@arcgis/core 4.32.0-next.20250101 → 4.32.0-next.20250103
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/Color.js +1 -1
- package/PopupTemplate.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/extendedUnitData.js +5 -0
- package/arcade/geometry/functions.js +5 -0
- package/arcade/geometry/operators.js +5 -0
- package/arcade/geometry/unitConversion.js +5 -0
- package/arcade/geometry/wkt.js +5 -0
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js → 005727711cca0614c2ab.js} +2 -2
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js.LICENSE.txt → 005727711cca0614c2ab.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{2d908c115ea18e813b95.js → 00c0fbe19c12691cf2c3.js} +1 -1
- package/assets/esri/core/workers/chunks/08e28328385066c519c2.js +1 -0
- package/assets/esri/core/workers/chunks/{0e735d01296d340b393e.js → 0b95ec12218f3c04df18.js} +1 -1
- package/assets/esri/core/workers/chunks/{59bf879b4802a5ba431e.js → 0ee669947c23f469e357.js} +1 -1
- package/assets/esri/core/workers/chunks/116103ecec27cce47a2f.js +1 -0
- package/assets/esri/core/workers/chunks/11f00218905f0db447ff.js +1 -0
- package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +1 -0
- package/assets/esri/core/workers/chunks/16d7c07e1c11b88dae84.js +1 -0
- package/assets/esri/core/workers/chunks/1d04fe800cb98e4d6bc4.js +1 -0
- package/assets/esri/core/workers/chunks/{71f6e5742cf0c482066b.js → 1dc6b5b177022b80c473.js} +1 -1
- package/assets/esri/core/workers/chunks/{59455e2dd44b4c01cc76.js → 2586741c359057b3f626.js} +1 -1
- package/assets/esri/core/workers/chunks/{250a810dd4e1ff293564.js → 318a39b56851e707edad.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js → 370b230fd2d7703d0698.js} +2 -2
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js.LICENSE.txt → 370b230fd2d7703d0698.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/38d03fe352057fb375b5.js +1 -0
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js → 42aa697b4718b75b8cb2.js} +2 -2
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js.LICENSE.txt → 42aa697b4718b75b8cb2.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{801dbea20966806db1c9.js → 53cd990b2c988518de6d.js} +1 -1
- package/assets/esri/core/workers/chunks/5a1eb0d1e25ff5574c43.js +1 -0
- package/assets/esri/core/workers/chunks/6157c49e7431f5868c77.js +1 -0
- package/assets/esri/core/workers/chunks/{eef2d94a73064f9bc085.js → 61d64f163840563017d5.js} +1 -1
- package/assets/esri/core/workers/chunks/6d218fb5e0f0a04d72c5.js +2 -0
- package/assets/esri/core/workers/chunks/{d82b3e2905cab511ff3a.js.LICENSE.txt → 6d218fb5e0f0a04d72c5.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/6ed57d01be6bc054c7cd.js +1 -0
- package/assets/esri/core/workers/chunks/7254956381e823219db0.js +1 -0
- package/assets/esri/core/workers/chunks/740e6bdb3b76f2ea6d61.js +1 -0
- package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{56fc353421252f2d0a99.js → 75e8ba7e02647b7216ae.js} +1 -1
- package/assets/esri/core/workers/chunks/89d7eec47e5b29935d92.js +1 -0
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +1 -0
- package/assets/esri/core/workers/chunks/{0b3e1e903120da297641.js → 932375de79e3d33bc4d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{263adfd1c2641ef5c0f5.js → 95f23bd17ce9e07fc8ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{7de9c01849c4aa1940e7.js → 986889cea53c4a470347.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc6160e8ab3cea4040c2.js → 9e9b2fd958e816b1b5f6.js} +1 -1
- package/assets/esri/core/workers/chunks/a57cead317eb2fc9afd8.js +1 -0
- package/assets/esri/core/workers/chunks/acec58a7f23b2cc938ee.js +1 -0
- package/assets/esri/core/workers/chunks/b0f4254d8a32dd713009.js +1 -0
- package/assets/esri/core/workers/chunks/b277b8c2f556918e4f9a.js +1 -0
- package/assets/esri/core/workers/chunks/{deffd56e39ce725ce377.js → b30046a40bcfbec8abe4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5c11e2e65b97565e5003.js → b7db64b07edb0b37ece1.js} +1 -1
- package/assets/esri/core/workers/chunks/bd1fb82e8bac439d05ea.js +1 -0
- package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/c44ce0302dc82fb66ada.js +1 -0
- package/assets/esri/core/workers/chunks/c52872a50a5989121388.js +1 -0
- package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +2 -0
- package/assets/esri/core/workers/chunks/{a100fb789d72410f8d4f.js.LICENSE.txt → c8cd6ba5600d8ff8db0b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{57c1370b310768c0790a.js → ca1e186f136abb23ae4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d14e4fc82ad772899336.js → ca4a37bdc0f7fb705146.js} +1 -1
- package/assets/esri/core/workers/chunks/cb94fc9b0f613ad50b3f.js +1 -0
- package/assets/esri/core/workers/chunks/d20764cc99fcabcb7cbf.js +1 -0
- package/assets/esri/core/workers/chunks/df18a72e3625cbe31935.js +1 -0
- package/assets/esri/core/workers/chunks/eff8fcb6393cd1193cbc.js +1 -0
- package/assets/esri/core/workers/chunks/f19d3c855f6e93544918.js +1 -0
- package/assets/esri/core/workers/chunks/{60b40b2319d1651dd150.js → f7e50a8284d12da21355.js} +1 -1
- package/assets/esri/core/workers/chunks/f9c0d571f62e611ffe2b.js +1 -0
- package/assets/esri/core/workers/chunks/fdfe8e0d942b78f08191.js +1 -0
- package/assets/esri/core/workers/chunks/ff21207f46a354786eed.js +1 -0
- package/chunks/Bufferer-BiY2mtjI.js +1 -1
- package/chunks/Centroid-DZi-eb9F.js +1 -1
- package/chunks/Clipper-a9xfvRaw.js +1 -1
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/Distance2DCalculator-eS0piaux.js +1 -1
- package/chunks/GeodeticDistanceCalculator-bNilDneE.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-DVgW95-D.js +1 -1
- package/chunks/Intersector-K1VmdfQW.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorDensify.js +1 -1
- package/chunks/OperatorDifference.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersection.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingDensify.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorSimplify.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorUnion.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SideCalculator2D-Bf4QCxCR.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tick.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/areaOperator.js +5 -0
- package/chunks/array.js +1 -1
- package/chunks/bufferOperator.js +5 -0
- package/chunks/centroidOperator.js +5 -0
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/clipOperator.js +5 -0
- package/chunks/containsOperator.js +5 -0
- package/chunks/convexHullOperator.js +5 -0
- package/chunks/crossesOperator.js +5 -0
- package/chunks/cutOperator.js +5 -0
- package/chunks/densifyOperator.js +5 -0
- package/chunks/differenceOperator.js +5 -0
- package/chunks/disjointOperator.js +5 -0
- package/chunks/distanceOperator.js +5 -0
- package/chunks/equalsOperator.js +5 -0
- package/chunks/generalizeOperator.js +5 -0
- package/chunks/geodesicBufferOperator.js +5 -0
- package/chunks/geodeticAreaOperator.js +5 -0
- package/chunks/geodeticDensifyOperator.js +5 -0
- package/chunks/geodeticLengthOperator.js +5 -0
- package/chunks/i3s.js +1 -1
- package/chunks/intersectionOperator.js +5 -0
- package/chunks/intersectsOperator.js +5 -0
- package/chunks/languageUtils.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lengthOperator.js +5 -0
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/offsetOperator.js +5 -0
- package/chunks/overlapsOperator.js +5 -0
- package/chunks/pe-wasm.js +1 -1
- package/chunks/proximityOperator.js +5 -0
- package/chunks/relateOperator.js +5 -0
- package/chunks/simplifyOperator.js +5 -0
- package/chunks/symmetricDifferenceOperator.js +5 -0
- package/chunks/touchesOperator.js +5 -0
- package/chunks/unionOperator.js +5 -0
- package/chunks/vxlLayer.js +1 -1
- package/chunks/withinOperator.js +5 -0
- package/copyright.txt +2 -2
- package/core/Evented.js +1 -1
- package/geometry/operators/areaOperator.js +1 -1
- package/geometry/operators/bufferOperator.js +1 -1
- package/geometry/operators/centroidOperator.js +1 -1
- package/geometry/operators/clipOperator.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/convexHullOperator.js +1 -1
- package/geometry/operators/crossesOperator.js +1 -1
- package/geometry/operators/cutOperator.js +1 -1
- package/geometry/operators/densifyOperator.js +1 -1
- package/geometry/operators/differenceOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/distanceOperator.js +1 -1
- package/geometry/operators/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.js +1 -1
- package/geometry/operators/geodesicBufferOperator.js +1 -1
- package/geometry/operators/geodeticAreaOperator.js +1 -1
- package/geometry/operators/geodeticDensifyOperator.js +1 -1
- package/geometry/operators/geodeticLengthOperator.js +1 -1
- package/geometry/operators/gx/operatorAffineTransform.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/intersectionOperator.js +1 -1
- package/geometry/operators/intersectsOperator.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/lengthOperator.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/overlapsOperator.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/operators/relateOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.js +1 -1
- package/geometry/operators/touchesOperator.js +1 -1
- package/geometry/operators/unionOperator.js +1 -1
- package/geometry/operators/withinOperator.js +1 -1
- package/geometry/support/contains.js +1 -1
- package/kernel.js +1 -1
- package/layers/KMLLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/symbology/support/Theme.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/assets/esri/core/workers/chunks/015285436ca965f94e17.js +0 -1
- package/assets/esri/core/workers/chunks/048d296efa26ccd79056.js +0 -1
- package/assets/esri/core/workers/chunks/0e0b978459d70b15acb5.js +0 -1
- package/assets/esri/core/workers/chunks/10fa211987b16fd71a1a.js +0 -1
- package/assets/esri/core/workers/chunks/200a5f1864c2c2f7536c.js +0 -1
- package/assets/esri/core/workers/chunks/23a697d48f6e45cc033e.js +0 -1
- package/assets/esri/core/workers/chunks/29b610ff44708e044cbd.js +0 -1
- package/assets/esri/core/workers/chunks/3600125c58d5d04c515a.js +0 -1
- package/assets/esri/core/workers/chunks/457d4abc938d14f28e31.js +0 -1
- package/assets/esri/core/workers/chunks/4b5dbdcad438cb2dd4bf.js +0 -1
- package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +0 -1
- package/assets/esri/core/workers/chunks/6e254e846e284223ef63.js +0 -1
- package/assets/esri/core/workers/chunks/785610aa615198fd3815.js +0 -1
- package/assets/esri/core/workers/chunks/7bf7aace72f81f5de4e4.js +0 -1
- package/assets/esri/core/workers/chunks/7ea3d652536e1d79dfc6.js +0 -1
- package/assets/esri/core/workers/chunks/816c9c81352cd0ca8ce8.js +0 -1
- package/assets/esri/core/workers/chunks/9291508232b23f030178.js +0 -1
- package/assets/esri/core/workers/chunks/9fc49968dea8e2b64f3e.js +0 -1
- package/assets/esri/core/workers/chunks/a0b3d70a1b0360084593.js +0 -1
- package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js +0 -2
- package/assets/esri/core/workers/chunks/b4d76d46661aba356ea3.js +0 -1
- package/assets/esri/core/workers/chunks/cb3af81e1fe6405c4885.js +0 -1
- package/assets/esri/core/workers/chunks/cbf57abb537e86c1dd7f.js +0 -1
- package/assets/esri/core/workers/chunks/cebdf2f88c4d2ad8baab.js +0 -1
- package/assets/esri/core/workers/chunks/d56d77125798beb7e493.js +0 -1
- package/assets/esri/core/workers/chunks/d82b3e2905cab511ff3a.js +0 -2
- package/assets/esri/core/workers/chunks/e2f91098793b8742fae6.js +0 -1
- package/assets/esri/core/workers/chunks/f25c04cf1a4bc1d2636a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{c as n,m as o,h as i,g as r,s}from"../../../../chunks/vec32.js";import{create as h,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{e as u,g as c,i as f,a as m,c as _}from"../../../../chunks/sphere.js";import{rayBoxTest as p}from"./Util.js";class b{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new g,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),g.clearPool(),q[0]=null,K.prune(),Q.prune()}add(t,e=t.length){this._objectCount+=e,this._grow(t,e);const n=g.acquire();for(let o=0;o<e;o++){const e=t[o];this._isDegenerate(e)?this._degenerateObjects.add(e):(n.init(this._root),this._add(e,n))}g.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=g.acquire();for(const o of t){const t=e??u(this.objectToBoundingSphere(o),J);C(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}g.release(n),this._shrink()}update(t,e){if(!C(e[3])&&this._isDegenerate(t))return;const n=y(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=d(t,e);S(this._root,(t=>{if(!T(o,t))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),!0}))}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=d(t,e);S(this._root,(t=>{if(!z(i,t,o))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),!0}))}forEach(t){S(this._root,(e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0})),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,s=1/0){let h=1/0,a=1/0,d=null;const u=F(t,e),c=i=>{if(--s,!o(i))return;const r=this.objectToBoundingSphere(i);if(!l(n,r))return;const u=v(t,e,m(r)),c=u-r[3],f=u+r[3];c<h&&(h=c,a=f,d=i)};return j(this._root,(o=>{if(s<=0||!l(n,o.bounds))return!1;i(I,u,o.halfSize),r(I,I,m(o.bounds));if(v(t,e,I)>a)return!1;const h=o.node;return h.terminals.forAll((t=>c(t))),null!==h.residents&&h.residents.forAll((t=>c(t))),!0}),t,e),d}forEachInDepthRange(t,e,n,o,s,h,a){let d=-1/0,u=1/0;const c={setRange:t=>{n===b.DepthOrder.FRONT_TO_BACK?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};c.setRange(o);const f=v(e,n,t),_=F(e,n),p=F(e,-n),g=t=>{if(!a(t))return;const o=this.objectToBoundingSphere(t),i=m(o),r=v(e,n,i)-f,_=r-o[3],p=r+o[3];_>u||p<d||!l(h,o)||s(t,c)};j(this._root,(t=>{if(!l(h,t.bounds))return!1;i(I,_,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f>u)return!1;i(I,p,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f<d)return!1;const o=t.node;return o.terminals.forAll((t=>g(t))),null!==o.residents&&o.residents.forAll((t=>g(t))),!0}),e,n)}forEachNode(t){S(this._root,(e=>t(e.node,e.bounds,e.halfSize,e.depth)))}forEachNeighbor(t,e){const n=c(e),o=m(e),i=e=>{const i=this.objectToBoundingSphere(e),r=c(i),h=n+r;return!(s(m(i),o)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=i(t))};S(this._root,(t=>{const e=c(t.bounds),i=n+e;if(s(m(t.bounds),o)-i*i>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r})),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=g.acquire().init(t);this._add(e.at(n),o),g.release(o)}}_grow(t,e){if(0!==e&&(D(t,e,(t=>this.objectToBoundingSphere(t)),W),C(W[3])&&!this._fitsInsideTree(W)))if(N(this._root.node))u(W,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(W);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(W,t):this._growRootAsSubNode(t),g.release(t)}}_rebuildTree(t,e){n(m(V),m(e.bounds)),V[3]=e.halfSize,D([t,V],2,(t=>t),G);const o=g.acquire().init(this._root);this._root.initFrom(null,G,G[3]),this._root.increaseHalfSize(1.25),S(o,(t=>(this.add(t.node.terminals.data,t.node.terminals.length),null!==t.node.residents&&this.add(t.node.residents.data,t.node.residents.length),!0))),g.release(o)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return S(this._root,(t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth))),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,r=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-r-(n[h]-e),s=n[h]+e-(i[h]+r),a=Math.max(0,Math.ceil(t/(2*r))),l=Math.max(0,Math.ceil(s/(2*r)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),U[h].min=a,U[h].max=l}for(let h=0;h<3;h++){let t=U[h].min,e=U[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const s=i[h]-r-t*r*2;k[h]=s+(e+t)*r}const s=o*r;return k[3]=s*w,g.acquire().initFrom(null,k,s,0)}_growRootAsSubNode(t){const e=this._root.node;n(m(W),m(this._root.bounds)),W[3]=this._root.halfSize,this._root.init(t),t.advanceTo(W,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!C(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map((t=>t?this._nodeToJSON(t):null)),n=t.residents?.map((t=>this.objectToBoundingSphere(t))),o=t.terminals?.map((t=>this.objectToBoundingSphere(t)));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new b((t=>t),{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class g{constructor(){this.bounds=_(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:g.createEmptyNode(),e&&u(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*w}advance(t){let e=this.node.children[t];e||(e=g.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=E[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e&&e(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static acquire(){return g._pool.acquire()}static release(t){g._pool.release(t)}static clearPool(){g._pool.prune()}}function S(t,e){let n=g.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(g.acquire().init(n).advance(t))}g.release(n)}}function j(t,e,n,o=b.DepthOrder.FRONT_TO_BACK){let i=g.acquire().init(t);const r=[i];for(R(n,o,X);0!==r.length;){if(i=r.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=X[t];i.node.children[e]&&r.push(g.acquire().init(i).advance(e))}g.release(i)}}function O(t,e,n){K.clear();const o=n.advanceTo(e,((t,e)=>{K.push(t.node),K.push(e)}))?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=K.length-2;i>=0;i-=2){if(!x(K.data[i],K.data[i+1]))break}}function x(t,n){return n>=0&&(t.children[n]=null),!!N(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function T(t,e){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),p(t.origin,t.direction,L,H)}function z(t,e,n){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),n.applyToMinMax(L,H),p(t.origin,t.direction,L,H)}function N(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function M(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function D(t,e,n,i){if(1===e){const e=n(t[0]);u(e,i)}else{L[0]=1/0,L[1]=1/0,L[2]=1/0,H[0]=-1/0,H[1]=-1/0,H[2]=-1/0;for(let o=0;o<e;o++){const e=n(t[o]);C(e[3])&&(M(L,e),A(H,e))}o(m(i),L,H,.5),i[3]=Math.max(H[0]-L[0],H[1]-L[1],H[2]-L[2])/2}}function R(t,e,n){if(!Q.length)for(let o=0;o<8;++o)Q.push({index:0,distance:0});for(let o=0;o<8;++o){const n=E[o];Q.data[o].index=o,Q.data[o].distance=v(t,e,n)}Q.sort(((t,e)=>t.distance-e.distance));for(let o=0;o<8;++o)n[o]=Q.data[o].index}function F(t,e){let n,o=1/0;for(let i=0;i<8;++i){const r=v(t,e,P[i]);r<o&&(o=r,n=P[i])}return n}function v(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function C(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}g._pool=new t(g),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(b||(b={}));const E=[a(-1,-1,-1),a(1,-1,-1),a(-1,1,-1),a(1,1,-1),a(-1,-1,1),a(1,-1,1),a(-1,1,1),a(1,1,1)],P=[a(-1,-1,-1),a(-1,-1,1),a(-1,1,-1),a(-1,1,1),a(1,-1,-1),a(1,-1,1),a(1,1,-1),a(1,1,1)],w=Math.sqrt(3),q=[null];function y(t){return q[0]=t,q}const k=_(),I=h(),L=h(),H=h(),K=new e,J=_(),W=_(),V=_(),G=_(),U=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],Q=new e,X=[0,0,0,0,0,0,0,0],Y=b;export{Y as default};
|
|
5
|
+
import t from"../../../../core/ObjectPool.js";import e from"../../../../core/PooledArray.js";import{c as n,m as o,h as i,g as r,s}from"../../../../chunks/vec32.js";import{create as h,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersectsSphere as l}from"../../../../geometry/support/frustum.js";import{wrap as d}from"../../../../geometry/support/ray.js";import{e as u,g as c,i as f,a as m,c as _}from"../../../../chunks/sphere.js";import{rayBoxTest as p}from"./Util.js";class b{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new g,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),g.clearPool(),q[0]=null,K.prune(),Q.prune()}add(t,e=t.length){this._objectCount+=e,this._grow(t,e);const n=g.acquire();for(let o=0;o<e;o++){const e=t[o];this._isDegenerate(e)?this._degenerateObjects.add(e):(n.init(this._root),this._add(e,n))}g.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=g.acquire();for(const o of t){const t=e??u(this.objectToBoundingSphere(o),J);C(t[3])?(n.init(this._root),O(o,t,n)):this._degenerateObjects.delete(o)}g.release(n),this._shrink()}update(t,e){if(!C(e[3])&&this._isDegenerate(t))return;const n=y(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const o=d(t,e);S(this._root,(t=>{if(!T(o,t))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObject(o,t)&&n(t)})),!0}))}forEachAlongRayWithVerticalOffset(t,e,n,o){const i=d(t,e);S(this._root,(t=>{if(!z(i,t,o))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObjectWithOffset(i,t,o)&&n(t)})),!0}))}forEach(t){S(this._root,(e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0})),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,o=()=>!0,s=1/0){let h=1/0,a=1/0,d=null;const u=F(t,e),c=i=>{if(--s,!o(i))return;const r=this.objectToBoundingSphere(i);if(!l(n,r))return;const u=v(t,e,m(r)),c=u-r[3],f=u+r[3];c<h&&(h=c,a=f,d=i)};return j(this._root,(o=>{if(s<=0||!l(n,o.bounds))return!1;i(I,u,o.halfSize),r(I,I,m(o.bounds));if(v(t,e,I)>a)return!1;const h=o.node;return h.terminals.forAll((t=>c(t))),null!==h.residents&&h.residents.forAll((t=>c(t))),!0}),t,e),d}forEachInDepthRange(t,e,n,o,s,h,a){let d=-1/0,u=1/0;const c={setRange:t=>{n===b.DepthOrder.FRONT_TO_BACK?(d=Math.max(d,t.near),u=Math.min(u,t.far)):(d=Math.max(d,-t.far),u=Math.min(u,-t.near))}};c.setRange(o);const f=v(e,n,t),_=F(e,n),p=F(e,-n),g=t=>{if(!a(t))return;const o=this.objectToBoundingSphere(t),i=m(o),r=v(e,n,i)-f,_=r-o[3],p=r+o[3];_>u||p<d||!l(h,o)||s(t,c)};j(this._root,(t=>{if(!l(h,t.bounds))return!1;i(I,_,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f>u)return!1;i(I,p,t.halfSize),r(I,I,m(t.bounds));if(v(e,n,I)-f<d)return!1;const o=t.node;return o.terminals.forAll((t=>g(t))),null!==o.residents&&o.residents.forAll((t=>g(t))),!0}),e,n)}forEachNode(t){S(this._root,(e=>t(e.node,e.bounds,e.halfSize,e.depth)))}forEachNeighbor(t,e){const n=c(e),o=m(e),i=e=>{const i=this.objectToBoundingSphere(e),r=c(i),h=n+r;return!(s(m(i),o)-h*h<=0)||t(e)};let r=!0;const h=t=>{r&&(r=i(t))};S(this._root,(t=>{const e=c(t.bounds),i=n+e;if(s(m(t.bounds),o)-i*i>0)return!1;const a=t.node;return a.terminals.forAll(h),r&&null!==a.residents&&a.residents.forAll(h),r})),r&&this.forEachDegenerateObject(h)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||f(n,t)}_intersectsObjectWithOffset(t,e,n){const o=this.objectToBoundingSphere(e);return!(o[3]>0)||f(n.applyToBoundingSphere(o),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const o=g.acquire().init(t);this._add(e.at(n),o),g.release(o)}}_grow(t,e){if(0!==e&&(D(t,e,(t=>this.objectToBoundingSphere(t)),W),C(W[3])&&!this._fitsInsideTree(W)))if(N(this._root.node))u(W,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(W);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(W,t):this._growRootAsSubNode(t),g.release(t)}}_rebuildTree(t,e){n(m(V),m(e.bounds)),V[3]=e.halfSize,D([t,V],2,(t=>t),G);const o=g.acquire().init(this._root);this._root.initFrom(null,G,G[3]),this._root.increaseHalfSize(1.25),S(o,(t=>(this.add(t.node.terminals.data,t.node.terminals.length),null!==t.node.residents&&this.add(t.node.residents.data,t.node.residents.length),!0))),g.release(o)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return S(this._root,(t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth))),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let o=-1/0;const i=this._root.bounds,r=this._root.halfSize;for(let h=0;h<3;h++){const t=i[h]-r-(n[h]-e),s=n[h]+e-(i[h]+r),a=Math.max(0,Math.ceil(t/(2*r))),l=Math.max(0,Math.ceil(s/(2*r)))+1,d=2**Math.ceil(Math.log(a+l)*Math.LOG2E);o=Math.max(o,d),U[h].min=a,U[h].max=l}for(let h=0;h<3;h++){let t=U[h].min,e=U[h].max;const n=(o-(t+e))/2;t+=Math.ceil(n),e+=Math.floor(n);const s=i[h]-r-t*r*2;k[h]=s+(e+t)*r}const s=o*r;return k[3]=s*w,g.acquire().initFrom(null,k,s,0)}_growRootAsSubNode(t){const e=this._root.node;n(m(W),m(this._root.bounds)),W[3]=this._root.halfSize,this._root.init(t),t.advanceTo(W,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,o=0;for(;o<e.length&&null==t;)n=o++,t=e[n];for(;o<e.length;)if(e[o++])return-1;return n}_isDegenerate(t){return!C(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,o=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:o}}}_nodeToJSON(t){const e=t.children.map((t=>t?this._nodeToJSON(t):null)),n=t.residents?.map((t=>this.objectToBoundingSphere(t))),o=t.terminals?.map((t=>this.objectToBoundingSphere(t)));return{children:e,residents:n,terminals:o}}static fromJSON(t){const e=new b((t=>t),{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class g{constructor(){this.bounds=_(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,o=this.depth){return this.node=null!=t?t:g.createEmptyNode(),e&&u(e,this.bounds),this.halfSize=n,this.depth=o,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*w}advance(t){let e=this.node.children[t];e||(e=g.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=E[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const o=this._childIndex(t);e&&e(this,o),this.advance(o)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new e({shrink:!0}),residents:new e({shrink:!0})}}static acquire(){return g._pool.acquire()}static release(t){g._pool.release(t)}static clearPool(){g._pool.prune()}}function S(t,e){let n=g.acquire().init(t);const o=[n];for(;0!==o.length;){if(n=o.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++){n.node.children[t]&&o.push(g.acquire().init(n).advance(t))}g.release(n)}}function j(t,e,n,o=b.DepthOrder.FRONT_TO_BACK){let i=g.acquire().init(t);const r=[i];for(R(n,o,X);0!==r.length;){if(i=r.pop(),e(i)&&!i.isLeaf())for(let t=7;t>=0;--t){const e=X[t];i.node.children[e]&&r.push(g.acquire().init(i).advance(e))}g.release(i)}}function O(t,e,n){K.clear();const o=n.advanceTo(e,((t,e)=>{K.push(t.node),K.push(e)}))?n.node.terminals:n.node.residents;if(o.removeUnordered(t),0===o.length)for(let i=K.length-2;i>=0;i-=2){if(!x(K.data[i],K.data[i+1]))break}}function x(t,n){return n>=0&&(t.children[n]=null),!!N(t)&&(null===t.residents&&(t.residents=new e({shrink:!0})),!0)}function T(t,e){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),p(t.origin,t.direction,L,H)}function z(t,e,n){return B(m(e.bounds),2*-e.halfSize,L),B(m(e.bounds),2*e.halfSize,H),n.applyToMinMax(L,H),p(t.origin,t.direction,L,H)}function N(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function M(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function A(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function B(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function D(t,e,n,i){if(1===e){const e=n(t[0]);u(e,i)}else{L[0]=1/0,L[1]=1/0,L[2]=1/0,H[0]=-1/0,H[1]=-1/0,H[2]=-1/0;for(let o=0;o<e;o++){const e=n(t[o]);C(e[3])&&(M(L,e),A(H,e))}o(m(i),L,H,.5),i[3]=Math.max(H[0]-L[0],H[1]-L[1],H[2]-L[2])/2}}function R(t,e,n){if(!Q.length)for(let o=0;o<8;++o)Q.push({index:0,distance:0});for(let o=0;o<8;++o){const n=E[o];Q.data[o].index=o,Q.data[o].distance=v(t,e,n)}Q.sort(((t,e)=>t.distance-e.distance));for(let o=0;o<8;++o)n[o]=Q.data[o].index}function F(t,e){let n,o=1/0;for(let i=0;i<8;++i){const r=v(t,e,P[i]);r<o&&(o=r,n=P[i])}return n}function v(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function C(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}g._pool=new t(g),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(b);const E=[a(-1,-1,-1),a(1,-1,-1),a(-1,1,-1),a(1,1,-1),a(-1,-1,1),a(1,-1,1),a(-1,1,1),a(1,1,1)],P=[a(-1,-1,-1),a(-1,-1,1),a(-1,1,-1),a(-1,1,1),a(1,-1,-1),a(1,-1,1),a(1,1,-1),a(1,1,1)],w=Math.sqrt(3),q=[null];function y(t){return q[0]=t,q}const k=_(),I=h(),L=h(),H=h(),K=new e,J=_(),W=_(),V=_(),G=_(),U=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],Q=new e,X=[0,0,0,0,0,0,0,0];export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as f,isSubtypeSublayer as g}from"../layers/support/layerUtils.js";import _ from"../rest/support/Query.js";import{isSelectableLayer as m}from"./support/selectionUtils.js";let y=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new i,this._trashCan=[],this._layerEditHandles=new i,this._vizTaskId=0,this.showHighlight=!0,this.highlightGroup="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new i;this.view.when().then((()=>{this.view.map&&(this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(m(t)&&!f(t)||g(t))&&e.add(t)})),this.sources=e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}async getSelectedFeatures(e,t={},s="layerView"){const{view:i,selections:o}=this,n=(void 0!==e?o.filter((t=>e.includes(t.layer))):o).filter((e=>e.selection.length>0)).map((async e=>{const{layer:o,selection:n}=e,l=g(o)?o.parent:o;if(null==l||!S(l))return null;if("layer"===s)return M(l,n,t);if(v(l))return null;const r=await i.whenLayerView(l).catch((()=>null));return r?M(r,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let i=!1;const o=e.current.concat(e.added);for(const t of o){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==o){const t=l(s,e,(()=>[]));t.includes(o)||(t.push(o),i=!0)}}for(const t of e.removed){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==o){const t=s.get(e),n=t?.indexOf(o);void 0!==n&&n>=0&&(t?.splice(n,1),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,l]of s){const s=e.get(n);void 0!==s&&i.push(s),e.set(n,{selection:l}),o.push({layer:n,selection:l,...t(void 0!==s?s.selection:[],l)})}this._onSelectionChange(o)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),i=void 0!==s?[...s.selection]:[];for(const o of t)i.includes(o)||i.push(o);this._setSelection(e,i)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[];for(const o of s.selection)t.includes(o)||i.push(o);this._setSelection(e,i)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const i=new Set(s.selection),o=new Set(t),n=u(i,o);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:i}=this,o=this._vizTaskId;for(const n of e){const e=s.get(n),l=g(n)?n.parent:n;if(null!=l&&S(l)){if(v(l))continue;t.whenLayerView(l).then((t=>{e?.highlightHandle?.remove(),null!=e&&i&&o===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightGroup))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=g(e)?e.parent:e;if(null!=t&&m(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const i=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,i)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(void 0===i||!j(i,{selection:s})){void 0!==i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...s]});const o={layer:e,selection:[...s],...t(void 0!==i?i.selection:[],s)};this._onSelectionChange([o])}}};e([p({readOnly:!0,nonNullable:!0})],y.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],y.prototype,"count",null),e([p({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],y.prototype,"hasSelection",null),e([p()],y.prototype,"showHighlight",void 0),e([p()],y.prototype,"sources",null),e([p()],y.prototype,"highlightGroup",void 0),y=e([d("esri.views.SelectionManager")],y);const v=e=>g(e)?!0===e.parent?.isTable:e.isTable,w=e=>void 0!==e.layer,S=e=>void 0!==e?.when,j=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},M=async(e,t,s={})=>{let i;if(w(e)){const o=e;i=void 0===o?null:await o.queryFeatures(new _({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const o=e;i=void 0===o?null:await o.queryFeatures(new _({...s,objectIds:t})).then((e=>({data:e,layer:o})))}return i},b=y;export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import"../core/has.js";import{abortHandle as t}from"../core/handleUtils.js";import{watch as n,whenOnce as i}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as s,getVisibleFieldInputValidationErrorMessage as l}from"./BatchAttributeForm/batchAttributeFormUtils.js";import d from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as u}from"./BatchAttributeForm/css.js";import{VisibleElements as p}from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as c,isFieldInput as m}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as v,prepareISOFieldValueForDateComponents as C,prepareUnixFieldValueForDateComponents as _,normalizeTimeOnlyString as b,getISOFieldValueFromDateComponents as f,getUnixFieldValueFromDateComponents as g}from"./support/dateUtils.js";import{globalCss as F}from"./support/globalCss.js";import{Heading as y}from"./support/Heading.js";import{setFocus as I}from"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";import{substitute as O}from"../intl/substitute.js";const M="data-element-id";let T=class extends r{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.readOnly=!1,this.viewModel=new d,this.visibleElements=new p,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.features),(()=>{this._dateComponentMap.clear();const e=new AbortController;i((()=>!this.viewModel.updating),e.signal).then((()=>{this._attemptFocusOnNextRender=!0})),this.addHandles(t(e))}))])}loadDependencies(){return h({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}render(){const{status:e}=this.viewModel;return"failed"===e?w("div",null,this.messages.formFailedToLoad):w("div",{class:this.classes(u.base,F.widget,F.panel)},"loaded"===e?this._renderForm():"loading"===e?w("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}_renderForm(){return w("form",{onsubmit:this._onFormSubmit},this._renderHeader(),this._renderInvisibleFieldsError(),this._renderContent())}_renderHeader(){const e=this.viewModel.activeForm.title,t=this.viewModel.activeForm.description,n=e?w(y,{key:"title",level:this.headingLevel},e):null,i=t?w("p",{key:"description"},t):null;return e||t?w("div",null,n,i):null}_renderInvisibleFieldsError(){const{hasNonActiveInvalidFeatures:e,activeForm:t}=this.viewModel;let n;return t.invalidHiddenInputs.length>0?n=s(t,this.messages):e&&(n=this.messages.validationErrors.featuresInError),n?w("calcite-notice",{class:u.noticeError,icon:!0,kind:"warning",open:!0},w("div",{slot:"message"},n)):null}_renderContent(){const{inputs:e}=this.viewModel.activeForm;return e.filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return c(e)?this._renderGroupInput(e):m(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:n}=e,i=t.filter((e=>e.visible)),o=n.label??"";return w("calcite-block",{class:this.classes(u.group,u.groupSequential,u.block),collapsible:!0,description:n.description??void 0,disabled:!1,heading:o,headingLevel:this.headingLevel,key:`{${n.elementId}-key}`,label:o,open:!0},i.map((e=>this._renderInput(e))))}_renderLabeledField(e){const{label:t,elementId:n}=e.template,{required:i,dataType:o}=e,a=i?O(this.messages.requiredFieldLabel,{name:t}):t;return w("calcite-label",{"aria-label":a,class:u.label,key:`field--${n}`},w("div",{class:u.labelTextContent,key:"labelTextContainer"},t,i?w("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==o?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{template:n,dataType:i}=e;if("date"===i)return this._renderDateComponents(e,t);if("coded-value"===n.field.domain?.type){const{domain:i}=n.field;return this._renderCodedInputs({input:e,domain:i,props:t})}return"number"===i?this._renderNumberComponent(t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:n,submittable:i}=e,o=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?l(e,t,this.messages):null;return o?w("calcite-input-message",{icon:!0,status:"invalid"},o):n?w("calcite-input-message",{class:u.description},n):null}_renderCodedInputs({input:e,domain:t,props:n}){const i=e.template.input?.type??null,o=this.viewModel.getCodedValueOptions(t);switch(i){case"combo-box":return this._renderComboBoxComponent({options:o,props:n});case"switch":return this._renderSwitchComponent(n);case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o,props:n});default:return null}}_renderSwitchComponent(e){return w("calcite-switch",{...e,checked:!1,class:u.inputSwitch,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:t=>this._saveInput(e[M],t.currentTarget.value)})}_renderComboBoxComponent({options:e,props:t}){const n=e.map((e=>this.renderComboboxItem({value:`${e.value}`,text:e.name,selected:t.value===e.value})));return w("calcite-combobox",{...t,selectionMode:"single",value:t.value,onCalciteComboboxChange:e=>{const n=Array.isArray(e.currentTarget.value)?e.currentTarget.value[0]:e.currentTarget.value;this._saveInput(t[M],n)}},n)}renderComboboxItem({text:e,value:t,selected:n}){return w("calcite-combobox-item",{key:t,selected:n,textLabel:e,value:t})}_renderRadioButtonGroupComponent({input:e,options:t,props:n}){const i=t.map((({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:n})));return w("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:u.inputRadioGroup,key:`${n.key}-radio-group`,layout:"vertical",name:n.name,required:n.required},n.placeholder===this.messages.differentValues?w("calcite-label",{class:u.placeholderRadio,key:n.label,layout:"inline"},w("calcite-radio-button",{checked:!0,disabled:!0,name:n.placeholder,value:n.placeholder}),n.placeholder):null,i)}_renderRadioButtons({value:e,selected:t,label:n,props:i}){return w("calcite-label",{class:u.inputRadioLabel,key:i.label,layout:"inline"},w("calcite-radio-button",{...i,checked:t,class:u.inputRadio,disabled:i.readOnly,name:i.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(i[M],e.value)}}),n)}_renderStringComponent(e,t){const{template:n}=e;return n.field.editable?n.input&&"text-area"===n.input.type?w("calcite-text-area",{...t,class:this.classes(u.group,u.groupSequential,u.individualElement),resize:"vertical",value:t.value?t.value:void 0,onCalciteTextAreaInput:e=>this._saveInput(t[M],e.currentTarget.value)}):w("calcite-input",{...t,class:this.classes(u.group,u.groupSequential,u.individualElement),type:"text",value:t.value?t.value:void 0,onCalciteInputInput:e=>this._saveInput(t[M],e.currentTarget.value)}):this._renderReadOnlyComponent(e)}_renderNumberComponent(e){return w("calcite-input-number",{...e,type:"number",value:e.value?e.value:void 0,onCalciteInputNumberInput:t=>this._saveInput(e[M],t.currentTarget.value)})}_renderReadOnlyComponent(e,t){const n=this.getCommonInputProps(e);return w("calcite-input",{...n,class:this.classes(u.fieldInput,u.inputDisabled,u.individualElement),readOnly:!0,type:"text",value:null!=t?t:n.value})}_renderDateComponents(e,t){const{type:n}=e.field;switch(n){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,v(e.field,t.value))}}_renderDateOnlyFieldComponent(e,t){const{class:n,key:i}=t;return w("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:n,"data-date-part":"date","data-element-id":t[M],key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",value:e.value?e.value:void 0,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:n,key:i}=t;return w("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:n,"data-date-part":"time","data-element-id":t[M],key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",value:e.value?e.value:void 0,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:n,key:i,readOnly:o}=t,a=C(e.value),r=e.includeTimeOffset,s={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[M]:t[M],onfocus:this._onComponentFocus};return w("div",{class:u.dateInputContainer,key:`${i}-date-time-container`},w("calcite-input-date-picker",{...s,class:n,"data-date-part":"date",key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},value:a.date??void 0,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),w("calcite-input-time-picker",{...s,class:n,"data-date-part":"time",key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:a.time??void 0,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),r?w("calcite-input-time-zone",{...s,class:n,"data-date-part":"timeZone",key:`${i}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:a.timeZoneOffset??"0",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:n,key:i,readOnly:o}=t,a=_(e.value),r=e.includeTime,s={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[M]:t[M],onfocus:this._onComponentFocus};return w("div",{class:u.dateInputContainer,key:`${i}-date-time-container`},w("calcite-input-date-picker",{...s,class:n,"data-date-part":"date",key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},value:a.date??void 0,onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),r?w("calcite-input-time-picker",{...s,"data-date-part":"time",key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:a.time??void 0,onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}getCommonInputProps(e){const{disabled:t}=this,{template:n,valid:i,value:o,minLength:a,maxLength:r,required:s,fieldName:l,editable:d,userHasChangedValue:p}=e,c=!d||t;let m=n.hint??void 0,h=!1;return"esri_BatchAttributeForm_different_values"===o&&(m=this.messages.differentValues,h=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(u.fieldInput,c?u.inputDisabled:null),status:p&&!i?"invalid":"idle",maxLength:r&&r>-1?r:void 0,minLength:a&&a>-1?a:void 0,key:n.elementId,label:l,name:l,readOnly:c,onblur:this._onComponentBlur,required:s,placeholder:m,value:h||null==o?"":o,[M]:n.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(M))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,n=e.querySelector("calcite-radio-button"),i=t||n;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,n=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(n.template.elementId),this._focusedFieldInput=n}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),n=this._focusedFieldInput;this._attemptFocusOnNextRender&&n===t&&(this._attemptFocusOnNextRender=!1,I(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){return null==t||""===t?null:"number"===e.dataType?"-0"===t||"-0."===t||"-0,"===t?t:parseFloat(t):"date"===e.field.type?parseFloat(t):t}_saveInput(e,t){const n=this.viewModel.findFieldInput(e);if(!n)return;const i=n?.value,o=this._parseValue(n,t);o!==i&&this.viewModel.setValue(e,o)}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:n}=t.template,i=e.dataset.datePart,o=this._dateComponentMap.get(`${n}`);if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(`${n}`,{[i]:e});this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:n}=e.template,i=e.field.type,o=this._dateComponentMap.get(`${n}`);if(!o)return;let a=e.value,r=null;"date-only"===i?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(a=b(a),r=b(t.value)):r="timestamp-offset"===i?null!=t.value?f({dateComponent:o.date,timeComponent:o.time,oldValue:a,timeZoneComponent:o.timeZone}):null:null!=t.value?g({oldValue:a,dateComponent:o.date,timeComponent:o.time}):null,a!==r&&(null!==r&&t.value?this.viewModel.setValue(`${n}`,r):this.viewModel.setValue(`${n}`,null))}};e([o()],T.prototype,"activeFeatureIndex",null),e([o()],T.prototype,"disabled",null),e([o()],T.prototype,"features",null),e([o()],T.prototype,"headingLevel",void 0),e([o()],T.prototype,"icon",null),e([o(),k("esri/t9n/common")],T.prototype,"messagesCommon",void 0),e([o(),k("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],T.prototype,"messages",void 0),e([o()],T.prototype,"readOnly",void 0),e([o(),x(["value-change","submit"])],T.prototype,"viewModel",void 0),e([o({type:p,nonNullable:!0})],T.prototype,"visibleElements",void 0),T=e([a("esri.widgets.BatchAttributeForm")],T);const U=T;export{U as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import"../core/has.js";import{abortHandle as t}from"../core/handleUtils.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{watch as i,whenOnce as o}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import s from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as l,getVisibleFieldInputValidationErrorMessage as d}from"./BatchAttributeForm/batchAttributeFormUtils.js";import p from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as u}from"./BatchAttributeForm/css.js";import{VisibleElements as c}from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as m,isFieldInput as h,differentValuesString as v}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as b,prepareISOFieldValueForDateComponents as _,prepareUnixFieldValueForDateComponents as f,normalizeTimeOnlyString as g,getISOFieldValueFromDateComponents as F,getUnixFieldValueFromDateComponents as y}from"./support/dateUtils.js";import{globalCss as I}from"./support/globalCss.js";import{Heading as k}from"./support/Heading.js";import{setFocus as x}from"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as D}from"./support/jsxFactory.js";import{substitute as O}from"../intl/substitute.js";const M="data-element-id";let U=class extends s{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.readOnly=!1,this.viewModel=new p,this.visibleElements=new c,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentUpdate=this._afterDateComponentUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([i((()=>this.features),(()=>{this._dateComponentMap.clear();const e=new AbortController;o((()=>!this.viewModel.updating),e.signal).then((()=>{this._attemptFocusOnNextRender=!0})),this.addHandles(t(e))}))])}loadDependencies(){return C({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}render(){const{status:e}=this.viewModel;return"failed"===e?D("div",null,this.messages.formFailedToLoad):D("div",{class:this.classes(u.base,I.widget,I.panel)},"loaded"===e?this._renderForm():"loading"===e?D("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,o=this._getCalciteElementFromDateTimeTimeZonePicker(e,t);if(!o)return;const a=n(this._dateComponentMap,`${i}`,(()=>({placeholder:{date:"",time:"",timeZone:""}})));switch(a.placeholder[t]=o.placeholder??"",t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e,a.defaultComboboxItemElements=o.selectedItems}"timeZone"===t&&(a.defaultComboboxItemElements=o.selectedItems)}_getCalciteElementFromDateTimeTimeZonePicker(e,t){const n=e.shadowRoot;return n?"timeZone"===t?n.querySelector("calcite-combobox"):n.querySelector("calcite-input-text"):null}_updateDateTimeOrTimeZoneShadowDom(e,t){const{datePart:n,elementId:i}=e.dataset,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=this._getCalciteElementFromDateTimeTimeZonePicker(e,n);if(a)switch(n){case"date":case"time":a.placeholder=t?this.messages.differentValues:o.placeholder[n];break;case"timeZone":t?(a.value="",a.placeholder=this.messages.differentValues):(!a.selectedItems.length&&o.defaultComboboxItemElements?.length&&(a.selectedItems[0]=o.defaultComboboxItemElements[0]),a.placeholder=o.placeholder[n])}}_renderForm(){return D("form",{onsubmit:this._onFormSubmit},this._renderHeader(),this._renderInvisibleFieldsError(),this._renderContent())}_renderHeader(){const e=this.viewModel.activeForm.title,t=this.viewModel.activeForm.description,n=e?D(k,{key:"title",level:this.headingLevel},e):null,i=t?D("p",{key:"description"},t):null;return e||t?D("div",null,n,i):null}_renderInvisibleFieldsError(){const{hasNonActiveInvalidFeatures:e,activeForm:t}=this.viewModel;let n;return t.invalidHiddenInputs.length>0?n=l(t,this.messages):e&&(n=this.messages.validationErrors.featuresInError),n?D("calcite-notice",{class:u.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},n)):null}_renderContent(){const{inputs:e}=this.viewModel.activeForm;return e.filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return m(e)?this._renderGroupInput(e):h(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:n}=e,i=t.filter((e=>e.visible)),o=n.label??"";return D("calcite-block",{class:this.classes(u.group,u.groupSequential,u.block),collapsible:!0,description:n.description??void 0,disabled:!1,heading:o,headingLevel:this.headingLevel,key:`{${n.elementId}-key}`,label:o,open:!0},i.map((e=>this._renderInput(e))))}_renderLabeledField(e){const{label:t,elementId:n}=e.template,{required:i,dataType:o}=e,a=i?O(this.messages.requiredFieldLabel,{name:t}):t;return D("calcite-label",{"aria-label":a,class:u.label,key:`field--${n}`},D("div",{class:u.labelTextContent,key:"labelTextContainer"},t,i?D("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==o?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{template:n,dataType:i}=e;if("date"===i)return this._renderDateComponents(e,t);if("coded-value"===n.field.domain?.type){const{domain:i}=n.field;return this._renderCodedInputs({input:e,domain:i,props:t})}return"number"===i?this._renderNumberComponent(t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:n,submittable:i}=e,o=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?d(e,t,this.messages):null;return o?D("calcite-input-message",{icon:!0,status:"invalid"},o):n?D("calcite-input-message",{class:u.description},n):null}_renderCodedInputs({input:e,domain:t,props:n}){const i=e.template.input?.type??null,o=this.viewModel.getCodedValueOptions(t);switch(i){case"combo-box":return this._renderComboBoxComponent({options:o,props:n});case"switch":return this._renderSwitchComponent(n);case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o,props:n});default:return null}}_renderSwitchComponent(e){return D("calcite-switch",{...e,checked:!1,class:u.inputSwitch,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:t=>this._saveInput(e[M],t.currentTarget.value)})}_renderComboBoxComponent({options:e,props:t}){const n=e.map((e=>this.renderComboboxItem({value:`${e.value}`,text:e.name,selected:t.value===e.value})));return D("calcite-combobox",{...t,selectionMode:"single",value:t.value,onCalciteComboboxChange:e=>{const n=Array.isArray(e.currentTarget.value)?e.currentTarget.value[0]:e.currentTarget.value;this._saveInput(t[M],n)}},n)}renderComboboxItem({text:e,value:t,selected:n}){return D("calcite-combobox-item",{key:t,selected:n,textLabel:e,value:t})}_renderRadioButtonGroupComponent({input:e,options:t,props:n}){const i=t.map((({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:n})));return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:u.inputRadioGroup,key:`${n.key}-radio-group`,layout:"vertical",name:n.name,required:n.required},n.placeholder===this.messages.differentValues?D("calcite-label",{class:u.placeholderRadio,key:n.label,layout:"inline"},D("calcite-radio-button",{checked:!0,disabled:!0,name:n.placeholder,value:n.placeholder}),n.placeholder):null,i)}_renderRadioButtons({value:e,selected:t,label:n,props:i}){return D("calcite-label",{class:u.inputRadioLabel,key:i.label,layout:"inline"},D("calcite-radio-button",{...i,checked:t,class:u.inputRadio,disabled:i.readOnly,name:i.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(i[M],e.value)}}),n)}_renderStringComponent(e,t){const{template:n}=e;return n.field.editable?n.input&&"text-area"===n.input.type?D("calcite-text-area",{...t,class:this.classes(u.group,u.groupSequential,u.individualElement),resize:"vertical",value:t.value??"",onCalciteTextAreaInput:e=>this._saveInput(t[M],e.currentTarget.value)}):D("calcite-input",{...t,class:this.classes(u.group,u.groupSequential,u.individualElement),type:"text",value:t.value??"",onCalciteInputInput:e=>this._saveInput(t[M],e.currentTarget.value)}):this._renderReadOnlyComponent(e)}_renderNumberComponent(e){return D("calcite-input-number",{...e,type:"number",value:e.value??"",onCalciteInputNumberInput:t=>this._saveInput(e[M],t.currentTarget.value)})}_renderReadOnlyComponent(e,t){const n=this.getCommonInputProps(e);return D("calcite-input",{...n,class:this.classes(u.fieldInput,u.inputDisabled,u.individualElement),readOnly:!0,type:"text",value:t??n.value??""})}_renderDateComponents(e,t){const{type:n}=e.field;switch(n){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,b(e.field,t.value))}}_renderDateOnlyFieldComponent(e,t){const{class:n,key:i}=t;return D("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:n,"data-date-part":"date","data-element-id":t[M],key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",value:e.value===v?"":e.value??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:n,key:i}=t;return D("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:n,"data-date-part":"time","data-element-id":t[M],key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",value:e.value===v?"":e.value??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:n,key:i,readOnly:o}=t,a=_(e.value===v?"":e.value),r=e.includeTimeOffset,s={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:o,[M]:t[M],onfocus:this._onComponentFocus};return D("div",{class:u.dateInputContainer,key:`${i}-date-time-container`},D("calcite-input-date-picker",{...s,class:n,"data-date-part":"date",key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},value:a.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),D("calcite-input-time-picker",{...s,class:n,"data-date-part":"time",key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:a.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),r?D("calcite-input-time-zone",{...s,class:n,"data-date-part":"timeZone",key:`${i}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:a.timeZoneOffset??"0",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:n,key:i,readOnly:o}=t,a=f(e.value===v?"":e.value),r=e.includeTime,s={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:o,[M]:t[M],onfocus:this._onComponentFocus};return D("div",{class:u.dateInputContainer,key:`${i}-date-time-container`},D("calcite-input-date-picker",{...s,class:n,"data-date-part":"date",key:`${i}-date-input`,onblur:()=>{this._focusedFieldInput=null},value:a.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),r?D("calcite-input-time-picker",{...s,"data-date-part":"time",key:`${i}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:a.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}getCommonInputProps(e){const{disabled:t}=this,{template:n,valid:i,value:o,minLength:a,maxLength:r,required:s,fieldName:l,editable:d,userHasChangedValue:p}=e,c=!d||t;let m=n.hint??void 0,h=!1;return o===v&&(m=this.messages.differentValues,h=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(u.fieldInput,c?u.inputDisabled:null),status:p&&!i?"invalid":"idle",maxLength:r&&r>-1?r:void 0,minLength:a&&a>-1?a:void 0,key:n.elementId,label:l,name:l,readOnly:c,onblur:this._onComponentBlur,required:s,placeholder:m,value:h||null==o?"":o,[M]:n.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(M))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,n=e.querySelector("calcite-radio-button"),i=t||n;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,n=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(n.template.elementId),this._focusedFieldInput=n}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),n=this._focusedFieldInput;this._attemptFocusOnNextRender&&n===t&&(this._attemptFocusOnNextRender=!1,x(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){return null==t||""===t?null:"number"===e.dataType?"-0"===t||"-0."===t||"-0,"===t?t:parseFloat(t):"date"===e.field.type?parseFloat(t):t}_saveInput(e,t){const n=this.viewModel.findFieldInput(e);if(!n)return;const i=n?.value,o=this._parseValue(n,t);o!==i&&this.viewModel.setValue(e,o)}async _afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._setDateTimeTimeZoneMap(e),this._updateDateTimeOrTimeZoneShadowDom(e,t.value===v),this._afterComponentCreateOrUpdate(e)}async _afterDateComponentUpdate(e){const{value:t}=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._updateDateTimeOrTimeZoneShadowDom(e,t===v),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:n}=e.template,i=e.field.type,o=this._dateComponentMap.get(`${n}`);if(!o)return;let a=e.value===v?void 0:e.value,r=null;"date-only"===i?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(a=g(a),r=g(t.value)):r="timestamp-offset"===i?null!=t.value?F({dateComponent:o.date,timeComponent:o.time,oldValue:a,timeZoneComponent:o.timeZone}):null:null!=t.value?y({oldValue:a,dateComponent:o.date,timeComponent:o.time?.value===v?void 0:o.time}):null,a!==r&&(null!==r&&t.value?this.viewModel.setValue(`${n}`,r):this.viewModel.setValue(`${n}`,null))}};e([a()],U.prototype,"activeFeatureIndex",null),e([a()],U.prototype,"disabled",null),e([a()],U.prototype,"features",null),e([a()],U.prototype,"headingLevel",void 0),e([a()],U.prototype,"icon",null),e([a(),w("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([a(),w("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],U.prototype,"messages",void 0),e([a()],U.prototype,"readOnly",void 0),e([a(),T(["value-change","submit"])],U.prototype,"viewModel",void 0),e([a({type:c,nonNullable:!0})],U.prototype,"visibleElements",void 0),U=e([r("esri.widgets.BatchAttributeForm")],U);const j=U;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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,b=/(\{([^{\r\n]+)\})/g,h=/'/g,I=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function E({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):await t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function v(e=""){if(e)return!N.test(e.trim().toLowerCase())}function x(e){return!!e&&I.test(e)}function C(e,t){if(!t||!x(t)||!e)return;const n=t.replace(I,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function U(e,t){const n=C(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function q(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function A(e){return e.replaceAll(g,"")}function M(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>M(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:P(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(A(t(t(n,(e=>q(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(h,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function Q(e,t){return e.replaceAll(b,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function P(e,t,n){const r=Q(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"subtype-sublayer"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return!!(e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"type"in e)&&("subtype-sublayer"===e.type&&"parent"in e&&e.parent&&"object"==typeof e.parent?"globalIdField"in e.parent:"globalIdField"in e)}function K(e){return H(e)&&B(e)}function V(e){return H(e)&&J(e)}function W(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&K(e.sourceLayer)}function X(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=te(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?Y(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ue(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function Y(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?ee(e,",",", ",t):e.includes(";")?ee(e,";","; ",t):e.includes(" ")?ee(e," "," ",t):i(Number(e),o(t))}function ee(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function te(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ne({fieldName:e,graphic:t,layer:n}){if(ye(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function re({fieldName:e,value:t,graphic:n,layer:r}){if(ye(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});return i&&"coded-value"===i.type?i.getName(t):null}function ie(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function oe(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=M(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function ae(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function le(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ue(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function se(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=re({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=ne({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return X(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ue(t)}function fe({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>be({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=se({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function ce(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function de(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function pe({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await de(t);if(f&&!d)return;const p=await ce({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function ye(e=""){return!!e&&e.includes(j)}function me(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function ge({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=me({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=se({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function be({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const he=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Ie=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;he(r)||he(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},Te=({query:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},we=({queryPayload:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Fe(e,t,n){return e&&t&&n?"sublayer"===t.type?Ze({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:n})||Ze({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Ze({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Ze({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function Ne(e,t){return e&&"utilityNetworks"in e&&t?e.utilityNetworks?.find((e=>e.isUtilityLayer(t))):null}function je(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))}function Ze({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Ze({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Ze({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!K(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?je(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?je(e,o):o}return null}function Le(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ue as applyTextFormattingHTML,oe as createFieldInfoMap,Fe as findRelatedLayer,Ne as findUtilityNetwork,Q as fixTokens,fe as formatAttributes,ie as formatEditInfo,X as formatValueToFieldInfo,ae as getAllFieldInfos,te as getFieldInfo,U as getFieldInfoLabel,M as getFixedFieldName,R as getFixedFieldNames,Le as getHighlightKeyForFeature,L as getSourceLayer,E as graphicCallback,le as htmlEntities,V as isAssociatedFeatureSupportedLayer,J as isAssociatedLayer,x as isExpressionField,H as isFeatureSupportedLayer,W as isGraphicForRelatableFeatureSupportedLayer,K as isRelatableFeatureSupportedLayer,B as isRelatableLayer,ye as isRelatedField,Te as preLayerQueryCallback,we as preRequestCallback,ce as querySourceLayer,pe as queryUpdatedFeature,v as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
5
|
+
import has from"../../../core/has.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,b=/(\{([^{\r\n]+)\})/g,h=/'/g,I=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=n("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function E({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):await t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function v(e=""){if(e)return!N.test(e.trim().toLowerCase())}function x(e){return!!e&&I.test(e)}function C(e,t){if(!t||!x(t)||!e)return;const n=t.replace(I,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function U(e,t){const n=C(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function q(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function A(e){return e.replaceAll(g,"")}function M(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>M(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:P(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(A(t(t(n,(e=>q(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(h,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function Q(e,t){return e.replaceAll(b,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function P(e,t,n){const r=Q(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"subtype-sublayer"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return!!(e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"type"in e)&&("subtype-sublayer"===e.type&&"parent"in e&&e.parent&&"object"==typeof e.parent?"globalIdField"in e.parent:"globalIdField"in e)}function K(e){return H(e)&&B(e)}function V(e){return H(e)&&J(e)}function W(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&K(e.sourceLayer)}function X(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=te(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?Y(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ue(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function Y(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?ee(e,",",", ",t):e.includes(";")?ee(e,";","; ",t):e.includes(" ")?ee(e," "," ",t):i(Number(e),o(t))}function ee(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function te(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ne({fieldName:e,graphic:t,layer:n}){if(ye(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function re({fieldName:e,value:t,graphic:n,layer:r}){if(ye(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n,excludeImpliedDomains:has("esri-widget-legacy-field-domain-calculation")});return i&&"coded-value"===i.type?i.getName(t):null}function ie(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function oe(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=M(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function ae(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function le(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ue(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function se(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=re({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=ne({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return X(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ue(t)}function fe({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>be({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=se({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function ce(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function de(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function pe({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await de(t);if(f&&!d)return;const p=await ce({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function ye(e=""){return!!e&&e.includes(j)}function me(e){return`${j}${e.layerId}/${e.fieldName}`}function ge({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=me({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=se({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function be({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const he=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Ie=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;he(r)||he(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},Te=({query:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},we=({queryPayload:e,layer:t,method:n})=>{Ie({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Fe(e,t,n){return e&&t&&n?"sublayer"===t.type?Ze({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:n})||Ze({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:n}):Ze({layers:e.allLayers,map:e,relatedLayer:t,relationship:n})||Ze({layers:e.allTables,map:e,relatedLayer:t,relationship:n}):null}function Ne(e,t){return e&&"utilityNetworks"in e&&t?e.utilityNetworks?.find((e=>e.isUtilityLayer(t))):null}function je(e,t){return e?.allTables.find((e=>"feature"===e.type&&e.layerId===t.id&&e.url===t.layer?.url))}function Ze({map:e,relationship:t,relationship:{relatedTableId:n},relatedLayer:r,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const n=Ze({layers:o.sublayers,map:e,relatedLayer:r,relationship:t})||Ze({layers:o.subtables,map:e,relatedLayer:r,relationship:t});if(n)return n;continue}if(!K(o))continue;if("sublayer"===r.type){if(o!==r&&o.id===n)return o.isTable?je(e,o):o;continue}const i="scene"===r.type&&r.associatedLayer?r.associatedLayer.url:r.url;if(!i)return null;if("sublayer"!==o.type){if(o!==r&&o.url===i&&o.layerId===n)return o}else if(o!==r&&o.layer?.url===i&&o.id===n)return o.isTable?je(e,o):o}return null}function Le(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ue as applyTextFormattingHTML,oe as createFieldInfoMap,Fe as findRelatedLayer,Ne as findUtilityNetwork,Q as fixTokens,fe as formatAttributes,ie as formatEditInfo,X as formatValueToFieldInfo,ae as getAllFieldInfos,te as getFieldInfo,U as getFieldInfoLabel,M as getFixedFieldName,R as getFixedFieldNames,Le as getHighlightKeyForFeature,L as getSourceLayer,E as graphicCallback,le as htmlEntities,V as isAssociatedFeatureSupportedLayer,J as isAssociatedLayer,x as isExpressionField,H as isFeatureSupportedLayer,W as isGraphicForRelatableFeatureSupportedLayer,K as isRelatableFeatureSupportedLayer,B as isRelatableLayer,ye as isRelatedField,Te as preLayerQueryCallback,we as preRequestCallback,ce as querySourceLayer,pe as queryUpdatedFeature,v as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import o from"../../../renderers/support/HeatmapColorStop.js";function r(r){if(!r.colorStops)return[];const e=[...r.colorStops].filter((o=>o.color?.a>0));let t=e.length-1;if(e
|
|
5
|
+
import o from"../../../renderers/support/HeatmapColorStop.js";function r(r){if(!r.colorStops)return[];const e=[...r.colorStops].filter((o=>o.color?.a>0));let t=e.length-1;if(e[0]){const r=e[t];r&&1!==r.ratio&&(e.push(new o({ratio:1,color:r.color})),t++)}return e.map(((o,e)=>{let l="";return 0===e?l=r.legendOptions?.minLabel||"low":e===t&&(l=r.legendOptions?.maxLabel||"high"),{color:o.color,label:l,ratio:o.ratio}})).reverse()}export{r as getHeatmapRampStops};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import n from"../../core/Logger.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let a=class extends e{constructor(){super(...arguments),this.additionalFootprintToggle=!0,this.additionalCameraLocationsToggle=!0,this.currentFootprintToggle=!0,this.imageEnhancement=!0,this.imageGallery=!0,this.imageOverlays=!0,this.mapImageConversionTool=!0,this.menu=!0,this.navigationTool=!0,this.digitization=!0,this.title=!0,this.showPopupsAction=!0}get coverageMenu(){return t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu}set coverageMenu(o){t(n.getLogger(this),"coverageMenu",{replacement:"menu"}),this.menu=o}};o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"additionalCameraLocationsToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"currentFootprintToggle",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"coverageMenu",null),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageEnhancement",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageGallery",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"imageOverlays",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"mapImageConversionTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"menu",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"navigationTool",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"digitization",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"title",void 0),o([l({type:Boolean,nonNullable:!0})],a.prototype,"showPopupsAction",void 0),a=o([r("esri.widgets.OrientedImageryViewer.OrientedImageryViewerVisibleElements")],a);const i=a;export{i 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import i from"../core/Collection.js";import{deprecatedProperty as a}from"../core/deprecate.js";import s from"../core/Logger.js";import{deg2rad as o}from"../core/mathUtils.js";import{formatArea as r,formatLength as n}from"../core/quantityFormatUtils.js";import{createArea as l,createLength as c}from"../core/quantityUtils.js";import{watch as d,initial as h,syncAndInitial as g,whenOnce as m}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{rotatePixel as u}from"../layers/orientedImagery/transformations/utils.js";import y from"../layers/support/rasterDatasets/RasterFactory.js";import w from"../support/actions/ActionToggle.js";import _ from"./Widget.js";import{getAllArcPath as b}from"./OrientedImageryViewer/arcUtils.js";import{segmentArcs as M,sectorsRadii as C,featureCircleRadius as I,navigationToolDimensionLength as f}from"./OrientedImageryViewer/constants.js";import{css as A,navigation as O,navigationToolRotationFrom as T,navigationToolRotationTo as F,root as E}from"./OrientedImageryViewer/css.js";import{isValidDigitizationLayer as L}from"./OrientedImageryViewer/digitizationUtils.js";import V from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import k from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import S from"./OrientedImageryViewer/components/ImageOverlays.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as P}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as j}from"./support/decorators/messageBundle.js";import{vmEvent as $}from"./support/decorators/vmEvent.js";import{tsx as G}from"./support/jsxFactory.js";import{substitute as B}from"../intl/substitute.js";const R={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles"};let U=class extends _{constructor(e,t){super(e,t),this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.onOverlayAction=e=>{this._onOverlayAction(e)},this.viewModel=new V,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new k,this._currentAction=null,this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._actionItems=new Map,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new i,this._handleOverlayLayerDeselect=e=>{const t=e.layer;this.viewModel.removeOverlayedGraphicsOnImage(`${t.id}`),this.removeHandles(`${R.overlayed}-${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(d((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${R.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onDeleteFeatures=()=>{this.sketchViewModel?.delete()},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onOverlayAction=async({action:e,item:t})=>{switch(this._currentAction&&this._currentAction!==e&&(this._currentAction.value=!1,this._currentAction=null),e.id){case"create-features":this._currentAction=e;e.value?(this.digitizationLayer=t.layer,await this.viewModel.loadDigitizationAdapter(),this.viewModel.activeViewer?.imageRenderer.map.add(this.viewModel.sketch.layer,this.viewModel.activeViewer?.imageRenderer.map.allLayers.length-1),this.sketchViewModel?.updateGraphics.removeAll(),this.sketchViewModel?.create(this.digitizationLayer.geometryType)):(this.sketchViewModel?.updateGraphics.removeAll(),this.viewModel.activeViewer?.imageRenderer.map.remove(this.viewModel.sketch.layer),this.digitizationLayer=null);break}},this._onSaveFeatures=()=>{this.viewModel.sketchAdapter?.save?.()},this._onSelectFeatures=e=>{const{sketchViewModel:t}=this;t&&(t.updateOnGraphicClick=e,this.sketchViewModel?.cancel())},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._overlayLayerListItemCreatedFunction=async e=>{const{item:t}=e,a=t.layer;if(await(a?.load()),!a||!L(a))return;const s=new i,o=new i;s.add(new w({icon:"polyline"===a.geometryType?"line":a.geometryType,id:"create-features",title:this.messages.addOrUpdateDigitizationFeatures})),t.actionsSections=new i([s,o])},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([d((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),h),d((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),d((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),d((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),d((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),g),d((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),((e,t)=>{e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature&&m((()=>"image-loaded"===this.viewModel.state)).then((()=>{this.viewModel.removeAllOverlayMapFeatures(),this._overlayedLayers?.forEach((t=>{this.viewModel.overlayMapFeatures(t,e.showMapFeatures)}))}))}),h)])}loadDependencies(){return x({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get activeLayer(){return a(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){a(s.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get digitizationLayer(){return this.viewModel.digitizationLayer}set digitizationLayer(e){this.viewModel.digitizationLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get listItemCreatedFunction(){return this._get("listItemCreatedFunction")??this._overlayLayerListItemCreatedFunction}set listItemCreatedFunction(e){this._set("listItemCreatedFunction",e)}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}async _getThumbnailPixelBlockInternal(e,t){const{level:i,offset:a,size:o}=this._getMaxLevelRasterParameters(e);try{const{pixelBlock:s}=await e.fetchRawPixels(i,a,o,t);return s}catch(r){s.getLogger(this).warn("failed to create canvas with pixel data",r)}return null}_getMaxLevelRasterParameters(e){const{storageInfo:t,width:i,height:a}=e.rasterInfo,{maximumPyramidLevel:s,pyramidScalingFactor:o}=t,r=o??2;return{level:s,offset:{x:0,y:0},size:{width:Math.ceil(i/r**s),height:Math.ceil(a/r**s)}}}async _getThumbnailPixelBlock(e){const{signal:t}=this._galleryController;try{const{origin:i,pathname:a,searchParams:s}=new URL(e),o=await y.open({ioConfig:{customFetchParameters:Object.fromEntries(s),skipMapInfo:!0},url:`${i}${a}`,signal:t});return o?await this._getThumbnailPixelBlockInternal(o,{signal:t}):null}catch(i){s.getLogger(this).error("failed to create thumbnail",i)}return null}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const i=e.target,a=i.getAttribute("data-src"),r=i.getAttribute("data-rotation"),n=r?parseFloat(r)%360:null;if(!a)return;const l=await this._getThumbnailPixelBlock(a);if(!l)return;i.width=l.width,i.height=l.height;const c=i.getContext("2d");if(!c)return;const d=c.createImageData(i.width,i.height);if(d.data.set(l.getAsRGBA()),"number"==typeof n&&0!==n){const e=o(n),a=document.createElement("canvas"),r=a.getContext("2d");if(r){a.width=d.width,a.height=d.height,r.putImageData(d,0,0);const s=u(0,0,e),o=u(d.width,0,e),n=u(d.width,d.height,e),l=u(0,d.height,e),h=Math.max(s[0],o[0],n[0],l[0])-Math.min(s[0],o[0],n[0],l[0]),g=Math.max(s[1],o[1],n[1],l[1])-Math.min(s[1],o[1],n[1],l[1]),m=Math.min(i.width/h,i.height/g);return c.save(),c.clearRect(0,0,i.width,i.height),c.translate(i.width/2,i.height/2),c.rotate(e),c.scale(m,m),c.drawImage(a,-d.width/2,-d.height/2,d.width,d.height),c.restore(),t.unobserve(i)}s.getLogger(this).warn("oriented-imagery-viewer:image-gallery","failed to apply rotation on thumbnail")}c.putImageData(d,0,0),t.unobserve(i)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderActionTooltips(){return[...this._actionItems].map((([e,t])=>G("calcite-tooltip",{key:e,referenceElement:t},G("span",null,e))))}_renderBody(){return G("div",{class:A.body},this._renderViewerContainer,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._renderImageGallery,this._renderNavigation,this._renderImageOverlays],this._renderImageEnhancementTools)}_renderImageEnhancementAction(){const{state:e,mode:t}=this.viewModel;return G("calcite-action",{active:this.imageEnhancementToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement})}get _renderImageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:s}}=this;return e&&"image-loaded"===s?G("calcite-panel",{bind:this,class:A.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},G("div",{class:A.imageEnhancementTools},G("div",{class:A.imageEnhancementToolContainer},G("calcite-label",null,this.messages.brightness,G("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),G("div",{class:A.imageEnhancementToolContainer},G("calcite-label",null,this.messages.contrast,G("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),G("div",{class:A.imageEnhancementToolContainer},G("calcite-label",null,this.messages.sharpness,G("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),G("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset})):null}get _renderImageGallery(){const{container:e,galleryOpened:t,imageGalleryEnabled:i,viewModel:{thumbnails:a},invalidCameraHeading:s}=this;return i&&t&&(e&&a)?G("calcite-panel",{bind:this,class:A.carousel,closable:!0,closed:!t,disabled:s,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},G("div",{class:A.carouselContainer},this._renderThumbnails(a))):null}_renderImageOverlaysAction(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i}=this;return G("calcite-action",{active:t,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays})}get _renderImageOverlays(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this;if(e&&"image-loaded"===t)return G("div",{class:A.imageOverlaysContainer,key:this.messages.imageOverlays},this._renderImageOverlaysComponent)}get _renderImageOverlaysComponent(){return G(S,{closed:!this.imageOverlaysOpened,listItemCreatedFunction:this.listItemCreatedFunction,messages:this._imageOverlayMessages,overlayedLayers:this._overlayedLayers,showCameraLocations:this.showCameraLocations,showMapFeatures:this.showMapFeatures,view:this.view,onDeleteFeatures:this._onDeleteFeatures,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onListItemAction:this._onOverlayAction,onSaveFeatures:this._onSaveFeatures,onSelectFeatures:this._onSelectFeatures,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged})}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[G("calcite-notice",{class:A.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},G("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return G("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}_renderMapImageConversionTool(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i}=this;return G("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool})}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:s}}=this;if(!this.container||!a)return null;let o,r,n,l,c;if(i){const{x:e,y:t,direction:a}=i,[s,d,h,g]=M[a];o=`M ${e} ${t} L ${s} ${d} A ${C[2]} ${C[2]} 0 0 1 ${h} ${g} Z`,r=e,l=t,n=M[a][4],c=M[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},h=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},g=e=>{e.removeEventListener("click",h)},m=a.attributes.objectId,p=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:s})=>G("circle",{afterRemoved:g,class:this.classes(A.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":s,key:`${A.feature}-${i}`,onclick:h,r:I}))))),v=e=>{e.removeEventListener("click",d)},u=this.classes({[A.navigationWrapper]:!0,[A.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===s?G("div",{bind:this,class:u,key:this.messages.navigationTool},G("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?O:A.rotateWithAnimation,focusable:"false",height:f,role:"img",width:f,xmlns:"http://www.w3.org/2000/svg"},G("defs",null,G("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},G("stop",{class:A.navigationPathOffset0,offset:0}),G("stop",{class:A.navigationPathOffset1,offset:1}))),G("g",null,G("circle",{class:this.classes(A.sector,A.outerSector),cx:C[3],cy:C[3],onclick:this._scaleNavigationTool,r:C[3]}),G("circle",{class:A.sector,cx:C[3],cy:C[3],r:C[2]}),G("circle",{class:A.sector,cx:C[3],cy:C[3],r:C[1]}),G("circle",{class:A.sector,cx:C[3],cy:C[3],r:C[0]}),G("path",{class:A.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${A.pointer}-west`}),G("path",{class:this.classes(A.pointer,A.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${A.pointer}-north`}),G("path",{class:A.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${A.pointer}-east`}),G("path",{class:A.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${A.pointer}-south`}),G("path",{class:this.classes(A.sector,A.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:A.sectorSeparator}),b([C[2],C[1],C[0]],C[3],C[3]).map(((t,i)=>G("path",{afterRemoved:v,class:this.classes(A.sector,e?.[i]?.length?A.sectorEnabled:A.sectorDisabled),d:t,"data-sector":`${i}`,key:`${A.sector}-${i}`,onclick:d}))),G("path",{class:this.classes(A.sector,A.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:A.sectorCross}),p,a.attributes.cameraPitch>=5&&o?G("path",{class:A.selectedFeaturePath,d:o,fill:`url(#${this.id}-coverage-fill)`,key:A.selectedFeaturePath}):null))):null}_renderNavigationToolAction(){const{state:e}=this.viewModel;return G("calcite-action",{active:this.navigationToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool})}_renderMenuBarContainer(){const{currentCoverageVisible:e,isAdditionalCoverageVisible:t,isAdditionalPointSourcesVisible:i,imageGalleryEnabled:a,invalidCameraHeading:s}=this;return G("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},G("calcite-action-group",null,G("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:A.currentCoverage,disabled:s,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint}),G("calcite-action",{active:t,afterCreate:this._storeActionElement,bind:this,class:A.addCoverage,disabled:s,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints}),G("calcite-action",{active:i,afterCreate:this._storeActionElement,bind:this,class:A.addExpPoints,disabled:s,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations})),G("calcite-action-group",null,this.visibleElements.mapImageConversionTool?this._renderMapImageConversionTool():null,this.visibleElements.navigationTool?this._renderNavigationToolAction():null,this.visibleElements.imageEnhancement?this._renderImageEnhancementAction():null),G("calcite-action-group",null,G("calcite-action",{active:this.galleryOpened,afterCreate:this._storeActionElement,bind:this,disabled:!a||s,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery}),this.visibleElements.imageOverlays?this._renderImageOverlaysAction():null,this.visibleElements.showPopupsAction?this._renderPopupAction():null),this._renderActionTooltips())}get _renderMessageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:s}=t,o=`${s?B(e[a],s):e[a]}`;return G("span",{class:A.messageBox},i?`${o} ${i}`:o)}_renderPopupAction(){return G("calcite-action",{afterCreate:this._storeActionElement,bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,textEnabled:!0})}_renderThumbnails(e){const{currentBestFeature:t}=this.viewModel;return t?G("div",{class:A.carouselContent},e.items.map((({url:e,objectId:i,rotation:a},s)=>G("div",{class:`${A.carouselItemWrapper}${t.attributes.objectId===i?"--selected":""}`,key:`${A.carouselItemWrapper}-${s}`},G("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:A.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":e,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}get _renderViewerContainer(){return G("div",{class:A.viewerContainer},this._renderImageViewer,this._renderPanoramicViewer,this._renderMessageBox)}get _renderImageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,s=this.classes({[A.viewer]:!a,[A.viewerHidden]:a});return G("calcite-panel",{afterCreate:t,bind:this,class:s})}get _renderPanoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,s=this.classes({[A.viewer]:!a,[A.viewerHidden]:a});return G("calcite-panel",{afterCreate:t,bind:this,class:s})}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleImageOverlays(e){e.stopPropagation(),this.imageOverlaysOpened=!this.imageOverlaysOpened,this.imageOverlaysOpened&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(T,`${t}deg`),e.style.setProperty(F,`${t+a}deg`)}getConvertedAreaMeasurement(){const{viewModel:{areaMeasurementResult:e},measurementUnitMessages:t,pixelAreaMeasurementUnit:i,messages:{startMeasurement:a}}=this;return i&&e?r(t,l(e,"square-meters"),i):a}getConvertedMeasurement(){const{viewModel:{distanceMeasurementResult:e},measurementUnitMessages:t,pixelMeasurementUnit:i,messages:{startMeasurement:a}}=this;return i&&e?n(t,c(e,"meters"),i):a}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){const{viewModel:{state:e}}=this;return G("div",{class:this.classes(P.widget,E)},G("calcite-panel",{bind:this,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===e},this.visibleElements.coverageMenu?this._renderMenuBarContainer():null,this._renderBody()))}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([p()],U.prototype,"activeLayer",null),e([p()],U.prototype,"currentBestFeature",null),e([p()],U.prototype,"currentCoverageVisible",null),e([p()],U.prototype,"digitizationLayer",null),e([p()],U.prototype,"disabled",null),e([p()],U.prototype,"features",null),e([p()],U.prototype,"imagePointsInView",null),e([p()],U.prototype,"galleryOpened",void 0),e([p()],U.prototype,"icon",null),e([p()],U.prototype,"imageEnhancementToolActive",void 0),e([p({readOnly:!0})],U.prototype,"imageGalleryEnabled",null),e([p()],U.prototype,"imageOverlaysOpened",void 0),e([p({readOnly:!0})],U.prototype,"invalidCameraHeading",null),e([p()],U.prototype,"isAdditionalCoverageVisible",null),e([p()],U.prototype,"isAdditionalPointSourcesVisible",null),e([p()],U.prototype,"mapImageConversionToolState",null),e([p()],U.prototype,"layer",null),e([p()],U.prototype,"listItemCreatedFunction",null),e([p()],U.prototype,"navigationToolActive",void 0),e([p()],U.prototype,"onOverlayAction",void 0),e([p({type:V})],U.prototype,"viewModel",void 0),e([p(),j("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],U.prototype,"messages",void 0),e([p(),j("esri/core/t9n/Units")],U.prototype,"measurementUnitMessages",void 0),e([p(),j("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([p(),j("esri/widgets/Sketch/t9n/Sketch")],U.prototype,"messagesSketch",void 0),e([p()],U.prototype,"pixelMeasurementUnit",void 0),e([p()],U.prototype,"pixelAreaMeasurementUnit",void 0),e([p({readOnly:!0})],U.prototype,"popupEnabled",null),e([p()],U.prototype,"referencePoint",null),e([p()],U.prototype,"showCameraLocations",void 0),e([p()],U.prototype,"showMapFeatures",void 0),e([$(["create","delete","redo","undo","update"]),p({readOnly:!0})],U.prototype,"sketchViewModel",null),e([p()],U.prototype,"view",null),e([p({type:k,nonNullable:!0})],U.prototype,"visibleElements",void 0),e([p()],U.prototype,"determineWorkflowForFeature",null),e([p()],U.prototype,"updateFootprint",null),e([p()],U.prototype,"_currentAction",void 0),e([p()],U.prototype,"_imageOverlayMessages",null),e([p()],U.prototype,"_navigationToolExpanded",void 0),e([p()],U.prototype,"_navigationTool",void 0),e([p()],U.prototype,"_warningTitleElement",void 0),e([p()],U.prototype,"_renderImageEnhancementTools",null),e([p()],U.prototype,"_renderImageGallery",null),e([p()],U.prototype,"_renderImageOverlays",null),e([p()],U.prototype,"_renderImageOverlaysComponent",null),e([p()],U.prototype,"_renderNavigation",null),e([p()],U.prototype,"_renderMessageBox",null),e([p()],U.prototype,"_renderViewerContainer",null),e([p()],U.prototype,"_renderImageViewer",null),e([p()],U.prototype,"_renderPanoramicViewer",null),U=e([v("esri.widgets.OrientedImageryViewer")],U);const H=U;export{H as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{prefersReducedMotion as t}from"../core/a11yUtils.js";import i from"../core/Collection.js";import{deprecatedProperty as a}from"../core/deprecate.js";import o from"../core/Logger.js";import{deg2rad as s}from"../core/mathUtils.js";import{formatArea as r,formatLength as n}from"../core/quantityFormatUtils.js";import{createArea as l,createLength as c}from"../core/quantityUtils.js";import d from"../core/ReactiveMap.js";import{watch as g,initial as h,syncAndInitial as m,whenOnce as p}from"../core/reactiveUtils.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{rotatePixel as y}from"../layers/orientedImagery/transformations/utils.js";import w from"../layers/support/rasterDatasets/RasterFactory.js";import _ from"../support/actions/ActionToggle.js";import b from"./Widget.js";import{getAllArcPath as C}from"./OrientedImageryViewer/arcUtils.js";import{segmentArcs as M,sectorsRadii as f,featureCircleRadius as T,navigationToolDimensionLength as I}from"./OrientedImageryViewer/constants.js";import{css as O,navigation as A,navigationToolRotationFrom as F,navigationToolRotationTo as E,root as L}from"./OrientedImageryViewer/css.js";import{isValidDigitizationLayer as k}from"./OrientedImageryViewer/digitizationUtils.js";import x from"./OrientedImageryViewer/OrientedImageryViewerViewModel.js";import V from"./OrientedImageryViewer/OrientedImageryViewerVisibleElements.js";import S from"./OrientedImageryViewer/components/ImageOverlays.js";import{loadCalciteComponents as P}from"./support/componentsUtils.js";import{globalCss as j}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as G}from"./support/decorators/messageBundle.js";import{vmEvent as $}from"./support/decorators/vmEvent.js";import{tsx as B}from"./support/jsxFactory.js";import{substitute as H}from"../intl/substitute.js";const R={overlayMapFeatures:"overlay-map-features",overlayed:"overlayed",overlaysActionHandles:"overlays-action-handles"};let U=class extends b{constructor(e,t){super(e,t),this.galleryOpened=!1,this.imageEnhancementToolActive=!1,this.imageOverlaysOpened=!1,this.navigationToolActive=!1,this.onOverlayAction=e=>{this._onOverlayAction(e)},this.viewModel=new x,this.messagesCommon=null,this.messagesSketch=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters",this.showCameraLocations=!1,this.showMapFeatures=!1,this.visibleElements=new V,this._actionItems=new d,this._currentAction=null,this._navigationToolExpanded=!1,this._navigationTool=null,this._warningTitleElement=null,this._galleryController=new AbortController,this._galleryObserver=new IntersectionObserver(this._lazyLoadImage.bind(this)),this._overlayedLayers=new i,this._handleOverlayLayerDeselect=e=>{const t=e.layer;this.viewModel.removeOverlayedGraphicsOnImage(`${t.id}`),this.removeHandles(`${R.overlayed}-${t.id}`)},this._handleOverlayLayerSelect=e=>{const t=e.layer;this.viewModel.overlayMapFeatures(t,this.showMapFeatures),this.addHandles(g((()=>t.visible),(()=>{this.viewModel.toggleOverlayMapFeatures(t.id,t.visible)})),`${R.overlayed}-${t.id}`)},this._highlight=e=>{const t=e.target?.dataset.objectid;t&&this.viewModel.highlight(t)},this._onDeleteFeatures=()=>{this.sketchViewModel?.delete()},this._onImageOverlayClosed=()=>{this.imageOverlaysOpened=!1},this._onOverlayAction=async({action:e,item:t})=>{switch(this._currentAction&&this._currentAction!==e&&(this._currentAction.value=!1,this._currentAction=null),e.id){case"create-features":this._currentAction=e;e.value?(this.digitizationLayer=t.layer,await this.viewModel.loadDigitizationAdapter(),this.viewModel.activeViewer?.imageRenderer.map.add(this.viewModel.sketch.layer,this.viewModel.activeViewer?.imageRenderer.map.allLayers.length-1),this.sketchViewModel?.updateGraphics.removeAll(),this.sketchViewModel?.create(this.digitizationLayer.geometryType)):(this.sketchViewModel?.updateGraphics.removeAll(),this.viewModel.activeViewer?.imageRenderer.map.remove(this.viewModel.sketch.layer),this.digitizationLayer=null);break}},this._onSaveFeatures=()=>{this.viewModel.sketchAdapter?.save?.()},this._onSelectFeatures=e=>{const{sketchViewModel:t}=this;t&&(t.updateOnGraphicClick=e,this.sketchViewModel?.cancel())},this._onShowCameraLocationsChanged=e=>{this.showCameraLocations=e},this._onShowMapFeaturesChanged=e=>{this.showMapFeatures=e},this._overlayLayerListItemCreatedFunction=async e=>{const{item:t}=e,a=t.layer;if(await(a?.load()),!a||!k(a))return;const o=new i,s=new i;o.add(new _({icon:"polyline"===a.geometryType?"line":a.geometryType,id:"create-features",title:this.messages.addOrUpdateDigitizationFeatures})),t.actionsSections=new i([o,s])},this._removeHighlight=()=>this.viewModel.removeHighlight(),this._scaleNavigationTool=()=>{this._navigationToolExpanded=!this._navigationToolExpanded},this._toggleImageAttributes=()=>{this.viewModel.toggleImageAttributes()},this._loadImageFromGallery=this._loadImageFromGallery.bind(this),this._registerGalleryItem=this._registerGalleryItem.bind(this),this._unregisterGalleryItem=this._unregisterGalleryItem.bind(this),this.loadImageFromSource=this.loadImageFromSource.bind(this),this.updateSuitabilities=this.updateSuitabilities.bind(this)}initialize(){this.addHandles([g((()=>[this.viewModel?.bestFeatureAngle,this._navigationTool]),(([e,t])=>{t&&this._updateNavigationTool(t)}),h),g((()=>this.currentCoverageVisible),(e=>this._onCurrentCoverageVisibilityChange(e))),g((()=>this.isAdditionalCoverageVisible),(e=>this._onAdditionalCoverageVisibilityChange(e))),g((()=>this.isAdditionalPointSourcesVisible),(e=>this._onAdditionalCameraLocationsVisibility(e))),g((()=>({features:this.currentBestFeature,showCameraLocations:this.showCameraLocations,state:this.viewModel.state})),(({showCameraLocations:e,state:t})=>{"image-loaded"===t&&this.viewModel.overlayCameraLocations(e)}),m),g((()=>({feature:this.currentBestFeature,showMapFeatures:this.showMapFeatures,state:this.viewModel.state})),((e,t)=>{e.showMapFeatures!==t?.showMapFeatures&&this.viewModel.toggleAllOverlayMapFeatures(e.showMapFeatures),null!=e.feature&&e.feature!==t?.feature&&p((()=>"image-loaded"===this.viewModel.state)).then((()=>{this.viewModel.removeAllOverlayMapFeatures(),this._overlayedLayers?.forEach((t=>{this.viewModel.overlayMapFeatures(t,e.showMapFeatures)}))}))}),h)])}loadDependencies(){return P({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),shell:()=>import("@esri/calcite-components/dist/components/calcite-shell"),slider:()=>import("@esri/calcite-components/dist/components/calcite-slider"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._galleryController.abort(),this._galleryObserver.disconnect()}get activeLayer(){return a(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){a(o.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get currentBestFeature(){return this.viewModel.currentBestFeature}set currentBestFeature(e){this.viewModel.currentBestFeature=e}get currentCoverageVisible(){return this.viewModel.currentCoverageVisible}set currentCoverageVisible(e){this.viewModel.currentCoverageVisible=e}get digitizationLayer(){return this.viewModel.digitizationLayer}set digitizationLayer(e){this.viewModel.digitizationLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get displayMessage(){return this.viewModel.displayMessage}get features(){return this.viewModel.features}get imagePointsInView(){return this.viewModel.imagePointsInView}get icon(){return"oriented-imagery-widget"}set icon(e){this._overrideIfSome("icon",e)}get imageGalleryEnabled(){return this.viewModel.imageGalleryEnabled}get invalidCameraHeading(){return this.viewModel.invalidCameraHeading}get isAdditionalCoverageVisible(){return this.viewModel.isAdditionalCoverageVisible}set isAdditionalCoverageVisible(e){this.viewModel.isAdditionalCoverageVisible=e}get isAdditionalPointSourcesVisible(){return this.viewModel.isAdditionalPointSourcesVisible}set isAdditionalPointSourcesVisible(e){this.viewModel.isAdditionalPointSourcesVisible=e}get mapImageConversionToolState(){return this.viewModel.mapImageConversionToolState}set mapImageConversionToolState(e){this.viewModel.mapImageConversionToolState=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get listItemCreatedFunction(){return this._get("listItemCreatedFunction")??this._overlayLayerListItemCreatedFunction}set listItemCreatedFunction(e){this._set("listItemCreatedFunction",e)}get popupEnabled(){const{popupEnabled:e,state:t}=this.viewModel;return"image-loaded"===t&&e}get referencePoint(){return this.viewModel.referencePoint??null}get sketchViewModel(){return this.viewModel.sketch}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set determineWorkflowForFeature(e){this.viewModel.determineWorkflowForFeature=e}get determineWorkflowForFeature(){return this.viewModel.determineWorkflowForFeature}set updateFootprint(e){this.viewModel.updateFootprint=e}get updateFootprint(){return this.viewModel.updateFootprint}get _actionBarContext(){return B("calcite-action-bar",{expandDisabled:!0,layout:"horizontal",slot:"action-bar"},B("calcite-action-group",null,this.visibleElements.currentFootprintToggle?this._currentFootprintToggle:null,this.visibleElements.additionalFootprintToggle?this._additionalFootprintToggle:null,this.visibleElements.additionalCameraLocationsToggle?this._additionalPointSourcesToggle:null),B("calcite-action-group",null,this.visibleElements.mapImageConversionTool?this._mapImageConversionToggle:null,this.visibleElements.navigationTool?this._navigationToolToggle:null,this.visibleElements.imageEnhancement?this._imageEnhancementsToggle:null),B("calcite-action-group",null,this.visibleElements.imageGallery?this._imageGalleryToggle:null,this.visibleElements.imageOverlays?this._imageOverlaysToggle:null,this.visibleElements.showPopupsAction?this._openPopupAction:null),this._actionTooltips)}get _actionTooltips(){return[...this._actionItems].map((([e,t])=>B("calcite-tooltip",{key:e,referenceElement:t},B("span",null,e))))}get _additionalFootprintToggle(){const{isAdditionalCoverageVisible:e,invalidCameraHeading:t}=this;return B("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:O.addCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleAdditionalCoverage,text:this.messages.additionalFootprints})}get _additionalPointSourcesToggle(){const{isAdditionalPointSourcesVisible:e,invalidCameraHeading:t}=this;return B("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:O.addExpPoints,disabled:t,icon:"circle-area",onclick:this._toggleAdditionalCameraLocations,text:this.messages.additionalCameraLocations})}get _context(){const{viewModel:{state:e}}=this;return B("calcite-panel",null,B("calcite-shell",null,B("calcite-panel",{bind:this,class:O.viewerContainer,heading:this.visibleElements.title?this.messages.title:void 0,loading:"image-loading"===e},this.visibleElements.menu?this._actionBarContext:null,this._imageViewer,this._panoramicViewer,this._messageBox,this.invalidCameraHeading?[this._renderWarning(this.messages.invalidCameraHeadingWarningTitle),this._renderWarningTooltip(this.messages.invalidCameraHeadingWarningDescription)]:[this._imageGalleryPanel,this._renderNavigation,this._imageOverlaysPanel],this._imageEnhancementTools)))}get _currentFootprintToggle(){const{currentCoverageVisible:e,invalidCameraHeading:t}=this;return B("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,class:O.currentCoverage,disabled:t,icon:"trapezoid-area",onclick:this._toggleCurrentCoverage,text:this.messages.currentFootprint})}get _imageEnhancementTools(){const{imageEnhancementToolActive:e,viewModel:{brightness:t,contrast:i,sharpness:a,state:o}}=this;return e&&"image-loaded"===o?B("calcite-panel",{bind:this,class:O.imageEnhancementWrapper,closable:!0,closed:!e,heading:this.messages.imageEnhancement,key:this.messages.imageEnhancement,onCalcitePanelClose:this._toggleImageEnhancementToolState},B("div",{class:O.imageEnhancementTools},B("div",{class:O.imageEnhancementToolContainer},B("calcite-label",null,this.messages.brightness,B("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:t,onCalciteSliderInput:this._handleBrightnessChange}))),B("div",{class:O.imageEnhancementToolContainer},B("calcite-label",null,this.messages.contrast,B("calcite-slider",{bind:this,labelTicks:!0,max:10,min:-10,ticks:5,value:i,onCalciteSliderInput:this._handleContrastChange}))),B("div",{class:O.imageEnhancementToolContainer},B("calcite-label",null,this.messages.sharpness,B("calcite-slider",{bind:this,labelTicks:!0,max:1,min:0,step:.1,ticks:.5,value:a,onCalciteSliderInput:this._handleSharpnessChange})))),B("calcite-action",{bind:this,icon:"reset",onclick:this._resetImageTools,slot:"header-actions-end",text:this.messagesCommon.reset})):null}get _imageEnhancementsToggle(){const{state:e,mode:t}=this.viewModel;return B("calcite-action",{active:this.imageEnhancementToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"default"!==t||"image-loaded"!==e,icon:"sliders-horizontal",onclick:this._toggleImageEnhancementToolState,text:this.messages.imageEnhancement})}get _imageGalleryPanel(){const{container:e,galleryOpened:t,imageGalleryEnabled:i,viewModel:{thumbnails:a},invalidCameraHeading:o}=this;return i&&t&&(e&&a)?B("calcite-panel",{bind:this,class:O.carousel,closable:!0,closed:!t,disabled:o,heading:this.messages.imageGallery,key:this.messages.imageGallery,onCalcitePanelClose:this._toggleImageGallery},B("div",{class:O.carouselContainer},this._renderThumbnails(a))):null}get _imageGalleryToggle(){const{imageGalleryEnabled:e,invalidCameraHeading:t}=this;return B("calcite-action",{active:this.galleryOpened,afterCreate:this._storeActionElement,bind:this,disabled:!e||t,icon:"images",onclick:this._toggleImageGallery,text:this.messages.imageGallery})}get _imageOverlaysComponent(){return B(S,{closed:!this.imageOverlaysOpened,listItemCreatedFunction:this.listItemCreatedFunction,messages:this._imageOverlayMessages,overlayedLayers:this._overlayedLayers,showCameraLocations:this.showCameraLocations,showMapFeatures:this.showMapFeatures,view:this.view,onDeleteFeatures:this._onDeleteFeatures,onImageOverlaysClosed:this._onImageOverlayClosed,onLayerDeselected:this._handleOverlayLayerDeselect,onLayerSelected:this._handleOverlayLayerSelect,onListItemAction:this._onOverlayAction,onSaveFeatures:this._onSaveFeatures,onSelectFeatures:this._onSelectFeatures,onShowCameraLocationsChanged:this._onShowCameraLocationsChanged,onShowMapFeaturesChanged:this._onShowMapFeaturesChanged})}get _imageOverlayMessages(){return{...this.messages,...this.messagesSketch}}get _imageOverlaysPanel(){const{imageOverlaysOpened:e,viewModel:{state:t}}=this;if(e&&"image-loaded"===t)return B("div",{class:O.imageOverlaysContainer,key:this.messages.imageOverlays},this._imageOverlaysComponent)}get _imageOverlaysToggle(){const{viewModel:{state:e},imageOverlaysOpened:t,invalidCameraHeading:i}=this;return B("calcite-action",{active:t,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e||i,icon:"layers",onclick:this._toggleImageOverlays,text:this.messages.imageOverlays})}get _imageViewer(){const{displayMessage:e,loadImageViewer:t,mode:i}=this.viewModel,a=null!=e||"default"!==i,o=this.classes({[O.viewer]:!a,[O.viewerHidden]:a});return B("calcite-panel",{afterCreate:t,bind:this,class:o})}get _mapImageConversionToggle(){const{mapImageConversionToolState:e,viewModel:{state:t},invalidCameraHeading:i}=this;return B("calcite-action",{active:e,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==t||i,icon:"image-pin",onclick:this._toggleMapImageConversionToolState,text:this.messages.mapImageConversionTool})}get _messageBox(){const{messages:e,viewModel:{displayMessage:t}}=this;if(!t)return null;const{data:i,key:a,map:o}=t,s=`${o?H(e[a],o):e[a]}`;return B("span",{class:O.messageBox},i?`${s} ${i}`:s)}get _navigationToolToggle(){const{state:e}=this.viewModel;return B("calcite-action",{active:this.navigationToolActive,afterCreate:this._storeActionElement,bind:this,disabled:"image-loaded"!==e||this.invalidCameraHeading,icon:"explore",onclick:this._toggleNavigationTool,text:this.messages.navigationTool})}get _openPopupAction(){return B("calcite-action",{afterCreate:this._storeActionElement,bind:this,disabled:!this.popupEnabled,icon:"popup",onclick:this._toggleImageAttributes,text:this.messages.showPopups,textEnabled:!0})}get _panoramicViewer(){const{displayMessage:e,loadPanoramicViewer:t,mode:i}=this.viewModel,a=null!=e||"panoramic"!==i,o=this.classes({[O.viewer]:!a,[O.viewerHidden]:a});return B("calcite-panel",{afterCreate:t,bind:this,class:o})}async _getThumbnailPixelBlockInternal(e,t){const{level:i,offset:a,size:s}=this._getMaxLevelRasterParameters(e);try{const{pixelBlock:o}=await e.fetchRawPixels(i,a,s,t);return o}catch(r){o.getLogger(this).warn("failed to create canvas with pixel data",r)}return null}_getMaxLevelRasterParameters(e){const{storageInfo:t,width:i,height:a}=e.rasterInfo,{maximumPyramidLevel:o,pyramidScalingFactor:s}=t,r=s??2;return{level:o,offset:{x:0,y:0},size:{width:Math.ceil(i/r**o),height:Math.ceil(a/r**o)}}}async _getThumbnailPixelBlock(e){const{signal:t}=this._galleryController;try{const{origin:i,pathname:a,searchParams:o}=new URL(e),s=await w.open({ioConfig:{customFetchParameters:Object.fromEntries(o),skipMapInfo:!0},url:`${i}${a}`,signal:t});return s?await this._getThumbnailPixelBlockInternal(s,{signal:t}):null}catch(i){o.getLogger(this).error("failed to create thumbnail",i)}return null}_handleBrightnessChange(e){this.viewModel.brightness=e.currentTarget.value??0}_handleContrastChange(e){this.viewModel.contrast=e.currentTarget.value??0}_handleSharpnessChange(e){this.viewModel.sharpness=e.currentTarget.value??0}_lazyLoadImage(e,t){e.forEach((async e=>{if(e.isIntersecting){const i=e.target,a=i.getAttribute("data-src"),r=i.getAttribute("data-rotation"),n=r?parseFloat(r)%360:null;if(!a)return;const l=await this._getThumbnailPixelBlock(a);if(!l)return;i.width=l.width,i.height=l.height;const c=i.getContext("2d");if(!c)return;const d=c.createImageData(i.width,i.height);if(d.data.set(l.getAsRGBA()),"number"==typeof n&&0!==n){const e=s(n),a=document.createElement("canvas"),r=a.getContext("2d");if(r){a.width=d.width,a.height=d.height,r.putImageData(d,0,0);const o=y(0,0,e),s=y(d.width,0,e),n=y(d.width,d.height,e),l=y(0,d.height,e),g=Math.max(o[0],s[0],n[0],l[0])-Math.min(o[0],s[0],n[0],l[0]),h=Math.max(o[1],s[1],n[1],l[1])-Math.min(o[1],s[1],n[1],l[1]),m=Math.min(i.width/g,i.height/h);return c.save(),c.clearRect(0,0,i.width,i.height),c.translate(i.width/2,i.height/2),c.rotate(e),c.scale(m,m),c.drawImage(a,-d.width/2,-d.height/2,d.width,d.height),c.restore(),t.unobserve(i)}o.getLogger(this).warn("oriented-imagery-viewer:image-gallery","failed to apply rotation on thumbnail")}c.putImageData(d,0,0),t.unobserve(i)}}))}_loadImageFromGallery(e){const{target:t}=e;if(!t)return;const i=t.getAttribute("data-objectid");i&&this.viewModel.currentBestFeature?.attributes.objectId!==Number(i)&&this.viewModel.selectBestFeature(i)}_onAdditionalCoverageVisibilityChange(e){this.viewModel.setAdditionalCoverageVisibility(e)}_onAdditionalCameraLocationsVisibility(e){this.viewModel.setAdditionalCameraLocationsVisibility(e)}_onCurrentCoverageVisibilityChange(e){this.viewModel.setCurrentCoverageVisibility(e)}_registerGalleryItem(e){this._galleryObserver.observe(e)}_renderWarning(e){const{invalidCameraHeading:t,viewModel:{state:i}}=this;return t&&"image-loaded"===i?[B("calcite-notice",{class:O.alert,closable:!0,icon:"exclamation-mark-triangle-f",iconFlipRtl:!0,kind:"warning",open:!0,scale:"s"},B("div",{afterCreate:e=>this._storeWarningTitleElement(e),slot:"title"},e))]:null}_renderWarningTooltip(e){const{_warningTitleElement:t}=this;if(e?.length&&t)return B("calcite-tooltip",{closeOnClick:!0,referenceElement:t},e)}get _renderNavigation(){const{viewModel:{sectorData:e,navigatorCurrentBestFeature:i,currentBestFeature:a,state:o}}=this;if(!this.container||!a)return null;let s,r,n,l,c;if(i){const{x:e,y:t,direction:a}=i,[o,d,g,h]=M[a];s=`M ${e} ${t} L ${o} ${d} A ${f[2]} ${f[2]} 0 0 1 ${g} ${h} Z`,r=e,l=t,n=M[a][4],c=M[a][5]}const d=e=>{const t=e.target.dataset?.sector;t&&this.viewModel.handleSectorClick(+t)},g=e=>{const t=e.target.dataset;if(!t)return;const{featureIndexInSector:i,sector:a}=t;i&&a&&this.viewModel.handleFeatureClick({sector:a,featureIndexInSector:+i})},h=e=>{e.removeEventListener("click",g)},m=a.attributes.objectId,p=e?.map((e=>e?.items)).filter(Boolean).flatMap((e=>e?.map((({x:e,y:t,objectID:i,featureIndexInSector:a,sector:o})=>B("circle",{afterRemoved:h,class:this.classes(O.feature,{selected:m===i}),cx:e,cy:t,"data-feature-index-in-sector":a,"data-sector":o,key:`${O.feature}-${i}`,onclick:g,r:T}))))),u=e=>{e.removeEventListener("click",d)},v=this.classes({[O.navigationWrapper]:!0,[O.navigationZoomed]:this._navigationToolExpanded});return this.navigationToolActive&&"image-loaded"===o?B("div",{bind:this,class:v,key:this.messages.navigationTool},B("svg",{afterCreate:e=>this._storeNavigationToolReference(e),class:t()?A:O.rotateWithAnimation,focusable:"false",height:I,role:"img",width:I,xmlns:"http://www.w3.org/2000/svg"},B("defs",null,B("linearGradient",{gradientUnits:"userSpaceOnUse",id:`${this.id}-coverage-fill`,x1:r,x2:n,y1:l,y2:c},B("stop",{class:O.navigationPathOffset0,offset:0}),B("stop",{class:O.navigationPathOffset1,offset:1}))),B("g",null,B("circle",{class:this.classes(O.sector,O.outerSector),cx:f[3],cy:f[3],onclick:this._scaleNavigationTool,r:f[3]}),B("circle",{class:O.sector,cx:f[3],cy:f[3],r:f[2]}),B("circle",{class:O.sector,cx:f[3],cy:f[3],r:f[1]}),B("circle",{class:O.sector,cx:f[3],cy:f[3],r:f[0]}),B("path",{class:O.pointer,d:"M 56.5 6.06217782649107 L 60 0 L 63.5 6.06217782649107 Z",key:`${O.pointer}-west`}),B("path",{class:this.classes(O.pointer,O.north),d:"M 113.93782217350893 56.5 L 120 60 L 113.93782217350893 63.5 Z",key:`${O.pointer}-north`}),B("path",{class:O.pointer,d:"M 56.5 113.93782217350893 L 60 120 L 63.5 113.93782217350893 Z",key:`${O.pointer}-east`}),B("path",{class:O.pointer,d:"M 6.06217782649107 56.5 L 0 60 L 6.06217782649107 63.5 Z",key:`${O.pointer}-south`}),B("path",{class:this.classes(O.sector,O.sectorSeparator),d:"M 23.937554159486076 23.937554159486076 L 96.06244584051393 96.06244584051393 M 23.937554159486076 96.06244584051393 L 96.06244584051393 23.937554159486076",key:O.sectorSeparator}),C([f[2],f[1],f[0]],f[3],f[3]).map(((t,i)=>B("path",{afterRemoved:u,class:this.classes(O.sector,e?.[i]?.length?O.sectorEnabled:O.sectorDisabled),d:t,"data-sector":`${i}`,key:`${O.sector}-${i}`,onclick:d}))),B("path",{class:this.classes(O.sector,O.sectorCross),d:"M 56.4 56.4 L 63.53 63.53 M 63.53 56.4 L 56.4 63.53",key:O.sectorCross}),p,a.attributes.cameraPitch>=5&&s?B("path",{class:O.selectedFeaturePath,d:s,fill:`url(#${this.id}-coverage-fill)`,key:O.selectedFeaturePath}):null))):null}_renderThumbnails(e){const{currentBestFeature:t}=this.viewModel;return t?B("div",{class:O.carouselContent},e.items.map((({url:e,objectId:i,rotation:a},o)=>B("div",{class:`${O.carouselItemWrapper}${t.attributes.objectId===i?"--selected":""}`,key:`${O.carouselItemWrapper}-${o}`},B("canvas",{afterCreate:this._registerGalleryItem,afterRemoved:this._unregisterGalleryItem,alt:`thumbnail-${i}`,class:O.carouselItem,"data-objectid":`${i}`,"data-rotation":`${a}`,"data-src":e,onclick:this._loadImageFromGallery,onmouseenter:this._highlight,onmouseleave:this._removeHighlight}))))):null}_resetImageTools(){this.viewModel.sharpness=this.viewModel.brightness=this.viewModel.contrast=0}_storeActionElement(e){this._actionItems.set(e.text,e)}_storeNavigationToolReference(e){this._navigationTool=e}_storeWarningTitleElement(e){this._warningTitleElement=e}_toggleAdditionalCameraLocations(){this.isAdditionalPointSourcesVisible=!this.isAdditionalPointSourcesVisible}_toggleAdditionalCoverage(){this.isAdditionalCoverageVisible=!this.isAdditionalCoverageVisible}_toggleCurrentCoverage(){this.currentCoverageVisible=!this.currentCoverageVisible}_toggleImageEnhancementToolState(e){e.stopPropagation(),this.imageEnhancementToolActive=!this.imageEnhancementToolActive,this.imageEnhancementToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleImageOverlays(e){e.stopPropagation(),this.imageOverlaysOpened=!this.imageOverlaysOpened,this.imageOverlaysOpened&&(this.galleryOpened&&(this.galleryOpened=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1))}_toggleImageGallery(e){e.stopPropagation(),this.galleryOpened=!!this.imageGalleryEnabled&&!this.galleryOpened,this.galleryOpened&&(this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.navigationToolActive&&(this.navigationToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleNavigationTool(){this.navigationToolActive=!this.navigationToolActive,this.navigationToolActive&&(this.galleryOpened&&(this.galleryOpened=!1),this.imageEnhancementToolActive&&(this.imageEnhancementToolActive=!1),this.imageOverlaysOpened&&(this.imageOverlaysOpened=!1))}_toggleMapImageConversionToolState(){this.mapImageConversionToolState=!this.mapImageConversionToolState}_unregisterGalleryItem(e){this._galleryObserver.unobserve(e)}_updateNavigationTool(e){const{previousFeatureAngle:t,bestFeatureAngle:i}=this.viewModel,a=(i-t+540)%360-180;e.style.setProperty(F,`${t}deg`),e.style.setProperty(E,`${t+a}deg`)}getConvertedAreaMeasurement(){const{viewModel:{areaMeasurementResult:e},measurementUnitMessages:t,pixelAreaMeasurementUnit:i,messages:{startMeasurement:a}}=this;return i&&e?r(t,l(e,"square-meters"),i):a}getConvertedMeasurement(){const{viewModel:{distanceMeasurementResult:e},measurementUnitMessages:t,pixelMeasurementUnit:i,messages:{startMeasurement:a}}=this;return i&&e?n(t,c(e,"meters"),i):a}async loadBestImage(e){return this.viewModel.loadBestImage(e)}loadImageFromSource(e,t){return this.viewModel.loadImageFromSource(e,t)}async plotMapPoint(e){return this.viewModel.plotMapPoint(e)}plotReferencePointOnGround(e){this.viewModel.plotReferencePointOnGround(e)}plotReferencePointOnImage(e){this.viewModel.plotReferencePointOnImage(e)}resetImage(){this.viewModel.resetImage()}render(){return B("div",{class:this.classes(j.widget,L)},this._context)}updateSuitabilities(e){this.viewModel.updateSuitabilities(e)}};e([u()],U.prototype,"activeLayer",null),e([u()],U.prototype,"currentBestFeature",null),e([u()],U.prototype,"currentCoverageVisible",null),e([u()],U.prototype,"digitizationLayer",null),e([u()],U.prototype,"disabled",null),e([u()],U.prototype,"features",null),e([u()],U.prototype,"imagePointsInView",null),e([u()],U.prototype,"galleryOpened",void 0),e([u()],U.prototype,"icon",null),e([u()],U.prototype,"imageEnhancementToolActive",void 0),e([u({readOnly:!0})],U.prototype,"imageGalleryEnabled",null),e([u()],U.prototype,"imageOverlaysOpened",void 0),e([u({readOnly:!0})],U.prototype,"invalidCameraHeading",null),e([u()],U.prototype,"isAdditionalCoverageVisible",null),e([u()],U.prototype,"isAdditionalPointSourcesVisible",null),e([u()],U.prototype,"mapImageConversionToolState",null),e([u()],U.prototype,"layer",null),e([u()],U.prototype,"listItemCreatedFunction",null),e([u()],U.prototype,"navigationToolActive",void 0),e([u()],U.prototype,"onOverlayAction",void 0),e([u({type:x})],U.prototype,"viewModel",void 0),e([u(),G("esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer")],U.prototype,"messages",void 0),e([u(),G("esri/core/t9n/Units")],U.prototype,"measurementUnitMessages",void 0),e([u(),G("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([u(),G("esri/widgets/Sketch/t9n/Sketch")],U.prototype,"messagesSketch",void 0),e([u()],U.prototype,"pixelMeasurementUnit",void 0),e([u()],U.prototype,"pixelAreaMeasurementUnit",void 0),e([u({readOnly:!0})],U.prototype,"popupEnabled",null),e([u()],U.prototype,"referencePoint",null),e([u()],U.prototype,"showCameraLocations",void 0),e([u()],U.prototype,"showMapFeatures",void 0),e([$(["create","delete","redo","undo","update"]),u({readOnly:!0})],U.prototype,"sketchViewModel",null),e([u()],U.prototype,"view",null),e([u({type:V,nonNullable:!0})],U.prototype,"visibleElements",void 0),e([u()],U.prototype,"determineWorkflowForFeature",null),e([u()],U.prototype,"updateFootprint",null),e([u()],U.prototype,"_actionBarContext",null),e([u()],U.prototype,"_actionItems",void 0),e([u()],U.prototype,"_actionTooltips",null),e([u()],U.prototype,"_additionalFootprintToggle",null),e([u()],U.prototype,"_additionalPointSourcesToggle",null),e([u()],U.prototype,"_context",null),e([u()],U.prototype,"_currentAction",void 0),e([u()],U.prototype,"_currentFootprintToggle",null),e([u()],U.prototype,"_imageEnhancementTools",null),e([u()],U.prototype,"_imageEnhancementsToggle",null),e([u()],U.prototype,"_imageGalleryPanel",null),e([u()],U.prototype,"_imageGalleryToggle",null),e([u()],U.prototype,"_imageOverlaysComponent",null),e([u()],U.prototype,"_imageOverlayMessages",null),e([u()],U.prototype,"_imageOverlaysPanel",null),e([u()],U.prototype,"_imageOverlaysToggle",null),e([u()],U.prototype,"_imageViewer",null),e([u()],U.prototype,"_mapImageConversionToggle",null),e([u()],U.prototype,"_messageBox",null),e([u()],U.prototype,"_navigationToolToggle",null),e([u()],U.prototype,"_navigationToolExpanded",void 0),e([u()],U.prototype,"_navigationTool",void 0),e([u()],U.prototype,"_openPopupAction",null),e([u()],U.prototype,"_panoramicViewer",null),e([u()],U.prototype,"_warningTitleElement",void 0),e([u()],U.prototype,"_renderNavigation",null),U=e([v("esri.widgets.OrientedImageryViewer")],U);const z=U;export{z as default};
|