@arcgis/core 4.34.0-next.59 → 4.34.0-next.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/007721d1d99233046420.js +1 -0
- package/assets/esri/core/workers/chunks/{03fe4164abd12abc7921.js → 0468266dfe15ec41d60a.js} +1 -1
- package/assets/esri/core/workers/chunks/08d420cd7cfa19a10fa4.js +1 -0
- package/assets/esri/core/workers/chunks/{d91b80aa4f847c2e2a33.js → 0ff8b28a34b1825c227d.js} +1 -1
- package/assets/esri/core/workers/chunks/{b29144ee58b43f769d9a.js → 2d74af2b383187bd59c3.js} +1 -1
- package/assets/esri/core/workers/chunks/3124a8516e815efec973.js +1 -0
- package/assets/esri/core/workers/chunks/3461701a15be46603c56.js +1 -0
- package/assets/esri/core/workers/chunks/{1612d1c1d78c122dfef6.js → 36acf191a2d48560c796.js} +1 -1
- package/assets/esri/core/workers/chunks/{27334cda1b877abcba1b.js → 40e1fbfbf3f3979b3713.js} +1 -1
- package/assets/esri/core/workers/chunks/{4dee2f05508e90410f13.js → 4d8d942fbd6750bb7567.js} +1 -1
- package/assets/esri/core/workers/chunks/{94b9948ec628187c19fc.js → 4e21a1116be0d6340163.js} +1 -1
- package/assets/esri/core/workers/chunks/5915f5ba9064097aee79.js +1 -0
- package/assets/esri/core/workers/chunks/702d2c668dedf83421ca.js +1 -0
- package/assets/esri/core/workers/chunks/7b2ec80dca0fdb0442cf.js +1 -0
- package/assets/esri/core/workers/chunks/abededd48e0ea6cfec01.js +1 -0
- package/assets/esri/core/workers/chunks/c1c6202f7bef24b5db26.js +1 -0
- package/assets/esri/core/workers/chunks/{3f634580055b30dbfc8e.js → c77a97c723b8c17df186.js} +1 -1
- package/assets/esri/core/workers/chunks/{bf6b76027c60b4ffa507.js → d2bdd52d2291306a4e47.js} +1 -1
- package/assets/esri/core/workers/chunks/{81eb7785d626aa975033.js → d47c3431c501d77b1779.js} +1 -1
- package/assets/esri/core/workers/chunks/eccb4550edc4752cf41a.js +1 -0
- package/assets/esri/core/workers/chunks/{3e7c9a43e52ed6a1b018.js → f462a138912e5379b6a7.js} +1 -1
- package/chunks/GeodeticUtils.js +5 -0
- package/config.js +1 -1
- package/core/quantityUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/core/units.d.ts +1 -0
- package/geometry/operators/geodeticUtilsOperator.js +5 -0
- package/geometry/operators/gx/geodeticUtils.js +5 -0
- package/graphic/CSVGraphicOrigin.js +1 -1
- package/graphic/CatalogGraphicOrigin.js +1 -1
- package/graphic/FeatureGraphicOrigin.js +1 -1
- package/graphic/GeoJSONGraphicOrigin.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/OGCFeatureGraphicOrigin.js +1 -1
- package/graphic/OrientedImageryGraphicOrigin.js +1 -1
- package/graphic/ParquetGraphicOrigin.js +1 -1
- package/graphic/StreamGraphicOrigin.js +1 -1
- package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.d.ts +4 -0
- package/graphic/WFSGraphicOrigin.js +1 -1
- package/graphic/isPopupProviderGraphicOrigin.js +5 -0
- package/interfaces.d.ts +128 -41
- package/kernel.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult.d.ts +4 -0
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementResult.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/volumeMeasurementUtils.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1c61cf137a989bc52bb8.js +0 -1
- package/assets/esri/core/workers/chunks/462b30fc40a5f337ba10.js +0 -1
- package/assets/esri/core/workers/chunks/781e424a383c71ca904d.js +0 -1
- package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +0 -1
- package/assets/esri/core/workers/chunks/94f1005222bff1870ef1.js +0 -1
- package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +0 -1
- package/assets/esri/core/workers/chunks/abe60d92e0219ee97036.js +0 -1
- package/assets/esri/core/workers/chunks/af5ae7c36e1178077cbc.js +0 -1
- package/assets/esri/core/workers/chunks/bb67d491f62a5cce96cd.js +0 -1
- package/assets/esri/core/workers/chunks/f718f630a8b81496c646.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[624,7136],{10536:(e,t,r)=>{function s(e){const t={};for(const r in e){if("declaredClass"===r)continue;const n=e[r];if(null!=n&&"function"!=typeof n)if(Array.isArray(n)){t[r]=[];for(let e=0;e<n.length;e++)t[r][e]=s(n[e])}else"object"==typeof n?n.toJSON&&(t[r]=JSON.stringify(n)):t[r]=n}return t}r.d(t,{z:()=>s})},17136:(e,t,r)=>{r.d(t,{O7:()=>I,el:()=>S});var s=r(92602),n=r(49186),i=r(53966),o=r(39829),a=r(82799),c=r(80754),u=r(21325),l=r(28735),h=r(78888),d=r(65864),f=r(2272),g=r(84952),p=r(92300);const y=()=>i.A.getLogger("esri.geometry.support.normalizeUtils");function m(e){return"polygon"===e[0].type}function _(e){return"polyline"===e[0].type}function b(e,t,r){if(t){const t=function(e,t){if(!(e instanceof a.A||e instanceof o.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y().error(e),new n.A("internal:geometry",e)}const r=(0,c.r8)(e),s=[];for(const e of r){const r=[];s.push(r),r.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],i=e[s][1],o=e[s+1][0],a=e[s+1][1],c=Math.sqrt((o-n)*(o-n)+(a-i)*(a-i)),u=(a-i)/c,l=(o-n)/c,h=c/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,o=l*s+n,a=u*s+i;r.push([o,a])}const e=(c+Math.floor(h-1)*t)/2,s=l*e+n,o=u*e+i;r.push([s,o])}r.push([o,a])}}return function(e){return"polygon"===e.type}(e)?new o.A({rings:s,spatialReference:e.spatialReference}):new a.A({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,l.ci)(t,!0)}return r&&(e=(0,c.kS)(e,r)),e}function w(e,t,r){if(Array.isArray(e)){const s=e[0];if(s>t){const r=(0,c.kd)(s,t);e[0]=s+r*(-2*t)}else if(s<r){const t=(0,c.kd)(s,r);e[0]=s+t*(-2*r)}}else{const s=e.x;if(s>t){const r=(0,c.kd)(s,t);e=e.clone().offset(r*(-2*t),0)}else if(s<r){const t=(0,c.kd)(s,r);e=e.clone().offset(t*(-2*r),0)}}return e}function k(e,t){let r=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],i=t.geometries[s],o=(0,c.r8)(i);for(let e=0;e<o.length;e++){const t=o[e];t.some(r=>{if(r[0]<180)return!0;{let r=0;for(let e=0;e<t.length;e++){const s=t[e][0];r=s>r?s:r}r=Number(r.toFixed(9));const s=-360*(0,c.kd)(r,180);for(let r=0;r<t.length;r++){const t=i.getPoint(e,r);i.setPoint(e,r,t.clone().offset(s,0))}return!0}})}if(n===r){if(m(e))for(const t of(0,c.r8)(i))e[n]=e[n].addRing(t);else if(_(e))for(const t of(0,c.r8)(i))e[n]=e[n].addPath(t)}else r=n,e[n]=i}return e}async function S(e,t,r){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&y().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.A.geometryServiceUrl;let i,m,_,I,F,T,A,x,N=0;const q=[],R=[];for(const t of e)if(null!=t)if(i||(i=t.spatialReference,m=(0,u.Vp)(i),_=i.isWebMercator,T=_?102100:4326,I=c.j7[T].maxX,F=c.j7[T].minX,A=c.j7[T].plus180Line,x=c.j7[T].minus180Line),m)if("mesh"===t.type)R.push(t);else if("point"===t.type)R.push(w(t.clone(),I,F));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>w(e,I,F)),R.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,m);R.push(e.rings?new o.A(e):e)}else if(t.extent){const e=t.extent,r=(0,c.kd)(e.xmin,F)*(2*I);let s=0===r?t.clone():(0,c.kS)(t.clone(),r);e.offset(r,0);let{xmin:n,xmax:i}=e;n=Number(n.toFixed(9)),i=Number(i.toFixed(9)),e.intersects(A)&&i!==I?(N=i>N?i:N,s=b(s,_),q.push(s),R.push("cut")):e.intersects(x)&&n!==F?(N=i*(2*I)>N?i*(2*I):N,s=b(s,_,360),q.push(s),R.push("cut")):R.push(s)}else R.push(t.clone());else R.push(t);else R.push(t);let v=(0,c.kd)(N,I),M=-90;const O=v,E=new a.A;for(;v>0;){const e=360*v-180;E.addPath([[e,M],[e,-1*M]]),M*=-1,v--}if(q.length>0&&O>0){const t=k(q,await async function(e,t,r,s){const n=(0,f.Dl)(e),i=t[0].spatialReference,o={...s,responseType:"json",query:{...n.query,f:"json",sr:(0,u.YX)(i),target:JSON.stringify({geometryType:(0,d.$B)(t[0]),geometries:t}),cutter:JSON.stringify(r)}},a=await(0,h.A)(n.path+"/cut",o),{cutIndexes:c,geometries:l=[]}=a.data;return{cutIndexes:c,geometries:l.map(e=>{const t=(0,d.rS)(e);return t.spatialReference=i,t})}}(n,q,E,r)),s=[],i=[];for(let r=0;r<R.length;r++){const n=R[r];if("cut"!==n)i.push(n);else{const n=t.shift(),o=e[r];null!=o&&"polygon"===o.type&&o.rings&&o.rings.length>1&&n.rings.length>=o.rings.length?(s.push(n),i.push("simplify")):i.push(_?(0,l.Gh)(n):n)}}if(!s.length)return i;const o=await async function(e,t,r){const s="string"==typeof e?(0,g.An)(e):e,n=t[0].spatialReference,i=(0,d.$B)(t[0]),o={...r,query:{...s.query,f:"json",sr:(0,u.YX)(n),geometries:JSON.stringify((0,p.X)(t))}},{data:a}=await(0,h.A)(s.path+"/simplify",o);return(0,p.V)(a.geometries,i,n)}(n,s,r),a=[];for(let e=0;e<i.length;e++){const t=i[e];"simplify"!==t?a.push(t):a.push(_?(0,l.Gh)(o.shift()):o.shift())}return a}const C=[];for(let e=0;e<R.length;e++){const t=R[e];if("cut"!==t)C.push(t);else{const e=q.shift();C.push(!0===_?(0,l.Gh)(e):e)}}return C}function I(e,t,r){const s=(0,u.Vp)(r);if(null==s)return e;const[n,i]=s.valid,o=2*i;let a=0,c=0;t>i?a=Math.ceil(Math.abs(t-i)/o):t<n&&(a=-Math.ceil(Math.abs(t-n)/o)),e>i?c=Math.ceil(Math.abs(e-i)/o):e<n&&(c=-Math.ceil(Math.abs(e-n)/o));let l=e+(a-c)*o;const h=l-t;return h>i?l-=o:h<n&&(l+=o),l}},27647:(e,t,r)=>{function s(e,t){return e?t?4:3:t?3:2}function n(e,t,r,n){if(!t?.lengths.length)return null;e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0);const a=e.coords,c=[],u=r?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:l,coords:h}=t,d=s(r,n);let f=0;for(const e of l){const t=i(u,h,f,e,r,n);t&&c.push(t),f+=e*d}if(c.sort((e,t)=>{let s=e[2]-t[2];return 0===s&&r&&(s=e[4]-t[4]),s}),c.length){let e=6*c[0][2];a[0]=c[0][0]/e,a[1]=c[0][1]/e,r&&(e=6*c[0][4],a[2]=0!==e?c[0][3]/e:0),(a[0]<u[0]||a[0]>u[1]||a[1]<u[2]||a[1]>u[3]||r&&(a[2]<u[4]||a[2]>u[5]))&&(a.length=0)}if(!a.length){const e=t.lengths[0]?o(h,0,l[0],r,n):null;if(!e)return null;a[0]=e[0],a[1]=e[1],r&&e.length>2&&(a[2]=e[2])}return e}function i(e,t,r,n,i,o){const a=s(i,o);let c=r,u=r+a,l=0,h=0,d=0,f=0,g=0;for(let r=0,s=n-1;r<s;r++,c+=a,u+=a){const r=t[c],s=t[c+1],n=t[c+2],o=t[u],a=t[u+1],p=t[u+2];let y=r*a-o*s;f+=y,l+=(r+o)*y,h+=(s+a)*y,i&&(y=r*p-o*n,d+=(n+p)*y,g+=y),r<e[0]&&(e[0]=r),r>e[1]&&(e[1]=r),s<e[2]&&(e[2]=s),s>e[3]&&(e[3]=s),i&&(n<e[4]&&(e[4]=n),n>e[5]&&(e[5]=n))}if(f>0&&(f*=-1),g>0&&(g*=-1),!f)return null;const p=[l,h,.5*f];return i&&(p[3]=d,p[4]=.5*g),p}function o(e,t,r,n,i){const o=s(n,i);let h=t,d=t+o,f=0,g=0,p=0,y=0;for(let t=0,s=r-1;t<s;t++,h+=o,d+=o){const t=e[h],r=e[h+1],s=e[h+2],i=e[d],o=e[d+1],m=e[d+2],_=n?c(t,r,s,i,o,m):a(t,r,i,o);if(_)if(f+=_,n){const e=l(t,r,s,i,o,m);g+=_*e[0],p+=_*e[1],y+=_*e[2]}else{const e=u(t,r,i,o);g+=_*e[0],p+=_*e[1]}}return f>0?n?[g/f,p/f,y/f]:[g/f,p/f]:r>0?n?[e[t],e[t+1],e[t+2]]:[e[t],e[t+1]]:null}function a(e,t,r,s){const n=r-e,i=s-t;return Math.sqrt(n*n+i*i)}function c(e,t,r,s,n,i){const o=s-e,a=n-t,c=i-r;return Math.sqrt(o*o+a*a+c*c)}function u(e,t,r,s){return[e+.5*(r-e),t+.5*(s-t)]}function l(e,t,r,s,n,i){return[e+.5*(s-e),t+.5*(n-t),r+.5*(i-r)]}r.d(t,{Q:()=>n})},30624:(e,t,r)=>{r.r(t),r.d(t,{createConnection:()=>I});var s=r(31635),n=r(78888),i=r(49186),o=r(53966),a=r(74887),c=r(84952),u=(r(44208),r(87811),r(40608)),l=r(16930),h=r(65864),d=r(10107),f=r(62815),g=r(65529);let p=class extends g.nJ{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new i.A("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,s.Cg)([(0,d.MZ)({readOnly:!0})],p.prototype,"connectionError",null),p=(0,s.Cg)([(0,u.$)("esri.layers.support.StreamConnection")],p);let y=class extends p{constructor(e){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._config=e,this._featureZScaler=(0,f.N)(t,s,r),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,r=0){try{if(this.destroyed)return;const t=(0,c.a6)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(s){const n=t/1e3;return this._config.maxReconnectionAttempts&&r>=this._config.maxReconnectionAttempts?(o.A.getLogger(this).error(new i.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.A.getLogger(this).error(new i.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${n}s`,s)),await(0,a.Pl)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),r+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{const t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void o.A.getLogger(this).error(new i.A("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise((t,r)=>{const s=new WebSocket(e);s.onopen=()=>{if(s.onopen=null,this.destroyed)return s.onclose=null,void s.close();s.onclose=e=>this._onClose(e),s.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(s),t(s)},s.onclose=e=>{s.onopen=s.onclose=null,r(e)}})}async _handshake(e=1e4){const t=this._websocket;if(null==t)return;const r=(0,a.Tw)(),s=t.onmessage,{filter:n,outFields:c,spatialReference:u}=this._config;return r.timeout(e),t.onmessage=e=>{let a=null;try{a=JSON.parse(e.data)}catch(e){}a&&"object"==typeof a||(o.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),r.reject(),this.destroy()),a.spatialReference?.wkid!==u?.wkid&&(o.A.getLogger(this).error(new i.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${u.wkid}`,e.data)),r.reject(),this.destroy()),"json"!==a.format&&(o.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),r.reject(),this.destroy()),n&&a.filter!==n&&o.A.getLogger(this).error(new i.A("websocket-connection","Tried to set filter, but server doesn't support it")),c&&a.outFields!==c&&o.A.getLogger(this).error(new i.A("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=s;for(const e of this._outstandingMessages)t.send(JSON.stringify(e));this._outstandingMessages=[],r.resolve()},t.send(JSON.stringify({filter:n,outFields:c,format:"json",spatialReference:{wkid:u.wkid}})),r.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),o.A.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&o.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,s.Cg)([(0,d.MZ)()],y.prototype,"connectionStatus",null),(0,s.Cg)([(0,d.MZ)()],y.prototype,"errorString",void 0),y=(0,s.Cg)([(0,u.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],y);var m=r(80893),_=r(61956);const b={maxQueryDepth:5,maxRecordCountFactor:3};let w=class extends y{constructor(e){super({...b,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||o.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void o.A.getLogger(this).error(new i.A("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},r=(0,n.A)(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const r=e[0],{urls:s,token:n}=r,i=this._inferWebSocketBaseUrl(s);return(0,c.a6)(`${i}/subscribe`,{outSR:""+t.wkid,token:n})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return o.A.getLogger(this).error(new i.A("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const r=this._websocket;if(null==r||null==e&&null==t)return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let n=!1;const c=(0,a.Tw)();return r.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(o.A.getLogger(this).error(new i.A("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(r),n=!0,c.resolve())},r.send(s),setTimeout(()=>{n||(this.destroyed||this._websocket!==r||o.A.getLogger(this).error(new i.A("geoevent-connection","Server timed out when setting filter")),c.reject())},1e4),c.promise}_serializeFilter(e,t){const r={};if(null==e&&null==t)return r;if(e?.geometry)try{const t=(0,h.rS)(e.geometry);if("extent"!==t.type)throw new i.A("geoevent-connection",`Expected extent but found type ${t.type}`);r.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){o.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(r.where=e.where),null!=t&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return o.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:n,geometry:a}=s;for(const t in n)e.attributes[t]=n[t];return a&&(e.geometry=a),e.geometry||e.centroid||o.A.getLogger(this).error(new i.A("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;const n=await s;if(!n)return;for(const e of n.features)this.onFeature(this._enrich(e))}catch(e){o.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(13),r.e(1214),r.e(9953),r.e(3926),r.e(3029),r.e(4111),r.e(8506),r.e(9784),r.e(812),r.e(655),r.e(6719)]).then(r.bind(r,29784))).default)({url:e}),{capabilities:s}=await t.load(),n=s.query.supportsMaxRecordCountFactor,i=s.query.supportsPagination,o=s.query.supportsCentroid,a=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,u=n?c*a:c,h=new _.A;if(h.outFields=this._config.outFields??["*"],h.where=this._config.filter?.where??"1=1",h.returnGeometry=!0,h.returnExceededLimitFeatures=!0,h.outSpatialReference=l.A.fromJSON(this._config.spatialReference),o&&(h.returnCentroid=!0),n&&(h.maxRecordCountFactor=a),i)return h.num=u,t.destroy(),this._queryPages(e,h);const d=await(0,m.eW)(e,h,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,r=[],s=0){t.start=null!=t.num?s*t.num:null;const{data:n}=await(0,m.eW)(e,t,this._config.sourceSpatialReference);return n.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(n.features.forEach(e=>r.push(e)),this._queryPages(e,t,r,s+1)):(r.forEach(e=>n.features.push(e)),n)}_addRelatedFeatures(e){const t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const e of r){const r=e.attributes[s];t.set(r,e)}this._relatedFeatures=t}};w=(0,s.Cg)([(0,u.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],w);let k=class extends p{constructor(e){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=(0,f.N)(t,s,r)}normalizeCtorArgs(){return{}}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function S(e,t){if(null==e&&null==t)return null;const r={};return null!=t&&(r.geometry=t),null!=e&&(r.where=e),r}function I(e,t,r,s,n,i,o,a,c){const u={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:S(n,i),maxReconnectionAttempts:o,maxReconnectionInterval:a,customParameters:c};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new y(u):new w(u):new k(u)}(0,s.Cg)([(0,d.MZ)()],k.prototype,"connectionStatus",void 0),(0,s.Cg)([(0,d.MZ)()],k.prototype,"errorString",void 0),k=(0,s.Cg)([(0,u.$)("esri.layers.support.ClientSideConnection")],k)},43334:(e,t,r)=>{r.d(t,{N3:()=>a,Om:()=>o});var s=r(69397),n=r(27647),i=r(92722);class o{constructor(e=null,t={},r,s,n=0){this.geometry=e,this.attributes=t,this.centroid=r,this.objectId=s,this.displayId=n}static fromJSON(e){const t=e.geometry?i.A.fromJSON(e.geometry):null,r=e.centroid?i.A.fromJSON(e.centroid):null,s=e.objectId;return new o(t,e.attributes,r,s)}weakClone(){const e=new o(this.geometry,this.attributes,this.centroid,this.objectId);return e.displayId=this.displayId,e}clone(){const e=this.geometry?.clone(),t=new o(e,{...this.attributes},this.centroid?.clone(),this.objectId);return t.displayId=this.displayId,t}ensureCentroid(e){return this.centroid??=(0,n.Q)(new i.A,this.geometry,e.hasZ,e.hasM),this.centroid}get usedMemory(){return 128+(0,s.lM)(this.attributes)+(this.geometry?.usedMemory??0)}}function a(e){return!!e.geometry?.coords?.length}},51624:(e,t,r)=>{r.d(t,{A:()=>u});var s=r(44208),n=r(69397),i=r(93687);const o=4294967296,a=new TextDecoder("utf-8"),c=(0,s.A)("safari")||(0,s.A)("ios")?6:(0,s.A)("ff")?12:32;class u{constructor(e,t,r=0,s=(e?e.byteLength:0)){this._tag=0,this._dataType=99,this._init(e,t,r,s)}_init(e,t,r,s){this._data=e,this._dataView=t,this._pos=r,this._end=s}get usedMemory(){return 64+(0,n.Qf)(this._data)}asUnsafe(){return this}clone(){return new u(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(e){this._pos=e}nextTag(e){for(;;){if(this._pos===this._end)return!1;const t=this._decodeVarint();if(this._tag=t>>3,this._dataType=7&t,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;if(e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128)return e;throw new Error("Varint overflow")}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();return e>>>1^-(1&e)}getSInt64(){return this._decodeSVarint()}getBool(){const e=0!==this._data[this._pos];return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getUint32(t+4,!0)*o;return this._skip(8),r}getSFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getInt32(t+4,!0)*o;return this._skip(8),r}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),t=this._pos,r=this._toString(this._data,t,t+e);return this._skip(e),r}getBytes(){const e=this._getLength(),t=this._pos,r=this._toBytes(this._data,t,t+e);return this._skip(e),r}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,t,r,s){const n=this.getMessage(),i=e(n,t,r,s);return n.release(),i}processMessage(e){const t=this.getMessage(),r=e(t);return t.release(),r}getMessage(){const e=this._getLength(),t=u.pool.acquire();return t._init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),t}release(){u.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case 0:this._decodeVarint();break;case 1:this._skip(8);break;case 2:this._skip(this._getLength());break;case 5:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let t=this._pos,r=0,s=0;if(this._end-t>=10)do{if(s=e[t++],r|=127&s,!(128&s))break;if(s=e[t++],r|=(127&s)<<7,!(128&s))break;if(s=e[t++],r|=(127&s)<<14,!(128&s))break;if(s=e[t++],r|=(127&s)<<21,!(128&s))break;if(s=e[t++],r+=268435456*(127&s),!(128&s))break;if(s=e[t++],r+=34359738368*(127&s),!(128&s))break;if(s=e[t++],r+=4398046511104*(127&s),!(128&s))break;if(s=e[t++],r+=562949953421312*(127&s),!(128&s))break;if(s=e[t++],r+=72057594037927940*(127&s),!(128&s))break;if(s=e[t++],r+=0x8000000000000000*(127&s),!(128&s))break;throw new Error("Varint too long!")}while(0);else{let n=1;for(;t!==this._end&&(s=e[t],128&s);)++t,r+=(127&s)*n,n*=128;if(t===this._end)throw new Error("Varint overrun!");++t,r+=s*n}return this._pos=t,r}_decodeSVarint(){const e=this._data;let t,r=0,s=0;const n=1&e[this._pos];if(s=e[this._pos++],r|=127&s,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<7,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<14,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<21,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=268435456*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=34359738368*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=4398046511104*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(t=BigInt(r),s=e[this._pos++],t+=0x2000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);if(s=e[this._pos++],t+=0x100000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);if(s=e[this._pos++],t+=0x8000000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);throw new Error("Varint too long!")}_getLength(){if(2!==this._dataType)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,t,r){if((r=Math.min(this._end,r))-t>c){const s=e.subarray(t,r);return a.decode(s)}let s="",n="";for(let i=t;i<r;++i){const t=e[i];128&t?n+="%"+t.toString(16):(s+=decodeURIComponent(n)+String.fromCharCode(t),n="")}return n.length&&(s+=decodeURIComponent(n)),s}_toBytes(e,t,r){return r=Math.min(this._end,r),new Uint8Array(e.buffer,t,r-t)}static{this.pool=new i.A(()=>new u(null,null),void 0,e=>{e._data=null,e._dataView=null})}}},53655:(e,t,r)=>{r.d(t,{SH:()=>N,ae:()=>I,cn:()=>_});var s=r(49186),n=r(51624),i=r(92722),o=r(69418);const a=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],c=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],u=["upperLeft","lowerLeft"];function l(e){return e>=a.length?null:a[e]}function h(e){return e>=c.length?null:c[e]}function d(e){return e>=u.length?null:u[e]}function f(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function g(e,t,r){const s=e.asUnsafe(),n=t.createPointGeometry(r);for(;s.next();)switch(s.tag()){case 3:{const e=s.getUInt32(),r=s.pos()+e;let i=0;for(;s.pos()<r;)t.addCoordinatePoint(n,s.getSInt64(),i++);break}default:s.skip()}return n}function p(e,t,r){const s=e.asUnsafe(),n=t.createGeometry(r),i=2+(r.hasZ?1:0)+(r.hasM?1:0);for(;s.next();)switch(s.tag()){case 2:{const e=s.getUInt32(),r=s.pos()+e;let i=0;for(;s.pos()<r;)t.addLength(n,s.getUInt32(),i++);break}case 3:{const e=s.getUInt32(),r=s.pos()+e;let o=0;for(t.allocateCoordinates(n);s.pos()<r;)t.addCoordinate(n,s.getSInt64(),o),o++,o===i&&(o=0);break}default:s.skip()}return n}function y(e){const t=e.asUnsafe(),r=new i.A;let s="esriGeometryPoint";for(;t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;)r.lengths.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;)r.coords.push(t.getSInt64());break}case 1:s=o.z[t.getEnum()];break;default:t.skip()}return{queryGeometry:r,queryGeometryType:s}}function m(e){const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}function _(e){const t=e.asUnsafe(),r={type:l(0)};for(;t.next();)switch(t.tag()){case 1:r.name=t.getString();break;case 2:r.type=l(t.getEnum());break;case 3:r.alias=t.getString();break;case 4:r.sqlType=h(t.getEnum());break;case 5:default:t.skip();break;case 6:r.defaultValue=t.getString()}return r}function b(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.name=r.getString();break;case 2:t.isSystemMaintained=r.getBool();break;default:r.skip()}return t}function w(e,t,r,s){const n=t.createFeature(r);let i=0;for(;e.next();)switch(e.tag()){case 1:{const t=s[i++].name;n.attributes[t]=e.processMessage(m);break}case 2:n.geometry=e.processMessageWithArgs(p,t,r);break;case 4:n.centroid=e.processMessageWithArgs(g,t,r);break;default:e.skip()}return n}function k(e){const t=[1,1,1,1],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function S(e){const t=[0,0,0,0],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function I(e){const t={originPosition:d(0)},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.originPosition=d(r.getEnum());break;case 2:t.scale=r.processMessage(k);break;case 3:t.translate=r.processMessage(S);break;default:r.skip()}return t}function F(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.shapeAreaFieldName=r.getString();break;case 2:t.shapeLengthFieldName=r.getString();break;case 3:t.units=r.getString();break;default:r.skip()}return t}function T(e,t){const r=t.createSpatialReference();for(;e.next();)switch(e.tag()){case 1:r.wkid=e.getUInt32();break;case 5:r.wkt=e.getString();break;case 2:r.latestWkid=e.getUInt32();break;case 3:r.vcsWkid=e.getUInt32();break;case 4:r.latestVcsWkid=e.getUInt32();break;default:e.skip()}return r}function A(e,t){const r=t.createFeatureResult(),s=e.asUnsafe();r.geometryType=f(t,0);let n=!1;for(;s.next();)switch(s.tag()){case 1:r.objectIdFieldName=s.getString();break;case 3:r.globalIdFieldName=s.getString();break;case 4:r.geohashFieldName=s.getString();break;case 5:r.geometryProperties=s.processMessage(F);break;case 7:r.geometryType=f(t,s.getEnum());break;case 8:r.spatialReference=s.processMessageWithArgs(T,t);break;case 10:r.hasZ=s.getBool();break;case 11:r.hasM=s.getBool();break;case 12:r.transform=s.processMessage(I);break;case 9:r.exceededTransferLimit=s.getBool();break;case 13:t.addField(r,s.processMessage(_));break;case 15:n||(t.prepareFeatures(r),n=!0),t.addFeature(r,s.processMessageWithArgs(w,t,r,r.fields));break;case 2:r.uniqueIdField=s.processMessage(b);break;default:s.skip()}return t.finishFeatureResult(r),r}function x(e,t){const r={};let s=null;for(;e.next();)switch(e.tag()){case 4:s=e.processMessageWithArgs(y);break;case 1:r.featureResult=e.processMessageWithArgs(A,t);break;default:e.skip()}return null!=s&&r.featureResult&&t.addQueryGeometry(r,s),r}function N(e,t){try{const r=2,s=new n.A(new Uint8Array(e),new DataView(e)),i={};for(;s.next();)s.tag()===r?i.queryResult=s.processMessageWithArgs(x,t):s.skip();return i}catch(e){throw new s.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},58501:(e,t,r)=>{r.d(t,{q:()=>n});var s=r(62815);function n(e,t,r){if(!r?.features||!r.hasZ)return;const n=(0,s.N)(r.geometryType,t,e.outSpatialReference);if(null!=n)for(const e of r.features)n(e.geometry)}},58512:(e,t,r)=>{r.d(t,{A:()=>s});class s{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new s;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}},66208:(e,t,r)=>{r.d(t,{m:()=>n});var s=r(53655);function n(e,t){const r=(0,s.SH)(e,t),n=r.queryResult.featureResult,i=r.queryResult.queryGeometry,o=r.queryResult.queryGeometryType;if(n&&n.features&&n.features.length&&n.objectIdFieldName){const e=n.objectIdFieldName;for(const t of n.features)t.attributes&&(t.objectId=t.attributes[e])}return n&&(n.queryGeometry=i,n.queryGeometryType=o),n}},69397:(e,t,r)=>{r.d(t,{$B:()=>n,Qf:()=>u,Qh:()=>a,RS:()=>i,ez:()=>d,lM:()=>o,qK:()=>h});var s=r(34275);function n(e){return 32+e.length}const i=16;function o(e){if(!e)return 0;let t=h;for(const r in e)e.hasOwnProperty(r)&&(t+=c(e[r],!1));return t}function a(e){if(!e)return 0;if("number"==typeof e[0])return u(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return l(e,8);let r=d;for(let s=0;s<t;s++)r+=c(e[s]);return r}(e);let t=h;for(const r in e)e.hasOwnProperty(r)&&(t+=c(e[r]));return t}function c(e,t=!0){switch(typeof e){case"object":return t?a(e):h;case"string":return n(e);case"number":return i;case"boolean":return 4;default:return 8}}function u(...e){return e.reduce((e,t)=>e+(t?(0,s.iu)(t)?t.byteLength+f:Array.isArray(t)?l(t,i):0:0),0)}function l(e,t){return d+e.length*t}const h=32,d=16,f=145},69418:(e,t,r)=>{r.d(t,{S:()=>u,z:()=>c});var s=r(83047),n=r(21325),i=r(43334),o=r(58512),a=r(92722);const c=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];class u{constructor(e){this._options=e,this.geometryTypes=c,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new o.A}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!e?.features||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||(0,n.aI)(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const t=(0,s.G9)(this._options.sourceSpatialReference)/(0,s.G9)(e.spatialReference);if(1!==t)for(const r of e.features){if(!(0,i.N3)(r))continue;const e=r.geometry.coords;for(let r=2;r<e.length;r+=3)e[r]*=t}}addFeature(e,t){e.features.push(t)}createFeature(){return new i.Om(null,{},null,0)}createSpatialReference(){return{wkid:0}}createGeometry(){return new a.A}addField(e,t){e.fields.push(t)}allocateCoordinates(e){e.coords.length=e.lengths.reduce((e,t)=>e+t,0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,t){e.coords[this._coordinatePtr++]=t}addCoordinatePoint(e,t){e.coords.push(t)}addLength(e,t){e.lengths.push(t)}addQueryGeometry(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType}createPointGeometry(){return new a.A}}},80754:(e,t,r)=>{r.d(t,{j7:()=>o,kS:()=>c,kd:()=>a,r8:()=>u});var s=r(82799),n=r(16930),i=r(65864);const o={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator}),minus180Line:new s.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.A({paths:[[[180,-180],[180,180]]],spatialReference:n.A.WGS84}),minus180Line:new s.A({paths:[[[-180,-180],[-180,180]]],spatialReference:n.A.WGS84})}};function a(e,t){return Math.ceil((e-t)/(2*t))}function c(e,t){const r=u(e);for(const e of r)for(const r of e)r[0]+=t;return e}function u(e){return(0,i.Bi)(e)?e.rings:e.paths}},80893:(e,t,r)=>{r.d(t,{IJ:()=>g,Jf:()=>_,Pk:()=>y,eW:()=>f,gW:()=>m,kS:()=>p});var s=r(78888),n=r(84952),i=r(65864),o=r(17136),a=r(21325),c=r(10536),u=r(66208),l=r(58501);const h="Layer does not support extent calculation.";function d(e,t,r){const s=e.geometry,n=e.toJSON();delete n.compactGeometryEnabled,delete n.defaultSpatialReferenceEnabled;const o=n;let c,u,l;if(s&&(u=s.spatialReference,l=(0,a.YX)(u),o.geometryType=(0,i.$B)(s),o.geometry=function(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const r=e.toJSON();return delete r.spatialReference,JSON.stringify(r)}(s,e.compactGeometryEnabled),o.inSR=l),n.groupByFieldsForStatistics&&(o.groupByFieldsForStatistics=n.groupByFieldsForStatistics.join(",")),n.objectIds)switch(r?.uniqueIdFields?.length){case void 0:o.objectIds=n.objectIds.join(",");break;case 1:o.uniqueIds=JSON.stringify(n.objectIds),delete o.objectIds;break;default:o.uniqueIds=JSON.stringify(n.objectIds.map(e=>JSON.parse(e))),delete o.objectIds}if(n.orderByFields&&(o.orderByFields=n.orderByFields.join(",")),!n.outFields||!n.returnDistinctValues&&(t?.returnCountOnly||t?.returnExtentOnly||t?.returnIdsOnly)?delete o.outFields:n.outFields.includes("*")?o.outFields="*":o.outFields=n.outFields.join(","),n.outSR?(o.outSR=(0,a.YX)(n.outSR),c=e.outSpatialReference):s&&(n.returnGeometry||n.returnCentroid)&&(o.outSR=o.inSR,c=u),n.returnGeometry&&delete n.returnGeometry,n.outStatistics&&(o.outStatistics=JSON.stringify(n.outStatistics)),n.fullText&&(o.fullText=JSON.stringify(n.fullText)),n.pixelSize&&(o.pixelSize=JSON.stringify(n.pixelSize)),n.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&null!=u&&null!=e.quantizationParameters?.extent&&u.equals(e.quantizationParameters.extent.spatialReference)&&delete n.quantizationParameters.extent.spatialReference,o.quantizationParameters=JSON.stringify(n.quantizationParameters)),n.parameterValues&&(o.parameterValues=JSON.stringify(n.parameterValues)),n.rangeValues&&(o.rangeValues=JSON.stringify(n.rangeValues)),n.dynamicDataSource&&(o.layer=JSON.stringify({source:n.dynamicDataSource}),delete n.dynamicDataSource),n.timeExtent){const e=n.timeExtent,{start:t,end:r}=e;null==t&&null==r||(o.time=t===r?t:`${t??"null"},${r??"null"}`),delete n.timeExtent}return e.defaultSpatialReferenceEnabled&&null!=u&&null!=c&&u.equals(c)&&(o.defaultSR=o.inSR,delete o.inSR,delete o.outSR),o}async function f(e,t,r,s,n){const i=t.timeExtent?.isEmpty?{data:{features:[]}}:await w(e,t,"json",s,void 0,n);return(0,l.q)(t,r,i.data),i}async function g(e,t,r,s,n){if(t.timeExtent?.isEmpty)return{data:r.createFeatureResult()};const i=await p(e,t,s,n),o=i;return o.data=(0,u.m)(i.data,r),o}function p(e,t,r,s){return w(e,t,"pbf",r,void 0,s)}function y(e,t,r,s){return t.timeExtent?.isEmpty?Promise.resolve({data:{objectIds:[]}}):w(e,t,"json",r,{returnIdsOnly:!0},s)}function m(e,t,r,s){return t.timeExtent?.isEmpty?Promise.resolve({data:{count:0}}):w(e,t,"json",r,{returnIdsOnly:!0,returnCountOnly:!0},s)}async function _(e,t,r){if(t.timeExtent?.isEmpty)return{data:{count:0,extent:null}};const s=await w(e,t,"json",r,{returnExtentOnly:!0,returnCountOnly:!0}),n=s.data;if(n.hasOwnProperty("extent"))return s;if(n.features)throw new Error(h);if(n.hasOwnProperty("count"))throw new Error(h);return s}function b(e,t){if(!e.returnIdsOnly||!t.uniqueIdFields)return e;const r={...e,returnUniqueIdsOnly:!0};return delete r.returnIdsOnly,r}async function w(e,t,r,i={},a={},u={}){const l="string"==typeof e?(0,n.An)(e):e,h=t.geometry?[t.geometry]:[],f=await(0,o.el)(h,null,{signal:i.signal}),g=f?.[0];null!=g&&((t=t.clone()).geometry=g);const p=(0,c.z)({...l.query,f:r,...b(a,u),...d(t,a,u)});return(0,s.A)((0,n.fj)(l.path,(y=a,null==t.formatOf3DObjects||y.returnCountOnly||y.returnExtentOnly||y.returnIdsOnly?"query":"query3d")),{...i,responseType:"pbf"===r?"array-buffer":"json",query:{...p,...i.query}});var y}},92300:(e,t,r)=>{r.d(t,{V:()=>i,X:()=>n});var s=r(65864);function n(e){return{geometryType:(0,s.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function i(e,t,r){const n=(0,s.xD)(t);return e.map(e=>{const t=n.fromJSON(e);return t.spatialReference=r,t})}},92722:(e,t,r)=>{r.d(t,{A:()=>n});var s=r(69397);class n{constructor(e=[],t=[]){this.lengths=e??[],this.coords=t??[]}static fromJSON(e){return new n(e.lengths,e.coords)}static fromRect(e){const[t,r,s,i]=e,o=s-t,a=i-r;return new n([5],[t,r,o,0,0,a,-o,0,0,-a])}get isPoint(){return 0===this.lengths.length&&this.coords.length>=2}get maxLength(){return Math.max(...this.lengths)}get size(){return this.lengths.reduce((e,t)=>e+t)}get usedMemory(){return 64+(0,s.Qf)(this.lengths,this.coords)}area(){let e=0,t=0;if(!this.lengths.length)return 0;for(let r=0;r<this.lengths.length;r++){const s=this.lengths[r];if(s<3)continue;let n=this.coords[2*t],i=this.coords[2*t+1];for(let r=1;r<s;r+=1){const s=this.coords[2*(r+t)],o=this.coords[2*(r+t)+1];e+=-.5*(s-n)*(o+i),n=s,i=o}t+=s}return e}forEachVertex(e){let t=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r<this.lengths.length;r++){const s=this.lengths[r];for(let r=0;r<s;r++)e(this.coords[2*(r+t)],this.coords[2*(r+t)+1]);t+=s}}deltaDecode(){const e=this.clone(),{coords:t,lengths:r}=e;let s=0;for(const e of r){for(let r=1;r<e;r++)t[2*(s+r)]+=t[2*(s+r)-2],t[2*(s+r)+1]+=t[2*(s+r)-1];s+=e}return e}clone(e){if(0===this.lengths.length)return new n([],[this.coords[0],this.coords[1]]);const t=2*(0===this.lengths.length?1:this.lengths.reduce((e,t)=>e+t)),r=this.coords.slice(0,t);return e?(e.set(r),new n(this.lengths,e)):new n(Array.from(this.lengths),Array.from(r))}}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[624,7136],{10536:(e,t,r)=>{function s(e){const t={};for(const r in e){if("declaredClass"===r)continue;const n=e[r];if(null!=n&&"function"!=typeof n)if(Array.isArray(n)){t[r]=[];for(let e=0;e<n.length;e++)t[r][e]=s(n[e])}else"object"==typeof n?n.toJSON&&(t[r]=JSON.stringify(n)):t[r]=n}return t}r.d(t,{z:()=>s})},17136:(e,t,r)=>{r.d(t,{O7:()=>I,el:()=>S});var s=r(92602),n=r(49186),i=r(53966),o=r(39829),a=r(82799),c=r(80754),u=r(21325),l=r(28735),h=r(78888),d=r(65864),f=r(2272),g=r(84952),p=r(92300);const y=()=>i.A.getLogger("esri.geometry.support.normalizeUtils");function m(e){return"polygon"===e[0].type}function _(e){return"polyline"===e[0].type}function b(e,t,r){if(t){const t=function(e,t){if(!(e instanceof a.A||e instanceof o.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y().error(e),new n.A("internal:geometry",e)}const r=(0,c.r8)(e),s=[];for(const e of r){const r=[];s.push(r),r.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],i=e[s][1],o=e[s+1][0],a=e[s+1][1],c=Math.sqrt((o-n)*(o-n)+(a-i)*(a-i)),u=(a-i)/c,l=(o-n)/c,h=c/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,o=l*s+n,a=u*s+i;r.push([o,a])}const e=(c+Math.floor(h-1)*t)/2,s=l*e+n,o=u*e+i;r.push([s,o])}r.push([o,a])}}return function(e){return"polygon"===e.type}(e)?new o.A({rings:s,spatialReference:e.spatialReference}):new a.A({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,l.ci)(t,!0)}return r&&(e=(0,c.kS)(e,r)),e}function w(e,t,r){if(Array.isArray(e)){const s=e[0];if(s>t){const r=(0,c.kd)(s,t);e[0]=s+r*(-2*t)}else if(s<r){const t=(0,c.kd)(s,r);e[0]=s+t*(-2*r)}}else{const s=e.x;if(s>t){const r=(0,c.kd)(s,t);e=e.clone().offset(r*(-2*t),0)}else if(s<r){const t=(0,c.kd)(s,r);e=e.clone().offset(t*(-2*r),0)}}return e}function k(e,t){let r=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],i=t.geometries[s],o=(0,c.r8)(i);for(let e=0;e<o.length;e++){const t=o[e];t.some(r=>{if(r[0]<180)return!0;{let r=0;for(let e=0;e<t.length;e++){const s=t[e][0];r=s>r?s:r}r=Number(r.toFixed(9));const s=-360*(0,c.kd)(r,180);for(let r=0;r<t.length;r++){const t=i.getPoint(e,r);i.setPoint(e,r,t.clone().offset(s,0))}return!0}})}if(n===r){if(m(e))for(const t of(0,c.r8)(i))e[n]=e[n].addRing(t);else if(_(e))for(const t of(0,c.r8)(i))e[n]=e[n].addPath(t)}else r=n,e[n]=i}return e}async function S(e,t,r){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&y().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.A.geometryServiceUrl;let i,m,_,I,F,T,A,x,N=0;const q=[],R=[];for(const t of e)if(null!=t)if(i||(i=t.spatialReference,m=(0,u.Vp)(i),_=i.isWebMercator,T=_?102100:4326,I=c.j7[T].maxX,F=c.j7[T].minX,A=c.j7[T].plus180Line,x=c.j7[T].minus180Line),m)if("mesh"===t.type)R.push(t);else if("point"===t.type)R.push(w(t.clone(),I,F));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>w(e,I,F)),R.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,m);R.push(e.rings?new o.A(e):e)}else if(t.extent){const e=t.extent,r=(0,c.kd)(e.xmin,F)*(2*I);let s=0===r?t.clone():(0,c.kS)(t.clone(),r);e.offset(r,0);let{xmin:n,xmax:i}=e;n=Number(n.toFixed(9)),i=Number(i.toFixed(9)),e.intersects(A)&&i!==I?(N=i>N?i:N,s=b(s,_),q.push(s),R.push("cut")):e.intersects(x)&&n!==F?(N=i*(2*I)>N?i*(2*I):N,s=b(s,_,360),q.push(s),R.push("cut")):R.push(s)}else R.push(t.clone());else R.push(t);else R.push(t);let v=(0,c.kd)(N,I),M=-90;const O=v,E=new a.A;for(;v>0;){const e=360*v-180;E.addPath([[e,M],[e,-1*M]]),M*=-1,v--}if(q.length>0&&O>0){const t=k(q,await async function(e,t,r,s){const n=(0,f.Dl)(e),i=t[0].spatialReference,o={...s,responseType:"json",query:{...n.query,f:"json",sr:(0,u.YX)(i),target:JSON.stringify({geometryType:(0,d.$B)(t[0]),geometries:t}),cutter:JSON.stringify(r)}},a=await(0,h.A)(n.path+"/cut",o),{cutIndexes:c,geometries:l=[]}=a.data;return{cutIndexes:c,geometries:l.map(e=>{const t=(0,d.rS)(e);return t.spatialReference=i,t})}}(n,q,E,r)),s=[],i=[];for(let r=0;r<R.length;r++){const n=R[r];if("cut"!==n)i.push(n);else{const n=t.shift(),o=e[r];null!=o&&"polygon"===o.type&&o.rings&&o.rings.length>1&&n.rings.length>=o.rings.length?(s.push(n),i.push("simplify")):i.push(_?(0,l.Gh)(n):n)}}if(!s.length)return i;const o=await async function(e,t,r){const s="string"==typeof e?(0,g.An)(e):e,n=t[0].spatialReference,i=(0,d.$B)(t[0]),o={...r,query:{...s.query,f:"json",sr:(0,u.YX)(n),geometries:JSON.stringify((0,p.X)(t))}},{data:a}=await(0,h.A)(s.path+"/simplify",o);return(0,p.V)(a.geometries,i,n)}(n,s,r),a=[];for(let e=0;e<i.length;e++){const t=i[e];"simplify"!==t?a.push(t):a.push(_?(0,l.Gh)(o.shift()):o.shift())}return a}const C=[];for(let e=0;e<R.length;e++){const t=R[e];if("cut"!==t)C.push(t);else{const e=q.shift();C.push(!0===_?(0,l.Gh)(e):e)}}return C}function I(e,t,r){const s=(0,u.Vp)(r);if(null==s)return e;const[n,i]=s.valid,o=2*i;let a=0,c=0;t>i?a=Math.ceil(Math.abs(t-i)/o):t<n&&(a=-Math.ceil(Math.abs(t-n)/o)),e>i?c=Math.ceil(Math.abs(e-i)/o):e<n&&(c=-Math.ceil(Math.abs(e-n)/o));let l=e+(a-c)*o;const h=l-t;return h>i?l-=o:h<n&&(l+=o),l}},27647:(e,t,r)=>{function s(e,t){return e?t?4:3:t?3:2}function n(e,t,r,n){if(!t?.lengths.length)return null;e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0);const a=e.coords,c=[],u=r?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:l,coords:h}=t,d=s(r,n);let f=0;for(const e of l){const t=i(u,h,f,e,r,n);t&&c.push(t),f+=e*d}if(c.sort((e,t)=>{let s=e[2]-t[2];return 0===s&&r&&(s=e[4]-t[4]),s}),c.length){let e=6*c[0][2];a[0]=c[0][0]/e,a[1]=c[0][1]/e,r&&(e=6*c[0][4],a[2]=0!==e?c[0][3]/e:0),(a[0]<u[0]||a[0]>u[1]||a[1]<u[2]||a[1]>u[3]||r&&(a[2]<u[4]||a[2]>u[5]))&&(a.length=0)}if(!a.length){const e=t.lengths[0]?o(h,0,l[0],r,n):null;if(!e)return null;a[0]=e[0],a[1]=e[1],r&&e.length>2&&(a[2]=e[2])}return e}function i(e,t,r,n,i,o){const a=s(i,o);let c=r,u=r+a,l=0,h=0,d=0,f=0,g=0;for(let r=0,s=n-1;r<s;r++,c+=a,u+=a){const r=t[c],s=t[c+1],n=t[c+2],o=t[u],a=t[u+1],p=t[u+2];let y=r*a-o*s;f+=y,l+=(r+o)*y,h+=(s+a)*y,i&&(y=r*p-o*n,d+=(n+p)*y,g+=y),r<e[0]&&(e[0]=r),r>e[1]&&(e[1]=r),s<e[2]&&(e[2]=s),s>e[3]&&(e[3]=s),i&&(n<e[4]&&(e[4]=n),n>e[5]&&(e[5]=n))}if(f>0&&(f*=-1),g>0&&(g*=-1),!f)return null;const p=[l,h,.5*f];return i&&(p[3]=d,p[4]=.5*g),p}function o(e,t,r,n,i){const o=s(n,i);let h=t,d=t+o,f=0,g=0,p=0,y=0;for(let t=0,s=r-1;t<s;t++,h+=o,d+=o){const t=e[h],r=e[h+1],s=e[h+2],i=e[d],o=e[d+1],m=e[d+2],_=n?c(t,r,s,i,o,m):a(t,r,i,o);if(_)if(f+=_,n){const e=l(t,r,s,i,o,m);g+=_*e[0],p+=_*e[1],y+=_*e[2]}else{const e=u(t,r,i,o);g+=_*e[0],p+=_*e[1]}}return f>0?n?[g/f,p/f,y/f]:[g/f,p/f]:r>0?n?[e[t],e[t+1],e[t+2]]:[e[t],e[t+1]]:null}function a(e,t,r,s){const n=r-e,i=s-t;return Math.sqrt(n*n+i*i)}function c(e,t,r,s,n,i){const o=s-e,a=n-t,c=i-r;return Math.sqrt(o*o+a*a+c*c)}function u(e,t,r,s){return[e+.5*(r-e),t+.5*(s-t)]}function l(e,t,r,s,n,i){return[e+.5*(s-e),t+.5*(n-t),r+.5*(i-r)]}r.d(t,{Q:()=>n})},30624:(e,t,r)=>{r.r(t),r.d(t,{createConnection:()=>I});var s=r(31635),n=r(78888),i=r(49186),o=r(53966),a=r(74887),c=r(84952),u=(r(44208),r(87811),r(40608)),l=r(16930),h=r(65864),d=r(10107),f=r(62815),g=r(65529);let p=class extends g.nJ{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new i.A("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,s.Cg)([(0,d.MZ)({readOnly:!0})],p.prototype,"connectionError",null),p=(0,s.Cg)([(0,u.$)("esri.layers.support.StreamConnection")],p);let y=class extends p{constructor(e){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._config=e,this._featureZScaler=(0,f.N)(t,s,r),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.source.path,t=1e3,r=0){try{if(this.destroyed)return;const t=(0,c.a6)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(s){const n=t/1e3;return this._config.maxReconnectionAttempts&&r>=this._config.maxReconnectionAttempts?(o.A.getLogger(this).error(new i.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.A.getLogger(this).error(new i.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${n}s`,s)),await(0,a.Pl)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),r+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{const t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void o.A.getLogger(this).error(new i.A("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise((t,r)=>{const s=new WebSocket(e);s.onopen=()=>{if(s.onopen=null,this.destroyed)return s.onclose=null,void s.close();s.onclose=e=>this._onClose(e),s.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(s),t(s)},s.onclose=e=>{s.onopen=s.onclose=null,r(e)}})}async _handshake(e=1e4){const t=this._websocket;if(null==t)return;const r=(0,a.Tw)(),s=t.onmessage,{filter:n,outFields:c,spatialReference:u}=this._config;return r.timeout(e),t.onmessage=e=>{let a=null;try{a=JSON.parse(e.data)}catch(e){}a&&"object"==typeof a||(o.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),r.reject(),this.destroy()),a.spatialReference?.wkid!==u?.wkid&&(o.A.getLogger(this).error(new i.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${u.wkid}`,e.data)),r.reject(),this.destroy()),"json"!==a.format&&(o.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),r.reject(),this.destroy()),n&&a.filter!==n&&o.A.getLogger(this).error(new i.A("websocket-connection","Tried to set filter, but server doesn't support it")),c&&a.outFields!==c&&o.A.getLogger(this).error(new i.A("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=s;for(const e of this._outstandingMessages)t.send(JSON.stringify(e));this._outstandingMessages=[],r.resolve()},t.send(JSON.stringify({filter:n,outFields:c,format:"json",spatialReference:{wkid:u.wkid}})),r.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),o.A.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&o.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,s.Cg)([(0,d.MZ)()],y.prototype,"connectionStatus",null),(0,s.Cg)([(0,d.MZ)()],y.prototype,"errorString",void 0),y=(0,s.Cg)([(0,u.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],y);var m=r(80893),_=r(61956);const b={maxQueryDepth:5,maxRecordCountFactor:3};let w=class extends y{constructor(e){super({...b,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||o.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void o.A.getLogger(this).error(new i.A("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},r=(0,n.A)(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const r=e[0],{urls:s,token:n}=r,i=this._inferWebSocketBaseUrl(s);return(0,c.a6)(`${i}/subscribe`,{outSR:""+t.wkid,token:n})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return o.A.getLogger(this).error(new i.A("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const r=this._websocket;if(null==r||null==e&&null==t)return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let n=!1;const c=(0,a.Tw)();return r.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(o.A.getLogger(this).error(new i.A("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(r),n=!0,c.resolve())},r.send(s),setTimeout(()=>{n||(this.destroyed||this._websocket!==r||o.A.getLogger(this).error(new i.A("geoevent-connection","Server timed out when setting filter")),c.reject())},1e4),c.promise}_serializeFilter(e,t){const r={};if(null==e&&null==t)return r;if(e?.geometry)try{const t=(0,h.rS)(e.geometry);if("extent"!==t.type)throw new i.A("geoevent-connection",`Expected extent but found type ${t.type}`);r.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){o.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(r.where=e.where),null!=t&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return o.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:n,geometry:a}=s;for(const t in n)e.attributes[t]=n[t];return a&&(e.geometry=a),e.geometry||e.centroid||o.A.getLogger(this).error(new i.A("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;const n=await s;if(!n)return;for(const e of n.features)this.onFeature(this._enrich(e))}catch(e){o.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.all([r.e(6131),r.e(8219),r.e(8948),r.e(3910),r.e(13),r.e(1214),r.e(9953),r.e(3926),r.e(3029),r.e(4111),r.e(4897),r.e(9784),r.e(812),r.e(655),r.e(6719)]).then(r.bind(r,29784))).default)({url:e}),{capabilities:s}=await t.load(),n=s.query.supportsMaxRecordCountFactor,i=s.query.supportsPagination,o=s.query.supportsCentroid,a=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,u=n?c*a:c,h=new _.A;if(h.outFields=this._config.outFields??["*"],h.where=this._config.filter?.where??"1=1",h.returnGeometry=!0,h.returnExceededLimitFeatures=!0,h.outSpatialReference=l.A.fromJSON(this._config.spatialReference),o&&(h.returnCentroid=!0),n&&(h.maxRecordCountFactor=a),i)return h.num=u,t.destroy(),this._queryPages(e,h);const d=await(0,m.eW)(e,h,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,r=[],s=0){t.start=null!=t.num?s*t.num:null;const{data:n}=await(0,m.eW)(e,t,this._config.sourceSpatialReference);return n.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(n.features.forEach(e=>r.push(e)),this._queryPages(e,t,r,s+1)):(r.forEach(e=>n.features.push(e)),n)}_addRelatedFeatures(e){const t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const e of r){const r=e.attributes[s];t.set(r,e)}this._relatedFeatures=t}};w=(0,s.Cg)([(0,u.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],w);let k=class extends p{constructor(e){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=(0,f.N)(t,s,r)}normalizeCtorArgs(){return{}}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function S(e,t){if(null==e&&null==t)return null;const r={};return null!=t&&(r.geometry=t),null!=e&&(r.where=e),r}function I(e,t,r,s,n,i,o,a,c){const u={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:S(n,i),maxReconnectionAttempts:o,maxReconnectionInterval:a,customParameters:c};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new y(u):new w(u):new k(u)}(0,s.Cg)([(0,d.MZ)()],k.prototype,"connectionStatus",void 0),(0,s.Cg)([(0,d.MZ)()],k.prototype,"errorString",void 0),k=(0,s.Cg)([(0,u.$)("esri.layers.support.ClientSideConnection")],k)},43334:(e,t,r)=>{r.d(t,{N3:()=>a,Om:()=>o});var s=r(69397),n=r(27647),i=r(92722);class o{constructor(e=null,t={},r,s,n=0){this.geometry=e,this.attributes=t,this.centroid=r,this.objectId=s,this.displayId=n}static fromJSON(e){const t=e.geometry?i.A.fromJSON(e.geometry):null,r=e.centroid?i.A.fromJSON(e.centroid):null,s=e.objectId;return new o(t,e.attributes,r,s)}weakClone(){const e=new o(this.geometry,this.attributes,this.centroid,this.objectId);return e.displayId=this.displayId,e}clone(){const e=this.geometry?.clone(),t=new o(e,{...this.attributes},this.centroid?.clone(),this.objectId);return t.displayId=this.displayId,t}ensureCentroid(e){return this.centroid??=(0,n.Q)(new i.A,this.geometry,e.hasZ,e.hasM),this.centroid}get usedMemory(){return 128+(0,s.lM)(this.attributes)+(this.geometry?.usedMemory??0)}}function a(e){return!!e.geometry?.coords?.length}},51624:(e,t,r)=>{r.d(t,{A:()=>u});var s=r(44208),n=r(69397),i=r(93687);const o=4294967296,a=new TextDecoder("utf-8"),c=(0,s.A)("safari")||(0,s.A)("ios")?6:(0,s.A)("ff")?12:32;class u{constructor(e,t,r=0,s=(e?e.byteLength:0)){this._tag=0,this._dataType=99,this._init(e,t,r,s)}_init(e,t,r,s){this._data=e,this._dataView=t,this._pos=r,this._end=s}get usedMemory(){return 64+(0,n.Qf)(this._data)}asUnsafe(){return this}clone(){return new u(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(e){this._pos=e}nextTag(e){for(;;){if(this._pos===this._end)return!1;const t=this._decodeVarint();if(this._tag=t>>3,this._dataType=7&t,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;if(e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128)return e;if(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128)return e;throw new Error("Varint overflow")}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();return e>>>1^-(1&e)}getSInt64(){return this._decodeSVarint()}getBool(){const e=0!==this._data[this._pos];return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getUint32(t+4,!0)*o;return this._skip(8),r}getSFixed64(){const e=this._dataView,t=this._pos,r=e.getUint32(t,!0)+e.getInt32(t+4,!0)*o;return this._skip(8),r}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),t=this._pos,r=this._toString(this._data,t,t+e);return this._skip(e),r}getBytes(){const e=this._getLength(),t=this._pos,r=this._toBytes(this._data,t,t+e);return this._skip(e),r}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,t,r,s){const n=this.getMessage(),i=e(n,t,r,s);return n.release(),i}processMessage(e){const t=this.getMessage(),r=e(t);return t.release(),r}getMessage(){const e=this._getLength(),t=u.pool.acquire();return t._init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),t}release(){u.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case 0:this._decodeVarint();break;case 1:this._skip(8);break;case 2:this._skip(this._getLength());break;case 5:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let t=this._pos,r=0,s=0;if(this._end-t>=10)do{if(s=e[t++],r|=127&s,!(128&s))break;if(s=e[t++],r|=(127&s)<<7,!(128&s))break;if(s=e[t++],r|=(127&s)<<14,!(128&s))break;if(s=e[t++],r|=(127&s)<<21,!(128&s))break;if(s=e[t++],r+=268435456*(127&s),!(128&s))break;if(s=e[t++],r+=34359738368*(127&s),!(128&s))break;if(s=e[t++],r+=4398046511104*(127&s),!(128&s))break;if(s=e[t++],r+=562949953421312*(127&s),!(128&s))break;if(s=e[t++],r+=72057594037927940*(127&s),!(128&s))break;if(s=e[t++],r+=0x8000000000000000*(127&s),!(128&s))break;throw new Error("Varint too long!")}while(0);else{let n=1;for(;t!==this._end&&(s=e[t],128&s);)++t,r+=(127&s)*n,n*=128;if(t===this._end)throw new Error("Varint overrun!");++t,r+=s*n}return this._pos=t,r}_decodeSVarint(){const e=this._data;let t,r=0,s=0;const n=1&e[this._pos];if(s=e[this._pos++],r|=127&s,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<7,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<14,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r|=(127&s)<<21,!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=268435456*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=34359738368*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(s=e[this._pos++],r+=4398046511104*(127&s),!(128&s))return n?-(r+1)/2:r/2;if(t=BigInt(r),s=e[this._pos++],t+=0x2000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);if(s=e[this._pos++],t+=0x100000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);if(s=e[this._pos++],t+=0x8000000000000000n*BigInt(127&s),!(128&s))return Number(n?-(t+1n)/2n:t/2n);throw new Error("Varint too long!")}_getLength(){if(2!==this._dataType)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,t,r){if((r=Math.min(this._end,r))-t>c){const s=e.subarray(t,r);return a.decode(s)}let s="",n="";for(let i=t;i<r;++i){const t=e[i];128&t?n+="%"+t.toString(16):(s+=decodeURIComponent(n)+String.fromCharCode(t),n="")}return n.length&&(s+=decodeURIComponent(n)),s}_toBytes(e,t,r){return r=Math.min(this._end,r),new Uint8Array(e.buffer,t,r-t)}static{this.pool=new i.A(()=>new u(null,null),void 0,e=>{e._data=null,e._dataView=null})}}},53655:(e,t,r)=>{r.d(t,{SH:()=>N,ae:()=>I,cn:()=>_});var s=r(49186),n=r(51624),i=r(92722),o=r(69418);const a=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],c=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],u=["upperLeft","lowerLeft"];function l(e){return e>=a.length?null:a[e]}function h(e){return e>=c.length?null:c[e]}function d(e){return e>=u.length?null:u[e]}function f(e,t){return t>=e.geometryTypes.length?null:e.geometryTypes[t]}function g(e,t,r){const s=e.asUnsafe(),n=t.createPointGeometry(r);for(;s.next();)switch(s.tag()){case 3:{const e=s.getUInt32(),r=s.pos()+e;let i=0;for(;s.pos()<r;)t.addCoordinatePoint(n,s.getSInt64(),i++);break}default:s.skip()}return n}function p(e,t,r){const s=e.asUnsafe(),n=t.createGeometry(r),i=2+(r.hasZ?1:0)+(r.hasM?1:0);for(;s.next();)switch(s.tag()){case 2:{const e=s.getUInt32(),r=s.pos()+e;let i=0;for(;s.pos()<r;)t.addLength(n,s.getUInt32(),i++);break}case 3:{const e=s.getUInt32(),r=s.pos()+e;let o=0;for(t.allocateCoordinates(n);s.pos()<r;)t.addCoordinate(n,s.getSInt64(),o),o++,o===i&&(o=0);break}default:s.skip()}return n}function y(e){const t=e.asUnsafe(),r=new i.A;let s="esriGeometryPoint";for(;t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;)r.lengths.push(t.getUInt32());break}case 3:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;)r.coords.push(t.getSInt64());break}case 1:s=o.z[t.getEnum()];break;default:t.skip()}return{queryGeometry:r,queryGeometryType:s}}function m(e){const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}function _(e){const t=e.asUnsafe(),r={type:l(0)};for(;t.next();)switch(t.tag()){case 1:r.name=t.getString();break;case 2:r.type=l(t.getEnum());break;case 3:r.alias=t.getString();break;case 4:r.sqlType=h(t.getEnum());break;case 5:default:t.skip();break;case 6:r.defaultValue=t.getString()}return r}function b(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.name=r.getString();break;case 2:t.isSystemMaintained=r.getBool();break;default:r.skip()}return t}function w(e,t,r,s){const n=t.createFeature(r);let i=0;for(;e.next();)switch(e.tag()){case 1:{const t=s[i++].name;n.attributes[t]=e.processMessage(m);break}case 2:n.geometry=e.processMessageWithArgs(p,t,r);break;case 4:n.centroid=e.processMessageWithArgs(g,t,r);break;default:e.skip()}return n}function k(e){const t=[1,1,1,1],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function S(e){const t=[0,0,0,0],r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t[0]=r.getDouble();break;case 2:t[1]=r.getDouble();break;case 4:t[2]=r.getDouble();break;case 3:t[3]=r.getDouble();break;default:r.skip()}return t}function I(e){const t={originPosition:d(0)},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.originPosition=d(r.getEnum());break;case 2:t.scale=r.processMessage(k);break;case 3:t.translate=r.processMessage(S);break;default:r.skip()}return t}function F(e){const t={},r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:t.shapeAreaFieldName=r.getString();break;case 2:t.shapeLengthFieldName=r.getString();break;case 3:t.units=r.getString();break;default:r.skip()}return t}function T(e,t){const r=t.createSpatialReference();for(;e.next();)switch(e.tag()){case 1:r.wkid=e.getUInt32();break;case 5:r.wkt=e.getString();break;case 2:r.latestWkid=e.getUInt32();break;case 3:r.vcsWkid=e.getUInt32();break;case 4:r.latestVcsWkid=e.getUInt32();break;default:e.skip()}return r}function A(e,t){const r=t.createFeatureResult(),s=e.asUnsafe();r.geometryType=f(t,0);let n=!1;for(;s.next();)switch(s.tag()){case 1:r.objectIdFieldName=s.getString();break;case 3:r.globalIdFieldName=s.getString();break;case 4:r.geohashFieldName=s.getString();break;case 5:r.geometryProperties=s.processMessage(F);break;case 7:r.geometryType=f(t,s.getEnum());break;case 8:r.spatialReference=s.processMessageWithArgs(T,t);break;case 10:r.hasZ=s.getBool();break;case 11:r.hasM=s.getBool();break;case 12:r.transform=s.processMessage(I);break;case 9:r.exceededTransferLimit=s.getBool();break;case 13:t.addField(r,s.processMessage(_));break;case 15:n||(t.prepareFeatures(r),n=!0),t.addFeature(r,s.processMessageWithArgs(w,t,r,r.fields));break;case 2:r.uniqueIdField=s.processMessage(b);break;default:s.skip()}return t.finishFeatureResult(r),r}function x(e,t){const r={};let s=null;for(;e.next();)switch(e.tag()){case 4:s=e.processMessageWithArgs(y);break;case 1:r.featureResult=e.processMessageWithArgs(A,t);break;default:e.skip()}return null!=s&&r.featureResult&&t.addQueryGeometry(r,s),r}function N(e,t){try{const r=2,s=new n.A(new Uint8Array(e),new DataView(e)),i={};for(;s.next();)s.tag()===r?i.queryResult=s.processMessageWithArgs(x,t):s.skip();return i}catch(e){throw new s.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}}},58501:(e,t,r)=>{r.d(t,{q:()=>n});var s=r(62815);function n(e,t,r){if(!r?.features||!r.hasZ)return;const n=(0,s.N)(r.geometryType,t,e.outSpatialReference);if(null!=n)for(const e of r.features)n(e.geometry)}},58512:(e,t,r)=>{r.d(t,{A:()=>s});class s{constructor(){this.globalIdFieldName=null,this.geohashFieldName=null,this.geometryProperties=null,this.geometryType=null,this.spatialReference=null,this.hasZ=!1,this.hasM=!1,this.features=[],this.fields=[],this.transform=null,this.exceededTransferLimit=!1,this.uniqueIdField=null,this.queryGeometryType=null,this.queryGeometry=null}weakClone(){const e=new s;return e.globalIdFieldName=this.globalIdFieldName,e.geohashFieldName=this.geohashFieldName,e.geometryProperties=this.geometryProperties,e.geometryType=this.geometryType,e.spatialReference=this.spatialReference,e.hasZ=this.hasZ,e.hasM=this.hasM,e.features=this.features,e.fields=this.fields,e.transform=this.transform,e.exceededTransferLimit=this.exceededTransferLimit,e.uniqueIdField=this.uniqueIdField,e.queryGeometry=this.queryGeometry,e.queryGeometryType=this.queryGeometryType,e}}},66208:(e,t,r)=>{r.d(t,{m:()=>n});var s=r(53655);function n(e,t){const r=(0,s.SH)(e,t),n=r.queryResult.featureResult,i=r.queryResult.queryGeometry,o=r.queryResult.queryGeometryType;if(n&&n.features&&n.features.length&&n.objectIdFieldName){const e=n.objectIdFieldName;for(const t of n.features)t.attributes&&(t.objectId=t.attributes[e])}return n&&(n.queryGeometry=i,n.queryGeometryType=o),n}},69397:(e,t,r)=>{r.d(t,{$B:()=>n,Qf:()=>u,Qh:()=>a,RS:()=>i,ez:()=>d,lM:()=>o,qK:()=>h});var s=r(34275);function n(e){return 32+e.length}const i=16;function o(e){if(!e)return 0;let t=h;for(const r in e)e.hasOwnProperty(r)&&(t+=c(e[r],!1));return t}function a(e){if(!e)return 0;if("number"==typeof e[0])return u(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return l(e,8);let r=d;for(let s=0;s<t;s++)r+=c(e[s]);return r}(e);let t=h;for(const r in e)e.hasOwnProperty(r)&&(t+=c(e[r]));return t}function c(e,t=!0){switch(typeof e){case"object":return t?a(e):h;case"string":return n(e);case"number":return i;case"boolean":return 4;default:return 8}}function u(...e){return e.reduce((e,t)=>e+(t?(0,s.iu)(t)?t.byteLength+f:Array.isArray(t)?l(t,i):0:0),0)}function l(e,t){return d+e.length*t}const h=32,d=16,f=145},69418:(e,t,r)=>{r.d(t,{S:()=>u,z:()=>c});var s=r(83047),n=r(21325),i=r(43334),o=r(58512),a=r(92722);const c=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];class u{constructor(e){this._options=e,this.geometryTypes=c,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new o.A}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!e?.features||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||(0,n.aI)(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const t=(0,s.G9)(this._options.sourceSpatialReference)/(0,s.G9)(e.spatialReference);if(1!==t)for(const r of e.features){if(!(0,i.N3)(r))continue;const e=r.geometry.coords;for(let r=2;r<e.length;r+=3)e[r]*=t}}addFeature(e,t){e.features.push(t)}createFeature(){return new i.Om(null,{},null,0)}createSpatialReference(){return{wkid:0}}createGeometry(){return new a.A}addField(e,t){e.fields.push(t)}allocateCoordinates(e){e.coords.length=e.lengths.reduce((e,t)=>e+t,0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,t){e.coords[this._coordinatePtr++]=t}addCoordinatePoint(e,t){e.coords.push(t)}addLength(e,t){e.lengths.push(t)}addQueryGeometry(e,t){e.queryGeometry=t.queryGeometry,e.queryGeometryType=t.queryGeometryType}createPointGeometry(){return new a.A}}},80754:(e,t,r)=>{r.d(t,{j7:()=>o,kS:()=>c,kd:()=>a,r8:()=>u});var s=r(82799),n=r(16930),i=r(65864);const o={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator}),minus180Line:new s.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.A({paths:[[[180,-180],[180,180]]],spatialReference:n.A.WGS84}),minus180Line:new s.A({paths:[[[-180,-180],[-180,180]]],spatialReference:n.A.WGS84})}};function a(e,t){return Math.ceil((e-t)/(2*t))}function c(e,t){const r=u(e);for(const e of r)for(const r of e)r[0]+=t;return e}function u(e){return(0,i.Bi)(e)?e.rings:e.paths}},80893:(e,t,r)=>{r.d(t,{IJ:()=>g,Jf:()=>_,Pk:()=>y,eW:()=>f,gW:()=>m,kS:()=>p});var s=r(78888),n=r(84952),i=r(65864),o=r(17136),a=r(21325),c=r(10536),u=r(66208),l=r(58501);const h="Layer does not support extent calculation.";function d(e,t,r){const s=e.geometry,n=e.toJSON();delete n.compactGeometryEnabled,delete n.defaultSpatialReferenceEnabled;const o=n;let c,u,l;if(s&&(u=s.spatialReference,l=(0,a.YX)(u),o.geometryType=(0,i.$B)(s),o.geometry=function(e,t){if(t&&"extent"===e.type)return`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`;if(t&&"point"===e.type)return`${e.x},${e.y}`;const r=e.toJSON();return delete r.spatialReference,JSON.stringify(r)}(s,e.compactGeometryEnabled),o.inSR=l),n.groupByFieldsForStatistics&&(o.groupByFieldsForStatistics=n.groupByFieldsForStatistics.join(",")),n.objectIds)switch(r?.uniqueIdFields?.length){case void 0:o.objectIds=n.objectIds.join(",");break;case 1:o.uniqueIds=JSON.stringify(n.objectIds),delete o.objectIds;break;default:o.uniqueIds=JSON.stringify(n.objectIds.map(e=>JSON.parse(e))),delete o.objectIds}if(n.orderByFields&&(o.orderByFields=n.orderByFields.join(",")),!n.outFields||!n.returnDistinctValues&&(t?.returnCountOnly||t?.returnExtentOnly||t?.returnIdsOnly)?delete o.outFields:n.outFields.includes("*")?o.outFields="*":o.outFields=n.outFields.join(","),n.outSR?(o.outSR=(0,a.YX)(n.outSR),c=e.outSpatialReference):s&&(n.returnGeometry||n.returnCentroid)&&(o.outSR=o.inSR,c=u),n.returnGeometry&&delete n.returnGeometry,n.outStatistics&&(o.outStatistics=JSON.stringify(n.outStatistics)),n.fullText&&(o.fullText=JSON.stringify(n.fullText)),n.pixelSize&&(o.pixelSize=JSON.stringify(n.pixelSize)),n.quantizationParameters&&(e.defaultSpatialReferenceEnabled&&null!=u&&null!=e.quantizationParameters?.extent&&u.equals(e.quantizationParameters.extent.spatialReference)&&delete n.quantizationParameters.extent.spatialReference,o.quantizationParameters=JSON.stringify(n.quantizationParameters)),n.parameterValues&&(o.parameterValues=JSON.stringify(n.parameterValues)),n.rangeValues&&(o.rangeValues=JSON.stringify(n.rangeValues)),n.dynamicDataSource&&(o.layer=JSON.stringify({source:n.dynamicDataSource}),delete n.dynamicDataSource),n.timeExtent){const e=n.timeExtent,{start:t,end:r}=e;null==t&&null==r||(o.time=t===r?t:`${t??"null"},${r??"null"}`),delete n.timeExtent}return e.defaultSpatialReferenceEnabled&&null!=u&&null!=c&&u.equals(c)&&(o.defaultSR=o.inSR,delete o.inSR,delete o.outSR),o}async function f(e,t,r,s,n){const i=t.timeExtent?.isEmpty?{data:{features:[]}}:await w(e,t,"json",s,void 0,n);return(0,l.q)(t,r,i.data),i}async function g(e,t,r,s,n){if(t.timeExtent?.isEmpty)return{data:r.createFeatureResult()};const i=await p(e,t,s,n),o=i;return o.data=(0,u.m)(i.data,r),o}function p(e,t,r,s){return w(e,t,"pbf",r,void 0,s)}function y(e,t,r,s){return t.timeExtent?.isEmpty?Promise.resolve({data:{objectIds:[]}}):w(e,t,"json",r,{returnIdsOnly:!0},s)}function m(e,t,r,s){return t.timeExtent?.isEmpty?Promise.resolve({data:{count:0}}):w(e,t,"json",r,{returnIdsOnly:!0,returnCountOnly:!0},s)}async function _(e,t,r){if(t.timeExtent?.isEmpty)return{data:{count:0,extent:null}};const s=await w(e,t,"json",r,{returnExtentOnly:!0,returnCountOnly:!0}),n=s.data;if(n.hasOwnProperty("extent"))return s;if(n.features)throw new Error(h);if(n.hasOwnProperty("count"))throw new Error(h);return s}function b(e,t){if(!e.returnIdsOnly||!t.uniqueIdFields)return e;const r={...e,returnUniqueIdsOnly:!0};return delete r.returnIdsOnly,r}async function w(e,t,r,i={},a={},u={}){const l="string"==typeof e?(0,n.An)(e):e,h=t.geometry?[t.geometry]:[],f=await(0,o.el)(h,null,{signal:i.signal}),g=f?.[0];null!=g&&((t=t.clone()).geometry=g);const p=(0,c.z)({...l.query,f:r,...b(a,u),...d(t,a,u)});return(0,s.A)((0,n.fj)(l.path,(y=a,null==t.formatOf3DObjects||y.returnCountOnly||y.returnExtentOnly||y.returnIdsOnly?"query":"query3d")),{...i,responseType:"pbf"===r?"array-buffer":"json",query:{...p,...i.query}});var y}},92300:(e,t,r)=>{r.d(t,{V:()=>i,X:()=>n});var s=r(65864);function n(e){return{geometryType:(0,s.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function i(e,t,r){const n=(0,s.xD)(t);return e.map(e=>{const t=n.fromJSON(e);return t.spatialReference=r,t})}},92722:(e,t,r)=>{r.d(t,{A:()=>n});var s=r(69397);class n{constructor(e=[],t=[]){this.lengths=e??[],this.coords=t??[]}static fromJSON(e){return new n(e.lengths,e.coords)}static fromRect(e){const[t,r,s,i]=e,o=s-t,a=i-r;return new n([5],[t,r,o,0,0,a,-o,0,0,-a])}get isPoint(){return 0===this.lengths.length&&this.coords.length>=2}get maxLength(){return Math.max(...this.lengths)}get size(){return this.lengths.reduce((e,t)=>e+t)}get usedMemory(){return 64+(0,s.Qf)(this.lengths,this.coords)}area(){let e=0,t=0;if(!this.lengths.length)return 0;for(let r=0;r<this.lengths.length;r++){const s=this.lengths[r];if(s<3)continue;let n=this.coords[2*t],i=this.coords[2*t+1];for(let r=1;r<s;r+=1){const s=this.coords[2*(r+t)],o=this.coords[2*(r+t)+1];e+=-.5*(s-n)*(o+i),n=s,i=o}t+=s}return e}forEachVertex(e){let t=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r<this.lengths.length;r++){const s=this.lengths[r];for(let r=0;r<s;r++)e(this.coords[2*(r+t)],this.coords[2*(r+t)+1]);t+=s}}deltaDecode(){const e=this.clone(),{coords:t,lengths:r}=e;let s=0;for(const e of r){for(let r=1;r<e;r++)t[2*(s+r)]+=t[2*(s+r)-2],t[2*(s+r)+1]+=t[2*(s+r)-1];s+=e}return e}clone(e){if(0===this.lengths.length)return new n([],[this.coords[0],this.coords[1]]);const t=2*(0===this.lengths.length?1:this.lengths.reduce((e,t)=>e+t)),r=this.coords.slice(0,t);return e?(e.set(r),new n(this.lengths,e)):new n(Array.from(this.lengths),Array.from(r))}}}}]);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__addDisposableResource as r,__disposeResources as t}from"tslib";import{t as s}from"./Geometry.js";import{m as a,P as e}from"./Point2D.js";import"./MultiPathImpl.js";import{h as o,r as n,aa as i,O as l,ab as c,aC as m}from"./UnitFactory.js";import"./Envelope.js";function f(m,f,g,u,h,y){const N={stack:[],error:void 0,hasError:!1};try{4===u&&s("");const t=m,p=o(t),S=n();p.querySpheroidData(S);const v=S.e2,T=S.majorSemiAxis,d=p.getUnit().getUnitToBaseFactor(),j=r(N,new i,!1),x=r(N,new i,!1),w=r(N,new i,!1);if(f.isNAN()||g.isNAN())return Number.NaN;const C=a(e,2);C[0].assign(f),C[1].assign(g);const A=a(e,2),E=t.getGCS()!==t?t.getSRToGCSTransform():null;if(E){if(2!==(new l).transform(E,C,2,A))return Number.NaN}else A[0].assign(C[0]),A[1].assign(C[1]);return A[0].scale(d),A[1].scale(d),c.geodeticDistance(T,v,A[0].x,A[0].y,A[1].x,A[1].y,j,x,w,u),h[0]=x.val,y[0]=w.val,j.val}catch(p){N.error=p,N.hasError=!0}finally{t(N)}}function g(l,f,g,u,h,y){const N={stack:[],error:void 0,hasError:!1};try{4===y&&s("");const t=l,p=o(t),S=n();p.querySpheroidData(S);const v=S.e2,T=S.majorSemiAxis,d=p.getUnit().getUnitToBaseFactor(),j=r(N,new i,!1),x=r(N,new i,!1),w=t.getSRToGCSTransform(),C=t.getGCSToSRTransform(),A=a(e,100),E=a(e,100);let G=0;for(let r=0,s=0;r<g;){let t=g-r;t>A.length&&(t=A.length);for(let s=0;s<t;s++)A[s].assign(f[r+s]);if(m(w,A,t,E,null)>0){for(let r=0;r<t;r++){const t=E[r].clone();t.isNAN()?A[r].assign(t):(t.scale(d),c.geodeticCoordinate(T,v,t.x,t.y,u,h,j,x,y),t.x=j.val,t.y=x.val,t.scale(1/d),A[r].assign(t))}G+=m(C,A,t,E,null)}for(let r=0;r<t;r++)f[s+r].assign(E[r]);r+=t,s+=t}return G}catch(p){N.error=p,N.hasError=!0}finally{t(N)}}export{f as calculateDistanceAndAzimuth,g as movePointsByDistance};
|
package/config.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.
|
|
5
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.60";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
package/core/quantityUtils.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unitType as n,convertUnit as t,isBaseUnit as u,baseUnitForUnit as e}from"./unitUtils.js";function r(t,u){return{type:n(u),value:t,unit:u}}function i(n){return{value:n}}function a(t,u){return{type:n(u),value:t,unit:u}}function l(t,u){return{type:n(u),value:t,unit:u}}function o(t,u,e="arithmetic"){return{type:n(u),value:t,unit:u,rotationType:e}}function
|
|
5
|
+
import{unitType as n,convertUnit as t,isBaseUnit as u,baseUnitForUnit as e}from"./unitUtils.js";function r(t,u){return{type:n(u),value:t,unit:u}}function i(n){return{value:n}}function a(t,u){return{type:n(u),value:t,unit:u}}function l(t,u){return{type:n(u),value:t,unit:u}}function o(t,u){return{type:n(u),value:t,unit:u}}function c(t,u,e="arithmetic"){return{type:n(u),value:t,unit:u,rotationType:e}}function f(n){return u(n.unit)}function s(n,t){const u=v(n,t);return"angle"===n.type?c(u,t,n.rotationType):r(u,t)}function v(n,u){return t(n.value,n.unit,u)}function p(n){return s(n,e(n.unit))}function y(n,u){return null==n?u:null==u||n.value>t(u.value,u.unit,n.unit)?n:u}function g(n,u){return null==n?u:null==u||n.value<t(u.value,u.unit,n.unit)?n:u}function m(n,t){return null==n?null:{...n,value:n.value*t}}function h(n,t,u){if(t===u)return n;switch(u){case"arithmetic":case"geographic":return 90-n}}const d=a(0,"meters"),T=l(0,"square-meters"),U=c(0,"radians"),j=c(0,"degrees"),q=c(0,"degrees","geographic");export{h as convertRotationType,c as createAngle,l as createArea,a as createLength,r as createQuantity,i as createScalar,o as createVolume,f as isBaseUnit,y as max,g as min,m as scale,p as toBaseUnit,s as toUnit,v as valueInUnit,j as zeroDegrees,q as zeroDegreesGeographic,d as zeroMeters,U as zeroRadians,T as zeroSquareMeters};
|
package/core/unitUtils.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"./has.js";import{strict as e}from"./jsonMap.js";import{getReferenceEllipsoid as s}from"../geometry/ellipsoidUtils.js";import{earth as i,mars as n,moon as t}from"../geometry/support/Ellipsoid.js";import{isGeographic as a,isWKIDFromMars as r,isWKIDFromMoon as c,isEarth as u}from"../geometry/support/spatialReferenceUtils.js";import o from"../geometry/support/WKIDUnitConversion.js";const l=39.37,m=i.radius*Math.PI/200,f=/(?:LENGTH)?UNIT\[([^\]]+)]]$/i,d=o,U=/UNIT\[([^\]]+)]/i,B=new Set([4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104025,104026,104139,104140]),_=e()({millimeter:"millimeters",centimeter:"centimeters",meter:"meters",meter_german:"german-meters",kilometer:"kilometers",decimeter:"decimeters",micrometer:"micrometers",nanometer:"nanometers","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",fathom:"fathoms",nautical_mile:"nautical-miles",chain_us:"us-chains",link_us:"us-links",mile_us:"us-miles",yard_clarke:"clarke-yards",chain_clarke:"clarke-chains",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",link_sears:"sears-links",yard_benoit_1895_a:"benoit-1895-a-yards",foot_benoit_1895_a:"benoit-1895-a-feet",chain_benoit_1895_a:"benoit-1895-a-chains",link_benoit_1895_a:"benoit-1895-a-links",yard_benoit_1895_b:"benoit-1895-b-yards",foot_benoit_1895_b:"benoit-1895-b-feet",chain_benoit_1895_b:"benoit-1895-b-chains",link_benoit_1895_b:"benoit-1895-b-links",foot_1865:"1865-feet",foot_indian:"indian-feet",foot_indian_1937:"indian-1937-feet",foot_indian_1962:"indian-1962-feet",foot_indian_1975:"indian-1975-feet",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",yard_indian_1962:"indian-1962-yards",yard_indian_1975:"indian-1975-yards",statute_mile:"statute-miles",foot_gold_coast:"gold-coast-feet",foot_british_1936:"british-1936-feet",yard:"yards",chain:"chains",link:"links",yard_sears_1922_truncated:"sears-1922-truncated-yards",foot_sears_1922_truncated:"sears-1922-truncated-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains",link_sears_1922_truncated:"sears-1922-truncated-links",yard_us:"us-yards",inch:"inches",inch_us:"us-inches",rod:"rods",rod_us:"us-rods",nautical_mile_us:"us-nautical-miles",nautical_mile_uk:"uk-nautical-miles",smoot:"smoots",vara_tx:"tx-vara",point:"points"}),h=e=>e*e,b=e=>e*e*e,k={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},meters:{inBaseUnits:1},feet:{inBaseUnits:.3048},"us-feet":{inBaseUnits:.3048006096012192},"clarke-feet":{inBaseUnits:.3047972654},fathoms:{inBaseUnits:1.8288},"nautical-miles":{inBaseUnits:1852},"german-meters":{inBaseUnits:1.0000135965},"us-chains":{inBaseUnits:20.11684023368047},"us-links":{inBaseUnits:.2011684023368047},"us-miles":{inBaseUnits:1609.347218694438},kilometers:{inBaseUnits:1e3},"clarke-yards":{inBaseUnits:.9143917962},"clarke-chains":{inBaseUnits:20.1166195164},"clarke-links":{inBaseUnits:.201166195164},"sears-yards":{inBaseUnits:.9143984146160287},"sears-feet":{inBaseUnits:.3047994715386762},"sears-chains":{inBaseUnits:20.11676512155263},"sears-links":{inBaseUnits:.2011676512155263},"benoit-1895-a-yards":{inBaseUnits:.9143992},"benoit-1895-a-feet":{inBaseUnits:.3047997333333333},"benoit-1895-a-chains":{inBaseUnits:20.1167824},"benoit-1895-a-links":{inBaseUnits:.201167824},"benoit-1895-b-yards":{inBaseUnits:.9143992042898124},"benoit-1895-b-feet":{inBaseUnits:.3047997347632708},"benoit-1895-b-chains":{inBaseUnits:20.11678249437587},"benoit-1895-b-links":{inBaseUnits:.2011678249437587},"1865-feet":{inBaseUnits:.3048008333333334},"indian-feet":{inBaseUnits:.3047995102481469},"indian-1937-feet":{inBaseUnits:.30479841},"indian-1962-feet":{inBaseUnits:.3047996},"indian-1975-feet":{inBaseUnits:.3047995},"indian-yards":{inBaseUnits:.9143985307444408},"indian-1937-yards":{inBaseUnits:.91439523},"indian-1962-yards":{inBaseUnits:.9143988},"indian-1975-yards":{inBaseUnits:.9143985},miles:{inBaseUnits:1609.344},"statute-miles":{inBaseUnits:1609.344},"gold-coast-feet":{inBaseUnits:.3047997101815088},"british-1936-feet":{inBaseUnits:.3048007491},yards:{inBaseUnits:.9144},chains:{inBaseUnits:20.1168},links:{inBaseUnits:.201168},"sears-1922-truncated-yards":{inBaseUnits:.914398},"sears-1922-truncated-feet":{inBaseUnits:.3047993333333334},"sears-1922-truncated-chains":{inBaseUnits:20.116756},"sears-1922-truncated-links":{inBaseUnits:.20116756},"us-yards":{inBaseUnits:.9144018288036576},decimeters:{inBaseUnits:.1},inches:{inBaseUnits:.0254},"us-inches":{inBaseUnits:.0254000508001016},rods:{inBaseUnits:5.0292},"us-rods":{inBaseUnits:5.029210058420118},"us-nautical-miles":{inBaseUnits:1853.248},"uk-nautical-miles":{inBaseUnits:1853.184},smoots:{inBaseUnits:1.7018},"tx-vara":{inBaseUnits:.8466683600033867},points:{inBaseUnits:.0003527777777777778},micrometers:{inBaseUnits:1e-6},nanometers:{inBaseUnits:1e-9},"50-kilometers":{inBaseUnits:5e4},"150-kilometers":{inBaseUnits:15e4}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:h(.001)},"square-centimeters":{inBaseUnits:h(.01)},"square-decimeters":{inBaseUnits:h(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:h(1e3)},"square-inches":{inBaseUnits:h(.0254)},"square-feet":{inBaseUnits:h(.3048)},"square-yards":{inBaseUnits:h(.9144)},"square-miles":{inBaseUnits:h(1609.344)},"square-nautical-miles":{inBaseUnits:h(1852)},"square-us-feet":{inBaseUnits:h(1200/3937)},acres:{inBaseUnits:.0015625*h(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*b(.001)},"cubic-centimeters":{inBaseUnits:1e3*b(.01)},"cubic-decimeters":{inBaseUnits:1e3*b(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*b(1e3)},"cubic-inches":{inBaseUnits:1e3*b(.0254)},"cubic-feet":{inBaseUnits:1e3*b(.3048)},"cubic-yards":{inBaseUnits:1e3*b(.9144)},"cubic-miles":{inBaseUnits:1e3*b(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},y=(()=>{const e={};for(const s in k)for(const i in k[s].units)e[i]=s;return e})();function q(e,s,i){return e*k[i].units[s].inBaseUnits}function p(e,s,i){return e/k[i].units[s].inBaseUnits}const g=["inches","feet","yards","miles","nautical-miles","us-feet","millimeters","centimeters","decimeters","meters","kilometers"],w=["square-inches","square-feet","square-yards","square-miles","square-nautical-miles","square-us-feet","square-millimeters","square-centimeters","square-decimeters","square-meters","square-kilometers","acres","ares","hectares"],M=["metric","imperial"],S=[...M,...w],D=[...M,...g],v=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function C(e){return"imperial"===e||"metric"===e}function P(e){const s=y[e];if(!s)throw new Error("unknown type");return s}function x(e){return k[e].baseUnit}function E(e){return x(P(e))}function I(e,s=null){return s=s||P(e),k[s].baseUnit===e}function j(e,s,i){if(s===i)return e;const n=P(s);if(n!==P(i))throw new Error("incompatible units");const t=I(s,n)?e:q(e,s,n);return I(i,n)?t:p(t,i,n)}function R(e,s,i,n=!1){if(!n&&a(s))throw new Error("Unable to convert from an angular unit to a linear unit.");const t=te(s);return t!==i&&(e=t?j(e,t,i):j(e*=Z(s),"meters",i)),e}function N(e,s,i,n=!1){if(!n&&a(i))throw new Error("Unable to convert from a linear unit to an angular unit.");const t=te(i);return s!==t&&(e=t?j(e,s,t):j(e,s,"meters")/Z(i)),e}function O(e){switch(e){case"metric":return"meters";case"imperial":return"feet";default:return e}}function F(e){return O(e)}function J(e){switch(e){case"metric":return"square-meters";case"imperial":return"square-feet";default:return e}}function T(e,s,i){switch(i){case"metric":return A(e,s);case"imperial":return H(e,s);default:return i}}function K(e,s,i){switch(i){case"metric":return G(e,s);case"imperial":return L(e,s);default:return i}}function A(e,s){const i=j(e,s,"meters");return Math.abs(i)<3e3?"meters":"kilometers"}function G(e,s){const i=j(e,s,"meters");return Math.abs(i)<1e5?"meters":"kilometers"}function H(e,s){const i=j(e,s,"feet");return Math.abs(i)<1e3?"feet":"miles"}function L(e,s){const i=j(e,s,"feet");return Math.abs(i)<1e5?"feet":"miles"}function Y(e,s){const i=j(e,s,"square-meters");return Math.abs(i)<3e6?"square-meters":"square-kilometers"}function W(e,s){const i=j(e,s,"square-feet");return Math.abs(i)<1e6?"square-feet":"square-miles"}function $(e,s,i){switch(i){case"metric":return Y(e,s);case"imperial":return W(e,s);default:return i}}function z(e,s,i){return j(e,s,"meters")/(i*Math.PI/180)}function Q(e){return _.fromJSON(e.toLowerCase())||null}function V(e){if(null!=e&&!u(e))return 1;const s=Z(e);return s>1e5?1:s}function X(e){return Z(e)>=s(e).metersPerDegree?"meters":te(e)}function Z(e,s=i.metersPerDegree){return ee(e,!0)??s}function ee(e,s=!1){const i=e?.wkid??null,a=e?.wkt2??e?.wkt??null;let u=null;if(i){if(r(i))return n.metersPerDegree;if(c(i))return t.metersPerDegree;u=d.values[d[i]],!u&&s&&B.has(i)&&(u=m)}else a&&(oe(a)?u=ie(f.exec(a),u):ue(a)&&(u=ie(U.exec(a),u)));return u}function se(e){return a(e)?1:Z(e)}function ie(e,s){return e?.[1]?ne(e[1]):s}function ne(e){return parseFloat(e.split(",")[1])}function te(e){const s=e?.wkid??null,i=e?.wkt2??e?.wkt??null;let n=null;if(s)n=d.units[d[s]];else if(i){const e=oe(i)?f:ue(i)?U:null;if(e){const s=e.exec(i);s?.[1]&&(n=me(s[1]))}}return null!=n?Q(n):null}function ae(e){const s=te(e);return null!=s&&D.includes(s)?s:null}function re(e){const s=X(e);return null!=s&&D.includes(s)?s:null}function ce(e){const s=te(e);return null==s?null:v.get(s)}function ue(e){return/^GEOCCS/i.test(e)}function oe(e){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(e)}const le=1e-7;function me(e){const s=/[\\"']([^\\"']+)/.exec(e);let i=s?.[1];if(!i||!Q(i)){const s=ne(e);i=null;const n=d.values;for(let e=0;e<n.length;++e)if(Math.abs(s-n[e])<le){i=d.units[e];break}}return i}function fe(e){const s=te(e);if(null==s)return null;switch(s){case"feet":case"us-feet":case"clarke-feet":case"fathoms":case"nautical-miles":case"us-chains":case"us-links":case"us-miles":case"clarke-yards":case"clarke-chains":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"sears-links":case"benoit-1895-a-yards":case"benoit-1895-a-feet":case"benoit-1895-a-chains":case"benoit-1895-a-links":case"benoit-1895-b-yards":case"benoit-1895-b-feet":case"benoit-1895-b-chains":case"benoit-1895-b-links":case"1865-feet":case"indian-feet":case"indian-1937-feet":case"indian-1962-feet":case"indian-1975-feet":case"indian-yards":case"indian-1937-yards":case"indian-1962-yards":case"indian-1975-yards":case"statute-miles":case"gold-coast-feet":case"british-1936-feet":case"yards":case"chains":case"links":case"sears-1922-truncated-yards":case"sears-1922-truncated-feet":case"sears-1922-truncated-chains":case"sears-1922-truncated-links":case"us-yards":case"inches":case"us-inches":case"rods":case"us-rods":case"us-nautical-miles":case"uk-nautical-miles":case"smoots":case"tx-vara":case"points":return"imperial";case"millimeters":case"centimeters":case"meters":case"german-meters":case"kilometers":case"decimeters":case"micrometers":case"nanometers":case"50-kilometers":case"150-kilometers":return"metric"}return null}const de={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},Ue={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},Be={esriDUDecimalDegrees:"degrees",esriDURadians:"radians"},_e=e()(de),he=e()(Ue),be=e()(Be);export{$ as adaptiveAreaUnit,W as adaptiveImperialAreaUnit,H as adaptiveImperialLengthUnit,L as adaptiveImperialVerticalLengthUnit,T as adaptiveLengthUnit,Y as adaptiveMetricAreaUnit,A as adaptiveMetricLengthUnit,G as adaptiveMetricVerticalLengthUnit,K as adaptiveVerticalLengthUnit,be as angleUnitsJSONMap,ce as areaUnitFromSpatialReference,_e as areaUnitsJSONMap,E as baseUnitForUnit,x as baseUnitForUnitType,R as convertFromSpatialReferenceUnit,N as convertToSpatialReferenceUnit,j as convertUnit,J as defaultAreaUnit,O as defaultLengthUnit,F as defaultVerticalLengthUnit,fe as getDefaultUnitSystem,se as getMetersPerCartesianUnitForSR,ee as getMetersPerUnit,Z as getMetersPerUnitForSR,V as getMetersPerVerticalUnitForSR,te as getUnitString,X as getVerticalUnitStringForSR,B as gradGcsIds,l as inchesPerMeter,I as isBaseUnit,C as isMeasurementSystem,oe as isProjectedWKT,z as lengthToDegrees,ae as lengthUnitFromSpatialReference,he as lengthUnitsJSONMap,S as measurementAreaUnits,D as measurementLengthUnits,Q as unitFromRESTJSON,P as unitType,re as verticalLengthUnitFromSpatialReference};
|
|
5
|
+
import"./has.js";import{strict as e}from"./jsonMap.js";import{getReferenceEllipsoid as s}from"../geometry/ellipsoidUtils.js";import{earth as i,mars as n,moon as t}from"../geometry/support/Ellipsoid.js";import{isGeographic as a,isWKIDFromMars as r,isWKIDFromMoon as c,isEarth as u}from"../geometry/support/spatialReferenceUtils.js";import l from"../geometry/support/WKIDUnitConversion.js";const o=39.37,m=i.radius*Math.PI/200,f=/(?:LENGTH)?UNIT\[([^\]]+)]]$/i,d=l,U=/UNIT\[([^\]]+)]/i,b=new Set([4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104025,104026,104139,104140]),B=e()({millimeter:"millimeters",centimeter:"centimeters",meter:"meters",meter_german:"german-meters",kilometer:"kilometers",decimeter:"decimeters",micrometer:"micrometers",nanometer:"nanometers","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",fathom:"fathoms",nautical_mile:"nautical-miles",chain_us:"us-chains",link_us:"us-links",mile_us:"us-miles",yard_clarke:"clarke-yards",chain_clarke:"clarke-chains",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",link_sears:"sears-links",yard_benoit_1895_a:"benoit-1895-a-yards",foot_benoit_1895_a:"benoit-1895-a-feet",chain_benoit_1895_a:"benoit-1895-a-chains",link_benoit_1895_a:"benoit-1895-a-links",yard_benoit_1895_b:"benoit-1895-b-yards",foot_benoit_1895_b:"benoit-1895-b-feet",chain_benoit_1895_b:"benoit-1895-b-chains",link_benoit_1895_b:"benoit-1895-b-links",foot_1865:"1865-feet",foot_indian:"indian-feet",foot_indian_1937:"indian-1937-feet",foot_indian_1962:"indian-1962-feet",foot_indian_1975:"indian-1975-feet",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",yard_indian_1962:"indian-1962-yards",yard_indian_1975:"indian-1975-yards",statute_mile:"statute-miles",foot_gold_coast:"gold-coast-feet",foot_british_1936:"british-1936-feet",yard:"yards",chain:"chains",link:"links",yard_sears_1922_truncated:"sears-1922-truncated-yards",foot_sears_1922_truncated:"sears-1922-truncated-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains",link_sears_1922_truncated:"sears-1922-truncated-links",yard_us:"us-yards",inch:"inches",inch_us:"us-inches",rod:"rods",rod_us:"us-rods",nautical_mile_us:"us-nautical-miles",nautical_mile_uk:"uk-nautical-miles",smoot:"smoots",vara_tx:"tx-vara",point:"points"}),h=e=>e*e,_=e=>e*e*e,k={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},meters:{inBaseUnits:1},feet:{inBaseUnits:.3048},"us-feet":{inBaseUnits:.3048006096012192},"clarke-feet":{inBaseUnits:.3047972654},fathoms:{inBaseUnits:1.8288},"nautical-miles":{inBaseUnits:1852},"german-meters":{inBaseUnits:1.0000135965},"us-chains":{inBaseUnits:20.11684023368047},"us-links":{inBaseUnits:.2011684023368047},"us-miles":{inBaseUnits:1609.347218694438},kilometers:{inBaseUnits:1e3},"clarke-yards":{inBaseUnits:.9143917962},"clarke-chains":{inBaseUnits:20.1166195164},"clarke-links":{inBaseUnits:.201166195164},"sears-yards":{inBaseUnits:.9143984146160287},"sears-feet":{inBaseUnits:.3047994715386762},"sears-chains":{inBaseUnits:20.11676512155263},"sears-links":{inBaseUnits:.2011676512155263},"benoit-1895-a-yards":{inBaseUnits:.9143992},"benoit-1895-a-feet":{inBaseUnits:.3047997333333333},"benoit-1895-a-chains":{inBaseUnits:20.1167824},"benoit-1895-a-links":{inBaseUnits:.201167824},"benoit-1895-b-yards":{inBaseUnits:.9143992042898124},"benoit-1895-b-feet":{inBaseUnits:.3047997347632708},"benoit-1895-b-chains":{inBaseUnits:20.11678249437587},"benoit-1895-b-links":{inBaseUnits:.2011678249437587},"1865-feet":{inBaseUnits:.3048008333333334},"indian-feet":{inBaseUnits:.3047995102481469},"indian-1937-feet":{inBaseUnits:.30479841},"indian-1962-feet":{inBaseUnits:.3047996},"indian-1975-feet":{inBaseUnits:.3047995},"indian-yards":{inBaseUnits:.9143985307444408},"indian-1937-yards":{inBaseUnits:.91439523},"indian-1962-yards":{inBaseUnits:.9143988},"indian-1975-yards":{inBaseUnits:.9143985},miles:{inBaseUnits:1609.344},"statute-miles":{inBaseUnits:1609.344},"gold-coast-feet":{inBaseUnits:.3047997101815088},"british-1936-feet":{inBaseUnits:.3048007491},yards:{inBaseUnits:.9144},chains:{inBaseUnits:20.1168},links:{inBaseUnits:.201168},"sears-1922-truncated-yards":{inBaseUnits:.914398},"sears-1922-truncated-feet":{inBaseUnits:.3047993333333334},"sears-1922-truncated-chains":{inBaseUnits:20.116756},"sears-1922-truncated-links":{inBaseUnits:.20116756},"us-yards":{inBaseUnits:.9144018288036576},decimeters:{inBaseUnits:.1},inches:{inBaseUnits:.0254},"us-inches":{inBaseUnits:.0254000508001016},rods:{inBaseUnits:5.0292},"us-rods":{inBaseUnits:5.029210058420118},"us-nautical-miles":{inBaseUnits:1853.248},"uk-nautical-miles":{inBaseUnits:1853.184},smoots:{inBaseUnits:1.7018},"tx-vara":{inBaseUnits:.8466683600033867},points:{inBaseUnits:.0003527777777777778},micrometers:{inBaseUnits:1e-6},nanometers:{inBaseUnits:1e-9},"50-kilometers":{inBaseUnits:5e4},"150-kilometers":{inBaseUnits:15e4}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:h(.001)},"square-centimeters":{inBaseUnits:h(.01)},"square-decimeters":{inBaseUnits:h(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:h(1e3)},"square-inches":{inBaseUnits:h(.0254)},"square-feet":{inBaseUnits:h(.3048)},"square-yards":{inBaseUnits:h(.9144)},"square-miles":{inBaseUnits:h(1609.344)},"square-nautical-miles":{inBaseUnits:h(1852)},"square-us-feet":{inBaseUnits:h(1200/3937)},acres:{inBaseUnits:.0015625*h(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*_(.001)},"cubic-centimeters":{inBaseUnits:1e3*_(.01)},"cubic-decimeters":{inBaseUnits:1e3*_(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*_(1e3)},"cubic-inches":{inBaseUnits:1e3*_(.0254)},"cubic-feet":{inBaseUnits:1e3*_(.3048)},"cubic-yards":{inBaseUnits:1e3*_(.9144)},"cubic-miles":{inBaseUnits:1e3*_(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},y=(()=>{const e={};for(const s in k)for(const i in k[s].units)e[i]=s;return e})();function q(e,s,i){return e*k[i].units[s].inBaseUnits}function p(e,s,i){return e/k[i].units[s].inBaseUnits}const w=["inches","feet","yards","miles","nautical-miles","us-feet","millimeters","centimeters","decimeters","meters","kilometers"],g=["square-inches","square-feet","square-yards","square-miles","square-nautical-miles","square-us-feet","square-millimeters","square-centimeters","square-decimeters","square-meters","square-kilometers","acres","ares","hectares"],M=["cubic-inches","cubic-feet","cubic-yards","cubic-miles","liters","cubic-millimeters","cubic-centimeters","cubic-decimeters","cubic-meters","cubic-kilometers"],S=["metric","imperial"],D=[...S,...g],v=[...S,...w],C=[...S,...M],P=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function x(e){return"imperial"===e||"metric"===e}function E(e){const s=y[e];if(!s)throw new Error("unknown type");return s}function I(e){return k[e].baseUnit}function j(e){return I(E(e))}function R(e,s=null){return s=s||E(e),k[s].baseUnit===e}function N(e,s,i){if(s===i)return e;const n=E(s);if(n!==E(i))throw new Error("incompatible units");const t=R(s,n)?e:q(e,s,n);return R(i,n)?t:p(t,i,n)}function O(e,s,i,n=!1){if(!n&&a(s))throw new Error("Unable to convert from an angular unit to a linear unit.");const t=oe(s);return t!==i&&(e=t?N(e,t,i):N(e*=ae(s),"meters",i)),e}function F(e,s,i,n=!1){if(!n&&a(i))throw new Error("Unable to convert from a linear unit to an angular unit.");const t=oe(i);return s!==t&&(e=t?N(e,s,t):N(e,s,"meters")/ae(i)),e}function J(e){switch(e){case"metric":return"meters";case"imperial":return"feet";default:return e}}function T(e){return J(e)}function K(e){switch(e){case"metric":return"square-meters";case"imperial":return"square-feet";default:return e}}function A(e){switch(e){case"metric":return"cubic-meters";case"imperial":return"cubic-feet";default:return e}}function G(e,s,i){switch(i){case"metric":return L(e,s);case"imperial":return W(e,s);default:return i}}function H(e,s,i){switch(i){case"metric":return Y(e,s);case"imperial":return $(e,s);default:return i}}function L(e,s){const i=N(e,s,"meters");return Math.abs(i)<3e3?"meters":"kilometers"}function Y(e,s){const i=N(e,s,"meters");return Math.abs(i)<1e5?"meters":"kilometers"}function W(e,s){const i=N(e,s,"feet");return Math.abs(i)<1e3?"feet":"miles"}function $(e,s){const i=N(e,s,"feet");return Math.abs(i)<1e5?"feet":"miles"}function z(e,s){const i=N(e,s,"square-meters");return Math.abs(i)<3e6?"square-meters":"square-kilometers"}function Q(e,s){const i=N(e,s,"square-feet");return Math.abs(i)<1e6?"square-feet":"square-miles"}function V(e,s,i){switch(i){case"metric":return z(e,s);case"imperial":return Q(e,s);default:return i}}function X(e,s){const i=N(e,s,"cubic-meters");return Math.abs(i)<3e9?"cubic-meters":"cubic-kilometers"}function Z(e,s){const i=N(e,s,"cubic-feet");return Math.abs(i)<1e9?"cubic-feet":"cubic-miles"}function ee(e,s,i){switch(i){case"metric":return X(e,s);case"imperial":return Z(e,s);default:return i}}function se(e,s,i){return N(e,s,"meters")/(i*Math.PI/180)}function ie(e){return B.fromJSON(e.toLowerCase())||null}function ne(e){if(null!=e&&!u(e))return 1;const s=ae(e);return s>1e5?1:s}function te(e){return ae(e)>=s(e).metersPerDegree?"meters":oe(e)}function ae(e,s=i.metersPerDegree){return re(e,!0)??s}function re(e,s=!1){const i=e?.wkid??null,a=e?.wkt2??e?.wkt??null;let u=null;if(i){if(r(i))return n.metersPerDegree;if(c(i))return t.metersPerDegree;u=d.values[d[i]],!u&&s&&b.has(i)&&(u=m)}else a&&(be(a)?u=ue(f.exec(a),u):Ue(a)&&(u=ue(U.exec(a),u)));return u}function ce(e){return a(e)?1:ae(e)}function ue(e,s){return e?.[1]?le(e[1]):s}function le(e){return parseFloat(e.split(",")[1])}function oe(e){const s=e?.wkid??null,i=e?.wkt2??e?.wkt??null;let n=null;if(s)n=d.units[d[s]];else if(i){const e=be(i)?f:Ue(i)?U:null;if(e){const s=e.exec(i);s?.[1]&&(n=he(s[1]))}}return null!=n?ie(n):null}function me(e){const s=oe(e);return null!=s&&v.includes(s)?s:null}function fe(e){const s=te(e);return null!=s&&v.includes(s)?s:null}function de(e){const s=oe(e);return null==s?null:P.get(s)}function Ue(e){return/^GEOCCS/i.test(e)}function be(e){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(e)}const Be=1e-7;function he(e){const s=/[\\"']([^\\"']+)/.exec(e);let i=s?.[1];if(!i||!ie(i)){const s=le(e);i=null;const n=d.values;for(let e=0;e<n.length;++e)if(Math.abs(s-n[e])<Be){i=d.units[e];break}}return i}function _e(e){const s=oe(e);if(null==s)return null;switch(s){case"feet":case"us-feet":case"clarke-feet":case"fathoms":case"nautical-miles":case"us-chains":case"us-links":case"us-miles":case"clarke-yards":case"clarke-chains":case"clarke-links":case"sears-yards":case"sears-feet":case"sears-chains":case"sears-links":case"benoit-1895-a-yards":case"benoit-1895-a-feet":case"benoit-1895-a-chains":case"benoit-1895-a-links":case"benoit-1895-b-yards":case"benoit-1895-b-feet":case"benoit-1895-b-chains":case"benoit-1895-b-links":case"1865-feet":case"indian-feet":case"indian-1937-feet":case"indian-1962-feet":case"indian-1975-feet":case"indian-yards":case"indian-1937-yards":case"indian-1962-yards":case"indian-1975-yards":case"statute-miles":case"gold-coast-feet":case"british-1936-feet":case"yards":case"chains":case"links":case"sears-1922-truncated-yards":case"sears-1922-truncated-feet":case"sears-1922-truncated-chains":case"sears-1922-truncated-links":case"us-yards":case"inches":case"us-inches":case"rods":case"us-rods":case"us-nautical-miles":case"uk-nautical-miles":case"smoots":case"tx-vara":case"points":return"imperial";case"millimeters":case"centimeters":case"meters":case"german-meters":case"kilometers":case"decimeters":case"micrometers":case"nanometers":case"50-kilometers":case"150-kilometers":return"metric"}return null}const ke={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},ye={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},qe={esriDUDecimalDegrees:"degrees",esriDURadians:"radians"},pe=e()(ke),we=e()(ye),ge=e()(qe);export{V as adaptiveAreaUnit,Q as adaptiveImperialAreaUnit,W as adaptiveImperialLengthUnit,$ as adaptiveImperialVerticalLengthUnit,Z as adaptiveImperialVolumeUnit,G as adaptiveLengthUnit,z as adaptiveMetricAreaUnit,L as adaptiveMetricLengthUnit,Y as adaptiveMetricVerticalLengthUnit,X as adaptiveMetricVolumeUnit,H as adaptiveVerticalLengthUnit,ee as adaptiveVolumeUnit,ge as angleUnitsJSONMap,de as areaUnitFromSpatialReference,pe as areaUnitsJSONMap,j as baseUnitForUnit,I as baseUnitForUnitType,O as convertFromSpatialReferenceUnit,F as convertToSpatialReferenceUnit,N as convertUnit,K as defaultAreaUnit,J as defaultLengthUnit,T as defaultVerticalLengthUnit,A as defaultVolumeUnit,_e as getDefaultUnitSystem,ce as getMetersPerCartesianUnitForSR,re as getMetersPerUnit,ae as getMetersPerUnitForSR,ne as getMetersPerVerticalUnitForSR,oe as getUnitString,te as getVerticalUnitStringForSR,b as gradGcsIds,o as inchesPerMeter,R as isBaseUnit,x as isMeasurementSystem,be as isProjectedWKT,se as lengthToDegrees,me as lengthUnitFromSpatialReference,we as lengthUnitsJSONMap,D as measurementAreaUnits,v as measurementLengthUnits,C as measurementVolumeUnits,ie as unitFromRESTJSON,E as unitType,fe as verticalLengthUnitFromSpatialReference};
|
package/core/units.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export type Unit = __esri.units.Unit;
|
|
|
9
9
|
export type MeasurementSystem = __esri.units.MeasurementSystem;
|
|
10
10
|
export type SystemOrAreaUnit = __esri.units.SystemOrAreaUnit;
|
|
11
11
|
export type SystemOrLengthUnit = __esri.units.SystemOrLengthUnit;
|
|
12
|
+
export type SystemOrVolumeUnit = __esri.units.SystemOrVolumeUnit;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{convertUnit as e}from"../../core/unitUtils.js";import t from"../Point.js";import{load as r,isLoaded as i,calculateDistanceAndAzimuth as n,movePointsByDistance as o}from"./gx/geodeticUtils.js";import{geodeticCurveType as s}from"./support/geodeticCurveType.js";let a,c,u;function m(){return!!a&&i()}async function p(){if(!m()){const[e]=await Promise.all([import("./support/apiConverter.js"),r()]);a=e.fromPoint,c=e.fromSpatialReference,u=e.getSpatialReference}}function f(t,r,i={}){const{curveType:o="geodesic",unit:m}=i,p=u(t),f=[0],l=[0];let g=n(c(p),a(t).getXY(),a(r).getXY(),s[o],f,l);g&&m&&(g=e(g,"meters",m));const y=t=>d(e(t,"radians","degrees"));return{distance:g,azimuth12:y(f[0]),azimuth21:y(l[0])}}function l(r,i,n,m={}){const{curveType:p="geodesic",unit:f}=m;f&&(i=e(i,f,"meters"));const l=u(r),d=[a(r).getXY()];o(c(l),d,1,i,e(n,"degrees","radians"),s[p]);const g=d[0];return g.isNAN()?null:new t({x:g.x,y:g.y,spatialReference:l})}function d(e){return e<0?e+360:e}export{f as calculateDistanceAndAzimuth,m as isLoaded,p as load,l as pointFromDistance,d as shiftDegreesTo360};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{l as t,i as n,p as e}from"../../../chunks/pe.js";let i,c;function s(){return!!i&&n()}async function o(){if(!s()){const[n]=await Promise.all([import("../../../chunks/SpatialReference.js").then(({injectPe:t})=>t),import("../../../chunks/GeodeticUtils.js").then(({calculateDistanceAndAzimuth:t,movePointsByDistance:n})=>{i=t,c=n}),t()]);n(e)}}function a(t,n,e,c,s,o){return i(t,n,e,c,s,o)}function r(t,n,e,i,s,o){return c(t,n,e,i,s,o)}export{a as calculateDistanceAndAzimuth,s as isLoaded,o as load,r as movePointsByDistance};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isCSVGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isCSVGraphicOriginSymbol as i}from"./isCSVGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as s}from"./isPopupProviderGraphicOrigin.js";var t,p;class o extends r{static{t=i,p=s}constructor(r){super(),this[t]=!0,this[p]=!0,this.type="csv",this.layer=r}get popupProvider(){return this.layer}}export{o 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isCatalogGraphicOriginSymbol as i}from"./isCatalogGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";var s,o;class a extends r{static{s=i,o=t}constructor(r){super(),this[s]=!0,this[o]=!0,this.type="catalog",this.layer=r}get popupProvider(){return this.layer}}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isFeatureGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isFeatureGraphicOriginSymbol as i}from"./isFeatureGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";var s,e;class p extends r{static{s=i,e=t}constructor(r){super(),this[s]=!0,this[e]=!0,this.type="feature",this.layer=r}get popupProvider(){return this.layer}}export{p 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isGeoJSONGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isGeoJSONGraphicOriginSymbol as i}from"./isGeoJSONGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as s}from"./isPopupProviderGraphicOrigin.js";var t,o;class e extends r{static{t=i,o=s}constructor(r){super(),this[t]=!0,this[o]=!0,this.type="geojson",this.layer=r}get popupProvider(){return this.layer}}export{e 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isKnowledgeGraphGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isKnowledgeGraphGraphicOriginSymbol as i}from"./isKnowledgeGraphGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as s}from"./isPopupProviderGraphicOrigin.js";var t,e;class p extends r{static{t=i,e=s}constructor(r,i){super(),this[t]=!0,this[e]=!0,this.type="knowledge-graph",this.layer=r,this.sublayer=i}get popupProvider(){return this.sublayer}}export{p 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isOGCFeatureGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isOGCFeatureGraphicOriginSymbol as i}from"./isOGCFeatureGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";var s,e;class o extends r{static{s=i,e=t}constructor(r){super(),this[s]=!0,this[e]=!0,this.type="ogc-feature",this.layer=r}get popupProvider(){return this.layer}}export{o 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isOrientedImageryGraphicOriginSymbol as i}from"./isOrientedImageryGraphicOrigin.js";
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isOrientedImageryGraphicOriginSymbol as i}from"./isOrientedImageryGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";var e,s;class o extends r{static{e=i,s=t}constructor(r){super(),this[e]=!0,this[s]=!0,this.type="oriented-imagery",this.layer=r}get popupProvider(){return this.layer}}export{o 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isParquetGraphicOriginSymbol as
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isParquetGraphicOriginSymbol as i}from"./isParquetGraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";var s,p;class e extends r{static{s=i,p=t}constructor(r){super(),this[s]=!0,this[p]=!0,this.type="parquet",this.layer=r}get popupProvider(){return this.layer}}export{e 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isStreamGraphicOriginSymbol as t}from"./isStreamGraphicOrigin.js";var s;class
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as i}from"./isPopupProviderGraphicOrigin.js";import{isStreamGraphicOriginSymbol as t}from"./isStreamGraphicOrigin.js";var s,e;class p extends r{static{s=t,e=i}constructor(r){super(),this[s]=!0,this[e]=!0,this.type="stream",this.layer=r}get popupProvider(){return this.layer}}export{p 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as t}from"./isPopupProviderGraphicOrigin.js";import{isSubtypeGroupGraphicOriginSymbol as i}from"./isSubtypeGroupGraphicOrigin.js";var s,e;class p extends r{static{s=i,e=t}constructor(r){super(),this[s]=!0,this[e]=!0,this.type="subtype-group",this.sublayer=r}get layer(){return this.sublayer.parent}get popupProvider(){return this.sublayer}}export{p 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"./GraphicOrigin.js";import{isWFSGraphicOriginSymbol as s}from"./isWFSGraphicOrigin.js";var
|
|
5
|
+
import r from"./GraphicOrigin.js";import{isPopupProviderGraphicOriginSymbol as i}from"./isPopupProviderGraphicOrigin.js";import{isWFSGraphicOriginSymbol as s}from"./isWFSGraphicOrigin.js";var t,p;class o extends r{static{t=s,p=i}constructor(r){super(),this[t]=!0,this[p]=!0,this.type="wfs",this.layer=r}get popupProvider(){return this.layer}}export{o as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const i=Symbol("isPopupProviderGraphicOriginSymbol");function o(o){return!!o&&i in o}export{o as isPopupProviderGraphicOrigin,i as isPopupProviderGraphicOriginSymbol};
|