@arcgis/core 4.21.0-next.20210916 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/EULA.pdf +0 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/836e8ed3f37b014670ec.js +1 -0
  4. package/assets/esri/core/workers/chunks/a1d5d196d14b194636ee.js +1 -0
  5. package/assets/esri/core/workers/chunks/dd33c0ef52ad555092bd.js +1 -0
  6. package/assets/esri/core/workers/chunks/ee32a34cce5d2f65d01c.js +1 -0
  7. package/assets/esri/core/workers/chunks/f57c8fc116d64723c16c.js +1 -0
  8. package/config.js +1 -1
  9. package/interfaces.d.ts +47 -123
  10. package/layers/ImageryTileLayer.js +1 -1
  11. package/layers/mixins/ArcGISImageService.js +1 -1
  12. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  13. package/package.json +1 -1
  14. package/support/revision.js +1 -1
  15. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  16. package/views/2d/layers/features/controllers/support/sourceAdapters.js +1 -1
  17. package/views/2d/layers/features/schemaUtils.js +1 -1
  18. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  19. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  20. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  21. package/views/3d/layers/analysis/LineOfSight/LineOfSightController.js +1 -1
  22. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  23. package/views/draw/support/Reshape.js +1 -1
  24. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  25. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  26. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  27. package/assets/esri/core/workers/chunks/05ad927ed6b27c8134b4.js +0 -1
  28. package/assets/esri/core/workers/chunks/42f1ea5f61521156e044.js +0 -1
  29. package/assets/esri/core/workers/chunks/5ec6930af98cbccc6a9a.js +0 -1
  30. package/assets/esri/core/workers/chunks/62f264baf3cbd76ecac6.js +0 -1
  31. package/assets/esri/core/workers/chunks/d4a77cf8f298d94879d6.js +0 -1
  32. package/views/2d/layers/features/controllers/support/sources.js +0 -5
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2134,3172],{68773:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(16358),o=(r(80442),r(78286));const s={apiKey:void 0,applicationUrl:n.Z.location&&n.Z.location.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryService:null,geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(n.Z.esriConfig&&((0,o.RH)(s,n.Z.esriConfig,!0),delete s.has),!s.assetsPath){const e="4.21.0";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(s,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),s.request.corsEnabledServers=[],s.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0}},20102:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(22974),o=r(92604),s=r(58896);class i extends s.Z{constructor(e,t,r){if(super(e,t,r),!(this instanceof i))return new i(e,t,r)}toJSON(){if(null!=this.details)try{return{name:this.name,message:this.message,details:JSON.parse(JSON.stringify(this.details,((e,t)=>{if(t&&"object"==typeof t&&"function"==typeof t.toJSON)return t;try{return(0,n.d9)(t)}catch(e){return"[object]"}})))}}catch(e){throw o.Z.getLogger("esri.core.Error").error(e),e}return{name:this.name,message:this.message,details:this.details}}static fromJSON(e){return new i(e.name,e.message,e.details)}}i.prototype.type="error"},92604:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(68773),o=(r(80442),r(70586)),s=r(19153);const i={info:0,warn:1,error:2,none:3};class a{constructor(e){this.level=null,this._module="",this._parent=null,this.writer=null,this._loggedMessages={error:new Map,warn:new Map,info:new Map},null!=e.level&&(this.level=e.level),null!=e.writer&&(this.writer=e.writer),this._module=e.module,a._loggers[this.module]=this;const t=this.module.lastIndexOf(".");-1!==t&&(this._parent=a.getLogger(this.module.slice(0,t)))}get module(){return this._module}get parent(){return this._parent}error(...e){this._log("error","always",...e)}warn(...e){this._log("warn","always",...e)}info(...e){this._log("info","always",...e)}errorOnce(...e){this._log("error","once",...e)}warnOnce(...e){this._log("warn","once",...e)}infoOnce(...e){this._log("info","once",...e)}errorOncePerTick(...e){this._log("error","oncePerTick",...e)}warnOncePerTick(...e){this._log("warn","oncePerTick",...e)}infoOncePerTick(...e){this._log("info","oncePerTick",...e)}get test(){const e=this;return{loggedMessages:e._loggedMessages,clearLoggedWarnings:()=>e._loggedMessages.warn.clear()}}static get testSingleton(){return{resetLoggers(e={}){const t=a._loggers;return a._loggers=e,t},set throttlingDisabled(e){a._throttlingDisabled=e}}}static getLogger(e){let t=a._loggers[e];return t||(t=new a({module:e})),t}_log(e,t,...r){if(this._matchLevel(e)){if("always"!==t&&!a._throttlingDisabled){const n=this._argsToKey(r),o=this._loggedMessages[e].get(n);if("once"===t&&null!=o||"oncePerTick"===t&&o&&o>=a._tickCounter)return;this._loggedMessages[e].set(n,a._tickCounter),a._scheduleTickCounterIncrement()}for(const t of n.Z.log.interceptors)if(t(e,this.module,...r))return;this._inheritedWriter()(e,this.module,...r)}}_parentWithMember(e,t){let r=this;for(;(0,o.pC)(r);){const t=r[e];if((0,o.pC)(t))return t;r=r.parent}return t}_inheritedWriter(){return this._parentWithMember("writer",this._consoleWriter)}_consoleWriter(e,t,...r){console[e](`[${t}]`,...r)}_matchLevel(e){const t=n.Z.log.level?n.Z.log.level:"warn";return i[this._parentWithMember("level",t)]<=i[e]}_argsToKey(...e){return(0,s.hP)(JSON.stringify(e,((e,t)=>"object"!=typeof t||Array.isArray(t)?t:"[Object]")))}static _scheduleTickCounterIncrement(){a._tickCounterScheduled||(a._tickCounterScheduled=!0,Promise.resolve().then((()=>{a._tickCounter++,a._tickCounterScheduled=!1})))}}a._loggers={},a._tickCounter=0,a._tickCounterScheduled=!1,a._throttlingDisabled=!1},58896:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(78286);class o{constructor(e,t,r){this.name=e,this.details=r,this.message=void 0,this instanceof o&&(this.message=t&&function(e,t){return e.replace(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,(function(e,r){if(""===r)return"$";const o=(0,n.hS)(r,t),s=null==o?"":o;if(void 0===s)throw new Error(`could not find key "${r}" in template`);return s.toString()}))}(t,r)||"")}toString(){return"["+this.name+"]: "+this.message}}},91460:(e,t,r)=>{function n(e){return e&&("function"==typeof e.on||"function"==typeof e.addEventListener)}function o(e,t,r){if(!n(e))throw new TypeError("target is not a Evented or EventTarget object");if("on"in e)return e.on(t,r);if(Array.isArray(t)){const n=t.slice();for(const t of n)e.addEventListener(t,r);return{remove(){for(const t of n)e.removeEventListener(t,r)}}}return e.addEventListener(t,r),{remove(){e.removeEventListener(t,r)}}}function s(e,t,r){if(!n(e))throw new TypeError("target is not a Evented or EventTarget object");if("once"in e)return e.once(t,r);const s=o(e,t,(t=>{s.remove(),r.call(e,t)}));return{remove(){s.remove()}}}r.d(t,{vT:()=>n,on:()=>o,IH:()=>s})},16358:(e,t,r)=>{r.d(t,{Z:()=>n});const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0},80442:(e,t,r)=>{r.d(t,{Z:()=>u});var n,o,s=r(16358);let i;var a,c;function u(e){return"function"==typeof i[e]?i[e]=i[e](s.Z):i[e]}i=null!=(n=s.Z.dojoConfig)&&n.has||null!=(o=s.Z.esriConfig)&&o.has?{...null==(a=s.Z.dojoConfig)?void 0:a.has,...null==(c=s.Z.esriConfig)?void 0:c.has}:{},u.add=(e,t,r,n)=>((n||void 0===i[e])&&(i[e]=t),r&&u(e)),u.cache=i,u.add("esri-deprecation-warnings",!0),(()=>{u.add("host-webworker",void 0!==s.Z.WorkerGlobalScope&&self instanceof s.Z.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(u.add("host-browser",e),u.add("host-node","object"==typeof s.Z.process&&s.Z.process.versions&&s.Z.process.versions.node&&s.Z.process.versions.v8),u.add("dom",e),u("host-browser")){const e=navigator,t=e.userAgent,r=e.appVersion,n=parseFloat(r);if(u.add("wp",parseFloat(t.split("Windows Phone")[1])||void 0),u.add("msapp",parseFloat(t.split("MSAppHost/")[1])||void 0),u.add("khtml",r.includes("Konqueror")?n:void 0),u.add("edge",parseFloat(t.split("Edge/")[1])||void 0),u.add("opr",parseFloat(t.split("OPR/")[1])||void 0),u.add("webkit",!u("wp")&&!u("edge")&&parseFloat(t.split("WebKit/")[1])||void 0),u.add("chrome",!u("edge")&&!u("opr")&&parseFloat(t.split("Chrome/")[1])||void 0),u.add("android",!u("wp")&&parseFloat(t.split("Android ")[1])||void 0),u.add("safari",!r.includes("Safari")||u("wp")||u("chrome")||u("android")||u("edge")||u("opr")?void 0:parseFloat(r.split("Version/")[1])),u.add("mac",r.includes("Macintosh")),!u("wp")&&t.match(/(iPhone|iPod|iPad)/)){const e=RegExp.$1.replace(/P/,"p"),r=t.match(/OS ([\d_]+)/)?RegExp.$1:"1",n=parseFloat(r.replace(/_/,".").replace(/_/g,""));u.add(e,n),u.add("ios",n)}u.add("trident",parseFloat(r.split("Trident/")[1])||void 0),u("webkit")||(!t.includes("Gecko")||u("wp")||u("khtml")||u("trident")||u("edge")||u.add("mozilla",n),u("mozilla")&&u.add("ff",parseFloat(t.split("Firefox/")[1]||t.split("Minefield/")[1])||void 0))}})(),(()=>{if(s.Z.navigator){const e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),r=/iPhone/i.test(e);t&&u.add("esri-mobile",t),r&&u.add("esri-iPhone",r),u.add("esri-geolocation",!!navigator.geolocation)}u.add("esri-canvas-svg-support",!u("trident")),u.add("esri-wasm","WebAssembly"in s.Z),u.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in s.Z,t=!1===s.Z.crossOriginIsolated;return e&&!t})),u.add("esri-atomics","Atomics"in s.Z),u.add("esri-workers","Worker"in s.Z),u.add("esri-text-decoder","TextDecoder"in s.Z),u.add("esri-text-encoder","TextEncoder"in s.Z),u.add("web-feat:cache","caches"in s.Z),u.add("esri-workers-arraybuffer-transfer",!u("safari")||Number(u("safari"))>=12),u.add("featurelayer-snapshot-enabled",!0),u.add("featurelayer-snapshot-point-min-threshold",8e4),u.add("featurelayer-snapshot-point-max-threshold",4e5),u.add("featurelayer-snapshot-point-coverage",.1),u.add("featurelayer-advanced-symbols",!1),u.add("featurelayer-pbf",!0),u.add("featurelayer-pbf-statistics",!1),u.add("feature-layers-workers",!0),u.add("mapview-transitions-duration",200),u.add("mapserver-pbf-enabled",!1),u("host-webworker")||u("host-browser")&&(u.add("csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),u.add("esri-image-decode",(()=>{if("decode"in new Image){const e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>',void e.decode().then((()=>{u.add("esri-image-decode",!0,!0,!0)})).catch((()=>{u.add("esri-image-decode",!1,!0,!0)}))}return!1})),u.add("esri-url-encodes-apostrophe",(()=>{const e=s.Z.document.createElement("a");return e.href="?'",e.href.includes("?%27")})),u.add("vectortilelayer-max-buffers",u("ff")?160:Number.POSITIVE_INFINITY))})()},22974:(e,t,r)=>{r.d(t,{d9:()=>s,fS:()=>i,yd:()=>o}),r(80442);var n=r(1533);function o(e,t){let r;if(t)for(r in e)e.hasOwnProperty(r)&&(void 0===e[r]?delete e[r]:e[r]instanceof Object&&o(e[r],!0));else for(r in e)e.hasOwnProperty(r)&&void 0===e[r]&&delete e[r];return e}function s(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;if((0,n.W0)(e)||(0,n.lq)(e)||(0,n.KZ)(e)||(0,n.z3)(e)||(0,n.Uc)(e)||(0,n.Hx)(e)||(0,n.ZY)(e)||(0,n.xZ)(e)||(0,n.fS)(e))return(0,n.tP)(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof ArrayBuffer)return e.slice(0,e.byteLength);if(e instanceof Map){const t=new Map;return e.forEach(((e,r)=>{t.set(r,s(e))})),t}if(e instanceof Set){const t=new Set;return e.forEach((e=>{t.add(s(e))})),t}let t;const r=e;if("function"==typeof r.clone)t=r.clone();else if("function"==typeof r.map&&"function"==typeof r.forEach)t=r.map(s);else if("function"==typeof r.notifyChange&&"function"==typeof r.watch)t=r.clone();else{t={};for(const r of Object.getOwnPropertyNames(e))t[r]=s(e[r])}return t}function i(e,t){return e===t||"number"==typeof e&&isNaN(e)&&"number"==typeof t&&isNaN(t)||"function"==typeof(e||{}).getTime&&"function"==typeof(t||{}).getTime&&e.getTime()===t.getTime()||!1}},70586:(e,t,r)=>{function n(e){return null!=e}function o(e){return null==e}function s(e){return void 0===e}function i(e,t){return n(e)?t(e):null}function a(e){return e}function c(e,t){if(o(e))throw new Error(t);return e}function u(e,t){return n(e)?e:"function"==typeof t?t():t}function l(e){return n(e)&&e.destroy(),null}function d(e){return n(e)&&e.dispose(),null}function f(e){return n(e)&&e.remove(),null}function h(e){return n(e)&&e.release(),null}function p(e){return null}function m(e,t){const r=new Array;for(const n of e)r.push(y(n,null,t));return r}function g(e,t){for(const r of e)y(r,null,t)}function y(e,t,r){return n(e)?r(e):t}function w(e,t){return n(e)?t(e):null}function b(e){return e.filter((e=>n(e)))}function v(e,...t){let r=e;for(let e=0;e<t.length&&r;++e)r=r[t[e]];return r}function O(e){return e}r.d(t,{Po:()=>w,yw:()=>i,j0:()=>O,SC:()=>l,O3:()=>d,lV:()=>b,JR:()=>g,U2:()=>v,Wi:()=>o,pC:()=>n,o8:()=>s,Fd:()=>m,R2:()=>y,Bd:()=>p,RY:()=>h,hw:()=>f,Wg:()=>a,Pt:()=>u,s3:()=>c})},78286:(e,t,r)=>{r.d(t,{RH:()=>o,hS:()=>s,RB:()=>i});var n=r(22974);function o(e,t,r=!1){return c(e,t,r)}function s(e,t){if(null!=t)return t[e]||a(e.split("."),!1,t)}function i(e,t,r){const n=e.split("."),o=n.pop(),s=a(n,!0,r);s&&o&&(s[o]=t)}function a(e,t,r){let n=r;for(const r of e){if(null==n)return;if(!(r in n)){if(!t)return;n[r]={}}n=n[r]}return n}function c(e,t,r){return t?Object.keys(t).reduce((function(e,o){let s=e[o],i=t[o];return s===i?e:void 0===s?(e[o]=(0,n.d9)(i),e):(Array.isArray(i)||Array.isArray(e)?(s=s?Array.isArray(s)?e[o]=s.concat():e[o]=[s]:e[o]=[],i&&(Array.isArray(i)||(i=[i]),r?i.forEach((e=>{-1===s.indexOf(e)&&s.push(e)})):e[o]=i.concat())):i&&"object"==typeof i?e[o]=c(s,i,r):e.hasOwnProperty(o)&&!t.hasOwnProperty(o)||(e[o]=i),e)}),e||{}):e}},95330:(e,t,r)=>{r.d(t,{e4:()=>P,$6:()=>c,Ue:()=>u,yi:()=>d,zE:()=>l,dD:()=>x,hh:()=>$,vr:()=>U,Ds:()=>_,as:()=>k,WW:()=>C,R8:()=>O,D_:()=>v,Hc:()=>p,tI:()=>Z,y8:()=>q,fu:()=>y,$F:()=>w,d1:()=>S,DB:()=>T,r9:()=>m,k_:()=>f,H9:()=>g,gx:()=>E,Hl:()=>b});var n,o=(n=r(16358).Z,{setTimeout:(e,t)=>{const r=n.setTimeout(e,t);return{remove:()=>n.clearTimeout(r)}}}),s=r(20102),i=r(91460),a=(r(92604),r(70586));function c(e){return Promise.all(e)}function u(e){return new Promise(((t,r)=>{try{e(t,r)}catch(e){Promise.resolve().then((()=>r(e)))}}))}function l(e="Aborted"){return new s.Z("AbortError",e)}function d(){return new AbortController}function f(e,t="Aborted"){if(p(e))throw l(t)}function h(e){return(0,a.pC)(e)?"aborted"in e?e:e.signal:e}function p(e){const t=h(e);return(0,a.pC)(t)&&t.aborted}function m(e){if(v(e))throw e}function g(e){if(!v(e))throw e}function y(e,t){const r=h(e);if(!(0,a.Wi)(r)){if(!r.aborted)return(0,i.IH)(r,"abort",(()=>t()));t()}}function w(e,t){const r=h(e);if(!(0,a.Wi)(r))return f(r),(0,i.IH)(r,"abort",(()=>t(l())))}function b(e,t){const r=h(t);return(0,a.Wi)(r)?e:new Promise(((r,n)=>{let o=y(t,(()=>n(l())));const s=()=>o=(0,a.hw)(o);e.then(s,s),e.then(r,n)}))}function v(e){return e&&"AbortError"===e.name}function O(e){return e.catch((e=>{if(!v(e))throw e}))}function x(){let e=null;const t=new Promise(((t,r)=>{e={promise:void 0,resolve:t,reject:r}}));return e.promise=t,e}function k(e){if(!e)return;if("function"!=typeof e.forEach){const t=Object.keys(e);return k(t.map((t=>e[t]))).then((e=>{const r={};return t.forEach(((t,n)=>r[t]=e[n])),r}))}const t=e;return u((e=>{const r=[];let n=t.length;0===n&&e(r),t.forEach((t=>{const o={promise:t||Promise.resolve(t)};r.push(o),o.promise.then((e=>{o.value=e})).catch((e=>{o.error=e})).then((()=>{--n,0===n&&e(r)}))}))}))}function C(e){return k(e).then((e=>e.filter((e=>!!e.value)).map((e=>e.value))))}function S(e){return Promise.reject(e)}function T(e){return Promise.resolve(e)}function P(e,t,r){const n=d();return y(r,(()=>n.abort())),new Promise(((r,o)=>{let s=setTimeout((()=>{s=0,r(t)}),e);y(n,(()=>{s&&(clearTimeout(s),o(l()))}))}))}function q(e){return e&&"function"==typeof e.then}function E(e){return Z(e)?e:Promise.resolve(e)}function Z(e){return e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function _(e,t=-1){let r,n,o,s,i=null;const c=(...u)=>{if(r){n=u,s&&s.reject(l()),s=x();const e=(0,a.j0)(s.promise);if(i){const e=i;i=null,e.abort()}return e}if(o=s||x(),s=null,t>0){const n=d();r=E(e(...u,n.signal));const o=r;P(t).then((()=>{r===o&&(s?n.abort():i=n)}))}else r=1,r=E(e(...u));const f=()=>{const e=n;n=o=r=i=null,null!=e&&c(...e)},h=r,p=o;return h.then(f,f),h.then(p.resolve,p.reject),(0,a.j0)(p.promise)};return c}function $(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n})),n=t=>{e(t)};return n.resolve=t=>e(t),n.reject=e=>t(e),n.timeout=(e,t)=>o.setTimeout((()=>n.reject(t)),e),n.promise=r,n}function U(e){let t=d();const r=e(t.signal);let n={promise:r,finished:!1,abort:()=>{t&&(t.abort(),t=null)}};const o=()=>{n&&(n.finished=!0,n=null),t=null};return r.then(o,o),n}},19153:(e,t,r)=>{r.d(t,{Qs:()=>a,hP:()=>c,gx:()=>i,Cb:()=>u});var n=r(78286);const o=/\{([^\}]+)\}/g;function s(e){return null==e?"":e}function i(e,t){return e.replace(o,"object"==typeof t?(e,r)=>s((0,n.hS)(r,t)):(e,r)=>s(t(r)))}function a(e,t){return e.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(e=>t&&-1!==t.indexOf(e)?e:`\\${e}`))}function c(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}function u(e){return(new DOMParser).parseFromString(e||"","text/html").body.innerText||""}},1533:(e,t,r)=>{function n(e,t){if(e.forEach)e.forEach(t);else for(let r=0;r<e.length;r++)t(e[r],r,e)}function o(e,t,r){if(e.slice)return e.slice(t,r);void 0===t?t=0:(t<0&&(t+=e.length),t=Math.min(e.length,Math.max(0,t))),void 0===r?r=e.length:(r<0&&(r+=e.length),r=Math.min(e.length,Math.max(0,r)));const n=Math.max(0,r-t),o=new(0,e.constructor)(n);for(let r=0;r<n;r++)o[r]=e[t+r];return o}function s(e){return e instanceof ArrayBuffer||e&&e.constructor&&"ArrayBuffer"===e.constructor.name}function i(e){return e instanceof Int8Array||e&&e.constructor&&"Int8Array"===e.constructor.name}function a(e){return e instanceof Uint8Array||e&&e.constructor&&"Uint8Array"===e.constructor.name}function c(e){return e instanceof Uint8ClampedArray||e&&e.constructor&&"Uint8ClampedArray"===e.constructor.name}function u(e){return e instanceof Int16Array||e&&e.constructor&&"Int16Array"===e.constructor.name}function l(e){return e instanceof Uint16Array||e&&e.constructor&&"Uint16Array"===e.constructor.name}function d(e){return e instanceof Int32Array||e&&e.constructor&&"Int32Array"===e.constructor.name}function f(e){return e instanceof Uint32Array||e&&e.constructor&&"Uint32Array"===e.constructor.name}function h(e){return e instanceof Float32Array||e&&e.constructor&&"Float32Array"===e.constructor.name}function p(e){return e instanceof Float64Array||e&&e.constructor&&"Float64Array"===e.constructor.name}r.d(t,{Ed:()=>n,eP:()=>s,xZ:()=>h,fS:()=>p,z3:()=>u,Hx:()=>d,W0:()=>i,Uc:()=>l,ZY:()=>f,lq:()=>a,KZ:()=>c,tP:()=>o})},17452:(e,t,r)=>{r.d(t,{R9:()=>w,qg:()=>P,tD:()=>_,ZN:()=>ue,fl:()=>le,AX:()=>O,Gd:()=>b,Ie:()=>ie,sJ:()=>G,AH:()=>J,vt:()=>oe,oh:()=>j,P$:()=>N,Ml:()=>de,ed:()=>$,b7:()=>T,D6:()=>L,tm:()=>U,YP:()=>B,jc:()=>H,HK:()=>z,$U:()=>X,oC:()=>V,kl:()=>I,v_:()=>W,hF:()=>F,_l:()=>Y,PF:()=>M,Fv:()=>D,B7:()=>S,u0:()=>k,Yd:()=>ne,Hu:()=>ce,Qj:()=>se,hO:()=>ee,mN:()=>x});var n=r(68773),o=r(20102),s=(r(16358),r(92604)),i=r(70586);const a=s.Z.getLogger("esri.core.urlUtils"),c=n.Z.request,u="esri/config: esriConfig.request.proxyUrl is not set.",l=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,d=/^\s*http:/i,f=/^\s*https:/i,h=/^\s*file:/i,p=/:\d+$/,m=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,g=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),y=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class w{constructor(e=""){this.uri=e,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let t=(0,i.j0)(this.uri.match(g));this.scheme=t[2]||(t[1]?"":null),this.authority=t[4]||(t[3]?"":null),this.path=t[5],this.query=t[7]||(t[6]?"":null),this.fragment=t[9]||(t[8]?"":null),null!=this.authority&&(t=(0,i.j0)(this.authority.match(y)),this.user=t[3]||null,this.password=t[4]||null,this.host=t[6]||t[7],this.port=t[9]||null)}toString(){return this.uri}}const b=new w(n.Z.applicationUrl),v={},O=(()=>{const e=(0,i.j0)(b.path),t=e.substring(0,e.lastIndexOf(e.split("/")[e.split("/").length-1]));return`${b.scheme}://${b.host}${null!=b.port?`:${b.port}`:""}${t}`})();function x(e){const t={path:null,query:null},r=new w(e),n=e.indexOf("?");return null===r.query?t.path=e:(t.path=e.substring(0,n),t.query=k(r.query)),r.fragment&&(t.hash=r.fragment,null===r.query&&(t.path=t.path.substring(0,t.path.length-(r.fragment.length+1)))),t}function k(e){const t=e.split("&"),r={};for(const e of t){if(!e)continue;const t=e.indexOf("=");let n,o;t<0?(n=decodeURIComponent(e),o=""):(n=decodeURIComponent(e.slice(0,t)),o=decodeURIComponent(e.slice(t+1)));let s=r[n];"string"==typeof s&&(s=r[n]=[s]),Array.isArray(s)?s.push(o):r[n]=o}return r}function C(e){return e&&"object"==typeof e&&"toJSON"in e&&"function"==typeof e.toJSON}function S(e,t){return e?t&&"function"==typeof t?Object.keys(e).map((r=>encodeURIComponent(r)+"="+encodeURIComponent(t(r,e[r])))).join("&"):Object.keys(e).map((r=>{const n=e[r];if(null==n)return"";const o=encodeURIComponent(r)+"=",s=t&&t[r];return s?o+encodeURIComponent(s(n)):Array.isArray(n)?n.map((e=>C(e)?o+encodeURIComponent(JSON.stringify(e)):o+encodeURIComponent(e))).join("&"):C(n)?o+encodeURIComponent(JSON.stringify(n)):o+encodeURIComponent(n)})).filter((e=>e)).join("&"):""}function T(e=!1){let t,r=c.proxyUrl;if("string"==typeof e){t=X(e);const n=$(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw a.warn(u),new o.Z("urlutils:proxy-not-set",u);return t&&te()&&(r=ee(r)),x(r)}function P(e){const t=$(e);let r,n;if(t){const e=E(t.proxyUrl);r=e.path,n=e.query?k(e.query):null}if(r){const t=x(e);e=r+"?"+t.path;const o=S({...n,...t.query});o&&(e=`${e}?${o}`)}return e}const q={path:"",query:""};function E(e){const t=e.indexOf("?");return-1!==t?(q.path=e.slice(0,t),q.query=e.slice(t+1)):(q.path=e,q.query=null),q}function Z(e){return(e=re(e=function(e){return e&&"/"===e[e.length-1]?e:`${e}/`}(e=E(e).path),!0)).toLowerCase()}function _(e){const t={proxyUrl:e.proxyUrl,urlPrefix:Z(e.urlPrefix)},r=c.proxyRules,n=t.urlPrefix;let o=r.length;for(let e=0;e<r.length;e++){const t=r[e].urlPrefix;if(0===n.indexOf(t)){if(n.length===t.length)return-1;o=e;break}0===t.indexOf(n)&&(o=e+1)}return r.splice(o,0,t),o}function $(e){const t=c.proxyRules,r=Z(e);for(let e=0;e<t.length;e++)if(0===r.indexOf(t[e].urlPrefix))return t[e]}function U(e,t){return e=A(e),t=A(t),re(e)===re(t)}function A(e){const t=(e=D(e)).indexOf("/sharing");return t>0?e.substring(0,t):e.replace(/\/+$/,"")}function j(e){const t=t=>null==t||t instanceof RegExp&&t.test(e)||"string"==typeof t&&e.startsWith(t),r=c.interceptors;if(r)for(const e of r)if(Array.isArray(e.urls)){if(e.urls.some(t))return e}else if(t(e.urls))return e;return null}function L(e,t,r=!1){const n=ae(e),o=ae(t);return!(!r&&n.scheme!==o.scheme)&&null!=n.host&&null!=o.host&&n.host.toLowerCase()===o.host.toLowerCase()&&n.port===o.port}function I(e){if("string"==typeof e){if(!B(e))return!0;e=ae(e)}if(L(e,b))return!0;const t=c.trustedServers||[];for(let r=0;r<t.length;r++){const n=R(t[r]);for(let t=0;t<n.length;t++)if(L(e,n[t]))return!0}return!1}function R(e){return v[e]||(Q(e)||V(e)?v[e]=[new w(F(e))]:v[e]=[new w(`http://${e}`),new w(`https://${e}`)]),v[e]}function F(e,t=O,r){return V(e)?r&&r.preserveProtocolRelative?e:"http"===b.scheme&&b.authority===N(e).slice(2)?`http:${e}`:`https:${e}`:Q(e)?e:(0,i.j0)(W("/"===e[0]?function(e){const t=e.indexOf("//"),r=e.indexOf("/",t+2);return-1===r?e:e.slice(0,r)}(t):t,e))}function M(e,t=O,r){if(!B(e))return e;const n=D(e),o=n.toLowerCase(),s=D(t).toLowerCase().replace(/\/+$/,""),i=r?D(r).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return e;const a=(e,t,r)=>-1===(r=e.indexOf(t,r))?e.length:r;let c=a(o,"/",o.indexOf("//")+2),u=-1;for(;o.slice(0,c+1)===s.slice(0,c)+"/"&&(u=c+1,c!==o.length);)c=a(o,"/",c+1);if(-1===u)return e;if(i&&u<i.length)return e;e=n.slice(u);const l=s.slice(u-1).replace(/[^/]+/g,"").length;if(l>0)for(let t=0;t<l;t++)e=`../${e}`;else e=`./${e}`;return e}function D(e){return function(e){const t=c.httpsDomains;if(!function(e){return d.test(e)||"http"===b.scheme&&V(e)}(e))return e;const r=e.indexOf("/",7);let n;if(n=-1===r?e:e.slice(0,r),n=n.toLowerCase().slice(7),p.test(n)){if(!n.endsWith(":80"))return e;n=n.slice(0,-3),e=e.replace(":80","")}return"http"===b.scheme&&n===b.authority&&!m.test(e)||(te()&&n===b.authority||t&&t.some((e=>n===e||n.endsWith(`.${e}`)))||te()&&!$(e))&&(e=ee(e)),e}(e=function(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}(e=function(e){if(/^https?:\/\//i.test(e)){const t=E(e);e=(e=t.path.replace(/\/{2,}/g,"/")).replace("/","//"),t.query&&(e+=`?${t.query}`)}return e}(e=F(e=e.trim()))))}function W(...e){const t=e.filter(i.pC);if(!t||!t.length)return;const r=[];if(B(t[0])){const e=t[0],n=e.indexOf("//");-1!==n&&(r.push(e.slice(0,n+1)),function(e){return h.test(e)}(t[0])&&(r[0]+="/"),t[0]=e.slice(n+2))}else"/"===t[0][0]&&r.push("");const n=t.reduce(((e,t)=>t?e.concat(t.split("/")):e),[]);for(let e=0;e<n.length;e++){const t=n[e];".."===t&&r.length>0&&".."!==r[r.length-1]?r.pop():(!t&&e===n.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function N(e,t=!1){if(H(e)||z(e))return null;let r=e.indexOf("://");if(-1===r&&V(e))r=2;else{if(-1===r)return null;r+=3}const n=e.indexOf("/",r);return-1!==n&&(e=e.slice(0,n)),t&&(e=re(e,!0)),e}function B(e){return V(e)||Q(e)}function H(e){return null!=e&&"blob:"===e.slice(0,5)}function z(e){return"data:"===e.slice(0,5)}function J(e){const t=G(e);if(!t||!t.isBase64)return null;const r=atob(t.data),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n.buffer}const K=/^data:(.*?)(;base64)?,(.*)$/;function G(e){const t=e.match(K);if(!t)return null;const[,r,n,o]=t;return{mediaType:r,isBase64:!!n,data:o}}function Y(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}function V(e){return null!=e&&void 0!==e&&"/"===e[0]&&"/"===e[1]}function Q(e){return l.test(e)}function X(e){return f.test(e)||"https"===b.scheme&&V(e)}function ee(e){return V(e)?`https:${e}`:e.replace(d,"https:")}function te(){return"https"===b.scheme}function re(e,t=!1){return V(e)?e.slice(2):(e=e.replace(l,""),t&&e.length>1&&"/"===e[0]&&"/"===e[1]&&(e=e.slice(2)),e)}function ne(e){let t=0;if(B(e)){const r=e.indexOf("//");-1!==r&&(t=r+2)}const r=e.lastIndexOf("/");return r<t?e:e.slice(0,r+1)}function oe(e,t){if(!e)return"";const r=x(e).path.replace(/\/+$/,""),n=r.substring(r.lastIndexOf("/")+1);if(null==t||!t.length)return n;const o=new RegExp(`.(${t.join("|")})$`,"ig");return n.replace(o,"")}function se(e){return e.replace(/\/+$/,"")}function ie(e,t,r){if(!(t&&r&&e&&B(e)))return e;const n=e.indexOf("//"),o=e.indexOf("/",n+2),s=e.indexOf(":",n+2),i=Math.min(o<0?e.length:o,s<0?e.length:s);return e.slice(n+2,i).toLowerCase()!==t.toLowerCase()?e:`${e.slice(0,n+2)}${r}${e.slice(i)}`}function ae(e){return"string"==typeof e?new w(F(e)):(e.scheme||(e.scheme=b.scheme),e)}function ce(e,t){const r=x(e),n=Object.keys(r.query||{});return n.length>0&&t&&t.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${n.join(", ")}.`),r.path}function ue(e,t,r){const n=x(e),o=n.query||{};return o[t]=String(r),`${n.path}?${S(o)}`}function le(e,t){const r=x(e),n=r.query||{};for(const e in t)n[e]=t[e];const o=S(n);return o?`${r.path}?${o}`:r.path}function de(e){if((0,i.Wi)(e))return null;const t=e.match(fe);return t?t[1]:null}const fe=/.*?\.([^\/]*)$/},40330:(e,t,r)=>{r.d(t,{Dp:()=>u,id:()=>a,qh:()=>c,i8:()=>s,Nv:()=>i});var n=r(80442),o=r(17452);const s="4.21",i={request(e,t){var n;const o=null==(n=e.options)?void 0:n.responseType;return r.e(3172).then(r.bind(r,3172)).then((({default:r})=>{const n=e.options||{};return n.responseType="native"===o||"native-request-init"===o?"native-request-init":"array-buffer",n.signal=null==t?void 0:t.signal,r(e.url,n)})).then((e=>{const t={data:e.data,ssl:e.ssl};return"native-request-init"===e.requestOptions.responseType?(delete t.data.signal,t):{result:t,transferList:[t.data]}}))}};let a;function c(e){a=e}function u(e){const t=a&&a.findCredential(e);return t&&t.token?(0,o.ZN)(e,"token",t.token):e}(0,n.Z)("host-webworker")||((0,n.Z)("edge")||(0,n.Z)("trident"))&&console.warn("Deprecated browser - see http://esriurl.com/oldbrowser")},3172:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(68773),o=r(40330),s=r(20102),i=r(16358),a=r(80442),c=r(22974),u=r(70586),l=r(95330),d=r(17452),f=r(71058),h=r(85958);async function p(e,t){const c=(0,d.HK)(e),h=(0,d.jc)(e);h||c||(e=(0,d.Fv)(e));const w={url:e,requestOptions:{...(0,u.Wg)(t)}};let b=(0,d.oh)(e);if(b){const e=await async function(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let r,n;try{n=await e.before(t)}catch(e){r=C("request:interceptor",e,t)}if((n instanceof Error||n instanceof s.Z)&&(r=C("request:interceptor",n,t)),r)throw e.error&&e.error(r),r;return n}}(b,w);if(null!=e)return{data:e,getHeader:O,requestOptions:w.requestOptions,url:w.url};b.after||b.error||(b=null)}if(e=w.url,"image"===(t=w.requestOptions).responseType){if((0,a.Z)("host-webworker")||(0,a.Z)("host-node"))throw C("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),w)}else if(c)throw C("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),w);if("head"===t.method){if(t.body)throw C("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),w);if(c||h)throw C("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),w)}if(await async function(){(0,a.Z)("host-webworker")?m||(m=await r.e(9884).then(r.bind(r,29884))):p._abortableFetch||(p._abortableFetch=i.Z.fetch.bind(i.Z))}(),m)return m.execute(e,t);const v=(0,l.yi)();(0,l.fu)(t,(()=>v.abort()));const x={controller:v,credential:null,credentialToken:null,fetchOptions:null,hasToken:!1,interceptor:b,params:w,redoRequest:!1,useIdentity:g.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},k=await async function(e){var t,r;let s,a;await async function(e){const t=e.params.url,r=e.params.requestOptions,s=e.controller.signal,a=r.body;let c=null,u=null,d=null;if(y&&"HTMLFormElement"in i.Z&&(a instanceof FormData?c=a:a instanceof HTMLFormElement&&(u=a,c=new FormData(u))),"string"==typeof a&&(d=a),e.fetchOptions={cache:r.cacheBust&&!p._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:r.headers||{},method:"head"===r.method?"HEAD":"GET",mode:"cors",redirect:"follow",signal:s},(c||d)&&(e.fetchOptions.body=c||d),"anonymous"===r.authMode&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||r.query&&r.query.token||c&&c.get&&c.get("token")||u&&u.elements.token),!e.hasToken&&n.Z.apiKey&&(0,f.r)(t)&&(r.query||(r.query={}),r.query.token=n.Z.apiKey,e.hasToken=!0),e.useIdentity&&!e.hasToken&&!e.credentialToken&&!T(t)&&!(0,l.Hc)(s)){let n;"immediate"===r.authMode?(await S(),n=await o.id.getCredential(t,{signal:s}),e.credential=n):"no-prompt"===r.authMode?(await S(),n=await o.id.getCredential(t,{prompt:!1,signal:s}).catch((()=>{})),e.credential=n):o.id&&(n=o.id.findCredential(t)),n&&(e.credentialToken=n.token,e.useSSL=!!n.ssl)}}(e);try{do{[s,a]=await P(e)}while(!await E(e,s,a))}catch(t){const r=C("request:server",t,e.params,s);throw r.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(r),r}const c=e.params.url;if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(c)&&!e.hasToken&&!e.credentialToken&&null!=(t=a)&&null!=(r=t.user)&&r.username&&!(0,d.kl)(c)){const e=(0,d.P$)(c,!0);e&&g.trustedServers.push(e)}const u=e.credential;if(u&&o.id){const e=o.id.findServerInfo(u.server);let t=e&&e.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=o.id.findCredential(t,u.userId);e&&-1===o.id._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:a,getHeader:s?e=>s.headers.get(e):O,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}(x);return b&&b.after&&b.after(k),k}let m;const g=n.Z.request,y="FormData"in i.Z,w=[499,498,403,401],b=["COM_0056","COM_0057","SB_0008"],v=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],O=()=>null,x=Symbol();function k(e){const t=(0,d.P$)(e);return!t||t.endsWith(".arcgis.com")||p._corsServers.includes(t)||(0,d.kl)(t)}function C(e,t,r,n){let o="Error";const i={url:r.url,requestOptions:r.requestOptions,getHeader:O,ssl:!1};if(t instanceof s.Z)return t.details?(t.details=(0,c.d9)(t.details),t.details.url=r.url,t.details.requestOptions=r.requestOptions):t.details=i,t;if(t){const e=n&&(e=>n.headers.get(e)),r=n&&n.status,s=t.message;s&&(o=s),e&&(i.getHeader=e),i.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,i.subCode=t.subcode,i.messageCode=t.messageCode,"string"==typeof t.details?i.messages=[t.details]:i.messages=t.details,i.raw=x in t?t[x]:t}return(0,l.D_)(t)?(0,l.zE)():new s.Z(e,o,i)}async function S(){o.id||await Promise.all([r.e(7824),r.e(7304),r.e(5472),r.e(9625)]).then(r.bind(r,79339))}function T(e){return v.some((t=>t.test(e)))}async function P(e){let t=e.params.url;const r=e.params.requestOptions,n=e.fetchOptions,s=(0,d.jc)(t)||(0,d.HK)(t),i=r.responseType||"json",c=s?0:null!=r.timeout?r.timeout:g.timeout;let u=!1;if(!s){e.useSSL&&(t=(0,d.hO)(t)),r.cacheBust&&"default"===n.cache&&(t=(0,d.ZN)(t,"request.preventCache",Date.now()));let s={...r.query};e.credentialToken&&(s.token=e.credentialToken);let i=(0,d.B7)(s);(0,a.Z)("esri-url-encodes-apostrophe")&&(i=i.replace(/'/g,"%27"));const c=t.length+1+i.length;let l;u="delete"===r.method||"post"===r.method||"put"===r.method||!!r.body||c>g.maxUrlLength;const f=r.useProxy||!!(0,d.ed)(t);if(f){const e=(0,d.b7)(t);l=e.path,!u&&l.length+1+c>g.maxUrlLength&&(u=!0),e.query&&(s={...e.query,...s})}if("HEAD"===n.method&&(u||f)){if(u){if(c>g.maxUrlLength)throw C("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw C("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(f)throw C("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(u?(n.method="delete"===r.method?"DELETE":"put"===r.method?"PUT":"POST",r.body?t=(0,d.fl)(t,s):(n.body=(0,d.B7)(s),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=(0,d.fl)(t,s),f&&(e.useProxy=!0,t=`${l}?${t}`),s.token&&y&&n.body instanceof FormData){const e=n.body;e.set?e.set("token",s.token):e.append("token",s.token)}if(r.hasOwnProperty("withCredentials"))e.withCredentials=r.withCredentials;else if(!(0,d.D6)(t,d.Gd))if((0,d.kl)(t))e.withCredentials=!0;else if(o.id){const r=o.id.findServerInfo(t);r&&r.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include")}let f,h,m=0,w=!1;c>0&&(m=setTimeout((()=>{w=!0,e.controller.abort()}),c));try{if("native-request-init"===r.responseType)h=n,h.url=t;else if("image"!==r.responseType||"default"!==n.cache||"GET"!==n.method||u||function(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}(r.headers)||!s&&!e.useProxy&&g.proxyUrl&&!k(t)){if(f=await p._abortableFetch(t,n),e.useProxy||function(e){const t=(0,d.P$)(e);t&&!p._corsServers.includes(t)&&p._corsServers.push(t)}(t),"native"===r.responseType)h=f;else if("HEAD"!==n.method)if(f.ok){switch(i){case"array-buffer":h=await f.arrayBuffer();break;case"blob":case"image":h=await f.blob();break;default:h=await f.text()}if(m&&(clearTimeout(m),m=0),"json"===i||"xml"===i||"document"===i)if(h)switch(i){case"json":h=JSON.parse(h);break;case"xml":h=q(h,"application/xml");break;case"document":h=q(h,"text/html")}else h=null;if(h){if("array-buffer"===i||"blob"===i){const e=f.headers.get("Content-Type");if(/application\/json|text\/plain/i.test(e)&&h["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(h).json();e.error&&(h=e)}catch{}}"image"===i&&h instanceof Blob&&(h=await Z(URL.createObjectURL(h),e,!0))}}else h=await f.text()}else h=await Z(t,e)}catch(n){if("AbortError"===n.name){if(w)throw new Error("Timeout exceeded");throw(0,l.zE)("Request canceled")}if(!(!f&&n instanceof TypeError&&g.proxyUrl)||r.body||"delete"===r.method||"head"===r.method||"post"===r.method||"put"===r.method||e.useProxy||k(t))throw n;e.redoRequest=!0,(0,d.tD)({proxyUrl:g.proxyUrl,urlPrefix:(0,d.P$)(t)})}finally{m&&clearTimeout(m)}return[f,h]}function q(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function E(e,t,r){if(e.redoRequest)return e.redoRequest=!1,!1;const n=e.params.requestOptions;if(!t||"native"===n.responseType||"native-request-init"===n.responseType)return!0;let s,i,a,c;if(!t.ok)throw s=new Error(`Unable to load ${t.url} status: ${t.status}`),s[x]=r,s;null!=r&&r.error&&(s=r.error),s&&(i=Number(s.code),a=s.hasOwnProperty("subcode")?Number(s.subcode):null,c=s.messageCode,c=c&&c.toUpperCase());const u=n.authMode;if(403===i&&(4===a||s.message&&s.message.toLowerCase().indexOf("ssl")>-1&&-1===s.message.toLowerCase().indexOf("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===i)&&-1!==w.indexOf(i)&&!T(e.params.url)&&(403!==i||-1===b.indexOf(c)&&(null==a||2===a&&e.credentialToken))){await S();try{const t=await o.id.getCredential(e.params.url,{error:C("request:server",s,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(t){if("no-prompt"===u)return e.credential=null,e.credentialToken=null,!1;s=t}}if(s)throw s;return!0}function Z(e,t,r=!1){const n=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.src=e,(0,h.f)(o,e,r,n)}p._abortableFetch=null,p._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"]},71058:(e,t,r)=>{r.d(t,{r:()=>s});var n=r(17452);const o=["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"];function s(e){const t=(0,n.P$)(e,!0);return t&&t.endsWith(".arcgis.com")&&!o.includes(t)&&!e.endsWith("/sharing/rest/generateToken")}},85958:(e,t,r)=>{r.d(t,{f:()=>i});var n=r(80442),o=r(70586),s=r(95330);function i(e,t,r=!1,i){return new Promise(((c,u)=>{if((0,s.Hc)(i))return void u(a());let l=()=>{h(),u(new Error(`Unable to load ${t}`))},d=()=>{const t=e;h(),c(t)},f=()=>{if(!e)return;const t=e;h(),t.src="",u(a())};const h=()=>{(0,n.Z)("esri-image-decode")||(e.removeEventListener("error",l),e.removeEventListener("load",d)),l=null,d=null,e=null,(0,o.pC)(i)&&i.removeEventListener("abort",f),f=null,r&&URL.revokeObjectURL(t)};(0,o.pC)(i)&&i.addEventListener("abort",f),(0,n.Z)("esri-image-decode")?e.decode().then(d,l):(e.addEventListener("error",l),e.addEventListener("load",d))}))}function a(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}},42134:(e,t,r)=>{r.r(t),r.d(t,{clearBoundingBoxCache:()=>d,computeIconLayerResourceSize:()=>p,computeLayerResourceSize:()=>f,computeLayerSize:()=>h,computeObjectLayerResourceSize:()=>m});var n=r(3172),o=r(20102),s=r(74669),i=r(70586),a=r(60437),c=r(45119);let u=l();function l(){return new s.Z(50)}function d(){u=l()}function f(e,t){if("icon"===e.type)return p(e,t);if("object"===e.type)return m(e,t);throw new o.Z("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function h(e,t){if("icon"===e.type)return function(e,t){return p(e,t).then((t=>{if(null==e.size)return t;const r=t[0]/t[1];return r>1?[e.size,e.size/r]:[e.size*r,e.size]}))}(e,t);if("object"===e.type)return async function(e,t){const r=await m(e,t);return(0,c.$K)(r,e)}(e,t);throw new o.Z("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function p(e,t){if(e.resource.href)return(r=e.resource.href,(0,n.default)(r,{responseType:"image"}).then((e=>e.data))).then((e=>[e.width,e.height]));var r;if(e.resource.primitive)return(0,i.pC)(t)?[t,t]:[256,256];throw new o.Z("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function m(e,t){return async function(e,t){if(!e.isPrimitive){const t=e.resource.href,n=u.get(t);if(void 0!==n)return Promise.resolve(n);const o=await Promise.all([r.e(6481),r.e(1762),r.e(9044),r.e(1313)]).then(r.bind(r,21313)),s=await o.fetch(t,{disableTextures:!0});return u.put(t,s.referenceBoundingBox),s.referenceBoundingBox}let n=null;if(e.resource&&e.resource.primitive&&(n=(0,a.Ue)((0,c.Uz)(e.resource.primitive)),(0,i.pC)(t)))for(let e=0;e<n.length;e++)n[e]*=t;return n?Promise.resolve(n):Promise.reject(new o.Z("symbol:invalid-resource","The symbol does not have a valid resource"))}(e,t).then((e=>(0,a.dp)(e)))}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7995],{84552:(e,t,r)=>{r.d(t,{Z:()=>c});var i,s=r(43697),n=r(10736),o=r(35463),a=r(5600),l=(r(80442),r(75215),r(92604),r(52525)),u=r(78981);let p=i=class extends n.wq{constructor(e){super(e),this.value=0,this.unit="milliseconds"}toMilliseconds(){return(0,o.rJ)(this.value,this.unit,"milliseconds")}clone(){return new i({value:this.value,unit:this.unit})}};(0,s._)([(0,a.Cb)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),(0,s._)([(0,a.Cb)({type:u.v.apiValues,json:{type:u.v.jsonValues,read:u.v.read,write:u.v.write},nonNullable:!0})],p.prototype,"unit",void 0),p=i=(0,s._)([(0,l.j)("esri.TimeInterval")],p);var c=p},23232:(e,t,r)=>{r.r(t),r.d(t,{default:()=>at});var i,s=r(43697),n=r(51773),o=r(70586),a=r(16453),l=r(95330),u=r(5600),p=(r(80442),r(75215)),c=r(92604),d=r(52525),m=r(30556),h=r(29600),y=r(66577),f=r(38171),g=r(30030),v=r(3172),b=r(20102),w=r(35454),_=r(22974),R=r(17452),C=r(44422),x=r(71715),S=r(21506),I=r(35956),j=r(10736),T=r(36030);const N=new Set(["raster","raster2","dem","fillraster"]),O=new Set(["rasters"]),F=e=>e&&e.rasterFunction?V.fromJSON(e):e,P=e=>e&&e instanceof V?e.toJSON():e,D=e=>(null==e?void 0:e.functionName)&&!e.declaredClass,M=e=>D(e)?new V(e):e;var A;!function(e){e[e.MOSAIC=0]="MOSAIC",e[e.GROUP=1]="GROUP",e[e.ITEM=2]="ITEM"}(A||(A={}));let V=i=class extends j.wq{constructor(e){super(e),this.functionName=null,this.outputPixelType="unknown",this.variableName=null,this.description=null,this.functionDefinition=null,this.thumbnail=null}set functionArguments(e){if(e){const t=Object.keys(e);if(t.some((t=>N.has(t.toLowerCase())&&D(e[t])))||t.some((t=>O.has(t.toLowerCase())&&Array.isArray(e[t])&&e[t].some((e=>D(e)))))){e=(0,_.d9)(e);for(const r of t)N.has(r.toLowerCase())?e[r]=M(e[r]):O.has(r.toLowerCase())&&Array.isArray(e[r])&&(e[r]=e[r].map((e=>M(e))))}}this._set("functionArguments",e)}readFunctionArguments(e,t){return(e=>{if(null==e)return null;e=(0,_.d9)(e);const t={};for(const r of Object.keys(e))N.has(r.toLowerCase())?t[r]=F(e[r]):O.has(r.toLowerCase())&&Array.isArray(e[r])?t[r]=e[r].map(F):t[r]=e[r];return t})(t.arguments||t.rasterFunctionArguments)}writeFunctionArguments(e,t,r){const i={};for(const t of Object.keys(e))N.has(t.toLowerCase())?i[t]=P(e[t]):O.has(t.toLowerCase())&&Array.isArray(e[t])?i[t]=e[t].map(P):i[t]=P(e[t]);this.functionDefinition?t.arguments=i:t[r]=i}readFunctionName(e,t){const r=t.rasterFunctionInfos;return t.name||(r&&r.length&&"None"!==r[0].name?r[0].name:t.rasterFunction)}writeFunctionName(e,t,r){this.functionDefinition?t.name=e:t[r]=e}readFunctionType(e){return A[e]}writeFunctionType(e,t,r){t[r]=A[e]}clone(){return new i({functionName:this.functionName,functionArguments:(0,_.d9)(this.functionArguments),outputPixelType:this.outputPixelType,variableName:this.variableName,description:this.description,functionType:this.functionType,functionDefinition:this.functionDefinition,thumbnail:this.thumbnail})}};(0,s._)([(0,u.Cb)({json:{type:Object,write:{target:"rasterFunctionArguments"}}})],V.prototype,"functionArguments",null),(0,s._)([(0,x.r)("functionArguments",["rasterFunctionArguments","arguments"])],V.prototype,"readFunctionArguments",null),(0,s._)([(0,m.c)("functionArguments")],V.prototype,"writeFunctionArguments",null),(0,s._)([(0,u.Cb)({json:{type:String,write:{target:"rasterFunction"}}})],V.prototype,"functionName",void 0),(0,s._)([(0,x.r)("functionName",["rasterFunction","rasterFunctionInfos","name"])],V.prototype,"readFunctionName",null),(0,s._)([(0,m.c)("functionName")],V.prototype,"writeFunctionName",null),(0,s._)([(0,T.J)({C128:"c128",C64:"c64",F32:"f32",F64:"f64",S16:"s16",S32:"s32",S8:"s8",U1:"u1",U16:"u16",U2:"u2",U32:"u32",U4:"u4",U8:"u8",UNKNOWN:"unknown"},{ignoreUnknown:!1}),(0,u.Cb)({json:{default:"unknown"}})],V.prototype,"outputPixelType",void 0),(0,s._)([(0,u.Cb)({type:String,json:{read:!0,write:!0}})],V.prototype,"variableName",void 0),(0,s._)([(0,u.Cb)({type:String,json:{read:!0,write:!0,origins:{"web-document":{read:!1,write:!1}}}})],V.prototype,"description",void 0),(0,s._)([(0,u.Cb)({json:{origins:{"web-document":{read:!1,write:!1}}}})],V.prototype,"functionType",void 0),(0,s._)([(0,x.r)("functionType")],V.prototype,"readFunctionType",null),(0,s._)([(0,m.c)("functionType")],V.prototype,"writeFunctionType",null),(0,s._)([(0,u.Cb)({type:Object,json:{read:{source:"function"},write:{target:"function"},origins:{"web-document":{read:!1,write:!1}}}})],V.prototype,"functionDefinition",void 0),(0,s._)([(0,u.Cb)({type:String,json:{read:!0,write:!0,origins:{"web-document":{read:!1,write:!1}}}})],V.prototype,"thumbnail",void 0),V=i=(0,s._)([(0,d.j)("esri.layers.support.RasterFunction")],V);var J=V,E=r(93010),q=r(75509),z=r(23847);const Z={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767]},L={simple_scalar:"Simple Scalar",wind_barb:"Wind Barb",single_arrow:"Single Arrow",beaufort_kn:"Beaufort Wind (Knots)",beaufort_m:"Beaufort Wind (MetersPerSecond)",ocean_current_m:"Ocean Current (MetersPerSecond)",ocean_current_kn:"Ocean Current (Knots)"},U=new Set(["raster-stretch","unique-value","class-breaks","raster-shaded-relief","vector-field","raster-colormap"]);function B(e){return U.has(e.type)}function k(e,t){if(!e||!t)return(0,_.d9)(e||t);const r=(0,_.d9)(e);return"none"!==t.functionName.toLowerCase()&&(Q(r.functionArguments).Raster=t),r}function Q(e){const t=e.Raster;return t&&"esri.layers.support.RasterFunction"===t.declaredClass?Q(t.functionArguments):e}const H={none:0,standardDeviation:3,histogramEqualization:4,minMax:5,percentClip:6,sigmoid:9};function G(e,t){const r=Z[String(t).toLowerCase()];return r&&e.push([Math.floor(r[0]-1),0,0,0],[Math.ceil(r[1]+1),0,0,0]),e}function W(e){if(!e)return;const{fields:t}=e,r=t&&t.find((e=>e&&e.name&&"value"===e.name.toLowerCase()));return r&&r.name}function X(e){const t=[];return e.forEach((e=>{const r=e;if(Array.isArray(r))t.push(r);else{if(null==r.min||null==r.max)return;const e=[r.min,r.max,r.avg||0,r.stddev||0];t.push(e)}})),t}var Y,$=r(90578),K=r(13473);const ee=(0,w.wY)()({MT_FIRST:"first",MT_LAST:"last",MT_MIN:"min",MT_MAX:"max",MT_MEAN:"mean",MT_BLEND:"blend",MT_SUM:"sum"}),te=(0,w.wY)()({esriMosaicNone:"none",esriMosaicCenter:"center",esriMosaicNadir:"nadir",esriMosaicViewpoint:"viewpoint",esriMosaicAttribute:"attribute",esriMosaicLockRaster:"lock-raster",esriMosaicNorthwest:"northwest",esriMosaicSeamline:"seamline"});let re=Y=class extends j.wq{constructor(e){super(e),this.ascending=!0,this.itemRenderingRule=null,this.lockRasterIds=null,this.method=null,this.multidimensionalDefinition=null,this.objectIds=null,this.operation=null,this.sortField=null,this.sortValue=null,this.viewpoint=null,this.where=null}readAscending(e,t){return null!=t.ascending?t.ascending:null==t.sortAscending||t.sortAscending}readMethod(e,t){return function(e){let t;switch(e?e.toLowerCase().replace("esrimosaic",""):""){case"byattribute":case"attribute":t="esriMosaicAttribute";break;case"lockraster":t="esriMosaicLockRaster";break;case"center":t="esriMosaicCenter";break;case"northwest":t="esriMosaicNorthwest";break;case"nadir":t="esriMosaicNadir";break;case"viewpoint":t="esriMosaicViewpoint";break;case"seamline":t="esriMosaicSeamline";break;default:t="esriMosaicNone"}return te.fromJSON(t)}(t.mosaicMethod||t.defaultMosaicMethod)}readOperation(e,t){const r=t.mosaicOperation,i=t.mosaicOperator&&t.mosaicOperator.toLowerCase(),s=r||(i?ee.toJSON(i):null);return ee.fromJSON(s)||"first"}castSortValue(e){return null==e||"string"==typeof e||"number"==typeof e?e:`${e}`}clone(){return new Y({ascending:this.ascending,itemRenderingRule:(0,_.d9)(this.itemRenderingRule),lockRasterIds:(0,_.d9)(this.lockRasterIds),method:this.method,multidimensionalDefinition:(0,_.d9)(this.multidimensionalDefinition),objectIds:(0,_.d9)(this.objectIds),operation:this.operation,sortField:this.sortField,sortValue:this.sortValue,viewpoint:(0,_.d9)(this.viewpoint),where:this.where})}};(0,s._)([(0,u.Cb)({type:Boolean,json:{write:!0}})],re.prototype,"ascending",void 0),(0,s._)([(0,x.r)("ascending",["ascending","sortAscending"])],re.prototype,"readAscending",null),(0,s._)([(0,u.Cb)({type:J,json:{write:!0}})],re.prototype,"itemRenderingRule",void 0),(0,s._)([(0,u.Cb)({type:[p.z8],json:{write:{overridePolicy(){return{enabled:"lock-raster"===this.method}}}}})],re.prototype,"lockRasterIds",void 0),(0,s._)([(0,u.Cb)({type:String,json:{type:te.jsonValues,write:{target:"mosaicMethod",writer:te.write}}})],re.prototype,"method",void 0),(0,s._)([(0,x.r)("method",["mosaicMethod","defaultMosaicMethod"])],re.prototype,"readMethod",null),(0,s._)([(0,u.Cb)({type:[I.Z],json:{write:!0}})],re.prototype,"multidimensionalDefinition",void 0),(0,s._)([(0,u.Cb)({type:[p.z8],json:{name:"fids",write:!0}})],re.prototype,"objectIds",void 0),(0,s._)([(0,u.Cb)({json:{type:ee.jsonValues,read:{reader:ee.read},write:{target:"mosaicOperation",writer:ee.write}}})],re.prototype,"operation",void 0),(0,s._)([(0,x.r)("operation",["mosaicOperation","mosaicOperator"])],re.prototype,"readOperation",null),(0,s._)([(0,u.Cb)({type:String,json:{write:{overridePolicy(){return{enabled:"attribute"===this.method}}}}})],re.prototype,"sortField",void 0),(0,s._)([(0,u.Cb)({type:[String,Number],json:{write:{allowNull:!0,overridePolicy(){return{enabled:"attribute"===this.method,allowNull:!0}}}}})],re.prototype,"sortValue",void 0),(0,s._)([(0,$.p)("sortValue")],re.prototype,"castSortValue",null),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],re.prototype,"viewpoint",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],re.prototype,"where",void 0),re=Y=(0,s._)([(0,d.j)("esri.layers.support.MosaicRule")],re);var ie=re,se=r(69608);let ne=class extends j.wq{constructor(){super(...arguments),this.layer=null,this.adjustAspectRatio=void 0,this.bandIds=void 0,this.compression=void 0,this.compressionQuality=void 0,this.compressionTolerance=.01,this.format=null,this.interpolation=null,this.noData=null,this.noDataInterpretation=void 0,this.pixelType=void 0,this.lercVersion=2}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().indexOf("jpg")>-1&&null!=e&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("renderingRule"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("renderer"),e.commitProperty("definitionExpression"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new ie({where:r})),t}get renderingRule(){const e=this.layer;let t=e.renderingRule;const r=e.pixelFilter,i=!e.format||e.format.indexOf("jpg")>-1||e.format.indexOf("png")>-1;return t=this._addResampleRasterFunction(t),i&&!r&&(t=this.combineRendererWithRenderingRule()),t}combineRendererWithRenderingRule(){var e;const t=this.layer,{rasterInfo:r,renderingRule:i,renderer:s}=t;return s&&B(s)?k(function(e,t){switch(t=t||{},e.type){case"raster-stretch":return function(e,t){const r=new J;r.functionName="Stretch";const i=H[q.v.toJSON(e.stretchType)],s="u8",n={StretchType:i,Statistics:X(e.statistics),DRA:e.dynamicRangeAdjustment,UseGamma:e.useGamma,Gamma:e.gamma,ComputeGamma:e.computeGamma};if(null!=e.outputMin&&(n.Min=e.outputMin),null!=e.outputMax&&(n.Max=e.outputMax),i===H.standardDeviation?(n.NumberOfStandardDeviations=e.numberOfStandardDeviations,r.outputPixelType=s):i===H.percentClip?(n.MinPercent=e.minPercent,n.MaxPercent=e.maxPercent,r.outputPixelType=s):i===H.minMax?r.outputPixelType=s:i===H.sigmoid&&(n.SigmoidStrengthLevel=e.sigmoidStrengthLevel),r.functionArguments=n,r.variableName="Raster",e.colorRamp){const i=e.colorRamp,s=new J,n=(0,E.Uh)(i);return n?s.functionArguments={colorRamp:n}:!t.convertColorRampToColormap||"algorithmic"!==i.type&&"multipart"!==i.type?s.functionArguments={colorRamp:e.colorRamp.toJSON()}:s.functionArguments={Colormap:(0,E.Jw)(i,256)},s.variableName="Raster",s.functionName="Colormap",s.functionArguments.Raster=r,s}return r}(e,t);case"class-breaks":return function(e,t){const r=[],i=[],s=[],n=[],o=1e-6,{pixelType:a,rasterAttributeTable:l}=t,u=l&&l.features,p=W(l);if(u&&Array.isArray(u)&&e.classBreakInfos){e.classBreakInfos.forEach(((t,r)=>{const i=t.symbol.color;let s;i.a&&u.forEach((o=>{s=o.attributes[e.field],(s>=t.minValue&&s<t.maxValue||r===e.classBreakInfos.length-1&&s>=t.minValue)&&n.push([o.attributes[p],i.r,i.g,i.b])}))}));const t=a?G(n,a):n,r=new J;return r.functionName="Colormap",r.functionArguments={},r.functionArguments.Colormap=t,r.variableName="Raster",r}e.classBreakInfos.forEach(((e,t)=>{const a=e.symbol&&e.symbol.color;a.a?(0===t?r.push(e.minValue,e.maxValue+o):r.push(e.minValue+o,e.maxValue+o),i.push(t),n.push([t,a.r,a.g,a.b])):s.push(e.minValue,e.maxValue)}));const c=a?G(n,a):n,d=new J;d.functionName="Remap",d.functionArguments={InputRanges:r,OutputValues:i,NoDataRanges:s},d.variableName="Raster";const m=new J;return m.functionName="Colormap",m.functionArguments={Colormap:c,Raster:d},m}(e,t);case"unique-value":return function(e,t){var r;const i=[],{pixelType:s,rasterAttributeTable:n}=t,o=n&&n.features,a=W(n),l=null==(r=e.defaultSymbol)?void 0:r.color;let u=!1;if(e.uniqueValueInfos&&(o?o.forEach((t=>{var r;const s=null==(r=e.uniqueValueInfos.find((r=>String(t.attributes[e.field])===String(r.value))))?void 0:r.symbol.color;s?i.push([t.attributes[a],s.r,s.g,s.b]):l&&i.push([t.attributes[a],l.r,l.g,l.b])})):e.uniqueValueInfos.forEach((e=>{var t;if(null==(t=e.symbol.color)||!t.a)return;const r=e.symbol.color;isNaN(+e.value)?u=!0:i.push([+e.value,r.r,r.g,r.b])}))),u)return null;const p=s&&i.length>0?G(i,s):i,c=new J;return c.functionName="Colormap",c.functionArguments={},c.functionArguments.Colormap=p,c.variableName="Raster",c}(e,t);case"raster-colormap":return function(e,t){const r=e.extractColormap();if(!r||0===r.length)return;const{pixelType:i}=t,s=i?G(r,i):r,n=new J;return n.functionName="Colormap",n.functionArguments={},n.functionArguments.Colormap=s,n}(e,t);case"vector-field":return function(e,t){const r=new J;r.functionName="VectorFieldRenderer";const{dataType:i,bandProperties:s}=t,n="vector-uv"===i;let o,a;s&&2===s.length&&(o=s.map((e=>e.BandName.toLowerCase())).indexOf("magnitude"),a=s.map((e=>e.BandName.toLowerCase())).indexOf("direction")),-1!==o&&null!==o||(o=0,a=1);const l="arithmetic"===e.rotationType?1:2,u="flow-from"===e.flowRepresentation?0:1,p=e.visualVariables?e.visualVariables.filter((e=>"Magnitude"===e.field))[0]:new z.Z,c={magnitudeBandID:o,directionBandID:a,isUVComponents:n,referenceSystem:l,massFlowAngleRepresentation:u,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:L[e.style.toLowerCase().replace("-","_")],minimumMagnitude:p.minDataValue,maximumMagnitude:p.maxDataValue,minimumSymbolSize:p.minSize,maximumSymbolSize:p.maxSize};return r.functionArguments=c,r}(e,t);case"raster-shaded-relief":return function(e,t){if("elevation"!==t.dataType)return new J;const r=new J;r.functionName="Hillshade";const i="traditional"===e.hillshadeType?0:1,s="none"===e.scalingType?1:3,n={HillshadeType:i,SlopeType:s,ZFactor:e.zFactor};return 0===i&&(n.Azimuth=e.azimuth,n.Altitude=e.altitude),3===s&&(n.PSPower=e.pixelSizePower,n.PSZFactor=e.pixelSizeFactor),r.functionArguments=n,r.variableName="Raster",e.colorRamp&&(r.functionName="ShadedRelief",n.Colormap=(0,E.Jw)(e.colorRamp,256)),r}(e,t)}}(s,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandProperties:null==(e=r.keyProperties)?void 0:e.BandProperties,convertColorRampToColormap:t.version<10.6}),i):i}_addResampleRasterFunction(e){var t;if("vector-field"!==(null==(t=this.layer.renderer)?void 0:t.type)||"Resample"===(null==e?void 0:e.functionName))return e;const r="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10;return k(new J({functionName:"Resample",functionArguments:{ResamplingType:r,InputCellSize:{x:this.layer.pixelSizeX,y:this.layer.pixelSizeY}}}),e)}};(0,s._)([(0,u.Cb)()],ne.prototype,"layer",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"adjustAspectRatio",void 0),(0,s._)([(0,m.c)("adjustAspectRatio")],ne.prototype,"writeAdjustAspectRatio",null),(0,s._)([(0,u.Cb)({json:{write:!0}}),(0,C.B)("layer.bandIds")],ne.prototype,"bandIds",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"compression",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}}),(0,C.B)("layer.compressionQuality")],ne.prototype,"compressionQuality",void 0),(0,s._)([(0,m.c)("compressionQuality")],ne.prototype,"writeCompressionQuality",null),(0,s._)([(0,u.Cb)({json:{write:!0}}),(0,C.B)("layer.compressionTolerance")],ne.prototype,"compressionTolerance",void 0),(0,s._)([(0,m.c)("compressionTolerance")],ne.prototype,"writeCompressionTolerance",null),(0,s._)([(0,u.Cb)({json:{write:!0}}),(0,C.B)("layer.format")],ne.prototype,"format",void 0),(0,s._)([(0,u.Cb)({type:String,json:{read:{reader:se.c.read},write:{writer:se.c.write}}}),(0,C.B)("layer.interpolation")],ne.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}}),(0,C.B)("layer.noData")],ne.prototype,"noData",void 0),(0,s._)([(0,u.Cb)({type:String,json:{read:{reader:se.k.read},write:{writer:se.k.write}}}),(0,C.B)("layer.noDataInterpretation")],ne.prototype,"noDataInterpretation",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"pixelType",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"lercVersion",void 0),(0,s._)([(0,m.c)("lercVersion")],ne.prototype,"writeLercVersion",null),(0,s._)([(0,u.Cb)({type:Number})],ne.prototype,"version",null),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"mosaicRule",null),(0,s._)([(0,u.Cb)({json:{write:!0}})],ne.prototype,"renderingRule",null),ne=(0,s._)([(0,d.j)("esri.layers.mixins.ExportImageServiceParameters")],ne);var oe=r(1231),ae=r(99514),le=r(54163),ue=r(48526),pe=r(88281),ce=r(75993),de=r(80676),me=r(77982),he=r(91219),ye=r(38581),fe=r(11282),ge=r(74889);let ve=class extends j.wq{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"catalogItemVisibilities",void 0),(0,s._)([(0,u.Cb)({type:ge.default,json:{write:!0}})],ve.prototype,"catalogItems",void 0),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],ve.prototype,"location",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"name",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"objectId",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"processedValues",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"properties",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ve.prototype,"value",void 0),ve=(0,s._)([(0,d.j)("esri.rest.support.ImageIdentifyResult")],ve);var be=ve;let we=class extends j.wq{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};(0,s._)([(0,u.Cb)({json:{write:!0}})],we.prototype,"attributes",void 0),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],we.prototype,"location",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],we.prototype,"locationId",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],we.prototype,"rasterId",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],we.prototype,"resolution",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],we.prototype,"pixelValue",void 0),we=(0,s._)([(0,d.j)("esri.rest.support.ImageSample")],we);var _e=we;let Re=class extends j.wq{constructor(){super(...arguments),this.samples=null}};(0,s._)([(0,u.Cb)({type:[_e],json:{write:!0}})],Re.prototype,"samples",void 0),Re=(0,s._)([(0,d.j)("esri.rest.support.ImageSampleResult")],Re);var Ce=Re;function xe(e){const t=null==e?void 0:e.time;if(t&&(null!=t.start||null!=t.end)){const r=[];null!=t.start&&r.push(t.start),null!=t.end&&-1===r.indexOf(t.end)&&r.push(t.end),e.time=r.join(",")}}async function Se(e,t,r){const i=(0,fe.en)(e),s=t.geometry?[t.geometry]:[],n=await(0,ye.aX)(s),a=t.toJSON();xe(a);const l=n&&n[0];(0,o.pC)(l)&&(a.geometry=l.toJSON());const u=(0,fe.cv)({...i.query,f:"json",...a});return(0,fe.lA)(u,r)}async function Ie(e,t,r){const i=(0,fe.en)(e),s=t.geometry?[t.geometry]:[];return(0,ye.aX)(s).then((e=>{const s=t.toJSON(),n=e&&e[0];(0,o.pC)(n)&&(s.geometry=JSON.stringify(n.toJSON()));const a=(0,fe.cv)({...i.query,f:"json",...s}),l=(0,fe.lA)(a,r);return(0,v.default)(i.path+"/identify",l)})).then((e=>be.fromJSON(e.data)))}r(40330),r(98326),r(56545);var je,Te=r(41818),Ne=r(6570),Oe=(r(9361),r(65091)),Fe=r(17332),Pe=(r(58901),r(45091),r(67900),r(8744),r(57444)),De=r(5396),Me=r(4967),Ae=(r(98732),r(75935),r(28141),r(92835)),Ve=r(33955);let Je=je=class extends j.wq{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.renderingRule=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(e,t,r){null!=e&&(t.geometryType=(0,Ve.Ji)(e),t[r]=e.toJSON())}clone(){return new je((0,_.d9)({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};(0,s._)([(0,u.Cb)({types:y.qM,json:{read:Ve.im}})],Je.prototype,"geometry",void 0),(0,s._)([(0,m.c)("geometry")],Je.prototype,"writeGeometry",null),(0,s._)([(0,u.Cb)({type:ie,json:{write:!0}})],Je.prototype,"mosaicRule",void 0),(0,s._)([(0,u.Cb)({type:J,json:{write:!0}})],Je.prototype,"renderingRule",void 0),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],Je.prototype,"pixelSize",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],Je.prototype,"raster",void 0),(0,s._)([(0,u.Cb)({type:Ae.Z,json:{read:{source:"time"},write:{target:"time"}}})],Je.prototype,"timeExtent",void 0),Je=je=(0,s._)([(0,d.j)("esri.rest.support.ImageHistogramParameters")],Je);var Ee,qe=Je;let ze=Ee=class extends j.wq{constructor(){super(...arguments),this.geometry=null,this.renderingRules=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0}writeGeometry(e,t,r){null!=e&&(t.geometryType=(0,Ve.Ji)(e),t[r]=JSON.stringify(e.toJSON()))}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=ie.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}writeMosaicRule(e,t,r){null!=e&&(t[r]=JSON.stringify(e.toJSON()))}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}writeRenderingRule(e,t,r){null!=e&&(t[r]=JSON.stringify(e.toJSON()))}writeRenderingRules(e,t,r){null!=e&&(t[r]=JSON.stringify(e.map((e=>e.toJSON()))))}writePixelSize(e,t,r){null!=e&&(t[r]=JSON.stringify(e))}writeTimeExtent(e,t,r){if(null!=e){const i=(0,o.pC)(e.start)?e.start.getTime():null,s=(0,o.pC)(e.end)?e.end.getTime():null;t[r]=null!=i?null!=s?`${i},${s}`:`${i}`:null}}clone(){return new Ee((0,_.d9)({geometry:this.geometry,mosaicRule:this.mosaicRule,renderingRule:this.renderingRule,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};(0,s._)([(0,u.Cb)({json:{write:!0}})],ze.prototype,"geometry",void 0),(0,s._)([(0,m.c)("geometry")],ze.prototype,"writeGeometry",null),(0,s._)([(0,u.Cb)({type:ie,json:{write:!0}})],ze.prototype,"mosaicRule",null),(0,s._)([(0,m.c)("mosaicRule")],ze.prototype,"writeMosaicRule",null),(0,s._)([(0,u.Cb)({type:J,json:{write:!0}})],ze.prototype,"renderingRule",null),(0,s._)([(0,m.c)("renderingRule")],ze.prototype,"writeRenderingRule",null),(0,s._)([(0,u.Cb)({type:[J],json:{write:!0}})],ze.prototype,"renderingRules",void 0),(0,s._)([(0,m.c)("renderingRules")],ze.prototype,"writeRenderingRules",null),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],ze.prototype,"pixelSize",void 0),(0,s._)([(0,m.c)("pixelSize")],ze.prototype,"writePixelSize",null),(0,s._)([(0,u.Cb)({type:Boolean,json:{write:!0}})],ze.prototype,"returnGeometry",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{write:!0}})],ze.prototype,"returnCatalogItems",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{write:!0}})],ze.prototype,"returnPixelValues",void 0),(0,s._)([(0,u.Cb)({type:Number,json:{write:!0}})],ze.prototype,"maxItemCount",void 0),(0,s._)([(0,u.Cb)({type:Ae.Z,json:{write:{target:"time"}}})],ze.prototype,"timeExtent",void 0),(0,s._)([(0,m.c)("timeExtent")],ze.prototype,"writeTimeExtent",null),(0,s._)([(0,u.Cb)({json:{write:!0}})],ze.prototype,"raster",void 0),(0,s._)([(0,u.Cb)({json:{write:!0}})],ze.prototype,"viewId",void 0),ze=Ee=(0,s._)([(0,d.j)("esri.rest.support.ImageIdentifyParameters")],ze);var Ze,Le=ze;let Ue=Ze=class extends j.wq{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(e,t,r){null!=e&&(t.geometryType=(0,Ve.Ji)(e),t[r]=e.toJSON())}set locations(e){if(null!=e&&e.length){const t=new Oe.Z({spatialReference:e[0].spatialReference});t.points=e.map((e=>[e.x,e.y])),this._set("locations",e),this.geometry=t}}clone(){return new Ze((0,_.d9)({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};(0,s._)([(0,u.Cb)({types:y.qM,json:{read:Ve.im}})],Ue.prototype,"geometry",void 0),(0,s._)([(0,m.c)("geometry")],Ue.prototype,"writeGeometry",null),(0,s._)([(0,u.Cb)({type:String,json:{type:se.c.jsonValues,read:se.c.read,write:se.c.write}})],Ue.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)({type:ie,json:{write:!0}})],Ue.prototype,"mosaicRule",void 0),(0,s._)([(0,u.Cb)({type:[String],json:{write:!0}})],Ue.prototype,"outFields",void 0),(0,s._)([(0,u.Cb)({type:K.Z,json:{write:!0}})],Ue.prototype,"pixelSize",void 0),(0,s._)([(0,u.Cb)({type:String,json:{write:!0}})],Ue.prototype,"raster",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{write:!0}})],Ue.prototype,"returnFirstValueOnly",void 0),(0,s._)([(0,u.Cb)({type:Number,json:{write:!0}})],Ue.prototype,"sampleDistance",void 0),(0,s._)([(0,u.Cb)({type:Number,json:{write:!0}})],Ue.prototype,"sampleCount",void 0),(0,s._)([(0,u.Cb)({type:Number,json:{write:!0}})],Ue.prototype,"sliceId",void 0),(0,s._)([(0,u.Cb)({type:Ae.Z,json:{read:{source:"time"},write:{target:"time"}}})],Ue.prototype,"timeExtent",void 0),Ue=Ze=(0,s._)([(0,d.j)("esri.rest.support.ImageSampleParameters")],Ue);var Be=Ue,ke=r(82971);const Qe=c.Z.getLogger("esri.layers.mixins.ArcGISImageService"),He=(0,w.wY)()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Ge=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),We=(0,u.Eg)(p.q9,{min:0,max:255}),Xe=e=>{let t=class extends e{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._symbolizer=null,this._defaultServiceMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.renderer=null,this.rasterAttributeTable=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=null}initialize(){this._set("exportImageServiceParameters",new ne({layer:this}))}readDefaultServiceMosaicRule(e,t){return ie.fromJSON(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos.length<1||this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new ae.Z(this.fields):null}set format(e){e&&Ge.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=ie.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){return ie.fromJSON(e||t.mosaicRule||t)}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new ie({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=We(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?(0,R.mN)(this.url):null}readRenderer(e,t,r){var i,s;const n=null==t||null==(i=t.layerDefinition)||null==(s=i.drawingInfo)?void 0:s.renderer,o=(0,g.ij)(n,r);return null==o?null:("vector-field"===o.type&&t.symbolTileSize&&!n.symbolTileSize&&(o.symbolTileSize=t.symbolTileSize),B(o)||Qe.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),o)}writeRenderer(e,t,r){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.rasterAttributeTableFieldPrefix||"Raster.",t=new oe.Z({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new oe.Z({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new oe.Z({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?(0,_.d9)(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new oe.Z({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new oe.Z({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new oe.Z({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=(0,_.d9)(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=J.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?J.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){this._isRFTJson(e)||(t[r]=e.toJSON())}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ke.Z.fromJSON(r):null}readPixelType(e){return He.fromJSON(e)||e}writePixelType(e,t,r){((0,o.Wi)(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=He.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this._symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this._symbolizer.bind(),await s.updateSymbolizer(this._symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this._symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeHistograms)throw new b.Z("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=(0,p.TJ)(qe,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),async function(e,t,r){const i=await Se(e,t,r),s=(0,fe.en)(e),{data:n}=await(0,v.default)(`${s.path}/computeHistograms`,i);return{histograms:n.histograms}}(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new b.Z("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=(0,p.TJ)(qe,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),async function(e,t,r){const i=await Se(e,t,r),s=(0,fe.en)(e),{data:n}=await(0,v.default)(`${s.path}/computeStatisticsHistograms`,i),{statistics:o}=n;return null!=o&&o.length&&o.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:o,histograms:n.histograms}}(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return(0,o.pC)(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new b.Z("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this._symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return(0,l.gx)(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return(0,v.default)(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>e.data))}fetchRasterAttributeTable(e){const t=e&&e.renderingRule&&e.renderingRule.toJSON();return this.version<10.1?Promise.reject(new b.Z("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):(0,v.default)(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3&&t?JSON.stringify(t):null})}).then((e=>ge.default.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=(0,v.default)(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=(0,v.default)(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const n=Ne.Z.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new ue.Z({bandCount:s[0].bandCount,extent:n,spatialReference:n.sr,pixelSize:new K.Z({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:n.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await(0,v.default)(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await(0,v.default)(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const n=this.version>=10.7?(0,v.default)(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,a={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},l=(0,v.default)(this.parsedUrl.path+"/project",{query:this._getQueryParams(a),...t}).then((e=>e.data)).catch((()=>({}))),u=(s.xmin+s.xmax)/2,p=(s.ymax-s.ymin)/6,c=s.ymin+p,d=[];for(let e=0;e<5;e++)d.push({x:u,y:c+p*e});const m={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},h=(0,v.default)(this.parsedUrl.path+"/project",{query:this._getQueryParams(m),...t}).then((e=>e.data)).catch((()=>({}))),y=await Promise.all([n,l,h]);let f=y[0].ipxf;if(null==f){var g,b,w;const e=null==(g=i.geodataXform)?void 0:g.xf_0;"topup"===(null==e||null==(b=e.name)?void 0:b.toLowerCase())&&6===(null==e||null==(w=e.coefficients)?void 0:w.length)&&(f={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const _=Ne.Z.fromJSON(y[1]&&y[1].geometries&&y[1].geometries[0]);_&&(_.spatialReference=new ke.Z({wkid:0,imageCoordinateSystem:i}));const R=y[2].geometries?y[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],C=R.length;if(C<3)return{ics:i,icsToPixelTransform:f,icsExtent:_,northDirection:null};let x=0,S=0,I=0,j=0;for(let e=0;e<C;e++)x+=R[e].x,S+=R[e].y,I+=R[e].x*R[e].x,j+=R[e].x*R[e].y;const T=(C*j-x*S)/(C*I-x*x);let N=0;const O=R[4].x>R[0].x,F=R[4].y>R[0].y;return T===1/0?N=F?90:270:0===T?N=O?0:180:T>0?N=O?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(N=F?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:i,icsToPixelTransform:f,icsExtent:_,northDirection:N}}async generateRasterInfo(e,t){if((!e||"none"===e.functionName.toLowerCase()||this._isVectorFieldResampleFunction(e))&&(0,o.pC)(this.serviceRasterInfo))return this.serviceRasterInfo;const r=function(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),r=null==t?void 0:t.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return r?r.join("/"):null}(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){const s=(e=e.clone().shiftCentralMeridian()).spatialReference;let n;if(s.imageCoordinateSystem){const{id:e,referenceServiceName:t}=s.imageCoordinateSystem;n=null!=e?t?this.parsedUrl.path.toLowerCase().indexOf("/"+t.toLowerCase()+"/")>-1?"0:"+e:JSON.stringify({icsid:e,icsns:t}):"0:"+e:JSON.stringify({ics:s.imageCoordinateSystem})}else n=s.wkid||JSON.stringify(s.toJSON());(0,o.pC)(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const a=this.exportImageServiceParameters.toJSON(),{bandIds:l,noData:u}=a;let{renderingRule:p}=a;if(l instanceof Array&&l.length>0&&!this.renderingRule?a.bandIds=l.join(","):a.bandIds=void 0,null!=l&&l.length&&this.renderingRule)if("Colormap"===p.rasterFunction){const e=new J({functionName:"ExtractBand",functionArguments:{BandIds:l,raster:p.rasterFunctionArguments.Raster}});p.rasterFunctionArguments.Raster=e}else p=new J({functionName:"ExtractBand",functionArguments:{BandIds:l,raster:p}});u instanceof Array&&u.length>0&&(a.noData=u.join(","));const c=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i);a.mosaicRule=c&&JSON.stringify(c),a.renderingRule=p&&JSON.stringify(p);const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+r,...a,...d}}async getSamples(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsGetSamples)throw new b.Z("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=(0,p.TJ)(Be,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),async function(e,t,r){var i,s;const n=t.toJSON();xe(n),null!=(i=n.outFields)&&i.length&&(n.outFields=n.outFields.join(","));const a=await(0,ye.aX)(t.geometry),l=null==a?void 0:a[0];(0,o.pC)(l)&&(n.geometry=l.toJSON());const u=(0,fe.en)(e),p=(0,fe.cv)({...u.query,f:"json",...n}),c=(0,fe.lA)(p,r),{data:d}=await(0,v.default)(`${u.path}/getSamples`,c),m=null==d||null==(s=d.samples)?void 0:s.map((e=>{const t="NaN"===e.value||""===e.value?null:e.value.split(" ").map((e=>Number(e)));return{...e,pixelValue:t}}));return Ce.fromJSON({samples:m})}(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(null==t?void 0:t.signal),!this.capabilities.operations.supportsIdentify)throw new b.Z("imagery-layer:query-rasters","query operation is not supported on the input image service");e=(0,p.TJ)(Le,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=(0,o.Wg)(t)}return r&&null==e.raster&&(e.raster=r),Ie(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new Pe.Z;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,Me.e)(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,De.G)(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),(0,Te.P)(this.url,e,t)}queryVisibleRasters(e,t){if(!e)return Promise.reject(new b.Z("imagery-layer: query-visible-rasters","missing query parameter"));const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this.rasterFunctionNamesIndex;if((0,o.pC)(e.outFields)&&(a=e.outFields.some((e=>-1===e.toLowerCase().indexOf(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().indexOf(p)>-1&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new J({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const d=(0,o.Wi)(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),m=e.timeExtent||this.timeExtent,h=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,m),y=this._getQueryParams({geometry:e.geometry,timeExtent:m,mosaicRule:h,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:d,raster:this.raster,maxItemCount:s?1:null});delete y.f;const f=new Le(y),g=this.generateRasterInfo(this.renderingRule);return new Promise((r=>{g.then((()=>{Ie(this.url,f,{signal:null==t?void 0:t.signal,query:{...this.customParameters}}).then((t=>{const s=e.outFields;if(a&&!d&&t.catalogItems&&t.catalogItems.features&&t.catalogItems.features.length>0){const o=this.objectIdField||"ObjectId",a=t.catalogItems.features,l=a.map((e=>e.attributes&&e.attributes[o])),p=new Pe.Z({objectIds:l,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[o]});return this.queryRasters(p).then((l=>{l&&l.features&&l.features.length>0&&l.features.forEach((t=>{a.forEach((r=>{r.attributes[o]===t.attributes[o]&&(r.geometry=new Fe.Z(t.geometry),r.geometry.spatialReference=e.outSpatialReference)}))})),r(this._processVisibleRastersResponse(t,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s}))})).catch((()=>{throw new b.Z("imagery-layer:query-visible-rasters","encountered error when querying visible rasters geometry")}))}r(this._processVisibleRastersResponse(t,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s}))})).catch((()=>{throw new b.Z("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}))}))}))}async fetchVariableStatisticsHistograms(e,t){const r=(0,v.default)(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.statistics})),i=(0,v.default)(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async _fetchService(e){await this._fetchServiceInfo(e),(0,o.pC)(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=(0,o.pC)(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this.renderingRule&&"none"!==this.renderingRule.functionName.toLowerCase()?this.generateRasterInfo(this.renderingRule,{signal:e}):null;return Promise.all([r,i]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this.renderer=null,Qe.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._configDefaultRenderer(),this.watch("renderer",(()=>this._configDefaultRenderer())),this.watch("renderingRule",(e=>{(this.renderer||this._symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}));const t=(0,o.pC)(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;return(0,o.Wi)(e)||(0,o.Wi)(e.multidimensionalDefinition)||(0,o.Wi)(this.multidimensionalInfo)||(0,o.Wi)(t)||(0,o.Wi)(null==r?void 0:r.startField)||((e=e.clone()).multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>e.dimensionName!==r.startField))),e}async _prepareForQuery(e,t){var r;if(await this._fetchCapabilities(null==(r=t)?void 0:r.signal),!this.capabilities.operations.supportsQuery)throw new b.Z("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=(0,o.pC)(e)?(0,p.TJ)(Pe.Z,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new pe.Z;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&r&&"none"!==r.functionName.toLowerCase()&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||(0,me.U0)(this.rasterInfo).includes(this.renderer.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var t;let r=this.sourceJSON;if(!r){const{data:t,ssl:i}=await(0,v.default)(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});r=t,this.sourceJSON=r,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if((null==(t=r.capabilities)?void 0:t.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly"))>-1)throw new b.Z("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(r,{origin:"service",url:this.parsedUrl})}_isVectorFieldResampleFunction(e){if(!(0,o.pC)(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t.toLowerCase(),s=(null==r?void 0:r.ResampleType)||(null==r?void 0:r.resampleType);return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.indexOf("jpg")>-1||this.format.indexOf("png")>-1}_configDefaultRenderer(){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=(0,me.YD)(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}var e,t;this.renderer||(this.renderer=(0,me.Ob)(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:null==(e=this.mosaicRule)||null==(t=e.multidimensionalDefinition)?void 0:t[0].variableName})),this._symbolizer?(this._symbolizer.rendererJSON=(0,me.ol)(this.renderer.toJSON()),this._symbolizer.rasterInfo=this.rasterInfo):this._symbolizer=new he.Z({rendererJSON:this.renderer.toJSON(),rasterInfo:this.rasterInfo}),this._symbolizer.bind()||(this._symbolizer=null)}}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:(0,o.pC)(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...null==e?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):(0,ce.Jx)(e,t,r)}async _fetchMultidimensionalInfo(e){var t;const r=await(0,v.default)(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=r.variables)&&t.length&&r.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),r}_fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)return Promise.reject(new b.Z("imagery-layer:fetch-metadata","valid serviceInfo is required"));const r=e.renderingRule?JSON.stringify(e.renderingRule.toJSON()):null,i=e.signal,s=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&(0,v.default)(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>ge.default.fromJSON(e.data))).catch((()=>null)),n=!!(t.hasColormap&&this.version>=10.1)&&(0,v.default)(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),o=!!(t.hasHistograms&&this.version>=10.1)&&(0,v.default)(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?r:null}),signal:i}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),a=this.version>=10.3&&(0,v.default)(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:r}),signal:i}).then((e=>e.data)).catch((()=>{})),l=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo();return Promise.all([s,n,o,a,l]).then((e=>{let r=null;if(t.minValues&&t.minValues.length===t.bandCount){r=[];for(let e=0;e<t.minValues.length;e++)r.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const i=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),s=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),n=ke.Z.fromJSON(t.spatialReference||t.extent.spatialReference);return new ue.Z({width:i,height:s,bandCount:t.bandCount,extent:Ne.Z.fromJSON(t.extent),spatialReference:n,pixelSize:new K.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n}),pixelType:t.pixelType.toLowerCase(),statistics:r,attributeTable:e[0]||null,colormap:e[1]||null,histograms:e[2]||null,keyProperties:e[3]||{},multidimensionalInfo:e[4]||null})}))}_requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format&&t.format.indexOf("png")>-1)return(0,v.default)(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}).then((e=>({imageElement:e.data,params:t})));const s=this._initJobHandler(),n=(0,v.default)(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i});return Promise.all([n,s]).then((e=>{const r=e[0].data,s=t.format||"jpgpng";let n=s;if("bsq"!==n&&"bip"!==n&&(n=(0,ce.y6)(r)),!n)throw new b.Z("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(r)));const o="gif"===s||"bmp"===s||s.indexOf("png")>-1&&("png"===n||"jpg"===n),a={signal:i};return o?(0,ce.Jx)(r,{useCanvas:!0,...t},a).then((e=>({pixelData:{pixelBlock:e,extent:t.extent},params:t}))):this._decodePixelBlock(r,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:s},a).then((e=>({pixelData:{pixelBlock:e,extent:t.extent},params:t})))}))}async _generateRasterInfo(e,t){const{data:r}=await(0,v.default)(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule&&this._defaultServiceMosaicRule.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r=[];for(const e in t)if(t.hasOwnProperty(e)){const i=t[e],s=i.extent;let n=!0,o=[s[0]];i.hasRanges&&!0===i.hasRanges?(n=!1,o=[i.values[0]]):"stdz"===i.name.toLowerCase()&&Math.abs(s[1])<=Math.abs(s[0])&&(o=[s[1]]),r.push(new I.Z({variableName:"",dimensionName:t[e].name,isSlice:n,values:o}))}if(r.length>0){this.mosaicRule=this.mosaicRule||new ie;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=r)}}_formatAttributeValue(e,t){if("string"==typeof e){const r=this.popupTemplate&&this.popupTemplate.fieldInfos,i=this._getFieldInfo(r,t),s=i&&i.format;if(s){let t,r;return e.trim().indexOf(",")>-1?(t=",",r=t+" ",this._formatDelimitedString(e,t,r,s)):e.trim().indexOf(" ")>-1?(t=r=" ",this._formatDelimitedString(e,t,r,s)):this._formatNumberFromString(e,s)}}return e}_getFieldInfo(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let i;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r&&e.fieldName.toLowerCase()!==r.replace(/ /g,"_")||(i=e,0)))),i}_formatDelimitedString(e,t,r,i){return e&&t&&r&&i?e.trim().split(t).map((e=>this._formatNumberFromString(e,i))).join(r):e}_formatNumberFromString(e,t){if(!e||!t)return e;const r=Number(e);return isNaN(r)?e:t.format(r)}_processVisibleRastersResponse(e,t){t=t||{};const r=e.value,{templateRRFunctionNames:i,showNoDataRecords:s,returnDomainValues:n,templateFields:a}=t,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",d="string"==typeof r&&r.toLowerCase().indexOf("nodata")>-1,m=[];if(r&&!u&&!d){const e={};e[c]=0,p=[r],u=[new f.Z(this.fullExtent,null,e)]}if(!u)return[];let h,y,g;this._updateResponseFieldNames(u,a),d&&!s&&(u=[]);for(let e=0;e<u.length;e++){if(h=u[e],null!=r&&!d){if(y=p[e],g=this.renderingRule&&l&&l.length>0&&i&&i.length>0&&i.indexOf(this.renderingRule.functionName)>-1?l[i.indexOf(this.renderingRule.functionName)]:r,"nodata"===y.toLowerCase()&&!s)continue;const t="Raster.ItemPixelValue",n="Raster.ServicePixelValue";h.attributes[t]=this._formatAttributeValue(y,t),h.attributes[n]=this._formatAttributeValue(g,n),this._updateFeatureWithMagDirValues(h,y);const a=this.fields&&this.fields.length>0;let u=this.renderingRule&&(0,o.pC)(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:r:g;this.renderingRule||(u=a?y:r),this._updateFeatureWithRasterAttributeTableValues(h,u)}if(h.sourceLayer=this,n&&this._updateFeatureWithDomainValues(h),i&&l&&i.length===l.length)for(let e=0;e<i.length;e++){const t="Raster.ServicePixelValue."+i[e];h.attributes[t]=this._formatAttributeValue(l[e],t)}m.push(u[e])}return m}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||(0,o.pC)(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const l=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));l&&l[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=this._formatAttributeValue(l[0].attributes[t.name],r)}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new le.Z({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new Ne.Z(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:(0,de.Tg)([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.filter((e=>e.code===r))[0];i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;(0,o.pC)(r)&&e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.indexOf("image")>-1,o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.indexOf("mensuration")>-1&&a,supportsDownload:t.indexOf("download")>-1,supportsQuery:t.indexOf("catalog")>-1&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.indexOf("catalog")>-1,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!(null==i||!i.supportsStatistics),supportsOrderBy:!(null==i||!i.supportsOrderBy),supportsDistinct:!(null==i||!i.supportsDistinct),supportsPagination:!(null==i||!i.supportsPagination),supportsStandardizedQueriesOnly:!(null==i||!i.useStandardizedQueries),supportsPercentileStatistics:!(null==i||!i.supportsPercentileStatistics),supportsCentroid:!(null==i||!i.supportsReturningGeometryCentroid),supportsDistance:!(null==i||!i.supportsQueryWithDistance),supportsExtent:!(null==i||!i.supportsReturningQueryExtent),supportsGeometryProperties:!(null==i||!i.supportsReturningGeometryProperties),supportsHavingClause:!(null==i||!i.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return(0,s._)([(0,u.Cb)()],t.prototype,"_functionRasterInfos",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_symbolizer",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"_defaultServiceMosaicRule",void 0),(0,s._)([(0,x.r)("_defaultServiceMosaicRule",["defaultMosaicMethod"])],t.prototype,"readDefaultServiceMosaicRule",null),(0,s._)([(0,u.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"rasterAttributeTableFieldPrefix",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"rasterFunctionNamesIndex",null),(0,s._)([(0,u.Cb)()],t.prototype,"adjustAspectRatio",void 0),(0,s._)([(0,u.Cb)({readOnly:!0}),(0,C.B)("serviceRasterInfo.bandCount")],t.prototype,"bandCount",void 0),(0,s._)([(0,u.Cb)({type:[p.z8],json:{write:!0}})],t.prototype,"bandIds",void 0),(0,s._)([(0,x.r)("bandIds")],t.prototype,"readBandIds",null),(0,s._)([(0,u.Cb)({readOnly:!0,json:{read:!1}})],t.prototype,"capabilities",void 0),(0,s._)([(0,x.r)("service","capabilities",["capabilities","currentVersion","serviceDataType"])],t.prototype,"readCapabilities",null),(0,s._)([(0,u.Cb)({type:Number})],t.prototype,"compressionQuality",void 0),(0,s._)([(0,m.c)("compressionQuality")],t.prototype,"writeCompressionQuality",null),(0,s._)([(0,u.Cb)({type:Number})],t.prototype,"compressionTolerance",void 0),(0,s._)([(0,m.c)("compressionTolerance")],t.prototype,"writeCompressionTolerance",null),(0,s._)([(0,u.Cb)({json:{read:{source:"copyrightText"}}})],t.prototype,"copyright",void 0),(0,s._)([(0,u.Cb)({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],t.prototype,"definitionExpression",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,constructOnly:!0})],t.prototype,"exportImageServiceParameters",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"rasterInfo",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:[oe.Z]})],t.prototype,"fields",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"fieldsIndex",null),(0,s._)([(0,u.Cb)({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],t.prototype,"format",null),(0,s._)([(0,x.r)("service","format",["serviceDataType"])],t.prototype,"readFormat",null),(0,s._)([(0,u.Cb)({type:Ne.Z})],t.prototype,"fullExtent",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"hasMultidimensions",void 0),(0,s._)([(0,u.Cb)({json:{read:{source:"maxImageHeight"}}})],t.prototype,"imageMaxHeight",void 0),(0,s._)([(0,u.Cb)({json:{read:{source:"maxImageWidth"}}})],t.prototype,"imageMaxWidth",void 0),(0,s._)([(0,u.Cb)({type:String,json:{type:se.c.jsonValues,read:se.c.read,write:se.c.write}})],t.prototype,"interpolation",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"minScale",void 0),(0,s._)([(0,x.r)("service","minScale")],t.prototype,"readMinScale",null),(0,s._)([(0,u.Cb)()],t.prototype,"maxScale",void 0),(0,s._)([(0,x.r)("service","maxScale")],t.prototype,"readMaxScale",null),(0,s._)([(0,u.Cb)({type:ie})],t.prototype,"mosaicRule",null),(0,s._)([(0,x.r)("mosaicRule",["mosaicRule","defaultMosaicMethod"])],t.prototype,"readMosaicRule",null),(0,s._)([(0,m.c)("mosaicRule")],t.prototype,"writeMosaicRule",null),(0,s._)([(0,u.Cb)({readOnly:!0}),(0,C.B)("serviceRasterInfo.multidimensionalInfo")],t.prototype,"multidimensionalInfo",void 0),(0,s._)([(0,u.Cb)({json:{type:p.z8}})],t.prototype,"noData",void 0),(0,s._)([(0,m.c)("noData")],t.prototype,"writeNoData",null),(0,s._)([(0,u.Cb)({type:String,json:{type:se.k.jsonValues,read:se.k.read,write:se.k.write}})],t.prototype,"noDataInterpretation",void 0),(0,s._)([(0,u.Cb)({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],t.prototype,"objectIdField",void 0),(0,s._)([(0,x.r)("objectIdField")],t.prototype,"readObjectIdField",null),(0,s._)([(0,u.Cb)({})],t.prototype,"geometryType",void 0),(0,s._)([(0,u.Cb)({})],t.prototype,"typeIdField",void 0),(0,s._)([(0,u.Cb)({})],t.prototype,"types",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"parsedUrl",null),(0,s._)([(0,u.Cb)({readOnly:!0}),(0,C.B)("serviceRasterInfo.pixelSize.x")],t.prototype,"pixelSizeX",void 0),(0,s._)([(0,u.Cb)({readOnly:!0}),(0,C.B)("serviceRasterInfo.pixelSize.y")],t.prototype,"pixelSizeY",void 0),(0,s._)([(0,u.Cb)({type:Function})],t.prototype,"pixelFilter",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"raster",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"viewId",void 0),(0,s._)([(0,u.Cb)({types:g.dr,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:g.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],t.prototype,"renderer",void 0),(0,s._)([(0,x.r)("renderer")],t.prototype,"readRenderer",null),(0,s._)([(0,m.c)("renderer")],t.prototype,"writeRenderer",null),(0,s._)([(0,u.Cb)(S.Oh)],t.prototype,"opacity",void 0),(0,s._)([(0,u.Cb)({readOnly:!0}),(0,C.B)("serviceRasterInfo.attributeTable")],t.prototype,"rasterAttributeTable",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"rasterFields",null),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"rasterFunctionInfos",void 0),(0,s._)([(0,u.Cb)({type:J})],t.prototype,"renderingRule",null),(0,s._)([(0,x.r)("renderingRule",["renderingRule","rasterFunctionInfos"])],t.prototype,"readRenderingRule",null),(0,s._)([(0,m.c)("renderingRule")],t.prototype,"writeRenderingRule",null),(0,s._)([(0,u.Cb)()],t.prototype,"serviceDataType",void 0),(0,s._)([(0,u.Cb)({readOnly:!0,type:ke.Z})],t.prototype,"spatialReference",void 0),(0,s._)([(0,x.r)("spatialReference",["spatialReference","extent"])],t.prototype,"readSpatialReference",null),(0,s._)([(0,u.Cb)({json:{type:He.jsonValues}})],t.prototype,"pixelType",void 0),(0,s._)([(0,x.r)("pixelType")],t.prototype,"readPixelType",null),(0,s._)([(0,m.c)("pixelType")],t.prototype,"writePixelType",null),(0,s._)([(0,u.Cb)({constructOnly:!0,type:ue.Z})],t.prototype,"serviceRasterInfo",void 0),(0,s._)([(0,u.Cb)()],t.prototype,"sourceJSON",void 0),(0,s._)([(0,u.Cb)(S.HQ)],t.prototype,"url",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],t.prototype,"version",void 0),(0,s._)([(0,x.r)("version",["currentVersion","fields","timeInfo"])],t.prototype,"readVersion",null),t=(0,s._)([(0,d.j)("esri.layers.mixins.ArcGISImageService")],t),t};var Ye=r(17287),$e=r(78096),Ke=r(17017),et=r(38009),tt=r(16859),rt=r(34760),it=r(72965),st=r(28294),nt=r(32163);let ot=class extends((0,$e.h)((0,st.n)((0,rt.Q)((0,it.M)((0,et.q)((0,tt.I)(Xe((0,Ke.N)((0,Ye.Y)((0,a.R)(h.Z))))))))))){constructor(...e){super(...e),this.legendEnabled=!0,this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery"}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=(0,o.pC)(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(l.r9).then((()=>this._fetchService(t)))),Promise.resolve(this)}writeOperationalLayerType(e,t,r){var i;const s="vector-field"===(null==(i=this.renderer)?void 0:i.type);t[r]=s?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(e){const t=this.rasterFields,r=this.title,i=new Set;let s=!1,n=!1;this.capabilities&&(s=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,n=s&&("esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType));const o=new Set;s&&(o.add("raster.itempixelvalue"),n&&o.add("raster.magnitude").add("raster.direction"));for(const e of t){const t=e.name.toLowerCase();o.has(t)||t.indexOf("raster.servicepixelvalue.")>-1||i.add(e.name)}return(0,nt.eZ)({fields:t,title:r},{...e,visibleFieldNames:i})}queryFeatures(e,t){return this.queryRasters(e,t).then((e=>{if(null!=e&&e.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryFeatureCount(e,t){return this.queryRasterCount(e,t)}redraw(){this.emit("redraw")}};(0,s._)([(0,u.Cb)(S.rn)],ot.prototype,"legendEnabled",void 0),(0,s._)([(0,u.Cb)({type:["show","hide"]})],ot.prototype,"listMode",void 0),(0,s._)([(0,u.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ot.prototype,"isReference",void 0),(0,s._)([(0,u.Cb)({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],ot.prototype,"operationalLayerType",void 0),(0,s._)([(0,m.c)("web-map","operationalLayerType")],ot.prototype,"writeOperationalLayerType",null),(0,s._)([(0,u.Cb)(S.C_)],ot.prototype,"popupEnabled",void 0),(0,s._)([(0,u.Cb)({type:n.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],ot.prototype,"popupTemplate",void 0),(0,s._)([(0,u.Cb)({readOnly:!0})],ot.prototype,"defaultPopupTemplate",null),(0,s._)([(0,u.Cb)({readOnly:!0,json:{read:!1}})],ot.prototype,"type",void 0),ot=(0,s._)([(0,d.j)("esri.layers.ImageryLayer")],ot);var at=ot},17287:(e,t,r)=>{r.d(t,{Y:()=>u});var i=r(43697),s=r(92604),n=r(70586),o=r(5600),a=(r(80442),r(75215),r(52525)),l=r(66677);const u=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,l.Qc)(this.url);if((0,n.pC)(e)&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,l.Nm)(e,s.Z.getLogger(this.declaredClass)))}};return(0,i._)([(0,o.Cb)()],t.prototype,"title",null),(0,i._)([(0,o.Cb)({type:String})],t.prototype,"url",null),t=(0,i._)([(0,a.j)("esri.layers.mixins.ArcGISService")],t),t}},28294:(e,t,r)=>{r.d(t,{n:()=>d});var i=r(43697),s=r(92835),n=r(84552),o=r(5600),a=(r(80442),r(75215),r(92604),r(71715)),l=r(52525),u=r(30547),p=r(69165),c=r(78981);const d=e=>{let t=class extends e{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,s=c.v.fromJSON(r.timeOffsetUnits);return i&&s?new n.Z({value:i,unit:s}):null}set timeInfo(e){(0,p.UF)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,o.Cb)({type:s.Z,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,o.Cb)({type:n.Z})],t.prototype,"timeOffset",void 0),(0,i._)([(0,a.r)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,o.Cb)({value:null,type:u.Z,json:{write:!0,origins:{"web-document":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,o.Cb)({type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation"},origins:{"web-scene":{read:!1,write:!1}}}})],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,l.j)("esri.layers.mixins.TemporalLayer")],t),t}},30547:(e,t,r)=>{r.d(t,{Z:()=>b});var i,s=r(43697),n=r(92835),o=r(84552),a=r(10736),l=r(22974),u=r(70586),p=r(5600),c=(r(75215),r(80442),r(92604),r(71715)),d=r(52525),m=r(30556);let h=i=class extends a.wq{constructor(e){super(e),this.respectsDaylightSaving=!1,this.timezone=null}readRespectsDaylightSaving(e,t){return void 0!==t.respectsDaylightSaving?t.respectsDaylightSaving:void 0!==t.respectDaylightSaving&&t.respectDaylightSaving}clone(){const{respectsDaylightSaving:e,timezone:t}=this;return new i({respectsDaylightSaving:e,timezone:t})}};(0,s._)([(0,p.Cb)({type:Boolean,json:{write:!0}})],h.prototype,"respectsDaylightSaving",void 0),(0,s._)([(0,c.r)("respectsDaylightSaving",["respectsDaylightSaving","respectDaylightSaving"])],h.prototype,"readRespectsDaylightSaving",null),(0,s._)([(0,p.Cb)({type:String,json:{read:{source:"timeZone"},write:{target:"timeZone"}}})],h.prototype,"timezone",void 0),h=i=(0,s._)([(0,d.j)("esri.layers.support.TimeReference")],h);var y,f=h,g=r(78981);let v=y=class extends a.wq{constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeReference=null,this.trackIdField=null,this.useTime=!0}readFullTimeExtent(e,t){if(!t.timeExtent||!Array.isArray(t.timeExtent)||2!==t.timeExtent.length)return null;const r=new Date(t.timeExtent[0]),i=new Date(t.timeExtent[1]);return new n.Z({start:r,end:i})}writeFullTimeExtent(e,t){e&&(0,u.pC)(e.start)&&(0,u.pC)(e.end)?t.timeExtent=[e.start.getTime(),e.end.getTime()]:t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?new o.Z({value:t.timeInterval,unit:g.v.fromJSON(t.timeIntervalUnits)}):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?new o.Z({value:t.defaultTimeInterval,unit:g.v.fromJSON(t.defaultTimeIntervalUnits)}):null}writeInterval(e,t){if(e){const r=e.toJSON();t.timeInterval=r.value,t.timeIntervalUnits=r.unit}else t.timeInterval=null,t.timeIntervalUnits=null}clone(){const{cumulative:e,endField:t,hasLiveData:r,interval:i,startField:s,timeReference:n,fullTimeExtent:o,trackIdField:a,useTime:u}=this;return new y({cumulative:e,endField:t,hasLiveData:r,interval:i,startField:s,timeReference:(0,l.d9)(n),fullTimeExtent:(0,l.d9)(o),trackIdField:a,useTime:u})}};(0,s._)([(0,p.Cb)({type:Boolean,json:{read:{source:"exportOptions.timeDataCumulative"},write:{target:"exportOptions.timeDataCumulative"}}})],v.prototype,"cumulative",void 0),(0,s._)([(0,p.Cb)({type:String,json:{read:{source:"endTimeField"},write:{target:"endTimeField",allowNull:!0}}})],v.prototype,"endField",void 0),(0,s._)([(0,p.Cb)({type:n.Z,json:{write:{enabled:!0,allowNull:!0}}})],v.prototype,"fullTimeExtent",void 0),(0,s._)([(0,c.r)("fullTimeExtent",["timeExtent"])],v.prototype,"readFullTimeExtent",null),(0,s._)([(0,m.c)("fullTimeExtent")],v.prototype,"writeFullTimeExtent",null),(0,s._)([(0,p.Cb)({type:Boolean,json:{write:!0}})],v.prototype,"hasLiveData",void 0),(0,s._)([(0,p.Cb)({type:o.Z,json:{write:{enabled:!0,allowNull:!0}}})],v.prototype,"interval",void 0),(0,s._)([(0,c.r)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],v.prototype,"readInterval",null),(0,s._)([(0,m.c)("interval")],v.prototype,"writeInterval",null),(0,s._)([(0,p.Cb)({type:String,json:{read:{source:"startTimeField"},write:{target:"startTimeField",allowNull:!0}}})],v.prototype,"startField",void 0),(0,s._)([(0,p.Cb)({type:f,json:{write:{enabled:!0,allowNull:!0}}})],v.prototype,"timeReference",void 0),(0,s._)([(0,p.Cb)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],v.prototype,"trackIdField",void 0),(0,s._)([(0,p.Cb)({type:Boolean,json:{read:{source:"exportOptions.useTime"},write:{target:"exportOptions.useTime"}}})],v.prototype,"useTime",void 0),v=y=(0,s._)([(0,d.j)("esri.layers.support.TimeInfo")],v);var b=v},66677:(e,t,r)=>{r.d(t,{ld:()=>h,B5:()=>c,M8:()=>f,G:()=>w,Qc:()=>d,DR:()=>m,Nm:()=>g,XG:()=>v,a7:()=>y,wH:()=>b});var i=r(70586),s=r(17452),n=r(25929);const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},a=Object.values(o),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),p=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function c(e){return!!l.test(e)}function d(e){const t=(0,s.mN)(e),r=t.path.match(l)||t.path.match(u);if(!r)return null;const[,i,n,a,p]=r,c=n.indexOf("/");return{title:h(-1!==c?n.slice(c+1):n),serverType:o[a.toLowerCase()],sublayer:null!=p&&""!==p?parseInt(p,10):null,url:{path:i}}}function m(e){const t=(0,s.mN)(e).path.match(p);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function h(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function y(e,t){const r=[];if(e){const t=d(e);(0,i.pC)(t)&&t.title&&r.push(t.title)}if(t){const e=h(t);r.push(e)}if(2===r.length){if(-1!==r[0].toLowerCase().indexOf(r[1].toLowerCase()))return r[0];if(-1!==r[1].toLowerCase().indexOf(r[0].toLowerCase()))return r[1]}return r.join(" - ")}function f(e){if(!e)return!1;const t=-1!==(e=e.toLowerCase()).indexOf(".arcgis.com/"),r=-1!==e.indexOf("//services")||-1!==e.indexOf("//tiles")||-1!==e.indexOf("//features");return t&&r}function g(e,t){return e?(0,s.Qj)((0,s.Hu)(e,t)):e}function v(e){let{url:t}=e;if(!t)return{url:t};t=(0,s.Hu)(t,e.logger);const r=(0,s.mN)(t),n=d(r.path);let o;if((0,i.pC)(n))null!=n.sublayer&&null==e.layer.layerId&&(o=n.sublayer),t=n.url.path;else if(e.nonStandardUrlAllowed){const e=m(r.path);(0,i.pC)(e)&&(t=e.serviceUrl,o=e.sublayerId)}return{url:(0,s.Qj)(t),layerId:o}}function b(e,t,r,i,o){(0,n.w)(t,i,"url",o),i.url&&null!=e.layerId&&(i.url=(0,s.v_)(i.url,r,e.layerId.toString()))}function w(e){if(!e)return!1;const t=e.toLowerCase(),r=-1!==t.indexOf("/services/"),i=-1!==t.indexOf("/mapserver/wmsserver"),s=-1!==t.indexOf("/imageserver/wmsserver"),n=-1!==t.indexOf("/wmsserver");return r&&(i||s||n)}},78981:(e,t,r)=>{r.d(t,{v:()=>i});const i=(0,r(35454).wY)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},99282:(e,t,r)=>{r.d(t,{a:()=>n});var i=r(67900),s=r(68441);const n={inches:(0,i.En)(1,"meters","inches"),feet:(0,i.En)(1,"meters","feet"),"us-feet":(0,i.En)(1,"meters","us-feet"),yards:(0,i.En)(1,"meters","yards"),miles:(0,i.En)(1,"meters","miles"),"nautical-miles":(0,i.En)(1,"meters","nautical-miles"),millimeters:(0,i.En)(1,"meters","millimeters"),centimeters:(0,i.En)(1,"meters","centimeters"),decimeters:(0,i.En)(1,"meters","decimeters"),meters:(0,i.En)(1,"meters","meters"),kilometers:(0,i.En)(1,"meters","kilometers"),"decimal-degrees":1/(0,i.ty)(1,"meters",s.sv.radius)}},28694:(e,t,r)=>{r.d(t,{p:()=>s});var i=r(50459);function s(e,t,r){if(!r||!r.features||!r.hasZ)return;const s=(0,i.k)(r.geometryType,t,e.outSpatialReference);if(s)for(const e of r.features)s(e.geometry)}},50459:(e,t,r)=>{r.d(t,{k:()=>o,P:()=>l});var i=r(70586),s=r(67900),n=r(8744);function o(e,t,r){if((0,i.Wi)(t)||(0,i.Wi)(r)||r.vcsWkid||(0,n.fS)(t,r))return null;const o=(0,s._R)(t)/(0,s._R)(r);if(1===o)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,o);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const r of e.paths)for(const e of r)e.length>2&&(e[2]*=t)}(e,o);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const r of e.rings)for(const e of r)e.length>2&&(e[2]*=t)}(e,o);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const r of e.points)r.length>2&&(r[2]*=t)}(e,o);default:return null}}function a(e,t,r){if(null==e.hasM||e.hasZ)for(const e of t)for(const t of e)t.length>2&&(t[2]*=r)}function l(e,t,r){if(!e&&!t||!r)return;const i=(0,s._R)(r);u(e,r,i),u(t,r,i)}function u(e,t,r){if(e)for(const i of e)p(i.geometry,t,r)}function p(e,t,r){if((0,i.Wi)(e)||!e.spatialReference||(0,n.fS)(e.spatialReference,t))return;const o=(0,s._R)(e.spatialReference)/r;if(1!==o)if("x"in e)null!=e.z&&(e.z*=o);else if("rings"in e)a(e,e.rings,o);else if("paths"in e)a(e,e.paths,o);else if("points"in e&&(null==e.hasM||e.hasZ))for(const t of e.points)t.length>2&&(t[2]*=o)}},56545:(e,t,r)=>{r.d(t,{Z:()=>d});var i,s=r(43697),n=r(10736),o=r(22974),a=r(5600),l=r(75215),u=(r(80442),r(92604),r(52525)),p=r(30556);let c=i=class extends n.wq{constructor(e){super(e),this.attachmentTypes=null,this.attachmentsWhere=null,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new i((0,o.d9)({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};(0,s._)([(0,a.Cb)({type:[String],json:{write:!0}})],c.prototype,"attachmentTypes",void 0),(0,s._)([(0,a.Cb)({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],c.prototype,"attachmentsWhere",void 0),(0,s._)([(0,a.Cb)({type:[String],json:{write:!0}})],c.prototype,"keywords",void 0),(0,s._)([(0,a.Cb)({type:[Number],json:{write:!0}})],c.prototype,"globalIds",void 0),(0,s._)([(0,a.Cb)({json:{write:!0}})],c.prototype,"name",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{read:{source:"resultRecordCount"}}})],c.prototype,"num",void 0),(0,s._)([(0,a.Cb)({type:[Number],json:{write:!0}})],c.prototype,"objectIds",void 0),(0,s._)([(0,a.Cb)({type:Boolean,json:{default:!1,write:!0}})],c.prototype,"returnMetadata",void 0),(0,s._)([(0,a.Cb)({type:[Number],json:{write:!0}})],c.prototype,"size",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{read:{source:"resultOffset"}}})],c.prototype,"start",void 0),(0,s._)([(0,p.c)("start"),(0,p.c)("num")],c.prototype,"writeStart",null),(0,s._)([(0,a.Cb)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],c.prototype,"where",void 0),c=i=(0,s._)([(0,u.j)("esri.rest.support.AttachmentQuery")],c),c.from=(0,l.se)(c);var d=c},75935:(e,t,r)=>{r.d(t,{Z:()=>h});var i,s=r(43697),n=(r(66577),r(10736)),o=r(22974),a=r(5600),l=r(75215),u=(r(80442),r(92604),r(52525)),p=r(30556),c=r(10158),d=r(82971);let m=i=class extends n.wq{constructor(e){super(e),this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(e,t){t.historicMoment=e&&e.getTime()}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10,t.where="1=1"}clone(){return new i((0,o.d9)({dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};(0,s._)([(0,a.Cb)({type:c.n,json:{write:!0}})],m.prototype,"dynamicDataSource",void 0),(0,s._)([(0,a.Cb)({type:String,json:{write:!0}})],m.prototype,"gdbVersion",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{write:!0}})],m.prototype,"geometryPrecision",void 0),(0,s._)([(0,a.Cb)({type:Date})],m.prototype,"historicMoment",void 0),(0,s._)([(0,p.c)("historicMoment")],m.prototype,"_writeHistoricMoment",null),(0,s._)([(0,a.Cb)({type:Number,json:{write:!0}})],m.prototype,"maxAllowableOffset",void 0),(0,s._)([(0,a.Cb)({type:[Number],json:{write:!0}})],m.prototype,"objectIds",void 0),(0,s._)([(0,a.Cb)({type:[String],json:{write:!0}})],m.prototype,"orderByFields",void 0),(0,s._)([(0,a.Cb)({type:[String],json:{write:!0}})],m.prototype,"outFields",void 0),(0,s._)([(0,a.Cb)({type:d.Z,json:{read:{source:"outSR"},write:{target:"outSR"}}})],m.prototype,"outSpatialReference",void 0),(0,s._)([(0,a.Cb)({json:{write:!0}})],m.prototype,"relationshipId",void 0),(0,s._)([(0,a.Cb)({type:Number,json:{read:{source:"resultOffset"}}})],m.prototype,"start",void 0),(0,s._)([(0,p.c)("start"),(0,p.c)("num")],m.prototype,"writeStart",null),(0,s._)([(0,a.Cb)({type:Number,json:{read:{source:"resultRecordCount"}}})],m.prototype,"num",void 0),(0,s._)([(0,a.Cb)({json:{write:!0}})],m.prototype,"returnGeometry",void 0),(0,s._)([(0,a.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"returnM",void 0),(0,s._)([(0,a.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"returnZ",void 0),(0,s._)([(0,a.Cb)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],m.prototype,"where",void 0),m=i=(0,s._)([(0,u.j)("esri.rest.support.RelationshipQuery")],m),m.from=(0,l.se)(m);var h=m},28141:(e,t,r)=>{r.d(t,{Z:()=>R});var i,s=r(43697),n=r(66577),o=r(92835),a=r(35454),l=r(10736),u=r(22974),p=r(5600),c=r(75215),d=(r(80442),r(92604),r(52525)),m=r(30556),h=r(33955);let y=i=class extends l.wq{constructor(e){super(e),this.groupByFields=void 0,this.topCount=void 0,this.orderByFields=void 0}clone(){return new i({groupByFields:this.groupByFields,topCount:this.topCount,orderByFields:this.orderByFields})}};(0,s._)([(0,p.Cb)({type:[String],json:{write:!0}})],y.prototype,"groupByFields",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{write:!0}})],y.prototype,"topCount",void 0),(0,s._)([(0,p.Cb)({type:[String],json:{write:!0}})],y.prototype,"orderByFields",void 0),y=i=(0,s._)([(0,d.j)("esri.rest.support.TopFilter")],y);var f,g=y,v=r(82971);const b=new a.Xn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),w=new a.Xn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let _=f=class extends l.wq{constructor(e){super(e),this.cacheHint=void 0,this.distance=void 0,this.geometry=null,this.geometryPrecision=void 0,this.maxAllowableOffset=void 0,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.resultType=null,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.start=void 0,this.spatialRelationship="intersects",this.timeExtent=null,this.topFilter=void 0,this.units=null,this.where="1=1"}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new f((0,u.d9)({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))}};(0,s._)([(0,p.Cb)({type:Boolean,json:{write:!0}})],_.prototype,"cacheHint",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],_.prototype,"distance",void 0),(0,s._)([(0,p.Cb)({types:n.qM,json:{read:h.im,write:!0}})],_.prototype,"geometry",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{write:!0}})],_.prototype,"geometryPrecision",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{write:!0}})],_.prototype,"maxAllowableOffset",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{read:{source:"resultRecordCount"}}})],_.prototype,"num",void 0),(0,s._)([(0,p.Cb)({json:{write:!0}})],_.prototype,"objectIds",void 0),(0,s._)([(0,p.Cb)({type:[String],json:{write:!0}})],_.prototype,"orderByFields",void 0),(0,s._)([(0,p.Cb)({type:[String],json:{write:!0}})],_.prototype,"outFields",void 0),(0,s._)([(0,p.Cb)({type:v.Z,json:{read:{source:"outSR"},write:{target:"outSR"}}})],_.prototype,"outSpatialReference",void 0),(0,s._)([(0,p.Cb)({type:String,json:{write:!0}})],_.prototype,"resultType",void 0),(0,s._)([(0,p.Cb)({json:{write:!0}})],_.prototype,"returnGeometry",void 0),(0,s._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"returnM",void 0),(0,s._)([(0,p.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"returnZ",void 0),(0,s._)([(0,p.Cb)({type:Number,json:{read:{source:"resultOffset"}}})],_.prototype,"start",void 0),(0,s._)([(0,m.c)("start"),(0,m.c)("num")],_.prototype,"writeStart",null),(0,s._)([(0,p.Cb)({type:String,json:{read:{source:"spatialRel",reader:b.read},write:{target:"spatialRel",writer:b.write}}})],_.prototype,"spatialRelationship",void 0),(0,s._)([(0,p.Cb)({type:o.Z,json:{write:!0}})],_.prototype,"timeExtent",void 0),(0,s._)([(0,p.Cb)({type:g,json:{write:!0}})],_.prototype,"topFilter",void 0),(0,s._)([(0,p.Cb)({type:String,json:{read:w.read,write:{writer:w.write,overridePolicy(e){return{enabled:e&&this.distance>0}}}}})],_.prototype,"units",void 0),(0,s._)([(0,p.Cb)({type:String,json:{write:!0}})],_.prototype,"where",void 0),_=f=(0,s._)([(0,d.j)("esri.rest.support.TopFeaturesQuery")],_),_.from=(0,c.se)(_);var R=_}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1637],{92835:(e,t,i)=>{i.d(t,{Z:()=>p});var r,n=i(43697),s=i(10736),a=i(70586),o=i(35463),l=i(5600),u=(i(80442),i(75215),i(92604),i(71715)),c=i(52525),h=i(30556);let f=r=class extends s.wq{constructor(e){super(e),this.end=null,this.start=null}static get allTime(){return d}static get empty(){return m}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(r.allTime)}get isEmpty(){return this.equals(r.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 r({end:this.end,start:this.start})}equals(e){if(!e)return!1;const t=(0,a.pC)(this.start)?this.start.getTime():this.start,i=(0,a.pC)(this.end)?this.end.getTime():this.end,r=(0,a.pC)(e.start)?e.start.getTime():e.start,n=(0,a.pC)(e.end)?e.end.getTime():e.end;return t===r&&i===n}expandTo(e){if(this.isEmpty||this.isAllTime)return this.clone();const t=(0,a.Po)(this.start,(t=>(0,o.JE)(t,e))),i=(0,a.Po)(this.end,(t=>(0,o.Nm)((0,o.JE)(t,e),1,e)));return new r({start:t,end:i})}intersection(e){if(!e)return this.clone();if(this.isEmpty||e.isEmpty)return r.empty;if(this.isAllTime)return e.clone();if(e.isAllTime)return this.clone();const t=(0,a.R2)(this.start,-1/0,(e=>e.getTime())),i=(0,a.R2)(this.end,1/0,(e=>e.getTime())),n=(0,a.R2)(e.start,-1/0,(e=>e.getTime())),s=(0,a.R2)(e.end,1/0,(e=>e.getTime()));let o,l;if(n>=t&&n<=i?o=n:t>=n&&t<=s&&(o=t),i>=n&&i<=s?l=i:s>=t&&s<=i&&(l=s),!isNaN(o)&&!isNaN(l)){const e=new r;return e.start=o===-1/0?null:new Date(o),e.end=l===1/0?null:new Date(l),e}return r.empty}offset(e,t){if(this.isEmpty||this.isAllTime)return this.clone();const i=new r,{start:n,end:s}=this;return(0,a.pC)(n)&&(i.start=(0,o.Nm)(n,e,t)),(0,a.pC)(s)&&(i.end=(0,o.Nm)(s,e,t)),i}union(e){if(!e||e.isEmpty)return this.clone();if(this.isEmpty)return e.clone();if(this.isAllTime||e.isAllTime)return d.clone();const t=(0,a.pC)(this.start)&&(0,a.pC)(e.start)?new Date(Math.min(this.start.getTime(),e.start.getTime())):null,i=(0,a.pC)(this.end)&&(0,a.pC)(e.end)?new Date(Math.max(this.end.getTime(),e.end.getTime())):null;return new r({start:t,end:i})}};(0,n._)([(0,l.Cb)({type:Date,json:{write:{allowNull:!0}}})],f.prototype,"end",void 0),(0,n._)([(0,u.r)("end")],f.prototype,"readEnd",null),(0,n._)([(0,h.c)("end")],f.prototype,"writeEnd",null),(0,n._)([(0,l.Cb)({readOnly:!0,json:{read:!1}})],f.prototype,"isAllTime",null),(0,n._)([(0,l.Cb)({readOnly:!0,json:{read:!1}})],f.prototype,"isEmpty",null),(0,n._)([(0,l.Cb)({type:Date,json:{write:{allowNull:!0}}})],f.prototype,"start",void 0),(0,n._)([(0,u.r)("start")],f.prototype,"readStart",null),(0,n._)([(0,h.c)("start")],f.prototype,"writeStart",null),f=r=(0,n._)([(0,c.j)("esri.TimeExtent")],f);const d=new f,m=new f({start:void 0,end:void 0});var p=f},13867:(e,t,i)=>{i.d(t,{Z:()=>n});var r=i(69801);class n{constructor(e,t){this._storage=new r.WJ,this._storage.maxSize=e,t&&this._storage.registerRemoveFunc("",t)}put(e,t,i){this._storage.put(e,t,i,1)}pop(e){return this._storage.pop(e)}get(e){return this._storage.get(e)}clear(){this._storage.clearAll()}destroy(){this._storage.destroy()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}}},35463:(e,t,i)=>{i.d(t,{rJ:()=>o,Nm:()=>s,JE:()=>a}),i(80442);const r={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 s(e,t,i){const r=new Date(e.getTime());if(t&&i){const e=n[i],{getter:s,setter:a,multiplier:o}=e;r[a](r[s]()+t*o)}return r}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*r[t]/r[i]}},91384:(e,t,i)=>{i.r(t),i.d(t,{default:()=>wt});var r=i(43697),n=i(51773),s=i(30030),a=i(20102),o=i(70586),l=i(16453),u=i(95330),c=i(5600),h=(i(80442),i(75215)),f=i(92604),d=i(36030),m=i(71715),p=i(52525),y=i(29600),g=i(78096),x=i(17017),w=(i(66577),i(3172)),v=i(44422),b=i(8744),I=i(66677),C=i(21506),_=i(35956),T=i(88281),R=i(11145),S=i(80676),M=i(77982),k=i(91219),F=i(6570),P=i(82971);const D=f.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),O=e=>{let t=class extends e{constructor(){super(...arguments),this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.fullExtent=null,this.interpolation="nearest",this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.tileInfo=null,this.symbolizer=null}set multidimensionalDefinition(e){this.raster&&(this._sliceId=this.raster.getSliceIndex(e)),this._set("multidimensionalDefinition",e)}set url(e){this._set("url",(0,I.Nm)(e,D))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async convertVectorFieldData(e,t){if((0,o.Wi)(e))return null;const i=this._rasterJobHandler.instance,r=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:r},t):(0,S.KC)(e,r)}async updateRenderer(){if(!this.loaded)return;if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(this.renderer))return;const e=this._rasterJobHandler.instance;e&&(this.symbolizer.rendererJSON=(0,M.ol)(this.renderer.toJSON()),this.symbolizer.bind(),await e.updateSymbolizer(this.symbolizer),this._cachedRendererJson=this.renderer.toJSON())}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!((0,o.pC)(i)&&i.pixels&&i.pixels.length>0))return null;let r;await this.updateRenderer();const n=this._rasterJobHandler.instance,{bandIds:s}=this;return r=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),r}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const r=(0,b.C5)(e);return R.Z.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.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,r={}){if(r.requestAsImageElement){const n=this.getTileUrl(e,t,i);return(0,w.default)(n,{responseType:"image",query:{sliceId:this._sliceId,...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:r.signal}).then((e=>e.data))}await this._initJobHandler();const n="raster-shaded-relief"===this.renderer.type?{cols:1,rows:1}:null;if(this.multidimensionalDefinition){const e=this._sliceId;r={multidimensionalDefinition:this.multidimensionalDefinition,sliceId:e,buffer:n,...r}}return this.raster.fetchTile(e,t,i,r)}async fetchPixels(e,t,i,r){if(await this._initJobHandler(),this.multidimensionalDefinition){const e=this._sliceId;r={multidimensionalDefinition:this.multidimensionalDefinition,sliceId:e,...r}}return this.raster.fetchPixels(e,t,i,r)}identify(e,t={}){return this.multidimensionalDefinition&&!t.multidimensionalDefinition&&(t={...t,multidimensionalDefinition:this.multidimensionalDefinition}),this.raster.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){var e;const t=this.rasterInfo.multidimensionalInfo;if(!(0,o.pC)(t)||"standard-time"!==this.rasterInfo.dataType)return!1;const i=null==(e=this.multidimensionalDefinition[0])?void 0:e.variableName;return t.variables.some((e=>e.name===i&&e.dimensions.some((e=>"StdTime"===e.name))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}_configDefaultSettings(){this._configDefaultInterpolation(),this._configDefaultSlice(),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new T.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,this.renderer&&this.updateRenderer()})).catch((()=>null)),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this.raster.rasterJobHandler=null}_configDefaultInterpolation(){if(null==this.interpolation){var e;const t=(0,M.In)(this.rasterInfo,this.raster.tileType,null==(e=this.sourceJSON)?void 0:e.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultSlice(){const{multidimensionalInfo:e}=this.raster.rasterInfo;if((0,o.pC)(e)){if(!this.multidimensionalDefinition){const t=e.variables[0],i=[];t.dimensions.forEach((e=>{i.push(new _.Z({variableName:t.name,dimensionName:e.name,values:e.hasRegularIntervals?e.extent[0]:e.values[0],isSlice:!0}))})),this.multidimensionalDefinition=i}this._sliceId=this.raster.getSliceIndex(this.multidimensionalDefinition)}}_configDefaultRenderer(){const e=this.raster.rasterInfo;var t,i;this.bandIds||(this.bandIds=(0,M.YD)(e)),this.renderer||(this.renderer=(0,M.Ob)(e,{bandIds:this.bandIds,variableName:null==(t=this.multidimensionalDefinition)||null==(i=t[0])?void 0:i.variableName})),this.symbolizer?(this.symbolizer.rendererJSON=(0,M.ol)(this.renderer.toJSON()),this.symbolizer.rasterInfo=e):this.symbolizer=new k.Z({rendererJSON:this.renderer.toJSON(),rasterInfo:e}),this.symbolizer.bind()||D.warn("imagery-tile-mixin","The given renderer is not supported by the layer.")}};return(0,r._)([(0,c.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"_sliceId",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"bandIds",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"copyright",void 0),(0,r._)([(0,c.Cb)({type:F.Z}),(0,v.B)("rasterInfo.extent")],t.prototype,"fullExtent",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"interpolation",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"ioConfig",void 0),(0,r._)([(0,c.Cb)({type:[_.Z]})],t.prototype,"multidimensionalDefinition",null),(0,r._)([(0,c.Cb)()],t.prototype,"raster",void 0),(0,r._)([(0,c.Cb)({readOnly:!0}),(0,v.B)("raster.rasterInfo")],t.prototype,"rasterInfo",void 0),(0,r._)([(0,c.Cb)()],t.prototype,"sourceJSON",void 0),(0,r._)([(0,c.Cb)({type:P.Z}),(0,v.B)("rasterInfo.spatialReference")],t.prototype,"spatialReference",void 0),(0,r._)([(0,c.Cb)({type:R.Z}),(0,v.B)("rasterInfo.storageInfo.tileInfo")],t.prototype,"tileInfo",void 0),(0,r._)([(0,c.Cb)(C.HQ)],t.prototype,"url",null),(0,r._)([(0,c.Cb)({types:s.dr})],t.prototype,"renderer",null),(0,r._)([(0,c.Cb)()],t.prototype,"symbolizer",void 0),t=(0,r._)([(0,p.j)("esri.layers.ImageryTileMixin")],t),t};var B=i(38009),z=i(16859),N=i(34760),E=i(72965),Z=i(1231),A=i(69608),H=i(48526),L=i(36679),J=i(10736),W=i(609),j=i(67900),q=i(42894),G=i(40488),U=i(13473);const Y=5e-4,V=function(e,t){const i=(e.isWGS84||e.isWebMercator)&&(t.isWGS84||t.isWebMercator);return!(e.equals(t)||i)},$={3395:20037508.342789244,3410:17334193.943686873,3832:3339584.723798206,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,8858:7396237.374497803,8859:2465412.4581659334,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53025:7276828.3848298555,53031:10384677.558821043,53034:20015086.79602057,53036:7389443.187332862,53037:2463147.729110953,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54025:7311399.09166516,54031:10396310.810074743,54034:20037508.342789244,54050:808820.9223376509,54053:1920897.3915568967,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244,102038:4297258.582585486,102299:5013965.117483125};function X(e,t,i,r=null){if(e.spatialReference.equals(t))return e;const n=V(e.spatialReference,t);if(n&&!(0,q.kR)())throw new a.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");const s=i.center,l=new F.Z({xmin:s.x-e.x/2,xmax:s.x+e.x/2,ymin:s.y-e.y/2,ymax:s.y+e.y/2,spatialReference:e.spatialReference}),u=n?(0,q.iV)(l,t,r):(0,G.iV)(l,t);return(0,o.Wi)(u)?null:{x:u.xmax-u.xmin,y:u.ymax-u.ymin}}function K(e,t=.01){return(0,j.c9)(e)?t/(0,j.c9)(e):0}function Q(e,t,i=null,r=!0){const n=e.spatialReference;if(n.equals(t))return e;let s=(0,G.iV)(e,t);if((0,o.Wi)(s)){if(!(0,q.kR)())throw new a.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");s=(0,q.iV)(e,t,i)}if(r&&t.isGeographic){const[t,i]=ne(n,!0),r=K(n);r&&null!=t&&null!=i&&(Math.abs(e.x-t)<r&&Math.abs(180-s.x)<Y?s.x-=360:Math.abs(e.x-i)<r&&Math.abs(180+s.x)<Y&&(s.x+=360))}return s}function ee(e){const t=re(e[0].spatialReference);if(e.length<2||!(0,o.pC)(t))return e[0];let{xmin:i,xmax:r,ymin:n,ymax:s}=e[0];for(let i=1;i<e.length;i++){const a=e[i];r=a.xmax+t*i,n=Math.min(n,a.ymin),s=Math.max(s,a.ymax)}return new F.Z({xmin:i,xmax:r,ymin:n,ymax:s,spatialReference:e[0].spatialReference})}function te(e,t,i=null,r=!0){if(e.spatialReference.equals(t))return e;const n=ae(e),s=re(e.spatialReference,!0);return(0,o.pC)(s)&&0!==n?ee(e.clone().normalize().map((e=>ie(e,t,i,r)))):ie(e,t,i,r)}function ie(e,t,i=null,r=!0){const n=e.spatialReference;if(n.equals(t))return e;if(V(n,t)&&!(0,q.kR)())throw new a.Z("rasterprojectionhelper-projectExtent","projection engine is not loaded");let s=(0,G.iV)(e,t);(0,o.Wi)(s)&&(s=(0,q.iV)(e,t,i));let[l,u]=ne(n,!0);if(s&&r&&n.isWebMercator&&t.isGeographic&&null!=l&&null!=u){const r=.001,a=1e3;if(Math.abs(e.xmin-l)<r&&Math.abs(u-e.xmax)>a&&Math.abs(180-s.xmax)<Y){s.xmin=-180;const r=[];r.push(new U.Z(e.xmax,e.ymin,n)),r.push(new U.Z(e.xmax,(e.ymin+e.ymax)/2,n)),r.push(new U.Z(e.xmax,e.ymax,n));const a=r.map((e=>Q(e,t,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));s.xmax=Math.max.apply(null,a)}if(Math.abs(e.xmax-u)<r&&Math.abs(l-e.xmin)>a&&Math.abs(180+s.xmin)<Y){s.xmax=180;const r=[];r.push(new U.Z(e.xmin,e.ymin,n)),r.push(new U.Z(e.xmin,(e.ymin+e.ymax)/2,n)),r.push(new U.Z(e.xmin,e.ymax,n));const a=r.map((e=>Q(e,t,i))).filter((e=>!isNaN(null==e?void 0:e.x))).map((e=>e.x));s.xmin=Math.min.apply(null,a)}}[l,u]=ne(t,!0);const c=K(t);return c&&null!=l&&null!=u&&(Math.abs(s.xmin-l)<c&&(s.xmin=l),Math.abs(s.xmax-u)<c&&(s.xmax=u)),s}function re(e,t=!1){const i=t?20037508.342787:20037508.342788905;return e.isWebMercator?2*i:e.wkid&&e.isGeographic?360:2*$[e.wkid]||null}function ne(e,t=!1){const i=[],r=re(e,t);return(0,o.pC)(r)&&(i.push(-r/2),i.push(r/2)),i}function se(e,t,i,r){let n=(e-t)/i;return n-Math.floor(n)!=0?n=Math.floor(n):r&&(n-=1),n}function ae(e,t=!1){const i=re(e.spatialReference);if(!(0,o.pC)(i))return 0;const r=t?0:-i/2;return se(e.xmax,r,i,!0)-se(e.xmin,r,i,!1)}function oe(e,t,i,r=null,n=null,s=!1,l=[32,32]){if(V(e.spatialReference,t.spatialReference)&&!(0,q.kR)())throw new a.Z("rasterprojectionhelper-projectResolution","projection engine is not loaded");if(!(e&&t&&i))return null;const{xmin:u,ymin:c,xmax:h,ymax:f}=e,d=e.spatialReference,m=t.spatialReference,p=re(m);s=s||"gcs-shift"===(null==n?void 0:n.type);const y={x:l[0]*i.x,y:l[1]*i.y},g={cols:Math.ceil((h-u)/y.x-.1/l[0])+1,rows:Math.ceil((f-c)/y.y-.1/l[1])+1},x=y.x,w=y.y,v=[];let b,I=!1;for(let e=0;e<g.cols;e++){const i=[];for(let a=0;a<g.rows;a++){let l=Q(new U.Z({x:u+x*e,y:f-w*a,spatialReference:d}),m,r);n&&(l=n.inverseTransform(l)),i.push(l),e>0&&s&&l&&b[a]&&(0,o.pC)(p)&&l.x<b[a].x&&(l.x+=p),l?(v.push((l.x-t.xmin)/(t.xmax-t.xmin)),v.push((t.ymax-l.y)/(t.ymax-t.ymin))):(v.push(NaN),v.push(NaN),I=!0)}b=i}const C=function(e,t){const i=(e[0]+e[4]+e[4*t.cols]+e[4*t.cols+4])/4,r=(e[1]+e[5]+e[4*t.rows+1]+e[4*t.rows+5])/4;return[Math.abs(i-e[2*t.rows+2]),Math.abs(r-e[2*t.rows+3])]}(v,g),_=new Float32Array((g.cols-1)*(g.rows-1)*2*6),T=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),R=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let e=0;e<g.cols-1;e++){for(let t=0;t<g.rows-1;t++){let i=e*g.rows*2+2*t;const r=v[i],n=v[i+1],s=v[i+2],a=v[i+3];i+=2*g.rows;const o=v[i],l=v[i+1],u=v[i+2],c=v[i+3];let h=0,f=12*(t*(g.cols-1)+e);for(let e=0;e<3;e++)_[f++]=T[h++]*r+T[h++]*s+T[h++]*u;h=0;for(let e=0;e<3;e++)_[f++]=T[h++]*n+T[h++]*a+T[h++]*c;h=0;for(let e=0;e<3;e++)_[f++]=R[h++]*r+R[h++]*o+R[h++]*u;h=0;for(let e=0;e<3;e++)_[f++]=R[h++]*n+R[h++]*l+R[h++]*c}if(I)for(let e=0;e<_.length;e++)isNaN(_[e])&&(_[e]=-1)}return{offsets:v,error:C,coefficients:_,spacing:l,size:[g.cols-1,g.rows-1]}}function le(e,t,i){const{storageInfo:r,pixelSize:n}=t;let s,a=!1;const{pyramidResolutions:l}=r;if((0,o.pC)(l)&&l.length){const r=(e.x+e.y)/2,o=l[l.length-1],u=(o.x+o.y)/2,c=(n.x+n.y)/2;if(r<=c)s=0;else if(r>=u)s=l.length,a=r/u>8;else{let e,t=c;for(let n=1;n<=l.length;n++){if(e=(l[n-1].x+l[n-1].y)/2,r<=e){r===e?s=n:"down"===i?(s=n-1,a=r/t>8):s="up"===i||r-t>e-r||r/t>2?n:n-1;break}t=e}}const h=0===s?n:l[s-1];return{pyramidLevel:s,pyramidResolution:new U.Z({x:h.x,y:h.y,spatialReference:t.spatialReference}),excessiveReading:a}}const u=Math.log(e.x/n.x)/Math.LN2,c=Math.log(e.y/n.y)/Math.LN2,h=t.storageInfo.maximumPyramidLevel||0;s="down"===i?Math.floor(Math.min(u,c)):"up"===i?Math.ceil(Math.max(u,c)):Math.round((u+c)/2),s<0?s=0:s>h&&(a=s>h+3,s=h);const f=2**s;return{pyramidLevel:s,pyramidResolution:new U.Z({x:f*t.nativePixelSize.x,y:f*t.nativePixelSize.y,spatialReference:t.spatialReference}),excessiveReading:a}}const ue=new Map,ce=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,r=this._cachedBlocks;if(r.has(i)){const e=r.get(i);return e.refCount--,e.refCount<=0&&(r.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,r=this._cachedBlocks;if(r.has(i)){const e=r.get(i);return e.ts=Date.now(),e.refCount++,r.delete(i),r.set(i,e),e.block}return null}putBlock(e,t,i,r=null){const n=this._cachedBlocks,s=e+"/"+t;if(n.has(s)){const e=n.get(s);e.ts=Date.now(),e.refCount++}else n.set(s,{block:i,ts:Date.now(),refCount:1,controller:r});this.trim(),this.updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,r=e+"/"+t;i.has(r)&&i.delete(r)}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 r=0;r<t.length&&t[r][1].ts<=i-this._duration;r++)e.delete(t[r][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 he(e,t){return null==t?e:`${e}?sliceId=${t}`}function fe(e,t,i){if(!ue.has(e))return null==t?ce.decreaseRefCount(e,i):0;const r=ue.get(e);if(null==r[t])return ce.decreaseRefCount(e,i);const n=r[t].cache;if(n.has(i)){const e=n.get(i);if(e.refCount--,0===e.refCount){n.delete(i);for(let e=0;e<r.length;e++)r[e]&&r[e].cache.has(i)&&r[e].cache.delete(i);e.controller&&e.controller.abort()}return e.refCount}return 0}function de(e,t,i){if(!ue.has(e))return null==t?ce.getBlock(e,i):null;const r=ue.get(e);if(null==r[t]){for(let e=0;e<r.length;e++)if(r[e]&&r[e].cache.has(i)){const t=r[e].cache.get(i);return t.refCount++,t.block}return ce.getBlock(e,i)}const n=r[t].cache;if(n.has(i)){const e=n.get(i);return e.refCount++,e.block}for(let e=0;e<r.length;e++)if(e!==t&&r[e]&&r[e]&&r[e].cache.has(i)){const t=r[e].cache.get(i);return t.refCount++,n.set(i,t),t.block}return null}function me(e,t,i,r,n=null){if(!ue.has(e))return void(null==t&&ce.putBlock(e,i,r,n));const s=ue.get(e);if(null==s[t])return void ce.putBlock(e,i,r,n);const a={refCount:1,block:r,isResolved:!1,isRejected:!1,controller:n};r.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),s[t].cache.set(i,a)}function pe(e,t,i){if(!ue.has(e))return void(null==t&&ce.deleteBlock(e,i));const r=ue.get(e);null!=r[t]?r[t].cache.delete(i):ce.deleteBlock(e,i)}var ye=i(75993),ge=i(55914);let xe=class extends((0,W.v)(J.wq)){constructor(){super(...arguments),this.rasterJobHandler=null,this.datasetName=null,this.datasetFormat=null,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=async function(){if((0,q.kR)()||!(0,q.Gb)())return null;await(0,q.zD)()}();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:R.Z.create(),...e.ioConfig}}),e}set url(e){this._set("url",(0,I.Nm)(e,f.Z.getLogger(this.declaredClass)))}async open(e){throw new a.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,r={}){const{tileInfo:n}=r,s=n.lodAt(e),a=this.getTileExtent({x:s.resolution,y:s.resolution},t,i,n.origin,n.spatialReference,n.size);return r=this._getRequestOptionsWithSliceId(r),this.fetchPixels(a,n.size[0],n.size[1],r)}async identify(e,t={}){t=this._getRequestOptionsWithSliceId(t);const{spatialReference:i,extent:r}=this.rasterInfo,{datumTransformation:n}=t;let s=Q(e,i,n);if(!r.intersects(s))return{location:s,value:null};if((0,o.pC)(this.rasterInfo.transform)){const e=this.rasterInfo.transform.inverseTransform(s);if(!this.rasterInfo.nativeExtent.intersects(e))return{location:e,value:null};s=e}let a=0;if(t.srcResolution)a=le(t.srcResolution,this.rasterInfo,this.ioConfig.sampling).pyramidLevel;else if(a=await this.computeBestPyramidLevelForLocation(e,t),null==a)return{location:s,value:null};const l=this.identifyPixelLocation(s,a,null);if(null===l)return{location:s,value:null};const{row:u,col:c,rowOffset:h,colOffset:f}=l,d=he(this.url,t.sliceId),m=`${a}/${u}/${c}`;let p=de(d,null,m);(0,o.Wi)(p)&&(p=this.fetchRawTile(a,u,c,t),me(d,null,m,p));const y=await p;if((0,o.Wi)(y)||!y.pixels||0===y.pixels.length)return{location:s,value:null};const g=h*this.rasterInfo.storageInfo.blockHeight+f,x=!y.mask||y.mask[g]?y.pixels.map((e=>e[g])):null,w=this.rasterInfo.dataType;return("vector-magdir"===w||"vector-uv"===w)&&(null==x?void 0:x.length)>1?{location:s,value:x,magdirValue:"vector-magdir"===w?[x[0],x[1]]:(0,S.Tg)([x[0],x[1]]),pyramidLevel:a}:{location:s,value:x,pyramidLevel:a}}async fetchPixels(e,t,i,r={}){e=function(e){const t=e.clone().normalize();return 1===t.length?t[0]:ee(t)}(e);const n=ae(e),s=this.rasterInfo.spatialReference,a=!e.spatialReference.equals(s),{datumTransformation:l}=r,u=new U.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),c=r.srcResolution||(a?X(u,s,e,l):u);if(!c)return null;const{pyramidLevel:h,pyramidResolution:f,excessiveReading:d}=le(c,this.rasterInfo,this.ioConfig.sampling);if(d)return null;const m=this.rasterInfo.storageInfo;let p=a?te(e,s,l):e;const y=(0,o.Wg)(this.rasterInfo.transform);if(y&&(p=y.inverseTransform(p)),null==p)return null;const g={x:Math.floor((p.xmin-m.origin.x)/f.x+.1),y:Math.floor((m.origin.y-p.ymax)/f.y+.1)},x=Math.ceil((p.xmax-p.xmin)/f.x-.1),w=Math.ceil((p.ymax-p.ymin)/f.y-.1);if(x/t>8||w/i>8||n>=2)return null;const v=await this.fetchRawPixels(h,g,{width:x,height:w,wrapCount:n},r);if(!v)return null;const b=h>0?m.pyramidBlockWidth:m.blockWidth,I=h>0?m.pyramidBlockHeight:m.blockHeight;if(!a&&b===x&&I===w&&g.x%b==0&&g.y%I==0&&1===v.pixelBlocks.length&&b===t&&I===i&&c.x===u.x&&c.y===u.y)return{extent:e,srcExtent:p,pixelBlock:v.pixelBlocks[0]};const C=oe(e,v.extent,u,l,y,n>0);let _;const T=!r.requestRawData,R={rows:C.spacing[0],cols:C.spacing[1]},S=(0,o.Wg)(this._getRasterTileAlignmentInfo(h,v.extent.xmin)),{pixelBlocks:M,mosaicSize:k,isPartiallyFilled:F}=v;if(this.rasterJobHandler)_=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:M,srcMosaicSize:k,destDimension:T?{width:t,height:i}:null,coefs:T?C.coefficients:null,sampleSpacing:T?R:null,interpolation:r.interpolation,alignmentInfo:S},r);else{const e=(0,ge.us)(M,k,null,null,S);_=T?(0,ge.Uk)(e,{width:t,height:i},C.coefficients,R,r.interpolation):e}return r.requestRawData?{srcExtent:p,pixelBlock:_,transformGrid:C,extent:e,isPartiallyFilled:F}:{srcExtent:p,extent:e,pixelBlock:_}}async fetchRawPixels(e,t,i,r){const{origin:n,blockBoundary:s}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:l}=this.getBlockWidthHeight(e);let{x:u,y:c}=t,{width:h,height:f,wrapCount:d}=i;const m=(0,o.Wg)(this._getRasterTileAlignmentInfo(e,0));r.buffer&&(u-=r.buffer.cols,c-=r.buffer.rows,h+=2*r.buffer.cols,f+=2*r.buffer.rows);const p=Math.floor(u/a),y=Math.floor(c/l),g=Math.floor((u+h-1)/a),x=Math.floor((c+f-1)/l),w=s[e];if(!w)return null;const{minRow:v,minCol:b,maxCol:I,maxRow:C}=w;if(x<v||g<b||y>C||p>I)return null;const _=new Array;let T=!1;const R=null==this.ioConfig.allowPartialFill?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let i=p;i<=g;i++){const n=0===d||null==m||i<m.worldColumnCountFromOrigin?i:i%m.worldColumnCountFromOrigin-m.originColumnOffset;if(t>=v&&n>=b&&C>=t&&I>=n){const i=this._fetchRawTile(e,t,n,r);R?_.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{T=!0,e(null)}))}))):_.push(i)}else _.push(null)}if(0===_.length)return null;const S=await Promise.all(_),M={height:(x-y+1)*l,width:(g-p+1)*a},{spatialReference:k}=this.rasterInfo,P=this.getPyramidPixelSize(e),{x:D,y:O}=P;return{extent:new F.Z({xmin:n.x+p*a*D,xmax:n.x+(g+1)*a*D,ymin:n.y-(x+1)*l*O,ymax:n.y-y*l*O,spatialReference:k}),pixelBlocks:S,mosaicSize:M,isPartiallyFilled:T}}fetchRawTile(e,t,i,r){throw new a.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return te(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,ye.Jx)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i){var r,n;const{customFetchParameters:s}=this.ioConfig,{range:a,query:o,headers:l}=t;i=null!=(r=null!=(n=i)?n:t.retryCount)?r:this.ioConfig.retryCount;const u=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await(0,w.default)(e,{...t,query:{...o,...s},headers:{...l,...u}})}catch(r){if(i>0)return i--,this.request(e,t,i);throw r}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;if(!(0,o.pC)(t)||null==e||!e.length)return null;let i=0;const r=e[0].variableName;for(let n=0;n<t.variables.length;n++){const s=t.variables[n],a=s.dimensions;if(s.name!==r){i+=a.map((e=>this._getDimensionValuesCount(e))).reduce(((e,t)=>e+t));break}const o=a.map((e=>this._getDimensionValuesCount(e))),l=a.length;for(let t=0;t<l;t++){const r=e.filter((e=>e.dimensionName===a[t].name))[0];if(null==r)return null;const n=Array.isArray(r.values[0])?r.values[0][0]:r.values[0],s=this._getIndexFromDimensions(n,a[t]);if(-1===s)return null;o.shift(),i+=t===l-1?s:s*o.reduce(((e,t)=>e+t))}}return i}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:r}=this.rasterInfo;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let a=Math.max(r.x,r.y),o=1/.0254*96*a;for(let e=0;e<=s;e++)n.push({level:s-e,resolution:a,scale:o}),a*=2,o*=2;const l=new U.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new R.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,r){const{width:n,height:s,nativeExtent:a,pixelSize:o,spatialReference:l}=e,u=new U.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==r&&(r=Math.max(0,Math.round(Math.log(Math.max(n,s))/Math.LN2-8)));const c=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],r);e.storageInfo=new L.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:u,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:c})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,r,n,s=0,a=2){if(1===n.length&&s>0){n=[...n];let{x:e,y:t}=n[0];for(let i=0;i<s;i++)e*=a,t*=a,n.push({x:e,y:t})}const o=[],{x:l,y:u}=r;for(let r=0;r<n.length;r++){const{x:s,y:a}=n[r];o.push({minCol:Math.floor((e.xmin-l+.1*s)/t/s),maxCol:Math.floor((e.xmax-l-.1*s)/t/s),minRow:Math.floor((u-e.ymax+.1*a)/i/a),maxRow:Math.floor((u-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(0===e)return t;if((0,o.pC)(i)&&i.length)return i[e-1];const n=r**e;return{x:t.x*n,y:t.y*n}}identifyPixelLocation(e,t,i){const{spatialReference:r,nativeExtent:n}=this.rasterInfo,{blockWidth:s,blockHeight:a,maximumPyramidLevel:o,origin:l}=this.rasterInfo.storageInfo,u=Q(e,r,i);if(!n.intersects(u))return null;if(t<0||t>o)return null;const c=this.getPyramidPixelSize(t),{x:h,y:f}=c,d=(l.y-u.y)/f/a,m=(u.x-l.x)/h/s,p=Math.min(a-1,Math.floor((d-Math.floor(d))*a)),y=Math.min(s-1,Math.floor((m-Math.floor(m))*s));return{pyramidLevel:t,row:Math.floor(d),col:Math.floor(m),rowOffset:p,colOffset:y,srcLocation:u}}getTileExtent(e,t,i,r,n,s){const[a,o]=s,l=r.x+i*a*e.x,u=l+a*e.x,c=r.y-t*o*e.y,h=c-o*e.y;return new F.Z({xmin:l,xmax:u,ymin:h,ymax:c,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 r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<i||r.minRow>t||r.minCol>i}_fetchRawTile(e,t,i,r){const n=this.rasterInfo.storageInfo.blockBoundary[e];if(!n)return Promise.resolve(null);const{minRow:s,minCol:a,maxCol:l,maxRow:c}=n;if(t<s||i<a||t>c||i>l)return Promise.resolve(null);const h=he(this.url,r.sliceId),f=`${e}/${t}/${i}`;let d=de(h,r.registryId,f);if((0,o.Wi)(d)){const n=(0,u.yi)();d=this.fetchRawTile(e,t,i,{...r,signal:n.signal}),me(h,r.registryId,f,d,n),d.catch((()=>pe(h,r.registryId,f)))}return r.signal&&(0,u.fu)(r,(()=>{fe(h,r.registryId,f)})),d}_getIndexFromDimensions(e,t){const{extent:i,interval:r,unit:n,values:s}=t;if(null!=s&&s.length)return Array.isArray(s[0])?s.findIndex((t=>t[0]<=e&&t[1]>=e)):s.indexOf(e);if(e>i[1])return-1;const a=i[0];let o=-1;if("ISO8601"===n){var l;switch((null==(l=t.intervalUnit)?void 0:l.toLowerCase())||"seconds"){case"seconds":o=Math.round((e-a)/1e3/r);break;case"minutes":o=Math.round((e-a)/6e4/r);break;case"hours":o=Math.round((e-a)/36e5/r);break;case"days":o=Math.round((e-a)/864e5/r);break;case"years":o=Math.round((new Date(e).getUTCFullYear()-new Date(a).getUTCFullYear())/r);break;case"decades":o=Math.round((new Date(e).getUTCFullYear()-new Date(a).getUTCFullYear())/10/r)}return o}return Math.round((e-a)/r)}_getDimensionValuesCount(e){const{extent:t,interval:i,unit:r,values:n}=e;let s=(null==n?void 0:n.length)||0;if(s)return s;const a=t[0];if(0===s&&"ISO8601"===r){var o;switch((null==(o=e.intervalUnit)?void 0:o.toLowerCase())||"seconds"){case"seconds":s=Math.round((t[1]-t[0])/1e3/i);break;case"minutes":s=Math.round((t[1]-t[0])/6e4/i);break;case"hours":s=Math.round((t[1]-t[0])/36e5/i);break;case"days":s=Math.round((t[1]-t[0])/864e5/i);break;case"years":s=Math.round((new Date(t[1]).getUTCFullYear()-new Date(a).getUTCFullYear())/i);break;case"decades":s=Math.round((new Date(t[1]).getUTCFullYear()-new Date(a).getUTCFullYear())/10/i)}return s}return Math.round((t[1]-t[0])/i)}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=function(e){const t=e.storageInfo.origin.x,i=re(e.spatialReference,!0);if(!(0,o.pC)(i))return{originX:t,halfWorldWidth:null,pyramidsInfo:null};const r=i/2,{nativePixelSize:n,storageInfo:s,extent:a}=e,{maximumPyramidLevel:l,blockWidth:u,pyramidScalingFactor:c}=s;let h=n.x;const f=[],d=(0,o.pC)(e.transform)&&"gcs-shift"===e.transform.type,m=t+r,p=d?i-t:r-t;for(let e=0;e<=l;e++){const e=(a.xmax-t)/h/u,r=e-Math.floor(e)==0?e:Math.ceil(e),n=(i/2-t)/h/u,s=n-Math.floor(n)==0?n:Math.ceil(n),o=Math.floor(m/h/u),l=Math.round(m/h)%u,d=(u-Math.round(p/h)%u)%u;f.push({resolutionX:h,blockWidth:u,datsetColumnCount:r,worldColumnCountFromOrigin:s,leftMargin:l,rightPadding:d,originColumnOffset:o}),h*=c}return{originX:t,halfWorldWidth:r,pyramidsInfo:f,hasGCSSShiftTransform:d}}(this.rasterInfo)),(0,o.pC)(this._rasterTileAlighmentInfo.pyramidsInfo)?{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}:null}_getRequestOptionsWithSliceId(e){var t;return null!=(t=e.multidimensionalDefinition)&&t.length&&(0,o.pC)(this.rasterInfo.multidimensionalInfo)&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)||0}),e}};(0,r._)([(0,c.Cb)()],xe.prototype,"_rasterTileAlighmentInfo",void 0),(0,r._)([(0,c.Cb)(C.HQ)],xe.prototype,"url",null),(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],xe.prototype,"datasetName",void 0),(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],xe.prototype,"datasetFormat",void 0),(0,r._)([(0,c.Cb)()],xe.prototype,"rasterInfo",void 0),(0,r._)([(0,c.Cb)()],xe.prototype,"ioConfig",void 0),(0,r._)([(0,c.Cb)()],xe.prototype,"sourceJSON",void 0),xe=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.BaseRaster")],xe);var we=xe,ve=i(20095);function be(e){const t=e.fields,i=e.records,r=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",n=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),s=n.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[r]=o++,l=1;l<s.length;l++)t[s[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:n,features:a}}let Ie=class extends J.wq{constructor(){super(...arguments),this.affectsPixelSize=!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r._)([(0,c.Cb)()],Ie.prototype,"affectsPixelSize",void 0),(0,r._)([(0,c.Cb)({json:{write:!0}})],Ie.prototype,"spatialReference",void 0),Ie=(0,r._)([(0,p.j)("esri.layers.support.rasterTransforms.BaseRasterTransform")],Ie);var Ce=Ie;let _e=class extends Ce{constructor(){super(...arguments),this.type="identity"}};(0,r._)([(0,d.J)({IdentityXform:"identity"})],_e.prototype,"type",void 0),_e=(0,r._)([(0,p.j)("esri.layers.support.rasterTransforms.IdentityTransform")],_e);var Te=_e,Re=i(30556);function Se(e,t,i){const{x:r,y:n}=t;if(i<2)return{x:e[0]+r*e[2]+n*e[4],y:e[1]+r*e[3]+n*e[5]};if(2===i){const t=r*r,i=n*n,s=r*n;return{x:e[0]+r*e[2]+n*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+n*e[5]+t*e[7]+s*e[9]+i*e[11]}}const s=r*r,a=n*n,o=r*n,l=s*r,u=s*n,c=r*a,h=n*a;return{x:e[0]+r*e[2]+n*e[4]+s*e[6]+o*e[8]+a*e[10]+l*e[12]+u*e[14]+c*e[16]+h*e[18],y:e[1]+r*e[3]+n*e[5]+s*e[7]+o*e[9]+a*e[11]+l*e[13]+u*e[15]+c*e[17]+h*e[19]}}function Me(e,t,i){const{xmin:r,ymin:n,xmax:s,ymax:a,spatialReference:o}=t;let l=[];if(i<2)l.push({x:r,y:a}),l.push({x:s,y:a}),l.push({x:r,y:n}),l.push({x:s,y:n});else{let e=10;for(let t=0;t<e;t++)l.push({x:r,y:n+(a-n)*t/(e-1)}),l.push({x:s,y:n+(a-n)*t/(e-1)});e=8;for(let t=1;t<=e;t++)l.push({x:r+(s-r)*t/e,y:n}),l.push({x:r+(s-r)*t/e,y:a})}l=l.map((t=>Se(e,t,i)));const u=l.map((e=>e.x)),c=l.map((e=>e.y));return new F.Z({xmin:Math.min.apply(null,u),xmax:Math.max.apply(null,u),ymin:Math.min.apply(null,c),ymax:Math.max.apply(null,c),spatialReference:o})}let ke=class extends Ce{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){const{coeffX:i,coeffY:r}=t;if(null==i||!i.length||null==r||!r.length||i.length!==r.length)return null;const n=[];for(let e=0;e<i.length;e++)n.push(i[e]),n.push(r[e]);return n}writeForwardCoefficients(e,t,i){const r=[],n=[];for(let t=0;t<(null==e?void 0:e.length);t++)t%2==0?r.push(e[t]):n.push(e[t]);t.coeffX=r,t.coeffY=n}get inverseCoefficients(){let e=this._get("inverseCoefficients");const t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){const[t,i,r,n,s,a]=e,o=r*a-s*n,l=s*n-r*a;return[(s*i-t*a)/o,(r*i-t*n)/l,a/o,n/l,-s/o,-r/l]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){const{inverseCoeffX:i,inverseCoeffY:r}=t;if(null==i||!i.length||null==r||!r.length||i.length!==r.length)return null;const n=[];for(let e=0;e<i.length;e++)n.push(i[e]),n.push(r[e]);return n}writeInverseCoefficients(e,t,i){const r=[],n=[];for(let t=0;t<(null==e?void 0:e.length);t++)t%2==0?r.push(e[t]):n.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=n}forwardTransform(e){if("point"===e.type){const t=Se(this.forwardCoefficients,e,this.polynomialOrder);return new U.Z({x:t.x,y:t.y,spatialReference:e.spatialReference})}return Me(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){const t=Se(this.inverseCoefficients,e,this.polynomialOrder);return new U.Z({x:t.x,y:t.y,spatialReference:e.spatialReference})}return Me(this.inverseCoefficients,e,this.polynomialOrder)}};(0,r._)([(0,c.Cb)({json:{write:!0}})],ke.prototype,"polynomialOrder",void 0),(0,r._)([(0,c.Cb)()],ke.prototype,"forwardCoefficients",void 0),(0,r._)([(0,m.r)("forwardCoefficients",["coeffX","coeffY"])],ke.prototype,"readForwardCoefficients",null),(0,r._)([(0,Re.c)("forwardCoefficients")],ke.prototype,"writeForwardCoefficients",null),(0,r._)([(0,c.Cb)({json:{write:!0}})],ke.prototype,"inverseCoefficients",null),(0,r._)([(0,m.r)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],ke.prototype,"readInverseCoefficients",null),(0,r._)([(0,Re.c)("inverseCoefficients")],ke.prototype,"writeInverseCoefficients",null),(0,r._)([(0,c.Cb)()],ke.prototype,"affectsPixelSize",void 0),(0,r._)([(0,d.J)({PolynomialXform:"polynomial"})],ke.prototype,"type",void 0),ke=(0,r._)([(0,p.j)("esri.layers.support.rasterTransforms.PolynomialTransform")],ke);var Fe=ke;const Pe={PolynomialXform:Fe,IdentityXform:Te},De=Object.keys(Pe);var Oe=i(74889);const Be=new Map;Be.set("int16","esriFieldTypeSmallInteger"),Be.set("int32","esriFieldTypeInteger"),Be.set("int64","esriFieldTypeInteger"),Be.set("float32","esriFieldTypeSingle"),Be.set("float64","esriFieldTypeDouble"),Be.set("text","esriFieldTypeString");let ze=class extends we{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:null==e?void 0:e.signal});if(!this._validateHeader(t))throw new a.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:r}=this._parseHeader(t);if("thematic"===r.dataType){const e=await this._fetchAuxiliaryInformation();r.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",r),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,r={}){const n=this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(n<0)return null;const s=this._buildCacheFilePath(n,t,i,r.multidimensionalDefinition),a=this._getIndexRecordFromBundle(t,i),o=await this.request(s,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:r.signal});if(!o)return null;const l=new Uint8Array(o.data),u=this._getTileEndAndContentType(l,a);if(0===u.recordSize)return null;const c=await this.request(s,{range:{from:u.position,to:u.position+u.recordSize},responseType:"array-buffer",signal:r.signal});return c?this.decodePixelBlock(c.data,{width:this.rasterInfo.storageInfo.tileInfo.size[0],height:this.rasterInfo.storageInfo.tileInfo.size[1],planes:null,pixelType:null}):null}_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){var t,i;const r=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:n,histograms:s,colormap:a,blockWidth:o,blockHeight:l,firstPyramidLevel:u,maximumPyramidLevel:c}=e,h=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),f=e.extent.spatialReference,d=null==(t=e.geodataXform)?void 0:t.spatialReference,m=new P.Z(null!=f&&f.wkid||null!=f&&f.wkt?f:d);let p=new F.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:m});const y=new U.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:m}),g=Math.round((p.xmax-p.xmin)/y.x),x=Math.round((p.ymax-p.ymin)/y.y),w=this._parseTransform(e.geodataXform),v=w?p:null;w&&(p=w.forwardTransform(p),y.x=(p.xmax-p.xmin)/g,y.y=(p.ymax-p.ymin)/x);const b=null!=(i=e.properties)?i:{},I=e.format.toLowerCase().replace("cache/",""),C=new U.Z(e.origin.x,e.origin.y,m);let _,T,S,M;if(a&&a.colors)for(_=[],T=0;T<a.colors.length;T++)S=a.colors[T],M=a.values?a.values[T]:T,_.push([M,255&S,S<<16>>>24,S<<8>>>24,S>>>24]);const k=e.LODInfos,D=[];for(T=0;T<k.levels.length;T++)D.push({level:k.levels[T],resolution:k.resolutions[T],scale:96/.0254*k.resolutions[T]});const O=new R.Z({dpi:96,lods:D,format:I,origin:C,size:[o,l],spatialReference:m}),B={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},z=[{maxCol:Math.ceil(g/o)-1,maxRow:Math.ceil(x/l)-1,minCol:0,minRow:0}];let N=2;if(c>0)for(T=0;T<c;T++)z.push({maxCol:Math.ceil(g/N/o)-1,maxRow:Math.ceil(x/N/l)-1,minCol:0,minRow:0}),N*=2;const E=e.mdInfo;return{storageInfo:B,rasterInfo:new H.Z({width:g,height:x,pixelType:r,bandCount:n,extent:p,nativeExtent:v,transform:w,spatialReference:m,pixelSize:y,keyProperties:b,statistics:h,histograms:s,multidimensionalInfo:E,colormap:_,storageInfo:new L.Z({blockWidth:o,blockHeight:l,pyramidBlockWidth:o,pyramidBlockHeight:l,origin:C,tileInfo:O,firstPyramidLevel:u,maximumPyramidLevel:c,blockBoundary:z})})}}_parseTransform(e){var t,i;if(!function(e){const t=null==e?void 0:e.type;return!e||De.includes(t)}(e))throw new a.Z("cloudraster:open","the data contains unsupported geodata transform types");const r=function(e){if(!(null==e?void 0:e.type))return null;const t=Pe[null==e?void 0:e.type];if(t){const i=new t;return i.read(e),i}return null}(e);if("identity"===r.type)return null;if("polynomial"!==r.type||null==(t=r.forwardCoefficients)||!t.length||null==(i=r.inverseCoefficients)||!i.length)throw new a.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return r}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)),r=await Promise.all([t,i]);let n;if(r[0]){let e=r[0].fields;const t=r[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":Be.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&&r[1]&&(n=class{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 r=t.getUint32(4,!0),n=t.getUint16(8,!0),s=t.getUint16(10,!0),a={version:i,recordCount:r,headerByteCount:n,recordByteCount:s};let o=32;const l=[],u=[];let c;if(3===i){for(;13!==t.getUint8(o);)c=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,ve.f)(new Uint8Array(e,o,11)),type:c,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(c)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;u.length<r&&e.byteLength-o>s;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,ve.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 r=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(r.substring(0,4),10),parseInt(r.substring(4,6),10)-1,parseInt(r.substring(6,8),10)))}o+=t.length})),u.push(i)):o+=s}}return{header:a,fields:l,records:u,recordSet:be({fields:l,records:u})}}}.parse(r[1]).recordSet),Oe.default.fromJSON(n)}_buildCacheFilePath(e,t,i,r){const n=this.storageInfo.packetSize,s=Math.floor(t/n)*n,a=Math.floor(i/n)*n,l="R"+this._toHexString4(s)+"C"+this._toHexString4(a);let u="L";u+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:c}=this.rasterInfo,h=null==r?void 0:r[0];if(!(0,o.pC)(c)||!h)return`${this.url}/_alllayers/${u}/${l}.bundle`;let f=c.variables.filter((e=>e.name===h.variableName))[0].dimensions[0].values.indexOf(h.values[0]).toString(16);const d=4-f.length;for(let e=0;e<d;e++)f="0"+f;return f="S"+f,`${this.url}/_alllayers/${h.variableName}/${f}/${u}/${l}.bundle`}_getIndexRecordFromBundle(e,t){const i=this.storageInfo.packetSize,r=i*(e%i)+t%i;if(r<0)throw"Invalid level / row / col";return 20+r*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let r,n=0;for(r=0;r<5;r++)n|=(255&i[r])<<8*r;const s=0xffffffffff&n;for(n=0,r=5;r<8;r++)n|=(255&i[r])<<8*(r-5);return{position:s,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,r._)([(0,c.Cb)({readOnly:!0})],ze.prototype,"storageInfo",void 0),(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],ze.prototype,"datasetFormat",void 0),ze=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.CloudRaster")],ze);var Ne=ze;let Ee=class extends we{constructor(){super(...arguments),this.datasetFormat="MEMORY"}async open(e){var t;await this.init();const{pixelBlock:i,statistics:r,histograms:n,name:s,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:u,height:c,pixelType:h}=i,f=this.data.extent||new F.Z({xmin:-.5,ymin:.5,xmax:u-.5,ymax:c-.5,spatialReference:new P.Z({wkid:3857})}),d=null!=(t=this.data.isPseudoSpatialReference)?t:!this.data.extent,m={x:f.width/u,y:f.height/c},p=new H.Z({width:u,height:c,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:m,spatialReference:f.spatialReference,bandCount:3,keyProperties:a||{},statistics:r,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=s,this.url="/InMemory/"+s}fetchRawTile(e,t,i,r={}){const n=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(n)}async _buildInMemoryRaster(e,t,i){const r=this.rasterInfo.storageInfo.maximumPyramidLevel,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:r},i):Promise.resolve((0,ge.Vl)(e,t,r)),s=(0,o.pC)(this.rasterInfo.statistics),l=(0,o.pC)(this.rasterInfo.histograms),c=s&&l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,ge.Hv)(e)),h=await(0,u.as)([n,c]);if(!h[0].value&&h[1].value)throw new a.Z("inmemory-raster:open","failed to build in memory raster");var f,d;this._pixelBlockTiles=h[0].value,s||(this.rasterInfo.statistics=null==(f=h[1].value)?void 0:f.statistics),l&&(this.rasterInfo.histograms=null==(d=h[1].value)?void 0:d.histograms)}};(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],Ee.prototype,"datasetFormat",void 0),(0,r._)([(0,c.Cb)()],Ee.prototype,"data",void 0),Ee=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],Ee);var Ze=Ee;function Ae(e,t){if(!e||!t)return[];let i=t;t.indexOf("/")>-1?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const r=[];if(t){const n=Ae(e,i);for(let e=0;e<n.length;e++)Ae(n[e],t).forEach((e=>r.push(e)));return r}const n=e.getElementsByTagNameNS("*",i);if(!n||0===n.length)return[];for(let e=0;e<n.length;e++)r.push(n[e]||n.item[e]);return r}function He(e,t){if(!e||!t)return null;let i=t;t.indexOf("/")>-1?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const r=Ae(e,i);return r.length>0?t?He(r[0],t):r[0]:null}function Le(e,t=null){const i=t?He(e,t):e;let r;return i?(r=i.textContent||i.nodeValue,r?r.trim():null):null}function Je(e,t){return function(e,t){const i=Ae(e,t),r=[];let n;for(let e=0;e<i.length;e++)n=i[e].textContent||i[e].nodeValue,n&&(n=n.trim(),""!==n&&r.push(n));return r}(e,t).map((e=>Number(e)))}function We(e,t){const i=Le(e,t);return Number(i)}function je(e,t){var i;const r=null==e||null==(i=e.nodeName)?void 0:i.toLowerCase(),n=t.toLowerCase();return r.slice(r.lastIndexOf(":")+1)===n}function qe(e,t){if(!e||!t)return null;const i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function Ge(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new P.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"),r=e.indexOf("PROJCS"),n=r>-1?r:e.indexOf("GEOGCS");if(-1===n)return null;const s=e.slice(n,e.lastIndexOf("]",i)+1).trim(),a=e.slice(n,e.lastIndexOf("]")).trim();t=Ue(s);const o=new P.Z(t?{wkid:t}:{wkt:s}),l=Ue(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ue(e),new P.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ue(e){const t=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(",");if("EPSG"===i[0]&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ye(e){var t;if("pamdataset"!==(null==e||null==(t=e.documentElement.tagName)?void 0:t.toLowerCase()))return{};const i={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(je(e,"SRS")){if(!i.spatialReference){const t=Le(e);i.spatialReference=Ge(t)}}else if(je(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:t,transform:r}=function(e){var t;const i=He(e,"GeodataXform"),r=Ge(We(i,"SpatialReference/WKID")||Le(i,"SpatialReference/WKT"));if("typens:PolynomialXform"!==i.getAttribute("xsi:type"))return{spatialReference:r,transform:null};const n=null!=(t=We(i,"PolynomialOrder"))?t:1,s=Je(i,"CoeffX/Double"),a=Je(i,"CoeffY/Double"),o=Je(i,"InverseCoeffX/Double"),l=Je(i,"InverseCoeffY/Double"),u=qe(s,a),c=qe(o,l);return{spatialReference:r,transform:new Fe({spatialReference:r,polynomialOrder:n,forwardCoefficients:u,inverseCoefficients:c})}}(e);i.transform=r,i.spatialReference||(i.spatialReference=t)}else Ae(e,"MDI").forEach((e=>i.metadata[e.getAttribute("key")]=Le(e)));else if(je(e,"PAMRasterBand")){const t=function(e){var t;const i=We(e,"NoDataValue"),r=He(e,"Histograms/HistItem"),n=We(r,"HistMin"),s=We(r,"HistMax"),a=We(r,"BucketCount"),o=null==(t=Le(r,"HistCounts"))?void 0:t.split("|").map((e=>Number(e)));let l,u,c,h;Ae(e,"Metadata/MDI").forEach((e=>{var t;const i=Number(null!=(t=e.textContent)?t:e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":l=i;break;case"STATISTICS_MAXIMUM":u=i;break;case"STATISTICS_MEAN":c=i;break;case"STATISTICS_STDDEV":h=i}}));const f=We(e,"Metadata/SourceBandIndex");return{noDataValue:i,histogram:null!=o&&o.length&&null!=l&&null!=u?{min:n,max:s,size:a||o.length,counts:o}:null,sourceBandIndex:f,statistics:null!=l&&null!=u?{min:l,max:u,avg:c,stddev:h}:null}}(e);null!=t.sourceBandIndex&&null==i.rasterBands[t.sourceBandIndex]?i.rasterBands[t.sourceBandIndex]=t:i.rasterBands.push(t)}}));const r=i.rasterBands;if(r){const e=!!r[0].statistics;i.statistics=e?r.map((e=>e.statistics)):null;const t=!!r[0].histogram;i.histograms=t?r.map((e=>e.histogram)):null}return i}let Ve=class extends we{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:r,histograms:n,transform:s}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new P.Z({wkid:3857})),null!=n&&n.length&&null==r&&(r=(0,ge.Oh)(n));const{width:o,height:l}=t;let u=new F.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const c=s?s.forwardTransform(u):u;let h=!0;if(s){const e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=c)}const f=new Ze({data:{extent:c,nativeExtent:u,transform:s,pixelBlock:t,statistics:r,histograms:n,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:null==e?void 0:e.signal}),i=(0,ye.y6)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.Z("image-aux-raster:open","the data is not a supported format");return this._set("datasetFormat",i),await this.decodePixelBlock(t,{format:"jpg",width:1,height:1,useCanvas:!0})}async _fetchAuxiliaryData(e){var t,i;const r=(0,o.Wg)(null==e?void 0:e.signal),n=null!=(t=this.ioConfig.skipExtensions)?t:[],s=n.indexOf("aux.xml")>-1?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:r}),a=this.datasetFormat,l="JPG"===a?"jgw":"PNG"===a?"pgw":"BMP"===a?"bpw":null,c=n.indexOf(l)>-1?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:r}),h=await(0,u.as)([s,c]);if(null!=r&&r.aborted)throw(0,u.zE)();const f=Ye(null==(i=h[0].value)?void 0:i.data);if(!f.transform){const e=h[1].value?h[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;f.transform=6===(null==e?void 0:e.length)?new Fe({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],Ve.prototype,"datasetFormat",void 0),Ve=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],Ve);var $e=Ve,Xe=i(17452),Ke=i(45322),Qe=i(56608);let et=class extends Ce{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}};(0,r._)([(0,d.J)({GCSShiftXform:"gcs-shift"})],et.prototype,"type",void 0),(0,r._)([(0,c.Cb)()],et.prototype,"tolerance",void 0),et=(0,r._)([(0,p.j)("esri.layers.support.rasterTransforms.GCSShiftTransform")],et);var tt=et;let it=class extends we{constructor(){super(...arguments),this._levelOffset=0,this._slices=null,this._tilemapCache=null,this.datasetFormat="RasterTileServer"}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 r=i.data;if(this.sourceJSON=r,!r)throw new a.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new a.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=r.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].indexOf(r.tileInfo.format.toLowerCase())>-1?this.tileType="Map":"lerc"===r.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=r.name.slice(r.name.indexOf("/")+1);const n=await this._fetchRasterInfo({signal:t});if(!(0,o.pC)(n))throw new a.Z("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?(0,Ke.d)(r.tileInfo,r):R.Z.fromJSON(r.tileInfo),{extent:t,pixelSize:i}=n,s=.5/n.width*i.x;let a,o;const l=e.lodAt(Math.max.apply(null,e.lods.map((e=>e.level))));"Map"!==this.tileType&&0!==r.maxScale&&("Raster"===this.tileType?(a=e.lods.filter((e=>e.resolution===i.x))[0],a||(a=e.lods[e.lods.length-1])):(a=e.lods.filter((e=>Math.abs(e.scale-r.maxScale)<s))[0],a||(a=e.lods.filter((e=>e.scale>r.maxScale)).sort(((e,t)=>e.scale>t.scale?1:-1))[0])),i.x=i.y=a.resolution,n.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),n.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),a||(a=l);const u=e.lodAt(Math.min.apply(null,e.lods.map((e=>e.level))));"Map"===this.tileType?this._levelOffset=e.lods[0].level:0!==r.minScale&&"Elevation"===this.tileType&&(o=e.lods.filter((e=>Math.abs(e.scale-r.minScale)<s))[0],this._levelOffset=o.level-u.level),o||(o=u);const c=Math.max(i.x,i.y);(Math.abs(i.x-i.y)>s||!e.lods.some((e=>Math.abs(e.resolution-c)<s)))&&(i.x=i.y=a.resolution,n.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),n.height=Math.ceil((t.ymax-t.ymin)/i.y-.1));const h=a.level-o.level,[f,d]=e.size,m=[];e.lods.forEach((e=>{e.level>=o.level&&e.level<=a.level&&m.push({x:e.resolution,y:e.resolution})})),m.sort(((e,t)=>e.x-t.x));const p=this.computeBlockBoundary(t,f,d,e.origin,m,h),y=m.length>1?m.slice(1):null;n.storageInfo=new L.Z({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],pyramidResolutions:y,compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:h,tileInfo:e,blockBoundary:p}),this._fixGCSShift(n),this._set("rasterInfo",n)}if(r.capabilities.toLowerCase().indexOf("tilemap")>-1){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:(0,Xe.mN)(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new Qe.y({layer:e})}}async fetchRawTile(e,t,i,r={}){const{storageInfo:n,extent:s}=this.rasterInfo,a=n.maximumPyramidLevel-e+this._levelOffset,o=`${this.url}/tile/${a}/${t}/${i}`,l=this._slices?{sliceId:r.sliceId||0}:null,{data:u}=await this.request(o,{query:l,responseType:"array-buffer",signal:r.signal});if(!u)return null;const c=await this.decodePixelBlock(u,{width:n.tileInfo.size[0],height:n.tileInfo.size[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType}),h=n.blockBoundary[e];if("jpg"!==n.compression||i>h.minCol&&i<h.maxCol&&t>h.minRow&&t<h.maxRow)return c;const{origin:f,blockWidth:d,blockHeight:m}=n,{x:p,y}=this.getPyramidPixelSize(e),g=Math.round((s.xmin-f.x)/p)%d,x=Math.round((s.xmax-f.x)/p)%d,w=Math.round((f.y-s.ymax)/y)%m,v=Math.round((f.y-s.ymin)/y)%m,b=i===h.minCol?g:0,I=t===h.minRow?w:0,C=i===h.maxCol?x:d,_=t===h.maxRow?v:m;return(0,ge.pW)(c,{x:b,y:I},{width:C-b,height:_-I}),c}getSliceIndex(e){if(null==e||!e.length||!this._slices)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.filter((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName))[0];return!i||(Array.isArray(e.values[0])?e.values[0][0]:e.values[0])!==(Array.isArray(i.values[0])?i.values[0][0]: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=>{var t;return null==(t=e.data)?void 0:t.statistics})),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),n=await Promise.all([i,r]);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,(0,o.Wg)(t.datumTransformation));if(null===i)return null;let r=0;const{maximumPyramidLevel:n}=this.rasterInfo.storageInfo;let s=n-r+this._levelOffset;const a=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,r++,i=this.identifyPixelLocation(a,r,(0,o.Wg)(t.datumTransformation)),null===i)return null}return-1===s||null==i?null:r}async _fetchRasterInfo(e){const t=this.sourceJSON,i=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),r=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),n=P.Z.fromJSON(t.spatialReference||t.extent.spatialReference);if("Map"===this.tileType)return new H.Z({width:i,height:r,bandCount:3,extent:F.Z.fromJSON(t.extent),spatialReference:n,pixelSize:new U.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n}),pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}});const{slice:s,signal:a}=e,o=!!t.hasRasterAttributeTable&&this.request(this.url+"/rasterAttributeTable",{query:{slice:s,f:"json"},signal:a}).then((e=>Oe.default.fromJSON(e.data))).catch((()=>null)),l=!!t.hasColormap&&this.request(this.url+"/colormap",{query:{slice:s,f:"json"},signal:a}).then((e=>{var t;return null==(t=e.data)?void 0:t.colormap})),u=!!t.hasHistograms&&this.request(this.url+"/histograms",{query:{slice:s,f:"json"},signal:a}).then((e=>{var t;return null==(t=e.data)?void 0:t.histograms})),c=this.request(this.url+"/keyProperties",{query:{f:"json"},signal:a}).then((e=>e.data)).catch((()=>{})),h=!!t.hasMultidimensions&&this._fetchMultidimensionalInfo(),f=!!t.hasMultidimensions&&this.request(this.url+"/slices",{query:{f:"json"},signal:a}).then((e=>e.data&&e.data.slices)).catch((()=>{}));return Promise.all([o,l,u,c,h,f]).then((e=>{let s=null;if(t.minValues&&t.minValues.length===t.bandCount){s=[];for(let e=0;e<t.minValues.length;e++)s.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}return this._slices=e[5]||null,new H.Z({width:i,height:r,bandCount:t.bandCount,extent:F.Z.fromJSON(t.extent),spatialReference:n,pixelSize:new U.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n}),pixelType:t.pixelType.toLowerCase(),statistics:s,attributeTable:e[0]||null,colormap:e[1]||null,histograms:e[2]||null,keyProperties:e[3]||{},multidimensionalInfo:e[4]||null})}))}async _fetchMultidimensionalInfo(e){var t;const i=await this.request(this.url+"/multidimensionalInfo",{query:{f:"json"},signal:e}).then((e=>{var t;return null==(t=e.data)?void 0:t.multidimensionalInfo}));return null!=(t=i.variables)&&t.length&&i.variables.forEach((e=>{var t;null!=(t=e.statistics)&&t.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),i}_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;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new tt,e.extent=e.transform.forwardTransform(t))}};(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],it.prototype,"datasetFormat",void 0),(0,r._)([(0,c.Cb)()],it.prototype,"tileType",void 0),it=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],it);var rt=it,nt=i(54163),st=i(48279);const at=new Map;at.set("Int8","s8"),at.set("UInt8","u8"),at.set("Int16","s16"),at.set("UInt16","u16"),at.set("Int32","s32"),at.set("UInt32","u32"),at.set("Float32","f32"),at.set("Float64","f32"),at.set("Double64","f32");const ot=new Map;ot.set("lerc",".lrc"),ot.set("none",".til"),ot.set("deflate",".pzp"),ot.set("jpeg",".jzp");let lt=class extends we{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){var t;await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const i=e?(0,o.Wg)(e.signal):null,r=await this.request(this.url,{responseType:"xml",signal:i}),{rasterInfo:n,files:s}=this._parseHeader(r.data);if(-1===(null==(t=this.ioConfig.skipExtensions)?void 0:t.indexOf("aux.xml"))){const t=await this._fetchAuxiliaryData(e);var a;null!=t&&(n.statistics=null!=(a=t.statistics)?a:n.statistics,n.histograms=t.histograms,t.histograms&&!(0,o.pC)(n.statistics)&&(n.statistics=(0,ge.Oh)(t.histograms)))}this._set("rasterInfo",n),this._files=s;const l=await this.request(s.index,{responseType:"array-buffer",signal:i});this._storageIndex=this._parseIndex(l.data);let u,c,h=0,f=-1;const{blockWidth:d,blockHeight:m,compression:p}=this.rasterInfo.storageInfo,y=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:g,height:x,bandCount:w}=this.rasterInfo,v=[],b="none"===p?1:w;for(;h<this._storageIndex.length;)f++,u=Math.ceil(g/d/y**f),c=Math.ceil(x/m/y**f),h+=u*c*b*4,v.push({maxRow:c,maxCol:u,minCol:0,minRow:0});this.rasterInfo.storageInfo.blockBoundary=v,f>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=f),this.updateTileInfo()}async fetchRawTile(e,t,i,r={}){const{blockWidth:n,blockHeight:s,blockBoundary:a,compression:o}=this.rasterInfo.storageInfo,l=a[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;const{bandCount:u,pixelType:c}=this.rasterInfo,{ranges:h,actualTileWidth:f,actualTileHeight:d}=this._getTileLocation(e,t,i);if(!h||0===h.length)return null;if(0===h[0].from&&0===h[0].to){const e=new Uint8Array(n*s);return new nt.Z({width:n,height:s,pixels:null,mask:e,validPixelCount:0})}const{bandIds:m}=this.ioConfig,p="none"===o?1:u,y=[];let g=0;for(g=0;g<p;g++)(!m||m.indexOf[g]>-1)&&y.push(this.request(this._files.data,{range:{from:h[g].from,to:h[g].to},responseType:"array-buffer",signal:r.signal}));const x=await Promise.all(y),w=x.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),v=new Uint8Array(w);let b=0;for(g=0;g<p;g++)v.set(new Uint8Array(x[g].data),b),b+=x[g].data.byteLength;const I="lerc"===this.rasterInfo.storageInfo.compression?"lerc":"bip",C=await this.decodePixelBlock(v.buffer,{width:n,height:s,format:I,pixelType:c});let _=0,T=0;if(f!==n||d!==s){let e=C.mask;if(e)for(g=0;g<s;g++)if(T=g*n,g<d)for(_=f;_<n;_++)e[T+_]=0;else for(_=0;_<n;_++)e[T+_]=0;else for(e=new Uint8Array(n*s),C.mask=e,g=0;g<d;g++)for(T=g*n,_=0;_<f;_++)e[T+_]=1}return C}_parseIndex(e){if(e.byteLength%16>0)throw"invalid array buffer must be multiples of 16";let t,i,r,n,s,a;if(st.f){for(i=new Uint8Array(e),n=new ArrayBuffer(e.byteLength),r=new Uint8Array(n),s=0;s<e.byteLength/4;s++)for(a=0;a<4;a++)r[4*s+a]=i[4*s+3-a];t=new Uint32Array(n)}else t=new Uint32Array(e);return t}_getTileLocation(e,t,i){const{blockWidth:r,blockHeight:n,pyramidScalingFactor:s,compression:a}=this.rasterInfo.storageInfo,{width:o,height:l,bandCount:u}=this.rasterInfo,c="none"===a?1:u;let h,f,d,m=0,p=0;for(d=0;d<e;d++)p=s**d,h=Math.ceil(o/r/p),f=Math.ceil(l/n/p),m+=h*f;p=s**e,h=Math.ceil(o/r/p),f=Math.ceil(l/n/p),m+=t*h+i,m*=4*c;const y=this._storageIndex.subarray(m,m+4*c);let g=0,x=0;const w=[];for(let e=0;e<c;e++)g=y[4*e+0]*2**32+y[4*e+1],x=g+y[4*e+2]*2**32+y[4*e+3],w.push({from:g,to:x});return{ranges:w,actualTileWidth:i<h-1?r:Math.ceil(o/p)-r*(h-1),actualTileHeight:t<f-1?n:Math.ceil(l/p)-n*(f-1)}}_parseHeader(e){const t=He(e,"MRF_META/Raster");if(!t)throw new a.Z("mrf:open","not a valid MRF format");const i=He(t,"Size"),r=parseInt(i.getAttribute("x"),10),n=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),o=(Le(t,"Compression")||"none").toLowerCase();if(!o||-1===["none","lerc"].indexOf(o))throw new a.Z("mrf:open","currently does not support compression "+o);const l=Le(t,"DataType")||"UInt8",u=at.get(l);if(null==u)throw new a.Z("mrf:open","currently does not support pixel type "+l);const c=He(t,"PageSize"),h=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10),d=He(t,"DataValues");let m,p;if(d&&(p=d.getAttribute("NoData"),null!=p&&(m=p.trim().split(" ").map((e=>parseFloat(e))))),He(e,"MRF_META/CachedSource"))throw new a.Z("mrf:open","currently does not support MRF referencing other data files");const y=He(e,"MRF_META/GeoTags"),g=He(y,"BoundingBox");if(null==g)throw new a.Z("mrf:open","missing node MRF_META/GeoTags/BoundingBox");const x=parseFloat(g.getAttribute("minx")),w=parseFloat(g.getAttribute("miny")),v=parseFloat(g.getAttribute("maxx")),b=parseFloat(g.getAttribute("maxy")),I=Le(y,"Projection")||"",C=Le(e,"datafile"),_=Le(e,"IndexFile");let T;if("LOCAL_CS[]"!==I)if(I.toLowerCase().startsWith("epsg:")){const e=Number(I.slice(5));isNaN(e)||0===e||(T=new P.Z({wkid:e}))}else T=Ge(I);const R=new F.Z(x,w,v,b);R.spatialReference=T;const S=He(e,"MRF_META/Rsets"),M=parseInt(S&&S.getAttribute("scale")||"2",10),k=new L.Z({origin:new U.Z({x:R.xmin,y:R.ymax,spatialReference:T}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:M}),D=new U.Z({x:(v-x)/r,y:(b-w)/n,spatialReference:T});return{rasterInfo:new H.Z({width:r,height:n,extent:R,spatialReference:T,bandCount:s,pixelType:u,pixelSize:D,noDataValue:m,storageInfo:k}),files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:C||this.url.replace(".mrf",ot.get(o))}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:null==e?void 0:e.signal});return Ye(t)}catch{return null}}};(0,r._)([(0,c.Cb)()],lt.prototype,"_files",void 0),(0,r._)([(0,c.Cb)()],lt.prototype,"_storageIndex",void 0),(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],lt.prototype,"datasetFormat",void 0),lt=(0,r._)([(0,p.j)("esri.layers.support.rasterIO.MRFRaster")],lt);var ut=lt,ct=i(67090),ht=i(9832);const ft=function(e,t){const i=e.get(t);return i&&i.values},dt=function(e,t){const i=e.get(t);return i&&i.values[0]};let mt=class extends we{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){var t,i,r;await this.init();const n=e?(0,o.Wg)(e.signal):null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:n});if(!s)throw new a.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{littleEndian:l,firstIFD:u,isBigTiff:c}=(0,ct.p)(s),h=[];await this.readIFDs(h,s,l,u,0,c?8:4,n);const f=(0,ct.g)(h),{width:d,height:m,tileWidth:p,tileHeight:y,planes:g,pixelType:x,compression:w,firstPyramidLevel:v,maximumPyramidLevel:b,pyramidBlockWidth:I,pyramidBlockHeight:C,tileBoundary:_,affine:T,metadata:R}=f;let S=Ge((null==(t=f.extent.spatialReference)?void 0:t.wkt)||(null==(i=f.extent.spatialReference)?void 0:i.wkid)),M=!1;null==S&&(M=!0,S=new P.Z({wkid:3857}));const k=new F.Z({...f.extent,spatialReference:S}),D=new U.Z(k?{x:k.xmin,y:k.ymax,spatialReference:S}:{x:0,y:0}),O=new L.Z({blockWidth:p,blockHeight:y,pyramidBlockWidth:I,pyramidBlockHeight:C,compression:w,origin:D,firstPyramidLevel:v,maximumPyramidLevel:b,blockBoundary:_}),B=new U.Z({x:(k.xmax-k.xmin)/d,y:(k.ymax-k.ymin)/m,spatialReference:S}),z=R?{BandProperties:R.bandProperties,DataType:R.dataType}:{},N=new H.Z({width:d,height:m,bandCount:g,pixelType:x,compression:w,pixelSize:B,storageInfo:O,spatialReference:S,isPseudoSpatialReference:M,keyProperties:z,extent:k,statistics:R?R.statistics:null});if(null!=T&&T.length&&(N.nativeExtent=new F.Z({xmin:-.5,ymin:.5-m,xmax:d-.5,ymax:.5,spatialReference:S}),N.transform=new Fe({polynomialOrder:1,forwardCoefficients:[T[2]+T[0]/2,T[5]-T[3]/2,T[0],T[3],-T[1],-T[4]]}),N.extent=N.transform.forwardTransform(N.nativeExtent),N.pixelSize=new U.Z({x:(k.xmax-k.xmin)/d,y:(k.ymax-k.ymin)/m,spatialReference:S}),O.origin.x=-.5,O.origin.y=.5),null==(r=this.ioConfig.skipExtensions)||!r.includes("aux.xml")){const t=await this._fetchAuxiliaryData(e);if(null!=t){var E;if(N.statistics=null!=(E=t.statistics)?E:N.statistics,N.histograms=t.histograms,t.histograms&&!(0,o.pC)(N.statistics)&&(N.statistics=(0,ge.Oh)(t.histograms)),t.transform&&!T){N.transform=t.transform,N.nativeExtent=N.extent;const e=N.transform.forwardTransform(N.nativeExtent);N.pixelSize=new U.Z({x:(e.xmax-e.xmin)/d,y:(e.ymax-e.ymin)/m,spatialReference:S}),N.extent=e}N.spatialReference||(N.spatialReference=t.spatialReference)}}if(this._set("rasterInfo",N),this._headerInfo={littleEndian:l,isBigTiff:c,ifds:h,...f},!this._headerInfo.isSupported)throw new a.Z("tiffraster:open","this tiff is not supported: "+this._headerInfo.message);this.updateTileInfo()}async fetchRawTile(e,t,i,r={}){var n;if(null==(n=this._headerInfo)||!n.isSupported||this.isBlockOutside(e,t,i))return null;const s=this.getTileLocation(e,t,i);if(!s)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:u}=s,c=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal}))),h=await Promise.all(c),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 r=h[t].data;e.set(new Uint8Array(r),i),m[t]=i,i+=r.byteLength,p[t]=r.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:u,offsets:m,sizes:p},width:y,height:g,planes:null,pixelType:null});let w,v,b;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(b=w*y,w<l)for(v=o;v<y;v++)e[b+v]=0;else for(v=0;v<y;v++)e[b+v]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(b=w*y,v=0;v<o;v++)e[b+v]=1}return x}async readIFDs(e,t,i,r,n,s=4,a){if(!r)return null;(r>=t.byteLength||r<0)&&(t=(await this.request(this.url,{range:{from:r+n,to:r+n+this._bufferSize},responseType:"array-buffer",signal:a})).data,n=r+n,r=0);const o=await this.readIFD(t,i,r,n,ht.Z.TIFF_TAGS,s,a);if(e.push(o.ifd),!o.nextIFD)return null;await this.readIFDs(e,t,i,o.nextIFD-n,n,s,a)}async readIFD(e,t,i,r,n=ht.Z.TIFF_TAGS,s=4,a){if(!e)return null;const o=(0,ct.b)(e,t,i,r,n,s);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)),s=Math.min.apply(null,n.map((e=>e[0])));if(Math.min.apply(null,n.map((e=>e[0]+e[1])))-s<=this._bufferSize){const{data:n}=await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:a});e=n,r=s,i.forEach((i=>(0,ct.c)(e,t,i,r)))}}if(o.ifd.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),n=i.values;if(n&&n.length>4){const s=n[0]+"."+n[1]+"."+n[2],o=await this.readIFD(e,t,i.valueOffset+6-r,r,ht.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:r,to:r+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this.readIFD(e,t,0,r,ht.Z.TIFF_TAGS,4,a)}}getTileLocation(e,t,i){const{firstPyramidLevel:r,blockBoundary:n}=this.rasterInfo.storageInfo,s=0===e?0:e-(r-1),a=this._headerInfo.ifds[s];if(!a)return null;const o=(0,ct.i)(a,this._headerInfo),l=ft(a,"TILEOFFSETS");if(void 0===l)return null;const u=ft(a,"TILEBYTECOUNTS"),{minRow:c,minCol:h,maxRow:f,maxCol:d}=n[s];if(t>f||i>d||t<c||i<h)return null;const m=dt(a,"IMAGEWIDTH"),p=dt(a,"IMAGELENGTH"),y=dt(a,"TILEWIDTH"),g=dt(a,"TILELENGTH"),x=o?this.rasterInfo.bandCount:1,w=x*t*(d+1)+i,v=[{from:l[w],to:l[w+x-1]+u[w+x-1]-1}];if(o){let e=!0;for(let t=0;t<x;t++)if(l[w+t]+u[w+t]!==l[w+t+1]){e=!1;break}if(!e)for(let e=0;e<x;e++)v[e]={from:l[w+e],to:l[w+e]+u[w+e]-1}}const b=l[w],I=u[w];return null==b||null==I?null:{ranges:v,ifd:a,actualTileWidth:i===d?m%y:y,actualTileHeight:t===f?p%g:g}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:null==e?void 0:e.signal});return Ye(t)}catch{return null}}};(0,r._)([(0,c.Cb)()],mt.prototype,"_files",void 0),(0,r._)([(0,c.Cb)()],mt.prototype,"_headerInfo",void 0),(0,r._)([(0,c.Cb)()],mt.prototype,"_bufferSize",void 0),(0,r._)([(0,c.Cb)({type:String,json:{write:!0}})],mt.prototype,"datasetFormat",void 0),mt=(0,r._)([(0,p.j)("esri.layers.support.rasterDatasets.TIFFRaster")],mt);var pt=mt;const yt=new Map;yt.set("CRF",{desc:"Cloud Raster Format",constructor:Ne}),yt.set("MRF",{desc:"Meta Raster Format",constructor:ut}),yt.set("TIFF",{desc:"GeoTIFF",constructor:pt}),yt.set("RasterTileServer",{desc:"Raster Tile Server",constructor:rt}),yt.set("JPG",{desc:"JPG Raster Format",constructor:$e}),yt.set("PNG",{desc:"PNG Raster Format",constructor:$e}),yt.set("GIF",{desc:"GIF Raster Format",constructor:$e}),yt.set("BMP",{desc:"BMP Raster Format",constructor:$e});var gt=i(32163);let xt=class extends((0,g.h)((0,E.M)((0,B.q)((0,z.I)((0,x.N)(O((0,N.Q)((0,l.R)(y.Z))))))))){constructor(...e){super(...e),this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.title=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=(0,o.pC)(e)?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(u.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){var e,t;let i=[new Z.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const r=null==(e=this.rasterInfo)||null==(t=e.attributeTable)?void 0:t.fields;if(r){const e=r.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));i=i.concat(e)}const n=this.rasterInfo.dataType;if(("vector-magdir"===n||"vector-uv"===n)&&(0,o.pC)(this.rasterInfo.multidimensionalInfo)){var s;const e=null==(s=this.rasterInfo.multidimensionalInfo.variables[0].unit)?void 0:s.trim(),t="Magnitude"+(e?` (${e})`:"");i.push(new Z.Z({name:"Raster.Magnitude",alias:t,domain:null,editable:!1,type:"double"})),i.push(new Z.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return i}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,i){const r=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,n=(0,s.ij)(r,i)||void 0;if(null!=n)return n}createPopupTemplate(e){return(0,gt.eZ)({fields:this.rasterFields,title:this.title},e)}write(e,t){const{raster:i}=this;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 a.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){this.raster?(this.raster.rasterInfo||await this.raster.open(),this.url=this.raster.url):this.raster=await class{static get supportedFormats(){const e=new Set;return yt.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:r}=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().indexOf("/imageserver")>-1&&-1===t.toLowerCase().indexOf("/wcsserver")&&(n="RasterTileServer");const s={url:t,sourceJSON:r,datasetFormat:n,ioConfig:i||{bandIds:null,sampling:null}};let o,l;if(this.supportedFormats.has(n))return o=yt.get(n).constructor,l=new o(s),await l.open({signal:e.signal}),l;if(n)throw new a.Z("rasterfactory:open","not a supported format "+n);const u=Array.from(yt.keys());let c=0;const h=function(){return n=u[c++],n?(o=yt.get(n).constructor,l=new o(s),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null};return h()}static register(e,t,i){yt.has(e.toUpperCase())||yt.set(e.toUpperCase(),{desc:t,constructor:i})}}.open({url:this.url,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e});const{rasterInfo:t}=this.raster;if(!t)throw new a.Z("imagery-tile-layer:load","cannot load resources on "+this.url);this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON&&(this._set("version",this.sourceJSON.currentVersion),this._set("copyright",this.sourceJSON.copyrightText)),null==this.title&&(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.watch("customParameters",(e=>this.raster.ioConfig.customFetchParameters=e))}};(0,r._)([(0,c.Cb)({type:[h.z8],json:{write:{overridePolicy(){var e;return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==(null==(e=this.bandIds)?void 0:e.join(","))}}}}})],xt.prototype,"bandIds",void 0),(0,r._)([(0,c.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,d.J)(A.c)],xt.prototype,"interpolation",void 0),(0,r._)([(0,c.Cb)({json:{write:!0}})],xt.prototype,"multidimensionalDefinition",void 0),(0,r._)([(0,c.Cb)(C.rn)],xt.prototype,"legendEnabled",void 0),(0,r._)([(0,c.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],xt.prototype,"isReference",void 0),(0,r._)([(0,c.Cb)({type:["show","hide"]})],xt.prototype,"listMode",void 0),(0,r._)([(0,c.Cb)()],xt.prototype,"sourceJSON",void 0),(0,r._)([(0,c.Cb)({readOnly:!0})],xt.prototype,"version",void 0),(0,r._)([(0,c.Cb)()],xt.prototype,"title",void 0),(0,r._)([(0,c.Cb)({readOnly:!0,json:{read:!1}})],xt.prototype,"type",void 0),(0,r._)([(0,c.Cb)({type:["ArcGISTiledImageServiceLayer"]})],xt.prototype,"operationalLayerType",void 0),(0,r._)([(0,c.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}}}})],xt.prototype,"popupEnabled",void 0),(0,r._)([(0,c.Cb)({type:n.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],xt.prototype,"popupTemplate",void 0),(0,r._)([(0,c.Cb)({readOnly:!0})],xt.prototype,"defaultPopupTemplate",null),(0,r._)([(0,c.Cb)({readOnly:!0,type:[Z.Z]})],xt.prototype,"fields",void 0),(0,r._)([(0,c.Cb)({readOnly:!0,type:[Z.Z]})],xt.prototype,"rasterFields",null),(0,r._)([(0,c.Cb)({types:s.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){var e;const t="raster-stretch"===(null==(e=this.renderer)?void 0:e.type)&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!t}}},origins:{"web-scene":{types:s.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],xt.prototype,"renderer",null),(0,r._)([(0,m.r)("renderer")],xt.prototype,"readRenderer",null),xt=(0,r._)([(0,p.j)("esri.layers.ImageryTileLayer")],xt);var wt=xt}}]);