@mulmoclaude/shapescript-plugin 1.2.0 → 1.4.0

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.
Files changed (46) hide show
  1. package/README.md +19 -0
  2. package/dist/core/dispatch.d.ts +8 -3
  3. package/dist/core/dispatch.d.ts.map +1 -1
  4. package/dist/core/index.d.ts +5 -2
  5. package/dist/core/index.d.ts.map +1 -1
  6. package/dist/core/paths.d.ts +5 -0
  7. package/dist/core/paths.d.ts.map +1 -1
  8. package/dist/core-CpVzK-0i.js +53 -0
  9. package/dist/core-bcFgqR_m.cjs +1 -0
  10. package/dist/core.cjs +1 -1
  11. package/dist/core.js +4 -3
  12. package/dist/export/tool.d.ts +45 -0
  13. package/dist/export/tool.d.ts.map +1 -0
  14. package/dist/export/usdz.d.ts +17 -0
  15. package/dist/export/usdz.d.ts.map +1 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.js +4 -4
  18. package/dist/lang/de.d.ts.map +1 -1
  19. package/dist/lang/en.d.ts.map +1 -1
  20. package/dist/lang/es.d.ts.map +1 -1
  21. package/dist/lang/fr.d.ts.map +1 -1
  22. package/dist/lang/ja.d.ts.map +1 -1
  23. package/dist/lang/ko.d.ts.map +1 -1
  24. package/dist/lang/messages.d.ts +2 -0
  25. package/dist/lang/messages.d.ts.map +1 -1
  26. package/dist/lang/ptBR.d.ts.map +1 -1
  27. package/dist/lang/zh.d.ts.map +1 -1
  28. package/dist/render/index.d.ts +2 -0
  29. package/dist/render/index.d.ts.map +1 -1
  30. package/dist/render/renderer.d.ts +11 -0
  31. package/dist/render/renderer.d.ts.map +1 -1
  32. package/dist/render/tool.d.ts +118 -0
  33. package/dist/render/tool.d.ts.map +1 -0
  34. package/dist/render.cjs +2 -2
  35. package/dist/render.js +115 -11
  36. package/dist/samples-DPOGWslc.js +1038 -0
  37. package/dist/samples-DZNAeuSZ.cjs +210 -0
  38. package/dist/style.css +1 -1
  39. package/dist/{toThreeJS-B5LiF110.js → toThreeJS-BX_aeGdA.js} +18 -18
  40. package/dist/{toThreeJS-BOBpx5Dc.cjs → toThreeJS-XGDoVISb.cjs} +1 -1
  41. package/dist/vue/View.vue.d.ts.map +1 -1
  42. package/dist/vue.cjs +16 -16
  43. package/dist/vue.js +1760 -1716
  44. package/package.json +1 -1
  45. package/dist/samples-DHEKUNs5.cjs +0 -186
  46. package/dist/samples-SaXsqbHJ.js +0 -180
