// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built require({cache:{"esri/layers/support/MediaElementView":function(){define("exports ../../chunks/tslib.es6 ../../core/Accessor ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/Polygon ../../geometry/projection ../../geometry/support/aaBoundingRect ../../geometry/support/normalizeUtilsSync".split(" "),function(f,c,p,x,B,l,q,r,A,z,E,a){f.MediaElementView=class extends p{constructor(d){super(d)}get bounds(){const d= this.coords;return null==d?.extent?null:E.fromExtent(d.extent)}get coords(){return z.projectOrLoad(this.element.georeference?.coords,this.spatialReference).geometry}get normalizedCoords(){return A.fromJSON(a.normalizeCentralMeridianSync(this.coords))}get normalizedBounds(){const d=null!=this.normalizedCoords?this.normalizedCoords.extent:null;return null!=d?E.fromExtent(d):null}};c.__decorate([x.property()],f.MediaElementView.prototype,"spatialReference",void 0);c.__decorate([x.property()],f.MediaElementView.prototype, "element",void 0);c.__decorate([x.property()],f.MediaElementView.prototype,"bounds",null);c.__decorate([x.property()],f.MediaElementView.prototype,"coords",null);c.__decorate([x.property()],f.MediaElementView.prototype,"normalizedCoords",null);c.__decorate([x.property()],f.MediaElementView.prototype,"normalizedBounds",null);f.MediaElementView=c.__decorate([r.subclass("esri.layers.support.MediaElementView")],f.MediaElementView);Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})})},"esri/views/2d/engine/webgl/Overlay":function(){define("../../../../core/Error ../../../../core/events ../../../../core/Logger ../../../../core/maybe ../../../../core/perspectiveUtils ../../../../core/reactiveUtils ../../../../core/libs/gl-matrix-2/factories/mat3f64 ../../../../core/libs/gl-matrix-2/math/vec2 ../../../../core/libs/gl-matrix-2/factories/vec2f64 ../../../../symbols/cim/enums ../DisplayObject ./animatedFormats/utils ../../../webgl/BufferObject ../../../webgl/enums ../../../webgl/Texture ../../../webgl/TextureDescriptor ../../../webgl/VertexArrayObject".split(" "), function(f,c,p,x,B,l,q,r,A,z,E,a,d,u,C,I,G){function H(g){return g?{...g,playAnimation:g.playing,repeatType:g.repeatType?h[g.repeatType]:void 0}:{}}const v=[1,1],m=q.create(),h={none:z.AnimatedSymbolRepeatType.None,loop:z.AnimatedSymbolRepeatType.Loop,oscillate:z.AnimatedSymbolRepeatType.Oscillate};class y extends E.DisplayObject{constructor(g){super();this.elementView=g;this.isWrapAround=!1;this.wrapAroundShift=0;this.perspectiveTransform=A.create();this._playHandle=null;this._vertices=new Float32Array(20); this._handles=[];this._handles.push(l.watch(()=>this.elementView.element.opacity,w=>this.opacity=w,l.initial),l.watch(()=>[this.elementView.coords],()=>{this.requestRender()},l.initial),l.watch(()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions],()=>{this._playHandle?.remove();this.texture=x.disposeMaybe(this.texture);this.requestRender()},l.initial),l.when(()=>this.elementView.element.loaded,()=>{const w=this.elementView.element;this.ready();"video"===w.type&& null!=w.content&&this._handles.push(c.on(w.content,"play",()=>this.requestRender()))},l.initial));g.element.load().catch(w=>{p.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new f("element-load-error","Element cannot be displayed",{element:g,error:w}))})}getMesh(g){throw Error("Method not implemented.");}destroy(){this._playHandle?.remove();this._handles.forEach(g=>g.remove());this.texture=x.disposeMaybe(this.texture)}get textureSize(){return v}get dvsMat3(){return this.parent.dvsMat3}beforeRender(g){const {context:w}= g,k=this.elementView.element.content;if(null!=k){var t=k instanceof HTMLImageElement;const K=k instanceof HTMLVideoElement;var J=t?k.naturalWidth:K?k.videoWidth:k.width;t=t?k.naturalHeight:K?k.videoHeight:k.height;this._updatePerspectiveTransform(J,t);if(this.texture)K&&!k.paused&&(this.texture.setData(k),this.requestRender(),this.texture.generateMipmap());else{const D=new I.TextureDescriptor;D.wrapMode=u.TextureWrapMode.CLAMP_TO_EDGE;D.preMultiplyAlpha=!0;D.width=J;D.height=t;"getFrame"in k?(J=M=> {this.texture?this.texture.setData(M):this.texture=new C.Texture(w,D,M);this.requestRender()},"animationOptions"in this.elementView.element&&(this._playHandle=a.play(k,H(this.elementView.element.animationOptions),null,J))):this.texture=new C.Texture(w,D,k);this.texture.generateMipmap();K&&!k.paused&&this.requestRender()}}super.beforeRender(g)}_createTransforms(){return null}draw(g){g.drawArrays(u.PrimitiveType.TRIANGLE_STRIP,0,4)}updateDrawCoords(g,w,k,t){const {coords:J,bounds:K}=this.elementView; if(null!=J&&null!=K){var [D,M,O,U]=J.rings[0];k=this._vertices;var {x:Q,y:P}=g;k.set([M[0]-Q,M[1]-P,D[0]-Q,D[1]-P,O[0]-Q,O[1]-P,U[0]-Q,U[1]-P]);g=w;if(t){const [V,,W]=K,{worldWidth:X,xBounds:aa}=t,[Y,Z]=aa;VY?g=X:W>Z&&Vthis.children,drawPhase:A.WGLDrawPhase.MAP});return[...super.prepareRenderPasses(a),d]}_updateMatrices(a){var {state:d}= a;const {id:u,size:C,pixelRatio:I,resolution:G,rotation:H,viewpoint:v,displayMat3:m}=d;if(this._viewStateId!==u){a=Math.PI/180*H;var h=I*C[0],y=I*C[1];this._localOrigin=v.targetGeometry.clone();var {x:g,y:w}=this._localOrigin;d=B.normalizeMapX(g,d.spatialReference);this._localOrigin.x=d;this._localOrigin.y=w;d=G*h;var k=G*y,t=f.identity(this._dvsMat3);f.multiply(t,t,m);f.translate(t,t,p.fromValues(h/2,y/2));f.scale(t,t,x.fromValues(h/d,-y/k,1));f.rotate(t,t,-a);this._viewStateId=u}}_updateOverlays(a, d){({state:a}=a);const {rotation:u,spatialReference:C,worldScreenWidth:I,size:G,viewpoint:H}=a,v=this._localOrigin;let m=0;var h=l.getInfo(C);if(h&&C.isWrappable){var y=180/Math.PI*u;var g=Math.round(G[0]*Math.abs(Math.cos(y))+G[1]*Math.abs(Math.sin(y)));const [k,t]=h.valid;h=q.getWorldWidth(C);const {x:J,y:K}=H.targetGeometry;y=[0,0];a.toScreen(y,[J,K]);const D=[0,0];g=g>I?.5*I:.5*g;var w=Math.floor((J+.5*h)/h);const M=k+w*h;w=t+w*h;const O=[y[0]+g,0];a.toMap(D,O);D[0]>w&&(m=h);O[0]=y[0]-g;a.toMap(D, O);D[0]{v=class extends v{constructor(){super(...arguments);this.attached=!1;this.clips=new H;this.highlightOptions=null;this.lastUpdateId=-1;this.updateRequested=this.moving=!1;this._visibleAtCurrentScale=!0}initialize(){const m=this.view?.spatialReferenceLocked??!0;this.view?.spatialReference&&m&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new B("layerview:spatial-reference-incompatible", "The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new a.Container),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([l.watch(()=>this.suspended,h=>{this.container&&(this.container.visible=!h)},l.syncAndInitial),l.watch(()=>this.updateSuspended,h=>{this.view&&!h&&this.updateRequested&&this.view.requestUpdate()},l.syncAndInitial),l.watch(()=>this.layer?.opacity?? 1,h=>{this.container&&(this.container.opacity=h)},l.syncAndInitial),l.watch(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",h=>{this.container&&(this.container.blendMode=h)},l.syncAndInitial),l.watch(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,h=>{this.container&&(this.container.effect=h)},l.syncAndInitial),l.watch(()=>this.highlightOptions,h=>this.container.highlightOptions=h,l.syncAndInitial),l.on(()=>this.clips,"change",()=>{this.container&&(this.container.clips= this.clips)},l.syncAndInitial),l.watch(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:h,scaleRange:y})=>{h=G.isInEffectiveScaleRange(y,h);h!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=h)},l.syncAndInitial)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(h=>{h===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(); this.updateRequested=!1}get spatialReferenceSupported(){const m=this.view?.spatialReference;return null==m||this.supportsSpatialReference(m)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0, this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(m){this.isFulfilled()&&!this.isResolved()?this.updateRequested=!1:(this._set("updateParameters",m),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(m)))}hitTest(m,h){return Promise.resolve(null)}supportsSpatialReference(m){return!0}canResume(){return this.spatialReferenceSupported? super.canResume()?this.visibleAtCurrentScale:!1:!1}getSuspendInfo(){const m=super.getSuspendInfo(),h=!this.spatialReferenceSupported;h&&(m.spatialReferenceNotSupported=h);return m}addAttachHandles(m){this.addHandles(m,"attach")}};c.__decorate([q.property()],v.prototype,"attached",void 0);c.__decorate([q.property({type:H,set(m){m=x.referenceSetter(m,this._get("clips"),H);this._set("clips",m)}})],v.prototype,"clips",void 0);c.__decorate([q.property()],v.prototype,"container",void 0);c.__decorate([q.property({type:d})], v.prototype,"highlightOptions",void 0);c.__decorate([q.property()],v.prototype,"moving",void 0);c.__decorate([q.property({readOnly:!0})],v.prototype,"spatialReferenceSupported",null);c.__decorate([q.property({readOnly:!0})],v.prototype,"updateParameters",void 0);c.__decorate([q.property()],v.prototype,"updateRequested",void 0);c.__decorate([q.property()],v.prototype,"updating",null);c.__decorate([q.property()],v.prototype,"view",void 0);c.__decorate([q.property()],v.prototype,"_visibleAtCurrentScale", void 0);c.__decorate([q.property({readOnly:!0})],v.prototype,"visibleAtCurrentScale",null);return v=c.__decorate([E.subclass("esri.views.2d.layers.LayerView2D")],v)};Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})})},"esri/views/layers/support/ClipRect":function(){define("../../../chunks/tslib.es6 ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./ClipArea".split(" "),function(f, c,p,x,B,l,q){var r;p=r=class extends q{constructor(A){super(A);this.type="rect";this.bottom=this.top=this.right=this.left=null}clone(){return new r({left:this.left,right:this.right,top:this.top,bottom:this.bottom})}commitVersionProperties(){this.commitProperty("left");this.commitProperty("right");this.commitProperty("top");this.commitProperty("bottom")}};f.__decorate([c.property({type:[Number,String],json:{write:!0}})],p.prototype,"left",void 0);f.__decorate([c.property({type:[Number,String],json:{write:!0}})], p.prototype,"right",void 0);f.__decorate([c.property({type:[Number,String],json:{write:!0}})],p.prototype,"top",void 0);f.__decorate([c.property({type:[Number,String],json:{write:!0}})],p.prototype,"bottom",void 0);return p=r=f.__decorate([l.subclass("esri.views.layers.support.ClipRect")],p)})},"esri/views/layers/support/ClipArea":function(){define("../../../chunks/tslib.es6 ../../../core/JSONSupport ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass".split(" "), function(f,c,p,x,B,l,q){c=class extends c.JSONSupport{get version(){this.commitVersionProperties();return(this._get("version")||0)+1}};f.__decorate([p.property({readOnly:!0})],c.prototype,"version",null);return c=f.__decorate([q.subclass("esri.views.layers.support.ClipArea")],c)})},"esri/views/layers/support/Geometry":function(){define("../../../chunks/tslib.es6 ../../../geometry ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../geometry/Geometry ../../../geometry/support/jsonUtils ./ClipArea ../../../geometry/Extent ../../../geometry/Polygon".split(" "), function(f,c,p,x,B,l,q,r,A,z,E,a){var d;c={base:r,key:"type",typeMap:{extent:E,polygon:a}};z=d=class extends z{constructor(u){super(u);this.type="geometry";this.geometry=null}clone(){return new d({geometry:this.geometry?.clone()??null})}commitVersionProperties(){this.commitProperty("geometry")}};f.__decorate([p.property({types:c,json:{read:A.fromJSON,write:!0}})],z.prototype,"geometry",void 0);return z=d=f.__decorate([q.subclass("esri.views.layers.support.Geometry")],z)})},"esri/views/layers/support/Path":function(){define("../../../chunks/tslib.es6 ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ./ClipArea".split(" "), function(f,c,p,x,B,l,q){p=class extends q{constructor(r){super(r);this.type="path";this.path=[]}commitVersionProperties(){this.commitProperty("path")}};f.__decorate([c.property({type:[[[Number]]],json:{write:!0}})],p.prototype,"path",void 0);return p=f.__decorate([l.subclass("esri.views.layers.support.Path")],p)})},"*noref":1}}); define("../../../chunks/tslib.es6 ../../../geometry ../../../Graphic ../../../renderers/ClassBreaksRenderer ../../../renderers/DictionaryRenderer ../../../renderers/DotDensityRenderer ../../../renderers/HeatmapRenderer ../../../renderers/PieChartRenderer ../../../renderers/Renderer ../../../renderers/SimpleRenderer ../../../renderers/UniqueValueRenderer ../../../renderers/support/jsonUtils ../../../core/Logger ../../../symbols ../../../core/Collection ../../../core/has ../../../core/MapUtils ../../../core/promiseUtils ../../../core/reactiveUtils ../../../core/accessorSupport/decorators/property ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../geometry/support/aaBoundingRect ../../../geometry/support/contains ../../../geometry/support/intersectsBase ../../../layers/support/MediaElementView ../../../core/Error ../../../core/scheduling ../../../core/accessorSupport/tracking/Flags ../../../core/colorUtils ../../../config ../../../symbols/Font ../../../core/ObjectPool ../../../geometry/Extent ../../../geometry/Geometry ../../../geometry/Multipoint ../../../geometry/Point ../../../geometry/Polygon ../../../geometry/Polyline ../../../geometry/support/Axis ../../../geometry/support/spatialReferenceUtils ../../../geometry/support/TileClipper ../../../symbols/cim/effects/EffectAddControlPoints ../../../symbols/cim/effects/EffectArrow ../../../symbols/cim/effects/EffectBuffer ../../../symbols/cim/effects/EffectControlMeasureLine ../../../symbols/cim/effects/EffectCut ../../../symbols/cim/effects/EffectDashes ../../../symbols/cim/effects/EffectDonut ../../../symbols/cim/effects/EffectJog ../../../symbols/cim/effects/EffectMove ../../../symbols/cim/effects/EffectOffset ../../../symbols/cim/effects/EffectReverse ../../../symbols/cim/effects/EffectRotate ../../../symbols/cim/effects/EffectScale ../../../symbols/cim/effects/EffectWave ../../../symbols/cim/placements/PlacementAlongLineSameSize ../../../symbols/cim/placements/PlacementAtExtremities ../../../symbols/cim/placements/PlacementAtRatioPositions ../../../symbols/cim/placements/PlacementInsidePolygon ../../../symbols/cim/placements/PlacementOnLine ../../../symbols/cim/placements/PlacementOnVertices ../../../symbols/cim/placements/PlacementPolygonCenter ../../../symbols/cim/enums ../../../core/mathUtils ../engine/webgl/definitions ../../../core/libs/gl-matrix-2/factories/vec2f32 ../engine/webgl/alignmentUtils ../../../symbols/support/defaults ../../../symbols/cim/OverrideHelper ../../../core/floatRGBA ../../../layers/effects/EffectView ../../../core/Evented ./support/util ../engine/webgl/enums ../engine/webgl/brushes/BrushBitmap ../../../core/libs/gl-matrix-2/factories/vec4f32 ../../webgl/checkWebGLError ../../webgl/enums ../../webgl/FramebufferObject ../../../chunks/builtins ../../webgl/GLObjectType ../../webgl/Texture ../engine/webgl/shaders/BackgroundPrograms ../engine/webgl/DefaultVertexAttributeLayouts ../engine/webgl/AFeatureTile ../engine/webgl/DisplayEntity ../engine/webgl/shaderGraph/techniques/featureTechniqueUtils ../engine/webgl/number ../engine/webgl/PooledUint32Array ../engine/webgl/shaders/TileInfoPrograms ../engine/vectorTiles/style/StyleDefinition ../engine/vectorTiles/enums ../engine/webgl/shaders/BitBlitPrograms ../../../request ../../../core/urlUtils ../../../core/pbf ../engine/webgl/shaders/StencilPrograms ../engine/webgl/shaders/HighlightPrograms ../engine/webgl/Profiler ../engine/webgl/shaderGraph/techniques/TechniqueRegistry ../engine/webgl/shaderGraph/techniques/TechniqueType ../engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter ../engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter ../engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter ../engine/webgl/shaderGraph/techniques/fill/FillMeshWriter ../engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter ../engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter ../engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter ../engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter ../../../geometry/support/aaBoundingBox ../../../Color ../engine/webgl/shaderGraph/techniques/text/TextMeshWriter ../engine/webgl/shaderGraph/techniques/line/LineMeshWriter ../engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter ../engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter ../engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter ../../webgl/renderState ../../3d/webgl-engine/core/shaderModules/interfaces ../../webgl/testSVGPremultipliedAlpha ../LabelManager ./graphics/GraphicsView2D ../../../chunks/earcut ../../../core/libs/gl-matrix-2/factories/vec3f32 ../../../geometry/support/normalizeUtilsCommon ../../../geometry/SpatialReference ../../../geometry/support/Ellipsoid ../../../kernel ../navigation/MapViewNavigation ../../../core/asyncUtils ../../../core/support/UpdatingHandles ../engine/webgl/shaders/MagnifierPrograms ../tiling/TileInfoView ../tiling/TileKey ../tiling/TileQueue ../tiling/TileStrategy ../engine/webgl/Overlay ../engine/webgl/OverlayContainer ./LayerView2D ../../layers/LayerView".split(" "),function(f, c,p,x,B,l,q,r,A,z,E,a,d,u,C,I,G,H,v,m,h,y,g,w,k,t,J,K,D,M,O,U,Q,P,V,W,X,aa,Y,Z,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,mb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Eb,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,da,ea,fa,ha,ia,ja){function ba(b,e,n){b.getTileBounds(L,e.key,!0);R.xmin=L[0];R.ymin=L[1];R.xmax=L[2];R.ymax=L[3];return k.extentIntersectsPolygon(R, n)}let T=class extends ia.LayerView2DMixin(ja){constructor(){super(...arguments);this._tileStrategy=this._fetchQueue=this._overlayContainer=null;this._elementReferences=new Map;this.layer=this._debugGraphicsView=null;this.elements=new C}attach(){this.addAttachHandles([v.on(()=>this.layer.effectiveSource,"refresh",()=>{this._tileStrategy.refresh(b=>this._updateTile(b));this.requestUpdate()}),v.on(()=>this.layer.effectiveSource,"change",({element:b})=>this._elementUpdateHandler(b))]);this._overlayContainer= new ha;this.container.addChild(this._overlayContainer);this._fetchQueue=new da({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(b,e)=>this._queryElements(b,e)});this._tileStrategy=new ea({cachePolicy:"purge",resampling:!0,acquireTile:b=>this._acquireTile(b),releaseTile:b=>this._releaseTile(b),tileInfoView:this.view.featuresTilingScheme});this.requestUpdate()}detach(){this.elements.removeAll();this._tileStrategy.destroy();this._fetchQueue.destroy();this._overlayContainer.removeAllChildren(); this.container.removeAllChildren();this._elementReferences.clear();this._debugGraphicsView?.destroy()}supportsSpatialReference(b){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(b){this._tileStrategy.update(b);this._debugGraphicsView?.update(b)}async hitTest(b,e){e=[];var n=b.normalize();n=[n.x,n.y];for(const {projectedElement:{normalizedCoords:F,element:S}}of this._elementReferences.values())null!=F&&w.ringsContainsCoords(F.rings,n)&&e.push({type:"media",element:S, layer:this.layer,mapPoint:b,sourcePoint:S.toSource(b)});return e.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset();this._tileStrategy.refresh(b=>this._updateTile(b))}_acquireTile(b){b=new ka(b.clone());this._updateTile(b);return b}_updateTile(b){this._updatingHandles.addPromise(this._fetchQueue.push(b.key).then(e=>{const [n,F]=b.setElements(e);this._referenceElements(b,n);this._dereferenceElements(b,F);this.requestUpdate()},e=>{H.isAbortError(e)|| d.getLogger(this).error(e)}))}_releaseTile(b){this._fetchQueue.abort(b.key.id);b.elements&&this._dereferenceElements(b,b.elements);this.requestUpdate()}async _queryElements(b,e){const n=this.layer.effectiveSource;if(null==n)return[];this.view.featuresTilingScheme.getTileBounds(L,b,!0);b=new P({xmin:L[0],ymin:L[1],xmax:L[2],ymax:L[3],spatialReference:this.view.spatialReference});return n.queryElements(b,e)}_referenceElements(b,e){if(null!=this.layer.source)for(const n of e)this._referenceElement(b, n)}_referenceElement(b,e){G.getOrCreateMapValue(this._elementReferences,e.uid,()=>{const n=new t.MediaElementView({element:e,spatialReference:this.view.spatialReference}),F=new fa(n);this._overlayContainer.addChild(F);this.elements.add(e);return{tiles:new Set,projectedElement:n,overlay:F,debugGraphic:null}}).tiles.add(b)}_dereferenceElements(b,e){for(const n of e)this._dereferenceElement(b,n)}_dereferenceElement(b,e){const n=this._elementReferences.get(e.uid);n.tiles.delete(b);n.tiles.size||(this._overlayContainer.removeChild(n.overlay), n.overlay.destroy(),n.projectedElement.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),this._debugGraphicsView?.graphics.remove(n.debugGraphic))}_elementUpdateHandler(b){var e=this._elementReferences.get(b.uid);if(e){const S=e.projectedElement.normalizedCoords;if(null==S)this._overlayContainer.removeChild(e.overlay),e.overlay.destroy(),e.projectedElement.destroy(),this._elementReferences.delete(b.uid),this.elements.remove(b),this._debugGraphicsView?.graphics.remove(e.debugGraphic); else{var n=[],F=[];for(const N of this._tileStrategy.tiles){const ca=ba(this.view.featuresTilingScheme,N,S);e.tiles.has(N)?ca||F.push(N):ca&&n.push(N)}for(const N of n)this._referenceElement(N,b);for(const N of F)this._dereferenceElement(N,b);e=this._elementReferences.get(b.uid);e?.debugGraphic&&(e.debugGraphic.geometry=e.projectedElement.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:e.debugGraphic,property:"geometry"}))}}else if(e=(new t.MediaElementView({element:b,spatialReference:this.view.spatialReference})).normalizedCoords, null!=e)for(n of this._tileStrategy.tiles)ba(this.view.featuresTilingScheme,n,e)&&this._referenceElement(n,b)}};f.__decorate([m.property()],T.prototype,"layer",void 0);f.__decorate([m.property({readOnly:!0})],T.prototype,"elements",void 0);T=f.__decorate([y.subclass("esri.views.2d.layers.MediaLayerView2D")],T);const L=g.create(),R={xmin:0,ymin:0,xmax:0,ymax:0};class ka{constructor(b){this.key=b;this.elements=null;this.isReady=!1;this.visible=!0}setElements(b){const e=[],n=new Set(this.elements);this.elements= b;for(const F of b)n.has(F)?n.delete(F):e.push(F);this.isReady=!0;return[e,Array.from(n)]}destroy(){}}return T});