0x85582125…5972sent to0x96a83b48…d253·#22,595,611·view on Etherscan
this.kTree.pointsWithinDistanceGenerator(e,this.maxDist+g))if(t.point.distanceTo(e.point)+this.epsilon<Math.max(t.minDist,e.minDist))return!1;return!0}placePoint(e){this.kTree.insert(e)}}const bi=function(e,t,n){const l=1/t,i=1/n;return Math.min(4,((3-l)*l**2*e+i**3)/(l**3*e+(3-i)*i**2))},gi=(e,t,n,l,i)=>Math.min(4,(2+Math.sqrt(2)*(e-n/16)*(n-e/16)*(t-l))/(1.5*i*(2+(Math.sqrt(5)-1)*t+(3-Math.sqrt(5))*l))),fi=(e,t)=>{const n=Math.sin(e.theta),l=Math.cos(e.theta),i=Math.sin(t.phi),a=Math.cos(t.phi),s=t.leftY,o=e.rightY,r=gi(n,l,i,a,s),c=gi(i,a,n,l,o);e.rightX=e.x+(e.deltaX*l-e.deltaY*n)*r,e.rightY=e.y+(e.deltaY*l+e.deltaX*n)*r,t.leftX=t.x-(e.deltaX*a+e.deltaY*i)*c,t.leftY=t.y-(e.deltaY*a-e.deltaX*i)*c},xi=(e,{tension:t=1,cyclic:n=!1}={})=>{const l=((e,t=1,n=!1)=>{const l=e.map((({x:e,y:n})=>((e,t,n)=>({x:e,y:t,leftY:n,rightY:n,leftX:n,rightX:n,deltaX:0,deltaY:0,delta:0,theta:0,phi:0,psi:0}))(e,n,t))),i=l[0],a=l[l.length-1];for(let e=0;e<l.length;e++)l[e].next=l[e+1]??i,l[e].prev=l[e-1]??a;if(((e,t)=>{const n=t?e.length:e.length-1;for(let t=0;t<n;t++){const n=e[t],l=e[t+1]??e[0];n.deltaX=l.x-n.x,n.deltaY=l.y-n.y,n.delta=Math.hypot(n.deltaX,n.deltaY)}})(l,n),2===e.length&&!n)return((e,t)=>{let n=1/(3*e.rightY);e.rightX=e.x+e.deltaX*n,e.rightY=e.y+e.deltaY*n,n=1/(3*t.leftY),t.leftX=t.x-e.deltaX*n,t.leftY=t.y-e.deltaY*n})(i,a),l;((e,t)=>{const[n,l]=t?[0,e.length]:[1,e.length-1];for(let t=n;t<l;t++){const n=e[t],l=n.prev,i=l.deltaY/l.delta,a=l.deltaX/l.delta;n.psi=Math.atan2(n.deltaY*a-n.deltaX*i,n.deltaX*a+n.deltaY*i)}})(l,n),function(e,t){const n=[],l=[],i=[],a=e[0],s=e[1],o=e[e.length-1],r=t?e.length+1:e.length;if(t)n[0]=0,i[0]=0,l[0]=1;else{const e=a.next,t=a.rightX,o=Math.abs(e.leftY),r=Math.abs(a.rightY);n[0]=bi(t,r,o),i[0]=-s.psi*n[0],l[0]=0}for(let s=1;s<r;s++){const c=e[s]??a,d=c.next,u=c.prev,h=s===r-1;if(!t&&h){const e=c.leftX,t=Math.abs(c.leftY),l=Math.abs(u.rightY),a=bi(e,t,l);o.theta=-i[r-2]*a/(1-a*n[r-2]);break}{let e=1/(3*Math.abs(u.rightY)-1),o=c.delta*(3-1/Math.abs(u.rightY)),m=1/(3*Math.abs(d.leftY)-1),p=u.delta*(3-1/Math.abs(d.leftY));const b=1-n[s-1]*e;o*=b;const g=Math.abs(c.leftY),f=Math.abs(c.rightY);g<f?o*=(g/f)**2:p*=(f/g)**2;let x=p/(p+o);n[s]=x*m;let Z=-d.psi*n[s];if(x=(1-x)/b,Z-=c.psi*x,x*=e,i[s]=Z-i[s-1]*x,l[s]=-l[s-1]*x,t&&h){let e=0,t=1;for(let a=s-1;a>=0;a--){const s=0===a?r-1:a;e=i[s]-e*n[s],t=l[s]-t*n[s]}e/=1-t,a.theta=e,i[0]=e;for(let t=1;t<r-1;t++)i[t]=i[t]+e*l[t];break}}}for(let t=r-2;t>=0;t-=1)e[t].theta=i[t]-e[t].next.theta*n[t]}(l,n),(e=>{for(let t=0;t<e.length;t++){const n=e[t];n.phi=-n.psi-n.theta}})(l);const s=n?l.length:l.length-1;for(let e=0;e<s;e++)fi(l[e],l[e].next);return l})(e,t,n),i=[],a=n?l.length:l.length-1;for(let e=0;e<a;e++){const t=l[e];i.push({startControl:{x:t.rightX,y:t.rightY},endControl:{x:t.next.leftX,y:t.next.leftY},point:{x:t.next.x,y:t.next.y}})}return i};function Zi(e,t,n=!1,l=.01){const i=[],a=e.length;if(a<2)return i;const s=n?a:a-1;let o=null;for(let n=1;n<=s;n++){const s=n%a,r=e[(n-1)%a].point,c=e[s].startControl,d=e[s].endControl,u=e[s].point;let h=0;for(;h<=1;){const e=1-h,n={x:e**3*r.x+3*e**2*h*c.x+3*e*h**2*d.x+h**3*u.x,y:e**3*r.y+3*e**2*h*c.y+3*e*h**2*d.y+h**3*u.y};if(o){const e=n.x-o.x,l=n.y-o.y;e*e+l*l>=t*t&&(i.push(n),o=n)}else i.push(n),o=n;h+=l}const m={x:u.x,y:u.y};!o||o.x===m.x&&o.y===m.y||(i.push(m),o=m)}if(!n){const t=e[a-1].point,n=i[i.length-1];n.x===t.x&&n.y===t.y||i.push(t)}return i}let yi,Gi,Wi,vi,Li,Si=[],Xi=[],Ci=[],Vi=[],Ki=new class{cells=new Map;polygons=new Map;polygonMeta=new Map;nextPolygonId=0;cellSize;constructor(e,t){this.cellSize=e,t&&this.addPolygons(t)}getCellIndex(e,t){return`${f(e)},${f(t)}`}clear(){this.cells.clear(),this.polygons.clear(),this.polygonMeta.clear()}getCellTestVertices(e,t){let{cellSize:n}=this;return[new Ut(e*n,t*n),new Ut((e+1)*n,t*n),new Ut((e+1)*n,(t+1)*n),new Ut(e*n,(t+1)*n)]}addPolygons(e){e.forEach((e=>this.addPolygon(e.verts,e.meta)))}getPolygonsAtPoint(e){let{cellSize:t}=this,n=f(e[0]/t),l=f(e[1]/t);const i=this.getCellIndex(n,l);let a=new Set;return this.cells.has(i)&&Array.from(this.cells.get(i)).map((t=>{In(this.polygons.get(t).map((e=>(new Ut).fromArray(e))),new Ut(e[0],e[1]))&&a.add(t)})),Array.from(a).map((e=>({verts:this.polygons.get(e),meta:this.polygonMeta.get(e)})))}addPolygon(e,t){let{cellSize:n}=this;const l=this.nextPolygonId++;this.polygons.set(l,e),this.polygonMeta.set(l,t);let i=e.map((e=>(new Ut).fromArray(e))),a=new dn;a.expands(i);const s=f(a.minX/n),o=x(a.maxX/n)-1,r=f(a.minY/n),c=x(a.maxY/n)-1;for(let e=s;e<=o;e++)for(let t=r;t<=c;t++){const n=this.getCellIndex(e,t),a=this.getCellTestVertices(e,t);if(a.some((e=>In(i,e))))this.cells.has(n)||this.cells.set(n,new Set),this.cells.get(n).add(l);else for(let e=0;e<a.length;e++)if(Qn([a[e],a[(e+1)%a.length]],i)){this.cells.has(n)||this.cells.set(n,new Set),this.cells.get(n).add(l);break}}return l}checkIntersections(e){let{cellSize:t}=this,n=e.map((e=>(new Ut).fromArray(e))),l=new dn;l.expands(n);const i=f(l.minX/t),a=x(l.maxX/t)-1,s=f(l.minY/t),o=x(l.maxY/t)-1;let r=new Set;for(let e=i;e<=a;e++)for(let t=s;t<=o;t++){const l=this.getCellIndex(e,t),i=this.getCellTestVertices(e,t);this.cells.has(l)&&this.cells.get(l).forEach((e=>{if(i.some((e=>In(n,e))))r.add(e);else for(let t=0;t<i.length;t++)if(Qn([i[t],i[(t+1)%i.length]],n)){r.add(e);break}}))}return Array.from(r).map((e=>({verts:this.polygons.get(e),meta:this.polygonMeta.get(e)})))}getAllPolygons(){return Array.from(this.polygons).map((([e,t])=>({verts:t,meta:this.polygonMeta.get(e)})))}}(10),wi=[],ki=[[function*(){Zn()}],[function*(){ml=et.curveMap;let e=Re.bg[0][0]>=.5,t=e?1:1.0012,n=e?1:1.001;cl=cl.length?cl:he.filter((e=>e!==Re)).map((e=>[...e.accent,...e.base,...e.line])).flat().map((e=>(e[0]*=n,e[1]*=t,e))),[...Re.accent,...Re.base,...Re.line].forEach((e=>{e[0]*=n,e[1]*=t}));let l=[...Re.accent,...Re.base,...Re.line];ol=l,rl=[...Re.base].sort(((e,t)=>t[0]-e[0])),ol=[...ol].sort(((e,t)=>t[2]-e[2])),nl([...ol]),nl([...rl])}],[function*(){let t=K?e.LinearFilter:e.NearestFilter,n={anisotropy:V,colorSpace:e.LinearDisplayP3ColorSpace,minFilter:t,magFilter:t,type:e.FloatType};Ft=new Pt(Q,j,{stencilBuffer:!1,depthBuffer:!1}),Ht={paperTexture:{target:new e.WebGLRenderTarget(Q,j,{...n,format:e.RedFormat,internalFormat:"R32F"}),pass:()=>{let t=new e.ShaderMaterial({uniforms:{resolution:{value:new e.Vector2(Q,j)},noiseOffset:{value:new e.Vector2(ke[0],ke[1])},...ce()},colorWrite:!0,depthWrite:!1,depthTest:!1,glslVersion:e.GLSL3,vertexShader:le,fragmentShader:`\n precision highp float;\n precision highp int;\n \n uniform highp sampler2D tTex;\n uniform vec2 resolution;\n uniform vec2 uTileOffset;\n uniform vec2 uTileSize;\n uniform vec3 backgroundColor;\n uniform vec3 lineColor;\n uniform vec2 noiseOffset;\n\n ${ee}\n ${te}\n\n varying vec2 vUv;\n out vec4 outColor;\n\n #include <packing>\n\n ${ne}\n\n vec4 render(vec2 uv) {\n\n float noiseTex1 = fbm(uv - noiseOffset, 5, 300., 0.9) - 0.5;\n float noiseTex2 = fbm(uv - noiseOffset, 3, 400., 0.9) - 0.5;\n float texCombined = step(0.001, -(noiseTex1 * noiseTex2)) * .05;\n\n float noiseTexDark1 = fbm(uv + noiseOffset + 1., 5, 280., 0.9) - 0.5;\n float noiseTexDark2 = fbm(uv + noiseOffset + 1., 3, 300., 0.9) - 0.5;\n float texDarkCombined = step(0.0001, -(noiseTexDark1 * noiseTexDark2)) * .05;\n\n float smoothNoise1 = smoothstep(0., 0.6, fbm(uv, 3, 420., 0.9)) * 0.03;\n\n // vec3 lchColor = vec3(0., 0.5, 0.5);\n float result;\n result += texCombined;\n result -= texDarkCombined;\n result += smoothNoise1;\n \n // vec3 colorRGB = OKLCHtoP3LRGB(lchColor);\n // float canvasTexture = fbm(uv, 6, 120., 0.7);\n return vec4(vec3(result), 1.);\n }\n\n \n\n void main() {\n // A pseudo-random distribution for multi-sample\n const vec2 H2 = vec2(0.56984029, 0.75487766);\n // We do sub-pixel offsets relative to tile size, \n // because each tile is scaled to fill the entire local canvas\n vec2 px = 1.0 / resolution.xy;\n px *= 1.25;\n\n // We'll accumulate color across multiple samples\n const float samples = 6.0;\n vec4 sumColour = vec4(0.0);\n \n // Vary the random offset per pixel\n vec2 d0 = vec2(randomNonDet(vUv), randomNonDet(vUv + 1.0));\n\n for (float i = 0.0; i < samples; i++) {\n vec2 d = fract(i * H2 + d0) - 0.5;\n // localCoord in [0..1] in the local canvas\n vec2 sampleCoord = vUv + d * px;\n\n // Now map that to the large “full” coordinate space \n // subregion given by uTileOffset..uTileOffset+uTileSize\n vec2 screenCoord = uTileOffset + sampleCoord * uTileSize;\n\n // Next convert to [0..1] over the entire original geometry\n vec2 globalUV = screenCoord / resolution;\n\n vec4 sampleColor = render(globalUV);\n sumColour += sampleColor;\n }\n\n vec4 finalColor = clamp(sumColour / samples, 0.0, 1.0);\n outColor = finalColor;\n }\n `});re(t),It.material=t,X.setRenderTarget(Ht.paperTexture.target),It.render(X)}},displacementMap:{target:new e.WebGLRenderTarget(Q,j,{...n,format:e.RGFormat,internalFormat:"RG32F"}),pass:()=>{let e=Kt();re(e),It.material=e,X.setRenderTarget(Ht.displacementMap.target),It.render(X)}},displacementMapWarped:{target:new e.WebGLRenderTarget(Q,j,{...n,format:e.RGFormat,internalFormat:"RG32F"}),pass:()=>{let e=Kt();re(e),e.uniforms.uWarpEnabled.value=!0,It.material=e,X.setRenderTarget(Ht.displacementMapWarped.target),It.render(X)}},polyEdgeDistance:{target:new e.WebGLRenderTarget(Q,j,{...n,format:e.RedFormat,internalFormat:"R32F"}),skipSetup:!0}};let l=function*(){for(let e of Object.keys(Ht)){const t=Ht[e];t.skipSetup||t.pass&&t.pass()}return X.shadowMap.enabled=!0,void X.setRenderTarget(null)}();for(;!l.next().done;)yield}],[function*(){let e=Rt();It.material=e;for(let t of Object.keys(Ht)){if(!Ht[t].debug)continue;let n=Ht[t].target.texture;e.uniforms.tTex.value=n,X.setRenderTarget(null),It.render(X),ia(),yield}}],[function*(){let t=(n=Ht.paperTexture.target.texture,new e.ShaderMaterial({uniforms:{grid:{value:{...Be}},...ce(),tWarpTex:{value:Ht.displacementMap.target.texture},resolution:{value:new e.Vector2(Q,j)},coordsResolution:{value:new e.Vector2(Y,P)},noiseOffset:{value:new e.Vector2(0,0)},tPaperTexture:{value:n},backgroundColor:{value:new e.Vector3(0,0,0)},lineColor:{value:new e.Vector3(0,0,0)},uGridStrength:{value:.3}},colorWrite:!0,depthWrite:!1,depthTest:!1,glslVersion:e.GLSL3,vertexShader:le,fragmentShader:`\n precision highp float;\n\t\t\tprecision highp int;\n \n // uniform highp sampler2D tTex;\n uniform vec2 resolution;\n uniform vec2 uTileOffset;\n uniform vec2 uTileSize;\n uniform vec2 coordsResolution;\n uniform vec3 backgroundColor;\n uniform vec3 lineColor;\n uniform vec2 noiseOffset;\n uniform float uGridStrength;\n uniform highp sampler2D tPaperTexture;\n uniform highp sampler2D tWarpTex;\n\n struct Grid {\n float countX;\n float countY;\n float marginX;\n float marginY;\n float w;\n float h;\n float scale;\n };\n uniform Grid grid;\n\n ${ee}\n ${Et}\n ${te}\n \n float drawGridLines(vec2 uv, float lineWeight, float gridScale) {\n vec2 scale = resolution / coordsResolution;\n // This should be the desired line width in pixels\n float lineWeightNoise = snoise2D(uv * 200.f) * .09f;\n float gridLineWeight = (lineWeight + lineWeightNoise) * scale.y; // Width of the grid lines in pixels\n\n vec2 offset = vec2(grid.marginX, grid.marginY) * scale; // Applying scale to margins\n\n // Compute UVs for grid lines based on actual screen resolution and grid scaling\n vec2 gridUV = (uv * resolution - offset);\n\n // Convert grid dimensions from whatever space they are in to pixel space directly\n float gridWidthInPixelsX = grid.w * (resolution.x / coordsResolution.x) * 1.;\n float gridWidthInPixelsY = grid.h * (resolution.y / coordsResolution.y) * 1.;\n\n // Calculate the distance to the nearest grid line in pixels\n float lineDistX = min(mod(gridUV.x, gridWidthInPixelsX / gridScale), gridWidthInPixelsX - mod(gridUV.x, gridWidthInPixelsX / gridScale));\n float lineDistY = min(mod(gridUV.y, gridWidthInPixelsY / gridScale), gridWidthInPixelsY - mod(gridUV.y, gridWidthInPixelsY / gridScale));\n float lineDist = min(lineDistX, lineDistY);\n\n // Use smoothstep to create anti-aliased lines with a specified pixel width\n float lineFactor = 1.0 - smoothstep(gridLineWeight - 0.1, gridLineWeight + 0.1, lineDist);\n\n return lineFactor;\n }\n\n float drawGridBlocks(vec2 uv, float gridScale ) {\n vec2 scale = resolution / coordsResolution;\n vec2 offset = vec2(grid.marginX, grid.marginY) * scale; // Applying scale to margins\n vec2 gridUV = (uv * resolution - offset); // Apply resolution scaling to UV, then subtract offset\n\n float tileX = floor(gridUV.x / (grid.w * scale.x));\n float tileY = floor(gridUV.y / (grid.h * scale.y));\n\n vec2 centerUV = (vec2(tileX, tileY)) * vec2(grid.w, grid.h) / resolution;\n\n float noiseValue = clamp(fbm(centerUV, 3, 300., 0.5) + .5, 0.0, 1.); // Adjust for correct scaling if necessary\n\n return noiseValue;\n\n // float checker = mod(tileX + tileY, 2.0);\n \n // return checker == 0.0;\n }\n\n ${Ct}\n\n varying vec2 vUv;\n out vec4 outColor;\n\n #include <packing>\n\n ${ne}\n ${At}\n\n vec4 render(vec2 uv, vec2 texUv, vec2 msaaOffset) {\n\n // vec2 uvOffset = lookupWarpSample(uv).xy;\n\n // vec2 offsetUV = uv + uvOffset;\n vec2 offsetUV = uv;\n\n float gridNoise = fbm(uv, 3, 10., 0.9);\n float gridNoise2 = fbm(uv + 2., 3, 600., 0.9);\n\n float tileScaleFactor = resolution.x / uTileSize.x;\n\n // float gridFactor = clamp(0., .12, drawGridLines(uv, 38.));\n float aspectRatio = resolution.x / resolution.y;\n vec2 uvNormalised = offsetUV * vec2(aspectRatio, 1.);\n\n const float gridDarkness = 0.3;\n\n float gridDivisor = 1.;\n float edgeFactor = smoothstep(0.2f, 1.f, screenEdgeDist(uvNormalised, 0.22 - (gridNoise * .06)));\n \n float gridFactor = clamp(0., gridDarkness, drawGridLines(offsetUV, .3 , 5.) * edgeFactor);\n float gridFactor2 = clamp(0., gridDarkness + 0.025, drawGridLines(offsetUV, .5 , 1.) * edgeFactor);\n \n vec3 lineCol = lineColor;\n \n lineCol.x += (step(0.6, gridNoise - gridNoise2) * 0.4);\n \n float gridTextureNoise = fbm(uv + noiseOffset, 6, 700., 0.7) * 0.5;\n vec3 lchColor = mix(backgroundColor, lineCol, clamp((gridFactor2 - gridTextureNoise) * uGridStrength, 0., 1.));\n \n float smoothNoise1 = texture(tPaperTexture, texUv + msaaOffset).x * 0.8;\n\n float colourNoise = fbm(uv + noiseOffset, 12, 5., 0.7) * 0.001;\n float colourNoise2 = fbm(uv - noiseOffset + 1., 12, 3., 0.7) * 0.001;\n\n lchColor.x += smoothNoise1 - colourNoise + colourNoise2;\n\n float edgeFactorVignette = smoothstep(0.2f, 1.f, screenEdgeDist(uvNormalised, 0.5));\n lchColor.x -= (1. - edgeFactorVignette) * 0.005;\n lchColor.y += (1. - edgeFactorVignette) * 0.005;\n // lchColor.y *= colourNoise;\n \n\n // lchColor = vec3(lchColor.x, lchColor.y, lchColor.z);\n\n vec3 colorRGB = OKLCHtoP3LRGB(lchColor);\n\n vec3 lightDir = normalize(vec3(.6f, 1.6f, 1.6f));\n vec3 lightColor = vec3(1.0f) * 1.7f;\n\n vec3 paperTextureNormals = calculateNormals(texUv + msaaOffset, 0.0002 * tileScaleFactor, 2.);\n vec3 diffuse = calculateDiffuse(paperTextureNormals, lightDir, lightColor);\n\n colorRGB *= diffuse;\n \n // float canvasTexture = fbm(uv, 6, 120., 0.7);\n return vec4(colorRGB, 1.);\n }\n\n \n\n void main() {\n // A pseudo-random distribution for multi-sample\n const vec2 H2 = vec2(0.56984029, 0.75487766);\n // We do sub-pixel offsets relative to tile size, \n // because each tile is scaled to fill the entire local canvas\n vec2 px = 1.0 / resolution.xy;\n px *= 1.25;\n\n // We'll accumulate color across multiple samples\n const float samples = 16.0;\n vec4 sumColour = vec4(0.0);\n \n // Vary the random offset per pixel\n vec2 d0 = vec2(randomNonDet(vUv), randomNonDet(vUv + 1.0));\n\n for (float i = 0.0; i < samples; i++) {\n vec2 d = fract(i * H2 + d0) - 0.5;\n // localCoord in [0..1] in the local canvas\n vec2 sampleCoord = vUv + d * px;\n\n // Now map that to the large “full” coordinate space \n // subregion given by uTileOffset..uTileOffset+uTileSize\n vec2 screenCoord = uTileOffset + sampleCoord * uTileSize;\n\n // Next convert to [0..1] over the entire original geometry\n vec2 globalUV = screenCoord / resolution;\n\n vec4 sampleColor = render(globalUV, vUv, d * px);\n sumColour += sampleColor;\n }\n\n vec4 finalColor = clamp(sumColour / samples, 0.0, 1.0);\n outColor = finalColor;\n }\n `}));var n;It.material=t,re(t);let l=Qt(J.choice(Re.bg)),i=Qt(J.choice(Re.line));t.uniforms.backgroundColor.value=(new e.Vector3).fromArray(l),t.uniforms.lineColor.value=(new e.Vector3).fromArray(i),t.uniforms.noiseOffset.value=new e.Vector2(ke[0],ke[1]),t.uniforms.uGridStrength.value=.2,X.setRenderTarget(Ft.getWriteBuffer()),It.render(X),Ft.copyAndSwapBuffers(),Ft.copyBufferToScreen()}],[function*(){let e=Ae.margin+Be.marginX,n=Ae.margin+Be.marginY,l=new Ut(e,n),i=new Ut(Y-e,P-n);(function(e,t,n=0){let l=[],i=[],a=J.weightedChoice([0,J.easedNum(Le,Ae.HVariance.min,Ae.HVariance.max)]),s=J.weightedChoice([0,J.easedNum(Le,Ae.VVariance.min,Ae.VVariance.max)]);for(let i=e.y;i<t.y;i+=Be.scale/2)J.gaussianBool(Ae.HVariance.threshold,Ae.HVariance.mean,Ae.HVariance.stdDev)||l.push({id:Jn(),meta:{lineCategory:Se.horizontal},line:[[e.x-Be.scale*n,i+J.num(-Be.scale*a,Be.scale*a)],[t.x+Be.scale*n,i+J.num(-Be.scale*a,Be.scale*a)]]});for(let l=e.x;l<t.x;l+=Be.scale/2)J.gaussianBool(Ae.VVariance.threshold,Ae.VVariance.mean,Ae.VVariance.stdDev)||i.push({id:Jn(),meta:{lineCategory:Se.vertical},line:[[l+J.num(-Be.scale*s,Be.scale*s),e.y-Be.scale*n],[l+J.num(-Be.scale*s,Be.scale*s),t.y+Be.scale*n]]});Xi.push(...l,...i)})(l,i),vi=function(e,t){let n;if(!Ae.perspectiveBox.enabled)return;let l=[e,new Ut(t.x,e.y),t,new Ut(e.x,t.y)].map((e=>e.toArray())),i=new kn(l,[[0,1],[1,2],[2,3],[3,0]]);for(let e=0;e<Ae.perspectiveBox.count;e++){let e,t=i.internalFaces(),n=J.choice(t),l=n.aabb,a=J.bool(50),s=o(l.height,l.width)/4;if(a){let t=J.num(l.minX+s,l.maxX-s);e=[[t,l.minY],[t,l.maxY]]}else{let t=J.num(l.minY+s,l.maxY-s);e=[[l.minX,t],[l.maxX,t]]}i.splitFaceByPolyLine(n,e)}let a=i.internalFaces(),s=!1,r=!1,c=!1,d=Ae.perspectiveBox.firstFull;for(let e of a){if(-1==Ae.perspectiveBox.count)break;let t=e.aabb,l=t.width*J.num(.75,1.25),i=t.height*J.num(.75,1.25),a=!(!d||c)||J.bool(s?0:50),o=!(!d||c)||J.bool(r?0:50);a&&(r=!0),o&&(s=!0);let u=[a?Y/2:t.center.x,o?P/2:t.center.y];c||(n=u),c=!0,Ee[Se.perspective]>1&&Xi.push(...An({gStdDev:Ae.perspectiveBox.threshold,gMean:Ae.perspectiveBox.mean,gThreshold:Ae.perspectiveBox.stdDev,boxCenter:u,perspectiveCenter:[t.center.x+J.int(-l/4,l/4),t.center.y+J.int(-i/4,i/4)],width:a?4*Y:l*J.num(.75,1.25),height:o?P:i*J.num(.75,1.25),centerBoxMaskDimensions:[J.int(1,l/Be.scale*.5),J.int(1,i/Be.scale*.5)]}).map((e=>({id:Jn(),line:e,meta:{lineCategory:Se.perspective}}))))}return n}(l,i),function(){for(let e=0;e<Ae.circles.count;e++){let e=xe(J.num(Be.scale*Ae.circles.minRadius,Be.scale*Ae.circles.maxRadius),Be.scale),t=e/2,n=[Y/2+J.num(-Y/2+t,Y/2-t),P/2+J.num(-P/2+t,P/2-t)],l=J.num(0,360),i=_n({center:n,radius:e,startAngle:l,endAngle:l+J.int(25,360)});i.length>3&&Xi.push({id:Jn(),line:i,meta:{lineCategory:Se.circle}})}}(),function(){if(!Ae.rects.spiralRectsEnabled)return;let e=Ot(new Ut(J.num(.4*Y,.6*Y),J.num(.4*P,.6*P))).toArray(),t=J.num(0,22.5)*J.choice([-1,1]),n=Be.scale*J.int(5,10),l=J.num(0,360),i=Be.scale*(2*J.int(1,8));for(;n<P;){let a=En({width:n,height:n,center:e,angle:l});Xi.push({id:Jn(),line:a,meta:{lineCategory:Se.rects,isClosed:!0}}),n+=i,l+=t}}(),function(){if(!Ae.rects.insetRectEnabled)return;let e=2*Ae.margin+Be.scale*(2*J.int(1,4)),t=Ot(new Ut(J.num(Y/2,Y/2),J.num(P/2,P/2))).toArray(),n=En({width:Y-e,height:P-e,center:t,angle:J.num(-1,1)});Xi.push({id:Jn(),line:n,meta:{lineCategory:Se.borderRect,isClosed:!0}})}();let a=function(){let e=J.num(Ae.wobble.warpFreq.min,Ae.wobble.warpFreq.max),t=[];for(let n=0;n<Ae.wobble.layers;n++){let l=me(180/Ae.wobble.layers*n);for(let n=0;n<Ae.wobble.multiLayers;n++){let i=n*Ae.wobble.offsetMultiplier,a={warpStrength:e,rotationAngleAddition:l,wobbleOffset:i};zl.push(a);let s=new dn;s.expands([new Ut(-Y/4,-P/4),new Ut(Y+Y/4,P+P/4)]);let o=s.vertexList.map((e=>e.toArray())),r=xe(Be.scale/Ae.wobble.gridDivisions,.1),c=Ml({streamlineWorkerProps:{vectorFieldType:"bnnoise",addOutline:!1,vectorFieldNoiseProps:{warpStrength:xe(e,.01),rotationAngleAddition:xe(l+J.num(-.1,.1),.01),wobbleOffset:i,wobbleDetail:J.int(0,1)},postProcessingArgs:{directional:!1,wobbleFreq:.5,wobbleAmplitude:.5},maxStreamlines:Ae.wobble.count,minLength:xe(Be.scale*Ae.wobble.minLength,.1),maxLength:xe(3*P,.1),stepSize:r/4,minDistance:r,bounds:{topLeft:o[0],bottomRight:o[2]},boundingGeometry:o},noiseSeed:xn,randomSeed:q(J)});t.push(c)}}return t}(),s=new Map,r=0,c="◴ ◷ ◶ ◵".split(" "),d=Array(a.length);for(let e=0;e<a.length;e++){let t=a[e];s.set(r,!1);let n=r;t.then((t=>{d[e]=t,s.set(n,!0)})),r++}for(;;){let e=[...s.values()].reduce(((e,t)=>e+(t?0:1)),0);if(yield{showUpdate:e>0,message:""+c[t(oi/4)%4],isPercent:!1,value:`${e>0?"Pausing for":"Waiting for"} ${e} tasks`},0==e)break}for(let e=0;e<d.length;e++){let t=d[e];if(Ee[Se.wobbles]>0)for(let n of t)Xi.push({line:n,id:Jn(),meta:{lineCategory:Se.wobbles,lineSubCategory:e}})}}],[function*(){let e=Ae.margin+Be.marginX,t=Ae.margin+Be.marginY,n=new ie(e,t),l=new ie(Y-e,P-t);Wi=new el(Be.scale/2,Xi),Li=[n,new Ut(l.x,n.y),l,new Ut(n.x,l.y)].map((e=>e.toArray())),yi=new kn(Li,[[0,1],[1,2],[2,3],[3,0]])}],[function*(){let{maxWidth:e,widthRange:t,spread:n,maxDivergence:l,tens