@@ -0,0 +1,210 @@
1
+ const e=require("./toThreeJS-XGDoVISb.cjs");let t=require("@mulmoclaude/core/artifacts");var n=`presentShapeScript`,r={type:`function`,name:n,description:"Display interactive 3D visualizations using ShapeScript with expressions, variables, control flow, and functions. A new `script` is saved to `artifacts/shapes/` and the returned `filePath` names it; pass `path` instead to present a source that already exists.",parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the 3D visualization`},script:{type:`string`,description:`ShapeScript code defining the 3D scene. Supported features and syntax are listed below. Syntax, evaluation, geometry and resource-limit errors are returned as diagnostics; correct the script and retry.
2
+
3
+ ## SYNTAX OVERVIEW:
4
+
5
+ ### Expressions & Operators:
6
+ - Arithmetic: +, -, *, /, % with proper precedence
7
+ - Comparison: =, <>, <, <=, >, >=
8
+ - Boolean: and, or, not
9
+ - Parentheses for grouping: (2 + 3) * 4
10
+
11
+ ### Variables:
12
+ define radius 2
13
+ define red (1 0 0)
14
+ sphere { size radius color red }
15
+
16
+ ### Control Flow:
17
+
18
+ For loops with variables:
19
+ for i in 1 to 5 {
20
+ cube { position (i * 2) 0 0 size 1 }
21
+ }
22
+
23
+ For loops with step:
24
+ for i in 0 to 10 step 2 {
25
+ sphere { position 0 i 0 }
26
+ }
27
+
28
+ If/else conditionals:
29
+ define showSphere 1
30
+ if showSphere {
31
+ sphere { size 2 }
32
+ } else {
33
+ cube { size 2 }
34
+ }
35
+
36
+ Switch statements:
37
+ define shape 2
38
+ switch shape {
39
+ case 1
40
+ cube
41
+ case 2
42
+ sphere
43
+ else
44
+ cone
45
+ }
46
+
47
+ ### Built-in Functions:
48
+
49
+ Math: round, floor, ceil, abs, sign, sqrt, pow, min, max
50
+ Trig: sin, cos, tan, asin, acos, atan, atan2 (uses radians)
51
+ Vector: dot, cross, length, normalize, sum
52
+
53
+ IMPORTANT: Function calls require NO space between name and parenthesis:
54
+ - sin(x) ✓ function call
55
+ - sin (x) ✗ NOT a function call (identifier + parenthesized expression)
56
+
57
+ Examples:
58
+ for i in 1 to 8 {
59
+ define angle (i * 0.785) // 45 degrees in radians
60
+ cube { position (cos(angle) * 3) 0 (sin(angle) * 3) }
61
+ }
62
+
63
+ ### Primitives & Properties:
64
+
65
+ Shapes: cube, sphere, cylinder, cone, torus, circle, square, polygon (sides 3–256)
66
+ Properties: position X Y Z, rotation X Y Z, size X Y Z
67
+ Materials: color R G B (0-1), opacity (0-1)
68
+
69
+ ### CSG Operations:
70
+ union, difference, intersection, xor, stencil
71
+
72
+ Example:
73
+ difference {
74
+ sphere { size 2 color (1 0.5 0) }
75
+ cube { size 1.5 }
76
+ }
77
+
78
+ ### Builders:
79
+ - extrude: extrude { polygon { sides 3 } } or extrude path { point 0 0 point 1 0 point 0 1 }
80
+ - fill: fill { square } or fill path { ... }
81
+ - lathe: lathe path { point 1 0 curve 0 2 1 -1 } (revolves about Y)
82
+ - loft: loft { square translate 0 0 2 circle } (closed planar sections joined with caps)
83
+ - hull: hull { cube { position -1 0 0 } cube { position 1 0 0 } } (convex envelope)
84
+ - stencil preserves the first shape and paints its surface with later shapes' materials.
85
+ Loft sections must each have one perimeter and enclose an area; extrude/fill primitive profiles must lie in XY.
86
+
87
+ ### Additional Expressions:
88
+ - Constants: pi, tau, true, false
89
+ - Scientific notation and unary plus: 1e-3, +2
90
+ - Tuple/vector members: vector.x, vector.y, vector.z; color.red/green/blue/alpha
91
+ - Tuple/string length: value.count; zero-based indexing: values[0]
92
+ - String literals, join(...), trim(...); min/max also accept tuples
93
+ - Custom shapes with options:
94
+ define post { option height 2 cylinder { size 0.2 height } }
95
+ post { height 3 }
96
+
97
+ ### Compatibility:
98
+ This plugin implements the documented modeling subset, not all upstream ShapeScript syntax.
99
+ Function calls use name(...); trig functions and rotation/orientation properties use radians.
100
+ Relative rotate/orientation commands and path rotate use turns (1 = 360 degrees).
101
+ Path point/curve coordinates are relative steps. Curves accept optional control-point offsets.
102
+ Imports, textures, text/fonts, arbitrary objects, and general user-defined functions are not supported.
103
+
104
+ ### Comments:
105
+ // Single-line comment
106
+ /* Multi-line
107
+ comment */
108
+
109
+ ## COMPLETE EXAMPLES:
110
+
111
+ Linear arrangement with expressions:
112
+ define spacing 1.5
113
+ for i in 1 to 4 {
114
+ cylinder { position ((i - 2.5) * spacing) 0 0 size 0.4 1 }
115
+ }
116
+
117
+ Circular pattern:
118
+ define count 12
119
+ for i in 1 to count {
120
+ define angle ((i / count) * 6.283) // 2 * PI
121
+ cube {
122
+ position (cos(angle) * 3) 0 (sin(angle) * 3)
123
+ color (i / count) 0.5 (1 - i / count)
124
+ size 0.5
125
+ }
126
+ }
127
+
128
+ Conditional geometry:
129
+ define makeHollow 1
130
+ if makeHollow {
131
+ difference {
132
+ sphere { size 2 color (1 0 0) }
133
+ sphere { size 1.7 }
134
+ }
135
+ } else {
136
+ sphere { size 2 color (1 0 0) }
137
+ }
138
+
139
+ Mathematical visualization:
140
+ for x in -5 to 5 {
141
+ for z in -5 to 5 {
142
+ define height (sin(x * 0.5) * cos(z * 0.5) * 2)
143
+ cube {
144
+ position (x * 0.3) height (z * 0.3)
145
+ size 0.25 (abs(height) + 0.1) 0.25
146
+ color (0.5 + height * 0.25) 0.3 (0.5 - height * 0.25)
147
+ }
148
+ }
149
+ }`},path:{type:`string`,description:"Path to an EXISTING ShapeScript source to present in place, instead of `script` — a `.shape` file this tool saved earlier (`artifacts/shapes/…`) or any other on disk. Provide either `script` or `path`, never both. Edits the user makes in the view write back to that same file."}},required:[`title`]}},i=`shapes`,a=`shape`,o=[`.shape`];function s(e,n=a){return(0,t.slugifyArtifact)(e,n)}function c(){let e=globalThis.crypto;if(e?.getRandomValues){let t=e.getRandomValues(new Uint8Array(4));return Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(16).slice(2,10).padEnd(8,`0`)}function l(e,n=new Date,r=c()){let o=(0,t.buildArtifactRelPath)({dir:i,title:e,ext:`.shape`,fallback:a,now:n,partitioned:!1,suffix:r});return{relPath:o,filePath:(0,t.toWorkspaceArtifactPath)(o)}}function u(e,n=new Date,r=c()){let o=(0,t.buildArtifactRelPath)({dir:i,title:e,ext:`.usdz`,fallback:a,now:n,partitioned:!1,suffix:r});return{relPath:o,filePath:(0,t.toWorkspaceArtifactPath)(o)}}function d(e){return!e.startsWith(`${t.ARTIFACTS_ROOT}/${i}/`)||!e.endsWith(`.shape`)?!1:!(0,t.hasUnsafePathSegment)(e)}function f(e){return e.startsWith(`${t.ARTIFACTS_ROOT}/`)?e.slice(t.ARTIFACTS_ROOT.length+1):e}function p(e){return(0,t.classifyFilePath)(e,o)!==null}function m(e,t){if(d(t))return{files:e.files.artifacts,rel:f(t)};let n=e.files.byPath;return n&&p(t)?{files:n,rel:t}:null}async function h(e,t){if(typeof t?.path!=`string`)throw Error(`path must be an existing .shape file`);let n=m(e,t.path);if(!n)throw Error(`path must be an existing .shape file`);switch(t.kind){case`loadShape`:return{script:await n.files.read(n.rel)};case`saveShape`:if(typeof t.script!=`string`)throw Error("saveShape requires `script` as a string");if(!await n.files.exists(n.rel))throw Error(`No ShapeScript exists at ${t.path}`);return await n.files.write(n.rel,t.script),{path:t.path};default:throw Error(`shapescript plugin: unknown dispatch kind ${JSON.stringify(t)}`)}}var g=`Acknowledge that the 3D visualization has been created and is displayed to the user. They can rotate, zoom, and pan the camera.`,_=e=>typeof e==`string`&&e.trim()!==``;function v(t){e.i(e.r(e.In(t)))}async function y(e,t){let n=e.files;if(!n)throw Error("This host cannot open a ShapeScript by path — pass the source as `script` instead");let r=m({files:n},t);if(!r)throw Error("`path` must be a .shape file, without `.` / `..` segments");if(!await r.files.exists(r.rel))throw Error(`No ShapeScript exists at ${t}`);return r.files.read(r.rel)}var b=5;async function x(e,t,n){let r=e.files?.artifacts;if(r){for(let e=0;e<b;e++){let{relPath:e,filePath:i}=l(n);if(!await r.exists(e))return await r.write(e,t),i}throw Error(`Could not allocate a free path under artifacts/shapes — try again with a different title`)}}async function S(e,t){if(_(t.path)&&_(t.script))throw Error("Provide either `script` or `path`, not both");if(_(t.path))return{script:await y(e,t.path),filePath:t.path};if(!_(t.script))throw Error(`ShapeScript code is required but was not provided`);return{script:t.script}}var C=async(t,n)=>{let r=`INVALID_ARGUMENT`;try{if(!e.Rn(n))throw Error("presentShapeScript args must be an object with `script` or `path`");if(!_(n.title))throw Error(`A nonempty visualization title is required`);let i=await S(t??{},n);r=`EVALUATION_ERROR`,v(i.script);let a=i.filePath??await x(t??{},i.script,n.title);return{message:a?`Saved ShapeScript to ${a}`:`Created 3D visualization: ${n.title}`,title:n.title,data:a?{script:i.script,filePath:a}:{script:i.script},instructions:g}}catch(t){let n={code:t instanceof e.Ln?`PARSE_ERROR`:t instanceof e.n?`LIMIT_EXCEEDED`:r,message:t instanceof Error?t.message:String(t),...t instanceof e.Ln&&t.line!==void 0?{line:t.line}:{},...t instanceof e.Ln&&t.column!==void 0?{column:t.column}:{}};return{message:`ShapeScript error: ${n.message}`,error:n,jsonData:{error:n},instructions:`The visualization was not created. Correct the ShapeScript using the returned diagnostic and call presentShapeScript again.`}}},w={toolDefinition:r,execute:C,generatingMessage:`Creating 3D visualization...`,waitingMessage:`Tell the user that the 3D visualization was created and will be presented shortly.`,isEnabled:()=>!0},T=C,E=Uint8Array,D=Uint16Array,ee=Int32Array,te=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ne=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),O=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),k=function(e,t){for(var n=new D(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},A=k(te,2),j=A.b,M=A.r;j[28]=258,M[258]=28;var N=k(ne,0);N.b;for(var P=N.r,F=new D(32768),I=0;I<32768;++I){var L=(I&43690)>>1|(I&21845)<<1;L=(L&52428)>>2|(L&13107)<<2,L=(L&61680)>>4|(L&3855)<<4,F[I]=((L&65280)>>8|(L&255)<<8)>>1}for(var R=(function(e,t,n){for(var r=e.length,i=0,a=new D(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new D(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new D(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[F[d]>>c]=l}else for(s=new D(r),i=0;i<r;++i)e[i]&&(s[i]=F[o[e[i]-1]++]>>15-e[i]);return s}),z=new E(288),I=0;I<144;++I)z[I]=8;for(var I=144;I<256;++I)z[I]=9;for(var I=256;I<280;++I)z[I]=7;for(var I=280;I<288;++I)z[I]=8;for(var B=new E(32),I=0;I<32;++I)B[I]=5;var V=R(z,9,0),re=R(B,5,0),ie=function(e){return(e+7)/8|0},H=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new E(e.subarray(t,n))},U=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],W=function(e,t,n){var r=Error(t||U[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,W),!n)throw r;return r},G=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},K=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},q=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:ce,l:0};if(i==1){var o=new E(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new D(f+1),m=J(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new E(p),l:m}},J=function(e,t,n){return e.s==-1?Math.max(J(e.l,t,n+1),J(e.r,t,n+1)):t[e.s]=n},ae=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new D(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Y=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},oe=function(e,t,n){var r=n.length,i=ie(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},X=function(e,t,n,r,i,a,o,s,c,l,u){G(t,u++,n),++i[256];for(var d=q(i,15),f=d.t,p=d.l,m=q(a,15),h=m.t,g=m.l,_=ae(f),v=_.c,y=_.n,b=ae(h),x=b.c,S=b.n,C=new D(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=q(C,7),E=T.t,ee=T.l,k=19;k>4&&!E[O[k-1]];--k);var A=l+5<<3,j=Y(i,z)+Y(a,B)+o,M=Y(i,f)+Y(a,h)+o+14+3*k+Y(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&A<=j&&A<=M)return oe(t,u,e.subarray(c,c+l));var N,P,F,I;if(G(t,u,1+(M<j)),u+=2,M<j){N=R(f,p,0),P=f,F=R(h,g,0),I=h;var L=R(E,ee,0);G(t,u,y-257),G(t,u+5,S-1),G(t,u+10,k-4),u+=14;for(var w=0;w<k;++w)G(t,u+3*w,E[O[w]]);u+=3*k;for(var ie=[v,x],H=0;H<2;++H)for(var U=ie[H],w=0;w<U.length;++w){var W=U[w]&31;G(t,u,L[W]),u+=E[W],W>15&&(G(t,u,U[w]>>5&127),u+=U[w]>>12)}}else N=V,P=z,F=re,I=B;for(var w=0;w<s;++w){var J=r[w];if(J>255){var W=J>>18&31;K(t,u,N[W+257]),u+=P[W+257],W>7&&(G(t,u,J>>23&31),u+=te[W]);var X=J&31;K(t,u,F[X]),u+=I[X],X>3&&(K(t,u,J>>5&8191),u+=ne[X])}else K(t,u,N[J]),u+=P[J]}return K(t,u,N[256]),u+P[256]},se=new ee([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ce=new E(0),le=function(e,t,n,r,i,a){var o=a.z||e.length,s=new E(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=se[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new D(32768),g=a.h||new D(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ee(25e3),x=new D(288),S=new D(32),C=0,w=0,T=a.i||0,O=0,k=a.w||0,A=0;T+2<o;++T){var j=y(T),N=T&32767,F=g[j];if(h[N]=F,g[j]=N,k<=T){var I=o-T;if((C>7e3||O>24576)&&(I>423||!l)){u=X(e,c,0,b,x,S,w,O,A,T-A,u),O=C=w=0,A=T;for(var L=0;L<286;++L)x[L]=0;for(var L=0;L<30;++L)S[L]=0}var R=2,z=0,B=p,V=N-F&32767;if(I>2&&j==y(T-V))for(var re=Math.min(f,I)-1,U=Math.min(32767,T),W=Math.min(258,I);V<=U&&--B&&N!=F;){if(e[T+R]==e[T+R-V]){for(var G=0;G<W&&e[T+G]==e[T+G-V];++G);if(G>R){if(R=G,z=V,G>re)break;for(var K=Math.min(V,G-2),q=0,L=0;L<K;++L){var J=T-V+L&32767,ae=J-h[J]&32767;ae>q&&(q=ae,F=J)}}}N=F,F=h[N],V+=N-F&32767}if(z){b[O++]=268435456|M[R]<<18|P[z];var Y=M[R]&31,ce=P[z]&31;w+=te[Y]+ne[ce],++x[257+Y],++S[ce],k=T+R,++C}else b[O++]=e[T],++x[e[T]]}}for(T=Math.max(T,k);T<o;++T)b[O++]=e[T],++x[e[T]];u=X(e,c,l,b,x,S,w,O,A,T-A,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=k)}else{for(var T=a.w||0;T<o+l;T+=65535){var le=T+65535;le>=o&&(c[u/8|0]=l,le=o),u=oe(c,u+1,e.subarray(T,le))}a.i=o}return H(s,0,r+ie(u)+i)},ue=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),de=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ue[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},fe=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new E(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return le(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},pe=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Z=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function me(e,t){return fe(e,t||{},0,0)}var he=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=pe(r,a[1]),a=a[0]),a instanceof E?n[o]=[a,s]:(n[o+=`/`]=[new E(0),s],he(a,o,n,r))}},ge=typeof TextEncoder<`u`&&new TextEncoder,_e=typeof TextDecoder<`u`&&new TextDecoder;try{_e.decode(ce,{stream:!0})}catch{}function ve(e,t){if(t){for(var n=new E(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ge)return ge.encode(e);for(var i=e.length,a=new E(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new E(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return H(a,0,o)}var ye=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&W(9),t+=r+4}return t},be=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=ye(l);Z(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&W(10),Z(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Z(e,t,n.crc),Z(e,t+4,a<0?-a-2:a),Z(e,t+8,n.size)),Z(e,t+12,c),Z(e,t+14,d),t+=16,o!=null&&(Z(e,t,u),Z(e,t+6,n.attrs),Z(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Z(e,t,+m),Z(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},xe=function(e,t,n,r,i){Z(e,t,101010256),Z(e,t+8,n),Z(e,t+10,n),Z(e,t+12,r),Z(e,t+16,i)};function Se(e,t){t||={};var n={},r=[];he(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=ve(o),f=d.length,p=l.comment,m=p&&ve(p),h=m&&m.length,g=ye(l.extra);f>65535&&W(11);var _=u?me(c,l):c,v=_.length,y=de();y.p(c),r.push(pe(l,{size:c.length,crc:y.d(),c:_,f:d,m,u:f!=o.length||m&&p.length!=h,o:i,compression:u})),i+=30+f+g+v,a+=76+2*(f+g)+(h||0)+v}for(var b=new E(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];be(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+ye(d.extra);b.set(d.c,d.o+w),be(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return xe(b,i,r.length,S,x),b}var Q=class{constructor(e,t=``,n=[],r=[]){this.name=e,this.type=t,this.metadata=n,this.properties=r,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){let t=` `.repeat(e),n=this.metadata.map(e=>{let n=e.key,r=e.value;if(Array.isArray(r)){let e=[];return e.push(`${n} = {`),r.forEach(n=>{e.push(`${t}\t\t${n}`)}),e.push(`${t}\t}`),e.join(`
150
+ `)}return`${n} = ${r}`}),r=n.length?` (\n${n.map(e=>`${t}\t${e}`).join(`
151
+ `)}\n${t})`:``,i=this.properties.map(e=>{let n=e.property.replace(/\n/g,`
152
+ `+t+` `),r=e.metadata.length?` (\n${e.metadata.map(e=>`${t}\t\t${e}`).join(`
153
+ `)}\n${t}\t)`:``;return`${t}\t${n}${r}`}),a=this.children.map(t=>t.toString(e+1)),o=[];if(i.length>0&&o.push(...i),a.length>0){i.length>0&&o.push(``);for(let e=0;e<a.length;e++)o.push(a[e]),e<a.length-1&&o.push(``)}let s=o.join(`
154
+ `);return`${t}def ${this.type?this.type+` `:``}"${this.name}"${r}\n${t}{\n${s}\n${t}}`}},Ce=class{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,n,r){this.parseAsync(e,r).then(t).catch(n)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:`plane`},planeAnchoring:{alignment:`horizontal`}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024,animations:[],animationFrameRate:60},t);let n=new Set,r={},i=`model.usda`;r[i]=null;let a=Oe(e,t.animations);t.animationTracks=a;let o=new Q(`Root`,`Xform`),s=new Q(`Scenes`,`Scope`);s.addMetadata(`kind`,`"sceneLibrary"`),o.addChild(s);let c=`Scene`,l=new Q(c,`Xform`);l.addMetadata(`customData`,[`bool preliminary_collidesWithEnvironment = 0`,`string sceneName = "${c}"`]),l.addMetadata(`sceneName`,`"${c}"`),t.includeAnchoringProperties&&(l.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),l.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),s.addChild(l);let u,d={},f={};e.isScene?Me(e,l,d,n,r,t):Ne(e,l,d,n,r,t);let p=Ge(d,f,t.quickLookCompatible);u=De(a.size>0?{fps:t.animationFrameRate,endTimeCode:ke(t.animations)*t.animationFrameRate}:null)+`
155
+ `+o.toString()+`
156
+
157
+ `+p.toString(),r[i]=ve(u),u=null;for(let e in f){let n=f[e];if(n.isCompressedTexture===!0){if(this.textureUtils===null)throw Error(`THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.`);n=await this.textureUtils.decompress(n)}let i=Ee(n.image,n.flipY,t.maxTextureSize),a=n.userData.mimeType===`image/jpeg`?`image/jpeg`:`image/png`,o=await new Promise(e=>i.toBlob(e,a));r[`textures/Texture_${e}.${Te(n)}`]=new Uint8Array(await o.arrayBuffer())}let m=0;for(let e in r){let t=r[e],n=34+e.length;m+=n;let i=m&63;if(i!==4){let n=64-i;r[e]=[t,{extra:{12345:new Uint8Array(n)}}]}m=t.length}return Se(r,{level:0})}};function we(e,t){let n=e.name;return n=n.replace(/[^A-Za-z0-9_]/g,``),/^[0-9]/.test(n)&&(n=`_`+n),n===``&&(n=e.isCamera?`Camera`:`Object`),t.has(n)&&(n=n+`_`+e.id),t.add(n),n}function Te(e){return e.userData.mimeType===`image/jpeg`?`jpg`:`png`}function Ee(e,t,n){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let r=n/Math.max(e.width,e.height),i=document.createElement(`canvas`);i.width=e.width*Math.min(1,r),i.height=e.height*Math.min(1,r);let a=i.getContext(`2d`);return t===!0&&(a.translate(0,i.height),a.scale(1,-1)),a.drawImage(e,0,0,i.width,i.height),i}throw Error(`THREE.USDZExporter: No valid image data found. Unable to process texture.`)}var $=7;function De(e=null){return`#usda 1.0
158
+ (
159
+ customLayerData = {
160
+ string creator = "Three.js USDZExporter"
161
+ }
162
+ defaultPrim = "Root"
163
+ metersPerUnit = 1
164
+ upAxis = "Y"${e?`
165
+ startTimeCode = 0
166
+ endTimeCode = ${e.endTimeCode}
167
+ timeCodesPerSecond = ${e.fps}
168
+ framesPerSecond = ${e.fps}`:``}
169
+ )
170
+ `}function Oe(t,n){let r=new Map;for(let i=0;i<n.length;i++){let a=n[i];for(let n=0;n<a.tracks.length;n++){let i=a.tracks[n],o=e.it.parseTrackName(i.name),s=e.it.findNode(t,o.nodeName);if(s==null)continue;let c=o.propertyName;if(c!==`position`&&c!==`quaternion`&&c!==`scale`)continue;let l=r.get(s);l===void 0&&(l={},r.set(s,l)),l[c]=i}}return r}function ke(e){let t=0;for(let n=0;n<e.length;n++)e[n].duration>t&&(t=e[n].duration);return t}function Ae(e,t,n,r){let i=n.times,a=n.values,o=[];for(let e=0;e<i.length;e++){let t=e*3;o.push(`${(i[e]*r).toPrecision($)}: (${a[t].toPrecision($)}, ${a[t+1].toPrecision($)}, ${a[t+2].toPrecision($)})`)}return`${t} ${e}.timeSamples = {\n\t${o.join(`,
171
+ `)},\n}`}function je(e,t){let n=e.times,r=e.values,i=[];for(let e=0;e<n.length;e++){let a=e*4;i.push(`${(n[e]*t).toPrecision($)}: (${r[a+3].toPrecision($)}, ${r[a].toPrecision($)}, ${r[a+1].toPrecision($)}, ${r[a+2].toPrecision($)})`)}return`quatf xformOp:orient.timeSamples = {\n\t${i.join(`,
172
+ `)},\n}`}function Me(e,t,n,r,i,a){for(let o=0,s=e.children.length;o<s;o++)Ne(e.children[o],t,n,r,i,a)}function Ne(e,t,n,r,i,a){if(e.visible===!1&&a.onlyVisible===!0)return;let o;if(e.isMesh){let t=e.geometry,s=Array.isArray(e.material),c=s?e.material:[e.material];for(let e=0;e<c.length;e++){let t=c[e];t.isMeshStandardMaterial||console.warn(`THREE.USDZExporter: Use MeshStandardMaterial for best results.`),t.uuid in n||(n[t.uuid]=t)}let l=c.map(e=>n[e.uuid]);if(s===!1){let e=`geometries/Geometry_${t.id}.usda`;if(!(e in i)){let n=ze(t);i[e]=ve(De()+`
173
+ `+n.toString())}}o=Ie(e,t,l,r,a)}else o=e.isCamera?Xe(e,r,a):Fe(e,r,a);t.addChild(o),Me(e,o,n,r,i,a)}function Pe(e,t,n){let r=n.animationTracks.get(t),i=t.pivot!==null;if(!i&&r===void 0){let n=Le(t.matrix);e.addProperty(`matrix4d xformOp:transform = ${n}`),e.addProperty(`uniform token[] xformOpOrder = ["xformOp:transform"]`);return}let a=n.animationFrameRate,o=t.position,s=t.quaternion,c=t.scale;if(r!==void 0&&r.position!==void 0?e.addProperty(Ae(`xformOp:translate`,`float3`,r.position,a)):e.addProperty(`float3 xformOp:translate = (${o.x.toPrecision($)}, ${o.y.toPrecision($)}, ${o.z.toPrecision($)})`),i){let n=t.pivot;e.addProperty(`float3 xformOp:translate:pivot = (${n.x.toPrecision($)}, ${n.y.toPrecision($)}, ${n.z.toPrecision($)})`)}r!==void 0&&r.quaternion!==void 0?e.addProperty(je(r.quaternion,a)):e.addProperty(`quatf xformOp:orient = (${s.w.toPrecision($)}, ${s.x.toPrecision($)}, ${s.y.toPrecision($)}, ${s.z.toPrecision($)})`),r!==void 0&&r.scale!==void 0?e.addProperty(Ae(`xformOp:scale`,`float3`,r.scale,a)):e.addProperty(`float3 xformOp:scale = (${c.x.toPrecision($)}, ${c.y.toPrecision($)}, ${c.z.toPrecision($)})`),i?e.addProperty(`uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]`):e.addProperty(`uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]`)}function Fe(e,t,n){let r=we(e,t);e.matrix.determinant()<0&&console.warn(`THREE.USDZExporter: USDZ does not support negative scales`,e);let i=new Q(r,`Xform`);return Pe(i,e,n),i}function Ie(e,t,n,r,i){let a=Fe(e,r,i);return n.length===1?(a.addMetadata(`prepend references`,`@./geometries/Geometry_${t.id}.usda@</Geometry>`),a.addMetadata(`prepend apiSchemas`,`["MaterialBindingAPI"]`),a.addProperty(`rel material:binding = </Materials/Material_${n[0].id}>`)):a.addChild(Be(t,n)),a}function Le(e){let t=e.elements;return`( ${Re(t,0)}, ${Re(t,4)}, ${Re(t,8)}, ${Re(t,12)} )`}function Re(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function ze(e){let t=new Q(`Geometry`),n=Be(e);return t.addChild(n),t}function Be(e,t=null){let n=e.attributes,r=n.position.count,i=new Q(`Geometry`,`Mesh`);i.addProperty(`int[] faceVertexCounts = [${Ve(e)}]`),i.addProperty(`int[] faceVertexIndices = [${He(e)}]`),i.addProperty(`normal3f[] normals = [${Ue(n.normal,r)}]`,[`interpolation = "vertex"`]),i.addProperty(`point3f[] points = [${Ue(n.position,r)}]`);for(let e=0;e<4;e++){let t=e>0?e:``,r=n[`uv`+t];r!==void 0&&i.addProperty(`texCoord2f[] primvars:st${t} = [${We(r)}]`,[`interpolation = "vertex"`])}let a=n.color;if(a!==void 0&&i.addProperty(`color3f[] primvars:displayColor = [${Ue(a,r)}]`,[`interpolation = "vertex"`]),i.addProperty(`uniform token subdivisionScheme = "none"`),t!==null){let r=e.groups,a=(e.index===null?n.position.count:e.index.count)/3;for(let e=0;e<r.length;e++){let n=r[e],o=t[n.materialIndex];if(o===void 0)continue;let s=Math.floor(n.start/3),c=Math.min(s+Math.floor(n.count/3),a),l=[];for(let e=s;e<c;e++)l.push(e);let u=new Q(`subset_${e}`,`GeomSubset`);u.addMetadata(`prepend apiSchemas`,`["MaterialBindingAPI"]`),u.addProperty(`uniform token elementType = "face"`),u.addProperty(`uniform token familyName = "materialBind"`),u.addProperty(`int[] indices = [${l.join(`, `)}]`),u.addProperty(`rel material:binding = </Materials/Material_${o.id}>`),i.addChild(u)}}return i}function Ve(e){let t=e.index===null?e.attributes.position.count:e.index.count;return Array(t/3).fill(3).join(`, `)}function He(e){let t=e.index,n=[];if(t!==null)for(let e=0;e<t.count;e++)n.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)n.push(e)}return n.join(`, `)}function Ue(e,t){if(e===void 0)return console.warn(`USDZExporter: Normals missing.`),Array(t).fill(`(0, 0, 0)`).join(`, `);let n=[];for(let t=0;t<e.count;t++){let r=e.getX(t),i=e.getY(t),a=e.getZ(t);n.push(`(${r.toPrecision($)}, ${i.toPrecision($)}, ${a.toPrecision($)})`)}return n.join(`, `)}function We(e){let t=[];for(let n=0;n<e.count;n++){let r=e.getX(n),i=e.getY(n);t.push(`(${r.toPrecision($)}, ${1-i.toPrecision($)})`)}return t.join(`, `)}function Ge(e,t,n=!1){let r=new Q(`Materials`);for(let i in e){let a=e[i];r.addChild(Ke(a,t,n))}return r}function Ke(t,n,r=!1){let i=new Q(`Material_${t.id}`,`Material`);function a(e,i,a){let o=e.source.id+`_`+e.flipY;n[o]=e;let s=e.channel>0?`st`+e.channel:`st`,c={1e3:`repeat`,1001:`clamp`,1002:`mirror`},l=e.repeat.clone(),u=e.offset.clone(),d=e.rotation,f=Math.sin(d),p=Math.cos(d);u.y=1-u.y-l.y,r?(u.x/=l.x,u.y/=l.y,u.x+=f/l.x,u.y+=p-1):(u.x+=f*l.x,u.y+=(1-p)*l.y);let m=new Q(`PrimvarReader_${i}`,`Shader`);m.addProperty(`uniform token info:id = "UsdPrimvarReader_float2"`),m.addProperty(`float2 inputs:fallback = (0.0, 0.0)`),m.addProperty(`string inputs:varname = "${s}"`),m.addProperty(`float2 outputs:result`);let h=new Q(`Transform2d_${i}`,`Shader`);h.addProperty(`uniform token info:id = "UsdTransform2d"`),h.addProperty(`float2 inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${i}.outputs:result>`),h.addProperty(`float inputs:rotation = ${(180/Math.PI*d).toFixed($)}`),h.addProperty(`float2 inputs:scale = ${Ye(l)}`),h.addProperty(`float2 inputs:translation = ${Ye(u)}`),h.addProperty(`float2 outputs:result`);let g=new Q(`Texture_${e.id}_${i}`,`Shader`);if(g.addProperty(`uniform token info:id = "UsdUVTexture"`),g.addProperty(`asset inputs:file = @textures/Texture_${o}.${Te(e)}@`),g.addProperty(`float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${i}.outputs:result>`),a!==void 0){let e=i===`diffuse`?t.opacity:1;g.addProperty(`float4 inputs:scale = ${Je(a,e)}`)}if(i===`normal`){let e=t.normalScale.x;g.addProperty(`float4 inputs:scale = (${2*e}, ${2*e}, 2, 1)`),g.addProperty(`float4 inputs:bias = (${-e}, ${-e}, -1, 0)`)}return g.addProperty(`token inputs:sourceColorSpace = "${e.colorSpace===``?`raw`:`sRGB`}"`),g.addProperty(`token inputs:wrapS = "${c[e.wrapS]}"`),g.addProperty(`token inputs:wrapT = "${c[e.wrapT]}"`),g.addProperty(`float outputs:r`),g.addProperty(`float outputs:g`),g.addProperty(`float outputs:b`),g.addProperty(`float3 outputs:rgb`),(t.transparent||t.alphaTest>0)&&g.addProperty(`float outputs:a`),[m,h,g]}t.side===2&&console.warn(`THREE.USDZExporter: USDZ does not support double sided materials`,t);let o=new Q(`PreviewSurface`,`Shader`);if(o.addProperty(`uniform token info:id = "UsdPreviewSurface"`),t.map===null?o.addProperty(`color3f inputs:diffuseColor = ${qe(t.color)}`):(o.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),t.transparent?o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`):t.alphaTest>0&&(o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`),o.addProperty(`float inputs:opacityThreshold = ${t.alphaTest}`)),a(t.map,`diffuse`,t.color).forEach(e=>i.addChild(e))),t.emissive){let n=t.emissiveIntensity??1;if(t.emissiveMap){o.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`);let r=new e.m(t.emissive.r*n,t.emissive.g*n,t.emissive.b*n);a(t.emissiveMap,`emissive`,r).forEach(e=>i.addChild(e))}else t.emissive.getHex()>0&&o.addProperty(`color3f inputs:emissiveColor = ${qe(t.emissive)}`)}if(t.normalMap&&(o.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`),a(t.normalMap,`normal`).forEach(e=>i.addChild(e))),t.aoMap){o.addProperty(`float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`);let n=t.aoMapIntensity??1,r=new e.m(n,n,n);a(t.aoMap,`occlusion`,r).forEach(e=>i.addChild(e))}if(t.roughnessMap){o.addProperty(`float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`);let n=new e.m(t.roughness,t.roughness,t.roughness);a(t.roughnessMap,`roughness`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:roughness = ${t.roughness??1}`);if(t.metalnessMap){o.addProperty(`float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`);let n=new e.m(t.metalness,t.metalness,t.metalness);a(t.metalnessMap,`metallic`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:metallic = ${t.metalness??0}`);if(t.alphaMap?(o.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.alphaMap.id}_opacity.outputs:r>`),o.addProperty(`float inputs:opacityThreshold = 0.0001`),a(t.alphaMap,`opacity`).forEach(e=>i.addChild(e))):o.addProperty(`float inputs:opacity = ${t.opacity}`),t.isMeshPhysicalMaterial){if(t.clearcoatMap!==null){o.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatMap.id}_clearcoat.outputs:r>`);let n=new e.m(t.clearcoat,t.clearcoat,t.clearcoat);a(t.clearcoatMap,`clearcoat`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:clearcoat = ${t.clearcoat}`);if(t.clearcoatRoughnessMap!==null){o.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);let n=new e.m(t.clearcoatRoughness,t.clearcoatRoughness,t.clearcoatRoughness);a(t.clearcoatRoughnessMap,`clearcoatRoughness`,n).forEach(e=>i.addChild(e))}else o.addProperty(`float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`);o.addProperty(`float inputs:ior = ${t.ior}`)}return o.addProperty(`int inputs:useSpecularWorkflow = 0`),o.addProperty(`token outputs:surface`),i.addChild(o),i.addProperty(`token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>`),i}function qe(e){return`(${e.r}, ${e.g}, ${e.b})`}function Je(e,t=1){return`(${e.r}, ${e.g}, ${e.b}, ${t})`}function Ye(e){return`(${e.x}, ${e.y})`}function Xe(e,t,n){let r=we(e,t);e.matrix.determinant()<0&&console.warn(`THREE.USDZExporter: USDZ does not support negative scales`,e);let i=new Q(r,`Camera`);Pe(i,e,n);let a=e.isOrthographicCamera?`orthographic`:`perspective`;i.addProperty(`token projection = "${a}"`);let o=`(${e.near.toPrecision($)}, ${e.far.toPrecision($)})`;i.addProperty(`float2 clippingRange = ${o}`);let s;s=e.isOrthographicCamera?((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision($):e.getFilmWidth().toPrecision($),i.addProperty(`float horizontalAperture = ${s}`);let c;if(c=e.isOrthographicCamera?((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision($):e.getFilmHeight().toPrecision($),i.addProperty(`float verticalAperture = ${c}`),e.isPerspectiveCamera){let t=e.getFocalLength().toPrecision($);i.addProperty(`float focalLength = ${t}`);let n=e.focus.toPrecision($);i.addProperty(`float focusDistance = ${n}`)}return i}var Ze=`model/vnd.usdz+zip`,Qe=`.usdz`;async function $e(e){let t=await new Ce().parseAsync(e,{quickLookCompatible:!0});return new Uint8Array(t)}async function et(t,n={}){let r=e.r(e.In(t),{...n,wireframe:!1});try{return await $e(r)}finally{e.i(r)}}var tt=[{name:`Basic Shapes`,args:{title:`Basic 3D Shapes`,script:`// Basic shapes demonstration
174
+ cube { position -2 0 0 size 1 color (1 0.3 0.3) }
175
+ sphere { position 0 0 0 size 1 color (0.3 1 0.3) }
176
+ cylinder { position 2 0 0 size 0.5 1 color (0.3 0.3 1) }`}},{name:`Circular Pattern`,args:{title:`Circular Pattern`,script:`// 12個の立方体を円形に配置
177
+
178
+ define count 12
179
+ define radius 3
180
+
181
+ for i in 1 to count {
182
+ // 各立方体の角度を計算(2 * PI = 6.283ラジアン)
183
+ define angle ((i / count) * 6.283)
184
+
185
+ // 円形配置のためのX座標とZ座標を計算
186
+ define x (cos(angle) * radius)
187
+ define z (sin(angle) * radius)
188
+
189
+ // グラデーションカラーを作成
190
+ define colorValue (i / count)
191
+
192
+ cube {
193
+ position x 0 z
194
+ size 0.5
195
+ color colorValue 0.5 (1 - colorValue)
196
+ }
197
+ }
198
+
199
+ // 中心に参考用の球体を配置
200
+ sphere {
201
+ position 0 0 0
202
+ size 0.3
203
+ color 1 1 0
204
+ opacity 0.5
205
+ }`}},{name:`CSG Difference`,args:{title:`Hollow Sphere`,script:`// Create a hollow sphere using CSG difference
206
+ difference {
207
+ sphere { size 2 color (1 0.5 0) }
208
+ sphere { size 1.7 color (1 1 1) }
209
+ cube { position 0 0 2 size 2 }
210
+ }`}}];Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return et}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Qe}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return n}});
package/dist/style.css CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.border{border-style:var(--tw-border-style);border-width:1px}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.present3d-container[data-v-4e16e031]{color:#fff;background:#1a1a1a;flex-direction:column;width:100%;height:100%;display:flex}.header[data-v-4e16e031]{background:#2a2a2a;border-bottom:1px solid #444;justify-content:space-between;align-items:center;padding:1rem;display:flex}.header h1[data-v-4e16e031]{margin:0;font-size:1.5rem;font-weight:600}.controls[data-v-4e16e031]{gap:.5rem;display:flex}.control-btn[data-v-4e16e031]{color:#fff;cursor:pointer;background:#3a3a3a;border:1px solid #555;border-radius:4px;align-items:center;gap:.25rem;padding:.5rem 1rem;font-size:.9rem;transition:background .2s;display:flex}.control-btn[data-v-4e16e031]:hover{background:#4a4a4a}.control-btn .material-icons[data-v-4e16e031]{font-size:1.2rem}.viewport[data-v-4e16e031]{flex:1;min-height:0;position:relative}.error[data-v-4e16e031]{color:#f66;background:#ff000020;border-bottom:1px solid #ff000040;padding:1rem;font-family:monospace}.script-source[data-v-4e16e031]{background:#00000040;border-top:1px solid #444;padding:.5rem;font-family:monospace;font-size:.85rem}.script-source summary[data-v-4e16e031]{cursor:pointer;-webkit-user-select:none;user-select:none;background:#2a2a2a;border-radius:4px;padding:.5rem}.script-source[open] summary[data-v-4e16e031]{margin-bottom:.5rem}.script-source summary[data-v-4e16e031]:hover{background:#3a3a3a}.script-editor[data-v-4e16e031]{color:#aaa;resize:vertical;background:#1a1a1a;border:1px solid #444;border-radius:4px;width:100%;min-height:150px;margin-bottom:.5rem;padding:1rem;font-family:Courier New,monospace;font-size:.9rem}.script-editor[data-v-4e16e031]:focus{background:#222;border-color:#666;outline:none}.apply-btn[data-v-4e16e031]{color:#fff;cursor:pointer;background:#4caf50;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem;transition:background .2s}.apply-btn[data-v-4e16e031]:hover{background:#45a049}.apply-btn[data-v-4e16e031]:active{background:#3d8b40}.apply-btn[data-v-4e16e031]:disabled{color:#666;cursor:not-allowed;opacity:.6;background:#ccc}.apply-btn[data-v-4e16e031]:disabled:hover{background:#ccc}.preview-container[data-v-3df26806]{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);border-radius:8px;width:100%;height:100%;min-height:150px;position:relative;overflow:hidden}.preview-viewport[data-v-3df26806]{width:100%;height:100%}.preview-title[data-v-3df26806]{color:#fff;text-align:center;white-space:nowrap;text-overflow:ellipsis;background:#000000b3;padding:.5rem;font-size:.75rem;font-weight:500;position:absolute;bottom:0;left:0;right:0;overflow:hidden}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.border{border-style:var(--tw-border-style);border-width:1px}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.present3d-container[data-v-3d6dc542]{color:#fff;background:#1a1a1a;flex-direction:column;width:100%;height:100%;display:flex}.header[data-v-3d6dc542]{background:#2a2a2a;border-bottom:1px solid #444;justify-content:space-between;align-items:center;padding:1rem;display:flex}.header h1[data-v-3d6dc542]{margin:0;font-size:1.5rem;font-weight:600}.controls[data-v-3d6dc542]{gap:.5rem;display:flex}.control-btn[data-v-3d6dc542]{color:#fff;cursor:pointer;background:#3a3a3a;border:1px solid #555;border-radius:4px;align-items:center;gap:.25rem;padding:.5rem 1rem;font-size:.9rem;transition:background .2s;display:flex}.control-btn[data-v-3d6dc542]:hover{background:#4a4a4a}.control-btn[data-v-3d6dc542]:disabled{cursor:not-allowed;opacity:.5}.control-btn[data-v-3d6dc542]:disabled:hover{background:#3a3a3a}.control-btn .material-icons[data-v-3d6dc542]{font-size:1.2rem}.viewport[data-v-3d6dc542]{flex:1;min-height:0;position:relative}.error[data-v-3d6dc542]{color:#f66;background:#ff000020;border-bottom:1px solid #ff000040;padding:1rem;font-family:monospace}.script-source[data-v-3d6dc542]{background:#00000040;border-top:1px solid #444;padding:.5rem;font-family:monospace;font-size:.85rem}.script-source summary[data-v-3d6dc542]{cursor:pointer;-webkit-user-select:none;user-select:none;background:#2a2a2a;border-radius:4px;padding:.5rem}.script-source[open] summary[data-v-3d6dc542]{margin-bottom:.5rem}.script-source summary[data-v-3d6dc542]:hover{background:#3a3a3a}.script-editor[data-v-3d6dc542]{color:#aaa;resize:vertical;background:#1a1a1a;border:1px solid #444;border-radius:4px;width:100%;min-height:150px;margin-bottom:.5rem;padding:1rem;font-family:Courier New,monospace;font-size:.9rem}.script-editor[data-v-3d6dc542]:focus{background:#222;border-color:#666;outline:none}.apply-btn[data-v-3d6dc542]{color:#fff;cursor:pointer;background:#4caf50;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem;transition:background .2s}.apply-btn[data-v-3d6dc542]:hover{background:#45a049}.apply-btn[data-v-3d6dc542]:active{background:#3d8b40}.apply-btn[data-v-3d6dc542]:disabled{color:#666;cursor:not-allowed;opacity:.6;background:#ccc}.apply-btn[data-v-3d6dc542]:disabled:hover{background:#ccc}.preview-container[data-v-3df26806]{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);border-radius:8px;width:100%;height:100%;min-height:150px;position:relative;overflow:hidden}.preview-viewport[data-v-3df26806]{width:100%;height:100%}.preview-title[data-v-3df26806]{color:#fff;text-align:center;white-space:nowrap;text-overflow:ellipsis;background:#000000b3;padding:.5rem;font-size:.75rem;font-weight:500;position:absolute;bottom:0;left:0;right:0;overflow:hidden}
3
3
  /*$vite$:1*/
@@ -11683,11 +11683,11 @@ function Np(e, t) {
11683
11683
  function Pp(e, t) {
11684
11684
  t && (e?.remove(t), Mp(t));
11685
11685
  }
11686
- var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
11686
+ var Fp = 3e4, Ip = 12, Lp = 4, Rp = 1e-9, zp = class extends Error {
11687
11687
  constructor(e) {
11688
11688
  super(e), this.name = "ShapeScriptLimitError";
11689
11689
  }
11690
- }, zp = class {
11690
+ }, Bp = class {
11691
11691
  options;
11692
11692
  evaluator;
11693
11693
  symbols;
@@ -11726,24 +11726,24 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
11726
11726
  this.chargeEstimate(r * n);
11727
11727
  }
11728
11728
  chargeEstimate(e) {
11729
- if (this.vertexCount + e > this.maxVertices) throw new Rp(`ShapeScript exceeds ${this.maxVertices} vertices — lower \`detail\` or simplify the path`);
11729
+ if (this.vertexCount + e > this.maxVertices) throw new zp(`ShapeScript exceeds ${this.maxVertices} vertices — lower \`detail\` or simplify the path`);
11730
11730
  }
11731
11731
  makeMesh(e, t) {
11732
- if (this.vertexCount += e.getAttribute("position")?.count ?? 0, this.vertexCount > this.maxVertices) throw e.dispose(), t.dispose(), new Rp(`ShapeScript exceeds ${this.maxVertices} vertices — lower \`detail\` or use fewer shapes`);
11732
+ if (this.vertexCount += e.getAttribute("position")?.count ?? 0, this.vertexCount > this.maxVertices) throw e.dispose(), t.dispose(), new zp(`ShapeScript exceeds ${this.maxVertices} vertices — lower \`detail\` or use fewer shapes`);
11733
11733
  return new ii(e, t);
11734
11734
  }
11735
11735
  rangeIterations(e, t, n) {
11736
11736
  if (n === 0 || !Number.isFinite(n) || !Number.isFinite(e) || !Number.isFinite(t)) throw Error("Loop bounds and step must be finite, with a nonzero step");
11737
11737
  let r = [];
11738
11738
  for (let i = e; n > 0 ? i <= t : i >= t; i += n) {
11739
- if (r.length >= this.maxLoopIterations) throw new Rp(`ShapeScript loop exceeds ${this.maxLoopIterations} iterations — narrow the range or increase the step`);
11739
+ if (r.length >= this.maxLoopIterations) throw new zp(`ShapeScript loop exceeds ${this.maxLoopIterations} iterations — narrow the range or increase the step`);
11740
11740
  r.push(i);
11741
11741
  }
11742
11742
  return r;
11743
11743
  }
11744
11744
  convertNode(e) {
11745
- if (this.nodeCount += 1, this.nodeCount > this.maxNodes) throw new Rp(`ShapeScript produced more than ${this.maxNodes} objects — reduce the loop counts or the nesting`);
11746
- if (Date.now() - this.startedAt > this.maxDurationMs) throw new Rp(`ShapeScript took longer than ${this.maxDurationMs}ms to build — simplify the model or use fewer boolean operations`);
11745
+ if (this.nodeCount += 1, this.nodeCount > this.maxNodes) throw new zp(`ShapeScript produced more than ${this.maxNodes} objects — reduce the loop counts or the nesting`);
11746
+ if (Date.now() - this.startedAt > this.maxDurationMs) throw new zp(`ShapeScript took longer than ${this.maxDurationMs}ms to build — simplify the model or use fewer boolean operations`);
11747
11747
  switch (e.type) {
11748
11748
  case "shape": return this.convertShape(e);
11749
11749
  case "csg": return this.convertCSG(e);
@@ -11767,7 +11767,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
11767
11767
  case "customShape": return this.convertCustomShape(e);
11768
11768
  case "path": {
11769
11769
  let t = this.buildPath(e);
11770
- this.chargePathEstimate(t, Fp), this.requireEnclosedArea(t, "path");
11770
+ this.chargePathEstimate(t, Ip), this.requireEnclosedArea(t, "path");
11771
11771
  let n = this.makeMesh(new to(t), this.createMaterial({ properties: {} }));
11772
11772
  return this.applyCurrentTransform(n), n;
11773
11773
  }
@@ -11958,7 +11958,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
11958
11958
  return this.inScope(t, () => {
11959
11959
  if (e.iterableValues) {
11960
11960
  let n = this.evaluator.evaluate(e.iterableValues), r = Array.isArray(n) ? n : [n];
11961
- if (r.length > this.maxLoopIterations) throw new Rp(`ShapeScript loop exceeds ${this.maxLoopIterations} iterations — narrow the range or increase the step`);
11961
+ if (r.length > this.maxLoopIterations) throw new zp(`ShapeScript loop exceeds ${this.maxLoopIterations} iterations — narrow the range or increase the step`);
11962
11962
  for (let n of r) this.symbols.set(e.variable, n), this.addChildren(t, e.body);
11963
11963
  } else {
11964
11964
  let n = this.evaluateNumber(e.from), r = this.evaluateNumber(e.to), i = e.step ? this.evaluateNumber(e.step) : 1, a = this.rangeIterations(n, r, i);
@@ -12062,9 +12062,9 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12062
12062
  n.matrix.multiply(r);
12063
12063
  }
12064
12064
  requireEnclosedArea(e, t) {
12065
- let n = e.getPoints(Fp), r = qa.area(n);
12065
+ let n = e.getPoints(Ip), r = qa.area(n);
12066
12066
  if (!Number.isFinite(r)) throw Error(`\`${t}\` needs finite path coordinates — these overflow`);
12067
- if (n.length < 3 || Math.abs(r) < Lp) throw Error(`\`${t}\` needs a path that encloses an area — this one has fewer than three distinct points, or they are collinear`);
12067
+ if (n.length < 3 || Math.abs(r) < Rp) throw Error(`\`${t}\` needs a path that encloses an area — this one has fewer than three distinct points, or they are collinear`);
12068
12068
  return e;
12069
12069
  }
12070
12070
  convertExtrude(e) {
@@ -12091,7 +12091,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12091
12091
  1,
12092
12092
  1
12093
12093
  ])[2] || 1, r = Math.max(1, Math.floor(this.detailLevel / 4));
12094
- this.chargePathEstimate(t, r, Ip);
12094
+ this.chargePathEstimate(t, r, Lp);
12095
12095
  let i = new Xa(t, {
12096
12096
  depth: n,
12097
12097
  bevelEnabled: !1,
@@ -12103,7 +12103,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12103
12103
  let t = new pa(), n = 0, r = 0, i = 0, a = !1, o = (e, t) => {
12104
12104
  if (n += e, r += t, !Number.isFinite(n) || !Number.isFinite(r)) throw Error("Path coordinates overflowed to a non-finite value — they accumulate, so each command adds to the previous one");
12105
12105
  }, s = (e) => {
12106
- if (++this.pathCommandCount > this.maxLoopIterations) throw new Rp(`ShapeScript path exceeds ${this.maxLoopIterations} commands`);
12106
+ if (++this.pathCommandCount > this.maxLoopIterations) throw new zp(`ShapeScript path exceeds ${this.maxLoopIterations} commands`);
12107
12107
  switch (e.type) {
12108
12108
  case "define":
12109
12109
  this.handleDefine(e);
@@ -12158,7 +12158,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12158
12158
  requireLatheProfile(e) {
12159
12159
  if (!e.every((e) => Number.isFinite(e.x) && Number.isFinite(e.y))) throw Error("`lathe` profile has non-finite coordinates — a curve control point or a path command overflowed");
12160
12160
  let t = Math.max(...e.map((e) => Math.abs(e.x))), n = Math.max(...e.map((e) => e.y)) - Math.min(...e.map((e) => e.y));
12161
- if (t < Lp || n < Lp) throw Error("`lathe` needs a profile with both radius and height — one on the axis of rotation sweeps nothing");
12161
+ if (t < Rp || n < Rp) throw Error("`lathe` needs a profile with both radius and height — one on the axis of rotation sweeps nothing");
12162
12162
  }
12163
12163
  buildLathe(e) {
12164
12164
  let t = null;
@@ -12214,7 +12214,7 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12214
12214
  return new to(t, 1);
12215
12215
  });
12216
12216
  let n = this.buildPath(t);
12217
- this.chargePathEstimate(n, Fp), this.requireEnclosedArea(n, "fill");
12217
+ this.chargePathEstimate(n, Ip), this.requireEnclosedArea(n, "fill");
12218
12218
  let r = new to(n), i = this.makeMesh(r, this.createMaterial(e));
12219
12219
  return this.applyExplicitTransforms(i, e.properties), this.applyCurrentTransform(i), i;
12220
12220
  });
@@ -12324,8 +12324,8 @@ var Fp = 12, Ip = 4, Lp = 1e-9, Rp = class extends Error {
12324
12324
  return e === t;
12325
12325
  }
12326
12326
  };
12327
- function Bp(e, t = {}) {
12328
- return new zp(t).convert(e);
12327
+ function Vp(e, t = {}) {
12328
+ return new Bp(t).convert(e);
12329
12329
  }
12330
12330
  //#endregion
12331
- export { Ko as $, qe as $t, hi as A, oo as An, ne as At, Ke as B, z as Bt, L as C, ao as Cn, xe as Ct, Mi as D, Cs as Dn, se as Dt, ct as E, G as En, ue as Et, gn as F, o as Fn, ce as Ft, ii as G, te as Gt, Pt as H, ho as Ht, v as I, e as In, le as It, vo as J, fe as Jt, Kr as K, f as Kt, b as L, t as Ln, ae as Lt, xs as M, W as Mn, P as Mt, O as N, at as Nn, Ae as Nt, X as O, lo as On, oe as Ot, T as P, l as Pn, je as Pt, g as Q, We as Qt, y as R, r as Rn, ie as Rt, I as S, Fn as Sn, be as St, Jo as T, et as Tn, ke as Tt, Rt as U, Gr as Ut, u as V, B as Vt, Y as W, R as Wt, h as X, Ne as Xt, m as Y, Fe as Yt, _ as Z, me as Zt, ji as _, q as _n, he as _t, ee as a, $t as an, ft as at, rn as b, Ze as bn, ve as bt, Ni as c, uo as cn, pe as ct, S as d, j as dn, Ee as dt, Hn as en, Go as et, p as f, M as fn, Ce as ft, Qo as g, w as gn, Oe as gt, Ss as h, A as hn, De as ht, Pp as i, d as in, de as it, Xe as j, ot as jn, re as jt, D as k, rt as kn, U as kt, xr as l, x as ln, F as lt, Ut as m, k as mn, Te as mt, Bp as n, C as nn, eo as nt, Yo as o, Sr as on, Pe as ot, Bn as p, E as pn, we as pt, _o as q, st as qt, Mp as r, fs as rn, Ft as rt, $o as s, Cr as sn, Me as st, Rp as t, mo as tn, di as tt, Fr as u, N as un, V as ut, ki as v, J as vn, ge as vt, Ai as w, tt as wn, Se as wt, si as x, nn as xn, ye as xt, an as y, en as yn, _e as yt, Ge as z, i as zn, H as zt };
12331
+ export { g as $, me as $t, D as A, lo as An, oe as At, Ge as B, r as Bn, ie as Bt, I as C, nn as Cn, ye as Ct, ct as D, et as Dn, ke as Dt, Jo as E, tt as En, Se as Et, T as F, at as Fn, Ae as Ft, Y as G, Gr as Gt, u as H, z as Ht, gn as I, l as In, je as It, _o as J, f as Jt, ii as K, R as Kt, v as L, o as Ln, ce as Lt, Xe as M, oo as Mn, ne as Mt, xs as N, ot as Nn, re as Nt, Mi as O, G as On, ue as Ot, O as P, W as Pn, P as Pt, _ as Q, Ne as Qt, b as R, e as Rn, le as Rt, si as S, Ze as Sn, ve as St, Ai as T, ao as Tn, xe as Tt, Pt as U, B as Ut, Ke as V, i as Vn, H as Vt, Rt as W, ho as Wt, m as X, fe as Xt, vo as Y, st as Yt, h as Z, Fe as Zt, Qo as _, A as _n, De as _t, Pp as a, fs as an, Ft as at, an as b, J as bn, ge as bt, $o as c, Sr as cn, Pe as ct, Fr as d, x as dn, F as dt, We as en, Ko as et, S as f, N as fn, V as ft, Ss as g, k as gn, Te as gt, Ut as h, E as hn, we as ht, Mp as i, C as in, ds as it, hi as j, rt as jn, U as jt, X as k, Cs as kn, se as kt, Ni as l, Cr as ln, Me as lt, Bn as m, M as mn, Ce as mt, zp as n, Hn as nn, di as nt, ee as o, d as on, de as ot, p, j as pn, Ee as pt, Kr as q, te as qt, Vp as r, mo as rn, eo as rt, Yo as s, $t as sn, ft as st, Fp as t, qe as tn, Go as tt, xr as u, uo as un, pe as ut, ji as v, w as vn, Oe as vt, L as w, Fn as wn, be as wt, rn as x, en as xn, _e as xt, ki as y, q as yn, he as yt, y as z, t as zn, ae as zt };