@arcgis/core 4.28.0-next.20230706 → 4.28.0-next.20230708
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{cfd8b13bfabafc56d65d.js → 2c2cab197c47f080772a.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d22060e5b6e0b11227a.js → 3a0e2535f6cdb2e65667.js} +1 -1
- package/assets/esri/core/workers/chunks/4e4e62462deec25e82ce.js +1 -0
- package/assets/esri/core/workers/chunks/fb7eff7f76386f81d57b.js +1 -0
- package/assets/esri/t9n/common.json +1 -1
- package/assets/esri/t9n/common_en.json +1 -1
- package/assets/esri/themes/base/widgets/_Feature.scss +3 -2
- package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +69 -32
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
- package/chunks/BlendWeights.glsl.js +33 -35
- package/chunks/Blur.glsl.js +6 -9
- package/chunks/EdgeDetect.glsl.js +10 -10
- package/interfaces.d.ts +6 -300
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/shaders/BlendWeights.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Blur.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/EdgeDetect.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SMAAPassParameters.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/resources.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Zoom/ZoomConditions2D.js +1 -1
- package/assets/esri/core/workers/chunks/6b579428c976011b8bcb.js +0 -1
- package/assets/esri/core/workers/chunks/7d9ad61c7896cafc19f7.js +0 -1
- package/layers/LinkChartLayer.d.ts +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4578],{92835:(e,t,i)=>{i.d(t,{Z:()=>m});var s,n=i(43697),r=i(96674),a=i(35463),o=i(5600),l=(i(75215),i(67676),i(80442),i(71715)),c=i(52011),u=i(30556);let h=s=class extends r.wq{static get allTime(){return f}static get empty(){return d}constructor(e){super(e),this.end=null,this.start=null}readEnd(e,t){return null!=t.end?new Date(t.end):null}writeEnd(e,t){t.end=e?e.getTime():null}get isAllTime(){return this.equals(s.allTime)}get isEmpty(){return this.equals(s.empty)}readStart(e,t){return null!=t.start?new Date(t.start):null}writeStart(e,t){t.start=e?e.getTime():null}clone(){return new s({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=null!=this.start?this.start.getTime():this.start,i=null!=this.end?this.end.getTime():this.end,s=null!=e.start?e.start.getTime():e.start,n=null!=e.end?e.end.getTime():e.end;return t===s&&i===n}expandTo(e){if(this.isEmpty||this.isAllTime)return this.clone();let t=this.start;t&&(t=(0,a.JE)(t,e));let i=this.end;if(i){const t=(0,a.JE)(i,e);i=i.getTime()===t.getTime()?t:(0,a.Nm)(t,1,e)}return new s({start:t,end:i})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return s.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=this.start?.getTime()??-1/0,i=this.end?.getTime()??1/0,n=e.start?.getTime()??-1/0,r=e.end?.getTime()??1/0;let a,o;if(n>=t&&n<=i?a=n:t>=n&&t<=r&&(a=t),i>=n&&i<=r?o=i:r>=t&&r<=i&&(o=r),null!=a&&null!=o&&!isNaN(a)&&!isNaN(o)){const e=new s;return e.start=a===-1/0?null:new Date(a),e.end=o===1/0?null:new Date(o),e}return s.empty}offset(e,t){if(this.isEmpty||this.isAllTime)return this.clone();const i=new s,{start:n,end:r}=this;return null!=n&&(i.start=(0,a.Nm)(n,e,t)),null!=r&&(i.end=(0,a.Nm)(r,e,t)),i}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return f.clone();const t=null!=this.start&&null!=e.start?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,i=null!=this.end&&null!=e.end?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new s({start:t,end:i})}};(0,n._)([(0,o.Cb)({type:Date,json:{write:{allowNull:!0}}})],h.prototype,"end",void 0),(0,n._)([(0,l.r)("end")],h.prototype,"readEnd",null),(0,n._)([(0,u.c)("end")],h.prototype,"writeEnd",null),(0,n._)([(0,o.Cb)({readOnly:!0,json:{read:!1}})],h.prototype,"isAllTime",null),(0,n._)([(0,o.Cb)({readOnly:!0,json:{read:!1}})],h.prototype,"isEmpty",null),(0,n._)([(0,o.Cb)({type:Date,json:{write:{allowNull:!0}}})],h.prototype,"start",void 0),(0,n._)([(0,l.r)("start")],h.prototype,"readStart",null),(0,n._)([(0,u.c)("start")],h.prototype,"writeStart",null),h=s=(0,n._)([(0,c.j)("esri.TimeExtent")],h);const f=new h,d=new h({start:void 0,end:void 0}),m=h},13867:(e,t,i)=>{i.d(t,{z:()=>n});var s=i(69801);class n{constructor(e,t){this._storage=new s.WJ,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this),t&&this._storage.registerRemoveFunc("",t)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,t,i=1){this._storage.put(this,e,t,i,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}}},69801:(e,t,i)=>{i.d(t,{WJ:()=>o,Xq:()=>a});var s,n,r=i(44553);(n=s||(s={}))[n.ALL=0]="ALL",n[n.SOME=1]="SOME";class a{constructor(e,t,i){this.name=e,this._storage=t,this.id=l+++":",this.size=0,this.maxSize=0,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),i&&(this._storage.registerRemoveFunc(this.id,i),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get sizeAll(){return this._storage.size}resetHitRate(){this._hit=this._miss=0}put(e,t,i,s=0){this._storage.put(this,e,t,i,s)}get(e){const t=this._storage.get(this,e);return void 0===t?++this._miss:++this._hit,t}peek(e){return this._storage.peek(this,e)}pop(e){const t=this._storage.pop(this,e);return void 0===t?++this._miss:++this._hit,t}updateSize(e,t,i){this._storage.updateSize(this,e,t,i)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class o{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new r.Z,this._users=new r.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,t){this._removeFuncs.push([e,t])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace((t=>t[0]!==e))}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimits()}put(e,t,i,n,r){t=e.id+t;const a=this._db.get(t);if(a&&(this._size-=a.size,e.size-=a.size,this._db.delete(t),a.entry!==i&&this._notifyRemove(t,a.entry,s.ALL)),n>this._maxSize)return void this._notifyRemove(t,i,s.ALL);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!n||n<0)return void console.warn("Refusing to cache entry with invalid size "+n);const o=1+Math.max(r,-3)- -3;this._db.set(t,{entry:i,size:n,lifetime:o,lives:o}),this._size+=n,e.size+=n,this._checkSizeLimits()}updateSize(e,t,i,n){t=e.id+t;const r=this._db.get(t);if(r&&r.entry===i){for(this._size-=r.size,e.size-=r.size;n>this._maxSize;){const e=this._notifyRemove(t,i,s.SOME);if(!(null!=e&&e>0))return void this._db.delete(t);n=e}r.size=n,this._size+=n,e.size+=n,this._checkSizeLimits()}}pop(e,t){t=e.id+t;const i=this._db.get(t);if(i)return this._size-=i.size,e.size-=i.size,this._db.delete(t),++this._hit,i.entry;++this._miss}get(e,t){t=e.id+t;const i=this._db.get(t);if(void 0!==i)return this._db.delete(t),i.lives=i.lifetime,this._db.set(t,i),++this._hit,i.entry;++this._miss}peek(e,t){const i=this._db.get(e.id+t);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach(((e,s)=>{const n=e.lifetime;i[n]=(i[n]||0)+e.size,this._users.forAll((i=>{const{id:n,name:r}=i;if(s.startsWith(n)){const i=t[r]||0;t[r]=i+e.size}}))}));const s={};this._users.forAll((e=>{const i=e.name;if("hitRate"in e&&"number"==typeof e.hitRate&&!isNaN(e.hitRate)&&e.hitRate>0){const n=t[i]||0;t[i]=n,s[i]=Math.round(100*e.hitRate)+"%"}else s[i]="0%"}));const n=Object.keys(t);n.sort(((e,i)=>t[i]-t[e])),n.forEach((i=>e[i]=Math.round(t[i]/2**20)+"MB / "+s[i]));for(let t=i.length-1;t>=0;--t){const s=i[t];s&&(e["Priority "+(t+-3-1)]=Math.round(s/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll((e=>e.resetHitRate()))}clear(e){const t=e.id;this._db.forEach(((e,i)=>{i.startsWith(t)&&(this._size-=e.size,this._db.delete(i),this._notifyRemove(i,e.entry,s.ALL))})),e.size=0}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,s.ALL))),this._users.forEach((e=>e.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i){let s;return this._removeFuncs.some((n=>{if(e.startsWith(n[0])){const e=n[1](t,i);return"number"==typeof e&&(s=e),!0}return!1})),s}_checkSizeLimits(){if(this._size>this._maxSize)for(const[e,t]of this._db)if(this._purgeItem(e,t),this._size<=.9*this.maxSize)return;this._users.forEach((e=>{if(e.maxSize>0&&e.size>e.maxSize)for(const[t,i]of this._db)if(t.startsWith(e.id)&&(this._purgeItem(t,i,e),e.size<=.9*e.maxSize))return}))}_purgeItem(e,t,i=this._users.find((t=>e.startsWith(t.id)))){if(this._db.delete(e),t.lives<=1){this._size-=t.size,i&&(i.size-=t.size);const n=this._notifyRemove(e,t.entry,s.SOME);null!=n&&n>0&&(this._size+=n,i&&(i.size+=n),t.lives=t.lifetime,t.size=n,this._db.set(e,t))}else--t.lives,this._db.set(e,t)}}let l=0},17445:(e,t,i)=>{i.d(t,{N1:()=>f,YP:()=>l,Z_:()=>p,gx:()=>c,nn:()=>g,on:()=>h,tX:()=>y}),i(66643),i(46791);var s=i(91460),n=i(50758),r=i(70586),a=i(95330),o=i(26258);function l(e,t,i={}){return u(e,t,i,d)}function c(e,t,i={}){return u(e,t,i,m)}function u(e,t,i={},s){let n=null;const a=i.once?(e,i)=>{s(e)&&((0,r.hw)(n),t(e,i))}:(e,i)=>{s(e)&&t(e,i)};if(n=(0,o.aQ)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return n}function h(e,t,i,a={}){let o=null,c=null,u=null;function h(){o&&c&&(c.remove(),a.onListenerRemove?.(o),o=null,c=null)}function f(e){a.once&&a.once&&(0,r.hw)(u),i(e)}const d=l(e,((e,i)=>{h(),(0,s.vT)(e)&&(o=e,c=(0,s.on)(e,t,f),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return u=(0,n.kB)((()=>{d.remove(),h()})),u}function f(e,t){return function(e,t,i){if((0,a.Hc)(i))return Promise.reject((0,a.zE)());const s=e();if(t?.(s))return Promise.resolve(s);let o=null;function l(){o=(0,r.hw)(o)}return new Promise(((s,r)=>{o=(0,n.AL)([(0,a.fu)(i,(()=>{l(),r((0,a.zE)())})),u(e,(e=>{l(),s(e)}),{sync:!1,once:!0},t??d)])}))}(e,m,t)}function d(e){return!0}function m(e){return!!e}i(87538);const p={sync:!0},g={initial:!0},y={sync:!0,initial:!0}},35463:(e,t,i)=>{i.d(t,{JE:()=>a,Nm:()=>r,rJ:()=>o}),i(80442);const s={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8},n={milliseconds:{getter:"getMilliseconds",setter:"setMilliseconds",multiplier:1},seconds:{getter:"getSeconds",setter:"setSeconds",multiplier:1},minutes:{getter:"getMinutes",setter:"setMinutes",multiplier:1},hours:{getter:"getHours",setter:"setHours",multiplier:1},days:{getter:"getDate",setter:"setDate",multiplier:1},weeks:{getter:"getDate",setter:"setDate",multiplier:7},months:{getter:"getMonth",setter:"setMonth",multiplier:1},years:{getter:"getFullYear",setter:"setFullYear",multiplier:1},decades:{getter:"getFullYear",setter:"setFullYear",multiplier:10},centuries:{getter:"getFullYear",setter:"setFullYear",multiplier:100}};function r(e,t,i){const s=new Date(e.getTime());if(t&&i){const e=n[i],{getter:r,setter:a,multiplier:o}=e;if("months"===i){const e=function(e,t){const i=new Date(e,t+1,1);return i.setDate(0),i.getDate()}(s.getFullYear(),s.getMonth()+t);s.getDate()>e&&s.setDate(e)}s[a](s[r]()+t*o)}return s}function a(e,t){switch(t){case"milliseconds":return new Date(e.getTime());case"seconds":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());case"minutes":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());case"hours":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours());case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate());case"weeks":return new Date(e.getFullYear(),e.getMonth(),e.getDate()-e.getDay());case"months":return new Date(e.getFullYear(),e.getMonth(),1);case"years":return new Date(e.getFullYear(),0,1);case"decades":return new Date(e.getFullYear()-e.getFullYear()%10,0,1);case"centuries":return new Date(e.getFullYear()-e.getFullYear()%100,0,1);default:return new Date}}function o(e,t,i){return 0===e?0:e*s[t]/s[i]}},16306:(e,t,i)=>{i.d(t,{aX:()=>I});var s=i(68773),n=i(20102),r=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),d=i(11282),m=i(17452);async function p(e,t,i){const s="string"==typeof e?(0,m.mN)(e):e,n=t[0].spatialReference,r=(0,f.Ji)(t[0]),a={...i,query:{...s.query,f:"json",sr:n.wkid??JSON.stringify(n),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.default)(s.path+"/simplify",a);var l;return function(e,t,i){const s=(0,f.q9)(t);return e.map((e=>{const t=s.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,r,n)}const g=r.Z.getLogger("esri.geometry.support.normalizeUtils");function y(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw g.error(e),new n.Z(e)}const i=(0,l.x3)(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],r=e[s][1],a=e[s+1][0],o=e[s+1][1],l=Math.sqrt((a-n)*(a-n)+(o-r)*(o-r)),c=(o-r)/l,u=(a-n)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=u*s+n,o=c*s+r;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,s=u*e+n,a=c*e+r;i.push([s,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:s,spatialReference:e.spatialReference}):new o.Z({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function _(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=(0,l.XZ)(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=(0,l.XZ)(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=(0,l.XZ)(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=(0,l.XZ)(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function b(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],r=t.geometries[s],a=(0,l.x3)(r);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=r.getPoint(e,i);r.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(n===i){if(y(e))for(const t of(0,l.x3)(r))e[n]=e[n].addRing(t);else if(x(e))for(const t of(0,l.x3)(r))e[n]=e[n].addPath(t)}else i=n,e[n]=r}return e}async function I(e,t,i){if(!Array.isArray(e))return I([e],t);t&&"string"!=typeof t&&g.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.default.geometryServiceUrl;let r,m,y,x,S,R,v,T,C=0;const k=[],F=[];for(const t of e)if(null!=t)if(r||(r=t.spatialReference,m=(0,c.C5)(r),y=r.isWebMercator,R=y?102100:4326,x=l.UZ[R].maxX,S=l.UZ[R].minX,v=l.UZ[R].plus180Line,T=l.UZ[R].minus180Line),m)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(_(t.clone(),x,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>_(e,x,S))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,m);F.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,S)*(2*x);let s=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(v)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,s=w(s,y),k.push(s),F.push("cut")):e.intersects(T)&&e.xmin!==S?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,s=w(s,y,360),k.push(s),F.push("cut")):F.push(s)}else F.push(t.clone());else F.push(t);else F.push(t);let M=(0,l.XZ)(C,x),z=-90;const P=M,D=new o.Z;for(;M>0;){const e=360*M-180;D.addPath([[e,z],[e,-1*z]]),z*=-1,M--}if(k.length>0&&P>0){const t=b(k,await async function(e,t,i,s){const n=(0,d.en)(e),r=t[0].spatialReference,a={...s,query:{...n.query,f:"json",sr:JSON.stringify(r),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.default)(n.path+"/cut",a),{cutIndexes:l,geometries:c=[]}=o.data;return{cutIndexes:l,geometries:c.map((e=>{const t=(0,f.im)(e);return t.spatialReference=r,t}))}}(n,k,D,i)),s=[],r=[];for(let i=0;i<F.length;i++){const n=F[i];if("cut"!==n)r.push(n);else{const n=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&n.rings.length>=a.rings.length?(s.push(n),r.push("simplify")):r.push(y?(0,u.$)(n):n)}}if(!s.length)return r;const a=await p(n,s,i),o=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?o.push(t):o.push(y?(0,u.$)(a.shift()):a.shift())}return o}const O=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)O.push(t);else{const e=k.shift();O.push(!0===y?(0,u.$)(e):e)}}return O}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var s=i(58901),n=i(82971),r=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.Z.WebMercator}),minus180Line:new s.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.Z({paths:[[[180,-180],[180,180]]],spatialReference:n.Z.WGS84}),minus180Line:new s.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:n.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,r.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ut});var s=i(43697),n=i(51773),r=i(20102),a=i(92604),o=i(16453),l=i(95330),c=i(17445),u=i(5600),h=i(75215),f=i(67676),d=i(80442),m=i(36030),p=i(52011),g=i(87085),y=i(17287),x=i(71612),w=i(17017),_=(i(66577),i(30030)),b=i(3172),I=i(71715),S=i(8744),R=i(66677),v=i(21506),T=i(35956),C=i(29876),k=i(45663),F=i(88281),M=i(11145),z=i(96674),P=i(609),D=i(39450),O=i(36679),Z=i(99815),N=i(73506),J=i(94139);const A=new Map,E=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.refCount--,e.refCount<=0&&(s.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.ts=Date.now(),e.refCount++,s.delete(i),s.set(i,e),e.block}return null}putBlock(e,t,i,s){const n=this._cachedBlocks,r=e+"/"+t;if(n.has(r)){const e=n.get(r);e.ts=Date.now(),e.refCount++}else n.set(r,{block:i,ts:Date.now(),refCount:1,controller:s});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,s=e+"/"+t;i.has(s)&&i.delete(s)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let s=0;s<t.length&&t[s][1].ts<=i-this._duration;s++)e.delete(t[s][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function B(e,t){return null==t?e:`${e}?sliceId=${t}`}function H(e,t,i){const s=A.get(e);if(!s)return null==t?E.decreaseRefCount(e,i):0;if(null==t||null==s[t])return E.decreaseRefCount(e,i);const n=s[t]?.cache,r=n?.get(i);if(n&&r){if(r.refCount--,0===r.refCount){n.delete(i);for(let e=0;e<s.length;e++)s[e]?.cache.delete(i);r.controller&&r.controller.abort()}return r.refCount}return 0}function L(e,t,i){const s=A.get(e);if(!s)return null==t?E.getBlock(e,i):null;if(null==t||null==s[t]){for(let e=0;e<s.length;e++){const t=s[e]?.cache.get(i);if(t)return t.refCount++,t.block}return E.getBlock(e,i)}const n=s[t]?.cache.get(i);if(n)return n.refCount++,n.block;for(let e=0;e<s.length;e++){if(e===t||!s[e])continue;const n=s[e]?.cache,r=n?.get(i);if(n&&r)return r.refCount++,n.set(i,r),r.block}return null}function W(e,t,i,s,n=null){const r=A.get(e);if(!r)return void(null==t&&E.putBlock(e,i,s,n));if(null==t||null==r[t])return void E.putBlock(e,i,s,n);const a={refCount:1,block:s,isResolved:!1,isRejected:!1,controller:n};s.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),r[t]?.cache.set(i,a)}function q(e,t,i){const s=A.get(e);s?null!=t&&null!=s[t]?s[t]?.cache.delete(i):E.deleteBlock(e,i):null==t&&E.deleteBlock(e,i)}var j=i(81578),G=i(75993),U=i(55914),V=i(80676),$=i(6570);let Y=class extends((0,P.v)(z.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,N.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:M.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,N.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,R.Nm)(e,a.Z.getLogger(this)))}async open(e){throw new r.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,s={}){const n=s.tileInfo||this.rasterInfo.storageInfo.tileInfo,r=this.getTileExtentFromTileInfo(e,t,i,n);return this.fetchPixels(r,n.size[0],n.size[1],s)}async identify(e,t={}){e=(0,h.TJ)(J.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:s}=t,{rasterInfo:n}=this,{hasMultidimensionalTranspose:r,multidimensionalInfo:a}=n;let{transposedVariableName:o}=t;const l=null!=a&&r&&(null!=s||(0,Z.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=n,{datumTransformation:f}=t;let d=(0,N.nF)(e,c,f);if(!u.intersects(d))return{location:d,value:null};if(null!=n.transform){const e=n.transform.inverseTransform(d);if(!n.nativeExtent.intersects(e))return{location:e,value:null};d=e}let m=0;const p=null!=o&&null!=a&&n.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(p)return e.identify(d,t);const{pixelSize:i}=n,s=3,r=i.x*s/2,a=i.y*s/2,o=new $.Z({xmin:d.x-r,xmax:d.x+r,ymin:d.y-a,ymax:d.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,s,s,l),{pixelBlock:h}=await this.fetchPixels(o,s,s,l);if(null==u)return{location:d,value:null};const f=Math.floor(s*s*.5),m=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let g;return null!=h&&(g=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:d,value:m,processedValue:g,pyramidLevel:0}}if(!p)if(t.srcResolution)m=(0,N.kr)(t.srcResolution,n,this.ioConfig.sampling).pyramidLevel;else if(m=await this.computeBestPyramidLevelForLocation(e,t),null==m)return{location:d,value:null};const g=this.identifyPixelLocation(d,m,null,p);if(null===g)return{location:d,value:null};const{row:y,col:x,rowOffset:w,colOffset:_,blockWidth:b}=g,I=o??t.sliceId,S=B(this.url,I),R=`${m}/${y}/${x}`;let v=L(S,null,R);null==v&&(v=this.fetchRawTile(m,y,x,t),W(S,null,R,v));const T=await v;if(null==T||!T.pixels?.length)return{location:d,value:null};const C=w*b+_;return this._processIdentifyResult(T,{srcLocation:d,position:C,pyramidLevel:m,useTransposedTile:!!p,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,s={}){e=(0,N.kZ)(e),s=this._getRequestOptionsWithSliceId(s);const{_hasNoneOrGCSShiftTransform:n}=this;if(s.requestRawData&&n)return this._fetchPixels(e,t,i,s);const r=(0,N.ut)(e.spatialReference),a=(0,N.Hq)(e);if(null==r||0===a||1===a&&this._isGlobalWrappableSource&&n)return this._fetchPixels(e,t,i,s);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(r/(c-l)*t),h=u-Math.round((r/2-l)/(c-l)*t);let f=0;const d=[];for(let n=0;n<=a;n++){const m=new $.Z({xmin:0===n?l:-r/2,xmax:n===a?c-r*n:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),p=0===n?u-h:n===a?t-f:u;f+=p,d.push(p);const g=s.disableWrapAround&&n>0?null:this._fetchPixels(m,p,i,s);o.push(g)}const m=(await Promise.all(o)).map((e=>e?.pixelBlock));let p=null;const g={width:t,height:i};return p=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:m,srcMosaicSize:g,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},s)).pixelBlock:(0,U.us)(m,g,{blockWidths:d}),{extent:e,srcExtent:(0,N.tB)(e,this.rasterInfo.spatialReference,s.datumTransformation),pixelBlock:p}}async fetchRawPixels(e,t,i,s={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const n=await this._fetchRawTiles(e,t,i,s),{nativeExtent:r,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new $.Z({xmin:r.xmin+c*t.x,xmax:r.xmin+c*(t.x+i.width-1),ymin:r.ymax-u*(t.y+i.height-1),ymax:r.ymax-u*t.y,spatialReference:r.spatialReference});if(!n)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=n;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:n.pixelBlocks[0]};const m=e>0?o.pyramidBlockWidth:o.blockWidth,p=e>0?o.pyramidBlockHeight:o.blockHeight,g={x:t.x%m,y:t.y%p};let y;return y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:i,clipOffset:g,clipSize:i,coefs:null,sampleSpacing:null,interpolation:s.interpolation,alignmentInfo:null,blockWidths:null},s)).pixelBlock:(0,U.us)(f,d,{clipOffset:g,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:y}}fetchRawTile(e,t,i,s){throw new r.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,N.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,G.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:s}=this.ioConfig,{range:n,query:r,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await(0,b.default)(e,{...t,query:{...r,...s},headers:{...a,...o}})}catch(s){if(i>0)return i--,this.request(e,t,i);throw s}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,Z.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,s){const n=s.lodAt(e);return this.getTileExtent({x:n.resolution,y:n.resolution},t,i,s.origin,s.spatialReference,s.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:s}=this.rasterInfo;if(!e.tileInfo){const n=[],r=e.maximumPyramidLevel||0;let a=Math.max(s.x,s.y),o=1/.0254*96*a;for(let e=0;e<=r;e++)n.push(new D.Z({level:r-e,resolution:a,scale:o})),a*=2,o*=2;const l=new J.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new M.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,s){const{width:n,height:r,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new J.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==s&&(s=Math.max(0,Math.round(Math.log(Math.max(n,r))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],s);e.storageInfo=new O.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:s,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,s,n,r=0,a=2){if(1===n.length&&r>0){n=[...n];let{x:e,y:t}=n[0];for(let i=0;i<r;i++)e*=a,t*=a,n.push({x:e,y:t})}const o=[],{x:l,y:c}=s;for(let s=0;s<n.length;s++){const{x:r,y:a}=n[s];o.push({minCol:Math.floor((e.xmin-l+.1*r)/t/r),maxCol:Math.floor((e.xmax-l-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:s}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const n=s**e;return{x:t.x*n,y:t.y*n}}identifyPixelLocation(e,t,i,s){const{spatialReference:n,nativeExtent:r,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=s&&null!=c?c.tileSize[0]:a.blockWidth,h=s&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,N.nF)(e,n,i);if(!r.intersects(f))return null;if(t<0||t>o)return null;const d=this.getPyramidPixelSize(t),{x:m,y:p}=d,g=(l.y-f.y)/p/h,y=(f.x-l.x)/m/u,x=Math.min(h-1,Math.floor((g-Math.floor(g))*h)),w=Math.min(u-1,Math.floor((y-Math.floor(y))*u));return{pyramidLevel:t,row:Math.floor(g),col:Math.floor(y),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,s,n,r){const[a,o]=r,l=s.x+i*a*e.x,c=l+a*e.x,u=s.y-t*o*e.y,h=u-o*e.y;return new $.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:n})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const s=this.rasterInfo.storageInfo.blockBoundary[e];return!s||s.maxRow<t||s.maxCol<i||s.minRow>t||s.minCol>i}async _fetchPixels(e,t,i,s={}){let n=(0,N.Hq)(e);if(n>=2)return{extent:e,pixelBlock:null};const r=this._getSourceDataInfo(e,t,i,s),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=r;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,d=f.transform,m="gcs-shift"===d?.type,p=null!=(0,N.ut)(e.spatialReference);!m&&p||(n=(0,N.Hq)(r.srcExtent,m));const g=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:n},s);if(!g)return{extent:e,srcExtent:l,pixelBlock:null};const y=f.storageInfo,x=a>0?y.pyramidBlockWidth:y.blockWidth,w=a>0?y.pyramidBlockHeight:y.blockHeight;let{x:_,y:b}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=y;if(null!=e&&e[a-1])({x:_,y:b}=e[a-1]);else{const e=t**a;_*=e,b*=e}}const I=f.spatialReference,S=new J.Z({x:_,y:b,spatialReference:I}),R=x===c&&w===u&&h.x%x==0&&h.y%w==0,v=new J.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(I),C=I.isGeographic?1e-9:1e-4,{datumTransformation:k}=s;if(!T&&R&&1===g.pixelBlocks.length&&x===t&&w===i&&this._isSameResolution(o,v,C))return{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:g.pixelBlocks[0]};const F=p&&null!=(0,N.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,M=s.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");M&&!this.rasterJobHandler&&await(0,N.zD)();const z=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:v.toJSON(),datumTransformation:k,rasterTransform:d,hasWrapAround:n>0||F,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:M},s):(0,N.Qp)({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:v,datumTransformation:k,rasterTransform:d,hasWrapAround:n>0||F,isAdaptive:!1,includeGCSGrid:M});let P;const D=!s.requestRawData,O={rows:z.spacing[0],cols:z.spacing[1]},Z=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,g.extent.xmin):void 0,{pixelBlocks:A,mosaicSize:E,isPartiallyFilled:B}=g;let H=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:E,destDimension:D?{width:t,height:i}:null,coefs:D?z.coefficients:null,sampleSpacing:D?O:null,projectDirections:M,gcsGrid:M?z.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:s.interpolation,alignmentInfo:Z,blockWidths:null},s);({pixelBlock:P,localNorthDirections:H}=e)}else{const e=(0,U.us)(A,E,{alignmentInfo:Z});P=D?(0,U.Uk)(e,{width:t,height:i},z.coefficients,O,s.interpolation):e,M&&z.gcsGrid&&(H=(0,U.Qh)({width:t,height:i},z.gcsGrid),P=(0,V.xQ)(P,this.rasterInfo.dataType,H))}return s.requestRawData||M?{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:P,transformGrid:z,localNorthDirections:H,isPartiallyFilled:B}:{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:P}}async _fetchRawTiles(e,t,i,s){const{origin:n,blockBoundary:r}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const d=this._getRasterTileAlignmentInfo(e,0);s.buffer&&(l-=s.buffer.cols,c-=s.buffer.rows,u+=2*s.buffer.cols,h+=2*s.buffer.rows);let m=0,p=0,g=0;f&&null!=d&&(({worldColumnCountFromOrigin:p,originColumnOffset:g,rightPadding:m}=d),p*d.blockWidth-m>=l+u&&(m=0));const y=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+m-1)/a),_=Math.floor((c+h+m-1)/o),b=r[e];if(!b)return null;const{minRow:I,minCol:S,maxCol:R,maxRow:v}=b;if(0===f&&(_<I||w<S||x>v||y>R))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?s.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=_;t++)for(let i=y;i<=w;i++){let n=i;if(!s.disableWrapAround&&f&&null!=d&&p<=i&&(n=i-p-g),t>=I&&n>=S&&v>=t&&R>=n){const i=this._fetchRawTile(e,t,n,s);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const F=await Promise.all(T),M={height:(_-x+1)*o,width:(w-y+1)*a},{spatialReference:z}=this.rasterInfo,P=this.getPyramidPixelSize(e),{x:D,y:O}=P;return{extent:new $.Z({xmin:n.x+y*a*D,xmax:n.x+(w+1)*a*D,ymin:n.y-(_+1)*o*O,ymax:n.y-x*o*O,spatialReference:z}),pixelBlocks:F,mosaicSize:M,isPartiallyFilled:C}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,s){const n=this.rasterInfo.storageInfo.blockBoundary[e];if(!n)return Promise.resolve(null);const{minRow:r,minCol:a,maxCol:o,maxRow:c}=n;if(t<r||i<a||t>c||i>o)return Promise.resolve(null);const u=B(this.url,s.sliceId),h=`${e}/${t}/${i}`;let f=L(u,s.registryId,h);if(null==f){const n=new AbortController;f=this.fetchRawTile(e,t,i,{...s,signal:n.signal}),W(u,s.registryId,h,f,n),f.catch((()=>q(u,s.registryId,h)))}return s.signal&&(0,l.fu)(s,(()=>{H(u,s.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const s=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[n,r]=e,a=[],o=[];for(let e=0;e<s;e++){const[t,i]=(0,V.Tg)([n[e],r[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,N.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,s={}){const n={datumTransformation:s.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};s.srcResolution&&(n.srcResolution=s.srcResolution,this._updateSourceDataInfo(e,n));const r=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=n,c=a/t,u=o/i,h=l<r&&c*u>=16,f=l===r&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new J.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,N.VO)(a,this.rasterInfo.spatialReference,e,n.datumTransformation);const f=!o||s.srcResolution&&o.x+o.y<s.srcResolution.x+s.srcResolution.y;if(h&&s.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(r-l+3>=e){const t=2**e;o={x:s.srcResolution.x*t,y:s.srcResolution.y*t}}}o&&(n.srcResolution=o,this._updateSourceDataInfo(e,n))}return this._requireTooManySrcTiles(n.srcWidth,n.srcHeight,t,i)&&(n.srcWidth=0,n.srcHeight=0),n}_requireTooManySrcTiles(e,t,i,s){const{tileInfo:n}=this.rasterInfo.storageInfo;return Math.ceil(e/n.size[0])*Math.ceil(t/n.size[1])>=256||e/i>8||t/s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,s=i.spatialReference,{srcResolution:n,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,N.kr)(n,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,N.tB)(e,s,r);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,d=Math.floor((c.xmin-h)/o.x+.1),m=Math.floor((f-c.ymax)/o.y+.1),p=Math.floor((c.xmax-h)/o.x-.1),g=Math.floor((f-c.ymin)/o.y-.1),y=c.width<.1*o.x?0:p-d+1,x=c.height<.1*o.y?0:g-m+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=y,t.srcHeight=x,t.ul={x:d,y:m}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:s,pyramidLevel:n,useTransposedTile:r}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[s])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!r){const t=e.pixels.map((e=>e[s])),r={location:i,value:t,pyramidLevel:n},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(r.magdirValue=a.map((e=>e[0]))),r}let l=e.pixels.map((e=>e.slice(s*a,s*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,Z.MO)(o,h.transposedVariableName);if(u){const e=(0,Z.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const d=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:l,pixelType:e.pixelType};let p;return null!=d&&((0,j.A)(m,d),p=m.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===p?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new T.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:n}}};(0,s._)([(0,u.Cb)()],Y.prototype,"_rasterTileAlighmentInfo",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],Y.prototype,"_isGlobalWrappableSource",null),(0,s._)([(0,u.Cb)({readOnly:!0})],Y.prototype,"_hasNoneOrGCSShiftTransform",null),(0,s._)([(0,u.Cb)()],Y.prototype,"rasterJobHandler",null),(0,s._)([(0,u.Cb)(v.HQ)],Y.prototype,"url",null),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetName",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"hasUniqueSourceStorageInfo",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"rasterInfo",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"ioConfig",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"sourceJSON",void 0),Y=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.BaseRaster")],Y);const X=Y;var K=i(74889);let Q=class extends X{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:s}=this.primaryRasters,n=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(n);const a=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:a,rasterIds:s});if(!o.success||0===a.length)throw new r.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=K.Z.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((e=>this._hasSameStorageInfo(e,c))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,s={}){const{rasters:n,rasterIds:r}=this.primaryRasters;let a=!1;const{interpolation:o}=s,l=this.rasterFunction.flatWebGLFunctionChain?.hasSurfaceFunction;!s.requestRawData&&"bilinear"!==o&&l&&(a=1===n.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:a});const c=n.map((n=>n.fetchPixels(e,t,i,s))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||s.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((e=>null==e)))return u[0];const d=u.find((e=>null!=e.pixelBlock))?.extent??e,m=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}),{transformGrid:p}=u[0];if(!a||null==m||null==p)return{...u[0],pixelBlock:m};const g={rows:p.spacing[0],cols:p.spacing[1]};let y;return y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[m],srcMosaicSize:{width:m.width,height:m.height},destDimension:{width:t,height:i},coefs:p.coefficients,sampleSpacing:g,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock:(0,U.Uk)(m,{width:t,height:i},p.coefficients,g,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:y}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:s,spatialReference:n,extent:r}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return s.x===o.x&&s.y===o.y&&n.equals(l)&&r.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"tileType",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"rasterFunction",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"primaryRasters",void 0),Q=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.FunctionRaster")],Q);const ee=Q;var te=i(67900),ie=i(5847);var se=i(40932),ne=i(15612),re=i(67058),ae=i(72758),oe=i(79681),le=i(23808),ce=i(82971);const ue=a.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),he=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",(0,R.Nm)(e,ue))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer;return(0,_.ij)(s,i)||void 0}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,s=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:s},t):(0,V.KC)(e,s)}async computeStatisticsHistograms(e,t){e=(0,h.TJ)(oe.Z,e).clone();const{rasterInfo:s}=this,{geometry:n}=e;if(null==n)throw new r.Z("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let a=n;const{spatialReference:o}=s;n.spatialReference.equals(o)||(await(0,N.zD)(),a="extent"===n.type?(0,N.tB)(n,o):(0,N.Wt)(n,o));const l=e.pixelSize??new J.Z({x:s.pixelSize.x,y:s.pixelSize.y,spatialReference:o}),{extent:c,width:u,height:f}=function(e,t,i,s=!0){const{spatialReference:n}=e,{x:r,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,te.c9)(e.spatialReference),s=(0,te.c9)(t);if(i===s)return e;const n=i/s;return{x:e.x*n,y:e.y*n}}(i,n);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:d,ymin:m}=u;const{xmin:p,ymax:g}=e.extent;return s?(h=p+(h>p?r*Math.round((h-p)/r):0),d=g-(d<g?a*Math.round((g-d)/a):0),f=p+(f>p?r*Math.round((f-p)/r):0),m=g-(m<g?a*Math.round((g-m)/a):0),o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:m,spatialReference:n}),l=Math.round(o.width/r),c=Math.round(o.height/a)):(l=Math.floor((f-h)/r+.8),c=Math.floor((d-m)/a+.8),h=p+(h>p?r*Math.floor((h-p)/r+.1):0),d=g-(d<g?a*Math.floor((g-d)/a+.1):0),f=h+l*r,m=d-c*a,o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:m,spatialReference:n})),{extent:o,width:l,height:c}}(s,a,l),d=await this.fetchPixels(c,u,f,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new r.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const m=await async function(e,t,s){if("extent"===s.type)return function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n;if(i.width/a<.5||i.height/o<.5)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:d,ymin:m,ymax:p}=i,g=Math.max(l,f),y=Math.min(c,d),x=Math.max(u,m),w=Math.min(h,p),_=.5*a,b=.5*o;if(y-g<_||w-x<b||y<l+_||g>c-_||x>h-b||w<u+b)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const I=Math.max(0,(g-l)/a),S=Math.min(s,Math.max(0,(y-l)/a)),R=Math.max(0,(h-w)/o),v=Math.min(n,Math.max(0,(h-x)/o)),T=Math.round(I),C=Math.round(S)-1,k=Math.round(R),F=Math.round(v)-1;if(T===C&&I%1>.5&&S%1<.5||k===F&&R%1>.5&&v%1<.5)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});if(0===T&&0===k&&C===s&&F===n)return e;const M=e.mask;for(let e=k;e<=F;e++)for(let t=T;t<=C;t++){const i=e*s+t;r[i]=M?M[i]:255}return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s);const{width:n,height:r}=e,a=new Uint8Array(n*r),{contains:o,intersects:l}=await Promise.all([i.e(5837),i.e(1433)]).then(i.bind(i,61433));return l(t,s)?"polyline"===s.type?function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n,{xmin:l,ymax:c}=t,{paths:u}=i,h=e.mask;for(let e=0;e<u.length;e++){const t=u[e];for(let e=0;e<t.length-1;e++){const[i,u]=t[e],[f,d]=t[e+1];let m=Math.floor((c-u)/o),p=Math.floor((c-d)/o);if(p<m){const e=m;m=p,p=e}m=Math.max(0,m),p=Math.min(n-1,p);const g=(f-i)/(d-u);for(let e=m;e<=p;e++){const t=e===m?Math.max(u,d):(n+1-e)*o,c=e===p?Math.min(u,d):t-o;let y=d===u?Math.floor((i-l)/a):Math.floor((g*(t-u)+i-l)/a),x=d===u?Math.floor((f-l)/a):Math.floor((g*(c-u)+i-l)/a);if(x<y){const e=y;y=x,x=e}const w=e*s;y=Math.max(0,y),x=Math.min(s-1,x);for(let e=w+y;e<=w+x;e++)r[e]=h?h[e]:255}}}return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s):o(s,t)?e:function(e,t,i){if(!e)return e;const{width:s,height:n}=e,r=t.width/s,a=t.height/n,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/r,t=(i.xmax-o)/r,s=(l-i.ymax)/a,n=(l-i.ymin)/a;c=[[[e,s],[e,n],[t,n],[t,s],[e,s]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/r,(l-t)/a]))));const u=document.createElement("canvas");u.width=s,u.height=n;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,s,n).data,d=e.mask,m=s*n,p=new Uint8Array(m);for(let e=0;e<m;e++)d&&!d[e]||(p[e]=f[4*e+3]>127?255:0);return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:p,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,s):new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}(d.pixelBlock,c,a),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:m},t):(0,ne.js)(m)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,le.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,Z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const s=e.timeExtent||this.timeExtent;if(null!=i&&null!=s&&(null!=s.start||null!=s.end)){i=i.map((e=>e.clone()));const n=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),r=i.find((({dimensionName:e})=>"StdTime"===e));if(!n||!r)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=s,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=n.values){const e=n.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>{const i=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:e,n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:t;return u===h?i-n:Math.abs(s-h)-Math.abs(r-h)}))[0];r.values=[t]}else i=null}else if(n.hasRegularIntervals&&n.extent){const[e,t]=n.extent;u>t||h<e?i=null:r.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,Z.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",k.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:s}=this;if(s){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const n=(0,se.Ue)(s.functionDefinition?.toJSON()??s.toJSON(),i),r=new ee({rasterFunction:n});r.rasterJobHandler=this._rasterJobHandler.instance,await r.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=r}else this.raster=t,this._cachedRasterFunctionJson=null,await t.when();if(this._cachedRendererJson=null,!i&&!s)return;const{bandIds:n}=this,{bandCount:r}=this.raster.rasterInfo,a=n?.length?n.some((e=>e>=r)):r>=3;n&&(a||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:i}=this.raster,s=(0,Z.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,r=(0,re.ol)({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(r))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,re.FI)(i,n),t.rendererJSON=r,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=r)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let s;await this.updateRenderer();const n=this._rasterJobHandler.instance,r=this.bandIds??[];return s=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:r}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:r}),s}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const s=(0,S.C5)(e);return M.Z.create({size:256,spatialReference:e,origin:s?{x:s.origin[0],y:s.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,s={}){if(n(this),s.requestAsImageElement){const n=this.getTileUrl(e,t,i);return(0,b.default)(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{rasterInfo:r}=this;if(null!=r.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const n=s.tileInfo||r.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,i,n),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,i,s)}async fetchPixels(e,t,i,s={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,s))}async identify(e,t={}){const{raster:i,rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&!(s.hasMultidimensionalTranspose&&((0,Z.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new r.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,Z.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,Z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new F.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{n(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){n(this);const{raster:e}=this,t=(0,re.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){n(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,re.YD)(t));const i=(0,Z.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name;if(!this.renderer||"override"===e){const e=(0,re.Ob)(t,{bandIds:this.bandIds,variableName:s}),i=t.statistics,n=i&&i.length>0?i[0]:null,r=n?.max??0,a=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(r>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const r=(0,re.ol)({...this.renderer.toJSON(),variableName:s}),a=(0,re.FI)(t,s);this.symbolizer?(this.symbolizer.rendererJSON=r,this.symbolizer.rasterInfo=a):this.symbolizer=new ae.Z({rendererJSON:r,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=(0,re.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else ue.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function n(e){if(!e.raster||!e.rasterInfo)throw new r.Z("imagery-tile","no raster")}return(0,s._)([(0,u.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_cachedRasterFunctionJson",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"bandIds",void 0),(0,s._)([(0,u.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,s._)([(0,u.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,s._)([(0,u.Cb)()],t.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"ioConfig",void 0),(0,s._)([(0,u.Cb)({type:[T.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,s._)([(0,u.Cb)({type:C.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"raster",void 0),(0,s._)([(0,u.Cb)({type:k.Z,json:{name:"renderingRule",write:!0}})],t.prototype,"rasterFunction",null),(0,s._)([(0,u.Cb)()],t.prototype,"rasterInfo",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"sourceJSON",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:ce.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,s._)([(0,u.Cb)({type:M.Z})],t.prototype,"tileInfo",void 0),(0,s._)([(0,u.Cb)(v.HQ)],t.prototype,"url",null),(0,s._)([(0,u.Cb)({types:_.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:_.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,s._)([(0,I.r)("renderer")],t.prototype,"readRenderer",null),(0,s._)([(0,u.Cb)()],t.prototype,"symbolizer",void 0),t=(0,s._)([(0,p.j)("esri.layers.ImageryTileMixin")],t),t};var fe=i(38009),de=i(16859),me=i(34760),pe=i(72965),ge=i(28294),ye=i(1231),xe=i(69608),we=i(25972),_e=i(20095);function be(e){const t=e.fields,i=e.records,s=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",n=[{name:s,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),r=n.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[s]=o++,l=1;l<r.length;l++)t[r[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:n,features:a}}class Ie{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const s=t.getUint32(4,!0),n=t.getUint16(8,!0),r=t.getUint16(10,!0),a={version:i,recordCount:s,headerByteCount:n,recordByteCount:r};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,_e.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<s&&e.byteLength-o>r;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,_e.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const s=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(s.substring(0,4),10),parseInt(s.substring(4,6),10)-1,parseInt(s.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=r}}return{header:a,fields:l,records:c,recordSet:be({fields:l,records:c})}}}var Se=i(87521);const Re=new Map;Re.set("int16","esriFieldTypeSmallInteger"),Re.set("int32","esriFieldTypeInteger"),Re.set("int64","esriFieldTypeInteger"),Re.set("float32","esriFieldTypeSingle"),Re.set("float64","esriFieldTypeDouble"),Re.set("text","esriFieldTypeString");let ve=class extends X{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new r.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:s}=this._parseHeader(t);if("thematic"===s.dataType){const e=await this._fetchAuxiliaryInformation();s.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",s),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,s={}){const{transposeInfo:n}=this.rasterInfo.storageInfo,{transposedVariableName:r}=s,a=!(!n||!r),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,s.multidimensionalDefinition,r),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:s.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const d=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:s.signal});if(!d)return null;const[m,p]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:m,height:p,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,histograms:s,colormap:n,blockWidth:r,blockHeight:a,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ce.Z(u?.wkid||u?.wkt?u:h);let d=new $.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const m=new J.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),p=Math.round((d.xmax-d.xmin)/m.x),g=Math.round((d.ymax-d.ymin)/m.y),y=this._parseTransform(e.geodataXform),x=y?d:null;y&&(d=y.forwardTransform(d),m.x=(d.xmax-d.xmin)/p,m.y=(d.ymax-d.ymin)/g);const w=e.properties??{},_=e.format.toLowerCase().replace("cache/",""),b=new J.Z(e.origin.x,e.origin.y,f);let I,S,R,v;if(n&&n.colors)for(I=[],S=0;S<n.colors.length;S++)R=n.colors[S],v=n.values?n.values[S]:S,I.push([v,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const T=e.LODInfos,C=[];for(S=0;S<T.levels.length;S++)C.push(new D.Z({level:T.levels[S],resolution:T.resolutions[S],scale:96/.0254*T.resolutions[S]}));const k=new M.Z({dpi:96,lods:C,format:_,origin:b,size:[r,a],spatialReference:f}),F={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},z=[{maxCol:Math.ceil(p/r)-1,maxRow:Math.ceil(g/a)-1,minCol:0,minRow:0}];let P=2;if(l>0)for(S=0;S<l;S++)z.push({maxCol:Math.ceil(p/P/r)-1,maxRow:Math.ceil(g/P/a)-1,minCol:0,minRow:0}),P*=2;const Z=e.mdInfo;let N=null;if(Z&&w._yxs){const e=w._yxs;N={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:F,rasterInfo:new we.Z({width:p,height:g,pixelType:t,bandCount:i,extent:d,nativeExtent:x,transform:y,spatialReference:f,pixelSize:m,keyProperties:w,statistics:c,histograms:s,multidimensionalInfo:Z,colormap:I,storageInfo:new O.Z({blockWidth:r,blockHeight:a,pyramidBlockWidth:r,pyramidBlockHeight:a,origin:b,tileInfo:k,transposeInfo:N,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:z})})}}_parseTransform(e){if(!(0,Se.j)(e))throw new r.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,Se.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new r.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),s=await Promise.all([t,i]);let n;if(s[0]){let e=s[0].fields;const t=s[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":Re.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(n={fields:e,features:i})}}return!n&&s[1]&&(n=Ie.parse(s[1]).recordSet),K.Z.fromJSON(n)}_buildCacheFilePath(e,t,i,s,n){const r=this._getPackageSize(!!n),a=Math.floor(t/r)*r,o=Math.floor(i/r)*r,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=s?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!n){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(n||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replaceAll(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const s=this._getPackageSize(i),n=s*(e%s)+t%s;if(n<0)throw new Error("Invalid level / row / col");return 20+n*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let s,n=0;for(s=0;s<5;s++)n|=(255&i[s])<<8*s;const r=0xffffffffff&n;for(n=0,s=5;s<8;s++)n|=(255&i[s])<<8*(s-5);return{position:r,recordSize:0xffffffffff&n}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,s._)([(0,u.Cb)({readOnly:!0})],ve.prototype,"storageInfo",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],ve.prototype,"datasetFormat",void 0),ve=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.CloudRaster")],ve);const Te=ve;let Ce=class extends X{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:s,histograms:n,name:r,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new $.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ce.Z({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,m={x:f.width/c,y:f.height/u},p=new we.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:m,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:s,isPseudoSpatialReference:d,histograms:n});this.createRemoteDatasetStorageInfo(p,512,512),this._set("rasterInfo",p),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=r,this.url="/InMemory/"+r}fetchRawTile(e,t,i,s={}){const n=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(n)}async _buildInMemoryRaster(e,t,i){const s=this.rasterInfo.storageInfo.maximumPyramidLevel,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:s},i):Promise.resolve((0,U.Vl)(e,t,s)),a=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,c=a?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,ne.Hv)(e)),u=await(0,l.as)([n,c]);if(!u[0].value&&u[1].value)throw new r.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,a||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ce.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Ce.prototype,"data",void 0),Ce=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],Ce);const ke=Ce;function Fe(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=[];if(t){const n=Fe(e,i);for(let e=0;e<n.length;e++)Fe(n[e],t).forEach((e=>s.push(e)));return s}const n=e.getElementsByTagNameNS("*",i);if(!n||0===n.length)return[];for(let e=0;e<n.length;e++)s.push(n[e]||n.item(e));return s}function Me(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=Fe(e,i);return s.length>0?t?Me(s[0],t):s[0]:null}function ze(e,t=null){const i=t?Me(e,t):e;let s;return i?(s=i.textContent||i.nodeValue,s?s.trim():null):null}function Pe(e,t){return function(e,t){const i=Fe(e,t),s=[];let n;for(let e=0;e<i.length;e++)n=i[e].textContent||i[e].nodeValue,n&&(n=n.trim(),""!==n&&s.push(n));return s}(e,t).map((e=>Number(e)))}function De(e,t){const i=ze(e,t);return Number(i)}function Oe(e,t){const i=e?.nodeName?.toLowerCase(),s=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===s}var Ze=i(87390);function Ne(e,t){if(!e||!t)return null;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),i.push(t[s]);return i}function Je(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ce.Z({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),s=e.indexOf("PROJCS"),n=s>-1?s:e.indexOf("GEOGCS");if(-1===n)return null;const r=e.slice(n,e.lastIndexOf("]",i)+1).trim(),a=e.slice(i,e.lastIndexOf("]")).trim();t=Ae(r);const o=new ce.Z(t?{wkid:t}:{wkt:r}),l=Ae(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ae(e),new ce.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ae(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),s=i[0]?.toLowerCase();if(("epsg"===s||"esri"===s)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ee(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Oe(e,"SRS")){if(!t.spatialReference){const i=ze(e);t.spatialReference=Je(i)}}else if(Oe(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:s}=function(e){const t=Me(e,"GeodataXform"),i=Je(De(t,"SpatialReference/WKID")||ze(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const s=De(t,"PolynomialOrder")??1,n=Pe(t,"CoeffX/Double"),r=Pe(t,"CoeffY/Double"),a=Pe(t,"InverseCoeffX/Double"),o=Pe(t,"InverseCoeffY/Double"),l=Ne(n,r),c=Ne(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Ze.Z({spatialReference:i,polynomialOrder:s,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=s,t.spatialReference||(t.spatialReference=i)}else Fe(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=ze(e)));else if(Oe(e,"PAMRasterBand")){const i=function(e){const t=De(e,"NoDataValue"),i=Me(e,"Histograms/HistItem"),s=De(i,"HistMin"),n=De(i,"HistMax"),r=De(i,"BucketCount"),a=ze(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Fe(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=De(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=s&&null!=n?{min:s,max:n,size:r||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(f.pC):null;const s=!!i[0].histogram;t.histograms=s?i.map((e=>e.histogram)).filter(f.pC):null}return t}let Be=class extends X{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:s,histograms:n,transform:r}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ce.Z({wkid:3857})),n?.length&&null==s&&(s=(0,ne.Oh)(n));const{width:o,height:l}=t;let c=new $.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=r?r.forwardTransform(c):c;let h=!0;if(r){const e=r.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(r=null,c=u)}const f=new ke({data:{extent:u,nativeExtent:c,transform:r,pixelBlock:t,statistics:s,histograms:n,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,G.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new r.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const s=i.toLowerCase(),n="gif"===s||"bmp"===s||!(0,d.Z)("ios"),a=await this.decodePixelBlock(t,{format:s,useCanvas:n,hasNoZlibMask:!0});if(null==a)throw new r.Z("image-aux-raster:open","the data cannot be decoded");return a}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],s=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),n=this.datasetFormat,r="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,a=r&&i.includes(r)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+r,{responseType:"text",signal:t}),o=await(0,l.as)([s,a]);if(t?.aborted)throw(0,l.zE)();const c=Ee(o[0].value?.data);if(!c.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;c.transform=6===e?.length?new Ze.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return c}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Be.prototype,"datasetFormat",void 0),Be=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],Be);const He=Be;var Le=i(70586),We=i(17452),qe=i(28589),je=i(29680),Ge=i(26059);let Ue=class extends X{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const s=i.data;if(this.sourceJSON=s,!s)throw new r.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!s.tileInfo)throw new r.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=s.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(s.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===s.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=s.name?.slice(s.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:t});if(null==n)throw new r.Z("image-server-raster:open","cannot initialize image service");const a="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:n,maxLOD:r}=t;if(null!=n&&null!=r)return M.Z.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=n&&e<=r))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,n=i?t(i):1/0,r=s?t(s):-1/0;return M.Z.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=n&&i>=r}))})}return M.Z.fromJSON(e)}(s.tileInfo,s):M.Z.fromJSON(s.tileInfo);(0,Le.O3)(a);const[o,l]=this._computeMinMaxLOD(n,a),{extent:c,pixelSize:u}=n,h=.5/n.width*u.x,f=Math.max(u.x,u.y),{lods:d}=a;("Map"!==this.tileType&&0!==s.maxScale||Math.abs(u.x-u.y)>h||!d.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,n.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),n.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const m=o.level-l.level,[p,g]=a.size,y=[],x=[];d.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&y.push({x:e.resolution,y:e.resolution}),t<d.length-1&&x.push(Math.round(10*e.resolution/d[t+1].resolution)/10)})),y.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,p,g,a.origin,y,m),_=y.length>1?y.slice(1):null;let b;s.transposeInfo&&(b={tileSize:[s.transposeInfo.rows,s.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0});const I=x.length<=1||x.length>=3&&x.slice(0,x.length-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/m))/10;if(n.storageInfo=new O.Z({blockWidth:a.size[0],blockHeight:a.size[1],pyramidBlockWidth:a.size[0],pyramidBlockHeight:a.size[1],pyramidResolutions:_,pyramidScalingFactor:I,compression:a.format,origin:a.origin,firstPyramidLevel:1,maximumPyramidLevel:m,tileInfo:a,transposeInfo:b,blockBoundary:w}),this._fixGCSShift(n),this._set("rasterInfo",n),s.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:(0,We.mN)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new qe.y({layer:e})}}async fetchRawTile(e,t,i,s={}){const{storageInfo:n,extent:r}=this.rasterInfo,{transposeInfo:a}=n,o=null!=a&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const l=o?0:n.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:s.signal});if(!h)return null;const f=o?a.tileSize:n.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const m=n.blockBoundary[e];if("jpg"!==n.compression||i>m.minCol&&i<m.maxCol&&t>m.minRow&&t<m.maxRow)return d;const{origin:p,blockWidth:g,blockHeight:y}=n,{x,y:w}=this.getPyramidPixelSize(e),_=Math.round((r.xmin-p.x)/x)%g,b=Math.round((r.xmax-p.x)/x)%g||g,I=Math.round((p.y-r.ymax)/w)%y,S=Math.round((p.y-r.ymin)/w)%y||y,R=i===m.minCol?_:0,v=t===m.minRow?I:0,T=i===m.maxCol?b:g,C=t===m.maxRow?S:y;return(0,U.pW)(d,{x:R,y:v},{width:T-R,height:C-v}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([i,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:n[0]||null,histograms:n[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:n}=this.rasterInfo.storageInfo;let r=n-s+this._levelOffset;const a=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,s++,i=this.identifyPixelLocation(a,s,t.datumTransformation),null===i)return null}return-1===r||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),n=ce.Z.fromJSON(t.spatialReference||e.spatialReference),r=new J.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n});return new we.Z({width:i,height:s,bandCount:3,extent:$.Z.fromJSON(e),spatialReference:n,pixelSize:r,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=(0,Ge.g)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),n=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,r=await Promise.all([s,n]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new je.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:n}=t,r=t.lodAt(Math.max.apply(null,n.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,n.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=n[0].level,[r,a];if("Raster"===o)return[n.find((e=>e.resolution===i.x))??r,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=n.find((e=>Math.abs(e.scale-c)<s)),u||(u=n.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??r));let h=a;return l>0&&(h=n.find((e=>Math.abs(e.scale-l)<s))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ue.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Ue.prototype,"tileType",void 0),Ue=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],Ue);const Ve=Ue;var $e=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Xe=new Map;Xe.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Xe.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Xe.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Xe.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Ke=class extends X{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:s,files:n}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(s.statistics=t.statistics??s.statistics,s.histograms=t.histograms,t.histograms&&null==s.statistics&&(s.statistics=(0,ne.Oh)(t.histograms)))}this._set("rasterInfo",s),this._files=n;const r=await this.request(n.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(r.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,m=-1;for(;d<this._storageIndex.length;){m++;const e=Math.ceil(c/a/l**m)-1,t=Math.ceil(u/o/l**m)-1;d+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,m>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=m),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){const{blockWidth:n,blockHeight:r,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(n*r);return new ie.Z({width:n,height:r,pixels:null,mask:e,validPixelCount:0})}const{bandIds:d}=this.ioConfig,m=this._getBandSegmentCount(),p=[];let g=0;for(g=0;g<m;g++)d&&!d.includes(g)||p.push(this.request(this._files.data,{range:{from:u[g].from,to:u[g].to},responseType:"array-buffer",signal:s.signal}));const y=await Promise.all(p),x=y.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let _=0;for(g=0;g<m;g++)w.set(new Uint8Array(y[g].data),_),_+=y[g].data.byteLength;const b=Xe.get(this.rasterInfo.storageInfo.compression).decoderFormat,I=await this.decodePixelBlock(w.buffer,{width:n,height:r,format:b,planes:d?.length||l,pixelType:c});if(null==I)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==b&&!I.mask&&(S=S[0],null!=S)){const e=I.width*I.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(g=0;g<e;g++)Math.abs((I.pixels[0][g]-S)/S)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)I.pixels[0][g]!==S&&(t[g]=1);I.mask=t}let R=0,v=0;if(h!==n||f!==r){let e=I.mask;if(e)for(g=0;g<r;g++)if(v=g*n,g<f)for(R=h;R<n;R++)e[v+R]=0;else for(R=0;R<n;R++)e[v+R]=0;else for(e=new Uint8Array(n*r),I.mask=e,g=0;g<f;g++)for(v=g*n,R=0;R<h;R++)e[v+R]=1}return I}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,s,n,r,a;if($e.f){for(i=new Uint8Array(e),n=new ArrayBuffer(e.byteLength),s=new Uint8Array(n),r=0;r<e.byteLength/4;r++)for(a=0;a<4;a++)s[4*r+a]=i[4*r+3-a];t=new Uint32Array(n)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Xe.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:s,blockHeight:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,d=0;for(h=0;h<e;h++)d=r**h,c=Math.ceil(a/s/d),u=Math.ceil(o/n/d),f+=c*u;d=r**e,c=Math.ceil(a/s/d),u=Math.ceil(o/n/d),f+=t*c+i,f*=4*l;const m=this._storageIndex.subarray(f,f+4*l);let p=0,g=0;const y=[];for(let e=0;e<l;e++)p=m[4*e]*2**32+m[4*e+1],g=p+m[4*e+2]*2**32+m[4*e+3],y.push({from:p,to:g});return{ranges:y,actualTileWidth:i<c-1?s:Math.ceil(a/d)-s*(c-1),actualTileHeight:t<u-1?n:Math.ceil(o/d)-n*(u-1)}}_parseHeader(e){const t=Me(e,"MRF_META/Raster");if(!t)throw new r.Z("mrf:open","not a valid MRF format");const i=Me(t,"Size"),s=parseInt(i.getAttribute("x"),10),n=parseInt(i.getAttribute("y"),10),a=parseInt(i.getAttribute("c"),10),o=(ze(t,"Compression")||"none").toLowerCase();if(!Xe.has(o))throw new r.Z("mrf:open","currently does not support compression "+o);const l=ze(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new r.Z("mrf:open","currently does not support pixel type "+l);const u=Me(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),d=Me(t,"DataValues");let m,p;if(d&&(p=d.getAttribute("NoData"),null!=p&&(m=p.trim().split(" ").map((e=>parseFloat(e))))),Me(e,"MRF_META/CachedSource"))throw new r.Z("mrf:open","currently does not support MRF referencing other data files");const g=Me(e,"MRF_META/GeoTags"),y=Me(g,"BoundingBox");let x,w=!1;if(null!=y){const e=parseFloat(y.getAttribute("minx")),t=parseFloat(y.getAttribute("miny")),i=parseFloat(y.getAttribute("maxx")),s=parseFloat(y.getAttribute("maxy")),n=ze(g,"Projection")||"";let r=ce.Z.WGS84;if("LOCAL_CS[]"!==n)if(n.toLowerCase().startsWith("epsg:")){const e=Number(n.slice(5));isNaN(e)||0===e||(r=new ce.Z({wkid:e}))}else r=Je(n)??ce.Z.WGS84;else w=!0,r=new ce.Z({wkid:3857});x=new $.Z(e,t,i,s),x.spatialReference=r}else w=!0,x=new $.Z({xmin:-.5,ymin:.5-n,xmax:s-.5,ymax:.5,spatialReference:new ce.Z({wkid:3857})});const _=Me(e,"MRF_META/Rsets"),b=parseInt(_&&_.getAttribute("scale")||"2",10),I=x.spatialReference,S=new O.Z({origin:new J.Z({x:x.xmin,y:x.ymax,spatialReference:I}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:b}),R=new J.Z({x:x.width/s,y:x.height/n,spatialReference:I}),v=new we.Z({width:s,height:n,extent:x,isPseudoSpatialReference:w,spatialReference:I,bandCount:a,pixelType:c,pixelSize:R,noDataValue:m,storageInfo:S}),T=ze(e,"datafile"),C=ze(e,"IndexFile");return{rasterInfo:v,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Xe.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}};(0,s._)([(0,u.Cb)()],Ke.prototype,"_files",void 0),(0,s._)([(0,u.Cb)()],Ke.prototype,"_storageIndex",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ke.prototype,"datasetFormat",void 0),Ke=(0,s._)([(0,p.j)("esri.layers.support.rasterIO.MRFRaster")],Ke);const Qe=Ke;var et=i(94793),tt=i(9832);const it=(e,t)=>e.get(t)?.values,st=(e,t)=>e.get(t)?.values?.[0];let nt=class extends X{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new r.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:n,isBigTiff:o}=(0,et.cK)(i),l=[];await this._readIFDs(l,i,s,n,0,o?8:4,t);const{imageInfo:c,rasterInfo:u}=this._parseIFDs(l),h=(0,et.ee)(l),f=(0,et.I7)(l);if(this._headerInfo={littleEndian:s,isBigTiff:o,ifds:l,pyramidIFDs:h,maskIFDs:f,...c},this._set("rasterInfo",u),!c.isSupported)throw new r.Z("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new r.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");u.isPseudoSpatialReference&&a.Z.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const d=l[0].get("PREDICTOR")?.values?.[0],m=l[0].get("SAMPLEFORMAT")?.values?.[0];if(3===m&&2===d)throw new r.Z("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:p=[]}=this.ioConfig;if(!p.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,u)}p.includes("vat.dbf")||1!==u.bandCount||"u8"!==u.pixelType||(u.attributeTable=await this._fetchAuxiliaryTable(e),null!=u.attributeTable&&(u.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const n=await this._fetchRawTiffTile(e,t,i,!1,s);if(null!=n&&this._headerInfo.hasMaskBand){const r=await this._fetchRawTiffTile(e,t,i,!0,s);null!=r&&r.pixels[0]instanceof Uint8Array&&(n.mask=r.pixels[0])}return n}_parseIFDs(e){const t=(0,et.FI)(e),{width:i,height:s,tileWidth:n,tileHeight:r,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:m,metadata:p}=t;let g=Je(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),y=!!t.isPseudoGeographic;null==g&&(y=!0,g=new ce.Z({wkid:3857}));const x=new $.Z({...t.extent,spatialReference:g}),w=new J.Z(x?{x:x.xmin,y:x.ymax,spatialReference:g}:{x:0,y:0}),_=new O.Z({blockWidth:n,blockHeight:r,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:d}),b=new J.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),I=p?{BandProperties:p.bandProperties,DataType:p.dataType}:{};let S=null;const R=st(e[0],"PHOTOMETRICINTERPRETATION"),v=it(e[0],"COLORMAP");if(R<=3&&v?.length>3&&v.length%3==0){S=[];const e=v.length/3;for(let t=0;t<e;t++)S.push([t,v[t]>>>8,v[t+e]>>>8,v[t+2*e]>>>8])}const T=new we.Z({width:i,height:s,bandCount:a,pixelType:o,pixelSize:b,storageInfo:_,spatialReference:g,isPseudoSpatialReference:y,keyProperties:I,extent:x,colormap:S,statistics:p?p.statistics:null});return m?.length&&(T.nativeExtent=new $.Z({xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:g}),T.transform=new Ze.Z({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new J.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),_.origin.x=-.5,_.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,ne.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new J.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,s,n,r=4,a){if(!s)return null;(s>=t.byteLength||s<0)&&(t=(await this.request(this.url,{range:{from:s+n,to:s+n+this._bufferSize},responseType:"array-buffer",signal:a})).data,n=s+n,s=0);const o=await this._readIFD(t,i,s,n,tt.Z.TIFF_TAGS,r,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-n,n,r,a)}async _readIFD(e,t,i,s,n=tt.Z.TIFF_TAGS,r=4,a){if(!e)return null;const o=(0,et.vr)(e,t,i,s,n,r);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const n=i.map((e=>e.offlineOffsetSize)).filter(f.pC),r=Math.min.apply(null,n.map((e=>e[0])));if(Math.min.apply(null,n.map((e=>e[0]+e[1])))-r<=this._bufferSize){const{data:n}=await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:a});e=n,s=r,i.forEach((i=>(0,et.Dq)(e,t,i,s)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),n=i?.values;if(n&&n.length>4){const r=n[0]+"."+n[1]+"."+n[2],o=await this._readIFD(e,t,i.valueOffset+6-s,s,tt.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:s,to:s+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,s,tt.Z.TIFF_TAGS,4,a)}}async _fetchRawTiffTile(e,t,i,s,n={}){const r=this._getTileLocation(e,t,i,s);if(!r)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=r,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:n.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),d=1===h.length?h[0].data:new ArrayBuffer(f),m=[0],p=[0];if(h.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){const s=h[t].data;e.set(new Uint8Array(s),i),m[t]=i,i+=s.byteLength,p[t]=s.byteLength}}const{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:m,sizes:p},width:g,height:y,planes:null,pixelType:null});if(null==x)return null;let w,_,b;if(o!==g||l!==y){let e=x.mask;if(e)for(w=0;w<y;w++)if(b=w*g,w<l)for(_=o;_<g;_++)e[b+_]=0;else for(_=0;_<g;_++)e[b+_]=0;else for(e=new Uint8Array(g*y),x.mask=e,w=0;w<l;w++)for(b=w*g,_=0;_<o;_++)e[b+_]=1}return x}_getTileLocation(e,t,i,s=!1){const{firstPyramidLevel:n,blockBoundary:r}=this.rasterInfo.storageInfo,a=0===e?0:e-(n-1),{_headerInfo:o}=this;if(!o)return null;const l=s?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,et.If)(l,o),u=it(l,"TILEOFFSETS");if(void 0===u)return null;const h=it(l,"TILEBYTECOUNTS"),{minRow:f,minCol:d,maxRow:m,maxCol:p}=r[a];if(t>m||i>p||t<f||i<d)return null;const g=st(l,"IMAGEWIDTH"),y=st(l,"IMAGELENGTH"),x=st(l,"TILEWIDTH"),w=st(l,"TILELENGTH"),_=[];if(c){const{bandCount:e}=this.rasterInfo;for(let s=0;s<e;s++){const e=s*(m+1)*(p+1)+t*(p+1)+i;_[s]={from:u[e],to:u[e]+h[e]-1}}}else{const e=t*(p+1)+i;_.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<_.length;e++)if(null==_[e].from||!_[e].to)return null;return{ranges:_,ifd:l,actualTileWidth:i===p&&g%x||x,actualTileHeight:t===m&&y%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ie.parse(t);return i?.recordSet?K.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,s._)([(0,u.Cb)()],nt.prototype,"_files",void 0),(0,s._)([(0,u.Cb)()],nt.prototype,"_headerInfo",void 0),(0,s._)([(0,u.Cb)()],nt.prototype,"_bufferSize",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],nt.prototype,"datasetFormat",void 0),nt=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.TIFFRaster")],nt);const rt=nt,at=new Map;at.set("CRF",{desc:"Cloud Raster Format",constructor:Te}),at.set("MRF",{desc:"Meta Raster Format",constructor:Qe}),at.set("TIFF",{desc:"GeoTIFF",constructor:rt}),at.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Ve}),at.set("JPG",{desc:"JPG Raster Format",constructor:He}),at.set("PNG",{desc:"PNG Raster Format",constructor:He}),at.set("GIF",{desc:"GIF Raster Format",constructor:He}),at.set("BMP",{desc:"BMP Raster Format",constructor:He});class ot{static get supportedFormats(){const e=new Set;return at.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:s}=e;let n=e.datasetFormat;null==n&&t.lastIndexOf(".")&&(n=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===n||"TIF"===n?n="TIFF":"JPG"!==n&&"JPEG"!==n&&"JFIF"!==n||(n="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");const a={url:t,sourceJSON:s,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(n&&this.supportedFormats.has(n)){if("CRF"===n&&!i?.enableCRF)throw new r.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=at.get(n).constructor,l=new o(a),await l.open({signal:e.signal}),l}if(n)throw new r.Z("rasterfactory:open","not a supported format "+n);const c=Array.from(at.keys());let u=0;const h=()=>(n=c[u++],n&&("CRF"!==n||i?.enableCRF)?(o=at.get(n).constructor,l=new o(a),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){at.has(e.toUpperCase())||at.set(e.toUpperCase(),{desc:t,constructor:i})}}var lt=i(32163);let ct=class extends((0,x.h)((0,pe.M)((0,fe.q)((0,de.I)((0,w.N)(he((0,ge.n)((0,y.Y)((0,me.Q)((0,o.R)(g.Z))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}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:["Image Service"]},e).catch(l.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new ye.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new ye.Z({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:t}=this,i=t?.attributeTable,s=null!=i?i.fields:null;if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e.push(...t)}const n=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===n||"vector-uv"===n)&&null!=r){const t=r.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ye.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ye.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,i=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return(0,lt.eZ)({fields:t,title:this.title},{...e,visibleFieldNames:i})}async generateRasterInfo(e,t){if(!(e=(0,h.TJ)(k.Z,e)))return this.rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const s=(0,se.Ue)(e.functionDefinition?.toJSON()??e.toJSON(),i),n=new ee({rasterFunction:s});return await n.open(t),n.rasterInfo}catch(e){if(e instanceof r.Z)throw e;throw new r.Z("imagery-tile-layer","the given raster function is not supported")}}write(e,t){const i=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new r.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,se.G8)(t.toJSON(),i);const s=await Promise.all(i.map((t=>ot.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),n=s.findIndex((e=>null==e));if(n>-1)throw new r.Z("imagery-tile-layer:open",`cannot open raster: ${i[n]}`);if(this._primaryRasters=s,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,se.Ue)(t.functionDefinition?.toJSON()??t.toJSON(),e),n=new ee({rasterFunction:i});try{await n.open(),this.raster=n}catch(e){const t=a.Z.getLogger(this);e instanceof r.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=s[0]}}else this.raster=s[0]}const i=this.raster.rasterInfo;if(!i)throw new r.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,s._)([(0,u.Cb)()],ct.prototype,"_primaryRasters",void 0),(0,s._)([(0,u.Cb)({type:[h.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ct.prototype,"bandIds",void 0),(0,s._)([(0,u.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,m.J)(xe.cl)],ct.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)(v.rn)],ct.prototype,"legendEnabled",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ct.prototype,"isReference",void 0),(0,s._)([(0,u.Cb)({type:["show","hide"]})],ct.prototype,"listMode",void 0),(0,s._)([(0,u.Cb)({json:{read:!0,write:!0}})],ct.prototype,"blendMode",void 0),(0,s._)([(0,u.Cb)()],ct.prototype,"sourceJSON",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ct.prototype,"version",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,json:{read:!1}})],ct.prototype,"type",void 0),(0,s._)([(0,u.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ct.prototype,"operationalLayerType",void 0),(0,s._)([(0,u.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ct.prototype,"popupEnabled",void 0),(0,s._)([(0,u.Cb)({type:n.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ct.prototype,"popupTemplate",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],ct.prototype,"defaultPopupTemplate",null),(0,s._)([(0,u.Cb)({readOnly:!0,type:[ye.Z]})],ct.prototype,"fields",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:[ye.Z]})],ct.prototype,"rasterFields",null),ct=(0,s._)([(0,p.j)("esri.layers.ImageryTileLayer")],ct);const ut=ct},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>r}),i(68773),i(40330);var s=i(22974),n=i(17452);function r(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,n.mN)(e):(0,s.d9)(e)}function o(e,t,i){const s={};for(const n in e){if("declaredClass"===n)continue;const r=e[n];if(null!=r&&"function"!=typeof r)if(Array.isArray(r)){s[n]=[];for(let e=0;e<r.length;e++)s[n][e]=o(r[e])}else if("object"==typeof r)if(r.toJSON){const e=r.toJSON(i&&i[n]);s[n]=t?e:JSON.stringify(e)}else s[n]=t?r:JSON.stringify(r);else s[n]=r}return s}i(71058)}}]);
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4578],{92835:(e,t,i)=>{i.d(t,{Z:()=>m});var s,n=i(43697),r=i(96674),a=i(35463),o=i(5600),l=(i(75215),i(67676),i(80442),i(71715)),c=i(52011),u=i(30556);let h=s=class extends r.wq{static get allTime(){return f}static get empty(){return d}constructor(e){super(e),this.end=null,this.start=null}readEnd(e,t){return null!=t.end?new Date(t.end):null}writeEnd(e,t){t.end=e?e.getTime():null}get isAllTime(){return this.equals(s.allTime)}get isEmpty(){return this.equals(s.empty)}readStart(e,t){return null!=t.start?new Date(t.start):null}writeStart(e,t){t.start=e?e.getTime():null}clone(){return new s({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=null!=this.start?this.start.getTime():this.start,i=null!=this.end?this.end.getTime():this.end,s=null!=e.start?e.start.getTime():e.start,n=null!=e.end?e.end.getTime():e.end;return t===s&&i===n}expandTo(e){if(this.isEmpty||this.isAllTime)return this.clone();let t=this.start;t&&(t=(0,a.JE)(t,e));let i=this.end;if(i){const t=(0,a.JE)(i,e);i=i.getTime()===t.getTime()?t:(0,a.Nm)(t,1,e)}return new s({start:t,end:i})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return s.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=this.start?.getTime()??-1/0,i=this.end?.getTime()??1/0,n=e.start?.getTime()??-1/0,r=e.end?.getTime()??1/0;let a,o;if(n>=t&&n<=i?a=n:t>=n&&t<=r&&(a=t),i>=n&&i<=r?o=i:r>=t&&r<=i&&(o=r),null!=a&&null!=o&&!isNaN(a)&&!isNaN(o)){const e=new s;return e.start=a===-1/0?null:new Date(a),e.end=o===1/0?null:new Date(o),e}return s.empty}offset(e,t){if(this.isEmpty||this.isAllTime)return this.clone();const i=new s,{start:n,end:r}=this;return null!=n&&(i.start=(0,a.Nm)(n,e,t)),null!=r&&(i.end=(0,a.Nm)(r,e,t)),i}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return f.clone();const t=null!=this.start&&null!=e.start?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,i=null!=this.end&&null!=e.end?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new s({start:t,end:i})}};(0,n._)([(0,o.Cb)({type:Date,json:{write:{allowNull:!0}}})],h.prototype,"end",void 0),(0,n._)([(0,l.r)("end")],h.prototype,"readEnd",null),(0,n._)([(0,u.c)("end")],h.prototype,"writeEnd",null),(0,n._)([(0,o.Cb)({readOnly:!0,json:{read:!1}})],h.prototype,"isAllTime",null),(0,n._)([(0,o.Cb)({readOnly:!0,json:{read:!1}})],h.prototype,"isEmpty",null),(0,n._)([(0,o.Cb)({type:Date,json:{write:{allowNull:!0}}})],h.prototype,"start",void 0),(0,n._)([(0,l.r)("start")],h.prototype,"readStart",null),(0,n._)([(0,u.c)("start")],h.prototype,"writeStart",null),h=s=(0,n._)([(0,c.j)("esri.TimeExtent")],h);const f=new h,d=new h({start:void 0,end:void 0}),m=h},13867:(e,t,i)=>{i.d(t,{z:()=>n});var s=i(69801);class n{constructor(e,t){this._storage=new s.WJ,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this),t&&this._storage.registerRemoveFunc("",t)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,t,i=1){this._storage.put(this,e,t,i,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}}},69801:(e,t,i)=>{i.d(t,{WJ:()=>o,Xq:()=>a});var s,n,r=i(44553);(n=s||(s={}))[n.ALL=0]="ALL",n[n.SOME=1]="SOME";class a{constructor(e,t,i){this.name=e,this._storage=t,this.id=l+++":",this.size=0,this.maxSize=0,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),i&&(this._storage.registerRemoveFunc(this.id,i),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get sizeAll(){return this._storage.size}resetHitRate(){this._hit=this._miss=0}put(e,t,i,s=0){this._storage.put(this,e,t,i,s)}get(e){const t=this._storage.get(this,e);return void 0===t?++this._miss:++this._hit,t}peek(e){return this._storage.peek(this,e)}pop(e){const t=this._storage.pop(this,e);return void 0===t?++this._miss:++this._hit,t}updateSize(e,t,i){this._storage.updateSize(this,e,t,i)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class o{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new r.Z,this._users=new r.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,t){this._removeFuncs.push([e,t])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace((t=>t[0]!==e))}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimits()}put(e,t,i,n,r){t=e.id+t;const a=this._db.get(t);if(a&&(this._size-=a.size,e.size-=a.size,this._db.delete(t),a.entry!==i&&this._notifyRemove(t,a.entry,s.ALL)),n>this._maxSize)return void this._notifyRemove(t,i,s.ALL);if(void 0===i)return void console.warn("Refusing to cache undefined entry ");if(!n||n<0)return void console.warn("Refusing to cache entry with invalid size "+n);const o=1+Math.max(r,-3)- -3;this._db.set(t,{entry:i,size:n,lifetime:o,lives:o}),this._size+=n,e.size+=n,this._checkSizeLimits()}updateSize(e,t,i,n){t=e.id+t;const r=this._db.get(t);if(r&&r.entry===i){for(this._size-=r.size,e.size-=r.size;n>this._maxSize;){const e=this._notifyRemove(t,i,s.SOME);if(!(null!=e&&e>0))return void this._db.delete(t);n=e}r.size=n,this._size+=n,e.size+=n,this._checkSizeLimits()}}pop(e,t){t=e.id+t;const i=this._db.get(t);if(i)return this._size-=i.size,e.size-=i.size,this._db.delete(t),++this._hit,i.entry;++this._miss}get(e,t){t=e.id+t;const i=this._db.get(t);if(void 0!==i)return this._db.delete(t),i.lives=i.lifetime,this._db.set(t,i),++this._hit,i.entry;++this._miss}peek(e,t){const i=this._db.get(e.id+t);return i?++this._hit:++this._miss,i?.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach(((e,s)=>{const n=e.lifetime;i[n]=(i[n]||0)+e.size,this._users.forAll((i=>{const{id:n,name:r}=i;if(s.startsWith(n)){const i=t[r]||0;t[r]=i+e.size}}))}));const s={};this._users.forAll((e=>{const i=e.name;if("hitRate"in e&&"number"==typeof e.hitRate&&!isNaN(e.hitRate)&&e.hitRate>0){const n=t[i]||0;t[i]=n,s[i]=Math.round(100*e.hitRate)+"%"}else s[i]="0%"}));const n=Object.keys(t);n.sort(((e,i)=>t[i]-t[e])),n.forEach((i=>e[i]=Math.round(t[i]/2**20)+"MB / "+s[i]));for(let t=i.length-1;t>=0;--t){const s=i[t];s&&(e["Priority "+(t+-3-1)]=Math.round(s/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll((e=>e.resetHitRate()))}clear(e){const t=e.id;this._db.forEach(((e,i)=>{i.startsWith(t)&&(this._size-=e.size,this._db.delete(i),this._notifyRemove(i,e.entry,s.ALL))})),e.size=0}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,s.ALL))),this._users.forEach((e=>e.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i){let s;return this._removeFuncs.some((n=>{if(e.startsWith(n[0])){const e=n[1](t,i);return"number"==typeof e&&(s=e),!0}return!1})),s}_checkSizeLimits(){if(this._size>this._maxSize)for(const[e,t]of this._db)if(this._purgeItem(e,t),this._size<=.9*this.maxSize)return;this._users.forEach((e=>{if(e.maxSize>0&&e.size>e.maxSize)for(const[t,i]of this._db)if(t.startsWith(e.id)&&(this._purgeItem(t,i,e),e.size<=.9*e.maxSize))return}))}_purgeItem(e,t,i=this._users.find((t=>e.startsWith(t.id)))){if(this._db.delete(e),t.lives<=1){this._size-=t.size,i&&(i.size-=t.size);const n=this._notifyRemove(e,t.entry,s.SOME);null!=n&&n>0&&(this._size+=n,i&&(i.size+=n),t.lives=t.lifetime,t.size=n,this._db.set(e,t))}else--t.lives,this._db.set(e,t)}}let l=0},17445:(e,t,i)=>{i.d(t,{N1:()=>f,YP:()=>l,Z_:()=>p,gx:()=>c,nn:()=>g,on:()=>h,tX:()=>y}),i(66643),i(46791);var s=i(91460),n=i(50758),r=i(70586),a=i(95330),o=i(26258);function l(e,t,i={}){return u(e,t,i,d)}function c(e,t,i={}){return u(e,t,i,m)}function u(e,t,i={},s){let n=null;const a=i.once?(e,i)=>{s(e)&&((0,r.hw)(n),t(e,i))}:(e,i)=>{s(e)&&t(e,i)};if(n=(0,o.aQ)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return n}function h(e,t,i,a={}){let o=null,c=null,u=null;function h(){o&&c&&(c.remove(),a.onListenerRemove?.(o),o=null,c=null)}function f(e){a.once&&a.once&&(0,r.hw)(u),i(e)}const d=l(e,((e,i)=>{h(),(0,s.vT)(e)&&(o=e,c=(0,s.on)(e,t,f),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return u=(0,n.kB)((()=>{d.remove(),h()})),u}function f(e,t){return function(e,t,i){if((0,a.Hc)(i))return Promise.reject((0,a.zE)());const s=e();if(t?.(s))return Promise.resolve(s);let o=null;function l(){o=(0,r.hw)(o)}return new Promise(((s,r)=>{o=(0,n.AL)([(0,a.fu)(i,(()=>{l(),r((0,a.zE)())})),u(e,(e=>{l(),s(e)}),{sync:!1,once:!0},t??d)])}))}(e,m,t)}function d(e){return!0}function m(e){return!!e}i(87538);const p={sync:!0},g={initial:!0},y={sync:!0,initial:!0}},35463:(e,t,i)=>{i.d(t,{JE:()=>a,Nm:()=>r,rJ:()=>o}),i(80442);const s={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8},n={milliseconds:{getter:"getMilliseconds",setter:"setMilliseconds",multiplier:1},seconds:{getter:"getSeconds",setter:"setSeconds",multiplier:1},minutes:{getter:"getMinutes",setter:"setMinutes",multiplier:1},hours:{getter:"getHours",setter:"setHours",multiplier:1},days:{getter:"getDate",setter:"setDate",multiplier:1},weeks:{getter:"getDate",setter:"setDate",multiplier:7},months:{getter:"getMonth",setter:"setMonth",multiplier:1},years:{getter:"getFullYear",setter:"setFullYear",multiplier:1},decades:{getter:"getFullYear",setter:"setFullYear",multiplier:10},centuries:{getter:"getFullYear",setter:"setFullYear",multiplier:100}};function r(e,t,i){const s=new Date(e.getTime());if(t&&i){const e=n[i],{getter:r,setter:a,multiplier:o}=e;if("months"===i){const e=function(e,t){const i=new Date(e,t+1,1);return i.setDate(0),i.getDate()}(s.getFullYear(),s.getMonth()+t);s.getDate()>e&&s.setDate(e)}s[a](s[r]()+t*o)}return s}function a(e,t){switch(t){case"milliseconds":return new Date(e.getTime());case"seconds":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());case"minutes":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());case"hours":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours());case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate());case"weeks":return new Date(e.getFullYear(),e.getMonth(),e.getDate()-e.getDay());case"months":return new Date(e.getFullYear(),e.getMonth(),1);case"years":return new Date(e.getFullYear(),0,1);case"decades":return new Date(e.getFullYear()-e.getFullYear()%10,0,1);case"centuries":return new Date(e.getFullYear()-e.getFullYear()%100,0,1);default:return new Date}}function o(e,t,i){return 0===e?0:e*s[t]/s[i]}},16306:(e,t,i)=>{i.d(t,{aX:()=>I});var s=i(68773),n=i(20102),r=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),d=i(11282),m=i(17452);async function p(e,t,i){const s="string"==typeof e?(0,m.mN)(e):e,n=t[0].spatialReference,r=(0,f.Ji)(t[0]),a={...i,query:{...s.query,f:"json",sr:n.wkid??JSON.stringify(n),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.default)(s.path+"/simplify",a);var l;return function(e,t,i){const s=(0,f.q9)(t);return e.map((e=>{const t=s.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,r,n)}const g=r.Z.getLogger("esri.geometry.support.normalizeUtils");function y(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw g.error(e),new n.Z(e)}const i=(0,l.x3)(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],r=e[s][1],a=e[s+1][0],o=e[s+1][1],l=Math.sqrt((a-n)*(a-n)+(o-r)*(o-r)),c=(o-r)/l,u=(a-n)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=u*s+n,o=c*s+r;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,s=u*e+n,a=c*e+r;i.push([s,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:s,spatialReference:e.spatialReference}):new o.Z({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function _(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=(0,l.XZ)(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=(0,l.XZ)(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=(0,l.XZ)(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=(0,l.XZ)(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function b(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],r=t.geometries[s],a=(0,l.x3)(r);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=r.getPoint(e,i);r.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(n===i){if(y(e))for(const t of(0,l.x3)(r))e[n]=e[n].addRing(t);else if(x(e))for(const t of(0,l.x3)(r))e[n]=e[n].addPath(t)}else i=n,e[n]=r}return e}async function I(e,t,i){if(!Array.isArray(e))return I([e],t);t&&"string"!=typeof t&&g.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.default.geometryServiceUrl;let r,m,y,x,S,R,v,T,C=0;const k=[],F=[];for(const t of e)if(null!=t)if(r||(r=t.spatialReference,m=(0,c.C5)(r),y=r.isWebMercator,R=y?102100:4326,x=l.UZ[R].maxX,S=l.UZ[R].minX,v=l.UZ[R].plus180Line,T=l.UZ[R].minus180Line),m)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(_(t.clone(),x,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>_(e,x,S))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,m);F.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,S)*(2*x);let s=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(v)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,s=w(s,y),k.push(s),F.push("cut")):e.intersects(T)&&e.xmin!==S?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,s=w(s,y,360),k.push(s),F.push("cut")):F.push(s)}else F.push(t.clone());else F.push(t);else F.push(t);let M=(0,l.XZ)(C,x),z=-90;const P=M,D=new o.Z;for(;M>0;){const e=360*M-180;D.addPath([[e,z],[e,-1*z]]),z*=-1,M--}if(k.length>0&&P>0){const t=b(k,await async function(e,t,i,s){const n=(0,d.en)(e),r=t[0].spatialReference,a={...s,query:{...n.query,f:"json",sr:JSON.stringify(r),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.default)(n.path+"/cut",a),{cutIndexes:l,geometries:c=[]}=o.data;return{cutIndexes:l,geometries:c.map((e=>{const t=(0,f.im)(e);return t.spatialReference=r,t}))}}(n,k,D,i)),s=[],r=[];for(let i=0;i<F.length;i++){const n=F[i];if("cut"!==n)r.push(n);else{const n=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&n.rings.length>=a.rings.length?(s.push(n),r.push("simplify")):r.push(y?(0,u.$)(n):n)}}if(!s.length)return r;const a=await p(n,s,i),o=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?o.push(t):o.push(y?(0,u.$)(a.shift()):a.shift())}return o}const O=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)O.push(t);else{const e=k.shift();O.push(!0===y?(0,u.$)(e):e)}}return O}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var s=i(58901),n=i(82971),r=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.Z.WebMercator}),minus180Line:new s.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.Z({paths:[[[180,-180],[180,180]]],spatialReference:n.Z.WGS84}),minus180Line:new s.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:n.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,r.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ut});var s=i(43697),n=i(51773),r=i(20102),a=i(92604),o=i(16453),l=i(95330),c=i(17445),u=i(5600),h=i(75215),f=i(67676),d=i(80442),m=i(36030),p=i(52011),g=i(87085),y=i(17287),x=i(71612),w=i(17017),_=(i(66577),i(30030)),b=i(3172),I=i(71715),S=i(8744),R=i(66677),v=i(21506),T=i(35956),C=i(29876),k=i(45663),F=i(88281),M=i(11145),z=i(96674),P=i(609),D=i(39450),O=i(36679),Z=i(99815),N=i(73506),J=i(94139);const A=new Map,E=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.refCount--,e.refCount<=0&&(s.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.ts=Date.now(),e.refCount++,s.delete(i),s.set(i,e),e.block}return null}putBlock(e,t,i,s){const n=this._cachedBlocks,r=e+"/"+t;if(n.has(r)){const e=n.get(r);e.ts=Date.now(),e.refCount++}else n.set(r,{block:i,ts:Date.now(),refCount:1,controller:s});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,s=e+"/"+t;i.has(s)&&i.delete(s)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let s=0;s<t.length&&t[s][1].ts<=i-this._duration;s++)e.delete(t[s][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function B(e,t){return null==t?e:`${e}?sliceId=${t}`}function H(e,t,i){const s=A.get(e);if(!s)return null==t?E.decreaseRefCount(e,i):0;if(null==t||null==s[t])return E.decreaseRefCount(e,i);const n=s[t]?.cache,r=n?.get(i);if(n&&r){if(r.refCount--,0===r.refCount){n.delete(i);for(let e=0;e<s.length;e++)s[e]?.cache.delete(i);r.controller&&r.controller.abort()}return r.refCount}return 0}function L(e,t,i){const s=A.get(e);if(!s)return null==t?E.getBlock(e,i):null;if(null==t||null==s[t]){for(let e=0;e<s.length;e++){const t=s[e]?.cache.get(i);if(t)return t.refCount++,t.block}return E.getBlock(e,i)}const n=s[t]?.cache.get(i);if(n)return n.refCount++,n.block;for(let e=0;e<s.length;e++){if(e===t||!s[e])continue;const n=s[e]?.cache,r=n?.get(i);if(n&&r)return r.refCount++,n.set(i,r),r.block}return null}function W(e,t,i,s,n=null){const r=A.get(e);if(!r)return void(null==t&&E.putBlock(e,i,s,n));if(null==t||null==r[t])return void E.putBlock(e,i,s,n);const a={refCount:1,block:s,isResolved:!1,isRejected:!1,controller:n};s.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),r[t]?.cache.set(i,a)}function q(e,t,i){const s=A.get(e);s?null!=t&&null!=s[t]?s[t]?.cache.delete(i):E.deleteBlock(e,i):null==t&&E.deleteBlock(e,i)}var j=i(81578),G=i(75993),U=i(55914),V=i(80676),$=i(6570);let Y=class extends((0,P.v)(z.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,N.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:M.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,N.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,R.Nm)(e,a.Z.getLogger(this)))}async open(e){throw new r.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,s={}){const n=s.tileInfo||this.rasterInfo.storageInfo.tileInfo,r=this.getTileExtentFromTileInfo(e,t,i,n);return this.fetchPixels(r,n.size[0],n.size[1],s)}async identify(e,t={}){e=(0,h.TJ)(J.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:s}=t,{rasterInfo:n}=this,{hasMultidimensionalTranspose:r,multidimensionalInfo:a}=n;let{transposedVariableName:o}=t;const l=null!=a&&r&&(null!=s||(0,Z.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=n,{datumTransformation:f}=t;let d=(0,N.nF)(e,c,f);if(!u.intersects(d))return{location:d,value:null};if(null!=n.transform){const e=n.transform.inverseTransform(d);if(!n.nativeExtent.intersects(e))return{location:e,value:null};d=e}let m=0;const p=null!=o&&null!=a&&n.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(p)return e.identify(d,t);const{pixelSize:i}=n,s=3,r=i.x*s/2,a=i.y*s/2,o=new $.Z({xmin:d.x-r,xmax:d.x+r,ymin:d.y-a,ymax:d.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,s,s,l),{pixelBlock:h}=await this.fetchPixels(o,s,s,l);if(null==u)return{location:d,value:null};const f=Math.floor(s*s*.5),m=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let g;return null!=h&&(g=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:d,value:m,processedValue:g,pyramidLevel:0}}if(!p)if(t.srcResolution)m=(0,N.kr)(t.srcResolution,n,this.ioConfig.sampling).pyramidLevel;else if(m=await this.computeBestPyramidLevelForLocation(e,t),null==m)return{location:d,value:null};const g=this.identifyPixelLocation(d,m,null,p);if(null===g)return{location:d,value:null};const{row:y,col:x,rowOffset:w,colOffset:_,blockWidth:b}=g,I=o??t.sliceId,S=B(this.url,I),R=`${m}/${y}/${x}`;let v=L(S,null,R);null==v&&(v=this.fetchRawTile(m,y,x,t),W(S,null,R,v));const T=await v;if(null==T||!T.pixels?.length)return{location:d,value:null};const C=w*b+_;return this._processIdentifyResult(T,{srcLocation:d,position:C,pyramidLevel:m,useTransposedTile:!!p,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,s={}){e=(0,N.kZ)(e),s=this._getRequestOptionsWithSliceId(s);const{_hasNoneOrGCSShiftTransform:n}=this;if(s.requestRawData&&n)return this._fetchPixels(e,t,i,s);const r=(0,N.ut)(e.spatialReference),a=(0,N.Hq)(e);if(null==r||0===a||1===a&&this._isGlobalWrappableSource&&n)return this._fetchPixels(e,t,i,s);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(r/(c-l)*t),h=u-Math.round((r/2-l)/(c-l)*t);let f=0;const d=[];for(let n=0;n<=a;n++){const m=new $.Z({xmin:0===n?l:-r/2,xmax:n===a?c-r*n:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),p=0===n?u-h:n===a?t-f:u;f+=p,d.push(p);const g=s.disableWrapAround&&n>0?null:this._fetchPixels(m,p,i,s);o.push(g)}const m=(await Promise.all(o)).map((e=>e?.pixelBlock));let p=null;const g={width:t,height:i};return p=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:m,srcMosaicSize:g,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},s)).pixelBlock:(0,U.us)(m,g,{blockWidths:d}),{extent:e,srcExtent:(0,N.tB)(e,this.rasterInfo.spatialReference,s.datumTransformation),pixelBlock:p}}async fetchRawPixels(e,t,i,s={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const n=await this._fetchRawTiles(e,t,i,s),{nativeExtent:r,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new $.Z({xmin:r.xmin+c*t.x,xmax:r.xmin+c*(t.x+i.width-1),ymin:r.ymax-u*(t.y+i.height-1),ymax:r.ymax-u*t.y,spatialReference:r.spatialReference});if(!n)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=n;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:n.pixelBlocks[0]};const m=e>0?o.pyramidBlockWidth:o.blockWidth,p=e>0?o.pyramidBlockHeight:o.blockHeight,g={x:t.x%m,y:t.y%p};let y;return y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:i,clipOffset:g,clipSize:i,coefs:null,sampleSpacing:null,interpolation:s.interpolation,alignmentInfo:null,blockWidths:null},s)).pixelBlock:(0,U.us)(f,d,{clipOffset:g,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:y}}fetchRawTile(e,t,i,s){throw new r.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,N.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,G.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:s}=this.ioConfig,{range:n,query:r,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await(0,b.default)(e,{...t,query:{...r,...s},headers:{...a,...o}})}catch(s){if(i>0)return i--,this.request(e,t,i);throw s}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,Z.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,s){const n=s.lodAt(e);return this.getTileExtent({x:n.resolution,y:n.resolution},t,i,s.origin,s.spatialReference,s.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:s}=this.rasterInfo;if(!e.tileInfo){const n=[],r=e.maximumPyramidLevel||0;let a=Math.max(s.x,s.y),o=1/.0254*96*a;for(let e=0;e<=r;e++)n.push(new D.Z({level:r-e,resolution:a,scale:o})),a*=2,o*=2;const l=new J.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new M.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,s){const{width:n,height:r,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new J.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==s&&(s=Math.max(0,Math.round(Math.log(Math.max(n,r))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],s);e.storageInfo=new O.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:s,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,s,n,r=0,a=2){if(1===n.length&&r>0){n=[...n];let{x:e,y:t}=n[0];for(let i=0;i<r;i++)e*=a,t*=a,n.push({x:e,y:t})}const o=[],{x:l,y:c}=s;for(let s=0;s<n.length;s++){const{x:r,y:a}=n[s];o.push({minCol:Math.floor((e.xmin-l+.1*r)/t/r),maxCol:Math.floor((e.xmax-l-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:s}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const n=s**e;return{x:t.x*n,y:t.y*n}}identifyPixelLocation(e,t,i,s){const{spatialReference:n,nativeExtent:r,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=s&&null!=c?c.tileSize[0]:a.blockWidth,h=s&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,N.nF)(e,n,i);if(!r.intersects(f))return null;if(t<0||t>o)return null;const d=this.getPyramidPixelSize(t),{x:m,y:p}=d,g=(l.y-f.y)/p/h,y=(f.x-l.x)/m/u,x=Math.min(h-1,Math.floor((g-Math.floor(g))*h)),w=Math.min(u-1,Math.floor((y-Math.floor(y))*u));return{pyramidLevel:t,row:Math.floor(g),col:Math.floor(y),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,s,n,r){const[a,o]=r,l=s.x+i*a*e.x,c=l+a*e.x,u=s.y-t*o*e.y,h=u-o*e.y;return new $.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:n})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const s=this.rasterInfo.storageInfo.blockBoundary[e];return!s||s.maxRow<t||s.maxCol<i||s.minRow>t||s.minCol>i}async _fetchPixels(e,t,i,s={}){let n=(0,N.Hq)(e);if(n>=2)return{extent:e,pixelBlock:null};const r=this._getSourceDataInfo(e,t,i,s),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=r;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,d=f.transform,m="gcs-shift"===d?.type,p=null!=(0,N.ut)(e.spatialReference);!m&&p||(n=(0,N.Hq)(r.srcExtent,m));const g=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:n},s);if(!g)return{extent:e,srcExtent:l,pixelBlock:null};const y=f.storageInfo,x=a>0?y.pyramidBlockWidth:y.blockWidth,w=a>0?y.pyramidBlockHeight:y.blockHeight;let{x:_,y:b}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=y;if(null!=e&&e[a-1])({x:_,y:b}=e[a-1]);else{const e=t**a;_*=e,b*=e}}const I=f.spatialReference,S=new J.Z({x:_,y:b,spatialReference:I}),R=x===c&&w===u&&h.x%x==0&&h.y%w==0,v=new J.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(I),C=I.isGeographic?1e-9:1e-4,{datumTransformation:k}=s;if(!T&&R&&1===g.pixelBlocks.length&&x===t&&w===i&&this._isSameResolution(o,v,C))return{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:g.pixelBlocks[0]};const F=p&&null!=(0,N.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,M=s.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");M&&!this.rasterJobHandler&&await(0,N.zD)();const z=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:v.toJSON(),datumTransformation:k,rasterTransform:d,hasWrapAround:n>0||F,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:M},s):(0,N.Qp)({projectedExtent:e,srcBufferExtent:g.extent,pixelSize:v,datumTransformation:k,rasterTransform:d,hasWrapAround:n>0||F,isAdaptive:!1,includeGCSGrid:M});let P;const D=!s.requestRawData,O={rows:z.spacing[0],cols:z.spacing[1]},Z=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,g.extent.xmin):void 0,{pixelBlocks:A,mosaicSize:E,isPartiallyFilled:B}=g;let H=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:E,destDimension:D?{width:t,height:i}:null,coefs:D?z.coefficients:null,sampleSpacing:D?O:null,projectDirections:M,gcsGrid:M?z.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:s.interpolation,alignmentInfo:Z,blockWidths:null},s);({pixelBlock:P,localNorthDirections:H}=e)}else{const e=(0,U.us)(A,E,{alignmentInfo:Z});P=D?(0,U.Uk)(e,{width:t,height:i},z.coefficients,O,s.interpolation):e,M&&z.gcsGrid&&(H=(0,U.Qh)({width:t,height:i},z.gcsGrid),P=(0,V.xQ)(P,this.rasterInfo.dataType,H))}return s.requestRawData||M?{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:P,transformGrid:z,localNorthDirections:H,isPartiallyFilled:B}:{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:P}}async _fetchRawTiles(e,t,i,s){const{origin:n,blockBoundary:r}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const d=this._getRasterTileAlignmentInfo(e,0);s.buffer&&(l-=s.buffer.cols,c-=s.buffer.rows,u+=2*s.buffer.cols,h+=2*s.buffer.rows);let m=0,p=0,g=0;f&&null!=d&&(({worldColumnCountFromOrigin:p,originColumnOffset:g,rightPadding:m}=d),p*d.blockWidth-m>=l+u&&(m=0));const y=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+m-1)/a),_=Math.floor((c+h+m-1)/o),b=r[e];if(!b)return null;const{minRow:I,minCol:S,maxCol:R,maxRow:v}=b;if(0===f&&(_<I||w<S||x>v||y>R))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?s.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=_;t++)for(let i=y;i<=w;i++){let n=i;if(!s.disableWrapAround&&f&&null!=d&&p<=i&&(n=i-p-g),t>=I&&n>=S&&v>=t&&R>=n){const i=this._fetchRawTile(e,t,n,s);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const F=await Promise.all(T),M={height:(_-x+1)*o,width:(w-y+1)*a},{spatialReference:z}=this.rasterInfo,P=this.getPyramidPixelSize(e),{x:D,y:O}=P;return{extent:new $.Z({xmin:n.x+y*a*D,xmax:n.x+(w+1)*a*D,ymin:n.y-(_+1)*o*O,ymax:n.y-x*o*O,spatialReference:z}),pixelBlocks:F,mosaicSize:M,isPartiallyFilled:C}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,s){const n=this.rasterInfo.storageInfo.blockBoundary[e];if(!n)return Promise.resolve(null);const{minRow:r,minCol:a,maxCol:o,maxRow:c}=n;if(t<r||i<a||t>c||i>o)return Promise.resolve(null);const u=B(this.url,s.sliceId),h=`${e}/${t}/${i}`;let f=L(u,s.registryId,h);if(null==f){const n=new AbortController;f=this.fetchRawTile(e,t,i,{...s,signal:n.signal}),W(u,s.registryId,h,f,n),f.catch((()=>q(u,s.registryId,h)))}return s.signal&&(0,l.fu)(s,(()=>{H(u,s.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const s=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[n,r]=e,a=[],o=[];for(let e=0;e<s;e++){const[t,i]=(0,V.Tg)([n[e],r[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,N.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,s={}){const n={datumTransformation:s.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};s.srcResolution&&(n.srcResolution=s.srcResolution,this._updateSourceDataInfo(e,n));const r=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=n,c=a/t,u=o/i,h=l<r&&c*u>=16,f=l===r&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new J.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,N.VO)(a,this.rasterInfo.spatialReference,e,n.datumTransformation);const f=!o||s.srcResolution&&o.x+o.y<s.srcResolution.x+s.srcResolution.y;if(h&&s.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(r-l+3>=e){const t=2**e;o={x:s.srcResolution.x*t,y:s.srcResolution.y*t}}}o&&(n.srcResolution=o,this._updateSourceDataInfo(e,n))}return this._requireTooManySrcTiles(n.srcWidth,n.srcHeight,t,i)&&(n.srcWidth=0,n.srcHeight=0),n}_requireTooManySrcTiles(e,t,i,s){const{tileInfo:n}=this.rasterInfo.storageInfo;return Math.ceil(e/n.size[0])*Math.ceil(t/n.size[1])>=256||e/i>8||t/s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,s=i.spatialReference,{srcResolution:n,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,N.kr)(n,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,N.tB)(e,s,r);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,d=Math.floor((c.xmin-h)/o.x+.1),m=Math.floor((f-c.ymax)/o.y+.1),p=Math.floor((c.xmax-h)/o.x-.1),g=Math.floor((f-c.ymin)/o.y-.1),y=c.width<.1*o.x?0:p-d+1,x=c.height<.1*o.y?0:g-m+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=y,t.srcHeight=x,t.ul={x:d,y:m}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:s,pyramidLevel:n,useTransposedTile:r}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[s])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!r){const t=e.pixels.map((e=>e[s])),r={location:i,value:t,pyramidLevel:n},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(r.magdirValue=a.map((e=>e[0]))),r}let l=e.pixels.map((e=>e.slice(s*a,s*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,Z.MO)(o,h.transposedVariableName);if(u){const e=(0,Z.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const d=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:l,pixelType:e.pixelType};let p;return null!=d&&((0,j.A)(m,d),p=m.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===p?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new T.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:n}}};(0,s._)([(0,u.Cb)()],Y.prototype,"_rasterTileAlighmentInfo",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],Y.prototype,"_isGlobalWrappableSource",null),(0,s._)([(0,u.Cb)({readOnly:!0})],Y.prototype,"_hasNoneOrGCSShiftTransform",null),(0,s._)([(0,u.Cb)()],Y.prototype,"rasterJobHandler",null),(0,s._)([(0,u.Cb)(v.HQ)],Y.prototype,"url",null),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetName",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Y.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"hasUniqueSourceStorageInfo",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"rasterInfo",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"ioConfig",void 0),(0,s._)([(0,u.Cb)()],Y.prototype,"sourceJSON",void 0),Y=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.BaseRaster")],Y);const X=Y;var K=i(74889);let Q=class extends X{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:s}=this.primaryRasters,n=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(n);const a=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:a,rasterIds:s});if(!o.success||0===a.length)throw new r.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=K.Z.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((e=>this._hasSameStorageInfo(e,c))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,s={}){const{rasters:n,rasterIds:r}=this.primaryRasters;let a=!1;const{interpolation:o}=s,l=this.rasterFunction.flatWebGLFunctionChain?.hasSurfaceFunction;!s.requestRawData&&"bilinear"!==o&&l&&(a=1===n.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:a});const c=n.map((n=>n.fetchPixels(e,t,i,s))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||s.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((e=>null==e)))return u[0];const d=u.find((e=>null!=e.pixelBlock))?.extent??e,m=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}),{transformGrid:p}=u[0];if(!a||null==m||null==p)return{...u[0],pixelBlock:m};const g={rows:p.spacing[0],cols:p.spacing[1]};let y;return y=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[m],srcMosaicSize:{width:m.width,height:m.height},destDimension:{width:t,height:i},coefs:p.coefficients,sampleSpacing:g,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock:(0,U.Uk)(m,{width:t,height:i},p.coefficients,g,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:y}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:s,spatialReference:n,extent:r}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return s.x===o.x&&s.y===o.y&&n.equals(l)&&r.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"tileType",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"rasterFunction",void 0),(0,s._)([(0,u.Cb)()],Q.prototype,"primaryRasters",void 0),Q=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.FunctionRaster")],Q);const ee=Q;var te=i(67900),ie=i(5847);var se=i(40932),ne=i(15612),re=i(67058),ae=i(72758),oe=i(79681),le=i(23808),ce=i(82971);const ue=a.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),he=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",(0,R.Nm)(e,ue))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer;return(0,_.ij)(s,i)||void 0}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,s=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:s},t):(0,V.KC)(e,s)}async computeStatisticsHistograms(e,t){e=(0,h.TJ)(oe.Z,e).clone();const{rasterInfo:s}=this,{geometry:n}=e;if(null==n)throw new r.Z("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let a=n;const{spatialReference:o}=s;n.spatialReference.equals(o)||(await(0,N.zD)(),a="extent"===n.type?(0,N.tB)(n,o):(0,N.Wt)(n,o));const l=e.pixelSize??new J.Z({x:s.pixelSize.x,y:s.pixelSize.y,spatialReference:o}),{extent:c,width:u,height:f}=function(e,t,i,s=!0){const{spatialReference:n}=e,{x:r,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,te.c9)(e.spatialReference),s=(0,te.c9)(t);if(i===s)return e;const n=i/s;return{x:e.x*n,y:e.y*n}}(i,n);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:d,ymin:m}=u;const{xmin:p,ymax:g}=e.extent;return s?(h=p+(h>p?r*Math.round((h-p)/r):0),d=g-(d<g?a*Math.round((g-d)/a):0),f=p+(f>p?r*Math.round((f-p)/r):0),m=g-(m<g?a*Math.round((g-m)/a):0),o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:m,spatialReference:n}),l=Math.round(o.width/r),c=Math.round(o.height/a)):(l=Math.floor((f-h)/r+.8),c=Math.floor((d-m)/a+.8),h=p+(h>p?r*Math.floor((h-p)/r+.1):0),d=g-(d<g?a*Math.floor((g-d)/a+.1):0),f=h+l*r,m=d-c*a,o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:m,spatialReference:n})),{extent:o,width:l,height:c}}(s,a,l),d=await this.fetchPixels(c,u,f,{...t,interpolation:"nearest"});if(null==d.pixelBlock)throw new r.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const m=await async function(e,t,s){if("extent"===s.type)return function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n;if(i.width/a<.5||i.height/o<.5)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:d,ymin:m,ymax:p}=i,g=Math.max(l,f),y=Math.min(c,d),x=Math.max(u,m),w=Math.min(h,p),_=.5*a,b=.5*o;if(y-g<_||w-x<b||y<l+_||g>c-_||x>h-b||w<u+b)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const I=Math.max(0,(g-l)/a),S=Math.min(s,Math.max(0,(y-l)/a)),R=Math.max(0,(h-w)/o),v=Math.min(n,Math.max(0,(h-x)/o)),T=Math.round(I),C=Math.round(S)-1,k=Math.round(R),F=Math.round(v)-1;if(T===C&&I%1>.5&&S%1<.5||k===F&&R%1>.5&&v%1<.5)return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});if(0===T&&0===k&&C===s&&F===n)return e;const M=e.mask;for(let e=k;e<=F;e++)for(let t=T;t<=C;t++){const i=e*s+t;r[i]=M?M[i]:255}return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s);const{width:n,height:r}=e,a=new Uint8Array(n*r),{contains:o,intersects:l}=await Promise.all([i.e(5837),i.e(1433)]).then(i.bind(i,61433));return l(t,s)?"polyline"===s.type?function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n,{xmin:l,ymax:c}=t,{paths:u}=i,h=e.mask;for(let e=0;e<u.length;e++){const t=u[e];for(let e=0;e<t.length-1;e++){const[i,u]=t[e],[f,d]=t[e+1];let m=Math.floor((c-u)/o),p=Math.floor((c-d)/o);if(p<m){const e=m;m=p,p=e}m=Math.max(0,m),p=Math.min(n-1,p);const g=(f-i)/(d-u);for(let e=m;e<=p;e++){const t=e===m?Math.max(u,d):(n+1-e)*o,c=e===p?Math.min(u,d):t-o;let y=d===u?Math.floor((i-l)/a):Math.floor((g*(t-u)+i-l)/a),x=d===u?Math.floor((f-l)/a):Math.floor((g*(c-u)+i-l)/a);if(x<y){const e=y;y=x,x=e}const w=e*s;y=Math.max(0,y),x=Math.min(s-1,x);for(let e=w+y;e<=w+x;e++)r[e]=h?h[e]:255}}}return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s):o(s,t)?e:function(e,t,i){if(!e)return e;const{width:s,height:n}=e,r=t.width/s,a=t.height/n,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/r,t=(i.xmax-o)/r,s=(l-i.ymax)/a,n=(l-i.ymin)/a;c=[[[e,s],[e,n],[t,n],[t,s],[e,s]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/r,(l-t)/a]))));const u=document.createElement("canvas");u.width=s,u.height=n;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,s,n).data,d=e.mask,m=s*n,p=new Uint8Array(m);for(let e=0;e<m;e++)d&&!d[e]||(p[e]=f[4*e+3]>127?255:0);return new ie.Z({pixelType:e.pixelType,width:s,height:n,mask:p,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,s):new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}(d.pixelBlock,c,a),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:m},t):(0,ne.js)(m)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,le.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,Z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const s=e.timeExtent||this.timeExtent;if(null!=i&&null!=s&&(null!=s.start||null!=s.end)){i=i.map((e=>e.clone()));const n=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),r=i.find((({dimensionName:e})=>"StdTime"===e));if(!n||!r)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=s,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=n.values){const e=n.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>{const i=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:e,n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:t;return u===h?i-n:Math.abs(s-h)-Math.abs(r-h)}))[0];r.values=[t]}else i=null}else if(n.hasRegularIntervals&&n.extent){const[e,t]=n.extent;u>t||h<e?i=null:r.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,Z.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",k.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:s}=this;if(s){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const n=(0,se.Ue)(s.functionDefinition?.toJSON()??s.toJSON(),i),r=new ee({rasterFunction:n});r.rasterJobHandler=this._rasterJobHandler.instance,await r.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=r}else this.raster=t,this._cachedRasterFunctionJson=null,await t.when();if(this._cachedRendererJson=null,!i&&!s)return;const{bandIds:n}=this,{bandCount:r}=this.raster.rasterInfo,a=n?.length?n.some((e=>e>=r)):r>=3;n&&(a||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:i}=this.raster,s=(0,Z.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,r=(0,re.ol)({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(r))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,re.FI)(i,n),t.rendererJSON=r,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=r)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let s;await this.updateRenderer();const n=this._rasterJobHandler.instance,r=this.bandIds??[];return s=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:r}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:r}),s}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const s=(0,S.C5)(e);return M.Z.create({size:256,spatialReference:e,origin:s?{x:s.origin[0],y:s.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,s={}){if(n(this),s.requestAsImageElement){const n=this.getTileUrl(e,t,i);return(0,b.default)(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{rasterInfo:r}=this;if(null!=r.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const n=s.tileInfo||r.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,i,n),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,i,s)}async fetchPixels(e,t,i,s={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,s))}async identify(e,t={}){const{raster:i,rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&!(s.hasMultidimensionalTranspose&&((0,Z.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new r.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,Z.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,Z.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new F.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{n(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){n(this);const{raster:e}=this,t=(0,re.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){n(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,re.YD)(t));const i=(0,Z.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name;if(!this.renderer||"override"===e){const e=(0,re.Ob)(t,{bandIds:this.bandIds,variableName:s}),i=t.statistics,n=i&&i.length>0?i[0]:null,r=n?.max??0,a=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(r>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const r=(0,re.ol)({...this.renderer.toJSON(),variableName:s}),a=(0,re.FI)(t,s);this.symbolizer?(this.symbolizer.rendererJSON=r,this.symbolizer.rasterInfo=a):this.symbolizer=new ae.Z({rendererJSON:r,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=(0,re.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else ue.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function n(e){if(!e.raster||!e.rasterInfo)throw new r.Z("imagery-tile","no raster")}return(0,s._)([(0,u.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_cachedRasterFunctionJson",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"bandIds",void 0),(0,s._)([(0,u.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,s._)([(0,u.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,s._)([(0,u.Cb)()],t.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"ioConfig",void 0),(0,s._)([(0,u.Cb)({type:[T.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,s._)([(0,u.Cb)({type:C.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"raster",void 0),(0,s._)([(0,u.Cb)({type:k.Z,json:{name:"renderingRule",write:!0}})],t.prototype,"rasterFunction",null),(0,s._)([(0,u.Cb)()],t.prototype,"rasterInfo",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"sourceJSON",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:ce.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,s._)([(0,u.Cb)({type:M.Z})],t.prototype,"tileInfo",void 0),(0,s._)([(0,u.Cb)(v.HQ)],t.prototype,"url",null),(0,s._)([(0,u.Cb)({types:_.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:_.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,s._)([(0,I.r)("renderer")],t.prototype,"readRenderer",null),(0,s._)([(0,u.Cb)()],t.prototype,"symbolizer",void 0),t=(0,s._)([(0,p.j)("esri.layers.ImageryTileMixin")],t),t};var fe=i(38009),de=i(16859),me=i(34760),pe=i(72965),ge=i(28294),ye=i(1231),xe=i(69608),we=i(25972),_e=i(20095);function be(e){const t=e.fields,i=e.records,s=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",n=[{name:s,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),r=n.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[s]=o++,l=1;l<r.length;l++)t[r[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:n,features:a}}class Ie{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const s=t.getUint32(4,!0),n=t.getUint16(8,!0),r=t.getUint16(10,!0),a={version:i,recordCount:s,headerByteCount:n,recordByteCount:r};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,_e.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<s&&e.byteLength-o>r;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,_e.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const s=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(s.substring(0,4),10),parseInt(s.substring(4,6),10)-1,parseInt(s.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=r}}return{header:a,fields:l,records:c,recordSet:be({fields:l,records:c})}}}var Se=i(87521);const Re=new Map;Re.set("int16","esriFieldTypeSmallInteger"),Re.set("int32","esriFieldTypeInteger"),Re.set("int64","esriFieldTypeInteger"),Re.set("float32","esriFieldTypeSingle"),Re.set("float64","esriFieldTypeDouble"),Re.set("text","esriFieldTypeString");let ve=class extends X{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new r.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:s}=this._parseHeader(t);if("thematic"===s.dataType){const e=await this._fetchAuxiliaryInformation();s.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",s),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,s={}){const{transposeInfo:n}=this.rasterInfo.storageInfo,{transposedVariableName:r}=s,a=!(!n||!r),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,s.multidimensionalDefinition,r),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:s.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const d=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:s.signal});if(!d)return null;const[m,p]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:m,height:p,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,histograms:s,colormap:n,blockWidth:r,blockHeight:a,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ce.Z(u?.wkid||u?.wkt?u:h);let d=new $.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const m=new J.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),p=Math.round((d.xmax-d.xmin)/m.x),g=Math.round((d.ymax-d.ymin)/m.y),y=this._parseTransform(e.geodataXform),x=y?d:null;y&&(d=y.forwardTransform(d),m.x=(d.xmax-d.xmin)/p,m.y=(d.ymax-d.ymin)/g);const w=e.properties??{},_=e.format.toLowerCase().replace("cache/",""),b=new J.Z(e.origin.x,e.origin.y,f);let I,S,R,v;if(n&&n.colors)for(I=[],S=0;S<n.colors.length;S++)R=n.colors[S],v=n.values?n.values[S]:S,I.push([v,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const T=e.LODInfos,C=[];for(S=0;S<T.levels.length;S++)C.push(new D.Z({level:T.levels[S],resolution:T.resolutions[S],scale:96/.0254*T.resolutions[S]}));const k=new M.Z({dpi:96,lods:C,format:_,origin:b,size:[r,a],spatialReference:f}),F={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},z=[{maxCol:Math.ceil(p/r)-1,maxRow:Math.ceil(g/a)-1,minCol:0,minRow:0}];let P=2;if(l>0)for(S=0;S<l;S++)z.push({maxCol:Math.ceil(p/P/r)-1,maxRow:Math.ceil(g/P/a)-1,minCol:0,minRow:0}),P*=2;const Z=e.mdInfo;let N=null;if(Z&&w._yxs){const e=w._yxs;N={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:F,rasterInfo:new we.Z({width:p,height:g,pixelType:t,bandCount:i,extent:d,nativeExtent:x,transform:y,spatialReference:f,pixelSize:m,keyProperties:w,statistics:c,histograms:s,multidimensionalInfo:Z,colormap:I,storageInfo:new O.Z({blockWidth:r,blockHeight:a,pyramidBlockWidth:r,pyramidBlockHeight:a,origin:b,tileInfo:k,transposeInfo:N,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:z})})}}_parseTransform(e){if(!(0,Se.j)(e))throw new r.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,Se.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new r.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),s=await Promise.all([t,i]);let n;if(s[0]){let e=s[0].fields;const t=s[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":Re.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(n={fields:e,features:i})}}return!n&&s[1]&&(n=Ie.parse(s[1]).recordSet),K.Z.fromJSON(n)}_buildCacheFilePath(e,t,i,s,n){const r=this._getPackageSize(!!n),a=Math.floor(t/r)*r,o=Math.floor(i/r)*r,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=s?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!n){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(n||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replaceAll(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const s=this._getPackageSize(i),n=s*(e%s)+t%s;if(n<0)throw new Error("Invalid level / row / col");return 20+n*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let s,n=0;for(s=0;s<5;s++)n|=(255&i[s])<<8*s;const r=0xffffffffff&n;for(n=0,s=5;s<8;s++)n|=(255&i[s])<<8*(s-5);return{position:r,recordSize:0xffffffffff&n}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,s._)([(0,u.Cb)({readOnly:!0})],ve.prototype,"storageInfo",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],ve.prototype,"datasetFormat",void 0),ve=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.CloudRaster")],ve);const Te=ve;let Ce=class extends X{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:s,histograms:n,name:r,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new $.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ce.Z({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,m={x:f.width/c,y:f.height/u},p=new we.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:m,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:s,isPseudoSpatialReference:d,histograms:n});this.createRemoteDatasetStorageInfo(p,512,512),this._set("rasterInfo",p),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=r,this.url="/InMemory/"+r}fetchRawTile(e,t,i,s={}){const n=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(n)}async _buildInMemoryRaster(e,t,i){const s=this.rasterInfo.storageInfo.maximumPyramidLevel,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:s},i):Promise.resolve((0,U.Vl)(e,t,s)),a=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,c=a?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,ne.Hv)(e)),u=await(0,l.as)([n,c]);if(!u[0].value&&u[1].value)throw new r.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,a||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ce.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Ce.prototype,"data",void 0),Ce=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],Ce);const ke=Ce;function Fe(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=[];if(t){const n=Fe(e,i);for(let e=0;e<n.length;e++)Fe(n[e],t).forEach((e=>s.push(e)));return s}const n=e.getElementsByTagNameNS("*",i);if(!n||0===n.length)return[];for(let e=0;e<n.length;e++)s.push(n[e]||n.item(e));return s}function Me(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=Fe(e,i);return s.length>0?t?Me(s[0],t):s[0]:null}function ze(e,t=null){const i=t?Me(e,t):e;let s;return i?(s=i.textContent||i.nodeValue,s?s.trim():null):null}function Pe(e,t){return function(e,t){const i=Fe(e,t),s=[];let n;for(let e=0;e<i.length;e++)n=i[e].textContent||i[e].nodeValue,n&&(n=n.trim(),""!==n&&s.push(n));return s}(e,t).map((e=>Number(e)))}function De(e,t){const i=ze(e,t);return Number(i)}function Oe(e,t){const i=e?.nodeName?.toLowerCase(),s=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===s}var Ze=i(87390);function Ne(e,t){if(!e||!t)return null;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),i.push(t[s]);return i}function Je(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ce.Z({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),s=e.indexOf("PROJCS"),n=s>-1?s:e.indexOf("GEOGCS");if(-1===n)return null;const r=e.slice(n,e.lastIndexOf("]",i)+1).trim(),a=e.slice(i,e.lastIndexOf("]")).trim();t=Ae(r);const o=new ce.Z(t?{wkid:t}:{wkt:r}),l=Ae(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ae(e),new ce.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ae(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),s=i[0]?.toLowerCase();if(("epsg"===s||"esri"===s)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ee(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Oe(e,"SRS")){if(!t.spatialReference){const i=ze(e);t.spatialReference=Je(i)}}else if(Oe(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:s}=function(e){const t=Me(e,"GeodataXform"),i=Je(De(t,"SpatialReference/WKID")||ze(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const s=De(t,"PolynomialOrder")??1,n=Pe(t,"CoeffX/Double"),r=Pe(t,"CoeffY/Double"),a=Pe(t,"InverseCoeffX/Double"),o=Pe(t,"InverseCoeffY/Double"),l=Ne(n,r),c=Ne(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Ze.Z({spatialReference:i,polynomialOrder:s,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=s,t.spatialReference||(t.spatialReference=i)}else Fe(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=ze(e)));else if(Oe(e,"PAMRasterBand")){const i=function(e){const t=De(e,"NoDataValue"),i=Me(e,"Histograms/HistItem"),s=De(i,"HistMin"),n=De(i,"HistMax"),r=De(i,"BucketCount"),a=ze(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Fe(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=De(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=s&&null!=n?{min:s,max:n,size:r||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(f.pC):null;const s=!!i[0].histogram;t.histograms=s?i.map((e=>e.histogram)).filter(f.pC):null}return t}let Be=class extends X{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:s,histograms:n,transform:r}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ce.Z({wkid:3857})),n?.length&&null==s&&(s=(0,ne.Oh)(n));const{width:o,height:l}=t;let c=new $.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=r?r.forwardTransform(c):c;let h=!0;if(r){const e=r.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(r=null,c=u)}const f=new ke({data:{extent:u,nativeExtent:c,transform:r,pixelBlock:t,statistics:s,histograms:n,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,G.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new r.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const s=i.toLowerCase(),n="gif"===s||"bmp"===s||!(0,d.Z)("ios"),a=await this.decodePixelBlock(t,{format:s,useCanvas:n,hasNoZlibMask:!0});if(null==a)throw new r.Z("image-aux-raster:open","the data cannot be decoded");return a}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],s=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),n=this.datasetFormat,r="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,a=r&&i.includes(r)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+r,{responseType:"text",signal:t}),o=await(0,l.as)([s,a]);if(t?.aborted)throw(0,l.zE)();const c=Ee(o[0].value?.data);if(!c.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;c.transform=6===e?.length?new Ze.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return c}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Be.prototype,"datasetFormat",void 0),Be=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],Be);const He=Be;var Le=i(70586),We=i(17452),qe=i(28589),je=i(29680),Ge=i(26059);let Ue=class extends X{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const s=i.data;if(this.sourceJSON=s,!s)throw new r.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!s.tileInfo)throw new r.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=s.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(s.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===s.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=s.name?.slice(s.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:t});if(null==n)throw new r.Z("image-server-raster:open","cannot initialize image service");const a="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:n,maxLOD:r}=t;if(null!=n&&null!=r)return M.Z.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=n&&e<=r))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,n=i?t(i):1/0,r=s?t(s):-1/0;return M.Z.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=n&&i>=r}))})}return M.Z.fromJSON(e)}(s.tileInfo,s):M.Z.fromJSON(s.tileInfo);(0,Le.O3)(a);const[o,l]=this._computeMinMaxLOD(n,a),{extent:c,pixelSize:u}=n,h=.5/n.width*u.x,f=Math.max(u.x,u.y),{lods:d}=a;("Map"!==this.tileType&&0!==s.maxScale||Math.abs(u.x-u.y)>h||!d.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,n.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),n.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const m=o.level-l.level,[p,g]=a.size,y=[],x=[];d.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&y.push({x:e.resolution,y:e.resolution}),t<d.length-1&&x.push(Math.round(10*e.resolution/d[t+1].resolution)/10)})),y.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,p,g,a.origin,y,m),_=y.length>1?y.slice(1):null;let b;s.transposeInfo&&(b={tileSize:[s.transposeInfo.rows,s.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0});const I=x.length<=1||x.length>=3&&x.slice(0,x.length-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/m))/10;if(n.storageInfo=new O.Z({blockWidth:a.size[0],blockHeight:a.size[1],pyramidBlockWidth:a.size[0],pyramidBlockHeight:a.size[1],pyramidResolutions:_,pyramidScalingFactor:I,compression:a.format,origin:a.origin,firstPyramidLevel:1,maximumPyramidLevel:m,tileInfo:a,transposeInfo:b,blockBoundary:w}),this._fixGCSShift(n),this._set("rasterInfo",n),s.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:(0,We.mN)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new qe.y({layer:e})}}async fetchRawTile(e,t,i,s={}){const{storageInfo:n,extent:r}=this.rasterInfo,{transposeInfo:a}=n,o=null!=a&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const l=o?0:n.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:s.signal});if(!h)return null;const f=o?a.tileSize:n.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const m=n.blockBoundary[e];if("jpg"!==n.compression||i>m.minCol&&i<m.maxCol&&t>m.minRow&&t<m.maxRow)return d;const{origin:p,blockWidth:g,blockHeight:y}=n,{x,y:w}=this.getPyramidPixelSize(e),_=Math.round((r.xmin-p.x)/x)%g,b=Math.round((r.xmax-p.x)/x)%g||g,I=Math.round((p.y-r.ymax)/w)%y,S=Math.round((p.y-r.ymin)/w)%y||y,R=i===m.minCol?_:0,v=t===m.minRow?I:0,T=i===m.maxCol?b:g,C=t===m.maxRow?S:y;return(0,U.pW)(d,{x:R,y:v},{width:T-R,height:C-v}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([i,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:n[0]||null,histograms:n[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:n}=this.rasterInfo.storageInfo;let r=n-s+this._levelOffset;const a=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,s++,i=this.identifyPixelLocation(a,s,t.datumTransformation),null===i)return null}return-1===r||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),n=ce.Z.fromJSON(t.spatialReference||e.spatialReference),r=new J.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n});return new we.Z({width:i,height:s,bandCount:3,extent:$.Z.fromJSON(e),spatialReference:n,pixelSize:r,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=(0,Ge.g)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),n=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,r=await Promise.all([s,n]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new je.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:n}=t,r=t.lodAt(Math.max.apply(null,n.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,n.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=n[0].level,[r,a];if("Raster"===o)return[n.find((e=>e.resolution===i.x))??r,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=n.find((e=>Math.abs(e.scale-c)<s)),u||(u=n.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??r));let h=a;return l>0&&(h=n.find((e=>Math.abs(e.scale-l)<s))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ue.prototype,"datasetFormat",void 0),(0,s._)([(0,u.Cb)()],Ue.prototype,"tileType",void 0),Ue=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],Ue);const Ve=Ue;var $e=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Xe=new Map;Xe.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Xe.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Xe.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Xe.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Ke=class extends X{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:s,files:n}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(s.statistics=t.statistics??s.statistics,s.histograms=t.histograms,t.histograms&&null==s.statistics&&(s.statistics=(0,ne.Oh)(t.histograms)))}this._set("rasterInfo",s),this._files=n;const r=await this.request(n.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(r.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,m=-1;for(;d<this._storageIndex.length;){m++;const e=Math.ceil(c/a/l**m)-1,t=Math.ceil(u/o/l**m)-1;d+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,m>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=m),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){const{blockWidth:n,blockHeight:r,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(n*r);return new ie.Z({width:n,height:r,pixels:null,mask:e,validPixelCount:0})}const{bandIds:d}=this.ioConfig,m=this._getBandSegmentCount(),p=[];let g=0;for(g=0;g<m;g++)d&&!d.includes(g)||p.push(this.request(this._files.data,{range:{from:u[g].from,to:u[g].to},responseType:"array-buffer",signal:s.signal}));const y=await Promise.all(p),x=y.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let _=0;for(g=0;g<m;g++)w.set(new Uint8Array(y[g].data),_),_+=y[g].data.byteLength;const b=Xe.get(this.rasterInfo.storageInfo.compression).decoderFormat,I=await this.decodePixelBlock(w.buffer,{width:n,height:r,format:b,planes:d?.length||l,pixelType:c});if(null==I)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==b&&!I.mask&&(S=S[0],null!=S)){const e=I.width*I.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(g=0;g<e;g++)Math.abs((I.pixels[0][g]-S)/S)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)I.pixels[0][g]!==S&&(t[g]=1);I.mask=t}let R=0,v=0;if(h!==n||f!==r){let e=I.mask;if(e)for(g=0;g<r;g++)if(v=g*n,g<f)for(R=h;R<n;R++)e[v+R]=0;else for(R=0;R<n;R++)e[v+R]=0;else for(e=new Uint8Array(n*r),I.mask=e,g=0;g<f;g++)for(v=g*n,R=0;R<h;R++)e[v+R]=1}return I}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,s,n,r,a;if($e.f){for(i=new Uint8Array(e),n=new ArrayBuffer(e.byteLength),s=new Uint8Array(n),r=0;r<e.byteLength/4;r++)for(a=0;a<4;a++)s[4*r+a]=i[4*r+3-a];t=new Uint32Array(n)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Xe.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:s,blockHeight:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,d=0;for(h=0;h<e;h++)d=r**h,c=Math.ceil(a/s/d),u=Math.ceil(o/n/d),f+=c*u;d=r**e,c=Math.ceil(a/s/d),u=Math.ceil(o/n/d),f+=t*c+i,f*=4*l;const m=this._storageIndex.subarray(f,f+4*l);let p=0,g=0;const y=[];for(let e=0;e<l;e++)p=m[4*e]*2**32+m[4*e+1],g=p+m[4*e+2]*2**32+m[4*e+3],y.push({from:p,to:g});return{ranges:y,actualTileWidth:i<c-1?s:Math.ceil(a/d)-s*(c-1),actualTileHeight:t<u-1?n:Math.ceil(o/d)-n*(u-1)}}_parseHeader(e){const t=Me(e,"MRF_META/Raster");if(!t)throw new r.Z("mrf:open","not a valid MRF format");const i=Me(t,"Size"),s=parseInt(i.getAttribute("x"),10),n=parseInt(i.getAttribute("y"),10),a=parseInt(i.getAttribute("c"),10),o=(ze(t,"Compression")||"none").toLowerCase();if(!Xe.has(o))throw new r.Z("mrf:open","currently does not support compression "+o);const l=ze(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new r.Z("mrf:open","currently does not support pixel type "+l);const u=Me(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),d=Me(t,"DataValues");let m,p;if(d&&(p=d.getAttribute("NoData"),null!=p&&(m=p.trim().split(" ").map((e=>parseFloat(e))))),Me(e,"MRF_META/CachedSource"))throw new r.Z("mrf:open","currently does not support MRF referencing other data files");const g=Me(e,"MRF_META/GeoTags"),y=Me(g,"BoundingBox");let x,w=!1;if(null!=y){const e=parseFloat(y.getAttribute("minx")),t=parseFloat(y.getAttribute("miny")),i=parseFloat(y.getAttribute("maxx")),s=parseFloat(y.getAttribute("maxy")),n=ze(g,"Projection")||"";let r=ce.Z.WGS84;if("LOCAL_CS[]"!==n)if(n.toLowerCase().startsWith("epsg:")){const e=Number(n.slice(5));isNaN(e)||0===e||(r=new ce.Z({wkid:e}))}else r=Je(n)??ce.Z.WGS84;else w=!0,r=new ce.Z({wkid:3857});x=new $.Z(e,t,i,s),x.spatialReference=r}else w=!0,x=new $.Z({xmin:-.5,ymin:.5-n,xmax:s-.5,ymax:.5,spatialReference:new ce.Z({wkid:3857})});const _=Me(e,"MRF_META/Rsets"),b=parseInt(_&&_.getAttribute("scale")||"2",10),I=x.spatialReference,S=new O.Z({origin:new J.Z({x:x.xmin,y:x.ymax,spatialReference:I}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:b}),R=new J.Z({x:x.width/s,y:x.height/n,spatialReference:I}),v=new we.Z({width:s,height:n,extent:x,isPseudoSpatialReference:w,spatialReference:I,bandCount:a,pixelType:c,pixelSize:R,noDataValue:m,storageInfo:S}),T=ze(e,"datafile"),C=ze(e,"IndexFile");return{rasterInfo:v,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Xe.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}};(0,s._)([(0,u.Cb)()],Ke.prototype,"_files",void 0),(0,s._)([(0,u.Cb)()],Ke.prototype,"_storageIndex",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ke.prototype,"datasetFormat",void 0),Ke=(0,s._)([(0,p.j)("esri.layers.support.rasterIO.MRFRaster")],Ke);const Qe=Ke;var et=i(94793),tt=i(9832);const it=(e,t)=>e.get(t)?.values,st=(e,t)=>e.get(t)?.values?.[0];let nt=class extends X{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new r.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:n,isBigTiff:o}=(0,et.cK)(i),l=[];await this._readIFDs(l,i,s,n,0,o?8:4,t);const{imageInfo:c,rasterInfo:u}=this._parseIFDs(l),h=(0,et.ee)(l),f=(0,et.I7)(l);if(this._headerInfo={littleEndian:s,isBigTiff:o,ifds:l,pyramidIFDs:h,maskIFDs:f,...c},this._set("rasterInfo",u),!c.isSupported)throw new r.Z("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new r.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");u.isPseudoSpatialReference&&a.Z.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const d=l[0].get("PREDICTOR")?.values?.[0],m=l[0].get("SAMPLEFORMAT")?.values?.[0];if(3===m&&2===d)throw new r.Z("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:p=[]}=this.ioConfig;if(!p.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,u)}p.includes("vat.dbf")||1!==u.bandCount||"u8"!==u.pixelType||(u.attributeTable=await this._fetchAuxiliaryTable(e),null!=u.attributeTable&&(u.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const n=await this._fetchRawTiffTile(e,t,i,!1,s);if(null!=n&&this._headerInfo.hasMaskBand){const r=await this._fetchRawTiffTile(e,t,i,!0,s);null!=r&&r.pixels[0]instanceof Uint8Array&&(n.mask=r.pixels[0])}return n}_parseIFDs(e){const t=(0,et.FI)(e),{width:i,height:s,tileWidth:n,tileHeight:r,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:m,metadata:p}=t;let g=Je(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),y=!!t.isPseudoGeographic;null==g&&(y=!0,g=new ce.Z({wkid:3857}));const x=new $.Z({...t.extent,spatialReference:g}),w=new J.Z(x?{x:x.xmin,y:x.ymax,spatialReference:g}:{x:0,y:0}),_=new O.Z({blockWidth:n,blockHeight:r,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:d}),b=new J.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),I=p?{BandProperties:p.bandProperties,DataType:p.dataType}:{};let S=null;const R=st(e[0],"PHOTOMETRICINTERPRETATION"),v=it(e[0],"COLORMAP");if(R<=3&&v?.length>3&&v.length%3==0){S=[];const e=v.length/3;for(let t=0;t<e;t++)S.push([t,v[t]>>>8,v[t+e]>>>8,v[t+2*e]>>>8])}const T=new we.Z({width:i,height:s,bandCount:a,pixelType:o,pixelSize:b,storageInfo:_,spatialReference:g,isPseudoSpatialReference:y,keyProperties:I,extent:x,colormap:S,statistics:p?p.statistics:null});return m?.length&&(T.nativeExtent=new $.Z({xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:g}),T.transform=new Ze.Z({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new J.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),_.origin.x=-.5,_.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,ne.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new J.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,s,n,r=4,a){if(!s)return null;(s>=t.byteLength||s<0)&&(t=(await this.request(this.url,{range:{from:s+n,to:s+n+this._bufferSize},responseType:"array-buffer",signal:a})).data,n=s+n,s=0);const o=await this._readIFD(t,i,s,n,tt.Z.TIFF_TAGS,r,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-n,n,r,a)}async _readIFD(e,t,i,s,n=tt.Z.TIFF_TAGS,r=4,a){if(!e)return null;const o=(0,et.vr)(e,t,i,s,n,r);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const n=i.map((e=>e.offlineOffsetSize)).filter(f.pC),r=Math.min.apply(null,n.map((e=>e[0])));if(Math.min.apply(null,n.map((e=>e[0]+e[1])))-r<=this._bufferSize){const{data:n}=await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:a});e=n,s=r,i.forEach((i=>(0,et.Dq)(e,t,i,s)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),n=i?.values;if(n&&n.length>4){const r=n[0]+"."+n[1]+"."+n[2],o=await this._readIFD(e,t,i.valueOffset+6-s,s,tt.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:s,to:s+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,s,tt.Z.TIFF_TAGS,4,a)}}async _fetchRawTiffTile(e,t,i,s,n={}){const r=this._getTileLocation(e,t,i,s);if(!r)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=r,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:n.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),d=1===h.length?h[0].data:new ArrayBuffer(f),m=[0],p=[0];if(h.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){const s=h[t].data;e.set(new Uint8Array(s),i),m[t]=i,i+=s.byteLength,p[t]=s.byteLength}}const{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:m,sizes:p},width:g,height:y,planes:null,pixelType:null});if(null==x)return null;let w,_,b;if(o!==g||l!==y){let e=x.mask;if(e)for(w=0;w<y;w++)if(b=w*g,w<l)for(_=o;_<g;_++)e[b+_]=0;else for(_=0;_<g;_++)e[b+_]=0;else for(e=new Uint8Array(g*y),x.mask=e,w=0;w<l;w++)for(b=w*g,_=0;_<o;_++)e[b+_]=1}return x}_getTileLocation(e,t,i,s=!1){const{firstPyramidLevel:n,blockBoundary:r}=this.rasterInfo.storageInfo,a=0===e?0:e-(n-1),{_headerInfo:o}=this;if(!o)return null;const l=s?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,et.If)(l,o),u=it(l,"TILEOFFSETS");if(void 0===u)return null;const h=it(l,"TILEBYTECOUNTS"),{minRow:f,minCol:d,maxRow:m,maxCol:p}=r[a];if(t>m||i>p||t<f||i<d)return null;const g=st(l,"IMAGEWIDTH"),y=st(l,"IMAGELENGTH"),x=st(l,"TILEWIDTH"),w=st(l,"TILELENGTH"),_=[];if(c){const{bandCount:e}=this.rasterInfo;for(let s=0;s<e;s++){const e=s*(m+1)*(p+1)+t*(p+1)+i;_[s]={from:u[e],to:u[e]+h[e]-1}}}else{const e=t*(p+1)+i;_.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<_.length;e++)if(null==_[e].from||!_[e].to||_[e].to<0)return null;return{ranges:_,ifd:l,actualTileWidth:i===p&&g%x||x,actualTileHeight:t===m&&y%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ie.parse(t);return i?.recordSet?K.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,s._)([(0,u.Cb)()],nt.prototype,"_files",void 0),(0,s._)([(0,u.Cb)()],nt.prototype,"_headerInfo",void 0),(0,s._)([(0,u.Cb)()],nt.prototype,"_bufferSize",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],nt.prototype,"datasetFormat",void 0),nt=(0,s._)([(0,p.j)("esri.layers.support.rasterDatasets.TIFFRaster")],nt);const rt=nt,at=new Map;at.set("CRF",{desc:"Cloud Raster Format",constructor:Te}),at.set("MRF",{desc:"Meta Raster Format",constructor:Qe}),at.set("TIFF",{desc:"GeoTIFF",constructor:rt}),at.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Ve}),at.set("JPG",{desc:"JPG Raster Format",constructor:He}),at.set("PNG",{desc:"PNG Raster Format",constructor:He}),at.set("GIF",{desc:"GIF Raster Format",constructor:He}),at.set("BMP",{desc:"BMP Raster Format",constructor:He});class ot{static get supportedFormats(){const e=new Set;return at.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:s}=e;let n=e.datasetFormat;null==n&&t.lastIndexOf(".")&&(n=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===n||"TIF"===n?n="TIFF":"JPG"!==n&&"JPEG"!==n&&"JFIF"!==n||(n="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");const a={url:t,sourceJSON:s,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(n&&this.supportedFormats.has(n)){if("CRF"===n&&!i?.enableCRF)throw new r.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=at.get(n).constructor,l=new o(a),await l.open({signal:e.signal}),l}if(n)throw new r.Z("rasterfactory:open","not a supported format "+n);const c=Array.from(at.keys());let u=0;const h=()=>(n=c[u++],n&&("CRF"!==n||i?.enableCRF)?(o=at.get(n).constructor,l=new o(a),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){at.has(e.toUpperCase())||at.set(e.toUpperCase(),{desc:t,constructor:i})}}var lt=i(32163);let ct=class extends((0,x.h)((0,pe.M)((0,fe.q)((0,de.I)((0,w.N)(he((0,ge.n)((0,y.Y)((0,me.Q)((0,o.R)(g.Z))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}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:["Image Service"]},e).catch(l.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new ye.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new ye.Z({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:t}=this,i=t?.attributeTable,s=null!=i?i.fields:null;if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e.push(...t)}const n=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===n||"vector-uv"===n)&&null!=r){const t=r.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ye.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ye.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,i=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return(0,lt.eZ)({fields:t,title:this.title},{...e,visibleFieldNames:i})}async generateRasterInfo(e,t){if(!(e=(0,h.TJ)(k.Z,e)))return this.rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const s=(0,se.Ue)(e.functionDefinition?.toJSON()??e.toJSON(),i),n=new ee({rasterFunction:s});return await n.open(t),n.rasterInfo}catch(e){if(e instanceof r.Z)throw e;throw new r.Z("imagery-tile-layer","the given raster function is not supported")}}write(e,t){const i=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new r.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,se.G8)(t.toJSON(),i);const s=await Promise.all(i.map((t=>ot.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),n=s.findIndex((e=>null==e));if(n>-1)throw new r.Z("imagery-tile-layer:open",`cannot open raster: ${i[n]}`);if(this._primaryRasters=s,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,se.Ue)(t.functionDefinition?.toJSON()??t.toJSON(),e),n=new ee({rasterFunction:i});try{await n.open(),this.raster=n}catch(e){const t=a.Z.getLogger(this);e instanceof r.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=s[0]}}else this.raster=s[0]}const i=this.raster.rasterInfo;if(!i)throw new r.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,s._)([(0,u.Cb)()],ct.prototype,"_primaryRasters",void 0),(0,s._)([(0,u.Cb)({type:[h.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ct.prototype,"bandIds",void 0),(0,s._)([(0,u.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,m.J)(xe.cl)],ct.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)(v.rn)],ct.prototype,"legendEnabled",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ct.prototype,"isReference",void 0),(0,s._)([(0,u.Cb)({type:["show","hide"]})],ct.prototype,"listMode",void 0),(0,s._)([(0,u.Cb)({json:{read:!0,write:!0}})],ct.prototype,"blendMode",void 0),(0,s._)([(0,u.Cb)()],ct.prototype,"sourceJSON",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ct.prototype,"version",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,json:{read:!1}})],ct.prototype,"type",void 0),(0,s._)([(0,u.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ct.prototype,"operationalLayerType",void 0),(0,s._)([(0,u.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ct.prototype,"popupEnabled",void 0),(0,s._)([(0,u.Cb)({type:n.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ct.prototype,"popupTemplate",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],ct.prototype,"defaultPopupTemplate",null),(0,s._)([(0,u.Cb)({readOnly:!0,type:[ye.Z]})],ct.prototype,"fields",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:[ye.Z]})],ct.prototype,"rasterFields",null),ct=(0,s._)([(0,p.j)("esri.layers.ImageryTileLayer")],ct);const ut=ct},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>r}),i(68773),i(40330);var s=i(22974),n=i(17452);function r(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,n.mN)(e):(0,s.d9)(e)}function o(e,t,i){const s={};for(const n in e){if("declaredClass"===n)continue;const r=e[n];if(null!=r&&"function"!=typeof r)if(Array.isArray(r)){s[n]=[];for(let e=0;e<r.length;e++)s[n][e]=o(r[e])}else if("object"==typeof r)if(r.toJSON){const e=r.toJSON(i&&i[n]);s[n]=t?e:JSON.stringify(e)}else s[n]=t?r:JSON.stringify(r);else s[n]=r}return s}i(71058)}}]);
|