@rive-app/webgl2 2.40.0 → 2.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl2",
3
- "version": "2.40.0",
3
+ "version": "2.40.1",
4
4
  "description": "Rive's webgl2 based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.js CHANGED
@@ -431,14 +431,14 @@ c.ec.count.value+=1;c.ec.Xc=!1;return c},["delete"](){this.ec.lc||dc(this);if(th
431
431
  const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
432
432
  Object.assign(tc.prototype,{ye(a){this.Zd&&(a=this.Zd(a));return a},Md(a){this.Ec?.(a)},wc:Yb,kc:function(a){function b(){return this.kd?sc(this.fc.Bc,{nc:this.Me,lc:c,yc:this,sc:a}):sc(this.fc.Bc,{nc:this,lc:a})}var c=this.ye(a);if(!c)return this.Md(a),null;var d=rc(this.fc,c);if(void 0!==d){if(0===d.ec.count.value)return d.ec.lc=c,d.ec.sc=a,d.clone();d=d.clone();this.Md(a);return d}d=this.fc.xe(c);d=gc[d];if(!d)return b.call(this);d=this.jd?d.oe:d.pointerType;var e=qc(c,this.fc,d.fc);return null===
433
433
  e?b.call(this):this.kd?sc(d.fc.Bc,{nc:d,lc:e,yc:this,sc:a}):sc(d.fc.Bc,{nc:d,lc:e})}});for(let a=0;32>a;++a)od.push(Array(a));l.print&&(oa=l.print);l.printErr&&(y=l.printErr);l.wasmBinary&&(pa=l.wasmBinary);l.thisProgram&&(ja=l.thisProgram);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
434
- var yd={324599:(a,b,c,d,e)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=a;window.miniaudio.device_type.capture=b;window.miniaudio.device_type.duplex=c;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=d;window.miniaudio.device_state.started=e;let f=window.miniaudio;f.devices=
434
+ var yd={325014:(a,b,c,d,e)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=a;window.miniaudio.device_type.capture=b;window.miniaudio.device_type.duplex=c;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=d;window.miniaudio.device_state.started=e;let f=window.miniaudio;f.devices=
435
435
  [];f.track_device=function(g){for(var h=0;h<f.devices.length;++h)if(null==f.devices[h])return f.devices[h]=g,h;f.devices.push(g);return f.devices.length-1};f.untrack_device_by_index=function(g){for(f.devices[g]=null;0<f.devices.length;)if(null==f.devices[f.devices.length-1])f.devices.pop();else break};f.untrack_device=function(g){for(var h=0;h<f.devices.length;++h)if(f.devices[h]==g)return f.untrack_device_by_index(h)};f.get_device_by_index=function(g){return f.devices[g]};f.unlock_event_types=["touchend",
436
- "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.zc&&h.state===f.device_state.started&&h.zc.resume().then(()=>{vd(h.Wd)},k=>{console.error("Failed to resume audiocontext",k)})}f.unlock_event_types.map(function(k){document.removeEventListener(k,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},326777:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
437
- window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},327081:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,327185:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},327356:(a,b,c,d,e,f)=>{if("undefined"===typeof window.miniaudio)return-1;var g={},h={};a==window.miniaudio.device_type.playback&&0!=c&&(h.sampleRate=c);g.zc=
436
+ "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.zc&&h.state===f.device_state.started&&h.zc.resume().then(()=>{vd(h.Wd)},k=>{console.error("Failed to resume audiocontext",k)})}f.unlock_event_types.map(function(k){document.removeEventListener(k,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},327192:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
437
+ window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},327496:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,327600:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},327771:(a,b,c,d,e,f)=>{if("undefined"===typeof window.miniaudio)return-1;var g={},h={};a==window.miniaudio.device_type.playback&&0!=c&&(h.sampleRate=c);g.zc=
438
438
  new (window.AudioContext||window.webkitAudioContext)(h);g.zc.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.Oc=g.zc.createScriptProcessor(d,c,b);g.Oc.onaudioprocess=function(k){if(null==g.hd||0==g.hd.length)g.hd=new Float32Array(ua.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var m=0;m<b;m+=1)for(var q=k.inputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)v[t*b+m]=q[t];wd(f,d,e)}if(a==
439
439
  window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(xd(f,d,e),m=0;m<k.outputBuffer.numberOfChannels;++m)for(q=k.outputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)q[t]=v[t*b+m];else for(m=0;m<k.outputBuffer.numberOfChannels;++m)k.outputBuffer.getChannelData(m).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(k){g.sd=g.zc.createMediaStreamSource(k);g.sd.connect(g.Oc);
440
- g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},330233:a=>window.miniaudio.get_device_by_index(a).zc.sampleRate,330306:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.Oc&&(a.Oc.onaudioprocess=function(){},a.Oc.disconnect(),a.Oc=void 0);void 0!==a.sd&&(a.sd.disconnect(),a.sd=void 0);a.zc.close();a.zc=void 0;a.Wd=void 0},330706:a=>
441
- {window.miniaudio.untrack_device_by_index(a)},330756:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.resume();a.state=window.miniaudio.device_state.started},330895:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,rd,Pb,vd,wd,xd,zd,Ad,Bd,Aa,vc,Dd={pa:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 0:var e=K();if(0>e)break;for(;kb[e];)e++;return xb(d,e).Mc;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
440
+ g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},330648:a=>window.miniaudio.get_device_by_index(a).zc.sampleRate,330721:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.Oc&&(a.Oc.onaudioprocess=function(){},a.Oc.disconnect(),a.Oc=void 0);void 0!==a.sd&&(a.sd.disconnect(),a.sd=void 0);a.zc.close();a.zc=void 0;a.Wd=void 0},331121:a=>
441
+ {window.miniaudio.untrack_device_by_index(a)},331171:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.resume();a.state=window.miniaudio.device_state.started},331310:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,rd,Pb,vd,wd,xd,zd,Ad,Bd,Aa,vc,Dd={pa:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 0:var e=K();if(0>e)break;for(;kb[e];)e++;return xb(d,e).Mc;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
442
442
  e,0;case 12:return e=K(),D[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return-f.Lc}},vb:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 21509:return d.mc?0:-59;case 21505:if(!d.mc)return-59;if(d.mc.Kc.Fe){a=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var e=K();G[e>>2]=25856;G[e+4>>2]=5;G[e+8>>2]=191;G[e+12>>2]=35387;for(var f=0;32>f;f++)A[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.mc?
443
443
  0:-59;case 21506:case 21507:case 21508:if(!d.mc)return-59;if(d.mc.Kc.Ge)for(e=K(),a=[],f=0;32>f;f++)a.push(A[e+f+17]);return 0;case 21519:if(!d.mc)return-59;e=K();return G[e>>2]=0;case 21520:return d.mc?-28:-59;case 21537:case 21531:e=K();if(!d.hc.Ee)throw new M(59);return d.hc.Ee(d,b,e);case 21523:if(!d.mc)return-59;d.mc.Kc.He&&(f=[24,80],e=K(),D[e>>1]=f[0],D[e+2>>1]=f[1]);return 0;case 21524:return d.mc?0:-59;case 21515:return d.mc?0:-59;default:return-28}}catch(g){if("undefined"==typeof Gb||"ErrnoError"!==
444
444
  g.name)throw g;return-g.Lc}},wb:function(a,b,c,d){Ka=d;try{b=b?L(B,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":vb(a).path;if(0==e.length)throw new M(44);b=f+"/"+e}var g=d?K():0;return Db(b,c,g).Mc}catch(h){if("undefined"==typeof Gb||"ErrnoError"!==h.name)throw h;return-h.Lc}},zb:()=>Ba(""),la:(a,b,c)=>{a=R(a);b=Sb(b,"wrapper");c=Q(c);var d=b.fc,e=d.Bc,f=d.rc.Bc,g=d.rc.constructor;a=Hb(a,function(...h){for(var k of d.rc.Xd)if(this[k]===f[k])throw new Lb(`Pure virtual function ${k} must be implemented in JavaScript`);
@@ -460,11 +460,11 @@ Kc,e=Lc,f=Mc;S(a,{name:c,kc:g=>{var h=d(g+4,J[g>>2]*b,!0);Qb(g);return h},oc:(g,
460
460
  },m:(a,b,c)=>{var [d,...e]=Pc(a,b),f=d.oc.bind(d),g=e.map(k=>k.wc.bind(k));a--;var h=Array(a);b=`methodCaller<(${e.map(k=>k.name)}) => ${d.name}>`;return Oc(Hb(b,(k,m,q,v)=>{for(var t=0,C=0;C<a;++C)h[C]=g[C](v+t),t+=8;switch(c){case 0:var p=Q(k).apply(null,h);break;case 2:p=Reflect.construct(Q(k),h);break;case 3:p=h[0];break;case 1:p=Q(k)[Rc(m)](...h)}k=[];p=f(k,p);k.length&&(J[q>>2]=Kb(k));return p}))},jb:Cc,bb:(a,b)=>{a=Q(a);b=Q(b);return Kb(a[b])},ga:a=>{9<a&&(Jb[a+1]+=1)},l:(a,b,c,d,e)=>Nc[a](b,
461
461
  c,d,e),gb:()=>Kb([]),ib:a=>Kb(Rc(a)),Ob:()=>Kb({}),Fa:a=>{var b=Q(a);Xb(b);Cc(a)},q:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},qb:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getUTCSeconds();G[b+4>>2]=a.getUTCMinutes();G[b+8>>2]=a.getUTCHours();G[b+12>>2]=a.getUTCDate();G[b+16>>2]=a.getUTCMonth();G[b+20>>2]=a.getUTCFullYear()-1900;G[b+24>>2]=a.getUTCDay();G[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},rb:function(a,b){a=
462
462
  -9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getSeconds();G[b+4>>2]=a.getMinutes();G[b+8>>2]=a.getHours();G[b+12>>2]=a.getDate();G[b+16>>2]=a.getMonth();G[b+20>>2]=a.getFullYear()-1900;G[b+24>>2]=a.getDay();var c=a.getFullYear();G[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?Tc:Sc)[a.getMonth()]+a.getDate()-1|0;G[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();G[b+32>>
463
- 2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},sb:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();J[a>>2]=60*Math.max(f,e);G[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(Va(a,B,c,17),Va(b,B,d,17)):(Va(a,B,d,17),Va(b,B,c,17))},Ia:function(a,b,c){(a=u[a].tc.qd)&&a.beginPixelLocalStorageWEBGL(l.HEAPU32.subarray(c,
464
- c+b))},yb:function(a,b,c){if(!(0<=a&&3>=a))return 28;wa[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},fb:function(a,b,c){var d=l.images;d||(d=new Map,l.images=d);var e=new Image;d.set(a,e);b=l.HEAP8.subarray(b,b+c);c=new Uint8Array(c);c.set(b);e.src=URL.createObjectURL(new Blob([c],{type:"image/png"}));e.onload=function(){l._setWebImage(a,e.width,e.height)}},eb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},s:(a,b,c)=>{Uc.length=0;for(var d;d=B[b++];){var e=105!=
465
- d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),pb:a=>{var b=B.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Aa.buffer.byteLength+65535)/65536|0;try{Aa.grow(d);za();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},t:(a,b)=>{a=u[a];b=b?L(B,b):"";b.startsWith("GL_")&&
463
+ 2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},sb:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();J[a>>2]=60*Math.max(f,e);G[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(Va(a,B,c,17),Va(b,B,d,17)):(Va(a,B,d,17),Va(b,B,c,17))},Ia:function(a,b,c){(a=u[a].tc.qd)&&a.beginPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,
464
+ 4*c,b))},yb:function(a,b,c){if(!(0<=a&&3>=a))return 28;wa[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},fb:function(a,b,c){var d=l.images;d||(d=new Map,l.images=d);var e=new Image;d.set(a,e);b=l.HEAP8.subarray(b,b+c);c=new Uint8Array(c);c.set(b);e.src=URL.createObjectURL(new Blob([c],{type:"image/png"}));e.onload=function(){l._setWebImage(a,e.width,e.height)}},eb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},s:(a,b,c)=>{Uc.length=0;for(var d;d=B[b++];){var e=
465
+ 105!=d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),pb:a=>{var b=B.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Aa.buffer.byteLength+65535)/65536|0;try{Aa.grow(d);za();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},t:(a,b)=>{a=u[a];b=b?L(B,b):"";b.startsWith("GL_")&&
466
466
  (b=b.slice(3));"WEBGL_draw_instanced_base_vertex_base_instance"==b&&Vc(X);"WEBGL_multi_draw_instanced_base_vertex_base_instance"==b&&Wc(X);"WEBGL_multi_draw"==b&&(X.Ke=X.getExtension("WEBGL_multi_draw"));"EXT_polygon_offset_clamp"==b&&(X.ue=X.getExtension("EXT_polygon_offset_clamp"));"EXT_clip_control"==b&&(X.te=X.getExtension("EXT_clip_control"));"WEBGL_polygon_mode"==b&&(X.Te=X.getExtension("WEBGL_polygon_mode"));return!!a.tc.getExtension(b)},f:()=>n?n.handle:0,ja:a=>ha(a)?0:-5,Ga:function(a){a=
467
- u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[a].tc;const b=a.getExtension("WEBGL_shader_pixel_local_storage");if(b&&b.isCoherent()){if(5==b.framebufferTexturePixelLocalStorageWEBGL.length)return a.qd=b,!0;console.warn("WEBGL_shader_pixel_local_storage is advertised, but a deprecated version has been detected. Disabling.")}return!1},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(l.HEAPU32.subarray(c,c+b))},mb:(a,b)=>{var c=0,d=0,e;for(e of nd()){var f=
467
+ u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[a].tc;const b=a.getExtension("WEBGL_shader_pixel_local_storage");if(b&&b.isCoherent()){if(5==b.framebufferTexturePixelLocalStorageWEBGL.length)return a.qd=b,!0;console.warn("WEBGL_shader_pixel_local_storage is advertised, but a deprecated version has been detected. Disabling.")}return!1},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,4*c,b))},mb:(a,b)=>{var c=0,d=0,e;for(e of nd()){var f=
468
468
  b+c;J[a+d>>2]=f;c+=Va(e,B,f,Infinity)+1;d+=4}return 0},nb:(a,b)=>{var c=nd();J[a>>2]=c.length;a=0;for(var d of c)a+=Ua(d)+1;J[b>>2]=a;return 0},na:function(a){try{var b=vb(a);if(null===b.Mc)throw new M(8);b.Cd&&(b.Cd=null);try{b.hc.close&&b.hc.close(b)}catch(c){throw c;}finally{kb[b.Mc]=null}b.Mc=null;return 0}catch(c){if("undefined"==typeof Gb||"ErrnoError"!==c.name)throw c;return c.Lc}},ub:function(a,b,c,d){try{a:{var e=vb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var m=e,q=
469
469
  h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(1===(m.flags&2097155))throw new M(8);if(16384===(m.node.mode&61440))throw new M(31);if(!m.hc.read)throw new M(28);var p="undefined"!=typeof t;if(!p)t=m.position;else if(!m.seekable)throw new M(70);var r=m.hc.read(m,C,q,v,t);p||(m.position+=r);var w=r;if(0>w){var x=-1;break a}b+=w;if(w<k)break;"undefined"!=typeof f&&(f+=w)}x=b}J[d>>2]=x;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.Lc}},
470
470
  tb:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=vb(a);Eb(e,b,c);wa[d>>3]=BigInt(e.position);e.Cd&&0===b&&0===c&&(e.Cd=null);return 0}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return f.Lc}},oa:function(a,b,c,d){try{a:{var e=vb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var m=e,q=h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(0===(m.flags&2097155))throw new M(8);if(16384===
@@ -481,7 +481,7 @@ var q=c.Id;c.Id+=h;e[m]=[h,q];for(k=0;k<h;++k)d[q]=k,c.ce[q++]=m}}c=a.$c;d=0;e=b
481
481
  ud(f);g>>>=31-Math.clz32(h.BYTES_PER_ELEMENT);X.readPixels(a,b,c,d,e,f,h,g)}},ra:(a,b,c,d,e)=>X.renderbufferStorageMultisample(a,b,c,d,e),Sa:(a,b,c,d)=>X.scissor(a,b,c,d),Aa:(a,b,c,d)=>{for(var e="",f=0;f<b;++f){var g=(g=J[c+4*f>>2])?L(B,g,d?J[d+4*f>>2]:void 0):"";e+=g}X.shaderSource(cd[a],e)},Qa:(a,b,c)=>X.stencilFunc(a,b,c),ca:(a,b,c,d)=>X.stencilFuncSeparate(a,b,c,d),da:a=>X.stencilMask(a),Pa:(a,b,c)=>X.stencilOp(a,b,c),ba:(a,b,c,d)=>X.stencilOpSeparate(a,b,c,d),p:(a,b,c)=>X.texParameteri(a,b,
482
482
  c),o:(a,b,c,d,e)=>X.texStorage2D(a,b,c,d,e),Ab:(a,b,c,d,e,f)=>X.texStorage3D(a,b,c,d,e,f),D:(a,b,c,d,e,f,g,h,k)=>{if(X.ed)X.texSubImage2D(a,b,c,d,e,f,g,h,k);else if(k){var m=ud(h);X.texSubImage2D(a,b,c,d,e,f,g,h,m,k>>>31-Math.clz32(m.BYTES_PER_ELEMENT))}else{if(k){m=ud(h);var q=f*((hd||e)*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[g-6402]||1)*m.BYTES_PER_ELEMENT+gd-1&-gd);k=m.subarray(k>>>31-Math.clz32(m.BYTES_PER_ELEMENT),k+q>>>31-Math.clz32(m.BYTES_PER_ELEMENT))}else k=null;
483
483
  X.texSubImage2D(a,b,c,d,e,f,g,h,k)}},X:(a,b)=>{var c=X,d=c.uniform1i;var e=X.pe;if(e){var f=e.$c[a];"number"==typeof f&&(e.$c[a]=f=X.getUniformLocation(e,e.ce[a]+(0<f?`[${f}]`:"")));a=f}else Z||=1282,a=void 0;d.call(c,a,b)},J:(a,b,c)=>{a=Y[a];X.uniformBlockBinding(a,b,c)},Oa:a=>{a=Y[a];X.useProgram(a);X.pe=a},I:(a,b)=>{X.vertexAttribDivisor(a,b)},U:(a,b,c,d,e)=>{X.vertexAttribIPointer(a,b,c,d,e)},u:(a,b,c,d,e,f)=>{X.vertexAttribPointer(a,b,c,!!d,e,f)},P:(a,b,c,d)=>X.viewport(a,b,c,d),Ya:Cd,Za:function(){return-1<
484
- navigator.platform.indexOf("Win")},Ea:function(a,b){(a=u[a].tc.Yd)&&a.provokingVertexWEBGL(b)},hb:function(a,b){var c=l.images;c&&(b=c.get(b))&&(a=u[a].tc,a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,b),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1))},_a:function(a,b,c){b=l.HEAP8.subarray(b,b+c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");
484
+ navigator.platform.indexOf("Win")},Ea:function(a,b){(a=u[a].tc.Yd)&&a.provokingVertexWEBGL(b)},hb:function(a,b){var c=l.images;c&&(b=c.get(b))&&(a=u[a].tc,a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,b),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1))},_a:function(a,b,c){b=new Uint8Array(Aa.buffer,b,c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");
485
485
  e.drawImage(d,0,0);e=e.getImageData(0,0,d.width,d.height);var f=e.data.length,g=l.je(f);l.Ue.set(e.data,g);l.We(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=l.mf(d)+1,f=l.je(e);l.tf(d,f,e);l.Xe(a,f);l.Ve(f)})}};function Cd(a,b,c){var d=Bd();try{vc.get(a)(b,c)}catch(e){Ad(d);if(e!==e+0)throw e;zd(1,0)}}var Ed;
