@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 465 kB
JavaScript
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5719,6061],{76061:(t,e,s)=>{s.d(e,{G:()=>i,S:()=>r});class i{*[Symbol.iterator](){let t=this.next();for(;t;)yield t,t=this.next()}}class r extends i{constructor(t){super(),this.m_iGeom=-1,this.m_aGeoms=t?t.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const t=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,t}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},9775:(t,e,s)=>{s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t=t=>t.values().next().value){this._peeker=t,this._observable=new r.I,this._items=new Set}get length(){return(0,i.gc)(this._observable),this._items.size}clear(){0!==this.length&&(this._items.clear(),this._observable.notify())}last(){if(0===this.length)return;let t;for(t of this._items);return t}peek(){if(0!==this.length)return this._peeker(this._items)}push(t){this.contains(t)||(this._items.add(t),this._observable.notify())}contains(t){return(0,i.gc)(this._observable),this._items.has(t)}pop(){if(0===this.length)return;const t=this.peek();return this._items.delete(t),this._observable.notify(),t}popLast(){if(0===this.length)return;const t=this.last();return this._items.delete(t),this._observable.notify(),t}remove(t){this.contains(t)&&(this._items.delete(t),this._observable.notify())}filter(t){const e=this.length;return this._items.forEach((e=>{t(e)||this._items.delete(e)})),e!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){(0,i.gc)(this._observable),yield*this._items}}},563:(t,e,s)=>{s.d(e,{QueueProcessor:()=>l});var i=s(97768),r=s(74887),n=s(9775),o=s(32587),a=s(11932),h=s(44794);class c{constructor(t,e){this.item=t,this.controller=e,this.promise=null}}class l{constructor(t){this._schedule=null,this._deferreds=new o.A,this._controllers=new o.A,this._processingItems=new o.A,this._pausedSignal=(0,h.v)(!1),this.concurrency=1,t.concurrency&&(this.concurrency=t.concurrency),this._queue=new n.A(t.peeker),this.process=t.process}destroy(){this.clear(),this._schedule=(0,i.xt)(this._schedule)}get updating(){return this.running}get length(){return this._processingItems.size+this._queue.length}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}abort(t){const e=this._controllers.get(t);e&&e.abort()}clear(){this._queue.clear();const t=[];this._controllers.forEach((e=>t.push(e))),this._controllers.clear(),t.forEach((t=>t.abort())),this._processingItems.clear(),this._cancelNext()}forEach(t){this._deferreds.forEach(((e,s)=>t(s)))}get(t){const e=this._deferreds.get(t);return e?e.promise:void 0}isOngoing(t){return this._processingItems.has(t)}has(t){return this._deferreds.has(t)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(t,e){const s=this.get(t);if(s)return s;const i=new AbortController;let n=null;e&&(n=(0,r.u7)(e,(()=>i.abort())));const o=()=>{a.remove(),null!=n&&n.remove(),this._removeItem(t),this._queue.remove(t),this._scheduleNext()},a=(0,r.NY)(i.signal,(()=>{const e=this._processingItems.get(t);e&&e.controller.abort(),o(),h.reject((0,r.NK)())})),h=(0,r.Tw)();return this._deferreds.set(t,h),this._controllers.set(t,i),h.promise.then(o,o),this._queue.push(t),this._scheduleNext(),h.promise}last(){return this._queue.last()}lastPromise(){const t=this.last();return t?this.get(t):null}peek(){return this._queue.peek()}popLast(){const t=this._queue.popLast();return t&&(this._deferreds.get(t)?.reject((0,r.NK)()),this._removeItem(t)),t}reset(){const t=Array.from(this._processingItems.values());this._processingItems.clear();for(const e of t)this._queue.push(e.item),e.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const t=[];for(;this._queue.length;)t.push(this._queue.pop());return this.clear(),t}_removeItem(t){this._deferreds.delete(t),this._controllers.delete(t),this._processingItems.delete(t)}_scheduleNext(){this._pausedSignal.value||this._schedule||(this._schedule=(0,a._)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).resolve(e))}_processError(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).reject(e))}_canProcessFulfillment(t){return!!this._deferreds.get(t.item)&&this._processingItems.get(t.item)===t}_process(t){if(null==t)return;let e;const s=new AbortController,i=new c(t,s);this._processingItems.set(t,i);try{e=this.process(t,s.signal)}catch(t){this._processError(i,t)}(0,r.$X)(e)?(i.promise=e,e.then((t=>this._processResult(i,t)),(t=>this._processError(i,t)))):this._processResult(i,e)}}},32587:(t,e,s)=>{s.d(e,{A:()=>n});var i=s(62788),r=s(95488);class n{constructor(t){this._observable=new r.I,this._map=new Map(t)}get size(){return(0,i.gc)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(t){const e=this._map.delete(t);return e&&this._observable.notify(),e}entries(){return(0,i.gc)(this._observable),this._map.entries()}forEach(t,e){(0,i.gc)(this._observable),this._map.forEach(((s,i)=>t.call(e,s,i,this)),e)}get(t){return(0,i.gc)(this._observable),this._map.get(t)}has(t){return(0,i.gc)(this._observable),this._map.has(t)}keys(){return(0,i.gc)(this._observable),this._map.keys()}set(t,e){return this._map.set(t,e),this._observable.notify(),this}values(){return(0,i.gc)(this._observable),this._map.values()}[Symbol.iterator](){return(0,i.gc)(this._observable),this._map[Symbol.iterator]()}[Symbol.dispose](){this._observable.destroy()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}},60999:(t,e,s)=>{s.d(e,{DZ:()=>p,Ke:()=>_,Tj:()=>l,UT:()=>f,jJ:()=>c});var i=s(90237),r=s(69622),n=s(97768),o=s(74887),a=s(10107),h=s(40608);function c(t,e,s){return(0,o.Lx)(t.map(((t,i)=>e.apply(s,[t,i]))))}async function l(t,e,s){return(await(0,o.Lx)(t.map(((t,i)=>e.apply(s,[t,i]))))).map((t=>t.value))}function u(t){return{ok:!0,value:t}}function d(t){return{ok:!1,error:t}}async function _(t){if(null==t)return{ok:!1,error:new Error("no promise provided")};try{return u(await t)}catch(t){return d(t)}}async function p(t){try{return u(await t)}catch(t){return(0,o.QP)(t),d(t)}}function f(t,e){return new g(t,e)}let g=class extends r.A{get value(){return null!=(t=this._result)&&!0===t.ok?t.value:null;var t}get error(){return null!=(t=this._result)&&!1===t.ok?t.error:null;var t}get finished(){return null!=this._result}constructor(t,e){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,n.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:s}=this._abortController;this.promise=t(s),this.promise.then((t=>{this._result=u(t),this._cleanup()}),(t=>{this._result=d(t),this._cleanup()})),this._abortHandle=(0,o.u7)(e,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,n.xt)(this._abortHandle),this._abortController=null}};(0,i._)([(0,a.MZ)()],g.prototype,"value",null),(0,i._)([(0,a.MZ)()],g.prototype,"error",null),(0,i._)([(0,a.MZ)()],g.prototype,"finished",null),(0,i._)([(0,a.MZ)()],g.prototype,"promise",void 0),(0,i._)([(0,a.MZ)()],g.prototype,"_result",void 0),g=(0,i._)([(0,h.$)("esri.core.asyncUtils.ReactiveTask")],g)},40804:(t,e,s)=>{s.d(e,{U:()=>r});var i=s(34727);function r(t,e,s=0){const r=(0,i.qE)(t,0,a);for(let t=0;t<4;t++)e[s+t]=Math.floor(256*h(r*n[t]))}const n=[1,256,65536,16777216],o=[1/256,1/65536,1/16777216,1/4294967296],a=function(t,e=0){let s=0;for(let i=0;i<4;i++)s+=t[e+i]*o[i];return s}(new Uint8ClampedArray([255,255,255,255]));function h(t){return t-Math.floor(t)}},88340:(t,e,s)=>{function i(){return new Float32Array(2)}function r(t,e){const s=new Float32Array(2);return s[0]=t,s[1]=e,s}function n(){return i()}function o(){return r(1,1)}function a(){return r(1,0)}function h(){return r(0,1)}s.d(e,{Un:()=>l,fA:()=>r,uY:()=>c,vt:()=>i});const c=n(),l=o(),u=a(),d=h();Object.freeze(Object.defineProperty({__proto__:null,ONES:l,UNIT_X:u,UNIT_Y:d,ZEROS:c,clone:function(t){const e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e},create:i,createView:function(t,e){return new Float32Array(t,e,2)},fromValues:r,ones:o,unitX:a,unitY:h,zeros:n},Symbol.toStringTag,{value:"Module"}))},48163:(t,e,s)=>{function i(){return[0,0]}function r(t,e){return[t,e]}function n(){return r(1,1)}function o(){return r(1,0)}function a(){return r(0,1)}s.d(e,{Un:()=>h,fA:()=>r,vt:()=>i});const h=n(),c=o(),l=a();Object.freeze(Object.defineProperty({__proto__:null,ONES:h,UNIT_X:c,UNIT_Y:l,ZEROS:[0,0],clone:function(t){return[t[0],t[1]]},create:i,createView:function(t,e){return new Float64Array(t,e,2)},freeze:function(t,e){return[t,e]},fromArray:function(t,e=[0,0]){const s=Math.min(2,t.length);for(let i=0;i<s;++i)e[i]=t[i];return e},fromValues:r,ones:n,unitX:o,unitY:a,zeros:function(){return[0,0]}},Symbol.toStringTag,{value:"Module"}))},37585:(t,e,s)=>{s.d(e,{C:()=>r,Cc:()=>g,Io:()=>u,S8:()=>f,WQ:()=>o,e$:()=>y,hZ:()=>n,hs:()=>l,jb:()=>x,l0:()=>m,t2:()=>b});var i=s(34304);function r(t,e){return t[0]=e[0],t[1]=e[1],t}function n(t,e,s){return t[0]=e,t[1]=s,t}function o(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t}function a(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function h(t,e,s){return t[0]=e[0]*s[0],t[1]=e[1]*s[1],t}function c(t,e,s){return t[0]=e[0]/s[0],t[1]=e[1]/s[1],t}function l(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t}function u(t,e){const s=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(s*s+i*i)}function d(t,e){const s=e[0]-t[0],i=e[1]-t[1];return s*s+i*i}function _(t){const e=t[0],s=t[1];return Math.sqrt(e*e+s*s)}function p(t){const e=t[0],s=t[1];return e*e+s*s}function f(t,e){const s=e[0],i=e[1];let r=s*s+i*i;return r>0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t}function g(t,e,s,i){const r=e[0],n=e[1];return t[0]=r+i*(s[0]-r),t[1]=n+i*(s[1]-n),t}function m(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[2]*r+s[4],t[1]=s[1]*i+s[3]*r+s[5],t}function y(t,e,s,i){const r=e[0]-s[0],n=e[1]-s[1],o=Math.sin(i),a=Math.cos(i);return t[0]=r*a-n*o+s[0],t[1]=r*o+n*a+s[1],t}function b(t,e){return t[0]===e[0]&&t[1]===e[1]}const w=_,x=a,v=h,I=c,S=u,P=d,M=p;Object.freeze(Object.defineProperty({__proto__:null,add:o,angle:function(t,e){const s=t[0],i=t[1],r=e[0],n=e[1];let o=s*s+i*i;o>0&&(o=1/Math.sqrt(o));let a=r*r+n*n;a>0&&(a=1/Math.sqrt(a));const h=(s*r+i*n)*o*a;return h>1?0:h<-1?Math.PI:Math.acos(h)},ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},copy:r,cross:function(t,e,s){const i=e[0]*s[1]-e[1]*s[0];return t[0]=t[1]=0,t[2]=i,t},dist:S,distance:u,div:I,divide:c,dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},equals:function(t,e){const s=t[0],r=t[1],n=e[0],o=e[1],a=(0,i.FD)();return Math.abs(s-n)<=a*Math.max(1,Math.abs(s),Math.abs(n))&&Math.abs(r-o)<=a*Math.max(1,Math.abs(r),Math.abs(o))},exactEquals:b,floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},inverse:function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},len:w,length:_,lerp:g,max:function(t,e,s){return t[0]=Math.max(e[0],s[0]),t[1]=Math.max(e[1],s[1]),t},min:function(t,e,s){return t[0]=Math.min(e[0],s[0]),t[1]=Math.min(e[1],s[1]),t},mul:v,multiply:h,negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},normalize:f,projectAndScale:function(t,e,s,i,r){let n=e[0]-s[0],o=e[1]-s[1];const a=(i[0]*n+i[1]*o)*(r-1);return n=i[0]*a,o=i[1]*a,t[0]=e[0]+n,t[1]=e[1]+o,t},random:function(t,e=1){const s=2*(0,i.Ov)()*Math.PI;return t[0]=Math.cos(s)*e,t[1]=Math.sin(s)*e,t},rotate:y,round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},scale:l,scaleAndAdd:function(t,e,s,i){return t[0]=e[0]+s[0]*i,t[1]=e[1]+s[1]*i,t},set:n,sqrDist:P,sqrLen:M,squaredDistance:d,squaredLength:p,str:function(t){return"vec2("+t[0]+", "+t[1]+")"},sub:x,subtract:a,transformMat2:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[2]*r,t[1]=s[1]*i+s[3]*r,t},transformMat2d:m,transformMat3:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[3]*r+s[6],t[1]=s[1]*i+s[4]*r+s[7],t},transformMat4:function(t,e,s){const i=e[0],r=e[1];return t[0]=s[0]*i+s[4]*r+s[12],t[1]=s[1]*i+s[5]*r+s[13],t}},Symbol.toStringTag,{value:"Module"}))},10382:(t,e,s)=>{s.d(e,{A:()=>c});var i=s(36563),r=(s(44208),s(74887)),n=s(9775),o=s(72457),a=s(52268),h=s(61322);class c{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new n.A}destroy(){this.close()}get closed(){return!this._clients?.length}open(t,e){return new Promise(((s,i)=>{let n=!0;const o=t=>{(0,r.Te)(e.signal),n&&(n=!1,t())};this._clients.length=t.length,this._clientPromises.length=t.length,this._inUseClients.length=t.length;for(let n=0;n<t.length;++n){const a=t[n];(0,r.$X)(a)?this._clientPromises[n]=a.then((t=>(this._clients[n]=new h.default(t,e,this._ongoingJobsQueue),o(s),this._clients[n])),(()=>(o(i),null))):(this._clients[n]=new h.default(a,e,this._ongoingJobsQueue),this._clientPromises[n]=Promise.resolve(this._clients[n]),o(s))}}))}broadcast(t,e,s){const i=new Array(this._clientPromises.length);for(let r=0;r<this._clientPromises.length;++r){const n=this._clientPromises[r];i[r]=n.then((i=>i?.invoke(t,e,s)))}return i}close(){let t;for(;t=this._ongoingJobsQueue.pop();)t.resolver.reject((0,r.NK)(`Worker closing, aborting job calling '${t.methodName}'`));for(const t of this._clientPromises)t.then((t=>t?.close()));this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,(0,o.h)(this)}invoke(t,e,s){return this.apply(t,[e],s)}apply(t,e,s){const i=(0,r.Tw)();this._ongoingJobsQueue.push({methodName:t,data:e,invokeOptions:s,resolver:i});for(let t=0;t<this._clientPromises.length;t++){const e=this._clients[t];e?e.jobAdded():this._clientPromises[t].then((t=>t?.jobAdded()))}return i.promise}createInvokeProxy(t){return(0,a.L)(this,t)}on(t,e){return Promise.all(this._clientPromises).then((()=>(0,i.vE)(this._clients.map((s=>s.on(t,e))))))}openPorts(){return new Promise((t=>{const e=new Array(this._clientPromises.length);let s=e.length;for(let i=0;i<this._clientPromises.length;++i)this._clientPromises[i].then((r=>{r&&(e[i]=r.openPort()),0==--s&&t(e)}))}))}get test(){}}},72457:(t,e,s)=>{s.d(e,{h:()=>n,k:()=>r});const i=new FinalizationRegistry((t=>{t.close()}));function r(t,e){i.register(t,e,e)}function n(t){i.unregister(t)}},77085:(t,e,s)=>{s.d(e,{Hh:()=>a,fz:()=>l,g7:()=>h,s1:()=>o,zo:()=>c});var i=s(76061),r=s(83290);let n;function o(){return!!n&&(0,r.i)()}async function a(){if(!o()){const[t,e]=await Promise.all([Promise.all([s.e(1878),s.e(2189),s.e(1088)]).then(s.bind(s,31088)),Promise.all([s.e(1878),s.e(2189)]).then(s.bind(s,12189)).then((t=>t.aG)).then((({injectPe:t})=>t)),(0,r.l)()]);n=new t.OperatorGeodeticDensifyByLength,e(r.p)}}function h(t,e,s,i){return n.execute(t,e,s,i,null)}function c(t,e,s,r){const o=n.executeMany(new i.S(t),e,s,r,null);return Array.from(o)}function l(){return n.supportsCurves()}},5808:(t,e,s)=>{s.d(e,{O:()=>i});const i={geodesic:0,loxodrome:1,"great-elliptic":2,"normal-section":3,"shape-preserving":4}},89056:(t,e,s)=>{s.d(e,{b3:()=>u,jZ:()=>l});var i=s(25482),r=s(19419),n=s(537),o=s(95108),a=s(65864),h=s(80754),c=s(21325);function l(t){return d(t,!0)}function u(t){return d(t,!1)}function d(t,e){if(null==t)return null;const s=t.spatialReference,r=(0,c.Vp)(s),o=i.A.isSerializable(t)?t.toJSON():t;if(!r)return o;const l=(0,c.K8)(s)?102100:4326,u=h.j7[l].maxX,d=h.j7[l].minX;if((0,a.fT)(o))return p(o,u,d);if((0,a.U9)(o))return o.points=o.points.map((t=>p(t,u,d))),o;if((0,a.ZC)(o))return _(o,r);if((0,a.Bi)(o)||(0,a.Rg)(o)){const t=(0,n.Rg)(w,o),s={xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]},i=(0,h.kd)(s.xmin,d)*(2*u),r=0===i?o:(0,h.kS)(o,i);return s.xmin+=i,s.xmax+=i,s.xmax>u?y(r,u,e):s.xmin<d?y(r,d,e):r}return o}function _(t,e){if(!e)return t;const s=function(t,e){const s=[],{ymin:i,ymax:r,xmin:n,xmax:o}=t,a=t.xmax-t.xmin,[h,c]=e.valid,{x:l,frameId:u}=f(t.xmin,e),{x:d,frameId:_}=f(t.xmax,e),p=l===d&&a>0;if(a>2*c){const t={xmin:n<o?l:d,ymin:i,xmax:c,ymax:r},e={xmin:h,ymin:i,xmax:n<o?d:l,ymax:r},a={xmin:0,ymin:i,xmax:c,ymax:r},p={xmin:h,ymin:i,xmax:0,ymax:r},f=[],m=[];g(t,a)&&f.push(u),g(t,p)&&m.push(u),g(e,a)&&f.push(_),g(e,p)&&m.push(_);for(let t=u+1;t<_;t++)f.push(t),m.push(t);s.push(new b(t,[u]),new b(e,[_]),new b(a,f),new b(p,m))}else l>d||p?s.push(new b({xmin:l,ymin:i,xmax:c,ymax:r},[u]),new b({xmin:h,ymin:i,xmax:d,ymax:r},[_])):s.push(new b({xmin:l,ymin:i,xmax:d,ymax:r},[u]));return s}(t,e).map((t=>t.extent));return s.length<2?s[0]||t:s.length>2?(t.xmin=e.valid[0],t.xmax=e.valid[1],t):{rings:s.map((t=>[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]))}}function p(t,e,s){if(Array.isArray(t)){const i=t[0];if(i>e){const s=(0,h.kd)(i,e);t[0]=i+s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t[0]=i+e*(-2*s)}}else{const i=t.x;if(i>e){const s=(0,h.kd)(i,e);t.x+=s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t.x+=e*(-2*s)}}return t}function f(t,e){const[s,i]=e.valid,r=2*i;let n,o=0;return t>i?(n=Math.ceil(Math.abs(t-i)/r),t-=n*r,o=n):t<s&&(n=Math.ceil(Math.abs(t-s)/r),t+=n*r,o=-n),{x:t,frameId:o}}function g(t,e){const{xmin:s,ymin:i,xmax:r,ymax:n}=e;return m(t,s,i)&&m(t,s,n)&&m(t,r,n)&&m(t,r,i)}function m(t,e,s){return e>=t.xmin&&e<=t.xmax&&s>=t.ymin&&s<=t.ymax}function y(t,e,s=!0){const i=!(0,a.Rg)(t);if(i&&(0,o.m3)(t),s)return(new x).cut(t,e);const r=i?t.rings:t.paths,n=i?4:2,h=r.length,c=-2*e;for(let t=0;t<h;t++){const e=r[t];if(e&&e.length>=n){const t=[];for(const s of e)t.push([s[0]+c,s[1]]);r.push(t)}}return i?t.rings=r:t.paths=r,t}class b{constructor(t,e){this.extent=t,this.frameIds=e}}const w=(0,r.vt)();class x{constructor(){this._linesIn=[],this._linesOut=[]}cut(t,e){let s;if(this._xCut=e,t.rings)this._closed=!0,s=t.rings,this._minPts=4;else{if(!t.paths)return null;this._closed=!1,s=t.paths,this._minPts=2}for(const t of s){if(!t||t.length<this._minPts)continue;let e=!0;for(const s of t)e?(this.moveTo(s),e=!1):this.lineTo(s);this._closed&&this.close()}this._pushLineIn(),this._pushLineOut(),s=[];for(const t of this._linesIn)t&&t.length>=this._minPts&&s.push(t);const i=-2*this._xCut;for(const t of this._linesOut)if(t&&t.length>=this._minPts){for(const e of t)e[0]+=i;s.push(t)}return this._closed?t.rings=s:t.paths=s,t}moveTo(t){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(t[0]),this._moveTo(t[0],t[1],this._prevSide),this._prevPt=t,this._firstPt=t}lineTo(t){const e=this._side(t[0]);if(e*this._prevSide==-1){const s=this._intersect(this._prevPt,t);this._lineTo(this._xCut,s,0),this._prevSide=0,this._lineTo(t[0],t[1],e)}else this._lineTo(t[0],t[1],e);this._prevSide=e,this._prevPt=t}close(){const t=this._firstPt,e=this._prevPt;t[0]===e[0]&&t[1]===e[1]||this.lineTo(t),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(t,e,s){this._closed?(this._lineIn.push([s<=0?t:this._xCut,e]),this._lineOut.push([s>=0?t:this._xCut,e])):(s<=0&&this._lineIn.push([t,e]),s>=0&&this._lineOut.push([t,e]))}_lineTo(t,e,s){this._closed?(v(this._lineIn,s<=0?t:this._xCut,e),v(this._lineOut,s>=0?t:this._xCut,e)):s<0?(0===this._prevSide&&this._pushLineOut(),this._lineIn.push([t,e])):s>0?(0===this._prevSide&&this._pushLineIn(),this._lineOut.push([t,e])):this._prevSide<0?(this._lineIn.push([t,e]),this._lineOut.push([t,e])):this._prevSide>0&&(this._lineOut.push([t,e]),this._lineIn.push([t,e]))}_checkClosingPt(t){const e=t.length;e>3&&t[0][0]===this._xCut&&t[e-2][0]===this._xCut&&t[1][0]===this._xCut&&(t[0][1]=t[e-2][1],t.pop())}_side(t){return t<this._xCut?-1:t>this._xCut?1:0}_intersect(t,e){const s=(this._xCut-t[0])/(e[0]-t[0]);return t[1]+s*(e[1]-t[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}function v(t,e,s){const i=t.length;i>1&&t[i-1][0]===e&&t[i-2][0]===e?t[i-1][1]=s:t.push([e,s])}},18047:(t,e,s)=>{s.d(e,{ZV:()=>h,yx:()=>a});var i=s(73444);const r={ar:"ar-u-nu-latn"};let n=new WeakMap,o={};function a(t={}){const e={};return null!=t.digitSeparator&&(e.useGrouping=t.digitSeparator),null!=t.places&&(e.minimumFractionDigits=e.maximumFractionDigits=t.places),e}function h(t,e){return Object.is(t,-0)&&(t=0),function(t){const e=t||o;if(!n.has(e)){const s=(0,i.JK)(),o=r[(0,i.JK)()]||s;n.set(e,new Intl.NumberFormat(o,t))}return n.get(e)}(e).format(t)}(0,i.Ml)((()=>{n=new WeakMap,o={}})),new Map},37730:(t,e,s)=>{s.d(e,{T:()=>r});var i=s(43334);const r={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,e)=>new i.Om(e,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(t,e)=>t.ensureCentroid(e)}},30624:(t,e,s)=>{s.r(e),s.d(e,{createConnection:()=>k});var i=s(90237),r=s(78888),n=s(49186),o=s(53966),a=s(74887),h=s(84952),c=(s(44208),s(87811),s(40608)),l=s(16930),u=s(65864),d=s(10107),_=s(62815),p=s(65529);let f=class extends p.A.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.A("stream-connection",this.errorString):null}onFeature(t){this.emit("data-received",t)}onMessage(t){this.emit("message-received",t)}};(0,i._)([(0,d.MZ)({readOnly:!0})],f.prototype,"connectionError",null),f=(0,i._)([(0,c.$)("esri.layers.support.StreamConnection")],f);const g=f;var m,y;(y=m||(m={}))[y.CONNECTING=0]="CONNECTING",y[y.OPEN=1]="OPEN",y[y.CLOSING=2]="CLOSING",y[y.CLOSED=3]="CLOSED";let b=class extends g{constructor(t){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._config=t,this._featureZScaler=(0,_.N)(e,i,s),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case m.CONNECTING:case m.OPEN:return"connected";case m.CLOSING:case m.CLOSED:return"disconnected"}}sendMessageToSocket(t){null!=this._websocket?this._websocket.send(JSON.stringify(t)):this._outstandingMessages.push(t)}sendMessageToClient(t){this._onMessage(t)}updateCustomParameters(t){this._config.customParameters=t,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(t=this._config.source.path,e=1e3,s=0){try{if(this.destroyed)return;const e=(0,h.a6)(t,this._config.customParameters??{});this._websocket=await this._createWebSocket(e),this.notifyChange("connectionStatus")}catch(i){const r=e/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(o.A.getLogger(this).error(new n.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.A.getLogger(this).error(new n.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${r}s`,i)),await(0,a.Pl)(e),this._tryCreateWebSocket(t,Math.min(1.5*e,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(t){t.onmessage=t=>{try{const e=JSON.parse(t.data);this._onMessage(e)}catch(t){return void o.A.getLogger(this).error(new n.A("websocket-connection","Failed to parse message, invalid JSON",{error:t}))}}}_createWebSocket(t){return new Promise(((e,s)=>{const i=new WebSocket(t);i.onopen=()=>{if(i.onopen=null,this.destroyed)return i.onclose=null,void i.close();i.onclose=t=>this._onClose(t),i.onerror=t=>this._onError(t),this._setWebSocketJSONParseHandler(i),e(i)},i.onclose=t=>{i.onopen=i.onclose=null,s(t)}}))}async _handshake(t=1e4){const e=this._websocket;if(null==e)return;const s=(0,a.Tw)(),i=e.onmessage,{filter:r,outFields:h,spatialReference:c}=this._config;return s.timeout(t),e.onmessage=t=>{let a=null;try{a=JSON.parse(t.data)}catch(t){}a&&"object"==typeof a||(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - malformed message",t.data)),s.reject(),this.destroy()),a.spatialReference?.wkid!==c?.wkid&&(o.A.getLogger(this).error(new n.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${c.wkid}`,t.data)),s.reject(),this.destroy()),"json"!==a.format&&(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - format is not set",t.data)),s.reject(),this.destroy()),r&&a.filter!==r&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set filter, but server doesn't support it")),h&&a.outFields!==h&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set outFields, but server doesn't support it")),e.onmessage=i;for(const t of this._outstandingMessages)e.send(JSON.stringify(t));this._outstandingMessages=[],s.resolve()},e.send(JSON.stringify({filter:r,outFields:h,format:"json",spatialReference:{wkid:c.wkid}})),s.promise}_onMessage(t){if(this.onMessage(t),"type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}}_onError(t){const e="Encountered an error over WebSocket connection";this._set("errorString",e),o.A.getLogger(this).error("websocket-connection",e)}_onClose(t){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==t.code&&o.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${t.code}`),this.destroyed||this._open()}};(0,i._)([(0,d.MZ)()],b.prototype,"connectionStatus",null),(0,i._)([(0,d.MZ)()],b.prototype,"errorString",void 0),b=(0,i._)([(0,c.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],b);var w=s(80893),x=s(61956);const v={maxQueryDepth:5,maxRecordCountFactor:3};let I=class extends b{constructor(t){super({...v,...t}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const t=await this._fetchServiceDefinition(this._config.source);t.timeInfo.trackIdField||o.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const e=this._fetchWebSocketUrl(t.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(e);const{filter:s,outFields:i}=this._config;this.destroyed||this._setFilter(s,i)}_onMessage(t){if("attributes"in t){let e;try{e=this._enrich(t),null!=this._featureZScaler&&this._featureZScaler(e.geometry)}catch(t){return void o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to parse message",t))}this.onFeature(e)}else this.onMessage(t)}async _fetchServiceDefinition(t){const e={f:"json",...this._config.customParameters},s=(0,r.A)(t.path,{query:e,responseType:"json"}),i=(await s).data;return this._serviceDefinition=i,i}_fetchWebSocketUrl(t,e){const s=t[0],{urls:i,token:r}=s,n=this._inferWebSocketBaseUrl(i);return(0,h.a6)(`${n}/subscribe`,{outSR:""+e.wkid,token:r})}_inferWebSocketBaseUrl(t){if(1===t.length)return t[0];for(const e of t)if(e.includes("wss"))return e;return o.A.getLogger(this).error(new n.A("geoevent-connection","Unable to infer WebSocket url",t)),null}async _setFilter(t,e){const s=this._websocket;if(null==s||null==t&&null==e)return;const i=JSON.stringify({filter:this._serializeFilter(t,e)});let r=!1;const h=(0,a.Tw)();return s.onmessage=t=>{const e=JSON.parse(t.data);e.filter&&(e.error&&(o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to set service filter",e.error)),this._set("errorString",`Could not set service filter - ${e.error}`),h.reject(e.error)),this._setWebSocketJSONParseHandler(s),r=!0,h.resolve())},s.send(i),setTimeout((()=>{r||(this.destroyed||this._websocket!==s||o.A.getLogger(this).error(new n.A("geoevent-connection","Server timed out when setting filter")),h.reject())}),1e4),h.promise}_serializeFilter(t,e){const s={};if(null==t&&null==e)return s;if(t?.geometry)try{const e=(0,u.rS)(t.geometry);if("extent"!==e.type)throw new n.A(`Expected extent but found type ${e.type}`);s.geometry=JSON.stringify(e.shiftCentralMeridian())}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",t))}return t?.where&&"1 = 1"!==t.where&&"1=1"!==t.where&&(s.where=t.where),null!=e&&(s.outFields=e.join(",")),s}_enrich(t){if(!this._relatedFeatures)return t;const e=this._serviceDefinition.relatedFeatures.joinField,s=t.attributes[e],i=this._relatedFeatures.get(s);if(!i)return o.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",t),t;const{attributes:r,geometry:a}=i;for(const e in r)t.attributes[e]=r[e];return a&&(t.geometry=a),t.geometry||t.centroid||o.A.getLogger(this).error(new n.A("geoevent-connection","Found malformed feature - no geometry found",t)),t}async _queryBuddyServices(){try{const{relatedFeatures:t,keepLatestArchive:e}=this._serviceDefinition,s=this._queryRelatedFeatures(t),i=this._queryArchive(e);await s;const r=await i;if(!r)return;for(const t of r.features)this.onFeature(this._enrich(t))}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when querying buddy services",{error:t}))}}async _queryRelatedFeatures(t){if(!t)return;const e=await this._queryBuddy(t.featuresUrl);this._addRelatedFeatures(e)}async _queryArchive(t){if(t)return this._queryBuddy(t.featuresUrl)}async _queryBuddy(t){const e=new((await Promise.all([s.e(6131),s.e(8219),s.e(8948),s.e(2106),s.e(13),s.e(3112),s.e(9953),s.e(4796),s.e(3029),s.e(4111),s.e(8506),s.e(3600),s.e(812),s.e(655),s.e(52)]).then(s.bind(s,13600))).default)({url:t}),{capabilities:i}=await e.load(),r=i.query.supportsMaxRecordCountFactor,n=i.query.supportsPagination,o=i.query.supportsCentroid,a=this._config.maxRecordCountFactor,h=e.capabilities.query.maxRecordCount,c=r?h*a:h,u=new x.A;if(u.outFields=this._config.outFields??["*"],u.where=this._config.filter?.where??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=l.A.fromJSON(this._config.spatialReference),o&&(u.returnCentroid=!0),r&&(u.maxRecordCountFactor=a),n)return u.num=c,e.destroy(),this._queryPages(t,u);const d=await(0,w.eW)(t,u,this._config.sourceSpatialReference);return e.destroy(),d.data}async _queryPages(t,e,s=[],i=0){e.start=null!=e.num?i*e.num:null;const{data:r}=await(0,w.eW)(t,e,this._config.sourceSpatialReference);return r.exceededTransferLimit&&i<(this._config.maxQueryDepth??0)?(r.features.forEach((t=>s.push(t))),this._queryPages(t,e,s,i+1)):(s.forEach((t=>r.features.push(t))),r)}_addRelatedFeatures(t){const e=new Map,s=t.features,i=this._serviceDefinition.relatedFeatures.joinField;for(const t of s){const s=t.attributes[i];e.set(s,t)}this._relatedFeatures=e}};I=(0,i._)([(0,c.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],I);const S=I;let P=class extends g{constructor(t){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._featureZScaler=(0,_.N)(e,i,s)}normalizeCtorArgs(){return{}}updateCustomParameters(t){}sendMessageToSocket(t){}sendMessageToClient(t){if("type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}this.onMessage(t)}};function M(t,e){if(null==t&&null==e)return null;const s={};return null!=e&&(s.geometry=e),null!=t&&(s.where=t),s}function k(t,e,s,i,r,n,o,a,h){const c={source:t,sourceSpatialReference:e,spatialReference:s,geometryType:i,filter:M(r,n),maxReconnectionAttempts:o,maxReconnectionInterval:a,customParameters:h};return t?t.path.startsWith("wss://")||t.path.startsWith("ws://")?new b(c):new S(c):new P(c)}(0,i._)([(0,d.MZ)()],P.prototype,"connectionStatus",void 0),(0,i._)([(0,d.MZ)()],P.prototype,"errorString",void 0),P=(0,i._)([(0,c.$)("esri.layers.support.ClientSideConnection")],P)},72691:(t,e,s)=>{s.d(e,{Aw:()=>o,DN:()=>i,EA:()=>n,Gm:()=>r,t0:()=>h,xq:()=>a});const i="__esri_stream_id__",r="__esri_timestamp__",n="__esri_track_part__",o="__esri_time_received__",a="__esri_track_line__";var h;!function(t){t[t.TrackLine=0]="TrackLine",t[t.LatestObservation=1]="LatestObservation",t[t.PreviousObservation=2]="PreviousObservation"}(h||(h={}))},93705:(t,e,s)=>{s.r(e),s.d(e,{default:()=>Cu});var i=s(49186),r=s(36563),n=s(44208),o=s(26390),a=s(74887),h=s(87811),c=s(36708),l=s(90629),u=s(8341),d=s(87045),_=s(76213);class p{constructor(t){this._client=t,this.layerView=this._client.createInvokeProxy(""),this.container=this._client.createInvokeProxy("container"),this._eventLog=this._client.createInvokeProxy("eventLog")}onEvent(t){(0,u.oV)(this._eventLog.onEvent(t))}}var f=s(97768),g=s(93637),m=s(6797),y=s(16930),b=s(21325),w=s(44159);function x(t,e){return[t,e]}function v(t,e,s){return t[0]=e,t[1]=s,t}const I=new w.A("0/0/0/0");class S{static create(t,e,s=null){const i=(0,b.Vp)(t.spatialReference),r=e.origin||x(t.origin.x,t.origin.y),n=x(t.size[0]*e.resolution,t.size[1]*e.resolution),o=x(-1/0,-1/0),a=x(1/0,1/0),h=x(1/0,1/0);null!=s&&(v(o,Math.max(0,Math.floor((s.xmin-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymax)/n[1]))),v(a,Math.max(0,Math.floor((s.xmax-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymin)/n[1]))),v(h,a[0]-o[0]+1,a[1]-o[1]+1));const{cols:c,rows:l}=e;let u,d,_,p;return!s&&c&&l&&(v(o,c[0],l[0]),v(a,c[1],l[1]),v(h,c[1]-c[0]+1,l[1]-l[0]+1)),t.isWrappable?(u=x(Math.ceil(Math.round((i.valid[1]-i.valid[0])/e.resolution)/t.size[0]),h[1]),d=!0,_=i.origin,p=i.valid):(u=h,d=!1),new S(e.level,e.resolution,e.scale,r,o,a,h,n,u,d,_,p)}constructor(t,e,s,i,r,n,o,a,h,c,l,u){this.level=t,this.resolution=e,this.scale=s,this.origin=i,this.first=r,this.last=n,this.size=o,this.norm=a,this.worldSize=h,this.wrap=c,this._spatialReferenceOrigin=l,this._spatialReferenceValid=u}normalizeCol(t){if(!this.wrap)return t;const e=this.worldSize[0];return t<0?e-1-Math.abs((t+1)%e):t%e}normalizeKey(t){if(!this.wrap)return;const e=this.worldSize[0],s=t.col;s<0?(t.col=s+e,t.world-=1):s>=e&&(t.col=s-e,t.world+=1)}denormalizeCol(t,e){return this.wrap?this.worldSize[0]*e+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){const e=this.origin[0]+t*this.norm[0],s=this._spatialReferenceOrigin,i=this._spatialReferenceValid;return this.wrap&&s&&i?e===s[0]?i[0]:this.origin[0]===s[0]&&t===this.worldSize[0]?i[1]:e:e}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,e,s=!1){I.set(e);const i=s?I.col:this.denormalizeCol(I.col,I.world),r=I.row;return function(t,e,s,i,r){t[0]=e,t[1]=s,t[2]=i,t[3]=r}(t,this.getXForColumn(i),this.getYForRow(r+1),this.getXForColumn(i+1),this.getYForRow(r)),t}getTileCoords(t,e,s=!1){I.set(e);const i=s?I.col:this.denormalizeCol(I.col,I.world);return Array.isArray(t)?v(t,this.getXForColumn(i),this.getYForRow(I.row)):(t.x=this.getXForColumn(i),t.y=this.getYForRow(I.row)),t}}var P=s(93687);class M{constructor(){this.spans=[]}acquire(t){this.lodInfo=t}release(){this.lodInfo=null,this.spans.length=0}*keys(){const t=this.lodInfo;for(const{row:e,colFrom:s,colTo:i}of this.spans)for(let r=s;r<=i;r++){const s=t.getWorldForColumn(r);yield new w.A(t.level,e,t.normalizeCol(r),s)}}forEach(t,e){const{spans:s,lodInfo:i}=this,{level:r}=i;if(0!==s.length)for(const{row:n,colFrom:o,colTo:a}of s)for(let s=o;s<=a;s++)t.call(e,r,n,i.normalizeCol(s),i.getWorldForColumn(s))}}M.pool=new P.A(M);class k{constructor(t,e,s){this.row=t,this.colFrom=e,this.colTo=s}}const A=new w.A("0/0/0/0");class T{static create(t,e){t[1]>e[1]&&([t,e]=[e,t]);const[s,i]=t,[r,n]=e,o=r-s,a=n-i,h=0!==a?o/a:0,c=(Math.ceil(i)-i)*h,l=(Math.floor(i)-i)*h;return new T(s,Math.floor(i),Math.ceil(n),h,o<0?c:l,o<0?l:c,o<0?r:s,o<0?s:r)}constructor(t,e,s,i,r,n,o,a){this.x=t,this.ymin=e,this.ymax=s,this.invM=i,this.leftAdjust=r,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const C=[[0,0],[0,0],[0,0],[0,0]];class F{constructor(t,e=null,s=t.lods[0].level,i=t.lods[t.lods.length-1].level){this.tileInfo=t,this.fullExtent=e,this.scales=[],this._infoByScale={},this._infoByLevel={};const r=t.lods.filter((t=>t.level>=s&&t.level<=i));this.minScale=r[0].scale,this.maxScale=r[r.length-1].scale;const n=this._lodInfos=r.map((s=>S.create(t,s,e)));r.forEach(((t,e)=>{this._infoByLevel[t.level]=n[e],this._infoByScale[t.scale]=n[e],this.scales[e]=t.scale}),this),this._wrap=t.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(t){return this._infoByLevel["number"==typeof t?t:t.level]}getTileBounds(t,e,s=!1){A.set(e);const i=this._infoByLevel[A.level];return i?i.getTileBounds(t,A,s):t}getTileCoords(t,e,s=!1){A.set(e);const i=this._infoByLevel[A.level];return i?i.getTileCoords(t,A,s):t}getTileCoverage(t,e=192,s=!0,i="closest"){if(!s&&(t.scale>this.minScale||t.scale<this.maxScale))return null;const r="closest"===i?this.getClosestInfoForScale(t.scale):this.getSmallestInfoForScale(t.scale),n=M.pool.acquire(r),o=this._wrap;let a,h,c,l=1/0,u=-1/0;const d=n.spans;C[0][0]=C[0][1]=C[1][1]=C[3][0]=-e,C[1][0]=C[2][0]=t.size[0]+e,C[2][1]=C[3][1]=t.size[1]+e;for(const e of C)t.toMap(e,e),e[0]=r.getColumnForX(e[0]),e[1]=r.getRowForY(e[1]);const _=[];let p=3;for(let t=0;t<4;t++){if(C[t][1]===C[p][1]){p=t;continue}const e=T.create(C[t],C[p]);l=Math.min(e.ymin,l),u=Math.max(e.ymax,u),void 0===_[e.ymin]&&(_[e.ymin]=[]),_[e.ymin].push(e),p=t}if(null==l||null==u||u-l>100)return null;let f=[];for(a=l;a<u;){null!=_[a]&&(f=f.concat(_[a])),h=1/0,c=-1/0;for(let t=f.length-1;t>=0;t--){const e=f[t];h=Math.min(h,e.getLeftCol()),c=Math.max(c,e.getRightCol())}if(h=Math.floor(h),c=Math.floor(c),a>=r.first[1]&&a<=r.last[1])if(o)if(r.size[0]<r.worldSize[0]){const t=Math.floor(c/r.worldSize[0]);for(let e=Math.floor(h/r.worldSize[0]);e<=t;e++)d.push(new k(a,Math.max(r.getFirstColumnForWorld(e),h),Math.min(r.getLastColumnForWorld(e),c)))}else d.push(new k(a,h,c));else h>r.last[0]||c<r.first[0]||(h=Math.max(h,r.first[0]),c=Math.min(c,r.last[0]),d.push(new k(a,h,c)));a+=1;for(let t=f.length-1;t>=0;t--){const e=f[t];e.ymax>=a?e.incrRow():f.splice(t,1)}}return n}getTileParentId(t){A.set(t);const e=this._infoByLevel[A.level],s=this._lodInfos.indexOf(e)-1;return s<0?null:(this._getTileIdAtLOD(A,this._lodInfos[s],A),A.id)}getTileResolution(t){const e=this._infoByLevel["object"==typeof t?t.level:t];return e?e.resolution:-1}getTileScale(t){const e=this._infoByLevel[t.level];return e?e.scale:-1}intersects(t,e){A.set(e);const s=this._infoByLevel[A.level],i=t.lodInfo;if(i.resolution>s.resolution){this._getTileIdAtLOD(A,i,A);const e=i.denormalizeCol(A.col,A.world);for(const s of t.spans)if(s.row===A.row&&s.colFrom<=e&&s.colTo>=e)return!0}if(i.resolution<s.resolution){const[e,r,n,o]=t.spans.reduce(((t,e)=>(t[0]=Math.min(t[0],e.row),t[1]=Math.max(t[1],e.row),t[2]=Math.min(t[2],e.colFrom),t[3]=Math.max(t[3],e.colTo),t)),[1/0,-1/0,1/0,-1/0]),a=s.denormalizeCol(A.col,A.world),h=i.getColumnForX(s.getXForColumn(a)),c=i.getRowForY(s.getYForRow(A.row)),l=i.getColumnForX(s.getXForColumn(a+1))-1,u=i.getRowForY(s.getYForRow(A.row+1))-1;return!(h>o||l<n||c>r||u<e)}const r=i.denormalizeCol(A.col,A.world);return t.spans.some((t=>t.row===A.row&&t.colFrom<=r&&t.colTo>=r))}normalizeBounds(t,e,s){if(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._wrap){const e=(0,b.Vp)(this.tileInfo.spatialReference),i=-s*(e.valid[1]-e.valid[0]);t[0]+=i,t[2]+=i}return t}getSmallestInfoForScale(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t];if(t>e[0])return this._infoByScale[e[0]];for(let s=1;s<e.length-1;s++)if(t>e[s]+1e-6)return this._infoByScale[e[s-1]];return this._infoByScale[e[e.length-1]]}getClosestInfoForScale(t){const e=this.scales;return this._infoByScale[t]||(t=e.reduce(((e,s)=>Math.abs(s-t)<Math.abs(e-t)?s:e),e[0])),this._infoByScale[t]}scaleToLevel(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t].level;for(let s=e.length-1;s>=0;s--)if(t<e[s])return s===e.length-1?this._infoByScale[e[e.length-1]].level:this._infoByScale[e[s]].level+(e[s]-t)/(e[s]-e[s+1]);return this._infoByScale[e[0]].level}scaleToZoom(t){return this.tileInfo.scaleToZoom(t)}zoomToScale(t){return this.tileInfo.zoomToScale(t)}_getTileIdAtLOD(t,e,s){const i=this._infoByLevel[s.level];return t.set(s),e.resolution<i.resolution?null:(e.resolution===i.resolution||(t.level=e.level,t.col=Math.floor(s.col*i.resolution/e.resolution+.01),t.row=Math.floor(s.row*i.resolution/e.resolution+.01)),t)}}var z=s(90237),O=s(69622),E=s(91869),R=s(3483),L=s(10107),D=s(53966),N=s(40608),B=s(37585),G=s(9775),q=s(32587),W=s(11932),Y=s(44794);class j{constructor(t,e){this.item=t,this.controller=e,this.promise=null}}class U{constructor(t){this._schedule=null,this._task=null,this._deferreds=new q.A,this._controllers=new q.A,this._processingItems=new q.A,this._pausedSignal=(0,Y.v)(!1),this.concurrency=1,t.concurrency&&(this.concurrency=t.concurrency),this._queue=new G.A(t.peeker),this.process=t.process;const e=t.scheduler;t.priority&&e&&(this._task=e.registerTask(t.priority,this))}destroy(){this.clear(),this._schedule=(0,f.xt)(this._schedule),this._task=(0,f.xt)(this._task)}get updating(){return!!this._task?.updating||this.running}get length(){return this._processingItems.size+this._queue.length}abort(t){const e=this._controllers.get(t);e&&e.abort()}clear(){this._queue.clear();const t=[];this._controllers.forEach((e=>t.push(e))),this._controllers.clear(),t.forEach((t=>t.abort())),this._processingItems.clear(),this._cancelNext()}forEach(t){this._deferreds.forEach(((e,s)=>t(s)))}get(t){const e=this._deferreds.get(t);return e?e.promise:void 0}isOngoing(t){return this._processingItems.has(t)}has(t){return this._deferreds.has(t)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(t,e){const s=this.get(t);if(s)return s;const i=new AbortController;let r=null;e&&(r=(0,a.u7)(e,(()=>i.abort())));const n=()=>{o.remove(),null!=r&&r.remove(),this._removeItem(t),this._queue.remove(t),this._scheduleNext()},o=(0,a.NY)(i.signal,(()=>{const e=this._processingItems.get(t);e&&e.controller.abort(),n(),h.reject((0,a.NK)())})),h=(0,a.Tw)();return this._deferreds.set(t,h),this._controllers.set(t,i),h.promise.then(n,n),this._queue.push(t),this._scheduleNext(),h.promise}last(){return this._queue.last()}lastPromise(){const t=this.last();return t?this.get(t):null}peek(){return this._queue.peek()}popLast(){const t=this._queue.popLast();return t&&(this._deferreds.get(t)?.reject((0,a.NK)()),this._removeItem(t)),t}reset(){const t=Array.from(this._processingItems.values());this._processingItems.clear();for(const e of t)this._queue.push(e.item),e.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const t=[];for(;this._queue.length;)t.push(this._queue.pop());return this.clear(),t}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(t){for(;!t.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),t.madeProgress()}_removeItem(t){this._deferreds.delete(t),this._controllers.delete(t),this._processingItems.delete(t)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,W._)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).resolve(e))}_processError(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).reject(e))}_canProcessFulfillment(t){return!!this._deferreds.get(t.item)&&this._processingItems.get(t.item)===t}_process(t){if(null==t)return;let e;const s=new AbortController,i=new j(t,s);this._processingItems.set(t,i);try{e=this.process(t,s.signal)}catch(t){this._processError(i,t)}(0,a.$X)(e)?(i.promise=e,e.then((t=>this._processResult(i,t)),(t=>this._processError(i,t)))):this._processResult(i,e)}get test(){}}const V=[0,0];let X=class extends O.A{constructor(t){super(t),this._keyToItem=new Map,this._tilesByScale=new Map,this.concurrency=6}initialize(){const{concurrency:t,process:e,scheduler:s,priority:i}=this;this._queue=new U({concurrency:t,scheduler:s,priority:i,process:(t,s)=>{const i=this._keyToItem.get(t);return e(i,{signal:s})},peeker:t=>this._peek(t)})}destroy(){this.clear(),this._queue=(0,f.pR)(this._queue)}get length(){return this._queue?this._queue.length:0}abort(t){const e="string"==typeof t?t:t.id;this._queue.abort(e)}clear(){this._queue.clear(),this._keyToItem.clear(),this._tilesByScale.clear()}has(t){return"string"==typeof t?this._keyToItem.has(t):this._keyToItem.has(t.id)}pause(){this._queue.pause()}push(t){const e=t.key.id;if(this._queue.has(e))return this._queue.get(e);const s=this._queue.push(e),i=this.tileInfoView.getTileScale(t.key),r=(0,E.tE)(this._tilesByScale,i,(()=>new Set)),n=()=>{r.delete(t.key),0===r.size&&this._tilesByScale.delete(i),this._keyToItem.delete(e)};return r.add(t.key),this._keyToItem.set(e,t),s.then(n,n),s}reset(){this._queue.reset()}resume(){this._queue.resume()}_peek(t){if(!this.state)return t.values().next().value;const e=new Set;for(const s of t)e.add(this._keyToItem.get(s).key);const s=this.state.scale;let i,r=Number.POSITIVE_INFINITY;for(const[t,n]of this._tilesByScale)if((0,R.bw)(n,(t=>e.has(t)))){const e=Math.abs(t-s);e<r&&(i=n,r=e)}return this._getClosestTileKey(i,t).id}_getClosestTileKey(t,e){const s=this.tileInfoView,i=this.state.center;let r,n=Number.POSITIVE_INFINITY;for(const o of t)if(e.has(o.id)){s.getTileCoords(V,o);const t=(0,B.Io)(V,i);t<n&&(n=t,r=o)}return r}};(0,z._)([(0,L.MZ)({constructOnly:!0})],X.prototype,"concurrency",void 0),(0,z._)([(0,L.MZ)({constructOnly:!0})],X.prototype,"priority",void 0),(0,z._)([(0,L.MZ)({constructOnly:!0})],X.prototype,"process",void 0),(0,z._)([(0,L.MZ)({constructOnly:!0})],X.prototype,"scheduler",void 0),(0,z._)([(0,L.MZ)()],X.prototype,"state",void 0),(0,z._)([(0,L.MZ)({constructOnly:!0})],X.prototype,"tileInfoView",void 0),X=(0,z._)([(0,N.$)("esri.views.2d.tiling.TileQueue")],X);var H=s(19419);new w.A(0,0,0,0),new Map;class Q{constructor(t,e,s,i,r,n,o){this.instanceId=t,this.textureKey=e,this.indexStart=s,this.indexCount=i,this.vertexStart=r,this.vertexCount=n,this.overlaps=o}updateBaseOffsets(t){this.vertexStart+=t.vertexFrom,this.indexStart+=t.indexFrom}clone(){return new Q(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(t,e,s,i,r,n,o,a){t.push(e),t.push(s),t.push(i),t.push(r),t.push(n),t.push(o),t.push(a)}serialize(t){return t.push(this.instanceId),t.push(this.textureKey),t.push(this.indexStart),t.push(this.indexCount),t.push(this.vertexStart),t.push(this.vertexCount),t.push(this.overlaps),t}static deserialize(t){const e=t.readInt32(),s=t.readInt32(),i=t.readInt32(),r=t.readInt32(),n=t.readInt32(),o=t.readInt32(),a=t.readInt32();return new Q(e,s,i,r,n,o,a)}}function Z(t,e){if(null!==e){t.push(e.length);for(const s of e)s.serialize(t);return t}t.push(0)}function $(t,e,s){const i=t.readInt32(),r=new Array(i);for(let i=0;i<r.length;i++)r[i]=e.deserialize(t,s);return r}Q.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT;class J{constructor(t,e){this.id=t,this.sortKey=e,this.records=[]}serialize(t){return t.push(this.id),t.writeF32(this.sortKey),Z(t,this.records),t}static deserialize(t){const e=t.readInt32(),s=t.readF32(),i=new J(e,s);return i.records=$(t,Q)??[],i}}J.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+Q.byteSizeHint;class K{get length(){return this._pos}constructor(t,e){this._pos=0;const s=e?this._roundToNearest(e,t.BYTES_PER_ELEMENT):40;this._array=new ArrayBuffer(s),this._buffer=new t(this._array),this._ctor=t,this._i16View=new Int16Array(this._array)}_roundToNearest(t,e){const s=Math.round(t);return 1===e?s:s+(e-s%e)}_ensureSize(t){if(this._pos+t>=this._buffer.length){const e=this._roundToNearest(1.25*(this._array.byteLength+t*this._buffer.BYTES_PER_ELEMENT),this._buffer.BYTES_PER_ELEMENT),s=new ArrayBuffer(e),i=new this._ctor(s);i.set(this._buffer,0),this._array=s,this._buffer=i,this._i16View=new Int16Array(this._array)}}ensureSize(t){this._ensureSize(t)}writeF32(t){this._ensureSize(1);const e=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=t,this._pos++,e}push(t){this._ensureSize(1);const e=this._pos;return this._buffer[this._pos++]=t,e}writeFixed(t){this._buffer[this._pos++]=t}setValue(t,e){this._buffer[t]=e}i1616Add(t,e,s){this._i16View[2*t]+=e,this._i16View[2*t+1]+=s}getValue(t){return this._buffer[t]}getValueF32(t){return new Float32Array(this._array,4*t,1)[0]}incr(t){if(this._buffer.length<t)throw new Error("Increment index overflows the target buffer");this._buffer[t]++}decr(t){this._buffer[t]--}writeRegion(t){this._ensureSize(t.length);const e=this._pos;return this._buffer.set(t,this._pos),this._pos+=t.length