UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 50.5 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2061],{20521(e,t,n){n.r(t),n.d(t,{default:()=>Se});var i=n(5482),s=n(37838),o=n(69540),r=n(49186),a=n(25728),l=n(74887),c=n(36708),u=n(91429),p=n(89808),d=n(99959);const m=Symbol("isWCSGraphicOrigin");var h;class g extends d.A{get[(h=m,p.Q)](){return this.layer}constructor(e){super(),this[h]=!0,this.type="wcs",this.layer=e}get id(){return this.layer.id}}var f=n(4146),v=n(63074),y=n(69208),w=n(16131),b=n(8303),x=n(72545),C=n(54310),I=n(25036),S=n(82935),A=n(82806),D=n(53966),T=n(5443),M=n(38458),L=n(11254),R=n(330);function V(e){return e.endsWith("?")?e.slice(0,-1):e}function N(e){return e.filter(({coverageSubType:e})=>null==e||""===e||/^rectified(grid|dataset)/i.test(e))}function P(e){const t={};for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes[n];if(1!==i.nodeType)continue;const s=(0,R.vv)(i).toLowerCase();switch(s){case"title":case"abstract":t[s]=(0,R.mX)(i);break;case"identifier":t.id=(0,R.mX)(i);break;case"wgs84boundingbox":{const e=(0,R.pN)(i,"LowerCorner"),n=(0,R.pN)(i,"UpperCorner");t.lonLatEnvelope=new T.A({xmin:e[0],ymin:e[1],xmax:n[0],ymax:n[1],spatialReference:{wkid:4326}})}break;case"coveragesummary":t.coverageSummaries=t.coverageSummaries||[],t.coverageSummaries.push(P(i))}}return t}function O(e,t){if(e.coverageSummaries)for(let n=0;n<e.coverageSummaries.length;n++)e.coverageSummaries[n].abstract=e.coverageSummaries[n].abstract||e.abstract,e.coverageSummaries[n].lonLatEnvelope=e.coverageSummaries[n].lonLatEnvelope||e.lonLatEnvelope,e.coverageSummaries[n].title=e.coverageSummaries[n].title||e.title,O(e.coverageSummaries[n],t);null!=e.id&&t.push(e)}function E(e){const t=(0,R.V6)(e.querySelector("Operation[name=GetCapabilities]"),"Get")?.getAttribute("xlink:href")||"",n=(0,R.V6)(e.querySelector("Operation[name=DescribeCoverage]"),"Get")?.getAttribute("xlink:href")||"",i=(0,R.V6)(e.querySelector("Operation[name=GetCoverage]"),"Get")?.getAttribute("xlink:href")||"";return{getCapabilities:V(t),describeCoverage:V(n),getCoverage:V(i)}}function $(e,t=null){let n=null;n="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e;let i=n.documentElement.getAttribute("version");"1.0"===i?i="1.0.0":"1.1"===i&&(i="1.1.0");const s=i||t||"1.0.0",o=s.slice(0,3);let a;if("2.0"===o)a=function(e){const t=(0,R.V6)(e,"ServiceIdentification"),n=(0,R.mX)(t,"Title"),i=(0,R.Dy)(t,"ServiceTypeVersion"),s=(0,R.Dy)(t,"Profile"),o=E((0,R.V6)(e,"OperationsMetadata")),r=(0,R.IC)(e,"Contents/CoverageSummary"),a=[];for(let e=0;e<r.length;e++){const t=r[e],n=(0,R.mX)(t,"CoverageId"),i=(0,R.V6)(t,"WGS84BoundingBox");let s;if(i){const e=(0,R.pN)(i,"LowerCorner"),t=(0,R.pN)(i,"UpperCorner");s=new T.A({xmin:e[0],ymin:e[1],xmax:t[0],ymax:t[1],spatialReference:{wkid:4326}})}const o=(0,R.mX)(t,"CoverageSubtype")||"RectifiedGridCoverage";a.push({id:n,lonLatEnvelope:s,coverageSubType:o})}const l=(0,R.V6)(e,"ServiceMetadata");return{name:n,supportedVersions:i,supportedFormats:(0,R.Dy)(l,"formatSupported"),supportedInterpolations:(0,R.Dy)(l,"interpolationSupported").concat((0,R.Dy)(l,"InterpolationSupported")),onlineResources:o,profiles:s,coverages:a,gridCoverages:N(a),version:"2.0.1"}}(n);else if("1.1"===o)a=function(e){const t=(0,R.mX)(e,"ServiceIdentification/Title"),n=(0,R.Dy)(e,"ServiceIdentification/ServiceTypeVersion"),i=E((0,R.V6)(e,"OperationsMetadata")),s=[],o=(0,R.V6)(e,"Contents");for(let e=0;e<o.childNodes.length;e++){const t=o.childNodes[e];1===t.nodeType&&(0,R.g7)(t,"CoverageSummary")&&O(P(t),s)}const r=(0,R.Dy)(o,"SupportedFormat");return{name:t,onlineResources:i,coverages:s,gridCoverages:N(s),supportedVersions:n,supportedFormats:r,version:"1.1.0"}}(n);else{if("1.0"!==o)throw new r.A("wcsraster:parsecapabilities","the capabilities version is not supported");a=function(e){const t=(0,R.mX)(e,"Service/name"),n=(0,R.V6)(e,"Capability"),i=(0,R.V6)(n,"GetCapabilities/Get/OnlineResource")?.getAttribute("xlink:href")??"",s=(0,R.V6)(n,"DescribeCoverage/Get/OnlineResource")?.getAttribute("xlink:href")??"",o=(0,R.V6)(n,"GetCoverage/Get/OnlineResource")?.getAttribute("xlink:href")??"",r={getCapabilities:V(i),describeCoverage:V(s),getCoverage:V(o)},a=(0,R.IC)(e,"CoverageOfferingBrief"),l=[];for(let e=0;e<a.length;e++){const t=a[e],n=(0,R.mX)(t,"name"),i=(0,R.IC)(t,"pos"),s=(0,R.pN)(i[0]),o=(0,R.pN)(i[1]),r=new T.A({xmin:s[0],ymin:s[1],xmax:o[0],ymax:o[1],spatialReference:{wkid:4326}});l.push({id:n,lonLatEnvelope:r})}return{name:t,onlineResources:r,coverages:l,gridCoverages:N(l),supportedVersions:["1.0.0"],version:"1.0.0"}}(n)}return a.version=s,a}var _=n(39829),X=n(4366),G=n(87186);function F(e){e.variables.forEach(e=>e.dimensions.forEach(e=>e.values??=(0,X.Xg)(e)))}function k(e){return{requestResponseCRSs:(0,R.Dy)(e,"requestResponseCRSs").map(e=>e.split(":")[1]),nativeCRSs:(0,R.Dy)(e,"nativeCRSs").map(e=>e.split(":")[1])}}function j(e,t){const n=(0,R.Dy)(e,"1.0.0"===t?"interpolationMethod":"InterpolationMethod"),i="1.0.0"===t?e.getAttribute("default"):(0,R.mX)(e,"InterpolationMethods/Default");return null!=i?[i].concat(n.filter(e=>e.toLowerCase()!==i.toLowerCase())):n}function Z(e){return null==e?["nearest"]:e.map(e=>{const t=e.toLowerCase();return t.includes("nearest")?"nearest":t.includes("linear")?"bilinear":t.includes("cubic")?"cubic":null}).filter(e=>!!e)}function z(e){const t=(0,R.IC)(e,"pos"),n=(0,R.pN)(t[0]),i=(0,R.pN)(t[1]);return new T.A({xmin:n[0],ymin:n[1],xmax:i[0],ymax:i[1],spatialReference:{wkid:4326}})}function W(e,t){const n=(0,R.Dy)(e,t);return n?.length&&""!==n[0]&&!isNaN(Number(n[0]))?n.map(e=>Number(e)):null}function B(e){const t=(0,R.pN)(e,"MinimumValue"),n=(0,R.pN)(e,"MaximumValue");return t.length&&n.length?t.map((e,t)=>({min:e,max:n[t],avg:-1,stddev:-1})):null}function U(e){return null==e?null:e.every(t=>t===e[0])?e[0]:e}function q(e){const t=[],n=(0,R.IC)(e,"RangeSet");let i=[];for(let e=0;e<n.length;e++){const s=(0,R.mX)(n[e],"name"),o=(0,R.mX)(n[e],"label"),r=[],a=W(n[e],"nullValues/singleValue"),l=(0,R.IC)(n[e],"AxisDescription");for(let e=0;e<l.length;e++){const t=(0,R.mX)(l[e],"name"),n=(0,R.mX)(l[e],"label"),s=(0,R.Dy)(l[e],"singleValue");if(0===s.length){const t=(0,R.mX)(l[e],"min"),n=(0,R.mX)(l[e],"max"),i=Number((0,R.mX)(l[e],"res"))||1;if(null!==t&&null!==n)for(let e=parseInt(t,10);e<=parseInt(n,10);e+=i)s.push(e.toString())}"band"===t.toLowerCase()&&(i=s),r.push({name:t,label:n,values:s})}t.push({name:s,label:o,nullValues:a,axis:r})}return{rangeSet:t,bandNames:i}}function H(e=null){if(!e)return{resolution:null,units:null};let t=e.toUpperCase();const n=["Years","Months","Days","Hours","Minutes","Seconds"];let i,s,o;return t.includes("PT")?(t=t.slice(2),o=["H","M","S"].findIndex(e=>t.includes(e)),i=n[3+o],s=parseFloat(t.slice(0,-1))):(t=t.slice(1),o=["Y","M","D"].findIndex(e=>t.includes(e)),o>-1&&(i=n[o]),s=parseFloat(t.slice(0,-1))),{resolution:s,units:i}}function J(e){const t=(0,R.IC)(e,"timeposition");if(t.length>0){const e=[];for(let n=0;n<t.length;n++)e.push(new Date((0,R.mX)(t[n])));return{begin:e[0],end:e[e.length-1],values:e}}const n=(0,R.V6)(e,"timePeriod")||(0,R.V6)(e,"TimePeriod");return n?{begin:new Date((0,R.mX)(n,"beginPosition")||(0,R.mX)(n,"BeginPosition")),end:new Date((0,R.mX)(n,"endPosition")||(0,R.mX)(n,"EndPosition")),...H((0,R.mX)(n,"timeResolution")||(0,R.mX)(n,"TimeResolution"))}:null}function K(e){const t=(0,R.V6)(e,"spatialDomain"),n=(0,R.V6)(t,"Envelope")||(0,R.V6)(t,"EnvelopeWithTimePeriod"),i=n.getAttribute("srsName").split(":"),s=i[i.length-1],o=(0,R.IC)(n,"pos"),r=(0,R.pN)(o[0]),a=(0,R.pN)(o[1]),l=parseInt(s,10),c=isNaN(l)?null:{wkid:l},u=new T.A({xmin:r[0],ymin:r[1],xmax:a[0],ymax:a[1],spatialReference:c}),p=(0,R.V6)(t,"RectifiedGrid"),d=(0,R.mX)(p,"low").split(" "),m=(0,R.mX)(p,"high").split(" "),h=parseInt(m[0],10)-parseInt(d[0],10)+1,g=parseInt(m[1],10)-parseInt(d[1],10)+1,f=(0,R.pN)(t,"origin/pos"),v=(0,R.IC)(t,"offsetVector"),y={envelope:u,columns:h,rows:g,offset:{x:parseFloat((0,R.mX)(v[0]).split(" ")[0]),y:parseFloat((0,R.mX)(v[1]).split(" ")[1])},origin:{x:f[0],y:f[1]}},w=(0,R.V6)(e,"temporalDomain")||(0,R.V6)(e,"TemporalDomain");return{spatialDomain:y,temporalDomain:w?J(w):null}}function Q(e,t){const n=[],i=(0,R.IC)(e,"Field");let s,o=[];for(let e=0;e<i.length;e++){const r=(0,R.mX)(i[e],"Identifier"),a=(0,R.mX)(i[e],"Description"),l=(0,R.mX)(i[e],"Definition"),c=(0,R.mX)(i[e],"Abstract"),u=(0,R.mX)(i[e],"Title"),p=W(i[e],"NullValue"),d=(0,R.V6)(i[e],"AllowedValues"),m=d?B(d):null,h=j(i[e],"1.1.0"),g=[],f=(0,R.IC)(i[e],"Axis");for(let e=0;e<f.length;e++){const n=f[e].getAttribute("identifier"),i=(0,R.mX)(f[e],"UOM"),r=(0,R.mX)(f[e],"DataType"),a=(0,R.Dy)(f[e],"Key");t&&!n.toLowerCase().includes("band")||(o=a,s=p),g.push({identifier:n,uom:i,dataType:r,values:a,bandNoDataValues:s})}n.push({identifier:r,description:a,definition:l,abstract:c,title:u,supportedInterpolations:h,axis:g,nullValues:p,statistics:m})}return{rangeSet:n,bandNames:o,bandNoDataValues:s,statistics:n[0].statistics}}function Y(e){const t=(0,R.V6)(e,"SpatialDomain"),n=(0,R.V6)(t,"GridCRS"),i=(0,R.mX)(n,"GridBaseCRS"),s=(0,R.mX)(n,"GridOrigin"),o=s?.split(" ").map(e=>parseFloat(e))??[0,0],r=(0,R.pN)(n,"GridOffsets"),a=(0,R.IC)(t,"BoundingBox");let l,c,u,p;for(let e=0;e<a.length;e++){const t=a[e].getAttribute("crs")?.toLowerCase();if(null!=t)if(t.includes("imagecrs")){const t=(0,R.pN)(a[e],"LowerCorner"),n=(0,R.pN)(a[e],"UpperCorner");l=n[0]-t[0]+1,c=n[1]-t[1]+1}else if(t.indexOf("epsg")>0){const n=t.split(":");u=parseInt(n[n.length-1],10);const i=(0,R.pN)(a[e],"LowerCorner"),s=(0,R.pN)(a[e],"UpperCorner");p=new T.A({xmin:i[0],ymin:i[1],xmax:s[0],ymax:s[1],spatialReference:{wkid:u}})}}const d=l>c,m=p.xmax-p.xmin>p.ymax-p.ymin;let h=!1;(0,M.m)(u)&&(d===m?h=!1:(h=!0,p=new T.A({xmin:p.ymin,ymin:p.xmin,xmax:p.ymax,ymax:p.xmax,spatialReference:{wkid:u}})));const g={columns:l,rows:c,origin:{x:o[0],y:o[1]},offset:{x:r[0],y:r[r.length-1]},gridBaseCRS:i,envelope:p,useEPSGAxis:h},f=(0,R.V6)(e,"temporalDomain")||(0,R.V6)(e,"TemporalDomain");return{spatialDomain:g,temporalDomain:f?J(f):null}}function ee(e){const t=(0,R.V6)(e,"Envelope")||(0,R.V6)(e,"EnvelopeWithTimePeriod"),n=t.getAttribute("srsName"),i=n.slice(n.lastIndexOf("/")+1),s=t.getAttribute("axisLabels").split(" ").map(e=>e.trim()).filter(e=>""!==e.trim()),o=(0,R.pN)(t,"lowerCorner"),r=(0,R.pN)(t,"upperCorner"),a=!["y","lat","latitude","north","nor","n","b"].includes(s[0].toLowerCase());let l;const c=parseInt(i,10),u=isNaN(c)?null:{wkid:c};l=new T.A(a?{xmin:o[0],ymin:o[1],xmax:r[0],ymax:r[1],spatialReference:u}:{xmin:o[1],ymin:o[0],xmax:r[1],ymax:r[0],spatialReference:u});const p={mins:o,maxs:r},d=t.getAttribute("uomLabels").trim().split(" ");let m,h;if((0,R.g7)(t,"EnvelopeWithTimePeriod")){m=new Date((0,R.mX)(e,"beginPosition")||(0,R.mX)(e,"BeginPosition")),h=new Date((0,R.mX)(e,"endPosition")||(0,R.mX)(e,"EndPosition"));const t=d?.findIndex(e=>"oledatetime"===e?.toLowerCase());t>-1&&(d[t]="ISO8601")}return{envelope:l,axisLabels:s,uomLabels:d.length?d:null,envelopeAllDims:p,beginPosition:m,endPosition:h,isEastFirst:a}}function te(e,t){const n=[],i=(0,R.IC)(e,"DataRecord"),s=[];let o,r=[];for(let e=0;e<i.length;e++){const a=(0,R.IC)(i[e],"field"),l=[];for(let e=0;e<a.length;e++){const n=a[e].getAttribute("name"),i=(0,R.mX)(a[e],"description")||"",c=(0,R.V6)(a[e],"uom")?.getAttribute("code")||"",u=(0,R.pN)(a[e],"interval"),p=W(a[e],"nilValue")?.[0];t&&!n.toLowerCase().includes("band")||(s.push(n),u?.length&&(o=o||[],o.push({min:u[0],max:u[1],avg:-1,stddev:-1})),r.push(p)),l.push({name:n,description:i,uom:c,allowedValues:u,nilValue:p})}n.push(l)}return r.some(e=>null!=e)||(r=null),{rangeType:n,bandNames:s,bandStats:o,bandNoDataValues:r}}function ne(e){let t=1,n="";const i=.01;return Math.abs(e-1/24)<1/24*i?n="Hours":Math.abs(e-1)<1*i?n="Days":e<1?(t=Math.round(24*e),n="Hours"):e>28-i&&e<31+i||Math.round(e/30)<12?n="Months":e>365-i&&e<366+i&&(n="Years"),{interval:t,intervalUnit:n}}function ie(e,t){const n=(0,R.V6)(e,"RectifiedGrid"),i=(0,R.pN)(n,"low"),s=(0,R.pN)(n,"high"),o=[];for(let e=0;e<i.length;e++)o.push(s[e]-i[e]+1);const r=(0,R.mX)(n,"axisLabels").split(" "),a=(0,R.pN)(n,"origin/pos"),l=(0,R.IC)(n,"offsetVector"),c=[];for(let e=0;e<l.length;e++){const t=(0,R.pN)(l[e]),n=t.findIndex(e=>0!==e);c[n]=t[n]}let u,p,d,m=!1;return t?.length&&r?.length&&(m=[...t].sort((e,t)=>e<t?-1:1).join(",")===[...r].sort((e,t)=>e<t?-1:1).join(",")),["y","lat","latitude","north","nor","n","b"].includes((m?r:t)[0].toLowerCase())?(u=o[1],p=o[0],d={y:Math.abs(c[0]),x:Math.abs(c[1])}):(u=o[0],p=o[1],d={x:Math.abs(c[0]),y:Math.abs(c[1])}),{columns:u,rows:p,origin:a,offset:c,resolution:d,gridSamples:o,axisLabels:r,hasSameAxisLabelsAsBoundedBy:m}}function se(e){const t=(0,R.V6)(e,"EarthObservation");if(!t)return null;const n=(0,R.V6)(t,"phenomenonTime"),i=n?J(n):null,s=(0,R.V6)(t,"phenomenonTime"),o=s?J(s):null,r=(0,R.mX)(t,"featureOfInterest/Footprint/multiExtentOf/MultiSurface/surfaceMembers/Polygon/exterior/LinearRing/posList");let a=null;if(r){const e=r.split(" ").map(e=>e.trim()).filter(e=>null!=e&&""!==e).map(Number);if(e.length){const t=[];for(let n=0;n<e.length/2;n+=2)t.push(e[n],e[n+1]);a=new _.A({rings:[[t]]})}}return{observation:{phenomenonTime:i,resultTime:o,footprint:a,identifier:(0,R.mX)(e,"metaDataProperty/EarthObservationMetaData/identifier"),acquisitionType:(0,R.mX)(e,"metaDataProperty/EarthObservationMetaData/acquisitionType"),status:(0,R.mX)(e,"metaDataProperty/EarthObservationMetaData/status")}}}async function oe(e,t){const{coverageIds:n,version:i,customParameters:s,signal:o}=t,a=i.slice(0,3),c="1.0"===a?"coverage":"1.1"===a?"identifiers":"coverageId",u={service:"WCS",request:"DescribeCoverage",version:i,[c]:n.join(","),...s};try{const{data:t}=await(0,L.A)(e,{query:u,responseType:"xml",signal:o});return function(e,t){let n=null;if(n="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e,"1.0.0"===t)return(0,R.IC)(n,"CoverageOffering").map(e=>function(e){const t={version:"1.0"};let n,i=[];for(let s=0;s<e.childNodes.length;s++){const o=e.childNodes[s];if(1===o.nodeType)if((0,R.g7)(o,"description"))t.description=(0,R.mX)(o);else if((0,R.g7)(o,"name"))t.name=(0,R.mX)(o);else if((0,R.g7)(o,"label"))t.label=(0,R.mX)(o);else if((0,R.g7)(o,"supportedFormats"))t.supportedFormats=(0,R.Dy)(o,"formats");else if((0,R.g7)(o,"supportedCRSs"))t.supportedCRSs=k(o);else if((0,R.g7)(o,"supportedInterpolations"))t.supportedInterpolations=j(o,"1.0.0");else if((0,R.g7)(o,"lonLatEnvelope"))t.lonLatEnvelope=z(o);else if((0,R.g7)(o,"rangeSet")){const e=q(o);t.rangeSet=e.rangeSet,i=e.bandNames;const s=e.rangeSet[0].nullValues;s?.length&&(n=U(s))}else(0,R.g7)(o,"domainSet")&&(t.domainSet=K(o))}const s=Z(t.supportedInterpolations),{name:o,description:r,label:a,lonLatEnvelope:l,supportedFormats:c}=t,{spatialDomain:u}=t.domainSet,p={x:Math.abs(u.offset.x),y:Math.abs(u.offset.y)},d=function(e){if(!e.temporalDomain)return null;const{begin:t,end:n,values:i,units:s,resolution:o}=e.temporalDomain,r={variables:[{name:"default",description:"",dimensions:[{name:"StdTime",description:"",unit:"ISO8601",values:i?.map(e=>e.getTime()),hasRegularIntervals:!i,interval:o,intervalUnit:s,extent:[t.getTime(),n.getTime()]}]}]};return F(r),r}(t.domainSet),m=new G.A({width:u.columns,height:u.rows,pixelSize:p,pixelType:"unknown",extent:u.envelope,spatialReference:u.envelope.spatialReference,bandCount:i.length||1,noDataValue:n,multidimensionalInfo:d});return{id:o,title:t.name,description:r||a,lonLatEnvelope:l,rasterInfo:m,bandNames:i,supportedFormats:c,supportedInterpolations:s,coverageDescription:t,version:"1.0.0",useEPSGAxis:!1}}(e));const i=(0,R.IC)(n,"CoverageDescription");return"1.1.0"===t||"1.1.1"===t||"1.1.2"===t?i.map(e=>function(e,t){const n=[],i=[],s={supportedFormats:n,supportedCRSs:i,version:"1.1"};let o,r,a=[];for(let t=0;t<e.childNodes.length;t++){const l=e.childNodes[t];if(1!==l.nodeType)continue;const c=(0,R.vv)(l).toLowerCase();switch(c){case"title":case"abstract":case"identifier":s[c]=(0,R.mX)(l);break;case"supportedformat":{const e=(0,R.mX)(l);n.includes(e)||n.push(e)}break;case"supportedcrs":{const e=(0,R.mX)(l);i.includes(e)||i.push(e)}break;case"range":{const e=Q(l,!!s.domain?.temporalDomain);s.range=e.rangeSet,a=e.bandNames;const{bandNoDataValues:t}=e;t?.length&&(o=U(t)),r=e.statistics}break;case"domain":s.domain=Y(l)}}const l=Z(s.range[0].supportedInterpolations),{identifier:c,abstract:u,title:p,domain:d,range:m}=s,h={x:Math.abs(d.spatialDomain.offset.x),y:Math.abs(d.spatialDomain.offset.y)},g=function(e,t){if(!t.temporalDomain)return null;const n=e.filter(e=>!e.identifier.toLowerCase().includes("field_1")&&!e.axis.some(e=>e.identifier.includes("band"))),i=[];if(n.length&&n.forEach(e=>{const t=e.axis.map(e=>{const t=e.values.map(t=>"ISO8601"===e.uom?(t=t.trim()).toLowerCase().includes("z")?new Date(t).getTime():new Date(t+"Z").getTime():parseFloat(t.trim())),n=[Math.min.apply(null,t),Math.max.apply(null,t)];return{name:e.identifier.trim(),description:"",field:e.identifier.trim(),unit:e.uom?e.uom.trim():"",hasRegularIntervals:!1,values:t,extent:n}});i.push({name:e.identifier.trim(),description:e.description?.trim()??"",unit:"",dimensions:t,statistics:e.statistics})}),t.temporalDomain){const{begin:e,end:n,values:s,units:o,resolution:r}=t.temporalDomain;i.some(e=>e.dimensions.some(e=>"stdtime"===e.name.toLowerCase()))||i.forEach(t=>{t.dimensions.push({name:"StdTime",description:"",unit:"ISO8601",values:s?.map(e=>e.getTime()),hasRegularIntervals:!s,interval:r,intervalUnit:o,extent:[e.getTime(),n.getTime()]})})}if(i.length){const e={variables:i};return F(e),e}return null}(m,d);g&&(o=m[0].nullValues,1===o?.length&&(o=o[0]));const f=new G.A({width:d.spatialDomain.columns,height:d.spatialDomain.rows,pixelSize:h,pixelType:"unknown",extent:d.spatialDomain.envelope,spatialReference:d.spatialDomain.envelope.spatialReference,bandCount:a.length||1,noDataValue:o,statistics:r,multidimensionalInfo:g});return{id:c,title:s.title,description:u||p,bandNames:a,rasterInfo:f,supportedFormats:n,supportedInterpolations:l,coverageDescription:s,version:t,useEPSGAxis:d.spatialDomain.useEPSGAxis}}(e,t)):i.map(e=>function(e){const t={version:"2.0"};let n,i,s=[];for(let o=0;o<e.childNodes.length;o++){const r=e.childNodes[o];if(1===r.nodeType)if((0,R.g7)(r,"coverageId"))t.coverageId=(0,R.mX)(r);else if((0,R.g7)(r,"ServiceParameters"))t.serviceParameters={supportedFormats:(0,R.Dy)(r,"nativeFormat")};else if((0,R.g7)(r,"boundedBy"))t.boundedBy=ee(r);else if((0,R.g7)(r,"rangeType")){const e=te(r,t.boundedBy?.axisLabels.length>2||t.domainSet?.axisLabels.length>2);t.rangeType=e.rangeType,s=e.bandNames,n=e.bandStats;const{bandNoDataValues:o}=e;o?.length&&(i=U(o))}else if((0,R.g7)(r,"domainSet"))t.domainSet=ie(r,t.boundedBy?.axisLabels);else if((0,R.g7)(r,"metadata")){const e=(0,R.V6)(r,"EOMetadata");t.eoMetadata=e?se(e):null}}const{coverageId:o,boundedBy:r,domainSet:a,rangeType:l,serviceParameters:c}=t,u=function(e,t,n){if(n.axisLabels.length<=2)return null;const i=[];for(let t=0;t<e.length;t++){const n=e[t];for(let e=0;e<n.length;e++)n[e].name.toLowerCase().includes("band")||i.push(n[e])}const s=[];if(i.length){const e=[];for(let i=2;i<n.axisLabels.length;i++){const s=t.uomLabels?.[i]?.trim()??"",o=n.axisLabels[i].toLowerCase().includes("time")||"iso8601"===s.toLowerCase()||"oledatetime"===s.toLowerCase();let r,a;if(o){const e=ne(n.offset[i]);r=e.interval,a=e.intervalUnit}else r=n.offset[i],a=s;const l=[];o?(l.push((0,X.$E)(t.envelopeAllDims.mins[i])),l.push((0,X.$E)(t.envelopeAllDims.maxs[i]))):(l.push(t.envelopeAllDims.mins[i]),l.push(t.envelopeAllDims.maxs[i])),e.push({name:n.axisLabels[i].trim(),description:n.axisLabels[i].trim(),unit:o?"ISO8601":s,hasRegularIntervals:!0,extent:l,interval:r,intervalUnit:a})}if(i.forEach(t=>{const{allowedValues:n}=t,i=2===n?.length?[{min:n[0],max:n[1],avg:-1,stddev:-1}]:null;s.push({name:t.name.trim(),description:t.description?.trim()??"",unit:t.uom.trim(),statistics:i,dimensions:[...e]})}),s.length){const e={variables:s};return F(e),e}}return null}(l,r,a);return!n&&u&&(n=u?.variables[0].statistics),null!=u&&(i=l[0][0].nilValue),{id:o,title:o,description:o,bandNames:s,rasterInfo:new G.A({width:a.columns,height:a.rows,pixelSize:a.resolution,pixelType:"unknown",extent:r.envelope,spatialReference:r.envelope.spatialReference,bandCount:s.length||1,statistics:n,noDataValue:i,multidimensionalInfo:u}),supportedFormats:c.supportedFormats,coverageDescription:t,version:"2.0.1",useEPSGAxis:!1}}(e))}(t,i)}catch(e){if(!(0,l.zf)(e))throw new r.A("wcslayer:open","wcs coverage description is not valid or supported");throw e}}var re=n(49859);function ae(e,t,n=0){const i="--"+t.boundary,s=[];for(let e=0;e<i.length;e++)s.push(i.charCodeAt(e));const o=[],r="\n--"+t.boundary+"--";for(let e=0;e<r.length;e++)o.push(r.charCodeAt(e));const a=[10],l=[13,10],c=[],u=s.length,p=new Uint8Array(e,n),d=p.length-u;let m=0,h=0;for(let e=0;e<d;e++){for(h=0;h<u&&p[e+h]===s[h];h++);if(h!==u)continue;let n=!1;if(m){const i=le(p.subarray(m,e),t);c.push(i),n=!!i.isValidImage}if(e+=u-1,p[e+1]===a[0]?e+=1:p[e+1]===l[0]&&p[e+2]===l[1]&&(e+=2),m=e+1,n)break}const g=o.length;for(let e=p.length-g-10;e<p.length-g;e++){for(h=0;h<g&&p[e+h]===o[h];h++);if(h===g){c.push(le(p.subarray(m,e),t));break}}return c}function le(e,t){const n=String.fromCharCode.apply(null,e.subarray(0,Math.min(300,e.length))).split("\n"),i=Math.min(n.length,7),s={contentDisposition:"inline"};let o=0;for(let r=0;r<i;r++)if(n[r].length<4)o=o+n[r].length+1;else if("content"===n[r].slice(0,7).toLowerCase()){o=o+n[r].length+1;const e=n[r].indexOf(":");if(-1===e)continue;const t=n[r].slice(0,e).trim(),i=n[r].slice(e+1).trim();switch(t.toLowerCase()){case"content-type":s.contentType=i;break;case"content-description":s.contentDescription=i;break;case"content-transfer-encoding":s.contentTransferEncoding=i;break;case"content-id":s.contentID=i;break;case"content-disposition":s.contentDisposition=i;break;case"content-location":s.contentLocation=i}}else{if(s.contentDisposition.toLowerCase().includes("inline")&&n[r].length>=4&&s.contentType?.toLowerCase().includes("image")){let t=!0,n=e.subarray(o,e.length);if(s.contentType.toLowerCase().indexOf("tif")>0){if("base64"===s.contentTransferEncoding){let e="";const t=n;for(let n=0;n<t.length;n+=65535){const i=t.subarray(n,n+65535>t.length-1?t.length-1:n+65535);e+=String.fromCharCode.apply(null,i)}const i=atob(e);n=new Uint8Array(i.length);for(let e=0;e<n.length;e++)n[e]=i.charCodeAt(e)}t=73===n[0]&&73===n[1]||77===n[0]&&77===n[1]}if(t){let t=n.buffer;"base64"!==s.contentTransferEncoding&&(t=new ArrayBuffer(e.length-o),n=new Uint8Array(t),n.set(e.subarray(o,e.length))),s.contentData=t,s.isValidImage=!0}break}if((""===t.start||s.contentID===t.start)&&s.contentType){if(s.contentType.includes("text")||s.contentType.includes("xml")){s.contentData=String.fromCharCode.apply(null,e.subarray(o,e.length));break}s.contentData=e.subarray(o,e.length)}}return s}var ce=n(20758),ue=n(47520),pe=n(45617);const de=["nearest neighbor","bilinear","bicubic"],me=["nearest","linear","cubic"],he="response is not a supported multipart/related mediaType with inline tiff, switching to compatibility mode",ge=new Set(["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"]);let fe=class extends re.A{constructor(){super(...arguments),this.datasetFormat="WCSServer",this.tileType="Raster"}get rasterId(){return`${this.url}-${this.coverageId}-${this.version}`}async fetchRawTile(e,t,n,i={}){if(this.isBlockOutside(e,t,n))return null;const{nativePixelSize:s,spatialReference:o}=this.rasterInfo,a=2**e,l=s.x*a,c=s.y*a,{blockWidth:u,blockHeight:p}=this.getBlockWidthHeight(e),{origin:d}=this.rasterInfo.storageInfo.tileInfo,m=this.getTileExtent({x:l,y:c},t,n,d,o,[u,p]),h=this.rasterInfo.extent,g=m.xmax>h.xmax,f=m.ymin<h.ymin,v=g||f;let y=m,w=u,b=p;if(v&&(y=m.clone().intersection(h),null!=y&&(g&&(w=Math.floor((y.xmax-y.xmin)/l),y.xmax=y.xmin+l*w),f&&(b=Math.floor((y.ymax-y.ymin)/c),y.ymin=y.ymax-c*b))),null==y||w<=1||b<=1)return null;const x=await this._getCoverage(y,w,b,a,i);if(!x)return null;const{coverageDescription:C}=this.coverageInfo,{noDataValue:I,multidimensionalInfo:S}=this.rasterInfo,{multidimensionalDefinition:A}=i;let D;if(null!=S&&null!=A&&A.length){const e=A[0].variableName;if("2.0"===C.version){const t=C.rangeType[0].find(t=>t.name===e);D=t?.nilValue}else if("1.1"===C.version){const t=C.range.find(t=>t.identifier===e);D=t?.nullValues}}const T=D??I,M=await this.decodePixelBlock(x,{width:w,height:b,planes:null,pixelType:null,tiffNoDataValue:Array.isArray(T)?T[0]:T,matchAllNoData:!0});if(null==M)return null;if(M&&(M.width!==w||M.height!==b))throw new r.A("wcsraster-fetch",`the response has unexpected dimension width: ${M.width}, height: {pixelBlock.height}`);return v?(0,ue.$Q)(M,{x:0,y:0},{width:p,height:p}):M}async _open(e){const{customFetchParameters:t}=this.ioConfig,n=e?.signal,i=await async function(e,t){const{version:n,customParameters:i,signal:s}=t??{},o=n?.startsWith("1.0")?"version":"acceptVersions",a={service:"WCS",request:"GetCapabilities",[o]:n,...i};try{let{data:n}=await(0,L.A)(e,{query:a,responseType:"xml",signal:s});return t?.version||function(e){let t=null;t="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e;const n=t.documentElement.getAttribute("version"),i=n?.slice(0,3);return null!=i&&i<"2.1"}(n)||(a[o]="2.0.1",({data:n}=await(0,L.A)(e,{query:a,responseType:"xml",signal:s}))),$(n)}catch(e){if(!(0,l.zf)(e))throw new r.A("wcslayer:open","wcs capabilities is not valid or supported");throw e}}(this.url,{version:t?.version??this.version,customParameters:t,signal:n});if(this.capabilities=i,!this.version){let e=i.version.slice(0,3);"2.0"===e||"1.1"===e||"1.0"===e?this.version=i.version:(e=i.supportedVersions.find(e=>"2.0.1"===e)||i.supportedVersions.find(e=>e.startsWith("2.0"))||i.supportedVersions.find(e=>e.startsWith("1.1"))||i.supportedVersions.find(e=>e.startsWith("1.0"))||"1.0.0",this.version=e)}const{version:s}=this;if(!ge.has(s))throw new r.A("wcsraster-open",`unsupported WCS version ${s}`);const{gridCoverages:o}=i;if(!o.length)throw new r.A("wcsraster-open","cannot find rectified grid coverages");this.coverageId??=o[0].id;const{coverageId:a}=this,c=o.find(e=>e.id===a);if(null==c)throw new r.A("wcsraster-open",`the coverageId ${a} does not exist in capabilities`);const u=await oe(this.url,{coverageIds:[a],version:s,customParameters:t,signal:n});if(this.coverageInfo=u[0],s.startsWith("2.0")){const{coverageInfo:e}=this;e.lonLatEnvelope=c.lonLatEnvelope,e.supportedInterpolations=Z(i.supportedInterpolations),this._patchDimensionValues201(a,n)}this.datasetName=this.coverageInfo.title;const{rasterInfo:p}=this.coverageInfo;if(this.createRemoteDatasetStorageInfo(p,512,512),this._set("rasterInfo",p),null==p.spatialReference)throw new r.A("wcsraster-open",`coverage without spatial reference is not supported: ${a}`);const{pixelType:d,bandCount:m}=await this._getPixelTypeAndBandCount(n);p.pixelType=d,1===p.bandCount&&m>1&&(p.bandCount=m),this.updateTileInfo()}async _patchDimensionValues201(e,t){const{coverageInfo:n}=this,i=n.rasterInfo.multidimensionalInfo?.variables,s=ge.has("1.1.2")?"1.1.2":ge.has("1.1.1")?"1.1.1":ge.has("1.1.0")?"1.1.0":null,{customFetchParameters:o}=this.ioConfig;if(i&&s)try{const n=this.url.includes("/ImageServer/"),r=e.length>8&&e.startsWith("Coverage")&&n?e.slice(8):e,a=await oe(this.url,{coverageIds:[r??e],version:s,customParameters:o,signal:t}).catch(()=>{if(r)return oe(this.url,{coverageIds:[e],version:s,customParameters:o,signal:t})}),l=a?.[0].rasterInfo.multidimensionalInfo?.variables;if(l)for(const e of i){const t=l.find(({name:t})=>t===e.name);if(t?.dimensions?.length)for(let i=e.dimensions.length-1;i>=0;i--){const s=e.dimensions[i],o=t.dimensions.find(({name:e})=>e===s.name);o?o.values&&o.extent?.join(",")===s.extent?.join(",")&&(e.dimensions[i]={...s,values:o.values}):n&&e.dimensions.splice(i,1)}}}catch{}}async _getPixelTypeAndBandCount(e){const{pixelSize:t,extent:n,multidimensionalInfo:i}=this.rasterInfo,s=n.center,o=new T.A({xmin:s.x-t.x,xmax:s.x+t.x,ymin:s.y-t.y,ymax:s.y+t.y,spatialReference:n.spatialReference});let a=[];if(null!=i){const e=i.variables[0];a=[],e.dimensions.forEach(t=>{a.push(new pe.A({variableName:e.name,dimensionName:t.name,values:t.hasRegularIntervals?t.extent?.[0]:t.values?.[0],isSlice:!0}))})}const{coverageDescription:l}=this.coverageInfo,c={interpolation:"nearest",multidimensionalDefinition:a,signal:e},{version:u}=l,{ioConfig:p}=this,d="2.0"===u&&null==p.allowAnyMediaType||"1.1"===u&&null==p.use2GridOffsets;let m;try{m=await this._getCoverage(o,2,2,1,c,!0)}catch(e){if(!d)throw e;if("1.1"===u){if(!e.details?.isResolutionMismatch)throw e;p.use2GridOffsets=!0}}if(!m&&d&&("2.0"===u&&(p.allowAnyMediaType=!0),m=await this._getCoverage(o,2,2,1,c),m&&D.A.getLogger(this).warn("wcsraster:getcoverage",he)),!m)throw new r.A("wcsraster-open","unable to determine pixel type");const h=await this.decodePixelBlock(m,{width:2,height:2,planes:null,pixelType:null});if(null==h)throw new r.A("wcsraster-open","unable to determine pixel type");return{pixelType:h.pixelType,bandCount:h.getPlaneCount()??0}}async _getCoverage(e,t,n,i,s,o=!1){const{coverageDescription:a}=this.coverageInfo,{version:l}=a,c="2.0"===l?this._getCoverage201Parameters(e,t,n,i,s,a):"1.1"===l?this._getCoverage110Parameters(e,t,n,s,a):this._getCoverage100Parameters(e,t,n,s),u="2.0"===l?await this.request(this._constructWCS201Url(c),{signal:s.signal,responseType:"array-buffer"}):await this.request(this.url,{query:c,signal:s.signal,responseType:"array-buffer"});if("1.0"===l)return u.data;if("2.0"===l&&!1!==this.ioConfig.allowAnyMediaType&&"tiff"===(0,ce.g)(u.data))return o&&(this.ioConfig.allowAnyMediaType=!0,D.A.getLogger(this).warn("wcsraster:getcoverage",he)),u.data;const p=function(e){const t=function(e){const t=e.getHeader?.("Content-Type")?.split(";");if(!t)return null;if(!(t[0].trim()??"").startsWith("multipart/"))return null;const n={boundary:"",start:"",type:""};for(let e=1;e<t.length;e++){const i=t[e].indexOf("=");if(i>0){const s=t[e].slice(0,i).trim(),o=t[e].slice(i+1).trim();n[s]=o.startsWith('"')?o.slice(1,-1):o}}return n}(e);return t?{isMultipart:!0,data:t.boundary?ae(e.data,t,0):null}:{isMultipart:!1,data:null}}(u);if(p.isMultipart&&p.data){const e=p.data.find(e=>e.isValidImage);return o&&"base64"===e?.contentTransferEncoding&&D.A.getLogger(this).warn("wcsraster:getcoverage","response is base64 encoded which may impact layer display performance"),e?.contentData}const d=new Uint8Array(u.data,0,Math.min(u.data.byteLength,2e3)),m=String.fromCharCode.apply(null,d).toLowerCase().includes("exception"),h=m&&String.fromCharCode.apply(null,d).includes("A non-zero RESX/RESY or WIDTH/HEIGHT is required but neither was provided");if(m)throw new r.A("wcsraster:getcoverage","server returns an exception",{isResolutionMismatch:h});throw new r.A("wcsraster:getcoverage","response is not a supported multipart mediaType with inline tiff")}_getInterpolationIndex(e){return e&&this.coverageInfo.supportedInterpolations?.includes(e)?"nearest"===e?0:"bilinear"===e?1:"cubic"===e?2:0:0}_getCoverage100Parameters(e,t,n,i){const s=`${e.xmin},${e.ymin},${e.xmax},${e.ymax}`,o=e.spatialReference.wkid,r=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes("tiff"))||"GEOTIFF",{bandIds:a,interpolation:l}=i,c=this._getInterpolationIndex(l),u=a?a.map(e=>this.coverageInfo.bandNames[e]):null,p=de[c],{multidimensionalDefinition:d}=i;let m;if(null!=d&&null!=this.rasterInfo.multidimensionalInfo){const e=d.find(e=>"StdTime"===e.dimensionName);let t=e?.values;t&&t.length>0&&(Array.isArray(t[0])&&(t=t[0]),m=t.map(e=>ve(e)).join(","))}return{service:"WCS",request:"GetCoverage",version:this.version,coverage:this.coverageId,format:r,crs:`EPSG:${o}`,bbox:s,width:t,height:n,time:m,interpolation:p,band:u?.join(",")}}_getCoverage110Parameters(e,t,n,i,s){const{multidimensionalDefinition:o,bandIds:r,interpolation:a}=i,l=e.spatialReference.wkid,c=`urn:ogc:def:crs:EPSG::${l}`,u=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes("tiff"))||"image/tiff",p=this._getInterpolationIndex(a),d=me[p],m=null==a||0===this.coverageInfo.supportedInterpolations?.indexOf(a),h=s.domain.spatialDomain,g=h.origin.x<=h.envelope.xmin&&h.origin.y<=h.envelope.ymin,f=e.width/t,v=e.height/n*(g?1:-1),y=g?[e.xmin,e.ymin]:[e.xmin,e.ymax],w=h.useEPSGAxis&&(0,M.m)(l),b=w?`${y[1]},${y[0]}`:`${y[0]},${y[1]}`,x=this.ioConfig.use2GridOffsets,C=w?x?`${v},${f}`:`${v},0,0,${f}`:x?`${f},${v}`:`${f},0,0,${v}`,I=f/2,S=e.xmin+I,A=e.xmax-I,D=Math.abs(v)/2,T=e.ymin+D,L=e.ymax-D,R=w?`${T},${S},${L},${A},${c}`:`${S},${T},${A},${L},${c}`,V=s.range.find(e=>e.axis.some(e=>e.identifier.toLowerCase().includes("band")));let N,P=V&&d&&r?m?`${V.identifier}[${V.axis[0].identifier}[${r.join(",")}]]`:`${V.identifier}:${d}[${V.axis[0].identifier}[${r.join(",")}]]`:null;if(null!=o&&o.length)for(let e=0;e<o.length;e++){let t=o[e].values;const n=o[e].dimensionName?.toLowerCase(),i=o[e].variableName?.toLowerCase(),r=s.range.find(e=>e.identifier.toLowerCase()===i);if(t.length>0)if(Array.isArray(t[0])&&(t=t[0]),"stdtime"===n)N=t.map(e=>ve(e)).join(",");else if(r){const e=r.axis.find(e=>e.identifier.toLowerCase()===n);e&&(P=m?r.identifier+"["+e.identifier+"["+t.join(",")+"]]":r.identifier+":"+d+"["+e.identifier+"["+t.join(",")+"]]")}e===o.length-1&&r&&!P&&(P=m?r.identifier:r.identifier+":"+d)}return{service:"WCS",request:"GetCoverage",version:this.version,identifier:this.coverageId,format:u,crs:`EPSG:${l}`,boundingbox:R,gridCS:"urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS",gridType:"urn:ogc:def:method:WCS:1.1:2dGridIn2dCrs",gridOrigin:b,gridOffsets:C,gridBaseCRS:c,timeSequence:N,rangeSubset:P}}_getCoverage201Parameters(e,t,n,i,s,o){const{multidimensionalDefinition:r,interpolation:a}=s,l=this._getInterpolationIndex(a);let c=null;const{supportedInterpolations:u}=this.capabilities;if(u?.length)switch(l){case 0:c=u.find(e=>e.toLowerCase().includes("nearest"));break;case 1:c=u.find(e=>e.toLowerCase().includes("linear"));break;case 2:c=u.find(e=>e.toLowerCase().includes("cubic")||e.toLowerCase().includes("quadratic"))}const p=(this.coverageInfo.supportedFormats||[]).find(e=>e.toLowerCase().includes("tiff"))||"image/tiff",{bandNames:d}=this.coverageInfo,{boundedBy:m,domainSet:h,rangeType:g}=o,f=m.isEastFirst?0:1,v=1-f,{axisLabels:y}=m,w=y[f],b=y[v],x=`http://www.opengis.net/def/crs/EPSG/0/${e.spatialReference.wkid}`,C=x,I=[];I.push(`${w}(${e.xmin},${e.xmax})`),I.push(`${b}(${e.ymin},${e.ymax})`);const S=[];if(y.length>2)for(let e=2;e<y.length;e++){const t=h.origin[e];if(y[e].toLowerCase().includes("time")){let n=t.toString();m.uomLabels?.[e].toLowerCase().includes("ole")&&(S.push(y[e]),n=ve(t,!0)),I.push(y[e]+",http://www.opengis.net("+n+")")}else I.push(y[e]+",http://www.opengis.net("+t+")")}let A=null;if(null!=r&&r.length){const e=[];g.forEach(t=>t.forEach(t=>e.push(t.name)));const t=[];for(let n=0;n<r.length;n++){const i=y.find(e=>e===r[n].dimensionName),s=e.find(e=>e===r[n].variableName);if(t.includes(s)||t.push(s),i){let e=r[n].values;if(e.length>0){Array.isArray(e[0])&&(e=e[0]);let t="";t=i.toLowerCase().includes("time")?e.map(e=>ve(e)).join(","):e.join(",");const n=I.findIndex(e=>e.startsWith(i+",http://www.opengis.net"));-1===n&&I.push(i+",http://www.opengis.net("+t+")"),-1===n||I[n].includes("("+t+")")||I.splice(n,1,i+",http://www.opengis.net("+t+")")}}}t.length&&(A=t.join(","))}else d?.length>=2&&(A=(s.bandIds?s.bandIds.map(e=>d[e]):d).join(","));const D=I.join("&subset="),T=!o.domainSet.hasSameAxisLabelsAsBoundedBy&&!1!==this.ioConfig.allowScaleFactor,M=T?null:`${w}(${t}),${b}(${n})`,L=T?1/i:null;return{service:"WCS",request:"GetCoverage",version:this.version,coverageId:this.coverageId,rangesubset:A,interpolation:c,scaleSize:M,scaleFactor:L,subset:D,format:p,mediaType:this.ioConfig.allowAnyMediaType?null:"multipart/related",outputcrs:x,subsettingcrs:C}}_constructWCS201Url(e){const t={...this.ioConfig.customFetchParameters,...e},n=[];return Object.keys(t).forEach(e=>{const i=t[e];null!=i&&("subset"===e?"string"==typeof i&&i.split("&subset=").forEach(e=>{e&&n.push(`subset=${encodeURIComponent(e)}`)}):n.push(`${e}=${encodeURIComponent(i)}`))}),`${encodeURI(this.url)}?${n.join("&")}`}};function ve(e,t=!1){return(t?new Date((0,X.$E)(e)):new Date(e)).toISOString()}(0,i.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],fe.prototype,"datasetFormat",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],fe.prototype,"tileType",void 0),(0,i.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],fe.prototype,"version",void 0),(0,i.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],fe.prototype,"coverageId",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],fe.prototype,"rasterId",null),fe=(0,i.Cg)([(0,u.$K)("esri.layers.raster.datasets.WCSRaster")],fe);var ye=n(10873),we=n(20437),be=n(74797),xe=n(30291);const Ce=new Set(["milliseconds","seconds","minutes","hours","days","weeks","months","years","decades","centuries"]);let Ie=class extends((0,v.dM)((0,I.j)((0,w.q)((0,b.A)((0,y.d)((0,A.b)((0,x.G)((0,S.e)((0,C.J)((0,a.M)((0,o.OU)(f.A)))))))))))){constructor(...e){super(...e),this.coverageId=null,this.version=null,this.isReference=null,this.graphicOrigin=new g(this),this.legendEnabled=!0,this.noData=0,this.operationalLayerType="WCS",this.type="wcs",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=(0,l.sg)(async(e,t,i)=>{const{save:s,saveAs:o}=await n.e(9838).then(n.bind(n,59838));switch(e){case 0:return s(this,t);case 1:return o(this,i,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WCS"]},e).catch(l.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}get renderer(){return super.renderer}set renderer(e){super.renderer=e}get coverageInfo(){return this.raster.coverageInfo}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[(0,be.rZ)("Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,n=t?.multidimensionalInfo;if(n){const t=(0,be.AL)(n);e.push(...t)}return e}createPopupTemplate(e){return(0,xe.tn)({fields:this.rasterFields,title:this.title},e)}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}async _openRaster(e){const t=new fe({url:this.url,version:this.version,coverageId:this.coverageId,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters}});if(await t.open({signal:e}),!t.rasterInfo)throw t.destroy(),new r.A("wcs-layer:load","cannot load resources on "+this.url);const{rasterInfo:n}=t;null==n.noDataValue&&(n.noDataValue=this.noData),this._set("serviceRasterInfo",n),this._set("spatialReference",n.spatialReference),null==this.title&&this.setAtOrigin("title",t.datasetName,"service"),null==this.coverageId&&this.setAtOrigin("coverageId",t.coverageInfo.id,"service"),null==this.version&&t.version&&this.setAtOrigin("version",t.version,"service"),this.setAtOrigin("tileInfo",t.rasterInfo.storageInfo.tileInfo,"service");const{multidimensionalInfo:i}=n;if(null!=i){const e=i.variables[0].dimensions.find(({name:e})=>"StdTime"===e);if(e){let t=e.extent?.[0]??e.values[0];Array.isArray(t)&&(t=t[0]);let n=e.extent?.[1]??e.values[e.values.length-1];Array.isArray(n)&&(n=n[1]);const i=Ce.has(e.intervalUnit?.toLowerCase())?e.intervalUnit?.toLowerCase():null;this.set("timeInfo",{startField:"StdTime",fullTimeExtent:{start:t,end:n},timeZone:null,interval:i?{value:e.interval,unit:i}:null})}}this.raster=t,this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>this.raster.ioConfig.customFetchParameters=e))}};(0,i.Cg)([(0,u.MZ)({type:String,nonNullable:!0,json:{name:"wcsInfo.coverageId",write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"coverageId",void 0),(0,i.Cg)([(0,u.MZ)()],Ie.prototype,"coverageInfo",null),(0,i.Cg)([(0,u.MZ)({type:["1.0.0","1.1.0","1.1.1","1.1.2","2.0.1"],nonNullable:!0,json:{name:"wcsInfo.version",write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"version",void 0),(0,i.Cg)([(0,u.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Ie.prototype,"isReference",void 0),(0,i.Cg)([(0,u.MZ)({json:{read:!0,write:!0}})],Ie.prototype,"blendMode",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,clonable:!1})],Ie.prototype,"graphicOrigin",void 0),(0,i.Cg)([(0,u.MZ)(ye.fV)],Ie.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,u.MZ)({type:["show","hide"]})],Ie.prototype,"listMode",void 0),(0,i.Cg)([(0,u.MZ)()],Ie.prototype,"noData",void 0),(0,i.Cg)([(0,u.MZ)({type:["WCS"]})],Ie.prototype,"operationalLayerType",void 0),(0,i.Cg)([(0,u.MZ)()],Ie.prototype,"raster",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],Ie.prototype,"type",void 0),(0,i.Cg)([(0,u.MZ)(ye.M6)],Ie.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,u.MZ)({type:s.A,json:{name:"popupInfo",write:!0}})],Ie.prototype,"popupTemplate",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),(0,i.Cg)([(0,u.MZ)({readOnly:!0,type:[we.A]})],Ie.prototype,"fields",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,type:[we.A]})],Ie.prototype,"rasterFields",null),Ie=(0,i.Cg)([(0,u.$K)("esri.layers.WCSLayer")],Ie);const Se=Ie},38458(e,t,n){n.d(t,{m:()=>s});const i=[[3819,3819],[3821,3824],[3889,3889],[3906,3906],[4001,4025],[4027,4036],[4039,4047],[4052,4055],[4074,4075],[4080,4081],[4120,4176],[4178,4185],[4188,4216],[4218,4289],[4291,4304],[4306,4319],[4322,4326],[4463,4463],[4470,4470],[4475,4475],[4483,4483],[4490,4490],[4555,4558],[4600,4646],[4657,4765],[4801,4811],[4813,4821],[4823,4824],[4901,4904],[5013,5013],[5132,5132],[5228,5229],[5233,5233],[5246,5246],[5252,5252],[5264,5264],[5324,5340],[5354,5354],[5360,5360],[5365,5365],[5370,5373],[5381,5381],[5393,5393],[5451,5451],[5464,5464],[5467,5467],[5489,5489],[5524,5524],[5527,5527],[5546,5546],[2044,2045],[2081,2083],[2085,2086],[2093,2093],[2096,2098],[2105,2132],[2169,2170],[2176,2180],[2193,2193],[2200,2200],[2206,2212],[2319,2319],[2320,2462],[2523,2549],[2551,2735],[2738,2758],[2935,2941],[2953,2953],[3006,3030],[3034,3035],[3038,3051],[3058,3059],[3068,3068],[3114,3118],[3126,3138],[3150,3151],[3300,3301],[3328,3335],[3346,3346],[3350,3352],[3366,3366],[3389,3390],[3416,3417],[3833,3841],[3844,3850],[3854,3854],[3873,3885],[3907,3910],[4026,4026],[4037,4038],[4417,4417],[4434,4434],[4491,4554],[4839,4839],[5048,5048],[5105,5130],[5253,5259],[5269,5275],[5343,5349],[5479,5482],[5518,5519],[5520,5520],[20004,20032],[20064,20092],[21413,21423],[21473,21483],[21896,21899],[22171,22177],[22181,22187],[22191,22197],[25884,25884],[27205,27232],[27391,27398],[27492,27492],[28402,28432],[28462,28492],[30161,30179],[30800,30800],[31251,31259],[31275,31279],[31281,31290],[31466,31700]];function s(e){return null!=e&&i.some(([t,n])=>e>=t&&e<=n)}},72802(e,t,n){n.d(t,{U:()=>s});var i=n(19419);class s{constructor(e,t,n,s=(0,i.vt)()){this._level=e,this._row=t,this._col=n,this.extent=s}get id(){return this._id??=`${this.level}/${this.row}/${this.col}`,this._id}get level(){return this._level}set level(e){this._level=e,this._id=null}get row(){return this._row}set row(e){this._row=e,this._id=null}get col(){return this._col}set col(e){this._col=e,this._id=null}toJSON(){return{level:this._level,row:this._row,col:this._col,extent:this.extent}}static fromJSON(e){return new s(e.level,e.row,e.col,e.extent)}}},87045(e,t,n){n.d(t,{A:()=>w});var i,s=n(5482),o=n(66552),r=n(25482),a=n(86211),l=n(91429),c=n(56507),u=n(86738),p=n(16930),d=n(21325),m=n(28735),h=n(91806),g=n(72802),f=n(36005),v=n(43937);const y=new o.J({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let w=class extends r.o{static{i=this}static create(e={}){const{resolutionFactor:t=1,scales:n,size:s=256,spatialReference:o=p.A.WebMercator,numLODs:r=24}=e;if(!(0,d.fn)(o)){const e=[];if(n)for(let t=0;t<n.length;t++){const i=n[t];e.push(new h.A({level:t,scale:i,resolution:i}))}else{let t=5e-4;for(let n=r-1;n>=0;n--)e.unshift(new h.A({level:n,scale:t,resolution:t})),t*=2}return new i({dpi:96,lods:e,origin:new u.A(0,0,o),size:[s,s],spatialReference:o})}const l=(0,d.Vp)(o),c=e.origin?new u.A({x:e.origin.x,y:e.origin.y,spatialReference:o}):new u.A(l?{x:l.origin[0],y:l.origin[1],spatialReference:o}:{x:0,y:0,spatialReference:o}),m=1/(39.37*(0,a.GA)(o)*96),g=[];if(n)for(let e=0;e<n.length;e++){const t=n[e],i=t*m;g.push(new h.A({level:e,scale:t,resolution:i}))}else{let e=(0,d.EA)(o)?512/s*591657527.5917094:256/s*591657527.591555;const n=Math.ceil(r/t);g.push(new h.A({level:0,scale:e,resolution:e*m}));for(let i=1;i<n;i++){const n=e/2**t,s=n*m;g.push(new h.A({level:i,scale:n,resolution:s})),e=n}}return new i({dpi:96,lods:g,origin:c,size:[s,s],spatialReference:o})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const n=(0,d.Vp)(e);return e.isWrappable&&!!n&&Math.abs(n.origin[0]-t.x)<=n.dx}return!1}readOrigin(e,t){return u.A.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,n=0;const i=[],s=this._levelToLOD={};e&&(t=-1/0,n=1/0,e.forEach(e=>{i.push(e.scale),t=e.scale>t?e.scale:t,n=e.scale<n?e.scale:n,s[e.level]=e})),this._set("scales",i),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const n=Math.floor(e),i=n+1;return t[n]/(t[n]/t[i])**(e-n)}scaleToZoom(e){const t=this.scales,n=t.length-1;let i=0;for(;i<n;i++){const n=t[i],s=t[i+1];if(n<=e)return i;if(s===e)return i+1;if(n>e&&s<e)return i+Math.log(n/e)/Math.log(n/s)}return i}tileAt(e,t,n,i){const s=this.lodAt(e);if(!s)return null;let o,r;if("number"==typeof t)o=t,r=n;else if((0,d.aI)(t.spatialReference,this.spatialReference))o=t.x,r=t.y,i=n;else{const e=(0,m.Cv)(t,this.spatialReference);if(null==e)return null;o=e.x,r=e.y,i=n}const a=s.resolution*this.size[0],l=s.resolution*this.size[1];return i??=new g.U(0,0,0),i.level=e,i.row=Math.floor((this.origin.y-r)/l+.001),i.col=Math.floor((o-this.origin.x)/a+.001),this.updateTileInfo(i),i}updateTileInfo(e,t=0){if(!("extent"in e))return!1;let n=this.lodAt(e.level);if(!n&&1===t){const t=this.lods[this.lods.length-1];t.level<e.level&&(n=t)}if(!n)return!1;const i=e.level-n.level,s=n.resolution*this.size[0]/2**i,o=n.resolution*this.size[1]/2**i;return e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*o,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+o,!0}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const n=this.lodAt(t.level);if(null==n)return null;const{resolution:i}=n,s=i*this.size[0],o=i*this.size[1];return e[0]=this.origin.x+t.col*s,e[1]=this.origin.y-(t.row+1)*o,e[2]=e[0]+s,e[3]=e[1]+o,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return i.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||256===this.size[0]&&512===e)return null;const t=(512===this.size[0]&&256===e?-1:0)+(this.spatialReference.isGeographic?1:0);if(this.size[0]===e&&0===t)return this;const n=[],s=this.lods.length-t;for(let e=0;e<s;e++){const i=e+t,{scale:s,resolution:o}=i>=0?this.lods[i]:{scale:2*this.lods[0].scale,resolution:2*this.lods[0].resolution};n.push(new h.A({level:e,scale:s,resolution:o}))}return new i({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:n})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let n=0;n<e.length;n++){const i=e[n];this._upsampleLevels[i.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/i.resolution:0},t=i}}};(0,s.Cg)([(0,l.MZ)({type:Number,json:{write:!0}})],w.prototype,"compressionQuality",void 0),(0,s.Cg)([(0,l.MZ)({type:Number,json:{write:!0}})],w.prototype,"dpi",void 0),(0,s.Cg)([(0,l.MZ)({type:String,json:{read:y.read,write:y.write,origins:{"web-scene":{read:!1,write:!1}}}})],w.prototype,"format",void 0),(0,s.Cg)([(0,l.MZ)({readOnly:!0})],w.prototype,"isWrappable",null),(0,s.Cg)([(0,l.MZ)({type:u.A,json:{write:!0}})],w.prototype,"origin",void 0),(0,s.Cg)([(0,f.w)("origin")],w.prototype,"readOrigin",null),(0,s.Cg)([(0,l.MZ)({type:[h.A],value:null,json:{write:!0}})],w.prototype,"lods",null),(0,s.Cg)([(0,l.MZ)({readOnly:!0})],w.prototype,"scales",void 0),(0,s.Cg)([(0,l.MZ)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],w.prototype,"size",void 0),(0,s.Cg)([(0,f.w)("size",["rows","cols"])],w.prototype,"readSize",null),(0,s.Cg)([(0,v.K)("size",{cols:{type:c.jz},rows:{type:c.jz}})],w.prototype,"writeSize",null),(0,s.Cg)([(0,l.MZ)({type:p.A,json:{write:!0}})],w.prototype,"spatialReference",void 0),w=i=(0,s.Cg)([(0,l.$K)("esri.layers.support.TileInfo")],w)},91806(e,t,n){n.d(t,{A:()=>l});var i,s=n(5482),o=n(25482),r=n(91429),a=n(56507);let l=class extends o.o{static{i=this}constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new i({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,s.Cg)([(0,r.MZ)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],l.prototype,"cols",void 0),(0,s.Cg)([(0,r.MZ)({type:a.jz,json:{write:!0}})],l.prototype,"level",void 0),(0,s.Cg)([(0,r.MZ)({type:String,json:{write:!0}})],l.prototype,"levelValue",void 0),(0,s.Cg)([(0,r.MZ)({json:{write:!0,origins: