import{A as u,B as h,fr as Wt,a9 as kt,a8 as zt,C as k,a6 as he,dD as qe,lf as Ht,a7 as Le,bS as Vt,ey as pt,z as y,ea as z,bb as D,s as P,ik as Bt,iE as L,aW as Gt,gM as Xt,fm as Ne,lg as Fe,ab as Ue,f8 as Zt,bT as b,cQ as ue,cT as Se,eY as ht,_ as xe,aC as We,aH as I,d4 as Yt,lh as Jt,kp as qt,g$ as Kt,h0 as Qt,hV as en,V as tn,T as nn,j5 as ft,j7 as ve,cv as ke,cu as rn,iC as on,iD as sn,jb as mt,cS as gt,fq as an,i8 as ln,eo as cn,D as un,aI as pn,li as hn,lj as fn,E as mn,f as gn,K as dn,bU as yn,i6 as wn,gF as Ke}from"./index-b5c8f851.js";import{I as dt,o as Re,r as Me,D as xn,U as vn,L as yt,h as ze,j as He,R as Ve,O as Be,_ as Ge,v as Xe,B as $n,a as Ze,N as ne,b as bn,l as _e,w as An,p as Ee,g as Tn}from"./georeference-f533c6ae.js";import{m as wt}from"./MeshGeoreferencedRelativeVertexSpace-7e8894cd.js";import{a as Sn,e as Rn,t as xt,m as $e}from"./MeshLocalVertexSpace-702f1ae9.js";import{i as Mn}from"./earcut-d423749e.js";import{t as vt}from"./Indices-8bd7636c.js";import{e as Qe}from"./deduplicate-d84e5ef3.js";import{b as Fn,o as jn,X as Dn}from"./plane-66dd48d1.js";import"./triangle-f93283ef.js";import{e as $t}from"./mat4f64-1413b4a7.js";import"./basicInterfaces-11f56cb3.js";import"./VertexAttribute-0e674613.js";import{u as et,y as Ln,h as _n,o as En,i as Cn}from"./External-7e16e2e2.js";import{c as Ye}from"./spatialReferenceEllipsoidUtils-bc18a3f3.js";var Y;const je=new WeakMap;let On=0,E=Y=class extends he{constructor(e){super(e),this.wrap="repeat"}get url(){return this._get("url")||null}set url(e){this._set("url",e),e&&this._set("data",null)}get data(){return this._get("data")||null}set data(e){this._set("data",e),e&&this._set("url",null)}writeData(e,t,n,r){if(e instanceof HTMLImageElement){const o={type:"image-element",src:qe(e.src,r),crossOrigin:e.crossOrigin};t[n]=o}else if(e instanceof HTMLCanvasElement){const o=e.getContext("2d").getImageData(0,0,e.width,e.height),s={type:"canvas-element",imageData:this._encodeImageData(o)};t[n]=s}else if(e instanceof HTMLVideoElement){const o={type:"video-element",src:qe(e.src,r),autoplay:e.autoplay,loop:e.loop,muted:e.muted,crossOrigin:e.crossOrigin,preload:e.preload};t[n]=o}else if(e instanceof ImageData){const o={type:"image-data",imageData:this._encodeImageData(e)};t[n]=o}}readData(e){switch(e.type){case"image-element":{const t=new Image;return t.src=e.src,t.crossOrigin=e.crossOrigin,t}case"canvas-element":{const t=this._decodeImageData(e.imageData),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,n.getContext("2d").putImageData(t,0,0),n}case"image-data":return this._decodeImageData(e.imageData);case"video-element":{const t=document.createElement("video");return t.src=e.src,t.crossOrigin=e.crossOrigin,t.autoplay=e.autoplay,t.loop=e.loop,t.muted=e.muted,t.preload=e.preload,t}default:return}}get transparent(){const e=this.data,t=this.url;if(e instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(e.getContext("2d").getImageData(0,0,e.width,e.height));if(e instanceof ImageData)return this._imageDataContainsTransparent(e);if(t){const n=t.substr(t.length-4,4).toLowerCase(),r=t.substr(0,15).toLocaleLowerCase();if(n===".png"||r==="data:image/png;")return!0}return!1}set transparent(e){this._overrideIfSome("transparent",e)}get contentHash(){const e=typeof this.wrap=="string"?this.wrap:typeof this.wrap=="object"?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",t=(n="")=>`d:${n},t:${this.transparent},w:${e}`;return this.url!=null?t(this.url):this.data!=null?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?t(this.data.src):(je.has(this.data)||je.set(this.data,++On),t(je.get(this.data))):t()}get memoryUsage(){let e=0;if(e+=this.url!=null?this.url.length:0,this.data!=null){const t=this.data;"data"in t?e+=t.data.byteLength:t instanceof HTMLImageElement?e+=t.naturalWidth*t.naturalHeight*3:t instanceof HTMLCanvasElement&&(e+=t.width*t.height*3)}return e}clone(){const e={url:this.url,data:this.data,wrap:this._cloneWrap()};return new Y(e)}cloneWithDeduplication(e){const t=e.get(this);if(t)return t;const n=this.clone();return e.set(this,n),n}_cloneWrap(){return typeof this.wrap=="string"?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(e){let t="";for(let n=0;n!Array.isArray(i[0]))(t)?(i,l)=>t[3*i+l]:(i,l)=>t[i][l],s=r?Gt(r)/Xt(r):1;return Dn(e,(i,l)=>Ne(i,o(l,0)*s,o(l,1)*s,o(l,2)),n)}function Bn(e,t,n){const r=Vn(tt,e,t,n)?jn(tt):[0,0,1];return Math.abs(r[2])>Math.cos(Bt(80))?L.Z:Math.abs(r[1])>Math.abs(r[0])?L.Y:L.X}const tt=Fn();function Gn(e){const t=Zn(e.rings,e.hasZ,be.CCW_IS_HOLE,e.spatialReference),n=new Array;let r=0,o=0;for(const l of t.polygons){const c=l.count,a=l.index,p=Sn(t.position,3*a,3*c),f=l.holeIndices.map(g=>g-a),m=vt(Mn(p,f,3));n.push({position:p,faces:m}),r+=p.length,o+=m.length}const s=Xn(n,r,o),i=Array.isArray(s.position)?Qe(s.position,3,{originalIndices:s.faces}):Qe(s.position.buffer,6,{originalIndices:s.faces});return s.position=Rn(new Float64Array(i.buffer)),s.faces=i.indices,s}function Xn(e,t,n){if(e.length===1)return e[0];const r=xt(t),o=new Array(n);let s=0,i=0,l=0;for(const c of e){for(let a=0;a=0;x--){const d=e[x],S=n===be.CCW_IS_HOLE&&Yn(d,t,r);if(S&&o!==1)s[c++]=d;else{let _=d.length;for(let w=0;w0&&(l[p++]={index:g,count:d.length}),g=S?fe(d,d.length-1,-1,m,g,d.length,t):fe(d,0,1,m,g,d.length,t);for(let w=0;w0&&(l[p++]={index:g,count:R.length}),g=fe(R,0,1,m,g,R.length,t)}c=0,$.count>0&&(i[a++]=$)}}for(let x=0;x0&&(l[p++]={index:g,count:d.length}),g=fe(d,0,1,m,g,d.length,t)}return i.length=a,l.length=p,{position:m,polygons:i,outlines:l}}function fe(e,t,n,r,o,s,i){o*=3;for(let l=0;limport("./loadGLTFMesh-ea0baf04.js"),["assets/loadGLTFMesh-ea0baf04.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/BufferView-db785e2d.js","assets/vec32-567858f4.js","assets/DefaultMaterial_COLOR_GAMMA-830e6516.js","assets/mat4f64-1413b4a7.js","assets/enums-bdecffa2.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/Indices-8bd7636c.js","assets/types-1305598a.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/earcut-d423749e.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n),s=await sr(r,n);We(n);const i=o(new I({x:0,y:0,z:0,spatialReference:e.spatialReference}),s.url,{resolveFile:or(s),requestFile:void 0,useTransform:!0,signal:n==null?void 0:n.signal,expectedType:s.type});i.then(()=>s.dispose(),()=>s.dispose());const{vertexAttributes:l,components:c}=await i;e.vertexAttributes=l,e.components=c}function or(e){const t=Yt(e.url);return n=>{const r=Jt(n,t,t),o=r?r.replace(/^ *\.\//,""):null;return(o?e.files.get(o):null)??n}}async function sr(e,t){if(Array.isArray(e)){if(!e.length)throw new P("mesh-load-external:missing-assets","There must be at least one file to load");return e[0]instanceof File?ar(e):lr(e,t)}return Rt(e)}async function ir(e,t){const{parts:n,assetMimeType:r,assetName:o}=e;if(n.length===1)return new Ae(n[0].partUrl);const s=await e.toBlob(t);return We(t),Ae.fromBlob(s,Lt(o,r))}function Rt(e){return Ae.fromBlob(e,Lt(e.name,e.type))}function ar(e){return jt(e.map(t=>({name:t.name,mimeType:t.type,source:Rt(t)})))}async function lr(e,t){const n=await qt(e.map(async r=>{const o=await ir(r);return We(t),{name:r.assetName,mimeType:r.assetMimeType,source:o}}));if(Kt(t))throw n.forEach(r=>r.source.dispose()),Qt();return jt(n)}const Mt=/^model\/gltf\+json$/,Ft=/^model\/gltf-binary$/,Pe=/\.gltf$/i,cr=/\.glb$/i;function jt(e){const t=new Map;let n,r=null;for(const{name:o,mimeType:s,source:i}of e)r===null&&(Mt.test(s)||Pe.test(o)?(r=i.url,n="gltf"):(Ft.test(s)||cr.test(o))&&(r=i.url,n="glb")),t.set(o,i.url),i.files.forEach((l,c)=>t.set(c,l));if(r==null)throw new P("mesh-load-external:missing-files","Missing files to load external mesh source");return new Ae(r,()=>e.forEach(({source:o})=>o.dispose()),t,n)}let Ae=class Dt{constructor(t,n=()=>{},r=new Map,o){this.url=t,this.dispose=n,this.files=r,this.type=o}static fromBlob(t,n){const r=URL.createObjectURL(t);return new Dt(r,()=>URL.revokeObjectURL(r),void 0,n)}};function Lt(e,t){return Mt.test(t)||Pe.test(e)?"gltf":Ft.test(t)||Pe.test(e)?"glb":void 0}let W=class extends en{constructor(){super(),this.externalSources=new tn,this._explicitDisplaySource=null,this.addHandles(nn(()=>this.externalSources,"after-remove",({item:e})=>{e===this._explicitDisplaySource&&(this._explicitDisplaySource=null)},{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(e){if(e!=null&&!et(e))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=e,e&&this.externalSources.every(t=>!Ln(t,e))&&this.externalSources.add(e)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(e){return this.externalSources.items.filter(t=>_n(t,e))}get _implicitDisplaySource(){return this.externalSources.find(et)}};u([h()],W.prototype,"externalSources",void 0),u([h()],W.prototype,"displaySource",null),u([h()],W.prototype,"_implicitDisplaySource",null),u([h()],W.prototype,"_explicitDisplaySource",void 0),W=u([k("esri.geometry.support.meshUtils.Metadata")],W);const ur="esri.geometry.support.meshUtils.offset";function pr(e,t,n){var o;if(!((o=e.vertexAttributes)!=null&&o.position))return;const{vertexSpace:r}=e;r.isRelative?(Re(r,ur,n),hr(r,t)):Me(e.spatialReference,n)?fr(e,t):mr(e,t)}function hr(e,t){const n=e.origin;e.origin=Se(b(),n,t)}function fr(e,t){const n=e.spatialReference,r=e.vertexAttributes.position,o=e.vertexAttributes.normal,s=e.vertexAttributes.tangent,i=new Float64Array(r.length),l=o!=null?new Float32Array(o.length):null,c=s!=null?new Float32Array(s.length):null,a=e.extent.center,p=gr;yt(n,[a.x,a.y,a.z],rt,Ye(n)),ft(ot,rt),ve(p,t,ot),ze(r,n,i),o!=null&&l!=null&&He(o,r,i,n,l),s!=null&&c!=null&&Ve(s,r,i,n,c),_t(i,p),Be(i,r,n),o!=null&&l!=null&&Ge(l,r,i,n,o),s!=null&&c!=null&&Xe(c,r,i,n,s),e.vertexAttributesChanged()}function mr(e,t){_t(e.vertexAttributes.position,t),e.vertexAttributesChanged()}function _t(e,t){if(e)for(let n=0;n=s&&p=5-1,S=g===2||g===4,_=x?n-1:n;for(let $=0;$<=_;$++){const w=$/_*2*Math.PI,R=x?0:.5;v[0]=R*Math.sin(w),v[1]=R*-Math.cos(w),v[2]=g<=2?.5:-.5;for(let H=0;H<3;H++)o[c++]=v[H],s[a++]=d?H===2?g<=1?1:-1:0:H===2?0:v[H]/R;i[p++]=($+(x?.5:0))/n,i[p++]=g<=1?1*g/3:g<=3?1*(g-2)/3+1/3:1*(g-4)/3+2/3,S||g===0||$===n||(g!==5&&(l[f++]=m,l[f++]=m+1,l[f++]=m-n),g!==1&&(l[f++]=m,l[f++]=m-n,l[f++]=m-n-1)),m++}}return{position:o,normal:s,uv:i,faces:l}}function vr(e,t){const n=typeof t=="number"?t:t!=null?t.width:1,r=typeof t=="number"?t:t!=null?t.height:1;switch(e){case"up":case"down":return{width:n,depth:r};case"north":case"south":return{width:n,height:r};case"east":case"west":return{depth:n,height:r}}}function $r(e){const t=ie.facingAxisOrderSwap[e],n=ie.position,r=ie.normal,o=new Float64Array(n.length),s=new Float32Array(r.length);let i=0;for(let l=0;l<4;l++){const c=i;for(let a=0;a<3;a++){const p=t[a],f=Math.abs(p)-1,m=p>=0?1:-1;o[i]=n[c+f]*m,s[i]=r[c+f]*m,i++}}return{position:o,normal:s,uv:new Float32Array(ie.uv),faces:new Uint32Array(ie.faces),isPlane:!0}}const G=1,X=2,Z=3,ie={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[Z,G,X],west:[-Z,-G,X],north:[-G,Z,X],south:[G,-Z,X],up:[G,X,Z],down:[G,-X,-Z]}};function ge(e,t,n){e.isPlane||br(e),Ar(e,n==null?void 0:n.size);const{vertexAttributes:r,vertexSpace:o,transform:s}=$n(e,t,n);return{vertexAttributes:new T({...r,uv:e.uv}),vertexSpace:o,transform:s,components:[new re({faces:e.faces,material:(n==null?void 0:n.material)||null})],spatialReference:t.spatialReference}}function br(e){for(let t=0;timport("./zipjs-wrapper-4f68a823.js"),[]),o=[];return(await new n(new t(e)).getEntries()).forEach(i=>{var a;if(i.directory||/^__MACOS/i.test(i.filename))return;const l=new r,c=(a=i.getData)==null?void 0:a.call(i,l).then(p=>new File([p],i.filename));c&&o.push(c)}),Promise.all(o)}var M;const U="esri.geometry.Mesh",Pr={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:Ee,"georeferenced-relative":wt,local:$e}};let A=M=class extends an.LoadableMixin(ln(cn)){constructor(e){super(e),this.components=null,this.vertexSpace=new Ee,this.transform=null,this.metadata=new W,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new T,this.type="mesh"}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when(()=>{this.addHandles(un(()=>{var e;return{vertexAttributes:this.vertexAttributes,components:(e=this.components)==null?void 0:e.map(t=>t.clone())}},()=>this._clearSources(),{once:!0,sync:!0}))})}get hasExtent(){var e;return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):((e=this.metadata.displaySource)==null?void 0:e.extent)!=null}get _transformedExtent(){const{components:e,spatialReference:t,vertexAttributes:n,vertexSpace:r}=this,o=n.position;if(o.length===0||e&&e.length===0)return new Ue({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0,spatialReference:t});if(r.type==="local"){const{_untransformedExtent:s,transform:i}=this;return Jn(s,i,r,t)}if(r.type==="georeferenced-relative"){const{transform:s}=this,i=dt({positions:o,transform:s,vertexSpace:r,inSpatialReference:t,outSpatialReference:t});return we(i,t)}return we(o,t)}get _untransformedExtent(){return we(this.vertexAttributes.position,this.spatialReference)}get anchor(){const{vertexSpace:e}=this;if(e.isRelative)return e.getOriginPoint(this.spatialReference);const{center:t,zmin:n}=this._transformedExtent;return new I({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get origin(){const{vertexSpace:e}=this;return e.isRelative?e.getOriginPoint(this.spatialReference):this._transformedExtent.center}get extent(){var e,t;return this.loaded||((t=(e=this.metadata)==null?void 0:e.displaySource)==null?void 0:t.extent)==null?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){if(!this.loaded)return y.getLogger(this).error("addComponent()",new se().message);this.components||(this.components=[]),this.components.push(re.from(e)),this.notifyChange("components")}removeComponent(e){if(!this.loaded)return y.getLogger(this).error("removeComponent()",new se().message);if(this.components){const t=this.components.indexOf(e);if(t!==-1)return this.components.splice(t,1),void this.notifyChange("components")}y.getLogger(this).error("removeComponent()",new Un().message)}rotate(e,t,n,r){return Tn(e,t,n,ct),Rr(this,ct,r),this}offset(e,t,n,r){return this.loaded?(de[0]=e,de[1]=t,de[2]=n,pr(this,de,r),this):(y.getLogger(this).error("offset()",new se().message),this)}scale(e,t){return this.loaded?(Dr(this,e,t),this):(y.getLogger(this).error("scale()",new se().message),this)}centerAt(e,t){return this.loaded?(qn(this,e,t),this):(y.getLogger(this).error("centerAt()",new se().message),this)}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(rr(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneWithVertexSpace(this.vertexSpace.clone())}cloneWithVertexSpace(e){var r;let t=null;if(this.components){const o=new Map,s=new Map;t=this.components.map(i=>i.cloneWithDeduplication(o,s))}const n={components:t,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes.clone(),vertexSpace:e,transform:((r=this.transform)==null?void 0:r.clone())??null,metadata:this.metadata.clone()};return new M(n)}cloneShallow(){return new M({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const t=xe(()=>import("./gltfexport-64d48c46.js"),["assets/gltfexport-64d48c46.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/mat4f64-1413b4a7.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/vec32-567858f4.js","assets/BufferView-db785e2d.js","assets/enums-bdecffa2.js","assets/imageutils-c59aa434.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/earcut-d423749e.js","assets/Indices-8bd7636c.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n=this.load(),r=await Promise.all([t,n]),{toBinaryGLTF:o}=r[0];return o(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,this.components!=null)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}static createBox(e,t){if(!(e instanceof I))return y.getLogger(U).error(".createBox()",new B().message),null;const n=new M(ge(dr(),e,t));return t!=null&&t.imageFace&&t.imageFace!=="all"?yr(n,t.imageFace):n}static createSphere(e,t){return e instanceof I?new M(ge(wr((t==null?void 0:t.densificationFactor)||0),e,t)):(y.getLogger(U).error(".createSphere()",new B().message),null)}static createCylinder(e,t){return e instanceof I?new M(ge(xr((t==null?void 0:t.densificationFactor)||0),e,t)):(y.getLogger(U).error(".createCylinder()",new B().message),null)}static createPlane(e,t){if(!(e instanceof I))return y.getLogger(U).error(".createPlane()",new B().message),null;const n=(t==null?void 0:t.facing)??"up",r=vr(n,t==null?void 0:t.size);return new M(ge($r(n),e,{...t,size:r}))}static createFromPolygon(e,t){if(!(e instanceof pn))return y.getLogger(U).error(".createFromPolygon()",new Wn().message),null;const n=Gn(e);return new M({vertexAttributes:new T({position:n.position}),components:[new re({faces:n.faces,shading:"flat",material:(t==null?void 0:t.material)??null})],spatialReference:e.spatialReference,vertexSpace:new Ee})}static async createFromGLTF(e,t,n){if(!(e instanceof I)){const o=new B;throw y.getLogger(U).error(".createfromGLTF()",o.message),o}const{loadGLTFMesh:r}=await ht(xe(()=>import("./loadGLTFMesh-ea0baf04.js"),["assets/loadGLTFMesh-ea0baf04.js","assets/index-b5c8f851.js","assets/index-86716609.css","assets/BufferView-db785e2d.js","assets/vec32-567858f4.js","assets/DefaultMaterial_COLOR_GAMMA-830e6516.js","assets/mat4f64-1413b4a7.js","assets/enums-bdecffa2.js","assets/quat-59e6d063.js","assets/quatf64-3363c48e.js","assets/resourceUtils-908c2b28.js","assets/basicInterfaces-11f56cb3.js","assets/Indices-8bd7636c.js","assets/types-1305598a.js","assets/georeference-f533c6ae.js","assets/spatialReferenceEllipsoidUtils-bc18a3f3.js","assets/MeshLocalVertexSpace-702f1ae9.js","assets/MeshGeoreferencedRelativeVertexSpace-7e8894cd.js","assets/earcut-d423749e.js","assets/deduplicate-d84e5ef3.js","assets/plane-66dd48d1.js","assets/sphere-5667aa69.js","assets/ByteSizeUnit-d4757d40.js","assets/triangle-f93283ef.js","assets/lineSegment-95273d56.js","assets/VertexAttribute-0e674613.js","assets/External-7e16e2e2.js"]),n);return new M(await r(e,t,n))}static async createFromFiles(e,t,n){const r=a=>y.getLogger(U).error(".createFromFiles()",a.message);if(!(e instanceof I)){const a=new B;throw r(a),a}const o=n==null?void 0:n.layer;if(!o){const a=new kn;throw r(a),a}const s=await M.extractAndFilterFiles(t,o),i=s.reduce((a,p)=>hn(o.infoFor3D,p)?a+1:a,0);if(i===0){const a=new zn;throw r(a),a}if(i>1){const a=new Hn;throw r(a),a}const l=M.createWithExternalSource(e,s),[c]=await o.uploadAssets([l],n);return c}static async extractAndFilterFiles(e,t){const n=t==null?void 0:t.infoFor3D;return n?(await Cr(e)).filter(r=>fn(n,r)):e}static createWithExternalSource(e,t,n){var m;const r=(n==null?void 0:n.extent)??null,{x:o,y:s,z:i,spatialReference:l}=e,c=((m=n==null?void 0:n.transform)==null?void 0:m.clone())??new ne,a=(n==null?void 0:n.vertexSpace)??new $e({origin:[o,s,i??0]}),p={source:t,extent:r},f=new W;return f.externalSources.push(p),new M({metadata:f,transform:c,vertexSpace:a,spatialReference:l})}static createIncomplete(e,t){var a;const{x:n,y:r,z:o,spatialReference:s}=e,i=((a=t==null?void 0:t.transform)==null?void 0:a.clone())??new ne,l=(t==null?void 0:t.vertexSpace)??new $e({origin:[n,r,o??0]}),c=new M({transform:i,vertexSpace:l,spatialReference:s});return c.addResolvingPromise(Promise.reject(new P("mesh-incomplete","Mesh resources are not complete"))),c}};u([h({type:[re],json:{write:!0}})],A.prototype,"components",void 0),u([h({nonNullable:!0,types:Pr,constructOnly:!0,json:{write:!0}})],A.prototype,"vertexSpace",void 0),u([h({type:ne,json:{write:!0}})],A.prototype,"transform",void 0),u([h({constructOnly:!0})],A.prototype,"metadata",void 0),u([h()],A.prototype,"hasExtent",null),u([h()],A.prototype,"_transformedExtent",null),u([h()],A.prototype,"_untransformedExtent",null),u([h()],A.prototype,"anchor",null),u([h()],A.prototype,"origin",null),u([h({readOnly:!0,json:{read:!1}})],A.prototype,"extent",null),u([h({readOnly:!0,json:{read:!1,write:!0,default:!0}})],A.prototype,"hasZ",void 0),u([h({readOnly:!0,json:{read:!1,write:!0,default:!1}})],A.prototype,"hasM",void 0),u([h({type:T,nonNullable:!0,json:{write:!0}})],A.prototype,"vertexAttributes",void 0),A=M=u([k(U)],A);const de=b(),ct=Ze(),ut=A,Ie=()=>y.getLogger("esri.rest.support.meshFeatureSet");function Ir(e,t,n){const r=n.features;n.features=[],delete n.geometryType;const o=mn.fromJSON(n);if(o.geometryType="mesh",!n.assetMaps)return o;const s=Ut(t,n.assetMaps),i=e.sourceSpatialReference??gn.WGS84,l=n.globalIdFieldName,{outFields:c}=e,a=c!=null&&c.length>0?Nr(c.includes("*")?null:new Set(c)):()=>({});for(const p of r){const f=Nt(p,l,i,t,s);f!=null&&o.features.push(new dn({geometry:f,attributes:a(p)}))}return o}function Nr(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const n in t)e.has(n)||delete t[n];return t}}function Nt(e,t,n,r,o){const s=e.attributes[t],i=o.get(s);if(i==null)return Ie().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return Ie().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:l,originVector:c}=Ur(e,n,r),a=Ue.fromJSON(e.geometry);a.spatialReference=n;const p=Wr(e.attributes,r),f=i.projectVertices?new wt({origin:c}):new $e({origin:c}),m=kr(i);return m?ut.createWithExternalSource(l,m,{extent:a,transform:p,vertexSpace:f}):ut.createIncomplete(l,{extent:a,transform:p,vertexSpace:f})}function Ur({attributes:e},t,{transformFieldRoles:n}){const r=e[n.originX],o=e[n.originY],s=e[n.originZ];return{originPoint:new I({x:r,y:o,z:s,spatialReference:t}),originVector:yn(r,o,s)}}function Wr(e,{transformFieldRoles:t}){return new ne({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var te;function Ut(e,t){const n=new Map;for(const r of t){const o=r.parentGlobalId;if(o==null)continue;const s=r.assetName,i=r.assetType,l=r.assetHash,c=r.assetURL,a=r.conversionStatus,p=r.seqNo,f=wn(i,e.supportedFormats);if(!f){Ie().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const m=Ke(n,o,()=>({projectVertices:Hr(r.flags).projectVertices,files:new Map}));Ke(m.files,s,()=>({name:s,type:i,mimeType:f,status:zr(a),parts:[]})).parts[p]={hash:l,url:c}}return n}function kr(e){const t=Array.from(e.files.values()),n=new Array;for(const r of t){if(r.status!==te.COMPLETED)return null;const o=new Array;for(const s of r.parts){if(!s)return null;o.push(new En(s.url,s.hash))}n.push(new Cn(r.name,r.mimeType,o))}return n}function zr(e){switch(e){case"COMPLETED":case"SUBMITTED":return te.COMPLETED;case"INPROGRESS":return te.PENDING;default:return te.FAILED}}function Hr(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}(function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"})(te||(te={}));const co=Object.freeze(Object.defineProperty({__proto__:null,assetMapFromAssetMapsJSON:Ut,extractMesh:Nt,meshFeatureSetFromJSON:Ir},Symbol.toStringTag,{value:"Module"}));export{ce as a,co as b,Pn as c,re as g,le as m,T as p};