// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../chunks/tslib.es6 ../core/domUtils ../core/events ../core/Logger ../core/maybe ../core/reactiveUtils ../core/scheduling ../core/accessorSupport/decorators/property ../core/has ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./overlay/ViewOverlay".split(" "),function(m,f,k,t,u,n,h,p,g,x,y,v,q){function r(e){e&&(k.empty(e),e.parentNode&&e.parentNode.removeChild(e))}const l=[0,0];m.DOMContainer=e=>{e=class extends e{constructor(...a){super(...a);this._freqInfo={freq:16, time:750};this._overlayRenderTaskHandle=null;this.height=0;this.position=this.overlay=this.messagesCommon=null;this.resizing=!1;this.surface=this.root=null;this.suspended=!0;this.userContent=this.ui=null;this.width=0;this.widthBreakpoint=null;this.addHandles([h.watch(()=>this.cursor,c=>{const {surface:b}=this;b&&b.setAttribute("data-cursor",c)}),h.watch(()=>this.navigating,c=>{const {surface:b}=this;b&&b.setAttribute("data-navigating",c.toString())})])}initialize(){this.addHandles([h.watch(()=>this.ui, (a,c)=>this._handleUIChange(a,c),h.initial),this.on("focus",()=>this.notifyChange("focused")),this.on("blur",()=>this.notifyChange("focused"))])}destroy(){this.destroyed||(this.ui=n.destroyMaybe(this.ui),this.container=null)}get container(){return this._get("container")??null}set container(a){var c=this._get("container");const b=k.byId(a);b||"string"!==typeof a||u.getLogger(this).error("#container",`element with id '${a}' not found`);if(c!==b)if(this._stopMeasuring(),c&&(c.classList.remove("esri-view"), this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this.root&&(r(this.root),this._set("root",null)),this.userContent&&(k.reparent(this.userContent,c),r(this.userContent),this._set("userContent",null))),b){b.classList.add("esri-view");a=document.createElement("div");a.className="esri-view-user-storage";k.reparent(b,a);b.appendChild(a);this._set("userContent",a);a=document.createElement("div"); a.className="esri-view-root";b.insertBefore(a,b.firstChild);this._set("root",a);c=document.createElement("div");c.className="esri-view-surface";c.setAttribute("role","application");c.tabIndex=0;a.appendChild(c);this._set("surface",c);var d=new q;a.appendChild(d.surface);this._set("overlay",d);this.addHandles(h.watch(()=>d.needsRender,w=>{this._overlayRenderTaskHandle=w&&!this._overlayRenderTaskHandle?p.addFrameTask({render:()=>this.overlay?.render()}):n.removeMaybe(this._overlayRenderTaskHandle)})); this.forceDOMReadyCycle();this._set("container",b);this._startMeasuring()}else this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),this._set("container",null)}get focused(){const a=document.activeElement===this.surface;return document.hasFocus()&&a}get size(){return[this.width,this.height]}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(a,c,b){const d=this.position;a-=d?d[0]:0;c-=d?d[1]:0;b?(b[0]=a,b[1]= c):b=[a,c];return b}containerToPage(a,c,b){const d=this.position;a+=d?d[0]:0;c+=d?d[1]:0;b?(b[0]=a,b[1]=c):b=[a,c];return b}_handleUIChange(a,c){this.removeHandles("ui");c&&c!==a&&c.destroy();a&&(a.view=this,this.addHandles(h.watch(()=>this.root,b=>{if(b){const d=document.createElement("div");b.appendChild(d);b=d}else b=null;a.container=b},h.initial),"ui"));this._set("ui",a)}_stopMeasuring(){this.removeHandles("measuring");this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const a= this._freqInfo;a.freq=16;a.time=750;this.addHandles([t.on(window,"resize",()=>{a.freq=16;a.time=750}),p.addFrameTask({prepare:c=>{const b=this._measure(),d=this._freqInfo;d.time+=c.deltaTime;b&&(d.freq=16,this._get("resizing")||this._set("resizing",!0));d.time