1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/loader-BVcPMAjs.js","assets/index-BdMpjrZC.js","assets/index-D8MutIMi.css","assets/quat-DyX4Pz4x.js","assets/quatf64-aQ5IuZRd.js","assets/BufferView-j5PJU4Em.js","assets/resourceUtils-BgvyNOhC.js"])))=>i.map(i=>d[i]); 2import{m7 as ce,m8 as fe,kn as V,cQ as Y,jP as z,i9 as me,m9 as Z,ck as H,k$ as ee,L as de,bO as te,aE as pe,ia as re,lU as k,s as he,ma as xe,_ as ge,cp as ye,cn as be,cj as q,fL as Q,eD as Te,mb as W,eE as we,cH as ve,fz as $e,fi as Me,mc as G,md as Ae,iA as Re,iB as K,iC as Be}from"./index-BdMpjrZC.js";import{m as se,n as U}from"./OutputColorHighlightOID.glsl-D3mkd1sf.js";import{o as ne,T as oe,g as Pe,M as Se,O as Ee,V as Ie}from"./BufferView-j5PJU4Em.js";import{r as Oe,n as Ce,d as N,l as J}from"./vec3-DuGGm54K.js";import{o as _e,d as X}from"./vec4-DU5LGtaO.js";import{l as Ue,o as Fe,n as ke}from"./indexUtils-CPNPqChv.js";import{t as F}from"./resourceUtils-BgvyNOhC.js";import{t as je}from"./NestedMap-B93H1Ttm.js";import{A as Le}from"./Indices-ClZTd2iv.js";import{t as De}from"./requestImageUtils-h0Z1-KLG.js";import{t as I}from"./orientedBoundingBox-DbVPNrch.js";import{M as ae}from"./Texture-R2FfGVZi.js";import{P as j,n as Ve,o as qe,s as Ge,t as ze}from"./RealisticTree.glsl-DbRJq4HV.js";function C(r){if(r==null)return null;const t=r.offset!=null?r.offset:ce,n=r.rotation!=null?r.rotation:0,s=r.scale!=null?r.scale:fe,u=V(1,0,0,0,1,0,t[0],t[1],1),i=V(Math.cos(n),-Math.sin(n),0,Math.sin(n),Math.cos(n),0,0,0,1),o=V(s[0],0,0,0,s[1],0,0,0,1),a=Y();return z(a,i,o),z(a,u,a),a}class He{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class Qe{constructor(t,n,s){this.name=t,this.lodThreshold=n,this.pivotOffset=s,this.stageResources=new He,this.numberOfVertices=0}}const R=()=>pe.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class We{constructor(t,n,s){this.resource=t,this.textures=n,this.usedMemory=s}}async function Ke(r,t){const n=await Ne(r,t),s=await et(n.textureDefinitions??{},t);let u=0;for(const i in s)if(s.hasOwnProperty(i)){const o=s[i];u+=o?.image?o.image.width*o.image.height*4:0}return new We(n,s,u+me(n))}async function Ne(r,t){const n=t?.streamDataRequester;if(n)return Je(r,n,t);const s=await ee(de(r,t));if(s.ok===!0)return s.value.data;te(s.error),ie(s.error)}async function Je(r,t,n){const s=await ee(t.request(r,0,n));if(s.ok===!0)return s.value;te(s.error),ie(s.error.details.url)}function ie(r){throw new he("",`Request for object resource failed: ${r}`)}function Xe(r){const t=r.params,n=t.topology;let s=!0;switch(t.vertexAttributes||(R().warn("Geometry must specify vertex attributes"),s=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const i=t.faces;if(i){if(t.vertexAttributes)for(const o in t.vertexAttributes){const a=i[o];a?.values?(a.valueType!=null&&a.valueType!=="UInt32"&&(R().warn(`Unsupported indexed geometry indices type '${a.valueType}', only UInt32 is currently supported`),s=!1),a.valuesPerElement!=null&&a.valuesPerElement!==1&&(R().warn(`Unsupported indexed geometry values per element '${a.valuesPerElement}', only 1 is currently supported`),s=!1)):(R().warn(`Indexed geometry does not specify face indices for '${o}' attribute`),s=!1)}}else R().warn("Indexed geometries must specify faces"),s=!1;break}default:R().warn(`Unsupported topology '${n}'`),s=!1}r.params.material||(R().warn("Geometry requires material"),s=!1);const u=r.params.vertexAttributes;for(const i in u)u[i].values||(R().warn("Geometries with externally defined attributes are not yet supported"),s=!1);return s}function Ye(r,t){const n=new Array,s=new Array,u=new Array,i=new je,o=r.resource,a=Z.parse(o.version||"1.0","wosr");rt.validate(a);const f=o.model.name,e=o.model.geometries,l=o.materialDefinitions??{},c=r.textures;let x=0;const d=new Map;for(let g=0;g<e.length;g++){const m=e[g];if(!Xe(m))continue;const w=tt(m),b=m.params.vertexAttributes,v=[],y=p=>{if(m.params.topology==="PerAttributeArray")return null;const T=m.params.faces;for(const h in T)if(h===p)return T[h].values;return null},$=b.position,_=$.values.length/$.valuesPerElement;for(const p in b){const T=b[p],h=T.values,D=y(p)??Le(_);v.push([p,new I(h,D,T.valuesPerElement,!0)])}
2const M=w.texture,B=c&&c[M];if(B&&!d.has(M)){const{image:p,parameters:T}=B,h=new ae(p,T);s.push(h),d.set(M,h)}const O=d.get(M),P=O?O.id:void 0,S=w.material;let A=i.get(S,M);if(A==null){const p=l[S.slice(S.lastIndexOf("/")+1)].params;p.transparency===1&&(p.transparency=0);const T=B?le(B.alphaChannelUsage):void 0,h={ambient:H(p.diffuse),diffuse:H(p.diffuse),opacity:1-(p.transparency||0),textureAlphaMode:T,textureAlphaCutoff:.33,textureId:P,doubleSided:!0,cullFace:0,colorMixMode:p.externalColorMixMode||"tint",textureAlphaPremultiplied:B?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(h,t.materialParameters),A=new j(h,t),i.set(S,M,A)}u.push(A);const L=new se(A,v);x+=v.find(p=>p[0]==="position")?.[1]?.indices.length??0,n.push(L)}return{engineResources:[{name:f,stageResources:{textures:s,materials:u,geometries:n},pivotOffset:o.model.pivotOffset,numberOfVertices:x,lodThreshold:null}],referenceBoundingBox:Ze(n)}}function Ze(r){const t=re();return r.forEach(n=>{const s=n.boundingInfo;s!=null&&(k(t,s.bbMin),k(t,s.bbMax))}),t}async function et(r,t){const n=new Array;for(const i in r){const o=r[i],a=o.images[0].data;if(!a){R().warn("Externally referenced texture data is not yet supported");continue}const f=o.encoding+";base64,"+a,e="/textureDefinitions/"+i,l=o.channels==="rgba"?o.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:le(l)!==1},x=t?.disableTextures?Promise.resolve(null):De(f,t);n.push(x.then(d=>({refId:e,image:d,parameters:c,alphaChannelUsage:l})))}const s=await Promise.all(n),u={};for(const i of s)u[i.refId]=i;return u}function le(r){switch(r){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function tt(r){const t=r.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const rt=new Z(1,2,"wosr");async function st(r,t){const n=ue(xe(r));if(n.fileType==="wosr"){const c=await(t.cache?t.cache.loadWOSR(n.url,t):Ke(n.url,t)),{engineResources:x,referenceBoundingBox:d}=Ye(c,t);return{lods:x,referenceBoundingBox:d,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(n.url,t,!!t.usePBR);else{const{loadGLTF:c}=await ge(()=>import("./loader-BVcPMAjs.js"),__vite__mapDeps([0,1,2,3,4,5,6]));s=await c(new Ue(t.streamDataRequester),n.url,t,t.usePBR)}const u=s.model.meta?.ESRI_proxyEllipsoid,i=s.meta.isEsriSymbolResource&&u!=null&&s.meta.ESRI_webstyle==="EsriRealisticTreesStyle";i&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,lt(s,u));const o=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:o,isSchematic:!1,treeRendering:i,mrrFactors:Ge}:{usePBR:o,isSchematic:!1,treeRendering:!1,mrrFactors:ze},f={...t.materialParameters,treeRendering:i},{engineResources:e,referenceBoundingBox:l}=nt(s,a,f,t,n.specifiedLodIndex,i);return{lods:e,referenceBoundingBox:l,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function ue(r){const t=r.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:t[4]!=null?Number(t[4]):null}:r.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:r,specifiedLodIndex:null}:{fileType:"unknown",url:r,specifiedLodIndex:null}}function nt(r,t,n,s,u,i){const o=r.model,a=new Array,f=new Map,e=new Map,l=o.lods.length,c=re();return o.lods.forEach((x,d)=>{const g=s.skipHighLods===!0&&(l>1&&d===0||l>3&&d===1)||s.skipHighLods===!1&&u!=null&&d!==u;if(g&&d!==0)return;const m=new Qe(x.name,x.lodThreshold,[0,0,0]);x.parts.forEach(w=>{const b=g?new j({},s):ot(o,w,m,t,n,f,e,s,i),{geometry:v,vertexCount:y}=at(w,b??new j({},s)),$=v.boundingInfo;$!=null&&d===0&&(k(c,$.bbMin),k(c,$.bbMax)),b!=null&&(m.stageResources.geometries.push(v),m.numberOfVertices+=y)}),g||a.push(m)}),{engineResources:a,referenceBoundingBox:c}}function ot(r,t,n,s,u,i,o,a,f){const e=r.materials.get(t.material);if(e==null)return null;const{normal:l,color:c,texCoord0:x,tangent:d}=t.attributes,g=t.material+(l?"_normal":"")+(c?"_color":"")+(x?"_texCoord0":"")+(d?"_tangent":""),m=t.attributes.texCoord0!=null,w=t.attributes.normal!=null,b=it(e.alphaMode);
2if(!i.has(g)){if(m){const P=(A,L=!1,p=!1)=>{if(A!=null&&!o.has(A)){const T=r.textures.get(A);if(T){const h=T.data,D=L&&!F(h)?a.compressionOptions:void 0;o.set(A,new ae(F(h)?h.data:h,{...T.parameters,preMultiplyAlpha:!F(h)&&p,encoding:F(h)?h.encoding:void 0,compressionOptions:D}))}}},S=b!==1&&!f;P(e.colorTexture,S,b!==1),P(e.normalTexture),P(e.occlusionTexture,!0),P(e.emissiveTexture),P(e.metallicRoughnessTexture,!0)}const y=G(e.color[0]),$=G(e.color[1]),_=G(e.color[2]),M=e.colorTexture!=null&&m?o.get(e.colorTexture):null,B=Ve(e),O=e.normalTextureTransform?.scale!=null?e.normalTextureTransform?.scale:Ae;i.set(g,new j({...s,customDepthTest:1,textureAlphaMode:b,textureAlphaCutoff:e.alphaCutoff,diffuse:[y,$,_],ambient:[y,$,_],opacity:e.alphaMode==="OPAQUE"?1:e.opacity,doubleSided:e.doubleSided,doubleSidedType:"winding-order",cullFace:e.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:w?0:2,castShadows:!0,receiveShadows:e.receiveShadows,receiveAmbientOcclusion:e.receiveAmbientOcclusion,textureId:M?.id,colorMixMode:e.colorMixMode,normalTextureId:e.normalTexture!=null&&m?o.get(e.normalTexture).id:void 0,textureAlphaPremultiplied:M!=null&&!!M.parameters.preMultiplyAlpha,occlusionTextureId:e.occlusionTexture!=null&&m?o.get(e.occlusionTexture).id:void 0,emissiveTextureId:e.emissiveTexture!=null&&m?o.get(e.emissiveTexture).id:void 0,metallicRoughnessTextureId:e.metallicRoughnessTexture!=null&&m?o.get(e.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[e.emissiveFactor[0],e.emissiveFactor[1],e.emissiveFactor[2]],mrrFactors:B?qe:[e.metallicFactor,e.roughnessFactor,s.mrrFactors[2]],isSchematic:B,colorTextureTransformMatrix:C(e.colorTextureTransform),normalTextureTransformMatrix:C(e.normalTextureTransform),scale:[O[0],O[1]],occlusionTextureTransformMatrix:C(e.occlusionTextureTransform),emissiveTextureTransformMatrix:C(e.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:C(e.metallicRoughnessTextureTransform),...u},a))}const v=i.get(g);if(n.stageResources.materials.push(v),m){const y=$=>{$!=null&&n.stageResources.textures.push(o.get($))};y(e.colorTexture),y(e.normalTexture),y(e.occlusionTexture),y(e.emissiveTexture),y(e.metallicRoughnessTexture)}return v}function at(r,t){const n=r.attributes.position.count,s=Fe(r.indices||n,r.primitiveType),u=U(3*n),{typedBuffer:i,typedBufferStride:o}=r.attributes.position;Oe(u,i,r.transform,3,o);const a=[["position",new I(u,s,3,!0)]];if(r.attributes.normal!=null){const e=U(3*n),{typedBuffer:l,typedBufferStride:c}=r.attributes.normal;Re(E,r.transform),Ce(e,l,E,3,c),K(E)&&N(e,e),a.push(["normal",new I(e,s,3,!0)])}if(r.attributes.tangent!=null){const e=U(4*n),{typedBuffer:l,typedBufferStride:c}=r.attributes.tangent;Be(E,r.transform),_e(e,l,E,4,c),K(E)&&N(e,e,4),a.push(["tangent",new I(e,s,4,!0)])}if(r.attributes.texCoord0!=null){const e=U(2*n),{typedBuffer:l,typedBufferStride:c}=r.attributes.texCoord0;ke(e,l,2,c),a.push(["uv0",new I(e,s,2,!0)])}const f=r.attributes.color;if(f!=null){const e=new Uint8Array(4*n);f.elementCount===4?f instanceof oe?X(e,f,1,255):(f instanceof Pe||f instanceof Se)&&X(e,f,1/255,255):(e.fill(255),f instanceof ne?J(e,f.typedBuffer,1,255,4,f.typedBufferStride):(r.attributes.color instanceof Ee||r.attributes.color instanceof Ie)&&J(e,f.typedBuffer,1/255,255,4,r.attributes.color.typedBufferStride)),a.push(["color",new I(e,s,4,!0)])}return{geometry:new se(t,a),vertexCount:n}}const E=Y();function it(r){switch(r){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function lt(r,t){for(let n=0;n<r.model.lods.length;++n){const s=r.model.lods[n];for(const u of s.parts){const i=u.attributes.normal;if(i==null)return;const o=u.attributes.position,a=o.count,f=q(),e=q(),l=q(),c=new Float32Array(4*a),x=new Float32Array(3*a),d=ye(be(),u.transform);let g=0,m=0;for(let w=0;w<a;w++){o.getVec(w,e),i.getVec(w,f),Q(e,e,u.transform),Te(l,e,t.center),W(l,l,t.radius);const b=l[2],v=we(l),y=Math.min(.45+.55*v*v,1)**Me;W(l,l,t.radius),d!==null&&Q(l,l,d),ve(l,l),n+1!==r.model.lods.length&&r.model.lods.length>1&&$e(l,l,f,b>
2-1?.2:Math.min(-4*b-3.8,1)),x[g]=l[0],x[g+1]=l[1],x[g+2]=l[2],g+=3,c[m]=y,c[m+1]=y,c[m+2]=y,c[m+3]=1,m+=4}u.attributes.normal=new ne(x.buffer),u.attributes.color=new oe(c.buffer)}}}const vt=Object.freeze(Object.defineProperty({__proto__:null,fetch:st,parseUrl:ue},Symbol.toStringTag,{value:"Module"}));export{vt as o,C as s,st as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.