@mapvx/web-components-ssr 1.6.1-dev.1 → 1.7.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,348 @@
1
+ import"./main.js";import{X as v}from"./chunk-CzASft0S.js";import{K as kv,S as Vv,X as pe$1,Y as on,a as Hr,b as Uf,it as ze,t as De}from"./chunk-BK2bFfek.js";function p(t,e,n=!1){if(n)return e===1?`float`:`vec${e}`;switch(t){case`uint8`:case`uint16`:case`uint32`:return e===1?`uint`:`uvec${e}`;case`sint8`:case`sint16`:case`sint32`:return e===1?`int`:`ivec${e}`;default:return e===1?`float`:`vec${e}`}}function L(t,e,n=!1){let r;if(n)switch(t){case`uint8`:r=`unorm8`;break;case`sint8`:r=`snorm8`;break;case`uint16`:r=`unorm16`;break;case`sint16`:r=`snorm16`;break;case`float32`:r=`float32`;break;default:throw new Error(`Unsupported normalized vertex format for ${t}`)}else r=t;return e===1?r:e===3&&!r.startsWith(`float32`)&&!r.endsWith(`32`)?`${r}x3-webgl`:`${r}x${e}`}function T(t){switch(t[0]){case`u`:return`0u`;case`s`:return`0`;default:return`0.`}}function k(t,e){switch(t){case`uint8`:case`uint16`:case`uint32`:return`${Math.trunc(e)}u`;case`sint8`:case`sint16`:case`sint32`:return`${Math.trunc(e)}`;default:return Number.isInteger(e)?`${e}.0`:`${e}`}}function D(t){switch(t){case`uint8`:return`r8uint`;case`sint8`:return`r8sint`;case`uint16`:return`r16uint`;case`sint16`:return`r16sint`;case`uint32`:return`r32uint`;case`sint32`:return`r32sint`;case`float32`:return`r32float`;default:throw new Error(`Unsupported WebGL gather texture format for ${t}`)}}function V(t){switch(t){case`uint32`:return`usampler2D`;case`sint32`:return`isampler2D`;case`float32`:return`sampler2D`;default:throw new Error(`Unsupported WebGL gather sampler type for ${t}`)}}var W=`GPGPU Operation Counts`;var J=`Transform Runs`;var K=new on;function g({module:t,elementWise:e=!1,expression:n,inputs:r,output:i,operationType:s=i.type,outputBuffer:a}){let u=a.device,o=y(`result`,i.type,i.size,i.normalized),f=[t,o],d=[],c={},l=p(i.type,1,i.normalized),x=p(s,1,i.normalized),b=``,$=null,M={TYPE:x,RESULT_LEN:i.size.toString()},z=Q(r);for(let[m,h]of z)f.push(I(m,h.type,h.size,h.normalized,s)),d.push(R(m,h)),h instanceof pe$1?c[m]=h.buffer:($=$||ze.createOrReuse(u,a.byteLength),c[m]=$),b+=`TYPE ${m}[${h.size}]; get_${m}(${m});
2
+ `,M[`${m.toUpperCase()}_LEN`]=h.size.toString();let w=``;if(n)for(let m=0;m<i.size;m++)w+=`result[${m}]=${n(m)};
3
+ `;else if(e)for(let m=0;m<i.size;m++){let h=T(x),j=z.map(([H,Z])=>m<Z.size?`${H}[${m}]`:h);w+=`result[${m}]=${t.name}(${j.join(`, `)});
4
+ `}else w=`${t.name}(${z.map(([m])=>m).join(`, `)}, result);`;let q=new Hr(u,{vs:`#version 300 es
5
+
6
+ void main() {
7
+ ${b}
8
+ ${l} result[${i.size}];
9
+ ${w}
10
+ set_result(result);
11
+ }
12
+ `,shaderAssembler:K,defines:M,modules:f,bufferLayout:d,vertexCount:1,instanceCount:i.length,attributes:c,feedbackBufferMode:`interleaved`,outputs:o.varyings});u.statsManager.getStats(W).get(J).incrementCount(),q.run({inputBuffers:c,outputBuffers:{[o.varyings[0]]:i.offset===0?a:{buffer:a,byteOffset:i.offset,byteLength:i.byteLength}}}),$&&ze.recycle($)}function Q(t){return Array.isArray(t)?t.map((e,n)=>[`x${n}`,e]):Object.entries(t)}function I(t,e,n,r=!1,i=e){let s=``,a=``;for(let o=0;o<n;o+=4){let f=Math.min(n-o,4),d=p(e,f,r);s+=`in ${d} a${t}_${o};
13
+ `;for(let c=0;c<f;c++){let l=`a${t}_${o}`;f>1&&(l=`${l}[${c}]`),(r||e!==i)&&(l=`TYPE(${l})`),a+=`v[${o+c}]=${l};
14
+ `}}return{name:t,vs:`
15
+ ${s}
16
+ void get_${t}(out TYPE v[${n}]) {
17
+ ${a}
18
+ }
19
+ `}}function R(t,e){let n={name:t,stepMode:e.isConstant?`vertex`:`instance`,byteStride:e.stride,attributes:[]};for(let r=0;r<e.size;r+=4){let i=Math.min(e.size-r,4);n.attributes.push({attribute:`a${t}_${r}`,format:L(e.type,i,e.normalized),byteOffset:e.offset+e.ValueType.BYTES_PER_ELEMENT*r})}return n}function y(t,e,n,r=!1){let i=[],s=p(e,1,r),a=``,u=``;for(let o=0;o<n;o+=4){let f=Math.min(n-o,4),d=p(e,f,r);i.push(`${t}_${o}`),a+=`flat out ${d} ${t}_${o};
20
+ `;let c=Array.from({length:f},(l,x)=>o+x);u+=`${t}_${o} = ${d}(${c.map(l=>`v[${l}]`).join(`,`)});
21
+ `}return{name:t,varyings:i,vs:`
22
+ ${a}
23
+ void set_${t}(in ${s} v[${n}]) {
24
+ ${u}
25
+ }
26
+ `}}var ee=`TYPE arithmetic_add(TYPE x, TYPE y) {
27
+ return x + y;
28
+ }
29
+
30
+ TYPE arithmetic_subtract(TYPE x, TYPE y) {
31
+ return x - y;
32
+ }
33
+
34
+ TYPE arithmetic_multiply(TYPE x, TYPE y) {
35
+ return x * y;
36
+ }
37
+
38
+ TYPE arithmetic_divide(TYPE x, TYPE y) {
39
+ return x / y;
40
+ }
41
+
42
+ float arithmetic_tan(float x) {
43
+ return tan_fp32(x);
44
+ }
45
+ `;var A=({inputs:t,output:e,target:n})=>{let r=e.type,i=p(r,1,e.normalized),s=T(i),a=t.namedInputs;return g({module:{name:`arithmetic`,dependencies:[Uf],vs:ee},inputs:a,output:e,operationType:r,outputBuffer:n,expression:u=>kv(t.expression,{operations:Vv,inputs:a,laneIndex:u,formatInput:o=>`${o}[${u}]`,formatOutOfBoundsInput:o=>a[o].size===1?`${o}[0]`:s,formatLiteral:o=>{let f=Array.isArray(o)?o[u]??0:o;return`${i}(${k(r,f)})`},formatCall:(o,f)=>`${o}(${f.join(`, `)})`})}),{success:!0}};var te=`GPGPU Operation Counts`;var re=`Transform Runs`;var ne=({inputs:t,output:e,target:n})=>{let{sourceValues:r}=t,i=n.device;if(r.length===0){let c=new e.ValueType(e.length*e.size);return n.write(c),{success:!0,value:c}}if(r.isConstant){let c=r.value,l=new e.ValueType(e.length*e.size);for(let x=0;x<e.length;x++){let b=c[x];l[x*2]=b,l[x*2+1]=b}return n.write(l),{success:!0,value:l}}let s=i.createTexture({width:1,height:e.length,format:`rg32float`,usage:v.RENDER|v.COPY_SRC|v.COPY_DST}),a=i.createFramebuffer({colorAttachments:[s]}),f=new De(i,{vs:`#version 300 es
46
+
47
+ flat out float extent_value;
48
+
49
+ void main() {
50
+ float sourceValues[SOURCE_VALUES_LEN];
51
+ get_sourceValues(sourceValues);
52
+ extent_value = sourceValues[gl_VertexID];
53
+
54
+ float y = (float(gl_VertexID) + 0.5) / float(CHANNEL_COUNT) * 2.0 - 1.0;
55
+ gl_Position = vec4(0.0, y, 0.0, 1.0);
56
+ gl_PointSize = 1.0;
57
+ }
58
+ `,fs:`#version 300 es
59
+
60
+ precision highp float;
61
+
62
+ flat in float extent_value;
63
+ out vec2 fragColor;
64
+
65
+ void main() {
66
+ fragColor = vec2(-extent_value, extent_value);
67
+ }
68
+ `,topology:`point-list`,parameters:{depthCompare:`always`,blend:!0,blendColorSrcFactor:`one`,blendColorDstFactor:`one`,blendColorOperation:`max`,blendAlphaSrcFactor:`one`,blendAlphaDstFactor:`one`,blendAlphaOperation:`max`},modules:[I(`sourceValues`,r.type,r.size,r.normalized)],defines:{TYPE:`float`,SOURCE_VALUES_LEN:r.size.toString(),CHANNEL_COUNT:e.length.toString()},attributes:{sourceValues:r.buffer},bufferLayout:[R(`sourceValues`,r)],instanceCount:r.length,vertexCount:e.length,disableWarnings:!0}),d=ze.createOrReuse(i,e.byteLength);try{let c=i.beginRenderPass({framebuffer:a,parameters:{viewport:[0,0,1,e.length]},clearColor:[-G,-G,0,0],clearDepth:!1,clearStencil:!1});i.statsManager.getStats(te).get(re).incrementCount(),f.draw(c),c.end();let l=i.createCommandEncoder();return l.copyTextureToBuffer({sourceTexture:s,width:1,height:e.length,destinationBuffer:d,byteOffset:0,bytesPerRow:8}),i.submit(l.finish()),A({device:i,inputs:{expression:{kind:`call`,op:`multiply`,args:[{kind:`input`,name:`x`},{kind:`literal`,value:[-1,1]}]},namedInputs:{x:new pe$1({buffer:d,size:2,type:`float32`,length:e.length})}},output:e,target:n})}finally{f.destroy(),ze.recycle(d),a.destroy(),s.destroy()}};var G=3e38;var ie=({inputs:t,output:e,target:n})=>{let r=t.map((o,f)=>[`x${f}`,o]);oe(n.device.limits.maxVertexAttributes,r),se(n.device.limits.maxInterStageShaderVariables,e);let i=r.map(([o,f])=>`in TYPE ${o}[${f.size}]`).join(`, `),s=0;return g({module:{name:`interleave`,vs:`void interleave(${i}, out TYPE result[RESULT_LEN]) {
69
+ ${r.map(([o,f])=>{let d=Array.from({length:f.size},(c,l)=>` result[${s+l}] = ${o}[${l}];`).join(`
70
+ `);return s+=f.size,d}).join(`
71
+ `)}
72
+ }
73
+ `},inputs:t,output:e,outputBuffer:n}),{success:!0}};function oe(t,e){let n=e.reduce((r,[,i])=>r+Math.ceil(i.size/4),0);if(n>t)throw new Error(`interleave() requires ${n} vertex attributes, exceeding device limit ${t}`)}function se(t,e){if(e.size>t)throw new Error(`interleave() output size ${e.size} exceeds device inter-stage component limit ${t}`)}function ae(){let t=new Uint16Array([255]);return new Uint8Array(t.buffer)[0]>0}var ue=`#define LE ${ae()?1:0}
74
+ const uint F32_NAN = 0xffffffffu;
75
+ const uint F32_INF = 0x7f800000u;
76
+
77
+ // Find first set bit using binary search
78
+ // https://en.wikipedia.org/wiki/Find_first_set#CLZ
79
+ int countLeadingZeros(uint a) {
80
+ if (a == 0u) return 32;
81
+ int n = 0;
82
+ if ((a & 0xffff0000u) == 0u) { n += 16; a = a << 16; }
83
+ if ((a & 0xff000000u) == 0u) { n += 8; a = a << 8; }
84
+ if ((a & 0xf0000000u) == 0u) { n += 4; a = a << 4; }
85
+ if ((a & 0xc0000000u) == 0u) { n += 2; a = a << 2; }
86
+ if ((a & 0x80000000u) == 0u) return n + 1;
87
+ return n;
88
+ }
89
+
90
+ uint roundShiftRight(uint value, int shift) {
91
+ if (shift <= 0) {
92
+ return value << (-shift);
93
+ }
94
+
95
+ if (shift >= 32) {
96
+ if (shift == 32 && value > 0x80000000u) {
97
+ return 1u;
98
+ }
99
+ return 0u;
100
+ }
101
+
102
+ uint truncated = value >> shift;
103
+ uint halfShift = 1u << (shift - 1);
104
+ uint remainder = value & ((1u << shift) - 1u);
105
+ if (remainder > halfShift || (remainder == halfShift && (truncated & 1u) == 1u)) {
106
+ return truncated + 1u;
107
+ }
108
+ return truncated;
109
+ }
110
+
111
+ uint makeFloat_(uint sign, int exponent, uint mantissa) {
112
+ return (sign << 31) | (uint(exponent + 127) << 23) | (mantissa & 0x7fffffu);
113
+ }
114
+
115
+ /**
116
+ * Assemble a float32 in bit representation according to IEEE 754
117
+ * https://en.wikipedia.org/wiki/Single-precision_floating-point_format
118
+ */
119
+ uint makeFloat(uint sign, int exponent, uint significand) {
120
+ if (significand == 0u) {
121
+ return sign << 31;
122
+ }
123
+
124
+ // Remove any extra leading zeros for better precision
125
+ int lead_zeros = countLeadingZeros(significand);
126
+ // Significand is encoded as 1.fraction
127
+ int normalizedExponent = exponent + 31 - lead_zeros;
128
+
129
+ if (normalizedExponent > 127) {
130
+ return (sign << 31) | F32_INF;
131
+ }
132
+
133
+ uint mantissa;
134
+ if (normalizedExponent >= -126) {
135
+ mantissa = roundShiftRight(significand, 8 - lead_zeros);
136
+ if (mantissa >= 0x1000000u) {
137
+ mantissa >>= 1;
138
+ normalizedExponent++;
139
+ if (normalizedExponent > 127) {
140
+ return (sign << 31) | F32_INF;
141
+ }
142
+ }
143
+ return makeFloat_(sign, normalizedExponent, mantissa);
144
+ }
145
+
146
+ int subnormalShift = -149 - exponent;
147
+ mantissa = roundShiftRight(significand, subnormalShift);
148
+ if (mantissa >= 0x800000u) {
149
+ return (sign << 31) | (1u << 23);
150
+ }
151
+ return (sign << 31) | mantissa;
152
+ }
153
+
154
+ /**
155
+ * Parse 8-byte memory as a float64 number according to IEEE 754
156
+ * https://en.wikipedia.org/wiki/Double-precision_floating-point_format
157
+ * Returns 8-byte memory as 2 float32 numbers, consisting of
158
+ * high part: fround(d)
159
+ * low part: d - fround(d)
160
+ */
161
+ uvec2 parseAsDouble(uvec2 d) {
162
+ #if LE
163
+ d = d.yx; // to big endian
164
+ #endif
165
+
166
+ uint sign = (d[0] >> 31) & 1u; // first bit
167
+ uint exponentBits = (d[0] >> 20) & 0x7ffu;
168
+ int exponent = int(exponentBits) - 1023; // next 11 bits
169
+ uint fractionHigh = d[0] & 0xfffffu;
170
+ uint fractionLow = d[1];
171
+
172
+ if (exponentBits == 0x7ffu) {
173
+ if (fractionHigh == 0u && fractionLow == 0u) {
174
+ return uvec2((sign << 31) | F32_INF, F32_NAN);
175
+ }
176
+ return uvec2(F32_NAN);
177
+ }
178
+
179
+ if (exponentBits == 0u) {
180
+ // All float64 subnormals are too small to survive a float32 split.
181
+ return uvec2(sign << 31);
182
+ }
183
+
184
+ if (exponent > 127) {
185
+ return uvec2((sign << 31) | F32_INF, ((1u - sign) << 31) | F32_INF);
186
+ }
187
+
188
+ uint hi_part;
189
+ uint low_part;
190
+
191
+ // float64 significand has 52 bits
192
+ // float32 significand has 23 bits
193
+ // The significand of the high part is the significand of the double, trimmed
194
+ uint f_hi = 0x800000u | (fractionHigh << 3) | (fractionLow >> 29);
195
+ uint f_low = fractionLow & 0x1fffffffu;
196
+
197
+ if (exponent < -126) {
198
+ // For tiny normals, the top 24 significand bits still contribute to the float32
199
+ // high part, but they land in the float32 subnormal range.
200
+ hi_part = makeFloat(sign, exponent - 23, f_hi);
201
+
202
+ // The residual keeps the remaining 29 significand bits at the original double scale.
203
+ low_part = makeFloat(sign, exponent - 52, f_low);
204
+ return uvec2(hi_part, low_part);
205
+ }
206
+
207
+ bool roundUp = f_low > 0x10000000u || (f_low == 0x10000000u && (f_hi & 1u) == 1u);
208
+
209
+ uint f_rounded = f_hi + (roundUp ? 1u : 0u);
210
+ int exponent_hi = exponent;
211
+ if (f_rounded == 0x1000000u) {
212
+ f_rounded = 0x800000u;
213
+ exponent_hi++;
214
+ }
215
+
216
+ if (exponent_hi > 127) {
217
+ // Overflows float32 limit
218
+ hi_part = (sign << 31) | F32_INF;
219
+ low_part = ((1u - sign) << 31) | F32_INF;
220
+ return uvec2(hi_part, low_part);
221
+ }
222
+
223
+ hi_part = makeFloat_(sign, exponent_hi, f_rounded);
224
+
225
+ int remainder = int(f_low);
226
+ uint sign_low = sign;
227
+ if (roundUp) {
228
+ remainder -= 0x20000000;
229
+ }
230
+ if (remainder < 0) {
231
+ sign_low = 1u - sign;
232
+ remainder = -remainder;
233
+ }
234
+ low_part = makeFloat(sign_low, exponent - 52, uint(remainder));
235
+
236
+ return uvec2(hi_part, low_part);
237
+ }
238
+
239
+ void fround(in uint x[X_LEN], out float result[X_LEN]) {
240
+ int n = X_LEN / 2;
241
+ for (int i = 0; i < n; i++) {
242
+ uvec2 f = parseAsDouble(uvec2(x[i * 2], x[i * 2 + 1]));
243
+ result[i] = uintBitsToFloat(f.x);
244
+ result[i + n] = uintBitsToFloat(f.y);
245
+ }
246
+ }
247
+ `;var fe=({inputs:t,output:e,target:n})=>(g({module:{name:`fround`,vs:ue},inputs:t,output:e,operationType:`uint32`,outputBuffer:n}),{success:!0});function P(t,e,n){let r=V(n),i=p(e,1),s=Array.from({length:t.size},(a,u)=>` v[${u}] = ${i}(texelFetch(source_values_texture, ivec2(${u}, rowIndex), 0).r);`).join(`
248
+ `);return{name:`source_values_texture`,vs:`
249
+ uniform highp ${r} source_values_texture;
250
+ void read_source_values(int rowIndex, out TYPE v[${t.size}]) {
251
+ ${s}
252
+ }
253
+ `}}function N(t,e,n){let r=n.createTexture({width:Math.max(t.size,1),height:t.length,format:D(e),usage:v.SAMPLE|v.COPY_DST});if(t.length===0)return r;let i=n.createCommandEncoder();return i.copyBufferToTexture({sourceBuffer:t.buffer,destinationTexture:r,byteOffset:t.offset,bytesPerRow:t.stride,rowsPerImage:t.length,size:[t.size,t.length,1]}),n.submit(i.finish()),r}var le=async({inputs:t,output:e,target:n})=>{let{ids:r,sourceValues:i}=t,s=n.device,a=y(`result`,e.type,e.size),u=p(r.type,1),o=p(e.type,1),f=e.type,d=N(i,f,s),l=new Hr(s,{vs:`#version 300 es
254
+
255
+ void main() {
256
+ INDEX_TYPE ids[1];
257
+ get_ids(ids);
258
+ TYPE result[${e.size}];
259
+ gather(ids, result);
260
+ set_result(result);
261
+ }
262
+ `,defines:{INDEX_TYPE:u,TYPE:o,RESULT_LEN:e.size.toString(),SOURCE_VALUES_ROWS:i.length.toString()},modules:[ce(r,u),P(i,e.type,f),de(e.type),a],bindings:{source_values_texture:d},bufferLayout:[me(r)],vertexCount:1,instanceCount:e.length,feedbackBufferMode:`interleaved`,outputs:a.varyings});try{return l.run({inputBuffers:{ids:r.buffer},outputBuffers:{[a.varyings[0]]:n}}),{success:!0}}finally{l.destroy(),d.destroy()}};function ce(t,e){let n=p(t.type,1),r=`aids_0`;return t.type!==pe(e)&&(r=`${e}(${r})`),{name:`ids`,vs:`
263
+ in ${n} aids_0;
264
+ void get_ids(out INDEX_TYPE v[1]) {
265
+ v[0] = ${r};
266
+ }
267
+ `}}function me(t){return{name:`ids`,stepMode:t.isConstant?`vertex`:`instance`,byteStride:t.stride,attributes:[{attribute:`aids_0`,format:L(t.type,1,t.normalized),byteOffset:t.offset}]}}function de(t){return{name:`gather`,vs:`
268
+ void zero_result(out TYPE result[RESULT_LEN]) {
269
+ for (int i = 0; i < RESULT_LEN; i++) {
270
+ result[i] = ${T(t)};
271
+ }
272
+ }
273
+
274
+ void gather(in INDEX_TYPE ids[1], out TYPE result[RESULT_LEN]) {
275
+ int sourceIndex = int(ids[0]);
276
+ if (sourceIndex < 0 || sourceIndex >= SOURCE_VALUES_ROWS) {
277
+ zero_result(result);
278
+ return;
279
+ }
280
+ read_source_values(sourceIndex, result);
281
+ }
282
+ `}}function pe(t){switch(t){case`uint`:return`uint32`;case`int`:return`sint32`;default:return`float32`}}var ge=`void row_dot(in TYPE x[X_LEN], in TYPE y[Y_LEN], out float result[1]) {
283
+ float sum = 0.0;
284
+ for (int i = 0; i < X_LEN; i++) {
285
+ sum += float(x[i]) * float(y[i]);
286
+ }
287
+ result[0] = sum;
288
+ }
289
+ `;var xe=({inputs:t,output:e,target:n})=>(g({module:{name:`row_dot`,vs:ge},inputs:t,output:e,operationType:`float32`,outputBuffer:n}),{success:!0});var he=`void equalAll(in TYPE x[X_LEN], in TYPE y[Y_LEN], out uint result[1]) {
290
+ uint allEqual = uint(1);
291
+ for (int i = 0; i < X_LEN; i++) {
292
+ if (x[i] != y[i]) {
293
+ allEqual = uint(0);
294
+ break;
295
+ }
296
+ }
297
+ result[0] = allEqual;
298
+ }
299
+ `;var _e=({inputs:t,output:e,target:n})=>(g({module:{name:`equalAll`,vs:he},inputs:t,output:e,operationType:e.type===`uint32`?t.x.type:e.type,outputBuffer:n}),{success:!0});var Te=`void row_length(in TYPE x[X_LEN], out float result[1]) {
300
+ float sum = 0.0;
301
+ for (int i = 0; i < X_LEN; i++) {
302
+ sum += float(x[i]) * float(x[i]);
303
+ }
304
+ result[0] = sqrt(sum);
305
+ }
306
+ `;var ve=({inputs:t,output:e,target:n})=>(g({module:{name:`row_length`,vs:Te},inputs:t,output:e,operationType:`float32`,outputBuffer:n}),{success:!0});var ye=async({inputs:t,output:e,target:n})=>{let{segments:r}=t,i=n.device,s=y(`result`,e.type,e.size),a=r.type,u=N(r,a,i),o=new Hr(i,{vs:`#version 300 es
307
+
308
+ void main() {
309
+ TYPE result[RESULT_LEN];
310
+ segmentedMap(result);
311
+ set_result(result);
312
+ }
313
+ `,defines:{TYPE:`uint`,RESULT_LEN:e.size.toString(),SEGMENTS_LENGTH:r.length.toString()},modules:[P(r,e.type,a),Ee(),s],bindings:{source_values_texture:u},vertexCount:1,instanceCount:e.length,feedbackBufferMode:`interleaved`,outputs:s.varyings});try{return o.run({outputBuffers:{[s.varyings[0]]:n}}),{success:!0}}finally{o.destroy(),u.destroy()}};function Ee(){return{name:`segmentedMap`,vs:`
314
+ uint read_segment_start(int segmentIndex) {
315
+ TYPE value[1];
316
+ read_source_values(segmentIndex, value);
317
+ return uint(value[0]);
318
+ }
319
+
320
+ void segmentedMap(out TYPE result[RESULT_LEN]) {
321
+ uint vertexIndex = uint(gl_InstanceID);
322
+ int low = 0;
323
+ int high = SEGMENTS_LENGTH;
324
+
325
+ while (low < high) {
326
+ int mid = low + (high - low) / 2;
327
+ uint midStart = read_segment_start(mid);
328
+ if (midStart <= vertexIndex) {
329
+ low = mid + 1;
330
+ } else {
331
+ high = mid;
332
+ }
333
+ }
334
+
335
+ uint segmentIndex = uint(max(low - 1, 0));
336
+ uint segmentStart = read_segment_start(int(segmentIndex));
337
+ result[0] = segmentIndex;
338
+ result[1] = vertexIndex - segmentStart;
339
+ }
340
+ `}}var be=async({inputs:t,output:e,target:n})=>{let i=T(p(e.type,1,e.normalized));return g({module:{name:`select`,vs:``},inputs:t,output:e,operationType:e.type,outputBuffer:n,expression:s=>{let a=F(`condition`,t.condition,s,i),u=F(`whenTrue`,t.whenTrue,s,i),o=F(`whenFalse`,t.whenFalse,s,i);return`(${a} != ${i} ? ${u} : ${o})`}}),{success:!0}};function F(t,e,n,r){return n<e.size?`${t}[${n}]`:e.size===1?`${t}[0]`:r}var $e=({inputs:t,output:e,target:n})=>{let r=y(`result`,e.type,e.size),i=new Hr(n.device,{vs:`#version 300 es
341
+
342
+ void main() {
343
+ int result[1];
344
+ result[0] = START + gl_InstanceID * STEP;
345
+ set_result(result);
346
+ }
347
+ `,defines:{START:t.start.toString(),STEP:t.step.toString()},modules:[r],vertexCount:1,instanceCount:e.length,feedbackBufferMode:`interleaved`,outputs:r.varyings});try{return i.run({outputBuffers:{[r.varyings[0]]:n}}),{success:!0}}finally{i.destroy()}};var we=({inputs:t,output:e,target:n})=>{let{columns:r}=t;return g({module:{name:`swizzle`,vs:`// swizzle expression handled inline`},expression:i=>`x[${r[i]}]`,inputs:{x:t.x},output:e,outputBuffer:n}),{success:!0}};export{A as arithmetic,xe as dot,_e as equalAll,ne as extent,fe as fround,le as gather,ie as interleave,ve as length,ye as segmentedMap,be as select,$e as sequence,we as swizzle};
348
+ //# debugId=9e968b23-d0ee-5bc1-8204-4a733ef2ea0a