@cesdk/engine 1.57.0-rc.0 → 1.57.0-rc.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/index.js CHANGED
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),a=e=>{throw TypeError(e)},l=(e,r,o)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,c=(e,r)=>t(e,"name",{value:r,configurable:!0}),d=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(s,a,l)=>(l=null!=s?e(n(s)):{},((e,n,s,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of o(n))i.call(e,l)||l===s||t(e,l,{get:()=>n[l],enumerable:!(a=r(n,l))||a.enumerable});return e})(!a&&s&&s.__esModule?l:t(l,"default",{value:s,enumerable:!0}),s)),h=t=>[,,,e(t?.[s("metadata")]??null)],p=["class","method","getter","setter","accessor","field","value","get","set"],f=e=>void 0!==e&&"function"!=typeof e?a("Function expected"):e,g=(e,t,r,o,n)=>({kind:p[e],name:t,metadata:o,addInitializer:e=>r._?a("Already initialized"):n.push(f(e||null))}),m=(e,t)=>l(t,s("metadata"),e[3]),b=(e,t,r,o)=>{for(var n=0,i=e[t>>1],s=i&&i.length;n<s;n++)1&t?i[n].call(r):o=i[n].call(r,o);return o},y=(e,o,n,i,s,l)=>{var d,u,h,b,y,v=7&o,w=!!(8&o),C=!!(16&o),x=v>3?e.length+1:v?w?1:2:0,T=p[v+5],P=v>3&&(e[x-1]=[]),A=e[x]||(e[x]=[]),F=v&&(!C&&!w&&(s=s.prototype),v<5&&(v>3||!C)&&r(v<4?s:{get[n](){return _(this,l)},set[n](e){return E(this,l,e)}},n));v?C&&v<4&&c(l,(v>2?"set ":v>1?"get ":"")+n):c(s,n);for(var M=i.length-1;M>=0;M--)b=g(v,n,h={},e[3],A),v&&(b.static=w,b.private=C,y=b.access={has:C?e=>k(s,e):e=>n in e},3^v&&(y.get=C?e=>(1^v?_:S)(e,s,4^v?l:F.get):e=>e[n]),v>2&&(y.set=C?(e,t)=>E(e,s,t,4^v?l:F.set):(e,t)=>e[n]=t)),u=(0,i[M])(v?v<4?C?l:F[T]:v>4?void 0:{get:F.get,set:F.set}:s,b),h._=1,4^v||void 0===u?f(u)&&(v>4?P.unshift(u):v?C?l=u:F[T]=u:s=u):"object"!=typeof u||null===u?a("Object expected"):(f(d=u.get)&&(F.get=d),f(d=u.set)&&(F.set=d),f(d=u.init)&&P.unshift(d));return v||m(e,s),F&&t(s,n,F),C?4^v?l:F:s},v=(e,t,r)=>l(e,"symbol"!=typeof t?t+"":t,r),w=(e,t,r)=>t.has(e)||a("Cannot "+r),k=(e,t)=>Object(t)!==t?a('Cannot use the "in" operator on this value'):e.has(t),_=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),C=(e,t,r)=>t.has(e)?a("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),E=(e,t,r,o)=>(w(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),S=(e,t,r)=>(w(e,t,"access private method"),r),x=d({"../../../node_modules/lodash/isObject.js"(e,t){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}}),T=d({"../../../node_modules/lodash/_freeGlobal.js"(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r}}),P=d({"../../../node_modules/lodash/_root.js"(e,t){var r=T(),o="object"==typeof self&&self&&self.Object===Object&&self,n=r||o||Function("return this")();t.exports=n}}),A=d({"../../../node_modules/lodash/now.js"(e,t){var r=P();t.exports=function(){return r.Date.now()}}}),F=d({"../../../node_modules/lodash/_trimmedEndIndex.js"(e,t){var r=/\s/;t.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}}}),M=d({"../../../node_modules/lodash/_baseTrim.js"(e,t){var r=F(),o=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}}}),I=d({"../../../node_modules/lodash/_Symbol.js"(e,t){var r=P().Symbol;t.exports=r}}),L=d({"../../../node_modules/lodash/_getRawTag.js"(e,t){var r=I(),o=Object.prototype,n=o.hasOwnProperty,i=o.toString,s=r?r.toStringTag:void 0;t.exports=function(e){var t=n.call(e,s),r=e[s];try{e[s]=void 0;var o=!0}catch(e){}var a=i.call(e);return o&&(t?e[s]=r:delete e[s]),a}}}),R=d({"../../../node_modules/lodash/_objectToString.js"(e,t){var r=Object.prototype.toString;t.exports=function(e){return r.call(e)}}}),D=d({"../../../node_modules/lodash/_baseGetTag.js"(e,t){var r=I(),o=L(),n=R(),i=r?r.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):n(e)}}}),B=d({"../../../node_modules/lodash/isObjectLike.js"(e,t){t.exports=function(e){return null!=e&&"object"==typeof e}}}),O=d({"../../../node_modules/lodash/isSymbol.js"(e,t){var r=D(),o=B();t.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}}}),j=d({"../../../node_modules/lodash/toNumber.js"(e,t){var r=M(),o=x(),n=O(),i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(n(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var c=s.test(e);return c||a.test(e)?l(e.slice(2),c?2:8):i.test(e)?NaN:+e}}}),$=d({"../../../node_modules/lodash/debounce.js"(e,t){var r=x(),o=A(),n=j(),i=Math.max,s=Math.min;t.exports=function(e,t,a){var l,c,d,u,h,p,f=0,g=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var r=l,o=c;return l=c=void 0,f=t,u=e.apply(o,r)}function v(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-f>=d}function w(){var e=o();if(v(e))return k(e);h=setTimeout(w,function(e){var r=t-(e-p);return m?s(r,d-(e-f)):r}(e))}function k(e){return h=void 0,b&&l?y(e):(l=c=void 0,u)}function _(){var e=o(),r=v(e);if(l=arguments,c=this,p=e,r){if(void 0===h)return function(e){return f=e,h=setTimeout(w,t),g?y(e):u}(p);if(m)return clearTimeout(h),h=setTimeout(w,t),y(p)}return void 0===h&&(h=setTimeout(w,t)),u}return t=n(t)||0,r(a)&&(g=!!a.leading,d=(m="maxWait"in a)?i(n(a.maxWait)||0,t):d,b="trailing"in a?!!a.trailing:b),_.cancel=function(){void 0!==h&&clearTimeout(h),f=0,l=p=c=h=void 0},_.flush=function(){return void 0===h?u:k(o())},_}}}),q=d({"../../../node_modules/lodash/_listCacheClear.js"(e,t){t.exports=function(){this.__data__=[],this.size=0}}}),U=d({"../../../node_modules/lodash/eq.js"(e,t){t.exports=function(e,t){return e===t||e!=e&&t!=t}}}),W=d({"../../../node_modules/lodash/_assocIndexOf.js"(e,t){var r=U();t.exports=function(e,t){for(var o=e.length;o--;)if(r(e[o][0],t))return o;return-1}}}),N=d({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=W(),o=Array.prototype.splice;t.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}}}),H=d({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=W();t.exports=function(e){var t=this.__data__,o=r(t,e);return o<0?void 0:t[o][1]}}}),V=d({"../../../node_modules/lodash/_listCacheHas.js"(e,t){var r=W();t.exports=function(e){return r(this.__data__,e)>-1}}}),z=d({"../../../node_modules/lodash/_listCacheSet.js"(e,t){var r=W();t.exports=function(e,t){var o=this.__data__,n=r(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}}}),G=d({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=q(),o=N(),n=H(),i=V(),s=z();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),X=d({"../../../node_modules/lodash/_stackClear.js"(e,t){var r=G();t.exports=function(){this.__data__=new r,this.size=0}}}),Y=d({"../../../node_modules/lodash/_stackDelete.js"(e,t){t.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}}),K=d({"../../../node_modules/lodash/_stackGet.js"(e,t){t.exports=function(e){return this.__data__.get(e)}}}),Q=d({"../../../node_modules/lodash/_stackHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),Z=d({"../../../node_modules/lodash/isFunction.js"(e,t){var r=D(),o=x();t.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}}}),J=d({"../../../node_modules/lodash/_coreJsData.js"(e,t){var r=P()["__core-js_shared__"];t.exports=r}}),ee=d({"../../../node_modules/lodash/_isMasked.js"(e,t){var r,o=J(),n=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!n&&n in e}}}),te=d({"../../../node_modules/lodash/_toSource.js"(e,t){var r=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}}}),re=d({"../../../node_modules/lodash/_baseIsNative.js"(e,t){var r=Z(),o=ee(),n=x(),i=te(),s=/^\[object .+?Constructor\]$/,a=Function.prototype,l=Object.prototype,c=a.toString,d=l.hasOwnProperty,u=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!n(e)||o(e))&&(r(e)?u:s).test(i(e))}}}),oe=d({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),ne=d({"../../../node_modules/lodash/_getNative.js"(e,t){var r=re(),o=oe();t.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}}}),ie=d({"../../../node_modules/lodash/_Map.js"(e,t){var r=ne()(P(),"Map");t.exports=r}}),se=d({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=ne()(Object,"create");t.exports=r}}),ae=d({"../../../node_modules/lodash/_hashClear.js"(e,t){var r=se();t.exports=function(){this.__data__=r?r(null):{},this.size=0}}}),le=d({"../../../node_modules/lodash/_hashDelete.js"(e,t){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}}),ce=d({"../../../node_modules/lodash/_hashGet.js"(e,t){var r=se(),o=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}}}),de=d({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=se(),o=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}}}),ue=d({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=se();t.exports=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),he=d({"../../../node_modules/lodash/_Hash.js"(e,t){var r=ae(),o=le(),n=ce(),i=de(),s=ue();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),pe=d({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=he(),o=G(),n=ie();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(n||o),string:new r}}}}),fe=d({"../../../node_modules/lodash/_isKeyable.js"(e,t){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}}),ge=d({"../../../node_modules/lodash/_getMapData.js"(e,t){var r=fe();t.exports=function(e,t){var o=e.__data__;return r(t)?o["string"==typeof t?"string":"hash"]:o.map}}}),me=d({"../../../node_modules/lodash/_mapCacheDelete.js"(e,t){var r=ge();t.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}}}),be=d({"../../../node_modules/lodash/_mapCacheGet.js"(e,t){var r=ge();t.exports=function(e){return r(this,e).get(e)}}}),ye=d({"../../../node_modules/lodash/_mapCacheHas.js"(e,t){var r=ge();t.exports=function(e){return r(this,e).has(e)}}}),ve=d({"../../../node_modules/lodash/_mapCacheSet.js"(e,t){var r=ge();t.exports=function(e,t){var o=r(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}}}),we=d({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=pe(),o=me(),n=be(),i=ye(),s=ve();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),ke=d({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=G(),o=ie(),n=we();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var s=i.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new n(s)}return i.set(e,t),this.size=i.size,this}}}),_e=d({"../../../node_modules/lodash/_Stack.js"(e,t){var r=G(),o=X(),n=Y(),i=K(),s=Q(),a=ke();function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=o,l.prototype.delete=n,l.prototype.get=i,l.prototype.has=s,l.prototype.set=a,t.exports=l}}),Ce=d({"../../../node_modules/lodash/_setCacheAdd.js"(e,t){t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}}}),Ee=d({"../../../node_modules/lodash/_setCacheHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),Se=d({"../../../node_modules/lodash/_SetCache.js"(e,t){var r=we(),o=Ce(),n=Ee();function i(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new r;++t<o;)this.add(e[t])}i.prototype.add=i.prototype.push=o,i.prototype.has=n,t.exports=i}}),xe=d({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(e[r],r,e))return!0;return!1}}}),Te=d({"../../../node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),Pe=d({"../../../node_modules/lodash/_equalArrays.js"(e,t){var r=Se(),o=xe(),n=Te();t.exports=function(e,t,i,s,a,l){var c=1&i,d=e.length,u=t.length;if(d!=u&&!(c&&u>d))return!1;var h=l.get(e),p=l.get(t);if(h&&p)return h==t&&p==e;var f=-1,g=!0,m=2&i?new r:void 0;for(l.set(e,t),l.set(t,e);++f<d;){var b=e[f],y=t[f];if(s)var v=c?s(y,b,f,t,e,l):s(b,y,f,e,t,l);if(void 0!==v){if(v)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!n(m,t)&&(b===e||a(b,e,i,s,l)))return m.push(t)}))){g=!1;break}}else if(b!==y&&!a(b,y,i,s,l)){g=!1;break}}return l.delete(e),l.delete(t),g}}}),Ae=d({"../../../node_modules/lodash/_Uint8Array.js"(e,t){var r=P().Uint8Array;t.exports=r}}),Fe=d({"../../../node_modules/lodash/_mapToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,o){r[++t]=[o,e]})),r}}}),Me=d({"../../../node_modules/lodash/_setToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}}}),Ie=d({"../../../node_modules/lodash/_equalByTag.js"(e,t){var r=I(),o=Ae(),n=U(),i=Pe(),s=Fe(),a=Me(),l=r?r.prototype:void 0,c=l?l.valueOf:void 0;t.exports=function(e,t,r,l,d,u,h){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!u(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=s;case"[object Set]":var f=1&l;if(p||(p=a),e.size!=t.size&&!f)return!1;var g=h.get(e);if(g)return g==t;l|=2,h.set(e,t);var m=i(p(e),p(t),l,d,u,h);return h.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}}}),Le=d({"../../../node_modules/lodash/_arrayPush.js"(e,t){t.exports=function(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}}}),Re=d({"../../../node_modules/lodash/isArray.js"(e,t){var r=Array.isArray;t.exports=r}}),De=d({"../../../node_modules/lodash/_baseGetAllKeys.js"(e,t){var r=Le(),o=Re();t.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}}}),Be=d({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,o=null==e?0:e.length,n=0,i=[];++r<o;){var s=e[r];t(s,r,e)&&(i[n++]=s)}return i}}}),Oe=d({"../../../node_modules/lodash/stubArray.js"(e,t){t.exports=function(){return[]}}}),je=d({"../../../node_modules/lodash/_getSymbols.js"(e,t){var r=Be(),o=Oe(),n=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return n.call(e,t)})))}:o;t.exports=s}}),$e=d({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}}}),qe=d({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=D(),o=B();t.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}}}),Ue=d({"../../../node_modules/lodash/isArguments.js"(e,t){var r=qe(),o=B(),n=Object.prototype,i=n.hasOwnProperty,s=n.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};t.exports=a}}),We=d({"../../../node_modules/lodash/stubFalse.js"(e,t){t.exports=function(){return!1}}}),Ne=d({"../../../node_modules/lodash/isBuffer.js"(e,t){var r=P(),o=We(),n="object"==typeof e&&e&&!e.nodeType&&e,i=n&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===n?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}}),He=d({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&r.test(e))&&e>-1&&e%1==0&&e<t}}}),Ve=d({"../../../node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),ze=d({"../../../node_modules/lodash/_baseIsTypedArray.js"(e,t){var r=D(),o=Ve(),n=B(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return n(e)&&o(e.length)&&!!i[r(e)]}}}),Ge=d({"../../../node_modules/lodash/_baseUnary.js"(e,t){t.exports=function(e){return function(t){return e(t)}}}}),Xe=d({"../../../node_modules/lodash/_nodeUtil.js"(e,t){var r=T(),o="object"==typeof e&&e&&!e.nodeType&&e,n=o&&"object"==typeof t&&t&&!t.nodeType&&t,i=n&&n.exports===o&&r.process,s=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();t.exports=s}}),Ye=d({"../../../node_modules/lodash/isTypedArray.js"(e,t){var r=ze(),o=Ge(),n=Xe(),i=n&&n.isTypedArray,s=i?o(i):r;t.exports=s}}),Ke=d({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=$e(),o=Ue(),n=Re(),i=Ne(),s=He(),a=Ye(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=n(e),d=!c&&o(e),u=!c&&!d&&i(e),h=!c&&!d&&!u&&a(e),p=c||d||u||h,f=p?r(e.length,String):[],g=f.length;for(var m in e)!t&&!l.call(e,m)||p&&("length"==m||u&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||f.push(m);return f}}}),Qe=d({"../../../node_modules/lodash/_isPrototype.js"(e,t){var r=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}}}),Ze=d({"../../../node_modules/lodash/_overArg.js"(e,t){t.exports=function(e,t){return function(r){return e(t(r))}}}}),Je=d({"../../../node_modules/lodash/_nativeKeys.js"(e,t){var r=Ze()(Object.keys,Object);t.exports=r}}),et=d({"../../../node_modules/lodash/_baseKeys.js"(e,t){var r=Qe(),o=Je(),n=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return o(e);var t=[];for(var i in Object(e))n.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),tt=d({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=Z(),o=Ve();t.exports=function(e){return null!=e&&o(e.length)&&!r(e)}}}),rt=d({"../../../node_modules/lodash/keys.js"(e,t){var r=Ke(),o=et(),n=tt();t.exports=function(e){return n(e)?r(e):o(e)}}}),ot=d({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=De(),o=je(),n=rt();t.exports=function(e){return r(e,n,o)}}}),nt=d({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=ot(),o=Object.prototype.hasOwnProperty;t.exports=function(e,t,n,i,s,a){var l=1&n,c=r(e),d=c.length;if(d!=r(t).length&&!l)return!1;for(var u=d;u--;){var h=c[u];if(!(l?h in t:o.call(t,h)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var g=!0;a.set(e,t),a.set(t,e);for(var m=l;++u<d;){var b=e[h=c[u]],y=t[h];if(i)var v=l?i(y,b,h,t,e,a):i(b,y,h,e,t,a);if(!(void 0===v?b===y||s(b,y,n,i,a):v)){g=!1;break}m||(m="constructor"==h)}if(g&&!m){var w=e.constructor,k=t.constructor;w==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(g=!1)}return a.delete(e),a.delete(t),g}}}),it=d({"../../../node_modules/lodash/_DataView.js"(e,t){var r=ne()(P(),"DataView");t.exports=r}}),st=d({"../../../node_modules/lodash/_Promise.js"(e,t){var r=ne()(P(),"Promise");t.exports=r}}),at=d({"../../../node_modules/lodash/_Set.js"(e,t){var r=ne()(P(),"Set");t.exports=r}}),lt=d({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=ne()(P(),"WeakMap");t.exports=r}}),ct=d({"../../../node_modules/lodash/_getTag.js"(e,t){var r=it(),o=ie(),n=st(),i=at(),s=lt(),a=D(),l=te(),c="[object Map]",d="[object Promise]",u="[object Set]",h="[object WeakMap]",p="[object DataView]",f=l(r),g=l(o),m=l(n),b=l(i),y=l(s),v=a;(r&&v(new r(new ArrayBuffer(1)))!=p||o&&v(new o)!=c||n&&v(n.resolve())!=d||i&&v(new i)!=u||s&&v(new s)!=h)&&(v=function(e){var t=a(e),r="[object Object]"==t?e.constructor:void 0,o=r?l(r):"";if(o)switch(o){case f:return p;case g:return c;case m:return d;case b:return u;case y:return h}return t}),t.exports=v}}),dt=d({"../../../node_modules/lodash/_baseIsEqualDeep.js"(e,t){var r=_e(),o=Pe(),n=Ie(),i=nt(),s=ct(),a=Re(),l=Ne(),c=Ye(),d="[object Arguments]",u="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;t.exports=function(e,t,f,g,m,b){var y=a(e),v=a(t),w=y?u:s(e),k=v?u:s(t),_=(w=w==d?h:w)==h,C=(k=k==d?h:k)==h,E=w==k;if(E&&l(e)){if(!l(t))return!1;y=!0,_=!1}if(E&&!_)return b||(b=new r),y||c(e)?o(e,t,f,g,m,b):n(e,t,w,f,g,m,b);if(!(1&f)){var S=_&&p.call(e,"__wrapped__"),x=C&&p.call(t,"__wrapped__");if(S||x){var T=S?e.value():e,P=x?t.value():t;return b||(b=new r),m(T,P,f,g,b)}}return!!E&&(b||(b=new r),i(e,t,f,g,m,b))}}}),ut=d({"../../../node_modules/lodash/_baseIsEqual.js"(e,t){var r=dt(),o=B();t.exports=function e(t,n,i,s,a){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,s,e,a))}}}),ht=d({"../../../node_modules/lodash/isEqual.js"(e,t){var r=ut();t.exports=function(e,t){return r(e,t)}}}),pt=d({"../../../node_modules/lodash/throttle.js"(e,t){var r=$(),o=x();t.exports=function(e,t,n){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),r(e,t,{leading:i,maxWait:t,trailing:s})}}}),ft=d({"../../../node_modules/lodash/toFinite.js"(e,t){var r=j(),o=1/0;t.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}}}),gt=d({"../../../node_modules/lodash/toInteger.js"(e,t){var r=ft();t.exports=function(e){var t=r(e),o=t%1;return t==t?o?t-o:t:0}}}),mt=d({"../../../node_modules/lodash/before.js"(e,t){var r=gt();t.exports=function(e,t){var o;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(o=t.apply(this,arguments)),e<=1&&(t=void 0),o}}}}),bt=d({"../../../node_modules/lodash/once.js"(e,t){var r=mt();t.exports=function(e){return r(2,e)}}}),yt=d({"../../../esbuild/polyfill.noop.js"(){}}),vt=d({"../../../_builds/cesdk/wasm32-unknown-emscripten/Release/cesdk.js"(e,t){var r,o=(r="undefined"!=typeof document?document.currentScript?.src:void 0,"undefined"!=typeof __filename&&(r=r||__filename),async function(e={}){var t,o,n,i,s,a,l=e,c=new Promise(((e,r)=>{t=e,o=r})),d="object"==typeof window,u="undefined"!=typeof WorkerGlobalScope,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;l.expectedDataFileDownloads??=0,l.expectedDataFileDownloads++,(()=>{var e="undefined"!=typeof ENVIRONMENT_IS_PTHREAD&&ENVIRONMENT_IS_PTHREAD,t="undefined"!=typeof ENVIRONMENT_IS_WASM_WORKER&&ENVIRONMENT_IS_WASM_WORKER;if(!e&&!t){var r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;!function(e){"object"==typeof window?window.encodeURIComponent(window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/"):"undefined"==typeof process&&"undefined"!=typeof location&&encodeURIComponent(location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/");var t,o,n,i,s="cesdk.data",a=l.locateFile?l.locateFile(s,""):s,c=e.remote_package_size,d=null,u=l.getPreloadedPackage?l.getPreloadedPackage(a,c):null;function h(t){function r(e,t){if(!e)throw t+(new Error).stack}function o(e,t,r){this.start=e,this.end=t,this.audio=r}t.FS_createPath("/","ly.img.cesdk",!0,!0),t.FS_createPath("/ly.img.cesdk","fonts",!0,!0),t.FS_createPath("/ly.img.cesdk","icons",!0,!0),t.FS_createPath("/ly.img.cesdk","icu",!0,!0),t.FS_createPath("/ly.img.cesdk","presets",!0,!0),t.FS_createPath("/ly.img.cesdk","shaders",!0,!0),t.FS_createPath("/ly.img.cesdk/shaders","common",!0,!0),o.prototype={requests:{},open:function(e,r){this.name=r,this.requests[r]=this,t.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var e=this.byteArray.subarray(this.start,this.end);this.finish(e)},finish:function(e){t.FS_createDataFile(this.name,null,e,!0,!0,!0),t.removeRunDependency(`fp ${this.name}`),this.requests[this.name]=null}};for(var n=e.files,i=0;i<n.length;++i)new o(n[i].start,n[i].end,n[i].audio||0).open("GET",n[i].filename);function s(n){r(n,"Loading data file failed."),r(n.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var i=new Uint8Array(n);o.prototype.byteArray=i;for(var s=e.files,a=0;a<s.length;++a)o.prototype.requests[s[a].filename].onload();t.removeRunDependency("datafile_cesdk.data")}t.addRunDependency("datafile_cesdk.data"),t.preloadResults??={},t.preloadResults["cesdk.data"]={fromCache:!1},u?(s(u),u=null):d=s}u||(t=a,o=c,n=e=>{d?(d(e),d=null):u=e},i=function(e){console.error("package error:",e)},r?yt().readFile(t,((e,t)=>{e?i(e):n(t.buffer)})):(l.dataFileDownloads??={},fetch(t).catch((e=>Promise.reject(new Error(`Network Error: ${t}`,{cause:e})))).then((e=>{if(!e.ok)return Promise.reject(new Error(`${e.status}: ${e.url}`));if(!e.body&&e.arrayBuffer)return e.arrayBuffer().then(n);const r=e.body.getReader(),i=()=>r.read().then(u).catch((t=>Promise.reject(new Error(`Unexpected error while handling : ${e.url} ${t}`,{cause:t})))),s=[],a=e.headers,c=Number(a.get("Content-Length")??o);let d=0;const u=({done:e,value:r})=>{if(!e){s.push(r),d+=r.length,l.dataFileDownloads[t]={loaded:d,total:c};let e=0,o=0;for(const t of Object.values(l.dataFileDownloads))e+=t.loaded,o+=t.total;return l.setStatus?.(`Downloading data... (${e}/${o})`),i()}{const e=new Uint8Array(s.map((e=>e.length)).reduce(((e,t)=>e+t),0));let t=0;for(const r of s)e.set(r,t),t+=r.length;n(e.buffer)}};return l.setStatus?.("Downloading data..."),i()})))),l.calledRun?h(l):(l.preRun??=[]).push(h)}({files:[{filename:"/ly.img.cesdk/fonts/imgly_font_inter_semibold.otf",start:0,end:270760},{filename:"/ly.img.cesdk/icons/ErrorAudio.svg",start:270760,end:271410},{filename:"/ly.img.cesdk/icons/ErrorConnection.svg",start:271410,end:272334},{filename:"/ly.img.cesdk/icons/ErrorImage.svg",start:272334,end:273191},{filename:"/ly.img.cesdk/icons/ErrorUnknown.svg",start:273191,end:275199},{filename:"/ly.img.cesdk/icons/ErrorVideo.svg",start:275199,end:275919},{filename:"/ly.img.cesdk/icons/Move.svg",start:275919,end:276859},{filename:"/ly.img.cesdk/icons/RotateIndicator.svg",start:276859,end:277840},{filename:"/ly.img.cesdk/icu/icudt74l.dat",start:277840,end:812944},{filename:"/ly.img.cesdk/presets/.keep",start:812944,end:812944},{filename:"/ly.img.cesdk/shaders/adjustments.sksl",start:812944,end:816833},{filename:"/ly.img.cesdk/shaders/black_and_white_color_mixer.sksl",start:816833,end:823150},{filename:"/ly.img.cesdk/shaders/common/ubq_adjustments.sksl",start:823150,end:827741},{filename:"/ly.img.cesdk/shaders/common/ubq_color_conversions.sksl",start:827741,end:837726},{filename:"/ly.img.cesdk/shaders/common/ubq_constants.sksl",start:837726,end:838216},{filename:"/ly.img.cesdk/shaders/common/ubq_hue_constants.sksl",start:838216,end:841383},{filename:"/ly.img.cesdk/shaders/common/ubq_noise.sksl",start:841383,end:844021},{filename:"/ly.img.cesdk/shaders/cross_cut.sksl",start:844021,end:844968},{filename:"/ly.img.cesdk/shaders/dot_pattern.sksl",start:844968,end:846046},{filename:"/ly.img.cesdk/shaders/duotone_filter.sksl",start:846046,end:847010},{filename:"/ly.img.cesdk/shaders/extrude_blur.sksl",start:847010,end:849127},{filename:"/ly.img.cesdk/shaders/glow.sksl",start:849127,end:850094},{filename:"/ly.img.cesdk/shaders/half_tone.sksl",start:850094,end:850588},{filename:"/ly.img.cesdk/shaders/hsp_selective_adjustments.sksl",start:850588,end:864188},{filename:"/ly.img.cesdk/shaders/linocut.sksl",start:864188,end:864973},{filename:"/ly.img.cesdk/shaders/liquid.sksl",start:864973,end:865455},{filename:"/ly.img.cesdk/shaders/lut_filter.sksl",start:865455,end:868318},{filename:"/ly.img.cesdk/shaders/mask_color.sksl",start:868318,end:868823},{filename:"/ly.img.cesdk/shaders/mirror.sksl",start:868823,end:869277},{filename:"/ly.img.cesdk/shaders/outliner.sksl",start:869277,end:870914},{filename:"/ly.img.cesdk/shaders/pixelize.sksl",start:870914,end:871214},{filename:"/ly.img.cesdk/shaders/placeholder_overlay_lines.sksl",start:871214,end:871902},{filename:"/ly.img.cesdk/shaders/posterize.sksl",start:871902,end:872114},{filename:"/ly.img.cesdk/shaders/radial_pixel.sksl",start:872114,end:872677},{filename:"/ly.img.cesdk/shaders/recolor.sksl",start:872677,end:874878},{filename:"/ly.img.cesdk/shaders/sharpie.sksl",start:874878,end:877183},{filename:"/ly.img.cesdk/shaders/shifter.sksl",start:877183,end:877867},{filename:"/ly.img.cesdk/shaders/tiltshift.sksl",start:877867,end:878449},{filename:"/ly.img.cesdk/shaders/tv_glitch.sksl",start:878449,end:879167},{filename:"/ly.img.cesdk/shaders/vignette.sksl",start:879167,end:879539}],remote_package_size:879539})}})(),"object"==typeof window&&"object"==typeof window.performance?l.performance=performance:"object"==typeof global&&"object"==typeof global.perf_hooks&&"object"==typeof global.perf_hooks.performance?l.performance=global.perf_hooks.performance:l.performance={mark:function(){},measure:function(){}},(i=n||(n={}))[i.PENDING=0]="PENDING",i[i.FINISHED=1]="FINISHED",i[i.ALLOCATED=2]="ALLOCATED",i[i.ERROR=3]="ERROR",(a=s||(s={}))[a.GET=0]="GET",a[a.POST=1]="POST";class FetchProcess{constructor(e,t){this.state=n.PENDING,this.totalBytes=0,this.receivedLength=0,this.handle=e,this.uri=t,this.abortController=new AbortController,this.abortSignal=this.abortController.signal}async readChunks(e){let t=0;const r=[],o=e=>{r.push(e),t+=e.length,this.receivedLength=t};if(null==e);else if("getReader"in e){const t=e.getReader();for(;;){const{done:e,value:r}=await t.read();if(e)break;if(this.abortSignal.aborted)throw await t.cancel(),t.releaseLock(),new Error(this.abortSignal.reason);o(r)}t.releaseLock()}else{const t=()=>e.destroy(new Error(this.abortSignal.reason));this.abortSignal.addEventListener("abort",t,{once:!0});try{await new Promise(((t,r)=>{e.on("data",o),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const n=new Uint8Array(t);let i=0;for(const e of r)n.set(e,i),i+=e.length;return this.finish(n)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===n.PENDING}isError(){return this.state===n.ERROR}isFinished(){return this.state===n.FINISHED}isAllocated(){return this.state===n.ALLOCATED}allocate(){if(this.isAllocated())return this;if(this.isFinished()){const e=this.result.length,t=l._malloc(e);l.HEAPU8.set(this.result,t);const r=Object.assign(Object.assign({},this),{state:n.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:n.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:n.ERROR,error:e});return Object.assign(this,t)}}l.emscripten_ubq_asyncFetchManager=new class AsyncFetchManager{constructor(){this._nextHandle=0,this._nextHeaderHandle=0,this._processes=new Map,this._headers=new Map,this._fetchImpl=null}_fetch(e,t){return this._fetchImpl?this._fetchImpl(e,t):fetch(e,t)}setFetch(e){this._fetchImpl=e}getProcess(e){return this._processes.get(e)}deleteProcess(e){const t=this._processes.get(e);return(null==t?void 0:t.isPending())&&t.abort(),this._processes.delete(e)}clear(){for(const e of this._processes.values())e.isPending()&&e.abort();this._processes.clear(),this._headers.clear()}fetch(e,t,r,o,n,i,s,a,c){const d=l.UTF8ToString(t,r),u=this._nextHandle++,h=new FetchProcess(u,d);return this._processes.set(u,h),d.match(/^file:/)?this._fetchFile(h).catch((e=>{h.fail(e)})):this._fetchRemote(h,e,o,n,i,s,a,c).catch((e=>{h.fail(e)})),h}async _fetchFile(e){if("undefined"!=typeof window)throw new Error("File URLs supported only in Node.JS");const t=yt(),{fileURLToPath:r}=yt(),o=t.createReadStream(r(e.uri));return e.readChunks(o)}async _fetchRemote(e,t,r,o,n,i,a,c){const d=l.UTF8ToString(a,c),u=this.getHeaders(r,o),h=t===s.POST?new Uint8Array(new Uint8Array(l.HEAPU8.buffer,n,i)):void 0,p=await this._fetch(e.uri,{method:s[t],headers:u,body:h,mode:"cors",credentials:d,signal:e.abortSignal});if(p.status>=200&&p.status<=209){let t=0;return p.headers.has("Content-Length")&&(t=+p.headers.get("Content-Length")),e.totalBytes=t,e.readChunks(p.body)}return e.fail(p.statusText)}getHeaders(e,t){const r={};for(let o=0;o<t;o++){const t=l.getValue(e+4*o,"i32"),n=this._headers.get(t);r[n.key]=n.value}return r}createHeader(e,t,r,o){const n=l.UTF8ToString(e,t),i=l.UTF8ToString(r,o),s=this._nextHeaderHandle++;return this._headers.set(s,{key:n,value:i}),s}deleteHeader(e){return this._headers.delete(e)}},l.emscripten_ubq_codec_videoDecoders=new Map,l.emscripten_ubq_codec_audioDecoders=new Map,l.emscripten_ubq_codec_videoEncoders=new Map,l.emscripten_ubq_codec_audioEncoders=new Map,l.emscripten_ubq_codec_videoDecoderNextHandle=1,l.emscripten_ubq_codec_audioDecoderNextHandle=1,l.emscripten_ubq_codec_videoEncoderNextHandle=1,l.emscripten_ubq_codec_audioEncoderNextHandle=1,l.emscripten_ubq_codec_createNativeResult=function(e){const t=l._malloc(8),r=l.HEAPU32.subarray(t/4,t/4+2);if(r[0]=e.handle?e.handle:e.code?e.code:0,e.error){const t=(new TextEncoder).encode(e.error),o=l._malloc(t.length+1),n=l.HEAPU8.subarray(o,o+t.length+1);for(let e=0;e<t.length;e++)n[e]=t[e];n[t.length]=0,r[1]=o}else r[1]=0;return t},l.emscripten_ubq_codec_offscreenCanvas=null,l.emscripten_ubq_codec_offscreenCtx=null,l.emscripten_ubq_codec_toneMapHdrToSdr=function(e){l.emscripten_ubq_codec_offscreenCanvas||(l.emscripten_ubq_codec_offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),l.emscripten_ubq_codec_offscreenCtx=l.emscripten_ubq_codec_offscreenCanvas.getContext("2d"));const t=l.emscripten_ubq_codec_offscreenCanvas;return t.width===e.codedWidth&&t.height===e.codedHeight||(t.width=e.codedWidth,t.height=e.codedHeight),l.emscripten_ubq_codec_offscreenCtx.drawImage(e,0,0),t},l.emscripten_ubq_codec_createVideoDecoder=function(e,t,r){const o=new VideoDecoder({output:n=>{const i=o.textures;let s=!1;if((o.shouldDropFrames||o.decodedFrames<o.requestedFrame||o.decodeQueueSize>=i.length)&&(s=!0),!s){var a=l.ctx;const e=o.decodedFrames%i.length,r=a.getParameter(a.TEXTURE_BINDING_2D);a.bindTexture(a.TEXTURE_2D,i[e]);const s=t?l.emscripten_ubq_codec_toneMapHdrToSdr(n):n;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,s),a.bindTexture(a.TEXTURE_2D,r)}n.close(),o.decodedFrames++,l.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,o.decodedFrames,s,r)},error:e=>{o.unexpectedError=e,console.error(e)}});return o.decodedFrames=0,o.requestedFrame=0,o.shouldDropFrames=!1,o.isHdr=t,o},l.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const o=new AudioDecoder({output:n=>{if(o.flushing)return void n.close();const i=l.HEAPF32.subarray(e/4,e/4+r),s=l.HEAPF32.subarray(t/4,t/4+r),a=1===n.numberOfChannels?0:1;if("f32-planar"===n.format){let e=o.writtenFrames%r;if(e+n.numberOfFrames<=r)n.copyTo(i.subarray(e),{planeIndex:0,frameCount:n.numberOfFrames}),n.copyTo(s.subarray(e),{planeIndex:a,frameCount:n.numberOfFrames});else{const t=r-e;n.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),n.copyTo(s.subarray(e),{planeIndex:a,frameCount:t}),n.copyTo(i,{planeIndex:0,frameOffset:t}),n.copyTo(s,{planeIndex:a,frameOffset:t})}o.writtenFrames+=n.numberOfFrames}else if("s16-planar"===n.format)if(1===n.numberOfChannels){const e=new Int16Array(n.numberOfFrames);n.copyTo(e,{planeIndex:0});for(let t=0;t<n.numberOfFrames;t++){const n=e[t]/32768;let a=o.writtenFrames%r;i[a]=n,s[a]=n,o.writtenFrames++}}else{const e=new Int16Array(n.numberOfFrames),t=new Int16Array(n.numberOfFrames);n.copyTo(e,{planeIndex:0}),n.copyTo(t,{planeIndex:1});for(let a=0;a<n.numberOfFrames;a++){let n=o.writtenFrames%r;i[n]=e[a]/32768,s[n]=t[a]/32768,o.writtenFrames++}}else if("s16"===n.format){const e=new Int16Array(n.numberOfFrames*n.numberOfChannels);if(n.copyTo(e,{planeIndex:0}),1===n.numberOfChannels)for(let t=0;t<n.numberOfFrames;t++){const n=e[t]/32768;let a=o.writtenFrames%r;i[a]=n,s[a]=n,o.writtenFrames++}else for(let t=0;t<n.numberOfFrames;t++){let a=o.writtenFrames%r;i[a]=e[t*n.numberOfChannels+0]/32768,s[a]=e[t*n.numberOfChannels+1]/32768,o.writtenFrames++}}else console.error("Unsupported audio format:",n.format);n.close()},error:e=>{o.unexpectedError=e,console.error(e)}});return o.writtenFrames=0,o},l.emscripten_ubq_settings_forceWebGL1=!1,l.emscripten_ubq_opfs_CHUNK_SIZE=10485760,l.emscripten_ubq_opfs_MAX_CACHE_SIZE_BYTES=209715200,void 0===l.emscripten_ubq_opfs_readTagCounter&&(l.emscripten_ubq_opfs_readTagCounter=0),l.emscripten_ubq_opfs_caches=new Map,l.emscripten_ubq_opfs_createWorker=function(){const e=new Blob(["\n let handle = null; \n\n self.onmessage = async (ev) => {\n if (ev.data.open) {\n if (handle) {\n try {\n console.log('[OPFS Worker] Closing previous access handle');\n handle.close();\n } catch (e) {\n console.warn('[OPFS Worker] Failed to close previous handle', e);\n }\n }\n handle = await ev.data.fileHandle.createSyncAccessHandle({\n mode: 'read-only'\n });\n \n self.postMessage({ready:true});\n return;\n }\n \n if (ev.data.read) {\n const {offset, size, tag} = ev.data.read;\n\n const tmp = new Uint8Array(size);\n const bytes = handle.read(tmp, {at: offset});\n\n self.postMessage({tag, bytes, buf: tmp.buffer}, [tmp.buffer]);\n }\n };\n "],{type:"application/javascript"});return{worker:new Worker(URL.createObjectURL(e),{type:"module"}),readyPromise:null,post:function(e){this.worker.postMessage(e)},get:function(){return this.worker}}},l.emscripten_ubq_opfs_destroyWorker=function(e){if(e)try{e.worker.terminate()}catch(e){console.warn("[OPFS] Failed to terminate worker",e)}},l.emscripten_ubq_opfs_getCache=function(e){let t=l.emscripten_ubq_opfs_caches.get(e);return t||(t={chunkCache:new Map,accessOrder:[],currentSize:0,loadingChunks:new Set,file:null,openPromise:null,fileSize:-1,worker:null,workerOpened:!1,workerOpening:null},l.emscripten_ubq_opfs_caches.set(e,t)),t},l.emscripten_ubq_opfs_ensureFile=async function(e,t){if(t.fileHandle)return t.fileHandle;if(t.openPromise)return t.openPromise;const r=e.replace(/^opfs:\/\//,"");return t.openPromise=(async()=>{const e=await navigator.storage.getDirectory(),o=r.split("/").filter(Boolean);let n=e;for(let e=0;e<o.length-1;e++)n=await n.getDirectoryHandle(o[e]);const i=await n.getFileHandle(o[o.length-1]);t.fileHandle=i;const s=await i.getFile();return t.fileSize=s.size,i})(),t.openPromise},l.emscripten_ubq_opfs_ensureWorker=function(e,t){return t.worker||(t.worker=l.emscripten_ubq_opfs_createWorker()),t.worker},l.emscripten_ubq_opfs_updateAccess=function(e,t){const r=e.accessOrder.indexOf(t);-1!==r&&e.accessOrder.splice(r,1),e.accessOrder.push(t)},l.emscripten_ubq_opfs_cleanCache=function(e){const t=l.emscripten_ubq_opfs_MAX_CACHE_SIZE_BYTES;for(;e.currentSize>t&&e.accessOrder.length>0;){const t=e.accessOrder.shift(),r=e.chunkCache.get(t);r&&(e.currentSize-=r.byteLength,e.chunkCache.delete(t))}},l.emscripten_ubq_opfs_loadChunk=function(e,t,r){if(t.chunkCache.has(r)||t.loadingChunks.has(r))return void l.emscripten_ubq_opfs_updateAccess(t,r);t.loadingChunks.add(r);const o=l.emscripten_ubq_opfs_CHUNK_SIZE,n=r*o,i=n+o;l.emscripten_ubq_opfs_ensureFile(e,t).then((async e=>{const o=(await e.getFile()).slice(n,i),s=await o.arrayBuffer(),a=new Uint8Array(s);t.chunkCache.set(r,a),t.currentSize+=a.byteLength,l.emscripten_ubq_opfs_updateAccess(t,r),l.emscripten_ubq_opfs_cleanCache(t)})).catch((t=>{console.error(`[OPFS] Failed to load chunk ${r} for "${e}":`,t)})).finally((()=>{t.loadingChunks.delete(r)}))},l.emscripten_ubq_opfs_getChunkDataAsync=async function(e,t,r,o,n){if(o<=0)return 0;const i=Q(e),s=4294967296*(r>>>0)+(t>>>0),a=l.emscripten_ubq_opfs_getCache(i),c=l.emscripten_ubq_opfs_ensureWorker(i,a);a.workerOpened||(a.workerOpening||(a.workerOpening=(async()=>{const e=await l.emscripten_ubq_opfs_ensureFile(i,a);c.post({open:!0,fileHandle:e,sab:l.HEAPU8.buffer}),await new Promise((e=>{const t=c.get(),r=o=>{o.data&&o.data.ready&&(t.removeEventListener("message",r),e())};t.addEventListener("message",r)})),a.workerOpened=!0})().finally((()=>{a.workerOpening=null}))),await a.workerOpening);try{return await new Promise(((e,t)=>{void 0===l.emscripten_ubq_opfs_readTagCounter&&(l.emscripten_ubq_opfs_readTagCounter=0);const r=++l.emscripten_ubq_opfs_readTagCounter,i=c.get(),a=s=>{s.data.tag===r&&(i.removeEventListener("message",a),s.data.buf&&l.HEAPU8.set(new Uint8Array(s.data.buf),n),s.data.bytes===o?e(o):t(new Error("short read")))};i.addEventListener("message",a),c.post({read:{offset:s,size:o,ptr:n,tag:r}})}))}catch(e){return console.error("[OPFS] worker read failed:",e),-1}},l.emscripten_ubq_opfs_loadChunkAsync=async function(e,t,r){if(t.chunkCache.has(r))return void l.emscripten_ubq_opfs_updateAccess(t,r);if(t.loadingChunks.has(r))return;t.loadingChunks.add(r);const o=l.emscripten_ubq_opfs_CHUNK_SIZE,n=r*o,i=n+o;try{const o=await l.emscripten_ubq_opfs_ensureFile(e,t),s=(await o.getFile()).slice(n,i),a=await s.arrayBuffer(),c=new Uint8Array(a);t.chunkCache.set(r,c),t.currentSize+=c.byteLength,l.emscripten_ubq_opfs_updateAccess(t,r),l.emscripten_ubq_opfs_cleanCache(t)}catch(t){throw console.error(`[OPFS] Async Failed to load chunk ${r} for "${e}":`,t),t}finally{t.loadingChunks.delete(r)}};var p,f,g={...l},m=[],b="./this.program",y=(e,t)=>{throw t},v="";if(h){var w=yt();yt(),v=__dirname+"/",f=e=>(e=O(e)?new URL(e):e,w.readFileSync(e)),p=async(e,t=!0)=>(e=O(e)?new URL(e):e,w.readFileSync(e,t?void 0:"utf8")),!l.thisProgram&&process.argv.length>1&&(b=process.argv[1].replace(/\\/g,"/")),m=process.argv.slice(2),y=(e,t)=>{throw process.exitCode=e,t}}else(d||u)&&(u?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),r&&(v=r),v=v.startsWith("blob:")?"":v.slice(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1),u&&(f=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=async e=>{var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)});var k=l.print||console.log.bind(console),_=l.printErr||console.error.bind(console);Object.assign(l,g),g=null,l.arguments&&(m=l.arguments),l.thisProgram&&(b=l.thisProgram);var C,E,S,x,T,P,A,F,M,I,L,R,D=l.wasmBinary,B=!1,O=e=>e.startsWith("file://");function j(){var e=C.buffer;l.HEAP8=S=new Int8Array(e),l.HEAP16=T=new Int16Array(e),l.HEAPU8=x=new Uint8Array(e),l.HEAPU16=P=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=F=new Uint32Array(e),l.HEAPF32=M=new Float32Array(e),l.HEAPF64=R=new Float64Array(e),l.HEAP64=I=new BigInt64Array(e),l.HEAPU64=L=new BigUint64Array(e)}if(l.wasmMemory)C=l.wasmMemory;else{var $=l.INITIAL_MEMORY||16777216;C=new WebAssembly.Memory({initial:$/65536,maximum:32768})}j();var q,U=0,W=null;function N(e){U++,l.monitorRunDependencies?.(U)}function H(e){if(U--,l.monitorRunDependencies?.(U),0==U&&W){var t=W;W=null,t()}}function V(e){l.onAbort?.(e),_(e="Aborted("+e+")"),B=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw o(t),t}function z(){return e="cesdk.wasm",l.locateFile?l.locateFile(e,v):v+e;var e}async function G(e){if(!D)try{var t=await p(e);return new Uint8Array(t)}catch{}return function(e){if(e==q&&D)return new Uint8Array(D);if(f)return f(e);throw"both async and sync fetching of the wasm failed"}(e)}async function X(e,t,r){if(!e&&"function"==typeof WebAssembly.instantiateStreaming&&!h)try{var o=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(o,r)}catch(e){_(`wasm streaming compile failed: ${e}`),_("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await G(e);return await WebAssembly.instantiate(r,t)}catch(e){_(`failed to asynchronously prepare wasm: ${e}`),V(e)}}(t,r)}class ExitStatus{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Y="undefined"!=typeof TextDecoder?new TextDecoder:void 0,K=(e,t=0,r=NaN)=>{for(var o=t+r,n=t;e[n]&&!(n>=o);)++n;if(n-t>16&&e.buffer&&Y)return Y.decode(e.subarray(t,n));for(var i="";t<n;){var s=e[t++];if(128&s){var a=63&e[t++];if(192!=(224&s)){var l=63&e[t++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&e[t++])<65536)i+=String.fromCharCode(s);else{var c=s-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&s)<<6|a)}else i+=String.fromCharCode(s)}return i},Q=(e,t)=>e?K(x,e,t):"",Z=e=>{for(;e.length>0;)e.shift()(l)},J=[],ee=e=>J.unshift(e),te=[],re=e=>te.unshift(e),oe=l.noExitRuntime||!0,ne=e=>Zl(e),ie=()=>ec(),se=e=>{for(var t=0,r=0;r<e.length;++r){var o=e.charCodeAt(r);o<=127?t++:o<=2047?t+=2:o>=55296&&o<=57343?(t+=4,++r):t+=3}return t},ae=(e,t,r,o)=>{if(!(o>0))return 0;for(var n=r,i=r+o-1,s=0;s<e.length;++s){var a=e.charCodeAt(s);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),a<=127){if(r>=i)break;t[r++]=a}else if(a<=2047){if(r+1>=i)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=i)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n},le=(e,t,r)=>ae(e,x,t,r),ce=e=>{var t=se(e)+1,r=Nl(t);return r&&le(e,r,t),r},de=[],ue=0;class ExceptionInfo{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){F[this.ptr+4>>2]=e}get_type(){return F[this.ptr+4>>2]}set_destructor(e){F[this.ptr+8>>2]=e}get_destructor(){return F[this.ptr+8>>2]}set_caught(e){e=e?1:0,S[this.ptr+12]=e}get_caught(){return 0!=S[this.ptr+12]}set_rethrown(e){e=e?1:0,S[this.ptr+13]=e}get_rethrown(){return 0!=S[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){F[this.ptr+16>>2]=e}get_adjusted_ptr(){return F[this.ptr+16>>2]}}var he=e=>Ql(e),pe=e=>{var t=ue;if(!t)return he(0),0;var r=new ExceptionInfo(t);r.set_adjusted_ptr(t);var o=r.get_type();if(!o)return he(0),t;for(var n of e){if(0===n||n===o)break;var i=r.ptr+16;if(oc(n,o,i))return he(n),t}return he(o),t},fe={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,o=e.length-1;o>=0;o--){var n=e[o];"."===n?e.splice(o,1):".."===n?(e.splice(o,1),r++):r&&(e.splice(o,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=fe.isAbs(e),r="/"===e.slice(-1);return(e=fe.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=fe.splitPath(e),r=t[0],o=t[1];return r||o?(o&&(o=o.slice(0,-1)),r+o):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>fe.normalize(e.join("/")),join2:(e,t)=>fe.normalize(e+"/"+t)},ge=e=>{(ge=e=>crypto.getRandomValues(e))(e)},me={resolve:(...e)=>{for(var t="",r=!1,o=e.length-1;o>=-1&&!r;o--){var n=o>=0?e[o]:Te.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,r=fe.isAbs(n)}return(r?"/":"")+(t=fe.normalizeArray(t.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=me.resolve(e).slice(1),t=me.resolve(t).slice(1);for(var o=r(e.split("/")),n=r(t.split("/")),i=Math.min(o.length,n.length),s=i,a=0;a<i;a++)if(o[a]!==n[a]){s=a;break}var l=[];for(a=s;a<o.length;a++)l.push("..");return(l=l.concat(n.slice(s))).join("/")}},be=[],ye=(e,t,r)=>{var o=r>0?r:se(e)+1,n=new Array(o),i=ae(e,n,0,n.length);return t&&(n.length=i),n},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,o,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var i=0,s=0;s<o;s++){var a;try{a=e.tty.ops.get_char(e.tty)}catch(e){throw new Te.ErrnoError(29)}if(void 0===a&&0===i)throw new Te.ErrnoError(6);if(null==a)break;i++,t[r+s]=a}return i&&(e.node.atime=Date.now()),i},write(e,t,r,o,n){if(!e.tty||!e.tty.ops.put_char)throw new Te.ErrnoError(60);try{for(var i=0;i<o;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Te.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}},default_tty_ops:{get_char:e=>(()=>{if(!be.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,o=process.stdin.fd;try{r=w.readSync(o,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}r>0&&(e=t.slice(0,r).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;be=ye(e,!0)}return be.shift()})(),put_char(e,t){null===t||10===t?(k(K(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(k(K(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[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]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(_(K(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(_(K(e.output)),e.output=[])}}},we=(e,t)=>Math.ceil(e/t)*t,ke=e=>{e=we(e,65536);var t=Xl(65536,e);return t&&((e,t)=>{x.fill(0,e,e+t)})(t,e),t},_e={ops_table:null,mount:e=>_e.createNode(null,"/",16895,0),createNode(e,t,r,o){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);_e.ops_table||={dir:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,lookup:_e.node_ops.lookup,mknod:_e.node_ops.mknod,rename:_e.node_ops.rename,unlink:_e.node_ops.unlink,rmdir:_e.node_ops.rmdir,readdir:_e.node_ops.readdir,symlink:_e.node_ops.symlink},stream:{llseek:_e.stream_ops.llseek}},file:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:{llseek:_e.stream_ops.llseek,read:_e.stream_ops.read,write:_e.stream_ops.write,mmap:_e.stream_ops.mmap,msync:_e.stream_ops.msync}},link:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,readlink:_e.node_ops.readlink},stream:{}},chrdev:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:Te.chrdev_stream_ops}};var n=Te.createNode(e,t,r,o);return Te.isDir(n.mode)?(n.node_ops=_e.ops_table.dir.node,n.stream_ops=_e.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=_e.ops_table.file.node,n.stream_ops=_e.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=_e.ops_table.link.node,n.stream_ops=_e.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=_e.ops_table.chrdev.node,n.stream_ops=_e.ops_table.chrdev.stream),n.atime=n.mtime=n.ctime=Date.now(),e&&(e.contents[t]=n,e.atime=e.mtime=e.ctime=n.atime),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var o=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(const r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&_e.resizeFileStorage(e,t.size)},lookup(e,t){throw _e.doesNotExistError},mknod:(e,t,r,o)=>_e.createNode(e,t,r,o),rename(e,t,r){var o;try{o=Te.lookupNode(t,r)}catch(e){}if(o){if(Te.isDir(e.mode))for(var n in o.contents)throw new Te.ErrnoError(55);Te.hashRemoveNode(o)}delete e.parent.contents[e.name],t.contents[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var o in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,t,r){var o=_e.createNode(e,t,41471,0);return o.link=r,o},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,o,n){var i=e.node.contents;if(n>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-n,o);if(s>8&&i.subarray)t.set(i.subarray(n,n+s),r);else for(var a=0;a<s;a++)t[r+a]=i[n+a];return s},write(e,t,r,o,n,i){if(t.buffer===S.buffer&&(i=!1),!o)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),t.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=t.subarray(r,r+o),s.usedBytes=o,o;if(0===s.usedBytes&&0===n)return s.contents=t.slice(r,r+o),s.usedBytes=o,o;if(n+o<=s.usedBytes)return s.contents.set(t.subarray(r,r+o),n),o}if(_e.expandFileStorage(s,n+o),s.contents.subarray&&t.subarray)s.contents.set(t.subarray(r,r+o),n);else for(var a=0;a<o;a++)s.contents[n+a]=t[r+a];return s.usedBytes=Math.max(s.usedBytes,n+o),o},llseek(e,t,r){var o=t;if(1===r?o+=e.position:2===r&&Te.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new Te.ErrnoError(28);return o},mmap(e,t,r,o,n){if(!Te.isFile(e.node.mode))throw new Te.ErrnoError(43);var i,s,a=e.node.contents;if(2&n||!a||a.buffer!==S.buffer){if(s=!0,!(i=ke(t)))throw new Te.ErrnoError(48);a&&((r>0||r+t<a.length)&&(a=a.subarray?a.subarray(r,r+t):Array.prototype.slice.call(a,r,r+t)),S.set(a,i))}else s=!1,i=a.byteOffset;return{ptr:i,allocated:s}},msync:(e,t,r,o,n)=>(_e.stream_ops.write(e,t,0,o,r,!1),0)}},Ce=(e,t,r,o,n,i)=>{Te.createDataFile(e,t,r,o,n,i)},Ee=l.preloadPlugins||[],Se=(e,t,r,o,n,i,s,a,l,c)=>{var d=t?me.resolve(fe.join2(e,t)):e;function u(r){function u(r){c?.(),a||Ce(e,t,r,o,n,l),i?.(),H()}((e,t,r,o)=>{void 0!==br&&br.init();var n=!1;return Ee.forEach((i=>{n||i.canHandle(t)&&(i.handle(e,t,r,o),n=!0)})),n})(r,d,u,(()=>{s?.(),H()}))||u(r)}N(),"string"==typeof r?(async e=>{var t=await p(e);return new Uint8Array(t)})(r).then(u,s):u(r)},xe=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return 0!=(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,t,r,o){e||(e=this),this.parent=e,this.mount=e.mount,this.id=Te.nextInode++,this.name=t,this.mode=r,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Te.isDir(this.mode)}get isDevice(){return Te.isChrdev(this.mode)}},lookupPath(e,t={}){if(!e)throw new Te.ErrnoError(44);t.follow_mount??=!0,fe.isAbs(e)||(e=Te.cwd()+"/"+e);e:for(var r=0;r<40;r++){for(var o=e.split("/").filter((e=>!!e)),n=Te.root,i="/",s=0;s<o.length;s++){var a=s===o.length-1;if(a&&t.parent)break;if("."!==o[s])if(".."!==o[s]){i=fe.join2(i,o[s]);try{n=Te.lookupNode(n,o[s])}catch(e){if(44===e?.errno&&a&&t.noent_okay)return{path:i};throw e}if(!Te.isMountpoint(n)||a&&!t.follow_mount||(n=n.mounted.root),Te.isLink(n.mode)&&(!a||t.follow)){if(!n.node_ops.readlink)throw new Te.ErrnoError(52);var l=n.node_ops.readlink(n);fe.isAbs(l)||(l=fe.dirname(i)+"/"+l),e=l+"/"+o.slice(s+1).join("/");continue e}}else i=fe.dirname(i),n=n.parent}return{path:i,node:n}}throw new Te.ErrnoError(32)},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,o=0;o<t.length;o++)r=(r<<5)-r+t.charCodeAt(o)|0;return(e+r>>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r);for(var o=Te.hashName(e.id,t),n=Te.nameTable[o];n;n=n.name_next){var i=n.name;if(n.parent.id===e.id&&i===t)return n}return Te.lookup(e,t)},createNode(e,t,r,o){var n=new Te.FSNode(e,t,r,o);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!Te.isDir(e.mode))return 54;var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){if(!Te.isDir(e.mode))return 54;try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var o;try{o=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(o.mode))return 54;if(Te.isRoot(o)||Te.getPath(o)===Te.cwd())return 10}else if(Te.isDir(o.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||576&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,checkOpExists(e,t){if(!e)throw new Te.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream:(e,t=-1)=>(e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e),closeStream(e){Te.streams[e]=null},dupStream(e,t=-1){var r=Te.createStream(e,t);return r.stream_ops?.dup?.(r),r},doSetAttr(e,t,r){var o=e?.stream_ops.setattr,n=o?e:t;o??=t.node_ops.setattr,Te.checkOpExists(o,63),o(n,r)},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var o=r.pop();t.push(o),r.push(...o.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&_(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),o=0;function n(e){return Te.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,n(e));++o>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var o,n="/"===r,i=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!i){var s=Te.lookupPath(r,{follow_mount:!1});if(r=s.path,o=s.node,Te.isMountpoint(o))throw new Te.ErrnoError(10);if(!Te.isDir(o.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},l=e.mount(a);return l.mount=a,a.root=l,n?Te.root=l:o&&(o.mounted=a,o.mount&&o.mount.mounts.push(a)),l},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,o=r.mounted,n=Te.getMounts(o);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(o);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var o=Te.lookupPath(e,{parent:!0}).node,n=fe.basename(e);if(!n)throw new Te.ErrnoError(28);if("."===n||".."===n)throw new Te.ErrnoError(20);var i=Te.mayCreate(o,n);if(i)throw new Te.ErrnoError(i);if(!o.node_ops.mknod)throw new Te.ErrnoError(63);return o.node_ops.mknod(o,n,t,r)},statfs:e=>Te.statfsNode(Te.lookupPath(e,{follow:!0}).node),statfsStream:e=>Te.statfsNode(e.node),statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Te.nextInode,ffree:Te.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create:(e,t=438)=>(t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t=511)=>(t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){var r=e.split("/"),o="";for(var n of r)if(n){o+="/"+n;try{Te.mkdir(o,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!me.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var o=fe.basename(t),n=Te.mayCreate(r,o);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,o,e)},rename(e,t){var r,o,n=fe.dirname(e),i=fe.dirname(t),s=fe.basename(e),a=fe.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,o=Te.lookupPath(t,{parent:!0}).node,!r||!o)throw new Te.ErrnoError(44);if(r.mount!==o.mount)throw new Te.ErrnoError(75);var l,c=Te.lookupNode(r,s),d=me.relative(e,i);if("."!==d.charAt(0))throw new Te.ErrnoError(28);if("."!==(d=me.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{l=Te.lookupNode(o,a)}catch(e){}if(c!==l){var u=Te.isDir(c.mode),h=Te.mayDelete(r,s,u);if(h)throw new Te.ErrnoError(h);if(h=l?Te.mayDelete(o,a,u):Te.mayCreate(o,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(c)||l&&Te.isMountpoint(l))throw new Te.ErrnoError(10);if(o!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(c);try{r.node_ops.rename(c,o,a),c.parent=o}catch(e){throw e}finally{Te.hashAddNode(c)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=fe.basename(e),o=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(o))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(o)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;return Te.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=fe.basename(e),o=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(o))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(o)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;return Te.checkOpExists(r.node_ops.getattr,63)(r)},fstat(e){var t=Te.getStreamChecked(e),r=t.node,o=t.stream_ops.getattr,n=o?t:r;return o??=r.node_ops.getattr,Te.checkOpExists(o,63),o(n)},lstat:e=>Te.stat(e,!0),doChmod(e,t,r,o){Te.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:o})},chmod(e,t,r){var o;o="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e,Te.doChmod(null,o,t,r)},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.doChmod(r,r.node,t,!1)},doChown(e,t,r){Te.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:r})},chown(e,t,r,o){var n;n="string"==typeof e?Te.lookupPath(e,{follow:!o}).node:e,Te.doChown(null,n,o)},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var o=Te.getStreamChecked(e);Te.doChown(o,o.node,!1)},doTruncate(e,t,r){if(Te.isDir(t.mode))throw new Te.ErrnoError(31);if(!Te.isFile(t.mode))throw new Te.ErrnoError(28);var o=Te.nodePermissions(t,"w");if(o)throw new Te.ErrnoError(o);Te.doSetAttr(e,t,{size:r,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e,Te.doTruncate(null,r,t)},ftruncate(e,t){var r=Te.getStreamChecked(e);if(t<0||0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.doTruncate(r,r.node,t)},utime(e,t,r){var o=Te.lookupPath(e,{follow:!0}).node;Te.checkOpExists(o.node_ops.setattr,63)(o,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Te.ErrnoError(44);var o,n;if(r=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&r|32768:0,"object"==typeof e)o=e;else{n=e.endsWith("/");var i=Te.lookupPath(e,{follow:!(131072&t),noent_okay:!0});o=i.node,e=i.path}var s=!1;if(64&t)if(o){if(128&t)throw new Te.ErrnoError(20)}else{if(n)throw new Te.ErrnoError(31);o=Te.mknod(e,511|r,0),s=!0}if(!o)throw new Te.ErrnoError(44);if(Te.isChrdev(o.mode)&&(t&=-513),65536&t&&!Te.isDir(o.mode))throw new Te.ErrnoError(54);if(!s){var a=Te.mayOpen(o,t);if(a)throw new Te.ErrnoError(a)}512&t&&!s&&Te.truncate(o,0),t&=-131713;var c=Te.createStream({node:o,path:Te.getPath(o),flags:t,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&Te.chmod(o,511&r),!l.logReadFiles||1&t||e in Te.readFiles||(Te.readFiles[e]=1),c},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,o,n){if(o<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var i=void 0!==n;if(i){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var s=e.stream_ops.read(e,t,r,o,n);return i||(e.position+=s),s},write(e,t,r,o,n,i){if(o<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,o,n,i);return s||(e.position+=a),a},mmap(e,t,r,o,n){if(0!=(2&o)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);if(!t)throw new Te.ErrnoError(28);return e.stream_ops.mmap(e,t,r,o,n)},msync:(e,t,r,o,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,o,n):0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,o=Te.open(e,t.flags),n=Te.stat(e).size,i=new Uint8Array(n);return Te.read(o,i,0,n,0),"utf8"===t.encoding?r=K(i):"binary"===t.encoding&&(r=i),Te.close(o),r},writeFile(e,t,r={}){r.flags=r.flags||577;var o=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(se(t)+1),i=ae(t,n,0,n.length);Te.write(o,n,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(o,t,0,t.byteLength,void 0,r.canOwn)}Te.close(o)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,o,n)=>o,llseek:()=>0}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(ge(e),t=e.byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.stream_ops={llseek:_e.stream_ops.llseek},t.node_ops={lookup(e,t){var r=+t,o=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path},id:r+1};return n.parent=n,n},readdir:()=>Array.from(Te.streams.entries()).filter((([e,t])=>t)).map((([e,t])=>e.toString()))},t}},{},"/proc/self/fd")},createStandardStreams(e,t,r){e?Te.createDevice("/dev","stdin",e):Te.symlink("/dev/tty","/dev/stdin"),t?Te.createDevice("/dev","stdout",null,t):Te.symlink("/dev/tty","/dev/stdout"),r?Te.createDevice("/dev","stderr",null,r):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},staticInit(){Te.nameTable=new Array(4096),Te.mount(_e,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:_e}},init(e,t,r){Te.initialized=!0,e??=l.stdin,t??=l.stdout,r??=l.stderr,Te.createStandardStreams(e,t,r)},quit(){for(var e of(Te.initialized=!1,Te.streams))e&&Te.close(e)},findObject(e,t){var r=Te.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(o=Te.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var o=Te.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=o.path,r.parentObject=o.node,r.name=fe.basename(e),o=Te.lookupPath(e,{follow:!t}),r.exists=!0,r.path=o.path,r.object=o.node,r.name=o.node.name,r.isRoot="/"===o.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,o){e="string"==typeof e?e:Te.getPath(e);for(var n=t.split("/").reverse();n.length;){var i=n.pop();if(i){var s=fe.join2(e,i);try{Te.mkdir(s)}catch(e){if(20!=e.errno)throw e}e=s}}return s},createFile(e,t,r,o,n){var i=fe.join2("string"==typeof e?e:Te.getPath(e),t),s=xe(o,n);return Te.create(i,s)},createDataFile(e,t,r,o,n,i){var s=t;e&&(e="string"==typeof e?e:Te.getPath(e),s=t?fe.join2(e,t):e);var a=xe(o,n),l=Te.create(s,a);if(r){if("string"==typeof r){for(var c=new Array(r.length),d=0,u=r.length;d<u;++d)c[d]=r.charCodeAt(d);r=c}Te.chmod(l,146|a);var h=Te.open(l,577);Te.write(h,r,0,r.length,0,i),Te.close(h),Te.chmod(l,a)}},createDevice(e,t,r,o){var n=fe.join2("string"==typeof e?e:Te.getPath(e),t),i=xe(!!r,!!o);Te.createDevice.major??=64;var s=Te.makedev(Te.createDevice.major++,0);return Te.registerDevice(s,{open(e){e.seekable=!1},close(e){o?.buffer?.length&&o(10)},read(e,t,o,n,i){for(var s=0,a=0;a<n;a++){var l;try{l=r()}catch(e){throw new Te.ErrnoError(29)}if(void 0===l&&0===s)throw new Te.ErrnoError(6);if(null==l)break;s++,t[o+a]=l}return s&&(e.node.atime=Date.now()),s},write(e,t,r,n,i){for(var s=0;s<n;s++)try{o(t[r+s])}catch(e){throw new Te.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),s}}),Te.mkdev(n,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=f(e.url),e.usedBytes=e.contents.length}catch(e){throw new Te.ErrnoError(29)}},createLazyFile(e,t,r,o,n){class LazyUint8Array{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;n||(s=o);var a=this;a.setDataGetter((e=>{var t=e*s,n=(e+1)*s-1;if(n=Math.min(n,o-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>o-1)throw new Error("only "+o+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),o!==s&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ye(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!i&&o||(s=o=1,o=this.getter(0).length,s=o,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=o,this._chunkSize=s,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new LazyUint8Array}}else i={isDevice:!1,url:r};var s=Te.createFile(e,t,i,o,n);i.contents?s.contents=i.contents:i.url&&(s.contents=null,s.url=i.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var a={};function l(e,t,r,o,n){var i=e.node.contents;if(n>=i.length)return 0;var s=Math.min(i.length-n,o);if(i.slice)for(var a=0;a<s;a++)t[r+a]=i[n+a];else for(a=0;a<s;a++)t[r+a]=i.get(n+a);return s}return Object.keys(s.stream_ops).forEach((e=>{var t=s.stream_ops[e];a[e]=(...e)=>(Te.forceLoadFile(s),t(...e))})),a.read=(e,t,r,o,n)=>(Te.forceLoadFile(s),l(e,t,r,o,n)),a.mmap=(e,t,r,o,n)=>{Te.forceLoadFile(s);var i=ke(t);if(!i)throw new Te.ErrnoError(48);return l(e,S,i,t,r),{ptr:i,allocated:!0}},s.stream_ops=a,s}},Pe={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(fe.isAbs(t))return t;var o;if(o=-100===e?Te.cwd():Pe.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return o}return o+"/"+t},writeStat(e,t){A[e>>2]=t.dev,A[e+4>>2]=t.mode,F[e+8>>2]=t.nlink,A[e+12>>2]=t.uid,A[e+16>>2]=t.gid,A[e+20>>2]=t.rdev,I[e+24>>3]=BigInt(t.size),A[e+32>>2]=4096,A[e+36>>2]=t.blocks;var r=t.atime.getTime(),o=t.mtime.getTime(),n=t.ctime.getTime();return I[e+40>>3]=BigInt(Math.floor(r/1e3)),F[e+48>>2]=r%1e3*1e3*1e3,I[e+56>>3]=BigInt(Math.floor(o/1e3)),F[e+64>>2]=o%1e3*1e3*1e3,I[e+72>>3]=BigInt(Math.floor(n/1e3)),F[e+80>>2]=n%1e3*1e3*1e3,I[e+88>>3]=BigInt(t.ino),0},writeStatFs(e,t){A[e+4>>2]=t.bsize,A[e+40>>2]=t.bsize,A[e+8>>2]=t.blocks,A[e+12>>2]=t.bfree,A[e+16>>2]=t.bavail,A[e+20>>2]=t.files,A[e+24>>2]=t.ffree,A[e+28>>2]=t.fsid,A[e+44>>2]=t.flags,A[e+36>>2]=t.namelen},doMsync(e,t,r,o,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&o)return 0;var i=x.slice(e,e+r);Te.msync(t,i,n,r,o)},getStreamFromFD:e=>Te.getStreamChecked(e),varargs:void 0,getStr:e=>Q(e)},Ae=()=>{var e=A[+Pe.varargs>>2];return Pe.varargs+=4,e},Fe=Ae,Me={},Ie=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Le(e){return this.fromWireType(F[e>>2])}var Re,De={},Be={},Oe={},je=l.InternalError=class InternalError extends Error{constructor(e){super(e),this.name="InternalError"}},$e=e=>{throw new je(e)},qe=(e,t,r)=>{function o(t){var o=r(t);o.length!==e.length&&$e("Mismatched type converter count");for(var n=0;n<e.length;++n)ze(e[n],o[n])}e.forEach((e=>Oe[e]=t));var n=new Array(t.length),i=[],s=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?n[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{n[t]=Be[e],++s===i.length&&o(n)})))})),0===i.length&&o(n)},Ue={},We=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ne=e=>{for(var t="",r=e;x[r];)t+=Re[x[r++]];return t},He=l.BindingError=class BindingError extends Error{constructor(e){super(e),this.name="BindingError"}},Ve=e=>{throw new He(e)};function ze(e,t,r={}){return function(e,t,r={}){var o=t.name;if(e||Ve(`type "${o}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Ve(`Cannot register type '${o}' twice`)}if(Be[e]=t,delete Oe[e],De.hasOwnProperty(e)){var n=De[e];delete De[e],n.forEach((e=>e()))}}(e,t,r)}var Ge=(e,t,r)=>{switch(t){case 1:return r?e=>S[e]:e=>x[e];case 2:return r?e=>T[e>>1]:e=>P[e>>1];case 4:return r?e=>A[e>>2]:e=>F[e>>2];case 8:return r?e=>I[e>>3]:e=>L[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Xe=8,Ye=e=>{Ve(e.$$.ptrType.registeredClass.name+" instance already deleted")},Ke=!1,Qe=e=>{},Ze=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Je=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var o=Je(e,t,r.baseClass);return null===o?null:r.downcast(o)},et={},tt={},rt=(e,t)=>(t=((e,t)=>{for(void 0===t&&Ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),tt[t]),ot=(e,t)=>(t.ptrType&&t.ptr||$e("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&$e("Both smartPtrType and smartPtr must be specified"),t.count={value:1},it(Object.create(e,{$$:{value:t,writable:!0}})));function nt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=rt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var o=r.clone();return this.destructor(e),o}function n(){return this.isSmartPointer?ot(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ot(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,s=this.registeredClass.getActualType(t),a=et[s];if(!a)return n.call(this);i=this.isConst?a.constPointerType:a.pointerType;var l=Je(t,this.registeredClass,i.registeredClass);return null===l?n.call(this):this.isSmartPointer?ot(i.registeredClass.instancePrototype,{ptrType:i,ptr:l,smartPtrType:this,smartPtr:e}):ot(i.registeredClass.instancePrototype,{ptrType:i,ptr:l})}var it=e=>"undefined"==typeof FinalizationRegistry?(it=e=>e,e):(Ke=new FinalizationRegistry((e=>{Ze(e.$$)})),Qe=e=>Ke.unregister(e),(it=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Ke.register(e,r,e)}return e})(e)),st=[];function at(){}var lt=(e,t)=>Object.defineProperty(t,"name",{value:e}),ct=(e,t,r)=>{if(void 0===e[t].overloadTable){var o=e[t];e[t]=function(...o){return e[t].overloadTable.hasOwnProperty(o.length)||Ve(`Function '${r}' called with an invalid number of arguments (${o.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[o.length].apply(this,o)},e[t].overloadTable=[],e[t].overloadTable[o.argCount]=o}},dt=(e,t,r)=>{l.hasOwnProperty(e)?((void 0===r||void 0!==l[e].overloadTable&&void 0!==l[e].overloadTable[r])&&Ve(`Cannot register public name '${e}' twice`),ct(l,e,e),l[e].overloadTable.hasOwnProperty(r)&&Ve(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),l[e].overloadTable[r]=t):(l[e]=t,l[e].argCount=r)};function ut(e,t,r,o,n,i,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=o,this.baseClass=n,this.getActualType=i,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}var ht=(e,t,r)=>{for(;t!==r;)t.upcast||Ve(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function pt(e,t){if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,r,this.registeredClass)}function ft(e,t){var r;if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var o=t.$$.ptrType.registeredClass;if(r=ht(t.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Ve(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Ot.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:Ve("Unsupporting sharing policy")}return r}function gt(e,t){if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,r,this.registeredClass)}function mt(e,t,r,o,n,i,s,a,l,c,d){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=o,this.isSmartPointer=n,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=d,n||void 0!==t.baseClass?this.toWireType=ft:o?(this.toWireType=pt,this.destructorFunction=null):(this.toWireType=gt,this.destructorFunction=null)}var bt,vt,wt,kt,_t=(e,t,r)=>{l.hasOwnProperty(e)||$e("Replacing nonexistent public symbol"),void 0!==l[e].overloadTable&&void 0!==r?l[e].overloadTable[r]=t:(l[e]=t,l[e].argCount=r)},Ct=[],Et=e=>{var t=Ct[e];return t||(Ct[e]=t=bt.get(e)),t},St=(e,t)=>{e=Ne(e);var r=Et(t);return"function"!=typeof r&&Ve(`unknown function pointer with signature ${e}: ${t}`),r},xt=l.UnboundTypeError=(vt=Error,(kt=lt(wt="UnboundTypeError",(function(e){this.name=wt,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(vt.prototype),kt.prototype.constructor=kt,kt.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},kt),Tt=e=>{var t=Wl(e),r=Ne(t);return Vl(t),r},Pt=(e,t)=>{var r=[],o={};throw t.forEach((function e(t){o[t]||Be[t]||(Oe[t]?Oe[t].forEach(e):(r.push(t),o[t]=!0))})),new xt(`${e}: `+r.map(Tt).join([", "]))},At=(e,t)=>{for(var r=[],o=0;o<e;o++)r.push(F[t+4*o>>2]);return r};function Ft(e,t,r,o,n,i){var s=t.length;s<2&&Ve("argTypes array size mismatch! Must at least get return value and 'this' types!");var a=null!==t[1]&&null!==r,l=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}(t),c="void"!==t[0].name,d=s-2,u=new Array(d),h=[],p=[];return lt(e,(function(...e){var r;p.length=0,h.length=a?2:1,h[0]=n,a&&(r=t[1].toWireType(p,this),h[1]=r);for(var i=0;i<d;++i)u[i]=t[i+2].toWireType(p,e[i]),h.push(u[i]);return function(e){if(l)Ie(p);else for(var o=a?1:2;o<t.length;o++){var n=1===o?r:u[o-2];null!==t[o].destructorFunction&&t[o].destructorFunction(n)}if(c)return t[0].fromWireType(e)}(o(...h))}))}var Mt,It=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},Lt=[],Rt=[],Dt=e=>{e>9&&0==--Rt[e+1]&&(Rt[e]=void 0,Lt.push(e))},Bt=()=>Rt.length/2-5-Lt.length,Ot={toValue:e=>(e||Ve("Cannot use deleted val. handle = "+e),Rt[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=Lt.pop()||Rt.length;return Rt[t]=e,Rt[t+1]=1,t}}}},jt={name:"emscripten::val",fromWireType:e=>{var t=Ot.toValue(e);return Dt(e),t},toWireType:(e,t)=>Ot.toHandle(t),argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:null},$t=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(S[e])}:function(e){return this.fromWireType(x[e])};case 2:return r?function(e){return this.fromWireType(T[e>>1])}:function(e){return this.fromWireType(P[e>>1])};case 4:return r?function(e){return this.fromWireType(A[e>>2])}:function(e){return this.fromWireType(F[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},qt=(e,t)=>{var r=Be[e];return void 0===r&&Ve(`${t} has unknown type ${Tt(e)}`),r},Ut=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(M[e>>2])};case 8:return function(e){return this.fromWireType(R[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Wt=Object.assign({optional:!0},jt),Nt="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Ht=(e,t)=>{for(var r=e,o=r>>1,n=o+t/2;!(o>=n)&&P[o];)++o;if((r=o<<1)-e>32&&Nt)return Nt.decode(x.subarray(e,r));for(var i="",s=0;!(s>=t/2);++s){var a=T[e+2*s>>1];if(0==a)break;i+=String.fromCharCode(a)}return i},Vt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var o=t,n=(r-=2)<2*e.length?r/2:e.length,i=0;i<n;++i){var s=e.charCodeAt(i);T[t>>1]=s,t+=2}return T[t>>1]=0,t-o},zt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,o="";!(r>=t/4);){var n=A[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var i=n-65536;o+=String.fromCharCode(55296|i>>10,56320|1023&i)}else o+=String.fromCharCode(n)}return o},Xt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var o=t,n=o+r-4,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),A[t>>2]=s,(t+=4)+4>n)break}return A[t>>2]=0,t-o},Yt=e=>{for(var t=0,r=0;r<e.length;++r){var o=e.charCodeAt(r);o>=55296&&o<=57343&&++r,t+=4}return t},Kt=0,Qt=(e,t,r)=>{var o=[],n=e.toWireType(o,r);return o.length&&(F[t>>2]=Ot.toHandle(o)),n},Zt=[],Jt={},er=e=>{var t=Jt[e];return void 0===t?Ne(e):t},tr=()=>{if("object"==typeof globalThis)return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==typeof $$$embind_global$$$&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof global&&e(global)?$$$embind_global$$$=global:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},rr=Reflect.construct,or=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),nr=[0,31,60,91,121,152,182,213,244,274,305,335],ir=[0,31,59,90,120,151,181,212,243,273,304,334],sr=e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?ir:nr)[e.getMonth()]+e.getDate()-1},ar={},lr=e=>{if(e instanceof ExitStatus||"unwind"==e)return E;y(1,e)},cr=()=>oe||Kt>0,dr=e=>{E=e,cr()||(l.onExit?.(e),B=!0),y(e,new ExitStatus(e))},ur=(e,t)=>{E=e,dr(e)},hr=ur,pr=e=>{if(!B)try{e(),(()=>{if(!cr())try{hr(E)}catch(e){lr(e)}})()}catch(e){lr(e)}},fr=()=>performance.now(),gr=()=>Date.now(),mr=(e,t)=>setTimeout((()=>{pr(e)}),t),br={useWebGL:!1,isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],workers:[],preloadedImages:{},preloadedAudios:{},getCanvas:()=>l.canvas,init(){if(!br.initted){br.initted=!0;var e={canHandle:function(e){return!l.noImageDecoding&&/\.(jpg|jpeg|png|bmp|webp)$/i.test(e)},handle:function(e,t,r,o){var n=new Blob([e],{type:br.getMimetype(t)});n.size!==e.length&&(n=new Blob([new Uint8Array(e).buffer],{type:br.getMimetype(t)}));var i=URL.createObjectURL(n),s=new Image;s.onload=()=>{var o=document.createElement("canvas");o.width=s.width,o.height=s.height,o.getContext("2d").drawImage(s,0,0),br.preloadedImages[t]=o,URL.revokeObjectURL(i),r?.(e)},s.onerror=e=>{_(`Image ${i} could not be decoded`),o?.()},s.src=i}};Ee.push(e);var t={canHandle:function(e){return!l.noAudioDecoding&&e.slice(-4)in{".ogg":1,".wav":1,".mp3":1}},handle:function(e,t,r,o){var n=!1;function i(o){n||(n=!0,br.preloadedAudios[t]=o,r?.(e))}var s=new Blob([e],{type:br.getMimetype(t)}),a=URL.createObjectURL(s),l=new Audio;l.addEventListener("canplaythrough",(()=>i(l)),!1),l.onerror=function(r){n||(_(`warning: browser could not fully decode audio ${t}, trying slower base64 approach`),l.src="data:audio/x-"+t.slice(-3)+";base64,"+function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",o=0,n=0,i=0;i<e.length;i++)for(o=o<<8|e[i],n+=8;n>=6;){var s=o>>n-6&63;n-=6,r+=t[s]}return 2==n?(r+=t[(3&o)<<4],r+="=="):4==n&&(r+=t[(15&o)<<2],r+="="),r}(e),i(l))},l.src=a,mr((()=>{i(l)}),1e4)}};Ee.push(t);var r=br.getCanvas();r&&(r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||(()=>{}),r.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||(()=>{}),r.exitPointerLock=r.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",o,!1),document.addEventListener("mozpointerlockchange",o,!1),document.addEventListener("webkitpointerlockchange",o,!1),document.addEventListener("mspointerlockchange",o,!1),l.elementPointerLock&&r.addEventListener("click",(e=>{!br.pointerLock&&br.getCanvas().requestPointerLock&&(br.getCanvas().requestPointerLock(),e.preventDefault())}),!1))}function o(){var e=br.getCanvas();br.pointerLock=document.pointerLockElement===e||document.mozPointerLockElement===e||document.webkitPointerLockElement===e||document.msPointerLockElement===e}},createContext(e,t,r,o){if(t&&l.ctx&&e==br.getCanvas())return l.ctx;var n,i;if(t){var s={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(o)for(var a in o)s[a]=o[a];void 0!==vr&&(i=vr.createContext(e,s))&&(n=vr.getContext(i).GLctx)}else n=e.getContext("2d");return n?(r&&(l.ctx=n,t&&vr.makeContextCurrent(i),br.useWebGL=t,br.moduleContextCreatedCallbacks.forEach((e=>e())),br.init()),n):null},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,t){br.lockPointer=e,br.resizeCanvas=t,void 0===br.lockPointer&&(br.lockPointer=!0),void 0===br.resizeCanvas&&(br.resizeCanvas=!1);var r=br.getCanvas();function o(){br.isFullscreen=!1;var e=r.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e?(r.exitFullscreen=br.exitFullscreen,br.lockPointer&&r.requestPointerLock(),br.isFullscreen=!0,br.resizeCanvas?br.setFullscreenCanvasSize():br.updateCanvasDimensions(r)):(e.parentNode.insertBefore(r,e),e.parentNode.removeChild(e),br.resizeCanvas?br.setWindowedCanvasSize():br.updateCanvasDimensions(r)),l.onFullScreen?.(br.isFullscreen),l.onFullscreen?.(br.isFullscreen)}br.fullscreenHandlersInstalled||(br.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",o,!1),document.addEventListener("mozfullscreenchange",o,!1),document.addEventListener("webkitfullscreenchange",o,!1),document.addEventListener("MSFullscreenChange",o,!1));var n=document.createElement("div");r.parentNode.insertBefore(n,r),n.appendChild(r),n.requestFullscreen=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||(n.webkitRequestFullscreen?()=>n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(n.webkitRequestFullScreen?()=>n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),n.requestFullscreen()},exitFullscreen:()=>!!br.isFullscreen&&((document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||(()=>{})).apply(document,[]),!0),safeSetTimeout:(e,t)=>mr(e,t),getMimetype:e=>({jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.slice(e.lastIndexOf(".")+1)]),getUserMedia(e){window.getUserMedia||=navigator.getUserMedia||navigator.mozGetUserMedia,window.getUserMedia(e)},getMovementX:e=>e.movementX||e.mozMovementX||e.webkitMovementX||0,getMovementY:e=>e.movementY||e.mozMovementY||e.webkitMovementY||0,getMouseWheelDelta(e){var t=0;switch(e.type){case"DOMMouseScroll":t=e.detail/3;break;case"mousewheel":t=e.wheelDelta/120;break;case"wheel":switch(t=e.deltaY,e.deltaMode){case 0:t/=100;break;case 1:t/=3;break;case 2:t*=80;break;default:throw"unrecognized mouse wheel delta mode: "+e.deltaMode}break;default:throw"unrecognized mouse wheel event: "+e.type}return t},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(e,t){var r=br.getCanvas(),o=r.getBoundingClientRect(),n=void 0!==window.scrollX?window.scrollX:window.pageXOffset,i=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(n+o.left),a=t-(i+o.top);return{x:s*=r.width/o.width,y:a*=r.height/o.height}},setMouseCoords(e,t){const{x:r,y:o}=br.calculateMouseCoords(e,t);br.mouseMovementX=r-br.mouseX,br.mouseMovementY=o-br.mouseY,br.mouseX=r,br.mouseY=o},calculateMouseEvent(e){if(br.pointerLock)"mousemove"!=e.type&&"mozMovementX"in e?br.mouseMovementX=br.mouseMovementY=0:(br.mouseMovementX=br.getMovementX(e),br.mouseMovementY=br.getMovementY(e)),br.mouseX+=br.mouseMovementX,br.mouseY+=br.mouseMovementY;else{if("touchstart"===e.type||"touchend"===e.type||"touchmove"===e.type){var t=e.touch;if(void 0===t)return;var r=br.calculateMouseCoords(t.pageX,t.pageY);if("touchstart"===e.type)br.lastTouches[t.identifier]=r,br.touches[t.identifier]=r;else if("touchend"===e.type||"touchmove"===e.type){var o=br.touches[t.identifier];o||=r,br.lastTouches[t.identifier]=o,br.touches[t.identifier]=r}return}br.setMouseCoords(e.pageX,e.pageY)}},resizeListeners:[],updateResizeListeners(){var e=br.getCanvas();br.resizeListeners.forEach((t=>t(e.width,e.height)))},setCanvasSize(e,t,r){var o=br.getCanvas();br.updateCanvasDimensions(o,e,t),r||br.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if("undefined"!=typeof SDL){var e=F[SDL.screen>>2];e|=8388608,A[SDL.screen>>2]=e}br.updateCanvasDimensions(br.getCanvas()),br.updateResizeListeners()},setWindowedCanvasSize(){if("undefined"!=typeof SDL){var e=F[SDL.screen>>2];e&=-8388609,A[SDL.screen>>2]=e}br.updateCanvasDimensions(br.getCanvas()),br.updateResizeListeners()},updateCanvasDimensions(e,t,r){t&&r?(e.widthNative=t,e.heightNative=r):(t=e.widthNative,r=e.heightNative);var o=t,n=r;if(l.forcedAspectRatio>0&&(o/n<l.forcedAspectRatio?o=Math.round(n*l.forcedAspectRatio):n=Math.round(o/l.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/o,screen.height/n);o=Math.round(o*i),n=Math.round(n*i)}br.resizeCanvas?(e.width!=o&&(e.width=o),e.height!=n&&(e.height=n),void 0!==e.style&&(e.style.removeProperty("width"),e.style.removeProperty("height"))):(e.width!=t&&(e.width=t),e.height!=r&&(e.height=r),void 0!==e.style&&(o!=t||n!=r?(e.style.setProperty("width",o+"px","important"),e.style.setProperty("height",n+"px","important")):(e.style.removeProperty("width"),e.style.removeProperty("height"))))}},yr={errorCode:12288,defaultDisplayInitialized:!1,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1},stringCache:{},setErrorCode(e){yr.errorCode=e},chooseConfig(e,t,r,o,n){if(62e3!=e)return yr.setErrorCode(12296),0;if(t)for(;;){var i=A[t>>2];if(12321==i){var s=A[t+4>>2];yr.contextAttributes.alpha=s>0}else if(12325==i){var a=A[t+4>>2];yr.contextAttributes.depth=a>0}else if(12326==i){var l=A[t+4>>2];yr.contextAttributes.stencil=l>0}else if(12337==i){var c=A[t+4>>2];yr.contextAttributes.antialias=c>0}else if(12338==i)c=A[t+4>>2],yr.contextAttributes.antialias=1==c;else if(12544==i){var d=A[t+4>>2];yr.contextAttributes.lowLatency=12547!=d}else if(12344==i)break;t+=8}return r&&o||n?(n&&(A[n>>2]=1),r&&o>0&&(F[r>>2]=62002),yr.setErrorCode(12288),1):(yr.setErrorCode(12300),0)}},vr={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,unpackRowLength:0,recordError:e=>{vr.lastError||(vr.lastError=e)},getNewId:e=>{for(var t=vr.counter++,r=e.length;r<t;r++)e[r]=null;return t},genObject:(e,t,r,o)=>{for(var n=0;n<e;n++){var i=Mt[r](),s=i&&vr.getNewId(o);i?(i.name=s,o[s]=i):vr.recordError(1282),A[t+4*n>>2]=s}},getSource:(e,t,r,o)=>{for(var n="",i=0;i<t;++i){var s=o?F[o+4*i>>2]:void 0;n+=Q(F[r+4*i>>2],s)}return n},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var o=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==o instanceof WebGLRenderingContext?o:null};e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=t}var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?vr.registerContext(r,t):0},registerContext:(e,t)=>{var r=vr.getNewId(vr.contexts),o={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=o),vr.contexts[r]=o,r},makeContextCurrent:e=>(vr.currentContext=vr.contexts[e],l.ctx=Mt=vr.currentContext?.GLctx,!(e&&!Mt)),getContext:e=>vr.contexts[e],deleteContext:e=>{vr.currentContext===vr.contexts[e]&&(vr.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(vr.contexts[e].GLctx.canvas),vr.contexts[e]?.GLctx.canvas&&(vr.contexts[e].GLctx.canvas.GLctxObject=void 0),vr.contexts[e]=null}},wr=[],kr=(e,t,r)=>{var o=((e,t)=>{var r;for(wr.length=0;r=x[e++];){var o=105!=r;t+=(o&=112!=r)&&t%8?4:0,wr.push(112==r?F[t>>2]:106==r?I[t>>3]:105==r?A[t>>2]:R[t>>3]),t+=o?8:4}return wr})(t,r);return $l[e](...o)},_r=e=>Mt.activeTexture(e),Cr=(e,t)=>{Mt.attachShader(vr.programs[e],vr.shaders[t])},Er=(e,t)=>{Mt.beginQuery(e,vr.queries[t])},Sr=(e,t)=>{Mt.disjointTimerQueryExt.beginQueryEXT(e,vr.queries[t])},xr=e=>Mt.beginTransformFeedback(e),Tr=(e,t,r)=>{Mt.bindAttribLocation(vr.programs[e],t,Q(r))},Pr=(e,t)=>{35051==e?Mt.currentPixelPackBufferBinding=t:35052==e&&(Mt.currentPixelUnpackBufferBinding=t),Mt.bindBuffer(e,vr.buffers[t])},Ar=(e,t,r)=>{Mt.bindBufferBase(e,t,vr.buffers[r])},Fr=(e,t,r,o,n)=>{Mt.bindBufferRange(e,t,vr.buffers[r],o,n)},Mr=(e,t)=>{Mt.bindFramebuffer(e,vr.framebuffers[t])},Ir=(e,t)=>{Mt.bindRenderbuffer(e,vr.renderbuffers[t])},Lr=(e,t)=>{Mt.bindSampler(e,vr.samplers[t])},Rr=(e,t)=>{Mt.bindTexture(e,vr.textures[t])},Dr=(e,t)=>{Mt.bindTransformFeedback(e,vr.transformFeedbacks[t])},Br=e=>{Mt.bindVertexArray(vr.vaos[e])},Or=Br,jr=Br,$r=jr,qr=(e,t,r,o)=>Mt.blendColor(e,t,r,o),Ur=e=>Mt.blendEquation(e),Wr=(e,t)=>Mt.blendEquationSeparate(e,t),Nr=(e,t)=>Mt.blendFunc(e,t),Hr=(e,t,r,o)=>Mt.blendFuncSeparate(e,t,r,o),Vr=(e,t,r,o,n,i,s,a,l,c)=>Mt.blitFramebuffer(e,t,r,o,n,i,s,a,l,c),zr=(e,t,r,o)=>{vr.currentContext.version>=2?r&&t?Mt.bufferData(e,x,o,r,t):Mt.bufferData(e,t,o):Mt.bufferData(e,r?x.subarray(r,r+t):t,o)},Gr=(e,t,r,o)=>{vr.currentContext.version>=2?r&&Mt.bufferSubData(e,t,x,o,r):Mt.bufferSubData(e,t,x.subarray(o,o+r))},Xr=e=>Mt.checkFramebufferStatus(e),Yr=e=>Mt.clear(e),Kr=(e,t,r,o)=>Mt.clearBufferfi(e,t,r,o),Qr=(e,t,r)=>{Mt.clearBufferfv(e,t,M,r>>2)},Zr=(e,t,r)=>{Mt.clearBufferiv(e,t,A,r>>2)},Jr=(e,t,r)=>{Mt.clearBufferuiv(e,t,F,r>>2)},eo=(e,t,r,o)=>Mt.clearColor(e,t,r,o),to=e=>Mt.clearDepth(e),ro=e=>Mt.clearStencil(e),oo=(e,t,r)=>(r=Number(r),Mt.clientWaitSync(vr.syncs[e],t,r)),no=(e,t)=>{Mt.extClipControl.clipControlEXT(e,t)},io=(e,t,r,o)=>{Mt.colorMask(!!e,!!t,!!r,!!o)},so=e=>{Mt.compileShader(vr.shaders[e])},ao=(e,t,r,o,n,i,s,a)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!s?void Mt.compressedTexImage2D(e,t,r,o,n,i,s,a):void Mt.compressedTexImage2D(e,t,r,o,n,i,x,a,s);Mt.compressedTexImage2D(e,t,r,o,n,i,x.subarray(a,a+s))},lo=(e,t,r,o,n,i,s,a,l)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexImage3D(e,t,r,o,n,i,s,a,l):Mt.compressedTexImage3D(e,t,r,o,n,i,s,x,l,a)},co=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!a?void Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,a,l):void Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,x,l,a);Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,x.subarray(l,l+a))},uo=(e,t,r,o,n,i,s,a,l,c,d)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexSubImage3D(e,t,r,o,n,i,s,a,l,c,d):Mt.compressedTexSubImage3D(e,t,r,o,n,i,s,a,l,x,d,c)},ho=(e,t,r,o,n)=>Mt.copyBufferSubData(e,t,r,o,n),po=(e,t,r,o,n,i,s,a)=>Mt.copyTexImage2D(e,t,r,o,n,i,s,a),fo=(e,t,r,o,n,i,s,a)=>Mt.copyTexSubImage2D(e,t,r,o,n,i,s,a),go=(e,t,r,o,n,i,s,a,l)=>Mt.copyTexSubImage3D(e,t,r,o,n,i,s,a,l),mo=()=>{var e=vr.getNewId(vr.programs),t=Mt.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,vr.programs[e]=t,e},bo=e=>{var t=vr.getNewId(vr.shaders);return vr.shaders[t]=Mt.createShader(e),t},yo=e=>Mt.cullFace(e),vo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.buffers[o];n&&(Mt.deleteBuffer(n),n.name=0,vr.buffers[o]=null,o==Mt.currentPixelPackBufferBinding&&(Mt.currentPixelPackBufferBinding=0),o==Mt.currentPixelUnpackBufferBinding&&(Mt.currentPixelUnpackBufferBinding=0))}},wo=(e,t)=>{for(var r=0;r<e;++r){var o=A[t+4*r>>2],n=vr.framebuffers[o];n&&(Mt.deleteFramebuffer(n),n.name=0,vr.framebuffers[o]=null)}},ko=e=>{if(e){var t=vr.programs[e];t?(Mt.deleteProgram(t),t.name=0,vr.programs[e]=null):vr.recordError(1281)}},_o=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.queries[o];n&&(Mt.deleteQuery(n),vr.queries[o]=null)}},Co=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.queries[o];n&&(Mt.disjointTimerQueryExt.deleteQueryEXT(n),vr.queries[o]=null)}},Eo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.renderbuffers[o];n&&(Mt.deleteRenderbuffer(n),n.name=0,vr.renderbuffers[o]=null)}},So=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.samplers[o];n&&(Mt.deleteSampler(n),n.name=0,vr.samplers[o]=null)}},xo=e=>{if(e){var t=vr.shaders[e];t?(Mt.deleteShader(t),vr.shaders[e]=null):vr.recordError(1281)}},To=e=>{if(e){var t=vr.syncs[e];t?(Mt.deleteSync(t),t.name=0,vr.syncs[e]=null):vr.recordError(1281)}},Po=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.textures[o];n&&(Mt.deleteTexture(n),n.name=0,vr.textures[o]=null)}},Ao=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.transformFeedbacks[o];n&&(Mt.deleteTransformFeedback(n),n.name=0,vr.transformFeedbacks[o]=null)}},Fo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2];Mt.deleteVertexArray(vr.vaos[o]),vr.vaos[o]=null}},Mo=Fo,Io=Fo,Lo=Io,Ro=e=>Mt.depthFunc(e),Do=e=>{Mt.depthMask(!!e)},Bo=(e,t)=>Mt.depthRange(e,t),Oo=(e,t)=>{Mt.detachShader(vr.programs[e],vr.shaders[t])},jo=e=>Mt.disable(e),$o=e=>{Mt.disableVertexAttribArray(e)},qo=(e,t,r)=>{Mt.drawArrays(e,t,r)},Uo=(e,t,r,o)=>{Mt.drawArraysInstanced(e,t,r,o)},Wo=Uo,No=Uo,Ho=No,Vo=Uo,zo=Vo,Go=(e,t,r,o,n)=>{Mt.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,o,n)},Xo=Uo,Yo=Xo,Ko=Uo,Qo=Ko,Zo=[],Jo=(e,t)=>{for(var r=Zo[e],o=0;o<e;o++)r[o]=A[t+4*o>>2];Mt.drawBuffers(r)},en=Jo,tn=Jo,rn=tn,on=Jo,nn=on,sn=(e,t,r,o)=>{Mt.drawElements(e,t,r,o)},an=sn,ln=(e,t,r,o,n)=>{Mt.drawElementsInstanced(e,t,r,o,n)},cn=ln,dn=ln,un=dn,hn=ln,pn=hn,fn=(e,t,r,o,n,i,s)=>{Mt.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,o,n,i,s)},gn=ln,mn=gn,bn=ln,yn=bn,vn=(e,t,r,o,n,i)=>{sn(e,o,n,i)},wn=e=>Mt.enable(e),kn=e=>{Mt.enableVertexAttribArray(e)},_n=e=>Mt.endQuery(e),Cn=e=>{Mt.disjointTimerQueryExt.endQueryEXT(e)},En=()=>Mt.endTransformFeedback(),Sn=(e,t)=>{var r=Mt.fenceSync(e,t);if(r){var o=vr.getNewId(vr.syncs);return r.name=o,vr.syncs[o]=r,o}return 0},xn=()=>Mt.finish(),Tn=()=>Mt.flush(),Pn=(e,t,r,o)=>{Mt.framebufferRenderbuffer(e,t,r,vr.renderbuffers[o])},An=(e,t,r,o,n)=>{Mt.framebufferTexture2D(e,t,r,vr.textures[o],n)},Fn=(e,t,r,o,n)=>{Mt.framebufferTextureLayer(e,t,vr.textures[r],o,n)},Mn=e=>Mt.frontFace(e),In=(e,t)=>{vr.genObject(e,t,"createBuffer",vr.buffers)},Ln=(e,t)=>{vr.genObject(e,t,"createFramebuffer",vr.framebuffers)},Rn=(e,t)=>{vr.genObject(e,t,"createQuery",vr.queries)},Dn=(e,t)=>{for(var r=0;r<e;r++){var o=Mt.disjointTimerQueryExt.createQueryEXT();if(!o){for(vr.recordError(1282);r<e;)A[t+4*r++>>2]=0;return}var n=vr.getNewId(vr.queries);o.name=n,vr.queries[n]=o,A[t+4*r>>2]=n}},Bn=(e,t)=>{vr.genObject(e,t,"createRenderbuffer",vr.renderbuffers)},On=(e,t)=>{vr.genObject(e,t,"createSampler",vr.samplers)},jn=(e,t)=>{vr.genObject(e,t,"createTexture",vr.textures)},$n=(e,t)=>{vr.genObject(e,t,"createTransformFeedback",vr.transformFeedbacks)},qn=(e,t)=>{vr.genObject(e,t,"createVertexArray",vr.vaos)},Un=qn,Wn=qn,Nn=Wn,Hn=e=>Mt.generateMipmap(e),Vn=(e,t,r,o,n,i,s,a)=>{t=vr.programs[t];var l=Mt[e](t,r);if(l){var c=a&&le(l.name,a,o);n&&(A[n>>2]=c),i&&(A[i>>2]=l.size),s&&(A[s>>2]=l.type)}},zn=(e,t,r,o,n,i,s)=>Vn("getActiveAttrib",e,t,r,o,n,i,s),Gn=(e,t,r,o,n,i,s)=>Vn("getActiveUniform",e,t,r,o,n,i,s),Xn=(e,t,r,o,n)=>{e=vr.programs[e];var i=Mt.getActiveUniformBlockName(e,t);if(i)if(n&&r>0){var s=le(i,n,r);o&&(A[o>>2]=s)}else o&&(A[o>>2]=0)},Yn=(e,t,r,o)=>{if(o)if(e=vr.programs[e],35393!=r){var n=Mt.getActiveUniformBlockParameter(e,t,r);if(null!==n)if(35395==r)for(var i=0;i<n.length;i++)A[o+4*i>>2]=n[i];else A[o>>2]=n}else{var s=Mt.getActiveUniformBlockName(e,t);A[o>>2]=s.length+1}else vr.recordError(1281)},Kn=(e,t,r,o,n)=>{if(n)if(t>0&&0==r)vr.recordError(1281);else{e=vr.programs[e];for(var i=[],s=0;s<t;s++)i.push(A[r+4*s>>2]);var a=Mt.getActiveUniforms(e,i,o);if(a){var l=a.length;for(s=0;s<l;s++)A[n+4*s>>2]=a[s]}}else vr.recordError(1281)},Qn=(e,t,r,o)=>{var n=Mt.getAttachedShaders(vr.programs[e]),i=n.length;i>t&&(i=t),A[r>>2]=i;for(var s=0;s<i;++s){var a=vr.shaders.indexOf(n[s]);A[o+4*s>>2]=a}},Zn=(e,t)=>Mt.getAttribLocation(vr.programs[e],Q(t)),Jn=(e,t)=>{F[e>>2]=t;var r=F[e>>2];F[e+4>>2]=(t-r)/4294967296},ei=()=>{var e,t=(e=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_conservative_depth","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","NV_shader_noperspective_interpolation","WEBGL_clip_cull_distance","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"],(Mt.getSupportedExtensions()||[]).filter((t=>e.includes(t))));return t=t.concat(t.map((e=>"GL_"+e)))},ti=(e,t,r)=>{if(t){var o=void 0;switch(e){case 36346:o=1;break;case 36344:return void(0!=r&&1!=r&&vr.recordError(1280));case 34814:case 36345:o=0;break;case 34466:var n=Mt.getParameter(34467);o=n?n.length:0;break;case 33309:if(vr.currentContext.version<2)return void vr.recordError(1282);o=ei().length;break;case 33307:case 33308:if(vr.currentContext.version<2)return void vr.recordError(1280);o=33307==e?3:0}if(void 0===o){var i=Mt.getParameter(e);switch(typeof i){case"number":o=i;break;case"boolean":o=i?1:0;break;case"string":return void vr.recordError(1280);case"object":if(null===i)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:o=0;break;default:return void vr.recordError(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(var s=0;s<i.length;++s)switch(r){case 0:A[t+4*s>>2]=i[s];break;case 2:M[t+4*s>>2]=i[s];break;case 4:S[t+s]=i[s]?1:0}return}try{o=0|i.name}catch(t){return vr.recordError(1280),void _(`GL_INVALID_ENUM in glGet${r}v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return vr.recordError(1280),void _(`GL_INVALID_ENUM in glGet${r}v: Native code calling glGet${r}v(${e}) and it returns ${i} of type ${typeof i}!`)}}switch(r){case 1:Jn(t,o);break;case 0:A[t>>2]=o;break;case 2:M[t>>2]=o;break;case 4:S[t]=o?1:0}}else vr.recordError(1281)},ri=(e,t)=>ti(e,t,4),oi=(e,t,r)=>{r?Jn(r,Mt.getBufferParameter(e,t)):vr.recordError(1281)},ni=(e,t,r)=>{r?A[r>>2]=Mt.getBufferParameter(e,t):vr.recordError(1281)},ii=()=>{var e=Mt.getError()||vr.lastError;return vr.lastError=0,e},si=(e,t)=>ti(e,t,2),ai=(e,t)=>Mt.getFragDataLocation(vr.programs[e],Q(t)),li=(e,t,r,o)=>{var n=Mt.getFramebufferAttachmentParameter(e,t,r);(n instanceof WebGLRenderbuffer||n instanceof WebGLTexture)&&(n=0|n.name),A[o>>2]=n},ci=(e,t,r,o)=>{if(r){var n,i=Mt.getIndexedParameter(e,t);switch(typeof i){case"boolean":n=i?1:0;break;case"number":n=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:n=0;break;default:return void vr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void vr.recordError(1280);n=0|i.name}break;default:return void vr.recordError(1280)}switch(o){case 1:Jn(r,n);break;case 0:A[r>>2]=n;break;case 2:M[r>>2]=n;break;case 4:S[r]=n?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+o}}else vr.recordError(1281)},di=(e,t,r)=>ci(e,t,r,1),ui=(e,t)=>{ti(e,t,1)},hi=(e,t,r)=>ci(e,t,r,0),pi=(e,t)=>ti(e,t,0),fi=(e,t,r,o,n)=>{if(o<0)vr.recordError(1281);else if(n){var i=Mt.getInternalformatParameter(e,t,r);if(null!==i)for(var s=0;s<i.length&&s<o;++s)A[n+4*s>>2]=i[s]}else vr.recordError(1281)},gi=(e,t,r,o,n)=>{vr.recordError(1282)},mi=(e,t,r,o)=>{var n=Mt.getProgramInfoLog(vr.programs[e]);null===n&&(n="(unknown error)");var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)},bi=(e,t,r)=>{if(r)if(e>=vr.counter)vr.recordError(1281);else if(e=vr.programs[e],35716==t){var o=Mt.getProgramInfoLog(e);null===o&&(o="(unknown error)"),A[r>>2]=o.length+1}else if(35719==t){if(!e.maxUniformLength)for(var n=Mt.getProgramParameter(e,35718),i=0;i<n;++i)e.maxUniformLength=Math.max(e.maxUniformLength,Mt.getActiveUniform(e,i).name.length+1);A[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength){var s=Mt.getProgramParameter(e,35721);for(i=0;i<s;++i)e.maxAttributeLength=Math.max(e.maxAttributeLength,Mt.getActiveAttrib(e,i).name.length+1)}A[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength){var a=Mt.getProgramParameter(e,35382);for(i=0;i<a;++i)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,Mt.getActiveUniformBlockName(e,i).length+1)}A[r>>2]=e.maxUniformBlockNameLength}else A[r>>2]=Mt.getProgramParameter(e,t);else vr.recordError(1281)},yi=(e,t,r)=>{if(r){var o,n=vr.queries[e];o=vr.currentContext.version<2?Mt.disjointTimerQueryExt.getQueryObjectEXT(n,t):Mt.getQueryParameter(n,t),Jn(r,"boolean"==typeof o?o?1:0:o)}else vr.recordError(1281)},vi=yi,wi=(e,t,r)=>{if(r){var o,n=vr.queries[e],i=Mt.disjointTimerQueryExt.getQueryObjectEXT(n,t);o="boolean"==typeof i?i?1:0:i,A[r>>2]=o}else vr.recordError(1281)},ki=wi,_i=yi,Ci=_i,Ei=(e,t,r)=>{if(r){var o,n=vr.queries[e],i=Mt.getQueryParameter(n,t);o="boolean"==typeof i?i?1:0:i,A[r>>2]=o}else vr.recordError(1281)},Si=wi,xi=Si,Ti=(e,t,r)=>{r?A[r>>2]=Mt.getQuery(e,t):vr.recordError(1281)},Pi=(e,t,r)=>{r?A[r>>2]=Mt.disjointTimerQueryExt.getQueryEXT(e,t):vr.recordError(1281)},Ai=(e,t,r)=>{r?A[r>>2]=Mt.getRenderbufferParameter(e,t):vr.recordError(1281)},Fi=(e,t,r)=>{r?M[r>>2]=Mt.getSamplerParameter(vr.samplers[e],t):vr.recordError(1281)},Mi=(e,t,r)=>{r?A[r>>2]=Mt.getSamplerParameter(vr.samplers[e],t):vr.recordError(1281)},Ii=(e,t,r,o)=>{var n=Mt.getShaderInfoLog(vr.shaders[e]);null===n&&(n="(unknown error)");var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)},Li=(e,t,r,o)=>{var n=Mt.getShaderPrecisionFormat(e,t);A[r>>2]=n.rangeMin,A[r+4>>2]=n.rangeMax,A[o>>2]=n.precision},Ri=(e,t,r,o)=>{var n=Mt.getShaderSource(vr.shaders[e]);if(n){var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)}},Di=(e,t,r)=>{if(r)if(35716==t){var o=Mt.getShaderInfoLog(vr.shaders[e]);null===o&&(o="(unknown error)");var n=o?o.length+1:0;A[r>>2]=n}else if(35720==t){var i=Mt.getShaderSource(vr.shaders[e]),s=i?i.length+1:0;A[r>>2]=s}else A[r>>2]=Mt.getShaderParameter(vr.shaders[e],t);else vr.recordError(1281)},Bi=e=>{var t=vr.stringCache[e];if(!t){switch(e){case 7939:t=ce(ei().join(" "));break;case 7936:case 7937:case 37445:case 37446:var r=Mt.getParameter(e);r||vr.recordError(1280),t=r?ce(r):0;break;case 7938:var o=Mt.getParameter(7938),n=`OpenGL ES 2.0 (${o})`;vr.currentContext.version>=2&&(n=`OpenGL ES 3.0 (${o})`),t=ce(n);break;case 35724:var i=Mt.getParameter(35724),s=i.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==s&&(3==s[1].length&&(s[1]=s[1]+"0"),i=`OpenGL ES GLSL ES ${s[1]} (${i})`),t=ce(i);break;default:vr.recordError(1280)}vr.stringCache[e]=t}return t},Oi=(e,t)=>{if(vr.currentContext.version<2)return vr.recordError(1282),0;var r=vr.stringiCache[e];if(r)return t<0||t>=r.length?(vr.recordError(1281),0):r[t];if(7939===e){var o=ei().map(ce);return r=vr.stringiCache[e]=o,t<0||t>=r.length?(vr.recordError(1281),0):r[t]}return vr.recordError(1280),0},ji=(e,t,r,o,n)=>{if(r<0)vr.recordError(1281);else if(n){var i=Mt.getSyncParameter(vr.syncs[e],t);null!==i&&(A[n>>2]=i,o&&(A[o>>2]=1))}else vr.recordError(1281)},$i=(e,t,r)=>{r?M[r>>2]=Mt.getTexParameter(e,t):vr.recordError(1281)},qi=(e,t,r)=>{r?A[r>>2]=Mt.getTexParameter(e,t):vr.recordError(1281)},Ui=(e,t,r,o,n,i,s)=>{e=vr.programs[e];var a=Mt.getTransformFeedbackVarying(e,t);if(a){if(s&&r>0){var l=le(a.name,s,r);o&&(A[o>>2]=l)}else o&&(A[o>>2]=0);n&&(A[n>>2]=a.size),i&&(A[i>>2]=a.type)}},Wi=(e,t)=>Mt.getUniformBlockIndex(vr.programs[e],Q(t)),Ni=(e,t,r,o)=>{if(o)if(t>0&&(0==r||0==o))vr.recordError(1281);else{e=vr.programs[e];for(var n=[],i=0;i<t;i++)n.push(Q(A[r+4*i>>2]));var s=Mt.getUniformIndices(e,n);if(s){var a=s.length;for(i=0;i<a;i++)A[o+4*i>>2]=s[i]}}else vr.recordError(1281)},Hi=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),Vi=e=>{var t,r,o=e.uniformLocsById,n=e.uniformSizeAndIdsByName;if(!o){e.uniformLocsById=o={},e.uniformArrayNamesById={};var i=Mt.getProgramParameter(e,35718);for(t=0;t<i;++t){var s=Mt.getActiveUniform(e,t),a=s.name,l=s.size,c=Hi(a),d=c>0?a.slice(0,c):a,u=e.uniformIdCounter;for(e.uniformIdCounter+=l,n[d]=[l,u],r=0;r<l;++r)o[u]=r,e.uniformArrayNamesById[u++]=d}}},zi=(e,t)=>{if(t=Q(t),e=vr.programs[e]){Vi(e);var r=e.uniformLocsById,o=0,n=t,i=Hi(t);i>0&&(a=t.slice(i+1),o=parseInt(a)>>>0,n=t.slice(0,i));var s=e.uniformSizeAndIdsByName[n];if(s&&o<s[0]&&(r[o+=s[1]]=r[o]||Mt.getUniformLocation(e,t)))return o}else vr.recordError(1281);var a;return-1},Gi=e=>{var t=Mt.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=Mt.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}vr.recordError(1282)},Xi=(e,t,r,o)=>{if(r){e=vr.programs[e],Vi(e);var n=Mt.getUniform(e,Gi(t));if("number"==typeof n||"boolean"==typeof n)switch(o){case 0:A[r>>2]=n;break;case 2:M[r>>2]=n}else for(var i=0;i<n.length;i++)switch(o){case 0:A[r+4*i>>2]=n[i];break;case 2:M[r+4*i>>2]=n[i]}}else vr.recordError(1281)},Yi=(e,t,r)=>{Xi(e,t,r,2)},Ki=(e,t,r)=>{Xi(e,t,r,0)},Qi=(e,t,r)=>Xi(e,t,r,0),Zi=(e,t,r,o)=>{if(r){var n=Mt.getVertexAttrib(e,t);if(34975==t)A[r>>2]=n&&n.name;else if("number"==typeof n||"boolean"==typeof n)switch(o){case 0:A[r>>2]=n;break;case 2:M[r>>2]=n;break;case 5:A[r>>2]=Math.fround(n)}else for(var i=0;i<n.length;i++)switch(o){case 0:A[r+4*i>>2]=n[i];break;case 2:M[r+4*i>>2]=n[i];break;case 5:A[r+4*i>>2]=Math.fround(n[i])}}else vr.recordError(1281)},Ji=(e,t,r)=>{Zi(e,t,r,0)},es=Ji,ts=Ji,rs=ts,os=(e,t,r)=>{r?A[r>>2]=Mt.getVertexAttribOffset(e,t):vr.recordError(1281)},ns=(e,t,r)=>{Zi(e,t,r,2)},is=(e,t,r)=>{Zi(e,t,r,5)},ss=(e,t)=>Mt.hint(e,t),as=(e,t,r)=>{for(var o=Zo[t],n=0;n<t;n++)o[n]=A[r+4*n>>2];Mt.invalidateFramebuffer(e,o)},ls=(e,t,r,o,n,i,s)=>{for(var a=Zo[t],l=0;l<t;l++)a[l]=A[r+4*l>>2];Mt.invalidateSubFramebuffer(e,a,o,n,i,s)},cs=e=>{var t=vr.buffers[e];return t?Mt.isBuffer(t):0},ds=e=>Mt.isEnabled(e),us=e=>{var t=vr.framebuffers[e];return t?Mt.isFramebuffer(t):0},hs=e=>(e=vr.programs[e])?Mt.isProgram(e):0,ps=e=>{var t=vr.queries[e];return t?Mt.isQuery(t):0},fs=e=>{var t=vr.queries[e];return t?Mt.disjointTimerQueryExt.isQueryEXT(t):0},gs=e=>{var t=vr.renderbuffers[e];return t?Mt.isRenderbuffer(t):0},ms=e=>{var t=vr.samplers[e];return t?Mt.isSampler(t):0},bs=e=>{var t=vr.shaders[e];return t?Mt.isShader(t):0},ys=e=>Mt.isSync(vr.syncs[e]),vs=e=>{var t=vr.textures[e];return t?Mt.isTexture(t):0},ws=e=>Mt.isTransformFeedback(vr.transformFeedbacks[e]),ks=e=>{var t=vr.vaos[e];return t?Mt.isVertexArray(t):0},_s=ks,Cs=ks,Es=Cs,Ss=e=>Mt.lineWidth(e),xs=e=>{e=vr.programs[e],Mt.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},Ts=(e,t,r,o,n,i)=>{Mt.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,A,t>>2,A,r>>2,A,o>>2,F,n>>2,i)},Ps=(e,t,r,o,n,i,s,a)=>{Mt.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,A,t>>2,r,A,o>>2,A,n>>2,A,i>>2,F,s>>2,a)},As=()=>Mt.pauseTransformFeedback(),Fs=(e,t)=>{3317==e?vr.unpackAlignment=t:3314==e&&(vr.unpackRowLength=t),Mt.pixelStorei(e,t)},Ms=(e,t)=>{Mt.webglPolygonMode.polygonModeWEBGL(e,t)},Is=(e,t)=>Mt.polygonOffset(e,t),Ls=(e,t,r)=>{Mt.extPolygonOffsetClamp.polygonOffsetClampEXT(e,t,r)},Rs=(e,t,r,o)=>{vr.recordError(1280)},Ds=(e,t,r)=>{vr.recordError(1280)},Bs=(e,t)=>{Mt.disjointTimerQueryExt.queryCounterEXT(vr.queries[e],t)},Os=e=>Mt.readBuffer(e),js=e=>0==(e-=5120)?S:1==e?x:2==e?T:4==e?A:6==e?M:5==e||28922==e||28520==e||30779==e||30782==e?F:P,$s=(e,t)=>e>>>31-Math.clz32(t.BYTES_PER_ELEMENT),qs=(e,t,r,o,n,i)=>{var s=js(e),a=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*s.BYTES_PER_ELEMENT,l=((e,t,r)=>{var o,n,i=(vr.unpackRowLength||e)*r;return t*(o=i,n=vr.unpackAlignment,o+n-1&-n)})(r,o,a);return s.subarray($s(n,s),$s(n+l,s))},Us=(e,t,r,o,n,i,s)=>{if(vr.currentContext.version>=2){if(Mt.currentPixelPackBufferBinding)return void Mt.readPixels(e,t,r,o,n,i,s);var a=js(i),l=$s(s,a);Mt.readPixels(e,t,r,o,n,i,a,l)}else{var c=qs(i,n,r,o,s);c?Mt.readPixels(e,t,r,o,n,i,c):vr.recordError(1280)}},Ws=()=>{},Ns=(e,t,r,o)=>Mt.renderbufferStorage(e,t,r,o),Hs=(e,t,r,o,n)=>Mt.renderbufferStorageMultisample(e,t,r,o,n),Vs=()=>Mt.resumeTransformFeedback(),zs=(e,t)=>{Mt.sampleCoverage(e,!!t)},Gs=(e,t,r)=>{Mt.samplerParameterf(vr.samplers[e],t,r)},Xs=(e,t,r)=>{var o=M[r>>2];Mt.samplerParameterf(vr.samplers[e],t,o)},Ys=(e,t,r)=>{Mt.samplerParameteri(vr.samplers[e],t,r)},Ks=(e,t,r)=>{var o=A[r>>2];Mt.samplerParameteri(vr.samplers[e],t,o)},Qs=(e,t,r,o)=>Mt.scissor(e,t,r,o),Zs=(e,t,r,o,n)=>{vr.recordError(1280)},Js=(e,t,r,o)=>{var n=vr.getSource(e,t,r,o);if(vr.currentContext.version>=2&&n.includes("#version 100")){var i="";(n=(n=n.replace(/#extension GL_OES_standard_derivatives : enable/g,"")).replace(/#extension GL_EXT_shader_texture_lod : enable/g,"")).includes("gl_FragColor")&&(i+="out mediump vec4 GL_FragColor;\n",n=n.replace(/gl_FragColor/g,"GL_FragColor")),n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.includes("attribute")?(n=n.replace(/attribute/g,"in")).replace(/varying/g,"out"):n.replace(/varying/g,"in")).replace(/textureCubeLodEXT/g,"textureCubeLod")).replace(/texture2DLodEXT/g,"texture2DLod")).replace(/texture2DProjLodEXT/g,"texture2DProjLod")).replace(/texture2DGradEXT/g,"texture2DGrad")).replace(/texture2DProjGradEXT/g,"texture2DProjGrad")).replace(/textureCubeGradEXT/g,"textureCubeGrad")).replace(/textureCube/g,"texture")).replace(/texture1D/g,"texture")).replace(/texture2D/g,"texture")).replace(/texture3D/g,"texture")).replace(/#version 100/g,"#version 300 es\n"+i)}Mt.shaderSource(vr.shaders[e],n)},ea=(e,t,r)=>Mt.stencilFunc(e,t,r),ta=(e,t,r,o)=>Mt.stencilFuncSeparate(e,t,r,o),ra=e=>Mt.stencilMask(e),oa=(e,t)=>Mt.stencilMaskSeparate(e,t),na=(e,t,r)=>Mt.stencilOp(e,t,r),ia=(e,t,r,o)=>Mt.stencilOpSeparate(e,t,r,o),sa=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2&&(6402==s&&6402==r&&5125==a&&(r=33190),36193==a&&(a=5131,6408==s&&6408==r&&(r=34842)),34041==r&&(r=35056),6408==r&&5126==a&&(r=34836)),vr.currentContext.version>=2){if(Mt.currentPixelUnpackBufferBinding)return void Mt.texImage2D(e,t,r,o,n,i,s,a,l);if(l){var c=js(a),d=$s(l,c);return void Mt.texImage2D(e,t,r,o,n,i,s,a,c,d)}}var u=l?qs(a,s,o,n,l):null;Mt.texImage2D(e,t,r,o,n,i,s,a,u)},aa=(e,t,r,o,n,i,s,a,l,c)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texImage3D(e,t,r,o,n,i,s,a,l,c);else if(c){var d=js(l);Mt.texImage3D(e,t,r,o,n,i,s,a,l,d,$s(c,d))}else Mt.texImage3D(e,t,r,o,n,i,s,a,l,null)},la=(e,t,r)=>Mt.texParameterf(e,t,r),ca=(e,t,r)=>{var o=M[r>>2];Mt.texParameterf(e,t,o)},da=(e,t,r)=>Mt.texParameteri(e,t,r),ua=(e,t,r)=>{var o=A[r>>2];Mt.texParameteri(e,t,o)},ha=(e,t,r,o,n)=>Mt.texStorage2D(e,t,r,o,n),pa=(e,t,r,o,n,i)=>Mt.texStorage3D(e,t,r,o,n,i),fa=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2&&36193==a&&(a=5131),vr.currentContext.version>=2){if(Mt.currentPixelUnpackBufferBinding)return void Mt.texSubImage2D(e,t,r,o,n,i,s,a,l);if(l){var c=js(a);return void Mt.texSubImage2D(e,t,r,o,n,i,s,a,c,$s(l,c))}}var d=l?qs(a,s,n,i,l):null;Mt.texSubImage2D(e,t,r,o,n,i,s,a,d)},ga=(e,t,r,o,n,i,s,a,l,c,d)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,d);else if(d){var u=js(c);Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,u,$s(d,u))}else Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,null)},ma=(e,t,r,o)=>{e=vr.programs[e];for(var n=[],i=0;i<t;i++)n.push(Q(A[r+4*i>>2]));Mt.transformFeedbackVaryings(e,n,o)},ba=(e,t)=>{Mt.uniform1f(Gi(e),t)},ya=[],va=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform1fv(Gi(e),M,r>>2,t);else{if(t<=288)for(var o=ya[t],n=0;n<t;++n)o[n]=M[r+4*n>>2];else o=M.subarray(r>>2,r+4*t>>2);Mt.uniform1fv(Gi(e),o)}},wa=(e,t)=>{Mt.uniform1i(Gi(e),t)},ka=[],_a=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform1iv(Gi(e),A,r>>2,t);else{if(t<=288)for(var o=ka[t],n=0;n<t;++n)o[n]=A[r+4*n>>2];else o=A.subarray(r>>2,r+4*t>>2);Mt.uniform1iv(Gi(e),o)}},Ca=(e,t)=>{Mt.uniform1ui(Gi(e),t)},Ea=(e,t,r)=>{t&&Mt.uniform1uiv(Gi(e),F,r>>2,t)},Sa=(e,t,r)=>{Mt.uniform2f(Gi(e),t,r)},xa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform2fv(Gi(e),M,r>>2,2*t);else{if(t<=144)for(var o=ya[t*=2],n=0;n<t;n+=2)o[n]=M[r+4*n>>2],o[n+1]=M[r+(4*n+4)>>2];else o=M.subarray(r>>2,r+8*t>>2);Mt.uniform2fv(Gi(e),o)}},Ta=(e,t,r)=>{Mt.uniform2i(Gi(e),t,r)},Pa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform2iv(Gi(e),A,r>>2,2*t);else{if(t<=144)for(var o=ka[t*=2],n=0;n<t;n+=2)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2];else o=A.subarray(r>>2,r+8*t>>2);Mt.uniform2iv(Gi(e),o)}},Aa=(e,t,r)=>{Mt.uniform2ui(Gi(e),t,r)},Fa=(e,t,r)=>{t&&Mt.uniform2uiv(Gi(e),F,r>>2,2*t)},Ma=(e,t,r,o)=>{Mt.uniform3f(Gi(e),t,r,o)},Ia=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform3fv(Gi(e),M,r>>2,3*t);else{if(t<=96)for(var o=ya[t*=3],n=0;n<t;n+=3)o[n]=M[r+4*n>>2],o[n+1]=M[r+(4*n+4)>>2],o[n+2]=M[r+(4*n+8)>>2];else o=M.subarray(r>>2,r+12*t>>2);Mt.uniform3fv(Gi(e),o)}},La=(e,t,r,o)=>{Mt.uniform3i(Gi(e),t,r,o)},Ra=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform3iv(Gi(e),A,r>>2,3*t);else{if(t<=96)for(var o=ka[t*=3],n=0;n<t;n+=3)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2],o[n+2]=A[r+(4*n+8)>>2];else o=A.subarray(r>>2,r+12*t>>2);Mt.uniform3iv(Gi(e),o)}},Da=(e,t,r,o)=>{Mt.uniform3ui(Gi(e),t,r,o)},Ba=(e,t,r)=>{t&&Mt.uniform3uiv(Gi(e),F,r>>2,3*t)},Oa=(e,t,r,o,n)=>{Mt.uniform4f(Gi(e),t,r,o,n)},ja=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4fv(Gi(e),M,r>>2,4*t);else{if(t<=72){var o=ya[4*t],n=M;r>>=2,t*=4;for(var i=0;i<t;i+=4){var s=r+i;o[i]=n[s],o[i+1]=n[s+1],o[i+2]=n[s+2],o[i+3]=n[s+3]}}else o=M.subarray(r>>2,r+16*t>>2);Mt.uniform4fv(Gi(e),o)}},$a=(e,t,r,o,n)=>{Mt.uniform4i(Gi(e),t,r,o,n)},qa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4iv(Gi(e),A,r>>2,4*t);else{if(t<=72)for(var o=ka[t*=4],n=0;n<t;n+=4)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2],o[n+2]=A[r+(4*n+8)>>2],o[n+3]=A[r+(4*n+12)>>2];else o=A.subarray(r>>2,r+16*t>>2);Mt.uniform4iv(Gi(e),o)}},Ua=(e,t,r,o,n)=>{Mt.uniform4ui(Gi(e),t,r,o,n)},Wa=(e,t,r)=>{t&&Mt.uniform4uiv(Gi(e),F,r>>2,4*t)},Na=(e,t,r)=>{e=vr.programs[e],Mt.uniformBlockBinding(e,t,r)},Ha=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix2fv(Gi(e),!!r,M,o>>2,4*t);else{if(t<=72)for(var n=ya[t*=4],i=0;i<t;i+=4)n[i]=M[o+4*i>>2],n[i+1]=M[o+(4*i+4)>>2],n[i+2]=M[o+(4*i+8)>>2],n[i+3]=M[o+(4*i+12)>>2];else n=M.subarray(o>>2,o+16*t>>2);Mt.uniformMatrix2fv(Gi(e),!!r,n)}},Va=(e,t,r,o)=>{t&&Mt.uniformMatrix2x3fv(Gi(e),!!r,M,o>>2,6*t)},za=(e,t,r,o)=>{t&&Mt.uniformMatrix2x4fv(Gi(e),!!r,M,o>>2,8*t)},Ga=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix3fv(Gi(e),!!r,M,o>>2,9*t);else{if(t<=32)for(var n=ya[t*=9],i=0;i<t;i+=9)n[i]=M[o+4*i>>2],n[i+1]=M[o+(4*i+4)>>2],n[i+2]=M[o+(4*i+8)>>2],n[i+3]=M[o+(4*i+12)>>2],n[i+4]=M[o+(4*i+16)>>2],n[i+5]=M[o+(4*i+20)>>2],n[i+6]=M[o+(4*i+24)>>2],n[i+7]=M[o+(4*i+28)>>2],n[i+8]=M[o+(4*i+32)>>2];else n=M.subarray(o>>2,o+36*t>>2);Mt.uniformMatrix3fv(Gi(e),!!r,n)}},Xa=(e,t,r,o)=>{t&&Mt.uniformMatrix3x2fv(Gi(e),!!r,M,o>>2,6*t)},Ya=(e,t,r,o)=>{t&&Mt.uniformMatrix3x4fv(Gi(e),!!r,M,o>>2,12*t)},Ka=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix4fv(Gi(e),!!r,M,o>>2,16*t);else{if(t<=18){var n=ya[16*t],i=M;o>>=2,t*=16;for(var s=0;s<t;s+=16){var a=o+s;n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5],n[s+6]=i[a+6],n[s+7]=i[a+7],n[s+8]=i[a+8],n[s+9]=i[a+9],n[s+10]=i[a+10],n[s+11]=i[a+11],n[s+12]=i[a+12],n[s+13]=i[a+13],n[s+14]=i[a+14],n[s+15]=i[a+15]}}else n=M.subarray(o>>2,o+64*t>>2);Mt.uniformMatrix4fv(Gi(e),!!r,n)}},Qa=(e,t,r,o)=>{t&&Mt.uniformMatrix4x2fv(Gi(e),!!r,M,o>>2,8*t)},Za=(e,t,r,o)=>{t&&Mt.uniformMatrix4x3fv(Gi(e),!!r,M,o>>2,12*t)},Ja=e=>{e=vr.programs[e],Mt.useProgram(e),Mt.currentProgram=e},el=e=>{Mt.validateProgram(vr.programs[e])},tl=(e,t)=>Mt.vertexAttrib1f(e,t),rl=(e,t)=>{Mt.vertexAttrib1f(e,M[t>>2])},ol=(e,t,r)=>Mt.vertexAttrib2f(e,t,r),nl=(e,t)=>{Mt.vertexAttrib2f(e,M[t>>2],M[t+4>>2])},il=(e,t,r,o)=>Mt.vertexAttrib3f(e,t,r,o),sl=(e,t)=>{Mt.vertexAttrib3f(e,M[t>>2],M[t+4>>2],M[t+8>>2])},al=(e,t,r,o,n)=>Mt.vertexAttrib4f(e,t,r,o,n),ll=(e,t)=>{Mt.vertexAttrib4f(e,M[t>>2],M[t+4>>2],M[t+8>>2],M[t+12>>2])},cl=(e,t)=>{Mt.vertexAttribDivisor(e,t)},dl=cl,ul=cl,hl=cl,pl=cl,fl=cl,gl=(e,t,r,o,n)=>Mt.vertexAttribI4i(e,t,r,o,n),ml=(e,t)=>{Mt.vertexAttribI4i(e,A[t>>2],A[t+4>>2],A[t+8>>2],A[t+12>>2])},bl=(e,t,r,o,n)=>Mt.vertexAttribI4ui(e,t,r,o,n),yl=(e,t)=>{Mt.vertexAttribI4ui(e,F[t>>2],F[t+4>>2],F[t+8>>2],F[t+12>>2])},vl=(e,t,r,o,n)=>{Mt.vertexAttribIPointer(e,t,r,o,n)},wl=(e,t,r,o,n,i)=>{Mt.vertexAttribPointer(e,t,r,!!o,n,i)},kl=(e,t,r,o)=>Mt.viewport(e,t,r,o),_l=(e,t,r)=>{r=Number(r),Mt.waitSync(vr.syncs[e],t,r)},Cl=e=>{var t=(e-C.buffer.byteLength+65535)/65536|0;try{return C.grow(t),j(),1}catch(e){}},El=["default","low-power","high-performance"],Sl=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],xl=e=>{var t;return e=(t=e)>2?Q(t):t,Sl[e]||("undefined"!=typeof document?document.querySelector(e):null)},Tl=(e,t)=>{var r=t>>2,o=A[r+2],n={alpha:!!S[t+0],depth:!!S[t+1],stencil:!!S[t+2],antialias:!!S[t+3],premultipliedAlpha:!!S[t+4],preserveDrawingBuffer:!!S[t+5],powerPreference:El[o],failIfMajorPerformanceCaveat:!!S[t+12],majorVersion:A[r+4],minorVersion:A[r+5],enableExtensionsByDefault:S[t+24],explicitSwapControl:S[t+25],proxyContextToMainThread:A[r+7],renderViaOffscreenBackBuffer:S[t+32]},i=xl(e);return i?n.explicitSwapControl?0:vr.createContext(i,n):0},Pl={},Al=()=>{if(!Al.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:b||"./this.program"};for(var t in Pl)void 0===Pl[t]?delete e[t]:e[t]=Pl[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Al.strings=r}return Al.strings},Fl=(e,t,r,o)=>{for(var n=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Te.read(e,S,s,a,o);if(l<0)return-1;if(n+=l,l<a)break;void 0!==o&&(o+=l)}return n},Ml=e=>Jl(e),Il=e=>{var t=se(e)+1,r=Ml(t);return le(e,r,t),r},Ll=Te.createPath,Rl=Te.createLazyFile,Dl=Te.createDevice;Te.createPreloadedFile=Se,Te.staticInit(),l.FS_createPath=Te.createPath,l.FS_createDataFile=Te.createDataFile,l.FS_createPreloadedFile=Te.createPreloadedFile,l.FS_unlink=Te.unlink,l.FS_createLazyFile=Te.createLazyFile,l.FS_createDevice=Te.createDevice,_e.doesNotExistError=new Te.ErrnoError(44),_e.doesNotExistError.stack="<generic error, no stack>",(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Re=e})(),(()=>{let e=at.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof at))return!1;if(!(e instanceof at))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var o=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;o.baseClass;)n=o.upcast(n),o=o.baseClass;return t===o&&r===n},clone(){if(this.$$.ptr||Ye(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=it(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),Qe(this),Ze(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),st.push(this),st.length,this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(mt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:Xe,readValueFromPointer:Le,fromWireType:nt}),Rt.push(0,1,void 0,1,null,1,!0,1,!1,1),l.count_emval_handles=Bt,l.requestFullscreen=br.requestFullscreen,l.setCanvasSize=br.setCanvasSize,l.getUserMedia=br.getUserMedia,l.createContext=br.createContext;for(let e=0;e<32;++e)Zo.push(new Array(e));for(var Bl=new Float32Array(288),Ol=0;Ol<=288;++Ol)ya[Ol]=Bl.subarray(0,Ol);var jl=new Int32Array(288);for(Ol=0;Ol<=288;++Ol)ka[Ol]=jl.subarray(0,Ol);var $l={2764944:(e,t,r,o,n)=>"undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext)?0:(void 0===window.miniaudio&&(window.miniaudio={referenceCount:0},window.miniaudio.device_type={},window.miniaudio.device_type.playback=e,window.miniaudio.device_type.capture=t,window.miniaudio.device_type.duplex=r,window.miniaudio.device_state={},window.miniaudio.device_state.stopped=o,window.miniaudio.device_state.started=n,miniaudio.devices=[],miniaudio.track_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(null==miniaudio.devices[t])return miniaudio.devices[t]=e,t;return miniaudio.devices.push(e),miniaudio.devices.length-1},miniaudio.untrack_device_by_index=function(e){for(miniaudio.devices[e]=null;miniaudio.devices.length>0&&null==miniaudio.devices[miniaudio.devices.length-1];)miniaudio.devices.pop()},miniaudio.untrack_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(miniaudio.devices[t]==e)return miniaudio.untrack_device_by_index(t)},miniaudio.get_device_by_index=function(e){return miniaudio.devices[e]},miniaudio.unlock_event_types=function(){return["touchstart","touchend","click"]}(),miniaudio.unlock=function(){for(var e=0;e<miniaudio.devices.length;++e){var t=miniaudio.devices[e];null!=t&&null!=t.webaudio&&2===t.state&&t.webaudio.resume()}miniaudio.unlock_event_types.map((function(e){document.removeEventListener(e,miniaudio.unlock,!0)}))},miniaudio.unlock_event_types.map((function(e){document.addEventListener(e,miniaudio.unlock,!0)}))),window.miniaudio.referenceCount+=1,1),2766934:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2767098:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2767202:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2767373:(e,t,r,o,n,i)=>{var s=e,a=t,c=r,d=o,u=n,h=i;if(void 0===window.miniaudio)return-1;var p={},f={};s==window.miniaudio.device_type.playback&&(f.sampleRate=c),p.webaudio=new(window.AudioContext||window.webkitAudioContext)(f),p.webaudio.suspend(),p.state=window.miniaudio.device_state.stopped;var g=0,m=a;return s!=window.miniaudio.device_type.playback&&(g=a),p.scriptNode=p.webaudio.createScriptProcessor(d,g,m),p.scriptNode.onaudioprocess=function(e){if(null!=p.intermediaryBufferView&&0!=p.intermediaryBufferView.length||(p.intermediaryBufferView=new Float32Array(l.HEAPF32.buffer,u,d*a)),s==miniaudio.device_type.capture||s==miniaudio.device_type.duplex){for(var t=0;t<a;t+=1)for(var r=e.inputBuffer.getChannelData(t),o=p.intermediaryBufferView,n=0;n<d;n+=1)o[n*a+t]=r[n];zl(h,d,u)}if(s==miniaudio.device_type.playback||s==miniaudio.device_type.duplex)for(Gl(h,d,u),t=0;t<e.outputBuffer.numberOfChannels;++t){var i=e.outputBuffer.getChannelData(t);for(o=p.intermediaryBufferView,n=0;n<d;n+=1)i[n]=o[n*a+t]}else for(t=0;t<e.outputBuffer.numberOfChannels;++t)e.outputBuffer.getChannelData(t).fill(0)},s!=miniaudio.device_type.capture&&s!=miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){p.streamNode=p.webaudio.createMediaStreamSource(e),p.streamNode.connect(p.scriptNode),p.scriptNode.connect(p.webaudio.destination)})).catch((function(e){console.log("Failed to get user media: "+e)})),s==miniaudio.device_type.playback&&p.scriptNode.connect(p.webaudio.destination),miniaudio.track_device(p)},2770156:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2770222:e=>{var t=miniaudio.get_device_by_index(e);void 0!==t.scriptNode&&(t.scriptNode.onaudioprocess=function(e){},t.scriptNode.disconnect(),t.scriptNode=void 0),void 0!==t.streamNode&&(t.streamNode.disconnect(),t.streamNode=void 0),t.webaudio.close(),t.webaudio=void 0},2770587:e=>{miniaudio.untrack_device_by_index(e)},2770630:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2770755:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2770881:()=>!!globalThis.ubq_browserTabHidden},ql={Ua:e=>{var t=new ExceptionInfo(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),de.push(t),rc(e),nc(e)},Hh:()=>{Kl(0,0);var e=de.pop();tc(e.excPtr),ue=0},n:()=>pe([]),qa:e=>pe([e]),k:(e,t,r)=>{throw new ExceptionInfo(e).init(t,r),ue=e},O:e=>{throw ue||(ue=e),ue},Gh:function(e,t){try{return e=Pe.getStr(e),Te.chmod(e,t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Fh:function(e,t){try{return Te.fchmod(e,t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},pa:function(e,t,r){Pe.varargs=r;try{var o=Pe.getStreamFromFD(e);switch(t){case 0:if((n=Ae())<0)return-28;for(;Te.streams[n];)n++;return Te.dupStream(o,n).fd;case 1:case 2:case 13:case 14:return 0;case 3:return o.flags;case 4:var n=Ae();return o.flags|=n,0;case 12:return n=Fe(),T[n+0>>1]=2,0}return-28}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Eh:function(e,t){try{return Pe.writeStat(t,Te.fstat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Dh:function(e,t,r){Pe.varargs=r;try{var o=Pe.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return o.tty?0:-59;case 21505:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var n=o.tty.ops.ioctl_tcgets(o),i=Fe();A[i>>2]=n.c_iflag||0,A[i+4>>2]=n.c_oflag||0,A[i+8>>2]=n.c_cflag||0,A[i+12>>2]=n.c_lflag||0;for(var s=0;s<32;s++)S[i+s+17]=n.c_cc[s]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){i=Fe();var a=A[i>>2],l=A[i+4>>2],c=A[i+8>>2],d=A[i+12>>2],u=[];for(s=0;s<32;s++)u.push(S[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,t,{c_iflag:a,c_oflag:l,c_cflag:c,c_lflag:d,c_cc:u})}return 0;case 21519:return o.tty?(i=Fe(),A[i>>2]=0,0):-59;case 21520:return o.tty?-28:-59;case 21531:return i=Fe(),Te.ioctl(o,t,i);case 21523:if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var h=o.tty.ops.ioctl_tiocgwinsz(o.tty);i=Fe(),T[i>>1]=h[0],T[i+2>>1]=h[1]}return 0;default:return-28}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ch:function(e,t){try{return e=Pe.getStr(e),Pe.writeStat(t,Te.lstat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Bh:function(e,t,r,o){try{t=Pe.getStr(t);var n=256&o,i=4096&o;return o&=-6401,t=Pe.calculateAt(e,t,i),Pe.writeStat(r,n?Te.lstat(t):Te.stat(t))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ta:function(e,t,r,o){Pe.varargs=o;try{t=Pe.getStr(t),t=Pe.calculateAt(e,t);var n=o?Ae():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ah:function(e,t,r,o){try{return t=Pe.getStr(t),o=Pe.getStr(o),t=Pe.calculateAt(e,t),o=Pe.calculateAt(r,o),Te.rename(t,o),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},zh:function(e){try{return e=Pe.getStr(e),Te.rmdir(e),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},yh:function(e,t){try{return e=Pe.getStr(e),Pe.writeStat(t,Te.stat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},xh:function(e,t,r){try{return t=Pe.getStr(t),t=Pe.calculateAt(e,t),0===r?Te.unlink(t):512===r?Te.rmdir(t):V("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},nh:()=>V(""),Ra:e=>{var t=Me[e];delete Me[e];var r=t.elements,o=r.length,n=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,s=t.rawDestructor;qe([e],n,(e=>(r.forEach(((t,r)=>{var n=e[r],i=t.getter,s=t.getterContext,a=e[r+o],l=t.setter,c=t.setterContext;t.read=e=>n.fromWireType(i(s,e)),t.write=(e,t)=>{var r=[];l(c,e,a.toWireType(r,t)),Ie(r)}})),[{name:t.name,fromWireType:e=>{for(var t=new Array(o),n=0;n<o;++n)t[n]=r[n].read(e);return s(e),t},toWireType:(e,n)=>{if(o!==n.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${o}, actual=${n.length}`);for(var a=i(),l=0;l<o;++l)r[l].write(a,n[l]);return null!==e&&e.push(s,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:s}])))},A:e=>{var t=Ue[e];delete Ue[e];var r=t.rawConstructor,o=t.rawDestructor,n=t.fields,i=n.map((e=>e.getterReturnType)).concat(n.map((e=>e.setterArgumentType)));qe([e],i,(e=>{var i={};return n.forEach(((t,r)=>{var o=t.fieldName,s=e[r],a=e[r].optional,l=t.getter,c=t.getterContext,d=e[r+n.length],u=t.setter,h=t.setterContext;i[o]={read:e=>s.fromWireType(l(c,e)),write:(e,t)=>{var r=[];u(h,e,d.toWireType(r,t)),Ie(r)},optional:a}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in i)t[r]=i[r].read(e);return o(e),t},toWireType:(e,t)=>{for(var n in i)if(!(n in t)&&!i[n].optional)throw new TypeError(`Missing field: "${n}"`);var s=r();for(n in i)i[n].write(s,t[n]);return null!==e&&e.push(o,s),s},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:o}]}))},Qa:(e,t,r,o,n)=>{var i=-1!=(t=Ne(t)).indexOf("u");ze(e,{name:t,fromWireType:e=>e,toWireType:function(e,t){if("bigint"!=typeof t&&"number"!=typeof t)throw new TypeError(`Cannot convert "${We(t)}" to ${this.name}`);return"number"==typeof t&&(t=BigInt(t)),t},argPackAdvance:Xe,readValueFromPointer:Ge(t,r,!i),destructorFunction:null})},mh:(e,t,r,o)=>{ze(e,{name:t=Ne(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:o},argPackAdvance:Xe,readValueFromPointer:function(e){return this.fromWireType(x[e])},destructorFunction:null})},t:(e,t,r,o,n,i,s,a,l,c,d,u,h)=>{d=Ne(d),i=St(n,i),a&&=St(s,a),c&&=St(l,c),h=St(u,h);var p=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(d);dt(p,(function(){Pt(`Cannot construct ${d} due to unbound types`,[o])})),qe([e,t,r],o?[o]:[],(t=>{var r,n;t=t[0],n=o?(r=t.registeredClass).instancePrototype:at.prototype;var s=lt(d,(function(...e){if(Object.getPrototypeOf(this)!==l)throw new He("Use 'new' to construct "+d);if(void 0===u.constructor_body)throw new He(d+" has no accessible constructor");var t=u.constructor_body[e.length];if(void 0===t)throw new He(`Tried to invoke ctor of ${d} with invalid number of parameters (${e.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)})),l=Object.create(n,{constructor:{value:s}});s.prototype=l;var u=new ut(d,s,l,h,r,i,a,c);u.baseClass&&(u.baseClass.__derivedClasses??=[],u.baseClass.__derivedClasses.push(u));var f=new mt(d,u,!0,!1,!1),g=new mt(d+"*",u,!1,!1,!1),m=new mt(d+" const*",u,!1,!0,!1);return et[e]={pointerType:g,constPointerType:m},_t(p,s),[f,g,m]}))},v:(e,t,r,o,n,i)=>{var s=At(t,r);n=St(o,n),qe([],[e],(e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new He(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Pt(`Cannot construct ${e.name} due to unbound types`,s)},qe([],s,(o=>(o.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,o,null,n,i),[]))),[]}))},c:(e,t,r,o,n,i,s,a,l,c)=>{var d=At(r,o);t=Ne(t),t=It(t),i=St(n,i),qe([],[e],(e=>{var o=`${(e=e[0]).name}.${t}`;function n(){Pt(`Cannot call ${o} due to unbound types`,d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(ct(l,t,o),l[t].overloadTable[r-2]=n),qe([],d,(n=>{var a=Ft(o,n,e,i,s);return void 0===l[t].overloadTable?(a.argCount=r-2,l[t]=a):l[t].overloadTable[r-2]=a,[]})),[]}))},lh:e=>ze(e,jt),ba:(e,t,r,o)=>{function n(){}t=Ne(t),n.values={},ze(e,{name:t,constructor:n,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:Xe,readValueFromPointer:$t(t,r,o),destructorFunction:null}),dt(t,n)},I:(e,t,r)=>{var o=qt(e,"enum");t=Ne(t);var n=o.constructor,i=Object.create(o.constructor.prototype,{value:{value:r},constructor:{value:lt(`${o.name}_${t}`,(function(){}))}});n.values[r]=i,n[t]=i},Pa:(e,t,r)=>{ze(e,{name:t=Ne(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Xe,readValueFromPointer:Ut(t,r),destructorFunction:null})},P:(e,t,r,o,n,i,s,a)=>{var l=At(t,r);e=Ne(e),e=It(e),n=St(o,n),dt(e,(function(){Pt(`Cannot call ${e} due to unbound types`,l)}),t-1),qe([],l,(r=>{var o=[r[0],null].concat(r.slice(1));return _t(e,Ft(e,o,null,n,i),t-1),[]}))},N:(e,t,r,o,n)=>{t=Ne(t),-1===n&&(n=4294967295);var i=e=>e;if(0===o){var s=32-8*r;i=e=>e<<s>>>s}var a=t.includes("unsigned");ze(e,{name:t,fromWireType:i,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Xe,readValueFromPointer:Ge(t,r,0!==o),destructorFunction:null})},E:(e,t,r)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function n(e){var t=F[e>>2],r=F[e+4>>2];return new o(S.buffer,r,t)}ze(e,{name:r=Ne(r),fromWireType:n,argPackAdvance:Xe,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},U:(e,t)=>{ze(e,Wt)},kh:(e,t,r,o,n,i,s,a,l,c,d,u)=>{r=Ne(r),i=St(n,i),a=St(s,a),c=St(l,c),u=St(d,u),qe([e],[t],(e=>(e=e[0],[new mt(r,e.registeredClass,!1,!1,!0,e,o,i,a,c,u)])))},jh:(e,t)=>{t=Ne(t),ze(e,{name:t,fromWireType(e){for(var t,r=F[e>>2],o=e+4,n=o,i=0;i<=r;++i){var s=o+i;if(i==r||0==x[s]){var a=Q(n,s-n);void 0===t?t=a:(t+=String.fromCharCode(0),t+=a),n=s+1}}return Vl(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||Ve("Cannot pass non-string to std::string"),r=o?se(t):t.length;var n=Nl(4+r+1),i=n+4;return F[n>>2]=r,o?le(t,i,r+1):x.set(t,i),null!==e&&e.push(Vl,n),n},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Vl(e)}})},na:(e,t,r)=>{var o,n,i,s;r=Ne(r),2===t?(o=Ht,n=Vt,s=zt,i=e=>P[e>>1]):4===t&&(o=Gt,n=Xt,s=Yt,i=e=>F[e>>2]),ze(e,{name:r,fromWireType:e=>{for(var r,n=F[e>>2],s=e+4,a=0;a<=n;++a){var l=e+4+a*t;if(a==n||0==i(l)){var c=o(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Vl(e),r},toWireType:(e,o)=>{"string"!=typeof o&&Ve(`Cannot pass non-string to C++ string type ${r}`);var i=s(o),a=Nl(4+i+t);return F[a>>2]=i/t,n(o,a+4,i+t),null!==e&&e.push(Vl,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Vl(e)}})},Oa:(e,t,r,o,n,i)=>{Me[e]={name:Ne(t),rawConstructor:St(r,o),rawDestructor:St(n,i),elements:[]}},M:(e,t,r,o,n,i,s,a,l)=>{Me[e].elements.push({getterReturnType:t,getter:St(r,o),getterContext:n,setterArgumentType:i,setter:St(s,a),setterContext:l})},z:(e,t,r,o,n,i)=>{Ue[e]={name:Ne(t),rawConstructor:St(r,o),rawDestructor:St(n,i),fields:[]}},l:(e,t,r,o,n,i,s,a,l,c)=>{Ue[e].fields.push({fieldName:Ne(t),getterReturnType:r,getter:St(o,n),getterContext:i,setterArgumentType:s,setter:St(a,l),setterContext:c})},ih:(e,t)=>{ze(e,{isVoid:!0,name:t=Ne(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},hh:()=>{oe=!1,Kt=0},gh:()=>{throw 1/0},i:(e,t,r)=>(e=Ot.toValue(e),t=qt(t,"emval::as"),Qt(t,r,e)),u:(e,t,r,o)=>(e=Zt[e])(null,t=Ot.toValue(t),r,o),K:(e,t,r,o,n)=>(e=Zt[e])(t=Ot.toValue(t),t[r=er(r)],o,n),b:Dt,fh:(e,t)=>(e=Ot.toValue(e))==(t=Ot.toValue(t)),J:e=>0===e?Ot.toHandle(tr()):(e=er(e),Ot.toHandle(tr()[e])),q:(e,t,r)=>{var o=((e,t)=>{for(var r=new Array(e),o=0;o<e;++o)r[o]=qt(F[t+4*o>>2],"parameter "+o);return r})(e,t),n=o.shift();e--;var i,s,a=new Array(e),l=`methodCaller<(${o.map((e=>e.name)).join(", ")}) => ${n.name}>`;return i=lt(l,((t,i,s,l)=>{for(var c=0,d=0;d<e;++d)a[d]=o[d].readValueFromPointer(l+c),c+=o[d].argPackAdvance;var u=1===r?rr(i,a):i.apply(t,a);return Qt(n,s,u)})),s=Zt.length,Zt.push(i),s},g:(e,t)=>(e=Ot.toValue(e),t=Ot.toValue(t),Ot.toHandle(e[t])),d:e=>{e>9&&(Rt[e+1]+=1)},W:(e,t)=>(e=Ot.toValue(e))instanceof(t=Ot.toValue(t)),ma:e=>"number"==typeof(e=Ot.toValue(e)),H:e=>"string"==typeof(e=Ot.toValue(e)),Na:()=>Ot.toHandle([]),e:e=>Ot.toHandle(er(e)),x:()=>Ot.toHandle({}),h:e=>{var t=Ot.toValue(e);Ie(t),Dt(e)},j:(e,t,r)=>{e=Ot.toValue(e),t=Ot.toValue(t),r=Ot.toValue(r),e[t]=r},f:(e,t)=>{var r=(e=qt(e,"_emval_take_value")).readValueFromPointer(t);return Ot.toHandle(r)},eh:e=>{throw e=Ot.toValue(e)},dh:e=>(e=Ot.toValue(e),Ot.toHandle(typeof e)),ch:function(e,t){e=or(e);var r=new Date(1e3*e);A[t>>2]=r.getUTCSeconds(),A[t+4>>2]=r.getUTCMinutes(),A[t+8>>2]=r.getUTCHours(),A[t+12>>2]=r.getUTCDate(),A[t+16>>2]=r.getUTCMonth(),A[t+20>>2]=r.getUTCFullYear()-1900,A[t+24>>2]=r.getUTCDay();var o=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),n=(r.getTime()-o)/864e5|0;A[t+28>>2]=n},bh:function(e,t){e=or(e);var r=new Date(1e3*e);A[t>>2]=r.getSeconds(),A[t+4>>2]=r.getMinutes(),A[t+8>>2]=r.getHours(),A[t+12>>2]=r.getDate(),A[t+16>>2]=r.getMonth(),A[t+20>>2]=r.getFullYear()-1900,A[t+24>>2]=r.getDay();var o=0|sr(r);A[t+28>>2]=o,A[t+36>>2]=-60*r.getTimezoneOffset();var n=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=n.getTimezoneOffset(),a=0|(i!=s&&r.getTimezoneOffset()==Math.min(s,i));A[t+32>>2]=a},ah:function(e){var t=(()=>{var t=new Date(A[e+20>>2]+1900,A[e+16>>2],A[e+12>>2],A[e+8>>2],A[e+4>>2],A[e>>2],0),r=A[e+32>>2],o=t.getTimezoneOffset(),n=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=n.getTimezoneOffset(),a=Math.min(s,i);if(r<0)A[e+32>>2]=Number(i!=s&&a==o);else if(r>0!=(a==o)){var l=Math.max(s,i),c=r>0?a:l;t.setTime(t.getTime()+6e4*(c-o))}A[e+24>>2]=t.getDay();var d=0|sr(t);A[e+28>>2]=d,A[e>>2]=t.getSeconds(),A[e+4>>2]=t.getMinutes(),A[e+8>>2]=t.getHours(),A[e+12>>2]=t.getDate(),A[e+16>>2]=t.getMonth(),A[e+20>>2]=t.getYear();var u=t.getTime();return isNaN(u)?-1:u/1e3})();return BigInt(t)},$g:function(e,t,r,o,n,i,s){n=or(n);try{if(isNaN(n))return 61;var a=Pe.getStreamFromFD(o),l=Te.mmap(a,e,n,t,r),c=l.ptr;return A[i>>2]=l.allocated,F[s>>2]=c,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},_g:function(e,t,r,o,n,i){i=or(i);try{var s=Pe.getStreamFromFD(n);2&r&&Pe.doMsync(e,s,t,o,i)}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Zg:(e,t)=>{if(ar[e]&&(clearTimeout(ar[e].id),delete ar[e]),!t)return 0;var r=setTimeout((()=>{delete ar[e],pr((()=>Yl(e,fr())))}),t);return ar[e]={id:r,timeout_ms:t},0},Yg:(e,t,r,o)=>{var n=(new Date).getFullYear(),i=new Date(n,0,1),s=new Date(n,6,1),a=i.getTimezoneOffset(),l=s.getTimezoneOffset(),c=Math.max(a,l);F[e>>2]=60*c,A[t>>2]=Number(a!=l);var d=e=>{var t=e>=0?"-":"+",r=Math.abs(e);return`UTC${t}${String(Math.floor(r/60)).padStart(2,"0")}${String(r%60).padStart(2,"0")}`},u=d(a),h=d(l);l<a?(le(u,r,17),le(h,o,17)):(le(u,o,17),le(h,r,17))},Xg:function(e){var t=Q(e);localStorage.removeItem(t)},wh:function(e,t,r){if(t=or(t),!((o=e)>=0&&o<=3))return 28;var o,n;n=0===e?gr():fr();var i=Math.round(1e3*n*1e3);return I[r>>3]=BigInt(i),0},Ma:(e,t,r,o,n)=>yr.chooseConfig(e,t,r,o,n),La:(e,t,r,o)=>{if(62e3!=e)return yr.setErrorCode(12296),0;for(var n=1;;){var i=A[o>>2];if(12440!=i){if(12344==i)break;return yr.setErrorCode(12292),0}n=A[o+4>>2],o+=8}return n<2||n>3?(yr.setErrorCode(12293),0):(yr.contextAttributes.majorVersion=n-1,yr.contextAttributes.minorVersion=0,yr.context=vr.createContext(br.getCanvas(),yr.contextAttributes),0!=yr.context?(yr.setErrorCode(12288),vr.makeContextCurrent(yr.context),br.useWebGL=!0,br.moduleContextCreatedCallbacks.forEach((e=>e())),vr.makeContextCurrent(null),62004):(yr.setErrorCode(12297),0))},Wg:(e,t,r,o)=>62e3!=e?(yr.setErrorCode(12296),0):62002!=t?(yr.setErrorCode(12293),0):(yr.setErrorCode(12288),62006),Ka:(e,t)=>62e3!=e?(yr.setErrorCode(12296),0):62004!=t?(yr.setErrorCode(12294),0):(vr.deleteContext(yr.context),yr.setErrorCode(12288),yr.currentContext==t&&(yr.currentContext=0),1),la:(e,t)=>62e3!=e?(yr.setErrorCode(12296),0):62006!=t?(yr.setErrorCode(12301),1):(yr.currentReadSurface==t&&(yr.currentReadSurface=0),yr.currentDrawSurface==t&&(yr.currentDrawSurface=0),yr.setErrorCode(12288),1),T:(e,t,r,o)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(62002!=t)return yr.setErrorCode(12293),0;if(!o)return yr.setErrorCode(12300),0;switch(yr.setErrorCode(12288),r){case 12320:return A[o>>2]=yr.contextAttributes.alpha?32:24,1;case 12321:return A[o>>2]=yr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return A[o>>2]=8,1;case 12325:return A[o>>2]=yr.contextAttributes.depth?24:0,1;case 12326:return A[o>>2]=yr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return A[o>>2]=12344,1;case 12328:return A[o>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return A[o>>2]=0,1;case 12330:case 12332:return A[o>>2]=4096,1;case 12331:return A[o>>2]=16777216,1;case 12337:return A[o>>2]=yr.contextAttributes.antialias?4:0,1;case 12338:return A[o>>2]=yr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return A[o>>2]=4,1;case 12341:case 12342:case 12343:return A[o>>2]=-1,1;case 12348:return A[o>>2]=1,1;case 12351:return A[o>>2]=12430,1;default:return yr.setErrorCode(12292),0}},Vg:e=>(yr.setErrorCode(12288),0!=e&&1!=e?0:62e3),Ja:()=>yr.errorCode,Ug:(e,t,r)=>62e3!=e?(yr.setErrorCode(12296),0):(t&&(A[t>>2]=1),r&&(A[r>>2]=4),yr.defaultDisplayInitialized=!0,yr.setErrorCode(12288),1),aa:(e,t,r,o)=>62e3!=e?(yr.setErrorCode(12296),0):0!=o&&62004!=o?(yr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(yr.setErrorCode(12301),0):(vr.makeContextCurrent(o?yr.context:null),yr.currentContext=o,yr.currentDrawSurface=t,yr.currentReadSurface=r,yr.setErrorCode(12288),1),ka:(e,t)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(yr.setErrorCode(12288),yr.stringCache[t])return yr.stringCache[t];var r;switch(t){case 12371:r=ce("Emscripten");break;case 12372:r=ce("1.4 Emscripten EGL");break;case 12373:r=ce("");break;case 12429:r=ce("OpenGL_ES");break;default:return yr.setErrorCode(12300),0}return yr.stringCache[t]=r,r},Ia:(e,t)=>{if(yr.defaultDisplayInitialized)if(Mt){if(!Mt.isContextLost())return yr.setErrorCode(12288),1;yr.setErrorCode(12302)}else yr.setErrorCode(12290);else yr.setErrorCode(12289);return 0},Tg:e=>62e3!=e?(yr.setErrorCode(12296),0):(yr.currentContext=0,yr.currentReadSurface=0,yr.currentDrawSurface=0,yr.defaultDisplayInitialized=!1,yr.setErrorCode(12288),1),G:(e,t,r)=>kr(e,t,r),Sg:e=>{console.error(Q(e))},Rg:e=>{console.log(Q(e))},Qg:e=>{console.warn(Q(e))},Ha:gr,Pg:()=>{},Og:()=>2147483648,Ng:_r,Mg:Cr,Lg:Er,Kg:Sr,Jg:xr,Ig:Tr,Hg:Pr,Gg:Ar,Fg:Fr,Eg:Mr,Dg:Ir,Cg:Lr,Bg:Rr,Ag:Dr,zg:Or,yg:$r,xg:qr,wg:Ur,vg:Wr,ug:Nr,tg:Hr,sg:Vr,rg:zr,qg:Gr,pg:Xr,og:Yr,ng:Kr,mg:Qr,lg:Zr,kg:Jr,jg:eo,ig:to,hg:ro,Ga:oo,gg:no,fg:io,eg:so,dg:ao,cg:lo,bg:co,ag:uo,$f:ho,_f:po,Zf:fo,Yf:go,Xf:mo,Wf:bo,Vf:yo,Uf:vo,Tf:wo,Sf:ko,Rf:_o,Qf:Co,Pf:Eo,Of:So,Nf:xo,Mf:To,Lf:Po,Kf:Ao,Jf:Mo,If:Lo,Hf:Ro,Gf:Do,Ff:Bo,Ef:Oo,Df:jo,Cf:$o,Bf:qo,Af:Wo,zf:Ho,yf:zo,xf:Go,wf:Yo,vf:Qo,uf:en,tf:rn,sf:nn,rf:an,qf:cn,pf:un,of:pn,nf:fn,mf:mn,lf:yn,kf:vn,jf:wn,hf:kn,gf:_n,ff:Cn,ef:En,df:Sn,cf:xn,bf:Tn,af:Pn,$e:An,_e:Fn,Ze:Mn,Ye:In,Xe:Ln,We:Rn,Ve:Dn,Ue:Bn,Te:On,Se:jn,Re:$n,Qe:Un,Pe:Nn,Oe:Hn,Ne:zn,Me:Gn,Le:Xn,Ke:Yn,Je:Kn,Ie:Qn,He:Zn,Ge:ri,Fe:oi,Ee:ni,De:ii,Ce:si,Be:ai,Ae:li,ze:di,ye:ui,xe:hi,we:pi,ve:fi,ue:gi,te:mi,se:bi,re:vi,qe:ki,pe:Ci,oe:Ei,ne:xi,me:Ti,le:Pi,ke:Ai,je:Fi,ie:Mi,he:Ii,ge:Li,fe:Ri,ee:Di,Fa:Bi,de:Oi,ce:ji,be:$i,ae:qi,$d:Ui,_d:Wi,Zd:Ni,Yd:zi,Xd:Yi,Wd:Ki,Vd:Qi,Ud:es,Td:rs,Sd:os,Rd:ns,Qd:is,Pd:ss,Od:as,Nd:ls,Md:cs,Ld:ds,Kd:us,Jd:hs,Id:ps,Hd:fs,Gd:gs,Fd:ms,Ed:bs,Dd:ys,Cd:vs,Bd:ws,Ad:_s,zd:Es,yd:Ss,xd:xs,wd:Ts,vd:Ps,ud:As,td:Fs,sd:Ms,rd:Is,qd:Ls,pd:Rs,od:Ds,nd:Bs,md:Os,ld:Us,kd:Ws,jd:Ns,id:Hs,hd:Vs,gd:zs,fd:Gs,ed:Xs,dd:Ys,cd:Ks,bd:Qs,ad:Zs,$c:Js,_c:ea,Zc:ta,Yc:ra,Xc:oa,Wc:na,Vc:ia,Uc:sa,Tc:aa,Sc:la,Rc:ca,Qc:da,Pc:ua,Oc:ha,Nc:pa,Mc:fa,Lc:ga,Kc:ma,Jc:ba,Ic:va,Hc:wa,Gc:_a,Fc:Ca,Ec:Ea,Dc:Sa,Cc:xa,Bc:Ta,Ac:Pa,zc:Aa,yc:Fa,xc:Ma,wc:Ia,vc:La,uc:Ra,tc:Da,sc:Ba,rc:Oa,qc:ja,pc:$a,oc:qa,nc:Ua,mc:Wa,lc:Na,kc:Ha,jc:Va,ic:za,hc:Ga,gc:Xa,fc:Ya,ec:Ka,dc:Qa,cc:Za,bc:Ja,ac:el,$b:tl,_b:rl,Zb:ol,Yb:nl,Xb:il,Wb:sl,Vb:al,Ub:ll,Tb:dl,Sb:ul,Rb:hl,Qb:pl,Pb:fl,Ob:gl,Nb:ml,Mb:bl,Lb:yl,Kb:vl,Jb:wl,Ib:kl,Ea:_l,Hb:e=>{var t=x.length,r=2147483648;if((e>>>=0)>r)return!1;for(var o=1;o<=4;o*=2){var n=t*(1+.2/o);n=Math.min(n,e+100663296);var i=Math.min(r,we(Math.max(e,n),65536));if(Cl(i))return!0}return!1},Gb:function(e,t,r,o,n,i,s,a,c){const d=l.UTF8ToString(e,e+t),u=l.HEAPU8.subarray(n,n+i),h=l.emscripten_ubq_codec_audioDecoderNextHandle++,p={codec:d,sampleRate:r,numberOfChannels:o,description:u};try{const e=l.emscripten_ubq_codec_createAudioDecoder(s,a,c);AudioDecoder.isConfigSupported(p).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(p),l.emscripten_ubq_codec_audioDecoders.set(h,{audioDecoder:e,decoderConfig:p,leftBufferPtr:s,rightBufferPtr:a,bufferLength:c,opfsUri:""})}catch(e){return l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:h})},Fb:function(e,t,r,o,n,i){const s=l.UTF8ToString(e,e+t),a=l.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:s,sampleRate:r,numberOfChannels:o,bitrate:n};try{const e=new AudioEncoder({output:e=>{const t=l._malloc(e.byteLength),r=l.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),l.emscripten_ubq_codec_onOutputEncodedAudioChunk(a,t,e.byteLength,i),l._free(t)},error:e=>{l.emscripten_ubq_codec_audioEncoders.get(a).frameIndex>1&&console.error(e)}});e.configure(c),l.emscripten_ubq_codec_audioEncoders.set(a,{audioEncoder:e,audioEncoderConfig:c,frameIndex:0})}catch(e){return e+=' Requested codec: "'+s+'"',e+="; sample rate: "+r,e+="; channels: "+o,e+="; bit rate: "+n,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:a})},Eb:function(e,t,r,o,n,i,s,a){const c=l.UTF8ToString(e,e+t),d=l.HEAPU8.subarray(i,i+s),u=l.emscripten_ubq_codec_videoDecoderNextHandle++,h={codec:c,codedWidth:r,codedHeight:o,description:d,optimizeForLatency:!0};try{const e=l.emscripten_ubq_codec_createVideoDecoder(u,n,a);VideoDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(h),l.emscripten_ubq_codec_videoDecoders.set(u,{videoDecoder:e,decoderConfig:h,codecServicePtr:a,opfsUri:""})}catch(e){return l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:u})},Db:function(e,t,r,o,n,i,s){const a=l.UTF8ToString(e,e+t),c=l.emscripten_ubq_codec_videoEncoderNextHandle++,d=l.specialHTMLTargets["!canvas"];d.width=r,d.height=o;const u={codec:a,width:r,height:o,avc:{format:"annexb"},framerate:n};i>0&&(u.bitrate=i);try{const e=new VideoEncoder({output:e=>{const t=l._malloc(e.byteLength),r=l.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),l.emscripten_ubq_codec_onOutputEncodedVideoChunk(c,t,e.byteLength,s),l._free(t)},error:e=>console.error(e)});VideoEncoder.isConfigSupported(u).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(u),l.emscripten_ubq_codec_videoEncoders.set(c,{videoEncoder:e,encoderConfig:u,groupOfPictures:150,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; resolution: "+r+"x"+o,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:c})},Cb:function(e,t,r,o,n,i){const s=l.emscripten_ubq_codec_audioDecoders.get(e);if(s.audioDecoder.unexpectedError)return l.emscripten_ubq_codec_createNativeResult({code:2,error:s.audioDecoder.unexpectedError});"closed"===s.audioDecoder.state&&(s.audioDecoder=l.emscripten_ubq_codec_createAudioDecoder(s.leftBufferPtr,s.rightBufferPtr,s.bufferLength),s.audioDecoder.configure(s.decoderConfig));const a=s.audioDecoder,c=l.HEAPU8.subarray(n,n+i),d=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:o,data:c});try{a.decode(d)}catch(e){return a.configUnsupported?l.emscripten_ubq_codec_createNativeResult({code:2,error:e}):l.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return l.emscripten_ubq_codec_createNativeResult({code:0})},Bb:function(e,t,r,o,n,i){const s=l.emscripten_ubq_codec_videoDecoders.get(e);if(s.videoDecoder.unexpectedError)return l.emscripten_ubq_codec_createNativeResult({code:2,error:s.videoDecoder.unexpectedError});if("closed"===s.videoDecoder.state){const t=s.videoDecoder.textures;return s.videoDecoder=l.emscripten_ubq_codec_createVideoDecoder(e,s.isHdr,s.codecServicePtr),s.videoDecoder.textures=t,s.videoDecoder.configure(s.decoderConfig),l.emscripten_ubq_codec_createNativeResult({code:1,error:"VideoDecoder was closed"})}const a=s.videoDecoder,c=l.HEAPU8.subarray(n,n+i),d=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:o,data:c});try{a.decode(d)}catch(e){return a.configUnsupported?l.emscripten_ubq_codec_createNativeResult({code:2,error:e}):l.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return l.emscripten_ubq_codec_createNativeResult({code:0})},Da:function(e){if(l.emscripten_ubq_codec_audioDecoders.has(e)){const t=l.emscripten_ubq_codec_audioDecoders.get(e);if("closed"!==t.audioDecoder.state&&t.audioDecoder.close(),t.opfsUri&&""!==t.opfsUri){const e=l.emscripten_ubq_opfs_getCache(t.opfsUri);e&&e.worker&&(l.emscripten_ubq_opfs_destroyWorker(e.worker),e.worker=null,e.workerOpened=!1,e.workerOpening=null)}l.emscripten_ubq_codec_audioDecoders.delete(e)}},Ca:function(e){const t=l.emscripten_ubq_codec_audioEncoders.get(e);"closed"!==t.audioEncoder.state&&t.audioEncoder.close(),l.emscripten_ubq_codec_audioEncoders.delete(e)},Ba:function(e){if(l.emscripten_ubq_codec_videoDecoders.has(e)){const t=l.emscripten_ubq_codec_videoDecoders.get(e);if("closed"!==t.videoDecoder.state&&t.videoDecoder.close(),t.opfsUri&&""!==t.opfsUri){const e=l.emscripten_ubq_opfs_getCache(t.opfsUri);e&&e.worker&&(l.emscripten_ubq_opfs_destroyWorker(e.worker),e.worker=null,e.workerOpened=!1,e.workerOpening=null)}l.emscripten_ubq_codec_videoDecoders.delete(e)}},Aa:function(e){const t=l.emscripten_ubq_codec_videoEncoders.get(e);"closed"!==t.videoEncoder.state&&t.videoEncoder.close(),l.emscripten_ubq_codec_videoEncoders.delete(e)},Ab:function(e,t,r){const o=1e6,n=l.emscripten_ubq_codec_audioEncoders.get(e),i=n.audioEncoderConfig.sampleRate,s=n.audioEncoderConfig.numberOfChannels,a=r/s,c=Math.round(o*(n.frameIndex*a/i)),d=Math.round(o*(a/i)),u=l.HEAPF32.subarray(t/4,t/4+r),h=new AudioData({format:"f32",sampleRate:i,numberOfFrames:a,numberOfChannels:s,duration:d,timestamp:c,data:u});n.audioEncoder.encode(h),n.frameIndex++,h.close()},zb:function(e,t,r){const o=1e6,n=l.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(o*(n.frameIndex/n.encoderConfig.framerate)),s=n.frameIndex%n.groupOfPictures==0,a=Math.round(o/n.encoderConfig.framerate),c=l.specialHTMLTargets["!canvas"],d=new VideoFrame(c,{timestamp:i,duration:a});n.videoEncoder.encode(d,{keyFrame:s}),d.close(),n.frameIndex++},yb:async function(e,t){const r=l.emscripten_ubq_codec_audioEncoders.get(e);try{await r.audioEncoder.flush()}catch{if(r.frameIndex>1)throw new Error("AudioEncoder.flush() failed")}l.emscripten_ubq_codec_onFinalizedAudioEncoding(e,t)},xb:async function(e,t){const r=l.emscripten_ubq_codec_videoEncoders.get(e);await r.videoEncoder.flush(),l.emscripten_ubq_codec_onFinalizedVideoEncoding(e,t)},wb:async function(e,t){const r=l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder;r.flushing=!0;try{await r.flush()}catch{}r.flushing=!1,r.writtenFrames=t},S:async function(e,t,r){const o=l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;o.shouldDropFrames=r,o.flushing=!0;try{await o.flush()}catch{}o.flushing=!1,o.shouldDropFrames=!1,o.decodedFrames=t},za:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},$:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},_:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.writtenFrames},vb:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.flushing},ub:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.flushing},Z:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},tb:function(e,t,r,o,n,i,s){const a=l.emscripten_ubq_codec_videoDecoders.get(e),c=l.UTF8ToString(t,t+r),d=l.HEAPU8.subarray(i,i+s);a.videoDecoder.configure({codec:c,codedWidth:o,codedHeight:n,description:d})},sb:function(e,t){l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},rb:function(e,t,r){const o=l.emscripten_ubq_codec_videoDecoders.get(e),n=l.HEAPU32.subarray(t/4,t/4+r);o.videoDecoder.textures=[];for(let e=0;e<r;e++)o.videoDecoder.textures[e]=vr.textures[n[e]]},qb:async function(e,t,r,o,n,i,s,a,c,d){const u=l.UTF8ToString(e),h=l.emscripten_ubq_codec_audioDecoders.get(t);h&&(h.opfsUri=u);const p=l._malloc(a);try{const r=await l.emscripten_ubq_opfs_getChunkDataAsync(e,i,s,a,p);return r===a?(l.emscripten_ubq_codec_onAudioChunkLoaded(t,c,p,a,d),1):-1===r?(console.error(`[Codec] Error retrieving chunk data for ${u} at offset ${i}. OPFS loading failed.`),0):(console.warn(`[Codec] Incomplete data read for ${u} at offset ${i}. Expected ${a}, got ${r}`),0)}catch(e){return console.error(`[Codec] Error in submitChunkedData for ${u}:`,e),0}finally{l._free(p)}},pb:async function(e,t,r,o,n,i,s,a,c,d){const u=l.UTF8ToString(e),h=l.emscripten_ubq_codec_videoDecoders.get(t);h&&(h.opfsUri=u);const p=l._malloc(a);try{const r=await l.emscripten_ubq_opfs_getChunkDataAsync(e,i,s,a,p);return r===a?(l.emscripten_ubq_codec_onVideoChunkLoaded(t,c,p,a,d),1):-1===r?(console.error(`[Codec] Error retrieving chunk data for ${u} at offset ${i}. OPFS loading failed.`),0):(console.warn(`[Codec] Incomplete data read for ${u} at offset ${i}. Expected ${a}, got ${r}`),0)}catch(e){return console.error(`[Codec] Error in submitChunkedData for ${u}:`,e),0}finally{l._free(p)}},ob:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return!!(null==t?void 0:t.allocate())},ja:function(){l.emscripten_ubq_asyncFetchManager.clear()},ia:function(e,t,r,o){return l.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,o)},nb:function(e){l.emscripten_ubq_asyncFetchManager.deleteHeader(e)},mb:function(e,t,r,o,n,i,s,a,c){return l.emscripten_ubq_asyncFetchManager.fetch(e,t,r,o,n,i,s,a,c).handle},ha:function(e){return l.emscripten_ubq_asyncFetchManager.deleteProcess(e)},lb:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.receivedLength)&&void 0!==r?r:0},kb:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultAddress:-1},jb:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultLength:-1},ga:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.state)&&void 0!==r?r:-1},ib:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.totalBytes)&&void 0!==r?r:0},fa:function(e,t,r,o,n){const i=Q(e),s=4294967296*(r>>>0)+(t>>>0);if(o<=0)return 0;const a=l.emscripten_ubq_opfs_CHUNK_SIZE,c=l.emscripten_ubq_opfs_getCache(i),d=x.subarray(n,n+o);let u=0,h=s;const p=Math.min(s+o,c.fileSize);for(;h<p;){const e=Math.floor(h/a),t=c.chunkCache.get(e);if(!t)return-1;l.emscripten_ubq_opfs_updateAccess(c,e);const r=h-e*a,o=Math.min(t.byteLength-r,p-h);d.set(t.subarray(r,r+o),u),u+=o,h+=o}return u},hb:function(e){const t=Q(e),r=l.emscripten_ubq_opfs_getCache(t);return l.emscripten_ubq_opfs_ensureFile(t,r),BigInt(r.fileSize)},ea:function(e,t,r,o){const n=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(n),c=Math.floor(i/s),d=Math.floor((i+o)/s);for(let e=c;e<=d;++e){if(!a.chunkCache.has(e))return 0;l.emscripten_ubq_opfs_updateAccess(a,e)}return 1},da:function(e,t,r,o){const n=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(n),c=Math.floor(i/s),d=Math.floor((i+o-1)/s);let u=!0;for(let e=c;e<=d;++e)a.chunkCache.has(e)?l.emscripten_ubq_opfs_updateAccess(a,e):(u=!1,l.emscripten_ubq_opfs_loadChunk(n,a,e));return u?1:0},gb:function(){return!!l.emscripten_ubq_settings_forceWebGL1},ya:Tl,Y:e=>{vr.currentContext==e&&(vr.currentContext=0),vr.deleteContext(e)},fb:e=>(e=>{var t=e.getExtension("OES_vertex_array_object");if(t)return e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e),1})(vr.contexts[e].GLctx),eb:e=>(e=>{var t=e.getExtension("WEBGL_draw_buffers");if(t)return e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r),1})(vr.contexts[e].GLctx),db:e=>(e=>!!(e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")))(vr.contexts[e].GLctx),X:(e,t)=>{var r=vr.getContext(e),o=Q(t);return o.startsWith("GL_")&&(o=o.slice(3)),!!r.GLctx.getExtension(o)},cb:(e,t)=>{if(!t)return-5;if(!(e=vr.contexts[e]))return-3;var r=e.GLctx;if(!r)return-3;r=r.getContextAttributes(),S[t]=r.alpha,S[t+1]=r.depth,S[t+2]=r.stencil,S[t+3]=r.antialias,S[t+4]=r.premultipliedAlpha,S[t+5]=r.preserveDrawingBuffer;var o=r.powerPreference&&El.indexOf(r.powerPreference);return A[t+8>>2]=o,S[t+12]=r.failIfMajorPerformanceCaveat,A[t+16>>2]=e.version,A[t+20>>2]=0,0},bb:e=>vr.makeContextCurrent(e)?0:-5,vh:(e,t)=>{var r=0;return Al().forEach(((o,n)=>{var i=t+r;F[e+4*n>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)S[t++]=e.charCodeAt(r);S[t]=0})(o,i),r+=o.length+1})),0},uh:(e,t)=>{var r=Al();F[e>>2]=r.length;var o=0;return r.forEach((e=>o+=e.length+1)),F[t>>2]=o,0},xa:hr,oa:function(e){try{var t=Pe.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},th:function(e,t){try{var r=Pe.getStreamFromFD(e),o=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t]=o,T[t+2>>1]=0,I[t+8>>3]=BigInt(0),I[t+16>>3]=BigInt(0),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},sh:function(e,t,r,o,n){o=or(o);try{if(isNaN(o))return 61;var i=Pe.getStreamFromFD(e),s=Fl(i,t,r,o);return F[n>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},Sa:function(e,t,r,o){try{var n=Pe.getStreamFromFD(e),i=Fl(n,t,r);return F[o>>2]=i,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},rh:function(e,t,r,o){t=or(t);try{if(isNaN(t))return 61;var n=Pe.getStreamFromFD(e);return Te.llseek(n,t,r),I[o>>3]=BigInt(n.position),n.getdents&&0===t&&0===r&&(n.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},qh:function(e,t,r,o){try{var n=((e,t,r,o)=>{for(var n=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Te.write(e,S,s,a,o);if(l<0)return-1;if(n+=l,l<a)break;void 0!==o&&(o+=l)}return n})(Pe.getStreamFromFD(e),t,r);return F[o>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},ab:function(e){var t=Q(e),r=localStorage.getItem(t);return null==r?null:ce(r)},$a:function(){return"undefined"!=typeof window?ce(window.location.hostname):ce("")},y:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},L:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},F:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},m:function(e,t,r,o){var n=ie();try{return Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},_a:function(e){var t=ie();try{return Et(e)()}catch(e){if(ne(t),e!==e+0)throw e;Kl(1,0)}},wa:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},r:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},V:function(e,t,r,o,n,i,s,a,l,c,d,u,h,p,f,g){var m=ie();try{return Et(e)(t,r,o,n,i,s,a,l,c,d,u,h,p,f,g)}catch(e){if(ne(m),e!==e+0)throw e;Kl(1,0)}},p:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},s:function(e,t,r,o){var n=ie();try{return Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},R:function(e,t,r,o,n){var i=ie();try{return Et(e)(t,r,o,n)}catch(e){if(ne(i),e!==e+0)throw e;Kl(1,0)}},Za:function(e,t,r,o,n,i){var s=ie();try{return Et(e)(t,r,o,n,i)}catch(e){if(ne(s),e!==e+0)throw e;Kl(1,0)}},va:function(e,t,r,o,n,i,s){var a=ie();try{return Et(e)(t,r,o,n,i,s)}catch(e){if(ne(a),e!==e+0)throw e;Kl(1,0)}},ua:function(e,t,r,o,n,i,s,a,l,c){var d=ie();try{return Et(e)(t,r,o,n,i,s,a,l,c)}catch(e){if(ne(d),e!==e+0)throw e;Kl(1,0)}},Q:function(e){var t=ie();try{Et(e)()}catch(e){if(ne(t),e!==e+0)throw e;Kl(1,0)}},w:function(e,t){var r=ie();try{Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},C:function(e,t,r,o){var n=ie();try{Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},B:function(e,t,r){var o=ie();try{Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},o:function(e,t,r,o){var n=ie();try{Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},D:function(e,t,r,o,n){var i=ie();try{Et(e)(t,r,o,n)}catch(e){if(ne(i),e!==e+0)throw e;Kl(1,0)}},Ya:function(e,t,r,o,n,i){var s=ie();try{Et(e)(t,r,o,n,i)}catch(e){if(ne(s),e!==e+0)throw e;Kl(1,0)}},Xa:function(e,t,r,o,n,i,s){var a=ie();try{Et(e)(t,r,o,n,i,s)}catch(e){if(ne(a),e!==e+0)throw e;Kl(1,0)}},Wa:function(e,t,r,o,n,i,s,a){var l=ie();try{Et(e)(t,r,o,n,i,s,a)}catch(e){if(ne(l),e!==e+0)throw e;Kl(1,0)}},Va:function(e,t,r,o,n,i,s,a,l,c){var d=ie();try{Et(e)(t,r,o,n,i,s,a,l,c)}catch(e){if(ne(d),e!==e+0)throw e;Kl(1,0)}},ca:function(){return"undefined"!=typeof localStorage},ta:function(){return"undefined"!=typeof process&&process.versions&&process.versions.node?1:0},sa:function(e,t){const r=Ot.toValue(t),o=l.ctx;o.bindTexture(o.TEXTURE_2D,vr.textures[e]),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r)},a:C,ph:dr,oh:function(e,t){try{return ge(x.subarray(e,e+t)),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},ra:function(e,t){var r=Q(e),o=Q(t);localStorage.setItem(r,o)}},Ul=await async function(){function e(e,t){return Ul=e.exports,bt=Ul.Nh,H(),Ul}N();var t={a:ql};if(l.instantiateWasm)return new Promise(((r,o)=>{l.instantiateWasm(t,((t,o)=>{e(t),r(t.exports)}))}));q??=z();try{var r=await X(D,q,t);return e(r.instance)}catch(e){return o(e),Promise.reject(e)}}(),Wl=(Ul.Ih,Ul.Jh),Nl=l._malloc=Ul.Kh,Hl=l._main=Ul.Lh,Vl=l._free=Ul.Mh,zl=(l._ma_malloc_emscripten=Ul.Oh,l._ma_free_emscripten=Ul.Ph,l._ma_device_process_pcm_frames_capture__webaudio=Ul.Qh),Gl=l._ma_device_process_pcm_frames_playback__webaudio=Ul.Rh,Xl=Ul.Sh,Yl=Ul.Th,Kl=Ul.Uh,Ql=Ul.Vh,Zl=Ul.Wh,Jl=Ul.Xh,ec=Ul.Yh,tc=Ul.Zh,rc=Ul._h,oc=Ul.$h,nc=Ul.ai;if(l.addRunDependency=N,l.removeRunDependency=H,l.ccall=(e,t,r,o,n)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=Il(e)),t},array:e=>{var t,r,o=Ml(e.length);return t=e,r=o,S.set(t,r),o}},s=(e=>l["_"+e])(e),a=[],c=0;if(o)for(var d=0;d<o.length;d++){var u=i[r[d]];u?(0===c&&(c=ie()),a[d]=u(o[d])):a[d]=o[d]}var h,p=s(...a);return h=p,0!==c&&ne(c),p=function(e){return"string"===t?Q(e):"boolean"===t?Boolean(e):e}(h),p},l.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return S[e];case"i16":return T[e>>1];case"i32":return A[e>>2];case"i64":return I[e>>3];case"float":return M[e>>2];case"double":return R[e>>3];case"*":return F[e>>2];default:V(`invalid type for getValue: ${t}`)}},l.UTF8ToString=Q,l.specialHTMLTargets=Sl,l.FS_createPreloadedFile=Se,l.FS_unlink=e=>Te.unlink(e),l.FS_createPath=Ll,l.FS_createDevice=Dl,l.FS_createDataFile=Ce,l.FS_createLazyFile=Rl,l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return function e(r=m){function o(){l.calledRun=!0,B||(l.noFSInit||Te.initialized||Te.init(),ve.init(),Ul.Ih(),Te.ignorePermissions=!1,t(l),l.onRuntimeInitialized?.(),l.noInitialRun||function(e=[]){var t=Hl;e.unshift(b);var r=e.length,o=Ml(4*(r+1)),n=o;e.forEach((e=>{F[n>>2]=Il(e),n+=4})),F[n>>2]=0;try{var i=t(r,o);return ur(i,!0),i}catch(e){return lr(e)}}(r),function(){if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;)ee(l.postRun.shift());Z(J)}())}U>0?W=e:(function(){if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)re(l.preRun.shift());Z(te)}(),U>0?W=e:l.setStatus?(l.setStatus("Running..."),setTimeout((()=>{setTimeout((()=>l.setStatus("")),1),o()}),1)):o())}(),c});"object"==typeof e&&"object"==typeof t?(t.exports=o,t.exports.default=o):"function"==typeof define&&define.amd&&define([],(()=>o))}}),wt=u($()),kt=u(ht()),_t=u(pt()),Ct=class extends TypeError{constructor(e,t){let r;const{message:o,...n}=e,{path:i}=e;super(0===i.length?o:"At path: "+i.join(".")+" -- "+o),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>{var o;return null!=(o=r)?o:r=[e,...t()]}}};function Et(e){return"object"==typeof e&&null!=e}function St(e){return"string"==typeof e?JSON.stringify(e):""+e}function xt(e,t,r,o){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:n,branch:i}=t,{type:s}=r,{refinement:a,message:l="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+St(o)+"`"}=e;return{value:o,type:s,refinement:a,key:n[n.length-1],path:n,branch:i,...e,message:l}}function*Tt(e,t,r,o){var n;Et(n=e)&&"function"==typeof n[Symbol.iterator]||(e=[e]);for(const n of e){const e=xt(n,t,r,o);e&&(yield e)}}function*Pt(e,t,r={}){const{path:o=[],branch:n=[e],coerce:i=!1,mask:s=!1}=r,a={path:o,branch:n};if(i&&(e=t.coercer(e,a),s&&"type"!==t.type&&Et(t.schema)&&Et(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let l=!0;for(const r of t.validator(e,a))l=!1,yield[r,void 0];for(let[r,c,d]of t.entries(e,a)){const t=Pt(c,d,{path:void 0===r?o:[...o,r],branch:void 0===r?n:[...n,c],coerce:i,mask:s});for(const o of t)o[0]?(l=!1,yield[o[0],void 0]):i&&(c=o[1],void 0===r?e=c:e instanceof Map?e.set(r,c):e instanceof Set?e.add(c):Et(e)&&(e[r]=c))}if(l)for(const r of t.refiner(e,a))l=!1,yield[r,void 0];l&&(yield[void 0,e])}var At=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:r,validator:o,refiner:n,coercer:i=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=i,this.validator=o?(e,t)=>Tt(o(e,t),t,this,e):()=>[],this.refiner=n?(e,t)=>Tt(n(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const r=Ft(e,t);if(r[0])throw r[0]}(e,this)}create(e){return function(e,t){const r=Ft(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}(e,this)}is(e){return function(e,t){const r=Ft(e,t);return!r[0]}(e,this)}mask(e){return function(e,t){const r=Ft(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(e,this)}validate(e,t={}){return Ft(e,this,t)}};function Ft(e,t,r={}){const o=Pt(e,t,r),n=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(o);if(n[0]){return[new Ct(n[0],(function*(){for(const e of o)e[0]&&(yield e[0])})),void 0]}return[void 0,n[1]]}function Mt(e,t){return new At({type:e,schema:null,validator:t})}function It(e){return new At({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,o]of t.entries())yield[r,o,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+St(e)})}function Lt(){return Mt("boolean",(e=>"boolean"==typeof e))}function Rt(){return Mt("func",(e=>"function"==typeof e||"Expected a function, but received: "+St(e)))}function Dt(){return Mt("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+St(e)))}function Bt(){return Mt("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+St(e)))}function Ot(e){const t=e?Object.keys(e):[],r=Mt("never",(()=>!1));return new At({type:"object",schema:e||null,*entries(o){if(e&&Et(o)){const n=new Set(Object.keys(o));for(const r of t)n.delete(r),yield[r,o[r],e[r]];for(const e of n)yield[e,o[e],r]}},validator:e=>Et(e)||"Expected an object, but received: "+St(e),coercer:e=>Et(e)?{...e}:e})}function jt(e){return new At({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function $t(){return Mt("string",(e=>"string"==typeof e||"Expected a string, but received: "+St(e)))}function qt(e){const t=Object.keys(e);return new At({type:"type",schema:e,*entries(r){if(Et(r))for(const o of t)yield[o,r[o],e[o]]},validator:e=>Et(e)||"Expected an object, but received: "+St(e)})}function Ut(e){const t=e.map((e=>e.type)).join(" | ");return new At({type:"union",schema:null,coercer:(t,r)=>(e.find((e=>{const[r]=e.validate(t,{coerce:!0});return!r}))||Mt("unknown",(()=>!0))).coercer(t,r),validator(r,o){const n=[];for(const t of e){const[...e]=Pt(r,t,o),[i]=e;if(!i[0])return[];for(const[t]of e)t&&n.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+St(r),...n]}})}function Wt(e,t,r={}){const{exclusive:o}=r;return Vt(e,"max",(r=>o?r<t:r<=t||"Expected a "+e.type+" less than "+(o?"":"or equal to ")+t+" but received `"+r+"`"))}function Nt(e,t,r={}){const{exclusive:o}=r;return Vt(e,"min",(r=>o?r>t:r>=t||"Expected a "+e.type+" greater than "+(o?"":"or equal to ")+t+" but received `"+r+"`"))}function Ht(e){return Vt(e,"nonempty",(t=>{const r=function(e){return e instanceof Map||e instanceof Set?e.size:e.length}(t);return r>0||"Expected a nonempty "+e.type+" but received an empty one"}))}function Vt(e,t,r){return new At({...e,*refiner(o,n){yield*e.refiner(o,n);const i=Tt(r(o,n),n,e,o);for(const e of i)yield{...e,refinement:t}}})}var zt={Png:"image/png",Jpeg:"image/jpeg",WebP:"image/webp",Tga:"image/x-tga",Wav:"audio/wav",Mp4:"video/mp4",QuickTime:"video/quicktime",Binary:"application/octet-stream",Pdf:"application/pdf",Zip:"application/zip"};function Gt(e,t,r){const[o]=Ft(t,r);if(o)throw o.message=`Error in argument '${e}': ${o.message}`,o;return!0}function Xt(){const e=/image\/(png|jpeg|webp|x-tga)/;return Mt("ImageMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "image/png", "image/jpeg", "image/webp" or "image/x-tga", but got "${t}"`}))}function Yt(){const e=/audio\/(wav)/;return Mt("AudioMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected "audio/wav", but got "${t}"`}))}function Kt(){const e=/video\/(mp4|quicktime)/;return Mt("VideoMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "video/mp4" or "video/quicktime", but got "${t}"`}))}function Qt(){const e=/application\/(octet-stream|pdf)/;return Mt("ApplicationMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "application/octet-stream" or "application/pdf", but got "${t}"`}))}function Zt(){const e=["Free","VerticalStack","HorizontalStack","DepthStack"];return Mt("SceneLayout",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function Jt(){const e=["Linear","EaseIn","EaseOut","EaseInOut","EaseInQuart","EaseOutQuart","EaseInOutQuart","EaseInQuint","EaseOutQuint","EaseInOutQuint","EaseInBack","EaseOutBack","EaseInOutBack","EaseInSpring","EaseOutSpring","EaseInOutSpring"];return Mt("AnimationEasing",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function er(){return Mt("AbortSignal",(e=>{if("undefined"!=typeof AbortSignal&&e instanceof AbortSignal)return!0;return!("object"!=typeof e||null===e||"boolean"!=typeof e.aborted||"function"!=typeof e.addEventListener)||{message:`expected an AbortSignal-like object, but got "${Object.prototype.toString.call(e)}"`}}))}function tr(){const e=["Absolute","Percent","Auto"];return Mt("SizeMode",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function rr(){const e=["Absolute","Percent","Auto"];return Mt("PositionMode",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function or(){const e=["slide","pan","fade","blur","grow","zoom","pop","wipe","baseline","crop_zoom","spin","spin_loop","fade_loop","blur_loop","pulsating_loop","breathing_loop","jump_loop","squeeze_loop","sway_loop","typewriter_text","block_swipe_text","spread_text","merge_text","ken_burns","//ly.img.ubq/animation/slide","//ly.img.ubq/animation/pan","//ly.img.ubq/animation/fade","//ly.img.ubq/animation/blur","//ly.img.ubq/animation/grow","//ly.img.ubq/animation/zoom","//ly.img.ubq/animation/pop","//ly.img.ubq/animation/wipe","//ly.img.ubq/animation/baseline","//ly.img.ubq/animation/crop_zoom","//ly.img.ubq/animation/spin","//ly.img.ubq/animation/spin_loop","//ly.img.ubq/animation/fade_loop","//ly.img.ubq/animation/blur_loop","//ly.img.ubq/animation/pulsating_loop","//ly.img.ubq/animation/breathing_loop","//ly.img.ubq/animation/jump_loop","//ly.img.ubq/animation/squeeze_loop","//ly.img.ubq/animation/sway_loop","//ly.img.ubq/animation/typewriter_text","//ly.img.ubq/animation/block_swipe_text","//ly.img.ubq/animation/spread_text","//ly.img.ubq/animation/merge_text","//ly.img.ubq/animation/ken_burns"];return Mt("AnimationType",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function nr(){return Ut([qt({r:Bt(),g:Bt(),b:Bt(),a:Bt()}),qt({c:Bt(),m:Bt(),y:Bt(),k:Bt(),tint:Bt()}),qt({name:$t(),tint:Bt(),externalReference:$t()})])}function ir(){return qt({type:or(),duration:Bt(),easing:jt(Jt())})}function sr(e){if(e.isValid()){const t=e.value();return e.delete(),t}{const t=e.error(),r=t.publicMessage();throw t.delete(),e.delete(),new Error(r)}}function ar(e){return new Promise(((t,r)=>{e((e=>{try{const r=sr(e);t(r)}catch(e){r(e)}}))}))}var lr=(e,t=!0)=>{const r=[];for(let t=0;t<e.size();t+=1)r.push(e.get(t));return t&&e.delete(),r},cr=new WeakMap,dr={assets:[],total:0,currentPage:0,nextPage:void 0},AssetAPI=class{#e;constructor(e){this.#e=e}#t=new Set;#r=new Set;unstable_registerApplyAssetMiddleware(e){return this.#t.add(e),()=>{this.#t.delete(e)}}unstable_registerApplyAssetToBlockMiddleware(e){return this.#r.add(e),()=>{this.#r.delete(e)}}addSource(e){const t=e.getSupportedMimeTypes?.bind(e),r=e.getGroups?.bind(e),o=e.fetchAsset?.bind(e),n=e.applyAsset?.bind(e),i=e.applyAssetToBlock?.bind(e),s=e.applyAssetProperty?.bind(e),a=e.addAsset?.bind(e),l=e.removeAsset?.bind(e),c=e.credits,d=e.license;sr(this.#e.addAssetSource(e.id,(async(t,r)=>{try{const o={...t,sortKey:t.sortKey,sortingOrder:t.sortingOrder,sortActiveFirst:t.sortActiveFirst,tags:lr(t.tags),groups:lr(t.groups),excludeGroups:lr(t.excludeGroups)},n=await e.findAssets(o);if(n){const t={...n,assets:n.assets.map((t=>ur(t,e.id)))};r.invoke(t)}else r.invoke(dr)}catch(e){r.invoke(e.message??"Unknown error in user-defined `findAssets`")}}),o?async(t,r)=>{try{const n=await o(t);null===n?r.invoke(null):r.invoke(ur(n,e.id))}catch(e){r.invoke(e.message??"Unknown error in user-defined `fetchAsset`")}}:null,r?async e=>{try{const t=await r();e.invoke(t)}catch(t){e.invoke(t.message??"Unknown error in user-defined `getGroups`")}}:null,c?()=>({name:c.name,url:c.url??""}):null,d?()=>({name:d.name,url:d.url??""}):null,t?()=>t()??[]:null,n?async(e,t)=>{try{const r=await n(this.#o(e));t.invoke(r)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,i?async(e,t,r)=>{try{await i(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null,s?async(e,t,r)=>{try{await s(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetProperty`")}}:null,a?async e=>{a(e)}:null,l?async e=>{l(e)}:null)),this.#n(e.id,e)}addLocalSource(e,t,r,o){sr(this.#e.addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const o=await r(this.#o(e));t.invoke(o)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,o?async(e,t,r)=>{try{await o(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null))}addLocalAssetSourceFromJSONString(e,t){return Gt("contentJSON",e,$t()),Gt("basePath",t,jt($t())),new Promise(((r,o)=>{try{r(sr(this.#e.addLocalAssetSourceFromJSONString(e,t)))}catch(e){o(e)}}))}removeSource(e){sr(this.#e.removeAssetSource(e)),this.#i(e)}findAllSources(){return lr(this.#e.findAllAssetSources())}findAssets(e,t){return new Promise(((r,o)=>{let n=t?.tags??[];Array.isArray(n)||(n=[n]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:n,groups:t?.groups??[],excludeGroups:t?.excludeGroups??[],locale:t?.locale??"",sortingOrder:t?.sortingOrder??"None",sortKey:t?.sortKey??"",sortActiveFirst:t?.sortActiveFirst??!1};this.#e.findAssetSourceAssets(e,i,(e=>{try{const t=sr(e);r({...t,nextPage:-1===t.nextPage?void 0:t.nextPage})}catch(e){o(e)}}))}))}async fetchAsset(e,t){return Gt("sourceId",e,$t()),Gt("assetId",t,$t()),new Promise(((r,o)=>{this.#e.fetchAssetSourceAsset(e,t,(e=>{try{const t=sr(e);r(t||null)}catch(e){o(e)}}))}))}#o(e){const t={...e};return 0===t.groups?.length&&delete t.groups,t.locale||delete t.locale,t.label||delete t.label,0===t.tags?.length&&delete t.tags,t.credits?.name||t.credits?.url?t.credits.url||delete t.credits.url:delete t.credits,t.license?.name||t.license?.url?t.license.url||delete t.license.url:delete t.license,t.utm?.source||t.utm?.medium?(t.utm.source||delete t.utm.source,t.utm.medium||delete t.utm.medium):delete t.utm,t}async getGroups(e){return ar((t=>this.#e.getAssetSourceGroups(e,t))).then((e=>lr(e)))}getSupportedMimeTypes(e){return lr(sr(this.#e.getAssetSourceSupportedMimeTypes(e)))}getCredits(e){const t=sr(this.#e.getAssetSourceCredits(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}getLicense(e){const t=sr(this.#e.getAssetSourceLicense(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}canManageAssets(e){return!!cr.get(this.#e)?.get(e)?.canManageAssets}addAssetToSource(e,t){sr(this.#e.addAssetToSource(e,t))}removeAssetFromSource(e,t){sr(this.#e.removeAssetFromSource(e,t))}#n(e,t){cr.has(this.#e)||cr.set(this.#e,new Map),t.canManageAssets&&console.warn(`\nDEPRECATION WARNING:\n\n'canManageAssets' flag was found for asset source with the id '${e}'.\n\nThis flag is deprecated and will be removed in the next version. If you have used it to control if an upload buttons is rendered in the asset library, use the 'canAdd' options on an asset library entry. See documentation here: https://img.ly/docs/cesdk/ui/guides/customize-asset-library/`),cr.get(this.#e).set(e,{canManageAssets:t.canManageAssets})}#i(e){cr.get(this.#e)?.delete(e)}async apply(e,t){const r=(e,t)=>new Promise(((r,o)=>{this.#e.applyAssetSourceAsset(e,ur(t,e),(e=>{try{const t=sr(e);this.#e.isValid(t)?r(t):r(void 0)}catch(e){o(e)}}))}));if(this.#t.size>0){return Array.from(this.#t).reduce(((e,t)=>(r,o)=>t(r,o,e)),r)(e,t)}return r(e,t)}async applyToBlock(e,t,r){const o=(e,t,r)=>ar((o=>this.#e.applyAssetSourceAssetToBlock(e,ur(t,e),r,o)));if(this.#r.size>0){return Array.from(this.#r).reduce(((e,t)=>(r,o,n)=>t(r,o,n,e)),o)(e,t,r)}return o(e,t,r)}async applyProperty(e,t,r){return ar((o=>this.#e.applyAssetSourceProperty(e,ur(t,e),r,o)))}async defaultApplyAsset(e){return new Promise(((t,r)=>{this.#e.defaultApplyAsset(ur(e,""),(e=>{try{const r=sr(e);this.#e.isValid(r)?t(r):t(void 0)}catch(e){r(e)}}))}))}async defaultApplyAssetToBlock(e,t){return ar((r=>this.#e.defaultApplyAssetToBlock(ur(e,""),t,r)))}onAssetSourceAdded=e=>{const t=this.#e.subscribeToAssetSourceAdded(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};onAssetSourceRemoved=e=>{const t=this.#e.subscribeToAssetSourceRemoved(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};onAssetSourceUpdated=e=>{const t=this.#e.subscribeToAssetSourceUpdated(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};assetSourceContentsChanged(e){sr(this.#e.assetSourceContentsChanged(e))}dispose(){cr.delete(this.#e)}};function ur(e,t){return"context"in e&&e.context.sourceId===t&&"active"in e?e:{...e,active:e.active??!1,context:{sourceId:t}}}var hr=Symbol("PROXY");function pr(e){return(t,r)=>{Object.defineProperty(t,hr,{value:{type:"getter",...e},writable:!1})}}function fr(e,t){Object.defineProperty(e,hr,{value:{type:"setter"},writable:!1})}var gr,mr,br,yr,vr,wr,kr,_r,Cr,Er,Sr,xr,Tr,Pr,Ar,Fr,Mr,Ir,Lr,Rr,Dr,Br,Or,jr,$r,qr,Ur,Wr,Nr,Hr,Vr={};function zr(e,t,r){return Object.hasOwnProperty.call(e,t)?()=>{e[t]=r}:()=>{delete e[t]}}jr=[fr],Or=[fr],Br=[fr],Dr=[fr],Rr=[fr],Lr=[fr],Ir=[fr],Mr=[pr({disabledInModes:["Playback"]})],Fr=[fr],Ar=[fr],Pr=[pr({disabledInModes:["Playback"]})],Tr=[fr],xr=[pr({disabledInModes:["Playback"]})],Sr=[pr({disabledInModes:["Playback"]})],Er=[pr({disabledInModes:["Playback"]})],Cr=[pr({disabledInModes:["Playback"]})],_r=[pr({disabledInModes:["Playback"]})],kr=[fr],wr=[pr({disabledInModes:["Playback"]})],vr=[fr],yr=[fr],br=[fr],mr=[pr({disabledInModes:["Playback"]})],gr=[fr];var Gr,Xr,Yr,Kr,Qr,Zr,Jr,eo,to,ro,oo,no,io,so,ao,lo,co,uo,ho,po,fo,go,mo,bo,yo,vo,wo,ko,_o,Co,Eo,So,xo,To,Po,Ao,Fo,Mo,Io,Lo,Ro,Do,Bo,Oo,jo,$o,qo,Uo,Wo,No,Ho,Vo,zo,Go,Xo,Yo,Ko,Qo,Zo,Jo,en,tn,rn,on,nn,sn,an,ln,cn,dn,un,hn,pn,fn,gn,mn,bn,yn,vn,wn,kn,_n,Cn,En,Sn,xn,Tn,Pn,An,Fn,Mn,In,Ln,Rn,Dn,Bn,On,jn,$n,qn,Un,Wn,Nn,Hn,Vn,zn,Gn,Xn,Yn,Kn,Qn,Zn,Jn,ei,ti,ri,oi,ni,ii,si,ai,li,ci,di,ui,hi,pi,fi,gi,mi,bi,yi,vi,wi,ki,_i,Ci,Ei,Si,xi,Ti,Pi,Ai,Fi,Mi,Ii,Li,Ri,Di,Bi,Oi,ji,$i,qi,Ui,Wi,Ni,Hi,Vi,zi,Gi,Xi,Yi,Ki,Qi,Zi,Ji,es,ts,rs,os,ns,is,ss,as,ls,cs,ds,us,hs,ps,fs,gs,ms,bs,ys,vs,ws,ks,_s,Cs,Es,Ss,xs,Ts,Ps,As,Fs,Ms,Is,Ls,Rs,Ds,Bs,Os,js,$s,qs,Us,Ws,Ns,Hs,Vs,zs,Gs,Xs,Ys,Ks,Qs,Zs,Js,ea,ta,ra,oa,na,ia,sa,aa,la,ca,da,ua,ha,pa,fa,ga,ma,ba,ya,va,wa,ka,_a,Ca,Ea,Sa,xa,Ta,Pa,Aa,Fa,Ma,Ia,La,Ra,Da,Ba,Oa,ja,$a,qa,Ua,Wa,Na,Ha,Va,za,Ga,Xa,Ya,Ka,Qa,Za,Ja,el,tl,rl,ol,nl,il,sl,al,ll,cl,dl,ul,hl,pl,fl,gl,ml,bl,yl,vl,wl,kl,_l,Cl,El,Sl,SceneAPI=class{constructor(e,t=!1){b(Ur,5,this),C(this,Wr),C(this,$r),C(this,qr),v(this,"onZoomLevelChanged",(e=>{const t=_(this,$r).subscribeToZoomLevel(e);return()=>{_(this,$r).isDeleted()||sr(_(this,$r).unsubscribe(t))}})),v(this,"onActiveChanged",(e=>{const t=_(this,$r).subscribeToActiveSceneChange(e);return()=>{_(this,$r).isDeleted()||sr(_(this,$r).unsubscribe(t))}})),E(this,$r,e),t||E(this,qr,new BlockAPI(e))}async loadFromString(e){return Gt("sceneContent",e,$t()),ar((t=>_(this,$r).loadSceneFromString(e,t)))}async loadFromURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).loadSceneFromURL(e,t)))}async loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).loadSceneFromArchiveURL(e,t)))}async saveToString(e=["blob","bundle","file","http","https","opfs"]){const t=this.get();if(null==t)throw new Error("No scene available.");return ar((r=>{_(this,$r).saveSceneToString(t,r,e)}))}async saveToArchive(){return new Promise(((e,t)=>{const r=this.get();null==r?t(new Error("No scene available.")):_(this,$r).saveSceneToArchive(r,(r=>{"error"in r?t(r.error):e(new Blob([r],{type:"application/zip"}))}))}))}create(e="Free",t){Gt("sceneLayout",e,Zt());const r=sr(_(this,$r).createScene(e));return t?(S(this,Wr,Nr).call(this,r,t),r):r}createVideo(e){const t=S(this,Wr,Hr).call(this);return e?(S(this,Wr,Nr).call(this,t,e),t):t}createFromImage(e,t=300,r=1,o="Free",n=0,i=!1){return Gt("url",e,$t()),Gt("dpi",t,Nt(Bt(),0)),Gt("pixelScaleFactor",r,Nt(Bt(),0)),Gt("sceneLayout",o,Zt()),ar((s=>_(this,$r).createSceneFromImage(e,t,r,o,n,i,s)))}createFromVideo(e){return Gt("url",e,$t()),ar((t=>_(this,$r).createSceneFromVideo(e,t)))}get(){const e=sr(_(this,$r).findByType("scene")),t=lr(e);return t.length>0?t[0]:null}async applyTemplateFromString(e){return Gt("content",e,$t()),ar((t=>_(this,$r).applyTemplateFromString(e,t)))}async applyTemplateFromURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).applyTemplateFromURL(e,t)))}getMode(){const e=this.get();return sr(_(this,$r).getSceneMode(e))}setDesignUnit(e){Gt("designUnit",e,function(){const e=["Pixel","Millimeter","Inch"];return Mt("DesignUnit",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}());const t=this.get();sr(_(this,$r).setDesignUnit(t,e))}getDesignUnit(){const e=this.get();return sr(_(this,$r).getDesignUnit(e))}getPages(){return lr(sr(_(this,$r).getPages()))}getCurrentPage(){const e=this.get();if(null==e)return null;const t=_(this,$r).getCurrentPage(e);return t.isValid()?sr(t):null}findNearestToViewPortCenterByType(e){Gt("type",e,$t());const t=this.get();if(null==t)return[];const r=sr(_(this,$r).findNearestToViewPortCenterByType(t,e));return lr(r)}findNearestToViewPortCenterByKind(e){Gt("kind",e,$t());const t=this.get();if(null==t)return[];const r=sr(_(this,$r).findNearestToViewPortCenterByKind(t,e));return lr(r)}setZoomLevel(e=1){const t=this.get();Gt("zoomLevel",e,Nt(Bt(),0)),_(this,$r).setZoomLevel(t,e)}getZoomLevel(){const e=this.get();return sr(_(this,$r).getZoomLevel(e))}async zoomToBlock(e,t,r,o,n){Gt("id",e,Dt());try{Gt("options",t,jt(Ot({padding:jt(Ut([Bt(),Ot({x:jt(Bt()),y:jt(Bt())}),Ot({top:jt(Bt()),bottom:jt(Bt()),left:jt(Bt()),right:jt(Bt())})])),animate:jt(Ut([Lt(),Ot({duration:jt(Nt(Bt(),0)),easing:jt(Jt()),interruptible:jt(Lt())})]))})))}catch(e){try{Gt("paddingLeft",t,jt(Bt())),Gt("paddingTop",r,jt(Bt())),Gt("paddingRight",o,jt(Bt())),Gt("paddingBottom",n,jt(Bt()))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.scene.zoomToBlock(id, paddingLeft, paddingTop, paddingRight, paddingBottom)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.scene.zoomToBlock(id, options)\n${e.message}`)}}const i="object"==typeof t?t:{padding:{left:t??0,top:r??0,right:o??0,bottom:n??0}},s={left:0,top:0,right:0,bottom:0};if(null!=i.padding&&("number"==typeof i.padding?(s.left=i.padding,s.top=i.padding,s.right=i.padding,s.bottom=i.padding):(("x"in i.padding||"y"in i.padding)&&(s.left=i.padding.x??s.left,s.right=i.padding.x??s.right,s.top=i.padding.y??s.top,s.bottom=i.padding.y??s.bottom),("left"in i.padding||"top"in i.padding||"right"in i.padding||"bottom"in i.padding)&&(s.left=i.padding.left??s.left,s.top=i.padding.top??s.top,s.right=i.padding.right??s.right,s.bottom=i.padding.bottom??s.bottom))),null!=i.animate){const t={duration:.5,easing:"EaseInOut",interruptible:!1};return"object"==typeof i.animate&&(t.duration=i.animate.duration??t.duration,t.easing=i.animate.easing??t.easing,t.interruptible=i.animate.interruptible??t.interruptible),new Promise((r=>{_(this,$r).zoomToBlockWithAnimation(e,s.left,s.top,s.right,s.bottom,t.duration,t.easing,t.interruptible,(()=>{r()}))}))}return ar((t=>_(this,$r).zoomToBlock(e,s.left,s.top,s.right,s.bottom,t)))}enableZoomAutoFit(e,t,r=0,o=0,n=0,i=0){return Gt("id",e,Dt()),Gt("axis",t,function(){const e=["Horizontal","Vertical","Both"];return Mt("ZoomAutoFitAxis",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),"Horizontal"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",o,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,0,o,0))):"Vertical"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",o,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,0,r,0,o))):(Gt("paddingLeft",r,Bt()),Gt("paddingTop",o,Bt()),Gt("paddingRight",n,Bt()),Gt("paddingBottom",i,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,o,n,i)))}disableZoomAutoFit(e){return Gt("blockOrScene",e,Dt()),sr(_(this,$r).disableZoomAutoFit(e))}isZoomAutoFitEnabled(e){return Gt("blockOrScene",e,Dt()),sr(_(this,$r).isZoomAutoFitEnabled(e))}unstable_enableCameraPositionClamping(e,t=0,r=0,o=0,n=0,i=0,s=0,a=0,l=0){return Gt("ids",e,It(Bt())),Gt("paddingLeft",t,Bt()),Gt("paddingTop",r,Bt()),Gt("paddingRight",o,Bt()),Gt("paddingBottom",n,Bt()),Gt("scaledPaddingLeft",t,Bt()),Gt("scaledPaddingTop",r,Bt()),Gt("scaledPaddingRight",o,Bt()),Gt("scaledPaddingBottom",n,Bt()),sr(_(this,$r).unstable_enableCameraPositionClamping(e,t,r,o,n,i,s,a,l))}unstable_disableCameraPositionClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_disableCameraPositionClamping(e))}unstable_isCameraPositionClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_isCameraPositionClampingEnabled(e))}unstable_enableCameraZoomClamping(e,t=-1,r=-1,o=0,n=0,i=0,s=0){return Gt("ids",e,It(Bt())),Gt("minZoomLimit",t,Bt()),Gt("maxZoomLimit",r,Bt()),Gt("paddingLeft",o,Bt()),Gt("paddingTop",n,Bt()),Gt("paddingRight",i,Bt()),Gt("paddingBottom",s,Bt()),sr(_(this,$r).unstable_enableCameraZoomClamping(e,t,r,o,n,i,s))}unstable_disableCameraZoomClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_disableCameraZoomClamping(e))}unstable_isCameraZoomClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_isCameraZoomClampingEnabled(e))}setPlaying(e){const t=this.getCurrentPage();if(null==t)throw new Error("No page to play");_(this,$r).setPlaying(t,e)}};function xl(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}function Tl(e){return"name"in e&&void 0!==e.name}function Pl(e){return"c"in e&&"m"in e&&"y"in e&&"k"in e&&void 0!==e.c&&void 0!==e.m&&void 0!==e.y&&void 0!==e.k}Ur=h(null),$r=new WeakMap,qr=new WeakMap,Wr=new WeakSet,Nr=function(e,t){if(!_(this,qr))throw new Error("Utility functions not allowed to be called inside utility functions.");let r=0,o=0;if("number"==typeof t.page.size)r=t.page.size,o=t.page.size;else{if("object"!=typeof t.page.size)return;r=t.page.size.width,o=t.page.size.height}const n=_(this,qr).create("page");if(_(this,qr).appendChild(e,n),_(this,qr).setSize(n,r,o),t.page.color){const e=_(this,qr).createFill("color");_(this,qr).setFill(n,e),_(this,qr).setColor(n,"fill/solid/color",t.page.color)}},Hr=function(){return sr(_(this,$r).createVideoScene())},y(Ur,1,"loadFromString",jr,SceneAPI),y(Ur,1,"loadFromURL",Or,SceneAPI),y(Ur,1,"loadFromArchiveURL",Br,SceneAPI),y(Ur,1,"create",Dr,SceneAPI),y(Ur,1,"createVideo",Rr,SceneAPI),y(Ur,1,"createFromImage",Lr,SceneAPI),y(Ur,1,"createFromVideo",Ir,SceneAPI),y(Ur,1,"get",Mr,SceneAPI),y(Ur,1,"applyTemplateFromString",Fr,SceneAPI),y(Ur,1,"applyTemplateFromURL",Ar,SceneAPI),y(Ur,1,"getMode",Pr,SceneAPI),y(Ur,1,"setDesignUnit",Tr,SceneAPI),y(Ur,1,"getDesignUnit",xr,SceneAPI),y(Ur,1,"getPages",Sr,SceneAPI),y(Ur,1,"getCurrentPage",Er,SceneAPI),y(Ur,1,"findNearestToViewPortCenterByType",Cr,SceneAPI),y(Ur,1,"findNearestToViewPortCenterByKind",_r,SceneAPI),y(Ur,1,"setZoomLevel",kr,SceneAPI),y(Ur,1,"getZoomLevel",wr,SceneAPI),y(Ur,1,"zoomToBlock",vr,SceneAPI),y(Ur,1,"enableZoomAutoFit",yr,SceneAPI),y(Ur,1,"disableZoomAutoFit",br,SceneAPI),y(Ur,1,"isZoomAutoFitEnabled",mr,SceneAPI),y(Ur,1,"setPlaying",gr,SceneAPI),m(Ur,SceneAPI),(e=>{let t;var r;(r=t=e.ColorSpace||(e.ColorSpace={}))[r.sRGB=0]="sRGB",r[r.CMYK=1]="CMYK",r[r.SpotColor=2]="SpotColor",e.toColor=function(e){switch(e.colorSpace){case 0:return{r:e.components.x,g:e.components.y,b:e.components.z,a:e.components.w};case 2:return{name:e.spotColorName,tint:e.tint,externalReference:e.externalReference};case 1:return{c:e.components.x,m:e.components.y,y:e.components.z,k:e.components.w,tint:e.tint};default:throw new Error("Unknown color space!")}},e.fromColor=function(e){if(xl(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(Pl(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(Tl(e))return{colorSpace:2,components:{x:0,y:0,z:0,w:0},spotColorName:e.name,tint:e.tint,externalReference:e.externalReference};throw new Error("Unknown color space!")}})(Gr||(Gr={})),wl=[fr],vl=[fr],yl=[fr],bl=[fr],ml=[fr],gl=[pr({disabledInModes:["Playback"]})],fl=[pr({disabledInModes:["Playback"]})],pl=[fr],hl=[fr],ul=[fr],dl=[pr({disabledInModes:["Playback"]})],cl=[pr({disabledInModes:["Playback"]})],ll=[pr({disabledInModes:["Playback"]})],al=[fr],sl=[fr],il=[fr],nl=[fr],ol=[pr({disabledInModes:["Playback"]})],rl=[fr],tl=[fr],el=[pr({disabledInModes:["Playback"]})],Ja=[pr({disabledInModes:["Playback"]})],Za=[pr({disabledInModes:["Playback"]})],Qa=[pr({disabledInModes:["Playback"]})],Ka=[pr({disabledInModes:["Playback"]})],Ya=[pr({disabledInModes:["Playback"]})],Xa=[pr({disabledInModes:["Playback"]})],Ga=[fr],za=[pr({disabledInModes:["Playback"]})],Va=[fr],Ha=[pr({disabledInModes:["Playback"]})],Na=[fr],Wa=[pr({disabledInModes:["Playback"]})],Ua=[fr],qa=[pr({disabledInModes:["Playback"]})],$a=[fr],ja=[pr({disabledInModes:["Playback"]})],Oa=[pr({disabledInModes:["Playback"]})],Ba=[pr({disabledInModes:["Playback"]})],Da=[pr({disabledInModes:["Playback"]})],Ra=[fr],La=[fr],Ia=[fr],Ma=[fr],Fa=[fr],Aa=[fr],Pa=[pr({disabledInModes:["Playback"]})],Ta=[pr({disabledInModes:["Playback"]})],xa=[fr],Sa=[fr],Ea=[fr],Ca=[fr],_a=[pr({disabledInModes:["Playback"]})],ka=[fr],wa=[pr({disabledInModes:["Playback"]})],va=[pr({disabledInModes:["Playback"]})],ya=[fr],ba=[fr],ma=[pr({disabledInModes:["Playback"]})],ga=[pr({disabledInModes:["Playback"]})],fa=[pr({disabledInModes:["Playback"]})],pa=[pr({disabledInModes:["Playback"]})],ha=[fr],ua=[fr],da=[fr],ca=[fr],la=[fr],aa=[fr],sa=[pr({disabledInModes:["Playback"]})],ia=[pr({disabledInModes:["Playback"]})],na=[pr({disabledInModes:["Playback"]})],oa=[pr({disabledInModes:["Playback"]})],ra=[fr],ta=[pr({disabledInModes:["Playback"]})],ea=[fr],Js=[fr],Zs=[pr({disabledInModes:["Playback"]})],Qs=[pr({disabledInModes:["Playback"]})],Ks=[pr({disabledInModes:["Playback"]})],Ys=[fr],Xs=[fr],Gs=[pr({disabledInModes:["Playback"]})],zs=[pr({disabledInModes:["Playback"]})],Vs=[pr({disabledInModes:["Playback"]})],Hs=[pr({disabledInModes:["Playback"]})],Ns=[pr({disabledInModes:["Playback"]})],Ws=[pr({disabledInModes:["Playback"]})],Us=[fr],qs=[fr],$s=[pr({disabledInModes:["Playback"]})],js=[fr],Os=[fr],Bs=[fr],Ds=[fr],Rs=[fr],Ls=[fr],Is=[pr({disabledInModes:["Playback"]})],Ms=[pr({disabledInModes:["Playback"]})],Fs=[pr({disabledInModes:["Playback"]})],As=[pr({disabledInModes:["Playback"]})],Ps=[pr({disabledInModes:["Playback"]})],Ts=[fr],xs=[pr({disabledInModes:["Playback"]})],Ss=[fr],Es=[pr({disabledInModes:["Playback"]})],Cs=[fr],_s=[pr({disabledInModes:["Playback"]})],ks=[fr],ws=[pr({disabledInModes:["Playback"]})],vs=[fr],ys=[pr({disabledInModes:["Playback"]})],bs=[fr],ms=[pr({disabledInModes:["Playback"]})],gs=[fr],fs=[pr({disabledInModes:["Playback"]})],ps=[fr],hs=[pr({disabledInModes:["Playback"]})],us=[pr({disabledInModes:["Playback"]})],ds=[fr],cs=[pr({disabledInModes:["Playback"]})],ls=[pr({disabledInModes:["Playback"]})],as=[fr],ss=[fr],is=[fr],ns=[fr],os=[pr({disabledInModes:["Playback"]})],rs=[fr],ts=[fr],es=[fr],Ji=[fr],Zi=[fr],Qi=[fr],Ki=[fr],Yi=[pr({disabledInModes:["Playback"]})],Xi=[pr({disabledInModes:["Playback"]})],Gi=[pr({disabledInModes:["Playback"]})],zi=[pr({disabledInModes:["Playback"]})],Vi=[pr({disabledInModes:["Playback"]})],Hi=[pr({disabledInModes:["Playback"]})],Ni=[fr],Wi=[fr],Ui=[fr],qi=[fr],$i=[pr({disabledInModes:["Playback"]})],ji=[fr],Oi=[pr({disabledInModes:["Playback"]})],Bi=[pr({disabledInModes:["Playback"]})],Di=[fr],Ri=[fr],Li=[pr({disabledInModes:["Playback"]})],Ii=[fr],Mi=[pr({disabledInModes:["Playback"]})],Fi=[fr],Ai=[pr()],Pi=[fr],Ti=[fr],xi=[fr],Si=[fr],Ei=[pr({disabledInModes:["Playback"]})],Ci=[fr],_i=[fr],ki=[pr({disabledInModes:["Playback"]})],wi=[fr],vi=[pr({disabledInModes:["Playback"]})],yi=[fr],bi=[pr({disabledInModes:["Playback"]})],mi=[fr],gi=[pr({disabledInModes:["Playback"]})],fi=[fr],pi=[pr({disabledInModes:["Playback"]})],hi=[fr],ui=[fr],di=[pr({disabledInModes:["Playback"]})],ci=[pr({disabledInModes:["Playback"]})],li=[fr],ai=[pr({disabledInModes:["Playback"]})],si=[fr],ii=[pr({disabledInModes:["Playback"]})],ni=[fr],oi=[pr({disabledInModes:["Playback"]})],ri=[fr],ti=[pr({disabledInModes:["Playback"]})],ei=[fr],Jn=[pr({disabledInModes:["Playback"]})],Zn=[fr],Qn=[fr],Kn=[pr({disabledInModes:["Playback"]})],Yn=[pr({disabledInModes:["Playback"]})],Xn=[fr],Gn=[pr({disabledInModes:["Playback"]})],zn=[fr],Vn=[pr({disabledInModes:["Playback"]})],Hn=[fr],Nn=[pr({disabledInModes:["Playback"]})],Wn=[fr],Un=[pr({disabledInModes:["Playback"]})],qn=[fr],$n=[pr({disabledInModes:["Playback"]})],jn=[fr],On=[fr],Bn=[fr],Dn=[fr],Rn=[fr],Ln=[fr],In=[pr({disabledInModes:["Playback"]})],Mn=[fr],Fn=[pr({disabledInModes:["Playback"]})],An=[fr],Pn=[pr({disabledInModes:["Playback"]})],Tn=[fr],xn=[pr({disabledInModes:["Playback"]})],Sn=[pr({disabledInModes:["Playback"]})],En=[fr],Cn=[pr({disabledInModes:["Playback"]})],_n=[pr({disabledInModes:["Playback"]})],kn=[fr],wn=[fr],vn=[fr],yn=[fr],bn=[pr({disabledInModes:["Playback"]})],mn=[pr({disabledInModes:["Playback"]})],gn=[pr({disabledInModes:["Playback"]})],fn=[pr({disabledInModes:["Playback"]})],pn=[pr({disabledInModes:["Playback"]})],hn=[pr({disabledInModes:["Playback"]})],un=[pr({disabledInModes:["Playback"]})],dn=[fr],cn=[pr({disabledInModes:["Playback"]})],ln=[fr],an=[fr],sn=[pr({disabledInModes:["Playback"]})],nn=[fr],on=[pr({disabledInModes:["Playback"]})],rn=[fr],tn=[pr({disabledInModes:["Playback"]})],en=[fr],Jo=[pr({disabledInModes:["Playback"]})],Zo=[fr],Qo=[pr({disabledInModes:["Playback"]})],Ko=[fr],Yo=[pr({disabledInModes:["Playback"]})],Xo=[pr({disabledInModes:["Playback"]})],Go=[fr],zo=[fr],Vo=[pr({disabledInModes:["Playback"]})],Ho=[pr({disabledInModes:["Playback"]})],No=[fr],Wo=[pr({disabledInModes:["Playback"]})],Uo=[fr],qo=[pr({disabledInModes:["Playback"]})],$o=[fr],jo=[fr],Oo=[pr({disabledInModes:["Playback"]})],Bo=[fr],Do=[pr({disabledInModes:["Playback"]})],Ro=[fr],Lo=[pr({disabledInModes:["Playback"]})],Io=[pr({disabledInModes:["Playback"]})],Mo=[fr],Fo=[pr()],Ao=[fr],Po=[pr()],To=[pr({disabledInModes:["Playback"]})],xo=[fr],So=[pr({disabledInModes:["Playback"]})],Eo=[fr],Co=[pr()],_o=[fr],ko=[pr({disabledInModes:["Playback"]})],wo=[fr],vo=[pr({disabledInModes:["Playback"]})],yo=[fr],bo=[pr({disabledInModes:["Playback"]})],mo=[pr({disabledInModes:["Playback"]})],go=[pr({disabledInModes:["Playback"]})],fo=[pr({disabledInModes:["Playback"]})],po=[pr({disabledInModes:["Playback"]})],ho=[pr({disabledInModes:["Playback"]})],uo=[pr({disabledInModes:["Playback"]})],co=[fr],lo=[fr],ao=[fr],so=[fr],io=[pr({disabledInModes:["Playback"]})],no=[pr({disabledInModes:["Playback"]})],oo=[pr({disabledInModes:["Playback"]})],ro=[fr],to=[pr({disabledInModes:["Playback"]})],eo=[fr],Jr=[fr],Zr=[fr],Qr=[fr],Kr=[pr({disabledInModes:["Playback"]})],Yr=[pr({disabledInModes:["Playback"]})],Xr=[fr];var BlockAPI=class{constructor(e){b(Cl,5,this),C(this,El),C(this,kl),C(this,_l),v(this,"onSelectionChanged",(e=>{const t=_(this,kl).subscribeToSelectionChange(e);return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(t))}})),v(this,"onClicked",(e=>{const t=_(this,kl).subscribeToBlockClicked(e);return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(t))}})),v(this,"onStateChanged",((e,t)=>{Gt("ids",e,It(Dt()));const r=_(this,kl).subscribeToBlockState(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(r))}})),E(this,kl,e),E(this,_l,new SceneAPI(e,!0))}async export(e,t,r){Gt("handle",e,Bt());try{Gt("options",t,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",t,jt(Ut([Xt(),Qt()]))),Gt("options",r,jt(Ot({pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.export(handle, mimeType, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const o="object"==typeof t?t:{mimeType:t,...r},n=o.mimeType??"image/png",i=null!=o.targetWidth&&null!=o.targetHeight,s=o.jpegQuality??.9,a=o.webpQuality??1,l=o.pngCompressionLevel??5;return new Promise(((t,r)=>{o.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,kl).exportToBuffer(e,n,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:n}))}),{pngCompressionLevel:l,jpegQuality:s,webpQuality:a,useTargetSize:i,targetWidth:o.targetWidth??0,targetHeight:o.targetHeight??0,exportPdfWithHighCompatibility:o.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:o.exportPdfWithUnderlayer??!1,underlayerSpotColorName:o.underlayerSpotColorName??"",underlayerOffset:o.underlayerOffset??0})}))}async exportWithColorMask(e,t,r,o,n,i){Gt("handle",e,Bt());try{Gt("maskColorR",t,Bt()),Gt("maskColorG",r,Bt()),Gt("maskColorB",o,Bt()),Gt("options",i,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",t,jt(Ut([Xt(),Qt()]))),Gt("maskColorR",r,Bt()),Gt("maskColorG",o,Bt()),Gt("maskColorB",n,Bt()),Gt("options",i,jt(Ot({pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportWithColorMask(handle, mimeType, maskColorR, maskColorG, maskColorB, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.exportWithColorMask(handle, maskColorR, maskColorG, maskColorB, options)\n${e.message}`)}}let s,a,l,c;"number"==typeof t?(s=t,a=r,l=o,c=n??{}):(s=r,a=o,l=n,c={mimeType:t,...i});const d=c.mimeType??"image/png",u=null!=c.targetWidth&&null!=c.targetHeight,h=c.jpegQuality??.9,p=c.webpQuality??1,f=c.pngCompressionLevel??5;return new Promise(((t,r)=>{c.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,kl).exportWithColorMaskToBuffer(e,d,s,a,l,((e,o)=>{if("error"in e)r(e.error);else if("error"in o)r(o.error);else{const r=new Blob([e],{type:d}),n=new Blob([o],{type:d});t([r,n])}}),{pngCompressionLevel:f,jpegQuality:h,webpQuality:p,useTargetSize:u,targetWidth:c.targetWidth??0,targetHeight:c.targetHeight??0,exportPdfWithHighCompatibility:c.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:c.exportPdfWithUnderlayer??!1,underlayerSpotColorName:c.underlayerSpotColorName??"",underlayerOffset:c.underlayerOffset??0})}))}async exportVideo(e,t,r,o){throw new Error("Method not implemented. An implementation is available on the BlockAPI at engine.block or cesdk.engine.block")}async unstable_exportAudio(e,t={}){return Gt("handle",e,Bt()),Gt("options",t,Ot({mimeType:jt(Yt()),onProgress:jt(Rt()),timeOffset:jt(Bt()),duration:jt(Bt()),sampleRate:jt(Bt()),numberOfChannels:jt(Bt())})),new Promise(((r,o)=>{_(this,kl).unstable_exportAudioToBuffer(e,t.timeOffset??0,t.duration??0,t.mimeType??"audio/wav",t.onProgress??(()=>{}),(e=>{"error"in e?o(e.error):r(new Blob([e],{type:t.mimeType??"audio/wav"}))}),{sampleRate:t.sampleRate??48e3,numberOfChannels:t.numberOfChannels??2})}))}async loadFromString(e){return Gt("content",e,$t()),ar((t=>_(this,kl).loadBlocksFromString(e,t))).then((e=>lr(e)))}loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,kl).loadBlocksFromArchiveURL(e,t))).then((e=>lr(e)))}async saveToString(e,t=["buffer","http","https"]){return Gt("blocks",e,It(Bt())),ar((r=>_(this,kl).saveBlocksToString(e,r,t)))}async saveToArchive(e){return Gt("blocks",e,It(Bt())),new Promise(((t,r)=>{_(this,kl).saveBlocksToArchive(e,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:"application/zip"}))}))}))}create(e){return Gt("type",e,$t()),sr(_(this,kl).create(e))}createFill(e){return Gt("type",e,$t()),sr(_(this,kl).createFill(e))}async createCaptionsFromURI(e){return Gt("uri",e,$t()),ar((t=>_(this,kl).createCaptionsFromURI(e,t))).then((e=>lr(e)))}getType(e){return Gt("id",e,Dt()),sr(_(this,kl).getType(e))}getKind(e){return Gt("id",e,Dt()),sr(_(this,kl).getKind(e))}setKind(e,t){Gt("id",e,Dt()),sr(_(this,kl).setKind(e,t))}select(e){return Gt("id",e,Dt()),sr(_(this,kl).select(e))}setSelected(e,t){return Gt("id",e,Dt()),Gt("selected",t,Lt()),sr(_(this,kl).setSelected(e,t))}isSelected(e){return Gt("id",e,Dt()),sr(_(this,kl).isSelected(e))}findAllSelected(){return lr(_(this,kl).findAllSelected())}isGroupable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isGroupable(e))}group(e){return Gt("ids",e,Ht(It(Bt()))),sr(_(this,kl).group(e))}ungroup(e){return Gt("id",e,Bt()),sr(_(this,kl).ungroup(e))}enterGroup(e){return Gt("id",e,Bt()),sr(_(this,kl).enterGroup(e))}exitGroup(e){return Gt("id",e,Bt()),sr(_(this,kl).exitGroup(e))}isCombinable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isCombinable(e))}combine(e,t){return Gt("ids",e,It(Bt())),Gt("op",t,$t()),sr(_(this,kl).combine(e,t))}setName(e,t){return Gt("id",e,Dt()),Gt("name",t,$t()),sr(_(this,kl).setName(e,t))}getName(e){return Gt("id",e,Dt()),sr(_(this,kl).getName(e))}getUUID(e){return Gt("id",e,Dt()),sr(_(this,kl).getUUID(e))}findByName(e){Gt("name",e,$t());const t=_(this,kl).findByName(e);return lr(t)}findByType(e){Gt("type",e,$t());const t=sr(_(this,kl).findByType(e));return lr(t)}findByKind(e){Gt("kind",e,$t());const t=sr(_(this,kl).findByKind(e));return lr(t)}findAll(){return lr(_(this,kl).findAll())}findAllPlaceholders(){return lr(_(this,kl).findAllPlaceholders())}createShape(e){return Gt("type",e,$t()),sr(_(this,kl).createShape(e))}hasShape(e){return Gt("id",e,Dt()),sr(_(this,kl).hasShape(e))}supportsShape(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsShape(e))}getShape(e){return Gt("id",e,Dt()),sr(_(this,kl).getShape(e))}setShape(e,t){return Gt("id",e,Dt()),Gt("shape",t,Dt()),sr(_(this,kl).setShape(e,t))}isVisible(e){return Gt("id",e,Dt()),sr(_(this,kl).isVisible(e))}setVisible(e,t){return Gt("id",e,Dt()),Gt("visible",t,Lt()),sr(_(this,kl).setVisible(e,t))}isClipped(e){return Gt("id",e,Dt()),sr(_(this,kl).isClipped(e))}setClipped(e,t){return Gt("id",e,Dt()),Gt("clipped",t,Lt()),sr(_(this,kl).setClipped(e,t))}isTransformLocked(e){return Gt("id",e,Dt()),sr(_(this,kl).isTransformLocked(e))}setTransformLocked(e,t){return Gt("id",e,Dt()),Gt("locked",t,Lt()),sr(_(this,kl).setTransformLocked(e,t))}getPositionX(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionX(e))}getPositionXMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionXMode(e))}getPositionY(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionY(e))}getPositionYMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionYMode(e))}setPositionX(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,kl).setPositionX(e,t))}setPositionXMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setPositionXMode(e,t))}setPositionY(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,kl).setPositionY(e,t))}setPositionYMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Gt("id",e,Dt()),sr(_(this,kl).isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Gt("id",e,Dt()),sr(_(this,kl).isAlwaysOnBottom(e))}bringToFront(e){return Gt("id",e,Bt()),sr(_(this,kl).bringToFront(e))}sendToBack(e){return Gt("id",e,Bt()),sr(_(this,kl).sendToBack(e))}bringForward(e){return Gt("id",e,Bt()),sr(_(this,kl).bringForward(e))}sendBackward(e){return Gt("id",e,Bt()),sr(_(this,kl).sendBackward(e))}getRotation(e){return Gt("id",e,Dt()),sr(_(this,kl).getRotation(e))}setRotation(e,t){return Gt("id",e,Dt()),Gt("radians",t,Bt()),sr(_(this,kl).setRotation(e,t))}getFlipHorizontal(e){return Gt("id",e,Dt()),sr(_(this,kl).getFlip(e)).horizontal}getFlipVertical(e){return Gt("id",e,Dt()),sr(_(this,kl).getFlip(e)).vertical}setFlipHorizontal(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,kl).setFlipHorizontal(e,t))}setFlipVertical(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,kl).setFlipVertical(e,t))}hasContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).hasContentFillMode(e))}supportsContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsContentFillMode(e))}getWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getWidth(e))}getWidthMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getWidthMode(e))}getHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getHeight(e))}getHeightMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getHeightMode(e))}setSize(e,t,r,o){return Gt("id",e,Dt()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",o,jt(Ot({maintainCrop:jt(Lt()),sizeMode:jt(tr())}))),null!=o?.sizeMode&&(sr(_(this,kl).setWidthMode(e,o.sizeMode)),sr(_(this,kl).setHeightMode(e,o.sizeMode))),sr(_(this,kl).setWidth(e,t,o?.maintainCrop??!1)),sr(_(this,kl).setHeight(e,r,o?.maintainCrop??!1))}setPosition(e,t,r,o){return Gt("id",e,Dt()),Gt("x",t,Bt()),Gt("y",r,Bt()),null!=o?.positionMode&&(sr(_(this,kl).setPositionXMode(e,o.positionMode)),sr(_(this,kl).setPositionYMode(e,o.positionMode))),sr(_(this,kl).setPositionX(e,t)),sr(_(this,kl).setPositionY(e,r))}setWidth(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,kl).setWidth(e,t,r??!1))}setWidthMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setWidthMode(e,t))}setHeight(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,kl).setHeight(e,t,r??!1))}setHeightMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setHeightMode(e,t))}getFrameX(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameX(e))}getFrameY(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameY(e))}getFrameWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameWidth(e))}getFrameHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameHeight(e))}setContentFillMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setContentFillMode(e,t))}getContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getContentFillMode(e))}duplicate(e,t=!0){return Gt("id",e,Dt()),sr(_(this,kl).duplicate(e,t))}destroy(e){return Gt("id",e,Dt()),sr(_(this,kl).destroy(e))}isValid(e){return Gt("id",e,Dt()),_(this,kl).isValid(e)}getParent(e){return Gt("id",e,Dt()),sr(_(this,kl).hasParent(e))?sr(_(this,kl).getParent(e)):null}getChildren(e){Gt("id",e,Dt());const t=sr(_(this,kl).getChildren(e));return lr(t)}insertChild(e,t,r){return Gt("parent",e,Bt()),Gt("child",t,Bt()),Gt("index",r,Nt(Bt(),0)),sr(_(this,kl).insertChild(e,t,r))}appendChild(e,t){return Gt("parent",e,Bt()),Gt("child",t,Bt()),sr(_(this,kl).appendChild(e,t))}referencesAnyVariables(e){return Gt("id",e,Dt()),sr(_(this,kl).referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Gt("ids",e,Ht(It(Bt()))),sr(_(this,kl).alignHorizontally(e,t))}alignVertically(e,t){return Gt("ids",e,Ht(It(Bt()))),sr(_(this,kl).alignVertically(e,t))}isAlignable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isAlignable(e))}distributeHorizontally(e){return Gt("ids",e,Ht(It(Bt()))),sr(_(this,kl).distributeHorizontally(e))}distributeVertically(e){return Gt("ids",e,Ht(It(Bt()))),sr(_(this,kl).distributeVertically(e))}isDistributable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isDistributable(e))}fillParent(e){return Gt("id",e,Dt()),sr(_(this,kl).fillParent(e))}resizeContentAware(e,t,r){return Gt("ids",e,It(Bt())),Gt("width",t,Bt()),Gt("height",r,Bt()),sr(_(this,kl).resizeContentAware(e,t,r))}scale(e,t,r=0,o=0){return Gt("id",e,Dt()),sr(_(this,kl).scale(e,t,r,o))}findAllProperties(e){return Gt("id",e,Dt()),lr(sr(_(this,kl).findAllProperties(e)))}isPropertyReadable(e){return Gt("property",e,$t()),_(this,kl).isPropertyReadable(e)}isPropertyWritable(e){return Gt("property",e,$t()),_(this,kl).isPropertyWritable(e)}getPropertyType(e){Gt("property",e,$t());return sr(_(this,kl).getPropertyType(e))}getEnumValues(e){return Gt("enumProperty",e,$t()),lr(sr(_(this,kl).getEnumValues(e)))}setBool(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Lt()),sr(_(this,kl).setBool(e,t,r))}getBool(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getBool(e,t))}setInt(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Dt()),sr(_(this,kl).setInt(e,t,r))}getInt(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getInt(e,t))}setFloat(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,kl).setFloat(e,t,r))}getFloat(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getFloat(e,t))}setDouble(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,kl).setDouble(e,t,r))}getDouble(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getDouble(e,t))}setString(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setString(e,t,r))}getString(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getString(e,t))}setColor(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,nr()),sr(_(this,kl).setColor(e,t,Gr.fromColor(r)))}getColor(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),Gr.toColor(sr(_(this,kl).getColor(e,t)))}setColorRGBA(e,t,r,o,n,i=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("r",r,Bt()),Gt("g",o,Bt()),Gt("b",n,Bt()),Gt("a",i,Bt()),sr(_(this,kl).setColorRGBA(e,t,r,o,n,i))}getColorRGBA(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorRGBA(e,t))}setColorSpot(e,t,r,o=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("name",r,$t()),Gt("tint",o,Bt()),sr(_(this,kl).setColorSpot(e,t,r,o))}getColorSpotName(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorSpotName(e,t))}getColorSpotTint(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t());const o=r.map((e=>({color:Gr.fromColor(e.color),stop:e.stop})));return sr(_(this,kl).setGradientColorStops(e,t,o))}getGradientColorStops(e,t){Gt("id",e,Dt()),Gt("property",t,$t());const r=sr(_(this,kl).getGradientColorStops(e,t));return lr(r).map((e=>({color:Gr.toColor(e.color),stop:e.stop})))}getSourceSet(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),lr(sr(_(this,kl).getSourceSet(e,t)))}setSourceSet(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t()),Gt("sourceSet",r,It(Ot({uri:$t(),width:Bt(),height:Bt()}))),sr(_(this,kl).setSourceSet(e,t,r))}addImageFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((o=>_(this,kl).addImageFileURIToSourceSet(e,t,r,o)))}addVideoFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((o=>_(this,kl).addVideoFileURIToSourceSet(e,t,r,o)))}setEnum(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setEnum(e,t,r))}getEnum(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getEnum(e,t))}hasCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).hasCrop(e))}supportsCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsCrop(e))}setCropScaleX(e,t){return Gt("id",e,Dt()),Gt("scaleX",t,Bt()),sr(_(this,kl).setCropScaleX(e,t))}setCropScaleY(e,t){return Gt("id",e,Dt()),Gt("scaleY",t,Bt()),sr(_(this,kl).setCropScaleY(e,t))}setCropRotation(e,t){return Gt("id",e,Dt()),Gt("rotation",t,Bt()),sr(_(this,kl).setCropRotation(e,t))}setCropScaleRatio(e,t){return Gt("id",e,Dt()),Gt("scaleRatio",t,Bt()),sr(_(this,kl).setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Gt("id",e,Dt()),Gt("translationX",t,Bt()),sr(_(this,kl).setCropTranslationX(e,t))}setCropTranslationY(e,t){return Gt("id",e,Dt()),Gt("translationY",t,Bt()),sr(_(this,kl).setCropTranslationY(e,t))}resetCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).resetCrop(e))}getCropScaleX(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleX(e))}getCropScaleY(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleY(e))}getCropRotation(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropRotation(e))}getCropScaleRatio(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleRatio(e))}getCropTranslationX(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropTranslationX(e))}getCropTranslationY(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Gt("id",e,Dt()),Gt("minScaleRatio",t,Bt()),sr(_(this,kl).adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Gt("id",e,Dt()),sr(_(this,kl).flipCropHorizontal(e))}flipCropVertical(e){return Gt("id",e,Dt()),sr(_(this,kl).flipCropVertical(e))}hasOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).hasOpacity(e))}supportsOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsOpacity(e))}setOpacity(e,t){return Gt("id",e,Dt()),Gt("opacity",t,Bt()),sr(_(this,kl).setOpacity(e,t))}getOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).getOpacity(e))}hasBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBlendMode(e))}supportsBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBlendMode(e))}setBlendMode(e,t){return Gt("id",e,Dt()),Gt("blendMode",t,$t()),sr(_(this,kl).setBlendMode(e,t))}getBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getBlendMode(e))}hasFillColor(e){return Gt("id",e,Dt()),sr(_(this,kl).hasFillColor(e))}isIncludedInExport(e){return Gt("id",e,Dt()),sr(_(this,kl).isIncludedInExport(e))}setIncludedInExport(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setFillColorRGBA(e,t,r,o,n))}getFillColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getFillColorRGBA(e))}setFillColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setFillColorEnabled(e,t))}isFillColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isFillColorEnabled(e))}createEffect(e){return Gt("type",e,$t()),sr(_(this,kl).createEffect(e))}hasEffects(e){return Gt("id",e,Dt()),sr(_(this,kl).hasEffects(e))}supportsEffects(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsEffects(e))}getEffects(e){Gt("id",e,Dt());const t=sr(_(this,kl).getEffects(e));return lr(t)}insertEffect(e,t,r){Gt("id",e,Dt()),Gt("effectId",t,Dt()),Gt("index",r,Nt(Dt(),0)),sr(_(this,kl).insertEffect(e,t,r))}appendEffect(e,t){Gt("id",e,Dt()),Gt("effectId",t,Dt()),sr(_(this,kl).appendEffect(e,t))}removeEffect(e,t){Gt("id",e,Dt()),Gt("index",t,Nt(Dt(),0)),sr(_(this,kl).removeEffect(e,t))}hasEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,kl).hasEffectEnabled(e))}setEffectEnabled(e,t){Gt("effectId",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setEffectEnabled(e,t))}isEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,kl).isEffectEnabled(e))}createBlur(e){return Gt("type",e,$t()),sr(_(this,kl).createBlur(e))}hasBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBlur(e))}supportsBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBlur(e))}setBlur(e,t){Gt("id",e,Dt()),Gt("blurId",t,Dt()),sr(_(this,kl).setBlur(e,t))}getBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).getBlur(e))}setBlurEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setBlurEnabled(e,t))}isBlurEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isBlurEnabled(e))}hasBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBackgroundColor(e))}supportsBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setBackgroundColorRGBA(e,t,r,o,n))}getBackgroundColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isBackgroundColorEnabled(e))}hasStroke(e){return Gt("id",e,Dt()),sr(_(this,kl).hasStroke(e))}supportsStroke(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsStroke(e))}setStrokeEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setStrokeEnabled(e,t))}isStrokeEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setStrokeColorRGBA(e,t,r,o,n))}setStrokeColor(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeColor(e,Gr.fromColor(t)))}getStrokeColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getStrokeColorRGBA(e))}getStrokeColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,kl).getStrokeColor(e)))}setStrokeWidth(e,t){return Gt("id",e,Dt()),Gt("width",t,Bt()),sr(_(this,kl).setStrokeWidth(e,t))}getStrokeWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getStrokeWidth(e))}setStrokeStyle(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeStyle(e,t))}getStrokeStyle(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokeStyle(e))}setStrokePosition(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokePosition(e,t))}getStrokePosition(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokeCornerGeometry(e))}hasDropShadow(e){return Gt("id",e,Dt()),sr(_(this,kl).hasDropShadow(e))}supportsDropShadow(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsDropShadow(e))}setDropShadowEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setDropShadowColorRGBA(e,t,r,o,n))}setDropShadowColor(e,t){return Gt("id",e,Dt()),Gt("color",t,nr()),sr(_(this,kl).setDropShadowColor(e,Gr.fromColor(t)))}getDropShadowColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowColorRGBA(e))}getDropShadowColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,kl).getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Gt("id",e,Dt()),Gt("offsetX",t,Bt()),sr(_(this,kl).setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Gt("id",e,Dt()),Gt("offsetY",t,Bt()),sr(_(this,kl).setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Gt("id",e,Dt()),Gt("blurRadiusX",t,Bt()),sr(_(this,kl).setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Gt("id",e,Dt()),Gt("blurRadiusY",t,Bt()),sr(_(this,kl).setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setDropShadowClip(e,t))}getDropShadowClip(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4,o=!0){return Gt("ids",e,It(Dt())),Gt("vectorizeDistanceThreshold",t,Bt()),Gt("maxSmoothingDistance",r,Bt()),Gt("useExistingShapeInformation",o,Lt()),sr(_(this,kl).createCutoutFromBlocks(e,t,r,o))}createCutoutFromPath(e){return Gt("path",e,$t()),sr(_(this,kl).createCutoutFromPath(e))}createCutoutFromOperation(e,t){return Gt("ids",e,It(Dt())),Gt("op",t,function(){const e=["Difference","Intersection","Union","XOR"];return Mt("CutoutOperation",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),sr(_(this,kl).createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("text",t,$t()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).replaceText(e,t,r,o))}removeText(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).removeText(e,t,r))}setTextColor(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("color",t,nr()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextColor(e,Gr.fromColor(t),r,o))}getTextColors(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt());const o=_(this,kl).getTextColors(e,t,r);return lr(sr(o)).map((e=>Gr.toColor(e)))}setTextFontWeight(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontWeight(e,t,r,o))}getTextFontWeights(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontWeights(e,t,r)))}setTextFontSize(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontSize(e,t,r,o))}getTextFontSizes(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontSizes(e,t,r)))}setTextFontStyle(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontStyle(e,t,r,o))}getTextFontStyles(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontStyles(e,t,r)))}getTextCases(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextCases(e,t,r)))}setTextCase(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("textCase",t,$t()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextCase(e,t,r,o))}canToggleBoldFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).canToggleBoldFont(e,t,r))}canToggleItalicFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).canToggleItalicFont(e,t,r))}toggleBoldFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).toggleBoldFont(e,t,r))}toggleItalicFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).toggleItalicFont(e,t,r))}setFont(e,t,r){Gt("block",e,Dt()),Gt("fontFileUri",t,$t()),sr(_(this,kl).setFont(e,t,r))}setTypeface(e,t,r=-1,o=-1){Gt("block",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTypeface(e,t,r,o))}getTypeface(e){return Gt("block",e,Dt()),sr(_(this,kl).getTypeface(e))}getTypefaces(e,t=-1,r=-1){return Gt("block",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTypefaces(e,t,r)))}getTextCursorRange(){return sr(_(this,kl).getTextCursorRange())}getTextVisibleLineCount(e){return Gt("id",e,Dt()),sr(_(this,kl).getTextVisibleLineCount(e))}getTextVisibleLineGlobalBoundingBoxXYWH(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,kl).getTextVisibleLineGlobalBoundingBoxXYWH(e,t))}getTextVisibleLineContent(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,kl).getTextVisibleLineContent(e,t))}hasFill(e){return Gt("id",e,Dt()),sr(_(this,kl).hasFill(e))}supportsFill(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsFill(e))}isFillEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isFillEnabled(e))}setFillEnabled(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setFillEnabled(e,t))}getFill(e){return Gt("id",e,Dt()),sr(_(this,kl).getFill(e))}setFill(e,t){return Gt("id",e,Dt()),Gt("fill",t,Dt()),sr(_(this,kl).setFill(e,t))}setFillSolidColor(e,t,r,o,n=1){Gt("id",e,Dt()),sr(_(this,kl).setFillSolidColor(e,t,r,o,n))}getFillSolidColor(e){return Gt("id",e,Dt()),sr(_(this,kl).getFillSolidColor(e))}setPlaceholderEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaceholderBehavior(e))}supportsPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Gt("id",e,Dt()),sr(_(this,kl).setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaceholderControls(e))}supportsPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setMetadata(e,t,r))}getMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).getMetadata(e,t))}hasMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).hasMetadata(e,t))}findAllMetadata(e){return Gt("id",e,Dt()),lr(sr(_(this,kl).findAllMetadata(e)))}removeMetadata(e,t){Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).removeMetadata(e,t))}setScopeEnabled(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("enabled",r,Lt()),sr(_(this,kl).setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).isScopeEnabled(e,t))}isAllowedByScope(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).isAllowedByScope(e,t))}hasDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).hasDuration(e))}supportsDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsDuration(e))}setDuration(e,t){return Gt("id",e,Dt()),Gt("duration",t,Bt()),sr(_(this,kl).setDuration(e,t))}getDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).getDuration(e))}setPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,kl).setPageDurationSource(e,t))}isPageDurationSource(e){return Gt("id",e,Dt()),sr(_(this,kl).isPageDurationSource(e))}supportsPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,kl).supportsPageDurationSource(e,t))}removePageDurationSource(e){Gt("id",e,Dt()),sr(_(this,kl).removePageDurationSource(e))}hasTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).hasTimeOffset(e))}supportsTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsTimeOffset(e))}setTimeOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,kl).setTimeOffset(e,t))}getTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).getTimeOffset(e))}hasTrim(e){return Gt("id",e,Dt()),sr(_(this,kl).hasTrim(e))}supportsTrim(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsTrim(e))}setTrimOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,kl).setTrimOffset(e,t))}getTrimOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).getTrimOffset(e))}setTrimLength(e,t){return Gt("id",e,Dt()),Gt("length",t,Bt()),sr(_(this,kl).setTrimLength(e,t))}getTrimLength(e){return Gt("id",e,Dt()),sr(_(this,kl).getTrimLength(e))}getTotalSceneDuration(e){return Gt("scene",e,Dt()),sr(_(this,kl).getTotalSceneDuration(e))}setPlaying(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setPlaying(e,t))}isPlaying(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaying(e))}hasPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaybackTime(e))}supportsPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaybackTime(e))}setPlaybackTime(e,t){return Gt("id",e,Dt()),Gt("time",t,Bt()),sr(_(this,kl).setPlaybackTime(e,t))}getPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,kl).setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaybackControl(e))}supportsPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaybackControl(e))}setLooping(e,t){Gt("id",e,Dt()),Gt("looping",t,Lt()),sr(_(this,kl).setLooping(e,t))}isLooping(e){return Gt("id",e,Dt()),sr(_(this,kl).isLooping(e))}setMuted(e,t){Gt("id",e,Dt()),Gt("muted",t,Lt()),sr(_(this,kl).setMuted(e,t))}isMuted(e){return Gt("id",e,Dt()),sr(_(this,kl).isMuted(e))}setVolume(e,t){Gt("id",e,Dt()),Gt("volume",t,Bt()),sr(_(this,kl).setVolume(e,t))}getVolume(e){return Gt("id",e,Dt()),sr(_(this,kl).getVolume(e))}async forceLoadAVResource(e){return Gt("id",e,Dt()),ar((t=>_(this,kl).forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Gt("id",e,Dt()),sr(_(this,kl).unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).getAVResourceTotalDuration(e))}getVideoWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getVideoWidth(e))}getVideoHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,o,n,i){Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",o,Bt()),Gt("numberOfFrames",n,Dt());const s=_(this,kl).generateVideoThumbnailSequence(e,t,r,o,n,(e=>{"error"in e?i(0,new Error(e.error)):i(e.frameIndex,new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height))}));return()=>{_(this,kl).cancelVideoThumbnailSequenceGeneration(s)}}generateAudioThumbnailSequence(e,t,r,o,n,i,s){Gt("id",e,Dt()),Gt("samplesPerChunk",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",o,Bt()),Gt("numberOfSamples",n,Dt()),Gt("numberOfChannels",i,Dt());const a=_(this,kl).generateAudioThumbnailSequence(e,t,r,o,n,i,(e=>{"error"in e?s(0,new Error(e.error)):s(e.chunkIndex,e.sampleData)}));return()=>{_(this,kl).cancelAudioThumbnailSequenceGeneration(a)}}async getVideoFillThumbnail(e,t){return Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),new Promise(((r,o)=>{_(this,kl).getVideoFillThumbnail(e,t,(e=>{"error"in e?o(e.error):r(new Blob([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,o){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),Gt("thumbnailHeight",o,Dt()),new Promise(((n,i)=>{_(this,kl).getVideoFillThumbnailAtlas(e,t,r,o,(e=>{"error"in e?i(e.error):n(new Blob([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,o){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),new Promise(((n,i)=>{_(this,kl).getPageThumbnailAtlas(e,t,r,o,(e=>{"error"in e?i(e.error):n(new Blob([e],{type:"image/jpeg"}))}))}))}createAnimation(e){return Gt("type",e,$t()),sr(_(this,kl).createAnimation(e))}supportsAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsAnimation(e))}setInAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setInAnimation(e,t))}setLoopAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setLoopAnimation(e,t))}setOutAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setOutAnimation(e,t))}getInAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getInAnimation(e))}getLoopAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getLoopAnimation(e))}getOutAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getOutAnimation(e))}setNativePixelBuffer(e,t){Gt("id",e,Dt()),t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),sr(_(this,kl).setNativePixelBuffer(e,t))}getState(e){return Gt("id",e,Dt()),sr(_(this,kl).getState(e))}setState(e,t){Gt("id",e,Dt()),sr(_(this,kl).setState(e,t))}async forceLoadResources(e){return Gt("ids",e,It(Dt())),ar((t=>_(this,kl).forceLoadResources(e,t)))}async addImage(e,t={}){Gt("url",e,$t()),Gt("options",t,jt(Ot({sizeMode:jt(tr()),positionMode:jt(rr()),x:jt(Bt()),y:jt(Bt()),cornerRadius:jt(Bt()),size:jt(Ut([Bt(),Ot({width:Bt(),height:Bt()})])),timeline:jt(Ot({timeOffset:jt(Bt()),duration:jt(Bt())})),shadow:jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),animation:jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())}))})));const{x:r,y:o,size:n,timeline:i,animation:s,shadow:a,cornerRadius:l,sizeMode:c="Absolute",positionMode:d="Absolute"}=t;let u,h;if(null!=n)"number"==typeof n?(u=n,h=n):(u=n.width,h=n.height);else{const t=await new Promise(((t,r)=>{const o=new Image;o.src=e,o.onerror=r,o.onload=()=>{t({width:o.width,height:o.height})}}));u=t.width,h=t.height}const p=_(this,_l).getCurrentPage();if(null==p)throw new Error("No current page");const f=this.create("graphic");this.appendChild(p,f),this.setPositionXMode(f,d),this.setPositionYMode(f,d),this.setWidthMode(f,c),this.setHeightMode(f,c),null!=u&&this.setWidth(f,u),null!=h&&this.setHeight(f,h),null!=r?this.setPositionX(f,r):this.alignHorizontally([f],"Center"),null!=o?this.setPositionY(f,o):this.alignVertically([f],"Center");const g=this.createShape("rect");this.setShape(f,g),null!=l&&(this.setFloat(g,"shape/rect/cornerRadiusBL",l),this.setFloat(g,"shape/rect/cornerRadiusBR",l),this.setFloat(g,"shape/rect/cornerRadiusTL",l),this.setFloat(g,"shape/rect/cornerRadiusTR",l));const m=this.createFill("image");return this.setFill(f,m),this.setString(m,"fill/image/imageFileURI",e),null!=a&&this.applyDropShadow(f,a),"Design"===_(this,_l).getMode()||(null!=i?.timeOffset&&this.setTimeOffset(f,i.timeOffset),null!=i?.duration&&this.setDuration(f,i.duration),null!=s&&this.applyAnimation(f,s),await this.forceLoadResources([f]),this.adjustCropToFillFrame(f,.5)),f}async addVideo(e,t,r,o={}){if(Gt("url",e,$t()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",o,jt(Ot({sizeMode:jt(tr()),positionMode:jt(rr()),x:jt(Bt()),y:jt(Bt()),timeline:jt(Ot({timeOffset:jt(Bt()),duration:jt(Bt())})),animation:jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())})),shadow:jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),cornerRadius:jt(Bt())}))),"Design"===_(this,_l).getMode())throw new Error("Cannot add video in design mode.");const{x:n,y:i,timeline:s,animation:a,shadow:l,cornerRadius:c,sizeMode:d="Absolute",positionMode:u="Absolute"}=o,h=_(this,_l).getCurrentPage();if(null==h)throw new Error("No current page");const p=this.create("graphic");this.appendChild(h,p),this.setPositionXMode(p,u),this.setPositionYMode(p,u),this.setWidthMode(p,d),this.setHeightMode(p,d),this.setWidth(p,t),this.setHeight(p,r),null!=n?this.setPositionX(p,n):this.alignHorizontally([p],"Center"),null!=i?this.setPositionY(p,i):this.alignVertically([p],"Center");const f=this.createShape("rect");this.setShape(p,f),null!=c&&(this.setFloat(f,"shape/rect/cornerRadiusBL",c),this.setFloat(f,"shape/rect/cornerRadiusBR",c),this.setFloat(f,"shape/rect/cornerRadiusTL",c),this.setFloat(f,"shape/rect/cornerRadiusTR",c));const g=this.createFill("video");return this.setFill(p,g),this.setString(g,"fill/video/fileURI",e),null!=l&&this.applyDropShadow(p,l),null!=s?.timeOffset&&this.setTimeOffset(p,s.timeOffset),null!=s?.duration&&this.setDuration(p,s.duration),null!=a&&this.applyAnimation(p,a),await this.forceLoadResources([p]),this.adjustCropToFillFrame(p,0),p}applyAnimation(e,t={}){if(Gt("block",e,Dt()),Gt("animation",t,jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())}))),null!=t.in){const r=this.createAnimation(t.in.type);if(this.setInAnimation(e,r),this.setDuration(r,t.in.duration),null!=t.in.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.in.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}if(null!=t.out){const r=this.createAnimation(t.out.type);if(this.setOutAnimation(e,r),this.setDuration(r,t.out.duration),null!=t.out.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.out.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}if(null!=t.loop){const r=this.createAnimation(t.loop.type);if(this.setLoopAnimation(e,r),this.setDuration(r,t.loop.duration),null!=t.loop.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.loop.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}}applyDropShadow(e,t={}){Gt("block",e,Dt()),Gt("options",t,jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})));const{color:r,offset:o,blur:n}=t;this.setDropShadowEnabled(e,!0),null!=r&&this.setDropShadowColor(e,r),null!=o&&(null!=o.x&&this.setDropShadowOffsetX(e,o.x),null!=o.y&&this.setDropShadowOffsetY(e,o.y)),null!=n&&(null!=n.x&&this.setDropShadowBlurRadiusX(e,n.x),null!=n.y&&this.setDropShadowBlurRadiusY(e,n.y))}async generateThumbnailAtTimeOffset(e,t){Gt("height",e,Nt(Wt(Dt(),512),1)),Gt("time",t,Bt());const r=_(this,_l).getCurrentPage();if(null==r)throw new Error("No page to get thumbnail for");if("Design"===_(this,_l).getMode())throw new Error("Cannot get thumbnail in design mode. Use export instead.");return new Promise(((o,n)=>{_(this,kl).generateVideoThumbnailSequence(r,e,t,t,1,(e=>{if("error"in e)n(e.error);else{const t=new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height),r=document.createElement("canvas");r.width=e.width,r.height=e.height;const i=r.getContext("2d");if(!i)return void n(new Error("Failed to get canvas context"));i.putImageData(t,0,0),r.toBlob((e=>{e?o(e):n(new Error("Failed to convert to PNG"))}),"image/png")}}))}))}getBackgroundTrack(){if("Design"===_(this,_l).getMode())throw new Error("Cannot get background track in design mode");if(null==_(this,_l).getCurrentPage())return null;return this.findByType("track").find((e=>this.isPageDurationSource(e)))??null}moveToBackgroundTrack(e){Gt("block",e,Dt());const t=this.getBackgroundTrack();if(null==t)throw new Error("No background track found");this.appendChild(t,e)}};Cl=h(null),kl=new WeakMap,_l=new WeakMap,El=new WeakSet,Sl=function(e,t){return this.findAllProperties(e).includes(t)},y(Cl,1,"loadFromString",wl,BlockAPI),y(Cl,1,"loadFromArchiveURL",vl,BlockAPI),y(Cl,1,"create",yl,BlockAPI),y(Cl,1,"createFill",bl,BlockAPI),y(Cl,1,"createCaptionsFromURI",ml,BlockAPI),y(Cl,1,"getType",gl,BlockAPI),y(Cl,1,"getKind",fl,BlockAPI),y(Cl,1,"setKind",pl,BlockAPI),y(Cl,1,"select",hl,BlockAPI),y(Cl,1,"setSelected",ul,BlockAPI),y(Cl,1,"isSelected",dl,BlockAPI),y(Cl,1,"findAllSelected",cl,BlockAPI),y(Cl,1,"isGroupable",ll,BlockAPI),y(Cl,1,"group",al,BlockAPI),y(Cl,1,"ungroup",sl,BlockAPI),y(Cl,1,"enterGroup",il,BlockAPI),y(Cl,1,"exitGroup",nl,BlockAPI),y(Cl,1,"isCombinable",ol,BlockAPI),y(Cl,1,"combine",rl,BlockAPI),y(Cl,1,"setName",tl,BlockAPI),y(Cl,1,"getName",el,BlockAPI),y(Cl,1,"getUUID",Ja,BlockAPI),y(Cl,1,"findByName",Za,BlockAPI),y(Cl,1,"findByType",Qa,BlockAPI),y(Cl,1,"findByKind",Ka,BlockAPI),y(Cl,1,"findAll",Ya,BlockAPI),y(Cl,1,"findAllPlaceholders",Xa,BlockAPI),y(Cl,1,"createShape",Ga,BlockAPI),y(Cl,1,"getShape",za,BlockAPI),y(Cl,1,"setShape",Va,BlockAPI),y(Cl,1,"isVisible",Ha,BlockAPI),y(Cl,1,"setVisible",Na,BlockAPI),y(Cl,1,"isClipped",Wa,BlockAPI),y(Cl,1,"setClipped",Ua,BlockAPI),y(Cl,1,"isTransformLocked",qa,BlockAPI),y(Cl,1,"setTransformLocked",$a,BlockAPI),y(Cl,1,"getPositionX",ja,BlockAPI),y(Cl,1,"getPositionXMode",Oa,BlockAPI),y(Cl,1,"getPositionY",Ba,BlockAPI),y(Cl,1,"getPositionYMode",Da,BlockAPI),y(Cl,1,"setPositionX",Ra,BlockAPI),y(Cl,1,"setPositionXMode",La,BlockAPI),y(Cl,1,"setPositionY",Ia,BlockAPI),y(Cl,1,"setPositionYMode",Ma,BlockAPI),y(Cl,1,"setAlwaysOnTop",Fa,BlockAPI),y(Cl,1,"setAlwaysOnBottom",Aa,BlockAPI),y(Cl,1,"isAlwaysOnTop",Pa,BlockAPI),y(Cl,1,"isAlwaysOnBottom",Ta,BlockAPI),y(Cl,1,"bringToFront",xa,BlockAPI),y(Cl,1,"sendToBack",Sa,BlockAPI),y(Cl,1,"bringForward",Ea,BlockAPI),y(Cl,1,"sendBackward",Ca,BlockAPI),y(Cl,1,"getRotation",_a,BlockAPI),y(Cl,1,"setRotation",ka,BlockAPI),y(Cl,1,"getFlipHorizontal",wa,BlockAPI),y(Cl,1,"getFlipVertical",va,BlockAPI),y(Cl,1,"setFlipHorizontal",ya,BlockAPI),y(Cl,1,"setFlipVertical",ba,BlockAPI),y(Cl,1,"getWidth",ma,BlockAPI),y(Cl,1,"getWidthMode",ga,BlockAPI),y(Cl,1,"getHeight",fa,BlockAPI),y(Cl,1,"getHeightMode",pa,BlockAPI),y(Cl,1,"setSize",ha,BlockAPI),y(Cl,1,"setPosition",ua,BlockAPI),y(Cl,1,"setWidth",da,BlockAPI),y(Cl,1,"setWidthMode",ca,BlockAPI),y(Cl,1,"setHeight",la,BlockAPI),y(Cl,1,"setHeightMode",aa,BlockAPI),y(Cl,1,"getFrameX",sa,BlockAPI),y(Cl,1,"getFrameY",ia,BlockAPI),y(Cl,1,"getFrameWidth",na,BlockAPI),y(Cl,1,"getFrameHeight",oa,BlockAPI),y(Cl,1,"setContentFillMode",ra,BlockAPI),y(Cl,1,"getContentFillMode",ta,BlockAPI),y(Cl,1,"duplicate",ea,BlockAPI),y(Cl,1,"destroy",Js,BlockAPI),y(Cl,1,"isValid",Zs,BlockAPI),y(Cl,1,"getParent",Qs,BlockAPI),y(Cl,1,"getChildren",Ks,BlockAPI),y(Cl,1,"insertChild",Ys,BlockAPI),y(Cl,1,"appendChild",Xs,BlockAPI),y(Cl,1,"referencesAnyVariables",Gs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxX",zs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxY",Vs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxWidth",Hs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxHeight",Ns,BlockAPI),y(Cl,1,"getScreenSpaceBoundingBoxXYWH",Ws,BlockAPI),y(Cl,1,"alignHorizontally",Us,BlockAPI),y(Cl,1,"alignVertically",qs,BlockAPI),y(Cl,1,"isAlignable",$s,BlockAPI),y(Cl,1,"distributeHorizontally",js,BlockAPI),y(Cl,1,"distributeVertically",Os,BlockAPI),y(Cl,1,"isDistributable",Bs,BlockAPI),y(Cl,1,"fillParent",Ds,BlockAPI),y(Cl,1,"resizeContentAware",Rs,BlockAPI),y(Cl,1,"scale",Ls,BlockAPI),y(Cl,1,"findAllProperties",Is,BlockAPI),y(Cl,1,"isPropertyReadable",Ms,BlockAPI),y(Cl,1,"isPropertyWritable",Fs,BlockAPI),y(Cl,1,"getPropertyType",As,BlockAPI),y(Cl,1,"getEnumValues",Ps,BlockAPI),y(Cl,1,"setBool",Ts,BlockAPI),y(Cl,1,"getBool",xs,BlockAPI),y(Cl,1,"setInt",Ss,BlockAPI),y(Cl,1,"getInt",Es,BlockAPI),y(Cl,1,"setFloat",Cs,BlockAPI),y(Cl,1,"getFloat",_s,BlockAPI),y(Cl,1,"setDouble",ks,BlockAPI),y(Cl,1,"getDouble",ws,BlockAPI),y(Cl,1,"setString",vs,BlockAPI),y(Cl,1,"getString",ys,BlockAPI),y(Cl,1,"setColor",bs,BlockAPI),y(Cl,1,"getColor",ms,BlockAPI),y(Cl,1,"setColorRGBA",gs,BlockAPI),y(Cl,1,"getColorRGBA",fs,BlockAPI),y(Cl,1,"setColorSpot",ps,BlockAPI),y(Cl,1,"getColorSpotName",hs,BlockAPI),y(Cl,1,"getColorSpotTint",us,BlockAPI),y(Cl,1,"setGradientColorStops",ds,BlockAPI),y(Cl,1,"getGradientColorStops",cs,BlockAPI),y(Cl,1,"getSourceSet",ls,BlockAPI),y(Cl,1,"setSourceSet",as,BlockAPI),y(Cl,1,"addImageFileURIToSourceSet",ss,BlockAPI),y(Cl,1,"addVideoFileURIToSourceSet",is,BlockAPI),y(Cl,1,"setEnum",ns,BlockAPI),y(Cl,1,"getEnum",os,BlockAPI),y(Cl,1,"setCropScaleX",rs,BlockAPI),y(Cl,1,"setCropScaleY",ts,BlockAPI),y(Cl,1,"setCropRotation",es,BlockAPI),y(Cl,1,"setCropScaleRatio",Ji,BlockAPI),y(Cl,1,"setCropTranslationX",Zi,BlockAPI),y(Cl,1,"setCropTranslationY",Qi,BlockAPI),y(Cl,1,"resetCrop",Ki,BlockAPI),y(Cl,1,"getCropScaleX",Yi,BlockAPI),y(Cl,1,"getCropScaleY",Xi,BlockAPI),y(Cl,1,"getCropRotation",Gi,BlockAPI),y(Cl,1,"getCropScaleRatio",zi,BlockAPI),y(Cl,1,"getCropTranslationX",Vi,BlockAPI),y(Cl,1,"getCropTranslationY",Hi,BlockAPI),y(Cl,1,"adjustCropToFillFrame",Ni,BlockAPI),y(Cl,1,"flipCropHorizontal",Wi,BlockAPI),y(Cl,1,"flipCropVertical",Ui,BlockAPI),y(Cl,1,"setOpacity",qi,BlockAPI),y(Cl,1,"getOpacity",$i,BlockAPI),y(Cl,1,"setBlendMode",ji,BlockAPI),y(Cl,1,"getBlendMode",Oi,BlockAPI),y(Cl,1,"isIncludedInExport",Bi,BlockAPI),y(Cl,1,"setIncludedInExport",Di,BlockAPI),y(Cl,1,"setFillColorRGBA",Ri,BlockAPI),y(Cl,1,"getFillColorRGBA",Li,BlockAPI),y(Cl,1,"setFillColorEnabled",Ii,BlockAPI),y(Cl,1,"isFillColorEnabled",Mi,BlockAPI),y(Cl,1,"createEffect",Fi,BlockAPI),y(Cl,1,"getEffects",Ai,BlockAPI),y(Cl,1,"insertEffect",Pi,BlockAPI),y(Cl,1,"appendEffect",Ti,BlockAPI),y(Cl,1,"removeEffect",xi,BlockAPI),y(Cl,1,"setEffectEnabled",Si,BlockAPI),y(Cl,1,"isEffectEnabled",Ei,BlockAPI),y(Cl,1,"createBlur",Ci,BlockAPI),y(Cl,1,"setBlur",_i,BlockAPI),y(Cl,1,"getBlur",ki,BlockAPI),y(Cl,1,"setBlurEnabled",wi,BlockAPI),y(Cl,1,"isBlurEnabled",vi,BlockAPI),y(Cl,1,"setBackgroundColorRGBA",yi,BlockAPI),y(Cl,1,"getBackgroundColorRGBA",bi,BlockAPI),y(Cl,1,"setBackgroundColorEnabled",mi,BlockAPI),y(Cl,1,"isBackgroundColorEnabled",gi,BlockAPI),y(Cl,1,"setStrokeEnabled",fi,BlockAPI),y(Cl,1,"isStrokeEnabled",pi,BlockAPI),y(Cl,1,"setStrokeColorRGBA",hi,BlockAPI),y(Cl,1,"setStrokeColor",ui,BlockAPI),y(Cl,1,"getStrokeColorRGBA",di,BlockAPI),y(Cl,1,"getStrokeColor",ci,BlockAPI),y(Cl,1,"setStrokeWidth",li,BlockAPI),y(Cl,1,"getStrokeWidth",ai,BlockAPI),y(Cl,1,"setStrokeStyle",si,BlockAPI),y(Cl,1,"getStrokeStyle",ii,BlockAPI),y(Cl,1,"setStrokePosition",ni,BlockAPI),y(Cl,1,"getStrokePosition",oi,BlockAPI),y(Cl,1,"setStrokeCornerGeometry",ri,BlockAPI),y(Cl,1,"getStrokeCornerGeometry",ti,BlockAPI),y(Cl,1,"setDropShadowEnabled",ei,BlockAPI),y(Cl,1,"isDropShadowEnabled",Jn,BlockAPI),y(Cl,1,"setDropShadowColorRGBA",Zn,BlockAPI),y(Cl,1,"setDropShadowColor",Qn,BlockAPI),y(Cl,1,"getDropShadowColorRGBA",Kn,BlockAPI),y(Cl,1,"getDropShadowColor",Yn,BlockAPI),y(Cl,1,"setDropShadowOffsetX",Xn,BlockAPI),y(Cl,1,"getDropShadowOffsetX",Gn,BlockAPI),y(Cl,1,"setDropShadowOffsetY",zn,BlockAPI),y(Cl,1,"getDropShadowOffsetY",Vn,BlockAPI),y(Cl,1,"setDropShadowBlurRadiusX",Hn,BlockAPI),y(Cl,1,"getDropShadowBlurRadiusX",Nn,BlockAPI),y(Cl,1,"setDropShadowBlurRadiusY",Wn,BlockAPI),y(Cl,1,"getDropShadowBlurRadiusY",Un,BlockAPI),y(Cl,1,"setDropShadowClip",qn,BlockAPI),y(Cl,1,"getDropShadowClip",$n,BlockAPI),y(Cl,1,"createCutoutFromBlocks",jn,BlockAPI),y(Cl,1,"createCutoutFromPath",On,BlockAPI),y(Cl,1,"createCutoutFromOperation",Bn,BlockAPI),y(Cl,1,"replaceText",Dn,BlockAPI),y(Cl,1,"removeText",Rn,BlockAPI),y(Cl,1,"setTextColor",Ln,BlockAPI),y(Cl,1,"getTextColors",In,BlockAPI),y(Cl,1,"setTextFontWeight",Mn,BlockAPI),y(Cl,1,"getTextFontWeights",Fn,BlockAPI),y(Cl,1,"setTextFontSize",An,BlockAPI),y(Cl,1,"getTextFontSizes",Pn,BlockAPI),y(Cl,1,"setTextFontStyle",Tn,BlockAPI),y(Cl,1,"getTextFontStyles",xn,BlockAPI),y(Cl,1,"getTextCases",Sn,BlockAPI),y(Cl,1,"setTextCase",En,BlockAPI),y(Cl,1,"canToggleBoldFont",Cn,BlockAPI),y(Cl,1,"canToggleItalicFont",_n,BlockAPI),y(Cl,1,"toggleBoldFont",kn,BlockAPI),y(Cl,1,"toggleItalicFont",wn,BlockAPI),y(Cl,1,"setFont",vn,BlockAPI),y(Cl,1,"setTypeface",yn,BlockAPI),y(Cl,1,"getTypeface",bn,BlockAPI),y(Cl,1,"getTypefaces",mn,BlockAPI),y(Cl,1,"getTextCursorRange",gn,BlockAPI),y(Cl,1,"getTextVisibleLineCount",fn,BlockAPI),y(Cl,1,"getTextVisibleLineGlobalBoundingBoxXYWH",pn,BlockAPI),y(Cl,1,"getTextVisibleLineContent",hn,BlockAPI),y(Cl,1,"isFillEnabled",un,BlockAPI),y(Cl,1,"setFillEnabled",dn,BlockAPI),y(Cl,1,"getFill",cn,BlockAPI),y(Cl,1,"setFill",ln,BlockAPI),y(Cl,1,"setFillSolidColor",an,BlockAPI),y(Cl,1,"getFillSolidColor",sn,BlockAPI),y(Cl,1,"setPlaceholderEnabled",nn,BlockAPI),y(Cl,1,"isPlaceholderEnabled",on,BlockAPI),y(Cl,1,"setPlaceholderBehaviorEnabled",rn,BlockAPI),y(Cl,1,"isPlaceholderBehaviorEnabled",tn,BlockAPI),y(Cl,1,"setPlaceholderControlsOverlayEnabled",en,BlockAPI),y(Cl,1,"isPlaceholderControlsOverlayEnabled",Jo,BlockAPI),y(Cl,1,"setPlaceholderControlsButtonEnabled",Zo,BlockAPI),y(Cl,1,"isPlaceholderControlsButtonEnabled",Qo,BlockAPI),y(Cl,1,"setMetadata",Ko,BlockAPI),y(Cl,1,"getMetadata",Yo,BlockAPI),y(Cl,1,"findAllMetadata",Xo,BlockAPI),y(Cl,1,"removeMetadata",Go,BlockAPI),y(Cl,1,"setScopeEnabled",zo,BlockAPI),y(Cl,1,"isScopeEnabled",Vo,BlockAPI),y(Cl,1,"isAllowedByScope",Ho,BlockAPI),y(Cl,1,"setDuration",No,BlockAPI),y(Cl,1,"getDuration",Wo,BlockAPI),y(Cl,1,"setPageDurationSource",Uo,BlockAPI),y(Cl,1,"isPageDurationSource",qo,BlockAPI),y(Cl,1,"removePageDurationSource",$o,BlockAPI),y(Cl,1,"setTimeOffset",jo,BlockAPI),y(Cl,1,"getTimeOffset",Oo,BlockAPI),y(Cl,1,"setTrimOffset",Bo,BlockAPI),y(Cl,1,"getTrimOffset",Do,BlockAPI),y(Cl,1,"setTrimLength",Ro,BlockAPI),y(Cl,1,"getTrimLength",Lo,BlockAPI),y(Cl,1,"getTotalSceneDuration",Io,BlockAPI),y(Cl,1,"setPlaying",Mo,BlockAPI),y(Cl,1,"isPlaying",Fo,BlockAPI),y(Cl,1,"setPlaybackTime",Ao,BlockAPI),y(Cl,1,"getPlaybackTime",Po,BlockAPI),y(Cl,1,"isVisibleAtCurrentPlaybackTime",To,BlockAPI),y(Cl,1,"setSoloPlaybackEnabled",xo,BlockAPI),y(Cl,1,"isSoloPlaybackEnabled",So,BlockAPI),y(Cl,1,"setLooping",Eo,BlockAPI),y(Cl,1,"isLooping",Co,BlockAPI),y(Cl,1,"setMuted",_o,BlockAPI),y(Cl,1,"isMuted",ko,BlockAPI),y(Cl,1,"setVolume",wo,BlockAPI),y(Cl,1,"getVolume",vo,BlockAPI),y(Cl,1,"forceLoadAVResource",yo,BlockAPI),y(Cl,1,"unstable_isAVResourceLoaded",bo,BlockAPI),y(Cl,1,"getAVResourceTotalDuration",mo,BlockAPI),y(Cl,1,"getVideoWidth",go,BlockAPI),y(Cl,1,"getVideoHeight",fo,BlockAPI),y(Cl,1,"getVideoFillThumbnail",po,BlockAPI),y(Cl,1,"getVideoFillThumbnailAtlas",ho,BlockAPI),y(Cl,1,"getPageThumbnailAtlas",uo,BlockAPI),y(Cl,1,"createAnimation",co,BlockAPI),y(Cl,1,"setInAnimation",lo,BlockAPI),y(Cl,1,"setLoopAnimation",ao,BlockAPI),y(Cl,1,"setOutAnimation",so,BlockAPI),y(Cl,1,"getInAnimation",io,BlockAPI),y(Cl,1,"getLoopAnimation",no,BlockAPI),y(Cl,1,"getOutAnimation",oo,BlockAPI),y(Cl,1,"setNativePixelBuffer",ro,BlockAPI),y(Cl,1,"getState",to,BlockAPI),y(Cl,1,"setState",eo,BlockAPI),y(Cl,1,"forceLoadResources",Jr,BlockAPI),y(Cl,1,"applyAnimation",Zr,BlockAPI),y(Cl,1,"applyDropShadow",Qr,BlockAPI),y(Cl,1,"generateThumbnailAtTimeOffset",Kr,BlockAPI),y(Cl,1,"getBackgroundTrack",Yr,BlockAPI),y(Cl,1,"moveToBackgroundTrack",Xr,BlockAPI),m(Cl,BlockAPI);var Al,Fl,Ml,Il,Ll,Rl,Dl,Bl,Ol,jl,$l,ql,Ul,Wl,Nl,Hl,Vl,zl,Gl,Xl,Yl,Kl,Ql,Zl,Jl,ec,tc,rc,oc,nc,ic,sc,ac,lc,cc,dc,uc,hc,pc,fc,gc,mc,bc,yc,vc,wc,kc,_c,Cc,Ec,Sc,xc,Tc,Pc,Ac,Fc,Mc,Ic,Lc,Rc,Dc=new WeakMap;Ic=[fr],Mc=[fr],Fc=[fr],Ac=[pr({disabledInModes:["Playback"]})],Pc=[pr({disabledInModes:["Playback"]})],Tc=[fr],xc=[fr],Sc=[pr()],Ec=[pr({disabledInModes:["Playback"]})],Cc=[pr({disabledInModes:["Playback"]})],_c=[pr({disabledInModes:["Playback"]})],kc=[pr({disabledInModes:["Playback"]})],wc=[pr({disabledInModes:["Playback"]})],vc=[fr],yc=[fr],bc=[fr],mc=[pr({disabledInModes:["Playback"]})],gc=[fr],fc=[fr],pc=[fr],hc=[pr({disabledInModes:["Playback"]})],uc=[pr({disabledInModes:["Playback"]})],dc=[fr],cc=[pr({disabledInModes:["Playback"]})],lc=[fr],ac=[pr({disabledInModes:["Playback"]})],sc=[fr],ic=[pr({disabledInModes:["Playback"]})],nc=[fr],oc=[pr({disabledInModes:["Playback"]})],rc=[fr],tc=[pr({disabledInModes:["Playback"]})],ec=[fr],Jl=[pr({disabledInModes:["Playback"]})],Zl=[fr],Ql=[pr({disabledInModes:["Playback"]})],Kl=[fr],Yl=[pr({disabledInModes:["Playback"]})],Xl=[pr({disabledInModes:["Playback"]})],Gl=[pr({disabledInModes:["Playback"]})],zl=[pr({disabledInModes:["Playback"]})],Vl=[pr({disabledInModes:["Playback"]})],Hl=[fr],Nl=[pr({disabledInModes:["Playback"]})],Wl=[pr({disabledInModes:["Playback"]})],Ul=[fr],ql=[pr({disabledInModes:["Playback"]})],$l=[pr({disabledInModes:["Playback"]})],jl=[pr({disabledInModes:["Playback"]})],Ol=[pr({disabledInModes:["Playback"]})],Bl=[fr],Dl=[fr],Rl=[fr],Ll=[fr],Il=[fr],Ml=[pr({disabledInModes:["Playback"]})],Fl=[pr({disabledInModes:["Playback"]})],Al=[fr];var EditorAPI=class{constructor(e){b(Rc,5,this),C(this,Lc),v(this,"onStateChanged",(e=>{const t=_(this,Lc).subscribeToEditorState(e);return()=>{_(this,Lc).isDeleted()||sr(_(this,Lc).unsubscribe(t))}})),v(this,"onHistoryUpdated",(e=>{const t=_(this,Lc).subscribeToHistory(e);return()=>{_(this,Lc).isDeleted()||_(this,Lc).unsubscribe(t)}})),v(this,"onSettingsChanged",(e=>{const t=_(this,Lc).subscribeToSettings(e);return()=>{_(this,Lc).isDeleted()||sr(_(this,Lc).unsubscribe(t))}})),v(this,"onRoleChanged",(e=>{const t=_(this,Lc).subscribeToRoleChange(e);return()=>{_(this,Lc).isDeleted()||sr(_(this,Lc).unsubscribe(t))}})),E(this,Lc,e)}unlockWithLicense(e){sr(_(this,Lc).unlockWithLicense(e))}startTracking(e,t){_(this,Lc).startTracking(e,t,"")}setTrackingMetadata(e){_(this,Lc).setTrackingMetadata(e)}getTrackingMetadata(){return sr(_(this,Lc).getTrackingMetadata())}getActiveLicense(){return sr(_(this,Lc).getActiveLicense())}_update(){_(this,Lc).update()}setEditMode(e){Gt("keypath",e,$t()),_(this,Lc).setEditMode(e)}getEditMode(){return _(this,Lc).getEditMode()}unstable_isInteractionHappening(){return sr(_(this,Lc).unstable_isInteractionHappening())}getCursorType(){return _(this,Lc).getCursorType()}getCursorRotation(){return _(this,Lc).getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return _(this,Lc).getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return _(this,Lc).getTextCursorPositionInScreenSpaceY()}createHistory(){return _(this,Lc).createHistory()}destroyHistory(e){sr(_(this,Lc).destroyHistory(e))}setActiveHistory(e){sr(_(this,Lc).setActiveHistory(e))}getActiveHistory(){return _(this,Lc).getActiveHistory()}addUndoStep(){sr(_(this,Lc).addUndoStep())}undo(){sr(_(this,Lc).undo())}redo(){sr(_(this,Lc).redo())}canUndo(){return sr(_(this,Lc).canUndo())}canRedo(){return sr(_(this,Lc).canRedo())}setSettingBool(e,t){return Gt("keypath",e,$t()),Gt("value",t,Lt()),sr(_(this,Lc).setSettingBool(e,t))}getSettingBool(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingBool(e))}setSettingInt(e,t){return Gt("keypath",e,$t()),Gt("value",t,Dt()),sr(_(this,Lc).setSettingInt(e,t))}getSettingInt(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingInt(e))}setSettingFloat(e,t){return Gt("keypath",e,$t()),Gt("value",t,Bt()),sr(_(this,Lc).setSettingFloat(e,t))}getSettingFloat(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingFloat(e))}setSettingString(e,t){return Gt("keypath",e,$t()),Gt("value",t,$t()),sr(_(this,Lc).setSettingString(e,t))}getSettingString(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingString(e))}setSettingColor(e,t){return Gt("keypath",e,$t()),sr(_(this,Lc).setSettingColor(e,Gr.fromColor(t)))}getSettingColor(e){return Gt("keypath",e,$t()),Gr.toColor(sr(_(this,Lc).getSettingColor(e)))}setSettingColorRGBA(e,t,r,o,n=1){return Gt("keypath",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,Lc).setSettingColorRGBA(e,t,r,o,n))}getSettingColorRGBA(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingColorRGBA(e))}setSettingEnum(e,t){return Gt("keypath",e,$t()),Gt("value",t,$t()),sr(_(this,Lc).setSettingEnum(e,t))}getSettingEnum(e){return Gt("keypath",e,$t()),sr(_(this,Lc).getSettingEnum(e))}getSettingEnumOptions(e){return Gt("keypath",e,$t()),lr(sr(_(this,Lc).getSettingEnumOptions(e)))}setRole(e){return sr(_(this,Lc).setRole(e))}getRole(){return sr(_(this,Lc).getRole())}findAllSettings(){return lr(_(this,Lc).findAllSettings())}getSettingType(e){Gt("keypath",e,$t());return sr(_(this,Lc).getSettingType(e))}getAvailableMemory(){return sr(_(this,Lc).getAvailableMemory())}getUsedMemory(){return sr(_(this,Lc).getUsedMemory())}getMaxExportSize(){return sr(_(this,Lc).getMaxExportSize())}setURIResolver(e){Dc.set(_(this,Lc),e);return sr(_(this,Lc).setURIResolver((t=>e(t,this.defaultURIResolver.bind(this)))))}unstable_getURIResolver(){return Dc.get(_(this,Lc))??null}defaultURIResolver(e){return _(this,Lc).defaultURIResolver(e)}getAbsoluteURI(e){return sr(_(this,Lc).getAbsoluteURI(e))}findAllScopes(){return lr(_(this,Lc).findAllScopes())}setGlobalScope(e,t){Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,Lc).setGlobalScope(e,t))}getGlobalScope(e){return Gt("key",e,$t()),sr(_(this,Lc).getGlobalScope(e))}findAllSpotColors(){return lr(_(this,Lc).findAllSpotColors())}getSpotColorRGBA(e){return Gt("name",e,$t()),_(this,Lc).getSpotColorRGB(e)}getSpotColorCMYK(e){return Gt("name",e,$t()),_(this,Lc).getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,o){return Gt("name",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),_(this,Lc).setSpotColorRGB(e,t,r,o)}setSpotColorCMYK(e,t,r,o,n){return Gt("name",e,$t()),Gt("c",t,Bt()),Gt("m",r,Bt()),Gt("y",o,Bt()),Gt("k",n,Bt()),_(this,Lc).setSpotColorCMYK(e,t,r,o,n)}removeSpotColor(e){return Gt("name",e,$t()),sr(_(this,Lc).removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Gt("type",e,$t()),Gt("color",t,$t()),sr(_(this,Lc).setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Gt("type",e,$t()),sr(_(this,Lc).getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Gt("colorSpace",t,$t()),Gr.toColor(sr(_(this,Lc).convertColorToColorSpace(Gr.fromColor(e),t)))}createBuffer(){return _(this,Lc).createBuffer()}destroyBuffer(e){sr(_(this,Lc).destroyBuffer(e))}setBufferData(e,t,r){Gt("offset",t,Dt()),sr(_(this,Lc).setBufferData(e,t,r))}getBufferData(e,t,r){Gt("offset",t,Dt()),Gt("length",r,Dt());const o=_(this,Lc).getBufferData(e,t,r);if("error"in o)throw new Error(o.error);return o}setBufferLength(e,t){Gt("length",t,Dt()),sr(_(this,Lc).setBufferLength(e,t))}getBufferLength(e){return sr(_(this,Lc).getBufferLength(e))}cloneBuffers(){return lr(sr(_(this,Lc).cloneBuffers()))}restoreBuffers(e){sr(_(this,Lc).restoreBuffers(e))}getMimeType(e){return Gt("uri",e,$t()),ar((t=>_(this,Lc).getMimeType(e,t)))}findAllTransientResources(){return lr(sr(_(this,Lc).findAllTransientResources()))}getResourceData(e,t,r){Gt("uri",e,$t()),Gt("chunkSize",t,Dt()),sr(_(this,Lc).getResourceData(e,t,r))}relocateResource(e,t){Gt("currentUrl",e,$t()),Gt("relocatedUrl",t,$t()),sr(_(this,Lc).relocateResource(e,t))}isHighlightingEnabled(e){return Gt("id",e,Dt()),sr(_(this,Lc).isHighlightingEnabled(e))}setHighlightingEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,Lc).setHighlightingEnabled(e,t))}};Rc=h(null),Lc=new WeakMap,y(Rc,1,"unlockWithLicense",Ic,EditorAPI),y(Rc,1,"startTracking",Mc,EditorAPI),y(Rc,1,"setTrackingMetadata",Fc,EditorAPI),y(Rc,1,"getTrackingMetadata",Ac,EditorAPI),y(Rc,1,"getActiveLicense",Pc,EditorAPI),y(Rc,1,"_update",Tc,EditorAPI),y(Rc,1,"setEditMode",xc,EditorAPI),y(Rc,1,"getEditMode",Sc,EditorAPI),y(Rc,1,"unstable_isInteractionHappening",Ec,EditorAPI),y(Rc,1,"getCursorType",Cc,EditorAPI),y(Rc,1,"getCursorRotation",_c,EditorAPI),y(Rc,1,"getTextCursorPositionInScreenSpaceX",kc,EditorAPI),y(Rc,1,"getTextCursorPositionInScreenSpaceY",wc,EditorAPI),y(Rc,1,"createHistory",vc,EditorAPI),y(Rc,1,"destroyHistory",yc,EditorAPI),y(Rc,1,"setActiveHistory",bc,EditorAPI),y(Rc,1,"getActiveHistory",mc,EditorAPI),y(Rc,1,"addUndoStep",gc,EditorAPI),y(Rc,1,"undo",fc,EditorAPI),y(Rc,1,"redo",pc,EditorAPI),y(Rc,1,"canUndo",hc,EditorAPI),y(Rc,1,"canRedo",uc,EditorAPI),y(Rc,1,"setSettingBool",dc,EditorAPI),y(Rc,1,"getSettingBool",cc,EditorAPI),y(Rc,1,"setSettingInt",lc,EditorAPI),y(Rc,1,"getSettingInt",ac,EditorAPI),y(Rc,1,"setSettingFloat",sc,EditorAPI),y(Rc,1,"getSettingFloat",ic,EditorAPI),y(Rc,1,"setSettingString",nc,EditorAPI),y(Rc,1,"getSettingString",oc,EditorAPI),y(Rc,1,"setSettingColor",rc,EditorAPI),y(Rc,1,"getSettingColor",tc,EditorAPI),y(Rc,1,"setSettingColorRGBA",ec,EditorAPI),y(Rc,1,"getSettingColorRGBA",Jl,EditorAPI),y(Rc,1,"setSettingEnum",Zl,EditorAPI),y(Rc,1,"getSettingEnum",Ql,EditorAPI),y(Rc,1,"setRole",Kl,EditorAPI),y(Rc,1,"getRole",Yl,EditorAPI),y(Rc,1,"findAllSettings",Xl,EditorAPI),y(Rc,1,"getAvailableMemory",Gl,EditorAPI),y(Rc,1,"getUsedMemory",zl,EditorAPI),y(Rc,1,"getMaxExportSize",Vl,EditorAPI),y(Rc,1,"setURIResolver",Hl,EditorAPI),y(Rc,1,"unstable_getURIResolver",Nl,EditorAPI),y(Rc,1,"findAllScopes",Wl,EditorAPI),y(Rc,1,"setGlobalScope",Ul,EditorAPI),y(Rc,1,"getGlobalScope",ql,EditorAPI),y(Rc,1,"findAllSpotColors",$l,EditorAPI),y(Rc,1,"getSpotColorRGBA",jl,EditorAPI),y(Rc,1,"getSpotColorCMYK",Ol,EditorAPI),y(Rc,1,"setSpotColorRGB",Bl,EditorAPI),y(Rc,1,"setSpotColorCMYK",Dl,EditorAPI),y(Rc,1,"removeSpotColor",Rl,EditorAPI),y(Rc,1,"setSpotColorForCutoutType",Ll,EditorAPI),y(Rc,1,"getSpotColorForCutoutType",Il,EditorAPI),y(Rc,1,"convertColorToColorSpace",Ml,EditorAPI),y(Rc,1,"isHighlightingEnabled",Fl,EditorAPI),y(Rc,1,"setHighlightingEnabled",Al,EditorAPI),m(Rc,EditorAPI);var Bc,Oc,jc,$c,qc,Uc,EventAPI=class{#e;constructor(e){this.#e=e}subscribe=(e,t)=>{Gt("blocks",e,It());const r=this.#e.subscribe(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(r))}}};$c=[pr({disabledInModes:["Playback"]})],jc=[fr],Oc=[pr({disabledInModes:["Playback"]})],Bc=[fr];var VariableAPI=class{constructor(e){b(Uc,5,this),C(this,qc),E(this,qc,e)}findAll(){return lr(_(this,qc).findAllVariables())}setString(e,t){return Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,qc).setVariableString(e,t))}getString(e){return Gt("key",e,$t()),sr(_(this,qc).getVariableString(e))}remove(e){return Gt("key",e,$t()),sr(_(this,qc).removeVariable(e))}};function Wc(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}Uc=h(null),qc=new WeakMap,y(Uc,1,"findAll",$c,VariableAPI),y(Uc,1,"setString",jc,VariableAPI),y(Uc,1,"getString",Oc,VariableAPI),y(Uc,1,"remove",Bc,VariableAPI),m(Uc,VariableAPI);var Nc=async function(e,t,r=fetch,o,n=new Set(o.findAllSources())){const i=e.map((async e=>{const i=Wc(t,`/${e}/content.json`);return r(i).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).then((r=>{if(void 0===r.assets)throw new Error(`Invalid content.json for assets: ${e}`);const i=r.assets;n.has(e)||o.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,o])=>{const n=o.toString();if(n.includes("{{base_url}}")){const o=n.replace("{{base_url}}",t);r.meta&&(r.meta[e]=o)}})),r.payload?.typeface&&r.payload.typeface.fonts.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),r.payload?.sourceSet&&r.payload.sourceSet.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),o.addAssetToSource(e,r)}))}))}));await Promise.all(i)},Hc=class _CaptionPresetAssetSource{static assetSourceId="ly.img.captionPresets";propertyWhitelist=["backgroundColor/enabled","backgroundColor/color","backgroundColor/cornerRadius","backgroundColor/paddingBottom","backgroundColor/paddingLeft","backgroundColor/paddingRight","backgroundColor/paddingTop","blend/mode","dropShadow/enabled","dropShadow/color","dropShadow/offset/x","dropShadow/offset/y","dropShadow/blurRadius/x","dropShadow/blurRadius/y","dropShadow/clip","fill/enabled","fill/solid/color","opacity","stroke/enabled","stroke/color","stroke/width","stroke/style","stroke/position","stroke/cornerGeometry","{{blockType}}/typeface","{{blockType}}/fontSize","{{blockType}}/horizontalAlignment","{{blockType}}/verticalAlignment","{{blockType}}/letterSpacing","{{blockType}}/lineHeight","{{blockType}}/automaticFontSizeEnabled","{{blockType}}/maxAutomaticFontSize","{{blockType}}/minAutomaticFontSize","{{blockType}}/paragraphSpacing"];#s;#a;#l;constructor(e,t,r){this.#s=e,this.#a=t,this.#l=r??window.fetch.bind(window),this.createSource()}static async fetchAssets(e,t=fetch){const r=Wc(e,`/${_CaptionPresetAssetSource.assetSourceId}/content.json`),o=await t(r);if(!o.ok)throw new Error(o.statusText);const n=await o.json();if(void 0===n.assets)throw new Error(`Invalid content.json for assets: ${_CaptionPresetAssetSource.assetSourceId}`);return n.assets.map((t=>(t.meta&&Object.entries(t.meta).forEach((([r,o])=>{const n=o.toString();if(n.includes("{{base_url}}")){const o=n.replace("{{base_url}}",e);t.meta&&(t.meta[r]=o)}})),t)))}createSource(){this.#s.asset.addSource({id:_CaptionPresetAssetSource.assetSourceId,findAssets:({page:e,perPage:t,excludeGroups:r,groups:o,locale:n="en",query:i,sortActiveFirst:s,sortKey:a,sortingOrder:l,tags:c})=>{const d=this.getCaptionTrack(),u=null!=d&&this.#s.block.hasMetadata(d,"activePreset")?this.#s.block.getMetadata(d,"activePreset"):void 0;let h=[...this.#a];if(o&&o.length>0&&(h=h.filter((e=>e.groups?.some((e=>o.includes(e)))))),i&&""!==i.trim()){const e=i.toLowerCase().trim();h=h.filter((t=>(t.label?.[n]?.toLowerCase()||"").includes(e)))}c&&c.length>0&&(h=h.filter((e=>(e.tags?.[n]??[]).some((e=>c.includes(e)))))),r&&r.length>0&&(h=h.filter((e=>!(e.groups??[]).some((e=>r.includes(e)))))),"label"===a&&"None"!==l&&h.sort(((e,t)=>{const r=e.label?.[n]?.toLocaleLowerCase()||"",o=t.label?.[n]?.toLocaleLowerCase()||"";return r<o?"Ascending"===l?-1:1:r>o?"Ascending"===l?1:-1:0})),s&&u&&h.sort(((e,t)=>e.id===u?-1:t.id===u?1:0));const p=h.length,f=e*t,g=f+t,m=h.slice(f,g).map((e=>{const t=e.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:this.fetchCaptionScale()}:e));return{id:e.id,label:e.label?.[n],active:e.id===u,context:{id:_CaptionPresetAssetSource.assetSourceId},meta:e.meta,groups:e.groups,tags:e.tags?.[n],payload:{...e.payload,properties:t},locale:n}}));return Promise.resolve({assets:m,total:p,currentPage:e})},getGroups:()=>{const e=new Set;return this.#a.forEach((t=>{t.groups&&t.groups.forEach((t=>{e.add(t)}))})),Promise.resolve(Array.from(e))},removeAsset:e=>{const t=this.#a.findIndex((t=>t.id===e));-1!==t&&this.#a.splice(t,1)},addAsset:e=>{const t=this.#a.findIndex((t=>t.id===e.id));-1!==t?this.#a[t]=e:this.#a.push(e)},applyAssetToBlock:(e,t)=>this.applyPreset(e,t),applyAssetProperty:(e,t)=>this.applyProperty(e,t)})}async applyPreset(e,t){const r=e?.meta?.uri;if(null==r)throw new Error(`The asset ${e.id} does not have a preset block URL.`);const o=await this.#l(r);if(!o.ok)throw new Error(`Failed to fetch the preset block from ${r}`);const n=await o.text(),[i]=await this.#s.block.loadFromString(n),s=null!=i?this.#s.block.getType(i):void 0;if("//ly.img.ubq/text"!==s&&"//ly.img.ubq/caption"!==s)return;const a=this.getCaptionTrack(),l=null!=a?this.#s.block.getChildren(a):[];this.propertyWhitelist.forEach((e=>{const r=e.replace("{{blockType}}","//ly.img.ubq/text"===s?"text":"caption"),o=this.#s.block.getPropertyType(r),n=e.replace("{{blockType}}","caption");switch(o){case"Int":{const e=this.#s.block.getInt(i,r);this.#s.block.setInt(t,n,e);break}case"Float":{const e=this.#s.block.getFloat(i,r);this.#s.block.setFloat(t,n,e);break}case"Double":{const e=this.#s.block.getDouble(i,r);this.#s.block.setDouble(t,n,e);break}case"Bool":{const e=this.#s.block.getBool(i,r);this.#s.block.setBool(t,n,e);break}case"Enum":{if("stroke/position"===r)break;const e=this.#s.block.getEnum(i,r);this.#s.block.setEnum(t,n,e);break}case"Color":{if("fill/solid/color"===r){const[e]=this.#s.block.getTextColors(i);this.#s.block.setColor(t,n,e),"Text"===this.#s.editor.getEditMode()&&this.#s.editor.setEditMode("Transform"),this.#s.block.setTextColor(t,e);break}const e=this.#s.block.getColor(i,r);this.#s.block.setColor(t,n,e);break}case"String":{if("text/typeface"===r||"caption/typeface"===r){const e=this.#s.block.getTypeface(i);this.#s.block.setTypeface(t,e);break}const e=this.#s.block.getString(i,r);this.#s.block.setString(t,n,e);break}}}));const[c]=this.#s.block.getTextFontWeights(i);null!=c&&this.#s.block.setTextFontWeight(t,c);const[d]=this.#s.block.getTextFontStyles(i);null!=d&&this.#s.block.setTextFontStyle(t,d);const u={in:this.#s.block.getInAnimation(i),loop:this.#s.block.getLoopAnimation(i),out:this.#s.block.getOutAnimation(i)},h=(e,t)=>{const r=u[t],o=(()=>{switch(t){case"in":return this.#s.block.getInAnimation(e);case"loop":return this.#s.block.getLoopAnimation(e);case"out":return this.#s.block.getOutAnimation(e);default:return}})();if(null!=o&&this.#s.block.isValid(o)&&this.#s.block.destroy(o),this.#s.block.isValid(r)){const o=this.#s.block.duplicate(r);switch(t){case"in":this.#s.block.setInAnimation(e,o);break;case"loop":this.#s.block.setLoopAnimation(e,o);break;case"out":this.#s.block.setOutAnimation(e,o)}}};l.forEach((e=>{h(e,"in"),h(e,"loop"),h(e,"out")})),null!=a&&this.#s.block.setMetadata(a,"activePreset",e.id),this.#s.block.destroy(i),this.#s.editor.addUndoStep(),this.#s.asset.assetSourceContentsChanged(_CaptionPresetAssetSource.assetSourceId)}async applyProperty(e,t){const r=this.getCaptionTrack();if(null==r)return;const[o]=this.#s.block.findAllSelected(),n="//ly.img.ubq/caption"===(null!=o?this.#s.block.getType(o):void 0)?o:this.#s.block.getChildren(r)[0];if(null!=n){switch(t.type){case"Color":if("fill/solid/color"===t.property){this.#s.block.setColor(n,t.property,t.value),this.#s.block.setTextColor(n,t.value);break}this.#s.block.setColor(n,t.property,t.value);break;case"Int":this.#s.block.setInt(n,t.property,t.value);break;case"Float":if("caption/scale"===t.property){const e=this.fetchCaptionScale(),r=this.#s.block.getTextFontSizes(n)[0]/e,o=Math.round(r*t.value);if(this.#s.block.setTextFontSize(n,o),this.#s.block.isStrokeEnabled(n)){const r=this.#s.block.getStrokeWidth(n)/e*t.value;this.#s.block.setStrokeWidth(n,r)}if(this.#s.block.isDropShadowEnabled(n)){const r=this.#s.block.getDropShadowOffsetX(n),o=this.#s.block.getDropShadowOffsetY(n)/e,i=this.#s.block.getDropShadowBlurRadiusX(n)/e,s=this.#s.block.getDropShadowBlurRadiusY(n)/e,a=r/e*t.value,l=o*t.value,c=i*t.value,d=s*t.value;this.#s.block.setDropShadowOffsetX(n,a),this.#s.block.setDropShadowOffsetY(n,l),this.#s.block.setDropShadowBlurRadiusX(n,c),this.#s.block.setDropShadowBlurRadiusY(n,d)}this.storeCaptionScale(t.value);break}this.#s.block.setFloat(n,t.property,t.value);break;case"Double":this.#s.block.setDouble(n,t.property,t.value);break;case"Boolean":this.#s.block.setBool(n,t.property,t.value);break;case"Enum":this.#s.block.setEnum(n,t.property,t.value);break;case"String":this.#s.block.setString(n,t.property,t.value)}this.#a=this.#a.map((r=>{if("caption/scale"===t.property){const e=r.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:t.value}:e));return{...r,payload:{...r.payload,properties:e}}}if(r.id===e.id){const e=r.payload?.properties?.map((e=>e.property===t.property?{...e,value:t.value}:e));return{...r,payload:{...r.payload,properties:e}}}return{...r}})),this.#s.asset.assetSourceContentsChanged(_CaptionPresetAssetSource.assetSourceId)}}storeCaptionScale(e){const t=this.getCaptionTrack();null!=t&&this.#s.block.setMetadata(t,"previousScale",e.toString())}fetchCaptionScale(){const e=this.getCaptionTrack();if(null==e)return 1;try{const t=this.#s.block.getMetadata(e,"previousScale"),r=parseFloat(t);return Number.isNaN(r)?1:r}catch(e){return 1}}getCaptionTrack(){const e=this.#s.scene.getCurrentPage();if(null!=e)return this.#s.block.getChildren(e).find((e=>"//ly.img.ubq/captionTrack"===this.#s.block.getType(e)))}static async create(e,t,r){const o=await _CaptionPresetAssetSource.fetchAssets(t,r);return new _CaptionPresetAssetSource(e,o,r)}};var Vc=async function(e,t,r,o){const n=["ly.img.sticker","ly.img.vectorpath","ly.img.colors.defaultPalette","ly.img.filter.lut","ly.img.filter.duotone","ly.img.effect","ly.img.blur","ly.img.typeface","ly.img.crop.presets","ly.img.page.presets","ly.img.page.presets.video"].filter((e=>!r.includes(e)));await Nc(n,t,o,e.asset),r.includes("ly.img.captionPresets")||await Hc.create(e,t,o)},zc=(e=>(e[e.Information=0]="Information",e[e.Warning=1]="Warning",e[e.Error=2]="Error",e))(zc||{}),Gc=(e=>(e[e.Free=0]="Free",e[e.VerticalStack=1]="VerticalStack",e[e.HorizontalStack=2]="HorizontalStack",e[e.DepthStack=3]="DepthStack",e))(Gc||{});var Xc=async function(e,t,r,o,n,i,s="https://cdn.img.ly/assets/demo/v2"){const a=new Set(e.findAllSources()),l="ly.img.image.upload";!n||r.includes(l)||a.has(l)||e.addLocalSource(l,["image/jpeg","image/png","image/webp","image/svg+xml","image/bmp",..."Design"===o?["image/gif"]:[]]);const c="ly.img.video.upload";"Video"!==o||!n||r.includes(c)||a.has(c)||e.addLocalSource(c,["video/mp4","video/quicktime","image/gif"]);const d="ly.img.audio.upload";"Video"!==o||!n||r.includes(d)||a.has(d)||e.addLocalSource(d,["audio/mpeg","audio/mp3","audio/x-m4a","audio/wav"]);const u=["ly.img.image","ly.img.video","ly.img.audio"].filter((e=>!r.includes(e)));a.has("ly.img.template")||r.includes("ly.img.template")||(e.addLocalSource("ly.img.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),u.push("ly.img.template")),"Video"!==o||a.has("ly.img.video.template")||r.includes("ly.img.video.template")||(e.addLocalSource("ly.img.video.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),u.push("ly.img.video.template")),a.has("ly.img.textComponents")||r.includes("ly.img.textComponents")||u.push("ly.img.textComponents"),await Nc(u,s,i,e)};function Yc(e,t){let r;const o=new Set;function n(){const o=window.devicePixelRatio,{width:i,height:s}=e.getBoundingClientRect();t(i*o,s*o,o),r=matchMedia(`(resolution: ${o}dppx)`),r.addEventListener("change",n,{once:!0})}n();const i=new ResizeObserver((function([e]){const{width:r,height:n}=e.target.getBoundingClientRect();if(r<=0||n<=0)return;const i=window.devicePixelRatio,s=setTimeout((function(){o.delete(s),t(r*i,n*i,i)}),0);o.add(s)}));return i.observe(e),()=>{r.removeEventListener("change",n),i.disconnect();for(const e of o)clearTimeout(e);o.clear(),e=null,t=null}}var Kc=u(ht());function Qc(e,t){const r=new Set;function o(o){r.add(o);e?.(((e,...t)=>{o(e);for(const e of t)o(e)}));return()=>{r.delete(o),t?.()}}return o.emit=function(e,...t){for(const o of r){o(e);for(const e of t)o(e)}},o.handlers=r,o}var Zc=e=>t=>function(r){return t((function(t){r(e(t))}))};function Jc(e){return t=>function(r){let o=!1;const n=t((function(e){o=!0,r(e)}));return o||r(e instanceof Function?e():e),n}}var ed=(e=((e,t)=>e===t))=>t=>function(r){let o;return t((function(t){e(t,o)||(o=t,r(t))}))},td=e=>{const t=new Set;let r=null;return function(o){return t.add(o),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(o),0===t.size&&(r?.(),r=null)}}};function rd(e,...t){return t.reduce(((e,t)=>t(e)),e)}var od=(...e)=>{const t=Array.from(e);return function(e){const r=t.map((function(t){return t(e)}));return function(){for(const e of r)e()}}};function nd(e){return function(t){let r=null;const o=e((function(e){r?.(),r=e?e(t):e}));return function(){o(),r?.(),r=null}}}function id(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),o=t.map(((t,o)=>t((function(t){r[o]=t,e(r)}))));return function(){o.forEach((e=>e())),r.length=0}}}var sd=Symbol("NO_VALUE");function ad(e){let t=sd;const r=Qc();return{subscribe:r,value:()=>(t===sd&&(t=e()),t),update(e){t=e,r.emit(t)}}}var ld=u(bt());function cd(e,t){const{block:r,event:o}=t;return rd((t=>{const n=r.getType(e),i=(0,ld.default)(o.subscribe([e],(function(o){o.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==n?i():t(o)})));return i}),td)}function dd(e,t){if(!t)return e;let r;return(...o)=>{const n=e(...o);return t(n,r)||(r=n),r}}var ud=function(e,t,r,o){const n=dd(t,o?.equals),i=Qc();return{subscribe:rd(od(e,i),Zc(n),ed(),td),update:r,value:n,flush:()=>i.emit()}};var hd=class{settings;clampCamera=!1;clampResult=ad((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#c;viewportPadding=ad((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_legacyApi:o}=e,n=rd(r.onActiveChanged,Jc(),Zc((()=>r.get()))),i=rd(n,Zc((r=>null!=r&&t.isValid(r)?rd(cd(r,e),Jc([]),Zc((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),nd),s=rd(n,Zc((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:rd(cd(r,e),Jc([]),Zc((()=>r)))})),nd);this.settings={subscribe:rd(s,Zc((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),ed(Kc.default),td),update({width:e,height:r,pixelRatio:o}){const n=t.findByType("camera")[0];null!=n&&(t.setFloat(n,"camera/resolution/width",e),t.setFloat(n,"camera/resolution/height",r),t.setFloat(n,"camera/pixelRatio",o))},value(){const e=t.findByType("camera")[0];return null==e?{width:0,height:0,pixelRatio:1}:{width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}}},this.zoomLevel=ud(od(r.onZoomLevelChanged,i),(()=>{const e=r.get(),{pixelRatio:o}=this.settings.value();return null!=e&&t.isValid(e)?r.getZoomLevel()/o:1}),(e=>{const o=r.get(),{pixelRatio:n}=this.settings.value();null!=o&&t.isValid(o)&&r.setZoomLevel(e*n)})),this.#c={subscribe:rd(s,Zc((e=>o.getValue(e,"ubq/designblocks/Camera","zoomLevel"))),ed()),value(){const e=t.findByType("camera")[0];return null==e?1:o.getValue(e,"ubq/designblocks/Camera","zoomLevel")}},this.autoFit=ud(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:rd(this.clampResult.subscribe,Zc((e=>e.scrollPercentage)),ed(Kc.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:rd(id(this.clampResult.subscribe,this.#c.subscribe,this.settings.subscribe),Zc((([e,t,r])=>{const o=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},n=t??this.#c.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:o.x*n/i,y:o.y*n/i}})),ed(Kc.default)),value:()=>{const e=this.clampResult.value().sceneSize??{x:0,y:0},t=this.#c.value()??10,r=this.settings.value().pixelRatio??1;return{x:e.x*t/r,y:e.y*t/r}}},this.scroll=e=>{const r=t.findByType("camera")[0];if(null==r)return;const o=this.#c.value(),n=this.settings.value().pixelRatio,i=e.x*n/o,s=e.y*n/o,a={x:t.getPositionX(r)+i,y:t.getPositionY(r)+s};t.setPositionX(r,a.x),t.setPositionY(r,a.y)}}};function pd(e,t){const r=`[UBQ] ${e}`;switch(t){case"Warning":console.warn(r);break;case"Error":console.error(r);break;case"Info":console.info(r);break;default:console.log(r)}}var fd="1.57.0-rc.0".includes("nightly")?"https://cdn.img.ly/nightlies/1.57.0-rc.0/packages/imgly/cesdk-engine/1.57.0-rc.0/assets":"https://cdn.img.ly/packages/imgly/cesdk-engine/1.57.0-rc.0/assets";function gd(e,t){return t??="undefined"==typeof window?void 0:window.location.href,new URL(e??"",t).href.replace(/\/*$/,"/")}function md(e={}){const t={...e,license:e.license??"",baseURL:e.baseURL??fd,core:e.core??{baseURL:"core/"},logger:e.logger??pd,presets:e.presets??{}};return t.baseURL=gd(t.baseURL),t.core.baseURL=gd(t.core.baseURL,t.baseURL),t}var bd={warnKeys(e){if(e.scene||e.page||e.assetSources||e.presets?.colorPalettes||e.presets?.images||e.presets?.pageFormats||e.presets?.colorPalettes||e.variables||e.callbacks?.log||e.initialSceneMode||e.initialSceneString||e.initialSceneURL||e.initialImageURL)return"Your configuration contains keys that are no longer supported and will be ignored. Refer to https://img.ly/docs/cesdk/introduction/migration_1_13/ for information about the removed keys."}};function yd(e,t){return t?e.flatMap((e=>{const r=e.warnKeys?.(t);return"string"==typeof r?[r]:r??[]})):[]}function vd(e,t,r){if(t)for(const o of e)o.applyFallback?.(t,r)}function wd(e,t){return t?e.reduce(((e,t)=>t.migrateConfigObject?t.migrateConfigObject(e):e),t):t}var kd,_d,Cd,Ed,Sd=[bd,new class _TypefaceMigration{static APIFALLBACK_TYPEFACES_SOURCE_ID="apiFallbackTypefaces";warnKeys(e){if(e.presets?.typefaces)return"The `presets.typefaces` configuration option is deprecated. Use the AssetAPI to add typefaces instead."}applyFallback(e,t){if(e)try{const r=t.asset;if(e.presets?.typefaces){r.addLocalSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID);for(const[t,o]of Object.entries(e.presets.typefaces))r.addAssetToSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID,{id:t,payload:{typeface:{name:o.family,fonts:o.fonts.map((e=>({subFamily:`${e.weight} ${e.style}`,style:e.style,uri:e.fontURL,weight:e.weight})))}}})}}catch(e){console.error(e)}}}];function xd(e,t,r=void 0){const o=e=>{sr(t.setContext("")),e.preventDefault()},n=e=>{sr(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",o,!1),e.addEventListener("webglcontextrestored",n,!1),()=>{e.removeEventListener("webglcontextlost",o),e.removeEventListener("webglcontextrestored",n)}}function Td(e){const t={key:255,characters:e.key,shiftIsHeld:e.shiftKey,commandIsHeld:e.metaKey||e.ctrlKey,optionIsHeld:e.altKey,timestamp:Date.now()};switch(e.key.toUpperCase()){case"0":t.key=0;break;case"1":t.key=1;break;case"2":t.key=2;break;case"3":t.key=3;break;case"4":t.key=4;break;case"5":t.key=5;break;case"6":t.key=6;break;case"7":t.key=7;break;case"8":t.key=8;break;case"9":t.key=9;break;case"A":t.key=10;break;case"B":t.key=11;break;case"C":t.key=12;break;case"D":t.key=13;break;case"E":t.key=14;break;case"F":t.key=15;break;case"G":t.key=16;break;case"H":t.key=17;break;case"I":t.key=18;break;case"J":t.key=19;break;case"K":t.key=20;break;case"L":t.key=21;break;case"M":t.key=22;break;case"N":t.key=23;break;case"O":t.key=24;break;case"P":t.key=25;break;case"Q":t.key=26;break;case"R":t.key=27;break;case"S":t.key=28;break;case"T":t.key=29;break;case"U":t.key=30;break;case"V":t.key=31;break;case"W":t.key=32;break;case"X":t.key=33;break;case"Y":t.key=34;break;case"Z":t.key=35;break;case" ":t.key=42;break;case"ESCAPE":t.key=43,t.characters="";break;case"BACKSPACE":t.key=40,t.characters="";break;case"DELETE":t.key=44,t.characters="";break;case"ENTER":t.key=41,t.characters=t.shiftIsHeld?"\u2028":"\n";break;case"CONTROL":t.key=45,t.characters="";break;case"ALT":t.key=46,t.characters="";break;case"SHIFT":t.key=47,t.characters="";break;case"ARROWLEFT":t.key=36,t.characters="";break;case"ARROWRIGHT":t.key=37,t.characters="";break;case"ARROWUP":t.key=38,t.characters="";break;case"ARROWDOWN":t.key=39,t.characters="";break;case"DEAD":t.key=255,t.characters=""}return t}Cd=[pr({disabledInModes:["Playback"]})],_d=[pr({disabledInModes:["Playback"]})],kd=[pr({disabledInModes:["Playback"]})];var Pd=class{constructor(e){b(Ed,5,this),v(this,"ubique"),v(this,"notificationStream",(e=>{const t=this.ubique.addEventCallback("NotificationEvent",(t=>e({type:zc[t.type],i18n:t.i18n})));return()=>{t.dispose(),t.delete()}})),v(this,"designElementLifecycleStream",(e=>t=>{const r=this.ubique.addEventCallback(e,t);return()=>{r.dispose(),r.delete()}})),v(this,"historyStream",(e=>{const t=this.ubique.addEventCallback("HistoryUpdatedEvent",e);return()=>{t.dispose(),t.delete()}})),this.ubique=e.getInternalAPI()}dispose(){this.ubique.delete()}setErrorCallback(e,t){this.ubique.setErrorCallback(e,t)}getSelectedText(){return sr(this.ubique.getSelectedText())}hasComponent(e,t){return sr(this.ubique.hasComponent(e,t))}getValue(e,t,r){return sr(this.ubique.getValue(e,t,r))}execute(e,t){let r;const o=new Promise(((o,n)=>{r=this.ubique.ubqExecute(e,t,(e=>{try{const t=sr(e);o(t)}catch(e){n(e)}}))}));return sr(r),o}sendKey(e){return this.execute("ubq/inputs/keyboardkey",Td(e))}changeSceneLayout(e,t,r,o){return this.execute("ubq/scene/changeLayout",[e,Gc[t],r,o])}};y(Ed=h(null),1,"getSelectedText",Cd,Pd),y(Ed,1,"hasComponent",_d,Pd),y(Ed,1,"getValue",kd,Pd),m(Ed,Pd);var Ad=!1;var Fd="https://api.img.ly/activate";var Md=u(vt()),Id="./cesdk-v1.57.0-rc.0-44YCFRT6.data",Ld="./cesdk-v1.57.0-rc.0-QLZZJUAO.wasm",Rd=Md.default,Dd=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Bd=-1!==Dd.indexOf("Edge"),Od=!!Dd.match(/msie|trident/i),jd=/\b(iPad|iPhone|iPod)\b/.test(Dd)&&/WebKit/.test(Dd)&&!/Edge/.test(Dd)&&("undefined"==typeof window||!("MSStream"in window)),$d=/(WOW64|Win32|i[3-6]86)/.test(navigator.userAgent)||/Win32|i[3-6]86|armv[6-7]/.test(navigator.platform),qd=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function Ud(){try{return new WebAssembly.Memory({initial:Wd(jd?512:32),maximum:Wd($d?1024:2048)})}catch(e){return new WebAssembly.Memory({initial:Wd(32),maximum:Wd($d?1024:2048)})}}function Wd(e){return 1024*e*1024/65536}async function Nd(e,t){const{core:r}=t,o=t.logger,n=qd(Ld,r.baseURL).toString(),i=qd(Id,r.baseURL).toString(),s=/electron/i.test(navigator.userAgent),a=function(e,t=fetch){if(!e.license)throw new Error("Missing license key in config");return e.license.length<128?t(Fd,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e.license,userId:e.userId})}).then((e=>{if(e.ok)return e.json();throw new Error("Unfortunately we are experiencing a server down time and your License key cannot be validated. We're already working on a fix and will restore service soon. Should services not restore within the hour, kindly get in touch with our support team.")})).then((e=>{if("valid"===e.status)return e.license;throw"expired"===e.status?new Error("Thanks for using IMG.LY for creative editing. Please note that your license file or commercial use is expired. Please get in touch with our sales team to discuss extension of your commercial license."):new Error("The License Key (API Key) you are using to access the IMG.LY SDK is invalid. Please ensure that you are using the license key tied to your subscription and get in touch with our support team.")})):Promise.resolve(e.license)}(t),l=s?await fetch(i,{credentials:"same-origin"}).then((e=>e.arrayBuffer())).then((e=>function(t,r){if(t!==i)return null;if(r===e.byteLength)return e;throw new Error(`Attempt to get preloaded package of unknown name or size: ${t} ${r}`)})):void 0;return new Promise(((r,s)=>{const c={getPreloadedPackage:l,locateFile:(e,t)=>e.endsWith(".wasm")?n:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&o(e,"Info")},printErr:e=>{e&&"undefined"!==e&&o(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:Ud()};Rd(c).then((async o=>{o.specialHTMLTargets["!canvas"]=e;o.emscripten_ubq_settings_forceWebGL1=jd||!!t?.forceWebGL1;const n=sr(o.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");sr(e.unlockWithLicense(t))}(n,await a),function(e,t){const r=new EditorAPI(e),o=new AssetAPI(e);if(r.setRole(t.role??"Creator"),Ad){const t=new Pd(e);t.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),t.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e))),t.dispose()}r.setSettingString("basePath",t.baseURL),r.setSettingBool("showBuildVersion",Ad||!1),t.featureFlags?.preventScrolling&&(r.setSettingBool("touch/singlePointPanning",!1),r.setSettingBool("touch/dragStartCanSelect",!1)),o.addLocalSource("ly.img.text"),function(){Ad&&(r.setSettingBool("features/hspSelectiveAdjustmentsEnabled",!1),r.setSettingBool("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;r.setSettingBool("features/singlePageModeEnabled",e),r.setSettingBool("features/effectsEnabled",!0)}(),function(){const t=new VariableAPI(e);(Ad||"undefined"!=typeof window&&window.Cypress)&&(t.setString("company_name","img.ly"),t.setString("first_name","Charly"),t.setString("last_name","Williams"),t.setString("address","742 Evergreen Terrace"),t.setString("city","Springfield"))}(),r.startTracking(t.license,t.userId??"")}(n,t),r(n)})).catch(s)}))}var Hd=class{_reactor;_updateHandler=null;debugName;dirty=!0;readCalls=new Set;constructor(e,t){this.debugName=t,this._reactor=e}dispose(){this._updateHandler=null,this._reactor._unregisterReaction(this),this._reactor=null}track(e){return this._reactor._trackReaction(this,e)}subscribe(e){return this._reactor._registerReaction(this),this._updateHandler=e,()=>{this._updateHandler=null,this._reactor._unregisterReaction(this)}}update(){this._updateHandler?.()}},Vd=u(ht()),zd=Symbol("NO_VALUE"),Gd=class{callId;_value=zd;_lastUpdateValue=zd;_readFromEngine;_disabledInModes=[];constructor(e,t,r){this.callId=e,this._readFromEngine=t,this.read(),this._lastUpdateValue=this._value,this._disabledInModes=r??[]}readCachedValue(){return this._value===zd||this.revalidate?this.read():this._value}revalidate=!1;invalidate(){this.revalidate=!0}read(){const e=this._readFromEngine();return this.revalidate=!1,(0,Vd.default)(this._value,e)?this._value:(this._value=e,e)}updateValueAndCheckDirty(){try{const e=this.read(),t=this._lastUpdateValue!==e;return this._lastUpdateValue=e,t}catch{return this._lastUpdateValue=zd,!0}}update(e){this._readFromEngine=e}isDisabledInMode(e){return this._disabledInModes.includes(e)}},Xd=class{readCalls=new Map;_createOrUpdateReadCall(e,t,r){if(this.readCalls.has(e)){this.readCalls.get(e).update(t)}else this.readCalls.set(e,new Gd(e,t,r))}registeredReactions=new Set;activeReactions=new Set;get isTracking(){return this.activeReactions.size>0}_nextReaction;_resolveNextReaction;_createNextReaction(){this._nextReaction=new Promise((e=>{this._resolveNextReaction=e}))}currentMode;constructor(e){this.currentMode=e,this._createNextReaction()}get nextReaction(){return this._nextReaction}_getterCalled(e,t,r){if(this.isTracking){this._createOrUpdateReadCall(e,t,r);for(const t of this.activeReactions)t.readCalls.add(e)}}_setterCalled(){for(const e of this.readCalls.values())e.invalidate()}read(e,t){return this.isTracking&&this.readCalls.has(e)?this.readCalls.get(e).readCachedValue():t()}createReaction(e){return new Hd(this,e)}_registerReaction(e){this.registeredReactions.add(e)}_unregisterReaction(e){this.registeredReactions.delete(e)}_cleanupReadCalls(){const e=new Set;for(const t of this.registeredReactions)for(const r of t.readCalls)e.add(r);for(const[t]of this.readCalls)e.has(t)||this.readCalls.delete(t)}#d=new Set;updateDirtyReactions(){const e=new Set;for(const[t,r]of this.readCalls)null!=this.currentMode&&r.isDisabledInMode(this.currentMode)||r.updateValueAndCheckDirty()&&e.add(t);if(e.size>0)for(const t of this.registeredReactions)if(!t.dirty)for(const r of t.readCalls)if(e.has(r)){t.dirty=!0;break}for(const e of this.registeredReactions)if(!this.#d.has(e)&&e.dirty)try{this.#d.add(e),e.update()}finally{e.dirty=!1,this.#d.delete(e)}this._cleanupReadCalls(),this._resolveNextReaction(),this._createNextReaction()}_trackReaction(e,t){try{return this.activeReactions.add(e),e.readCalls.clear(),t()}finally{e.dirty=!1,this.activeReactions.delete(e)}}decorateFunction(e,t){return function(e,t,r=t.name){Vr[r]??=0;const o=Vr[r]++;return function(...n){const i=this,s=`${r}${o}-${JSON.stringify(n,null,0)}`;function a(){return Reflect.apply(t,i,n)}return e._getterCalled(s,a),e.read(s,a)}}(this,e,t)}decorateObject(e){return function(e,t){const r=t.constructor?.name??crypto.randomUUID(),o=[];let n=!1;const i=Object.getOwnPropertyNames(t.constructor.prototype).concat(Object.getOwnPropertyNames(t));for(const a of i){const i=t[a];if("function"==typeof(s=i)&&hr in s)if("getter"===i[hr].type){let s=function(...t){if(n)throw new Error("Disposed @getter proxy called");const o=this,s=`${r}-${a.toString()}-${JSON.stringify(t,null,0)}`;function c(){return Reflect.apply(i,o,t)}return e._getterCalled(s,c,l),e.read(s,c)};const l=i[hr].disabledInModes;o.push(zr(t,a,i)),t[a]=s}else if("setter"===i[hr].type){let r=function(...t){if(n)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};o.push(zr(t,a,i)),t[a]=r}}var s;return function(){n=!0;for(const e of o)e();o.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear()}},Yd='url("data:image/svg+xml,%3Csvg width=%2722%27 height=%2725%27 viewBox=%270 0 22 25%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cg filter=%27url(%23filter0_d)%27%3E%3Cpath d=%27M18 11.1071C18 14.5637 15.5566 17.4515 12.3314 18.0846V20L7.20308 17.0145L12.3314 14.0289V15.7825C14.3292 15.1951 15.7946 13.3221 15.7946 11.107C15.7946 8.42285 13.6437 6.23908 11 6.23908C8.35629 6.23908 6.20542 8.42285 6.20542 11.107C6.20542 11.8299 6.35745 12.5252 6.65738 13.1736L4.66118 14.1255C4.22245 13.1771 4 12.1616 4 11.1071C4.00007 7.18825 7.1403 4 11.0001 4C14.8599 4 18 7.18825 18 11.1071Z%27 fill=%27black%27/%3E%3Cpath d=%27M12.8314 15.0559V14.0289V13.1593L12.0799 13.5968L6.95152 16.5824L6.20927 17.0145L6.95152 17.4466L12.0799 20.4321L12.8314 20.8696V20V18.4841C16.0889 17.6521 18.5 14.6573 18.5 11.1071C18.5 6.9193 15.1431 3.5 11.0001 3.5C6.85702 3.5 3.50008 6.91929 3.5 11.1071V11.1071C3.5 12.2334 3.73793 13.3206 4.20739 14.3354L4.41978 14.7946L4.8764 14.5768L6.8726 13.6249L7.31866 13.4122L7.11118 12.9637C6.84206 12.3819 6.70542 11.7584 6.70542 11.107C6.70542 8.69181 8.63956 6.73908 11 6.73908C13.3604 6.73908 15.2946 8.69181 15.2946 11.107C15.2946 12.8513 14.2837 14.3564 12.8314 15.0559Z%27 stroke=%27white%27/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id=%27filter0_d%27 x=%270.0599999%27 y=%270.0599999%27 width=%2721.88%27 height=%2724.6193%27 filterUnits=%27userSpaceOnUse%27 color-interpolation-filters=%27sRGB%27%3E%3CfeFlood flood-opacity=%270%27 result=%27BackgroundImageFix%27/%3E%3CfeColorMatrix in=%27SourceAlpha%27 type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0%27/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation=%271.47%27/%3E%3CfeColorMatrix type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0%27/%3E%3CfeBlend mode=%27normal%27 in2=%27BackgroundImageFix%27 result=%27effect1_dropShadow%27/%3E%3CfeBlend mode=%27normal%27 in=%27SourceGraphic%27 in2=%27effect1_dropShadow%27 result=%27shape%27/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer';function Kd(e,t){let r;return t.onStateChanged((()=>{const o=function(e,t){switch(e){case"Arrow":return"default";case"Move":return"move";case"MoveNotPermitted":return"auto";case"Resize":{const e=180*t/Math.PI+45;if(!Od&&!Bd)return`url("data:image/svg+xml,%3Csvg style='transform: rotate(${e}deg)' width ='22' height ='22' viewBox ='0 0 22 22' fill ='none' xmlns ='http://www.w3.org/2000/svg'%3E%3Cg filter ='url(%23filter0_d)'%3E%3Cpath d ='M13.7 11.1L9.7 15.2L12.5 18H4V9.5L6.9 12.3L10.9 8.3L12.3 6.9L9.5 4H18V12.5L15.2 9.7L13.7 11.1Z' fill ='white'/%3E%3C/g%3E%3Cpath d ='M12.7 10.7L8.3 15.2L10.1 17H5V11.9L6.9 13.8L11.3 9.3L13.8 6.9L11.9 5H17V10.1L15.2 8.3L12.7 10.7Z' fill ='black'/%3E%3Cdefs%3E%3Cfilter id ='filter0_d' x ='0' y ='0' width ='22' height ='22' filterUnits ='userSpaceOnUse' color-interpolation-filters ='sRGB'%3E%3CfeFlood flood-opacity ='0' result ='BackgroundImageFix'/%3E%3CfeColorMatrix in ='SourceAlpha' type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation ='2'/%3E%3CfeColorMatrix type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0'/%3E%3CfeBlend mode ='normal' in2 ='BackgroundImageFix' result ='effect1_dropShadow'/%3E%3CfeBlend mode ='normal' in ='SourceGraphic' in2 ='effect1_dropShadow' result ='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer`;switch(e){case 90:case 270:return"nwse-resize";case 135:case 315:return"ns-resize";case 180:case 360:return"nesw-resize";case 225:return"ew-resize";default:return"move"}}case"Rotate":return Yd;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(o!==r){r=o;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:o});e.dispatchEvent(t)&&e.style.setProperty("cursor",o)}}))}var Qd=function(e,t,r,o,n){let i,s=null;const a=o.onStateChanged((()=>{i=o.getEditMode(),"Text"!==i||s?"Text"!==i&&s&&(s(),s=null):s=function(){const i=s();return()=>{i?.()};function s(){let i=!1,s="";if(null==e.parentElement)return console.warn('Could not attach hidden text input to the DOM: Canvas has no parentElement. This can happen if edit mode is switched to "Text", while the canvas is removed from the DOM.'),()=>{};const a=c();u();const l=h();return e.parentElement.appendChild(a),p(),()=>{l(),d()};function c(){const e=document.createElement("textarea");return e.id="ubq_internal-inline_text_editing_html_representation",e.setAttribute("data-cy","inline-text-editing-input"),e.autocapitalize="none",e.spellcheck=!1,e.cols=4096,e.style.contain="strict",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.position="fixed",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.border="0",e}function d(){a.blur(),a.remove()}function u(){const t=o.getTextCursorPositionInScreenSpaceX(),r=o.getTextCursorPositionInScreenSpaceY(),{left:n,top:i}=e.getBoundingClientRect();a.style.left=`${n+t/window.devicePixelRatio}px`,a.style.top=`${i+r/window.devicePixelRatio}px`}function h(){const t=e.getRootNode();a.addEventListener("input",w),a.addEventListener("keydown",_),a.addEventListener("copy",b),a.addEventListener("cut",y),a.addEventListener("compositionstart",C),a.addEventListener("compositionend",E),a.addEventListener("beforeinput",P),a.addEventListener("focusout",A),t.addEventListener("touchend",T),t.addEventListener("mousedown",T),t.addEventListener("mouseup",x);const r=o.onStateChanged((()=>{u()}));return()=>{a.removeEventListener("input",w),a.removeEventListener("keydown",_),a.removeEventListener("copy",b),a.removeEventListener("cut",y),a.removeEventListener("compositionstart",C),a.removeEventListener("compositionend",E),a.removeEventListener("beforeinput",P),a.removeEventListener("focusout",A),t.removeEventListener("mousedown",T),t.removeEventListener("mouseup",x),t.removeEventListener("touchend",T),r()}}function p(){null!==a.parentElement&&(a.focus(),f()||setTimeout((()=>a.focus()),0))}function f(){return a.getRootNode().activeElement===a}function g(e){return[...e].length}function m(e){const t=e.selectionEnd??e.selectionStart??0;return g(e.value.substring(0,t))}function b(e){try{const r=t.getSelectedText();""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}catch(e){console.error(e)}}function y(e){try{const r=t.getSelectedText();if(""!==r&&e.clipboardData){e.clipboardData.setData("text/plain",r),e.preventDefault();const o={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",o)}}catch(e){console.error(e)}}async function v(){return!(!i||r.unstable_isTextCursorInCompositionRange())&&(await E(),!0)}function w(e){const r=e.target,{value:o}=r;if(i){const e=m(a);t.execute("ubq/text/compositionUpdate",{value:o,cursorPosition:e})}else o.length>0&&(r.value="")}function k(e){const r={key:255,characters:e,shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}async function _(e){if(v(),1===e.key.length&&(s=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return i&&E(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void L();if("Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"Enter"!==e.key)return;const r=Td(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(a.value="")}async function C(){i=!0,await t.execute("ubq/text/compositionStart")}async function E(){i?(i=!1,a.value="",t.execute("ubq/text/compositionEnd")):a.value=""}async function S(){if(!i)return;n();if(await v())return;const e=r.unstable_getCursorPosition(),t=r.unstable_getCompositionRange(),o=e.end-t.start,s=m(a);e.start>=t.start&&e.start<=1+t.end&&o!==s&&E()}async function x(){S()}async function T(t){S(),t.target===e&&"Text"===o.getEditMode()&&(p(),t.preventDefault())}async function P(e){if(i&&!e.isComposing&&E(),null===e.data)return;const r=e.target,o=e.data;if(await v())k(s);else if(i){const e=g(o);t.execute("ubq/text/compositionUpdate",{value:o,cursorPosition:e})}else o.length>0&&("\n"!==o[0]&&k(o),r.value="")}function A(e){if(I(e.relatedTarget)&&F(e.relatedTarget));else{M(e)}}function F(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function M(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),o=e.dispatchEvent(r);return o&&p(),o}function I(e){return null!=e&&(e instanceof HTMLElement&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&e.type.match("^(text|number|url|email|search|tel)$")||e.isContentEditable))}async function L(){o.setEditMode("Transform")}}}()}));return()=>{s?.(),a()}};function Zd(e,t,r){const o=[],n=r=>{if("touch"===r.pointerType)return;const o=Jd(e,r);t.execute("ubq/inputs/mousemove",o)},i=r=>{if("touch"===r.pointerType)return;const o=e.getBoundingClientRect();if(r.clientX>=o.x&&r.clientX<=o.x+o.width&&r.clientY>=o.y&&r.clientY<=o.y+o.height)return;const n={...Jd(e,r),position:{x:1/0,y:1/0}};t.execute("ubq/inputs/mousemove",n)},s=n=>{if("touch"===n.pointerType)return;const i={...Jd(e,n),button:eu(n.button),state:0,shiftIsHeld:!!n.shiftKey};o[n.button]=!1,n.currentTarget.releasePointerCapture(n.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const n={...Jd(e,r),button:eu(r.button),state:1,shiftIsHeld:!!r.shiftKey};o[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",n)},l=r=>{if("touch"===r.pointerType)return;const n={...Jd(e,r),shiftIsHeld:!!r.shiftKey};o.forEach(((e,r)=>{if(e){const e={...n,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),o.length=0},c=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointermove",n),e.addEventListener("pointerleave",i),e.addEventListener("lostpointercapture",l),e.addEventListener("touchmove",c,{passive:!1}),()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointermove",n),e.removeEventListener("pointerleave",i),e.removeEventListener("lostpointercapture",l),e.removeEventListener("touchmove",c),e=null}}function Jd(e,t){const r=e.getBoundingClientRect(),o=r?.top??0,n=r?.left??0;return{position:{x:(t.clientX-n)*window.devicePixelRatio,y:(t.clientY-o)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function eu(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var tu=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=ud(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=ad((()=>{})),this.dispose=()=>{this.target.update(void 0),this.target=null,this.enabled=null,this.ubq=null,this.initialTarget=null,e=null,t=null}}initialize(e){let t;this.initialTarget=e;const r=od(this.enabled.subscribe,this.target.subscribe)((()=>{t?.(),t=void 0;const e=this.target.value();this.enabled.value()&&e&&(t=this.addWheelListener(e))}));this.target.update(e);return()=>{r(),t?.()}}setTarget(e){this.target.update(e);return()=>{this.target.update(this.initialTarget)}}addWheelListener(e){const t=e=>{if(!this.initialTarget)throw new Error("initialTarget is not set");const t={...Jd(this.initialTarget,e),deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,shiftIsHeld:!!e.shiftKey,ctrlOrMetaIsHeld:!!e.ctrlKey||!!e.metaKey};this.ubq.mouseWheel(t)&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("wheel",t,{passive:!1,capture:!0});return()=>{e.removeEventListener("wheel",t,{capture:!0}),e=null}}},ru=class{active=!1;enableDebug=!1;timestamp=0;baseTouches=[];touches=[];currentTransform;constructor(){this.currentTransform=this.emptyTransform()}touchAddRemove(e){const t=new Array(e.touches.length);for(let r=0;r<e.touches.length;r++){const o=e.touches.item(r);t[r]=ou(o)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),o=this.touches.find((e=>e.identifier===r.identifier));if(!o)return;o.x=r.clientX,o.y=r.clientY}}listen(e){return e.addEventListener("touchstart",this.touchstart,{passive:!0}),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchcancel),e.addEventListener("touchmove",this.touchmove,{passive:!0}),()=>{e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.touchcancel),e.removeEventListener("touchmove",this.touchmove)}}touchstart=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchstart")};touchend=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchend")};touchcancel=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchcancel")};touchmove=e=>{this.touchUpdate(e),this.timestamp=e.timeStamp,this.process("touchmove")};debugState;debug(){if(!this.enableDebug)return;const e=JSON.stringify(this.currentTransform);function t(e,[t,r,o],n){const i=document.createElement("div");return i.style.position="fixed",i.style.top="-25px",i.style.left="-25px",i.style.width="50px",i.style.height="50px",i.style.border=`3px ${n} rgb(${t},${r},${o})`,i.style.borderRadius="50%",i.style.borderStyle=n,i.style.backgroundColor=`rgba(${t},${r},${o}, 0.5)`,i.style.transformOrigin="center",i.style.textAlign="center",i.innerHTML=e,i.style.display="none",document.body.appendChild(i),i}this.debugState||(this.debugState={touches:[t("T1",[218,212,104],"solid"),t("T2",[218,212,104],"solid")],value:this.debugValueDiv(void 0,e,this.touches,[218,212,104]),baseTouches:[t("B1",[128,128,128],"solid"),t("B2",[128,128,128],"solid")]}),this.debugState.touches[0].style.display=this.touches[0]?"block":"none",this.debugState.touches[1].style.display=this.touches[1]?"block":"none",this.debugState.baseTouches[0].style.display=this.baseTouches[0]?"block":"none",this.debugState.baseTouches[1].style.display=this.baseTouches[1]?"block":"none",this.touches[0]&&(this.debugState.touches[0].style.transform=`translate(${this.touches[0]?.x}px, ${this.touches[0]?.y}px)`),this.touches[1]&&(this.debugState.touches[1].style.transform=`translate(${this.touches[1]?.x}px, ${this.touches[1]?.y}px)`),this.baseTouches[0]&&(this.debugState.baseTouches[0].style.transform=`translate(${this.baseTouches[0]?.x}px, ${this.baseTouches[0]?.y}px)`),this.baseTouches[1]&&(this.debugState.baseTouches[1].style.transform=`translate(${this.baseTouches[1]?.x}px, ${this.baseTouches[1]?.y}px)`),this.debugState.value=this.debugValueDiv(this.debugState.value,e,this.touches)}debugValueDiv(e,t,r,o){if(!e){const[t,r,n]=o??[128,128,128];(e=document.createElement("div")).style.position="fixed",e.style.top="50px",e.style.left="50px",e.style.width="300px",e.style.height="100px",e.style.border=`3px solid rgb(${t},${r},${n})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${n}, 0.5)`,e.style.transformOrigin="center",e.style.overflow="visible",e.style.textOverflow="visible",e.style.display="none",document.body.appendChild(e)}return this.active?e.style.borderStyle="solid":e.style.borderStyle="dashed",0===r.length?(e.style.display="none",e):(e.style.display="block",e.innerHTML=t,e)}resetBaseTouches(){this.baseTouches=this.touches.map(ou)}process(e){if("touchcancel"===e)return this.resetBaseTouches(),this.reset(),this.debug(),void this.emit(2);"touchstart"!==e&&"touchend"!==e||(this.resetBaseTouches(),this.debug()),!this.active&&this.shouldStart()&&(this.active=!0,this.emit(0)),"touchmove"===e&&(this.currentTransform=this.calculateTransform(),this.active&&this.emit(1)),this.debug(),this.active&&this.shouldStop()&&(this.active=!1,this.emit(2),this.reset())}shouldStart(){return 2===this.touches.length}shouldStop(){return 2!==this.touches.length}emit(e){const t={timestamp:this.timestamp,state:e,touchPoints:this.touches},r=this.makeEvent(t);for(const e of this.handlers)e(r)}handlers=new Set;addListener(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}reset(){this.active=!1,this.currentTransform=this.emptyTransform()}};function ou(e){if(null!=e)return e instanceof Touch?{identifier:e.identifier,x:e.clientX,y:e.clientY}:{identifier:e.identifier,x:e.x,y:e.y}}var nu=class _PanRecognizer extends ru{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=su(this.touches),t=su(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&iu(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function iu(e){return Math.sqrt(e.x**2+e.y**2)}function su(e){let t=0,r=0;for(let o=0;o<e.length;o++){const n=e[o];t+=n.x,r+=n.y}return t/=e.length,r/=e.length,{x:t,y:r}}var au=class _PinchRecognizer extends ru{static PINCH_THRESHOLD=.2;makeEvent(e){return{...e,scale:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(2!==e.length||2!==t.length)return 1;const r=Math.sqrt(Math.pow(e[0].x-e[1].x,2)+Math.pow(e[0].y-e[1].y,2));return Math.sqrt(Math.pow(t[0].x-t[1].x,2)+Math.pow(t[0].y-t[1].y,2))/r}emptyTransform(){return 1}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform()-1)>_PinchRecognizer.PINCH_THRESHOLD}},lu=class _PointRecognizer extends ru{static DISTANCE_THRESHOLD=5;static TAP_MAX_TIME=250;lastPosition={x:0,y:0};makeEvent(e){const t=this.tapDetected?this.tapLocation:e.touchPoints[0];return 0===e.state?(this.lastPosition=t,{button:0,state:1,position:t,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}):2===e.state?{button:0,state:0,position:t??this.lastPosition,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}:(this.lastPosition=t,{position:t,isTouch:!0,timestamp:e.timestamp})}previousNumTouches=0;fingerDownTimestamp=0;tapDetected=!1;tapLocation={x:0,y:0};process(e){if("touchstart"===e||"touchend"===e){this.tapDetected=!1;const e=1===this.touches.length&&0===this.previousNumTouches,t=0===this.touches.length&&1===this.previousNumTouches;e&&(this.fingerDownTimestamp=performance.now(),this.tapLocation=this.touches[0]),t&&performance.now()-this.fingerDownTimestamp<_PointRecognizer.TAP_MAX_TIME&&(this.tapDetected=!0),this.previousNumTouches=this.touches.length}super.process(e)}calculateTransform(){if(0===this.touches.length||0===this.baseTouches.length)return{x:0,y:0};const e=this.touches[0],t=this.baseTouches[0];return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return this.tapDetected||1===this.touches.length&&iu(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},cu=class _RotateRecognizer extends ru{static ROTATE_THRESHOLD=.1;makeEvent(e){return{...e,rotation:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(e.length<2||t.length<2)return 0;const r=Math.atan2(e[1].y-e[0].y,e[1].x-e[0].x);return Math.atan2(t[1].y-t[0].y,t[1].x-t[0].x)-r}emptyTransform(){return 0}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform())>_RotateRecognizer.ROTATE_THRESHOLD}};function du(e,t,r){const o=[],n=new lu;o.push(n.listen(e)),o.push(n.addListener((o=>{"button"in o?(t.execute("ubq/inputs/mousebutton",uu(e,o)),r.update()):t.execute("ubq/inputs/mousemove",uu(e,o))})));const i=new nu;o.push(i.listen(e)),o.push(i.addListener((r=>{t.execute("ubq/inputs/touchpan",uu(e,r))})));const s=new au;o.push(s.listen(e)),o.push(s.addListener((r=>{t.execute("ubq/inputs/touchpinch",uu(e,r))})));const a=new cu;return o.push(a.listen(e)),o.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",uu(e,r))}))),()=>{o.forEach((e=>e()))}}function uu(e,t){const r=window.devicePixelRatio??1,{top:o,left:n}=e.getBoundingClientRect();if(1===r&&0===o&&0===n)return t;const i=e=>({x:(e.x-n)*r,y:(e.y-o)*r});if("position"in t)return{...t,position:i(t.position)};const s=t.touchPoints.map(i);return"panDistance"in t?{...t,touchPoints:s,panDistance:i(t.panDistance)}:{...t,touchPoints:s}}function hu(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var pu="application/javascript";var fu,gu,mu,bu,yu,vu,wu={Info:"Info",Warning:"Warning",Error:"Error"};function ku(e){return{msg:"setVisibility",visible:e}}(gu=fu||(fu={})).start=function(e){return{...e,msg:"exportVideo"}},gu.abort=function(){return{msg:"exportVideoAbort"}},gu.finished=function(e){return{...e,msg:"exportVideoFinished"}},gu.error=function(e){return{...e,msg:"exportVideoError"}},gu.progress=function(e){return{...e,msg:"exportVideoProgress"}},gu.log=function(e){return{...e,msg:"exportLog"}},(bu=mu||(mu={})).start=function(e){return{...e,msg:"exportStatic"}},bu.abort=function(){return{msg:"exportStaticAbort"}},bu.finished=function(e){return{...e,msg:"exportStaticFinished"}},bu.error=function(e){return{...e,msg:"exportStaticError"}},bu.log=function(e){return{...e,msg:"exportLog"}},(vu=yu||(yu={})).start=function(e){return{...e,msg:"exportWithColorMask"}},vu.abort=function(){return{msg:"exportWithColorMaskAbort"}},vu.finished=function(e){return{...e,msg:"exportWithColorMaskFinished"}},vu.error=function(e){return{...e,msg:"exportWithColorMaskError"}},vu.log=function(e){return{...e,msg:"exportLog"}};var _u=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportVideoFinished":{const t=new Blob([r.data],{type:r.mimeType});e(t);break}case"exportVideoError":t(r.error);break;case"exportVideoProgress":o?.onProgress?.(r.renderedFrames,r.encodedFrames,r.totalFrames);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(fu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(fu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}async export(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportStaticFinished":{const t=new Blob([r.data],{type:r.mimeType});e(t);break}case"exportStaticError":t(r.error);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(mu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(mu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}async exportWithColorMask(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportWithColorMaskFinished":{const[t,o]=r.data,n=new Blob([t],{type:r.mimeType}),i=new Blob([o],{type:r.mimeType});e([n,i]);break}case"exportWithColorMaskError":t(r.error);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(yu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(yu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}};function Cu(e){return{baseURL:e.baseURL,license:e.license,core:e.core,role:e.role,presets:e.presets,featureFlags:e.featureFlags,forceWebGL1:e.forceWebGL1,audioOutput:e.audioOutput}}async function Eu(e){const t="assets/core/worker-host-v1.57.0-rc.0.js".toString().split("/").pop(),r=await async function(e){if(!(e=e.toString()).includes("://")||e.includes(window.location.origin))return e;const t=`const _importScripts = importScripts;\n const _fixImports = (url) => new URL(url, '${new URL(e).href.split("/").slice(0,-1).join("/")}/').href;\n importScripts = (...urls) => _importScripts(...urls.map(_fixImports));`;return URL.createObjectURL(new Blob([`${t}importScripts("${e}")`],{type:pu}))}(new URL(t,e.core.baseURL));return new Worker(r)}function Su(e){const t=new Map,r=e.findAllSettings();for(const o of r)switch(e.getSettingType(o)){case"Bool":t.set(o,e.getSettingBool(o));break;case"Int":t.set(o,e.getSettingInt(o));break;case"Float":t.set(o,e.getSettingFloat(o));break;case"String":t.set(o,e.getSettingString(o));break;case"Color":t.set(o,e.getSettingColor(o));break;case"Enum":t.set(o,e.getSettingEnum(o))}return t}var xu=10;globalThis.ubq_browserTabHidden=!0;var Tu={value:()=>"undefined"==typeof document||"visible"===document.visibilityState,subscribe(e){if("undefined"==typeof document)return()=>{};{const t=()=>{e("visible"===document.visibilityState)};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}}};function Pu(e,t,r){return async(o,n,i,s)=>{Gt("handle",o,Bt());try{Gt("options",n,jt(Ot({mimeType:jt(Kt()),onProgress:jt(Rt()),h264Profile:jt(Bt()),h264Level:jt(Bt()),videoBitrate:jt(Bt()),audioBitrate:jt(Bt()),timeOffset:jt(Bt()),duration:jt(Bt()),framerate:jt(Bt()),targetWidth:jt(Bt()),targetHeight:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Kt())),Gt("progressCallback",i,jt(Rt())),Gt("options",s,jt(Ot({h264Profile:jt(Bt()),h264Level:jt(Bt()),videoBitrate:jt(Bt()),audioBitrate:jt(Bt()),timeOffset:jt(Bt()),duration:jt(Bt()),framerate:jt(Bt()),targetWidth:jt(Bt()),targetHeight:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportVideo(handle, mimeType, progressCallback, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const a=t.scene.get();if(null==a||!t.block.isValid(a))throw new Error("No valid scene available.");const l="object"==typeof n?n:{mimeType:n,onProgress:i,...s},c=l.onProgress,d=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),u=Su(t.editor),h=r(),p=t.editor.getActiveLicense(),f={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{f.trackingMetadata=t.editor.getTrackingMetadata()}catch{f.trackingMetadata=void 0}const g={block:o,mimeType:l.mimeType,targetWidth:l.targetWidth,targetHeight:l.targetHeight,duration:l.duration,framerate:l.framerate,h264Level:l.h264Level,h264Profile:l.h264Profile,videoBitrate:l.videoBitrate,audioBitrate:l.audioBitrate,timeOffset:l.timeOffset};if(e.featureFlags?.exportWorker??1){return new _u({...e,license:p}).exportVideo(d,u,g,{abortSignal:l.abortSignal,inactivityTimeout:h,onProgress:c},f)}return async function(e,t,r,o,n,i){let s,a,l=0,c=null;const d=i.visibility??Tu,u=i.inactivityTimeout,h=d.subscribe((()=>{null!==c&&(c=Date.now()),globalThis.ubq_browserTabHidden=!d.value()}));let p=null;function f(){clearTimeout(a),h(),p?.()}try{let h=function(){!0===d.value()&&null!==c&&Date.now()-c>u?s(new Error("Video export timed out due to inactivity.")):(l<xu&&m.update(),a=setTimeout(h,1))};const g=new OffscreenCanvas(64,64),m=await Nd(g,{...e,audioOutput:"none"}),b=new SceneAPI(m),y=new BlockAPI(m),v=new EditorAPI(m),w=new VariableAPI(m);if(p=()=>{m.delete()},function(e,t){for(const[r,o]of t)switch(e.getSettingType(r)){case"Bool":e.setSettingBool(r,o);break;case"Int":e.setSettingInt(r,o);break;case"Float":e.setSettingFloat(r,o);break;case"String":e.setSettingString(r,o);break;case"Color":e.setSettingColor(r,o);break;case"Enum":{const t=r,n=o;e.setSettingEnum(t,n)}}}(v,t),n?.trackingMetadata&&v.setTrackingMetadata(n.trackingMetadata),n?.uriResolver){let e=function(e,r){try{return t(e,r)}catch(t){return console.warn(`Error during execution of URI resolver: ${t}.\nMake sure the url resolver function does not reference any external variables. Falling back to default URI resolver.`),r(e)}};const t=(0,eval)(`'use strict';(${n.uriResolver})`);v.setURIResolver(e)}if(n?.scopes)for(const[e,t]of Object.entries(n.scopes))v.setGlobalScope(e,t);if(n?.textVariables)for(const[e,t]of Object.entries(n.textVariables))w.setString(e,t);if(n?.spotColors)for(const[e,t]of Object.entries(n.spotColors))v.setSpotColorRGB(e,t[0],t[1],t[2]);n?.spotColorForCutoutTypeSolid&&v.setSpotColorForCutoutType("Solid",n.spotColorForCutoutTypeSolid),n?.spotColorForCutoutTypeDashed&&v.setSpotColorForCutoutType("Dashed",n.spotColorForCutoutTypeDashed),n?.buffers&&v.restoreBuffers(n.buffers),await b.loadFromString(r);const k=y.getDuration(o.block),_=o.mimeType??"video/mp4";h();const C=await new Promise(((t,r)=>{s=r,e.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),m.exportVideoToBuffer(o.block,o.timeOffset??0,o.duration??k,_,((e,t,r)=>{l=e-t,c=Date.now(),i?.onProgress?.(e,t,r)}),(e=>{"error"in e?r(e.error):t(e)}),{h264Profile:o.h264Profile??77,h264Level:o.h264Level??52,framerate:o.framerate??30,videoBitrate:o.videoBitrate??0,audioBitrate:o.audioBitrate??0,useTargetSize:void 0!==o.targetWidth&&void 0!==o.targetHeight,targetWidth:o.targetWidth??0,targetHeight:o.targetHeight??0})})),E=new Uint8Array(C.byteLength);return E.set(C),f(),{data:E,mimeType:_}}catch(e){throw f(),e}}(l.abortSignal?{...e,abortSignal:l.abortSignal}:e,u,d,g,f,{onProgress:c,visibility:Mu,inactivityTimeout:h}).then((({data:e,mimeType:t})=>new Blob([e],{type:t})))}}var Au,Fu,Mu={value:()=>"visible"===document.visibilityState,subscribe:rd((Au=document,Fu="visibilitychange",function(e){return Au.addEventListener(Fu,e),function(){Au.removeEventListener(Fu,e)}}),Zc((()=>"visible"===document.visibilityState)))};var CreativeEngine=class{asset;block;editor;event;scene;variable;reactor;version="1.57.0-rc.0";#u;#h;#p;#f;#e;#g;#m=[];constructor(e,t,r){this.#e=e,this.#g=new Pd(e),this.asset=new AssetAPI(e),this.block=new BlockAPI(e),this.editor=new EditorAPI(e),this.event=new EventAPI(e),this.scene=new SceneAPI(e),this.variable=new VariableAPI(e),this.#f=new tu(this,e),this.#m.push(this.#f.dispose);const o=new Xd(this.editor.getEditMode());this.reactor=o;const n=[o.decorateObject(this.#g),o.decorateObject(this.block),o.decorateObject(this.editor),o.decorateObject(this.scene),o.decorateObject(this.variable)];let i=(0,_t.default)(o.updateDirtyReactions.bind(o),1e3/120,{leading:!0,trailing:!1}),s=this.addPostUpdateCallback(i);const a=this.editor.onStateChanged((()=>{o.currentMode=this.editor.getEditMode(),i="Playback"===o.currentMode?(0,_t.default)(o.updateDirtyReactions.bind(o),100,{leading:!0,trailing:!1}):(0,_t.default)(o.updateDirtyReactions.bind(o),1e3/120,{leading:!0,trailing:!1});const e=this.addPostUpdateCallback(i);s(),s=e}));this.#m.push((()=>{n.forEach((e=>e())),a(),s(),this.reactor.dispose()})),this.block.exportVideo=Pu(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_videoExportInactivityTimeout)),r.featureFlags?.exportWorker&&(this.block.export=function(e,t,r){return async(o,n,i)=>{Gt("handle",o,Bt());try{Gt("options",n,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Ut([Xt(),Qt()]))),Gt("options",i,jt(Ot({pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf you're using the deprecated signature:\ncesdk.engine.block.export(handle, mimeType, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const s=t.scene.get();if(null==s||!t.block.isValid(s))throw new Error("No valid scene available.");const a="object"==typeof n?n:{mimeType:n,...i},l=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),c=Su(t.editor),d=r(),u=t.editor.getActiveLicense(),h={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{h.trackingMetadata=t.editor.getTrackingMetadata()}catch{h.trackingMetadata=void 0}const p={block:o,mimeType:a.mimeType,pngCompressionLevel:a.pngCompressionLevel,jpegQuality:a.jpegQuality,webpQuality:a.webpQuality,targetWidth:a.targetWidth,targetHeight:a.targetHeight,exportPdfWithHighCompatibility:a.exportPdfWithHighCompatibility,exportPdfWithUnderlayer:a.exportPdfWithUnderlayer,underlayerSpotColorName:a.underlayerSpotColorName,underlayerOffset:a.underlayerOffset};return new _u({...e,license:u}).export(l,c,p,{abortSignal:a.abortSignal,inactivityTimeout:d},h)}}(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_exportInactivityTimeout)),this.block.exportWithColorMask=function(e,t,r){return async(o,n,i,s,a,l)=>{Gt("handle",o,Bt());try{Gt("maskColorR",n,Bt()),Gt("maskColorG",i,Bt()),Gt("maskColorB",s,Bt()),Gt("options",a,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Ut([Xt(),Qt()]))),Gt("maskColorR",i,Bt()),Gt("maskColorG",s,Bt()),Gt("maskColorB",a,Bt()),Gt("options",l,jt(Ot({pngCompressionLevel:jt(Nt(Wt(Dt(),9),0)),jpegQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Nt(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportWithColorMask(handle, mimeType, maskColorR, maskColorG, maskColorB, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.exportWithColorMask(handle, maskColorR, maskColorG, maskColorB, options)\n${e.message}`)}}const c=t.scene.get();if(null==c||!t.block.isValid(c))throw new Error("No valid scene available.");let d,u,h,p;"number"==typeof n?(d=n,u=i,h=s,p=a??{}):(d=i,u=s,h=a,p={mimeType:n,...l});const f=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),g=Su(t.editor),m=r(),b=t.editor.getActiveLicense(),y={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{y.trackingMetadata=t.editor.getTrackingMetadata()}catch{y.trackingMetadata=void 0}const v={block:o,maskColorR:d,maskColorG:u,maskColorB:h,mimeType:p.mimeType,pngCompressionLevel:p.pngCompressionLevel,jpegQuality:p.jpegQuality,webpQuality:p.webpQuality,targetWidth:p.targetWidth,targetHeight:p.targetHeight,exportPdfWithHighCompatibility:p.exportPdfWithHighCompatibility,exportPdfWithUnderlayer:p.exportPdfWithUnderlayer,underlayerSpotColorName:p.underlayerSpotColorName,underlayerOffset:p.underlayerOffset};return new _u({...e,license:b}).exportWithColorMask(f,g,v,{abortSignal:p.abortSignal,inactivityTimeout:m},y)}}(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_exportInactivityTimeout))),"getInternalCanvas"in t?(this.#h=t.getInternalCanvas(),this.#p=t):this.#h=t,this.#u=new hd(this),this.#b(),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.legacyAPI=this.#g)}addPlugin(e){if(e.initialize){const t={engine:{asset:this.asset,block:this.block,scene:this.scene,editor:this.editor,event:this.event,variable:this.variable}};e.initialize(t)}}unstable_setVideoExportInactivityTimeout(e){this._unstable_videoExportInactivityTimeout=e}_unstable_videoExportInactivityTimeout=1e4;unstable_setExportInactivityTimeout(e){this._unstable_exportInactivityTimeout=e}_unstable_exportInactivityTimeout=1e4;#y(){if(!this.#p)return;const e=this.#p.getInternalCanvas(),t=e.getBoundingClientRect();if(0===t.width||0===t.height)return;const r="undefined"!=typeof window?window.devicePixelRatio:1,o=t.width*r,n=t.height*r;e.width!==o&&(e.width=o),e.height!==n&&(e.height=n)}#v(){const{width:e,height:t}=this.#h,r="undefined"!=typeof window?window.devicePixelRatio:1,{height:o,width:n,pixelRatio:i}=this.#u.settings.value();if(!hu(n,e,1e-4)||!hu(o,t,1e-4)||!hu(i,r,1e-4)){this.#u.settings.update({height:t,width:e,pixelRatio:r});const o=this.scene.get();if(!hu(i,r,1e-4)&&null!==o&&!1===this.scene.isZoomAutoFitEnabled(o)){const e=this.scene.getZoomLevel();this.scene.setZoomLevel(e*(r/i))}}}#w=[];#k=[];addPostUpdateCallback(e){return this.#w.push(e),()=>{const t=this.#w.indexOf(e);-1!==t&&this.#w.splice(t,1)}}addPreUpdateCallback(e){return this.#k.push(e),()=>{const t=this.#k.indexOf(e);-1!==t&&this.#k.splice(t,1)}}#_;#b(e=!0){this.#C(e),this.#E()}#C(e=!0){let t,r=!1,o=0;if(this.#_)return;const n=()=>{if(this.#_=requestAnimationFrame(n),!r)try{this.#S(e),o=0}catch(e){throw o++,o>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),this.#x()),e}};this.#_=requestAnimationFrame(n)}#E(){if(e=this.#h,!("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement))return;var e;const t=this.#p??this.#h,r=this.#S.bind(this,!1),o=[Zd(t,this.#g,r),this.#f.initialize(t),Qd(t,this.#g,this.#e,this.editor,r),Kd(t,this.editor),du(t,this.#g,this.#e),xd(this.#h,this.#e,(()=>{this.#h.width=this.#h.width})),Yc(t,this.#T)];this.#P=()=>{o.reverse().forEach((e=>e()))}}setWheelEventTarget(e){return this.#f.setTarget(e)}#T=(0,wt.default)(function(){this.#S()}.bind(this),100,{leading:!0,trailing:!1});#P;#x(){this.#P?.(),this.#P=void 0,this.#_&&(cancelAnimationFrame(this.#_),this.#_=0)}#S(e=!0){for(const e of this.#k)e();if(e){1===this.block.findByType("scene").length&&this.#A()}this.#y(),this.#v(),this.#e.update();for(const e of this.#w)e()}#A(){if(this.#u.clampCamera){const e={sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}};this.#g.execute("cesdk/clampCameraAndRender",{horizontalPaddingInPixels:this._camera.viewportPadding.value().x,verticalPaddingInPixels:this._camera.viewportPadding.value().y}).then((e=>{(0,kt.default)(this.#u.clampResult.value(),e)||this.#u.clampResult.update(e)}),(()=>{(0,kt.default)(this.#u.clampResult.value(),e)||this.#u.clampResult.update(e)}))}else this.#g.execute("ubq/render")}get element(){return this.#p}dispose(){this.#m.forEach((e=>e())),this.#x(),this.asset.dispose(),this.#h=null,this.#p?.dispose(),this.#p=void 0,this.block=null,this.scene=null,this.variable=null,this.asset=null,this.editor=null,this.event=null,this.#w.length=0,this.#g.dispose(),this.#g=null,this.#e.delete(),this.#e=null}static async init(e,t){let r=function(e,t){if(r(t?.canvas))return t?.canvas;if(r(e))return console.warn("Passing an existing HTMLCanvasElement as a second parameter to CreativeEngine.init() is deprecated. Use the element property on the CreativeEngine instance to access a fully managed canvas to append into the DOM instead. For more information, have a look into our documentation at https://img.ly/docs/cesdk/next/engine/quickstart/#initialization."),e;return;function r(e){return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}}(t,e);const o="92aebbdf7c",n="1.57.0-rc.0";if(o||n){const e=["[CreativeEngine]"];n&&e.push(`v${n}`),o&&e.push(`Revision ${o}`),console.log(e.join(" "))}let i;r||(i=function(){customElements.get("cesdk-canvas")||customElements.define("cesdk-canvas",class HTMLCreativeEngineCanvasElement extends HTMLElement{#h;constructor(){super(),this.#h=document.createElement("canvas");const e=document.createElement("style");e.textContent=":host {display: block; width: 100%; height: 100%; contain: content;} canvas {position: absolute; inset: 0; width: 100%; height:100%; display: block; touch-action: none;}",this.attachShadow({mode:"closed"}).append(e,this.#h)}getInternalCanvas(){if(!this.#h)throw new Error("Internal canvas element is undefined");return this.#h}dispose(){this.#h?.remove(),this.#h=void 0}clear(){if(!this.#h)return;const e=this.#h.width;this.#h.width=1,this.#h.width=e}});return document.createElement("cesdk-canvas")}(),r=i.getInternalCanvas());const s=md(wd(Sd,e));if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of yd(Sd,e))s.logger(t,"Warning");const a=new this(await Nd(r,s),i??r,s);return Object.defineProperty(a,"version",{configurable:!1,writable:!1}),vd(Sd,s,a),a}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v4",excludeAssetSourceIds:t=[]}={}){return Vc(this,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:o=!1}={}){return Xc(this.asset,this.scene,t,r,o,void 0,e)}get _camera(){return this.#u}get _legacyApi(){return this.#g}};var Iu=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return console.error(e),!1}return!1},Lu=1e4,Ru=1e6,Du=8;async function Bu(){if("undefined"==typeof window)throw new Error("Window is undefined");const e=["VideoFrame","VideoDecoder","VideoEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(`Missing required web video APIs:\n${t.join("\n")}`)}const t={codec:"avc1.4D0034",width:1920,height:1080,avc:{format:"annexb"},framerate:30};if(!await VideoEncoder.isConfigSupported(t))throw new Error(`VideoEncoder config ${JSON.stringify(t)} not supported`);const r=new OffscreenCanvas(t.width,t.height),o=r.getContext("webgl2");if(!o)throw new Error("Could not create WebGL2 context");return o.clearColor(1,0,1,1),o.clear(o.COLOR_BUFFER_BIT),new Promise(((e,o)=>{setTimeout((()=>{o(new Error("Timed out during video export"))}),Lu);const n=new VideoEncoder({output:()=>e(),error:e=>o(new Error(`Could not create a new VideoEncoder: ${e}`))});try{n.configure(t)}catch(e){throw new Error(`Failed to configure a VideoEncoder object with ${JSON.stringify(t)}: ${e}`)}for(let e=0;e<Du;++e){const o=new VideoFrame(r,{timestamp:e*(Ru/t.framerate),duration:Ru/t.framerate});n.encode(o,{keyFrame:!0}),o.close()}n.flush().then((()=>{"closed"!==n.state&&n.close()}),(e=>{o(new Error(`Error during video export: ${e}`))}))}))}async function Ou(){if("undefined"==typeof window)throw new Error("Window is undefined");const e=["AudioDecoder","AudioEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(`Missing required web audio APIs:\n${t.join("\n")}`)}const t={codec:"mp4a.40.02",sampleRate:48e3,numberOfChannels:2,bitrate:128e3};if(!await AudioEncoder.isConfigSupported(t))throw new Error(`AudioEncoder config ${JSON.stringify(t)} not supported`);return new Promise(((e,r)=>{setTimeout((()=>{r(new Error("Timed out during audio export"))}),Lu);const o=new AudioEncoder({output:()=>e(),error:e=>r(new Error(`Could not create a new AudioEncoder with ${JSON.stringify(t)}: ${e}`))});try{o.configure(t)}catch(e){throw new Error(`Failed to configure an AudioEncoder object with ${JSON.stringify(t)}: ${e}`)}const n=1024,i=new Float32Array(n*t.numberOfChannels);for(let e=0;e<n;++e){const t=e/n;i[2*e+0]=Math.sin(880*Math.PI*t),i[2*e+1]=Math.sin(888*Math.PI*t)}for(let e=0;e<10;++e)try{const r=new AudioData({format:"f32",sampleRate:t.sampleRate,numberOfFrames:n,numberOfChannels:t.numberOfChannels,timestamp:e*n/t.sampleRate*Ru,data:i});o.encode(r),r.close()}catch(e){throw new Error(`Failed to encode AudioData in an encoder configured with ${JSON.stringify(t)}: ${e}`)}o.flush().then((()=>{"closed"!==o.state&&o.close()}),(e=>{r(new Error(`Error during audio export with ${t}: ${e}`))}))}))}function ju(){if("undefined"==typeof window)throw new Error("Window object is not available. This function should be run in a browser environment");const e=["VideoFrame","VideoDecoder","VideoEncoder","AudioDecoder","AudioEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(t.join("\n"))}}function $u(){try{return ju(),!0}catch{return!1}}async function qu(){await Promise.all([Bu(),Ou()])}async function Uu(){try{return await qu(),!0}catch(e){return!1}}var Wu,Nu,Hu=function(){try{const e=!0,t=!0,r="globalThis"in window,o="BigInt"in window,n="allSettled"in Promise,i="matchAll"in String.prototype,s=CSS.supports("contain: content"),a="MediaRecorder"in window&&"pause"in window.MediaRecorder.prototype,l=CSS.supports("color: lab(29.2345% 39.3825 20.0664)");return Iu()&&e&&t&&r&&o&&n&&i&&s&&a&&l}catch{return!1}};(Nu=Wu||(Wu={})).combineLatest=id,Nu.fan=td,Nu.makeSource=Qc,Nu.map=Zc,Nu.memo=ed,Nu.merge=od,Nu.pipe=rd,Nu.startWith=Jc,Nu.switchAll=nd;export{wu as LogLevel,zt as MimeType,_u as WorkerClient,vd as _applyFallback,cd as _getBlockStream,md as _initWithDefaults,ud as _makeEngineChannel,ad as _makeValueChannel,dd as _memoizeResult,wd as _migrateConfigObject,Wu as _streams,yd as _warnKeys,qu as checkVideoExportSupport,ju as checkVideoSupport,CreativeEngine as default,pd as defaultLogger,Pl as isCMYKColor,xl as isRGBAColor,Tl as isSpotColor,gd as normalizeBaseURL,Hu as supportsBrowser,$u as supportsVideo,Uu as supportsVideoExport,Iu as supportsWasm};
1
+ var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),a=e=>{throw TypeError(e)},l=(e,r,o)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,c=(e,r)=>t(e,"name",{value:r,configurable:!0}),d=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(s,a,l)=>(l=null!=s?e(n(s)):{},((e,n,s,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of o(n))i.call(e,l)||l===s||t(e,l,{get:()=>n[l],enumerable:!(a=r(n,l))||a.enumerable});return e})(!a&&s&&s.__esModule?l:t(l,"default",{value:s,enumerable:!0}),s)),h=t=>[,,,e(t?.[s("metadata")]??null)],p=["class","method","getter","setter","accessor","field","value","get","set"],f=e=>void 0!==e&&"function"!=typeof e?a("Function expected"):e,g=(e,t,r,o,n)=>({kind:p[e],name:t,metadata:o,addInitializer:e=>r._?a("Already initialized"):n.push(f(e||null))}),m=(e,t)=>l(t,s("metadata"),e[3]),b=(e,t,r,o)=>{for(var n=0,i=e[t>>1],s=i&&i.length;n<s;n++)1&t?i[n].call(r):o=i[n].call(r,o);return o},y=(e,o,n,i,s,l)=>{var d,u,h,b,y,v=7&o,w=!!(8&o),C=!!(16&o),x=v>3?e.length+1:v?w?1:2:0,T=p[v+5],P=v>3&&(e[x-1]=[]),A=e[x]||(e[x]=[]),F=v&&(!C&&!w&&(s=s.prototype),v<5&&(v>3||!C)&&r(v<4?s:{get[n](){return _(this,l)},set[n](e){return E(this,l,e)}},n));v?C&&v<4&&c(l,(v>2?"set ":v>1?"get ":"")+n):c(s,n);for(var M=i.length-1;M>=0;M--)b=g(v,n,h={},e[3],A),v&&(b.static=w,b.private=C,y=b.access={has:C?e=>k(s,e):e=>n in e},3^v&&(y.get=C?e=>(1^v?_:S)(e,s,4^v?l:F.get):e=>e[n]),v>2&&(y.set=C?(e,t)=>E(e,s,t,4^v?l:F.set):(e,t)=>e[n]=t)),u=(0,i[M])(v?v<4?C?l:F[T]:v>4?void 0:{get:F.get,set:F.set}:s,b),h._=1,4^v||void 0===u?f(u)&&(v>4?P.unshift(u):v?C?l=u:F[T]=u:s=u):"object"!=typeof u||null===u?a("Object expected"):(f(d=u.get)&&(F.get=d),f(d=u.set)&&(F.set=d),f(d=u.init)&&P.unshift(d));return v||m(e,s),F&&t(s,n,F),C?4^v?l:F:s},v=(e,t,r)=>l(e,"symbol"!=typeof t?t+"":t,r),w=(e,t,r)=>t.has(e)||a("Cannot "+r),k=(e,t)=>Object(t)!==t?a('Cannot use the "in" operator on this value'):e.has(t),_=(e,t,r)=>(w(e,t,"read from private field"),r?r.call(e):t.get(e)),C=(e,t,r)=>t.has(e)?a("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),E=(e,t,r,o)=>(w(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r),S=(e,t,r)=>(w(e,t,"access private method"),r),x=d({"../../../node_modules/lodash/isObject.js"(e,t){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}}),T=d({"../../../node_modules/lodash/_freeGlobal.js"(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r}}),P=d({"../../../node_modules/lodash/_root.js"(e,t){var r=T(),o="object"==typeof self&&self&&self.Object===Object&&self,n=r||o||Function("return this")();t.exports=n}}),A=d({"../../../node_modules/lodash/now.js"(e,t){var r=P();t.exports=function(){return r.Date.now()}}}),F=d({"../../../node_modules/lodash/_trimmedEndIndex.js"(e,t){var r=/\s/;t.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}}}),M=d({"../../../node_modules/lodash/_baseTrim.js"(e,t){var r=F(),o=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}}}),I=d({"../../../node_modules/lodash/_Symbol.js"(e,t){var r=P().Symbol;t.exports=r}}),R=d({"../../../node_modules/lodash/_getRawTag.js"(e,t){var r=I(),o=Object.prototype,n=o.hasOwnProperty,i=o.toString,s=r?r.toStringTag:void 0;t.exports=function(e){var t=n.call(e,s),r=e[s];try{e[s]=void 0;var o=!0}catch(e){}var a=i.call(e);return o&&(t?e[s]=r:delete e[s]),a}}}),L=d({"../../../node_modules/lodash/_objectToString.js"(e,t){var r=Object.prototype.toString;t.exports=function(e){return r.call(e)}}}),D=d({"../../../node_modules/lodash/_baseGetTag.js"(e,t){var r=I(),o=R(),n=L(),i=r?r.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):n(e)}}}),B=d({"../../../node_modules/lodash/isObjectLike.js"(e,t){t.exports=function(e){return null!=e&&"object"==typeof e}}}),O=d({"../../../node_modules/lodash/isSymbol.js"(e,t){var r=D(),o=B();t.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}}}),j=d({"../../../node_modules/lodash/toNumber.js"(e,t){var r=M(),o=x(),n=O(),i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(n(e))return NaN;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var c=s.test(e);return c||a.test(e)?l(e.slice(2),c?2:8):i.test(e)?NaN:+e}}}),$=d({"../../../node_modules/lodash/debounce.js"(e,t){var r=x(),o=A(),n=j(),i=Math.max,s=Math.min;t.exports=function(e,t,a){var l,c,d,u,h,p,f=0,g=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var r=l,o=c;return l=c=void 0,f=t,u=e.apply(o,r)}function v(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-f>=d}function w(){var e=o();if(v(e))return k(e);h=setTimeout(w,function(e){var r=t-(e-p);return m?s(r,d-(e-f)):r}(e))}function k(e){return h=void 0,b&&l?y(e):(l=c=void 0,u)}function _(){var e=o(),r=v(e);if(l=arguments,c=this,p=e,r){if(void 0===h)return function(e){return f=e,h=setTimeout(w,t),g?y(e):u}(p);if(m)return clearTimeout(h),h=setTimeout(w,t),y(p)}return void 0===h&&(h=setTimeout(w,t)),u}return t=n(t)||0,r(a)&&(g=!!a.leading,d=(m="maxWait"in a)?i(n(a.maxWait)||0,t):d,b="trailing"in a?!!a.trailing:b),_.cancel=function(){void 0!==h&&clearTimeout(h),f=0,l=p=c=h=void 0},_.flush=function(){return void 0===h?u:k(o())},_}}}),q=d({"../../../node_modules/lodash/_listCacheClear.js"(e,t){t.exports=function(){this.__data__=[],this.size=0}}}),U=d({"../../../node_modules/lodash/eq.js"(e,t){t.exports=function(e,t){return e===t||e!=e&&t!=t}}}),W=d({"../../../node_modules/lodash/_assocIndexOf.js"(e,t){var r=U();t.exports=function(e,t){for(var o=e.length;o--;)if(r(e[o][0],t))return o;return-1}}}),H=d({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=W(),o=Array.prototype.splice;t.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}}}),N=d({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=W();t.exports=function(e){var t=this.__data__,o=r(t,e);return o<0?void 0:t[o][1]}}}),V=d({"../../../node_modules/lodash/_listCacheHas.js"(e,t){var r=W();t.exports=function(e){return r(this.__data__,e)>-1}}}),z=d({"../../../node_modules/lodash/_listCacheSet.js"(e,t){var r=W();t.exports=function(e,t){var o=this.__data__,n=r(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}}}),G=d({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=q(),o=H(),n=N(),i=V(),s=z();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),X=d({"../../../node_modules/lodash/_stackClear.js"(e,t){var r=G();t.exports=function(){this.__data__=new r,this.size=0}}}),Y=d({"../../../node_modules/lodash/_stackDelete.js"(e,t){t.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}}),K=d({"../../../node_modules/lodash/_stackGet.js"(e,t){t.exports=function(e){return this.__data__.get(e)}}}),Q=d({"../../../node_modules/lodash/_stackHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),Z=d({"../../../node_modules/lodash/isFunction.js"(e,t){var r=D(),o=x();t.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}}}),J=d({"../../../node_modules/lodash/_coreJsData.js"(e,t){var r=P()["__core-js_shared__"];t.exports=r}}),ee=d({"../../../node_modules/lodash/_isMasked.js"(e,t){var r,o=J(),n=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!n&&n in e}}}),te=d({"../../../node_modules/lodash/_toSource.js"(e,t){var r=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}}}),re=d({"../../../node_modules/lodash/_baseIsNative.js"(e,t){var r=Z(),o=ee(),n=x(),i=te(),s=/^\[object .+?Constructor\]$/,a=Function.prototype,l=Object.prototype,c=a.toString,d=l.hasOwnProperty,u=RegExp("^"+c.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!n(e)||o(e))&&(r(e)?u:s).test(i(e))}}}),oe=d({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),ne=d({"../../../node_modules/lodash/_getNative.js"(e,t){var r=re(),o=oe();t.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}}}),ie=d({"../../../node_modules/lodash/_Map.js"(e,t){var r=ne()(P(),"Map");t.exports=r}}),se=d({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=ne()(Object,"create");t.exports=r}}),ae=d({"../../../node_modules/lodash/_hashClear.js"(e,t){var r=se();t.exports=function(){this.__data__=r?r(null):{},this.size=0}}}),le=d({"../../../node_modules/lodash/_hashDelete.js"(e,t){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}}),ce=d({"../../../node_modules/lodash/_hashGet.js"(e,t){var r=se(),o=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}}}),de=d({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=se(),o=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}}}),ue=d({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=se();t.exports=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),he=d({"../../../node_modules/lodash/_Hash.js"(e,t){var r=ae(),o=le(),n=ce(),i=de(),s=ue();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),pe=d({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=he(),o=G(),n=ie();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(n||o),string:new r}}}}),fe=d({"../../../node_modules/lodash/_isKeyable.js"(e,t){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}}),ge=d({"../../../node_modules/lodash/_getMapData.js"(e,t){var r=fe();t.exports=function(e,t){var o=e.__data__;return r(t)?o["string"==typeof t?"string":"hash"]:o.map}}}),me=d({"../../../node_modules/lodash/_mapCacheDelete.js"(e,t){var r=ge();t.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}}}),be=d({"../../../node_modules/lodash/_mapCacheGet.js"(e,t){var r=ge();t.exports=function(e){return r(this,e).get(e)}}}),ye=d({"../../../node_modules/lodash/_mapCacheHas.js"(e,t){var r=ge();t.exports=function(e){return r(this,e).has(e)}}}),ve=d({"../../../node_modules/lodash/_mapCacheSet.js"(e,t){var r=ge();t.exports=function(e,t){var o=r(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}}}),we=d({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=pe(),o=me(),n=be(),i=ye(),s=ve();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),ke=d({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=G(),o=ie(),n=we();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var s=i.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new n(s)}return i.set(e,t),this.size=i.size,this}}}),_e=d({"../../../node_modules/lodash/_Stack.js"(e,t){var r=G(),o=X(),n=Y(),i=K(),s=Q(),a=ke();function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=o,l.prototype.delete=n,l.prototype.get=i,l.prototype.has=s,l.prototype.set=a,t.exports=l}}),Ce=d({"../../../node_modules/lodash/_setCacheAdd.js"(e,t){t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}}}),Ee=d({"../../../node_modules/lodash/_setCacheHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),Se=d({"../../../node_modules/lodash/_SetCache.js"(e,t){var r=we(),o=Ce(),n=Ee();function i(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new r;++t<o;)this.add(e[t])}i.prototype.add=i.prototype.push=o,i.prototype.has=n,t.exports=i}}),xe=d({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(e[r],r,e))return!0;return!1}}}),Te=d({"../../../node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),Pe=d({"../../../node_modules/lodash/_equalArrays.js"(e,t){var r=Se(),o=xe(),n=Te();t.exports=function(e,t,i,s,a,l){var c=1&i,d=e.length,u=t.length;if(d!=u&&!(c&&u>d))return!1;var h=l.get(e),p=l.get(t);if(h&&p)return h==t&&p==e;var f=-1,g=!0,m=2&i?new r:void 0;for(l.set(e,t),l.set(t,e);++f<d;){var b=e[f],y=t[f];if(s)var v=c?s(y,b,f,t,e,l):s(b,y,f,e,t,l);if(void 0!==v){if(v)continue;g=!1;break}if(m){if(!o(t,(function(e,t){if(!n(m,t)&&(b===e||a(b,e,i,s,l)))return m.push(t)}))){g=!1;break}}else if(b!==y&&!a(b,y,i,s,l)){g=!1;break}}return l.delete(e),l.delete(t),g}}}),Ae=d({"../../../node_modules/lodash/_Uint8Array.js"(e,t){var r=P().Uint8Array;t.exports=r}}),Fe=d({"../../../node_modules/lodash/_mapToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,o){r[++t]=[o,e]})),r}}}),Me=d({"../../../node_modules/lodash/_setToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}}}),Ie=d({"../../../node_modules/lodash/_equalByTag.js"(e,t){var r=I(),o=Ae(),n=U(),i=Pe(),s=Fe(),a=Me(),l=r?r.prototype:void 0,c=l?l.valueOf:void 0;t.exports=function(e,t,r,l,d,u,h){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!u(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=s;case"[object Set]":var f=1&l;if(p||(p=a),e.size!=t.size&&!f)return!1;var g=h.get(e);if(g)return g==t;l|=2,h.set(e,t);var m=i(p(e),p(t),l,d,u,h);return h.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}}}),Re=d({"../../../node_modules/lodash/_arrayPush.js"(e,t){t.exports=function(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}}}),Le=d({"../../../node_modules/lodash/isArray.js"(e,t){var r=Array.isArray;t.exports=r}}),De=d({"../../../node_modules/lodash/_baseGetAllKeys.js"(e,t){var r=Re(),o=Le();t.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}}}),Be=d({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,o=null==e?0:e.length,n=0,i=[];++r<o;){var s=e[r];t(s,r,e)&&(i[n++]=s)}return i}}}),Oe=d({"../../../node_modules/lodash/stubArray.js"(e,t){t.exports=function(){return[]}}}),je=d({"../../../node_modules/lodash/_getSymbols.js"(e,t){var r=Be(),o=Oe(),n=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return n.call(e,t)})))}:o;t.exports=s}}),$e=d({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}}}),qe=d({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=D(),o=B();t.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}}}),Ue=d({"../../../node_modules/lodash/isArguments.js"(e,t){var r=qe(),o=B(),n=Object.prototype,i=n.hasOwnProperty,s=n.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};t.exports=a}}),We=d({"../../../node_modules/lodash/stubFalse.js"(e,t){t.exports=function(){return!1}}}),He=d({"../../../node_modules/lodash/isBuffer.js"(e,t){var r=P(),o=We(),n="object"==typeof e&&e&&!e.nodeType&&e,i=n&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===n?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||o;t.exports=a}}),Ne=d({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&r.test(e))&&e>-1&&e%1==0&&e<t}}}),Ve=d({"../../../node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),ze=d({"../../../node_modules/lodash/_baseIsTypedArray.js"(e,t){var r=D(),o=Ve(),n=B(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return n(e)&&o(e.length)&&!!i[r(e)]}}}),Ge=d({"../../../node_modules/lodash/_baseUnary.js"(e,t){t.exports=function(e){return function(t){return e(t)}}}}),Xe=d({"../../../node_modules/lodash/_nodeUtil.js"(e,t){var r=T(),o="object"==typeof e&&e&&!e.nodeType&&e,n=o&&"object"==typeof t&&t&&!t.nodeType&&t,i=n&&n.exports===o&&r.process,s=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();t.exports=s}}),Ye=d({"../../../node_modules/lodash/isTypedArray.js"(e,t){var r=ze(),o=Ge(),n=Xe(),i=n&&n.isTypedArray,s=i?o(i):r;t.exports=s}}),Ke=d({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=$e(),o=Ue(),n=Le(),i=He(),s=Ne(),a=Ye(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=n(e),d=!c&&o(e),u=!c&&!d&&i(e),h=!c&&!d&&!u&&a(e),p=c||d||u||h,f=p?r(e.length,String):[],g=f.length;for(var m in e)!t&&!l.call(e,m)||p&&("length"==m||u&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||s(m,g))||f.push(m);return f}}}),Qe=d({"../../../node_modules/lodash/_isPrototype.js"(e,t){var r=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}}}),Ze=d({"../../../node_modules/lodash/_overArg.js"(e,t){t.exports=function(e,t){return function(r){return e(t(r))}}}}),Je=d({"../../../node_modules/lodash/_nativeKeys.js"(e,t){var r=Ze()(Object.keys,Object);t.exports=r}}),et=d({"../../../node_modules/lodash/_baseKeys.js"(e,t){var r=Qe(),o=Je(),n=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return o(e);var t=[];for(var i in Object(e))n.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),tt=d({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=Z(),o=Ve();t.exports=function(e){return null!=e&&o(e.length)&&!r(e)}}}),rt=d({"../../../node_modules/lodash/keys.js"(e,t){var r=Ke(),o=et(),n=tt();t.exports=function(e){return n(e)?r(e):o(e)}}}),ot=d({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=De(),o=je(),n=rt();t.exports=function(e){return r(e,n,o)}}}),nt=d({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=ot(),o=Object.prototype.hasOwnProperty;t.exports=function(e,t,n,i,s,a){var l=1&n,c=r(e),d=c.length;if(d!=r(t).length&&!l)return!1;for(var u=d;u--;){var h=c[u];if(!(l?h in t:o.call(t,h)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var g=!0;a.set(e,t),a.set(t,e);for(var m=l;++u<d;){var b=e[h=c[u]],y=t[h];if(i)var v=l?i(y,b,h,t,e,a):i(b,y,h,e,t,a);if(!(void 0===v?b===y||s(b,y,n,i,a):v)){g=!1;break}m||(m="constructor"==h)}if(g&&!m){var w=e.constructor,k=t.constructor;w==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(g=!1)}return a.delete(e),a.delete(t),g}}}),it=d({"../../../node_modules/lodash/_DataView.js"(e,t){var r=ne()(P(),"DataView");t.exports=r}}),st=d({"../../../node_modules/lodash/_Promise.js"(e,t){var r=ne()(P(),"Promise");t.exports=r}}),at=d({"../../../node_modules/lodash/_Set.js"(e,t){var r=ne()(P(),"Set");t.exports=r}}),lt=d({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=ne()(P(),"WeakMap");t.exports=r}}),ct=d({"../../../node_modules/lodash/_getTag.js"(e,t){var r=it(),o=ie(),n=st(),i=at(),s=lt(),a=D(),l=te(),c="[object Map]",d="[object Promise]",u="[object Set]",h="[object WeakMap]",p="[object DataView]",f=l(r),g=l(o),m=l(n),b=l(i),y=l(s),v=a;(r&&v(new r(new ArrayBuffer(1)))!=p||o&&v(new o)!=c||n&&v(n.resolve())!=d||i&&v(new i)!=u||s&&v(new s)!=h)&&(v=function(e){var t=a(e),r="[object Object]"==t?e.constructor:void 0,o=r?l(r):"";if(o)switch(o){case f:return p;case g:return c;case m:return d;case b:return u;case y:return h}return t}),t.exports=v}}),dt=d({"../../../node_modules/lodash/_baseIsEqualDeep.js"(e,t){var r=_e(),o=Pe(),n=Ie(),i=nt(),s=ct(),a=Le(),l=He(),c=Ye(),d="[object Arguments]",u="[object Array]",h="[object Object]",p=Object.prototype.hasOwnProperty;t.exports=function(e,t,f,g,m,b){var y=a(e),v=a(t),w=y?u:s(e),k=v?u:s(t),_=(w=w==d?h:w)==h,C=(k=k==d?h:k)==h,E=w==k;if(E&&l(e)){if(!l(t))return!1;y=!0,_=!1}if(E&&!_)return b||(b=new r),y||c(e)?o(e,t,f,g,m,b):n(e,t,w,f,g,m,b);if(!(1&f)){var S=_&&p.call(e,"__wrapped__"),x=C&&p.call(t,"__wrapped__");if(S||x){var T=S?e.value():e,P=x?t.value():t;return b||(b=new r),m(T,P,f,g,b)}}return!!E&&(b||(b=new r),i(e,t,f,g,m,b))}}}),ut=d({"../../../node_modules/lodash/_baseIsEqual.js"(e,t){var r=dt(),o=B();t.exports=function e(t,n,i,s,a){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,s,e,a))}}}),ht=d({"../../../node_modules/lodash/isEqual.js"(e,t){var r=ut();t.exports=function(e,t){return r(e,t)}}}),pt=d({"../../../node_modules/lodash/throttle.js"(e,t){var r=$(),o=x();t.exports=function(e,t,n){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),r(e,t,{leading:i,maxWait:t,trailing:s})}}}),ft=d({"../../../node_modules/lodash/toFinite.js"(e,t){var r=j(),o=1/0;t.exports=function(e){return e?(e=r(e))===o||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}}}),gt=d({"../../../node_modules/lodash/toInteger.js"(e,t){var r=ft();t.exports=function(e){var t=r(e),o=t%1;return t==t?o?t-o:t:0}}}),mt=d({"../../../node_modules/lodash/before.js"(e,t){var r=gt();t.exports=function(e,t){var o;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(o=t.apply(this,arguments)),e<=1&&(t=void 0),o}}}}),bt=d({"../../../node_modules/lodash/once.js"(e,t){var r=mt();t.exports=function(e){return r(2,e)}}}),yt=d({"../../../esbuild/polyfill.noop.js"(){}}),vt=d({"../../../_builds/cesdk/wasm32-unknown-emscripten/Release/cesdk.js"(e,t){var r,o=(r="undefined"!=typeof document?document.currentScript?.src:void 0,"undefined"!=typeof __filename&&(r=r||__filename),async function(e={}){var t,o,n,i,s,a,l=e,c=new Promise(((e,r)=>{t=e,o=r})),d="object"==typeof window,u="undefined"!=typeof WorkerGlobalScope,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;l.expectedDataFileDownloads??=0,l.expectedDataFileDownloads++,(()=>{var e="undefined"!=typeof ENVIRONMENT_IS_PTHREAD&&ENVIRONMENT_IS_PTHREAD,t="undefined"!=typeof ENVIRONMENT_IS_WASM_WORKER&&ENVIRONMENT_IS_WASM_WORKER;if(!e&&!t){var r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;!function(e){"object"==typeof window?window.encodeURIComponent(window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/"):"undefined"==typeof process&&"undefined"!=typeof location&&encodeURIComponent(location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/");var t,o,n,i,s="cesdk.data",a=l.locateFile?l.locateFile(s,""):s,c=e.remote_package_size,d=null,u=l.getPreloadedPackage?l.getPreloadedPackage(a,c):null;function h(t){function r(e,t){if(!e)throw t+(new Error).stack}function o(e,t,r){this.start=e,this.end=t,this.audio=r}t.FS_createPath("/","ly.img.cesdk",!0,!0),t.FS_createPath("/ly.img.cesdk","fonts",!0,!0),t.FS_createPath("/ly.img.cesdk","icons",!0,!0),t.FS_createPath("/ly.img.cesdk","icu",!0,!0),t.FS_createPath("/ly.img.cesdk","presets",!0,!0),t.FS_createPath("/ly.img.cesdk","shaders",!0,!0),t.FS_createPath("/ly.img.cesdk/shaders","common",!0,!0),o.prototype={requests:{},open:function(e,r){this.name=r,this.requests[r]=this,t.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var e=this.byteArray.subarray(this.start,this.end);this.finish(e)},finish:function(e){t.FS_createDataFile(this.name,null,e,!0,!0,!0),t.removeRunDependency(`fp ${this.name}`),this.requests[this.name]=null}};for(var n=e.files,i=0;i<n.length;++i)new o(n[i].start,n[i].end,n[i].audio||0).open("GET",n[i].filename);function s(n){r(n,"Loading data file failed."),r(n.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var i=new Uint8Array(n);o.prototype.byteArray=i;for(var s=e.files,a=0;a<s.length;++a)o.prototype.requests[s[a].filename].onload();t.removeRunDependency("datafile_cesdk.data")}t.addRunDependency("datafile_cesdk.data"),t.preloadResults??={},t.preloadResults["cesdk.data"]={fromCache:!1},u?(s(u),u=null):d=s}u||(t=a,o=c,n=e=>{d?(d(e),d=null):u=e},i=function(e){console.error("package error:",e)},r?yt().readFile(t,((e,t)=>{e?i(e):n(t.buffer)})):(l.dataFileDownloads??={},fetch(t).catch((e=>Promise.reject(new Error(`Network Error: ${t}`,{cause:e})))).then((e=>{if(!e.ok)return Promise.reject(new Error(`${e.status}: ${e.url}`));if(!e.body&&e.arrayBuffer)return e.arrayBuffer().then(n);const r=e.body.getReader(),i=()=>r.read().then(u).catch((t=>Promise.reject(new Error(`Unexpected error while handling : ${e.url} ${t}`,{cause:t})))),s=[],a=e.headers,c=Number(a.get("Content-Length")??o);let d=0;const u=({done:e,value:r})=>{if(!e){s.push(r),d+=r.length,l.dataFileDownloads[t]={loaded:d,total:c};let e=0,o=0;for(const t of Object.values(l.dataFileDownloads))e+=t.loaded,o+=t.total;return l.setStatus?.(`Downloading data... (${e}/${o})`),i()}{const e=new Uint8Array(s.map((e=>e.length)).reduce(((e,t)=>e+t),0));let t=0;for(const r of s)e.set(r,t),t+=r.length;n(e.buffer)}};return l.setStatus?.("Downloading data..."),i()})))),l.calledRun?h(l):(l.preRun??=[]).push(h)}({files:[{filename:"/ly.img.cesdk/fonts/imgly_font_inter_semibold.otf",start:0,end:270760},{filename:"/ly.img.cesdk/icons/ErrorAudio.svg",start:270760,end:271410},{filename:"/ly.img.cesdk/icons/ErrorConnection.svg",start:271410,end:272334},{filename:"/ly.img.cesdk/icons/ErrorImage.svg",start:272334,end:273191},{filename:"/ly.img.cesdk/icons/ErrorUnknown.svg",start:273191,end:275199},{filename:"/ly.img.cesdk/icons/ErrorVideo.svg",start:275199,end:275919},{filename:"/ly.img.cesdk/icons/Move.svg",start:275919,end:276859},{filename:"/ly.img.cesdk/icons/RotateIndicator.svg",start:276859,end:277840},{filename:"/ly.img.cesdk/icu/icudt74l.dat",start:277840,end:812944},{filename:"/ly.img.cesdk/presets/.keep",start:812944,end:812944},{filename:"/ly.img.cesdk/shaders/adjustments.sksl",start:812944,end:816833},{filename:"/ly.img.cesdk/shaders/black_and_white_color_mixer.sksl",start:816833,end:823150},{filename:"/ly.img.cesdk/shaders/common/ubq_adjustments.sksl",start:823150,end:827741},{filename:"/ly.img.cesdk/shaders/common/ubq_color_conversions.sksl",start:827741,end:837726},{filename:"/ly.img.cesdk/shaders/common/ubq_constants.sksl",start:837726,end:838216},{filename:"/ly.img.cesdk/shaders/common/ubq_hue_constants.sksl",start:838216,end:841383},{filename:"/ly.img.cesdk/shaders/common/ubq_noise.sksl",start:841383,end:844021},{filename:"/ly.img.cesdk/shaders/cross_cut.sksl",start:844021,end:844968},{filename:"/ly.img.cesdk/shaders/dot_pattern.sksl",start:844968,end:846046},{filename:"/ly.img.cesdk/shaders/duotone_filter.sksl",start:846046,end:847010},{filename:"/ly.img.cesdk/shaders/extrude_blur.sksl",start:847010,end:849127},{filename:"/ly.img.cesdk/shaders/glow.sksl",start:849127,end:850094},{filename:"/ly.img.cesdk/shaders/half_tone.sksl",start:850094,end:850588},{filename:"/ly.img.cesdk/shaders/hsp_selective_adjustments.sksl",start:850588,end:864188},{filename:"/ly.img.cesdk/shaders/linocut.sksl",start:864188,end:864973},{filename:"/ly.img.cesdk/shaders/liquid.sksl",start:864973,end:865455},{filename:"/ly.img.cesdk/shaders/lut_filter.sksl",start:865455,end:868318},{filename:"/ly.img.cesdk/shaders/mask_color.sksl",start:868318,end:868823},{filename:"/ly.img.cesdk/shaders/mirror.sksl",start:868823,end:869277},{filename:"/ly.img.cesdk/shaders/outliner.sksl",start:869277,end:870914},{filename:"/ly.img.cesdk/shaders/pixelize.sksl",start:870914,end:871214},{filename:"/ly.img.cesdk/shaders/placeholder_overlay_lines.sksl",start:871214,end:871902},{filename:"/ly.img.cesdk/shaders/posterize.sksl",start:871902,end:872114},{filename:"/ly.img.cesdk/shaders/radial_pixel.sksl",start:872114,end:872677},{filename:"/ly.img.cesdk/shaders/recolor.sksl",start:872677,end:874878},{filename:"/ly.img.cesdk/shaders/sharpie.sksl",start:874878,end:877183},{filename:"/ly.img.cesdk/shaders/shifter.sksl",start:877183,end:877867},{filename:"/ly.img.cesdk/shaders/tiltshift.sksl",start:877867,end:878449},{filename:"/ly.img.cesdk/shaders/tv_glitch.sksl",start:878449,end:879167},{filename:"/ly.img.cesdk/shaders/vignette.sksl",start:879167,end:879539}],remote_package_size:879539})}})(),"object"==typeof window&&"object"==typeof window.performance?l.performance=performance:"object"==typeof global&&"object"==typeof global.perf_hooks&&"object"==typeof global.perf_hooks.performance?l.performance=global.perf_hooks.performance:l.performance={mark:function(){},measure:function(){}},(i=n||(n={}))[i.PENDING=0]="PENDING",i[i.FINISHED=1]="FINISHED",i[i.ALLOCATED=2]="ALLOCATED",i[i.ERROR=3]="ERROR",(a=s||(s={}))[a.GET=0]="GET",a[a.POST=1]="POST";class FetchProcess{constructor(e,t){this.state=n.PENDING,this.totalBytes=0,this.receivedLength=0,this.handle=e,this.uri=t,this.abortController=new AbortController,this.abortSignal=this.abortController.signal}async readChunks(e){let t=0;const r=[],o=e=>{r.push(e),t+=e.length,this.receivedLength=t};if(null==e);else if("getReader"in e){const t=e.getReader();for(;;){const{done:e,value:r}=await t.read();if(e)break;if(this.abortSignal.aborted)throw await t.cancel(),t.releaseLock(),new Error(this.abortSignal.reason);o(r)}t.releaseLock()}else{const t=()=>e.destroy(new Error(this.abortSignal.reason));this.abortSignal.addEventListener("abort",t,{once:!0});try{await new Promise(((t,r)=>{e.on("data",o),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const n=new Uint8Array(t);let i=0;for(const e of r)n.set(e,i),i+=e.length;return this.finish(n)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===n.PENDING}isError(){return this.state===n.ERROR}isFinished(){return this.state===n.FINISHED}isAllocated(){return this.state===n.ALLOCATED}allocate(){if(this.isAllocated())return this;if(this.isFinished()){const e=this.result.length,t=l._malloc(e);l.HEAPU8.set(this.result,t);const r=Object.assign(Object.assign({},this),{state:n.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:n.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:n.ERROR,error:e});return Object.assign(this,t)}}l.emscripten_ubq_asyncFetchManager=new class AsyncFetchManager{constructor(){this._nextHandle=0,this._nextHeaderHandle=0,this._processes=new Map,this._headers=new Map,this._fetchImpl=null}_fetch(e,t){return this._fetchImpl?this._fetchImpl(e,t):fetch(e,t)}setFetch(e){this._fetchImpl=e}getProcess(e){return this._processes.get(e)}deleteProcess(e){const t=this._processes.get(e);return(null==t?void 0:t.isPending())&&t.abort(),this._processes.delete(e)}clear(){for(const e of this._processes.values())e.isPending()&&e.abort();this._processes.clear(),this._headers.clear()}fetch(e,t,r,o,n,i,s,a,c){const d=l.UTF8ToString(t,r),u=this._nextHandle++,h=new FetchProcess(u,d);return this._processes.set(u,h),d.match(/^file:/)?this._fetchFile(h).catch((e=>{h.fail(e)})):this._fetchRemote(h,e,o,n,i,s,a,c).catch((e=>{h.fail(e)})),h}async _fetchFile(e){if("undefined"!=typeof window)throw new Error("File URLs supported only in Node.JS");const t=yt(),{fileURLToPath:r}=yt(),o=t.createReadStream(r(e.uri));return e.readChunks(o)}async _fetchRemote(e,t,r,o,n,i,a,c){const d=l.UTF8ToString(a,c),u=this.getHeaders(r,o),h=t===s.POST?new Uint8Array(new Uint8Array(l.HEAPU8.buffer,n,i)):void 0,p=await this._fetch(e.uri,{method:s[t],headers:u,body:h,mode:"cors",credentials:d,signal:e.abortSignal});if(p.status>=200&&p.status<=209){let t=0;return p.headers.has("Content-Length")&&(t=+p.headers.get("Content-Length")),e.totalBytes=t,e.readChunks(p.body)}return e.fail(p.statusText)}getHeaders(e,t){const r={};for(let o=0;o<t;o++){const t=l.getValue(e+4*o,"i32"),n=this._headers.get(t);r[n.key]=n.value}return r}createHeader(e,t,r,o){const n=l.UTF8ToString(e,t),i=l.UTF8ToString(r,o),s=this._nextHeaderHandle++;return this._headers.set(s,{key:n,value:i}),s}deleteHeader(e){return this._headers.delete(e)}},l.emscripten_ubq_codec_videoDecoders=new Map,l.emscripten_ubq_codec_audioDecoders=new Map,l.emscripten_ubq_codec_videoEncoders=new Map,l.emscripten_ubq_codec_audioEncoders=new Map,l.emscripten_ubq_codec_videoDecoderNextHandle=1,l.emscripten_ubq_codec_audioDecoderNextHandle=1,l.emscripten_ubq_codec_videoEncoderNextHandle=1,l.emscripten_ubq_codec_audioEncoderNextHandle=1,l.emscripten_ubq_codec_createNativeResult=function(e){const t=l._malloc(8),r=l.HEAPU32.subarray(t/4,t/4+2);if(r[0]=e.handle?e.handle:e.code?e.code:0,e.error){const t=(new TextEncoder).encode(e.error),o=l._malloc(t.length+1),n=l.HEAPU8.subarray(o,o+t.length+1);for(let e=0;e<t.length;e++)n[e]=t[e];n[t.length]=0,r[1]=o}else r[1]=0;return t},l.emscripten_ubq_codec_offscreenCanvas=null,l.emscripten_ubq_codec_offscreenCtx=null,l.emscripten_ubq_codec_toneMapHdrToSdr=function(e){l.emscripten_ubq_codec_offscreenCanvas||(l.emscripten_ubq_codec_offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),l.emscripten_ubq_codec_offscreenCtx=l.emscripten_ubq_codec_offscreenCanvas.getContext("2d"));const t=l.emscripten_ubq_codec_offscreenCanvas;return t.width===e.codedWidth&&t.height===e.codedHeight||(t.width=e.codedWidth,t.height=e.codedHeight),l.emscripten_ubq_codec_offscreenCtx.drawImage(e,0,0),t},l.emscripten_ubq_codec_createVideoDecoder=function(e,t,r){const o=new VideoDecoder({output:n=>{const i=o.textures;let s=!1;if((o.shouldDropFrames||o.decodedFrames<o.requestedFrame||o.decodeQueueSize>=i.length)&&(s=!0),!s){var a=l.ctx;const e=o.decodedFrames%i.length,r=a.getParameter(a.TEXTURE_BINDING_2D);a.bindTexture(a.TEXTURE_2D,i[e]);const s=t?l.emscripten_ubq_codec_toneMapHdrToSdr(n):n;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,s),a.bindTexture(a.TEXTURE_2D,r)}n.close(),o.decodedFrames++,l.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,o.decodedFrames,s,r)},error:e=>{o.unexpectedError=e,console.error(e)}});return o.decodedFrames=0,o.requestedFrame=0,o.shouldDropFrames=!1,o.isHdr=t,o},l.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const o=new AudioDecoder({output:n=>{if(o.flushing)return void n.close();const i=l.HEAPF32.subarray(e/4,e/4+r),s=l.HEAPF32.subarray(t/4,t/4+r),a=1===n.numberOfChannels?0:1;if("f32-planar"===n.format){let e=o.writtenFrames%r;if(e+n.numberOfFrames<=r)n.copyTo(i.subarray(e),{planeIndex:0,frameCount:n.numberOfFrames}),n.copyTo(s.subarray(e),{planeIndex:a,frameCount:n.numberOfFrames});else{const t=r-e;n.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),n.copyTo(s.subarray(e),{planeIndex:a,frameCount:t}),n.copyTo(i,{planeIndex:0,frameOffset:t}),n.copyTo(s,{planeIndex:a,frameOffset:t})}o.writtenFrames+=n.numberOfFrames}else if("s16-planar"===n.format)if(1===n.numberOfChannels){const e=new Int16Array(n.numberOfFrames);n.copyTo(e,{planeIndex:0});for(let t=0;t<n.numberOfFrames;t++){const n=e[t]/32768;let a=o.writtenFrames%r;i[a]=n,s[a]=n,o.writtenFrames++}}else{const e=new Int16Array(n.numberOfFrames),t=new Int16Array(n.numberOfFrames);n.copyTo(e,{planeIndex:0}),n.copyTo(t,{planeIndex:1});for(let a=0;a<n.numberOfFrames;a++){let n=o.writtenFrames%r;i[n]=e[a]/32768,s[n]=t[a]/32768,o.writtenFrames++}}else if("s16"===n.format){const e=new Int16Array(n.numberOfFrames*n.numberOfChannels);if(n.copyTo(e,{planeIndex:0}),1===n.numberOfChannels)for(let t=0;t<n.numberOfFrames;t++){const n=e[t]/32768;let a=o.writtenFrames%r;i[a]=n,s[a]=n,o.writtenFrames++}else for(let t=0;t<n.numberOfFrames;t++){let a=o.writtenFrames%r;i[a]=e[t*n.numberOfChannels+0]/32768,s[a]=e[t*n.numberOfChannels+1]/32768,o.writtenFrames++}}else console.error("Unsupported audio format:",n.format);n.close()},error:e=>{o.unexpectedError=e,console.error(e)}});return o.writtenFrames=0,o},l.emscripten_ubq_settings_forceWebGL1=!1,l.emscripten_ubq_opfs_CHUNK_SIZE=10485760,l.emscripten_ubq_opfs_MAX_CACHE_SIZE_BYTES=209715200,void 0===l.emscripten_ubq_opfs_readTagCounter&&(l.emscripten_ubq_opfs_readTagCounter=0),l.emscripten_ubq_opfs_caches=new Map,l.emscripten_ubq_opfs_createWorker=function(){const e=new Blob(["\n let handle = null; \n\n self.onmessage = async (ev) => {\n if (ev.data.open) {\n if (handle) {\n try {\n console.log('[OPFS Worker] Closing previous access handle');\n handle.close();\n } catch (e) {\n console.warn('[OPFS Worker] Failed to close previous handle', e);\n }\n }\n handle = await ev.data.fileHandle.createSyncAccessHandle({\n mode: 'read-only'\n });\n \n self.postMessage({ready:true});\n return;\n }\n \n if (ev.data.read) {\n const {offset, size, tag} = ev.data.read;\n\n const tmp = new Uint8Array(size);\n const bytes = handle.read(tmp, {at: offset});\n\n self.postMessage({tag, bytes, buf: tmp.buffer}, [tmp.buffer]);\n }\n };\n "],{type:"application/javascript"});return{worker:new Worker(URL.createObjectURL(e),{type:"module"}),readyPromise:null,post:function(e){this.worker.postMessage(e)},get:function(){return this.worker}}},l.emscripten_ubq_opfs_destroyWorker=function(e){if(e)try{e.worker.terminate()}catch(e){console.warn("[OPFS] Failed to terminate worker",e)}},l.emscripten_ubq_opfs_getCache=function(e){let t=l.emscripten_ubq_opfs_caches.get(e);return t||(t={chunkCache:new Map,accessOrder:[],currentSize:0,loadingChunks:new Set,file:null,openPromise:null,fileSize:-1,worker:null,workerOpened:!1,workerOpening:null},l.emscripten_ubq_opfs_caches.set(e,t)),t},l.emscripten_ubq_opfs_ensureFile=async function(e,t){if(t.fileHandle)return t.fileHandle;if(t.openPromise)return t.openPromise;const r=e.replace(/^opfs:\/\//,"");return t.openPromise=(async()=>{const e=await navigator.storage.getDirectory(),o=r.split("/").filter(Boolean);let n=e;for(let e=0;e<o.length-1;e++)n=await n.getDirectoryHandle(o[e]);const i=await n.getFileHandle(o[o.length-1]);t.fileHandle=i;const s=await i.getFile();return t.fileSize=s.size,i})(),t.openPromise},l.emscripten_ubq_opfs_ensureWorker=function(e,t){return t.worker||(t.worker=l.emscripten_ubq_opfs_createWorker()),t.worker},l.emscripten_ubq_opfs_updateAccess=function(e,t){const r=e.accessOrder.indexOf(t);-1!==r&&e.accessOrder.splice(r,1),e.accessOrder.push(t)},l.emscripten_ubq_opfs_cleanCache=function(e){const t=l.emscripten_ubq_opfs_MAX_CACHE_SIZE_BYTES;for(;e.currentSize>t&&e.accessOrder.length>0;){const t=e.accessOrder.shift(),r=e.chunkCache.get(t);r&&(e.currentSize-=r.byteLength,e.chunkCache.delete(t))}},l.emscripten_ubq_opfs_loadChunk=function(e,t,r){if(t.chunkCache.has(r)||t.loadingChunks.has(r))return void l.emscripten_ubq_opfs_updateAccess(t,r);t.loadingChunks.add(r);const o=l.emscripten_ubq_opfs_CHUNK_SIZE,n=r*o,i=n+o;l.emscripten_ubq_opfs_ensureFile(e,t).then((async e=>{const o=(await e.getFile()).slice(n,i),s=await o.arrayBuffer(),a=new Uint8Array(s);t.chunkCache.set(r,a),t.currentSize+=a.byteLength,l.emscripten_ubq_opfs_updateAccess(t,r),l.emscripten_ubq_opfs_cleanCache(t)})).catch((t=>{console.error(`[OPFS] Failed to load chunk ${r} for "${e}":`,t)})).finally((()=>{t.loadingChunks.delete(r)}))},l.emscripten_ubq_opfs_getChunkDataAsync=async function(e,t,r,o,n){if(o<=0)return 0;const i=Q(e),s=4294967296*(r>>>0)+(t>>>0),a=l.emscripten_ubq_opfs_getCache(i),c=l.emscripten_ubq_opfs_ensureWorker(i,a);a.workerOpened||(a.workerOpening||(a.workerOpening=(async()=>{const e=await l.emscripten_ubq_opfs_ensureFile(i,a);c.post({open:!0,fileHandle:e,sab:l.HEAPU8.buffer}),await new Promise((e=>{const t=c.get(),r=o=>{o.data&&o.data.ready&&(t.removeEventListener("message",r),e())};t.addEventListener("message",r)})),a.workerOpened=!0})().finally((()=>{a.workerOpening=null}))),await a.workerOpening);try{return await new Promise(((e,t)=>{void 0===l.emscripten_ubq_opfs_readTagCounter&&(l.emscripten_ubq_opfs_readTagCounter=0);const r=++l.emscripten_ubq_opfs_readTagCounter,i=c.get(),a=s=>{s.data.tag===r&&(i.removeEventListener("message",a),s.data.buf&&l.HEAPU8.set(new Uint8Array(s.data.buf),n),s.data.bytes===o?e(o):t(new Error("short read")))};i.addEventListener("message",a),c.post({read:{offset:s,size:o,ptr:n,tag:r}})}))}catch(e){return console.error("[OPFS] worker read failed:",e),-1}},l.emscripten_ubq_opfs_loadChunkAsync=async function(e,t,r){if(t.chunkCache.has(r))return void l.emscripten_ubq_opfs_updateAccess(t,r);if(t.loadingChunks.has(r))return;t.loadingChunks.add(r);const o=l.emscripten_ubq_opfs_CHUNK_SIZE,n=r*o,i=n+o;try{const o=await l.emscripten_ubq_opfs_ensureFile(e,t),s=(await o.getFile()).slice(n,i),a=await s.arrayBuffer(),c=new Uint8Array(a);t.chunkCache.set(r,c),t.currentSize+=c.byteLength,l.emscripten_ubq_opfs_updateAccess(t,r),l.emscripten_ubq_opfs_cleanCache(t)}catch(t){throw console.error(`[OPFS] Async Failed to load chunk ${r} for "${e}":`,t),t}finally{t.loadingChunks.delete(r)}};var p,f,g={...l},m=[],b="./this.program",y=(e,t)=>{throw t},v="";if(h){var w=yt();yt(),v=__dirname+"/",f=e=>(e=O(e)?new URL(e):e,w.readFileSync(e)),p=async(e,t=!0)=>(e=O(e)?new URL(e):e,w.readFileSync(e,t?void 0:"utf8")),!l.thisProgram&&process.argv.length>1&&(b=process.argv[1].replace(/\\/g,"/")),m=process.argv.slice(2),y=(e,t)=>{throw process.exitCode=e,t}}else(d||u)&&(u?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),r&&(v=r),v=v.startsWith("blob:")?"":v.slice(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1),u&&(f=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=async e=>{var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)});var k=l.print||console.log.bind(console),_=l.printErr||console.error.bind(console);Object.assign(l,g),g=null,l.arguments&&(m=l.arguments),l.thisProgram&&(b=l.thisProgram);var C,E,S,x,T,P,A,F,M,I,R,L,D=l.wasmBinary,B=!1,O=e=>e.startsWith("file://");function j(){var e=C.buffer;l.HEAP8=S=new Int8Array(e),l.HEAP16=T=new Int16Array(e),l.HEAPU8=x=new Uint8Array(e),l.HEAPU16=P=new Uint16Array(e),l.HEAP32=A=new Int32Array(e),l.HEAPU32=F=new Uint32Array(e),l.HEAPF32=M=new Float32Array(e),l.HEAPF64=L=new Float64Array(e),l.HEAP64=I=new BigInt64Array(e),l.HEAPU64=R=new BigUint64Array(e)}if(l.wasmMemory)C=l.wasmMemory;else{var $=l.INITIAL_MEMORY||16777216;C=new WebAssembly.Memory({initial:$/65536,maximum:32768})}j();var q,U=0,W=null;function H(e){U++,l.monitorRunDependencies?.(U)}function N(e){if(U--,l.monitorRunDependencies?.(U),0==U&&W){var t=W;W=null,t()}}function V(e){l.onAbort?.(e),_(e="Aborted("+e+")"),B=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw o(t),t}function z(){return e="cesdk.wasm",l.locateFile?l.locateFile(e,v):v+e;var e}async function G(e){if(!D)try{var t=await p(e);return new Uint8Array(t)}catch{}return function(e){if(e==q&&D)return new Uint8Array(D);if(f)return f(e);throw"both async and sync fetching of the wasm failed"}(e)}async function X(e,t,r){if(!e&&"function"==typeof WebAssembly.instantiateStreaming&&!h)try{var o=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(o,r)}catch(e){_(`wasm streaming compile failed: ${e}`),_("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await G(e);return await WebAssembly.instantiate(r,t)}catch(e){_(`failed to asynchronously prepare wasm: ${e}`),V(e)}}(t,r)}class ExitStatus{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Y="undefined"!=typeof TextDecoder?new TextDecoder:void 0,K=(e,t=0,r=NaN)=>{for(var o=t+r,n=t;e[n]&&!(n>=o);)++n;if(n-t>16&&e.buffer&&Y)return Y.decode(e.subarray(t,n));for(var i="";t<n;){var s=e[t++];if(128&s){var a=63&e[t++];if(192!=(224&s)){var l=63&e[t++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&e[t++])<65536)i+=String.fromCharCode(s);else{var c=s-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&s)<<6|a)}else i+=String.fromCharCode(s)}return i},Q=(e,t)=>e?K(x,e,t):"",Z=e=>{for(;e.length>0;)e.shift()(l)},J=[],ee=e=>J.unshift(e),te=[],re=e=>te.unshift(e),oe=l.noExitRuntime||!0,ne=e=>Zl(e),ie=()=>ec(),se=e=>{for(var t=0,r=0;r<e.length;++r){var o=e.charCodeAt(r);o<=127?t++:o<=2047?t+=2:o>=55296&&o<=57343?(t+=4,++r):t+=3}return t},ae=(e,t,r,o)=>{if(!(o>0))return 0;for(var n=r,i=r+o-1,s=0;s<e.length;++s){var a=e.charCodeAt(s);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),a<=127){if(r>=i)break;t[r++]=a}else if(a<=2047){if(r+1>=i)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=i)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n},le=(e,t,r)=>ae(e,x,t,r),ce=e=>{var t=se(e)+1,r=Hl(t);return r&&le(e,r,t),r},de=[],ue=0;class ExceptionInfo{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){F[this.ptr+4>>2]=e}get_type(){return F[this.ptr+4>>2]}set_destructor(e){F[this.ptr+8>>2]=e}get_destructor(){return F[this.ptr+8>>2]}set_caught(e){e=e?1:0,S[this.ptr+12]=e}get_caught(){return 0!=S[this.ptr+12]}set_rethrown(e){e=e?1:0,S[this.ptr+13]=e}get_rethrown(){return 0!=S[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){F[this.ptr+16>>2]=e}get_adjusted_ptr(){return F[this.ptr+16>>2]}}var he=e=>Ql(e),pe=e=>{var t=ue;if(!t)return he(0),0;var r=new ExceptionInfo(t);r.set_adjusted_ptr(t);var o=r.get_type();if(!o)return he(0),t;for(var n of e){if(0===n||n===o)break;var i=r.ptr+16;if(oc(n,o,i))return he(n),t}return he(o),t},fe={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,o=e.length-1;o>=0;o--){var n=e[o];"."===n?e.splice(o,1):".."===n?(e.splice(o,1),r++):r&&(e.splice(o,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=fe.isAbs(e),r="/"===e.slice(-1);return(e=fe.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=fe.splitPath(e),r=t[0],o=t[1];return r||o?(o&&(o=o.slice(0,-1)),r+o):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>fe.normalize(e.join("/")),join2:(e,t)=>fe.normalize(e+"/"+t)},ge=e=>{(ge=e=>crypto.getRandomValues(e))(e)},me={resolve:(...e)=>{for(var t="",r=!1,o=e.length-1;o>=-1&&!r;o--){var n=o>=0?e[o]:Te.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,r=fe.isAbs(n)}return(r?"/":"")+(t=fe.normalizeArray(t.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=me.resolve(e).slice(1),t=me.resolve(t).slice(1);for(var o=r(e.split("/")),n=r(t.split("/")),i=Math.min(o.length,n.length),s=i,a=0;a<i;a++)if(o[a]!==n[a]){s=a;break}var l=[];for(a=s;a<o.length;a++)l.push("..");return(l=l.concat(n.slice(s))).join("/")}},be=[],ye=(e,t,r)=>{var o=r>0?r:se(e)+1,n=new Array(o),i=ae(e,n,0,n.length);return t&&(n.length=i),n},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Te.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Te.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,o,n){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var i=0,s=0;s<o;s++){var a;try{a=e.tty.ops.get_char(e.tty)}catch(e){throw new Te.ErrnoError(29)}if(void 0===a&&0===i)throw new Te.ErrnoError(6);if(null==a)break;i++,t[r+s]=a}return i&&(e.node.atime=Date.now()),i},write(e,t,r,o,n){if(!e.tty||!e.tty.ops.put_char)throw new Te.ErrnoError(60);try{for(var i=0;i<o;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Te.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}},default_tty_ops:{get_char:e=>(()=>{if(!be.length){var e=null;if(h){var t=Buffer.alloc(256),r=0,o=process.stdin.fd;try{r=w.readSync(o,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}r>0&&(e=t.slice(0,r).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;be=ye(e,!0)}return be.shift()})(),put_char(e,t){null===t||10===t?(k(K(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(k(K(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[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]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(_(K(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(_(K(e.output)),e.output=[])}}},we=(e,t)=>Math.ceil(e/t)*t,ke=e=>{e=we(e,65536);var t=Xl(65536,e);return t&&((e,t)=>{x.fill(0,e,e+t)})(t,e),t},_e={ops_table:null,mount:e=>_e.createNode(null,"/",16895,0),createNode(e,t,r,o){if(Te.isBlkdev(r)||Te.isFIFO(r))throw new Te.ErrnoError(63);_e.ops_table||={dir:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,lookup:_e.node_ops.lookup,mknod:_e.node_ops.mknod,rename:_e.node_ops.rename,unlink:_e.node_ops.unlink,rmdir:_e.node_ops.rmdir,readdir:_e.node_ops.readdir,symlink:_e.node_ops.symlink},stream:{llseek:_e.stream_ops.llseek}},file:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:{llseek:_e.stream_ops.llseek,read:_e.stream_ops.read,write:_e.stream_ops.write,mmap:_e.stream_ops.mmap,msync:_e.stream_ops.msync}},link:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,readlink:_e.node_ops.readlink},stream:{}},chrdev:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:Te.chrdev_stream_ops}};var n=Te.createNode(e,t,r,o);return Te.isDir(n.mode)?(n.node_ops=_e.ops_table.dir.node,n.stream_ops=_e.ops_table.dir.stream,n.contents={}):Te.isFile(n.mode)?(n.node_ops=_e.ops_table.file.node,n.stream_ops=_e.ops_table.file.stream,n.usedBytes=0,n.contents=null):Te.isLink(n.mode)?(n.node_ops=_e.ops_table.link.node,n.stream_ops=_e.ops_table.link.stream):Te.isChrdev(n.mode)&&(n.node_ops=_e.ops_table.chrdev.node,n.stream_ops=_e.ops_table.chrdev.stream),n.atime=n.mtime=n.ctime=Date.now(),e&&(e.contents[t]=n,e.atime=e.mtime=e.ctime=n.atime),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var o=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Te.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Te.isDir(e.mode)?t.size=4096:Te.isFile(e.mode)?t.size=e.usedBytes:Te.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(const r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&_e.resizeFileStorage(e,t.size)},lookup(e,t){throw _e.doesNotExistError},mknod:(e,t,r,o)=>_e.createNode(e,t,r,o),rename(e,t,r){var o;try{o=Te.lookupNode(t,r)}catch(e){}if(o){if(Te.isDir(e.mode))for(var n in o.contents)throw new Te.ErrnoError(55);Te.hashRemoveNode(o)}delete e.parent.contents[e.name],t.contents[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r=Te.lookupNode(e,t);for(var o in r.contents)throw new Te.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,t,r){var o=_e.createNode(e,t,41471,0);return o.link=r,o},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,o,n){var i=e.node.contents;if(n>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-n,o);if(s>8&&i.subarray)t.set(i.subarray(n,n+s),r);else for(var a=0;a<s;a++)t[r+a]=i[n+a];return s},write(e,t,r,o,n,i){if(t.buffer===S.buffer&&(i=!1),!o)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),t.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=t.subarray(r,r+o),s.usedBytes=o,o;if(0===s.usedBytes&&0===n)return s.contents=t.slice(r,r+o),s.usedBytes=o,o;if(n+o<=s.usedBytes)return s.contents.set(t.subarray(r,r+o),n),o}if(_e.expandFileStorage(s,n+o),s.contents.subarray&&t.subarray)s.contents.set(t.subarray(r,r+o),n);else for(var a=0;a<o;a++)s.contents[n+a]=t[r+a];return s.usedBytes=Math.max(s.usedBytes,n+o),o},llseek(e,t,r){var o=t;if(1===r?o+=e.position:2===r&&Te.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new Te.ErrnoError(28);return o},mmap(e,t,r,o,n){if(!Te.isFile(e.node.mode))throw new Te.ErrnoError(43);var i,s,a=e.node.contents;if(2&n||!a||a.buffer!==S.buffer){if(s=!0,!(i=ke(t)))throw new Te.ErrnoError(48);a&&((r>0||r+t<a.length)&&(a=a.subarray?a.subarray(r,r+t):Array.prototype.slice.call(a,r,r+t)),S.set(a,i))}else s=!1,i=a.byteOffset;return{ptr:i,allocated:s}},msync:(e,t,r,o,n)=>(_e.stream_ops.write(e,t,0,o,r,!1),0)}},Ce=(e,t,r,o,n,i)=>{Te.createDataFile(e,t,r,o,n,i)},Ee=l.preloadPlugins||[],Se=(e,t,r,o,n,i,s,a,l,c)=>{var d=t?me.resolve(fe.join2(e,t)):e;function u(r){function u(r){c?.(),a||Ce(e,t,r,o,n,l),i?.(),N()}((e,t,r,o)=>{void 0!==br&&br.init();var n=!1;return Ee.forEach((i=>{n||i.canHandle(t)&&(i.handle(e,t,r,o),n=!0)})),n})(r,d,u,(()=>{s?.(),N()}))||u(r)}H(),"string"==typeof r?(async e=>{var t=await p(e);return new Uint8Array(t)})(r).then(u,s):u(r)},xe=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return 0!=(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,t,r,o){e||(e=this),this.parent=e,this.mount=e.mount,this.id=Te.nextInode++,this.name=t,this.mode=r,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Te.isDir(this.mode)}get isDevice(){return Te.isChrdev(this.mode)}},lookupPath(e,t={}){if(!e)throw new Te.ErrnoError(44);t.follow_mount??=!0,fe.isAbs(e)||(e=Te.cwd()+"/"+e);e:for(var r=0;r<40;r++){for(var o=e.split("/").filter((e=>!!e)),n=Te.root,i="/",s=0;s<o.length;s++){var a=s===o.length-1;if(a&&t.parent)break;if("."!==o[s])if(".."!==o[s]){i=fe.join2(i,o[s]);try{n=Te.lookupNode(n,o[s])}catch(e){if(44===e?.errno&&a&&t.noent_okay)return{path:i};throw e}if(!Te.isMountpoint(n)||a&&!t.follow_mount||(n=n.mounted.root),Te.isLink(n.mode)&&(!a||t.follow)){if(!n.node_ops.readlink)throw new Te.ErrnoError(52);var l=n.node_ops.readlink(n);fe.isAbs(l)||(l=fe.dirname(i)+"/"+l),e=l+"/"+o.slice(s+1).join("/");continue e}}else i=fe.dirname(i),n=n.parent}return{path:i,node:n}}throw new Te.ErrnoError(32)},getPath(e){for(var t;;){if(Te.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,o=0;o<t.length;o++)r=(r<<5)-r+t.charCodeAt(o)|0;return(e+r>>>0)%Te.nameTable.length},hashAddNode(e){var t=Te.hashName(e.parent.id,e.name);e.name_next=Te.nameTable[t],Te.nameTable[t]=e},hashRemoveNode(e){var t=Te.hashName(e.parent.id,e.name);if(Te.nameTable[t]===e)Te.nameTable[t]=e.name_next;else for(var r=Te.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Te.mayLookup(e);if(r)throw new Te.ErrnoError(r);for(var o=Te.hashName(e.id,t),n=Te.nameTable[o];n;n=n.name_next){var i=n.name;if(n.parent.id===e.id&&i===t)return n}return Te.lookup(e,t)},createNode(e,t,r,o){var n=new Te.FSNode(e,t,r,o);return Te.hashAddNode(n),n},destroyNode(e){Te.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Te.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!Te.isDir(e.mode))return 54;var t=Te.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){if(!Te.isDir(e.mode))return 54;try{return Te.lookupNode(e,t),20}catch(e){}return Te.nodePermissions(e,"wx")},mayDelete(e,t,r){var o;try{o=Te.lookupNode(e,t)}catch(e){return e.errno}var n=Te.nodePermissions(e,"wx");if(n)return n;if(r){if(!Te.isDir(o.mode))return 54;if(Te.isRoot(o)||Te.getPath(o)===Te.cwd())return 10}else if(Te.isDir(o.mode))return 31;return 0},mayOpen:(e,t)=>e?Te.isLink(e.mode)?32:Te.isDir(e.mode)&&("r"!==Te.flagsToPermissionString(t)||576&t)?31:Te.nodePermissions(e,Te.flagsToPermissionString(t)):44,checkOpExists(e,t){if(!e)throw new Te.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Te.MAX_OPEN_FDS;e++)if(!Te.streams[e])return e;throw new Te.ErrnoError(33)},getStreamChecked(e){var t=Te.getStream(e);if(!t)throw new Te.ErrnoError(8);return t},getStream:e=>Te.streams[e],createStream:(e,t=-1)=>(e=Object.assign(new Te.FSStream,e),-1==t&&(t=Te.nextfd()),e.fd=t,Te.streams[t]=e,e),closeStream(e){Te.streams[e]=null},dupStream(e,t=-1){var r=Te.createStream(e,t);return r.stream_ops?.dup?.(r),r},doSetAttr(e,t,r){var o=e?.stream_ops.setattr,n=o?e:t;o??=t.node_ops.setattr,Te.checkOpExists(o,63),o(n,r)},chrdev_stream_ops:{open(e){var t=Te.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Te.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Te.devices[e]={stream_ops:t}},getDevice:e=>Te.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var o=r.pop();t.push(o),r.push(...o.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Te.syncFSRequests++,Te.syncFSRequests>1&&_(`warning: ${Te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Te.getMounts(Te.root.mount),o=0;function n(e){return Te.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,n(e));++o>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var o,n="/"===r,i=!r;if(n&&Te.root)throw new Te.ErrnoError(10);if(!n&&!i){var s=Te.lookupPath(r,{follow_mount:!1});if(r=s.path,o=s.node,Te.isMountpoint(o))throw new Te.ErrnoError(10);if(!Te.isDir(o.mode))throw new Te.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},l=e.mount(a);return l.mount=a,a.root=l,n?Te.root=l:o&&(o.mounted=a,o.mount&&o.mount.mounts.push(a)),l},unmount(e){var t=Te.lookupPath(e,{follow_mount:!1});if(!Te.isMountpoint(t.node))throw new Te.ErrnoError(28);var r=t.node,o=r.mounted,n=Te.getMounts(o);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(o);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var o=Te.lookupPath(e,{parent:!0}).node,n=fe.basename(e);if(!n)throw new Te.ErrnoError(28);if("."===n||".."===n)throw new Te.ErrnoError(20);var i=Te.mayCreate(o,n);if(i)throw new Te.ErrnoError(i);if(!o.node_ops.mknod)throw new Te.ErrnoError(63);return o.node_ops.mknod(o,n,t,r)},statfs:e=>Te.statfsNode(Te.lookupPath(e,{follow:!0}).node),statfsStream:e=>Te.statfsNode(e.node),statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Te.nextInode,ffree:Te.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create:(e,t=438)=>(t&=4095,t|=32768,Te.mknod(e,t,0)),mkdir:(e,t=511)=>(t&=1023,t|=16384,Te.mknod(e,t,0)),mkdirTree(e,t){var r=e.split("/"),o="";for(var n of r)if(n){o+="/"+n;try{Te.mkdir(o,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,Te.mknod(e,t,r)),symlink(e,t){if(!me.resolve(e))throw new Te.ErrnoError(44);var r=Te.lookupPath(t,{parent:!0}).node;if(!r)throw new Te.ErrnoError(44);var o=fe.basename(t),n=Te.mayCreate(r,o);if(n)throw new Te.ErrnoError(n);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,o,e)},rename(e,t){var r,o,n=fe.dirname(e),i=fe.dirname(t),s=fe.basename(e),a=fe.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,o=Te.lookupPath(t,{parent:!0}).node,!r||!o)throw new Te.ErrnoError(44);if(r.mount!==o.mount)throw new Te.ErrnoError(75);var l,c=Te.lookupNode(r,s),d=me.relative(e,i);if("."!==d.charAt(0))throw new Te.ErrnoError(28);if("."!==(d=me.relative(t,n)).charAt(0))throw new Te.ErrnoError(55);try{l=Te.lookupNode(o,a)}catch(e){}if(c!==l){var u=Te.isDir(c.mode),h=Te.mayDelete(r,s,u);if(h)throw new Te.ErrnoError(h);if(h=l?Te.mayDelete(o,a,u):Te.mayCreate(o,a))throw new Te.ErrnoError(h);if(!r.node_ops.rename)throw new Te.ErrnoError(63);if(Te.isMountpoint(c)||l&&Te.isMountpoint(l))throw new Te.ErrnoError(10);if(o!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(c);try{r.node_ops.rename(c,o,a),c.parent=o}catch(e){throw e}finally{Te.hashAddNode(c)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=fe.basename(e),o=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!0);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(o))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(o)},readdir(e){var t=Te.lookupPath(e,{follow:!0}).node;return Te.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Te.lookupPath(e,{parent:!0}).node;if(!t)throw new Te.ErrnoError(44);var r=fe.basename(e),o=Te.lookupNode(t,r),n=Te.mayDelete(t,r,!1);if(n)throw new Te.ErrnoError(n);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(o))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(o)},readlink(e){var t=Te.lookupPath(e).node;if(!t)throw new Te.ErrnoError(44);if(!t.node_ops.readlink)throw new Te.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var r=Te.lookupPath(e,{follow:!t}).node;return Te.checkOpExists(r.node_ops.getattr,63)(r)},fstat(e){var t=Te.getStreamChecked(e),r=t.node,o=t.stream_ops.getattr,n=o?t:r;return o??=r.node_ops.getattr,Te.checkOpExists(o,63),o(n)},lstat:e=>Te.stat(e,!0),doChmod(e,t,r,o){Te.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:o})},chmod(e,t,r){var o;o="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e,Te.doChmod(null,o,t,r)},lchmod(e,t){Te.chmod(e,t,!0)},fchmod(e,t){var r=Te.getStreamChecked(e);Te.doChmod(r,r.node,t,!1)},doChown(e,t,r){Te.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:r})},chown(e,t,r,o){var n;n="string"==typeof e?Te.lookupPath(e,{follow:!o}).node:e,Te.doChown(null,n,o)},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var o=Te.getStreamChecked(e);Te.doChown(o,o.node,!1)},doTruncate(e,t,r){if(Te.isDir(t.mode))throw new Te.ErrnoError(31);if(!Te.isFile(t.mode))throw new Te.ErrnoError(28);var o=Te.nodePermissions(t,"w");if(o)throw new Te.ErrnoError(o);Te.doSetAttr(e,t,{size:r,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Te.ErrnoError(28);var r;r="string"==typeof e?Te.lookupPath(e,{follow:!0}).node:e,Te.doTruncate(null,r,t)},ftruncate(e,t){var r=Te.getStreamChecked(e);if(t<0||0==(2097155&r.flags))throw new Te.ErrnoError(28);Te.doTruncate(r,r.node,t)},utime(e,t,r){var o=Te.lookupPath(e,{follow:!0}).node;Te.checkOpExists(o.node_ops.setattr,63)(o,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Te.ErrnoError(44);var o,n;if(r=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&r|32768:0,"object"==typeof e)o=e;else{n=e.endsWith("/");var i=Te.lookupPath(e,{follow:!(131072&t),noent_okay:!0});o=i.node,e=i.path}var s=!1;if(64&t)if(o){if(128&t)throw new Te.ErrnoError(20)}else{if(n)throw new Te.ErrnoError(31);o=Te.mknod(e,511|r,0),s=!0}if(!o)throw new Te.ErrnoError(44);if(Te.isChrdev(o.mode)&&(t&=-513),65536&t&&!Te.isDir(o.mode))throw new Te.ErrnoError(54);if(!s){var a=Te.mayOpen(o,t);if(a)throw new Te.ErrnoError(a)}512&t&&!s&&Te.truncate(o,0),t&=-131713;var c=Te.createStream({node:o,path:Te.getPath(o),flags:t,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&Te.chmod(o,511&r),!l.logReadFiles||1&t||e in Te.readFiles||(Te.readFiles[e]=1),c},close(e){if(Te.isClosed(e))throw new Te.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Te.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Te.isClosed(e))throw new Te.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Te.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Te.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,o,n){if(o<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(1==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.read)throw new Te.ErrnoError(28);var i=void 0!==n;if(i){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var s=e.stream_ops.read(e,t,r,o,n);return i||(e.position+=s),s},write(e,t,r,o,n,i){if(o<0||n<0)throw new Te.ErrnoError(28);if(Te.isClosed(e))throw new Te.ErrnoError(8);if(0==(2097155&e.flags))throw new Te.ErrnoError(8);if(Te.isDir(e.node.mode))throw new Te.ErrnoError(31);if(!e.stream_ops.write)throw new Te.ErrnoError(28);e.seekable&&1024&e.flags&&Te.llseek(e,0,2);var s=void 0!==n;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,o,n,i);return s||(e.position+=a),a},mmap(e,t,r,o,n){if(0!=(2&o)&&0==(2&n)&&2!=(2097155&e.flags))throw new Te.ErrnoError(2);if(1==(2097155&e.flags))throw new Te.ErrnoError(2);if(!e.stream_ops.mmap)throw new Te.ErrnoError(43);if(!t)throw new Te.ErrnoError(28);return e.stream_ops.mmap(e,t,r,o,n)},msync:(e,t,r,o,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,o,n):0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Te.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,o=Te.open(e,t.flags),n=Te.stat(e).size,i=new Uint8Array(n);return Te.read(o,i,0,n,0),"utf8"===t.encoding?r=K(i):"binary"===t.encoding&&(r=i),Te.close(o),r},writeFile(e,t,r={}){r.flags=r.flags||577;var o=Te.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(se(t)+1),i=ae(t,n,0,n.length);Te.write(o,n,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(o,t,0,t.byteLength,void 0,r.canOwn)}Te.close(o)},cwd:()=>Te.currentPath,chdir(e){var t=Te.lookupPath(e,{follow:!0});if(null===t.node)throw new Te.ErrnoError(44);if(!Te.isDir(t.node.mode))throw new Te.ErrnoError(54);var r=Te.nodePermissions(t.node,"x");if(r)throw new Te.ErrnoError(r);Te.currentPath=t.path},createDefaultDirectories(){Te.mkdir("/tmp"),Te.mkdir("/home"),Te.mkdir("/home/web_user")},createDefaultDevices(){Te.mkdir("/dev"),Te.registerDevice(Te.makedev(1,3),{read:()=>0,write:(e,t,r,o,n)=>o,llseek:()=>0}),Te.mkdev("/dev/null",Te.makedev(1,3)),ve.register(Te.makedev(5,0),ve.default_tty_ops),ve.register(Te.makedev(6,0),ve.default_tty1_ops),Te.mkdev("/dev/tty",Te.makedev(5,0)),Te.mkdev("/dev/tty1",Te.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(ge(e),t=e.byteLength),e[--t]);Te.createDevice("/dev","random",r),Te.createDevice("/dev","urandom",r),Te.mkdir("/dev/shm"),Te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Te.mkdir("/proc");var e=Te.mkdir("/proc/self");Te.mkdir("/proc/self/fd"),Te.mount({mount(){var t=Te.createNode(e,"fd",16895,73);return t.stream_ops={llseek:_e.stream_ops.llseek},t.node_ops={lookup(e,t){var r=+t,o=Te.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path},id:r+1};return n.parent=n,n},readdir:()=>Array.from(Te.streams.entries()).filter((([e,t])=>t)).map((([e,t])=>e.toString()))},t}},{},"/proc/self/fd")},createStandardStreams(e,t,r){e?Te.createDevice("/dev","stdin",e):Te.symlink("/dev/tty","/dev/stdin"),t?Te.createDevice("/dev","stdout",null,t):Te.symlink("/dev/tty","/dev/stdout"),r?Te.createDevice("/dev","stderr",null,r):Te.symlink("/dev/tty1","/dev/stderr"),Te.open("/dev/stdin",0),Te.open("/dev/stdout",1),Te.open("/dev/stderr",1)},staticInit(){Te.nameTable=new Array(4096),Te.mount(_e,{},"/"),Te.createDefaultDirectories(),Te.createDefaultDevices(),Te.createSpecialDirectories(),Te.filesystems={MEMFS:_e}},init(e,t,r){Te.initialized=!0,e??=l.stdin,t??=l.stdout,r??=l.stderr,Te.createStandardStreams(e,t,r)},quit(){for(var e of(Te.initialized=!1,Te.streams))e&&Te.close(e)},findObject(e,t){var r=Te.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(o=Te.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var o=Te.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=o.path,r.parentObject=o.node,r.name=fe.basename(e),o=Te.lookupPath(e,{follow:!t}),r.exists=!0,r.path=o.path,r.object=o.node,r.name=o.node.name,r.isRoot="/"===o.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,o){e="string"==typeof e?e:Te.getPath(e);for(var n=t.split("/").reverse();n.length;){var i=n.pop();if(i){var s=fe.join2(e,i);try{Te.mkdir(s)}catch(e){if(20!=e.errno)throw e}e=s}}return s},createFile(e,t,r,o,n){var i=fe.join2("string"==typeof e?e:Te.getPath(e),t),s=xe(o,n);return Te.create(i,s)},createDataFile(e,t,r,o,n,i){var s=t;e&&(e="string"==typeof e?e:Te.getPath(e),s=t?fe.join2(e,t):e);var a=xe(o,n),l=Te.create(s,a);if(r){if("string"==typeof r){for(var c=new Array(r.length),d=0,u=r.length;d<u;++d)c[d]=r.charCodeAt(d);r=c}Te.chmod(l,146|a);var h=Te.open(l,577);Te.write(h,r,0,r.length,0,i),Te.close(h),Te.chmod(l,a)}},createDevice(e,t,r,o){var n=fe.join2("string"==typeof e?e:Te.getPath(e),t),i=xe(!!r,!!o);Te.createDevice.major??=64;var s=Te.makedev(Te.createDevice.major++,0);return Te.registerDevice(s,{open(e){e.seekable=!1},close(e){o?.buffer?.length&&o(10)},read(e,t,o,n,i){for(var s=0,a=0;a<n;a++){var l;try{l=r()}catch(e){throw new Te.ErrnoError(29)}if(void 0===l&&0===s)throw new Te.ErrnoError(6);if(null==l)break;s++,t[o+a]=l}return s&&(e.node.atime=Date.now()),s},write(e,t,r,n,i){for(var s=0;s<n;s++)try{o(t[r+s])}catch(e){throw new Te.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),s}}),Te.mkdev(n,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=f(e.url),e.usedBytes=e.contents.length}catch(e){throw new Te.ErrnoError(29)}},createLazyFile(e,t,r,o,n){class LazyUint8Array{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;n||(s=o);var a=this;a.setDataGetter((e=>{var t=e*s,n=(e+1)*s-1;if(n=Math.min(n,o-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>o-1)throw new Error("only "+o+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),o!==s&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ye(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!i&&o||(s=o=1,o=this.getter(0).length,s=o,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=o,this._chunkSize=s,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!u)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new LazyUint8Array}}else i={isDevice:!1,url:r};var s=Te.createFile(e,t,i,o,n);i.contents?s.contents=i.contents:i.url&&(s.contents=null,s.url=i.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var a={};function l(e,t,r,o,n){var i=e.node.contents;if(n>=i.length)return 0;var s=Math.min(i.length-n,o);if(i.slice)for(var a=0;a<s;a++)t[r+a]=i[n+a];else for(a=0;a<s;a++)t[r+a]=i.get(n+a);return s}return Object.keys(s.stream_ops).forEach((e=>{var t=s.stream_ops[e];a[e]=(...e)=>(Te.forceLoadFile(s),t(...e))})),a.read=(e,t,r,o,n)=>(Te.forceLoadFile(s),l(e,t,r,o,n)),a.mmap=(e,t,r,o,n)=>{Te.forceLoadFile(s);var i=ke(t);if(!i)throw new Te.ErrnoError(48);return l(e,S,i,t,r),{ptr:i,allocated:!0}},s.stream_ops=a,s}},Pe={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(fe.isAbs(t))return t;var o;if(o=-100===e?Te.cwd():Pe.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return o}return o+"/"+t},writeStat(e,t){A[e>>2]=t.dev,A[e+4>>2]=t.mode,F[e+8>>2]=t.nlink,A[e+12>>2]=t.uid,A[e+16>>2]=t.gid,A[e+20>>2]=t.rdev,I[e+24>>3]=BigInt(t.size),A[e+32>>2]=4096,A[e+36>>2]=t.blocks;var r=t.atime.getTime(),o=t.mtime.getTime(),n=t.ctime.getTime();return I[e+40>>3]=BigInt(Math.floor(r/1e3)),F[e+48>>2]=r%1e3*1e3*1e3,I[e+56>>3]=BigInt(Math.floor(o/1e3)),F[e+64>>2]=o%1e3*1e3*1e3,I[e+72>>3]=BigInt(Math.floor(n/1e3)),F[e+80>>2]=n%1e3*1e3*1e3,I[e+88>>3]=BigInt(t.ino),0},writeStatFs(e,t){A[e+4>>2]=t.bsize,A[e+40>>2]=t.bsize,A[e+8>>2]=t.blocks,A[e+12>>2]=t.bfree,A[e+16>>2]=t.bavail,A[e+20>>2]=t.files,A[e+24>>2]=t.ffree,A[e+28>>2]=t.fsid,A[e+44>>2]=t.flags,A[e+36>>2]=t.namelen},doMsync(e,t,r,o,n){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&o)return 0;var i=x.slice(e,e+r);Te.msync(t,i,n,r,o)},getStreamFromFD:e=>Te.getStreamChecked(e),varargs:void 0,getStr:e=>Q(e)},Ae=()=>{var e=A[+Pe.varargs>>2];return Pe.varargs+=4,e},Fe=Ae,Me={},Ie=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Re(e){return this.fromWireType(F[e>>2])}var Le,De={},Be={},Oe={},je=l.InternalError=class InternalError extends Error{constructor(e){super(e),this.name="InternalError"}},$e=e=>{throw new je(e)},qe=(e,t,r)=>{function o(t){var o=r(t);o.length!==e.length&&$e("Mismatched type converter count");for(var n=0;n<e.length;++n)ze(e[n],o[n])}e.forEach((e=>Oe[e]=t));var n=new Array(t.length),i=[],s=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?n[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{n[t]=Be[e],++s===i.length&&o(n)})))})),0===i.length&&o(n)},Ue={},We=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},He=e=>{for(var t="",r=e;x[r];)t+=Le[x[r++]];return t},Ne=l.BindingError=class BindingError extends Error{constructor(e){super(e),this.name="BindingError"}},Ve=e=>{throw new Ne(e)};function ze(e,t,r={}){return function(e,t,r={}){var o=t.name;if(e||Ve(`type "${o}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Ve(`Cannot register type '${o}' twice`)}if(Be[e]=t,delete Oe[e],De.hasOwnProperty(e)){var n=De[e];delete De[e],n.forEach((e=>e()))}}(e,t,r)}var Ge=(e,t,r)=>{switch(t){case 1:return r?e=>S[e]:e=>x[e];case 2:return r?e=>T[e>>1]:e=>P[e>>1];case 4:return r?e=>A[e>>2]:e=>F[e>>2];case 8:return r?e=>I[e>>3]:e=>R[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Xe=8,Ye=e=>{Ve(e.$$.ptrType.registeredClass.name+" instance already deleted")},Ke=!1,Qe=e=>{},Ze=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Je=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var o=Je(e,t,r.baseClass);return null===o?null:r.downcast(o)},et={},tt={},rt=(e,t)=>(t=((e,t)=>{for(void 0===t&&Ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),tt[t]),ot=(e,t)=>(t.ptrType&&t.ptr||$e("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&$e("Both smartPtrType and smartPtr must be specified"),t.count={value:1},it(Object.create(e,{$$:{value:t,writable:!0}})));function nt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=rt(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var o=r.clone();return this.destructor(e),o}function n(){return this.isSmartPointer?ot(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):ot(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,s=this.registeredClass.getActualType(t),a=et[s];if(!a)return n.call(this);i=this.isConst?a.constPointerType:a.pointerType;var l=Je(t,this.registeredClass,i.registeredClass);return null===l?n.call(this):this.isSmartPointer?ot(i.registeredClass.instancePrototype,{ptrType:i,ptr:l,smartPtrType:this,smartPtr:e}):ot(i.registeredClass.instancePrototype,{ptrType:i,ptr:l})}var it=e=>"undefined"==typeof FinalizationRegistry?(it=e=>e,e):(Ke=new FinalizationRegistry((e=>{Ze(e.$$)})),Qe=e=>Ke.unregister(e),(it=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Ke.register(e,r,e)}return e})(e)),st=[];function at(){}var lt=(e,t)=>Object.defineProperty(t,"name",{value:e}),ct=(e,t,r)=>{if(void 0===e[t].overloadTable){var o=e[t];e[t]=function(...o){return e[t].overloadTable.hasOwnProperty(o.length)||Ve(`Function '${r}' called with an invalid number of arguments (${o.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[o.length].apply(this,o)},e[t].overloadTable=[],e[t].overloadTable[o.argCount]=o}},dt=(e,t,r)=>{l.hasOwnProperty(e)?((void 0===r||void 0!==l[e].overloadTable&&void 0!==l[e].overloadTable[r])&&Ve(`Cannot register public name '${e}' twice`),ct(l,e,e),l[e].overloadTable.hasOwnProperty(r)&&Ve(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),l[e].overloadTable[r]=t):(l[e]=t,l[e].argCount=r)};function ut(e,t,r,o,n,i,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=o,this.baseClass=n,this.getActualType=i,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}var ht=(e,t,r)=>{for(;t!==r;)t.upcast||Ve(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function pt(e,t){if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,r,this.registeredClass)}function ft(e,t){var r;if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var o=t.$$.ptrType.registeredClass;if(r=ht(t.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Ve(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Ot.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:Ve("Unsupporting sharing policy")}return r}function gt(e,t){if(null===t)return this.isReference&&Ve(`null is not a valid ${this.name}`),0;t.$$||Ve(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||Ve(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Ve(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,r,this.registeredClass)}function mt(e,t,r,o,n,i,s,a,l,c,d){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=o,this.isSmartPointer=n,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=d,n||void 0!==t.baseClass?this.toWireType=ft:o?(this.toWireType=pt,this.destructorFunction=null):(this.toWireType=gt,this.destructorFunction=null)}var bt,vt,wt,kt,_t=(e,t,r)=>{l.hasOwnProperty(e)||$e("Replacing nonexistent public symbol"),void 0!==l[e].overloadTable&&void 0!==r?l[e].overloadTable[r]=t:(l[e]=t,l[e].argCount=r)},Ct=[],Et=e=>{var t=Ct[e];return t||(Ct[e]=t=bt.get(e)),t},St=(e,t)=>{e=He(e);var r=Et(t);return"function"!=typeof r&&Ve(`unknown function pointer with signature ${e}: ${t}`),r},xt=l.UnboundTypeError=(vt=Error,(kt=lt(wt="UnboundTypeError",(function(e){this.name=wt,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(vt.prototype),kt.prototype.constructor=kt,kt.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},kt),Tt=e=>{var t=Wl(e),r=He(t);return Vl(t),r},Pt=(e,t)=>{var r=[],o={};throw t.forEach((function e(t){o[t]||Be[t]||(Oe[t]?Oe[t].forEach(e):(r.push(t),o[t]=!0))})),new xt(`${e}: `+r.map(Tt).join([", "]))},At=(e,t)=>{for(var r=[],o=0;o<e;o++)r.push(F[t+4*o>>2]);return r};function Ft(e,t,r,o,n,i){var s=t.length;s<2&&Ve("argTypes array size mismatch! Must at least get return value and 'this' types!");var a=null!==t[1]&&null!==r,l=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}(t),c="void"!==t[0].name,d=s-2,u=new Array(d),h=[],p=[];return lt(e,(function(...e){var r;p.length=0,h.length=a?2:1,h[0]=n,a&&(r=t[1].toWireType(p,this),h[1]=r);for(var i=0;i<d;++i)u[i]=t[i+2].toWireType(p,e[i]),h.push(u[i]);return function(e){if(l)Ie(p);else for(var o=a?1:2;o<t.length;o++){var n=1===o?r:u[o-2];null!==t[o].destructorFunction&&t[o].destructorFunction(n)}if(c)return t[0].fromWireType(e)}(o(...h))}))}var Mt,It=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},Rt=[],Lt=[],Dt=e=>{e>9&&0==--Lt[e+1]&&(Lt[e]=void 0,Rt.push(e))},Bt=()=>Lt.length/2-5-Rt.length,Ot={toValue:e=>(e||Ve("Cannot use deleted val. handle = "+e),Lt[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=Rt.pop()||Lt.length;return Lt[t]=e,Lt[t+1]=1,t}}}},jt={name:"emscripten::val",fromWireType:e=>{var t=Ot.toValue(e);return Dt(e),t},toWireType:(e,t)=>Ot.toHandle(t),argPackAdvance:Xe,readValueFromPointer:Re,destructorFunction:null},$t=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(S[e])}:function(e){return this.fromWireType(x[e])};case 2:return r?function(e){return this.fromWireType(T[e>>1])}:function(e){return this.fromWireType(P[e>>1])};case 4:return r?function(e){return this.fromWireType(A[e>>2])}:function(e){return this.fromWireType(F[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},qt=(e,t)=>{var r=Be[e];return void 0===r&&Ve(`${t} has unknown type ${Tt(e)}`),r},Ut=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(M[e>>2])};case 8:return function(e){return this.fromWireType(L[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Wt=Object.assign({optional:!0},jt),Ht="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Nt=(e,t)=>{for(var r=e,o=r>>1,n=o+t/2;!(o>=n)&&P[o];)++o;if((r=o<<1)-e>32&&Ht)return Ht.decode(x.subarray(e,r));for(var i="",s=0;!(s>=t/2);++s){var a=T[e+2*s>>1];if(0==a)break;i+=String.fromCharCode(a)}return i},Vt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var o=t,n=(r-=2)<2*e.length?r/2:e.length,i=0;i<n;++i){var s=e.charCodeAt(i);T[t>>1]=s,t+=2}return T[t>>1]=0,t-o},zt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,o="";!(r>=t/4);){var n=A[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var i=n-65536;o+=String.fromCharCode(55296|i>>10,56320|1023&i)}else o+=String.fromCharCode(n)}return o},Xt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var o=t,n=o+r-4,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),A[t>>2]=s,(t+=4)+4>n)break}return A[t>>2]=0,t-o},Yt=e=>{for(var t=0,r=0;r<e.length;++r){var o=e.charCodeAt(r);o>=55296&&o<=57343&&++r,t+=4}return t},Kt=0,Qt=(e,t,r)=>{var o=[],n=e.toWireType(o,r);return o.length&&(F[t>>2]=Ot.toHandle(o)),n},Zt=[],Jt={},er=e=>{var t=Jt[e];return void 0===t?He(e):t},tr=()=>{if("object"==typeof globalThis)return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==typeof $$$embind_global$$$&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof global&&e(global)?$$$embind_global$$$=global:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},rr=Reflect.construct,or=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),nr=[0,31,60,91,121,152,182,213,244,274,305,335],ir=[0,31,59,90,120,151,181,212,243,273,304,334],sr=e=>{var t;return((t=e.getFullYear())%4!=0||t%100==0&&t%400!=0?ir:nr)[e.getMonth()]+e.getDate()-1},ar={},lr=e=>{if(e instanceof ExitStatus||"unwind"==e)return E;y(1,e)},cr=()=>oe||Kt>0,dr=e=>{E=e,cr()||(l.onExit?.(e),B=!0),y(e,new ExitStatus(e))},ur=(e,t)=>{E=e,dr(e)},hr=ur,pr=e=>{if(!B)try{e(),(()=>{if(!cr())try{hr(E)}catch(e){lr(e)}})()}catch(e){lr(e)}},fr=()=>performance.now(),gr=()=>Date.now(),mr=(e,t)=>setTimeout((()=>{pr(e)}),t),br={useWebGL:!1,isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],workers:[],preloadedImages:{},preloadedAudios:{},getCanvas:()=>l.canvas,init(){if(!br.initted){br.initted=!0;var e={canHandle:function(e){return!l.noImageDecoding&&/\.(jpg|jpeg|png|bmp|webp)$/i.test(e)},handle:function(e,t,r,o){var n=new Blob([e],{type:br.getMimetype(t)});n.size!==e.length&&(n=new Blob([new Uint8Array(e).buffer],{type:br.getMimetype(t)}));var i=URL.createObjectURL(n),s=new Image;s.onload=()=>{var o=document.createElement("canvas");o.width=s.width,o.height=s.height,o.getContext("2d").drawImage(s,0,0),br.preloadedImages[t]=o,URL.revokeObjectURL(i),r?.(e)},s.onerror=e=>{_(`Image ${i} could not be decoded`),o?.()},s.src=i}};Ee.push(e);var t={canHandle:function(e){return!l.noAudioDecoding&&e.slice(-4)in{".ogg":1,".wav":1,".mp3":1}},handle:function(e,t,r,o){var n=!1;function i(o){n||(n=!0,br.preloadedAudios[t]=o,r?.(e))}var s=new Blob([e],{type:br.getMimetype(t)}),a=URL.createObjectURL(s),l=new Audio;l.addEventListener("canplaythrough",(()=>i(l)),!1),l.onerror=function(r){n||(_(`warning: browser could not fully decode audio ${t}, trying slower base64 approach`),l.src="data:audio/x-"+t.slice(-3)+";base64,"+function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",o=0,n=0,i=0;i<e.length;i++)for(o=o<<8|e[i],n+=8;n>=6;){var s=o>>n-6&63;n-=6,r+=t[s]}return 2==n?(r+=t[(3&o)<<4],r+="=="):4==n&&(r+=t[(15&o)<<2],r+="="),r}(e),i(l))},l.src=a,mr((()=>{i(l)}),1e4)}};Ee.push(t);var r=br.getCanvas();r&&(r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||(()=>{}),r.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||(()=>{}),r.exitPointerLock=r.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",o,!1),document.addEventListener("mozpointerlockchange",o,!1),document.addEventListener("webkitpointerlockchange",o,!1),document.addEventListener("mspointerlockchange",o,!1),l.elementPointerLock&&r.addEventListener("click",(e=>{!br.pointerLock&&br.getCanvas().requestPointerLock&&(br.getCanvas().requestPointerLock(),e.preventDefault())}),!1))}function o(){var e=br.getCanvas();br.pointerLock=document.pointerLockElement===e||document.mozPointerLockElement===e||document.webkitPointerLockElement===e||document.msPointerLockElement===e}},createContext(e,t,r,o){if(t&&l.ctx&&e==br.getCanvas())return l.ctx;var n,i;if(t){var s={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(o)for(var a in o)s[a]=o[a];void 0!==vr&&(i=vr.createContext(e,s))&&(n=vr.getContext(i).GLctx)}else n=e.getContext("2d");return n?(r&&(l.ctx=n,t&&vr.makeContextCurrent(i),br.useWebGL=t,br.moduleContextCreatedCallbacks.forEach((e=>e())),br.init()),n):null},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,t){br.lockPointer=e,br.resizeCanvas=t,void 0===br.lockPointer&&(br.lockPointer=!0),void 0===br.resizeCanvas&&(br.resizeCanvas=!1);var r=br.getCanvas();function o(){br.isFullscreen=!1;var e=r.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e?(r.exitFullscreen=br.exitFullscreen,br.lockPointer&&r.requestPointerLock(),br.isFullscreen=!0,br.resizeCanvas?br.setFullscreenCanvasSize():br.updateCanvasDimensions(r)):(e.parentNode.insertBefore(r,e),e.parentNode.removeChild(e),br.resizeCanvas?br.setWindowedCanvasSize():br.updateCanvasDimensions(r)),l.onFullScreen?.(br.isFullscreen),l.onFullscreen?.(br.isFullscreen)}br.fullscreenHandlersInstalled||(br.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",o,!1),document.addEventListener("mozfullscreenchange",o,!1),document.addEventListener("webkitfullscreenchange",o,!1),document.addEventListener("MSFullscreenChange",o,!1));var n=document.createElement("div");r.parentNode.insertBefore(n,r),n.appendChild(r),n.requestFullscreen=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||(n.webkitRequestFullscreen?()=>n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(n.webkitRequestFullScreen?()=>n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),n.requestFullscreen()},exitFullscreen:()=>!!br.isFullscreen&&((document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||(()=>{})).apply(document,[]),!0),safeSetTimeout:(e,t)=>mr(e,t),getMimetype:e=>({jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.slice(e.lastIndexOf(".")+1)]),getUserMedia(e){window.getUserMedia||=navigator.getUserMedia||navigator.mozGetUserMedia,window.getUserMedia(e)},getMovementX:e=>e.movementX||e.mozMovementX||e.webkitMovementX||0,getMovementY:e=>e.movementY||e.mozMovementY||e.webkitMovementY||0,getMouseWheelDelta(e){var t=0;switch(e.type){case"DOMMouseScroll":t=e.detail/3;break;case"mousewheel":t=e.wheelDelta/120;break;case"wheel":switch(t=e.deltaY,e.deltaMode){case 0:t/=100;break;case 1:t/=3;break;case 2:t*=80;break;default:throw"unrecognized mouse wheel delta mode: "+e.deltaMode}break;default:throw"unrecognized mouse wheel event: "+e.type}return t},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(e,t){var r=br.getCanvas(),o=r.getBoundingClientRect(),n=void 0!==window.scrollX?window.scrollX:window.pageXOffset,i=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(n+o.left),a=t-(i+o.top);return{x:s*=r.width/o.width,y:a*=r.height/o.height}},setMouseCoords(e,t){const{x:r,y:o}=br.calculateMouseCoords(e,t);br.mouseMovementX=r-br.mouseX,br.mouseMovementY=o-br.mouseY,br.mouseX=r,br.mouseY=o},calculateMouseEvent(e){if(br.pointerLock)"mousemove"!=e.type&&"mozMovementX"in e?br.mouseMovementX=br.mouseMovementY=0:(br.mouseMovementX=br.getMovementX(e),br.mouseMovementY=br.getMovementY(e)),br.mouseX+=br.mouseMovementX,br.mouseY+=br.mouseMovementY;else{if("touchstart"===e.type||"touchend"===e.type||"touchmove"===e.type){var t=e.touch;if(void 0===t)return;var r=br.calculateMouseCoords(t.pageX,t.pageY);if("touchstart"===e.type)br.lastTouches[t.identifier]=r,br.touches[t.identifier]=r;else if("touchend"===e.type||"touchmove"===e.type){var o=br.touches[t.identifier];o||=r,br.lastTouches[t.identifier]=o,br.touches[t.identifier]=r}return}br.setMouseCoords(e.pageX,e.pageY)}},resizeListeners:[],updateResizeListeners(){var e=br.getCanvas();br.resizeListeners.forEach((t=>t(e.width,e.height)))},setCanvasSize(e,t,r){var o=br.getCanvas();br.updateCanvasDimensions(o,e,t),r||br.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if("undefined"!=typeof SDL){var e=F[SDL.screen>>2];e|=8388608,A[SDL.screen>>2]=e}br.updateCanvasDimensions(br.getCanvas()),br.updateResizeListeners()},setWindowedCanvasSize(){if("undefined"!=typeof SDL){var e=F[SDL.screen>>2];e&=-8388609,A[SDL.screen>>2]=e}br.updateCanvasDimensions(br.getCanvas()),br.updateResizeListeners()},updateCanvasDimensions(e,t,r){t&&r?(e.widthNative=t,e.heightNative=r):(t=e.widthNative,r=e.heightNative);var o=t,n=r;if(l.forcedAspectRatio>0&&(o/n<l.forcedAspectRatio?o=Math.round(n*l.forcedAspectRatio):n=Math.round(o/l.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/o,screen.height/n);o=Math.round(o*i),n=Math.round(n*i)}br.resizeCanvas?(e.width!=o&&(e.width=o),e.height!=n&&(e.height=n),void 0!==e.style&&(e.style.removeProperty("width"),e.style.removeProperty("height"))):(e.width!=t&&(e.width=t),e.height!=r&&(e.height=r),void 0!==e.style&&(o!=t||n!=r?(e.style.setProperty("width",o+"px","important"),e.style.setProperty("height",n+"px","important")):(e.style.removeProperty("width"),e.style.removeProperty("height"))))}},yr={errorCode:12288,defaultDisplayInitialized:!1,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1},stringCache:{},setErrorCode(e){yr.errorCode=e},chooseConfig(e,t,r,o,n){if(62e3!=e)return yr.setErrorCode(12296),0;if(t)for(;;){var i=A[t>>2];if(12321==i){var s=A[t+4>>2];yr.contextAttributes.alpha=s>0}else if(12325==i){var a=A[t+4>>2];yr.contextAttributes.depth=a>0}else if(12326==i){var l=A[t+4>>2];yr.contextAttributes.stencil=l>0}else if(12337==i){var c=A[t+4>>2];yr.contextAttributes.antialias=c>0}else if(12338==i)c=A[t+4>>2],yr.contextAttributes.antialias=1==c;else if(12544==i){var d=A[t+4>>2];yr.contextAttributes.lowLatency=12547!=d}else if(12344==i)break;t+=8}return r&&o||n?(n&&(A[n>>2]=1),r&&o>0&&(F[r>>2]=62002),yr.setErrorCode(12288),1):(yr.setErrorCode(12300),0)}},vr={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,unpackRowLength:0,recordError:e=>{vr.lastError||(vr.lastError=e)},getNewId:e=>{for(var t=vr.counter++,r=e.length;r<t;r++)e[r]=null;return t},genObject:(e,t,r,o)=>{for(var n=0;n<e;n++){var i=Mt[r](),s=i&&vr.getNewId(o);i?(i.name=s,o[s]=i):vr.recordError(1282),A[t+4*n>>2]=s}},getSource:(e,t,r,o)=>{for(var n="",i=0;i<t;++i){var s=o?F[o+4*i>>2]:void 0;n+=Q(F[r+4*i>>2],s)}return n},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var o=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==o instanceof WebGLRenderingContext?o:null};e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=t}var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?vr.registerContext(r,t):0},registerContext:(e,t)=>{var r=vr.getNewId(vr.contexts),o={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=o),vr.contexts[r]=o,r},makeContextCurrent:e=>(vr.currentContext=vr.contexts[e],l.ctx=Mt=vr.currentContext?.GLctx,!(e&&!Mt)),getContext:e=>vr.contexts[e],deleteContext:e=>{vr.currentContext===vr.contexts[e]&&(vr.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(vr.contexts[e].GLctx.canvas),vr.contexts[e]?.GLctx.canvas&&(vr.contexts[e].GLctx.canvas.GLctxObject=void 0),vr.contexts[e]=null}},wr=[],kr=(e,t,r)=>{var o=((e,t)=>{var r;for(wr.length=0;r=x[e++];){var o=105!=r;t+=(o&=112!=r)&&t%8?4:0,wr.push(112==r?F[t>>2]:106==r?I[t>>3]:105==r?A[t>>2]:L[t>>3]),t+=o?8:4}return wr})(t,r);return $l[e](...o)},_r=e=>Mt.activeTexture(e),Cr=(e,t)=>{Mt.attachShader(vr.programs[e],vr.shaders[t])},Er=(e,t)=>{Mt.beginQuery(e,vr.queries[t])},Sr=(e,t)=>{Mt.disjointTimerQueryExt.beginQueryEXT(e,vr.queries[t])},xr=e=>Mt.beginTransformFeedback(e),Tr=(e,t,r)=>{Mt.bindAttribLocation(vr.programs[e],t,Q(r))},Pr=(e,t)=>{35051==e?Mt.currentPixelPackBufferBinding=t:35052==e&&(Mt.currentPixelUnpackBufferBinding=t),Mt.bindBuffer(e,vr.buffers[t])},Ar=(e,t,r)=>{Mt.bindBufferBase(e,t,vr.buffers[r])},Fr=(e,t,r,o,n)=>{Mt.bindBufferRange(e,t,vr.buffers[r],o,n)},Mr=(e,t)=>{Mt.bindFramebuffer(e,vr.framebuffers[t])},Ir=(e,t)=>{Mt.bindRenderbuffer(e,vr.renderbuffers[t])},Rr=(e,t)=>{Mt.bindSampler(e,vr.samplers[t])},Lr=(e,t)=>{Mt.bindTexture(e,vr.textures[t])},Dr=(e,t)=>{Mt.bindTransformFeedback(e,vr.transformFeedbacks[t])},Br=e=>{Mt.bindVertexArray(vr.vaos[e])},Or=Br,jr=Br,$r=jr,qr=(e,t,r,o)=>Mt.blendColor(e,t,r,o),Ur=e=>Mt.blendEquation(e),Wr=(e,t)=>Mt.blendEquationSeparate(e,t),Hr=(e,t)=>Mt.blendFunc(e,t),Nr=(e,t,r,o)=>Mt.blendFuncSeparate(e,t,r,o),Vr=(e,t,r,o,n,i,s,a,l,c)=>Mt.blitFramebuffer(e,t,r,o,n,i,s,a,l,c),zr=(e,t,r,o)=>{vr.currentContext.version>=2?r&&t?Mt.bufferData(e,x,o,r,t):Mt.bufferData(e,t,o):Mt.bufferData(e,r?x.subarray(r,r+t):t,o)},Gr=(e,t,r,o)=>{vr.currentContext.version>=2?r&&Mt.bufferSubData(e,t,x,o,r):Mt.bufferSubData(e,t,x.subarray(o,o+r))},Xr=e=>Mt.checkFramebufferStatus(e),Yr=e=>Mt.clear(e),Kr=(e,t,r,o)=>Mt.clearBufferfi(e,t,r,o),Qr=(e,t,r)=>{Mt.clearBufferfv(e,t,M,r>>2)},Zr=(e,t,r)=>{Mt.clearBufferiv(e,t,A,r>>2)},Jr=(e,t,r)=>{Mt.clearBufferuiv(e,t,F,r>>2)},eo=(e,t,r,o)=>Mt.clearColor(e,t,r,o),to=e=>Mt.clearDepth(e),ro=e=>Mt.clearStencil(e),oo=(e,t,r)=>(r=Number(r),Mt.clientWaitSync(vr.syncs[e],t,r)),no=(e,t)=>{Mt.extClipControl.clipControlEXT(e,t)},io=(e,t,r,o)=>{Mt.colorMask(!!e,!!t,!!r,!!o)},so=e=>{Mt.compileShader(vr.shaders[e])},ao=(e,t,r,o,n,i,s,a)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!s?void Mt.compressedTexImage2D(e,t,r,o,n,i,s,a):void Mt.compressedTexImage2D(e,t,r,o,n,i,x,a,s);Mt.compressedTexImage2D(e,t,r,o,n,i,x.subarray(a,a+s))},lo=(e,t,r,o,n,i,s,a,l)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexImage3D(e,t,r,o,n,i,s,a,l):Mt.compressedTexImage3D(e,t,r,o,n,i,s,x,l,a)},co=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!a?void Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,a,l):void Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,x,l,a);Mt.compressedTexSubImage2D(e,t,r,o,n,i,s,x.subarray(l,l+a))},uo=(e,t,r,o,n,i,s,a,l,c,d)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexSubImage3D(e,t,r,o,n,i,s,a,l,c,d):Mt.compressedTexSubImage3D(e,t,r,o,n,i,s,a,l,x,d,c)},ho=(e,t,r,o,n)=>Mt.copyBufferSubData(e,t,r,o,n),po=(e,t,r,o,n,i,s,a)=>Mt.copyTexImage2D(e,t,r,o,n,i,s,a),fo=(e,t,r,o,n,i,s,a)=>Mt.copyTexSubImage2D(e,t,r,o,n,i,s,a),go=(e,t,r,o,n,i,s,a,l)=>Mt.copyTexSubImage3D(e,t,r,o,n,i,s,a,l),mo=()=>{var e=vr.getNewId(vr.programs),t=Mt.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,vr.programs[e]=t,e},bo=e=>{var t=vr.getNewId(vr.shaders);return vr.shaders[t]=Mt.createShader(e),t},yo=e=>Mt.cullFace(e),vo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.buffers[o];n&&(Mt.deleteBuffer(n),n.name=0,vr.buffers[o]=null,o==Mt.currentPixelPackBufferBinding&&(Mt.currentPixelPackBufferBinding=0),o==Mt.currentPixelUnpackBufferBinding&&(Mt.currentPixelUnpackBufferBinding=0))}},wo=(e,t)=>{for(var r=0;r<e;++r){var o=A[t+4*r>>2],n=vr.framebuffers[o];n&&(Mt.deleteFramebuffer(n),n.name=0,vr.framebuffers[o]=null)}},ko=e=>{if(e){var t=vr.programs[e];t?(Mt.deleteProgram(t),t.name=0,vr.programs[e]=null):vr.recordError(1281)}},_o=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.queries[o];n&&(Mt.deleteQuery(n),vr.queries[o]=null)}},Co=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.queries[o];n&&(Mt.disjointTimerQueryExt.deleteQueryEXT(n),vr.queries[o]=null)}},Eo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.renderbuffers[o];n&&(Mt.deleteRenderbuffer(n),n.name=0,vr.renderbuffers[o]=null)}},So=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.samplers[o];n&&(Mt.deleteSampler(n),n.name=0,vr.samplers[o]=null)}},xo=e=>{if(e){var t=vr.shaders[e];t?(Mt.deleteShader(t),vr.shaders[e]=null):vr.recordError(1281)}},To=e=>{if(e){var t=vr.syncs[e];t?(Mt.deleteSync(t),t.name=0,vr.syncs[e]=null):vr.recordError(1281)}},Po=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.textures[o];n&&(Mt.deleteTexture(n),n.name=0,vr.textures[o]=null)}},Ao=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2],n=vr.transformFeedbacks[o];n&&(Mt.deleteTransformFeedback(n),n.name=0,vr.transformFeedbacks[o]=null)}},Fo=(e,t)=>{for(var r=0;r<e;r++){var o=A[t+4*r>>2];Mt.deleteVertexArray(vr.vaos[o]),vr.vaos[o]=null}},Mo=Fo,Io=Fo,Ro=Io,Lo=e=>Mt.depthFunc(e),Do=e=>{Mt.depthMask(!!e)},Bo=(e,t)=>Mt.depthRange(e,t),Oo=(e,t)=>{Mt.detachShader(vr.programs[e],vr.shaders[t])},jo=e=>Mt.disable(e),$o=e=>{Mt.disableVertexAttribArray(e)},qo=(e,t,r)=>{Mt.drawArrays(e,t,r)},Uo=(e,t,r,o)=>{Mt.drawArraysInstanced(e,t,r,o)},Wo=Uo,Ho=Uo,No=Ho,Vo=Uo,zo=Vo,Go=(e,t,r,o,n)=>{Mt.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,o,n)},Xo=Uo,Yo=Xo,Ko=Uo,Qo=Ko,Zo=[],Jo=(e,t)=>{for(var r=Zo[e],o=0;o<e;o++)r[o]=A[t+4*o>>2];Mt.drawBuffers(r)},en=Jo,tn=Jo,rn=tn,on=Jo,nn=on,sn=(e,t,r,o)=>{Mt.drawElements(e,t,r,o)},an=sn,ln=(e,t,r,o,n)=>{Mt.drawElementsInstanced(e,t,r,o,n)},cn=ln,dn=ln,un=dn,hn=ln,pn=hn,fn=(e,t,r,o,n,i,s)=>{Mt.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,o,n,i,s)},gn=ln,mn=gn,bn=ln,yn=bn,vn=(e,t,r,o,n,i)=>{sn(e,o,n,i)},wn=e=>Mt.enable(e),kn=e=>{Mt.enableVertexAttribArray(e)},_n=e=>Mt.endQuery(e),Cn=e=>{Mt.disjointTimerQueryExt.endQueryEXT(e)},En=()=>Mt.endTransformFeedback(),Sn=(e,t)=>{var r=Mt.fenceSync(e,t);if(r){var o=vr.getNewId(vr.syncs);return r.name=o,vr.syncs[o]=r,o}return 0},xn=()=>Mt.finish(),Tn=()=>Mt.flush(),Pn=(e,t,r,o)=>{Mt.framebufferRenderbuffer(e,t,r,vr.renderbuffers[o])},An=(e,t,r,o,n)=>{Mt.framebufferTexture2D(e,t,r,vr.textures[o],n)},Fn=(e,t,r,o,n)=>{Mt.framebufferTextureLayer(e,t,vr.textures[r],o,n)},Mn=e=>Mt.frontFace(e),In=(e,t)=>{vr.genObject(e,t,"createBuffer",vr.buffers)},Rn=(e,t)=>{vr.genObject(e,t,"createFramebuffer",vr.framebuffers)},Ln=(e,t)=>{vr.genObject(e,t,"createQuery",vr.queries)},Dn=(e,t)=>{for(var r=0;r<e;r++){var o=Mt.disjointTimerQueryExt.createQueryEXT();if(!o){for(vr.recordError(1282);r<e;)A[t+4*r++>>2]=0;return}var n=vr.getNewId(vr.queries);o.name=n,vr.queries[n]=o,A[t+4*r>>2]=n}},Bn=(e,t)=>{vr.genObject(e,t,"createRenderbuffer",vr.renderbuffers)},On=(e,t)=>{vr.genObject(e,t,"createSampler",vr.samplers)},jn=(e,t)=>{vr.genObject(e,t,"createTexture",vr.textures)},$n=(e,t)=>{vr.genObject(e,t,"createTransformFeedback",vr.transformFeedbacks)},qn=(e,t)=>{vr.genObject(e,t,"createVertexArray",vr.vaos)},Un=qn,Wn=qn,Hn=Wn,Nn=e=>Mt.generateMipmap(e),Vn=(e,t,r,o,n,i,s,a)=>{t=vr.programs[t];var l=Mt[e](t,r);if(l){var c=a&&le(l.name,a,o);n&&(A[n>>2]=c),i&&(A[i>>2]=l.size),s&&(A[s>>2]=l.type)}},zn=(e,t,r,o,n,i,s)=>Vn("getActiveAttrib",e,t,r,o,n,i,s),Gn=(e,t,r,o,n,i,s)=>Vn("getActiveUniform",e,t,r,o,n,i,s),Xn=(e,t,r,o,n)=>{e=vr.programs[e];var i=Mt.getActiveUniformBlockName(e,t);if(i)if(n&&r>0){var s=le(i,n,r);o&&(A[o>>2]=s)}else o&&(A[o>>2]=0)},Yn=(e,t,r,o)=>{if(o)if(e=vr.programs[e],35393!=r){var n=Mt.getActiveUniformBlockParameter(e,t,r);if(null!==n)if(35395==r)for(var i=0;i<n.length;i++)A[o+4*i>>2]=n[i];else A[o>>2]=n}else{var s=Mt.getActiveUniformBlockName(e,t);A[o>>2]=s.length+1}else vr.recordError(1281)},Kn=(e,t,r,o,n)=>{if(n)if(t>0&&0==r)vr.recordError(1281);else{e=vr.programs[e];for(var i=[],s=0;s<t;s++)i.push(A[r+4*s>>2]);var a=Mt.getActiveUniforms(e,i,o);if(a){var l=a.length;for(s=0;s<l;s++)A[n+4*s>>2]=a[s]}}else vr.recordError(1281)},Qn=(e,t,r,o)=>{var n=Mt.getAttachedShaders(vr.programs[e]),i=n.length;i>t&&(i=t),A[r>>2]=i;for(var s=0;s<i;++s){var a=vr.shaders.indexOf(n[s]);A[o+4*s>>2]=a}},Zn=(e,t)=>Mt.getAttribLocation(vr.programs[e],Q(t)),Jn=(e,t)=>{F[e>>2]=t;var r=F[e>>2];F[e+4>>2]=(t-r)/4294967296},ei=()=>{var e,t=(e=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_conservative_depth","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","NV_shader_noperspective_interpolation","WEBGL_clip_cull_distance","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"],(Mt.getSupportedExtensions()||[]).filter((t=>e.includes(t))));return t=t.concat(t.map((e=>"GL_"+e)))},ti=(e,t,r)=>{if(t){var o=void 0;switch(e){case 36346:o=1;break;case 36344:return void(0!=r&&1!=r&&vr.recordError(1280));case 34814:case 36345:o=0;break;case 34466:var n=Mt.getParameter(34467);o=n?n.length:0;break;case 33309:if(vr.currentContext.version<2)return void vr.recordError(1282);o=ei().length;break;case 33307:case 33308:if(vr.currentContext.version<2)return void vr.recordError(1280);o=33307==e?3:0}if(void 0===o){var i=Mt.getParameter(e);switch(typeof i){case"number":o=i;break;case"boolean":o=i?1:0;break;case"string":return void vr.recordError(1280);case"object":if(null===i)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:o=0;break;default:return void vr.recordError(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(var s=0;s<i.length;++s)switch(r){case 0:A[t+4*s>>2]=i[s];break;case 2:M[t+4*s>>2]=i[s];break;case 4:S[t+s]=i[s]?1:0}return}try{o=0|i.name}catch(t){return vr.recordError(1280),void _(`GL_INVALID_ENUM in glGet${r}v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return vr.recordError(1280),void _(`GL_INVALID_ENUM in glGet${r}v: Native code calling glGet${r}v(${e}) and it returns ${i} of type ${typeof i}!`)}}switch(r){case 1:Jn(t,o);break;case 0:A[t>>2]=o;break;case 2:M[t>>2]=o;break;case 4:S[t]=o?1:0}}else vr.recordError(1281)},ri=(e,t)=>ti(e,t,4),oi=(e,t,r)=>{r?Jn(r,Mt.getBufferParameter(e,t)):vr.recordError(1281)},ni=(e,t,r)=>{r?A[r>>2]=Mt.getBufferParameter(e,t):vr.recordError(1281)},ii=()=>{var e=Mt.getError()||vr.lastError;return vr.lastError=0,e},si=(e,t)=>ti(e,t,2),ai=(e,t)=>Mt.getFragDataLocation(vr.programs[e],Q(t)),li=(e,t,r,o)=>{var n=Mt.getFramebufferAttachmentParameter(e,t,r);(n instanceof WebGLRenderbuffer||n instanceof WebGLTexture)&&(n=0|n.name),A[o>>2]=n},ci=(e,t,r,o)=>{if(r){var n,i=Mt.getIndexedParameter(e,t);switch(typeof i){case"boolean":n=i?1:0;break;case"number":n=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:n=0;break;default:return void vr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void vr.recordError(1280);n=0|i.name}break;default:return void vr.recordError(1280)}switch(o){case 1:Jn(r,n);break;case 0:A[r>>2]=n;break;case 2:M[r>>2]=n;break;case 4:S[r]=n?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+o}}else vr.recordError(1281)},di=(e,t,r)=>ci(e,t,r,1),ui=(e,t)=>{ti(e,t,1)},hi=(e,t,r)=>ci(e,t,r,0),pi=(e,t)=>ti(e,t,0),fi=(e,t,r,o,n)=>{if(o<0)vr.recordError(1281);else if(n){var i=Mt.getInternalformatParameter(e,t,r);if(null!==i)for(var s=0;s<i.length&&s<o;++s)A[n+4*s>>2]=i[s]}else vr.recordError(1281)},gi=(e,t,r,o,n)=>{vr.recordError(1282)},mi=(e,t,r,o)=>{var n=Mt.getProgramInfoLog(vr.programs[e]);null===n&&(n="(unknown error)");var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)},bi=(e,t,r)=>{if(r)if(e>=vr.counter)vr.recordError(1281);else if(e=vr.programs[e],35716==t){var o=Mt.getProgramInfoLog(e);null===o&&(o="(unknown error)"),A[r>>2]=o.length+1}else if(35719==t){if(!e.maxUniformLength)for(var n=Mt.getProgramParameter(e,35718),i=0;i<n;++i)e.maxUniformLength=Math.max(e.maxUniformLength,Mt.getActiveUniform(e,i).name.length+1);A[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength){var s=Mt.getProgramParameter(e,35721);for(i=0;i<s;++i)e.maxAttributeLength=Math.max(e.maxAttributeLength,Mt.getActiveAttrib(e,i).name.length+1)}A[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength){var a=Mt.getProgramParameter(e,35382);for(i=0;i<a;++i)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,Mt.getActiveUniformBlockName(e,i).length+1)}A[r>>2]=e.maxUniformBlockNameLength}else A[r>>2]=Mt.getProgramParameter(e,t);else vr.recordError(1281)},yi=(e,t,r)=>{if(r){var o,n=vr.queries[e];o=vr.currentContext.version<2?Mt.disjointTimerQueryExt.getQueryObjectEXT(n,t):Mt.getQueryParameter(n,t),Jn(r,"boolean"==typeof o?o?1:0:o)}else vr.recordError(1281)},vi=yi,wi=(e,t,r)=>{if(r){var o,n=vr.queries[e],i=Mt.disjointTimerQueryExt.getQueryObjectEXT(n,t);o="boolean"==typeof i?i?1:0:i,A[r>>2]=o}else vr.recordError(1281)},ki=wi,_i=yi,Ci=_i,Ei=(e,t,r)=>{if(r){var o,n=vr.queries[e],i=Mt.getQueryParameter(n,t);o="boolean"==typeof i?i?1:0:i,A[r>>2]=o}else vr.recordError(1281)},Si=wi,xi=Si,Ti=(e,t,r)=>{r?A[r>>2]=Mt.getQuery(e,t):vr.recordError(1281)},Pi=(e,t,r)=>{r?A[r>>2]=Mt.disjointTimerQueryExt.getQueryEXT(e,t):vr.recordError(1281)},Ai=(e,t,r)=>{r?A[r>>2]=Mt.getRenderbufferParameter(e,t):vr.recordError(1281)},Fi=(e,t,r)=>{r?M[r>>2]=Mt.getSamplerParameter(vr.samplers[e],t):vr.recordError(1281)},Mi=(e,t,r)=>{r?A[r>>2]=Mt.getSamplerParameter(vr.samplers[e],t):vr.recordError(1281)},Ii=(e,t,r,o)=>{var n=Mt.getShaderInfoLog(vr.shaders[e]);null===n&&(n="(unknown error)");var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)},Ri=(e,t,r,o)=>{var n=Mt.getShaderPrecisionFormat(e,t);A[r>>2]=n.rangeMin,A[r+4>>2]=n.rangeMax,A[o>>2]=n.precision},Li=(e,t,r,o)=>{var n=Mt.getShaderSource(vr.shaders[e]);if(n){var i=t>0&&o?le(n,o,t):0;r&&(A[r>>2]=i)}},Di=(e,t,r)=>{if(r)if(35716==t){var o=Mt.getShaderInfoLog(vr.shaders[e]);null===o&&(o="(unknown error)");var n=o?o.length+1:0;A[r>>2]=n}else if(35720==t){var i=Mt.getShaderSource(vr.shaders[e]),s=i?i.length+1:0;A[r>>2]=s}else A[r>>2]=Mt.getShaderParameter(vr.shaders[e],t);else vr.recordError(1281)},Bi=e=>{var t=vr.stringCache[e];if(!t){switch(e){case 7939:t=ce(ei().join(" "));break;case 7936:case 7937:case 37445:case 37446:var r=Mt.getParameter(e);r||vr.recordError(1280),t=r?ce(r):0;break;case 7938:var o=Mt.getParameter(7938),n=`OpenGL ES 2.0 (${o})`;vr.currentContext.version>=2&&(n=`OpenGL ES 3.0 (${o})`),t=ce(n);break;case 35724:var i=Mt.getParameter(35724),s=i.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==s&&(3==s[1].length&&(s[1]=s[1]+"0"),i=`OpenGL ES GLSL ES ${s[1]} (${i})`),t=ce(i);break;default:vr.recordError(1280)}vr.stringCache[e]=t}return t},Oi=(e,t)=>{if(vr.currentContext.version<2)return vr.recordError(1282),0;var r=vr.stringiCache[e];if(r)return t<0||t>=r.length?(vr.recordError(1281),0):r[t];if(7939===e){var o=ei().map(ce);return r=vr.stringiCache[e]=o,t<0||t>=r.length?(vr.recordError(1281),0):r[t]}return vr.recordError(1280),0},ji=(e,t,r,o,n)=>{if(r<0)vr.recordError(1281);else if(n){var i=Mt.getSyncParameter(vr.syncs[e],t);null!==i&&(A[n>>2]=i,o&&(A[o>>2]=1))}else vr.recordError(1281)},$i=(e,t,r)=>{r?M[r>>2]=Mt.getTexParameter(e,t):vr.recordError(1281)},qi=(e,t,r)=>{r?A[r>>2]=Mt.getTexParameter(e,t):vr.recordError(1281)},Ui=(e,t,r,o,n,i,s)=>{e=vr.programs[e];var a=Mt.getTransformFeedbackVarying(e,t);if(a){if(s&&r>0){var l=le(a.name,s,r);o&&(A[o>>2]=l)}else o&&(A[o>>2]=0);n&&(A[n>>2]=a.size),i&&(A[i>>2]=a.type)}},Wi=(e,t)=>Mt.getUniformBlockIndex(vr.programs[e],Q(t)),Hi=(e,t,r,o)=>{if(o)if(t>0&&(0==r||0==o))vr.recordError(1281);else{e=vr.programs[e];for(var n=[],i=0;i<t;i++)n.push(Q(A[r+4*i>>2]));var s=Mt.getUniformIndices(e,n);if(s){var a=s.length;for(i=0;i<a;i++)A[o+4*i>>2]=s[i]}}else vr.recordError(1281)},Ni=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),Vi=e=>{var t,r,o=e.uniformLocsById,n=e.uniformSizeAndIdsByName;if(!o){e.uniformLocsById=o={},e.uniformArrayNamesById={};var i=Mt.getProgramParameter(e,35718);for(t=0;t<i;++t){var s=Mt.getActiveUniform(e,t),a=s.name,l=s.size,c=Ni(a),d=c>0?a.slice(0,c):a,u=e.uniformIdCounter;for(e.uniformIdCounter+=l,n[d]=[l,u],r=0;r<l;++r)o[u]=r,e.uniformArrayNamesById[u++]=d}}},zi=(e,t)=>{if(t=Q(t),e=vr.programs[e]){Vi(e);var r=e.uniformLocsById,o=0,n=t,i=Ni(t);i>0&&(a=t.slice(i+1),o=parseInt(a)>>>0,n=t.slice(0,i));var s=e.uniformSizeAndIdsByName[n];if(s&&o<s[0]&&(r[o+=s[1]]=r[o]||Mt.getUniformLocation(e,t)))return o}else vr.recordError(1281);var a;return-1},Gi=e=>{var t=Mt.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=Mt.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}vr.recordError(1282)},Xi=(e,t,r,o)=>{if(r){e=vr.programs[e],Vi(e);var n=Mt.getUniform(e,Gi(t));if("number"==typeof n||"boolean"==typeof n)switch(o){case 0:A[r>>2]=n;break;case 2:M[r>>2]=n}else for(var i=0;i<n.length;i++)switch(o){case 0:A[r+4*i>>2]=n[i];break;case 2:M[r+4*i>>2]=n[i]}}else vr.recordError(1281)},Yi=(e,t,r)=>{Xi(e,t,r,2)},Ki=(e,t,r)=>{Xi(e,t,r,0)},Qi=(e,t,r)=>Xi(e,t,r,0),Zi=(e,t,r,o)=>{if(r){var n=Mt.getVertexAttrib(e,t);if(34975==t)A[r>>2]=n&&n.name;else if("number"==typeof n||"boolean"==typeof n)switch(o){case 0:A[r>>2]=n;break;case 2:M[r>>2]=n;break;case 5:A[r>>2]=Math.fround(n)}else for(var i=0;i<n.length;i++)switch(o){case 0:A[r+4*i>>2]=n[i];break;case 2:M[r+4*i>>2]=n[i];break;case 5:A[r+4*i>>2]=Math.fround(n[i])}}else vr.recordError(1281)},Ji=(e,t,r)=>{Zi(e,t,r,0)},es=Ji,ts=Ji,rs=ts,os=(e,t,r)=>{r?A[r>>2]=Mt.getVertexAttribOffset(e,t):vr.recordError(1281)},ns=(e,t,r)=>{Zi(e,t,r,2)},is=(e,t,r)=>{Zi(e,t,r,5)},ss=(e,t)=>Mt.hint(e,t),as=(e,t,r)=>{for(var o=Zo[t],n=0;n<t;n++)o[n]=A[r+4*n>>2];Mt.invalidateFramebuffer(e,o)},ls=(e,t,r,o,n,i,s)=>{for(var a=Zo[t],l=0;l<t;l++)a[l]=A[r+4*l>>2];Mt.invalidateSubFramebuffer(e,a,o,n,i,s)},cs=e=>{var t=vr.buffers[e];return t?Mt.isBuffer(t):0},ds=e=>Mt.isEnabled(e),us=e=>{var t=vr.framebuffers[e];return t?Mt.isFramebuffer(t):0},hs=e=>(e=vr.programs[e])?Mt.isProgram(e):0,ps=e=>{var t=vr.queries[e];return t?Mt.isQuery(t):0},fs=e=>{var t=vr.queries[e];return t?Mt.disjointTimerQueryExt.isQueryEXT(t):0},gs=e=>{var t=vr.renderbuffers[e];return t?Mt.isRenderbuffer(t):0},ms=e=>{var t=vr.samplers[e];return t?Mt.isSampler(t):0},bs=e=>{var t=vr.shaders[e];return t?Mt.isShader(t):0},ys=e=>Mt.isSync(vr.syncs[e]),vs=e=>{var t=vr.textures[e];return t?Mt.isTexture(t):0},ws=e=>Mt.isTransformFeedback(vr.transformFeedbacks[e]),ks=e=>{var t=vr.vaos[e];return t?Mt.isVertexArray(t):0},_s=ks,Cs=ks,Es=Cs,Ss=e=>Mt.lineWidth(e),xs=e=>{e=vr.programs[e],Mt.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},Ts=(e,t,r,o,n,i)=>{Mt.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,A,t>>2,A,r>>2,A,o>>2,F,n>>2,i)},Ps=(e,t,r,o,n,i,s,a)=>{Mt.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,A,t>>2,r,A,o>>2,A,n>>2,A,i>>2,F,s>>2,a)},As=()=>Mt.pauseTransformFeedback(),Fs=(e,t)=>{3317==e?vr.unpackAlignment=t:3314==e&&(vr.unpackRowLength=t),Mt.pixelStorei(e,t)},Ms=(e,t)=>{Mt.webglPolygonMode.polygonModeWEBGL(e,t)},Is=(e,t)=>Mt.polygonOffset(e,t),Rs=(e,t,r)=>{Mt.extPolygonOffsetClamp.polygonOffsetClampEXT(e,t,r)},Ls=(e,t,r,o)=>{vr.recordError(1280)},Ds=(e,t,r)=>{vr.recordError(1280)},Bs=(e,t)=>{Mt.disjointTimerQueryExt.queryCounterEXT(vr.queries[e],t)},Os=e=>Mt.readBuffer(e),js=e=>0==(e-=5120)?S:1==e?x:2==e?T:4==e?A:6==e?M:5==e||28922==e||28520==e||30779==e||30782==e?F:P,$s=(e,t)=>e>>>31-Math.clz32(t.BYTES_PER_ELEMENT),qs=(e,t,r,o,n,i)=>{var s=js(e),a=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*s.BYTES_PER_ELEMENT,l=((e,t,r)=>{var o,n,i=(vr.unpackRowLength||e)*r;return t*(o=i,n=vr.unpackAlignment,o+n-1&-n)})(r,o,a);return s.subarray($s(n,s),$s(n+l,s))},Us=(e,t,r,o,n,i,s)=>{if(vr.currentContext.version>=2){if(Mt.currentPixelPackBufferBinding)return void Mt.readPixels(e,t,r,o,n,i,s);var a=js(i),l=$s(s,a);Mt.readPixels(e,t,r,o,n,i,a,l)}else{var c=qs(i,n,r,o,s);c?Mt.readPixels(e,t,r,o,n,i,c):vr.recordError(1280)}},Ws=()=>{},Hs=(e,t,r,o)=>Mt.renderbufferStorage(e,t,r,o),Ns=(e,t,r,o,n)=>Mt.renderbufferStorageMultisample(e,t,r,o,n),Vs=()=>Mt.resumeTransformFeedback(),zs=(e,t)=>{Mt.sampleCoverage(e,!!t)},Gs=(e,t,r)=>{Mt.samplerParameterf(vr.samplers[e],t,r)},Xs=(e,t,r)=>{var o=M[r>>2];Mt.samplerParameterf(vr.samplers[e],t,o)},Ys=(e,t,r)=>{Mt.samplerParameteri(vr.samplers[e],t,r)},Ks=(e,t,r)=>{var o=A[r>>2];Mt.samplerParameteri(vr.samplers[e],t,o)},Qs=(e,t,r,o)=>Mt.scissor(e,t,r,o),Zs=(e,t,r,o,n)=>{vr.recordError(1280)},Js=(e,t,r,o)=>{var n=vr.getSource(e,t,r,o);if(vr.currentContext.version>=2&&n.includes("#version 100")){var i="";(n=(n=n.replace(/#extension GL_OES_standard_derivatives : enable/g,"")).replace(/#extension GL_EXT_shader_texture_lod : enable/g,"")).includes("gl_FragColor")&&(i+="out mediump vec4 GL_FragColor;\n",n=n.replace(/gl_FragColor/g,"GL_FragColor")),n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.includes("attribute")?(n=n.replace(/attribute/g,"in")).replace(/varying/g,"out"):n.replace(/varying/g,"in")).replace(/textureCubeLodEXT/g,"textureCubeLod")).replace(/texture2DLodEXT/g,"texture2DLod")).replace(/texture2DProjLodEXT/g,"texture2DProjLod")).replace(/texture2DGradEXT/g,"texture2DGrad")).replace(/texture2DProjGradEXT/g,"texture2DProjGrad")).replace(/textureCubeGradEXT/g,"textureCubeGrad")).replace(/textureCube/g,"texture")).replace(/texture1D/g,"texture")).replace(/texture2D/g,"texture")).replace(/texture3D/g,"texture")).replace(/#version 100/g,"#version 300 es\n"+i)}Mt.shaderSource(vr.shaders[e],n)},ea=(e,t,r)=>Mt.stencilFunc(e,t,r),ta=(e,t,r,o)=>Mt.stencilFuncSeparate(e,t,r,o),ra=e=>Mt.stencilMask(e),oa=(e,t)=>Mt.stencilMaskSeparate(e,t),na=(e,t,r)=>Mt.stencilOp(e,t,r),ia=(e,t,r,o)=>Mt.stencilOpSeparate(e,t,r,o),sa=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2&&(6402==s&&6402==r&&5125==a&&(r=33190),36193==a&&(a=5131,6408==s&&6408==r&&(r=34842)),34041==r&&(r=35056),6408==r&&5126==a&&(r=34836)),vr.currentContext.version>=2){if(Mt.currentPixelUnpackBufferBinding)return void Mt.texImage2D(e,t,r,o,n,i,s,a,l);if(l){var c=js(a),d=$s(l,c);return void Mt.texImage2D(e,t,r,o,n,i,s,a,c,d)}}var u=l?qs(a,s,o,n,l):null;Mt.texImage2D(e,t,r,o,n,i,s,a,u)},aa=(e,t,r,o,n,i,s,a,l,c)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texImage3D(e,t,r,o,n,i,s,a,l,c);else if(c){var d=js(l);Mt.texImage3D(e,t,r,o,n,i,s,a,l,d,$s(c,d))}else Mt.texImage3D(e,t,r,o,n,i,s,a,l,null)},la=(e,t,r)=>Mt.texParameterf(e,t,r),ca=(e,t,r)=>{var o=M[r>>2];Mt.texParameterf(e,t,o)},da=(e,t,r)=>Mt.texParameteri(e,t,r),ua=(e,t,r)=>{var o=A[r>>2];Mt.texParameteri(e,t,o)},ha=(e,t,r,o,n)=>Mt.texStorage2D(e,t,r,o,n),pa=(e,t,r,o,n,i)=>Mt.texStorage3D(e,t,r,o,n,i),fa=(e,t,r,o,n,i,s,a,l)=>{if(vr.currentContext.version>=2&&36193==a&&(a=5131),vr.currentContext.version>=2){if(Mt.currentPixelUnpackBufferBinding)return void Mt.texSubImage2D(e,t,r,o,n,i,s,a,l);if(l){var c=js(a);return void Mt.texSubImage2D(e,t,r,o,n,i,s,a,c,$s(l,c))}}var d=l?qs(a,s,n,i,l):null;Mt.texSubImage2D(e,t,r,o,n,i,s,a,d)},ga=(e,t,r,o,n,i,s,a,l,c,d)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,d);else if(d){var u=js(c);Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,u,$s(d,u))}else Mt.texSubImage3D(e,t,r,o,n,i,s,a,l,c,null)},ma=(e,t,r,o)=>{e=vr.programs[e];for(var n=[],i=0;i<t;i++)n.push(Q(A[r+4*i>>2]));Mt.transformFeedbackVaryings(e,n,o)},ba=(e,t)=>{Mt.uniform1f(Gi(e),t)},ya=[],va=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform1fv(Gi(e),M,r>>2,t);else{if(t<=288)for(var o=ya[t],n=0;n<t;++n)o[n]=M[r+4*n>>2];else o=M.subarray(r>>2,r+4*t>>2);Mt.uniform1fv(Gi(e),o)}},wa=(e,t)=>{Mt.uniform1i(Gi(e),t)},ka=[],_a=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform1iv(Gi(e),A,r>>2,t);else{if(t<=288)for(var o=ka[t],n=0;n<t;++n)o[n]=A[r+4*n>>2];else o=A.subarray(r>>2,r+4*t>>2);Mt.uniform1iv(Gi(e),o)}},Ca=(e,t)=>{Mt.uniform1ui(Gi(e),t)},Ea=(e,t,r)=>{t&&Mt.uniform1uiv(Gi(e),F,r>>2,t)},Sa=(e,t,r)=>{Mt.uniform2f(Gi(e),t,r)},xa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform2fv(Gi(e),M,r>>2,2*t);else{if(t<=144)for(var o=ya[t*=2],n=0;n<t;n+=2)o[n]=M[r+4*n>>2],o[n+1]=M[r+(4*n+4)>>2];else o=M.subarray(r>>2,r+8*t>>2);Mt.uniform2fv(Gi(e),o)}},Ta=(e,t,r)=>{Mt.uniform2i(Gi(e),t,r)},Pa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform2iv(Gi(e),A,r>>2,2*t);else{if(t<=144)for(var o=ka[t*=2],n=0;n<t;n+=2)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2];else o=A.subarray(r>>2,r+8*t>>2);Mt.uniform2iv(Gi(e),o)}},Aa=(e,t,r)=>{Mt.uniform2ui(Gi(e),t,r)},Fa=(e,t,r)=>{t&&Mt.uniform2uiv(Gi(e),F,r>>2,2*t)},Ma=(e,t,r,o)=>{Mt.uniform3f(Gi(e),t,r,o)},Ia=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform3fv(Gi(e),M,r>>2,3*t);else{if(t<=96)for(var o=ya[t*=3],n=0;n<t;n+=3)o[n]=M[r+4*n>>2],o[n+1]=M[r+(4*n+4)>>2],o[n+2]=M[r+(4*n+8)>>2];else o=M.subarray(r>>2,r+12*t>>2);Mt.uniform3fv(Gi(e),o)}},Ra=(e,t,r,o)=>{Mt.uniform3i(Gi(e),t,r,o)},La=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform3iv(Gi(e),A,r>>2,3*t);else{if(t<=96)for(var o=ka[t*=3],n=0;n<t;n+=3)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2],o[n+2]=A[r+(4*n+8)>>2];else o=A.subarray(r>>2,r+12*t>>2);Mt.uniform3iv(Gi(e),o)}},Da=(e,t,r,o)=>{Mt.uniform3ui(Gi(e),t,r,o)},Ba=(e,t,r)=>{t&&Mt.uniform3uiv(Gi(e),F,r>>2,3*t)},Oa=(e,t,r,o,n)=>{Mt.uniform4f(Gi(e),t,r,o,n)},ja=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4fv(Gi(e),M,r>>2,4*t);else{if(t<=72){var o=ya[4*t],n=M;r>>=2,t*=4;for(var i=0;i<t;i+=4){var s=r+i;o[i]=n[s],o[i+1]=n[s+1],o[i+2]=n[s+2],o[i+3]=n[s+3]}}else o=M.subarray(r>>2,r+16*t>>2);Mt.uniform4fv(Gi(e),o)}},$a=(e,t,r,o,n)=>{Mt.uniform4i(Gi(e),t,r,o,n)},qa=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4iv(Gi(e),A,r>>2,4*t);else{if(t<=72)for(var o=ka[t*=4],n=0;n<t;n+=4)o[n]=A[r+4*n>>2],o[n+1]=A[r+(4*n+4)>>2],o[n+2]=A[r+(4*n+8)>>2],o[n+3]=A[r+(4*n+12)>>2];else o=A.subarray(r>>2,r+16*t>>2);Mt.uniform4iv(Gi(e),o)}},Ua=(e,t,r,o,n)=>{Mt.uniform4ui(Gi(e),t,r,o,n)},Wa=(e,t,r)=>{t&&Mt.uniform4uiv(Gi(e),F,r>>2,4*t)},Ha=(e,t,r)=>{e=vr.programs[e],Mt.uniformBlockBinding(e,t,r)},Na=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix2fv(Gi(e),!!r,M,o>>2,4*t);else{if(t<=72)for(var n=ya[t*=4],i=0;i<t;i+=4)n[i]=M[o+4*i>>2],n[i+1]=M[o+(4*i+4)>>2],n[i+2]=M[o+(4*i+8)>>2],n[i+3]=M[o+(4*i+12)>>2];else n=M.subarray(o>>2,o+16*t>>2);Mt.uniformMatrix2fv(Gi(e),!!r,n)}},Va=(e,t,r,o)=>{t&&Mt.uniformMatrix2x3fv(Gi(e),!!r,M,o>>2,6*t)},za=(e,t,r,o)=>{t&&Mt.uniformMatrix2x4fv(Gi(e),!!r,M,o>>2,8*t)},Ga=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix3fv(Gi(e),!!r,M,o>>2,9*t);else{if(t<=32)for(var n=ya[t*=9],i=0;i<t;i+=9)n[i]=M[o+4*i>>2],n[i+1]=M[o+(4*i+4)>>2],n[i+2]=M[o+(4*i+8)>>2],n[i+3]=M[o+(4*i+12)>>2],n[i+4]=M[o+(4*i+16)>>2],n[i+5]=M[o+(4*i+20)>>2],n[i+6]=M[o+(4*i+24)>>2],n[i+7]=M[o+(4*i+28)>>2],n[i+8]=M[o+(4*i+32)>>2];else n=M.subarray(o>>2,o+36*t>>2);Mt.uniformMatrix3fv(Gi(e),!!r,n)}},Xa=(e,t,r,o)=>{t&&Mt.uniformMatrix3x2fv(Gi(e),!!r,M,o>>2,6*t)},Ya=(e,t,r,o)=>{t&&Mt.uniformMatrix3x4fv(Gi(e),!!r,M,o>>2,12*t)},Ka=(e,t,r,o)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix4fv(Gi(e),!!r,M,o>>2,16*t);else{if(t<=18){var n=ya[16*t],i=M;o>>=2,t*=16;for(var s=0;s<t;s+=16){var a=o+s;n[s]=i[a],n[s+1]=i[a+1],n[s+2]=i[a+2],n[s+3]=i[a+3],n[s+4]=i[a+4],n[s+5]=i[a+5],n[s+6]=i[a+6],n[s+7]=i[a+7],n[s+8]=i[a+8],n[s+9]=i[a+9],n[s+10]=i[a+10],n[s+11]=i[a+11],n[s+12]=i[a+12],n[s+13]=i[a+13],n[s+14]=i[a+14],n[s+15]=i[a+15]}}else n=M.subarray(o>>2,o+64*t>>2);Mt.uniformMatrix4fv(Gi(e),!!r,n)}},Qa=(e,t,r,o)=>{t&&Mt.uniformMatrix4x2fv(Gi(e),!!r,M,o>>2,8*t)},Za=(e,t,r,o)=>{t&&Mt.uniformMatrix4x3fv(Gi(e),!!r,M,o>>2,12*t)},Ja=e=>{e=vr.programs[e],Mt.useProgram(e),Mt.currentProgram=e},el=e=>{Mt.validateProgram(vr.programs[e])},tl=(e,t)=>Mt.vertexAttrib1f(e,t),rl=(e,t)=>{Mt.vertexAttrib1f(e,M[t>>2])},ol=(e,t,r)=>Mt.vertexAttrib2f(e,t,r),nl=(e,t)=>{Mt.vertexAttrib2f(e,M[t>>2],M[t+4>>2])},il=(e,t,r,o)=>Mt.vertexAttrib3f(e,t,r,o),sl=(e,t)=>{Mt.vertexAttrib3f(e,M[t>>2],M[t+4>>2],M[t+8>>2])},al=(e,t,r,o,n)=>Mt.vertexAttrib4f(e,t,r,o,n),ll=(e,t)=>{Mt.vertexAttrib4f(e,M[t>>2],M[t+4>>2],M[t+8>>2],M[t+12>>2])},cl=(e,t)=>{Mt.vertexAttribDivisor(e,t)},dl=cl,ul=cl,hl=cl,pl=cl,fl=cl,gl=(e,t,r,o,n)=>Mt.vertexAttribI4i(e,t,r,o,n),ml=(e,t)=>{Mt.vertexAttribI4i(e,A[t>>2],A[t+4>>2],A[t+8>>2],A[t+12>>2])},bl=(e,t,r,o,n)=>Mt.vertexAttribI4ui(e,t,r,o,n),yl=(e,t)=>{Mt.vertexAttribI4ui(e,F[t>>2],F[t+4>>2],F[t+8>>2],F[t+12>>2])},vl=(e,t,r,o,n)=>{Mt.vertexAttribIPointer(e,t,r,o,n)},wl=(e,t,r,o,n,i)=>{Mt.vertexAttribPointer(e,t,r,!!o,n,i)},kl=(e,t,r,o)=>Mt.viewport(e,t,r,o),_l=(e,t,r)=>{r=Number(r),Mt.waitSync(vr.syncs[e],t,r)},Cl=e=>{var t=(e-C.buffer.byteLength+65535)/65536|0;try{return C.grow(t),j(),1}catch(e){}},El=["default","low-power","high-performance"],Sl=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],xl=e=>{var t;return e=(t=e)>2?Q(t):t,Sl[e]||("undefined"!=typeof document?document.querySelector(e):null)},Tl=(e,t)=>{var r=t>>2,o=A[r+2],n={alpha:!!S[t+0],depth:!!S[t+1],stencil:!!S[t+2],antialias:!!S[t+3],premultipliedAlpha:!!S[t+4],preserveDrawingBuffer:!!S[t+5],powerPreference:El[o],failIfMajorPerformanceCaveat:!!S[t+12],majorVersion:A[r+4],minorVersion:A[r+5],enableExtensionsByDefault:S[t+24],explicitSwapControl:S[t+25],proxyContextToMainThread:A[r+7],renderViaOffscreenBackBuffer:S[t+32]},i=xl(e);return i?n.explicitSwapControl?0:vr.createContext(i,n):0},Pl={},Al=()=>{if(!Al.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:b||"./this.program"};for(var t in Pl)void 0===Pl[t]?delete e[t]:e[t]=Pl[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Al.strings=r}return Al.strings},Fl=(e,t,r,o)=>{for(var n=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Te.read(e,S,s,a,o);if(l<0)return-1;if(n+=l,l<a)break;void 0!==o&&(o+=l)}return n},Ml=e=>Jl(e),Il=e=>{var t=se(e)+1,r=Ml(t);return le(e,r,t),r},Rl=Te.createPath,Ll=Te.createLazyFile,Dl=Te.createDevice;Te.createPreloadedFile=Se,Te.staticInit(),l.FS_createPath=Te.createPath,l.FS_createDataFile=Te.createDataFile,l.FS_createPreloadedFile=Te.createPreloadedFile,l.FS_unlink=Te.unlink,l.FS_createLazyFile=Te.createLazyFile,l.FS_createDevice=Te.createDevice,_e.doesNotExistError=new Te.ErrnoError(44),_e.doesNotExistError.stack="<generic error, no stack>",(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Le=e})(),(()=>{let e=at.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof at))return!1;if(!(e instanceof at))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var o=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;o.baseClass;)n=o.upcast(n),o=o.baseClass;return t===o&&r===n},clone(){if(this.$$.ptr||Ye(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=it(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),Qe(this),Ze(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ye(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ve("Object already scheduled for deletion"),st.push(this),st.length,this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(mt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:Xe,readValueFromPointer:Re,fromWireType:nt}),Lt.push(0,1,void 0,1,null,1,!0,1,!1,1),l.count_emval_handles=Bt,l.requestFullscreen=br.requestFullscreen,l.setCanvasSize=br.setCanvasSize,l.getUserMedia=br.getUserMedia,l.createContext=br.createContext;for(let e=0;e<32;++e)Zo.push(new Array(e));for(var Bl=new Float32Array(288),Ol=0;Ol<=288;++Ol)ya[Ol]=Bl.subarray(0,Ol);var jl=new Int32Array(288);for(Ol=0;Ol<=288;++Ol)ka[Ol]=jl.subarray(0,Ol);var $l={2764928:(e,t,r,o,n)=>"undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext)?0:(void 0===window.miniaudio&&(window.miniaudio={referenceCount:0},window.miniaudio.device_type={},window.miniaudio.device_type.playback=e,window.miniaudio.device_type.capture=t,window.miniaudio.device_type.duplex=r,window.miniaudio.device_state={},window.miniaudio.device_state.stopped=o,window.miniaudio.device_state.started=n,miniaudio.devices=[],miniaudio.track_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(null==miniaudio.devices[t])return miniaudio.devices[t]=e,t;return miniaudio.devices.push(e),miniaudio.devices.length-1},miniaudio.untrack_device_by_index=function(e){for(miniaudio.devices[e]=null;miniaudio.devices.length>0&&null==miniaudio.devices[miniaudio.devices.length-1];)miniaudio.devices.pop()},miniaudio.untrack_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(miniaudio.devices[t]==e)return miniaudio.untrack_device_by_index(t)},miniaudio.get_device_by_index=function(e){return miniaudio.devices[e]},miniaudio.unlock_event_types=function(){return["touchstart","touchend","click"]}(),miniaudio.unlock=function(){for(var e=0;e<miniaudio.devices.length;++e){var t=miniaudio.devices[e];null!=t&&null!=t.webaudio&&2===t.state&&t.webaudio.resume()}miniaudio.unlock_event_types.map((function(e){document.removeEventListener(e,miniaudio.unlock,!0)}))},miniaudio.unlock_event_types.map((function(e){document.addEventListener(e,miniaudio.unlock,!0)}))),window.miniaudio.referenceCount+=1,1),2766918:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2767082:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2767186:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2767357:(e,t,r,o,n,i)=>{var s=e,a=t,c=r,d=o,u=n,h=i;if(void 0===window.miniaudio)return-1;var p={},f={};s==window.miniaudio.device_type.playback&&(f.sampleRate=c),p.webaudio=new(window.AudioContext||window.webkitAudioContext)(f),p.webaudio.suspend(),p.state=window.miniaudio.device_state.stopped;var g=0,m=a;return s!=window.miniaudio.device_type.playback&&(g=a),p.scriptNode=p.webaudio.createScriptProcessor(d,g,m),p.scriptNode.onaudioprocess=function(e){if(null!=p.intermediaryBufferView&&0!=p.intermediaryBufferView.length||(p.intermediaryBufferView=new Float32Array(l.HEAPF32.buffer,u,d*a)),s==miniaudio.device_type.capture||s==miniaudio.device_type.duplex){for(var t=0;t<a;t+=1)for(var r=e.inputBuffer.getChannelData(t),o=p.intermediaryBufferView,n=0;n<d;n+=1)o[n*a+t]=r[n];zl(h,d,u)}if(s==miniaudio.device_type.playback||s==miniaudio.device_type.duplex)for(Gl(h,d,u),t=0;t<e.outputBuffer.numberOfChannels;++t){var i=e.outputBuffer.getChannelData(t);for(o=p.intermediaryBufferView,n=0;n<d;n+=1)i[n]=o[n*a+t]}else for(t=0;t<e.outputBuffer.numberOfChannels;++t)e.outputBuffer.getChannelData(t).fill(0)},s!=miniaudio.device_type.capture&&s!=miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){p.streamNode=p.webaudio.createMediaStreamSource(e),p.streamNode.connect(p.scriptNode),p.scriptNode.connect(p.webaudio.destination)})).catch((function(e){console.log("Failed to get user media: "+e)})),s==miniaudio.device_type.playback&&p.scriptNode.connect(p.webaudio.destination),miniaudio.track_device(p)},2770140:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2770206:e=>{var t=miniaudio.get_device_by_index(e);void 0!==t.scriptNode&&(t.scriptNode.onaudioprocess=function(e){},t.scriptNode.disconnect(),t.scriptNode=void 0),void 0!==t.streamNode&&(t.streamNode.disconnect(),t.streamNode=void 0),t.webaudio.close(),t.webaudio=void 0},2770571:e=>{miniaudio.untrack_device_by_index(e)},2770614:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2770739:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2770865:()=>!!globalThis.ubq_browserTabHidden},ql={Ua:e=>{var t=new ExceptionInfo(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),de.push(t),rc(e),nc(e)},Hh:()=>{Kl(0,0);var e=de.pop();tc(e.excPtr),ue=0},n:()=>pe([]),qa:e=>pe([e]),k:(e,t,r)=>{throw new ExceptionInfo(e).init(t,r),ue=e},O:e=>{throw ue||(ue=e),ue},Gh:function(e,t){try{return e=Pe.getStr(e),Te.chmod(e,t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Fh:function(e,t){try{return Te.fchmod(e,t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},pa:function(e,t,r){Pe.varargs=r;try{var o=Pe.getStreamFromFD(e);switch(t){case 0:if((n=Ae())<0)return-28;for(;Te.streams[n];)n++;return Te.dupStream(o,n).fd;case 1:case 2:case 13:case 14:return 0;case 3:return o.flags;case 4:var n=Ae();return o.flags|=n,0;case 12:return n=Fe(),T[n+0>>1]=2,0}return-28}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Eh:function(e,t){try{return Pe.writeStat(t,Te.fstat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Dh:function(e,t,r){Pe.varargs=r;try{var o=Pe.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return o.tty?0:-59;case 21505:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var n=o.tty.ops.ioctl_tcgets(o),i=Fe();A[i>>2]=n.c_iflag||0,A[i+4>>2]=n.c_oflag||0,A[i+8>>2]=n.c_cflag||0,A[i+12>>2]=n.c_lflag||0;for(var s=0;s<32;s++)S[i+s+17]=n.c_cc[s]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){i=Fe();var a=A[i>>2],l=A[i+4>>2],c=A[i+8>>2],d=A[i+12>>2],u=[];for(s=0;s<32;s++)u.push(S[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,t,{c_iflag:a,c_oflag:l,c_cflag:c,c_lflag:d,c_cc:u})}return 0;case 21519:return o.tty?(i=Fe(),A[i>>2]=0,0):-59;case 21520:return o.tty?-28:-59;case 21531:return i=Fe(),Te.ioctl(o,t,i);case 21523:if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var h=o.tty.ops.ioctl_tiocgwinsz(o.tty);i=Fe(),T[i>>1]=h[0],T[i+2>>1]=h[1]}return 0;default:return-28}}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ch:function(e,t){try{return e=Pe.getStr(e),Pe.writeStat(t,Te.lstat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Bh:function(e,t,r,o){try{t=Pe.getStr(t);var n=256&o,i=4096&o;return o&=-6401,t=Pe.calculateAt(e,t,i),Pe.writeStat(r,n?Te.lstat(t):Te.stat(t))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ta:function(e,t,r,o){Pe.varargs=o;try{t=Pe.getStr(t),t=Pe.calculateAt(e,t);var n=o?Ae():0;return Te.open(t,r,n).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ah:function(e,t,r,o){try{return t=Pe.getStr(t),o=Pe.getStr(o),t=Pe.calculateAt(e,t),o=Pe.calculateAt(r,o),Te.rename(t,o),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},zh:function(e){try{return e=Pe.getStr(e),Te.rmdir(e),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},yh:function(e,t){try{return e=Pe.getStr(e),Pe.writeStat(t,Te.stat(e))}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},xh:function(e,t,r){try{return t=Pe.getStr(t),t=Pe.calculateAt(e,t),0===r?Te.unlink(t):512===r?Te.rmdir(t):V("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},nh:()=>V(""),Ra:e=>{var t=Me[e];delete Me[e];var r=t.elements,o=r.length,n=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,s=t.rawDestructor;qe([e],n,(e=>(r.forEach(((t,r)=>{var n=e[r],i=t.getter,s=t.getterContext,a=e[r+o],l=t.setter,c=t.setterContext;t.read=e=>n.fromWireType(i(s,e)),t.write=(e,t)=>{var r=[];l(c,e,a.toWireType(r,t)),Ie(r)}})),[{name:t.name,fromWireType:e=>{for(var t=new Array(o),n=0;n<o;++n)t[n]=r[n].read(e);return s(e),t},toWireType:(e,n)=>{if(o!==n.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${o}, actual=${n.length}`);for(var a=i(),l=0;l<o;++l)r[l].write(a,n[l]);return null!==e&&e.push(s,a),a},argPackAdvance:Xe,readValueFromPointer:Re,destructorFunction:s}])))},A:e=>{var t=Ue[e];delete Ue[e];var r=t.rawConstructor,o=t.rawDestructor,n=t.fields,i=n.map((e=>e.getterReturnType)).concat(n.map((e=>e.setterArgumentType)));qe([e],i,(e=>{var i={};return n.forEach(((t,r)=>{var o=t.fieldName,s=e[r],a=e[r].optional,l=t.getter,c=t.getterContext,d=e[r+n.length],u=t.setter,h=t.setterContext;i[o]={read:e=>s.fromWireType(l(c,e)),write:(e,t)=>{var r=[];u(h,e,d.toWireType(r,t)),Ie(r)},optional:a}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in i)t[r]=i[r].read(e);return o(e),t},toWireType:(e,t)=>{for(var n in i)if(!(n in t)&&!i[n].optional)throw new TypeError(`Missing field: "${n}"`);var s=r();for(n in i)i[n].write(s,t[n]);return null!==e&&e.push(o,s),s},argPackAdvance:Xe,readValueFromPointer:Re,destructorFunction:o}]}))},Qa:(e,t,r,o,n)=>{var i=-1!=(t=He(t)).indexOf("u");ze(e,{name:t,fromWireType:e=>e,toWireType:function(e,t){if("bigint"!=typeof t&&"number"!=typeof t)throw new TypeError(`Cannot convert "${We(t)}" to ${this.name}`);return"number"==typeof t&&(t=BigInt(t)),t},argPackAdvance:Xe,readValueFromPointer:Ge(t,r,!i),destructorFunction:null})},mh:(e,t,r,o)=>{ze(e,{name:t=He(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:o},argPackAdvance:Xe,readValueFromPointer:function(e){return this.fromWireType(x[e])},destructorFunction:null})},t:(e,t,r,o,n,i,s,a,l,c,d,u,h)=>{d=He(d),i=St(n,i),a&&=St(s,a),c&&=St(l,c),h=St(u,h);var p=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(d);dt(p,(function(){Pt(`Cannot construct ${d} due to unbound types`,[o])})),qe([e,t,r],o?[o]:[],(t=>{var r,n;t=t[0],n=o?(r=t.registeredClass).instancePrototype:at.prototype;var s=lt(d,(function(...e){if(Object.getPrototypeOf(this)!==l)throw new Ne("Use 'new' to construct "+d);if(void 0===u.constructor_body)throw new Ne(d+" has no accessible constructor");var t=u.constructor_body[e.length];if(void 0===t)throw new Ne(`Tried to invoke ctor of ${d} with invalid number of parameters (${e.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)})),l=Object.create(n,{constructor:{value:s}});s.prototype=l;var u=new ut(d,s,l,h,r,i,a,c);u.baseClass&&(u.baseClass.__derivedClasses??=[],u.baseClass.__derivedClasses.push(u));var f=new mt(d,u,!0,!1,!1),g=new mt(d+"*",u,!1,!1,!1),m=new mt(d+" const*",u,!1,!0,!1);return et[e]={pointerType:g,constPointerType:m},_t(p,s),[f,g,m]}))},v:(e,t,r,o,n,i)=>{var s=At(t,r);n=St(o,n),qe([],[e],(e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Ne(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Pt(`Cannot construct ${e.name} due to unbound types`,s)},qe([],s,(o=>(o.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,o,null,n,i),[]))),[]}))},c:(e,t,r,o,n,i,s,a,l,c)=>{var d=At(r,o);t=He(t),t=It(t),i=St(n,i),qe([],[e],(e=>{var o=`${(e=e[0]).name}.${t}`;function n(){Pt(`Cannot call ${o} due to unbound types`,d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(ct(l,t,o),l[t].overloadTable[r-2]=n),qe([],d,(n=>{var a=Ft(o,n,e,i,s);return void 0===l[t].overloadTable?(a.argCount=r-2,l[t]=a):l[t].overloadTable[r-2]=a,[]})),[]}))},lh:e=>ze(e,jt),ba:(e,t,r,o)=>{function n(){}t=He(t),n.values={},ze(e,{name:t,constructor:n,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:Xe,readValueFromPointer:$t(t,r,o),destructorFunction:null}),dt(t,n)},I:(e,t,r)=>{var o=qt(e,"enum");t=He(t);var n=o.constructor,i=Object.create(o.constructor.prototype,{value:{value:r},constructor:{value:lt(`${o.name}_${t}`,(function(){}))}});n.values[r]=i,n[t]=i},Pa:(e,t,r)=>{ze(e,{name:t=He(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Xe,readValueFromPointer:Ut(t,r),destructorFunction:null})},P:(e,t,r,o,n,i,s,a)=>{var l=At(t,r);e=He(e),e=It(e),n=St(o,n),dt(e,(function(){Pt(`Cannot call ${e} due to unbound types`,l)}),t-1),qe([],l,(r=>{var o=[r[0],null].concat(r.slice(1));return _t(e,Ft(e,o,null,n,i),t-1),[]}))},N:(e,t,r,o,n)=>{t=He(t),-1===n&&(n=4294967295);var i=e=>e;if(0===o){var s=32-8*r;i=e=>e<<s>>>s}var a=t.includes("unsigned");ze(e,{name:t,fromWireType:i,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:Xe,readValueFromPointer:Ge(t,r,0!==o),destructorFunction:null})},E:(e,t,r)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function n(e){var t=F[e>>2],r=F[e+4>>2];return new o(S.buffer,r,t)}ze(e,{name:r=He(r),fromWireType:n,argPackAdvance:Xe,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},U:(e,t)=>{ze(e,Wt)},kh:(e,t,r,o,n,i,s,a,l,c,d,u)=>{r=He(r),i=St(n,i),a=St(s,a),c=St(l,c),u=St(d,u),qe([e],[t],(e=>(e=e[0],[new mt(r,e.registeredClass,!1,!1,!0,e,o,i,a,c,u)])))},jh:(e,t)=>{t=He(t),ze(e,{name:t,fromWireType(e){for(var t,r=F[e>>2],o=e+4,n=o,i=0;i<=r;++i){var s=o+i;if(i==r||0==x[s]){var a=Q(n,s-n);void 0===t?t=a:(t+=String.fromCharCode(0),t+=a),n=s+1}}return Vl(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||Ve("Cannot pass non-string to std::string"),r=o?se(t):t.length;var n=Hl(4+r+1),i=n+4;return F[n>>2]=r,o?le(t,i,r+1):x.set(t,i),null!==e&&e.push(Vl,n),n},argPackAdvance:Xe,readValueFromPointer:Re,destructorFunction(e){Vl(e)}})},na:(e,t,r)=>{var o,n,i,s;r=He(r),2===t?(o=Nt,n=Vt,s=zt,i=e=>P[e>>1]):4===t&&(o=Gt,n=Xt,s=Yt,i=e=>F[e>>2]),ze(e,{name:r,fromWireType:e=>{for(var r,n=F[e>>2],s=e+4,a=0;a<=n;++a){var l=e+4+a*t;if(a==n||0==i(l)){var c=o(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Vl(e),r},toWireType:(e,o)=>{"string"!=typeof o&&Ve(`Cannot pass non-string to C++ string type ${r}`);var i=s(o),a=Hl(4+i+t);return F[a>>2]=i/t,n(o,a+4,i+t),null!==e&&e.push(Vl,a),a},argPackAdvance:Xe,readValueFromPointer:Re,destructorFunction(e){Vl(e)}})},Oa:(e,t,r,o,n,i)=>{Me[e]={name:He(t),rawConstructor:St(r,o),rawDestructor:St(n,i),elements:[]}},M:(e,t,r,o,n,i,s,a,l)=>{Me[e].elements.push({getterReturnType:t,getter:St(r,o),getterContext:n,setterArgumentType:i,setter:St(s,a),setterContext:l})},z:(e,t,r,o,n,i)=>{Ue[e]={name:He(t),rawConstructor:St(r,o),rawDestructor:St(n,i),fields:[]}},l:(e,t,r,o,n,i,s,a,l,c)=>{Ue[e].fields.push({fieldName:He(t),getterReturnType:r,getter:St(o,n),getterContext:i,setterArgumentType:s,setter:St(a,l),setterContext:c})},ih:(e,t)=>{ze(e,{isVoid:!0,name:t=He(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},hh:()=>{oe=!1,Kt=0},gh:()=>{throw 1/0},i:(e,t,r)=>(e=Ot.toValue(e),t=qt(t,"emval::as"),Qt(t,r,e)),u:(e,t,r,o)=>(e=Zt[e])(null,t=Ot.toValue(t),r,o),K:(e,t,r,o,n)=>(e=Zt[e])(t=Ot.toValue(t),t[r=er(r)],o,n),b:Dt,fh:(e,t)=>(e=Ot.toValue(e))==(t=Ot.toValue(t)),J:e=>0===e?Ot.toHandle(tr()):(e=er(e),Ot.toHandle(tr()[e])),q:(e,t,r)=>{var o=((e,t)=>{for(var r=new Array(e),o=0;o<e;++o)r[o]=qt(F[t+4*o>>2],"parameter "+o);return r})(e,t),n=o.shift();e--;var i,s,a=new Array(e),l=`methodCaller<(${o.map((e=>e.name)).join(", ")}) => ${n.name}>`;return i=lt(l,((t,i,s,l)=>{for(var c=0,d=0;d<e;++d)a[d]=o[d].readValueFromPointer(l+c),c+=o[d].argPackAdvance;var u=1===r?rr(i,a):i.apply(t,a);return Qt(n,s,u)})),s=Zt.length,Zt.push(i),s},g:(e,t)=>(e=Ot.toValue(e),t=Ot.toValue(t),Ot.toHandle(e[t])),d:e=>{e>9&&(Lt[e+1]+=1)},W:(e,t)=>(e=Ot.toValue(e))instanceof(t=Ot.toValue(t)),ma:e=>"number"==typeof(e=Ot.toValue(e)),H:e=>"string"==typeof(e=Ot.toValue(e)),Na:()=>Ot.toHandle([]),e:e=>Ot.toHandle(er(e)),x:()=>Ot.toHandle({}),h:e=>{var t=Ot.toValue(e);Ie(t),Dt(e)},j:(e,t,r)=>{e=Ot.toValue(e),t=Ot.toValue(t),r=Ot.toValue(r),e[t]=r},f:(e,t)=>{var r=(e=qt(e,"_emval_take_value")).readValueFromPointer(t);return Ot.toHandle(r)},eh:e=>{throw e=Ot.toValue(e)},dh:e=>(e=Ot.toValue(e),Ot.toHandle(typeof e)),ch:function(e,t){e=or(e);var r=new Date(1e3*e);A[t>>2]=r.getUTCSeconds(),A[t+4>>2]=r.getUTCMinutes(),A[t+8>>2]=r.getUTCHours(),A[t+12>>2]=r.getUTCDate(),A[t+16>>2]=r.getUTCMonth(),A[t+20>>2]=r.getUTCFullYear()-1900,A[t+24>>2]=r.getUTCDay();var o=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),n=(r.getTime()-o)/864e5|0;A[t+28>>2]=n},bh:function(e,t){e=or(e);var r=new Date(1e3*e);A[t>>2]=r.getSeconds(),A[t+4>>2]=r.getMinutes(),A[t+8>>2]=r.getHours(),A[t+12>>2]=r.getDate(),A[t+16>>2]=r.getMonth(),A[t+20>>2]=r.getFullYear()-1900,A[t+24>>2]=r.getDay();var o=0|sr(r);A[t+28>>2]=o,A[t+36>>2]=-60*r.getTimezoneOffset();var n=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=n.getTimezoneOffset(),a=0|(i!=s&&r.getTimezoneOffset()==Math.min(s,i));A[t+32>>2]=a},ah:function(e){var t=(()=>{var t=new Date(A[e+20>>2]+1900,A[e+16>>2],A[e+12>>2],A[e+8>>2],A[e+4>>2],A[e>>2],0),r=A[e+32>>2],o=t.getTimezoneOffset(),n=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=n.getTimezoneOffset(),a=Math.min(s,i);if(r<0)A[e+32>>2]=Number(i!=s&&a==o);else if(r>0!=(a==o)){var l=Math.max(s,i),c=r>0?a:l;t.setTime(t.getTime()+6e4*(c-o))}A[e+24>>2]=t.getDay();var d=0|sr(t);A[e+28>>2]=d,A[e>>2]=t.getSeconds(),A[e+4>>2]=t.getMinutes(),A[e+8>>2]=t.getHours(),A[e+12>>2]=t.getDate(),A[e+16>>2]=t.getMonth(),A[e+20>>2]=t.getYear();var u=t.getTime();return isNaN(u)?-1:u/1e3})();return BigInt(t)},$g:function(e,t,r,o,n,i,s){n=or(n);try{if(isNaN(n))return 61;var a=Pe.getStreamFromFD(o),l=Te.mmap(a,e,n,t,r),c=l.ptr;return A[i>>2]=l.allocated,F[s>>2]=c,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},_g:function(e,t,r,o,n,i){i=or(i);try{var s=Pe.getStreamFromFD(n);2&r&&Pe.doMsync(e,s,t,o,i)}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Zg:(e,t)=>{if(ar[e]&&(clearTimeout(ar[e].id),delete ar[e]),!t)return 0;var r=setTimeout((()=>{delete ar[e],pr((()=>Yl(e,fr())))}),t);return ar[e]={id:r,timeout_ms:t},0},Yg:(e,t,r,o)=>{var n=(new Date).getFullYear(),i=new Date(n,0,1),s=new Date(n,6,1),a=i.getTimezoneOffset(),l=s.getTimezoneOffset(),c=Math.max(a,l);F[e>>2]=60*c,A[t>>2]=Number(a!=l);var d=e=>{var t=e>=0?"-":"+",r=Math.abs(e);return`UTC${t}${String(Math.floor(r/60)).padStart(2,"0")}${String(r%60).padStart(2,"0")}`},u=d(a),h=d(l);l<a?(le(u,r,17),le(h,o,17)):(le(u,o,17),le(h,r,17))},Xg:function(e){var t=Q(e);localStorage.removeItem(t)},wh:function(e,t,r){if(t=or(t),!((o=e)>=0&&o<=3))return 28;var o,n;n=0===e?gr():fr();var i=Math.round(1e3*n*1e3);return I[r>>3]=BigInt(i),0},Ma:(e,t,r,o,n)=>yr.chooseConfig(e,t,r,o,n),La:(e,t,r,o)=>{if(62e3!=e)return yr.setErrorCode(12296),0;for(var n=1;;){var i=A[o>>2];if(12440!=i){if(12344==i)break;return yr.setErrorCode(12292),0}n=A[o+4>>2],o+=8}return n<2||n>3?(yr.setErrorCode(12293),0):(yr.contextAttributes.majorVersion=n-1,yr.contextAttributes.minorVersion=0,yr.context=vr.createContext(br.getCanvas(),yr.contextAttributes),0!=yr.context?(yr.setErrorCode(12288),vr.makeContextCurrent(yr.context),br.useWebGL=!0,br.moduleContextCreatedCallbacks.forEach((e=>e())),vr.makeContextCurrent(null),62004):(yr.setErrorCode(12297),0))},Wg:(e,t,r,o)=>62e3!=e?(yr.setErrorCode(12296),0):62002!=t?(yr.setErrorCode(12293),0):(yr.setErrorCode(12288),62006),Ka:(e,t)=>62e3!=e?(yr.setErrorCode(12296),0):62004!=t?(yr.setErrorCode(12294),0):(vr.deleteContext(yr.context),yr.setErrorCode(12288),yr.currentContext==t&&(yr.currentContext=0),1),la:(e,t)=>62e3!=e?(yr.setErrorCode(12296),0):62006!=t?(yr.setErrorCode(12301),1):(yr.currentReadSurface==t&&(yr.currentReadSurface=0),yr.currentDrawSurface==t&&(yr.currentDrawSurface=0),yr.setErrorCode(12288),1),T:(e,t,r,o)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(62002!=t)return yr.setErrorCode(12293),0;if(!o)return yr.setErrorCode(12300),0;switch(yr.setErrorCode(12288),r){case 12320:return A[o>>2]=yr.contextAttributes.alpha?32:24,1;case 12321:return A[o>>2]=yr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return A[o>>2]=8,1;case 12325:return A[o>>2]=yr.contextAttributes.depth?24:0,1;case 12326:return A[o>>2]=yr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return A[o>>2]=12344,1;case 12328:return A[o>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return A[o>>2]=0,1;case 12330:case 12332:return A[o>>2]=4096,1;case 12331:return A[o>>2]=16777216,1;case 12337:return A[o>>2]=yr.contextAttributes.antialias?4:0,1;case 12338:return A[o>>2]=yr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return A[o>>2]=4,1;case 12341:case 12342:case 12343:return A[o>>2]=-1,1;case 12348:return A[o>>2]=1,1;case 12351:return A[o>>2]=12430,1;default:return yr.setErrorCode(12292),0}},Vg:e=>(yr.setErrorCode(12288),0!=e&&1!=e?0:62e3),Ja:()=>yr.errorCode,Ug:(e,t,r)=>62e3!=e?(yr.setErrorCode(12296),0):(t&&(A[t>>2]=1),r&&(A[r>>2]=4),yr.defaultDisplayInitialized=!0,yr.setErrorCode(12288),1),aa:(e,t,r,o)=>62e3!=e?(yr.setErrorCode(12296),0):0!=o&&62004!=o?(yr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(yr.setErrorCode(12301),0):(vr.makeContextCurrent(o?yr.context:null),yr.currentContext=o,yr.currentDrawSurface=t,yr.currentReadSurface=r,yr.setErrorCode(12288),1),ka:(e,t)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(yr.setErrorCode(12288),yr.stringCache[t])return yr.stringCache[t];var r;switch(t){case 12371:r=ce("Emscripten");break;case 12372:r=ce("1.4 Emscripten EGL");break;case 12373:r=ce("");break;case 12429:r=ce("OpenGL_ES");break;default:return yr.setErrorCode(12300),0}return yr.stringCache[t]=r,r},Ia:(e,t)=>{if(yr.defaultDisplayInitialized)if(Mt){if(!Mt.isContextLost())return yr.setErrorCode(12288),1;yr.setErrorCode(12302)}else yr.setErrorCode(12290);else yr.setErrorCode(12289);return 0},Tg:e=>62e3!=e?(yr.setErrorCode(12296),0):(yr.currentContext=0,yr.currentReadSurface=0,yr.currentDrawSurface=0,yr.defaultDisplayInitialized=!1,yr.setErrorCode(12288),1),G:(e,t,r)=>kr(e,t,r),Sg:e=>{console.error(Q(e))},Rg:e=>{console.log(Q(e))},Qg:e=>{console.warn(Q(e))},Ha:gr,Pg:()=>{},Og:()=>2147483648,Ng:_r,Mg:Cr,Lg:Er,Kg:Sr,Jg:xr,Ig:Tr,Hg:Pr,Gg:Ar,Fg:Fr,Eg:Mr,Dg:Ir,Cg:Rr,Bg:Lr,Ag:Dr,zg:Or,yg:$r,xg:qr,wg:Ur,vg:Wr,ug:Hr,tg:Nr,sg:Vr,rg:zr,qg:Gr,pg:Xr,og:Yr,ng:Kr,mg:Qr,lg:Zr,kg:Jr,jg:eo,ig:to,hg:ro,Ga:oo,gg:no,fg:io,eg:so,dg:ao,cg:lo,bg:co,ag:uo,$f:ho,_f:po,Zf:fo,Yf:go,Xf:mo,Wf:bo,Vf:yo,Uf:vo,Tf:wo,Sf:ko,Rf:_o,Qf:Co,Pf:Eo,Of:So,Nf:xo,Mf:To,Lf:Po,Kf:Ao,Jf:Mo,If:Ro,Hf:Lo,Gf:Do,Ff:Bo,Ef:Oo,Df:jo,Cf:$o,Bf:qo,Af:Wo,zf:No,yf:zo,xf:Go,wf:Yo,vf:Qo,uf:en,tf:rn,sf:nn,rf:an,qf:cn,pf:un,of:pn,nf:fn,mf:mn,lf:yn,kf:vn,jf:wn,hf:kn,gf:_n,ff:Cn,ef:En,df:Sn,cf:xn,bf:Tn,af:Pn,$e:An,_e:Fn,Ze:Mn,Ye:In,Xe:Rn,We:Ln,Ve:Dn,Ue:Bn,Te:On,Se:jn,Re:$n,Qe:Un,Pe:Hn,Oe:Nn,Ne:zn,Me:Gn,Le:Xn,Ke:Yn,Je:Kn,Ie:Qn,He:Zn,Ge:ri,Fe:oi,Ee:ni,De:ii,Ce:si,Be:ai,Ae:li,ze:di,ye:ui,xe:hi,we:pi,ve:fi,ue:gi,te:mi,se:bi,re:vi,qe:ki,pe:Ci,oe:Ei,ne:xi,me:Ti,le:Pi,ke:Ai,je:Fi,ie:Mi,he:Ii,ge:Ri,fe:Li,ee:Di,Fa:Bi,de:Oi,ce:ji,be:$i,ae:qi,$d:Ui,_d:Wi,Zd:Hi,Yd:zi,Xd:Yi,Wd:Ki,Vd:Qi,Ud:es,Td:rs,Sd:os,Rd:ns,Qd:is,Pd:ss,Od:as,Nd:ls,Md:cs,Ld:ds,Kd:us,Jd:hs,Id:ps,Hd:fs,Gd:gs,Fd:ms,Ed:bs,Dd:ys,Cd:vs,Bd:ws,Ad:_s,zd:Es,yd:Ss,xd:xs,wd:Ts,vd:Ps,ud:As,td:Fs,sd:Ms,rd:Is,qd:Rs,pd:Ls,od:Ds,nd:Bs,md:Os,ld:Us,kd:Ws,jd:Hs,id:Ns,hd:Vs,gd:zs,fd:Gs,ed:Xs,dd:Ys,cd:Ks,bd:Qs,ad:Zs,$c:Js,_c:ea,Zc:ta,Yc:ra,Xc:oa,Wc:na,Vc:ia,Uc:sa,Tc:aa,Sc:la,Rc:ca,Qc:da,Pc:ua,Oc:ha,Nc:pa,Mc:fa,Lc:ga,Kc:ma,Jc:ba,Ic:va,Hc:wa,Gc:_a,Fc:Ca,Ec:Ea,Dc:Sa,Cc:xa,Bc:Ta,Ac:Pa,zc:Aa,yc:Fa,xc:Ma,wc:Ia,vc:Ra,uc:La,tc:Da,sc:Ba,rc:Oa,qc:ja,pc:$a,oc:qa,nc:Ua,mc:Wa,lc:Ha,kc:Na,jc:Va,ic:za,hc:Ga,gc:Xa,fc:Ya,ec:Ka,dc:Qa,cc:Za,bc:Ja,ac:el,$b:tl,_b:rl,Zb:ol,Yb:nl,Xb:il,Wb:sl,Vb:al,Ub:ll,Tb:dl,Sb:ul,Rb:hl,Qb:pl,Pb:fl,Ob:gl,Nb:ml,Mb:bl,Lb:yl,Kb:vl,Jb:wl,Ib:kl,Ea:_l,Hb:e=>{var t=x.length,r=2147483648;if((e>>>=0)>r)return!1;for(var o=1;o<=4;o*=2){var n=t*(1+.2/o);n=Math.min(n,e+100663296);var i=Math.min(r,we(Math.max(e,n),65536));if(Cl(i))return!0}return!1},Gb:function(e,t,r,o,n,i,s,a,c){const d=l.UTF8ToString(e,e+t),u=l.HEAPU8.subarray(n,n+i),h=l.emscripten_ubq_codec_audioDecoderNextHandle++,p={codec:d,sampleRate:r,numberOfChannels:o,description:u};try{const e=l.emscripten_ubq_codec_createAudioDecoder(s,a,c);AudioDecoder.isConfigSupported(p).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(p),l.emscripten_ubq_codec_audioDecoders.set(h,{audioDecoder:e,decoderConfig:p,leftBufferPtr:s,rightBufferPtr:a,bufferLength:c,opfsUri:""})}catch(e){return l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:h})},Fb:function(e,t,r,o,n,i){const s=l.UTF8ToString(e,e+t),a=l.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:s,sampleRate:r,numberOfChannels:o,bitrate:n};try{const e=new AudioEncoder({output:e=>{const t=l._malloc(e.byteLength),r=l.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),l.emscripten_ubq_codec_onOutputEncodedAudioChunk(a,t,e.byteLength,i),l._free(t)},error:e=>{l.emscripten_ubq_codec_audioEncoders.get(a).frameIndex>1&&console.error(e)}});e.configure(c),l.emscripten_ubq_codec_audioEncoders.set(a,{audioEncoder:e,audioEncoderConfig:c,frameIndex:0})}catch(e){return e+=' Requested codec: "'+s+'"',e+="; sample rate: "+r,e+="; channels: "+o,e+="; bit rate: "+n,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:a})},Eb:function(e,t,r,o,n,i,s,a){const c=l.UTF8ToString(e,e+t),d=l.HEAPU8.subarray(i,i+s),u=l.emscripten_ubq_codec_videoDecoderNextHandle++,h={codec:c,codedWidth:r,codedHeight:o,description:d,optimizeForLatency:!0};try{const e=l.emscripten_ubq_codec_createVideoDecoder(u,n,a);VideoDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(h),l.emscripten_ubq_codec_videoDecoders.set(u,{videoDecoder:e,decoderConfig:h,codecServicePtr:a,opfsUri:""})}catch(e){return l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:u})},Db:function(e,t,r,o,n,i,s){const a=l.UTF8ToString(e,e+t),c=l.emscripten_ubq_codec_videoEncoderNextHandle++,d=l.specialHTMLTargets["!canvas"];d.width=r,d.height=o;const u={codec:a,width:r,height:o,avc:{format:"annexb"},framerate:n};i>0&&(u.bitrate=i);try{const e=new VideoEncoder({output:e=>{const t=l._malloc(e.byteLength),r=l.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),l.emscripten_ubq_codec_onOutputEncodedVideoChunk(c,t,e.byteLength,s),l._free(t)},error:e=>console.error(e)});VideoEncoder.isConfigSupported(u).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(u),l.emscripten_ubq_codec_videoEncoders.set(c,{videoEncoder:e,encoderConfig:u,groupOfPictures:150,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; resolution: "+r+"x"+o,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:c})},Cb:function(e,t,r,o,n,i){const s=l.emscripten_ubq_codec_audioDecoders.get(e);if(s.audioDecoder.unexpectedError)return l.emscripten_ubq_codec_createNativeResult({code:2,error:s.audioDecoder.unexpectedError});"closed"===s.audioDecoder.state&&(s.audioDecoder=l.emscripten_ubq_codec_createAudioDecoder(s.leftBufferPtr,s.rightBufferPtr,s.bufferLength),s.audioDecoder.configure(s.decoderConfig));const a=s.audioDecoder,c=l.HEAPU8.subarray(n,n+i),d=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:o,data:c});try{a.decode(d)}catch(e){return a.configUnsupported?l.emscripten_ubq_codec_createNativeResult({code:2,error:e}):l.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return l.emscripten_ubq_codec_createNativeResult({code:0})},Bb:function(e,t,r,o,n,i){const s=l.emscripten_ubq_codec_videoDecoders.get(e);if(s.videoDecoder.unexpectedError)return l.emscripten_ubq_codec_createNativeResult({code:2,error:s.videoDecoder.unexpectedError});if("closed"===s.videoDecoder.state){const t=s.videoDecoder.textures;return s.videoDecoder=l.emscripten_ubq_codec_createVideoDecoder(e,s.isHdr,s.codecServicePtr),s.videoDecoder.textures=t,s.videoDecoder.configure(s.decoderConfig),l.emscripten_ubq_codec_createNativeResult({code:1,error:"VideoDecoder was closed"})}const a=s.videoDecoder,c=l.HEAPU8.subarray(n,n+i),d=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:o,data:c});try{a.decode(d)}catch(e){return a.configUnsupported?l.emscripten_ubq_codec_createNativeResult({code:2,error:e}):l.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return l.emscripten_ubq_codec_createNativeResult({code:0})},Da:function(e){if(l.emscripten_ubq_codec_audioDecoders.has(e)){const t=l.emscripten_ubq_codec_audioDecoders.get(e);if("closed"!==t.audioDecoder.state&&t.audioDecoder.close(),t.opfsUri&&""!==t.opfsUri){const e=l.emscripten_ubq_opfs_getCache(t.opfsUri);e&&e.worker&&(l.emscripten_ubq_opfs_destroyWorker(e.worker),e.worker=null,e.workerOpened=!1,e.workerOpening=null)}l.emscripten_ubq_codec_audioDecoders.delete(e)}},Ca:function(e){const t=l.emscripten_ubq_codec_audioEncoders.get(e);"closed"!==t.audioEncoder.state&&t.audioEncoder.close(),l.emscripten_ubq_codec_audioEncoders.delete(e)},Ba:function(e){if(l.emscripten_ubq_codec_videoDecoders.has(e)){const t=l.emscripten_ubq_codec_videoDecoders.get(e);if("closed"!==t.videoDecoder.state&&t.videoDecoder.close(),t.opfsUri&&""!==t.opfsUri){const e=l.emscripten_ubq_opfs_getCache(t.opfsUri);e&&e.worker&&(l.emscripten_ubq_opfs_destroyWorker(e.worker),e.worker=null,e.workerOpened=!1,e.workerOpening=null)}l.emscripten_ubq_codec_videoDecoders.delete(e)}},Aa:function(e){const t=l.emscripten_ubq_codec_videoEncoders.get(e);"closed"!==t.videoEncoder.state&&t.videoEncoder.close(),l.emscripten_ubq_codec_videoEncoders.delete(e)},Ab:function(e,t,r){const o=1e6,n=l.emscripten_ubq_codec_audioEncoders.get(e),i=n.audioEncoderConfig.sampleRate,s=n.audioEncoderConfig.numberOfChannels,a=r/s,c=Math.round(o*(n.frameIndex*a/i)),d=Math.round(o*(a/i)),u=l.HEAPF32.subarray(t/4,t/4+r),h=new AudioData({format:"f32",sampleRate:i,numberOfFrames:a,numberOfChannels:s,duration:d,timestamp:c,data:u});n.audioEncoder.encode(h),n.frameIndex++,h.close()},zb:function(e,t,r){const o=1e6,n=l.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(o*(n.frameIndex/n.encoderConfig.framerate)),s=n.frameIndex%n.groupOfPictures==0,a=Math.round(o/n.encoderConfig.framerate),c=l.specialHTMLTargets["!canvas"],d=new VideoFrame(c,{timestamp:i,duration:a});n.videoEncoder.encode(d,{keyFrame:s}),d.close(),n.frameIndex++},yb:async function(e,t){const r=l.emscripten_ubq_codec_audioEncoders.get(e);try{await r.audioEncoder.flush()}catch{if(r.frameIndex>1)throw new Error("AudioEncoder.flush() failed")}l.emscripten_ubq_codec_onFinalizedAudioEncoding(e,t)},xb:async function(e,t){const r=l.emscripten_ubq_codec_videoEncoders.get(e);await r.videoEncoder.flush(),l.emscripten_ubq_codec_onFinalizedVideoEncoding(e,t)},wb:async function(e,t){const r=l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder;r.flushing=!0;try{await r.flush()}catch{}r.flushing=!1,r.writtenFrames=t},S:async function(e,t,r){const o=l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;o.shouldDropFrames=r,o.flushing=!0;try{await o.flush()}catch{}o.flushing=!1,o.shouldDropFrames=!1,o.decodedFrames=t},za:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},$:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},_:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.writtenFrames},vb:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.flushing},ub:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.flushing},Z:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},tb:function(e,t,r,o,n,i,s){const a=l.emscripten_ubq_codec_videoDecoders.get(e),c=l.UTF8ToString(t,t+r),d=l.HEAPU8.subarray(i,i+s);a.videoDecoder.configure({codec:c,codedWidth:o,codedHeight:n,description:d})},sb:function(e,t){l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},rb:function(e,t,r){const o=l.emscripten_ubq_codec_videoDecoders.get(e),n=l.HEAPU32.subarray(t/4,t/4+r);o.videoDecoder.textures=[];for(let e=0;e<r;e++)o.videoDecoder.textures[e]=vr.textures[n[e]]},qb:async function(e,t,r,o,n,i,s,a,c,d){const u=l.UTF8ToString(e),h=l.emscripten_ubq_codec_audioDecoders.get(t);h&&(h.opfsUri=u);const p=l._malloc(a);try{const r=await l.emscripten_ubq_opfs_getChunkDataAsync(e,i,s,a,p);return r===a?(l.emscripten_ubq_codec_onAudioChunkLoaded(t,c,p,a,d),1):-1===r?(console.error(`[Codec] Error retrieving chunk data for ${u} at offset ${i}. OPFS loading failed.`),0):(console.warn(`[Codec] Incomplete data read for ${u} at offset ${i}. Expected ${a}, got ${r}`),0)}catch(e){return console.error(`[Codec] Error in submitChunkedData for ${u}:`,e),0}finally{l._free(p)}},pb:async function(e,t,r,o,n,i,s,a,c,d){const u=l.UTF8ToString(e),h=l.emscripten_ubq_codec_videoDecoders.get(t);h&&(h.opfsUri=u);const p=l._malloc(a);try{const r=await l.emscripten_ubq_opfs_getChunkDataAsync(e,i,s,a,p);return r===a?(l.emscripten_ubq_codec_onVideoChunkLoaded(t,c,p,a,d),1):-1===r?(console.error(`[Codec] Error retrieving chunk data for ${u} at offset ${i}. OPFS loading failed.`),0):(console.warn(`[Codec] Incomplete data read for ${u} at offset ${i}. Expected ${a}, got ${r}`),0)}catch(e){return console.error(`[Codec] Error in submitChunkedData for ${u}:`,e),0}finally{l._free(p)}},ob:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return!!(null==t?void 0:t.allocate())},ja:function(){l.emscripten_ubq_asyncFetchManager.clear()},ia:function(e,t,r,o){return l.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,o)},nb:function(e){l.emscripten_ubq_asyncFetchManager.deleteHeader(e)},mb:function(e,t,r,o,n,i,s,a,c){return l.emscripten_ubq_asyncFetchManager.fetch(e,t,r,o,n,i,s,a,c).handle},ha:function(e){return l.emscripten_ubq_asyncFetchManager.deleteProcess(e)},lb:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.receivedLength)&&void 0!==r?r:0},kb:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultAddress:-1},jb:function(e){const t=l.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultLength:-1},ga:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.state)&&void 0!==r?r:-1},ib:function(e){var t,r;return null!==(r=null===(t=l.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.totalBytes)&&void 0!==r?r:0},fa:function(e,t,r,o,n){const i=Q(e),s=4294967296*(r>>>0)+(t>>>0);if(o<=0)return 0;const a=l.emscripten_ubq_opfs_CHUNK_SIZE,c=l.emscripten_ubq_opfs_getCache(i),d=x.subarray(n,n+o);let u=0,h=s;const p=Math.min(s+o,c.fileSize);for(;h<p;){const e=Math.floor(h/a),t=c.chunkCache.get(e);if(!t)return-1;l.emscripten_ubq_opfs_updateAccess(c,e);const r=h-e*a,o=Math.min(t.byteLength-r,p-h);d.set(t.subarray(r,r+o),u),u+=o,h+=o}return u},hb:function(e){const t=Q(e),r=l.emscripten_ubq_opfs_getCache(t);return l.emscripten_ubq_opfs_ensureFile(t,r),BigInt(r.fileSize)},ea:function(e,t,r,o){const n=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(n),c=Math.floor(i/s),d=Math.floor((i+o)/s);for(let e=c;e<=d;++e){if(!a.chunkCache.has(e))return 0;l.emscripten_ubq_opfs_updateAccess(a,e)}return 1},da:function(e,t,r,o){const n=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(n),c=Math.floor(i/s),d=Math.floor((i+o-1)/s);let u=!0;for(let e=c;e<=d;++e)a.chunkCache.has(e)?l.emscripten_ubq_opfs_updateAccess(a,e):(u=!1,l.emscripten_ubq_opfs_loadChunk(n,a,e));return u?1:0},gb:function(){return!!l.emscripten_ubq_settings_forceWebGL1},ya:Tl,Y:e=>{vr.currentContext==e&&(vr.currentContext=0),vr.deleteContext(e)},fb:e=>(e=>{var t=e.getExtension("OES_vertex_array_object");if(t)return e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e),1})(vr.contexts[e].GLctx),eb:e=>(e=>{var t=e.getExtension("WEBGL_draw_buffers");if(t)return e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r),1})(vr.contexts[e].GLctx),db:e=>(e=>!!(e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")))(vr.contexts[e].GLctx),X:(e,t)=>{var r=vr.getContext(e),o=Q(t);return o.startsWith("GL_")&&(o=o.slice(3)),!!r.GLctx.getExtension(o)},cb:(e,t)=>{if(!t)return-5;if(!(e=vr.contexts[e]))return-3;var r=e.GLctx;if(!r)return-3;r=r.getContextAttributes(),S[t]=r.alpha,S[t+1]=r.depth,S[t+2]=r.stencil,S[t+3]=r.antialias,S[t+4]=r.premultipliedAlpha,S[t+5]=r.preserveDrawingBuffer;var o=r.powerPreference&&El.indexOf(r.powerPreference);return A[t+8>>2]=o,S[t+12]=r.failIfMajorPerformanceCaveat,A[t+16>>2]=e.version,A[t+20>>2]=0,0},bb:e=>vr.makeContextCurrent(e)?0:-5,vh:(e,t)=>{var r=0;return Al().forEach(((o,n)=>{var i=t+r;F[e+4*n>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)S[t++]=e.charCodeAt(r);S[t]=0})(o,i),r+=o.length+1})),0},uh:(e,t)=>{var r=Al();F[e>>2]=r.length;var o=0;return r.forEach((e=>o+=e.length+1)),F[t>>2]=o,0},xa:hr,oa:function(e){try{var t=Pe.getStreamFromFD(e);return Te.close(t),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},th:function(e,t){try{var r=Pe.getStreamFromFD(e),o=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t]=o,T[t+2>>1]=0,I[t+8>>3]=BigInt(0),I[t+16>>3]=BigInt(0),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},sh:function(e,t,r,o,n){o=or(o);try{if(isNaN(o))return 61;var i=Pe.getStreamFromFD(e),s=Fl(i,t,r,o);return F[n>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},Sa:function(e,t,r,o){try{var n=Pe.getStreamFromFD(e),i=Fl(n,t,r);return F[o>>2]=i,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},rh:function(e,t,r,o){t=or(t);try{if(isNaN(t))return 61;var n=Pe.getStreamFromFD(e);return Te.llseek(n,t,r),I[o>>3]=BigInt(n.position),n.getdents&&0===t&&0===r&&(n.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},qh:function(e,t,r,o){try{var n=((e,t,r,o)=>{for(var n=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Te.write(e,S,s,a,o);if(l<0)return-1;if(n+=l,l<a)break;void 0!==o&&(o+=l)}return n})(Pe.getStreamFromFD(e),t,r);return F[o>>2]=n,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},ab:function(e){var t=Q(e),r=localStorage.getItem(t);return null==r?null:ce(r)},$a:function(){return"undefined"!=typeof window?ce(window.location.hostname):ce("")},y:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},L:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},F:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},m:function(e,t,r,o){var n=ie();try{return Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},_a:function(e){var t=ie();try{return Et(e)()}catch(e){if(ne(t),e!==e+0)throw e;Kl(1,0)}},wa:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},r:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},V:function(e,t,r,o,n,i,s,a,l,c,d,u,h,p,f,g){var m=ie();try{return Et(e)(t,r,o,n,i,s,a,l,c,d,u,h,p,f,g)}catch(e){if(ne(m),e!==e+0)throw e;Kl(1,0)}},p:function(e,t,r){var o=ie();try{return Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},s:function(e,t,r,o){var n=ie();try{return Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},R:function(e,t,r,o,n){var i=ie();try{return Et(e)(t,r,o,n)}catch(e){if(ne(i),e!==e+0)throw e;Kl(1,0)}},Za:function(e,t,r,o,n,i){var s=ie();try{return Et(e)(t,r,o,n,i)}catch(e){if(ne(s),e!==e+0)throw e;Kl(1,0)}},va:function(e,t,r,o,n,i,s){var a=ie();try{return Et(e)(t,r,o,n,i,s)}catch(e){if(ne(a),e!==e+0)throw e;Kl(1,0)}},ua:function(e,t,r,o,n,i,s,a,l,c){var d=ie();try{return Et(e)(t,r,o,n,i,s,a,l,c)}catch(e){if(ne(d),e!==e+0)throw e;Kl(1,0)}},Q:function(e){var t=ie();try{Et(e)()}catch(e){if(ne(t),e!==e+0)throw e;Kl(1,0)}},w:function(e,t){var r=ie();try{Et(e)(t)}catch(e){if(ne(r),e!==e+0)throw e;Kl(1,0)}},C:function(e,t,r,o){var n=ie();try{Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},B:function(e,t,r){var o=ie();try{Et(e)(t,r)}catch(e){if(ne(o),e!==e+0)throw e;Kl(1,0)}},o:function(e,t,r,o){var n=ie();try{Et(e)(t,r,o)}catch(e){if(ne(n),e!==e+0)throw e;Kl(1,0)}},D:function(e,t,r,o,n){var i=ie();try{Et(e)(t,r,o,n)}catch(e){if(ne(i),e!==e+0)throw e;Kl(1,0)}},Ya:function(e,t,r,o,n,i){var s=ie();try{Et(e)(t,r,o,n,i)}catch(e){if(ne(s),e!==e+0)throw e;Kl(1,0)}},Xa:function(e,t,r,o,n,i,s){var a=ie();try{Et(e)(t,r,o,n,i,s)}catch(e){if(ne(a),e!==e+0)throw e;Kl(1,0)}},Wa:function(e,t,r,o,n,i,s,a){var l=ie();try{Et(e)(t,r,o,n,i,s,a)}catch(e){if(ne(l),e!==e+0)throw e;Kl(1,0)}},Va:function(e,t,r,o,n,i,s,a,l,c){var d=ie();try{Et(e)(t,r,o,n,i,s,a,l,c)}catch(e){if(ne(d),e!==e+0)throw e;Kl(1,0)}},ca:function(){return"undefined"!=typeof localStorage},ta:function(){return"undefined"!=typeof process&&process.versions&&process.versions.node?1:0},sa:function(e,t){const r=Ot.toValue(t),o=l.ctx;o.bindTexture(o.TEXTURE_2D,vr.textures[e]),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r)},a:C,ph:dr,oh:function(e,t){try{return ge(x.subarray(e,e+t)),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},ra:function(e,t){var r=Q(e),o=Q(t);localStorage.setItem(r,o)}},Ul=await async function(){function e(e,t){return Ul=e.exports,bt=Ul.Nh,N(),Ul}H();var t={a:ql};if(l.instantiateWasm)return new Promise(((r,o)=>{l.instantiateWasm(t,((t,o)=>{e(t),r(t.exports)}))}));q??=z();try{var r=await X(D,q,t);return e(r.instance)}catch(e){return o(e),Promise.reject(e)}}(),Wl=(Ul.Ih,Ul.Jh),Hl=l._malloc=Ul.Kh,Nl=l._main=Ul.Lh,Vl=l._free=Ul.Mh,zl=(l._ma_malloc_emscripten=Ul.Oh,l._ma_free_emscripten=Ul.Ph,l._ma_device_process_pcm_frames_capture__webaudio=Ul.Qh),Gl=l._ma_device_process_pcm_frames_playback__webaudio=Ul.Rh,Xl=Ul.Sh,Yl=Ul.Th,Kl=Ul.Uh,Ql=Ul.Vh,Zl=Ul.Wh,Jl=Ul.Xh,ec=Ul.Yh,tc=Ul.Zh,rc=Ul._h,oc=Ul.$h,nc=Ul.ai;if(l.addRunDependency=H,l.removeRunDependency=N,l.ccall=(e,t,r,o,n)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=Il(e)),t},array:e=>{var t,r,o=Ml(e.length);return t=e,r=o,S.set(t,r),o}},s=(e=>l["_"+e])(e),a=[],c=0;if(o)for(var d=0;d<o.length;d++){var u=i[r[d]];u?(0===c&&(c=ie()),a[d]=u(o[d])):a[d]=o[d]}var h,p=s(...a);return h=p,0!==c&&ne(c),p=function(e){return"string"===t?Q(e):"boolean"===t?Boolean(e):e}(h),p},l.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return S[e];case"i16":return T[e>>1];case"i32":return A[e>>2];case"i64":return I[e>>3];case"float":return M[e>>2];case"double":return L[e>>3];case"*":return F[e>>2];default:V(`invalid type for getValue: ${t}`)}},l.UTF8ToString=Q,l.specialHTMLTargets=Sl,l.FS_createPreloadedFile=Se,l.FS_unlink=e=>Te.unlink(e),l.FS_createPath=Rl,l.FS_createDevice=Dl,l.FS_createDataFile=Ce,l.FS_createLazyFile=Ll,l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return function e(r=m){function o(){l.calledRun=!0,B||(l.noFSInit||Te.initialized||Te.init(),ve.init(),Ul.Ih(),Te.ignorePermissions=!1,t(l),l.onRuntimeInitialized?.(),l.noInitialRun||function(e=[]){var t=Nl;e.unshift(b);var r=e.length,o=Ml(4*(r+1)),n=o;e.forEach((e=>{F[n>>2]=Il(e),n+=4})),F[n>>2]=0;try{var i=t(r,o);return ur(i,!0),i}catch(e){return lr(e)}}(r),function(){if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;)ee(l.postRun.shift());Z(J)}())}U>0?W=e:(function(){if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)re(l.preRun.shift());Z(te)}(),U>0?W=e:l.setStatus?(l.setStatus("Running..."),setTimeout((()=>{setTimeout((()=>l.setStatus("")),1),o()}),1)):o())}(),c});"object"==typeof e&&"object"==typeof t?(t.exports=o,t.exports.default=o):"function"==typeof define&&define.amd&&define([],(()=>o))}}),wt=u($()),kt=u(ht()),_t=u(pt()),Ct=class extends TypeError{constructor(e,t){let r;const{message:o,...n}=e,{path:i}=e;super(0===i.length?o:"At path: "+i.join(".")+" -- "+o),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>{var o;return null!=(o=r)?o:r=[e,...t()]}}};function Et(e){return"object"==typeof e&&null!=e}function St(e){return"string"==typeof e?JSON.stringify(e):""+e}function xt(e,t,r,o){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:n,branch:i}=t,{type:s}=r,{refinement:a,message:l="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+St(o)+"`"}=e;return{value:o,type:s,refinement:a,key:n[n.length-1],path:n,branch:i,...e,message:l}}function*Tt(e,t,r,o){var n;Et(n=e)&&"function"==typeof n[Symbol.iterator]||(e=[e]);for(const n of e){const e=xt(n,t,r,o);e&&(yield e)}}function*Pt(e,t,r={}){const{path:o=[],branch:n=[e],coerce:i=!1,mask:s=!1}=r,a={path:o,branch:n};if(i&&(e=t.coercer(e,a),s&&"type"!==t.type&&Et(t.schema)&&Et(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let l=!0;for(const r of t.validator(e,a))l=!1,yield[r,void 0];for(let[r,c,d]of t.entries(e,a)){const t=Pt(c,d,{path:void 0===r?o:[...o,r],branch:void 0===r?n:[...n,c],coerce:i,mask:s});for(const o of t)o[0]?(l=!1,yield[o[0],void 0]):i&&(c=o[1],void 0===r?e=c:e instanceof Map?e.set(r,c):e instanceof Set?e.add(c):Et(e)&&(e[r]=c))}if(l)for(const r of t.refiner(e,a))l=!1,yield[r,void 0];l&&(yield[void 0,e])}var At=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:r,validator:o,refiner:n,coercer:i=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=i,this.validator=o?(e,t)=>Tt(o(e,t),t,this,e):()=>[],this.refiner=n?(e,t)=>Tt(n(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const r=Ft(e,t);if(r[0])throw r[0]}(e,this)}create(e){return function(e,t){const r=Ft(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}(e,this)}is(e){return function(e,t){const r=Ft(e,t);return!r[0]}(e,this)}mask(e){return function(e,t){const r=Ft(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(e,this)}validate(e,t={}){return Ft(e,this,t)}};function Ft(e,t,r={}){const o=Pt(e,t,r),n=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(o);if(n[0]){return[new Ct(n[0],(function*(){for(const e of o)e[0]&&(yield e[0])})),void 0]}return[void 0,n[1]]}function Mt(e,t){return new At({type:e,schema:null,validator:t})}function It(e){return new At({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,o]of t.entries())yield[r,o,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+St(e)})}function Rt(){return Mt("boolean",(e=>"boolean"==typeof e))}function Lt(){return Mt("func",(e=>"function"==typeof e||"Expected a function, but received: "+St(e)))}function Dt(){return Mt("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+St(e)))}function Bt(){return Mt("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+St(e)))}function Ot(e){const t=e?Object.keys(e):[],r=Mt("never",(()=>!1));return new At({type:"object",schema:e||null,*entries(o){if(e&&Et(o)){const n=new Set(Object.keys(o));for(const r of t)n.delete(r),yield[r,o[r],e[r]];for(const e of n)yield[e,o[e],r]}},validator:e=>Et(e)||"Expected an object, but received: "+St(e),coercer:e=>Et(e)?{...e}:e})}function jt(e){return new At({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function $t(){return Mt("string",(e=>"string"==typeof e||"Expected a string, but received: "+St(e)))}function qt(e){const t=Object.keys(e);return new At({type:"type",schema:e,*entries(r){if(Et(r))for(const o of t)yield[o,r[o],e[o]]},validator:e=>Et(e)||"Expected an object, but received: "+St(e)})}function Ut(e){const t=e.map((e=>e.type)).join(" | ");return new At({type:"union",schema:null,coercer:(t,r)=>(e.find((e=>{const[r]=e.validate(t,{coerce:!0});return!r}))||Mt("unknown",(()=>!0))).coercer(t,r),validator(r,o){const n=[];for(const t of e){const[...e]=Pt(r,t,o),[i]=e;if(!i[0])return[];for(const[t]of e)t&&n.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+St(r),...n]}})}function Wt(e,t,r={}){const{exclusive:o}=r;return Vt(e,"max",(r=>o?r<t:r<=t||"Expected a "+e.type+" less than "+(o?"":"or equal to ")+t+" but received `"+r+"`"))}function Ht(e,t,r={}){const{exclusive:o}=r;return Vt(e,"min",(r=>o?r>t:r>=t||"Expected a "+e.type+" greater than "+(o?"":"or equal to ")+t+" but received `"+r+"`"))}function Nt(e){return Vt(e,"nonempty",(t=>{const r=function(e){return e instanceof Map||e instanceof Set?e.size:e.length}(t);return r>0||"Expected a nonempty "+e.type+" but received an empty one"}))}function Vt(e,t,r){return new At({...e,*refiner(o,n){yield*e.refiner(o,n);const i=Tt(r(o,n),n,e,o);for(const e of i)yield{...e,refinement:t}}})}var zt={Png:"image/png",Jpeg:"image/jpeg",WebP:"image/webp",Tga:"image/x-tga",Wav:"audio/wav",Mp4:"video/mp4",QuickTime:"video/quicktime",Binary:"application/octet-stream",Pdf:"application/pdf",Zip:"application/zip"};function Gt(e,t,r){const[o]=Ft(t,r);if(o)throw o.message=`Error in argument '${e}': ${o.message}`,o;return!0}function Xt(){const e=/image\/(png|jpeg|webp|x-tga)/;return Mt("ImageMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "image/png", "image/jpeg", "image/webp" or "image/x-tga", but got "${t}"`}))}function Yt(){const e=/audio\/(wav)/;return Mt("AudioMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected "audio/wav", but got "${t}"`}))}function Kt(){const e=/video\/(mp4|quicktime)/;return Mt("VideoMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "video/mp4" or "video/quicktime", but got "${t}"`}))}function Qt(){const e=/application\/(octet-stream|pdf)/;return Mt("ApplicationMimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "application/octet-stream" or "application/pdf", but got "${t}"`}))}function Zt(){const e=["Free","VerticalStack","HorizontalStack","DepthStack"];return Mt("SceneLayout",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function Jt(){const e=["Linear","EaseIn","EaseOut","EaseInOut","EaseInQuart","EaseOutQuart","EaseInOutQuart","EaseInQuint","EaseOutQuint","EaseInOutQuint","EaseInBack","EaseOutBack","EaseInOutBack","EaseInSpring","EaseOutSpring","EaseInOutSpring"];return Mt("AnimationEasing",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function er(){return Mt("AbortSignal",(e=>{if("undefined"!=typeof AbortSignal&&e instanceof AbortSignal)return!0;return!("object"!=typeof e||null===e||"boolean"!=typeof e.aborted||"function"!=typeof e.addEventListener)||{message:`expected an AbortSignal-like object, but got "${Object.prototype.toString.call(e)}"`}}))}function tr(){const e=["Absolute","Percent","Auto"];return Mt("SizeMode",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function rr(){const e=["Absolute","Percent","Auto"];return Mt("PositionMode",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function or(){const e=["slide","pan","fade","blur","grow","zoom","pop","wipe","baseline","crop_zoom","spin","spin_loop","fade_loop","blur_loop","pulsating_loop","breathing_loop","jump_loop","squeeze_loop","sway_loop","typewriter_text","block_swipe_text","spread_text","merge_text","ken_burns","//ly.img.ubq/animation/slide","//ly.img.ubq/animation/pan","//ly.img.ubq/animation/fade","//ly.img.ubq/animation/blur","//ly.img.ubq/animation/grow","//ly.img.ubq/animation/zoom","//ly.img.ubq/animation/pop","//ly.img.ubq/animation/wipe","//ly.img.ubq/animation/baseline","//ly.img.ubq/animation/crop_zoom","//ly.img.ubq/animation/spin","//ly.img.ubq/animation/spin_loop","//ly.img.ubq/animation/fade_loop","//ly.img.ubq/animation/blur_loop","//ly.img.ubq/animation/pulsating_loop","//ly.img.ubq/animation/breathing_loop","//ly.img.ubq/animation/jump_loop","//ly.img.ubq/animation/squeeze_loop","//ly.img.ubq/animation/sway_loop","//ly.img.ubq/animation/typewriter_text","//ly.img.ubq/animation/block_swipe_text","//ly.img.ubq/animation/spread_text","//ly.img.ubq/animation/merge_text","//ly.img.ubq/animation/ken_burns"];return Mt("AnimationType",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}function nr(){return Ut([qt({r:Bt(),g:Bt(),b:Bt(),a:Bt()}),qt({c:Bt(),m:Bt(),y:Bt(),k:Bt(),tint:Bt()}),qt({name:$t(),tint:Bt(),externalReference:$t()})])}function ir(){return qt({type:or(),duration:Bt(),easing:jt(Jt())})}function sr(e){if(e.isValid()){const t=e.value();return e.delete(),t}{const t=e.error(),r=t.publicMessage();throw t.delete(),e.delete(),new Error(r)}}function ar(e){return new Promise(((t,r)=>{e((e=>{try{const r=sr(e);t(r)}catch(e){r(e)}}))}))}var lr=(e,t=!0)=>{const r=[];for(let t=0;t<e.size();t+=1)r.push(e.get(t));return t&&e.delete(),r},cr=new WeakMap,dr={assets:[],total:0,currentPage:0,nextPage:void 0},AssetAPI=class{#e;constructor(e){this.#e=e}#t=new Set;#r=new Set;unstable_registerApplyAssetMiddleware(e){return this.#t.add(e),()=>{this.#t.delete(e)}}unstable_registerApplyAssetToBlockMiddleware(e){return this.#r.add(e),()=>{this.#r.delete(e)}}addSource(e){const t=e.getSupportedMimeTypes?.bind(e),r=e.getGroups?.bind(e),o=e.fetchAsset?.bind(e),n=e.applyAsset?.bind(e),i=e.applyAssetToBlock?.bind(e),s=e.applyAssetProperty?.bind(e),a=e.addAsset?.bind(e),l=e.removeAsset?.bind(e),c=e.credits,d=e.license;sr(this.#e.addAssetSource(e.id,(async(t,r)=>{try{const o={...t,sortKey:t.sortKey,sortingOrder:t.sortingOrder,sortActiveFirst:t.sortActiveFirst,tags:lr(t.tags),groups:lr(t.groups),excludeGroups:lr(t.excludeGroups)},n=await e.findAssets(o);if(n){const t={...n,assets:n.assets.map((t=>ur(t,e.id)))};r.invoke(t)}else r.invoke(dr)}catch(e){r.invoke(e.message??"Unknown error in user-defined `findAssets`")}}),o?async(t,r)=>{try{const n=await o(t);null===n?r.invoke(null):r.invoke(ur(n,e.id))}catch(e){r.invoke(e.message??"Unknown error in user-defined `fetchAsset`")}}:null,r?async e=>{try{const t=await r();e.invoke(t)}catch(t){e.invoke(t.message??"Unknown error in user-defined `getGroups`")}}:null,c?()=>({name:c.name,url:c.url??""}):null,d?()=>({name:d.name,url:d.url??""}):null,t?()=>t()??[]:null,n?async(e,t)=>{try{const r=await n(this.#o(e));t.invoke(r)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,i?async(e,t,r)=>{try{await i(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null,s?async(e,t,r)=>{try{await s(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetProperty`")}}:null,a?async e=>{a(e)}:null,l?async e=>{l(e)}:null)),this.#n(e.id,e)}addLocalSource(e,t,r,o){sr(this.#e.addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const o=await r(this.#o(e));t.invoke(o)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,o?async(e,t,r)=>{try{await o(this.#o(e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null))}addLocalAssetSourceFromJSONString(e,t){return Gt("contentJSON",e,$t()),Gt("basePath",t,jt($t())),new Promise(((r,o)=>{try{r(sr(this.#e.addLocalAssetSourceFromJSONString(e,t)))}catch(e){o(e)}}))}removeSource(e){sr(this.#e.removeAssetSource(e)),this.#i(e)}findAllSources(){return lr(this.#e.findAllAssetSources())}findAssets(e,t){return new Promise(((r,o)=>{let n=t?.tags??[];Array.isArray(n)||(n=[n]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:n,groups:t?.groups??[],excludeGroups:t?.excludeGroups??[],locale:t?.locale??"",sortingOrder:t?.sortingOrder??"None",sortKey:t?.sortKey??"",sortActiveFirst:t?.sortActiveFirst??!1};this.#e.findAssetSourceAssets(e,i,(e=>{try{const t=sr(e);r({...t,nextPage:-1===t.nextPage?void 0:t.nextPage})}catch(e){o(e)}}))}))}async fetchAsset(e,t){return Gt("sourceId",e,$t()),Gt("assetId",t,$t()),new Promise(((r,o)=>{this.#e.fetchAssetSourceAsset(e,t,(e=>{try{const t=sr(e);r(t||null)}catch(e){o(e)}}))}))}#o(e){const t={...e};return 0===t.groups?.length&&delete t.groups,t.locale||delete t.locale,t.label||delete t.label,0===t.tags?.length&&delete t.tags,t.credits?.name||t.credits?.url?t.credits.url||delete t.credits.url:delete t.credits,t.license?.name||t.license?.url?t.license.url||delete t.license.url:delete t.license,t.utm?.source||t.utm?.medium?(t.utm.source||delete t.utm.source,t.utm.medium||delete t.utm.medium):delete t.utm,t}async getGroups(e){return ar((t=>this.#e.getAssetSourceGroups(e,t))).then((e=>lr(e)))}getSupportedMimeTypes(e){return lr(sr(this.#e.getAssetSourceSupportedMimeTypes(e)))}getCredits(e){const t=sr(this.#e.getAssetSourceCredits(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}getLicense(e){const t=sr(this.#e.getAssetSourceLicense(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}canManageAssets(e){return!!cr.get(this.#e)?.get(e)?.canManageAssets}addAssetToSource(e,t){sr(this.#e.addAssetToSource(e,t))}removeAssetFromSource(e,t){sr(this.#e.removeAssetFromSource(e,t))}#n(e,t){cr.has(this.#e)||cr.set(this.#e,new Map),t.canManageAssets&&console.warn(`\nDEPRECATION WARNING:\n\n'canManageAssets' flag was found for asset source with the id '${e}'.\n\nThis flag is deprecated and will be removed in the next version. If you have used it to control if an upload buttons is rendered in the asset library, use the 'canAdd' options on an asset library entry. See documentation here: https://img.ly/docs/cesdk/ui/guides/customize-asset-library/`),cr.get(this.#e).set(e,{canManageAssets:t.canManageAssets})}#i(e){cr.get(this.#e)?.delete(e)}async apply(e,t){const r=(e,t)=>new Promise(((r,o)=>{this.#e.applyAssetSourceAsset(e,ur(t,e),(e=>{try{const t=sr(e);this.#e.isValid(t)?r(t):r(void 0)}catch(e){o(e)}}))}));if(this.#t.size>0){return Array.from(this.#t).reduce(((e,t)=>(r,o)=>t(r,o,e)),r)(e,t)}return r(e,t)}async applyToBlock(e,t,r){const o=(e,t,r)=>ar((o=>this.#e.applyAssetSourceAssetToBlock(e,ur(t,e),r,o)));if(this.#r.size>0){return Array.from(this.#r).reduce(((e,t)=>(r,o,n)=>t(r,o,n,e)),o)(e,t,r)}return o(e,t,r)}async applyProperty(e,t,r){return ar((o=>this.#e.applyAssetSourceProperty(e,ur(t,e),r,o)))}async defaultApplyAsset(e){return new Promise(((t,r)=>{this.#e.defaultApplyAsset(ur(e,""),(e=>{try{const r=sr(e);this.#e.isValid(r)?t(r):t(void 0)}catch(e){r(e)}}))}))}async defaultApplyAssetToBlock(e,t){return ar((r=>this.#e.defaultApplyAssetToBlock(ur(e,""),t,r)))}onAssetSourceAdded=e=>{const t=this.#e.subscribeToAssetSourceAdded(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};onAssetSourceRemoved=e=>{const t=this.#e.subscribeToAssetSourceRemoved(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};onAssetSourceUpdated=e=>{const t=this.#e.subscribeToAssetSourceUpdated(e);return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(t))}};assetSourceContentsChanged(e){sr(this.#e.assetSourceContentsChanged(e))}dispose(){cr.delete(this.#e)}};function ur(e,t){return"context"in e&&e.context.sourceId===t&&"active"in e?e:{...e,active:e.active??!1,context:{sourceId:t}}}var hr=Symbol("PROXY");function pr(e){return(t,r)=>{Object.defineProperty(t,hr,{value:{type:"getter",...e},writable:!1})}}function fr(e,t){Object.defineProperty(e,hr,{value:{type:"setter"},writable:!1})}var gr,mr,br,yr,vr,wr,kr,_r,Cr,Er,Sr,xr,Tr,Pr,Ar,Fr,Mr,Ir,Rr,Lr,Dr,Br,Or,jr,$r,qr,Ur,Wr,Hr,Nr,Vr={};function zr(e,t,r){return Object.hasOwnProperty.call(e,t)?()=>{e[t]=r}:()=>{delete e[t]}}jr=[fr],Or=[fr],Br=[fr],Dr=[fr],Lr=[fr],Rr=[fr],Ir=[fr],Mr=[pr({disabledInModes:["Playback"]})],Fr=[fr],Ar=[fr],Pr=[pr({disabledInModes:["Playback"]})],Tr=[fr],xr=[pr({disabledInModes:["Playback"]})],Sr=[pr({disabledInModes:["Playback"]})],Er=[pr({disabledInModes:["Playback"]})],Cr=[pr({disabledInModes:["Playback"]})],_r=[pr({disabledInModes:["Playback"]})],kr=[fr],wr=[pr({disabledInModes:["Playback"]})],vr=[fr],yr=[fr],br=[fr],mr=[pr({disabledInModes:["Playback"]})],gr=[fr];var Gr,Xr,Yr,Kr,Qr,Zr,Jr,eo,to,ro,oo,no,io,so,ao,lo,co,uo,ho,po,fo,go,mo,bo,yo,vo,wo,ko,_o,Co,Eo,So,xo,To,Po,Ao,Fo,Mo,Io,Ro,Lo,Do,Bo,Oo,jo,$o,qo,Uo,Wo,Ho,No,Vo,zo,Go,Xo,Yo,Ko,Qo,Zo,Jo,en,tn,rn,on,nn,sn,an,ln,cn,dn,un,hn,pn,fn,gn,mn,bn,yn,vn,wn,kn,_n,Cn,En,Sn,xn,Tn,Pn,An,Fn,Mn,In,Rn,Ln,Dn,Bn,On,jn,$n,qn,Un,Wn,Hn,Nn,Vn,zn,Gn,Xn,Yn,Kn,Qn,Zn,Jn,ei,ti,ri,oi,ni,ii,si,ai,li,ci,di,ui,hi,pi,fi,gi,mi,bi,yi,vi,wi,ki,_i,Ci,Ei,Si,xi,Ti,Pi,Ai,Fi,Mi,Ii,Ri,Li,Di,Bi,Oi,ji,$i,qi,Ui,Wi,Hi,Ni,Vi,zi,Gi,Xi,Yi,Ki,Qi,Zi,Ji,es,ts,rs,os,ns,is,ss,as,ls,cs,ds,us,hs,ps,fs,gs,ms,bs,ys,vs,ws,ks,_s,Cs,Es,Ss,xs,Ts,Ps,As,Fs,Ms,Is,Rs,Ls,Ds,Bs,Os,js,$s,qs,Us,Ws,Hs,Ns,Vs,zs,Gs,Xs,Ys,Ks,Qs,Zs,Js,ea,ta,ra,oa,na,ia,sa,aa,la,ca,da,ua,ha,pa,fa,ga,ma,ba,ya,va,wa,ka,_a,Ca,Ea,Sa,xa,Ta,Pa,Aa,Fa,Ma,Ia,Ra,La,Da,Ba,Oa,ja,$a,qa,Ua,Wa,Ha,Na,Va,za,Ga,Xa,Ya,Ka,Qa,Za,Ja,el,tl,rl,ol,nl,il,sl,al,ll,cl,dl,ul,hl,pl,fl,gl,ml,bl,yl,vl,wl,kl,_l,Cl,El,Sl,SceneAPI=class{constructor(e,t=!1){b(Ur,5,this),C(this,Wr),C(this,$r),C(this,qr),v(this,"onZoomLevelChanged",(e=>{const t=_(this,$r).subscribeToZoomLevel(e);return()=>{_(this,$r).isDeleted()||sr(_(this,$r).unsubscribe(t))}})),v(this,"onActiveChanged",(e=>{const t=_(this,$r).subscribeToActiveSceneChange(e);return()=>{_(this,$r).isDeleted()||sr(_(this,$r).unsubscribe(t))}})),E(this,$r,e),t||E(this,qr,new BlockAPI(e))}async loadFromString(e){return Gt("sceneContent",e,$t()),ar((t=>_(this,$r).loadSceneFromString(e,t)))}async loadFromURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).loadSceneFromURL(e,t)))}async loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).loadSceneFromArchiveURL(e,t)))}async saveToString(e=["blob","bundle","file","http","https","opfs"]){const t=this.get();if(null==t)throw new Error("No scene available.");return ar((r=>{_(this,$r).saveSceneToString(t,r,e)}))}async saveToArchive(){return new Promise(((e,t)=>{const r=this.get();null==r?t(new Error("No scene available.")):_(this,$r).saveSceneToArchive(r,(r=>{"error"in r?t(r.error):e(new Blob([r],{type:"application/zip"}))}))}))}create(e="Free",t){Gt("sceneLayout",e,Zt());const r=sr(_(this,$r).createScene(e));return t?(S(this,Wr,Hr).call(this,r,t),r):r}createVideo(e){const t=S(this,Wr,Nr).call(this);return e?(S(this,Wr,Hr).call(this,t,e),t):t}createFromImage(e,t=300,r=1,o="Free",n=0,i=!1){return Gt("url",e,$t()),Gt("dpi",t,Ht(Bt(),0)),Gt("pixelScaleFactor",r,Ht(Bt(),0)),Gt("sceneLayout",o,Zt()),ar((s=>_(this,$r).createSceneFromImage(e,t,r,o,n,i,s)))}createFromVideo(e){return Gt("url",e,$t()),ar((t=>_(this,$r).createSceneFromVideo(e,t)))}get(){const e=sr(_(this,$r).findByType("scene")),t=lr(e);return t.length>0?t[0]:null}async applyTemplateFromString(e){return Gt("content",e,$t()),ar((t=>_(this,$r).applyTemplateFromString(e,t)))}async applyTemplateFromURL(e){return Gt("url",e,$t()),ar((t=>_(this,$r).applyTemplateFromURL(e,t)))}getMode(){const e=this.get();return sr(_(this,$r).getSceneMode(e))}setDesignUnit(e){Gt("designUnit",e,function(){const e=["Pixel","Millimeter","Inch"];return Mt("DesignUnit",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}());const t=this.get();sr(_(this,$r).setDesignUnit(t,e))}getDesignUnit(){const e=this.get();return sr(_(this,$r).getDesignUnit(e))}getPages(){return lr(sr(_(this,$r).getPages()))}getCurrentPage(){const e=this.get();if(null==e)return null;const t=_(this,$r).getCurrentPage(e);return t.isValid()?sr(t):null}findNearestToViewPortCenterByType(e){Gt("type",e,$t());const t=this.get();if(null==t)return[];const r=sr(_(this,$r).findNearestToViewPortCenterByType(t,e));return lr(r)}findNearestToViewPortCenterByKind(e){Gt("kind",e,$t());const t=this.get();if(null==t)return[];const r=sr(_(this,$r).findNearestToViewPortCenterByKind(t,e));return lr(r)}setZoomLevel(e=1){const t=this.get();Gt("zoomLevel",e,Ht(Bt(),0)),_(this,$r).setZoomLevel(t,e)}getZoomLevel(){const e=this.get();return sr(_(this,$r).getZoomLevel(e))}async zoomToBlock(e,t,r,o,n){Gt("id",e,Dt());try{Gt("options",t,jt(Ot({padding:jt(Ut([Bt(),Ot({x:jt(Bt()),y:jt(Bt())}),Ot({top:jt(Bt()),bottom:jt(Bt()),left:jt(Bt()),right:jt(Bt())})])),animate:jt(Ut([Rt(),Ot({duration:jt(Ht(Bt(),0)),easing:jt(Jt()),interruptible:jt(Rt())})]))})))}catch(e){try{Gt("paddingLeft",t,jt(Bt())),Gt("paddingTop",r,jt(Bt())),Gt("paddingRight",o,jt(Bt())),Gt("paddingBottom",n,jt(Bt()))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.scene.zoomToBlock(id, paddingLeft, paddingTop, paddingRight, paddingBottom)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.scene.zoomToBlock(id, options)\n${e.message}`)}}const i="object"==typeof t?t:{padding:{left:t??0,top:r??0,right:o??0,bottom:n??0}},s={left:0,top:0,right:0,bottom:0};if(null!=i.padding&&("number"==typeof i.padding?(s.left=i.padding,s.top=i.padding,s.right=i.padding,s.bottom=i.padding):(("x"in i.padding||"y"in i.padding)&&(s.left=i.padding.x??s.left,s.right=i.padding.x??s.right,s.top=i.padding.y??s.top,s.bottom=i.padding.y??s.bottom),("left"in i.padding||"top"in i.padding||"right"in i.padding||"bottom"in i.padding)&&(s.left=i.padding.left??s.left,s.top=i.padding.top??s.top,s.right=i.padding.right??s.right,s.bottom=i.padding.bottom??s.bottom))),null!=i.animate){const t={duration:.5,easing:"EaseInOut",interruptible:!1};return"object"==typeof i.animate&&(t.duration=i.animate.duration??t.duration,t.easing=i.animate.easing??t.easing,t.interruptible=i.animate.interruptible??t.interruptible),new Promise((r=>{_(this,$r).zoomToBlockWithAnimation(e,s.left,s.top,s.right,s.bottom,t.duration,t.easing,t.interruptible,(()=>{r()}))}))}return ar((t=>_(this,$r).zoomToBlock(e,s.left,s.top,s.right,s.bottom,t)))}enableZoomAutoFit(e,t,r=0,o=0,n=0,i=0){return Gt("id",e,Dt()),Gt("axis",t,function(){const e=["Horizontal","Vertical","Both"];return Mt("ZoomAutoFitAxis",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),"Horizontal"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",o,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,0,o,0))):"Vertical"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",o,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,0,r,0,o))):(Gt("paddingLeft",r,Bt()),Gt("paddingTop",o,Bt()),Gt("paddingRight",n,Bt()),Gt("paddingBottom",i,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,o,n,i)))}disableZoomAutoFit(e){return Gt("blockOrScene",e,Dt()),sr(_(this,$r).disableZoomAutoFit(e))}isZoomAutoFitEnabled(e){return Gt("blockOrScene",e,Dt()),sr(_(this,$r).isZoomAutoFitEnabled(e))}unstable_enableCameraPositionClamping(e,t=0,r=0,o=0,n=0,i=0,s=0,a=0,l=0){return Gt("ids",e,It(Bt())),Gt("paddingLeft",t,Bt()),Gt("paddingTop",r,Bt()),Gt("paddingRight",o,Bt()),Gt("paddingBottom",n,Bt()),Gt("scaledPaddingLeft",t,Bt()),Gt("scaledPaddingTop",r,Bt()),Gt("scaledPaddingRight",o,Bt()),Gt("scaledPaddingBottom",n,Bt()),sr(_(this,$r).unstable_enableCameraPositionClamping(e,t,r,o,n,i,s,a,l))}unstable_disableCameraPositionClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_disableCameraPositionClamping(e))}unstable_isCameraPositionClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_isCameraPositionClampingEnabled(e))}unstable_enableCameraZoomClamping(e,t=-1,r=-1,o=0,n=0,i=0,s=0){return Gt("ids",e,It(Bt())),Gt("minZoomLimit",t,Bt()),Gt("maxZoomLimit",r,Bt()),Gt("paddingLeft",o,Bt()),Gt("paddingTop",n,Bt()),Gt("paddingRight",i,Bt()),Gt("paddingBottom",s,Bt()),sr(_(this,$r).unstable_enableCameraZoomClamping(e,t,r,o,n,i,s))}unstable_disableCameraZoomClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_disableCameraZoomClamping(e))}unstable_isCameraZoomClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return sr(_(this,$r).unstable_isCameraZoomClampingEnabled(e))}setPlaying(e){const t=this.getCurrentPage();if(null==t)throw new Error("No page to play");_(this,$r).setPlaying(t,e)}};function xl(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}function Tl(e){return"name"in e&&void 0!==e.name}function Pl(e){return"c"in e&&"m"in e&&"y"in e&&"k"in e&&void 0!==e.c&&void 0!==e.m&&void 0!==e.y&&void 0!==e.k}Ur=h(null),$r=new WeakMap,qr=new WeakMap,Wr=new WeakSet,Hr=function(e,t){if(!_(this,qr))throw new Error("Utility functions not allowed to be called inside utility functions.");let r=0,o=0;if("number"==typeof t.page.size)r=t.page.size,o=t.page.size;else{if("object"!=typeof t.page.size)return;r=t.page.size.width,o=t.page.size.height}const n=_(this,qr).create("page");if(_(this,qr).appendChild(e,n),_(this,qr).setSize(n,r,o),t.page.color){const e=_(this,qr).createFill("color");_(this,qr).setFill(n,e),_(this,qr).setColor(n,"fill/solid/color",t.page.color)}},Nr=function(){return sr(_(this,$r).createVideoScene())},y(Ur,1,"loadFromString",jr,SceneAPI),y(Ur,1,"loadFromURL",Or,SceneAPI),y(Ur,1,"loadFromArchiveURL",Br,SceneAPI),y(Ur,1,"create",Dr,SceneAPI),y(Ur,1,"createVideo",Lr,SceneAPI),y(Ur,1,"createFromImage",Rr,SceneAPI),y(Ur,1,"createFromVideo",Ir,SceneAPI),y(Ur,1,"get",Mr,SceneAPI),y(Ur,1,"applyTemplateFromString",Fr,SceneAPI),y(Ur,1,"applyTemplateFromURL",Ar,SceneAPI),y(Ur,1,"getMode",Pr,SceneAPI),y(Ur,1,"setDesignUnit",Tr,SceneAPI),y(Ur,1,"getDesignUnit",xr,SceneAPI),y(Ur,1,"getPages",Sr,SceneAPI),y(Ur,1,"getCurrentPage",Er,SceneAPI),y(Ur,1,"findNearestToViewPortCenterByType",Cr,SceneAPI),y(Ur,1,"findNearestToViewPortCenterByKind",_r,SceneAPI),y(Ur,1,"setZoomLevel",kr,SceneAPI),y(Ur,1,"getZoomLevel",wr,SceneAPI),y(Ur,1,"zoomToBlock",vr,SceneAPI),y(Ur,1,"enableZoomAutoFit",yr,SceneAPI),y(Ur,1,"disableZoomAutoFit",br,SceneAPI),y(Ur,1,"isZoomAutoFitEnabled",mr,SceneAPI),y(Ur,1,"setPlaying",gr,SceneAPI),m(Ur,SceneAPI),(e=>{let t;var r;(r=t=e.ColorSpace||(e.ColorSpace={}))[r.sRGB=0]="sRGB",r[r.CMYK=1]="CMYK",r[r.SpotColor=2]="SpotColor",e.toColor=function(e){switch(e.colorSpace){case 0:return{r:e.components.x,g:e.components.y,b:e.components.z,a:e.components.w};case 2:return{name:e.spotColorName,tint:e.tint,externalReference:e.externalReference};case 1:return{c:e.components.x,m:e.components.y,y:e.components.z,k:e.components.w,tint:e.tint};default:throw new Error("Unknown color space!")}},e.fromColor=function(e){if(xl(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(Pl(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(Tl(e))return{colorSpace:2,components:{x:0,y:0,z:0,w:0},spotColorName:e.name,tint:e.tint,externalReference:e.externalReference};throw new Error("Unknown color space!")}})(Gr||(Gr={})),wl=[fr],vl=[fr],yl=[fr],bl=[fr],ml=[fr],gl=[pr({disabledInModes:["Playback"]})],fl=[pr({disabledInModes:["Playback"]})],pl=[fr],hl=[fr],ul=[fr],dl=[pr({disabledInModes:["Playback"]})],cl=[pr({disabledInModes:["Playback"]})],ll=[pr({disabledInModes:["Playback"]})],al=[fr],sl=[fr],il=[fr],nl=[fr],ol=[pr({disabledInModes:["Playback"]})],rl=[fr],tl=[fr],el=[pr({disabledInModes:["Playback"]})],Ja=[pr({disabledInModes:["Playback"]})],Za=[pr({disabledInModes:["Playback"]})],Qa=[pr({disabledInModes:["Playback"]})],Ka=[pr({disabledInModes:["Playback"]})],Ya=[pr({disabledInModes:["Playback"]})],Xa=[pr({disabledInModes:["Playback"]})],Ga=[fr],za=[pr({disabledInModes:["Playback"]})],Va=[fr],Na=[pr({disabledInModes:["Playback"]})],Ha=[fr],Wa=[pr({disabledInModes:["Playback"]})],Ua=[fr],qa=[pr({disabledInModes:["Playback"]})],$a=[fr],ja=[pr({disabledInModes:["Playback"]})],Oa=[pr({disabledInModes:["Playback"]})],Ba=[pr({disabledInModes:["Playback"]})],Da=[pr({disabledInModes:["Playback"]})],La=[fr],Ra=[fr],Ia=[fr],Ma=[fr],Fa=[fr],Aa=[fr],Pa=[pr({disabledInModes:["Playback"]})],Ta=[pr({disabledInModes:["Playback"]})],xa=[fr],Sa=[fr],Ea=[fr],Ca=[fr],_a=[pr({disabledInModes:["Playback"]})],ka=[fr],wa=[pr({disabledInModes:["Playback"]})],va=[pr({disabledInModes:["Playback"]})],ya=[fr],ba=[fr],ma=[pr({disabledInModes:["Playback"]})],ga=[pr({disabledInModes:["Playback"]})],fa=[pr({disabledInModes:["Playback"]})],pa=[pr({disabledInModes:["Playback"]})],ha=[fr],ua=[fr],da=[fr],ca=[fr],la=[fr],aa=[fr],sa=[pr({disabledInModes:["Playback"]})],ia=[pr({disabledInModes:["Playback"]})],na=[pr({disabledInModes:["Playback"]})],oa=[pr({disabledInModes:["Playback"]})],ra=[fr],ta=[pr({disabledInModes:["Playback"]})],ea=[fr],Js=[fr],Zs=[pr({disabledInModes:["Playback"]})],Qs=[pr({disabledInModes:["Playback"]})],Ks=[pr({disabledInModes:["Playback"]})],Ys=[fr],Xs=[fr],Gs=[pr({disabledInModes:["Playback"]})],zs=[pr({disabledInModes:["Playback"]})],Vs=[pr({disabledInModes:["Playback"]})],Ns=[pr({disabledInModes:["Playback"]})],Hs=[pr({disabledInModes:["Playback"]})],Ws=[pr({disabledInModes:["Playback"]})],Us=[fr],qs=[fr],$s=[pr({disabledInModes:["Playback"]})],js=[fr],Os=[fr],Bs=[fr],Ds=[fr],Ls=[fr],Rs=[fr],Is=[pr({disabledInModes:["Playback"]})],Ms=[pr({disabledInModes:["Playback"]})],Fs=[pr({disabledInModes:["Playback"]})],As=[pr({disabledInModes:["Playback"]})],Ps=[pr({disabledInModes:["Playback"]})],Ts=[fr],xs=[pr({disabledInModes:["Playback"]})],Ss=[fr],Es=[pr({disabledInModes:["Playback"]})],Cs=[fr],_s=[pr({disabledInModes:["Playback"]})],ks=[fr],ws=[pr({disabledInModes:["Playback"]})],vs=[fr],ys=[pr({disabledInModes:["Playback"]})],bs=[fr],ms=[pr({disabledInModes:["Playback"]})],gs=[fr],fs=[pr({disabledInModes:["Playback"]})],ps=[fr],hs=[pr({disabledInModes:["Playback"]})],us=[pr({disabledInModes:["Playback"]})],ds=[fr],cs=[pr({disabledInModes:["Playback"]})],ls=[pr({disabledInModes:["Playback"]})],as=[fr],ss=[fr],is=[fr],ns=[fr],os=[pr({disabledInModes:["Playback"]})],rs=[fr],ts=[fr],es=[fr],Ji=[fr],Zi=[fr],Qi=[fr],Ki=[fr],Yi=[pr({disabledInModes:["Playback"]})],Xi=[pr({disabledInModes:["Playback"]})],Gi=[pr({disabledInModes:["Playback"]})],zi=[pr({disabledInModes:["Playback"]})],Vi=[pr({disabledInModes:["Playback"]})],Ni=[pr({disabledInModes:["Playback"]})],Hi=[fr],Wi=[fr],Ui=[fr],qi=[fr],$i=[pr({disabledInModes:["Playback"]})],ji=[fr],Oi=[pr({disabledInModes:["Playback"]})],Bi=[pr({disabledInModes:["Playback"]})],Di=[fr],Li=[fr],Ri=[pr({disabledInModes:["Playback"]})],Ii=[fr],Mi=[pr({disabledInModes:["Playback"]})],Fi=[fr],Ai=[pr()],Pi=[fr],Ti=[fr],xi=[fr],Si=[fr],Ei=[pr({disabledInModes:["Playback"]})],Ci=[fr],_i=[fr],ki=[pr({disabledInModes:["Playback"]})],wi=[fr],vi=[pr({disabledInModes:["Playback"]})],yi=[fr],bi=[pr({disabledInModes:["Playback"]})],mi=[fr],gi=[pr({disabledInModes:["Playback"]})],fi=[fr],pi=[pr({disabledInModes:["Playback"]})],hi=[fr],ui=[fr],di=[pr({disabledInModes:["Playback"]})],ci=[pr({disabledInModes:["Playback"]})],li=[fr],ai=[pr({disabledInModes:["Playback"]})],si=[fr],ii=[pr({disabledInModes:["Playback"]})],ni=[fr],oi=[pr({disabledInModes:["Playback"]})],ri=[fr],ti=[pr({disabledInModes:["Playback"]})],ei=[fr],Jn=[pr({disabledInModes:["Playback"]})],Zn=[fr],Qn=[fr],Kn=[pr({disabledInModes:["Playback"]})],Yn=[pr({disabledInModes:["Playback"]})],Xn=[fr],Gn=[pr({disabledInModes:["Playback"]})],zn=[fr],Vn=[pr({disabledInModes:["Playback"]})],Nn=[fr],Hn=[pr({disabledInModes:["Playback"]})],Wn=[fr],Un=[pr({disabledInModes:["Playback"]})],qn=[fr],$n=[pr({disabledInModes:["Playback"]})],jn=[fr],On=[fr],Bn=[fr],Dn=[fr],Ln=[fr],Rn=[fr],In=[pr({disabledInModes:["Playback"]})],Mn=[fr],Fn=[pr({disabledInModes:["Playback"]})],An=[fr],Pn=[pr({disabledInModes:["Playback"]})],Tn=[fr],xn=[pr({disabledInModes:["Playback"]})],Sn=[pr({disabledInModes:["Playback"]})],En=[fr],Cn=[pr({disabledInModes:["Playback"]})],_n=[pr({disabledInModes:["Playback"]})],kn=[fr],wn=[fr],vn=[fr],yn=[fr],bn=[pr({disabledInModes:["Playback"]})],mn=[pr({disabledInModes:["Playback"]})],gn=[pr({disabledInModes:["Playback"]})],fn=[pr({disabledInModes:["Playback"]})],pn=[pr({disabledInModes:["Playback"]})],hn=[pr({disabledInModes:["Playback"]})],un=[pr({disabledInModes:["Playback"]})],dn=[fr],cn=[pr({disabledInModes:["Playback"]})],ln=[fr],an=[fr],sn=[pr({disabledInModes:["Playback"]})],nn=[fr],on=[pr({disabledInModes:["Playback"]})],rn=[fr],tn=[pr({disabledInModes:["Playback"]})],en=[fr],Jo=[pr({disabledInModes:["Playback"]})],Zo=[fr],Qo=[pr({disabledInModes:["Playback"]})],Ko=[fr],Yo=[pr({disabledInModes:["Playback"]})],Xo=[pr({disabledInModes:["Playback"]})],Go=[fr],zo=[fr],Vo=[pr({disabledInModes:["Playback"]})],No=[pr({disabledInModes:["Playback"]})],Ho=[fr],Wo=[pr({disabledInModes:["Playback"]})],Uo=[fr],qo=[pr({disabledInModes:["Playback"]})],$o=[fr],jo=[fr],Oo=[pr({disabledInModes:["Playback"]})],Bo=[fr],Do=[pr({disabledInModes:["Playback"]})],Lo=[fr],Ro=[pr({disabledInModes:["Playback"]})],Io=[pr({disabledInModes:["Playback"]})],Mo=[fr],Fo=[pr()],Ao=[fr],Po=[pr()],To=[pr({disabledInModes:["Playback"]})],xo=[fr],So=[pr({disabledInModes:["Playback"]})],Eo=[fr],Co=[pr()],_o=[fr],ko=[pr({disabledInModes:["Playback"]})],wo=[fr],vo=[pr({disabledInModes:["Playback"]})],yo=[fr],bo=[pr({disabledInModes:["Playback"]})],mo=[pr({disabledInModes:["Playback"]})],go=[pr({disabledInModes:["Playback"]})],fo=[pr({disabledInModes:["Playback"]})],po=[pr({disabledInModes:["Playback"]})],ho=[pr({disabledInModes:["Playback"]})],uo=[pr({disabledInModes:["Playback"]})],co=[fr],lo=[fr],ao=[fr],so=[fr],io=[pr({disabledInModes:["Playback"]})],no=[pr({disabledInModes:["Playback"]})],oo=[pr({disabledInModes:["Playback"]})],ro=[fr],to=[pr({disabledInModes:["Playback"]})],eo=[fr],Jr=[fr],Zr=[fr],Qr=[fr],Kr=[pr({disabledInModes:["Playback"]})],Yr=[pr({disabledInModes:["Playback"]})],Xr=[fr];var BlockAPI=class{constructor(e){b(Cl,5,this),C(this,El),C(this,kl),C(this,_l),v(this,"onSelectionChanged",(e=>{const t=_(this,kl).subscribeToSelectionChange(e);return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(t))}})),v(this,"onClicked",(e=>{const t=_(this,kl).subscribeToBlockClicked(e);return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(t))}})),v(this,"onStateChanged",((e,t)=>{Gt("ids",e,It(Dt()));const r=_(this,kl).subscribeToBlockState(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{_(this,kl).isDeleted()||sr(_(this,kl).unsubscribe(r))}})),E(this,kl,e),E(this,_l,new SceneAPI(e,!0))}async export(e,t,r){Gt("handle",e,Bt());try{Gt("options",t,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",t,jt(Ut([Xt(),Qt()]))),Gt("options",r,jt(Ot({pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.export(handle, mimeType, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const o="object"==typeof t?t:{mimeType:t,...r},n=o.mimeType??"image/png",i=null!=o.targetWidth&&null!=o.targetHeight,s=o.jpegQuality??.9,a=o.webpQuality??1,l=o.pngCompressionLevel??5;return new Promise(((t,r)=>{o.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,kl).exportToBuffer(e,n,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:n}))}),{pngCompressionLevel:l,jpegQuality:s,webpQuality:a,useTargetSize:i,targetWidth:o.targetWidth??0,targetHeight:o.targetHeight??0,exportPdfWithHighCompatibility:o.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:o.exportPdfWithUnderlayer??!1,underlayerSpotColorName:o.underlayerSpotColorName??"",underlayerOffset:o.underlayerOffset??0})}))}async exportWithColorMask(e,t,r,o,n,i){Gt("handle",e,Bt());try{Gt("maskColorR",t,Bt()),Gt("maskColorG",r,Bt()),Gt("maskColorB",o,Bt()),Gt("options",i,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",t,jt(Ut([Xt(),Qt()]))),Gt("maskColorR",r,Bt()),Gt("maskColorG",o,Bt()),Gt("maskColorB",n,Bt()),Gt("options",i,jt(Ot({pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportWithColorMask(handle, mimeType, maskColorR, maskColorG, maskColorB, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.exportWithColorMask(handle, maskColorR, maskColorG, maskColorB, options)\n${e.message}`)}}let s,a,l,c;"number"==typeof t?(s=t,a=r,l=o,c=n??{}):(s=r,a=o,l=n,c={mimeType:t,...i});const d=c.mimeType??"image/png",u=null!=c.targetWidth&&null!=c.targetHeight,h=c.jpegQuality??.9,p=c.webpQuality??1,f=c.pngCompressionLevel??5;return new Promise(((t,r)=>{c.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,kl).exportWithColorMaskToBuffer(e,d,s,a,l,((e,o)=>{if("error"in e)r(e.error);else if("error"in o)r(o.error);else{const r=new Blob([e],{type:d}),n=new Blob([o],{type:d});t([r,n])}}),{pngCompressionLevel:f,jpegQuality:h,webpQuality:p,useTargetSize:u,targetWidth:c.targetWidth??0,targetHeight:c.targetHeight??0,exportPdfWithHighCompatibility:c.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:c.exportPdfWithUnderlayer??!1,underlayerSpotColorName:c.underlayerSpotColorName??"",underlayerOffset:c.underlayerOffset??0})}))}async exportVideo(e,t,r,o){throw new Error("Method not implemented. An implementation is available on the BlockAPI at engine.block or cesdk.engine.block")}async unstable_exportAudio(e,t={}){return Gt("handle",e,Bt()),Gt("options",t,Ot({mimeType:jt(Yt()),onProgress:jt(Lt()),timeOffset:jt(Bt()),duration:jt(Bt()),sampleRate:jt(Bt()),numberOfChannels:jt(Bt())})),new Promise(((r,o)=>{_(this,kl).unstable_exportAudioToBuffer(e,t.timeOffset??0,t.duration??0,t.mimeType??"audio/wav",t.onProgress??(()=>{}),(e=>{"error"in e?o(e.error):r(new Blob([e],{type:t.mimeType??"audio/wav"}))}),{sampleRate:t.sampleRate??48e3,numberOfChannels:t.numberOfChannels??2})}))}async loadFromString(e){return Gt("content",e,$t()),ar((t=>_(this,kl).loadBlocksFromString(e,t))).then((e=>lr(e)))}loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,kl).loadBlocksFromArchiveURL(e,t))).then((e=>lr(e)))}async saveToString(e,t=["buffer","http","https"]){return Gt("blocks",e,It(Bt())),ar((r=>_(this,kl).saveBlocksToString(e,r,t)))}async saveToArchive(e){return Gt("blocks",e,It(Bt())),new Promise(((t,r)=>{_(this,kl).saveBlocksToArchive(e,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:"application/zip"}))}))}))}create(e){return Gt("type",e,$t()),sr(_(this,kl).create(e))}createFill(e){return Gt("type",e,$t()),sr(_(this,kl).createFill(e))}async createCaptionsFromURI(e){return Gt("uri",e,$t()),ar((t=>_(this,kl).createCaptionsFromURI(e,t))).then((e=>lr(e)))}getType(e){return Gt("id",e,Dt()),sr(_(this,kl).getType(e))}getKind(e){return Gt("id",e,Dt()),sr(_(this,kl).getKind(e))}setKind(e,t){Gt("id",e,Dt()),sr(_(this,kl).setKind(e,t))}select(e){return Gt("id",e,Dt()),sr(_(this,kl).select(e))}setSelected(e,t){return Gt("id",e,Dt()),Gt("selected",t,Rt()),sr(_(this,kl).setSelected(e,t))}isSelected(e){return Gt("id",e,Dt()),sr(_(this,kl).isSelected(e))}findAllSelected(){return lr(_(this,kl).findAllSelected())}isGroupable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isGroupable(e))}group(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,kl).group(e))}ungroup(e){return Gt("id",e,Bt()),sr(_(this,kl).ungroup(e))}enterGroup(e){return Gt("id",e,Bt()),sr(_(this,kl).enterGroup(e))}exitGroup(e){return Gt("id",e,Bt()),sr(_(this,kl).exitGroup(e))}isCombinable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isCombinable(e))}combine(e,t){return Gt("ids",e,It(Bt())),Gt("op",t,$t()),sr(_(this,kl).combine(e,t))}setName(e,t){return Gt("id",e,Dt()),Gt("name",t,$t()),sr(_(this,kl).setName(e,t))}getName(e){return Gt("id",e,Dt()),sr(_(this,kl).getName(e))}getUUID(e){return Gt("id",e,Dt()),sr(_(this,kl).getUUID(e))}findByName(e){Gt("name",e,$t());const t=_(this,kl).findByName(e);return lr(t)}findByType(e){Gt("type",e,$t());const t=sr(_(this,kl).findByType(e));return lr(t)}findByKind(e){Gt("kind",e,$t());const t=sr(_(this,kl).findByKind(e));return lr(t)}findAll(){return lr(_(this,kl).findAll())}findAllPlaceholders(){return lr(_(this,kl).findAllPlaceholders())}createShape(e){return Gt("type",e,$t()),sr(_(this,kl).createShape(e))}hasShape(e){return Gt("id",e,Dt()),sr(_(this,kl).hasShape(e))}supportsShape(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsShape(e))}getShape(e){return Gt("id",e,Dt()),sr(_(this,kl).getShape(e))}setShape(e,t){return Gt("id",e,Dt()),Gt("shape",t,Dt()),sr(_(this,kl).setShape(e,t))}isVisible(e){return Gt("id",e,Dt()),sr(_(this,kl).isVisible(e))}setVisible(e,t){return Gt("id",e,Dt()),Gt("visible",t,Rt()),sr(_(this,kl).setVisible(e,t))}isClipped(e){return Gt("id",e,Dt()),sr(_(this,kl).isClipped(e))}setClipped(e,t){return Gt("id",e,Dt()),Gt("clipped",t,Rt()),sr(_(this,kl).setClipped(e,t))}isTransformLocked(e){return Gt("id",e,Dt()),sr(_(this,kl).isTransformLocked(e))}setTransformLocked(e,t){return Gt("id",e,Dt()),Gt("locked",t,Rt()),sr(_(this,kl).setTransformLocked(e,t))}getPositionX(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionX(e))}getPositionXMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionXMode(e))}getPositionY(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionY(e))}getPositionYMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getPositionYMode(e))}setPositionX(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,kl).setPositionX(e,t))}setPositionXMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setPositionXMode(e,t))}setPositionY(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,kl).setPositionY(e,t))}setPositionYMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Gt("id",e,Dt()),sr(_(this,kl).isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Gt("id",e,Dt()),sr(_(this,kl).isAlwaysOnBottom(e))}bringToFront(e){return Gt("id",e,Bt()),sr(_(this,kl).bringToFront(e))}sendToBack(e){return Gt("id",e,Bt()),sr(_(this,kl).sendToBack(e))}bringForward(e){return Gt("id",e,Bt()),sr(_(this,kl).bringForward(e))}sendBackward(e){return Gt("id",e,Bt()),sr(_(this,kl).sendBackward(e))}getRotation(e){return Gt("id",e,Dt()),sr(_(this,kl).getRotation(e))}setRotation(e,t){return Gt("id",e,Dt()),Gt("radians",t,Bt()),sr(_(this,kl).setRotation(e,t))}getFlipHorizontal(e){return Gt("id",e,Dt()),sr(_(this,kl).getFlip(e)).horizontal}getFlipVertical(e){return Gt("id",e,Dt()),sr(_(this,kl).getFlip(e)).vertical}setFlipHorizontal(e,t){return Gt("id",e,Dt()),Gt("flip",t,Rt()),sr(_(this,kl).setFlipHorizontal(e,t))}setFlipVertical(e,t){return Gt("id",e,Dt()),Gt("flip",t,Rt()),sr(_(this,kl).setFlipVertical(e,t))}hasContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).hasContentFillMode(e))}supportsContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsContentFillMode(e))}getWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getWidth(e))}getWidthMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getWidthMode(e))}getHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getHeight(e))}getHeightMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getHeightMode(e))}setSize(e,t,r,o){return Gt("id",e,Dt()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",o,jt(Ot({maintainCrop:jt(Rt()),sizeMode:jt(tr())}))),null!=o?.sizeMode&&(sr(_(this,kl).setWidthMode(e,o.sizeMode)),sr(_(this,kl).setHeightMode(e,o.sizeMode))),sr(_(this,kl).setWidth(e,t,o?.maintainCrop??!1)),sr(_(this,kl).setHeight(e,r,o?.maintainCrop??!1))}setPosition(e,t,r,o){return Gt("id",e,Dt()),Gt("x",t,Bt()),Gt("y",r,Bt()),null!=o?.positionMode&&(sr(_(this,kl).setPositionXMode(e,o.positionMode)),sr(_(this,kl).setPositionYMode(e,o.positionMode))),sr(_(this,kl).setPositionX(e,t)),sr(_(this,kl).setPositionY(e,r))}setWidth(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Rt()),sr(_(this,kl).setWidth(e,t,r??!1))}setWidthMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setWidthMode(e,t))}setHeight(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Rt()),sr(_(this,kl).setHeight(e,t,r??!1))}setHeightMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setHeightMode(e,t))}getFrameX(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameX(e))}getFrameY(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameY(e))}getFrameWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameWidth(e))}getFrameHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getLastFrameHeight(e))}setContentFillMode(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setContentFillMode(e,t))}getContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getContentFillMode(e))}duplicate(e,t=!0){return Gt("id",e,Dt()),sr(_(this,kl).duplicate(e,t))}destroy(e){return Gt("id",e,Dt()),sr(_(this,kl).destroy(e))}isValid(e){return Gt("id",e,Dt()),_(this,kl).isValid(e)}getParent(e){return Gt("id",e,Dt()),sr(_(this,kl).hasParent(e))?sr(_(this,kl).getParent(e)):null}getChildren(e){Gt("id",e,Dt());const t=sr(_(this,kl).getChildren(e));return lr(t)}insertChild(e,t,r){return Gt("parent",e,Bt()),Gt("child",t,Bt()),Gt("index",r,Ht(Bt(),0)),sr(_(this,kl).insertChild(e,t,r))}appendChild(e,t){return Gt("parent",e,Bt()),Gt("child",t,Bt()),sr(_(this,kl).appendChild(e,t))}referencesAnyVariables(e){return Gt("id",e,Dt()),sr(_(this,kl).referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,kl).alignHorizontally(e,t))}alignVertically(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,kl).alignVertically(e,t))}isAlignable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isAlignable(e))}distributeHorizontally(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,kl).distributeHorizontally(e))}distributeVertically(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,kl).distributeVertically(e))}isDistributable(e){return Gt("ids",e,It(Bt())),sr(_(this,kl).isDistributable(e))}fillParent(e){return Gt("id",e,Dt()),sr(_(this,kl).fillParent(e))}resizeContentAware(e,t,r){return Gt("ids",e,It(Bt())),Gt("width",t,Bt()),Gt("height",r,Bt()),sr(_(this,kl).resizeContentAware(e,t,r))}scale(e,t,r=0,o=0){return Gt("id",e,Dt()),sr(_(this,kl).scale(e,t,r,o))}findAllProperties(e){return Gt("id",e,Dt()),lr(sr(_(this,kl).findAllProperties(e)))}isPropertyReadable(e){return Gt("property",e,$t()),_(this,kl).isPropertyReadable(e)}isPropertyWritable(e){return Gt("property",e,$t()),_(this,kl).isPropertyWritable(e)}getPropertyType(e){Gt("property",e,$t());return sr(_(this,kl).getPropertyType(e))}getEnumValues(e){return Gt("enumProperty",e,$t()),lr(sr(_(this,kl).getEnumValues(e)))}setBool(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Rt()),sr(_(this,kl).setBool(e,t,r))}getBool(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getBool(e,t))}setInt(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Dt()),sr(_(this,kl).setInt(e,t,r))}getInt(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getInt(e,t))}setFloat(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,kl).setFloat(e,t,r))}getFloat(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getFloat(e,t))}setDouble(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,kl).setDouble(e,t,r))}getDouble(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getDouble(e,t))}setString(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setString(e,t,r))}getString(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getString(e,t))}setColor(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,nr()),sr(_(this,kl).setColor(e,t,Gr.fromColor(r)))}getColor(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),Gr.toColor(sr(_(this,kl).getColor(e,t)))}setColorRGBA(e,t,r,o,n,i=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("r",r,Bt()),Gt("g",o,Bt()),Gt("b",n,Bt()),Gt("a",i,Bt()),sr(_(this,kl).setColorRGBA(e,t,r,o,n,i))}getColorRGBA(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorRGBA(e,t))}setColorSpot(e,t,r,o=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("name",r,$t()),Gt("tint",o,Bt()),sr(_(this,kl).setColorSpot(e,t,r,o))}getColorSpotName(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorSpotName(e,t))}getColorSpotTint(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t());const o=r.map((e=>({color:Gr.fromColor(e.color),stop:e.stop})));return sr(_(this,kl).setGradientColorStops(e,t,o))}getGradientColorStops(e,t){Gt("id",e,Dt()),Gt("property",t,$t());const r=sr(_(this,kl).getGradientColorStops(e,t));return lr(r).map((e=>({color:Gr.toColor(e.color),stop:e.stop})))}getSourceSet(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),lr(sr(_(this,kl).getSourceSet(e,t)))}setSourceSet(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t()),Gt("sourceSet",r,It(Ot({uri:$t(),width:Bt(),height:Bt()}))),sr(_(this,kl).setSourceSet(e,t,r))}addImageFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((o=>_(this,kl).addImageFileURIToSourceSet(e,t,r,o)))}addVideoFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((o=>_(this,kl).addVideoFileURIToSourceSet(e,t,r,o)))}setEnum(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setEnum(e,t,r))}getEnum(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,kl).getEnum(e,t))}hasCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).hasCrop(e))}supportsCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsCrop(e))}setCropScaleX(e,t){return Gt("id",e,Dt()),Gt("scaleX",t,Bt()),sr(_(this,kl).setCropScaleX(e,t))}setCropScaleY(e,t){return Gt("id",e,Dt()),Gt("scaleY",t,Bt()),sr(_(this,kl).setCropScaleY(e,t))}setCropRotation(e,t){return Gt("id",e,Dt()),Gt("rotation",t,Bt()),sr(_(this,kl).setCropRotation(e,t))}setCropScaleRatio(e,t){return Gt("id",e,Dt()),Gt("scaleRatio",t,Bt()),sr(_(this,kl).setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Gt("id",e,Dt()),Gt("translationX",t,Bt()),sr(_(this,kl).setCropTranslationX(e,t))}setCropTranslationY(e,t){return Gt("id",e,Dt()),Gt("translationY",t,Bt()),sr(_(this,kl).setCropTranslationY(e,t))}resetCrop(e){return Gt("id",e,Dt()),sr(_(this,kl).resetCrop(e))}getCropScaleX(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleX(e))}getCropScaleY(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleY(e))}getCropRotation(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropRotation(e))}getCropScaleRatio(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropScaleRatio(e))}getCropTranslationX(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropTranslationX(e))}getCropTranslationY(e){return Gt("id",e,Dt()),sr(_(this,kl).getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Gt("id",e,Dt()),Gt("minScaleRatio",t,Bt()),sr(_(this,kl).adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Gt("id",e,Dt()),sr(_(this,kl).flipCropHorizontal(e))}flipCropVertical(e){return Gt("id",e,Dt()),sr(_(this,kl).flipCropVertical(e))}hasOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).hasOpacity(e))}supportsOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsOpacity(e))}setOpacity(e,t){return Gt("id",e,Dt()),Gt("opacity",t,Bt()),sr(_(this,kl).setOpacity(e,t))}getOpacity(e){return Gt("id",e,Dt()),sr(_(this,kl).getOpacity(e))}hasBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBlendMode(e))}supportsBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBlendMode(e))}setBlendMode(e,t){return Gt("id",e,Dt()),Gt("blendMode",t,$t()),sr(_(this,kl).setBlendMode(e,t))}getBlendMode(e){return Gt("id",e,Dt()),sr(_(this,kl).getBlendMode(e))}hasFillColor(e){return Gt("id",e,Dt()),sr(_(this,kl).hasFillColor(e))}isIncludedInExport(e){return Gt("id",e,Dt()),sr(_(this,kl).isIncludedInExport(e))}setIncludedInExport(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setFillColorRGBA(e,t,r,o,n))}getFillColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getFillColorRGBA(e))}setFillColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setFillColorEnabled(e,t))}isFillColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isFillColorEnabled(e))}createEffect(e){return Gt("type",e,$t()),sr(_(this,kl).createEffect(e))}hasEffects(e){return Gt("id",e,Dt()),sr(_(this,kl).hasEffects(e))}supportsEffects(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsEffects(e))}getEffects(e){Gt("id",e,Dt());const t=sr(_(this,kl).getEffects(e));return lr(t)}insertEffect(e,t,r){Gt("id",e,Dt()),Gt("effectId",t,Dt()),Gt("index",r,Ht(Dt(),0)),sr(_(this,kl).insertEffect(e,t,r))}appendEffect(e,t){Gt("id",e,Dt()),Gt("effectId",t,Dt()),sr(_(this,kl).appendEffect(e,t))}removeEffect(e,t){Gt("id",e,Dt()),Gt("index",t,Ht(Dt(),0)),sr(_(this,kl).removeEffect(e,t))}hasEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,kl).hasEffectEnabled(e))}setEffectEnabled(e,t){Gt("effectId",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setEffectEnabled(e,t))}isEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,kl).isEffectEnabled(e))}createBlur(e){return Gt("type",e,$t()),sr(_(this,kl).createBlur(e))}hasBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBlur(e))}supportsBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBlur(e))}setBlur(e,t){Gt("id",e,Dt()),Gt("blurId",t,Dt()),sr(_(this,kl).setBlur(e,t))}getBlur(e){return Gt("id",e,Dt()),sr(_(this,kl).getBlur(e))}setBlurEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setBlurEnabled(e,t))}isBlurEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isBlurEnabled(e))}hasBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,kl).hasBackgroundColor(e))}supportsBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setBackgroundColorRGBA(e,t,r,o,n))}getBackgroundColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isBackgroundColorEnabled(e))}hasStroke(e){return Gt("id",e,Dt()),sr(_(this,kl).hasStroke(e))}supportsStroke(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsStroke(e))}setStrokeEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setStrokeEnabled(e,t))}isStrokeEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setStrokeColorRGBA(e,t,r,o,n))}setStrokeColor(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeColor(e,Gr.fromColor(t)))}getStrokeColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getStrokeColorRGBA(e))}getStrokeColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,kl).getStrokeColor(e)))}setStrokeWidth(e,t){return Gt("id",e,Dt()),Gt("width",t,Bt()),sr(_(this,kl).setStrokeWidth(e,t))}getStrokeWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getStrokeWidth(e))}setStrokeStyle(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeStyle(e,t))}getStrokeStyle(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokeStyle(e))}setStrokePosition(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokePosition(e,t))}getStrokePosition(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Gt("id",e,Dt());return sr(_(this,kl).getStrokeCornerGeometry(e))}hasDropShadow(e){return Gt("id",e,Dt()),sr(_(this,kl).hasDropShadow(e))}supportsDropShadow(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsDropShadow(e))}setDropShadowEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,o,n=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,kl).setDropShadowColorRGBA(e,t,r,o,n))}setDropShadowColor(e,t){return Gt("id",e,Dt()),Gt("color",t,nr()),sr(_(this,kl).setDropShadowColor(e,Gr.fromColor(t)))}getDropShadowColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowColorRGBA(e))}getDropShadowColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,kl).getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Gt("id",e,Dt()),Gt("offsetX",t,Bt()),sr(_(this,kl).setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Gt("id",e,Dt()),Gt("offsetY",t,Bt()),sr(_(this,kl).setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Gt("id",e,Dt()),Gt("blurRadiusX",t,Bt()),sr(_(this,kl).setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Gt("id",e,Dt()),Gt("blurRadiusY",t,Bt()),sr(_(this,kl).setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setDropShadowClip(e,t))}getDropShadowClip(e){return Gt("id",e,Dt()),sr(_(this,kl).getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4,o=!0){return Gt("ids",e,It(Dt())),Gt("vectorizeDistanceThreshold",t,Bt()),Gt("maxSmoothingDistance",r,Bt()),Gt("useExistingShapeInformation",o,Rt()),sr(_(this,kl).createCutoutFromBlocks(e,t,r,o))}createCutoutFromPath(e){return Gt("path",e,$t()),sr(_(this,kl).createCutoutFromPath(e))}createCutoutFromOperation(e,t){return Gt("ids",e,It(Dt())),Gt("op",t,function(){const e=["Difference","Intersection","Union","XOR"];return Mt("CutoutOperation",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),sr(_(this,kl).createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("text",t,$t()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).replaceText(e,t,r,o))}removeText(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).removeText(e,t,r))}setTextColor(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("color",t,nr()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextColor(e,Gr.fromColor(t),r,o))}getTextColors(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt());const o=_(this,kl).getTextColors(e,t,r);return lr(sr(o)).map((e=>Gr.toColor(e)))}setTextFontWeight(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontWeight(e,t,r,o))}getTextFontWeights(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontWeights(e,t,r)))}setTextFontSize(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontSize(e,t,r,o))}getTextFontSizes(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontSizes(e,t,r)))}setTextFontStyle(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextFontStyle(e,t,r,o))}getTextFontStyles(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextFontStyles(e,t,r)))}getTextCases(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTextCases(e,t,r)))}setTextCase(e,t,r=-1,o=-1){Gt("id",e,Dt()),Gt("textCase",t,$t()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTextCase(e,t,r,o))}canToggleBoldFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).canToggleBoldFont(e,t,r))}canToggleItalicFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).canToggleItalicFont(e,t,r))}toggleBoldFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).toggleBoldFont(e,t,r))}toggleItalicFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,kl).toggleItalicFont(e,t,r))}setFont(e,t,r){Gt("block",e,Dt()),Gt("fontFileUri",t,$t()),sr(_(this,kl).setFont(e,t,r))}setTypeface(e,t,r=-1,o=-1){Gt("block",e,Dt()),Gt("from",r,Dt()),Gt("to",o,Dt()),sr(_(this,kl).setTypeface(e,t,r,o))}getTypeface(e){return Gt("block",e,Dt()),sr(_(this,kl).getTypeface(e))}getTypefaces(e,t=-1,r=-1){return Gt("block",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,kl).getTypefaces(e,t,r)))}getTextCursorRange(){return sr(_(this,kl).getTextCursorRange())}getTextVisibleLineCount(e){return Gt("id",e,Dt()),sr(_(this,kl).getTextVisibleLineCount(e))}getTextVisibleLineGlobalBoundingBoxXYWH(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,kl).getTextVisibleLineGlobalBoundingBoxXYWH(e,t))}getTextVisibleLineContent(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,kl).getTextVisibleLineContent(e,t))}hasFill(e){return Gt("id",e,Dt()),sr(_(this,kl).hasFill(e))}supportsFill(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsFill(e))}isFillEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isFillEnabled(e))}setFillEnabled(e,t){return Gt("id",e,Dt()),sr(_(this,kl).setFillEnabled(e,t))}getFill(e){return Gt("id",e,Dt()),sr(_(this,kl).getFill(e))}setFill(e,t){return Gt("id",e,Dt()),Gt("fill",t,Dt()),sr(_(this,kl).setFill(e,t))}setFillSolidColor(e,t,r,o,n=1){Gt("id",e,Dt()),sr(_(this,kl).setFillSolidColor(e,t,r,o,n))}getFillSolidColor(e){return Gt("id",e,Dt()),sr(_(this,kl).getFillSolidColor(e))}setPlaceholderEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaceholderBehavior(e))}supportsPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Gt("id",e,Dt()),sr(_(this,kl).setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaceholderControls(e))}supportsPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("value",r,$t()),sr(_(this,kl).setMetadata(e,t,r))}getMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).getMetadata(e,t))}hasMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).hasMetadata(e,t))}findAllMetadata(e){return Gt("id",e,Dt()),lr(sr(_(this,kl).findAllMetadata(e)))}removeMetadata(e,t){Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).removeMetadata(e,t))}setScopeEnabled(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("enabled",r,Rt()),sr(_(this,kl).setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).isScopeEnabled(e,t))}isAllowedByScope(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,kl).isAllowedByScope(e,t))}hasDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).hasDuration(e))}supportsDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsDuration(e))}setDuration(e,t){return Gt("id",e,Dt()),Gt("duration",t,Bt()),sr(_(this,kl).setDuration(e,t))}getDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).getDuration(e))}setPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,kl).setPageDurationSource(e,t))}isPageDurationSource(e){return Gt("id",e,Dt()),sr(_(this,kl).isPageDurationSource(e))}supportsPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,kl).supportsPageDurationSource(e,t))}removePageDurationSource(e){Gt("id",e,Dt()),sr(_(this,kl).removePageDurationSource(e))}hasTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).hasTimeOffset(e))}supportsTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsTimeOffset(e))}setTimeOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,kl).setTimeOffset(e,t))}getTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).getTimeOffset(e))}hasTrim(e){return Gt("id",e,Dt()),sr(_(this,kl).hasTrim(e))}supportsTrim(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsTrim(e))}setTrimOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,kl).setTrimOffset(e,t))}getTrimOffset(e){return Gt("id",e,Dt()),sr(_(this,kl).getTrimOffset(e))}setTrimLength(e,t){return Gt("id",e,Dt()),Gt("length",t,Bt()),sr(_(this,kl).setTrimLength(e,t))}getTrimLength(e){return Gt("id",e,Dt()),sr(_(this,kl).getTrimLength(e))}getTotalSceneDuration(e){return Gt("scene",e,Dt()),sr(_(this,kl).getTotalSceneDuration(e))}setPlaying(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setPlaying(e,t))}isPlaying(e){return Gt("id",e,Dt()),sr(_(this,kl).isPlaying(e))}hasPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaybackTime(e))}supportsPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaybackTime(e))}setPlaybackTime(e,t){return Gt("id",e,Dt()),Gt("time",t,Bt()),sr(_(this,kl).setPlaybackTime(e,t))}getPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,kl).isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,kl).setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Gt("id",e,Dt()),sr(_(this,kl).isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,kl).hasPlaybackControl(e))}supportsPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsPlaybackControl(e))}setLooping(e,t){Gt("id",e,Dt()),Gt("looping",t,Rt()),sr(_(this,kl).setLooping(e,t))}isLooping(e){return Gt("id",e,Dt()),sr(_(this,kl).isLooping(e))}setMuted(e,t){Gt("id",e,Dt()),Gt("muted",t,Rt()),sr(_(this,kl).setMuted(e,t))}isMuted(e){return Gt("id",e,Dt()),sr(_(this,kl).isMuted(e))}setVolume(e,t){Gt("id",e,Dt()),Gt("volume",t,Bt()),sr(_(this,kl).setVolume(e,t))}getVolume(e){return Gt("id",e,Dt()),sr(_(this,kl).getVolume(e))}async forceLoadAVResource(e){return Gt("id",e,Dt()),ar((t=>_(this,kl).forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Gt("id",e,Dt()),sr(_(this,kl).unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Gt("id",e,Dt()),sr(_(this,kl).getAVResourceTotalDuration(e))}getVideoWidth(e){return Gt("id",e,Dt()),sr(_(this,kl).getVideoWidth(e))}getVideoHeight(e){return Gt("id",e,Dt()),sr(_(this,kl).getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,o,n,i){Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",o,Bt()),Gt("numberOfFrames",n,Dt());const s=_(this,kl).generateVideoThumbnailSequence(e,t,r,o,n,(e=>{"error"in e?i(0,new Error(e.error)):i(e.frameIndex,new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height))}));return()=>{_(this,kl).cancelVideoThumbnailSequenceGeneration(s)}}generateAudioThumbnailSequence(e,t,r,o,n,i,s){Gt("id",e,Dt()),Gt("samplesPerChunk",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",o,Bt()),Gt("numberOfSamples",n,Dt()),Gt("numberOfChannels",i,Dt());const a=_(this,kl).generateAudioThumbnailSequence(e,t,r,o,n,i,(e=>{"error"in e?s(0,new Error(e.error)):s(e.chunkIndex,e.sampleData)}));return()=>{_(this,kl).cancelAudioThumbnailSequenceGeneration(a)}}async getVideoFillThumbnail(e,t){return Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),new Promise(((r,o)=>{_(this,kl).getVideoFillThumbnail(e,t,(e=>{"error"in e?o(e.error):r(new Blob([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,o){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),Gt("thumbnailHeight",o,Dt()),new Promise(((n,i)=>{_(this,kl).getVideoFillThumbnailAtlas(e,t,r,o,(e=>{"error"in e?i(e.error):n(new Blob([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,o){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),new Promise(((n,i)=>{_(this,kl).getPageThumbnailAtlas(e,t,r,o,(e=>{"error"in e?i(e.error):n(new Blob([e],{type:"image/jpeg"}))}))}))}createAnimation(e){return Gt("type",e,$t()),sr(_(this,kl).createAnimation(e))}supportsAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).supportsAnimation(e))}setInAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setInAnimation(e,t))}setLoopAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setLoopAnimation(e,t))}setOutAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,kl).setOutAnimation(e,t))}getInAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getInAnimation(e))}getLoopAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getLoopAnimation(e))}getOutAnimation(e){return Gt("id",e,Dt()),sr(_(this,kl).getOutAnimation(e))}setNativePixelBuffer(e,t){Gt("id",e,Dt()),t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),sr(_(this,kl).setNativePixelBuffer(e,t))}getState(e){return Gt("id",e,Dt()),sr(_(this,kl).getState(e))}setState(e,t){Gt("id",e,Dt()),sr(_(this,kl).setState(e,t))}async forceLoadResources(e){return Gt("ids",e,It(Dt())),ar((t=>_(this,kl).forceLoadResources(e,t)))}async addImage(e,t={}){Gt("url",e,$t()),Gt("options",t,jt(Ot({sizeMode:jt(tr()),positionMode:jt(rr()),x:jt(Bt()),y:jt(Bt()),cornerRadius:jt(Bt()),size:jt(Ut([Bt(),Ot({width:Bt(),height:Bt()})])),timeline:jt(Ot({timeOffset:jt(Bt()),duration:jt(Bt())})),shadow:jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),animation:jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())}))})));const{x:r,y:o,size:n,timeline:i,animation:s,shadow:a,cornerRadius:l,sizeMode:c="Absolute",positionMode:d="Absolute"}=t;let u,h;if(null!=n)"number"==typeof n?(u=n,h=n):(u=n.width,h=n.height);else{const t=await new Promise(((t,r)=>{const o=new Image;o.src=e,o.onerror=r,o.onload=()=>{t({width:o.width,height:o.height})}}));u=t.width,h=t.height}const p=_(this,_l).getCurrentPage();if(null==p)throw new Error("No current page");const f=this.create("graphic");this.appendChild(p,f),this.setPositionXMode(f,d),this.setPositionYMode(f,d),this.setWidthMode(f,c),this.setHeightMode(f,c),null!=u&&this.setWidth(f,u),null!=h&&this.setHeight(f,h),null!=r?this.setPositionX(f,r):this.alignHorizontally([f],"Center"),null!=o?this.setPositionY(f,o):this.alignVertically([f],"Center");const g=this.createShape("rect");this.setShape(f,g),null!=l&&(this.setFloat(g,"shape/rect/cornerRadiusBL",l),this.setFloat(g,"shape/rect/cornerRadiusBR",l),this.setFloat(g,"shape/rect/cornerRadiusTL",l),this.setFloat(g,"shape/rect/cornerRadiusTR",l));const m=this.createFill("image");return this.setFill(f,m),this.setString(m,"fill/image/imageFileURI",e),null!=a&&this.applyDropShadow(f,a),"Design"===_(this,_l).getMode()||(null!=i?.timeOffset&&this.setTimeOffset(f,i.timeOffset),null!=i?.duration&&this.setDuration(f,i.duration),null!=s&&this.applyAnimation(f,s),await this.forceLoadResources([f]),this.adjustCropToFillFrame(f,.5)),f}async addVideo(e,t,r,o={}){if(Gt("url",e,$t()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",o,jt(Ot({sizeMode:jt(tr()),positionMode:jt(rr()),x:jt(Bt()),y:jt(Bt()),timeline:jt(Ot({timeOffset:jt(Bt()),duration:jt(Bt())})),animation:jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())})),shadow:jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),cornerRadius:jt(Bt())}))),"Design"===_(this,_l).getMode())throw new Error("Cannot add video in design mode.");const{x:n,y:i,timeline:s,animation:a,shadow:l,cornerRadius:c,sizeMode:d="Absolute",positionMode:u="Absolute"}=o,h=_(this,_l).getCurrentPage();if(null==h)throw new Error("No current page");const p=this.create("graphic");this.appendChild(h,p),this.setPositionXMode(p,u),this.setPositionYMode(p,u),this.setWidthMode(p,d),this.setHeightMode(p,d),this.setWidth(p,t),this.setHeight(p,r),null!=n?this.setPositionX(p,n):this.alignHorizontally([p],"Center"),null!=i?this.setPositionY(p,i):this.alignVertically([p],"Center");const f=this.createShape("rect");this.setShape(p,f),null!=c&&(this.setFloat(f,"shape/rect/cornerRadiusBL",c),this.setFloat(f,"shape/rect/cornerRadiusBR",c),this.setFloat(f,"shape/rect/cornerRadiusTL",c),this.setFloat(f,"shape/rect/cornerRadiusTR",c));const g=this.createFill("video");return this.setFill(p,g),this.setString(g,"fill/video/fileURI",e),null!=l&&this.applyDropShadow(p,l),null!=s?.timeOffset&&this.setTimeOffset(p,s.timeOffset),null!=s?.duration&&this.setDuration(p,s.duration),null!=a&&this.applyAnimation(p,a),await this.forceLoadResources([p]),this.adjustCropToFillFrame(p,0),p}applyAnimation(e,t={}){if(Gt("block",e,Dt()),Gt("animation",t,jt(Ot({in:jt(ir()),loop:jt(ir()),out:jt(ir())}))),null!=t.in){const r=this.createAnimation(t.in.type);if(this.setInAnimation(e,r),this.setDuration(r,t.in.duration),null!=t.in.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.in.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}if(null!=t.out){const r=this.createAnimation(t.out.type);if(this.setOutAnimation(e,r),this.setDuration(r,t.out.duration),null!=t.out.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.out.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}if(null!=t.loop){const r=this.createAnimation(t.loop.type);if(this.setLoopAnimation(e,r),this.setDuration(r,t.loop.duration),null!=t.loop.easing&&S(this,El,Sl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),o=t.loop.easing??"Linear";e.includes(o)&&this.setEnum(r,"animationEasing",o)}}}applyDropShadow(e,t={}){Gt("block",e,Dt()),Gt("options",t,jt(Ot({color:jt(nr()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})));const{color:r,offset:o,blur:n}=t;this.setDropShadowEnabled(e,!0),null!=r&&this.setDropShadowColor(e,r),null!=o&&(null!=o.x&&this.setDropShadowOffsetX(e,o.x),null!=o.y&&this.setDropShadowOffsetY(e,o.y)),null!=n&&(null!=n.x&&this.setDropShadowBlurRadiusX(e,n.x),null!=n.y&&this.setDropShadowBlurRadiusY(e,n.y))}async generateThumbnailAtTimeOffset(e,t){Gt("height",e,Ht(Wt(Dt(),512),1)),Gt("time",t,Bt());const r=_(this,_l).getCurrentPage();if(null==r)throw new Error("No page to get thumbnail for");if("Design"===_(this,_l).getMode())throw new Error("Cannot get thumbnail in design mode. Use export instead.");return new Promise(((o,n)=>{_(this,kl).generateVideoThumbnailSequence(r,e,t,t,1,(e=>{if("error"in e)n(e.error);else{const t=new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height),r=document.createElement("canvas");r.width=e.width,r.height=e.height;const i=r.getContext("2d");if(!i)return void n(new Error("Failed to get canvas context"));i.putImageData(t,0,0),r.toBlob((e=>{e?o(e):n(new Error("Failed to convert to PNG"))}),"image/png")}}))}))}getBackgroundTrack(){if("Design"===_(this,_l).getMode())throw new Error("Cannot get background track in design mode");if(null==_(this,_l).getCurrentPage())return null;return this.findByType("track").find((e=>this.isPageDurationSource(e)))??null}moveToBackgroundTrack(e){Gt("block",e,Dt());const t=this.getBackgroundTrack();if(null==t)throw new Error("No background track found");this.appendChild(t,e)}};Cl=h(null),kl=new WeakMap,_l=new WeakMap,El=new WeakSet,Sl=function(e,t){return this.findAllProperties(e).includes(t)},y(Cl,1,"loadFromString",wl,BlockAPI),y(Cl,1,"loadFromArchiveURL",vl,BlockAPI),y(Cl,1,"create",yl,BlockAPI),y(Cl,1,"createFill",bl,BlockAPI),y(Cl,1,"createCaptionsFromURI",ml,BlockAPI),y(Cl,1,"getType",gl,BlockAPI),y(Cl,1,"getKind",fl,BlockAPI),y(Cl,1,"setKind",pl,BlockAPI),y(Cl,1,"select",hl,BlockAPI),y(Cl,1,"setSelected",ul,BlockAPI),y(Cl,1,"isSelected",dl,BlockAPI),y(Cl,1,"findAllSelected",cl,BlockAPI),y(Cl,1,"isGroupable",ll,BlockAPI),y(Cl,1,"group",al,BlockAPI),y(Cl,1,"ungroup",sl,BlockAPI),y(Cl,1,"enterGroup",il,BlockAPI),y(Cl,1,"exitGroup",nl,BlockAPI),y(Cl,1,"isCombinable",ol,BlockAPI),y(Cl,1,"combine",rl,BlockAPI),y(Cl,1,"setName",tl,BlockAPI),y(Cl,1,"getName",el,BlockAPI),y(Cl,1,"getUUID",Ja,BlockAPI),y(Cl,1,"findByName",Za,BlockAPI),y(Cl,1,"findByType",Qa,BlockAPI),y(Cl,1,"findByKind",Ka,BlockAPI),y(Cl,1,"findAll",Ya,BlockAPI),y(Cl,1,"findAllPlaceholders",Xa,BlockAPI),y(Cl,1,"createShape",Ga,BlockAPI),y(Cl,1,"getShape",za,BlockAPI),y(Cl,1,"setShape",Va,BlockAPI),y(Cl,1,"isVisible",Na,BlockAPI),y(Cl,1,"setVisible",Ha,BlockAPI),y(Cl,1,"isClipped",Wa,BlockAPI),y(Cl,1,"setClipped",Ua,BlockAPI),y(Cl,1,"isTransformLocked",qa,BlockAPI),y(Cl,1,"setTransformLocked",$a,BlockAPI),y(Cl,1,"getPositionX",ja,BlockAPI),y(Cl,1,"getPositionXMode",Oa,BlockAPI),y(Cl,1,"getPositionY",Ba,BlockAPI),y(Cl,1,"getPositionYMode",Da,BlockAPI),y(Cl,1,"setPositionX",La,BlockAPI),y(Cl,1,"setPositionXMode",Ra,BlockAPI),y(Cl,1,"setPositionY",Ia,BlockAPI),y(Cl,1,"setPositionYMode",Ma,BlockAPI),y(Cl,1,"setAlwaysOnTop",Fa,BlockAPI),y(Cl,1,"setAlwaysOnBottom",Aa,BlockAPI),y(Cl,1,"isAlwaysOnTop",Pa,BlockAPI),y(Cl,1,"isAlwaysOnBottom",Ta,BlockAPI),y(Cl,1,"bringToFront",xa,BlockAPI),y(Cl,1,"sendToBack",Sa,BlockAPI),y(Cl,1,"bringForward",Ea,BlockAPI),y(Cl,1,"sendBackward",Ca,BlockAPI),y(Cl,1,"getRotation",_a,BlockAPI),y(Cl,1,"setRotation",ka,BlockAPI),y(Cl,1,"getFlipHorizontal",wa,BlockAPI),y(Cl,1,"getFlipVertical",va,BlockAPI),y(Cl,1,"setFlipHorizontal",ya,BlockAPI),y(Cl,1,"setFlipVertical",ba,BlockAPI),y(Cl,1,"getWidth",ma,BlockAPI),y(Cl,1,"getWidthMode",ga,BlockAPI),y(Cl,1,"getHeight",fa,BlockAPI),y(Cl,1,"getHeightMode",pa,BlockAPI),y(Cl,1,"setSize",ha,BlockAPI),y(Cl,1,"setPosition",ua,BlockAPI),y(Cl,1,"setWidth",da,BlockAPI),y(Cl,1,"setWidthMode",ca,BlockAPI),y(Cl,1,"setHeight",la,BlockAPI),y(Cl,1,"setHeightMode",aa,BlockAPI),y(Cl,1,"getFrameX",sa,BlockAPI),y(Cl,1,"getFrameY",ia,BlockAPI),y(Cl,1,"getFrameWidth",na,BlockAPI),y(Cl,1,"getFrameHeight",oa,BlockAPI),y(Cl,1,"setContentFillMode",ra,BlockAPI),y(Cl,1,"getContentFillMode",ta,BlockAPI),y(Cl,1,"duplicate",ea,BlockAPI),y(Cl,1,"destroy",Js,BlockAPI),y(Cl,1,"isValid",Zs,BlockAPI),y(Cl,1,"getParent",Qs,BlockAPI),y(Cl,1,"getChildren",Ks,BlockAPI),y(Cl,1,"insertChild",Ys,BlockAPI),y(Cl,1,"appendChild",Xs,BlockAPI),y(Cl,1,"referencesAnyVariables",Gs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxX",zs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxY",Vs,BlockAPI),y(Cl,1,"getGlobalBoundingBoxWidth",Ns,BlockAPI),y(Cl,1,"getGlobalBoundingBoxHeight",Hs,BlockAPI),y(Cl,1,"getScreenSpaceBoundingBoxXYWH",Ws,BlockAPI),y(Cl,1,"alignHorizontally",Us,BlockAPI),y(Cl,1,"alignVertically",qs,BlockAPI),y(Cl,1,"isAlignable",$s,BlockAPI),y(Cl,1,"distributeHorizontally",js,BlockAPI),y(Cl,1,"distributeVertically",Os,BlockAPI),y(Cl,1,"isDistributable",Bs,BlockAPI),y(Cl,1,"fillParent",Ds,BlockAPI),y(Cl,1,"resizeContentAware",Ls,BlockAPI),y(Cl,1,"scale",Rs,BlockAPI),y(Cl,1,"findAllProperties",Is,BlockAPI),y(Cl,1,"isPropertyReadable",Ms,BlockAPI),y(Cl,1,"isPropertyWritable",Fs,BlockAPI),y(Cl,1,"getPropertyType",As,BlockAPI),y(Cl,1,"getEnumValues",Ps,BlockAPI),y(Cl,1,"setBool",Ts,BlockAPI),y(Cl,1,"getBool",xs,BlockAPI),y(Cl,1,"setInt",Ss,BlockAPI),y(Cl,1,"getInt",Es,BlockAPI),y(Cl,1,"setFloat",Cs,BlockAPI),y(Cl,1,"getFloat",_s,BlockAPI),y(Cl,1,"setDouble",ks,BlockAPI),y(Cl,1,"getDouble",ws,BlockAPI),y(Cl,1,"setString",vs,BlockAPI),y(Cl,1,"getString",ys,BlockAPI),y(Cl,1,"setColor",bs,BlockAPI),y(Cl,1,"getColor",ms,BlockAPI),y(Cl,1,"setColorRGBA",gs,BlockAPI),y(Cl,1,"getColorRGBA",fs,BlockAPI),y(Cl,1,"setColorSpot",ps,BlockAPI),y(Cl,1,"getColorSpotName",hs,BlockAPI),y(Cl,1,"getColorSpotTint",us,BlockAPI),y(Cl,1,"setGradientColorStops",ds,BlockAPI),y(Cl,1,"getGradientColorStops",cs,BlockAPI),y(Cl,1,"getSourceSet",ls,BlockAPI),y(Cl,1,"setSourceSet",as,BlockAPI),y(Cl,1,"addImageFileURIToSourceSet",ss,BlockAPI),y(Cl,1,"addVideoFileURIToSourceSet",is,BlockAPI),y(Cl,1,"setEnum",ns,BlockAPI),y(Cl,1,"getEnum",os,BlockAPI),y(Cl,1,"setCropScaleX",rs,BlockAPI),y(Cl,1,"setCropScaleY",ts,BlockAPI),y(Cl,1,"setCropRotation",es,BlockAPI),y(Cl,1,"setCropScaleRatio",Ji,BlockAPI),y(Cl,1,"setCropTranslationX",Zi,BlockAPI),y(Cl,1,"setCropTranslationY",Qi,BlockAPI),y(Cl,1,"resetCrop",Ki,BlockAPI),y(Cl,1,"getCropScaleX",Yi,BlockAPI),y(Cl,1,"getCropScaleY",Xi,BlockAPI),y(Cl,1,"getCropRotation",Gi,BlockAPI),y(Cl,1,"getCropScaleRatio",zi,BlockAPI),y(Cl,1,"getCropTranslationX",Vi,BlockAPI),y(Cl,1,"getCropTranslationY",Ni,BlockAPI),y(Cl,1,"adjustCropToFillFrame",Hi,BlockAPI),y(Cl,1,"flipCropHorizontal",Wi,BlockAPI),y(Cl,1,"flipCropVertical",Ui,BlockAPI),y(Cl,1,"setOpacity",qi,BlockAPI),y(Cl,1,"getOpacity",$i,BlockAPI),y(Cl,1,"setBlendMode",ji,BlockAPI),y(Cl,1,"getBlendMode",Oi,BlockAPI),y(Cl,1,"isIncludedInExport",Bi,BlockAPI),y(Cl,1,"setIncludedInExport",Di,BlockAPI),y(Cl,1,"setFillColorRGBA",Li,BlockAPI),y(Cl,1,"getFillColorRGBA",Ri,BlockAPI),y(Cl,1,"setFillColorEnabled",Ii,BlockAPI),y(Cl,1,"isFillColorEnabled",Mi,BlockAPI),y(Cl,1,"createEffect",Fi,BlockAPI),y(Cl,1,"getEffects",Ai,BlockAPI),y(Cl,1,"insertEffect",Pi,BlockAPI),y(Cl,1,"appendEffect",Ti,BlockAPI),y(Cl,1,"removeEffect",xi,BlockAPI),y(Cl,1,"setEffectEnabled",Si,BlockAPI),y(Cl,1,"isEffectEnabled",Ei,BlockAPI),y(Cl,1,"createBlur",Ci,BlockAPI),y(Cl,1,"setBlur",_i,BlockAPI),y(Cl,1,"getBlur",ki,BlockAPI),y(Cl,1,"setBlurEnabled",wi,BlockAPI),y(Cl,1,"isBlurEnabled",vi,BlockAPI),y(Cl,1,"setBackgroundColorRGBA",yi,BlockAPI),y(Cl,1,"getBackgroundColorRGBA",bi,BlockAPI),y(Cl,1,"setBackgroundColorEnabled",mi,BlockAPI),y(Cl,1,"isBackgroundColorEnabled",gi,BlockAPI),y(Cl,1,"setStrokeEnabled",fi,BlockAPI),y(Cl,1,"isStrokeEnabled",pi,BlockAPI),y(Cl,1,"setStrokeColorRGBA",hi,BlockAPI),y(Cl,1,"setStrokeColor",ui,BlockAPI),y(Cl,1,"getStrokeColorRGBA",di,BlockAPI),y(Cl,1,"getStrokeColor",ci,BlockAPI),y(Cl,1,"setStrokeWidth",li,BlockAPI),y(Cl,1,"getStrokeWidth",ai,BlockAPI),y(Cl,1,"setStrokeStyle",si,BlockAPI),y(Cl,1,"getStrokeStyle",ii,BlockAPI),y(Cl,1,"setStrokePosition",ni,BlockAPI),y(Cl,1,"getStrokePosition",oi,BlockAPI),y(Cl,1,"setStrokeCornerGeometry",ri,BlockAPI),y(Cl,1,"getStrokeCornerGeometry",ti,BlockAPI),y(Cl,1,"setDropShadowEnabled",ei,BlockAPI),y(Cl,1,"isDropShadowEnabled",Jn,BlockAPI),y(Cl,1,"setDropShadowColorRGBA",Zn,BlockAPI),y(Cl,1,"setDropShadowColor",Qn,BlockAPI),y(Cl,1,"getDropShadowColorRGBA",Kn,BlockAPI),y(Cl,1,"getDropShadowColor",Yn,BlockAPI),y(Cl,1,"setDropShadowOffsetX",Xn,BlockAPI),y(Cl,1,"getDropShadowOffsetX",Gn,BlockAPI),y(Cl,1,"setDropShadowOffsetY",zn,BlockAPI),y(Cl,1,"getDropShadowOffsetY",Vn,BlockAPI),y(Cl,1,"setDropShadowBlurRadiusX",Nn,BlockAPI),y(Cl,1,"getDropShadowBlurRadiusX",Hn,BlockAPI),y(Cl,1,"setDropShadowBlurRadiusY",Wn,BlockAPI),y(Cl,1,"getDropShadowBlurRadiusY",Un,BlockAPI),y(Cl,1,"setDropShadowClip",qn,BlockAPI),y(Cl,1,"getDropShadowClip",$n,BlockAPI),y(Cl,1,"createCutoutFromBlocks",jn,BlockAPI),y(Cl,1,"createCutoutFromPath",On,BlockAPI),y(Cl,1,"createCutoutFromOperation",Bn,BlockAPI),y(Cl,1,"replaceText",Dn,BlockAPI),y(Cl,1,"removeText",Ln,BlockAPI),y(Cl,1,"setTextColor",Rn,BlockAPI),y(Cl,1,"getTextColors",In,BlockAPI),y(Cl,1,"setTextFontWeight",Mn,BlockAPI),y(Cl,1,"getTextFontWeights",Fn,BlockAPI),y(Cl,1,"setTextFontSize",An,BlockAPI),y(Cl,1,"getTextFontSizes",Pn,BlockAPI),y(Cl,1,"setTextFontStyle",Tn,BlockAPI),y(Cl,1,"getTextFontStyles",xn,BlockAPI),y(Cl,1,"getTextCases",Sn,BlockAPI),y(Cl,1,"setTextCase",En,BlockAPI),y(Cl,1,"canToggleBoldFont",Cn,BlockAPI),y(Cl,1,"canToggleItalicFont",_n,BlockAPI),y(Cl,1,"toggleBoldFont",kn,BlockAPI),y(Cl,1,"toggleItalicFont",wn,BlockAPI),y(Cl,1,"setFont",vn,BlockAPI),y(Cl,1,"setTypeface",yn,BlockAPI),y(Cl,1,"getTypeface",bn,BlockAPI),y(Cl,1,"getTypefaces",mn,BlockAPI),y(Cl,1,"getTextCursorRange",gn,BlockAPI),y(Cl,1,"getTextVisibleLineCount",fn,BlockAPI),y(Cl,1,"getTextVisibleLineGlobalBoundingBoxXYWH",pn,BlockAPI),y(Cl,1,"getTextVisibleLineContent",hn,BlockAPI),y(Cl,1,"isFillEnabled",un,BlockAPI),y(Cl,1,"setFillEnabled",dn,BlockAPI),y(Cl,1,"getFill",cn,BlockAPI),y(Cl,1,"setFill",ln,BlockAPI),y(Cl,1,"setFillSolidColor",an,BlockAPI),y(Cl,1,"getFillSolidColor",sn,BlockAPI),y(Cl,1,"setPlaceholderEnabled",nn,BlockAPI),y(Cl,1,"isPlaceholderEnabled",on,BlockAPI),y(Cl,1,"setPlaceholderBehaviorEnabled",rn,BlockAPI),y(Cl,1,"isPlaceholderBehaviorEnabled",tn,BlockAPI),y(Cl,1,"setPlaceholderControlsOverlayEnabled",en,BlockAPI),y(Cl,1,"isPlaceholderControlsOverlayEnabled",Jo,BlockAPI),y(Cl,1,"setPlaceholderControlsButtonEnabled",Zo,BlockAPI),y(Cl,1,"isPlaceholderControlsButtonEnabled",Qo,BlockAPI),y(Cl,1,"setMetadata",Ko,BlockAPI),y(Cl,1,"getMetadata",Yo,BlockAPI),y(Cl,1,"findAllMetadata",Xo,BlockAPI),y(Cl,1,"removeMetadata",Go,BlockAPI),y(Cl,1,"setScopeEnabled",zo,BlockAPI),y(Cl,1,"isScopeEnabled",Vo,BlockAPI),y(Cl,1,"isAllowedByScope",No,BlockAPI),y(Cl,1,"setDuration",Ho,BlockAPI),y(Cl,1,"getDuration",Wo,BlockAPI),y(Cl,1,"setPageDurationSource",Uo,BlockAPI),y(Cl,1,"isPageDurationSource",qo,BlockAPI),y(Cl,1,"removePageDurationSource",$o,BlockAPI),y(Cl,1,"setTimeOffset",jo,BlockAPI),y(Cl,1,"getTimeOffset",Oo,BlockAPI),y(Cl,1,"setTrimOffset",Bo,BlockAPI),y(Cl,1,"getTrimOffset",Do,BlockAPI),y(Cl,1,"setTrimLength",Lo,BlockAPI),y(Cl,1,"getTrimLength",Ro,BlockAPI),y(Cl,1,"getTotalSceneDuration",Io,BlockAPI),y(Cl,1,"setPlaying",Mo,BlockAPI),y(Cl,1,"isPlaying",Fo,BlockAPI),y(Cl,1,"setPlaybackTime",Ao,BlockAPI),y(Cl,1,"getPlaybackTime",Po,BlockAPI),y(Cl,1,"isVisibleAtCurrentPlaybackTime",To,BlockAPI),y(Cl,1,"setSoloPlaybackEnabled",xo,BlockAPI),y(Cl,1,"isSoloPlaybackEnabled",So,BlockAPI),y(Cl,1,"setLooping",Eo,BlockAPI),y(Cl,1,"isLooping",Co,BlockAPI),y(Cl,1,"setMuted",_o,BlockAPI),y(Cl,1,"isMuted",ko,BlockAPI),y(Cl,1,"setVolume",wo,BlockAPI),y(Cl,1,"getVolume",vo,BlockAPI),y(Cl,1,"forceLoadAVResource",yo,BlockAPI),y(Cl,1,"unstable_isAVResourceLoaded",bo,BlockAPI),y(Cl,1,"getAVResourceTotalDuration",mo,BlockAPI),y(Cl,1,"getVideoWidth",go,BlockAPI),y(Cl,1,"getVideoHeight",fo,BlockAPI),y(Cl,1,"getVideoFillThumbnail",po,BlockAPI),y(Cl,1,"getVideoFillThumbnailAtlas",ho,BlockAPI),y(Cl,1,"getPageThumbnailAtlas",uo,BlockAPI),y(Cl,1,"createAnimation",co,BlockAPI),y(Cl,1,"setInAnimation",lo,BlockAPI),y(Cl,1,"setLoopAnimation",ao,BlockAPI),y(Cl,1,"setOutAnimation",so,BlockAPI),y(Cl,1,"getInAnimation",io,BlockAPI),y(Cl,1,"getLoopAnimation",no,BlockAPI),y(Cl,1,"getOutAnimation",oo,BlockAPI),y(Cl,1,"setNativePixelBuffer",ro,BlockAPI),y(Cl,1,"getState",to,BlockAPI),y(Cl,1,"setState",eo,BlockAPI),y(Cl,1,"forceLoadResources",Jr,BlockAPI),y(Cl,1,"applyAnimation",Zr,BlockAPI),y(Cl,1,"applyDropShadow",Qr,BlockAPI),y(Cl,1,"generateThumbnailAtTimeOffset",Kr,BlockAPI),y(Cl,1,"getBackgroundTrack",Yr,BlockAPI),y(Cl,1,"moveToBackgroundTrack",Xr,BlockAPI),m(Cl,BlockAPI);var Al,Fl,Ml,Il,Rl,Ll,Dl,Bl,Ol,jl,$l,ql,Ul,Wl,Hl,Nl,Vl,zl,Gl,Xl,Yl,Kl,Ql,Zl,Jl,ec,tc,rc,oc,nc,ic,sc,ac,lc,cc,dc,uc,hc,pc,fc,gc,mc,bc,yc,vc,wc,kc,_c,Cc,Ec,Sc,xc,Tc,Pc,Ac,Fc,Mc,Ic,Rc,Lc,Dc=new WeakMap;Ic=[fr],Mc=[fr],Fc=[fr],Ac=[pr({disabledInModes:["Playback"]})],Pc=[pr({disabledInModes:["Playback"]})],Tc=[fr],xc=[fr],Sc=[pr()],Ec=[pr({disabledInModes:["Playback"]})],Cc=[pr({disabledInModes:["Playback"]})],_c=[pr({disabledInModes:["Playback"]})],kc=[pr({disabledInModes:["Playback"]})],wc=[pr({disabledInModes:["Playback"]})],vc=[fr],yc=[fr],bc=[fr],mc=[pr({disabledInModes:["Playback"]})],gc=[fr],fc=[fr],pc=[fr],hc=[pr({disabledInModes:["Playback"]})],uc=[pr({disabledInModes:["Playback"]})],dc=[fr],cc=[pr({disabledInModes:["Playback"]})],lc=[fr],ac=[pr({disabledInModes:["Playback"]})],sc=[fr],ic=[pr({disabledInModes:["Playback"]})],nc=[fr],oc=[pr({disabledInModes:["Playback"]})],rc=[fr],tc=[pr({disabledInModes:["Playback"]})],ec=[fr],Jl=[pr({disabledInModes:["Playback"]})],Zl=[fr],Ql=[pr({disabledInModes:["Playback"]})],Kl=[fr],Yl=[pr({disabledInModes:["Playback"]})],Xl=[pr({disabledInModes:["Playback"]})],Gl=[pr({disabledInModes:["Playback"]})],zl=[pr({disabledInModes:["Playback"]})],Vl=[pr({disabledInModes:["Playback"]})],Nl=[fr],Hl=[pr({disabledInModes:["Playback"]})],Wl=[pr({disabledInModes:["Playback"]})],Ul=[fr],ql=[pr({disabledInModes:["Playback"]})],$l=[pr({disabledInModes:["Playback"]})],jl=[pr({disabledInModes:["Playback"]})],Ol=[pr({disabledInModes:["Playback"]})],Bl=[fr],Dl=[fr],Ll=[fr],Rl=[fr],Il=[fr],Ml=[pr({disabledInModes:["Playback"]})],Fl=[pr({disabledInModes:["Playback"]})],Al=[fr];var EditorAPI=class{constructor(e){b(Lc,5,this),C(this,Rc),v(this,"onStateChanged",(e=>{const t=_(this,Rc).subscribeToEditorState(e);return()=>{_(this,Rc).isDeleted()||sr(_(this,Rc).unsubscribe(t))}})),v(this,"onHistoryUpdated",(e=>{const t=_(this,Rc).subscribeToHistory(e);return()=>{_(this,Rc).isDeleted()||_(this,Rc).unsubscribe(t)}})),v(this,"onSettingsChanged",(e=>{const t=_(this,Rc).subscribeToSettings(e);return()=>{_(this,Rc).isDeleted()||sr(_(this,Rc).unsubscribe(t))}})),v(this,"onRoleChanged",(e=>{const t=_(this,Rc).subscribeToRoleChange(e);return()=>{_(this,Rc).isDeleted()||sr(_(this,Rc).unsubscribe(t))}})),E(this,Rc,e)}unlockWithLicense(e){sr(_(this,Rc).unlockWithLicense(e))}startTracking(e,t){_(this,Rc).startTracking(e,t,"")}setTrackingMetadata(e){_(this,Rc).setTrackingMetadata(e)}getTrackingMetadata(){return sr(_(this,Rc).getTrackingMetadata())}getActiveLicense(){return sr(_(this,Rc).getActiveLicense())}_update(){_(this,Rc).update()}setEditMode(e){Gt("keypath",e,$t()),_(this,Rc).setEditMode(e)}getEditMode(){return _(this,Rc).getEditMode()}unstable_isInteractionHappening(){return sr(_(this,Rc).unstable_isInteractionHappening())}getCursorType(){return _(this,Rc).getCursorType()}getCursorRotation(){return _(this,Rc).getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return _(this,Rc).getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return _(this,Rc).getTextCursorPositionInScreenSpaceY()}createHistory(){return _(this,Rc).createHistory()}destroyHistory(e){sr(_(this,Rc).destroyHistory(e))}setActiveHistory(e){sr(_(this,Rc).setActiveHistory(e))}getActiveHistory(){return _(this,Rc).getActiveHistory()}addUndoStep(){sr(_(this,Rc).addUndoStep())}undo(){sr(_(this,Rc).undo())}redo(){sr(_(this,Rc).redo())}canUndo(){return sr(_(this,Rc).canUndo())}canRedo(){return sr(_(this,Rc).canRedo())}setSettingBool(e,t){return Gt("keypath",e,$t()),Gt("value",t,Rt()),sr(_(this,Rc).setSettingBool(e,t))}getSettingBool(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingBool(e))}setSettingInt(e,t){return Gt("keypath",e,$t()),Gt("value",t,Dt()),sr(_(this,Rc).setSettingInt(e,t))}getSettingInt(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingInt(e))}setSettingFloat(e,t){return Gt("keypath",e,$t()),Gt("value",t,Bt()),sr(_(this,Rc).setSettingFloat(e,t))}getSettingFloat(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingFloat(e))}setSettingString(e,t){return Gt("keypath",e,$t()),Gt("value",t,$t()),sr(_(this,Rc).setSettingString(e,t))}getSettingString(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingString(e))}setSettingColor(e,t){return Gt("keypath",e,$t()),sr(_(this,Rc).setSettingColor(e,Gr.fromColor(t)))}getSettingColor(e){return Gt("keypath",e,$t()),Gr.toColor(sr(_(this,Rc).getSettingColor(e)))}setSettingColorRGBA(e,t,r,o,n=1){return Gt("keypath",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),Gt("a",n,Bt()),sr(_(this,Rc).setSettingColorRGBA(e,t,r,o,n))}getSettingColorRGBA(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingColorRGBA(e))}setSettingEnum(e,t){return Gt("keypath",e,$t()),Gt("value",t,$t()),sr(_(this,Rc).setSettingEnum(e,t))}getSettingEnum(e){return Gt("keypath",e,$t()),sr(_(this,Rc).getSettingEnum(e))}getSettingEnumOptions(e){return Gt("keypath",e,$t()),lr(sr(_(this,Rc).getSettingEnumOptions(e)))}setRole(e){return sr(_(this,Rc).setRole(e))}getRole(){return sr(_(this,Rc).getRole())}findAllSettings(){return lr(_(this,Rc).findAllSettings())}getSettingType(e){Gt("keypath",e,$t());return sr(_(this,Rc).getSettingType(e))}getAvailableMemory(){return sr(_(this,Rc).getAvailableMemory())}getUsedMemory(){return sr(_(this,Rc).getUsedMemory())}getMaxExportSize(){return sr(_(this,Rc).getMaxExportSize())}setURIResolver(e){Dc.set(_(this,Rc),e);return sr(_(this,Rc).setURIResolver((t=>e(t,this.defaultURIResolver.bind(this)))))}unstable_getURIResolver(){return Dc.get(_(this,Rc))??null}defaultURIResolver(e){return _(this,Rc).defaultURIResolver(e)}getAbsoluteURI(e){return sr(_(this,Rc).getAbsoluteURI(e))}findAllScopes(){return lr(_(this,Rc).findAllScopes())}setGlobalScope(e,t){Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,Rc).setGlobalScope(e,t))}getGlobalScope(e){return Gt("key",e,$t()),sr(_(this,Rc).getGlobalScope(e))}findAllSpotColors(){return lr(_(this,Rc).findAllSpotColors())}getSpotColorRGBA(e){return Gt("name",e,$t()),_(this,Rc).getSpotColorRGB(e)}getSpotColorCMYK(e){return Gt("name",e,$t()),_(this,Rc).getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,o){return Gt("name",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",o,Bt()),_(this,Rc).setSpotColorRGB(e,t,r,o)}setSpotColorCMYK(e,t,r,o,n){return Gt("name",e,$t()),Gt("c",t,Bt()),Gt("m",r,Bt()),Gt("y",o,Bt()),Gt("k",n,Bt()),_(this,Rc).setSpotColorCMYK(e,t,r,o,n)}removeSpotColor(e){return Gt("name",e,$t()),sr(_(this,Rc).removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Gt("type",e,$t()),Gt("color",t,$t()),sr(_(this,Rc).setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Gt("type",e,$t()),sr(_(this,Rc).getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Gt("colorSpace",t,$t()),Gr.toColor(sr(_(this,Rc).convertColorToColorSpace(Gr.fromColor(e),t)))}createBuffer(){return _(this,Rc).createBuffer()}destroyBuffer(e){sr(_(this,Rc).destroyBuffer(e))}setBufferData(e,t,r){Gt("offset",t,Dt()),sr(_(this,Rc).setBufferData(e,t,r))}getBufferData(e,t,r){Gt("offset",t,Dt()),Gt("length",r,Dt());const o=_(this,Rc).getBufferData(e,t,r);if("error"in o)throw new Error(o.error);return o}setBufferLength(e,t){Gt("length",t,Dt()),sr(_(this,Rc).setBufferLength(e,t))}getBufferLength(e){return sr(_(this,Rc).getBufferLength(e))}cloneBuffers(){return lr(sr(_(this,Rc).cloneBuffers()))}restoreBuffers(e){sr(_(this,Rc).restoreBuffers(e))}getMimeType(e){return Gt("uri",e,$t()),ar((t=>_(this,Rc).getMimeType(e,t)))}findAllTransientResources(){return lr(sr(_(this,Rc).findAllTransientResources()))}getResourceData(e,t,r){Gt("uri",e,$t()),Gt("chunkSize",t,Dt()),sr(_(this,Rc).getResourceData(e,t,r))}relocateResource(e,t){Gt("currentUrl",e,$t()),Gt("relocatedUrl",t,$t()),sr(_(this,Rc).relocateResource(e,t))}isHighlightingEnabled(e){return Gt("id",e,Dt()),sr(_(this,Rc).isHighlightingEnabled(e))}setHighlightingEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Rt()),sr(_(this,Rc).setHighlightingEnabled(e,t))}};Lc=h(null),Rc=new WeakMap,y(Lc,1,"unlockWithLicense",Ic,EditorAPI),y(Lc,1,"startTracking",Mc,EditorAPI),y(Lc,1,"setTrackingMetadata",Fc,EditorAPI),y(Lc,1,"getTrackingMetadata",Ac,EditorAPI),y(Lc,1,"getActiveLicense",Pc,EditorAPI),y(Lc,1,"_update",Tc,EditorAPI),y(Lc,1,"setEditMode",xc,EditorAPI),y(Lc,1,"getEditMode",Sc,EditorAPI),y(Lc,1,"unstable_isInteractionHappening",Ec,EditorAPI),y(Lc,1,"getCursorType",Cc,EditorAPI),y(Lc,1,"getCursorRotation",_c,EditorAPI),y(Lc,1,"getTextCursorPositionInScreenSpaceX",kc,EditorAPI),y(Lc,1,"getTextCursorPositionInScreenSpaceY",wc,EditorAPI),y(Lc,1,"createHistory",vc,EditorAPI),y(Lc,1,"destroyHistory",yc,EditorAPI),y(Lc,1,"setActiveHistory",bc,EditorAPI),y(Lc,1,"getActiveHistory",mc,EditorAPI),y(Lc,1,"addUndoStep",gc,EditorAPI),y(Lc,1,"undo",fc,EditorAPI),y(Lc,1,"redo",pc,EditorAPI),y(Lc,1,"canUndo",hc,EditorAPI),y(Lc,1,"canRedo",uc,EditorAPI),y(Lc,1,"setSettingBool",dc,EditorAPI),y(Lc,1,"getSettingBool",cc,EditorAPI),y(Lc,1,"setSettingInt",lc,EditorAPI),y(Lc,1,"getSettingInt",ac,EditorAPI),y(Lc,1,"setSettingFloat",sc,EditorAPI),y(Lc,1,"getSettingFloat",ic,EditorAPI),y(Lc,1,"setSettingString",nc,EditorAPI),y(Lc,1,"getSettingString",oc,EditorAPI),y(Lc,1,"setSettingColor",rc,EditorAPI),y(Lc,1,"getSettingColor",tc,EditorAPI),y(Lc,1,"setSettingColorRGBA",ec,EditorAPI),y(Lc,1,"getSettingColorRGBA",Jl,EditorAPI),y(Lc,1,"setSettingEnum",Zl,EditorAPI),y(Lc,1,"getSettingEnum",Ql,EditorAPI),y(Lc,1,"setRole",Kl,EditorAPI),y(Lc,1,"getRole",Yl,EditorAPI),y(Lc,1,"findAllSettings",Xl,EditorAPI),y(Lc,1,"getAvailableMemory",Gl,EditorAPI),y(Lc,1,"getUsedMemory",zl,EditorAPI),y(Lc,1,"getMaxExportSize",Vl,EditorAPI),y(Lc,1,"setURIResolver",Nl,EditorAPI),y(Lc,1,"unstable_getURIResolver",Hl,EditorAPI),y(Lc,1,"findAllScopes",Wl,EditorAPI),y(Lc,1,"setGlobalScope",Ul,EditorAPI),y(Lc,1,"getGlobalScope",ql,EditorAPI),y(Lc,1,"findAllSpotColors",$l,EditorAPI),y(Lc,1,"getSpotColorRGBA",jl,EditorAPI),y(Lc,1,"getSpotColorCMYK",Ol,EditorAPI),y(Lc,1,"setSpotColorRGB",Bl,EditorAPI),y(Lc,1,"setSpotColorCMYK",Dl,EditorAPI),y(Lc,1,"removeSpotColor",Ll,EditorAPI),y(Lc,1,"setSpotColorForCutoutType",Rl,EditorAPI),y(Lc,1,"getSpotColorForCutoutType",Il,EditorAPI),y(Lc,1,"convertColorToColorSpace",Ml,EditorAPI),y(Lc,1,"isHighlightingEnabled",Fl,EditorAPI),y(Lc,1,"setHighlightingEnabled",Al,EditorAPI),m(Lc,EditorAPI);var Bc,Oc,jc,$c,qc,Uc,EventAPI=class{#e;constructor(e){this.#e=e}subscribe=(e,t)=>{Gt("blocks",e,It());const r=this.#e.subscribe(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{this.#e.isDeleted()||sr(this.#e.unsubscribe(r))}}};$c=[pr({disabledInModes:["Playback"]})],jc=[fr],Oc=[pr({disabledInModes:["Playback"]})],Bc=[fr];var VariableAPI=class{constructor(e){b(Uc,5,this),C(this,qc),E(this,qc,e)}findAll(){return lr(_(this,qc).findAllVariables())}setString(e,t){return Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,qc).setVariableString(e,t))}getString(e){return Gt("key",e,$t()),sr(_(this,qc).getVariableString(e))}remove(e){return Gt("key",e,$t()),sr(_(this,qc).removeVariable(e))}};function Wc(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}Uc=h(null),qc=new WeakMap,y(Uc,1,"findAll",$c,VariableAPI),y(Uc,1,"setString",jc,VariableAPI),y(Uc,1,"getString",Oc,VariableAPI),y(Uc,1,"remove",Bc,VariableAPI),m(Uc,VariableAPI);var Hc=async function(e,t,r=fetch,o,n=new Set(o.findAllSources())){const i=e.map((async e=>{const i=Wc(t,`/${e}/content.json`);return r(i).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).then((r=>{if(void 0===r.assets)throw new Error(`Invalid content.json for assets: ${e}`);const i=r.assets;n.has(e)||o.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,o])=>{const n=o.toString();if(n.includes("{{base_url}}")){const o=n.replace("{{base_url}}",t);r.meta&&(r.meta[e]=o)}})),r.payload?.typeface&&r.payload.typeface.fonts.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),r.payload?.sourceSet&&r.payload.sourceSet.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),o.addAssetToSource(e,r)}))}))}));await Promise.all(i)},Nc=class _CaptionPresetAssetSource{static assetSourceId="ly.img.captionPresets";propertyWhitelist=["backgroundColor/enabled","backgroundColor/color","backgroundColor/cornerRadius","backgroundColor/paddingBottom","backgroundColor/paddingLeft","backgroundColor/paddingRight","backgroundColor/paddingTop","blend/mode","dropShadow/enabled","dropShadow/color","dropShadow/offset/x","dropShadow/offset/y","dropShadow/blurRadius/x","dropShadow/blurRadius/y","dropShadow/clip","fill/enabled","fill/solid/color","opacity","stroke/enabled","stroke/color","stroke/width","stroke/style","stroke/position","stroke/cornerGeometry","{{blockType}}/typeface","{{blockType}}/fontSize","{{blockType}}/horizontalAlignment","{{blockType}}/verticalAlignment","{{blockType}}/letterSpacing","{{blockType}}/lineHeight","{{blockType}}/automaticFontSizeEnabled","{{blockType}}/maxAutomaticFontSize","{{blockType}}/minAutomaticFontSize","{{blockType}}/paragraphSpacing"];#s;#a;#l;constructor(e,t,r){this.#s=e,this.#a=t,this.#l=r??window.fetch.bind(window),this.createSource()}static async fetchAssets(e,t=fetch){const r=Wc(e,`/${_CaptionPresetAssetSource.assetSourceId}/content.json`),o=await t(r);if(!o.ok)throw new Error(o.statusText);const n=await o.json();if(void 0===n.assets)throw new Error(`Invalid content.json for assets: ${_CaptionPresetAssetSource.assetSourceId}`);return n.assets.map((t=>(t.meta&&Object.entries(t.meta).forEach((([r,o])=>{const n=o.toString();if(n.includes("{{base_url}}")){const o=n.replace("{{base_url}}",e);t.meta&&(t.meta[r]=o)}})),t)))}createSource(){this.#s.asset.addSource({id:_CaptionPresetAssetSource.assetSourceId,findAssets:({page:e,perPage:t,excludeGroups:r,groups:o,locale:n="en",query:i,sortActiveFirst:s,sortKey:a,sortingOrder:l,tags:c})=>{const d=this.getCaptionTrack(),u=null!=d&&this.#s.block.hasMetadata(d,"activePreset")?this.#s.block.getMetadata(d,"activePreset"):void 0;let h=[...this.#a];if(o&&o.length>0&&(h=h.filter((e=>e.groups?.some((e=>o.includes(e)))))),i&&""!==i.trim()){const e=i.toLowerCase().trim();h=h.filter((t=>(t.label?.[n]?.toLowerCase()||"").includes(e)))}c&&c.length>0&&(h=h.filter((e=>(e.tags?.[n]??[]).some((e=>c.includes(e)))))),r&&r.length>0&&(h=h.filter((e=>!(e.groups??[]).some((e=>r.includes(e)))))),"label"===a&&"None"!==l&&h.sort(((e,t)=>{const r=e.label?.[n]?.toLocaleLowerCase()||"",o=t.label?.[n]?.toLocaleLowerCase()||"";return r<o?"Ascending"===l?-1:1:r>o?"Ascending"===l?1:-1:0})),s&&u&&h.sort(((e,t)=>e.id===u?-1:t.id===u?1:0));const p=h.length,f=e*t,g=f+t,m=h.slice(f,g).map((e=>{const t=e.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:this.fetchCaptionScale()}:e));return{id:e.id,label:e.label?.[n],active:e.id===u,context:{id:_CaptionPresetAssetSource.assetSourceId},meta:e.meta,groups:e.groups,tags:e.tags?.[n],payload:{...e.payload,properties:t},locale:n}}));return Promise.resolve({assets:m,total:p,currentPage:e})},getGroups:()=>{const e=new Set;return this.#a.forEach((t=>{t.groups&&t.groups.forEach((t=>{e.add(t)}))})),Promise.resolve(Array.from(e))},removeAsset:e=>{const t=this.#a.findIndex((t=>t.id===e));-1!==t&&this.#a.splice(t,1)},addAsset:e=>{const t=this.#a.findIndex((t=>t.id===e.id));-1!==t?this.#a[t]=e:this.#a.push(e)},applyAssetToBlock:(e,t)=>this.applyPreset(e,t),applyAssetProperty:(e,t)=>this.applyProperty(e,t)})}async applyPreset(e,t){const r=e?.meta?.uri;if(null==r)throw new Error(`The asset ${e.id} does not have a preset block URL.`);const o=await this.#l(r);if(!o.ok)throw new Error(`Failed to fetch the preset block from ${r}`);const n=await o.text(),[i]=await this.#s.block.loadFromString(n),s=null!=i?this.#s.block.getType(i):void 0;if("//ly.img.ubq/text"!==s&&"//ly.img.ubq/caption"!==s)return;const a=this.getCaptionTrack(),l=null!=a?this.#s.block.getChildren(a):[];this.propertyWhitelist.forEach((e=>{const r=e.replace("{{blockType}}","//ly.img.ubq/text"===s?"text":"caption"),o=this.#s.block.getPropertyType(r),n=e.replace("{{blockType}}","caption");switch(o){case"Int":{const e=this.#s.block.getInt(i,r);this.#s.block.setInt(t,n,e);break}case"Float":{const e=this.#s.block.getFloat(i,r);this.#s.block.setFloat(t,n,e);break}case"Double":{const e=this.#s.block.getDouble(i,r);this.#s.block.setDouble(t,n,e);break}case"Bool":{const e=this.#s.block.getBool(i,r);this.#s.block.setBool(t,n,e);break}case"Enum":{if("stroke/position"===r)break;const e=this.#s.block.getEnum(i,r);this.#s.block.setEnum(t,n,e);break}case"Color":{if("fill/solid/color"===r){const[e]=this.#s.block.getTextColors(i);this.#s.block.setColor(t,n,e),"Text"===this.#s.editor.getEditMode()&&this.#s.editor.setEditMode("Transform"),this.#s.block.setTextColor(t,e);break}const e=this.#s.block.getColor(i,r);this.#s.block.setColor(t,n,e);break}case"String":{if("text/typeface"===r||"caption/typeface"===r){const e=this.#s.block.getTypeface(i);this.#s.block.setTypeface(t,e);break}const e=this.#s.block.getString(i,r);this.#s.block.setString(t,n,e);break}}})),e.payload?.properties?.forEach((async t=>{"Color"===t.type&&await this.applyProperty(e,t)}));const[c]=this.#s.block.getTextFontWeights(i);null!=c&&this.#s.block.setTextFontWeight(t,c);const[d]=this.#s.block.getTextFontStyles(i);null!=d&&this.#s.block.setTextFontStyle(t,d);const u={in:this.#s.block.getInAnimation(i),loop:this.#s.block.getLoopAnimation(i),out:this.#s.block.getOutAnimation(i)},h=(e,t)=>{const r=u[t],o=(()=>{switch(t){case"in":return this.#s.block.getInAnimation(e);case"loop":return this.#s.block.getLoopAnimation(e);case"out":return this.#s.block.getOutAnimation(e);default:return}})();if(null!=o&&this.#s.block.isValid(o)&&this.#s.block.destroy(o),this.#s.block.isValid(r)){const o=this.#s.block.duplicate(r);switch(t){case"in":this.#s.block.setInAnimation(e,o);break;case"loop":this.#s.block.setLoopAnimation(e,o);break;case"out":this.#s.block.setOutAnimation(e,o)}}};l.forEach((e=>{h(e,"in"),h(e,"loop"),h(e,"out")})),null!=a&&this.#s.block.setMetadata(a,"activePreset",e.id),this.#s.block.destroy(i),this.#s.editor.addUndoStep(),this.#s.asset.assetSourceContentsChanged(_CaptionPresetAssetSource.assetSourceId)}async applyProperty(e,t){const r=this.getCaptionTrack();if(null==r)return;const[o]=this.#s.block.findAllSelected(),n="//ly.img.ubq/caption"===(null!=o?this.#s.block.getType(o):void 0)?o:this.#s.block.getChildren(r)[0];if(null!=n){switch(t.type){case"Color":if("fill/solid/color"===t.property){this.#s.block.setColor(n,t.property,t.value),this.#s.block.setTextColor(n,t.value);break}this.#s.block.setColor(n,t.property,t.value);break;case"Int":this.#s.block.setInt(n,t.property,t.value);break;case"Float":if("caption/scale"===t.property){const e=this.fetchCaptionScale(),r=this.#s.block.getTextFontSizes(n)[0]/e,o=Math.round(r*t.value);if(this.#s.block.setTextFontSize(n,o),this.#s.block.isStrokeEnabled(n)){const r=this.#s.block.getStrokeWidth(n)/e*t.value;this.#s.block.setStrokeWidth(n,r)}if(this.#s.block.isDropShadowEnabled(n)){const r=this.#s.block.getDropShadowOffsetX(n),o=this.#s.block.getDropShadowOffsetY(n)/e,i=this.#s.block.getDropShadowBlurRadiusX(n)/e,s=this.#s.block.getDropShadowBlurRadiusY(n)/e,a=r/e*t.value,l=o*t.value,c=i*t.value,d=s*t.value;this.#s.block.setDropShadowOffsetX(n,a),this.#s.block.setDropShadowOffsetY(n,l),this.#s.block.setDropShadowBlurRadiusX(n,c),this.#s.block.setDropShadowBlurRadiusY(n,d)}this.storeCaptionScale(t.value);break}this.#s.block.setFloat(n,t.property,t.value);break;case"Double":this.#s.block.setDouble(n,t.property,t.value);break;case"Boolean":this.#s.block.setBool(n,t.property,t.value);break;case"Enum":this.#s.block.setEnum(n,t.property,t.value);break;case"String":this.#s.block.setString(n,t.property,t.value)}this.#a=this.#a.map((r=>{if("caption/scale"===t.property){const e=r.payload?.properties?.map((e=>"caption/scale"===e.property?{...e,value:t.value}:e));return{...r,payload:{...r.payload,properties:e}}}if(r.id===e.id){const e=r.payload?.properties?.map((e=>e.property===t.property?{...e,value:t.value}:e));return{...r,payload:{...r.payload,properties:e}}}return{...r}})),this.#s.asset.assetSourceContentsChanged(_CaptionPresetAssetSource.assetSourceId)}}storeCaptionScale(e){const t=this.getCaptionTrack();null!=t&&this.#s.block.setMetadata(t,"previousScale",e.toString())}fetchCaptionScale(){const e=this.getCaptionTrack();if(null==e)return 1;try{const t=this.#s.block.getMetadata(e,"previousScale"),r=parseFloat(t);return Number.isNaN(r)?1:r}catch(e){return 1}}getCaptionTrack(){const e=this.#s.scene.getCurrentPage();if(null!=e)return this.#s.block.getChildren(e).find((e=>"//ly.img.ubq/captionTrack"===this.#s.block.getType(e)))}static async create(e,t,r){const o=await _CaptionPresetAssetSource.fetchAssets(t,r);return new _CaptionPresetAssetSource(e,o,r)}};var Vc=async function(e,t,r,o){const n=["ly.img.sticker","ly.img.vectorpath","ly.img.colors.defaultPalette","ly.img.filter.lut","ly.img.filter.duotone","ly.img.effect","ly.img.blur","ly.img.typeface","ly.img.crop.presets","ly.img.page.presets","ly.img.page.presets.video"].filter((e=>!r.includes(e)));await Hc(n,t,o,e.asset),r.includes("ly.img.captionPresets")||await Nc.create(e,t,o)},zc=(e=>(e[e.Information=0]="Information",e[e.Warning=1]="Warning",e[e.Error=2]="Error",e))(zc||{}),Gc=(e=>(e[e.Free=0]="Free",e[e.VerticalStack=1]="VerticalStack",e[e.HorizontalStack=2]="HorizontalStack",e[e.DepthStack=3]="DepthStack",e))(Gc||{});var Xc=async function(e,t,r,o,n,i,s="https://cdn.img.ly/assets/demo/v2"){const a=new Set(e.findAllSources()),l="ly.img.image.upload";!n||r.includes(l)||a.has(l)||e.addLocalSource(l,["image/jpeg","image/png","image/webp","image/svg+xml","image/bmp",..."Design"===o?["image/gif"]:[]]);const c="ly.img.video.upload";"Video"!==o||!n||r.includes(c)||a.has(c)||e.addLocalSource(c,["video/mp4","video/quicktime","image/gif"]);const d="ly.img.audio.upload";"Video"!==o||!n||r.includes(d)||a.has(d)||e.addLocalSource(d,["audio/mpeg","audio/mp3","audio/x-m4a","audio/wav"]);const u=["ly.img.image","ly.img.video","ly.img.audio"].filter((e=>!r.includes(e)));a.has("ly.img.template")||r.includes("ly.img.template")||(e.addLocalSource("ly.img.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),u.push("ly.img.template")),"Video"!==o||a.has("ly.img.video.template")||r.includes("ly.img.video.template")||(e.addLocalSource("ly.img.video.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),u.push("ly.img.video.template")),a.has("ly.img.textComponents")||r.includes("ly.img.textComponents")||u.push("ly.img.textComponents"),await Hc(u,s,i,e)};function Yc(e,t){let r;const o=new Set;function n(){const o=window.devicePixelRatio,{width:i,height:s}=e.getBoundingClientRect();t(i*o,s*o,o),r=matchMedia(`(resolution: ${o}dppx)`),r.addEventListener("change",n,{once:!0})}n();const i=new ResizeObserver((function([e]){const{width:r,height:n}=e.target.getBoundingClientRect();if(r<=0||n<=0)return;const i=window.devicePixelRatio,s=setTimeout((function(){o.delete(s),t(r*i,n*i,i)}),0);o.add(s)}));return i.observe(e),()=>{r.removeEventListener("change",n),i.disconnect();for(const e of o)clearTimeout(e);o.clear(),e=null,t=null}}var Kc=u(ht());function Qc(e,t){const r=new Set;function o(o){r.add(o);e?.(((e,...t)=>{o(e);for(const e of t)o(e)}));return()=>{r.delete(o),t?.()}}return o.emit=function(e,...t){for(const o of r){o(e);for(const e of t)o(e)}},o.handlers=r,o}var Zc=e=>t=>function(r){return t((function(t){r(e(t))}))};function Jc(e){return t=>function(r){let o=!1;const n=t((function(e){o=!0,r(e)}));return o||r(e instanceof Function?e():e),n}}var ed=(e=((e,t)=>e===t))=>t=>function(r){let o;return t((function(t){e(t,o)||(o=t,r(t))}))},td=e=>{const t=new Set;let r=null;return function(o){return t.add(o),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(o),0===t.size&&(r?.(),r=null)}}};function rd(e,...t){return t.reduce(((e,t)=>t(e)),e)}var od=(...e)=>{const t=Array.from(e);return function(e){const r=t.map((function(t){return t(e)}));return function(){for(const e of r)e()}}};function nd(e){return function(t){let r=null;const o=e((function(e){r?.(),r=e?e(t):e}));return function(){o(),r?.(),r=null}}}function id(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),o=t.map(((t,o)=>t((function(t){r[o]=t,e(r)}))));return function(){o.forEach((e=>e())),r.length=0}}}var sd=Symbol("NO_VALUE");function ad(e){let t=sd;const r=Qc();return{subscribe:r,value:()=>(t===sd&&(t=e()),t),update(e){t=e,r.emit(t)}}}var ld=u(bt());function cd(e,t){const{block:r,event:o}=t;return rd((t=>{const n=r.getType(e),i=(0,ld.default)(o.subscribe([e],(function(o){o.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==n?i():t(o)})));return i}),td)}function dd(e,t){if(!t)return e;let r;return(...o)=>{const n=e(...o);return t(n,r)||(r=n),r}}var ud=function(e,t,r,o){const n=dd(t,o?.equals),i=Qc();return{subscribe:rd(od(e,i),Zc(n),ed(),td),update:r,value:n,flush:()=>i.emit()}};var hd=class{settings;clampCamera=!1;clampResult=ad((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#c;viewportPadding=ad((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_legacyApi:o}=e,n=rd(r.onActiveChanged,Jc(),Zc((()=>r.get()))),i=rd(n,Zc((r=>null!=r&&t.isValid(r)?rd(cd(r,e),Jc([]),Zc((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),nd),s=rd(n,Zc((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:rd(cd(r,e),Jc([]),Zc((()=>r)))})),nd);this.settings={subscribe:rd(s,Zc((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),ed(Kc.default),td),update({width:e,height:r,pixelRatio:o}){const n=t.findByType("camera")[0];null!=n&&(t.setFloat(n,"camera/resolution/width",e),t.setFloat(n,"camera/resolution/height",r),t.setFloat(n,"camera/pixelRatio",o))},value(){const e=t.findByType("camera")[0];return null==e?{width:0,height:0,pixelRatio:1}:{width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}}},this.zoomLevel=ud(od(r.onZoomLevelChanged,i),(()=>{const e=r.get(),{pixelRatio:o}=this.settings.value();return null!=e&&t.isValid(e)?r.getZoomLevel()/o:1}),(e=>{const o=r.get(),{pixelRatio:n}=this.settings.value();null!=o&&t.isValid(o)&&r.setZoomLevel(e*n)})),this.#c={subscribe:rd(s,Zc((e=>o.getValue(e,"ubq/designblocks/Camera","zoomLevel"))),ed()),value(){const e=t.findByType("camera")[0];return null==e?1:o.getValue(e,"ubq/designblocks/Camera","zoomLevel")}},this.autoFit=ud(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:rd(this.clampResult.subscribe,Zc((e=>e.scrollPercentage)),ed(Kc.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:rd(id(this.clampResult.subscribe,this.#c.subscribe,this.settings.subscribe),Zc((([e,t,r])=>{const o=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},n=t??this.#c.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:o.x*n/i,y:o.y*n/i}})),ed(Kc.default)),value:()=>{const e=this.clampResult.value().sceneSize??{x:0,y:0},t=this.#c.value()??10,r=this.settings.value().pixelRatio??1;return{x:e.x*t/r,y:e.y*t/r}}},this.scroll=e=>{const r=t.findByType("camera")[0];if(null==r)return;const o=this.#c.value(),n=this.settings.value().pixelRatio,i=e.x*n/o,s=e.y*n/o,a={x:t.getPositionX(r)+i,y:t.getPositionY(r)+s};t.setPositionX(r,a.x),t.setPositionY(r,a.y)}}};function pd(e,t){const r=`[UBQ] ${e}`;switch(t){case"Warning":console.warn(r);break;case"Error":console.error(r);break;case"Info":console.info(r);break;default:console.log(r)}}var fd="1.57.0-rc.1".includes("nightly")?"https://cdn.img.ly/nightlies/1.57.0-rc.1/packages/imgly/cesdk-engine/1.57.0-rc.1/assets":"https://cdn.img.ly/packages/imgly/cesdk-engine/1.57.0-rc.1/assets";function gd(e,t){return t??="undefined"==typeof window?void 0:window.location.href,new URL(e??"",t).href.replace(/\/*$/,"/")}function md(e={}){const t={...e,license:e.license??"",baseURL:e.baseURL??fd,core:e.core??{baseURL:"core/"},logger:e.logger??pd,presets:e.presets??{}};return t.baseURL=gd(t.baseURL),t.core.baseURL=gd(t.core.baseURL,t.baseURL),t}var bd={warnKeys(e){if(e.scene||e.page||e.assetSources||e.presets?.colorPalettes||e.presets?.images||e.presets?.pageFormats||e.presets?.colorPalettes||e.variables||e.callbacks?.log||e.initialSceneMode||e.initialSceneString||e.initialSceneURL||e.initialImageURL)return"Your configuration contains keys that are no longer supported and will be ignored. Refer to https://img.ly/docs/cesdk/introduction/migration_1_13/ for information about the removed keys."}};function yd(e,t){return t?e.flatMap((e=>{const r=e.warnKeys?.(t);return"string"==typeof r?[r]:r??[]})):[]}function vd(e,t,r){if(t)for(const o of e)o.applyFallback?.(t,r)}function wd(e,t){return t?e.reduce(((e,t)=>t.migrateConfigObject?t.migrateConfigObject(e):e),t):t}var kd,_d,Cd,Ed,Sd=[bd,new class _TypefaceMigration{static APIFALLBACK_TYPEFACES_SOURCE_ID="apiFallbackTypefaces";warnKeys(e){if(e.presets?.typefaces)return"The `presets.typefaces` configuration option is deprecated. Use the AssetAPI to add typefaces instead."}applyFallback(e,t){if(e)try{const r=t.asset;if(e.presets?.typefaces){r.addLocalSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID);for(const[t,o]of Object.entries(e.presets.typefaces))r.addAssetToSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID,{id:t,payload:{typeface:{name:o.family,fonts:o.fonts.map((e=>({subFamily:`${e.weight} ${e.style}`,style:e.style,uri:e.fontURL,weight:e.weight})))}}})}}catch(e){console.error(e)}}}];function xd(e,t,r=void 0){const o=e=>{sr(t.setContext("")),e.preventDefault()},n=e=>{sr(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",o,!1),e.addEventListener("webglcontextrestored",n,!1),()=>{e.removeEventListener("webglcontextlost",o),e.removeEventListener("webglcontextrestored",n)}}function Td(e){const t={key:255,characters:e.key,shiftIsHeld:e.shiftKey,commandIsHeld:e.metaKey||e.ctrlKey,optionIsHeld:e.altKey,timestamp:Date.now()};switch(e.key.toUpperCase()){case"0":t.key=0;break;case"1":t.key=1;break;case"2":t.key=2;break;case"3":t.key=3;break;case"4":t.key=4;break;case"5":t.key=5;break;case"6":t.key=6;break;case"7":t.key=7;break;case"8":t.key=8;break;case"9":t.key=9;break;case"A":t.key=10;break;case"B":t.key=11;break;case"C":t.key=12;break;case"D":t.key=13;break;case"E":t.key=14;break;case"F":t.key=15;break;case"G":t.key=16;break;case"H":t.key=17;break;case"I":t.key=18;break;case"J":t.key=19;break;case"K":t.key=20;break;case"L":t.key=21;break;case"M":t.key=22;break;case"N":t.key=23;break;case"O":t.key=24;break;case"P":t.key=25;break;case"Q":t.key=26;break;case"R":t.key=27;break;case"S":t.key=28;break;case"T":t.key=29;break;case"U":t.key=30;break;case"V":t.key=31;break;case"W":t.key=32;break;case"X":t.key=33;break;case"Y":t.key=34;break;case"Z":t.key=35;break;case" ":t.key=42;break;case"ESCAPE":t.key=43,t.characters="";break;case"BACKSPACE":t.key=40,t.characters="";break;case"DELETE":t.key=44,t.characters="";break;case"ENTER":t.key=41,t.characters=t.shiftIsHeld?"\u2028":"\n";break;case"CONTROL":t.key=45,t.characters="";break;case"ALT":t.key=46,t.characters="";break;case"SHIFT":t.key=47,t.characters="";break;case"ARROWLEFT":t.key=36,t.characters="";break;case"ARROWRIGHT":t.key=37,t.characters="";break;case"ARROWUP":t.key=38,t.characters="";break;case"ARROWDOWN":t.key=39,t.characters="";break;case"DEAD":t.key=255,t.characters=""}return t}Cd=[pr({disabledInModes:["Playback"]})],_d=[pr({disabledInModes:["Playback"]})],kd=[pr({disabledInModes:["Playback"]})];var Pd=class{constructor(e){b(Ed,5,this),v(this,"ubique"),v(this,"notificationStream",(e=>{const t=this.ubique.addEventCallback("NotificationEvent",(t=>e({type:zc[t.type],i18n:t.i18n})));return()=>{t.dispose(),t.delete()}})),v(this,"designElementLifecycleStream",(e=>t=>{const r=this.ubique.addEventCallback(e,t);return()=>{r.dispose(),r.delete()}})),v(this,"historyStream",(e=>{const t=this.ubique.addEventCallback("HistoryUpdatedEvent",e);return()=>{t.dispose(),t.delete()}})),this.ubique=e.getInternalAPI()}dispose(){this.ubique.delete()}setErrorCallback(e,t){this.ubique.setErrorCallback(e,t)}getSelectedText(){return sr(this.ubique.getSelectedText())}hasComponent(e,t){return sr(this.ubique.hasComponent(e,t))}getValue(e,t,r){return sr(this.ubique.getValue(e,t,r))}execute(e,t){let r;const o=new Promise(((o,n)=>{r=this.ubique.ubqExecute(e,t,(e=>{try{const t=sr(e);o(t)}catch(e){n(e)}}))}));return sr(r),o}sendKey(e){return this.execute("ubq/inputs/keyboardkey",Td(e))}changeSceneLayout(e,t,r,o){return this.execute("ubq/scene/changeLayout",[e,Gc[t],r,o])}};y(Ed=h(null),1,"getSelectedText",Cd,Pd),y(Ed,1,"hasComponent",_d,Pd),y(Ed,1,"getValue",kd,Pd),m(Ed,Pd);var Ad=!1;var Fd="https://api.img.ly/activate";var Md=u(vt()),Id="./cesdk-v1.57.0-rc.1-44YCFRT6.data",Rd="./cesdk-v1.57.0-rc.1-4ZGHPUTP.wasm",Ld=Md.default,Dd=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Bd=-1!==Dd.indexOf("Edge"),Od=!!Dd.match(/msie|trident/i),jd=/\b(iPad|iPhone|iPod)\b/.test(Dd)&&/WebKit/.test(Dd)&&!/Edge/.test(Dd)&&("undefined"==typeof window||!("MSStream"in window)),$d=/(WOW64|Win32|i[3-6]86)/.test(navigator.userAgent)||/Win32|i[3-6]86|armv[6-7]/.test(navigator.platform),qd=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function Ud(){try{return new WebAssembly.Memory({initial:Wd(jd?512:32),maximum:Wd($d?1024:2048)})}catch(e){return new WebAssembly.Memory({initial:Wd(32),maximum:Wd($d?1024:2048)})}}function Wd(e){return 1024*e*1024/65536}async function Hd(e,t){const{core:r}=t,o=t.logger,n=qd(Rd,r.baseURL).toString(),i=qd(Id,r.baseURL).toString(),s=/electron/i.test(navigator.userAgent),a=function(e,t=fetch){if(!e.license)throw new Error("Missing license key in config");return e.license.length<128?t(Fd,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e.license,userId:e.userId})}).then((e=>{if(e.ok)return e.json();throw new Error("Unfortunately we are experiencing a server down time and your License key cannot be validated. We're already working on a fix and will restore service soon. Should services not restore within the hour, kindly get in touch with our support team.")})).then((e=>{if("valid"===e.status)return e.license;throw"expired"===e.status?new Error("Thanks for using IMG.LY for creative editing. Please note that your license file or commercial use is expired. Please get in touch with our sales team to discuss extension of your commercial license."):new Error("The License Key (API Key) you are using to access the IMG.LY SDK is invalid. Please ensure that you are using the license key tied to your subscription and get in touch with our support team.")})):Promise.resolve(e.license)}(t),l=s?await fetch(i,{credentials:"same-origin"}).then((e=>e.arrayBuffer())).then((e=>function(t,r){if(t!==i)return null;if(r===e.byteLength)return e;throw new Error(`Attempt to get preloaded package of unknown name or size: ${t} ${r}`)})):void 0;return new Promise(((r,s)=>{const c={getPreloadedPackage:l,locateFile:(e,t)=>e.endsWith(".wasm")?n:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&o(e,"Info")},printErr:e=>{e&&"undefined"!==e&&o(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:Ud()};Ld(c).then((async o=>{o.specialHTMLTargets["!canvas"]=e;o.emscripten_ubq_settings_forceWebGL1=jd||!!t?.forceWebGL1;const n=sr(o.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");sr(e.unlockWithLicense(t))}(n,await a),function(e,t){const r=new EditorAPI(e),o=new AssetAPI(e);if(r.setRole(t.role??"Creator"),Ad){const t=new Pd(e);t.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),t.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e))),t.dispose()}r.setSettingString("basePath",t.baseURL),r.setSettingBool("showBuildVersion",Ad||!1),t.featureFlags?.preventScrolling&&(r.setSettingBool("touch/singlePointPanning",!1),r.setSettingBool("touch/dragStartCanSelect",!1)),o.addLocalSource("ly.img.text"),function(){Ad&&(r.setSettingBool("features/hspSelectiveAdjustmentsEnabled",!1),r.setSettingBool("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;r.setSettingBool("features/singlePageModeEnabled",e),r.setSettingBool("features/effectsEnabled",!0)}(),function(){const t=new VariableAPI(e);(Ad||"undefined"!=typeof window&&window.Cypress)&&(t.setString("company_name","img.ly"),t.setString("first_name","Charly"),t.setString("last_name","Williams"),t.setString("address","742 Evergreen Terrace"),t.setString("city","Springfield"))}(),r.startTracking(t.license,t.userId??"")}(n,t),r(n)})).catch(s)}))}var Nd=class{_reactor;_updateHandler=null;debugName;dirty=!0;readCalls=new Set;constructor(e,t){this.debugName=t,this._reactor=e}dispose(){this._updateHandler=null,this._reactor._unregisterReaction(this),this._reactor=null}track(e){return this._reactor._trackReaction(this,e)}subscribe(e){return this._reactor._registerReaction(this),this._updateHandler=e,()=>{this._updateHandler=null,this._reactor._unregisterReaction(this)}}update(){this._updateHandler?.()}},Vd=u(ht()),zd=Symbol("NO_VALUE"),Gd=class{callId;_value=zd;_lastUpdateValue=zd;_readFromEngine;_disabledInModes=[];constructor(e,t,r){this.callId=e,this._readFromEngine=t,this.read(),this._lastUpdateValue=this._value,this._disabledInModes=r??[]}readCachedValue(){return this._value===zd||this.revalidate?this.read():this._value}revalidate=!1;invalidate(){this.revalidate=!0}read(){const e=this._readFromEngine();return this.revalidate=!1,(0,Vd.default)(this._value,e)?this._value:(this._value=e,e)}updateValueAndCheckDirty(){try{const e=this.read(),t=this._lastUpdateValue!==e;return this._lastUpdateValue=e,t}catch{return this._lastUpdateValue=zd,!0}}update(e){this._readFromEngine=e}isDisabledInMode(e){return this._disabledInModes.includes(e)}},Xd=class{readCalls=new Map;_createOrUpdateReadCall(e,t,r){if(this.readCalls.has(e)){this.readCalls.get(e).update(t)}else this.readCalls.set(e,new Gd(e,t,r))}registeredReactions=new Set;activeReactions=new Set;get isTracking(){return this.activeReactions.size>0}_nextReaction;_resolveNextReaction;_createNextReaction(){this._nextReaction=new Promise((e=>{this._resolveNextReaction=e}))}currentMode;constructor(e){this.currentMode=e,this._createNextReaction()}get nextReaction(){return this._nextReaction}_getterCalled(e,t,r){if(this.isTracking){this._createOrUpdateReadCall(e,t,r);for(const t of this.activeReactions)t.readCalls.add(e)}}_setterCalled(){for(const e of this.readCalls.values())e.invalidate()}read(e,t){return this.isTracking&&this.readCalls.has(e)?this.readCalls.get(e).readCachedValue():t()}createReaction(e){return new Nd(this,e)}_registerReaction(e){this.registeredReactions.add(e)}_unregisterReaction(e){this.registeredReactions.delete(e)}_cleanupReadCalls(){const e=new Set;for(const t of this.registeredReactions)for(const r of t.readCalls)e.add(r);for(const[t]of this.readCalls)e.has(t)||this.readCalls.delete(t)}#d=new Set;updateDirtyReactions(){const e=new Set;for(const[t,r]of this.readCalls)null!=this.currentMode&&r.isDisabledInMode(this.currentMode)||r.updateValueAndCheckDirty()&&e.add(t);if(e.size>0)for(const t of this.registeredReactions)if(!t.dirty)for(const r of t.readCalls)if(e.has(r)){t.dirty=!0;break}for(const e of this.registeredReactions)if(!this.#d.has(e)&&e.dirty)try{this.#d.add(e),e.update()}finally{e.dirty=!1,this.#d.delete(e)}this._cleanupReadCalls(),this._resolveNextReaction(),this._createNextReaction()}_trackReaction(e,t){try{return this.activeReactions.add(e),e.readCalls.clear(),t()}finally{e.dirty=!1,this.activeReactions.delete(e)}}decorateFunction(e,t){return function(e,t,r=t.name){Vr[r]??=0;const o=Vr[r]++;return function(...n){const i=this,s=`${r}${o}-${JSON.stringify(n,null,0)}`;function a(){return Reflect.apply(t,i,n)}return e._getterCalled(s,a),e.read(s,a)}}(this,e,t)}decorateObject(e){return function(e,t){const r=t.constructor?.name??crypto.randomUUID(),o=[];let n=!1;const i=Object.getOwnPropertyNames(t.constructor.prototype).concat(Object.getOwnPropertyNames(t));for(const a of i){const i=t[a];if("function"==typeof(s=i)&&hr in s)if("getter"===i[hr].type){let s=function(...t){if(n)throw new Error("Disposed @getter proxy called");const o=this,s=`${r}-${a.toString()}-${JSON.stringify(t,null,0)}`;function c(){return Reflect.apply(i,o,t)}return e._getterCalled(s,c,l),e.read(s,c)};const l=i[hr].disabledInModes;o.push(zr(t,a,i)),t[a]=s}else if("setter"===i[hr].type){let r=function(...t){if(n)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};o.push(zr(t,a,i)),t[a]=r}}var s;return function(){n=!0;for(const e of o)e();o.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear()}},Yd='url("data:image/svg+xml,%3Csvg width=%2722%27 height=%2725%27 viewBox=%270 0 22 25%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cg filter=%27url(%23filter0_d)%27%3E%3Cpath d=%27M18 11.1071C18 14.5637 15.5566 17.4515 12.3314 18.0846V20L7.20308 17.0145L12.3314 14.0289V15.7825C14.3292 15.1951 15.7946 13.3221 15.7946 11.107C15.7946 8.42285 13.6437 6.23908 11 6.23908C8.35629 6.23908 6.20542 8.42285 6.20542 11.107C6.20542 11.8299 6.35745 12.5252 6.65738 13.1736L4.66118 14.1255C4.22245 13.1771 4 12.1616 4 11.1071C4.00007 7.18825 7.1403 4 11.0001 4C14.8599 4 18 7.18825 18 11.1071Z%27 fill=%27black%27/%3E%3Cpath d=%27M12.8314 15.0559V14.0289V13.1593L12.0799 13.5968L6.95152 16.5824L6.20927 17.0145L6.95152 17.4466L12.0799 20.4321L12.8314 20.8696V20V18.4841C16.0889 17.6521 18.5 14.6573 18.5 11.1071C18.5 6.9193 15.1431 3.5 11.0001 3.5C6.85702 3.5 3.50008 6.91929 3.5 11.1071V11.1071C3.5 12.2334 3.73793 13.3206 4.20739 14.3354L4.41978 14.7946L4.8764 14.5768L6.8726 13.6249L7.31866 13.4122L7.11118 12.9637C6.84206 12.3819 6.70542 11.7584 6.70542 11.107C6.70542 8.69181 8.63956 6.73908 11 6.73908C13.3604 6.73908 15.2946 8.69181 15.2946 11.107C15.2946 12.8513 14.2837 14.3564 12.8314 15.0559Z%27 stroke=%27white%27/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id=%27filter0_d%27 x=%270.0599999%27 y=%270.0599999%27 width=%2721.88%27 height=%2724.6193%27 filterUnits=%27userSpaceOnUse%27 color-interpolation-filters=%27sRGB%27%3E%3CfeFlood flood-opacity=%270%27 result=%27BackgroundImageFix%27/%3E%3CfeColorMatrix in=%27SourceAlpha%27 type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0%27/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation=%271.47%27/%3E%3CfeColorMatrix type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0%27/%3E%3CfeBlend mode=%27normal%27 in2=%27BackgroundImageFix%27 result=%27effect1_dropShadow%27/%3E%3CfeBlend mode=%27normal%27 in=%27SourceGraphic%27 in2=%27effect1_dropShadow%27 result=%27shape%27/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer';function Kd(e,t){let r;return t.onStateChanged((()=>{const o=function(e,t){switch(e){case"Arrow":return"default";case"Move":return"move";case"MoveNotPermitted":return"auto";case"Resize":{const e=180*t/Math.PI+45;if(!Od&&!Bd)return`url("data:image/svg+xml,%3Csvg style='transform: rotate(${e}deg)' width ='22' height ='22' viewBox ='0 0 22 22' fill ='none' xmlns ='http://www.w3.org/2000/svg'%3E%3Cg filter ='url(%23filter0_d)'%3E%3Cpath d ='M13.7 11.1L9.7 15.2L12.5 18H4V9.5L6.9 12.3L10.9 8.3L12.3 6.9L9.5 4H18V12.5L15.2 9.7L13.7 11.1Z' fill ='white'/%3E%3C/g%3E%3Cpath d ='M12.7 10.7L8.3 15.2L10.1 17H5V11.9L6.9 13.8L11.3 9.3L13.8 6.9L11.9 5H17V10.1L15.2 8.3L12.7 10.7Z' fill ='black'/%3E%3Cdefs%3E%3Cfilter id ='filter0_d' x ='0' y ='0' width ='22' height ='22' filterUnits ='userSpaceOnUse' color-interpolation-filters ='sRGB'%3E%3CfeFlood flood-opacity ='0' result ='BackgroundImageFix'/%3E%3CfeColorMatrix in ='SourceAlpha' type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation ='2'/%3E%3CfeColorMatrix type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0'/%3E%3CfeBlend mode ='normal' in2 ='BackgroundImageFix' result ='effect1_dropShadow'/%3E%3CfeBlend mode ='normal' in ='SourceGraphic' in2 ='effect1_dropShadow' result ='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer`;switch(e){case 90:case 270:return"nwse-resize";case 135:case 315:return"ns-resize";case 180:case 360:return"nesw-resize";case 225:return"ew-resize";default:return"move"}}case"Rotate":return Yd;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(o!==r){r=o;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:o});e.dispatchEvent(t)&&e.style.setProperty("cursor",o)}}))}var Qd=function(e,t,r,o,n){let i,s=null;const a=o.onStateChanged((()=>{i=o.getEditMode(),"Text"!==i||s?"Text"!==i&&s&&(s(),s=null):s=function(){const i=s();return()=>{i?.()};function s(){let i=!1,s="";if(null==e.parentElement)return console.warn('Could not attach hidden text input to the DOM: Canvas has no parentElement. This can happen if edit mode is switched to "Text", while the canvas is removed from the DOM.'),()=>{};const a=c();u();const l=h();return e.parentElement.appendChild(a),p(),()=>{l(),d()};function c(){const e=document.createElement("textarea");return e.id="ubq_internal-inline_text_editing_html_representation",e.setAttribute("data-cy","inline-text-editing-input"),e.autocapitalize="none",e.spellcheck=!1,e.cols=4096,e.style.contain="strict",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.position="fixed",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.border="0",e}function d(){a.blur(),a.remove()}function u(){const t=o.getTextCursorPositionInScreenSpaceX(),r=o.getTextCursorPositionInScreenSpaceY(),{left:n,top:i}=e.getBoundingClientRect();a.style.left=`${n+t/window.devicePixelRatio}px`,a.style.top=`${i+r/window.devicePixelRatio}px`}function h(){const t=e.getRootNode();a.addEventListener("input",w),a.addEventListener("keydown",_),a.addEventListener("copy",b),a.addEventListener("cut",y),a.addEventListener("compositionstart",C),a.addEventListener("compositionend",E),a.addEventListener("beforeinput",P),a.addEventListener("focusout",A),t.addEventListener("touchend",T),t.addEventListener("mousedown",T),t.addEventListener("mouseup",x);const r=o.onStateChanged((()=>{u()}));return()=>{a.removeEventListener("input",w),a.removeEventListener("keydown",_),a.removeEventListener("copy",b),a.removeEventListener("cut",y),a.removeEventListener("compositionstart",C),a.removeEventListener("compositionend",E),a.removeEventListener("beforeinput",P),a.removeEventListener("focusout",A),t.removeEventListener("mousedown",T),t.removeEventListener("mouseup",x),t.removeEventListener("touchend",T),r()}}function p(){null!==a.parentElement&&(a.focus(),f()||setTimeout((()=>a.focus()),0))}function f(){return a.getRootNode().activeElement===a}function g(e){return[...e].length}function m(e){const t=e.selectionEnd??e.selectionStart??0;return g(e.value.substring(0,t))}function b(e){try{const r=t.getSelectedText();""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}catch(e){console.error(e)}}function y(e){try{const r=t.getSelectedText();if(""!==r&&e.clipboardData){e.clipboardData.setData("text/plain",r),e.preventDefault();const o={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",o)}}catch(e){console.error(e)}}async function v(){return!(!i||r.unstable_isTextCursorInCompositionRange())&&(await E(),!0)}function w(e){const r=e.target,{value:o}=r;if(i){const e=m(a);t.execute("ubq/text/compositionUpdate",{value:o,cursorPosition:e})}else o.length>0&&(r.value="")}function k(e){const r={key:255,characters:e,shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}async function _(e){if(v(),1===e.key.length&&(s=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return i&&E(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void R();if("Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"Enter"!==e.key)return;const r=Td(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(a.value="")}async function C(){i=!0,await t.execute("ubq/text/compositionStart")}async function E(){i?(i=!1,a.value="",t.execute("ubq/text/compositionEnd")):a.value=""}async function S(){if(!i)return;n();if(await v())return;const e=r.unstable_getCursorPosition(),t=r.unstable_getCompositionRange(),o=e.end-t.start,s=m(a);e.start>=t.start&&e.start<=1+t.end&&o!==s&&E()}async function x(){S()}async function T(t){S(),t.target===e&&"Text"===o.getEditMode()&&(p(),t.preventDefault())}async function P(e){if(i&&!e.isComposing&&E(),null===e.data)return;const r=e.target,o=e.data;if(await v())k(s);else if(i){const e=g(o);t.execute("ubq/text/compositionUpdate",{value:o,cursorPosition:e})}else o.length>0&&("\n"!==o[0]&&k(o),r.value="")}function A(e){if(I(e.relatedTarget)&&F(e.relatedTarget));else{M(e)}}function F(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function M(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),o=e.dispatchEvent(r);return o&&p(),o}function I(e){return null!=e&&(e instanceof HTMLElement&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&e.type.match("^(text|number|url|email|search|tel)$")||e.isContentEditable))}async function R(){o.setEditMode("Transform")}}}()}));return()=>{s?.(),a()}};function Zd(e,t,r){const o=[],n=r=>{if("touch"===r.pointerType)return;const o=Jd(e,r);t.execute("ubq/inputs/mousemove",o)},i=r=>{if("touch"===r.pointerType)return;const o=e.getBoundingClientRect();if(r.clientX>=o.x&&r.clientX<=o.x+o.width&&r.clientY>=o.y&&r.clientY<=o.y+o.height)return;const n={...Jd(e,r),position:{x:1/0,y:1/0}};t.execute("ubq/inputs/mousemove",n)},s=n=>{if("touch"===n.pointerType)return;const i={...Jd(e,n),button:eu(n.button),state:0,shiftIsHeld:!!n.shiftKey};o[n.button]=!1,n.currentTarget.releasePointerCapture(n.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const n={...Jd(e,r),button:eu(r.button),state:1,shiftIsHeld:!!r.shiftKey};o[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",n)},l=r=>{if("touch"===r.pointerType)return;const n={...Jd(e,r),shiftIsHeld:!!r.shiftKey};o.forEach(((e,r)=>{if(e){const e={...n,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),o.length=0},c=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointermove",n),e.addEventListener("pointerleave",i),e.addEventListener("lostpointercapture",l),e.addEventListener("touchmove",c,{passive:!1}),()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointerup",s),e.removeEventListener("pointercancel",s),e.removeEventListener("pointermove",n),e.removeEventListener("pointerleave",i),e.removeEventListener("lostpointercapture",l),e.removeEventListener("touchmove",c),e=null}}function Jd(e,t){const r=e.getBoundingClientRect(),o=r?.top??0,n=r?.left??0;return{position:{x:(t.clientX-n)*window.devicePixelRatio,y:(t.clientY-o)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function eu(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var tu=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=ud(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=ad((()=>{})),this.dispose=()=>{this.target.update(void 0),this.target=null,this.enabled=null,this.ubq=null,this.initialTarget=null,e=null,t=null}}initialize(e){let t;this.initialTarget=e;const r=od(this.enabled.subscribe,this.target.subscribe)((()=>{t?.(),t=void 0;const e=this.target.value();this.enabled.value()&&e&&(t=this.addWheelListener(e))}));this.target.update(e);return()=>{r(),t?.()}}setTarget(e){this.target.update(e);return()=>{this.target.update(this.initialTarget)}}addWheelListener(e){const t=e=>{if(!this.initialTarget)throw new Error("initialTarget is not set");const t={...Jd(this.initialTarget,e),deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,shiftIsHeld:!!e.shiftKey,ctrlOrMetaIsHeld:!!e.ctrlKey||!!e.metaKey};this.ubq.mouseWheel(t)&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("wheel",t,{passive:!1,capture:!0});return()=>{e.removeEventListener("wheel",t,{capture:!0}),e=null}}},ru=class{active=!1;enableDebug=!1;timestamp=0;baseTouches=[];touches=[];currentTransform;constructor(){this.currentTransform=this.emptyTransform()}touchAddRemove(e){const t=new Array(e.touches.length);for(let r=0;r<e.touches.length;r++){const o=e.touches.item(r);t[r]=ou(o)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),o=this.touches.find((e=>e.identifier===r.identifier));if(!o)return;o.x=r.clientX,o.y=r.clientY}}listen(e){return e.addEventListener("touchstart",this.touchstart,{passive:!0}),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchcancel),e.addEventListener("touchmove",this.touchmove,{passive:!0}),()=>{e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.touchcancel),e.removeEventListener("touchmove",this.touchmove)}}touchstart=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchstart")};touchend=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchend")};touchcancel=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchcancel")};touchmove=e=>{this.touchUpdate(e),this.timestamp=e.timeStamp,this.process("touchmove")};debugState;debug(){if(!this.enableDebug)return;const e=JSON.stringify(this.currentTransform);function t(e,[t,r,o],n){const i=document.createElement("div");return i.style.position="fixed",i.style.top="-25px",i.style.left="-25px",i.style.width="50px",i.style.height="50px",i.style.border=`3px ${n} rgb(${t},${r},${o})`,i.style.borderRadius="50%",i.style.borderStyle=n,i.style.backgroundColor=`rgba(${t},${r},${o}, 0.5)`,i.style.transformOrigin="center",i.style.textAlign="center",i.innerHTML=e,i.style.display="none",document.body.appendChild(i),i}this.debugState||(this.debugState={touches:[t("T1",[218,212,104],"solid"),t("T2",[218,212,104],"solid")],value:this.debugValueDiv(void 0,e,this.touches,[218,212,104]),baseTouches:[t("B1",[128,128,128],"solid"),t("B2",[128,128,128],"solid")]}),this.debugState.touches[0].style.display=this.touches[0]?"block":"none",this.debugState.touches[1].style.display=this.touches[1]?"block":"none",this.debugState.baseTouches[0].style.display=this.baseTouches[0]?"block":"none",this.debugState.baseTouches[1].style.display=this.baseTouches[1]?"block":"none",this.touches[0]&&(this.debugState.touches[0].style.transform=`translate(${this.touches[0]?.x}px, ${this.touches[0]?.y}px)`),this.touches[1]&&(this.debugState.touches[1].style.transform=`translate(${this.touches[1]?.x}px, ${this.touches[1]?.y}px)`),this.baseTouches[0]&&(this.debugState.baseTouches[0].style.transform=`translate(${this.baseTouches[0]?.x}px, ${this.baseTouches[0]?.y}px)`),this.baseTouches[1]&&(this.debugState.baseTouches[1].style.transform=`translate(${this.baseTouches[1]?.x}px, ${this.baseTouches[1]?.y}px)`),this.debugState.value=this.debugValueDiv(this.debugState.value,e,this.touches)}debugValueDiv(e,t,r,o){if(!e){const[t,r,n]=o??[128,128,128];(e=document.createElement("div")).style.position="fixed",e.style.top="50px",e.style.left="50px",e.style.width="300px",e.style.height="100px",e.style.border=`3px solid rgb(${t},${r},${n})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${n}, 0.5)`,e.style.transformOrigin="center",e.style.overflow="visible",e.style.textOverflow="visible",e.style.display="none",document.body.appendChild(e)}return this.active?e.style.borderStyle="solid":e.style.borderStyle="dashed",0===r.length?(e.style.display="none",e):(e.style.display="block",e.innerHTML=t,e)}resetBaseTouches(){this.baseTouches=this.touches.map(ou)}process(e){if("touchcancel"===e)return this.resetBaseTouches(),this.reset(),this.debug(),void this.emit(2);"touchstart"!==e&&"touchend"!==e||(this.resetBaseTouches(),this.debug()),!this.active&&this.shouldStart()&&(this.active=!0,this.emit(0)),"touchmove"===e&&(this.currentTransform=this.calculateTransform(),this.active&&this.emit(1)),this.debug(),this.active&&this.shouldStop()&&(this.active=!1,this.emit(2),this.reset())}shouldStart(){return 2===this.touches.length}shouldStop(){return 2!==this.touches.length}emit(e){const t={timestamp:this.timestamp,state:e,touchPoints:this.touches},r=this.makeEvent(t);for(const e of this.handlers)e(r)}handlers=new Set;addListener(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}reset(){this.active=!1,this.currentTransform=this.emptyTransform()}};function ou(e){if(null!=e)return e instanceof Touch?{identifier:e.identifier,x:e.clientX,y:e.clientY}:{identifier:e.identifier,x:e.x,y:e.y}}var nu=class _PanRecognizer extends ru{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=su(this.touches),t=su(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&iu(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function iu(e){return Math.sqrt(e.x**2+e.y**2)}function su(e){let t=0,r=0;for(let o=0;o<e.length;o++){const n=e[o];t+=n.x,r+=n.y}return t/=e.length,r/=e.length,{x:t,y:r}}var au=class _PinchRecognizer extends ru{static PINCH_THRESHOLD=.2;makeEvent(e){return{...e,scale:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(2!==e.length||2!==t.length)return 1;const r=Math.sqrt(Math.pow(e[0].x-e[1].x,2)+Math.pow(e[0].y-e[1].y,2));return Math.sqrt(Math.pow(t[0].x-t[1].x,2)+Math.pow(t[0].y-t[1].y,2))/r}emptyTransform(){return 1}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform()-1)>_PinchRecognizer.PINCH_THRESHOLD}},lu=class _PointRecognizer extends ru{static DISTANCE_THRESHOLD=5;static TAP_MAX_TIME=250;lastPosition={x:0,y:0};makeEvent(e){const t=this.tapDetected?this.tapLocation:e.touchPoints[0];return 0===e.state?(this.lastPosition=t,{button:0,state:1,position:t,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}):2===e.state?{button:0,state:0,position:t??this.lastPosition,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}:(this.lastPosition=t,{position:t,isTouch:!0,timestamp:e.timestamp})}previousNumTouches=0;fingerDownTimestamp=0;tapDetected=!1;tapLocation={x:0,y:0};process(e){if("touchstart"===e||"touchend"===e){this.tapDetected=!1;const e=1===this.touches.length&&0===this.previousNumTouches,t=0===this.touches.length&&1===this.previousNumTouches;e&&(this.fingerDownTimestamp=performance.now(),this.tapLocation=this.touches[0]),t&&performance.now()-this.fingerDownTimestamp<_PointRecognizer.TAP_MAX_TIME&&(this.tapDetected=!0),this.previousNumTouches=this.touches.length}super.process(e)}calculateTransform(){if(0===this.touches.length||0===this.baseTouches.length)return{x:0,y:0};const e=this.touches[0],t=this.baseTouches[0];return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return this.tapDetected||1===this.touches.length&&iu(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},cu=class _RotateRecognizer extends ru{static ROTATE_THRESHOLD=.1;makeEvent(e){return{...e,rotation:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(e.length<2||t.length<2)return 0;const r=Math.atan2(e[1].y-e[0].y,e[1].x-e[0].x);return Math.atan2(t[1].y-t[0].y,t[1].x-t[0].x)-r}emptyTransform(){return 0}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform())>_RotateRecognizer.ROTATE_THRESHOLD}};function du(e,t,r){const o=[],n=new lu;o.push(n.listen(e)),o.push(n.addListener((o=>{"button"in o?(t.execute("ubq/inputs/mousebutton",uu(e,o)),r.update()):t.execute("ubq/inputs/mousemove",uu(e,o))})));const i=new nu;o.push(i.listen(e)),o.push(i.addListener((r=>{t.execute("ubq/inputs/touchpan",uu(e,r))})));const s=new au;o.push(s.listen(e)),o.push(s.addListener((r=>{t.execute("ubq/inputs/touchpinch",uu(e,r))})));const a=new cu;return o.push(a.listen(e)),o.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",uu(e,r))}))),()=>{o.forEach((e=>e()))}}function uu(e,t){const r=window.devicePixelRatio??1,{top:o,left:n}=e.getBoundingClientRect();if(1===r&&0===o&&0===n)return t;const i=e=>({x:(e.x-n)*r,y:(e.y-o)*r});if("position"in t)return{...t,position:i(t.position)};const s=t.touchPoints.map(i);return"panDistance"in t?{...t,touchPoints:s,panDistance:i(t.panDistance)}:{...t,touchPoints:s}}function hu(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var pu="application/javascript";var fu,gu,mu,bu,yu,vu,wu={Info:"Info",Warning:"Warning",Error:"Error"};function ku(e){return{msg:"setVisibility",visible:e}}(gu=fu||(fu={})).start=function(e){return{...e,msg:"exportVideo"}},gu.abort=function(){return{msg:"exportVideoAbort"}},gu.finished=function(e){return{...e,msg:"exportVideoFinished"}},gu.error=function(e){return{...e,msg:"exportVideoError"}},gu.progress=function(e){return{...e,msg:"exportVideoProgress"}},gu.log=function(e){return{...e,msg:"exportLog"}},(bu=mu||(mu={})).start=function(e){return{...e,msg:"exportStatic"}},bu.abort=function(){return{msg:"exportStaticAbort"}},bu.finished=function(e){return{...e,msg:"exportStaticFinished"}},bu.error=function(e){return{...e,msg:"exportStaticError"}},bu.log=function(e){return{...e,msg:"exportLog"}},(vu=yu||(yu={})).start=function(e){return{...e,msg:"exportWithColorMask"}},vu.abort=function(){return{msg:"exportWithColorMaskAbort"}},vu.finished=function(e){return{...e,msg:"exportWithColorMaskFinished"}},vu.error=function(e){return{...e,msg:"exportWithColorMaskError"}},vu.log=function(e){return{...e,msg:"exportLog"}};var _u=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportVideoFinished":{const t=new Blob([r.data],{type:r.mimeType});e(t);break}case"exportVideoError":t(r.error);break;case"exportVideoProgress":o?.onProgress?.(r.renderedFrames,r.encodedFrames,r.totalFrames);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(fu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(fu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}async export(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportStaticFinished":{const t=new Blob([r.data],{type:r.mimeType});e(t);break}case"exportStaticError":t(r.error);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(mu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(mu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}async exportWithColorMask(e,t,r,o,n){const{abortSignal:i,inactivityTimeout:s}=o??{},a=await Eu(this.configuration),l=Cu(this.configuration),c=new Promise(((e,t)=>{if(a.onmessage=({data:r})=>{switch(r.msg){case"exportWithColorMaskFinished":{const[t,o]=r.data,n=new Blob([t],{type:r.mimeType}),i=new Blob([o],{type:r.mimeType});e([n,i]);break}case"exportWithColorMaskError":t(r.error);break;case"exportLog":this.configuration.logger(r.message,r.logLevel);break;default:console.error("Unknown message received ",r)}},i){let e=!1;const t=()=>{e||(e=!0,a.postMessage(yu.abort()))};i.addEventListener("abort",t,{once:!0})}}));a.postMessage(yu.start({sceneString:e,engineSettings:t,config:l,exportOptions:r,workerOptions:n,inactivityTimeout:s}));const d=()=>{a.postMessage(ku("visible"===document.visibilityState))};document.addEventListener("visibilitychange",d);try{return await c}finally{a.terminate(),document.removeEventListener("visibilitychange",d)}}};function Cu(e){return{baseURL:e.baseURL,license:e.license,core:e.core,role:e.role,presets:e.presets,featureFlags:e.featureFlags,forceWebGL1:e.forceWebGL1,audioOutput:e.audioOutput}}async function Eu(e){const t="assets/core/worker-host-v1.57.0-rc.1.js".toString().split("/").pop(),r=await async function(e){if(!(e=e.toString()).includes("://")||e.includes(window.location.origin))return e;const t=`const _importScripts = importScripts;\n const _fixImports = (url) => new URL(url, '${new URL(e).href.split("/").slice(0,-1).join("/")}/').href;\n importScripts = (...urls) => _importScripts(...urls.map(_fixImports));`;return URL.createObjectURL(new Blob([`${t}importScripts("${e}")`],{type:pu}))}(new URL(t,e.core.baseURL));return new Worker(r)}function Su(e){const t=new Map,r=e.findAllSettings();for(const o of r)switch(e.getSettingType(o)){case"Bool":t.set(o,e.getSettingBool(o));break;case"Int":t.set(o,e.getSettingInt(o));break;case"Float":t.set(o,e.getSettingFloat(o));break;case"String":t.set(o,e.getSettingString(o));break;case"Color":t.set(o,e.getSettingColor(o));break;case"Enum":t.set(o,e.getSettingEnum(o))}return t}var xu=10;globalThis.ubq_browserTabHidden=!0;var Tu={value:()=>"undefined"==typeof document||"visible"===document.visibilityState,subscribe(e){if("undefined"==typeof document)return()=>{};{const t=()=>{e("visible"===document.visibilityState)};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}}};function Pu(e,t,r){return async(o,n,i,s)=>{Gt("handle",o,Bt());try{Gt("options",n,jt(Ot({mimeType:jt(Kt()),onProgress:jt(Lt()),h264Profile:jt(Bt()),h264Level:jt(Bt()),videoBitrate:jt(Bt()),audioBitrate:jt(Bt()),timeOffset:jt(Bt()),duration:jt(Bt()),framerate:jt(Bt()),targetWidth:jt(Bt()),targetHeight:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Kt())),Gt("progressCallback",i,jt(Lt())),Gt("options",s,jt(Ot({h264Profile:jt(Bt()),h264Level:jt(Bt()),videoBitrate:jt(Bt()),audioBitrate:jt(Bt()),timeOffset:jt(Bt()),duration:jt(Bt()),framerate:jt(Bt()),targetWidth:jt(Bt()),targetHeight:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportVideo(handle, mimeType, progressCallback, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const a=t.scene.get();if(null==a||!t.block.isValid(a))throw new Error("No valid scene available.");const l="object"==typeof n?n:{mimeType:n,onProgress:i,...s},c=l.onProgress,d=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),u=Su(t.editor),h=r(),p=t.editor.getActiveLicense(),f={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{f.trackingMetadata=t.editor.getTrackingMetadata()}catch{f.trackingMetadata=void 0}const g={block:o,mimeType:l.mimeType,targetWidth:l.targetWidth,targetHeight:l.targetHeight,duration:l.duration,framerate:l.framerate,h264Level:l.h264Level,h264Profile:l.h264Profile,videoBitrate:l.videoBitrate,audioBitrate:l.audioBitrate,timeOffset:l.timeOffset};if(e.featureFlags?.exportWorker??1){return new _u({...e,license:p}).exportVideo(d,u,g,{abortSignal:l.abortSignal,inactivityTimeout:h,onProgress:c},f)}return async function(e,t,r,o,n,i){let s,a,l=0,c=null;const d=i.visibility??Tu,u=i.inactivityTimeout,h=d.subscribe((()=>{null!==c&&(c=Date.now()),globalThis.ubq_browserTabHidden=!d.value()}));let p=null;function f(){clearTimeout(a),h(),p?.()}try{let h=function(){!0===d.value()&&null!==c&&Date.now()-c>u?s(new Error("Video export timed out due to inactivity.")):(l<xu&&m.update(),a=setTimeout(h,1))};const g=new OffscreenCanvas(64,64),m=await Hd(g,{...e,audioOutput:"none"}),b=new SceneAPI(m),y=new BlockAPI(m),v=new EditorAPI(m),w=new VariableAPI(m);if(p=()=>{m.delete()},function(e,t){for(const[r,o]of t)switch(e.getSettingType(r)){case"Bool":e.setSettingBool(r,o);break;case"Int":e.setSettingInt(r,o);break;case"Float":e.setSettingFloat(r,o);break;case"String":e.setSettingString(r,o);break;case"Color":e.setSettingColor(r,o);break;case"Enum":{const t=r,n=o;e.setSettingEnum(t,n)}}}(v,t),n?.trackingMetadata&&v.setTrackingMetadata(n.trackingMetadata),n?.uriResolver){let e=function(e,r){try{return t(e,r)}catch(t){return console.warn(`Error during execution of URI resolver: ${t}.\nMake sure the url resolver function does not reference any external variables. Falling back to default URI resolver.`),r(e)}};const t=(0,eval)(`'use strict';(${n.uriResolver})`);v.setURIResolver(e)}if(n?.scopes)for(const[e,t]of Object.entries(n.scopes))v.setGlobalScope(e,t);if(n?.textVariables)for(const[e,t]of Object.entries(n.textVariables))w.setString(e,t);if(n?.spotColors)for(const[e,t]of Object.entries(n.spotColors))v.setSpotColorRGB(e,t[0],t[1],t[2]);n?.spotColorForCutoutTypeSolid&&v.setSpotColorForCutoutType("Solid",n.spotColorForCutoutTypeSolid),n?.spotColorForCutoutTypeDashed&&v.setSpotColorForCutoutType("Dashed",n.spotColorForCutoutTypeDashed),n?.buffers&&v.restoreBuffers(n.buffers),await b.loadFromString(r);const k=y.getDuration(o.block),_=o.mimeType??"video/mp4";h();const C=await new Promise(((t,r)=>{s=r,e.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),m.exportVideoToBuffer(o.block,o.timeOffset??0,o.duration??k,_,((e,t,r)=>{l=e-t,c=Date.now(),i?.onProgress?.(e,t,r)}),(e=>{"error"in e?r(e.error):t(e)}),{h264Profile:o.h264Profile??77,h264Level:o.h264Level??52,framerate:o.framerate??30,videoBitrate:o.videoBitrate??0,audioBitrate:o.audioBitrate??0,useTargetSize:void 0!==o.targetWidth&&void 0!==o.targetHeight,targetWidth:o.targetWidth??0,targetHeight:o.targetHeight??0})})),E=new Uint8Array(C.byteLength);return E.set(C),f(),{data:E,mimeType:_}}catch(e){throw f(),e}}(l.abortSignal?{...e,abortSignal:l.abortSignal}:e,u,d,g,f,{onProgress:c,visibility:Mu,inactivityTimeout:h}).then((({data:e,mimeType:t})=>new Blob([e],{type:t})))}}var Au,Fu,Mu={value:()=>"visible"===document.visibilityState,subscribe:rd((Au=document,Fu="visibilitychange",function(e){return Au.addEventListener(Fu,e),function(){Au.removeEventListener(Fu,e)}}),Zc((()=>"visible"===document.visibilityState)))};var CreativeEngine=class{asset;block;editor;event;scene;variable;reactor;version="1.57.0-rc.1";#u;#h;#p;#f;#e;#g;#m=[];constructor(e,t,r){this.#e=e,this.#g=new Pd(e),this.asset=new AssetAPI(e),this.block=new BlockAPI(e),this.editor=new EditorAPI(e),this.event=new EventAPI(e),this.scene=new SceneAPI(e),this.variable=new VariableAPI(e),this.#f=new tu(this,e),this.#m.push(this.#f.dispose);const o=new Xd(this.editor.getEditMode());this.reactor=o;const n=[o.decorateObject(this.#g),o.decorateObject(this.block),o.decorateObject(this.editor),o.decorateObject(this.scene),o.decorateObject(this.variable)];let i=(0,_t.default)(o.updateDirtyReactions.bind(o),1e3/120,{leading:!0,trailing:!1}),s=this.addPostUpdateCallback(i);const a=this.editor.onStateChanged((()=>{o.currentMode=this.editor.getEditMode(),i="Playback"===o.currentMode?(0,_t.default)(o.updateDirtyReactions.bind(o),100,{leading:!0,trailing:!1}):(0,_t.default)(o.updateDirtyReactions.bind(o),1e3/120,{leading:!0,trailing:!1});const e=this.addPostUpdateCallback(i);s(),s=e}));this.#m.push((()=>{n.forEach((e=>e())),a(),s(),this.reactor.dispose()})),this.block.exportVideo=Pu(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_videoExportInactivityTimeout)),r.featureFlags?.exportWorker&&(this.block.export=function(e,t,r){return async(o,n,i)=>{Gt("handle",o,Bt());try{Gt("options",n,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Ut([Xt(),Qt()]))),Gt("options",i,jt(Ot({pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf you're using the deprecated signature:\ncesdk.engine.block.export(handle, mimeType, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.export(handle, options)\n${e.message}`)}}const s=t.scene.get();if(null==s||!t.block.isValid(s))throw new Error("No valid scene available.");const a="object"==typeof n?n:{mimeType:n,...i},l=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),c=Su(t.editor),d=r(),u=t.editor.getActiveLicense(),h={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{h.trackingMetadata=t.editor.getTrackingMetadata()}catch{h.trackingMetadata=void 0}const p={block:o,mimeType:a.mimeType,pngCompressionLevel:a.pngCompressionLevel,jpegQuality:a.jpegQuality,webpQuality:a.webpQuality,targetWidth:a.targetWidth,targetHeight:a.targetHeight,exportPdfWithHighCompatibility:a.exportPdfWithHighCompatibility,exportPdfWithUnderlayer:a.exportPdfWithUnderlayer,underlayerSpotColorName:a.underlayerSpotColorName,underlayerOffset:a.underlayerOffset};return new _u({...e,license:u}).export(l,c,p,{abortSignal:a.abortSignal,inactivityTimeout:d},h)}}(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_exportInactivityTimeout)),this.block.exportWithColorMask=function(e,t,r){return async(o,n,i,s,a,l)=>{Gt("handle",o,Bt());try{Gt("maskColorR",n,Bt()),Gt("maskColorG",i,Bt()),Gt("maskColorB",s,Bt()),Gt("options",a,jt(Ot({mimeType:jt(Ut([Xt(),Qt()])),pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",n,jt(Ut([Xt(),Qt()]))),Gt("maskColorR",i,Bt()),Gt("maskColorG",s,Bt()),Gt("maskColorB",a,Bt()),Gt("options",l,jt(Ot({pngCompressionLevel:jt(Ht(Wt(Dt(),9),0)),jpegQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),webpQuality:jt(Ht(Wt(Bt(),1),0,{exclusive:!0})),targetWidth:jt(Bt()),targetHeight:jt(Bt()),exportPdfWithHighCompatibility:jt(Rt()),exportPdfWithUnderlayer:jt(Rt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(t){throw new Error(`Invalid arguments.\nIf your're using the deprecated signature:\ncesdk.engine.block.exportWithColorMask(handle, mimeType, maskColorR, maskColorG, maskColorB, options)\n${t.message}\nIf you're using the new signature:\ncesdk.engine.block.exportWithColorMask(handle, maskColorR, maskColorG, maskColorB, options)\n${e.message}`)}}const c=t.scene.get();if(null==c||!t.block.isValid(c))throw new Error("No valid scene available.");let d,u,h,p;"number"==typeof n?(d=n,u=i,h=s,p=a??{}):(d=i,u=s,h=a,p={mimeType:n,...l});const f=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),g=Su(t.editor),m=r(),b=t.editor.getActiveLicense(),y={scopes:Object.fromEntries(t.editor.findAllScopes().map((e=>[e,t.editor.getGlobalScope(e)]))),textVariables:Object.fromEntries(t.variable.findAll().map((e=>[e,t.variable.getString(e)]))),spotColors:Object.fromEntries(t.editor.findAllSpotColors().map((e=>[e,t.editor.getSpotColorRGBA(e)]))),spotColorForCutoutTypeSolid:t.editor.getSpotColorForCutoutType("Solid"),spotColorForCutoutTypeDashed:t.editor.getSpotColorForCutoutType("Dashed"),uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{y.trackingMetadata=t.editor.getTrackingMetadata()}catch{y.trackingMetadata=void 0}const v={block:o,maskColorR:d,maskColorG:u,maskColorB:h,mimeType:p.mimeType,pngCompressionLevel:p.pngCompressionLevel,jpegQuality:p.jpegQuality,webpQuality:p.webpQuality,targetWidth:p.targetWidth,targetHeight:p.targetHeight,exportPdfWithHighCompatibility:p.exportPdfWithHighCompatibility,exportPdfWithUnderlayer:p.exportPdfWithUnderlayer,underlayerSpotColorName:p.underlayerSpotColorName,underlayerOffset:p.underlayerOffset};return new _u({...e,license:b}).exportWithColorMask(f,g,v,{abortSignal:p.abortSignal,inactivityTimeout:m},y)}}(r,{block:this.block,scene:this.scene,editor:this.editor,variable:this.variable},(()=>this._unstable_exportInactivityTimeout))),"getInternalCanvas"in t?(this.#h=t.getInternalCanvas(),this.#p=t):this.#h=t,this.#u=new hd(this),this.#b(),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.legacyAPI=this.#g)}addPlugin(e){if(e.initialize){const t={engine:{asset:this.asset,block:this.block,scene:this.scene,editor:this.editor,event:this.event,variable:this.variable}};e.initialize(t)}}unstable_setVideoExportInactivityTimeout(e){this._unstable_videoExportInactivityTimeout=e}_unstable_videoExportInactivityTimeout=1e4;unstable_setExportInactivityTimeout(e){this._unstable_exportInactivityTimeout=e}_unstable_exportInactivityTimeout=1e4;#y(){if(!this.#p)return;const e=this.#p.getInternalCanvas(),t=e.getBoundingClientRect();if(0===t.width||0===t.height)return;const r="undefined"!=typeof window?window.devicePixelRatio:1,o=t.width*r,n=t.height*r;e.width!==o&&(e.width=o),e.height!==n&&(e.height=n)}#v(){const{width:e,height:t}=this.#h,r="undefined"!=typeof window?window.devicePixelRatio:1,{height:o,width:n,pixelRatio:i}=this.#u.settings.value();if(!hu(n,e,1e-4)||!hu(o,t,1e-4)||!hu(i,r,1e-4)){this.#u.settings.update({height:t,width:e,pixelRatio:r});const o=this.scene.get();if(!hu(i,r,1e-4)&&null!==o&&!1===this.scene.isZoomAutoFitEnabled(o)){const e=this.scene.getZoomLevel();this.scene.setZoomLevel(e*(r/i))}}}#w=[];#k=[];addPostUpdateCallback(e){return this.#w.push(e),()=>{const t=this.#w.indexOf(e);-1!==t&&this.#w.splice(t,1)}}addPreUpdateCallback(e){return this.#k.push(e),()=>{const t=this.#k.indexOf(e);-1!==t&&this.#k.splice(t,1)}}#_;#b(e=!0){this.#C(e),this.#E()}#C(e=!0){let t,r=!1,o=0;if(this.#_)return;const n=()=>{if(this.#_=requestAnimationFrame(n),!r)try{this.#S(e),o=0}catch(e){throw o++,o>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),this.#x()),e}};this.#_=requestAnimationFrame(n)}#E(){if(e=this.#h,!("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement))return;var e;const t=this.#p??this.#h,r=this.#S.bind(this,!1),o=[Zd(t,this.#g,r),this.#f.initialize(t),Qd(t,this.#g,this.#e,this.editor,r),Kd(t,this.editor),du(t,this.#g,this.#e),xd(this.#h,this.#e,(()=>{this.#h.width=this.#h.width})),Yc(t,this.#T)];this.#P=()=>{o.reverse().forEach((e=>e()))}}setWheelEventTarget(e){return this.#f.setTarget(e)}#T=(0,wt.default)(function(){this.#S()}.bind(this),100,{leading:!0,trailing:!1});#P;#x(){this.#P?.(),this.#P=void 0,this.#_&&(cancelAnimationFrame(this.#_),this.#_=0)}#S(e=!0){for(const e of this.#k)e();if(e){1===this.block.findByType("scene").length&&this.#A()}this.#y(),this.#v(),this.#e.update();for(const e of this.#w)e()}#A(){if(this.#u.clampCamera){const e={sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}};this.#g.execute("cesdk/clampCameraAndRender",{horizontalPaddingInPixels:this._camera.viewportPadding.value().x,verticalPaddingInPixels:this._camera.viewportPadding.value().y}).then((e=>{(0,kt.default)(this.#u.clampResult.value(),e)||this.#u.clampResult.update(e)}),(()=>{(0,kt.default)(this.#u.clampResult.value(),e)||this.#u.clampResult.update(e)}))}else this.#g.execute("ubq/render")}get element(){return this.#p}dispose(){this.#m.forEach((e=>e())),this.#x(),this.asset.dispose(),this.#h=null,this.#p?.dispose(),this.#p=void 0,this.block=null,this.scene=null,this.variable=null,this.asset=null,this.editor=null,this.event=null,this.#w.length=0,this.#g.dispose(),this.#g=null,this.#e.delete(),this.#e=null}static async init(e,t){let r=function(e,t){if(r(t?.canvas))return t?.canvas;if(r(e))return console.warn("Passing an existing HTMLCanvasElement as a second parameter to CreativeEngine.init() is deprecated. Use the element property on the CreativeEngine instance to access a fully managed canvas to append into the DOM instead. For more information, have a look into our documentation at https://img.ly/docs/cesdk/next/engine/quickstart/#initialization."),e;return;function r(e){return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}}(t,e);const o="129e4ee7f3",n="1.57.0-rc.1";if(o||n){const e=["[CreativeEngine]"];n&&e.push(`v${n}`),o&&e.push(`Revision ${o}`),console.log(e.join(" "))}let i;r||(i=function(){customElements.get("cesdk-canvas")||customElements.define("cesdk-canvas",class HTMLCreativeEngineCanvasElement extends HTMLElement{#h;constructor(){super(),this.#h=document.createElement("canvas");const e=document.createElement("style");e.textContent=":host {display: block; width: 100%; height: 100%; contain: content;} canvas {position: absolute; inset: 0; width: 100%; height:100%; display: block; touch-action: none;}",this.attachShadow({mode:"closed"}).append(e,this.#h)}getInternalCanvas(){if(!this.#h)throw new Error("Internal canvas element is undefined");return this.#h}dispose(){this.#h?.remove(),this.#h=void 0}clear(){if(!this.#h)return;const e=this.#h.width;this.#h.width=1,this.#h.width=e}});return document.createElement("cesdk-canvas")}(),r=i.getInternalCanvas());const s=md(wd(Sd,e));if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of yd(Sd,e))s.logger(t,"Warning");const a=new this(await Hd(r,s),i??r,s);return Object.defineProperty(a,"version",{configurable:!1,writable:!1}),vd(Sd,s,a),a}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v4",excludeAssetSourceIds:t=[]}={}){return Vc(this,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:o=!1}={}){return Xc(this.asset,this.scene,t,r,o,void 0,e)}get _camera(){return this.#u}get _legacyApi(){return this.#g}};var Iu=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return console.error(e),!1}return!1},Ru=1e4,Lu=1e6,Du=8;async function Bu(){if("undefined"==typeof window)throw new Error("Window is undefined");const e=["VideoFrame","VideoDecoder","VideoEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(`Missing required web video APIs:\n${t.join("\n")}`)}const t={codec:"avc1.4D0034",width:1920,height:1080,avc:{format:"annexb"},framerate:30};if(!await VideoEncoder.isConfigSupported(t))throw new Error(`VideoEncoder config ${JSON.stringify(t)} not supported`);const r=new OffscreenCanvas(t.width,t.height),o=r.getContext("webgl2");if(!o)throw new Error("Could not create WebGL2 context");return o.clearColor(1,0,1,1),o.clear(o.COLOR_BUFFER_BIT),new Promise(((e,o)=>{setTimeout((()=>{o(new Error("Timed out during video export"))}),Ru);const n=new VideoEncoder({output:()=>e(),error:e=>o(new Error(`Could not create a new VideoEncoder: ${e}`))});try{n.configure(t)}catch(e){throw new Error(`Failed to configure a VideoEncoder object with ${JSON.stringify(t)}: ${e}`)}for(let e=0;e<Du;++e){const o=new VideoFrame(r,{timestamp:e*(Lu/t.framerate),duration:Lu/t.framerate});n.encode(o,{keyFrame:!0}),o.close()}n.flush().then((()=>{"closed"!==n.state&&n.close()}),(e=>{o(new Error(`Error during video export: ${e}`))}))}))}async function Ou(){if("undefined"==typeof window)throw new Error("Window is undefined");const e=["AudioDecoder","AudioEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(`Missing required web audio APIs:\n${t.join("\n")}`)}const t={codec:"mp4a.40.02",sampleRate:48e3,numberOfChannels:2,bitrate:128e3};if(!await AudioEncoder.isConfigSupported(t))throw new Error(`AudioEncoder config ${JSON.stringify(t)} not supported`);return new Promise(((e,r)=>{setTimeout((()=>{r(new Error("Timed out during audio export"))}),Ru);const o=new AudioEncoder({output:()=>e(),error:e=>r(new Error(`Could not create a new AudioEncoder with ${JSON.stringify(t)}: ${e}`))});try{o.configure(t)}catch(e){throw new Error(`Failed to configure an AudioEncoder object with ${JSON.stringify(t)}: ${e}`)}const n=1024,i=new Float32Array(n*t.numberOfChannels);for(let e=0;e<n;++e){const t=e/n;i[2*e+0]=Math.sin(880*Math.PI*t),i[2*e+1]=Math.sin(888*Math.PI*t)}for(let e=0;e<10;++e)try{const r=new AudioData({format:"f32",sampleRate:t.sampleRate,numberOfFrames:n,numberOfChannels:t.numberOfChannels,timestamp:e*n/t.sampleRate*Lu,data:i});o.encode(r),r.close()}catch(e){throw new Error(`Failed to encode AudioData in an encoder configured with ${JSON.stringify(t)}: ${e}`)}o.flush().then((()=>{"closed"!==o.state&&o.close()}),(e=>{r(new Error(`Error during audio export with ${t}: ${e}`))}))}))}function ju(){if("undefined"==typeof window)throw new Error("Window object is not available. This function should be run in a browser environment");const e=["VideoFrame","VideoDecoder","VideoEncoder","AudioDecoder","AudioEncoder"].filter((e=>!(e in window)));if(e.length>0){const t=e.map((e=>`Missing ${e} in the window global`));throw new Error(t.join("\n"))}}function $u(){try{return ju(),!0}catch{return!1}}async function qu(){await Promise.all([Bu(),Ou()])}async function Uu(){try{return await qu(),!0}catch(e){return!1}}var Wu,Hu,Nu=function(){try{const e=!0,t=!0,r="globalThis"in window,o="BigInt"in window,n="allSettled"in Promise,i="matchAll"in String.prototype,s=CSS.supports("contain: content"),a="MediaRecorder"in window&&"pause"in window.MediaRecorder.prototype,l=CSS.supports("color: lab(29.2345% 39.3825 20.0664)");return Iu()&&e&&t&&r&&o&&n&&i&&s&&a&&l}catch{return!1}};(Hu=Wu||(Wu={})).combineLatest=id,Hu.fan=td,Hu.makeSource=Qc,Hu.map=Zc,Hu.memo=ed,Hu.merge=od,Hu.pipe=rd,Hu.startWith=Jc,Hu.switchAll=nd;export{wu as LogLevel,zt as MimeType,_u as WorkerClient,vd as _applyFallback,cd as _getBlockStream,md as _initWithDefaults,ud as _makeEngineChannel,ad as _makeValueChannel,dd as _memoizeResult,wd as _migrateConfigObject,Wu as _streams,yd as _warnKeys,qu as checkVideoExportSupport,ju as checkVideoSupport,CreativeEngine as default,pd as defaultLogger,Pl as isCMYKColor,xl as isRGBAColor,Tl as isSpotColor,gd as normalizeBaseURL,Nu as supportsBrowser,$u as supportsVideo,Uu as supportsVideoExport,Iu as supportsWasm};