fui-studio-mcp 0.1.0 → 0.1.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.
- package/README.md +12 -4
- package/dist/{chunk-RAHWGTHJ.js → chunk-EFZHSV66.js} +1 -1
- package/dist/{chunk-W7L36Z34.js → chunk-NDQB3ETD.js} +29 -24
- package/dist/{dist-3URVYEPT.js → dist-RTISZO3Q.js} +1 -1
- package/dist/index.js +191 -17
- package/dist/{node-4RLELQ7B.js → node-3VDUDD3U.js} +2 -2
- package/dist/runtime.global.js +863 -860
- package/package.json +2 -2
package/dist/runtime.global.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var FUI=(()=>{var
|
|
2
|
-
t))!
|
|
3
|
-
t())})(
|
|
1
|
+
"use strict";var FUI=(()=>{var dc=Object.create;var Yr=Object.defineProperty;var Ac=Object.getOwnPropertyDescriptor;var mc=Object.getOwnPropertyNames;var yc=Object.getPrototypeOf,gc=Object.prototype.hasOwnProperty;var bc=(e,t,n)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ms=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ts=(e,t)=>{for(var n in t)Yr(e,n,{get:t[n],enumerable:!0})},Rs=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mc(
|
|
2
|
+
t))!gc.call(e,i)&&i!==n&&Yr(e,i,{get:()=>t[i],enumerable:!(r=Ac(t,i))||r.enumerable});return e};var Xr=(e,t,n)=>(n=e!=null?dc(yc(e)):{},Rs(t||!e||!e.__esModule?Yr(n,"default",{value:e,enumerable:!0}):n,e)),vc=e=>Rs(Yr({},"__esModule",{value:!0}),e);var Bt=(e,t,n)=>bc(e,typeof t!="symbol"?t+"":t,n);var Vr=Ms((Ui,Hi)=>{"use strict";(function(e,t){typeof Ui=="object"&&typeof Hi<"u"?Hi.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,e.polygonClipping=
|
|
3
|
+
t())})(Ui,(function(){"use strict";function e(X,I){var k={label:0,sent:function(){if(N[0]&1)throw N[1];return N[1]},trys:[],ops:[]},R,D,N,z;return z={next:q(0),throw:q(1),return:q(2)},typeof Symbol=="\
|
|
4
4
|
function"&&(z[Symbol.iterator]=function(){return this}),z;function q(J){return function(fe){return ee([J,fe])}}function ee(J){if(R)throw new TypeError("Generator is already executing.");for(;k;)try{if(R=
|
|
5
5
|
1,D&&(N=J[0]&2?D.return:J[0]?D.throw||((N=D.return)&&N.call(D),0):D.next)&&!(N=N.call(D,J[1])).done)return N;switch(D=0,N&&(J=[J[0]&2,N.value]),J[0]){case 0:case 1:N=J;break;case 4:return k.label++,{value:J[1],
|
|
6
6
|
done:!1};case 5:k.label++,D=J[1],J=[0];continue;case 7:J=k.ops.pop(),k.trys.pop();continue;default:if(N=k.trys,!(N=N.length>0&&N[N.length-1])&&(J[0]===6||J[0]===2)){k=0;continue}if(J[0]===3&&(!N||J[1]>
|
|
@@ -52,11 +52,11 @@ Dt,ae=te-(te-Dt),Ee=Dt-ae,te=Q*Ft,xe=te-(te-Ft),Le=Ft-xe,ct=Ee*Le-(tt-ae*xe-Ee*x
|
|
|
52
52
|
U=ct-Be,he[0]=ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,he[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,he[2]=je-(ft-U)+(Be-U),he[3]=ft;let Jt=$(4,he),Ln=oe*z;if(Jt>=Ln||-Jt>=Ln||
|
|
53
53
|
(U=X-Dt,q=X-(Dt+U)+(U-D),U=k-Ot,J=k-(Ot+U)+(U-D),U=I-Lt,ee=I-(Lt+U)+(U-N),U=R-Ft,fe=R-(Ft+U)+(U-N),q===0&&ee===0&&J===0&&fe===0)||(Ln=ce*z+Y*Math.abs(Jt),Jt+=Dt*fe+Ft*q-(Lt*J+Ot*ee),Jt>=Ln||-Jt>=Ln))return Jt;
|
|
54
54
|
tt=q*Ft,te=Q*q,ae=te-(te-q),Ee=q-ae,te=Q*Ft,xe=te-(te-Ft),Le=Ft-xe,ct=Ee*Le-(tt-ae*xe-Ee*xe-ae*Le),ht=ee*Ot,te=Q*ee,ae=te-(te-ee),Ee=ee-ae,te=Q*Ot,xe=te-(te-Ot),Le=Ot-xe,Et=Ee*Le-(ht-ae*xe-Ee*xe-ae*Le),
|
|
55
|
-
Be=ct-Et,U=ct-Be,ne[0]=ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let
|
|
55
|
+
Be=ct-Et,U=ct-Be,ne[0]=ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let hi=F(4,he,4,ne,se);tt=Dt*fe,te=
|
|
56
56
|
Q*Dt,ae=te-(te-Dt),Ee=Dt-ae,te=Q*fe,xe=te-(te-fe),Le=fe-xe,ct=Ee*Le-(tt-ae*xe-Ee*xe-ae*Le),ht=Lt*J,te=Q*Lt,ae=te-(te-Lt),Ee=Lt-ae,te=Q*J,xe=te-(te-J),Le=J-xe,Et=Ee*Le-(ht-ae*xe-Ee*xe-ae*Le),Be=ct-Et,U=
|
|
57
|
-
ct-Be,ne[0]=ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let
|
|
57
|
+
ct-Be,ne[0]=ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let fi=F(hi,se,4,ne,Ae);tt=q*fe,te=Q*q,ae=te-
|
|
58
58
|
(te-q),Ee=q-ae,te=Q*fe,xe=te-(te-fe),Le=fe-xe,ct=Ee*Le-(tt-ae*xe-Ee*xe-ae*Le),ht=ee*J,te=Q*ee,ae=te-(te-ee),Ee=ee-ae,te=Q*J,xe=te-(te-J),Le=J-xe,Et=Ee*Le-(ht-ae*xe-Ee*xe-ae*Le),Be=ct-Et,U=ct-Be,ne[0]=
|
|
59
|
-
ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let Fn=F(
|
|
59
|
+
ct-(Be+U)+(U-Et),je=tt+Be,U=je-tt,ut=tt-(je-U)+(Be-U),Be=ut-ht,U=ut-Be,ne[1]=ut-(Be+U)+(U-ht),ft=je+Be,U=ft-je,ne[2]=je-(ft-U)+(Be-U),ne[3]=ft;let Fn=F(fi,Ae,4,ne,ve);return ve[Fn-1]}function _e(X,I,k,R,D,N){
|
|
60
60
|
let z=(I-N)*(k-D),q=(X-D)*(R-N),ee=z-q,J=Math.abs(z+q);return Math.abs(ee)>=G*J?ee:-ge(X,I,k,R,D,N,J)}let Se=(X,I)=>X.x*I.y-X.y*I.x,Fe=(X,I)=>X.x*I.x+X.y*I.y,lt=(X,I,k)=>{let R=_e(X.x,X.y,I.x,I.y,k.x,
|
|
61
61
|
k.y);return R>0?-1:R<0?1:0},de=X=>Math.sqrt(Fe(X,X)),Ie=(X,I,k)=>{let R={x:I.x-X.x,y:I.y-X.y},D={x:k.x-X.x,y:k.y-X.y};return Se(D,R)/de(D)/de(R)},qe=(X,I,k)=>{let R={x:I.x-X.x,y:I.y-X.y},D={x:k.x-X.x,
|
|
62
62
|
y:k.y-X.y};return Fe(D,R)/de(D)/de(R)},Ue=(X,I,k)=>I.y===0?null:{x:X.x+I.x/I.y*(k-X.y),y:k},et=(X,I,k)=>I.x===0?null:{x:k,y:X.y+I.y/I.x*(k-X.x)},Ve=(X,I,k,R)=>{if(I.x===0)return et(k,R,X.x);if(R.x===0)
|
|
@@ -130,17 +130,17 @@ U)||(fe=U),!ee.isAnEndpoint(U))){let te=this._splitSafely(ee,U);for(let ae=0,Ee=
|
|
|
130
130
|
fe)<=0?J:fe,this.queue.remove(k.rightSE),R.push(k.rightSE);let te=k.split(U);for(let ae=0,Ee=te.length;ae<Ee;ae++)R.push(te[ae])}R.length>0?(this.tree.remove(k),R.push(I)):(this.segments.push(k),k.prev=
|
|
131
131
|
q)}else{if(q&&ee){let J=q.getIntersection(ee);if(J!==null){if(!q.isAnEndpoint(J)){let fe=this._splitSafely(q,J);for(let U=0,te=fe.length;U<te;U++)R.push(fe[U])}if(!ee.isAnEndpoint(J)){let fe=this._splitSafely(
|
|
132
132
|
ee,J);for(let U=0,te=fe.length;U<te;U++)R.push(fe[U])}}}this.tree.remove(k)}return R}_splitSafely(I,k){this.tree.remove(I);let R=I.rightSE;this.queue.remove(R);let D=I.split(k);return D.push(R),I.consumedBy===
|
|
133
|
-
void 0&&this.tree.add(I),D}}let qt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class
|
|
133
|
+
void 0&&this.tree.add(I),D}}let qt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ui{run(I,k,R){
|
|
134
134
|
Nt.type=I,E.reset();let D=[new Gt(k,!0)];for(let U=0,te=R.length;U<te;U++)D.push(new Gt(R[U],!1));if(Nt.numMultiPolys=D.length,Nt.type==="difference"){let U=D[0],te=1;for(;te<D.length;)b(D[te].bbox,U.
|
|
135
135
|
bbox)!==null?te++:D.splice(te,1)}if(Nt.type==="intersection")for(let U=0,te=D.length;U<te;U++){let ae=D[U];for(let Ee=U+1,xe=D.length;Ee<xe;Ee++)if(b(ae.bbox,D[Ee].bbox)===null)return[]}let N=new h(He.
|
|
136
136
|
compare);for(let U=0,te=D.length;U<te;U++){let ae=D[U].getSweepEvents();for(let Ee=0,xe=ae.length;Ee<xe;Ee++)if(N.insert(ae[Ee]),N.size>qt)throw new Error("Infinite loop when putting segment endpoints\
|
|
137
137
|
in a priority queue (queue size too big).")}let z=new It(N),q=N.size,ee=N.pop();for(;ee;){let U=ee.key;if(N.size===q){let ae=U.segment;throw new Error(`Unable to pop() ${U.isLeft?"left":"right"} Swee\
|
|
138
138
|
pEvent [${U.point.x}, ${U.point.y}] from segment #${ae.id} [${ae.leftSE.point.x}, ${ae.leftSE.point.y}] -> [${ae.rightSE.point.x}, ${ae.rightSE.point.y}] from queue.`)}if(N.size>qt)throw new Error("In\
|
|
139
139
|
finite loop when passing sweep line over endpoints (queue size too big).");if(z.segments.length>xt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
140
|
-
let te=z.process(U);for(let ae=0,Ee=te.length;ae<Ee;ae++){let xe=te[ae];xe.consumedBy===void 0&&N.insert(xe)}q=N.size,ee=N.pop()}E.reset();let J=We.factory(z.segments);return new dt(J).getGeom()}}let Nt=new
|
|
141
|
-
var
|
|
140
|
+
let te=z.process(U);for(let ae=0,Ee=te.length;ae<Ee;ae++){let xe=te[ae];xe.consumedBy===void 0&&N.insert(xe)}q=N.size,ee=N.pop()}E.reset();let J=We.factory(z.segments);return new dt(J).getGeom()}}let Nt=new ui;
|
|
141
|
+
var ci={union:function(X){for(var I=arguments.length,k=new Array(I>1?I-1:0),R=1;R<I;R++)k[R-1]=arguments[R];return Nt.run("union",X,k)},intersection:function(X){for(var I=arguments.length,k=new Array(
|
|
142
142
|
I>1?I-1:0),R=1;R<I;R++)k[R-1]=arguments[R];return Nt.run("intersection",X,k)},xor:function(X){for(var I=arguments.length,k=new Array(I>1?I-1:0),R=1;R<I;R++)k[R-1]=arguments[R];return Nt.run("xor",X,k)},
|
|
143
|
-
difference:function(X){for(var I=arguments.length,k=new Array(I>1?I-1:0),R=1;R<I;R++)k[R-1]=arguments[R];return Nt.run("difference",X,k)}};return
|
|
143
|
+
difference:function(X){for(var I=arguments.length,k=new Array(I>1?I-1:0),R=1;R<I;R++)k[R-1]=arguments[R];return Nt.run("difference",X,k)}};return ci}))});var ll=Ms((Yg,Lo)=>{"use strict";(function(){"use strict";var e={};e.version="6.4.2.2",e.use_lines=!0,e.use_xyz=!1;var t=!1;typeof Lo<"u"&&Lo.exports?(Lo.exports=e,t=!0):(typeof define=="function"&&define.
|
|
144
144
|
amd&&define(e),typeof document<"u"?window.ClipperLib=e:self.ClipperLib=e);var n;if(t){var r="chrome";n="Netscape"}else{var r=navigator.userAgent.toString().toLowerCase();n=navigator.appName}var i={};r.
|
|
145
145
|
indexOf("chrome")!=-1&&r.indexOf("chromium")==-1?i.chrome=1:i.chrome=0,r.indexOf("chromium")!=-1?i.chromium=1:i.chromium=0,r.indexOf("safari")!=-1&&r.indexOf("chrome")==-1&&r.indexOf("chromium")==-1?i.
|
|
146
146
|
safari=1:i.safari=0,r.indexOf("firefox")!=-1?i.firefox=1:i.firefox=0,r.indexOf("firefox/17")!=-1?i.firefox17=1:i.firefox17=0,r.indexOf("firefox/15")!=-1?i.firefox15=1:i.firefox15=0,r.indexOf("firefox/\
|
|
@@ -185,7 +185,7 @@ var c;return o<256||a.isEven()?c=new Fe(a):c=new Ve(a),this.exp(o,c)}h.prototype
|
|
|
185
185
|
he,h.prototype.lShiftTo=se,h.prototype.rShiftTo=Ae,h.prototype.subTo=ve,h.prototype.multiplyTo=ne,h.prototype.squareTo=ge,h.prototype.divRemTo=_e,h.prototype.invDigit=et,h.prototype.isEven=Gt,h.prototype.
|
|
186
186
|
exp=We,h.prototype.toString=Y,h.prototype.negate=F,h.prototype.abs=$,h.prototype.compareTo=W,h.prototype.bitLength=oe,h.prototype.mod=Se,h.prototype.modPowInt=Je,h.ZERO=E(0),h.ONE=E(1);function dt(){var o=f();
|
|
187
187
|
return this.copyTo(o),o}function It(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.
|
|
188
|
-
DB|this[0]}function qt(){return this.t==0?this.s:this[0]<<24>>24}function xt(){return this.t==0?this.s:this[0]<<16>>16}function
|
|
188
|
+
DB|this[0]}function qt(){return this.t==0?this.s:this[0]<<24>>24}function xt(){return this.t==0?this.s:this[0]<<16>>16}function ui(o){return Math.floor(Math.LN2*this.DB/Math.log(o))}function Nt(){return this.
|
|
189
189
|
s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function ks(o){if(o==null&&(o=10),this.signum()==0||o<2||o>36)return"0";var a=this.chunkSize(o),c=Math.pow(o,a),p=E(c),m=f(),w=f(),B="";for(this.divRemTo(p,
|
|
190
190
|
m,w);m.signum()>0;)B=(c+w.intValue()).toString(o).substr(1)+B,m.divRemTo(p,m,w);return w.intValue().toString(o)+B}function Es(o,a){this.fromInt(0),a==null&&(a=10);for(var c=this.chunkSize(a),p=Math.pow(
|
|
191
191
|
a,c),m=!1,w=0,B=0,O=0;O<o.length;++O){var L=S(o,O);if(L<0){o.charAt(O)=="-"&&this.signum()==0&&(m=!0);continue}B=a*B+L,++w>=c&&(this.dMultiply(p),this.dAddOffset(B,0),w=0,B=0)}w>0&&(this.dMultiply(Math.
|
|
@@ -193,7 +193,7 @@ pow(a,w)),this.dAddOffset(B,0)),m&&h.ZERO.subTo(this,this)}function Ss(o,a,c){if
|
|
|
193
193
|
o-1),N,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>o&&this.subTo(h.ONE.shiftLeft(o-1),this);else{var p=new Array,m=o&7;p.length=(o>>3)+1,a.
|
|
194
194
|
nextBytes(p),m>0?p[0]&=(1<<m)-1:p[0]=0,this.fromString(p,256)}}function Bs(){var o=this.t,a=new Array;a[0]=this.s;var c=this.DB-o*this.DB%8,p,m=0;if(o-- >0)for(c<this.DB&&(p=this[o]>>c)!=(this.s&this.
|
|
195
195
|
DM)>>c&&(a[m++]=p|this.s<<this.DB-c);o>=0;)c<8?(p=(this[o]&(1<<c)-1)<<8-c,p|=this[--o]>>(c+=this.DB-8)):(p=this[o]>>(c-=8)&255,c<=0&&(c+=this.DB,--o)),(p&128)!=0&&(p|=-256),m==0&&(this.s&128)!=(p&128)&&
|
|
196
|
-
++m,(m>0||p!=this.s)&&(a[m++]=p);return a}function
|
|
196
|
+
++m,(m>0||p!=this.s)&&(a[m++]=p);return a}function ci(o){return this.compareTo(o)==0}function X(o){return this.compareTo(o)<0?this:o}function I(o){return this.compareTo(o)>0?this:o}function k(o,a,c){var p,
|
|
197
197
|
m,w=Math.min(o.t,this.t);for(p=0;p<w;++p)c[p]=a(this[p],o[p]);if(o.t<this.t){for(m=o.s&this.DM,p=w;p<this.t;++p)c[p]=a(this[p],m);c.t=this.t}else{for(m=this.s&this.DM,p=w;p<o.t;++p)c[p]=a(m,o[p]);c.t=
|
|
198
198
|
o.t}c.s=a(this.s,o.s),c.clamp()}function R(o,a){return o&a}function D(o){var a=f();return this.bitwiseTo(o,R,a),a}function N(o,a){return o|a}function z(o){var a=f();return this.bitwiseTo(o,N,a),a}function q(o,a){
|
|
199
199
|
return o^a}function ee(o){var a=f();return this.bitwiseTo(o,q,a),a}function J(o,a){return o&~a}function fe(o){var a=f();return this.bitwiseTo(o,J,a),a}function U(){for(var o=f(),a=0;a<this.t;++a)o[a]=
|
|
@@ -205,37 +205,37 @@ changeBit(o,N)}function ct(o){return this.changeBit(o,J)}function ht(o){return t
|
|
|
205
205
|
DB;if(o.t<this.t){for(p+=o.s;c<this.t;)p+=this[c],a[c++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;c<o.t;)p+=o[c],a[c++]=p&this.DM,p>>=this.DB;p+=o.s}a.s=p<0?-1:0,p>0?a[c++]=p:p<-1&&(a[c++]=this.
|
|
206
206
|
DV+p),a.t=c,a.clamp()}function ft(o){var a=f();return this.addTo(o,a),a}function Dt(o){var a=f();return this.subTo(o,a),a}function Ot(o){var a=f();return this.multiplyTo(o,a),a}function Lt(){var o=f();
|
|
207
207
|
return this.squareTo(o),o}function Ft(o){var a=f();return this.divRemTo(o,a,null),a}function Jt(o){var a=f();return this.divRemTo(o,null,a),a}function Ln(o){var a=f(),c=f();return this.divRemTo(o,a,c),
|
|
208
|
-
new Array(a,c)}function
|
|
209
|
-
DV,++a>=this.t&&(this[this.t++]=0),++this[a]}}function Fn(){}function Ps(o){return o}function
|
|
210
|
-
Fn.prototype.mulTo=
|
|
211
|
-
t]=this.am(0,o[p],c,p,0,this.t);for(m=Math.min(o.t,a);p<m;++p)this.am(0,o[p],c,p,0,a-p);c.clamp()}function
|
|
212
|
-
t;++p)c[this.t+p-a]=this.am(a-p,o[p],c,0,0,this.t+p-a);c.clamp(),c.drShiftTo(1,c)}function
|
|
213
|
-
if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var a=f();return o.copyTo(a),this.reduce(a),a}function
|
|
208
|
+
new Array(a,c)}function hi(o){this[this.t]=this.am(0,o-1,this,0,0,this.t),++this.t,this.clamp()}function fi(o,a){if(o!=0){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=o;this[a]>=this.DV;)this[a]-=this.
|
|
209
|
+
DV,++a>=this.t&&(this[this.t++]=0),++this[a]}}function Fn(){}function Ps(o){return o}function Uu(o,a,c){o.multiplyTo(a,c)}function Hu(o,a){o.squareTo(a)}Fn.prototype.convert=Ps,Fn.prototype.revert=Ps,
|
|
210
|
+
Fn.prototype.mulTo=Uu,Fn.prototype.sqrTo=Hu;function $u(o){return this.exp(o,new Fn)}function zu(o,a,c){var p=Math.min(this.t+o.t,a);for(c.s=0,c.t=p;p>0;)c[--p]=0;var m;for(m=c.t-this.t;p<m;++p)c[p+this.
|
|
211
|
+
t]=this.am(0,o[p],c,p,0,this.t);for(m=Math.min(o.t,a);p<m;++p)this.am(0,o[p],c,p,0,a-p);c.clamp()}function ju(o,a,c){--a;var p=c.t=this.t+o.t-a;for(c.s=0;--p>=0;)c[p]=0;for(p=Math.max(a-this.t,0);p<o.
|
|
212
|
+
t;++p)c[this.t+p-a]=this.am(a-p,o[p],c,0,0,this.t+p-a);c.clamp(),c.drShiftTo(1,c)}function Ar(o){this.r2=f(),this.q3=f(),h.ONE.dlShiftTo(2*o.t,this.r2),this.mu=this.r2.divide(o),this.m=o}function Vu(o){
|
|
213
|
+
if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var a=f();return o.copyTo(a),this.reduce(a),a}function Ju(o){return o}function Zu(o){for(o.drShiftTo(this.m.t-1,this.r2),
|
|
214
214
|
o.t>this.m.t+1&&(o.t=this.m.t+1,o.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);o.compareTo(this.r2)<0;)o.dAddOffset(1,this.m.t+1);for(o.
|
|
215
|
-
subTo(this.r2,o);o.compareTo(this.m)>=0;)o.subTo(this.m,o)}function
|
|
216
|
-
|
|
217
|
-
w=new
|
|
215
|
+
subTo(this.r2,o);o.compareTo(this.m)>=0;)o.subTo(this.m,o)}function Ku(o,a){o.squareTo(a),this.reduce(a)}function ec(o,a,c){o.multiplyTo(a,c),this.reduce(c)}Ar.prototype.convert=Vu,Ar.prototype.revert=
|
|
216
|
+
Ju,Ar.prototype.reduce=Zu,Ar.prototype.mulTo=ec,Ar.prototype.sqrTo=Ku;function tc(o,a){var c=o.bitLength(),p,m=E(1),w;if(c<=0)return m;c<18?p=1:c<48?p=3:c<144?p=4:c<768?p=5:p=6,c<8?w=new Fe(a):a.isEven()?
|
|
217
|
+
w=new Ar(a):w=new Ve(a);var B=new Array,O=3,L=p-1,H=(1<<p)-1;if(B[1]=w.convert(this),p>1){var re=f();for(w.sqrTo(B[1],re);O<=H;)B[O]=f(),w.mulTo(re,B[O-2],B[O]),O+=2}var K=o.t-1,le,Ce=!0,Ne=f(),De;for(c=
|
|
218
218
|
G(o[K])-1;K>=0;){for(c>=L?le=o[K]>>c-L&H:(le=(o[K]&(1<<c+1)-1)<<L-c,K>0&&(le|=o[K-1]>>this.DB+c-L)),O=p;(le&1)==0;)le>>=1,--O;if((c-=O)<0&&(c+=this.DB,--K),Ce)B[le].copyTo(m),Ce=!1;else{for(;O>1;)w.sqrTo(
|
|
219
|
-
m,Ne),w.sqrTo(Ne,m),O-=2;O>0?w.sqrTo(m,Ne):(De=m,m=Ne,Ne=De),w.mulTo(Ne,B[le],m)}for(;K>=0&&(o[K]&1<<c)==0;)w.sqrTo(m,Ne),De=m,m=Ne,Ne=De,--c<0&&(c=this.DB-1,--K)}return w.revert(m)}function
|
|
219
|
+
m,Ne),w.sqrTo(Ne,m),O-=2;O>0?w.sqrTo(m,Ne):(De=m,m=Ne,Ne=De),w.mulTo(Ne,B[le],m)}for(;K>=0&&(o[K]&1<<c)==0;)w.sqrTo(m,Ne),De=m,m=Ne,Ne=De,--c<0&&(c=this.DB-1,--K)}return w.revert(m)}function nc(o){var a=this.
|
|
220
220
|
s<0?this.negate():this.clone(),c=o.s<0?o.negate():o.clone();if(a.compareTo(c)<0){var p=a;a=c,c=p}var m=a.getLowestSetBit(),w=c.getLowestSetBit();if(w<0)return a;for(m<w&&(w=m),w>0&&(a.rShiftTo(w,a),c.
|
|
221
221
|
rShiftTo(w,c));a.signum()>0;)(m=a.getLowestSetBit())>0&&a.rShiftTo(m,a),(m=c.getLowestSetBit())>0&&c.rShiftTo(m,c),a.compareTo(c)>=0?(a.subTo(c,a),a.rShiftTo(1,a)):(c.subTo(a,c),c.rShiftTo(1,c));return w>
|
|
222
|
-
0&&c.lShiftTo(w,c),c}function
|
|
222
|
+
0&&c.lShiftTo(w,c),c}function rc(o){if(o<=0)return 0;var a=this.DV%o,c=this.s<0?o-1:0;if(this.t>0)if(a==0)c=this[0]%o;else for(var p=this.t-1;p>=0;--p)c=(a*c+this[p])%o;return c}function oc(o){var a=o.
|
|
223
223
|
isEven();if(this.isEven()&&a||o.signum()==0)return h.ZERO;for(var c=o.clone(),p=this.clone(),m=E(1),w=E(0),B=E(0),O=E(1);c.signum()!=0;){for(;c.isEven();)c.rShiftTo(1,c),a?((!m.isEven()||!w.isEven())&&
|
|
224
224
|
(m.addTo(this,m),w.subTo(o,w)),m.rShiftTo(1,m)):w.isEven()||w.subTo(o,w),w.rShiftTo(1,w);for(;p.isEven();)p.rShiftTo(1,p),a?((!B.isEven()||!O.isEven())&&(B.addTo(this,B),O.subTo(o,O)),B.rShiftTo(1,B)):
|
|
225
225
|
O.isEven()||O.subTo(o,O),O.rShiftTo(1,O);c.compareTo(p)>=0?(c.subTo(p,c),a&&m.subTo(B,m),w.subTo(O,w)):(p.subTo(c,p),a&&B.subTo(m,B),O.subTo(w,O))}if(p.compareTo(h.ONE)!=0)return h.ZERO;if(O.compareTo(
|
|
226
226
|
o)>=0)return O.subtract(o);if(O.signum()<0)O.addTo(o,O);else return O;return O.signum()<0?O.add(o):O}var wt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,
|
|
227
227
|
127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
|
|
228
228
|
419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,
|
|
229
|
-
739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],
|
|
230
|
-
c=this.abs();if(c.t==1&&c[0]<=wt[wt.length-1]){for(a=0;a<wt.length;++a)if(c[0]==wt[a])return!0;return!1}if(c.isEven())return!1;for(a=1;a<wt.length;){for(var p=wt[a],m=a+1;m<wt.length&&p<
|
|
231
|
-
for(p=c.modInt(p);a<m;)if(p%wt[a++]==0)return!1}return c.millerRabin(o)}function
|
|
229
|
+
739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ic=(1<<26)/wt[wt.length-1];function sc(o){var a,
|
|
230
|
+
c=this.abs();if(c.t==1&&c[0]<=wt[wt.length-1]){for(a=0;a<wt.length;++a)if(c[0]==wt[a])return!0;return!1}if(c.isEven())return!1;for(a=1;a<wt.length;){for(var p=wt[a],m=a+1;m<wt.length&&p<ic;)p*=wt[m++];
|
|
231
|
+
for(p=c.modInt(p);a<m;)if(p%wt[a++]==0)return!1}return c.millerRabin(o)}function ac(o){var a=this.subtract(h.ONE),c=a.getLowestSetBit();if(c<=0)return!1;var p=a.shiftRight(c);o=o+1>>1,o>wt.length&&(o=
|
|
232
232
|
wt.length);for(var m=f(),w=0;w<o;++w){m.fromInt(wt[Math.floor(.5*wt.length)]);var B=m.modPow(p,this);if(B.compareTo(h.ONE)!=0&&B.compareTo(a)!=0){for(var O=1;O++<c&&B.compareTo(a)!=0;)if(B=B.modPowInt(
|
|
233
|
-
2,this),B.compareTo(h.ONE)==0)return!1;if(B.compareTo(a)!=0)return!1}}return!0}h.prototype.chunkSize=
|
|
234
|
-
k,h.prototype.changeBit=ut,h.prototype.addTo=Et,h.prototype.dMultiply=
|
|
235
|
-
|
|
233
|
+
2,this),B.compareTo(h.ONE)==0)return!1;if(B.compareTo(a)!=0)return!1}}return!0}h.prototype.chunkSize=ui,h.prototype.toRadix=ks,h.prototype.fromRadix=Es,h.prototype.fromNumber=Ss,h.prototype.bitwiseTo=
|
|
234
|
+
k,h.prototype.changeBit=ut,h.prototype.addTo=Et,h.prototype.dMultiply=hi,h.prototype.dAddOffset=fi,h.prototype.multiplyLowerTo=zu,h.prototype.multiplyUpperTo=ju,h.prototype.modInt=rc,h.prototype.millerRabin=
|
|
235
|
+
ac,h.prototype.clone=dt,h.prototype.intValue=It,h.prototype.byteValue=qt,h.prototype.shortValue=xt,h.prototype.signum=Nt,h.prototype.toByteArray=Bs,h.prototype.equals=ci,h.prototype.min=X,h.prototype.
|
|
236
236
|
max=I,h.prototype.and=D,h.prototype.or=z,h.prototype.xor=ee,h.prototype.andNot=fe,h.prototype.not=U,h.prototype.shiftLeft=te,h.prototype.shiftRight=ae,h.prototype.getLowestSetBit=xe,h.prototype.bitCount=
|
|
237
237
|
Be,h.prototype.testBit=je,h.prototype.setBit=tt,h.prototype.clearBit=ct,h.prototype.flipBit=ht,h.prototype.add=ft,h.prototype.subtract=Dt,h.prototype.multiply=Ot,h.prototype.divide=Ft,h.prototype.remainder=
|
|
238
|
-
Jt,h.prototype.divideAndRemainder=Ln,h.prototype.modPow=
|
|
238
|
+
Jt,h.prototype.divideAndRemainder=Ln,h.prototype.modPow=tc,h.prototype.modInverse=oc,h.prototype.pow=$u,h.prototype.gcd=nc,h.prototype.isProbablePrime=sc,h.prototype.square=Lt;var Qe=h;Qe.prototype.IsNegative=
|
|
239
239
|
function(){return this.compareTo(Qe.ZERO)==-1},Qe.op_Equality=function(o,a){return o.compareTo(a)==0},Qe.op_Inequality=function(o,a){return o.compareTo(a)!=0},Qe.op_GreaterThan=function(o,a){return o.
|
|
240
240
|
compareTo(a)>0},Qe.op_LessThan=function(o,a){return o.compareTo(a)<0},Qe.op_Addition=function(o,a){return new Qe(o,void 0,void 0).add(new Qe(a,void 0,void 0))},Qe.op_Subtraction=function(o,a){return new Qe(
|
|
241
241
|
o,void 0,void 0).subtract(new Qe(a,void 0,void 0))},Qe.Int128Mul=function(o,a){return new Qe(o,void 0,void 0).multiply(new Qe(a,void 0,void 0))},Qe.op_Division=function(o,a){return o.divide(a)},Qe.prototype.
|
|
@@ -462,9 +462,9 @@ o.Edge2||o.Edge1.PrevInSEL===o.Edge2},e.Clipper.IntersectNodeSort=function(o,a){
|
|
|
462
462
|
this.CopyAELToSEL();for(var o=this.m_IntersectList.length,a=0;a<o;a++){if(!this.EdgesAdjacent(this.m_IntersectList[a])){for(var c=a+1;c<o&&!this.EdgesAdjacent(this.m_IntersectList[c]);)c++;if(c===o)return!1;
|
|
463
463
|
var p=this.m_IntersectList[a];this.m_IntersectList[a]=this.m_IntersectList[c],this.m_IntersectList[c]=p}this.SwapPositionsInSEL(this.m_IntersectList[a].Edge1,this.m_IntersectList[a].Edge2)}return!0},e.
|
|
464
464
|
Clipper.prototype.ProcessIntersectList=function(){for(var o=0,a=this.m_IntersectList.length;o<a;o++){var c=this.m_IntersectList[o];this.IntersectEdges(c.Edge1,c.Edge2,c.Pt),this.SwapPositionsInAEL(c.Edge1,
|
|
465
|
-
c.Edge2)}this.m_IntersectList.length=0};var
|
|
466
|
-
abs(o)):Math.round(o)},
|
|
467
|
-
Round=
|
|
465
|
+
c.Edge2)}this.m_IntersectList.length=0};var lc=function(o){return o<0?Math.ceil(o-.5):Math.round(o)},uc=function(o){return o<0?Math.ceil(o-.5):Math.floor(o+.5)},cc=function(o){return o<0?-Math.round(Math.
|
|
466
|
+
abs(o)):Math.round(o)},hc=function(o){return o<0?(o-=.5,o<-2147483648?Math.ceil(o):o|0):(o+=.5,o>2147483647?Math.floor(o):o|0)};i.msie?e.Clipper.Round=lc:i.chromium?e.Clipper.Round=cc:i.safari?e.Clipper.
|
|
467
|
+
Round=hc:e.Clipper.Round=uc,e.Clipper.TopX=function(o,a){return a===o.Top.Y?o.Top.X:o.Bot.X+e.Clipper.Round(o.Dx*(a-o.Bot.Y))},e.Clipper.prototype.IntersectPoint=function(o,a,c){c.X=0,c.Y=0;var p,m;if(o.
|
|
468
468
|
Dx===a.Dx){c.Y=o.Curr.Y,c.X=e.Clipper.TopX(o,c.Y);return}if(o.Delta.X===0)c.X=o.Bot.X,e.ClipperBase.IsHorizontal(a)?c.Y=a.Bot.Y:(m=a.Bot.Y-a.Bot.X/a.Dx,c.Y=e.Clipper.Round(c.X/a.Dx+m));else if(a.Delta.
|
|
469
469
|
X===0)c.X=a.Bot.X,e.ClipperBase.IsHorizontal(o)?c.Y=o.Bot.Y:(p=o.Bot.Y-o.Bot.X/o.Dx,c.Y=e.Clipper.Round(c.X/o.Dx+p));else{p=o.Bot.X-o.Bot.Y*o.Dx,m=a.Bot.X-a.Bot.Y*a.Dx;var w=(m-p)/(o.Dx-a.Dx);c.Y=e.Clipper.
|
|
470
470
|
Round(w),Math.abs(o.Dx)<Math.abs(a.Dx)?c.X=e.Clipper.Round(o.Dx*w+p):c.X=e.Clipper.Round(a.Dx*w+m)}if(c.Y<o.Top.Y||c.Y<a.Top.Y){if(o.Top.Y>a.Top.Y)return c.Y=o.Top.Y,c.X=e.Clipper.TopX(a,o.Top.Y),c.X<
|
|
@@ -619,10 +619,10 @@ re++);H=B[re-1],(B[0].X-H.X)*(B[0].X-H.X)+(B[0].Y-H.Y)*(B[0].Y-H.Y)<=L&&re--,re<
|
|
|
619
619
|
le},e.JS.Clone=function(o){if(!(o instanceof Array))return[];if(o.length===0)return[];if(o.length===1&&o[0].length===0)return[[]];var a=o[0]instanceof Array;a||(o=[o]);var c=o.length,p,m,w,B,O=new Array(
|
|
620
620
|
c);for(m=0;m<c;m++){for(p=o[m].length,B=new Array(p),w=0;w<p;w++)B[w]={X:o[m][w].X,Y:o[m][w].Y};O[m]=B}return a||(O=O[0]),O},e.JS.Lighten=function(o,a){if(!(o instanceof Array))return[];if(typeof a!="\
|
|
621
621
|
number"||a===null)return e.Error("Tolerance is not a number in Lighten()."),e.JS.Clone(o);if(o.length===0||o.length===1&&o[0].length===0||a<0)return e.JS.Clone(o);var c=o[0]instanceof Array;c||(o=[o]);
|
|
622
|
-
var p,m,w,B,O,L,H,re,K,le,Ce,Ne,De,$e,St,tn,
|
|
623
|
-
push({X:w[0].X,Y:w[0].Y}),L=w.length):Ne=0,Ce=[],m=0;m<L-2;m++)H=w[m],K=w[m+1],re=w[m+2],tn=H.X,
|
|
624
|
-
|
|
625
|
-
Y:w[L-1].Y}),Ne&&w.pop(),Ce.length)w=O;else break}L=O.length,O[L-1].X===O[0].X&&O[L-1].Y===O[0].Y&&O.pop(),O.length>2&&
|
|
622
|
+
var p,m,w,B,O,L,H,re,K,le,Ce,Ne,De,$e,St,tn,mr,fc=o.length,pc=a*a,yr=[];for(p=0;p<fc;p++)if(w=o[p],L=w.length,L!==0){for(B=0;B<1e6;B++){for(O=[],L=w.length,w[L-1].X!==w[0].X||w[L-1].Y!==w[0].Y?(Ne=1,w.
|
|
623
|
+
push({X:w[0].X,Y:w[0].Y}),L=w.length):Ne=0,Ce=[],m=0;m<L-2;m++)H=w[m],K=w[m+1],re=w[m+2],tn=H.X,mr=H.Y,De=re.X-tn,$e=re.Y-mr,(De!==0||$e!==0)&&(St=((K.X-tn)*De+(K.Y-mr)*$e)/(De*De+$e*$e),St>1?(tn=re.X,
|
|
624
|
+
mr=re.Y):St>0&&(tn+=De*St,mr+=$e*St)),De=K.X-tn,$e=K.Y-mr,le=De*De+$e*$e,le<=pc&&(Ce[m+1]=1,m++);for(O.push({X:w[0].X,Y:w[0].Y}),m=1;m<L-1;m++)Ce[m]||O.push({X:w[m].X,Y:w[m].Y});if(O.push({X:w[L-1].X,
|
|
625
|
+
Y:w[L-1].Y}),Ne&&w.pop(),Ce.length)w=O;else break}L=O.length,O[L-1].X===O[0].X&&O[L-1].Y===O[0].Y&&O.pop(),O.length>2&&yr.push(O)}return c||(yr=yr[0]),typeof yr>"u"&&(yr=[]),yr},e.JS.PerimeterOfPath=function(o,a,c){
|
|
626
626
|
if(typeof o>"u")return 0;var p=Math.sqrt,m=0,w,B,O=0,L=0,H=0,re=0,K=o.length;if(K<2)return 0;for(a&&(o[K]=o[0],K++);--K;)w=o[K],O=w.X,L=w.Y,B=o[K-1],H=B.X,re=B.Y,m+=p((O-H)*(O-H)+(L-re)*(L-re));return a&&
|
|
627
627
|
o.pop(),m/c},e.JS.PerimeterOfPaths=function(o,a,c){c||(c=1);for(var p=0,m=0;m<o.length;m++)p+=e.JS.PerimeterOfPath(o[m],a,c);return p},e.JS.ScaleDownPath=function(o,a){var c,p;for(a||(a=1),c=o.length;c--;)
|
|
628
628
|
p=o[c],p.X=p.X/a,p.Y=p.Y/a},e.JS.ScaleDownPaths=function(o,a){var c,p,m;for(a||(a=1),c=o.length;c--;)for(p=o[c].length;p--;)m=o[c][p],m.X=m.X/a,m.Y=m.Y/a},e.JS.ScaleUpPath=function(o,a){var c,p,m=Math.
|
|
@@ -630,33 +630,33 @@ round;for(a||(a=1),c=o.length;c--;)p=o[c],p.X=m(p.X*a),p.Y=m(p.Y*a)},e.JS.ScaleU
|
|
|
630
630
|
Y=w(m.Y*a)},e.ExPolygons=function(){return[]},e.ExPolygon=function(){this.outer=null,this.holes=null},e.JS.AddOuterPolyNodeToExPolygons=function(o,a){var c=new e.ExPolygon;c.outer=o.Contour();var p=o.
|
|
631
631
|
Childs(),m=p.length;c.holes=new Array(m);var w,B,O,L,H,re;for(O=0;O<m;O++)for(w=p[O],c.holes[O]=w.Contour(),L=0,H=w.Childs(),re=H.length;L<re;L++)B=H[L],e.JS.AddOuterPolyNodeToExPolygons(B,a);a.push(c)},
|
|
632
632
|
e.JS.ExPolygonsToPaths=function(o){var a,c,p,m,w=new e.Paths;for(a=0,p=o.length;a<p;a++)for(w.push(o[a].outer),c=0,m=o[a].holes.length;c<m;c++)w.push(o[a].holes[c]);return w},e.JS.PolyTreeToExPolygons=
|
|
633
|
-
function(o){var a=new e.ExPolygons,c,p,m,w;for(p=0,m=o.Childs(),w=m.length;p<w;p++)c=m[p],e.JS.AddOuterPolyNodeToExPolygons(c,a);return a}})()});var
|
|
633
|
+
function(o){var a=new e.ExPolygons,c,p,m,w;for(p=0,m=o.Childs(),w=m.length;p<w;p++)c=m[p],e.JS.AddOuterPolyNodeToExPolygons(c,a);return a}})()});var q0={};Ts(q0,{addFonts:()=>Qs,frame:()=>qu,open:()=>Gu});function Qs(e){if(e.fonts.length===0||typeof FontFace>"u"||typeof document>"u"||!document.fonts||document.getElementById(e.fontId))return;let t=document.createElement("meta");t.id=e.fontId,document.head.
|
|
634
634
|
append(t);for(let n of e.fonts){if(n.bitmap)continue;let r=atob(n.base64),i=new Uint8Array(r.length);for(let l=0;l<r.length;l++)i[l]=r.charCodeAt(l);let s={style:n.style,weight:n.weight};n.stretch&&(s.
|
|
635
|
-
stretch=n.stretch),document.fonts.add(new FontFace(n.family,i.buffer,s))}}var j={};Ts(j,{BRAND:()=>
|
|
635
|
+
stretch=n.stretch),document.fonts.add(new FontFace(n.family,i.buffer,s))}}var j={};Ts(j,{BRAND:()=>Hc,DIRTY:()=>Yn,EMPTY_PATH:()=>Cc,INVALID:()=>we,NEVER:()=>_h,OK:()=>yt,ParseStatus:()=>At,Schema:()=>Me,ZodAny:()=>Cn,ZodArray:()=>pn,ZodBigInt:()=>Wn,ZodBoolean:()=>Gn,ZodBranded:()=>Gr,
|
|
636
636
|
ZodCatch:()=>er,ZodDate:()=>qn,ZodDefault:()=>Kn,ZodDiscriminatedUnion:()=>vo,ZodEffects:()=>$t,ZodEnum:()=>Jn,ZodError:()=>Pt,ZodFirstPartyTypeKind:()=>ke,ZodFunction:()=>xo,ZodIntersection:()=>zn,ZodIssueCode:()=>ie,
|
|
637
|
-
ZodLazy:()=>jn,ZodLiteral:()=>Vn,ZodMap:()=>
|
|
638
|
-
ZodPipeline:()=>qr,ZodPromise:()=>kn,ZodReadonly:()=>tr,ZodRecord:()=>Io,ZodSchema:()=>Me,ZodSet:()=>
|
|
639
|
-
ZodUnion:()=>$n,ZodUnknown:()=>fn,ZodVoid:()=>
|
|
640
|
-
discriminatedUnion:()=>
|
|
641
|
-
late:()
|
|
642
|
-
optional:()=>
|
|
643
|
-
tuple:()=>
|
|
637
|
+
ZodLazy:()=>jn,ZodLiteral:()=>Vn,ZodMap:()=>wr,ZodNaN:()=>kr,ZodNativeEnum:()=>Zn,ZodNever:()=>Zt,ZodNull:()=>Hn,ZodNullable:()=>on,ZodNumber:()=>Xn,ZodObject:()=>_t,ZodOptional:()=>Ut,ZodParsedType:()=>pe,
|
|
638
|
+
ZodPipeline:()=>qr,ZodPromise:()=>kn,ZodReadonly:()=>tr,ZodRecord:()=>Io,ZodSchema:()=>Me,ZodSet:()=>Cr,ZodString:()=>wn,ZodSymbol:()=>Ir,ZodTransformer:()=>$t,ZodTuple:()=>rn,ZodType:()=>Me,ZodUndefined:()=>Un,
|
|
639
|
+
ZodUnion:()=>$n,ZodUnknown:()=>fn,ZodVoid:()=>xr,addIssueToContext:()=>ue,any:()=>th,array:()=>ih,bigint:()=>Vc,boolean:()=>Us,coerce:()=>Ph,custom:()=>Ws,date:()=>Jc,datetimeRegex:()=>Ys,defaultErrorMap:()=>cn,
|
|
640
|
+
discriminatedUnion:()=>uh,effect:()=>Ih,enum:()=>gh,function:()=>Ah,getErrorMap:()=>gr,getParsedType:()=>nn,instanceof:()=>zc,intersection:()=>ch,isAborted:()=>go,isAsync:()=>br,isDirty:()=>bo,isValid:()=>xn,
|
|
641
|
+
late:()=>$c,lazy:()=>mh,literal:()=>yh,makeIssue:()=>Wr,map:()=>ph,nan:()=>jc,nativeEnum:()=>bh,never:()=>rh,null:()=>eh,nullable:()=>wh,number:()=>qs,object:()=>sh,objectUtil:()=>pi,oboolean:()=>Bh,onumber:()=>Sh,
|
|
642
|
+
optional:()=>xh,ostring:()=>Eh,pipeline:()=>kh,preprocess:()=>Ch,promise:()=>vh,quotelessJson:()=>Ic,record:()=>fh,set:()=>dh,setErrorMap:()=>wc,strictObject:()=>ah,string:()=>Gs,symbol:()=>Zc,transformer:()=>Ih,
|
|
643
|
+
tuple:()=>hh,undefined:()=>Kc,union:()=>lh,unknown:()=>nh,util:()=>Oe,void:()=>oh});var Oe;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{let s={};for(let l of i)s[l]=l;return s},e.getValidEnumValues=i=>{let s=e.
|
|
644
644
|
objectKeys(i).filter(u=>typeof i[i[u]]!="number"),l={};for(let u of s)l[u]=i[u];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys==
|
|
645
645
|
"function"?i=>Object.keys(i):i=>{let s=[];for(let l in i)Object.prototype.hasOwnProperty.call(i,l)&&s.push(l);return s},e.find=(i,s)=>{for(let l of i)if(s(l))return l},e.isInteger=typeof Number.isInteger==
|
|
646
646
|
"function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}e.joinValues=r,e.jsonStringifyReplacer=
|
|
647
|
-
(i,s)=>typeof s=="bigint"?s.toString():s})(Oe||(Oe={}));var
|
|
647
|
+
(i,s)=>typeof s=="bigint"?s.toString():s})(Oe||(Oe={}));var pi;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(pi||(pi={}));var pe=Oe.arrayToEnum(["string","nan","number","integer","float","boolean",
|
|
648
648
|
"date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nn=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.
|
|
649
649
|
string;case"number":return Number.isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.
|
|
650
650
|
isArray(e)?pe.array:e===null?pe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?pe.promise:typeof Map<"u"&&e instanceof Map?pe.map:typeof Set<"u"&&e instanceof Set?pe.set:typeof Date<
|
|
651
651
|
"u"&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}};var ie=Oe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","inval\
|
|
652
|
-
id_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),
|
|
652
|
+
id_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ic=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Pt=class e extends Error{get errors(){
|
|
653
653
|
return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.
|
|
654
654
|
setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(let l of s.issues)if(l.code===
|
|
655
655
|
"invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{
|
|
656
656
|
let u=r,h=0;for(;h<l.path.length;){let f=l.path[h];h===l.path.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(n(l))):u[f]=u[f]||{_errors:[]},u=u[f],h++}}};return i(this),r}static assert(t){if(!(t instanceof
|
|
657
657
|
e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Oe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.
|
|
658
658
|
message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};
|
|
659
|
-
Pt.create=e=>new Pt(e);var
|
|
659
|
+
Pt.create=e=>new Pt(e);var xc=(e,t)=>{let n;switch(e.code){case ie.invalid_type:e.received===pe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:n=`Invalid literal valu\
|
|
660
660
|
e, expected ${JSON.stringify(e.expected,Oe.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${Oe.joinValues(e.keys,", ")}`;break;case ie.invalid_union:n="Inva\
|
|
661
661
|
lid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Oe.joinValues(e.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${Oe.joinValues(
|
|
662
662
|
e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="I\
|
|
@@ -671,13 +671,13 @@ an "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ie.too_big:e.t
|
|
|
671
671
|
"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.
|
|
672
672
|
inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection r\
|
|
673
673
|
esults could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=t.defaultError,Oe.assertNever(
|
|
674
|
-
e)}return{message:n}},cn=
|
|
675
|
-
for(let f of h)u=f(l,{data:t,defaultError:u}).message;return{...i,path:s,message:u}},
|
|
674
|
+
e)}return{message:n}},cn=xc;var Ns=cn;function wc(e){Ns=e}function gr(){return Ns}var Wr=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let u="",h=r.filter(f=>!!f).slice().reverse();
|
|
675
|
+
for(let f of h)u=f(l,{data:t,defaultError:u}).message;return{...i,path:s,message:u}},Cc=[];function ue(e,t){let n=gr(),r=Wr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,
|
|
676
676
|
e.schemaErrorMap,n,n===cn?void 0:cn].filter(i=>!!i)});e.common.issues.push(r)}var At=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="a\
|
|
677
677
|
borted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let i of n){if(i.status==="aborted")return we;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){
|
|
678
678
|
let r=[];for(let i of n){let s=await i.key,l=await i.value;r.push({key:s,value:l})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let i of n){let{key:s,value:l}=i;if(s.status===
|
|
679
679
|
"aborted"||l.status==="aborted")return we;s.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[s.value]=l.value)}return{status:t.value,
|
|
680
|
-
value:r}}},we=Object.freeze({status:"aborted"}),Yn=e=>({status:"dirty",value:e}),yt=e=>({status:"valid",value:e}),go=e=>e.status==="aborted",bo=e=>e.status==="dirty",xn=e=>e.status==="valid",
|
|
680
|
+
value:r}}},we=Object.freeze({status:"aborted"}),Yn=e=>({status:"dirty",value:e}),yt=e=>({status:"valid",value:e}),go=e=>e.status==="aborted",bo=e=>e.status==="dirty",xn=e=>e.status==="valid",br=e=>typeof Promise<
|
|
681
681
|
"u"&&e instanceof Promise;var ye;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ye||(ye={}));var Ht=class{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this.
|
|
682
682
|
_path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ds=(e,t)=>{if(xn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed\
|
|
683
683
|
but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Pt(e.common.issues);return this._error=n,this._error}}};function Pe(e){if(!e)return{};let{errorMap:t,
|
|
@@ -685,13 +685,13 @@ invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Er
|
|
|
685
685
|
{errorMap:(l,u)=>{let{message:h}=e;return l.code==="invalid_enum_value"?{message:h??u.defaultError}:typeof u.data>"u"?{message:h??r??u.defaultError}:l.code!=="invalid_type"?{message:u.defaultError}:{message:h??
|
|
686
686
|
n??u.defaultError}},description:i}}var Me=class{get description(){return this._def.description}_getType(t){return nn(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:nn(
|
|
687
687
|
t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new At,ctx:{common:t.parent.common,data:t.data,parsedType:nn(t.data),schemaErrorMap:this._def.
|
|
688
|
-
errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(
|
|
688
|
+
errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(br(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.
|
|
689
689
|
resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this.
|
|
690
690
|
_def.errorMap,parent:null,data:t,parsedType:nn(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Ds(r,i)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this.
|
|
691
691
|
_def.errorMap,parent:null,data:t,parsedType:nn(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return xn(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.
|
|
692
692
|
toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>xn(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){
|
|
693
693
|
let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this.
|
|
694
|
-
_def.errorMap,parent:null,data:t,parsedType:nn(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(
|
|
694
|
+
_def.errorMap,parent:null,data:t,parsedType:nn(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(br(i)?i:Promise.resolve(i));return Ds(r,s)}refine(t,n){let r=i=>typeof n=="string"||typeof n>"u"?
|
|
695
695
|
{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{let l=t(i),u=()=>s.addIssue({code:ie.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(u(),!1)):l?
|
|
696
696
|
!0:(u(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new $t({schema:this,typeName:ke.ZodEffects,effect:{type:"refi\
|
|
697
697
|
nement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.
|
|
@@ -704,38 +704,38 @@ optional()}array(){return pn.create(this)}promise(){return kn.create(this,this._
|
|
|
704
704
|
this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Kn({...Pe(this._def),innerType:this,defaultValue:n,typeName:ke.
|
|
705
705
|
ZodDefault})}brand(){return new Gr({typeName:ke.ZodBranded,type:this,...Pe(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new er({...Pe(this._def),innerType:this,catchValue:n,typeName:ke.
|
|
706
706
|
ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return qr.create(this,t)}readonly(){return tr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){
|
|
707
|
-
return this.safeParse(null).success}},
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",
|
|
714
|
-
t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function
|
|
715
|
-
let t=`${Ls}T${Fs(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function
|
|
716
|
-
(t==="v6"||!t)&&
|
|
717
|
-
atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function
|
|
707
|
+
return this.safeParse(null).success}},kc=/^c[^\s-]{8,}$/i,Ec=/^[0-9a-z]+$/,Sc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pc=/^[a-z0-9_-]{21}$/i,
|
|
708
|
+
_c=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Mc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,
|
|
709
|
+
Tc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",di,Qc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
710
|
+
Nc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Dc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,
|
|
711
|
+
Oc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
712
|
+
Lc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ls="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468\
|
|
713
|
+
][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Yc=new RegExp(`^${Ls}$`);function Fs(e){let t="[0-5]\\d";e.precision?
|
|
714
|
+
t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Xc(e){return new RegExp(`^${Fs(e)}$`)}function Ys(e){
|
|
715
|
+
let t=`${Ls}T${Fs(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Wc(e,t){return!!((t==="v4"||!t)&&Qc.test(e)||
|
|
716
|
+
(t==="v6"||!t)&&Dc.test(e))}function Gc(e,t){if(!_c.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(
|
|
717
|
+
atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function qc(e,t){return!!((t==="v4"||!t)&&Nc.test(e)||(t==="v6"||!t)&&Oc.test(e))}var wn=class e extends Me{_parse(t){
|
|
718
718
|
if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pe.string){let s=this._getOrReturnCtx(t);return ue(s,{code:ie.invalid_type,expected:pe.string,received:s.parsedType}),we}let r=new At,i;
|
|
719
719
|
for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.
|
|
720
720
|
kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let l=t.
|
|
721
721
|
data.length>s.value,u=t.data.length<s.value;(l||u)&&(i=this._getOrReturnCtx(t,i),l?ue(i,{code:ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):u&&ue(i,{code:ie.too_small,
|
|
722
|
-
minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")
|
|
723
|
-
message:s.message}),r.dirty());else if(s.kind==="emoji")
|
|
724
|
-
dirty());else if(s.kind==="uuid")
|
|
725
|
-
(i=this._getOrReturnCtx(t,i),ue(i,{validation:"nanoid",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")
|
|
726
|
-
d",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")
|
|
727
|
-
kind==="ulid")
|
|
722
|
+
minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Tc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"email",code:ie.invalid_string,
|
|
723
|
+
message:s.message}),r.dirty());else if(s.kind==="emoji")di||(di=new RegExp(Rc,"u")),di.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"emoji",code:ie.invalid_string,message:s.message}),r.
|
|
724
|
+
dirty());else if(s.kind==="uuid")Bc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"uuid",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Pc.test(t.data)||
|
|
725
|
+
(i=this._getOrReturnCtx(t,i),ue(i,{validation:"nanoid",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cui\
|
|
726
|
+
d",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Ec.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"cuid2",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.
|
|
727
|
+
kind==="ulid")Sc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ulid",code:ie.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(
|
|
728
728
|
t,i),ue(i,{validation:"url",code:ie.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"regex",
|
|
729
729
|
code:ie.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.invalid_string,
|
|
730
730
|
validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsW\
|
|
731
731
|
ith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||
|
|
732
732
|
(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Ys(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.
|
|
733
|
-
invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?
|
|
734
|
-
s.kind==="time"?
|
|
735
|
-
t,i),ue(i,{validation:"duration",code:ie.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?
|
|
736
|
-
message}),r.dirty()):s.kind==="jwt"?
|
|
737
|
-
this._getOrReturnCtx(t,i),ue(i,{validation:"cidr",code:ie.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?
|
|
738
|
-
invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?
|
|
733
|
+
invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Yc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.invalid_string,validation:"date",message:s.message}),r.dirty()):
|
|
734
|
+
s.kind==="time"?Xc(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{code:ie.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Mc.test(t.data)||(i=this._getOrReturnCtx(
|
|
735
|
+
t,i),ue(i,{validation:"duration",code:ie.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Wc(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"ip",code:ie.invalid_string,message:s.
|
|
736
|
+
message}),r.dirty()):s.kind==="jwt"?Gc(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"jwt",code:ie.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qc(t.data,s.version)||(i=
|
|
737
|
+
this._getOrReturnCtx(t,i),ue(i,{validation:"cidr",code:ie.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Lc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64",code:ie.
|
|
738
|
+
invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Fc.test(t.data)||(i=this._getOrReturnCtx(t,i),ue(i,{validation:"base64url",code:ie.invalid_string,message:s.message}),r.dirty()):Oe.assertNever(
|
|
739
739
|
s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:ie.invalid_string,...ye.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this.
|
|
740
740
|
_def.checks,t]})}email(t){return this._addCheck({kind:"email",...ye.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ye.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ye.errToObj(
|
|
741
741
|
t)})}uuid(t){return this._addCheck({kind:"uuid",...ye.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ye.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ye.errToObj(t)})}cuid2(t){
|
|
@@ -754,13 +754,13 @@ _def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(
|
|
|
754
754
|
find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.
|
|
755
755
|
kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base6\
|
|
756
756
|
4")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){
|
|
757
|
-
let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};wn.create=e=>new wn({checks:[],typeName:ke.ZodString,coerce:e?.coerce??!1,...Pe(e)});function
|
|
757
|
+
let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};wn.create=e=>new wn({checks:[],typeName:ke.ZodString,coerce:e?.coerce??!1,...Pe(e)});function Uc(e,t){
|
|
758
758
|
let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return s%
|
|
759
759
|
l/10**i}var Xn=class e extends Me{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==
|
|
760
760
|
pe.number){let s=this._getOrReturnCtx(t);return ue(s,{code:ie.invalid_type,expected:pe.number,received:s.parsedType}),we}let r,i=new At;for(let s of this._def.checks)s.kind==="int"?Oe.isInteger(t.data)||
|
|
761
761
|
(r=this._getOrReturnCtx(t,r),ue(r,{code:ie.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(
|
|
762
762
|
t,r),ue(r,{code:ie.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(
|
|
763
|
-
t,r),ue(r,{code:ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?
|
|
763
|
+
t,r),ue(r,{code:ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Uc(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ue(r,{
|
|
764
764
|
code:ie.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ue(r,{code:ie.not_finite,message:s.message}),i.dirty()):
|
|
765
765
|
Oe.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ye.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ye.toString(n))}lte(t,n){return this.setLimit("ma\
|
|
766
766
|
x",t,!0,ye.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ye.toString(n))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ye.toString(
|
|
@@ -791,23 +791,23 @@ s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),ue(i,{code
|
|
|
791
791
|
value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ye.toString(n)})}max(t,n){
|
|
792
792
|
return this._addCheck({kind:"max",value:t.getTime(),message:ye.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(
|
|
793
793
|
t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};qn.create=e=>new qn({checks:[],coerce:e?.coerce||!1,
|
|
794
|
-
typeName:ke.ZodDate,...Pe(e)});var
|
|
795
|
-
we}return yt(t.data)}};
|
|
794
|
+
typeName:ke.ZodDate,...Pe(e)});var Ir=class extends Me{_parse(t){if(this._getType(t)!==pe.symbol){let r=this._getOrReturnCtx(t);return ue(r,{code:ie.invalid_type,expected:pe.symbol,received:r.parsedType}),
|
|
795
|
+
we}return yt(t.data)}};Ir.create=e=>new Ir({typeName:ke.ZodSymbol,...Pe(e)});var Un=class extends Me{_parse(t){if(this._getType(t)!==pe.undefined){let r=this._getOrReturnCtx(t);return ue(r,{code:ie.invalid_type,
|
|
796
796
|
expected:pe.undefined,received:r.parsedType}),we}return yt(t.data)}};Un.create=e=>new Un({typeName:ke.ZodUndefined,...Pe(e)});var Hn=class extends Me{_parse(t){if(this._getType(t)!==pe.null){let r=this.
|
|
797
797
|
_getOrReturnCtx(t);return ue(r,{code:ie.invalid_type,expected:pe.null,received:r.parsedType}),we}return yt(t.data)}};Hn.create=e=>new Hn({typeName:ke.ZodNull,...Pe(e)});var Cn=class extends Me{constructor(){
|
|
798
798
|
super(...arguments),this._any=!0}_parse(t){return yt(t.data)}};Cn.create=e=>new Cn({typeName:ke.ZodAny,...Pe(e)});var fn=class extends Me{constructor(){super(...arguments),this._unknown=!0}_parse(t){return yt(
|
|
799
799
|
t.data)}};fn.create=e=>new fn({typeName:ke.ZodUnknown,...Pe(e)});var Zt=class extends Me{_parse(t){let n=this._getOrReturnCtx(t);return ue(n,{code:ie.invalid_type,expected:pe.never,received:n.parsedType}),
|
|
800
|
-
we}};Zt.create=e=>new Zt({typeName:ke.ZodNever,...Pe(e)});var
|
|
801
|
-
void,received:r.parsedType}),we}return yt(t.data)}};
|
|
800
|
+
we}};Zt.create=e=>new Zt({typeName:ke.ZodNever,...Pe(e)});var xr=class extends Me{_parse(t){if(this._getType(t)!==pe.undefined){let r=this._getOrReturnCtx(t);return ue(r,{code:ie.invalid_type,expected:pe.
|
|
801
|
+
void,received:r.parsedType}),we}return yt(t.data)}};xr.create=e=>new xr({typeName:ke.ZodVoid,...Pe(e)});var pn=class e extends Me{_parse(t){let{ctx:n,status:r}=this._processInputParams(t),i=this._def;
|
|
802
802
|
if(n.parsedType!==pe.array)return ue(n,{code:ie.invalid_type,expected:pe.array,received:n.parsedType}),we;if(i.exactLength!==null){let l=n.data.length>i.exactLength.value,u=n.data.length<i.exactLength.
|
|
803
803
|
value;(l||u)&&(ue(n,{code:l?ie.too_big:ie.too_small,minimum:u?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}
|
|
804
804
|
if(i.minLength!==null&&n.data.length<i.minLength.value&&(ue(n,{code:ie.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&
|
|
805
805
|
n.data.length>i.maxLength.value&&(ue(n,{code:ie.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].
|
|
806
806
|
map((l,u)=>i.type._parseAsync(new Ht(n,l,n.path,u)))).then(l=>At.mergeArray(r,l));let s=[...n.data].map((l,u)=>i.type._parseSync(new Ht(n,l,n.path,u)));return At.mergeArray(r,s)}get element(){return this.
|
|
807
807
|
_def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ye.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ye.toString(n)}})}length(t,n){return new e({...this.
|
|
808
|
-
_def,exactLength:{value:t,message:ye.toString(n)}})}nonempty(t){return this.min(1,t)}};pn.create=(e,t)=>new pn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...Pe(t)});function
|
|
809
|
-
if(e instanceof _t){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ut.create(
|
|
810
|
-
Ut?Ut.create(
|
|
808
|
+
_def,exactLength:{value:t,message:ye.toString(n)}})}nonempty(t){return this.min(1,t)}};pn.create=(e,t)=>new pn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,...Pe(t)});function vr(e){
|
|
809
|
+
if(e instanceof _t){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Ut.create(vr(r))}return new _t({...e._def,shape:()=>t})}else return e instanceof pn?new pn({...e._def,type:vr(e.element)}):e instanceof
|
|
810
|
+
Ut?Ut.create(vr(e.unwrap())):e instanceof on?on.create(vr(e.unwrap())):e instanceof rn?rn.create(e.items.map(t=>vr(t))):e}var _t=class e extends Me{constructor(){super(...arguments),this._cached=null,
|
|
811
811
|
this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Oe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){
|
|
812
812
|
if(this._getType(t)!==pe.object){let f=this._getOrReturnCtx(t);return ue(f,{code:ie.invalid_type,expected:pe.object,received:f.parsedType}),we}let{status:r,ctx:i}=this._processInputParams(t),{shape:s,
|
|
813
813
|
keys:l}=this._getCached(),u=[];if(!(this._def.catchall instanceof Zt&&this._def.unknownKeys==="strip"))for(let f in i.data)l.includes(f)||u.push(f);let h=[];for(let f of l){let A=s[f],d=i.data[f];h.push(
|
|
@@ -820,7 +820,7 @@ message??r.defaultError;return n.code==="unrecognized_keys"?{message:ye.errToObj
|
|
|
820
820
|
...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({
|
|
821
821
|
...this._def.shape(),...t._def.shape()}),typeName:ke.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of Oe.objectKeys(
|
|
822
822
|
t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let r of Oe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:()=>n})}deepPartial(){
|
|
823
|
-
return
|
|
823
|
+
return vr(this)}partial(t){let n={};for(let r of Oe.objectKeys(this.shape)){let i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let r of Oe.
|
|
824
824
|
objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ut;)s=s._def.innerType;n[r]=s}return new e({...this._def,shape:()=>n})}keyof(){return Xs(Oe.objectKeys(
|
|
825
825
|
this.shape))}};_t.create=(e,t)=>new _t({shape:()=>e,unknownKeys:"strip",catchall:Zt.create(),typeName:ke.ZodObject,...Pe(t)});_t.strictCreate=(e,t)=>new _t({shape:()=>e,unknownKeys:"strict",catchall:Zt.
|
|
826
826
|
create(),typeName:ke.ZodObject,...Pe(t)});_t.lazycreate=(e,t)=>new _t({shape:e,unknownKeys:"strip",catchall:Zt.create(),typeName:ke.ZodObject,...Pe(t)});var $n=class extends Me{_parse(t){let{ctx:n}=this.
|
|
@@ -836,10 +836,10 @@ parsedType}),we;let r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);re
|
|
|
836
836
|
(ue(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),we)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){
|
|
837
837
|
return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let s of n){let l=hn(s.shape[t]);if(!l.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all \
|
|
838
838
|
schema options`);for(let u of l){if(i.has(u))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(u)}`);i.set(u,s)}}return new e({typeName:ke.ZodDiscriminatedUnion,discriminator:t,
|
|
839
|
-
options:n,optionsMap:i,...Pe(r)})}};function
|
|
840
|
-
u)!==-1),l={...e,...t};for(let u of s){let h=
|
|
841
|
-
let i=[];for(let s=0;s<e.length;s++){let l=e[s],u=t[s],h=
|
|
842
|
-
var zn=class extends Me{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=(s,l)=>{if(go(s)||go(l))return we;let u=
|
|
839
|
+
options:n,optionsMap:i,...Pe(r)})}};function Ai(e,t){let n=nn(e),r=nn(t);if(e===t)return{valid:!0,data:e};if(n===pe.object&&r===pe.object){let i=Oe.objectKeys(t),s=Oe.objectKeys(e).filter(u=>i.indexOf(
|
|
840
|
+
u)!==-1),l={...e,...t};for(let u of s){let h=Ai(e[u],t[u]);if(!h.valid)return{valid:!1};l[u]=h.data}return{valid:!0,data:l}}else if(n===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};
|
|
841
|
+
let i=[];for(let s=0;s<e.length;s++){let l=e[s],u=t[s],h=Ai(l,u);if(!h.valid)return{valid:!1};i.push(h.data)}return{valid:!0,data:i}}else return n===pe.date&&r===pe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}
|
|
842
|
+
var zn=class extends Me{_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=(s,l)=>{if(go(s)||go(l))return we;let u=Ai(s.value,l.value);return u.valid?((bo(s)||bo(l))&&n.dirty(),{status:n.value,
|
|
843
843
|
value:u.data}):(ue(r,{code:ie.invalid_intersection_types}),we)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,
|
|
844
844
|
path:r.path,parent:r})]).then(([s,l])=>i(s,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};zn.create=(e,t,n)=>new zn(
|
|
845
845
|
{left:e,right:t,typeName:ke.ZodIntersection,...Pe(n)});var rn=class e extends Me{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.array)return ue(r,{code:ie.invalid_type,
|
|
@@ -850,21 +850,21 @@ _def.rest;return h?h._parse(new Ht(r,l,r.path,u)):null}).filter(l=>!!l);return r
|
|
|
850
850
|
var Io=class e extends Me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.object)return ue(
|
|
851
851
|
r,{code:ie.invalid_type,expected:pe.object,received:r.parsedType}),we;let i=[],s=this._def.keyType,l=this._def.valueType;for(let u in r.data)i.push({key:s._parse(new Ht(r,u,r.path,u)),value:l._parse(new Ht(
|
|
852
852
|
r,r.data[u],r.path,u)),alwaysSet:u in r.data});return r.common.async?At.mergeObjectAsync(n,i):At.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Me?
|
|
853
|
-
new e({keyType:t,valueType:n,typeName:ke.ZodRecord,...Pe(r)}):new e({keyType:wn.create(),valueType:t,typeName:ke.ZodRecord,...Pe(n)})}},
|
|
853
|
+
new e({keyType:t,valueType:n,typeName:ke.ZodRecord,...Pe(r)}):new e({keyType:wn.create(),valueType:t,typeName:ke.ZodRecord,...Pe(n)})}},wr=class extends Me{get keySchema(){return this._def.keyType}get valueSchema(){
|
|
854
854
|
return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.map)return ue(r,{code:ie.invalid_type,expected:pe.map,received:r.parsedType}),we;let i=this._def.
|
|
855
855
|
keyType,s=this._def.valueType,l=[...r.data.entries()].map(([u,h],f)=>({key:i._parse(new Ht(r,u,r.path,[f,"key"])),value:s._parse(new Ht(r,h,r.path,[f,"value"]))}));if(r.common.async){let u=new Map;return Promise.
|
|
856
856
|
resolve().then(async()=>{for(let h of l){let f=await h.key,A=await h.value;if(f.status==="aborted"||A.status==="aborted")return we;(f.status==="dirty"||A.status==="dirty")&&n.dirty(),u.set(f.value,A.value)}
|
|
857
857
|
return{status:n.value,value:u}})}else{let u=new Map;for(let h of l){let f=h.key,A=h.value;if(f.status==="aborted"||A.status==="aborted")return we;(f.status==="dirty"||A.status==="dirty")&&n.dirty(),u.
|
|
858
|
-
set(f.value,A.value)}return{status:n.value,value:u}}}};
|
|
858
|
+
set(f.value,A.value)}return{status:n.value,value:u}}}};wr.create=(e,t,n)=>new wr({valueType:t,keyType:e,typeName:ke.ZodMap,...Pe(n)});var Cr=class e extends Me{_parse(t){let{status:n,ctx:r}=this._processInputParams(
|
|
859
859
|
t);if(r.parsedType!==pe.set)return ue(r,{code:ie.invalid_type,expected:pe.set,received:r.parsedType}),we;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ue(r,{code:ie.too_small,minimum:i.
|
|
860
860
|
minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ue(r,{code:ie.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,
|
|
861
861
|
exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function l(h){let f=new Set;for(let A of h){if(A.status==="aborted")return we;A.status==="dirty"&&n.dirty(),f.add(A.value)}return{
|
|
862
862
|
status:n.value,value:f}}let u=[...r.data.values()].map((h,f)=>s._parse(new Ht(r,h,r.path,f)));return r.common.async?Promise.all(u).then(h=>l(h)):l(u)}min(t,n){return new e({...this._def,minSize:{value:t,
|
|
863
|
-
message:ye.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ye.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};
|
|
863
|
+
message:ye.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ye.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Cr.create=(e,t)=>new Cr(
|
|
864
864
|
{valueType:e,minSize:null,maxSize:null,typeName:ke.ZodSet,...Pe(t)});var xo=class e extends Me{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(
|
|
865
865
|
t);if(n.parsedType!==pe.function)return ue(n,{code:ie.invalid_type,expected:pe.function,received:n.parsedType}),we;function r(u,h){return Wr({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,
|
|
866
|
-
n.schemaErrorMap,
|
|
867
|
-
|
|
866
|
+
n.schemaErrorMap,gr(),cn].filter(f=>!!f),issueData:{code:ie.invalid_arguments,argumentsError:h}})}function i(u,h){return Wr({data:u,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,
|
|
867
|
+
gr(),cn].filter(f=>!!f),issueData:{code:ie.invalid_return_type,returnTypeError:h}})}let s={errorMap:n.common.contextualErrorMap},l=n.data;if(this._def.returns instanceof kn){let u=this;return yt(async function(...h){
|
|
868
868
|
let f=new Pt([]),A=await u._def.args.parseAsync(h,s).catch(g=>{throw f.addIssue(r(h,g)),f}),d=await Reflect.apply(l,this,A);return await u._def.returns._def.type.parseAsync(d,s).catch(g=>{throw f.addIssue(
|
|
869
869
|
i(d,g)),f})})}else{let u=this;return yt(function(...h){let f=u._def.args.safeParse(h,s);if(!f.success)throw new Pt([r(h,f.error)]);let A=Reflect.apply(l,this,f.data),d=u._def.returns.safeParse(A,s);if(!d.
|
|
870
870
|
success)throw new Pt([i(A,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:rn.create(t).rest(fn.create())})}returns(t){
|
|
@@ -897,47 +897,47 @@ ZodOptional,...Pe(t)});var on=class extends Me{_parse(t){return this._getType(t)
|
|
|
897
897
|
typeName:ke.ZodNullable,...Pe(t)});var Kn=class extends Me{_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType.
|
|
898
898
|
_parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Kn.create=(e,t)=>new Kn({innerType:e,typeName:ke.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.
|
|
899
899
|
default,...Pe(t)});var er=class extends Me{_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});
|
|
900
|
-
return
|
|
900
|
+
return br(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Pt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.
|
|
901
901
|
value:this._def.catchValue({get error(){return new Pt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};er.create=(e,t)=>new er({innerType:e,typeName:ke.ZodCatch,catchValue:typeof t.
|
|
902
|
-
catch=="function"?t.catch:()=>t.catch,...Pe(t)});var
|
|
903
|
-
parsedType}),we}return{status:"valid",value:t.data}}};
|
|
902
|
+
catch=="function"?t.catch:()=>t.catch,...Pe(t)});var kr=class extends Me{_parse(t){if(this._getType(t)!==pe.nan){let r=this._getOrReturnCtx(t);return ue(r,{code:ie.invalid_type,expected:pe.nan,received:r.
|
|
903
|
+
parsedType}),we}return{status:"valid",value:t.data}}};kr.create=e=>new kr({typeName:ke.ZodNaN,...Pe(e)});var Hc=Symbol("zod_brand"),Gr=class extends Me{_parse(t){let{ctx:n}=this._processInputParams(t),
|
|
904
904
|
r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},qr=class e extends Me{_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)
|
|
905
905
|
return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?we:s.status==="dirty"?(n.dirty(),Yn(s.value)):this._def.out._parseAsync({data:s.value,
|
|
906
906
|
path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?we:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out.
|
|
907
907
|
_parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:ke.ZodPipeline})}},tr=class extends Me{_parse(t){let n=this._def.innerType._parse(t),r=i=>(xn(i)&&
|
|
908
|
-
(i.value=Object.freeze(i.value)),i);return
|
|
908
|
+
(i.value=Object.freeze(i.value)),i);return br(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};tr.create=(e,t)=>new tr({innerType:e,typeName:ke.ZodReadonly,...Pe(t)});function Os(e,t){let n=typeof e==
|
|
909
909
|
"function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function Ws(e,t={},n){return e?Cn.create().superRefine((r,i)=>{let s=e(r);if(s instanceof Promise)return s.then(
|
|
910
|
-
l=>{if(!l){let u=Os(t,r),h=u.fatal??n??!0;i.addIssue({code:"custom",...u,fatal:h})}});if(!s){let l=Os(t,r),u=l.fatal??n??!0;i.addIssue({code:"custom",...l,fatal:u})}}):Cn.create()}var
|
|
910
|
+
l=>{if(!l){let u=Os(t,r),h=u.fatal??n??!0;i.addIssue({code:"custom",...u,fatal:h})}});if(!s){let l=Os(t,r),u=l.fatal??n??!0;i.addIssue({code:"custom",...l,fatal:u})}}):Cn.create()}var $c={object:_t.lazycreate},ke;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSy\
|
|
911
911
|
mbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="\
|
|
912
912
|
ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFuncti\
|
|
913
913
|
on",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="Zo\
|
|
914
|
-
dDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ke||(ke={}));var
|
|
915
|
-
create,
|
|
916
|
-
create,
|
|
917
|
-
|
|
918
|
-
number()}),
|
|
919
|
-
-pong"]).default("hold")}),
|
|
920
|
-
"mul"]).default("add"),seed:j.union([j.string(),j.number()]).optional(),noiseFreq:j.number().default(1),snap:j.number().optional()}),
|
|
921
|
-
ase","expo"]).default("linear"),apply:j.enum(["add","mul"]).default("add")});var
|
|
922
|
-
exec(e);return t?{key:t[1],field:t[2]}:void 0}function
|
|
923
|
-
Vs=j.object({x:j.number(),y:j.number()}),
|
|
924
|
-
expr:j.string().optional()}),
|
|
925
|
-
length===0?!1:t.every(n=>n==="wire"||n==="base"||n==="track"||n==="jitter"||n==="stagger"||n==="expr")}function Z(e){return e==null?{}:
|
|
926
|
-
ool","color","text","choice"]),
|
|
927
|
-
boolean().optional(),options:j.array(j.object({value:j.string(),label:j.string()})).optional(),description:j.string().optional()}),
|
|
928
|
-
params:j.record(
|
|
929
|
-
default(!1),micro:j.boolean().optional(),rows:j.array(
|
|
930
|
-
default("out"),to:j.string(),toPort:j.string()}),
|
|
914
|
+
dDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ke||(ke={}));var zc=(e,t={message:`Input not instance of ${e.name}`})=>Ws(n=>n instanceof e,t),Gs=wn.create,qs=Xn.create,jc=kr.create,Vc=Wn.create,Us=Gn.create,Jc=qn.create,Zc=Ir.create,Kc=Un.create,eh=Hn.create,th=Cn.
|
|
915
|
+
create,nh=fn.create,rh=Zt.create,oh=xr.create,ih=pn.create,sh=_t.create,ah=_t.strictCreate,lh=$n.create,uh=vo.create,ch=zn.create,hh=rn.create,fh=Io.create,ph=wr.create,dh=Cr.create,Ah=xo.create,mh=jn.
|
|
916
|
+
create,yh=Vn.create,gh=Jn.create,bh=Zn.create,vh=kn.create,Ih=$t.create,xh=Ut.create,wh=on.create,Ch=$t.createWithPreprocess,kh=qr.create,Eh=()=>Gs().optional(),Sh=()=>qs().optional(),Bh=()=>Us().optional(),
|
|
917
|
+
Ph={string:(e=>wn.create({...e,coerce:!0})),number:(e=>Xn.create({...e,coerce:!0})),boolean:(e=>Gn.create({...e,coerce:!0})),bigint:(e=>Wn.create({...e,coerce:!0})),date:(e=>qn.create({...e,coerce:!0}))};var _h=we;var Mh=j.enum(["linear","step","ease-in","ease-out","ease-in-out","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic"]),Hs=j.object({dt:j.number(),dv:j.
|
|
918
|
+
number()}),Th=j.object({t:j.number(),value:j.number(),easing:Mh.default("ease-in-out"),hIn:Hs.optional(),hOut:Hs.optional()}),Rh=j.object({keyframes:j.array(Th),extrapolate:j.enum(["hold","loop","ping\
|
|
919
|
+
-pong"]).default("hold")}),Qh=j.object({amount:j.number().default(0),distribution:j.enum(["uniform","gauss"]).default("uniform"),mode:j.enum(["frozen","animated"]).default("frozen"),apply:j.enum(["add",
|
|
920
|
+
"mul"]).default("add"),seed:j.union([j.string(),j.number()]).optional(),noiseFreq:j.number().default(1),snap:j.number().optional()}),Nh=j.object({amount:j.number().default(0),curve:j.enum(["linear","e\
|
|
921
|
+
ase","expo"]).default("linear"),apply:j.enum(["add","mul"]).default("add")});var mi=(e,t)=>`${e}.jitter.${t}`;function Dh(e){let t=/^(.+)\.jitter\.(amount|seed)$/.exec(e);return t?{key:t[1],field:t[2]}:void 0}var zs=(e,t="amount")=>`${e}.stagger.${t}`;function Oh(e){let t=/^(.+)\.stagger\.(amount)$/.
|
|
922
|
+
exec(e);return t?{key:t[1],field:t[2]}:void 0}function Er(e){return Dh(e)?.key??Oh(e)?.key}var Lh=j.object({from:j.string(),port:j.string().default("out")}),js=j.union([j.number(),j.string(),j.boolean()]),
|
|
923
|
+
Vs=j.object({x:j.number(),y:j.number()}),Fh=j.object({wire:Lh.optional(),base:j.union([js,Vs,j.array(j.number()),j.array(j.string())]).optional(),track:Rh.optional(),jitter:Qh.optional(),stagger:Nh.optional(),
|
|
924
|
+
expr:j.string().optional()}),Yh=j.union([js,Vs,j.array(j.number()),j.array(j.string()),Fh,j.null()]);function Xh(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.keys(e);return t.
|
|
925
|
+
length===0?!1:t.every(n=>n==="wire"||n==="base"||n==="track"||n==="jitter"||n==="stagger"||n==="expr")}function Z(e){return e==null?{}:Xh(e)?e:{base:e}}var Ur=33,Wh=j.enum(["number","int","percent","b\
|
|
926
|
+
ool","color","text","choice"]),Gh=j.object({key:j.string(),title:j.string(),kind:Wh,min:j.number().optional(),max:j.number().optional(),step:j.number().optional(),alpha:j.boolean().optional(),multiline:j.
|
|
927
|
+
boolean().optional(),options:j.array(j.object({value:j.string(),label:j.string()})).optional(),description:j.string().optional()}),qh=j.object({id:j.string(),type:j.string(),name:j.string().optional(),
|
|
928
|
+
params:j.record(Yh).default({}),position:j.object({x:j.number(),y:j.number()}).default({x:0,y:0}),seed:j.union([j.string(),j.number()]).optional(),collapsed:j.boolean().default(!1),disabled:j.boolean().
|
|
929
|
+
default(!1),micro:j.boolean().optional(),rows:j.array(Gh).optional(),units:j.record(j.string()).optional(),layer:j.string().optional()}),Uh=j.object({id:j.string(),from:j.string(),fromPort:j.string().
|
|
930
|
+
default("out"),to:j.string(),toPort:j.string()}),Hh=j.object({nodes:j.array(qh).default([]),edges:j.array(Uh).default([])}),$h=j.object({w:j.number().int().positive().default(1920),h:j.number().int().
|
|
931
931
|
positive().default(1080),bg:j.string().default("#05070a"),origin:j.enum(["top-left","center"]).default("top-left"),display:j.enum(["vector","pixel","mono"]).default("vector"),ink:j.string().default("#\
|
|
932
|
-
ffffff"),threshold:j.number().min(0).max(1).default(.5)})
|
|
933
|
-
string(),name:j.string(),nodeIds:j.array(j.string()).default([]),collapsed:j.boolean().default(!1),exposed:j.array(j.string()).default([])}),
|
|
934
|
-
positive(),duration:j.number().nonnegative(),codec:j.string(),pixfmt:j.string(),range:j.enum(["limited","full"]),matrix:j.enum(["bt709","bt601"])}),
|
|
935
|
-
number().int().positive(),height:j.number().int().positive(),bytes:j.number().int().nonnegative(),video:
|
|
936
|
-
number().positive()}),
|
|
937
|
-
graph:
|
|
932
|
+
ffffff"),threshold:j.number().min(0).max(1).default(.5)}),zh=j.object({fps:j.number().positive().default(30),duration:j.number().positive().default(4),loop:j.boolean().default(!1)}),jh=j.object({id:j.
|
|
933
|
+
string(),name:j.string(),nodeIds:j.array(j.string()).default([]),collapsed:j.boolean().default(!1),exposed:j.array(j.string()).default([])}),Vh=j.object({fps:j.number().positive(),frames:j.number().int().
|
|
934
|
+
positive(),duration:j.number().nonnegative(),codec:j.string(),pixfmt:j.string(),range:j.enum(["limited","full"]),matrix:j.enum(["bt709","bt601"])}),Jh=j.object({name:j.string(),mime:j.string(),width:j.
|
|
935
|
+
number().int().positive(),height:j.number().int().positive(),bytes:j.number().int().nonnegative(),video:Vh.optional()}),Zh=j.object({id:j.string(),layer:j.string(),start:j.number().nonnegative(),duration:j.
|
|
936
|
+
number().positive()}),Kh=j.object({version:j.number().int().default(Ur),name:j.string().default("untitled"),seed:j.union([j.string(),j.number()]).default(1),canvas:$h.default({}),timeline:zh.default({}),
|
|
937
|
+
graph:Hh.default({}),groups:j.array(jh).default([]),clips:j.array(Zh).default([]),assets:j.record(Jh).default({})});var wo=new Set(["canvas","layer","ograf"]);function ef(e){let t=new Map(e.nodes.map(s=>[s.id,s.type])),n=new Map;for(let s of e.edges){if(!t.has(s.from)||!t.has(s.to))continue;let l=n.get(s.to);l?l.push(
|
|
938
938
|
s.from):n.set(s.to,[s.from])}let r=new Map;for(let s of e.nodes){if(s.type!=="layer")continue;let l=[...n.get(s.id)??[]];for(;l.length>0;){let u=l.pop();if(wo.has(t.get(u)))continue;let h=r.get(u);h||
|
|
939
939
|
(h=new Set,r.set(u,h)),!h.has(s.id)&&(h.add(s.id),l.push(...n.get(u)??[]))}}let i=new Map;for(let s of e.nodes){let l=wo.has(s.type)?void 0:r.get(s.id);i.set(s.id,l&&l.size===1?[...l][0]:void 0)}return i}
|
|
940
|
-
function
|
|
940
|
+
function tf(e){let t=ef(e);for(let n of e.nodes){let r=t.get(n.id);r?n.layer=r:delete n.layer}return e}var Js=new Set(["text","random-code","radial-labels"]),$s=new Set([...Js,"row-labels"]),nf={1:e=>{let t=e.graph,n=new Set((t?.nodes??[]).filter(r=>Js.has(r.type)).map(r=>r.id));for(let r of t?.nodes??
|
|
941
941
|
[]){if(!n.has(r.id))continue;let i={...r.params??{}},s=i.stroke;if(s!==void 0){i.fill=s;let l=typeof s=="object"&&s!==null?s.base:s;typeof l=="string"?i.stroke=l:delete i.stroke}else delete i.fill;i.strokeWidth=
|
|
942
942
|
0,r.params=i}for(let r of t?.edges??[])n.has(r.to)&&r.toPort==="stroke"&&(r.toPort="fill");return{...e,version:2}},2:e=>{let t=e.graph;for(let n of t?.nodes??[]){if(n.type!=="text")continue;let r={...n.
|
|
943
943
|
params??{}};r.fontFamily??(r.fontFamily="IBM Plex Mono"),r.fontSize??(r.fontSize=12),r.anchor??(r.anchor="start"),n.params=r}return{...e,version:3}},3:e=>{let t={left:{angle:180,alignY:!1},"center-x":{
|
|
@@ -975,28 +975,28 @@ start;if(l==null){let u=n[i];u!==void 0&&(s.start=u+90)}else if(typeof l=="numbe
|
|
|
975
975
|
void 0&&n[i]!==void 0&&(u.base=n[i]+90),typeof u.expr=="string"&&u.expr.trim()!==""&&(u.expr=`(${u.expr}) + 90`);let h=u.track;h?.keyframes&&(u.track={...h,keyframes:h.keyframes.map(f=>typeof f.value==
|
|
976
976
|
"number"?{...f,value:f.value+90}:f)}),s.start=u}r.params=s}return{...e,version:27}},27:e=>{let t=e.graph;if(t){let n=t.nodes??(t.nodes=[]),r=t.edges??(t.edges=[]),i=new Map(n.map(s=>[s.id,s]));for(let s of n.
|
|
977
977
|
filter(l=>l.type==="canvas")){let l=0;for(let u=0;u<r.length;u++){let h=r[u];if(h.to!==s.id||h.toPort!=="in")continue;let f=i.get(h.from);if(!f||f.type==="layer"||String(h.fromPort).startsWith("param:")){
|
|
978
|
-
l++;continue}let A=
|
|
979
|
-
r.splice(u,1,{id:`${d}:out`,from:d,fromPort:"out",to:s.id,toPort:"in"},{...h,to:d,toPort:A?"texture":"in"}),u++,l++}}
|
|
978
|
+
l++;continue}let A=rf.has(f.type),d=`${s.id}:implicit:${l}`,y=f.position??{x:0,y:0};n.push({id:d,type:"layer",params:{name:A?"Post":"Shapes",order:l},position:{x:y.x+260,y:y.y},collapsed:!1,disabled:!1}),
|
|
979
|
+
r.splice(u,1,{id:`${d}:out`,from:d,fromPort:"out",to:s.id,toPort:"in"},{...h,to:d,toPort:A?"texture":"in"}),u++,l++}}tf(t)}return{...e,clips:Array.isArray(e.clips)?e.clips:[],version:28}},28:e=>{let t=e.
|
|
980
980
|
graph;for(let n of t?.nodes??[]){if(n.type!=="layer")continue;let r={...n.params??{}},i=r.name,s=typeof i=="string"?i:typeof i=="object"&&i!==null&&typeof i.base=="string"?i.base:void 0;s!==void 0&&typeof n.
|
|
981
981
|
name!="string"&&(n.name=s),delete r.name,n.params=r}return{...e,version:29}},29:e=>{let n=(e.graph?.nodes??[]).filter(l=>l.type==="layer"),r=l=>{let u=l.params?.order,h=typeof u=="object"&&u!==null?u.
|
|
982
982
|
base:u;return typeof h=="number"?h:void 0},s=1-Math.min(1,...n.map(l=>r(l)??0));for(let l of n){let u={...l.params??{}},h=u.order,f=r(l)??0;u.order=typeof h=="object"&&h!==null?{...h,base:f+s}:f+s,l.params=
|
|
983
983
|
u}return{...e,version:30}},30:e=>{let t=e.graph,n=new Set((t?.edges??[]).filter(r=>r.toPort==="ref").map(r=>r.to));for(let r of t?.nodes??[]){if(r.type!=="transform"||!n.has(r.id))continue;let i={...r.
|
|
984
984
|
params??{}},s=i.pivot,l=typeof s=="object"&&s!==null?s.base:s;l!==void 0&&l!=="shape"||(i.pivot=typeof s=="object"&&s!==null?{...s,base:"ref"}:"ref",r.params=i)}return{...e,version:31}},31:e=>{let t=e.
|
|
985
985
|
graph,n=new Set((t?.nodes??[]).filter(r=>r.type==="layer").map(r=>r.id));for(let r of t?.edges??[])r.toPort==="texture"&&n.has(r.to)&&(r.toPort="in");return{...e,version:32}},32:e=>{let t=e.graph;for(let n of t?.
|
|
986
|
-
nodes??[]){if(n.type!=="grid"&&n.type!=="polar-grid")continue;let r=n.params??(n.params={});r.subJoin??(r.subJoin=!1)}return{...e,version:33}}},
|
|
986
|
+
nodes??[]){if(n.type!=="grid"&&n.type!=="polar-grid")continue;let r=n.params??(n.params={});r.subJoin??(r.subJoin=!1)}return{...e,version:33}}},rf=new Set(["rasterize","blur","bloom","glitch","chromat\
|
|
987
987
|
ic","scanlines","fade","blend","switch-texture"]);function Zs(e){let t=[];if(typeof e!="object"||e===null)throw new Error("Not a FUI project: expected a JSON object");let n=structuredClone(e),r=typeof n.
|
|
988
|
-
version=="number"?n.version:1;for(r>Ur&&t.push(`Project was written by a newer build (v${r} > v${Ur}); loading anyway, unknown fields will be dropped.`);r<Ur;){let s=
|
|
989
|
-
gration from document version ${r}`);n=s(n),r=typeof n.version=="number"?n.version:r+1}let i=
|
|
988
|
+
version=="number"?n.version:1;for(r>Ur&&t.push(`Project was written by a newer build (v${r} > v${Ur}); loading anyway, unknown fields will be dropped.`);r<Ur;){let s=nf[r];if(!s)throw new Error(`No mi\
|
|
989
|
+
gration from document version ${r}`);n=s(n),r=typeof n.version=="number"?n.version:r+1}let i=Kh.parse({...n,version:Ur});return t.push(...sf(i)),t.push(...of(i)),{project:i,warnings:t}}function of(e){
|
|
990
990
|
let t=[],n=new Set(e.graph.nodes.filter(r=>r.type==="layer").map(r=>r.id));e.clips=e.clips.filter(r=>n.has(r.layer)?!0:(t.push(`Dropped clip ${r.id}: no Layer "${r.layer}"`),!1));for(let r of e.graph.
|
|
991
991
|
nodes)r.layer!==void 0&&(wo.has(r.type)?(t.push(`${r.type} "${r.id}" lives in the root, not in Layer "${r.layer}"`),delete r.layer):n.has(r.layer)||(t.push(`Node "${r.id}" names a missing Layer "${r.layer}\
|
|
992
|
-
"; moved to the root`),delete r.layer));return t}function
|
|
993
|
-
gling edge ${s.from} \u2192 ${s.to}.${s.toPort}`),l});e.graph.edges=r;let i=new Set;for(let s of e.graph.nodes)i.has(s.id)&&t.push(`Duplicate node id "${s.id}"`),i.add(s.id);return t}var
|
|
992
|
+
"; moved to the root`),delete r.layer));return t}function sf(e){let t=[],n=new Set(e.graph.nodes.map(s=>s.id)),r=e.graph.edges.filter(s=>{let l=n.has(s.from)&&n.has(s.to);return l||t.push(`Dropped dan\
|
|
993
|
+
gling edge ${s.from} \u2192 ${s.to}.${s.toPort}`),l});e.graph.edges=r;let i=new Set;for(let s of e.graph.nodes)i.has(s.id)&&t.push(`Duplicate node id "${s.id}"`),i.add(s.id);return t}var af=["version",
|
|
994
994
|
"name","seed","canvas","timeline","graph","groups","clips","assets","nodes","edges","id","type","from","fromPort","to","toPort","params","position","collapsed","disabled","layer","wire","base","track",
|
|
995
|
-
"expr","stagger","jitter","w","h","bg","display","ink","threshold","x","y","fps","start","duration","mime","width","height","bytes"],
|
|
995
|
+
"expr","stagger","jitter","w","h","bg","display","ink","threshold","x","y","fps","start","duration","mime","width","height","bytes"],Ig=new Map(af.map((e,t)=>[e,t]));var Bo={stroke:"#ffffff",strokeWidth:1,fill:"none",opacity:1},V=e=>({t:"shapes",v:e}),Te=e=>({t:"number",v:e});var sn=e=>({t:"color",v:e}),or=e=>({t:"paint",v:e}),Ci=e=>({t:"string",v:e}),la=e=>({t:"bool",v:e}),ua=e=>({t:"layers",v:e}),ca=e=>({t:"scene",v:e}),Ge=e=>({t:"texture",v:e}),be=[1,0,0,1,0,0];function me(e,t){
|
|
996
996
|
return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Re(e,t){return[1,0,0,1,e,t]}function dn(e,t=e){return[
|
|
997
|
-
e,0,0,t,0,0]}function zt(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return[n,r,-r,n,0,0]}function
|
|
998
|
-
y:e[1]*t.x+e[3]*t.y+e[5]}}function
|
|
999
|
-
0&&(u=me(u,zt(r))),(i!==1||s!==1)&&(u=me(u,dn(i,s))),u=me(u,Re(-l.x,-l.y)),u}var Co=16,
|
|
997
|
+
e,0,0,t,0,0]}function zt(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return[n,r,-r,n,0,0]}function Pr(e,t,n){return me(me(Re(t,n),zt(e)),Re(-t,-n))}function ir(e,t){return{x:e[0]*t.x+e[2]*t.y+e[4],
|
|
998
|
+
y:e[1]*t.x+e[3]*t.y+e[5]}}function ki(e){let t=e[0]*e[3]-e[1]*e[2];if(t===0||!Number.isFinite(t))return;let n=e[3]/t,r=-e[1]/t,i=-e[2]/t,s=e[0]/t;return[n,r,i,s,-(n*e[4]+i*e[5]),-(r*e[4]+s*e[5])]}function zr(e){return e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0}function Kt(e){let{tx:t=0,ty:n=0,rotation:r=0,sx:i=1,sy:s=1,pivot:l={x:0,y:0}}=e,u=Re(t,n);return u=me(u,Re(l.x,l.y)),r!==
|
|
999
|
+
0&&(u=me(u,zt(r))),(i!==1||s!==1)&&(u=me(u,dn(i,s))),u=me(u,Re(-l.x,-l.y)),u}var Co=16,lf=64,uf=/[A-Za-z]|-?(?:\d+\.?\d*|\.\d+)(?:[eE]-?\d+)?/g;function cf(e){let t=e.match(uf)??[],n=[],r=[],i={x:0,y:0},
|
|
1000
1000
|
s={x:0,y:0},l,u,h=0,f=!1,A=S=>{r.length>=2&&n.push({points:r,closed:S}),r=[]},d=()=>{let S=t[h];return S===void 0||/[A-Za-z]/.test(S)?(f=!0,0):(h++,Number(S))},y=()=>{let S=t[h];return S===void 0||S[0]!==
|
|
1001
1001
|
"0"&&S[0]!=="1"?(f=!0,0):S.length===1?(h++,Number(S)):(t[h]=S.slice(1),Number(S[0]))},g=()=>h<t.length&&!/[A-Za-z]/.test(t[h]),x=S=>{r.push(S),i=S,l=u=void 0},v=()=>{r.length===0&&r.push(i)},b=(S,T,P)=>{
|
|
1002
1002
|
v();for(let E=1;E<=Co;E++){let _=E/Co,Q=1-_;r.push({x:Q*Q*Q*i.x+3*Q*Q*_*S.x+3*Q*_*_*T.x+_*_*_*P.x,y:Q*Q*Q*i.y+3*Q*Q*_*S.y+3*Q*_*_*T.y+_*_*_*P.y})}i=P,l=T,u=void 0},C=(S,T)=>{v();for(let P=1;P<=Co;P++){
|
|
@@ -1004,243 +1004,243 @@ let E=P/Co,_=1-E;r.push({x:_*_*i.x+2*_*E*S.x+E*E*T.x,y:_*_*i.y+2*_*E*S.y+E*E*T.y
|
|
|
1004
1004
|
Q.x&&i.y===Q.y||x(Q),i=Q,l=u=void 0;return}let $=P*Math.PI/180,W=Math.cos($),G=Math.sin($),oe=(i.x-Q.x)/2,ce=(i.y-Q.y)/2,he=W*oe+G*ce,se=-G*oe+W*ce,Ae=he*he/(Y*Y)+se*se/(F*F);if(Ae>1){let Ve=Math.sqrt(
|
|
1005
1005
|
Ae);Y*=Ve,F*=Ve}let ve=E!==_?1:-1,ne=Y*Y*se*se+F*F*he*he,ge=Math.max(0,Y*Y*F*F-ne),_e=ve*Math.sqrt(ne===0?0:ge/ne),Se=_e*Y*se/F,Fe=-_e*F*he/Y,lt=W*Se-G*Fe+(i.x+Q.x)/2,de=G*Se+W*Fe+(i.y+Q.y)/2,Ie=(Ve,He,Qt,it)=>{
|
|
1006
1006
|
let kt=Ve*Qt+He*it,In=Math.hypot(Ve,He)*Math.hypot(Qt,it),Gt=Math.acos(Math.max(-1,Math.min(1,kt/In)));return Ve*it-He*Qt<0&&(Gt=-Gt),Gt},qe=Ie(1,0,(he-Se)/Y,(se-Fe)/F),Ue=Ie((he-Se)/Y,(se-Fe)/F,(-he-
|
|
1007
|
-
Se)/Y,(-se-Fe)/F);_===0&&Ue>0&&(Ue-=2*Math.PI),_===1&&Ue<0&&(Ue+=2*Math.PI);let et=Math.max(2,Math.ceil(Math.abs(Ue)/(2*Math.PI)*
|
|
1007
|
+
Se)/Y,(-se-Fe)/F);_===0&&Ue>0&&(Ue-=2*Math.PI),_===1&&Ue<0&&(Ue+=2*Math.PI);let et=Math.max(2,Math.ceil(Math.abs(Ue)/(2*Math.PI)*lf));for(let Ve=1;Ve<=et;Ve++){let He=qe+Ue*Ve/et,Qt=Y*Math.cos(He),it=F*
|
|
1008
1008
|
Math.sin(He);r.push({x:W*Qt-G*it+lt,y:G*Qt+W*it+de})}i=Q,l=u=void 0};for(;h<t.length&&!f;){let S=t[h];if(!/^[A-Za-z]$/.test(S)){f=!0;break}h++;let T=S===S.toLowerCase(),P=()=>T?i:{x:0,y:0};switch(S.toUpperCase()){case"\
|
|
1009
1009
|
M":{A(!1);let E=!0;for(;g()&&!f;){let _={x:P().x+d(),y:P().y+d()};E?(i=_,s=_,r=[_],l=u=void 0,E=!1):x(_)}E&&(f=!0);break}case"L":do x({x:P().x+d(),y:P().y+d()});while(g()&&!f);break;case"H":do x({x:P().
|
|
1010
1010
|
x+d(),y:i.y});while(g()&&!f);break;case"V":do x({x:i.x,y:P().y+d()});while(g()&&!f);break;case"C":do{let E={x:P().x+d(),y:P().y+d()},_={x:P().x+d(),y:P().y+d()};b(E,_,{x:P().x+d(),y:P().y+d()})}while(g()&&
|
|
1011
1011
|
!f);break;case"S":do{let E=l?{x:2*i.x-l.x,y:2*i.y-l.y}:i,_={x:P().x+d(),y:P().y+d()};b(E,_,{x:P().x+d(),y:P().y+d()})}while(g()&&!f);break;case"Q":do{let E={x:P().x+d(),y:P().y+d()};C(E,{x:P().x+d(),y:P().
|
|
1012
1012
|
y+d()})}while(g()&&!f);break;case"T":do{let E=u?{x:2*i.x-u.x,y:2*i.y-u.y}:i;C(E,{x:P().x+d(),y:P().y+d()})}while(g()&&!f);break;case"A":do{let E=d(),_=d(),Q=d(),Y=y(),F=y();M(E,_,Q,Y,F,{x:P().x+d(),y:P().
|
|
1013
|
-
y+d()})}while(g()&&!f);break;case"Z":A(!0),i=s,l=u=void 0;break;default:f=!0}}return f?[]:(A(!1),n)}var
|
|
1013
|
+
y+d()})}while(g()&&!f);break;case"Z":A(!0),i=s,l=u=void 0;break;default:f=!0}}return f?[]:(A(!1),n)}var gi=96;function Sr(e,t,n,r,i){let s=Math.abs(i-r),l=Math.max(2,Math.ceil(s/360*gi)),u=[];for(let h=0;h<=
|
|
1014
1014
|
l;h++){let f=(r+(i-r)*h/l)*Math.PI/180;u.push({x:e+n*Math.cos(f),y:t+n*Math.sin(f)})}return u}function rt(e){let t=r=>ir(e.transform,r),n=[];switch(e.kind){case"rect":case"image":{let{x:r,y:i,w:s,h:l}=e,
|
|
1015
|
-
u=e.kind==="rect"?Math.min(Math.max(0,e.rx),s/2,l/2):0;if(u>0){let h=[...
|
|
1016
|
-
break}n.push({points:[{x:r,y:i},{x:r+s,y:i},{x:r+s,y:i+l},{x:r,y:i+l}].map(t),closed:!0});break}case"circle":n.push({points:
|
|
1017
|
-
let r=[];for(let i=0;i<
|
|
1018
|
-
map(t),closed:!1});break;case"polyline":n.push({points:e.points.map(t),closed:e.closed});break;case"group":for(let r of e.children)n.push(...rt(r));break;case"path":{for(let r of
|
|
1015
|
+
u=e.kind==="rect"?Math.min(Math.max(0,e.rx),s/2,l/2):0;if(u>0){let h=[...Sr(r+s-u,i+u,u,270,360),...Sr(r+s-u,i+l-u,u,0,90),...Sr(r+u,i+l-u,u,90,180),...Sr(r+u,i+u,u,180,270)];n.push({points:h.map(t),closed:!0});
|
|
1016
|
+
break}n.push({points:[{x:r,y:i},{x:r+s,y:i},{x:r+s,y:i+l},{x:r,y:i+l}].map(t),closed:!0});break}case"circle":n.push({points:Sr(e.cx,e.cy,e.r,0,360).slice(0,-1).map(t),closed:!0});break;case"ellipse":{
|
|
1017
|
+
let r=[];for(let i=0;i<gi;i++){let s=i/gi*Math.PI*2;r.push(t({x:e.cx+e.rx*Math.cos(s),y:e.cy+e.ry*Math.sin(s)}))}n.push({points:r,closed:!0});break}case"arc":n.push({points:Sr(e.cx,e.cy,e.r,e.a0,e.a1).
|
|
1018
|
+
map(t),closed:!1});break;case"polyline":n.push({points:e.points.map(t),closed:e.closed});break;case"group":for(let r of e.children)n.push(...rt(r));break;case"path":{for(let r of cf(e.d))n.push({points:r.
|
|
1019
1019
|
points.map(t),closed:r.closed});break}case"text":break}return n}function En(e,t=!1){let n=0;for(let r=1;r<e.length;r++)n+=Math.hypot(e[r].x-e[r-1].x,e[r].y-e[r-1].y);if(t&&e.length>1){let r=e[e.length-
|
|
1020
|
-
1],i=e[0];n+=Math.hypot(i.x-r.x,i.y-r.y)}return n}function
|
|
1020
|
+
1],i=e[0];n+=Math.hypot(i.x-r.x,i.y-r.y)}return n}function Ei(e,t){return t&&e.length>1?[...e,e[0]]:e}function rr(e,t,n=!1){let r=Ei(e,n);if(r.length===0)return{x:0,y:0};if(r.length===1)return r[0];let i=Math.
|
|
1021
1021
|
max(0,t);for(let s=1;s<r.length;s++){let l=r[s-1],u=r[s],h=Math.hypot(u.x-l.x,u.y-l.y);if(h!==0){if(i<=h){let f=i/h;return{x:l.x+(u.x-l.x)*f,y:l.y+(u.y-l.y)*f}}i-=h}}return r[r.length-1]}function sr(e,t,n=!1){
|
|
1022
|
-
let r=
|
|
1023
|
-
y-l.y)/h};i-=h}}return{x:1,y:0}}function
|
|
1022
|
+
let r=Ei(e,n);if(r.length<2)return{x:1,y:0};let i=Math.max(0,t);for(let s=1;s<r.length;s++){let l=r[s-1],u=r[s],h=Math.hypot(u.x-l.x,u.y-l.y);if(h!==0){if(i<=h||s===r.length-1)return{x:(u.x-l.x)/h,y:(u.
|
|
1023
|
+
y-l.y)/h};i-=h}}return{x:1,y:0}}function Si(e,t,n,r=!1){let i=Ei(e,r),s=En(i);if(s===0||i.length<2)return[];let l=Math.max(0,Math.min(1,t))*s,u=Math.max(0,Math.min(1,n))*s;if(u<=l)return[];let h=[rr(i,
|
|
1024
1024
|
l)],f=0;for(let A=1;A<i.length;A++){let d=i[A-1],y=i[A],g=Math.hypot(y.x-d.x,y.y-d.y),x=f,v=f+g;if(v>l&&v<u&&h.push(y),f=v,f>=u)break}return h.push(rr(i,u)),h}function Ze(e){if(e.kind==="text"){let r=e.metrics?e.metrics.width:e.text.length*e.fontSize*.6+e.letterSpacing*e.text.length,i=e.metrics?e.metrics.capHeight:e.fontSize,s=e.anchor==="middle"?e.x-r/2:e.
|
|
1025
1025
|
anchor==="end"?e.x-r:e.x,l=[{x:s,y:e.y-i},{x:s+r,y:e.y-i},{x:s+r,y:e.y},{x:s,y:e.y}].map(u=>ir(e.transform,u));return Ks(l)}let n=rt(e).flatMap(r=>r.points);return n.length>0?Ks(n):void 0}function Ks(e){
|
|
1026
1026
|
if(e.length===0)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let s of e)s.x<t&&(t=s.x),s.x>r&&(r=s.x),s.y<n&&(n=s.y),s.y>i&&(i=s.y);return{x:t,y:n,w:r-t,h:i-n}}function at(e){let t;for(let n of e){let r=Ze(
|
|
1027
|
-
n);r&&(t=t?
|
|
1027
|
+
n);r&&(t=t?hf(t,r):r)}return t}function hf(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,w:Math.max(e.x+e.w,t.x+t.w)-n,h:Math.max(e.y+e.h,t.y+t.h)-r}}function nt(e){return{x:e.x+e.w/
|
|
1028
1028
|
2,y:e.y+e.h/2}}function Mt(e,t,n,r){let i=r*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Po(e,t){let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){let s=t[r],l=t[i];s.y>e.y!=l.y>
|
|
1029
|
-
e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(n=!n)}return n}var
|
|
1030
|
-
return typeof e=="object"&&e!==null&&e.kind==="noise"&&Array.isArray(e.stops)}function Sn(e){return _o(e)||ha(e)}function fa(e){return ha(e)||_o(e)&&e.kind==="conic"}function
|
|
1031
|
-
exec(e.trim());if(!t)return;let n=t[1].toLowerCase();n.length<=4&&(n=[...n].map(i=>i+i).join(""));let r=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{rgb:`#${n.slice(0,6)}`,a:r}}var
|
|
1029
|
+
e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(n=!n)}return n}var ff=new Set(["linear","radial","conic"]);function _o(e){return typeof e=="object"&&e!==null&&ff.has(e.kind)&&Array.isArray(e.stops)}function ha(e){
|
|
1030
|
+
return typeof e=="object"&&e!==null&&e.kind==="noise"&&Array.isArray(e.stops)}function Sn(e){return _o(e)||ha(e)}function fa(e){return ha(e)||_o(e)&&e.kind==="conic"}function ar(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.
|
|
1031
|
+
exec(e.trim());if(!t)return;let n=t[1].toLowerCase();n.length<=4&&(n=[...n].map(i=>i+i).join(""));let r=n.length===8?parseInt(n.slice(6,8),16)/255:1;return{rgb:`#${n.slice(0,6)}`,a:r}}var pf=e=>Math.round(
|
|
1032
1032
|
Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");function _r(e){if(e===void 0||typeof e=="string")return e;if(!Sn(e))return"none";let t=Bn(e.stops)[0];return t?t.color:"none"}function Bn(e){if(!e)
|
|
1033
|
-
return[];let t=e.filter(n=>typeof n.at=="number"&&Number.isFinite(n.at)&&typeof n.color=="string"&&
|
|
1033
|
+
return[];let t=e.filter(n=>typeof n.at=="number"&&Number.isFinite(n.at)&&typeof n.color=="string"&&ar(n.color)!==void 0).map(n=>({at:Math.min(1,Math.max(0,n.at)),color:n.color})).sort((n,r)=>n.at-r.at);
|
|
1034
1034
|
return t.length<2?[]:t}function Mo(e,t){if(!t||e.length<2)return[...e];let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push({at:i.at,color:i.color});let s=e[r+1];s&&n.push({at:s.at,color:i.color})}return n}
|
|
1035
|
-
var
|
|
1035
|
+
var yi=new WeakMap;function Bi(e,t){if(e.space==="canvas")return e.box;if(yi.has(t))return yi.get(t);let n=Ze({...t,transform:be});return yi.set(t,n),n}function pa(e,t){if(!t||e.kind==="conic")return;
|
|
1036
1036
|
if(e.kind==="linear"){let h=e.angle*Math.PI/180,f=Math.cos(h),A=Math.sin(h),d=(Math.abs(t.w*f)+Math.abs(t.h*A))/2;if(!(d>1e-9)||e.end===e.start)return;let y=t.x+t.w/2,g=t.y+t.h/2,x=C=>({x:y+f*d*(2*C-1),
|
|
1037
1037
|
y:g+A*d*(2*C-1)}),v=x(e.start),b=x(e.end);return{kind:"linear",x1:v.x,y1:v.y,x2:b.x,y2:b.y}}let n=Math.max(t.w,t.h)/2,r=e.r*n;if(!(r>0))return;let i=t.x+e.cx*t.w,s=t.y+e.cy*t.h,l=e.fx===void 0?i:t.x+e.
|
|
1038
|
-
fx*t.w,u=e.fy===void 0?s:t.y+e.fy*t.h;return{kind:"radial",cx:i,cy:s,r,fx:l,fy:u}}function da(e,t){let n=e.stops.map(r=>{let i=
|
|
1038
|
+
fx*t.w,u=e.fy===void 0?s:t.y+e.fy*t.h;return{kind:"radial",cx:i,cy:s,r,fx:l,fy:u}}function da(e,t){let n=e.stops.map(r=>{let i=ar(r.color);return i?{at:r.at,color:`${i.rgb}${pf(i.a*t*255)}`}:r});return{...e,stops:n}}function Pi(e){let t=n=>{let r=n>>>0;for(let i=0;i<e.length;i++)r^=e.charCodeAt(i),r=Math.imul(r,16777619)>>>0;return r.toString(36)};return t(2166136261)+t(84696351)}function _i(e){let t=1779033703,n=3144134277,
|
|
1039
1039
|
r=1013904242,i=2773480762;for(let s=0;s<e.length;s++){let l=e.charCodeAt(s);t=n^Math.imul(t^l,597399067),n=r^Math.imul(n^l,2869860233),r=i^Math.imul(r^l,951274213),i=t^Math.imul(i^l,2716044179)}return t=
|
|
1040
1040
|
Math.imul(r^t>>>18,597399067),n=Math.imul(i^n>>>22,2869860233),r=Math.imul(t^r>>>17,951274213),i=Math.imul(n^i>>>19,2716044179),[(t^n^r^i)>>>0,(n^t)>>>0,(r^t)>>>0,(i^t)>>>0]}function Aa(e,t,n,r){return()=>{
|
|
1041
|
-
e>>>=0,t>>>=0,n>>>=0,r>>>=0;let i=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,r=r+1|0,i=i+r|0,n=n+i|0,(i>>>0)/4294967296}}function
|
|
1042
|
-
range:(l,u)=>l+s()*(u-l),gauss:()=>(s()+s()+s()-1.5)*1.1547,int:(l,u)=>l+Math.floor(s()*(u-l)),pick:l=>l[Math.floor(s()*l.length)],bool:(l=.5)=>s()<l}}function nr(...e){let[t,n,r,i]=
|
|
1043
|
-
t,n,r,i)()}function
|
|
1044
|
-
n;f++)s+=ma(`${e}#${f}`,t*h)*l,u+=l,l*=i,h*=r;return u===0?0:s/u}var
|
|
1041
|
+
e>>>=0,t>>>=0,n>>>=0,r>>>=0;let i=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,r=r+1|0,i=i+r|0,n=n+i|0,(i>>>0)/4294967296}}function df(...e){let[t,n,r,i]=_i(e.join("|")),s=Aa(t,n,r,i);return{next:s,
|
|
1042
|
+
range:(l,u)=>l+s()*(u-l),gauss:()=>(s()+s()+s()-1.5)*1.1547,int:(l,u)=>l+Math.floor(s()*(u-l)),pick:l=>l[Math.floor(s()*l.length)],bool:(l=.5)=>s()<l}}function nr(...e){let[t,n,r,i]=_i(e.join("|"));return Aa(
|
|
1043
|
+
t,n,r,i)()}function Af(e){return e*e*e*(e*(e*6-15)+10)}function ma(e,t){let n=Math.floor(t),r=t-n,i=nr(e,n),s=nr(e,n+1);return(i+(s-i)*Af(r))*2-1}function ya(e,t,n=3,r=2,i=.5){let s=0,l=1,u=0,h=1;for(let f=0;f<
|
|
1044
|
+
n;f++)s+=ma(`${e}#${f}`,t*h)*l,u+=l,l*=i,h*=r;return u===0?0:s/u}var mf=["<=",">=","==","!=","&&","||","**","+","-","*","/","%","<",">","(",")",",","?",":","!"];function yf(e){let t=[],n=0;for(;n<e.length;){
|
|
1045
1045
|
let r=e[n];if(r===" "||r===" "||r===`
|
|
1046
1046
|
`||r==="\r"){n++;continue}if(r>="0"&&r<="9"){let s=n;for(;s<e.length&&/[0-9._eE]/.test(e[s]);)(e[s]==="e"||e[s]==="E")&&(e[s+1]==="-"||e[s+1]==="+")&&s++,s++;let l=e.slice(n,s),u=Number.parseFloat(l);
|
|
1047
|
-
if(!Number.isFinite(u))throw new
|
|
1048
|
-
n=s;continue}let i=
|
|
1049
|
-
min(Math.max(e,t),n),
|
|
1047
|
+
if(!Number.isFinite(u))throw new Br(`Bad number "${l}"`);t.push({k:"num",v:u}),n=s;continue}if(/[A-Za-z_]/.test(r)){let s=n;for(;s<e.length&&/[A-Za-z0-9_]/.test(e[s]);)s++;t.push({k:"id",v:e.slice(n,s)}),
|
|
1048
|
+
n=s;continue}let i=mf.find(s=>e.startsWith(s,n));if(!i)throw new Br(`Unexpected character "${r}" at ${n}`);t.push({k:"op",v:i}),n+=i.length}return t.push({k:"eof"}),t}var Br=class extends Error{},ea=(e,t,n)=>Math.
|
|
1049
|
+
min(Math.max(e,t),n),gf={sin:([e=0])=>Math.sin(e),cos:([e=0])=>Math.cos(e),tan:([e=0])=>Math.tan(e),asin:([e=0])=>Math.asin(e),acos:([e=0])=>Math.acos(e),atan:([e=0])=>Math.atan(e),atan2:([e=0,t=0])=>Math.
|
|
1050
1050
|
atan2(e,t),abs:([e=0])=>Math.abs(e),sign:([e=0])=>Math.sign(e),sqrt:([e=0])=>Math.sqrt(Math.max(0,e)),pow:([e=0,t=0])=>e**t,exp:([e=0])=>Math.exp(e),log:([e=0])=>Math.log(Math.max(1e-12,e)),floor:([e=0])=>Math.
|
|
1051
1051
|
floor(e),ceil:([e=0])=>Math.ceil(e),round:([e=0])=>Math.round(e),min:e=>Math.min(...e),max:e=>Math.max(...e),mod:([e=0,t=1])=>t===0?0:(e%t+t)%t,clamp:([e=0,t=0,n=1])=>ea(e,t,n),lerp:([e=0,t=0,n=0])=>e+
|
|
1052
1052
|
(t-e)*n,map:([e=0,t=0,n=1,r=0,i=1])=>n===t?r:r+(e-t)/(n-t)*(i-r),smoothstep:([e=0,t=1,n=0])=>{let r=ea(t===e?0:(n-e)/(t-e),0,1);return r*r*(3-2*r)},step:([e=0,t=0])=>t<e?0:1,deg:([e=0])=>e*180/Math.PI,
|
|
1053
|
-
rad:([e=0])=>e*Math.PI/180},ta={PI:Math.PI,TAU:Math.PI*2,E:Math.E},
|
|
1053
|
+
rad:([e=0])=>e*Math.PI/180},ta={PI:Math.PI,TAU:Math.PI*2,E:Math.E},bf={"||":{prec:1,fn:(e,t)=>e!==0||t!==0?1:0},"&&":{prec:2,fn:(e,t)=>e!==0&&t!==0?1:0},"==":{prec:3,fn:(e,t)=>e===t?1:0},"!=":{prec:3,
|
|
1054
1054
|
fn:(e,t)=>e!==t?1:0},"<":{prec:4,fn:(e,t)=>e<t?1:0},">":{prec:4,fn:(e,t)=>e>t?1:0},"<=":{prec:4,fn:(e,t)=>e<=t?1:0},">=":{prec:4,fn:(e,t)=>e>=t?1:0},"+":{prec:5,fn:(e,t)=>e+t},"-":{prec:5,fn:(e,t)=>e-
|
|
1055
|
-
t},"*":{prec:6,fn:(e,t)=>e*t},"/":{prec:6,fn:(e,t)=>t===0?0:e/t},"%":{prec:6,fn:(e,t)=>t===0?0:e%t},"**":{prec:7,right:!0,fn:(e,t)=>e**t}},
|
|
1056
|
-
"refs",new Set);this.toks=e}peek(){return this.toks[this.pos]}eat(e){let t=this.peek();return t.k==="op"&&t.v===e?(this.pos++,!0):!1}expect(e){if(!this.eat(e))throw new
|
|
1057
|
-
expr(0);if(this.peek().k!=="eof")throw new
|
|
1058
|
-
expect(":");let u=this.expr(0),h=t;t=f=>h(f)!==0?l(f):u(f);continue}let r=
|
|
1055
|
+
t},"*":{prec:6,fn:(e,t)=>e*t},"/":{prec:6,fn:(e,t)=>t===0?0:e/t},"%":{prec:6,fn:(e,t)=>t===0?0:e%t},"**":{prec:7,right:!0,fn:(e,t)=>e**t}},vf=class{constructor(e){Bt(this,"toks");Bt(this,"pos",0);Bt(this,
|
|
1056
|
+
"refs",new Set);this.toks=e}peek(){return this.toks[this.pos]}eat(e){let t=this.peek();return t.k==="op"&&t.v===e?(this.pos++,!0):!1}expect(e){if(!this.eat(e))throw new Br(`Expected "${e}"`)}parse(){let e=this.
|
|
1057
|
+
expr(0);if(this.peek().k!=="eof")throw new Br("Trailing input");return e}expr(e){let t=this.unary();for(;;){let n=this.peek();if(n.k!=="op")break;if(n.v==="?"&&e<=0){this.pos++;let l=this.expr(0);this.
|
|
1058
|
+
expect(":");let u=this.expr(0),h=t;t=f=>h(f)!==0?l(f):u(f);continue}let r=bf[n.v];if(!r||r.prec<e)break;this.pos++;let i=this.expr(r.right?r.prec:r.prec+1),s=t;t=l=>r.fn(s(l),i(l))}return t}unary(){if(this.
|
|
1059
1059
|
eat("-")){let e=this.unary();return t=>-e(t)}if(this.eat("+"))return this.unary();if(this.eat("!")){let e=this.unary();return t=>e(t)===0?1:0}return this.primary()}primary(){let e=this.peek();if(e.k===
|
|
1060
|
-
"num"){this.pos++;let{v:t}=e;return()=>t}if(e.k==="id"){this.pos++;let t=e.v;if(this.eat("(")){let n=[];if(!this.eat(")")){do n.push(this.expr(0));while(this.eat(","));this.expect(")")}let r=
|
|
1061
|
-
throw new
|
|
1062
|
-
expect(")"),t}throw new
|
|
1060
|
+
"num"){this.pos++;let{v:t}=e;return()=>t}if(e.k==="id"){this.pos++;let t=e.v;if(this.eat("(")){let n=[];if(!this.eat(")")){do n.push(this.expr(0));while(this.eat(","));this.expect(")")}let r=gf[t];if(!r)
|
|
1061
|
+
throw new Br(`Unknown function "${t}"`);return i=>r(n.map(s=>s(i)))}if(t in ta){let n=ta[t];return()=>n}return this.refs.add(t),n=>n[t]??0}if(e.k==="op"&&e.v==="("){this.pos++;let t=this.expr(0);return this.
|
|
1062
|
+
expect(")"),t}throw new Br("Unexpected end of expression")}},na=new Map;function To(e){let t=na.get(e);if(t)return t;let n=new vf(yf(e)),r=n.parse(),i=(s=>{let l=r(s);return Number.isFinite(l)?l:0});return Object.
|
|
1063
1063
|
defineProperty(i,"refs",{value:n.refs}),Object.defineProperty(i,"source",{value:e}),na.set(e,i),i}var ra={linear:e=>e,step:()=>0,"ease-in":e=>e*e,"ease-out":e=>1-(1-e)*(1-e),"ease-in-out":e=>e<.5?2*e*e:1-(-2*e+2)**2/2,"ease-in-quad":e=>e*e,"ease-out-quad":e=>1-(1-e)*(1-e),"ease-in-out-quad":e=>e<.5?
|
|
1064
1064
|
2*e*e:1-(-2*e+2)**2/2,"ease-in-cubic":e=>e**3,"ease-out-cubic":e=>1-(1-e)**3,"ease-in-out-cubic":e=>e<.5?4*e**3:1-(-2*e+2)**3/2},oa={linear:[1/3,1/3,2/3,2/3],step:[1/3,0,2/3,0],"ease-in":[.11,0,.5,0],
|
|
1065
1065
|
"ease-out":[.5,1,.89,1],"ease-in-out":[.45,0,.55,1],"ease-in-quad":[.11,0,.5,0],"ease-out-quad":[.5,1,.89,1],"ease-in-out-quad":[.45,0,.55,1],"ease-in-cubic":[.32,0,.67,0],"ease-out-cubic":[.33,1,.68,
|
|
1066
|
-
1],"ease-in-out-cubic":[.65,0,.35,1]};function
|
|
1067
|
-
r},in:t.hIn?{t:t.t+t.hIn.dt,v:t.value+t.hIn.dv}:{t:e.t+l*n,v:e.value+u*r}}}function
|
|
1066
|
+
1],"ease-in-out-cubic":[.65,0,.35,1]};function If(e,t){let n=t.t-e.t,r=t.value-e.value,[i,s,l,u]=oa[t.easing]??oa.linear;return{out:e.hOut?{t:e.t+e.hOut.dt,v:e.value+e.hOut.dv}:{t:e.t+i*n,v:e.value+s*
|
|
1067
|
+
r},in:t.hIn?{t:t.t+t.hIn.dt,v:t.value+t.hIn.dv}:{t:e.t+l*n,v:e.value+u*r}}}function xf(e,t,n){let r=t.t-e.t,i=If(e,t),s=Math.min(1,Math.max(0,(i.out.t-e.t)/r)),l=Math.min(1,Math.max(0,(i.in.t-e.t)/r)),
|
|
1068
1068
|
u=3*s,h=3*(l-s)-u,f=1-u-h,A=x=>((f*x+h)*x+u)*x,d=x=>(3*f*x+2*h)*x+u,y=n;for(let x=0;x<8;x++){let v=A(y)-n;if(Math.abs(v)<1e-6)break;let b=d(y);if(Math.abs(b)<1e-6)break;y-=v/b}if(y<0||y>1||Math.abs(A(
|
|
1069
1069
|
y)-n)>1e-4){let x=0,v=1;for(let b=0;b<26;b++)y=(x+v)/2,A(y)<n?x=y:v=y}let g=1-y;return g*g*g*e.value+3*g*g*y*i.out.v+3*g*y*y*i.in.v+y*y*y*t.value}function ga(e,t){let n=e.keyframes;if(n.length===0)return;
|
|
1070
1070
|
let r=n[0],i=n[n.length-1];if(n.length===1)return r.value;let s=t,l=i.t-r.t;if(l>0){if(e.extrapolate==="loop")s=r.t+((t-r.t)%l+l)%l;else if(e.extrapolate==="ping-pong"){let x=((t-r.t)%(l*2)+l*2)%(l*2);
|
|
1071
|
-
s=r.t+(x<=l?x:l*2-x)}}if(s<=r.t)return r.value;if(s>=i.t)return i.value;let u=1;for(;u<n.length&&n[u].t<s;)u++;let h=n[u],f=n[u-1],A=h.t-f.t;if(A<=0)return h.value;let d=(s-f.t)/A;if(f.hOut||h.hIn)return
|
|
1072
|
-
f,h,d);let g=(ra[h.easing]??ra.linear)(d);return f.value+(h.value-f.value)*g}function An(e,t){return e?Math.max(0,t):-t-1}function en(e){return e>=0?{playing:!0,local:e}:{playing:!1,local:-(e+1)}}function
|
|
1071
|
+
s=r.t+(x<=l?x:l*2-x)}}if(s<=r.t)return r.value;if(s>=i.t)return i.value;let u=1;for(;u<n.length&&n[u].t<s;)u++;let h=n[u],f=n[u-1],A=h.t-f.t;if(A<=0)return h.value;let d=(s-f.t)/A;if(f.hOut||h.hIn)return xf(
|
|
1072
|
+
f,h,d);let g=(ra[h.easing]??ra.linear)(d);return f.value+(h.value-f.value)*g}function An(e,t){return e?Math.max(0,t):-t-1}function en(e){return e>=0?{playing:!0,local:e}:{playing:!1,local:-(e+1)}}function wf(e,t,n=0,r){
|
|
1073
1073
|
let i=e.keyframes;if(i.length===0)return t;let s=i[0],l=i[i.length-1],u=r!==void 0?0:s.t,h=r!==void 0?r:l.t-s.t,f=u+h;if(t<=u||h<=0)return u;if(e.extrapolate==="hold")return Math.min(t,f);let A=(t-u)/
|
|
1074
1074
|
h;if(n>0&&A>=n)return e.extrapolate==="ping-pong"&&n%2===0?u:f;if(e.extrapolate==="loop")return u+(A-Math.floor(A))*h;let d=A%2;return u+(d<=1?d:2-d)*h}function ba(e,t,n=0,r){if(e.keyframes.length!==0)
|
|
1075
|
-
return ga({...e,extrapolate:"hold"},
|
|
1075
|
+
return ga({...e,extrapolate:"hold"},wf(e,t,n,r))}function Cf(e,t){return{t:e.t,i:e.index,n:e.count,v:t,...e.vars}}function kf(e,t,n){let r=e.seed??"";if(e.mode==="animated"){let i=nr(n.keyPath,t,r,n.index,"phase")*1e3;return ma(`${n.keyPath}|${t}|${r}`,
|
|
1076
1076
|
i+n.t*e.noiseFreq)}if(e.distribution==="gauss"){let i=nr(n.keyPath,t,r,n.index,0),s=nr(n.keyPath,t,r,n.index,1),l=nr(n.keyPath,t,r,n.index,2);return(i+s+l-1.5)*1.1547}return nr(n.keyPath,t,r,n.index)*
|
|
1077
|
-
2-1}function So(e,t=0){if(e){if(e.t==="number")return e.v;if(e.t==="bool")return e.v?1:0;if(e.t==="numbers")return e.v.length>0?e.v[Math.min(Math.max(t,0),e.v.length-1)]:void 0}}function
|
|
1078
|
-
wires;if(!r)return e;let i=So(r[
|
|
1079
|
-
let s=
|
|
1080
|
-
min(1,Math.max(0,t.index/(t.count-1)));return e.curve==="ease"?n*n*(3-2*n):e.curve==="expo"?n*n:n}function
|
|
1081
|
-
"mul"?e*(1+(i-1)*s):e+i*s}function
|
|
1082
|
-
base=="boolean"&&(s=i.base?1:0),s===void 0&&(s=n),i.expr)try{s=To(i.expr)(
|
|
1083
|
-
v;let s=Z(e?.[t]),l=s.base;return l&&typeof l=="object"&&!Array.isArray(l)&&"x"in l&&"y"in l?{x:
|
|
1084
|
-
let i=r.wires?.[t];if(i?.t==="string")return i.v;let s=Z(e?.[t]);return typeof s.base=="string"?s.base:n}function
|
|
1085
|
-
v;let s=Z(e?.[t]);return typeof s.base=="string"?s.base:n}function
|
|
1086
|
-
v>=.5;let s=Z(e?.[t]);return typeof s.base=="boolean"?s.base:typeof s.base=="number"?s.base!==0:n}function
|
|
1087
|
-
n+e.length:n]}function
|
|
1088
|
-
let l=
|
|
1089
|
-
filter(l=>typeof l=="number"):n}function
|
|
1090
|
-
has("t")}catch{return!1}return!1}function
|
|
1077
|
+
2-1}function So(e,t=0){if(e){if(e.t==="number")return e.v;if(e.t==="bool")return e.v?1:0;if(e.t==="numbers")return e.v.length>0?e.v[Math.min(Math.max(t,0),e.v.length-1)]:void 0}}function Ef(e,t,n){let r=n.
|
|
1078
|
+
wires;if(!r)return e;let i=So(r[mi(t,"amount")]),s=So(r[mi(t,"seed")]);return i===void 0&&s===void 0?e:{...e,amount:i??e.amount,seed:s===void 0?e.seed:Math.floor(s)}}function bi(e,t,n,r,i){if(!t)return e;
|
|
1079
|
+
let s=Ef(t,r,i);if(s.amount===0)return e;let l=kf(s,n,i),u=s.apply==="mul"?e*(1+s.amount*l):e+s.amount*l;return s.snap&&s.snap>0?Math.round(u/s.snap)*s.snap:u}function Sf(e,t){if(t.count<=1)return 0;let n=Math.
|
|
1080
|
+
min(1,Math.max(0,t.index/(t.count-1)));return e.curve==="ease"?n*n*(3-2*n):e.curve==="expo"?n*n:n}function vi(e,t,n,r){if(!t)return e;let i=So(r.wires?.[zs(n)])??t.amount,s=Sf(t,r);return s===0?e:t.apply===
|
|
1081
|
+
"mul"?e*(1+(i-1)*s):e+i*s}function Ii(e,t,n,r){let i=Z(e?.[t]),s=So(r.wires?.[t],r.index);if(s===void 0&&i.track&&(s=ga(i.track,r.t)),s===void 0&&typeof i.base=="number"&&(s=i.base),s===void 0&&typeof i.
|
|
1082
|
+
base=="boolean"&&(s=i.base?1:0),s===void 0&&(s=n),i.expr)try{s=To(i.expr)(Cf(r,s))}catch{}return bi(vi(s,i.stagger,t,r),i.jitter,t,t,r)}function Bf(e,t,n,r){let i=r.wires?.[t];if(i?.t==="vec2")return i.
|
|
1083
|
+
v;let s=Z(e?.[t]),l=s.base;return l&&typeof l=="object"&&!Array.isArray(l)&&"x"in l&&"y"in l?{x:bi(vi(l.x,s.stagger,t,r),s.jitter,`${t}.x`,t,r),y:bi(vi(l.y,s.stagger,t,r),s.jitter,`${t}.y`,t,r)}:n}function va(e,t,n,r){
|
|
1084
|
+
let i=r.wires?.[t];if(i?.t==="string")return i.v;let s=Z(e?.[t]);return typeof s.base=="string"?s.base:n}function Mi(e,t,n,r){let i=r.wires?.[t];if(i?.t==="paint"||i?.t==="color"||i?.t==="string")return i.
|
|
1085
|
+
v;let s=Z(e?.[t]);return typeof s.base=="string"?s.base:n}function Pf(e,t,n,r){return _r(Mi(e,t,n,r))??n}function _f(e,t,n,r){let i=r.wires?.[t];if(i?.t==="bool")return i.v;if(i?.t==="number")return i.
|
|
1086
|
+
v>=.5;let s=Z(e?.[t]);return typeof s.base=="boolean"?s.base:typeof s.base=="number"?s.base!==0:n}function Mf(e,t){if(e.length===0||!Number.isFinite(t))return;let n=Math.floor(t)%e.length;return e[n<0?
|
|
1087
|
+
n+e.length:n]}function Ti(e,t,n,r,i){let s=i.wires?.[t];if(s?.t==="number"||s?.t==="bool"){let l=Mf(n,typeof s.v=="number"?s.v:s.v?1:0);if(l!==void 0)return l}return va(e,t,r,i)}function Tf(e,t,n,r,i,s=n){
|
|
1088
|
+
let l=Ti(e,t,s,r,i);return n.includes(l)?l:r}function Ia(e,t,n,r){let i=r?.wires?.[t];if(i?.t==="numbers")return i.v;if(i?.t==="number")return[i.v];let s=Z(e?.[t]);return Array.isArray(s.base)?s.base.
|
|
1089
|
+
filter(l=>typeof l=="number"):n}function Rf(e){let t=Z(e);if(t.track&&t.track.keyframes.length>1||t.jitter&&t.jitter.mode==="animated"&&t.jitter.amount!==0)return!0;if(t.expr)try{return To(t.expr).refs.
|
|
1090
|
+
has("t")}catch{return!1}return!1}function xi(e){return e.type==="enum"?e.options.map(t=>t.value):[]}var Ye=[{key:"stroke",label:"Stroke",type:"color",default:"#ffffff",group:"Style"},{key:"strokeWidth",label:"Width",type:"number",default:1,min:0,step:.1,unit:"px",group:"Style"},{key:"fill",label:"Fi\
|
|
1091
1091
|
ll",type:"color",default:"none",group:"Style"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Style"},{key:"dash",label:"Dash",type:"numbers",default:[],group:"Styl\
|
|
1092
1092
|
e"}];function xa(e){let{nodeId:t,seed:n,t:r,params:i,defs:s,inputs:l,multiInputs:u,wires:h}=e,f=e.canvas??{w:0,h:0},A=`${n}|${t}`,d=new Map(s.map(b=>[b.key,b])),y={W:f.w,H:f.h,aspect:f.h>0?f.w/f.h:0},
|
|
1093
1093
|
g=(b=0,C=1,M)=>({keyPath:A,index:b,count:C,t:r,vars:M?{...y,...M}:y,wires:h}),x=b=>{let C=d.get(b);return C&&(C.type==="number"||C.type==="int"||C.type==="stops")?C.default:0},v={nodeId:t,name:e.name,
|
|
1094
|
-
seed:n,t:r,canvas:f,rasterize:e.rasterize,video:e.video,outline:e.outline,assets:e.assets??{},asset:e.asset,paramDefs:s,params:i,inputs:l,wires:h,inputList:b=>u[b]??(l[b]?[l[b]]:[]),scope:g,num:(b,C,M,S)=>
|
|
1095
|
-
i,b,x(b),g(C,M,S)),int:(b,C,M,S)=>Math.round(
|
|
1096
|
-
"enum"){let S=C.rangeFor?.(i??{}),T=g().wires?.[b];return S&&T?.t==="number"?String(Math.round(Math.min(S.max,Math.max(S.min,T.v)))):
|
|
1097
|
-
return va(i,b,M,g())},color:(b,C,M)=>{let S=d.get(b),T=S&&S.type==="color"?S.default:"#ffffff";return
|
|
1098
|
-
i,b,T,g(C,M))},bool:b=>{let C=d.get(b),M=C&&C.type==="bool"?C.default:!1;return
|
|
1099
|
-
|
|
1094
|
+
seed:n,t:r,canvas:f,rasterize:e.rasterize,video:e.video,outline:e.outline,assets:e.assets??{},asset:e.asset,paramDefs:s,params:i,inputs:l,wires:h,inputList:b=>u[b]??(l[b]?[l[b]]:[]),scope:g,num:(b,C,M,S)=>Ii(
|
|
1095
|
+
i,b,x(b),g(C,M,S)),int:(b,C,M,S)=>Math.round(Ii(i,b,x(b),g(C,M,S))),vec2:(b,C,M,S)=>{let T=d.get(b),P=T&&T.type==="vec2"?T.default:{x:0,y:0};return Bf(i,b,P,g(C,M,S))},str:b=>{let C=d.get(b);if(C&&C.type===
|
|
1096
|
+
"enum"){let S=C.rangeFor?.(i??{}),T=g().wires?.[b];return S&&T?.t==="number"?String(Math.round(Math.min(S.max,Math.max(S.min,T.v)))):Ti(i,b,xi(C),C.default,g())}let M=C&&C.type==="string"?C.default:"";
|
|
1097
|
+
return va(i,b,M,g())},color:(b,C,M)=>{let S=d.get(b),T=S&&S.type==="color"?S.default:"#ffffff";return Pf(i,b,T,g(C,M))},paint:(b,C,M)=>{let S=d.get(b),T=S&&S.type==="color"?S.default:"#ffffff";return Mi(
|
|
1098
|
+
i,b,T,g(C,M))},bool:b=>{let C=d.get(b),M=C&&C.type==="bool"?C.default:!1;return _f(i,b,M,g())},enumOf:(b,C)=>{let M=d.get(b),S=M&&M.type==="enum"?M.default:C[0];return Tf(i,b,C,S,g(),M&&M.type==="enum"?
|
|
1099
|
+
xi(M):C)},numbers:b=>{let C=d.get(b);return Ia(i,b,C&&C.type==="numbers"?C.default:[],g())},style:(b=0,C=1)=>{let M={...Bo,stroke:v.paint("stroke",b,C),strokeWidth:v.num("strokeWidth",b,C),fill:v.paint(
|
|
1100
1100
|
"fill",b,C),opacity:v.num("opacity",b,C)},S=v.numbers("dash");return S.length>0&&(M.strokeDash=S),M},shapes:(b="in")=>{let C=l[b];return C&&C.t==="shapes"?C.v:[]},texture:(b="in")=>{let C=l[b];return C&&
|
|
1101
|
-
C.t==="texture"?C.v:void 0},meta:(b,C)=>({sourceNodeId:t,index:b,...C?{tags:C}:{}}),shapeId:(b,C)=>C?`${t}:${b}:${C}`:`${t}:${b}`,rand:(...b)=>
|
|
1101
|
+
C.t==="texture"?C.v:void 0},meta:(b,C)=>({sourceNodeId:t,index:b,...C?{tags:C}:{}}),shapeId:(b,C)=>C?`${t}:${b}:${C}`:`${t}:${b}`,rand:(...b)=>df(A,...b),track:b=>Z(i[b]).track};return v}var wa=class{constructor(){
|
|
1102
1102
|
Bt(this,"defs",new Map);Bt(this,"specialized",new WeakMap)}register(e){if(this.defs.has(e.type))throw new Error(`Duplicate node type "${e.type}"`);return this.defs.set(e.type,e),this}registerAll(e){for(let t of e)
|
|
1103
1103
|
this.register(t);return this}get(e){return this.defs.get(e)}require(e){let t=this.defs.get(e);if(!t)throw new Error(`Unknown node type "${e}"`);return t}forNode(e){if(!e)return;let t=this.defs.get(e.type);
|
|
1104
1104
|
if(!t?.specialize)return t;let n=this.specialized.get(e);return n||(n={...t,...t.specialize(e)},this.specialized.set(e,n)),n}requireNode(e){let t=this.forNode(e);if(!t)throw new Error(`Unknown node ty\
|
|
1105
|
-
pe "${e.type}"`);return t}list(){return[...this.defs.values()].sort((e,t)=>e.type.localeCompare(t.type))}has(e){return this.defs.has(e)}};function
|
|
1106
|
-
let t=Z(e.params.duration).base;return typeof t=="number"&&t>0?t:0}function
|
|
1107
|
-
r.get(s.id),u=
|
|
1108
|
-
d.start||A.id.localeCompare(d.id))[0],!f){i.set(s.id,{on:!1,localT:0});continue}h=t-f.start}u===0?i.set(s.id,{on:!0,localT:h,clip:f}):
|
|
1109
|
-
s.id,h<u?{on:!0,localT:h,clip:f}:{on:!1,localT:0,clip:f})}return i}var
|
|
1110
|
-
function
|
|
1105
|
+
pe "${e.type}"`);return t}list(){return[...this.defs.values()].sort((e,t)=>e.type.localeCompare(t.type))}has(e){return this.defs.has(e)}};function wi(e){return e.type==="layer"?e.id:e.layer}function Qf(e){
|
|
1106
|
+
let t=Z(e.params.duration).base;return typeof t=="number"&&t>0?t:0}function Nf(e){return Z(e.params.loop).base===!0}function Df(e,t,n){let r=new Map;for(let s of e.clips){let l=r.get(s.layer);l?l.push(s):r.set(s.layer,[s])}let i=new Map;for(let s of e.graph.nodes){if(s.type!=="layer")continue;let l=s.id===n?void 0:
|
|
1107
|
+
r.get(s.id),u=Qf(s);if(!l){if(e.clips.length>0&&s.id!==n){i.set(s.id,{on:!1,localT:0});continue}if(u===0)continue}let h=t,f;if(l){if(f=l.filter(A=>A.start<=t&&t<A.start+A.duration).sort((A,d)=>A.start-
|
|
1108
|
+
d.start||A.id.localeCompare(d.id))[0],!f){i.set(s.id,{on:!1,localT:0});continue}h=t-f.start}u===0?i.set(s.id,{on:!0,localT:h,clip:f}):Nf(s)?i.set(s.id,{on:!0,localT:h-Math.floor(h/u)*u,clip:f}):i.set(
|
|
1109
|
+
s.id,h<u?{on:!0,localT:h,clip:f}:{on:!1,localT:0,clip:f})}return i}var Ri=class extends Error{constructor(t){super(`Cycle in graph: ${t.join(" \u2192 ")}`);Bt(this,"cycle");this.cycle=t,this.name="CycleError"}};function Qi(e){return new Map(e.nodes.map(t=>[t.id,t]))}
|
|
1110
|
+
function Of(e){let t=new Map(e.nodes.map(n=>[n.id,[]]));for(let n of e.edges)t.get(n.to)?.push(n);return t}function Ca(e){return Er(e)??e}var ko=e=>`n|${e}`,Eo=(e,t)=>`t|${e}|${t}`;function ka(e){let t=Qi(
|
|
1111
1111
|
e),n=new Map;for(let d of e.edges){if(!t.has(d.from)||!d.fromPort.startsWith("param:"))continue;let y=d.fromPort.slice(6),g=n.get(d.from);g?g.includes(y)||g.push(y):n.set(d.from,[y])}let r=[],i=new Map;
|
|
1112
1112
|
for(let d of e.nodes){for(let g of n.get(d.id)??[]){let x=Eo(d.id,g);r.push(x),i.set(x,{kind:"tap",node:d,key:g})}let y=ko(d.id);r.push(y),i.set(y,{kind:"cook",node:d})}let s=new Map(r.map(d=>[d,0])),
|
|
1113
1113
|
l=new Map(r.map(d=>[d,[]])),u=(d,y)=>{l.get(d).push(y),s.set(y,s.get(y)+1)};for(let d of e.nodes)for(let y of n.get(d.id)??[])u(Eo(d.id,y),ko(d.id));for(let d of e.edges){if(!t.has(d.from)||!t.has(d.to))
|
|
1114
1114
|
continue;let y=d.fromPort.startsWith("param:")?Eo(d.from,d.fromPort.slice(6)):ko(d.from);u(y,ko(d.to));let g=Eo(d.to,Ca(d.toPort));s.has(g)&&u(y,g)}let h=r.filter(d=>s.get(d)===0),f=[],A=new Set;for(;h.
|
|
1115
1115
|
length>0;){let d=h.shift();A.add(d),f.push(i.get(d));for(let y of l.get(d)){let g=s.get(y)-1;s.set(y,g),g===0&&h.push(y)}}if(f.length!==r.length){let d=[];for(let y of r){if(A.has(y))continue;let g=i.
|
|
1116
|
-
get(y).node.id;d.includes(g)||d.push(g)}throw new
|
|
1117
|
-
n=new Map,r=l=>{t.has(l)||t.set(l,0),n.has(l)||n.set(l,[])};for(let l of e){if(l.from!==l.to||!l.fromPort.startsWith("param:"))return null;let u=l.fromPort.slice(6),h=
|
|
1116
|
+
get(y).node.id;d.includes(g)||d.push(g)}throw new Ri(d)}return f}function Lf(e){let t=[];for(let n of ka(e))n.kind==="cook"&&t.push(n.node);return t}function Ff(e){if(e.length===0)return[];let t=new Map,
|
|
1117
|
+
n=new Map,r=l=>{t.has(l)||t.set(l,0),n.has(l)||n.set(l,[])};for(let l of e){if(l.from!==l.to||!l.fromPort.startsWith("param:"))return null;let u=l.fromPort.slice(6),h=Er(l.toPort)??l.toPort;r(u),r(h),
|
|
1118
1118
|
n.get(u).push(h),t.set(h,t.get(h)+1)}let i=new Map,s=[...t.entries()].filter(([,l])=>l===0).map(([l])=>l);for(;s.length>0;){let l=s.shift();i.set(l,i.size);for(let u of n.get(l)){let h=t.get(u)-1;t.set(
|
|
1119
|
-
u,h),h===0&&s.push(u)}}return i.size!==t.size?null:[...e].sort((l,u)=>i.get(l.fromPort.slice(6))-i.get(u.fromPort.slice(6)))}function
|
|
1120
|
-
timeRoot=="function"?i.has(u.id)||h.timeRoot(u.params):h?.timeRoot){n.add(u.id);continue}for(let A of Object.keys(u.params))if(
|
|
1121
|
-
get(u.from);h?h.push(u.to):s.set(u.from,[u.to])}let l=[...n];for(;l.length>0;){let u=l.pop();for(let h of s.get(u)??[])n.has(h)||(n.add(h),l.push(h))}return n}function
|
|
1119
|
+
u,h),h===0&&s.push(u)}}return i.size!==t.size?null:[...e].sort((l,u)=>i.get(l.fromPort.slice(6))-i.get(u.fromPort.slice(6)))}function Yf(e,t){let n=new Set,r=Qi(e),i=new Set;for(let u of e.edges)t.forNode(r.get(u.to))?.params.some(f=>f.key===u.toPort&&f.type==="enum")&&i.add(u.to);for(let u of e.nodes){let h=t.forNode(u);if(typeof h?.
|
|
1120
|
+
timeRoot=="function"?i.has(u.id)||h.timeRoot(u.params):h?.timeRoot){n.add(u.id);continue}for(let A of Object.keys(u.params))if(Rf(u.params[A])){n.add(u.id);break}}let s=new Map;for(let u of e.edges){let h=s.
|
|
1121
|
+
get(u.from);h?h.push(u.to):s.set(u.from,[u.to])}let l=[...n];for(;l.length>0;){let u=l.pop();for(let h of s.get(u)??[])n.has(h)||(n.add(h),l.push(h))}return n}function Xf(e,t,n=[]){let r=[],i=Qi(e),s=new Set(
|
|
1122
1122
|
n.map(h=>h.layer));for(let h of e.nodes)t.has(h.type)||r.push({level:"error",nodeId:h.id,message:`Unknown node type "${h.type}"`});for(let h of e.edges){let f=i.get(h.from),A=i.get(h.to);if(!f||!A){r.
|
|
1123
1123
|
push({level:"warning",message:`Dangling edge ${h.from} \u2192 ${h.to}`});continue}let d=t.forNode(f),y=t.forNode(A);if(d&&!d.outputs.some(g=>g.name===h.fromPort)){let g=h.fromPort.startsWith("param:")?
|
|
1124
1124
|
d.params.find(v=>v.key===h.fromPort.slice(6)):void 0;g&&(g.type==="number"||g.type==="int"||g.type==="color"||g.type==="numbers"||g.type==="enum")||r.push({level:"warning",nodeId:f.id,message:`No outp\
|
|
1125
|
-
ut "${h.fromPort}" on ${f.type}`})}if(y){let g=y.inputs.some(b=>b.name===h.toPort),x=
|
|
1126
|
-
message:`No input or param "${h.toPort}" on ${A.type}`})}}for(let h of e.edges){let f=i.get(h.from),A=i.get(h.to);if(!f||!A)continue;let d=
|
|
1125
|
+
ut "${h.fromPort}" on ${f.type}`})}if(y){let g=y.inputs.some(b=>b.name===h.toPort),x=Er(h.toPort),v=y.params.some(b=>b.key===h.toPort||x!==void 0&&b.key===x);!g&&!v&&r.push({level:"warning",nodeId:A.id,
|
|
1126
|
+
message:`No input or param "${h.toPort}" on ${A.type}`})}}for(let h of e.edges){let f=i.get(h.from),A=i.get(h.to);if(!f||!A)continue;let d=wi(f),y=A.type==="layer"?A.id:wi(A),g=f.type==="layer"?void 0:
|
|
1127
1127
|
d;if(g===y)continue;let x=t.forNode(f),v=t.forNode(A),b=x?.outputs.find(M=>M.name===h.fromPort),C=v?.inputs.find(M=>M.name===h.toPort);b&&(b.type==="shapes"||b.type==="texture")&&A.type!=="layer"?r.push(
|
|
1128
1128
|
{level:"warning",nodeId:A.id,message:`${f.type} "${f.id}" feeds ${A.type} from another layer; a stream belongs in one layer \u2014 duplicate the node.`}):(b?.clock||C?.clock)&&(s.has(g??"")||s.has(y??
|
|
1129
1129
|
""))&&r.push({level:"warning",nodeId:A.id,message:`A clock crosses into or out of a layer on the layer timeline: ${A.type} will not restart with the clip. Keep the Trigger in the same layer.`})}let l=new Map;
|
|
1130
1130
|
for(let h of e.edges){let A=t.forNode(i.get(h.to))?.inputs.find(y=>y.name===h.toPort);if(!A||A.multi)continue;let d=`${h.to}.${h.toPort}`;l.set(d,(l.get(d)??0)+1),l.get(d)===2&&r.push({level:"warning",
|
|
1131
1131
|
nodeId:h.to,message:`Several wires into ${i.get(h.to)?.type??h.to}.${h.toPort}, which takes one \u2014 all but one are ignored. Put a Merge in front.`})}let u=!1;for(let h of e.nodes){let f=e.edges.filter(
|
|
1132
|
-
A=>A.from===h.id&&A.to===h.id);f.length>0&&
|
|
1133
|
-
output into its own input.`}))}if(!u)try{
|
|
1132
|
+
A=>A.from===h.id&&A.to===h.id);f.length>0&&Ff(f)===null&&(u=!0,r.push({level:"error",nodeId:h.id,message:`${h.type}: its own wires loop back into it \u2014 a param tap feeding a param that feeds it, or an \
|
|
1133
|
+
output into its own input.`}))}if(!u)try{Lf(e)}catch(h){if(h instanceof Ri)r.push({level:"error",message:h.message});else throw h}return r}function Wf(e){return e.outputs[0]?.type==="shapes"&&e.inputs.
|
|
1134
1134
|
some(t=>t.type==="texture")}function $r(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map($r).join(",")}]`:`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(
|
|
1135
|
-
r)).map(([n,r])=>`${JSON.stringify(n)}:${$r(r)}`).join(",")}}`}var ia=new WeakMap,
|
|
1136
|
-
n,r,i]=
|
|
1135
|
+
r)).map(([n,r])=>`${JSON.stringify(n)}:${$r(r)}`).join(",")}}`}var ia=new WeakMap,Gf=1;function Ea(e){let t=ia.get(e);return t===void 0&&(t=Gf++,ia.set(e,t)),t}var qf=e=>Ea(e);function Hr(...e){let[t,
|
|
1136
|
+
n,r,i]=_i(e.join(" "));return`${t.toString(36)}${n.toString(36)}${r.toString(36)}${i.toString(36)}`}function Uf(e){let t=0;for(let n of Object.values(e))n.t==="texture"&&(t+=n.v.width*n.v.height*4);return t}
|
|
1137
1137
|
var Sa=class{constructor(e={}){Bt(this,"rings",new Map);Bt(this,"textured",new Set);Bt(this,"textureBytes",0);Bt(this,"frames");Bt(this,"textureBudget");Bt(this,"onDrop");Bt(this,"onKeep");this.frames=
|
|
1138
1138
|
Math.max(1,Math.floor(e.frames??1)),this.textureBudget=Math.max(0,e.textureBytes??Number.POSITIVE_INFINITY),this.onDrop=e.onDrop,this.onKeep=e.onKeep}get(e,t){let n=this.rings.get(e);if(!n)return;let r=n.
|
|
1139
1139
|
findIndex(s=>s.hash===t);if(r<0)return;let i=n[r];return r!==0&&(n.splice(r,1),n.unshift(i)),i.bytes>0&&(this.textured.delete(i),this.textured.add(i)),i.outputs}set(e,t,n){let r={node:e,hash:t,outputs:n,
|
|
1140
|
-
bytes:
|
|
1140
|
+
bytes:Uf(n)};this.onKeep?.(n);let i=this.rings.get(e);i||(i=[],this.rings.set(e,i));let s=i.findIndex(l=>l.hash===t);for(s>=0&&this.drop(i.splice(s,1)[0]),i.unshift(r),r.bytes>0&&(this.textured.add(r),
|
|
1141
1141
|
this.textureBytes+=r.bytes);i.length>this.frames;)this.drop(i.pop());for(let l of this.textured){if(this.textureBytes<=this.textureBudget||l===r)break;let u=this.rings.get(l.node);if(u){let h=u.indexOf(
|
|
1142
1142
|
l);h>=0&&u.splice(h,1),u.length===0&&this.rings.delete(l.node)}this.drop(l)}}drop(e){e.bytes>0&&this.textured.delete(e)&&(this.textureBytes-=e.bytes),this.onDrop?.(e.outputs)}clear(){if(this.onDrop)for(let e of this.
|
|
1143
1143
|
rings.values())for(let t of e)this.onDrop(t.outputs);this.rings.clear(),this.textured.clear(),this.textureBytes=0}get size(){return this.rings.size}get entries(){let e=0;for(let t of this.rings.values())
|
|
1144
|
-
e+=t.length;return e}get heldTextureBytes(){return this.textureBytes}};function Ba(e,t,n={}){let r=n.t??0,i=n.cache,s=
|
|
1145
|
-
scene:sa(e),issues:s,cooked:u};let h;try{h=ka(e.graph)}catch(P){if(P instanceof
|
|
1146
|
-
A=
|
|
1147
|
-
C=new Set,M=new Set,S=P=>C.has(P.from)||M.has(`${P.from}.${P.fromPort}`),T=(P,E)=>{let _=x.get(P);return _?{...E,..._}:E};for(let P of h){let E=P.node,_=
|
|
1144
|
+
e+=t.length;return e}get heldTextureBytes(){return this.textureBytes}};function Ba(e,t,n={}){let r=n.t??0,i=n.cache,s=Xf(e.graph,t,e.clips),l=new Map,u=[];if(s.some(P=>P.level==="error"))return{outputs:l,
|
|
1145
|
+
scene:sa(e),issues:s,cooked:u};let h;try{h=ka(e.graph)}catch(P){if(P instanceof Ri)return s.push({level:"error",message:P.message}),{outputs:l,scene:sa(e),issues:s,cooked:u};throw P}let f=Yf(e.graph,t),
|
|
1146
|
+
A=Of(e.graph),d=new Map,y=`${e.canvas.w}x${e.canvas.h}@${e.canvas.origin}`,g=Df(e,r,n.audition),x=new Map,v=new Map,b=P=>P.fromPort.startsWith("param:")?x.get(P.from)?.[P.fromPort]:l.get(P.from)?.[P.fromPort],
|
|
1147
|
+
C=new Set,M=new Set,S=P=>C.has(P.from)||M.has(`${P.from}.${P.fromPort}`),T=(P,E)=>{let _=x.get(P);return _?{...E,..._}:E};for(let P of h){let E=P.node,_=wi(E),Q=_!==void 0?g.get(_):void 0,Y=Q?Q.localT:
|
|
1148
1148
|
r;if(Q&&!Q.on){P.kind!=="tap"&&(l.set(E.id,{}),d.set(E.id,Hr("off",E.id)));continue}let F=t.requireNode(E),$=A.get(E.id)??[],W=E.seed??e.seed,G=v.get(E.id);G||(G={},v.set(E.id,G));let oe=de=>{let Ie=F.
|
|
1149
1149
|
params.find(et=>et.key===de);if(!Ie)return;let qe={W:e.canvas.w,H:e.canvas.h,aspect:e.canvas.h>0?e.canvas.w/e.canvas.h:0},Ue={keyPath:`${W}|${E.id}`,index:0,count:1,t:Y,wires:G,vars:qe};if(Ie.type==="\
|
|
1150
|
-
number"||Ie.type==="int")return{t:"number",v:
|
|
1151
|
-
t:"numbers",v:Ia(E.params,de,Ie.default,Ue)};if(Ie.type==="enum"){let et=
|
|
1150
|
+
number"||Ie.type==="int")return{t:"number",v:Ii(E.params,de,Ie.default,Ue)};if(Ie.type==="color"){let et=Mi(E.params,de,Ie.default,Ue);return Sn(et)?or(et):{t:"color",v:et}}if(Ie.type==="numbers")return{
|
|
1151
|
+
t:"numbers",v:Ia(E.params,de,Ie.default,Ue)};if(Ie.type==="enum"){let et=xi(Ie),Ve=et.indexOf(Ti(E.params,de,et,Ie.default,Ue));return Ve>=0?{t:"number",v:Ve}:void 0}};if(P.kind==="tap"){for(let Ie of $){
|
|
1152
1152
|
if(Ca(Ie.toPort)!==P.key)continue;S(Ie)&&M.add(`${E.id}.param:${P.key}`);let qe=b(Ie);qe!==void 0&&(G[Ie.toPort]=qe)}let de=oe(P.key);if(de!==void 0){let Ie=x.get(E.id);Ie?Ie[`param:${P.key}`]=de:x.set(
|
|
1153
1153
|
E.id,{[`param:${P.key}`]:de})}continue}let ce={},he={},se=new Set(F.params.map(de=>de.key));for(let de of $){let Ie=b(de);if(Ie===void 0)continue;let qe=F.inputs.find(Ue=>Ue.name===de.toPort);if(qe)if(qe.
|
|
1154
|
-
multi){let Ue=he[de.toPort];Ue?Ue.push(Ie):he[de.toPort]=[Ie]}else ce[de.toPort]=Ie;else(se.has(de.toPort)||se.has(
|
|
1154
|
+
multi){let Ue=he[de.toPort];Ue?Ue.push(Ie):he[de.toPort]=[Ie]}else ce[de.toPort]=Ie;else(se.has(de.toPort)||se.has(Er(de.toPort)??""))&&(G[de.toPort]=Ie)}for(let[de,Ie]of Object.entries(he))ce[de]===void 0&&
|
|
1155
1155
|
(ce[de]=Ie[0]);let Ae=new Map,ve=$.map(de=>{let Ie=Ae.get(de.toPort)??0;Ae.set(de.toPort,Ie+1);let qe=de.fromPort.startsWith("param:")?`=${$r(b(de))}`:`${d.get(de.from)??""}.${de.fromPort}`;return`${de.
|
|
1156
1156
|
toPort}#${Ie}<${qe}`}).sort().join("|"),ne=$.some(S);if(ne&&C.add(E.id),n.textures&&F.outputs[0]?.type==="texture"){let de=n.textures(E.id),Ie=F.outputs[0],qe={};de&&Ie&&(qe[Ie.name]=Ge(de)),l.set(E.id,
|
|
1157
|
-
T(E.id,qe)),d.set(E.id,Hr("provided",E.id,de?String(
|
|
1157
|
+
T(E.id,qe)),d.set(E.id,Hr("provided",E.id,de?String(qf(de)):"none"));continue}if(n.vectors&&Wf(F)){let de=n.vectors(E.id),Ie=F.outputs[0],qe={};de&&Ie&&(qe[Ie.name]=V(de)),l.set(E.id,T(E.id,qe)),d.set(
|
|
1158
1158
|
E.id,Hr("provided",E.id,de?String(Ea(de)):"none"));continue}if(E.disabled){let de=F.outputs[0],Ie=F.inputs.find(et=>(et.type==="shapes"||et.type==="texture")&&et.type===de?.type),qe=Ie?ce[Ie.name]:void 0,
|
|
1159
1159
|
Ue={};de&&qe&&qe.t===de.type&&(Ue[de.name]=qe),l.set(E.id,T(E.id,Ue)),d.set(E.id,Hr("disabled",E.id,$r(E.params),ve,y,f.has(E.id)?String(Y):""));continue}let ge=Hr(E.type,$r(E.params),E.name??"",String(
|
|
1160
1160
|
W),ve,y,f.has(E.id)?String(Y):"",n.outliner?"o1":"o0");d.set(E.id,ge);let _e=ne?void 0:i?.get(E.id,ge);if(_e){l.set(E.id,T(E.id,_e));continue}let Se=xa({nodeId:E.id,name:E.name,seed:W,t:Y,canvas:{w:e.
|
|
1161
1161
|
canvas.w,h:e.canvas.h,origin:e.canvas.origin},outline:n.outliner,rasterize:n.rasterize,video:n.video,assets:e.assets,asset:n.asset,params:E.params,defs:F.params,inputs:ce,multiInputs:he,wires:G}),Fe,lt=!1;
|
|
1162
|
-
try{Fe=
|
|
1163
|
-
u.push(E.id),!lt&&!ne&&i?.set(E.id,ge,Fe)}return{outputs:l,scene
|
|
1162
|
+
try{Fe=Hf(F.cook(Se),E.name)}catch(de){s.push({level:"error",nodeId:E.id,message:`${E.type} failed to cook: ${de instanceof Error?de.message:String(de)}`}),Fe={},lt=!0,C.add(E.id)}l.set(E.id,T(E.id,Fe)),
|
|
1163
|
+
u.push(E.id),!lt&&!ne&&i?.set(E.id,ge,Fe)}return{outputs:l,scene:$f(e,l),issues:s,cooked:u}}function Hf(e,t){let n=t?.trim();if(!n)return e;let r={};for(let[i,s]of Object.entries(e))r[i]=s.t==="shapes"?
|
|
1164
1164
|
{t:"shapes",v:s.v.map(l=>(l.meta.tags??[]).includes(n)?l:{...l,meta:{...l.meta,tags:[...l.meta.tags??[],n]}})}:s;return r}function Pa(e){if(!(e.display!=="pixel"&&e.display!=="mono"))return{mode:e.display,
|
|
1165
|
-
ink:e.ink,threshold:e.threshold}}function sa(e){let t=Pa(e.canvas);return{width:e.canvas.w,height:e.canvas.h,background:e.canvas.bg,origin:e.canvas.origin,...t?{display:t}:{},layers:[]}}function
|
|
1165
|
+
ink:e.ink,threshold:e.threshold}}function sa(e){let t=Pa(e.canvas);return{width:e.canvas.w,height:e.canvas.h,background:e.canvas.bg,origin:e.canvas.origin,...t?{display:t}:{},layers:[]}}function $f(e,t){
|
|
1166
1166
|
for(let l of e.graph.nodes){let u=t.get(l.id);if(u){for(let h of Object.values(u))if(h?.t==="scene")return h.v}}let n=new Set(e.graph.edges.map(l=>`${l.from}.${l.fromPort}`)),r=[],i=[];for(let l of e.
|
|
1167
1167
|
graph.nodes){let u=t.get(l.id);if(u)for(let[h,f]of Object.entries(u))n.has(`${l.id}.${h}`)||(f?.t==="shapes"?r.push(...f.v):f?.t==="layers"&&i.push(...f.v))}r.length>0&&i.push({id:"__implicit",name:"P\
|
|
1168
1168
|
review",opacity:1,visible:!0,order:i.length,shapes:r}),i.sort((l,u)=>l.order-u.order);let s=Pa(e.canvas);return{width:e.canvas.w,height:e.canvas.h,background:e.canvas.bg,origin:e.canvas.origin,...s?{display:s}:
|
|
1169
|
-
{},layers:i}}var aa=new WeakMap;function Mr(e,t){if(e.meta.index===t)return e;let n=aa.get(e);n||(n=new Map,aa.set(e,n));let r=n.get(t);return r||(r={...e,meta:{...e.meta,index:t}},n.set(t,r)),r}var
|
|
1170
|
-
256+t]=(e[r&255]^r>>>8)>>>0}return e})();function
|
|
1171
|
-
(n>>>16&255)]^t[n>>>24];for(;r<e.length;r++)n=t[(n^e[r])&255]^n>>>8;return(n^4294967295)>>>0}function
|
|
1172
|
-
65521,n%=65521}return(n<<16|t)>>>0}var
|
|
1173
|
-
e,e}function
|
|
1174
|
-
4,8+t.length))),n}function
|
|
1175
|
-
e.length));n[r++]=i===t-1?1:0,n[r++]=l.length&255,n[r++]=l.length>>8,n[r++]=~l.length&255,n[r++]=~l.length>>8&255,n.set(l,r),r+=l.length}return new DataView(n.buffer).setUint32(r,
|
|
1176
|
-
0,t),s.setUint32(4,n),i[8]=8,i[9]=6;let l=new Uint8Array(n*(1+t*4)),u=
|
|
1177
|
-
l[h++]=u[M+r[f+1]],l[h++]=u[M+r[f+2]],l[h++]=C}}}let d=[new Uint8Array([137,80,78,71,13,10,26,10]),
|
|
1178
|
-
y),x=0;for(let v of d)g.set(v,x),x+=v.length;return g}var mn=new TextEncoder().encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
|
|
1169
|
+
{},layers:i}}var aa=new WeakMap;function Mr(e,t){if(e.meta.index===t)return e;let n=aa.get(e);n||(n=new Map,aa.set(e,n));let r=n.get(t);return r||(r={...e,meta:{...e.meta,index:t}},n.set(t,r)),r}var zf=(()=>{let e=new Uint32Array(1024);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}for(let t=0;t<256;t++)for(let n=1;n<4;n++){let r=e[(n-1)*256+t];e[n*
|
|
1170
|
+
256+t]=(e[r&255]^r>>>8)>>>0}return e})();function jf(e){let t=zf,n=4294967295,r=0,i=e.length-e.length%4;for(;r<i;r+=4)n^=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,n=t[768+(n&255)]^t[512+(n>>>8&255)]^t[256+
|
|
1171
|
+
(n>>>16&255)]^t[n>>>24];for(;r<e.length;r++)n=t[(n^e[r])&255]^n>>>8;return(n^4294967295)>>>0}function Vf(e){let t=1,n=0,r=0,i=e.length;for(;r<i;){let s=Math.min(i,r+5552);for(;r<s;r++)t+=e[r],n+=t;t%=
|
|
1172
|
+
65521,n%=65521}return(n<<16|t)>>>0}var Ni;function Jf(){if(Ni)return Ni;let e=new Uint8Array(256*256);for(let t=1;t<256;t++)for(let n=0;n<256;n++)e[t*256+n]=Math.min(255,Math.round(n*255/t));return Ni=
|
|
1173
|
+
e,e}function Di(e,t){let n=new Uint8Array(12+t.length),r=new DataView(n.buffer);r.setUint32(0,t.length);for(let i=0;i<4;i++)n[4+i]=e.charCodeAt(i);return n.set(t,8),r.setUint32(8+t.length,jf(n.subarray(
|
|
1174
|
+
4,8+t.length))),n}function Zf(e){let t=Math.max(1,Math.ceil(e.length/65535)),n=new Uint8Array(2+t*5+e.length+4);n[0]=120,n[1]=1;let r=2;for(let i=0;i<t;i++){let s=i*65535,l=e.subarray(s,Math.min(s+65535,
|
|
1175
|
+
e.length));n[r++]=i===t-1?1:0,n[r++]=l.length&255,n[r++]=l.length>>8,n[r++]=~l.length&255,n[r++]=~l.length>>8&255,n.set(l,r),r+=l.length}return new DataView(n.buffer).setUint32(r,Vf(e)),n}function Kf(e){let{width:t,height:n,data:r}=e;if(r.length!==t*n*4)throw new Error(`texture is ${r.length} bytes; ${t}x${n} RGBA needs ${t*n*4}`);let i=new Uint8Array(13),s=new DataView(i.buffer);s.setUint32(
|
|
1176
|
+
0,t),s.setUint32(4,n),i[8]=8,i[9]=6;let l=new Uint8Array(n*(1+t*4)),u=Jf(),h=0,f=0;for(let v=0;v<n;v++){l[h++]=0;for(let b=0;b<t;b++,f+=4){let C=r[f+3];if(C===0)h+=4;else{let M=C*256;l[h++]=u[M+r[f]],
|
|
1177
|
+
l[h++]=u[M+r[f+1]],l[h++]=u[M+r[f+2]],l[h++]=C}}}let d=[new Uint8Array([137,80,78,71,13,10,26,10]),Di("IHDR",i),Di("IDAT",Zf(l)),Di("IEND",new Uint8Array(0))],y=d.reduce((v,b)=>v+b.length,0),g=new Uint8Array(
|
|
1178
|
+
y),x=0;for(let v of d)g.set(v,x),x+=v.length;return g}var mn=new TextEncoder().encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Oi=61,ep=new TextDecoder("ascii");function tp(e){
|
|
1179
1179
|
let t=new Uint8Array(Math.ceil(e.length/3)*4),n=0,r=e.length-e.length%3;for(let s=0;s<r;s+=3){let l=e[s],u=e[s+1],h=e[s+2];t[n++]=mn[l>>2],t[n++]=mn[(l&3)<<4|u>>4],t[n++]=mn[(u&15)<<2|h>>6],t[n++]=mn[h&
|
|
1180
|
-
63]}let i=e.length-r;if(i===1){let s=e[r];t[n++]=mn[s>>2],t[n++]=mn[(s&3)<<4],t[n++]=
|
|
1181
|
-
|
|
1180
|
+
63]}let i=e.length-r;if(i===1){let s=e[r];t[n++]=mn[s>>2],t[n++]=mn[(s&3)<<4],t[n++]=Oi,t[n++]=Oi}else if(i===2){let s=e[r],l=e[r+1];t[n++]=mn[s>>2],t[n++]=mn[(s&3)<<4|l>>4],t[n++]=mn[(l&15)<<2],t[n++]=
|
|
1181
|
+
Oi}return ep.decode(t)}var _a=new WeakMap;function Wi(e){let t=_a.get(e);if(t)return t;let n=`data:image/png;base64,${tp(Kf(e))}`;return _a.set(e,n),n}function np(e){let t=Uint8Array.of(0,2,3,1);for(let n=2;n<
|
|
1182
1182
|
e;n*=2){let r=new Uint8Array(n*n*4),i=n*2;for(let s=0;s<n;s++)for(let l=0;l<n;l++){let u=t[s*n+l]*4;r[s*i+l]=u,r[s*i+l+n]=u+2,r[(s+n)*i+l]=u+3,r[(s+n)*i+l+n]=u+1}t=r}return t}var Xe,ze=0;var Tr="auto",Ma;function mt(){if(!(Tr==="js"||Tr==="wasm")){if(Tr==="gpu"&&!Ma)throw new Error("gpu kernels forced but not set \u2014 setGpuKernels() first");return Ma}}function Xt(){if(Tr==="js"||Tr==="gpu")return!1;
|
|
1183
1183
|
if(Tr==="wasm"){if(!Xe)throw new Error("wasm kernels forced but not loaded \u2014 await loadKernels() first");return!0}return Xe!==void 0}var Ke=e=>e+15&-16;function Wt(e){let t=Xe,n=ze+e,r=t.memory.buffer.
|
|
1184
1184
|
byteLength;return r<n&&t.memory.grow(Math.ceil((n-r)/65536)),new Uint8Array(t.memory.buffer)}function Vt(e){let t={width:e.width,height:e.height,data:new Uint8ClampedArray(e.width*e.height*4)};return e.
|
|
1185
|
-
at&&(t.at=e.at),t}function Xa(e,t){return 8*(2*e*t*4+e*4)}function
|
|
1186
|
-
e);return A.data.set(new Uint8Array(Xe.memory.buffer,u,s)),A}function
|
|
1187
|
-
s,t,n,r[0],r[1],r[2]);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,f,u)),g}function
|
|
1188
|
-
l),new Int32Array(Xe.memory.buffer,h,t.length).set(t),Xe.glitch(l,u,h,t.length/5,n,r);let A=Vt(e);return A.data.set(new Uint8Array(Xe.memory.buffer,u,s)),A}function
|
|
1189
|
-
data:h}=e,f=l*u*4,A=ze,d=Ke(A+f);Wt(d+f-ze).set(h,A),Xe.scanlines(A,d,l,u,t,n,r,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,d,f)),g}function
|
|
1190
|
-
data:h}=e,f=l*u*4,A=ze,d=Ke(A+f);Wt(d+f-ze).set(h,A),Xe.grain(A,d,l,u,t,n,r|0,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,d,f)),g}function
|
|
1185
|
+
at&&(t.at=e.at),t}function Xa(e,t){return 8*(2*e*t*4+e*4)}function rp(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,l=ze,u=Ke(l+s),h=Ke(u+s);Wt(h+Xa(n,r)-ze).set(i,l),Xe.blur(l,u,h,n,r,t[0],t[1],t[2]);let A=Vt(
|
|
1186
|
+
e);return A.data.set(new Uint8Array(Xe.memory.buffer,u,s)),A}function op(e,t,n,r){let{width:i,height:s,data:l}=e,u=i*s*4,h=ze,f=Ke(h+u),A=Ke(f+u),d=Ke(2*u)+Xa(i,s);Wt(A+d-ze).set(l,h),Xe.bloom(h,f,A,i,
|
|
1187
|
+
s,t,n,r[0],r[1],r[2]);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,f,u)),g}function ip(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,l=ze,u=Ke(l+s),h=Ke(u+s);Wt(h+t.byteLength-ze).set(i,
|
|
1188
|
+
l),new Int32Array(Xe.memory.buffer,h,t.length).set(t),Xe.glitch(l,u,h,t.length/5,n,r);let A=Vt(e);return A.data.set(new Uint8Array(Xe.memory.buffer,u,s)),A}function sp(e,t,n,r,i,s=!1){let{width:l,height:u,
|
|
1189
|
+
data:h}=e,f=l*u*4,A=ze,d=Ke(A+f);Wt(d+f-ze).set(h,A),Xe.scanlines(A,d,l,u,t,n,r,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,d,f)),g}function ap(e,t,n,r,i,s){let{width:l,height:u,
|
|
1190
|
+
data:h}=e,f=l*u*4,A=ze,d=Ke(A+f);Wt(d+f-ze).set(h,A),Xe.grain(A,d,l,u,t,n,r|0,i,s?1:0);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,d,f)),g}function lp(e,t,n,r,i){let{width:s,height:l,
|
|
1191
1191
|
data:u}=e,h=s*l*4,f=ze,A=Ke(f+h),d=Ke(A+h);Wt(d+72-ze).set(u,f),new Float64Array(Xe.memory.buffer,d,9).set(i),Xe.color_correct(f,A,d,s,l,t,n,r);let g=Vt(e);return g.data.set(new Uint8Array(Xe.memory.buffer,
|
|
1192
|
-
A,h)),g}function
|
|
1192
|
+
A,h)),g}function up(e,t,n){let{width:r,height:i,data:s}=e,l=r*i*4,u=ze,h=Ke(u+l);Wt(h+l-ze).set(s,u),Xe.threshold(u,h,r,i,t,n);let A=Vt(e);return A.data.set(new Uint8Array(Xe.memory.buffer,h,l)),A}function cp(e,t,n,r,i,s){
|
|
1193
1193
|
let{width:l,height:u,data:h}=e,f=l*u*4,A=t.width*t.height*4,d=ze,y=Ke(d+f),g=Ke(y+A),x=Wt(g+f-ze);x.set(h,d),x.set(t.data,y),Xe.matte(d,y,g,l,u,t.width,t.height,n,r,i?1:0,s?1:0);let v=Vt(e);return v.data.
|
|
1194
|
-
set(new Uint8Array(Xe.memory.buffer,g,f)),v}function
|
|
1194
|
+
set(new Uint8Array(Xe.memory.buffer,g,f)),v}function hp(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,l=Math.ceil(n/t.s)*Math.ceil(r/t.s),u=(t.mono?1:3)+(t.alpha?1:0),h=ze,f=Ke(h+s),A=Ke(f+s),d=Ke(A+l),
|
|
1195
1195
|
y=Ke(d+l*u*4);Wt(y+l*u-ze).set(i,h);let x=b=>b[0]|b[1]<<8|b[2]<<16|b[3]<<24|0;Xe.dither(h,f,n,r,A,d,y,t.kind,t.order,t.steps,t.s,t.mono?1:0,x(t.dark),x(t.light),t.alpha?1:0);let v=Vt(e);return v.data.
|
|
1196
|
-
set(new Uint8Array(Xe.memory.buffer,f,s)),v}function
|
|
1197
|
-
memory.buffer,l,i)),h}function
|
|
1198
|
-
s)),f}function
|
|
1199
|
-
Xe.memory.buffer,h,l)),y}function
|
|
1200
|
-
e.at),d.data.set(new Uint8Array(Xe.memory.buffer,f,u)),d}function
|
|
1201
|
-
t}function jt(e){let t=mt();if(t?.resident(e))return t.copy(e);let n={width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)};return e.at&&(n.at=e.at),n}function
|
|
1202
|
-
3+1),n=Math.floor(t);n%2===0&&n--;let r=n+2,i=(12*e*e-3*n*n-12*n-9)/(-4*n-4),s=Math.round(i),l=u=>u<s?n:r;return[l(0),l(1),l(2)]}function
|
|
1196
|
+
set(new Uint8Array(Xe.memory.buffer,f,s)),v}function fp(e){let{width:t,height:n,data:r}=e,i=t*n*4,s=ze,l=Ke(s+i);Wt(l+i-ze).set(r,s),Xe.invert(s,l,t,n);let h=Vt(e);return h.data.set(new Uint8Array(Xe.
|
|
1197
|
+
memory.buffer,l,i)),h}function pp(e,t){let{width:n,height:r,data:i}=e,s=n*r*4,l=ze,u=Ke(l+s);Wt(u+s-ze).set(i,l),Xe.posterize(l,u,n,r,t);let f=Vt(e);return f.data.set(new Uint8Array(Xe.memory.buffer,u,
|
|
1198
|
+
s)),f}function dp(e,t,n){let{width:r,height:i,data:s}=e,l=r*i*4,u=ze,h=Ke(u+l),f=Ke(h+l),A=4*Math.max(r,i)*16;Wt(f+A-ze).set(s,u),Xe.chromatic(u,h,f,r,i,t,n);let y=Vt(e);return y.data.set(new Uint8Array(
|
|
1199
|
+
Xe.memory.buffer,h,l)),y}function Ap(e,t,n){let{width:r,height:i,data:s}=e,l=r*i*4,u=t*n*4,h=ze,f=Ke(h+l);Wt(f+u-ze).set(s,h),Xe.resample(h,f,r,i,t,n);let d={width:t,height:n,data:new Uint8ClampedArray(u)};return e.at&&(d.at=
|
|
1200
|
+
e.at),d.data.set(new Uint8Array(Xe.memory.buffer,f,u)),d}function Gi(e,t){return{width:e,height:t,data:new Uint8ClampedArray(e*t*4)}}function Yt(e){let t=Gi(e.width,e.height);return e.at&&(t.at=e.at),
|
|
1201
|
+
t}function jt(e){let t=mt();if(t?.resident(e))return t.copy(e);let n={width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)};return e.at&&(n.at=e.at),n}function mp(e){let t=Math.sqrt(12*e*e/
|
|
1202
|
+
3+1),n=Math.floor(t);n%2===0&&n--;let r=n+2,i=(12*e*e-3*n*n-12*n-9)/(-4*n-4),s=Math.round(i),l=u=>u<s?n:r;return[l(0),l(1),l(2)]}function yp(e,t,n,r,i){let s=2*i+1,l=n*4;for(let u=0;u<r;u++){let h=u*l,
|
|
1203
1203
|
f=0,A=0,d=0,y=0;for(let g=-i;g<=i;g++){let x=h+(g<0?0:g>=n?n-1:g)*4;f+=e[x],A+=e[x+1],d+=e[x+2],y+=e[x+3]}for(let g=0;g<n;g++){let x=h+g*4;t[x]=f/s,t[x+1]=A/s,t[x+2]=d/s,t[x+3]=y/s;let v=h+(g-i>0?g-i:
|
|
1204
|
-
0)*4,b=h+(g+i+1<n-1?g+i+1:n-1)*4;f+=e[b]-e[v],A+=e[b+1]-e[v+1],d+=e[b+2]-e[v+2],y+=e[b+3]-e[v+3]}}}function
|
|
1204
|
+
0)*4,b=h+(g+i+1<n-1?g+i+1:n-1)*4;f+=e[b]-e[v],A+=e[b+1]-e[v+1],d+=e[b+2]-e[v+2],y+=e[b+3]-e[v+3]}}}function gp(e,t,n,r,i){let s=2*i+1,l=n*4;Fi.length<l&&(Fi=new Float64Array(l));let u=Fi;u.fill(0,0,l);
|
|
1205
1205
|
for(let h=-i;h<=i;h++){let f=(h<0?0:h>=r?r-1:h)*l;for(let A=0;A<l;A++)u[A]=u[A]+e[f+A]}for(let h=0;h<r;h++){let f=h*l,A=(h-i>0?h-i:0)*l,d=(h+i+1<r-1?h+i+1:r-1)*l;for(let y=0;y<l;y++)t[f+y]=u[y]/s,u[y]=
|
|
1206
|
-
u[y]+(e[d+y]-e[A+y])}}var
|
|
1206
|
+
u[y]+(e[d+y]-e[A+y])}}var Li=new Float64Array(0),Ta=new Float64Array(0),Fi=new Float64Array(0);function bp(e,t,n){let r=t,i=n,s=-1,l=-1;if(e.byteOffset%4===0){let u=new Uint32Array(e.buffer,e.byteOffset,
|
|
1207
1207
|
t*n);for(let h=0;h<n;h++){let f=h*t;for(let A=0;A<t;A++)u[f+A]!==0&&(A<r&&(r=A),A>s&&(s=A),h<i&&(i=h),l=h)}}else for(let u=0;u<n;u++){let h=u*t*4;for(let f=0;f<t;f++){let A=h+f*4;(e[A]|e[A+1]|e[A+2]|e[A+
|
|
1208
|
-
3])!==0&&(f<r&&(r=f),f>s&&(s=f),u<i&&(i=u),l=u)}}return s<0?void 0:[r,i,s+1,l+1]}function
|
|
1209
|
-
let u=s*4;for(let h=0;h<l;h++){let f=h*u,A=((i+h)*n+r)*4;for(let d=0;d<u;d++)t[A+d]=Math.round(e[f+d])}}function
|
|
1210
|
-
2)]}function
|
|
1211
|
-
max(0,h[0]-f),d=Math.max(0,h[1]-f),y=Math.min(i,h[2]+f),g=Math.min(s,h[3]+f),x=y-A,v=g-d;
|
|
1212
|
-
b);for(let M of n)
|
|
1213
|
-
Math.max(0,s+t)),u=Math.floor(l);n[s]=u,r[s]=Math.min(e-1,u+1),i[s]=l-u}return{i0:n,i1:r,f:i}}function Wa(e,t,n){if(t===0&&n===0)return jt(e);let r=mt();if(r)return r.chromatic(e,t,n);if(Xt())return
|
|
1208
|
+
3])!==0&&(f<r&&(r=f),f>s&&(s=f),u<i&&(i=u),l=u)}}return s<0?void 0:[r,i,s+1,l+1]}function vp(e,t,n,r,i,s,l){for(let u=0;u<s;u++){let h=((r+u)*t+n)*4;l.set(e.subarray(h,h+i*4),u*i*4)}}function Ip(e,t,n,r,i,s,l){
|
|
1209
|
+
let u=s*4;for(let h=0;h<l;h++){let f=h*u,A=((i+h)*n+r)*4;for(let d=0;d<u;d++)t[A+d]=Math.round(e[f+d])}}function Xi(e){let[t,n,r]=mp(e);return[Math.max(0,(t-1)/2),Math.max(0,(n-1)/2),Math.max(0,(r-1)/
|
|
1210
|
+
2)]}function qi(e,t){if(t<=0)return jt(e);let n=Xi(t),r=mt();if(r)return r.blur(e,n);if(Xt())return rp(e,n);let{width:i,height:s,data:l}=e,u=Yt(e),h=bp(l,i,s);if(!h)return u;let f=n[0]+n[1]+n[2]+1,A=Math.
|
|
1211
|
+
max(0,h[0]-f),d=Math.max(0,h[1]-f),y=Math.min(i,h[2]+f),g=Math.min(s,h[3]+f),x=y-A,v=g-d;Li.length<l.length&&(Li=new Float64Array(l.length),Ta=new Float64Array(l.length));let b=Li,C=Ta;vp(l,i,A,d,x,v,
|
|
1212
|
+
b);for(let M of n)yp(b,C,x,v,M),gp(C,b,x,v,M);return Ip(b,u.data,i,A,d,x,v),u}function Ro(e,t){let n=new Int32Array(e),r=new Int32Array(e),i=new Float64Array(e);for(let s=0;s<e;s++){let l=Math.min(e-1,
|
|
1213
|
+
Math.max(0,s+t)),u=Math.floor(l);n[s]=u,r[s]=Math.min(e-1,u+1),i[s]=l-u}return{i0:n,i1:r,f:i}}function Wa(e,t,n){if(t===0&&n===0)return jt(e);let r=mt();if(r)return r.chromatic(e,t,n);if(Xt())return dp(
|
|
1214
1214
|
e,t,n);let{width:i,height:s,data:l}=e,u=Yt(e),h=u.data,f=Ro(i,-t),A=Ro(i,t),d=Ro(s,-n),y=Ro(s,n),g=i*4;for(let x=0;x<s;x++){let v=d.i0[x]*g,b=d.i1[x]*g,C=d.f[x],M=y.i0[x]*g,S=y.i1[x]*g,T=y.f[x],P=x*g;
|
|
1215
1215
|
if(C===0&&T===0){for(let E=0;E<i;E++){let _=P+E*4,Q=f.i0[E]*4,Y=f.i1[E]*4,F=f.f[E],$=A.i0[E]*4,W=A.i1[E]*4,G=A.f[E],oe=l[v+Q+3]*(1-F)+l[v+Y+3]*F,ce=l[M+$+3]*(1-G)+l[M+W+3]*G;h[_]=Math.round(l[v+Q]*(1-
|
|
1216
1216
|
F)+l[v+Y]*F),h[_+1]=l[_+1],h[_+2]=Math.round(l[M+$+2]*(1-G)+l[M+W+2]*G),h[_+3]=Math.round((oe+l[_+3]+ce)/3)}continue}for(let E=0;E<i;E++){let _=P+E*4,Q=f.i0[E]*4,Y=f.i1[E]*4,F=f.f[E],$=A.i0[E]*4,W=A.i1[E]*
|
|
1217
1217
|
4,G=A.f[E],oe=l[v+Q]*(1-F)+l[v+Y]*F,ce=l[b+Q]*(1-F)+l[b+Y]*F,he=l[v+Q+3]*(1-F)+l[v+Y+3]*F,se=l[b+Q+3]*(1-F)+l[b+Y+3]*F,Ae=l[M+$+2]*(1-G)+l[M+W+2]*G,ve=l[S+$+2]*(1-G)+l[S+W+2]*G,ne=l[M+$+3]*(1-G)+l[M+W+
|
|
1218
1218
|
3]*G,ge=l[S+$+3]*(1-G)+l[S+W+3]*G,_e=he*(1-C)+se*C,Se=ne*(1-T)+ge*T;h[_]=Math.round(oe*(1-C)+ce*C),h[_+1]=l[_+1],h[_+2]=Math.round(Ae*(1-T)+ve*T),h[_+3]=Math.round((_e+l[_+3]+Se)/3)}}return u}function Ga(e,t){
|
|
1219
1219
|
let n=Math.max(1,Math.round(t.spacing)),r=Math.min(n,Math.max(1,Math.round(t.thickness))),i=Math.min(1,Math.max(0,t.strength));if(i===0)return jt(e);let{width:s,height:l}=e,u=Math.round(t.offset),h=1-
|
|
1220
|
-
i,f=t.vertical===!0,A=mt();if(A)return A.scanlines(e,n,r,u,h,f);if(Xt())return
|
|
1220
|
+
i,f=t.vertical===!0,A=mt();if(A)return A.scanlines(e,n,r,u,h,f);if(Xt())return sp(e,n,r,u,h,f);let d=jt(e),y=x=>{d.data[x]=Math.round(d.data[x]*h),d.data[x+1]=Math.round(d.data[x+1]*h),d.data[x+2]=Math.
|
|
1221
1221
|
round(d.data[x+2]*h)},g=x=>((x+u)%n+n)%n<r;if(f){for(let x=0;x<s;x++)if(g(x))for(let v=0;v<l;v++)y((v*s+x)*4);return d}for(let x=0;x<l;x++){if(!g(x))continue;let v=x*s*4;for(let b=0;b<s;b++)y(v+b*4)}return d}
|
|
1222
|
-
function
|
|
1223
|
-
Math.imul(r,668265263)^Math.imul(i+1,374761393);return
|
|
1224
|
-
0,l=t.colour===!0;if(n===0)return jt(e);let u=mt();if(u)return u.grain(e,n,r,i,s,l);if(Xt())return
|
|
1222
|
+
function xp(e){return e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^=e>>>16,e>>>0}function Ra(e,t,n,r,i){let s=Math.imul(e,2654435761)^Math.imul(t,2246822519)^Math.imul(n,3266489917)^
|
|
1223
|
+
Math.imul(r,668265263)^Math.imul(i+1,374761393);return xp(s)/4294967296*2-1}function qa(e,t){let n=Math.min(1,Math.max(0,t.amount)),r=Math.max(1,Math.round(t.size)),i=t.seed>>>0,s=Math.round(t.frame)|
|
|
1224
|
+
0,l=t.colour===!0;if(n===0)return jt(e);let u=mt();if(u)return u.grain(e,n,r,i,s,l);if(Xt())return ap(e,n,r,i,s,l);let{width:h,height:f,data:A}=e,d=Yt(e);for(let y=0;y<f;y++){let g=y/r|0;for(let x=0;x<
|
|
1225
1225
|
h;x++){let v=(y*h+x)*4,b=A[v+3];if(b===0)continue;let C=x/r|0,M=n*b,S=Ra(C,g,i,s,0);for(let T=0;T<3;T++){let P=l&&T>0?Ra(C,g,i,s,T):S,E=Math.min(b,Math.max(0,A[v+T]+P*M));d.data[v+T]=Math.round(E)}d.data[v+
|
|
1226
|
-
3]=b}}return d}function
|
|
1227
|
-
r*.213,.715-n*.715-r*.715,.072-n*.072+r*.928,.213-n*.213+r*.143,.715+n*.285+r*.14,.072-n*.072-r*.283,.213-n*.213-r*.787,.715-n*.715+r*.715,.072+n*.928+r*.072])}function Ua(e,t){if(
|
|
1228
|
-
min(1,Math.max(-1,t.brightness)),r=1+Math.min(1,Math.max(-1,t.contrast)),i=1+Math.min(1,Math.max(-1,t.saturation)),s=
|
|
1226
|
+
3]=b}}return d}function wp(e){return e.brightness===0&&e.contrast===0&&e.saturation===0&&e.hue%360===0}function Cp(e){let t=e*Math.PI/180,n=Math.cos(t),r=Math.sin(t);return new Float64Array([.213+n*.787-
|
|
1227
|
+
r*.213,.715-n*.715-r*.715,.072-n*.072+r*.928,.213-n*.213+r*.143,.715+n*.285+r*.14,.072-n*.072-r*.283,.213-n*.213-r*.787,.715-n*.715+r*.715,.072+n*.928+r*.072])}function Ua(e,t){if(wp(t))return jt(e);let n=Math.
|
|
1228
|
+
min(1,Math.max(-1,t.brightness)),r=1+Math.min(1,Math.max(-1,t.contrast)),i=1+Math.min(1,Math.max(-1,t.saturation)),s=Cp(t.hue),l=mt();if(l)return l.colorCorrect(e,n,r,i,s);if(Xt())return lp(e,n,r,i,s);
|
|
1229
1229
|
let{data:u}=e,h=Yt(e);for(let f=0;f<u.length;f+=4){let A=u[f+3];if(A===0)continue;let d=u[f]/A,y=u[f+1]/A,g=u[f+2]/A,x=s[0]*d+s[1]*y+s[2]*g,v=s[3]*d+s[4]*y+s[5]*g,b=s[6]*d+s[7]*y+s[8]*g,C=.2126*x+.7152*
|
|
1230
1230
|
v+.0722*b;x=C+(x-C)*i,v=C+(v-C)*i,b=C+(b-C)*i,x=(x-.5)*r+.5+n,v=(v-.5)*r+.5+n,b=(b-.5)*r+.5+n,h.data[f]=Math.round(Math.min(1,Math.max(0,x))*A),h.data[f+1]=Math.round(Math.min(1,Math.max(0,v))*A),h.data[f+
|
|
1231
1231
|
2]=Math.round(Math.min(1,Math.max(0,b))*A),h.data[f+3]=A}return h}function Ha(e,t){let n=Math.min(1,Math.max(0,t.level)),r=Math.min(1,Math.max(0,t.soft)),i=mt();if(i)return i.threshold(e,n,r);if(Xt())
|
|
1232
|
-
return
|
|
1233
|
-
max(0,(A-u)/r));d=g*g*(3-2*g)}let y=Math.round(d*f);l.data[h]=y,l.data[h+1]=y,l.data[h+2]=y,l.data[h+3]=f}return l}function $a(e){let t=mt();if(t)return t.invert(e);if(Xt())return
|
|
1232
|
+
return up(e,n,r);let{data:s}=e,l=Yt(e),u=n-r/2;for(let h=0;h<s.length;h+=4){let f=s[h+3];if(f===0)continue;let A=(.2126*s[h]+.7152*s[h+1]+.0722*s[h+2])/f,d;if(r===0)d=A>=n?1:0;else{let g=Math.min(1,Math.
|
|
1233
|
+
max(0,(A-u)/r));d=g*g*(3-2*g)}let y=Math.round(d*f);l.data[h]=y,l.data[h+1]=y,l.data[h+2]=y,l.data[h+3]=f}return l}function $a(e){let t=mt();if(t)return t.invert(e);if(Xt())return fp(e);let{data:n}=e,
|
|
1234
1234
|
r=Yt(e);for(let i=0;i<n.length;i+=4){let s=n[i+3];r.data[i]=s-n[i],r.data[i+1]=s-n[i+1],r.data[i+2]=s-n[i+2],r.data[i+3]=s}return r}function za(e,t){let n=Math.min(256,Math.max(2,Math.round(t.levels)));
|
|
1235
|
-
if(n===256)return jt(e);let r=n-1,i=mt();if(i)return i.posterize(e,r);if(Xt())return
|
|
1235
|
+
if(n===256)return jt(e);let r=n-1,i=mt();if(i)return i.posterize(e,r);if(Xt())return pp(e,r);let s=new Uint8Array(65536);for(let h=1;h<256;h++)for(let f=0;f<=h;f++){let A=f*255/h,d=Math.round(A/255*r)/
|
|
1236
1236
|
r*255;s[h*256+f]=Math.round(d*h/255)}let{data:l}=e,u=Yt(e);for(let h=0;h<l.length;h+=4){let f=l[h+3];if(f===0)continue;let A=f*256;u.data[h]=s[A+l[h]],u.data[h+1]=s[A+l[h+1]],u.data[h+2]=s[A+l[h+2]],u.
|
|
1237
|
-
data[h+3]=f}return u}var Qa=e=>Math.min(255,Math.max(0,Math.round(e)));function
|
|
1237
|
+
data[h+3]=f}return u}var Qa=e=>Math.min(255,Math.max(0,Math.round(e)));function kp(e){let t=e.method;return{kind:t==="floyd"?1:t==="atkinson"?2:0,order:t==="bayer2"?2:t==="bayer4"?4:t==="bayer8"?8:0,steps:Math.min(16,Math.
|
|
1238
1238
|
max(2,Math.round(e.levels)||2))-1,s:Math.min(32,Math.max(1,Math.round(e.pixel??1)||1)),mono:e.mono,dark:(e.dark??[0,0,0,255]).map(Qa),light:(e.light??[255,255,255,255]).map(Qa),alpha:e.alpha??!0}}function ja(e,t){
|
|
1239
|
-
let n=
|
|
1239
|
+
let n=kp(t),r=mt();return r&&n.kind===0?r.dither(e,n):Xt()?hp(e,n):Ep(e,n)}function Ep(e,t){let{width:n,height:r,data:i}=e,s=Yt(e),{s:l,steps:u,mono:h}=t,f=Math.ceil(n/l),A=Math.ceil(r/l),d=f*A,y=h?1:
|
|
1240
1240
|
3,g=y+(t.alpha?1:0),x=new Uint8Array(d),v=new Int32Array(d*g),b=new Uint8Array(d*g);for(let S=0;S<A;S++){let T=S*l,P=Math.min(r,T+l);for(let E=0;E<f;E++){let _=E*l,Q=Math.min(n,_+l),Y=0,F=0,$=0,W=0;for(let ve=T;ve<
|
|
1241
1241
|
P;ve++)for(let ne=_;ne<Q;ne++){let ge=(ve*n+ne)*4;Y+=i[ge],F+=i[ge+1],$+=i[ge+2],W+=i[ge+3]}let G=(P-T)*(Q-_),oe=S*f+E,ce=Math.floor((2*W+G)/(2*G));if(x[oe]=ce,ce===0)continue;let he=Math.min(255,Math.
|
|
1242
1242
|
floor((Y*510+W)/(2*W))),se=Math.min(255,Math.floor((F*510+W)/(2*W))),Ae=Math.min(255,Math.floor(($*510+W)/(2*W)));h?v[oe*g]=Math.floor((2126*he+7152*se+722*Ae+5e3)/1e4):(v[oe*g]=he,v[oe*g+1]=se,v[oe*g+
|
|
1243
|
-
2]=Ae),t.alpha&&(v[oe*g+y]=ce)}}if(t.kind===0){let S=t.order,T=S*S,P=
|
|
1243
|
+
2]=Ae),t.alpha&&(v[oe*g+y]=ce)}}if(t.kind===0){let S=t.order,T=S*S,P=np(S);for(let E=0;E<A;E++)for(let _=0;_<f;_++){let Q=E*f+_;if(x[Q]===0)continue;let Y=(2*P[E%S*S+_%S]+1)*255;for(let F=0;F<g;F++){let $=Math.
|
|
1244
1244
|
floor((v[Q*g+F]*u*2*T+Y)/(510*T));b[Q*g+F]=Math.min(u,$)}}}else{for(let P=0;P<v.length;P++)v[P]=v[P]<<4;let S=t.kind===2,T=(P,E,_,Q)=>{if(P<0||P>=f||E>=A)return;let Y=(E*f+P)*g+_;v[Y]=v[Y]+Q};for(let P=0;P<
|
|
1245
1245
|
A;P++){let E=P&1?-1:1;for(let _=0;_<f;_++){let Q=E===1?_:f-1-_,Y=P*f+Q;if(x[Y]!==0)for(let F=0;F<g;F++){let $=Math.min(4080,Math.max(0,v[Y*g+F])),W=Math.floor(($*u*2+4080)/8160);b[Y*g+F]=W;let G=$-(Math.
|
|
1246
1246
|
floor((W*510+u)/(2*u))<<4);if(G!==0)if(S){let oe=G>>3;T(Q+E,P,F,oe),T(Q+2*E,P,F,oe),T(Q-E,P+1,F,oe),T(Q,P+1,F,oe),T(Q+E,P+1,F,oe),T(Q,P+2,F,oe)}else T(Q+E,P,F,G*7>>4),T(Q-E,P+1,F,G*3>>4),T(Q,P+1,F,G*5>>
|
|
@@ -1249,28 +1249,28 @@ if(Y===0)continue;let F,$,W,G;if(h){let he=b[_*g],se=(Ae,ve)=>Math.floor(((Ae*(u
|
|
|
1249
1249
|
C[1],M[1])*G+127)/255),W=Math.floor((se(C[2],M[2])*G+127)/255)}else G=Y,F=Math.floor((Q(b[_*g])*Y+127)/255),$=Math.floor((Q(b[_*g+1])*Y+127)/255),W=Math.floor((Q(b[_*g+2])*Y+127)/255);let oe=E*l,ce=Math.
|
|
1250
1250
|
min(n,oe+l);for(let he=T;he<P;he++)for(let se=oe;se<ce;se++){let Ae=(he*n+se)*4;s.data[Ae]=F,s.data[Ae+1]=$,s.data[Ae+2]=W,s.data[Ae+3]=G}}}return s}function Va(e,t){let{width:n,height:r}=e,i=[];for(let u of t){
|
|
1251
1251
|
let h=Math.max(0,Math.round(u.y0)),f=Math.min(r,Math.round(u.y1)),A=Math.round(u.dx),d=Math.round(u.channelDx),y=Math.round(u.dy??0);A===0&&d===0&&y===0||f<=h||i.push([h,f,A,d,y])}let s=mt();if(s)return s.
|
|
1252
|
-
glitch(e,Int32Array.from(i.flat()));if(Xt())return
|
|
1253
|
-
n*4,M=((b-d)%r+r)%r*n*4,S=y,T=g;for(let P=0;P<n;P++){let E=C+P*4,_=M+S*4;v[E]=x[M+T*4],v[E+1]=x[_+1],v[E+2]=x[_+2],v[E+3]=x[_+3],++S===n&&(S=0),++T===n&&(T=0)}}}return l}function
|
|
1252
|
+
glitch(e,Int32Array.from(i.flat()));if(Xt())return ip(e,Int32Array.from(i.flat()));let l=jt(e);for(let[u,h,f,A,d]of i){let y=((0-f)%n+n)%n,g=((0-f-A)%n+n)%n,x=e.data,v=l.data;for(let b=u;b<h;b++){let C=b*
|
|
1253
|
+
n*4,M=((b-d)%r+r)%r*n*4,S=y,T=g;for(let P=0;P<n;P++){let E=C+P*4,_=M+S*4;v[E]=x[M+T*4],v[E+1]=x[_+1],v[E+2]=x[_+2],v[E+3]=x[_+3],++S===n&&(S=0),++T===n&&(T=0)}}}return l}function Sp(e,t,n,r){for(let i=0;i<
|
|
1254
1254
|
e.length;i+=4){let s=Math.max(e[i],e[i+1],e[i+2]);if(s<=n)continue;let l=(s-n)/(255-n||1)*r;t[i]=Math.round(e[i]*l),t[i+1]=Math.round(e[i+1]*l),t[i+2]=Math.round(e[i+2]*l),t[i+3]=Math.round(e[i+3]*l)}}
|
|
1255
|
-
function Ja(e,t){let n=Math.max(0,t.strength);if(n===0||t.radius<=0)return jt(e);let{width:r,height:i,data:s}=e,l=Math.min(1,Math.max(0,t.threshold))*255,u=mt();if(u)return u.bloom(e,l,n,
|
|
1256
|
-
if(Xt())return
|
|
1255
|
+
function Ja(e,t){let n=Math.max(0,t.strength);if(n===0||t.radius<=0)return jt(e);let{width:r,height:i,data:s}=e,l=Math.min(1,Math.max(0,t.threshold))*255,u=mt();if(u)return u.bloom(e,l,n,Xi(t.radius));
|
|
1256
|
+
if(Xt())return op(e,l,n,Xi(t.radius));let h=Gi(r,i);Sp(s,h.data,l,n);let f=qi(h,t.radius).data,A=Yt(e);return Bp(s,f,A.data),A}function Bp(e,t,n){for(let r=0;r<n.length;r++)n[r]=e[r]+t[r]}function Pp(e,t){
|
|
1257
1257
|
return t==="ease"?e*e*(3-2*e):t==="expo"?e*e:e}function Za(e,t){let n=mt();if(n)return n.fade(e,t);let{width:r,height:i,data:s}=e,l=Yt(e),u=Math.min(1,Math.max(0,t.start)),f=Math.max(u,Math.min(1,t.end))-
|
|
1258
|
-
u,A=Math.min(1,Math.max(0,t.strength??1)),d=g=>{let x=f<=0?g<u?0:1:Math.min(1,Math.max(0,(g-u)/f)),v=1-
|
|
1258
|
+
u,A=Math.min(1,Math.max(0,t.strength??1)),d=g=>{let x=f<=0?g<u?0:1:Math.min(1,Math.max(0,(g-u)/f)),v=1-Pp(x,t.curve),b=t.invert?1-v:v;return A===1?b:1-A*(1-b)},y=(g,x)=>{l.data[g]=Math.round(s[g]*x),l.
|
|
1259
1259
|
data[g+1]=Math.round(s[g+1]*x),l.data[g+2]=Math.round(s[g+2]*x),l.data[g+3]=Math.round(s[g+3]*x)};if(t.shape==="radial"){let g=t.cx*r,x=t.cy*i,v=Math.max(Math.hypot(g,x),Math.hypot(r-g,x),Math.hypot(g,
|
|
1260
1260
|
i-x),Math.hypot(r-g,i-x),1e-6);for(let b=0;b<i;b++){let C=b+.5-x;for(let M=0;M<r;M++)y((b*r+M)*4,d(Math.hypot(M+.5-g,C)/v))}}else{let g=t.angle*Math.PI/180,x=Math.cos(g),v=Math.sin(g),b=[0,r*x,i*v,r*x+
|
|
1261
1261
|
i*v],C=Math.min(...b),M=Math.max(...b),S=Math.max(M-C,1e-6),T=new Float64Array(r);for(let P=0;P<r;P++)T[P]=(P+.5)*x;for(let P=0;P<i;P++){let E=(P+.5)*v;for(let _=0;_<r;_++)y((P*r+_)*4,d((T[_]+E-C)/S))}}
|
|
1262
1262
|
return l}var Oo=["normal","add","multiply","screen"];function Do(e,t){return e.at?{x:Math.round(e.at.x),y:Math.round(e.at.y)}:t==="center"?{x:-Math.floor(e.width/2),y:-Math.floor(e.height/2)}:{x:0,y:0}}
|
|
1263
|
-
var Na=new Uint8ClampedArray(4);function
|
|
1263
|
+
var Na=new Uint8ClampedArray(4);function _p(e,t,n,r,i,s,l,u){let h=n[r+3]/255*u,f=e[t+3]/255;if(l===0){let d=1-h;i[s]=Math.round(Math.min(1,n[r]/255*u+e[t]/255*d)*255),i[s+1]=Math.round(Math.min(1,n[r+
|
|
1264
1264
|
1]/255*u+e[t+1]/255*d)*255),i[s+2]=Math.round(Math.min(1,n[r+2]/255*u+e[t+2]/255*d)*255)}else if(l===1)i[s]=Math.round(Math.min(1,n[r]/255*u+e[t]/255)*255),i[s+1]=Math.round(Math.min(1,n[r+1]/255*u+e[t+
|
|
1265
1265
|
1]/255)*255),i[s+2]=Math.round(Math.min(1,n[r+2]/255*u+e[t+2]/255)*255);else if(l===2)for(let d=0;d<3;d++){let y=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,y*g+y*(1-f)+g*(1-h))*255)}else for(let d=0;d<
|
|
1266
|
-
3;d++){let y=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,y+g-y*g)*255)}let A=l===1?Math.min(1,h+f):h+f*(1-h);i[s+3]=Math.round(Math.min(1,A)*255)}function
|
|
1266
|
+
3;d++){let y=n[r+d]/255*u,g=e[t+d]/255;i[s+d]=Math.round(Math.min(1,y+g-y*g)*255)}let A=l===1?Math.min(1,h+f):h+f*(1-h);i[s+3]=Math.round(Math.min(1,A)*255)}function Mp(e,t,n,r,i,s,l){let u=1-l;i[s]=Math.
|
|
1267
1267
|
round(e[t]*u+n[r]*l),i[s+1]=Math.round(e[t+1]*u+n[r+1]*l),i[s+2]=Math.round(e[t+2]*u+n[r+2]*l),i[s+3]=Math.round(e[t+3]*u+n[r+3]*l)}function Ka(e,t,n,r,i="top-left"){let s=Math.min(1,Math.max(0,r)),l=Oo.
|
|
1268
|
-
indexOf(n),u=mt();return u?u.combine(e,t,i,{mode:l,k:s}):tl(e,t,i,(h,f,A,d,y,g)=>
|
|
1269
|
-
k:i}):tl(e,t,r,(l,u,h,f,A,d)=>
|
|
1268
|
+
indexOf(n),u=mt();return u?u.combine(e,t,i,{mode:l,k:s}):tl(e,t,i,(h,f,A,d,y,g)=>_p(h,f,A,d,y,g,l,s))}function el(e,t,n,r="top-left"){let i=Math.min(1,Math.max(0,n)),s=mt();return s?s.combine(e,t,r,{mode:4,
|
|
1269
|
+
k:i}):tl(e,t,r,(l,u,h,f,A,d)=>Mp(l,u,h,f,A,d,i))}function tl(e,t,n,r){let i=Do(e,n),s=Do(t,n);if(e.width===t.width&&e.height===t.height&&i.x===s.x&&i.y===s.y){let v=Yt(e);for(let b=0;b<e.data.length;b+=
|
|
1270
1270
|
4)r(e.data,b,t.data,b,v.data,b);return v}let l=Math.min(i.x,s.x),u=Math.min(i.y,s.y),h=Math.max(i.x+e.width,s.x+t.width),f=Math.max(i.y+e.height,s.y+t.height),A=h-l,d=f-u,y=A===e.width&&d===e.height&&
|
|
1271
|
-
l===i.x&&u===i.y?Yt(e):{...
|
|
1271
|
+
l===i.x&&u===i.y?Yt(e):{...Gi(A,d),at:{x:l,y:u}},g=e.data,x=t.data;for(let v=0;v<d;v++){let b=v+u-i.y,C=v+u-s.y,M=b>=0&&b<e.height,S=C>=0&&C<t.height;for(let T=0;T<A;T++){let P=T+l-i.x,E=T+l-s.x,_=M&&
|
|
1272
1272
|
P>=0&&P<e.width,Q=S&&E>=0&&E<t.width;!_&&!Q||r(_?g:Na,_?(b*e.width+P)*4:0,Q?x:Na,Q?(C*t.width+E)*4:0,y.data,(v*A+T)*4)}}return y}function nl(e,t,n,r="top-left"){let i=Do(e,r),s=Do(t,r),l=s.x-i.x,u=s.y-
|
|
1273
|
-
i.y,h=n.mode==="luma",f=n.invert===!0,A=mt();if(A)return A.matte(e,t,l,u,h,f);if(Xt())return
|
|
1273
|
+
i.y,h=n.mode==="luma",f=n.invert===!0,A=mt();if(A)return A.matte(e,t,l,u,h,f);if(Xt())return cp(e,t,l,u,h,f);let{width:d,height:y,data:g}=e,x=t.data,v=Yt(e),b=v.data;for(let C=0;C<y;C++){let M=C-u,S=M>=
|
|
1274
1274
|
0&&M<t.height;for(let T=0;T<d;T++){let P=T-l,E=0;if(S&&P>=0&&P<t.width){let Q=(M*t.width+P)*4;E=h?Math.floor((2126*x[Q]+7152*x[Q+1]+722*x[Q+2]+5e3)/1e4):x[Q+3]}if(f&&(E=255-E),E===0)continue;let _=(C*
|
|
1275
1275
|
d+T)*4;E===255?(b[_]=g[_],b[_+1]=g[_+1],b[_+2]=g[_+2],b[_+3]=g[_+3]):(b[_]=Math.floor((g[_]*E+127)/255),b[_+1]=Math.floor((g[_+1]*E+127)/255),b[_+2]=Math.floor((g[_+2]*E+127)/255),b[_+3]=Math.floor((g[_+
|
|
1276
1276
|
3]*E+127)/255))}}return v}var ot=`#version 300 es
|
|
@@ -1289,7 +1289,7 @@ vec3 rnd3(vec3 v) { return floor(v + 0.5); }
|
|
|
1289
1289
|
vec4 B(ivec2 p) { return floor(texelFetch(u_src, p, 0) * 255.0 + 0.5); }
|
|
1290
1290
|
// A true modulo for a possibly negative a: GLSL's % is undefined there.
|
|
1291
1291
|
int imod(int a, int n) { return a - n * int(floor(float(a) / float(n))); }
|
|
1292
|
-
`,
|
|
1292
|
+
`,Dg={copy:`${ot}
|
|
1293
1293
|
void main() { o = S(P()); }`,blit:`${ot}
|
|
1294
1294
|
uniform int u_h;
|
|
1295
1295
|
void main() { ivec2 p = P(); o = S(ivec2(p.x, u_h - 1 - p.y)); }`,boxH:`${ot}
|
|
@@ -1533,8 +1533,8 @@ void main() {
|
|
|
1533
1533
|
else { vec3 sc = s.rgb * u_k; c = min(sc + d.rgb - sc * d.rgb, 1.0); }
|
|
1534
1534
|
float a = u_mode == 1 ? min(sa + da, 1.0) : sa + da * (1.0 - sa);
|
|
1535
1535
|
o = vec4(c, min(a, 1.0));
|
|
1536
|
-
}`},
|
|
1537
|
-
u-h}return{i0:n,i1:r,f:i}}function rl(e,t,n){let r=Math.max(1,Math.round(t)),i=Math.max(1,Math.round(n));if(r===e.width&&i===e.height)return jt(e);let s=mt();if(s)return s.resample(e,r,i);if(Xt())return
|
|
1536
|
+
}`},Og=64*1024*1024;function Da(e,t){let n=new Int32Array(e),r=new Int32Array(e),i=new Float64Array(e),s=t/e;for(let l=0;l<e;l++){let u=(l+.5)*s-.5;u<0&&(u=0),u>t-1&&(u=t-1);let h=Math.floor(u);n[l]=h,r[l]=h+1<t?h+1:h,i[l]=
|
|
1537
|
+
u-h}return{i0:n,i1:r,f:i}}function rl(e,t,n){let r=Math.max(1,Math.round(t)),i=Math.max(1,Math.round(n));if(r===e.width&&i===e.height)return jt(e);let s=mt();if(s)return s.resample(e,r,i);if(Xt())return Ap(
|
|
1538
1538
|
e,r,i);let{width:l,height:u,data:h}=e,f=new Uint8ClampedArray(r*i*4),A=Da(r,l),d=Da(i,u);for(let g=0;g<i;g++){let x=d.i0[g]*l,v=d.i1[g]*l,b=d.f[g];for(let C=0;C<r;C++){let M=A.i0[C],S=A.i1[C],T=A.f[C],
|
|
1539
1539
|
P=(x+M)*4,E=(x+S)*4,_=(v+M)*4,Q=(v+S)*4,Y=(g*r+C)*4;for(let F=0;F<4;F++){let $=h[P+F]*(1-T)+h[E+F]*T,W=h[_+F]*(1-T)+h[Q+F]*T;f[Y+F]=Math.round($*(1-b)+W*b)}}}let y={width:r,height:i,data:f};return e.at&&
|
|
1540
1540
|
(y.at=e.at),y}var an=(e,t)=>Math.floor((2*e+t)/(2*t));function ol(e,t){let n=t.sub??1,r=typeof n=="number"?{x:Math.max(1,Math.floor(n)),y:Math.max(1,Math.floor(n))}:{x:Math.max(1,Math.floor(n.x)),y:Math.
|
|
@@ -1544,24 +1544,24 @@ h,Math.floor(t.x0+(b+1)*d))),S=0,T=0,P=0,E=0,_=0;for(let Y=x;Y<v&&Y<f;Y++){let F
|
|
|
1544
1544
|
T+722*P,1e4*_),u[Q*4]=an(S,_),u[Q*4+1]=an(T,_),u[Q*4+2]=an(P,_),u[Q*4+3]=an(E,_))}}return{cols:t.cols,rows:t.rows,sub:r,luma:l,rgba:u}}function il(e,t,n,r,i){let{width:s,height:l,data:u}=e,h=Math.max(
|
|
1545
1545
|
0,Math.floor(t)),f=Math.max(0,Math.floor(n)),A=Math.min(s,Math.ceil(r)),d=Math.min(l,Math.ceil(i)),y=0,g=0,x=0,v=0,b=0;for(let C=f;C<d;C++){let M=(C*s+h)*4;for(let S=h;S<A;S++,M+=4)y+=u[M],g+=u[M+1],x+=
|
|
1546
1546
|
u[M+2],v+=u[M+3],b++}return b===0?{luma:0,rgba:[0,0,0,0],count:0}:{luma:an(2126*y+7152*g+722*x,1e4*b),rgba:[an(y,b),an(g,b),an(x,b),an(v,b)],count:b}}var Oa=2048;function Pn(e,t,n){let r=Math.imul(e|0,
|
|
1547
|
-
668265261)^Math.imul(t|0,374761393)^Math.imul(n|0,2654435761);return r^=r>>>15,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,(r>>>0)/4294967296}var
|
|
1548
|
-
if(r<=0)return Pn(e,t,n);let s=2-Pn(e,t,n+40503),l,u;if(r<s)l=0,u=r/s;else{let A=r-s,d=Math.floor(A);l=d+1,u=A-d}let h=Pn(e,t,n+l*7),f=Pn(e,t,n+(l+1)*7);return h+(f-h)*
|
|
1549
|
-
sin(.9),
|
|
1550
|
-
3;g++){let x=g===0?0:g===1?A:1,v=g===0?0:g===1?d:1,b=h-x+(x+v)*
|
|
1551
|
-
-E:E)*r}M*=M,y+=M*M*(Math.cos(P)*b+Math.sin(P)*C)}return Math.min(1,Math.max(0,.5+.5*
|
|
1552
|
-
(h*Fa-f*Ya)+17.3;f=2*(h*Ya+f*Fa)+41.9,h=d}return u>0?s/u:0}function
|
|
1553
|
-
y=A+La(f,A,n+7919,r),g=(d-e)*(d-e)+(y-t)*(y-t);g<l&&(l=g)}return Math.min(1,Math.sqrt(l))}function
|
|
1554
|
-
mode==="blocks"?Pn(Math.floor(i),Math.floor(s),l+Math.floor(u)*7):e.mode==="cells"?
|
|
1555
|
-
function
|
|
1547
|
+
668265261)^Math.imul(t|0,374761393)^Math.imul(n|0,2654435761);return r^=r>>>15,r=Math.imul(r,2246822507),r^=r>>>13,r=Math.imul(r,3266489909),r^=r>>>16,(r>>>0)/4294967296}var Tp=e=>e*e*(3-2*e);function La(e,t,n,r){
|
|
1548
|
+
if(r<=0)return Pn(e,t,n);let s=2-Pn(e,t,n+40503),l,u;if(r<s)l=0,u=r/s;else{let A=r-s,d=Math.floor(A);l=d+1,u=A-d}let h=Pn(e,t,n+l*7),f=Pn(e,t,n+(l+1)*7);return h+(f-h)*Tp(u)}var Fa=Math.cos(.9),Ya=Math.
|
|
1549
|
+
sin(.9),Rp=(Math.sqrt(3)-1)/2,Yi=(3-Math.sqrt(3))/6,Qo=.4,Qp=99;function sl(e,t,n,r=0){let i=(e+t)*Rp,s=Math.floor(e+i),l=Math.floor(t+i),u=(s+l)*Yi,h=e-(s-u),f=t-(l-u),A=h>f?1:0,d=1-A,y=0;for(let g=0;g<
|
|
1550
|
+
3;g++){let x=g===0?0:g===1?A:1,v=g===0?0:g===1?d:1,b=h-x+(x+v)*Yi,C=f-v+(x+v)*Yi,M=.5-b*b-C*C;if(M<=0)continue;let S=s+x,T=l+v,P=Pn(S,T,n)*Math.PI*2;if(r>0){let E=.5+Pn(S,T,n+911);P+=(Pn(S,T,n+1777)<.5?
|
|
1551
|
+
-E:E)*r}M*=M,y+=M*M*(Math.cos(P)*b+Math.sin(P)*C)}return Math.min(1,Math.max(0,.5+.5*Qp*y))}function Np(e,t,n,r,i=0){let s=0,l=1,u=0,h=e,f=t;for(let A=0;A<r;A++){s+=sl(h,f,n+A*131,i)*l,u+=l,l*=.5;let d=2*
|
|
1552
|
+
(h*Fa-f*Ya)+17.3;f=2*(h*Ya+f*Fa)+41.9,h=d}return u>0?s/u:0}function Dp(e,t,n,r=0){let i=Math.floor(e),s=Math.floor(t),l=1/0;for(let u=-1;u<=1;u++)for(let h=-1;h<=1;h++){let f=i+h,A=s+u,d=f+La(f,A,n,r),
|
|
1553
|
+
y=A+La(f,A,n+7919,r),g=(d-e)*(d-e)+(y-t)*(y-t);g<l&&(l=g)}return Math.min(1,Math.sqrt(l))}function Op(e,t,n){let r=Math.max(1e-6,e.scale),i=t/r,s=n/r,l=Math.floor(e.seed),u=Math.max(0,e.time);return e.
|
|
1554
|
+
mode==="blocks"?Pn(Math.floor(i),Math.floor(s),l+Math.floor(u)*7):e.mode==="cells"?Dp(i,s,l,u):e.mode==="fbm"?Np(i*Qo,s*Qo,l,Math.max(1,Math.min(8,Math.round(e.octaves))),u):sl(i*Qo,s*Qo,l,u)}var No=1024;
|
|
1555
|
+
function Lp(e,t){let n=new Uint8ClampedArray(No*4),r=Mo(e,t),i=r.map(s=>{let l=ar(s.color);return[parseInt(l.rgb.slice(1,3),16),parseInt(l.rgb.slice(3,5),16),parseInt(l.rgb.slice(5,7),16),l.a]});for(let s=0;s<
|
|
1556
1556
|
No;s++){let l=s/(No-1),u,h,f,A;if(l<=r[0].at)[u,h,f,A]=i[0];else if(l>=r[r.length-1].at)[u,h,f,A]=i[i.length-1];else{let d=1;for(;d<r.length-1&&r[d].at<l;)d++;let y=r[d-1],g=r[d],x=g.at===y.at?1:(l-y.
|
|
1557
1557
|
at)/(g.at-y.at),v=i[d-1],b=i[d];u=v[0]+(b[0]-v[0])*x,h=v[1]+(b[1]-v[1])*x,f=v[2]+(b[2]-v[2])*x,A=v[3]+(b[3]-v[3])*x}n[s*4]=Math.round(u*A),n[s*4+1]=Math.round(h*A),n[s*4+2]=Math.round(f*A),n[s*4+3]=Math.
|
|
1558
|
-
round(A*255)}return n}function
|
|
1558
|
+
round(A*255)}return n}function Fp(e,t){if(t==="repeat")return e-Math.floor(e);if(t==="reflect"){let n=e-2*Math.floor(e/2);return n<=1?n:2-n}return Math.min(1,Math.max(0,e))}var jr=new Map,Yp=64;function al(e,t){
|
|
1559
1559
|
let n=JSON.stringify([e,t.x,t.y,t.w,t.h]),r=jr.get(n);if(r)return r;let i=Bn(e.stops),s=e.kind==="noise"&&e.mode==="blocks",l=s?Math.max(1e-6,e.scale):1,u=s?l:1/Math.min(1,Math.max(1/64,e.kind==="nois\
|
|
1560
1560
|
e"?e.detail??1:1));u=Math.max(u,Math.ceil(t.w)/Oa,Math.ceil(t.h)/Oa);let h=s?Math.floor(t.x/u)*u:t.x,f=s?Math.floor(t.y/u)*u:t.y,A=Math.max(1,Math.ceil((t.x+t.w-h)/u-1e-9)),d=Math.max(1,Math.ceil((t.y+
|
|
1561
1561
|
t.h-f)/u-1e-9)),y=!s&&u>1?1:0,g=s?u:t.w/A,x=s?u:t.h/d;h-=y*g,f-=y*x;let v=A+2*y,b=d+2*y,C=new Uint8ClampedArray(v*b*4),S={texture:{width:v,height:b,data:C},x:h-t.x,y:f-t.y,w:v*g,h:b*x,nearest:s};if(i.
|
|
1562
|
-
length>=2){let T=
|
|
1563
|
-
(F+.5)*g,W;e.kind==="conic"?(W=(Math.atan2(Y-E,$-P)*180/Math.PI-_)/360,W-=Math.floor(W)):W=
|
|
1564
|
-
3]=T[G+3]}}}return jr.size>=
|
|
1562
|
+
length>=2){let T=Lp(i,e.stepped),P=t.x+(e.kind==="conic"?e.cx:0)*t.w,E=t.y+(e.kind==="conic"?e.cy:0)*t.h,_=e.kind==="conic"?e.angle:0;for(let Q=0;Q<b;Q++){let Y=f+(Q+.5)*x;for(let F=0;F<v;F++){let $=h+
|
|
1563
|
+
(F+.5)*g,W;e.kind==="conic"?(W=(Math.atan2(Y-E,$-P)*180/Math.PI-_)/360,W-=Math.floor(W)):W=Op(e,$,Y);let G=Math.round(Fp(W,e.spread)*(No-1))*4,oe=(Q*v+F)*4;C[oe]=T[G],C[oe+1]=T[G+1],C[oe+2]=T[G+2],C[oe+
|
|
1564
|
+
3]=T[G+3]}}}return jr.size>=Yp&&jr.delete(jr.keys().next().value),jr.set(n,S),S}var Zl=Xr(Vr(),1);var vn=Xr(Vr(),1),Rt=Xr(ll(),1);var ru=Xr(Vr(),1);var Jr=[{family:"IBM Plex Mono",weight:400,style:"normal",file:"ibm-plex-mono-400"},{family:"IBM Plex Mono",weight:600,style:"normal",file:"ibm-plex-mono-600"},{family:"IBM Plex Mono",weight:700,style:"\
|
|
1565
1565
|
normal",file:"ibm-plex-mono-700"},{family:"JetBrains Mono",weight:400,style:"normal",file:"jetbrains-mono-400"},{family:"JetBrains Mono",weight:700,style:"normal",file:"jetbrains-mono-700"},{family:"R\
|
|
1566
1566
|
ajdhani",weight:400,style:"normal",file:"rajdhani-400"},{family:"Rajdhani",weight:600,style:"normal",file:"rajdhani-600"},{family:"Rajdhani",weight:700,style:"normal",file:"rajdhani-700"},{family:"Int\
|
|
1567
1567
|
er",weight:400,style:"normal",file:"inter-400"},{family:"Inter",weight:600,style:"normal",file:"inter-600"},{family:"Inter",weight:700,style:"normal",file:"inter-700"},{family:"Inter",weight:900,style:"\
|
|
@@ -1571,21 +1571,21 @@ normal",file:"silkscreen-400",pixelSize:8},{family:"Silkscreen",weight:700,style
|
|
|
1571
1571
|
pixelSize:8},{family:"Symbols Nerd Font Mono",weight:400,style:"normal",file:"symbols-nerd-font-mono-400",lazy:!0},{family:"Noto Sans Symbols 2",weight:400,style:"normal",file:"noto-sans-symbols-2-400",
|
|
1572
1572
|
lazy:!0},{family:"Fixed 4x6",weight:400,style:"normal",file:"fixed-4x6",pixelSize:6,bitmap:!0,lazy:!0},{family:"Fixed 5x7",weight:400,style:"normal",file:"fixed-5x7",pixelSize:7,bitmap:!0,lazy:!0},{family:"\
|
|
1573
1573
|
Fixed 5x8",weight:400,style:"normal",file:"fixed-5x8",pixelSize:8,bitmap:!0,lazy:!0},{family:"Fixed 6x10",weight:400,style:"normal",file:"fixed-6x10",pixelSize:10,bitmap:!0,lazy:!0},{family:"Fixed 6x1\
|
|
1574
|
-
3",weight:700,style:"normal",file:"fixed-6x13-bold",pixelSize:13,bitmap:!0,lazy:!0}],_n="IBM Plex Mono",Mn=[...new Set(Jr.map(e=>e.family))];function ul(e){return Mn.includes(e)}var
|
|
1575
|
-
function fl(e){return ul(e)||hl(e)}function gt(e){return e&&fl(e)?{family:e,wasSubstituted:!1}:{family:_n,wasSubstituted:!!e}}function Zr(e){return e.axes?.find(t=>t.tag==="wght")}function
|
|
1576
|
-
return Tn().find(t=>t.family===e&&(t.axes?.length??0)>0)}function yn(e){let t=Kr(e),n=t&&Zr(t);return n?{min:n.min,max:n.max}:void 0}function
|
|
1577
|
-
void 0}function gn(e){return Tn().find(t=>t.family===e&&t.pixelSize!==void 0)?.pixelSize}function eo(e){return Tn().some(t=>t.family===e&&t.bitmap)}function ln(e,t){let n=
|
|
1574
|
+
3",weight:700,style:"normal",file:"fixed-6x13-bold",pixelSize:13,bitmap:!0,lazy:!0}],_n="IBM Plex Mono",Mn=[...new Set(Jr.map(e=>e.family))];function ul(e){return Mn.includes(e)}var $i=[];function cl(){return $i.map(e=>e.face)}function Tn(){return $i.length===0?Jr:[...Jr,...cl()]}function lr(){return[...new Set(Tn().map(e=>e.family))]}function hl(e){return $i.some(t=>t.face.family===e)}
|
|
1575
|
+
function fl(e){return ul(e)||hl(e)}function gt(e){return e&&fl(e)?{family:e,wasSubstituted:!1}:{family:_n,wasSubstituted:!!e}}function Zr(e){return e.axes?.find(t=>t.tag==="wght")}function zi(e){return e.axes?.find(t=>t.tag==="wdth")}function Kr(e){
|
|
1576
|
+
return Tn().find(t=>t.family===e&&(t.axes?.length??0)>0)}function yn(e){let t=Kr(e),n=t&&Zr(t);return n?{min:n.min,max:n.max}:void 0}function ur(e){let t=Kr(e),n=t&&zi(t);return n?{min:n.min,max:n.max}:
|
|
1577
|
+
void 0}function gn(e){return Tn().find(t=>t.family===e&&t.pixelSize!==void 0)?.pixelSize}function eo(e){return Tn().some(t=>t.family===e&&t.bitmap)}function ln(e,t){let n=ur(e);return n?Math.round(Math.min(n.max,Math.max(n.min,t))):100}var pl=[100,200,300,400,500,600,700,800,900];function Tt(e,t){let n=Kr(e),r=n&&Zr(n);if(r)return Math.round(Math.
|
|
1578
1578
|
min(r.max,Math.max(r.min,t)));let i=Tn().filter(s=>s.family===e).map(s=>s.weight);return i.length===0?400:i.reduce((s,l)=>Math.abs(l-t)<Math.abs(s-t)?l:s)}function Rn(e){let t=Kr(e),n=t&&Zr(t);return n?
|
|
1579
|
-
pl.filter(r=>r>=n.min&&r<=n.max):[...new Set(Tn().filter(r=>r.family===e).map(r=>r.weight))]}function
|
|
1580
|
-
return Zr(s)&&(u.wght=i)
|
|
1579
|
+
pl.filter(r=>r>=n.min&&r<=n.max):[...new Set(Tn().filter(r=>r.family===e).map(r=>r.weight))]}function ji(e,t,n=100){let r=gt(e).family,i=Tt(r,t),s=Kr(r);if(s){let u={};for(let h of s.axes)u[h.tag]=h.default;
|
|
1580
|
+
return Zr(s)&&(u.wght=i),zi(s)&&(u.wdth=ln(r,n)),{face:s,variation:u}}return{face:Tn().find(u=>u.family===r&&u.weight===i)??Jr[0]}}var mu=Xr(Vr(),1);var Xp=-90,dr=e=>e+Xp,co="0 = 12 o\u2019clock, 90 = 3 o\u2019clock, clockwise round the dial.",Wp=["auto","corner","top","top-right","left","center","right","bottom-left","bottom","bottom-right"],Vi={
|
|
1581
1581
|
corner:{fx:0,fy:0},top:{fx:.5,fy:0},"top-right":{fx:1,fy:0},left:{fx:0,fy:.5},center:{fx:.5,fy:.5},right:{fx:1,fy:.5},"bottom-left":{fx:0,fy:1},bottom:{fx:.5,fy:1},"bottom-right":{fx:1,fy:1}},Dn={key:"\
|
|
1582
1582
|
anchor",label:"Anchor",type:"enum",default:"auto",widget:"anchor",options:[{value:"auto",label:"Auto (canvas)"},{value:"corner",label:"Top Left"},{value:"top",label:"Top"},{value:"top-right",label:"To\
|
|
1583
1583
|
p Right"},{value:"left",label:"Left"},{value:"center",label:"Centre"},{value:"right",label:"Right"},{value:"bottom-left",label:"Bottom Left"},{value:"bottom",label:"Bottom"},{value:"bottom-right",label:"\
|
|
1584
1584
|
Bottom Right"}],description:"The point of the frame that X/Y places: a corner, an edge midpoint or the centre. Auto follows the canvas origin: centre-origin documents build centre-out, top-left docume\
|
|
1585
|
-
nts from the top-left corner."},
|
|
1585
|
+
nts from the top-left corner."},Gp=["auto","corner","center","end"],fs={key:"anchor",label:"Anchor",type:"enum",default:"auto",options:[{value:"auto",label:"Auto (canvas)"},{value:"corner",label:"Star\
|
|
1586
1586
|
t"},{value:"center",label:"Centre"},{value:"end",label:"End"}],description:"Where along its length the row hangs from X/Y. Auto follows the canvas origin: centre-origin documents spread from the middl\
|
|
1587
|
-
e."};function
|
|
1588
|
-
function ps(e,t,n="anchor"){let r=e.enumOf(n,
|
|
1587
|
+
e."};function qp(e,t="anchor"){let n=e.enumOf(t,Wp);return n==="auto"?e.canvas.origin==="center"?Vi.center:Vi.corner:Vi[n]}function On(e,t,n,r="anchor"){let{fx:i,fy:s}=qp(e,r);return{dx:-t*i,dy:-n*s}}
|
|
1588
|
+
function ps(e,t,n="anchor"){let r=e.enumOf(n,Gp),i=r==="center"||r==="auto"&&e.canvas.origin==="center";return r==="end"?t:i?t/2:0}var Up={type:"rect",label:"Rect",category:"generator",translate:[{x:"\
|
|
1589
1589
|
x",y:"y"}],description:"A rectangle, optionally with rounded corners.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"\
|
|
1590
1590
|
Y",type:"number",default:0,step:.5,unit:"px"},{key:"w",label:"Width",type:"number",default:120,step:.5,unit:"px"},{key:"h",label:"Height",type:"number",default:120,step:.5,unit:"px"},{key:"corner",label:"\
|
|
1591
1591
|
Corner",type:"enum",default:"round",options:[{value:"round",label:"Round"},{value:"chamfer",label:"Chamfer"}],description:"What Corner Size does: rounds, or cuts at 45\xB0 \u2014 THE HUD corner."},{key:"\
|
|
@@ -1594,42 +1594,42 @@ key:"chBR",label:"BR",type:"bool",default:!0,group:"Corners"},{key:"chBL",label:
|
|
|
1594
1594
|
{value:"center",label:"Center"},{value:"inside",label:"Inside"},{value:"outside",label:"Outside"}],group:"Style",description:"Where the stroke sits on the outline: inside keeps the drawn size exact, o\
|
|
1595
1595
|
utside grows around it. Geometry-true, so booleans and outlines follow."},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},Dn,...Ye],cook(e){let t=e.enumOf("strokeAlign",["c\
|
|
1596
1596
|
enter","inside","outside"]),n=t==="center"?0:(t==="inside"?-1:1)*(e.style().strokeWidth??0),r=e.num("w"),i=e.num("h"),{dx:s,dy:l}=On(e,r,i),u=Math.max(0,r+n),h=Math.max(0,i+n),f=e.num("x")+s-n/2,A=e.num(
|
|
1597
|
-
"y")+l-n/2,d=e.num("rotation"),y=d===0?be:
|
|
1597
|
+
"y")+l-n/2,d=e.num("rotation"),y=d===0?be:Pr(d,f+u/2,A+h/2),g=Math.min(e.num("rx"),Math.min(u,h)/2),x=e.enumOf("corner",["round","chamfer"]),v={tl:e.bool("chTL"),tr:e.bool("chTR"),br:e.bool("chBR"),bl:e.
|
|
1598
1598
|
bool("chBL")},b=v.tl||v.tr||v.br||v.bl,C=v.tl&&v.tr&&v.br&&v.bl;if(g<=0||!b||x==="round"&&C){let P={id:e.shapeId(0),kind:"rect",x:f,y:A,w:u,h,rx:g>0&&C?g:0,style:e.style(),transform:y,meta:e.meta(0)};
|
|
1599
1599
|
return{out:V([P])}}let M=24,S=(P,E,_,Q,Y,F)=>{if(!Q)return[{x:P,y:E}];let $=P-Y*g,W=E-F*g;if(x==="chamfer")return[_===180?{x:P,y:W}:_===270?{x:$,y:E}:_===0?{x:P,y:W}:{x:$,y:E},_===180?{x:$,y:E}:_===270?
|
|
1600
1600
|
{x:P,y:W}:_===0?{x:$,y:E}:{x:P,y:W}];let G=[];for(let oe=0;oe<=M;oe++){let ce=(_+oe/M*90)*Math.PI/180;G.push({x:$+g*Math.cos(ce),y:W+g*Math.sin(ce)})}return G},T={id:e.shapeId(0),kind:"polyline",points:[
|
|
1601
|
-
...S(f,A,180,v.tl,-1,-1),...S(f+u,A,270,v.tr,1,-1),...S(f+u,A+h,0,v.br,1,1),...S(f,A+h,90,v.bl,-1,1)],closed:!0,style:e.style(),transform:y,meta:e.meta(0)};return{out:V([T])}}},
|
|
1601
|
+
...S(f,A,180,v.tl,-1,-1),...S(f+u,A,270,v.tr,1,-1),...S(f+u,A+h,0,v.br,1,1),...S(f,A+h,90,v.bl,-1,1)],closed:!0,style:e.style(),transform:y,meta:e.meta(0)};return{out:V([T])}}},Hp={type:"circle",label:"\
|
|
1602
1602
|
Circle",category:"generator",translate:[{x:"cx",y:"cy"}],description:"A circle, or an arc when the sweep is less than a full turn.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"\
|
|
1603
1603
|
Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"r",label:"Radius",type:"number",default:60,min:0,step:.5,unit:"px"},{key:"\
|
|
1604
1604
|
start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:co},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg"},{key:"ry",label:"Radius Y",type:"\
|
|
1605
1605
|
number",default:0,min:0,step:.5,unit:"px",description:"Stretch into an ellipse: Radius becomes X. 0 = circle. An ellipse ignores Start and Sweep."},{key:"strokeAlign",label:"Stroke Align",type:"enum",
|
|
1606
1606
|
default:"center",options:[{value:"center",label:"Center"},{value:"inside",label:"Inside"},{value:"outside",label:"Outside"}],group:"Style",description:"Where the stroke sits on the outline: inside kee\
|
|
1607
1607
|
ps the drawn size exact, outside grows around it. Geometry-true, so booleans and outlines follow."},...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.enumOf("strokeAlign",["center","inside","outside"]),
|
|
1608
|
-
i=r==="center"?0:(r==="inside"?-1:1)*(e.style().strokeWidth??0)/2,s=Math.max(0,e.num("r")+i),l=e.num("ry"),u=l>0?Math.max(0,l+i):l,h=
|
|
1608
|
+
i=r==="center"?0:(r==="inside"?-1:1)*(e.style().strokeWidth??0)/2,s=Math.max(0,e.num("r")+i),l=e.num("ry"),u=l>0?Math.max(0,l+i):l,h=dr(e.num("start")),f=e.num("sweep"),A=Math.abs(f)>=360;if(l>0&&l!==
|
|
1609
1609
|
e.num("r")){let y={id:e.shapeId(0),kind:"ellipse",cx:t,cy:n,rx:s,ry:u,style:e.style(),transform:be,meta:e.meta(0)};return{out:V([y])}}let d=A?{id:e.shapeId(0),kind:"circle",cx:t,cy:n,r:s,style:e.style(),
|
|
1610
|
-
transform:be,meta:e.meta(0)}:{id:e.shapeId(0),kind:"arc",cx:t,cy:n,r:s,a0:h,a1:h+f,style:e.style(),transform:be,meta:e.meta(0)};return{out:V([d])}}}
|
|
1610
|
+
transform:be,meta:e.meta(0)}:{id:e.shapeId(0),kind:"arc",cx:t,cy:n,r:s,a0:h,a1:h+f,style:e.style(),transform:be,meta:e.meta(0)};return{out:V([d])}}},$p={type:"line",label:"Line",category:"generator",translate:[
|
|
1611
1611
|
{x:"x1",y:"y1"},{x:"x2",y:"y2"}],inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x1",label:"X1",type:"number",default:0,step:.5,unit:"px"},{key:"y1",label:"Y1",type:"number",default:0,step:.5,
|
|
1612
1612
|
unit:"px"},{key:"x2",label:"X2",type:"number",default:100,step:.5,unit:"px"},{key:"y2",label:"Y2",type:"number",default:0,step:.5,unit:"px"},...Ye],cook(e){let t={id:e.shapeId(0),kind:"polyline",points:[
|
|
1613
|
-
{x:e.num("x1"),y:e.num("y1")},{x:e.num("x2"),y:e.num("y2")}],closed:!1,style:e.style(),transform:be,meta:e.meta(0)};return{out:V([t])}}}
|
|
1614
|
-
|
|
1615
|
-
let i={};for(let s of r[2].matchAll(
|
|
1613
|
+
{x:e.num("x1"),y:e.num("y1")},{x:e.num("x2"),y:e.num("y2")}],closed:!1,style:e.style(),transform:be,meta:e.meta(0)};return{out:V([t])}}},zp=[Up,Hp,$p],jp=/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*?)\/?>/g,
|
|
1614
|
+
Vp=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,Jp=/<(defs|clipPath|mask|symbol|style)\b[^>]*>[\s\S]*?<\/\1>/g;function Zp(e){let t=e.replace(Jp,""),n=[];for(let r of t.matchAll(jp)){
|
|
1615
|
+
let i={};for(let s of r[2].matchAll(Vp))i[s[1]]=s[2]??s[3]??"";n.push({tag:r[1],attrs:i})}return n}function Kp(e){let t=/viewBox\s*=\s*["']\s*([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)/.
|
|
1616
1616
|
exec(e);if(t){let[s,l,u,h]=[Number(t[1]),Number(t[2]),Number(t[3]),Number(t[4])];if(u>0&&h>0)return{x:s,y:l,w:u,h}}let n=s=>{let l=new RegExp(`<svg[^>]*\\b${s}\\s*=\\s*["']([\\d.]+)`).exec(e);return l?
|
|
1617
|
-
Number(l[1]):0},r=n("width"),i=n("height");return r>0&&i>0?{x:0,y:0,w:r,h:i}:{x:0,y:0,w:24,h:24}}var pt=(e,t=0)=>{let n=Number(e);return Number.isFinite(n)?n:t};function
|
|
1617
|
+
Number(l[1]):0},r=n("width"),i=n("height");return r>0&&i>0?{x:0,y:0,w:r,h:i}:{x:0,y:0,w:24,h:24}}var pt=(e,t=0)=>{let n=Number(e);return Number.isFinite(n)?n:t};function ed(e){let t={fill:e.fill===void 0||
|
|
1618
1618
|
e.fill.startsWith("url(")?"#000000":e.fill,stroke:e.stroke??"none"};e["stroke-width"]!==void 0?t.strokeWidth=pt(e["stroke-width"],1):t.stroke!=="none"&&(t.strokeWidth=1);let n=pt(e.opacity,1);return n!==
|
|
1619
|
-
1&&(t.opacity=n),t}function
|
|
1619
|
+
1&&(t.opacity=n),t}function td(e){let t=(e.match(/-?(?:\d+\.?\d*|\.\d+)(?:[eE]-?\d+)?/g)??[]).map(Number),n=[];for(let r=0;r+1<t.length;r+=2)n.push({x:t[r],y:t[r+1]});return n}var nd={type:"svg",label:"\
|
|
1620
1620
|
SVG",category:"generator",translate:[{x:"x",y:"y"}],description:"Paste SVG markup \u2014 icons, logos \u2014 and it becomes shapes. Drop .svg files on the graph to make these.",inputs:[],outputs:[{name:"\
|
|
1621
1621
|
out",type:"shapes"}],params:[{key:"svg",label:"Markup",type:"string",default:"",multiline:!0,exposable:!1,description:"The <svg>\u2026</svg> text, pasted whole."},{key:"x",label:"X",type:"number",default:0,
|
|
1622
1622
|
step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"size",label:"Size",type:"number",default:64,min:0,max:4096,step:1,unit:"px",description:"Target height; the icon \
|
|
1623
1623
|
is centred on X/Y. 0 keeps native coordinates."},{key:"keepStyle",label:"Source Style",type:"bool",default:!1,description:"Use the fills and strokes from the pasted markup instead of this node\u2019s style\
|
|
1624
|
-
."},...Ye],cook(e){let t=e.str("svg"),n=
|
|
1625
|
-
epStyle"),f=[];for(let[A,d]of n.entries()){let y=d.attrs,g={id:e.shapeId(A),style:h?
|
|
1624
|
+
."},...Ye],cook(e){let t=e.str("svg"),n=Zp(t),r=n.length;if(r===0)return{out:V([])};let i=Kp(t),s=e.num("size"),l=s>0?s/i.h:1,u=[l,0,0,l,e.num("x")-l*(i.x+i.w/2),e.num("y")-l*(i.y+i.h/2)],h=e.bool("ke\
|
|
1625
|
+
epStyle"),f=[];for(let[A,d]of n.entries()){let y=d.attrs,g={id:e.shapeId(A),style:h?ed(y):e.style(A,r),transform:u,meta:e.meta(A,["svg"])};switch(d.tag){case"path":y.d&&f.push({...g,kind:"path",d:y.d});
|
|
1626
1626
|
break;case"rect":f.push({...g,kind:"rect",x:pt(y.x),y:pt(y.y),w:pt(y.width),h:pt(y.height),rx:pt(y.rx)});break;case"circle":f.push({...g,kind:"circle",cx:pt(y.cx),cy:pt(y.cy),r:pt(y.r)});break;case"el\
|
|
1627
1627
|
lipse":f.push({...g,kind:"ellipse",cx:pt(y.cx),cy:pt(y.cy),rx:pt(y.rx),ry:pt(y.ry)});break;case"line":f.push({...g,kind:"polyline",points:[{x:pt(y.x1),y:pt(y.y1)},{x:pt(y.x2),y:pt(y.y2)}],closed:!1});
|
|
1628
|
-
break;case"polyline":case"polygon":{let x=
|
|
1628
|
+
break;case"polyline":case"polygon":{let x=td(y.points??"");x.length>=2&&f.push({...g,kind:"polyline",points:x,closed:d.tag==="polygon"});break}}}return{out:V(f)}}};function jl(e,t){let n=e.assets[t];if(!n)
|
|
1629
1629
|
throw new Error(`no image \u201C${t.slice(0,8)}\u2026\u201D in this document \u2014 drop the file on the graph again, or choose another`);let r=e.asset?.(t);if(!r)throw new Error(`the bytes of \u201C${n.
|
|
1630
|
-
name}\u201D are not on this machine \u2014 drop the file on the graph to restore them (the CLI reads them from the project\u2019s .assets folder)`);return{record:n,href:r}}var
|
|
1630
|
+
name}\u201D are not on this machine \u2014 drop the file on the graph to restore them (the CLI reads them from the project\u2019s .assets folder)`);return{record:n,href:r}}var rd={},Vl=[{value:"stretc\
|
|
1631
1631
|
h",label:"Stretch"},{value:"contain",label:"Contain"},{value:"cover",label:"Cover"}];function Jl(e,t,n,r,i){if(i==="stretch")return[n,r];let s=i==="contain"?Math.min(n/e,r/t):Math.max(n/e,r/t);return[
|
|
1632
|
-
e*s,t*s]}var
|
|
1632
|
+
e*s,t*s]}var od={type:"image",label:"Image",category:"generator",translate:[{x:"x",y:"y"}],description:"A PNG, JPEG or GIF placed as a shape \u2014 position it, array it, slice it, rasterise it into the po\
|
|
1633
1633
|
st chain. Drop image files on the graph to make these. The file stays beside the document; only its name and size are saved.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"asset",label:"\
|
|
1634
1634
|
File",type:"string",default:"",exposable:!1,asset:!0,description:"Which of the document\u2019s images this is. Choose a file, or drop one on the graph."},{key:"x",label:"X",type:"number",default:0,step:.5,
|
|
1635
1635
|
unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"width",label:"Width",type:"number",default:0,min:0,max:8192,step:1,unit:"px",description:"Drawn width; the image is centr\
|
|
@@ -1639,19 +1639,19 @@ er"),description:"With both Width and Height set: Stretch fills the box, Contain
|
|
|
1639
1639
|
width).base)>0&&Number(Z(e.height).base)>0)},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Style"}],cook(e){let t=e.str("asset");if(t==="")return{out:V([])};let{record:n,
|
|
1640
1640
|
href:r}=jl(e,t),i=n.width/n.height,s=e.num("height"),l=e.num("width");s<=0&&l<=0?(l=n.width,s=n.height):s<=0?s=l/i:l<=0?l=s*i:e.enumOf("fit",["stretch","contain"])==="contain"&&([l,s]=Jl(n.width,n.height,
|
|
1641
1641
|
l,s,"contain"));let u={kind:"image",id:e.shapeId(0),x:e.num("x")-l/2,y:e.num("y")-s/2,w:l,h:s,href:r,style:{...Bo,stroke:"none",fill:"none",opacity:e.num("opacity")},transform:[1,0,0,1,0,0],meta:e.meta(
|
|
1642
|
-
0,["image"])};return{out:V([u])}}},
|
|
1642
|
+
0,["image"])};return{out:V([u])}}},id={type:"picture",label:"Picture",category:"post",description:"A PNG, JPEG or GIF as a texture for the post chain, no Rasterize needed: at its own pixels, or fitted\
|
|
1643
1643
|
into a canvas-sized frame.",inputs:[],outputs:[{name:"out",type:"texture"}],params:[{key:"asset",label:"File",type:"string",default:"",exposable:!1,asset:!0,description:"Which of the document\u2019s image\
|
|
1644
1644
|
s this is."},{key:"size",label:"Size",type:"enum",default:"canvas",options:[{value:"canvas",label:"Canvas"},{value:"native",label:"Native pixels"}],description:"Canvas: a frame the size of the canvas \
|
|
1645
1645
|
with the file fitted in. Native: the file\u2019s own pixels, centred on X/Y."},{key:"fit",label:"Fit",type:"enum",default:"contain",options:Vl,description:"How the file meets the canvas: Stretch fills\
|
|
1646
1646
|
it, Contain keeps the aspect inside, Cover keeps the aspect and crops.",dimWhen:e=>Z(e.size).base==="native"},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",description:"Shift of the pi\
|
|
1647
1647
|
cture\u2019s centre."},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Style"}],cook(e){let t=e.str("as\
|
|
1648
|
-
set");if(t==="")return
|
|
1648
|
+
set");if(t==="")return rd;let{record:n,href:r}=jl(e,t);if(!e.rasterize)throw new Error("no rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let i=e.num("x"),s=e.
|
|
1649
1649
|
num("y"),l=(v,b,C,M)=>({kind:"image",id:e.shapeId(0),x:v,y:b,w:C,h:M,href:r,style:{...Bo,stroke:"none",fill:"none",opacity:e.num("opacity")},transform:[1,0,0,1,0,0],meta:e.meta(0,["image"])}),u=(v,b,C,M)=>({
|
|
1650
1650
|
width:v,height:b,origin:C,background:"none",layers:[{id:e.nodeId,name:"picture",opacity:1,visible:!0,order:0,shapes:[M]}]});if(e.enumOf("size",["canvas","native"])==="native"){let{width:v,height:b}=n,
|
|
1651
1651
|
C={x:Math.round(i-v/2),y:Math.round(s-b/2)},M=e.rasterize(u(v,b,"top-left",l(0,0,v,b)),C);return{out:Ge(M.at?M:{...M,at:C})}}let h=e.canvas.w,f=e.canvas.h;if(h<=0||f<=0)throw new Error("has no canvas \
|
|
1652
1652
|
to fill \u2014 give the project a canvas");let[A,d]=Jl(n.width,n.height,h,f,e.enumOf("fit",["stretch","contain","cover"])),y=e.canvas.origin==="center"?0:h/2,g=e.canvas.origin==="center"?0:f/2,x=l(y+i-
|
|
1653
|
-
A/2,g+s-d/2,A,d);return{out:Ge(e.rasterize(u(h,f,e.canvas.origin,x)))}}},dl={};function
|
|
1654
|
-
loop==="pingpong"){let s=Math.max(1,2*n-2),l=(i%s+s)%s;return l<n?l:s-l}return i<0?0:i>=n?r.after==="hold"?n-1:void 0:i}var
|
|
1653
|
+
A/2,g+s-d/2,A,d);return{out:Ge(e.rasterize(u(h,f,e.canvas.origin,x)))}}},dl={};function sd(e,t,n,r){if(n<=0)return;let i=Math.floor((e*r.speed+r.inPoint)*t+1e-6);if(r.loop==="repeat")return(i%n+n)%n;if(r.
|
|
1654
|
+
loop==="pingpong"){let s=Math.max(1,2*n-2),l=(i%s+s)%s;return l<n?l:s-l}return i<0?0:i>=n?r.after==="hold"?n-1:void 0:i}var ad={type:"video",label:"Video",category:"post",description:"A video file\u2019s f\
|
|
1655
1655
|
rame for the current time, as a texture for the post chain \u2014 ProRes, DNxHD, H.264, whatever ffmpeg reads. Drop a video on the graph to make one. The file stays beside the document; only its name and t\
|
|
1656
1656
|
iming are saved. No audio.",inputs:[],outputs:[{name:"out",type:"texture"}],timeRoot:!0,params:[{key:"asset",label:"File",type:"string",default:"",exposable:!1,asset:!0,description:"Which of the docum\
|
|
1657
1657
|
ent\u2019s videos this is. Choose a file, or drop one on the graph."},{key:"in",label:"In",type:"number",default:0,min:0,step:.01,unit:"s",description:"Seconds into the file where the document\u2019s time \
|
|
@@ -1664,32 +1664,32 @@ pect inside, Cover keeps the aspect and overflows.",dimWhen:e=>Z(e.size).base!==
|
|
|
1664
1664
|
{key:"y",label:"Y",type:"number",default:0,step:1,unit:"px"}],cook(e){let t=e.str("asset");if(t==="")return dl;let n=e.assets[t];if(!n)throw new Error(`no video \u201C${t.slice(0,8)}\u2026\u201D in this documen\
|
|
1665
1665
|
t \u2014 drop the file on the graph again, or choose another`);if(!n.video)throw new Error(`\u201C${n.name}\u201D is an image, not a video \u2014 a Picture node shows those`);if(!e.video)throw new Error(
|
|
1666
1666
|
"no video decoder available here \u2014 the preview loads one on demand; exports always have one");let r={inPoint:e.num("in"),speed:e.num("speed"),loop:e.enumOf("loop",["off","repeat","pingpong"]),after:e.
|
|
1667
|
-
enumOf("after",["hold","none"])},i=
|
|
1667
|
+
enumOf("after",["hold","none"])},i=sd(e.t,n.video.fps,n.video.frames,r);if(i===void 0)return dl;let s=e.enumOf("size",["native","canvas"])==="canvas",l=n.width,u=n.height;if(s){let x=e.canvas.w,v=e.canvas.
|
|
1668
1668
|
h;if(x<=0||v<=0)throw new Error("has no canvas to fill \u2014 give the project a canvas");let b=e.enumOf("fit",["stretch","contain","cover"]),C=b==="contain"?Math.min(x/l,v/u):Math.max(x/l,v/u);l=Math.
|
|
1669
1669
|
max(1,Math.round(b==="stretch"?x:l*C)),u=Math.max(1,Math.round(b==="stretch"?v:u*C))}let h=s&&e.canvas.origin!=="center"?e.canvas.w/2:0,f=s&&e.canvas.origin!=="center"?e.canvas.h/2:0,A={x:Math.round(h+
|
|
1670
1670
|
e.num("x")-l/2),y:Math.round(f+e.num("y")-u/2)},d=e.video(t,i,A),y=d&&d!=="loading"&&(l!==d.width||u!==d.height)?rl(d,l,u):d;if(y==="loading")throw new Error("the video decoder is still loading \u2014 a mo\
|
|
1671
1671
|
ment");if(!y)throw new Error(`the bytes of \u201C${n.name}\u201D are not on this machine \u2014 drop the file on the graph to restore them (the CLI reads them from the project\u2019s .assets folder)`);
|
|
1672
|
-
let g=y.at&&y.at.x===A.x&&y.at.y===A.y?y:{...y,at:A};return{out:Ge(g)}}},Al=["union","subtract","intersect","exclude"],Or=e=>Math.round(e*1e3)/1e3;function
|
|
1672
|
+
let g=y.at&&y.at.x===A.x&&y.at.y===A.y?y:{...y,at:A};return{out:Ge(g)}}},Al=["union","subtract","intersect","exclude"],Or=e=>Math.round(e*1e3)/1e3;function fr(e){let t=[];for(let n of e){let r=[],i=n.
|
|
1673
1673
|
style.fill!==void 0&&n.style.fill!=="none";for(let f of rt(n)){if(!(f.closed||i)||f.points.length<3)continue;let A=f.points.map(y=>[Or(y.x),Or(y.y)]),d=0;for(let y=0;y<A.length;y++){let[g,x]=A[y],[v,b]=A[(y+
|
|
1674
1674
|
1)%A.length];d+=g*b-v*x}r.push({ring:A,pts:f.points,area:d/2})}if(r.length===0)continue;let s=r.reduce((f,A)=>f+A.area,0)>=0,l=r.filter(f=>f.area>=0===s),u=r.filter(f=>f.area>=0!==s),h=l.map(f=>[f.ring]);
|
|
1675
1675
|
for(let f of u){let A=f.pts[0],d=-1,y=1/0;l.forEach((g,x)=>{Math.abs(g.area)<y&&Po(A,g.pts)&&(y=Math.abs(g.area),d=x)}),d>=0?h[d].push(f.ring):h.push([f.ring])}t.push(...h)}return t}var Lr=1e3;function Kl(e){
|
|
1676
|
-
let t=[];for(let n of e)n.forEach((r,i)=>{if(r.length<3)return;let s=r.map(([u,h])=>({X:Math.round(u*Lr),Y:Math.round(h*Lr)})),l=
|
|
1677
|
-
return Rt.default.JS.PolyTreeToExPolygons(e).map(t=>[t.outer,...t.holes].map(n=>n.map(r=>[r.X/Lr,r.Y/Lr])))}var
|
|
1676
|
+
let t=[];for(let n of e)n.forEach((r,i)=>{if(r.length<3)return;let s=r.map(([u,h])=>({X:Math.round(u*Lr),Y:Math.round(h*Lr)})),l=ud(r);(i===0&&l<0||i>0&&l>0)&&s.reverse(),t.push(s)});return t}function eu(e){
|
|
1677
|
+
return Rt.default.JS.PolyTreeToExPolygons(e).map(t=>[t.outer,...t.holes].map(n=>n.map(r=>[r.X/Lr,r.Y/Lr])))}var ld=["round","miter","square"];function tu(e,t,n,r=4){let i=Kl(e);if(i.length===0)return[];
|
|
1678
1678
|
let s=new Rt.default.ClipperOffset(r,.25*Lr),l=n==="round"?Rt.default.JoinType.jtRound:n==="miter"?Rt.default.JoinType.jtMiter:Rt.default.JoinType.jtSquare;s.AddPaths(i,l,Rt.default.EndType.etClosedPolygon);
|
|
1679
|
-
let u=new Rt.default.PolyTree;return s.Execute(u,t*Lr),eu(u)}function ml(e,t){if(!t)return
|
|
1680
|
-
stroke!=="none")||i.length===0){n.push(...i);continue}let u=r.style.strokeLinejoin,h=u==="round"?"round":u==="bevel"?"square":"miter";n.push(...tu(i,s/2,h))}return n}function
|
|
1679
|
+
let u=new Rt.default.PolyTree;return s.Execute(u,t*Lr),eu(u)}function ml(e,t){if(!t)return fr(e);let n=[];for(let r of e){let i=fr([r]),s=r.style.strokeWidth??0;if(!(s>0&&r.style.stroke!==void 0&&r.style.
|
|
1680
|
+
stroke!=="none")||i.length===0){n.push(...i);continue}let u=r.style.strokeLinejoin,h=u==="round"?"round":u==="bevel"?"square":"miter";n.push(...tu(i,s/2,h))}return n}function ud(e){let t=0;for(let n=0;n<
|
|
1681
1681
|
e.length;n++){let[r,i]=e[n],[s,l]=e[(n+1)%e.length];t+=r*l-s*i}return t/2}function ao(e){if(e.length===0)return[];let t=Kl(e);if(t.length===0)return[];let n=new Rt.default.Clipper;n.AddPaths(t,Rt.default.
|
|
1682
1682
|
PolyType.ptSubject,!0);let r=new Rt.default.PolyTree;return n.Execute(Rt.default.ClipType.ctUnion,r,Rt.default.PolyFillType.pftNonZero,Rt.default.PolyFillType.pftNonZero),eu(r)}function Nn(e){let t=[];
|
|
1683
1683
|
for(let n of e)for(let r of n){if(r.length<3)continue;let i=r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]?r.slice(0,-1):r;t.push(`M ${i.map(([s,l])=>`${Or(s)} ${Or(l)}`).join(" L ")} Z`)}return t.
|
|
1684
|
-
join(" ")}var
|
|
1684
|
+
join(" ")}var cd={type:"slice",label:"Slice",category:"modifier",translate:[{x:"x",y:"y"}],description:"Cut every shape along a line, leaving a gap \u2014 the detached-corner move. Each shape keeps its own\
|
|
1685
1685
|
style; both pieces stay one shape.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"anchor",label:"Anchor",type:"enum",default:"shape",options:[{value:"shape",label:"\
|
|
1686
1686
|
Shape centre"},{value:"canvas",label:"Canvas origin"}],description:"What X/Y measure from. Shape centre keeps the cut with the shape as it moves; old documents were canvas-anchored and stay that way."},
|
|
1687
1687
|
{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",description:"A point the cut line passes through, measured from the Anchor."},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},
|
|
1688
1688
|
{key:"angle",label:"Angle",type:"number",default:45,step:1,unit:"deg"},{key:"gap",label:"Gap",type:"number",default:6,min:0,step:.5,unit:"px"}],cook(e){let t=e.shapes("in"),n=e.num("gap");if(n<=0)return{
|
|
1689
|
-
out:V(t)};let r=e.enumOf("anchor",["shape","canvas"])==="shape",i=e.num("angle")*Math.PI/180,s={x:Math.cos(i),y:Math.sin(i)},l={x:-Math.sin(i),y:Math.cos(i)},u=t.map((h,f)=>{let A=
|
|
1689
|
+
out:V(t)};let r=e.enumOf("anchor",["shape","canvas"])==="shape",i=e.num("angle")*Math.PI/180,s={x:Math.cos(i),y:Math.sin(i)},l={x:-Math.sin(i),y:Math.cos(i)},u=t.map((h,f)=>{let A=fr([h]);if(A.length===
|
|
1690
1690
|
0)return h;let d=r?Ze(h):void 0,y=d?nt(d):{x:0,y:0},g=y.x+e.num("x",f,t.length),x=y.y+e.num("y",f,t.length),v=1;for(let P of A)for(let[E,_]of P[0])v=Math.max(v,Math.hypot(E-g,_-x));let b=v+n,C=n/2,M=[
|
|
1691
1691
|
[[g+s.x*b+l.x*C,x+s.y*b+l.y*C],[g+s.x*b-l.x*C,x+s.y*b-l.y*C],[g-s.x*b-l.x*C,x-s.y*b-l.y*C],[g-s.x*b+l.x*C,x-s.y*b+l.y*C]].map(P=>[Or(P[0]),Or(P[1])])],S=vn.default.difference(vn.default.union(A[0],...A.
|
|
1692
|
-
slice(1)),M),T=Nn(S);return T?{id:e.shapeId(f,"slice"),kind:"path",d:T,style:{...h.style},transform:be,meta:{...h.meta,index:f}}:h});return{out:V(u)}}},
|
|
1692
|
+
slice(1)),M),T=Nn(S);return T?{id:e.shapeId(f,"slice"),kind:"path",d:T,style:{...h.style},transform:be,meta:{...h.meta,index:f}}:h});return{out:V(u)}}},hd={type:"boolean",label:"Boolean",category:"mod\
|
|
1693
1693
|
ifier",description:'Combine closed outlines: union, subtract, intersect or exclude the "with" input. Nothing wired into "with" merges the input with itself. "rest" is the offcut: the part of the input\
|
|
1694
1694
|
the operation removed.',keywords:["union","weld","fuse","subtract","intersect","exclude","clip","offcut","remainder"],inputs:[{name:"in",type:"shapes"},{name:"with",type:"shapes"}],outputs:[{name:"ou\
|
|
1695
1695
|
t",type:"shapes"},{name:"rest",type:"shapes",label:"rest"}],params:[{key:"op",label:"Operation",type:"enum",default:"subtract",options:Al.map(e=>({value:e,label:e[0].toUpperCase()+e.slice(1)}))},{key:"\
|
|
@@ -1699,34 +1699,34 @@ lude Stroke",type:"bool",default:!1,description:"Count each input\u2019s stroke
|
|
|
1699
1699
|
"in"),t);if(n.length===0)return{out:V([]),rest:V([])};let r=ml(e.shapes("with"),t),i=e.enumOf("op",Al),s=ao(n),l,u=[];if(r.length===0)l=s;else{let A=ao(r);l=i==="union"?vn.default.union(s,A):i==="subt\
|
|
1700
1700
|
ract"?vn.default.difference(s,A):i==="intersect"?vn.default.intersection(s,A):vn.default.xor(s,A),u=i==="union"?[]:i==="intersect"?vn.default.difference(s,A):vn.default.intersection(s,A)}let h=e.bool(
|
|
1701
1701
|
"keepStyle")?{...e.shapes("in")[0]?.style??e.style()}:e.style(),f=(A,d,y)=>{let g=Nn(A);return g?[{id:e.shapeId(d,y),kind:"path",d:g,style:{...h},transform:be,meta:e.meta(d)}]:[]};return{out:V(f(l,0)),
|
|
1702
|
-
rest:V(f(u,0,"rest"))}}},
|
|
1703
|
-
"fill"?{...e,default:"#ffffff"}:e.type==="color"&&e.key==="stroke"?{...e,default:"none"}:e),
|
|
1702
|
+
rest:V(f(u,0,"rest"))}}},fd=["hazard","chevron"],un=e=>Math.round(e*1e3)/1e3;function nu(e){return Z(e.pattern).base==="chevron"}function pd(e){return!nu(e)}var dd=Ye.map(e=>e.type==="color"&&e.key===
|
|
1703
|
+
"fill"?{...e,default:"#ffffff"}:e.type==="color"&&e.key==="stroke"?{...e,default:"none"}:e),Ad={type:"stripes",label:"Stripes",category:"generator",translate:[{x:"x",y:"y"}],quickKey:"offset",description:"\
|
|
1704
1704
|
Hazard bands or chevrons filling a frame, one shape per stripe so cascades and ramps work per band. Wire Time into Offset and they march.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"\
|
|
1705
1705
|
x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"w",label:"Width",type:"number",default:240,min:0,step:.5,unit:"px"},{key:"h",
|
|
1706
1706
|
label:"Height",type:"number",default:24,min:0,step:.5,unit:"px"},{key:"pattern",label:"Pattern",type:"enum",default:"hazard",options:[{value:"hazard",label:"Hazard"},{value:"chevron",label:"Chevron"}],
|
|
1707
1707
|
description:"Hazard: slanted bands. Chevron: arrowheads."},{key:"stripe",label:"Stripe",type:"number",default:16,min:.5,step:.5,unit:"px",description:"Each band\u2019s width, measured along the frame."},
|
|
1708
1708
|
{key:"gap",label:"Gap",type:"number",default:16,min:0,step:.5,unit:"px",description:"Space between bands, measured along the frame."},{key:"lean",label:"Lean",type:"number",default:30,min:-80,max:80,step:1,
|
|
1709
1709
|
unit:"deg",description:"Hazard: how far the bands lean from vertical. 0 = upright bars.",dimWhen:nu},{key:"point",label:"Point",type:"number",default:90,min:20,max:170,step:1,unit:"deg",description:"C\
|
|
1710
|
-
hevron: the angle at the arrow\u2019s tip. 90 is the classic.",dimWhen:
|
|
1710
|
+
hevron: the angle at the arrow\u2019s tip. 90 is the classic.",dimWhen:pd},{key:"direction",label:"Direction",type:"enum",default:"right",options:[{value:"right",label:"Right"},{value:"left",label:"Le\
|
|
1711
1711
|
ft"}],description:"Which way the chevrons point; for Hazard, which way the bands lean."},{key:"offset",label:"Offset",type:"number",default:0,step:.5,unit:"px",description:"Slides the pattern along th\
|
|
1712
1712
|
e frame, wrapping round. Wire Time or an LFO here to make it march."},{key:"clip",label:"Clip",type:"bool",default:!0,description:"Cut the bands at the frame\u2019s edges (the leading and trailing triangle\
|
|
1713
|
-
s). Off leaves whole bands hanging past it."},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},Dn,...
|
|
1714
|
-
let{dx:r,dy:i}=On(e,t,n),s=e.num("x")+r,l=e.num("y")+i,u=e.enumOf("pattern",
|
|
1715
|
-
clip"),y=e.num("rotation"),g=y===0?be:
|
|
1713
|
+
s). Off leaves whole bands hanging past it."},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},Dn,...dd],cook(e){let t=e.num("w"),n=e.num("h");if(t<=0||n<=0)return{out:V([])};
|
|
1714
|
+
let{dx:r,dy:i}=On(e,t,n),s=e.num("x")+r,l=e.num("y")+i,u=e.enumOf("pattern",fd),h=Math.max(.5,e.num("stripe")),f=h+Math.max(0,e.num("gap")),A=e.enumOf("direction",["right","left"])==="left",d=e.bool("\
|
|
1715
|
+
clip"),y=e.num("rotation"),g=y===0?be:Pr(y,s+t/2,l+n/2),x=(e.num("offset")%f+f)%f,v,b;if(u==="hazard"){let E=n*Math.tan(e.num("lean")*Math.PI/180);v=Math.abs(E),b=_=>[[_,l+n],[_+h,l+n],[_+h+E,l],[_+E,
|
|
1716
1716
|
l]]}else{let E=e.num("point")/2*Math.PI/180,_=n/2/Math.max(Math.tan(E),.001);v=_,b=Q=>[[Q,l],[Q+h,l],[Q+h+_,l+n/2],[Q+h,l+n],[Q,l+n],[Q+_,l+n/2]]}let C=[[[un(s),un(l)],[un(s+t),un(l)],[un(s+t),un(l+n)],
|
|
1717
1717
|
[un(s),un(l+n)]]],M=s*2+t,S=Math.floor((-v-x)/f)-1,T=Math.ceil((t+v)/f)+1,P=[];for(let E=S;E<=T;E++){let _=b(s+x+E*f);A&&(_=_.map(([G,oe])=>[M-G,oe]));let Q=Math.min(..._.map(G=>G[0]));if(Math.max(..._.
|
|
1718
1718
|
map(G=>G[0]))<=s||Q>=s+t)continue;let F=[_.map(([G,oe])=>[un(G),un(oe)])],$=Nn(d?Zl.default.intersection(F,C):[F]);if(!$)continue;let W=P.length;P.push({id:e.shapeId(W),kind:"path",d:$,style:e.style(W,
|
|
1719
|
-
T-S+1),transform:g,meta:e.meta(W,["stripe",u])})}return{out:V(P)}}},
|
|
1720
|
-
t,e));function ou(e){return Z(e.mode).base==="recursive"?"recursive":"split"}var
|
|
1719
|
+
T-S+1),transform:g,meta:e.meta(W,["stripe",u])})}return{out:V(P)}}},md=["split","recursive"],yd=["h","v"],gd=["alternate","longest","random"],bt=e=>Math.round(e*1e3)/1e3,oo=(e,t,n)=>Math.min(n,Math.max(
|
|
1720
|
+
t,e));function ou(e){return Z(e.mode).base==="recursive"?"recursive":"split"}var cr=e=>ou(e)==="split",yl=e=>ou(e)==="recursive";function bd(e){let t=e.split(/[\s,;/]+/).map(n=>Number.parseFloat(n)).filter(
|
|
1721
1721
|
n=>Number.isFinite(n)&&n>0);return t.length>=2?t:void 0}function iu(e,t,n){let r=n.reduce((h,f)=>h+f,0),i=t==="h"?e.h:e.w,s=[],l=[],u=0;for(let[h,f]of n.entries()){let A=r>0?f/r*i:0;s.push(t==="h"?{x:e.
|
|
1722
|
-
x,y:e.y+u,w:e.w,h:A}:{x:e.x+u,y:e.y,w:A,h:e.h}),u+=A,h<n.length-1&&l.push(t==="h"?[e.x,e.y+u,e.x+e.w,e.y+u]:[e.x+u,e.y,e.x+u,e.y+e.h])}return{pieces:s,lines:l}}function
|
|
1723
|
-
t+(r.next()*2-1)*n*.5,.05,.95);return[s,1-s]}let i=[];for(let s=0;s<e;s++)i.push(Math.max(.05,1+(r.next()*2-1)*n));return i}function
|
|
1722
|
+
x,y:e.y+u,w:e.w,h:A}:{x:e.x+u,y:e.y,w:A,h:e.h}),u+=A,h<n.length-1&&l.push(t==="h"?[e.x,e.y+u,e.x+e.w,e.y+u]:[e.x+u,e.y,e.x+u,e.y+e.h])}return{pieces:s,lines:l}}function vd(e,t,n,r){if(e===2){let s=oo(
|
|
1723
|
+
t+(r.next()*2-1)*n*.5,.05,.95);return[s,1-s]}let i=[];for(let s=0;s<e;s++)i.push(Math.max(.05,1+(r.next()*2-1)*n));return i}function Id(e,t,n){let r=[],i=[],s=(l,u,h)=>{let f=t.rand("subdivide",n,h),A=u>=
|
|
1724
1724
|
t.depth;!A&&u>0&&t.stop>0&&f.next()<t.stop&&(A=!0);let d=t.axis;if(!A&&(t.rule==="alternate"?d=u%2===0?t.axis:t.axis==="h"?"v":"h":t.rule==="longest"?d=l.w>l.h?"v":l.w<l.h?"h":t.axis:d=f.next()<.5?"h":
|
|
1725
|
-
"v",(d==="h"?l.h:l.w)/t.ways<t.minSize)){let v=d==="h"?"v":"h",b=v==="h"?l.h:l.w;t.rule!=="alternate"&&b/t.ways>=t.minSize?d=v:A=!0}if(A){r.push({cell:l,depth:u});return}let y=
|
|
1726
|
-
f),g=iu(l,d,y);for(let x of g.lines)i.push({line:x,depth:u});g.pieces.forEach((x,v)=>s(x,u+1,`${h}.${v}`))};return s(e,0,"r"),{leaves:r,dividers:i}}function
|
|
1725
|
+
"v",(d==="h"?l.h:l.w)/t.ways<t.minSize)){let v=d==="h"?"v":"h",b=v==="h"?l.h:l.w;t.rule!=="alternate"&&b/t.ways>=t.minSize?d=v:A=!0}if(A){r.push({cell:l,depth:u});return}let y=vd(t.ways,t.ratio,t.variation,
|
|
1726
|
+
f),g=iu(l,d,y);for(let x of g.lines)i.push({line:x,depth:u});g.pieces.forEach((x,v)=>s(x,u+1,`${h}.${v}`))};return s(e,0,"r"),{leaves:r,dividers:i}}function xd(e,t){let[n,r,i,s]=e,l=Math.abs(r-s)<1e-9,
|
|
1727
1727
|
u=l?r:n,h=Math.min(l?n:r,l?i:s),f=Math.max(l?n:r,l?i:s),A=[];for(let y of t)for(let g of y)for(let x=0;x<g.length;x++){let[v,b]=g[x],[C,M]=g[(x+1)%g.length],S=l?b:v,T=l?M:C;if(S===T||S<u==T<u)continue;
|
|
1728
|
-
let P=(u-S)/(T-S);A.push(l?v+(C-v)*P:b+(M-b)*P)}A.sort((y,g)=>y-g);let d=[];for(let y=0;y+1<A.length;y+=2){let g=Math.max(h,A[y]),x=Math.min(f,A[y+1]);x-g<.01||d.push(l?[g,u,x,u]:[u,g,u,x])}return d}function
|
|
1729
|
-
let n=e.cell.y-t.cell.y;return Math.abs(n)>.5?n:e.cell.x-t.cell.x}var
|
|
1728
|
+
let P=(u-S)/(T-S);A.push(l?v+(C-v)*P:b+(M-b)*P)}A.sort((y,g)=>y-g);let d=[];for(let y=0;y+1<A.length;y+=2){let g=Math.max(h,A[y]),x=Math.min(f,A[y+1]);x-g<.01||d.push(l?[g,u,x,u]:[u,g,u,x])}return d}function wd(e,t){
|
|
1729
|
+
let n=e.cell.y-t.cell.y;return Math.abs(n)>.5?n:e.cell.x-t.cell.x}var Cd={type:"subdivide",label:"Subdivide",category:"modifier",quickKey:"ratio",description:"Carve each shape\u2019s frame into panels. Spl\
|
|
1730
1730
|
it makes one cut into Count pieces or the Ratios typed in; Recursive keeps cutting, seeded. Cells are rects; the second output is just the dividers.",inputs:[{name:"in",type:"shapes"},{name:"reseed",type:"\
|
|
1731
1731
|
number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes",label:"cells"},{name:"lines",type:"shapes",label:"lines"}],params:[{key:"mode",label:"Mode",type:"enum",default:"split",options:[{value:"\
|
|
1732
1732
|
split",label:"Split"},{value:"recursive",label:"Recursive"}],description:"Split: one cut, exactly as told. Recursive: keep cutting the pieces, seeded."},{key:"axis",label:"Axis",type:"enum",default:"h",
|
|
@@ -1734,29 +1734,29 @@ options:[{value:"h",label:"Horizontal"},{value:"v",label:"Vertical"}],descriptio
|
|
|
1734
1734
|
lternate alternates from."},{key:"count",label:"Count",type:"int",default:2,min:1,max:24,description:"How many pieces. Two pieces land at Ratio; more are equal unless Ratios says otherwise.",dimWhen:yl},
|
|
1735
1735
|
{key:"ratio",label:"Ratio",type:"number",default:50,min:0,max:100,step:.5,unit:"%",description:"The first piece\u2019s share of the span when cutting in two. Wire an LFO here and the panels breathe. Recurs\
|
|
1736
1736
|
ive: the centre Variation scatters around."},{key:"ratios",label:"Ratios",type:"string",default:"",exposable:!1,description:"Piece sizes as weights, e.g. 60 40 or 1 2 1. Overrides Count and Ratio; emp\
|
|
1737
|
-
ty = off.",dimWhen:yl},{key:"depth",label:"Depth",type:"int",default:3,min:1,max:7,description:"How many levels of cuts. Cells double (or more) per level.",dimWhen:
|
|
1737
|
+
ty = off.",dimWhen:yl},{key:"depth",label:"Depth",type:"int",default:3,min:1,max:7,description:"How many levels of cuts. Cells double (or more) per level.",dimWhen:cr},{key:"rule",label:"Rule",type:"e\
|
|
1738
1738
|
num",default:"longest",options:[{value:"longest",label:"Longest side"},{value:"alternate",label:"Alternate"},{value:"random",label:"Random"}],description:"Which way each level cuts. Longest side keeps\
|
|
1739
|
-
cells squarish but may flip a cut as Ratio animates; Alternate flips H/V per level and breathes smoothly (Variation 0 gives a full-span cross); Random is Mondrian.",dimWhen:
|
|
1740
|
-
s",type:"int",default:2,min:2,max:4,description:"Pieces per cut. Three gives the header-over-three-cells layout in one go.",dimWhen:
|
|
1741
|
-
max:1,step:.01,description:"0 = every cut exactly at Ratio (or equal); 1 = anywhere. Seeded.",dimWhen:
|
|
1742
|
-
s a cell stays whole instead of cutting again. The root always cuts.",dimWhen:
|
|
1743
|
-
along the cut are not made.",dimWhen:
|
|
1744
|
-
e it (a Value, a Mapping, a Select\u2019s index); a Trigger into Reseed rerolls on cue instead.",dimWhen:
|
|
1739
|
+
cells squarish but may flip a cut as Ratio animates; Alternate flips H/V per level and breathes smoothly (Variation 0 gives a full-span cross); Random is Mondrian.",dimWhen:cr},{key:"ways",label:"Way\
|
|
1740
|
+
s",type:"int",default:2,min:2,max:4,description:"Pieces per cut. Three gives the header-over-three-cells layout in one go.",dimWhen:cr},{key:"variation",label:"Variation",type:"number",default:.35,min:0,
|
|
1741
|
+
max:1,step:.01,description:"0 = every cut exactly at Ratio (or equal); 1 = anywhere. Seeded.",dimWhen:cr},{key:"stop",label:"Stop Chance",type:"number",default:.2,min:0,max:1,step:.01,description:"Odd\
|
|
1742
|
+
s a cell stays whole instead of cutting again. The root always cuts.",dimWhen:cr},{key:"minSize",label:"Min Size",type:"number",default:12,min:0,step:.5,unit:"px",description:"Pieces smaller than this\
|
|
1743
|
+
along the cut are not made.",dimWhen:cr},{key:"salt",label:"Seed",type:"int",default:1,min:0,description:"Reroll the recursive layout \u2014 the \u2212/+ steppers walk through layouts. Wire a number in to driv\
|
|
1744
|
+
e it (a Value, a Mapping, a Select\u2019s index); a Trigger into Reseed rerolls on cue instead.",dimWhen:cr},{key:"clip",label:"Keep Shape",type:"bool",default:!0,description:"Cut the cells to the inp\
|
|
1745
1745
|
ut\u2019s outline, so a circle or polygon is carved into panels that keep its silhouette. Off treats every shape as its bounding box."},{key:"gap",label:"Gap",type:"number",default:0,min:0,step:.5,unit:"\
|
|
1746
1746
|
px",description:"Gutter between cells at every cut. The frame\u2019s outer edges stay put; the dividers sit in the middle of it."},{key:"inset",label:"Inset",type:"number",default:0,min:0,step:.5,unit:"\
|
|
1747
1747
|
px",description:"Shrink every cell inward on all four sides."},{key:"keepStyle",label:"Source Style",type:"bool",default:!0,description:"Cells and lines wear the input shape\u2019s style. Off = this node\u2019s\
|
|
1748
|
-
own Style params dress them."},...Ye],cook(e){let t=e.shapes("in");if(t.length===0)return{out:V([]),lines:V([])};let n=e.enumOf("mode",
|
|
1748
|
+
own Style params dress them."},...Ye],cook(e){let t=e.shapes("in");if(t.length===0)return{out:V([]),lines:V([])};let n=e.enumOf("mode",md),r=e.enumOf("axis",yd),i=Math.max(0,e.num("gap")),s=Math.max(
|
|
1749
1749
|
0,e.num("inset")),l=e.bool("keepStyle"),u=e.bool("clip"),h=e.inputs.reseed,f=0;if(h?.t==="number"){let{playing:v,local:b}=en(h.v);f=v?Math.round((e.t-b)*1e3):-Math.round(b*1e3)-1}let A=`${e.int("salt")}\
|
|
1750
|
-
|${f}`,d=n==="split"?
|
|
1750
|
+
|${f}`,d=n==="split"?bd(e.str("ratios")):void 0,y=[],g=[],x=t.length;return t.forEach((v,b)=>{let C={...v,transform:be},M=Ze(C);if(!M||M.w<=0||M.h<=0)return;let S;if(u&&!(v.kind==="rect"&&v.rx===0)){let F=fr(
|
|
1751
1751
|
[C]);F.length>0&&(S=ao(F))}let T=oo(e.num("ratio",b,x),0,100)/100,P,E;if(n==="split"){let F=Math.max(1,e.int("count")),$=d??(F===2?[T,1-T]:new Array(F).fill(1)),W=iu(M,r,$);P=W.pieces.map(G=>({cell:G,
|
|
1752
|
-
depth:1})),E=W.lines.map(G=>({line:G,depth:0}))}else{let F=
|
|
1753
|
-
stop:oo(e.num("stop"),0,1),minSize:Math.max(0,e.num("minSize")),rand:(...$)=>e.rand(A,b,...$)},`${b}`);P=F.leaves.sort(
|
|
1752
|
+
depth:1})),E=W.lines.map(G=>({line:G,depth:0}))}else{let F=Id(M,{depth:Math.max(1,e.int("depth")),axis:r,rule:e.enumOf("rule",gd),ratio:T,variation:oo(e.num("variation"),0,1),ways:oo(e.int("ways"),2,4),
|
|
1753
|
+
stop:oo(e.num("stop"),0,1),minSize:Math.max(0,e.num("minSize")),rand:(...$)=>e.rand(A,b,...$)},`${b}`);P=F.leaves.sort(wd),E=F.dividers}let _=(F,$)=>l?{...v.style}:e.style(F,$),Q=(F,$)=>{let W=_(F,$);
|
|
1754
1754
|
return{...W,fill:"none",stroke:W.stroke&&W.stroke!=="none"?W.stroke:W.fill&&W.fill!=="none"?W.fill:"#ffffff"}},Y=.001;for(let F of P){let $=F.cell,W=Math.abs($.x-M.x)<Y?0:i/2,G=Math.abs($.y-M.y)<Y?0:i/
|
|
1755
1755
|
2,oe=Math.abs($.x+$.w-(M.x+M.w))<Y?0:i/2,ce=Math.abs($.y+$.h-(M.y+M.h))<Y?0:i/2,he=$.x+W+s,se=$.y+G+s,Ae=Math.max(0,$.w-W-oe-s*2),ve=Math.max(0,$.h-G-ce-s*2),ne=y.length,ge=["cell",`depth:${F.depth}`];
|
|
1756
1756
|
if(S){if(Ae<=0||ve<=0)continue;let _e=[[[bt(he),bt(se)],[bt(he+Ae),bt(se)],[bt(he+Ae),bt(se+ve)],[bt(he),bt(se+ve)]]],Se=Nn(ru.default.intersection(_e,S));if(!Se)continue;y.push({id:e.shapeId(ne),kind:"\
|
|
1757
1757
|
path",d:Se,style:_(ne,P.length),transform:v.transform,meta:e.meta(ne,ge)});continue}y.push({id:e.shapeId(ne),kind:"rect",x:bt(he),y:bt(se),w:bt(Ae),h:bt(ve),rx:0,style:_(ne,P.length),transform:v.transform,
|
|
1758
|
-
meta:e.meta(ne,ge)})}for(let F of E){let $=S?
|
|
1759
|
-
closed:!1,style:Q(he,E.length),transform:v.transform,meta:e.meta(he,["divider",`depth:${F.depth}`])})}}}),{out:V(y),lines:V(g)}}},
|
|
1758
|
+
meta:e.meta(ne,ge)})}for(let F of E){let $=S?xd(F.line,S):[F.line];for(let[W,G,oe,ce]of $){let he=g.length;g.push({id:e.shapeId(he,"line"),kind:"polyline",points:[{x:bt(W),y:bt(G)},{x:bt(oe),y:bt(ce)}],
|
|
1759
|
+
closed:!1,style:Q(he,E.length),transform:v.transform,meta:e.meta(he,["divider",`depth:${F.depth}`])})}}}),{out:V(y),lines:V(g)}}},kd={type:"offset",label:"Offset",category:"modifier",quickKey:"distanc\
|
|
1760
1760
|
e",description:"Grow or shrink outlines by a distance, in one or more bands \u2014 the multi-stroke word. Bands leave outermost first for a Merge to stack; the source leaves untouched on its own port.",
|
|
1761
1761
|
inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes",label:"bands"},{name:"source",type:"shapes",label:"source"}],params:[{key:"distance",label:"Distance",type:"number",default:8,step:.5,
|
|
1762
1762
|
unit:"px",description:"How far each band reaches past the one before. Negative shrinks inward."},{key:"count",label:"Bands",type:"int",default:1,min:1,max:16,description:"How many bands, each Distance\
|
|
@@ -1764,31 +1764,31 @@ unit:"px",description:"How far each band reaches past the one before. Negative s
|
|
|
1764
1764
|
Round hugs the shape; Miter keeps corners sharp (up to a 4\xD7 limit); Square chamfers them."},{key:"merge",label:"Merge Shapes",type:"bool",default:!0,description:"Fuse everything wired in into one s\
|
|
1765
1765
|
ilhouette before growing it, so letters share their bands. Off grows each shape on its own."},{key:"keepStyle",label:"Source Style",type:"bool",default:!1,description:"Bands wear the source\u2019s fill (or\
|
|
1766
1766
|
stroke) colour. Off = the Style block dresses them \u2014 or paint them downstream with Style Tokens in Cycle mode."},...Ye.map(e=>({...e,dimWhen:t=>Z(t.keepStyle).base!==!1}))],cook(e){let t=e.shapes(
|
|
1767
|
-
"in"),n=V(t);if(t.length===0)return{out:V([]),source:n};let r=e.num("distance"),i=Math.max(1,e.int("count")),s=e.enumOf("join",
|
|
1768
|
-
t.map(A=>({polys:
|
|
1767
|
+
"in"),n=V(t);if(t.length===0)return{out:V([]),source:n};let r=e.num("distance"),i=Math.max(1,e.int("count")),s=e.enumOf("join",ld),l=e.bool("keepStyle"),u=e.bool("merge")?[{polys:fr(t),style:t[0].style}]:
|
|
1768
|
+
t.map(A=>({polys:fr([A]),style:A.style})),h=[],f=i*u.length;for(let A=i;A>=1;A--)u.forEach((d,y)=>{if(d.polys.length===0)return;let g=Nn(tu(d.polys,r*A,s));if(!g)return;let x=h.length,v=d.style.fill,b=v!==
|
|
1769
1769
|
void 0&&v!=="none"?v:d.style.stroke&&d.style.stroke!=="none"?d.style.stroke:"#ffffff";h.push({id:e.shapeId(x),kind:"path",d:g,style:l?{...d.style,fill:b,stroke:"none",strokeWidth:0}:e.style(x,f),transform:be,
|
|
1770
1770
|
meta:e.meta(x,["offset",`band:${A}`,...u.length>1?[`group:${y}`]:[]])})});return{out:V(h),source:n}}};function Fr(e,t,n,r,i,s){return{id:e.shapeId(t),kind:"polyline",points:[n,r],closed:!1,style:i,transform:be,
|
|
1771
1771
|
meta:e.meta(t,s)}}var st=e=>Math.round(e*1e3)/1e3;function is(e,t,n,r,i){let s=n.map(([l,u])=>`M ${st(l.x)} ${st(l.y)} L ${st(u.x)} ${st(u.y)}`).join(" ");return{id:e.shapeId(t),kind:"path",d:s,style:r,
|
|
1772
|
-
transform:be,meta:e.meta(t,i)}}function
|
|
1772
|
+
transform:be,meta:e.meta(t,i)}}function Ed(e,t,n,r,i,s){if(r)return`M ${st(e+n)} ${st(t)} A ${st(n)} ${st(n)} 0 1 1 ${st(e-n)} ${st(t)} A ${st(n)} ${st(n)} 0 1 1 ${st(e+n)} ${st(t)}`;let l=Mt(e,t,n,i),
|
|
1773
1773
|
u=Mt(e,t,n,i+s),h=Math.abs(s)>180?1:0,f=s>=0?1:0;return`M ${st(l.x)} ${st(l.y)} A ${st(n)} ${st(n)} 0 ${h} ${f} ${st(u.x)} ${st(u.y)}`}var su={key:"subJoin",label:"One Path",type:"bool",default:!0,group:"\
|
|
1774
1774
|
Sub grid",description:"Draw the minors as one path per direction: a dense sub grid is then one shape, not hundreds. Off, every minor is its own shape \u2014 for Jitter, Select by index or Sub Out line by l\
|
|
1775
|
-
ine."};function
|
|
1775
|
+
ine."};function Sd(e){return Z(e.useSub).base===!0}var ei={name:"sub",type:"shapes",label:"sub",idleWhen:e=>!Sd(e)},ds={key:"useSub",label:"Use Sub Out",type:"bool",default:!1,group:"Sub grid",description:"\
|
|
1776
1776
|
Sends the minor lines out on the sub port alone, the majors leaving on out without them, so each grid can be styled, jittered or revealed on its own. Off, everything leaves on out and sub stays empty."},
|
|
1777
1777
|
au={...ds,group:void 0,description:"Sends the minor ticks out on the sub port alone, the majors leaving on out without them, so majors and minors can be styled, jittered or revealed on their own. Off,\
|
|
1778
|
-
every tick leaves on out and sub stays empty."},
|
|
1779
|
-
h.",inputs:[],outputs:[{name:"out",type:"shapes"},
|
|
1778
|
+
every tick leaves on out and sub stays empty."},Bd={type:"tick-ring",label:"Tick Ring",category:"generator",translate:[{x:"cx",y:"cy"}],description:"Ticks around a circle, with longer majors every Nt\
|
|
1779
|
+
h.",inputs:[],outputs:[{name:"out",type:"shapes"},ei],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},
|
|
1780
1780
|
{key:"radius",label:"Radius",type:"number",default:120,min:0,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:60,min:0,max:2e3,description:"Ticks around the ring. 0 = nothing \u2014 wire a \
|
|
1781
1781
|
Ramp or Seq in to grow it from empty."},{key:"start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:co},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,
|
|
1782
1782
|
unit:"deg"},{key:"offset",label:"Offset",type:"number",default:0,step:1,unit:"deg",description:"Slides the ticks round the sweep, wrapping: on a full ring they turn, on an arc a tick that leaves one e\
|
|
1783
1783
|
nd comes in at the other, majors staying major. Wire Time or an LFO here to make the gauge march; Start moves the arc itself."},{key:"length",label:"Length",type:"number",default:8,step:.5,unit:"px"},
|
|
1784
1784
|
{key:"majorEvery",label:"Major Every",type:"int",default:5,min:0,max:100},{key:"majorLength",label:"Major Length",type:"number",default:14,step:.5,unit:"px"},{key:"majorWidth",label:"Major Width",type:"\
|
|
1785
1785
|
number",default:1.5,min:0,step:.1,unit:"px"},au,{key:"align",label:"Align",type:"enum",default:"outward",options:[{value:"outward",label:"Outward"},{value:"inward",label:"Inward"},{value:"center",label:"\
|
|
1786
|
-
Centered"}]},...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(0,e.int("count"));if(r===0)return{out:V([]),sub:V([])};let i=
|
|
1786
|
+
Centered"}]},...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(0,e.int("count"));if(r===0)return{out:V([]),sub:V([])};let i=dr(e.num("start")),s=e.num("sweep"),l=e.int("majorEvery"),u=e.enumOf(
|
|
1787
1787
|
"align",["outward","inward","center"]),h=Math.abs(s)>=360,f=h?r:Math.max(1,r-1),A=e.num("offset"),d=s/f,y=h?360:Math.abs(s)+Math.abs(d),g=C=>{let M=d*C+A;if(A===0)return M;let S=(M%y+y)%y;if(h)return S;
|
|
1788
1788
|
let T=(Math.sign(s)*M%y+y)%y;if(!(T>Math.abs(s)+1e-9))return Math.sign(s)*T},x=e.bool("useSub"),v=[],b=[];for(let C=0;C<r;C++){let M=g(C);if(M===void 0)continue;let S=i+M,T=l>0&&C%l===0,P=e.num("radiu\
|
|
1789
1789
|
s",C,r,{angle:S}),E=T?e.num("majorLength",C,r,{angle:S}):e.num("length",C,r,{angle:S}),_=u==="outward"?P:u==="inward"?P-E:P-E/2,Q=_+E,Y=e.style(C,r);T&&(Y.strokeWidth=e.num("majorWidth",C,r,{angle:S})),
|
|
1790
|
-
(x&&!T?b:v).push(Fr(e,C,Mt(t,n,_,S),Mt(t,n,Q,S),Y,T?["major"]:["minor"]))}return{out:V(v),sub:V(b)}}},
|
|
1791
|
-
straight ruler of ticks, with longer majors every Nth.",inputs:[],outputs:[{name:"out",type:"shapes"},
|
|
1790
|
+
(x&&!T?b:v).push(Fr(e,C,Mt(t,n,_,S),Mt(t,n,Q,S),Y,T?["major"]:["minor"]))}return{out:V(v),sub:V(b)}}},Pd={type:"tick-row",label:"Tick Row",category:"generator",translate:[{x:"x",y:"y"}],description:"A\
|
|
1791
|
+
straight ruler of ticks, with longer majors every Nth.",inputs:[],outputs:[{name:"out",type:"shapes"},ei],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"\
|
|
1792
1792
|
number",default:0,step:.5,unit:"px"},{key:"span",label:"Span",type:"number",default:240,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:24,min:0,max:2e3,description:"Ticks along the r\
|
|
1793
1793
|
ow. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"deg"},{key:"offset",label:"Offset",type:"number",default:0,step:.5,
|
|
1794
1794
|
unit:"px",description:"Slides the ticks along the span, wrapping: a tick that runs off one end comes back in at the other, majors staying major. Wire Time or an LFO here to make the ruler march."},fs,
|
|
@@ -1798,13 +1798,13 @@ Up"},{value:"down",label:"Down"},{value:"center",label:"Centered"}]},...Ye],cook
|
|
|
1798
1798
|
i=e.int("majorEvery"),s=e.enumOf("align",["up","down","center"]),l=Math.cos(r),u=Math.sin(r),h=ps(e,t),f=e.num("x")-l*h,A=e.num("y")-u*h,d=-u,y=l,g=e.num("offset"),x=n===1?Math.abs(t):t/(n-1),v=Math.abs(
|
|
1799
1799
|
t)+Math.abs(x),b=T=>{let P=x*T+g;if(g===0)return P;let E=(Math.sign(t||1)*P%v+v)%v;if(!(E>Math.abs(t)+1e-9))return Math.sign(t||1)*E},C=e.bool("useSub"),M=[],S=[];for(let T=0;T<n;T++){let P=b(T);if(P===
|
|
1800
1800
|
void 0)continue;let E=i>0&&T%i===0,_=E?e.num("majorLength",T,n):e.num("length",T,n),Q={x:f+l*P,y:A+u*P},Y=s==="center"?-_/2:s==="up"?-_:0,F=Y+_,$=e.style(T,n);E&&($.strokeWidth=e.num("majorWidth",T,n)),
|
|
1801
|
-
(C&&!E?S:M).push(Fr(e,T,{x:Q.x+d*Y,y:Q.y+y*Y},{x:Q.x+d*F,y:Q.y+y*F},$,E?["major"]:["minor"]))}return{out:V(M),sub:V(S)}}},
|
|
1801
|
+
(C&&!E?S:M).push(Fr(e,T,{x:Q.x+d*Y,y:Q.y+y*Y},{x:Q.x+d*F,y:Q.y+y*F},$,E?["major"]:["minor"]))}return{out:V(M),sub:V(S)}}},_d={type:"crosshair",label:"Crosshair",category:"generator",translate:[{x:"cx",
|
|
1802
1802
|
y:"cy"}],description:"Four arms around a centre, with an optional gap and centre dot.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,
|
|
1803
1803
|
unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"size",label:"Size",type:"number",default:40,min:0,step:.5,unit:"px"},{key:"gap",label:"Gap",type:"number",default:8,
|
|
1804
1804
|
min:0,step:.5,unit:"px"},{key:"rotation",label:"Rotation",type:"number",default:0,step:1,unit:"deg"},{key:"dot",label:"Center Dot",type:"number",default:0,min:0,step:.5,unit:"px"},{key:"horizontal",label:"\
|
|
1805
1805
|
Horizontal",type:"bool",default:!0},{key:"vertical",label:"Vertical",type:"bool",default:!0},...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.num("size"),i=e.num("gap"),s=e.num("rotation"),l=e.num("\
|
|
1806
1806
|
dot"),u=[];e.bool("horizontal")&&u.push(0,180),e.bool("vertical")&&u.push(90,270);let h=u.map((f,A)=>Fr(e,A,Mt(t,n,i,f+s),Mt(t,n,i+r,f+s),e.style(A,u.length),["arm"]));return l>0&&h.push({id:e.shapeId(
|
|
1807
|
-
h.length),kind:"circle",cx:t,cy:n,r:l,style:{...e.style(),fill:e.color("stroke")},transform:be,meta:e.meta(h.length,["dot"])}),{out:V(h)}}},
|
|
1807
|
+
h.length),kind:"circle",cx:t,cy:n,r:l,style:{...e.style(),fill:e.color("stroke")},transform:be,meta:e.meta(h.length,["dot"])}),{out:V(h)}}},Md={type:"corner-brackets",label:"Corner Brackets",category:"\
|
|
1808
1808
|
generator",translate:[{x:"x",y:"y"}],description:"The four L-shaped corners of a frame, without the frame.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,
|
|
1809
1809
|
step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"w",label:"Width",type:"number",default:200,step:.5,unit:"px"},{key:"h",label:"Height",type:"number",default:140,step:.5,
|
|
1810
1810
|
unit:"px"},Dn,{key:"armX",label:"Arm X",type:"number",default:24,min:0,step:.5,unit:"px"},{key:"armY",label:"Arm Y",type:"number",default:24,min:0,step:.5,unit:"px"},{key:"inset",label:"Inset",type:"n\
|
|
@@ -1812,7 +1812,7 @@ umber",default:0,step:.5,unit:"px"},{key:"topLeft",label:"Top Left",type:"bool",
|
|
|
1812
1812
|
default:!0},{key:"bottomLeft",label:"Bottom Left",type:"bool",default:!0},...Ye],cook(e){let t=e.num("inset"),n=On(e,e.num("w"),e.num("h")),r=e.num("x")+n.dx+t,i=e.num("y")+n.dy+t,s=e.num("w")-t*2,l=e.
|
|
1813
1813
|
num("h")-t*2,u=e.num("armX"),h=e.num("armY"),A=[{on:e.bool("topLeft"),tag:"top-left",pts:[{x:r+u,y:i},{x:r,y:i},{x:r,y:i+h}]},{on:e.bool("topRight"),tag:"top-right",pts:[{x:r+s-u,y:i},{x:r+s,y:i},{x:r+
|
|
1814
1814
|
s,y:i+h}]},{on:e.bool("bottomRight"),tag:"bottom-right",pts:[{x:r+s,y:i+l-h},{x:r+s,y:i+l},{x:r+s-u,y:i+l}]},{on:e.bool("bottomLeft"),tag:"bottom-left",pts:[{x:r,y:i+l-h},{x:r,y:i+l},{x:r+u,y:i+l}]}].
|
|
1815
|
-
filter(y=>y.on),d=A.map((y,g)=>({id:e.shapeId(g),kind:"polyline",points:y.pts,closed:!1,style:e.style(g,A.length),transform:be,meta:e.meta(g,[y.tag])}));return{out:V(d)}}},
|
|
1815
|
+
filter(y=>y.on),d=A.map((y,g)=>({id:e.shapeId(g),kind:"polyline",points:y.pts,closed:!1,style:e.style(g,A.length),transform:be,meta:e.meta(g,[y.tag])}));return{out:V(d)}}},Td={type:"dot-matrix",label:"\
|
|
1816
1816
|
Dot Matrix",category:"generator",translate:[{x:"x",y:"y"}],description:"A grid of dots, thinnable by density for a scattered readout field.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"\
|
|
1817
1817
|
x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"cols",label:"Columns",type:"int",default:12,min:0,max:400,description:"0 = n\
|
|
1818
1818
|
othing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"rows",label:"Rows",type:"int",default:8,min:0,max:400,description:"0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},
|
|
@@ -1821,7 +1821,7 @@ min:0,step:.1,unit:"px"},{key:"density",label:"Density",type:"number",default:1,
|
|
|
1821
1821
|
ols")),n=Math.max(0,e.int("rows"));if(t===0||n===0)return{out:V([])};let r=On(e,(t-1)*e.num("stepX"),(n-1)*e.num("stepY")),i=e.num("x")+r.dx,s=e.num("y")+r.dy,l=e.num("density"),u=e.bool("square"),h=t*
|
|
1822
1822
|
n,f=e.rand("density"),A=[];for(let d=0;d<n;d++)for(let y=0;y<t;y++){let g=d*t+y;if(l<1&&f.next()>=l)continue;let x={col:y,row:d,cols:t,rows:n},v=i+y*e.num("stepX",g,h,x),b=s+d*e.num("stepY",g,h,x),C=e.
|
|
1823
1823
|
num("dot",g,h,x),M={...e.style(g,h),fill:e.color("stroke",g,h)};A.push(u?{id:e.shapeId(g),kind:"rect",x:v-C,y:b-C,w:C*2,h:C*2,rx:0,style:M,transform:be,meta:e.meta(g,["dot"])}:{id:e.shapeId(g),kind:"c\
|
|
1824
|
-
ircle",cx:v,cy:b,r:C,style:M,transform:be,meta:e.meta(g,["dot"])})}return{out:V(A)}}},
|
|
1824
|
+
ircle",cx:v,cy:b,r:C,style:M,transform:be,meta:e.meta(g,["dot"])})}return{out:V(A)}}},Rd={type:"bar-meter",label:"Bar Meter",category:"generator",translate:[{x:"x",y:"y"}],description:"A row of segmen\
|
|
1825
1825
|
ts with a filled portion \u2014 the readout bar.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",
|
|
1826
1826
|
default:0,step:.5,unit:"px"},{key:"count",label:"Segments",type:"int",default:20,min:0,max:500,description:"Cells in the bar. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"va\
|
|
1827
1827
|
lue",label:"Value",type:"number",default:.6,min:0,max:1,step:.01},{key:"segW",label:"Segment W",type:"number",default:4,min:0,step:.5,unit:"px"},{key:"segH",label:"Segment H",type:"number",default:16,
|
|
@@ -1829,7 +1829,7 @@ min:0,step:.5,unit:"px"},{key:"gap",label:"Gap",type:"number",default:3,min:0,st
|
|
|
1829
1829
|
type:"color",default:"#7fe8d0"},{key:"emptyColor",label:"Empty",type:"color",default:"#2a3a44"},...Ye],cook(e){let t=Math.max(0,e.int("count"));if(t===0)return{out:V([])};let n=e.num("value"),r=e.num(
|
|
1830
1830
|
"gap"),i=e.num("angle")*Math.PI/180,s=Math.cos(i),l=Math.sin(i),u=t*e.num("segW")+(t-1)*r,h=ps(e,u),f=e.num("x")-s*h,A=e.num("y")-l*h,d=e.color("fillColor"),y=e.color("emptyColor"),g=[],x=0;for(let v=0;v<
|
|
1831
1831
|
t;v++){let b=e.num("segW",v,t),C=e.num("segH",v,t),M=n>=(v+1)/t||v===0&&n>0,S={...e.style(v,t),fill:M?d:y,stroke:"none"};g.push({id:e.shapeId(v),kind:"rect",x:f+s*x,y:A+l*x-C/2,w:b,h:C,rx:0,style:S,transform:be,
|
|
1832
|
-
meta:e.meta(v,[M?"on":"off"])}),x+=b+r}return{out:V(g)}}},
|
|
1832
|
+
meta:e.meta(v,[M?"on":"off"])}),x+=b+r}return{out:V(g)}}},Qd={type:"polygon",label:"Polygon",category:"generator",translate:[{x:"cx",y:"cy"}],description:"A regular polygon \u2014 triangle markers, diamond\
|
|
1833
1833
|
s, hex frames.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,
|
|
1834
1834
|
unit:"px"},{key:"radius",label:"Radius",type:"number",default:40,min:0,step:.5,unit:"px"},{key:"sides",label:"Sides",type:"int",default:6,min:3,max:64},{key:"rotation",label:"Rotation",type:"number",default:-90,
|
|
1835
1835
|
step:1,unit:"deg"},{key:"cornerRadius",label:"Corner Radius",type:"number",default:0,min:0,step:.5,unit:"px",description:"Rounds every corner with a circular fillet, clamped to what the edges can carr\
|
|
@@ -1838,8 +1838,8 @@ round(f*1e3)/1e3,h=[];for(let f=0;f<r;f++){let A=s[(f-1+r)%r],d=s[f],y=s[(f+1)%r
|
|
|
1838
1838
|
y)/(v*b):1,M=Math.acos(Math.min(1,Math.max(-1,C))),S=Math.tan(M/2),T=e.num("cornerRadius",f,r),P=S>1e-6?Math.min(T/S,Math.min(v,b)/2):0;if(v===0||b===0||P<=.001){h.push(`${h.length===0?"M":"L"}${u(d.x)}\
|
|
1839
1839
|
${u(d.y)}`);continue}let E=P*S,_={x:d.x-g.x/v*P,y:d.y-g.y/v*P},Q={x:d.x+x.x/b*P,y:d.y+x.y/b*P},Y=g.x*x.y-g.y*x.x>0?1:0;h.push(`${h.length===0?"M":"L"}${u(_.x)} ${u(_.y)}`,`A${u(E)} ${u(E)} 0 0 ${Y} ${u(
|
|
1840
1840
|
Q.x)} ${u(Q.y)}`)}return{out:V([{id:e.shapeId(0),kind:"path",d:`${h.join("")}Z`,style:e.style(),transform:be,meta:e.meta(0)}])}}return{out:V([{id:e.shapeId(0),kind:"polyline",points:s,closed:!0,style:e.
|
|
1841
|
-
style(),transform:be,meta:e.meta(0)}])}}};function to(e){return Z(e.fullscreen).base===!0}function gl(e){return Z(e.square).base===!0}var
|
|
1842
|
-
x:"x",y:"y"}],description:"Blueprint grid: major cell lines, optionally subdivided by fainter minors. The main cell size leaves as numbers.",inputs:[],outputs:[{name:"out",type:"shapes"},
|
|
1841
|
+
style(),transform:be,meta:e.meta(0)}])}}};function to(e){return Z(e.fullscreen).base===!0}function gl(e){return Z(e.square).base===!0}var Nd={type:"grid",label:"Grid",category:"generator",translate:[{
|
|
1842
|
+
x:"x",y:"y"}],description:"Blueprint grid: major cell lines, optionally subdivided by fainter minors. The main cell size leaves as numbers.",inputs:[],outputs:[{name:"out",type:"shapes"},ei,{name:"cel\
|
|
1843
1843
|
lW",type:"number",label:"cell w"},{name:"cellH",type:"number",label:"cell h"}],params:[{key:"fullscreen",label:"Fill Canvas",type:"bool",default:!1,group:"Frame",description:"Match the document exactl\
|
|
1844
1844
|
y \u2014 X/Y/Width/Height are ignored, and a canvas resize follows through."},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:to},{key:"y",label:"Y",type:"number",default:0,
|
|
1845
1845
|
step:.5,unit:"px",group:"Frame",dimWhen:to},{key:"w",label:"Width",type:"number",default:400,min:0,step:1,unit:"px",group:"Frame",dimWhen:to},{key:"h",label:"Height",type:"number",default:300,min:0,step:1,
|
|
@@ -1862,62 +1862,62 @@ W.push(ce(ne,oe,e.style(oe,$),["major","v"])),oe++;for(let ne of E)W.push(he(ne,
|
|
|
1862
1862
|
$),_e.opacity=(_e.opacity??1)*e.num("subOpacity",ge,$),_e};if(Y)_.length>0&&(G.push(is(e,oe,_.map(ge=>[{x:ge,y:l},{x:ge,y:l+r}]),ne(oe),["minor","v"])),oe++),Q.length>0&&(G.push(is(e,oe,Q.map(ge=>[{x:s,
|
|
1863
1863
|
y:ge},{x:s+n,y:ge}]),ne(oe),["minor","h"])),oe++);else{for(let ge of _)G.push(ce(ge,oe,ne(oe),["minor","v"])),oe++;for(let ge of Q)G.push(he(ge,oe,ne(oe),["minor","h"])),oe++}}let se=e.bool("useSub"),
|
|
1864
1864
|
Ae=se?[...W]:[...G,...W],ve=e.color("fill",$,$+1);return ve&&ve!=="none"&&Ae.unshift({id:e.shapeId($),kind:"rect",x:s,y:l,w:n,h:r,rx:0,style:{fill:ve,stroke:"none",opacity:e.num("opacity",$,$+1)},transform:be,
|
|
1865
|
-
meta:e.meta($,["paper"])}),{out:V(Ae),sub:V(se?G:[]),cellW:Te(A),cellH:Te(M)}}},
|
|
1866
|
-
concentric rings and spokes, optionally subdivided by fainter minors.",inputs:[],outputs:[{name:"out",type:"shapes"},
|
|
1865
|
+
meta:e.meta($,["paper"])}),{out:V(Ae),sub:V(se?G:[]),cellW:Te(A),cellH:Te(M)}}},Dd={type:"polar-grid",label:"Grid Polar",category:"generator",translate:[{x:"cx",y:"cy"}],description:"Radar-scope grid:\
|
|
1866
|
+
concentric rings and spokes, optionally subdivided by fainter minors.",inputs:[],outputs:[{name:"out",type:"shapes"},ei],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px",group:"\
|
|
1867
1867
|
Frame"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px",group:"Frame"},{key:"radius",label:"Radius",type:"number",default:180,min:0,step:.5,unit:"px",group:"Frame"},{key:"innerRad\
|
|
1868
1868
|
ius",label:"Inner Radius",type:"number",default:0,min:0,step:.5,unit:"px",group:"Frame"},{key:"rings",label:"Rings",type:"int",default:4,min:1,max:200,group:"Cells"},{key:"spokes",label:"Spokes",type:"\
|
|
1869
1869
|
int",default:8,min:0,max:500,group:"Cells",description:"0 = rings only."},{key:"start",label:"Start",type:"number",default:0,step:1,unit:"deg",group:"Cells",description:co},{key:"sweep",label:"Sweep",
|
|
1870
1870
|
type:"number",default:360,min:-360,max:360,step:1,unit:"deg",group:"Cells"},{key:"subdivisions",label:"Subdivisions",type:"int",default:0,min:0,max:20,group:"Sub grid",description:"minor rings and spo\
|
|
1871
1871
|
kes per cell; 0 or 1 = off"},{key:"subWidth",label:"Sub Width",type:"number",default:.5,min:0,step:.1,unit:"px",group:"Sub grid"},{key:"subOpacity",label:"Sub Opacity",type:"number",default:.35,min:0,
|
|
1872
|
-
max:1,step:.01,group:"Sub grid"},su,ds,...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.num("radius"),i=Math.min(e.num("innerRadius"),r),s=Math.max(1,e.int("rings")),l=Math.max(0,e.int("spokes")),u=
|
|
1872
|
+
max:1,step:.01,group:"Sub grid"},su,ds,...Ye],cook(e){let t=e.num("cx"),n=e.num("cy"),r=e.num("radius"),i=Math.min(e.num("innerRadius"),r),s=Math.max(1,e.int("rings")),l=Math.max(0,e.int("spokes")),u=dr(
|
|
1873
1873
|
e.num("start")),h=e.num("sweep"),f=e.int("subdivisions"),A=f>1?f-1:0,d=Math.abs(h)>=360,y=l===0?0:d?l:l+1,g=(r-i)/s,x=A>0&&e.bool("subJoin"),v=x?(s>0?1:0)+(l>0?1:0):A*(s+l),b=s+1+y+v,C=[],M=[],S=0,T=(_,Q,Y,F)=>{
|
|
1874
1874
|
if(_<=0)return;let $={id:e.shapeId(Q),style:Y,transform:be,meta:e.meta(Q,F)};return d?{...$,kind:"circle",cx:t,cy:n,r:_}:{...$,kind:"arc",cx:t,cy:n,r:_,a0:u,a1:u+h}},P=(_,Q,Y,F)=>Fr(e,Q,Mt(t,n,i,_),Mt(
|
|
1875
1875
|
t,n,r,_),Y,F);for(let _=0;_<=s;_++){let Q=T(i+_*g,S,e.style(S,b),["major","ring"]);Q&&C.push(Q),S++}for(let _=0;_<y;_++)C.push(P(u+h*_/l,S,e.style(S,b),["major","spoke"])),S++;if(A>0){let _=Q=>{let Y=e.
|
|
1876
1876
|
style(Q,b);return Y.strokeWidth=e.num("subWidth",Q,b),Y.opacity=(Y.opacity??1)*e.num("subOpacity",Q,b),Y};if(x){let Q=[];for(let F=0;F<s;F++)for(let $=1;$<=A;$++)Q.push(i+(F+$/f)*g);let Y=Q.filter(F=>F>
|
|
1877
|
-
0);if(s>0){if(Y.length>0){let F=Y.map($=>
|
|
1877
|
+
0);if(s>0){if(Y.length>0){let F=Y.map($=>Ed(t,n,$,d,u,h)).join(" ");M.push({id:e.shapeId(S),kind:"path",d:F,style:_(S),transform:be,meta:e.meta(S,["minor","ring"])})}S++}if(l>0){let F=[];for(let $=0;$<
|
|
1878
1878
|
l;$++)for(let W=1;W<=A;W++){let G=u+h*($+W/f)/l;F.push([Mt(t,n,i,G),Mt(t,n,r,G)])}M.push(is(e,S,F,_(S),["minor","spoke"])),S++}}else{for(let Q=0;Q<s;Q++)for(let Y=1;Y<=A;Y++){let F=T(i+(Q+Y/f)*g,S,_(S),
|
|
1879
1879
|
["minor","ring"]);F&&M.push(F),S++}for(let Q=0;Q<l;Q++)for(let Y=1;Y<=A;Y++)M.push(P(u+h*(Q+Y/f)/l,S,_(S),["minor","spoke"])),S++}}let E=e.bool("useSub");return{out:V(E?C:[...M,...C]),sub:V(E?M:[])}}},
|
|
1880
|
-
|
|
1881
|
-
function lo(e){let t=gn(e);return eo(e)?`bitmap ${t} px`:t?`pixel ${t} px`:yn(e)||
|
|
1882
|
-
max(1,Math.round(t/n))*n:t}var
|
|
1883
|
-
SemiBold"},{value:"700",label:"Bold"},{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],
|
|
1880
|
+
Od=[Nd,Dd,Bd,Pd,_d,Md,Td,Rd,Qd];var Ld=[{value:"start",label:"Start"},{value:"middle",label:"Middle"},{value:"end",label:"End"}],Fd=[{value:"baseline",label:"Baseline"},{value:"middle",label:"Middle"},{value:"top",label:"Top"}],Yd=.7;
|
|
1881
|
+
function lo(e){let t=gn(e);return eo(e)?`bitmap ${t} px`:t?`pixel ${t} px`:yn(e)||ur(e)?"variable":"outline"}var bl=e=>({value:e,label:`${e} \xB7 ${lo(e)}`});function ti(e,t){let n=gn(e);return n?Math.
|
|
1882
|
+
max(1,Math.round(t/n))*n:t}var Ji=[{value:"100",label:"Thin"},{value:"200",label:"ExtraLight"},{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"\
|
|
1883
|
+
SemiBold"},{value:"700",label:"Bold"},{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],ni=[{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Mn.map(bl),optionsFor:()=>lr().map(
|
|
1884
1884
|
bl),description:"Bundled families render everywhere. Add your own under Settings \u203A Fonts; a machine without that font shows IBM Plex Mono instead. A pixel face (Silkscreen, Press Start 2P, the Fixed b\
|
|
1885
1885
|
itmaps) is drawn for small LCD screens: it is held to whole multiples of its grid and sits on whole pixels.",group:"Type"},{key:"fontSize",label:"Size",type:"number",default:12,min:1,step:.5,unit:"px",
|
|
1886
|
-
group:"Type",description:"In px. A pixel face rounds to the nearest multiple of its grid: 12 px of Silkscreen draws at 16, 11 at 8."},{key:"fontWeight",label:"Weight",type:"enum",default:"400",options:
|
|
1887
|
-
optionsFor:e=>{let t=gt(String(Z(e.fontFamily).base??"")).family,n=new Set(Rn(t).map(String)),r=
|
|
1886
|
+
group:"Type",description:"In px. A pixel face rounds to the nearest multiple of its grid: 12 px of Silkscreen draws at 16, 11 at 8."},{key:"fontWeight",label:"Weight",type:"enum",default:"400",options:Ji,
|
|
1887
|
+
optionsFor:e=>{let t=gt(String(Z(e.fontFamily).base??"")).family,n=new Set(Rn(t).map(String)),r=Ji.filter(i=>n.has(i.value));return r.length>0?r:Ji},rangeFor:e=>yn(gt(String(Z(e.fontFamily).base??"")).
|
|
1888
1888
|
family),description:"Only the weights the chosen family ships. A variable font takes any weight in its range.",group:"Type"},{key:"fontStretch",label:"Stretch",type:"number",default:100,min:50,max:200,
|
|
1889
|
-
step:1,unit:"%",group:"Type",dimWhen:e=>
|
|
1889
|
+
step:1,unit:"%",group:"Type",dimWhen:e=>ur(gt(String(Z(e.fontFamily).base??"")).family)===void 0,description:"The width axis of a variable font, in percent of normal \u2014 Tektur goes from 75 to 100. Any \
|
|
1890
1890
|
other family keeps its width. Wire an LFO in and the word squeezes to fit."},{key:"letterSpacing",label:"Tracking",type:"number",default:0,step:.1,unit:"px",group:"Type"},{key:"outlines",label:"Outlin\
|
|
1891
1891
|
e to Path",type:"bool",default:!1,group:"Type",description:"Turn each glyph into a real vector path, so geometry nodes \u2014 Slice, Boolean, Partial Outline, draw-on Reveal \u2014 can cut and trace the letterf\
|
|
1892
1892
|
orms. Flips on by itself when you wire into one. Costs more than native text. Not the Stroke under Style, which is the coloured line around the glyphs. A bitmap face (Fixed) is drawn as a path either \
|
|
1893
|
-
way, each lit pixel a square; off, it stays text through the graph for Split Glyphs and Text on Path."},{key:"anchor",label:"Anchor",type:"enum",default:"start",options:
|
|
1894
|
-
label:"Vertical",type:"enum",default:"baseline",options:
|
|
1895
|
-
e font\u2019s cap height rather than the text, so the line stays put while the words change."}],
|
|
1896
|
-
"anchor"||e.key==="vAnchor"?{...e,default:"middle"}:e);function
|
|
1893
|
+
way, each lit pixel a square; off, it stays text through the graph for Split Glyphs and Text on Path."},{key:"anchor",label:"Anchor",type:"enum",default:"start",options:Ld,group:"Type"},{key:"vAnchor",
|
|
1894
|
+
label:"Vertical",type:"enum",default:"baseline",options:Fd,group:"Type",description:"Where Y sits on the letters: on the baseline, through the middle of the capitals, or at their top. Measured from th\
|
|
1895
|
+
e font\u2019s cap height rather than the text, so the line stays put while the words change."}],Xd=ni.map(e=>e.key==="fontFamily"?{...e,default:"Rajdhani"}:e.key==="fontSize"?{...e,default:80}:e.key===
|
|
1896
|
+
"anchor"||e.key==="vAnchor"?{...e,default:"middle"}:e);function Wd(e,t,n){let r=e.style(t,n);return r.strokeWidth&&r.strokeWidth>0?r:{...r,stroke:"none"}}var no=e=>Ye.find(t=>t.key===e),ho=[{...no("fi\
|
|
1897
1897
|
ll"),default:"#ffffff",description:"The text colour \u2014 paints the glyphs. Pick none for stroke-only linework."},{...no("stroke"),default:"none",description:"Stroke colour around the glyphs \u2014 none \
|
|
1898
1898
|
by default; pick one and raise Width for an outline."},{...no("strokeWidth"),default:0,description:"Stroke thickness. 0 = no stroke."},no("opacity"),no("dash")],As=[{value:"scramble",label:"Scramble"},
|
|
1899
1899
|
{value:"typewriter",label:"Typewriter"},{value:"flicker",label:"Flicker"},{value:"cut-word",label:"Cut Word"},{value:"cut-char",label:"Cut Character"}],ss="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&*+<>\
|
|
1900
|
-
/=";function lu(e,t){let{mode:n,step:r,alphabet:i}=t,s=Math.max(0,t.reveal);if(s>=1)return e;if(n==="cut-word"||n==="cut-char")return
|
|
1901
|
-
s*u+1e-9),f=0;return e.map(A=>[...A].map(d=>{let y=f++;return y<h||d===" "?d:n==="typewriter"?"":n==="flicker"?t.rand(y,r).next()<s?d:" ":l.length>0?l[t.rand(y,r).int(0,l.length)]:d}).join(""))}function
|
|
1900
|
+
/=";function lu(e,t){let{mode:n,step:r,alphabet:i}=t,s=Math.max(0,t.reveal);if(s>=1)return e;if(n==="cut-word"||n==="cut-char")return qd(e,s,n);let l=[...i],u=e.reduce((A,d)=>A+d.length,0),h=Math.floor(
|
|
1901
|
+
s*u+1e-9),f=0;return e.map(A=>[...A].map(d=>{let y=f++;return y<h||d===" "?d:n==="typewriter"?"":n==="flicker"?t.rand(y,r).next()<s?d:" ":l.length>0?l[t.rand(y,r).int(0,l.length)]:d}).join(""))}function Gd(e,t){
|
|
1902
1902
|
let n=Math.max(0,Math.min(1,e.num("reveal")));if(n>=1)return t;let r=e.enumOf("revealMode",["scramble","typewriter","flicker","cut-word","cut-char"]);return lu(t,{reveal:n,mode:r,step:Math.floor(e.t*20),
|
|
1903
|
-
alphabet:ss,rand:(i,s)=>e.rand("decode",i,s)})}function
|
|
1903
|
+
alphabet:ss,rand:(i,s)=>e.rand("decode",i,s)})}function qd(e,t,n){let r=e.map(h=>[...h]),i=[],s;if(r.forEach((h,f)=>{h.forEach((A,d)=>{if(A===" "){s=void 0;return}(n==="cut-char"||!s)&&(s=[],i.push(s)),
|
|
1904
1904
|
s.push([f,d])}),s=void 0}),i.length===0)return e;let l=Math.min(i.length-1,Math.floor(t*i.length+1e-9)),u=new Set(i[l].map(([h,f])=>`${h}:${f}`));return r.map((h,f)=>h.map((A,d)=>A===" "||u.has(`${f}:${d}`)?
|
|
1905
|
-
A:" ").join(""))}function
|
|
1906
|
-
x:s,y:l,rotation:u=0,family:h,weight:f,anchor:A}=r,d=ln(h,r.stretch??100),y=gn(h),g=
|
|
1907
|
-
cos(C),S=Math.sin(C),T=e.outline?.measure?.({text:i,family:h,weight:f,stretch:d,size:g,letterSpacing:x}),P=T?.capHeight??g*
|
|
1905
|
+
A:" ").join(""))}function Ud(e){let t=Z(e.reveal).base,n=Z(e.revealMode).base??"scramble";return typeof t=="number"&&t<1&&n!=="typewriter"&&n!=="cut-word"&&n!=="cut-char"}function fo(e,t,n,r){let{text:i,
|
|
1906
|
+
x:s,y:l,rotation:u=0,family:h,weight:f,anchor:A}=r,d=ln(h,r.stretch??100),y=gn(h),g=ti(h,r.fontSize),x=y?Math.round(r.letterSpacing):r.letterSpacing,v=y!==void 0&&u===0,b=Wd(e,t,n),C=u*Math.PI/180,M=Math.
|
|
1907
|
+
cos(C),S=Math.sin(C),T=e.outline?.measure?.({text:i,family:h,weight:f,stretch:d,size:g,letterSpacing:x}),P=T?.capHeight??g*Yd,E=e.enumOf("vAnchor",["baseline","middle","top"]),_=E==="middle"?P/2:E==="\
|
|
1908
1908
|
top"?P:0,Q=e.bool("outlines")?e.outline:void 0;if(Q){let W=Q({text:i,family:h,weight:f,stretch:d,size:g,letterSpacing:x});if(W){let G=A==="middle"?-W.width/2:A==="end"?-W.width:0,oe=v?Math.round(s+G):
|
|
1909
1909
|
s+G*M-_*S,ce=v?Math.round(l+_):l+G*S+_*M;return{id:e.shapeId(t),kind:"path",d:W.d,style:b,transform:[M,S,-S,M,oe,ce],meta:e.meta(t,[...r.tags??[],"glyphs"])}}}let Y=T?A==="middle"?-T.width/2:A==="end"?
|
|
1910
1910
|
-T.width:0:0,F=v?s+(Math.round(s+Y)-(s+Y)):s,$=v?Math.round(l+_):l+_;return{id:e.shapeId(t),kind:"text",x:F,y:$,text:i,fontSize:g,fontFamily:h,fontWeight:f,...d!==100?{fontStretch:d}:{},anchor:A,letterSpacing:x,
|
|
1911
|
-
...T?{metrics:{width:T.width,capHeight:P}}:{},style:b,transform:u===0?be:[M,S,-S,M,s-M*s+S*l,l-S*s-M*l],meta:e.meta(t,r.tags)}}var
|
|
1912
|
-
y"}],description:"A line of text. Multi-line splits on newlines.",quickKey:"reveal",timeRoot:
|
|
1911
|
+
...T?{metrics:{width:T.width,capHeight:P}}:{},style:b,transform:u===0?be:[M,S,-S,M,s-M*s+S*l,l-S*s-M*l],meta:e.meta(t,r.tags)}}var Hd={type:"text",label:"Text",category:"generator",translate:[{x:"x",y:"\
|
|
1912
|
+
y"}],description:"A line of text. Multi-line splits on newlines.",quickKey:"reveal",timeRoot:Ud,inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"text",label:"Text",type:"string",default:"R\
|
|
1913
1913
|
EADY",multiline:!0,glyphs:!0},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px"},{key:"lineHeight",label:"Line Height",type:"nu\
|
|
1914
1914
|
mber",default:1.4,min:0,step:.05},{key:"uppercase",label:"Uppercase",type:"bool",default:!1},{key:"reveal",label:"Reveal",type:"number",default:1,max:1,step:.01,group:"Decode",description:"Characters \
|
|
1915
1915
|
resolve left to right from 0 to 1. Below 0 nothing has resolved yet and the scramble keeps boiling, so a ramp from \u22121 holds the noise twice as long before the first letter lands. Wire from a Seq, or p\
|
|
1916
1916
|
ress i to keyframe."},{key:"revealMode",label:"Decode",type:"enum",default:"scramble",options:[...As],group:"Decode",description:"What unresolved characters do while Reveal is below 1. Cut Word / Cut \
|
|
1917
|
-
Character show one piece at a time instead \u2014 a saw LFO on Reveal flashes through them."},...
|
|
1918
|
-
`)),i=e.num("x"),s=e.num("y"),l=gt(e.str("fontFamily")).family,u=Tt(l,Number(e.str("fontWeight"))||400),h=
|
|
1917
|
+
Character show one piece at a time instead \u2014 a saw LFO on Reveal flashes through them."},...Xd,...ho],cook(e){let t=e.str("text"),n=e.bool("uppercase")?t.toUpperCase():t,r=Gd(e,n.split(`
|
|
1918
|
+
`)),i=e.num("x"),s=e.num("y"),l=gt(e.str("fontFamily")).family,u=Tt(l,Number(e.str("fontWeight"))||400),h=ti(l,e.num("fontSize")),f=e.num("lineHeight"),A=e.enumOf("anchor",["start","middle","end"]),d=r.
|
|
1919
1919
|
map((y,g)=>fo(e,g,r.length,{text:y,x:i+e.num("x",g,r.length)-i,y:s+g*h*f,family:l,weight:u,stretch:e.num("fontStretch",g,r.length),fontSize:h,letterSpacing:e.num("letterSpacing",g,r.length),anchor:A}));
|
|
1920
|
-
return{out:V(d)}}},Rr={hex:"0123456789ABCDEF",digits:"0123456789",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alnum:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",binary:"01"}
|
|
1920
|
+
return{out:V(d)}}},Rr={hex:"0123456789ABCDEF",digits:"0123456789",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alnum:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",binary:"01"},$d={type:"random-code",label:"Random Code",
|
|
1921
1921
|
category:"generator",translate:[{x:"x",y:"y"}],description:"Seeded serials and readouts \u2014 stable for a seed, rerolled with it.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",
|
|
1922
1922
|
label:"Count",type:"int",default:6,min:1,max:500},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the text on every whole step \u2014 fractions are ignored, so a driver ticks r\
|
|
1923
1923
|
ather than boils. Wire Time in for one reroll a second (an expr like t*8 for eight), a Seq to reroll on cue, or a saw LFO spanning 0\u201310 for ten a cycle. 0 = the node\u2019s own stream."},{key:"x",
|
|
@@ -1925,34 +1925,34 @@ label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"nu
|
|
|
1925
1925
|
Step Y",type:"number",default:16,step:.5,unit:"px"},{...Dn,key:"stackAnchor",label:"Stack Anchor",description:"The point of the stack of lines that X/Y places. Auto follows the canvas origin: centre-o\
|
|
1926
1926
|
rigin documents centre the stack on X/Y, top-left documents hang it down and right."},{key:"pattern",label:"Pattern",type:"string",default:"AA#-#####",description:"A = letter, # = digit, X = alphabet \
|
|
1927
1927
|
char, anything else is literal.",exposable:!1},{key:"alphabet",label:"Alphabet",type:"enum",default:"hex",options:Object.keys(Rr).map(e=>({value:e,label:e})),description:"What an X in the pattern draw\
|
|
1928
|
-
s from. A and # always mean letter and digit.",dimWhen:e=>!String(Z(e.pattern).base??"").includes("X")},...
|
|
1928
|
+
s from. A and # always mean letter and digit.",dimWhen:e=>!String(Z(e.pattern).base??"").includes("X")},...ni,...ho],cook(e){let t=Math.max(1,e.int("count")),n=On(e,(t-1)*e.num("stepX"),(t-1)*e.num("s\
|
|
1929
1929
|
tepY"),"stackAnchor"),r=e.num("x")+n.dx,i=e.num("y")+n.dy,s=e.str("pattern"),l=Rr[e.enumOf("alphabet",Object.keys(Rr))]??Rr.hex,u=e.num("fontSize"),h=e.enumOf("anchor",["start","middle","end"]),f=gt(e.
|
|
1930
1930
|
str("fontFamily")).family,A=Tt(f,Number(e.str("fontWeight"))||400),d=[];for(let y=0;y<t;y++){let g=Math.floor(e.num("seed",y,t)),x=g===0?e.rand("code",y):e.rand("code",g,y),v="";for(let b of s)b==="A"?
|
|
1931
1931
|
v+=Rr.upper[x.int(0,26)]:b==="#"?v+=Rr.digits[x.int(0,10)]:b==="X"?v+=l[x.int(0,l.length)]:v+=b;d.push(fo(e,y,t,{text:v,x:r+y*e.num("stepX",y,t),y:i+y*e.num("stepY",y,t),family:f,weight:A,stretch:e.num(
|
|
1932
|
-
"fontStretch",y,t),fontSize:u,letterSpacing:e.num("letterSpacing",y,t),anchor:h}))}return{out:V(d)}}}
|
|
1932
|
+
"fontStretch",y,t),fontSize:u,letterSpacing:e.num("letterSpacing",y,t),anchor:h}))}return{out:V(d)}}},zd={type:"radial-labels",label:"Radial Labels",category:"generator",translate:[{x:"cx",y:"cy"}],description:"\
|
|
1933
1933
|
Numbers around a ring \u2014 the scale on a dial.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center \
|
|
1934
1934
|
Y",type:"number",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:150,min:0,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:8,min:1,max:200},{key:"start",
|
|
1935
1935
|
label:"Start",type:"number",default:0,step:1,unit:"deg",description:co},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg"},{key:"from",label:"From",type:"number",
|
|
1936
1936
|
default:0,step:1},{key:"to",label:"To",type:"number",default:100,step:1},{key:"decimals",label:"Decimals",type:"int",default:0,min:0,max:4},{key:"prefix",label:"Prefix",type:"string",default:"",exposable:!1},
|
|
1937
1937
|
{key:"suffix",label:"Suffix",type:"string",default:"",exposable:!1},{key:"orient",label:"Orient",type:"enum",default:"upright",options:[{value:"upright",label:"Upright"},{value:"radial",label:"Radial"},
|
|
1938
|
-
{value:"tangent",label:"Tangential"}]},...
|
|
1938
|
+
{value:"tangent",label:"Tangential"}]},...ni,...ho],cook(e){let t=e.num("cx"),n=e.num("cy"),r=Math.max(1,e.int("count")),i=dr(e.num("start")),s=e.num("sweep"),l=e.num("from"),u=e.num("to"),h=e.int("de\
|
|
1939
1939
|
cimals"),f=e.str("prefix"),A=e.str("suffix"),d=e.enumOf("orient",["upright","radial","tangent"]),y=gt(e.str("fontFamily")).family,g=Tt(y,Number(e.str("fontWeight"))||400),v=Math.abs(s)>=360?r:Math.max(
|
|
1940
1940
|
1,r-1),b=[];for(let C=0;C<r;C++){let M=C/v,S=i+s*M,T=e.num("radius",C,r,{angle:S}),P=Mt(t,n,T,S),E=l+(u-l)*(r===1?0:C/Math.max(1,r-1)),_=d==="radial"?S:d==="tangent"?S+90:0;b.push(fo(e,C,r,{text:f+E.toFixed(
|
|
1941
1941
|
h)+A,x:P.x,y:P.y,rotation:_,family:y,weight:g,stretch:e.num("fontStretch",C,r),fontSize:e.num("fontSize",C,r),letterSpacing:e.num("letterSpacing",C,r),anchor:e.enumOf("anchor",["start","middle","end"]),
|
|
1942
|
-
tags:["label"]}))}return{out:V(b)}}},
|
|
1942
|
+
tags:["label"]}))}return{out:V(b)}}},jd={type:"row-labels",label:"Row Labels",category:"generator",translate:[{x:"x",y:"y"}],description:"Numbers along a line \u2014 the scale under a Tick Row. Same X/Y/Sp\
|
|
1943
1943
|
an/Angle and it lines up.",inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px"},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"\
|
|
1944
1944
|
px"},{key:"span",label:"Span",type:"number",default:240,step:.5,unit:"px"},{key:"count",label:"Count",type:"int",default:5,min:1,max:200},{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"\
|
|
1945
1945
|
deg"},{...fs,key:"spanAnchor",label:"Span Anchor"},{key:"gap",label:"Gap",type:"number",default:16,step:.5,unit:"px",description:"Perpendicular distance from the line \u2014 positive sits below a horizonta\
|
|
1946
1946
|
l row, negative above."},{key:"from",label:"From",type:"number",default:0,step:1},{key:"to",label:"To",type:"number",default:100,step:1},{key:"decimals",label:"Decimals",type:"int",default:0,min:0,max:4},
|
|
1947
1947
|
{key:"prefix",label:"Prefix",type:"string",default:"",exposable:!1},{key:"suffix",label:"Suffix",type:"string",default:"",exposable:!1},{key:"orient",label:"Orient",type:"enum",default:"upright",options:[
|
|
1948
|
-
{value:"upright",label:"Upright"},{value:"along",label:"Along the line"}]},...
|
|
1948
|
+
{value:"upright",label:"Upright"},{value:"along",label:"Along the line"}]},...ni.map(e=>e.key==="anchor"?{...e,default:"middle"}:e),...ho],cook(e){let t=e.num("span"),n=Math.max(1,e.int("count")),r=e.
|
|
1949
1949
|
num("angle"),i=r*Math.PI/180,s=Math.cos(i),l=Math.sin(i),u=ps(e,t,"spanAnchor"),h=e.num("x")-s*u,f=e.num("y")-l*u,A=e.num("gap"),d=e.num("from"),y=e.num("to"),g=e.int("decimals"),x=e.str("prefix"),v=e.
|
|
1950
1950
|
str("suffix"),b=e.enumOf("orient",["upright","along"]),C=gt(e.str("fontFamily")).family,M=Tt(C,Number(e.str("fontWeight"))||400),S=[];for(let T=0;T<n;T++){let P=n===1?0:T/(n-1),E=h+s*t*P-l*A,_=f+l*t*P+
|
|
1951
1951
|
s*A,Q=d+(y-d)*P;S.push(fo(e,T,n,{text:x+Q.toFixed(g)+v,x:E,y:_,rotation:b==="along"?r:0,family:C,weight:M,stretch:e.num("fontStretch",T,n),fontSize:e.num("fontSize",T,n),letterSpacing:e.num("letterSpa\
|
|
1952
|
-
cing",T,n),anchor:e.enumOf("anchor",["start","middle","end"]),tags:["label"]}))}return{out:V(S)}}},
|
|
1952
|
+
cing",T,n),anchor:e.enumOf("anchor",["start","middle","end"]),tags:["label"]}))}return{out:V(S)}}},Vd=[Hd,$d,zd,jd];function Jd(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2}var uu=.6;function Zd(e,t,n,r){if(t){let i=(r%n+n)%n;return{p:rr(e,i,!0),t:sr(e,i,!0)}}if(r<
|
|
1953
1953
|
0){let i=sr(e,0),s=e[0];return{p:{x:s.x+i.x*r,y:s.y+i.y*r},t:i}}if(r>n){let i=sr(e,n),s=e[e.length-1],l=r-n;return{p:{x:s.x+i.x*l,y:s.y+i.y*l},t:i}}return{p:rr(e,r),t:sr(e,r)}}function cu(e,t){let n=t.
|
|
1954
1954
|
fontFamily,r=t.fontWeight??400,i={text:t.text,family:n,weight:r,stretch:t.fontStretch,size:t.fontSize,letterSpacing:t.letterSpacing},s=e.outline?.glyphs?.(i);if(s)return{run:s,outlined:!0};let l=t.fontSize*
|
|
1955
|
-
uu,u=[...t.text],h=u.map((A,d)=>({d:"",x:d*(l+t.letterSpacing),advance:l})),f=u.length===0?0:h[h.length-1].x+l;return{run:{glyphs:h,width:f},outlined:!1}}var
|
|
1955
|
+
uu,u=[...t.text],h=u.map((A,d)=>({d:"",x:d*(l+t.letterSpacing),advance:l})),f=u.length===0?0:h[h.length-1].x+l;return{run:{glyphs:h,width:f},outlined:!1}}var Kd={type:"text-on-path",label:"Text on Pat\
|
|
1956
1956
|
h",category:"modifier",description:"Bend text along a shape \u2014 a word around a ring, a label along an arc. Feed native text and the path to follow.",inputs:[{name:"in",type:"shapes"},{name:"path",
|
|
1957
1957
|
type:"shapes",label:"path"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"position",label:"Position",type:"number",default:0,step:.01,description:"Where along the path the text sits, as a fracti\
|
|
1958
1958
|
on of its length: 0 = the start, 0.5 = halfway. Closed shapes wrap, so wiring an LFO here orbits the word. On a Circle 0 is the right-hand point; 0.75 is the top."},{key:"align",label:"Align",type:"en\
|
|
@@ -1964,19 +1964,19 @@ eline",type:"number",default:0,step:.5,unit:"px",description:"Lifts the letters
|
|
|
1964
1964
|
default:0,step:.5,unit:"px",description:"Extra room between letters, on top of the text\u2019s own Tracking \u2014 curves outside need more, curves inside less."},{key:"wordGap",label:"Word Gap",type:"\
|
|
1965
1965
|
number",default:10,step:.5,unit:"px",description:"Room between words \u2014 between one incoming text shape and the next. Justify words sets this itself.",dimWhen:e=>String(Z(e.align).base??"")==="wor\
|
|
1966
1966
|
ds"},{key:"passRef",label:"Show Path",type:"bool",default:!1,description:"Also emit the path shapes, like a Merge \u2014 the ring and the word around it leave in one stream."}],cook(e){let t=e.shapes(
|
|
1967
|
-
"in"),n=e.shapes("path"),r=n.flatMap(rt)[0];if(!r||r.points.length<2)return{out:V(t)};let i=r.points,s=r.closed,l=e.enumOf("side",["outside","inside"])==="inside",h=(s?
|
|
1967
|
+
"in"),n=e.shapes("path"),r=n.flatMap(rt)[0];if(!r||r.points.length<2)return{out:V(t)};let i=r.points,s=r.closed,l=e.enumOf("side",["outside","inside"])==="inside",h=(s?Jd(i)>0:!0)===l;h&&(i=s?[i[0],...i.
|
|
1968
1968
|
slice(1).reverse()]:[...i].reverse());let f=En(i,s);if(f<=0)return{out:V(t)};let A=e.enumOf("align",["start","middle","end","justify","words"]),d=e.num("position"),y=(h?1-d:d)*f,g=e.num("baseline"),x=e.
|
|
1969
1969
|
num("spacing"),v=e.num("wordGap"),b=[],C=[];for(let W of t)W.kind==="text"?b.push({shape:W,...cu(e,W)}):C.push(W);let M=W=>W.width+Math.max(0,W.glyphs.length-1)*x,S=v;if(A==="words"){let W=b.reduce((oe,ce)=>oe+
|
|
1970
1970
|
M(ce.run),0),G=s?b.length:b.length-1;S=G>0?(f-W)/G:0}let T=[],P=0;for(let[W,{shape:G,run:oe,outlined:ce}]of b.entries()){W>0&&(P+=S);let he=[...G.text];for(let[se,Ae]of oe.glyphs.entries())T.push({shape:G,
|
|
1971
1971
|
d:Ae.d,ch:he[se]??"",x:P+Ae.x+se*x,advance:Ae.advance,outlined:ce});P+=M(oe)}let E=P,_=y,Q=0;if(A==="middle")_=y-E/2;else if(A==="end")_=y-E;else if(A==="justify"){let W=s?T.length:T.length-1;W>0&&(Q=
|
|
1972
|
-
(f-E)/W)}let Y=[],F=0;for(let[W,G]of T.entries()){let oe=G.x+W*Q+G.advance/2,{p:ce,t:he}=
|
|
1972
|
+
(f-E)/W)}let Y=[],F=0;for(let[W,G]of T.entries()){let oe=G.x+W*Q+G.advance/2,{p:ce,t:he}=Zd(i,s,f,_+oe),se=Math.atan2(he.y,he.x)*180/Math.PI,Ae=me(Re(ce.x,ce.y),zt(se)),ve=G.shape.style;if(G.outlined){
|
|
1973
1973
|
if(G.d==="")continue;Y.push({id:e.shapeId(F),kind:"path",d:G.d,style:ve,transform:me(Ae,Re(-G.advance/2,-g)),meta:e.meta(F,["glyphs","text-on-path"])})}else{if(G.ch.trim()==="")continue;Y.push({id:e.shapeId(
|
|
1974
1974
|
F),kind:"text",x:0,y:0,text:G.ch,fontSize:G.shape.fontSize,fontFamily:G.shape.fontFamily,fontWeight:G.shape.fontWeight,...G.shape.fontStretch!==void 0?{fontStretch:G.shape.fontStretch}:{},anchor:"midd\
|
|
1975
1975
|
le",letterSpacing:0,style:ve,transform:me(Ae,Re(0,-g)),meta:e.meta(F,["text-on-path"])})}F++}let $=e.bool("passRef")?[...C,...n]:C;for(let W of $)Y.push({...W,id:e.shapeId(F),meta:{...W.meta,index:F}}),
|
|
1976
|
-
F++;return{out:V(Y)}}},
|
|
1976
|
+
F++;return{out:V(Y)}}},eA=e=>t=>(Z(t.by).base??"char")!==e,tA={type:"split-glyphs",label:"Split Glyphs",category:"modifier",keywords:["letters","characters","chars","words","explode","per character","\
|
|
1977
1977
|
split text"],description:"One shape per letter (or word), each where the font put it, so Select, Transform, Jitter, Stagger and the arrays work character by character. Tags each with its text, word an\
|
|
1978
1978
|
d line.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"by",label:"Split",type:"enum",default:"char",options:[{value:"char",label:"Characters"},{value:"word",label:"\
|
|
1979
|
-
Words"}]},{key:"spaces",label:"Keep Spaces",type:"bool",default:!1,description:"Emit a (blank) shape for every space too, so index i is the position in the string. Off, spaces take no slot.",dimWhen:
|
|
1979
|
+
Words"}]},{key:"spaces",label:"Keep Spaces",type:"bool",default:!1,description:"Emit a (blank) shape for every space too, so index i is the position in the string. Off, spaces take no slot.",dimWhen:eA(
|
|
1980
1980
|
"char")},{key:"outlines",label:"Outline to Path",type:"bool",default:!1,description:"Hand out each piece as a real glyph path instead of native text \u2014 for Slice, Boolean and the draw-on Reveal. Needs \
|
|
1981
1981
|
the font; until it lands the pieces stay text."}],cook(e){let t=e.shapes("in"),n=e.enumOf("by",["char","word"]),r=e.bool("spaces"),i=e.bool("outlines"),s=[],l=0,u=0,h=0;for(let f of t){if(f.kind!=="te\
|
|
1982
1982
|
xt"){s.push({...f,id:e.shapeId(l),meta:{...f.meta,index:l}}),l++;continue}let A=h++,d=[...f.text];if(d.length===0)continue;let{run:y,outlined:g}=cu(e,f),x=y.glyphs,v=y.width,b=g;if(x.length!==d.length){
|
|
@@ -1987,277 +1987,279 @@ tags:E(Q,_.word)},oe=Re(M+$,f.y);if(i&&b){let he=n==="char"?Y.d:e.outline?.({tex
|
|
|
1987
1987
|
d??"";if(he===""){Q.trim()===""&&(s.push({...f,id:e.shapeId(l),x:M+$,text:Q,anchor:"start",letterSpacing:0,meta:G}),l++);continue}s.push({id:e.shapeId(l),kind:"path",d:he,style:f.style,transform:me(f.
|
|
1988
1988
|
transform,oe),meta:{...G,tags:[...G.tags,"glyphs"]}}),l++;continue}let ce={...f,id:e.shapeId(l),x:M+$,text:Q,anchor:"start",letterSpacing:n==="char"?0:f.letterSpacing,meta:G};f.metrics&&(ce.metrics={width:W,
|
|
1989
1989
|
capHeight:f.metrics.capHeight}),s.push(ce),l++}}return{out:V(s)}}},hu=[...As,{value:"uppercase",label:"Uppercase"},{value:"lowercase",label:"Lowercase"},{value:"reverse",label:"Reverse"},{value:"mirro\
|
|
1990
|
-
r",label:"Mirror"}],
|
|
1991
|
-
r"};function
|
|
1990
|
+
r",label:"Mirror"}],nA=hu.map(e=>e.value),rA=new Set(As.map(e=>e.value)),oA=e=>rA.has(e),ms=e=>String(Z(e.mode).base??"scramble"),iA=e=>!oA(ms(e)),as=e=>{let t=ms(e);return t!=="scramble"&&t!=="flicke\
|
|
1991
|
+
r"};function sA(e){if(as(e))return!1;let t=Z(e.reveal).base,n=Z(e.rate).base;return typeof t=="number"&&t<1&&(typeof n!="number"||n>0)}var aA={type:"text-effect",label:"Text Effect",category:"modifier",
|
|
1992
1992
|
keywords:["scramble","decode","flicker","typewriter","uppercase","lowercase","reverse","mirror","flip","glitch text"],description:"Scramble, Flicker, Typewriter or Cut the text flowing through, on a R\
|
|
1993
|
-
eveal of its own \u2014 or set its case, reverse it, or mirror it, glyphs and all. Counts every letter in the stream as one run, so it sweeps a split word letter by letter.",quickKey:"reveal",timeRoot:
|
|
1993
|
+
eveal of its own \u2014 or set its case, reverse it, or mirror it, glyphs and all. Counts every letter in the stream as one run, so it sweeps a split word letter by letter.",quickKey:"reveal",timeRoot:sA,
|
|
1994
1994
|
inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Mode",type:"enum",default:"scramble",options:[...hu]},{key:"reveal",label:"Reveal",type:"number",default:1,
|
|
1995
1995
|
max:1,step:.01,description:"Characters resolve first to last from 0 to 1, across every text shape in the stream. Below 0 nothing has resolved and the scramble keeps boiling. Wire a Seq or Ramp, or pre\
|
|
1996
|
-
ss i to keyframe.",dimWhen:
|
|
1996
|
+
ss i to keyframe.",dimWhen:iA},{key:"rate",label:"Rate",type:"number",default:20,min:0,max:120,step:1,unit:"/s",description:"How often the unresolved letters redraw. 0 freezes them.",dimWhen:as},{key:"\
|
|
1997
1997
|
alphabet",label:"Alphabet",type:"string",default:ss,exposable:!1,glyphs:!0,description:"The glyphs Scramble boils through. Digits only for a numeric readout, block characters for a censor bar.",dimWhen:e=>ms(
|
|
1998
1998
|
e)!=="scramble"},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the scramble and flicker pattern. Whole steps only; 0 = the node\u2019s own stream.",dimWhen:as}],cook(e){
|
|
1999
|
-
let t=e.shapes("in"),n=e.enumOf("mode",
|
|
1999
|
+
let t=e.shapes("in"),n=e.enumOf("mode",nA),r=t.filter(u=>u.kind==="text");if(r.length===0)return{out:V(t)};if(n==="mirror"){let u=at(r);if(!u)return{out:V(t)};let f=[-1,0,0,1,2*(u.x+u.w/2),0],A=t.map(
|
|
2000
2000
|
d=>d.kind==="text"?{...d,transform:me(f,d.transform)}:d);return{out:V(A)}}let i=r.map(u=>u.text);if(n==="uppercase")i=i.map(u=>u.toUpperCase());else if(n==="lowercase")i=i.map(u=>u.toLowerCase());else if(n===
|
|
2001
2001
|
"reverse")i=i.map(u=>[...u].reverse().join("")).reverse();else{let u=Math.max(0,Math.min(1,e.num("reveal"))),h=e.num("rate"),f=h>0?Math.floor(e.t*h):0,A=e.str("alphabet")||ss,d=Math.floor(e.num("seed"));
|
|
2002
2002
|
i=lu(i,{reveal:u,mode:n,step:f,alphabet:A,rand:(y,g)=>d===0?e.rand("decode",y,g):e.rand("decode",d,y,g)})}let s=0,l=t.map(u=>{if(u.kind!=="text")return u;let h=i[s++];if(h===u.text)return u;let f={...u,
|
|
2003
2003
|
text:h};if(u.metrics){let A=e.outline?.measure?.({text:h,family:u.fontFamily,weight:u.fontWeight??400,stretch:u.fontStretch,size:u.fontSize,letterSpacing:u.letterSpacing});A&&(f.metrics={width:A.width,
|
|
2004
|
-
capHeight:u.metrics.capHeight})}return f});return{out:V(l)}}},
|
|
2005
|
-
e[3]===1}function
|
|
2006
|
-
transform:be}}if(
|
|
2004
|
+
capHeight:u.metrics.capHeight})}return f});return{out:V(l)}}},ri=[{value:"both",label:"Both"},{value:"x",label:"X only"},{value:"y",label:"Y only"}];function lA(e){return e[0]===1&&e[1]===0&&e[2]===0&&
|
|
2005
|
+
e[3]===1}function oi(e,t,n,r){let i=e.transform,[,,,,s,l]=i,u=(h,f,A)=>f+(h-f)*A;if(e.kind==="polyline"){let h=e.points.map(f=>{let A=ir(i,f);return{x:u(A.x,r.x,t),y:u(A.y,r.y,n)}});return{...e,points:h,
|
|
2006
|
+
transform:be}}if(lA(i))switch(e.kind){case"rect":{let h=u(e.x+s,r.x,t)-s,f=u(e.y+l,r.y,n)-l;return{...e,x:h,y:f,w:e.w*t,h:e.h*n,rx:e.rx*Math.min(t,n)}}case"circle":{let h=u(e.cx+s,r.x,t)-s,f=u(e.cy+l,
|
|
2007
2007
|
r.y,n)-l;if(t===n)return{...e,cx:h,cy:f,r:e.r*t};let{r:A,kind:d,...y}=e;return{...y,kind:"ellipse",cx:h,cy:f,rx:e.r*t,ry:e.r*n}}case"ellipse":{let h=u(e.cx+s,r.x,t)-s,f=u(e.cy+l,r.y,n)-l;return{...e,cx:h,
|
|
2008
2008
|
cy:f,rx:e.rx*t,ry:e.ry*n}}case"arc":if(t===n){let h=u(e.cx+s,r.x,t)-s,f=u(e.cy+l,r.y,n)-l;return{...e,cx:h,cy:f,r:e.r*t}}break}return{...e,transform:me(Kt({tx:0,ty:0,rotation:0,sx:t,sy:n,pivot:r}),i)}}
|
|
2009
|
-
function ys(e){if(e.kind==="circle"||e.kind==="arc"||e.kind==="ellipse")return ir(e.transform,{x:e.cx,y:e.cy});let t=Ze(e);return t?nt(t):{x:0,y:0}}var
|
|
2009
|
+
function ys(e){if(e.kind==="circle"||e.kind==="arc"||e.kind==="ellipse")return ir(e.transform,{x:e.cx,y:e.cy});let t=Ze(e);return t?nt(t):{x:0,y:0}}var ii={key:"deal",label:"Deal",type:"bool",default:!1,
|
|
2010
2010
|
description:"One input shape per copy, cycling \u2014 the first copy gets the first shape, the second the second \u2014 each centred where the whole input would sit. Off repeats the whole input at every copy."};
|
|
2011
|
-
function
|
|
2012
|
-
return s=>[i[s%i.length]]}var fu=[{value:"shape",label:"Shape centre"},{value:"canvas",label:"Canvas origin"},{value:"custom",label:"Custom point"}],
|
|
2013
|
-
pe","canvas","custom","ref"];function vl(e){return Z(e.pivot).base!=="custom"}function
|
|
2011
|
+
function si(e,t){if(!t||e.length===0)return()=>e;let n=at(e),r=n?nt(n):void 0,i=e.map(s=>{let l=r?Ze(s):void 0;if(!l||!r)return s;let u=nt(l);return{...s,transform:me(Re(r.x-u.x,r.y-u.y),s.transform)}});
|
|
2012
|
+
return s=>[i[s%i.length]]}var fu=[{value:"shape",label:"Shape centre"},{value:"canvas",label:"Canvas origin"},{value:"custom",label:"Custom point"}],uA=[...fu,{value:"ref",label:"Ref point"}],cA=["sha\
|
|
2013
|
+
pe","canvas","custom","ref"];function vl(e){return Z(e.pivot).base!=="custom"}function zo(e,t,n,r,i){if(t==="canvas")return{x:0,y:0};if(t==="custom")return{x:e.num("pivotX",r,i),y:e.num("pivotY",r,i)};
|
|
2014
2014
|
let s=n?Ze(n):void 0;return s?nt(s):{x:0,y:0}}function pu(e,t,n,r){return e==="shape"||e==="ref"?t:{x:t.x-n,y:t.y-r}}var du=[{key:"pivot",label:"Pivot",type:"enum",default:"shape",options:fu},{key:"pi\
|
|
2015
2015
|
votX",label:"Pivot X",type:"number",default:0,step:.5,unit:"px",dimWhen:vl},{key:"pivotY",label:"Pivot Y",type:"number",default:0,step:.5,unit:"px",dimWhen:vl},{key:"showPivot",label:"Show Pivot",type:"\
|
|
2016
|
-
bool",default:!1,exposable:!1,description:"Mark the pivot on the artboard \u2014 even when it sits outside the canvas. A custom pivot can be dragged there."}];var
|
|
2017
|
-
tre, chosen for you when a wire lands on Ref."}:e),
|
|
2018
|
-
fy:.5},"bottom-left":{fx:0,fy:1},bottom:{fx:.5,fy:1},"bottom-right":{fx:1,fy:1}},
|
|
2016
|
+
bool",default:!1,exposable:!1,description:"Mark the pivot on the artboard \u2014 even when it sits outside the canvas. A custom pivot can be dragged there."}];var hA=du.map(e=>e.key==="pivot"&&e.type==="enum"?{...e,default:"canvas",options:uA,description:"What Rotate and Scale turn about, and the point of the shape a Ref places. Ref point is the shape\u2019s cen\
|
|
2017
|
+
tre, chosen for you when a wire lands on Ref."}:e),Fo=(e,t)=>t!==void 0&&!t.has("ref"),Au={corner:{fx:0,fy:0},top:{fx:.5,fy:0},"top-right":{fx:1,fy:0},left:{fx:0,fy:.5},center:{fx:.5,fy:.5},right:{fx:1,
|
|
2018
|
+
fy:.5},"bottom-left":{fx:0,fy:1},bottom:{fx:.5,fy:1},"bottom-right":{fx:1,fy:1}},fA=Object.keys(Au),pA={type:"transform",label:"Transform",category:"modifier",description:"Move, rotate and scale about\
|
|
2019
2019
|
a pivot. Wire a Ref stream and the shapes are placed relative to it instead: the pivot switches to Ref point and lands on a point of the Ref\u2019s bounds, Move X/Y offset from there \u2014 a marker on a selec\
|
|
2020
2020
|
ted letter, a label off the last bar.",translate:[{x:"tx",y:"ty"}],inputs:[{name:"in",type:"shapes"},{name:"ref",type:"shapes",label:"Ref"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"tx",label:"\
|
|
2021
2021
|
Move X",type:"number",default:0,step:.5,unit:"px"},{key:"ty",label:"Move Y",type:"number",default:0,step:.5,unit:"px"},{key:"rotation",label:"Rotate",type:"number",default:0,step:1,unit:"deg"},{key:"s\
|
|
2022
|
-
x",label:"Scale X",type:"number",default:1,step:.01},{key:"sy",label:"Scale Y",type:"number",default:1,step:.01},...
|
|
2022
|
+
x",label:"Scale X",type:"number",default:1,step:.01},{key:"sy",label:"Scale Y",type:"number",default:1,step:.01},...hA,{key:"refPoint",label:"Ref Point",type:"enum",default:"center",widget:"anchor",group:"\
|
|
2023
2023
|
Ref",options:[{value:"corner",label:"Top Left"},{value:"top",label:"Top"},{value:"top-right",label:"Top Right"},{value:"left",label:"Left"},{value:"center",label:"Centre"},{value:"right",label:"Right"},
|
|
2024
2024
|
{value:"bottom-left",label:"Bottom Left"},{value:"bottom",label:"Bottom"},{value:"bottom-right",label:"Bottom Right"}],description:"With a Ref wired: the point on its bounds the pivot lands on. Move X\
|
|
2025
|
-
/Y are measured from it; Rotate and Scale turn about it.",dimWhen:
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
d
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
"
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
r)%r],y=e[(f+1)%r]
|
|
2046
|
-
|
|
2047
|
-
if(
|
|
2048
|
-
|
|
2049
|
-
x
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
"
|
|
2057
|
-
|
|
2058
|
-
1,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
let
|
|
2082
|
-
|
|
2083
|
-
t
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
x
|
|
2090
|
-
|
|
2091
|
-
let y=s[d],g=
|
|
2092
|
-
x
|
|
2093
|
-
|
|
2094
|
-
n
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
void 0&&
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
Math.max(
|
|
2116
|
-
|
|
2117
|
-
return
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
let g=
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
label:"
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
dimWhen
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
0
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
"
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
E={x:
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
,
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
"
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
return{
|
|
2236
|
-
|
|
2237
|
-
return
|
|
2238
|
-
|
|
2239
|
-
|
|
2025
|
+
/Y are measured from it; Rotate and Scale turn about it.",dimWhen:Fo},{key:"refMix",label:"Mix",type:"number",default:1,step:.01,group:"Ref",description:"How far along the way to the Ref point: 0 leav\
|
|
2026
|
+
es the shape where it was authored, 1 lands it on the point. Wire a Seq or Mapping in to glide it there; past 0\u20131 it overshoots.",dimWhen:Fo},{key:"refEach",label:"Per Shape",type:"bool",default:!1,
|
|
2027
|
+
group:"Ref",description:"Off: one frame, the whole Ref stream\u2019s bounds. On: shape i is placed on Ref shape i (wrapping), so an array of markers lands one per selected letter.",dimWhen:Fo},{key:"p\
|
|
2028
|
+
assRef",label:"Show Ref",type:"bool",default:!1,group:"Ref",description:"Also emit the Ref shapes, like a Merge \u2014 the letter and the mark on it leave in one stream.",dimWhen:Fo}],cook(e){let t=e.
|
|
2029
|
+
shapes("in"),n=t.length,r=e.enumOf("pivot",cA),i=e.shapes("ref");if(i.length>0){let l=e.enumOf("refPoint",fA),u=e.bool("refEach"),h=at(i),f=t.map((d,y)=>{let g=u?Ze(i[y%i.length]):h;if(!g)return d;let{
|
|
2030
|
+
fx:x,fy:v}=Au[l],b=zo(e,r,d,y,n),C=e.num("refMix",y,n),M={x:b.x+C*(g.x+x*g.w-b.x),y:b.y+C*(g.y+v*g.h-b.y)},S=e.num("tx",y,n),T=e.num("ty",y,n),P=e.num("rotation",y,n),E=e.num("sx",y,n),_=e.num("sy",y,
|
|
2031
|
+
n),Q=Re(M.x+S,M.y+T);return P!==0&&(Q=me(Q,zt(P))),(E!==1||_!==1)&&(Q=me(Q,dn(E,_))),Q=me(Q,Re(-b.x,-b.y)),{...d,transform:me(Q,d.transform)}}),A=e.bool("passRef")?i.map((d,y)=>({...d,meta:{...d.meta,
|
|
2032
|
+
index:f.length+y}})):[];return{out:V([...f,...A])}}let s=t.map((l,u)=>{let h=e.num("tx",u,n),f=e.num("ty",u,n),A=zo(e,r,l,u,n),d=Kt({tx:h,ty:f,rotation:e.num("rotation",u,n),sx:e.num("sx",u,n),sy:e.num(
|
|
2033
|
+
"sy",u,n),pivot:pu(r,A,h,f)});return{...l,transform:me(d,l.transform)}});return{out:V(s)}}},dA={type:"array-linear",label:"Array Linear",category:"modifier",description:"Repeat the input along a strai\
|
|
2034
|
+
ght line.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:5,min:0,max:2048,description:"Copies along the line. 0 = nothin\
|
|
2035
|
+
g \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"stepX",label:"Step X",type:"number",default:40,step:.5,unit:"px"},{key:"stepY",label:"Step Y",type:"number",default:0,step:.5,unit:"px"},{
|
|
2036
|
+
key:"origin",label:"Origin",type:"enum",default:"center",options:[{value:"start",label:"Start (grow along step)"},{value:"center",label:"Center (grow outwards)"}],description:"Center spreads the row b\
|
|
2037
|
+
oth ways around the input; Start puts the first copy on the input and grows along the step."},{key:"rotationStep",label:"Rotate Step",type:"number",default:0,step:1,unit:"deg"},{key:"scaleStep",label:"\
|
|
2038
|
+
Scale Step",type:"number",default:1,step:.01,description:"Multiplied per copy."},ii,...du],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(n===0)return{out:V([])};let r=e.enumOf("pivot",[
|
|
2039
|
+
"shape","canvas","custom"]),i=e.bool("deal"),s=si(t,i),l=[],u=t.map((d,y)=>zo(e,r,d,y,t.length)),h=e.enumOf("origin",["start","center"])==="center",f=h?-(n-1)/2*e.num("stepX"):0,A=h?-(n-1)/2*e.num("st\
|
|
2040
|
+
epY"):0;for(let d=0;d<n;d++){let y={k:d,count:n},g=f+e.num("stepX",d,n,y)*d,x=A+e.num("stepY",d,n,y)*d,v=e.num("rotationStep",d,n,y)*d,b=e.num("scaleStep",d,n,y)**d,C=s(d);for(let[M,S]of C.entries()){
|
|
2041
|
+
let T=l.length+M,P=i?zo(e,r,S,M,C.length):u[M],E=pu(r,P,g,x),_=b!==1?oi(S,b,b,E):S,Q=Kt({tx:g,ty:x,rotation:v,pivot:E});l.push({..._,id:e.shapeId(T),transform:me(Q,_.transform),meta:{...S.meta,index:T}})}}
|
|
2042
|
+
return{out:V(l)}}},AA=[pA,dA],mA=96,yA=[{value:"round",label:"Round"},{value:"chamfer",label:"Chamfer"},{value:"notch",label:"Notch"}],gA=[{value:"all",label:"All"},{value:"convex",label:"Convex"},{value:"\
|
|
2043
|
+
concave",label:"Concave"},{value:"every-nth",label:"Every Nth"},{value:"list",label:"By index"}],Zi=e=>t=>(Z(t.which).base??"all")!==e;function bA(e,t){let n=[];for(let r of e){let i=n[n.length-1];i&&
|
|
2044
|
+
Math.abs(i.x-r.x)<1e-9&&Math.abs(i.y-r.y)<1e-9||n.push(r)}if(t&&n.length>1){let r=n[0],i=n[n.length-1];Math.abs(r.x-i.x)<1e-9&&Math.abs(r.y-i.y)<1e-9&&n.pop()}return n}function vA(e,t,n){let r=e.length;
|
|
2045
|
+
if(r<3)return[];let i=0,s=f=>{let A=e[f],d=e[(f-1+r)%r],y=e[(f+1)%r];return(A.x-d.x)*(y.y-A.y)-(A.y-d.y)*(y.x-A.x)};if(t){let f=0;for(let A=0;A<r;A++){let d=e[A],y=e[(A+1)%r];f+=d.x*y.y-y.x*d.y}i=Math.
|
|
2046
|
+
sign(f)}else{let f=0;for(let A=1;A<r-1;A++)f+=Math.sign(s(A));i=Math.sign(f)||1}let l=[],u=t?0:1,h=t?r-1:r-2;for(let f=u;f<=h;f++){let A=e[f],d=e[(f-1+r)%r],y=e[(f+1)%r],g=Math.hypot(d.x-A.x,d.y-A.y),
|
|
2047
|
+
x=Math.hypot(y.x-A.x,y.y-A.y);if(g<1e-9||x<1e-9)continue;let v={x:(d.x-A.x)/g,y:(d.y-A.y)/g},b={x:(y.x-A.x)/x,y:(y.y-A.y)/x},C=Math.max(-1,Math.min(1,v.x*b.x+v.y*b.y)),M=Math.acos(C);180-M*180/Math.PI<
|
|
2048
|
+
n||M<1e-6||l.push({at:f,u:v,v:b,lenA:g,lenB:x,interior:M,convex:Math.sign(s(f))===i})}return l}function IA(e,t,n,r){let i=Math.min(r,t.lenA/2,t.lenB/2);if(i<=1e-9)return[e];let s={x:e.x+t.u.x*i,y:e.y+
|
|
2049
|
+
t.u.y*i},l={x:e.x+t.v.x*i,y:e.y+t.v.y*i};if(n==="chamfer")return[s,l];if(n==="notch")return[s,{x:e.x+(t.u.x+t.v.x)*i,y:e.y+(t.u.y+t.v.y)*i},l];let u=t.interior/2,h={x:t.u.x+t.v.x,y:t.u.y+t.v.y},f=Math.
|
|
2050
|
+
hypot(h.x,h.y);if(f<1e-9)return[s,l];let A=i/Math.cos(u),d=e.x+h.x/f*A,y=e.y+h.y/f*A,g=i*Math.tan(u),x=Math.atan2(s.y-y,s.x-d),v=Math.atan2(l.y-y,l.x-d);for(;v-x>Math.PI;)v-=Math.PI*2;for(;x-v>Math.PI;)
|
|
2051
|
+
v+=Math.PI*2;let b=Math.abs(v-x),C=Math.max(2,Math.ceil(b/(Math.PI*2)*mA-1e-6)),M=[];for(let S=0;S<=C;S++){let T=x+(v-x)*S/C;M.push({x:d+g*Math.cos(T),y:y+g*Math.sin(T)})}return M}var xA={type:"corner\
|
|
2052
|
+
s",label:"Corners",category:"modifier",description:"Round, chamfer or notch the corners of any outline \u2014 pick which, size each.",quickKey:"size",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"\
|
|
2053
|
+
out",type:"shapes"}],params:[{key:"style",label:"Style",type:"enum",default:"round",options:yA,description:"Round is a tangent fillet, Chamfer a straight cut, Notch a step in and out \u2014 the HUD corner."},
|
|
2054
|
+
{key:"size",label:"Size",type:"number",default:8,min:0,step:.5,unit:"px",description:"Setback along each edge \u2014 the radius on a right angle. Clamped to half the shorter edge. Resolved per corner: jitt\
|
|
2055
|
+
er it, or write an expression over i."},{key:"which",label:"Corners",type:"enum",default:"all",options:gA,description:"Which corners to cut. Convex turns with the outline, Concave against it; Every Nt\
|
|
2056
|
+
h and By index count the corners the outline actually has."},{key:"n",label:"N",type:"int",default:2,min:1,max:500,dimWhen:Zi("every-nth")},{key:"offset",label:"Offset",type:"int",default:0,min:0,max:500,
|
|
2057
|
+
dimWhen:Zi("every-nth")},{key:"list",label:"Indices",type:"string",default:"0, 2",exposable:!1,description:"Comma-separated corner indices, per shape.",dimWhen:Zi("list")},{key:"invert",label:"Invert",
|
|
2058
|
+
type:"bool",default:!1},{key:"minTurn",label:"Min Turn",type:"number",default:20,min:0,max:179,step:1,unit:"deg",description:"Vertices turning less than this are not corners \u2014 flattened arcs stay arcs\
|
|
2059
|
+
."}],cook(e){let t=e.shapes("in"),n=e.enumOf("style",["round","chamfer","notch"]),r=e.enumOf("which",["all","convex","concave","every-nth","list"]),i=Math.max(1,e.int("n")),s=e.int("offset"),l=e.bool(
|
|
2060
|
+
"invert"),u=e.num("minTurn"),h=new Set(e.str("list").split(/[\s,;]+/).map(A=>Number.parseInt(A,10)).filter(A=>Number.isFinite(A))),f=[];for(let A of t){if(A.kind==="text"||A.kind==="image"){f.push(A);
|
|
2061
|
+
continue}let d=rt(A).map(T=>({points:bA(T.points,T.closed),closed:T.closed})),y=d.map(T=>vA(T.points,T.closed,u)),g=y.reduce((T,P)=>T+P.length,0),x=0,v=y.map(T=>{let P=T.filter((E,_)=>{let Q=x+_,Y;switch(r){case"\
|
|
2062
|
+
all":Y=!0;break;case"convex":Y=E.convex;break;case"concave":Y=!E.convex;break;case"every-nth":Y=Q>=s&&(Q-s)%i===0;break;case"list":Y=h.has(Q);break}return l?!Y:Y});return x+=T.length,P}),b=new Map,C=0;
|
|
2063
|
+
for(let T of y)for(let P of T)b.set(P,C++);let M=!1,S=d.map((T,P)=>{let E=new Map;for(let Q of v[P]){let Y=e.num("size",b.get(Q),g),F=IA(T.points[Q.at],Q,n,Y);F.length>1&&(E.set(Q.at,F),M=!0)}if(E.size===
|
|
2064
|
+
0)return T;let _=[];return T.points.forEach((Q,Y)=>_.push(...E.get(Y)??[Q])),{points:_,closed:T.closed}});if(!M){f.push(A);continue}for(let T of S)T.points.length<2||f.push({id:e.shapeId(f.length),kind:"\
|
|
2065
|
+
polyline",points:T.points,closed:T.closed,style:A.style,transform:be,meta:{...A.meta,index:f.length,tags:[...A.meta.tags??[],"corners"]}})}return{out:V(f)}}},wA=96,CA=360/wA,kA=e=>(Z(e.mode).base??"fi\
|
|
2066
|
+
t")==="fit",EA={type:"bend",label:"Bend",category:"modifier",description:"Wrap a straight stream around an arc: along the row becomes angle, across it becomes radius.",quickKey:"sweep",inputs:[{name:"\
|
|
2067
|
+
in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"axis",label:"Along",type:"enum",default:"x",options:[{value:"x",label:"X (a row)"},{value:"y",label:"Y (a column)"}],description:"\
|
|
2068
|
+
Which direction of the stream runs around the arc. The other becomes radius."},{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,
|
|
2069
|
+
step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:300,min:1,step:.5,unit:"px",description:"Where the Anchor line lands."},{key:"mode",label:"Mode",type:"enum",default:"fit",options:[
|
|
2070
|
+
{value:"fit",label:"Fit Sweep"},{value:"length",label:"Keep Length"}],description:"Fit stretches the whole stream over Sweep degrees. Keep Length maps pixels to arc length at Radius \u2014 a 100px cell spa\
|
|
2071
|
+
ns 100px of arc."},{key:"sweep",label:"Sweep",type:"number",default:180,min:-360,max:360,step:1,unit:"deg",description:"Fit only. Positive runs clockwise on screen.",dimWhen:e=>!kA(e)},{key:"start",label:"\
|
|
2072
|
+
Start",type:"number",default:270,step:1,unit:"deg",description:"Where the stream begins: 0 = 12 o\u2019clock, clockwise round the dial. 270 = 9 o\u2019clock, so a 180\xB0 sweep goes over the top."},{key:"\
|
|
2073
|
+
anchor",label:"Anchor",type:"enum",default:"center",options:[{value:"center",label:"Center"},{value:"near",label:"Near edge (top / left)"},{value:"far",label:"Far edge (bottom / right)"}],description:"\
|
|
2074
|
+
The line across the stream that sits exactly on Radius."},{key:"flip",label:"Flip Inward",type:"bool",default:!1,description:"Off: screen-up is outward, so a row bent over the top reads upright. On: i\
|
|
2075
|
+
nside out."}],cook(e){let t=e.shapes("in");if(t.length===0)return{out:V([])};let n=at(t);if(!n)return{out:V(t)};let r=e.enumOf("axis",["x","y"]),i=e.enumOf("mode",["fit","length"]),s=e.enumOf("anchor",
|
|
2076
|
+
["center","near","far"]),l=e.bool("flip"),u=e.num("cx"),h=e.num("cy"),f=Math.max(1e-6,e.num("radius")),A=dr(e.num("start")),d=r==="x"?n.x:n.y,y=r==="x"?n.w:n.h,g=r==="x"?n.y:n.x,x=g+(r==="x"?n.h:n.w),
|
|
2077
|
+
v=s==="near"?g:s==="far"?x:(g+x)/2,b=i==="fit"?e.num("sweep")/Math.max(1e-6,y):180/(Math.PI*f),C=l?1:-1,M=E=>{let _=r==="x"?E.x:E.y,Q=r==="x"?E.y:E.x,Y=(A+(_-d)*b)*Math.PI/180,F=f+(Q-v)*C;return{x:u+F*
|
|
2078
|
+
Math.cos(Y),y:h+F*Math.sin(Y)}},S=E=>A+(E-d)*b,T=(E,_)=>{let Q=[],Y=E.length,F=_?Y:Y-1;for(let $=0;$<F;$++){let W=E[$],G=E[($+1)%Y],oe=r==="x"?G.x-W.x:G.y-W.y,ce=Math.max(1,Math.ceil(Math.abs(oe*b)/CA));
|
|
2079
|
+
for(let he=0;he<ce;he++){let se=he/ce;Q.push(M({x:W.x+(G.x-W.x)*se,y:W.y+(G.y-W.y)*se}))}}return!_&&Y>0&&Q.push(M(E[Y-1])),Q},P=[];for(let E of t){if(E.kind==="image"){P.push(E);continue}if(E.kind==="\
|
|
2080
|
+
text"){let _=ir(E.transform,{x:E.x,y:E.y}),Q=M(_),Y=S(r==="x"?_.x:_.y)+90*(r==="x"?1:-1)*(l?-1:1),F=me(Pr(Y,Q.x,Q.y),me(Re(Q.x-_.x,Q.y-_.y),E.transform));P.push({...E,transform:F,meta:{...E.meta,index:P.
|
|
2081
|
+
length}});continue}for(let _ of rt(E))_.points.length<2||P.push({id:e.shapeId(P.length),kind:"polyline",points:T(_.points,_.closed),closed:_.closed,style:E.style,transform:be,meta:{...E.meta,index:P.length,
|
|
2082
|
+
tags:[...E.meta.tags??[],"bend"]}})}return{out:V(P)}}},SA=["auto","butt","round","square"],BA=["auto","miter","round","bevel"],Il=24,PA=4,vt=e=>[e.x,e.y],_A=.05;function MA(e,t,n){let r=n.x-t.x,i=n.y-
|
|
2083
|
+
t.y,s=r*r+i*i;if(s===0)return Math.hypot(e.x-t.x,e.y-t.y);let l=Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*i)/s));return Math.hypot(e.x-(t.x+l*r),e.y-(t.y+l*i))}function io(e,t){if(e.length<=2)return e;
|
|
2084
|
+
let n=e[0],r=e[e.length-1],i=0,s=-1;for(let l=1;l<e.length-1;l++){let u=MA(e[l],n,r);u>i&&(i=u,s=l)}return i<=t||s<0?[n,r]:[...io(e.slice(0,s+1),t).slice(0,-1),...io(e.slice(s),t)]}function TA(e,t,n){
|
|
2085
|
+
if(n<=0||e.length<4)return e;if(!t)return io(e,n);let r=1,i=-1;for(let u=1;u<e.length;u++){let h=Math.hypot(e[u].x-e[0].x,e[u].y-e[0].y);h>i&&(i=h,r=u)}let s=io(e.slice(0,r+1),n),l=io([...e.slice(r),e[0]],
|
|
2086
|
+
n);return[...s.slice(0,-1),...l.slice(0,-1)]}var xl=.001;function wl(e){let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],[s,l]=e[(n+1)%e.length];t+=r*l-s*i}return Math.abs(t)/2}function RA(e){let t=[];
|
|
2087
|
+
for(let n of e){let r=n.filter((i,s)=>s===0||wl(i)>=xl);r.length>0&&wl(r[0])>=xl&&t.push(r)}return t}function Yo(e,t){let n=[];for(let r=0;r<Il;r++){let i=r/Il*Math.PI*2;n.push(vt({x:e.x+t*Math.cos(i),
|
|
2088
|
+
y:e.y+t*Math.sin(i)}))}return n}function QA(e,t,n,r,i){let s=[];for(let d of e){let y=s[s.length-1];(!y||Math.hypot(d.x-y.x,d.y-y.y)>.001)&&s.push(d)}if(t&&s.length>2){let d=s[0],y=s[s.length-1];Math.
|
|
2089
|
+
hypot(d.x-y.x,d.y-y.y)<=.001&&s.pop()}if(s.length===0||n<=0)return[];if(s.length===1){if(r==="round")return[[Yo(s[0],n)]];if(r==="square"){let{x:d,y}=s[0];return[[[vt({x:d-n,y:y-n}),vt({x:d+n,y:y-n}),
|
|
2090
|
+
vt({x:d+n,y:y+n}),vt({x:d-n,y:y+n})]]]}return[]}let l=t?s.length:s.length-1,u=[];for(let d=0;d<l;d++){let y=s[d],g=s[(d+1)%s.length],x=Math.hypot(g.x-y.x,g.y-y.y);u.push({x:(g.x-y.x)/x,y:(g.y-y.y)/x})}
|
|
2091
|
+
let h=[];for(let d=0;d<l;d++){let y=s[d],g=s[(d+1)%s.length],x=u[d],v={x:-x.y*n,y:x.x*n},b=!t&&d===0&&r==="square"?n:0,C=!t&&d===l-1&&r==="square"?n:0,M={x:y.x-x.x*b,y:y.y-x.y*b},S={x:g.x+x.x*C,y:g.y+
|
|
2092
|
+
x.y*C};h.push([[vt({x:M.x+v.x,y:M.y+v.y}),vt({x:S.x+v.x,y:S.y+v.y}),vt({x:S.x-v.x,y:S.y-v.y}),vt({x:M.x-v.x,y:M.y-v.y})]])}let f=t?0:1,A=t?s.length-1:s.length-2;for(let d=f;d<=A;d++){let y=s[d],g=u[(d-
|
|
2093
|
+
1+l)%l],x=u[d%l],v=g.x*x.y-g.y*x.x,b=g.x*x.x+g.y*x.y;if(Math.abs(v)<.001&&b>0)continue;if(i==="round"){h.push([Yo(y,n)]);continue}let C=v>0?-1:1,M={x:y.x-g.y*n*C,y:y.y+g.x*n*C},S={x:y.x-x.y*n*C,y:y.y+
|
|
2094
|
+
x.x*n*C},T={x:M.x+S.x-2*y.x,y:M.y+S.y-2*y.y},P=Math.hypot(T.x,T.y),E=P>1e-9?{x:y.x-T.x/P*n*.5,y:y.y-T.y/P*n*.5}:y;if(i==="miter"){let _=Math.acos(Math.max(-1,Math.min(1,-b))),Q=1/Math.sin(_/2);if(Number.
|
|
2095
|
+
isFinite(Q)&&Q<=PA&&P>1e-9){let Y={x:y.x+T.x/P*n*Q,y:y.y+T.y/P*n*Q};h.push([[vt(E),vt(M),vt(Y),vt(S)]]);continue}}h.push([[vt(E),vt(M),vt(S)]])}return!t&&r==="round"&&h.push([Yo(s[0],n)],[Yo(s[s.length-
|
|
2096
|
+
1],n)]),h}function NA(e,t,n,r){let i=[];for(let s of rt(e))i.push(...QA(TA(s.points,s.closed,_A),s.closed,t/2,n,r));return i.length===0?[]:RA(ao(i))}var DA={type:"outline-stroke",label:"Outline Stroke",
|
|
2097
|
+
category:"modifier",description:"Turn each stroke into the filled shape of its ink \u2014 quads along the segments, joins and caps included \u2014 so Boolean, Slice and fills can work on ticks, rings and lines.\
|
|
2098
|
+
Width above 0 outlines any shape, stroked or not, in its stroke or fill colour. Text arrives traced (Outline to Path switches on when you wire it); a shape with nothing to outline passes through unto\
|
|
2099
|
+
uched.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"width",label:"Thickness",type:"number",default:0,min:0,step:.1,unit:"px",description:"How thick a stroke t\
|
|
2100
|
+
o turn into ink. 0 uses each shape\u2019s own stroke width \u2014 a shape without a stroke then passes through as it is. Above 0, every shape\u2019s outline is drawn at this thickness, filled glyphs included. (The W\
|
|
2101
|
+
idth under Style is the result\u2019s own stroke, only used when Source Style is off.)"},{key:"cap",label:"Cap",type:"enum",default:"auto",options:[{value:"auto",label:"From style"},{value:"butt",label:"\
|
|
2102
|
+
Butt"},{value:"round",label:"Round"},{value:"square",label:"Square"}],description:"Line ends. From style reads the shape\u2019s linecap, butt when unset."},{key:"join",label:"Join",type:"enum",default:"\
|
|
2103
|
+
auto",options:[{value:"auto",label:"From style"},{value:"miter",label:"Miter"},{value:"round",label:"Round"},{value:"bevel",label:"Bevel"}],description:"Corners. From style reads the shape\u2019s linejoin,\
|
|
2104
|
+
miter when unset."},{key:"keepStyle",label:"Source Style",type:"bool",default:!0,description:"Fill each result in the colour its stroke had. Off = the Style block below dresses the results instead."},
|
|
2105
|
+
...Ye.map(e=>({...e,dimWhen:t=>Z(t.keepStyle).base!==!1}))],cook(e){let t=e.shapes("in"),n=t.length,r=e.num("width"),i=e.enumOf("cap",SA),s=e.enumOf("join",BA),l=e.bool("keepStyle"),u=[];for(let[h,f]of t.
|
|
2106
|
+
entries()){let A=f.style.stroke!==void 0&&f.style.stroke!=="none"&&(f.style.strokeWidth??1)>0;if(f.kind==="text"||r<=0&&!A){u.push({...f,meta:{...f.meta,index:u.length}});continue}let d=r>0?r:f.style.
|
|
2107
|
+
strokeWidth??1,y=i==="auto"?f.style.strokeLinecap??"butt":i,g=s==="auto"?f.style.strokeLinejoin??"miter":s,x=Nn(NA(f,d,y,g));if(!x)continue;let v=f.style.fill,b=A?f.style.stroke:v!==void 0&&v!=="none"?
|
|
2108
|
+
v:"#ffffff";u.push({id:e.shapeId(u.length),kind:"path",d:x,style:l?{...f.style,fill:b,stroke:"none",strokeWidth:0}:e.style(h,n),transform:be,meta:e.meta(u.length,["outline-stroke",...f.meta.tags??[]])})}
|
|
2109
|
+
return{out:V(u)}}},OA=["cross","gap"],Xo=1e-6,LA=1e-6;function FA(e,t){let n=[];for(let A of t.points){let d=n[n.length-1];(!d||Math.hypot(A.x-d.x,A.y-d.y)>1e-9)&&n.push(A)}if(t.closed&&n.length>2){let A=n[0],
|
|
2110
|
+
d=n[n.length-1];Math.hypot(A.x-d.x,A.y-d.y)<=1e-9&&n.pop()}let r=t.closed&&n.length>2;if(n.length<2)return;let i=[0],s=r?[...n,n[0]]:n,l=1/0,u=1/0,h=-1/0,f=-1/0;for(let A=0;A<s.length;A++){let d=s[A];
|
|
2111
|
+
d.x<l&&(l=d.x),d.y<u&&(u=d.y),d.x>h&&(h=d.x),d.y>f&&(f=d.y),A>0&&i.push(i[A-1]+Math.hypot(d.x-s[A-1].x,d.y-s[A-1].y))}return{shape:e,points:n,closed:r,cum:i,total:i[i.length-1],bounds:[l,u,h,f]}}function YA(e,t,n){
|
|
2112
|
+
return e[0]<=t[2]+n&&t[0]<=e[2]+n&&e[1]<=t[3]+n&&t[1]<=e[3]+n}function Cl(e,t){return[e.points[t],e.points[(t+1)%e.points.length]]}function kl(e){return e.closed?e.points.length:e.points.length-1}function XA(e){
|
|
2113
|
+
let t=e.map(()=>[]);for(let n=0;n<e.length;n++){let r=e[n],i=kl(r);for(let s=n;s<e.length;s++){let l=e[s];if(!YA(r.bounds,l.bounds,1e-6))continue;let u=kl(l);for(let h=0;h<i;h++){let[f,A]=Cl(r,h),d=Math.
|
|
2114
|
+
min(f.x,A.x),y=Math.max(f.x,A.x),g=Math.min(f.y,A.y),x=Math.max(f.y,A.y),v={x:A.x-f.x,y:A.y-f.y};for(let b=n===s?h+2:0;b<u;b++){if(n===s&&r.closed&&h===0&&b===i-1)continue;let[C,M]=Cl(l,b);if(Math.min(
|
|
2115
|
+
C.x,M.x)>y+1e-9||Math.max(C.x,M.x)<d-1e-9||Math.min(C.y,M.y)>x+1e-9||Math.max(C.y,M.y)<g-1e-9)continue;let S={x:M.x-C.x,y:M.y-C.y},T=v.x*S.y-v.y*S.x;if(Math.abs(T)<1e-12)continue;let P=C.x-f.x,E=C.y-f.
|
|
2116
|
+
y,_=(P*S.y-E*S.x)/T,Q=(P*v.y-E*v.x)/T;_<-Xo||_>1+Xo||Q<-Xo||Q>1+Xo||(t[n].push(r.cum[h]+Math.max(0,Math.min(1,_))*(r.cum[h+1]-r.cum[h])),t[s].push(l.cum[b]+Math.max(0,Math.min(1,Q))*(l.cum[b+1]-l.cum[b])))}}}}
|
|
2117
|
+
return t}function WA(e,t,n,r){let i=[],s=n?Math.min(r,t/2):r;for(let u of e){let h=u-s,f=u+s;if(!n){i.push([Math.max(0,h),Math.min(t,f)]);continue}h<0?i.push([h+t,t],[0,f]):f>t?i.push([h,t],[0,f-t]):i.
|
|
2118
|
+
push([h,f])}i.sort((u,h)=>u[0]-h[0]);let l=[];for(let u of i){let h=l[l.length-1];h&&u[0]<=h[1]+1e-9?h[1]=Math.max(h[1],u[1]):l.push([u[0],u[1]])}return l}function GA(e,t){let n=[],r=0;for(let[i,s]of e)
|
|
2119
|
+
i>r&&n.push([r,i]),r=Math.max(r,s);return r<t&&n.push([r,t]),n}function El(e,t,n){let r=e.points[n%e.points.length],i=e.points[(n+1)%e.points.length],s=e.cum[n+1]-e.cum[n],l=s>0?(t-e.cum[n])/s:0;return{
|
|
2120
|
+
x:r.x+(i.x-r.x)*l,y:r.y+(i.y-r.y)*l}}function ls(e,t,n){if(n>e.total&&e.closed){let l=ls(e,t,e.total),u=ls(e,0,n-e.total);return[...l,...u.slice(1)]}let r=[],i=0;for(;i<e.cum.length-2&&e.cum[i+1]<=t;)
|
|
2121
|
+
i++;r.push(El(e,t,i));for(let l=i+1;l<e.cum.length-1&&e.cum[l]<n;l++)r.push(e.points[l%e.points.length]);let s=i;for(;s<e.cum.length-2&&e.cum[s+1]<n;)s++;return r.push(El(e,n,s)),r}function qA(e,t,n,r){
|
|
2122
|
+
if(t.length===0)return n==="gap"?[{points:e.points,closed:e.closed}]:[];let i=WA(t,e.total,e.closed,r),s=n==="cross"?i:GA(i,e.total);if(s=s.filter(([l,u])=>u-l>LA),s.length===0)return[];if(e.closed){if(s.
|
|
2123
|
+
length===1&&s[0][0]<=1e-9&&s[0][1]>=e.total-1e-9)return[{points:e.points,closed:!0}];let l=s[0],u=s[s.length-1];s.length>1&&l[0]<=1e-9&&u[1]>=e.total-1e-9&&(s=[...s.slice(1,-1),[u[0],e.total+l[1]]])}return s.
|
|
2124
|
+
map(([l,u])=>({points:ls(e,l,u),closed:!1}))}var Sl=e=>Math.round(e*1e3)/1e3;function UA(e){return e.map(t=>`M${t.points.map(n=>`${Sl(n.x)} ${Sl(n.y)}`).join("L")}${t.closed?"Z":""}`).join("")}var HA={
|
|
2125
|
+
type:"stroke-break",label:"Stroke Break",category:"modifier",quickKey:"length",description:"Cut every line where it crosses another. Crosses keeps a short arm of ink either side of each crossing \u2014 a g\
|
|
2126
|
+
rid becomes a field of little plus marks; Gaps cuts the crossings out and keeps the runs between them. Line Ends counts a free end as a crossing. Unstroked shapes pass through untouched.",inputs:[{name:"\
|
|
2127
|
+
in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Keep",type:"enum",default:"cross",options:[{value:"cross",label:"Crosses"},{value:"gap",label:"Gaps"}],description:"\
|
|
2128
|
+
Crosses keeps Length of ink either side of every crossing and drops the rest. Gaps drops that and keeps the rest \u2014 lines that stop short of every crossing."},{key:"length",label:"Length",type:"nu\
|
|
2129
|
+
mber",default:6,min:0,step:.5,unit:"px",description:"How far from each crossing the ink (Crosses) or the cut (Gaps) reaches along the line \u2014 the arm of the plus, or half the gap."},{key:"ends",label:"\
|
|
2130
|
+
Line Ends",type:"bool",default:!0,description:"A free end counts as a crossing: Crosses grows a stub at every line end, Gaps shrinks every line from its ends. Off leaves the ends alone."},{key:"split",
|
|
2131
|
+
label:"Split Pieces",type:"bool",default:!1,description:"One shape per piece, so Stagger, Reveal and Jitter can work the pieces one at a time. Off keeps one path per input shape."}],cook(e){let t=e.shapes(
|
|
2132
|
+
"in"),n=e.enumOf("mode",OA),r=Math.max(0,e.num("length")),i=e.bool("ends"),s=e.bool("split"),l=[],u=t.map(d=>d.style.stroke!==void 0&&d.style.stroke!=="none"&&(d.style.strokeWidth??1)>0);for(let[d,y]of t.
|
|
2133
|
+
entries())if(u[d])for(let g of rt(y)){let x=FA(d,g);x&&l.push(x)}let h=XA(l);if(i)for(let[d,y]of l.entries())y.closed||h[d].push(0,y.total);let f=t.map(()=>[]);for(let[d,y]of l.entries())f[y.shape].push(
|
|
2134
|
+
...qA(y,h[d],n,r));let A=[];for(let[d,y]of t.entries()){if(!u[d]||y.kind==="text"){A.push({...y,meta:{...y.meta,index:A.length}});continue}let g=["stroke-break",...y.meta.tags??[]];if(s){for(let v of f[d])
|
|
2135
|
+
A.push({id:e.shapeId(A.length),kind:"polyline",points:v.points,closed:v.closed,style:{...y.style},transform:be,meta:e.meta(A.length,g)});continue}let x=UA(f[d]);x&&A.push({id:e.shapeId(A.length),kind:"\
|
|
2136
|
+
path",d:x,style:{...y.style},transform:be,meta:e.meta(A.length,g)})}return{out:V(A)}}},$A={type:"array-radial",label:"Array Radial",category:"modifier",translate:[{x:"cx",y:"cy"}],description:"Repeat \
|
|
2137
|
+
the input around a circle, orbiting or just placed.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:8,min:0,max:2e3,description:"\
|
|
2138
|
+
Copies around the circle. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"numbe\
|
|
2139
|
+
r",default:0,step:.5,unit:"px"},{key:"radius",label:"Radius",type:"number",default:120,step:.5,unit:"px",dimWhen:e=>Z(e.mode).base==="rotate"},{key:"start",label:"Start",type:"number",default:0,step:1,
|
|
2140
|
+
unit:"deg",description:co},{key:"sweep",label:"Sweep",type:"number",default:360,min:-360,max:360,step:1,unit:"deg"},{key:"mode",label:"Mode",type:"enum",default:"orbit",options:[{value:"orbit",label:"\
|
|
2141
|
+
Orbit (rotate with ring)"},{value:"place",label:"Place (keep upright)"},{value:"rotate",label:"Rotate about centre"}]},ii],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(n===0)return{out:V(
|
|
2142
|
+
[])};let r=si(t,e.bool("deal")),i=e.num("cx"),s=e.num("cy"),l=dr(e.num("start")),u=e.num("sweep"),h=e.enumOf("mode",["orbit","place","rotate"]),A=Math.abs(u)>=360?n:Math.max(1,n-1),d=[];for(let y=0;y<
|
|
2143
|
+
n;y++){let g=l+u*y/A,x={k:y,angle:g},v=e.num("radius",y,n,x),b=g*Math.PI/180,C;if(h==="rotate")C=me(me(Re(i,s),zt(g)),Re(-i,-s));else{let M=i+v*Math.cos(b),S=s+v*Math.sin(b);C=h==="orbit"?me(Re(M,S),zt(
|
|
2144
|
+
g)):Re(M,S)}for(let[M,S]of r(y).entries()){let T=d.length+M;d.push({...S,id:e.shapeId(T),transform:me(C,S.transform),meta:{...S.meta,index:T}})}}return{out:V(d)}}};function Ki(e){let t=String(Z(e.frame).
|
|
2145
|
+
base??"free");return t==="fill"||t==="fit"||t==="frame"}function ro(e){return String(Z(e.frame).base??"free")!=="frame"}function jo(e){let t=String(Z(e.frame).base??"free");return t!=="frame"&&t!=="fi\
|
|
2146
|
+
ll"}function zA(e){return jo(e)||String(Z(e.place).base??"cells")!=="crossings"}function Bl(e){return!jo(e)&&Z(e.square).base===!0}var jA={type:"array-grid",label:"Array Grid",category:"modifier",translate:[
|
|
2147
|
+
{x:"x",y:"y"}],description:"Repeat the input across a grid of cells.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"frame",label:"Canvas",type:"enum",default:"f\
|
|
2148
|
+
ree",options:[{value:"free",label:"Free (Step X/Y)"},{value:"frame",label:"Frame (X/Y/Width/Height)"},{value:"fill",label:"Fill Canvas (cell centres)"},{value:"fit",label:"Fit to Canvas (edge to edge)"}],
|
|
2149
|
+
description:"Free spaces the copies by Step X/Y from the input. Frame cuts an X/Y/Width/Height box into Columns \xD7 Rows cells and centres a copy in each, so it lines up with a Grid of the same frame an\
|
|
2150
|
+
d counts. Fill Canvas does the same over the whole document. Fit to Canvas spreads the copies so the outermost ones touch the document edges. Frame and both canvas modes ignore Step, Origin and where \
|
|
2151
|
+
the input sits."},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:ro},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px",group:"Frame",dimWhen:ro},{key:"w",
|
|
2152
|
+
label:"Width",type:"number",default:400,min:0,step:1,unit:"px",group:"Frame",dimWhen:ro},{key:"h",label:"Height",type:"number",default:300,min:0,step:1,unit:"px",group:"Frame",dimWhen:ro},{...Dn,group:"\
|
|
2153
|
+
Frame",dimWhen:ro},{key:"place",label:"Place",type:"enum",default:"cells",options:[{value:"cells",label:"Cell centres"},{value:"crossings",label:"Line crossings"}],description:"Where in the Frame or F\
|
|
2154
|
+
ill Canvas lattice the copies land. Cell centres puts one copy in the middle of each of the Columns \xD7 Rows cells. Line crossings puts one on every intersection instead, corners included: (Columns + 1)\
|
|
2155
|
+
\xD7 (Rows + 1) copies, on the crossings of a Grid with the same counts.",dimWhen:jo},{key:"border",label:"Border",type:"bool",default:!0,description:"With Place on Line crossings: include the crossi\
|
|
2156
|
+
ngs on the frame edge. Off keeps the interior intersections only, (Columns \u2212 1) \xD7 (Rows \u2212 1) copies, matching a Grid drawn with Border off.",dimWhen:zA},{key:"cols",label:"Columns",type:"\
|
|
2157
|
+
int",default:4,min:0,max:400,description:"Cells across, as on the Grid generator. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty."},{key:"rows",label:"Rows",type:"int",default:3,min:0,
|
|
2158
|
+
max:400,description:"Cells down, as on the Grid generator. 0 = nothing \u2014 wire a Ramp or Seq in to grow it from empty.",dimWhen:Bl},{key:"square",label:"Square Cells",type:"bool",default:!1,description:"\
|
|
2159
|
+
Every cell a square, the Grid generator's way: Width \xF7 Columns sets the cell, rows then fall every cell down the Height (Rows is ignored); Square Fit says where the leftover goes. Tick it on both node\
|
|
2160
|
+
s and they stay aligned at any frame size.",dimWhen:jo},{key:"squareFit",label:"Square Fit",type:"enum",default:"center",options:[{value:"center",label:"Centre"},{value:"top",label:"Top"}],description:"\
|
|
2161
|
+
With Square Cells, where the rows sit when the Height is not a whole number of cells, as on the Grid: Centre splits the leftover into a part row at each end, Top leaves one short row at the bottom. Ma\
|
|
2162
|
+
tch the Grid's setting and the copies keep landing in its cells.",dimWhen:e=>!Bl(e)},{key:"stepX",label:"Step X",type:"number",default:60,step:.5,unit:"px",dimWhen:Ki},{key:"stepY",label:"Step Y",type:"\
|
|
2163
|
+
number",default:60,step:.5,unit:"px",dimWhen:Ki},{key:"origin",label:"Origin",type:"enum",default:"center",options:[{value:"corner",label:"Corner (grow +X +Y)"},{value:"center",label:"Center (grow out\
|
|
2164
|
+
wards)"}],description:"Center spreads the grid around the input in all four directions; Corner puts the first copy on the input.",dimWhen:Ki},{key:"density",label:"Density",type:"number",default:1,min:0,
|
|
2165
|
+
max:1,step:.01},{key:"stagger",label:"Stagger",type:"number",default:0,step:.5,unit:"px",description:"Row offset."},ii],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("cols")),r=Math.max(0,e.int("row\
|
|
2166
|
+
s")),i=e.num("density"),s=e.num("stagger"),l=e.rand("density"),u=si(t,e.bool("deal")),h=e.enumOf("frame",["free","frame","fill","fit"]),A=(h==="fill"||h==="fit")&&!(e.canvas.w>0&&e.canvas.h>0)?"free":
|
|
2167
|
+
h,d=A==="frame"||A==="fill",y=e.canvas.w,g=e.canvas.h,x={left:e.canvas.origin==="center"?-y/2:0,top:e.canvas.origin==="center"?-g/2:0,w:y,h:g},b=A==="frame"?(()=>{let se=Math.max(0,e.num("w")),Ae=Math.
|
|
2168
|
+
max(0,e.num("h")),ve=On(e,se,Ae);return{left:e.num("x")+ve.dx,top:e.num("y")+ve.dy,w:se,h:Ae}})():x,C=d&&e.enumOf("place",["cells","crossings"])==="crossings",M=C&&!e.bool("border")?1:0,S=d&&n>0?b.w/n:
|
|
2169
|
+
0,T=d&&e.bool("square")&&S>0,P=1e-6,E=[];if(T){let se=Math.floor(b.h/S+P),ve=e.enumOf("squareFit",["center","top"])==="center"?(b.h-se*S)/2:0;E.push(b.top);for(let ne=0;ne<=se;ne++){let ge=b.top+ve+ne*
|
|
2170
|
+
S;ge>b.top+P&&ge<b.top+b.h-P&&E.push(ge)}E.push(b.top+b.h)}let _=T?E.length-1:r;if(n===0||_===0)return{out:V([])};let Q=C?n+1-2*M:n,Y=C?_+1-2*M:_;if(Q<=0||Y<=0)return{out:V([])};let F=Q*Y,$=0,W=0,G=0,
|
|
2171
|
+
oe=0,ce;if(A==="free"){let se=e.enumOf("origin",["corner","center"])==="center";$=se?-(n-1)/2*e.num("stepX"):0,W=se?-(_-1)/2*e.num("stepY"):0}else if(d){let se=nt(at(t)??{x:0,y:0,w:0,h:0}),Ae=T?S:b.h/
|
|
2172
|
+
_;G=S,oe=Ae;let ve=ne=>T?E[Math.min(ne,_)]:ne>=_?b.top+b.h:b.top+ne*Ae;ce=C?ne=>ve(ne)-se.y:ne=>(ve(ne)+ve(ne+1))/2-se.y,$=b.left+(C?0:S/2)-se.x}else{let se=at(t)??{x:0,y:0,w:0,h:0},Ae=nt(se);G=n>1?(b.
|
|
2173
|
+
w-se.w)/(n-1):0,oe=_>1?(b.h-se.h)/(_-1):0,$=(n>1?b.left+se.w/2:b.left+b.w/2)-Ae.x,W=(_>1?b.top+se.h/2:b.top+b.h/2)-Ae.y}let he=[];for(let se=0;se<Y;se++)for(let Ae=0;Ae<Q;Ae++){let ve=se*Q+Ae;if(i<1&&
|
|
2174
|
+
l.next()>=i)continue;let ne={col:Ae,row:se,cols:Q,rows:Y,k:ve},ge=A==="free"?e.num("stepX",ve,F,ne):G,_e=A==="free"?e.num("stepY",ve,F,ne):oe,Se=Re($+(Ae+M)*ge+(se%2===1?s:0),ce?ce(se+M):W+se*_e);for(let[
|
|
2175
|
+
Fe,lt]of u(ve).entries()){let de=he.length+Fe;he.push({...lt,id:e.shapeId(de),transform:me(Se,lt.transform),meta:{...lt.meta,index:de}})}}return{out:V(he)}}};function Qn(e){return String(Z(e.mode).base??
|
|
2176
|
+
"rect")}function Pl(e){let t=Qn(e);return t==="along"||t==="inside"}var VA=[{value:"linear",label:"Linear"},{value:"ease",label:"Ease"},{value:"expo",label:"Exponential"}],JA={type:"scatter",label:"Sc\
|
|
2177
|
+
atter",category:"modifier",translate:[{x:"x",y:"y"}],description:"Place copies at seeded random positions in a region or along a shape.",inputs:[{name:"in",type:"shapes"},{name:"region",type:"shapes",
|
|
2178
|
+
label:"region"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"count",label:"Count",type:"int",default:24,min:0,max:5e3,description:"Copies placed. 0 = nothing \u2014 wire a Ramp or Seq in to grow it \
|
|
2179
|
+
from empty."},{key:"mode",label:"Mode",type:"enum",default:"rect",options:[{value:"rect",label:"Rectangle"},{value:"disc",label:"Disc"},{value:"ring",label:"Ring"},{value:"along",label:"Along region s\
|
|
2180
|
+
hape"},{value:"inside",label:"Inside region shape"}]},{key:"x",label:"X",type:"number",default:0,step:.5,unit:"px",dimWhen:Pl},{key:"y",label:"Y",type:"number",default:0,step:.5,unit:"px",dimWhen:Pl},
|
|
2181
|
+
{key:"w",label:"Width",type:"number",default:240,step:.5,unit:"px",dimWhen:e=>Qn(e)!=="rect"},{key:"h",label:"Height",type:"number",default:160,step:.5,unit:"px",dimWhen:e=>Qn(e)!=="rect"},{...Dn,dimWhen:e=>Qn(
|
|
2182
|
+
e)!=="rect"},{key:"radius",label:"Radius",type:"number",default:120,min:0,step:.5,unit:"px",dimWhen:e=>Qn(e)!=="disc"&&Qn(e)!=="ring"},{key:"innerRadius",label:"Inner Radius",type:"number",default:60,
|
|
2183
|
+
min:0,step:.5,unit:"px",dimWhen:e=>Qn(e)!=="ring"},{key:"rotate",label:"Random Rotation",type:"number",default:0,min:0,max:360,step:1,unit:"deg"},{key:"align",label:"Align to Path",type:"bool",default:!1,
|
|
2184
|
+
description:"Along mode: rotate each copy to follow the region shape.",dimWhen:e=>Qn(e)!=="along"},{key:"seed",label:"Seed",type:"number",default:0,step:.1,description:"Reroll the layout. Whole number\
|
|
2185
|
+
s are layouts \u2014 0 is the one the node always had \u2014 and the fraction between two glides every copy from its spot in one to its spot in the next, along the Curve. Wire Time in and the points wander to n\
|
|
2186
|
+
ew places once a second, Time \xD7 0.2 for a slow drift, a Seq for cued moves. Along a region shape the copy slides along the path; inside one it travels straight and may briefly cross outside a concave \
|
|
2187
|
+
shape."},{key:"curve",label:"Curve",type:"enum",default:"ease",options:VA,description:"How a copy travels between two layouts as Seed crosses a whole number: straight, eased at both ends, or accelerat\
|
|
2188
|
+
ing."},ii],cook(e){let t=e.shapes("in"),n=Math.max(0,e.int("count"));if(t.length===0||n===0)return{out:V([])};let r=e.enumOf("mode",["rect","disc","ring","along","inside"]),i=e.num("rotate"),s=e.bool(
|
|
2189
|
+
"align"),l=e.enumOf("curve",["linear","ease","expo"]),u=e.num("seed"),h=Number.isFinite(u)?Math.floor(u):0,f=Number.isFinite(u)?u-h:0,A=f<=0?0:l==="ease"?f*f*(3-2*f):l==="expo"?f*f:f,d=e.shapes("regio\
|
|
2190
|
+
n"),y=si(t,e.bool("deal")),x=d.flatMap(rt)[0],v=x?En(x.points,x.closed):0,b=r==="inside"?d.map(Ze).find(Boolean):void 0,C=(S,T)=>{let P=T===0?e.rand("scatter",S):e.rand("scatter",T,S),E={x:0,y:0},_=0;
|
|
2191
|
+
if(r==="along"&&x)_=P.next()*v;else if(r==="inside"&&x){if(E=b?{x:b.x+b.w/2,y:b.y+b.h/2}:E,b)for(let Q=0;Q<40;Q++){let Y={x:b.x+P.next()*b.w,y:b.y+P.next()*b.h};if(Po(Y,x.points)){E=Y;break}}}else if(r===
|
|
2192
|
+
"disc"||r==="ring"){let Q=e.num("x",S,n),Y=e.num("y",S,n),F=e.num("radius",S,n),$=r==="ring"?e.num("innerRadius",S,n):0,W=P.next()*Math.PI*2,G=Math.sqrt(P.next()*(F*F-$*$)+$*$);E={x:Q+G*Math.cos(W),y:Y+
|
|
2193
|
+
G*Math.sin(W)}}else{let Q=e.num("w",S,n),Y=e.num("h",S,n),F=On(e,Q,Y);E={x:e.num("x",S,n)+F.dx+P.next()*Q,y:e.num("y",S,n)+F.dy+P.next()*Y}}return{p:E,d:_,spin:i>0?P.range(-i,i):0}},M=[];for(let S=0;S<
|
|
2194
|
+
n;S++){let T=C(S,h),{p:P,d:E,spin:_}=T;if(A>0){let $=C(S,h+1);P={x:T.p.x+($.p.x-T.p.x)*A,y:T.p.y+($.p.y-T.p.y)*A};let W=$.d-T.d;x?.closed&&v>0&&Math.abs(W)>v/2&&(W-=Math.sign(W)*v),E=T.d+W*A,x?.closed&&
|
|
2195
|
+
v>0&&(E=(E%v+v)%v),_=T.spin+($.spin-T.spin)*A}let Q=0;if(r==="along"&&x&&(P=rr(x.points,E,x.closed),s)){let $=sr(x.points,E,x.closed);Q=Math.atan2($.y,$.x)*180/Math.PI}let Y=(s?Q:0)+_,F=Kt({tx:P.x,ty:P.
|
|
2196
|
+
y,rotation:Y});for(let[$,W]of y(S).entries()){let G=M.length+$;M.push({...W,id:e.shapeId(G),transform:me(F,W.transform),meta:{...W.meta,index:G,tags:[...W.meta.tags??[],"scattered"]}})}}return{out:V(M)}}},
|
|
2197
|
+
ZA=[{value:"mirror",label:"Mirror"},{value:"kaleidoscope",label:"Kaleidoscope"}];function so(e){return Z(e.mode).base==="kaleidoscope"}function _l(e){return!so(e)}function KA(e){return so(e)&&Z(e.reflectToo).
|
|
2198
|
+
base===!1}function es(e,t,n){let r=2*n*Math.PI/180,i=Math.cos(r),s=Math.sin(r);return me(me(Re(e,t),[i,s,s,-i,0,0]),Re(-e,-t))}var em={type:"mirror",label:"Mirror",category:"modifier",description:"Ref\
|
|
2199
|
+
lected copies: mirror across a line, or kaleidoscope \u2014 rotated copies of the input and its reflection.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",
|
|
2200
|
+
label:"Mode",type:"enum",default:"mirror",options:ZA},{key:"cx",label:"Center X",type:"number",default:0,step:.5,unit:"px"},{key:"cy",label:"Center Y",type:"number",default:0,step:.5,unit:"px"},{key:"\
|
|
2201
|
+
angle",label:"Axis",type:"number",default:90,step:1,unit:"deg",description:"The mirror line\u2019s angle: 90 = vertical line, left\u2013right symmetry. Kaleidoscope: the reflection axis, while Reflect is on.",
|
|
2202
|
+
dimWhen:KA},{key:"keepOriginal",label:"Keep Original",type:"bool",default:!0,description:"Mirror mode: emit the input as well as its reflection.",dimWhen:so},{key:"mirror2",label:"Second Axis",type:"b\
|
|
2203
|
+
ool",default:!1,description:"Mirror mode: reflect the result across a second line too \u2014 Axis 90 with Axis 2 at 180 is four-corner symmetry.",dimWhen:so},{key:"angle2",label:"Axis 2",type:"number",
|
|
2204
|
+
default:180,step:1,unit:"deg",description:"The second mirror line\u2019s angle: 180 = horizontal line, top\u2013bottom symmetry.",dimWhen:e=>so(e)||Z(e.mirror2).base!==!0},{key:"count",label:"Wedges",
|
|
2205
|
+
type:"int",default:6,min:1,max:64,description:"Kaleidoscope: rotation steps around the centre. 2 with Reflect = four-corner symmetry.",dimWhen:_l},{key:"reflectToo",label:"Reflect",type:"bool",default:!0,
|
|
2206
|
+
description:"Kaleidoscope: interleave reflected copies \u2014 a true mirror kaleidoscope rather than plain rotation.",dimWhen:_l}],cook(e){let t=e.shapes("in"),n=e.num("cx"),r=e.num("cy"),i=e.num("ang\
|
|
2207
|
+
le"),s=e.enumOf("mode",["mirror","kaleidoscope"]),l=[];if(s==="mirror"){if(e.bool("keepOriginal")&&l.push(be),l.push(es(n,r,i)),e.bool("mirror2")){let h=es(n,r,e.num("angle2"));for(let f of[...l])l.push(
|
|
2208
|
+
me(h,f))}}else{let h=Math.max(1,e.int("count")),f=e.bool("reflectToo")?es(n,r,i):void 0,A=d=>me(me(Re(n,r),zt(d)),Re(-n,-r));for(let d=0;d<h;d++){let y=A(360*d/h);l.push(y),f&&l.push(me(y,f))}}let u=[];
|
|
2209
|
+
for(let[h,f]of l.entries())for(let[A,d]of t.entries()){let y=h*t.length+A;u.push({...d,id:e.shapeId(y),transform:me(f,d.transform),meta:{...d.meta,index:y}})}return{out:V(u)}}},tm=[$A,jA,em,JA];function Vo(e){
|
|
2210
|
+
let t=/^#([0-9a-f]{3,8})$/i.exec(e.trim());if(!t)return;let n=t[1];if(n.length===3||n.length===4){let r=n.split("").map(i=>parseInt(i+i,16));return[r[0],r[1],r[2],n.length===4?r[3]/255:1]}if(n.length===
|
|
2211
|
+
6||n.length===8){let r=[0,2,4,6].slice(0,n.length/2).map(i=>parseInt(n.slice(i,i+2),16));return[r[0],r[1],r[2],n.length===8?r[3]/255:1]}}var Wo=e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).
|
|
2212
|
+
padStart(2,"0");function yu(e,t,n){let r=Vo(e),i=Vo(t);if(!r||!i)return n<.5?e:t;let s=r[0]+(i[0]-r[0])*n,l=r[1]+(i[1]-r[1])*n,u=r[2]+(i[2]-r[2])*n,h=r[3]+(i[3]-r[3])*n;return`#${Wo(s)}${Wo(l)}${Wo(u)}${h<
|
|
2213
|
+
1?Wo(h*255):""}`}var nm={type:"jitter",label:"Jitter",category:"modifier",description:"Shake position, rotation and scale per shape, deterministically.",inputs:[{name:"in",type:"shapes"},{name:"reseed",
|
|
2214
|
+
type:"number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes"}],params:[{key:"position",label:"Position",type:"number",default:4,min:0,step:.1,unit:"px",description:"Scatter amount \u2014 both\
|
|
2215
|
+
axes, until Position Y takes over Y."},{key:"positionY",label:"Position Y",type:"number",default:-1,step:.1,unit:"px",description:"Y axis alone, making Position the X amount. Negative = follow Positi\
|
|
2216
|
+
on."},{key:"rotation",label:"Rotation",type:"number",default:0,min:0,step:.5,unit:"deg"},{key:"scale",label:"Scale",type:"number",default:0,min:0,max:1,step:.01,description:"Grow or shrink each shape \
|
|
2217
|
+
about its own centre by up to this fraction, geometry-true: the stroke keeps its width."},{key:"scaleAxis",label:"Scale Axis",type:"enum",default:"both",options:ri,description:"Both grows the whole sh\
|
|
2218
|
+
ape; X only or Y only scatters one dimension \u2014 a row of equal bars whose widths differ while their heights stay put.",dimWhen:e=>Z(e.scale).base===0},{key:"uniformScale",label:"Uniform Scale",type:"\
|
|
2219
|
+
bool",default:!0,description:"One factor for width and height, so icons resize without squashing. Off = X and Y scatter independently. Both axes only.",dimWhen:e=>Z(e.scale).base===0||Z(e.scaleAxis).base!==
|
|
2220
|
+
"both"},{key:"opacity",label:"Opacity",type:"number",default:0,min:0,max:1,step:.01},{key:"strokeWidth",label:"Width",type:"number",default:0,min:0,step:.05,unit:"px"},{key:"salt",label:"Seed",type:"i\
|
|
2221
|
+
nt",default:1,min:0,description:"Reroll this node alone \u2014 the \u2212/+ steppers walk through scatters. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead."}],cook(e){let t=e.
|
|
2222
|
+
shapes("in"),n=t.length,r=e.num("position"),i=e.num("positionY"),s=i<0?r:i,l=e.num("rotation"),u=e.num("scale"),h=e.enumOf("scaleAxis",["both","x","y"]),f=e.bool("uniformScale"),A=e.num("opacity"),d=e.
|
|
2223
|
+
num("strokeWidth"),y=e.inputs.reseed,g=0;if(y?.t==="number"){let{playing:b,local:C}=en(y.v);g=b?Math.round((e.t-C)*1e3):-Math.round(C*1e3)-1}let x=`${e.int("salt")}|${g}`,v=t.map((b,C)=>{let M=e.rand(
|
|
2224
|
+
"jitter",x,C),S=()=>M.next()*2-1,T=r===0?0:S()*r,P=s===0?0:S()*s,E=l===0?0:S()*l,_=u===0?1:1+S()*u,Q=u===0?1:f||h!=="both"?_:1+S()*u,Y=h==="y"?1:_,F=h==="x"?1:h==="both"?Q:_,$=Y!==1||F!==1?oi(b,Y,F,ys(
|
|
2225
|
+
b)):b,W=Kt({tx:T,ty:P,rotation:E}),G={...b.style};return A>0&&(G.opacity=Math.max(0,Math.min(1,(G.opacity??1)+S()*A))),d>0&&(G.strokeWidth=Math.max(0,(G.strokeWidth??1)+S()*d)),{...$,transform:me(W,$.
|
|
2226
|
+
transform),style:G,meta:{...b.meta,index:C}}});return{out:V(v)}}},rm={type:"partial-outline",label:"Partial Outline",category:"modifier",description:"Keep only part of each outline, by fraction of its\
|
|
2227
|
+
length.",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"from",label:"From",type:"number",default:0,min:0,max:1,step:.001},{key:"to",label:"To",type:"number",default:.35,
|
|
2228
|
+
min:0,max:1,step:.001},{key:"segments",label:"Segments",type:"int",default:1,min:1,max:64,description:"Repeat the arc evenly around the outline."},{key:"offset",label:"Offset",type:"number",default:0,
|
|
2229
|
+
step:.001,description:"Rotate the pattern along the outline."},{key:"stagger",label:"Stagger",type:"number",default:0,step:.001,description:"Extra offset per outline: 0.1 shifts each next ring a tenth\
|
|
2230
|
+
further round. Wire an LFO to cascade."},{key:"scatter",label:"Scatter",type:"number",default:0,min:0,max:1,step:.01,description:"Seeded random phase per outline \u2014 every ring picks its own spot, froz\
|
|
2231
|
+
en until the seed changes."}],cook(e){let t=e.shapes("in"),n=t.length,r=Math.max(1,e.int("segments")),i=[],s=0;for(let[l,u]of t.entries()){let h=e.num("from",l,n),f=e.num("to",l,n),A=e.num("offset",l,
|
|
2232
|
+
n),d=e.num("stagger",l,n),y=e.num("scatter",l,n),g=rt(u);for(let x of g){if(En(x.points,x.closed)===0)continue;let v=A+d*s+y*e.rand("scatter",s).next();s++;for(let b=0;b<r;b++){let C=(b+h)/r+v,M=Math.
|
|
2233
|
+
max(0,Math.min(1,(f-h)/r));if(M===0)continue;let S=(C%1+1)%1,T=S+M,E=(T<=1?[[S,T]]:[[S,1],[0,T-1]]).map(([_,Q])=>Si(x.points,_,Q,x.closed)).filter(_=>_.length>=2);if(x.closed&&E.length===2){let[_,Q]=E;
|
|
2234
|
+
E=[[..._,...Q.slice(1)]]}for(let _ of E)i.push({id:e.shapeId(i.length),kind:"polyline",points:_,closed:!1,style:u.style,transform:[1,0,0,1,0,0],meta:{...u.meta,index:i.length,tags:[...u.meta.tags??[],
|
|
2235
|
+
"partial"]}})}}}return{out:V(i)}}},om=[{value:"cut",label:"Cut"},{value:"fade",label:"Fade"},{value:"scale",label:"Scale"},{value:"draw",label:"Draw on"},{value:"wipe",label:"Wipe"}],im=[{value:"forwa\
|
|
2236
|
+
rd",label:"Forward"},{value:"reverse",label:"Reverse"},{value:"random",label:"Random"}];function sm(e,t,n){let r=Math.max(0,Math.min(.95,n)),i=(e-t*r)/(1-r);return Math.max(0,Math.min(1,i))}function Jo(e,t){
|
|
2237
|
+
return{...e,style:{...e.style,opacity:(e.style.opacity??1)*t}}}function gu(e,t,n="both"){return oi(e,n==="y"?1:t,n==="x"?1:t,ys(e))}function am(e,t){if(e===void 0||e==="none")return e;if(Sn(e))return da(
|
|
2238
|
+
e,t*t);let n=Vo(e);if(!n)return"none";let r=Math.round(n[3]*t*t*255),i=s=>s.toString(16).padStart(2,"0");return`#${i(n[0])}${i(n[1])}${i(n[2])}${i(r)}`}function bu(e,t,n,r){let i=rt(t);if(i.length===0)
|
|
2239
|
+
return[Jo(t,n)];let s=[];for(let l of i){if(En(l.points,l.closed)===0)continue;let u=Si(l.points,0,n,l.closed);u.length<2||s.push({id:e.shapeId(r+s.length),kind:"polyline",points:u,closed:!1,style:{...t.
|
|
2240
|
+
style,fill:am(t.style.fill,n)},transform:[1,0,0,1,0,0],meta:{...t.meta,index:r+s.length,tags:[...t.meta.tags??[],"reveal"]}})}return s.length>0?s:[Jo(t,n)]}function gs(e){let t=e*Math.PI/180;return{x:Math.
|
|
2241
|
+
cos(t),y:Math.sin(t)}}function bs(e,t){let n=(l,u)=>l*t.x+u*t.y,r=e.map(l=>{let u=fr([l]),h=u.flat().flat();if(h.length>0){let d=1/0,y=-1/0;for(let[g,x]of h){let v=n(g,x);v<d&&(d=v),v>y&&(y=v)}return{
|
|
2240
2242
|
polys:u,lo:d,hi:y}}let f=Ze(l),A=f?nt(f):{x:0,y:0};return{polys:u,lo:n(A.x,A.y),hi:n(A.x,A.y)}}),i=r.length>0?Math.min(...r.map(l=>l.lo)):0,s=r.length>0?Math.max(...r.map(l=>l.hi)):0;return{min:i,max:s,
|
|
2241
2243
|
perShape:r}}function uo(e,t,n,r,i,s,l,u){let h=Math.max(1e-6,i.max-i.min),f=Math.max(0,Math.min(1,n)),A=i.min+f*h,d=[];for(let[y,g]of t.entries()){let{polys:x,lo:v,hi:b}=i.perShape[y];if(s==="behind"){
|
|
2242
2244
|
if(f>=1||A>=b&&A>v){d.push(g);continue}if(A<=v||x.length===0)continue}else{if(f<=0||A<=v&&A<b){d.push(g);continue}if(A>=b||x.length===0)continue}let C=h+10,M=r.x*A,S=r.y*A,T=-r.y,P=r.x,E=s==="behind"?
|
|
2243
2245
|
-1:1,_=[[M+T*C,S+P*C],[M-T*C,S-P*C],[M-T*C+E*r.x*C,S-P*C+E*r.y*C],[M+T*C+E*r.x*C,S+P*C+E*r.y*C]],Q=ao(x),Y=mu.default.intersection(Q,[[..._,_[0]]]),F=Nn(Y);F&&d.push({id:e.shapeId(y,u),kind:"path",d:F,
|
|
2244
|
-
style:g.style,transform:be,meta:{...g.meta,index:y,tags:[...g.meta.tags??[],l]}})}return d}function ts(e){return Z(e.mode).base==="wipe"}var
|
|
2246
|
+
style:g.style,transform:be,meta:{...g.meta,index:y,tags:[...g.meta.tags??[],l]}})}return d}function ts(e){return Z(e.mode).base==="wipe"}var lm={type:"reveal",label:"Reveal",category:"modifier",description:"\
|
|
2245
2247
|
Transition a stream in: 0 = nothing, 1 = everything. Stagger cascades the shapes.",quickKey:"progress",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"progress",label:"\
|
|
2246
|
-
Progress",type:"number",default:1,min:0,max:1,step:.01,description:"Drive this from a Seq for timed transitions; press i to keyframe it."},{key:"mode",label:"Mode",type:"enum",default:"fade",options:
|
|
2248
|
+
Progress",type:"number",default:1,min:0,max:1,step:.01,description:"Drive this from a Seq for timed transitions; press i to keyframe it."},{key:"mode",label:"Mode",type:"enum",default:"fade",options:om,
|
|
2247
2249
|
description:"Cut pops each shape in whole at the half of its window \u2014 with Stagger, a one-by-one cascade. Wipe SLICES the stream with a travelling front; Stagger and Order do not apply to it."},{
|
|
2248
|
-
key:"axis",label:"Scale Axis",type:"enum",default:"both",options:
|
|
2250
|
+
key:"axis",label:"Scale Axis",type:"enum",default:"both",options:ri,description:"Scale mode only: grow on both axes, or squash open along one like a blind.",dimWhen:e=>Z(e.mode).base!=="scale"},{key:"\
|
|
2249
2251
|
stagger",label:"Stagger",type:"number",default:.35,min:0,max:.95,step:.01,description:"0 = everything moves together; higher = one after another.",dimWhen:ts},{key:"order",label:"Order",type:"enum",default:"\
|
|
2250
|
-
forward",options:
|
|
2252
|
+
forward",options:im,description:"Which shapes lead the cascade. Wipe orders by position instead.",dimWhen:ts},{key:"angle",label:"Wipe Angle",type:"number",default:0,step:1,unit:"deg",description:"Dir\
|
|
2251
2253
|
ection the wipe front travels. Wipe mode only.",dimWhen:e=>!ts(e)}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("mode",["cut","fade","scale","draw","wipe"]),i=e.enumOf("order",["forward","rever\
|
|
2252
2254
|
se","random"]),s=e.enumOf("axis",["both","x","y"]),l=t.length>1?e.num("stagger"):0;if(n===0)return{out:V([])};if(r==="wipe"){let f=gs(e.num("angle")),A=bs(t,f),d=Math.max(0,Math.min(1,e.num("progress")));
|
|
2253
2255
|
return{out:V(uo(e,t,d,f,A,"behind","reveal"))}}let u;if(i==="random"){let A=t.map((d,y)=>e.rand("reveal-order",y).next()).map((d,y)=>({k:d,i:y})).sort((d,y)=>d.k-y.k||d.i-y.i);u=new Array(n),A.forEach(
|
|
2254
|
-
({i:d},y)=>{u[d]=n>1?y/(n-1):0})}else u=t.map((f,A)=>{let d=i==="reverse"?n-1-A:A;return n>1?d/(n-1):0});let h=[];for(let[f,A]of t.entries()){let d=
|
|
2255
|
-
h.push(A);continue}switch(r){case"cut":d>=.5&&h.push(A);break;case"fade":h.push(
|
|
2256
|
+
({i:d},y)=>{u[d]=n>1?y/(n-1):0})}else u=t.map((f,A)=>{let d=i==="reverse"?n-1-A:A;return n>1?d/(n-1):0});let h=[];for(let[f,A]of t.entries()){let d=sm(e.num("progress",f,n),u[f],l);if(!(d<=0)){if(d>=1){
|
|
2257
|
+
h.push(A);continue}switch(r){case"cut":d>=.5&&h.push(A);break;case"fade":h.push(Jo(A,d));break;case"scale":h.push(gu(A,d,s));break;case"draw":h.push(...bu(e,A,d,h.length));break}}}return{out:V(h)}}};function um(e,t,n,r){
|
|
2256
2258
|
let i={...t.style};if(e.bool("setStroke")&&(i.stroke=e.paint("stroke",n,r)),e.bool("setFill")&&(i.fill=e.paint("fill",n,r)),e.bool("setWidth")&&(i.strokeWidth=e.num("strokeWidth",n,r)),e.bool("setOpac\
|
|
2257
2259
|
ity")&&(i.opacity=e.num("opacity",n,r)),e.bool("setDash")){let u=e.numbers("dash");u.length>0?i.strokeDash=u:delete i.strokeDash}let s=t.kind==="text"&&e.bool("setWeight"),l=t.kind==="text"&&e.bool("s\
|
|
2258
2260
|
etStretch");if(t.kind==="text"&&(s||l)){let u=s?Tt(t.fontFamily,e.num("weight",n,r)):t.fontWeight??400,h=l?ln(t.fontFamily,e.num("stretch",n,r)):t.fontStretch,f=e.outline?.measure?.({text:t.text,family:t.
|
|
2259
2261
|
fontFamily,weight:u,stretch:h,size:t.fontSize,letterSpacing:t.letterSpacing});return{...t,style:i,fontWeight:u,...h!==void 0?{fontStretch:h}:{},...f?{metrics:{width:f.width,capHeight:f.capHeight}}:{}}}
|
|
2260
|
-
return{...t,style:i}}var
|
|
2262
|
+
return{...t,style:i}}var cm={type:"style",label:"Style",category:"modifier",description:"Override stroke, fill, width, opacity, dash, font weight or font stretch on a stream.",inputs:[{name:"in",type:"\
|
|
2261
2263
|
shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"setStroke",label:"Set Stroke",type:"bool",default:!1,description:"Recolour the stroke. On a stream with no stroke to colour, Set Width come\
|
|
2262
2264
|
s on too, so the colour shows."},{key:"stroke",label:"Stroke",type:"color",default:"#ff0000"},{key:"setFill",label:"Set Fill",type:"bool",default:!1},{key:"fill",label:"Fill",type:"color",default:"non\
|
|
2263
2265
|
e"},{key:"setWidth",label:"Set Width",type:"bool",default:!1,description:"Set the stroke width. Off leaves each shape\u2019s own width, including 0 \u2014 a stroke colour alone cannot show through that."},
|
|
@@ -2267,37 +2269,37 @@ the font weight of text shapes, per shape. A variable family renders any whole v
|
|
|
2267
2269
|
aps to its nearest shipped weight. Outlined text is already paths and is left alone."},{key:"weight",label:"Weight",type:"number",default:700,min:100,max:900,step:1,dimWhen:e=>Z(e.setWeight).base!==!0},
|
|
2268
2270
|
{key:"setStretch",label:"Set Stretch",type:"bool",default:!1,description:"Set the width of text shapes, per shape, in percent of normal \u2014 only a variable family with a width axis (Tektur, 75\u2013100%) str\
|
|
2269
2271
|
etches; any other face keeps its width. After Split Glyphs, an expression over i, n and t narrows and widens the letters one by one."},{key:"stretch",label:"Stretch",type:"number",default:100,min:50,max:200,
|
|
2270
|
-
step:1,unit:"%",dimWhen:e=>Z(e.setStretch).base!==!0}],cook(e){let t=e.shapes("in"),n=t.length;return{out:V(t.map((r,i)=>
|
|
2272
|
+
step:1,unit:"%",dimWhen:e=>Z(e.setStretch).base!==!0}],cook(e){let t=e.shapes("in"),n=t.length;return{out:V(t.map((r,i)=>um(e,r,i,n)))}}},hm=[{value:"width",label:"Width (\xD7)"},{value:"widthPx",label:"\
|
|
2271
2273
|
Width (px)"},{value:"opacity",label:"Opacity"},{value:"scale",label:"Scale"},{value:"rotation",label:"Rotation"},{value:"offsetX",label:"Offset X"},{value:"offsetY",label:"Offset Y"},{value:"weight",label:"\
|
|
2272
|
-
Font Weight"},{value:"stretch",label:"Font Stretch"}],
|
|
2273
|
-
Wave"}];function
|
|
2274
|
-
return .5-.5*Math.cos((t*i-s)*2*Math.PI);default:return t}}var
|
|
2275
|
-
first shape gets From, last gets To.",quickKey:"to",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"property",label:"Property",type:"enum",default:"width",options:
|
|
2274
|
+
Font Weight"},{value:"stretch",label:"Font Stretch"}],fm=[{value:"linear",label:"Linear"},{value:"ease",label:"Ease"},{value:"expo",label:"Exponential"},{value:"peak",label:"Peak"},{value:"wave",label:"\
|
|
2275
|
+
Wave"}];function pm(e,t,n,r,i,s){switch(e){case"ease":return t*t*(3-2*t);case"expo":return t*t;case"peak":{let l=Math.min(1,Math.abs(t-n)/Math.max(1e-6,r));return .5+.5*Math.cos(Math.PI*l)}case"wave":
|
|
2276
|
+
return .5-.5*Math.cos((t*i-s)*2*Math.PI);default:return t}}var dm={type:"stagger",label:"Stagger",category:"modifier",description:"Ramp a property across the stream, or run a peak or a wave along it: \
|
|
2277
|
+
first shape gets From, last gets To.",quickKey:"to",inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"property",label:"Property",type:"enum",default:"width",options:hm,
|
|
2276
2278
|
description:"Width (\xD7), Opacity and Scale multiply what each shape already has; Width (px) sets it outright; Rotation adds degrees, the Offsets add pixels. Font Weight and Font Stretch set text shapes\
|
|
2277
2279
|
outright \u2014 From 400 To 900 on split letters of a variable font \u2014 and leave everything else alone."},{key:"from",label:"From",type:"number",default:1,step:.05,description:"The first shape\u2019s \
|
|
2278
2280
|
value \u2014 a factor, or pixels/degrees where the property says so."},{key:"to",label:"To",type:"number",default:2,step:.05,description:"The last shape\u2019s value. Wire from a Seq to animate the ramp."},
|
|
2279
|
-
{key:"curve",label:"Curve",type:"enum",default:"linear",options:
|
|
2281
|
+
{key:"curve",label:"Curve",type:"enum",default:"linear",options:fm,description:"How From becomes To along the stream: straight, eased at both ends, or accelerating, first shape to last. Peak is a bump\
|
|
2280
2282
|
\u2014 To at Position, From either side; Wave a sine along the stream. Wire Position or Phase to Time and it travels."},{key:"position",label:"Position",type:"number",default:.5,step:.01,description:"\
|
|
2281
2283
|
Peak: where To sits, 0 the first shape, 1 the last. Past either end the bump has left the stream \u2014 a saw LFO from \u22120.2 to 1.2 scans it through.",dimWhen:e=>Z(e.curve).base!=="peak"},{key:"wi\
|
|
2282
2284
|
dth",label:"Peak Width",type:"number",default:.3,min:.01,max:2,step:.01,description:"Peak: how far either side of Position the bump reaches, as a fraction of the stream \u2014 0.3 spans about a third of it\
|
|
2283
2285
|
each way.",dimWhen:e=>Z(e.curve).base!=="peak"},{key:"cycles",label:"Cycles",type:"number",default:1,min:.01,step:.05,description:"Wave: how many full waves fit along the stream.",dimWhen:e=>Z(e.curve).
|
|
2284
2286
|
base!=="wave"},{key:"phase",label:"Phase",type:"number",default:0,step:.01,unit:"turn",description:"Wave: slides the wave along the stream, one turn per wave. Wire Time (times a speed) and it rolls.",
|
|
2285
|
-
dimWhen:e=>Z(e.curve).base!=="wave"},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:
|
|
2287
|
+
dimWhen:e=>Z(e.curve).base!=="wave"},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:ri,description:"Scale only: ramp both axes, or one \u2014 bars that grow taller along the row while ke\
|
|
2286
2288
|
eping their width.",dimWhen:e=>Z(e.property).base!=="scale"}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("property",["width","widthPx","opacity","scale","rotation","offsetX","offsetY","weight",
|
|
2287
2289
|
"stretch"]),i=e.enumOf("curve",["linear","ease","expo","peak","wave"]),s=e.enumOf("axis",["both","x","y"]),l=e.num("position"),u=e.num("width"),h=e.num("cycles"),f=e.num("phase"),A=t.map((d,y)=>{let g=n<=
|
|
2288
|
-
1?0:y/(n-1),x=
|
|
2290
|
+
1?0:y/(n-1),x=pm(i,g,l,u,h,f),v=e.num("from",y,n)+(e.num("to",y,n)-e.num("from",y,n))*x;if(r==="weight"||r==="stretch"){if(d.kind!=="text")return Mr(d,y);let M=r==="weight"?Tt(d.fontFamily,v):d.fontWeight??
|
|
2289
2291
|
400,S=r==="stretch"?ln(d.fontFamily,v):d.fontStretch,T=e.outline?.measure?.({text:d.text,family:d.fontFamily,weight:M,stretch:S,size:d.fontSize,letterSpacing:d.letterSpacing});return{...d,fontWeight:M,
|
|
2290
2292
|
...S!==void 0?{fontStretch:S}:{},...T?{metrics:{width:T.width,capHeight:T.capHeight}}:{},meta:{...d.meta,index:y}}}if(r==="width"||r==="widthPx"||r==="opacity"){let M={...d.style};return r==="width"?M.
|
|
2291
2293
|
strokeWidth=Math.max(0,(M.strokeWidth??1)*v):r==="widthPx"?M.strokeWidth=Math.max(0,v):M.opacity=Math.max(0,Math.min(1,(M.opacity??1)*v)),{...d,style:M,meta:{...d.meta,index:y}}}if(r==="offsetX"||r===
|
|
2292
|
-
"offsetY"){let M=Kt(r==="offsetX"?{tx:v}:{ty:v});return{...d,transform:me(M,d.transform),meta:{...d.meta,index:y}}}let b=ys(d);if(r==="scale")return{...
|
|
2293
|
-
index:y}};let C=Kt({rotation:v,pivot:b});return{...d,transform:me(C,d.transform),meta:{...d.meta,index:y}}});return{out:V(A)}}},
|
|
2294
|
+
"offsetY"){let M=Kt(r==="offsetX"?{tx:v}:{ty:v});return{...d,transform:me(M,d.transform),meta:{...d.meta,index:y}}}let b=ys(d);if(r==="scale")return{...oi(d,s==="y"?1:v,s==="x"?1:v,b),meta:{...d.meta,
|
|
2295
|
+
index:y}};let C=Kt({rotation:v,pivot:b});return{...d,transform:me(C,d.transform),meta:{...d.meta,index:y}}});return{out:V(A)}}},Am=[nm,rm,lm,cm,dm];function mm(e){let t=new Set;for(let n of e.split(/[\s,;]+/)){
|
|
2294
2296
|
if(!n)continue;let r=/^(\d+)\s*[-–]\s*(\d+)$/.exec(n);if(r){let s=Number(r[1]),l=Number(r[2]);for(let u=Math.min(s,l);u<=Math.max(s,l);u++)t.add(u);continue}let i=Number(n);Number.isInteger(i)&&i>=0&&
|
|
2295
|
-
t.add(i)}return[...t].sort((n,r)=>n-r)}var vu=e=>eo(e.fontFamily),
|
|
2297
|
+
t.add(i)}return[...t].sort((n,r)=>n-r)}var vu=e=>eo(e.fontFamily),ym=e=>ji(e.fontFamily,e.fontWeight??400,e.fontStretch).variation!==void 0,gm=e=>vu(e)||ym(e),bm=()=>!0;function vm(e,t){let n=r=>r.some(i=>i.kind==="text"?t(i):i.kind==="gro\
|
|
2296
2298
|
up"&&n(i.children));return e.layers.some(r=>n(r.shapes))}function vs(e,t,n){if(e.kind==="group"){let Y=e.children.map(F=>vs(F,t,n));return Y.some((F,$)=>F!==e.children[$])?{...e,children:Y}:e}if(e.kind!=="text"||!n(e))return e;let r=e.fontWeight??400,i=t({text:e.
|
|
2297
2299
|
text,family:e.fontFamily,weight:r,stretch:e.fontStretch,size:e.fontSize,letterSpacing:e.letterSpacing});if(!i)return e;let s=e.anchor==="middle"?-i.width/2:e.anchor==="end"?-i.width:0,[l,u,h,f,A,d]=e.
|
|
2298
2300
|
transform,y=e.x+s,g=e.y,{x,y:v,text:b,fontSize:C,fontFamily:M,fontWeight:S,fontStretch:T,anchor:P,letterSpacing:E,metrics:_,...Q}=e;return{...Q,kind:"path",d:i.d,transform:[l,u,h,f,l*y+h*g+A,u*y+f*g+d],
|
|
2299
|
-
meta:{...e.meta,tags:[...e.meta.tags??[],"glyphs"]}}}function
|
|
2300
|
-
return i.some((s,l)=>s!==r.shapes[l])?{...r,shapes:i}:r})}}function Iu(e,t){return
|
|
2301
|
+
meta:{...e.meta,tags:[...e.meta.tags??[],"glyphs"]}}}function Im(e,t,n=!1){return vs(e,t,n?bm:gm)}function xm(e,t,n){return!t||!vm(e,n)?e:{...e,layers:e.layers.map(r=>{let i=r.shapes.map(s=>vs(s,t,n));
|
|
2302
|
+
return i.some((s,l)=>s!==r.shapes[l])?{...r,shapes:i}:r})}}function Iu(e,t){return xm(e,t,vu)}var bn=e=>t=>(Z(t.mode).base??"every-nth")!==e,wm={type:"select",label:"Select",category:"layout",description:"Split a stream into a chosen subset and the rest. Select this node and the artboard numbe\
|
|
2301
2303
|
rs its input; By Index mode lets you click shapes to pick them. Count and Index leave as numbers for a Mapping.",inputs:[{name:"in",type:"shapes"},{name:"reseed",type:"number",label:"Reseed",clock:!0}],
|
|
2302
2304
|
outputs:[{name:"out",type:"shapes",label:"selected"},{name:"rest",type:"shapes",label:"rest"},{name:"count",type:"number",label:"count"},{name:"index",type:"number",label:"index"}],params:[{key:"mode",
|
|
2303
2305
|
label:"Mode",type:"enum",default:"every-nth",options:[{value:"every-nth",label:"Every Nth"},{value:"range",label:"Range"},{value:"list",label:"By index"},{value:"random",label:"Random subset"},{value:"\
|
|
@@ -2312,14 +2314,14 @@ nstead.",dimWhen:bn("random")},{key:"tag",label:"Tag",type:"string",default:"maj
|
|
|
2312
2314
|
gh Merges and modifiers. Tick Ring tags "major", Scatter "scattered", Switch "switch".',dimWhen:bn("tag")},{key:"test",label:"Test",type:"string",default:"i % 2 == 0",exposable:!1,description:"Express\
|
|
2313
2315
|
ion over i and n; non-zero selects.",dimWhen:bn("expr")},{key:"invert",label:"Invert",type:"bool",default:!1}],cook(e){let t=e.shapes("in"),n=t.length,r=e.enumOf("mode",["every-nth","range","list","ra\
|
|
2314
2316
|
ndom","tag","expr"]),i=e.bool("invert"),s=Math.max(1,e.int("n")),l=e.int("offset"),u=e.int("from"),h=e.int("to"),f=e.num("chance"),A=e.str("tag"),d=e.wires.list,y=new Set(d?.t==="number"?[Math.floor(d.
|
|
2315
|
-
v)]:d?.t==="numbers"?d.v.map(P=>Math.floor(P)):
|
|
2317
|
+
v)]:d?.t==="numbers"?d.v.map(P=>Math.floor(P)):mm(e.str("list"))),g=e.inputs.reseed,x=0;if(g?.t==="number"){let{playing:P,local:E}=en(g.v);x=P?Math.round((e.t-E)*1e3):-Math.round(E*1e3)-1}let v=e.int(
|
|
2316
2318
|
"salt"),b=P=>v===0&&x===0?e.rand("select",P):e.rand("select",v,x,P),C;if(r==="expr")try{C=To(e.str("test"))}catch{C=void 0}let M=[],S=[];for(let[P,E]of t.entries()){let _;switch(r){case"every-nth":_=(P-
|
|
2317
2319
|
l)%s===0&&P>=l;break;case"range":_=P>=u&&P<=h;break;case"list":_=y.has(P);break;case"random":_=b(P).next()<f;break;case"tag":_=(E.meta.tags??[]).includes(A);break;case"expr":_=C?C({i:P,n,t:e.t})!==0:!1;
|
|
2318
2320
|
break}i&&(_=!_);let Q=_?M:S;Q.push(Mr(E,Q.length))}let T=-1;for(let[P,E]of t.entries())if(M.some(_=>_.id===E.id)){T=P;break}return{out:V(M),rest:V(S),count:Te(M.length),index:Te(T)}}};function Qr(e){return Z(
|
|
2319
|
-
e.alignX).base===!1&&Z(e.alignY).base===!1}function
|
|
2321
|
+
e.alignX).base===!1&&Z(e.alignY).base===!1}function Go(e,t){let n=[];for(let r of e)n.push(...rt(t?Im(r,t,!0):r));return n}function xu(e,t,n){let r=-1/0;for(let{points:i,closed:s}of n){let l=i.length,
|
|
2320
2322
|
u=s?l:l-1;for(let h=0;h<u;h++){let f=i[h],A=i[(h+1)%l],d=A.x-f.x,y=A.y-f.y,g=t.x*y-t.y*d;if(Math.abs(g)<1e-12)continue;let x=f.x-e.x,v=f.y-e.y,b=(x*y-v*d)/g,C=(x*t.y-v*t.x)/g;b>0&&C>=0&&C<=1&&b>r&&(r=
|
|
2321
|
-
b)}}return r>-1/0?{x:e.x+t.x*r,y:e.y+t.y*r}:void 0}function
|
|
2322
|
-
1e-12?e.h/2/Math.abs(t.y):1/0;return Math.min(s,l)}var
|
|
2323
|
+
b)}}return r>-1/0?{x:e.x+t.x*r,y:e.y+t.y*r}:void 0}function Cm(e,t,n){let r=nt(e),i=xu(r,t,n);if(i)return Math.hypot(i.x-r.x,i.y-r.y);let s=Math.abs(t.x)>1e-12?e.w/2/Math.abs(t.x):1/0,l=Math.abs(t.y)>
|
|
2324
|
+
1e-12?e.h/2/Math.abs(t.y):1/0;return Math.min(s,l)}var km={type:"align",label:"Align",category:"layout",description:"Pin shapes to a point on the frame \u2014 the stream bounds, or the ref stream when wire\
|
|
2323
2325
|
d. Angle picks the edge point, Reach 0 is the centre. Frame: the box around it, or its actual outline.",inputs:[{name:"in",type:"shapes"},{name:"ref",type:"shapes",label:"Ref"}],outputs:[{name:"out",type:"\
|
|
2324
2326
|
shapes"}],params:[{key:"frame",label:"Frame",type:"enum",default:"box",options:[{value:"box",label:"Box"},{value:"outline",label:"Outline"}],description:"What Angle picks a point on. Box is the rectan\
|
|
2325
2327
|
gle around the frame \u2014 45\xB0 is always its corner, right for panels. Outline is the frame\u2019s own edge: from its centre, look out along Angle and pin where the line of sight meets the shape \u2014 a circle pin\
|
|
@@ -2336,11 +2338,11 @@ dimWhen:Qr},{key:"influence",label:"Influence",type:"number",default:1,min:0,max
|
|
|
2336
2338
|
{key:"passRef",label:"Show Ref",type:"bool",default:!1,description:"Also emit the ref shapes, like a Merge \u2014 the panel and the things pinned to it leave in one stream."}],cook(e){let t=e.shapes("\
|
|
2337
2339
|
in"),n=e.shapes("ref"),r=P=>e.bool("passRef")?[...P,...n.map((E,_)=>({...E,meta:{...E.meta,index:P.length+_}}))]:P,i=n.length>0?n:t,s=at(i);if(!s)return{out:V(r(t))};let l=e.bool("alignX"),u=e.bool("a\
|
|
2338
2340
|
lignY");if(!l&&!u)return{out:V(r(t))};let h=e.int("snap"),f=h>0?90/2**(h-1):0,A=e.enumOf("side",["inside","on-edge","outside"]),d=A==="inside"?0:A==="on-edge"?.5:1,y=e.bool("asOne"),g=y?at(t):void 0,x=y?
|
|
2339
|
-
1:t.length,v=e.enumOf("frame",["box","outline"])==="outline",b=v?
|
|
2341
|
+
1:t.length,v=e.enumOf("frame",["box","outline"])==="outline",b=v?Go(i,e.outline):[],C=nt(s),M=P=>v?Go(y?t:[P],e.outline):[],S=v&&y?Go(t,e.outline):void 0,T=t.map((P,E)=>{let _=y?0:E,Q=y?g:Ze(P);if(!Q)
|
|
2340
2342
|
return P;let Y=e.num("angle",_,x),$=(f>0?Math.round(Y/f)*f:Y)*Math.PI/180,W=Math.cos($),G=Math.sin($),oe=Math.max(Math.abs(W),Math.abs(G))||1,ce=Math.max(0,Math.min(1,e.num("reach",_,x))),he=(1+W/oe*ce)/
|
|
2341
2343
|
2,se=(1+G/oe*ce)/2,Ae=Math.max(0,Math.min(1,e.num("influence",_,x))),ve=s.x-d*Q.w+he*(s.w+(2*d-1)*Q.w),ne=s.y-d*Q.h+se*(s.h+(2*d-1)*Q.h);if(v){let Se={x:W,y:G},Fe=xu(C,Se,b);if(Fe){let lt=C.x+(Fe.x-C.
|
|
2342
|
-
x)*ce,de=C.y+(Fe.y-C.y)*ce,Ie=
|
|
2343
|
-
meta,index:E}}});return{out:V(r(T))}}},
|
|
2344
|
+
x)*ce,de=C.y+(Fe.y-C.y)*ce,Ie=Cm(Q,Se,S??M(P))*(1-2*d)*ce;ve=lt-Se.x*Ie-Q.w/2,ne=de-Se.y*Ie-Q.h/2}}let ge=l?(ve-Q.x)*Ae:0,_e=u?(ne-Q.y)*Ae:0;return{...P,transform:me(Re(ge,_e),P.transform),meta:{...P.
|
|
2345
|
+
meta,index:E}}});return{out:V(r(T))}}},Em={type:"distribute",label:"Distribute",category:"layout",description:"Space shapes evenly: equal steps between their leading edges, or equal gaps between them.",
|
|
2344
2346
|
inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"axis",label:"Axis",type:"enum",default:"x",options:[{value:"x",label:"Horizontal"},{value:"y",label:"Vertical"}]},
|
|
2345
2347
|
{key:"mode",label:"Measure",type:"enum",default:"edges",options:[{value:"edges",label:"Edges"},{value:"gaps",label:"Gaps"}],description:"Edges keeps the leading edges an equal step apart. Gaps keeps t\
|
|
2346
2348
|
he SPACE between neighbours equal \u2014 what a row of growing bars needs."},{key:"spacing",label:"Spacing",type:"number",default:-1,step:.5,unit:"px",description:"The step (Edges) or the gap (Gaps). \
|
|
@@ -2348,13 +2350,13 @@ Negative spreads across the existing bounds."}],cook(e){let t=e.shapes("in");if(
|
|
|
2348
2350
|
map(C=>({shape:C,b:Ze(C)})),l=at(t);if(!l)return{out:V(t)};let u=[...s].sort((C,M)=>{let S=C.b?n==="x"?C.b.x:C.b.y:0,T=M.b?n==="x"?M.b.x:M.b.y:0;return S-T}),h=n==="x"?l.x:l.y,f=n==="x"?l.w:l.h,A=u.filter(
|
|
2349
2351
|
C=>C.b),d=C=>n==="x"?C.w:C.h,y=i>=0?i:f/Math.max(1,u.length-1),g=A.reduce((C,M)=>C+d(M.b),0),x=i>=0?i:Math.max(0,f-g)/Math.max(1,A.length-1),v=new Map,b=h;return u.forEach(({shape:C,b:M},S)=>{if(!M){v.
|
|
2350
2352
|
set(C.id,C);return}let T=r==="gaps"?b:h+y*S;b=T+d(M)+x;let P=n==="x"?M.x:M.y,E=T-P;v.set(C.id,{...C,transform:me(Re(n==="x"?E:0,n==="y"?E:0),C.transform)})}),{out:V(t.map((C,M)=>({...v.get(C.id)??C,meta:{
|
|
2351
|
-
...C.meta,index:M}})))}}},
|
|
2353
|
+
...C.meta,index:M}})))}}},Sm={type:"merge",label:"Merge",category:"layout",description:"Concatenate several streams into one, in connection order. Group hands them on as one shape; name the node to ta\
|
|
2352
2354
|
g what leaves it.",keywords:["join","concat","combine","collect","group","bake","flatten","unit","as one","wrap","compound"],inputs:[{name:"in",type:"shapes",multi:!0}],outputs:[{name:"out",type:"shap\
|
|
2353
2355
|
es"}],params:[{key:"group",label:"Group",type:"bool",default:!1,description:"Leave as one group shape instead of a stream \u2014 Align, Array and Jitter then move the lot as a unit. The same as a Group nod\
|
|
2354
2356
|
e after the Merge."}],cook(e){let t=[];for(let n of e.inputList("in"))if(n.t==="shapes")for(let r of n.v)t.push(Mr(r,t.length));return e.bool("group")&&t.length>0?{out:V([{id:e.shapeId(0),kind:"group",
|
|
2355
|
-
children:t,style:{},transform:[1,0,0,1,0,0],meta:e.meta(0)}])}:{out:V(t)}}},
|
|
2356
|
-
:`;if(e.id.startsWith(t)){let n=Number.parseInt(e.id.slice(t.length),10);if(Number.isFinite(n))return n}return e.meta.index}function
|
|
2357
|
-
floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}var
|
|
2357
|
+
children:t,style:{},transform:[1,0,0,1,0,0],meta:e.meta(0)}])}:{out:V(t)}}},Bm=["source","reading","x","y","angle","shuffle"],ns=e=>t=>(Z(t.by).base??"source")!==e;function Ml(e){let t=`${e.meta.sourceNodeId}\
|
|
2358
|
+
:`;if(e.id.startsWith(t)){let n=Number.parseInt(e.id.slice(t.length),10);if(Number.isFinite(n))return n}return e.meta.index}function Pm(e){if(e.length===0)return 0;let t=[...e].sort((r,i)=>r-i),n=Math.
|
|
2359
|
+
floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}var _m={type:"sort",label:"Sort",category:"layout",description:"Renumber a stream \u2014 back to the order its emitter made it (Source), or by where\
|
|
2358
2360
|
each shape sits. Select, Stagger, Reveal and Deal follow that order. A Select-and-Merge round trip puts the picked shapes first; Source order undoes that.",keywords:["order","reorder","reindex","renu\
|
|
2359
2361
|
mber","reading order","sequence","index","shuffle","random","randomize","scramble"],inputs:[{name:"in",type:"shapes"},{name:"reseed",type:"number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"\
|
|
2360
2362
|
shapes"}],params:[{key:"by",label:"By",type:"enum",default:"source",options:[{value:"source",label:"Source order"},{value:"reading",label:"Reading order"},{value:"x",label:"Left to right"},{value:"y",
|
|
@@ -2365,17 +2367,17 @@ min:0,max:5,step:.05,description:"How far two centres may sit apart vertically,
|
|
|
2365
2367
|
y.",dimWhen:ns("reading")},{key:"start",label:"Start",type:"number",default:0,step:1,unit:"deg",description:"Where the count begins around the stream's centre: 0 is 12 o'clock, 90 is 3 o'clock, clockw\
|
|
2366
2368
|
ise from there \u2014 the Tick Ring convention. Around centre only.",dimWhen:ns("angle")},{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll the shuffle \u2014 the \u2212/+ steppers walk th\
|
|
2367
2369
|
rough orders. 0 = the project seed alone. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead. Shuffle only.",dimWhen:ns("shuffle")},{key:"reverse",label:"Reverse",type:"bool",default:!1}],
|
|
2368
|
-
cook(e){let t=e.shapes("in"),n=e.enumOf("by",
|
|
2370
|
+
cook(e){let t=e.shapes("in"),n=e.enumOf("by",Bm),r;if(n==="shuffle"){let i=e.inputs.reseed,s=0;if(i?.t==="number"){let{playing:h,local:f}=en(i.v);s=h?Math.round((e.t-f)*1e3):-Math.round(f*1e3)-1}let l=e.
|
|
2369
2371
|
int("salt"),u=new Map(t.map(h=>[h.id,e.rand("shuffle",l,s,h.id).next()]));r=[...t].sort((h,f)=>u.get(h.id)-u.get(f.id)||h.id.localeCompare(f.id))}else if(n==="source"){let i=[];for(let s of t)i.includes(
|
|
2370
2372
|
s.meta.sourceNodeId)||i.push(s.meta.sourceNodeId);r=[...t].sort((s,l)=>{let u=i.indexOf(s.meta.sourceNodeId)-i.indexOf(l.meta.sourceNodeId);return u!==0?u:Ml(s)-Ml(l)||s.id.localeCompare(l.id)})}else{
|
|
2371
2373
|
let i=[],s=[];for(let l of t){let u=Ze(l);if(u){let h=nt(u);i.push({shape:l,cx:h.x,cy:h.y,h:u.h})}else s.push(l)}if(n==="x")i.sort((l,u)=>l.cx-u.cx||l.cy-u.cy);else if(n==="y")i.sort((l,u)=>l.cy-u.cy||
|
|
2372
|
-
l.cx-u.cx);else if(n==="reading"){let l=e.num("rowTolerance")*
|
|
2373
|
-
h.sort((f,A)=>f.cx-A.cx);i.splice(0,i.length,...u.flat())}else{let l=at(t),u=l?nt(l):{x:0,y:0},h=
|
|
2374
|
-
1e-6?0:y};i.sort((A,d)=>f(A)-f(d)||Math.hypot(A.cx-u.x,A.cy-u.y)-Math.hypot(d.cx-u.x,d.cy-u.y))}r=[...i.map(l=>l.shape),...s]}return e.bool("reverse")&&r.reverse(),{out:V(r.map((i,s)=>Mr(i,s)))}}},
|
|
2374
|
+
l.cx-u.cx);else if(n==="reading"){let l=e.num("rowTolerance")*Pm(i.map(h=>h.h));i.sort((h,f)=>h.cy-f.cy);let u=[];for(let h of i){let f=u[u.length-1];f&&h.cy-f[0].cy<=l?f.push(h):u.push([h])}for(let h of u)
|
|
2375
|
+
h.sort((f,A)=>f.cx-A.cx);i.splice(0,i.length,...u.flat())}else{let l=at(t),u=l?nt(l):{x:0,y:0},h=dr(e.num("start")),f=A=>{let y=((Math.atan2(A.cy-u.y,A.cx-u.x)*180/Math.PI-h)%360+360)%360;return y>360-
|
|
2376
|
+
1e-6?0:y};i.sort((A,d)=>f(A)-f(d)||Math.hypot(A.cx-u.x,A.cy-u.y)-Math.hypot(d.cx-u.x,d.cy-u.y))}r=[...i.map(l=>l.shape),...s]}return e.bool("reverse")&&r.reverse(),{out:V(r.map((i,s)=>Mr(i,s)))}}},Mm={
|
|
2375
2377
|
type:"group",label:"Group",category:"layout",description:"Retired: a Merge with Group ticked does this. Kept so older documents still load. Wraps a stream in one group shape.",hidden:!0,inputs:[{name:"\
|
|
2376
2378
|
in",type:"shapes"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"name",label:"Tag",type:"string",default:"group",exposable:!1,description:"An extra tag on the group shape. Naming the node itself\
|
|
2377
2379
|
(the field at the top of the inspector) tags it too, and works on every node."}],cook(e){let t=e.shapes("in");return t.length===0?{out:V([])}:{out:V([{id:e.shapeId(0),kind:"group",children:t,style:{},
|
|
2378
|
-
transform:[1,0,0,1,0,0],meta:e.meta(0,[e.str("name")])}])}}},
|
|
2380
|
+
transform:[1,0,0,1,0,0],meta:e.meta(0,[e.str("name")])}])}}},Tm={type:"bounds",label:"Bounds",category:"layout",description:"Measure a stream: the box round everything that comes in leaves as numbers \
|
|
2379
2381
|
\u2014 X and Y of its top-left corner, W and H, and the centre \u2014 for a Mapping or a Value socket, and Count says how many shapes came in. The shapes pass through unchanged. After a Select it measures the p\
|
|
2380
2382
|
icked shapes. Per shape measures each one instead, and the sockets carry a list that fans across a modifier: shape i gets value i.",keywords:["measure","size","width","height","extent","box","bbox","d\
|
|
2381
2383
|
imensions","centre","center","count","length","how many"],inputs:[{name:"in",type:"shapes"}],outputs:[{name:"out",type:"shapes"},{name:"x",type:"number",label:"x"},{name:"y",type:"number",label:"y"},{
|
|
@@ -2383,143 +2385,143 @@ name:"w",type:"number",label:"w"},{name:"h",type:"number",label:"h"},{name:"cx",
|
|
|
2383
2385
|
{key:"each",label:"Per shape",type:"bool",default:!1,description:"Measure every shape on its own instead of the whole stream. Each socket then carries one number per shape, in stream order; wired into\
|
|
2384
2386
|
a modifier it fans out \u2014 shape 0 reads the first, shape 1 the second \u2014 so a bar's own width can set its label's offset. A Mapping or Value reads the first."}],cook(e){let t=e.shapes("in"),n=Te(
|
|
2385
2387
|
t.length);if(e.bool("each")){let s=t.map(u=>Ze(u)??{x:0,y:0,w:0,h:0}),l=u=>({t:"numbers",v:s.map(u)});return{out:V(t),x:l(u=>u.x),y:l(u=>u.y),w:l(u=>u.w),h:l(u=>u.h),cx:l(u=>nt(u).x),cy:l(u=>nt(u).y),
|
|
2386
|
-
count:n}}let r=at(t)??{x:0,y:0,w:0,h:0},i=nt(r);return{out:V(t),x:Te(r.x),y:Te(r.y),w:Te(r.w),h:Te(r.h),cx:Te(i.x),cy:Te(i.y),count:n}}},
|
|
2388
|
+
count:n}}let r=at(t)??{x:0,y:0,w:0,h:0},i=nt(r);return{out:V(t),x:Te(r.x),y:Te(r.y),w:Te(r.w),h:Te(r.h),cx:Te(i.x),cy:Te(i.y),count:n}}},Rm=[wm,Tm,km,Em,Sm,_m,Mm],Qm={type:"time",label:"Time",category:"\
|
|
2387
2389
|
driver",timeRoot:!0,description:"Seconds, scaled and offset. The root of most motion.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"speed",label:"Speed",type:"number",default:1,step:.01},
|
|
2388
|
-
{key:"offset",label:"Offset",type:"number",default:0,step:.01,unit:"s"}],cook(e){return{out:Te(e.t*e.num("speed")+e.num("offset"))}}},Tl=["sine","triangle","square","saw","sh","random"],
|
|
2389
|
-
triangle:"Triangle",square:"Square",saw:"Saw",sh:"S&H",random:"Random"},
|
|
2390
|
+
{key:"offset",label:"Offset",type:"number",default:0,step:.01,unit:"s"}],cook(e){return{out:Te(e.t*e.num("speed")+e.num("offset"))}}},Tl=["sine","triangle","square","saw","sh","random"],Nm={sine:"Sine",
|
|
2391
|
+
triangle:"Triangle",square:"Square",saw:"Saw",sh:"S&H",random:"Random"},Zo=e=>Z(e.shape).base??"sine",Dm=e=>Zo(e)==="square"||Zo(e)==="triangle",Om=e=>Zo(e)==="sh"||Zo(e)==="random";function Lm(e,t,n,r){
|
|
2390
2392
|
let i=Math.floor(t),s=t-i,l=Math.max(0,Math.min(1,n));switch(e){case"sine":return Math.sin(s*Math.PI*2);case"triangle":return s<l?-1+2*s/l:1-2*(s-l)/(1-l);case"square":return s<l?1:-1;case"saw":return s*
|
|
2391
|
-
2-1;case"sh":return r(i);case"random":{let u=r(i),h=r(i+1),f=(1-Math.cos(s*Math.PI))/2;return u+(h-u)*f}}}var
|
|
2393
|
+
2-1;case"sh":return r(i);case"random":{let u=r(i),h=r(i+1),f=(1-Math.cos(s*Math.PI))/2;return u+(h-u)*f}}}var Fm="lfo-hold",ai=e=>e===0?"":e,Ym={type:"lfo",label:"LFO",category:"driver",timeRoot:!0,description:"\
|
|
2392
2394
|
A periodic wave over time. Wire its rate for FM, its width for PWM.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"shape",label:"Shape",type:"enum",default:"sine",options:Tl.map(e=>({value:e,
|
|
2393
|
-
label:
|
|
2395
|
+
label:Nm[e]})),description:"S&H holds one seeded random value per cycle; Random glides between them. Both replay identically."},{key:"rate",label:"Rate",type:"number",default:.5,min:0,step:.01,unit:"h\
|
|
2394
2396
|
z"},{key:"amplitude",label:"Amplitude",type:"number",default:1,step:.1},{key:"unipolar",label:"From 0",type:"bool",default:!1,inline:!0,description:"Swing from Center up to Center + Amplitude instead \
|
|
2395
2397
|
of Center \xB1 Amplitude \u2014 with Center 0 the output reads 0 to Amplitude, so a radius or an opacity takes it straight."},{key:"center",label:"Center",type:"number",default:0,step:.1},{key:"phase",
|
|
2396
2398
|
label:"Phase",type:"number",default:0,min:0,max:1,step:.001,unit:"turn"},{key:"width",label:"Width",type:"number",default:.5,min:0,max:1,step:.01,description:"Square: the high fraction of each cycle (\
|
|
2397
|
-
wire it for PWM). Triangle: where the peak sits \u2014 0 or 1 makes a saw.",dimWhen:e=>!
|
|
2398
|
-
pers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:e=>!
|
|
2399
|
-
rand(
|
|
2399
|
+
wire it for PWM). Triangle: where the peak sits \u2014 0 or 1 makes a saw.",dimWhen:e=>!Dm(e)},{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll S&H / Random alone \u2014 the \u2212/+ step\
|
|
2400
|
+
pers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:e=>!Om(e)}],cook(e){let t=e.enumOf("shape",Tl),n=e.t*e.num("rate")+e.num("phase"),r=ai(e.int("salt")),i=u=>e.
|
|
2401
|
+
rand(Fm,r,u).range(-1,1),s=Lm(t,n,e.num("width"),i),l=e.bool("unipolar")?(s+1)/2:s;return{out:Te(e.num("center")+l*e.num("amplitude"))}}},Xm={type:"noise",label:"Noise",category:"driver",timeRoot:!0,description:"\
|
|
2400
2402
|
Smooth seeded noise over time \u2014 drift, not static.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"frequency",label:"Frequency",type:"number",default:.5,min:0,step:.01,unit:"hz"},{key:"\
|
|
2401
2403
|
amplitude",label:"Amplitude",type:"number",default:1,step:.1},{key:"unipolar",label:"From 0",type:"bool",default:!1,inline:!0,description:"Drift from Center up to Center + Amplitude instead of Center \
|
|
2402
2404
|
\xB1 Amplitude \u2014 with Center 0 the output reads 0 to Amplitude."},{key:"center",label:"Center",type:"number",default:0,step:.1},{key:"octaves",label:"Octaves",type:"int",default:2,min:1,max:6,description:"\
|
|
2403
2405
|
Layers of detail. 1 is one smooth drift; each extra layer adds a smaller, faster ripple on top of it. Low for lazy glides, high for a nervous tremble. The range stays inside Amplitude either way."},{key:"\
|
|
2404
2406
|
salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll the drift \u2014 the \u2212/+ steppers walk through variations, each as smooth as the last. 0 = the project seed alone. Wire a number in to driv\
|
|
2405
2407
|
e it: a Seq steps through drifts on cue."}],cook(e){let t=e.int("salt"),n=`${e.seed}|${e.nodeId}|${t===0?"":t}`,r=ya(n,e.t*e.num("frequency"),e.int("octaves")),i=e.bool("unipolar")?(r+1)/2:r;return{out:Te(
|
|
2406
|
-
e.num("center")+i*e.num("amplitude"))}}},
|
|
2408
|
+
e.num("center")+i*e.num("amplitude"))}}},Wm={type:"random-value",label:"Random Value",category:"driver",description:"One seeded random number in a range. Still \u2014 reroll the seed to change it.",inputs:[],
|
|
2407
2409
|
outputs:[{name:"out",type:"number"}],params:[{key:"min",label:"Min",type:"number",default:0,step:.1},{key:"max",label:"Max",type:"number",default:1,step:.1},{key:"step",label:"Snap",type:"number",default:0,
|
|
2408
2410
|
min:0,step:.1,description:"0 = continuous."},{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll the number \u2014 the \u2212/+ steppers walk through draws. 0 = the project seed alone. Wire \
|
|
2409
|
-
a number in to drive it."}],cook(e){let t=e.num("min"),n=e.num("max"),r=e.num("step"),i=e.rand("value",
|
|
2410
|
-
|
|
2411
|
+
a number in to drive it."}],cook(e){let t=e.num("min"),n=e.num("max"),r=e.num("step"),i=e.rand("value",ai(e.int("salt"))).range(Math.min(t,n),Math.max(t,n));return r>0&&(i=Math.round(i/r)*r),{out:Te(i)}}},
|
|
2412
|
+
Gm={type:"clip",label:"Seq",category:"driver",timeRoot:!0,wide:!0,description:"A tiny dope sheet on its own local clock. Free-runs from t=0, or wire a Trigger into play to start and stop it.",inputs:[
|
|
2411
2413
|
{name:"play",type:"number",clock:!0}],outputs:[{name:"out",type:"number"}],params:[{key:"keys",label:"Keys",type:"number",default:0,exposable:!1,dopesheet:!0,description:"Click the lane to add a keyfr\
|
|
2412
2414
|
ame; drag to retime and revalue, double-click to delete."},{key:"speed",label:"Speed",type:"number",default:1,step:.1},{key:"loops",label:"Loops",type:"int",default:0,min:0,description:"0 = forever. C\
|
|
2413
2415
|
ounts passes in loop and ping-pong modes; the clip parks where the last pass ends."},{key:"duration",label:"Duration",type:"number",default:3,min:.1,step:.1,unit:"s",description:"The clip's length: th\
|
|
2414
2416
|
e lane spans it, and loop and ping-pong cycle over it \u2014 not over the keys' extent."}],cook(e){let t=e.track("keys");if(!t||t.keyframes.length===0)return{out:Te(e.num("keys"))};let n=e.inputs.play,
|
|
2415
|
-
r=n?.t==="number"?n.v:An(!0,e.t),i=en(r).local*e.num("speed"),s=Math.max(.001,e.num("duration"));return{out:Te(ba(t,i,e.int("loops"),s)??0)}}},
|
|
2417
|
+
r=n?.t==="number"?n.v:An(!0,e.t),i=en(r).local*e.num("speed"),s=Math.max(.001,e.num("duration"));return{out:Te(ba(t,i,e.int("loops"),s)??0)}}},qm={type:"trigger",label:"Trigger",category:"driver",timeRoot:!0,
|
|
2416
2418
|
quickKey:"value",description:"A gate on the main timeline: select the node and press I to keyframe Value at the playhead. Start begins, Stop freezes \u2014 wire out into a Seq's play.",inputs:[],outputs:[
|
|
2417
2419
|
{name:"out",type:"number"},{name:"gate",type:"number"}],params:[{key:"value",label:"Value",type:"number",default:1,min:0,max:1,step:1,choices:[{value:1,label:"Start"},{value:0,label:"Stop"}],description:"\
|
|
2418
2420
|
What the next I keyframes at the playhead: Start begins the clip, Stop freezes it."}],cook(e){let t=e.track("value"),n=e.t;if(!t||t.keyframes.length===0){let l=e.num("value")>=.5;return{out:Te(An(l,l?
|
|
2419
|
-
n:0)),gate:Te(l?1:0)}}let r=!1,i=0,s=0;for(let l of t.keyframes){if(l.t>n)break;let u=l.value>=.5;u&&!r?(r=!0,i=l.t):!u&&r&&(r=!1,s=l.t-i)}return{out:Te(r?An(!0,n-i):An(!1,s)),gate:Te(r?1:0)}}},
|
|
2421
|
+
n:0)),gate:Te(l?1:0)}}let r=!1,i=0,s=0;for(let l of t.keyframes){if(l.t>n)break;let u=l.value>=.5;u&&!r?(r=!0,i=l.t):!u&&r&&(r=!1,s=l.t-i)}return{out:Te(r?An(!0,n-i):An(!1,s)),gate:Te(r?1:0)}}},Um={type:"\
|
|
2420
2422
|
random-step",label:"Random Step",category:"driver",timeRoot:!0,description:"A fresh seeded random number every interval \u2014 sample and hold.",inputs:[],outputs:[{name:"out",type:"number"}],params:[
|
|
2421
2423
|
{key:"interval",label:"Interval",type:"number",default:1,min:.01,step:.1,unit:"s"},{key:"min",label:"Min",type:"number",default:0,step:.1},{key:"max",label:"Max",type:"number",default:1,step:.1},{key:"\
|
|
2422
2424
|
step",label:"Snap",type:"number",default:0,min:0,step:.1,description:"0 = continuous."},{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll the sequence of holds \u2014 the \u2212/+ steppers\
|
|
2423
2425
|
walk through draws. 0 = the project seed alone. Wire a number in to drive it."}],cook(e){let t=e.num("interval"),n=t>0?Math.floor(e.t/t):0,r=e.num("min"),i=e.num("max"),s=e.num("step"),l=e.rand("valu\
|
|
2424
|
-
e",
|
|
2426
|
+
e",ai(e.int("salt")),n).range(Math.min(r,i),Math.max(r,i));return s>0&&(l=Math.round(l/s)*s),{out:Te(l)}}},Hm={type:"ramp",label:"Mapping",category:"driver",description:"Remap a value from one range t\
|
|
2425
2427
|
o another \u2014 wire anything into `value`.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"value",label:"Value",type:"number",default:0,step:.1},{key:"inMin",label:"In Min",type:"numbe\
|
|
2426
2428
|
r",default:0,step:.1},{key:"inMax",label:"In Max",type:"number",default:1,step:.1},{key:"outMin",label:"Out Min",type:"number",default:0,step:.1},{key:"outMax",label:"Out Max",type:"number",default:100,
|
|
2427
2429
|
step:.1},{key:"clamp",label:"Clamp",type:"bool",default:!0},{key:"ease",label:"Ease",type:"enum",default:"linear",options:[{value:"linear",label:"Linear"},{value:"smooth",label:"Smoothstep"},{value:"i\
|
|
2428
2430
|
n",label:"Ease In"},{value:"out",label:"Ease Out"}]}],cook(e){let t=e.num("inMin"),r=e.num("inMax")-t,i=r===0?0:(e.num("value")-t)/r;switch(e.bool("clamp")&&(i=Math.min(1,Math.max(0,i))),e.enumOf("eas\
|
|
2429
2431
|
e",["linear","smooth","in","out"])){case"smooth":i=i*i*(3-2*i);break;case"in":i=i*i;break;case"out":i=1-(1-i)*(1-i);break;case"linear":break}let s=e.num("outMin");return{out:Te(s+(e.num("outMax")-s)*i)}}},
|
|
2430
|
-
|
|
2431
|
-
andom"},{value:"pingpong",label:"Ping-pong"}],
|
|
2432
|
+
$m=[Qm,Ym,Xm,Wm,Um,Gm,qm,Hm],zm=[{value:"index",label:"Index"},{value:"normalized",label:"Normalized"}],jm=[{value:"forward",label:"Forward"},{value:"reverse",label:"Reverse"},{value:"random",label:"R\
|
|
2433
|
+
andom"},{value:"pingpong",label:"Ping-pong"}],Vm=[{value:"cut",label:"Cut"},{value:"fade",label:"Fade"},{value:"scale",label:"Scale"},{value:"draw",label:"Draw"},{value:"wipe",label:"Wipe"}],Jm=(e,t)=>(e%
|
|
2432
2434
|
t+t)%t;function po(e,t){if(t<=0)return{from:0,to:0,t:0};let n=e.enumOf("range",["index","normalized"]),r=e.enumOf("order",["forward","reverse","random","pingpong"]),i=e.bool("wrap"),s=Math.max(0,Math.
|
|
2433
2435
|
min(1,e.num("blend"))),l=Math.max(1,r==="pingpong"?2*t-2:t),u=e.num("index");if(!Number.isFinite(u))return{from:0,to:0,t:0};let h=n==="normalized"?u*l:u;h=Math.max(-1,i?h:Math.min(l-1,h));let f=Math.floor(
|
|
2434
|
-
h),A=h-f,d=
|
|
2435
|
-
let T=g(S);if(T[0]===g(S-1)[t-1]){let P=T[0];T[0]=T[1],T[1]=P}return T},v=S=>{if(S<0)return-1;let T=Math.floor(S/l),P=
|
|
2436
|
-
b=v(f);if(!i&&f>=l-1)return{from:b,to:b,t:0};let C=v(f+1),M=s<=0?A<.5?0:1:Math.max(0,Math.min(1,(A-(.5-s/2))/s));return{from:b,to:C,t:M}}var
|
|
2436
|
+
h),A=h-f,d=ai(e.int("salt")),y=r==="random"&&t>2,g=S=>{let T=Array.from({length:t},(E,_)=>_),P=e.rand("switch-order",d,S);for(let E=t-1;E>0;E--){let _=P.int(0,E+1),Q=T[E];T[E]=T[_],T[_]=Q}return T},x=S=>{
|
|
2437
|
+
let T=g(S);if(T[0]===g(S-1)[t-1]){let P=T[0];T[0]=T[1],T[1]=P}return T},v=S=>{if(S<0)return-1;let T=Math.floor(S/l),P=Jm(S,l);return r==="pingpong"&&P>=t&&(P=l-P),r==="reverse"&&(P=t-1-P),y?x(T)[P]:P},
|
|
2438
|
+
b=v(f);if(!i&&f>=l-1)return{from:b,to:b,t:0};let C=v(f+1),M=s<=0?A<.5?0:1:Math.max(0,Math.min(1,(A-(.5-s/2))/s));return{from:b,to:C,t:M}}var Zm=e=>Z(e.order).base!=="random",Km={input:{index:"0 = the \
|
|
2437
2439
|
first wire, 1 = the second \u2014 the number on each row; \u22121 is an empty slot, nothing out, so a toggle here switches the wire off. Drive it from an LFO, Seq or Random Value; fractions sit between two inpu\
|
|
2438
2440
|
ts.",range:"Normalized spreads 0..1 over every input, so a stock LFO pages through however many are wired.",wrap:"Past the last input, come round to the first. Off holds at the ends.",order:"The route\
|
|
2439
2441
|
Index takes through the inputs. Random reshuffles every cycle, deterministically."},output:{index:"0 = the first output, 1 = the second \u2014 the number on each row; \u22121 sends the stream nowhere. Drive it\
|
|
2440
2442
|
from an LFO, Seq or Random Value; fractions sit between two outputs.",range:"Normalized spreads 0..1 over the outputs in use, so a stock LFO pages through however many Outputs says.",wrap:"Past the l\
|
|
2441
|
-
ast output in use, come round to the first. Off holds at the ends.",order:"The route Index takes through the outputs. Random reshuffles every cycle, deterministically."}};function Ao(e,t="input"){let n=
|
|
2442
|
-
return[{key:"index",label:"Index",type:"number",default:0,min:-1,step:1,description:n.index},{key:"range",label:"Range",type:"enum",default:"index",options
|
|
2443
|
-
rap",type:"bool",default:!0,description:n.wrap},{key:"order",label:"Order",type:"enum",default:"forward",options:
|
|
2443
|
+
ast output in use, come round to the first. Off holds at the ends.",order:"The route Index takes through the outputs. Random reshuffles every cycle, deterministically."}};function Ao(e,t="input"){let n=Km[t];
|
|
2444
|
+
return[{key:"index",label:"Index",type:"number",default:0,min:-1,step:1,description:n.index},{key:"range",label:"Range",type:"enum",default:"index",options:zm,description:n.range},{key:"wrap",label:"W\
|
|
2445
|
+
rap",type:"bool",default:!0,description:n.wrap},{key:"order",label:"Order",type:"enum",default:"forward",options:jm,description:n.order},{key:"blend",label:"Blend",type:"number",default:0,min:0,max:1,
|
|
2444
2446
|
step:.01,description:"Width of the crossing, in steps: 0 = hard cut at the half step, 1 = the whole step is a crossfade."},...e,{key:"salt",label:"Seed",type:"int",default:0,min:0,description:"Reroll \
|
|
2445
|
-
the Random route alone \u2014 the \u2212/+ steppers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:
|
|
2446
|
-
switch"){return e.map((r,i)=>({...r,meta:{...r.meta,index:t+i,tags:[...r.meta.tags??[],n]}}))}function us(e,t,n,r,i,s){let l=[];for(let u of t)switch(r){case"fade":l.push(
|
|
2447
|
-
push(gu(u,n,i));break;case"draw":l.push(...bu(e,u,n,s+l.length));break}return l}var Cu=[{key:"transition",label:"Transition",type:"enum",default:"fade",options:
|
|
2448
|
-
aves and the incoming arrives while Blend is crossing. Cut ignores Blend."},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:
|
|
2447
|
+
the Random route alone \u2014 the \u2212/+ steppers walk through draws. 0 = the project seed alone. Wire a number in to drive it.",dimWhen:Zm}]}var ey={name:"in",type:"shapes",multi:!0,indexed:!0};function wu(e,t,n="\
|
|
2448
|
+
switch"){return e.map((r,i)=>({...r,meta:{...r.meta,index:t+i,tags:[...r.meta.tags??[],n]}}))}function us(e,t,n,r,i,s){let l=[];for(let u of t)switch(r){case"fade":l.push(Jo(u,n));break;case"scale":l.
|
|
2449
|
+
push(gu(u,n,i));break;case"draw":l.push(...bu(e,u,n,s+l.length));break}return l}var Cu=[{key:"transition",label:"Transition",type:"enum",default:"fade",options:Vm,description:"How the outgoing wire le\
|
|
2450
|
+
aves and the incoming arrives while Blend is crossing. Cut ignores Blend."},{key:"axis",label:"Scale Axis",type:"enum",default:"both",options:ri,description:"Scale transition only: cross on both axes,\
|
|
2449
2451
|
or squash along one like a blind.",dimWhen:e=>Z(e.transition).base!=="scale"},{key:"angle",label:"Wipe Angle",type:"number",default:0,step:1,unit:"deg",description:"Direction the wipe front travels. \
|
|
2450
|
-
Wipe only.",dimWhen:e=>Z(e.transition).base!=="wipe"}],
|
|
2451
|
-
ndex",inputs:[
|
|
2452
|
+
Wipe only.",dimWhen:e=>Z(e.transition).base!=="wipe"}],ty={type:"switch",label:"Switch",category:"layout",description:"Show one of several wires; Index picks, fractions cross between two.",quickKey:"i\
|
|
2453
|
+
ndex",inputs:[ey],outputs:[{name:"out",type:"shapes"}],params:Ao(Cu),cook(e){let t=e.inputList("in").flatMap(g=>g.t==="shapes"?[g.v]:[]),n=t.length;if(n===0)return{out:V([])};let{from:r,to:i,t:s}=po(e,
|
|
2452
2454
|
n),l=e.enumOf("transition",["cut","fade","scale","draw","wipe"]),u=e.enumOf("axis",["both","x","y"]),h=g=>g<0?[]:t[g];if(r===i||s<=0)return{out:V(h(r))};if(s>=1)return{out:V(h(i))};if(l==="cut")return{
|
|
2453
2455
|
out:V(h(s<.5?r:i))};let f=h(r),A=h(i),d=[];if(l==="wipe"){let g=gs(e.num("angle")),x=bs([...f,...A],g),v={...x,perShape:x.perShape.slice(0,f.length)},b={...x,perShape:x.perShape.slice(f.length)};return d.
|
|
2454
2456
|
push(...uo(e,f,s,g,v,"ahead","switch","a")),d.push(...uo(e,A,s,g,b,"behind","switch","b")),{out:V(d)}}let y=(g,x)=>d.push(...wu(us(e,g,x,l,u,d.length),d.length));return y(f,1-s),y(A,s),{out:V(d)}}},Is=8,
|
|
2455
|
-
rs=Array.from({length:Is},(e,t)=>`out${t}`),
|
|
2457
|
+
rs=Array.from({length:Is},(e,t)=>`out${t}`),ny=V([]);function os(e){let t=Z(e.count).base,n=typeof t=="number"&&Number.isFinite(t)?Math.round(t):2;return Math.max(2,Math.min(Is,n))}var ry={type:"route",
|
|
2456
2458
|
label:"Route",category:"layout",description:"Send one wire to one of several outputs; Index picks, fractions cross between two.",keywords:["demux","demultiplex","output switch","distribute","send","de\
|
|
2457
2459
|
stination"],quickKey:"index",inputs:[{name:"in",type:"shapes"}],outputs:rs.map((e,t)=>({name:e,type:"shapes",label:String(t),hideWhen:n=>t>=os(n)})),params:[{key:"count",label:"Outputs",type:"int",default:2,
|
|
2458
2460
|
min:2,max:Is,description:"How many outputs the node has, up to 8. Index walks these; Normalized, Wrap and Order spread over them. An output still wired past the count keeps its row."},...Ao(Cu,"output").
|
|
2459
|
-
map(e=>e.key==="index"&&e.type==="number"?{...e,rangeFor:t=>({min:-1,max:os(t)-1})}:e)],cook(e){let t=e.shapes("in"),n=os({...e.params,count:e.int("count")}),r={};for(let d of rs)r[d]=
|
|
2461
|
+
map(e=>e.key==="index"&&e.type==="number"?{...e,rangeFor:t=>({min:-1,max:os(t)-1})}:e)],cook(e){let t=e.shapes("in"),n=os({...e.params,count:e.int("count")}),r={};for(let d of rs)r[d]=ny;if(t.length===
|
|
2460
2462
|
0)return r;let i=(d,y)=>{d>=0&&(r[rs[d]]=V(y))},{from:s,to:l,t:u}=po(e,n),h=e.enumOf("transition",["cut","fade","scale","draw","wipe"]),f=e.enumOf("axis",["both","x","y"]);if(s===l||u<=0)return i(s,t),
|
|
2461
2463
|
r;if(u>=1)return i(l,t),r;if(h==="cut")return i(u<.5?s:l,t),r;if(h==="wipe"){let d=gs(e.num("angle")),y=bs(t,d);return i(s,uo(e,t,u,d,y,"ahead","route","a")),i(l,uo(e,t,u,d,y,"behind","route","b")),r}
|
|
2462
|
-
let A=(d,y)=>wu(d,0,"route").map(g=>({...g,id:`${g.id}:${y}`}));return i(s,A(us(e,t,1-u,h,f,0),"a")),i(l,A(us(e,t,u,h,f,0),"b")),r}},
|
|
2464
|
+
let A=(d,y)=>wu(d,0,"route").map(g=>({...g,id:`${g.id}:${y}`}));return i(s,A(us(e,t,1-u,h,f,0),"a")),i(l,A(us(e,t,u,h,f,0),"b")),r}},oy={type:"switch-value",label:"Switch Value",category:"driver",description:"\
|
|
2463
2465
|
Output one of several number wires; Index picks, Blend lerps between two.",quickKey:"index",inputs:[{name:"in",type:"number",multi:!0,indexed:!0}],outputs:[{name:"out",type:"number"}],params:Ao([]),cook(e){
|
|
2464
2466
|
let t=e.inputList("in").flatMap(f=>f.t==="number"?[f.v]:[]),n=t.length;if(n===0)return{out:Te(0)};let{from:r,to:i,t:s}=po(e,n),l=r<0?0:t[r],u=t[i],h=l+(u-l)*s;return{out:Te(Number.isFinite(h)?h:0)}}},
|
|
2465
|
-
|
|
2467
|
+
iy={type:"switch-color",label:"Switch Color",category:"driver",description:"Output one of several colour wires; Index picks, Blend mixes between two.",quickKey:"index",inputs:[{name:"in",type:"color",
|
|
2466
2468
|
multi:!0,indexed:!0,accepts:["paint"]}],outputs:[{name:"out",type:"color"}],params:Ao([]),cook(e){let t=e.inputList("in").flatMap(f=>f.t==="color"||f.t==="paint"?[f.v]:[]),n=t.length;if(n===0)return{out:sn(
|
|
2467
|
-
"#ffffff")};let{from:r,to:i,t:s}=po(e,n),l=r<0?"none":t[r],u=t[i],h=f=>Sn(f)?or(f):sn(f);return s<=0?{out:h(l)}:s>=1?{out:h(u)}:Sn(l)||Sn(u)?{out:h(s<.5?l:u)}:{out:sn(yu(l,u,s))}}},Rl={},
|
|
2469
|
+
"#ffffff")};let{from:r,to:i,t:s}=po(e,n),l=r<0?"none":t[r],u=t[i],h=f=>Sn(f)?or(f):sn(f);return s<=0?{out:h(l)}:s>=1?{out:h(u)}:Sn(l)||Sn(u)?{out:h(s<.5?l:u)}:{out:sn(yu(l,u,s))}}},Rl={},sy={type:"swi\
|
|
2468
2470
|
tch-texture",label:"Switch Texture",category:"post",description:"Show one of several rasters; Index picks, fractions dissolve between two.",quickKey:"index",inputs:[{name:"in",type:"texture",multi:!0,
|
|
2469
2471
|
indexed:!0}],outputs:[{name:"out",type:"texture"}],params:Ao([]),cook(e){let t=e.inputList("in").flatMap(h=>h.t==="texture"?[h.v]:[]),n=t.length;if(n===0)return Rl;let{from:r,to:i,t:s}=po(e,n);if(r===
|
|
2470
|
-
i||s<=0)return r<0?Rl:{out:Ge(t[r])};if(s>=1)return{out:Ge(t[i])};let l=t[i],u=r<0?{...l,data:new Uint8ClampedArray(l.width*l.height*4)}:t[r];return{out:Ge(el(u,l,s,e.canvas.origin??"top-left"))}}},
|
|
2471
|
-
|
|
2472
|
-
Value",type:"number",default:1,step:.1}],cook(e){return{out:Te(e.num("value"))}}},
|
|
2472
|
+
i||s<=0)return r<0?Rl:{out:Ge(t[r])};if(s>=1)return{out:Ge(t[i])};let l=t[i],u=r<0?{...l,data:new Uint8ClampedArray(l.width*l.height*4)}:t[r];return{out:Ge(el(u,l,s,e.canvas.origin??"top-left"))}}},ay=[
|
|
2473
|
+
ty,ry,oy,iy,sy],ly={type:"value",label:"Value",category:"driver",description:"A single number, wired anywhere it is needed.",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"value",label:"\
|
|
2474
|
+
Value",type:"number",default:1,step:.1}],cook(e){return{out:Te(e.num("value"))}}},uy={type:"color-value",label:"Color",category:"driver",description:"A single colour, wired anywhere it is needed. Seve\
|
|
2473
2475
|
ral into a Switch Color make a palette to page through.",inputs:[],outputs:[{name:"out",type:"color"}],params:[{key:"color",label:"Color",type:"color",default:"#ffffff"}],cook(e){return{out:sn(e.color(
|
|
2474
|
-
"color"))}}},Ql=["add","subtract","multiply","divide","power","min","max","modulo","round","floor","ceil"],
|
|
2475
|
-
category:"driver",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"op",label:"Operation",type:"enum",default:"add",options:Ql.map(e=>({value:e,label:
|
|
2476
|
+
"color"))}}},Ql=["add","subtract","multiply","divide","power","min","max","modulo","round","floor","ceil"],cy={round:"Round (to B)",floor:"Floor (to B)",ceil:"Ceil (to B)"},hy={type:"math",label:"Math",
|
|
2477
|
+
category:"driver",inputs:[],outputs:[{name:"out",type:"number"}],params:[{key:"op",label:"Operation",type:"enum",default:"add",options:Ql.map(e=>({value:e,label:cy[e]??e[0].toUpperCase()+e.slice(1)})),
|
|
2476
2478
|
description:"Round, Floor and Ceil snap A to a multiple of B \u2014 B 1 gives integers, 0.5 halves, 10 tens; B 0 counts as 1."},{key:"a",label:"A",type:"number",default:0,step:.1},{key:"b",label:"B",type:"\
|
|
2477
2479
|
number",default:0,step:.1}],cook(e){let t=e.num("a"),n=e.num("b"),r=e.enumOf("op",Ql),i;switch(r){case"add":i=t+n;break;case"subtract":i=t-n;break;case"multiply":i=t*n;break;case"divide":i=n===0?0:t/n;
|
|
2478
2480
|
break;case"power":i=t**n;break;case"min":i=Math.min(t,n);break;case"max":i=Math.max(t,n);break;case"modulo":i=n===0?0:(t%n+n)%n;break;case"round":{let s=n===0?1:Math.abs(n);i=Math.round(t/s)*s;break}case"\
|
|
2479
|
-
floor":{let s=n===0?1:Math.abs(n);i=Math.floor(t/s)*s;break}case"ceil":{let s=n===0?1:Math.abs(n);i=Math.ceil(t/s)*s;break}}return{out:Te(Number.isFinite(i)?i:0)}}},
|
|
2480
|
-
stop${e}At`,color:`stop${e}Color`});function Eu(e){let t=Z(e?.stops).base,n=typeof t=="number"?Math.round(t):
|
|
2481
|
-
let t=[];for(let n=1;n<=e;n++){let r=ku(n),i=
|
|
2482
|
-
yframe it to slide the colour.`},{key:r.color,label:"Colour",type:"color",default:i.color,description:`Stop ${n}\u2019s colour; alpha in the hex (#rrggbbaa) fades it.`})}return t}var
|
|
2483
|
-
kind).base??"linear"),
|
|
2481
|
+
floor":{let s=n===0?1:Math.abs(n);i=Math.floor(t/s)*s;break}case"ceil":{let s=n===0?1:Math.abs(n);i=Math.ceil(t/s)*s;break}}return{out:Te(Number.isFinite(i)?i:0)}}},fy=[ly,uy,hy],pr=2,li=16,ku=e=>({at:`\
|
|
2482
|
+
stop${e}At`,color:`stop${e}Color`});function Eu(e){let t=Z(e?.stops).base,n=typeof t=="number"?Math.round(t):pr;return Math.min(li,Math.max(pr,n))}function py(e,t){return{at:t>1?(e-1)/(t-1):0,color:e===t?"#ffffff00":"#ffffff"}}function Su(e){
|
|
2483
|
+
let t=[];for(let n=1;n<=e;n++){let r=ku(n),i=py(n,e);t.push({key:r.at,label:`Stop ${n}`,type:"number",default:i.at,min:0,max:1,step:.01,description:`Where stop ${n} sits on the run, 0 to 1. Wire or ke\
|
|
2484
|
+
yframe it to slide the colour.`},{key:r.color,label:"Colour",type:"color",default:i.color,description:`Stop ${n}\u2019s colour; alpha in the hex (#rrggbbaa) fades it.`})}return t}var dy=e=>String(Z(e.
|
|
2485
|
+
kind).base??"linear"),hr=(...e)=>t=>!e.includes(dy(t)),Ay=e=>hr("radial")(e)||Z(e.useFocal).base!==!0,Bu=[{key:"spread",label:"Spread",type:"enum",default:"pad",options:[{value:"pad",label:"Pad"},{value:"\
|
|
2484
2486
|
reflect",label:"Reflect"},{value:"repeat",label:"Repeat"}],description:"Past the ends: hold the end colours, mirror the ramp back, or start it again \u2014 stripes from a two-stop ramp with a short Start\u2013E\
|
|
2485
2487
|
nd span."},{key:"blend",label:"Blend",type:"enum",default:"smooth",options:[{value:"smooth",label:"Smooth"},{value:"stepped",label:"Stepped"}],description:"Smooth blends each colour into the next. Ste\
|
|
2486
2488
|
pped holds each colour until the next stop: hard edges, bands \u2014 with Repeat, stripes."},{key:"space",label:"Space",type:"enum",default:"shape",options:[{value:"shape",label:"Shape"},{value:"canva\
|
|
2487
2489
|
s",label:"Canvas"}],description:"Shape: every shape gets the whole ramp over its own box. Canvas: one ramp over the document, and each shape shows the part it covers \u2014 a grid lit from one corner."}];
|
|
2488
|
-
function
|
|
2490
|
+
function my(e){let t=Math.min(li,Math.max(pr,e.int("stops"))),n=[];for(let r=1;r<=t;r++){let i=ku(r);n.push({at:e.num(i.at),color:e.color(i.color)})}return Bn(n)}function Pu(e){let t=e.enumOf("space",
|
|
2489
2491
|
["shape","canvas"]),n=e.enumOf("spread",["pad","reflect","repeat"]),r=e.enumOf("blend",["smooth","stepped"])==="stepped",{w:i,h:s,origin:l}=e.canvas,u=t==="canvas"?{x:l==="center"?-i/2:0,y:l==="center"?
|
|
2490
|
-
-s/2:0,w:i,h:s}:void 0;return{stops:
|
|
2492
|
+
-s/2:0,w:i,h:s}:void 0;return{stops:my(e),spread:n,space:t,...r?{stepped:r}:{},...u?{box:u}:{}}}var yy=[{key:"kind",label:"Kind",type:"enum",default:"linear",options:[{value:"linear",label:"Linear"},{value:"radial",label:"Radial"},{value:"conic",label:"Conic"}],description:"Linear runs along an \
|
|
2491
2493
|
angle, Radial out from a centre, Conic once round a centre from an angle. A conic is painted as pixels over the box \u2014 SVG has no conic of its own \u2014 and exports as a pattern."},{key:"stops",label:"\
|
|
2492
|
-
Stops",type:"stops",default:
|
|
2493
|
-
sockets of their own."}],
|
|
2494
|
-
irst stop sits. Wire an LFO in and the light sweeps.",dimWhen:
|
|
2495
|
-
s \u2014 0 is the box\u2019s edge along the angle. Repeat and Reflect cycle on the Start\u2013End span.",dimWhen:
|
|
2496
|
-
Where on the box the ramp ends; 1 is the far edge.",dimWhen:
|
|
2497
|
-
n of the box: 0.5, 0.5 is the middle.",dimWhen:
|
|
2498
|
-
half the box\u2019s longer side: 0.5 reaches the nearer edge of a square, 0.71 its corners.",dimWhen:
|
|
2499
|
-
ewhere other than the centre: a highlight off to one side.",dimWhen:
|
|
2500
|
-
fraction of the box.",dimWhen:
|
|
2494
|
+
Stops",type:"stops",default:pr,min:pr,max:li,description:"The ramp: click the bar to add a stop where it is, drag a handle to move one. Each stop is two rows below \u2014 its position and its colour \u2014 with\
|
|
2495
|
+
sockets of their own."}],gy=[{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"\xB0",description:"Which way the ramp runs: 0 is left to right, 90 top to bottom; for a conic, where the f\
|
|
2496
|
+
irst stop sits. Wire an LFO in and the light sweeps.",dimWhen:hr("linear","conic")},{key:"start",label:"Start",type:"number",default:0,min:0,max:1,step:.01,description:"Where on the box the ramp begin\
|
|
2497
|
+
s \u2014 0 is the box\u2019s edge along the angle. Repeat and Reflect cycle on the Start\u2013End span.",dimWhen:hr("linear")},{key:"end",label:"End",type:"number",default:1,min:0,max:1,step:.01,description:"\
|
|
2498
|
+
Where on the box the ramp ends; 1 is the far edge.",dimWhen:hr("linear")},{key:"center",label:"Centre",type:"vec2",default:{x:.5,y:.5},step:.01,description:"The radial\u2019s or conic\u2019s centre as a fractio\
|
|
2499
|
+
n of the box: 0.5, 0.5 is the middle.",dimWhen:hr("radial","conic")},{key:"radius",label:"Radius",type:"number",default:.5,min:0,max:4,step:.01,description:"Where the last stop lands, as a fraction of\
|
|
2500
|
+
half the box\u2019s longer side: 0.5 reaches the nearer edge of a square, 0.71 its corners.",dimWhen:hr("radial")},{key:"useFocal",label:"Focal",type:"bool",default:!1,description:"Start the ramp som\
|
|
2501
|
+
ewhere other than the centre: a highlight off to one side.",dimWhen:hr("radial")},{key:"focal",label:"Focal Point",type:"vec2",default:{x:.5,y:.5},step:.01,description:"Where the first stop sits, as a\
|
|
2502
|
+
fraction of the box.",dimWhen:Ay},...Bu];function Nl(e){return[...yy,...Su(Eu(e?.params)),...gy]}var by={type:"gradient",label:"Gradient",category:"driver",description:"A fill or stroke that runs fro\
|
|
2501
2503
|
m one colour to the next \u2014 along an angle, or out from a centre \u2014 wired into any Fill or Stroke. Shape lays the ramp over each shape\u2019s own box; Canvas lays one ramp over the frame and every shape show\
|
|
2502
2504
|
s the part it covers. Alpha rides in the stops.",keywords:["gradient","ramp","fade","linear","radial","paint","blend","fill","stroke","colour"],inputs:[],outputs:[{name:"out",type:"paint"}],params:Nl(
|
|
2503
2505
|
void 0),specialize(e){return{params:Nl(e)}},cook(e){let t=Pu(e),n=e.enumOf("kind",["linear","radial","conic"]),r;if(n==="linear")r={...t,kind:"linear",angle:e.num("angle"),start:e.num("start"),end:e.num(
|
|
2504
2506
|
"end")};else if(n==="conic"){let i=e.vec2("center");r={...t,kind:"conic",cx:i.x,cy:i.y,angle:e.num("angle")}}else{let i=e.vec2("center"),s=e.bool("useFocal")?e.vec2("focal"):void 0;r={...t,kind:"radia\
|
|
2505
|
-
l",cx:i.x,cy:i.y,r:e.num("radius"),...s?{fx:s.x,fy:s.y}:{}}}return{out:or(r)}}},
|
|
2507
|
+
l",cx:i.x,cy:i.y,r:e.num("radius"),...s?{fx:s.x,fy:s.y}:{}}}return{out:or(r)}}},vy=e=>(Z(e.mode).base??"fbm")!=="fbm",Iy=[{key:"mode",label:"Mode",type:"enum",default:"fbm",options:[{value:"value",label:"\
|
|
2506
2508
|
Value"},{value:"fbm",label:"Turbulence"},{value:"cells",label:"Cells"},{value:"blocks",label:"Blocks"}],description:"Value: one smooth layer of noise \u2014 simplex, so its swells are round blobs with no g\
|
|
2507
2509
|
rid to line up on. Turbulence: octaves of it summed, finer and fainter each, every layer turned \u2014 clouds. Cells: the distance to scattered points \u2014 scales, foam, Voronoi. Blocks: one flat value per ce\
|
|
2508
|
-
ll, a mosaic; with Speed it cuts to a new field each step, like static."},{key:"stops",label:"Stops",type:"stops",default:
|
|
2509
|
-
the first stop where the noise is 0, the last where it is 1. Click the bar to add a stop, drag a handle to move one."}],
|
|
2510
|
+
ll, a mosaic; with Speed it cuts to a new field each step, like static."},{key:"stops",label:"Stops",type:"stops",default:pr,min:pr,max:li,description:"The ramp the field reads through, dark to light:\
|
|
2511
|
+
the first stop where the noise is 0, the last where it is 1. Click the bar to add a stop, drag a handle to move one."}],xy=[{key:"scale",label:"Scale",type:"number",default:64,min:1,max:4096,step:1,unit:"\
|
|
2510
2512
|
px",description:"Pixels per cell of the field: small is fine grain, large is slow swells."},{key:"octaves",label:"Octaves",type:"int",default:4,min:1,max:8,description:"Turbulence: how many layers are\
|
|
2511
|
-
summed, each twice as fine and half as loud.",dimWhen:
|
|
2513
|
+
summed, each twice as fine and half as loud.",dimWhen:vy},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Another field entirely. Whole steps only."},{key:"speed",label:"Speed",type:"\
|
|
2512
2514
|
number",default:0,min:0,max:10,step:.05,unit:"/s",description:"How fast the field flows: Value and Turbulence turn the slopes under the swells, Cells glide their points, every one at its own pace, so \
|
|
2513
2515
|
the motion never pauses as a whole; Blocks cut to a new mosaic this many times a second. 0 holds it still."},{key:"rate",label:"Rate",type:"number",default:12,min:0,max:120,step:1,unit:"/s",description:"\
|
|
2514
2516
|
A moving field is repainted this many times a second; between repaints the frame reuses the last picture. 0 repaints every frame."},{key:"detail",label:"Detail",type:"enum",default:"half",options:[{value:"\
|
|
2515
2517
|
full",label:"Full"},{value:"half",label:"Half"},{value:"quarter",label:"Quarter"}],description:"How finely the field is painted: a texel per pixel, per two, or per four, the pattern stretching the res\
|
|
2516
|
-
t. Smooth noise loses nothing at Half and costs a quarter. Blocks paint one texel per cell whatever this says.",dimWhen:e=>Z(e.mode).base==="blocks"},...Bu];function Dl(e){return[...
|
|
2517
|
-
...
|
|
2518
|
+
t. Smooth noise loses nothing at Half and costs a quarter. Blocks paint one texel per cell whatever this says.",dimWhen:e=>Z(e.mode).base==="blocks"},...Bu];function Dl(e){return[...Iy,...Su(Eu(e?.params)),
|
|
2519
|
+
...xy]}var wy={type:"noise-paint",label:"Noise Paint",category:"driver",description:"A noise field as a fill or stroke \u2014 clouds, grain, cells \u2014 read through a ramp of stops, wired into any Fill or Str\
|
|
2518
2520
|
oke. Painted as pixels over each shape\u2019s box (or the frame), since SVG has no noise of its own; exports as a pattern.",keywords:["noise","perlin","turbulence","fbm","cells","voronoi","worley","te\
|
|
2519
2521
|
xture","paint","fill","clouds","grain"],inputs:[],outputs:[{name:"out",type:"paint"}],params:Dl(void 0),specialize(e){return{params:Dl(e)}},timeRoot:e=>{let t=Z(e.speed).base;return typeof t=="number"?
|
|
2520
2522
|
t>0:!1},cook(e){let t=Math.max(0,e.num("speed")),n=Math.max(0,e.num("rate")),r=n>0?Math.floor(e.t*n)/n:e.t,i={full:1,half:.5,quarter:.25}[e.enumOf("detail",["full","half","quarter"])],s={...Pu(e),kind:"\
|
|
2521
|
-
noise",mode:e.enumOf("mode",["value","fbm","cells","blocks"]),scale:e.num("scale"),octaves:e.int("octaves"),seed:Math.floor(e.num("seed")),time:t>0?r*t:0,...i<1?{detail:i}:{}};return{out:or(s)}}},
|
|
2522
|
-
"ink","dim","faint","accent","warn","bg"],Ol=["stroke","bold"],Nr={ink:"#dbe7f0",dim:"#5d7285",faint:"#33424f",accent:"#7fe8d0",warn:"#ff5b2e",bg:"#04070a"},
|
|
2523
|
+
noise",mode:e.enumOf("mode",["value","fbm","cells","blocks"]),scale:e.num("scale"),octaves:e.int("octaves"),seed:Math.floor(e.num("seed")),time:t>0?r*t:0,...i<1?{detail:i}:{}};return{out:or(s)}}},qo=[
|
|
2524
|
+
"ink","dim","faint","accent","warn","bg"],Ol=["stroke","bold"],Nr={ink:"#dbe7f0",dim:"#5d7285",faint:"#33424f",accent:"#7fe8d0",warn:"#ff5b2e",bg:"#04070a"},Cy={arcoiris:{label:"Arcoiris",colors:{bg:"\
|
|
2523
2525
|
#201f1e",ink:"#eee4d9",dim:"#7d7872",faint:"#494643",accent:"#63fad5",warn:"#da2700"}},aurora:{label:"Aurora",colors:{bg:"#23262e",ink:"#ffca28",dim:"#86702b",faint:"#4f472d",accent:"#03d6b8",warn:"#f\
|
|
2524
2526
|
0266f"}},"belafonte-night":{label:"Belafonte Night",colors:{bg:"#20111b",ink:"#968c83",dim:"#55484a",faint:"#382a30",accent:"#eaa549",warn:"#be100e"}},ciapre:{label:"Ciapre",colors:{bg:"#191c27",ink:"\
|
|
2525
2527
|
#aea47a",dim:"#5c594c",faint:"#373738",accent:"#3097c6",warn:"#ac3835"}},duckbones:{label:"Duckbones",colors:{bg:"#0e101a",ink:"#ebefc0",dim:"#717465",faint:"#3a3d3b",accent:"#00b4e0",warn:"#ff4821"}},
|
|
@@ -2532,11 +2534,11 @@ colors:{bg:"#2e2e2e",ink:"#ffffff",dim:"#8c8c8c",faint:"#585858",accent:"#fca121
|
|
|
2532
2534
|
bg:"#181921",ink:"#ebdbb2",dim:"#777062",faint:"#42403e",accent:"#fabd2f",warn:"#f42c3e"}},"sea-shells":{label:"Sea Shells",colors:{bg:"#09141b",ink:"#deb88d",dim:"#695e4e",faint:"#343532",accent:"#1b\
|
|
2533
2535
|
bcdd",warn:"#d15123"}},sequoia:{label:"Sequoia Retro",colors:{bg:"#0f1014",ink:"#868690",dim:"#45454c",faint:"#27282d",accent:"#e8b246",warn:"#da674b"}},spacedust:{label:"Spacedust",colors:{bg:"#0a1e2\
|
|
2534
2536
|
4",ink:"#ecf0c1",dim:"#707c6b",faint:"#374843",accent:"#06afc7",warn:"#e35b00"}},sundried:{label:"Sundried",colors:{bg:"#1a1818",ink:"#c9c9c9",dim:"#696868",faint:"#3d3b3b",accent:"#7999f7",warn:"#aa0\
|
|
2535
|
-
00c"}}},
|
|
2536
|
-
ealBg"},
|
|
2537
|
+
00c"}}},ky=["off","random","cycle","ramp"],Ey=["fill","stroke","both"],Uo=e=>(Z(e.mode).base??"off")==="off",Ll={ink:"dealInk",dim:"dealDim",faint:"dealFaint",accent:"dealAccent",warn:"dealWarn",bg:"d\
|
|
2538
|
+
ealBg"},Sy={ink:"Deal Ink",dim:"Deal Dim",faint:"Deal Faint",accent:"Deal Accent",warn:"Deal Warn",bg:"Deal Background"},By={type:"style-tokens",label:"Style Tokens",category:"driver",description:"The\
|
|
2537
2539
|
artstyle: a named palette and stroke scale, wired anywhere \u2014 and the brush that paints a stream with it. Wire shapes into In and set Paint.",inputs:[{name:"in",type:"shapes"},{name:"reseed",type:"\
|
|
2538
|
-
number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes",label:"painted"},...
|
|
2539
|
-
type:"enum",default:"custom",options:[{value:"custom",label:"Custom"},...Object.entries(
|
|
2540
|
+
number",label:"Reseed",clock:!0}],outputs:[{name:"out",type:"shapes",label:"painted"},...qo.map(e=>({name:e,type:"color"})),...Ol.map(e=>({name:e,type:"number"}))],params:[{key:"preset",label:"Preset",
|
|
2541
|
+
type:"enum",default:"custom",options:[{value:"custom",label:"Custom"},...Object.entries(Cy).map(([e,t])=>({value:e,label:t.label}))],description:"Fill the palette from a named scheme. Picking one stam\
|
|
2540
2542
|
ps the six colours below; editing a colour afterwards sets this back to Custom."},{key:"ink",label:"Ink",type:"color",default:Nr.ink,group:"Palette"},{key:"dim",label:"Dim",type:"color",default:Nr.dim,
|
|
2541
2543
|
group:"Palette"},{key:"faint",label:"Faint",type:"color",default:Nr.faint,group:"Palette"},{key:"accent",label:"Accent",type:"color",default:Nr.accent,group:"Palette"},{key:"warn",label:"Warn",type:"c\
|
|
2542
2544
|
olor",default:Nr.warn,group:"Palette"},{key:"bg",label:"Background",type:"color",default:Nr.bg,group:"Palette"},{key:"stroke",label:"Stroke",type:"number",default:1,min:0,step:.05,unit:"px",group:"Sca\
|
|
@@ -2544,31 +2546,31 @@ le"},{key:"bold",label:"Bold",type:"number",default:2,min:0,step:.05,unit:"px",g
|
|
|
2544
2546
|
wn chrome in this palette. Off (the default) keeps your Settings theme while the artwork still uses the tokens. With several Tokens nodes, the first one wearing wins."},{key:"mode",label:"Paint",type:"\
|
|
2545
2547
|
enum",default:"off",group:"Paint",options:[{value:"off",label:"Off"},{value:"random",label:"Random"},{value:"cycle",label:"Cycle"},{value:"ramp",label:"Ramp"}],description:"Colour the stream wired int\
|
|
2546
2548
|
o In from the ticked roles. Random deals one per shape, seeded; Cycle walks them by index; Ramp blends from the first ticked to the last across the stream. Off passes the stream through."},{key:"targe\
|
|
2547
|
-
t",label:"Onto",type:"enum",default:"fill",group:"Paint",options:[{value:"fill",label:"Fill"},{value:"stroke",label:"Stroke"},{value:"both",label:"Fill + Stroke"}],dimWhen:
|
|
2548
|
-
label:
|
|
2549
|
-
group:"Paint",description:"Share of shapes left as they were, seeded \u2014 most cells hollow, a few lit. 0 paints everything.",dimWhen:
|
|
2550
|
-
aint",description:"Reroll the deal and the skips \u2014 the \u2212/+ steppers walk through them. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead.",dimWhen:e=>
|
|
2551
|
-
base==="cycle"}],cook(e){let t={...Object.fromEntries(
|
|
2552
|
-
0)return{...t,out:V(n)};let i=n.length,s=e.enumOf("target",
|
|
2549
|
+
t",label:"Onto",type:"enum",default:"fill",group:"Paint",options:[{value:"fill",label:"Fill"},{value:"stroke",label:"Stroke"},{value:"both",label:"Fill + Stroke"}],dimWhen:Uo},...qo.map(e=>({key:Ll[e],
|
|
2550
|
+
label:Sy[e],type:"bool",default:e==="accent"||e==="dim"||e==="faint",group:"Paint",description:`Deal ${e} when painting.`,dimWhen:Uo})),{key:"skip",label:"Skip",type:"number",default:0,min:0,max:1,step:.01,
|
|
2551
|
+
group:"Paint",description:"Share of shapes left as they were, seeded \u2014 most cells hollow, a few lit. 0 paints everything.",dimWhen:Uo},{key:"salt",label:"Seed",type:"int",default:1,min:0,group:"P\
|
|
2552
|
+
aint",description:"Reroll the deal and the skips \u2014 the \u2212/+ steppers walk through them. Wire a number in to drive it; a Trigger into Reseed rerolls on cue instead.",dimWhen:e=>Uo(e)||Z(e.mode).
|
|
2553
|
+
base==="cycle"}],cook(e){let t={...Object.fromEntries(qo.map(y=>[y,sn(e.color(y))])),...Object.fromEntries(Ol.map(y=>[y,Te(e.num(y))]))},n=e.shapes("in"),r=e.enumOf("mode",ky);if(r==="off"||n.length===
|
|
2554
|
+
0)return{...t,out:V(n)};let i=n.length,s=e.enumOf("target",Ey),l=Math.max(0,Math.min(1,e.num("skip"))),u=qo.filter(y=>e.bool(Ll[y]));if(u.length===0)return{...t,out:V(n)};let h=e.inputs.reseed,f=0;if(h?.
|
|
2553
2555
|
t==="number"){let{playing:y,local:g}=en(h.v);f=y?Math.round((e.t-g)*1e3):-Math.round(g*1e3)-1}let A=`${e.int("salt")}|${f}`,d=n.map((y,g)=>{let x=u.map(C=>e.color(C,g,i));if(l>0&&e.rand("palette-skip",
|
|
2554
2556
|
A,g).next()<l)return y;let v;if(r==="random")v=x[e.rand("palette",A,g).int(0,x.length)];else if(r==="cycle")v=x[g%x.length];else{let C=i>1&&x.length>1?g/(i-1)*(x.length-1):0,M=Math.min(x.length-2,Math.
|
|
2555
|
-
floor(C));v=x.length>1?yu(x[M],x[M+1],C-M):x[0]}let b={...y.style};return s!=="stroke"&&(b.fill=v),s!=="fill"&&(b.stroke=v),{...y,style:b,meta:{...y.meta,index:g}}});return{...t,out:V(d)}}},Ct={};function
|
|
2556
|
-
return Z(e.size).base==="content"}function
|
|
2557
|
+
floor(C));v=x.length>1?yu(x[M],x[M+1],C-M):x[0]}let b={...y.style};return s!=="stroke"&&(b.fill=v),s!=="fill"&&(b.stroke=v),{...y,style:b,meta:{...y.meta,index:g}}});return{...t,out:V(d)}}},Ct={};function Ko(e){
|
|
2558
|
+
return Z(e.size).base==="content"}function Py(e){return!Ko(e)}function _y(e){return Ko(e)||!(Number(Z(e.width).base)>0||Number(Z(e.height).base)>0)}function My(e,t,n,r){if(e==="none"||t.w<=0||t.h<=0||
|
|
2557
2559
|
n===t.w&&r===t.h)return;let i=e==="stretch"?n/t.w:e==="contain"?Math.min(n/t.w,r/t.h):Math.max(n/t.w,r/t.h),s=e==="stretch"?r/t.h:i;return t.origin==="center"?dn(i,s):me(Re(n/2-i*t.w/2,r/2-s*t.h/2),dn(
|
|
2558
|
-
i,s))}var
|
|
2560
|
+
i,s))}var Ty={type:"rasterize",label:"Rasterize",category:"post",description:"The vector/raster boundary: draws the incoming shapes to pixels. Everything downstream is post.",inputs:[{name:"in",type:"\
|
|
2559
2561
|
shapes"}],outputs:[{name:"out",type:"texture"}],params:[{key:"size",label:"Size",type:"enum",default:"canvas",options:[{value:"canvas",label:"Canvas"},{value:"content",label:"Content bounds"}],description:"\
|
|
2560
2562
|
Content bounds draws only the pixels the shapes cover (plus Padding) and remembers where they sat \u2014 smaller, faster post."},{key:"width",label:"Width",type:"int",default:0,min:0,unit:"px",description:"\
|
|
2561
|
-
0 = canvas width",dimWhen:
|
|
2562
|
-
px",description:"Room around the content for blur and bloom to breathe.",dimWhen:
|
|
2563
|
+
0 = canvas width",dimWhen:Ko},{key:"height",label:"Height",type:"int",default:0,min:0,unit:"px",description:"0 = canvas height",dimWhen:Ko},{key:"padding",label:"Padding",type:"int",default:16,min:0,unit:"\
|
|
2564
|
+
px",description:"Room around the content for blur and bloom to breathe.",dimWhen:Py},{key:"fit",label:"Fit",type:"enum",default:"none",options:[{value:"none",label:"None"},{value:"stretch",label:"Stre\
|
|
2563
2565
|
tch"},{value:"contain",label:"Contain"},{value:"cover",label:"Cover"}],description:"With a Width or Height of its own: None keeps the document\u2019s coordinates and the box crops; Stretch scales the canva\
|
|
2564
|
-
s onto the box; Contain keeps the aspect inside it, Cover keeps the aspect over it.",dimWhen:
|
|
2566
|
+
s onto the box; Contain keeps the aspect inside it, Cover keeps the aspect over it.",dimWhen:_y},{key:"bg",label:"Background",type:"color",default:"none"}],cook(e){if(!e.rasterize)throw new Error("no \
|
|
2565
2567
|
rasteriser available yet \u2014 the preview loads one on demand; exports always have one");let t=e.shapes("in");if(e.enumOf("size",["canvas","content"])==="content"){let u=at(t);if(!u)return Ct;let h=Math.
|
|
2566
2568
|
max(0,e.int("padding")),f=Math.floor(u.x-h),A=Math.floor(u.y-h),d=Math.max(1,Math.ceil(u.x+u.w+h)-f),y=Math.max(1,Math.ceil(u.y+u.h+h)-A),g=t.map(b=>({...b,transform:me(Re(-f,-A),b.transform)})),x={x:f,
|
|
2567
2569
|
y:A},v=e.rasterize({width:d,height:y,background:e.color("bg"),origin:"top-left",layers:[{id:e.nodeId,name:"rasterize",opacity:1,visible:!0,order:0,shapes:g}]},x);return{out:Ge(v.at?v:{...v,at:x})}}let n=e.
|
|
2568
|
-
int("width")||e.canvas.w,r=e.int("height")||e.canvas.h;if(n<=0||r<=0)throw new Error("has no size to draw at \u2014 set width/height, or give the project a canvas");let i=
|
|
2570
|
+
int("width")||e.canvas.w,r=e.int("height")||e.canvas.h;if(n<=0||r<=0)throw new Error("has no size to draw at \u2014 set width/height, or give the project a canvas");let i=My(e.enumOf("fit",["none","st\
|
|
2569
2571
|
retch","contain","cover"]),e.canvas,n,r),s=i?t.map(u=>({...u,transform:me(i,u.transform)})):t,l=e.rasterize({width:n,height:r,background:e.color("bg"),origin:e.canvas.origin,layers:[{id:e.nodeId,name:"\
|
|
2570
|
-
rasterize",opacity:1,visible:!0,order:0,shapes:s}]});return{out:Ge(l)}}},
|
|
2571
|
-
{key:"radius",label:"Radius",type:"number",default:4,min:0,max:64,step:.5,unit:"px"}],cook(e){let t=e.texture();return t?{out:Ge(
|
|
2572
|
+
rasterize",opacity:1,visible:!0,order:0,shapes:s}]});return{out:Ge(l)}}},Ry={type:"blur",label:"Blur",category:"post",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[
|
|
2573
|
+
{key:"radius",label:"Radius",type:"number",default:4,min:0,max:64,step:.5,unit:"px"}],cook(e){let t=e.texture();return t?{out:Ge(qi(t,e.num("radius")))}:Ct}},Qy={type:"glitch",label:"Glitch",category:"\
|
|
2572
2574
|
post",description:"Horizontal band displacement driven by hash(seed, t) \u2014 reproducible tearing.",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],timeRoot:!0,params:[{key:"\
|
|
2573
2575
|
amount",label:"H Shift",type:"number",default:14,min:0,max:4e3,step:1,unit:"px",description:"How far a torn band can slide left or right; each band draws its own shift up to this, wrapping at the edge\
|
|
2574
2576
|
s."},{key:"vertical",label:"V Shift",type:"number",default:0,min:0,max:4e3,step:1,unit:"px",description:"How far a torn band can also slide up or down; it shows the rows from there, wrapped over the t\
|
|
@@ -2581,25 +2583,25 @@ ar pattern \u2014 a different set of bands for the same project seed. Whole step
|
|
|
2581
2583
|
let n=e.num("amount"),r=e.num("vertical"),i=Math.max(1,e.int("bands")),s=e.num("probability"),l=e.num("rate"),u=e.num("channelShift"),h=e.num("widthJitter"),f=e.bool("holdEdges"),A=l>0?Math.floor(e.t*
|
|
2582
2584
|
l):0,d=Math.floor(e.num("seed")),y=(v,...b)=>d===0?e.rand(v,...b):e.rand(v,d,...b),g=[0];if(h>0){let v=[],b=0;for(let M=0;M<i;M++){let S=f?y("width",M):y("width",M,A),T=1+h*S.range(-.95,.95);v.push(T),
|
|
2583
2585
|
b+=T}let C=0;for(let M=0;M<i-1;M++)C+=v[M]/b*t.height,g.push(C);g.push(t.height)}else{let v=t.height/i;for(let b=1;b<=i;b++)g.push(b*v)}let x=[];for(let v=0;v<i;v++){let b=y("band",v,A);b.next()>=s||x.
|
|
2584
|
-
push({y0:g[v],y1:g[v+1],dx:Math.round(b.range(-n,n)),channelDx:Math.round(b.range(-u,u)),dy:Math.round(b.range(-r,r))})}return{out:Ge(x.length>0?Va(t,x):jt(t))}}},
|
|
2586
|
+
push({y0:g[v],y1:g[v+1],dx:Math.round(b.range(-n,n)),channelDx:Math.round(b.range(-u,u)),dy:Math.round(b.range(-r,r))})}return{out:Ge(x.length>0?Va(t,x):jt(t))}}},Ny={type:"chromatic",label:"Chromatic",
|
|
2585
2587
|
category:"post",description:"Splits the red and blue planes apart \u2014 lens fringing.",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"offset",label:"Offset",
|
|
2586
2588
|
type:"number",default:2,min:0,max:40,step:.25,unit:"px"},{key:"angle",label:"Angle",type:"number",default:0,min:-180,max:180,step:1,unit:"\xB0"}],cook(e){let t=e.texture();if(!t)return Ct;let n=e.num(
|
|
2587
|
-
"offset"),r=e.num("angle")*Math.PI/180;return{out:Ge(Wa(t,n*Math.cos(r),n*Math.sin(r)))}}},
|
|
2589
|
+
"offset"),r=e.num("angle")*Math.PI/180;return{out:Ge(Wa(t,n*Math.cos(r),n*Math.sin(r)))}}},Dy={type:"scanlines",label:"Scanlines",category:"post",inputs:[{name:"in",type:"texture"}],outputs:[{name:"ou\
|
|
2588
2590
|
t",type:"texture"}],timeRoot:!0,params:[{key:"spacing",label:"Spacing",type:"int",default:4,min:1,max:64,unit:"px"},{key:"thickness",label:"Thickness",type:"int",default:1,min:1,max:32,unit:"px"},{key:"\
|
|
2589
2591
|
strength",label:"Strength",type:"number",default:.35,min:0,max:1,step:.01},{key:"speed",label:"Roll",type:"number",default:0,min:-240,max:240,step:1,unit:"px/s"},{key:"orientation",label:"Lines",type:"\
|
|
2590
2592
|
enum",default:"horizontal",options:[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],description:"Horizontal darkens rows, the CRT look. Vertical darkens columns; Roll then\
|
|
2591
2593
|
moves them sideways."}],cook(e){let t=e.texture();return t?{out:Ge(Ga(t,{spacing:e.int("spacing"),thickness:e.int("thickness"),strength:e.num("strength"),offset:e.num("speed")*e.t,vertical:e.enumOf("\
|
|
2592
|
-
orientation",["horizontal","vertical"])==="vertical"}))}:Ct}},
|
|
2594
|
+
orientation",["horizontal","vertical"])==="vertical"}))}:Ct}},Oy={type:"grain",label:"Film Grain",category:"post",description:"Hashed noise on every covered pixel \u2014 a fresh field per frame at the Rate\
|
|
2593
2595
|
, held still at 0. Reproducible: frame 47 grains the same way everywhere.",keywords:["noise","film","grain","texture","analog","dirt"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"te\
|
|
2594
2596
|
xture"}],timeRoot:!0,params:[{key:"amount",label:"Amount",type:"number",default:.2,min:0,max:1,step:.01,description:"Noise swing as a share of the pixel\u2019s coverage: 1 moves a channel by up to its whol\
|
|
2595
2597
|
e alpha."},{key:"size",label:"Size",type:"int",default:1,min:1,max:16,unit:"px",description:"Grain cell: 1 is per pixel, more is blockier."},{key:"rate",label:"Rate",type:"number",default:24,min:0,max:120,
|
|
2596
2598
|
step:1,unit:"/s",description:"New grain this many times a second; 0 holds one field."},{key:"colour",label:"Colour",type:"bool",default:!1,description:"A value per channel instead of one per grain: co\
|
|
2597
2599
|
loured grain."},{key:"seed",label:"Seed",type:"number",default:0,step:1,description:"Rerolls the field for the same project seed. Whole steps only. 0 = the node\u2019s own stream."}],cook(e){let t=e.texture();
|
|
2598
2600
|
if(!t)return Ct;let n=e.num("rate"),r=Math.floor(e.num("seed")),i=r===0?e.rand("grain"):e.rand("grain",r);return{out:Ge(qa(t,{amount:e.num("amount"),size:e.int("size"),seed:Math.floor(i.next()*4294967296)>>>
|
|
2599
|
-
0,frame:n>0?Math.floor(e.t*n):0,colour:e.bool("colour")}))}}},
|
|
2601
|
+
0,frame:n>0?Math.floor(e.t*n):0,colour:e.bool("colour")}))}}},Ly={type:"posterize",label:"Posterize",category:"post",description:"Snap every colour channel to a few levels \u2014 the print and the pixel-ar\
|
|
2600
2602
|
t look. Alpha is left alone.",keywords:["quantise","quantize","levels","bands","reduce","palette","print"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"level\
|
|
2601
|
-
s",label:"Levels",type:"int",default:4,min:2,max:32,description:"Steps per channel: 2 is two-tone."}],cook(e){let t=e.texture();return t?{out:Ge(za(t,{levels:e.int("levels")}))}:Ct}},
|
|
2602
|
-
er4","bayer8","floyd","atkinson"],Fl=e=>Z(e.colour).base==="rgb";function Yl(e,t){let n=
|
|
2603
|
+
s",label:"Levels",type:"int",default:4,min:2,max:32,description:"Steps per channel: 2 is two-tone."}],cook(e){let t=e.texture();return t?{out:Ge(za(t,{levels:e.int("levels")}))}:Ct}},Fy=["bayer2","bay\
|
|
2604
|
+
er4","bayer8","floyd","atkinson"],Fl=e=>Z(e.colour).base==="rgb";function Yl(e,t){let n=Vo(e);return n?[n[0],n[1],n[2],Math.round(n[3]*255)]:t}var Yy={type:"dither",label:"Dither",category:"post",description:"\
|
|
2603
2605
|
Down to a few levels, with the tones in between faked by a pattern of the ones kept: the one-bit screen, the newspaper, the handheld console. Bayer is a fixed, regular pattern that holds still in moti\
|
|
2604
2606
|
on; Floyd\u2013Steinberg and Atkinson spread each pixel\u2019s error to its neighbours for a finer, grainier picture that shimmers when the picture moves. Transparency is dithered too, so a fade to clear become\
|
|
2605
2607
|
s dots that are there or gone.",keywords:["dither","bayer","ordered","floyd","steinberg","atkinson","error diffusion","1-bit","one bit","retro","pixel","mono","game boy","print","halftone","quantise"],
|
|
@@ -2613,22 +2615,22 @@ f00, say) becomes dots that are there or gone, and soft edges step. Keep: every
|
|
|
2613
2615
|
ing untouched."},{key:"colour",label:"Colour",type:"enum",default:"mono",options:[{value:"mono",label:"Mono"},{value:"rgb",label:"RGB"}],description:"Mono: by brightness, painted from Dark to Light. R\
|
|
2614
2616
|
GB: red, green and blue dithered each on its own, for the few-colour palette look.",group:"Colour"},{key:"dark",label:"Dark",type:"color",default:"#000000",description:"Mono: what the darkest level pa\
|
|
2615
2617
|
ints. Its alpha counts, so a clear Dark leaves only the lit dots.",group:"Colour",dimWhen:Fl},{key:"light",label:"Light",type:"color",default:"#ffffff",description:"Mono: what the brightest level pain\
|
|
2616
|
-
ts.",group:"Colour",dimWhen:Fl}],cook(e){let t=e.texture();return t?{out:Ge(ja(t,{method:e.enumOf("method",
|
|
2617
|
-
dither",mono:e.enumOf("colour",["mono","rgb"])==="mono",dark:Yl(e.color("dark"),[0,0,0,255]),light:Yl(e.color("light"),[255,255,255,255])}))}:Ct}},
|
|
2618
|
+
ts.",group:"Colour",dimWhen:Fl}],cook(e){let t=e.texture();return t?{out:Ge(ja(t,{method:e.enumOf("method",Fy),levels:e.int("levels"),pixel:e.int("pixel"),alpha:e.enumOf("alpha",["dither","keep"])==="\
|
|
2619
|
+
dither",mono:e.enumOf("colour",["mono","rgb"])==="mono",dark:Yl(e.color("dark"),[0,0,0,255]),light:Yl(e.color("light"),[255,255,255,255])}))}:Ct}},Xy={type:"color-correct",label:"Colour Correct",category:"\
|
|
2618
2620
|
post",description:"Hue, saturation, contrast and brightness on the picture\u2019s colour, in that order. Coverage is left alone.",keywords:["brightness","contrast","saturation","hue","grade","levels",
|
|
2619
2621
|
"adjust","color","colour","desaturate","greyscale"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"brightness",label:"Brightness",type:"number",default:0,min:-1,
|
|
2620
2622
|
max:1,step:.01},{key:"contrast",label:"Contrast",type:"number",default:0,min:-1,max:1,step:.01,description:"About mid grey: \u22121 is flat grey, 1 doubles the spread."},{key:"saturation",label:"Satur\
|
|
2621
2623
|
ation",type:"number",default:0,min:-1,max:1,step:.01,description:"\u22121 is greyscale, 1 doubles it."},{key:"hue",label:"Hue",type:"number",default:0,min:-180,max:180,step:1,unit:"deg",description:"T\
|
|
2622
2624
|
urns every colour around the grey axis."}],cook(e){let t=e.texture();return t?{out:Ge(Ua(t,{brightness:e.num("brightness"),contrast:e.num("contrast"),saturation:e.num("saturation"),hue:e.num("hue")}))}:
|
|
2623
|
-
Ct}},
|
|
2625
|
+
Ct}},Wy={type:"threshold",label:"Threshold",category:"post",description:"Two-tone by brightness: black below the level, white above, with an optional soft ramp. Coverage is left alone.",keywords:["two\
|
|
2624
2626
|
-tone","binary","cutoff","luma","black and white","stencil"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"level",label:"Level",type:"number",default:.5,min:0,
|
|
2625
2627
|
max:1,step:.01,description:"The brightness that flips, 0..1."},{key:"soft",label:"Soft",type:"number",default:0,min:0,max:1,step:.01,description:"Width of the ramp around the level; 0 is a hard cut."}],
|
|
2626
|
-
cook(e){let t=e.texture();return t?{out:Ge(Ha(t,{level:e.num("level"),soft:e.num("soft")}))}:Ct}},
|
|
2627
|
-
"negative","flip","reverse"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[],cook(e){let t=e.texture();return t?{out:Ge($a(t))}:Ct}},
|
|
2628
|
+
cook(e){let t=e.texture();return t?{out:Ge(Ha(t,{level:e.num("level"),soft:e.num("soft")}))}:Ct}},Gy={type:"invert",label:"Invert",category:"post",description:"The negative. Coverage is left alone.",keywords:[
|
|
2629
|
+
"negative","flip","reverse"],inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[],cook(e){let t=e.texture();return t?{out:Ge($a(t))}:Ct}},qy={type:"bloom",label:"Bloom",
|
|
2628
2630
|
category:"post",description:"Bright pixels bleed: threshold, blur, add back.",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"threshold",label:"Threshold",type:"\
|
|
2629
2631
|
number",default:.55,min:0,max:1,step:.01},{key:"radius",label:"Radius",type:"number",default:8,min:0,max:64,step:.5,unit:"px"},{key:"strength",label:"Strength",type:"number",default:.8,min:0,max:4,step:.05}],
|
|
2630
2632
|
cook(e){let t=e.texture();return t?{out:Ge(Ja(t,{threshold:e.num("threshold"),radius:e.num("radius"),strength:e.num("strength")}))}:Ct}};function _u(e){return Z(e.shape).base==="radial"}function Xl(e){
|
|
2631
|
-
return!_u(e)}var
|
|
2633
|
+
return!_u(e)}var Uy={type:"fade",label:"Fade",category:"post",description:"Dissolve the texture to transparent along a gradient: a bar that trails off, a vignette, or (inverted) a hole round the centr\
|
|
2632
2634
|
e.",quickKey:"start",inputs:[{name:"in",type:"texture"}],outputs:[{name:"out",type:"texture"}],params:[{key:"shape",label:"Shape",type:"enum",default:"linear",options:[{value:"linear",label:"Linear"},
|
|
2633
2635
|
{value:"radial",label:"Radial"}],description:"Linear runs across the texture along Angle; Radial runs outwards from the Centre."},{key:"angle",label:"Angle",type:"number",default:0,min:-180,max:180,step:1,
|
|
2634
2636
|
unit:"\xB0",description:"0 fades towards the right, 90 towards the bottom, 180 towards the left.",dimWhen:_u},{key:"cx",label:"Centre X",type:"number",default:.5,min:0,max:1,step:.01,description:"As a\
|
|
@@ -2638,23 +2640,23 @@ max:1,step:.01,description:"Where nothing is left. Wire a Seq to Start and End t
|
|
|
2638
2640
|
r"},{value:"ease",label:"Ease"},{value:"expo",label:"Expo"}],description:"How the fade travels between Start and End."},{key:"invert",label:"Invert",type:"bool",default:!1,description:"Transparent bef\
|
|
2639
2641
|
ore Start, solid after End \u2014 a hole rather than a vignette."},{key:"strength",label:"Strength",type:"number",default:1,min:0,max:1,step:.01,description:"How deep the fade cuts: 1 takes the End to\
|
|
2640
2642
|
nothing, 0.5 leaves half of it, 0 leaves the texture alone. Wire an LFO to breathe a vignette."}],cook(e){let t=e.texture();return t?{out:Ge(Za(t,{shape:e.enumOf("shape",["linear","radial"]),angle:e.
|
|
2641
|
-
num("angle"),cx:e.num("cx"),cy:e.num("cy"),start:e.num("start"),end:e.num("end"),curve:e.enumOf("curve",["linear","ease","expo"]),invert:e.bool("invert"),strength:e.num("strength")}))}:Ct}},
|
|
2643
|
+
num("angle"),cx:e.num("cx"),cy:e.num("cy"),start:e.num("start"),end:e.num("end"),curve:e.enumOf("curve",["linear","ease","expo"]),invert:e.bool("invert"),strength:e.num("strength")}))}:Ct}},Hy={type:"\
|
|
2642
2644
|
blend",label:"Blend",category:"post",description:"Composites B over A. Sizes need not match: the result covers both, each sitting where it does in the scene. One side wired passes through.",inputs:[{name:"\
|
|
2643
2645
|
a",type:"texture",label:"A"},{name:"b",type:"texture",label:"B"}],outputs:[{name:"out",type:"texture"}],params:[{key:"mode",label:"Mode",type:"enum",default:"normal",options:Oo.map(e=>({value:e,label:e}))},
|
|
2644
2646
|
{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01}],cook(e){let t=e.texture("a"),n=e.texture("b");if(!t||!n)return t||n?{out:Ge(t??n)}:Ct;let r=e.enumOf("mode",Oo);return{out:Ge(
|
|
2645
|
-
Ka(t,n,r,e.num("opacity"),e.canvas.origin??"top-left"))}}}
|
|
2647
|
+
Ka(t,n,r,e.num("opacity"),e.canvas.origin??"top-left"))}}},$y={type:"matte",label:"Matte",category:"post",description:"Keeps the picture only where the matte is: a video inside a title, a texture cut \
|
|
2646
2648
|
to a shape. Alpha reads the matte\u2019s coverage, Luma its brightness over black. Invert keeps the rest instead. In alone passes through.",keywords:["mask","clip","cut","stencil","track matte","alpha",
|
|
2647
2649
|
"luma","fill","video in text","key"],inputs:[{name:"in",type:"texture",label:"In"},{name:"matte",type:"texture",label:"Matte"}],outputs:[{name:"out",type:"texture"}],params:[{key:"mode",label:"Mode",type:"\
|
|
2648
2650
|
enum",default:"alpha",options:[{value:"alpha",label:"Alpha"},{value:"luma",label:"Luma"}],description:"Alpha: where the matte is drawn at all, by its coverage. Luma: by how bright it is over black \u2014 a\
|
|
2649
2651
|
white shape keeps, black cuts, and a half-covered white reads as half."},{key:"invert",label:"Invert",type:"bool",default:!1,description:"Keep the picture where the matte is clear (or dark) and cut i\
|
|
2650
2652
|
t where it is drawn."}],cook(e){let t=e.texture("in"),n=e.texture("matte");return t?n?{out:Ge(nl(t,n,{mode:e.enumOf("mode",["alpha","luma"]),invert:e.bool("invert")},e.canvas.origin??"top-left"))}:{out:Ge(
|
|
2651
|
-
t)}:Ct}}
|
|
2652
|
-
"\u259E","\u259F","\u2598","\u259A","\u258C","\u2599","\u2580","\u259C","\u259B","\u2588"],
|
|
2653
|
-
"){return["ascii",`row:${e}`,`col:${t}`,...n===" "?[]:[`blank:${n}`]]}var Dr=(...e)=>t=>!e.includes(Z(t.mode).base??"characters"),
|
|
2654
|
-
Z(e.fontFamily).base??"")).family,
|
|
2655
|
-
Math.round(s*255/n)),i=`#${
|
|
2653
|
+
t)}:Ct}},zy=[Ty,Ry,Qy,Ny,Dy,Oy,Ly,Yy,Wy,Gy,Xy,qy,Uy,Hy,$y],Wl={},jy={standard:" .:-=+*#%@",short:" .oO@",shades:" \u2591\u2592\u2593\u2588",binary:" #"},Vy=[" ","\u2597","\u2596","\u2584","\u259D","\u2590",
|
|
2654
|
+
"\u259E","\u259F","\u2598","\u259A","\u258C","\u2599","\u2580","\u259C","\u259B","\u2588"],Jy=["characters","blocks","braille","weight","width"],Zy="\u2800",Mu=e=>e==="braille"?Zy:" ";function xs(e,t,n="\
|
|
2655
|
+
"){return["ascii",`row:${e}`,`col:${t}`,...n===" "?[]:[`blank:${n}`]]}var Dr=(...e)=>t=>!e.includes(Z(t.mode).base??"characters"),Ky=e=>Dr("characters")(e)||Z(e.ramp).base!=="custom",Gl=e=>gt(String(
|
|
2656
|
+
Z(e.fontFamily).base??"")).family,e0=.7,t0={top:.95,bottom:-.35},ql=e=>Ye.find(t=>t.key===e),Ho=e=>e.toString(16).padStart(2,"0");function Tu(e,t){let n=e[t*4+3];if(n===0)return;let r=s=>Math.min(255,
|
|
2657
|
+
Math.round(s*255/n)),i=`#${Ho(r(e[t*4]))}${Ho(r(e[t*4+1]))}${Ho(r(e[t*4+2]))}`;return n===255?i:`${i}${Ho(n)}`}function n0(e){let t=e.match(/-?\d*\.?\d+(?:e-?\d+)?/g);if(!t||t.length<2)return;let n=1/0,
|
|
2656
2658
|
r=-1/0;for(let i=1;i<t.length;i+=2){let s=Number(t[i]);s<n&&(n=s),s>r&&(r=s)}return n===1/0?void 0:{top:n,bottom:r}}function Ul(e,t,n){let r=Math.max(2,Math.floor(n));return Array.from({length:r},(i,s)=>Math.
|
|
2657
|
-
round(e+(t-e)*s/(r-1)))}var
|
|
2659
|
+
round(e+(t-e)*s/(r-1)))}var r0={type:"ascii",label:"ASCII",category:"post",description:"Pixels back into text: the picture averaged over a grid of cells, each cell a character by its brightness \u2014 or a\
|
|
2658
2660
|
weight, a width, or a quadrant block. Text shapes out, so it stays vector.",keywords:["text","characters","glyphs","terminal","ansi","blocks","halftone","teletext","typewriter","matrix"],inputs:[{name:"\
|
|
2659
2661
|
in",type:"texture"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Mode",type:"enum",default:"characters",options:[{value:"characters",label:"Characters"},{value:"blocks",label:"Bloc\
|
|
2660
2662
|
ks"},{value:"braille",label:"Braille"},{value:"weight",label:"Weight"},{value:"width",label:"Width"}],description:"Characters picks a glyph on the Ramp by brightness. Blocks samples four corners per c\
|
|
@@ -2662,13 +2664,13 @@ ell and draws the quadrant block that matches (\u2580 \u2596 \u259F \u2026), two
|
|
|
2662
2664
|
tterns. Weight and Width repeat one Character and let brightness drive the axis of a variable face \u2014 Orbitron\u2019s weight, Tektur\u2019s width; a static family steps through the weights it ships."},
|
|
2663
2665
|
{key:"ramp",label:"Ramp",type:"enum",default:"standard",options:[{value:"standard",label:"Standard .:-=+*#%@"},{value:"short",label:"Short .oO@"},{value:"shades",label:"Shades \u2591\u2592\u2593\u2588"},
|
|
2664
2666
|
{value:"binary",label:"Binary #"},{value:"custom",label:"Custom"}],description:"The characters from dark to light. Shades needs a face with the block glyphs (the mono faces have them).",dimWhen:Dr("c\
|
|
2665
|
-
haracters")},{key:"custom",label:"Custom",type:"string",default:" .:-=+*#%@",description:"Your own ramp, typed dark to light. The first character is what an empty cell shows.",dimWhen:
|
|
2667
|
+
haracters")},{key:"custom",label:"Custom",type:"string",default:" .:-=+*#%@",description:"Your own ramp, typed dark to light. The first character is what an empty cell shows.",dimWhen:Ky},{key:"charac\
|
|
2666
2668
|
ter",label:"Character",type:"string",default:"#",description:"Weight and Width: the one glyph every cell repeats.",dimWhen:Dr("weight","width")},{key:"levels",label:"Levels",type:"int",default:8,min:2,
|
|
2667
2669
|
max:64,description:"Weight and Width: how many steps across the axis. Fewer steps, longer runs, fewer shapes.",dimWhen:Dr("weight","width")},{key:"threshold",label:"Threshold",type:"number",default:.5,
|
|
2668
2670
|
min:0,max:1,step:.01,description:"Blocks and Braille: the brightness at which a corner or a dot lights.",dimWhen:Dr("blocks","braille")},{key:"measure",label:"Measure",type:"enum",default:"luma",options:[
|
|
2669
2671
|
{value:"luma",label:"Brightness"},{value:"coverage",label:"Coverage"}],description:"What a cell\u2019s value is: its brightness over black (a red ring reads dark), or how much of it is painted at all (the \
|
|
2670
2672
|
ring reads full) \u2014 Mono\u2019s rule for a raster with no background."},{key:"invert",label:"Invert",type:"bool",default:!1,description:"Light cells take the dark end of the ramp \u2014 for ink on pape\
|
|
2671
|
-
r."},{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Mn.map(e=>({value:e,label:`${e} \xB7 ${lo(e)}`})),optionsFor:()=>
|
|
2673
|
+
r."},{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Mn.map(e=>({value:e,label:`${e} \xB7 ${lo(e)}`})),optionsFor:()=>lr().map(e=>({value:e,label:`${e} \xB7 ${lo(e)}`})),description:"The\
|
|
2672
2674
|
cell is this face\u2019s advance by Size \xD7 Line Height. A mono face runs a row as one shape; a proportional face puts every glyph on its own cell.",group:"Type"},{key:"fontSize",label:"Size",type:"\
|
|
2673
2675
|
number",default:12,min:2,step:.5,unit:"px",group:"Type",description:"Sets the cell: 12 px of Plex Mono is a 7.2 \xD7 12 cell. A pixel face rounds to its grid."},{key:"lineHeight",label:"Line Height",type:"\
|
|
2674
2676
|
number",default:1,min:.25,max:4,step:.05,group:"Type",description:"Cell height in em. 1 is the terminal look; Blocks count from the block glyph\u2019s own height so rows touch \u2014 a touch under 1 overlaps th\
|
|
@@ -2679,31 +2681,31 @@ ight. Weight mode drives it from the picture instead.",group:"Type",dimWhen:Dr("
|
|
|
2679
2681
|
Ink"},{value:"source",label:"Source"}],description:"Ink paints every glyph with the Fill; Source gives each cell the colour under it (a run per colour \u2014 Posterize upstream to keep the count down).",
|
|
2680
2682
|
group:"Colour"},{key:"background",label:"Background",type:"enum",default:"none",options:[{value:"none",label:"None"},{value:"source",label:"Source"}],description:"Source puts a block of the cell\u2019s own\
|
|
2681
2683
|
colour behind each glyph, as a terminal with background colours.",group:"Colour"},{...ql("fill"),default:"#ffffff",description:"The ink.",group:"Colour"},{...ql("opacity"),group:"Colour"}],cook(e){let t=e.
|
|
2682
|
-
texture();if(!t||t.width<=0||t.height<=0)return Wl;let n=e.enumOf("mode",
|
|
2683
|
-
enumOf("ramp",["standard","short","shades","binary","custom"]),f=h==="custom"?e.str("custom"):
|
|
2684
|
-
tWeight"))||400),x=yn(r),v=n==="weight"?x?Ul(x.min,x.max,y):Rn(r):[g],b=
|
|
2684
|
+
texture();if(!t||t.width<=0||t.height<=0)return Wl;let n=e.enumOf("mode",Jy),r=gt(e.str("fontFamily")).family,i=gn(r),s=ti(r,e.num("fontSize")),l=Math.max(.25,e.num("lineHeight")),u=e.bool("invert"),h=e.
|
|
2685
|
+
enumOf("ramp",["standard","short","shades","binary","custom"]),f=h==="custom"?e.str("custom"):jy[h],A=[...f.length>0?f:" "],d=[...e.str("character")][0]??"#",y=e.int("levels"),g=Tt(r,Number(e.str("fon\
|
|
2686
|
+
tWeight"))||400),x=yn(r),v=n==="weight"?x?Ul(x.min,x.max,y):Rn(r):[g],b=ur(r),C=n==="width"?b?Ul(b.min,b.max,y):[100]:[100],M=v[v.length-1],S=n==="blocks"||n==="braille",T=n==="braille"?"\u28FF":"\u2588",
|
|
2685
2687
|
P=n==="weight"||n==="width"?d:S?T:"0",E=Mu(n),_=(We,Je,dt)=>e.outline?.measure?.({text:We,family:r,weight:Je,stretch:dt,size:s,letterSpacing:0}),Q=_(P,M,ln(r,C[0])),Y=Q&&Q.width>0?Q.width:s*.6,F=Q?.capHeight??
|
|
2686
|
-
s*
|
|
2687
|
-
Je=We&&
|
|
2688
|
+
s*e0,$=_("M",g,100)?.width,W=_("i",g,100)?.width,G=$===void 0||W===void 0||Math.abs($-W)<1e-6,oe=t0;if(S){let We=e.outline?.glyphs?.({text:T,family:r,weight:g,stretch:100,size:s,letterSpacing:0})?.glyphs[0],
|
|
2689
|
+
Je=We&&n0(We.d);Je&&(oe={top:-Je.top/s,bottom:-Je.bottom/s})}let ce=i?Math.max(1,Math.round(Y)):Y,he=S?(oe.top-oe.bottom)*s*l:s*l,se=i?Math.max(1,Math.round(he)):he;if(!(ce>0)||!(se>0))return Wl;let Ae=t.
|
|
2688
2690
|
at?.x??(e.canvas.origin==="center"?-t.width/2:0),ve=t.at?.y??(e.canvas.origin==="center"?-t.height/2:0),ne=Math.max(1,Math.floor(t.width/ce)),ge=Math.max(1,Math.floor(t.height/se)),_e=(t.width-ne*ce)/
|
|
2689
2691
|
2,Se=(t.height-ge*se)/2,Fe=i?Math.round(Ae+_e):Ae+_e,lt=i?Math.round(ve+Se):ve+Se,de=S?(se-(oe.top-oe.bottom)*s)/2+oe.top*s:(se+F)/2,Ie=ol(t,{x0:Fe-Ae,y0:lt-ve,cw:ce,ch:se,cols:ne,rows:ge,sub:n==="blo\
|
|
2690
2692
|
cks"?2:n==="braille"?{x:2,y:4}:1}),qe=e.enumOf("colour",["ink","source"]),Ue=e.enumOf("background",["none","source"]),et=Math.min(1,Math.max(0,e.num("threshold"))),Ve=e.enumOf("measure",["luma","cover\
|
|
2691
|
-
age"])==="coverage",He=
|
|
2693
|
+
age"])==="coverage",He=o0(Ie,{mode:n,invert:u,coverage:Ve,ramp:A,repeated:d,weights:v,stretches:C,threshold:et,colour:qe==="source",background:Ue==="source"}),Qt=e.num("opacity"),it={fill:e.color("fil\
|
|
2692
2694
|
l"),stroke:"none",opacity:Qt},kt=[],In=We=>Fe+We*ce,Gt=We=>lt+We*se;if(Ue==="source")for(let We=0;We<ge;We++)for(let Je=0;Je<ne;){let dt=He[We*ne+Je].bg,It=Je+1;for(;It<ne&&He[We*ne+It].bg===dt;)It++;
|
|
2693
2695
|
dt!==void 0&&kt.push({id:e.shapeId(kt.length),kind:"rect",x:In(Je),y:Gt(We),w:(It-Je)*ce,h:se,rx:0,style:{fill:dt,stroke:"none",opacity:Qt},transform:be,meta:e.meta(kt.length,["ascii","cell"])}),Je=It}
|
|
2694
2696
|
for(let We=0;We<ge;We++)for(let Je=0;Je<ne;){let dt=He[We*ne+Je],It=Je+1;for(;It<ne&&G;){let xt=He[We*ne+It];if(xt.ch!==E&&(xt.weight!==dt.weight||xt.stretch!==dt.stretch||xt.fill!==dt.fill))break;It++}
|
|
2695
2697
|
let qt="";for(let xt=Je;xt<It;xt++)qt+=He[We*ne+xt].ch;for(;qt.endsWith(E);)qt=qt.slice(0,-E.length);if(qt.length>0){let xt=ln(r,dt.stretch);kt.push({id:e.shapeId(kt.length),kind:"text",x:In(Je),y:i?Math.
|
|
2696
2698
|
round(Gt(We)+de):Gt(We)+de,text:qt,fontSize:s,fontFamily:r,fontWeight:dt.weight,...xt!==100?{fontStretch:xt}:{},anchor:"start",letterSpacing:0,metrics:{width:[...qt].length*ce,capHeight:F},style:dt.fill!==
|
|
2697
|
-
void 0?{...it,fill:dt.fill}:it,transform:be,meta:e.meta(kt.length,xs(We,Je,E))})}Je=It}return{out:V(kt)}}};function
|
|
2699
|
+
void 0?{...it,fill:dt.fill}:it,transform:be,meta:e.meta(kt.length,xs(We,Je,E))})}Je=It}return{out:V(kt)}}};function o0(e,t){let{cols:n,rows:r,sub:i,luma:s,rgba:l}=e,u=n*i.x,h=new Array(n*r),f=d=>{let y=(t.
|
|
2698
2700
|
coverage?l[d*4+3]:s[d])/255;return t.invert?1-y:y},A=(d,y)=>d[Math.min(d.length-1,Math.floor(y*d.length))];for(let d=0;d<r;d++)for(let y=0;y<n;y++){let g={ch:" ",weight:t.weights[0],stretch:t.stretches[0]},
|
|
2699
2701
|
x=d*i.y*u+y*i.x;if(t.colour||t.background){let b=new Uint8ClampedArray(4),C=i.x*i.y;for(let S=0;S<4;S++){let T=0;for(let P=0;P<i.y;P++)for(let E=0;E<i.x;E++)T+=l[(x+P*u+E)*4+S];b[S]=Math.floor((2*T+C)/
|
|
2700
2702
|
(2*C))}let M=Tu(b,0);t.colour&&(g.fill=M),t.background&&(g.bg=M)}let v=(b,C)=>f(x+C*u+b)>=t.threshold&&(t.threshold>0||f(x+C*u+b)>0)?1:0;if(t.mode==="blocks"){let b=v(0,0)<<3|v(1,0)<<2|v(0,1)<<1|v(1,1);
|
|
2701
|
-
g.ch=
|
|
2702
|
-
A(t.ramp,b):b>0&&(g.ch=t.repeated,t.mode==="weight"?g.weight=A(t.weights,b):g.stretch=A(t.stretches,b))}g.ch===Mu(t.mode)&&(g.fill=void 0),h[d*n+y]=g}return h}var
|
|
2703
|
+
g.ch=Vy[b]}else if(t.mode==="braille"){let b=v(0,0)|v(0,1)<<1|v(0,2)<<2|v(1,0)<<3|v(1,1)<<4|v(1,2)<<5|v(0,3)<<6|v(1,3)<<7;g.ch=String.fromCodePoint(10240+b)}else{let b=f(x);t.mode==="characters"?g.ch=
|
|
2704
|
+
A(t.ramp,b):b>0&&(g.ch=t.repeated,t.mode==="weight"?g.weight=A(t.weights,b):g.stretch=A(t.stretches,b))}g.ch===Mu(t.mode)&&(g.fill=void 0),h[d*n+y]=g}return h}var i0={},s0=["ramp","size","both"],a0=(...e)=>t=>!e.includes(Z(t.mode).base??"ramp");function l0(e,t){let n={sourceNodeId:"halftone",index:0},r={fill:e,stroke:"none"},i={fill:"none",stroke:e,strokeWidth:t},
|
|
2703
2705
|
s=(l,u)=>({id:`builtin:${u}`,transform:be,meta:{...n,index:u},...l});return[s({kind:"circle",cx:0,cy:0,r:.12,style:r},0),s({kind:"path",d:"M -0.5 0 L 0.5 0 M 0 -0.5 L 0 0.5",style:i},1),s({kind:"path",
|
|
2704
2706
|
d:"M -0.4 -0.4 L 0.4 0.4 M 0.4 -0.4 L -0.4 0.4",style:i},2),s({kind:"circle",cx:0,cy:0,r:.5-t/2,style:i},3),s({kind:"rect",x:-.5+t/2,y:-.5+t/2,w:1-t,h:1-t,rx:0,style:i},4),s({kind:"rect",x:-.5,y:-.5,w:1,
|
|
2705
|
-
h:1,rx:0,style:r},5),s({kind:"circle",cx:0,cy:0,r:.5,style:r},6)]}function
|
|
2706
|
-
let s=t==="shapes"?void 0:t==="ink"?n:r,l={...e,opacity:(e.opacity??1)*i};return s===void 0||(e.fill!==void 0&&e.fill!=="none"&&(l.fill=s),e.stroke!==void 0&&e.stroke!=="none"&&(l.stroke=s)),l}var
|
|
2707
|
+
h:1,rx:0,style:r},5),s({kind:"circle",cx:0,cy:0,r:.5,style:r},6)]}function u0(e){let t=Ze(e);return!t||!(t.w>0||t.h>0)?{cx:0,cy:0,size:1}:{cx:t.x+t.w/2,cy:t.y+t.h/2,size:Math.max(t.w,t.h)}}function c0(e,t,n,r,i){
|
|
2708
|
+
let s=t==="shapes"?void 0:t==="ink"?n:r,l={...e,opacity:(e.opacity??1)*i};return s===void 0||(e.fill!==void 0&&e.fill!=="none"&&(l.fill=s),e.stroke!==void 0&&e.stroke!=="none"&&(l.stroke=s)),l}var h0={
|
|
2707
2709
|
type:"halftone",label:"Halftone",category:"post",description:"Pixels back into shapes: a screen of cells, each a shape picked from a ramp by its brightness, or one shape sized by it \u2014 the symbol grids\
|
|
2708
2710
|
of print and dashboards, or the classic dot screen. Wire shapes in as the ramp, dark to light; nothing wired uses a built-in set.",keywords:["halftone","dots","screen","dither","symbols","grid","prin\
|
|
2709
2711
|
t","ramp","mosaic","ascii"],inputs:[{name:"in",type:"texture",label:"In"},{name:"shapes",type:"shapes",multi:!0,label:"Ramp"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"mode",label:"Mode",type:"\
|
|
@@ -2712,32 +2714,32 @@ shape, the lightest the last. Size scales one shape by brightness \u2014 the fir
|
|
|
2712
2714
|
step:1,unit:"px",description:"The screen\u2019s pitch: one shape per this many pixels each way."},{key:"angle",label:"Angle",type:"number",default:0,step:1,unit:"\xB0",description:"The screen turned: \
|
|
2713
2715
|
15 and 45 are print\u2019s angles. The cells still read the pixels under them."},{key:"size",label:"Size",type:"number",default:.9,min:0,max:2,step:.05,description:"How much of the cell a shape fills,\
|
|
2714
2716
|
1 touching its neighbours \u2014 the lightest cell\u2019s size when brightness scales."},{key:"sizeMin",label:"Min Size",type:"number",default:.1,min:0,max:2,step:.05,description:"The darkest lit cel\
|
|
2715
|
-
l\u2019s size when brightness scales.",dimWhen:
|
|
2717
|
+
l\u2019s size when brightness scales.",dimWhen:a0("size","both")},{key:"spin",label:"Spin",type:"number",default:0,step:5,unit:"\xB0",description:"Turn each shape by up to this much, the lightest cell\
|
|
2716
2718
|
s most. 0 keeps them straight."},{key:"measure",label:"Measure",type:"enum",default:"luma",options:[{value:"luma",label:"Brightness"},{value:"coverage",label:"Coverage"}],description:"What a cell\u2019s va\
|
|
2717
2719
|
lue is: its brightness over black, or how much of it is painted at all."},{key:"invert",label:"Invert",type:"bool",default:!1,description:"Light cells read as dark: the first shape and the smallest si\
|
|
2718
2720
|
ze where it is bright."},{key:"colour",label:"Colour",type:"enum",default:"ink",options:[{value:"ink",label:"Ink"},{value:"shapes",label:"Shapes"},{value:"source",label:"Source"}],description:"Ink pai\
|
|
2719
2721
|
nts every copy with the Fill; Shapes keeps each wired shape\u2019s own style; Source gives each cell the colour under it.",group:"Colour"},{key:"fill",label:"Fill",type:"color",default:"#ffffff",description:"\
|
|
2720
|
-
The ink.",group:"Colour"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Colour"}],cook(e){let t=e.texture("in");if(!t||t.width<=0||t.height<=0)return
|
|
2721
|
-
"mode",
|
|
2722
|
-
rt"),A=e.enumOf("colour",["ink","shapes","source"]),d=e.color("fill"),y=e.num("opacity"),g=e.inputList("shapes").flatMap(F=>F.t==="shapes"?F.v:[]),x=
|
|
2723
|
-
0?g:x,b=v.map(
|
|
2722
|
+
The ink.",group:"Colour"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Colour"}],cook(e){let t=e.texture("in");if(!t||t.width<=0||t.height<=0)return i0;let n=e.enumOf(
|
|
2723
|
+
"mode",s0),r=Math.max(2,e.num("cell")),i=e.num("angle"),s=Math.max(0,e.num("size")),l=Math.max(0,e.num("sizeMin")),u=e.num("spin"),h=e.enumOf("measure",["luma","coverage"])==="coverage",f=e.bool("inve\
|
|
2724
|
+
rt"),A=e.enumOf("colour",["ink","shapes","source"]),d=e.color("fill"),y=e.num("opacity"),g=e.inputList("shapes").flatMap(F=>F.t==="shapes"?F.v:[]),x=l0(d,.12),v=n==="size"?[g[0]??x[x.length-1]]:g.length>
|
|
2725
|
+
0?g:x,b=v.map(u0),C=t.at?.x??(e.canvas.origin==="center"?-t.width/2:0),M=t.at?.y??(e.canvas.origin==="center"?-t.height/2:0),S=t.width/2,T=t.height/2,P=i*Math.PI/180,E=Math.cos(P),_=Math.sin(P),Q=Math.
|
|
2724
2726
|
ceil(Math.hypot(S,T)/r),Y=[];for(let F=-Q;F<=Q;F++)for(let $=-Q;$<=Q;$++){let W=S+E*$*r-_*F*r,G=T+_*$*r+E*F*r;if(W<0||G<0||W>=t.width||G>=t.height)continue;let oe=il(t,W-r/2,G-r/2,W+r/2,G+r/2);if(oe.count===
|
|
2725
2727
|
0)continue;let ce=(h?oe.rgba[3]:oe.luma)/255;if(f&&(ce=1-ce),ce<=0)continue;let he=n==="size"?0:Math.min(v.length-1,Math.floor(ce*v.length)),se=v[he],Ae=b[he],ve=n==="ramp"?s:l+(s-l)*ce;if(!(ve>0))continue;
|
|
2726
2728
|
let ne=r*ve/Ae.size,ge=me(Re(C+W,M+G),me(dn(ne),Re(-Ae.cx,-Ae.cy)));u!==0&&(ge=me(Re(C+W,M+G),me(zt(u*ce),me(dn(ne),Re(-Ae.cx,-Ae.cy)))));let _e=A==="source"?Tu(oe.rgba,0):void 0;if(A==="source"&&_e===
|
|
2727
|
-
void 0)continue;let Se=Y.length;Y.push({...se,id:e.shapeId(Se),transform:me(ge,se.transform),style:
|
|
2728
|
-
function
|
|
2729
|
+
void 0)continue;let Se=Y.length;Y.push({...se,id:e.shapeId(Se),transform:me(ge,se.transform),style:c0(se.style,A,d,_e,y),meta:e.meta(Se,[...xs(F+Q,$+Q),"halftone",`step:${he}`])})}return{out:V(Y)}}},f0={};
|
|
2730
|
+
function p0(e,t,n){let{width:r,height:i,data:s}=e,l=Math.max(1,Math.floor(t)),u=Math.ceil(r/l),h=Math.ceil(i/l),f=new Float64Array(u*h);for(let A=0;A<h;A++){let d=Math.min(i,(A+1)*l);for(let y=0;y<u;y++){
|
|
2729
2731
|
let g=Math.min(r,(y+1)*l),x=0,v=0;for(let b=A*l;b<d;b++){let C=(b*r+y*l)*4;for(let M=y*l;M<g;M++,C+=4)x+=n?s[C+3]:.2126*s[C]+.7152*s[C+1]+.0722*s[C+2],v++}f[A*u+y]=v>0?x/v/255:0}}return{gw:u,gh:h,v:f,
|
|
2730
|
-
step:l}}function
|
|
2732
|
+
step:l}}function d0(e,t){let{gw:n,gh:r,v:i}=e,s=new Map,l=new Map,u=(v,b)=>i[b*n+v],h=v=>{if(s.has(v))return;let b=v>>1,C=b%n,M=(b-C)/n,S=u(C,M),T=v&1?u(C,M+1):u(C+1,M),P=T===S?.5:Math.min(1,Math.max(
|
|
2731
2733
|
0,(t-S)/(T-S)));s.set(v,v&1?[C,M+P]:[C+P,M])},f=[],A=[],d=(v,b)=>{h(v),h(b);let C=f.length;f.push(v),A.push(b);for(let M of[v,b]){let S=l.get(M);S?S.push(C):l.set(M,[C])}};for(let v=0;v+1<r;v++)for(let b=0;b+
|
|
2732
2734
|
1<n;b++){let C=u(b,v)>=t,M=u(b+1,v)>=t,S=u(b+1,v+1)>=t,T=u(b,v+1)>=t;if(C===M&&M===S&&S===T)continue;let P=2*(v*n+b),E=2*((v+1)*n+b),_=2*(v*n+b)+1,Q=2*(v*n+b+1)+1,Y=[];C!==M&&Y.push(P),M!==S&&Y.push(Q),
|
|
2733
2735
|
S!==T&&Y.push(E),T!==C&&Y.push(_),Y.length===2?d(Y[0],Y[1]):(u(b,v)+u(b+1,v)+u(b+1,v+1)+u(b,v+1))/4>=t===C?(d(P,Q),d(E,_)):(d(_,P),d(Q,E))}let y=new Uint8Array(f.length),g=[],x=v=>{let b=[v],C=v;for(;;){
|
|
2734
2736
|
let S=(l.get(C)??[]).find(T=>!y[T]);if(S===void 0)break;y[S]=1,C=f[S]===C?A[S]:f[S],b.push(C)}let M=b.length>2&&b[b.length-1]===v;return M&&b.pop(),{points:b.map(S=>s.get(S)),closed:M}};for(let[v,b]of l)
|
|
2735
|
-
b.length===1&&!y[b[0]]&&g.push(x(v));for(let v=0;v<f.length;v++)y[v]||g.push(x(f[v]));return g}function
|
|
2737
|
+
b.length===1&&!y[b[0]]&&g.push(x(v));for(let v=0;v<f.length;v++)y[v]||g.push(x(f[v]));return g}function A0(e,t){let n=e.points;if(n.length<4||t<=0)return e;let r=e.closed?[...n,n[0]]:n,i=new Uint8Array(
|
|
2736
2738
|
r.length);i[0]=i[r.length-1]=1;let s=[[0,r.length-1]];for(;s.length>0;){let[u,h]=s.pop(),[f,A]=r[u],[d,y]=r[h],g=d-f,x=y-A,v=Math.hypot(g,x),b=-1,C=t;for(let M=u+1;M<h;M++){let[S,T]=r[M],P=v>0?Math.abs(
|
|
2737
|
-
x*(S-f)-g*(T-A))/v:Math.hypot(S-f,T-A);P>C&&(C=P,b=M)}b>=0&&(i[b]=1,s.push([u,b],[b,h]))}let l=r.filter((u,h)=>i[h]);return e.closed&&l.pop(),l.length>=(e.closed?3:2)?{points:l,closed:e.closed}:e}function
|
|
2739
|
+
x*(S-f)-g*(T-A))/v:Math.hypot(S-f,T-A);P>C&&(C=P,b=M)}b>=0&&(i[b]=1,s.push([u,b],[b,h]))}let l=r.filter((u,h)=>i[h]);return e.closed&&l.pop(),l.length>=(e.closed?3:2)?{points:l,closed:e.closed}:e}function m0(e,t){
|
|
2738
2740
|
let n=e.points;for(let r=0;r<t&&n.length>2;r++){let i=[],s=n.length;e.closed||i.push(n[0]);let l=e.closed?s:s-1;for(let u=0;u<l;u++){let h=n[u],f=n[(u+1)%s];i.push([.75*h[0]+.25*f[0],.75*h[1]+.25*f[1]],
|
|
2739
|
-
[.25*h[0]+.75*f[0],.25*h[1]+.75*f[1]])}e.closed||i.push(n[s-1]),n=i}return{points:n,closed:e.closed}}var
|
|
2740
|
-
e.points[r][1]-e.points[r-1][1]);return e.closed&&n>1&&(t+=Math.hypot(e.points[0][0]-e.points[n-1][0],e.points[0][1]-e.points[n-1][1])),t},Hl=e=>String(Math.round(e*100)/100),
|
|
2741
|
+
[.25*h[0]+.75*f[0],.25*h[1]+.75*f[1]])}e.closed||i.push(n[s-1]),n=i}return{points:n,closed:e.closed}}var y0=e=>{let t=0,n=e.points.length;for(let r=1;r<n;r++)t+=Math.hypot(e.points[r][0]-e.points[r-1][0],
|
|
2742
|
+
e.points[r][1]-e.points[r-1][1]);return e.closed&&n>1&&(t+=Math.hypot(e.points[0][0]-e.points[n-1][0],e.points[0][1]-e.points[n-1][1])),t},Hl=e=>String(Math.round(e*100)/100),g0={type:"contours",label:"\
|
|
2741
2743
|
Contours",category:"post",description:"Pixels back into lines: the picture read as a height map and traced where it crosses evenly spaced levels \u2014 the lines of a topographic map, every Nth one a major\
|
|
2742
2744
|
line. Wire Noise Paint \u2192 Rect \u2192 Rasterize in for terrain; animate Offset to make the lines flow.",keywords:["contours","contour","topographic","topo","isolines","iso","height","map","terrai\
|
|
2743
2745
|
n","marching squares","lines","trace"],inputs:[{name:"in",type:"texture",label:"In"}],outputs:[{name:"out",type:"shapes"}],params:[{key:"lines",label:"Lines",type:"int",default:12,min:1,max:128,description:"\
|
|
@@ -2750,17 +2752,17 @@ unit:"px",description:"Lines shorter than this are dropped: the specks round tin
|
|
|
2750
2752
|
The lines\u2019 colour.",group:"Lines"},{key:"width",label:"Width",type:"number",default:1,min:0,step:.1,unit:"px",description:"A minor line\u2019s width.",group:"Lines"},{key:"majorEvery",label:"Majo\
|
|
2751
2753
|
r Every",type:"int",default:5,min:0,max:32,description:"Every Nth level is a major line, drawn at Major Width and tagged major. 0: no majors.",group:"Lines"},{key:"majorWidth",label:"Major Width",type:"\
|
|
2752
2754
|
number",default:3,min:0,step:.1,unit:"px",group:"Lines"},{key:"opacity",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01,group:"Lines"}],cook(e){let t=e.texture("in");if(!t||t.width<=0||t.
|
|
2753
|
-
height<=0)return
|
|
2755
|
+
height<=0)return f0;let n=Math.max(1,e.int("lines")),r=e.num("offset"),i=p0(t,e.int("detail"),e.enumOf("measure",["luma","coverage"])==="coverage"),s=Math.max(0,Math.min(4,e.int("smooth"))),l=Math.max(
|
|
2754
2756
|
0,e.num("minLength")),u=e.color("stroke"),h=Math.max(0,e.num("width")),f=Math.max(0,e.int("majorEvery")),A=Math.max(0,e.num("majorWidth")),d=e.num("opacity"),y=t.at?.x??(e.canvas.origin==="center"?-t.
|
|
2755
2757
|
width/2:0),g=t.at?.y??(e.canvas.origin==="center"?-t.height/2:0),x=i.step,v=T=>y+Math.min(t.width,T*x+x/2),b=T=>g+Math.min(t.height,T*x+x/2),C=Math.floor(r),M=r-C,S=[];for(let T=0;T<n;T++){let P=(T+M)/
|
|
2756
|
-
n;if(P<=0||P>=1)continue;let E=T-C,_=f>0&&(E%f+f)%f===0;for(let Q of
|
|
2758
|
+
n;if(P<=0||P>=1)continue;let E=T-C,_=f>0&&(E%f+f)%f===0;for(let Q of d0(i,P)){if(Q.points.length<2||l>0&&y0(Q)*x<l)continue;let Y=m0(A0(Q,.1),s),F="";for(let W=0;W<Y.points.length;W++){let[G,oe]=Y.points[W];
|
|
2757
2759
|
F+=`${W===0?"M":" L"} ${Hl(v(G))} ${Hl(b(oe))}`}Y.closed&&(F+=" Z");let $=S.length;S.push({kind:"path",d:F,id:e.shapeId($),transform:be,style:{fill:"none",stroke:u,strokeWidth:_?A:h,opacity:d},meta:e.
|
|
2758
|
-
meta($,["contour",_?"major":"minor",`level:${E}`])})}}return{out:V(S)}}},
|
|
2760
|
+
meta($,["contour",_?"major":"minor",`level:${E}`])})}}return{out:V(S)}}},b0={single:["\u250C","\u2500","\u2510","\u2502","\u2514","\u2518"],double:["\u2554","\u2550","\u2557","\u2551","\u255A","\u255D"],
|
|
2759
2761
|
rounded:["\u256D","\u2500","\u256E","\u2502","\u2570","\u256F"],heavy:["\u250F","\u2501","\u2513","\u2503","\u2517","\u251B"],ascii:["+","-","+","|","+","+"]},$l=e=>gt(String(Z(e.fontFamily).base??"")).
|
|
2760
|
-
family,
|
|
2761
|
-
padY:i,align:s}=e,l=t==="none"?void 0:
|
|
2762
|
+
family,v0=.7;function I0(e,t,n){let r=[...e].slice(0,t),i=t-r.length,s=n==="start"?0:n==="end"?i:Math.floor(i/2);return" ".repeat(s)+r.join("")+" ".repeat(i-s)}function x0(e){let{border:t,title:n,padX:r,
|
|
2763
|
+
padY:i,align:s}=e,l=t==="none"?void 0:b0[t],u=l?1:0,h=Math.max(0,...e.lines.map(g=>[...g].length)),f=e.width>0?Math.max(0,e.width-2*u-2*r):h,A=g=>(l?l[3]:"")+" ".repeat(r)+I0(g,f,s)+" ".repeat(r)+(l?l[3]:
|
|
2762
2764
|
""),d=A(""),y=[];if(l){let g=f+2*r,x=[...n.trim()],v=x.length>0&&x.length+2<=g?` ${x.join("")} `+l[1].repeat(g-x.length-2):l[1].repeat(g);y.push(l[0]+v+l[2])}for(let g=0;g<i;g++)y.push(d);for(let g of e.
|
|
2763
|
-
lines)y.push(A(g));for(let g=0;g<i;g++)y.push(d);return l&&y.push(l[4]+l[1].repeat(f+2*r)+l[5]),y}var
|
|
2765
|
+
lines)y.push(A(g));for(let g=0;g<i;g++)y.push(d);return l&&y.push(l[4]+l[1].repeat(f+2*r)+l[5]),y}var w0={type:"textbox",label:"Text Box",category:"generator",translate:[{x:"x",y:"y"}],description:"Li\
|
|
2764
2766
|
nes of text in a frame of box-drawing characters \u2014 a terminal window, a readout panel. All text, in a mono face; reads back as plain text.",keywords:["box","frame","border","panel","window","term\
|
|
2765
2767
|
inal","drawbox","ascii"],inputs:[],outputs:[{name:"out",type:"shapes"}],params:[{key:"text",label:"Text",type:"string",default:`SYS // READY
|
|
2766
2768
|
LINK 04 OK`,multiline:!0,glyphs:!0},{key:"title",label:"Title",type:"string",default:"",description:"Set into the top edge: \u250C TITLE \u2500\u2500\u2500\u2510. Left out when it does not fit."},{key:"\
|
|
@@ -2772,24 +2774,24 @@ s are cut."},{key:"padX",label:"Pad X",type:"int",default:1,min:0,max:32,unit:"c
|
|
|
2772
2774
|
unit:"rows",description:"Blank rows above and below the text."},{key:"align",label:"Align",type:"enum",default:"start",options:[{value:"start",label:"Left"},{value:"middle",label:"Centre"},{value:"end",
|
|
2773
2775
|
label:"Right"}],description:"Where the lines sit inside a box wider than they are."},{key:"anchor",label:"Anchor",type:"enum",default:"start",options:[{value:"start",label:"Start"},{value:"middle",label:"\
|
|
2774
2776
|
Middle"},{value:"end",label:"End"}],description:"Which top corner X names: the left, the middle of the top edge, or the right."},{key:"fontFamily",label:"Font",type:"enum",default:_n,options:Mn.map(e=>({
|
|
2775
|
-
value:e,label:`${e} \xB7 ${lo(e)}`})),optionsFor:()=>
|
|
2777
|
+
value:e,label:`${e} \xB7 ${lo(e)}`})),optionsFor:()=>lr().map(e=>({value:e,label:`${e} \xB7 ${lo(e)}`})),description:"A mono face keeps the frame square; the Fixed bitmaps draw it on a pixel grid. A p\
|
|
2776
2778
|
roportional face leaves it ragged.",group:"Type"},{key:"fontSize",label:"Size",type:"number",default:12,min:1,step:.5,unit:"px",group:"Type",description:"A pixel face rounds to its grid."},{key:"fontW\
|
|
2777
2779
|
eight",label:"Weight",type:"enum",default:"400",options:[{value:"300",label:"Light"},{value:"400",label:"Regular"},{value:"500",label:"Medium"},{value:"600",label:"SemiBold"},{value:"700",label:"Bold"},
|
|
2778
2780
|
{value:"800",label:"ExtraBold"},{value:"900",label:"Black"}],optionsFor:e=>{let t=new Set(Rn($l(e)).map(String)),n=[300,400,500,600,700,800,900].map(i=>({value:String(i),label:String(i)})),r=n.filter(
|
|
2779
2781
|
i=>t.has(i.value));return r.length>0?r:n},rangeFor:e=>yn($l(e)),group:"Type"},{key:"lineHeight",label:"Line Height",type:"number",default:1.2,min:.5,max:4,step:.05,group:"Type",description:"Row pitch \
|
|
2780
2782
|
in em. 1 stacks the frame\u2019s verticals without a gap on most faces."},{key:"outlines",label:"Outline to Path",type:"bool",default:!1,group:"Type",description:"Each row as a real vector path, for t\
|
|
2781
|
-
he geometry nodes. A bitmap face is a path either way."},...ho],cook(e){let t=gt(e.str("fontFamily")).family,n=Tt(t,Number(e.str("fontWeight"))||400),r=
|
|
2783
|
+
he geometry nodes. A bitmap face is a path either way."},...ho],cook(e){let t=gt(e.str("fontFamily")).family,n=Tt(t,Number(e.str("fontWeight"))||400),r=ti(t,e.num("fontSize")),i=gn(t),s=x0({lines:e.str(
|
|
2782
2784
|
"text").split(`
|
|
2783
2785
|
`),border:e.enumOf("border",["single","double","rounded","heavy","ascii","none"]),title:e.str("title"),width:e.int("width"),padX:e.int("padX"),padY:e.int("padY"),align:e.enumOf("align",["start","middl\
|
|
2784
|
-
e","end"])});if(s.length===0)return{out:{t:"shapes",v:[]}};let l=e.outline?.measure?.({text:"0",family:t,weight:n,stretch:100,size:r,letterSpacing:0}),u=l&&l.width>0?l.width:r*.6,h=l?.capHeight??r*
|
|
2786
|
+
e","end"])});if(s.length===0)return{out:{t:"shapes",v:[]}};let l=e.outline?.measure?.({text:"0",family:t,weight:n,stretch:100,size:r,letterSpacing:0}),u=l&&l.width>0?l.width:r*.6,h=l?.capHeight??r*v0,
|
|
2785
2787
|
f=i?Math.max(1,Math.round(r*e.num("lineHeight"))):r*e.num("lineHeight"),A=Math.max(0,...s.map(b=>[...b].length)),d=e.enumOf("anchor",["start","middle","end"]),y=d==="middle"?-(A*u)/2:d==="end"?-A*u:0,
|
|
2786
2788
|
g=e.num("x")+y,x=e.num("y");return{out:{t:"shapes",v:s.map((b,C)=>fo(e,C,s.length,{text:b,x:g,y:x+C*f+(f+h)/2,family:t,weight:n,fontSize:r,letterSpacing:0,anchor:"start",tags:[...xs(C,0),"box"]}))}}}},
|
|
2787
|
-
zl=e=>Z(e.display).base!=="mono",
|
|
2789
|
+
zl=e=>Z(e.display).base!=="mono",C0={type:"layer",label:"Layer",category:"output",inputs:[{name:"in",type:"shapes",multi:!0,accepts:["texture"]}],outputs:[{name:"out",type:"layers"}],params:[{key:"opa\
|
|
2788
2790
|
city",label:"Opacity",type:"number",default:1,min:0,max:1,step:.01},{key:"visible",label:"Visible",type:"bool",default:!0},{key:"order",label:"Order",type:"int",default:1,min:1},{key:"duration",label:"\
|
|
2789
2791
|
Duration",type:"number",default:0,min:0,step:.1,unit:"s",exposable:!1,inspectorOnly:!0,description:"The layer\u2019s own clock length; 0 follows the document."},{key:"loop",label:"Loop",type:"bool",default:!1,
|
|
2790
2792
|
inline:!0,exposable:!1,inspectorOnly:!0,description:"Wrap the layer\u2019s clock at its Duration instead of switching off."}],cook(e){let t={id:e.nodeId,name:e.name?.trim()||"Layer",opacity:e.num("opa\
|
|
2791
2793
|
city"),visible:e.bool("visible"),order:e.int("order"),shapes:[]};for(let n of e.inputList("in"))n.t==="shapes"?t.shapes.push(...n.v):n.t==="texture"&&!t.texture&&(t.texture=n.v,t.shapes.length>0&&(t.textureAt=
|
|
2792
|
-
t.shapes.length));return{out:ua([t])}}},
|
|
2794
|
+
t.shapes.length));return{out:ua([t])}}},k0={type:"canvas",label:"Canvas",category:"output",description:"The document terminus: gathers layers into the rendered scene.",inputs:[{name:"in",type:"layers",
|
|
2793
2795
|
multi:!0,accepts:["shapes","texture"]}],outputs:[{name:"out",type:"scene"}],params:[{key:"width",label:"Width",type:"int",default:1920,min:1,unit:"px"},{key:"height",label:"Height",type:"int",default:1080,
|
|
2794
2796
|
min:1,unit:"px"},{key:"bg",label:"Background",type:"color",default:"#05070a"},{key:"origin",label:"Origin",type:"enum",default:"center",options:[{value:"top-left",label:"Top left"},{value:"center",label:"\
|
|
2795
2797
|
Centre"}],description:"Centre puts (0,0) mid-frame \u2014 HUD maths without the offsets."},{key:"display",label:"Display",type:"enum",default:"vector",options:[{value:"vector",label:"Vector"},{value:"\
|
|
@@ -2798,8 +2800,8 @@ ffffff",description:"Mono only: the colour beside the background.",dimWhen:zl},{
|
|
|
2798
2800
|
background a pixel must be, 0..1, to turn to ink.",dimWhen:zl}],cook(e){let t=[];for(let s of e.inputList("in"))s.t==="layers"?t.push(...s.v):s.t==="shapes"?t.push({id:`${e.nodeId}:implicit:${t.length}`,
|
|
2799
2801
|
name:"Shapes",opacity:1,visible:!0,order:t.length,shapes:s.v}):s.t==="texture"&&t.push({id:`${e.nodeId}:implicit:${t.length}`,name:"Post",opacity:1,visible:!0,order:t.length,shapes:[],texture:s.v});let n=t.
|
|
2800
2802
|
map((s,l)=>({l:s,i:l})).sort((s,l)=>s.l.order-l.l.order||s.i-l.i).map(({l:s})=>s),r=e.enumOf("display",["vector","pixel","mono"]),i=r==="vector"?void 0:{mode:r,ink:e.color("ink"),threshold:Math.min(1,
|
|
2801
|
-
Math.max(0,e.num("threshold")))};return{out:ca({width:e.int("width"),height:e.int("height"),background:e.color("bg"),origin:e.enumOf("origin",["top-left","center"]),...i?{display:i}:{},layers:n})}}},
|
|
2802
|
-
|
|
2803
|
+
Math.max(0,e.num("threshold")))};return{out:ca({width:e.int("width"),height:e.int("height"),background:e.color("bg"),origin:e.enumOf("origin",["top-left","center"]),...i?{display:i}:{},layers:n})}}},E0=[
|
|
2804
|
+
C0,k0],S0="ograf",B0=20,cs=[{key:"name",label:"Name",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0,description:"The title\u2019s name in Resolve. Empty: the project name."},{
|
|
2803
2805
|
key:"description",label:"Description",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0},{key:"version",label:"Version",group:"Template",type:"string",default:"1.0.0",exposable:!1,
|
|
2804
2806
|
inspectorOnly:!0},{key:"author",label:"Author",group:"Template",type:"string",default:"",exposable:!1,inspectorOnly:!0},{key:"hold",label:"Hold",group:"Template",type:"number",default:2,min:0,step:.1,
|
|
2805
2807
|
unit:"s",exposable:!1,inspectorOnly:!0,description:"Default time on screen after the intro (the timeline). Sets the clip length Resolve starts from."},{key:"outro",label:"Outro",group:"Template",type:"\
|
|
@@ -2808,61 +2810,62 @@ t",label:"Exit",group:"Template",type:"enum",default:"fade",exposable:!1,inspect
|
|
|
2808
2810
|
After a stop: fade the whole title out over Outro, cut it, or let the graph animate its own exit from the Out clock."},{key:"loop",label:"Loop",group:"Template",type:"bool",default:!1,exposable:!1,inspectorOnly:!0,
|
|
2809
2811
|
description:"The title repeats the timeline instead of holding its last pose. A looping clip gets no automatic stop in Resolve."},{key:"stopAt",label:"Preview stop",group:"Template",type:"number",default:-1,
|
|
2810
2812
|
min:-1,step:.1,unit:"s",exposable:!1,inspectorOnly:!0,description:"Where the studio previews the stop, for the Out clock and the exit. -1: no stop. In Resolve the clip\u2019s own stop replaces it."}],
|
|
2811
|
-
Ru=new Set(cs.map(e=>e.key)),
|
|
2812
|
-
bool":return!0;case"color":return e.alpha?"#ffffffff":"#ffffff";case"text":return"";case"choice":return e.options?.[0]?.value??""}}function
|
|
2813
|
-
description:e.description,exposable:!1};switch(e.kind){case"number":return{...t,type:"number",default
|
|
2814
|
-
max};case"percent":return{...t,type:"number",default:1,min:0,max:1,step:.01};case"bool":return{...t,type:"bool",default:!0};case"color":return{...t,type:"color",default
|
|
2815
|
-
string",default:"",multiline:e.multiline};case"choice":return{...t,type:"enum",default
|
|
2816
|
-
number",bool:"bool",color:"color",text:"string",choice:"string"};function ws(e){let t=new Set,n=[];for(let r of e.rows??[]){if(n.length>=
|
|
2817
|
-
test(r.key)||i.some(s=>
|
|
2813
|
+
Ru=new Set(cs.map(e=>e.key)),P0=new Set([...Ru,"in","out"]),hs=e=>`${e}_index`;function $o(e){switch(e.kind){case"number":case"int":return Math.min(e.max??1/0,Math.max(e.min??-1/0,0));case"percent":return 1;case"\
|
|
2814
|
+
bool":return!0;case"color":return e.alpha?"#ffffffff":"#ffffff";case"text":return"";case"choice":return e.options?.[0]?.value??""}}function _0(e){let t={key:e.key,label:e.title||e.key,group:"Controls",
|
|
2815
|
+
description:e.description,exposable:!1};switch(e.kind){case"number":return{...t,type:"number",default:$o(e),min:e.min,max:e.max,step:e.step};case"int":return{...t,type:"int",default:$o(e),min:e.min,max:e.
|
|
2816
|
+
max};case"percent":return{...t,type:"number",default:1,min:0,max:1,step:.01};case"bool":return{...t,type:"bool",default:!0};case"color":return{...t,type:"color",default:$o(e)};case"text":return{...t,type:"\
|
|
2817
|
+
string",default:"",multiline:e.multiline};case"choice":return{...t,type:"enum",default:$o(e),options:e.options?.length?e.options:[{value:"",label:"\u2014"}]}}}var M0={number:"number",int:"number",percent:"\
|
|
2818
|
+
number",bool:"bool",color:"color",text:"string",choice:"string"};function ws(e){let t=new Set,n=[];for(let r of e.rows??[]){if(n.length>=B0)break;let i=r.kind==="choice"?[r.key,hs(r.key)]:[r.key];if(!(!/^[A-Za-z_][A-Za-z0-9_]*$/.
|
|
2819
|
+
test(r.key)||i.some(s=>P0.has(s)||t.has(s)))){for(let s of i)t.add(s);n.push(r)}}return n}var T0={type:S0,label:"OGraf",category:"output",keywords:["resolve","davinci","template","title","export","ins\
|
|
2818
2820
|
pector","controls"],description:"Makes the project a DaVinci Resolve title. Each row is a control in Resolve\u2019s Inspector and a wire out of here. Intro clock runs from the clip\u2019s play and Exit clock fr\
|
|
2819
2821
|
om its stop: wire them into a Seq\u2019s Play to animate the entrance and the exit. One per document.",timeRoot:!0,inputs:[],outputs:[{name:"in",type:"number",label:"Intro clock",clock:!0},{name:"out",
|
|
2820
|
-
type:"number",label:"Exit clock",clock:!0}],params:cs,specialize(e){let t=ws(e);return{params:[...cs,...t.map(
|
|
2821
|
-
ber",label:"Exit clock",clock:!0},...t.flatMap(n=>[{name:n.key,type:
|
|
2822
|
+
type:"number",label:"Exit clock",clock:!0}],params:cs,specialize(e){let t=ws(e);return{params:[...cs,...t.map(_0)],outputs:[{name:"in",type:"number",label:"Intro clock",clock:!0},{name:"out",type:"num\
|
|
2823
|
+
ber",label:"Exit clock",clock:!0},...t.flatMap(n=>[{name:n.key,type:M0[n.kind],label:n.title||n.key},...n.kind==="choice"?[{name:hs(n.key),type:"number",label:`${n.title||n.key} #`}]:[]])]}},cook(e){let t=e.
|
|
2822
2824
|
t,n=e.num("stopAt"),r={in:Te(An(!0,t)),out:Te(n>=0&&t>=n?An(!0,t-n):An(!1,0))};for(let i of e.paramDefs)if(!Ru.has(i.key)){if(i.type==="number")r[i.key]=Te(e.num(i.key));else if(i.type==="int")r[i.key]=
|
|
2823
|
-
Te(e.int(i.key));else if(i.type==="bool")r[i.key]=la(e.bool(i.key));else if(i.type==="color")r[i.key]=sn(e.color(i.key));else if(i.type==="string")r[i.key]=
|
|
2824
|
-
str(i.key);r[i.key]=
|
|
2825
|
-
...
|
|
2825
|
+
Te(e.int(i.key));else if(i.type==="bool")r[i.key]=la(e.bool(i.key));else if(i.type==="color")r[i.key]=sn(e.color(i.key));else if(i.type==="string")r[i.key]=Ci(e.str(i.key));else if(i.type==="enum"){let s=e.
|
|
2826
|
+
str(i.key);r[i.key]=Ci(s),r[hs(i.key)]=Te(Math.max(0,i.options.findIndex(l=>l.value===s)))}}return r}},R0=[...zp,Ad,nd,od,...Od,...Vd,w0,Kd,tA,aA,...AA,xA,EA,hd,cd,Cd,kd,DA,HA,...tm,...Am,...Rm,...ay,
|
|
2827
|
+
...fy,by,wy,...$m,By,...zy,r0,h0,g0,id,ad,...E0,T0];function Qu(e=[]){return new wa().registerAll(R0).registerAll(e)}var Ou=3;function yo(e){return t=>{if(!Number.isFinite(t))return"0";let n=Number(t.toFixed(e));return Object.is(n,-0)?"0":String(n)}}function mo(e){return e.replace(/&/g,"&").replace(/</g,"<").
|
|
2826
2828
|
replace(/>/g,">").replace(/"/g,""")}function Cs(e,t){return`matrix(${[e[0],e[1],e[2],e[3],e[4],e[5]].map(t).join(" ")})`}function Nu(e,t,n,r,i){if(e===void 0||typeof e=="string")return e;if(fa(
|
|
2827
|
-
e))return
|
|
2829
|
+
e))return Q0(e,t,n,r,i);if(!_o(e))return"none";let s=Mo(Bn(e.stops),e.stepped),l=s.length>0?pa(e,Bi(e,t)):void 0;if(!l)return _r(e);let u=['gradientUnits="userSpaceOnUse"'];if(l.kind==="linear"?u.push(
|
|
2828
2830
|
`x1="${r(l.x1)}"`,`y1="${r(l.y1)}"`,`x2="${r(l.x2)}"`,`y2="${r(l.y2)}"`):(u.push(`cx="${r(l.cx)}"`,`cy="${r(l.cy)}"`,`r="${r(l.r)}"`),(l.fx!==l.cx||l.fy!==l.cy)&&u.push(`fx="${r(l.fx)}"`,`fy="${r(l.fy)}\
|
|
2829
|
-
"`)),e.spread!=="pad"&&u.push(`spreadMethod="${e.spread}"`),e.space==="canvas"&&!zr(n)){let y=
|
|
2830
|
-
<stop offset="${r(y.at)}" stop-color="${g.rgb}"${g.a<1?` stop-opacity="${r(g.a)}"`:""}/>`}).join("")+"",f=l.kind==="linear"?"linearGradient":"radialGradient",A=`<${f} ${u.join(" ")}>${h}</${f}>`,d=`g${
|
|
2831
|
-
A)}`;return i.push(`<${f} id="${d}" ${u.join(" ")}>${h}</${f}>`),`url(#${d})`}function
|
|
2832
|
-
erSpaceOnUse"',`x="${r(s.x)}"`,`y="${r(s.y)}"`,`width="${r(s.w)}"`,`height="${r(s.h)}"`];if(e.space==="canvas"&&!zr(n)){let g=
|
|
2831
|
+
"`)),e.spread!=="pad"&&u.push(`spreadMethod="${e.spread}"`),e.space==="canvas"&&!zr(n)){let y=ki(n);if(!y)return _r(e);u.push(`gradientTransform="${Cs(y,r)}"`)}let h=s.map(y=>{let g=ar(y.color);return`\
|
|
2832
|
+
<stop offset="${r(y.at)}" stop-color="${g.rgb}"${g.a<1?` stop-opacity="${r(g.a)}"`:""}/>`}).join("")+"",f=l.kind==="linear"?"linearGradient":"radialGradient",A=`<${f} ${u.join(" ")}>${h}</${f}>`,d=`g${Pi(
|
|
2833
|
+
A)}`;return i.push(`<${f} id="${d}" ${u.join(" ")}>${h}</${f}>`),`url(#${d})`}function Q0(e,t,n,r,i){let s=Bi(e,t);if(!s||!(s.w>0)||!(s.h>0)||Bn(e.stops).length<2)return _r(e);let l=['patternUnits="us\
|
|
2834
|
+
erSpaceOnUse"',`x="${r(s.x)}"`,`y="${r(s.y)}"`,`width="${r(s.w)}"`,`height="${r(s.h)}"`];if(e.space==="canvas"&&!zr(n)){let g=ki(n);if(!g)return _r(e);l.push(`patternTransform="${Cs(g,r)}"`)}let u=al(
|
|
2833
2835
|
e,s),h=u.nearest?' image-rendering="optimizeSpeed" style="image-rendering:pixelated"':"",A=`<image${u.x!==0||u.y!==0?` x="${r(u.x)}" y="${r(u.y)}"`:""} width="${r(u.w)}" height="${r(u.h)}" preserveAsp\
|
|
2834
|
-
ectRatio="none"${h} href="${
|
|
2835
|
-
let
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
function
|
|
2840
|
-
|
|
2841
|
-
|
|
2836
|
+
ectRatio="none"${h} href="${Wi(u.texture)}"/>`,d=`<pattern ${l.join(" ")}>${A}</pattern>`,y=`p${Pi(d)}`;return i.push(`<pattern id="${y}" ${l.join(" ")}>${A}</pattern>`),`url(#${y})`}function Lu(e,t,n){
|
|
2837
|
+
let r=t.startsWith("#")?ar(t):void 0;return r?r.a<1?[`${e}="${r.rgb}"`,`${e}-opacity="${n(r.a)}"`]:[`${e}="${t}"`]:[`${e}="${t}"`]}function N0(e,t,n,r,i=!0){let s=[],l=(u,h)=>i?Lu(u,h,r):[`${u}="${h}"`];
|
|
2838
|
+
return e!==void 0&&s.push(...l("fill",e)),t!==void 0&&t!=="none"&&s.push(...l("stroke",t)),n.strokeWidth!==void 0&&t!=="none"&&s.push(`stroke-width="${r(n.strokeWidth)}"`),n.strokeDash&&n.strokeDash.length>
|
|
2839
|
+
0&&s.push(`stroke-dasharray="${n.strokeDash.map(r).join(" ")}"`),n.strokeDashOffset&&s.push(`stroke-dashoffset="${r(n.strokeDashOffset)}"`),n.strokeLinecap&&s.push(`stroke-linecap="${n.strokeLinecap}"`),
|
|
2840
|
+
n.strokeLinejoin&&s.push(`stroke-linejoin="${n.strokeLinejoin}"`),n.opacity!==void 0&&n.opacity!==1&&s.push(`opacity="${r(n.opacity)}"`),s}function Du(e,t,n,r){let i=r*Math.PI/180;return[e+n*Math.cos(
|
|
2841
|
+
i),t+n*Math.sin(i)]}function D0(e,t,n,r,i,s){let l=i-r,[u,h]=Du(e,t,n,r),[f,A]=Du(e,t,n,i),d=Math.abs(l)>180?1:0,y=l>=0?1:0;return`M ${s(u)} ${s(h)} A ${s(n)} ${s(n)} 0 ${d} ${y} ${s(f)} ${s(A)}`}function Fu(e,t,n,r,i=be){
|
|
2842
|
+
let s=yo(t.precision),l=r?" ".repeat(n):"",u=r?`
|
|
2843
|
+
`:"",h=zr(e.transform)?i:me(i,e.transform),f=[],A=Nu(e.style.fill,e,h,s,f),d=Nu(e.style.stroke,e,h,s,f),y=O0(e,t,n,r,h,N0(A,d,e.style,s,e.kind!=="group"));return f.length===0?y:`${l}<g>${u}${l}<defs>${f.
|
|
2844
|
+
join("")}</defs>${u}${y}${l}</g>${u}`}function O0(e,t,n,r,i,s){let l=yo(t.precision),u=r?" ".repeat(n):"",h=r?`
|
|
2842
2845
|
`:"",f=[];switch(zr(e.transform)||f.push(`transform="${Cs(e.transform,l)}"`),t.interactive&&f.push(`data-node="${mo(e.meta.sourceNodeId)}"`,`data-index="${e.meta.index}"`,`data-id="${mo(e.id)}"`),e.kind){case"\
|
|
2843
2846
|
rect":{let A=e.rx>0?[`rx="${l(e.rx)}"`]:[];return`${u}<rect x="${l(e.x)}" y="${l(e.y)}" width="${l(e.w)}" height="${l(e.h)}" ${[...A,...s,...f].join(" ")}/>${h}`}case"circle":return`${u}<circle cx="${l(
|
|
2844
2847
|
e.cx)}" cy="${l(e.cy)}" r="${l(e.r)}" ${[...s,...f].join(" ")}/>${h}`;case"ellipse":return`${u}<ellipse cx="${l(e.cx)}" cy="${l(e.cy)}" rx="${l(e.rx)}" ry="${l(e.ry)}" ${[...s,...f].join(" ")}/>${h}`;case"\
|
|
2845
|
-
arc":return`${u}<path d="${
|
|
2848
|
+
arc":return`${u}<path d="${D0(e.cx,e.cy,e.r,e.a0,e.a1,l)}" ${[...s,...f].join(" ")}/>${h}`;case"polyline":{let A=e.points.map(y=>`${l(y.x)},${l(y.y)}`).join(" "),d=e.closed?"polygon":"polyline";return`${u}\
|
|
2846
2849
|
<${d} points="${A}" ${[...s,...f].join(" ")}/>${h}`}case"path":return`${u}<path d="${e.d}" ${[...s,...f].join(" ")}/>${h}`;case"image":{let A=e.style.opacity,d=['preserveAspectRatio="none"',...A!==void 0&&
|
|
2847
2850
|
A!==1?[`opacity="${l(A)}"`]:[]];return`${u}<image x="${l(e.x)}" y="${l(e.y)}" width="${l(e.w)}" height="${l(e.h)}" ${[...d,...f].join(" ")} href="${e.href}"/>${h}`}case"text":{let A=[`x="${l(e.x)}"`,`\
|
|
2848
2851
|
y="${l(e.y)}"`,`font-family="${mo(e.fontFamily)}"`,`font-size="${l(e.fontSize)}"`,`text-anchor="${e.anchor}"`];return e.fontWeight!==void 0&&e.fontWeight!==400&&A.push(`font-weight="${l(e.fontWeight)}\
|
|
2849
2852
|
"`),e.fontStretch!==void 0&&e.fontStretch!==100&&A.push(`font-stretch="${l(e.fontStretch)}%"`),e.letterSpacing!==0&&A.push(`letter-spacing="${l(e.letterSpacing)}"`),/^ | $| {2}/.test(e.text)&&A.push('\
|
|
2850
|
-
xml:space="preserve"'),`${u}<text ${[...A,...s,...f].join(" ")}>${mo(e.text)}</text>${h}`}case"group":{let A=e.children.map(d=>
|
|
2851
|
-
</g>${h}`}}}function
|
|
2852
|
-
`:"",u=
|
|
2853
|
-
`${n?" ":""}<image x="${s(h)}" y="${s(f)}" width="${s(e.texture.width)}" height="${s(e.texture.height)}" href="${i(e.texture)}"/>${l}`:"",d=e.texture?e.textureAt??0:0,y=x=>
|
|
2854
|
-
0,d).map(y).join("")+A+e.shapes.slice(d).map(y).join("");return`${n?" ":""}<g ${u.join(" ")}>${l}${g}${n?" ":""}</g>${l}`}function
|
|
2855
|
-
opacity!==1&&r.push(["opacity",n(e.opacity)]),r}function
|
|
2856
|
-
`:"",l=yo(n),u=t.textureHref??
|
|
2857
|
-
origin==="center"?-e.height/2:0,y=e.background&&e.background!=="none"?`${i?" ":""}<rect x="${l(A)}" y="${l(d)}" width="${l(e.width)}" height="${l(e.height)}" fill
|
|
2858
|
-
{x:A,y:d,w:e.width,h:e.height};return`<svg xmlns="http:/${"/"}www.w3.org/2000/svg" width="${l(g.w)}" height="${l(g.h)}" viewBox="${l(g.x)} ${l(g.y)} ${l(g.w)} ${l(g.h)}">${s}${f}${y}${h}</svg>${s}`}function
|
|
2853
|
+
xml:space="preserve"'),`${u}<text ${[...A,...s,...f].join(" ")}>${mo(e.text)}</text>${h}`}case"group":{let A=e.children.map(d=>Fu(d,t,n+1,r,i)).join("");return`${u}<g ${[...s,...f].join(" ")}>${h}${A}${u}\
|
|
2854
|
+
</g>${h}`}}}function L0(e,t,n,r,i){if(!e.visible)return"";let s=yo(t.precision),l=n?`
|
|
2855
|
+
`:"",u=F0(e,t.precision).map(([x,v])=>`${x}="${mo(v)}"`),h=e.texture?e.texture.at?.x??(r==="center"?-e.texture.width/2:0):0,f=e.texture?e.texture.at?.y??(r==="center"?-e.texture.height/2:0):0,A=e.texture?
|
|
2856
|
+
`${n?" ":""}<image x="${s(h)}" y="${s(f)}" width="${s(e.texture.width)}" height="${s(e.texture.height)}" href="${i(e.texture)}"/>${l}`:"",d=e.texture?e.textureAt??0:0,y=x=>Fu(x,t,2,n),g=e.shapes.slice(
|
|
2857
|
+
0,d).map(y).join("")+A+e.shapes.slice(d).map(y).join("");return`${n?" ":""}<g ${u.join(" ")}>${l}${g}${n?" ":""}</g>${l}`}function F0(e,t=Ou){let n=yo(t),r=[["id",e.id],["data-layer",e.name]];return e.
|
|
2858
|
+
opacity!==1&&r.push(["opacity",n(e.opacity)]),r}function Yu(e,t={}){let n=t.precision??Ou,r=t.interactive??!1,i=t.pretty??!0,s=i?`
|
|
2859
|
+
`:"",l=yo(n),u=t.textureHref??Wi,h=e.layers.map(x=>L0(x,{precision:n,interactive:r},i,e.origin,u)).join(""),f=t.defs?`${i?" ":""}<defs>${t.defs}</defs>${s}`:"",A=e.origin==="center"?-e.width/2:0,d=e.
|
|
2860
|
+
origin==="center"?-e.height/2:0,y=e.background&&e.background!=="none"?`${i?" ":""}<rect x="${l(A)}" y="${l(d)}" width="${l(e.width)}" height="${l(e.height)}" ${Lu("fill",e.background,l).join(" ")}/>${s}`:
|
|
2861
|
+
"",g=t.crop??{x:A,y:d,w:e.width,h:e.height};return`<svg xmlns="http:/${"/"}www.w3.org/2000/svg" width="${l(g.w)}" height="${l(g.h)}" viewBox="${l(g.x)} ${l(g.y)} ${l(g.w)} ${l(g.h)}">${s}${f}${y}${h}</svg>${s}`}function Y0(e,t){switch(e.kind){case"number":case"percent":{let n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?n:void 0}case"int":{let n=typeof t=="number"?t:Number(t);return Number.isFinite(
|
|
2859
2862
|
n)?Math.round(n):void 0}case"bool":return typeof t=="boolean"?t:t==="true"?!0:t==="false"?!1:void 0;case"color":return typeof t=="string"&&/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(t)?t.toLowerCase():void 0;case"\
|
|
2860
2863
|
text":return typeof t=="string"?t:t==null?void 0:String(t);case"choice":{let n=e.options??[];if(typeof t=="string")return n.some(i=>i.value===t)?t:void 0;let r=typeof t=="number"?t:Number.NaN;return!Number.
|
|
2861
|
-
isFinite(r)||n.length===0?void 0:n[Math.min(n.length-1,Math.max(0,Math.round(r)))].value}}}function
|
|
2864
|
+
isFinite(r)||n.length===0?void 0:n[Math.min(n.length-1,Math.max(0,Math.round(r)))].value}}}function Xu(e,t,n,r){if(!t)return e;let i=e.graph.nodes.findIndex(A=>A.id===t);if(i<0)return e;let s=e.graph.
|
|
2862
2865
|
nodes[i],l={...s.params},u=!1,h=(A,d)=>{if(Z(l[A]).base===d)return;let g=l[A];l[A]=typeof g=="object"&&g!==null&&!Array.isArray(g)&&!("x"in g)?{...g,base:d}:d,u=!0};for(let A of ws(s)){if(!(A.key in n))
|
|
2863
|
-
continue;let d=
|
|
2864
|
-
(s=u.timestamp/1e3,l=null):h==="stopAction"&&s!==null&&l===null&&(l=u.timestamp/1e3)}return{values:i,play:s,stop:l}}var
|
|
2865
|
-
map(s=>[s.file,
|
|
2866
|
+
continue;let d=Y0(A,n[A.key]);d!==void 0&&h(A.key,d)}if(h("stopAt",r),!u)return e;let f=e.graph.nodes.slice();return f[i]={...s,params:l},{...e,graph:{...e.graph,nodes:f}}}function Wu(e,t,n){let r=n*1e3,i=e,s=null,l=null;for(let u of t){if(u.timestamp>r)break;let h=u.action?.type;if(h==="updateAction"){let f=u.action.params?.data;f&&(i={...i,...f})}else h==="playAction"?
|
|
2867
|
+
(s=u.timestamp/1e3,l=null):h==="stopAction"&&s!==null&&l===null&&(l=u.timestamp/1e3)}return{values:i,play:s,stop:l}}var X0=Qu();function W0(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n.buffer}function Gu(e,t){let n=e.assets,r;if(e.outline&&t){let i=new Map(e.fonts.
|
|
2868
|
+
map(s=>[s.file,W0(s.base64)]));r=t.createOutliner(s=>i.get(s.file))}return{embedded:e,project:Zs(e.project).project,cache:new Sa,...n?{asset:i=>n[i]}:{},...r?{outliner:r}:{}}}function G0(e,t,n){if(t.play===
|
|
2866
2869
|
null)return null;let r=Math.max(0,n-t.play);if(e.loop&&e.duration>0&&(r%=e.duration),t.stop===null)return{t:r,opacity:1};let i=n-t.stop;return e.exit==="cut"||i>=e.outro?null:{t:r,opacity:e.exit==="fa\
|
|
2867
|
-
de"?1-i/e.outro:1}}function
|
|
2868
|
-
f.play:-1,y=Ba(
|
|
2870
|
+
de"?1-i/e.outro:1}}function qu(e,t,n,r){let{embedded:i,project:s,cache:l,asset:u,outliner:h}=e,f=Wu(t,n,r),A=G0(i.timing,f,r);if(!A)return null;let d=f.stop!==null&&f.play!==null&&!i.timing.loop?f.stop-
|
|
2871
|
+
f.play:-1,y=Ba(Xu(s,i.controlNode,f.values,d),X0,{t:A.t,cache:l,asset:u,outliner:h}),g=Iu(y.scene,h);return{svg:Yu(i.transparent?{...g,background:"none"}:g,{precision:i.precision}),opacity:A.opacity}}return vc(q0);})();
|