486
486
  Ed=await (async function(){function a(c){c=Ed=c.exports;Qb=c.Sb;rd=c.Tb;l._setWebImage=c.Ub;Pb=c.Vb;l._wasm_image_decode_complete=c.Wb;l._wasm_image_decode_error=c.Xb;vd=l._ma_device__on_notification_unlocked=c.Yb;l._ma_malloc_emscripten=c.Zb;l._ma_free_emscripten=c._b;wd=l._ma_device_process_pcm_frames_capture__webaudio=c.$b;xd=l._ma_device_process_pcm_frames_playback__webaudio=c.ac;zd=c.bc;Ad=c.cc;Bd=c.dc;Aa=c.Pb;vc=c.Rb;za();return Ed}var b={a:Dd};if(l.instantiateWasm)return new Promise(c=>
487
487
  {l.instantiateWasm(b,(d,e)=>{c(a(d,e))})});Ca??=l.locateFile?l.locateFile("webgl2_advanced.wasm",ka):ka+"webgl2_advanced.wasm";return a((await Fa(b)).instance)}());
@@ -495,7 +495,7 @@ if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.leng
495
495
  /* 5 */
496
496
  /***/ ((module) => {
497
497
 
498
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.40.0","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
498
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.40.1","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
499
499
 
500
500
  /***/ }),
