@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 13.3 kB
JavaScript
;(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6928,7136],{13069:(e,t,n)=>{n.d(t,{AG:()=>l,lk:()=>o,vD:()=>i,yS:()=>s});const r="randomUUID"in crypto;function o(){if(r)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint16Array(8));e[3]=4095&e[3]|16384,e[4]=16383&e[4]|32768;const t=t=>e[t].toString(16).padStart(4,"0");return t(0)+t(1)+"-"+t(2)+"-"+t(3)+"-"+t(4)+"-"+t(5)+t(6)+t(7)}function s(){return`{${o().toUpperCase()}}`}function i(){return`{${o()}}`}function l(e){const t=e.toUpperCase();return"{"!==e[0]?`{${t}}`:t}},17136:(e,t,n)=>{n.d(t,{O7:()=>S,el:()=>M});var r=n(92602),o=n(49186),s=n(53966),i=n(39829),l=n(82799),a=n(80754),c=n(21325),u=n(28735),f=n(78888),p=n(65864),y=n(2272),h=n(84952),m=n(92300);const g=()=>s.A.getLogger("esri.geometry.support.normalizeUtils");function d(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function A(e,t,n){if(t){const t=function(e,t){if(!(e instanceof l.A||e instanceof i.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw g().error(e),new o.A(e)}const n=(0,a.r8)(e),r=[];for(const e of n){const n=[];r.push(n),n.push([e[0][0],e[0][1]]);for(let r=0;r<e.length-1;r++){const o=e[r][0],s=e[r][1],i=e[r+1][0],l=e[r+1][1],a=Math.sqrt((i-o)*(i-o)+(l-s)*(l-s)),c=(l-s)/a,u=(i-o)/a,f=a/t;if(f>1){for(let e=1;e<=f-1;e++){const r=e*t,i=u*r+o,l=c*r+s;n.push([i,l])}const e=(a+Math.floor(f-1)*t)/2,r=u*e+o,i=c*e+s;n.push([r,i])}n.push([i,l])}}return function(e){return"polygon"===e.type}(e)?new i.A({rings:r,spatialReference:e.spatialReference}):new l.A({paths:r,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.ci)(t,!0)}return n&&(e=(0,a.kS)(e,n)),e}function w(e,t,n){if(Array.isArray(e)){const r=e[0];if(r>t){const n=(0,a.kd)(r,t);e[0]=r+n*(-2*t)}else if(r<n){const t=(0,a.kd)(r,n);e[0]=r+t*(-2*n)}}else{const r=e.x;if(r>t){const n=(0,a.kd)(r,t);e=e.clone().offset(n*(-2*t),0)}else if(r<n){const t=(0,a.kd)(r,n);e=e.clone().offset(t*(-2*n),0)}}return e}function R(e,t){let n=-1;for(let r=0;r<t.cutIndexes.length;r++){const o=t.cutIndexes[r],s=t.geometries[r],i=(0,a.r8)(s);for(let e=0;e<i.length;e++){const t=i[e];t.some((n=>{if(n[0]<180)return!0;{let n=0;for(let e=0;e<t.length;e++){const r=t[e][0];n=r>n?r:n}n=Number(n.toFixed(9));const r=-360*(0,a.kd)(n,180);for(let n=0;n<t.length;n++){const t=s.getPoint(e,n);s.setPoint(e,n,t.clone().offset(r,0))}return!0}}))}if(o===n){if(d(e))for(const t of(0,a.r8)(s))e[o]=e[o].addRing(t);else if(x(e))for(const t of(0,a.r8)(s))e[o]=e[o].addPath(t)}else n=o,e[o]=s}return e}async function M(e,t,n){if(!Array.isArray(e))return M([e],t);t&&"string"!=typeof t&&g().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const o="string"==typeof t?t:t?.url??r.A.geometryServiceUrl;let s,d,x,S,v,N,_,G,j=0;const J=[],O=[];for(const t of e)if(null!=t)if(s||(s=t.spatialReference,d=(0,c.Vp)(s),x=s.isWebMercator,N=x?102100:4326,S=a.j7[N].maxX,v=a.j7[N].minX,_=a.j7[N].plus180Line,G=a.j7[N].minus180Line),d)if("mesh"===t.type)O.push(t);else if("point"===t.type)O.push(w(t.clone(),S,v));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>w(e,S,v))),O.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,d);O.push(e.rings?new i.A(e):e)}else if(t.extent){const e=t.extent,n=(0,a.kd)(e.xmin,v)*(2*S);let r=0===n?t.clone():(0,a.kS)(t.clone(),n);e.offset(n,0);let{xmin:o,xmax:s}=e;o=Number(o.toFixed(9)),s=Number(s.toFixed(9)),e.intersects(_)&&s!==S?(j=s>j?s:j,r=A(r,x),J.push(r),O.push("cut")):e.intersects(G)&&o!==v?(j=s*(2*S)>j?s*(2*S):j,r=A(r,x,360),J.push(r),O.push("cut")):O.push(r)}else O.push(t.clone());else O.push(t);else O.push(t);let q=(0,a.kd)(j,S),z=-90;const T=q,b=new l.A;for(;q>0;){const e=360*q-180;b.addPath([[e,z],[e,-1*z]]),z*=-1,q--}if(J.length>0&&T>0){const t=R(J,await async function(e,t,n,r){const o=(0,y.Dl)(e),s=t[0].spatialReference,i={...r,responseType:"json",query:{...o.query,f:"json",sr:(0,c.YX)(s),target:JSON.stringify({geometryType:(0,p.$B)(t[0]),geometries:t}),cutter:JSON.stringify(n)}},l=await(0,f.A)(o.path+"/cut",i),{cutIndexes:a,geometries:u=[]}=l.data;return{cutIndexes:a,geometries:u.map((e=>{const t=(0,p.rS)(e);return t.spatialReference=s,t}))}}(o,J,b,n)),r=[],s=[];for(let n=0;n<O.length;n++){const o=O[n];if("cut"!==o)s.push(o);else{const o=t.shift(),i=e[n];null!=i&&"polygon"===i.type&&i.rings&&i.rings.length>1&&o.rings.length>=i.rings.length?(r.push(o),s.push("simplify")):s.push(x?(0,u.Gh)(o):o)}}if(!r.length)return s;const i=await async function(e,t,n){const r="string"==typeof e?(0,h.An)(e):e,o=t[0].spatialReference,s=(0,p.$B)(t[0]),i={...n,query:{...r.query,f:"json",sr:(0,c.YX)(o),geometries:JSON.stringify((0,m.X)(t))}},{data:l}=await(0,f.A)(r.path+"/simplify",i);return(0,m.V)(l.geometries,s,o)}(o,r,n),l=[];for(let e=0;e<s.length;e++){const t=s[e];"simplify"!==t?l.push(t):l.push(x?(0,u.Gh)(i.shift()):i.shift())}return l}const F=[];for(let e=0;e<O.length;e++){const t=O[e];if("cut"!==t)F.push(t);else{const e=J.shift();F.push(!0===x?(0,u.Gh)(e):e)}}return F}function S(e,t,n){const r=(0,c.Vp)(n);if(null==r)return e;const[o,s]=r.valid,i=2*s;let l=0,a=0;t>s?l=Math.ceil(Math.abs(t-s)/i):t<o&&(l=-Math.ceil(Math.abs(t-o)/i)),e>s?a=Math.ceil(Math.abs(e-s)/i):e<o&&(a=-Math.ceil(Math.abs(e-o)/i));let u=e+(l-a)*i;const f=u-t;return f>s?u-=i:f<o&&(u+=i),u}},80754:(e,t,n)=>{n.d(t,{j7:()=>i,kS:()=>a,kd:()=>l,r8:()=>c});var r=n(82799),o=n(16930),s=n(65864);const i={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new r.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:o.A.WebMercator}),minus180Line:new r.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:o.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new r.A({paths:[[[180,-180],[180,180]]],spatialReference:o.A.WGS84}),minus180Line:new r.A({paths:[[[-180,-180],[-180,180]]],spatialReference:o.A.WGS84})}};function l(e,t){return Math.ceil((e-t)/(2*t))}function a(e,t){const n=c(e);for(const e of n)for(const n of e)n[0]+=t;return e}function c(e){return(0,s.Bi)(e)?e.rings:e.paths}},92300:(e,t,n)=>{n.d(t,{V:()=>s,X:()=>o});var r=n(65864);function o(e){return{geometryType:(0,r.$B)(e[0]),geometries:e.map((e=>e.toJSON()))}}function s(e,t,n){const o=(0,r.xD)(t);return e.map((e=>{const t=o.fromJSON(e);return t.spatialReference=n,t}))}},22671:(e,t,n)=>{n.d(t,{A:()=>A});var r,o=n(90237),s=n(52106),i=n(66552),l=n(25482),a=n(4718),c=n(10107),u=(n(44208),n(53966),n(36005)),f=n(40608),p=n(43937),y=n(16930),h=n(65864),m=n(50498),g=n(20437);const d=new i.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let x=r=class extends l.A{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,s.A)}writeGeometryType(e,t,n,r){if(e)return void d.write(e,t,n,r);const{features:o}=this;if(o)for(const e of o)if(null!=e?.geometry)return void d.write(e.geometry.type,t,n,r)}readQueryGeometry(e,t){if(!e)return null;const n=!!e.spatialReference,r=(0,h.rS)(e);return r&&!n&&t.spatialReference&&(r.spatialReference=y.A.fromJSON(t.spatialReference)),r}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:n}=this;if(n)for(const e of n)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new r(this.cloneProperties())}cloneProperties(){return(0,a.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let n=0;n<t.features.length;n++){const r=t.features[n];if(r.geometry){const t=e?.[n];r.geometry=t?.toJSON()||r.geometry}}return t}quantize(e){const{scale:[t,n],translate:[r,o]}=e,s=this.features,i=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-r)/t)),(e=>Math.round((o-e)/n)));for(let e=0,t=s.length;e<t;e++)i?.(s[e].geometry)||(s.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:n}=this;if(!n)return this;const{translate:[r,o],scale:[s,i]}=n;let l=null,a=null;if(this.hasZ&&null!=n?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=n;l=n=>n*t+e}if(this.hasM&&null!=n?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=n;a=n=>null==n?n:n*t+e}const c=this._getHydrationFunction(e,(e=>e*s+r),(e=>o-e*i),l,a);for(const{geometry:e}of t)null!=e&&c&&c(e);return this.transform=null,this}readFeaturesWithClass(e,t,n){const r=y.A.fromJSON(t.spatialReference),o=[];for(let t=0;t<e.length;t++){const s=e[t],i=n.fromJSON(s),l=s.geometry?.spatialReference;null==i.geometry||l||(i.geometry.spatialReference=r);const a=s.aggregateGeometries,c=i.aggregateGeometries;if(a&&null!=c)for(const e in c){const t=c[e],n=a[e],o=n?.spatialReference;null==t||o||(t.spatialReference=r)}o.push(i)}return o}_quantizePoints(e,t,n){let r,o;const s=[];for(let i=0,l=e.length;i<l;i++){const l=e[i];if(i>0){const e=t(l[0]),i=n(l[1]);e===r&&i===o||(s.push([e-r,i-o]),r=e,o=i)}else r=t(l[0]),o=n(l[1]),s.push([r,o])}return s.length>0?s:null}_getQuantizationFunction(e,t,n){return"point"===e?e=>(e.x=t(e.x),e.y=n(e.y),e):"polyline"===e||"polygon"===e?e=>{const r=(0,h.Bi)(e)?e.rings:e.paths,o=[];for(let e=0,s=r.length;e<s;e++){const s=r[e],i=this._quantizePoints(s,t,n);i&&o.push(i)}return o.length>0?((0,h.Bi)(e)?e.rings=o:e.paths=o,e):null}:"multipoint"===e?e=>{const r=this._quantizePoints(e.points,t,n);return r&&r.length>0?(e.points=r,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,n,r,o){return"point"===e?e=>{e.x=t(e.x),e.y=n(e.y),r&&(e.z=r(e.z))}:"polyline"===e||"polygon"===e?e=>{const s=(0,h.Bi)(e)?e.rings:e.paths;let i,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];for(let e=0,o=r.length;e<o;e++){const o=r[e];e>0?(i+=o[0],l+=o[1]):(i=o[0],l=o[1]),o[0]=t(i),o[1]=n(l)}}if(r&&o)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=r(n[2]),n[3]=o(n[3])}}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=r(n[2])}}else if(o)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,n=t.length;e<n;e++){const n=t[e];n[2]=o(n[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=n(e.ymin),e.xmax=t(e.xmax),e.ymax=n(e.ymax),r&&null!=e.zmax&&null!=e.zmin&&(e.zmax=r(e.zmax),e.zmin=r(e.zmin)),o&&null!=e.mmax&&null!=e.mmin&&(e.mmax=o(e.mmax),e.mmin=o(e.mmin))}:"multipoint"===e?e=>{const s=e.points;let i,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(i+=r[0],l+=r[1]):(i=r[0],l=r[1]),r[0]=t(i),r[1]=n(l)}if(r&&o)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2]),t[3]=o(t[3])}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2])}else if(o)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=o(t[2])}}:null}};(0,o._)([(0,c.MZ)({type:String,json:{write:!0}})],x.prototype,"displayFieldName",void 0),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],x.prototype,"exceededTransferLimit",void 0),(0,o._)([(0,c.MZ)({type:[s.A],json:{write:!0}})],x.prototype,"features",void 0),(0,o._)([(0,u.w)("features")],x.prototype,"readFeatures",null),(0,o._)([(0,c.MZ)({type:[g.A],json:{write:!0}})],x.prototype,"fields",void 0),(0,o._)([(0,c.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:d.read}}})],x.prototype,"geometryType",void 0),(0,o._)([(0,p.K)("geometryType")],x.prototype,"writeGeometryType",null),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],x.prototype,"hasM",void 0),(0,o._)([(0,c.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],x.prototype,"hasZ",void 0),(0,o._)([(0,c.MZ)({types:m.yR,json:{write:!0}})],x.prototype,"queryGeometry",void 0),(0,o._)([(0,u.w)("queryGeometry")],x.prototype,"readQueryGeometry",null),(0,o._)([(0,c.MZ)({type:y.A,json:{write:!0}})],x.prototype,"spatialReference",void 0),(0,o._)([(0,p.K)("spatialReference")],x.prototype,"writeSpatialReference",null),(0,o._)([(0,c.MZ)({json:{write:!0}})],x.prototype,"transform",void 0),x=r=(0,o._)([(0,f.$)("esri.rest.support.FeatureSet")],x),x.prototype.toJSON.isDefaultToJSON=!0;const A=x},2272:(e,t,n)=>{n.d(t,{Dl:()=>i,jV:()=>s,lF:()=>l}),n(92602),n(70333);var r=n(4718),o=n(84952);function s(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function i(e){return"string"==typeof e?(0,o.An)(e):(0,r.o8)(e)}function l(e,t,n){const r={};for(const o in e){if("declaredClass"===o)continue;const s=e[o];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[o]=s.map((e=>l(e)));else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(n?.[o]);r[o]=t?e:JSON.stringify(e)}else r[o]=t?s:JSON.stringify(s);else r[o]=s}return r}n(926)}}]);