import{n as It}from"./deduplicate.b87c02b8.js";import{T as _}from"./InterleavedLayout.7e8c844d.js";import{O as u}from"./VertexAttribute.42396f25.js";import{C as D}from"./enums.2d9e6f64.js";import{t as At}from"./VertexElementDescriptor.1fdca6da.js";import{dj as nt,fq as ht,fr as Ot,G as W,fs as ot,ft as z,fu as St,fv as wt,fw as lt,fx as rt,fy as ut,fz as Tt,E,b7 as Et,fA as vt}from"./index.6c049565.js";function Y(t,e=0){const o=t.stride;return t.fieldNames.filter(s=>{const r=t.fields.get(s).optional;return!(r&&r.glPadding)}).map(s=>{const r=t.fields.get(s),c=r.constructor.ElementCount,g=$t(r.constructor.ElementType),a=r.offset,p=!(!r.optional||!r.optional.glNormalized);return new At(s,c,g,a,o,p,e)})}function $t(t){const e=Pt[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const Pt={u8:D.UNSIGNED_BYTE,u16:D.UNSIGNED_SHORT,u32:D.UNSIGNED_INT,i8:D.BYTE,i16:D.SHORT,i32:D.INT,f32:D.FLOAT},yt=_().vec3f(u.POSITION).u16(u.COMPONENTINDEX).u16(u.U16PADDING),Dt=_().vec2u8(u.SIDENESS);Y(Dt);const gt=_().vec3f(u.POSITION0).vec3f(u.POSITION1).u16(u.COMPONENTINDEX).u8(u.VARIANTOFFSET,{glNormalized:!0}).u8(u.VARIANTSTROKE).u8(u.VARIANTEXTENSION,{glNormalized:!0}).u8(u.U8PADDING,{glPadding:!0}).u16(u.U16PADDING,{glPadding:!0}),X=gt.clone().vec3f(u.NORMAL),K=gt.clone().vec3f(u.NORMALA).vec3f(u.NORMALB);u.POSITION0,u.POSITION1,u.COMPONENTINDEX,u.VARIANTOFFSET,u.VARIANTSTROKE,u.VARIANTEXTENSION,u.NORMAL,u.NORMALA,u.NORMALB,u.SIDENESS;const V=-1;var st;function Vt(t,e,o,s=Ft){const r=t.vertices.position,c=t.vertices.componentIndex,g=nt(s.anglePlanar),a=nt(s.angleSignificantEdge),p=Math.cos(a),f=Math.cos(g),l=k.edge,I=l.position0,A=l.position1,d=l.faceNormal0,v=l.faceNormal1,h=_t(t),$=xt(t),n=$.length/4,i=e.allocate(n);let m=0;const N=n,O=o.allocate(N);let T=0,P=0,S=0;const Q=ht(0,n),F=new Float32Array(n);Ot(F,(L,w,x)=>{r.getVec($[4*w+0],I),r.getVec($[4*w+1],A),x[w]=Tt(I,A)}),Q.sort((L,w)=>F[w]-F[L]);const Z=new Array,tt=new Array;for(let L=0;Le}function Rt(t,e){const o=St(t.cosAngle),s=k.fwd,r=k.ortho;return wt(s,t.position1,t.position0),o*(z(lt(r,t.faceNormal0,t.faceNormal1),s)>0?-1:1)>e}function xt(t){const e=t.faces.length/3,o=t.faces,s=t.neighbors;let r=0;for(let a=0;a{n{if(n{const m=2*n,N=i-n;for(let O=1;O=0&&f[m+2*S]>T;S--)f[m+2*S+2]=f[m+2*S],f[m+2*S+3]=f[m+2*S+1];f[m+2*S+2]=T,f[m+2*S+3]=P}};for(let n=0;nn===t[3*i]?0:n===t[3*i+1]?1:n===t[3*i+2]?2:-1,h=(n,i)=>{const m=v(n,i);d[3*i+m]=-1},$=(n,i,m,N)=>{const O=v(n,i);d[3*i+O]=N;const T=v(m,N);d[3*N+T]=i};for(let n=0;n