501
501
  /* 6 */
@@ -2651,21 +2651,21 @@ __webpack_require__.r(__webpack_exports__);
2651
2651
  /* harmony export */ KeyboardInteractions: () => (/* binding */ KeyboardInteractions)
2652
2652
  /* harmony export */ });
2653
2653
  /**
2654
- * Tracks the relationship between the canvas's DOM focus and Rive's internal focus for the
2655
- * current focus session.
2654
+ * Tracks the relationship between DOM focus inside this Rive focus domain (canvas or semantic overlay)
2655
+ * and Rive's internal focus for the current focus session.
2656
2656
  *
2657
- * NotFocused — the canvas is not the active DOM element, or Rive entered and then released focus
2658
- * internally this session. Either way the next Tab should move on to the next page
2659
- * element, so Tab events are ignored.
2660
- * EntryPending — the canvas has DOM focus but Rive holds no active focus node yet, and the next Tab should enter
2661
- * the focus tree. This is the resting state for pointer-driven focus (a click on the
2662
- * canvas), or an edge case for keyboard focus where initial focus action did not land on a focus node.
2663
- * RiveFocused — a Rive node currently holds focus. Tab/Shift+Tab are routed to the Rive focus
2664
- * manager and trapped inside the canvas until Rive notifies focus has ended.
2657
+ * NotFocused — DOM focus left the domain, Rive released focus internally, or Tab walked
2658
+ * off the end of the tree. Keyboard input isn't ours, so Tab is ignored and
2659
+ * reaches the next page element.
2660
+ * EntryPending — DOM focus is inside the domain but Rive holds no node yet, so the next Tab
2661
+ * enters the focus tree. Set by pointer focus on the canvas, by assistive technology (AT) focus landing
2662
+ * in the overlay, and by keyboard focus whose entry attempt found no eligible node.
2663
+ * RiveFocused — a Rive node holds focus. Tab/Shift+Tab route to the Rive focus manager and stay
2664
+ * inside the domain until either Rive reports focus ended (pollFocusState) or
2665
+ * focusNext()/focusPrevious() returns false at the edge of the tree.
2665
2666
  *
2666
- * When keyboard focus lands on the canvas, onCanvasFocus reads the direction focus came from and
2667
- * moves into the focus tree immediately, going straight to RiveFocused. EntryPending is only set via pointer focus (or keyboard focus
2668
- * where focusNext()/focusPrevious() return false but respects tabindex).
2667
+ * Keyboard focus on the canvas enters the tree immediately: onCanvasFocus infers direction from
2668
+ * where focus came from and goes straight to RiveFocused when a node accepts.
2669
2669
  */
