@arcgis/core 4.25.0-next.20220729 → 4.25.0-next.20220731

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.
@@ -1 +1 @@
1
- var RemoteClient;(()=>{var e={88277:(e,t,r)=>{r.p=self.esriConfig.assetsPath+"/esri/core/workers/"},68773:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s}),r(80442);var n=r(78286),o=r(17202);const s={apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&((0,n.RH)(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){const e="4.25.0";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${o.r}/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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";r.d(t,{Z:()=>o});var n=r(78286);class o{constructor(e,t,r){this.name=e,this.details=r,this instanceof o&&(this.message=(t&&function(e,t){return e.replace(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,((e,r)=>{if(""===r)return"$";const o=(0,n.hS)(r,t)??"";if(void 0===o)throw new Error(`could not find key "${r}" in template`);return o.toString()}))}(t,r))??"")}toString(){return"["+this.name+"]: "+this.message}}},77734:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e=1){this._seed=e}set seed(e){this._seed=e??Math.random()*n._m}getInt(){return this._seed=(n._a*this._seed+n._c)%n._m,this._seed}getFloat(){return this.getInt()/(n._m-1)}getIntRange(e,t){return Math.round(this.getFloatRange(e,t))}getFloatRange(e,t){const r=t-e;return e+this.getInt()/n._m*r}}n._m=2147483647,n._a=48271,n._c=0},67676:(e,t,r)=>{"use strict";r.d(t,{FY:()=>m,Od:()=>y,SO:()=>d,Vx:()=>i,a9:()=>u,cq:()=>p,e$:()=>b,e5:()=>a,fS:()=>s,w6:()=>f,zG:()=>c});var n=r(70586),o=r(77734);function s(e,t,r){if((0,n.Wi)(e)&&(0,n.Wi)(t))return!0;if((0,n.Wi)(e)||(0,n.Wi)(t)||e.length!==t.length)return!1;if(r){for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1}else for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function i(e,t){let r=e.length!==t.length;e.length=t.length;for(let n=0;n<t.length;++n)e[n]!==t[n]&&(e[n]=t[n],r=!0);return r}function a(e,t,r){let n,o;return r?(n=t.filter((t=>!e.some((e=>r(e,t))))),o=e.filter((e=>!t.some((t=>r(t,e)))))):(n=t.filter((t=>!e.includes(t))),o=e.filter((e=>!t.includes(e)))),{added:n,removed:o}}function c(e){return e&&"number"==typeof e.length}const l=!!Array.prototype.fill;function u(e,t){if(l)return new Array(e).fill(t);const r=new Array(e);for(let n=0;n<e;n++)r[n]=t;return r}function f(e,t){void 0===t&&(t=e,e=0);const r=new Array(t-e);for(let n=e;n<t;n++)r[n-e]=n;return r}class d{constructor(){this.last=0}}const h=new d;function p(e,t,r,n){n=n||h;const o=Math.max(0,n.last-10);for(let s=o;s<r;++s)if(e[s]===t)return n.last=s,s;const s=Math.min(o,r);for(let r=0;r<s;++r)if(e[r]===t)return n.last=r,r;return-1}function b(e,t,r,n){const o=r??e.length,s=p(e,t,o,n);if(-1!==s)return e[s]=e[o-1],null==r&&e.pop(),t}const g=new Set;function m(e,t,r=e.length,n=t.length,o,s){if(0===n||0===r)return r;g.clear();for(let e=0;e<n;++e)g.add(t[e]);o=o||h;const i=Math.max(0,o.last-10);for(let t=i;t<r;++t)if(g.has(e[t])&&(s&&s.push(e[t]),g.delete(e[t]),e[t]=e[r-1],--r,--t,0===g.size||0===r))return g.clear(),r;for(let t=0;t<i;++t)if(g.has(e[t])&&(s&&s.push(e[t]),g.delete(e[t]),e[t]=e[r-1],--r,--t,0===g.size||0===r))return g.clear(),r;return g.clear(),r}function y(e,t){const r=e.indexOf(t);return-1!==r?(e.splice(r,1),t):null}new o.Z},60235:(e,t,r)=>{"use strict";r.d(t,{Mr:()=>i,x9:()=>a});var n=r(80442);const o=new Set;function s(e,t,r=!1){r&&o.has(t)||(r&&o.add(t),e.warn(`🛑 DEPRECATED - ${t}`))}function i(e,t,r={}){if((0,n.Z)("esri-deprecation-warnings")){const{moduleName:n}=r;a(e,"Property: "+(n?n+"::":"")+t,r)}}function a(e,t,r={}){if((0,n.Z)("esri-deprecation-warnings")){const{replacement:n,version:o,see:i,warnOnce:a}=r;let c=t;n&&(c+=`\n\t🛠️ Replacement: ${n}`),o&&(c+=`\n\t⚙️ Version: ${o}`),i&&(c+=`\n\t🔗 See ${i} for more details.`),s(e,c,a)}}},91460:(e,t,r)=>{"use strict";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,{IH:()=>s,on:()=>o,vT:()=>n})},80442:(e,t,r)=>{"use strict";let n;function o(e){return"function"==typeof n[e]?n[e]=n[e](globalThis):n[e]}r.d(t,{Z:()=>o}),n=globalThis.dojoConfig?.has||globalThis.esriConfig?.has?{...globalThis.dojoConfig?.has,...globalThis.esriConfig?.has}:{},o.add=(e,t,r,s)=>((s||void 0===n[e])&&(n[e]=t),r&&o(e)),o.cache=n,o.add("esri-deprecation-warnings",!0),(()=>{o.add("host-webworker",void 0!==globalThis.WorkerGlobalScope&&self instanceof globalThis.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(o.add("host-browser",e),o.add("host-node","object"==typeof globalThis.process&&globalThis.process.versions?.node&&globalThis.process.versions.v8),o.add("dom",e),o("host-browser")){const e=navigator,t=e.userAgent,r=e.appVersion,n=parseFloat(r);if(o.add("wp",parseFloat(t.split("Windows Phone")[1])||void 0),o.add("msapp",parseFloat(t.split("MSAppHost/")[1])||void 0),o.add("khtml",r.includes("Konqueror")?n:void 0),o.add("edge",parseFloat(t.split("Edge/")[1])||void 0),o.add("opr",parseFloat(t.split("OPR/")[1])||void 0),o.add("webkit",!o("wp")&&!o("edge")&&parseFloat(t.split("WebKit/")[1])||void 0),o.add("chrome",!o("edge")&&!o("opr")&&parseFloat(t.split("Chrome/")[1])||void 0),o.add("android",!o("wp")&&parseFloat(t.split("Android ")[1])||void 0),o.add("safari",!r.includes("Safari")||o("wp")||o("chrome")||o("android")||o("edge")||o("opr")?void 0:parseFloat(r.split("Version/")[1])),o.add("mac",r.includes("Macintosh")),!o("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,""));o.add(e,n),o.add("ios",n)}o.add("trident",parseFloat(r.split("Trident/")[1])||void 0),o("webkit")||(!t.includes("Gecko")||o("wp")||o("khtml")||o("trident")||o("edge")||o.add("mozilla",n),o("mozilla")&&o.add("ff",parseFloat(t.split("Firefox/")[1]||t.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),r=/iPhone/i.test(e);t&&o.add("esri-mobile",t),r&&o.add("esri-iPhone",r),o.add("esri-geolocation",!!navigator.geolocation)}o.add("esri-canvas-svg-support",!o("trident")),o.add("esri-wasm","WebAssembly"in globalThis),o.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in globalThis,t=!1===globalThis.crossOriginIsolated;return e&&!t})),o.add("wasm-simd",(()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])))),o.add("esri-atomics","Atomics"in globalThis),o.add("esri-workers","Worker"in globalThis),o.add("web-feat:cache","caches"in globalThis),o.add("esri-workers-arraybuffer-transfer",!o("safari")||Number(o("safari"))>=12),o.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),o.add("featurelayer-simplify-payload-size-factors",[1,1,4]),o.add("featurelayer-snapshot-enabled",!0),o.add("featurelayer-snapshot-point-min-threshold",8e4),o.add("featurelayer-snapshot-point-max-threshold",4e5),o.add("featurelayer-snapshot-point-coverage",.1),o.add("featurelayer-advanced-symbols",!1),o.add("featurelayer-pbf",!0),o.add("featurelayer-pbf-statistics",!1),o.add("feature-layers-workers",!0),o.add("feature-polyline-generalization-factor",1),o.add("mapview-transitions-duration",200),o.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),o.add("mapserver-pbf-enabled",!1),o.add("mapimagelayer-popup-identify-max-tolerance",20),o.add("heatmap-allow-raster-fallback",!0),o.add("heatmap-force-raster",!1),o("host-webworker")||o("host-browser")&&(o.add("esri-csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),o.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((()=>{o.add("esri-image-decode",!0,!0,!0)})).catch((()=>{o.add("esri-image-decode",!1,!0,!0)}))}return!1})),o.add("esri-url-encodes-apostrophe",(()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")})))})()},22974:(e,t,r)=>{"use strict";r.d(t,{Vo:()=>c,d9:()=>a,fS:()=>p,y7:()=>b,yd:()=>i});var n=r(67676),o=(r(80442),r(70586)),s=r(1533);function i(e,t){let r;if(t)for(r in e)e.hasOwnProperty(r)&&(void 0===e[r]?delete e[r]:e[r]instanceof Object&&i(e[r],!0));else for(r in e)e.hasOwnProperty(r)&&void 0===e[r]&&delete e[r];return e}function a(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;const t=h(e);if((0,o.pC)(t))return t;if(l(e))return e.clone();if(u(e))return e.map(a);if(f(e))return e.clone();const r={};for(const t of Object.getOwnPropertyNames(e))r[t]=a(e[t]);return r}function c(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;const t=h(e);if((0,o.pC)(t))return t;if(u(e)){let t=!0;const r=e.map((e=>{const r=c(e);return null!=e&&null==r&&(t=!1),r}));return t?r:null}if(l(e))return e.clone();if(!f(e)){const t=new(0,Object.getPrototypeOf(e).constructor);for(const r of Object.getOwnPropertyNames(e)){const n=e[r],o=c(n);if(null!=n&&null==o)return null;t[r]=o}return t}return null}function l(e){return"function"==typeof e.clone}function u(e){return"function"==typeof e.map&&"function"==typeof e.forEach}function f(e){return"function"==typeof e.notifyChange&&"function"==typeof e.watch}function d(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function h(e){if((0,s.W0)(e)||(0,s.lq)(e)||(0,s.KZ)(e)||(0,s.z3)(e)||(0,s.Uc)(e)||(0,s.Hx)(e)||(0,s.ZY)(e)||(0,s.xZ)(e)||(0,s.fS)(e))return(0,s.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,a(e))})),t}if(e instanceof Set){const t=new Set;return e.forEach((e=>{t.add(a(e))})),t}return null}function p(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}function b(e,t){return e===t||(null==e||"string"==typeof e?e===t:"number"==typeof e?e===t||"number"==typeof t&&isNaN(e)&&isNaN(t):e instanceof Date?t instanceof Date&&e.getTime()===t.getTime():Array.isArray(e)?Array.isArray(t)&&(0,n.fS)(e,t):e instanceof Set?t instanceof Set&&function(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}(e,t):e instanceof Map?t instanceof Map&&function(e,t){if(e.size!==t.size)return!1;for(const[r,n]of e){const e=t.get(r);if(e!==n||void 0===e&&!t.has(r))return!1}return!0}(e,t):!!d(e)&&d(t)&&function(e,t){if(null===e||null===t)return!1;const r=Object.keys(e);if(null===t||Object.keys(t).length!==r.length)return!1;for(const n of r)if(e[n]!==t[n]||!Object.prototype.hasOwnProperty.call(t,n))return!1;return!0}(e,t))}},70586:(e,t,r)=>{"use strict";function n(e){return null!=e}function o(e){return null==e}function s(e,t){return n(e)?t(e):null}function i(e){return e}function a(e,t){if(o(e))throw new Error(t);return e}function c(e,t){return n(e)?e:"function"==typeof t?t():t}function l(e,t){return n(e)?e:t}function u(e){return n(e)&&e.destroy(),null}function f(e){return n(e)&&e.dispose(),null}function d(e){return n(e)&&e.remove(),null}function h(e){return n(e)&&e.abort(),null}function p(e){return n(e)&&e.release(),null}function b(e,t,r){return n(e)&&n(t)?n(r)?r(e,t):e.equals(t):e===t}function g(e){return null}function m(e,t){const r=new Array;for(const n of e)r.push(w(n,null,t));return r}function y(e,t){for(const r of e)s(r,t)}function w(e,t,r){return n(e)?r(e):t}function v(e){return e.filter((e=>n(e)))}function _(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,{Bd:()=>g,Fd:()=>m,IM:()=>h,JR:()=>y,O3:()=>f,Pt:()=>c,R2:()=>w,RY:()=>p,SC:()=>u,U2:()=>_,Wg:()=>i,Wi:()=>o,_W:()=>b,hw:()=>d,j0:()=>O,lV:()=>v,pC:()=>n,s3:()=>a,yl:()=>l,yw:()=>s})},78286:(e,t,r)=>{"use strict";r.d(t,{RB:()=>i,RH:()=>o,hS:()=>s});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(((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=>{s.includes(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)=>{"use strict";r.d(t,{e4:()=>O,zE:()=>c,dD:()=>w,hh:()=>C,Ds:()=>P,as:()=>v,WW:()=>_,R8:()=>y,D_:()=>m,Hc:()=>f,y8:()=>k,fu:()=>p,$F:()=>b,r9:()=>d,k_:()=>l,H9:()=>h,Yn:()=>j,gx:()=>S,Hl:()=>g});const n=(o=globalThis,{setTimeout:(e,t)=>{const r=o.setTimeout(e,t);return{remove:()=>o.clearTimeout(r)}}});var o;r(60235);var s=r(20102),i=r(91460),a=(r(92604),r(70586));function c(e="Aborted"){return new s.Z("AbortError",e)}function l(e,t="Aborted"){if(f(e))throw c(t)}function u(e){return(0,a.pC)(e)?"aborted"in e?e:e.signal:e}function f(e){const t=u(e);return(0,a.pC)(t)&&t.aborted}function d(e){if(m(e))throw e}function h(e){if(!m(e))throw e}function p(e,t){const r=u(e);if(!(0,a.Wi)(r)){if(!r.aborted)return(0,i.IH)(r,"abort",(()=>t()));t()}}function b(e,t){const r=u(e);if(!(0,a.Wi)(r))return l(r),(0,i.IH)(r,"abort",(()=>t(c())))}function g(e,t){const r=u(t);return(0,a.Wi)(r)?e:new Promise(((r,n)=>{let o=p(t,(()=>n(c())));const s=()=>o=(0,a.hw)(o);e.then(s,s),e.then(r,n)}))}function m(e){return"AbortError"===e?.name}async function y(e){try{return await e}catch(e){if(!m(e))throw e;return}}function w(){let e=null;const t=new Promise(((t,r)=>{e={promise:void 0,resolve:t,reject:r}}));return e.promise=t,e}async function v(e){if(!e)return;if("function"!=typeof e.forEach){const t=Object.keys(e),r=t.map((t=>e[t])),n=await v(r),o={};return t.map(((e,t)=>o[e]=n[t])),o}const t=e;return new Promise((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)}))}))}))}async function _(e){return(await v(e)).filter((e=>!!e.value)).map((e=>e.value))}function O(e,t,r){const n=new AbortController;return p(r,(()=>n.abort())),new Promise(((r,o)=>{let s=setTimeout((()=>{s=0,r(t)}),e);p(n,(()=>{s&&(clearTimeout(s),o(c()))}))}))}function k(e){return e&&"function"==typeof e.then}function S(e){return k(e)?e:Promise.resolve(e)}function P(e,t=-1){let r,n,o,s,i=null;const l=(...u)=>{if(r){n=u,s&&s.reject(c()),s=w();const e=(0,a.j0)(s.promise);if(i){const e=i;i=null,e.abort()}return e}if(o=s||w(),s=null,t>0){const n=new AbortController;r=S(e(...u,n.signal));const o=r;O(t).then((()=>{r===o&&(s?n.abort():i=n)}))}else r=1,r=S(e(...u));const f=()=>{const e=n;n=o=r=i=null,null!=e&&l(...e)},d=r,h=o;return d.then(f,f),d.then(h.resolve,h.reject),(0,a.j0)(h.promise)};return l}function C(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n})),o=t=>{e(t)};return o.resolve=t=>e(t),o.reject=e=>t(e),o.timeout=(e,t)=>n.setTimeout((()=>o.reject(t)),e),o.promise=r,o}async function j(e){await Promise.resolve(),l(e)}},19153:(e,t,r)=>{"use strict";r.d(t,{Cb:()=>l,Qs:()=>a,gx:()=>i,hP:()=>c});var n=r(78286);const o=/\{([^\}]+)\}/g;function s(e){return 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&&t.includes(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 l(e){return(new DOMParser).parseFromString(e||"","text/html").body.innerText||""}},1533:(e,t,r)=>{"use strict";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 l(e){return e instanceof Int16Array||e&&e.constructor&&"Int16Array"===e.constructor.name}function u(e){return e instanceof Uint16Array||e&&e.constructor&&"Uint16Array"===e.constructor.name}function f(e){return e instanceof Int32Array||e&&e.constructor&&"Int32Array"===e.constructor.name}function d(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,Hx:()=>f,KZ:()=>c,Uc:()=>u,W0:()=>i,ZY:()=>d,eP:()=>s,fS:()=>p,lq:()=>a,tP:()=>o,xZ:()=>h,z3:()=>l})},17452:(e,t,r)=>{"use strict";r.d(t,{$U:()=>ne,AH:()=>V,B7:()=>j,D6:()=>U,Fv:()=>Z,HK:()=>K,Hu:()=>de,Ie:()=>ue,L:()=>k,Ml:()=>be,P$:()=>B,PF:()=>F,Qj:()=>le,R9:()=>y,TI:()=>O,YP:()=>H,Yd:()=>ae,ZN:()=>he,_l:()=>X,b7:()=>A,ed:()=>N,fl:()=>pe,hF:()=>q,hO:()=>oe,io:()=>ee,jc:()=>z,kl:()=>L,mN:()=>S,oC:()=>te,oh:()=>W,qg:()=>E,rS:()=>Q,sJ:()=>Y,tD:()=>$,tm:()=>I,u0:()=>P,v_:()=>D,vt:()=>ce});var n=r(68773),o=r(20102),s=r(92604),i=r(70586);const a=s.Z.getLogger("esri.core.urlUtils"),c=n.Z.request,l="esri/config: esriConfig.request.proxyUrl is not set.",u=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,f=/^\s*http:/i,d=/^\s*https:/i,h=/^\s*file:/i,p=/:\d+$/,b=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,g=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),m=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class y{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(m)),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 w={};let v=new y(n.Z.applicationUrl);let _=function(){const e=(0,i.j0)(v.path),t=e.substring(0,e.lastIndexOf(e.split("/")[e.split("/").length-1]));return`${v.scheme}://${v.host}${null!=v.port?`:${v.port}`:""}${t}`}();const O=()=>v,k=()=>_;function S(e){const t={path:null,query:null},r=new y(e),n=e.indexOf("?");return null===r.query?t.path=e:(t.path=e.substring(0,n),t.query=P(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 P(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 j(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 A(e=!1){let t,r=c.proxyUrl;if("string"==typeof e){t=ne(e);const n=N(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw a.warn(l),new o.Z("urlutils:proxy-not-set",l);return t&&se()&&(r=oe(r)),S(r)}function E(e){const t=N(e);let r,n;if(t){const e=x(t.proxyUrl);r=e.path,n=e.query?P(e.query):null}if(r){const t=S(e);e=r+"?"+t.path;const o=j({...n,...t.query});o&&(e=`${e}?${o}`)}return e}const T={path:"",query:""};function x(e){const t=e.indexOf("?");return-1!==t?(T.path=e.slice(0,t),T.query=e.slice(t+1)):(T.path=e,T.query=null),T}function M(e){return(e=ie(e=function(e){return e&&"/"===e[e.length-1]?e:`${e}/`}(e=x(e).path),!0)).toLowerCase()}function $(e){const t={proxyUrl:e.proxyUrl,urlPrefix:M(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 N(e){const t=c.proxyRules,r=M(e);for(let e=0;e<t.length;e++)if(0===r.indexOf(t[e].urlPrefix))return t[e]}function I(e,t){return e=R(e),t=R(t),ie(e)===ie(t)}function R(e){const t=(e=Z(e)).indexOf("/sharing");return t>0?e.substring(0,t):e.replace(/\/+$/,"")}function W(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 U(e,t,r=!1){if(!e||!t)return!1;const n=fe(e),o=fe(t);return!(!r&&n.scheme!==o.scheme)&&null!=n.host&&null!=o.host&&n.host.toLowerCase()===o.host.toLowerCase()&&n.port===o.port}function L(e){if("string"==typeof e){if(!H(e))return!0;e=fe(e)}if(U(e,v))return!0;const t=c.trustedServers||[];for(let r=0;r<t.length;r++){const n=J(t[r]);for(let t=0;t<n.length;t++)if(U(e,n[t]))return!0}return!1}function J(e){return w[e]||(re(e)||te(e)?w[e]=[new y(q(e))]:w[e]=[new y(`http://${e}`),new y(`https://${e}`)]),w[e]}function q(e,t=_,r){return te(e)?r&&r.preserveProtocolRelative?e:"http"===v.scheme&&v.authority===B(e).slice(2)?`http:${e}`:`https:${e}`:re(e)?e:(0,i.j0)(D("/"===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 F(e,t=_,r){if(null==e||!H(e))return e;const n=Z(e),o=n.toLowerCase(),s=Z(t).toLowerCase().replace(/\/+$/,""),i=r?Z(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),l=-1;for(;o.slice(0,c+1)===s.slice(0,c)+"/"&&(l=c+1,c!==o.length);)c=a(o,"/",c+1);if(-1===l)return e;if(i&&l<i.length)return e;e=n.slice(l);const u=s.slice(l-1).replace(/[^/]+/g,"").length;if(u>0)for(let t=0;t<u;t++)e=`../${e}`;else e=`./${e}`;return e}function Z(e){return function(e){const t=c.httpsDomains;if(!function(e){return null!=e&&f.test(e)||"http"===v.scheme&&te(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"===v.scheme&&n===v.authority&&!b.test(e)||(se()&&n===v.authority||t&&t.some((e=>n===e||n.endsWith(`.${e}`)))||se()&&!N(e))&&(e=oe(e)),e}(e=function(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}(e=function(e){if(/^https?:\/\//i.test(e)){const t=x(e);e=(e=t.path.replace(/\/{2,}/g,"/")).replace("/","//"),t.query&&(e+=`?${t.query}`)}return e}(e=q(e=e.trim()))))}function D(...e){const t=e.filter(i.pC);if(!t||!t.length)return;const r=[];if(H(t[0])){const e=t[0],n=e.indexOf("//");-1!==n&&(r.push(e.slice(0,n+1)),function(e){return null!=e&&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 B(e,t=!1){if(null==e||z(e)||K(e))return null;let r=e.indexOf("://");if(-1===r&&te(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=ie(e,!0)),e}function H(e){return te(e)||re(e)}function z(e){return null!=e&&"blob:"===e.slice(0,5)}function K(e){return null!=e&&"data:"===e.slice(0,5)}function V(e){const t=Y(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}function Q(e){return btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const G=/^data:(.*?)(;base64)?,(.*)$/;function Y(e){const t=e.match(G);if(!t)return null;const[,r,n,o]=t;return{mediaType:r,isBase64:!!n,data:o}}function X(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}function ee(e,t){(function(e,t){if(!e)return!1;const r=document.createElement("a");if(!("download"in r))return!1;const n=URL.createObjectURL(e);return r.download=t,r.href=n,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),!0})(e,t)||function(e,t){!!window.navigator.msSaveOrOpenBlob&&window.navigator.msSaveOrOpenBlob(e,t)}(e,t)}function te(e){return null!=e&&"/"===e[0]&&"/"===e[1]}function re(e){return null!=e&&u.test(e)}function ne(e){return null!=e&&d.test(e)||"https"===v.scheme&&te(e)}function oe(e){return te(e)?`https:${e}`:e.replace(f,"https:")}function se(){return"https"===v.scheme}function ie(e,t=!1){return te(e)?e.slice(2):(e=e.replace(u,""),t&&e.length>1&&"/"===e[0]&&"/"===e[1]&&(e=e.slice(2)),e)}function ae(e){let t=0;if(H(e)){const r=e.indexOf("//");-1!==r&&(t=r+2)}const r=e.lastIndexOf("/");return r<t?e:e.slice(0,r+1)}function ce(e,t){if(!e)return"";const r=S(e).path.replace(/\/+$/,""),n=r.substring(r.lastIndexOf("/")+1);if(!t?.length)return n;const o=new RegExp(`.(${t.join("|")})$`,"ig");return n.replace(o,"")}function le(e){return e.replace(/\/+$/,"")}function ue(e,t,r){if(!(t&&r&&e&&H(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 fe(e){return"string"==typeof e?new y(q(e)):(e.scheme||(e.scheme=v.scheme),e)}function de(e,t){const r=S(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 he(e,t,r){const n=S(e),o=n.query||{};return o[t]=String(r),`${n.path}?${j(o)}`}function pe(e,t){const r=S(e),n=r.query||{};for(const e in t)n[e]=t[e];const o=j(n);return o?`${r.path}?${o}`:r.path}function be(e){if((0,i.Wi)(e))return null;const t=e.match(ge);return t?t[1]:null}const ge=/.*?\.([^\/]*)$/},25045:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>y});var n=r(40330),o=r(20102),s=r(91460),i=r(70586),a=r(95330),c=r(94362),l=r(17202);const u={statsWorker:()=>Promise.all([r.e(1400),r.e(1562),r.e(9293),r.e(6841)]).then(r.bind(r,36841)),geometryEngineWorker:()=>Promise.all([r.e(5837),r.e(8227)]).then(r.bind(r,48227)),CSVSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(4478)]).then(r.bind(r,14478)),EdgeProcessingWorker:()=>Promise.all([r.e(6481),r.e(9594)]).then(r.bind(r,49594)),ElevationSamplerWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(6481),r.e(6459),r.e(1438)]).then(r.bind(r,61787)),FeatureServiceSnappingSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(8494),r.e(6208)]).then(r.bind(r,2255)),GeoJSONSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(7845)]).then(r.bind(r,97845)),LercWorker:()=>r.e(3027).then(r.bind(r,23027)),MemorySourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(639)]).then(r.bind(r,30639)),PBFDecoderWorker:()=>Promise.all([r.e(1400),r.e(1562),r.e(5886),r.e(802)]).then(r.bind(r,10802)),Pipeline:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(8494),r.e(4325),r.e(908)]).then(r.bind(r,61837)),PointCloudWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(7789)]).then(r.bind(r,16583)),RasterWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(176),r.e(2398),r.e(8061)]).then(r.bind(r,61576)),SceneLayerSnappingSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(6481),r.e(2631),r.e(934)]).then(r.bind(r,40614)),SceneLayerWorker:()=>Promise.all([r.e(3739),r.e(1412)]).then(r.bind(r,31412)),WFSSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(3230)]).then(r.bind(r,43230)),WorkerTileHandler:()=>Promise.all([r.e(4325),r.e(1785),r.e(6810),r.e(3388)]).then(r.bind(r,56456))},{CLOSE:f,ABORT:d,INVOKE:h,RESPONSE:p,OPEN_PORT:b,ON:g}=c.Cs;class m{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===c.Cs.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class y{constructor(e,t,r){this._port=e,this._getNextJob=r,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new m((e=>this._onInvokeMessage(e))),this._client=t.client,this._onMessage=this._onMessage.bind(this),this._channel=t.channel,this._schedule=t.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}static connect(e){const t=new MessageChannel;let r;r="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const n=new y(t.port1,{channel:t,client:r},(()=>null));return"object"==typeof r&&"remoteClient"in r&&(r.remoteClient=n),y.clients.set(n,r),t.port2}static loadWorker(e){const t=u[e];return t?t():Promise.resolve(null)}close(){this._post({type:f}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,r){const n=r&&r.signal,s=r&&r.transferList;if(!this._port)return Promise.reject(new o.Z("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const l=(0,c.jt)();return new Promise(((r,o)=>{if((0,a.Hc)(n))return this._processWork(),void o((0,a.zE)());const c=(0,a.fu)(n,(()=>{const e=this._outJobs.get(l);e&&(this._outJobs.delete(l),this._processWork(),(0,i.hw)(e.abortHandle),this._post({type:d,jobId:l}),o((0,a.zE)()))})),u={resolve:r,reject:o,abortHandle:c,debugInfo:e};this._outJobs.set(l,u),this._post({type:h,jobId:l,methodName:e,abortable:null!=n},t,s)}))}on(e,t){const r=new MessageChannel;function n(e){t(e.data)}return this._port.postMessage({type:c.Cs.ON,eventType:e,port:r.port2},[r.port2]),r.port1.addEventListener("message",n),r.port1.start(),{remove(){r.port1.postMessage({type:c.Cs.CLOSE}),r.port1.close(),r.port1.removeEventListener("message",n)}}}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:b,port:e.port2}),e.port1}_processWork(){if(this._outJobs.size>=2)return;const e=this._getNextJob();if(!e)return;const{methodName:t,data:r,invokeOptions:n,deferred:o}=e;this.invoke(t,r,n).then((e=>o.resolve(e))).catch((e=>o.reject(e)))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{(0,i.hw)(e.abortHandle),e.reject((0,a.zE)(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=this._client=this._schedule=null}_onMessage(e){(0,i.pC)(this._schedule)?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const t=(0,c.QM)(e);if(t)switch(t.type){case p:this._onResponseMessage(t);break;case h:this._invokeQueue.push(t);break;case d:this._onAbortMessage(t);break;case f:this._onCloseMessage();break;case b:this._onOpenPortMessage(t);break;case g:this._onOnMessage(t)}}_onAbortMessage(e){const t=this._inJobs,r=e.jobId,n=t.get(r);this._invokeQueue.push(e),n&&(n.controller&&n.controller.abort(),t.delete(r))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&y.clients.get(this)===e&&e.destroy(),y.clients.delete(this),e&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:t,jobId:r,data:n,abortable:o}=e,s=o?new AbortController:null,i=this._inJobs;let l,u=this._client,f=u[t];try{if(!f&&t&&t.includes(".")){const e=t.split(".");for(let t=0;t<e.length-1;t++)u=u[e[t]],f=u[e[t+1]]}if("function"!=typeof f)throw new TypeError(`${t} is not a function`);l=f.call(u,n,{client:this,signal:s?s.signal:null})}catch(e){return void this._post({type:p,jobId:r,error:(0,c.AB)(e)})}(0,a.y8)(l)?(i.set(r,{controller:s,promise:l}),l.then((e=>{i.has(r)&&(i.delete(r),this._post({type:p,jobId:r},e))}),(e=>{i.has(r)&&(i.delete(r),(0,a.D_)(e)||this._post({type:p,jobId:r,error:(0,c.AB)(e||{message:`Error encountered at method ${t}`})}))}))):this._post({type:p,jobId:r},l)}_onOpenPortMessage(e){new y(e.port,{client:this._client},(()=>null))}_onOnMessage(e){const{port:t}=e,r=this._client.on(e.eventType,(e=>{t.postMessage(e)})),n=(0,s.on)(e.port,"message",(e=>{(0,c.QM)(e)?.type===c.Cs.CLOSE&&(n.remove(),r.remove(),t.close())}))}_onResponseMessage(e){const{jobId:t,error:r,data:n}=e,s=this._outJobs;if(!s.has(t))return;const a=s.get(t);s.delete(t),this._processWork(),(0,i.hw)(a.abortHandle),r?a.reject(o.Z.fromJSON(JSON.parse(r))):a.resolve(n)}_post(e,t,r){return(0,c.oi)(this._port,e,t,r)}}y.kernelInfo={revision:l.$,version:n.i8,buildDate:l.r},y.clients=new Map},94362:(e,t,r)=>{"use strict";r.d(t,{AB:()=>a,Cs:()=>n,QM:()=>l,jt:()=>i,oi:()=>c});var n,o=r(80442);!function(e){e[e.HANDSHAKE=0]="HANDSHAKE",e[e.OPEN=1]="OPEN",e[e.OPENED=2]="OPENED",e[e.RESPONSE=3]="RESPONSE",e[e.INVOKE=4]="INVOKE",e[e.ABORT=5]="ABORT",e[e.CLOSE=6]="CLOSE",e[e.OPEN_PORT=7]="OPEN_PORT",e[e.ON=8]="ON"}(n||(n={}));let s=0;function i(){return s++}function a(e){return e?"string"==typeof e?JSON.stringify({name:"message",message:e}):e.toJSON?JSON.stringify(e):JSON.stringify({name:e.name,message:e.message,details:e.details||{stack:e.stack}}):null}function c(e,t,r,o){if(t.type===n.OPEN_PORT)return void e.postMessage(t,[t.port]);if(t.type!==n.INVOKE&&t.type!==n.RESPONSE)return void e.postMessage(t);let s;!function(e){return e&&"object"==typeof e&&("result"in e||"transferList"in e)}(r)?(s=u(o),t.data=r):(s=u(r.transferList),t.data=r.result),s?e.postMessage(t,s):e.postMessage(t)}function l(e){if(!e)return null;const t=e.data;return t?"string"==typeof t?JSON.parse(t):t:null}function u(e){if(!e||!e.length)return null;if((0,o.Z)("esri-workers-arraybuffer-transfer"))return e;const t=e.filter((e=>!function(e){return e instanceof ArrayBuffer||e&&e.constructor&&"ArrayBuffer"===e.constructor.name}(e)));return t.length?t:null}},40330:(e,t,r)=>{"use strict";r.d(t,{Dp:()=>l,Nv:()=>i,i8:()=>s,id:()=>a,qh:()=>c});var n=r(80442),o=r(17452);const s="4.25",i={async request(e,t){const{default:n}=await r.e(3172).then(r.bind(r,3172)),s=e.options,i=s.responseType;s.signal=t?.signal,s.responseType="native"===i||"native-request-init"===i?"native-request-init":i&&["blob","json","text"].includes(i)&&(0,o.oh)(e.url)?.after?i:"array-buffer";const a=await n(e.url,s),c={data:a.data,ssl:a.ssl};switch(a.requestOptions?.responseType){case"native-request-init":return delete c.data.signal,c;case"blob":c.data=await c.data.arrayBuffer();break;case"json":c.data=(new TextEncoder).encode(JSON.stringify(c.data)).buffer;break;case"text":c.data=(new TextEncoder).encode(c.data).buffer}return{result:c,transferList:[c.data]}}};let a;function c(e){a=e}function l(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")},17202:(e,t,r)=>{"use strict";r.d(t,{$:()=>o,r:()=>n});const n="20220729",o="9b764948c15937e3a0744a4ac3b5d4a4f1507d54"}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.m=e,r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((t,n)=>(r.f[n](e,t),t)),[])),r.u=e=>"chunks/"+{24:"92f7415c2e40e320addc",176:"888d8e4471c9a2cd5009",247:"b24a76738482ebfc626f",280:"30d7796ee6f7e4a6a3e1",461:"fde2301c6cd97a3cfb86",565:"bbff8ed3192fe22a6b6d",576:"7fdd029a76a7ab1c3d83",639:"1537b8744b2dab81b601",734:"d81bcc85ceb91bbba69f",739:"37abe133c61e31c04204",802:"01160ad0aba069a80ac4",819:"5d3e774ce7b006c8cba8",908:"0c145b87c24bf6c7d572",934:"d02881954c0cc0d39dfb",1197:"3228293c159886513f60",1400:"5821d3a6499d8e84f48a",1408:"993f105c983d81a208d1",1412:"ff48d82c240950273de2",1421:"6196cfdeb91ceba52af3",1423:"698eaae866cf97a56541",1433:"dfdd853dd6c023089963",1438:"1b3733100b9fa41905d0",1491:"0111443107e3c793cd89",1534:"c912ae9afa1997a6e1bb",1562:"377354a81e402edf3077",1761:"83b5760b9bd71ff7a261",1773:"3a61e4ab83183f5526a7",1785:"3b5be512567d9c1c6fe6",1819:"afb74623cce5dfd0e4de",1938:"fc6423ca92289c739e19",2133:"f59f82a43437a51c934c",2134:"4f2d2cc71f5ff5ac2a60",2398:"bc1155973f3d84371df7",2485:"405b8535631c30162b01",2630:"cc0a0782b8b9f6ec511e",2631:"8e146ba7aed3991a2777",2664:"48c8ac9a22190c2b890c",2723:"8b0b4a6b19f3e26c06ee",2812:"ae8e87da97411cff3783",2855:"d595f2c41e3bd1b33e07",2916:"3485e2342f44e4d760a2",3027:"425d1fabc713a598139c",3121:"8caeb7c52816b582553f",3128:"54b01d2a4aba08d7e16b",3172:"fe84bcdfd9028b5e7ef6",3230:"016b54572465ad54c08a",3388:"652d36523efbe5c9ebb2",3529:"9341e9e1fe0f6800aa44",3668:"0896986aa60516f716f1",3723:"cafad818d72647dc5092",3739:"3538bb8545bdf1fe644f",3750:"28ecf5c49144903fbf68",3852:"b71a0a8a2f446c671161",3974:"e661dfce40f6064d05c6",4109:"f40290cfad3fe6fb4ef9",4133:"f039a029515be17164c0",4166:"93c945099be3a4f43263",4286:"037e666f6a7ad1def59c",4325:"d91140bc583925e4faf6",4358:"71a4618d959a09302c51",4417:"4ba51f56f9b82aa616ff",4475:"d10cb53bc07963d87311",4477:"de46fe79391f11d09d42",4478:"f6f44022482fcd13dcb5",4499:"577679f302c26ba4060a",4547:"038242c6b5a37de1be92",4695:"81074accfce5f109f909",4720:"4daed788b965c26d76ec",4889:"17be5bd0d1c233d73d7a",4910:"86f99e7078f427ad929f",5001:"35f3f714d6faa88b0c0c",5235:"7773b9415c5a8d82973f",5329:"c8a3a28809542396c6fd",5642:"1751de504354d98ac3fd",5787:"a23376df9696ebe5b5cd",5837:"bc682351fc915b4ab5a6",5853:"f298a70f3b6f27675d53",5886:"821a0754eae11421e56a",5906:"a3566b99bceaf173997b",6110:"374ee2b2cad26f7ad572",6130:"92e43e05265dfc8173a0",6199:"fadc0c18d52fffc29482",6208:"579ba109718bc2554008",6233:"4cb64ccb5fba126f9a66",6237:"c544df83e86a9d36b68c",6312:"c4db05de1cd997ee2fac",6459:"8b1d5b7e9de73bc9da3a",6481:"1570676351a313f1841b",6690:"1db150b26a4a3af2486f",6710:"d828a0656e7351a74fc4",6748:"61ddd479abf2c97dd408",6774:"c8402e32307a7b7eaaeb",6810:"4a7aa1b9de61eb013647",6841:"0e3e2276665d8e466379",6920:"8b94a400a04e7a803dc4",6968:"d1d71c1516ae00a0b4f1",7126:"c3c05fd41d88d6ab013b",7175:"2504c43fac77ecd9ec2a",7202:"51dc5863b815a89249ff",7277:"613fffcc5a1e81f370a6",7304:"b58eab838bd5c3a7961a",7374:"f9d744ba6bbd7c1dd689",7572:"43e7ef49b3f50cca6f8f",7789:"da54483123f377e9b3e1",7845:"9480f870574d3a9d4053",7873:"93eb468381bfcf0e47d7",8008:"823e25dbc70e71257b6e",8061:"112cb75f07c611d327f9",8062:"69f57ad2227e59b323e8",8096:"3c9da9b88777700879aa",8163:"9dc4db35c387e11e9beb",8227:"76b424b6d2c1ef089324",8326:"3fcb0d2c45e276ce355e",8422:"1e7d6920c4d176093ca8",8494:"8e0540562e433ff17a3b",8636:"f5d10ea7b8888f822b0c",8758:"ce546851aa7f48585494",8828:"92e1fd97afcdbb719e3f",8899:"b81c0d35f169a7df25c0",9032:"1f4f1896880bfa6801c5",9070:"3281656a9bd3627e41ff",9147:"d4ae3a25ec5b4773cfcc",9153:"ff6ebc9c3890a9e28e12",9169:"76b75ac18c8239687321",9228:"4d14be8c7e8adaa91876",9291:"ed763fc352d0b55e5867",9293:"073c067956c6cd792384",9296:"f0d1b51492106fda3efe",9348:"f1fdb335c5f9ec8b27cb",9454:"1a360d839c4eb83aaa02",9594:"9d824cdfbcdf3cb3246f",9779:"9b8711ba50ebaec535f8",9884:"356db8b8297282c77291",9904:"cf3e1ac63580bc495ea6",9932:"2f60073d3f14fdfba457"}[e]+".js",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={134:1};r.f.i=(t,n)=>{e[t]||importScripts(r.p+r.u(t))};var t=self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[],n=t.push.bind(t);t.push=t=>{var[o,s,i]=t;for(var a in s)r.o(s,a)&&(r.m[a]=s[a]);for(i&&i(r);o.length;)e[o.pop()]=1;n(t)}})(),r(88277);var n=r(25045);RemoteClient=n})();
1
+ var RemoteClient;(()=>{var e={88277:(e,t,r)=>{r.p=self.esriConfig.assetsPath+"/esri/core/workers/"},68773:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s}),r(80442);var n=r(78286),o=r(17202);const s={apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&((0,n.RH)(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){const e="4.25.0";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${o.r}/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)=>{"use strict";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)=>{"use strict";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)=>{"use strict";r.d(t,{Z:()=>o});var n=r(78286);class o{constructor(e,t,r){this.name=e,this.details=r,this instanceof o&&(this.message=(t&&function(e,t){return e.replace(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,((e,r)=>{if(""===r)return"$";const o=(0,n.hS)(r,t)??"";if(void 0===o)throw new Error(`could not find key "${r}" in template`);return o.toString()}))}(t,r))??"")}toString(){return"["+this.name+"]: "+this.message}}},77734:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e=1){this._seed=e}set seed(e){this._seed=e??Math.random()*n._m}getInt(){return this._seed=(n._a*this._seed+n._c)%n._m,this._seed}getFloat(){return this.getInt()/(n._m-1)}getIntRange(e,t){return Math.round(this.getFloatRange(e,t))}getFloatRange(e,t){const r=t-e;return e+this.getInt()/n._m*r}}n._m=2147483647,n._a=48271,n._c=0},67676:(e,t,r)=>{"use strict";r.d(t,{FY:()=>m,Od:()=>y,SO:()=>d,Vx:()=>i,a9:()=>u,cq:()=>p,e$:()=>b,e5:()=>a,fS:()=>s,w6:()=>f,zG:()=>c});var n=r(70586),o=r(77734);function s(e,t,r){if((0,n.Wi)(e)&&(0,n.Wi)(t))return!0;if((0,n.Wi)(e)||(0,n.Wi)(t)||e.length!==t.length)return!1;if(r){for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1}else for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function i(e,t){let r=e.length!==t.length;e.length=t.length;for(let n=0;n<t.length;++n)e[n]!==t[n]&&(e[n]=t[n],r=!0);return r}function a(e,t,r){let n,o;return r?(n=t.filter((t=>!e.some((e=>r(e,t))))),o=e.filter((e=>!t.some((t=>r(t,e)))))):(n=t.filter((t=>!e.includes(t))),o=e.filter((e=>!t.includes(e)))),{added:n,removed:o}}function c(e){return e&&"number"==typeof e.length}const l=!!Array.prototype.fill;function u(e,t){if(l)return new Array(e).fill(t);const r=new Array(e);for(let n=0;n<e;n++)r[n]=t;return r}function f(e,t){void 0===t&&(t=e,e=0);const r=new Array(t-e);for(let n=e;n<t;n++)r[n-e]=n;return r}class d{constructor(){this.last=0}}const h=new d;function p(e,t,r,n){n=n||h;const o=Math.max(0,n.last-10);for(let s=o;s<r;++s)if(e[s]===t)return n.last=s,s;const s=Math.min(o,r);for(let r=0;r<s;++r)if(e[r]===t)return n.last=r,r;return-1}function b(e,t,r,n){const o=r??e.length,s=p(e,t,o,n);if(-1!==s)return e[s]=e[o-1],null==r&&e.pop(),t}const g=new Set;function m(e,t,r=e.length,n=t.length,o,s){if(0===n||0===r)return r;g.clear();for(let e=0;e<n;++e)g.add(t[e]);o=o||h;const i=Math.max(0,o.last-10);for(let t=i;t<r;++t)if(g.has(e[t])&&(s&&s.push(e[t]),g.delete(e[t]),e[t]=e[r-1],--r,--t,0===g.size||0===r))return g.clear(),r;for(let t=0;t<i;++t)if(g.has(e[t])&&(s&&s.push(e[t]),g.delete(e[t]),e[t]=e[r-1],--r,--t,0===g.size||0===r))return g.clear(),r;return g.clear(),r}function y(e,t){const r=e.indexOf(t);return-1!==r?(e.splice(r,1),t):null}new o.Z},60235:(e,t,r)=>{"use strict";r.d(t,{Mr:()=>i,x9:()=>a});var n=r(80442);const o=new Set;function s(e,t,r=!1){r&&o.has(t)||(r&&o.add(t),e.warn(`🛑 DEPRECATED - ${t}`))}function i(e,t,r={}){if((0,n.Z)("esri-deprecation-warnings")){const{moduleName:n}=r;a(e,"Property: "+(n?n+"::":"")+t,r)}}function a(e,t,r={}){if((0,n.Z)("esri-deprecation-warnings")){const{replacement:n,version:o,see:i,warnOnce:a}=r;let c=t;n&&(c+=`\n\t🛠️ Replacement: ${n}`),o&&(c+=`\n\t⚙️ Version: ${o}`),i&&(c+=`\n\t🔗 See ${i} for more details.`),s(e,c,a)}}},91460:(e,t,r)=>{"use strict";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,{IH:()=>s,on:()=>o,vT:()=>n})},80442:(e,t,r)=>{"use strict";let n;function o(e){return"function"==typeof n[e]?n[e]=n[e](globalThis):n[e]}r.d(t,{Z:()=>o}),n=globalThis.dojoConfig?.has||globalThis.esriConfig?.has?{...globalThis.dojoConfig?.has,...globalThis.esriConfig?.has}:{},o.add=(e,t,r,s)=>((s||void 0===n[e])&&(n[e]=t),r&&o(e)),o.cache=n,o.add("esri-deprecation-warnings",!0),(()=>{o.add("host-webworker",void 0!==globalThis.WorkerGlobalScope&&self instanceof globalThis.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(o.add("host-browser",e),o.add("host-node","object"==typeof globalThis.process&&globalThis.process.versions?.node&&globalThis.process.versions.v8),o.add("dom",e),o("host-browser")){const e=navigator,t=e.userAgent,r=e.appVersion,n=parseFloat(r);if(o.add("wp",parseFloat(t.split("Windows Phone")[1])||void 0),o.add("msapp",parseFloat(t.split("MSAppHost/")[1])||void 0),o.add("khtml",r.includes("Konqueror")?n:void 0),o.add("edge",parseFloat(t.split("Edge/")[1])||void 0),o.add("opr",parseFloat(t.split("OPR/")[1])||void 0),o.add("webkit",!o("wp")&&!o("edge")&&parseFloat(t.split("WebKit/")[1])||void 0),o.add("chrome",!o("edge")&&!o("opr")&&parseFloat(t.split("Chrome/")[1])||void 0),o.add("android",!o("wp")&&parseFloat(t.split("Android ")[1])||void 0),o.add("safari",!r.includes("Safari")||o("wp")||o("chrome")||o("android")||o("edge")||o("opr")?void 0:parseFloat(r.split("Version/")[1])),o.add("mac",r.includes("Macintosh")),!o("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,""));o.add(e,n),o.add("ios",n)}o.add("trident",parseFloat(r.split("Trident/")[1])||void 0),o("webkit")||(!t.includes("Gecko")||o("wp")||o("khtml")||o("trident")||o("edge")||o.add("mozilla",n),o("mozilla")&&o.add("ff",parseFloat(t.split("Firefox/")[1]||t.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),r=/iPhone/i.test(e);t&&o.add("esri-mobile",t),r&&o.add("esri-iPhone",r),o.add("esri-geolocation",!!navigator.geolocation)}o.add("esri-canvas-svg-support",!o("trident")),o.add("esri-wasm","WebAssembly"in globalThis),o.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in globalThis,t=!1===globalThis.crossOriginIsolated;return e&&!t})),o.add("wasm-simd",(()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])))),o.add("esri-atomics","Atomics"in globalThis),o.add("esri-workers","Worker"in globalThis),o.add("web-feat:cache","caches"in globalThis),o.add("esri-workers-arraybuffer-transfer",!o("safari")||Number(o("safari"))>=12),o.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),o.add("featurelayer-simplify-payload-size-factors",[1,1,4]),o.add("featurelayer-snapshot-enabled",!0),o.add("featurelayer-snapshot-point-min-threshold",8e4),o.add("featurelayer-snapshot-point-max-threshold",4e5),o.add("featurelayer-snapshot-point-coverage",.1),o.add("featurelayer-advanced-symbols",!1),o.add("featurelayer-pbf",!0),o.add("featurelayer-pbf-statistics",!1),o.add("feature-layers-workers",!0),o.add("feature-polyline-generalization-factor",1),o.add("mapview-transitions-duration",200),o.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),o.add("mapserver-pbf-enabled",!1),o.add("mapimagelayer-popup-identify-max-tolerance",20),o.add("heatmap-allow-raster-fallback",!0),o.add("heatmap-force-raster",!1),o("host-webworker")||o("host-browser")&&(o.add("esri-csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),o.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((()=>{o.add("esri-image-decode",!0,!0,!0)})).catch((()=>{o.add("esri-image-decode",!1,!0,!0)}))}return!1})),o.add("esri-url-encodes-apostrophe",(()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")})))})()},22974:(e,t,r)=>{"use strict";r.d(t,{Vo:()=>c,d9:()=>a,fS:()=>p,y7:()=>b,yd:()=>i});var n=r(67676),o=(r(80442),r(70586)),s=r(1533);function i(e,t){let r;if(t)for(r in e)e.hasOwnProperty(r)&&(void 0===e[r]?delete e[r]:e[r]instanceof Object&&i(e[r],!0));else for(r in e)e.hasOwnProperty(r)&&void 0===e[r]&&delete e[r];return e}function a(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;const t=h(e);if((0,o.pC)(t))return t;if(l(e))return e.clone();if(u(e))return e.map(a);if(f(e))return e.clone();const r={};for(const t of Object.getOwnPropertyNames(e))r[t]=a(e[t]);return r}function c(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;const t=h(e);if((0,o.pC)(t))return t;if(u(e)){let t=!0;const r=e.map((e=>{const r=c(e);return null!=e&&null==r&&(t=!1),r}));return t?r:null}if(l(e))return e.clone();if(!f(e)){const t=new(0,Object.getPrototypeOf(e).constructor);for(const r of Object.getOwnPropertyNames(e)){const n=e[r],o=c(n);if(null!=n&&null==o)return null;t[r]=o}return t}return null}function l(e){return"function"==typeof e.clone}function u(e){return"function"==typeof e.map&&"function"==typeof e.forEach}function f(e){return"function"==typeof e.notifyChange&&"function"==typeof e.watch}function d(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function h(e){if((0,s.W0)(e)||(0,s.lq)(e)||(0,s.KZ)(e)||(0,s.z3)(e)||(0,s.Uc)(e)||(0,s.Hx)(e)||(0,s.ZY)(e)||(0,s.xZ)(e)||(0,s.fS)(e))return(0,s.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,a(e))})),t}if(e instanceof Set){const t=new Set;return e.forEach((e=>{t.add(a(e))})),t}return null}function p(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}function b(e,t){return e===t||(null==e||"string"==typeof e?e===t:"number"==typeof e?e===t||"number"==typeof t&&isNaN(e)&&isNaN(t):e instanceof Date?t instanceof Date&&e.getTime()===t.getTime():Array.isArray(e)?Array.isArray(t)&&(0,n.fS)(e,t):e instanceof Set?t instanceof Set&&function(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}(e,t):e instanceof Map?t instanceof Map&&function(e,t){if(e.size!==t.size)return!1;for(const[r,n]of e){const e=t.get(r);if(e!==n||void 0===e&&!t.has(r))return!1}return!0}(e,t):!!d(e)&&d(t)&&function(e,t){if(null===e||null===t)return!1;const r=Object.keys(e);if(null===t||Object.keys(t).length!==r.length)return!1;for(const n of r)if(e[n]!==t[n]||!Object.prototype.hasOwnProperty.call(t,n))return!1;return!0}(e,t))}},70586:(e,t,r)=>{"use strict";function n(e){return null!=e}function o(e){return null==e}function s(e,t){return n(e)?t(e):null}function i(e){return e}function a(e,t){if(o(e))throw new Error(t);return e}function c(e,t){return n(e)?e:"function"==typeof t?t():t}function l(e,t){return n(e)?e:t}function u(e){return n(e)&&e.destroy(),null}function f(e){return n(e)&&e.dispose(),null}function d(e){return n(e)&&e.remove(),null}function h(e){return n(e)&&e.abort(),null}function p(e){return n(e)&&e.release(),null}function b(e,t,r){return n(e)&&n(t)?n(r)?r(e,t):e.equals(t):e===t}function g(e){return null}function m(e,t){const r=new Array;for(const n of e)r.push(w(n,null,t));return r}function y(e,t){for(const r of e)s(r,t)}function w(e,t,r){return n(e)?r(e):t}function v(e){return e.filter((e=>n(e)))}function _(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,{Bd:()=>g,Fd:()=>m,IM:()=>h,JR:()=>y,O3:()=>f,Pt:()=>c,R2:()=>w,RY:()=>p,SC:()=>u,U2:()=>_,Wg:()=>i,Wi:()=>o,_W:()=>b,hw:()=>d,j0:()=>O,lV:()=>v,pC:()=>n,s3:()=>a,yl:()=>l,yw:()=>s})},78286:(e,t,r)=>{"use strict";r.d(t,{RB:()=>i,RH:()=>o,hS:()=>s});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(((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=>{s.includes(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)=>{"use strict";r.d(t,{e4:()=>O,zE:()=>c,dD:()=>w,hh:()=>C,Ds:()=>P,as:()=>v,WW:()=>_,R8:()=>y,D_:()=>m,Hc:()=>f,y8:()=>k,fu:()=>p,$F:()=>b,r9:()=>d,k_:()=>l,H9:()=>h,Yn:()=>j,gx:()=>S,Hl:()=>g});const n=(o=globalThis,{setTimeout:(e,t)=>{const r=o.setTimeout(e,t);return{remove:()=>o.clearTimeout(r)}}});var o;r(60235);var s=r(20102),i=r(91460),a=(r(92604),r(70586));function c(e="Aborted"){return new s.Z("AbortError",e)}function l(e,t="Aborted"){if(f(e))throw c(t)}function u(e){return(0,a.pC)(e)?"aborted"in e?e:e.signal:e}function f(e){const t=u(e);return(0,a.pC)(t)&&t.aborted}function d(e){if(m(e))throw e}function h(e){if(!m(e))throw e}function p(e,t){const r=u(e);if(!(0,a.Wi)(r)){if(!r.aborted)return(0,i.IH)(r,"abort",(()=>t()));t()}}function b(e,t){const r=u(e);if(!(0,a.Wi)(r))return l(r),(0,i.IH)(r,"abort",(()=>t(c())))}function g(e,t){const r=u(t);return(0,a.Wi)(r)?e:new Promise(((r,n)=>{let o=p(t,(()=>n(c())));const s=()=>o=(0,a.hw)(o);e.then(s,s),e.then(r,n)}))}function m(e){return"AbortError"===e?.name}async function y(e){try{return await e}catch(e){if(!m(e))throw e;return}}function w(){let e=null;const t=new Promise(((t,r)=>{e={promise:void 0,resolve:t,reject:r}}));return e.promise=t,e}async function v(e){if(!e)return;if("function"!=typeof e.forEach){const t=Object.keys(e),r=t.map((t=>e[t])),n=await v(r),o={};return t.map(((e,t)=>o[e]=n[t])),o}const t=e;return new Promise((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)}))}))}))}async function _(e){return(await v(e)).filter((e=>!!e.value)).map((e=>e.value))}function O(e,t,r){const n=new AbortController;return p(r,(()=>n.abort())),new Promise(((r,o)=>{let s=setTimeout((()=>{s=0,r(t)}),e);p(n,(()=>{s&&(clearTimeout(s),o(c()))}))}))}function k(e){return e&&"function"==typeof e.then}function S(e){return k(e)?e:Promise.resolve(e)}function P(e,t=-1){let r,n,o,s,i=null;const l=(...u)=>{if(r){n=u,s&&s.reject(c()),s=w();const e=(0,a.j0)(s.promise);if(i){const e=i;i=null,e.abort()}return e}if(o=s||w(),s=null,t>0){const n=new AbortController;r=S(e(...u,n.signal));const o=r;O(t).then((()=>{r===o&&(s?n.abort():i=n)}))}else r=1,r=S(e(...u));const f=()=>{const e=n;n=o=r=i=null,null!=e&&l(...e)},d=r,h=o;return d.then(f,f),d.then(h.resolve,h.reject),(0,a.j0)(h.promise)};return l}function C(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n})),o=t=>{e(t)};return o.resolve=t=>e(t),o.reject=e=>t(e),o.timeout=(e,t)=>n.setTimeout((()=>o.reject(t)),e),o.promise=r,o}async function j(e){await Promise.resolve(),l(e)}},19153:(e,t,r)=>{"use strict";r.d(t,{Cb:()=>l,Qs:()=>a,gx:()=>i,hP:()=>c});var n=r(78286);const o=/\{([^\}]+)\}/g;function s(e){return 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&&t.includes(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 l(e){return(new DOMParser).parseFromString(e||"","text/html").body.innerText||""}},1533:(e,t,r)=>{"use strict";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 l(e){return e instanceof Int16Array||e&&e.constructor&&"Int16Array"===e.constructor.name}function u(e){return e instanceof Uint16Array||e&&e.constructor&&"Uint16Array"===e.constructor.name}function f(e){return e instanceof Int32Array||e&&e.constructor&&"Int32Array"===e.constructor.name}function d(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,Hx:()=>f,KZ:()=>c,Uc:()=>u,W0:()=>i,ZY:()=>d,eP:()=>s,fS:()=>p,lq:()=>a,tP:()=>o,xZ:()=>h,z3:()=>l})},17452:(e,t,r)=>{"use strict";r.d(t,{$U:()=>ne,AH:()=>V,B7:()=>j,D6:()=>U,Fv:()=>Z,HK:()=>K,Hu:()=>de,Ie:()=>ue,L:()=>k,Ml:()=>be,P$:()=>B,PF:()=>F,Qj:()=>le,R9:()=>y,TI:()=>O,YP:()=>H,Yd:()=>ae,ZN:()=>he,_l:()=>X,b7:()=>A,ed:()=>N,fl:()=>pe,hF:()=>q,hO:()=>oe,io:()=>ee,jc:()=>z,kl:()=>L,mN:()=>S,oC:()=>te,oh:()=>W,qg:()=>E,rS:()=>Q,sJ:()=>Y,tD:()=>$,tm:()=>I,u0:()=>P,v_:()=>D,vt:()=>ce});var n=r(68773),o=r(20102),s=r(92604),i=r(70586);const a=s.Z.getLogger("esri.core.urlUtils"),c=n.Z.request,l="esri/config: esriConfig.request.proxyUrl is not set.",u=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,f=/^\s*http:/i,d=/^\s*https:/i,h=/^\s*file:/i,p=/:\d+$/,b=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,g=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),m=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class y{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(m)),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 w={};let v=new y(n.Z.applicationUrl);let _=function(){const e=(0,i.j0)(v.path),t=e.substring(0,e.lastIndexOf(e.split("/")[e.split("/").length-1]));return`${v.scheme}://${v.host}${null!=v.port?`:${v.port}`:""}${t}`}();const O=()=>v,k=()=>_;function S(e){const t={path:null,query:null},r=new y(e),n=e.indexOf("?");return null===r.query?t.path=e:(t.path=e.substring(0,n),t.query=P(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 P(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 j(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 A(e=!1){let t,r=c.proxyUrl;if("string"==typeof e){t=ne(e);const n=N(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw a.warn(l),new o.Z("urlutils:proxy-not-set",l);return t&&se()&&(r=oe(r)),S(r)}function E(e){const t=N(e);let r,n;if(t){const e=x(t.proxyUrl);r=e.path,n=e.query?P(e.query):null}if(r){const t=S(e);e=r+"?"+t.path;const o=j({...n,...t.query});o&&(e=`${e}?${o}`)}return e}const T={path:"",query:""};function x(e){const t=e.indexOf("?");return-1!==t?(T.path=e.slice(0,t),T.query=e.slice(t+1)):(T.path=e,T.query=null),T}function M(e){return(e=ie(e=function(e){return e&&"/"===e[e.length-1]?e:`${e}/`}(e=x(e).path),!0)).toLowerCase()}function $(e){const t={proxyUrl:e.proxyUrl,urlPrefix:M(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 N(e){const t=c.proxyRules,r=M(e);for(let e=0;e<t.length;e++)if(0===r.indexOf(t[e].urlPrefix))return t[e]}function I(e,t){return e=R(e),t=R(t),ie(e)===ie(t)}function R(e){const t=(e=Z(e)).indexOf("/sharing");return t>0?e.substring(0,t):e.replace(/\/+$/,"")}function W(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 U(e,t,r=!1){if(!e||!t)return!1;const n=fe(e),o=fe(t);return!(!r&&n.scheme!==o.scheme)&&null!=n.host&&null!=o.host&&n.host.toLowerCase()===o.host.toLowerCase()&&n.port===o.port}function L(e){if("string"==typeof e){if(!H(e))return!0;e=fe(e)}if(U(e,v))return!0;const t=c.trustedServers||[];for(let r=0;r<t.length;r++){const n=J(t[r]);for(let t=0;t<n.length;t++)if(U(e,n[t]))return!0}return!1}function J(e){return w[e]||(re(e)||te(e)?w[e]=[new y(q(e))]:w[e]=[new y(`http://${e}`),new y(`https://${e}`)]),w[e]}function q(e,t=_,r){return te(e)?r&&r.preserveProtocolRelative?e:"http"===v.scheme&&v.authority===B(e).slice(2)?`http:${e}`:`https:${e}`:re(e)?e:(0,i.j0)(D("/"===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 F(e,t=_,r){if(null==e||!H(e))return e;const n=Z(e),o=n.toLowerCase(),s=Z(t).toLowerCase().replace(/\/+$/,""),i=r?Z(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),l=-1;for(;o.slice(0,c+1)===s.slice(0,c)+"/"&&(l=c+1,c!==o.length);)c=a(o,"/",c+1);if(-1===l)return e;if(i&&l<i.length)return e;e=n.slice(l);const u=s.slice(l-1).replace(/[^/]+/g,"").length;if(u>0)for(let t=0;t<u;t++)e=`../${e}`;else e=`./${e}`;return e}function Z(e){return function(e){const t=c.httpsDomains;if(!function(e){return null!=e&&f.test(e)||"http"===v.scheme&&te(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"===v.scheme&&n===v.authority&&!b.test(e)||(se()&&n===v.authority||t&&t.some((e=>n===e||n.endsWith(`.${e}`)))||se()&&!N(e))&&(e=oe(e)),e}(e=function(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}(e=function(e){if(/^https?:\/\//i.test(e)){const t=x(e);e=(e=t.path.replace(/\/{2,}/g,"/")).replace("/","//"),t.query&&(e+=`?${t.query}`)}return e}(e=q(e=e.trim()))))}function D(...e){const t=e.filter(i.pC);if(!t||!t.length)return;const r=[];if(H(t[0])){const e=t[0],n=e.indexOf("//");-1!==n&&(r.push(e.slice(0,n+1)),function(e){return null!=e&&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 B(e,t=!1){if(null==e||z(e)||K(e))return null;let r=e.indexOf("://");if(-1===r&&te(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=ie(e,!0)),e}function H(e){return te(e)||re(e)}function z(e){return null!=e&&"blob:"===e.slice(0,5)}function K(e){return null!=e&&"data:"===e.slice(0,5)}function V(e){const t=Y(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}function Q(e){return btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const G=/^data:(.*?)(;base64)?,(.*)$/;function Y(e){const t=e.match(G);if(!t)return null;const[,r,n,o]=t;return{mediaType:r,isBase64:!!n,data:o}}function X(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}function ee(e,t){(function(e,t){if(!e)return!1;const r=document.createElement("a");if(!("download"in r))return!1;const n=URL.createObjectURL(e);return r.download=t,r.href=n,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),!0})(e,t)||function(e,t){!!window.navigator.msSaveOrOpenBlob&&window.navigator.msSaveOrOpenBlob(e,t)}(e,t)}function te(e){return null!=e&&"/"===e[0]&&"/"===e[1]}function re(e){return null!=e&&u.test(e)}function ne(e){return null!=e&&d.test(e)||"https"===v.scheme&&te(e)}function oe(e){return te(e)?`https:${e}`:e.replace(f,"https:")}function se(){return"https"===v.scheme}function ie(e,t=!1){return te(e)?e.slice(2):(e=e.replace(u,""),t&&e.length>1&&"/"===e[0]&&"/"===e[1]&&(e=e.slice(2)),e)}function ae(e){let t=0;if(H(e)){const r=e.indexOf("//");-1!==r&&(t=r+2)}const r=e.lastIndexOf("/");return r<t?e:e.slice(0,r+1)}function ce(e,t){if(!e)return"";const r=S(e).path.replace(/\/+$/,""),n=r.substring(r.lastIndexOf("/")+1);if(!t?.length)return n;const o=new RegExp(`.(${t.join("|")})$`,"ig");return n.replace(o,"")}function le(e){return e.replace(/\/+$/,"")}function ue(e,t,r){if(!(t&&r&&e&&H(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 fe(e){return"string"==typeof e?new y(q(e)):(e.scheme||(e.scheme=v.scheme),e)}function de(e,t){const r=S(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 he(e,t,r){const n=S(e),o=n.query||{};return o[t]=String(r),`${n.path}?${j(o)}`}function pe(e,t){const r=S(e),n=r.query||{};for(const e in t)n[e]=t[e];const o=j(n);return o?`${r.path}?${o}`:r.path}function be(e){if((0,i.Wi)(e))return null;const t=e.match(ge);return t?t[1]:null}const ge=/.*?\.([^\/]*)$/},25045:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>y});var n=r(40330),o=r(20102),s=r(91460),i=r(70586),a=r(95330),c=r(94362),l=r(17202);const u={statsWorker:()=>Promise.all([r.e(1400),r.e(1562),r.e(9293),r.e(6841)]).then(r.bind(r,36841)),geometryEngineWorker:()=>Promise.all([r.e(5837),r.e(8227)]).then(r.bind(r,48227)),CSVSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(4478)]).then(r.bind(r,14478)),EdgeProcessingWorker:()=>Promise.all([r.e(6481),r.e(9594)]).then(r.bind(r,49594)),ElevationSamplerWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(6481),r.e(6459),r.e(1438)]).then(r.bind(r,61787)),FeatureServiceSnappingSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(8494),r.e(6208)]).then(r.bind(r,2255)),GeoJSONSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(7845)]).then(r.bind(r,97845)),LercWorker:()=>r.e(3027).then(r.bind(r,23027)),MemorySourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(639)]).then(r.bind(r,30639)),PBFDecoderWorker:()=>Promise.all([r.e(1400),r.e(1562),r.e(5886),r.e(802)]).then(r.bind(r,10802)),Pipeline:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(8494),r.e(4325),r.e(908)]).then(r.bind(r,61837)),PointCloudWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(7789)]).then(r.bind(r,16583)),RasterWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(176),r.e(2398),r.e(8061)]).then(r.bind(r,61576)),SceneLayerSnappingSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(6481),r.e(2631),r.e(934)]).then(r.bind(r,40614)),SceneLayerWorker:()=>Promise.all([r.e(3739),r.e(1412)]).then(r.bind(r,31412)),WFSSourceWorker:()=>Promise.all([r.e(4547),r.e(1400),r.e(3739),r.e(1562),r.e(1534),r.e(5886),r.e(9293),r.e(2916),r.e(2630),r.e(3230)]).then(r.bind(r,43230)),WorkerTileHandler:()=>Promise.all([r.e(4325),r.e(1785),r.e(6810),r.e(3388)]).then(r.bind(r,56456))},{CLOSE:f,ABORT:d,INVOKE:h,RESPONSE:p,OPEN_PORT:b,ON:g}=c.Cs;class m{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===c.Cs.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class y{constructor(e,t,r){this._port=e,this._getNextJob=r,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new m((e=>this._onInvokeMessage(e))),this._client=t.client,this._onMessage=this._onMessage.bind(this),this._channel=t.channel,this._schedule=t.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}static connect(e){const t=new MessageChannel;let r;r="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const n=new y(t.port1,{channel:t,client:r},(()=>null));return"object"==typeof r&&"remoteClient"in r&&(r.remoteClient=n),y.clients.set(n,r),t.port2}static loadWorker(e){const t=u[e];return t?t():Promise.resolve(null)}close(){this._post({type:f}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,r){const n=r&&r.signal,s=r&&r.transferList;if(!this._port)return Promise.reject(new o.Z("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const l=(0,c.jt)();return new Promise(((r,o)=>{if((0,a.Hc)(n))return this._processWork(),void o((0,a.zE)());const c=(0,a.fu)(n,(()=>{const e=this._outJobs.get(l);e&&(this._outJobs.delete(l),this._processWork(),(0,i.hw)(e.abortHandle),this._post({type:d,jobId:l}),o((0,a.zE)()))})),u={resolve:r,reject:o,abortHandle:c,debugInfo:e};this._outJobs.set(l,u),this._post({type:h,jobId:l,methodName:e,abortable:null!=n},t,s)}))}on(e,t){const r=new MessageChannel;function n(e){t(e.data)}return this._port.postMessage({type:c.Cs.ON,eventType:e,port:r.port2},[r.port2]),r.port1.addEventListener("message",n),r.port1.start(),{remove(){r.port1.postMessage({type:c.Cs.CLOSE}),r.port1.close(),r.port1.removeEventListener("message",n)}}}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:b,port:e.port2}),e.port1}_processWork(){if(this._outJobs.size>=2)return;const e=this._getNextJob();if(!e)return;const{methodName:t,data:r,invokeOptions:n,deferred:o}=e;this.invoke(t,r,n).then((e=>o.resolve(e))).catch((e=>o.reject(e)))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{(0,i.hw)(e.abortHandle),e.reject((0,a.zE)(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=this._client=this._schedule=null}_onMessage(e){(0,i.pC)(this._schedule)?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const t=(0,c.QM)(e);if(t)switch(t.type){case p:this._onResponseMessage(t);break;case h:this._invokeQueue.push(t);break;case d:this._onAbortMessage(t);break;case f:this._onCloseMessage();break;case b:this._onOpenPortMessage(t);break;case g:this._onOnMessage(t)}}_onAbortMessage(e){const t=this._inJobs,r=e.jobId,n=t.get(r);this._invokeQueue.push(e),n&&(n.controller&&n.controller.abort(),t.delete(r))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&y.clients.get(this)===e&&e.destroy(),y.clients.delete(this),e&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:t,jobId:r,data:n,abortable:o}=e,s=o?new AbortController:null,i=this._inJobs;let l,u=this._client,f=u[t];try{if(!f&&t&&t.includes(".")){const e=t.split(".");for(let t=0;t<e.length-1;t++)u=u[e[t]],f=u[e[t+1]]}if("function"!=typeof f)throw new TypeError(`${t} is not a function`);l=f.call(u,n,{client:this,signal:s?s.signal:null})}catch(e){return void this._post({type:p,jobId:r,error:(0,c.AB)(e)})}(0,a.y8)(l)?(i.set(r,{controller:s,promise:l}),l.then((e=>{i.has(r)&&(i.delete(r),this._post({type:p,jobId:r},e))}),(e=>{i.has(r)&&(i.delete(r),(0,a.D_)(e)||this._post({type:p,jobId:r,error:(0,c.AB)(e||{message:`Error encountered at method ${t}`})}))}))):this._post({type:p,jobId:r},l)}_onOpenPortMessage(e){new y(e.port,{client:this._client},(()=>null))}_onOnMessage(e){const{port:t}=e,r=this._client.on(e.eventType,(e=>{t.postMessage(e)})),n=(0,s.on)(e.port,"message",(e=>{(0,c.QM)(e)?.type===c.Cs.CLOSE&&(n.remove(),r.remove(),t.close())}))}_onResponseMessage(e){const{jobId:t,error:r,data:n}=e,s=this._outJobs;if(!s.has(t))return;const a=s.get(t);s.delete(t),this._processWork(),(0,i.hw)(a.abortHandle),r?a.reject(o.Z.fromJSON(JSON.parse(r))):a.resolve(n)}_post(e,t,r){return(0,c.oi)(this._port,e,t,r)}}y.kernelInfo={revision:l.$,version:n.i8,buildDate:l.r},y.clients=new Map},94362:(e,t,r)=>{"use strict";r.d(t,{AB:()=>a,Cs:()=>n,QM:()=>l,jt:()=>i,oi:()=>c});var n,o=r(80442);!function(e){e[e.HANDSHAKE=0]="HANDSHAKE",e[e.OPEN=1]="OPEN",e[e.OPENED=2]="OPENED",e[e.RESPONSE=3]="RESPONSE",e[e.INVOKE=4]="INVOKE",e[e.ABORT=5]="ABORT",e[e.CLOSE=6]="CLOSE",e[e.OPEN_PORT=7]="OPEN_PORT",e[e.ON=8]="ON"}(n||(n={}));let s=0;function i(){return s++}function a(e){return e?"string"==typeof e?JSON.stringify({name:"message",message:e}):e.toJSON?JSON.stringify(e):JSON.stringify({name:e.name,message:e.message,details:e.details||{stack:e.stack}}):null}function c(e,t,r,o){if(t.type===n.OPEN_PORT)return void e.postMessage(t,[t.port]);if(t.type!==n.INVOKE&&t.type!==n.RESPONSE)return void e.postMessage(t);let s;!function(e){return e&&"object"==typeof e&&("result"in e||"transferList"in e)}(r)?(s=u(o),t.data=r):(s=u(r.transferList),t.data=r.result),s?e.postMessage(t,s):e.postMessage(t)}function l(e){if(!e)return null;const t=e.data;return t?"string"==typeof t?JSON.parse(t):t:null}function u(e){if(!e||!e.length)return null;if((0,o.Z)("esri-workers-arraybuffer-transfer"))return e;const t=e.filter((e=>!function(e){return e instanceof ArrayBuffer||e&&e.constructor&&"ArrayBuffer"===e.constructor.name}(e)));return t.length?t:null}},40330:(e,t,r)=>{"use strict";r.d(t,{Dp:()=>l,Nv:()=>i,i8:()=>s,id:()=>a,qh:()=>c});var n=r(80442),o=r(17452);const s="4.25",i={async request(e,t){const{default:n}=await r.e(3172).then(r.bind(r,3172)),s=e.options,i=s.responseType;s.signal=t?.signal,s.responseType="native"===i||"native-request-init"===i?"native-request-init":i&&["blob","json","text"].includes(i)&&(0,o.oh)(e.url)?.after?i:"array-buffer";const a=await n(e.url,s),c={data:a.data,ssl:a.ssl};switch(a.requestOptions?.responseType){case"native-request-init":return delete c.data.signal,c;case"blob":c.data=await c.data.arrayBuffer();break;case"json":c.data=(new TextEncoder).encode(JSON.stringify(c.data)).buffer;break;case"text":c.data=(new TextEncoder).encode(c.data).buffer}return{result:c,transferList:[c.data]}}};let a;function c(e){a=e}function l(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")},17202:(e,t,r)=>{"use strict";r.d(t,{$:()=>o,r:()=>n});const n="20220731",o="54752b14a3594f0a372b03eb500f925c39eb30b9"}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.m=e,r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((t,n)=>(r.f[n](e,t),t)),[])),r.u=e=>"chunks/"+{24:"92f7415c2e40e320addc",176:"888d8e4471c9a2cd5009",247:"b24a76738482ebfc626f",280:"30d7796ee6f7e4a6a3e1",461:"fde2301c6cd97a3cfb86",565:"bbff8ed3192fe22a6b6d",576:"7fdd029a76a7ab1c3d83",639:"1537b8744b2dab81b601",734:"d81bcc85ceb91bbba69f",739:"37abe133c61e31c04204",802:"01160ad0aba069a80ac4",819:"5d3e774ce7b006c8cba8",908:"0c145b87c24bf6c7d572",934:"d02881954c0cc0d39dfb",1197:"3228293c159886513f60",1400:"5821d3a6499d8e84f48a",1408:"993f105c983d81a208d1",1412:"ff48d82c240950273de2",1421:"6196cfdeb91ceba52af3",1423:"698eaae866cf97a56541",1433:"dfdd853dd6c023089963",1438:"1b3733100b9fa41905d0",1491:"0111443107e3c793cd89",1534:"c912ae9afa1997a6e1bb",1562:"377354a81e402edf3077",1761:"83b5760b9bd71ff7a261",1773:"3a61e4ab83183f5526a7",1785:"3b5be512567d9c1c6fe6",1819:"afb74623cce5dfd0e4de",1938:"fc6423ca92289c739e19",2133:"f59f82a43437a51c934c",2134:"4f2d2cc71f5ff5ac2a60",2398:"bc1155973f3d84371df7",2485:"405b8535631c30162b01",2630:"cc0a0782b8b9f6ec511e",2631:"8e146ba7aed3991a2777",2664:"48c8ac9a22190c2b890c",2723:"8b0b4a6b19f3e26c06ee",2812:"ae8e87da97411cff3783",2855:"d595f2c41e3bd1b33e07",2916:"3485e2342f44e4d760a2",3027:"425d1fabc713a598139c",3121:"8caeb7c52816b582553f",3128:"54b01d2a4aba08d7e16b",3172:"fe84bcdfd9028b5e7ef6",3230:"016b54572465ad54c08a",3388:"652d36523efbe5c9ebb2",3529:"9341e9e1fe0f6800aa44",3668:"0896986aa60516f716f1",3723:"cafad818d72647dc5092",3739:"3538bb8545bdf1fe644f",3750:"28ecf5c49144903fbf68",3852:"b71a0a8a2f446c671161",3974:"e661dfce40f6064d05c6",4109:"f40290cfad3fe6fb4ef9",4133:"f039a029515be17164c0",4166:"93c945099be3a4f43263",4286:"037e666f6a7ad1def59c",4325:"d91140bc583925e4faf6",4358:"71a4618d959a09302c51",4417:"4ba51f56f9b82aa616ff",4475:"d10cb53bc07963d87311",4477:"de46fe79391f11d09d42",4478:"f6f44022482fcd13dcb5",4499:"577679f302c26ba4060a",4547:"038242c6b5a37de1be92",4695:"81074accfce5f109f909",4720:"4daed788b965c26d76ec",4889:"17be5bd0d1c233d73d7a",4910:"86f99e7078f427ad929f",5001:"35f3f714d6faa88b0c0c",5235:"7773b9415c5a8d82973f",5329:"c8a3a28809542396c6fd",5642:"1751de504354d98ac3fd",5787:"a23376df9696ebe5b5cd",5837:"bc682351fc915b4ab5a6",5853:"f298a70f3b6f27675d53",5886:"821a0754eae11421e56a",5906:"a3566b99bceaf173997b",6110:"374ee2b2cad26f7ad572",6130:"92e43e05265dfc8173a0",6199:"fadc0c18d52fffc29482",6208:"579ba109718bc2554008",6233:"4cb64ccb5fba126f9a66",6237:"c544df83e86a9d36b68c",6312:"c4db05de1cd997ee2fac",6459:"8b1d5b7e9de73bc9da3a",6481:"1570676351a313f1841b",6690:"1db150b26a4a3af2486f",6710:"d828a0656e7351a74fc4",6748:"61ddd479abf2c97dd408",6774:"c8402e32307a7b7eaaeb",6810:"4a7aa1b9de61eb013647",6841:"0e3e2276665d8e466379",6920:"8b94a400a04e7a803dc4",6968:"d1d71c1516ae00a0b4f1",7126:"c3c05fd41d88d6ab013b",7175:"2504c43fac77ecd9ec2a",7202:"51dc5863b815a89249ff",7277:"613fffcc5a1e81f370a6",7304:"b58eab838bd5c3a7961a",7374:"f9d744ba6bbd7c1dd689",7572:"43e7ef49b3f50cca6f8f",7789:"da54483123f377e9b3e1",7845:"9480f870574d3a9d4053",7873:"93eb468381bfcf0e47d7",8008:"823e25dbc70e71257b6e",8061:"112cb75f07c611d327f9",8062:"69f57ad2227e59b323e8",8096:"3c9da9b88777700879aa",8163:"9dc4db35c387e11e9beb",8227:"76b424b6d2c1ef089324",8326:"3fcb0d2c45e276ce355e",8422:"1e7d6920c4d176093ca8",8494:"8e0540562e433ff17a3b",8636:"f5d10ea7b8888f822b0c",8758:"ce546851aa7f48585494",8828:"92e1fd97afcdbb719e3f",8899:"b81c0d35f169a7df25c0",9032:"1f4f1896880bfa6801c5",9070:"3281656a9bd3627e41ff",9147:"d4ae3a25ec5b4773cfcc",9153:"ff6ebc9c3890a9e28e12",9169:"76b75ac18c8239687321",9228:"4d14be8c7e8adaa91876",9291:"ed763fc352d0b55e5867",9293:"073c067956c6cd792384",9296:"f0d1b51492106fda3efe",9348:"f1fdb335c5f9ec8b27cb",9454:"1a360d839c4eb83aaa02",9594:"9d824cdfbcdf3cb3246f",9779:"9b8711ba50ebaec535f8",9884:"356db8b8297282c77291",9904:"cf3e1ac63580bc495ea6",9932:"2f60073d3f14fdfba457"}[e]+".js",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{var e={134:1};r.f.i=(t,n)=>{e[t]||importScripts(r.p+r.u(t))};var t=self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[],n=t.push.bind(t);t.push=t=>{var[o,s,i]=t;for(var a in s)r.o(s,a)&&(r.m[a]=s[a]);for(i&&i(r);o.length;)e[o.pop()]=1;n(t)}})(),r(88277);var n=r(25045);RemoteClient=n})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.25.0-next.20220729",
3
+ "version": "4.25.0-next.20220731",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
package/rest/identify.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import t from"../request.js";import{normalizeCentralMeridian as r}from"../geometry/support/normalizeUtils.js";import{parseUrl as e,encode as s,asValidOptions as o}from"./utils.js";import{identifyToIdentifyRESTParameters as n}from"./operations/identify.js";import u from"./support/IdentifyParameters.js";import f from"./support/IdentifyResult.js";async function i(u,f,i){const c=(f=a(f)).geometry?[f.geometry]:[],l=e(u);return l.path+="/identify",r(c).then((r=>{const e=n(f,{geometry:r&&r[0]}),u=s({...l.query,f:"json",...e}),a=o(u,i);return t(l.path,a).then(m).then((t=>p(t,f.sublayers)))}))}function m(t){const r=t.data;r.results=r.results||[];const e={results:[]};return e.results=r.results.map((t=>f.fromJSON(t))),e}function a(t){return t=u.from(t)}function p(t,r){if(!r?.length)return t;const e=new Map;function s(t){e.set(t.id,t),t.sublayers&&t.sublayers.forEach(s)}r.forEach(s);for(const o of t.results)o.feature.sourceLayer=e.get(o.layerId);return t}export{i as identify};
5
+ import r from"../request.js";import{normalizeCentralMeridian as e}from"../geometry/support/normalizeUtils.js";import{parseUrl as t,encode as o,asValidOptions as s}from"./utils.js";import{identifyToIdentifyRESTParameters as n}from"./operations/identify.js";import u from"./support/IdentifyParameters.js";import i from"./support/IdentifyResult.js";async function f(u,i,f){const c=(i=a(i)).geometry?[i.geometry]:[],l=t(u);return l.path+="/identify",e(c).then((e=>{const t=n(i,{geometry:e&&e[0]}),u=o({...l.query,f:"json",...t}),a=s(u,f);return r(l.path,a).then(m).then((r=>p(r,i.sublayers)))}))}function m(r){const e=r.data;return e.results=e.results||[],e.exceededTransferLimit=Boolean(e.exceededTransferLimit),e.results=e.results.map((r=>i.fromJSON(r))),e}function a(r){return r=u.from(r)}function p(r,e){if(!e?.length)return r;const t=new Map;function o(r){t.set(r.id,r),r.sublayers&&r.sublayers.forEach(o)}e.forEach(o);for(const s of r.results)s.feature.sourceLayer=t.get(s.layerId);return r}export{f as identify};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const a="20220729",c="9b764948c15937e3a0744a4ac3b5d4a4f1507d54";export{a as buildDate,c as commitHash};
5
+ const b="20220731",e="54752b14a3594f0a372b03eb500f925c39eb30b9";export{b as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{c as t}from"../../../chunks/vec4f64.js";import{empty as s}from"../../../geometry/support/aaBoundingBox.js";import{BufferPool as i}from"../../../geometry/support/buffer/BufferPool.js";import{newLayout as e}from"../support/buffer/InterleavedLayout.js";import{GEOMETRY_VERTEX_STRIDE as f}from"./TerrainConst.js";import{internalAssert as u}from"./terrainUtils.js";import{VertexAttribute as r}from"../webgl-engine/lib/VertexAttribute.js";class h{constructor(){this.indices=null,this.vertexAttributes=null,this.boundingBox=s(),this.indexCount=0,this.numVerticesPerSide=0,this.uvOffsetAndScale=t(),this.outerEdges=[null,null,null,null],this.innerEdges=[null,null,null,null]}}class o{constructor(t,s,i,e,f){this._buf=t,this._localOrigin=s,this.offset0=i,this.stride=e,this.count=f}getVertexOffset(t){return u(0<=t&&t<this.count),this.offset0+this.stride*t}getVertex(t,s){const i=this.getVertexOffset(s)*f;t[0]=this._buf[i+0]+this._localOrigin[0],t[1]=this._buf[i+1]+this._localOrigin[1],t[2]=this._buf[i+2]+this._localOrigin[2]}getVertexNormal(t,s,i){const e=this.getVertexOffset(i)*f;t[0]=this._buf[e+0]+this._localOrigin[0],t[1]=this._buf[e+1]+this._localOrigin[1],t[2]=this._buf[e+2]+this._localOrigin[2],s[0]=this._buf[e+5],s[1]=this._buf[e+6],s[2]=this._buf[e+7]}getVertexRawNormal(t,s,i){const e=this.getVertexOffset(i)*f;t[0]=this._buf[e+0],t[1]=this._buf[e+1],t[2]=this._buf[e+2],s[0]=this._buf[e+5],s[1]=this._buf[e+6],s[2]=this._buf[e+7]}getNormal(t,s){const i=this.getVertexOffset(s)*f;t[0]=this._buf[i+5],t[1]=this._buf[i+6],t[2]=this._buf[i+7]}setVertexUV(t,s,i,e){const u=this.getVertexOffset(t)*f;this._buf[u+0]=s[0]-this._localOrigin[0],this._buf[u+1]=s[1]-this._localOrigin[1],this._buf[u+2]=s[2]-this._localOrigin[2],this._buf[u+3]=i,this._buf[u+4]=e}setNormal(t,s){const i=this.getVertexOffset(t)*f;this._buf[i+5]=s[0],this._buf[i+6]=s[1],this._buf[i+7]=s[2]}setVertexUVNormal(t,s,i,e,u){const r=this.getVertexOffset(t)*f;this._buf[r+0]=s[0]-this._localOrigin[0],this._buf[r+1]=s[1]-this._localOrigin[1],this._buf[r+2]=s[2]-this._localOrigin[2],this._buf[r+3]=i,this._buf[r+4]=e,this._buf[r+5]=u[0],this._buf[r+6]=u[1],this._buf[r+7]=u[2]}setVertexFromValuesRawXYZUV(t,s,i,e,u,r){const h=this.getVertexOffset(t)*f;this._buf[h+0]=s,this._buf[h+1]=i,this._buf[h+2]=e,this._buf[h+3]=u,this._buf[h+4]=r}setVertexRawXYZUV(t,s,i,e){const u=this.getVertexOffset(t)*f;this._buf[u+0]=s[0],this._buf[u+1]=s[1],this._buf[u+2]=s[2],this._buf[u+3]=i,this._buf[u+4]=e}setVertexRawXYZUVN(t,s,i,e,u){const r=this.getVertexOffset(t)*f;this._buf[r+0]=s[0],this._buf[r+1]=s[1],this._buf[r+2]=s[2],this._buf[r+3]=i,this._buf[r+4]=e,this._buf[r+5]=u[0],this._buf[r+6]=u[1],this._buf[r+7]=u[2]}}const n=e().vec3f(r.POSITION).vec2f(r.UV0).vec3f(r.NORMAL),l=new i((t=>n.createBuffer(t)),(t=>t.count));function _(){l.clear()}function b(t){return l.acquire(t)}function c(t){l.release(t.vertexAttributes),t.vertexAttributes=null,t.indices=null}export{o as EdgeDescriptor,h as PatchGeometry,b as acquireTerrainAttributes,_ as clearCaches,c as releaseGeometry};
5
+ import{c as t}from"../../../chunks/vec4f64.js";import{empty as s}from"../../../geometry/support/aaBoundingBox.js";import{BufferPool as i}from"../../../geometry/support/buffer/BufferPool.js";import{newLayout as e}from"../support/buffer/InterleavedLayout.js";import{GEOMETRY_VERTEX_STRIDE as f}from"./TerrainConst.js";import{internalAssert as u}from"./terrainUtils.js";import{VertexAttribute as r}from"../webgl-engine/lib/VertexAttribute.js";class h{constructor(){this.indices=null,this.vertexAttributes=null,this.boundingBox=s(),this.indexCount=0,this.numVerticesPerSide=0,this.uvOffsetAndScale=t(),this.outerEdges=[null,null,null,null],this.innerEdges=[null,null,null,null]}}class n{constructor(t,s,i,e,f){this._buf=t,this._localOrigin=s,this.offset0=i,this.stride=e,this.count=f}getVertexOffset(t){return u(0<=t&&t<this.count),this.offset0+this.stride*t}getVertexXYZ(t,s){const i=this.getVertexOffset(s)*f;t[0]=this._buf[i+0]+this._localOrigin[0],t[1]=this._buf[i+1]+this._localOrigin[1],t[2]=this._buf[i+2]+this._localOrigin[2]}getVertexXYZN(t,s,i){const e=this.getVertexOffset(i)*f;t[0]=this._buf[e+0]+this._localOrigin[0],t[1]=this._buf[e+1]+this._localOrigin[1],t[2]=this._buf[e+2]+this._localOrigin[2],s[0]=this._buf[e+5],s[1]=this._buf[e+6],s[2]=this._buf[e+7]}getVertexRawXYZN(t,s,i){const e=this.getVertexOffset(i)*f;t[0]=this._buf[e+0],t[1]=this._buf[e+1],t[2]=this._buf[e+2],s[0]=this._buf[e+5],s[1]=this._buf[e+6],s[2]=this._buf[e+7]}getNormal(t,s){const i=this.getVertexOffset(s)*f;t[0]=this._buf[i+5],t[1]=this._buf[i+6],t[2]=this._buf[i+7]}setNormal(t,s){const i=this.getVertexOffset(t)*f;this._buf[i+5]=s[0],this._buf[i+6]=s[1],this._buf[i+7]=s[2]}setVertexUVN(t,s,i,e,u){const r=this.getVertexOffset(t)*f;this._buf[r+0]=s[0]-this._localOrigin[0],this._buf[r+1]=s[1]-this._localOrigin[1],this._buf[r+2]=s[2]-this._localOrigin[2],this._buf[r+3]=i,this._buf[r+4]=e,this._buf[r+5]=u[0],this._buf[r+6]=u[1],this._buf[r+7]=u[2]}setVertexFromValuesRawXYZUV(t,s,i,e,u,r){const h=this.getVertexOffset(t)*f;this._buf[h+0]=s,this._buf[h+1]=i,this._buf[h+2]=e,this._buf[h+3]=u,this._buf[h+4]=r}setVertexRawXYZUV(t,s,i,e){const u=this.getVertexOffset(t)*f;this._buf[u+0]=s[0],this._buf[u+1]=s[1],this._buf[u+2]=s[2],this._buf[u+3]=i,this._buf[u+4]=e}setVertexRawXYZUVN(t,s,i,e,u){const r=this.getVertexOffset(t)*f;this._buf[r+0]=s[0],this._buf[r+1]=s[1],this._buf[r+2]=s[2],this._buf[r+3]=i,this._buf[r+4]=e,this._buf[r+5]=u[0],this._buf[r+6]=u[1],this._buf[r+7]=u[2]}}const o=e().vec3f(r.POSITION).vec2f(r.UV0).vec3f(r.NORMAL),_=new i((t=>o.createBuffer(t)),(t=>t.count));function b(){_.clear()}function l(t){return _.acquire(t)}function c(t){_.release(t.vertexAttributes),t.vertexAttributes=null,t.indices=null}export{n as EdgeDescriptor,h as PatchGeometry,l as acquireTerrainAttributes,b as clearCaches,c as releaseGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{isPowerOfTwo as e,clamp as t,lerp as n}from"../../../core/mathUtils.js";import{isNone as o,isSome as r,unwrapOr as s}from"../../../core/maybe.js";import{s as a,n as i,w as c,f as l,a as f}from"../../../chunks/vec3.js";import{c as u}from"../../../chunks/vec3f64.js";import{s as d}from"../../../chunks/vec4.js";import{empty as g}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as m,containsXYWithMargin as p}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevationOrZero as h}from"./ElevationData.js";import{PatchType as x,NeighborIndex as M}from"./interfaces.js";import{acquireTerrainAttributes as S,EdgeDescriptor as v}from"./PatchGeometry.js";import{PatchGeometryLUT as b}from"./PatchGeometryLUT.js";import{neighborTileIfLoadedOrSelf as y}from"./PatchRenderData.js";import{GEOMETRY_VERTEX_STRIDE as D}from"./TerrainConst.js";import{internalAssert as O,ENABLE_TERRAIN_INTERNAL_CHECKS as V,neighborEdgeIndices as A}from"./terrainUtils.js";import{isCornerNeighbor as E}from"./Tile.js";const R=65536;function P(e,t){const n=e.tile,{extent:o,extentInRadians:r,surface:s}=n,c=e.localOrigin,l=e.geometryState,u=s.isWebMercator,m=s.shadingEnabled,p=l.numVerticesPerSide,M=p-1,v=(p-2)**2,b=u&&(t===x.HAS_SOUTH_POLE||t===x.HAS_BOTH_POLES),y=u&&(t===x.HAS_NORTH_POLE||t===x.HAS_BOTH_POLES),V=6,A=((b?1:0)+(y?1:0))*V*(M+1),E=l.neighborData,R=E.edgeResolutions.reduce(((e,t)=>e+t+1),0),P=S(v+A+R),I=e.geometryInfo;I.numVerticesPerSide=l.numVerticesPerSide,I.vertexAttributes=P,d(I.uvOffsetAndScale,0,0,1,1);const L=P.position.typedBuffer,B=P.uv0.typedBuffer,N=P.normal.typedBuffer,C=I.boundingBox;g(C);const U=c[0],w=c[1],j=c[2];xe.update(M,r);const H=l.samplerData,W=n.ellipsoid.radius,X=Y(e),Z=p-2,F=o[0],G=o[2],q=o[1],z=o[3];(()=>{if(!n.intersectsClippingArea)return;if((()=>{let e=0;for(let t=1;t<=Z;t++){const n=t/M,o=q*(1-n)+z*n,r=X(n),s=Math.cos(r),a=Math.sin(r);for(let t=1;t<=Z;t++){const r=t/M,i=F*(1-r)+G*r,c=xe.sinLonLUT[t],l=xe.cosLonLUT[t],f=W+h(i,o,H),u=l*s*f-U,d=c*s*f-w,g=a*f-j;pe(u,d,g,C);const m=D*e;L[m+0]=u,L[m+1]=d,L[m+2]=g,B[m+0]=r,B[m+1]=n,++e}}})(),m){(()=>{const t=P.position,n=P.normal;let o=0;const r=e=>{t.getVec(e,ve),k()},s=(e,t)=>{{const n=e/M,o=F*(1-n)+G*n,r=xe.sinLonLUT[e],s=xe.cosLonLUT[e],i=t/M,c=q*(1-i)+z*i,l=X(i),f=Math.cos(l),u=Math.sin(l),d=W+h(o,c,H);a(ve,s*f*d-U,r*f*d-w,u*d-j)}k()},c=(e,t,n)=>{e>1&&t>1&&e<Z&&t<Z?r(o+n):s(e,t)};for(let l=1;l<=Z;l++)for(let r=1;r<=Z;r++)t.getVec(o,Oe),f(Ve,Oe,e.localOrigin),i(Ae,Ve),a(Ee,0,0,0),c(r-1,l,-1),c(r+1,l,1),c(r,l-1,-Z),c(r,l+1,+Z),i(Ee,Ee),n.setVec(o,Ee),++o})()}})(),fe(e,v),T(e);const J=[];(()=>{let e=v+R;const t=(t,n)=>{const o=n*p;pe(-U,-w,t*W-j,C),J.push({connectedRowOffset:o,connectedOuterEdgeOffset:1===t?0:2,rowOffset:e,latitudeResolution:V});const r=_(-1===t?q:z,W),s=t*Math.PI/2-r,a=.99*(1===t?1:-1),i=W+0;for(let c=1;c<=V;++c){const t=r+s*(c/V),n=Math.cos(t),o=Math.sin(t);for(let r=0;r<=M;r++){const t=r/M,s=xe.sinLonLUT[r],c=xe.cosLonLUT[r]*n*i-U,l=s*n*i-w,f=o*i-j;pe(c,l,f,C);const u=D*e;if(L[u+0]=c,L[u+1]=l,L[u+2]=f,B[u+0]=t,B[u+1]=a,m){const e=1/Math.sqrt(c*c+l*l+f*f);N[u+0]=e*c,N[u+1]=e*l,N[u+2]=e*f}++e}}};b&&t(-1,0),y&&t(1,M)})(),le(I,l.numVerticesPerSide,J,[0,p-1],[0,p-1],l.wireframe),e.intersectionData=null;for(let a=0;a<4;++a)O(I.outerEdges[a].count===E.edgeResolutions[a]+1)}function I(e){e.tile.intersectsClippingArea&&(T(e),de(e))}function L(e){e.tile.intersectsClippingArea&&(N(e),B(e,!0),de(e))}function T(e){e.tile.intersectsClippingArea&&(N(e),B(e,!1))}function B(t,n){const s=t.geometryState,c=s.neighborData,l=t.tile,f=l.level,u=l.extent,d=l.ellipsoid.radius,g=l.extentInRadians,m=g[0],p=g[2],x=g[1],M=g[3],S=s.samplerData,v=t.geometryInfo,b=v.boundingBox,E=v.vertexAttributes,R=E.position.typedBuffer,P=E.uv0.typedBuffer,I=E.normal.typedBuffer,L=t.localOrigin,T=L[0],B=L[1],N=L[2],C=l.surface.shadingEnabled;for(let U=0;U<4;++U){const s=c.edgePeerNeighbors[U],E=y(l,s),L=c.edgeResolutions[U];if(V){const e=l.surface;if(!E&&e&&!e.updatingRootTiles){const t=A[U],n=l.findNeighborTile(t,(e=>e.isLoaded||e.isLeaf||e.level===l.level));n?n.intersectsClippingArea&&(O(!n.isLoaded),O(!n.isLeaf),O(n.level===f)):O(o(e?.rootTiles)||!l.shouldHaveNeighbor(t))}}const w=L;O(e(w));const j=1===U||3===U,H=1===U?p:m,_=0===U?M:x,W=l.level-(E?.level??l.level),X=w*2**W,Z=l.getNeighborEdgeStartVertexIndex(U,E)*w,F=E?.renderData?.geometryState?.samplerData,G=r(E),q=G&&0===W,z=E?.extent,J=G?z:u,K=J[0],Q=J[2],$=J[1],ee=J[3],te=G?E.extentInRadians:g,ne=te[0],oe=te[2],re=G?Z:0,se=G?X:w,ae=Y(G?E.renderData:t),ie=1===U?1:0,ce=0===U?1:0,le=1===U?u[2]:u[0],fe=0===U?u[3]:u[1];let ue=ie,de=le,ge=G&&j?1===U?z[0]:z[2]:le,me=H,he=ce,xe=fe,Me=_,Se=Math.sin(me),be=Math.cos(me),ye=Math.cos(Me),De=Math.sin(Me);const Ve=(e,t)=>{he=e,xe=$*(1-t)+ee*t,Me=ae(t),ye=Math.cos(Me),De=Math.sin(Me)},Re=(e,t)=>{ue=e,de=K*(1-t)+Q*t,ge=de,me=ne*(1-t)+oe*t,Se=Math.sin(me),be=Math.cos(me)},Pe=j?Ve:Re,Ie=v.outerEdges[U],Le=w+1,Te=()=>h(ge,xe,F),Be=()=>h(de,xe,S),Ne=()=>.5*(Te()+Be()),Ce=q?Ne:Te,Ue=G?Ce:Be;let we=re/se;const je=G?z:u,He=G?X:w,_e=1===U?-1:3===U?1:0,We=0===U?-1:2===U?1:0,Xe=(je[2]-je[0])/He,Ye=_e*Xe,Ze=We*Xe,ke=G?E.extentInRadians:l.extentInRadians,Fe=ke[2]-ke[0],Ge=j?_e*(Fe/He):0,qe=j?0:We*(1/He),ze=G?1-ce:ce,Je=e=>{const t=e?-1:1,n=h((e?ge:de)+t*Ye,xe+t*Ze,e?F:S),o=d+n,r=j?me+t*Ge:me,s=j?Math.sin(r):Se,i=j?Math.cos(r):be,c=j?Me:ae(ze+t*qe),l=j?De:Math.sin(c),f=j?ye:Math.cos(c);a(ve,i*f*o,s*f*o,l*o),k()},Ke=Ie.getVertexOffset(0),Qe=n&&Le>3?Le-3:1;for(let e=1;e<Le-1;e+=Qe){const t=e/w;if(we=(re+e)/se,Pe(t,we),V){O(0!==e||0===t),O(e!==Le-1||1===t);const n=.001;O(u[0]<=de&&de<=u[2]),O(u[1]<=xe&&xe<=u[3]),O(m-n<=me&&me<=p+n),O(x-n<=Me&&Me<=M+n),O(0<=ue&&ue<=1),O(0<=he&&he<=1)}const n=Ue(),o=d+n,r=be*ye*o,s=Se*ye*o,c=De*o,l=r-T,f=s-B,g=c-N;pe(l,f,g,b);const h=D*(Ke+e);R[h+0]=l,R[h+1]=f,R[h+2]=g,P[h+0]=ue,P[h+1]=he,C&&(a(Ee,0,0,0),a(Oe,r,s,c),i(Ae,Oe),E&&Je(!0),E&&!q||Je(!1),I[h+0]=Ee[0],I[h+1]=Ee[1],I[h+2]=Ee[2])}if(C){const e=G?l.getNeighborEdgeStartVertexIndex(U,E)*w:0,t=!G||!q&&0===e,n=G?(Le-1)*2**(l.level-E.level)+1:0;O(!G||0<=e&&e<=n-w);const o=!G||!q&&e+Le===n;for(let r=1;r<Le-1;r+=Qe)Ie.getVertexNormal(Oe,Ee,r),i(Ae,Oe),(!t||r>1)&&(Ie.getVertex(ve,r-1),k()),(!o||r<Le-2)&&(Ie.getVertex(ve,r+1),k()),i(Ee,Ee),Ie.setNormal(r,Ee)}}}function N(e){C(e),U(e)}function C(e){ue(e,((t,n,o,r)=>H(t,n,o,r,e.tile.extentInRadians,e.tile.ellipsoid.radius)))}function U(e){e.tile.surface.shadingEnabled&&ge(e,((e,t,n,o)=>Z(e,t,n,o)))}function w(e,t,n,o,r){const s=Y(e),a=e.tile,i=a.extent;O(p(i,n,o,1));const c=(n-i[0])/(i[2]-i[0]),l=(o-i[1])/(i[3]-i[1]),f=a.extentInRadians;j(t,f[0]*(1-c)+f[2]*c,s(l),r,a.ellipsoid.radius)}function j(e,t,n,o,r){const s=Math.cos(n),a=Math.sin(n),i=Math.sin(t),c=Math.cos(t),l=r+o;e[0]=c*s*l,e[1]=i*s*l,e[2]=a*l}function H(e,t,n,o,r,s){const a=r[0===n?1:3];j(e,r[0===t?0:2],a,o,s)}function _(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function W(e,t,n,o){return _(e*(1-o)+t*o,n)}function X(e,t,n){return e*(1-n)+t*n}function Y(e){const t=e.tile;if(t.surface.isWebMercator){const e=t.extent,n=t.ellipsoid.radius;return t=>W(e[1],e[3],n,t)}const n=t.extentInRadians;return e=>X(n[1],n[3],e)}function Z(e,t,n,o){w(e,ve,t,n,o),k()}function k(){c(be,ve,Oe),l(ye,be,Ae),l(De,ye,be),f(Ee,Ee,De)}function F(e,n){const o=e.tile,s=o.extent,c=e.localOrigin,l=e.geometryState,f=o.surface,u=f.isWebMercatorOnPlateeCarree,p=f.shadingEnabled,x=s[0],M=s[1],v=s[2],b=s[3],y=v-x,O=b-M,V=l.clippingArea,A=r(V)?Math.max(0,(V[0]-s[0])/y):0,E=r(V)?Math.max(0,(V[1]-s[1])/O):0,R=r(V)?Math.min(1,(V[2]-s[0])/y):1,P=r(V)?Math.min(1,(V[3]-s[1])/O):1,I=R-A,L=P-E,T=I>0?1/I:1,B=L>0?1/L:1,N=-A*T,C=-E*B,U=l.numVerticesPerSide,w=U-1,j=(U-2)**2,H=l.neighborData.edgeResolutions.reduce(((e,t)=>e+t+1),0),_=S(j+H),W=_.position.typedBuffer,X=_.uv0.typedBuffer,Y=_.normal.typedBuffer,Z=e.geometryInfo,k=Z.boundingBox;g(k);const F=o.ellipsoid.radius,G=l.samplerData,q=r(V)?V:Me,J=m(Math.max(s[0],q[0]),Math.max(s[1],q[1]),Math.min(s[2],q[2]),Math.min(s[3],q[3])),K=c[0],Q=c[1],$=c[2],ee=oe(u,F,n);(()=>{if(!e.tile.intersectsClippingArea)return;const o=U-2;(()=>{let e=0;for(let r=1;r<=o;r++){const s=r/w,a=C+s*B,i=t(M*(1-s)+b*s,J[1],J[3]),c=t(a,0,1),l=ee(i)-Q;for(let r=1;r<=o;r++){const o=r/w,s=N+o*T,a=t(x*(1-o)+v*o,J[0],J[2]),f=t(s,0,1),u=h(a,i,G),d=a*n-K,g=u-$;pe(d,l,g,k);const m=D*e;W[m+0]=d,W[m+1]=l,W[m+2]=g,X[m+0]=f,X[m+1]=c,++e}}})();(()=>{if(!p)return;let e=0;const r=(e,o)=>{const r=e/w,s=t(x*(1-r)+v*r,J[0],J[2]),a=o/w,i=t(M*(1-a)+b*a,J[1],J[3]),c=h(s,i,G);Se[0]=s*n,Se[1]=ee(i),Se[2]=c},s=(e,t)=>{const n=D*t;e[0]=W[n+0]+K,e[1]=W[n+1]+Q,e[2]=W[n+2]+$};for(let t=1;t<=o;t++)for(let n=1;n<=o;n++){a(Ee,0,0,0),s(Oe,e);{1===n?r(n-1,t):s(Se,e-1);const a=Se[0]-Oe[0],i=Se[2]-Oe[2];n===o?r(n+1,t):s(Se,e+1);const c=Se[0]-Oe[0],l=Se[2]-Oe[2];Ee[0]+=-a*i-c*l,Ee[2]+=a*a+c*c}1===t?r(n,t-1):s(Se,e-o);const c=Se[1]-Oe[1],l=Se[2]-Oe[2];t===o?r(n,t+1):s(Se,e+o);const f=Se[1]-Oe[1],u=Se[2]-Oe[2];Ee[1]+=-c*l-f*u,Ee[2]+=c*c+f*f,i(Ee,Ee);const d=D*e;Y[d+0]=Ee[0],Y[d+1]=Ee[1],Y[d+2]=Ee[2],++e}})()})(),Z.numVerticesPerSide=l.numVerticesPerSide,Z.vertexAttributes=_,d(e.geometryInfo.uvOffsetAndScale,A,E,R-A,P-E),fe(e,j),z(e,n),le(Z,l.numVerticesPerSide,[],[0,U-1],[0,U-1],l.wireframe),e.intersectionData=null}function G(e,t){e.tile.intersectsClippingArea&&(K(e,t),J(e,t,!0),de(e))}function q(e,t){e.tile.intersectsClippingArea&&(z(e,t),de(e))}function z(e,t){e.tile.intersectsClippingArea&&(K(e,t),J(e,t,!1))}function J(n,s,c){const l=n.geometryState,f=l.neighborData,u=n.tile,d=u.level,g=u.surface,p=g.shadingEnabled,x=n.localOrigin,M=u.extent,S=M[0],v=M[2],b=M[1],D=M[3],E=l.clippingArea,R=r(E)?E:Me,P=m(Math.max(M[0],R[0]),Math.max(M[1],R[1]),Math.min(M[2],R[2]),Math.min(M[3],R[3])),I=[M[3]>R[3],M[2]>R[2],M[1]<R[1],M[0]<R[0]],L=P[0],T=P[2],B=P[1],N=P[3],C=n.geometryInfo,U=C.boundingBox,w=l.samplerData,j=C.uvOffsetAndScale[0],H=C.uvOffsetAndScale[1],_=C.uvOffsetAndScale[2],W=C.uvOffsetAndScale[3],X=_>0?1/_:1,Y=W>0?1/W:1,Z=-j*X,k=-H*Y;for(let m=0;m<4;++m){const n=f.edgeResolutions[m],E=l.neighborData.edgePeerNeighbors[m],R=y(u,E);if(V&&!R&&u&&!g.updatingRootTiles){const e=A[m],t=u.findNeighborTile(e,(e=>e.isLoaded||e.isLeaf||e.level===d));g.updatingRootTiles||(t?t.intersectsClippingArea&&(O(!t.isLoaded),O(!t.isLeaf),O(t.level===d)):O(o(g?.rootTiles)||!u.shouldHaveNeighbor(e)))}const P=n;O(e(P));const j=P+1,H=I[m],_=r(R);O(!_||R?.isLoaded),O(!_||R?.intersectsClippingArea);const W=R?.renderData.geometryState.samplerData,F=(e,t)=>h(e,t,w),G=(e,t)=>.5*(h(e,t,W)+h(e,t,w)),q=(e,t)=>h(e,t,W),z=R?.level===d,J=z?G:q,K=H||!_?F:J,Q=C.outerEdges[m],$=oe(g.isWebMercatorOnPlateeCarree,u.ellipsoid.radius,s),ee=1===m||3===m,te=(M[2]-M[0])/n,ne=t(1===m?M[2]:M[0],L,T),re=t(0===m?M[3]:M[1],B,N),se=1===m?1:0,ae=0===m?1:0,ie=c&&j>3?j-3:1;for(let e=1;e<j-1;e+=ie){const n=e/P,o=ee?ne:t(S*(1-n)+v*n,L,T),r=ee?t(b*(1-n)+D*n,B,N):re,a=ee?se:t(Z+n*X,0,1),i=ee?t(k+n*Y,0,1):ae,c=K(o,r),l=o*s-x[0],f=$(r)-x[1],u=c-x[2];pe(l,f,u,U),Q.setVertexFromValuesRawXYZUV(e,l,f,u,a,i)}if(p){const e=e=>{const t=Se[e]-Oe[e],n=Se[2]-Oe[2];Ee[e]+=-t*n,Ee[2]+=t*t},n=ee?1===m?te:-te:0,o=ee?0:0===m?te:-te,r=-n,c=-o,l=ee?1:0,f=_?u.getNeighborEdgeStartVertexIndex(m,R)*P:0,d=!_||!z&&0===f,g=_?(j-1)*2**(u.level-R.level)+1:0;O(!_||0<=f&&f<=g-P);const p=!_||!z&&f+j===g;for(let u=1;u<j-1;u+=ie){const f=u/P,g=ee?ne:t(S*(1-f)+v*f,L,T),m=ee?t(b*(1-f)+D*f,B,N):re;Q.getVertex(Oe,u),a(Ee,0,0,0),(!d||u>1)&&(Q.getVertex(Se,u-1),e(l)),(!p||u<j-2)&&(Q.getVertex(Se,u+1),e(l)),_&&(Se[0]=ee?s*(g+n):Oe[0],Se[1]=ee?Oe[1]:$(m+o),Se[2]=h(g+n,m+o,W),e(1-l)),_&&!z||(Se[0]=ee?s*(g+r):Oe[0],Se[1]=ee?Oe[1]:$(m+c),Se[2]=h(g+r,m+c,w),e(1-l)),i(Ee,Ee),Q.setNormal(u,Ee)}}}}function K(e,t){Q(e,t),ee(e,t)}function Q(e,t){const n=e.tile;r(n.renderData.geometryState.clippingArea)?$(e,t):ue(e,((o,r,s,a)=>re(o,r,s,a,e.tile.extent,t,oe(n.surface.isWebMercatorOnPlateeCarree,n.ellipsoid.radius,t))))}function $(e,n){const o=e.geometryState,a=e.tile,i=a.extent,c=s(o.clippingArea,i),l=e.geometryInfo,f=l.boundingBox,u=l.outerEdges,d=l.uvOffsetAndScale[0],g=l.uvOffsetAndScale[1],m=l.uvOffsetAndScale[2],p=l.uvOffsetAndScale[3],x=m>0?1/m:1,M=p>0?1/p:1,S=-d*x,v=-g*M,b=a.surface.isWebMercatorOnPlateeCarree,D=oe(b,b?a.ellipsoid.radius:0,n),O=o.samplerData,V=o.neighborData,A=e.localOrigin,E=o=>{const s=(o+1)%4,l=0===o||1===o?1:0,d=0===o||3===o?1:0,g=u[o],m=0===o||3===o?g.count-1:0,p=u[s],b=0===o||1===o?p.count-1:0,E=i[0]*(1-l)+i[2]*l,R=i[1]*(1-d)+i[3]*d,P=t(E,c[0],c[2]),I=t(R,c[1],c[3]),L=[I===i[3],P===i[2],I===i[1],P===i[0]],T=!L[3]&&!L[1]||!L[0]&&!L[2],B=V.edgePeerNeighbors.map((e=>y(a,e))),N=T?L[0]&&r(B[0])?B[0]:L[1]&&r(B[1])?B[1]:L[2]&&r(B[2])?B[2]:L[3]&&r(B[3])?B[3]:null:null,C=T?N?N.level===a.level?.5*(h(P,I,O)+h(P,I,N.renderData.geometryState.samplerData)):h(P,I,N.renderData.geometryState.samplerData):h(P,I,O):me(e,o),U=P*n-A[0],w=D(I)-A[1],j=C-A[2];pe(U,w,j,f);const H=t(S+l*x,0,1),_=t(v+d*M,0,1);g.setVertexFromValuesRawXYZUV(m,U,w,j,H,_),p.setVertexFromValuesRawXYZUV(b,U,w,j,H,_)};for(let t=0;t<4;++t)E(t)}function ee(e,t){if(e.tile.surface.shadingEnabled){const n=ae(e,t);ge(e,((e,t,o,r)=>se(n,t,o,r)))}}function te(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function ne(e,t){return e*t}function oe(e,t,n){return e?e=>te(e,t):e=>ne(e,n)}function re(e,t,n,o,r,s,a){const i=0===t?r[0]:r[2],c=0===n?r[1]:r[3],l=o;e[0]=i*s,e[1]=a(c),e[2]=l}function se(e,t,n,o){e(t,n,o);const r=ve[0]-Oe[0],s=ve[1]-Oe[1],a=ve[2]-Oe[2];De[0]=-r*a,De[1]=-s*a,De[2]=r*r+s*s,f(Ee,Ee,De)}function ae(e,t){return e.tile.surface.isWebMercatorOnPlateeCarree?(n,o,r)=>ce(t,e.tile.ellipsoid.radius,n,o,r):(e,n,o)=>ie(t,e,n,o)}function ie(e,t,n,o){ve[0]=t*e,ve[1]=n*e,ve[2]=o}function ce(e,t,n,o,r){ve[0]=n*e,ve[1]=(Math.PI/2-2*Math.atan(Math.exp(-o/t)))*t,ve[2]=r}function le(e,t,n,o,r,s){const a=t-1,i=e.vertexAttributes.count,c=2*(Math.min(t-2,o[1])-Math.max(1,o[0]))*(Math.min(t-2,r[1])-Math.max(1,r[0])),l=A.map(((e,n)=>0===n&&r[1]<t-2||1===n&&o[1]<t-2||2===n&&r[0]>1||3===n&&o[0]>1)),f=e.outerEdges.reduce(((e,t,n)=>e+(l[n]?0:a-2+t.count-1)),0),u=n.reduce(((e,t)=>e+a*(2*(t.latitudeResolution-1)+1)),0),d=s?2:1,g=3*(c+f+u)*d,m=new(i>R?Uint32Array:Uint16Array)(g);let p=0;const h=s?(e,t,n)=>{m[p++]=e,m[p++]=t,m[p++]=t,m[p++]=n,m[p++]=n,m[p++]=e,V&&(O(e<i),O(t<i),O(n<i),O(p<=g))}:(e,t,n)=>{m[p++]=e,m[p++]=t,m[p++]=n,V&&(O(e<i),O(t<i),O(n<i),O(p<=g))},x=t-2,M=a-2;O(M>=0);(()=>{for(let e=Math.max(r[0],1)-1;e<Math.min(r[1],t-2)-1;++e)for(let n=Math.max(o[0],1)-1;n<Math.min(o[1],t-2)-1;++n){const t=e*x+n,o=t+1,r=o+x,s=r-1;h(t,o,r),h(r,s,t)}})(),O(p===3*c*d);(()=>{for(let t=0;t<4;++t){const n=p;if(l[t])continue;const o=e.outerEdges[t],r=e.innerEdges[t];let s=0,i=0;const c=o.count,f=r.count;O(f===a-1);const u=a-2+o.count-1;let g=0;const m=1===t||2===t?(e,t,n)=>h(e,t,n):(e,t,n)=>h(e,n,t);for(;s<c-1||i<f-1;){const e=r.getVertexOffset(i),t=o.getVertexOffset(s),n=s<c-1,l=i<f-1,u=n?0+a*(s+.5)/(c-1):0,d=l?1+M*(i+.5)/(f-1):0;if(n&&(!l||u<=d)){++s,V&&O(s<c);m(e,t,o.getVertexOffset(s)),g++}else{++i,V&&O(i<f);m(e,t,r.getVertexOffset(i)),g++}}V&&(O(s===c-1),O(i===f-1),O(g===c+f-2),O(u===g),O(p===n+3*g*d))}})(),O(p===3*(c+f)*d);const S=n=>{let o=e.outerEdges[n.connectedOuterEdgeOffset].offset0;for(let e=0;e<n.latitudeResolution;++e){const r=0===e?n.rowOffset:o+t;for(let t=0;t<a;t++)h(o,o+1,r+t),e<n.latitudeResolution-1&&h(o+1,r+t+1,r+t),++o;o=r}};(()=>{n.forEach(S)})(),O(p===g),e.indices=m,e.indexCount=g}function fe(e,t){const n=e.localOrigin,o=e.geometryInfo,r=e.geometryState.neighborData.edgeResolutions,s=o.numVerticesPerSide-2,a=o.vertexAttributes.position.typedBuffer;let i=t;for(let c=0;c<4;++c){{const e=0===c||2===c,t=(0===c?s-1:0)*s+(1===c?s-1:0),r=(e?0:1)*s+(e?1:0);o.innerEdges[c]=new v(a,n,t,r,s)}{const e=i,t=r[c]+1;o.outerEdges[c]=new v(a,n,e,1,t),i+=t}}}function ue(e,t){const n=e.geometryInfo,o=n.outerEdges,r=n.boundingBox,s=e.localOrigin;for(let a=0;a<4;++a){const n=(a+1)%4,i=0===a||1===a?1:0,l=0===a||3===a?1:0,f=o[a],u=0===a||3===a?f.count-1:0,d=o[n],g=0===a||1===a?d.count-1:0,m=me(e,a);t(Se,i,l,m),c(Se,Se,s),pe(Se[0],Se[1],Se[2],r),f.setVertexRawXYZUV(u,Se,i,l),d.setVertexRawXYZUV(g,Se,i,l)}}function de(e){const t=e.vao,n=e.geometryInfo.vertexAttributes;t?.vertexBuffers?.geometry?.setSubData(n.position.typedBuffer)}function ge(e,t){if(!e.tile.surface.shadingEnabled)return;const n=e.geometryState.neighborData.cornerNeighborData,o=e.tile,r=o.extent,s="local"===e.tile.surface.view?.viewingMode;s&&a(Ae,0,0,1);{const c=1,l=(e,n,o,r,s,a)=>{const i=1===a?s.extent[0]:3===a?s.extent[2]:e,l=0===a?s.extent[1]:2===a?s.extent[3]:n,f=i+he[o][0]*r,u=l+he[o][1]*r;O(p(s.extent,f,u,c));const d=s.renderData,g=h(f,u,d.geometryState.samplerData);t(d,f,u,g)},f=(e,t,n)=>e.extent[0===t||1===t?2:0]+n,u=(e,t,n)=>e.extent[0===t||3===t?3:1]+n,d=(e,n,o,r)=>{const s=f(o,r,he[e][0]*n),a=u(o,r,he[e][1]*n);O(p(o.extent,s,a,c));const i=o.renderData,l=h(s,a,i.geometryState.samplerData);t(i,s,a,l)},g=(e,n,o,r,s,a)=>{const i=he[e][0]*n,l=he[e][1]*n,d=f(o,r,i),g=u(o,r,l),m=f(s,a,i),x=u(s,a,l);O(p(o.extent,d,g,c)),O(p(s.extent,m,x,c));const M=o.renderData,S=s.renderData,v=h(d,g,M.geometryState.samplerData),b=h(m,x,S.geometryState.samplerData);t(M,d,g,.5*(v+b))},m=e=>{a(Ee,0,0,0);const t=0===e||1===e?r[2]:r[0],s=0===e||3===e?r[3]:r[1],i=n[e].cornerTiles,c=i.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);for(let n=0;n<4;++n){const e=i[n];Pe[n]=e?.level===c?e:null}for(let n=0;n<4;++n){const r=Pe[(n+3)%4],a=Pe[n];if(null!=r&&r!==o&&r===a){const a=r,i=o.renderData.geometryState.neighborData.edgeResolutions[n],c=i*2**(o.level-a.level),f=(a.extent[2]-a.extent[0])/c,u=(n+3)%4,d=(n+0)%4,g=(n+1)%4,m=o.getNeighborEdgeStartVertexIndex(n,a)*i;O(0<=m&&m<c);const p=m+(0===e||1===e&&2===n||3===e&&3===n?i:0);O(0<p&&p<c);const h=0===n||3===n,x=1===p,M=p===c-1;!(h&&x||!h&&M)&&l(t,s,u,f,a,n),l(t,s,d,f,a,n);return!(!h&&x||h&&M)&&l(t,s,g,f,a,n),Ee}}O(Pe.some((e=>e?.isLoaded||e===o)));const f=Pe.reduce(((e,t)=>t?t.extent[2]-t.extent[0]:e),0);O(f>0);const u=Pe.reduce(((e,t)=>Math.max(e,t?.renderData.geometryState.numVerticesPerSide??1)),1);O(u>1);const m=f/u;for(let n=0;n<4;++n){const e=Pe[(n+3)%4],t=Pe[(n+0)%4];if(!e&&!t)continue;const o=0===n?1:1===n?2:2===n?3:0,r=0===n?2:1===n?3:2===n?0:1;if(e&&t)g(n,m,e,o,t,r);else{d(n,m,e??t,e?o:r)}}return Ee};for(let t=0;t<4;++t){const n=e.geometryInfo.outerEdges[t],o=1===t||2===t?0:n.count-1;n.getVertex(Oe,o),s||i(Ae,Oe),m(t),i(Re[t],Ee)}}{const t=e.geometryInfo.outerEdges;for(let e=0;e<4;++e){const n=t[e];{const t=Re[0===e?3:1===e?1:2];n.setNormal(0,t)}{const t=Re[2===e?1:3===e?3:0];n.setNormal(n.count-1,t)}}}}function me(e,t){const o=e.geometryState.neighborData.cornerNeighborData[t].cornerTiles,r=o.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);V&&(O(!o[0]||!o[2]||E(o[0],o[2],M.SOUTH_WEST)),O(!o[1]||!o[3]||E(o[1],o[3],M.NORTH_WEST)));const s=e.tile;for(let l=0;l<4;++l){const e=o[(l+3)%4],r=o[l];if(e&&e.level<s.level&&e===r){O(!V||e!==s);const o=1==(1&l),r=0===t||1===t&&!o||3===t&&o,a=s.getNeighborEdgeStartVertexIndex(l,e)+(r?1:0),i=2**(s.level-e.level);O(!V||0<=a&&a<=i);const c=a/i,f=o?0===t||1===t?e.extent[0]:e.extent[2]:n(e.extent[0],e.extent[2],c),u=o?n(e.extent[1],e.extent[3],c):0===t||3===t?e.extent[1]:e.extent[3];return h(f,u,e.renderData.geometryState.samplerData)}}let a=0,i=0;for(let n=0;n<4;++n){const e=o[n];if(e&&e.level===r){const t=0===n||1===n,o=0===n||3===n,r=e.extent;i+=h(r[t?0:2],r[o?1:3],e.renderData?.geometryState?.samplerData),a++}}const c=a?i/a:0;return O(null!=c),c}function pe(e,t,n,o){e<o[0]?o[0]=e:e>o[3]&&(o[3]=e),t<o[1]?o[1]=t:t>o[4]&&(o[4]=t),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}const he=[[0,1],[1,0],[0,-1],[-1,0]],xe=new b,Me=m(-1/0,-1/0,1/0,1/0),Se=u(),ve=u(),be=u(),ye=u(),De=u(),Oe=u(),Ve=u(),Ae=u(),Ee=u(),Re=[u(),u(),u(),u()],Pe=[null,null,null,null];export{F as createPlanarGlobePatch,P as createSphericalGlobePatch,L as updateCornerSpherical,G as updateCornersPlanar,q as updateEdgesAndCornersPlanar,I as updateEdgesAndCornersSpherical};
5
+ import{isPowerOfTwo as e,clamp as t}from"../../../core/mathUtils.js";import{isNone as n,isSome as o}from"../../../core/maybe.js";import{s,n as r,w as i,f as a,a as c,c as l}from"../../../chunks/vec3.js";import{c as f}from"../../../chunks/vec3f64.js";import{s as u}from"../../../chunks/vec4.js";import{empty as d}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as g,containsXYWithMargin as m}from"../../../geometry/support/aaBoundingRect.js";import{sampleElevationOrZero as p}from"./ElevationData.js";import{PatchType as h,NeighborIndex as x}from"./interfaces.js";import{acquireTerrainAttributes as M,EdgeDescriptor as S}from"./PatchGeometry.js";import{PatchGeometryLUT as v}from"./PatchGeometryLUT.js";import{neighborTileIfLoadedOrSelf as y}from"./PatchRenderData.js";import{GEOMETRY_VERTEX_STRIDE as O}from"./TerrainConst.js";import{internalAssert as b,ENABLE_TERRAIN_INTERNAL_CHECKS as V,neighborEdgeIndices as A,almostEquals as D}from"./terrainUtils.js";import{isCornerNeighbor as R}from"./Tile.js";import{compareTilesByLij as E}from"./tileUtils.js";const P=65536;function L(e,t){const n=e.tile,{extent:o,extentInRadians:i,surface:a}=n,l=e.localOrigin,f=e.geometryState,g=a.isWebMercator,m=a.shadingEnabled,x=f.numVerticesPerSide,S=x-1,v=(x-2)**2,y=g&&(t===h.HAS_SOUTH_POLE||t===h.HAS_BOTH_POLES),V=g&&(t===h.HAS_NORTH_POLE||t===h.HAS_BOTH_POLES),A=6,D=((y?1:0)+(V?1:0))*A*(S+1),R=f.neighborData,E=R.edgeResolutions.reduce(((e,t)=>e+t+1),0),P=M(v+D+E),L=e.geometryInfo;L.numVerticesPerSide=f.numVerticesPerSide,L.vertexAttributes=P,u(L.uvOffsetAndScale,0,0,1,1);const T=P.position.typedBuffer,I=P.uv0.typedBuffer,j=P.normal.typedBuffer,N=L.boundingBox;d(N);const U=l[0],w=l[1],C=l[2];me.update(S,i);const Y=f.samplerData,Z=n.ellipsoid.radius,_=H(e),k=x-2,G=o[0],q=o[2],F=o[1],z=o[3];(()=>{if(!n.intersectsClippingArea)return;if((()=>{let e=0;for(let t=1;t<=k;t++){const n=t/S,o=F*(1-n)+z*n,s=_(n),r=Math.cos(s),i=Math.sin(s);for(let t=1;t<=k;t++){const s=t/S,a=G*(1-s)+q*s,c=me.sinLonLUT[t],l=me.cosLonLUT[t],f=Z+p(a,o,Y),u=l*r*f-U,d=c*r*f-w,g=i*f-C;de(u,d,g,N);const m=O*e;T[m+0]=u,T[m+1]=d,T[m+2]=g,I[m+0]=s,I[m+1]=n,++e}}})(),m){(()=>{const t=P.position,n=P.normal;let o=0;const i=e=>{t.getVec(e,xe),W()},a=(e,t)=>{{const n=e/S,o=G*(1-n)+q*n,r=me.sinLonLUT[e],i=me.cosLonLUT[e],a=t/S,c=F*(1-a)+z*a,l=_(a),f=Math.cos(l),u=Math.sin(l),d=Z+p(o,c,Y);s(xe,i*f*d-U,r*f*d-w,u*d-C)}W()},l=(e,t,n)=>{e>1&&t>1&&e<k&&t<k?i(o+n):a(e,t)};for(let f=1;f<=k;f++)for(let i=1;i<=k;i++)t.getVec(o,ye),c(Oe,ye,e.localOrigin),r(be,Oe),s(Ve,0,0,0),l(i-1,f,-1),l(i+1,f,1),l(i,f-1,-k),l(i,f+1,+k),r(Ve,Ve),n.setVec(o,Ve),++o})()}})(),ae(e,v),B(e);const J=[];(()=>{let e=v+E;const t=(t,n)=>{const o=n*x;de(-U,-w,t*Z-C,N),J.push({connectedRowOffset:o,connectedOuterEdgeOffset:1===t?0:2,rowOffset:e,latitudeResolution:A});const s=X(-1===t?F:z,Z),r=t*Math.PI/2-s,i=.99*(1===t?1:-1),a=Z+0;for(let c=1;c<=A;++c){const t=s+r*(c/A),n=Math.cos(t),o=Math.sin(t);for(let s=0;s<=S;s++){const t=s/S,r=me.sinLonLUT[s],c=me.cosLonLUT[s]*n*a-U,l=r*n*a-w,f=o*a-C;de(c,l,f,N);const u=O*e;if(T[u+0]=c,T[u+1]=l,T[u+2]=f,I[u+0]=t,I[u+1]=i,m){const e=1/Math.sqrt(c*c+l*l+f*f);j[u+0]=e*c,j[u+1]=e*l,j[u+2]=e*f}++e}}};y&&t(-1,0),V&&t(1,S)})(),ie(L,f.numVerticesPerSide,J,[0,x-1],[0,x-1],f.wireframe),e.intersectionData=null;for(let s=0;s<4;++s)b(L.outerEdges[s].count===R.edgeResolutions[s]+1)}function T(e){e.tile.intersectsClippingArea&&(B(e),ue(e))}function I(e){e.tile.intersectsClippingArea&&(N(e),j(e,!0),ue(e))}function B(e){e.tile.intersectsClippingArea&&(N(e),j(e))}function j(t,i=!1){const a=t.geometryState,c=t.geometryInfo,l=a.neighborData,f=t.tile,u=f.level,d=f.extent,g=f.ellipsoid.radius,m=f.extentInRadians,h=m[0],x=m[2],M=m[1],S=m[3],v=a.samplerData,R=d[0],P=d[2],L=d[1],T=d[3],I=H(t),B=c.boundingBox,j=c.vertexAttributes,N=j.position.typedBuffer,U=j.uv0.typedBuffer,w=j.normal.typedBuffer,C=t.localOrigin,X=C[0],Y=C[1],Z=C[2],_=f.surface.shadingEnabled;for(let H=0;H<4;++H){const a=1===H||3===H,m=l.edgeResolutions[H];b(e(m));const j=m+1,C=y(f,l.edgePeerNeighbors[H]);if(Re(f,C,H)){ce(t,H);continue}const k=o(C);b(!k||C.level===f.level),b(!k||E(f,C)<=0);const G=C?.renderData,q=G?.geometryState;if(V){const e=f.surface;if(!C&&e&&!e.updatingRootTiles){const t=A[H],o=f.findNeighborTile(t,(e=>e.isLoaded||e.isLeaf||e.level===f.level));o?o.intersectsClippingArea&&(b(!o.isLoaded),b(!o.isLeaf),b(o.level===u)):b(n(e?.rootTiles)||!f.shouldHaveNeighbor(t))}}const F=1===H?d[2]:d[0],z=0===H?d[3]:d[1],J=0===H?1:0,K=1===H?x:h,Q=0===H?S:M;let $=1===H?1:0,ee=F;const te=C?.extent;let ne=k&&a?1===H?te[0]:te[2]:F,oe=K,se=J,re=z,ie=Q,ae=Math.sin(oe),le=Math.cos(oe),fe=Math.cos(ie),ue=Math.sin(ie);const ge=e=>{se=e,re=L*(1-e)+T*e,ie=I(e),fe=Math.cos(ie),ue=Math.sin(ie)},me=e=>{$=e,ee=R*(1-e)+P*e,ne=ee,oe=h*(1-e)+x*e,ae=Math.sin(oe),le=Math.cos(oe)},pe=a?ge:me,he=q?.samplerData,Me=()=>p(ee,re,v),Se=()=>p(ne,re,he),ve=()=>.5*(Se()+Me()),Oe=k?ve:Me;b(!k||D(te[2]-te[0],d[2]-d[0]));const Ae=1===H?-1:3===H?1:0,De=0===H?-1:2===H?1:0,Ee=(d[2]-d[0])/m,Pe=Ae*Ee,Le=De*Ee,Te=x-h,Ie=a?Ae*(Te/m):0,Be=a?0:De*(1/m),je=J,Ne=e=>{const t=e?-1:1,n=p((e?ne:ee)+t*Pe,re+t*Le,e?he:v),o=g+n,r=a?oe+t*Ie:oe,i=a?Math.sin(r):ae,c=a?Math.cos(r):le,l=a?ie:I(je+t*Be),f=a?ue:Math.sin(l),u=a?fe:Math.cos(l);s(xe,c*u*o,i*u*o,f*o),W()},Ue=c.outerEdges[H],we=Ue.getVertexOffset(0),Ce=i&&j>3?j-3:1,Xe=o(v)&&v.some((e=>null!=e)),Ye=o(he)&&he.some((e=>null!=e)),Ze=Xe||Ye;for(let e=1;e<j-1;e+=Ce){const t=e/m;if(pe(t),V){b(0!==e||0===t),b(e!==j-1||1===t);const n=.001;b(d[0]<=ee&&ee<=d[2]),b(d[1]<=re&&re<=d[3]),b(h-n<=oe&&oe<=x+n),b(M-n<=ie&&ie<=S+n),b(0<=$&&$<=1),b(0<=se&&se<=1)}const n=Oe(),o=g+n,i=le*fe*o,a=ae*fe*o,c=ue*o,l=i-X,f=a-Y,u=c-Z;de(l,f,u,B);const p=O*(we+e);N[p+0]=l,N[p+1]=f,N[p+2]=u,U[p+0]=$,U[p+1]=se,Ze&&_&&(s(Ve,0,0,0),s(ye,i,a,c),r(be,ye),k&&Ne(!0),Ne(!1),w[p+0]=Ve[0],w[p+1]=Ve[1],w[p+2]=Ve[2])}if(_)for(let e=1;e<j-1;e+=Ce)Ue.getVertexXYZN(ye,Ve,e),r(be,ye),Ze?((k||e>1)&&(Ue.getVertexXYZ(xe,e-1),W()),(k||e<j-2)&&(Ue.getVertexXYZ(xe,e+1),W()),r(Ve,Ve),Ue.setNormal(e,Ve)):Ue.setNormal(e,be)}}function N(e){const t=e.tile,n=t.extentInRadians,o=t.ellipsoid.radius;le(e,((e,t,s)=>C(e,t,s,n,o)),((e,t,n,o)=>_(e,t,n,o)))}function U(e,t,n,o,s){const r=H(e),i=e.tile,a=i.extent;b(m(a,n,o,1));const c=(n-a[0])/(a[2]-a[0]),l=(o-a[1])/(a[3]-a[1]),f=i.extentInRadians;w(t,f[0]*(1-c)+f[2]*c,r(l),s,i.ellipsoid.radius)}function w(e,t,n,o,s){const r=Math.cos(n),i=Math.sin(n),a=Math.sin(t),c=Math.cos(t),l=s+o;e[0]=c*r*l,e[1]=a*r*l,e[2]=i*l}function C(e,t,n,o,s){const r=o[0===t?1:3],i=o[0===e?0:2];w(he,i,r,n,s)}function X(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function Y(e,t,n,o){return X(e*(1-o)+t*o,n)}function Z(e,t,n){return e*(1-n)+t*n}function H(e){const t=e.tile;if(t.surface.isWebMercator){const e=t.extent,n=t.ellipsoid.radius;return t=>Y(e[1],e[3],n,t)}const n=t.extentInRadians;return e=>Z(n[1],n[3],e)}function _(e,t,n,o){U(e,xe,t,n,o),W()}function W(){i(Me,xe,ye),a(Se,Me,be),a(ve,Se,Me),c(Ve,Ve,ve)}function k(e,n){const i=e.tile,a=i.extent,c=e.localOrigin,l=e.geometryState,f=i.surface,m=f.isWebMercatorOnPlateeCarree,h=f.shadingEnabled,x=a[0],S=a[1],v=a[2],y=a[3],b=v-x,V=y-S,A=l.clippingArea,D=o(A)?Math.max(0,(A[0]-a[0])/b):0,R=o(A)?Math.max(0,(A[1]-a[1])/V):0,E=o(A)?Math.min(1,(A[2]-a[0])/b):1,P=o(A)?Math.min(1,(A[3]-a[1])/V):1,L=E-D,T=P-R,I=L>0?1/L:1,B=T>0?1/T:1,j=-D*I,N=-R*B,U=l.numVerticesPerSide,w=U-1,C=(U-2)**2,X=l.neighborData.edgeResolutions.reduce(((e,t)=>e+t+1),0),Y=M(C+X),Z=Y.position.typedBuffer,H=Y.uv0.typedBuffer,_=Y.normal.typedBuffer,W=e.geometryInfo,k=W.boundingBox;d(k);const G=i.ellipsoid.radius,q=l.samplerData,z=o(A)?A:pe,J=g(Math.max(a[0],z[0]),Math.max(a[1],z[1]),Math.min(a[2],z[2]),Math.min(a[3],z[3])),K=c[0],Q=c[1],ee=c[2],te=$(m,G,n);(()=>{if(!e.tile.intersectsClippingArea)return;const o=U-2;(()=>{let e=0;for(let s=1;s<=o;s++){const r=s/w,i=N+r*B,a=t(S*(1-r)+y*r,J[1],J[3]),c=t(i,0,1),l=te(a)-Q;for(let s=1;s<=o;s++){const o=s/w,r=j+o*I,i=t(x*(1-o)+v*o,J[0],J[2]),f=t(r,0,1),u=p(i,a,q),d=i*n-K,g=u-ee;de(d,l,g,k);const m=O*e;Z[m+0]=d,Z[m+1]=l,Z[m+2]=g,H[m+0]=f,H[m+1]=c,++e}}})();(()=>{if(!h)return;let e=0;const i=(e,o)=>{const s=e/w,r=t(x*(1-s)+v*s,J[0],J[2]),i=o/w,a=t(S*(1-i)+y*i,J[1],J[3]),c=p(r,a,q);he[0]=r*n,he[1]=te(a),he[2]=c},a=(e,t)=>{const n=O*t;e[0]=Z[n+0]+K,e[1]=Z[n+1]+Q,e[2]=Z[n+2]+ee};for(let t=1;t<=o;t++)for(let n=1;n<=o;n++){s(Ve,0,0,0),a(ye,e);{1===n?i(n-1,t):a(he,e-1);const s=he[0]-ye[0],r=he[2]-ye[2];n===o?i(n+1,t):a(he,e+1);const c=he[0]-ye[0],l=he[2]-ye[2];Ve[0]+=-s*r-c*l,Ve[2]+=s*s+c*c}1===t?i(n,t-1):a(he,e-o);const c=he[1]-ye[1],l=he[2]-ye[2];t===o?i(n,t+1):a(he,e+o);const f=he[1]-ye[1],u=he[2]-ye[2];Ve[1]+=-c*l-f*u,Ve[2]+=c*c+f*f,r(Ve,Ve);const d=O*e;_[d+0]=Ve[0],_[d+1]=Ve[1],_[d+2]=Ve[2],++e}})()})(),W.numVerticesPerSide=l.numVerticesPerSide,W.vertexAttributes=Y,u(e.geometryInfo.uvOffsetAndScale,D,R,E-D,P-R),ae(e,C),F(e,n),ie(W,l.numVerticesPerSide,[],[0,U-1],[0,U-1],l.wireframe),e.intersectionData=null}function G(e,t){e.tile.intersectsClippingArea&&(J(e,t),z(e,t,!0),ue(e))}function q(e,t){e.tile.intersectsClippingArea&&(F(e,t),ue(e))}function F(e,t){e.tile.intersectsClippingArea&&(J(e,t),z(e,t,!1))}function z(i,a,c){const l=i.geometryState,f=l.neighborData,u=i.tile,d=u.surface,m=d.shadingEnabled,h=u.extent,x=l.clippingArea,M=o(x)?x:pe,S=g(Math.max(h[0],M[0]),Math.max(h[1],M[1]),Math.min(h[2],M[2]),Math.min(h[3],M[3])),v=[h[3]>M[3],h[2]>M[2],h[1]<M[1],h[0]<M[0]],O=i.geometryInfo,D=$(d.isWebMercatorOnPlateeCarree,u.ellipsoid.radius,a),R=O.boundingBox,P=O.uvOffsetAndScale[0],L=O.uvOffsetAndScale[1],T=O.uvOffsetAndScale[2],I=O.uvOffsetAndScale[3],B=T>0?1/T:1,j=I>0?1/I:1,N=-P*B,U=-L*j,w=h[0],C=h[2],X=S[0],Y=S[2],Z=h[1],H=h[3],_=S[1],W=S[3],k=i.localOrigin,G=l.samplerData;for(let g=0;g<4;++g){const l=1===g||3===g,x=f.edgeResolutions[g];b(e(x));const M=x+1,S=v[g],P=y(u,f.edgePeerNeighbors[g]);if(!S&&Re(u,P,g)){ce(i,g);continue}const L=o(P)&&!S;b(!L||P.level===u.level),b(!L||E(u,P)<=0);const T=P?.renderData,I=T?.geometryState;if(V&&u&&!P&&!d.updatingRootTiles){const e=A[g],t=u.findNeighborTile(e,(e=>e.isLoaded||e.isLeaf||e.level===u.level));d.updatingRootTiles||(t?t.intersectsClippingArea&&(b(!t.isLoaded),b(!t.isLeaf),b(t.level===u.level)):b(n(d?.rootTiles)||!u.shouldHaveNeighbor(e)))}const q=t(1===g?h[2]:h[0],X,Y),F=t(0===g?h[3]:h[1],_,W),z=1===g?1:0,J=0===g?1:0,K=I?.samplerData,Q=(e,t)=>p(e,t,G),$=(e,t)=>p(e,t,K),ee=(e,t)=>.5*($(e,t)+Q(e,t)),te=L?ee:Q,ne=O.outerEdges[g],oe=c&&M>3?M-3:1;for(let e=1;e<M-1;e+=oe){const n=e/x,o=l?q:t(w*(1-n)+C*n,X,Y),s=l?t(Z*(1-n)+H*n,_,W):F,r=l?z:t(N+n*B,0,1),i=l?t(U+n*j,0,1):J,c=te(o,s),f=o*a-k[0],u=D(s)-k[1],d=c-k[2];de(f,u,d,R),ne.setVertexFromValuesRawXYZUV(e,f,u,d,r,i)}if(m){const e=e=>{const t=he[e]-ye[e],n=he[2]-ye[2];Ve[e]+=-t*n,Ve[2]+=t*t},n=(h[2]-h[0])/x,o=l?1===g?n:-n:0,i=l?0:0===g?n:-n,c=-o,f=-i,u=l?1:0,d=(t,n,o)=>{he[0]=l?a*t:ye[0],he[1]=l?ye[1]:D(n),he[2]=p(t,n,o),e(1-u)};for(let a=1;a<M-1;a+=oe){const n=a/x,g=l?q:t(w*(1-n)+C*n,X,Y),m=l?t(Z*(1-n)+H*n,_,W):F;ne.getVertexXYZ(ye,a),s(Ve,0,0,0),(L||a>1)&&(ne.getVertexXYZ(he,a-1),e(u)),(L||a<M-2)&&(ne.getVertexXYZ(he,a+1),e(u)),d(g+c,m+f,G),L&&d(g+o,m+i,K),r(Ve,Ve),ne.setNormal(a,Ve)}}}}function J(e,t){const n=e.tile,s=e.geometryState.clippingArea,r=n.extent,i=o(s)&&(r[3]>s[3]||r[2]>s[2]||r[1]<s[1]||r[0]<s[0])?(e,o,i)=>te(e,o,i,r,s,t,$(n.surface.isWebMercatorOnPlateeCarree,n.ellipsoid.radius,t)):(e,o,s)=>ee(e,o,s,r,t,$(n.surface.isWebMercatorOnPlateeCarree,n.ellipsoid.radius,t)),a=oe(e,t);le(e,i,((e,t,n,o)=>ne(a,t,n,o)))}function K(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function Q(e,t){return e*t}function $(e,t,n){return e?e=>K(e,t):e=>Q(e,n)}function ee(e,t,n,o,s,r){const i=0===e?o[0]:o[2],a=0===t?o[1]:o[3],c=n;he[0]=i*s,he[1]=r(a),he[2]=c}function te(e,n,o,s,r,i,a){const c=0===e?s[0]:s[2],l=0===n?s[1]:s[3],f=t(c,r[0],r[2]),u=t(l,r[1],r[3]),d=o;he[0]=f*i,he[1]=a(u),he[2]=d}function ne(e,t,n,o){e(t,n,o);const s=xe[0]-ye[0],r=xe[1]-ye[1],i=xe[2]-ye[2];ve[0]=-s*i,ve[1]=-r*i,ve[2]=s*s+r*r,c(Ve,Ve,ve)}function oe(e,t){return e.tile.surface.isWebMercatorOnPlateeCarree?(n,o,s)=>re(t,e.tile.ellipsoid.radius,n,o,s):(e,n,o)=>se(t,e,n,o)}function se(e,t,n,o){xe[0]=t*e,xe[1]=n*e,xe[2]=o}function re(e,t,n,o,s){xe[0]=n*e,xe[1]=(Math.PI/2-2*Math.atan(Math.exp(-o/t)))*t,xe[2]=s}function ie(e,t,n,o,s,r){const i=t-1,a=e.vertexAttributes.count,c=2*(Math.min(t-2,o[1])-Math.max(1,o[0]))*(Math.min(t-2,s[1])-Math.max(1,s[0])),l=A.map(((e,n)=>0===n&&s[1]<t-2||1===n&&o[1]<t-2||2===n&&s[0]>1||3===n&&o[0]>1)),f=e.outerEdges.reduce(((e,t,n)=>e+(l[n]?0:i-2+t.count-1)),0),u=n.reduce(((e,t)=>e+i*(2*(t.latitudeResolution-1)+1)),0),d=r?2:1,g=3*(c+f+u)*d,m=new(a>P?Uint32Array:Uint16Array)(g);let p=0;const h=r?(e,t,n)=>{m[p++]=e,m[p++]=t,m[p++]=t,m[p++]=n,m[p++]=n,m[p++]=e,V&&(b(e<a),b(t<a),b(n<a),b(p<=g))}:(e,t,n)=>{m[p++]=e,m[p++]=t,m[p++]=n,V&&(b(e<a),b(t<a),b(n<a),b(p<=g))},x=t-2,M=i-2;b(M>=0);(()=>{for(let e=Math.max(s[0],1)-1;e<Math.min(s[1],t-2)-1;++e)for(let n=Math.max(o[0],1)-1;n<Math.min(o[1],t-2)-1;++n){const t=e*x+n,o=t+1,s=o+x,r=s-1;h(t,o,s),h(s,r,t)}})(),b(p===3*c*d);(()=>{for(let t=0;t<4;++t){const n=p;if(l[t])continue;const o=e.outerEdges[t],s=e.innerEdges[t];let r=0,a=0;const c=o.count,f=s.count;b(f===i-1);const u=i-2+o.count-1;let g=0;const m=1===t||2===t?(e,t,n)=>h(e,t,n):(e,t,n)=>h(e,n,t);for(;r<c-1||a<f-1;){const e=s.getVertexOffset(a),t=o.getVertexOffset(r),n=r<c-1,l=a<f-1,u=n?0+i*(r+.5)/(c-1):0,d=l?1+M*(a+.5)/(f-1):0;if(n&&(!l||u<=d)){++r,V&&b(r<c);m(e,t,o.getVertexOffset(r)),g++}else{++a,V&&b(a<f);m(e,t,s.getVertexOffset(a)),g++}}V&&(b(r===c-1),b(a===f-1),b(g===c+f-2),b(u===g),b(p===n+3*g*d))}})(),b(p===3*(c+f)*d);const S=n=>{let o=e.outerEdges[n.connectedOuterEdgeOffset].offset0;for(let e=0;e<n.latitudeResolution;++e){const s=0===e?n.rowOffset:o+t;for(let t=0;t<i;t++)h(o,o+1,s+t),e<n.latitudeResolution-1&&h(o+1,s+t+1,s+t),++o;o=s}};(()=>{n.forEach(S)})(),b(p===g),e.indices=m,e.indexCount=g}function ae(e,t){const n=e.localOrigin,o=e.geometryInfo,s=e.geometryState.neighborData.edgeResolutions,r=o.numVerticesPerSide-2,i=o.vertexAttributes.position.typedBuffer;let a=t;for(let c=0;c<4;++c){{const e=0===c||2===c,t=(0===c?r-1:0)*r+(1===c?r-1:0),s=(e?0:1)*r+(e?1:0);o.innerEdges[c]=new S(i,n,t,s,r)}{const e=a,t=s[c]+1;o.outerEdges[c]=new S(i,n,e,1,t),a+=t}}}function ce(n,o){const s=(o+2)%4,r=n.geometryState,a=n.geometryInfo,l=n.tile,f=r.neighborData,u=y(l,f.edgePeerNeighbors[o]),d=l.level-u.level,g=1===o||3===o,m=f.edgeResolutions[o];b(e(m));const p=m+1,h=1===o?1:0,x=0===o?1:0,M=u.renderData,S=M.geometryState,v=M.geometryInfo.outerEdges[s],O=l.getNeighborEdgeStartVertexIndex(o,u)*m,V=m*2**d;b(S.neighborData.edgeResolutions[s]===V),b(v.count-1===V);const A=a.outerEdges[o],D=a.uvOffsetAndScale[0],R=a.uvOffsetAndScale[1],E=a.uvOffsetAndScale[2],P=a.uvOffsetAndScale[3],L=E>0?1/E:1,T=P>0?1/P:1,I=-D*L,B=-R*T;i(Ae,M.localOrigin,n.localOrigin);for(let e=1;e<p-1;++e){const n=e/m,o=g?h:t(I+n*L,0,1),s=g?t(B+n*T,0,1):x,r=O+e;v.getVertexRawXYZN(he,Ve,r),c(he,he,Ae),A.setVertexRawXYZUVN(e,he,o,s,Ve)}}function le(e,n,a){const c=e.geometryState,f=c.neighborData,u=e.localOrigin,d=f.cornerNeighborData,g=e.geometryInfo,h=g.outerEdges,x=g.boundingBox,M=e.tile,S="local"===e.tile.surface.view?.viewingMode;S&&s(be,0,0,1);const v=M.extent,y=c.clippingArea,O=o(y)?y:pe,V=[v[3]>O[3],v[2]>O[2],v[1]<O[1],v[0]<O[0]],A=M.surface.shadingEnabled,D=(e,t,n)=>e.extent[0===t||1===t?2:0]+n,R=(e,t,n)=>e.extent[0===t||3===t?3:1]+n,P=1e-4,L=(e,t,n,o)=>{const s=D(n,o,ge[e][0]*t),r=R(n,o,ge[e][1]*t);b(m(n.extent,s,r,P));const i=n.renderData,c=p(s,r,i.geometryState.samplerData);a(i,s,r,c)},T=(e,t,n,o,s,r)=>{const i=ge[e][0]*t,c=ge[e][1]*t,l=D(n,o,i),f=R(n,o,c),u=D(s,r,i),d=R(s,r,c);b(m(n.extent,l,f,P)),b(m(s.extent,u,d,P));const g=n.renderData,h=s.renderData,x=p(l,f,g.geometryState.samplerData),M=p(u,d,h.geometryState.samplerData);a(g,l,f,.5*(x+M))},I=e=>{l(ye,he),S||r(be,ye);const t=d[e].cornerTiles;if(b(t.some((e=>e?.isLoaded||e===M))),s(Ve,0,0,0),t.some((e=>e&&E(M,e)>0)))return void b(!1);const n=t.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);for(let s=0;s<4;++s){const e=t[s];De[s]=e?.level===n?e:null}for(let s=0;s<4;++s){const e=De[(s+3)%4],t=De[s];null!=e&&e!==M&&e===t&&b(!1)}b(De.some((e=>e?.isLoaded||e===M)));const o=De.reduce(((e,t)=>t?t.extent[2]-t.extent[0]:e),0);b(o>0);const i=De.reduce(((e,t)=>Math.max(e,t?.renderData.geometryState.numVerticesPerSide??1)),1);b(i>1);const a=o/i;for(let s=0;s<4;++s){const e=De[(s+3)%4],t=De[(s+0)%4];if(!e&&!t)continue;const n=0===s?1:1===s?2:2===s?3:0,o=0===s?2:1===s?3:2===s?0:1;if(e&&t)T(s,a,e,n,t,o);else{L(s,a,e??t,e?n:o)}}r(Ve,Ve)},B=o=>{const s=o,r=(o+1)%4,a=0===o||1===o?1:0,l=0===o||3===o?1:0,f=h[s],g=0===o||3===o?f.count-1:0,m=h[r],S=0===o||1===o?m.count-1:0,y=d[o].cornerTiles,D=y.reduce(((e,t,n)=>t&&(-1===e||E(y[e],t)>0)?n:e),-1),R=y[D],P=()=>{i(he,he,u),de(he[0],he[1],he[2],x),A?(f.setVertexRawXYZUVN(g,he,a,l,Ve),m.setVertexRawXYZUVN(S,he,a,l,Ve)):(f.setVertexRawXYZUV(g,he,a,l),m.setVertexRawXYZUV(S,he,a,l))};if(R!==M){const t=M.level-R.level,n=2**t,s=[R.lij[0]+t,R.lij[1]*n,R.lij[2]*n],r=[s[1]+n===M.lij[1],0===o&&(1===D||0===D&&R!==y[3])||1===o&&(0===D||1===D&&R!==y[2]),s[1]===M.lij[1]+1,2===o&&(3===D||2===D&&R!==y[1])||3===o&&(2===D||3===D&&R!==y[0])],i=r.reduce(((e,t)=>e+(t?1:0)),0);b(1===i||2===i);let a=-1,c=-1;const l=R.renderData;if(1===i){const t=r.findIndex((e=>e));b(0<=t&&t<=3),a=(t+2)%4;const n=e.geometryState.neighborData.edgeResolutions[t];c=M.getNeighborEdgeStartVertexIndex(t,R)*n+n*(0===t&&0===o||1===t&&0===o||2===t&&1===o||3===t&&3===o?1:0)}else{b(r[1]||r[3]),a=r[1]?3:1;const e=l.geometryState.neighborData.edgeResolutions[a];c=0===o||3===o?0:e}l.geometryInfo.outerEdges[a].getVertexXYZN(he,Ve,c),P()}else{const e=V[s],i=V[r];let f;if(e||i){const e=v[0]*(1-a)+v[2]*a,n=v[1]*(1-l)+v[3]*l,o=t(e,O[0],O[2]),s=t(n,O[1],O[3]),r=c.samplerData;f=p(o,s,r)}else f=fe(y);n(a,l,f),A&&I(o),P()}};for(let t=0;t<4;++t)B(t)}function fe(e){const t=e.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);V&&(b(!e[0]||!e[2]||R(e[0],e[2],x.SOUTH_WEST)),b(!e[1]||!e[3]||R(e[1],e[3],x.NORTH_WEST)));let n=0,o=0;for(let r=0;r<4;++r){const s=e[r];if(s&&s.level===t){const e=0===r||1===r,t=0===r||3===r,i=s.extent;o+=p(i[e?0:2],i[t?1:3],s.renderData?.geometryState?.samplerData),n++}}const s=n?o/n:0;return b(null!=s),s}function ue(e){const t=e.vao,n=e.geometryInfo.vertexAttributes;t.vertexBuffers.geometry.setSubData(n.position.typedBuffer)}function de(e,t,n,o){e<o[0]?o[0]=e:e>o[3]&&(o[3]=e),t<o[1]?o[1]=t:t>o[4]&&(o[4]=t),n<o[2]?o[2]=n:n>o[5]&&(o[5]=n)}const ge=[[0,1],[1,0],[0,-1],[-1,0]],me=new v,pe=g(-1/0,-1/0,1/0,1/0),he=f(),xe=f(),Me=f(),Se=f(),ve=f(),ye=f(),Oe=f(),be=f(),Ve=f(),Ae=f(),De=[null,null,null,null];function Re(e,t,n){if(!t)return!1;const o=E(e,t);return o>0||0===o&&n<2}export{k as createPlanarGlobePatch,L as createSphericalGlobePatch,I as updateCornerSpherical,G as updateCornersPlanar,q as updateEdgesAndCornersPlanar,T as updateEdgesAndCornersSpherical};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,mapOr as s}from"../../../core/maybe.js";import{i as a,j as o,u as n,b as l,n as h,e as d,w as g,z as c}from"../../../chunks/vec3.js";import{c as u,a as m}from"../../../chunks/vec3f64.js";import{empty as f}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as p}from"../../../geometry/support/aaBoundingRect.js";import{earth as y}from"../../../geometry/support/Ellipsoid.js";import{glLayout as _}from"../support/buffer/glUtil.js";import{GeometryState as x}from"./GeometryState.js";import{NeighborIndex as D}from"./interfaces.js";import{LayerClass as v}from"./LayerClass.js";import{PatchGeometry as S,releaseGeometry as $}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as C,internalAssert as b,neighborEdgeIndices as E,oppositeEdge as T,neighborCornerIndices as A,v32s as j,eps as V,lij2s as R}from"./terrainUtils.js";import{TextureFader as w,ActivationTime as L}from"./TextureFader.js";export{ActivationTime}from"./TextureFader.js";import{isEdgeNeighbor as N}from"./Tile.js";import I from"./TileOverlayData.js";import{fallsWithinLayer as P}from"./tileUtils.js";import{Default3D as G}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as M}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as O}from"../../webgl/BufferObject.js";class U{constructor(){this.geometryInfo=new S,this.intersectionData=null,this.geometryState=null,this._textureRef=new w((()=>this.tile.surface.textureFadeDuration)),this.overlay=new I,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this._tile=e,this.clear();const t=this.geometryInfo;t.indices=null,t.vertexAttributes=null,f(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new x,this.localOrigin=null,this.overlay.clear()}clear(){this._releaseGeometry(),this.releaseTexture(),this._textureRef.clear()}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),C&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)b(this.geometryInfo.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const s=this.tile,a=this.geometryState.numVerticesPerSide-1;if(!s.surface.isGlobal){const t=s.surface.extent;if(r(t)&&(0===e&&s.extent[3]>t[3]||1===e&&s.extent[2]>t[2]||2===e&&s.extent[1]<t[1]||3===e&&s.extent[0]<t[0]))return a}const o=s.level,n=E[e];if(!t)return b(i(s.surface?.rootTiles)||s.surface.updatingRootTiles||!s.shouldHaveNeighbor(n)),a;if(t.isLoaded){const r=t,i=r.renderData.geometryState,s=o-r.level;if(b(s>=0),0===s){const e=i.numVerticesPerSide-1;return Math.max(e,a)}const n=2**s,l=i.neighborData.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}b(!t.isLeaf);let l=a;return t.forAllSubtreeOnSide(T(n),(e=>e===s||(e.isLoaded?(l=Math.max(l,2**(e.level-o)),!0):(b(!e.isLeaf),!1)))),l}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,a=r.edgePeerNeighborSamplerVersions;for(let n=0;n<4;++n){const o=e.findNeighborTile(E[n],i),l=K(e,o),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[n],g=l!==K(e,d),c=a[n]!==h;s[n]=o,(g||c)&&(a[n]=h,this._markEdgeDirty(n));const u=r.edgeResolutions[n],m=this._calculateEdgeResolution(n,o);b(t(m)),b(m>=1),r.edgeResolutions[n]=m,u!==m&&this._markEdgeResolutionDirty(n)}const o=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const a=e.findNeighborTile(A[t],i);o[t]=a;const n=K(e,s[t]),l=K(e,s[(t+1)%4]),h=K(e,a);J[t]=h,J[(t+1)%4]=l,J[(t+2)%4]=e,J[(t+3)%4]=n,b(J.some((t=>t?.isLoaded||t===e)));const d=J.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);J.forEach(((e,t)=>{e?.level>d&&(J[t]=null)})),b(J.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,c=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=J[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,a=!s&&c[e]!==i;(s||a)&&(g[e]=r,c[e]=i,this._markCornerDirty(t))}b(g.some((t=>t?.isLoaded||t===e)))}C&&b(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)))}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;C&&b(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometryInfo.vertexAttributes,s=!r||!i||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,a=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),o=!a&&0!==this._dirtyCorners;s?(this._releaseGeometry(),this._createGeometry(e)):a||o?t.updateEdgeElevations():o?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}releaseGeometry(){return this._releaseGeometry()}get hasGeometry(){return this._hasGeometry}ensureTexture(e,t){return r(this._texture)&&this._texture.descriptor.width!==e&&this.releaseTexture(),i(this._texture)&&(this._texture=t(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){r(this._texture)&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._dirtyEdges|=t}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=t.samplerData?this.tile.getElevationBasedVerticesPerSide(t.maxTileLevel):this.tile.getDefaultVerticesPerRowOnLevel(),i=Math.max(r,5);let s=this.tile.clippingArea;this.tile.intersectsClippingArea&&!this.tile.isWithinClippingArea||(s=null);const a=this.geometryState;let o=!1;a.numVerticesPerSide!==i&&(this._numVerticesPerSideChanged=!0,a.numVerticesPerSide=i,a.samplerDataVersion++,o=!0),t.changed&&(this._samplerDataChanged=!0,a.samplerData=t.samplerData,a.samplerDataVersion++,o=!0),e(a.clippingArea,s)||(this._clippingAreaChanged=!0,a.clippingArea=s,o=!0);const n=this.tile.surface.wireframe;return a.wireframe!==n&&(this._wireframeChanged=!0,a.wireframe=n,o=!0),this._geometryStateChangedSinceLastUpdate||(this._geometryStateChangedSinceLastUpdate=o),o&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometryInfo.vertexAttributes,r=this.geometryInfo.indices,i=e.gl;this._vao=new M(e,G,{geometry:_(t.layout)},{geometry:O.createVertex(e,i.STATIC_DRAW,t.buffer)},O.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}_releaseGeometry(){return this._hasGeometry=!1,!!this._vao&&(this._vao.dispose(),this._vao=null,$(this.geometryInfo),!0)}get vao(){return this._vao}setTextureReference(e,t=L.Immediate){r(e)&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[v.ELEVATION],i=t.length;let s=new Array(i),a=0,o=0,n=!1;for(let l=0;l<i;l++){const i=t[l];if(r(i.upsampleInfo)){const t=i.upsampleInfo.tile,r=t.layerInfo[v.ELEVATION][l].data,h=r&&r.samplerData;e&&e[a]===h||(n=!0),s[a++]=h,o=Math.max(o,t.lij[0])}else if(i.data){const t=this.tile.surface.layerViewByIndex(l,v.ELEVATION);if(P(this.tile,t.layer,!1)){const t=i.data;e&&e[a]===t.samplerData||(n=!0),s[a++]=t.samplerData,o=this.tile.level}}}return r(e)&&e.length!==a&&(n=!0),a>0?s.length=a:s=null,{changed:n,samplerData:s,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=s(this.intersectionData,0,(e=>e.estimatedMemoryUsage));return(this.geometryInfo.indices?.byteLength??0)+(this.geometryInfo.vertexAttributes?.byteLength??0)+e}get textureDescriptor(){return r(this._texture)?this._texture.descriptor:null}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!C)return;const e=this.tile;if(b(e?.isLoaded),!e.isLoaded||!e.intersectsClippingArea)return;if(0===e.level)return;const s=e.surface.extent;if(r(s)&&!e.intersectsExtent(s))return;const f=E.map(((t,i)=>!!r(s)&&(i<2?-1:1)*(e.extent[3-i]-s[3-i])<0)),_=e.level;b(0===this._dirtyCorners),b(0===this._dirtyEdges),b(0===this._dirtyEdgeResolutions),b(!this._numVerticesPerSideChanged),b(!this._samplerDataChanged),b(!this._clippingAreaChanged),b(!this._wireframeChanged);const x=A.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),v=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=v.cornerPeerNeighbors[t],i=x[t];b(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}E.forEach(((s,x)=>{if(f[x])return;const v=e.findNeighborTile(s,(e=>(e.level===_||e?.isLoaded)&&e?.intersectsClippingArea));if(!v){const t=!e.surface.updatingRootTiles&&r(e.surface.rootTiles)&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(s);return void b(!t)}b(v.isLoaded||v.level===e.level),b(v===this.geometryState.neighborData.edgePeerNeighbors[x]);const S=_-v.level;if(!v.isLoaded)return b(!v.isLeaf),void b(0===S);b(N(e,v,s)),b(S>=0);const $=2**S;if(S<0)return void b(!1);const C=e.renderData.geometryInfo,E=C.outerEdges[x],T=C.numVerticesPerSide-1,A=v.renderData.geometryInfo;if(!A)return void b(!1);{const t=this.geometryState.neighborData.edgePeerNeighbors[x];(t?.isLoaded||t.isLoaded)&&(b(t==t),b(e.renderData.geometryState.neighborData.edgePeerNeighborSamplerVersions[x]===t.renderData.geometryState.samplerDataVersion),b(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[x]===t.renderData.geometryState.samplerDataVersion))}const V=(x+2)%4,w=A.outerEdges[V],L=E.count-1,I=w.count-1;b(L*$===I,`Tile[${e.lij}]:e${x},res=${L} edgeRes mismatch with Neighbor[${v.lij}]:e${V},res=${I} (expected:${L*$})`);const P=e.extent,G=s===D.NORTH||s===D.SOUTH,M=w.count-1,O=M/2**S,U=E.count-1;if(O<1)return void b(1===U);b(O===U),b(t(O));const z=A.numVerticesPerSide-1;b(S>0||O===Math.max(z,T));const J=e.getNeighborEdgeStartVertexIndex(x,v);b(0<=J&&J<$);const K=J*O;b(0<=K&&K<=M-O);let Q=0,Y=K;E.getVertex(k,0),E.getVertex(F,E.count-1);const Z=a(k,F),ee=Math.max(q,1e-4*Z);for(let t=0;t<=O;++t){E.getVertex(k,Q),w.getVertex(F,Y);const a=t/O,f=G?P[0]+a*(P[2]-P[0]):s===D.WEST?P[0]:P[2],_=G?s===D.SOUTH?P[1]:P[3]:P[1]+a*(P[3]-P[1]),S=e.surface.extent;if(i(S)||p(S,f,_)){const t=o(k,F),i=n(k)-y.radius,s=n(F)-y.radius,a=t<ee;if(!a){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${x}[${Q}/${E.count}] and [${v.lij}].edge${V}[${Y}/${w.count}]`),r(S)&&console.warn(" surface extent= ",S," x,y=",f,",",_);const o=u();l(o,e.renderData.localOrigin,v.renderData.localOrigin),n(o)>0&&console.warn(` localOrigins: ${e.renderData.localOrigin} vs ${v.renderData.localOrigin} d=${n(o)} [${o}]`);(()=>{const t=m(k),r=m(F);e.updateEdgeElevations(),v.updateEdgeElevations(),E.getVertex(k,Q),w.getVertex(F,Y);const i=u();g(i,k,t),n(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${k} d=${n(i)} [${i}]`),g(i,F,r),n(i)>0&&console.warn(` XXX Neighbor[${v.lij}] edge out of date: ${r} vs ${F} d=${n(i)} [${i}]`)})(),b(a,`Mismatch in tile [${e.lij}].edge[${x}][${Q}/${E.count}] vs neighbor [${v.lij}].edge[${V}][${Y}/${w.count}] ${j(k)} vs ${j(F)} dist=${t} h(t|n|d)=${i}|${s}|${s-i}`)}if(e.surface.shadingEnabled){E.getNormal(B,Q),w.getNormal(X,Y),h(H,B),h(W,X);const t=d(H,W),r=!1,i=1-t<.01||r||e===v;if(!i){const r=u();g(r,B,X);const s=()=>`Mismatch in tile edge normal ${R(e.lij)} (${Q}/${E.count-1}) edge ${x} vs neighbor ${R(v.lij)} (${Y}/${w.count-1}) nedge ${V} :${j(B)} vs ${j(X)} dot = ${t} : ${j(r)}`;console.warn("Mismatch in tile edge normal: ",s());{e.updateEdgeElevations(),v.updateEdgeElevations();const t=u(),r=u();E.getNormal(t,Q),w.getNormal(r,Y),c(B,t)||console.warn("Missing update in tile normal: ",j(B)," => ",j(t)),c(X,r)||console.warn("Missing update in neighbor normal: ",j(X)," => ",j(r))}b(i,s())}}}Q+=1,Y+=1}}))}}const k=u(),F=u(),B=u(),X=u(),H=u(),W=u();function z(e,t,i){if(r(i))for(const r of i)if(r){const i=r.x0,s=r.width,a=i+(s-1)/r.dx,o=r.y1,n=o-(s-1)/r.dy;if(e>=i-V&&e<=a+V&&n-V<=t&&t<=o+V)return!0}return!1}const q=1,J=[null,null,null,null];function K(e,t){return t?.isLoaded||t===e?t:null}export{U as PatchRenderData,z as isElevationSampleIn,K as neighborTileIfLoadedOrSelf};
5
+ import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,mapOr as s}from"../../../core/maybe.js";import{i as a,j as o,u as n,b as l,n as h,e as d,w as g,z as c}from"../../../chunks/vec3.js";import{c as u,a as m}from"../../../chunks/vec3f64.js";import{empty as f}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as p}from"../../../geometry/support/aaBoundingRect.js";import{earth as y}from"../../../geometry/support/Ellipsoid.js";import{glLayout as _}from"../support/buffer/glUtil.js";import{GeometryState as x}from"./GeometryState.js";import{NeighborIndex as D}from"./interfaces.js";import{LayerClass as v}from"./LayerClass.js";import{PatchGeometry as S,releaseGeometry as $}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as C,internalAssert as b,neighborEdgeIndices as E,oppositeEdge as T,neighborCornerIndices as A,v32s as j,eps as V,lij2s as R}from"./terrainUtils.js";import{TextureFader as w,ActivationTime as L}from"./TextureFader.js";export{ActivationTime}from"./TextureFader.js";import{isEdgeNeighbor as N}from"./Tile.js";import I from"./TileOverlayData.js";import{fallsWithinLayer as P}from"./tileUtils.js";import{Default3D as G}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{VertexArrayObject as M}from"../webgl-engine/lib/VertexArrayObject.js";import{BufferObject as O}from"../../webgl/BufferObject.js";class U{constructor(){this.geometryInfo=new S,this.intersectionData=null,this.geometryState=null,this._textureRef=new w((()=>this.tile.surface.textureFadeDuration)),this.overlay=new I,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this._tile=e,this.clear();const t=this.geometryInfo;t.indices=null,t.vertexAttributes=null,f(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new x,this.localOrigin=null,this.overlay.clear()}clear(){this._releaseGeometry(),this.releaseTexture(),this._textureRef.clear()}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),C&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)b(this.geometryInfo.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const s=this.tile,a=this.geometryState.numVerticesPerSide-1;if(!s.surface.isGlobal){const t=s.surface.extent;if(r(t)&&(0===e&&s.extent[3]>t[3]||1===e&&s.extent[2]>t[2]||2===e&&s.extent[1]<t[1]||3===e&&s.extent[0]<t[0]))return a}const o=s.level,n=E[e];if(!t)return b(i(s.surface?.rootTiles)||s.surface.updatingRootTiles||!s.shouldHaveNeighbor(n)),a;if(t.isLoaded){const r=t,i=r.renderData.geometryState,s=o-r.level;if(b(s>=0),0===s){const e=i.numVerticesPerSide-1;return Math.max(e,a)}const n=2**s,l=i.neighborData.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}b(!t.isLeaf);let l=a;return t.forAllSubtreeOnSide(T(n),(e=>e===s||(e.isLoaded?(l=Math.max(l,2**(e.level-o)),!0):(b(!e.isLeaf),!1)))),l}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,a=r.edgePeerNeighborSamplerVersions;for(let n=0;n<4;++n){const o=e.findNeighborTile(E[n],i),l=q(e,o),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[n],g=l!==q(e,d),c=a[n]!==h;s[n]=o,(g||c)&&(a[n]=h,this._markEdgeDirty(n));const u=r.edgeResolutions[n],m=this._calculateEdgeResolution(n,o);b(t(m)),b(m>=1),r.edgeResolutions[n]=m,u!==m&&this._markEdgeResolutionDirty(n)}const o=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const a=e.findNeighborTile(A[t],i);o[t]=a;const n=q(e,s[t]),l=q(e,s[(t+1)%4]),h=q(e,a);z[t]=h,z[(t+1)%4]=l,z[(t+2)%4]=e,z[(t+3)%4]=n,b(z.some((t=>t?.isLoaded||t===e)));const d=z.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);z.forEach(((e,t)=>{e?.level>d&&(z[t]=null)})),b(z.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,c=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=z[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,a=!s&&c[e]!==i;(s||a)&&(g[e]=r,c[e]=i,this._markCornerDirty(t))}b(g.some((t=>t?.isLoaded||t===e)))}C&&b(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)))}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;C&&b(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometryInfo.vertexAttributes,s=!r||!i||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,a=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),o=!a&&0!==this._dirtyCorners;s?(this._releaseGeometry(),this._createGeometry(e)):a||o?t.updateEdgeElevations():o?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}releaseGeometry(){return this._releaseGeometry()}get hasGeometry(){return this._hasGeometry}ensureTexture(e,t){return r(this._texture)&&this._texture.descriptor.width!==e&&this.releaseTexture(),i(this._texture)&&(this._texture=t(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){r(this._texture)&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._dirtyEdges|=t}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=t.samplerData?this.tile.getElevationBasedVerticesPerSide(t.maxTileLevel):this.tile.getDefaultVerticesPerRowOnLevel(),i=Math.max(r,5);let s=this.tile.clippingArea;this.tile.intersectsClippingArea&&!this.tile.isWithinClippingArea||(s=null);const a=this.geometryState;let o=!1;a.numVerticesPerSide!==i&&(this._numVerticesPerSideChanged=!0,a.numVerticesPerSide=i,a.samplerDataVersion++,o=!0),t.changed&&(this._samplerDataChanged=!0,a.samplerData=t.samplerData,a.samplerDataVersion++,o=!0),e(a.clippingArea,s)||(this._clippingAreaChanged=!0,a.clippingArea=s,o=!0);const n=this.tile.surface.wireframe;return a.wireframe!==n&&(this._wireframeChanged=!0,a.wireframe=n,o=!0),this._geometryStateChangedSinceLastUpdate||(this._geometryStateChangedSinceLastUpdate=o),o&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometryInfo.vertexAttributes,r=this.geometryInfo.indices,i=e.gl;this._vao=new M(e,G,{geometry:_(t.layout)},{geometry:O.createVertex(e,i.STATIC_DRAW,t.buffer)},O.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}_releaseGeometry(){return this._hasGeometry=!1,!!this._vao&&(this._vao.dispose(),this._vao=null,$(this.geometryInfo),!0)}get vao(){return this._vao}setTextureReference(e,t=L.Immediate){r(e)&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[v.ELEVATION],i=t.length;let s=new Array(i),a=0,o=0,n=!1;for(let l=0;l<i;l++){const i=t[l];if(r(i.upsampleInfo)){const t=i.upsampleInfo.tile,r=t.layerInfo[v.ELEVATION][l].data,h=r&&r.samplerData;e&&e[a]===h||(n=!0),s[a++]=h,o=Math.max(o,t.lij[0])}else if(i.data){const t=this.tile.surface.layerViewByIndex(l,v.ELEVATION);if(P(this.tile,t.layer,!1)){const t=i.data;e&&e[a]===t.samplerData||(n=!0),s[a++]=t.samplerData,o=this.tile.level}}}return r(e)&&e.length!==a&&(n=!0),a>0?s.length=a:s=null,{changed:n,samplerData:s,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=s(this.intersectionData,0,(e=>e.estimatedMemoryUsage));return(this.geometryInfo.indices?.byteLength??0)+(this.geometryInfo.vertexAttributes?.byteLength??0)+e}get textureDescriptor(){return r(this._texture)?this._texture.descriptor:null}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!C)return;const e=this.tile;if(b(e?.isLoaded),!e.isLoaded||!e.intersectsClippingArea)return;if(0===e.level)return;const s=e.surface.extent;if(r(s)&&!e.intersectsExtent(s))return;const f=E.map(((t,i)=>!!r(s)&&(i<2?-1:1)*(e.extent[3-i]-s[3-i])<0)),_=e.level;b(0===this._dirtyCorners),b(0===this._dirtyEdges),b(0===this._dirtyEdgeResolutions),b(!this._numVerticesPerSideChanged),b(!this._samplerDataChanged),b(!this._clippingAreaChanged),b(!this._wireframeChanged);const x=A.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),v=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=v.cornerPeerNeighbors[t],i=x[t];b(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}E.forEach(((s,x)=>{if(f[x])return;const v=e.findNeighborTile(s,(e=>(e.level===_||e?.isLoaded)&&e?.intersectsClippingArea));if(!v){const t=!e.surface.updatingRootTiles&&r(e.surface.rootTiles)&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(s);return void b(!t)}b(v.isLoaded||v.level===e.level),b(v===this.geometryState.neighborData.edgePeerNeighbors[x]);const S=_-v.level;if(!v.isLoaded)return b(!v.isLeaf),void b(0===S);b(N(e,v,s)),b(S>=0);const $=2**S;if(S<0)return void b(!1);const C=e.renderData.geometryInfo,E=C.outerEdges[x],T=C.numVerticesPerSide-1,A=v.renderData.geometryInfo;if(!A)return void b(!1);{const t=this.geometryState.neighborData.edgePeerNeighbors[x];(t?.isLoaded||t.isLoaded)&&(b(t==t),b(e.renderData.geometryState.neighborData.edgePeerNeighborSamplerVersions[x]===t.renderData.geometryState.samplerDataVersion),b(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[x]===t.renderData.geometryState.samplerDataVersion))}const V=(x+2)%4,w=A.outerEdges[V],L=E.count-1,I=w.count-1;b(L*$===I,`Tile[${e.lij}]:e${x},res=${L} edgeRes mismatch with Neighbor[${v.lij}]:e${V},res=${I} (expected:${L*$})`);const P=e.extent,G=s===D.NORTH||s===D.SOUTH,M=w.count-1,O=M/2**S,U=E.count-1;if(O<1)return void b(1===U);b(O===U),b(t(O));const H=A.numVerticesPerSide-1;b(S>0||O===Math.max(H,T));const z=e.getNeighborEdgeStartVertexIndex(x,v);b(0<=z&&z<$);const q=z*O;b(0<=q&&q<=M-O);let J=0,K=q;E.getVertexXYZ(X,0),E.getVertexXYZ(k,E.count-1);const Q=a(X,k),ee=Math.max(W,1e-4*Q);for(let t=0;t<=O;++t){E.getVertexXYZ(X,J),w.getVertexXYZ(k,K);const a=t/O,f=G?P[0]+a*(P[2]-P[0]):s===D.WEST?P[0]:P[2],_=G?s===D.SOUTH?P[1]:P[3]:P[1]+a*(P[3]-P[1]),S=e.surface.extent;if(i(S)||p(S,f,_)){const t=o(X,k),i=n(X)-y.radius,s=n(k)-y.radius,a=t<ee;if(!a){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${x}[${J}/${E.count}] and [${v.lij}].edge${V}[${K}/${w.count}]`),r(S)&&console.warn(" surface extent= ",S," x,y=",f,",",_);const o=u();l(o,e.renderData.localOrigin,v.renderData.localOrigin),n(o)>0&&console.warn(` localOrigins: ${e.renderData.localOrigin} vs ${v.renderData.localOrigin} d=${n(o)} [${o}]`);(()=>{const t=m(X),r=m(k);e.updateEdgeElevations(),v.updateEdgeElevations(),E.getVertexXYZ(X,J),w.getVertexXYZ(k,K);const i=u();g(i,X,t),n(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${X} d=${n(i)} [${i}]`),g(i,k,r),n(i)>0&&console.warn(` XXX Neighbor[${v.lij}] edge out of date: ${r} vs ${k} d=${n(i)} [${i}]`)})(),b(a,`Mismatch in tile [${e.lij}].edge[${x}][${J}/${E.count}] vs neighbor [${v.lij}].edge[${V}][${K}/${w.count}] ${j(X)} vs ${j(k)} dist=${t} h(t|n|d)=${i}|${s}|${s-i}`)}if(e.surface.shadingEnabled){E.getNormal(F,J),w.getNormal(B,K),h(Y,F),h(Z,B);const t=d(Y,Z),r=!1,i=1-t<.01||r||e===v;if(!i){const r=u();g(r,F,B);const s=()=>`Mismatch in tile edge normal ${R(e.lij)} (${J}/${E.count-1}) edge ${x} vs neighbor ${R(v.lij)} (${K}/${w.count-1}) nedge ${V} :${j(F)} vs ${j(B)} dot = ${t} : ${j(r)}`;console.warn("Mismatch in tile edge normal: ",s());{e.updateEdgeElevations(),v.updateEdgeElevations();const t=u(),r=u();E.getNormal(t,J),w.getNormal(r,K),c(F,t)||console.warn("Missing update in tile normal: ",j(F)," => ",j(t)),c(B,r)||console.warn("Missing update in neighbor normal: ",j(B)," => ",j(r))}b(i,s())}}}J+=1,K+=1}}))}}const X=u(),k=u(),F=u(),B=u(),Y=u(),Z=u();function H(e,t,i){if(r(i))for(const r of i)if(r){const i=r.x0,s=r.width,a=i+(s-1)/r.dx,o=r.y1,n=o-(s-1)/r.dy;if(e>=i-V&&e<=a+V&&n-V<=t&&t<=o+V)return!0}return!1}const W=1,z=[null,null,null,null];function q(e,t){return t?.isLoaded||t===e?t:null}export{U as PatchRenderData,H as isElevationSampleIn,q as neighborTileIfLoadedOrSelf};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as T}from"../../../core/promiseUtils.js";import{watch as f,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as L}from"../../../core/accessorSupport/decorators/subclass.js";import{m as E}from"../../../chunks/mat4.js";import{c as D}from"../../../chunks/mat4f64.js";import{c as x}from"../../../chunks/vec3.js";import{c as b}from"../../../chunks/vec3f64.js";import{c as C}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as P}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as U,projectPointToVector as R}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as j,equals as A,intersection as I,empty as V,expand as O,intersectsSphere as B}from"../../../geometry/support/aaBoundingRect.js";import{create as k,copy as q}from"../../../geometry/support/frustum.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as G}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{acquireDecoder as H}from"../../../layers/support/LercDecoder.js";import{printAllocations as Q}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as X,scaleToZoom as z}from"../support/cameraUtils.js";import Y from"../support/debugFlags.js";import{toBoundingRect as $}from"../support/extentUtils.js";import{ClientType as K}from"../support/index.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{sampleElevation as ee,ElevationData as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LODSnapping as re,TextureUpdate as se}from"./interfaces.js";import{LayerClass as ae,LayerClasses as ne}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as he}from"./RenderOrder.js";import{SphericalPatch as de}from"./SphericalPatch.js";import{MAX_ROOT_TILES as pe,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ue,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as ce,MAX_MEMORY_LOD_BIAS as _e,ELEVATION_NODATA_VALUE as ge}from"./TerrainConst.js";import me from"./TerrainRenderer.js";import Te from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,internalAssert as ye,neighborEdgeIndices as ve,oppositeEdge as we,isSurfaceLayerView as Se,isMapTileLayerView as Le,isBlendableLayerView as Ee,isGroupLayer as De,isElevationLayerView as xe,isVectorTileLayerView as be,useFetchTileForLayer as Ce,isImageryTileLayerView as Pe,isTileLayerView as Ue,releaseTileData as Re,ENABLE_TERRAIN_INTERNAL_CHECKS as Me,ENABLE_WATERPROOFNESS_TESTS as je,enableTerrainInternalChecks as Ae,enableTerrainWaterproofnessChecks as Ie}from"./terrainUtils.js";import{SplitLimits as Ve,Tile as Oe}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{TileUpdate as ke}from"./TileUpdate.js";import{IteratorPreorder as qe,IteratorPostorder as Ne,compareTilesByLij as Ge,hasLoadableSiblings as Fe,sortTilesByPOI as We,sortTiles as He}from"./tileUtils.js";import{TilingSchemeLogic as Qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Xe}from"./UpsampleInfo.js";import{isCompositeBlendMode as ze,blendModeFromString as Ye}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{RenderRequestType as $e}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Ke,TaskPriority as Je,noBudget as Ze}from"../../support/Scheduler.js";const et=.25;let tt=class extends(a.EventedMixin(i)){constructor(e){super(e),this._iteratorPool=new c(qe,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ne,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visibleCached=!1,this._usedMemory=null,this._performanceInfo=new Te,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new Ve,this._snapLevel=1/0,this._frustum=k(),this._viewProjectionMatrix=D(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new P,this._frameTask=Ke,this._allTiles=new _,this._upsampleInfoPool=new c(Xe),this._rootTilesExtent=j(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.visibleElevationBounds=new Z(1/0,-1/0),this.rootTileElevationBounds=new Z(1/0,-1/0),this._updatingRootTiles=!1,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this.shortBatches=!1,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=H(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(de);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([f((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),f((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new me({_overlayRenderer:this.overlayManager.renderer,_ellipsoidRadius:M(this.view.spatialReference).radius,_stage:this.view._stage,_allTiles:this._allTiles}),this._handles.add([f((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),f((()=>this.hasCompositeBlendMode),(()=>{this._updateBaseOpacity(this.baseOpacity)}),y),f((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),f((()=>this.backgroundColor),(e=>{this._handleLayerViewChanges(),this._renderer.updateTileBackground(e)}),y),f((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),f((()=>Y.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=ie(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Qe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(K.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(K.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Je.TERRAIN_SURFACE,this),this._handles.add([f((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),f((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),f((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),f((()=>{const e=this.view,t=e.state;return[this._lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),f((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),f((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Oe.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),Q(),Be()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=X(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=z(this.view,e)-r;Math.abs(this._snapLevel-s)>et&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?re.ON:re.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=j(),r=$(t,i,e)?i:null,s=this._get("extent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=I(this.groundExtent,this._userClippingExtent,j()),t=this._get("extent");return A(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view.map.ground.opacity}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view.map.ground.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}get wireframe(){return this._renderer.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}set _visible(e){e!==this._visibleCached&&(this._visibleCached=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get textureFadeDuration(){return this.view.qualitySettings.tiledSurface.textureFadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,nt);return p(s)?null:ee(nt[0],nt[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=nt){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[ae.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!U(s,r,s,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}getScale(e){if(this.tilingScheme){if(!R(e,nt,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e?.containsPoint(nt)){for(;!e.isLeaf&&!e.rendered;){let t=0;nt[0]>e.children[0].extent[2]&&(t+=1),nt[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereElevationBounds(e,t,i,r,s){if(nt[0]=e,nt[1]=t,nt[2]=i,nt[3]=r,!U(nt,s,nt,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;let a=1/0,n=-1/0;const o=e=>{if(e&&B(e.extent,nt))if(e.isLeaf||e.rendered)a=Math.min(a,e.elevationBounds[0]),n=Math.max(n,e.elevationBounds[1]);else for(const t of e.children)o(t)},h=this.rootTiles;if(u(h))for(const l of h)o(l);return{min:a,max:n}}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!R(e,nt,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;nt[3]=t;let i=null;const r=e=>{if(e&&B(e.extent,nt))if(e.isLeaf||e.rendered){const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}else for(const t of e.children)r(t)},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1&&!this.hasCompositeBlendMode,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?se.UNFADED:se.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return ot[0]=e,ot[1]=t,ot[2]=i,s.init(ot,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=lt;let s=t.rootTilesInExtent(e,i,5*pe);if(u(this.rootTiles)){if(s.length>pe)return void l.getLogger(this.declaredClass).warn(ue);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,rt);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>rt(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>pe&&(l.getLogger(this.declaredClass).warn(ce),s=t.rootTilesInExtent(e,i,pe)),this._setRootTiles(s.map((e=>this._newRootTile(e))));A(i,this._rootTilesExtent)||(this._rootTilesExtent=j(i)),this._visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.isLoaded&&e.intersectsClippingArea));e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ge);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e)))}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===ke.SPLIT&&t.setPendingUpdate(ke.SPLIT),this._loadTile(t),this._pendingTilesToUpdate.add(t),this._markAllTileNeighborsForGeometryUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visibleCached&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(ke.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(p(e))return;const t=Fe(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this._viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(ke.GEOMETRY)&&this._updateTileGeometryState(e),e.setPendingUpdate(ke.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBounds[0],r),s=Math.max(e.elevationBounds[1],s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._batchUpdatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new Z(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this.rootTiles;u(i)&&i.forEach((({elevationBounds:i})=>{e=Math.min(e,i[0]),t=Math.max(t,i[1])}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new Z(e,t))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=k()),q(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,q(this._frustum,e.frustum),E(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),x(this._eyePosRenderSR,t.eye),U(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(st(e)?this._loadChildren(e):at(e)&&this._loadParent(e))}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForGeometryUpdate(e)),this._usedMemory=null}_markAllTileNeighborsForGeometryUpdate(e){const t=this._pendingTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(ke.TEXTURE_FADING)?ke.TEXTURE_FADING:!!e.resetPendingUpdate(ke.TEXTURE_NOFADING)&&ke.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(e){const t=dt.extent;V(t);const i=e.length;for(let r=0;r<i;r++)O(t,e[r].extent,t);dt.spatialReference=this.spatialReference,this.emit("elevation-change",dt)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done?this.requestUpdate():this._usedMemory=this._recalculateUsedMemory(),this.notifyChange("updatingProgressValue")}_updateAllTilesStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==ke.SPLIT){if(e.resetPendingUpdate(ke.SPLIT)&&e.updateAgentSuspension(),i===ke.VSPLITMERGE&&e.updateAgents(ae.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(ke.MERGE),e.resetPendingUpdate(ke.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(ke.MERGE),e.isLeaf&&(e.setPendingUpdate(ke.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),this._batchUpdatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(We(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_batchUpdatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=e.size;if(0===t)return;const i=Array.from(e),r=(t,r)=>{!r?.isLoaded||!r.intersectsClippingArea||r.level<t.level||e.has(r)||(e.add(r),i.push(r),r.renderData.updateNeighborData())};i.sort(Ge);for(let s=0;s<t;++s){const t=i[s];ye(t.isLoaded);const a=t.renderData;a.updateNeighborData();const n=a._dirtyEdgeResolutions,l=a.geometryState.neighborData;for(let i=0;i<4;++i)if(n&1<<i){t.findNeighborTile(ve[i],(e=>(e.level===t.level||e.isLoaded)&&e.intersectsClippingArea))?.forAllSubtreeOnSide(we(ve[i]),(i=>!!i.isLoaded&&(ye(e.has(i)||i.level>t.level),r(t,i),!0))),r(t,l.cornerPeerNeighbors[i]),r(t,l.cornerPeerNeighbors[(i+1)%4])}}e.clear(),this._updateTilesGeometries(i),this._emitElevationUpdateEventForTiles(i),Me&&je&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1,r=!1;for(;!e.done;){r=!0;let s=!1;const a=!this._allTiles.some((r=>{if(!i&&!r.loadable)return e.done;let a=r;if(r.resetPendingUpdate(ke.MERGE)){if(!t)return r.setPendingUpdate(ke.MERGE),e.done;for(;a.parent?.resetPendingUpdate(ke.MERGE);)a=a.parent;this._mergeTile(a),s=!0,e.madeProgress()}else r.resetPendingUpdate(ke.SPLIT)&&(this._splitTile(r),s=!0,e.madeProgress());return!e.done&&a===r&&r.resetPendingUpdate(ke.RENDERDATA)&&(this._updateRenderData(r),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!i){i=!0;continue}if(!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}r||(this._allTilesDirty=!0),this._batchUpdatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){return this._allTiles.some((t=>(t.resetPendingUpdate(ke.GEOMETRY)&&(this._updateTileGeometryState(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdatePendingTileGeometries(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams($e.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*_e}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this._visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i])||t;return e.unsetChildren(),t}_purgeTile(e){const t=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),this._tilePool.release(e),t}_unloadTile(e){this._pendingTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){fe(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(ke.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){pt.spatialReference=this.spatialReference,pt.extent=e.extent,pt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",pt)}_createTile(e,t,i,r){fe(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===ke.SPLIT&&s.setPendingUpdate(ke.SPLIT),s}_mergeTile(e){fe(!e.hasPendingUpdate(ke.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(fe(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForGeometryUpdate(e),this._emitTileScaleChange(e),this.shortBatches&&this._batchUpdatePendingTileGeometries()),this._allTilesDirty=!0,++this._performanceInfo.numMerged}_loadChildren(e){fe(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._markAllTileNeighborsForGeometryUpdate(e),this._emitTileScaleChange(e,e.level+1),this.shortBatches&&this._batchUpdatePendingTileGeometries()}_loadParent(e){const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._pendingTilesToUpdate.add(t),this._markAllTileNeighborsForGeometryUpdate(t),this._emitTileScaleChange(t,t.level),this.shortBatches&&this._batchUpdatePendingTileGeometries()}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_loadTile(e){e.load(),e.setPendingUpdate(ke.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e)}_elevationDataArrived(e,t,i){const r=new te(e.lij,e.extent,i);e.dataArrived(t,ae.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}0===a&&this._updateRootTileElevationBounds(),n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Ze){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),Se(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._getLayerIdxByUID(e,s.uid);u(i)&&((i<r||p(r))&&(t=!0),r=i)}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Le(t)&&!W(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if(Ee(e)){const t=De(e.layer.parent)?"normal":e.layer.blendMode;if(ze(Ye[t]))return!0}return!1}_layerClassFromLayerView(e){return xe(e)?ae.ELEVATION:ae.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(f((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(f((()=>e.fullOpacity),(()=>this._updateTileTextures(se.UNFADED)))),t.push(f((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),Ee(e)&&t.push(f((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(se.UNFADED)}))),e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);u(t)&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===ae.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of ne){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ae.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ae.MAP),e===se.IMMEDIATE?this.renderer.updateTileTexture(t,ke.TEXTURE_NOFADING):t.updateRenderData(ae.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=$e.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||be(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ae.ELEVATION?xe(i)?this._requestElevationTileData(e,i,r):Promise.reject():Le(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[ae.ELEVATION].get(t.uid);null!=s?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(e,s,r)):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer %d %s",ae.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,ae.ELEVATION,t,i),this.requestUpdate())};if(Ce(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:ge,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:ge},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Re(s),m(i)||(this._dataMissing(e,ae.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Re(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(be(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Pe(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(Ue(t)&&Ce(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(T());a(e)}),n);let o=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);G(t.layer)&&t.layer.refreshTimestamp&&(o+=`${o.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const h=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(o,h,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(ae.MAP,t.uid);u(r)?e.dataArrived(r,ae.MAP,i):(Re(i),l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i,r){const s=this._getLayerIdxByUID(t,i.uid);u(s)?e.dataMissing(s,t,r):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(p(this._usedMemory)&&(this._usedMemory=this._recalculateUsedMemory()),u(this._usedMemory)?this._usedMemory:0):0}_recalculateUsedMemory(){return this.tilingScheme?this._allTiles.reduce(((e,t)=>e+t.usedMemory),0):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return u(r)&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return fe(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){ht.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&ht.push(e)}));const t=ht.toArray();return He(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTilesWaterproofness(){if(!je)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get shadingEnabled(){return this._renderer.shadingEnabled}get isWebMercator(){return!!this.tilingScheme?.spatialReference.isWebMercator}get isWebMercatorOnPlateeCarree(){return this.isWebMercator&&N(this.view?.renderSpatialReference)}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(u(this.spatialReference)&&this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ae(e)}enableWaterproofnessChecks(e){Ie(e)}};e([S()],tt.prototype,"_renderer",void 0),e([S()],tt.prototype,"_hasPendingUpdates",void 0),e([S()],tt.prototype,"_asyncWorkItems",void 0),e([S()],tt.prototype,"_allTilesDirty",void 0),e([S()],tt.prototype,"_allTilesSorted",void 0),e([S()],tt.prototype,"_viewChanged",void 0),e([S({readOnly:!0})],tt.prototype,"_watchUpdatingTracking",void 0),e([S()],tt.prototype,"_frameTask",void 0),e([S({readOnly:!0})],tt.prototype,"snapLevel",null),e([S({readOnly:!0})],tt.prototype,"lodSnapping",null),e([S({constructOnly:!0})],tt.prototype,"view",void 0),e([S()],tt.prototype,"_userClippingExtent",null),e([S()],tt.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],tt.prototype,"extent",null),e([S({readOnly:!0})],tt.prototype,"groundExtent",null),e([S({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],tt.prototype,"updating",null),e([S(J)],tt.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([S()],tt.prototype,"_maxNumUpdating",void 0),e([S()],tt.prototype,"baseOpacity",null),e([S()],tt.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],tt.prototype,"overlayManager",void 0),e([S({readOnly:!0})],tt.prototype,"viewingMode",null),e([S()],tt.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],tt.prototype,"ready",null),e([S({value:he.FRONT_TO_BACK})],tt.prototype,"renderOrder",null),e([S({readOnly:!0})],tt.prototype,"rootTiles",void 0),e([S({readOnly:!0})],tt.prototype,"spatialReference",null),e([S({type:t})],tt.prototype,"backgroundColor",null),e([S({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([S({value:!0})],tt.prototype,"velvetOverground",null),e([S()],tt.prototype,"wireframe",null),e([S({value:!1})],tt.prototype,"suspended",null),e([S()],tt.prototype,"textureFadeDuration",null),e([S()],tt.prototype,"visibleElevationBounds",void 0),e([S()],tt.prototype,"rootTileElevationBounds",void 0),e([S()],tt.prototype,"_layerViewsDirty",void 0),e([S()],tt.prototype,"renderPatchBorders",null),e([S()],tt.prototype,"renderingDisabled",null),tt=e([L("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt;function rt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function st(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>st(e))))}function at(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const nt=C(),lt=j(),ot=[0,0,0],ht=new _,dt={spatialReference:null,extent:j(),context:"ground"},pt={spatialReference:null,extent:null,scale:0};export{it as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import n from"../../../core/Handles.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{releaseMaybe as h,destroyMaybe as d,isNone as p,isSome as u}from"../../../core/maybe.js";import c from"../../../core/ObjectPool.js";import _ from"../../../core/PooledArray.js";import{isAbortError as g,isAborted as m,createAbortError as T}from"../../../core/promiseUtils.js";import{watch as f,syncAndInitial as y,sync as v,initial as w}from"../../../core/reactiveUtils.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as L}from"../../../core/accessorSupport/decorators/subclass.js";import{m as E}from"../../../chunks/mat4.js";import{c as D}from"../../../chunks/mat4f64.js";import{c as x}from"../../../chunks/vec3.js";import{c as C}from"../../../chunks/vec3f64.js";import{c as P}from"../../../chunks/vec4f64.js";import{WatchUpdatingTracking as b}from"../../../core/support/WatchUpdatingTracking.js";import{projectVectorToVector as U,projectPointToVector as R}from"../../../geometry/projection.js";import{getReferenceEllipsoid as M}from"../../../geometry/projectionEllipsoid.js";import{create as j,equals as A,intersection as I,empty as V,expand as O,intersectsSphere as k}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as q}from"../../../geometry/support/frustum.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{isRefreshableLayer as G}from"../../../layers/mixins/RefreshableLayer.js";import{ElevationQueryTileCache as F}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{acquireDecoder as H}from"../../../layers/support/LercDecoder.js";import{printAllocations as Q}from"../../2d/engine/vectorTiles/VectorTile.js";import{directionToHeadingTilt as X,scaleToZoom as z}from"../support/cameraUtils.js";import Y from"../support/debugFlags.js";import{toBoundingRect as $}from"../support/extentUtils.js";import{ClientType as K}from"../support/index.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{sampleElevation as ee,ElevationData as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LODSnapping as re,TextureUpdate as se}from"./interfaces.js";import{LayerClass as ae,LayerClasses as ne}from"./LayerClass.js";import{OverlayManager as le}from"./OverlayManager.js";import{PlanarPatch as oe}from"./PlanarPatch.js";import{RenderOrder as he}from"./RenderOrder.js";import{SphericalPatch as de}from"./SphericalPatch.js";import{MAX_ROOT_TILES as pe,TOO_MANY_ROOT_TILES_AFTER_CHANGE_ERROR as ue,TOO_MANY_ROOT_TILES_FOR_LAYER_ERROR as ce,MAX_MEMORY_LOD_BIAS as _e,ELEVATION_NODATA_VALUE as ge}from"./TerrainConst.js";import me from"./TerrainRenderer.js";import Te from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,internalAssert as ye,oppositeEdge as ve,isSurfaceLayerView as we,isMapTileLayerView as Se,isBlendableLayerView as Le,isGroupLayer as Ee,isElevationLayerView as De,isVectorTileLayerView as xe,useFetchTileForLayer as Ce,isImageryTileLayerView as Pe,isTileLayerView as be,releaseTileData as Ue,neighborEdgeIndices as Re,ENABLE_TERRAIN_INTERNAL_CHECKS as Me,ENABLE_WATERPROOFNESS_TESTS as je,enableTerrainInternalChecks as Ae,enableTerrainWaterproofnessChecks as Ie}from"./terrainUtils.js";import{SplitLimits as Ve,Tile as Oe}from"./Tile.js";import{printAllocations as ke}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as qe,IteratorPostorder as Ne,compareTilesByLij as Ge,hasLoadableSiblings as Fe,sortTilesByPOI as We,sortTiles as He}from"./tileUtils.js";import{TilingSchemeLogic as Qe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Xe}from"./UpsampleInfo.js";import{isCompositeBlendMode as ze,blendModeFromString as Ye}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{RenderRequestType as $e}from"../webgl-engine/lib/basicInterfaces.js";import{ImmediateTask as Ke,TaskPriority as Je,noBudget as Ze}from"../../support/Scheduler.js";const et=.25;let tt=class extends(a.EventedMixin(i)){constructor(e){super(e),this._iteratorPool=new c(qe,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ne,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._visibleCached=!1,this._usedMemory=null,this._performanceInfo=new Te,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=C(),this._eyePosSurfaceSR=C(),this._splitLimits=new Ve,this._snapLevel=1/0,this._frustum=B(),this._viewProjectionMatrix=D(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._handles=new n,this._watchUpdatingTracking=new b,this._frameTask=Ke,this._allTiles=new _,this._upsampleInfoPool=new c(Xe),this._rootTilesExtent=j(),this._maxNumUpdating=1,this.maxTextureScale=1.2,this.visibleElevationBounds=new Z(1/0,-1/0),this.rootTileElevationBounds=new Z(1/0,-1/0),this._updatingRootTiles=!1,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this.shortBatches=!1,this._layerViewsDirty=!1,this._isGlobal=!e.view?.state?.isLocal}initialize(){this._lercDecoder=H(this.view.resourceController),this._tilePool=this.view.state.isLocal?new c(oe):new c(de);const e=this.view.resourceController.memoryController;this._upsampleMapCache=e.newCache("esri.views.3d.terrain.upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new F(e.newCache("elevation-query")),this._set("overlayManager",new le({surface:this})),this._handles.add([f((()=>this.overlayManager.hasHighlights),(e=>this._renderer.setNeedsHighlight(e))),f((()=>this.overlayManager.rendersOccluded),(e=>this._renderer.setRenderOccludedOverlay(e)))],"overlayManager"),this._renderer=new me({_overlayRenderer:this.overlayManager.renderer,_ellipsoidRadius:M(this.view.spatialReference).radius,_stage:this.view._stage,_allTiles:this._allTiles}),this._handles.add([f((()=>this.baseOpacity),(e=>{this._handleLayerViewChanges(),this._updateBaseOpacity(e)}),y),f((()=>this.hasCompositeBlendMode),(()=>{this._updateBaseOpacity(this.baseOpacity)}),y),f((()=>this.renderingDisabled),(()=>this._updateTransparentTerrain()),v),f((()=>this.backgroundColor),(e=>{this._handleLayerViewChanges(),this._renderer.updateTileBackground(e)}),y),f((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>()=>this._allTilesSorted=!1))})),f((()=>Y.TERRAIN_TILE_TREE_SHOW_TILES),(e=>{e&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:e})=>{!this._treeDebugger&&Y.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new e({view:this.view}))})):e||(this._treeDebugger=d(this._treeDebugger))}),w)]),this._extentHelper=ie(this.viewingMode,{layers:this.view.map.allLayers,layerViews:this.view.allLayerViews,viewSpatialReference:this.view.spatialReference});const t=this.view.defaultsFromMap?new s({getCollections:()=>this.view?.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}):this.view.map.allLayers,i=new Qe({layers:t,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:this.view.spatialReference});this._set("tilingSchemeLogic",i),this._updateTilingScheme(),this._elevationDataRequester=this.view.resourceController.createStreamDataRequester(K.ELEVATION),this._mapDataRequester=this.view.resourceController.createStreamDataRequester(K.BASEMAP);const r=this.view.resourceController.scheduler;this._frameTask=r.registerTask(Je.TERRAIN_SURFACE,this),this._handles.add([f((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),w),f((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),v),f((()=>this.extent),(()=>this._updateRootTiles()),w),this.view.on("resize",(()=>this._viewChangeUpdate())),f((()=>{const e=this.view,t=e.state;return[this._lodBias,this.lodSnapping,e.resourceController?.memoryController?.memoryFactor,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),y),f((()=>this.view.qualitySettings?.tiledSurface?.textureFadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),w),f((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),v)]),this._handles.add(this.view.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges()}destroy(){this._frameTask.remove(),this._handles.destroy(),this._watchUpdatingTracking.destroy(),this._lercDecoder=h(this._lercDecoder),this._removeAllTiles(),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._extentHelper=d(this._extentHelper),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",d(this.overlayManager)),this._tilePool=d(this._tilePool),Oe.prune(),this._treeDebugger&&(this._treeDebugger.destroy(),this._treeDebugger=null),this._renderer=d(this._renderer),this._iteratorPool=d(this._iteratorPool),this._set("view",null),this._upsampleInfoPool=d(this._upsampleInfoPool),Q(),ke()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){const e=this.view.pointsOfInterest?.contentCameraOnSurface?.scale;if(e){const t=this.view.state.contentCamera;let i=X(this.view,t.eye,t.viewForward,t.up).tilt;i>90&&(i=180-i);const r=2*(i/90)**2,s=z(this.view,e)-r;Math.abs(this._snapLevel-s)>et&&(Math.round(s)!==Math.round(this._snapLevel)&&(this._viewChanged=!0),this._snapLevel=s)}return Math.round(this._snapLevel)}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?re.ON:re.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(p(t)||p(e))return null;const i=j(),r=$(t,i,e)?i:null,s=this._get("extent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=I(this.groundExtent,this._userClippingExtent,j()),t=this._get("extent");return A(e,t)?t:e}get groundExtent(){return u(this._tilingSchemeExtent)?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this._watchUpdatingTracking.updating||this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||this._asyncWorkItems>0||!this._allTilesSorted||this._layerViewsDirty)&&this.ready&&!this.suspended||this.overlayManager.updating||this._frameTask.updating)}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view.map.ground.opacity}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return u(this.rootTiles)}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view.map.ground.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._updateTransparentTerrain()}_updateTransparentTerrain(){const e=!this.renderingDisabled&&!this.opaque;this.view?._stage?.renderView.setRenderParameters({transparentTerrain:e})}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}set velvetOverground(e){e!==this.velvetOverground&&(this._renderer.velvetOverground=e),this._set("velvetOverground",e)}get wireframe(){return this._renderer.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}set _visible(e){e!==this._visibleCached&&(this._visibleCached=e,this._renderer.setVisibility(e),this.suspended=!e)}get opaque(){return this._renderer.opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get textureFadeDuration(){return this.view.qualitySettings.tiledSurface.textureFadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevation(e,t,i,r){const s=this.getTileWithElevation(e,t,i,r,nt);return p(s)?null:ee(nt[0],nt[1],s.renderData.geometryState.samplerData)}getTileWithElevation(e,t,i,r,s=nt){const a=this.rootTiles;if(p(a)||!a.length)return null;if(0===a[0].layerInfo[ae.ELEVATION].length)return null;if(s[0]=e,s[1]=t,s[2]=i,!U(s,r,s,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;for(let n of a){if(!n.containsPoint(s))continue;for(;n&&!n.rendered&&!n.isLeaf;){let e=0;s[0]>.5*(n.extent[0]+n.extent[2])&&(e+=1),s[1]<.5*(n.extent[1]+n.extent[3])&&(e+=2),n=n.children[e]}const e=n.renderData;return(e?e.geometryState.samplerData:null)?n:null}return null}getScale(e){if(this.tilingScheme){if(!R(e,nt,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this.rootTiles;if(u(t))for(let e of t)if(e?.containsPoint(nt)){for(;!e.isLeaf&&!e.rendered;){let t=0;nt[0]>e.children[0].extent[2]&&(t+=1),nt[1]<e.children[0].extent[1]&&(t+=2),e=e.children[t]}return this._getLodBiasCorrectedScale(e.level)}}return 1e100}getSphereElevationBounds(e,t,i,r,s){if(nt[0]=e,nt[1]=t,nt[2]=i,nt[3]=r,!U(nt,s,nt,this.tilingScheme?.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;let a=1/0,n=-1/0;const o=e=>{if(e&&k(e.extent,nt))if(e.isLeaf||e.rendered)a=Math.min(a,e.elevationBounds[0]),n=Math.max(n,e.elevationBounds[1]);else for(const t of e.children)o(t)},h=this.rootTiles;if(u(h))for(const l of h)o(l);return{min:a,max:n}}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!R(e,nt,this.spatialReference))return l.getLogger(this.declaredClass).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;nt[3]=t;let i=null;const r=e=>{if(e&&k(e.extent,nt))if(e.isLeaf||e.rendered){const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}else for(const t of e.children)r(t)},s=this.rootTiles;if(u(s))for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._renderer.queryVisibleLevelRange(e,s+n,a+n,r)}_updateBaseOpacity(e){const t=this._renderer.opaque;this._renderer.opaque=e>=1&&!this.hasCompositeBlendMode,this._renderer.isTransparent=this._allSurfaceLayersTransparent();const i=t!==this._renderer.opaque;i&&this._updateTransparentTerrain(),this._updateTileTextures(i?se.UNFADED:se.IMMEDIATE)}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;e!==this.tilingScheme&&(fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles(),this._set("tilingScheme",e),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.setTileSize(e.pixelSize),this.overlayManager.setSpatialReference(e.spatialReference),this._updateRootTiles()))}_acquireTile(e,t,i,r){const s=this._tilePool.acquire();return ot[0]=e,ot[1]=t,ot[2]=i,s.init(ot,r,this),s}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=lt;let s=t.rootTilesInExtent(e,i,5*pe);if(u(this.rootTiles)){if(s.length>pe)return void l.getLogger(this.declaredClass).warn(ue);const e=this.rootTiles.map((e=>e.lij)),t=r(e,s,rt);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this.rootTiles.filter((e=>!(t.removed.findIndex((t=>rt(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>pe&&(l.getLogger(this.declaredClass).warn(ce),s=t.rootTilesInExtent(e,i,pe)),this._setRootTiles(s.map((e=>this._newRootTile(e))));A(i,this._rootTilesExtent)||(this._rootTilesExtent=j(i)),this._visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.isLoaded&&e.intersectsClippingArea));e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ge);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e)))}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Be.SPLIT&&t.setPendingUpdate(Be.SPLIT),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._set("rootTiles",e),this._allTiles.clear(),u(e)){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this.rootTiles),this._updateTilesVisibility(e)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this._visibleCached&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this.rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(p(e))return;const t=Fe(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this._viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e),e.setPendingUpdate(Be.RENDERDATA),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBounds[0],r),s=Math.max(e.elevationBounds[1],s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._batchUpdatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new Z(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this.rootTiles;u(i)&&i.forEach((({elevationBounds:i})=>{e=Math.min(e,i[0]),t=Math.max(t,i[1])}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new Z(e,t))}_updateViewDependentParameters(){const e=this.view.state.camera,t=this.view.state.contentCamera,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?(p(this._splitLimits.frustum)&&(this._splitLimits.frustum=B()),q(this._splitLimits.frustum,t.frustum)):this._splitLimits.frustum=null,q(this._frustum,e.frustum),E(this._viewProjectionMatrix,t.projectionMatrix,t.viewMatrix),x(this._eyePosRenderSR,t.eye),U(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(e){e.rendered&&!e.shouldLoad&&(st(e)?this._loadChildren(e):at(e)&&this._loadParent(e))}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this._usedMemory=null}_markAllTileNeighborsForGeometryUpdate(e){const t=this._pendingTilesToUpdate;e.forEachLoadedNeighbor((e=>{t.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(e){const t=dt.extent;V(t);const i=e.length;for(let r=0;r<i;r++)O(t,e[r].extent,t);dt.spatialReference=this.spatialReference,this.emit("elevation-change",dt)}get running(){return this.updating&&this.ready&&!this.suspended}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),e.run((()=>this._updateElevation(e))),e.run((()=>this._updateTextures(e))),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),e.done?this.requestUpdate():this._usedMemory=this._recalculateUsedMemory(),this.notifyChange("updatingProgressValue")}_updateAllTilesStatus(e){if(!this._viewChanged||!this.rootTiles||e.done)return;this._viewChanged=!1;const t=this._iteratorPool.acquire();for(t.reset(this.rootTiles);!t.done;){const e=t.next(),i=e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping);if(i!==Be.SPLIT){if(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),i===Be.VSPLITMERGE&&e.updateAgents(ae.ELEVATION),t.skipSubtree(),!e.isLeaf){e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT);const t=this._iteratorPool.acquire();t.resetOne(e);for(let e=t.next();!t.done;e=t.next())this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(this._viewProjectionMatrix);t.remove()}}else e.resetPendingUpdate(Be.MERGE),e.isLeaf&&(e.setPendingUpdate(Be.SPLIT),t.skipSubtree())}t.remove(),this.requestUpdate(),this._batchUpdatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(We(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e,t=!0){ye(e.isLoaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),t&&this._markAllTileNeighborsForGeometryUpdate(e))}_batchUpdatePendingTileGeometries(){const e=this._pendingTilesToUpdate;if(0===e.size)return;const t=[];e.forEach((e=>{e.isLoaded&&e.intersectsClippingArea&&t.push(e)}));const i=(i,r)=>{!r?.isLoaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ge);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ye(r.isLoaded),ye(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a._dirtyEdgeResolutions,l=a.geometryState.neighborData;for(let t=0;t<4;++t)if(n&1<<t){const s=r.renderData.geometryState.neighborData.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(Re[t]),(t=>!(!t.isLoaded||!t.intersectsClippingArea)&&(ye(e.has(t)||Ge(r,t)<0),i(r,t),!0))),i(r,l.cornerPeerNeighbors[t]),i(r,l.cornerPeerNeighbors[(t+1)%4])}}e.clear(),this._updateTilesGeometries(t),this._emitElevationUpdateEventForTiles(t),Me&&je&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1,r=!1;for(;!e.done;){r=!0;let s=!1;const a=!this._allTiles.some((r=>{if(!i&&!r.loadable)return e.done;let a=r;if(r.resetPendingUpdate(Be.MERGE)){if(!t)return r.setPendingUpdate(Be.MERGE),e.done;for(;a.parent?.resetPendingUpdate(Be.MERGE);)a=a.parent;this._mergeTile(a),s=!0,e.madeProgress()}else r.resetPendingUpdate(Be.SPLIT)&&(this._splitTile(r),s=!0,e.madeProgress());return!e.done&&a===r&&r.resetPendingUpdate(Be.RENDERDATA)&&(this._updateRenderData(r),e.madeProgress()),e.done}));if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),a){if(!i){i=!0;continue}if(!s)break;this._updateTilesVisibility(this.rootTiles)}else this._allTilesDirty=!0}r||(this._allTilesDirty=!0),this._batchUpdatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){return this._allTiles.some((t=>(t.resetPendingUpdate(Be.GEOMETRY)&&(this._updateTileGeometryState(t),this._updateTileTexture(t,e),e.madeProgress()),e.done))),this._batchUpdatePendingTileGeometries(),e.hasProgressed}_updateTextures(e){return this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done))),e.hasProgressed}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams($e.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.resourceController.memoryController.memoryFactor;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*_e}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){u(this.rootTiles)&&(this.rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this._visible=!1}_purgeDescendantTiles(e){if(e.isLeaf)return!1;let t=!1;for(let i=0;i<4;++i)t=this._purgeTile(e.children[i])||t;return e.unsetChildren(),t}_purgeTile(e){const t=this._purgeDescendantTiles(e)||e.rendered;return this._allTiles.removeUnordered(e),this._unloadTile(e),this._tilePool.release(e),t}_unloadTile(e){this._pendingTilesToUpdate.delete(e),e.unload(this._renderer)}_splitTile(e){fe(e.isLeaf,"tile that is already split should not be split again!");const t=e.level+1,i=2*e.lij[1],r=2*e.lij[2];e.setChildren(this._createTile(t,i,r,e),this._createTile(t,i,r+1,e),this._createTile(t,i+1,r,e),this._createTile(t,i+1,r+1,e)),e.setPendingUpdate(Be.RENDERDATA),e.updateAgentSuspension(),this._allTiles.pushArray(e.children),this._allTilesDirty=!0,++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){pt.spatialReference=this.spatialReference,pt.extent=e.extent,pt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",pt)}_createTile(e,t,i,r){fe(!!r,"_createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this._viewProjectionMatrix),s.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.lodSnapping)===Be.SPLIT&&s.setPendingUpdate(Be.SPLIT),s}_mergeTile(e){fe(!e.hasPendingUpdate(Be.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(e)&&(fe(!e.renderData,"_mergeTile sanity check"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this.shortBatches&&this._batchUpdatePendingTileGeometries()),this._allTilesDirty=!0,++this._performanceInfo.numMerged}_loadChildren(e){fe(e.rendered,"parent should be rendered"),this._unloadTile(e);const t=e.children;t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._markAllTileNeighborsForGeometryUpdate(e),this._emitTileScaleChange(e,e.level+1),this.shortBatches&&this._batchUpdatePendingTileGeometries()}_loadParent(e){const t=e.parent;this._unloadChildren(t),this._loadTile(t),this._markTileToUpdate(t),this._emitTileScaleChange(t,t.level),this.shortBatches&&this._batchUpdatePendingTileGeometries()}_unloadChildren(e){if(!e.isLeaf)for(let t=0;t<4;++t){const i=e.children[t];this._unloadChildren(i),this._unloadTile(i)}}_loadTile(e){e.load(),e.setPendingUpdate(Be.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(e)}_elevationDataArrived(e,t,i){const r=new te(e.lij,e.extent,i);e.dataArrived(t,ae.ELEVATION,r);const s=[e],a=e.level,n=this._iteratorPool.acquire();for(n.reset(s);!n.done;){const e=n.next();e.findElevationBoundsForLayer(t,a),e.computeElevationBounds()}0===a&&this._updateRootTileElevationBounds(),n.remove(),this._updateTilesVisibility(s)}_handleLayerViewChanges(e=Ze){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(const s of this.view.allLayerViews.items)if(i.add(s.uid),we(s))if(this._basemapLayerViewHandles.has(s.uid)){const e=this._layerClassFromLayerView(s),i=this._getLayerIdxByUID(e,s.uid);u(i)&&((i<r||p(r))&&(t=!0),r=i)}else this._registerTiledLayerView(s),s.layer.loaded&&(t=!0);this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this._renderer.isTransparent=this._allSurfaceLayersTransparent(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),e.madeProgress()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(Se(t)&&!W(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if(Le(e)){const t=Ee(e.layer.parent)?"normal":e.layer.blendMode;if(ze(Ye[t]))return!0}return!1}_layerClassFromLayerView(e){return De(e)?ae.ELEVATION:ae.MAP}_registerTiledLayerView(e){const t=[],i=this._layerClassFromLayerView(e);t.push(f((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(f((()=>e.fullOpacity),(()=>this._updateTileTextures(se.UNFADED)))),t.push(f((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),Le(e)&&t.push(f((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(se.UNFADED)}))),e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);u(t)&&this._invalidateLayerData(t,i)})),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(let e=0;e<t.length;e++)t[e].remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===ae.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of ne){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this.rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this.rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this.rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ae.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ae.MAP),e===se.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(ae.MAP,e)})),this._renderer.isTransparent=this._allSurfaceLayersTransparent()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=$e.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1==++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||xe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.lij[0],e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,g(t)||this._dataMissing(e,i,s,{notInTilemap:!0}),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){return t===ae.ELEVATION?De(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{if(m(i))return;const s=this._layerIndexByUid[ae.ELEVATION].get(t.uid);null!=s?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(e,s,r)):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer %d %s",ae.ELEVATION,e.lij.toString())},s=i=>{g(i)||(this._dataMissing(e,ae.ELEVATION,t,i),this.requestUpdate())};if(Ce(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],{noDataValue:ge,signal:i.signal}).then((e=>{if(!m(i))return this._frameTask.schedule((()=>r(e)),i.signal,s);l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")}),s).finally((()=>{--this._asyncWorkItems}));const a=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);return this._elevationDataRequester.request(a,"binary",i).then((e=>this._lercDecoder.decode(e,{noDataValue:ge},i.signal))).then((e=>{e?r({values:e.pixelData,width:e.width,height:e.height,noDataValue:e.noDataValue,minValue:e.minValue,maxValue:e.maxValue}):s(new Error("LERC decoding failed"))}),s).finally((()=>{--this._asyncWorkItems}))}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{--this._asyncWorkItems,Ue(s),m(i)||(this._dataMissing(e,ae.MAP,t,r),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{--this._asyncWorkItems,this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));if(xe(t)){const r=t.schemaHelper.getLevelRowColumn(e.lij);return t.fetchTile(r[0],r[1],r[2],i).then(a,n)}if(Pe(t))return t.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then(a,n);if(be(t)&&Ce(t.layer))return t.layer.fetchTile(e.lij[0],e.lij[1],e.lij[2],i).then((e=>{if(m(i))return l.getLogger(this.declaredClass).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void n(T());a(e)}),n);let o=t.getTileUrl(e.lij[0],e.lij[1],e.lij[2]);G(t.layer)&&t.layer.refreshTimestamp&&(o+=`${o.includes("?")?"&":"?"}_ts=${t.layer.refreshTimestamp}`);const h=t.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(o,h,i).then(a,n)}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(ae.MAP,t.uid);u(r)?e.dataArrived(r,ae.MAP,i):(Ue(i),l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i,r){const s=this._getLayerIdxByUID(t,i.uid);u(s)?e.dataMissing(s,t,r):l.getLogger(this.declaredClass).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(e){this.rootTiles&&this.overlayManager&&(this._allTiles.forAll((e=>{e.renderData&&this.overlayManager.setTileParameters(e)})),this._renderer.setNeedsRender(e))}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.isLeaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}getUsedMemory(){return this.tilingScheme?(p(this._usedMemory)&&(this._usedMemory=this._recalculateUsedMemory()),u(this._usedMemory)?this._usedMemory:0):0}_recalculateUsedMemory(){return this.tilingScheme?this._allTiles.reduce(((e,t)=>e+t.usedMemory),0):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return u(r)&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}getTile(e){if(p(e)||p(this.rootTiles))return null;const t=e.split("/").map((e=>+e));if(0===t[0])return this.rootTiles.find((e=>e.lij[1]===t[1]&&e.lij[2]===t[2]));const i=2**t[0],r=Math.floor(t[1]/i),s=Math.floor(t[2]/i);let a;if(this.rootTiles.some((e=>e.lij[1]===r&&e.lij[2]===s&&(a=e,!0))),a){let e=1<<t[0]-1;for(;a.lij[0]<t[0];){let i=t[1]&e?2:0;if((t[2]&e)>0&&i++,!a.children[i])return null;a=a.children[i],e>>=1}return fe(a.lij[0]===t[0]&&a.lij[1]===t[1]&&a.lij[2]===t[2],"not the right tile?"),a}return null}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){const e=this;return{renderer:e._renderer,lercDecoder:e._lercDecoder,forceReload:()=>{u(e.rootTiles)&&(e._mergeTile(e.rootTiles[0]),e._viewChangeUpdate())},getTiles:()=>e._allTiles.toArray(),getRenderedTiles(){ht.clear(),e._allTiles.forAll((e=>{e.visible&&e.rendered&&ht.push(e)}));const t=ht.toArray();return He(e.renderOrder,t),t},lockTilingScheme(t,i){e._extentHelper.defaultTiledLayersExtent=i,e.tilingSchemeLogic.test.lockTilingScheme(t)}}}checkAllTilesWaterproofness(){if(!je)return;const e=this.rootTiles;if(p(e))return;const t=e=>e?.renderData?.geometryInfo?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometryInfo&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometryInfo||(e.renderData.geometryInfo.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometryInfo),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.isLeaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.isLeaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get shadingEnabled(){return this._renderer.shadingEnabled}get isWebMercator(){return!!this.tilingScheme?.spatialReference.isWebMercator}get isWebMercatorOnPlateeCarree(){return this.isWebMercator&&N(this.view?.renderSpatialReference)}isEastEndWrap(e){return this.isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this.isGlobal&&0===e[2]}lijEastEnd(e){return 2**(e+(u(this.spatialReference)&&this.spatialReference.isGeographic?1:0))}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this.isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ae(e)}enableWaterproofnessChecks(e){Ie(e)}};e([S()],tt.prototype,"_renderer",void 0),e([S()],tt.prototype,"_hasPendingUpdates",void 0),e([S()],tt.prototype,"_asyncWorkItems",void 0),e([S()],tt.prototype,"_allTilesDirty",void 0),e([S()],tt.prototype,"_allTilesSorted",void 0),e([S()],tt.prototype,"_viewChanged",void 0),e([S({readOnly:!0})],tt.prototype,"_watchUpdatingTracking",void 0),e([S()],tt.prototype,"_frameTask",void 0),e([S({readOnly:!0})],tt.prototype,"snapLevel",null),e([S({readOnly:!0})],tt.prototype,"lodSnapping",null),e([S({constructOnly:!0})],tt.prototype,"view",void 0),e([S()],tt.prototype,"_userClippingExtent",null),e([S()],tt.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],tt.prototype,"extent",null),e([S({readOnly:!0})],tt.prototype,"groundExtent",null),e([S({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],tt.prototype,"updating",null),e([S(J)],tt.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([S()],tt.prototype,"_maxNumUpdating",void 0),e([S()],tt.prototype,"baseOpacity",null),e([S()],tt.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],tt.prototype,"overlayManager",void 0),e([S({readOnly:!0})],tt.prototype,"viewingMode",null),e([S()],tt.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],tt.prototype,"ready",null),e([S({value:he.FRONT_TO_BACK})],tt.prototype,"renderOrder",null),e([S({readOnly:!0})],tt.prototype,"rootTiles",void 0),e([S({readOnly:!0})],tt.prototype,"spatialReference",null),e([S({type:t})],tt.prototype,"backgroundColor",null),e([S({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([S({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([S({value:!0})],tt.prototype,"velvetOverground",null),e([S()],tt.prototype,"wireframe",null),e([S({value:!1})],tt.prototype,"suspended",null),e([S()],tt.prototype,"textureFadeDuration",null),e([S()],tt.prototype,"visibleElevationBounds",void 0),e([S()],tt.prototype,"rootTileElevationBounds",void 0),e([S()],tt.prototype,"_layerViewsDirty",void 0),e([S()],tt.prototype,"renderPatchBorders",null),e([S()],tt.prototype,"renderingDisabled",null),tt=e([L("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt;function rt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function st(e){return!e.isLeaf&&(e.children.some((e=>e.shouldLoad))||e.children.some((e=>st(e))))}function at(e){return e.isLeaf&&e.parent&&e.parent.shouldLoad}const nt=P(),lt=j(),ot=[0,0,0],ht=new _,dt={spatialReference:null,extent:j(),context:"ground"},pt={spatialReference:null,extent:null,scale:0};export{it as default};