@arcgis/core 4.31.0-next.20240820 → 4.31.0-next.20240821

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{dc03a639c97a6f99dbc9.js → 1ac47b7a77818c372e1a.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{a2c40517266fe420017c.js → 25fa59544c13db8cee30.js} +1 -1
  4. package/assets/esri/core/workers/chunks/40e4224f700206c67053.js +1 -0
  5. package/assets/esri/core/workers/chunks/5c4173205f885cd21422.js +1 -0
  6. package/assets/esri/core/workers/chunks/5cb07fa227b7fd06499f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{44bb9ca79b7eeb605b32.js → 7fda3d3b211b6da5b0e5.js} +1 -1
  8. package/assets/esri/core/workers/chunks/949cbb667531527e6918.js +1 -0
  9. package/assets/esri/core/workers/chunks/9bbf7129579fe04ab268.js +1 -0
  10. package/assets/esri/core/workers/chunks/{1bd48c11947082f8b296.js → cd8d595d577b74817623.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{c27f0a9b14f82feb9792.js → cfc93bbd35cc4bfde7c0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{07737567079db2a208b3.js → e2a6f77c05d0818e3f74.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{1ee365125c9fb9d9cafe.js → e5474bcde5b8fa037b56.js} +11 -11
  14. package/assets/esri/core/workers/chunks/{bd9c85047ef82c5a8bef.js → ea561b2460e634a643fc.js} +1 -1
  15. package/chunks/BloomComposition.glsl.js +45 -0
  16. package/chunks/OperatorGeodesicBuffer.js +1 -1
  17. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  18. package/chunks/OperatorGeodeticDistance.js +1 -1
  19. package/chunks/OperatorProximity.js +5 -0
  20. package/chunks/Polyline.js +1 -1
  21. package/core/mathUtils.js +1 -1
  22. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  23. package/geometry/operators/gx/operatorCut.js +1 -1
  24. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  25. package/geometry/operators/gx/operatorOffset.js +1 -1
  26. package/geometry/operators/gx/operatorSimplify.js +1 -1
  27. package/geometry/operators/gx/operatorUnion.js +1 -1
  28. package/geometry/operators/operatorProximity.js +5 -0
  29. package/geometry/operators/operatorRelate.js +1 -1
  30. package/geometry/operators/operatorReshape.js +5 -0
  31. package/layers/LinkChartLayer.js +1 -1
  32. package/layers/graphics/sources/geojson/geojson.js +1 -1
  33. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  34. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  35. package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
  36. package/layers/knowledgeGraph/layerUtils.js +1 -1
  37. package/package.json +1 -1
  38. package/portal/PortalItem.js +1 -1
  39. package/support/revision.js +1 -1
  40. package/symbols/cim/cimAnalyzer.js +1 -1
  41. package/symbols/support/utils.js +1 -1
  42. package/views/3d/state/ViewStateManager.js +1 -1
  43. package/views/3d/support/cameraUtils.js +1 -1
  44. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  45. package/views/3d/support/viewpointUtils.js +1 -1
  46. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +3 -3
  47. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +5 -0
  48. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +5 -0
  49. package/views/3d/webgl-engine/effects/bloom/BloomTechnique.js +5 -0
  50. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  51. package/widgets/OrientedImageryViewer.js +1 -1
  52. package/assets/esri/core/workers/chunks/2b61de00084c1ca97da6.js +0 -1
  53. package/assets/esri/core/workers/chunks/31f931de94414f13bd13.js +0 -1
  54. package/assets/esri/core/workers/chunks/6f1853ab502bebefd3c3.js +0 -1
  55. package/assets/esri/core/workers/chunks/9661398ce832137461f6.js +0 -1
  56. package/assets/esri/core/workers/chunks/cd737bfb5ff43737a3df.js +0 -1
package/core/mathUtils.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{l as t,s as n}from"../chunks/vec32.js";const r=new Float32Array(1);function u(t){--t;for(let n=1;n<32;n<<=1)t|=t>>n;return t+1}function e(t,n,r){return Math.min(Math.max(t,n),r)}function i(t,n){return 0===n?0:Math.round(t/n)*n}function a(t){return!(t&t-1)}function o(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function c(t){return 10**Math.ceil(Math.LOG10E*Math.log(t))}function f(t,n,r){return t+(n-t)*r}function s(t,n,r,u,e){return f(u,e,(t-n)/(r-n))}function h(t){return t*Math.PI/180}function M(t){return 180*t/Math.PI}function b(t,n=1e-6){return(t<0?-1:1)/Math.max(Math.abs(t),n)}function m(t){return Math.acos(e(t,-1,1))}function l(t){return Math.asin(e(t,-1,1))}function F(t,n,r=1e-6){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;return(t>n?t-n:n-t)<=r}const N=new DataView(new ArrayBuffer(Float64Array.BYTES_PER_ELEMENT));function g(t){return N.setFloat64(0,t),N.getBigInt64(0)}function E(t){return N.setBigInt64(0,t),N.getFloat64(0)}const B=BigInt("1000000"),I=w(1);function w(t){const n=g(t=Math.abs(t)),r=E(n<=B?B:n-B);return Math.abs(t-r)}function x(t,n,r=I){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;if(null!=r){if(w(Math.min(Math.abs(t),Math.abs(n)))<r)return Math.abs(t-n)<=r}const u=g(t),e=g(n);if(u<0!=e<0)return!1;return!((u<e?e-u:u-e)>B)}function y(t,n,r=1e-6){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;const u=Math.abs(t-n),e=Math.abs(t),i=Math.abs(n);if(0===t||0===n||e<1e-12&&i<1e-12){if(u>.01*r)return!1}else if(u/(e+i)>r)return!1;return!0}function A(t){return P(Math.max(-j,Math.min(t,j)))}function P(t){return r[0]=t,r[0]}function p(t,n,r){const u=e((r-t)/(n-t),0,1);return u*u*(3-2*u)}function L(r,u){const e=t(r),i=l(r[2]/e),a=Math.atan2(r[1]/e,r[0]/e);return n(u,e,i,a),u}function T(t,r){const u=t[0],e=t[1],i=t[2],a=Math.cos(e);n(r,u*a*Math.cos(i),u*a*Math.sin(i),u*Math.sin(e))}function _(t){const n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[3]*t[3]+t[4]*t[4]+t[5]*t[5],u=t[6]*t[6]+t[7]*t[7]+t[8]*t[8];return!(F(n,1)&&F(r,1)&&F(u,1))}function d(t,n){return(t%n+n)%n}const j=P(34028234663852886e22);export{m as acosClamped,l as asinClamped,L as cartesianToSpherical,e as clamp,A as clampFloat32,h as deg2rad,F as floatEqualAbsolute,y as floatEqualRelative,x as floatEqualUlp,_ as hasScaling,a as isPowerOfTwo,f as lerp,d as moduloPositive,c as nextHighestPowerOfTen,u as nextHighestPowerOfTwo,o as nextPowerOfTwo,j as numberMaxFloat32,M as rad2deg,b as reciprocalClamped,i as roundToNearest,s as scale,p as smoothstep,T as sphericalToCartesian};
5
+ import{l as t,s as n}from"../chunks/vec32.js";const r=new Float32Array(1);function u(t){--t;for(let n=1;n<32;n<<=1)t|=t>>n;return t+1}function e(t,n,r){return Math.min(Math.max(t,n),r)}function i(t,n){return 0===n?0:Math.round(t/n)*n}function a(t){return!(t&t-1)}function o(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function c(t){return 10**Math.ceil(Math.LOG10E*Math.log(t))}function f(t,n,r){return t+(n-t)*r}function s(t,n){const r=-t*t/(2*n);return 1/Math.sqrt(2*Math.PI*n)*Math.exp(r)}function h(t,n,r,u,e){return f(u,e,(t-n)/(r-n))}function M(t){return t*Math.PI/180}function b(t){return 180*t/Math.PI}function m(t,n=1e-6){return(t<0?-1:1)/Math.max(Math.abs(t),n)}function l(t){return Math.acos(e(t,-1,1))}function F(t){return Math.asin(e(t,-1,1))}function N(t,n,r=1e-6){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;return(t>n?t-n:n-t)<=r}const g=new DataView(new ArrayBuffer(Float64Array.BYTES_PER_ELEMENT));function E(t){return g.setFloat64(0,t),g.getBigInt64(0)}function I(t){return g.setBigInt64(0,t),g.getFloat64(0)}const x=BigInt("1000000"),B=w(1);function w(t){const n=E(t=Math.abs(t)),r=I(n<=x?x:n-x);return Math.abs(t-r)}function P(t,n,r=B){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;if(null!=r){if(w(Math.min(Math.abs(t),Math.abs(n)))<r)return Math.abs(t-n)<=r}const u=E(t),e=E(n);if(u<0!=e<0)return!1;return!((u<e?e-u:u-e)>x)}function p(t,n,r=1e-6){if(t===n)return!0;if(!Number.isFinite(t)||!Number.isFinite(n))return!1;const u=Math.abs(t-n),e=Math.abs(t),i=Math.abs(n);if(0===t||0===n||e<1e-12&&i<1e-12){if(u>.01*r)return!1}else if(u/(e+i)>r)return!1;return!0}function y(t){return A(Math.max(-k,Math.min(t,k)))}function A(t){return r[0]=t,r[0]}function L(t,n,r){const u=e((r-t)/(n-t),0,1);return u*u*(3-2*u)}function T(r,u){const e=t(r),i=F(r[2]/e),a=Math.atan2(r[1]/e,r[0]/e);return n(u,e,i,a),u}function _(t,r){const u=t[0],e=t[1],i=t[2],a=Math.cos(e);n(r,u*a*Math.cos(i),u*a*Math.sin(i),u*Math.sin(e))}function d(t){const n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[3]*t[3]+t[4]*t[4]+t[5]*t[5],u=t[6]*t[6]+t[7]*t[7]+t[8]*t[8];return!(N(n,1)&&N(r,1)&&N(u,1))}function j(t,n){return(t%n+n)%n}const k=A(34028234663852886e22);export{l as acosClamped,F as asinClamped,T as cartesianToSpherical,e as clamp,y as clampFloat32,M as deg2rad,N as floatEqualAbsolute,p as floatEqualRelative,P as floatEqualUlp,s as gauss,d as hasScaling,a as isPowerOfTwo,f as lerp,j as moduloPositive,c as nextHighestPowerOfTen,u as nextHighestPowerOfTwo,o as nextPowerOfTwo,k as numberMaxFloat32,b as rad2deg,m as reciprocalClamped,i as roundToNearest,h as scale,L as smoothstep,_ as sphericalToCartesian};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,o as t,p as r,_ as s,G as n,aB as o,aC as l,A as u,aD as i,S as m}from"../../../chunks/Polyline.js";class a{getOperatorType(){return 10008}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(t,r,s,n){const o=(new e).executeMany(t,s,n);return new p(o,r,s,n)}}class p extends t{constructor(e,t,r,s){super(),this.m_resultPolygons=null,this.m_polygons=e,this.m_polylines=t,this.m_sr=r,this.m_progressTracker=s,this.m_bFirst=!0}tock(){return!0}getRank(){return 1}next(){return this.m_bFirst&&(this.performOperation(),this.m_bFirst=!1),this.m_resultPolygons?this.m_resultPolygons.next():null}getGeometryID(){return null!=this.m_resultPolygons?this.m_resultPolygons.getGeometryID():-1}performOperation(){const e=new r,t=new s;let m,a=o;for(;m=this.m_polylines.next();){if(m.getGeometryType()!==n.enumPolyline||m.isEmpty())continue;a===o?a=t.addGeometry(m):t.appendGeometry(a,m);const s=new r;m.queryEnvelope(s),e.mergeEnvelope2D(s)}if(0===t.getTotalPointCount())return;for(;m=this.m_polygons.next();){if(!l(m.getGeometryType())||m.isEmpty())continue;const s=new r;m.queryEnvelope(s),e.mergeEnvelope2D(s),t.addGeometry(m)}const p=u(this.m_sr,e,!0);this.m_resultPolygons=i(t,a,p,this.m_progressTracker)}}const y=new a;function c(e,t,r){const s=y.execute(new m(e),new m(t),r,null);return Array.from(s)}function g(){return y.supportsCurves()}export{c as execute,g as supportsCurves};
5
+ import{v as e,w as t,o as r,a1 as s,G as n,aB as o,aC as l,D as u,aD as i,S as m}from"../../../chunks/Polyline.js";class a{getOperatorType(){return 10008}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(t,r,s,n){const o=(new e).executeMany(t,s,n);return new y(o,r,s,n)}}class y extends t{constructor(e,t,r,s){super(),this.m_resultPolygons=null,this.m_polygons=e,this.m_polylines=t,this.m_sr=r,this.m_progressTracker=s,this.m_bFirst=!0}tock(){return!0}getRank(){return 1}next(){return this.m_bFirst&&(this.performOperation(),this.m_bFirst=!1),this.m_resultPolygons?this.m_resultPolygons.next():null}getGeometryID(){return null!=this.m_resultPolygons?this.m_resultPolygons.getGeometryID():-1}performOperation(){const e=new r,t=new s;let m,a=o;for(;m=this.m_polylines.next();){if(m.getGeometryType()!==n.enumPolyline||m.isEmpty())continue;a===o?a=t.addGeometry(m):t.appendGeometry(a,m);const s=new r;m.queryEnvelope(s),e.mergeEnvelope2D(s)}if(0===t.getTotalPointCount())return;for(;m=this.m_polygons.next();){if(!l(m.getGeometryType())||m.isEmpty())continue;const s=new r;m.queryEnvelope(s),e.mergeEnvelope2D(s),t.addGeometry(m)}const y=u(this.m_sr,e,!0);this.m_resultPolygons=i(t,a,y,this.m_progressTracker)}}const p=new a;function c(e,t,r){const s=p.execute(new m(e),new m(t),r,null);return Array.from(s)}function g(){return p.supportsCurves()}export{c as execute,g as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{o as t,b as e,aG as s,A as n,G as r,t as o,a as u,ai as i,_ as c,aH as m,aI as a,aJ as l,aK as h,aL as d,aB as y,aM as p}from"../../../chunks/Polyline.js";var _=p;function g(t,e){return{m_geometry:t,m_side:e}}function f(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const u=[],i=new c;{const c=i.createGeometryUserIndex(),y=i.addGeometry(e),p=i.addGeometry(s),f=new m(o);let C=0,E=null;if(i.hasCurves()){E=new _;const t=i.getEnvelope2D(o);C=a(n.total());const e=l(n.total(),t);h(i,e,n.total(),12e3,E,null,o)}i.dbgVerifyCurves(),f.setEditShapeCrackAndCluster(i,n),f.cut(t,c,y,p,u);for(const t of u){null!==E&&E.stitchCurves(i,t,C,!1);const e=g(i.getGeometry(t),d(i.getGeometryUserIndex(t,c)));r.push(e)}null!==E&&E.clearStitcher(i)}}function C(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const i=[],d=new c;{const t=d.createGeometryUserIndex(),p=d.addGeometry(e),f=d.addGeometry(s),C=new m(o);let E=0,G=null;if(d.hasCurves()){G=new _;const t=d.getEnvelope2D(o);E=a(n.total());const e=l(n.total(),t);h(d,e,n.total(),12e3,G,null,o)}d.dbgVerifyCurves(),C.setEditShapeCrackAndCluster(d,n),C.cut(!1,t,p,f,i),null!==G&&G.stitchCurves(d,y,E,!0);let v=d.getGeometry(p);const w=new u,x=new u,k=[];for(let e=0;e<i.length;e++){let s=null;{const r=new c,u=r.addGeometry(v),m=r.addGeometry(d.getGeometry(i[e]));if(r.hasCurves()){const t=r.getEnvelope2D(o);E=a(n.total());const e=l(n.total(),t);h(r,e,n.total(),12e3,G,null,o)}C.setEditShapeCrackAndCluster(r,n);const p=C.intersection(u,m);if(null!==G&&G.stitchCurves(r,y,E,!0),s=r.getGeometry(p),s.isEmpty())continue;const _=d.getGeometryUserIndex(i[e],t);2===_?w.add(s,!1):1===_?x.add(s,!1):k.push(s)}{const t=new c,s=t.addGeometry(v),r=t.addGeometry(d.getGeometry(i[e]));if(t.hasCurves()){const e=t.getEnvelope2D(o);E=a(n.total());const s=l(n.total(),e);h(t,s,n.total(),12e3,G,null,o)}C.setEditShapeCrackAndCluster(t,n);const u=C.difference(s,r);null!==G&&G.stitchCurves(t,y,E,!0);v=t.getGeometry(u)}}if(!v.isEmpty()&&i.length>0&&k.push(v),w.isEmpty()&&x.isEmpty())return;if(!w.isEmpty()){const t=g(w,1);r.push(t)}if(!x.isEmpty()){const t=g(x,2);r.push(t)}for(let e=0,s=k.length;e<s;++e){const t=g(k[e],3);r.push(t)}}}class E{getOperatorType(){return 10005}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}execute(t,e,s,n,r){return new G(t,e,s,n,r)}}class G extends t{constructor(t,r,o,u,i){super(),this.m_cutIndex=-1,this.m_cuts=[],this.m_progressTracker=i,this.m_cuttee=r.clone(),this.m_cutter=new e({copy:o}),this.m_bConsiderTouch=t;const c=s(r,o);this.m_tolerance=n(u,c,!0)}next(){return-1===this.m_cutIndex&&this.generateCuts(),++this.m_cutIndex<this.m_cuts.length?this.m_cuts[this.m_cutIndex]:null}getGeometryID(){return 0}tock(){return!0}getRank(){return 1}generateCuts(){switch(this.m_cuttee.getGeometryType()){case r.enumPolyline:this.generatePolylineCuts();break;case r.enumPolygon:this.generatePolygonCuts()}}generatePolylineCuts(){const t=new e,s=new e,n=new e;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(s);const r=[];f(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,r,this.m_progressTracker);for(let e=0;e<r.length;e++){const u=r[e];1===u.m_side?t.add(u.m_geometry,!1):2===u.m_side||4===u.m_side?s.add(u.m_geometry,!1):3===u.m_side?this.m_cuts.push(u.m_geometry):0===u.m_side?n.add(u.m_geometry,!1):o("")}n.isEmpty()||t.isEmpty()&&s.isEmpty()&&!(this.m_cuts.length>=3)||this.m_cuts.push(n),t.isEmpty()&&s.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}generatePolygonCuts(){const t=new u,e=new u,s=new u;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const n=[];C(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,n,this.m_progressTracker);for(let r=0;r<n.length;r++){const u=n[r];1===u.m_side?t.add(u.m_geometry,!1):2===u.m_side?e.add(u.m_geometry,!1):3===u.m_side?this.m_cuts.push(u.m_geometry):0===u.m_side?s.add(u.m_geometry,!1):o("")}i(s.isEmpty()||1===n.length),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}}const v=new E;function w(t,e,s){const n=v.execute(!0,t,e,s,null);return Array.from(n)}function x(){return v.supportsCurves()}export{w as execute,x as supportsCurves};
5
+ import{w as t,b as e,aG as s,D as n,G as r,t as o,a as u,s as c,a1 as i,aH as m,aI as a,aJ as l,aK as h,aL as d,aB as y,aM as p}from"../../../chunks/Polyline.js";var _=p;function g(t,e){return{m_geometry:t,m_side:e}}function f(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const u=[],c=new i;{const i=c.createGeometryUserIndex(),y=c.addGeometry(e),p=c.addGeometry(s),f=new m(o);let C=0,E=null;if(c.hasCurves()){E=new _;const t=c.getEnvelope2D(o);C=a(n.total());const e=l(n.total(),t);h(c,e,n.total(),12e3,E,null,o)}c.dbgVerifyCurves(),f.setEditShapeCrackAndCluster(c,n),f.cut(t,i,y,p,u);for(const t of u){null!==E&&E.stitchCurves(c,t,C,!1);const e=g(c.getGeometry(t),d(c.getGeometryUserIndex(t,i)));r.push(e)}null!==E&&E.clearStitcher(c)}}function C(t,e,s,n,r,o){if(e.isEmpty()){const t=g(e,0);return void r.push(t)}if(s.isEmpty()){const t=g(e,0);return void r.push(t)}const c=[],d=new i;{const t=d.createGeometryUserIndex(),p=d.addGeometry(e),f=d.addGeometry(s),C=new m(o);let E=0,G=null;if(d.hasCurves()){G=new _;const t=d.getEnvelope2D(o);E=a(n.total());const e=l(n.total(),t);h(d,e,n.total(),12e3,G,null,o)}d.dbgVerifyCurves(),C.setEditShapeCrackAndCluster(d,n),C.cut(!1,t,p,f,c),null!==G&&G.stitchCurves(d,y,E,!0);let v=d.getGeometry(p);const w=new u,x=new u,k=[];for(let e=0;e<c.length;e++){let s=null;{const r=new i,u=r.addGeometry(v),m=r.addGeometry(d.getGeometry(c[e]));if(r.hasCurves()){const t=r.getEnvelope2D(o);E=a(n.total());const e=l(n.total(),t);h(r,e,n.total(),12e3,G,null,o)}C.setEditShapeCrackAndCluster(r,n);const p=C.intersection(u,m);if(null!==G&&G.stitchCurves(r,y,E,!0),s=r.getGeometry(p),s.isEmpty())continue;const _=d.getGeometryUserIndex(c[e],t);2===_?w.add(s,!1):1===_?x.add(s,!1):k.push(s)}{const t=new i,s=t.addGeometry(v),r=t.addGeometry(d.getGeometry(c[e]));if(t.hasCurves()){const e=t.getEnvelope2D(o);E=a(n.total());const s=l(n.total(),e);h(t,s,n.total(),12e3,G,null,o)}C.setEditShapeCrackAndCluster(t,n);const u=C.difference(s,r);null!==G&&G.stitchCurves(t,y,E,!0);v=t.getGeometry(u)}}if(!v.isEmpty()&&c.length>0&&k.push(v),w.isEmpty()&&x.isEmpty())return;if(!w.isEmpty()){const t=g(w,1);r.push(t)}if(!x.isEmpty()){const t=g(x,2);r.push(t)}for(let e=0,s=k.length;e<s;++e){const t=g(k[e],3);r.push(t)}}}class E{getOperatorType(){return 10005}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}execute(t,e,s,n,r){return new G(t,e,s,n,r)}}class G extends t{constructor(t,r,o,u,c){super(),this.m_cutIndex=-1,this.m_cuts=[],this.m_progressTracker=c,this.m_cuttee=r.clone(),this.m_cutter=new e({copy:o}),this.m_bConsiderTouch=t;const i=s(r,o);this.m_tolerance=n(u,i,!0)}next(){return-1===this.m_cutIndex&&this.generateCuts(),++this.m_cutIndex<this.m_cuts.length?this.m_cuts[this.m_cutIndex]:null}getGeometryID(){return 0}tock(){return!0}getRank(){return 1}generateCuts(){switch(this.m_cuttee.getGeometryType()){case r.enumPolyline:this.generatePolylineCuts();break;case r.enumPolygon:this.generatePolygonCuts()}}generatePolylineCuts(){const t=new e,s=new e,n=new e;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(s);const r=[];f(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,r,this.m_progressTracker);for(let e=0;e<r.length;e++){const u=r[e];1===u.m_side?t.add(u.m_geometry,!1):2===u.m_side||4===u.m_side?s.add(u.m_geometry,!1):3===u.m_side?this.m_cuts.push(u.m_geometry):0===u.m_side?n.add(u.m_geometry,!1):o("")}n.isEmpty()||t.isEmpty()&&s.isEmpty()&&!(this.m_cuts.length>=3)||this.m_cuts.push(n),t.isEmpty()&&s.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}generatePolygonCuts(){const t=new u,e=new u,s=new u;this.m_cuts.length=0,this.m_cuts.push(t),this.m_cuts.push(e);const n=[];C(this.m_bConsiderTouch,this.m_cuttee,this.m_cutter,this.m_tolerance,n,this.m_progressTracker);for(let r=0;r<n.length;r++){const u=n[r];1===u.m_side?t.add(u.m_geometry,!1):2===u.m_side?e.add(u.m_geometry,!1):3===u.m_side?this.m_cuts.push(u.m_geometry):0===u.m_side?s.add(u.m_geometry,!1):o("")}c(s.isEmpty()||1===n.length),t.isEmpty()&&e.isEmpty()&&this.m_cuts.length<3&&(this.m_cuts.length=0)}}const v=new E;function w(t,e,s){const n=v.execute(!0,t,e,s,null);return Array.from(n)}function x(){return v.supportsCurves()}export{w as execute,x as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{e,r as t,q as n,G as r,p as o,au as s,az as i,y as a,ai as u,o as c,u as l,P as m,L as N,a as g,aR as y,aS as d,aT as h,aU as P,V as f}from"../../../chunks/Polyline.js";import{a as x}from"../../../chunks/Centroid-DZi-eb9F.js";function p(e,t,n=-1,s=-1){if(e.isEmpty())return 3;const i=e.getGeometryType();if(a(i))return b(e,t,n,s);if(i===r.enumPolygon)return w();if(i===r.enumPolyline)return C();if(i===r.enumEnvelope){const n=new o;return e.queryEnvelope(n),n.contains(t)?n.containsExclusive(t)?1:2:0}return 3}function b(n,r,o,s){if(o>=0||s>=0)return t("");if(n.isDegenerate(0))return n.getStartXY().equals(r)?2:3;if(!n.isCurve()){const t=e.orientationRobust(r,n.getStartXY(),n.getEndXY());return t<0?1:t>0?0:2}const i=n.getClosestCoordinate(r,!1),a=n.getTangent(i),u=n.getCoord2D(i),c=e.orientationRobust(r,u,u.add(a));return c<0?1:c>0?0:2}function w(e,t,n,r){return u(0),3}function C(e,t,n,r){return u(0),3}const _=A(new e,-1,Number.NaN);function A(e,t,n){return{m_coordinate:e.clone(),m_vertexIndex:t,m_geometryIndex:0,m_distance:n,m_bRightSide:!1,isEmpty:G}}function G(){return Number.isNaN(this.m_distance)}class E{getOperatorType(){return 10500}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}getNearestCoordinate(e,o,s,i){if(o.isNAN()&&t("NAN xy coordinates are not allowed"),e.isEmpty())return _;switch(e.getGeometryType()){case r.enumPoint:return this.pointGetNearestVertex(e,o);case r.enumMultiPoint:return this.multiVertexGetNearestVertex(e,o);case r.enumPolyline:case r.enumPolygon:return this.multiPathGetNearestCoordinate(e,o,s,i);default:n("")}}getNearestVertex(e,o){if(o.isNAN()&&t("NAN xy coordinates are not allowed"),e.isEmpty())return _;switch(e.getGeometryType()){case r.enumPoint:return this.pointGetNearestVertex(e,o);case r.enumMultiPoint:case r.enumPolyline:case r.enumPolygon:return this.multiVertexGetNearestVertex(e,o);default:n("")}}getNearestVertices(e,o,s,i){if(0===i&&t(""),o.isNAN()&&t("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case r.enumPoint:return this.pointGetNearestVertices(e,o,s,i);case r.enumMultiPoint:case r.enumPolyline:case r.enumPolygon:return this.multiVertexGetNearestVertices(e,o,s,i);default:n("")}}multiPathGetNearestCoordinate(n,a,u,c){if(n.getGeometryType()===r.enumPolygon&&u){const e=new o;n.queryEnvelope(e);const t=s(null,e,!1);let r;if(r=i(n,a,c?0:t),0!==r){const e=A(a,-1,0);return c&&(e.m_bRightSide=!0),e}}const l=n.querySegmentIterator(),m=new e;let N=-1,g=-1,y=Number.MAX_VALUE,d=0;for(;l.nextPath();)for(;l.hasNextSegment();){const t=l.nextSegment(),n=t.getClosestCoordinate(a,!1),r=t.getCoord2D(n),o=e.sqrDistance(r,a);o<y?(d=1,m.assign(r),N=l.getStartPointIndex(),g=l.getPathIndex(),y=o):o===y&&d++}-1===N&&t("");const h=A(m,N,Math.sqrt(y));if(c)if(n.getGeometryType()!==r.enumPolygon){let e=!1;if(d>1){const t=p(n,a,N,g);e=0!==t&&3!==t}else{l.resetToVertex(N,g);e=0!==p(l.nextSegment(),a)}h.m_bRightSide=e}else if(!u){0!==i(n,a,0)&&(h.m_bRightSide=!0)}return h}pointGetNearestVertex(t,n){const r=t.getXY();return A(r,0,e.distance(r,n))}multiVertexGetNearestVertex(t,n){const r=t.getAttributeStreamRef(0),o=t.getPointCount();let s=-1;const i=new e;let a=Number.MAX_VALUE;const u=new e;for(let c=0;c<o;c++){r.queryPoint2D(2*c,u);const t=e.sqrDistance(u,n);t<a&&(i.assign(u),s=c,a=t)}return A(i,s,Math.sqrt(a))}pointGetNearestVertices(t,n,r,o){const s=[];if(0!==o){const o=r*r,i=t.getXY(),a=e.sqrDistance(i,n);a<=o&&s.push(A(i,0,Math.sqrt(a)))}return s}multiVertexGetNearestVertices(t,n,r,o){const s=[];if(0!==o){const i=t.getAttributeStreamRef(0),a=t.getPointCount();s.length=o+1;const u=r*r;for(let t=0;t<a;t++){const r=i.read(2*t),o=i.read(2*t+1),a=n.x-r,c=n.y-o,l=a*a+c*c;l<=u&&s.push(A(e.construct(r,o),t,Math.sqrt(l)))}s.sort(((e,t)=>e.m_distance-t.m_distance))}return s.slice(0,o)}}class D{getOperatorType(){return 10203}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t){return u(0),{}}execute(e,t){return new q(null,t).labelPoint(e)}}class q extends c{progress_(){}tock(){return u(0),!1}getRank(){return u(0),0}constructor(e,t){super(),this.m_index=-1,this.m_progressCounter=0,this.m_progressTracker=t,this.m_inputGeoms=e}next(){const e=this.m_inputGeoms.next();return e?(l(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.labelPoint(e)):null}getGeometryID(){return this.m_index}labelPoint(e){if(null===e&&t("null pointer is not allowed"),e.getGeometryType()===r.enumPoint)return e;if(e.isEmpty())return new m({vd:e.getDescription()});switch(e.getGeometryType()){case r.enumPolygon:return this.labelPointPolygon(e);case r.enumPolyline:return this.labelPointPolyline(e);case r.enumMultiPoint:return this.labelPointMultiPoint(e);case r.enumEnvelope:return this.labelPointEnvelope(e);default:t("geometry is not supported")}}labelPointPolygon(t){const n=N(null,t,!0).total();let r=null,s=t;if(t.hasNonLinearSegments()){const e=new g({copy:t}),o=y(e,.25*n,n,this.m_progressTracker);u(o!==t),r=o,s=r}let a=0,c=0;for(let e=0,o=s.getPathCount();e<o;++e){const t=Math.abs(s.calculateRingArea2D(e));t>c&&(c=t,a=e)}const l=new e;if(Math.abs(c)<=2*n*n?l.setNAN():l.assign(x(s,a)),Number.isNaN(l.x)){const e=new o;return s.queryPathEnvelope(a,e),new m({pt:e.getCenter()})}if(s.getPointCount()<4)return new m({x:l.x,y:l.y});const P=e.getNAN(),f=[P.clone(),P.clone(),P.clone(),P.clone()],p=[Number.NaN,Number.NaN,Number.NaN,Number.NaN],b=[Number.NaN,Number.NaN,Number.NaN,Number.NaN];let w=!1,C=(new E).getNearestCoordinate(s,l,!0,!1);0===C.m_distance&&(w=!0,f[0]=l,C=(new E).getNearestCoordinate(s,l,!1,!1)),p[0]=C.m_distance,b[0]=0;const _=new e;let A=!1,G=.25,D=-1;const q=new o;s.queryPathEnvelope(a,q);do{let t=Number.NaN;if(f[1]=this.calculateParacentroid_(s,d(q.xmin,q.xmax,G),n),f[1].isNAN()||(C=(new E).getNearestCoordinate(s,f[1],!1,!1),t=C.m_distance),t>n&&1===i(s,f[1],n))A=!0,p[1]=t,b[1]=e.sqrDistance(f[1],l);else if(t>D&&(D=t,_.setCoordsPoint2D(f[1])),G-=.01,G<.1){if(!(D>=0))break;A=!0,p[1]=D,f[1]=_,b[1]=e.sqrDistance(f[1],l)}}while(!A);A=!1,G=.5,D=-1;let S=.01,V=1;do{let t=Number.NaN;if(f[2]=this.calculateParacentroid_(s,d(q.xmin,q.xmax,G),n),f[2].isNAN()||(C=(new E).getNearestCoordinate(s,f[2],!1,!1),t=C.m_distance),t>n&&1===i(s,f[2],n))A=!0,p[2]=t,b[2]=e.sqrDistance(f[2],l);else if(t>D&&(D=t,_.setCoordsPoint2D(f[2])),G=.5+S*V,S+=.01,V*=-1,G<.3||G>.7){if(!(D>=0))break;A=!0,p[2]=D,f[2]=_,b[2]=e.sqrDistance(f[2],l)}}while(!A);A=!1,G=.75,D=-1;do{let t=Number.NaN;if(f[3]=this.calculateParacentroid_(s,d(q.xmin,q.xmax,G),n),f[3].isNAN()||(C=(new E).getNearestCoordinate(s,f[3],!1,!1),t=C.m_distance),t>n&&1===i(s,f[3],n))A=!0,p[3]=t,b[3]=e.sqrDistance(f[3],l);else if(t>D&&(D=t,_.setCoordsPoint2D(f[3])),G+=.01,G>.9){if(!(D>=0))break;A=!0,p[3]=D,f[3]=_,b[3]=e.sqrDistance(f[3],l)}}while(!A);const M=[0,1,2,3],v=w?0:1;for(let e=v;e<4;e++)for(let t=v;t<3;t++){const e=b[t],n=b[t+1];if(h(e,n)>0){const r=M[t];M[t]=M[t+1],M[t+1]=r,b[t]=n,b[t+1]=e}}let T=v,X=0,k=0;for(let e=v;e<4;e++){switch(e){case 0:k=2*p[M[e]];break;case 1:k=1.66666666*p[M[e]];break;case 2:k=1.33333333*p[M[e]];break;case 3:k=p[M[e]]}k>X&&(X=k,T=M[e])}return u(!f[T].isNAN()),new m({x:f[T].x,y:f[T].y})}labelPointPolyline(t){const n=new e;if(t.getPointCount()>2*t.getPathCount()){let e=-1,r=-Number.MAX_VALUE;for(let n=0,a=t.getPathCount();n<a;n++)if(t.getPathSize(n)>2){const o=t.calculatePathLength2D(n);o>r&&(r=o,e=n)}const o=t.getPathStart(e),s=t.getPathEnd(e),i=Math.trunc((o+s)/2);n.assign(t.getXY(i))}else{let e=-Number.MAX_VALUE;const r=t.querySegmentIterator();for(;r.nextPath();)if(r.hasNextSegment()){const t=r.nextSegment(),o=t.calculateLength2D();o>e&&(e=o,n.assign(t.getCoord2D(t.lengthToT(.5*o))))}}return new m({x:n.x,y:n.y})}labelPointMultiPoint(e){const t=new o;e.queryEnvelope(t);const n=t.getCenter(),r=(new E).getNearestCoordinate(e,n,!1,!1).m_coordinate;return new m({x:r.x,y:r.y})}labelPointEnvelope(e){const t=e.getCenterXY();return new m({x:t.x,y:t.y})}calculateParacentroid_(t,n,r){const s=new o;t.queryEnvelope(s);const i=new e(n,0);let a=Number.MAX_VALUE,c=Number.MAX_VALUE,l=!1,m=!1;const N=new P;N.setStartXYCoords(i.x,s.ymin-1),N.setEndXYCoords(i.x,s.ymax+1);const g=new o,y=new e,d=new e,h=f(e,2),x=t.querySegmentIterator();for(;x.nextPath();)for(;x.hasNextSegment();){const e=x.nextSegment();if(e.queryEnvelope(g),u(e.isMonotoneQuickAndDirty()),y.setCoordsPoint2D(N.getStartXY()),d.setCoordsPoint2D(N.getEndXY()),0===g.clipLine(y,d))continue;if(1!==N.intersect(e,h,null,null,r))continue;const t=h[0].y;a>c?t<a&&(a=t,l=!0):t<c&&(c=t,m=!0)}return l&&m?i.y=(a+c)/2:i.setNAN(),i}}const S=new D;function V(e){return S.execute(e,null)}function M(e){return e.map(V)}function v(){return S.supportsCurves()}export{V as execute,M as executeMany,v as supportsCurves};
5
+ import{s as e,w as t,y as n,m as r,G as o,P as s,R as a,a as i,aN as l,o as u,e as c,aO as m,q as N,aP as g,aQ as P,Y as h}from"../../../chunks/Polyline.js";import{a as y}from"../../../chunks/Centroid-DZi-eb9F.js";import{O as d}from"../../../chunks/OperatorProximity.js";class x{getOperatorType(){return 10203}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(t,n){return e(0),{}}execute(e,t){return new p(null,t).labelPoint(e)}}class p extends t{progress_(){}tock(){return e(0),!1}getRank(){return e(0),0}constructor(e,t){super(),this.m_index=-1,this.m_progressCounter=0,this.m_progressTracker=t,this.m_inputGeoms=e}next(){const e=this.m_inputGeoms.next();return e?(n(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.labelPoint(e)):null}getGeometryID(){return this.m_index}labelPoint(e){if(null===e&&r("null pointer is not allowed"),e.getGeometryType()===o.enumPoint)return e;if(e.isEmpty())return new s({vd:e.getDescription()});switch(e.getGeometryType()){case o.enumPolygon:return this.labelPointPolygon(e);case o.enumPolyline:return this.labelPointPolyline(e);case o.enumMultiPoint:return this.labelPointMultiPoint(e);case o.enumEnvelope:return this.labelPointEnvelope(e);default:r("geometry is not supported")}}labelPointPolygon(t){const n=a(null,t,!0).total();let r=null,o=t;if(t.hasNonLinearSegments()){const s=new i({copy:t}),a=l(s,.25*n,n,this.m_progressTracker);e(a!==t),r=a,o=r}let P=0,h=0;for(let e=0,s=o.getPathCount();e<s;++e){const t=Math.abs(o.calculateRingArea2D(e));t>h&&(h=t,P=e)}const x=new c;if(Math.abs(h)<=2*n*n?x.setNAN():x.assign(y(o,P)),Number.isNaN(x.x)){const e=new u;return o.queryPathEnvelope(P,e),new s({pt:e.getCenter()})}if(o.getPointCount()<4)return new s({x:x.x,y:x.y});const p=c.getNAN(),b=[p.clone(),p.clone(),p.clone(),p.clone()],f=[Number.NaN,Number.NaN,Number.NaN,Number.NaN],w=[Number.NaN,Number.NaN,Number.NaN,Number.NaN];let C=!1,_=(new d).getNearestCoordinate(o,x,!0,!1);0===_.m_distance&&(C=!0,b[0]=x,_=(new d).getNearestCoordinate(o,x,!1,!1)),f[0]=_.m_distance,w[0]=0;const D=new c;let A=!1,E=.25,k=-1;const q=new u;o.queryPathEnvelope(P,q);do{let e=Number.NaN;if(b[1]=this.calculateParacentroid_(o,m(q.xmin,q.xmax,E),n),b[1].isNAN()||(_=(new d).getNearestCoordinate(o,b[1],!1,!1),e=_.m_distance),e>n&&1===N(o,b[1],n))A=!0,f[1]=e,w[1]=c.sqrDistance(b[1],x);else if(e>k&&(k=e,D.setCoordsPoint2D(b[1])),E-=.01,E<.1){if(!(k>=0))break;A=!0,f[1]=k,b[1]=D,w[1]=c.sqrDistance(b[1],x)}}while(!A);A=!1,E=.5,k=-1;let M=.01,v=1;do{let e=Number.NaN;if(b[2]=this.calculateParacentroid_(o,m(q.xmin,q.xmax,E),n),b[2].isNAN()||(_=(new d).getNearestCoordinate(o,b[2],!1,!1),e=_.m_distance),e>n&&1===N(o,b[2],n))A=!0,f[2]=e,w[2]=c.sqrDistance(b[2],x);else if(e>k&&(k=e,D.setCoordsPoint2D(b[2])),E=.5+M*v,M+=.01,v*=-1,E<.3||E>.7){if(!(k>=0))break;A=!0,f[2]=k,b[2]=D,w[2]=c.sqrDistance(b[2],x)}}while(!A);A=!1,E=.75,k=-1;do{let e=Number.NaN;if(b[3]=this.calculateParacentroid_(o,m(q.xmin,q.xmax,E),n),b[3].isNAN()||(_=(new d).getNearestCoordinate(o,b[3],!1,!1),e=_.m_distance),e>n&&1===N(o,b[3],n))A=!0,f[3]=e,w[3]=c.sqrDistance(b[3],x);else if(e>k&&(k=e,D.setCoordsPoint2D(b[3])),E+=.01,E>.9){if(!(k>=0))break;A=!0,f[3]=k,b[3]=D,w[3]=c.sqrDistance(b[3],x)}}while(!A);const S=[0,1,2,3],G=C?0:1;for(let e=G;e<4;e++)for(let t=G;t<3;t++){const e=w[t],n=w[t+1];if(g(e,n)>0){const r=S[t];S[t]=S[t+1],S[t+1]=r,w[t]=n,w[t+1]=e}}let X=G,L=0,T=0;for(let e=G;e<4;e++){switch(e){case 0:T=2*f[S[e]];break;case 1:T=1.66666666*f[S[e]];break;case 2:T=1.33333333*f[S[e]];break;case 3:T=f[S[e]]}T>L&&(L=T,X=S[e])}return e(!b[X].isNAN()),new s({x:b[X].x,y:b[X].y})}labelPointPolyline(e){const t=new c;if(e.getPointCount()>2*e.getPathCount()){let n=-1,r=-Number.MAX_VALUE;for(let t=0,i=e.getPathCount();t<i;t++)if(e.getPathSize(t)>2){const o=e.calculatePathLength2D(t);o>r&&(r=o,n=t)}const o=e.getPathStart(n),s=e.getPathEnd(n),a=Math.trunc((o+s)/2);t.assign(e.getXY(a))}else{let n=-Number.MAX_VALUE;const r=e.querySegmentIterator();for(;r.nextPath();)if(r.hasNextSegment()){const e=r.nextSegment(),o=e.calculateLength2D();o>n&&(n=o,t.assign(e.getCoord2D(e.lengthToT(.5*o))))}}return new s({x:t.x,y:t.y})}labelPointMultiPoint(e){const t=new u;e.queryEnvelope(t);const n=t.getCenter(),r=(new d).getNearestCoordinate(e,n,!1,!1).m_coordinate;return new s({x:r.x,y:r.y})}labelPointEnvelope(e){const t=e.getCenterXY();return new s({x:t.x,y:t.y})}calculateParacentroid_(t,n,r){const o=new u;t.queryEnvelope(o);const s=new c(n,0);let a=Number.MAX_VALUE,i=Number.MAX_VALUE,l=!1,m=!1;const N=new P;N.setStartXYCoords(s.x,o.ymin-1),N.setEndXYCoords(s.x,o.ymax+1);const g=new u,y=new c,d=new c,x=h(c,2),p=t.querySegmentIterator();for(;p.nextPath();)for(;p.hasNextSegment();){const t=p.nextSegment();if(t.queryEnvelope(g),e(t.isMonotoneQuickAndDirty()),y.setCoordsPoint2D(N.getStartXY()),d.setCoordsPoint2D(N.getEndXY()),0===g.clipLine(y,d))continue;if(1!==N.intersect(t,x,null,null,r))continue;const n=x[0].y;a>i?n<a&&(a=n,l=!0):n<i&&(i=n,m=!0)}return l&&m?s.y=(a+i)/2:s.setNAN(),s}}const b=new x;function f(e){return b.execute(e,null)}function w(e){return e.map(f)}function C(){return b.supportsCurves()}export{f as execute,w as executeMany,C as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{ai as t,o as s,s as e,u as i,L as n,r as o,G as h,y as r,b as m,a,q as f,ag as _,e as c,a7 as d,aN as P,aO as u}from"../../../chunks/Polyline.js";function l(t,s,n,h,r,m){if(null==t&&o(""),t.getDimension()<1&&o(""),e(t),i(t),0===s||t.isEmpty())return t;const a=new A(m);return a.m_bUseZ=t.hasAttribute(1),a.m_bUseM=t.hasAttribute(2),a.m_inputGeometry=t,a.m_distance=s,a.m_tolerance=r,a.m_joins=n,a.m_miterLimit=h,a.m_progressCounter=0,a.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===h.enumLine)return this.offsetLine();if(t===h.enumEnvelope)return this.offsetEnvelope();if(r(t)){const t=new m;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===h.enumPolyline){const t=new m;return this.offsetMultiPath(t),t}if(t===h.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}f("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],r=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,r-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],r=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],m=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,P=0;{const t=r.x-h.x,s=r.y-h.y,e=m.x-h.x,_=m.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),P=c.orientationRobust(h.asPoint2D(),r.asPoint2D(),m.asPoint2D())}const u=f;if(f<a&&(f+=d),P*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let r=a+_;A.buildPoint(h,this.m_distance,r,t),0===o&&(t.type|=M),this.addPointEx(t,o);const m=this.m_distance/Math.cos(n/2);for(r+=n/2,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);--i>0;)r+=n,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t)}else if(1!==this.m_joins)if(0!==this.m_joins)if(2!==this.m_joins){let s;if(f=u,this.m_distance>0?(f>a&&(f-=d),s=a-f<_):(f<a&&(f+=d),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=d),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}else{const s=r.x-h.x,e=r.y-h.y,i=m.x-h.x,n=m.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const d=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),P=Math.abs(this.m_miterLimit*this.m_distance);if(d>P){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),r=new c;r.setSub(i,n);const m=new c;m.scaleAddOther(P/r.length(),r,n);const _=Math.sqrt(d*d-this.m_distance*this.m_distance),u=(d-P)*Math.abs(this.m_distance)/_;this.m_distance>0?r.leftPerpendicularThis():r.rightPerpendicularThis(),r.scale(u/r.length());const l=new c;l.setAdd(m,r);const y=new c;y.setSub(m,r),t.x=l.x,t.y=l.y,this.addPointEx(t,o),t.x=y.x,t.y=y.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o)}else{const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const r=this.m_distance/Math.cos(.5*n);let m=a+_+.5*n;for(A.buildPoint(h,r,m,t),this.addPointEx(t,o);--i>0;)m+=n,A.buildPoint(h,r,m,t),this.addPoint(t)}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,!(this.m_offsetPts[i].type&p||this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const r=1e-8,m=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/m,f=(i.y-e.y)/m,_=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),c=(o.x-n.x)/_,d=(o.y-n.y)/_;let P=!1;const u=h.pt.clone();u.x+=(a+c)*r,u.y+=(f+d)*r;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(P=!P),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(P)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,r,m;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),r=0===o?2:h/o,r>=0&&r<=1&&(m=r,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),r=0===o?2:h/o,r>=0&&r<=1)&&(n.pt.x=t.x+r*(s.x-t.x),n.pt.y=t.y+r*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+m*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+m*(i.m-e.m)),0!==m&&1!==m||0!==r&&1!==r||(n.bAtExistingPt=!0),!((0===m||1===m)&&r>0&&r<1||(0===r||1===r)&&m>0&&m<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=this.m_inputGeometry,e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=!!(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=!!(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,r=i.y-e.y,m=P(n,o,h,r);return u(m)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!1}executeMany(s,e,i,n,o,h,r){return t(0),{}}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends s{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return e(t),i(t),s=this.m_flattenError<=0?n(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const w=new E;function G(t,s,e,i,n,o){return w.execute(t,s,e,i,n,o,null)}function D(t,s,e,i,n,o){return t.map((t=>G(t,s,e,i,n,o)))}function U(){return w.supportsCurves()}export{G as execute,D as executeMany,U as supportsCurves};
5
+ import{s as t,w as s,x as e,y as i,R as n,m as o,G as h,r as m,b as r,a,n as f,aj as _,e as c,aa as d,aR as P,aS as u}from"../../../chunks/Polyline.js";function l(t,s,n,h,m,r){if(null==t&&o(""),t.getDimension()<1&&o(""),e(t),i(t),0===s||t.isEmpty())return t;const a=new A(r);return a.m_bUseZ=t.hasAttribute(1),a.m_bUseM=t.hasAttribute(2),a.m_inputGeometry=t,a.m_distance=s,a.m_tolerance=m,a.m_joins=n,a.m_miterLimit=h,a.m_progressCounter=0,a.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===h.enumLine)return this.offsetLine();if(t===h.enumEnvelope)return this.offsetEnvelope();if(m(t)){const t=new r;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===h.enumPolyline){const t=new r;return this.offsetMultiPath(t),t}if(t===h.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}f("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],m=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,m-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],m=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],r=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,P=0;{const t=m.x-h.x,s=m.y-h.y,e=r.x-h.x,_=r.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),P=c.orientationRobust(h.asPoint2D(),m.asPoint2D(),r.asPoint2D())}const u=f;if(f<a&&(f+=d),P*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let m=a+_;A.buildPoint(h,this.m_distance,m,t),0===o&&(t.type|=M),this.addPointEx(t,o);const r=this.m_distance/Math.cos(n/2);for(m+=n/2,A.buildPoint(h,r,m,t),t.type|=M,this.addPoint(t);--i>0;)m+=n,A.buildPoint(h,r,m,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t)}else if(1!==this.m_joins)if(0!==this.m_joins)if(2!==this.m_joins){let s;if(f=u,this.m_distance>0?(f>a&&(f-=d),s=a-f<_):(f<a&&(f+=d),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=d),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}else{const s=m.x-h.x,e=m.y-h.y,i=r.x-h.x,n=r.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const d=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),P=Math.abs(this.m_miterLimit*this.m_distance);if(d>P){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),m=new c;m.setSub(i,n);const r=new c;r.scaleAddOther(P/m.length(),m,n);const _=Math.sqrt(d*d-this.m_distance*this.m_distance),u=(d-P)*Math.abs(this.m_distance)/_;this.m_distance>0?m.leftPerpendicularThis():m.rightPerpendicularThis(),m.scale(u/m.length());const l=new c;l.setAdd(r,m);const y=new c;y.setSub(r,m),t.x=l.x,t.y=l.y,this.addPointEx(t,o),t.x=y.x,t.y=y.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o)}else{const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const m=this.m_distance/Math.cos(.5*n);let r=a+_+.5*n;for(A.buildPoint(h,m,r,t),this.addPointEx(t,o);--i>0;)r+=n,A.buildPoint(h,m,r,t),this.addPoint(t)}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,!(this.m_offsetPts[i].type&p||this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const m=1e-8,r=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/r,f=(i.y-e.y)/r,_=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),c=(o.x-n.x)/_,d=(o.y-n.y)/_;let P=!1;const u=h.pt.clone();u.x+=(a+c)*m,u.y+=(f+d)*m;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(P=!P),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(P)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,m,r;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),m=0===o?2:h/o,m>=0&&m<=1&&(r=m,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),m=0===o?2:h/o,m>=0&&m<=1)&&(n.pt.x=t.x+m*(s.x-t.x),n.pt.y=t.y+m*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+r*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+r*(i.m-e.m)),0!==r&&1!==r||0!==m&&1!==m||(n.bAtExistingPt=!0),!((0===r||1===r)&&m>0&&m<1||(0===m||1===m)&&r>0&&r<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=this.m_inputGeometry,e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=!!(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=!!(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,m=i.y-e.y,r=P(n,o,h,m);return u(r)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!1}executeMany(s,e,i,n,o,h,m){return t(0),{}}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends s{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return e(t),i(t),s=this.m_flattenError<=0?n(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const w=new E;function G(t,s,e,i,n,o){return w.execute(t,s,e,i,n,o,null)}function D(t,s,e,i,n,o){return t.map((t=>G(t,s,e,i,n,o)))}function U(){return w.supportsCurves()}export{G as execute,D as executeMany,U as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{S as n,m as e}from"../../../chunks/Polyline.js";const u=new e;function r(n,e,r){return u.execute(n,e,r,null)}function t(e,r,t){const o=u.executeMany(new n(e),r,t,null);return Array.from(o)}function o(n,e,r){return u.isSimpleAsFeature(n,e,r,null,null)}function l(){return u.supportsCurves()}export{r as execute,t as executeMany,o as isSimpleAsFeature,l as supportsCurves};
5
+ import{S as n,u}from"../../../chunks/Polyline.js";const e=new u;function r(n,u,r){return e.execute(n,u,r,null)}function t(u,r,t){const o=e.executeMany(new n(u),r,t,null);return Array.from(o)}function o(n,u,r){return e.isSimpleAsFeature(n,u,r,null,null)}function l(){return e.supportsCurves()}export{r as execute,t as executeMany,o as isSimpleAsFeature,l as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{S as n,n as e}from"../../../chunks/Polyline.js";const t=new e;function u(n,e,u){return t.execute(n,e,u,null)}function r(e,u){return t.executeMany(new n(e),u,null).next()}function o(){return t.supportsCurves()}export{u as execute,r as executeMany,o as supportsCurves};
5
+ import{S as n,v as e}from"../../../chunks/Polyline.js";const t=new e;function u(n,e,u){return t.execute(n,e,u,null)}function r(e,u){return t.executeMany(new n(e),u,null).next()}function o(){return t.supportsCurves()}export{u as execute,r as executeMany,o as supportsCurves};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ */
5
+ import{O as t}from"../../chunks/OperatorProximity.js";import{fromGeometry as e,fromPoint as r,toPoint as n,getSpatialReference as o}from"./support/converterAPI.js";const i=new t;function s(t,n,o,s){return m(i.getNearestCoordinate(e(t),r(n).getXY(),o,s),t)}function u(t,n){return m(i.getNearestVertex(e(t),r(n).getXY()),t)}function c(t,n,o,s){return i.getNearestVertices(e(t),r(n).getXY(),o,s).map((e=>m(e,t)))}function p(){return i.supportsCurves()}function m(t,e){const r=e.type;return{coordinate:n(t.m_coordinate,o(e)),distance:t.m_distance,isEmpty:t.isEmpty(),rightSide:t.m_bRightSide,vertexIndex:"point"===r||"multipoint"===r?t.m_vertexIndex:void 0}}export{s as getNearestCoordinate,u as getNearestVertex,c as getNearestVertices,p as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{aP as e,aQ as r,ai as t}from"../../chunks/Polyline.js";import{fromGeometry as n,fromSpatialReference as u}from"./support/converterAPI.js";class o{supportsCurves(){return!0}getOperatorType(){return 1}execute(r,t,n,u,o){return e(r,t,n,u,o)}isValidDE9IM(e){return 0===r(e)}accelerateGeometry(e,r,t){return s()}canAccelerateGeometry(e){return c()}}function s(e,r,n){return t(0),!1}function c(e){return t(0),!1}const a=new o;function i(e,r,t){return a.execute(n(e),n(r),u(e.spatialReference),t,null)}function p(e){return a.isValidDE9IM(e)}function l(){return a.supportsCurves()}export{i as execute,p as isValidDE9IM,l as supportsCurves};
5
+ import{aT as e,aU as r,s as t}from"../../chunks/Polyline.js";import{fromGeometry as n,fromSpatialReference as u}from"./support/converterAPI.js";class s{supportsCurves(){return!0}getOperatorType(){return 1}execute(r,t,n,u,s){return e(r,t,n,u,s)}isValidDE9IM(e){return 0===r(e)}accelerateGeometry(e,r,t){return o()}canAccelerateGeometry(e){return c()}}function o(e,r,n){return t(0),!1}function c(e){return t(0),!1}const a=new s;function i(e,r,t){return a.execute(n(e),n(r),u(e.spatialReference),t,null)}function p(e){return a.isValidDE9IM(e)}function l(){return a.supportsCurves()}export{i as execute,p as isValidDE9IM,l as supportsCurves};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ */
5
+ import{n as e,x as t,o as r,D as s,G as a,b as n,ap as m,P as i,a as o,u as h,t as l}from"../../chunks/Polyline.js";import{getSpatialReference as c,fromGeometry as u,fromPolyline as g,fromSpatialReference as _,toGeometry as d}from"./support/converterAPI.js";function x(m,i,o,h){if(i.getPathCount()>1&&e(""),m.isEmpty()||i.isEmpty())return null;t(m),t(i);let l=null;const c=new r;m.queryEnvelope(c);const u=new r;i.queryEnvelope(u);const g=new r;g.setCoords({env2D:c}),g.mergeEnvelope2D(u);const _=s(o,g,!1).total(),d=new A(h);let x=d.setIndicesAndScalars(m,i,_);if(x){const e=d.getTrimmedPolyline(m,i);if(e.isEmpty())return null;l=d.getReshapedMultiPath(m,e,o)}else{if(Number.isNaN(d.m_scalarB0)||m.getGeometryType()===a.enumPolyline)return null;const e=new n;if(e.add(i,!0),d.clearIndicesAndScalars(),x=d.setIndicesAndScalars(m,e,_),!x)return null;const t=d.getTrimmedPolyline(m,e);if(t.isEmpty())return null;l=d.getReshapedMultiPath(m,t,o)}return l}class A{constructor(e){this.m_progressTracker=e,this.clearIndicesAndScalars()}setIndicesAndScalars(e,t,s){const n=new r,m=new r;e.queryEnvelope(n),e.queryEnvelope(m),n.inflateCoords(s,s);if(!n.intersect(m))return!1;const i=e.getImpl().querySegmentIterator(),o=t.getImpl().querySegmentIterator(),h=[0,0],l=[0,0];let c=-1,u=-1,g=-1,_=-1,d=-1,x=-1,A=Number.NaN,p=Number.NaN,S=Number.NaN,y=Number.NaN;for(o.nextPath();o.hasNextSegment();){const e=o.nextSegment(),t=new r;for(e.queryEnvelope(t),t.inflateCoords(s,s),i.resetToFirstPath();i.nextPath();){for(;i.hasNextSegment();){const a=i.nextSegment(),n=new r;if(a.queryEnvelope(n),t.isIntersecting(n)){if(0!==e.intersect(a,null,l,h,s)&&(Number.isNaN(S)||l[0]<S)&&(c=i.getPathIndex(),g=i.getStartPointIndex(),d=o.getStartPointIndex(),A=h[0],S=l[0],0===S))break}}if(0===S)break}if(!Number.isNaN(S)&&1!==S)break}if(Number.isNaN(S))return!1;this.m_pathA0=c,this.m_vertexA0=g,this.m_vertexB0=d,this.m_scalarA0=A,this.m_scalarB0=S;const P=e.getGeometryType();for(o.resetToLastSegment();o.hasPreviousSegment();){const e=o.previousSegment(),t=new r;for(e.queryEnvelope(t),t.inflateCoords(s,s),P===a.enumPolygon?i.resetToPath(c):i.resetToFirstPath();i.nextPath();){for(;i.hasNextSegment();){const a=i.nextSegment(),n=new r;if(a.queryEnvelope(n),t.isIntersecting(n)){const t=e.intersect(a,null,l,h,s);if(0!==t&&(Number.isNaN(y)||l[t-1]>y)&&(o.getStartPointIndex()!==this.m_vertexB0||l[t-1]!==this.m_scalarB0)&&(u=i.getPathIndex(),_=i.getStartPointIndex(),x=o.getStartPointIndex(),p=h[t-1],y=l[t-1],1===y))break}}if(1===y)break;if(P===a.enumPolygon)break}if(!Number.isNaN(y))break}return!Number.isNaN(y)&&(this.m_pathA1=u,this.m_vertexA1=_,this.m_vertexB1=x,this.m_scalarA1=p,this.m_scalarB1=y,!0)}getTrimmedPolyline(e,t){const r=new m,s=t.createInstance();let a=!0;const n=t.getImpl().querySegmentIterator();if(n.resetToVertex(this.m_vertexB0,0),this.m_vertexB0>this.m_vertexB1)return s;if(this.m_vertexB0===this.m_vertexB1){n.nextSegment().queryCut(this.m_scalarB0,this.m_scalarB1,r,!1),s.addSegment(r.get(),!0)}else for(;;){const e=n.nextSegment(),t=n.getStartPointIndex();if(t===this.m_vertexB0)1!==this.m_scalarB0&&(e.queryCut(this.m_scalarB0,1,r,!1),s.addSegment(r.get(),a),a=!1);else{if(t===this.m_vertexB1){0!==this.m_scalarB1&&(e.queryCut(0,this.m_scalarB1,r),s.addSegment(r.get(),a),a=!1);break}s.addSegment(e,a)}}if(s.isEmpty())return s;if(e.getDescription().getAttributeCount()>1){const t=e.getImpl().querySegmentIterator(),r=new i,a=s.getPointCount();t.resetToVertex(this.m_vertexA0,this.m_pathA0);t.nextSegment().queryCoord(this.m_scalarA0,r),s.setPointByVal(0,r),t.resetToVertex(this.m_vertexA1,this.m_pathA1);t.nextSegment().queryCoord(this.m_scalarA1,r),s.setPointByVal(a-1,r),s.interpolateAttributesRange(0,0,0,a-1)}return s}getReshapedMultiPath(e,t,r){let s;return s=e.getGeometryType()===a.enumPolygon?this.getReshapedPolygon(e,t,r):this.getReshapedPolyline(e,t),s}getReshapedPolygon(e,t,r){const s=e.getImpl().querySegmentIterator();s.setCirculator(!0);const a=new m;new i;const n=new o({vd:e.getDescription()});if(n.addSegmentsFromPath(t,0,0,t.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA1,this.m_pathA0),this.m_vertexA1===this.m_vertexA0&&this.m_scalarA1<=this.m_scalarA0){s.nextSegment().queryCut(this.m_scalarA1,this.m_scalarA0,a),n.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA1&&(e.queryCut(this.m_scalarA1,1,a),n.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA0){0!==this.m_scalarA0&&(e.queryCut(0,this.m_scalarA0,a),n.addSegment(a.get(),!1));break}n.addSegment(e,!1)}}const l=new o({vd:e.getDescription()}),c=t.clone();if(c.reversePath(0),l.addSegmentsFromPath(c,0,0,c.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA0,this.m_pathA0),this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0<this.m_scalarA1){s.nextSegment().queryCut(this.m_scalarA0,this.m_scalarA1,a),l.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA0&&(e.queryCut(this.m_scalarA0,1,a),l.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA1){0!==this.m_scalarA1&&(e.queryCut(0,this.m_scalarA1,a),l.addSegment(a.get(),!1));break}l.addSegment(e,!1)}}const u=Math.abs(n.calculateArea2D()),g=Math.abs(l.calculateArea2D());let _=e.createInstance();for(let m=0;m<e.getPathCount();m++)m===this.m_pathA0?u>=g?_.add(n,!1):_.add(l,!1):_.addPath(e,m,!0);return _=(new h).execute(_,r,!1,this.m_progressTracker),_}getReshapedPolyline(e,t){const r=e.getImpl().querySegmentIterator(),s=new n,a=new m;let i=!1,o=-1,h=Number.NaN;i=this.m_pathA0>this.m_pathA1||this.m_pathA0===this.m_pathA1&&(this.m_vertexA0>this.m_vertexA1||this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0>this.m_scalarA1),i?(o=this.m_vertexA1,h=this.m_scalarA1,r.resetToPath(this.m_pathA1)):(o=this.m_vertexA0,h=this.m_scalarA0,r.resetToPath(this.m_pathA0));let c=!0;for(r.nextPath()||l("reshaper");;){const e=r.nextSegment();if(r.getStartPointIndex()===o){0!==h&&(e.queryCut(0,h,a),s.addSegment(a.get(),c),c=!1);break}s.addSegment(e,c),c=!1}if(i){const e=t.clone();e.reversePath(0),s.addSegmentsFromPath(e,0,0,e.getSegmentCount(),c)}else s.addSegmentsFromPath(t,0,0,t.getSegmentCount(),c);i?(h=this.m_scalarA0,r.resetToVertex(this.m_vertexA0,this.m_pathA0)):(h=this.m_scalarA1,r.resetToVertex(this.m_vertexA1,this.m_pathA1));{const e=r.nextSegment();1!==h&&(e.queryCut(h,1,a),s.addSegment(a.get(),!1))}for(;r.hasNextSegment();){const e=r.nextSegment();s.addSegment(e,!1)}const u=e.createInstance();let g=!1;for(let n=0;n<e.getPathCount();n++)n===this.m_pathA0||n===this.m_pathA1?g||(u.add(s,!1),g=!0):u.addPath(e,n,!0);return u}clearIndicesAndScalars(){this.m_pathA0=-1,this.m_pathA1=-1,this.m_vertexA0=-1,this.m_vertexA1=-1,this.m_vertexB0=-1,this.m_vertexB1=-1,this.m_scalarA0=Number.NaN,this.m_scalarA1=Number.NaN,this.m_scalarB0=Number.NaN,this.m_scalarB1=Number.NaN}}class p{getOperatorType(){return 10006}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!1}execute(e,t,r,s){return x(e,t,r,s)}}const S=new p;function y(e,t){const r=c(e),s=S.execute(u(e),g(t),_(r),null);return d(s,r)}function P(){return S.supportsCurves()}export{y as execute,P as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Layer.js";import{convertFromGeometry as h}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as u}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as p,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as C}from"./knowledgeGraph/layerUtils.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as b,LCSimpleLayout as E,LCSmartTreeLayout as N,LCRadialTreeLayout as T,LCHierarchicalLayout as I,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as R,load as O,LinkType as A}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import S from"../geometry/Polyline.js";let P=class extends(M(w(l))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((async a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),await C(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?h(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),await C(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=h(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,d=new Map,u=new Map,c=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Float64Array(n.length),M=new Float64Array(n.length),w=new Uint32Array(o.length),G=new Uint32Array(o.length),P=new Float64Array(o.length),j=new Float64Array(o.length),H=[],F="FORCE_DIRECTED",U=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let B,z="FORCE_DIRECTED",W=0,Q=0;const K=b.apply;switch(z="GEOGRAPHIC"===e?F:e,z){case"FORCE_DIRECTED":B=x.apply;break;case"COMMUNITY":B=D.apply;break;case"HIERARCHICAL":B=I.apply;break;case"RADIAL_TREE":B=T.apply;break;case"SMART_TREE":B=N.apply;break;default:B=E.apply}let Y=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[p])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[W]=R.IsGeographic:c[W]=R.None;const n=t.lockedNodeLocations.get(i.attributes[p]);L[W]=n.x,C[W]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[W]=R.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[W]=t?.x,C[W]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[W]=e.x,C[W]=e.y):c[W]=R.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[W]=e.x,C[W]=e.y):c[W]=R.IsMovable;break;default:c[W]=R.IsMovable}(null==L[W]||null==C[W]||Number.isNaN(L[W])||Number.isNaN(C[W]))&&(c[W]=R.IsMovable,L[W]=0,C[W]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[p])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;k[W]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;M[W]=r?new Date(r).getTime():NaN,L[W]=0,C[W]=0,c[W]=R.IsMovable}else c[W]=R.IsMovable,L[W]=0,C[W]=0;u.set(i.attributes[p],W),H[W]={feature:i,typeName:a},W++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let $=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[y],n=a.feature.attributes[g],o=u.get(i),r=u.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,c=l?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+d+"-"+p);const l=q.get(t),h=l?.has(a.typeName);h||(w[Q]=o,G[Q]=r,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(P[Q]=d?new Date(d).getTime():NaN,j[Q]=p?new Date(p).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,Q]])):l.set(a.typeName,Q),Q++),s.push(a)}else $=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),$&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await O();let X=!1,Z=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:X,links:Z,graphics:a}=K(c,L,C,k,M,w.subarray(0,Q),G.subarray(0,Q),P.subarray(0,Q),j.subarray(0,Q),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalOptions??{})),X&&(this.chronologicalAuxiliaryGraphics=a)}else({success:X,links:Z}=B(c,L,C,w.subarray(0,Q),G.subarray(0,Q),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<H.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),H[a].feature.attributes[m]=new v(L[a],C[a]),r.has(H[a].typeName)){const e=r.get(H[a].typeName);e?.set(H[a].feature.attributes[p],H[a].feature)}else{const e=new Map;e.set(H[a].feature.attributes[p],H[a].feature),r.set(H[a].typeName,e)}d.set(H[a].feature.attributes[p],H[a].feature);const e=h(H[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(H[a].feature.attributes[p],H[a].feature.attributes[m]?e:null),H[a].feature.attributes[m].x<U.xmin&&(U.xmin=H[a].feature.attributes[m].x),H[a].feature.attributes[m].x>U.xmax&&(U.xmax=H[a].feature.attributes[m].x),H[a].feature.attributes[m].y<U.ymin&&(U.ymin=H[a].feature.attributes[m].y),H[a].feature.attributes[m].y>U.ymax&&(U.ymax=H[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=U.xmin,this.linkChartExtent.xmax=U.xmax,this.linkChartExtent.ymin=U.ymin,this.linkChartExtent.ymax=U.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[y],c=o.feature.attributes[g];let f=r+"-"+c;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;f+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const L=q.get(f).get(o.typeName),C=0===L?0:Z?.vertexEndIndex[L-1];if(!ie.has(L)){if(ie.add(L),Z.types[L]===A.Recursive){const e=[Z.vertices[2*C],Z.vertices[2*C+1]],t=[Z.vertices[2*(C+1)],Z.vertices[2*(C+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[L]!==A.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=C;e<Z.vertexEndIndex[L];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=H[u.get(r)]?.feature.attributes[m],t=H[u.get(c)]?.feature.attributes[m];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(f)?ee.get(f).push(n):ee.set(f,[n])}const k=ee.get(f);te.has(f)||(te.set(f,new Map),ae.set(f,new Map));const M=te.get(f),w=ae.get(f);M.has(o.typeName)||(M.set(o.typeName,k.shift()),w.set(o.typeName,0));const b=M.get(o.typeName);w.set(o.typeName,w.get(o.typeName)+1);const E=new S({paths:[b]});if(o.feature.attributes[m]=E,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[p],o.feature)}else{const e=new Map;e.set(o.feature.attributes[p],o.feature),l.set(o.typeName,e)}d.set(o.feature.attributes[p],o.feature);const N=h(o.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[p],o.feature.attributes[m]?N:null)}for(const a of s)a.feature.attributes[f]=ae.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new v({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await C(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new v(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=h(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=h(new S({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[p],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[p],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(u).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:c,idealEdgeLengthType:p}=t;o(h)?l.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==c||void 0!==p)&&(s(p)?l.idealEdgeLengthType=p:void 0!==p&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?l.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalOptions){const e=t.chronologicalOptions;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===u.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new L({objectType:e,parentCompositeLayer:this,graphType:e.type})}};e([s()],P.prototype,"dataPreloadedInLocalCache",void 0),e([s()],P.prototype,"defaultLinkChartConfig",void 0),e([s()],P.prototype,"dataManager",void 0),e([s()],P.prototype,"knowledgeGraph",void 0),e([s()],P.prototype,"layers",void 0),e([s()],P.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],P.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],P.prototype,"linkChartExtent",void 0),e([s()],P.prototype,"memberEntityTypes",void 0),e([s()],P.prototype,"memberRelationshipTypes",void 0),e([s()],P.prototype,"sublayerIdsCache",void 0),e([s()],P.prototype,"tables",void 0),e([s({json:{read:!1}})],P.prototype,"type",void 0),e([s({json:{read:!1}})],P.prototype,"chronologicalAuxiliaryGraphics",void 0),P=e([r("esri.layers.LinkChartLayer")],P);const j=P;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Layer.js";import{convertFromGeometry as h}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as u}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import p from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as y,systemOidFieldName as g,systemOriginIdFieldName as m,systemDestinationIdFieldName as f,systemLayoutGeometryFieldName as L,systemAggregationCountFieldName as C}from"./knowledgeGraph/layerUtils.js";import{getRelationshipEndNodeIds as k}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as M}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as b,LCSimpleLayout as E,LCSmartTreeLayout as N,LCRadialTreeLayout as T,LCHierarchicalLayout as I,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as R,load as O,LinkType as A}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as G}from"../rest/knowledgeGraphService.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import S from"../geometry/Polyline.js";let P=class extends(M(w(l))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{G(this.url).then((async a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),await y(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?h(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),await y(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await k(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=this._createSublayer(e);t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=h(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,d=new Map,u=new Map,c=new Uint8Array(n.length),p=new Float64Array(n.length),y=new Float64Array(n.length),k=new Float64Array(n.length),M=new Float64Array(n.length),w=new Uint32Array(o.length),G=new Uint32Array(o.length),P=new Float64Array(o.length),j=new Float64Array(o.length),H=[],F="FORCE_DIRECTED",U=new _({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let B,z="FORCE_DIRECTED",W=0,Q=0;const K=b.apply;switch(z="GEOGRAPHIC"===e?F:e,z){case"FORCE_DIRECTED":B=x.apply;break;case"COMMUNITY":B=D.apply;break;case"HIERARCHICAL":B=I.apply;break;case"RADIAL_TREE":B=T.apply;break;case"SMART_TREE":B=N.apply;break;default:B=E.apply}let Y=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[g])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[W]=R.IsGeographic:c[W]=R.None;const n=t.lockedNodeLocations.get(i.attributes[g]);p[W]=n.x,y[W]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[W]=R.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":p[W]=t?.x,y[W]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):c[W]=R.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):c[W]=R.IsMovable;break;default:c[W]=R.IsMovable}(null==p[W]||null==y[W]||Number.isNaN(p[W])||Number.isNaN(y[W]))&&(c[W]=R.IsMovable,p[W]=0,y[W]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[g])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;k[W]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;M[W]=r?new Date(r).getTime():NaN,p[W]=0,y[W]=0,c[W]=R.IsMovable}else c[W]=R.IsMovable,p[W]=0,y[W]=0;u.set(i.attributes[g],W),H[W]={feature:i,typeName:a},W++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let $=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[m],n=a.feature.attributes[f],o=u.get(i),r=u.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,c=l?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+d+"-"+p);const l=q.get(t),h=l?.has(a.typeName);h||(w[Q]=o,G[Q]=r,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(P[Q]=d?new Date(d).getTime():NaN,j[Q]=p?new Date(p).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,Q]])):l.set(a.typeName,Q),Q++),s.push(a)}else $=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),$&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await O();let X=!1,Z=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:X,links:Z,graphics:a}=K(c,p,y,k,M,w.subarray(0,Q),G.subarray(0,Q),P.subarray(0,Q),j.subarray(0,Q),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalOptions??{})),X&&(this.chronologicalAuxiliaryGraphics=a)}else({success:X,links:Z}=B(c,p,y,w.subarray(0,Q),G.subarray(0,Q),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<H.length;a++){if(y[a]>84.9999?y[a]=84.9999:y[a]<-84.9999&&(y[a]=-84.9999),p[a]>179.9999?p[a]=179.9999:p[a]<-179.9999&&(p[a]=-179.9999),H[a].feature.attributes[L]=new v(p[a],y[a]),r.has(H[a].typeName)){const e=r.get(H[a].typeName);e?.set(H[a].feature.attributes[g],H[a].feature)}else{const e=new Map;e.set(H[a].feature.attributes[g],H[a].feature),r.set(H[a].typeName,e)}d.set(H[a].feature.attributes[g],H[a].feature);const e=h(H[a].feature.attributes[L]);this.entityLinkChartDiagramLookup.set(H[a].feature.attributes[g],H[a].feature.attributes[L]?e:null),H[a].feature.attributes[L].x<U.xmin&&(U.xmin=H[a].feature.attributes[L].x),H[a].feature.attributes[L].x>U.xmax&&(U.xmax=H[a].feature.attributes[L].x),H[a].feature.attributes[L].y<U.ymin&&(U.ymin=H[a].feature.attributes[L].y),H[a].feature.attributes[L].y>U.ymax&&(U.ymax=H[a].feature.attributes[L].y)}if(this.linkChartExtent.xmin=U.xmin,this.linkChartExtent.xmax=U.xmax,this.linkChartExtent.ymin=U.ymin,this.linkChartExtent.ymax=U.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[m],c=o.feature.attributes[f];let p=r+"-"+c;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;p+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const y=q.get(p).get(o.typeName),C=0===y?0:Z?.vertexEndIndex[y-1];if(!ie.has(y)){if(ie.add(y),Z.types[y]===A.Recursive){const e=[Z.vertices[2*C],Z.vertices[2*C+1]],t=[Z.vertices[2*(C+1)],Z.vertices[2*(C+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[y]!==A.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=C;e<Z.vertexEndIndex[y];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=H[u.get(r)]?.feature.attributes[L],t=H[u.get(c)]?.feature.attributes[L];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(p)?ee.get(p).push(n):ee.set(p,[n])}const k=ee.get(p);te.has(p)||(te.set(p,new Map),ae.set(p,new Map));const M=te.get(p),w=ae.get(p);M.has(o.typeName)||(M.set(o.typeName,k.shift()),w.set(o.typeName,0));const b=M.get(o.typeName);w.set(o.typeName,w.get(o.typeName)+1);const E=new S({paths:[b]});if(o.feature.attributes[L]=E,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[g],o.feature)}else{const e=new Map;e.set(o.feature.attributes[g],o.feature),l.set(o.typeName,e)}d.set(o.feature.attributes[g],o.feature);const N=h(o.feature.attributes[L]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[g],o.feature.attributes[L]?N:null)}for(const a of s)a.feature.attributes[C]=ae.get(a.feature.attributes[m]+"-"+a.feature.attributes[f])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new v({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await y(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new v(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=h(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[m]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[f]);if(t&&a){const i=h(new S({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[g],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[g],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(u).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:c,idealEdgeLengthType:p}=t;o(h)?l.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==c||void 0!==p)&&(s(p)?l.idealEdgeLengthType=p:void 0!==p&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?l.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalOptions){const e=t.chronologicalOptions;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===u.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new p({objectType:e,parentCompositeLayer:this,graphType:e.type})}};e([s()],P.prototype,"dataPreloadedInLocalCache",void 0),e([s()],P.prototype,"defaultLinkChartConfig",void 0),e([s()],P.prototype,"dataManager",void 0),e([s()],P.prototype,"knowledgeGraph",void 0),e([s()],P.prototype,"layers",void 0),e([s()],P.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],P.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],P.prototype,"linkChartExtent",void 0),e([s()],P.prototype,"memberEntityTypes",void 0),e([s()],P.prototype,"memberRelationshipTypes",void 0),e([s()],P.prototype,"sublayerIdsCache",void 0),e([s()],P.prototype,"tables",void 0),e([s({json:{read:!1}})],P.prototype,"type",void 0),e([s({json:{read:!1}})],P.prototype,"chronologicalAuxiliaryGraphics",void 0),P=e([r("esri.layers.LinkChartLayer")],P);const j=P;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.31/esri/copyright.txt for details.
4
4
  */
5
- import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p??void 0);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t,m=!1;for(const s of l(e)){const{geometry:e,properties:t,id:l}=s;if(!e||(g||(g=u(e.type)),u(e.type)===g)){if(!p){p=a(f(e))}if(d||(d=null!=l,d&&(c=typeof l,t&&(y=Object.keys(t).filter((e=>t[e]===l))))),t&&y&&d&&null!=l&&(y.length>1?y=y.filter((e=>t[e]===l)):1===y.length&&(y=t[y[0]]===l?y:[])),!m&&t){let e=!0;for(const s in t){if(o.has(s))continue;const c=t[s];if(null==c){e=!1,r.add(s);continue}const u=L(c);if("unknown"===u){r.add(s);continue}r.delete(s),o.add(s);const l=i(s);l&&n.push({name:l,alias:s,type:u})}m=e}}}const h=i(1===y?.length&&y[0]||null)??void 0;if(h)for(const i of n)if(i.name===h&&s(i)){i.type="esriFieldTypeOID";break}return{fields:n,geometryType:g,hasZ:p,objectIdFieldName:h,objectIdFieldType:c,unknownFields:Array.from(r)}}function N(e,t){return Array.from(p(l(e),t))}export{N as createOptimizedFeatures,u as getGeometryType,I as inferLayerProperties,E as validateGeoJSON};
5
+ import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p??void 0);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t;for(const s of l(e)){const{geometry:e,properties:t,id:l}=s;if(!e||(g||(g=u(e.type)),u(e.type)===g)){if(!p){p=a(f(e))}if(d||(d=null!=l,d&&(c=typeof l,t&&(y=Object.keys(t).filter((e=>t[e]===l))))),t&&y&&d&&null!=l&&(y.length>1?y=y.filter((e=>t[e]===l)):1===y.length&&(y=t[y[0]]===l?y:[])),t)for(const e in t){if(o.has(e))continue;const s=L(t[e]);if("unknown"===s){r.add(e);continue}r.delete(e),o.add(e);const c=i(e);c&&n.push({name:c,alias:e,type:s})}}}const m=i(1===y?.length&&y[0]||null)??void 0;if(m)for(const i of n)if(i.name===m&&s(i)){i.type="esriFieldTypeOID";break}return{fields:n,geometryType:g,hasZ:p,objectIdFieldName:m,objectIdFieldType:c,unknownFields:Array.from(r)}}function N(e,t){return Array.from(p(l(e),t))}export{N as createOptimizedFeatures,u as getGeometryType,I as inferLayerProperties,E as validateGeoJSON};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polygon.js";import{initializeProjection as d,project as l}from"../../geometry/projection.js";import{wgs84 as m}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{extentToInBoundsRings as c}from"./supportUtils.js";import{executeQueryStreaming as y}from"../../rest/knowledgeGraphService.js";import u from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import f from"../../rest/support/Query.js";import g from"../../geometry/Extent.js";const b="ESRI__ID",w="ESRI__ORIGIN_ID",T="ESRI__DESTINATION_ID",I="ESRI__LAYOUT_GEOMETRY",D="ESRI__AGGREGATION_COUNT",E="LC.ESRI__IsSpatial";let M=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const a=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&a.set(e.id,t)})),this.sublayerCaches.set(s,a)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new f({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===b&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],a=[];return s.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)){i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.memberIdTypeLookup.get(i.attributes[w]),o=this.memberIdTypeLookup.get(i.attributes[T]),s=this._isEndEntitySpatial(n,i,w),a=this._isEndEntitySpatial(o,i,T);i.attributes[E]=Number(s&&a)}else{i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.geographicLookup.get(t.objectType.name);n&&i.attributes[n.name]?i.attributes[E]=1:i.attributes[E]=0}i.attributes[I]=i.geometry,a.push(i)})),a}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],a=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}const r={};let p="",d=-1;for(const[n,m]of a){d++,0!==d&&(p+=" UNION ");const e=`${n}_ids`;r[e]=m,p+=t&&0!==t?.length?`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r:${o}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`}const l=new Promise((e=>{(async()=>{const e=(await y(this.knowledgeGraph,new u({openCypherQuery:p,bindParameters:r}))).resultRowsStream.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;for(let e=0;e<n.length;e++){const t=n[e];i.push({id:t[0],typeName:t[1]}),i.push({id:t[2],typeName:t[3]})}}}catch(t){if("AbortError"!==t.name)throw t;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{e()}))}));return s.push(l),this.refreshCacheContent(),await Promise.all(s),i}async getRelationshipsBetweenNodes(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await y(this.knowledgeGraph,new u({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(a){if("AbortError"!==a.name)throw a;n.getLogger(this).info("Request aborted as expected")}return i}async getRelationshipsFromNodes(e,t,i){const o=[],s="MATCH (n)-[r]-(m) WHERE id(n) IN $targetEntityIds AND id(m) in $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",a=(await y(this.knowledgeGraph,new u({openCypherQuery:s,bindParameters:{targetEntityIds:e,possibleConnectionEntityIds:t,relationshipExclusionIds:i}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await a.read();if(e)break;for(let i=0;i<t.length;i++){const e=t[i];o.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return o}async refreshCacheContent(e,t,n,s=!0){const a=h.getInstance(),r=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[l,m]of p){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let p,h="",c=!1;if(t||d.get(l)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(l)){const t=this.geographicLookup.get(l)?.name;t&&e.add(t)}if(this.entityTypeNames.has(l))h=`MATCH (n:${l}) ${m?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(l))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${l} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${l}]->() ${m?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,r.push(e)}))}p=new u(m?{openCypherQuery:h,bindParameters:{ids:m}}:{openCypherQuery:h});const f=(await y(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await f.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,a=0;const p={properties:{}};for(p.id=e[n],n++,a++,c&&(p.originId=e[n],n++,a++,p.destinationId=e[n],n++,a++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[r[n-a]]=e[n];i.push(p)}const n=a.writeToStore(i,b,this.geographicLookup.get(l)?.name);this.sublayerCaches.has(l)||this.sublayerCaches.set(l,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(l)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(l,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(l).members=new Map);const p=this.sublayerCaches.get(l);n.forEach((e=>{p?.set(e.attributes[b],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.has(e.attributes[b])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.set(e.attributes[b],{id:e.attributes[b]}),o(this.memberIdTypeLookup,e.attributes[b],(()=>new Set)).add(l))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(l)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=h.getInstance(),a=new Set,r=[];let f,w="",T=[];const I="relationship"===t.graphType,D=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,E=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let M=!D&&E?Array.from(E).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(M=e.objectIds);else if(null!=e.objectIds&&M&&M.length>0){const t=e.objectIds;e.objectIds=M.filter((e=>t.includes(e)))}else if(null!=e.objectIds)M=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=M}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{a.add(e.name)})):i.forEach((e=>{e!==b&&e!==t.geometryFieldName&&a.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,y=h?.spatialReference,b=h?.serviceCapabilities?.geometryCapabilities;let T=b?.geometryMaxBoundingRectangleSizeX,D=b?.geometryMaxBoundingRectangleSizeY;if("point"===n.type){let e=n;e.spatialReference?.isWGS84||(await d(e.spatialReference,m),e=l(e,m)),o=new g({spatialReference:m,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await d(n.extent.spatialReference,m),o=l(n.extent,m)):o=n.extent;if(T&&D&&y){if(4326!==y.wkid){const e=new g({spatialReference:y,xmax:T,ymax:D}),t=l(e,m);T=t.xmax,D=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>D)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${D}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&a.add(e.name)}))}w=I?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{w+=`, n.${e}`,r.push(e)})),f=new u({openCypherQuery:w,bindParameters:{param_filter_geom:new p({rings:c(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&a.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),r=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&r.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=I?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;M&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",I&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&a.add(t.geometryFieldName),a.forEach((e=>{n+=`, n.${e}`,r.push(e)})),f=new u(M?{openCypherQuery:n,bindParameters:{ids:M}}:{openCypherQuery:n})}const k=(await y(t.parentCompositeLayer.dataManager.knowledgeGraph,f,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const a={properties:{}};for(a.id=e[o],o++,s++,I&&(a.originId=e[o],o++,s++,a.destinationId=e[o],o++,s++);o<e.length;o++)a.properties[r[o-s]]=e[o];n.push(a)}T=T.concat(o.writeToStore(n,b,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}_isEndEntitySpatial(e,t,i){for(const n of e??[])if(this.entityTypeNames.has(n)){const e=this.geographicLookup.get(n),o=e&&this.sublayerCaches.get(n)?.get(t.attributes[i]);if(e&&o?.attributes[e.name])return!0}return!1}};e([a()],M.prototype,"knowledgeGraph",void 0),e([a()],M.prototype,"inclusionModeDefinition",void 0),e([a()],M.prototype,"entityTypeNames",void 0),e([a()],M.prototype,"relationshipTypeNames",void 0),e([a()],M.prototype,"geographicLookup",void 0),e([a()],M.prototype,"sublayerCaches",void 0),e([a()],M.prototype,"nodeConnectionsLookup",void 0),e([a()],M.prototype,"relationshipConnectionsLookup",void 0),e([a()],M.prototype,"memberIdTypeLookup",void 0),M=e([r("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],M);export{M as KnowledgeGraphLayerDataManager,D as mockAggregationCountFieldName,T as mockDestinationIdFieldName,I as mockLayoutGeometryFieldName,b as mockOidFieldName,w as mockOriginIdFieldName,E as systemIsSpatialFieldName};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polygon.js";import{initializeProjection as d,project as l}from"../../geometry/projection.js";import{wgs84 as m}from"../../geometry/support/spatialReferenceUtils.js";import{systemOidFieldName as h,systemOriginIdFieldName as c,systemDestinationIdFieldName as y,systemIsSpatialFieldName as u,systemLayoutGeometryFieldName as f}from"./layerUtils.js";import g from"./SessionMemoryStorage.js";import{extentToInBoundsRings as b}from"./supportUtils.js";import{executeQueryStreaming as w}from"../../rest/knowledgeGraphService.js";import T from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import D from"../../rest/support/Query.js";import I from"../../geometry/Extent.js";let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const r=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&r.set(e.id,t)})),this.sublayerCaches.set(s,r)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return g.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new D({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===h&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],r=[];return s.forEach((i=>{if(this.relationshipTypeNames.has(t.objectType.name)){i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.memberIdTypeLookup.get(i.attributes[c]),o=this.memberIdTypeLookup.get(i.attributes[y]),s=this._isEndEntitySpatial(n,i,c),r=this._isEndEntitySpatial(o,i,y);i.attributes[u]=Number(s&&r)}else{i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]);const n=this.geographicLookup.get(t.objectType.name);n&&i.attributes[n.name]?i.attributes[u]=1:i.attributes[u]=0}i.attributes[f]=i.geometry,r.push(i)})),r}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],r=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;r.has(t)?r.get(t)?.push(e):r.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}const a={};let p="",d=-1;for(const[n,m]of r){d++,0!==d&&(p+=" UNION ");const e=`${n}_ids`;a[e]=m,p+=t&&0!==t?.length?`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r:${o}]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${n}) WHERE id(n) IN $${e} WITH n MATCH (n)-[r]-(m) RETURN id(r), type(r), id(m), labels(m)[0]`}const l=new Promise((e=>{(async()=>{const e=(await w(this.knowledgeGraph,new T({openCypherQuery:p,bindParameters:a}))).resultRowsStream.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;for(let e=0;e<n.length;e++){const t=n[e];i.push({id:t[0],typeName:t[1]}),i.push({id:t[2],typeName:t[3]})}}}catch(t){if("AbortError"!==t.name)throw t;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{e()}))}));return s.push(l),this.refreshCacheContent(),await Promise.all(s),i}async getRelationshipsBetweenNodes(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await w(this.knowledgeGraph,new T({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return i}async getRelationshipsFromNodes(e,t,i){const o=[],s="MATCH (n)-[r]-(m) WHERE id(n) IN $targetEntityIds AND id(m) in $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",r=(await w(this.knowledgeGraph,new T({openCypherQuery:s,bindParameters:{targetEntityIds:e,possibleConnectionEntityIds:t,relationshipExclusionIds:i}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await r.read();if(e)break;for(let i=0;i<t.length;i++){const e=t[i];o.push({id:e[0],typeName:e[1]})}}}catch(a){if("AbortError"!==a.name)throw a;n.getLogger(this).info("Request aborted as expected")}return o}async refreshCacheContent(e,t,n,s=!0){const r=g.getInstance(),a=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[l,m]of p){const e=new Promise((e=>{const a=async()=>{const e=new Set,a=[];let p,c="",y=!1;if(t||d.get(l)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(l)){const t=this.geographicLookup.get(l)?.name;t&&e.add(t)}if(this.entityTypeNames.has(l))c=`MATCH (n:${l}) ${m?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{c+=`, n.${e}`,a.push(e)}));else{if(!this.relationshipTypeNames.has(l))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${l} could not be determined. Was this type set in the KG data model and inclusion definition?`);y=!0,c=`MATCH ()-[n:${l}]->() ${m?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{c+=`, n.${e}`,a.push(e)}))}p=new T(m?{openCypherQuery:c,bindParameters:{ids:m}}:{openCypherQuery:c});const u=(await w(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await u.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,r=0;const p={properties:{}};for(p.id=e[n],n++,r++,y&&(p.originId=e[n],n++,r++,p.destinationId=e[n],n++,r++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[a[n-r]]=e[n];i.push(p)}const n=r.writeToStore(i,h,this.geographicLookup.get(l)?.name);this.sublayerCaches.has(l)||this.sublayerCaches.set(l,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(l)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(l,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(l).members=new Map);const p=this.sublayerCaches.get(l);n.forEach((e=>{p?.set(e.attributes[h],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.has(e.attributes[h])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.set(e.attributes[h],{id:e.attributes[h]}),o(this.memberIdTypeLookup,e.attributes[h],(()=>new Set)).add(l))}))}};a().then((()=>{e(null)}))}));a.push(e),this._processingCacheUpdatesLookup.get(l)?.push(e)}await Promise.all(a)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=g.getInstance(),r=new Set,a=[];let c,y="",u=[];const f="relationship"===t.graphType,D=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,E=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let M=!D&&E?Array.from(E).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(M=e.objectIds);else if(null!=e.objectIds&&M&&M.length>0){const t=e.objectIds;e.objectIds=M.filter((e=>t.includes(e)))}else if(null!=e.objectIds)M=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=M}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{r.add(e.name)})):i.forEach((e=>{e!==h&&e!==t.geometryFieldName&&r.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,u=h?.spatialReference,g=h?.serviceCapabilities?.geometryCapabilities;let w=g?.geometryMaxBoundingRectangleSizeX,D=g?.geometryMaxBoundingRectangleSizeY;if("point"===n.type){let e=n;e.spatialReference?.isWGS84||(await d(e.spatialReference,m),e=l(e,m)),o=new I({spatialReference:m,xmin:e.x-1e-4,ymin:e.y-1e-4,xmax:e.x+1e-4,ymax:e.y+1e-4})}else n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await d(n.extent.spatialReference,m),o=l(n.extent,m)):o=n.extent;if(w&&D&&u){if(4326!==u.wkid){const e=new I({spatialReference:u,xmax:w,ymax:D}),t=l(e,m);w=t.xmax,D=t.ymax}if(o.xmax-o.xmin>w)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${w}° latitude, limit exceeded`);if(o.ymax-o.ymin>D)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${D}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&r.add(e.name)}))}y=f?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{y+=`, n.${e}`,a.push(e)})),c=new T({openCypherQuery:y,bindParameters:{param_filter_geom:new p({rings:b(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&r.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),a=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&a.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=f?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;M&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",f&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{n+=`, n.${e}`,a.push(e)})),c=new T(M?{openCypherQuery:n,bindParameters:{ids:M}}:{openCypherQuery:n})}const k=(await w(t.parentCompositeLayer.dataManager.knowledgeGraph,c,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const r={properties:{}};for(r.id=e[o],o++,s++,f&&(r.originId=e[o],o++,s++,r.destinationId=e[o],o++,s++);o<e.length;o++)r.properties[a[o-s]]=e[o];n.push(r)}u=u.concat(o.writeToStore(n,h,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return u}_isEndEntitySpatial(e,t,i){for(const n of e??[])if(this.entityTypeNames.has(n)){const e=this.geographicLookup.get(n),o=e&&this.sublayerCaches.get(n)?.get(t.attributes[i]);if(e&&o?.attributes[e.name])return!0}return!1}};e([r()],E.prototype,"knowledgeGraph",void 0),e([r()],E.prototype,"inclusionModeDefinition",void 0),e([r()],E.prototype,"entityTypeNames",void 0),e([r()],E.prototype,"relationshipTypeNames",void 0),e([r()],E.prototype,"geographicLookup",void 0),e([r()],E.prototype,"sublayerCaches",void 0),e([r()],E.prototype,"nodeConnectionsLookup",void 0),e([r()],E.prototype,"relationshipConnectionsLookup",void 0),e([r()],E.prototype,"memberIdTypeLookup",void 0),E=e([a("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],E);export{E as KnowledgeGraphLayerDataManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as i}from"../../core/lang.js";import{MultiOriginJSONMixin as n}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as l}from"../../core/accessorSupport/PropertyOrigin.js";import{initializeProjection as y,project as u}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{wgs84 as d}from"../../geometry/support/spatialReferenceUtils.js";import c from"../Layer.js";import h from"../graphics/data/FeatureStore.js";import{QueryEngine as f}from"../graphics/data/QueryEngine.js";import{createCapabilities as g,createDrawingInfo as j}from"../graphics/sources/support/clientSideDefaults.js";import{mockOidFieldName as b,mockAggregationCountFieldName as w,systemIsSpatialFieldName as T,mockLayoutGeometryFieldName as S}from"./KnowledgeGraphLayerDataManager.js";import{KnowledgeGraphSublayerBase as v}from"./KnowledgeGraphSublayerBase.js";import{BlendLayer as O,blendModeProperty as x,effectProperty as I}from"../mixins/BlendLayer.js";import{FeatureEffectLayer as E,featureEffectProperty as N}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as F}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as L,orderByProperty as R}from"../mixins/OrderedLayer.js";import{RefreshableLayer as Q}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as J,useViewTimeProperty as M}from"../mixins/TemporalLayer.js";import{labelsVisible as _,legendEnabled as k,maxScale as q,minScale as D,opacity as P,popupEnabled as G}from"../support/commonProperties.js";import{featureReductionProperty as U}from"../support/featureReductionUtils.js";import V from"../support/Field.js";import{fixRendererFields as Z,fixTimeInfoFields as B}from"../support/fieldUtils.js";import K from"../support/LabelClass.js";import{reader as W}from"../support/labelingInfo.js";import z from"../support/TimeInfo.js";import A from"../../rest/support/FeatureSet.js";import H from"../../rest/support/Query.js";import{createPopupTemplate as X}from"../../support/popupUtils.js";import Y from"../../core/workers/RemoteClient.js";import $ from"../../geometry/Extent.js";import ee from"../../geometry/Polygon.js";import te from"../../geometry/Polyline.js";import re from"../../geometry/Point.js";import{featureGeometryTypeKebabDictionary as oe}from"../../geometry/support/typeUtils.js";function ie(e){if(!e.json)return e;e.json.write=ne(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ne(e.write))}return e}function ne(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=se(e)),e):!0===e?ae():e}function se(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=pe.call(this,e,t);return r.enabled?{...i,...r}:r}}function ae(){return{overridePolicy:pe}}function pe(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...le.call(this,e,t)}),o}function le(e,t){return{ignoreOrigin:this.originIdOf(t)>l.DEFAULTS}}let ye=class extends(v(F(E(O(L(J(C(Q(n(c)))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=g(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.labelingInfo=null,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=b,this.objectType=null,this.opacity=1,this.orderBy=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new Y(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=H.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(V.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(V.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),V.fromJSON({name:w,type:"esriFieldTypeInteger",alias:w,editable:!1}),V.fromJSON({name:T,type:"esriFieldTypeInteger",alias:T,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?oe.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return S;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set renderer(e){Z(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){return this._isOverridden("renderer")?this._get("renderer"):"link-chart"===this.parentCompositeLayer?.type?"relationship"===this.graphType?r(j(oe.toJSON("polyline")).renderer):r(j(oe.toJSON("point")).renderer):r(j(oe.toJSON(this.geometryType)).renderer)}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??m.WGS84}set timeInfo(e){B(e,this.fieldsIndex),this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return X(this,e)}createQuery(){return new H({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=A.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new $(n.extent):new $,{count:n.count,extent:s}}async queryObjectIds(e,t){const r=H.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new h({geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new f({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new H({where:"1=1",outFields:[b]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=H.from(e),o=r.geometry;let i;if(o&&!o.spatialReference?.isWGS84&&(await y(o.spatialReference,d),r.geometry=u(o instanceof ee||o instanceof te||o instanceof re?o:o.extent,d)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:i}}};e([s(ie(i(x)))],ye.prototype,"blendMode",void 0),e([s()],ye.prototype,"capabilities",void 0),e([s({json:{origins:{"web-scene":{write:!1}},write:ae()}})],ye.prototype,"charts",void 0),e([s({readOnly:!0})],ye.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],ye.prototype,"definitionExpression",void 0),e([s()],ye.prototype,"displayField",void 0),e([s(ie(i(I)))],ye.prototype,"effect",void 0),e([s()],ye.prototype,"elevationInfo",void 0),e([s(ie(i(N)))],ye.prototype,"featureEffect",void 0),e([s(ie(i(U)))],ye.prototype,"featureReduction",null),e([s()],ye.prototype,"fields",null),e([s()],ye.prototype,"geometryType",null),e([s()],ye.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphTypeName",null),e([s()],ye.prototype,"hasM",null),e([s()],ye.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"id",void 0),e([s(ie(i(_)))],ye.prototype,"labelsVisible",void 0),e([s({type:[K],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:W,write:ae()}})],ye.prototype,"labelingInfo",void 0),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"layerType",void 0),e([s(ie(i(k)))],ye.prototype,"legendEnabled",void 0),e([s(ie(i(q)))],ye.prototype,"maxScale",void 0),e([s(ie(i(D)))],ye.prototype,"minScale",void 0),e([s()],ye.prototype,"objectIdField",void 0),e([s()],ye.prototype,"objectType",void 0),e([s(ie(i(P)))],ye.prototype,"opacity",void 0),e([s(ie(i(R)))],ye.prototype,"orderBy",void 0),e([s()],ye.prototype,"parentCompositeLayer",void 0),e([s(ie(i(G)))],ye.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:le}}})],ye.prototype,"refreshInterval",void 0),e([s({types:o,json:{name:"layerDefinition.drawingInfo.renderer",write:ae()}})],ye.prototype,"renderer",null),e([s()],ye.prototype,"source",void 0),e([s()],ye.prototype,"spatialReference",null),e([s({type:z,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],ye.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"title",null),e([p("title")],ye.prototype,"writeTitle",null),e([s({json:{read:!1}})],ye.prototype,"type",void 0),e([s(ie(i(M)))],ye.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:ae()}})],ye.prototype,"visible",void 0),ye=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],ye);const ue=ye;export{ue as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import{fromJSON as r}from"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as i}from"../../core/lang.js";import{MultiOriginJSONMixin as n}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as l}from"../../core/accessorSupport/PropertyOrigin.js";import{initializeProjection as y,project as u}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{wgs84 as d}from"../../geometry/support/spatialReferenceUtils.js";import c from"../Layer.js";import h from"../graphics/data/FeatureStore.js";import{QueryEngine as f}from"../graphics/data/QueryEngine.js";import{createCapabilities as g,createDrawingInfo as j}from"../graphics/sources/support/clientSideDefaults.js";import{KnowledgeGraphSublayerBase as b}from"./KnowledgeGraphSublayerBase.js";import{systemOidFieldName as w,systemAggregationCountFieldName as T,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as v}from"./layerUtils.js";import{BlendLayer as O,blendModeProperty as x,effectProperty as I}from"../mixins/BlendLayer.js";import{FeatureEffectLayer as E,featureEffectProperty as N}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as F}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as L,orderByProperty as R}from"../mixins/OrderedLayer.js";import{RefreshableLayer as Q}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as C}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as J,useViewTimeProperty as M}from"../mixins/TemporalLayer.js";import{labelsVisible as _,legendEnabled as k,maxScale as q,minScale as D,opacity as P,popupEnabled as G}from"../support/commonProperties.js";import{featureReductionProperty as U}from"../support/featureReductionUtils.js";import V from"../support/Field.js";import{fixRendererFields as Z,fixTimeInfoFields as B}from"../support/fieldUtils.js";import K from"../support/LabelClass.js";import{reader as W}from"../support/labelingInfo.js";import z from"../support/TimeInfo.js";import A from"../../rest/support/FeatureSet.js";import H from"../../rest/support/Query.js";import{createPopupTemplate as X}from"../../support/popupUtils.js";import Y from"../../core/workers/RemoteClient.js";import $ from"../../geometry/Extent.js";import ee from"../../geometry/Polygon.js";import te from"../../geometry/Polyline.js";import re from"../../geometry/Point.js";import{featureGeometryTypeKebabDictionary as oe}from"../../geometry/support/typeUtils.js";function ie(e){if(!e.json)return e;e.json.write=ne(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ne(e.write))}return e}function ne(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=se(e)),e):!0===e?ae():e}function se(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=pe.call(this,e,t);return r.enabled?{...i,...r}:r}}function ae(){return{overridePolicy:pe}}function pe(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...le.call(this,e,t)}),o}function le(e,t){return{ignoreOrigin:this.originIdOf(t)>l.DEFAULTS}}let ye=class extends(b(F(E(O(L(J(C(Q(n(c)))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=g(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.labelingInfo=null,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=w,this.objectType=null,this.opacity=1,this.orderBy=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new Y(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=H.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(V.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(V.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),V.fromJSON({name:T,type:"esriFieldTypeInteger",alias:T,editable:!1}),V.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?oe.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return v;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set renderer(e){Z(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){return this._isOverridden("renderer")?this._get("renderer"):"link-chart"===this.parentCompositeLayer?.type?"relationship"===this.graphType?r(j(oe.toJSON("polyline")).renderer):r(j(oe.toJSON("point")).renderer):r(j(oe.toJSON(this.geometryType)).renderer)}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??m.WGS84}set timeInfo(e){B(e,this.fieldsIndex),this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return X(this,e)}createQuery(){return new H({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];return null}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=A.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new $(n.extent):new $,{count:n.count,extent:s}}async queryObjectIds(e,t){const r=H.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new h({geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new f({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:oe.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new H({where:"1=1",outFields:[w]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){const r=H.from(e),o=r.geometry;let i;if(o&&!o.spatialReference?.isWGS84&&(await y(o.spatialReference,d),r.geometry=u(o instanceof ee||o instanceof te||o instanceof re?o:o.extent,d)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return{resolvedQuery:r,queryEngine:i}}};e([s(ie(i(x)))],ye.prototype,"blendMode",void 0),e([s()],ye.prototype,"capabilities",void 0),e([s({json:{origins:{"web-scene":{write:!1}},write:ae()}})],ye.prototype,"charts",void 0),e([s({readOnly:!0})],ye.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],ye.prototype,"definitionExpression",void 0),e([s()],ye.prototype,"displayField",void 0),e([s(ie(i(I)))],ye.prototype,"effect",void 0),e([s()],ye.prototype,"elevationInfo",void 0),e([s(ie(i(N)))],ye.prototype,"featureEffect",void 0),e([s(ie(i(U)))],ye.prototype,"featureReduction",null),e([s()],ye.prototype,"fields",null),e([s()],ye.prototype,"geometryType",null),e([s()],ye.prototype,"geometryFieldName",null),e([s({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphType",void 0),e([s({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],ye.prototype,"graphTypeName",null),e([s()],ye.prototype,"hasM",null),e([s()],ye.prototype,"hasZ",null),e([s({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],ye.prototype,"id",void 0),e([s(ie(i(_)))],ye.prototype,"labelsVisible",void 0),e([s({type:[K],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:W,write:ae()}})],ye.prototype,"labelingInfo",void 0),e([s({readOnly:!0,json:{read:!1,write:{writer(e,t){t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"layerType",void 0),e([s(ie(i(k)))],ye.prototype,"legendEnabled",void 0),e([s(ie(i(q)))],ye.prototype,"maxScale",void 0),e([s(ie(i(D)))],ye.prototype,"minScale",void 0),e([s()],ye.prototype,"objectIdField",void 0),e([s()],ye.prototype,"objectType",void 0),e([s(ie(i(P)))],ye.prototype,"opacity",void 0),e([s(ie(i(R)))],ye.prototype,"orderBy",void 0),e([s()],ye.prototype,"parentCompositeLayer",void 0),e([s(ie(i(G)))],ye.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],ye.prototype,"popupTemplate",void 0),e([s({type:Number,json:{write:{overridePolicy:le}}})],ye.prototype,"refreshInterval",void 0),e([s({types:o,json:{name:"layerDefinition.drawingInfo.renderer",write:ae()}})],ye.prototype,"renderer",null),e([s()],ye.prototype,"source",void 0),e([s()],ye.prototype,"spatialReference",null),e([s({type:z,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],ye.prototype,"timeInfo",null),e([s({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],ye.prototype,"title",null),e([p("title")],ye.prototype,"writeTitle",null),e([s({json:{read:!1}})],ye.prototype,"type",void 0),e([s(ie(i(M)))],ye.prototype,"useViewTime",void 0),e([s({type:Boolean,json:{name:"visibility",write:ae()}})],ye.prototype,"visible",void 0),ye=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],ye);const ue=ye;export{ue as default};