2670
2670
  var FocusSessionState;
2671
2671
  (function (FocusSessionState) {
@@ -2674,7 +2674,9 @@ var FocusSessionState;
2674
2674
  FocusSessionState["RiveFocused"] = "riveFocused";
2675
2675
  })(FocusSessionState || (FocusSessionState = {}));
2676
2676
  /**
2677
- * Manages keyboard and DOM focus interactions for a Rive canvas.
2677
+ * Manages keyboard and DOM focus interactions for Rive's focus domain (<canvas> or semantic overlay).
2678
+ * Because keyboard events can apply on either part of the domain, we need to track what events we should
2679
+ * handle/intercept, and when to release focus back to the page outside of the domain.
2678
2680
  *
2679
2681
  * Tracks the canvas focus session state (focusSessionState) and routes
2680
2682
  * Tab/Shift+Tab to the Rive state machine's focus manager. Exposes shared
@@ -2720,17 +2722,45 @@ var KeyboardInteractions = /** @class */ (function () {
2720
2722
  _this.focusSessionState = FocusSessionState.RiveFocused;
2721
2723
  }
2722
2724
  };
2723
- this.onCanvasBlur = function (_event) {
2725
+ /**
2726
+ * Marks internal state that the canvas has lost DOM focus. Do not actually clear
2727
+ * Rive focus though if:
2728
+ * 1. DOM focus is still within Rive domain (i.e., semantic overlay)
2729
+ * 2. Document just lost focus (i.e. tab switching)
2730
+ *
2731
+ * When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
2732
+ */
2733
+ this.onCanvasBlur = function (event) {
2724
2734
  _this.focusSessionState = FocusSessionState.NotFocused;
2725
2735
  _this.canvasHasFocus = false;
2736
+ var movedWithinFocusDomain = _this.isInFocusDomain(event.relatedTarget);
2737
+ var documentLostFocus = event.relatedTarget === null && !document.hasFocus();
2738
+ if (movedWithinFocusDomain || documentLostFocus)
2739
+ return;
2740
+ _this.mainSm.clearFocus();
2726
2741
  };
2742
+ /**
2743
+ * Assistive technology (AT) focus landing inside the overlay is DOM focus inside the Rive focus domain, so open a
2744
+ * session even when no Rive node holds focus yet. shouldRiveHandleKeyEvent treats NotFocused
2745
+ * as authoritative, so without this the overlay's Tab keydowns reach onKeyDown and get dropped
2746
+ * at that gate — the browser would move focus out of Rive instead of to the next focus node.
2747
+ */
2727
2748
  this.onOverlayFocusIn = function (event) {
2728
- if (_this.isInOverlay(event.target)) {
2729
- _this.focusDomainReleased = false;
2730
- }
2749
+ if (!_this.isInOverlay(event.target))
2750
+ return;
2751
+ _this.focusDomainReleased = false;
2752
+ if (!_this.hasFocusNodes)
2753
+ return;
2754
+ if (_this.focusSessionState !== FocusSessionState.NotFocused)
2755
+ return;
2756
+ _this.focusSessionState = _this.mainSm.focusState().hasFocus
2757
+ ? FocusSessionState.RiveFocused
2758
+ : FocusSessionState.EntryPending;
2731
2759
  };
2732
- this.onFocusDomainHostFocusIn = function (_event) {
2760
+ /** Overlay listeners attach lazily, so the first focusin only ever lands here. */
2761
+ this.onFocusDomainHostFocusIn = function (event) {
2733
2762
  _this.syncOverlayListener();
2763
+ _this.onOverlayFocusIn(event);
2734
2764
  };
2735
2765
  this.onKeyDown = function (event) {
2736
2766
  _this.syncOverlayListener();
@@ -2743,7 +2773,7 @@ var KeyboardInteractions = /** @class */ (function () {
2743
2773
  var forward = !event.shiftKey;
2744
2774
  var focusMoved = forward ? _this.mainSm.focusNext() : _this.mainSm.focusPrevious();
2745
2775
  if (focusMoved) {
2746
- // A Rive node accepted focus — keep trapping Tab inside the canvas.
2776
+ // A Rive node accepted focus — keep trapping Tab inside Rive.
2747
2777
  _this.focusSessionState = FocusSessionState.RiveFocused;
2748
2778
  event.preventDefault();
2749
2779
  }
@@ -2779,27 +2809,34 @@ var KeyboardInteractions = /** @class */ (function () {
2779
2809
  /**
2780
2810
  * Called by pollFocusState on the Rive instance when it observes hasFocus=true. Rive acquired
2781
2811
  * focus internally (e.g. via a listener action or state transition) without a DOM focus event,
2782
- * so mark the session RiveFocused.
2812
+ * so mark the session RiveFocused. This cannot resurrect a session that a DOM blur ended,
2813
+ * because onCanvasBlur clears Rive's focus alongside it.
2783
2814
  */
2784
2815
  KeyboardInteractions.prototype.notifyRiveFocused = function () {
2785
2816
  this.focusSessionState = FocusSessionState.RiveFocused;
2786
2817
  };
2787
2818
  /**
2788
- * Whether Rive should handle this keydown — i.e. it currently owns keyboard input.
2789
- * True when focus is anywhere in the Rive focus domain (the canvas itself or the
2790
- * accessibility overlay), OR a focus session is active and the key landed on the
2791
- * canvas.
2819
+ * Determine if Rive should handle keyboard input. If session state is `NotFocused` - no.
2820
+ * DOM focus stays parked on the canvas after Rive releases focus internally, and that Tab
2821
+ * has to reach the page rather than re-enter the tree.
2822
+ *
2823
+ * Otherwise, the event still has to belong to Rive:
2824
+ * 1. If the current DOM focus is in Rive domain (canvas or semantic overlay)
2825
+ * 2. If the target for the key input is for the semantic overlay, or the canvas
2792
2826
  */
2793
2827
  KeyboardInteractions.prototype.shouldRiveHandleKeyEvent = function (event) {
2828
+ if (this.focusSessionState === FocusSessionState.NotFocused)
2829
+ return false;
2794
2830
  var inFocusDomain = this.isInFocusDomain(document.activeElement) ||
2795
2831
  this.isInOverlay(event.target);
2796
- if (inFocusDomain)
2797
- return true;
2798
- var sessionActive = this.focusSessionState !== FocusSessionState.NotFocused;
2799
2832
  var eventOnCanvas = event.target === this.canvas;
2800
- return sessionActive && (this.canvasHasFocus || eventOnCanvas);
2833
+ return inFocusDomain || this.canvasHasFocus || eventOnCanvas;
2801
2834
  };
2802
- /** Rive focus domain = the canvas itself OR the accessibility overlay. */
2835
+ /**
2836
+ * The Rive focus domain: the DOM that counts as "inside" Rive for focus purposes — today the
2837
+ * canvas itself OR the accessibility overlay subtree. Anything added later belongs here, so
2838
+ * session bookkeeping and keydown routing pick it up for free.
2839
+ */
2803
2840
  KeyboardInteractions.prototype.isInFocusDomain = function (target) {
2804
2841
  if (target === this.canvas)
2805
2842
  return true;
@@ -5506,8 +5543,9 @@ var Rive = /** @class */ (function () {
5506
5543
  // Rive has an active focus node. Mark the session RiveFocused so Tab stays
5507
5544
  // trapped and a later internal release (hasFocus true → false) is detected.
5508
5545
  this._keyboardInteractions.notifyRiveFocused();
5509
- // Only steal DOM focus on the false→true transition. If hasFocus stays
5510
- // true across frames and the user clicks away, do not re-focus the canvas again.
5546
+ // Only steal DOM focus on the false→true transition. Rive can hold focus across
5547
+ // frames while DOM focus sits elsewhere — a window switch preserves runtime focus
5548
+ // by design — and that must not re-focus the canvas again.
5511
5549
  if (!this._prevHasFocus) {
5512
5550
  // Steal DOM focus to the canvas only when focus isn't already held
5513
5551
  // somewhere inside this instance's focus scope. When the accessibility
@@ -5528,8 +5566,9 @@ var Rive = /** @class */ (function () {
5528
5566
  this._prevHasFocus = false;
5529
5567
  // hasFocus is false — only act when Rive previously held focus and released it internally
5530
5568
  // (state change clears focus). Release the DOM Tab trap so the next Tab moves to the next
5531
- // page element. EntryPending and NotFocused cases are intentional no-ops — EntryPending in
5532
- // particular must stay in its state (a click awaiting its first Tab) rather than be reset here.
5569
+ // page element. A DOM blur reaches here too now that onCanvasBlur clears Rive focus, but it
5570
+ // has already set NotFocused, so this is a no-op. EntryPending and NotFocused are likewise
5571
+ // intentional no-ops — EntryPending must stay put (a click awaiting its first Tab).
5533
5572
  if (this._keyboardInteractions.focusSessionState === _utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.RiveFocused) {
5534
5573
  this._keyboardInteractions.setFocusSessionState(_utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.NotFocused);
5535
5574
  }