@occluze/umber 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +126 -50
- package/THIRD-PARTY-NOTICES.md +33 -0
- package/dist/chunks/badge.js +2 -0
- package/dist/chunks/basis.js +2 -0
- package/dist/chunks/basis_transcoder.js +2 -0
- package/dist/chunks/basis_transcoder.wasm +0 -0
- package/dist/chunks/batches.js +2 -0
- package/dist/chunks/capture.js +2 -2
- package/dist/chunks/covers.js +2 -2
- package/dist/chunks/curves.js +2 -0
- package/dist/chunks/flip.js +2 -2
- package/dist/chunks/fx.js +2 -102
- package/dist/chunks/gl.js +2 -180
- package/dist/chunks/glsl.js +2 -239
- package/dist/chunks/glyphs.js +2 -0
- package/dist/chunks/inspect.js +2 -6
- package/dist/chunks/instances.js +2 -93
- package/dist/chunks/layers.js +2 -21
- package/dist/chunks/licence.js +2 -2
- package/dist/chunks/morph.js +2 -2
- package/dist/chunks/pace.js +2 -0
- package/dist/chunks/patch.js +2 -0
- package/dist/chunks/prepared.js +2 -0
- package/dist/chunks/profiler.js +2 -0
- package/dist/chunks/recheck.js +2 -0
- package/dist/chunks/resize.js +2 -0
- package/dist/chunks/restore.js +2 -2
- package/dist/chunks/shapes.js +2 -2
- package/dist/chunks/sim.js +2 -22
- package/dist/chunks/text.js +2 -52
- package/dist/chunks/video.js +2 -2
- package/dist/chunks/vocabulary.js +2 -0
- package/dist/chunks/warm.js +2 -2
- package/dist/modules/debug.js +2 -36
- package/dist/modules/debug.mjs +2 -36
- package/dist/modules/handoff.js +2 -2
- package/dist/modules/handoff.mjs +2 -2
- package/dist/modules/input.js +2 -2
- package/dist/modules/input.mjs +2 -2
- package/dist/modules/scrollfx.js +2 -0
- package/dist/modules/scrollfx.mjs +2 -0
- package/dist/modules/scrub.js +2 -8
- package/dist/modules/scrub.mjs +2 -8
- package/dist/modules/three.js +2 -0
- package/dist/modules/three.mjs +2 -0
- package/dist/node/assets.mjs +11 -0
- package/dist/node/astro.mjs +55 -0
- package/dist/node/cli.mjs +162 -0
- package/dist/node/shared-P6KINBNR.mjs +2113 -0
- package/dist/node/shared-VQKZUUXF.mjs +289 -0
- package/dist/node/vite.mjs +14 -0
- package/dist/prepared.mjs +2 -0
- package/dist/umber.css +2 -2
- package/dist/umber.js +2 -2
- package/dist/umber.mjs +2 -2
- package/docs/AI-quick.md +104 -86
- package/docs/AI.md +2299 -1692
- package/docs/npm.md +40 -32
- package/package.json +176 -24
- package/types/assets.d.ts +192 -0
- package/types/astro.d.ts +40 -0
- package/types/debug.d.ts +18 -17
- package/types/esm.d.ts +13 -17
- package/types/global.d.ts +17 -0
- package/types/handoff.d.ts +26 -25
- package/types/input.d.ts +63 -55
- package/types/loop.d.ts +87 -0
- package/types/module.d.ts +106 -0
- package/types/scrollfx.d.ts +44 -0
- package/types/scrub.d.ts +33 -32
- package/types/three.d.ts +251 -0
- package/types/umber.d.ts +705 -432
- package/types/vite.d.ts +33 -0
- package/dist/chunks/views.js +0 -2
- package/dist/modules/router-swap.js +0 -13
- package/dist/modules/router.js +0 -2
- package/dist/modules/router.mjs +0 -2
- package/dist/modules/scroll.js +0 -2
- package/dist/modules/scroll.mjs +0 -2
- package/types/router.d.ts +0 -181
- package/types/scroll.d.ts +0 -132
package/dist/chunks/layers.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
/*! Umber v0.
|
|
2
|
-
var F={info(){},warn:(a,...e)=>console.warn("[umber]",a,...e),once:(a,...e)=>console.warn("[umber]",a,...e),error:(a,...e)=>console.error("[umber]",a,...e)},m=F;function I(a){a&&(m=a)}function C(a){if(!a||typeof a.tagName!="string")return"<?>";let e=a.tagName.toLowerCase();if(a.id)return`<${e}#${a.id}>`;let r=typeof a.className=="string"?a.className.trim().split(/\s+/)[0]:"";return r?`<${e}.${r}>`:`<${e}>`}var D="uniformMatrix2fv,uniformMatrix3fv,uniformMatrix4fv,,,,,,,,,uniformMatrix2x3fv,uniformMatrix2x4fv,uniformMatrix3x2fv,uniformMatrix3x4fv,uniformMatrix4x2fv,uniformMatrix4x3fv".split(","),L=class{constructor(e,r,t,i="program"){this.gl=e;this.vertex=r;this.fragment=t;this.label=i;this.uniforms=new Map;this.samplers=[];this.state="pending";this.error=null;this.shaders=[];this.Ka=globalThis.occluzeCapture?.version==1?null:e.getExtension("KHR_parallel_shader_compile");let s=N(e,e.VERTEX_SHADER,r),n=N(e,e.FRAGMENT_SHADER,t),o=e.createProgram();e.attachShader(o,s),e.attachShader(o,n),e.bindAttribLocation(o,0,"aPosition"),e.linkProgram(o),this.program=o,this.shaders=[s,n],this.Ka||this.finalize()}ready(){return this.state!=="pending"?this.state==="ok":this.Ka&&!this.gl.getProgramParameter(this.program,this.Ka.COMPLETION_STATUS_KHR)?!1:(this.finalize(),this.state==="ok")}get failed(){return this.state==="failed"}finalize(){let e=this.gl,r=this.program;if(!e.getProgramParameter(r,e.LINK_STATUS)){let[i,s]=this.shaders;this.error=G(e,i,"vertex",this.vertex,this.label)||G(e,s,"fragment",this.fragment,this.label)||["link",this.label,e.getProgramInfoLog(r)||"",""],this.Pa(),e.deleteProgram(r),this.state="failed";return}this.Pa();let t=e.getProgramParameter(r,e.ACTIVE_UNIFORMS);for(let i=0;i<t;i++){let s=e.getActiveUniform(r,i);if(!s)continue;let n=s.name.replace(/\[0\]$/,""),o=e.getUniformLocation(r,s.name);o&&(this.uniforms.set(n,{loc:o,type:s.type,size:s.size}),(s.type===e.SAMPLER_2D||s.type===e.UNSIGNED_INT_SAMPLER_2D)&&this.samplers.push(n))}this.state="ok"}Pa(){for(let e of this.shaders)this.gl.deleteShader(e);this.shaders=[]}set(e,r){let t=this.state==="ok"?this.uniforms.get(e):void 0;if(!t||r==null)return;let i=this.gl,s=t.type;if(typeof r=="number"){if(t.last===r)return;t.last=r,s===i.FLOAT?i.uniform1f(t.loc,r):s===i.UNSIGNED_INT?i.uniform1ui(t.loc,r):i.uniform1i(t.loc,r);return}let n=r,o=t.last;if(o?.length===n.length){let h=n.length;for(;h--&&o[h]===n[h];);if(h<0)return}else o=t.last=[];for(let h=0;h<n.length;h++)o[h]=n[h];s===i.FLOAT_VEC2?i.uniform2fv(t.loc,n):s===i.FLOAT_VEC3?i.uniform3fv(t.loc,n,0,Math.min(n.length,t.size*3)):s===i.FLOAT_VEC4?i.uniform4fv(t.loc,n):D[s-i.FLOAT_MAT2]?i[D[s-i.FLOAT_MAT2]](t.loc,!1,n):s===i.FLOAT?i.uniform1fv(t.loc,n):i[`uniform${n.length/t.size}${s===i.UNSIGNED_INT||s>=i.UNSIGNED_INT_VEC2?"u":""}iv`]?.(t.loc,n)}dispose(){this.Pa(),this.state!=="failed"&&this.gl.deleteProgram(this.program)}};function N(a,e,r){let t=a.createShader(e);return a.shaderSource(t,r),a.compileShader(t),t}function G(a,e,r,t,i){return e&&!a.getShaderParameter(e,a.COMPILE_STATUS)?[r,i,a.getShaderInfoLog(e)||"",t]:null}var O=`#version 300 es
|
|
3
|
-
layout(location=0)in vec2 aPosition;
|
|
4
|
-
uniform vec2 uCanvas;
|
|
5
|
-
uniform vec4 uRect;
|
|
6
|
-
out vec2 vUv;
|
|
7
|
-
void main(){
|
|
8
|
-
vUv=aPosition;
|
|
9
|
-
vec2 px=uRect.xy+aPosition*uRect.zw;
|
|
10
|
-
gl_Position=vec4(px/uCanvas*2.0-1.0,0.0,1.0);
|
|
11
|
-
}
|
|
12
|
-
`,W=`#version 300 es
|
|
13
|
-
precision highp float;
|
|
14
|
-
in vec2 vUv;
|
|
15
|
-
uniform sampler2D uImage;
|
|
16
|
-
uniform float uAlpha;
|
|
17
|
-
out vec4 outColor;
|
|
18
|
-
void main(){
|
|
19
|
-
outColor=texture(uImage,vUv)*uAlpha;
|
|
20
|
-
}
|
|
21
|
-
`,A=class{constructor(e){this.gl=e;this.program=null;this.qa=[];this.rect=[]}get(){return this.program||=new L(this.gl,O,W,"layer fade")}draw(e,r,t,i,s){let n=this.get();if(!n.ready())return!1;let o=this.gl,h=this.qa,c=this.rect;return h[0]=i.width,h[1]=i.height,c[0]=r.x,c[1]=r.y,c[2]=r.dw,c[3]=r.dh,o.useProgram(n.program),n.set("uCanvas",h),n.set("uRect",c),n.set("uAlpha",t),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e),n.set("uImage",0),s.draw(),!0}forget(){this.program=null}dispose(){this.program?.dispose(),this.program=null}};function w(a,e,r){a.bindFramebuffer(a.FRAMEBUFFER,null),a.viewport(0,0,e,r),a.disable(a.SCISSOR_TEST),a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE),a.frontFace(a.CCW),a.disable(a.STENCIL_TEST),a.disable(a.SAMPLE_ALPHA_TO_COVERAGE),a.disable(a.SAMPLE_COVERAGE),a.depthMask(!0),a.colorMask(!0,!0,!0,!0),a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.useProgram(null),a.bindVertexArray(null),a.activeTexture(a.TEXTURE0),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,a.BROWSER_DEFAULT_WEBGL)}function M(a,e,r,t){return t.x=Math.round(a.x*r),t.y=Math.round((e-a.y-a.height)*r),t.width=Math.max(0,Math.round(a.width*r)),t.height=Math.max(0,Math.round(a.height*r)),t}var P=class{constructor(e){this.stage=e;this.Yb={x:0,y:0,width:0,height:0};this.full={x:0,y:0,width:0,height:0};this.ask={x:0,y:0,width:0,height:0};this.view={px:{x:0,y:0,width:0,height:0},dpr:1,clip:{x:0,y:0,width:0,height:0}};this.fade=new A(e.gl)}upright(e){this.stage.warnOnce(e,`${C(e.el)}: a three.js layer is drawn upright; GL can't turn or tilt a layer's own drawing. Turn the camera in your scene instead.`)}begin(e,r){w(this.stage.gl,this.stage.canvas.width,this.stage.canvas.height);for(let t of e)t._layer?.ready&&this.captured(t)&&this.capture(t,r,this.scale(t))}create(e){let r=this.stage,t=e.el,i=t.getAttribute("data-gl-layer")||"",s=r.registry.layers.get(i);return!s||typeof s.render!="function"?(m.warn(`data-gl="layer" needs data-gl-layer="name" and gl.layer("${i||"name"}", { setup, render }).`),e.setStatus("error"),!1):(t.hasAttribute("data-gl-effect")&&m.once(`data-gl-effect is ignored on layers ("${i}"): a layer draws itself.`),this.build(e,i,s,r.readOptions(t,"data-gl-layer",s.options||{})),!0)}build(e,r,t,i){e._layer=new U(r,t,this.context(e,r,i),this,e),this.fade.get()}setup(e){let r=this.stage,t=e._layer;e.textureState="loading";let i=++t.gen,s;try{s=t.def.setup?.(t.ctx)}catch(n){return this.failed(e,"setup",n)}Promise.resolve(s).then(n=>{if(i!==t.gen||!r.planes.includes(e)||r.lost){try{typeof n=="function"&&n()}catch(o){m.error(`layer "${t.name}" cleanup failed`,o)}return}w(r.gl,r.canvas.width,r.canvas.height),t.cleanup=n,t.ready=!0,t.sizeKey=-1,e.textureState="ready",e.resolveLoaded(),r.wake(2)},n=>{i===t.gen&&this.failed(e,"setup",n)})}failed(e,r,t){m.error(`layer "${e._layer?.name}" ${r} failed; its element keeps its DOM content.`,t),e._layer&&(e._layer.ready=!1),e.textureState="error",e.setStatus("error")}cut(e,r){let t=e.clips?.ga?e.clips.scissorPx:null;if(!t)return r;let i=this.Yb;return i.x=Math.max(r.x,t[0]),i.y=Math.max(r.y,t[1]),i.width=Math.max(0,Math.min(r.x+r.width,t[0]+t[2])-i.x),i.height=Math.max(0,Math.min(r.y+r.height,t[1]+t[3])-i.y),i}context(e,r,t){let i=this.stage,s=this,n={name:r,el:e.el,gl:i.gl,canvas:i.canvas,options:t,state:{},engine:i.host.engine,rect:{x:0,y:0,width:0,height:0},px:{x:0,y:0,width:0,height:0},viewport:i.viewport,dpr:1,mouse:{x:.5,y:.5},scrollVelocity:0,opacity:1,time:0,frame:null,get reducedMotion(){return i.reducedMotion},wake(o){i.wake(o)},busy(o){o?e.busyReasons.add(`layer:${r}`):e.busyReasons.delete(`layer:${r}`),i.markDirty()},three(o){let h=n.px;if(o.resetState?.(),o.autoClear=!1,o.setViewport?.(h.x,h.y,h.width,h.height),e._layer?.def.scissor!==!1){let c=e._layer?.clip||s.cut(e,h);o.setScissor?.(c.x,c.y,c.width,c.height),o.setScissorTest?.(!0)}}};return n}draw(e,r,t){let i=this.stage,s=e._layer,n=s.ctx,o=e.rect;n.rect.x=o[0],n.rect.y=o[1],n.rect.width=o[2],n.rect.height=o[3],t?(Object.assign(n.px,t.px),n.dpr=t.dpr):(n.dpr=i.dpr*i.scale,M(n.rect,i.viewport.height,n.dpr,n.px)),s.clip=t?t.clip:null,n.time=i.time,n.frame=r,n.scrollVelocity=i.velocity,n.opacity=e.opacity,n.mouse.x=(i.pointer.x-o[0])/Math.max(o[2],1),n.mouse.y=(i.pointer.y-o[1])/Math.max(o[3],1);let h=i.gl,c=n.px.width*65536+n.px.height;try{if(c!==s.sizeKey&&(s.sizeKey=c,s.def.resize?.(n)),s.def.scissor!==!1){let d=s.clip||this.cut(e,n.px);h.enable(h.SCISSOR_TEST),h.scissor(d.x,d.y,d.width,d.height)}h.viewport(n.px.x,n.px.y,n.px.width,n.px.height),h.depthMask(!0),h.clear(h.DEPTH_BUFFER_BIT),s.def.render(n)}catch(d){this.failed(e,"render",d)}w(h,i.canvas.width,i.canvas.height)}capture(e,r,t){let i=this.stage,s=i.gl,n=e._layer,o=i.canvas.width,h=i.canvas.height,c=i.dpr*i.scale,d=this.full,y=this.ask;if(n.def.scissor!==!1){let p=e.rect;y.x=p[0],y.y=p[1],y.width=p[2],y.height=p[3],M(y,i.viewport.height,c,d)}else d.x=d.y=0,d.width=o,d.height=h;let g=Math.max(0,d.x),u=Math.max(0,d.y),l=Math.min(o,d.x+d.width)-g,f=Math.min(h,d.y+d.height)-u;if(n.def.scissor!==!1&&e.clips?.ga){y.x=g,y.y=u,y.width=l,y.height=f;let p=this.cut(e,y);g=p.x,u=p.y,l=p.width,f=p.height}if(l<1||f<1)return this.freeFade(e);let R=t<1?0:g,x=t<1?0:u,_=Math.max(1,Math.round(l*t)),b=Math.max(1,Math.round(f*t)),T=this.view,v=T.clip;if(v.x=R,v.y=x,v.width=_,v.height=b,T.px.x=Math.round(R-(g-d.x)*t),T.px.y=Math.round(x-(u-d.y)*t),T.px.width=Math.max(0,Math.round(d.width*t)),T.px.height=Math.max(0,Math.round(d.height*t)),T.dpr=c*t,s.enable(s.SCISSOR_TEST),s.scissor(R,x,_,b),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),this.draw(e,r,t<1?T:void 0),n.clip=null,!n.ready)return this.freeFade(e);let E=n.fade;if(!E||E.width!==_||E.height!==b){let p=E?.texture||s.createTexture();if(!p)return;s.bindTexture(s.TEXTURE_2D,p),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,_,b,0,s.RGBA,s.UNSIGNED_BYTE,null),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),E=n.fade={texture:p,width:_,height:b,x:g,y:u,dw:l,dh:f}}E.x=g,E.y=u,E.dw=l,E.dh=f,s.bindTexture(s.TEXTURE_2D,E.texture),s.copyTexSubImage2D(s.TEXTURE_2D,0,0,0,R,x,_,b)}scale(e){let r=e._layer?.def.dpr,t=this.stage.dpr*this.stage.scale;return r&&r>0&&r<t-.01?r/t:1}alpha(e){return e._layer?.def.followOpacity===!1?1:e.opacity}captured(e){return this.scale(e)<1||this.alpha(e)<.999}drawFade(e,r){let t=this.stage;if(!this.fade.draw(e._layer.fade.texture,e._layer.fade,this.alpha(e),t.canvas,t.programs.grid(1))){let i=this.fade.get();i.failed&&m.once(`layer fade: ${i.error[2]}`),this.draw(e,r)}}waiting(e){return e.near?"its layer is still setting up":"its layer sets up when it comes near the screen"}freeFade(e){let r=e._layer;r?.fade&&(this.stage.lost||this.stage.gl.deleteTexture(r.fade.texture),r.fade=null)}render(e,r){e._layer.fade&&this.captured(e)?this.drawFade(e,r):(this.freeFade(e),this.draw(e,r))}},U=class{constructor(e,r,t,i,s){this.name=e;this.def=r;this.ctx=t;this.owner=i;this.plane=s;this.ready=!1;this.sizeKey=-1;this.gen=0;this.fade=null;this.clip=null}stop(){try{typeof this.cleanup=="function"&&this.cleanup()}catch(e){m.error(`layer "${this.name}" cleanup failed`,e)}}lost(){this.stop(),this.cleanup=void 0,this.ready=!1,this.gen++,this.fade=null}dispose(){this.stop(),this.gen++,this.owner.freeFade(this.plane)}};var S=class{constructor(e){this.stage=e;this.renderer=null;this.entries=new Set}create(e,r={}){if(this.renderer)return this.renderer;let t=e?.WebGLRenderer;if(typeof t!="function")return m.warn('gl.renderer(THREE) needs the three.js module itself: import * as THREE from "three"; gl.renderer(THREE).'),null;let i=this.stage;if(i.lost)return null;let s;try{s=new t({...r,canvas:i.canvas,context:i.gl})}catch(n){return m.error("gl.renderer(THREE): three.js could not use Umber's WebGL2 context",n),null}return s.autoClear=!1,s.setPixelRatio?.(1),s.setSize?.(i.canvas.width,i.canvas.height,!1),this.renderer=s,w(i.gl,i.canvas.width,i.canvas.height),i.wake(1),s}resized(e,r){this.renderer?.setSize?.(e,r,!1)}view(e){let r=this.stage,t=e.options;!t.render&&!this.renderer&&m.warn("gl.view() draws with gl.renderer(THREE): call (and await) that first, or pass render(f) to draw yourself.");let i=null,s=!1,n=this,o=()=>r.reducedMotion,h={time:0,dt:0,ratio:1,frame:0,width:0,height:0,dpr:1,rect:e.tracker.rect,progress:0,velocity:0,reducedMotion:!1,renderer:null,scene:t.scene,camera:t.camera,view:e.view},c=l=>{let f=l.frame;return h.time=l.time,h.dt=f?.dt??0,h.ratio=f?.ratio??1,h.frame=f?.frame??0,h.width=l.rect.width,h.height=l.rect.height,h.dpr=l.dpr,h.rect=e.tracker.rect,h.progress=i?.progress??0,h.velocity=f?.scroll.velocity??0,h.reducedMotion=o(),h.renderer=n.renderer,h},d=typeof t.dpr=="number"?t.dpr:Array.isArray(t.dpr)?t.dpr[1]:void 0,y={setup:t.setup?()=>t.setup({el:e.el,renderer:n.renderer,scene:t.scene,camera:t.camera,view:e.view}):void 0,render(l){let f=c(l);t.animate?.(f)===!0&&!f.reducedMotion?i.busyReasons.add("view:animate"):i.busyReasons.delete("view:animate");let x=n.renderer;x&&l.three(x),t.render?t.render(f):x?.render(t.scene,t.camera),s||(s=!0,e.setStatus("ready"))},resize(l){let f=t.camera;t.aspect!==!1&&f?.isPerspectiveCamera&&l.rect.height>0&&(f.aspect=l.rect.width/l.rect.height,f.updateProjectionMatrix?.()),t.resize?.(c(l)),e.emit("resize")},animate:!1,scissor:t.scissor,followOpacity:t.followOpacity,dpr:d};if(r.plane(e.el))return m.warn("gl.view(el): this element already has a GL plane (data-gl); give the view its own element.",e.el),null;i=r.addView(e.el,y);let g={plane:i,state:e,redraw:()=>s=!1};this.entries.add(g);let u=i;u.on("error",()=>e.setStatus("error","render")),u.on("destroy",()=>{this.entries.delete(g),e.destroyed||e.view.destroy()});for(let l of e.busy)u.busyReasons.add(`view:${l}`);return e.wanted&&r.wake(e.wanted),{wake(l){r.wake(l)},busy(){for(let l of[...u.busyReasons])l.startsWith("view:")&&l!=="view:animate"&&u.busyReasons.delete(l);for(let l of e.busy)u.busyReasons.add(`view:${l}`);r.markDirty()},get width(){return Math.round(u.rect[2])},get height(){return Math.round(u.rect[3])},get dpr(){return u._layer?.ctx.dpr||0},destroy(){u.destroyed||r.removePlane(u)}}}lost(){for(let{state:e,redraw:r}of this.entries)r(),e.setStatus("lost"),e.emit("lost")}restored(){for(let{state:e}of this.entries)e.emit("restored")}dispose(){try{this.renderer?.dispose?.()}catch(e){m.error("the shared three.js renderer failed to dispose",e)}this.renderer=null}};function ie(a){I(a.host.log),a.layers=new P(a);let e=a.views=new S(a);for(let r of a.planes.slice())r.kind==="layer"&&!r._layer&&r.el.isConnected&&a.rebuild(r);return e}export{ie as layers};
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e=()=>{};var t=()=>Promise.reject(new Error("no words"));var r={configure:e,debug:!1,warnings:!1,info:e,warn:e,error:e,report:e,words:t},i=r;function a(e){i=e}var s=(e,t)=>e[t]??NaN;function n(e){if(!e||typeof e.tagName!="string")return"<?>";let t=e.tagName.toLowerCase();if(e.id)return`<${t}#${e.id}>`;let r=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";return r?`<${t}.${r}>`:`<${t}>`}var h=e=>e,l=["uniformMatrix2fv","uniformMatrix3fv","uniformMatrix4fv",void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,"uniformMatrix2x3fv","uniformMatrix2x4fv","uniformMatrix3x2fv","uniformMatrix3x4fv","uniformMatrix4x2fv","uniformMatrix4x3fv"],o=["uniform1iv","uniform2iv","uniform3iv","uniform4iv"],d=["uniform1uiv","uniform2uiv","uniform3uiv","uniform4uiv"];function u(e,t,r){return(t===e.UNSIGNED_INT||t>=e.UNSIGNED_INT_VEC2&&t<=e.UNSIGNED_INT_VEC4?d:o)[r-1]}var c=0,g=0,p=0,f=3e3,m=.02,v=m,y=.001,x=!1,w=4,E=500;var T=()=>performance.now()<c,_=class{constructor(e,t,r,i="program"){this.gl=e;this.vertex=t;this.fragment=r;this.uniforms=new Map;this.state="pending";this.started=!1;this.error=null;this.shaders=[];this.options=typeof i=="string"?{label:i}:i;let a=globalThis.occluzeCapture;this.now=a?.version===1,this.Uf=this.now?null:e.getExtension("KHR_parallel_shader_compile");let s=h(e.createProgram());if(!s)throw new Error("the WebGL context is lost");this.program=s,this.options.lazy||this.start()}start(e){if(this.started||!e&&T())return;this.started=!0;let t=this.gl,r=this.program,i,a;try{i=R(t,t.VERTEX_SHADER,this.vertex),a=R(t,t.FRAGMENT_SHADER,this.fragment)}catch{this.state="failed";return}t.attachShader(r,i),t.attachShader(r,a),t.bindAttribLocation(r,0,"aPosition");for(let[e,i]of this.options.attributes??[])t.bindAttribLocation(r,i,e);if(t.linkProgram(r),this.shaders=[i,a],this.Uf)return;if(this.now){this.T();return}t.flush(),T()||(g=c=performance.now(),p=0);let s=f+this.vertex.length+this.fragment.length;p+=s,c+=Math.min(E,v*s)}ready(){return this.state!=="pending"?this.state==="ok":this.compiled()?(this.T(),this.state==="ok"):!1}compiled(){return this.start(),this.state!=="pending"?!0:this.Uf?!!this.gl.getProgramParameter(this.program,this.Uf.COMPLETION_STATUS_KHR):this.started&&!T()}get failed(){return this.state==="failed"}get eh(){return!this.Uf&&!this.now}T(){if(this.start(!0),this.state!=="pending")return;let e=this.gl,t=this.program,r=performance.now(),i=e.getProgramParameter(t,e.LINK_STATUS),a=performance.now();if(a-r>w?(v=Math.max(m,(Math.min(a,c+a-r)-g)/p),c=a,x=!0):!x&&!this.Uf&&(v=Math.max(y,v/2)),!i){this.error=this.ze(),this.ob(),e.deleteProgram(t),this.state="failed";return}this.ob();let s=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<s;r++){let i=e.getActiveUniform(t,r);if(!i)continue;let a=i.name.replace(/\[0\]$/,""),s=e.getUniformLocation(t,i.name);s&&this.uniforms.set(a,{location:s,type:i.type,size:i.size})}this.state="ok"}ze(){let e=this.gl,[t,r]=this.shaders,i=U(e,t);if(i!==null)return["vertex",this.options.label,i,this.vertex];let a=U(e,r);return a!==null?["fragment",this.options.label,a,this.fragment]:["link",this.options.label,e.getProgramInfoLog(this.program)??"",""]}ob(){for(let e of this.shaders)this.gl.deleteShader(e);this.shaders=[]}set(e,t){let r=this.state==="ok"?this.uniforms.get(e):void 0;!r||t==null||(typeof t=="number"?b(this.gl,r,t):S(this.gl,r,t))}dispose(){this.ob(),this.state!=="failed"&&this.gl.deleteProgram(this.program)}};function b(e,t,r){if(t.last===r)return;t.last=r;let{type:i,location:a}=t;i===e.FLOAT?e.uniform1f(a,r):i===e.UNSIGNED_INT?e.uniform1ui(a,r):e.uniform1i(a,r)}function M(e,t){let r=e.last;if(r?.length===t.length){let e=t.length;for(;e--&&r[e]===t[e];);if(e<0)return!1}else r=[],e.last=r;for(let e=0;e<t.length;e++)r[e]=s(t,e);return!0}function S(e,t,r){if(!M(t,r))return;let{type:i,location:a}=t,s=l[i-e.FLOAT_MAT2];if(i===e.FLOAT_VEC2)e.uniform2fv(a,r);else if(i===e.FLOAT_VEC3)e.uniform3fv(a,r,0,Math.min(r.length,t.size*3));else if(i===e.FLOAT_VEC4)e.uniform4fv(a,r);else if(s)e[s](a,!1,r);else if(i===e.FLOAT)e.uniform1fv(a,r);else{let s=u(e,i,r.length/t.size);s&&e[s](a,r)}}function R(e,t,r){let i=h(e.createShader(t));if(!i)throw new Error("the WebGL context is lost");return e.shaderSource(i,r),e.compileShader(i),i}function U(e,t){return t&&!e.getShaderParameter(t,e.COMPILE_STATUS)?e.getShaderInfoLog(t)??"":null}var A=`#version 300 es\nlayout(location=0)in vec2 aPosition;\nuniform vec2 uCanvas;\nuniform vec4 uRect;\nout vec2 vUv;\nvoid main(){\nvUv=aPosition;\nvec2 px=uRect.xy+aPosition*uRect.zw;\ngl_Position=vec4(px/uCanvas*2.0-1.0,0.0,1.0);\n}\n`,P=`#version 300 es\nprecision highp float;\nin vec2 vUv;\nuniform sampler2D uImage;\nuniform float uAlpha;\nout vec4 outColor;\nvoid main(){\noutColor=texture(uImage,vUv)*uAlpha;\n}\n`,L=class{constructor(e){this.gl=e;this.program=null;this.Lj=[];this.rect=[]}get(){return this.program??=new _(this.gl,A,P,"layer fade")}draw(e,t,r,i){let a=this.get();if(!a.ready())return!1;let s=this.gl,n=this.Lj,h=this.rect;return n[0]=r.width,n[1]=r.height,h[0]=e.x,h[1]=e.y,h[2]=e.dw,h[3]=e.dh,s.useProgram(a.program),a.set("uCanvas",n),a.set("uRect",h),a.set("uAlpha",t),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,e.texture),a.set("uImage",0),i.draw(),!0}forget(){this.program=null}dispose(){this.program?.dispose(),this.program=null}};var C="model";var O=e=>e.matches("[data-umber~=model]"),N=e=>O(e)?C:e.getAttribute("data-umber-layer")??"";function I(e,t,r){e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,t,r),e.disable(e.SCISSOR_TEST),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.frontFace(e.CCW),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.disable(e.SAMPLE_COVERAGE),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(null),e.bindVertexArray(null),e.activeTexture(e.TEXTURE0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL)}function k(e,t,r,i){return i.x=Math.round(e.x*r),i.y=Math.round((t-e.y-e.height)*r),i.width=Math.max(0,Math.round(e.width*r)),i.height=Math.max(0,Math.round(e.height*r)),i}var D=class{constructor(e){this.stage=e;this.mg={x:0,y:0,width:0,height:0};this.full={x:0,y:0,width:0,height:0};this.ask={x:0,y:0,width:0,height:0};this.view={px:{x:0,y:0,width:0,height:0},dpr:1,clip:{x:0,y:0,width:0,height:0}};this.fade=new L(e.gpu.gl)}upright(e){this.stage.fallbacks.Ja(e,`${n(e.el)}: a three.js layer is drawn upright; GL can't turn or tilt a layer's own drawing. Turn the camera in your scene instead.`)}begin(e,t){I(this.stage.gpu.gl,this.stage.gpu.canvas.width,this.stage.gpu.canvas.height);for(let r of e)r.layer?.ready&&this.captured(r)&&this.capture(r,t,this.scale(r))}create(e){let t=this.stage,r=e.el,i=O(r),a=N(r),s=t.env.registry.layers.get(a);if(!s||typeof s.render!="function")return i?t.env.lib.say("model",[]):t.env.lib.say("layer",[a]),e.setStatus("error"),!1;r.hasAttribute("data-umber-effect")&&t.env.lib.say("layerEffect",[a]);let n=i?t.env.lib.config(r,"data-umber-model",s.options??{}):t.env.lib.config(r,"data-umber-layer",s.options??{});return this.build(e,a,s,n),!0}build(e,t,r,i){e.layer=new H(r,this.context(e,t,i),()=>{this.Rd(e)}),this.fade.get()}setup(e){let t=this.stage,r=e.layer;if(!r)return;e.textureState="loading";let a=++r.gen,s;try{s=r.def.setup?.(r.ctx)}catch(t){this.failed(e,"setup",t);return}Promise.resolve(s).then(s=>{if(a!==r.gen||!t.planes.all.includes(e)||t.gpu.context.gone){try{F(s)&&s()}catch(e){i.error(`layer "${r.name}" cleanup failed`,e)}return}I(t.gpu.gl,t.gpu.canvas.width,t.gpu.canvas.height),r.cleanup=F(s)?s:void 0,r.ready=!0,r.hl=-1,e.textureState="ready",e._o(),t.scheduler.wake(2)},t=>{a===r.gen&&this.failed(e,"setup",t)})}failed(e,t,r){i.error(`layer "${e.layer?.name}" ${t} failed; its element keeps its DOM content.`,r),e.layer&&(e.layer.ready=!1),e.textureState="error",e.setStatus("error")}cut(e,t){let r=e.clips?.lb?e.clips.scissorPx:null;if(!r)return t;let i=this.mg;return i.x=Math.max(t.x,r[0]),i.y=Math.max(t.y,r[1]),i.width=Math.max(0,Math.min(t.x+t.width,r[0]+r[2])-i.x),i.height=Math.max(0,Math.min(t.y+t.height,r[1]+r[3])-i.y),i}context(e,t,r){let i=this.stage,a=t=>this.cut(e,t),s={name:t,el:e.el,gl:i.gpu.gl,canvas:i.gpu.canvas,options:r,state:{},engine:i.env.host.engine,rect:{x:0,y:0,width:0,height:0},px:{x:0,y:0,width:0,height:0},viewport:i.canvasHost.viewport,dpr:1,mouse:{x:.5,y:.5},scrollVelocity:0,opacity:1,time:0,frame:null,get reducedMotion(){return i.env.reducedMotion},wake(e){i.scheduler.wake(e)},busy(r){r?e._U.add(`layer:${t}`):e._U.delete(`layer:${t}`),i.scheduler.markDirty()},three(t){let r=s.px;if(t.resetState?.(),t.autoClear=!1,t.setViewport?.(r.x,r.y,r.width,r.height),e.layer?.def.scissor!==!1){let i=e.layer?.clip??a(r);t.setScissor?.(i.x,i.y,i.width,i.height),t.setScissorTest?.(!0)}}};return s}draw(e,t,r){let i=this.stage,a=e.layer;if(!a)return;let s=a.ctx,n=e.rect;s.rect.x=n[0],s.rect.y=n[1],s.rect.width=n[2],s.rect.height=n[3],r?(Object.assign(s.px,r.px),s.dpr=r.dpr):(s.dpr=i.canvasHost.dpr*i.gpu.renderer.adaptive.scale,k(s.rect,i.canvasHost.viewport.height,s.dpr,s.px)),a.clip=r?r.clip:null,s.time=i.env.frame.time,s.frame=t,s.scrollVelocity=i.env.frame.velocity,s.opacity=e.opacity,s.mouse.x=(i.env.frame.pointer.x-n[0])/Math.max(n[2],1),s.mouse.y=(i.env.frame.pointer.y-n[1])/Math.max(n[3],1);let h=i.gpu.gl,l=s.px.width*65536+s.px.height;try{if(l!==a.hl&&(a.hl=l,a.def.resize?.(s)),a.def.scissor!==!1){let t=a.clip??this.cut(e,s.px);h.enable(h.SCISSOR_TEST),h.scissor(t.x,t.y,t.width,t.height)}h.viewport(s.px.x,s.px.y,s.px.width,s.px.height),h.depthMask(!0),h.clear(h.DEPTH_BUFFER_BIT),a.def.render(s)}catch(t){this.failed(e,"render",t)}I(h,i.gpu.canvas.width,i.gpu.canvas.height)}capture(e,t,r){let i=this.stage.gpu.gl,a=e.layer;if(!a)return;let s=this.stage.canvasHost.dpr*this.stage.gpu.renderer.adaptive.scale,n=this.hk(e,a,s);if(n.width<1||n.height<1){this.Rd(e);return}let h=this.Le(n,r,s),l=h.clip;if(i.enable(i.SCISSOR_TEST),i.scissor(l.x,l.y,l.width,l.height),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),this.draw(e,t,r<1?h:void 0),a.clip=null,!a.ready){this.Rd(e);return}z(i,a,n,l)}hk(e,t,r){let i=this.stage.gpu.canvas,a=this.full,s=this.ask,n=t.def.scissor!==!1;if(n){let t=e.rect;s.x=t[0],s.y=t[1],s.width=t[2],s.height=t[3],k(s,this.stage.canvasHost.viewport.height,r,a)}else a.x=0,a.y=0,a.width=i.width,a.height=i.height;return s.x=Math.max(0,a.x),s.y=Math.max(0,a.y),s.width=Math.min(i.width,a.x+a.width)-s.x,s.height=Math.min(i.height,a.y+a.height)-s.y,n&&e.clips?.lb&&Object.assign(s,this.cut(e,s)),s}Le(e,t,r){let i=this.full,a=this.view,s=a.clip;return s.x=t<1?0:e.x,s.y=t<1?0:e.y,s.width=Math.max(1,Math.round(e.width*t)),s.height=Math.max(1,Math.round(e.height*t)),a.px.x=Math.round(s.x-(e.x-i.x)*t),a.px.y=Math.round(s.y-(e.y-i.y)*t),a.px.width=Math.max(0,Math.round(i.width*t)),a.px.height=Math.max(0,Math.round(i.height*t)),a.dpr=r*t,a}scale(e){let t=e.layer?.def.dpr,r=this.stage.canvasHost.dpr*this.stage.gpu.renderer.adaptive.scale;return t&&t>0&&t<r-.01?t/r:1}alpha(e){return e.layer?.def.followOpacity===!1?1:e.opacity}captured(e){return this.scale(e)<1||this.alpha(e)<.999?!0:e.layer?.def.passes===!0&&this.stage.chunks.fx?.passing===!0}Uh(e,t){let r=this.stage,a=e.layer?.fade;if(r.gpu.gl.disable(r.gpu.gl.SCISSOR_TEST),!a||!this.fade.draw(a,this.alpha(e),r.gpu.canvas,r.gpu.programs.grid(1))){let r=this.fade.get();r.error&&i.warn(`layer fade: ${r.error[2]}`),this.draw(e,t)}}waiting(e){return e.zone.near?"its layer is still setting up":"its layer sets up when it comes near the screen"}Rd(e){let t=e.layer;t?.fade&&(this.stage.gpu.context.gone||this.stage.gpu.gl.deleteTexture(t.fade.texture),t.fade=null)}render(e,t){e.layer?.fade&&this.captured(e)?this.Uh(e,t):(this.Rd(e),this.draw(e,t))}},F=e=>typeof e=="function",G=e=>e.createTexture();function z(e,t,r,i){let a=t.fade;if(a?.width!==i.width||a.height!==i.height){let r=a?.texture??G(e);if(!r)return;e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,i.width,i.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),a={texture:r,width:i.width,height:i.height,x:0,y:0,dw:0,dh:0},t.fade=a}a.x=r.x,a.y=r.y,a.dw=r.width,a.dh=r.height,e.bindTexture(e.TEXTURE_2D,a.texture),e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,i.x,i.y,i.width,i.height)}var H=class{constructor(e,t,r){this.def=e;this.ctx=t;this.Rd=r;this.ready=!1;this.hl=-1;this.gen=0;this.fade=null;this.clip=null;this.name=t.name}stop(){try{this.cleanup?.()}catch(e){i.error(`layer "${this.name}" cleanup failed`,e)}}lost(){this.stop(),this.cleanup=void 0,this.ready=!1,this.gen++,this.fade=null}dispose(){this.stop(),this.gen++,this.Rd()}};var X=e=>typeof e=="object"&&e!==null&&typeof e.WebGLRenderer=="function",$=e=>typeof e=="object"&&e!==null&&!!e.isPerspectiveCamera;function B(e){return typeof e=="number"?e:Array.isArray(e)?e[1]:void 0}var V=e=>e.state.options.scene,W=e=>e.state.options.camera;function j(e){let t=e.state,r={time:0,dt:0,ratio:1,frame:0,width:0,height:0,dpr:1,rect:t.tracker.rect,progress:0,velocity:0,reducedMotion:!1,renderer:null,scene:V(e),camera:W(e),view:t.view};return i=>{let a=i.frame;return r.time=i.time,r.dt=a?.dt??0,r.ratio=a?.ratio??1,r.frame=a?.frame??0,r.width=i.rect.width,r.height=i.rect.height,r.dpr=i.dpr,r.rect=t.tracker.rect,r.progress=e.plane?.progress??0,r.velocity=a?.scroll.velocity??0,r.reducedMotion=e.stage.env.reducedMotion,r.renderer=e.renderer(),r}}async function K(e){let t=e.renderer(),r=V(e),a=W(e);if(!(!t?.compileAsync||!r||!a))try{await t.compileAsync(r,a)}catch(e){i.info("umber.view(): the scene's shaders compile at its first draw",e)}}function Y(e){let t=e.state,r=t.options,i=j(e),a=r.setup;return{async setup(){let r=await(a?.({el:t.el,renderer:e.renderer(),scene:V(e),camera:W(e),view:t.view}));return await K(e),r},render(a){let s=i(a);r.animate?.(s)===!0&&!s.reducedMotion?e.plane?._U.add("view:animate"):e.plane?._U.delete("view:animate");let n=e.renderer();n&&a.three(n),r.render?r.render(s):n?.render(V(e),W(e)),e.drawnOnce||(e.drawnOnce=!0,t.setStatus("ready"))},resize(a){let s=W(e);r.aspect!==!1&&$(s)&&a.rect.height>0&&(s.aspect=a.rect.width/a.rect.height,s.updateProjectionMatrix?.()),r.resize?.(i(a)),t.emit("resize")},animate:!1,scissor:r.scissor,followOpacity:r.followOpacity,dpr:B(r.dpr),passes:r.passes}}function q(e,t,r){return{wake(t){e.scheduler.wake(t)},busy(){for(let e of[...t._U])e.startsWith("view:")&&e!=="view:animate"&&t._U.delete(e);for(let e of r.busy)t._U.add(`view:${e}`);e.scheduler.markDirty()},get width(){return Math.round(t.rect[2])},get height(){return Math.round(t.rect[3])},get dpr(){return t.layer?.ctx.dpr??0},destroy(){t.destroyed||e.planes.remove(t)}}}var J=class{constructor(e){this.stage=e;this.renderer=null;this.params={};this.entries=new Set}create(e,t={}){if(this.renderer){let e=Object.keys(t).filter(e=>t[e]!==this.params[e]);return e.length&&this.stage.env.lib.say("rendererParams",[e]),this.renderer}if(!X(e))return this.stage.env.lib.say("three",[]),null;let r=this.stage;if(r.gpu.context.gone)return null;let a;try{a=new e.WebGLRenderer({...t,canvas:r.gpu.canvas,context:r.gpu.gl})}catch(e){return i.error("umber.renderer(THREE): three.js could not use Umber's WebGL2 context",e),null}return a.autoClear=!1,a.setPixelRatio?.(1),a.setSize?.(r.gpu.canvas.width,r.gpu.canvas.height,!1),this.renderer=a,this.params=t,I(r.gpu.gl,r.gpu.canvas.width,r.gpu.canvas.height),r.scheduler.wake(1),a}resized(e,t){this.renderer?.setSize?.(e,t,!1)}view(e){let t=this.stage;!e.options.render&&!this.renderer&&t.env.lib.say("viewRenderer",[]);let r={stage:t,state:e,renderer:()=>this.renderer,plane:null,drawnOnce:!1},i=Y(r);if(t.planes.of(e.el))return t.env.lib.say("viewPlane",[],e.el),null;let a=t.factory.Gl(e.el,i);r.plane=a;let s={plane:a,state:e,redraw:()=>{r.drawnOnce=!1}};this.entries.add(s),a.on("error",()=>{e.setStatus("error","render")}),a.on("destroy",()=>{this.entries.delete(s),e.destroyed||e.view.destroy()});for(let t of e.busy)a._U.add(`view:${t}`);return e.wanted&&t.scheduler.wake(e.wanted),q(t,a,e)}lost(){for(let{state:e,redraw:t}of this.entries)t(),e.setStatus("lost"),e.emit("lost")}restored(){for(let{state:e}of this.entries)e.emit("restored")}dispose(){try{this.renderer?.dispose?.()}catch(e){i.error("the shared three.js renderer failed to dispose",e)}this.renderer=null,this.params={}}};function Q(e){a(e.env.host.log),e.chunks.layers=new D(e);let t=e.chunks.views=new J(e);for(let t of e.planes.all.slice())t.kind==="layer"&&!t.layer&&t.el.isConnected&&e.planes.pe(t);return t}export{Q as layers};
|
package/dist/chunks/licence.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Umber v0.
|
|
2
|
-
var
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e=["scrollfx","handoff","scrub","input","debug","three"],t=t=>e.includes(t),o=e=>(e??"").split(/[\s,]+/).filter(Boolean);var n=/^(localhost|127\.0\.0\.1|\[::1\]|.+\.localhost|.+\.test|(10\.\d+|172\.(1[6-9]|2\d|3[01])|192\.168)\.\d+\.\d+|\[f([cd][\da-f]|e[89ab])[\da-f]:[\da-f:.]*\])$/;var r=3e3,a=700,i=100,c=e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0));async function s(e,t){let o="1=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKx8yfTMpNDg7/qifhBeSBVuQpfmTv4kKTlCyfOvjhK8VRNKAUYRCMIED2z7Q81eEyxqGc5Z8yMAxPYODPLchvQ==".split(",").find(t=>t.startsWith(`${e.kid}=`))?.slice(e.kid.length+1);if(e.host!==t)return"forged";if(!o||e.until*1e3<=Date.now()||!("subtle"in crypto))return"unknown";try{let t=await crypto.subtle.importKey("spki",c(o),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"]),n=`${e.host}|${e.until}|${e.preview?1:0}`;return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},t,c(e.sig),(new TextEncoder).encode(n))?"yes":"forged"}catch{return"forged"}}var u=e=>typeof e=="object"&&e!==null&&"ok"in e&&e.ok===!0&&"sig"in e&&"kid"in e;function l(e){if("timeout"in AbortSignal)return AbortSignal.timeout(e);let t=new AbortController;return setTimeout(()=>{t.abort()},e),t.signal}function d({load:e,host:t}){if(!e)return;let o=()=>e().then(e=>{e.showBadge(t)});o().catch(o).catch(()=>{t&&(console.warn("Umber: the Occluze badge (chunks/badge.js) could not be loaded, so Umber has stopped and the page shows without GL. The free version of Umber shows the badge; a site on a licence runs without it: https://occluze.com/dashboard?view=umber"),t.gone())})}async function h(e,t,o){let n=u(e)?await s(e,t):"forged";return n==="yes"&&e.preview&&d(o),n}async function m(e,t,o){try{let n=await fetch(e,{credentials:"omit",cache:"force-cache",signal:l(a)});if(n.ok&&await h(await n.json(),t,o)==="yes")return"yes"}catch{}return"unreachable"}var f=new Set;function b(e,t){let o=l(e);f.add(o),o.addEventListener("abort",()=>{f.delete(o),t()})}var y="umber-check:";function w(e){return new Promise(t=>{let o=document.createElement("iframe"),n=e=>{removeEventListener("message",a),o.remove(),t(e)},a=e=>{let t=e.data;if(!(e.source!==o.contentWindow||typeof t!="string"||!t.startsWith(y)))try{n(JSON.parse(t.slice(y.length)))}catch{n(void 0)}};addEventListener("message",a),b(r,()=>{n(void 0)});try{o.setAttribute("sandbox","allow-scripts"),o.name=e,o.style.display="none",o.srcdoc=`<script src="${new URL("recheck.js",import.meta.url).href}"><\/script>`,document.documentElement.append(o)}catch{n(void 0)}})}function p(){let e=new URL("https://umber.occluze.com/v2/check").origin,t=()=>{},o=new Promise(o=>{t=t=>{t.disposition==="enforce"&&t.blockedURI.startsWith(e)&&o(!0)}});return document.addEventListener("securitypolicyviolation",t),async()=>{let e=new Promise(e=>{b(i,()=>{e(!1)})}),n=await Promise.race([o,e]);return document.removeEventListener("securitypolicyviolation",t),n}}var g="Your key and your sites: https://occluze.com/dashboard?view=umber";function v(e,t){return console.warn(`Umber: ${e}, so Umber runs with the Occluze badge. ${g}`),d(t),"no"}var k=(e,t,o)=>typeof e=="object"&&e!==null&&t in e&&e[t]===o;function U(n){n&&console.info(`Umber runs here without a licence. Before launch, add your key from occluze.com/dashboard to the umber.js tag (data-umber-key) or createUmber({ key }).\nAdd-ons load from the umber.js tag: data-umber-modules="scrollfx handoff" (also scrub, input, debug, three). Docs: occluze.com/umber/llms.txt`);let r=document.querySelector("script[data-umber-modules]")?.dataset.umberModules,a=o(r).filter(e=>!t(e));a.length&&console.error(`Umber: data-umber-modules names ${a.join(", ")}, which isn't an add-on, so umber.js doesn't load it. The add-ons are ${e.join(", ")}.`)}async function $(e,t,o,n){if(k(e,"ok",!1))return k(e,"blocked",!0)?(console.warn(`Umber: Occluze has turned Umber off for ${o}, so this page shows without GL.`),"blocked"):v(t?`${o} isn't on your list of sites (add it under Umber's Domains)`:"this page has no key",n);if(!k(e,"ok",!0))return"unreachable";let r=await h(e,o,n);return r==="forged"?v(`the licence check's answer for ${o} isn't one Occluze signed`,n):r==="yes"?"yes":"unreachable"}async function A(e,t,o,a){let i={load:t,host:o&&a&&{engine:o(),gone:a}},c=location.hostname;if(!c&&location.protocol!=="file:")return d(i),"no";if(!c||n.test(c))return U(c),"yes";let s=`https://umber.occluze.com/v2/check?k=${encodeURIComponent(e??"")}&h=${encodeURIComponent(c)}`,u=p(),h,f=!1;try{let e=await fetch(s,{credentials:"omit",signal:l(r)});e.ok&&(h=await e.json())}catch{f=!0}if(h!==void 0)return $(h,e,c,i);if(await m(s,c,i)==="yes")return"yes";if(f&&await u())return v(`this page's Content Security Policy stops the licence check (add ${new URL(s).origin} to connect-src)`,i);let b=await w(s);return b===void 0?"unreachable":$(b,e,c,i)}export{A as ask};
|
package/dist/chunks/morph.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Umber v0.
|
|
2
|
-
function y(n){let t=[],s=/[\s,]*(\S+)([^,]*)/g;for(let e;(e=s.exec(n||""))&&e[1];){let i=e[1].replace(/,+$/,"");i!==e[1]&&(s.lastIndex=e.index+e[0].indexOf(e[1])+e[1].length),t.push([i,i!==e[1]?"1x":e[2].trim()||"1x"])}return t}function m(n){let t=/^calc\((.+)\)$/.exec(n);if(t){let i=t[1].trim().split(/\s+([+-])\s+/),o=m(i[0]);for(let r=1;r<i.length;r+=2)o+=(i[r]==="-"?-1:1)*m(i[r+1]);return o}let s=/^([\d.]+)(vw|px|r?em)$/.exec(n),e=s?Number(s[1]):NaN;return s?s[2]==="vw"?innerWidth*e/100:s[2]==="px"?e:e*16:innerWidth}function N(n){let t=[],s=0,e=0;for(let i=0;i<=n.length;i++){let o=n[i];o==="("?s++:o===")"?s--:!s&&(o===","||o===void 0)&&(t.push(n.slice(e,i).trim()),e=i+1)}for(let i of t){let o=-1;for(let a=0,c=0;a<i.length;a++)i[a]==="("?c++:i[a]===")"?c--:!c&&/\s/.test(i[a])&&(o=a);let r=o>0?i.slice(0,o):"";if(i&&(!r||matchMedia(r).matches))return m(i.slice(o+1))}return innerWidth}function w(n){let t=n.ownerDocument?.baseURI||document.baseURI,s=a=>a?new URL(a,t).href:"",e=y(n.getAttribute("srcset")).map(([a,c])=>({url:a,n:parseFloat(c)||1,w:c.endsWith("w")})),i=n.getAttribute("src");if(i&&!e.some(a=>a.w||a.n==1)&&e.push({url:i,n:1,w:!1}),!e.length)return"";let o=window.devicePixelRatio||1,r=o;return e[0].w&&(r=N(n.getAttribute("sizes")||"")*o),e.sort((a,c)=>a.n-c.n),s((e.find(a=>a.n>=r)||e[e.length-1]).url)}var R={duration:1,ease:"umber"},M=3e3,P=3e3,X=8;function C(n,t){return n.includes(`data-gl-id="${t}"`)||n.includes(`data-gl-id='${t}'`)||n.includes(`data-gl-id=${t}`)}var A=(n,t)=>n.querySelector(`[data-gl-id="${t.replace(/["\\]/g,"\\$&")}"]`);function x(n){return n&&typeof n=="object"&&"html"in n&&(n=n.html),typeof n=="string"?n?t=>C(n,t):null:n&&typeof n.querySelector=="function"?t=>!!A(n,t):null}function E(n){return n[2]>0&&n[3]>0&&n[0]<window.innerWidth&&n[0]+n[2]>0&&n[1]<window.innerHeight&&n[1]+n[3]>0}var k=n=>n.opacity<=.001&&E(n.rect);function v(n){let t=n.media,s=[n.el.getAttribute("data-gl-src")||""];if(t&&t.tagName==="IMG"){let e=t;s.push(e.currentSrc,e.getAttribute("src")||"",...y(e.getAttribute("srcset")).map(i=>i[0]))}return s.filter(Boolean).map(e=>new URL(e,document.baseURI).href)}function F(n,t){let s=v(n);return v(t).some(e=>s.includes(e))}var b=n=>{n.morphHidden=!1,n.el.removeAttribute("data-gl-morphing")},z=(n,t)=>n.Ba&&n.Ba!==t&&b(n.Ba);function H(n,t){let{from:s,to:e}=n,i=s.drawXf,o=s.rect;if(!e.level&&O(n.originXf)){i[0]=i[4]=i[8]=1,i[1]=i[2]=i[3]=i[5]=0,i[6]=o[0],i[7]=o[1],s.size[0]=o[2],s.size[1]=o[3],s.level=0;return}let r=n.originXf,a=e.drawXf,c=r[8]||1,h=a[8]||1;for(let u=0;u<9;u++)i[u]=r[u]/c+(a[u]/h-r[u]/c)*t;s.size[0]=n.originSize[0]+(e.size[0]-n.originSize[0])*t,s.size[1]=n.originSize[1]+(e.size[1]-n.originSize[1])*t,s.level=1,s.xfReason=null;let l=s.size[0]/2,d=s.size[1]/2,f=i[2]*l+i[5]*d+i[8],p=s.shaderRect;p[0]=(i[0]*l+i[3]*d+i[6])/f-l,p[1]=(i[1]*l+i[4]*d+i[7])/f-d,p[2]=s.size[0],p[3]=s.size[1]}function O(n){return n[0]===1&&n[1]===0&&n[2]===0&&n[3]===0&&n[4]===1&&n[5]===0&&n[8]===1}var S=n=>(n.sx=NaN,n),g=class{constructor(t){this.host=t;this.snapshots=new Map;this.flights=[];this.parked=new Set;this.later=new Map;this.gen=0;this.yc=t=>{t.el.isConnected&&this.host.transitioning&&!t.destroyed||(this.parked.delete(t),t.destroyed||this.La(t,!0))}}snap(t,s,e=0,i=null){let o=this.host,r=t.scrolls?o.scrollX:o.pageX,a=t.scrolls?o.scrollY:o.pageY;return{plane:t,rect:t.rect.slice(),xf:t.drawXf.slice(),size:t.size.slice(),radius:t.radius.slice(),ky:t.radiusKy,opacity:t.opacity,frozen:s,Ba:i,until:e,sx:r,sy:a,ex:t.doc.x-r,ey:t.doc.y-a}}get busy(){return this.flights.length>0}holds(t){for(let s of this.snapshots.values())if(s.plane===t)return!0;return!1}capture(t,s=!1){s||this.settle(),t&&typeof t.then=="function"&&(this.known(t),t=void 0);let e=x(t);if(!s)for(let o of this.flights.slice()){let{from:r,to:a}=o;if(!e||!e(o.id)){r.rect.set(a.rect),r.radius.set(a.radius),r.radiusKy=a.radiusKy,r.drawXf.set(a.drawXf),r.size.set(a.size),r.opacity=1,this.finish(o,this.host.drawable(a));continue}this.flights.splice(this.flights.indexOf(o),1),this.snapshots.set(o.id,S(this.snap(o.from,!0,0,o.to)))}let i=this.host.planes.filter(o=>o.visible).concat(this.host.planes.filter(o=>!o.visible&&k(o)));for(let o of i){let r=o.el.getAttribute("data-gl-id");!r||o.kind==="layer"||this.snapshots.has(r)||o.status!=="ready"||o.morphHidden||e&&!e(r)||(this.snapshots.set(r,this.snap(o,!!e)),e&&this.host.detach(o))}t&&typeof t=="object"&&!("html"in t)&&this.preload(t),this.snapshots.size&&this.host.markDirty()}known(t){if(t&&typeof t.then=="function"){let e=this.gen;t.then(i=>e===this.gen&&this.known(i),()=>{});return}let s=x(t);if(s){for(let[e,i]of this.snapshots)i.frozen||i.until||(s(e)?this.host.planes.includes(i.plane)&&(this.snapshots.set(e,this.snap(i.plane,!0)),this.host.detach(i.plane)):this.drop(e));typeof t=="object"&&t&&!("html"in t)&&this.preload(t)}}preload(t){for(let s of this.snapshots.keys()){let e=A(t,s),i=e?.matches("img")?e:e?.querySelector("img"),o=i&&!i.parentElement?.querySelector("source")&&w(i);o&&fetch(o,{mode:"cors",credentials:"omit"}).catch(()=>{})}}keep(t){let s=t.el.getAttribute("data-gl-id");return!s||this.snapshots.has(s)||t.kind==="layer"||t.status!=="ready"||t.morphHidden||this.host.reducedMotion||!t.visible&&!k(t)?!1:(this.wait(s,this.snap(t,!1,performance.now()+P)),!0)}wait(t,s){let e=[...this.snapshots].filter(([,i])=>i.until).sort((i,o)=>i[1].until-o[1].until);e.length>=X&&this.drop(e[0][0]),this.snapshots.set(t,s),setTimeout(()=>this.snapshots.get(t)===s&&this.drop(t),s.until-performance.now())}drop(t){let s=this.snapshots.get(t);s&&(this.snapshots.delete(t),this.release(s),this.host.markDirty())}forget(t){for(let[s,e]of this.snapshots)if(e.plane===t)return this.snapshots.delete(s),!0;return!1}claim(t){let s=t.el.getAttribute("data-gl-id");for(let h of this.flights.slice())h.id===s&&!h.to.el.isConnected&&this.Qb(h);let e=s?this.snapshots.get(s):void 0,i=this.host;if(!s||!e||t.kind==="layer"||i.reducedMotion)return!1;if(!i.onScreen(t.el))return i.changing&&e.plane.el.isConnected&&this.later.set(s,t),!1;this.later.delete(s),this.snapshots.delete(s),z(e,t);let o=e.plane,r=e.frozen?e:this.snap(o,!1);e.frozen||i.detach(o);let a=i.readOptions(t.el,"data-gl-morph",R),c=Math.max(0,Number(a.duration)||0);this.flights.push({id:s,from:o,to:t,origin:r.rect,originXf:r.xf,originSize:r.size,originRadius:r.radius,originKy:r.ky,originOpacity:r.opacity,start:i.now,duration:c,ease:i.ease(a.ease),doneAt:0,same:F(o,t)}),o.opacity=r.opacity,t.morphIn=!0,t.morphHidden=!0;for(let h of t._play.playables.keys())t.uniforms[h]&&(t.uniforms[h].value=1);t.el.setAttribute("data-gl-morphing","");for(let h of o._play.playables.keys()){let l=o.uniforms[h];l&&l.value<1&&i.tweens.to(l,{value:1,duration:Math.max(.3,c),ease:"cubic.out"})}return i.markDirty(),!0}retry(){let t=[];for(let[s,e]of this.later){let i=this.snapshots.get(s);i?.plane.el.isConnected&&e.el.isConnected||(this.later.delete(s),i&&e.el.isConnected&&this.host.planes.includes(e)&&this.claim(e)?t.push(e):i&&this.drop(s))}return t}Qb(t){this.flights.splice(this.flights.indexOf(t),1),b(t.to),this.wait(t.id,S(this.snap(t.from,!0,performance.now()+P)))}settle(t=!0){t&&(this.later.clear(),this.gen++);for(let[s,e]of this.snapshots)!t&&(e.until||this.later.has(s))||this.drop(s);this.Vb()}Vb(){this.parked.forEach(this.yc)}update(t){if(this.snapshots.size&&this.follow(),this.parked.size&&this.Vb(),!this.flights.length)return!1;for(let s=this.flights.length;s--;){let e=this.flights[s],{from:i,to:o}=e;if(!this.host.planes.includes(o)||o.status==="error"||o.textureState==="error"){o.status!=="error"&&!o.el.isConnected&&(this.host.changing||!i.el.isConnected&&this.host.transitioning)?this.Qb(e):this.finish(e,!1);continue}let r=e.duration>0?Math.min(1,(t-e.start)/(e.duration*1e3)):1,a=e.ease(r),c=o.rect;for(let l=0;l<4;l++)i.rect[l]=e.origin[l]+(c[l]-e.origin[l])*a,i.radius[l]=e.originRadius[l]+(o.radius[l]-e.originRadius[l])*a;if(i.radiusKy=e.originKy+(o.radiusKy-e.originKy)*a,H(e,a),i.opacity=e.originOpacity+((this.host.transitioning?1:o.opacity)-e.originOpacity)*a,r<1)continue;e.doneAt||(e.doneAt=t),(o.opacity>=.99||!this.host.transitioning)&&this.host.drawable(o)?this.finish(e,!0):t-e.doneAt>M&&this.finish(e,!1)}return!0}follow(){let t=this.host;for(let s of this.snapshots.values()){let e=s.plane;if(!s.frozen||s.sx!==s.sx)continue;let i=e.scrolls?t.scrollX:t.pageX,o=e.scrolls?t.scrollY:t.pageY;if(i===s.sx&&o===s.sy)continue;let r=e.el.isConnected?e.el.getBoundingClientRect():null;if(!r?.width){s.sx=NaN;continue}let a=e.pinned?r.left-s.ex:s.sx-i,c=e.pinned?r.top-s.ey:s.sy-o;if(s.sx=i,s.sy=o,s.ex=r.left,s.ey=r.top,!a&&!c)continue;let h=e.rect,l=e.shaderRect,d=e.drawXf;h[0]+=a,h[1]+=c,l[0]+=a,l[1]+=c;for(let f=0;f<9;f+=3)d[f]+=a*d[f+2],d[f+1]+=c*d[f+2];s.rect.set(h),s.xf.set(d),t.markDirty()}}draw(t){if(this.snapshots.size)for(let s of this.snapshots.values())s.frozen&&!this.host.planes.includes(s.plane)&&t(s.plane);for(let s of this.flights){let{from:e,to:i}=s,o=e.texture;s.same&&i.texture?.ready&&e.kind==="image"&&(e.texture=i.texture),t(e),e.texture=o}}cancel(){for(let t of this.flights.slice())this.finish(t,!1);this.settle(),this.parked.forEach(t=>this.La(t,!0)),this.parked.clear()}finish(t,s){if(this.flights.splice(this.flights.indexOf(t),1),s){t.to.morphHidden=!1;let e=t.to.el;this.host.host.loadCovers?.().then(i=>i.landed(e,this.host.hostEl,this.host.host.log),()=>{})}else b(t.to);this.La(t.from,!s),this.host.markDirty()}La(t,s){t.el.isConnected?this.host.transitioning&&!s?this.parked.add(t):this.host.attach(t):this.host.discard(t)}release(t){z(t);let s=t.plane;this.host.planes.includes(s)||this.La(s,!0)}};function T(n){return n.morph=new g(n)}export{T as morph};
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
function t(t){let e=[],s=t??"",i=/[\s,]*(\S+)([^,]*)/g;for(let t=i.exec(s);t;t=i.exec(s)){let[s,n,r=""]=t;if(!n)break;let o=n.replace(/,+$/,"");o!==n&&(i.lastIndex=t.index+s.indexOf(n)+n.length),e.push([o,o!==n?"1x":r.trim()||"1x"])}return e}function e(t){let s=/^calc\((.+)\)$/.exec(t)?.[1];if(s!==void 0){let[t="",...i]=s.trim().split(/\s+([+-])\s+/),n=e(t);for(let t=0;t<i.length;t+=2)n+=(i[t]==="-"?-1:1)*e(i[t+1]??"");return n}let i=/^([\d.]+)(vw|px|r?em)$/.exec(t);if(!i)return innerWidth;let[,n="",r]=i,o=Number(n);return r==="vw"?innerWidth*o/100:r==="px"?o:o*16}function s(t){for(let s of i(t)){let t=n(s),i=t>0?s.slice(0,t):"";if(s&&(!i||matchMedia(i).matches))return e(s.slice(t+1))}return innerWidth}function i(t){let e=[],s=0,i=0;for(let n=0;n<=t.length;n++){let r=t.charAt(n);r==="("?s++:r===")"?s--:!s&&(r===","||n===t.length)&&(e.push(t.slice(i,n).trim()),i=n+1)}return e}function n(t){let e=-1;for(let s=0,i=0;s<t.length;s++){let n=t.charAt(s);n==="("?i++:n===")"?i--:!i&&/\s/.test(n)&&(e=s)}return e}function r(e){let i=e.ownerDocument.baseURI||document.baseURI,n=t=>t?new URL(t,i).href:"",r=t(e.getAttribute("srcset")).map(([t,e])=>({url:t,size:parseFloat(e)||1,width:e.endsWith("w")})),o=e.getAttribute("src");o&&!r.some(t=>t.width||t.size===1)&&r.push({url:o,size:1,width:!1});let[l]=r;if(!l)return"";let h=window.devicePixelRatio||1,a=h;return l.width&&(a=s(e.getAttribute("sizes")??"")*h),r.sort((t,e)=>t.size-e.size),n((r.find(t=>t.size>=a)??r.at(-1)??l).url)}function o(t){return typeof t=="number"?new Float32Array(t):new Float32Array(t)}var l=(t,e)=>t[e]??NaN;var h={duration:1,ease:"umber"},a=3e3,u=3e3,d=8;function c(t,e){return t.includes(`data-umber-id="${e}"`)||t.includes(`data-umber-id='${e}'`)||t.includes(`data-umber-id=${e}`)}var f=(t,e)=>t.querySelector(`[data-umber-id="${e.replace(/["\\]/g,"\\$&")}"]`),p=t=>typeof t=="object"&&t!==null&&"querySelector"in t&&typeof t.querySelector=="function",g=t=>typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function";function m(t){let e=t&&typeof t=="object"&&"html"in t?t.html:t;return typeof e=="string"?e?t=>c(e,t):null:p(e)?t=>!!f(e,t):null}function y(t){return t[2]>0&&t[3]>0&&t[0]<window.innerWidth&&t[0]+t[2]>0&&t[1]<window.innerHeight&&t[1]+t[3]>0}var w=t=>t.opacity<=.001&&y(t.rect);function x(e){let s=e.media,i=[e.el.getAttribute("data-umber-src")??""];if(s?.tagName==="IMG"){let e=s;i.push(e.currentSrc,e.getAttribute("src")??"",...t(e.getAttribute("srcset")).map(t=>t[0]))}return i.filter(Boolean).map(t=>new URL(t,document.baseURI).href)}function b(t,e){let s=x(t);return x(e).some(t=>s.includes(t))}var k=t=>{t.morphHidden=!1,t.el.removeAttribute("data-umber-morphing")};function z(t,e){t.Ik&&t.Ik!==e&&k(t.Ik)}function v(t,e){let{from:s,to:i}=t,n=s._s,r=s.rect;if(!i.level&&A(t.originXf)){n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=1,n[5]=0,n[6]=r[0],n[7]=r[1],s.size[0]=r[2],s.size[1]=r[3],s.level=0;return}let o=t.originXf,h=i._s,a=o[8]||1,u=h[8]||1;for(let t=0;t<9;t++){let s=l(o,t)/a;n[t]=s+(l(h,t)/u-s)*e}s.size[0]=t.originSize[0]+(i.size[0]-t.originSize[0])*e,s.size[1]=t.originSize[1]+(i.size[1]-t.originSize[1])*e,s.level=1,s.xfReason=null;let d=s.size[0]/2,c=s.size[1]/2,f=n[2]*d+n[5]*c+n[8],p=s._x;p[0]=(n[0]*d+n[3]*c+n[6])/f-d,p[1]=(n[1]*d+n[4]*c+n[7])/f-c,p[2]=s.size[0],p[3]=s.size[1]}function A(t){return t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===1&&t[5]===0&&t[8]===1}function S(t){return t.sx=NaN,t}function _(t){let{from:e,to:s}=t;e.rect.set(s.rect),e.radius.set(s.radius),e._w=s._w,e._s.set(s._s),e.size.set(s.size),e.opacity=1}function j(t,e,s){let i=t.rect,n=t._x,r=t._s;i[0]+=e,i[1]+=s,n[0]+=e,n[1]+=s,r[0]+=e*r[2],r[1]+=s*r[2],r[3]+=e*r[5],r[4]+=s*r[5],r[6]+=e*r[8],r[7]+=s*r[8]}function I(t){for(let e of t.plays.za.keys()){let s=t.uniforms[e];s&&(s.value=1)}}function C(t,e,s){for(let i of t.plays.za.keys()){let n=t.uniforms[i];n&&typeof n.value=="number"&&n.value<1&&s.to(n,{value:1,duration:Math.max(.3,e),ease:"cubic.out"})}}var R=class{constructor(t){this.host=t;this.snapshots=new Map;this.flights=[];this.parked=new Set;this.later=new Map;this.Ij=0;this.jg=t=>{t.el.isConnected&&this.host.transitions.ongoing&&!t.destroyed||(this.parked.delete(t),t.destroyed||this.wk(t,!0))}}snap(t,e,s=0,i=null){let n=this.host.env.frame,r=t.scrolls?n.scrollX:n.pageX,l=t.scrolls?n.scrollY:n.pageY,h=o(4),a=o(9),u=o(2),d=o(4);return h.set(t.rect),a.set(t._s),u.set(t.size),d.set(t.radius),{plane:t,rect:h,xf:a,size:u,radius:d,ky:t._w,opacity:t.opacity,frozen:e,Ik:i,until:s,sx:r,sy:l,ex:t.doc.x-r,ey:t.doc.y-l}}get busy(){return this.flights.length>0}holds(t){for(let e of this.snapshots.values())if(e.plane===t)return!0;return!1}capture(t,e=!1){e||this.settle(),t&&typeof t.then=="function"&&(this.known(t),t=void 0);let s=m(t);e||this.xa(s),this.rj(s),t&&typeof t=="object"&&!("html"in t)&&this.preload(t),this.snapshots.size&&this.host.scheduler.markDirty()}xa(t){for(let e of this.flights.slice()){if(!t?.(e.id)){_(e),this.finish(e,e.to.drawable());continue}this.flights.splice(this.flights.indexOf(e),1),this.snapshots.set(e.id,S(this.snap(e.from,!0,0,e.to)))}}rj(t){let e=this.host.planes.all,s=e.filter(t=>t.visible).concat(e.filter(t=>!t.visible&&w(t)));for(let e of s){let s=e.el.getAttribute("data-umber-id");!s||e.kind==="layer"||this.snapshots.has(s)||e.status!=="ready"||e.morphHidden||t&&!t(s)||(this.snapshots.set(s,this.snap(e,!!t)),t&&this.host.planes.detach(e))}}known(t){if(g(t)){let e=this.Ij;t.then(t=>{e===this.Ij&&this.known(t)},()=>{});return}let e=m(t);if(e){for(let[t,s]of this.snapshots)s.frozen||s.until||(e(t)?this.host.planes.all.includes(s.plane)&&(this.snapshots.set(t,this.snap(s.plane,!0)),this.host.planes.detach(s.plane)):this.drop(t));typeof t=="object"&&t&&!("html"in t)&&this.preload(t)}}preload(t){for(let e of this.snapshots.keys()){let s=f(t,e),i=s?.matches("img")?s:s?.querySelector("img"),n=i&&!i.parentElement?.querySelector("source")&&r(i);n&&fetch(n,{mode:"cors",credentials:"omit"}).catch(()=>{})}}keep(t){let e=t.el.getAttribute("data-umber-id");return!e||this.snapshots.has(e)||t.kind==="layer"||t.status!=="ready"||t.morphHidden||this.host.env.reducedMotion||!t.visible&&!w(t)?!1:(this.wait(e,this.snap(t,!1,performance.now()+u)),!0)}wait(t,e){let s=[...this.snapshots].filter(([,t])=>t.until).sort((t,e)=>t[1].until-e[1].until),[i]=s;i&&s.length>=d&&this.drop(i[0]),this.snapshots.set(t,e),setTimeout(()=>{this.snapshots.get(t)===e&&this.drop(t)},e.until-performance.now())}drop(t){let e=this.snapshots.get(t);e&&(this.snapshots.delete(t),this.release(e),this.host.scheduler.markDirty())}forget(t){for(let[e,s]of this.snapshots)if(s.plane===t)return this.snapshots.delete(e),!0;return!1}flies(t){return this.snapshots.has(t)||this.flights.some(e=>e.id===t)}claim(t){let e=t.el.getAttribute("data-umber-id");for(let t of this.flights.slice())t.id===e&&!t.to.el.isConnected&&this.xd(t);let s=e?this.snapshots.get(e):void 0,i=this.host;if(!e||!s||t.kind==="layer"||i.env.reducedMotion)return!1;if(!i.env.kit.onScreen(t.el))return i.scheduler.changing&&s.plane.el.isConnected&&this.later.set(e,t),!1;this.later.delete(e),this.snapshots.delete(e),z(s,t);let n=s.plane,r=s.frozen?s:this.snap(n,!1);s.frozen||i.planes.detach(n);let o=this.Bh(e,r,t);return n.opacity=r.opacity,t._D=!0,t.morphHidden=!0,I(t),t.el.setAttribute("data-umber-morphing",""),C(n,o,i.env.tweens),i.scheduler.markDirty(),!0}Bh(t,e,s){let i=this.host.env,n=i.lib.config(s.el,"data-umber-morph",h),r=Math.max(0,n.duration||0);return this.flights.push({id:t,from:e.plane,to:s,origin:e.rect,originXf:e.xf,originSize:e.size,originRadius:e.radius,originKy:e.ky,originOpacity:e.opacity,start:i.now,duration:r,ease:i.kit.ease(n.ease),doneAt:0,same:b(e.plane,s)}),r}retry(){let t=[];for(let[e,s]of this.later){let i=this.snapshots.get(e);i?.plane.el.isConnected&&s.el.isConnected||(this.later.delete(e),i&&s.el.isConnected&&this.host.planes.all.includes(s)&&this.claim(s)?t.push(s):i&&this.drop(e))}return t}xd(t){this.flights.splice(this.flights.indexOf(t),1),k(t.to),this.wait(t.id,S(this.snap(t.from,!0,performance.now()+u)))}settle(t=!0){t&&(this.later.clear(),this.Ij++);for(let[e,s]of this.snapshots)!t&&(s.until||this.later.has(e))||this.drop(e);this.Pa()}Pa(){this.parked.forEach(this.jg)}update(t){if(this.snapshots.size&&this.follow(),this.parked.size&&this.Pa(),!this.flights.length)return!1;for(let e=this.flights.length;e--;){let s=this.flights[e];if(!s)continue;let i=s.to;!this.host.planes.all.includes(i)||i.status==="error"||i.textureState==="error"?this.pd(s):this.fly(s,t)}return!0}pd(t){let{from:e,to:s}=t;s.status!=="error"&&!s.el.isConnected&&(this.host.scheduler.changing||!e.el.isConnected&&this.host.transitions.ongoing)?this.xd(t):this.finish(t,!1)}fly(t,e){let{from:s,to:i}=t,n=t.duration>0?Math.min(1,(e-t.start)/(t.duration*1e3)):1,r=t.ease(n),o=i.rect;for(let e=0;e<4;e++){let n=l(t.origin,e),h=l(t.originRadius,e);s.rect[e]=n+(l(o,e)-n)*r,s.radius[e]=h+(l(i.radius,e)-h)*r}if(s._w=t.originKy+(i._w-t.originKy)*r,v(t,r),s.opacity=t.originOpacity+((this.host.transitions.ongoing?1:i.opacity)-t.originOpacity)*r,n<1)return;t.doneAt||(t.doneAt=e),(i.opacity>=.99||!this.host.transitions.ongoing)&&i.drawable()?this.finish(t,!0):e-t.doneAt>a&&this.finish(t,!1)}follow(){for(let t of this.snapshots.values())t.frozen&&t.sx===t.sx&&this.Yd(t)}Yd(t){let e=t.plane,s=this.host.env.frame,i=e.scrolls?s.scrollX:s.pageX,n=e.scrolls?s.scrollY:s.pageY;if(i===t.sx&&n===t.sy)return;let r=e.el.isConnected?e.el.getBoundingClientRect():null;if(!r?.width){t.sx=NaN;return}let o=e.pinned?r.left-t.ex:t.sx-i,l=e.pinned?r.top-t.ey:t.sy-n;t.sx=i,t.sy=n,t.ex=r.left,t.ey=r.top,!(!o&&!l)&&(j(e,o,l),t.rect.set(e.rect),t.xf.set(e._s),this.host.scheduler.markDirty())}draw(t){if(this.snapshots.size)for(let[e,s]of this.snapshots)s.frozen&&!this.host.planes.all.includes(s.plane)&&!this.drawn(s.plane,t)&&this.drop(e);let e=this.flights;for(let s=0,i=e[0];i;i=e[++s]){let{from:e,to:n}=i,r=e.texture;i.same&&n.texture?.ready&&e.kind==="image"&&(e.texture=n.texture);let o=this.drawn(e,t);e.texture=r,!o&&(this.finish(i,!1),s--)}}drawn(t,e){try{return e(t),!0}catch(e){let s=this.host;return s.env.lib.say("threw",[t.el],e),s.gpu.renderer.reset(),s.chunks.fx?.bind(),!1}}cancel(){for(let t of this.flights.slice())this.finish(t,!1);this.settle(),this.parked.forEach(t=>{this.wk(t,!0)}),this.parked.clear()}finish(t,e){if(this.flights.splice(this.flights.indexOf(t),1),e){t.to.morphHidden=!1;let e=t.to.el;this.host.env.host.loadCovers?.().then(t=>t.landed(e,this.host.canvasHost.el,this.host.env.lib.say),()=>{})}else k(t.to);this.wk(t.from,!e),this.host.scheduler.markDirty()}wk(t,e){t.el.isConnected?this.host.transitions.ongoing&&!e?this.parked.add(t):this.host.planes.attach(t):this.host.planes.discard(t)}release(t){z(t);let e=t.plane;this.host.planes.all.includes(e)||this.wk(e,!0)}};function M(t){return t.chunks.morph=new R(t)}export{M as morph};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var t=.016666666666666666;function s(t,s){let i=1/0;for(let{fps:e}of t)i=e?Math.min(i,typeof e=="string"?100/s/parseFloat(e):1/e):0;return i===1/0?0:i}var i=.1,e=8;function h(){let t=typeof document>"u"?null:document.timeline.currentTime;return typeof t=="number"?performance.now()-t:-1}var r=[1,.85,.7,.55],n=2,a=45,l=150,o=15,d=4,u=60,f=.9,c=3;function m(t,s,i,{dt:e,busy:r=h()}){return t<0&&r>e*1e3-s?0:t<0?i?a/l:1:t>s*.6?1:0}var g=class{constructor(s){this.callbacks=s;this.scale=1;this.index=0;this.settle=30;this.te=!1;this.slowFrames=0;this.Xi=0;this.refresh=t;this.last=1/0;this.from=0;this.qj=150;this.fk=-1;this.drawnAt=-1;this.gaps=[];this.chosen=0;this.always=[];this.asked=0;this.time=0;this.count=0;this.squares=0;this.Cl=0;this.low=0;this.uj=!1;this.ef=!1;this.flipped=!1;this.before=0}frame(t,s,i,e){let h=t.frame-this.fk===1;this.fk=t.frame,this.learn(t,h);let n=h?Math.max(this.last,t.dt):1/0;this.last=t.dt,n<this.refresh&&(this.refresh=n);let o=this.refresh,d=t.dt*60;if(this.settle>0||s)return this.settle=Math.max(0,this.settle-d),!1;if(!h)return!1;if(this.before)return this.weigh(t.dt,e);let u=Math.max(this.asked,this.chosen);if(u&&i<0&&t.dt<=u*1.5)return!1;this.tally(t.dt,d,m(i,o*1e3,e,t)),this.slowFrames?this.add(t.dt):this.time=this.count=this.squares=0;let f=e?a:l;if(this.slowFrames>f&&this.index<r.length-1&&!this.te){this.qj=Math.min(this.qj*2,2400),this.flipped=this.ef;let t=this.time/this.count,s=this.spread();return this.from=this.index,this.setIndex(this.index+1),this.before=t,this.Cl=s,!0}return this.Xi>this.qj&&this.index>0?(this.ef=!0,this.setIndex(this.index-1),!0):!1}learn({time:t,dt:h},r){let n=this.callbacks?.entries().filter(t=>t.always)??[];if(this.asked=s(n,this.callbacks?.fps??60),(n.length!==this.always.length||n.some((t,s)=>t!==this.always[s]))&&(this.always=n,this.chosen=0,this.gaps.length=0),t===void 0)return;let a=this.drawnAt<0?-1:t-this.drawnAt;if(this.drawnAt=t,r){this.chosen&&h<this.chosen*.75&&(this.chosen=0),this.chosen||(this.gaps.length=0);return}if(a<=0||a>=i){this.gaps.length=0;return}let l=this.gaps;l.push(a),l.length>e&&l.shift(),l.length===e&&Math.max(...l)-Math.min(...l)<=this.refresh*1.5&&(this.chosen=l.reduce((t,s)=>t+s,0)/e)}tally(t,s,i){if(t>this.refresh*1.5){let t=Math.min(s,o);this.slowFrames+=i*t,this.Xi=Math.max(0,this.Xi-d*t)}else{let i=t<this.refresh*1.2;(i||!this.flipped)&&(this.Xi+=s),i&&(this.slowFrames=Math.max(0,this.slowFrames-s))}}weigh(t,s){if(this.add(t),this.time*60<u)return!1;let{before:i,index:e,from:h,Cl:a,low:l}=this,o=this.time/this.count,d=this.spread(),m=c*Math.sqrt(a+d);if(l){let t=i<o*f-m;return this.low=0,this.uj=t,this.te=!t,this.setIndex(t?l:e),t}if(o<i*f-m){let t=s||this.uj;return this.setIndex(t?e:h),t?!1:(this.low=e,this.before=o,this.Cl=d,!0)}let g=e-h<n&&e<r.length-1;return this.te=!g,this.setIndex(g?e+1:h),g&&(this.before=i,this.Cl=a),!0}add(t){this.time+=t,this.count++,this.squares+=t*t}spread(){let t=this.time/this.count;return Math.max(0,this.squares/this.count-t*t)/this.count}hj(){this.settle=30,this.slowFrames=0,this.Xi=0,this.time=0,this.count=0,this.squares=0}rest(t){this.settle=Math.max(this.settle,t)}reset(){this.refresh=t,this.last=1/0,this.settle=30,this.te=!1,this.before=this.low=0,this.ef=this.flipped=this.uj=!1}setIndex(t){this.index=t,this.scale=r[t]??1,this.before=0,this.hj()}};var p=t=>t;var w=class{constructor(t){this.gl=t;this.ms=-1;this.pending=[];this.active=null;this.$i=t.getExtension("EXT_disjoint_timer_query_webgl2")}get supported(){return!!this.$i}begin(){if(!this.$i||this.active||this.pending.length>3)return;let t=p(this.gl.createQuery());t&&(this.gl.beginQuery(this.$i.TIME_ELAPSED_EXT,t),this.active=t)}end(){!this.$i||!this.active||(this.gl.endQuery(this.$i.TIME_ELAPSED_EXT),this.pending.push(this.active),this.active=null)}poll(){let t=this.gl;if(!this.$i)return;let s=t.getParameter(this.$i.GPU_DISJOINT_EXT),i=this.pending[0];for(;i!==void 0&&t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE);){let e=t.getQueryParameter(i,t.QUERY_RESULT);s||(this.ms=e/1e6),t.deleteQuery(i),this.pending.shift(),i=this.pending[0]}}dispose(){this.active&&this.end(),this.pending.forEach(t=>{this.gl.deleteQuery(t)}),this.pending=[]}};export{g as AdaptiveResolution,w as GPUTimer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e=()=>{};function a({loops:e,natives:a}){let{queue:n,ours:o}=e,{raf:t,caf:r}=a;if(!(!n||!o||!t||!r)){window.requestAnimationFrame===o[0]&&(window.requestAnimationFrame=t),window.cancelAnimationFrame===o[1]&&(window.cancelAnimationFrame=r),e.queue=e.wake=e.ours=null;for(let e of n.values())t(e);delete a.raf,delete a.caf}}var n="page loops";function o(o,t){let{loops:r,run:l}=t,{queue:i}=r;if(!i)return e;let u=new WeakMap,m=e=>(a,n)=>{let o=u.get(a);o||(o={label:a.name||"page loop",phase:-1,order:0,page:!0},u.set(a,o)),e(o,n)};r.wake=()=>{o.wakePage()},window.cancelAnimationFrame(r.pump),r.pump=0;let p=o.add(()=>{let{meter:e}=o;l(o.stamp,e&&m(e))},{label:n},!0);return i.size&&o.wakePage(),()=>{p(),a(t)}}export{n as PAGE_LOOPS,o as drive};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
function e(e,a,r){let[n]=r.levels,i=e.createTexture();if(!n||!i)return;e.bindTexture(e.TEXTURE_2D,i),e.pixelStorei(e.UNPACK_ALIGNMENT,1);let l=0;r.levels.forEach((t,a)=>{r.format?e.compressedTexImage2D(e.TEXTURE_2D,a,r.format,t.width,t.height,0,t.data):e.texImage2D(e.TEXTURE_2D,a,e.RGBA,t.width,t.height,0,e.RGBA,e.UNSIGNED_BYTE,t.data),l+=t.data.byteLength}),e.pixelStorei(e.UNPACK_ALIGNMENT,4);let o=r.levels.length>1;o||r.format?e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAX_LEVEL,r.levels.length-1):(e.generateMipmap(e.TEXTURE_2D),l*=4/3);let s=o||!r.format;e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,s?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),a.adopt(i,{width:n.width,height:n.height,bytes:l,mipmaps:s});for(let e of r.levels)t(e.data.buffer)}function t(e){e.byteLength&&e.transfer?.(0)}var a=e=>fetch(e,e.startsWith(location.origin+"/")?{mode:"no-cors",credentials:"include"}:{});function r(e,t){let r=t.get(e);return r||(r=a(e).then(e=>e.ok?e.json():null).catch(()=>null),t.set(e,r)),r}var n={flag:2,name:"bc7",extension:"EXT_texture_compression_bptc",gl:[36492,36492],block:[16,16],vk:[145,145],samples:[1,1],whole:!0,side:4,slot:0},i={...n,name:"bc1",extension:"WEBGL_compressed_texture_s3tc",gl:[33776,33776],block:[8,8],vk:[131,131]},l={flag:8,name:"etc2",extension:"WEBGL_compressed_texture_etc",gl:[37492,37496],block:[8,16],vk:[147,151],samples:[1,2],whole:!1,side:4,slot:2},o={4:[37808,157],5:[37810,161],6:[37812,165],8:[37815,171],10:[37819,179],12:[37821,183]};function s([,,,,,e,t=4]){let[a=37808,r=157]=o[t]??[],s={...n,flag:4,name:"astc",extension:"WEBGL_compressed_texture_astc",gl:[a,a],vk:[r,r],whole:!1,side:t};return[e&32?i:n,s,l].filter(t=>e&t.flag)}var h=[171,75,84,88,32,50,48,187,13,10,26,10],f=new Map,m=(e,t=f)=>r(e,t).then(e=>e?.v===1?e:null),u=new WeakMap;function c(e,t){let a=u.get(e);a||u.set(e,a=new Map);let r=a.get(t);return r===void 0&&a.set(t,r=!!e.getExtension(t)),r}var g=e=>Math.ceil(e/16)*16,E=(e,t)=>Math.max(1,e>>t);function d(e){let t=4;return e>=512?t=32:e>=256&&(t=16),Math.max(4,Math.floor((e+t/2)/t)*t)}function w(e,t,a,r){let n=e.whole?d(a):a,i=e.whole?d(r):r;return{format:e,alpha:t,w:n,h:i,count:Math.floor(Math.log2(Math.max(n,i,1)))+1}}function T({format:e,alpha:t,w:a,h:r,count:n},i){let l=g(80+24*n+4+24+16*e.samples[t]);for(let o=n-1;o>=i;o--)l=g(l+Math.ceil(E(a,o)/e.side)*Math.ceil(E(r,o)/e.side)*e.block[t]);return l}function _({format:e,w:t,h:a,count:r},n,i){let[l=0,o=0]=n,s=r=>!e.whole||E(t,r)%4===0&&E(a,r)%4===0,h=0;for(;h+1<r&&Math.max(E(t,h),E(a,h))>i;)h++;for(let e=h+1;l&&e<r&&!(E(t,e)<l||E(a,e)<o);e++)s(e)&&(h=e);for(;h>0&&!s(h);)h--;return h}async function R(e){let a=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate")).getReader(),r=[],n=0;for(;;){let{done:e,value:t}=await a.read();if(e)break;r.push(t),n+=t.length}let i=new Uint8Array(n),l=0;for(let e of r)i.set(e,l),l+=e.length,t(e.buffer);return i}async function U(e,t,a){let r=new Uint8Array(e),n=new DataView(e);if(r.length<80||h.some((e,t)=>r[t]!==e)||n.getUint32(12,!0)!==t)throw new Error("not the KTX2 file the manifest names");let i=n.getUint32(20,!0),l=n.getUint32(24,!0),o=n.getUint32(40,!0),s=n.getUint32(44,!0)===3,f=[];for(let e=a;e<o;e++){let t=80+24*e,a=Number(n.getBigUint64(t,!0)),o=Number(n.getBigUint64(t+8,!0));if(a+o>r.length)throw new Error("the file ends early");let s=r.subarray(a,a+o);f.push({width:E(i,e),height:E(l,e),data:s})}return s&&await Promise.all(f.map(async e=>e.data=await R(e.data))),f}function p(e,t,a){if(!a?.length)return T(e,t);let r=a[0]??0;for(let e=0;e<Math.min(t,3);e++)r-=a[e+1]??0;return r}async function x(e,a){let r=new URL(a.manifest,document.baseURI),n=await m(r.href,a.reads),i=new URL(a.src,document.baseURI),l=i.origin===r.origin?n?.images[i.pathname]:void 0;if(!l)return null;let[o,h,f,u,g,E]=l,d=e=>new URL(`${o}.${e}`,r).href,T=l[7],R=!T||"DecompressionStream"in globalThis?s(l).find(t=>c(e,t.extension)):void 0;if(!R)return E&16?{avif:d("avif")}:null;let x=w(R,E&1?1:0,u,g),v=_(x,a.size(),a.maxTexture),b;try{let e=await fetch(d(`${R.name}.ktx2`),{credentials:"same-origin",headers:v?{Range:`bytes=0-${p(x,v,T?.[R.slot])-1}`}:{}});if(!e.ok)throw new Error(`HTTP ${e.status}`);let a=await e.arrayBuffer();b=await U(a,R.vk[x.alpha],v),b[0]?.data.buffer!==a&&t(a)}catch(e){if(E&16)return{avif:d("avif")};throw e}let[M]=b;if(!M)throw new Error("no levels");return{image:{width:M.width,height:M.height,format:R.gl[x.alpha],levels:b},box:v?[M.width,M.height,h,f]:[0,0,h,f]}}async function v(t,a,r){let n=new URL(r.manifest,document.baseURI),i=new URL(r.src,document.baseURI),l=(i.origin===n.origin?await m(n.href,r.reads):null)?.images[i.pathname]?.[5];if(l===void 0||(l&65)!==64)return!1;let o=t.getParameter(t.MAX_TEXTURE_SIZE),s=await x(t,{...r,size:()=>[],maxTexture:o});return!s||!("image"in s)?!1:(e(t,a,s.image),!0)}export{x as get,_ as levelFor,m as manifestAt,T as prefix,U as read,v as uniform,e as upload};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e="page loops";function r(e=""){let r=new CSSStyleSheet;return r.replaceSync(e),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],r}function t(e){e&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==e))}var o=1/60,a=3e3,l=250,n=["step","measure","update","render"],p=[280,200,145,32],i={"top-left":"top: 8px; left: 8px;","top-right":"top: 8px; right: 8px;","bottom-left":"bottom: 8px; left: 8px;","bottom-right":"bottom: 8px; right: 8px;"},s=`\n.umber-profiler {\n position: fixed; z-index: 2147483647; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box;\n padding: 8px 10px 9px; border-radius: 8px;\n background: rgba(12, 12, 14, 0.86); color: #e8e8ea;\n -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);\n box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.35);\n font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-variant-numeric: tabular-nums; letter-spacing: 0; text-align: left; pointer-events: auto;\n}\n.umber-profiler * { box-sizing: border-box; margin: 0; padding: 0; font: inherit; color: inherit; }\n.umber-profiler__head { display: flex; align-items: center; gap: 8px; color: #fff; }\n.umber-profiler__head span:first-of-type { flex: 1 1 auto; }\n.umber-profiler__head span:last-of-type { color: #8a8a90; }\n.umber-profiler button {\n width: 18px; height: 18px; border: 0; border-radius: 4px; background: rgba(255,255,255,0.1); cursor: pointer;\n}\n.umber-profiler__bar { position: relative; display: flex; height: 10px; margin: 6px 0; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,0.06); }\n.umber-profiler__bar i { display: block; height: 100%; min-width: 1px; }\n.umber-profiler__bar.is-over { box-shadow: inset 0 0 0 1px #f87171; }\n.umber-profiler__row { display: flex; gap: 8px; white-space: nowrap; }\n.umber-profiler__row b { flex: 0 0 64px; font-weight: 400; color: #8a8a90; overflow: hidden; }\n.umber-profiler__row span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }\n.umber-profiler__row em { font-style: normal; color: #8a8a90; }\n.umber-profiler__row span:last-child { flex: 0 0 auto; }\n`,d=null,u=(e,r="",t="")=>Object.assign(document.createElement(e),{className:r,textContent:t}),f=e=>"page"in e;function b(e){if(f(e))return{label:e.label,phase:e.phase,order:e.order,rate:"page"};let r=e;return{label:r.label??(r.fn.name||"callback"),phase:r.phase,order:r.order,rate:c(r.fps)}}function m(e){return e===1/0?"last":e===-1/0?"first":String(e)}function c(e){return e===void 0?"":typeof e=="number"?`${e} fps`:e}function x(r,t={}){let l=new Map,p=0,i=()=>[...l.values()].sort((e,r)=>e.phase-r.phase||e.order-r.order),s=()=>{let e=performance.now();p=0;for(let r of l.values())r.cost+=(r.frame-r.cost)*o,p+=r.cost,r.frame=0,e-r.seen>a&&l.delete(r.key)};r.meter=(r,t)=>{if(r.fn===s||r.label===e)return;let o=l.get(r);o||(o={key:r,...b(r),cost:t,frame:0,seen:0},l.set(r,o)),o.frame+=t,o.seen=performance.now()};let d=r.add(s,{order:-1/0,always:!1},!0),u=()=>i().map(e=>({label:e.label,phase:n[e.phase+1]??"update",order:e.order,rate:e.rate,ms:e.cost})),f=()=>{d(),r.meter=null};if(t.panel===!1)return{read:u,destroy:f};let m=h(r,t,i,()=>p);return{read:u,destroy(){f(),m()}}}function h(e,o,a,f){d??=r(s);let b=u("div","umber-profiler");b.style.cssText=i[o.corner??"top-right"],b.setAttribute("data-umber-profiler","");let c=u("div","umber-profiler__head"),x=u("button");x.type="button";let h=u("span","","frame"),g=u("span");c.append(x,h,g);let y=u("div","umber-profiler__bar"),_=u("div");b.append(c,y,_),document.body.appendChild(b);let w=()=>{x.textContent=e.paused?"\u25b6":"\u2759\u2759",x.setAttribute("aria-label",e.paused?"Play the loop":"Pause the loop")};x.addEventListener("click",()=>{e.paused?e.play():e.pause(),w()});let v=()=>{w();let r=1e3/e.fps,t=a(),o=f();g.textContent=`${Math.round(e.fps)} fps ${o.toFixed(2)} / ${r.toFixed(1)} ms`,y.classList.toggle("is-over",o>r);let l=Math.max(r,o);y.replaceChildren(...t.map(e=>{let r=u("i");return r.style.width=`${e.cost/l*100}%`,r.style.background=`hsl(${p[e.phase+1]??0} 70% ${e.key===t[0]?.key?58:50}%)`,r.title=`${e.label} ${e.cost.toFixed(2)} ms`,r})),_.replaceChildren(...t.map(e=>{let r=u("div","umber-profiler__row");return r.append(u("b","",`${n[e.phase+1]??""} ${m(e.order)}`),u("span","",e.label),u("em","",e.rate),u("span","",`${e.cost.toFixed(2)} ms`)),r}))};v();let S=setInterval(v,l);return()=>{clearInterval(S),b.remove(),t(d),d=null}}export{x as profile};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e=(e,t)=>({resizeWidth:e,resizeHeight:t,resizeQuality:"high"});function t(e,t){let a=new Uint8Array(t.width*t.height*4);return e.bindTexture(e.TEXTURE_2D,e.createTexture()),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.bindFramebuffer(e.FRAMEBUFFER,e.createFramebuffer()),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,e.getParameter(e.TEXTURE_BINDING_2D),0),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,a),t.close(),a}var a;function r(){return a??=(async()=>{let a=document.createElement("canvas");a.width=a.height=32;let r=a.getContext("2d"),i=document.createElement("canvas").getContext("webgl2");if(!r||!i)return!1;r.fillStyle="#e33",r.arc(13,16,10,0,7),r.fill(),r.fillStyle="rgba(40,220,90,.5)",r.fillRect(16,5,11,22);let n=await new Promise(e=>{a.toBlob(e)});if(!n)return!1;let l={premultiplyAlpha:"premultiply"},o=t(i,await createImageBitmap(n,{...l,...e(12,12)})),c=await createImageBitmap(n,l),u=t(i,await createImageBitmap(c,e(12,12)));return c.close(),i.getExtension("WEBGL_lose_context")?.loseContext(),o.every((e,t)=>e===u[t])})().catch(()=>!1)}var i=(e,t)=>(e[t]??0)*2**24+((e[t+1]??0)<<16)+((e[t+2]??0)<<8)+(e[t+3]??0)>>>0;async function n(e){let t=new Uint8Array(await e.slice(0,16384).arrayBuffer()),a="";for(let e of t)a+=String.fromCharCode(e);if(e.type==="image/png"){let e=a.indexOf("IDAT");return(t[25]===2||t[25]===0)&&e>0&&!a.slice(0,e).includes("tRNS")}if(e.type==="image/webp"){let e=a.slice(12,16);return e==="VP8 "?!0:e==="VP8L"?!((t[24]??16)&16):e==="VP8X"&&!((t[20]??16)&16)}if(e.type==="image/avif"){let e=i(t,0);return a.slice(e+4,e+8)==="meta"&&e+i(t,e)<=t.length&&!/auxiliary:alpha|auxid:1/.test(a)}return!1}async function l(t,a,i,l){let o=e(Math.max(1,Math.round(a.width*i)),Math.max(1,Math.round(a.height*i))),c=t.type==="image/jpeg"||await r()||await n(t),u=await createImageBitmap(c?t:a,c?{...l,...o}:o);return a.close(),u}async function o(e,t){let a=await new Promise((t,a)=>{let r=new Image;r.crossOrigin="anonymous",r.decoding="async",r.onload=()=>{t(r)},r.onerror=()=>{a(new Error(`could not load ${e}`))},r.src=e}),r=a.width,i=a.height,n=t(r,i);if(n===1||!r)return a;let l=document.createElement("canvas");l.width=Math.round(r*n)||1,l.height=Math.round(i*n)||1;let o=l.getContext("2d");return o?(o.drawImage(a,0,0,l.width,l.height),l):a}export{n as opaque,l as resize,r as sameBothWays,o as viaImg};
|
package/dist/chunks/restore.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Umber v0.
|
|
2
|
-
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
var e=e=>(e>3?192:96)*2**20;function t(t){if(t.gpu.context.state!=="lost"||t.env.destroyed||t.gpu.gl.isContextLost())return;t.gpu.context.state="live";let o=t.gpu.tier;o.textureBudget=Math.max(e(o.level),o.textureBudget/2),t.gpu.media.Zk();for(let e of t.gpu.subsystems)e.restored?.();t.planes.all.some(e=>e.layer)&&t.chunks.layers?.fade.get();let s=t.gpu.media.Ef;t.gpu.media.Ef=new Map;let l=e=>[e.zone.screen,e.zone.soon,e.zone.near,!0].indexOf(!0);for(let e of[...t.planes.all].sort((e,t)=>l(e)-l(t)))r(t,e,s),a(t,e);t.factory.invalidate(),t.scheduler.wake(2),t.chunks.views?.restored(),t.env.host.emit("restored")}function r(e,t,r){for(let a of Object.values(t.uniforms)){let t=r.get(a.value);t&&(a.value=e.gpu.media.Wk(t))}}function a(e,t){if(t.status==="error"){t._E&&e.gpu.programs.prepare(t);return}if(t.setStatus(e.scheduler.inactive?null:"loading"),t._l[0]=NaN,t.wait(),t.layer){t.zone.near&&e.factory.load(t);return}e.gpu.programs.prepare(t),t.shader?t.textureState="ready":t.zone.near&&e.factory.load(t),t.modules.tell(e=>e.restored?.())}export{t as restored};
|
package/dist/chunks/shapes.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Umber v0.
|
|
2
|
-
function D(t,e){let n=e[0],r=e[1],o=e[2],i=e[3],s=e[4],a=e[5],l=e[6],c=e[7],f=e[8],u=s*f-a*c,p=-(i*f-a*l),d=i*c-s*l,h=n*u+r*p+o*d;if(!h||!Number.isFinite(h))return!1;let m=1/h;return t[0]=u*m,t[1]=-(r*f-o*c)*m,t[2]=(r*a-o*s)*m,t[3]=p*m,t[4]=(n*f-o*l)*m,t[5]=-(n*a-o*i)*m,t[6]=d*m,t[7]=-(n*c-r*l)*m,t[8]=(n*s-r*i)*m,!0}function Te(t,e,n,r,o){return t.fill(0),t[0]=r,t[4]=o,t[6]=e,t[7]=n,t[8]=1,t}function S(t,e){let n=t.trim();if(n.startsWith("calc(")&&n.endsWith(")"))n=n.slice(5,-1).trim();else if(n.includes("("))return NaN;let r=0,o=1,i=!0;for(let s of n.split(/\s+/)){if(!s)continue;if(!i){if(s==="+")o=1;else if(s==="-")o=-1;else return NaN;i=!0;continue}let a=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px|%)?$/i.exec(s);if(!a)return NaN;let l=parseFloat(a[1]);if(!a[2]&&l!==0)return NaN;r+=o*(a[2]==="%"?l/100*e:l),i=!1}return i?NaN:r}function L(t){let e=[],n=0,r="";for(let o of t.trim())o==="("?n++:o===")"&&n--,/\s/.test(o)&&n===0?(r&&e.push(r),r=""):r+=o;return r&&e.push(r),e}function lt(t){let e=[],n=0,r="";for(let o of t)o==="("?n++:o===")"&&n--,o===","&&n===0?(e.push(r.trim()),r=""):r+=o;return e.push(r.trim()),e}function ee(t,e,n){let r=[],o=[];for(let i of t){let s=L(i||"0px"),a=S(s[0]||"0px",e),l=S(s[1]??s[0]??"0px",n);if(!Number.isFinite(a)||!Number.isFinite(l))return null;let c=a<=0||l<=0;r.push(c?0:a),o.push(c?0:l)}return de({rx:r,ry:o},e,n)}function de(t,e,n){let r=[[e,t.rx[0]+t.rx[1]],[n,t.ry[1]+t.ry[2]],[e,t.rx[2]+t.rx[3]],[n,t.ry[3]+t.ry[0]]],o=1;for(let[i,s]of r)s>0&&(o=Math.min(o,Math.max(i,0)/s));if(o<1)for(let i=0;i<4;i++)t.rx[i]*=o,t.ry[i]*=o;return t}function fe(t,e,n,r){let[o,i,s,a]=e,l=[a,i,i,a],c=[o,o,s,s],f={rx:[0,0,0,0],ry:[0,0,0,0]};for(let u=0;u<4;u++)t.rx[u]<=0||t.ry[u]<=0||(f.rx[u]=Math.max(0,t.rx[u]-l[u]),f.ry[u]=Math.max(0,t.ry[u]-c[u]));return de(f,n,r)}function he(t){let e=0;for(let n=0;n<4;n++){if(t.rx[n]<=0||t.ry[n]<=0)continue;let r=t.rx[n]/t.ry[n];if(!e)e=r;else if(Math.abs(t.rx[n]/e-t.ry[n])>1)return NaN}return e||1}var ct=8;function ut(t,e){let[n,r,o,i]=e.border,[s,a,l,c]=e.padding,[f,u,p,d]=e.margin;switch(t){case"padding-box":return{x:i,y:n,w:e.w-i-r,h:e.h-n-o,edges:[n,r,o,i]};case"content-box":case"fill-box":return{x:i+c,y:n+s,w:e.w-i-r-c-a,h:e.h-n-o-s-l,edges:[n+s,r+a,o+l,i+c]};case"margin-box":return{x:-d,y:-f,w:e.w+d+u,h:e.h+f+p,edges:[-f,-u,-p,-d]};default:return{x:0,y:0,w:e.w,h:e.h,edges:[0,0,0,0]}}}var dt=/\s*\b(border-box|padding-box|content-box|margin-box|fill-box|stroke-box|view-box)\s*$/;function te(t,e,n,r,o){let i=o||{rx:[0,0,0,0],ry:[0,0,0,0]},s=he(i);return Number.isFinite(s)?{shape:{kind:0,box:[t,e*s,Math.max(0,n),Math.max(0,r)*s],radius:i.rx.slice(),points:null,ky:s}}:{reason:"mixed-corners"}}function ft(t){let[e,n]=t.split("/").map(s=>L(s)),r=s=>{let[a,l=a,c=a,f=l]=s;return[a,l,c,f]},o=r(e),i=n?r(n):o;return o.map((s,a)=>`${s} ${i[a]}`)}function ue(t,e){let[n,r]=t.split(/\bround\b/),o=L(n),[i,s=i,a=i,l=s]=o,c=S(i,e.h),f=S(s,e.w),u=S(a,e.h),p=S(l,e.w);if(![c,f,u,p].every(Number.isFinite))return{reason:"unparsed"};let d=Math.max(0,e.w-p-f),h=Math.max(0,e.h-c-u),m=null;if(r){let b=ee(ft(r),e.w,e.h);if(!b)return{reason:"unparsed"};m=de(b,d,h)}return te(e.x+p,e.y+c,d,h,m)}function ht(t,e){let n={left:[0,"x"],right:[1,"x"],top:[0,"y"],bottom:[1,"y"],center:[.5,""]};if(!t.length)return[e.w/2,e.h/2];if(t.length===1&&(t=[t[0],"center"]),t.length===2){let[r,o]=t;(n[r]?.[1]==="y"||n[o]?.[1]==="x")&&([r,o]=[o,r]);let i=n[r]?n[r][0]*e.w:S(r,e.w),s=n[o]?n[o][0]*e.h:S(o,e.h);return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(t.length===4){let r=[[t[0],t[1]],[t[2],t[3]]];n[r[0][0]]?.[1]==="y"&&(r=[r[1],r[0]]);let o=([a,l],c)=>{let f=S(l,c);return a==="right"||a==="bottom"?c-f:f},i=o(r[0],e.w),s=o(r[1],e.h);return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}return null}function J(t,e,n,r){return!t||t==="closest-side"?Math.min(Math.abs(e),Math.abs(n-e)):t==="farthest-side"?Math.max(Math.abs(e),Math.abs(n-e)):S(t,r)}function mt(t,e,n){let[r,o]=e.split(/\bat\b/),i=L(r),s=ht(L(o||""),n);if(!s)return{reason:"unparsed"};let[a,l]=s,c,f;if(t==="circle"){let h=i[0];c=f=!h||h.endsWith("-side")?(h==="farthest-side"?Math.max:Math.min)(J(h,a,n.w,0),J(h,l,n.h,0)):S(h,Math.hypot(n.w,n.h)/Math.SQRT2)}else c=J(i[0],a,n.w,n.w),f=J(i[1],l,n.h,n.h);if(!Number.isFinite(c)||!Number.isFinite(f))return{reason:"unparsed"};c>0&&f>0||(c=f=0);let u=f>0?c/f:1,p=n.x+a,d=(n.y+l)*u;return{shape:{kind:0,box:[p-c,d-c,2*c,2*c],radius:[c,c,c,c],points:null,ky:u}}}function pt(t,e,n,r,o,i,s,a){let l=(s-o)*(e-i)-(a-i)*(t-o),c=(s-o)*(r-i)-(a-i)*(n-o),f=(n-t)*(i-e)-(r-e)*(o-t),u=(n-t)*(a-e)-(r-e)*(s-t);return l*c<0&&f*u<0}function bt(t){let e=t.length/2;for(let n=0;n<e;n++){let r=(n+1)%e;for(let o=n+1;o<e;o++){let i=(o+1)%e;if(!(n===i||r===o)&&pt(t[n*2],t[n*2+1],t[r*2],t[r*2+1],t[o*2],t[o*2+1],t[i*2],t[i*2+1]))return!0}}return!1}function gt(t,e){let n=lt(t),r=!1;(n[0]==="evenodd"||n[0]==="nonzero")&&(r=n.shift()==="evenodd");let o=[];for(let i of n){let[s,a]=L(i),l=S(s||"",e.w),c=S(a||"",e.h);if(!Number.isFinite(l)||!Number.isFinite(c))return{reason:"unparsed"};o.push(e.x+l,e.y+c)}if(o.length===8){let i=[o[0],o[2],o[4],o[6]],s=[o[1],o[3],o[5],o[7]],a=!0;for(let p=0;p<4;p++){let d=(p+1)%4;i[p]!==i[d]&&s[p]!==s[d]&&(a=!1)}let l=Math.min(...i),c=Math.max(...i),f=Math.min(...s),u=Math.max(...s);if(a&&new Set(i).size<=2&&new Set(s).size<=2)return te(l,f,c-l,u-f,null)}return o.length/2>ct?{reason:"polygon-points"}:!r&&bt(o)?{reason:"polygon-nonzero"}:{shape:{kind:1,box:[0,0,0,0],radius:[0,0,0,0],points:o,ky:1}}}function Oe(t,e){let n=(t||"none").trim();if(n==="none"||n==="")return null;let r="border-box",o=dt.exec(n);o&&(r=o[1],n=n.slice(0,o.index).trim());let i=ut(r,e);if(!n){let c=ee(e.radius,e.w,e.h);return c?te(i.x,i.y,i.w,i.h,fe(c,i.edges,i.w,i.h)):{reason:"unparsed"}}let s=/^([a-z-]+)\((.*)\)$/s.exec(n);if(!s)return{reason:"unsupported"};let[,a,l]=s;if(/\b(min|max|clamp|var|env)\(/.test(l))return{reason:"unparsed"};switch(a){case"inset":return ue(l,i);case"rect":{let[c,f,u,p]=L(l.split(/\bround\b/)[0]),d=(w,A,v)=>w==="auto"?v:S(w,A),h=d(c,i.h,0),m=i.w-d(f,i.w,i.w),b=i.h-d(u,i.h,i.h),g=d(p,i.w,0),y=l.split(/\bround\b/)[1];return ue(`${h}px ${m}px ${b}px ${g}px${y?` round ${y}`:""}`,i)}case"xywh":{let[c,f,u,p]=L(l.split(/\bround\b/)[0]).map((h,m)=>S(h,m%2?i.h:i.w)),d=l.split(/\bround\b/)[1];return ue(`${f}px ${i.w-c-u}px ${i.h-f-p}px ${c}px${d?` round ${d}`:""}`,i)}case"circle":case"ellipse":return mt(a,l,i);case"polygon":return gt(l,i);default:return{reason:"unsupported"}}}function He(t,e,n){let r=/^rect\((.*)\)$/.exec((t||"auto").trim());if(!r)return null;let o=r[1].split(/\s*,\s*|\s+/).filter(Boolean);if(o.length!==4)return{reason:"unparsed"};let i=(f,u)=>f==="auto"?u:S(f,0),s=i(o[0],0),a=i(o[1],e),l=i(o[2],n),c=i(o[3],0);return[s,a,l,c].every(Number.isFinite)?te(c,s,a-c,l-s,null):{reason:"unparsed"}}function ze(t,e,n,r,o=0){let i=n[0],s=n[1],a=n[2],l=n[3],c=Array.from(r),f=1;for(let g=0;g<4;g++)f=Math.min(f,(g%2?l:a)/Math.max(c[g]+c[(g+1)%4],1e-5));let u=t-i,p=e-s,d=Math.abs(u-a/2)-a/2,h=Math.abs(p-l/2)-l/2,m=Math.hypot(Math.max(d,0),Math.max(h,0))+Math.min(Math.max(d,h),0),b=[u,p,a-u,p,a-u,l-p,u,l-p];for(let g=0;g<4;g++){let y=c[g]*f,w=b[g*2],A=b[g*2+1];Math.max(w,A)<y&&(m=Math.max(m,Math.hypot(w-y,A-y)-y))}return m<=o}function Be(t,e,n){let r=n.length/2,o=!1;for(let i=0,s=r-1;i<r;s=i++){let a=n[i*2],l=n[i*2+1],c=n[s*2],f=n[s*2+1];l>e!=f>e&&t<(c-a)*(e-l)/(f-l)+a&&(o=!o)}return o}var R=t=>parseFloat(t||"0")||0;function yt(t){try{return t.matches(":modal")||t.matches(":popover-open")}catch{return!1}}function xt(t,e){let n=e.get(t);if(n)return n;let r=getComputedStyle(t),o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none"||r.maskBorderSource&&r.maskBorderSource!=="none"||r.webkitMaskBoxImageSource&&r.webkitMaskBoxImageSource!=="none";return n={el:t,tag:t.localName||t.tagName.toLowerCase(),display:r.display,position:r.position||"static",overflowX:r.overflowX||"visible",overflowY:r.overflowY||"visible",contain:r.contain||"none",contentVisibility:r.contentVisibility||"visible",willChange:r.willChange||"auto",filter:r.filter||"none",backdropFilter:r.backdropFilter||r.webkitBackdropFilter||"none",clipPath:r.clipPath||"none",clip:r.clip||"auto",mask:!!o,transform:r.transform||"none",translate:r.translate||"none",rotate:r.rotate||"none",scale:r.scale||"none",perspective:r.perspective||"none",transformOrigin:r.transformOrigin||"",perspectiveOrigin:r.perspectiveOrigin||"",transformStyle:r.transformStyle||"flat",backfaceVisibility:r.backfaceVisibility||r.webkitBackfaceVisibility||"visible",offsetPath:r.offsetPath||"none",opacity:r.opacity||"1",isolation:r.isolation||"auto",mixBlendMode:r.mixBlendMode||"normal",zoom:r.zoom||"1",topLayer:yt(t)},e.set(t,n),n}function pe(t,e){if(e.has(t.el))return;e.add(t.el);let n=getComputedStyle(t.el);t.transform=n.transform||"none",t.translate=n.translate||"none",t.rotate=n.rotate||"none",t.scale=n.scale||"none",t.transformOrigin=n.transformOrigin||"",t.perspective=n.perspective||"none",t.perspectiveOrigin=n.perspectiveOrigin||"",t.box=void 0}function be(t,e,n,r,o){let i=Math.min(n+1,t.length-1);me.length<i*2+2&&(me=new Float64Array(i*4+4));let s=me;for(let a=e;a<=i;a++){let l=t[a].el;if(!(l instanceof HTMLElement))return!1;vt(l,s,a*2);let c=I(t[a]);o[a*2]=Number.isFinite(c.width)?c.width:l.offsetWidth,o[a*2+1]=Number.isFinite(c.height)?c.height:l.offsetHeight}for(let a=e;a<i;a++){let l=t[a+1],c=l.tag!=="html"&&l.tag!=="body";r[a*2]=s[a*2]-s[(a+1)*2]-(c?l.el.scrollLeft:0),r[a*2+1]=s[a*2+1]-s[(a+1)*2+1]-(c?l.el.scrollTop:0)}return!0}var me=new Float64Array(64),ge=()=>window.scrollX||document.body?.scrollLeft||0,ye=()=>window.scrollY||document.body?.scrollTop||0,wt=t=>(t.overflowY==="auto"||t.overflowY==="scroll")&&t.el.scrollHeight>t.el.clientHeight;function vt(t,e,n){let r=0,o=0,i=t;for(;i;){r+=i.offsetLeft,o+=i.offsetTop;let s=i.offsetParent;if(!s){getComputedStyle(i).position==="fixed"&&(r+=ge(),o+=ye());break}if(s===document.body)break;r+=s.clientLeft,o+=s.clientTop,i=s}e[n]=r,e[n+1]=o}function I(t){if(t.box)return t.box;let e=t.el,n=getComputedStyle(e),r=(u,p="")=>["Top","Right","Bottom","Left"].map(d=>R(n[`${u}${d}${p}`])),o=r("border","Width"),i=r("padding"),s=r("margin"),[a,l]=kt(n),c=[0,0],f=u=>u==="auto"||u==="scroll";if(e instanceof HTMLElement&&(f(t.overflowX)||f(t.overflowY))){let u=e.offsetWidth-e.clientWidth-o[1]-o[3],p=e.offsetHeight-e.clientHeight-o[0]-o[2];c=[u>=2?u:0,p>=2?p:0]}return t.box={border:o,padding:i,margin:s,radius:[n.borderTopLeftRadius,n.borderTopRightRadius,n.borderBottomRightRadius,n.borderBottomLeftRadius].map(u=>u||"0px"),width:a,height:l,direction:n.direction||"ltr",overflowClipMargin:n.overflowClipMargin||"0px",scrollbar:c},t.box}function kt(t){let e=/px$/.test(t.width)?R(t.width):NaN,n=/px$/.test(t.height)?R(t.height):NaN;return t.boxSizing!=="border-box"&&(e+=R(t.paddingLeft)+R(t.paddingRight)+R(t.borderLeftWidth)+R(t.borderRightWidth),n+=R(t.paddingTop)+R(t.paddingBottom)+R(t.borderTopWidth)+R(t.borderBottomWidth)),[e,n]}function Mt(t){return t.assignedSlot??t.parentElement??(t.parentNode?.host||null)}function xe(t,e){let n=[],r=t;for(;r;){let o=xt(r,e);if(n.push(o),o.tag==="html"||o.topLayer)break;r=Mt(r)}return n}var q=(t,...e)=>e.some(n=>new RegExp(`\\b${n}\\b`).test(t)),Xe=t=>t.tag==="html",Ct=t=>{let e=Xe(t)?t.willChange.replace(/(^|,)\s*(backdrop-)?filter\s*(?=,|$)/g,"$1"):t.willChange;return q(e,"transform","perspective","filter","translate","rotate","scale")},St=["transform","translate","rotate","scale","perspective","filter","backdropFilter"];function Nt(t,e=!0){for(let r of St)if(t[r]!=="none"&&!(Xe(t)&&r.endsWith("ilter")))return`${r==="backdropFilter"?"backdrop-filter":r}: ${t[r]}`;if(q(t.contain,"layout","paint","strict","content"))return`contain: ${t.contain}`;if(t.contentVisibility==="auto"||t.contentVisibility==="hidden")return`content-visibility: ${t.contentVisibility}`;if(Ct(t))return`will-change: ${t.willChange}`;let n=parseFloat(t.zoom||"1");return e&&Number.isFinite(n)&&Math.abs(n-1)>1e-6?`zoom: ${t.zoom}`:null}var we=t=>Nt(t,!1)!==null;function De(t,e=null){for(let n=0;n<t.length;n++){let r=t[n];if(r.tag==="html")break;if(r.tag!=="body"&&r.el.classList?.contains("pin-spacer"))return!0;if(r.position==="fixed"){let o=!1;for(let i=n+1;i<t.length&&!o;i++)o=we(t[i]);if(!o)return!0}else if(r.position==="sticky"){let o=null;for(let i=n+1;i<t.length&&!o;i++){let s=t[i];(s.el===e||s.tag==="html"||s.tag==="body"||$t(s))&&(o=s)}if(!o||o.el===e||o.tag==="html"||o.tag==="body")return!0}}return!1}function $t(t){let e=n=>n==="hidden"||n==="auto"||n==="scroll"||n==="overlay";return t.display!=="inline"&&t.display!=="contents"&&(e(t.overflowX)||e(t.overflowY))}function At(t){return t.position!=="static"||we(t)}function Ft(t){return t.display==="inline"?!1:t.overflowX!=="visible"||t.overflowY!=="visible"||q(t.contain,"paint","strict","content")||t.contentVisibility==="auto"||t.contentVisibility==="hidden"}function ne(t,e=0,n=!1){let r=[],o=null;if(!t.length)return{sources:r,mask:o};let i=t[t.length-1].tag==="html"?t[t.length-1]:null,s=!i||i.overflowX==="visible"&&i.overflowY==="visible",a=t[0].position;for(let l=0;l<t.length&&!(n&&l>e);l++){let c=t[l];if(c.display!=="contents"){if(l>0&&(a==="static"||a==="relative"||a==="sticky"||a==="absolute"&&At(c)||a==="fixed"&&we(c))){let u=c.tag==="html"||c.tag==="body"&&(s||wt(c));Ft(c)&&!u&&r.push({node:c,depth:l,by:"overflow"}),a=c.position}c.clipPath!=="none"&&r.push({node:c,depth:l,by:"clip-path"}),c.clip!=="auto"&&c.clip!==""&&(c.position==="absolute"||c.position==="fixed")&&r.push({node:c,depth:l,by:"clip"}),c.mask&&!o&&(o=c)}}return{sources:r,mask:o}}function Ye(t,e,n,r){let[o,i,s,a]=e.border,[l,c]=e.scrollbar,f=a+(e.direction==="rtl"?l:0),u=o,p=n-i-(e.direction==="rtl"?0:l),d=r-s-c,h=[o,i,s,a],m=t.overflowX==="clip",b=t.overflowY==="clip";if(m||b){let k=(e.overflowClipMargin||"0px").trim().split(/\s+/),M=k.find(H=>/-box$/.test(H))||"padding-box",N=Math.max(0,S(k.find(H=>!/-box$/.test(H))||"0px",0)||0),[C,F,E,$]=e.padding,P=M==="content-box"?[C,F,E,$]:M==="border-box"?[-o,-i,-s,-a]:[0,0,0,0],O=[P[0]-N,P[1]-N,P[2]-N,P[3]-N];m&&(f+=O[3],p-=O[1]),b&&(u+=O[0],d-=O[2]),h=h.map((H,B)=>H+O[B])}let g=1e6,y=t.overflowX==="visible"&&!q(t.contain,"paint","strict","content"),w=t.overflowY==="visible"&&!q(t.contain,"paint","strict","content");y&&(f=-g,p=g),w&&(u=-g,d=g);let A=null;if(!y&&!w){let k=ee(e.radius,n,r);if(!k)return{reason:"unparsed"};A=fe(k,h,p-f,d-u)}let v=A?he(A):1;return Number.isFinite(v)?{shape:{kind:0,box:[f,u*v,Math.max(0,p-f),Math.max(0,d-u)*v],radius:A?A.rx.slice():[0,0,0,0],points:null,ky:v}}:{reason:"mixed-corners"}}function T(t){return t.fill(0),t[0]=t[5]=t[10]=t[15]=1,t}function X(t,e,n){let r=Et;for(let o=0;o<4;o++){let i=n[o*4],s=n[o*4+1],a=n[o*4+2],l=n[o*4+3];for(let c=0;c<4;c++)r[o*4+c]=e[c]*i+e[4+c]*s+e[8+c]*a+e[12+c]*l}return t.set(r),t}var Et=new Float64Array(16);function re(t,e,n,r,o=0){t!==e&&t.set(e);for(let i=0;i<4;i++){let s=t[i*4+3];t[i*4]+=n*s,t[i*4+1]+=r*s,t[i*4+2]+=o*s}return t}function Lt(t){let e=t,n=(o,i,s,a,l,c)=>e[a*4+o]*(e[l*4+i]*e[c*4+s]-e[c*4+i]*e[l*4+s])-e[l*4+o]*(e[a*4+i]*e[c*4+s]-e[c*4+i]*e[a*4+s])+e[c*4+o]*(e[a*4+i]*e[l*4+s]-e[l*4+i]*e[a*4+s]),r=-e[3]*n(0,1,2,1,2,3)+e[7]*n(0,1,2,0,2,3)-e[11]*n(0,1,2,0,1,3)+e[15]*n(0,1,2,0,1,2);return!r||!Number.isFinite(r)?NaN:n(0,1,3,0,1,3)/r}var Rt=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(deg|rad|grad|turn)?$/i;function Pt(t){let e=Rt.exec(t.trim());if(!e)return NaN;let n=parseFloat(e[1]);switch((e[2]||"deg").toLowerCase()){case"rad":return n;case"grad":return n*Math.PI/200;case"turn":return n*2*Math.PI;default:return n*Math.PI/180}}function It(t,e){let n=t.trim();if(!n||n==="none")return null;let r=/^matrix(3d)?\((.*)\)$/.exec(n);if(!r)return null;let o=r[2].split(",").map(Number);return o.some(i=>!Number.isFinite(i))?null:r[1]?o.length!==16?null:(e.set(o),e):o.length!==6?null:(T(e),e[0]=o[0],e[1]=o[1],e[4]=o[2],e[5]=o[3],e[12]=o[4],e[13]=o[5],e)}function Tt(t,e){let n=t.trim().split(/\s+/);if(!n[0]||n[0]==="none")return null;let r=0,o=0,i=1,s=Pt(n[n.length-1]);return Number.isFinite(s)?(n.length===2?(r=n[0]==="x"?1:0,o=n[0]==="y"?1:0,i=n[0]==="z"?1:0):n.length===4&&(r=Number(n[0]),o=Number(n[1]),i=Number(n[2])),Ot(e,r,o,i,s)):null}function Ot(t,e,n,r,o){let i=Math.hypot(e,n,r);if(T(t),!i||!Number.isFinite(i))return t;e/=i,n/=i,r/=i;let s=Math.sin(o),a=Math.cos(o),l=1-a;return t[0]=a+e*e*l,t[1]=n*e*l+r*s,t[2]=r*e*l-n*s,t[4]=e*n*l-r*s,t[5]=a+n*n*l,t[6]=r*n*l+e*s,t[8]=e*r*l+n*s,t[9]=n*r*l-e*s,t[10]=a+r*r*l,t}function Ht(t,e){let n=t.trim().split(/\s+/);if(!n[0]||n[0]==="none")return null;let r=(a,l)=>a===void 0?l:a.endsWith("%")?parseFloat(a)/100:parseFloat(a),o=r(n[0],1),i=r(n[1],o),s=r(n[2],1);return[o,i,s].every(Number.isFinite)?(T(e),e[0]=o,e[5]=i,e[10]=s,e):null}function zt(t,e,n,r){let o=L(t);if(!o[0]||o[0]==="none")return null;let i=S(o[0],e),s=o[1]===void 0?0:S(o[1],n),a=o[2]===void 0?0:S(o[2],0);return[i,s,a].every(Number.isFinite)?(T(r),r[12]=i,r[13]=s,r[14]=a,r):null}function We(t,e,n){let r=L(t||""),o=r[0]===void 0?e/2:S(r[0],e),i=r[1]===void 0?n/2:S(r[1],n),s=r[2]===void 0?0:S(r[2],0);return[Number.isFinite(o)?o:e/2,Number.isFinite(i)?i:n/2,Number.isFinite(s)?s:0]}var Bt=new Set(["img","video","canvas","iframe","embed","object","svg","input","select","textarea","button"]);function U(t){return!(t.display==="contents"||t.display==="none"||t.display==="inline"&&!Bt.has(t.tag))}function z(t){return U(t)&&(t.transform!=="none"||t.translate!=="none"||t.rotate!=="none"||t.scale!=="none")}var Xt=new Float64Array(16);function ve(t,e,n,r){if(!z(t))return null;let[o,i,s]=We(t.transformOrigin,e,n);T(r),re(r,r,o,i,s);let a=Xt;zt(t.translate,e,n,a)&&X(r,r,a),Tt(t.rotate,a)&&X(r,r,a),Ht(t.scale,a)&&X(r,r,a),It(t.transform,a)&&X(r,r,a);let l=a;return T(l),l[12]=-o,l[13]=-i,l[14]=-s,X(r,r,l),r}function Dt(t){return Math.abs(t[2])>1e-9||Math.abs(t[3])>1e-9||Math.abs(t[6])>1e-9||Math.abs(t[7])>1e-9||Math.abs(t[8])>1e-9||Math.abs(t[9])>1e-9||Math.abs(t[11])>1e-9||Math.abs(t[10]-1)>1e-9}function Yt(t){return Math.abs(t[1])>1e-9||Math.abs(t[4])>1e-9||t[0]<=1e-9||t[5]<=1e-9}function ke(t){return!(t.transformStyle!=="preserve-3d"||t.overflowX!=="visible"||t.overflowY!=="visible"||(parseFloat(t.opacity)||0)<1&&t.opacity!==""||t.filter!=="none"||t.clipPath!=="none"||t.mask||t.isolation==="isolate"||t.mixBlendMode&&t.mixBlendMode!=="normal"||/\b(paint|strict|content)\b/.test(t.contain))}var Ge=new Float64Array(16);function oe(t,e=0){let n=0,r=Ge;for(let o=e;o<t.length;o++){let i=t[o];if(ve(i,0,0,r)){if(Dt(r)||Math.abs(r[14])>1e-9&&Wt(t,o))return 2;Yt(r)&&(n=1)}}return n}function Ve(t,e,n,r){for(let o=e;o<=n&&o+1<t.length;o++){let i=t[o+1];if(!(!z(t[o])||i.perspective==="none"||!U(i))&&!(i.overflowX==="visible"&&i.overflowY==="visible")&&r(o+1))return o+1}return-1}function Wt(t,e){for(let n=e+1;n<t.length;n++){if(t[n].perspective!=="none")return!0;if(!ke(t[n]))return!1}return!1}function Me(t,e,n){n[0]=1,n[1]=0,n[2]=0,n[3]=1;let r=Ge;for(let o=e;o<t.length;o++){if(!ve(t[o],0,0,r))continue;let i=r[0],s=r[1],a=r[4],l=r[5],c=n[0],f=n[1],u=n[2],p=n[3];n[0]=i*c+a*f,n[1]=s*c+l*f,n[2]=i*u+a*p,n[3]=s*u+l*p}return n}function Ce(t,e){let n=e;for(let r=e;r<t.length;r++){let o=t[r];(z(o)||o.perspective!=="none"&&r>e&&z(t[r-1]))&&(n=r)}return n}var Gt=new Float64Array(16),Vt=new Float64Array(16);function Se(t,e,n,r,o,i,s,a){let l=T(a.m);a.behind=!1,a.backHidden=!1,a.scene=-1;for(let c=e;c<=n&&c<t.length;c++){let f=t[c];je(l,t,c,r,o);let u=t[c+1];if(f.backfaceVisibility==="hidden"&&!a.backHidden&&Ut(t,c,n,r,o)&&(a.backHidden=!0),u&&ke(u)){a.scene=c+1;continue}jt(l)}for(let[c,f]of[[0,0],[i,0],[i,s],[0,s]])l[3]*c+l[7]*f+l[15]<=1e-6&&(a.behind=!0);return a}function je(t,e,n,r,o){let i=e[n],s=ve(i,o[n*2]||0,o[n*2+1]||0,Gt);s&&X(t,s,t),re(t,t,r[n*2]||0,r[n*2+1]||0,0);let a=e[n+1];if(a&&a.perspective!=="none"&&U(a)){let l=parseFloat(a.perspective);if(l>0){let[c,f]=We(a.perspectiveOrigin,o[(n+1)*2]||0,o[(n+1)*2+1]||0),u=T(Vt);u[11]=-1/Math.max(l,1),re(t,t,-c,-f,0),X(t,u,t),re(t,t,c,f,0)}}}function jt(t){t[2]=t[6]=t[14]=0,t[8]=t[9]=t[11]=0,t[10]=1}var qt=new Float64Array(16);function Ut(t,e,n,r,o){let i=T(qt);for(let a=e;a<=Math.max(n,e)&&a<t.length;a++){je(i,t,a,r,o);let l=t[a+1];if(!l||!ke(l))break}return Lt(i)<0}function Ne(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[3],e[3]=t[4],e[4]=t[5],e[5]=t[7],e[6]=t[12],e[7]=t[13],e[8]=t[15],e}function $e(t,e){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Ae(t,e,n,r,o,i,s){let a=1/0,l=1/0,c=-1/0,f=-1/0;for(let d=0;d<4;d++){let h=d===1||d===2?e:0,m=d>=2?n:0,b=t[2]*h+t[5]*m+t[8],g=(t[0]*h+t[3]*m+t[6])/b,y=(t[1]*h+t[4]*m+t[7])/b;g<a&&(a=g),g>c&&(c=g),y<l&&(l=y),y>f&&(f=y)}let u=r-a,p=o-l;for(let d=0;d<3;d++)t[d*3]+=u*t[d*3+2],t[d*3+1]+=p*t[d*3+2];return Math.max(Math.abs(c-a-i),Math.abs(f-l-s))}function qe(t,e,n,r){let o=e/2,i=n/2,s=t[2]*o+t[5]*i+t[8],a=(t[0]*o+t[3]*i+t[6])/s,l=(t[1]*o+t[4]*i+t[7])/s,c=(t[0]-a*t[2])/s,f=(t[1]-l*t[2])/s,u=(t[3]-a*t[5])/s,p=(t[4]-l*t[5])/s,d=Math.sqrt(Math.abs(c*p-f*u))||1;return r[0]=r[1]=d,r}function K(t){return Math.abs(t[1])<1e-9&&Math.abs(t[3])<1e-9&&Math.abs(t[2])<1e-9&&Math.abs(t[5])<1e-9&&Math.abs(t[8]-1)<1e-9}function x(t){if(!t||typeof t.tagName!="string")return"<?>";let e=t.tagName.toLowerCase();if(t.id)return`<${e}#${t.id}>`;let n=typeof t.className=="string"?t.className.trim().split(/\s+/)[0]:"";return n?`<${e}.${n}>`:`<${e}>`}var W=2,_=8;function Kt(){return{list:[],occ:[],occHow:[],noSlots:!1,occSlots:[],mask:null,scissorDoc:new Float64Array(8),shaders:[],reason:null,fold:new Float32Array(4),ownRadius:new Float32Array(4),ownKy:1,count:0,xf:new Float32Array(9*W),box:new Float32Array(4*W),radius:new Float32Array(4*W),poly:new Float32Array(2*_),polyInfo:new Float32Array([-1,0]),ga:!1,scissorPx:new Int32Array(4),cutBy:null,reshaped:!1}}function Ke(t,e,n,r,o,i=[]){let s=Math.max(0,e.findIndex(u=>u.el===t.el)),{sources:a,mask:l}=ne(e,s,n);if(!a.length&&!l&&!i.length)return null;let c=o||Kt();c.occ=i,c.occSlots.length=0,c.occHow.length=i.length,c.occHow.fill("pruned");let f=[];for(let u of a){let p=c.list.find(d=>d.el===u.node.el&&d.by===u.by);f.push({el:u.node.el,by:u.by,node:u.node,own:u.depth<=s,ignored:!1,depth:u.depth,key:p?.key||"",shape:p?.shape||null,reason:p?.reason||null,m:p?.m||new Float64Array(9),inv:p?.inv||new Float64Array(9),bounds:p?.bounds||new Float64Array(4),scrolls:r(u.node.el),square:!1,how:"shader"})}return c.list=f,c.mask=l,c}function _t(t,e,n,r,o){let i=`${e.radius.join(" ")}|${e.border.join(" ")}|${e.padding.join(" ")}`;return t.by==="overflow"?`|${r}|${o}|${i}|${e.overflowClipMargin}|${e.scrollbar.join(" ")}|${e.direction}`:t.by==="clip-path"||t.by==="occlude"?`${n}|${r}|${o}|${i}|${e.margin.join(" ")}`:`${n}|${r}|${o}`}function Fe(t,e,n,r,o){let i=I(t.node),s=_t(t,i,o,n,r);if(s!==t.key||!t.shape&&!t.reason){t.key=s;let h=t.by==="overflow"?Ye(t.node,i,n,r):t.by==="clip"?He(o,n,r):Oe(o,{w:n,h:r,border:i.border,padding:i.padding,margin:i.margin,radius:i.radius});t.shape=h&&"shape"in h?h.shape:null,t.reason=h&&"reason"in h?h.reason:null,h||(t.reason="none")}e!==t.m&&t.m.set(e);let a=t.shape;if(!a)return;if(!D(t.inv,t.m)){t.inv.fill(0),t.bounds.fill(0),t.square=!0;return}t.inv[1]*=a.ky,t.inv[4]*=a.ky,t.inv[7]*=a.ky;let l,c,f,u;if(a.kind===0){let[h,m,b,g]=a.box;l=h,f=h+b,c=m/a.ky,u=(m+g)/a.ky}else{let h=a.points;l=c=1/0,f=u=-1/0;for(let m=0;m<h.length;m+=2)l=Math.min(l,h[m]),f=Math.max(f,h[m]),c=Math.min(c,h[m+1]),u=Math.max(u,h[m+1])}let p=t.bounds;p[0]=p[1]=1/0,p[2]=p[3]=-1/0;let d=Math.max(Math.abs(l),Math.abs(f),Math.abs(c),Math.abs(u))>1e5;for(let h=0;h<4;h++){let m=h===1||h===2?f:l,b=h>=2?u:c,g=d?1:e[2]*m+e[5]*b+e[8],y=(e[0]*m+e[3]*b+e[6])/g,w=(e[1]*m+e[4]*b+e[7])/g;y<p[0]&&(p[0]=y),w<p[1]&&(p[1]=w),y>p[2]&&(p[2]=y),w>p[3]&&(p[3]=w)}t.square=a.kind===0&&a.radius.every(h=>h<=0)&&K(e)}function ie(t,e,n){let r=t.shape,o=t.inv,i=o[2]*e+o[5]*n+o[8],s=(o[0]*e+o[3]*n+o[6])/i,a=(o[1]*e+o[4]*n+o[7])/i;return r.kind===0?ze(s,a,r.box,r.radius,.01):Be(s,a,r.points)}function Qt(t,e){let n=t.shape;return n.kind===1&&!Zt(n.points)?!1:ie(t,e[0],e[1])&&ie(t,e[2],e[1])&&ie(t,e[2],e[3])&&ie(t,e[0],e[3])}function Zt(t){let e=t.length/2,n=0;for(let r=0;r<e;r++){let o=r*2,i=(r+1)%e*2,s=(r+2)%e*2,a=(t[i]-t[o])*(t[s+1]-t[i+1])-(t[i+1]-t[o+1])*(t[s]-t[i]);if(a!==0){if(n===0)n=Math.sign(a);else if(Math.sign(a)!==n)return!1}}return!0}var Jt=new Float64Array(4);function _e(t,e,n,r){e.reason=null,e.scissorDoc.fill(NaN),e.shaders.length=0,e.fold.fill(0),e.mask&&(e.reason={code:"mask",clips:[]});let o=Jt,i=r?(n[2]-n[0])*.25:0,s=r?(n[3]-n[1])*.25:0;o[0]=n[0]-i,o[1]=n[1]-s,o[2]=n[2]+i,o[3]=n[3]+s;let a=[];for(let d of e.list){if(d.ignored){d.how="ignored";continue}if(d.reason==="none"){d.how="pruned";continue}if(d.reason||!d.shape){e.reason||={code:d.reason||"unparsed",clips:[d]};continue}let h=d.scrolls===t.scrolls;if(d.square){let m=d.bounds;if(h&&m[0]<=o[0]&&m[1]<=o[1]&&m[2]>=o[2]&&m[3]>=o[3]){d.how="pruned";continue}let b=d.scrolls?0:4,g=e.scissorDoc;Number.isNaN(g[b])?g.set(m,b):(g[b]=Math.max(g[b],m[0]),g[b+1]=Math.max(g[b+1],m[1]),g[b+2]=Math.min(g[b+2],m[2]),g[b+3]=Math.min(g[b+3],m[3])),d.how="scissor";continue}a.push(d)}for(let d=a.length-1;d>=0;d--){let h=a[d];h.scrolls===t.scrolls&&Qt(h,o)&&(h.how="pruned",a.splice(d,1))}for(let d=a.length-1;d>=0&&!r;d--){let h=a[d],m=h.shape,b=h.bounds,g=h.m[0];if(t.level===0&&K(h.m)&&h.scrolls===t.scrolls&&m.kind===0&&m.ky===1&&Math.abs(g-h.m[4])<.01*g&&Math.abs(b[0]-n[0])<.5&&Math.abs(b[1]-n[1])<.5&&Math.abs(b[2]-n[2])<.5&&Math.abs(b[3]-n[3])<.5){for(let w=0;w<4;w++)e.fold[w]=Math.max(e.fold[w],m.radius[w]*g);h.how="corners",a.splice(d,1)}}let l=a.filter(d=>d.shape.kind===1);(a.length>W||l.length>1)&&(e.reason||={code:"too-many",clips:a});for(let d of a)d.how="shader",e.shaders.length<W&&e.shaders.push(d);let c=!1,f=(d,h,m)=>{let b=Math.fround(m);d[h]!==b&&(d[h]=b,c=!0)},u=-1;for(let d=0;d<e.shaders.length;d++){let h=e.shaders[d].shape;for(let m=0;m<4;m++)f(e.box,d*4+m,h.kind===0?h.box[m]:0),f(e.radius,d*4+m,h.kind===0?h.radius[m]:0);h.kind===1&&(u=d)}let p=u>=0?e.shaders[u].shape.points:null;for(let d=0;d<2*_;d++)f(e.poly,d,p&&d<p.length?p[d]:0);return f(e.polyInfo,0,u),f(e.polyInfo,1,p?p.length/2:0),c&&(e.reshaped=!0),e.reason}var en=1,Y=2,tn=new Float64Array(9);function Qe(t,e,n,r){let o=t.reshaped?Y:0;t.reshaped=!1,t.cutBy=null;let i=-1/0,s=-1/0,a=1/0,l=1/0,c=!1,f=t.scissorDoc;for(let v=0;v<8;v+=4){if(Number.isNaN(f[v]))continue;c=!0;let k=v===0?r.scrollX:r.pageX,M=v===0?r.scrollY:r.pageY;i=Math.max(i,f[v]-k),s=Math.max(s,f[v+1]-M),a=Math.min(a,f[v+2]-k),l=Math.min(l,f[v+3]-M)}let u=i,p=s,d=a,h=l,m=null,b=0,g=t.occ;if(g.length){let v=n?e[2]*.25:0,k=n?e[3]*.25:0,M=e[0]-v,N=e[1]-k,C=e[0]+e[2]+v,F=e[1]+e[3]+k;for(let E=0;E<g.length;E++){let $=g[E],P=$.bounds,O=$.scrolls?r.scrollX:r.pageX,H=$.scrolls?r.scrollY:r.pageY,B=P[0]-O,G=P[1]-H,V=P[2]-O,j=P[3]-H;if($.ignored||!$.shape||B>=C||V<=M||G>=F||j<=N){t.occHow[E]="pruned";continue}let le=B<=M&&V>=C,ce=G<=N&&j>=F,Pe=$.axis&&($.square||M>=B+$.rx&&C<=V-$.rx||N>=G+$.ry&&F<=j-$.ry);if(Pe&&le&&ce)return t.cutBy=$,t.occHow[E]="pruned",o;let Z=le&&G<=N?1:le&&j>=F?2:ce&&B<=M?3:ce&&V>=C?4:0,Ie=!t.noSlots&&t.shaders.length+b<W;Z&&(Pe||!Ie&&$.axis)?(Z===1?s=Math.max(s,j):Z===2?l=Math.min(l,G):Z===3?i=Math.max(i,V):a=Math.min(a,B),c=!0,m=$,t.occHow[E]="scissor"):Ie?(t.occSlots[b++]=$,t.occHow[E]="shader"):t.occHow[E]="uncut"}}t.occSlots.length>b&&(t.occSlots.length=b);let y=!1;if(c){if(a<=i||l<=s||!n&&(e[0]>=a||e[0]+e[2]<=i||e[1]>=l||e[1]+e[3]<=s)){let k=d<=u||h<=p||!n&&(e[0]>=d||e[0]+e[2]<=u||e[1]>=h||e[1]+e[3]<=p);return t.cutBy=!k&&m||t.list.find(M=>M.how==="scissor")||m,o}if(y=n||e[0]<i||e[1]<s||e[0]+e[2]>a||e[1]+e[3]>l,y){let k=Math.min(r.cw,Math.max(0,Math.round(i*r.kx))),M=Math.min(r.cw,Math.max(0,Math.round(a*r.kx))),N=Math.min(r.ch,Math.max(0,Math.round(s*r.ky))),C=Math.min(r.ch,Math.max(0,Math.round(l*r.ky)));if(M<=k||C<=N)return t.cutBy=m||t.list.find($=>$.how==="scissor")||null,o;let F=t.scissorPx,E=r.ch-C;(F[0]!==k||F[1]!==E||F[2]!==M-k||F[3]!==C-N)&&(F[0]=k,F[1]=E,F[2]=M-k,F[3]=C-N,o=Y)}}y!==t.ga&&(t.ga=y,o=Y);let w=t.shaders.length,A=w+b;A!==t.count&&(t.count=A,o=Y);for(let v=0;v<w;v++){let k=t.shaders[v],M=k.scrolls?r.scrollX:r.pageX,N=k.scrolls?r.scrollY:r.pageY,C=k.bounds;if(!n&&(e[0]>=C[2]-M||e[0]+e[2]<=C[0]-M||e[1]>=C[3]-N||e[1]+e[3]<=C[1]-N))return t.cutBy=k,o;o|=Ue(t,v,k,r,1)}for(let v=0;v<b;v++){let k=t.occSlots[v],M=w+v;o|=Ue(t,M,k,r,-1);let N=k.shape;for(let C=0;C<4;C++){let F=Math.fround(N.box[C]),E=Math.fround(N.radius[C]);(t.box[M*4+C]!==F||t.radius[M*4+C]!==E)&&(t.box[M*4+C]=F,t.radius[M*4+C]=E,o=Y)}}return o|en}function Ue(t,e,n,r,o){let i=n.scrolls?r.scrollX:r.pageX,s=n.scrolls?r.scrollY:r.pageY,a=1/r.kx,l=1/r.ky,c=n.inv,f=r.ch*l+s,u=tn;u[0]=c[0]*a,u[1]=c[1]*a,u[2]=c[2]*a,u[3]=-c[3]*l,u[4]=-c[4]*l,u[5]=-c[5]*l,u[6]=c[0]*i+c[3]*f+c[6],u[7]=c[1]*i+c[4]*f+c[7],u[8]=c[2]*i+c[5]*f+c[8];let p=t.xf,d=0;for(let h=0,m=e*9;h<9;h++,m++){let b=Math.fround(u[h]*o);p[m]!==b&&(p[m]=b,d=Y)}return d}function Q(t){if(t.by==="occlude")return t.shape&&t.shape.radius.some(n=>n>0)?"data-gl-occlude, rounded":"data-gl-occlude";if(t.by==="overflow"){let n=t.node,r=n.overflowX===n.overflowY?n.overflowX:`${n.overflowX} ${n.overflowY}`,o=r==="visible"?n.contentVisibility!=="visible"?`content-visibility: ${n.contentVisibility}`:`contain: ${n.contain}`:`overflow: ${r}`;return t.shape&&t.shape.radius.some(i=>i>0)?`${o}, rounded`:o}let e=t.by==="clip"?t.node.clip:t.node.clipPath;return`${t.by==="clip"?"clip: ":""}${e.length>60?`${e.slice(0,57)}...`:e}`}function Ze(t,e){let n=x(t.el),r=e.reason,o=r.clips[0],i=s=>s.length>40?`${s.slice(0,37)}...`:s;switch(r.code){case"mask":return`${n}: GL can't draw the CSS mask on ${x(e.mask?.el)}, so its DOM shows. Move the mask off the parents of GL elements, or add data-gl-clip="false" to draw it unmasked.`;case"mixed-corners":return`${n}: ${x(o.el)}'s corners mix different horizontal / vertical radii; GL needs one ratio for all of them, so its DOM shows. Use the same radius both ways (or one shape for all corners).`;case"polygon-points":return`${n}: clip-path polygon() on ${x(o.el)} has more than ${_} points; GL draws up to ${_}, so its DOM shows. Simplify the polygon${o.own?"":', or add data-gl-clip="false" to draw it uncut'}.`;case"polygon-nonzero":return`${n}: clip-path polygon() on ${x(o.el)} crosses itself, and GL fills polygons even-odd, so its DOM shows. Write polygon(evenodd, ...) or untangle it.`;case"too-many":return`${n}: cut by too many rounded or shaped parents (${r.clips.map(s=>x(s.el)).join(", ")}), so its DOM shows. Make one of them a straight overflow: hidden, keep one polygon (up to ${_} points), or add data-gl-clip="false".`;default:{let s=o?o.by==="clip"?o.node.clip:o.node.clipPath:"";return`${n}: ${o?.by==="clip"?"clip":"clip-path"} ${i(s)} on ${x(o?.el)} can't be drawn in GL, so its DOM shows. Use inset(), rect(), xywh(), circle(), ellipse() or polygon()${o?.own?"":', or add data-gl-clip="false" to draw it uncut'}.`}}}function et(t,e,n,r=t.rect){if(r[0]=t.doc.x-e,r[1]=t.doc.y-n,r[2]=t.doc.w,r[3]=t.doc.h,t.pad){let o=t.pad*(t.layoutW?t.doc.w/t.layoutW:1),i=t.pad*(t.layoutH?t.doc.h/t.layoutH:1);r[0]-=o,r[1]-=i,r[2]+=o*2,r[3]+=i*2}return r}var nn=/^(transform|translate|rotate|scale|perspective|offset[A-Z]|left|top|right|bottom|inset|width|height|min[WH]|max[WH]|margin|padding|flex|grid|clipPath|clip$|opacity|visibility|display|fontSize|letterSpacing|lineHeight|border\w*(Width|Radius)|all$|zoom)/,rn=/^(rotate|perspective|offset|clip|display|border\w*Radius|all$|zoom)/,on={transform:/^(none|((translate[XY]?\([^()]*\)|scale[XY]?\([^()-]*\)) ?)+)$/,translate:/^\S+( \S+)?$/,scale:/^[^-\s]+( [^-\s]+)?$/},Je=new WeakMap;function sn(t){let e=Je.get(t);if(e!==void 0)return e;try{let n=t.effect.getKeyframes();e=0;for(let r of new Set(n.flatMap(o=>Object.keys(o)))){if(!nn.test(r))continue;let o=n.map(s=>s[r]).filter(s=>s!=null),i=on[r];e=Math.max(e,rn.test(r)||i&&!(o.length&&o.every(s=>i.test(String(s).trim())))?2:1)}}catch{e=2}return Je.set(t,e),e}var Ee=t=>sn(t)>0;var an=t=>!!t.backgroundImage&&t.backgroundImage!=="none"||!/^(transparent|rgba\(.*,\s*0\))$/.test(t.backgroundColor||"transparent"),ln=["transform","translate","rotate","scale","perspective","filter","backdropFilter","clipPath","maskImage","webkitMaskImage"],Le=t=>t.position!=="static"&&t.zIndex!=="auto"||/fixed|sticky/.test(t.position)||parseFloat(t.opacity)<1||ln.some(e=>(t[e]||"none")!=="none")||t.isolation==="isolate"||(t.mixBlendMode||"normal")!=="normal"||/\b(layout|paint|strict|content)\b/.test(t.contain)||/^(size|inline-size)$/.test(t.containerType)||/\b(transform|translate|rotate|scale|perspective|filter|opacity|clip-path|mask|isolation|mix-blend-mode|contain)\b/.test(t.willChange);function tt(t,e){let n=parseInt(getComputedStyle(e).zIndex,10);if(!(n>0))return null;let r=null,o="auto",i=[];for(let s=t;s&&s!==document.body&&s!==document.documentElement;s=s.parentElement){let a=getComputedStyle(s);an(a)&&!(s===t&&t.getAttribute("data-gl")==="shader")&&i.push(s),Le(a)&&(r=s,o=a.position!=="static"?a.zIndex:"auto")}return!r||o==="auto"||+o<n||!i.some(s=>r.contains(s))?null:`${x(r)} (z-index ${o}, with a background) covers Umber's canvas (z-index ${n}): GL inside it is hidden. Drop that z-index (and give it data-gl-occlude if it must still cover the GL elements before it) or move the background behind the content.`}function nt(t,e,n){let r=parseInt(getComputedStyle(n).zIndex,10);if(!(r>0)||e>=r||!Le(getComputedStyle(t)))return null;let o=x(t);return[...t.querySelectorAll("[data-gl-above]")].map(i=>[i,`data-gl-above on ${x(i)} stays under Umber's canvas: ${o} around it is a stacking context (a pin, a transform, a fade) under the canvas (z-index ${r}). Give ${o} position: relative and z-index: ${r+1} (no background), or move it out.`])}function se(t){let e=[],n=!0;for(let r=t;r&&r!==document.body&&r!==document.documentElement;r=r.parentElement){let o=getComputedStyle(r),i=Le(o),s=o.position!=="static";(i||n&&s)&&e.unshift([r,s&&o.zIndex!=="auto"&&+o.zIndex||0]),(i||s)&&(n=!1)}return e}function rt(t,e,n,r){let o=0;for(;o<e.length&&o<r.length&&e[o][0]===r[o][0];)o++;let i=e[o]?.[1]??-.5,s=r[o]?.[1]??-.5;return i!==s?s>i:!!(n.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}function ot(t){let e=getComputedStyle(t),n=e.backgroundColor||"transparent";return(n!=="transparent"&&!/^rgba\(/.test(n)&&!/\/\s*(0?\.\d+|0)\s*\)$/.test(n)||!!e.backgroundImage&&e.backgroundImage!=="none")&&parseFloat(e.opacity)>=1}var cn={1:.75,2:1.5},un=3,dn=typeof navigator<"u"&&/AppleWebKit\//.test(navigator.userAgent)&&!/Chrome\/|Chromium\//.test(navigator.userAgent),fn=t=>I(t).radius.some(e=>e.split(" ").every(n=>parseFloat(n)>0));function at(t,e=!1){try{return t.getKeyframes().some(n=>"opacity"in n&&!(e&&parseFloat(n.opacity)>0)||"visibility"in n||"clipPath"in n)}catch{return!0}}var hn=/^(offset|computedOffset|easing|composite|opacity|filter|color|\w+(Color|Shadow))$/,mn=t=>!at(t,!0)&&t.getKeyframes().every(e=>Object.keys(e).every(n=>hn.test(n)));function pn(t,e){if(e.contains(t)||t.contains(e))return!0;let n=t.parentElement;for(let r=e,o=0;r&&r!==document.body&&o<4;r=r.parentElement,o++){let i=r.parentElement;if(i&&(n===i||n?.parentElement===i))return!0}return!1}var bn=/^(SPAN|B|I|EM|STRONG|SMALL|SUB|SUP|TIME|BR)$/;function it(t){for(let e=0;e<t.length;e++)if(t[e].nodeType===1&&!bn.test(t[e].nodeName))return!0;return!1}function st(t){let e=null;for(let n of t)z(n)&&(n.transform!=="none"||n.rotate!=="none")&&(e=n.el);if(!e)for(let n of t)(z(n)||n.perspective!=="none")&&(e=n.el);return e}var Re=[];function gn(t){return{el:t,by:"occlude",node:null,nodes:[],own:!1,ignored:!0,depth:0,key:"",shape:null,reason:null,m:new Float64Array(9),inv:new Float64Array(9),bounds:new Float64Array(4),scrolls:!0,square:!1,how:"pruned",live:!1,axis:!0,rx:0,ry:0,want:!1,over:!1,cuts:[],full:new Float64Array(8),from:null,warned:!1,stack:[],hidden:!1,until:0,linked:!1,fades:!1,at:null}}var ae=class{constructor(e){this.stage=e;this.gb=new Map;this.cb=new Map;this.lb=new Set;this.quad=new Float64Array(4);this.nc=new Float32Array(4);this.Fb=new Float64Array(4);this.rel=new Float64Array(64);this.sizes=new Float64Array(64);this.composed={m:new Float64Array(16),behind:!1,backHidden:!1,scene:-1};this.sb=new WeakSet;this.contexts=new WeakSet;this.held=[];this.ci={scrollX:0,scrollY:0,pageX:0,pageY:0,kx:1,ky:1,cw:1,ch:1};this.occluders=[];this.Hb=-1;this.Ab=0;this.$a=!1;this.ua=!1;this.watch=null;this.Cb=e=>{let n=this.stage.host.scroll.root;return n?n!==e&&n.contains(e):!0};let n=r=>{let o=r.target;o instanceof Element&&(r.type!=="input"||/^(checkbox|radio|select-)/.test(o.type))&&this.hook(o)&&e.request()};for(let r of["pointerover","pointerout","focusin","focusout","input"])e.listen(document,r,n)}start(e,n){this.gb.clear(),this.cb.clear(),this.lb.clear(),this.$a=!1,this.stage.gen!==this.Hb?(this.Hb=this.stage.gen,this.$b(),this.bb(),this.occluders.length&&(n=!0),this.ua=!1):this.ua&&!this.stage.scrolled&&(this.ua=!1,this.bb(),n=!0),n&&this.scanAnimations(e),this.occluders.length&&this.bc(e),this.checkHeld()}measureTransform(e,n,r,o,i,s,a){let l=e.nodes,c=n;if(n){l=e.nodes=xe(e.geomEl,this.stage.chainMemo),e.chained=!0;let m=e.dynamic;m.length=0;for(let b=0;b<l.length;b++){let g=l[b];(z(g)||g.perspective!=="none"||e.animTargets.includes(g.el))&&m.push(b)}e.chainReason=this.xc(e,l)}else if(r&&(e.level&&e.dynamic.length||e.animTargets.length)){if(e.level)for(let m of e.dynamic)pe(l[m],this.lb);for(let m of e.animTargets){let b=l.findIndex(g=>g.el===m);b>=0&&pe(l[b],this.lb)}c=!0}if(c){n||(l[0].box=void 0);let m=I(l[0]);e.boxW=Number.isFinite(m.width)&&m.width>0?m.width:o.width,e.boxH=Number.isFinite(m.height)&&m.height>0?m.height:o.height;let b=oe(l,0);b!==e.level&&e._raster&&(e._raster.textDirty=!0),e.level=b}let f=e.level;if(e.backHidden=!1,e.scene=null,e.xfReason=e.chainReason,!f||e.chainReason){e.edge[0]=e.edge[1]=1;return}let u=e.boxW,p=e.boxH,d=e.xf,h=null;if(f===1)$e(Me(l,0,this.Fb),d);else{let m=Ce(l,0);if(this.grow(l.length),!be(l,0,m,this.rel,this.sizes))h=this.ha(e,"svg",l[0].el);else{let b=Se(l,0,m,this.rel,this.sizes,u,p,this.composed);if(Ne(b.m,d),e.backHidden=b.backHidden,e.scene=b.scene>=0?l[b.scene].el:null,b.behind)h=this.ha(e,"behind",st(l));else if(dn){let g=Ve(l,0,m,y=>fn(l[y]));g>=0&&(h=this.ha(e,"rounded",l[g].el))}}}if(!h){if(Ae(d,u,p,o.left+i,o.top+s,o.width,o.height)<=cn[f])e.verifyMiss=0;else if(!(a<e.animUntil||e.scrollLinked)||++e.verifyMiss>=un){let b=l.find(g=>g.zoom&&Math.abs(parseFloat(g.zoom)-1)>1e-6);h=b?this.ha(e,"zoom",b.el):this.ha(e,"verify",st(l))}}h||qe(d,u,p,e.edge),e.xfReason=h}turnedText(e){if(!e.level||e.xfReason)return null;let n=new Float64Array(9);if(!D(n,e.xf))return null;let r=e.scrolls?this.stage.host.scroll.root:null,o=r?r.scrollLeft:ge(),i=r?r.scrollTop:ye(),s=e.xf,a=e.boxW/2,l=e.boxH/2,c=s[2]*a+s[5]*l+s[8],f=(s[0]*a+s[3]*l+s[6])/c,u=(s[1]*a+s[4]*l+s[7])/c;return{width:e.boxW,height:e.boxH,ax:(s[0]-f*s[2])/c,ay:(s[1]-u*s[2])/c,bx:(s[3]-f*s[5])/c,by:(s[4]-u*s[5])/c,toLocal(p,d,h){let m=p+o,b=d+i,g=n[2]*m+n[5]*b+n[8],y=(n[0]*m+n[3]*b+n[6])/g,w=(n[1]*m+n[4]*b+n[7])/g;h[0]=y,h[1]=w;let A=s[2]*y+s[5]*w+s[8];h[2]=(s[0]-m*s[2])/A,h[3]=(s[1]-b*s[2])/A,h[4]=(s[3]-m*s[5])/A,h[5]=(s[4]-b*s[5])/A}}}grow(e){this.rel.length>=e*2+2||(this.rel=new Float64Array(e*4),this.sizes=new Float64Array(e*4))}xc(e,n){for(let r of n){if(r.el.namespaceURI==="http://www.w3.org/2000/svg")return this.ha(e,"svg",r.el);if(r.offsetPath!=="none"&&r.offsetPath!==""&&U(r))return this.ha(e,"offset-path",r.el)}return null}ha(e,n,r){let o=x(e.el),i=x(r);switch(n){case"behind":return`${o}: part of it turns behind the viewer (3D transform on ${i}), so its DOM shows until it turns back. Lower the angle or raise the perspective.`;case"svg":return`${o}: GL elements can't sit inside an <svg> (${i}); its DOM shows. Move data-gl to an element outside the SVG.`;case"offset-path":return`${o}: offset-path on ${i} moves it along a path GL does not follow, so its DOM shows. Animate transform instead.`;case"scene":return`${o}: GL can't depth-sort several GL elements in one preserve-3d scene (${i}), so their DOM shows. Add backface-visibility: hidden to faces that turn away, or use transform-style: flat.`;case"rounded":return`${o}: WebKit draws a tilt flat when its perspective parent (${i}) also has overflow and border-radius, so its DOM shows. Put the perspective on an inner element, or round the corners with clip-path: inset(0 round <radius>).`;case"zoom":return`${o}: zoom on ${i} scales it in a way GL can't follow together with its transforms, so its DOM shows. Use transform: scale() instead of zoom.`;default:return`${o}: its on-screen box doesn't match the transforms on ${i} (turned almost edge-on?), so its DOM shows until they agree again. Lower the angle or raise the perspective.`}}checkScenes(){let e=new Map;for(let n of this.stage.planes)n.scene&&!n.backHidden&&!n.xfReason&&n.el.isConnected&&e.set(n.scene,(e.get(n.scene)||0)+1);for(let n of this.stage.planes){let r=n.scene&&!n.backHidden&&(e.get(n.scene)||0)>1?this.ha(n,"scene",n.scene):null;r!==n.sceneReason&&(n.sceneReason=r,this.stage.decide(n))}}Lb(e,n,r,o,i,s,a){let l=e[n].el,c=this.cb.get(l);if(c!==void 0)return c&&a.set(c),!!c;let f=this.za(l),u=oe(e,n),p=!0;if(u===0)Te(a,f.left+r,f.top+o,i?f.width/i:1,s?f.height/s:1);else{if(u===1)$e(Me(e,n,this.Fb),a);else{let d=Ce(e,n);this.grow(e.length),p=be(e,n,d,this.rel,this.sizes)&&!Se(e,n,d,this.rel,this.sizes,i,s,this.composed).behind,p&&Ne(this.composed.m,a)}p&&Ae(a,i,s,f.left+r,f.top+o,f.width,f.height)}return this.cb.set(l,p?a:null),p}measureClips(e,n,r=!0){if(e.nodes[e.nodes.length-1]?.topLayer)return`${x(e.el)}: it is inside an open modal <dialog> or popover (the top layer), which paints over Umber's canvas, so its DOM shows.`;let o=e.clips,i=o?o.occHow.indexOf("uncut"):-1;if(i>=0){let u=x(o.occ[i].el);this.stage.warnOnce(e,o.noSlots?`${x(e.el)}: a layer can only be cut straight, so data-gl-occlude on ${u} doesn't hide it where it passes through it or a rounded or turned corner overlaps it (GL draws over that panel there).`:`${x(e.el)}: its parents' rounded or shaped clips take both GL clip slots, so data-gl-occlude on ${u} doesn't hide it where they overlap (GL draws over that panel there). Make one of those parents' clips a straight overflow: hidden.`)}if(n){if(!this.sb.has(e)&&!this.stage.transitioning){this.sb.add(e);let p=tt(e.el,this.stage.hostEl);p&&this.stage.warnOnce(e,`${x(e.el)}: ${p}`)}if(!this.stage.transitioning){let[p]=se(e.el),d=p&&p[0]!==e.el&&!this.contexts.has(p[0])&&nt(p[0],p[1],this.stage.hostEl);if(d){this.contexts.add(p[0]);for(let[h,m]of d)this.stage.host.log.warn(m,h)}}let u=(e.el.getAttribute("data-gl-clip")||"").trim().toLowerCase()==="false";e.clips=Ke(e,e.nodes,u,this.Cb,e.clips,this.lc(e))}let s=e.clips;if(!s)return null;s.noSlots=e.kind==="layer";for(let u of s.list){let p="";if(u.by!=="overflow"){if(!n&&r){let w=getComputedStyle(u.el);u.by==="clip"?u.node.clip=w.clip||"auto":u.node.clipPath=w.clipPath||"none"}p=u.by==="clip"?u.node.clip:u.node.clipPath}let d=u.scrolls?this.stage.scrollX:this.stage.pageX,h=u.scrolls?this.stage.scrollY:this.stage.pageY,m=I(u.node),b=this.za(u.el),g=Number.isFinite(m.width)&&m.width>0?m.width:b.width,y=Number.isFinite(m.height)&&m.height>0?m.height:b.height;u.ignored=!this.Lb(e.nodes,u.depth,d,h,g,y,u.m),u.ignored||Fe(u,u.m,g,y,p)}let a=et(e,0,0,this.nc),l=this.quad;l[0]=a[0],l[1]=a[1],l[2]=a[0]+a[2],l[3]=a[1]+a[3];let c=_e(e,s,l,e.bends);e.stale&&(s.ownRadius.set(e.radius),s.ownKy=e.radiusKy);let f=!1;for(let u=0;u<4;u++)e.radius[u]=Math.max(s.ownRadius[u],s.fold[u]),f||=s.fold[u]>s.ownRadius[u];if(e.radiusKy=f?1:s.ownKy,e.kind==="layer"){if(c||s.shaders.length){let u=s.shaders[0]?.el||c?.clips[0]?.el||s.mask?.el;this.stage.warnOnce(e,`${x(e.el)}: a layer can't be cut by a rounded, shaped or masked parent (${x(u)}); it draws uncut. Make that parent's clip a straight overflow: hidden, or add data-gl-clip="false" to silence this.`),s.shaders.length=0,s.reason=null}return null}return c?Ze(e,s):null}scanAnimations(e){this.stage.animCheck=!1;let n=this.held;if(this.held=[],typeof document.getAnimations!="function")return;for(let i of this.occluders)i.until=0,i.linked=i.fades=!1;let r=!1;for(let i of this.stage.planes)i.soon&&(r=!0,i.animInfinite=i.animUntil===1/0,i.animInfinite&&(i.animUntil=0),i.scrollLinked=!1,i.animTargets.length=0,i.animUntil||(i.animLabel=""));if(!r)return;let o=typeof DocumentTimeline<"u"?DocumentTimeline:null;for(let i of document.getAnimations()){let s=i.playState,a=s==="running"&&!!i.playbackRate;if(s==="idle")continue;let l=i.effect,c=l?.target;if(!l||!c||l.pseudoElement||!Ee(i))continue;let f=!!(i.timeline&&o&&!(i.timeline instanceof o)),u=0;if(a&&!f){let h=l.getComputedTiming(),m=Number(h.endTime),b=Number(h.localTime??0)||0;u=m===1/0?1/0:e+Math.max(0,i.playbackRate<0?b:m-b)/Math.abs(i.playbackRate)+50}for(let h of this.occluders)!c.contains(h.el)||u===1/0&&mn(l)||(h.fades||=at(l,u===1/0),f?h.linked=!0:u>h.until&&(h.until=u));let p=typeof CSSTransition<"u"&&i instanceof CSSTransition?"CSS transition":typeof CSSAnimation<"u"&&i instanceof CSSAnimation?"CSS animation":"Web Animation",d=null;for(let h of this.stage.planes)if(h.soon&&(c===h.el||c.contains(h.geomEl))){if(h.animTargets.includes(c)||h.animTargets.push(c),f){h.scrollLinked=!0,h.animLabel||=`scroll-driven ${p} on ${x(c)}`;continue}if(!a){let m=!1;if(d)m=!n.some(b=>b.a===i);else{let b=n.find(g=>g.a===i);m=!b,d={a:i,t:b?b.t:i.currentTime,state:s,planes:[]},this.held.push(d)}m&&(h.heldMoved=!0),d.planes.push(h),h.animLabel||=`${s} ${p} on ${x(c)} (followed while a script moves its time)`;continue}u>h.animUntil&&(h.animUntil=u,h.animLabel=`${u===1/0?"infinite ":""}${p} on ${x(c)}`)}}for(let i of this.stage.planes)i.animInfinite&&(i.animInfinite=!1,i.animUntil!==1/0&&(i.stale=!0))}checkHeld(){for(let e of this.held){let n=e.a.playState;n!==e.state&&(e.state=n,this.stage.animCheck=!0,this.stage.request());let r=e.a.currentTime;if(r!==e.t){e.t=r;for(let o of e.planes)o.heldMoved=!0}}}Jb(e){if(this.stage.inactive)return;for(let r of this.held)if(r.a===e)return this.stage.request();if(!Ee(e))return;let n=e.effect?.target;if(n){if(this.occluders.some(r=>n.contains(r.el)))return this.stage.animCheck=!0,this.stage.request();this.stage.onAnimate(n)}}$b(){let e=document.querySelectorAll("[data-gl-occlude]");if(!e.length&&!this.occluders.length)return;this.Ab=+getComputedStyle(this.stage.hostEl).zIndex||0;let n=e.length!==this.occluders.length,r=[];if(e.forEach((o,i)=>{let s=this.occluders.find(a=>a.el===o);s||(s=gn(o)),this.occluders[i]!==s&&(n=!0),r.push(s)}),this.occluders=r,!!n){this.Ec();for(let o of this.stage.planes)o.stale=!0;this.stage.markDirty()}}bc(e){let n=this.occluders;for(let o=0;o<n.length;o++){let i=n[o];i.want=i.over=!1,!i.ignored&&!i.el.isConnected&&(i.ignored=!0,this.stage.markDirty())}let r=this.stage.planes;for(let o=0;o<r.length;o++){let i=r[o],s=i.clips,a=s?.occ;if(a?.length&&(i.soon||i.visible))for(let l=0;l<a.length;l++)a[l].want=!0,(s.occHow[l]!=="pruned"||s.cutBy===a[l])&&(a[l].over=!0)}for(let o=0;o<n.length;o++){let i=n[o],s=i.linked||e<i.until;(i.live||s)&&i.want&&i.el.isConnected&&(this.Mb(i,!1,s&&i.fades),e<i.until&&(i.until<1/0||i.over)&&(this.stage.forced||=1))}}hook(e){if(e===document.body||e===document.documentElement)return!1;for(let n of this.occluders)if(pn(e,n.el))return this.ua=!0;return!1}Ec(){if(!(typeof MutationObserver>"u")&&(this.watch?this.watch.disconnect():(this.watch=new MutationObserver(e=>{for(let n of e)(n.type==="childList"?it(n.addedNodes)||it(n.removedNodes):this.hook(n.target))&&(this.ua=!0,this.stage.request())}),this.stage.cleanups.push(()=>this.watch.disconnect())),!!this.occluders.length)){this.watch.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["aria-expanded","aria-hidden","open","data-state","hidden"]});for(let e of this.occluders)this.watch.observe(e.el,{childList:!0,subtree:!0})}}Mb(e,n,r=n){if(n&&(e.nodes=xe(e.el,this.stage.chainMemo),e.node=e.nodes[0],e.scrolls=this.Cb(e.el),e.live=De(e.nodes,this.stage.host.scroll.root)||e.el.hasAttribute("data-gl-live"),e.stack=se(e.el),e.cuts=e.nodes.length?ne(e.nodes).sources.filter(d=>d.by==="overflow"&&!oe(e.nodes,d.depth)).map(d=>d.node):[]),!e.nodes.length)return;if(r){let d=getComputedStyle(e.el);n||(e.node.clipPath=d.clipPath||"none");let h=d.visibility==="hidden"||e.el.checkVisibility?.()===!1;for(let m=0;m<e.nodes.length&&!h;m++)h=parseFloat(n?e.nodes[m].opacity:getComputedStyle(e.nodes[m].el).opacity)===0;e.hidden=h}if(n&&!e.hidden&&!e.warned&&e.el.getAttribute("data-gl")!=="shader"&&!ot(e.el)&&(e.warned=!0,this.stage.host.log.warn(`data-gl-occlude on ${x(e.el)}: its background isn't opaque (or it is faded), so GL under it is cut where the page shows through. Give it an opaque background, or remove data-gl-occlude.`,e.el)),e.ignored=e.hidden||!e.el.isConnected,e.ignored)return;let o=this.za(e.el),i=I(e.node),s=Number.isFinite(i.width)&&i.width>0?i.width:o.width,a=Number.isFinite(i.height)&&i.height>0?i.height:o.height;if(e.ignored=o.width<=0||o.height<=0,e.ignored)return;let l=e.scrolls?this.stage.scrollX:this.stage.pageX,c=e.scrolls?this.stage.scrollY:this.stage.pageY;if(e.ignored=!this.Lb(e.nodes,0,l,c,s,a,e.m),e.ignored)return;let f=e.full;if(e.shape&&e.shape===e.from)for(let d=0;d<4;d++)e.shape.box[d]=f[d],e.shape.radius[d]=f[d+4];if(Fe(e,e.m,s,a,/^(inset|circle|ellipse|rect|xywh)\(/.test(e.node.clipPath)?e.node.clipPath:"border-box"),e.shape&&e.shape!==e.from){e.from=e.shape;for(let d=0;d<4;d++)f[d]=e.shape.box[d],f[d+4]=e.shape.radius[d]}if(e.ignored=this.cut(e,l,c),e.ignored)return;n&&e.reason==="mixed-corners"&&this.stage.host.log.warn(`data-gl-occlude on ${x(e.el)}: its corners mix shapes (round and oval), so it cuts nothing (GL draws over it). Give all its corners the same shape.`,e.el),e.axis=K(e.m);let u=e.shape,p=u&&u.kind===0?Math.max(u.radius[0],u.radius[1],u.radius[2],u.radius[3]):0;e.rx=p*e.m[0],e.ry=u?p/u.ky*e.m[4]:0}cut(e,n,r){let o=e.bounds,i=e.shape,s=e.m;if(!i)return!1;if(i.kind||s[1]||s[3]||s[2]||s[5]||!(s[0]>0&&s[4]>0))return o[2]<=o[0]||o[3]<=o[1];let a=o[0],l=o[1],c=o[2],f=o[3],u=e.cuts;for(let d=0;d<u.length;d++){let h=u[d],m=this.za(h.el),{border:b,scrollbar:g,direction:y}=I(h),w=y==="rtl"?g[0]:0;h.overflowX!=="visible"&&(a=Math.max(a,m.left+n+b[3]+w),c=Math.min(c,m.right+n-b[1]-g[0]+w)),h.overflowY!=="visible"&&(l=Math.max(l,m.top+r+b[0]),f=Math.min(f,m.bottom+r-b[2]-g[1]))}if(c<=a||f<=l)return!0;if(a===o[0]&&l===o[1]&&c===o[2]&&f===o[3])return!1;let p=i.radius;return l>o[1]&&(p[0]=p[1]=0),c<o[2]&&(p[1]=p[2]=0),f<o[3]&&(p[2]=p[3]=0),a>o[0]&&(p[3]=p[0]=0),i.box[0]=(a-s[6])/s[0],i.box[1]=(l-s[7])/s[4]*i.ky,i.box[2]=(c-a)/s[0],i.box[3]=(f-l)/s[4]*i.ky,o[0]=a,o[1]=l,o[2]=c,o[3]=f,!1}bb(){if(!(this.$a||!this.occluders.length)){this.$a=!0;for(let e of this.occluders){let n=e.bounds[0]+e.bounds[1]*3+e.bounds[2]*5+e.bounds[3]*7+(e.ignored?.5:0),r=e.stack,o=e.at,i=e.nodes.length>0;if(this.Mb(e,!0),e.bounds[0]+e.bounds[1]*3+e.bounds[2]*5+e.bounds[3]*7+(e.ignored?.5:0)!==n&&this.stage.markDirty(),e.at=e.el.previousElementSibling||e.el.parentElement,i&&(e.at!==o||r.length!==e.stack.length||r.some((s,a)=>s[0]!==e.stack[a][0]||s[1]!==e.stack[a][1]))){for(let s of this.stage.planes)s.stale=!0;this.stage.markDirty()}}}}lc(e){if(!this.occluders.length||this.Ab<=0)return Re;this.bb();let n=(e.el.getAttribute("data-gl-under")||"").trim();if(n==="none")return Re;let r=null;if(n){try{r=this.occluders.filter(s=>s.el.matches(n))}catch{r=[]}r.length||(this.stage.warnOnce(e,`${x(e.el)}: data-gl-under="${n}" matches no [data-gl-occlude] element, so its occluders are the usual ones (those after it in the page).`),r=null)}let o=[],i=null;for(let s of r||this.occluders){if(s.el.contains(e.el)){r&&this.stage.warnOnce(e,`${x(e.el)}: data-gl-under names ${x(s.el)}, which holds it; a panel never cuts what is inside it.`);continue}e.el.contains(s.el)&&e.kind!=="shader"||!r&&!rt(e.el,i??=se(e.el),s.el,s.stack)||o.push(s)}return o.length?o:Re}za(e){let n=this.gb.get(e);return n||(n=e.getBoundingClientRect(),this.gb.set(e,n)),n}frame(e,n){let r=this.stage,o=this.ci;o.scrollX=r.scrollX,o.scrollY=r.scrollY,o.pageX=r.pageX,o.pageY=r.pageY,o.cw=r.canvas.width,o.ch=r.canvas.height,o.kx=r.canvas.width/Math.max(e,1),o.ky=r.canvas.height/Math.max(n,1)}clip(e,n){return Qe(e.clips,n,e.bends,this.ci)}placeDraw(e,n,r){let o=e.drawXf,i=e.pad,s=e.edge[0],a=e.size;a[0]=(e.boxW+2*i)*s,a[1]=(e.boxH+2*i)*s;let l=e.xf,c=e.xfDraw,f=1/s;c[0]=l[0]*f,c[1]=l[1]*f,c[2]=l[2]*f,c[3]=l[3]*f,c[4]=l[4]*f,c[5]=l[5]*f,c[6]=l[6]-i*(l[0]+l[3]),c[7]=l[7]-i*(l[1]+l[4]),c[8]=l[8]-i*(l[2]+l[5]);for(let m=0;m<3;m++)o[m*3]=c[m*3]-n*c[m*3+2],o[m*3+1]=c[m*3+1]-r*c[m*3+2],o[m*3+2]=c[m*3+2];let u=a[0]/2,p=a[1]/2,d=o[2]*u+o[5]*p+o[8],h=e.shaderRect;h[0]=(o[0]*u+o[3]*p+o[6])/d-u,h[1]=(o[1]*u+o[4]*p+o[7])/d-p,h[2]=a[0],h[3]=a[1]}pointer(e,n,r){let o=e.invDraw;if(!D(o,e.xfDraw))return;let i=o[2]*n+o[5]*r+o[8];e.mouseTarget[0]=(o[0]*n+o[3]*r+o[6])/i/Math.max(e.size[0],1),e.mouseTarget[1]=(o[1]*n+o[4]*r+o[7])/i/Math.max(e.size[1],1)}cutBy(e){return`it is entirely cut off by ${Q(e)} on ${x(e.el)}`}report(e,n){let r=e.clips,o=(r?.list||[]).map(i=>(i.ignored&&n.push(`the ${Q(i)} clip on ${x(i.el)} is skipped right now: part of that parent turns behind the viewer`),{el:i.el,by:i.by,shape:Q(i),how:i.how}));return r?.occ.forEach((i,s)=>{let a=r.occHow[s]||"pruned";a==="uncut"&&n.push(`data-gl-occlude on ${x(i.el)} overlaps it, but ${r.noSlots?"a layer is only cut straight":"its parents' clips take both GL clip slots"}: GL draws over that panel there`),o.push({el:i.el,by:i.by,shape:Q(i),how:a})}),o}};function Yn(t){t.shapesError=null,t.shapes=new ae(t),t.animCheck=!0;for(let e of t.planes)e.stale=!0,e.shapeWait=!1;t.markDirty()}export{Yn as shapes};
|
|
1
|
+
/*! Umber v0.4.0 | (c) Ravi Klaassens | UNLICENSED */
|
|
2
|
+
function e(e){return typeof e=="number"?new Float64Array(e):new Float64Array(e)}function t(e){return typeof e=="number"?new Float32Array(e):new Float32Array(e)}function n(e){return new Int32Array(e)}var r=(e,t)=>e[t]??NaN;function i(e){if(!e||typeof e.tagName!="string")return"<?>";let t=e.tagName.toLowerCase();if(e.id)return`<${t}#${e.id}>`;let n=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";return n?`<${t}.${n}>`:`<${t}>`}function o(e,t){let n=t[0],r=t[1],i=t[2],o=t[3],l=t[4],s=t[5],a=t[6],u=t[7],c=t[8],h=l*c-s*u,d=-(o*c-s*a),f=o*u-l*a,p=n*h+r*d+i*f;if(!p||!Number.isFinite(p))return!1;let m=1/p;return e[0]=h*m,e[1]=-(r*c-i*u)*m,e[2]=(r*s-i*l)*m,e[3]=d*m,e[4]=(n*c-i*a)*m,e[5]=-(n*s-i*o)*m,e[6]=f*m,e[7]=-(n*u-r*a)*m,e[8]=(n*l-r*o)*m,!0}function l(e,t,n,{r:r,sx:i,sy:o}){return e.fill(0),e[0]=t?r.width/t:1,e[4]=n?r.height/n:1,e[6]=r.left+i,e[7]=r.top+o,e[8]=1,e}function s(e,t){let n=e.trim();if(n.startsWith("calc(")&&n.endsWith(")"))n=n.slice(5,-1).trim();else if(n.includes("("))return NaN;let r=0,i=1,o=!0;for(let e of n.split(/\s+/))if(e){if(o)r+=i*a(e,t);else if(e==="+"||e==="-")i=e==="-"?-1:1;else return NaN;o=!o}return o?NaN:r}function a(e,t){let[,n,r]=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(px|%)?$/i.exec(e)??[];if(n===void 0)return NaN;let i=parseFloat(n);return!r&&i!==0?NaN:r==="%"?i/100*t:i}function u(e){let t=[],n=0,r="";for(let i of e.trim())i==="("?n++:i===")"&&n--,/\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t}function c(e){let t=[],n=0,r="";for(let i of e)i==="("?n++:i===")"&&n--,i===","&&n===0?(t.push(r.trim()),r=""):r+=i;return t.push(r.trim()),t}function h(e,t,n){let r={rx:[0,0,0,0],ry:[0,0,0,0]};for(let[i,o]of e.entries()){let[e="0px",l=e]=u(o||"0px"),a=s(e,t),c=s(l,n);if(!Number.isFinite(a)||!Number.isFinite(c))return null;a>0&&c>0&&d(r,i,a,c)}return f(r,t,n)}function d(e,t,n,r){e.rx[t]=n,e.ry[t]=r}function f(e,t,n){let{rx:r,ry:i}=e,o=[[t,r[0]+r[1]],[n,i[1]+i[2]],[t,r[2]+r[3]],[n,i[3]+i[0]]],l=1;for(let[e,t]of o)t>0&&(l=Math.min(l,Math.max(e,0)/t));return l<1&&(e.rx=[r[0]*l,r[1]*l,r[2]*l,r[3]*l],e.ry=[i[0]*l,i[1]*l,i[2]*l,i[3]*l]),e}function p(e,t,n,r){let[i,o,l,s]=t,a=[[s,i],[o,i],[o,l],[s,l]],u={rx:[0,0,0,0],ry:[0,0,0,0]};for(let[t,[n,r]]of a.entries()){let i=e.rx[t]??0,o=e.ry[t]??0;i<=0||o<=0||d(u,t,Math.max(0,i-n),Math.max(0,o-r))}return f(u,n,r)}function m(e){let t=0;for(let[n,r]of e.rx.entries()){let i=e.ry[n]??0;if(!(r<=0||i<=0)){if(!t)t=r/i;else if(Math.abs(r/t-i)>1)return NaN}}return t||1}var b=8;function g(e,t){let[n,r,i,o]=t.border,[l,s,a,u]=t.padding,[c,h,d,f]=t.margin;switch(e){case"padding-box":return{x:o,y:n,w:t.w-o-r,h:t.h-n-i,edges:[n,r,i,o]};case"content-box":case"fill-box":return{x:o+u,y:n+l,w:t.w-o-r-u-s,h:t.h-n-i-l-a,edges:[n+l,r+s,i+a,o+u]};case"margin-box":return{x:-f,y:-c,w:t.w+f+h,h:t.h+c+d,edges:[-c,-h,-d,-f]};default:return{x:0,y:0,w:t.w,h:t.h,edges:[0,0,0,0]}}}var v=/\s*\b(border-box|padding-box|content-box|margin-box|fill-box|stroke-box|view-box)\s*$/;function y({x:e,y:t,w:n,h:r},i){let o=i??{rx:[0,0,0,0],ry:[0,0,0,0]},l=m(o);return Number.isFinite(l)?{shape:{kind:0,box:[e,t*l,Math.max(0,n),Math.max(0,r)*l],radius:[...o.rx],points:null,ky:l}}:{reason:"mixed-corners"}}function w(e){let[t="",n]=e.split("/"),r=x(u(t)),i=n===void 0?r:x(u(n));return!r||!i?null:[`${r[0]} ${i[0]}`,`${r[1]} ${i[1]}`,`${r[2]} ${i[2]}`,`${r[3]} ${i[3]}`]}function x(e){let[t]=e;if(t===void 0)return null;let[,n=t,r=t,i=n]=e;return[t,n,r,i]}function k(e,t){let[n="",r]=e.split(/\bround\b/),i=u(n),[o]=i;if(o===void 0)return{reason:"unparsed"};let[,l=o,a=o,c=l]=i,d=s(o,t.h),p=s(l,t.w),m=s(a,t.h),b=s(c,t.w);if(![d,p,m,b].every(Number.isFinite))return{reason:"unparsed"};let g=Math.max(0,t.w-b-p),v=Math.max(0,t.h-d-m),x=null;if(r){let e=w(r),n=e&&h(e,t.w,t.h);if(!n)return{reason:"unparsed"};x=f(n,g,v)}return y({x:t.x+b,y:t.y+d,w:g,h:v},x)}function M(e,t){let[n,r,i,o]=e,l;if(n===void 0)l=[t.w/2,t.h/2];else if(i===void 0)l=S(n,r??"center",t);else if(e.length===4&&r!==void 0&&o!==void 0)l=N([n,r],[i,o],t);else return null;return Number.isFinite(l[0])&&Number.isFinite(l[1])?l:null}var $={left:[0,"x"],right:[1,"x"],top:[0,"y"],bottom:[1,"y"],center:[.5,""]};function S(e,t,n){($[e]?.[1]==="y"||$[t]?.[1]==="x")&&([e,t]=[t,e]);let r=$[e],i=$[t];return[r?r[0]*n.w:s(e,n.w),i?i[0]*n.h:s(t,n.h)]}function N(e,t,n){let[r,i]=$[e[0]]?.[1]==="y"?[t,e]:[e,t],o=([e,t],n)=>{let r=s(t,n);return e==="right"||e==="bottom"?n-r:r};return[o(r,n.w),o(i,n.h)]}function F(e,t,n,r){return!e||e==="closest-side"?Math.min(Math.abs(t),Math.abs(n-t)):e==="farthest-side"?Math.max(Math.abs(t),Math.abs(n-t)):s(e,r)}function P(e,t,n){let[r="",i]=t.split(/\bat\b/),o=u(r),l=M(u(i??""),n);if(!l)return{reason:"unparsed"};let[a,c]=l,h,d;if(e==="circle"){let e=o[0];h=!e||e.endsWith("-side")?(e==="farthest-side"?Math.max:Math.min)(F(e,a,n.w,0),F(e,c,n.h,0)):s(e,Math.hypot(n.w,n.h)/Math.SQRT2),d=h}else h=F(o[0],a,n.w,n.w),d=F(o[1],c,n.h,n.h);if(!Number.isFinite(h)||!Number.isFinite(d))return{reason:"unparsed"};h>0&&d>0||(h=0,d=0);let f=d>0?h/d:1,p=n.x+a,m=(n.y+c)*f;return{shape:{kind:0,box:[p-h,m-h,2*h,2*h],radius:[h,h,h,h],points:null,ky:f}}}function C(e,t,n){let i=e.length/2,o=(t+1)%i,l=(n+1)%i,s=r(e,t*2),a=r(e,t*2+1),u=r(e,o*2),c=r(e,o*2+1),h=r(e,n*2),d=r(e,n*2+1),f=r(e,l*2),p=r(e,l*2+1),m=(f-h)*(a-d)-(p-d)*(s-h),b=(f-h)*(c-d)-(p-d)*(u-h),g=(u-s)*(d-a)-(c-a)*(h-s),v=(u-s)*(p-a)-(c-a)*(f-s);return m*b<0&&g*v<0}function z(e){let t=e.length/2;for(let n=0;n<t;n++)for(let r=n+1;r<t;r++)if(!(n===(r+1)%t||(n+1)%t===r)&&C(e,n,r))return!0;return!1}function O(e){let[t,n,r,i,o,l,s,a]=e;if(e.length!==8||t===void 0||n===void 0||r===void 0||i===void 0||o===void 0||l===void 0||s===void 0||a===void 0)return null;let u=[t,r,o,s],c=[n,i,l,a];if(t!==r&&n!==i||r!==o&&i!==l||o!==s&&l!==a||s!==t&&a!==n||new Set(u).size>2||new Set(c).size>2)return null;let h=Math.min(...u),d=Math.min(...c);return{x:h,y:d,w:Math.max(...u)-h,h:Math.max(...c)-d}}function L(e,t){let n=c(e),r=!1,[i]=n;(i==="evenodd"||i==="nonzero")&&(r=n.shift()==="evenodd");let o=[];for(let e of n){let[n,r]=u(e),i=s(n??"",t.w),l=s(r??"",t.h);if(!Number.isFinite(i)||!Number.isFinite(l))return{reason:"unparsed"};o.push(t.x+i,t.y+l)}let l=O(o);return l?y(l,null):o.length/2>b?{reason:"polygon-points"}:!r&&z(o)?{reason:"polygon-nonzero"}:{shape:{kind:1,box:[0,0,0,0],radius:[0,0,0,0],points:o,ky:1}}}function _(e,t){let n=(e||"none").trim();if(n==="none"||n==="")return null;let r="border-box",i=v.exec(n),[,o]=i??[];i&&o&&(r=o,n=n.slice(0,i.index).trim());let l=g(r,t);if(!n){let e=h(t.radius,t.w,t.h);return e?y(l,p(e,l.edges,l.w,l.h)):{reason:"unparsed"}}let[,s,a]=/^([a-z-]+)\((.*)\)$/s.exec(n)??[];if(s===void 0||a===void 0)return{reason:"unsupported"};if(/\b(min|max|clamp|var|env)\(/.test(a))return{reason:"unparsed"};switch(s){case"inset":return k(a,l);case"rect":return D(a,l);case"xywh":return T(a,l);case"circle":case"ellipse":return P(s,a,l);case"polygon":return L(a,l);default:return{reason:"unsupported"}}}function D(e,t){let[n="",r]=e.split(/\bround\b/),[i,o,l,a]=u(n);if(i===void 0||o===void 0||l===void 0||a===void 0)return{reason:"unparsed"};let c=(e,t,n)=>e==="auto"?n:s(e,t),h=c(i,t.h,0),d=t.w-c(o,t.w,t.w),f=t.h-c(l,t.h,t.h),p=c(a,t.w,0);return k(`${h}px ${d}px ${f}px ${p}px${r?` round ${r}`:""}`,t)}function T(e,t){let[n="",r]=e.split(/\bround\b/),[i,o,l,a]=u(n).map((e,n)=>s(e,n%2?t.h:t.w));return i===void 0||o===void 0||l===void 0||a===void 0?{reason:"unparsed"}:k(`${o}px ${t.w-i-l}px ${t.h-o-a}px ${i}px${r?` round ${r}`:""}`,t)}function Y(e,t,n){let[,r]=/^rect\((.*)\)$/.exec((e||"auto").trim())??[];if(r===void 0)return null;let i=r.split(/\s*,\s*|\s+/).filter(Boolean),[o,l,a,u]=i;if(i.length!==4||!o||!l||!a||!u)return{reason:"unparsed"};let c=(e,t)=>e==="auto"?t:s(e,0),h=c(o,0),d=c(l,t),f=c(a,n),p=c(u,0);return[h,d,f,p].every(Number.isFinite)?y({x:p,y:h,w:d-p,h:f-h},null):{reason:"unparsed"}}function X(e,t,{box:n,radius:r},i=0){let o=n[2],l=n[3],[s,a,u,c]=[r[0],r[1],r[2],r[3]],h=Math.min(1,o/Math.max(s+a,1e-5),l/Math.max(a+u,1e-5),o/Math.max(u+c,1e-5),l/Math.max(c+s,1e-5)),d=e-n[0],f=t-n[1],p=Math.abs(d-o/2)-o/2,m=Math.abs(f-l/2)-l/2,b=Math.hypot(Math.max(p,0),Math.max(m,0))+Math.min(Math.max(p,m),0);return b=H(b,d,f,s*h),b=H(b,o-d,f,a*h),b=H(b,o-d,l-f,u*h),b=H(b,d,l-f,c*h),b<=i}function H(e,t,n,r){return Math.max(t,n)>=r?e:Math.max(e,Math.hypot(t-r,n-r)-r)}function A(e,t,n){let i=n.length/2,o=!1;for(let l=0,s=i-1;l<i;s=l++){let i=r(n,l*2),a=r(n,l*2+1),u=r(n,s*2),c=r(n,s*2+1);a>t!=c>t&&e<(u-i)*(t-a)/(c-a)+i&&(o=!o)}return o}var j=e=>parseFloat(e??"0")||0,I=(e,t)=>e===void 0||e===""?t:e,G=e=>!!e&&e!=="none";function W(e){try{return e.matches(":modal")||e.matches(":popover-open")}catch{return!1}}function E(e,t){let n=t.get(e);if(n)return n;let r=getComputedStyle(e),i=[r.maskImage,r.getPropertyValue("-webkit-mask-image"),r.maskBorderSource,r.getPropertyValue("-webkit-mask-box-image-source")].some(G),o={el:e,tag:e.localName||e.tagName.toLowerCase(),display:r.display,position:I(r.position,"static"),overflowX:I(r.overflowX,"visible"),overflowY:I(r.overflowY,"visible"),contain:I(r.contain,"none"),contentVisibility:I(r.contentVisibility,"visible"),willChange:I(r.willChange,"auto"),filter:I(r.filter,"none"),backdropFilter:I(r.backdropFilter||r.webkitBackdropFilter,"none"),clipPath:I(r.clipPath,"none"),clip:I(r.getPropertyValue("clip"),"auto"),mask:i,transform:I(r.transform,"none"),translate:I(r.translate,"none"),rotate:I(r.rotate,"none"),scale:I(r.scale,"none"),perspective:I(r.perspective,"none"),transformOrigin:I(r.transformOrigin,""),perspectiveOrigin:I(r.perspectiveOrigin,""),transformStyle:I(r.transformStyle,"flat"),backfaceVisibility:I(r.backfaceVisibility||r.getPropertyValue("-webkit-backface-visibility"),"visible"),offsetPath:I(r.offsetPath,"none"),opacity:I(r.opacity,"1"),isolation:I(r.isolation,"auto"),mixBlendMode:I(r.mixBlendMode,"normal"),zoom:I(r.zoom,"1"),zIndex:r.zIndex,topLayer:W(e)};return t.set(e,o),o}function R(e,t){if(t.has(e.el))return;t.add(e.el);let n=getComputedStyle(e.el);e.transform=n.transform||"none",e.translate=n.translate||"none",e.rotate=n.rotate||"none",e.scale=n.scale||"none",e.transformOrigin=n.transformOrigin||"",e.perspective=n.perspective||"none",e.perspectiveOrigin=n.perspectiveOrigin||"",e.box=void 0}function U(e,t,n,r){let i=Math.min(n+1,e.length-1);V.length<i*2+2&&(V=new Float64Array(i*4+4));let o=V,{rel:l,sizes:s}=r;for(let n=t;n<=i;n++){let t=e[n];if(!t||!(t.el instanceof HTMLElement))return!1;let i=t.el;Z(i,o,n*2,r.bodyOrNull);let l=Q(t);s[n*2]=Number.isFinite(l.width)?l.width:i.offsetWidth,s[n*2+1]=Number.isFinite(l.height)?l.height:i.offsetHeight}for(let n=t;n<i;n++){let t=e[n+1];if(!t)break;B(t,o,n,l)}return!0}var V=new Float64Array(64);function B(e,t,n,i){let o=e.tag!=="html"&&e.tag!=="body";i[n*2]=r(t,n*2)-r(t,(n+1)*2)-(o?e.el.scrollLeft:0),i[n*2+1]=r(t,n*2+1)-r(t,(n+1)*2+1)-(o?e.el.scrollTop:0)}var q=e=>window.scrollX||(e()?.scrollLeft??0),K=e=>window.scrollY||(e()?.scrollTop??0),J=e=>(e.overflowY==="auto"||e.overflowY==="scroll")&&e.el.scrollHeight>e.el.clientHeight;function Z(e,t,n,r){let i=0,o=0,l=e;for(;;){i+=l.offsetLeft,o+=l.offsetTop;let e=l.offsetParent;if(!e){getComputedStyle(l).position==="fixed"&&(i+=q(r),o+=K(r));break}if(e===document.body)break;i+=e.clientLeft,o+=e.clientTop,l=e}t[n]=i,t[n+1]=o}function Q(e){if(e.box)return e.box;let t=e.el,n=getComputedStyle(t),r=(e,t="")=>[j(n[`${e}Top${t}`]),j(n[`${e}Right${t}`]),j(n[`${e}Bottom${t}`]),j(n[`${e}Left${t}`])],i=r("border","Width"),o=r("padding"),l=r("margin"),[s,a]=ee(n),u=[0,0],c=e=>e==="auto"||e==="scroll";if(t instanceof HTMLElement&&(c(e.overflowX)||c(e.overflowY))){let e=t.offsetWidth-t.clientWidth-i[1]-i[3],n=t.offsetHeight-t.clientHeight-i[0]-i[2];u=[e>=2?e:0,n>=2?n:0]}return e.box={border:i,padding:o,margin:l,radius:[n.borderTopLeftRadius||"0px",n.borderTopRightRadius||"0px",n.borderBottomRightRadius||"0px",n.borderBottomLeftRadius||"0px"],width:s,height:a,direction:n.direction||"ltr",overflowClipMargin:n.overflowClipMargin||"0px",scrollbar:u},e.box}function ee(e){let t=e.width.endsWith("px")?j(e.width):NaN,n=e.height.endsWith("px")?j(e.height):NaN;return e.boxSizing!=="border-box"&&(t+=j(e.paddingLeft)+j(e.paddingRight)+j(e.borderLeftWidth)+j(e.borderRightWidth),n+=j(e.paddingTop)+j(e.paddingBottom)+j(e.borderTopWidth)+j(e.borderBottomWidth)),[t,n]}function te(e){return e.assignedSlot??e.parentElement??e.parentNode?.host??null}function ne(e,t){let n=[],r=e;for(;r;){let e=E(r,t);if(n.push(e),e.tag==="html"||e.topLayer)break;r=te(r)}return n}var re=(e,...t)=>t.some(t=>new RegExp(`\\b${t}\\b`).test(e)),ie=e=>e.tag==="html",oe=e=>{let t=ie(e)?e.willChange.replace(/(^|,)\s*(backdrop-)?filter\s*(?=,|$)/g,"$1"):e.willChange;return re(t,"transform","perspective","filter","translate","rotate","scale")},le=["transform","translate","rotate","scale","perspective","filter","backdropFilter"];function se(e,{countZoom:t=!0}={}){for(let t of le)if(e[t]!=="none"&&!(ie(e)&&t.endsWith("ilter")))return`${t==="backdropFilter"?"backdrop-filter":t}: ${e[t]}`;if(re(e.contain,"layout","paint","strict","content"))return`contain: ${e.contain}`;if(e.contentVisibility==="auto"||e.contentVisibility==="hidden")return`content-visibility: ${e.contentVisibility}`;if(oe(e))return`will-change: ${e.willChange}`;let n=parseFloat(e.zoom??"1");return t&&Number.isFinite(n)&&Math.abs(n-1)>1e-6?`zoom: ${e.zoom}`:null}var ae=e=>se(e,{countZoom:!1})!==null;function ue(e,t=null){for(let[n,r]of e.entries()){if(r.tag==="html")break;if(r.position==="fixed"&&!ce(e,n)||r.position==="sticky"&&he(e,n,t))return!0}return!1}function ce(e,t){return e.some((e,n)=>n>t&&ae(e))}function he(e,t,n){for(let r=t+1;r<e.length;r++){let t=e[r];if(!t)break;if(t.el===n||t.tag==="html"||t.tag==="body")return!0;if(pe(t))return!1}return!0}function de(e){let t=e.at(-1);return t?.tag!=="html"||t.overflowX==="visible"&&t.overflowY==="visible"}function fe(e,t){return e.tag==="html"||e.tag==="body"&&(t||J(e))}function pe(e){let t=e=>e==="hidden"||e==="auto"||e==="scroll"||e==="overlay";return e.display!=="inline"&&e.display!=="contents"&&(t(e.overflowX)||t(e.overflowY))}function me(e){return e.position!=="static"||ae(e)}function be(e){return e.display==="inline"?!1:e.overflowX!=="visible"||e.overflowY!=="visible"||re(e.contain,"paint","strict","content")||e.contentVisibility==="auto"||e.contentVisibility==="hidden"}function ge(e,t=0,n=!1){let r=[],i=null,[o]=e;if(!o)return{sources:r,mask:i};let l=de(e),s=n?e.slice(0,t+1):e,a=o.position;for(let[e,t]of s.entries())t.display!=="contents"&&(e>0&&ye(a,t)&&(be(t)&&!fe(t,l)&&r.push({node:t,depth:e,by:"overflow"}),a=t.position),ve(t,e,r),t.mask&&!i&&(i=t));return{sources:r,mask:i}}function ve(e,t,n){e.clipPath!=="none"&&n.push({node:e,depth:t,by:"clip-path"}),e.clip!=="auto"&&e.clip!==""&&(e.position==="absolute"||e.position==="fixed")&&n.push({node:e,depth:t,by:"clip"})}function ye(e,t){return e==="static"||e==="relative"||e==="sticky"?!0:e==="absolute"?me(t):e==="fixed"&&ae(t)}function we(e,t){let[n,r,i,o]=t.padding,[l,s,a,u]=t.border;return e==="content-box"?[n,r,i,o]:e==="border-box"?[-l,-s,-a,-u]:[0,0,0,0]}function xe(e,t,n,r){let i=(t.overflowClipMargin||"0px").trim().split(/\s+/),o=i.find(e=>e.endsWith("-box"))??"padding-box",l=Math.max(0,s(i.find(e=>!e.endsWith("-box"))??"0px",0)||0),a=we(o,t),u=[a[0]-l,a[1]-l,a[2]-l,a[3]-l];return e.overflowX==="clip"&&(n[0]+=u[3],n[2]-=u[1]),e.overflowY==="clip"&&(n[1]+=u[0],n[3]-=u[2]),[r[0]+u[0],r[1]+u[1],r[2]+u[2],r[3]+u[3]]}var ke=1e6;function Me(e,t,n,r){let[i,o,l,s]=t.border,[a,u]=t.scrollbar,c=t.direction==="rtl",d=[s+(c?a:0),i,n-o-(c?0:a),r-l-u],f=[i,o,l,s];(e.overflowX==="clip"||e.overflowY==="clip")&&(f=xe(e,t,d,f));let m=re(e.contain,"paint","strict","content"),b=e.overflowX==="visible"&&!m,g=e.overflowY==="visible"&&!m;b&&(d[0]=-ke,d[2]=ke),g&&(d[1]=-ke,d[3]=ke);let v=null;if(!b&&!g){let e=h(t.radius,n,r);if(!e)return{reason:"unparsed"};v=p(e,f,d[2]-d[0],d[3]-d[1])}return $e(d,v)}function $e([e,t,n,r],i){let o=i?m(i):1;return Number.isFinite(o)?{shape:{kind:0,box:[e,t*o,Math.max(0,n-e),Math.max(0,r-t)*o],radius:i?[...i.rx]:[0,0,0,0],points:null,ky:o}}:{reason:"mixed-corners"}}var Se=1e-9,Ne=1e-6;function Fe(e){return e.fill(0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Pe(e,t,n){let i=Ce;for(let e=0;e<4;e++){let o=r(n,e*4),l=r(n,e*4+1),s=r(n,e*4+2),a=r(n,e*4+3);for(let n=0;n<4;n++)i[e*4+n]=r(t,n)*o+r(t,4+n)*l+r(t,8+n)*s+r(t,12+n)*a}return e.set(i),e}var Ce=e(16);function ze(e,t,n,i=0){for(let o=0;o<16;o+=4){let l=r(e,o+3);e[o]=r(e,o)+t*l,e[o+1]=r(e,o+1)+n*l,e[o+2]=r(e,o+2)+i*l}return e}var Oe=(e,t)=>t<e?t:t+1;function Le(e,t,n){let i=Oe(t,0),o=Oe(t,1),l=Oe(t,2),s=Oe(n,0)*4,a=Oe(n,1)*4,u=Oe(n,2)*4;return r(e,s+i)*(r(e,a+o)*r(e,u+l)-r(e,u+o)*r(e,a+l))-r(e,a+i)*(r(e,s+o)*r(e,u+l)-r(e,u+o)*r(e,s+l))+r(e,u+i)*(r(e,s+o)*r(e,a+l)-r(e,a+o)*r(e,s+l))}function _e(e){let t=-e[3]*Le(e,3,0)+e[7]*Le(e,3,1)-e[11]*Le(e,3,2)+e[15]*Le(e,3,3);return!t||!Number.isFinite(t)?NaN:Le(e,2,2)/t}var De=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(deg|rad|grad|turn)?$/i;function Te(e){let t=De.exec(e.trim());if(!t)return NaN;let[,n="",r="deg"]=t,i=parseFloat(n);switch(r.toLowerCase()){case"rad":return i;case"grad":return i*Math.PI/200;case"turn":return i*2*Math.PI;default:return i*Math.PI/180}}function Ye(e,t){let n=e.trim();if(!n||n==="none")return null;let i=/^matrix(3d)?\((.*)\)$/.exec(n);if(!i)return null;let[,o,l=""]=i,s=l.split(",").map(Number);return s.some(e=>!Number.isFinite(e))?null:o?s.length!==16?null:(t.set(s),t):s.length!==6?null:(Fe(t),t[0]=r(s,0),t[1]=r(s,1),t[4]=r(s,2),t[5]=r(s,3),t[12]=r(s,4),t[13]=r(s,5),t)}function Xe(e,t){let n=e.trim().split(/\s+/),[r,i,o]=n,l=n.at(-1);if(!r||r==="none"||l===void 0)return null;let s=Te(l);if(!Number.isFinite(s))return null;let a=[0,0,1];return n.length===2?a=[r==="x"?1:0,r==="y"?1:0,r==="z"?1:0]:n.length===4&&(a=[Number(r),Number(i),Number(o)]),He(t,a,s)}function He(e,t,n){let r=Math.hypot(t[0],t[1],t[2]);if(Fe(e),!r||!Number.isFinite(r))return e;let i=t[0]/r,o=t[1]/r,l=t[2]/r,s=Math.sin(n),a=Math.cos(n),u=1-a;return e[0]=a+i*i*u,e[1]=o*i*u+l*s,e[2]=l*i*u-o*s,e[4]=i*o*u-l*s,e[5]=a+o*o*u,e[6]=l*o*u+i*s,e[8]=i*l*u+o*s,e[9]=o*l*u-i*s,e[10]=a+l*l*u,e}function Ae(e,t){let n=e.trim().split(/\s+/);if(!n[0]||n[0]==="none")return null;let r=(e,t)=>e===void 0?t:e.endsWith("%")?parseFloat(e)/100:parseFloat(e),i=r(n[0],1),o=r(n[1],i),l=r(n[2],1);return[i,o,l].every(Number.isFinite)?(Fe(t),t[0]=i,t[5]=o,t[10]=l,t):null}function je(e,t,n,r){let i=u(e);if(!i[0]||i[0]==="none")return null;let o=s(i[0],t),l=i[1]===void 0?0:s(i[1],n),a=i[2]===void 0?0:s(i[2],0);return[o,l,a].every(Number.isFinite)?(Fe(r),r[12]=o,r[13]=l,r[14]=a,r):null}function Ie(e,t,n){let r=u(e||""),i=r[0]===void 0?t/2:s(r[0],t),o=r[1]===void 0?n/2:s(r[1],n),l=r[2]===void 0?0:s(r[2],0);return[Number.isFinite(i)?i:t/2,Number.isFinite(o)?o:n/2,Number.isFinite(l)?l:0]}var Ge=new Set(["img","video","canvas","iframe","embed","object","svg","input","select","textarea","button"]);function We(e){return!(e.display==="contents"||e.display==="none"||e.display==="inline"&&!Ge.has(e.tag))}function Ee(e){return We(e)&&(e.transform!=="none"||e.translate!=="none"||e.rotate!=="none"||e.scale!=="none")}var Re=e(16);function Ue(e,t,n,r){if(!Ee(e))return null;let[i,o,l]=Ie(e.transformOrigin,t,n);Fe(r),ze(r,i,o,l);let s=Re;je(e.translate,t,n,s)&&Pe(r,r,s),Xe(e.rotate,s)&&Pe(r,r,s),Ae(e.scale,s)&&Pe(r,r,s),Ye(e.transform,s)&&Pe(r,r,s);let a=s;return Fe(a),a[12]=-i,a[13]=-o,a[14]=-l,Pe(r,r,a),r}function Ve(e){return Math.abs(e[2])>Se||Math.abs(e[3])>Se||Math.abs(e[6])>Se||Math.abs(e[7])>Se||Math.abs(e[8])>Se||Math.abs(e[9])>Se||Math.abs(e[11])>Se||Math.abs(e[10]-1)>Se}function Be(e){return Math.abs(e[1])>Se||Math.abs(e[4])>Se||e[0]<=Se||e[5]<=Se}function qe(e){return!(e.transformStyle!=="preserve-3d"||e.overflowX!=="visible"||e.overflowY!=="visible"||(parseFloat(e.opacity)||0)<1&&e.opacity!==""||e.filter!=="none"||e.clipPath!=="none"||e.mask||e.isolation==="isolate"||e.mixBlendMode&&e.mixBlendMode!=="normal"||/\b(paint|strict|content)\b/.test(e.contain))}var Ke=e(16);function Je(e,t=0){let n=0,r=Ke;for(let i=t;i<e.length;i++){let t=e[i];if(!t)break;if(Ue(t,0,0,r)){if(Ve(r)||Math.abs(r[14])>Se&&Qe(e,i))return 2;Be(r)&&(n=1)}}return n}function Ze(e,t,n,r){for(let i=t;i<=n;i++){let t=e[i],n=e[i+1];if(!t||!n)break;if(!(!Ee(t)||n.perspective==="none"||!We(n))&&!(n.overflowX==="visible"&&n.overflowY==="visible")&&r(i+1))return i+1}return-1}function Qe(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(!t)break;if(t.perspective!=="none")return!0;if(!qe(t))return!1}return!1}function et(e,t,n){n[0]=1,n[1]=0,n[2]=0,n[3]=1;let r=Ke;for(let i=t;i<e.length;i++){let t=e[i];if(!t)break;if(!Ue(t,0,0,r))continue;let o=r[0],l=r[1],s=r[4],a=r[5],u=n[0],c=n[1],h=n[2],d=n[3];n[0]=o*u+s*c,n[1]=l*u+a*c,n[2]=o*h+s*d,n[3]=l*h+a*d}return n}function tt(e,t){let n=t,r;for(let i=t;i<e.length;i++){let t=e[i];if(!t)break;(Ee(t)||t.perspective!=="none"&&r&&Ee(r))&&(n=i),r=t}return n}var nt=e(16),rt=e(16),it={m:e(16),backHidden:!1,scene:-1};function ot(e,t,n,r){let i=Fe(it.m);it.backHidden=!1,it.scene=-1;for(let o=t;o<=n&&o<e.length;o++){let t=e[o];if(!t)break;ut(i,e,o,r);let l=at(e,o);if(t.backfaceVisibility==="hidden"&&!it.backHidden&&dt(e,o,n,r)&&(it.backHidden=!0),l&&qe(l)){it.scene=o+1;continue}ct(i)}return it}function lt(e,t,n){return st(e,0,0)||st(e,t,0)||st(e,t,n)||st(e,0,n)}function st(e,t,n){return e[3]*t+e[7]*n+e[15]<=Ne}function at(e,t){return e[t+1]}function ut(e,t,n,{rel:i,sizes:o}){let l=t[n];if(!l)return;let s=Ue(l,r(o,n*2)||0,r(o,n*2+1)||0,nt);s&&Pe(e,s,e),ze(e,r(i,n*2)||0,r(i,n*2+1)||0,0);let a=at(t,n);if(a&&a.perspective!=="none"&&We(a)){let t=parseFloat(a.perspective);if(t>0){let[i,l]=Ie(a.perspectiveOrigin,r(o,(n+1)*2)||0,r(o,(n+1)*2+1)||0),s=Fe(rt);s[11]=-1/Math.max(t,1),ze(e,-i,-l,0),Pe(e,s,e),ze(e,i,l,0)}}}function ct(e){e[2]=0,e[6]=0,e[14]=0,e[8]=0,e[9]=0,e[11]=0,e[10]=1}var ht=e(16);function dt(e,t,n,r){let i=Fe(ht);for(let o=t;o<=Math.max(n,t)&&o<e.length;o++){ut(i,e,o,r);let t=at(e,o);if(!t||!qe(t))break}return _e(i)<0}function ft(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[3],t[3]=e[4],t[4]=e[5],t[5]=e[7],t[6]=e[12],t[7]=e[13],t[8]=e[15],t}function pt(e,t){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function mt(e,t,n,{r:r,sx:i,sy:o}){let l=r.left+i,s=r.top+o,a=1/0,u=1/0,c=-1/0,h=-1/0;for(let r=0;r<4;r++){let i=r===1||r===2?t:0,o=r>=2?n:0,l=e[2]*i+e[5]*o+e[8],s=(e[0]*i+e[3]*o+e[6])/l,d=(e[1]*i+e[4]*o+e[7])/l;s<a&&(a=s),s>c&&(c=s),d<u&&(u=d),d>h&&(h=d)}let d=l-a,f=s-u;return e[0]+=d*e[2],e[1]+=f*e[2],e[3]+=d*e[5],e[4]+=f*e[5],e[6]+=d*e[8],e[7]+=f*e[8],Math.max(Math.abs(c-a-r.width),Math.abs(h-u-r.height))}function bt(e,t,n,r){let i=t/2,o=n/2,l=e[2]*i+e[5]*o+e[8],s=(e[0]*i+e[3]*o+e[6])/l,a=(e[1]*i+e[4]*o+e[7])/l,u=(e[0]-s*e[2])/l,c=(e[1]-a*e[2])/l,h=(e[3]-s*e[5])/l,d=(e[4]-a*e[5])/l,f=Math.sqrt(Math.abs(u*d-c*h))||1;return r[0]=f,r[1]=f,r}function gt(e){return Math.abs(e[1])<Se&&Math.abs(e[3])<Se&&Math.abs(e[2])<Se&&Math.abs(e[5])<Se&&Math.abs(e[8]-1)<Se}var vt=2,yt=8,wt=e=>e.shape!==null;function xt(){let r=e(8),i=t(4),o=t(4);return{list:[],occluders:[],occluderHow:[],noSlots:!1,occluderSlots:[],mask:null,scissorDoc:r,shaders:[],reason:null,fold:i,ownRadius:o,ownKy:1,count:0,xf:new Float32Array(9*vt),box:new Float32Array(4*vt),radius:new Float32Array(4*vt),poly:new Float32Array(2*yt),polyInfo:new Float32Array([-1,0]),lb:!1,scissorPx:n(4),Sh:null,reshaped:!1}}function kt(e,{nodes:t,off:n,isInsideScroll:r,previous:i,occluders:o=[]}){let l=Math.max(0,t.findIndex(t=>t.el===e.el)),{sources:s,mask:a}=ge(t,l,n);if(!s.length&&!a&&!o.length)return null;let u=i??xt();u.occluders=o,u.occluderSlots.length=0,u.occluderHow.length=o.length,u.occluderHow.fill("pruned");let c=[];for(let e of s){let t=u.list.find(t=>t.el===e.node.el&&t.by===e.by),n=t??Mt();c.push({el:e.node.el,by:e.by,node:e.node,own:e.depth<=l,ignored:!1,depth:e.depth,key:t?.key??"",shape:t?.shape??null,reason:t?.reason??null,toDocument:n.toDocument,toShape:n.toShape,bounds:n.bounds,scrolls:r(e.node.el),square:!1,how:"shader"})}return u.list=c,u.mask=a,u}function Mt(){let t=e(9),n=e(9),r=e(4);return{toDocument:t,toShape:n,bounds:r}}function $t(e,t,{width:n,height:r,value:i}){let o=`${t.radius.join(" ")}|${t.border.join(" ")}|${t.padding.join(" ")}`;return e.by==="overflow"?`|${n}|${r}|${o}|${t.overflowClipMargin}|${t.scrollbar.join(" ")}|${t.direction}`:e.by==="clip-path"||e.by==="occlude"?`${i}|${n}|${r}|${o}|${t.margin.join(" ")}`:`${i}|${n}|${r}`}function St(e,t,{width:n,height:r,value:i}){return e.by==="overflow"?Me(e.node,t,n,r):e.by==="clip"?Y(i,n,r):_(i,{w:n,h:r,border:t.border,padding:t.padding,margin:t.margin,radius:t.radius})}var Nt=e(4);function Ft(e,t){if(e.kind===0){let[n,r,i,o]=e.box;return t[0]=n,t[1]=r/e.ky,t[2]=n+i,t[3]=(r+o)/e.ky,t}let n=e.points;t[0]=1/0,t[1]=1/0,t[2]=-1/0,t[3]=-1/0;for(let e=0;e<n.length;e+=2){let i=r(n,e),o=r(n,e+1);t[0]=Math.min(t[0],i),t[2]=Math.max(t[2],i),t[1]=Math.min(t[1],o),t[3]=Math.max(t[3],o)}return t}function Pt(e,t,n){let r=Q(e.node),i=$t(e,r,n);if(i!==e.key||!e.shape&&!e.reason){e.key=i;let t=St(e,r,n);e.shape=t&&"shape"in t?t.shape:null,e.reason=t&&"reason"in t?t.reason:null,t||(e.reason="none")}t!==e.toDocument&&e.toDocument.set(t);let l=e.shape;if(l){if(!o(e.toShape,e.toDocument)){e.toShape.fill(0),e.bounds.fill(0),e.square=!0;return}e.toShape[1]*=l.ky,e.toShape[4]*=l.ky,e.toShape[7]*=l.ky,Ct(e.bounds,t,Ft(l,Nt)),e.square=l.kind===0&&l.radius.every(e=>e<=0)&>(t)}}function Ct(e,t,n){let r=n[0],i=n[1],o=n[2],l=n[3];e[0]=1/0,e[1]=1/0,e[2]=-1/0,e[3]=-1/0;let s=Math.max(Math.abs(r),Math.abs(o),Math.abs(i),Math.abs(l))>1e5;for(let n=0;n<4;n++){let a=n===1||n===2?o:r,u=n>=2?l:i,c=s?1:t[2]*a+t[5]*u+t[8],h=(t[0]*a+t[3]*u+t[6])/c,d=(t[1]*a+t[4]*u+t[7])/c;h<e[0]&&(e[0]=h),d<e[1]&&(e[1]=d),h>e[2]&&(e[2]=h),d>e[3]&&(e[3]=d)}}function zt(e,t,n){let r=e.shape,i=e.toShape,o=i[2]*t+i[5]*n+i[8],l=(i[0]*t+i[3]*n+i[6])/o,s=(i[1]*t+i[4]*n+i[7])/o;return r.kind===0?X(l,s,r,.01):A(l,s,r.points)}function Ot(e,t){let n=e.shape;return n.kind===1&&!Lt(n.points)?!1:zt(e,t[0],t[1])&&zt(e,t[2],t[1])&&zt(e,t[2],t[3])&&zt(e,t[0],t[3])}function Lt(e){let t=e.length/2,n=0;for(let i=0;i<t;i++){let o=i*2,l=(i+1)%t*2,s=(i+2)%t*2,a=(r(e,l)-r(e,o))*(r(e,s+1)-r(e,l+1))-(r(e,l+1)-r(e,o+1))*(r(e,s)-r(e,l));if(a!==0){if(n===0)n=Math.sign(a);else if(Math.sign(a)!==n)return!1}}return!0}var _t=e(4);function Dt(e,t,n,r){t.reason=null,t.scissorDoc.fill(NaN),t.shaders.length=0,t.fold.fill(0),t.mask&&(t.reason={code:"mask",clips:[]});let i=_t,o=r?(n[2]-n[0])*.25:0,l=r?(n[3]-n[1])*.25:0;i[0]=n[0]-o,i[1]=n[1]-l,i[2]=n[2]+o,i[3]=n[3]+l;let s=Tt(e,t,i);for(let t=s.length-1;t>=0;t--){let n=s[t];n&&n.scrolls===e.scrolls&&Ot(n,i)&&(n.how="pruned",s.splice(t,1))}r||Xt(e,t,s,n);let a=s.filter(e=>e.shape.kind===1);(s.length>vt||a.length>1)&&(t.reason??={code:"too-many",clips:s});for(let e of s)e.how="shader",t.shaders.length<vt&&t.shaders.push(e);return Ht(t)&&(t.reshaped=!0),t.reason}function Tt(e,t,n){let r=[];for(let i of t.list){if(i.ignored){i.how="ignored";continue}if(i.reason==="none"){i.how="pruned";continue}if(i.reason||!wt(i)){t.reason??={code:i.reason??"unparsed",clips:[i]};continue}i.square?i.how=Yt(e,t,i,n):r.push(i)}return r}function Yt(e,t,n,i){let o=n.bounds;if(n.scrolls===e.scrolls&&o[0]<=i[0]&&o[1]<=i[1]&&o[2]>=i[2]&&o[3]>=i[3])return"pruned";let l=n.scrolls?0:4,s=t.scissorDoc;return Number.isNaN(s[l])?s.set(o,l):(s[l]=Math.max(s[l],o[0]),s[l+1]=Math.max(r(s,l+1),o[1]),s[l+2]=Math.min(r(s,l+2),o[2]),s[l+3]=Math.min(r(s,l+3),o[3])),"scissor"}function Xt(e,t,n,r){for(let i=n.length-1;i>=0;i--){let o=n[i];if(!o)continue;let l=o.shape,s=o.bounds,a=o.toDocument[0];if(!(e.level===0&>(o.toDocument)&&o.scrolls===e.scrolls&&l.kind===0&&l.ky===1&&Math.abs(a-o.toDocument[4])<.01*a&&Math.abs(s[0]-r[0])<.5&&Math.abs(s[1]-r[1])<.5&&Math.abs(s[2]-r[2])<.5&&Math.abs(s[3]-r[3])<.5))continue;let u=t.fold;u[0]=Math.max(u[0],l.radius[0]*a),u[1]=Math.max(u[1],l.radius[1]*a),u[2]=Math.max(u[2],l.radius[2]*a),u[3]=Math.max(u[3],l.radius[3]*a),o.how="corners",n.splice(i,1)}}function Ht(e){let t=!1,n=(e,n,r)=>{let i=Math.fround(r);e[n]!==i&&(e[n]=i,t=!0)};for(let t=0;t<e.shaders.length;t++){let i=e.shaders[t]?.shape;if(!i)break;let o=i.kind===0?i:At;for(let i=0;i<4;i++)n(e.box,t*4+i,r(o.box,i)),n(e.radius,t*4+i,r(o.radius,i))}let[i,o]=jt(e);for(let t=0;t<2*yt;t++)n(e.poly,t,o[t]??0);return n(e.polyInfo,0,i),n(e.polyInfo,1,o.length/2),t}var At={box:[0,0,0,0],radius:[0,0,0,0]};function jt(e){for(let t=e.shaders.length-1;t>=0;t--){let n=e.shaders[t]?.shape;if(n?.kind===1)return[t,n.points]}return[-1,[]]}var It={visible:!0,moved:!1},Gt=e(9),Wt={moved:!1,x0:0,y0:0,x1:0,y1:0,any:!1,own0:0,own1:0,own2:0,own3:0,slots:0,cutter:null},Et=e(4),Rt=e(4);function Ut(e,t,n,r){return Wt.moved=e.reshaped,e.reshaped=!1,e.Sh=null,Vt(e.scissorDoc,r),It.visible=Bt(e,t,n,r)&&tn(e,t,n,r)&&sn(e,t,n,r),It.moved=Wt.moved,It}function Vt(e,t){Wt.x0=-1/0,Wt.y0=-1/0,Wt.x1=1/0,Wt.y1=1/0,Wt.any=!1;for(let n=0;n<8;n+=4){if(Number.isNaN(e[n]))continue;Wt.any=!0;let i=n===0?t.scrollX:t.pageX,o=n===0?t.scrollY:t.pageY;Wt.x0=Math.max(Wt.x0,r(e,n)-i),Wt.y0=Math.max(Wt.y0,r(e,n+1)-o),Wt.x1=Math.min(Wt.x1,r(e,n+2)-i),Wt.y1=Math.min(Wt.y1,r(e,n+3)-o)}Wt.own0=Wt.x0,Wt.own1=Wt.y0,Wt.own2=Wt.x1,Wt.own3=Wt.y1}function Bt(e,t,n,r){Wt.slots=0,Wt.cutter=null;let i=e.occluders;if(i.length){let o=n?t[2]*.25:0,l=n?t[3]*.25:0,s=Et;s[0]=t[0]-o,s[1]=t[1]-l,s[2]=t[0]+t[2]+o,s[3]=t[1]+t[3]+l;for(let t=0;t<i.length;t++){let n=i[t];if(!n)break;let o=qt(e,n,s,r);if(e.occluderHow[t]=o??"pruned",!o)return e.Sh=n,!1}}return e.occluderSlots.length>Wt.slots&&(e.occluderSlots.length=Wt.slots),!0}function qt(e,t,n,r){let i=Kt(t,r);if(t.ignored||!t.shape||Jt(i,n))return"pruned";let o=i[0]<=n[0]&&i[2]>=n[2],l=i[1]<=n[1]&&i[3]>=n[3],s=Qt(t,i,n);if(s&&o&&l)return null;let a=en(o,l,i,n),u=!e.noSlots&&e.shaders.length+Wt.slots<vt;return a&&(s||!u&&t.axis)?(Zt(a,i),Wt.cutter=t,"scissor"):u?(e.occluderSlots[Wt.slots++]=t,"shader"):"uncut"}function Kt(e,t){let n=e.scrolls?t.scrollX:t.pageX,r=e.scrolls?t.scrollY:t.pageY,i=Rt;return i[0]=e.bounds[0]-n,i[1]=e.bounds[1]-r,i[2]=e.bounds[2]-n,i[3]=e.bounds[3]-r,i}var Jt=(e,t)=>e[0]>=t[2]||e[2]<=t[0]||e[1]>=t[3]||e[3]<=t[1];function Zt(e,t){e===1?Wt.y0=Math.max(Wt.y0,t[3]):e===2?Wt.y1=Math.min(Wt.y1,t[1]):e===3?Wt.x0=Math.max(Wt.x0,t[2]):Wt.x1=Math.min(Wt.x1,t[0]),Wt.any=!0}function Qt(e,t,n){return e.axis?e.square||n[0]>=t[0]+e.radiusX&&n[2]<=t[2]-e.radiusX||n[1]>=t[1]+e.radiusY&&n[3]<=t[3]-e.radiusY:!1}function en(e,t,n,r){return e&&n[1]<=r[1]?1:e&&n[3]>=r[3]?2:t&&n[0]<=r[0]?3:t&&n[2]>=r[2]?4:0}function tn(e,t,n,r){let{x0:i,y0:o,x1:l,y1:s}=Wt,a=!1;if(Wt.any){if(l<=i||s<=o||!n&&(rn(t,i,l)||on(t,o,s)))return e.Sh=nn(e,t,n),!1;if(a=n||t[0]<i||t[1]<o||t[0]+t[2]>l||t[1]+t[3]>s,a&&!ln(e,r))return e.Sh=Wt.cutter??e.list.find(e=>e.how==="scissor")??null,!1}return a!==e.lb&&(e.lb=a,Wt.moved=!0),!0}function nn(e,t,n){return(Wt.own2<=Wt.own0||Wt.own3<=Wt.own1||!n&&(rn(t,Wt.own0,Wt.own2)||on(t,Wt.own1,Wt.own3))?null:Wt.cutter)??e.list.find(e=>e.how==="scissor")??Wt.cutter}var rn=(e,t,n)=>e[0]>=n||e[0]+e[2]<=t,on=(e,t,n)=>e[1]>=n||e[1]+e[3]<=t;function ln(e,t){let n=Math.min(t.canvasWidth,Math.max(0,Math.round(Wt.x0*t.canvasPerCssX))),r=Math.min(t.canvasWidth,Math.max(0,Math.round(Wt.x1*t.canvasPerCssX))),i=Math.min(t.canvasHeight,Math.max(0,Math.round(Wt.y0*t.canvasPerCssY))),o=Math.min(t.canvasHeight,Math.max(0,Math.round(Wt.y1*t.canvasPerCssY)));if(r<=n||o<=i)return!1;let l=e.scissorPx,s=t.canvasHeight-o;return(l[0]!==n||l[1]!==s||l[2]!==r-n||l[3]!==o-i)&&(l[0]=n,l[1]=s,l[2]=r-n,l[3]=o-i,Wt.moved=!0),!0}function sn(e,t,n,r){let i=e.shaders.length,o=i+Wt.slots;o!==e.count&&(e.count=o,Wt.moved=!0);for(let o=0;o<i;o++){let i=e.shaders[o];if(!i)break;if(!n&&an(i,t,r))return e.Sh=i,!1;cn(e,o,i,r)&&(Wt.moved=!0)}for(let t=0;t<Wt.slots;t++){let n=e.occluderSlots[t];if(!n)break;un(e,i+t,n,r)}return!0}function an(e,t,n){let r=e.scrolls?n.scrollX:n.pageX,i=e.scrolls?n.scrollY:n.pageY,o=e.bounds;return t[0]>=o[2]-r||t[0]+t[2]<=o[0]-r||t[1]>=o[3]-i||t[1]+t[3]<=o[1]-i}function un(e,t,n,i){cn(e,t,n,i)&&(Wt.moved=!0);let o=n.shape;if(o)for(let n=0;n<4;n++){let i=Math.fround(r(o.box,n)),l=Math.fround(r(o.radius,n));(e.box[t*4+n]!==i||e.radius[t*4+n]!==l)&&(e.box[t*4+n]=i,e.radius[t*4+n]=l,Wt.moved=!0)}}function cn(e,t,n,i){let o=t<e.shaders.length?1:-1,l=n.scrolls?i.scrollX:i.pageX,s=n.scrolls?i.scrollY:i.pageY,a=1/i.canvasPerCssX,u=1/i.canvasPerCssY,c=n.toShape,h=i.canvasHeight*u+s,d=Gt;d[0]=c[0]*a,d[1]=c[1]*a,d[2]=c[2]*a,d[3]=-c[3]*u,d[4]=-c[4]*u,d[5]=-c[5]*u,d[6]=c[0]*l+c[3]*h+c[6],d[7]=c[1]*l+c[4]*h+c[7],d[8]=c[2]*l+c[5]*h+c[8];let f=e.xf,p=!1;for(let e=0,n=t*9;e<9;e++,n++){let t=Math.fround(r(d,e)*o);f[n]!==t&&(f[n]=t,p=!0)}return p}function hn(e){let t=!!e.shape?.radius.some(e=>e>0);if(e.by==="occlude")return t?"data-umber-occlude, rounded":"data-umber-occlude";if(e.by==="overflow"){let n=dn(e.node);return t?`${n}, rounded`:n}let n=e.by==="clip"?e.node.clip:e.node.clipPath;return`${e.by==="clip"?"clip: ":""}${n.length>60?`${n.slice(0,57)}...`:n}`}function dn(e){let t=e.overflowX===e.overflowY?e.overflowX:`${e.overflowX} ${e.overflowY}`;return t!=="visible"?`overflow: ${t}`:e.contentVisibility!=="visible"?`content-visibility: ${e.contentVisibility}`:`contain: ${e.contain}`}function fn(e,t){let n=i(e.el),r=t.reason;if(!r)return`${n}: its clips can be drawn in GL.`;let o=e=>e.length>40?`${e.slice(0,37)}...`:e;if(r.code==="mask")return`${n}: GL can't draw the CSS mask on ${i(t.mask?.el)}, so its DOM shows. Move the mask off the parents of GL elements, or add data-umber-clip="false" to draw it unmasked.`;if(r.code==="too-many")return`${n}: cut by too many rounded or shaped parents (${r.clips.map(e=>i(e.el)).join(", ")}), so its DOM shows. Make one of them a straight overflow: hidden, keep one polygon (up to ${yt} points), or add data-umber-clip="false".`;let[l]=r.clips;if(!l)return`${n}: its clips can't be drawn in GL (${r.code}), so its DOM shows.`;switch(r.code){case"mixed-corners":return`${n}: ${i(l.el)}'s corners mix different horizontal / vertical radii; GL needs one ratio for all of them, so its DOM shows. Use the same radius both ways (or one shape for all corners).`;case"polygon-points":return`${n}: clip-path polygon() on ${i(l.el)} has more than ${yt} points; GL draws up to ${yt}, so its DOM shows. Simplify the polygon${l.own?"":', or add data-umber-clip="false" to draw it uncut'}.`;case"polygon-nonzero":return`${n}: clip-path polygon() on ${i(l.el)} crosses itself, and GL fills polygons even-odd, so its DOM shows. Write polygon(evenodd, ...) or untangle it.`;default:{let e=l.by==="clip"?l.node.clip:l.node.clipPath;return`${n}: ${l.by==="clip"?"clip":"clip-path"} ${o(e)} on ${i(l.el)} can't be drawn in GL, so its DOM shows. Use inset(), rect(), xywh(), circle(), ellipse() or polygon()${l.own?"":', or add data-umber-clip="false" to draw it uncut'}.`}}}function pn(e,t,n,r=e.rect){let i=e.offset;if(r[0]=e.doc.x-t+(i?i[0]:0),r[1]=e.doc.y-n+(i?i[1]:0),e.pixelGrid&&(r[1]=Math.round(r[1]*e.pixelGrid)/e.pixelGrid),r[2]=e.doc.w,r[3]=e.doc.h,e.pad){let t=e.pad*(e.layoutW?e.doc.w/e.layoutW:1),n=e.pad*(e.layoutH?e.doc.h/e.layoutH:1);r[0]-=t,r[1]-=n,r[2]+=t/e.pad*(e.pad*2+e.rounding[0]),r[3]+=n/e.pad*(e.pad*2+e.rounding[1])}return r}var mn=/^(transform|translate|rotate|scale|perspective|offset[A-Z]|left|top|right|bottom|inset|width|height|min[WH]|max[WH]|margin|padding|flex|grid|clipPath|clip$|opacity|visibility|display|fontSize|letterSpacing|lineHeight|border\w*(Width|Radius)|all$|zoom)/,bn=/^(rotate|perspective|offset|clip|display|border\w*Radius|all$|zoom)/,gn={transform:/^(none|((translate[XY]?\([^()]*\)|scale[XY]?\([^()-]*\)) ?)+)$/,translate:/^\S+( \S+)?$/,scale:/^[^-\s]+( [^-\s]+)?$/},vn=new WeakMap;function yn(e){let t=vn.get(e);if(t!==void 0)return t;try{let n=e.effect.getKeyframes();t=0;for(let e of new Set(n.flatMap(e=>Object.keys(e)))){if(!mn.test(e))continue;let r=n.map(t=>t[e]).filter(e=>e!=null),i=gn[e];t=Math.max(t,bn.test(e)||i&&!(r.length&&r.every(e=>i.test(String(e).trim())))?2:1)}}catch{t=2}return vn.set(e,t),t}var wn=e=>yn(e)>0;var xn=50;function kn(e,{onlyHiding:t=!1}={}){try{return e.getKeyframes().some(e=>"opacity"in e&&!(t&&parseFloat(e.opacity)>0)||"visibility"in e||"clipPath"in e)}catch{return!0}}var Mn=/^(offset|computedOffset|easing|composite|opacity|filter|color|\w+(Color|Shadow))$/,$n=e=>!kn(e,{onlyHiding:!0})&&e.getKeyframes().every(e=>Object.keys(e).every(e=>Mn.test(e)));function Sn(e){return typeof CSSTransition<"u"&&e instanceof CSSTransition?"CSS transition":typeof CSSAnimation<"u"&&e instanceof CSSAnimation?"CSS animation":"Web Animation"}function Nn(e,t,n){let r=t.getComputedTiming(),i=Number(r.endTime);if(i===1/0)return 1/0;let o=Number(r.localTime??0)||0;return n+Math.max(0,e.playbackRate<0?o:i-o)/Math.abs(e.playbackRate)+xn}var Fn=class{constructor(e,t){this.stage=e;this.occluders=t;this.held=[]}scan(e){let t=this.stage;t.measurePhase.cd();let n=this.held;if(this.held=[],typeof document.getAnimations=="function"){for(let e of this.occluders.list)e.until=0,e.linked=!1,e.fades=!1;if(this.Sg()){for(let t of document.getAnimations()){let r=Pn(t,e);r&&(this.Fi(r,r.fx),this._d(r,n))}for(let e of t.planes.all)e._B&&(e._B=!1,e.animUntil!==1/0&&(e.stale=!0))}}}Sg(){let e=!1;for(let t of this.stage.planes.all)t.zone.soon&&(e=!0,t._B=t.animUntil===1/0,t._B&&(t.animUntil=0),t.scrollLinked=!1,t._v.length=0,t.animUntil||(t.animLabel=""));return e}Fi(e,t){for(let n of this.occluders.list)!e.target.contains(n.el)||e.until===1/0&&$n(t)||(n.fades||=kn(t,{onlyHiding:e.until===1/0}),e.scrollTimeline?n.linked=!0:e.until>n.until&&(n.until=e.until))}_d(e,t){let n=null;for(let r of this.stage.planes.all)!r.zone.soon||!(e.target===r.el||e.target.contains(r.geomEl))||(r._v.includes(e.target)||r._v.push(e.target),e.scrollTimeline?(r.scrollLinked=!0,r.animLabel||=`scroll-driven ${e.kind} on ${i(e.target)}`):e.running?Cn(r,e):(n??=this.hold(e,t),zn(r,e,t,n)))}hold(e,t){let n=t.find(t=>t.a===e.a),r={a:e.a,t:n?n.t:e.a.currentTime,state:e.state,planes:[]};return this.held.push(r),r}Th(){for(let e of this.held){let t=e.a.playState;t!==e.state&&(e.state=t,this.stage.measurePhase.ma(),this.stage.scheduler.request());let n=e.a.currentTime;if(n!==e.t){e.t=n;for(let t of e.planes)t.heldMoved=!0}}}Ad(e){let t=this.stage;if(t.scheduler.inactive)return;if(this.held.some(t=>t.a===e)){t.scheduler.request();return}if(!wn(e))return;let n=e.effect?.target;if(n){if(this.occluders.holds(n)){t.measurePhase.ma(),t.scheduler.request();return}t.measurePhase.Vh(n)}}};function Pn(e,t){let n=e.playState;if(n==="idle")return null;let r=e.effect,i=r?.target;if(!r||!i||r.pseudoElement||!wn(e))return null;let o=n==="running"&&!!e.playbackRate,l=typeof DocumentTimeline<"u"?DocumentTimeline:null,s=!!(e.timeline&&l&&!(e.timeline instanceof l)),a=o&&!s?Nn(e,r,t):0;return{a:e,fx:r,target:i,state:n,running:o,scrollTimeline:s,until:a,kind:Sn(e)}}function Cn(e,t){t.until<=e.animUntil||(e.animUntil=t.until,e.animLabel=`${t.until===1/0?"infinite ":""}${t.kind} on ${i(t.target)}`)}function zn(e,t,n,r){n.some(e=>e.a===t.a)||(e.heldMoved=!0),r.planes.push(e),e.animLabel||=`${t.state} ${t.kind} on ${i(t.target)} (followed while a script moves its time)`}var On=e=>!!e.backgroundImage&&e.backgroundImage!=="none"||!/^(transparent|rgba\(.*,\s*0\))$/.test(e.backgroundColor||"transparent"),Ln=["transform","translate","rotate","scale","perspective","filter","backdropFilter","clipPath","maskImage","webkitMaskImage"],_n=e=>e.position!=="static"&&e.zIndex!=="auto"||/fixed|sticky/.test(e.position)||parseFloat(e.opacity)<1||Ln.some(t=>(e[t]||"none")!=="none")||e.isolation==="isolate"||(e.mixBlendMode||"normal")!=="normal"||/\b(layout|paint|strict|content)\b/.test(e.contain)||/^(size|inline-size)$/.test(e.containerType)||/\b(transform|translate|rotate|scale|perspective|filter|opacity|clip-path|mask|isolation|mix-blend-mode|contain)\b/.test(e.willChange),Dn=e=>e!==null&&e!==document.body&&e!==document.documentElement;function Tn(e,t){let n=parseInt(getComputedStyle(t).zIndex,10);if(!(n>0))return null;let r=null,o="auto",l=[];for(let t=e;Dn(t);t=t.parentElement){let n=getComputedStyle(t);On(n)&&!(t===e&&e.matches("[data-umber~=shader]"))&&l.push(t),_n(n)&&(r=t,o=n.position!=="static"?n.zIndex:"auto")}if(!r||o==="auto"||+o<n)return null;let s=l.filter(e=>r.contains(e)),a=s.find(t=>t!==e)??s[0];return a?a===e?`its own background covers Umber's canvas (z-index ${n}): ${i(r)} around it (z-index ${o}) is above the canvas, so that background paints over what GL draws of it. Remove its background (GL draws the element itself), or drop that z-index.`:`${a===r?`${i(r)} (z-index ${o}, with a background) covers Umber's canvas (z-index ${n})`:`${i(r)} (z-index ${o}) is above Umber's canvas (z-index ${n}), and the background of ${i(a)} inside it covers Umber's canvas`}: GL inside it is hidden. Drop that z-index (and give it data-umber-occlude if it must still cover the GL elements before it) or move the background behind the content.`:null}function Yn(e,t,n){if(!e.has(t)||e.get(t)){let r=Tn(t.el,n.canvasHost.el),o=t.kind==="layer",l=r&&`${i(t.el)}: ${r}${o?"":" Until then its DOM shows."}`;e.set(t,l),l&&o&&n.fallbacks.Ja(t,l)}return t.kind==="layer"?null:e.get(t)??null}function Xn(e,t,n){let r=parseInt(getComputedStyle(n).zIndex,10);if(!(r>0)||t>=r||!_n(getComputedStyle(e)))return null;let o=i(e);return[...e.querySelectorAll("[data-umber~=above]")].map(e=>[e,`data-umber="above" on ${i(e)} stays under Umber's canvas: ${o} around it is a stacking context (a pin, a transform, a fade) under the canvas (z-index ${r}). Give ${o} position: relative and z-index: ${r+1} (no background), or move it out.`])}function Hn(e){let t=[],n=!0;for(let r=e;Dn(r);r=r.parentElement){let e=getComputedStyle(r),i=_n(e),o=e.position!=="static";(i||n&&o)&&t.unshift([r,o&&e.zIndex!=="auto"&&+e.zIndex||0]),(i||o)&&(n=!1)}return t}function An(e,t,n,r){let i=0;for(;i<t.length&&i<r.length&&t[i]?.[0]===r[i]?.[0];)i++;let o=t[i]?.[1]??-.5,l=r[i]?.[1]??-.5;return o!==l?l>o:!!(n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function jn(e){let t=getComputedStyle(e),n=t.backgroundColor||"transparent";return(n!=="transparent"&&!n.startsWith("rgba(")&&!/\/\s*(0?\.\d+|0)\s*\)$/.test(n)||!!t.backgroundImage&&t.backgroundImage!=="none")&&parseFloat(t.opacity)>=1}var In={1:.75,2:1.5},Gn=3,Wn=typeof navigator<"u"&&navigator.userAgent.includes("AppleWebKit/")&&!/Chrome\/|Chromium\//.test(navigator.userAgent),En=e=>!!e&&Q(e).radius.some(e=>e.split(" ").every(e=>parseFloat(e)>0));function Rn(e){let t=null;for(let n of e)Ee(n)&&(n.transform!=="none"||n.rotate!=="none")&&(t=n.el);if(!t)for(let n of e)(Ee(n)||n.perspective!=="none")&&(t=n.el);return t}function Un(e,t,n){let r=i(e.el),o=i(n);switch(t){case"behind":return`${r}: part of it turns behind the viewer (3D transform on ${o}), so its DOM shows until it turns back. Lower the angle or raise the perspective.`;case"svg":return`${r}: GL elements can't sit inside an <svg> (${o}); its DOM shows. Move data-umber to an element outside the SVG.`;case"offset-path":return`${r}: offset-path on ${o} moves it along a path GL does not follow, so its DOM shows. Animate transform instead.`;case"scene":return`${r}: GL can't depth-sort several GL elements in one preserve-3d scene (${o}), so their DOM shows. Add backface-visibility: hidden to faces that turn away, or use transform-style: flat.`;case"rounded":return`${r}: WebKit draws a tilt flat when its perspective parent (${o}) also has overflow and border-radius, so its DOM shows. Put the perspective on an inner element, or round the corners with clip-path: inset(0 round <radius>).`;case"zoom":return`${r}: zoom on ${o} scales it in a way GL can't follow together with its transforms, so its DOM shows. Use transform: scale() instead of zoom.`;case"verify":return`${r}: its on-screen box doesn't match the transforms on ${o} (turned almost edge-on?), so its DOM shows until they agree again. Lower the angle or raise the perspective.`}}function Vn(e,t){for(let n of t){if(n.el.namespaceURI==="http://www.w3.org/2000/svg")return Un(e,"svg",n.el);if(n.offsetPath!=="none"&&n.offsetPath!==""&&We(n))return Un(e,"offset-path",n.el)}return null}function Bn(e,t,n){let r=Q(e);n.w=Number.isFinite(r.width)&&r.width>0?r.width:t.width,n.h=Number.isFinite(r.height)&&r.height>0?r.height:t.height}var qn=class{constructor(t){this.stage=t;this.kj=new Map;this.Jf=new Map;this.hh=new Set;this.vi=e(4);this.jj={rel:new Float64Array(64),sizes:new Float64Array(64),bodyOrNull:()=>this.stage.env.lib.bodyOrNull()}}clear(){this.kj.clear(),this.Jf.clear(),this.hh.clear()}Td(e){let t=this.kj.get(e);return t||(t=e.getBoundingClientRect(),this.kj.set(e,t)),t}grow(e){this.jj.rel.length>=e*2+2||(this.jj.rel=new Float64Array(e*4),this.jj.sizes=new Float64Array(e*4))}yj(e,t,n,r){let{sx:i,sy:o,w:s,h:a}=n,u=e[t]?.el;if(!u)return!1;let c=this.Jf.get(u);if(c!==void 0)return c&&r.set(c),!!c;let h=this.Td(u),d=Je(e,t),f=!0,p={r:h,sx:i,sy:o};return d===0?l(r,s,a,p):(d===1?pt(et(e,t,this.vi),r):f=this.Ue(e,t,n,r),f&&mt(r,s,a,p)),this.Jf.set(u,f?r:null),f}Ue(e,t,n,r){let i=tt(e,t);if(this.grow(e.length),!U(e,t,i,this.jj))return!1;let{m:o}=ot(e,t,i,this.jj);return lt(o,n.w,n.h)?!1:(ft(o,r),!0)}gi(e,t){let{full:n,restyle:r,r:i}=t;(n||r)&&this.aj(e,n,r,i);let o=e.level;if(e.backHidden=!1,e.scene=null,e.xfReason=e._T,!o||e._T){e.edge[0]=1,e.edge[1]=1;return}let l=e._G,s=null;o===1?pt(et(e.nodes,0,this.vi),l):s=this.tilt(e),s??=this.verify(e,o,t),s||bt(l,e._u,e._F,e.edge),e.xfReason=s}aj(e,t,n,r){let i=e.nodes;if(t)i=this.og(e);else if(n&&(e.level&&e._k.length||e._v.length))this.Of(e,i);else return;let[o]=i;if(!o)return;t||(o.box=void 0);let l=Q(o);e._u=Number.isFinite(l.width)&&l.width>0?l.width:r.width,e._F=Number.isFinite(l.height)&&l.height>0?l.height:r.height;let s=Je(i,0);s!==e.level&&e.raster&&(e.raster.Ze=!0),e.level=s}Of(e,t){if(e.level)for(let n of e._k){let e=t[n];e&&R(e,this.hh)}for(let n of e._v){let e=t.find(e=>e.el===n);e&&R(e,this.hh)}}og(e){let t=e.nodes=ne(e.geomEl,this.stage.env.frame.cc);e.chained=!0;let n=e._k;return n.length=0,t.forEach((t,r)=>{(Ee(t)||t.perspective!=="none"||e._v.includes(t.el))&&n.push(r)}),e._T=Vn(e,t),t}tilt(e){let t=e.nodes,n=tt(t,0);if(this.grow(t.length),!U(t,0,n,this.jj))return Un(e,"svg",t[0]?.el??null);let r=ot(t,0,n,this.jj);if(ft(r.m,e._G),e.backHidden=r.backHidden,e.scene=t[r.scene]?.el??null,lt(r.m,e._u,e._F))return Un(e,"behind",Rn(t));if(!Wn)return null;let i=Ze(t,0,n,e=>En(t[e]));return i>=0?Un(e,"rounded",t[i]?.el??null):null}verify(e,t,n){if(mt(e._G,e._u,e._F,n)<=In[t])return e._A=0,null;if((n.now<e.animUntil||e.scrollLinked)&&++e._A<Gn)return null;let r=e.nodes,i=r.find(e=>e.zoom&&Math.abs(parseFloat(e.zoom)-1)>1e-6);return i?Un(e,"zoom",i.el):Un(e,"verify",Rn(r))}};function Kn(t,n){if(!n.level||n.xfReason)return null;let r=e(9);if(!o(r,n._G))return null;let i=n.scrolls?t.env.host.scroll.root:null,l=i?i.scrollLeft:q(t.env.lib.bodyOrNull),s=i?i.scrollTop:K(t.env.lib.bodyOrNull),a=n._G,u=n._u/2,c=n._F/2,h=a[2]*u+a[5]*c+a[8],d=(a[0]*u+a[3]*c+a[6])/h,f=(a[1]*u+a[4]*c+a[7])/h;return{width:n._u,height:n._F,ax:(a[0]-d*a[2])/h,ay:(a[1]-f*a[2])/h,bx:(a[3]-d*a[5])/h,by:(a[4]-f*a[5])/h,toLocal(e,t,n){let i=e+l,o=t+s,u=r[2]*i+r[5]*o+r[8],c=(r[0]*i+r[3]*o+r[6])/u,h=(r[1]*i+r[4]*o+r[7])/u;n[0]=c,n[1]=h;let d=a[2]*c+a[5]*h+a[8];n[2]=(a[0]-i*a[2])/d,n[3]=(a[1]-o*a[2])/d,n[4]=(a[3]-i*a[5])/d,n[5]=(a[4]-o*a[5])/d}}}function Jn(e){let t=new Map;for(let n of e.planes.all)n.scene&&!n.backHidden&&!n.xfReason&&n.el.isConnected&&t.set(n.scene,(t.get(n.scene)??0)+1);for(let n of e.planes.all){let r=n.scene&&!n.backHidden&&(t.get(n.scene)??0)>1?Un(n,"scene",n.scene):null;r!==n._y&&(n._y=r,e.fallbacks.decide(n))}}function Zn(e){let t=getComputedStyle(e.el);e.by==="clip"?e.node.clip=t.getPropertyValue("clip")||"auto":e.node.clipPath=t.clipPath||"none"}function Qn(e){return e.nodes[e.nodes.length-1]?.topLayer?`${i(e.el)}: it is inside an open modal <dialog> or popover (the top layer), which paints over Umber's canvas, so its DOM shows.`:null}var er=[null,-1,!1];function tr(e){let t=e.jc;return(er[0]!==e||er[1]!==t)&&(er=[e,t,!!document.querySelector("[data-umber~=above]")]),er[2]}var nr=class{constructor(n,r,i,o){this.stage=n;this.placement=r;this.occluders=i;this.Md=o;this.box={sx:0,sy:0,w:0,h:0};this.covers=new WeakMap;this.contexts=new WeakSet;this.quad=e(4);this.V=t(4)}measure(e,t,n=!0){let o=Qn(e);if(o)return o;this.uncut(e),t&&this.pe(e);let l=this.gb(e);if(l)return l;let s=e.clips;if(!s)return null;s.noSlots=e.kind==="layer",this.S(e,t,n),pn(e,0,0,this.V);let a=this.V,u=this.quad;u[0]=a[0],u[1]=a[1],u[2]=a[0]+a[2],u[3]=a[1]+a[3];let c=Dt(e,s,u,e.bends);e.stale&&(s.ownRadius.set(e.radius),s.ownKy=e._w);let h=!1;for(let t=0;t<4;t++){let n=r(s.ownRadius,t),i=r(s.fold,t);e.radius[t]=Math.max(n,i),h||=i>n}if(e._w=h?1:s.ownKy,e.kind!=="layer")return c?fn(e,s):null;if(c||s.shaders.length){let t=s.shaders[0]?.el??c?.clips[0]?.el??s.mask?.el;this.stage.fallbacks.Ja(e,`${i(e.el)}: a layer can't be cut by a rounded, shaped or masked parent (${i(t)}); it draws uncut. Make that parent's clip a straight overflow: hidden, or add data-umber-clip="false" to silence this.`),s.shaders.length=0,s.reason=null}return null}uncut(e){let t=e.clips,n=t?t.occluderHow.indexOf("uncut"):-1,r=t?.occluders[n];if(!t||!r)return;let o=i(r.el);this.stage.fallbacks.Ja(e,t.noSlots?`${i(e.el)}: a layer can only be cut straight, so data-umber-occlude on ${o} doesn't hide it where it passes through it or a rounded or turned corner overlaps it (GL draws over that panel there).`:`${i(e.el)}: its parents' rounded or shaped clips take both GL clip slots, so data-umber-occlude on ${o} doesn't hide it where they overlap (GL draws over that panel there). Make one of those parents' clips a straight overflow: hidden.`)}pe(e){let t=this.stage;if(!t.transitions.ongoing){Yn(this.covers,e,t);let n=tr(t.batches)?Hn(e.el):[],r=n.length?n[0]:null,i=r&&r[0]!==e.el&&!this.contexts.has(r[0])&&Xn(r[0],r[1],t.canvasHost.el);if(i){this.contexts.add(r[0]);for(let[e,n]of i)t.env.host.log.warn(n,e)}}let n=(e.el.getAttribute("data-umber-clip")??"").trim().toLowerCase()==="false";e.clips=kt(e,{nodes:e.nodes,off:n,isInsideScroll:this.Md,previous:e.clips,occluders:this.occluders.Nk(e)})}gb(e){return e.kind==="layer"?null:this.covers.get(e)}S(e,t,n){let r=this.stage;for(let i of e.clips?.list??[]){i.by!=="overflow"&&!t&&n&&Zn(i);let o=rr(i),l=this.box;l.sx=i.scrolls?r.env.frame.scrollX:r.env.frame.pageX,l.sy=i.scrolls?r.env.frame.scrollY:r.env.frame.pageY,Bn(i.node,this.placement.Td(i.el),l),i.ignored=!this.placement.yj(e.nodes,i.depth,l,i.toDocument),i.ignored||Pt(i,i.toDocument,{width:l.w,height:l.h,value:o})}}};function rr(e){return e.by==="overflow"?"":e.by==="clip"?e.node.clip:e.node.clipPath}var ir=[],or=4;function lr(e,t){if(t.contains(e)||e.contains(t))return!0;let n=e.parentElement;for(let e=t,r=0;e&&e!==document.body&&r<or;e=e.parentElement,r++){let t=e.parentElement;if(t&&(n===t||n?.parentElement===t))return!0}return!1}var sr=/^(SPAN|B|I|EM|STRONG|SMALL|SUB|SUP|TIME|BR)$/;function ar(e){for(let t of e)if(t.nodeType===1&&!sr.test(t.nodeName))return!0;return!1}function ur(t,n){let r=e(9),i=e(9),o=e(4),l=e(8);return{el:t,by:"occlude",node:n,nodes:[],own:!1,ignored:!0,depth:0,key:"",shape:null,reason:null,toDocument:r,toShape:i,bounds:o,scrolls:!0,square:!1,how:"pruned",live:!1,axis:!0,radiusX:0,radiusY:0,want:!1,over:!1,cuts:[],full:l,from:null,warned:!1,stack:[],hidden:!1,until:0,linked:!1,fades:!1,siblingOrParent:null}}var cr=(e,t,n)=>e.ignored===n&&e.bounds[0]===t[0]&&e.bounds[1]===t[1]&&e.bounds[2]===t[2]&&e.bounds[3]===t[3],hr=class{constructor(t,n,r){this.stage=t;this.placement=n;this.Md=r;this.edges=e(4);this.was=e(4);this.box={sx:0,sy:0,w:0,h:0};this.list=[];this.Pj=-1;this.hostZ=0;this.ik=!1;this.rk=!1;this.watch=null}ha(){this.ik=!1;let e=this.stage;return e.batches.gk!==this.Pj?(this.Pj=e.batches.gk,this.find(),this.zf(),this.rk=!1,this.list.length>0):this.rk&&!e.env.frame.scrolled?(this.rk=!1,this.zf(),!0):!1}find(){let e=document.querySelectorAll("[data-umber-occlude]");if(!e.length&&!this.list.length)return;this.hostZ=+getComputedStyle(this.stage.canvasHost.el).zIndex||0;let t=e.length!==this.list.length,n=[];if(e.forEach((e,r)=>{let i=this.list.find(t=>t.el===e)??ur(e,E(e,this.stage.env.frame.cc));this.list[r]!==i&&(t=!0),n.push(i)}),this.list=n,!!t){this.Ne();for(let e of this.stage.planes.all)e.stale=!0;this.stage.scheduler.markDirty()}}follow(e){let t=this.list;for(let e of t)e.want=!1,e.over=!1,!e.ignored&&!e.el.isConnected&&(e.ignored=!0,this.stage.scheduler.markDirty());for(let e of this.stage.planes.all)(e.zone.soon||e.visible)&&br(e);for(let n of t){let t=n.linked||e<n.until;!(n.live||t)||!n.want||!n.el.isConnected||(this.place(n,!1,t&&n.fades),e<n.until&&(n.until<1/0||n.over)&&this.stage.scheduler.uc(1))}}hook(e){if(e===document.body||e===document.documentElement)return!1;for(let t of this.list)if(lr(e,t.el))return this.rk=!0;return!1}holds(e){return this.list.some(t=>e.contains(t.el))}Ne(){if(typeof MutationObserver>"u")return;let e=this.watch;if(e)e.disconnect();else{let t=new MutationObserver(e=>{for(let t of e)(t.type==="childList"?ar(t.addedNodes)||ar(t.removedNodes):this.hook(t.target))&&(this.rk=!0,this.stage.scheduler.request())});this.stage.env.cleanups.push(()=>{t.disconnect()}),this.watch=t,e=t}if(this.list.length){e.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["aria-expanded","aria-hidden","open","data-state","hidden"]});for(let t of this.list)e.observe(t.el,{childList:!0,subtree:!0})}}place(e,t,n=t){let r=this.stage;if(t&&this.M(e),!e.nodes.length||(n&&(e.hidden=dr(e,t)),t&&!e.hidden&&!e.warned&&!e.el.matches("[data-umber~=shader]")&&!jn(e.el)&&(e.warned=!0,r.env.lib.say("occludeSeeThrough",[e.el],e.el)),e.ignored=e.hidden||!e.el.isConnected,e.ignored))return;let i=this.placement.Td(e.el);if(e.ignored=i.width<=0||i.height<=0,e.ignored)return;let o=this.box;Bn(e.node,i,o);let l=o.sx=e.scrolls?r.env.frame.scrollX:r.env.frame.pageX,s=o.sy=e.scrolls?r.env.frame.scrollY:r.env.frame.pageY;e.ignored=!this.placement.yj(e.nodes,0,o,e.toDocument),!e.ignored&&(fr(e,o.w,o.h),e.ignored=this.cut(e,l,s),!e.ignored&&(t&&e.reason==="mixed-corners"&&r.env.lib.say("occludeCorners",[e.el],e.el),e.axis=gt(e.toDocument),pr(e)))}M(e){e.nodes=ne(e.el,this.stage.env.frame.cc);let[t]=e.nodes;t&&(e.node=t),e.scrolls=this.Md(e.el),e.live=ue(e.nodes,this.stage.env.host.scroll.root)||e.el.hasAttribute("data-umber-live"),e.stack=Hn(e.el),e.cuts=e.nodes.length?ge(e.nodes).sources.filter(t=>t.by==="overflow"&&!Je(e.nodes,t.depth)).map(e=>e.node):[]}cut(e,t,n){let r=e.bounds,i=e.shape,o=e.toDocument;if(!i)return!1;if(i.kind||o[1]||o[3]||o[2]||o[5]||!(o[0]>0&&o[4]>0))return r[2]<=r[0]||r[3]<=r[1];let l=this.edges;l.set(r),this.Oe(e,t,n,l);let s=l[0],a=l[1],u=l[2],c=l[3];return u<=s||c<=a?!0:(s===r[0]&&a===r[1]&&u===r[2]&&c===r[3]||(gr(i.radius,r,l),i.box[0]=(s-o[6])/o[0],i.box[1]=(a-o[7])/o[4]*i.ky,i.box[2]=(u-s)/o[0],i.box[3]=(c-a)/o[4]*i.ky,r.set(l)),!1)}Oe(e,t,n,r){for(let i of e.cuts){let e=this.placement.Td(i.el),{border:o,scrollbar:l,direction:s}=Q(i),a=s==="rtl"?l[0]:0;i.overflowX!=="visible"&&(r[0]=Math.max(r[0],e.left+t+o[3]+a),r[2]=Math.min(r[2],e.right+t-o[1]-l[0]+a)),i.overflowY!=="visible"&&(r[1]=Math.max(r[1],e.top+n+o[0]),r[3]=Math.min(r[3],e.bottom+n-o[2]-l[1]))}}zf(){if(!(this.ik||!this.list.length)){this.ik=!0;for(let e of this.list){this.was.set(e.bounds);let t=e.ignored,n=e.stack,r=e.siblingOrParent,i=e.nodes.length>0;if(this.place(e,!0),cr(e,this.was,t)||this.stage.scheduler.markDirty(),e.siblingOrParent=e.el.previousElementSibling??e.el.parentElement,i&&(e.siblingOrParent!==r||mr(n,e.stack))){for(let e of this.stage.planes.all)e.stale=!0;this.stage.scheduler.markDirty()}}}}Nk(e){if(!this.list.length||this.hostZ<=0)return ir;this.zf();let t=(e.el.getAttribute("data-umber-under")??"").trim();if(t==="none")return ir;let n=t?this.picked(e,t):null,r=[],i=null;for(let t of n??this.list){if(!this.K(e,t,!!n))continue;(!!n||(this.stage.planes.of(t.el)?this.drawnOver(e.el,t.el):An(e.el,i??=Hn(e.el),t.el,t.stack)))&&r.push(t)}return r.length?r:ir}drawnOver(e,t){let n=e=>this.stage.env.lib.attr.num(e,"data-umber-order",0),r=n(t)-n(e);return r?r>0:!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}K(e,t,n){return t.el.contains(e.el)?(n&&this.stage.fallbacks.Ja(e,`${i(e.el)}: data-umber-under names ${i(t.el)}, which holds it; a panel never cuts what is inside it.`),!1):!e.el.contains(t.el)||e.kind==="shader"}picked(e,t){let n;try{n=this.list.filter(e=>e.el.matches(t))}catch{n=[]}return n.length?n:(this.stage.fallbacks.Ja(e,`${i(e.el)}: data-umber-under="${t}" matches no [data-umber-occlude] element, so its occluders are the usual ones (those after it in the page).`),null)}};function dr(e,t){let n=getComputedStyle(e.el);t||(e.node.clipPath=n.clipPath||"none");let r=n.visibility==="hidden"||e.el.checkVisibility?.()===!1;for(let n of e.nodes){if(r)break;r=parseFloat(t?n.opacity:getComputedStyle(n.el).opacity)===0}return r}function fr(e,t,n){let i=e.full;if(e.shape&&e.shape===e.from)for(let t=0;t<4;t++)e.shape.box[t]=r(i,t),e.shape.radius[t]=r(i,t+4);if(Pt(e,e.toDocument,{width:t,height:n,value:/^(inset|circle|ellipse|rect|xywh)\(/.test(e.node.clipPath)?e.node.clipPath:"border-box"}),e.shape&&e.shape!==e.from){e.from=e.shape;for(let t=0;t<4;t++)i[t]=r(e.shape.box,t),i[t+4]=r(e.shape.radius,t)}}function pr(e){let t=e.shape,n=t?.kind===0?Math.max(t.radius[0],t.radius[1],t.radius[2],t.radius[3]):0;e.radiusX=n*e.toDocument[0],e.radiusY=t?n/t.ky*e.toDocument[4]:0}var mr=(e,t)=>e.length!==t.length||e.some((e,n)=>{let r=t[n];return r?e[0]!==r[0]||e[1]!==r[1]:!0});function br(e){let t=e.clips;if(!t)return;let n=t.occluders;for(let e=0;e<n.length;e++){let r=n[e];r&&(r.want=!0,(t.occluderHow[e]!=="pruned"||t.Sh===r)&&(r.over=!0))}}function gr(e,t,n){let r=n[1]>t[1],i=n[2]<t[2],o=n[3]<t[3],l=n[0]>t[0];(r||l)&&(e[0]=0),(r||i)&&(e[1]=0),(i||o)&&(e[2]=0),(o||l)&&(e[3]=0)}var vr=class{constructor(e){this.stage=e;this.sk={scrollX:0,scrollY:0,pageX:0,pageY:0,canvasPerCssX:1,canvasPerCssY:1,canvasWidth:1,canvasHeight:1};let t=t=>{let n=e.env.host.scroll.root;return n?n!==t&&n.contains(t):!0};this.placement=new qn(e),this.occluders=new hr(e,this.placement,t),this.cuts=new nr(e,this.placement,this.occluders,t),this.animations=new Fn(e,this.occluders);let n=t=>{let n=t.target;n instanceof Element&&(t.type!=="input"||/^(checkbox|radio|select-)/.test(n.type))&&this.occluders.hook(n)&&e.scheduler.request()};for(let t of["pointerover","pointerout","focusin","focusout","input"])e.env.listen(document,t,n)}start(e,t){this.placement.clear(),this.occluders.ha()&&(t=!0),t&&this.animations.scan(e),this.occluders.list.length&&this.occluders.follow(e),this.animations.Th()}gi(e,t){this.placement.gi(e,t)}yc(e){return Kn(this.stage,e)}zl(){Jn(this.stage)}Fb(e,t,n=!0){return this.cuts.measure(e,t,n)}Ii(e){this.animations.scan(e)}Th(){this.animations.Th()}Ad(e){this.animations.Ad(e)}frame(e,t){let n=this.stage,r=this.sk;r.scrollX=n.env.frame.scrollX,r.scrollY=n.env.frame.scrollY,r.pageX=n.env.frame.pageX,r.pageY=n.env.frame.pageY,r.canvasWidth=n.gpu.canvas.width,r.canvasHeight=n.gpu.canvas.height,r.canvasPerCssX=n.gpu.canvas.width/Math.max(e,1),r.canvasPerCssY=n.gpu.canvas.height/Math.max(t,1)}clip(e,t,n){return Ut(e,t,n,this.sk)}fh(e,t,n){let r=e._s,i=e.pad,o=e.edge[0],l=e.size;l[0]=(e._u+2*i+e.rounding[0])*o,l[1]=(e._F+2*i+e.rounding[1])*o;let s=e._G,a=e._O,u=1/o;a[0]=s[0]*u,a[1]=s[1]*u,a[2]=s[2]*u,a[3]=s[3]*u,a[4]=s[4]*u,a[5]=s[5]*u,a[6]=s[6]-i*(s[0]+s[3]),a[7]=s[7]-i*(s[1]+s[4]),a[8]=s[8]-i*(s[2]+s[5]),r[0]=a[0]-t*a[2],r[1]=a[1]-n*a[2],r[2]=a[2],r[3]=a[3]-t*a[5],r[4]=a[4]-n*a[5],r[5]=a[5],r[6]=a[6]-t*a[8],r[7]=a[7]-n*a[8],r[8]=a[8];let c=l[0]/2,h=l[1]/2,d=r[2]*c+r[5]*h+r[8],f=e._x;f[0]=(r[0]*c+r[3]*h+r[6])/d-c,f[1]=(r[1]*c+r[4]*h+r[7])/d-h,f[2]=l[0],f[3]=l[1]}pointer(e,t,n){let r=e._q;if(!o(r,e._O))return;let i=r[2]*t+r[5]*n+r[8];e._m[0]=(r[0]*t+r[3]*n+r[6])/i/Math.max(e.size[0],1),e._m[1]=(r[1]*t+r[4]*n+r[7])/i/Math.max(e.size[1],1)}Sh(e){return`it is entirely cut off by ${hn(e)} on ${i(e.el)}`}report(e,t){let n=e.clips,r=(n?.list??[]).map(e=>(e.ignored&&t.push(`the ${hn(e)} clip on ${i(e.el)} is skipped right now: part of that parent turns behind the viewer`),{el:e.el,by:e.by,shape:hn(e),how:e.how}));return n?.occluders.forEach((e,o)=>{let l=n.occluderHow[o]??"pruned";l==="uncut"&&t.push(`data-umber-occlude on ${i(e.el)} overlaps it, but ${n.noSlots?"a layer is only cut straight":"its parents' clips take both GL clip slots"}: GL draws over that panel there`),r.push({el:e.el,by:e.by,shape:hn(e),how:l})}),r}};function yr(e){e.chunks.shapesError=null,e.chunks.shapes=new vr(e),e.measurePhase.ma();for(let t of e.planes.all)t.stale=!0,t.shapeWait=!1;e.scheduler.markDirty()}export{yr as shapes};
|