@cesdk/engine 1.61.0-nightly.20250915 → 1.61.0-nightly.20250916
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/assets/core/{cesdk-v1.61.0-nightly.20250915-BFOZKXXQ.wasm → cesdk-v1.61.0-nightly.20250916-AT7VXXNL.wasm} +0 -0
- package/assets/core/{worker-host-v1.61.0-nightly.20250915.js → worker-host-v1.61.0-nightly.20250916.js} +1 -1
- package/index.d.ts +69 -2
- package/index.js +1 -1
- package/package.json +1 -1
- /package/assets/core/{cesdk-v1.61.0-nightly.20250915-44YCFRT6.data → cesdk-v1.61.0-nightly.20250916-44YCFRT6.data} +0 -0
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=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,n)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,c=(e,r)=>t(e,"name",{value:r,configurable:!0}),d=(e,t)=>function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(s,a,l)=>(l=null!=s?e(o(s)):{},((e,o,s,a)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===s||t(e,l,{get:()=>o[l],enumerable:!(a=r(o,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,n,o)=>({kind:p[e],name:t,metadata:n,addInitializer:e=>r._?a("Already initialized"):o.push(f(e||null))}),m=(e,t)=>l(t,s("metadata"),e[3]),b=(e,t,r,n)=>{for(var o=0,i=e[t>>1],s=i&&i.length;o<s;o++)1&t?i[o].call(r):n=i[o].call(r,n);return n},y=(e,n,o,i,s,l)=>{var d,u,h,b,y,v=7&n,w=!!(8&n),C=!!(16&n),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[o](){return _(this,l)},set[o](e){return E(this,l,e)}},o));v?C&&v<4&&c(l,(v>2?"set ":v>1?"get ":"")+o):c(s,o);for(var M=i.length-1;M>=0;M--)b=g(v,o,h={},e[3],A),v&&(b.static=w,b.private=C,y=b.access={has:C?e=>k(s,e):e=>o in e},3^v&&(y.get=C?e=>(1^v?_:S)(e,s,4^v?l:F.get):e=>e[o]),v>2&&(y.set=C?(e,t)=>E(e,s,t,4^v?l:F.set):(e,t)=>e[o]=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,o,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,n)=>(w(e,t,"write to private field"),n?n.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(),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();t.exports=o}}),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(),n=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(n,""):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(),n=Object.prototype,o=n.hasOwnProperty,i=n.toString,s=r?r.toStringTag:void 0;t.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var a=i.call(e);return n&&(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(),n=L(),o=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)?n(e):o(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(),n=B();t.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==r(e)}}}),j=d({"../../../node_modules/lodash/toNumber.js"(e,t){var r=M(),n=x(),o=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(o(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(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(),n=A(),o=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,n=c;return l=c=void 0,f=t,u=e.apply(n,r)}function v(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-f>=d}function w(){var e=n();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=n(),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=o(t)||0,r(a)&&(g=!!a.leading,d=(m="maxWait"in a)?i(o(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(n())},_}}}),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 n=e.length;n--;)if(r(e[n][0],t))return n;return-1}}}),H=d({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=W(),n=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=r(t,e);return!(o<0)&&(o==t.length-1?t.pop():n.call(t,o,1),--this.size,!0)}}}),N=d({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=W();t.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][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 n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}}}),G=d({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=q(),n=H(),o=N(),i=V(),s=z();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,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(),n=x();t.exports=function(e){if(!n(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,n=J(),o=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!o&&o 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(),n=ee(),o=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!(!o(e)||n(e))&&(r(e)?u:s).test(i(e))}}}),ne=d({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),oe=d({"../../../node_modules/lodash/_getNative.js"(e,t){var r=re(),n=ne();t.exports=function(e,t){var o=n(e,t);return r(o)?o:void 0}}}),ie=d({"../../../node_modules/lodash/_Map.js"(e,t){var r=oe()(P(),"Map");t.exports=r}}),se=d({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=oe()(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(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(t,e)?t[e]:void 0}}}),de=d({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=se(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:n.call(t,e)}}}),ue=d({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=se();t.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),he=d({"../../../node_modules/lodash/_Hash.js"(e,t){var r=ae(),n=le(),o=ce(),i=de(),s=ue();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),pe=d({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=he(),n=G(),o=ie();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||n),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 n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.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 n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}}}),we=d({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=pe(),n=me(),o=be(),i=ye(),s=ve();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),ke=d({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=G(),n=ie(),o=we();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var s=i.__data__;if(!n||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(s)}return i.set(e,t),this.size=i.size,this}}}),_e=d({"../../../node_modules/lodash/_Stack.js"(e,t){var r=G(),n=X(),o=Y(),i=K(),s=Q(),a=ke();function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=n,l.prototype.delete=o,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(),n=Ce(),o=Ee();function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=n,i.prototype.has=o,t.exports=i}}),xe=d({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)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(),n=xe(),o=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(!n(t,(function(e,t){if(!o(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,n){r[++t]=[n,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(),n=Ae(),o=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 n(e),new n(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+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,n=t.length,o=e.length;++r<n;)e[o+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(),n=Re();t.exports=function(e,t,o){var i=t(e);return n(e)?i:r(i,o(e))}}}),Be=d({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var s=e[r];t(s,r,e)&&(i[o++]=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(),n=Oe(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return o.call(e,t)})))}:n;t.exports=s}}),$e=d({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}}),qe=d({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=D(),n=B();t.exports=function(e){return n(e)&&"[object Arguments]"==r(e)}}}),Ue=d({"../../../node_modules/lodash/isArguments.js"(e,t){var r=qe(),n=B(),o=Object.prototype,i=o.hasOwnProperty,s=o.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return n(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(),n=We(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}}),Ne=d({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&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(),n=Ve(),o=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 o(e)&&n(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(),n="object"==typeof e&&e&&!e.nodeType&&e,o=n&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,s=function(){try{var e=o&&o.require&&o.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(),n=Ge(),o=Xe(),i=o&&o.isTypedArray,s=i?n(i):r;t.exports=s}}),Ke=d({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=$e(),n=Ue(),o=Re(),i=He(),s=Ne(),a=Ye(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),d=!c&&n(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(),n=Je(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return n(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),tt=d({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=Z(),n=Ve();t.exports=function(e){return null!=e&&n(e.length)&&!r(e)}}}),rt=d({"../../../node_modules/lodash/keys.js"(e,t){var r=Ke(),n=et(),o=tt();t.exports=function(e){return o(e)?r(e):n(e)}}}),nt=d({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=De(),n=je(),o=rt();t.exports=function(e){return r(e,o,n)}}}),ot=d({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=nt(),n=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,s,a){var l=1&o,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:n.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,o,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=oe()(P(),"DataView");t.exports=r}}),st=d({"../../../node_modules/lodash/_Promise.js"(e,t){var r=oe()(P(),"Promise");t.exports=r}}),at=d({"../../../node_modules/lodash/_Set.js"(e,t){var r=oe()(P(),"Set");t.exports=r}}),lt=d({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=oe()(P(),"WeakMap");t.exports=r}}),ct=d({"../../../node_modules/lodash/_getTag.js"(e,t){var r=it(),n=ie(),o=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(n),m=l(o),b=l(i),y=l(s),v=a;(r&&v(new r(new ArrayBuffer(1)))!=p||n&&v(new n)!=c||o&&v(o.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,n=r?l(r):"";if(n)switch(n){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(),n=Pe(),o=Ie(),i=ot(),s=ct(),a=Re(),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)?n(e,t,f,g,m,b):o(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(),n=B();t.exports=function e(t,o,i,s,a){return t===o||(null==t||null==o||!n(t)&&!n(o)?t!=t&&o!=o:r(t,o,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=$(),n=x();t.exports=function(e,t,o){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return n(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),r(e,t,{leading:i,maxWait:t,trailing:s})}}}),ft=d({"../../../node_modules/lodash/toFinite.js"(e,t){var r=j(),n=1/0;t.exports=function(e){return e?(e=r(e))===n||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),n=t%1;return t==t?n?t-n:t:0}}}),mt=d({"../../../node_modules/lodash/before.js"(e,t){var r=gt();t.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}}}),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,n=(r="undefined"!=typeof document?document.currentScript?.src:void 0,"undefined"!=typeof __filename&&(r=r||__filename),async function(e={}){var t,n,o,i,s,a,l=e,c=new Promise(((e,r)=>{t=e,n=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,n,o,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 n(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),n.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 o=e.files,i=0;i<o.length;++i)new n(o[i].start,o[i].end,o[i].audio||0).open("GET",o[i].filename);function s(o){r(o,"Loading data file failed."),r(o.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var i=new Uint8Array(o);n.prototype.byteArray=i;for(var s=e.files,a=0;a<s.length;++a)n.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,n=c,o=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):o(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(o);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")??n);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,n=0;for(const t of Object.values(l.dataFileDownloads))e+=t.loaded,n+=t.total;return l.setStatus?.(`Downloading data... (${e}/${n})`),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;o(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=o||(o={}))[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=o.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=[],n=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);n(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",n),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const o=new Uint8Array(t);let i=0;for(const e of r)o.set(e,i),i+=e.length;return this.finish(o)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===o.PENDING}isError(){return this.state===o.ERROR}isFinished(){return this.state===o.FINISHED}isAllocated(){return this.state===o.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:o.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:o.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:o.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,n,o,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,n,o,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(),n=t.createReadStream(r(e.uri));return e.readChunks(n)}async _fetchRemote(e,t,r,n,o,i,a,c){const d=l.UTF8ToString(a,c),u=this.getHeaders(r,n),h=t===s.POST?new Uint8Array(new Uint8Array(l.HEAPU8.buffer,o,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 n=0;n<t;n++){const t=l.getValue(e+4*n,"i32"),o=this._headers.get(t);r[o.key]=o.value}return r}createHeader(e,t,r,n){const o=l.UTF8ToString(e,t),i=l.UTF8ToString(r,n),s=this._nextHeaderHandle++;return this._headers.set(s,{key:o,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),n=l._malloc(t.length+1),o=l.HEAPU8.subarray(n,n+t.length+1);for(let e=0;e<t.length;e++)o[e]=t[e];o[t.length]=0,r[1]=n}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 n=new VideoDecoder({output:o=>{const i=n.textures;let s=!1;if((n.shouldDropFrames||n.decodedFrames<n.requestedFrame||n.decodeQueueSize>=i.length)&&(s=!0),!s){var a=l.ctx;const e=n.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(o):o;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,s),a.bindTexture(a.TEXTURE_2D,r)}o.close(),n.decodedFrames++,l.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,n.decodedFrames,s,r)},error:e=>{n.unexpectedError=e,console.error(e)}});return n.decodedFrames=0,n.requestedFrame=0,n.shouldDropFrames=!1,n.isHdr=t,n},l.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const n=new AudioDecoder({output:o=>{if(n.flushing)return void o.close();const i=l.HEAPF32.subarray(e/4,e/4+r),s=l.HEAPF32.subarray(t/4,t/4+r),a=1===o.numberOfChannels?0:1;if("f32-planar"===o.format){let e=n.writtenFrames%r;if(e+o.numberOfFrames<=r)o.copyTo(i.subarray(e),{planeIndex:0,frameCount:o.numberOfFrames}),o.copyTo(s.subarray(e),{planeIndex:a,frameCount:o.numberOfFrames});else{const t=r-e;o.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),o.copyTo(s.subarray(e),{planeIndex:a,frameCount:t}),o.copyTo(i,{planeIndex:0,frameOffset:t}),o.copyTo(s,{planeIndex:a,frameOffset:t})}n.writtenFrames+=o.numberOfFrames}else if("s16-planar"===o.format)if(1===o.numberOfChannels){const e=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let a=n.writtenFrames%r;i[a]=o,s[a]=o,n.writtenFrames++}}else{const e=new Int16Array(o.numberOfFrames),t=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let a=0;a<o.numberOfFrames;a++){let o=n.writtenFrames%r;i[o]=e[a]/32768,s[o]=t[a]/32768,n.writtenFrames++}}else if("s16"===o.format){const e=new Int16Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let a=n.writtenFrames%r;i[a]=o,s[a]=o,n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let a=n.writtenFrames%r;i[a]=e[t*o.numberOfChannels+0]/32768,s[a]=e[t*o.numberOfChannels+1]/32768,n.writtenFrames++}}else if("f32-planar"===o.format)if(1===o.numberOfChannels){const e=new Float32Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){let o=n.writtenFrames%r;i[o]=e[t],s[o]=e[t],n.writtenFrames++}}else{const e=new Float32Array(o.numberOfFrames),t=new Float32Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let a=0;a<o.numberOfFrames;a++){let o=n.writtenFrames%r;i[o]=e[a],s[o]=t[a],n.writtenFrames++}}else if("f32"===o.format){const e=new Float32Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){let o=n.writtenFrames%r;i[o]=e[t],s[o]=e[t],n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let a=n.writtenFrames%r;i[a]=e[t*o.numberOfChannels+0],s[a]=e[t*o.numberOfChannels+1],n.writtenFrames++}}else console.error("Unsupported audio format:",o.format);o.close()},error:e=>{n.unexpectedError=e,console.error(e)}});return n.writtenFrames=0,n},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(),n=r.split("/").filter(Boolean);let o=e;for(let e=0;e<n.length-1;e++)o=await o.getDirectoryHandle(n[e]);const i=await o.getFileHandle(n[n.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 n=l.emscripten_ubq_opfs_CHUNK_SIZE,o=r*n,i=o+n;l.emscripten_ubq_opfs_ensureFile(e,t).then((async e=>{const n=(await e.getFile()).slice(o,i),s=await n.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,n,o){if(n<=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=n=>{n.data&&n.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),o),s.data.bytes===n?e(n):t(new Error("short read")))};i.addEventListener("message",a),c.post({read:{offset:s,size:n,ptr:o,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 n=l.emscripten_ubq_opfs_CHUNK_SIZE,o=r*n,i=o+n;try{const n=await l.emscripten_ubq_opfs_ensureFile(e,t),s=(await n.getFile()).slice(o,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 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 n(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 n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,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 n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&Y)return Y.decode(e.subarray(t,o));for(var i="";t<o;){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),ne=l.noExitRuntime||!0,oe=e=>Zl(e),ie=()=>ec(),se=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ae=(e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-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-o},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 n=r.get_type();if(!n)return he(0),t;for(var o of e){if(0===o||o===n)break;var i=r.ptr+16;if(nc(o,n,i))return he(o),t}return he(n),t},fe={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,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],n=t[1];return r||n?(n&&(n=n.slice(0,-1)),r+n):"."},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,n=e.length-1;n>=-1&&!r;n--){var o=n>=0?e[n]:Te.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";t=o+"/"+t,r=fe.isAbs(o)}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 n=r(e.split("/")),o=r(t.split("/")),i=Math.min(n.length,o.length),s=i,a=0;a<i;a++)if(n[a]!==o[a]){s=a;break}var l=[];for(a=s;a<n.length;a++)l.push("..");return(l=l.concat(o.slice(s))).join("/")}},be=[],ye=(e,t,r)=>{var n=r>0?r:se(e)+1,o=new Array(n),i=ae(e,o,0,o.length);return t&&(o.length=i),o},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,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Te.ErrnoError(60);for(var i=0,s=0;s<n;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,n,o){if(!e.tty||!e.tty.ops.put_char)throw new Te.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Te.ErrnoError(29)}return n&&(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,n=process.stdin.fd;try{r=w.readSync(n,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,n){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 o=Te.createNode(e,t,r,n);return Te.isDir(o.mode)?(o.node_ops=_e.ops_table.dir.node,o.stream_ops=_e.ops_table.dir.stream,o.contents={}):Te.isFile(o.mode)?(o.node_ops=_e.ops_table.file.node,o.stream_ops=_e.ops_table.file.stream,o.usedBytes=0,o.contents=null):Te.isLink(o.mode)?(o.node_ops=_e.ops_table.link.node,o.stream_ops=_e.ops_table.link.stream):Te.isChrdev(o.mode)&&(o.node_ops=_e.ops_table.chrdev.node,o.stream_ops=_e.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[t]=o,e.atime=e.mtime=e.ctime=o.atime),o},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 n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.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,n)=>_e.createNode(e,t,r,n),rename(e,t,r){var n;try{n=Te.lookupNode(t,r)}catch(e){}if(n){if(Te.isDir(e.mode))for(var o in n.contents)throw new Te.ErrnoError(55);Te.hashRemoveNode(n)}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 n 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 n=_e.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Te.isLink(e.mode))throw new Te.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&i.subarray)t.set(i.subarray(o,o+s),r);else for(var a=0;a<s;a++)t[r+a]=i[o+a];return s},write(e,t,r,n,o,i){if(t.buffer===S.buffer&&(i=!1),!n)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+n),s.usedBytes=n,n;if(0===s.usedBytes&&0===o)return s.contents=t.slice(r,r+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(t.subarray(r,r+n),o),n}if(_e.expandFileStorage(s,o+n),s.contents.subarray&&t.subarray)s.contents.set(t.subarray(r,r+n),o);else for(var a=0;a<n;a++)s.contents[o+a]=t[r+a];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Te.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Te.ErrnoError(28);return n},mmap(e,t,r,n,o){if(!Te.isFile(e.node.mode))throw new Te.ErrnoError(43);var i,s,a=e.node.contents;if(2&o||!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,n,o)=>(_e.stream_ops.write(e,t,0,n,r,!1),0)}},Ce=(e,t,r,n,o,i)=>{Te.createDataFile(e,t,r,n,o,i)},Ee=l.preloadPlugins||[],Se=(e,t,r,n,o,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,n,o,l),i?.(),N()}((e,t,r,n)=>{void 0!==br&&br.init();var o=!1;return Ee.forEach((i=>{o||i.canHandle(t)&&(i.handle(e,t,r,n),o=!0)})),o})(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,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=Te.nextInode++,this.name=t,this.mode=r,this.rdev=n,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 n=e.split("/").filter((e=>!!e)),o=Te.root,i="/",s=0;s<n.length;s++){var a=s===n.length-1;if(a&&t.parent)break;if("."!==n[s])if(".."!==n[s]){i=fe.join2(i,n[s]);try{o=Te.lookupNode(o,n[s])}catch(e){if(44===e?.errno&&a&&t.noent_okay)return{path:i};throw e}if(!Te.isMountpoint(o)||a&&!t.follow_mount||(o=o.mounted.root),Te.isLink(o.mode)&&(!a||t.follow)){if(!o.node_ops.readlink)throw new Te.ErrnoError(52);var l=o.node_ops.readlink(o);fe.isAbs(l)||(l=fe.dirname(i)+"/"+l),e=l+"/"+n.slice(s+1).join("/");continue e}}else i=fe.dirname(i),o=o.parent}return{path:i,node:o}}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,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|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 n=Te.hashName(e.id,t),o=Te.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return Te.lookup(e,t)},createNode(e,t,r,n){var o=new Te.FSNode(e,t,r,n);return Te.hashAddNode(o),o},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 n;try{n=Te.lookupNode(e,t)}catch(e){return e.errno}var o=Te.nodePermissions(e,"wx");if(o)return o;if(r){if(!Te.isDir(n.mode))return 54;if(Te.isRoot(n)||Te.getPath(n)===Te.cwd())return 10}else if(Te.isDir(n.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 n=e?.stream_ops.setattr,o=n?e:t;n??=t.node_ops.setattr,Te.checkOpExists(n,63),n(o,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 n=r.pop();t.push(n),r.push(...n.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),n=0;function o(e){return Te.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var n,o="/"===r,i=!r;if(o&&Te.root)throw new Te.ErrnoError(10);if(!o&&!i){var s=Te.lookupPath(r,{follow_mount:!1});if(r=s.path,n=s.node,Te.isMountpoint(n))throw new Te.ErrnoError(10);if(!Te.isDir(n.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,o?Te.root=l:n&&(n.mounted=a,n.mount&&n.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,n=r.mounted,o=Te.getMounts(n);Object.keys(Te.nameTable).forEach((e=>{for(var t=Te.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&Te.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Te.lookupPath(e,{parent:!0}).node,o=fe.basename(e);if(!o)throw new Te.ErrnoError(28);if("."===o||".."===o)throw new Te.ErrnoError(20);var i=Te.mayCreate(n,o);if(i)throw new Te.ErrnoError(i);if(!n.node_ops.mknod)throw new Te.ErrnoError(63);return n.node_ops.mknod(n,o,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("/"),n="";for(var o of r)if(o){n+="/"+o;try{Te.mkdir(n,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 n=fe.basename(t),o=Te.mayCreate(r,n);if(o)throw new Te.ErrnoError(o);if(!r.node_ops.symlink)throw new Te.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,o=fe.dirname(e),i=fe.dirname(t),s=fe.basename(e),a=fe.basename(t);if(r=Te.lookupPath(e,{parent:!0}).node,n=Te.lookupPath(t,{parent:!0}).node,!r||!n)throw new Te.ErrnoError(44);if(r.mount!==n.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,o)).charAt(0))throw new Te.ErrnoError(55);try{l=Te.lookupNode(n,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(n,a,u):Te.mayCreate(n,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(n!==r&&(h=Te.nodePermissions(r,"w")))throw new Te.ErrnoError(h);Te.hashRemoveNode(c);try{r.node_ops.rename(c,n,a),c.parent=n}catch(e){throw e}finally{Te.hashAddNode(c)}}},rmdir(e){var t=Te.lookupPath(e,{parent:!0}).node,r=fe.basename(e),n=Te.lookupNode(t,r),o=Te.mayDelete(t,r,!0);if(o)throw new Te.ErrnoError(o);if(!t.node_ops.rmdir)throw new Te.ErrnoError(63);if(Te.isMountpoint(n))throw new Te.ErrnoError(10);t.node_ops.rmdir(t,r),Te.destroyNode(n)},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),n=Te.lookupNode(t,r),o=Te.mayDelete(t,r,!1);if(o)throw new Te.ErrnoError(o);if(!t.node_ops.unlink)throw new Te.ErrnoError(63);if(Te.isMountpoint(n))throw new Te.ErrnoError(10);t.node_ops.unlink(t,r),Te.destroyNode(n)},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,n=t.stream_ops.getattr,o=n?t:r;return n??=r.node_ops.getattr,Te.checkOpExists(n,63),n(o)},lstat:e=>Te.stat(e,!0),doChmod(e,t,r,n){Te.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:n})},chmod(e,t,r){var n;n="string"==typeof e?Te.lookupPath(e,{follow:!r}).node:e,Te.doChmod(null,n,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,n){var o;o="string"==typeof e?Te.lookupPath(e,{follow:!n}).node:e,Te.doChown(null,o,n)},lchown(e,t,r){Te.chown(e,t,r,!0)},fchown(e,t,r){var n=Te.getStreamChecked(e);Te.doChown(n,n.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 n=Te.nodePermissions(t,"w");if(n)throw new Te.ErrnoError(n);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 n=Te.lookupPath(e,{follow:!0}).node;Te.checkOpExists(n.node_ops.setattr,63)(n,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Te.ErrnoError(44);var n,o;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)n=e;else{o=e.endsWith("/");var i=Te.lookupPath(e,{follow:!(131072&t),noent_okay:!0});n=i.node,e=i.path}var s=!1;if(64&t)if(n){if(128&t)throw new Te.ErrnoError(20)}else{if(o)throw new Te.ErrnoError(31);n=Te.mknod(e,511|r,0),s=!0}if(!n)throw new Te.ErrnoError(44);if(Te.isChrdev(n.mode)&&(t&=-513),65536&t&&!Te.isDir(n.mode))throw new Te.ErrnoError(54);if(!s){var a=Te.mayOpen(n,t);if(a)throw new Te.ErrnoError(a)}512&t&&!s&&Te.truncate(n,0),t&=-131713;var c=Te.createStream({node:n,path:Te.getPath(n),flags:t,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&Te.chmod(n,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,n,o){if(n<0||o<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!==o;if(i){if(!e.seekable)throw new Te.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,t,r,n,o);return i||(e.position+=s),s},write(e,t,r,n,o,i){if(n<0||o<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!==o;if(s){if(!e.seekable)throw new Te.ErrnoError(70)}else o=e.position;var a=e.stream_ops.write(e,t,r,n,o,i);return s||(e.position+=a),a},mmap(e,t,r,n,o){if(0!=(2&n)&&0==(2&o)&&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,n,o)},msync:(e,t,r,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,o):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,n=Te.open(e,t.flags),o=Te.stat(e).size,i=new Uint8Array(o);return Te.read(n,i,0,o,0),"utf8"===t.encoding?r=K(i):"binary"===t.encoding&&(r=i),Te.close(n),r},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Te.open(e,r.flags,r.mode);if("string"==typeof t){var o=new Uint8Array(se(t)+1),i=ae(t,o,0,o.length);Te.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Te.write(n,t,0,t.byteLength,void 0,r.canOwn)}Te.close(n)},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,n,o)=>n,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,n=Te.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:r+1};return o.parent=o,o},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=(n=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 n=Te.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=fe.basename(e),n=Te.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Te.getPath(e);for(var o=t.split("/").reverse();o.length;){var i=o.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,n,o){var i=fe.join2("string"==typeof e?e:Te.getPath(e),t),s=xe(n,o);return Te.create(i,s)},createDataFile(e,t,r,n,o,i){var s=t;e&&(e="string"==typeof e?e:Te.getPath(e),s=t?fe.join2(e,t):e);var a=xe(n,o),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,n){var o=fe.join2("string"==typeof e?e:Te.getPath(e),t),i=xe(!!r,!!n);Te.createDevice.major??=64;var s=Te.makedev(Te.createDevice.major++,0);return Te.registerDevice(s,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,o,i){for(var s=0,a=0;a<o;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[n+a]=l}return s&&(e.node.atime=Date.now()),s},write(e,t,r,o,i){for(var s=0;s<o;s++)try{n(t[r+s])}catch(e){throw new Te.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),s}}),Te.mkdev(o,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,n,o){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,n=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;o||(s=n);var a=this;a.setDataGetter((e=>{var t=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-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>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==s&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ye(o.responseText||"",!0)})(t,o)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!i&&n||(s=n=1,n=this.getter(0).length,s=n,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,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,n,o);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,n,o){var i=e.node.contents;if(o>=i.length)return 0;var s=Math.min(i.length-o,n);if(i.slice)for(var a=0;a<s;a++)t[r+a]=i[o+a];else for(a=0;a<s;a++)t[r+a]=i.get(o+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,n,o)=>(Te.forceLoadFile(s),l(e,t,r,n,o)),a.mmap=(e,t,r,n,o)=>{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 n;if(n=-100===e?Te.cwd():Pe.getStreamFromFD(e).path,0==t.length){if(!r)throw new Te.ErrnoError(44);return n}return n+"/"+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(),n=t.mtime.getTime(),o=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(n/1e3)),F[e+64>>2]=n%1e3*1e3*1e3,I[e+72>>3]=BigInt(Math.floor(o/1e3)),F[e+80>>2]=o%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,n,o){if(!Te.isFile(t.node.mode))throw new Te.ErrnoError(43);if(2&n)return 0;var i=x.slice(e,e+r);Te.msync(t,i,o,r,n)},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 n(t){var n=r(t);n.length!==e.length&&$e("Mismatched type converter count");for(var o=0;o<e.length;++o)ze(e[o],n[o])}e.forEach((e=>Oe[e]=t));var o=new Array(t.length),i=[],s=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?o[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{o[t]=Be[e],++s===i.length&&n(o)})))})),0===i.length&&n(o)},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+=Re[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 n=t.name;if(e||Ve(`type "${n}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Ve(`Cannot register type '${n}' twice`)}if(Be[e]=t,delete Oe[e],De.hasOwnProperty(e)){var o=De[e];delete De[e],o.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 n=Je(e,t,r.baseClass);return null===n?null:r.downcast(n)},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]),nt=(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 ot(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 n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?nt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):nt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,s=this.registeredClass.getActualType(t),a=et[s];if(!a)return o.call(this);i=this.isConst?a.constPointerType:a.pointerType;var l=Je(t,this.registeredClass,i.registeredClass);return null===l?o.call(this):this.isSmartPointer?nt(i.registeredClass.instancePrototype,{ptrType:i,ptr:l,smartPtrType:this,smartPtr:e}):nt(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 n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||Ve(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},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,n,o,i,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,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 n=t.$$.ptrType.registeredClass;if(r=ht(t.$$.ptr,n,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 o=t.clone();r=this.rawShare(r,Ot.toHandle((()=>o.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,n,o,i,s,a,l,c,d){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=d,o||void 0!==t.baseClass?this.toWireType=ft:n?(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 Nl(t),r},Pt=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||Be[t]||(Oe[t]?Oe[t].forEach(e):(r.push(t),n[t]=!0))})),new xt(`${e}: `+r.map(Tt).join([", "]))},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(F[t+4*n>>2]);return r};function Ft(e,t,r,n,o,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]=o,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 n=a?1:2;n<t.length;n++){var o=1===n?r:u[n-2];null!==t[n].destructorFunction&&t[n].destructorFunction(o)}if(c)return t[0].fromWireType(e)}(n(...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),Ht="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Nt=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&P[n];)++n;if((r=n<<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 n=t,o=(r-=2)<2*e.length?r/2:e.length,i=0;i<o;++i){var s=e.charCodeAt(i);T[t>>1]=s,t+=2}return T[t>>1]=0,t-n},zt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=A[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Xt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+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>o)break}return A[t>>2]=0,t-n},Yt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},Kt=0,Qt=(e,t,r)=>{var n=[],o=e.toWireType(n,r);return n.length&&(F[t>>2]=Ot.toHandle(n)),o},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,nr=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),or=[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:or)[e.getMonth()]+e.getDate()-1},ar={},lr=e=>{if(e instanceof ExitStatus||"unwind"==e)return E;y(1,e)},cr=()=>ne||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,n){var o=new Blob([e],{type:br.getMimetype(t)});o.size!==e.length&&(o=new Blob([new Uint8Array(e).buffer],{type:br.getMimetype(t)}));var i=URL.createObjectURL(o),s=new Image;s.onload=()=>{var n=document.createElement("canvas");n.width=s.width,n.height=s.height,n.getContext("2d").drawImage(s,0,0),br.preloadedImages[t]=n,URL.revokeObjectURL(i),r?.(e)},s.onerror=e=>{_(`Image ${i} could not be decoded`),n?.()},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,n){var o=!1;function i(n){o||(o=!0,br.preloadedAudios[t]=n,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){o||(_(`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="",n=0,o=0,i=0;i<e.length;i++)for(n=n<<8|e[i],o+=8;o>=6;){var s=n>>o-6&63;o-=6,r+=t[s]}return 2==o?(r+=t[(3&n)<<4],r+="=="):4==o&&(r+=t[(15&n)<<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",n,!1),document.addEventListener("mozpointerlockchange",n,!1),document.addEventListener("webkitpointerlockchange",n,!1),document.addEventListener("mspointerlockchange",n,!1),l.elementPointerLock&&r.addEventListener("click",(e=>{!br.pointerLock&&br.getCanvas().requestPointerLock&&(br.getCanvas().requestPointerLock(),e.preventDefault())}),!1))}function n(){var e=br.getCanvas();br.pointerLock=document.pointerLockElement===e||document.mozPointerLockElement===e||document.webkitPointerLockElement===e||document.msPointerLockElement===e}},createContext(e,t,r,n){if(t&&l.ctx&&e==br.getCanvas())return l.ctx;var o,i;if(t){var s={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(n)for(var a in n)s[a]=n[a];void 0!==vr&&(i=vr.createContext(e,s))&&(o=vr.getContext(i).GLctx)}else o=e.getContext("2d");return o?(r&&(l.ctx=o,t&&vr.makeContextCurrent(i),br.useWebGL=t,br.moduleContextCreatedCallbacks.forEach((e=>e())),br.init()),o):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 n(){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",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var o=document.createElement("div");r.parentNode.insertBefore(o,r),o.appendChild(r),o.requestFullscreen=o.requestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen||(o.webkitRequestFullscreen?()=>o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(o.webkitRequestFullScreen?()=>o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),o.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(),n=r.getBoundingClientRect(),o=void 0!==window.scrollX?window.scrollX:window.pageXOffset,i=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(o+n.left),a=t-(i+n.top);return{x:s*=r.width/n.width,y:a*=r.height/n.height}},setMouseCoords(e,t){const{x:r,y:n}=br.calculateMouseCoords(e,t);br.mouseMovementX=r-br.mouseX,br.mouseMovementY=n-br.mouseY,br.mouseX=r,br.mouseY=n},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 n=br.touches[t.identifier];n||=r,br.lastTouches[t.identifier]=n,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 n=br.getCanvas();br.updateCanvasDimensions(n,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 n=t,o=r;if(l.forcedAspectRatio>0&&(n/o<l.forcedAspectRatio?n=Math.round(o*l.forcedAspectRatio):o=Math.round(n/l.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/n,screen.height/o);n=Math.round(n*i),o=Math.round(o*i)}br.resizeCanvas?(e.width!=n&&(e.width=n),e.height!=o&&(e.height=o),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&&(n!=t||o!=r?(e.style.setProperty("width",n+"px","important"),e.style.setProperty("height",o+"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,n,o){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&&n||o?(o&&(A[o>>2]=1),r&&n>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,n)=>{for(var o=0;o<e;o++){var i=Mt[r](),s=i&&vr.getNewId(n);i?(i.name=s,n[s]=i):vr.recordError(1282),A[t+4*o>>2]=s}},getSource:(e,t,r,n)=>{for(var o="",i=0;i<t;++i){var s=n?F[n+4*i>>2]:void 0;o+=Q(F[r+4*i>>2],s)}return o},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n: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),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),vr.contexts[r]=n,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 n=((e,t)=>{var r;for(wr.length=0;r=x[e++];){var n=105!=r;t+=(n&=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+=n?8:4}return wr})(t,r);return $l[e](...n)},_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,n,o)=>{Mt.bindBufferRange(e,t,vr.buffers[r],n,o)},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,n)=>Mt.blendColor(e,t,r,n),Ur=e=>Mt.blendEquation(e),Wr=(e,t)=>Mt.blendEquationSeparate(e,t),Hr=(e,t)=>Mt.blendFunc(e,t),Nr=(e,t,r,n)=>Mt.blendFuncSeparate(e,t,r,n),Vr=(e,t,r,n,o,i,s,a,l,c)=>Mt.blitFramebuffer(e,t,r,n,o,i,s,a,l,c),zr=(e,t,r,n)=>{vr.currentContext.version>=2?r&&t?Mt.bufferData(e,x,n,r,t):Mt.bufferData(e,t,n):Mt.bufferData(e,r?x.subarray(r,r+t):t,n)},Gr=(e,t,r,n)=>{vr.currentContext.version>=2?r&&Mt.bufferSubData(e,t,x,n,r):Mt.bufferSubData(e,t,x.subarray(n,n+r))},Xr=e=>Mt.checkFramebufferStatus(e),Yr=e=>Mt.clear(e),Kr=(e,t,r,n)=>Mt.clearBufferfi(e,t,r,n),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)},en=(e,t,r,n)=>Mt.clearColor(e,t,r,n),tn=e=>Mt.clearDepth(e),rn=e=>Mt.clearStencil(e),nn=(e,t,r)=>(r=Number(r),Mt.clientWaitSync(vr.syncs[e],t,r)),on=(e,t)=>{Mt.extClipControl.clipControlEXT(e,t)},sn=(e,t,r,n)=>{Mt.colorMask(!!e,!!t,!!r,!!n)},an=e=>{Mt.compileShader(vr.shaders[e])},ln=(e,t,r,n,o,i,s,a)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!s?void Mt.compressedTexImage2D(e,t,r,n,o,i,s,a):void Mt.compressedTexImage2D(e,t,r,n,o,i,x,a,s);Mt.compressedTexImage2D(e,t,r,n,o,i,x.subarray(a,a+s))},cn=(e,t,r,n,o,i,s,a,l)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexImage3D(e,t,r,n,o,i,s,a,l):Mt.compressedTexImage3D(e,t,r,n,o,i,s,x,l,a)},dn=(e,t,r,n,o,i,s,a,l)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!a?void Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,a,l):void Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,x,l,a);Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,x.subarray(l,l+a))},un=(e,t,r,n,o,i,s,a,l,c,d)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexSubImage3D(e,t,r,n,o,i,s,a,l,c,d):Mt.compressedTexSubImage3D(e,t,r,n,o,i,s,a,l,x,d,c)},hn=(e,t,r,n,o)=>Mt.copyBufferSubData(e,t,r,n,o),pn=(e,t,r,n,o,i,s,a)=>Mt.copyTexImage2D(e,t,r,n,o,i,s,a),fn=(e,t,r,n,o,i,s,a)=>Mt.copyTexSubImage2D(e,t,r,n,o,i,s,a),gn=(e,t,r,n,o,i,s,a,l)=>Mt.copyTexSubImage3D(e,t,r,n,o,i,s,a,l),mn=()=>{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},bn=e=>{var t=vr.getNewId(vr.shaders);return vr.shaders[t]=Mt.createShader(e),t},yn=e=>Mt.cullFace(e),vn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.buffers[n];o&&(Mt.deleteBuffer(o),o.name=0,vr.buffers[n]=null,n==Mt.currentPixelPackBufferBinding&&(Mt.currentPixelPackBufferBinding=0),n==Mt.currentPixelUnpackBufferBinding&&(Mt.currentPixelUnpackBufferBinding=0))}},wn=(e,t)=>{for(var r=0;r<e;++r){var n=A[t+4*r>>2],o=vr.framebuffers[n];o&&(Mt.deleteFramebuffer(o),o.name=0,vr.framebuffers[n]=null)}},kn=e=>{if(e){var t=vr.programs[e];t?(Mt.deleteProgram(t),t.name=0,vr.programs[e]=null):vr.recordError(1281)}},_n=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.queries[n];o&&(Mt.deleteQuery(o),vr.queries[n]=null)}},Cn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.queries[n];o&&(Mt.disjointTimerQueryExt.deleteQueryEXT(o),vr.queries[n]=null)}},En=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.renderbuffers[n];o&&(Mt.deleteRenderbuffer(o),o.name=0,vr.renderbuffers[n]=null)}},Sn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.samplers[n];o&&(Mt.deleteSampler(o),o.name=0,vr.samplers[n]=null)}},xn=e=>{if(e){var t=vr.shaders[e];t?(Mt.deleteShader(t),vr.shaders[e]=null):vr.recordError(1281)}},Tn=e=>{if(e){var t=vr.syncs[e];t?(Mt.deleteSync(t),t.name=0,vr.syncs[e]=null):vr.recordError(1281)}},Pn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.textures[n];o&&(Mt.deleteTexture(o),o.name=0,vr.textures[n]=null)}},An=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.transformFeedbacks[n];o&&(Mt.deleteTransformFeedback(o),o.name=0,vr.transformFeedbacks[n]=null)}},Fn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2];Mt.deleteVertexArray(vr.vaos[n]),vr.vaos[n]=null}},Mn=Fn,In=Fn,Ln=In,Rn=e=>Mt.depthFunc(e),Dn=e=>{Mt.depthMask(!!e)},Bn=(e,t)=>Mt.depthRange(e,t),On=(e,t)=>{Mt.detachShader(vr.programs[e],vr.shaders[t])},jn=e=>Mt.disable(e),$n=e=>{Mt.disableVertexAttribArray(e)},qn=(e,t,r)=>{Mt.drawArrays(e,t,r)},Un=(e,t,r,n)=>{Mt.drawArraysInstanced(e,t,r,n)},Wn=Un,Hn=Un,Nn=Hn,Vn=Un,zn=Vn,Gn=(e,t,r,n,o)=>{Mt.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,o)},Xn=Un,Yn=Xn,Kn=Un,Qn=Kn,Zn=[],Jn=(e,t)=>{for(var r=Zn[e],n=0;n<e;n++)r[n]=A[t+4*n>>2];Mt.drawBuffers(r)},eo=Jn,to=Jn,ro=to,no=Jn,oo=no,io=(e,t,r,n)=>{Mt.drawElements(e,t,r,n)},so=io,ao=(e,t,r,n,o)=>{Mt.drawElementsInstanced(e,t,r,n,o)},lo=ao,co=ao,uo=co,ho=ao,po=ho,fo=(e,t,r,n,o,i,s)=>{Mt.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,o,i,s)},go=ao,mo=go,bo=ao,yo=bo,vo=(e,t,r,n,o,i)=>{io(e,n,o,i)},wo=e=>Mt.enable(e),ko=e=>{Mt.enableVertexAttribArray(e)},_o=e=>Mt.endQuery(e),Co=e=>{Mt.disjointTimerQueryExt.endQueryEXT(e)},Eo=()=>Mt.endTransformFeedback(),So=(e,t)=>{var r=Mt.fenceSync(e,t);if(r){var n=vr.getNewId(vr.syncs);return r.name=n,vr.syncs[n]=r,n}return 0},xo=()=>Mt.finish(),To=()=>Mt.flush(),Po=(e,t,r,n)=>{Mt.framebufferRenderbuffer(e,t,r,vr.renderbuffers[n])},Ao=(e,t,r,n,o)=>{Mt.framebufferTexture2D(e,t,r,vr.textures[n],o)},Fo=(e,t,r,n,o)=>{Mt.framebufferTextureLayer(e,t,vr.textures[r],n,o)},Mo=e=>Mt.frontFace(e),Io=(e,t)=>{vr.genObject(e,t,"createBuffer",vr.buffers)},Lo=(e,t)=>{vr.genObject(e,t,"createFramebuffer",vr.framebuffers)},Ro=(e,t)=>{vr.genObject(e,t,"createQuery",vr.queries)},Do=(e,t)=>{for(var r=0;r<e;r++){var n=Mt.disjointTimerQueryExt.createQueryEXT();if(!n){for(vr.recordError(1282);r<e;)A[t+4*r++>>2]=0;return}var o=vr.getNewId(vr.queries);n.name=o,vr.queries[o]=n,A[t+4*r>>2]=o}},Bo=(e,t)=>{vr.genObject(e,t,"createRenderbuffer",vr.renderbuffers)},Oo=(e,t)=>{vr.genObject(e,t,"createSampler",vr.samplers)},jo=(e,t)=>{vr.genObject(e,t,"createTexture",vr.textures)},$o=(e,t)=>{vr.genObject(e,t,"createTransformFeedback",vr.transformFeedbacks)},qo=(e,t)=>{vr.genObject(e,t,"createVertexArray",vr.vaos)},Uo=qo,Wo=qo,Ho=Wo,No=e=>Mt.generateMipmap(e),Vo=(e,t,r,n,o,i,s,a)=>{t=vr.programs[t];var l=Mt[e](t,r);if(l){var c=a&&le(l.name,a,n);o&&(A[o>>2]=c),i&&(A[i>>2]=l.size),s&&(A[s>>2]=l.type)}},zo=(e,t,r,n,o,i,s)=>Vo("getActiveAttrib",e,t,r,n,o,i,s),Go=(e,t,r,n,o,i,s)=>Vo("getActiveUniform",e,t,r,n,o,i,s),Xo=(e,t,r,n,o)=>{e=vr.programs[e];var i=Mt.getActiveUniformBlockName(e,t);if(i)if(o&&r>0){var s=le(i,o,r);n&&(A[n>>2]=s)}else n&&(A[n>>2]=0)},Yo=(e,t,r,n)=>{if(n)if(e=vr.programs[e],35393!=r){var o=Mt.getActiveUniformBlockParameter(e,t,r);if(null!==o)if(35395==r)for(var i=0;i<o.length;i++)A[n+4*i>>2]=o[i];else A[n>>2]=o}else{var s=Mt.getActiveUniformBlockName(e,t);A[n>>2]=s.length+1}else vr.recordError(1281)},Ko=(e,t,r,n,o)=>{if(o)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,n);if(a){var l=a.length;for(s=0;s<l;s++)A[o+4*s>>2]=a[s]}}else vr.recordError(1281)},Qo=(e,t,r,n)=>{var o=Mt.getAttachedShaders(vr.programs[e]),i=o.length;i>t&&(i=t),A[r>>2]=i;for(var s=0;s<i;++s){var a=vr.shaders.indexOf(o[s]);A[n+4*s>>2]=a}},Zo=(e,t)=>Mt.getAttribLocation(vr.programs[e],Q(t)),Jo=(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 n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&vr.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var o=Mt.getParameter(34467);n=o?o.length:0;break;case 33309:if(vr.currentContext.version<2)return void vr.recordError(1282);n=ei().length;break;case 33307:case 33308:if(vr.currentContext.version<2)return void vr.recordError(1280);n=33307==e?3:0}if(void 0===n){var i=Mt.getParameter(e);switch(typeof i){case"number":n=i;break;case"boolean":n=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:n=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{n=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:Jo(t,n);break;case 0:A[t>>2]=n;break;case 2:M[t>>2]=n;break;case 4:S[t]=n?1:0}}else vr.recordError(1281)},ri=(e,t)=>ti(e,t,4),ni=(e,t,r)=>{r?Jo(r,Mt.getBufferParameter(e,t)):vr.recordError(1281)},oi=(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,n)=>{var o=Mt.getFramebufferAttachmentParameter(e,t,r);(o instanceof WebGLRenderbuffer||o instanceof WebGLTexture)&&(o=0|o.name),A[n>>2]=o},ci=(e,t,r,n)=>{if(r){var o,i=Mt.getIndexedParameter(e,t);switch(typeof i){case"boolean":o=i?1:0;break;case"number":o=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:o=0;break;default:return void vr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void vr.recordError(1280);o=0|i.name}break;default:return void vr.recordError(1280)}switch(n){case 1:Jo(r,o);break;case 0:A[r>>2]=o;break;case 2:M[r>>2]=o;break;case 4:S[r]=o?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+n}}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,n,o)=>{if(n<0)vr.recordError(1281);else if(o){var i=Mt.getInternalformatParameter(e,t,r);if(null!==i)for(var s=0;s<i.length&&s<n;++s)A[o+4*s>>2]=i[s]}else vr.recordError(1281)},gi=(e,t,r,n,o)=>{vr.recordError(1282)},mi=(e,t,r,n)=>{var o=Mt.getProgramInfoLog(vr.programs[e]);null===o&&(o="(unknown error)");var i=t>0&&n?le(o,n,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 n=Mt.getProgramInfoLog(e);null===n&&(n="(unknown error)"),A[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var o=Mt.getProgramParameter(e,35718),i=0;i<o;++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 n,o=vr.queries[e];n=vr.currentContext.version<2?Mt.disjointTimerQueryExt.getQueryObjectEXT(o,t):Mt.getQueryParameter(o,t),Jo(r,"boolean"==typeof n?n?1:0:n)}else vr.recordError(1281)},vi=yi,wi=(e,t,r)=>{if(r){var n,o=vr.queries[e],i=Mt.disjointTimerQueryExt.getQueryObjectEXT(o,t);n="boolean"==typeof i?i?1:0:i,A[r>>2]=n}else vr.recordError(1281)},ki=wi,_i=yi,Ci=_i,Ei=(e,t,r)=>{if(r){var n,o=vr.queries[e],i=Mt.getQueryParameter(o,t);n="boolean"==typeof i?i?1:0:i,A[r>>2]=n}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,n)=>{var o=Mt.getShaderInfoLog(vr.shaders[e]);null===o&&(o="(unknown error)");var i=t>0&&n?le(o,n,t):0;r&&(A[r>>2]=i)},Li=(e,t,r,n)=>{var o=Mt.getShaderPrecisionFormat(e,t);A[r>>2]=o.rangeMin,A[r+4>>2]=o.rangeMax,A[n>>2]=o.precision},Ri=(e,t,r,n)=>{var o=Mt.getShaderSource(vr.shaders[e]);if(o){var i=t>0&&n?le(o,n,t):0;r&&(A[r>>2]=i)}},Di=(e,t,r)=>{if(r)if(35716==t){var n=Mt.getShaderInfoLog(vr.shaders[e]);null===n&&(n="(unknown error)");var o=n?n.length+1:0;A[r>>2]=o}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 n=Mt.getParameter(7938),o=`OpenGL ES 2.0 (${n})`;vr.currentContext.version>=2&&(o=`OpenGL ES 3.0 (${n})`),t=ce(o);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 n=ei().map(ce);return r=vr.stringiCache[e]=n,t<0||t>=r.length?(vr.recordError(1281),0):r[t]}return vr.recordError(1280),0},ji=(e,t,r,n,o)=>{if(r<0)vr.recordError(1281);else if(o){var i=Mt.getSyncParameter(vr.syncs[e],t);null!==i&&(A[o>>2]=i,n&&(A[n>>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,n,o,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);n&&(A[n>>2]=l)}else n&&(A[n>>2]=0);o&&(A[o>>2]=a.size),i&&(A[i>>2]=a.type)}},Wi=(e,t)=>Mt.getUniformBlockIndex(vr.programs[e],Q(t)),Hi=(e,t,r,n)=>{if(n)if(t>0&&(0==r||0==n))vr.recordError(1281);else{e=vr.programs[e];for(var o=[],i=0;i<t;i++)o.push(Q(A[r+4*i>>2]));var s=Mt.getUniformIndices(e,o);if(s){var a=s.length;for(i=0;i<a;i++)A[n+4*i>>2]=s[i]}}else vr.recordError(1281)},Ni=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),Vi=e=>{var t,r,n=e.uniformLocsById,o=e.uniformSizeAndIdsByName;if(!n){e.uniformLocsById=n={},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,o[d]=[l,u],r=0;r<l;++r)n[u]=r,e.uniformArrayNamesById[u++]=d}}},zi=(e,t)=>{if(t=Q(t),e=vr.programs[e]){Vi(e);var r=e.uniformLocsById,n=0,o=t,i=Ni(t);i>0&&(a=t.slice(i+1),n=parseInt(a)>>>0,o=t.slice(0,i));var s=e.uniformSizeAndIdsByName[o];if(s&&n<s[0]&&(r[n+=s[1]]=r[n]||Mt.getUniformLocation(e,t)))return n}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,n)=>{if(r){e=vr.programs[e],Vi(e);var o=Mt.getUniform(e,Gi(t));if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:A[r>>2]=o;break;case 2:M[r>>2]=o}else for(var i=0;i<o.length;i++)switch(n){case 0:A[r+4*i>>2]=o[i];break;case 2:M[r+4*i>>2]=o[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,n)=>{if(r){var o=Mt.getVertexAttrib(e,t);if(34975==t)A[r>>2]=o&&o.name;else if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:A[r>>2]=o;break;case 2:M[r>>2]=o;break;case 5:A[r>>2]=Math.fround(o)}else for(var i=0;i<o.length;i++)switch(n){case 0:A[r+4*i>>2]=o[i];break;case 2:M[r+4*i>>2]=o[i];break;case 5:A[r+4*i>>2]=Math.fround(o[i])}}else vr.recordError(1281)},Ji=(e,t,r)=>{Zi(e,t,r,0)},es=Ji,ts=Ji,rs=ts,ns=(e,t,r)=>{r?A[r>>2]=Mt.getVertexAttribOffset(e,t):vr.recordError(1281)},os=(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 n=Zn[t],o=0;o<t;o++)n[o]=A[r+4*o>>2];Mt.invalidateFramebuffer(e,n)},ls=(e,t,r,n,o,i,s)=>{for(var a=Zn[t],l=0;l<t;l++)a[l]=A[r+4*l>>2];Mt.invalidateSubFramebuffer(e,a,n,o,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,n,o,i)=>{Mt.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,A,t>>2,A,r>>2,A,n>>2,F,o>>2,i)},Ps=(e,t,r,n,o,i,s,a)=>{Mt.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,A,t>>2,r,A,n>>2,A,o>>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,n)=>{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,n,o,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 n,o,i=(vr.unpackRowLength||e)*r;return t*(n=i,o=vr.unpackAlignment,n+o-1&-o)})(r,n,a);return s.subarray($s(o,s),$s(o+l,s))},Us=(e,t,r,n,o,i,s)=>{if(vr.currentContext.version>=2){if(Mt.currentPixelPackBufferBinding)return void Mt.readPixels(e,t,r,n,o,i,s);var a=js(i),l=$s(s,a);Mt.readPixels(e,t,r,n,o,i,a,l)}else{var c=qs(i,o,r,n,s);c?Mt.readPixels(e,t,r,n,o,i,c):vr.recordError(1280)}},Ws=()=>{},Hs=(e,t,r,n)=>Mt.renderbufferStorage(e,t,r,n),Ns=(e,t,r,n,o)=>Mt.renderbufferStorageMultisample(e,t,r,n,o),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 n=M[r>>2];Mt.samplerParameterf(vr.samplers[e],t,n)},Ys=(e,t,r)=>{Mt.samplerParameteri(vr.samplers[e],t,r)},Ks=(e,t,r)=>{var n=A[r>>2];Mt.samplerParameteri(vr.samplers[e],t,n)},Qs=(e,t,r,n)=>Mt.scissor(e,t,r,n),Zs=(e,t,r,n,o)=>{vr.recordError(1280)},Js=(e,t,r,n)=>{var o=vr.getSource(e,t,r,n);if(vr.currentContext.version>=2&&o.includes("#version 100")){var i="";(o=(o=o.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",o=o.replace(/gl_FragColor/g,"GL_FragColor")),o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.includes("attribute")?(o=o.replace(/attribute/g,"in")).replace(/varying/g,"out"):o.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],o)},ea=(e,t,r)=>Mt.stencilFunc(e,t,r),ta=(e,t,r,n)=>Mt.stencilFuncSeparate(e,t,r,n),ra=e=>Mt.stencilMask(e),na=(e,t)=>Mt.stencilMaskSeparate(e,t),oa=(e,t,r)=>Mt.stencilOp(e,t,r),ia=(e,t,r,n)=>Mt.stencilOpSeparate(e,t,r,n),sa=(e,t,r,n,o,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,n,o,i,s,a,l);if(l){var c=js(a),d=$s(l,c);return void Mt.texImage2D(e,t,r,n,o,i,s,a,c,d)}}var u=l?qs(a,s,n,o,l):null;Mt.texImage2D(e,t,r,n,o,i,s,a,u)},aa=(e,t,r,n,o,i,s,a,l,c)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texImage3D(e,t,r,n,o,i,s,a,l,c);else if(c){var d=js(l);Mt.texImage3D(e,t,r,n,o,i,s,a,l,d,$s(c,d))}else Mt.texImage3D(e,t,r,n,o,i,s,a,l,null)},la=(e,t,r)=>Mt.texParameterf(e,t,r),ca=(e,t,r)=>{var n=M[r>>2];Mt.texParameterf(e,t,n)},da=(e,t,r)=>Mt.texParameteri(e,t,r),ua=(e,t,r)=>{var n=A[r>>2];Mt.texParameteri(e,t,n)},ha=(e,t,r,n,o)=>Mt.texStorage2D(e,t,r,n,o),pa=(e,t,r,n,o,i)=>Mt.texStorage3D(e,t,r,n,o,i),fa=(e,t,r,n,o,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,n,o,i,s,a,l);if(l){var c=js(a);return void Mt.texSubImage2D(e,t,r,n,o,i,s,a,c,$s(l,c))}}var d=l?qs(a,s,o,i,l):null;Mt.texSubImage2D(e,t,r,n,o,i,s,a,d)},ga=(e,t,r,n,o,i,s,a,l,c,d)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,d);else if(d){var u=js(c);Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,u,$s(d,u))}else Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,null)},ma=(e,t,r,n)=>{e=vr.programs[e];for(var o=[],i=0;i<t;i++)o.push(Q(A[r+4*i>>2]));Mt.transformFeedbackVaryings(e,o,n)},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 n=ya[t],o=0;o<t;++o)n[o]=M[r+4*o>>2];else n=M.subarray(r>>2,r+4*t>>2);Mt.uniform1fv(Gi(e),n)}},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 n=ka[t],o=0;o<t;++o)n[o]=A[r+4*o>>2];else n=A.subarray(r>>2,r+4*t>>2);Mt.uniform1iv(Gi(e),n)}},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 n=ya[t*=2],o=0;o<t;o+=2)n[o]=M[r+4*o>>2],n[o+1]=M[r+(4*o+4)>>2];else n=M.subarray(r>>2,r+8*t>>2);Mt.uniform2fv(Gi(e),n)}},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 n=ka[t*=2],o=0;o<t;o+=2)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2];else n=A.subarray(r>>2,r+8*t>>2);Mt.uniform2iv(Gi(e),n)}},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,n)=>{Mt.uniform3f(Gi(e),t,r,n)},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 n=ya[t*=3],o=0;o<t;o+=3)n[o]=M[r+4*o>>2],n[o+1]=M[r+(4*o+4)>>2],n[o+2]=M[r+(4*o+8)>>2];else n=M.subarray(r>>2,r+12*t>>2);Mt.uniform3fv(Gi(e),n)}},La=(e,t,r,n)=>{Mt.uniform3i(Gi(e),t,r,n)},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 n=ka[t*=3],o=0;o<t;o+=3)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2],n[o+2]=A[r+(4*o+8)>>2];else n=A.subarray(r>>2,r+12*t>>2);Mt.uniform3iv(Gi(e),n)}},Da=(e,t,r,n)=>{Mt.uniform3ui(Gi(e),t,r,n)},Ba=(e,t,r)=>{t&&Mt.uniform3uiv(Gi(e),F,r>>2,3*t)},Oa=(e,t,r,n,o)=>{Mt.uniform4f(Gi(e),t,r,n,o)},ja=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4fv(Gi(e),M,r>>2,4*t);else{if(t<=72){var n=ya[4*t],o=M;r>>=2,t*=4;for(var i=0;i<t;i+=4){var s=r+i;n[i]=o[s],n[i+1]=o[s+1],n[i+2]=o[s+2],n[i+3]=o[s+3]}}else n=M.subarray(r>>2,r+16*t>>2);Mt.uniform4fv(Gi(e),n)}},$a=(e,t,r,n,o)=>{Mt.uniform4i(Gi(e),t,r,n,o)},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 n=ka[t*=4],o=0;o<t;o+=4)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2],n[o+2]=A[r+(4*o+8)>>2],n[o+3]=A[r+(4*o+12)>>2];else n=A.subarray(r>>2,r+16*t>>2);Mt.uniform4iv(Gi(e),n)}},Ua=(e,t,r,n,o)=>{Mt.uniform4ui(Gi(e),t,r,n,o)},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,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix2fv(Gi(e),!!r,M,n>>2,4*t);else{if(t<=72)for(var o=ya[t*=4],i=0;i<t;i+=4)o[i]=M[n+4*i>>2],o[i+1]=M[n+(4*i+4)>>2],o[i+2]=M[n+(4*i+8)>>2],o[i+3]=M[n+(4*i+12)>>2];else o=M.subarray(n>>2,n+16*t>>2);Mt.uniformMatrix2fv(Gi(e),!!r,o)}},Va=(e,t,r,n)=>{t&&Mt.uniformMatrix2x3fv(Gi(e),!!r,M,n>>2,6*t)},za=(e,t,r,n)=>{t&&Mt.uniformMatrix2x4fv(Gi(e),!!r,M,n>>2,8*t)},Ga=(e,t,r,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix3fv(Gi(e),!!r,M,n>>2,9*t);else{if(t<=32)for(var o=ya[t*=9],i=0;i<t;i+=9)o[i]=M[n+4*i>>2],o[i+1]=M[n+(4*i+4)>>2],o[i+2]=M[n+(4*i+8)>>2],o[i+3]=M[n+(4*i+12)>>2],o[i+4]=M[n+(4*i+16)>>2],o[i+5]=M[n+(4*i+20)>>2],o[i+6]=M[n+(4*i+24)>>2],o[i+7]=M[n+(4*i+28)>>2],o[i+8]=M[n+(4*i+32)>>2];else o=M.subarray(n>>2,n+36*t>>2);Mt.uniformMatrix3fv(Gi(e),!!r,o)}},Xa=(e,t,r,n)=>{t&&Mt.uniformMatrix3x2fv(Gi(e),!!r,M,n>>2,6*t)},Ya=(e,t,r,n)=>{t&&Mt.uniformMatrix3x4fv(Gi(e),!!r,M,n>>2,12*t)},Ka=(e,t,r,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix4fv(Gi(e),!!r,M,n>>2,16*t);else{if(t<=18){var o=ya[16*t],i=M;n>>=2,t*=16;for(var s=0;s<t;s+=16){var a=n+s;o[s]=i[a],o[s+1]=i[a+1],o[s+2]=i[a+2],o[s+3]=i[a+3],o[s+4]=i[a+4],o[s+5]=i[a+5],o[s+6]=i[a+6],o[s+7]=i[a+7],o[s+8]=i[a+8],o[s+9]=i[a+9],o[s+10]=i[a+10],o[s+11]=i[a+11],o[s+12]=i[a+12],o[s+13]=i[a+13],o[s+14]=i[a+14],o[s+15]=i[a+15]}}else o=M.subarray(n>>2,n+64*t>>2);Mt.uniformMatrix4fv(Gi(e),!!r,o)}},Qa=(e,t,r,n)=>{t&&Mt.uniformMatrix4x2fv(Gi(e),!!r,M,n>>2,8*t)},Za=(e,t,r,n)=>{t&&Mt.uniformMatrix4x3fv(Gi(e),!!r,M,n>>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])},nl=(e,t,r)=>Mt.vertexAttrib2f(e,t,r),ol=(e,t)=>{Mt.vertexAttrib2f(e,M[t>>2],M[t+4>>2])},il=(e,t,r,n)=>Mt.vertexAttrib3f(e,t,r,n),sl=(e,t)=>{Mt.vertexAttrib3f(e,M[t>>2],M[t+4>>2],M[t+8>>2])},al=(e,t,r,n,o)=>Mt.vertexAttrib4f(e,t,r,n,o),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,n,o)=>Mt.vertexAttribI4i(e,t,r,n,o),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,n,o)=>Mt.vertexAttribI4ui(e,t,r,n,o),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,n,o)=>{Mt.vertexAttribIPointer(e,t,r,n,o)},wl=(e,t,r,n,o,i)=>{Mt.vertexAttribPointer(e,t,r,!!n,o,i)},kl=(e,t,r,n)=>Mt.viewport(e,t,r,n),_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,n=A[r+2],o={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[n],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?o.explicitSwapControl?0:vr.createContext(i,o):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,n)=>{for(var o=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,n);if(l<0)return-1;if(o+=l,l<a)break;void 0!==n&&(n+=l)}return o},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 n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o},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:ot}),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)Zn.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={2820528:(e,t,r,n,o)=>"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=n,window.miniaudio.device_state.started=o,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),2822518:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2822682:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2822786:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2822957:(e,t,r,n,o,i)=>{var s=e,a=t,c=r,d=n,u=o,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),n=p.intermediaryBufferView,o=0;o<d;o+=1)n[o*a+t]=r[o];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(n=p.intermediaryBufferView,o=0;o<d;o+=1)i[o]=n[o*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)},2825740:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2825806: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},2826171:e=>{miniaudio.untrack_device_by_index(e)},2826214:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2826339:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2826465:()=>!!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),oc(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 n=Pe.getStreamFromFD(e);switch(t){case 0:if((o=Ae())<0)return-28;for(;Te.streams[o];)o++;return Te.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=Ae();return n.flags|=o,0;case 12:return o=Fe(),T[o+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 n=Pe.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=Fe();A[i>>2]=o.c_iflag||0,A[i+4>>2]=o.c_oflag||0,A[i+8>>2]=o.c_cflag||0,A[i+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)S[i+s+17]=o.c_cc[s]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.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 n.tty.ops.ioctl_tcsets(n.tty,t,{c_iflag:a,c_oflag:l,c_cflag:c,c_lflag:d,c_cc:u})}return 0;case 21519:return n.tty?(i=Fe(),A[i>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return i=Fe(),Te.ioctl(n,t,i);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.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,n){try{t=Pe.getStr(t);var o=256&n,i=4096&n;return n&=-6401,t=Pe.calculateAt(e,t,i),Pe.writeStat(r,o?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,n){Pe.varargs=n;try{t=Pe.getStr(t),t=Pe.calculateAt(e,t);var o=n?Ae():0;return Te.open(t,r,o).fd}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return-e.errno}},Ah:function(e,t,r,n){try{return t=Pe.getStr(t),n=Pe.getStr(n),t=Pe.calculateAt(e,t),n=Pe.calculateAt(r,n),Te.rename(t,n),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,n=r.length,o=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,s=t.rawDestructor;qe([e],o,(e=>(r.forEach(((t,r)=>{var o=e[r],i=t.getter,s=t.getterContext,a=e[r+n],l=t.setter,c=t.setterContext;t.read=e=>o.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(n),o=0;o<n;++o)t[o]=r[o].read(e);return s(e),t},toWireType:(e,o)=>{if(n!==o.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${n}, actual=${o.length}`);for(var a=i(),l=0;l<n;++l)r[l].write(a,o[l]);return null!==e&&e.push(s,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:s}])))},z:e=>{var t=Ue[e];delete Ue[e];var r=t.rawConstructor,n=t.rawDestructor,o=t.fields,i=o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType)));qe([e],i,(e=>{var i={};return o.forEach(((t,r)=>{var n=t.fieldName,s=e[r],a=e[r].optional,l=t.getter,c=t.getterContext,d=e[r+o.length],u=t.setter,h=t.setterContext;i[n]={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 n(e),t},toWireType:(e,t)=>{for(var o in i)if(!(o in t)&&!i[o].optional)throw new TypeError(`Missing field: "${o}"`);var s=r();for(o in i)i[o].write(s,t[o]);return null!==e&&e.push(n,s),s},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:n}]}))},Qa:(e,t,r,n,o)=>{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,n)=>{ze(e,{name:t=He(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:Xe,readValueFromPointer:function(e){return this.fromWireType(x[e])},destructorFunction:null})},s:(e,t,r,n,o,i,s,a,l,c,d,u,h)=>{d=He(d),i=St(o,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`,[n])})),qe([e,t,r],n?[n]:[],(t=>{var r,o;t=t[0],o=n?(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(o,{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,n,o,i)=>{var s=At(t,r);o=St(n,o),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,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,n,null,o,i),[]))),[]}))},c:(e,t,r,n,o,i,s,a,l,c)=>{var d=At(r,n);t=He(t),t=It(t),i=St(o,i),qe([],[e],(e=>{var n=`${(e=e[0]).name}.${t}`;function o(){Pt(`Cannot call ${n} 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?(o.argCount=r-2,o.className=e.name,l[t]=o):(ct(l,t,n),l[t].overloadTable[r-2]=o),qe([],d,(o=>{var a=Ft(n,o,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),da:(e,t,r,n)=>{function o(){}t=He(t),o.values={},ze(e,{name:t,constructor:o,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:Xe,readValueFromPointer:$t(t,r,n),destructorFunction:null}),dt(t,o)},K:(e,t,r)=>{var n=qt(e,"enum");t=He(t);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:lt(`${n.name}_${t}`,(function(){}))}});o.values[r]=i,o[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,n,o,i,s,a)=>{var l=At(t,r);e=He(e),e=It(e),o=St(n,o),dt(e,(function(){Pt(`Cannot call ${e} due to unbound types`,l)}),t-1),qe([],l,(r=>{var n=[r[0],null].concat(r.slice(1));return _t(e,Ft(e,n,null,o,i),t-1),[]}))},N:(e,t,r,n,o)=>{t=He(t),-1===o&&(o=4294967295);var i=e=>e;if(0===n){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!==n),destructorFunction:null})},E:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function o(e){var t=F[e>>2],r=F[e+4>>2];return new n(S.buffer,r,t)}ze(e,{name:r=He(r),fromWireType:o,argPackAdvance:Xe,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},Q:(e,t)=>{ze(e,Wt)},kh:(e,t,r,n,o,i,s,a,l,c,d,u)=>{r=He(r),i=St(o,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,n,i,a,c,u)])))},jh:(e,t)=>{t=He(t),ze(e,{name:t,fromWireType(e){for(var t,r=F[e>>2],n=e+4,o=n,i=0;i<=r;++i){var s=n+i;if(i==r||0==x[s]){var a=Q(o,s-o);void 0===t?t=a:(t+=String.fromCharCode(0),t+=a),o=s+1}}return Nl(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||Ve("Cannot pass non-string to std::string"),r=n?se(t):t.length;var o=Hl(4+r+1),i=o+4;return F[o>>2]=r,n?le(t,i,r+1):x.set(t,i),null!==e&&e.push(Nl,o),o},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Nl(e)}})},na:(e,t,r)=>{var n,o,i,s;r=He(r),2===t?(n=Nt,o=Vt,s=zt,i=e=>P[e>>1]):4===t&&(n=Gt,o=Xt,s=Yt,i=e=>F[e>>2]),ze(e,{name:r,fromWireType:e=>{for(var r,o=F[e>>2],s=e+4,a=0;a<=o;++a){var l=e+4+a*t;if(a==o||0==i(l)){var c=n(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Nl(e),r},toWireType:(e,n)=>{"string"!=typeof n&&Ve(`Cannot pass non-string to C++ string type ${r}`);var i=s(n),a=Hl(4+i+t);return F[a>>2]=i/t,o(n,a+4,i+t),null!==e&&e.push(Nl,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Nl(e)}})},Oa:(e,t,r,n,o,i)=>{Me[e]={name:He(t),rawConstructor:St(r,n),rawDestructor:St(o,i),elements:[]}},M:(e,t,r,n,o,i,s,a,l)=>{Me[e].elements.push({getterReturnType:t,getter:St(r,n),getterContext:o,setterArgumentType:i,setter:St(s,a),setterContext:l})},y:(e,t,r,n,o,i)=>{Ue[e]={name:He(t),rawConstructor:St(r,n),rawDestructor:St(o,i),fields:[]}},l:(e,t,r,n,o,i,s,a,l,c)=>{Ue[e].fields.push({fieldName:He(t),getterReturnType:r,getter:St(n,o),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:()=>{ne=!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,n)=>(e=Zt[e])(null,t=Ot.toValue(t),r,n),J:(e,t,r,n,o)=>(e=Zt[e])(t=Ot.toValue(t),t[r=er(r)],n,o),b:Dt,fh:(e,t)=>(e=Ot.toValue(e))==(t=Ot.toValue(t)),I:e=>0===e?Ot.toHandle(tr()):(e=er(e),Ot.toHandle(tr()[e])),o:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=qt(F[t+4*n>>2],"parameter "+n);return r})(e,t),o=n.shift();e--;var i,s,a=new Array(e),l=`methodCaller<(${n.map((e=>e.name)).join(", ")}) => ${o.name}>`;return i=lt(l,((t,i,s,l)=>{for(var c=0,d=0;d<e;++d)a[d]=n[d].readValueFromPointer(l+c),c+=n[d].argPackAdvance;var u=1===r?rr(i,a):i.apply(t,a);return Qt(o,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)},Y:(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=nr(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 n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),o=(r.getTime()-n)/864e5|0;A[t+28>>2]=o},bh:function(e,t){e=nr(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 n=0|sr(r);A[t+28>>2]=n,A[t+36>>2]=-60*r.getTimezoneOffset();var o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.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],n=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),a=Math.min(s,i);if(r<0)A[e+32>>2]=Number(i!=s&&a==n);else if(r>0!=(a==n)){var l=Math.max(s,i),c=r>0?a:l;t.setTime(t.getTime()+6e4*(c-n))}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,n,o,i,s){o=nr(o);try{if(isNaN(o))return 61;var a=Pe.getStreamFromFD(n),l=Te.mmap(a,e,o,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,n,o,i){i=nr(i);try{var s=Pe.getStreamFromFD(o);2&r&&Pe.doMsync(e,s,t,n,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,n)=>{var o=(new Date).getFullYear(),i=new Date(o,0,1),s=new Date(o,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,n,17)):(le(u,n,17),le(h,r,17))},Xg:function(e){var t=Q(e);localStorage.removeItem(t)},wh:function(e,t,r){if(t=nr(t),!((n=e)>=0&&n<=3))return 28;var n,o;o=0===e?gr():fr();var i=Math.round(1e3*o*1e3);return I[r>>3]=BigInt(i),0},Ma:(e,t,r,n,o)=>yr.chooseConfig(e,t,r,n,o),La:(e,t,r,n)=>{if(62e3!=e)return yr.setErrorCode(12296),0;for(var o=1;;){var i=A[n>>2];if(12440!=i){if(12344==i)break;return yr.setErrorCode(12292),0}o=A[n+4>>2],n+=8}return o<2||o>3?(yr.setErrorCode(12293),0):(yr.contextAttributes.majorVersion=o-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,n)=>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),W:(e,t,r,n)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(62002!=t)return yr.setErrorCode(12293),0;if(!n)return yr.setErrorCode(12300),0;switch(yr.setErrorCode(12288),r){case 12320:return A[n>>2]=yr.contextAttributes.alpha?32:24,1;case 12321:return A[n>>2]=yr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return A[n>>2]=8,1;case 12325:return A[n>>2]=yr.contextAttributes.depth?24:0,1;case 12326:return A[n>>2]=yr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return A[n>>2]=12344,1;case 12328:return A[n>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return A[n>>2]=0,1;case 12330:case 12332:return A[n>>2]=4096,1;case 12331:return A[n>>2]=16777216,1;case 12337:return A[n>>2]=yr.contextAttributes.antialias?4:0,1;case 12338:return A[n>>2]=yr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return A[n>>2]=4,1;case 12341:case 12342:case 12343:return A[n>>2]=-1,1;case 12348:return A[n>>2]=1,1;case 12351:return A[n>>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),ca:(e,t,r,n)=>62e3!=e?(yr.setErrorCode(12296),0):0!=n&&62004!=n?(yr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(yr.setErrorCode(12301),0):(vr.makeContextCurrent(n?yr.context:null),yr.currentContext=n,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:Hr,tg:Nr,sg:Vr,rg:zr,qg:Gr,pg:Xr,og:Yr,ng:Kr,mg:Qr,lg:Zr,kg:Jr,jg:en,ig:tn,hg:rn,Ga:nn,gg:on,fg:sn,eg:an,dg:ln,cg:cn,bg:dn,ag:un,$f:hn,_f:pn,Zf:fn,Yf:gn,Xf:mn,Wf:bn,Vf:yn,Uf:vn,Tf:wn,Sf:kn,Rf:_n,Qf:Cn,Pf:En,Of:Sn,Nf:xn,Mf:Tn,Lf:Pn,Kf:An,Jf:Mn,If:Ln,Hf:Rn,Gf:Dn,Ff:Bn,Ef:On,Df:jn,Cf:$n,Bf:qn,Af:Wn,zf:Nn,yf:zn,xf:Gn,wf:Yn,vf:Qn,uf:eo,tf:ro,sf:oo,rf:so,qf:lo,pf:uo,of:po,nf:fo,mf:mo,lf:yo,kf:vo,jf:wo,hf:ko,gf:_o,ff:Co,ef:Eo,df:So,cf:xo,bf:To,af:Po,$e:Ao,_e:Fo,Ze:Mo,Ye:Io,Xe:Lo,We:Ro,Ve:Do,Ue:Bo,Te:Oo,Se:jo,Re:$o,Qe:Uo,Pe:Ho,Oe:No,Ne:zo,Me:Go,Le:Xo,Ke:Yo,Je:Ko,Ie:Qo,He:Zo,Ge:ri,Fe:ni,Ee:oi,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:Hi,Yd:zi,Xd:Yi,Wd:Ki,Vd:Qi,Ud:es,Td:rs,Sd:ns,Rd:os,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: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:na,Wc:oa,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: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:nl,Yb:ol,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 n=1;n<=4;n*=2){var o=t*(1+.2/n);o=Math.min(o,e+100663296);var i=Math.min(r,we(Math.max(e,o),65536));if(Cl(i))return!0}return!1},Gb:function(e,t,r,n,o,i,s,a,c){const d=l.UTF8ToString(e,e+t),u=l.HEAPU8.subarray(o,o+i),h=l.emscripten_ubq_codec_audioDecoderNextHandle++,p={codec:d,sampleRate:r,numberOfChannels:n,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,n,o,i){const s=l.UTF8ToString(e,e+t),a=l.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:s,sampleRate:r,numberOfChannels:n,bitrate:o};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: "+n,e+="; bit rate: "+o,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:a})},Eb:function(e,t,r,n,o,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:n,description:d,optimizeForLatency:!0,hardwareAcceleration:"prefer-software"};try{const e=l.emscripten_ubq_codec_createVideoDecoder(u,o,a);VideoDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t.supported}),(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,n,o,i,s){const a=l.UTF8ToString(e,e+t),c=l.emscripten_ubq_codec_videoEncoderNextHandle++,d=l.specialHTMLTargets["!canvas"];d.width=r,d.height=n;const u={codec:a,width:r,height:n,avc:{format:"annexb"},framerate:o};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"+n,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:c})},Cb:function(e,t,r,n,o,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(o,o+i),d=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:n,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,n,o,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(o,o+i),d=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:n,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 n=1e6,o=l.emscripten_ubq_codec_audioEncoders.get(e),i=o.audioEncoderConfig.sampleRate,s=o.audioEncoderConfig.numberOfChannels,a=r/s,c=Math.round(n*(o.frameIndex*a/i)),d=Math.round(n*(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});o.audioEncoder.encode(h),o.frameIndex++,h.close()},zb:function(e,t,r){const n=1e6,o=l.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(n*(o.frameIndex/o.encoderConfig.framerate)),s=o.frameIndex%o.groupOfPictures==0,a=Math.round(n/o.encoderConfig.framerate),c=l.specialHTMLTargets["!canvas"],d=new VideoFrame(c,{timestamp:i,duration:a});o.videoEncoder.encode(d,{keyFrame:s}),d.close(),o.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},V:async function(e,t,r){const n=l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;n.shouldDropFrames=r,n.flushing=!0;try{await n.flush()}catch{}n.flushing=!1,n.shouldDropFrames=!1,n.decodedFrames=t},za:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},ba:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},aa: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},$:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},tb:function(e,t,r,n,o,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:n,codedHeight:o,description:d})},sb:function(e,t){l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},rb:function(e,t,r){const n=l.emscripten_ubq_codec_videoDecoders.get(e),o=l.HEAPU32.subarray(t/4,t/4+r);n.videoDecoder.textures=[];for(let e=0;e<r;e++)n.videoDecoder.textures[e]=vr.textures[o[e]]},qb:async function(e,t,r,n,o,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,n,o,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,n){return l.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,n)},nb:function(e){l.emscripten_ubq_asyncFetchManager.deleteHeader(e)},mb:function(e,t,r,n,o,i,s,a,c){return l.emscripten_ubq_asyncFetchManager.fetch(e,t,r,n,o,i,s,a,c).handle},U: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},T: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},ha:function(e,t,r,n,o){const i=Q(e),s=4294967296*(r>>>0)+(t>>>0);if(n<=0)return 0;const a=l.emscripten_ubq_opfs_CHUNK_SIZE,c=l.emscripten_ubq_opfs_getCache(i),d=x.subarray(o,o+n);let u=0,h=s;const p=Math.min(s+n,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,n=Math.min(t.byteLength-r,p-h);d.set(t.subarray(r,r+n),u),u+=n,h+=n}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)},ga:function(e,t,r,n){const o=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(o),c=Math.floor(i/s),d=Math.floor((i+n)/s);for(let e=c;e<=d;++e){if(!a.chunkCache.has(e))return 0;l.emscripten_ubq_opfs_updateAccess(a,e)}return 1},fa:function(e,t,r,n){const o=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(o),c=Math.floor(i/s),d=Math.floor((i+n-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(o,a,e));return u?1:0},gb:function(){return!!l.emscripten_ubq_settings_forceWebGL1},ya:Tl,_: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),Z:(e,t)=>{var r=vr.getContext(e),n=Q(t);return n.startsWith("GL_")&&(n=n.slice(3)),!!r.GLctx.getExtension(n)},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 n=r.powerPreference&&El.indexOf(r.powerPreference);return A[t+8>>2]=n,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(((n,o)=>{var i=t+r;F[e+4*o>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)S[t++]=e.charCodeAt(r);S[t]=0})(n,i),r+=n.length+1})),0},uh:(e,t)=>{var r=Al();F[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),F[t>>2]=n,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),n=r.tty?2:Te.isDir(r.mode)?3:Te.isLink(r.mode)?7:4;return S[t]=n,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,n,o){n=nr(n);try{if(isNaN(n))return 61;var i=Pe.getStreamFromFD(e),s=Fl(i,t,r,n);return F[o>>2]=s,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},Sa:function(e,t,r,n){try{var o=Pe.getStreamFromFD(e),i=Fl(o,t,r);return F[n>>2]=i,0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},rh:function(e,t,r,n){t=nr(t);try{if(isNaN(t))return 61;var o=Pe.getStreamFromFD(e);return Te.llseek(o,t,r),I[n>>3]=BigInt(o.position),o.getdents&&0===t&&0===r&&(o.getdents=null),0}catch(e){if(void 0===Te||"ErrnoError"!==e.name)throw e;return e.errno}},qh:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=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,n);if(l<0)return-1;if(o+=l,l<a)break;void 0!==n&&(n+=l)}return o})(Pe.getStreamFromFD(e),t,r);return F[n>>2]=o,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("")},A:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},L:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},F:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},m:function(e,t,r,n){var o=ie();try{return Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},_a:function(e){var t=ie();try{return Et(e)()}catch(e){if(oe(t),e!==e+0)throw e;Kl(1,0)}},wa:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},r:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},X:function(e,t,r,n,o,i,s,a,l,c,d,u,h,p,f,g){var m=ie();try{return Et(e)(t,r,n,o,i,s,a,l,c,d,u,h,p,f,g)}catch(e){if(oe(m),e!==e+0)throw e;Kl(1,0)}},q:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},t:function(e,t,r,n){var o=ie();try{return Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},S:function(e,t,r,n,o){var i=ie();try{return Et(e)(t,r,n,o)}catch(e){if(oe(i),e!==e+0)throw e;Kl(1,0)}},Za:function(e,t,r,n,o,i){var s=ie();try{return Et(e)(t,r,n,o,i)}catch(e){if(oe(s),e!==e+0)throw e;Kl(1,0)}},va:function(e,t,r,n,o,i,s){var a=ie();try{return Et(e)(t,r,n,o,i,s)}catch(e){if(oe(a),e!==e+0)throw e;Kl(1,0)}},ua:function(e,t,r,n,o,i,s,a,l,c){var d=ie();try{return Et(e)(t,r,n,o,i,s,a,l,c)}catch(e){if(oe(d),e!==e+0)throw e;Kl(1,0)}},R:function(e){var t=ie();try{Et(e)()}catch(e){if(oe(t),e!==e+0)throw e;Kl(1,0)}},w:function(e,t){var r=ie();try{Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},C:function(e,t,r,n){var o=ie();try{Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},B:function(e,t,r){var n=ie();try{Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},p:function(e,t,r,n){var o=ie();try{Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},D:function(e,t,r,n,o){var i=ie();try{Et(e)(t,r,n,o)}catch(e){if(oe(i),e!==e+0)throw e;Kl(1,0)}},Ya:function(e,t,r,n,o,i){var s=ie();try{Et(e)(t,r,n,o,i)}catch(e){if(oe(s),e!==e+0)throw e;Kl(1,0)}},Xa:function(e,t,r,n,o,i,s){var a=ie();try{Et(e)(t,r,n,o,i,s)}catch(e){if(oe(a),e!==e+0)throw e;Kl(1,0)}},Wa:function(e,t,r,n,o,i,s,a){var l=ie();try{Et(e)(t,r,n,o,i,s,a)}catch(e){if(oe(l),e!==e+0)throw e;Kl(1,0)}},Va:function(e,t,r,n,o,i,s,a,l,c){var d=ie();try{Et(e)(t,r,n,o,i,s,a,l,c)}catch(e){if(oe(d),e!==e+0)throw e;Kl(1,0)}},ea: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),n=l.ctx;n.bindTexture(n.TEXTURE_2D,vr.textures[e]),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.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),n=Q(t);localStorage.setItem(r,n)}},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,n)=>{l.instantiateWasm(t,((t,n)=>{e(t),r(t.exports)}))}));q??=z();try{var r=await X(D,q,t);return e(r.instance)}catch(e){return n(e),Promise.reject(e)}}(),Wl=(Ul.Ih,Ul.Jh),Hl=l._malloc=Ul.Kh,Nl=l._free=Ul.Lh,Vl=l._main=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,nc=Ul.$h,oc=Ul.ai;if(l.addRunDependency=H,l.removeRunDependency=N,l.ccall=(e,t,r,n,o)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=Il(e)),t},array:e=>{var t,r,n=Ml(e.length);return t=e,r=n,S.set(t,r),n}},s=(e=>l["_"+e])(e),a=[],c=0;if(n)for(var d=0;d<n.length;d++){var u=i[r[d]];u?(0===c&&(c=ie()),a[d]=u(n[d])):a[d]=n[d]}var h,p=s(...a);return h=p,0!==c&&oe(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 n(){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=Vl;e.unshift(b);var r=e.length,n=Ml(4*(r+1)),o=n;e.forEach((e=>{F[o>>2]=Il(e),o+=4})),F[o>>2]=0;try{var i=t(r,n);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),n()}),1)):n())}(),c});"object"==typeof e&&"object"==typeof t?(t.exports=n,t.exports.default=n):"function"==typeof define&&define.amd&&define([],(()=>n))}}),wt=u($()),kt=u(ht()),_t=u(pt()),Ct=class extends TypeError{constructor(e,t){let r;const{message:n,...o}=e,{path:i}=e;super(0===i.length?n:"At path: "+i.join(".")+" -- "+n),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,o),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n: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,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:s}=r,{refinement:a,message:l="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+St(n)+"`"}=e;return{value:n,type:s,refinement:a,key:o[o.length-1],path:o,branch:i,...e,message:l}}function*Tt(e,t,r,n){var o;Et(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]);for(const o of e){const e=xt(o,t,r,n);e&&(yield e)}}function*Pt(e,t,r={}){const{path:n=[],branch:o=[e],coerce:i=!1,mask:s=!1}=r,a={path:n,branch:o};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?n:[...n,r],branch:void 0===r?o:[...o,c],coerce:i,mask:s});for(const n of t)n[0]?(l=!1,yield[n[0],void 0]):i&&(c=n[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:n,refiner:o,coercer:i=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=i,this.validator=n?(e,t)=>Tt(n(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Tt(o(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 n=Pt(e,t,r),o=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(o[0]){return[new Ct(o[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,o[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,n]of t.entries())yield[r,n,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(n){if(e&&Et(n)){const o=new Set(Object.keys(n));for(const r of t)o.delete(r),yield[r,n[r],e[r]];for(const e of o)yield[e,n[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 n of t)yield[n,r[n],e[n]]},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,n){const o=[];for(const t of e){const[...e]=Pt(r,t,n),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+St(r),...o]}})}function Wt(e,t,r={}){const{exclusive:n}=r;return Vt(e,"max",(r=>n?r<t:r<=t||"Expected a "+e.type+" less than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Ht(e,t,r={}){const{exclusive:n}=r;return Vt(e,"min",(r=>n?r>t:r>=t||"Expected a "+e.type+" greater than "+(n?"":"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(n,o){yield*e.refiner(n,o);const i=Tt(r(n,o),o,e,n);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[n]=Ft(t,r);if(n)throw n.message=`Error in argument '${e}': ${n.message}`,n;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 nr(){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 or(){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:nr(),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),n=e.fetchAsset?.bind(e),o=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 n={...t,sortKey:t.sortKey,sortingOrder:t.sortingOrder,sortActiveFirst:t.sortActiveFirst,tags:lr(t.tags),groups:lr(t.groups),excludeGroups:lr(t.excludeGroups)},o=await e.findAssets(n);if(o){const t={...o,assets:o.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`")}}),n?async(t,r)=>{try{const o=await n(t);null===o?r.invoke(null):r.invoke(ur(o,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,o?async(e,t)=>{try{const r=await o(this.#n(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.#n(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.#n(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.#o(e.id,e)}addLocalSource(e,t,r,n){sr(this.#e.addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const n=await r(this.#n(e));t.invoke(n)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,n?async(e,t,r)=>{try{await n(this.#n(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,n)=>{try{r(sr(this.#e.addLocalAssetSourceFromJSONString(e,t)))}catch(e){n(e)}}))}addLocalAssetSourceFromJSONURI(e){return new Promise(((t,r)=>{this.#e.addLocalAssetSourceFromJSONURI(e,(e=>{try{const r=sr(e);t(r)}catch(e){r(e)}}))}))}removeSource(e){sr(this.#e.removeAssetSource(e)),this.#i(e)}findAllSources(){return lr(this.#e.findAllAssetSources())}findAssets(e,t){return new Promise(((r,n)=>{let o=t?.tags??[];Array.isArray(o)||(o=[o]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:o,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){n(e)}}))}))}async fetchAsset(e,t){return Gt("sourceId",e,$t()),Gt("assetId",t,$t()),new Promise(((r,n)=>{this.#e.fetchAssetSourceAsset(e,t,(e=>{try{const t=sr(e);r(t||null)}catch(e){n(e)}}))}))}#n(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))}#o(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,n)=>{this.#e.applyAssetSourceAsset(e,ur(t,e),(e=>{try{const t=sr(e);this.#e.isValid(t)?r(t):r(void 0)}catch(e){n(e)}}))}));if(this.#t.size>0){return Array.from(this.#t).reduce(((e,t)=>(r,n)=>t(r,n,e)),r)(e,t)}return r(e,t)}async applyToBlock(e,t,r){const n=(e,t,r)=>ar((n=>this.#e.applyAssetSourceAssetToBlock(e,ur(t,e),r,n)));if(this.#r.size>0){return Array.from(this.#r).reduce(((e,t)=>(r,n,o)=>t(r,n,o,e)),n)(e,t,r)}return n(e,t,r)}async applyProperty(e,t,r){return ar((n=>this.#e.applyAssetSourceProperty(e,ur(t,e),r,n)))}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,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],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,en,tn,rn,nn,on,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,Hn,Nn,Vn,zn,Gn,Xn,Yn,Kn,Qn,Zn,Jn,eo,to,ro,no,oo,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,Ho,No,Vo,zo,Go,Xo,Yo,Ko,Qo,Zo,Jo,ei,ti,ri,ni,oi,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,Hi,Ni,Vi,zi,Gi,Xi,Yi,Ki,Qi,Zi,Ji,es,ts,rs,ns,os,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,Hs,Ns,Vs,zs,Gs,Xs,Ys,Ks,Qs,Zs,Js,ea,ta,ra,na,oa,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,Ha,Na,Va,za,Ga,Xa,Ya,Ka,Qa,Za,Ja,el,tl,rl,nl,ol,il,sl,al,ll,cl,dl,ul,hl,pl,fl,gl,ml,bl,yl,vl,wl,kl,_l,Cl,El,Sl,xl,Tl,Pl,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,t=!1){return Gt("sceneContent",e,$t()),ar((r=>_(this,$r).loadSceneFromString(e,r,t)))}async loadFromURL(e,t=!1){return Gt("url",e,$t()),ar((r=>_(this,$r).loadSceneFromURL(e,r,t)))}async loadFromArchiveURL(e,t=!1){return Gt("url",e,$t()),ar((r=>_(this,$r).loadSceneFromArchiveURL(e,r,t)))}async saveToString(e=["blob","bundle","file","http","https","opfs"],t){const r=this.get();if(null==r)throw new Error("No scene available.");return ar((n=>{_(this,$r).saveSceneToString(r,n,e,t?async(e,r,n)=>{const o=await t(e,r);n&&n.invoke(e,o)}:void 0)}))}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,n="Free",o=0,i=!1){return Gt("url",e,$t()),Gt("dpi",t,Ht(Bt(),0)),Gt("pixelScaleFactor",r,Ht(Bt(),0)),Gt("sceneLayout",n,Zt()),ar((s=>_(this,$r).createSceneFromImage(e,t,r,n,o,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,n,o){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(Ht(Bt(),0)),easing:jt(Jt()),interruptible:jt(Lt())})]))})))}catch(e){try{Gt("paddingLeft",t,jt(Bt())),Gt("paddingTop",r,jt(Bt())),Gt("paddingRight",n,jt(Bt())),Gt("paddingBottom",o,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:n??0,bottom:o??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,n=0,o=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",n,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,0,n,0))):"Vertical"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",n,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,0,r,0,n))):(Gt("paddingLeft",r,Bt()),Gt("paddingTop",n,Bt()),Gt("paddingRight",o,Bt()),Gt("paddingBottom",i,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,n,o,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,n=0,o=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",n,Bt()),Gt("paddingBottom",o,Bt()),Gt("scaledPaddingLeft",t,Bt()),Gt("scaledPaddingTop",r,Bt()),Gt("scaledPaddingRight",n,Bt()),Gt("scaledPaddingBottom",o,Bt()),sr(_(this,$r).unstable_enableCameraPositionClamping(e,t,r,n,o,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,n=0,o=0,i=0,s=0){return Gt("ids",e,It(Bt())),Gt("minZoomLimit",t,Bt()),Gt("maxZoomLimit",r,Bt()),Gt("paddingLeft",n,Bt()),Gt("paddingTop",o,Bt()),Gt("paddingRight",i,Bt()),Gt("paddingBottom",s,Bt()),sr(_(this,$r).unstable_enableCameraZoomClamping(e,t,r,n,o,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 Al(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}function Fl(e){return"name"in e&&void 0!==e.name}function Ml(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,n=0;if("number"==typeof t.page.size)r=t.page.size,n=t.page.size;else{if("object"!=typeof t.page.size)return;r=t.page.size.width,n=t.page.size.height}const o=_(this,qr).create("page");if(_(this,qr).appendChild(e,o),_(this,qr).setSize(o,r,n),t.page.color){const e=_(this,qr).createFill("color");_(this,qr).setFill(o,e),_(this,qr).setColor(o,"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",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(Al(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(Ml(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(Fl(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={})),Cl=[fr],_l=[fr],kl=[fr],wl=[fr],vl=[fr],yl=[fr],bl=[fr],ml=[pr({disabledInModes:["Playback"]})],gl=[pr({disabledInModes:["Playback"]})],fl=[fr],pl=[fr],hl=[fr],ul=[pr({disabledInModes:["Playback"]})],dl=[pr({disabledInModes:["Playback"]})],cl=[pr({disabledInModes:["Playback"]})],ll=[fr],al=[fr],sl=[fr],il=[fr],ol=[pr({disabledInModes:["Playback"]})],nl=[fr],rl=[fr],tl=[pr({disabledInModes:["Playback"]})],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=[fr],Ga=[pr({disabledInModes:["Playback"]})],za=[fr],Va=[pr({disabledInModes:["Playback"]})],Na=[fr],Ha=[pr({disabledInModes:["Playback"]})],Wa=[fr],Ua=[pr({disabledInModes:["Playback"]})],qa=[fr],$a=[pr({disabledInModes:["Playback"]})],ja=[pr({disabledInModes:["Playback"]})],Oa=[pr({disabledInModes:["Playback"]})],Ba=[pr({disabledInModes:["Playback"]})],Da=[fr],Ra=[fr],La=[fr],Ia=[fr],Ma=[fr],Fa=[fr],Aa=[pr({disabledInModes:["Playback"]})],Pa=[pr({disabledInModes:["Playback"]})],Ta=[fr],xa=[fr],Sa=[fr],Ea=[fr],Ca=[pr({disabledInModes:["Playback"]})],_a=[fr],ka=[pr({disabledInModes:["Playback"]})],wa=[pr({disabledInModes:["Playback"]})],va=[fr],ya=[fr],ba=[pr({disabledInModes:["Playback"]})],ma=[pr({disabledInModes:["Playback"]})],ga=[pr({disabledInModes:["Playback"]})],fa=[pr({disabledInModes:["Playback"]})],pa=[fr],ha=[fr],ua=[fr],da=[fr],ca=[fr],la=[fr],aa=[pr({disabledInModes:["Playback"]})],sa=[pr({disabledInModes:["Playback"]})],ia=[pr({disabledInModes:["Playback"]})],oa=[pr({disabledInModes:["Playback"]})],na=[fr],ra=[pr({disabledInModes:["Playback"]})],ta=[fr],ea=[fr],Js=[pr({disabledInModes:["Playback"]})],Zs=[pr({disabledInModes:["Playback"]})],Qs=[pr({disabledInModes:["Playback"]})],Ks=[fr],Ys=[fr],Xs=[pr({disabledInModes:["Playback"]})],Gs=[pr({disabledInModes:["Playback"]})],zs=[pr({disabledInModes:["Playback"]})],Vs=[pr({disabledInModes:["Playback"]})],Ns=[pr({disabledInModes:["Playback"]})],Hs=[pr({disabledInModes:["Playback"]})],Ws=[fr],Us=[fr],qs=[pr({disabledInModes:["Playback"]})],$s=[fr],js=[fr],Os=[fr],Bs=[fr],Ds=[fr],Rs=[fr],Ls=[pr({disabledInModes:["Playback"]})],Is=[pr({disabledInModes:["Playback"]})],Ms=[pr({disabledInModes:["Playback"]})],Fs=[pr({disabledInModes:["Playback"]})],As=[pr({disabledInModes:["Playback"]})],Ps=[fr],Ts=[pr({disabledInModes:["Playback"]})],xs=[fr],Ss=[pr({disabledInModes:["Playback"]})],Es=[fr],Cs=[pr({disabledInModes:["Playback"]})],_s=[fr],ks=[pr({disabledInModes:["Playback"]})],ws=[fr],vs=[pr({disabledInModes:["Playback"]})],ys=[fr],bs=[pr({disabledInModes:["Playback"]})],ms=[fr],gs=[pr({disabledInModes:["Playback"]})],fs=[fr],ps=[pr({disabledInModes:["Playback"]})],hs=[pr({disabledInModes:["Playback"]})],us=[fr],ds=[pr({disabledInModes:["Playback"]})],cs=[pr({disabledInModes:["Playback"]})],ls=[fr],as=[fr],ss=[fr],is=[fr],os=[pr({disabledInModes:["Playback"]})],ns=[fr],rs=[fr],ts=[fr],es=[fr],Ji=[fr],Zi=[fr],Qi=[fr],Ki=[pr({disabledInModes:["Playback"]})],Yi=[pr({disabledInModes:["Playback"]})],Xi=[pr({disabledInModes:["Playback"]})],Gi=[pr({disabledInModes:["Playback"]})],zi=[pr({disabledInModes:["Playback"]})],Vi=[pr({disabledInModes:["Playback"]})],Ni=[fr],Hi=[fr],Wi=[fr],Ui=[fr],qi=[pr({disabledInModes:["Playback"]})],$i=[fr],ji=[pr({disabledInModes:["Playback"]})],Oi=[pr({disabledInModes:["Playback"]})],Bi=[fr],Di=[fr],Ri=[pr({disabledInModes:["Playback"]})],Li=[fr],Ii=[pr({disabledInModes:["Playback"]})],Mi=[fr],Fi=[pr()],Ai=[fr],Pi=[fr],Ti=[fr],xi=[fr],Si=[pr({disabledInModes:["Playback"]})],Ei=[fr],Ci=[fr],_i=[pr({disabledInModes:["Playback"]})],ki=[fr],wi=[pr({disabledInModes:["Playback"]})],vi=[fr],yi=[pr({disabledInModes:["Playback"]})],bi=[fr],mi=[pr({disabledInModes:["Playback"]})],gi=[fr],fi=[pr({disabledInModes:["Playback"]})],pi=[fr],hi=[fr],ui=[pr({disabledInModes:["Playback"]})],di=[pr({disabledInModes:["Playback"]})],ci=[fr],li=[pr({disabledInModes:["Playback"]})],ai=[fr],si=[pr({disabledInModes:["Playback"]})],ii=[fr],oi=[pr({disabledInModes:["Playback"]})],ni=[fr],ri=[pr({disabledInModes:["Playback"]})],ti=[fr],ei=[pr({disabledInModes:["Playback"]})],Jo=[fr],Zo=[fr],Qo=[pr({disabledInModes:["Playback"]})],Ko=[pr({disabledInModes:["Playback"]})],Yo=[fr],Xo=[pr({disabledInModes:["Playback"]})],Go=[fr],zo=[pr({disabledInModes:["Playback"]})],Vo=[fr],No=[pr({disabledInModes:["Playback"]})],Ho=[fr],Wo=[pr({disabledInModes:["Playback"]})],Uo=[fr],qo=[pr({disabledInModes:["Playback"]})],$o=[fr],jo=[fr],Oo=[fr],Bo=[fr],Do=[fr],Ro=[fr],Lo=[pr({disabledInModes:["Playback"]})],Io=[fr],Mo=[pr({disabledInModes:["Playback"]})],Fo=[fr],Ao=[pr({disabledInModes:["Playback"]})],Po=[fr],To=[pr({disabledInModes:["Playback"]})],xo=[pr({disabledInModes:["Playback"]})],So=[fr],Eo=[pr({disabledInModes:["Playback"]})],Co=[pr({disabledInModes:["Playback"]})],_o=[fr],ko=[fr],wo=[fr],vo=[fr],yo=[pr({disabledInModes:["Playback"]})],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=[fr],co=[pr({disabledInModes:["Playback"]})],lo=[fr],ao=[fr],so=[pr({disabledInModes:["Playback"]})],io=[fr],oo=[pr({disabledInModes:["Playback"]})],no=[fr],ro=[pr({disabledInModes:["Playback"]})],to=[fr],eo=[pr({disabledInModes:["Playback"]})],Jn=[fr],Zn=[pr({disabledInModes:["Playback"]})],Qn=[fr],Kn=[pr({disabledInModes:["Playback"]})],Yn=[pr({disabledInModes:["Playback"]})],Xn=[fr],Gn=[fr],zn=[pr({disabledInModes:["Playback"]})],Vn=[pr({disabledInModes:["Playback"]})],Nn=[fr],Hn=[pr({disabledInModes:["Playback"]})],Wn=[fr],Un=[pr({disabledInModes:["Playback"]})],qn=[fr],$n=[fr],jn=[pr({disabledInModes:["Playback"]})],On=[fr],Bn=[pr({disabledInModes:["Playback"]})],Dn=[fr],Rn=[pr({disabledInModes:["Playback"]})],Ln=[fr],In=[pr({disabledInModes:["Playback"]})],Mn=[fr],Fn=[pr()],An=[fr],Pn=[pr()],Tn=[pr({disabledInModes:["Playback"]})],xn=[fr],Sn=[pr({disabledInModes:["Playback"]})],En=[fr],Cn=[pr()],_n=[fr],kn=[pr({disabledInModes:["Playback"]})],wn=[fr],vn=[pr({disabledInModes:["Playback"]})],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=[fr],ln=[fr],an=[fr],sn=[pr({disabledInModes:["Playback"]})],on=[pr({disabledInModes:["Playback"]})],nn=[pr({disabledInModes:["Playback"]})],rn=[fr],tn=[pr({disabledInModes:["Playback"]})],en=[fr],Jr=[fr],Zr=[fr],Qr=[fr],Kr=[pr({disabledInModes:["Playback"]})],Yr=[pr({disabledInModes:["Playback"]})],Xr=[fr];var BlockAPI=class{constructor(e){b(xl,5,this),C(this,Tl),C(this,El),C(this,Sl),v(this,"onSelectionChanged",(e=>{const t=_(this,El).subscribeToSelectionChange(e);return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(t))}})),v(this,"onClicked",(e=>{const t=_(this,El).subscribeToBlockClicked(e);return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(t))}})),v(this,"onStateChanged",((e,t)=>{Gt("ids",e,It(Dt()));const r=_(this,El).subscribeToBlockState(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(r))}})),E(this,El,e),E(this,Sl,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(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(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(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 n="object"==typeof t?t:{mimeType:t,...r},o=n.mimeType??"image/png",i=null!=n.targetWidth&&null!=n.targetHeight,s=n.jpegQuality??.9,a=n.webpQuality??1,l=n.pngCompressionLevel??5;return new Promise(((t,r)=>{n.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,El).exportToBuffer(e,o,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:o}))}),{pngCompressionLevel:l,jpegQuality:s,webpQuality:a,useTargetSize:i,targetWidth:n.targetWidth??0,targetHeight:n.targetHeight??0,exportPdfWithHighCompatibility:n.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:n.exportPdfWithUnderlayer??!1,underlayerSpotColorName:n.underlayerSpotColorName??"",underlayerOffset:n.underlayerOffset??0})}))}async exportWithColorMask(e,t,r,n,o,i){Gt("handle",e,Bt());try{Gt("maskColorR",t,Bt()),Gt("maskColorG",r,Bt()),Gt("maskColorB",n,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(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",n,Bt()),Gt("maskColorB",o,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(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=n,c=o??{}):(s=r,a=n,l=o,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,El).exportWithColorMaskToBuffer(e,d,s,a,l,((e,n)=>{if("error"in e)r(e.error);else if("error"in n)r(n.error);else{const r=new Blob([e],{type:d}),o=new Blob([n],{type:d});t([r,o])}}),{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,n){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,n)=>{_(this,El).unstable_exportAudioToBuffer(e,t.timeOffset??0,t.duration??0,t.mimeType??"audio/wav",t.onProgress??(()=>{}),(e=>{"error"in e?n(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,El).loadBlocksFromString(e,t))).then((e=>lr(e)))}loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,El).loadBlocksFromArchiveURL(e,t))).then((e=>lr(e)))}async saveToString(e,t=["buffer","http","https"],r){return Gt("blocks",e,It(Bt())),ar((n=>_(this,El).saveBlocksToString(e,n,t,r?async(e,t,n)=>{const o=await r(e,t);n&&n.invoke(e,o)}:void 0)))}async saveToArchive(e){return Gt("blocks",e,It(Bt())),new Promise(((t,r)=>{_(this,El).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,El).create(e))}createFill(e){return Gt("type",e,$t()),sr(_(this,El).createFill(e))}getAudioTrackCountFromVideo(e){return Gt("videoFillBlock",e,Dt()),sr(_(this,El).getAudioTrackCountFromVideo(e))}createAudioFromVideo(e,t,r=!1){return Gt("videoFillBlock",e,Dt()),Gt("trackIndex",t,Bt()),Gt("muteOriginalVideo",r,Lt()),sr(_(this,El).createAudioFromVideo(e,t,r))}createAudiosFromVideo(e,t=!1){return Gt("videoFillBlock",e,Dt()),Gt("muteOriginalVideo",t,Lt()),lr(sr(_(this,El).createAudiosFromVideo(e,t)))}getAudioInfoFromVideo(e){return Gt("videoFillBlock",e,Dt()),lr(sr(_(this,El).getAudioInfoFromVideo(e)))}async createCaptionsFromURI(e){return Gt("uri",e,$t()),ar((t=>_(this,El).createCaptionsFromURI(e,t))).then((e=>lr(e)))}getType(e){return Gt("id",e,Dt()),sr(_(this,El).getType(e))}getKind(e){return Gt("id",e,Dt()),sr(_(this,El).getKind(e))}setKind(e,t){Gt("id",e,Dt()),sr(_(this,El).setKind(e,t))}select(e){return Gt("id",e,Dt()),sr(_(this,El).select(e))}setSelected(e,t){return Gt("id",e,Dt()),Gt("selected",t,Lt()),sr(_(this,El).setSelected(e,t))}isSelected(e){return Gt("id",e,Dt()),sr(_(this,El).isSelected(e))}findAllSelected(){return lr(_(this,El).findAllSelected())}isGroupable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isGroupable(e))}group(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).group(e))}ungroup(e){return Gt("id",e,Bt()),sr(_(this,El).ungroup(e))}enterGroup(e){return Gt("id",e,Bt()),sr(_(this,El).enterGroup(e))}exitGroup(e){return Gt("id",e,Bt()),sr(_(this,El).exitGroup(e))}isCombinable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isCombinable(e))}combine(e,t){return Gt("ids",e,It(Bt())),Gt("op",t,$t()),sr(_(this,El).combine(e,t))}setName(e,t){return Gt("id",e,Dt()),Gt("name",t,$t()),sr(_(this,El).setName(e,t))}getName(e){return Gt("id",e,Dt()),sr(_(this,El).getName(e))}getUUID(e){return Gt("id",e,Dt()),sr(_(this,El).getUUID(e))}findByName(e){Gt("name",e,$t());const t=_(this,El).findByName(e);return lr(t)}findByType(e){Gt("type",e,$t());const t=sr(_(this,El).findByType(e));return lr(t)}findByKind(e){Gt("kind",e,$t());const t=sr(_(this,El).findByKind(e));return lr(t)}findAll(){return lr(_(this,El).findAll())}findAllPlaceholders(){return lr(_(this,El).findAllPlaceholders())}createShape(e){return Gt("type",e,$t()),sr(_(this,El).createShape(e))}hasShape(e){return Gt("id",e,Dt()),sr(_(this,El).hasShape(e))}supportsShape(e){return Gt("id",e,Dt()),sr(_(this,El).supportsShape(e))}getShape(e){return Gt("id",e,Dt()),sr(_(this,El).getShape(e))}setShape(e,t){return Gt("id",e,Dt()),Gt("shape",t,Dt()),sr(_(this,El).setShape(e,t))}isVisible(e){return Gt("id",e,Dt()),sr(_(this,El).isVisible(e))}setVisible(e,t){return Gt("id",e,Dt()),Gt("visible",t,Lt()),sr(_(this,El).setVisible(e,t))}isClipped(e){return Gt("id",e,Dt()),sr(_(this,El).isClipped(e))}setClipped(e,t){return Gt("id",e,Dt()),Gt("clipped",t,Lt()),sr(_(this,El).setClipped(e,t))}isTransformLocked(e){return Gt("id",e,Dt()),sr(_(this,El).isTransformLocked(e))}setTransformLocked(e,t){return Gt("id",e,Dt()),Gt("locked",t,Lt()),sr(_(this,El).setTransformLocked(e,t))}getPositionX(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionX(e))}getPositionXMode(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionXMode(e))}getPositionY(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionY(e))}getPositionYMode(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionYMode(e))}setPositionX(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,El).setPositionX(e,t))}setPositionXMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setPositionXMode(e,t))}setPositionY(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,El).setPositionY(e,t))}setPositionYMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Gt("id",e,Dt()),sr(_(this,El).isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Gt("id",e,Dt()),sr(_(this,El).isAlwaysOnBottom(e))}bringToFront(e){return Gt("id",e,Bt()),sr(_(this,El).bringToFront(e))}sendToBack(e){return Gt("id",e,Bt()),sr(_(this,El).sendToBack(e))}bringForward(e){return Gt("id",e,Bt()),sr(_(this,El).bringForward(e))}sendBackward(e){return Gt("id",e,Bt()),sr(_(this,El).sendBackward(e))}getRotation(e){return Gt("id",e,Dt()),sr(_(this,El).getRotation(e))}setRotation(e,t){return Gt("id",e,Dt()),Gt("radians",t,Bt()),sr(_(this,El).setRotation(e,t))}getFlipHorizontal(e){return Gt("id",e,Dt()),sr(_(this,El).getFlip(e)).horizontal}getFlipVertical(e){return Gt("id",e,Dt()),sr(_(this,El).getFlip(e)).vertical}setFlipHorizontal(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,El).setFlipHorizontal(e,t))}setFlipVertical(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,El).setFlipVertical(e,t))}hasContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).hasContentFillMode(e))}supportsContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).supportsContentFillMode(e))}getWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getWidth(e))}getWidthMode(e){return Gt("id",e,Dt()),sr(_(this,El).getWidthMode(e))}getHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getHeight(e))}getHeightMode(e){return Gt("id",e,Dt()),sr(_(this,El).getHeightMode(e))}setSize(e,t,r,n){return Gt("id",e,Dt()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",n,jt(Ot({maintainCrop:jt(Lt()),sizeMode:jt(tr())}))),null!=n?.sizeMode&&(sr(_(this,El).setWidthMode(e,n.sizeMode)),sr(_(this,El).setHeightMode(e,n.sizeMode))),sr(_(this,El).setWidth(e,t,n?.maintainCrop??!1)),sr(_(this,El).setHeight(e,r,n?.maintainCrop??!1))}setPosition(e,t,r,n){return Gt("id",e,Dt()),Gt("x",t,Bt()),Gt("y",r,Bt()),null!=n?.positionMode&&(sr(_(this,El).setPositionXMode(e,n.positionMode)),sr(_(this,El).setPositionYMode(e,n.positionMode))),sr(_(this,El).setPositionX(e,t)),sr(_(this,El).setPositionY(e,r))}setWidth(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,El).setWidth(e,t,r??!1))}setWidthMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setWidthMode(e,t))}setHeight(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,El).setHeight(e,t,r??!1))}setHeightMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setHeightMode(e,t))}getFrameX(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameX(e))}getFrameY(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameY(e))}getFrameWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameWidth(e))}getFrameHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameHeight(e))}setContentFillMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setContentFillMode(e,t))}getContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).getContentFillMode(e))}duplicate(e,t=!0){return Gt("id",e,Dt()),sr(_(this,El).duplicate(e,t))}destroy(e){return Gt("id",e,Dt()),sr(_(this,El).destroy(e))}isValid(e){return Gt("id",e,Dt()),_(this,El).isValid(e)}getParent(e){return Gt("id",e,Dt()),sr(_(this,El).hasParent(e))?sr(_(this,El).getParent(e)):null}getChildren(e){Gt("id",e,Dt());const t=sr(_(this,El).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,El).insertChild(e,t,r))}appendChild(e,t){return Gt("parent",e,Bt()),Gt("child",t,Bt()),sr(_(this,El).appendChild(e,t))}referencesAnyVariables(e){return Gt("id",e,Dt()),sr(_(this,El).referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Gt("ids",e,It(Bt())),sr(_(this,El).getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).alignHorizontally(e,t))}alignVertically(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).alignVertically(e,t))}isAlignable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isAlignable(e))}distributeHorizontally(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).distributeHorizontally(e))}distributeVertically(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).distributeVertically(e))}isDistributable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isDistributable(e))}fillParent(e){return Gt("id",e,Dt()),sr(_(this,El).fillParent(e))}resizeContentAware(e,t,r){return Gt("ids",e,It(Bt())),Gt("width",t,Bt()),Gt("height",r,Bt()),sr(_(this,El).resizeContentAware(e,t,r))}scale(e,t,r=0,n=0){return Gt("id",e,Dt()),sr(_(this,El).scale(e,t,r,n))}findAllProperties(e){return Gt("id",e,Dt()),lr(sr(_(this,El).findAllProperties(e)))}isPropertyReadable(e){return Gt("property",e,$t()),_(this,El).isPropertyReadable(e)}isPropertyWritable(e){return Gt("property",e,$t()),_(this,El).isPropertyWritable(e)}getPropertyType(e){Gt("property",e,$t());return sr(_(this,El).getPropertyType(e))}getEnumValues(e){return Gt("enumProperty",e,$t()),lr(sr(_(this,El).getEnumValues(e)))}setBool(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Lt()),sr(_(this,El).setBool(e,t,r))}getBool(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getBool(e,t))}setInt(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Dt()),sr(_(this,El).setInt(e,t,r))}getInt(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getInt(e,t))}setFloat(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,El).setFloat(e,t,r))}getFloat(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getFloat(e,t))}setDouble(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,El).setDouble(e,t,r))}getDouble(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getDouble(e,t))}setString(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,El).setString(e,t,r))}getString(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getString(e,t))}setColor(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,or()),sr(_(this,El).setColor(e,t,Gr.fromColor(r)))}getColor(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),Gr.toColor(sr(_(this,El).getColor(e,t)))}setColorRGBA(e,t,r,n,o,i=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("r",r,Bt()),Gt("g",n,Bt()),Gt("b",o,Bt()),Gt("a",i,Bt()),sr(_(this,El).setColorRGBA(e,t,r,n,o,i))}getColorRGBA(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorRGBA(e,t))}setColorSpot(e,t,r,n=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("name",r,$t()),Gt("tint",n,Bt()),sr(_(this,El).setColorSpot(e,t,r,n))}getColorSpotName(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorSpotName(e,t))}getColorSpotTint(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t());const n=r.map((e=>({color:Gr.fromColor(e.color),stop:e.stop})));return sr(_(this,El).setGradientColorStops(e,t,n))}getGradientColorStops(e,t){Gt("id",e,Dt()),Gt("property",t,$t());const r=sr(_(this,El).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,El).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,El).setSourceSet(e,t,r))}addImageFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((n=>_(this,El).addImageFileURIToSourceSet(e,t,r,n)))}addVideoFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((n=>_(this,El).addVideoFileURIToSourceSet(e,t,r,n)))}setEnum(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,El).setEnum(e,t,r))}getEnum(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getEnum(e,t))}hasCrop(e){return Gt("id",e,Dt()),sr(_(this,El).hasCrop(e))}supportsCrop(e){return Gt("id",e,Dt()),sr(_(this,El).supportsCrop(e))}setCropScaleX(e,t){return Gt("id",e,Dt()),Gt("scaleX",t,Bt()),sr(_(this,El).setCropScaleX(e,t))}setCropScaleY(e,t){return Gt("id",e,Dt()),Gt("scaleY",t,Bt()),sr(_(this,El).setCropScaleY(e,t))}setCropRotation(e,t){return Gt("id",e,Dt()),Gt("rotation",t,Bt()),sr(_(this,El).setCropRotation(e,t))}setCropScaleRatio(e,t){return Gt("id",e,Dt()),Gt("scaleRatio",t,Bt()),sr(_(this,El).setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Gt("id",e,Dt()),Gt("translationX",t,Bt()),sr(_(this,El).setCropTranslationX(e,t))}setCropTranslationY(e,t){return Gt("id",e,Dt()),Gt("translationY",t,Bt()),sr(_(this,El).setCropTranslationY(e,t))}resetCrop(e){return Gt("id",e,Dt()),sr(_(this,El).resetCrop(e))}getCropScaleX(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleX(e))}getCropScaleY(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleY(e))}getCropRotation(e){return Gt("id",e,Dt()),sr(_(this,El).getCropRotation(e))}getCropScaleRatio(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleRatio(e))}getCropTranslationX(e){return Gt("id",e,Dt()),sr(_(this,El).getCropTranslationX(e))}getCropTranslationY(e){return Gt("id",e,Dt()),sr(_(this,El).getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Gt("id",e,Dt()),Gt("minScaleRatio",t,Bt()),sr(_(this,El).adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Gt("id",e,Dt()),sr(_(this,El).flipCropHorizontal(e))}flipCropVertical(e){return Gt("id",e,Dt()),sr(_(this,El).flipCropVertical(e))}hasOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).hasOpacity(e))}supportsOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).supportsOpacity(e))}setOpacity(e,t){return Gt("id",e,Dt()),Gt("opacity",t,Bt()),sr(_(this,El).setOpacity(e,t))}getOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).getOpacity(e))}hasBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).hasBlendMode(e))}supportsBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBlendMode(e))}setBlendMode(e,t){return Gt("id",e,Dt()),Gt("blendMode",t,$t()),sr(_(this,El).setBlendMode(e,t))}getBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).getBlendMode(e))}hasFillColor(e){return Gt("id",e,Dt()),sr(_(this,El).hasFillColor(e))}isIncludedInExport(e){return Gt("id",e,Dt()),sr(_(this,El).isIncludedInExport(e))}setIncludedInExport(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setFillColorRGBA(e,t,r,n,o))}getFillColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getFillColorRGBA(e))}setFillColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setFillColorEnabled(e,t))}isFillColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isFillColorEnabled(e))}createEffect(e){return Gt("type",e,$t()),sr(_(this,El).createEffect(e))}hasEffects(e){return Gt("id",e,Dt()),sr(_(this,El).hasEffects(e))}supportsEffects(e){return Gt("id",e,Dt()),sr(_(this,El).supportsEffects(e))}getEffects(e){Gt("id",e,Dt());const t=sr(_(this,El).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,El).insertEffect(e,t,r))}appendEffect(e,t){Gt("id",e,Dt()),Gt("effectId",t,Dt()),sr(_(this,El).appendEffect(e,t))}removeEffect(e,t){Gt("id",e,Dt()),Gt("index",t,Ht(Dt(),0)),sr(_(this,El).removeEffect(e,t))}hasEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,El).hasEffectEnabled(e))}setEffectEnabled(e,t){Gt("effectId",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setEffectEnabled(e,t))}isEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,El).isEffectEnabled(e))}createBlur(e){return Gt("type",e,$t()),sr(_(this,El).createBlur(e))}hasBlur(e){return Gt("id",e,Dt()),sr(_(this,El).hasBlur(e))}supportsBlur(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBlur(e))}setBlur(e,t){Gt("id",e,Dt()),Gt("blurId",t,Dt()),sr(_(this,El).setBlur(e,t))}getBlur(e){return Gt("id",e,Dt()),sr(_(this,El).getBlur(e))}setBlurEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setBlurEnabled(e,t))}isBlurEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isBlurEnabled(e))}hasBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,El).hasBackgroundColor(e))}supportsBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setBackgroundColorRGBA(e,t,r,n,o))}getBackgroundColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isBackgroundColorEnabled(e))}hasStroke(e){return Gt("id",e,Dt()),sr(_(this,El).hasStroke(e))}supportsStroke(e){return Gt("id",e,Dt()),sr(_(this,El).supportsStroke(e))}setStrokeEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setStrokeEnabled(e,t))}isStrokeEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setStrokeColorRGBA(e,t,r,n,o))}setStrokeColor(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeColor(e,Gr.fromColor(t)))}getStrokeColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getStrokeColorRGBA(e))}getStrokeColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,El).getStrokeColor(e)))}setStrokeWidth(e,t){return Gt("id",e,Dt()),Gt("width",t,Bt()),sr(_(this,El).setStrokeWidth(e,t))}getStrokeWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getStrokeWidth(e))}setStrokeStyle(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeStyle(e,t))}getStrokeStyle(e){Gt("id",e,Dt());return sr(_(this,El).getStrokeStyle(e))}setStrokePosition(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokePosition(e,t))}getStrokePosition(e){Gt("id",e,Dt());return sr(_(this,El).getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Gt("id",e,Dt());return sr(_(this,El).getStrokeCornerGeometry(e))}hasDropShadow(e){return Gt("id",e,Dt()),sr(_(this,El).hasDropShadow(e))}supportsDropShadow(e){return Gt("id",e,Dt()),sr(_(this,El).supportsDropShadow(e))}setDropShadowEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setDropShadowColorRGBA(e,t,r,n,o))}setDropShadowColor(e,t){return Gt("id",e,Dt()),Gt("color",t,or()),sr(_(this,El).setDropShadowColor(e,Gr.fromColor(t)))}getDropShadowColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowColorRGBA(e))}getDropShadowColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,El).getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Gt("id",e,Dt()),Gt("offsetX",t,Bt()),sr(_(this,El).setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Gt("id",e,Dt()),Gt("offsetY",t,Bt()),sr(_(this,El).setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Gt("id",e,Dt()),Gt("blurRadiusX",t,Bt()),sr(_(this,El).setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Gt("id",e,Dt()),Gt("blurRadiusY",t,Bt()),sr(_(this,El).setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Gt("id",e,Dt()),sr(_(this,El).setDropShadowClip(e,t))}getDropShadowClip(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4,n=!0){return Gt("ids",e,It(Dt())),Gt("vectorizeDistanceThreshold",t,Bt()),Gt("maxSmoothingDistance",r,Bt()),Gt("useExistingShapeInformation",n,Lt()),sr(_(this,El).createCutoutFromBlocks(e,t,r,n))}createCutoutFromPath(e){return Gt("path",e,$t()),sr(_(this,El).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,El).createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("text",t,$t()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).replaceText(e,t,r,n))}removeText(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).removeText(e,t,r))}setTextColor(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("color",t,or()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextColor(e,Gr.fromColor(t),r,n))}getTextColors(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt());const n=_(this,El).getTextColors(e,t,r);return lr(sr(n)).map((e=>Gr.toColor(e)))}setTextFontWeight(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontWeight(e,t,r,n))}getTextFontWeights(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTextFontWeights(e,t,r)))}setTextFontSize(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontSize(e,t,r,n))}getTextFontSizes(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTextFontSizes(e,t,r)))}setTextFontStyle(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontStyle(e,t,r,n))}getTextFontStyles(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).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,El).getTextCases(e,t,r)))}setTextCase(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("textCase",t,$t()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextCase(e,t,r,n))}canToggleBoldFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).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,El).canToggleItalicFont(e,t,r))}toggleBoldFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).toggleBoldFont(e,t,r))}toggleItalicFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).toggleItalicFont(e,t,r))}setFont(e,t,r){Gt("block",e,Dt()),Gt("fontFileUri",t,$t()),sr(_(this,El).setFont(e,t,r))}setTypeface(e,t,r=-1,n=-1){Gt("block",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTypeface(e,t,r,n))}getTypeface(e){return Gt("block",e,Dt()),sr(_(this,El).getTypeface(e))}getTypefaces(e,t=-1,r=-1){return Gt("block",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTypefaces(e,t,r)))}getTextCursorRange(){return sr(_(this,El).getTextCursorRange())}getTextVisibleLineCount(e){return Gt("id",e,Dt()),sr(_(this,El).getTextVisibleLineCount(e))}getTextVisibleLineGlobalBoundingBoxXYWH(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,El).getTextVisibleLineGlobalBoundingBoxXYWH(e,t))}getTextVisibleLineContent(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,El).getTextVisibleLineContent(e,t))}hasFill(e){return Gt("id",e,Dt()),sr(_(this,El).hasFill(e))}supportsFill(e){return Gt("id",e,Dt()),sr(_(this,El).supportsFill(e))}isFillEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isFillEnabled(e))}setFillEnabled(e,t){return Gt("id",e,Dt()),sr(_(this,El).setFillEnabled(e,t))}getFill(e){return Gt("id",e,Dt()),sr(_(this,El).getFill(e))}setFill(e,t){return Gt("id",e,Dt()),Gt("fill",t,Dt()),sr(_(this,El).setFill(e,t))}setFillSolidColor(e,t,r,n,o=1){Gt("id",e,Dt()),sr(_(this,El).setFillSolidColor(e,t,r,n,o))}getFillSolidColor(e){return Gt("id",e,Dt()),sr(_(this,El).getFillSolidColor(e))}setPlaceholderEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaceholderBehavior(e))}supportsPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Gt("id",e,Dt()),sr(_(this,El).setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaceholderControls(e))}supportsPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("value",r,$t()),sr(_(this,El).setMetadata(e,t,r))}getMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).getMetadata(e,t))}hasMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).hasMetadata(e,t))}findAllMetadata(e){return Gt("id",e,Dt()),lr(sr(_(this,El).findAllMetadata(e)))}removeMetadata(e,t){Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).removeMetadata(e,t))}setScopeEnabled(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("enabled",r,Lt()),sr(_(this,El).setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).isScopeEnabled(e,t))}isAllowedByScope(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).isAllowedByScope(e,t))}hasDuration(e){return Gt("id",e,Dt()),sr(_(this,El).hasDuration(e))}supportsDuration(e){return Gt("id",e,Dt()),sr(_(this,El).supportsDuration(e))}setDuration(e,t){return Gt("id",e,Dt()),Gt("duration",t,Bt()),sr(_(this,El).setDuration(e,t))}getDuration(e){return Gt("id",e,Dt()),sr(_(this,El).getDuration(e))}setPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,El).setPageDurationSource(e,t))}isPageDurationSource(e){return Gt("id",e,Dt()),sr(_(this,El).isPageDurationSource(e))}supportsPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,El).supportsPageDurationSource(e,t))}removePageDurationSource(e){Gt("id",e,Dt()),sr(_(this,El).removePageDurationSource(e))}hasTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).hasTimeOffset(e))}supportsTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).supportsTimeOffset(e))}setTimeOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,El).setTimeOffset(e,t))}getTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).getTimeOffset(e))}hasTrim(e){return Gt("id",e,Dt()),sr(_(this,El).hasTrim(e))}supportsTrim(e){return Gt("id",e,Dt()),sr(_(this,El).supportsTrim(e))}setTrimOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,El).setTrimOffset(e,t))}getTrimOffset(e){return Gt("id",e,Dt()),sr(_(this,El).getTrimOffset(e))}setTrimLength(e,t){return Gt("id",e,Dt()),Gt("length",t,Bt()),sr(_(this,El).setTrimLength(e,t))}getTrimLength(e){return Gt("id",e,Dt()),sr(_(this,El).getTrimLength(e))}split(e,t,r={}){return Gt("id",e,Dt()),Gt("atTime",t,Bt()),Gt("options",r,Ot({attachToParent:jt(Lt()),createParentTrackIfNeeded:jt(Lt()),selectNewBlock:jt(Lt())})),sr(_(this,El).split(e,t,{attachToParent:r.attachToParent??!0,createParentTrackIfNeeded:r.createParentTrackIfNeeded??!1,selectNewBlock:r.selectNewBlock??!0}))}getTotalSceneDuration(e){return Gt("scene",e,Dt()),sr(_(this,El).getTotalSceneDuration(e))}setPlaying(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaying(e,t))}isPlaying(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaying(e))}hasPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaybackTime(e))}supportsPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaybackTime(e))}setPlaybackTime(e,t){return Gt("id",e,Dt()),Gt("time",t,Bt()),sr(_(this,El).setPlaybackTime(e,t))}getPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaybackControl(e))}supportsPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaybackControl(e))}setLooping(e,t){Gt("id",e,Dt()),Gt("looping",t,Lt()),sr(_(this,El).setLooping(e,t))}isLooping(e){return Gt("id",e,Dt()),sr(_(this,El).isLooping(e))}setMuted(e,t){Gt("id",e,Dt()),Gt("muted",t,Lt()),sr(_(this,El).setMuted(e,t))}isMuted(e){return Gt("id",e,Dt()),sr(_(this,El).isMuted(e))}setVolume(e,t){Gt("id",e,Dt()),Gt("volume",t,Bt()),sr(_(this,El).setVolume(e,t))}getVolume(e){return Gt("id",e,Dt()),sr(_(this,El).getVolume(e))}async forceLoadAVResource(e){return Gt("id",e,Dt()),ar((t=>_(this,El).forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Gt("id",e,Dt()),sr(_(this,El).unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Gt("id",e,Dt()),sr(_(this,El).getAVResourceTotalDuration(e))}getVideoWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getVideoWidth(e))}getVideoHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,n,o,i){Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",n,Bt()),Gt("numberOfFrames",o,Dt());const s=_(this,El).generateVideoThumbnailSequence(e,t,r,n,o,(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,El).cancelVideoThumbnailSequenceGeneration(s)}}generateAudioThumbnailSequence(e,t,r,n,o,i,s){Gt("id",e,Dt()),Gt("samplesPerChunk",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",n,Bt()),Gt("numberOfSamples",o,Dt()),Gt("numberOfChannels",i,Dt());const a=_(this,El).generateAudioThumbnailSequence(e,t,r,n,o,i,(e=>{"error"in e?s(0,new Error(e.error)):s(e.chunkIndex,e.sampleData)}));return()=>{_(this,El).cancelAudioThumbnailSequenceGeneration(a)}}async getVideoFillThumbnail(e,t){return Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),new Promise(((r,n)=>{_(this,El).getVideoFillThumbnail(e,t,(e=>{"error"in e?n(e.error):r(new Blob([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,n){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),Gt("thumbnailHeight",n,Dt()),new Promise(((o,i)=>{_(this,El).getVideoFillThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new Blob([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,n){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),new Promise(((o,i)=>{_(this,El).getPageThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new Blob([e],{type:"image/jpeg"}))}))}))}createAnimation(e){return Gt("type",e,$t()),sr(_(this,El).createAnimation(e))}supportsAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).supportsAnimation(e))}setInAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setInAnimation(e,t))}setLoopAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setLoopAnimation(e,t))}setOutAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setOutAnimation(e,t))}getInAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getInAnimation(e))}getLoopAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getLoopAnimation(e))}getOutAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getOutAnimation(e))}setNativePixelBuffer(e,t){Gt("id",e,Dt()),t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),sr(_(this,El).setNativePixelBuffer(e,t))}getState(e){return Gt("id",e,Dt()),sr(_(this,El).getState(e))}setState(e,t){Gt("id",e,Dt()),sr(_(this,El).setState(e,t))}async forceLoadResources(e){return Gt("ids",e,It(Dt())),ar((t=>_(this,El).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(or()),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:n,size:o,timeline:i,animation:s,shadow:a,cornerRadius:l,sizeMode:c="Absolute",positionMode:d="Absolute"}=t;let u,h;if(null!=o)"number"==typeof o?(u=o,h=o):(u=o.width,h=o.height);else{const t=await new Promise(((t,r)=>{const n=new Image;n.src=e,n.onerror=r,n.onload=()=>{t({width:n.width,height:n.height})}}));u=t.width,h=t.height}const p=_(this,Sl).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!=n?this.setPositionY(f,n):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,Sl).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,n={}){if(Gt("url",e,$t()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",n,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(or()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),cornerRadius:jt(Bt())}))),"Design"===_(this,Sl).getMode())throw new Error("Cannot add video in design mode.");const{x:o,y:i,timeline:s,animation:a,shadow:l,cornerRadius:c,sizeMode:d="Absolute",positionMode:u="Absolute"}=n,h=_(this,Sl).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!=o?this.setPositionX(p,o):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,Tl,Pl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.in.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}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,Tl,Pl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.out.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}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,Tl,Pl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.loop.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}}applyDropShadow(e,t={}){Gt("block",e,Dt()),Gt("options",t,jt(Ot({color:jt(or()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})));const{color:r,offset:n,blur:o}=t;this.setDropShadowEnabled(e,!0),null!=r&&this.setDropShadowColor(e,r),null!=n&&(null!=n.x&&this.setDropShadowOffsetX(e,n.x),null!=n.y&&this.setDropShadowOffsetY(e,n.y)),null!=o&&(null!=o.x&&this.setDropShadowBlurRadiusX(e,o.x),null!=o.y&&this.setDropShadowBlurRadiusY(e,o.y))}async generateThumbnailAtTimeOffset(e,t){Gt("height",e,Ht(Wt(Dt(),512),1)),Gt("time",t,Bt());const r=_(this,Sl).getCurrentPage();if(null==r)throw new Error("No page to get thumbnail for");if("Design"===_(this,Sl).getMode())throw new Error("Cannot get thumbnail in design mode. Use export instead.");return new Promise(((n,o)=>{_(this,El).generateVideoThumbnailSequence(r,e,t,t,1,(e=>{if("error"in e)o(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 o(new Error("Failed to get canvas context"));i.putImageData(t,0,0),r.toBlob((e=>{e?n(e):o(new Error("Failed to convert to PNG"))}),"image/png")}}))}))}getBackgroundTrack(){if("Design"===_(this,Sl).getMode())throw new Error("Cannot get background track in design mode");if(null==_(this,Sl).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)}};xl=h(null),El=new WeakMap,Sl=new WeakMap,Tl=new WeakSet,Pl=function(e,t){return this.findAllProperties(e).includes(t)},y(xl,1,"loadFromString",Cl,BlockAPI),y(xl,1,"loadFromArchiveURL",_l,BlockAPI),y(xl,1,"create",kl,BlockAPI),y(xl,1,"createFill",wl,BlockAPI),y(xl,1,"createAudioFromVideo",vl,BlockAPI),y(xl,1,"createAudiosFromVideo",yl,BlockAPI),y(xl,1,"createCaptionsFromURI",bl,BlockAPI),y(xl,1,"getType",ml,BlockAPI),y(xl,1,"getKind",gl,BlockAPI),y(xl,1,"setKind",fl,BlockAPI),y(xl,1,"select",pl,BlockAPI),y(xl,1,"setSelected",hl,BlockAPI),y(xl,1,"isSelected",ul,BlockAPI),y(xl,1,"findAllSelected",dl,BlockAPI),y(xl,1,"isGroupable",cl,BlockAPI),y(xl,1,"group",ll,BlockAPI),y(xl,1,"ungroup",al,BlockAPI),y(xl,1,"enterGroup",sl,BlockAPI),y(xl,1,"exitGroup",il,BlockAPI),y(xl,1,"isCombinable",ol,BlockAPI),y(xl,1,"combine",nl,BlockAPI),y(xl,1,"setName",rl,BlockAPI),y(xl,1,"getName",tl,BlockAPI),y(xl,1,"getUUID",el,BlockAPI),y(xl,1,"findByName",Ja,BlockAPI),y(xl,1,"findByType",Za,BlockAPI),y(xl,1,"findByKind",Qa,BlockAPI),y(xl,1,"findAll",Ka,BlockAPI),y(xl,1,"findAllPlaceholders",Ya,BlockAPI),y(xl,1,"createShape",Xa,BlockAPI),y(xl,1,"getShape",Ga,BlockAPI),y(xl,1,"setShape",za,BlockAPI),y(xl,1,"isVisible",Va,BlockAPI),y(xl,1,"setVisible",Na,BlockAPI),y(xl,1,"isClipped",Ha,BlockAPI),y(xl,1,"setClipped",Wa,BlockAPI),y(xl,1,"isTransformLocked",Ua,BlockAPI),y(xl,1,"setTransformLocked",qa,BlockAPI),y(xl,1,"getPositionX",$a,BlockAPI),y(xl,1,"getPositionXMode",ja,BlockAPI),y(xl,1,"getPositionY",Oa,BlockAPI),y(xl,1,"getPositionYMode",Ba,BlockAPI),y(xl,1,"setPositionX",Da,BlockAPI),y(xl,1,"setPositionXMode",Ra,BlockAPI),y(xl,1,"setPositionY",La,BlockAPI),y(xl,1,"setPositionYMode",Ia,BlockAPI),y(xl,1,"setAlwaysOnTop",Ma,BlockAPI),y(xl,1,"setAlwaysOnBottom",Fa,BlockAPI),y(xl,1,"isAlwaysOnTop",Aa,BlockAPI),y(xl,1,"isAlwaysOnBottom",Pa,BlockAPI),y(xl,1,"bringToFront",Ta,BlockAPI),y(xl,1,"sendToBack",xa,BlockAPI),y(xl,1,"bringForward",Sa,BlockAPI),y(xl,1,"sendBackward",Ea,BlockAPI),y(xl,1,"getRotation",Ca,BlockAPI),y(xl,1,"setRotation",_a,BlockAPI),y(xl,1,"getFlipHorizontal",ka,BlockAPI),y(xl,1,"getFlipVertical",wa,BlockAPI),y(xl,1,"setFlipHorizontal",va,BlockAPI),y(xl,1,"setFlipVertical",ya,BlockAPI),y(xl,1,"getWidth",ba,BlockAPI),y(xl,1,"getWidthMode",ma,BlockAPI),y(xl,1,"getHeight",ga,BlockAPI),y(xl,1,"getHeightMode",fa,BlockAPI),y(xl,1,"setSize",pa,BlockAPI),y(xl,1,"setPosition",ha,BlockAPI),y(xl,1,"setWidth",ua,BlockAPI),y(xl,1,"setWidthMode",da,BlockAPI),y(xl,1,"setHeight",ca,BlockAPI),y(xl,1,"setHeightMode",la,BlockAPI),y(xl,1,"getFrameX",aa,BlockAPI),y(xl,1,"getFrameY",sa,BlockAPI),y(xl,1,"getFrameWidth",ia,BlockAPI),y(xl,1,"getFrameHeight",oa,BlockAPI),y(xl,1,"setContentFillMode",na,BlockAPI),y(xl,1,"getContentFillMode",ra,BlockAPI),y(xl,1,"duplicate",ta,BlockAPI),y(xl,1,"destroy",ea,BlockAPI),y(xl,1,"isValid",Js,BlockAPI),y(xl,1,"getParent",Zs,BlockAPI),y(xl,1,"getChildren",Qs,BlockAPI),y(xl,1,"insertChild",Ks,BlockAPI),y(xl,1,"appendChild",Ys,BlockAPI),y(xl,1,"referencesAnyVariables",Xs,BlockAPI),y(xl,1,"getGlobalBoundingBoxX",Gs,BlockAPI),y(xl,1,"getGlobalBoundingBoxY",zs,BlockAPI),y(xl,1,"getGlobalBoundingBoxWidth",Vs,BlockAPI),y(xl,1,"getGlobalBoundingBoxHeight",Ns,BlockAPI),y(xl,1,"getScreenSpaceBoundingBoxXYWH",Hs,BlockAPI),y(xl,1,"alignHorizontally",Ws,BlockAPI),y(xl,1,"alignVertically",Us,BlockAPI),y(xl,1,"isAlignable",qs,BlockAPI),y(xl,1,"distributeHorizontally",$s,BlockAPI),y(xl,1,"distributeVertically",js,BlockAPI),y(xl,1,"isDistributable",Os,BlockAPI),y(xl,1,"fillParent",Bs,BlockAPI),y(xl,1,"resizeContentAware",Ds,BlockAPI),y(xl,1,"scale",Rs,BlockAPI),y(xl,1,"findAllProperties",Ls,BlockAPI),y(xl,1,"isPropertyReadable",Is,BlockAPI),y(xl,1,"isPropertyWritable",Ms,BlockAPI),y(xl,1,"getPropertyType",Fs,BlockAPI),y(xl,1,"getEnumValues",As,BlockAPI),y(xl,1,"setBool",Ps,BlockAPI),y(xl,1,"getBool",Ts,BlockAPI),y(xl,1,"setInt",xs,BlockAPI),y(xl,1,"getInt",Ss,BlockAPI),y(xl,1,"setFloat",Es,BlockAPI),y(xl,1,"getFloat",Cs,BlockAPI),y(xl,1,"setDouble",_s,BlockAPI),y(xl,1,"getDouble",ks,BlockAPI),y(xl,1,"setString",ws,BlockAPI),y(xl,1,"getString",vs,BlockAPI),y(xl,1,"setColor",ys,BlockAPI),y(xl,1,"getColor",bs,BlockAPI),y(xl,1,"setColorRGBA",ms,BlockAPI),y(xl,1,"getColorRGBA",gs,BlockAPI),y(xl,1,"setColorSpot",fs,BlockAPI),y(xl,1,"getColorSpotName",ps,BlockAPI),y(xl,1,"getColorSpotTint",hs,BlockAPI),y(xl,1,"setGradientColorStops",us,BlockAPI),y(xl,1,"getGradientColorStops",ds,BlockAPI),y(xl,1,"getSourceSet",cs,BlockAPI),y(xl,1,"setSourceSet",ls,BlockAPI),y(xl,1,"addImageFileURIToSourceSet",as,BlockAPI),y(xl,1,"addVideoFileURIToSourceSet",ss,BlockAPI),y(xl,1,"setEnum",is,BlockAPI),y(xl,1,"getEnum",os,BlockAPI),y(xl,1,"setCropScaleX",ns,BlockAPI),y(xl,1,"setCropScaleY",rs,BlockAPI),y(xl,1,"setCropRotation",ts,BlockAPI),y(xl,1,"setCropScaleRatio",es,BlockAPI),y(xl,1,"setCropTranslationX",Ji,BlockAPI),y(xl,1,"setCropTranslationY",Zi,BlockAPI),y(xl,1,"resetCrop",Qi,BlockAPI),y(xl,1,"getCropScaleX",Ki,BlockAPI),y(xl,1,"getCropScaleY",Yi,BlockAPI),y(xl,1,"getCropRotation",Xi,BlockAPI),y(xl,1,"getCropScaleRatio",Gi,BlockAPI),y(xl,1,"getCropTranslationX",zi,BlockAPI),y(xl,1,"getCropTranslationY",Vi,BlockAPI),y(xl,1,"adjustCropToFillFrame",Ni,BlockAPI),y(xl,1,"flipCropHorizontal",Hi,BlockAPI),y(xl,1,"flipCropVertical",Wi,BlockAPI),y(xl,1,"setOpacity",Ui,BlockAPI),y(xl,1,"getOpacity",qi,BlockAPI),y(xl,1,"setBlendMode",$i,BlockAPI),y(xl,1,"getBlendMode",ji,BlockAPI),y(xl,1,"isIncludedInExport",Oi,BlockAPI),y(xl,1,"setIncludedInExport",Bi,BlockAPI),y(xl,1,"setFillColorRGBA",Di,BlockAPI),y(xl,1,"getFillColorRGBA",Ri,BlockAPI),y(xl,1,"setFillColorEnabled",Li,BlockAPI),y(xl,1,"isFillColorEnabled",Ii,BlockAPI),y(xl,1,"createEffect",Mi,BlockAPI),y(xl,1,"getEffects",Fi,BlockAPI),y(xl,1,"insertEffect",Ai,BlockAPI),y(xl,1,"appendEffect",Pi,BlockAPI),y(xl,1,"removeEffect",Ti,BlockAPI),y(xl,1,"setEffectEnabled",xi,BlockAPI),y(xl,1,"isEffectEnabled",Si,BlockAPI),y(xl,1,"createBlur",Ei,BlockAPI),y(xl,1,"setBlur",Ci,BlockAPI),y(xl,1,"getBlur",_i,BlockAPI),y(xl,1,"setBlurEnabled",ki,BlockAPI),y(xl,1,"isBlurEnabled",wi,BlockAPI),y(xl,1,"setBackgroundColorRGBA",vi,BlockAPI),y(xl,1,"getBackgroundColorRGBA",yi,BlockAPI),y(xl,1,"setBackgroundColorEnabled",bi,BlockAPI),y(xl,1,"isBackgroundColorEnabled",mi,BlockAPI),y(xl,1,"setStrokeEnabled",gi,BlockAPI),y(xl,1,"isStrokeEnabled",fi,BlockAPI),y(xl,1,"setStrokeColorRGBA",pi,BlockAPI),y(xl,1,"setStrokeColor",hi,BlockAPI),y(xl,1,"getStrokeColorRGBA",ui,BlockAPI),y(xl,1,"getStrokeColor",di,BlockAPI),y(xl,1,"setStrokeWidth",ci,BlockAPI),y(xl,1,"getStrokeWidth",li,BlockAPI),y(xl,1,"setStrokeStyle",ai,BlockAPI),y(xl,1,"getStrokeStyle",si,BlockAPI),y(xl,1,"setStrokePosition",ii,BlockAPI),y(xl,1,"getStrokePosition",oi,BlockAPI),y(xl,1,"setStrokeCornerGeometry",ni,BlockAPI),y(xl,1,"getStrokeCornerGeometry",ri,BlockAPI),y(xl,1,"setDropShadowEnabled",ti,BlockAPI),y(xl,1,"isDropShadowEnabled",ei,BlockAPI),y(xl,1,"setDropShadowColorRGBA",Jo,BlockAPI),y(xl,1,"setDropShadowColor",Zo,BlockAPI),y(xl,1,"getDropShadowColorRGBA",Qo,BlockAPI),y(xl,1,"getDropShadowColor",Ko,BlockAPI),y(xl,1,"setDropShadowOffsetX",Yo,BlockAPI),y(xl,1,"getDropShadowOffsetX",Xo,BlockAPI),y(xl,1,"setDropShadowOffsetY",Go,BlockAPI),y(xl,1,"getDropShadowOffsetY",zo,BlockAPI),y(xl,1,"setDropShadowBlurRadiusX",Vo,BlockAPI),y(xl,1,"getDropShadowBlurRadiusX",No,BlockAPI),y(xl,1,"setDropShadowBlurRadiusY",Ho,BlockAPI),y(xl,1,"getDropShadowBlurRadiusY",Wo,BlockAPI),y(xl,1,"setDropShadowClip",Uo,BlockAPI),y(xl,1,"getDropShadowClip",qo,BlockAPI),y(xl,1,"createCutoutFromBlocks",$o,BlockAPI),y(xl,1,"createCutoutFromPath",jo,BlockAPI),y(xl,1,"createCutoutFromOperation",Oo,BlockAPI),y(xl,1,"replaceText",Bo,BlockAPI),y(xl,1,"removeText",Do,BlockAPI),y(xl,1,"setTextColor",Ro,BlockAPI),y(xl,1,"getTextColors",Lo,BlockAPI),y(xl,1,"setTextFontWeight",Io,BlockAPI),y(xl,1,"getTextFontWeights",Mo,BlockAPI),y(xl,1,"setTextFontSize",Fo,BlockAPI),y(xl,1,"getTextFontSizes",Ao,BlockAPI),y(xl,1,"setTextFontStyle",Po,BlockAPI),y(xl,1,"getTextFontStyles",To,BlockAPI),y(xl,1,"getTextCases",xo,BlockAPI),y(xl,1,"setTextCase",So,BlockAPI),y(xl,1,"canToggleBoldFont",Eo,BlockAPI),y(xl,1,"canToggleItalicFont",Co,BlockAPI),y(xl,1,"toggleBoldFont",_o,BlockAPI),y(xl,1,"toggleItalicFont",ko,BlockAPI),y(xl,1,"setFont",wo,BlockAPI),y(xl,1,"setTypeface",vo,BlockAPI),y(xl,1,"getTypeface",yo,BlockAPI),y(xl,1,"getTypefaces",bo,BlockAPI),y(xl,1,"getTextCursorRange",mo,BlockAPI),y(xl,1,"getTextVisibleLineCount",go,BlockAPI),y(xl,1,"getTextVisibleLineGlobalBoundingBoxXYWH",fo,BlockAPI),y(xl,1,"getTextVisibleLineContent",po,BlockAPI),y(xl,1,"isFillEnabled",ho,BlockAPI),y(xl,1,"setFillEnabled",uo,BlockAPI),y(xl,1,"getFill",co,BlockAPI),y(xl,1,"setFill",lo,BlockAPI),y(xl,1,"setFillSolidColor",ao,BlockAPI),y(xl,1,"getFillSolidColor",so,BlockAPI),y(xl,1,"setPlaceholderEnabled",io,BlockAPI),y(xl,1,"isPlaceholderEnabled",oo,BlockAPI),y(xl,1,"setPlaceholderBehaviorEnabled",no,BlockAPI),y(xl,1,"isPlaceholderBehaviorEnabled",ro,BlockAPI),y(xl,1,"setPlaceholderControlsOverlayEnabled",to,BlockAPI),y(xl,1,"isPlaceholderControlsOverlayEnabled",eo,BlockAPI),y(xl,1,"setPlaceholderControlsButtonEnabled",Jn,BlockAPI),y(xl,1,"isPlaceholderControlsButtonEnabled",Zn,BlockAPI),y(xl,1,"setMetadata",Qn,BlockAPI),y(xl,1,"getMetadata",Kn,BlockAPI),y(xl,1,"findAllMetadata",Yn,BlockAPI),y(xl,1,"removeMetadata",Xn,BlockAPI),y(xl,1,"setScopeEnabled",Gn,BlockAPI),y(xl,1,"isScopeEnabled",zn,BlockAPI),y(xl,1,"isAllowedByScope",Vn,BlockAPI),y(xl,1,"setDuration",Nn,BlockAPI),y(xl,1,"getDuration",Hn,BlockAPI),y(xl,1,"setPageDurationSource",Wn,BlockAPI),y(xl,1,"isPageDurationSource",Un,BlockAPI),y(xl,1,"removePageDurationSource",qn,BlockAPI),y(xl,1,"setTimeOffset",$n,BlockAPI),y(xl,1,"getTimeOffset",jn,BlockAPI),y(xl,1,"setTrimOffset",On,BlockAPI),y(xl,1,"getTrimOffset",Bn,BlockAPI),y(xl,1,"setTrimLength",Dn,BlockAPI),y(xl,1,"getTrimLength",Rn,BlockAPI),y(xl,1,"split",Ln,BlockAPI),y(xl,1,"getTotalSceneDuration",In,BlockAPI),y(xl,1,"setPlaying",Mn,BlockAPI),y(xl,1,"isPlaying",Fn,BlockAPI),y(xl,1,"setPlaybackTime",An,BlockAPI),y(xl,1,"getPlaybackTime",Pn,BlockAPI),y(xl,1,"isVisibleAtCurrentPlaybackTime",Tn,BlockAPI),y(xl,1,"setSoloPlaybackEnabled",xn,BlockAPI),y(xl,1,"isSoloPlaybackEnabled",Sn,BlockAPI),y(xl,1,"setLooping",En,BlockAPI),y(xl,1,"isLooping",Cn,BlockAPI),y(xl,1,"setMuted",_n,BlockAPI),y(xl,1,"isMuted",kn,BlockAPI),y(xl,1,"setVolume",wn,BlockAPI),y(xl,1,"getVolume",vn,BlockAPI),y(xl,1,"forceLoadAVResource",yn,BlockAPI),y(xl,1,"unstable_isAVResourceLoaded",bn,BlockAPI),y(xl,1,"getAVResourceTotalDuration",mn,BlockAPI),y(xl,1,"getVideoWidth",gn,BlockAPI),y(xl,1,"getVideoHeight",fn,BlockAPI),y(xl,1,"getVideoFillThumbnail",pn,BlockAPI),y(xl,1,"getVideoFillThumbnailAtlas",hn,BlockAPI),y(xl,1,"getPageThumbnailAtlas",un,BlockAPI),y(xl,1,"createAnimation",dn,BlockAPI),y(xl,1,"setInAnimation",cn,BlockAPI),y(xl,1,"setLoopAnimation",ln,BlockAPI),y(xl,1,"setOutAnimation",an,BlockAPI),y(xl,1,"getInAnimation",sn,BlockAPI),y(xl,1,"getLoopAnimation",on,BlockAPI),y(xl,1,"getOutAnimation",nn,BlockAPI),y(xl,1,"setNativePixelBuffer",rn,BlockAPI),y(xl,1,"getState",tn,BlockAPI),y(xl,1,"setState",en,BlockAPI),y(xl,1,"forceLoadResources",Jr,BlockAPI),y(xl,1,"applyAnimation",Zr,BlockAPI),y(xl,1,"applyDropShadow",Qr,BlockAPI),y(xl,1,"generateThumbnailAtTimeOffset",Kr,BlockAPI),y(xl,1,"getBackgroundTrack",Yr,BlockAPI),y(xl,1,"moveToBackgroundTrack",Xr,BlockAPI),m(xl,BlockAPI);var Il,Ll,Rl,Dl,Bl,Ol,jl,$l,ql,Ul,Wl,Hl,Nl,Vl,zl,Gl,Xl,Yl,Kl,Ql,Zl,Jl,ec,tc,rc,nc,oc,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,Bc,Oc,jc,$c,qc=new WeakMap;Oc=[fr],Bc=[fr],Dc=[fr],Rc=[pr({disabledInModes:["Playback"]})],Lc=[pr({disabledInModes:["Playback"]})],Ic=[fr],Mc=[fr],Fc=[pr()],Ac=[pr({disabledInModes:["Playback"]})],Pc=[pr({disabledInModes:["Playback"]})],Tc=[pr({disabledInModes:["Playback"]})],xc=[pr({disabledInModes:["Playback"]})],Sc=[pr({disabledInModes:["Playback"]})],Ec=[fr],Cc=[fr],_c=[fr],kc=[pr({disabledInModes:["Playback"]})],wc=[fr],vc=[fr],yc=[fr],bc=[pr({disabledInModes:["Playback"]})],mc=[pr({disabledInModes:["Playback"]})],gc=[fr],fc=[pr({disabledInModes:["Playback"]})],pc=[fr],hc=[pr({disabledInModes:["Playback"]})],uc=[fr],dc=[pr({disabledInModes:["Playback"]})],cc=[fr],lc=[pr({disabledInModes:["Playback"]})],ac=[fr],sc=[pr({disabledInModes:["Playback"]})],ic=[fr],oc=[pr({disabledInModes:["Playback"]})],nc=[fr],rc=[pr({disabledInModes:["Playback"]})],tc=[fr],ec=[pr({disabledInModes:["Playback"]})],Jl=[fr],Zl=[pr({disabledInModes:["Playback"]})],Ql=[pr({disabledInModes:["Playback"]})],Kl=[pr({disabledInModes:["Playback"]})],Yl=[pr({disabledInModes:["Playback"]})],Xl=[pr({disabledInModes:["Playback"]})],Gl=[fr],zl=[pr({disabledInModes:["Playback"]})],Vl=[pr({disabledInModes:["Playback"]})],Nl=[fr],Hl=[pr({disabledInModes:["Playback"]})],Wl=[pr({disabledInModes:["Playback"]})],Ul=[pr({disabledInModes:["Playback"]})],ql=[pr({disabledInModes:["Playback"]})],$l=[fr],jl=[fr],Ol=[fr],Bl=[fr],Dl=[fr],Rl=[pr({disabledInModes:["Playback"]})],Ll=[pr({disabledInModes:["Playback"]})],Il=[fr];var EditorAPI=class{constructor(e){b($c,5,this),C(this,jc),v(this,"onStateChanged",(e=>{const t=_(this,jc).subscribeToEditorState(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),v(this,"onHistoryUpdated",(e=>{const t=_(this,jc).subscribeToHistory(e);return()=>{_(this,jc).isDeleted()||_(this,jc).unsubscribe(t)}})),v(this,"onSettingsChanged",(e=>{const t=_(this,jc).subscribeToSettings(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),v(this,"onRoleChanged",(e=>{const t=_(this,jc).subscribeToRoleChange(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),E(this,jc,e)}unlockWithLicense(e){sr(_(this,jc).unlockWithLicense(e))}startTracking(e,t){_(this,jc).startTracking(e,t,"")}setTrackingMetadata(e){_(this,jc).setTrackingMetadata(e)}getTrackingMetadata(){return sr(_(this,jc).getTrackingMetadata())}getActiveLicense(){return sr(_(this,jc).getActiveLicense())}_update(){_(this,jc).update()}setEditMode(e,t){Gt("mode",e,$t()),Gt("baseMode",t,jt($t())),_(this,jc).setEditMode(e,t??"")}getEditMode(){return _(this,jc).getEditMode()}unstable_isInteractionHappening(){return sr(_(this,jc).unstable_isInteractionHappening())}getCursorType(){return _(this,jc).getCursorType()}getCursorRotation(){return _(this,jc).getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return _(this,jc).getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return _(this,jc).getTextCursorPositionInScreenSpaceY()}createHistory(){return _(this,jc).createHistory()}destroyHistory(e){sr(_(this,jc).destroyHistory(e))}setActiveHistory(e){sr(_(this,jc).setActiveHistory(e))}getActiveHistory(){return _(this,jc).getActiveHistory()}addUndoStep(){sr(_(this,jc).addUndoStep())}undo(){sr(_(this,jc).undo())}redo(){sr(_(this,jc).redo())}canUndo(){return sr(_(this,jc).canUndo())}canRedo(){return sr(_(this,jc).canRedo())}setSetting(e,t){Gt("keypath",e,$t());const r=this.normalizeSettingKey(e);if(!this.isValidSettingKey(r))throw new Error(`Invalid setting key: '${e}'`);switch(this.getSettingTypeForKey(r)){case"Bool":return sr(_(this,jc).setSettingBool(r,t));case"Int":if(!Number.isInteger(t))throw new Error(`Setting '${e}' requires an integer value`);return sr(_(this,jc).setSettingInt(r,t));case"Float":return sr(_(this,jc).setSettingFloat(r,t));case"String":return sr(_(this,jc).setSettingString(r,t));case"Color":{const e=t;return sr(_(this,jc).setSettingColor(r,Gr.fromColor(e)))}case"Enum":return sr(_(this,jc).setSettingEnum(r,t));default:throw new Error(`Unknown setting type for key '${e}'`)}}getSetting(e){Gt("keypath",e,$t());const t=this.normalizeSettingKey(e);if(!this.isValidSettingKey(t))throw new Error(`Invalid setting key: '${e}'`);switch(this.getSettingTypeForKey(t)){case"Bool":return sr(_(this,jc).getSettingBool(t));case"Int":return sr(_(this,jc).getSettingInt(t));case"Float":return sr(_(this,jc).getSettingFloat(t));case"String":return sr(_(this,jc).getSettingString(t));case"Color":return Gr.toColor(sr(_(this,jc).getSettingColor(t)));case"Enum":return sr(_(this,jc).getSettingEnum(t));default:throw new Error(`Unknown setting type for key '${e}'`)}}normalizeSettingKey(e){return e.startsWith("ubq://")?e.slice(6):e}isValidSettingKey(e){return e in{"controlGizmo/showCropHandles":!0,"controlGizmo/showCropScaleHandles":!0,"controlGizmo/showMoveHandles":!0,"controlGizmo/showResizeHandles":!0,"controlGizmo/showRotateHandles":!0,"controlGizmo/showScaleHandles":!0,doubleClickToCropEnabled:!0,"features/singlePageModeEnabled":!0,"features/pageCarouselEnabled":!0,"features/transformEditsRetainCoverMode":!0,"mouse/enableScroll":!0,"mouse/enableZoom":!0,"page/allowCropInteraction":!0,"page/allowMoveInteraction":!0,"page/allowResizeInteraction":!0,"page/allowRotateInteraction":!0,"page/dimOutOfPageAreas":!0,"page/restrictResizeInteractionToFixedAspectRatio":!0,"page/moveChildrenWhenCroppingFill":!0,"page/selectWhenNoBlocksSelected":!0,"page/title/appendPageName":!0,"page/title/show":!0,"page/title/showOnSinglePage":!0,"page/title/showPageTitleTemplate":!0,"placeholderControls/showButton":!0,"placeholderControls/showOverlay":!0,"blockAnimations/enabled":!0,showBuildVersion:!0,"touch/dragStartCanSelect":!0,"touch/singlePointPanning":!0,useSystemFontFallback:!0,forceSystemEmojis:!0,basePath:!0,defaultEmojiFontFileUri:!0,defaultFontFileUri:!0,license:!0,"page/title/fontFileUri":!0,"page/title/separator":!0,fallbackFontUri:!0,"upload/supportedMimeTypes":!0,"controlGizmo/blockScaleDownLimit":!0,positionSnappingThreshold:!0,rotationSnappingThreshold:!0,maxImageSize:!0,borderOutlineColor:!0,clearColor:!0,"colorMaskingSettings/maskColor":!0,cropOverlayColor:!0,errorStateColor:!0,highlightColor:!0,"page/innerBorderColor":!0,"page/marginFillColor":!0,"page/marginFrameColor":!0,"page/outerBorderColor":!0,"page/title/color":!0,placeholderHighlightColor:!0,progressColor:!0,rotationSnappingGuideColor:!0,ruleOfThirdsLineColor:!0,snappingGuideColor:!0,textVariableHighlightColor:!0,handleFillColor:!0,doubleClickSelectionMode:!0,"touch/pinchAction":!0,"touch/rotateAction":!0,"camera/clamping/overshootMode":!0,renderMode:!0,alwaysHighlightPlaceholders:!0,"colorMaskingSettings/secondPass":!0,"debug/enforceScopesInAPIs":!0,"debug/showHandlesInteractionArea":!0,"debug/useDebugMipmaps":!0,"features/effectsEnabled":!0,"features/highQualityMipmaps":!0,"features/hspSelectiveAdjustmentsEnabled":!0,"features/implicitUpdatesEnabled":!0,"features/templatingEnabled":!0,"features/videosEnabled":!0,"features/videoCaptionsEnabled":!0,"features/forceLowQualityVideoPreview":!0,"features/matchThumbnailSourceToFill":!0,"features/p3WorkingColorSpace":!0,"features/removeForegroundTracksOnSceneLoad":!0,"features/videoTranscodingEnabled":!0,renderTextCursorAndSelectionInEngine:!0,clampThumbnailTextureSizes:!0}}getSettingTypeForKey(e){const t=Object.keys({borderOutlineColor:!0,clearColor:!0,"colorMaskingSettings/maskColor":!0,cropOverlayColor:!0,errorStateColor:!0,handleFillColor:!0,highlightColor:!0,"page/innerBorderColor":!0,"page/marginFillColor":!0,"page/marginFrameColor":!0,"page/outerBorderColor":!0,"page/title/color":!0,placeholderHighlightColor:!0,progressColor:!0,rotationSnappingGuideColor:!0,ruleOfThirdsLineColor:!0,snappingGuideColor:!0,textVariableHighlightColor:!0});if(new Set(t).has(e))return"Color";const r=Object.keys({doubleClickSelectionMode:!0,"touch/pinchAction":!0,"touch/rotateAction":!0,"camera/clamping/overshootMode":!0});if(new Set(r).has(e))return"Enum";if(e in{maxImageSize:!0})return"Int";const n=Object.keys({"controlGizmo/blockScaleDownLimit":!0,positionSnappingThreshold:!0,rotationSnappingThreshold:!0});if(new Set(n).has(e))return"Float";const o=Object.keys({basePath:!0,defaultEmojiFontFileUri:!0,defaultFontFileUri:!0,license:!0,"page/title/fontFileUri":!0,"page/title/separator":!0,fallbackFontUri:!0,"upload/supportedMimeTypes":!0});return new Set(o).has(e)?"String":"Bool"}setSettingBool(e,t){return this.setSetting(e,t)}getSettingBool(e){return this.getSetting(e)}setSettingInt(e,t){return this.setSetting(e,t)}getSettingInt(e){return this.getSetting(e)}setSettingFloat(e,t){return this.setSetting(e,t)}getSettingFloat(e){return this.getSetting(e)}setSettingString(e,t){return this.setSetting(e,t)}getSettingString(e){return this.getSetting(e)}setSettingColor(e,t){return this.setSetting(e,t)}getSettingColor(e){return this.getSetting(e)}setSettingColorRGBA(e,t,r,n,o=1){return this.setSetting(e,{r:t,g:r,b:n,a:o})}getSettingColorRGBA(e){const t=this.getSetting(e);if("r"in t)return[t.r,t.g,t.b,t.a];throw new Error(`Setting '${e}' returned non-RGBA color format`)}setSettingEnum(e,t){return this.setSetting(e,t)}getSettingEnum(e){return this.getSetting(e)}getSettingEnumOptions(e){return Gt("keypath",e,$t()),lr(sr(_(this,jc).getSettingEnumOptions(e)))}setRole(e){return sr(_(this,jc).setRole(e))}getRole(){return sr(_(this,jc).getRole())}findAllSettings(){return lr(_(this,jc).findAllSettings())}getSettingType(e){Gt("keypath",e,$t());return sr(_(this,jc).getSettingType(e))}getAvailableMemory(){return sr(_(this,jc).getAvailableMemory())}getUsedMemory(){return sr(_(this,jc).getUsedMemory())}getMaxExportSize(){return sr(_(this,jc).getMaxExportSize())}setURIResolver(e){qc.set(_(this,jc),e);return sr(_(this,jc).setURIResolver((t=>e(t,this.defaultURIResolver.bind(this)))))}unstable_getURIResolver(){return qc.get(_(this,jc))??null}defaultURIResolver(e){return _(this,jc).defaultURIResolver(e)}getAbsoluteURI(e){return sr(_(this,jc).getAbsoluteURI(e))}findAllScopes(){return lr(_(this,jc).findAllScopes())}setGlobalScope(e,t){Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,jc).setGlobalScope(e,t))}getGlobalScope(e){return Gt("key",e,$t()),sr(_(this,jc).getGlobalScope(e))}findAllSpotColors(){return lr(_(this,jc).findAllSpotColors())}getSpotColorRGBA(e){return Gt("name",e,$t()),_(this,jc).getSpotColorRGB(e)}getSpotColorCMYK(e){return Gt("name",e,$t()),_(this,jc).getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,n){return Gt("name",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),_(this,jc).setSpotColorRGB(e,t,r,n)}setSpotColorCMYK(e,t,r,n,o){return Gt("name",e,$t()),Gt("c",t,Bt()),Gt("m",r,Bt()),Gt("y",n,Bt()),Gt("k",o,Bt()),_(this,jc).setSpotColorCMYK(e,t,r,n,o)}removeSpotColor(e){return Gt("name",e,$t()),sr(_(this,jc).removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Gt("type",e,$t()),Gt("color",t,$t()),sr(_(this,jc).setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Gt("type",e,$t()),sr(_(this,jc).getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Gt("colorSpace",t,$t()),Gr.toColor(sr(_(this,jc).convertColorToColorSpace(Gr.fromColor(e),t)))}createBuffer(){return _(this,jc).createBuffer()}destroyBuffer(e){sr(_(this,jc).destroyBuffer(e))}setBufferData(e,t,r){Gt("offset",t,Dt()),sr(_(this,jc).setBufferData(e,t,r))}getBufferData(e,t,r){Gt("offset",t,Dt()),Gt("length",r,Dt());const n=_(this,jc).getBufferData(e,t,r);if("error"in n)throw new Error(n.error);return n}setBufferLength(e,t){Gt("length",t,Dt()),sr(_(this,jc).setBufferLength(e,t))}getBufferLength(e){return sr(_(this,jc).getBufferLength(e))}cloneBuffers(){return lr(sr(_(this,jc).cloneBuffers()))}restoreBuffers(e){sr(_(this,jc).restoreBuffers(e))}getMimeType(e){return Gt("uri",e,$t()),ar((t=>_(this,jc).getMimeType(e,t)))}findAllTransientResources(){return lr(sr(_(this,jc).findAllTransientResources()))}getResourceData(e,t,r){Gt("uri",e,$t()),Gt("chunkSize",t,Dt()),sr(_(this,jc).getResourceData(e,t,r))}relocateResource(e,t){Gt("currentUrl",e,$t()),Gt("relocatedUrl",t,$t()),sr(_(this,jc).relocateResource(e,t))}isHighlightingEnabled(e){return Gt("id",e,Dt()),sr(_(this,jc).isHighlightingEnabled(e))}setHighlightingEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,jc).setHighlightingEnabled(e,t))}};$c=h(null),jc=new WeakMap,y($c,1,"unlockWithLicense",Oc,EditorAPI),y($c,1,"startTracking",Bc,EditorAPI),y($c,1,"setTrackingMetadata",Dc,EditorAPI),y($c,1,"getTrackingMetadata",Rc,EditorAPI),y($c,1,"getActiveLicense",Lc,EditorAPI),y($c,1,"_update",Ic,EditorAPI),y($c,1,"setEditMode",Mc,EditorAPI),y($c,1,"getEditMode",Fc,EditorAPI),y($c,1,"unstable_isInteractionHappening",Ac,EditorAPI),y($c,1,"getCursorType",Pc,EditorAPI),y($c,1,"getCursorRotation",Tc,EditorAPI),y($c,1,"getTextCursorPositionInScreenSpaceX",xc,EditorAPI),y($c,1,"getTextCursorPositionInScreenSpaceY",Sc,EditorAPI),y($c,1,"createHistory",Ec,EditorAPI),y($c,1,"destroyHistory",Cc,EditorAPI),y($c,1,"setActiveHistory",_c,EditorAPI),y($c,1,"getActiveHistory",kc,EditorAPI),y($c,1,"addUndoStep",wc,EditorAPI),y($c,1,"undo",vc,EditorAPI),y($c,1,"redo",yc,EditorAPI),y($c,1,"canUndo",bc,EditorAPI),y($c,1,"canRedo",mc,EditorAPI),y($c,1,"setSetting",gc,EditorAPI),y($c,1,"getSetting",fc,EditorAPI),y($c,1,"setSettingBool",pc,EditorAPI),y($c,1,"getSettingBool",hc,EditorAPI),y($c,1,"setSettingInt",uc,EditorAPI),y($c,1,"getSettingInt",dc,EditorAPI),y($c,1,"setSettingFloat",cc,EditorAPI),y($c,1,"getSettingFloat",lc,EditorAPI),y($c,1,"setSettingString",ac,EditorAPI),y($c,1,"getSettingString",sc,EditorAPI),y($c,1,"setSettingColor",ic,EditorAPI),y($c,1,"getSettingColor",oc,EditorAPI),y($c,1,"setSettingColorRGBA",nc,EditorAPI),y($c,1,"getSettingColorRGBA",rc,EditorAPI),y($c,1,"setSettingEnum",tc,EditorAPI),y($c,1,"getSettingEnum",ec,EditorAPI),y($c,1,"setRole",Jl,EditorAPI),y($c,1,"getRole",Zl,EditorAPI),y($c,1,"findAllSettings",Ql,EditorAPI),y($c,1,"getAvailableMemory",Kl,EditorAPI),y($c,1,"getUsedMemory",Yl,EditorAPI),y($c,1,"getMaxExportSize",Xl,EditorAPI),y($c,1,"setURIResolver",Gl,EditorAPI),y($c,1,"unstable_getURIResolver",zl,EditorAPI),y($c,1,"findAllScopes",Vl,EditorAPI),y($c,1,"setGlobalScope",Nl,EditorAPI),y($c,1,"getGlobalScope",Hl,EditorAPI),y($c,1,"findAllSpotColors",Wl,EditorAPI),y($c,1,"getSpotColorRGBA",Ul,EditorAPI),y($c,1,"getSpotColorCMYK",ql,EditorAPI),y($c,1,"setSpotColorRGB",$l,EditorAPI),y($c,1,"setSpotColorCMYK",jl,EditorAPI),y($c,1,"removeSpotColor",Ol,EditorAPI),y($c,1,"setSpotColorForCutoutType",Bl,EditorAPI),y($c,1,"getSpotColorForCutoutType",Dl,EditorAPI),y($c,1,"convertColorToColorSpace",Rl,EditorAPI),y($c,1,"isHighlightingEnabled",Ll,EditorAPI),y($c,1,"setHighlightingEnabled",Il,EditorAPI),m($c,EditorAPI);var Uc,Wc,Hc,Nc,Vc,zc,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))}}};Nc=[pr({disabledInModes:["Playback"]})],Hc=[fr],Wc=[pr({disabledInModes:["Playback"]})],Uc=[fr];var VariableAPI=class{constructor(e){b(zc,5,this),C(this,Vc),E(this,Vc,e)}findAll(){return lr(_(this,Vc).findAllVariables())}setString(e,t){return Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,Vc).setVariableString(e,t))}getString(e){return Gt("key",e,$t()),sr(_(this,Vc).getVariableString(e))}remove(e){return Gt("key",e,$t()),sr(_(this,Vc).removeVariable(e))}};function Gc(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}zc=h(null),Vc=new WeakMap,y(zc,1,"findAll",Nc,VariableAPI),y(zc,1,"setString",Hc,VariableAPI),y(zc,1,"getString",Wc,VariableAPI),y(zc,1,"remove",Uc,VariableAPI),m(zc,VariableAPI);var Xc=async function(e,t,r=fetch,n,o=new Set(n.findAllSources())){const i=e.map((async e=>{const i=Gc(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;o.has(e)||n.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",t);r.meta&&(r.meta[e]=n)}})),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))})),n.addAssetToSource(e,r)}))}))}));await Promise.all(i)},Yc=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=Gc(e,`/${_CaptionPresetAssetSource.assetSourceId}/content.json`),n=await t(r);if(!n.ok)throw new Error(n.statusText);const o=await n.json();if(void 0===o.assets)throw new Error(`Invalid content.json for assets: ${_CaptionPresetAssetSource.assetSourceId}`);return o.assets.map((t=>(t.meta&&Object.entries(t.meta).forEach((([r,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",e);t.meta&&(t.meta[r]=n)}})),t)))}createSource(){this.#s.asset.addSource({id:_CaptionPresetAssetSource.assetSourceId,findAssets:({page:e,perPage:t,excludeGroups:r,groups:n,locale:o="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(n&&n.length>0&&(h=h.filter((e=>e.groups?.some((e=>n.includes(e)))))),i&&""!==i.trim()){const e=i.toLowerCase().trim();h=h.filter((t=>(t.label?.[o]?.toLowerCase()||"").includes(e)))}c&&c.length>0&&(h=h.filter((e=>(e.tags?.[o]??[]).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?.[o]?.toLocaleLowerCase()||"",n=t.label?.[o]?.toLocaleLowerCase()||"";return r<n?"Ascending"===l?-1:1:r>n?"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?.[o],active:e.id===u,context:{id:_CaptionPresetAssetSource.assetSourceId},meta:e.meta,groups:e.groups,tags:e.tags?.[o],payload:{...e.payload,properties:t},locale:o}}));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 n=await this.#l(r);if(!n.ok)throw new Error(`Failed to fetch the preset block from ${r}`);const o=await n.text(),[i]=await this.#s.block.loadFromString(o),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"),n=this.#s.block.getPropertyType(r),o=e.replace("{{blockType}}","caption");switch(n){case"Int":{const e=this.#s.block.getInt(i,r);this.#s.block.setInt(t,o,e);break}case"Float":{const e=this.#s.block.getFloat(i,r);this.#s.block.setFloat(t,o,e);break}case"Double":{const e=this.#s.block.getDouble(i,r);this.#s.block.setDouble(t,o,e);break}case"Bool":{const e=this.#s.block.getBool(i,r);this.#s.block.setBool(t,o,e);break}case"Enum":{if("stroke/position"===r)break;const e=this.#s.block.getEnum(i,r);this.#s.block.setEnum(t,o,e);break}case"Color":{if("fill/solid/color"===r){const[e]=this.#s.block.getTextColors(i);this.#s.block.setColor(t,o,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,o,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,o,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],n=(()=>{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!=n&&this.#s.block.isValid(n)&&this.#s.block.destroy(n),this.#s.block.isValid(r)){const n=this.#s.block.duplicate(r);switch(t){case"in":this.#s.block.setInAnimation(e,n);break;case"loop":this.#s.block.setLoopAnimation(e,n);break;case"out":this.#s.block.setOutAnimation(e,n)}}};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[n]=this.#s.block.findAllSelected(),o="//ly.img.ubq/caption"===(null!=n?this.#s.block.getType(n):void 0)?n:this.#s.block.getChildren(r)[0];if(null!=o){switch(t.type){case"Color":if("fill/solid/color"===t.property){this.#s.block.setColor(o,t.property,t.value),this.#s.block.setTextColor(o,t.value);break}this.#s.block.setColor(o,t.property,t.value);break;case"Int":this.#s.block.setInt(o,t.property,t.value);break;case"Float":if("caption/scale"===t.property){const e=this.fetchCaptionScale(),r=this.#s.block.getTextFontSizes(o)[0]/e,n=Math.round(r*t.value);if(this.#s.block.setTextFontSize(o,n),this.#s.block.isStrokeEnabled(o)){const r=this.#s.block.getStrokeWidth(o)/e*t.value;this.#s.block.setStrokeWidth(o,r)}if(this.#s.block.isDropShadowEnabled(o)){const r=this.#s.block.getDropShadowOffsetX(o),n=this.#s.block.getDropShadowOffsetY(o)/e,i=this.#s.block.getDropShadowBlurRadiusX(o)/e,s=this.#s.block.getDropShadowBlurRadiusY(o)/e,a=r/e*t.value,l=n*t.value,c=i*t.value,d=s*t.value;this.#s.block.setDropShadowOffsetX(o,a),this.#s.block.setDropShadowOffsetY(o,l),this.#s.block.setDropShadowBlurRadiusX(o,c),this.#s.block.setDropShadowBlurRadiusY(o,d)}this.storeCaptionScale(t.value);break}this.#s.block.setFloat(o,t.property,t.value);break;case"Double":this.#s.block.setDouble(o,t.property,t.value);break;case"Boolean":this.#s.block.setBool(o,t.property,t.value);break;case"Enum":this.#s.block.setEnum(o,t.property,t.value);break;case"String":this.#s.block.setString(o,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 n=await _CaptionPresetAssetSource.fetchAssets(t,r);return new _CaptionPresetAssetSource(e,n,r)}};var Kc=async function(e,t,r,n){const o=["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 Xc(o,t,n,e.asset),r.includes("ly.img.captionPresets")||await Yc.create(e,t,n)},Qc=(e=>(e[e.Information=0]="Information",e[e.Warning=1]="Warning",e[e.Error=2]="Error",e))(Qc||{}),Zc=(e=>(e[e.Free=0]="Free",e[e.VerticalStack=1]="VerticalStack",e[e.HorizontalStack=2]="HorizontalStack",e[e.DepthStack=3]="DepthStack",e))(Zc||{});var Jc=async function(e,t,r,n,o,i,s="https://cdn.img.ly/assets/demo/v2"){const a=new Set(e.findAllSources()),l="ly.img.image.upload";!o||r.includes(l)||a.has(l)||e.addLocalSource(l,["image/jpeg","image/png","image/webp","image/svg+xml","image/bmp",..."Design"===n?["image/gif"]:[]]);const c="ly.img.video.upload";"Video"!==n||!o||r.includes(c)||a.has(c)||e.addLocalSource(c,["application/json","video/mp4","video/quicktime","video/webm","video/matroska","image/gif"]);const d="ly.img.audio.upload";"Video"!==n||!o||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"!==n||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 Xc(u,s,i,e)};function ed(e,t){let r;const n=new Set;function o(){const n=window.devicePixelRatio,{width:i,height:s}=e.getBoundingClientRect();t(i*n,s*n,n),r=matchMedia(`(resolution: ${n}dppx)`),r.addEventListener("change",o,{once:!0})}o();const i=new ResizeObserver((function([e]){const{width:r,height:o}=e.target.getBoundingClientRect();if(r<=0||o<=0)return;const i=window.devicePixelRatio,s=setTimeout((function(){n.delete(s),t(r*i,o*i,i)}),0);n.add(s)}));return i.observe(e),()=>{r.removeEventListener("change",o),i.disconnect();for(const e of n)clearTimeout(e);n.clear(),e=null,t=null}}var td=u(ht());function rd(e,t){const r=new Set;function n(n){r.add(n);e?.(((e,...t)=>{n(e);for(const e of t)n(e)}));return()=>{r.delete(n),t?.()}}return n.emit=function(e,...t){for(const n of r){n(e);for(const e of t)n(e)}},n.handlers=r,n}var nd=e=>t=>function(r){return t((function(t){r(e(t))}))};function od(e){return t=>function(r){let n=!1;const o=t((function(e){n=!0,r(e)}));return n||r(e instanceof Function?e():e),o}}var id=(e=((e,t)=>e===t))=>t=>function(r){let n;return t((function(t){e(t,n)||(n=t,r(t))}))},sd=e=>{const t=new Set;let r=null;return function(n){return t.add(n),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(n),0===t.size&&(r?.(),r=null)}}};function ad(e,...t){return t.reduce(((e,t)=>t(e)),e)}var ld=(...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 cd(e){return function(t){let r=null;const n=e((function(e){r?.(),r=e?e(t):e}));return function(){n(),r?.(),r=null}}}function dd(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),n=t.map(((t,n)=>t((function(t){r[n]=t,e(r)}))));return function(){n.forEach((e=>e())),r.length=0}}}var ud=Symbol("NO_VALUE");function hd(e){let t=ud;const r=rd();return{subscribe:r,value:()=>(t===ud&&(t=e()),t),update(e){t=e,r.emit(t)}}}var pd=u(bt());function fd(e,t){const{block:r,event:n}=t;return ad((t=>{const o=r.getType(e),i=(0,pd.default)(n.subscribe([e],(function(n){n.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==o?i():t(n)})));return i}),sd)}function gd(e,t){if(!t)return e;let r;return(...n)=>{const o=e(...n);return t(o,r)||(r=o),r}}var md=function(e,t,r,n){const o=gd(t,n?.equals),i=rd();return{subscribe:ad(ld(e,i),nd(o),id(),sd),update:r,value:o,flush:()=>i.emit()}};var bd=class{settings;clampCamera=!1;clampResult=hd((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#c;viewportPadding=hd((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_legacyApi:n}=e,o=ad(r.onActiveChanged,od(),nd((()=>r.get()))),i=ad(o,nd((r=>null!=r&&t.isValid(r)?ad(fd(r,e),od([]),nd((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),cd),s=ad(o,nd((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:ad(fd(r,e),od([]),nd((()=>r)))})),cd);this.settings={subscribe:ad(s,nd((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),id(td.default),sd),update({width:e,height:r,pixelRatio:n}){const o=t.findByType("camera")[0];null!=o&&(t.setFloat(o,"camera/resolution/width",e),t.setFloat(o,"camera/resolution/height",r),t.setFloat(o,"camera/pixelRatio",n))},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=md(ld(r.onZoomLevelChanged,i),(()=>{const e=r.get(),{pixelRatio:n}=this.settings.value();return null!=e&&t.isValid(e)?r.getZoomLevel()/n:1}),(e=>{const n=r.get(),{pixelRatio:o}=this.settings.value();null!=n&&t.isValid(n)&&r.setZoomLevel(e*o)})),this.#c={subscribe:ad(s,nd((e=>n.getValue(e,"ubq/designblocks/Camera","zoomLevel"))),id()),value(){const e=t.findByType("camera")[0];return null==e?1:n.getValue(e,"ubq/designblocks/Camera","zoomLevel")}},this.autoFit=md(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:ad(this.clampResult.subscribe,nd((e=>e.scrollPercentage)),id(td.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:ad(dd(this.clampResult.subscribe,this.#c.subscribe,this.settings.subscribe),nd((([e,t,r])=>{const n=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},o=t??this.#c.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:n.x*o/i,y:n.y*o/i}})),id(td.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 n=this.#c.value(),o=this.settings.value().pixelRatio,i=e.x*o/n,s=e.y*o/n,a={x:t.getPositionX(r)+i,y:t.getPositionY(r)+s};t.setPositionX(r,a.x),t.setPositionY(r,a.y)}}};function yd(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 vd="1.61.0-nightly.20250915".includes("nightly")?"https://cdn.img.ly/nightlies/1.61.0-nightly.20250915/packages/imgly/cesdk-engine/1.61.0-nightly.20250915/assets":"https://cdn.img.ly/packages/imgly/cesdk-engine/1.61.0-nightly.20250915/assets";function wd(e,t){return t??="undefined"==typeof window?void 0:window.location.href,new URL(e??"",t).href.replace(/\/*$/,"/")}function kd(e={}){const t={...e,license:e.license??"",baseURL:e.baseURL??vd,core:e.core??{baseURL:"core/"},logger:e.logger??yd,presets:e.presets??{}};return t.baseURL=wd(t.baseURL),t.core.baseURL=wd(t.core.baseURL,t.baseURL),t}var _d={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 Cd(e,t){return t?e.flatMap((e=>{const r=e.warnKeys?.(t);return"string"==typeof r?[r]:r??[]})):[]}function Ed(e,t,r){if(t)for(const n of e)n.applyFallback?.(t,r)}function Sd(e,t){return t?e.reduce(((e,t)=>t.migrateConfigObject?t.migrateConfigObject(e):e),t):t}var xd,Td,Pd,Ad,Fd=[_d,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,n]of Object.entries(e.presets.typefaces))r.addAssetToSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID,{id:t,payload:{typeface:{name:n.family,fonts:n.fonts.map((e=>({subFamily:`${e.weight} ${e.style}`,style:e.style,uri:e.fontURL,weight:e.weight})))}}})}}catch(e){console.error(e)}}}];function Md(e,t,r=void 0){const n=e=>{sr(t.setContext("")),e.preventDefault()},o=e=>{sr(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",o,!1),()=>{e.removeEventListener("webglcontextlost",n),e.removeEventListener("webglcontextrestored",o)}}function Id(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}Pd=[pr({disabledInModes:["Playback"]})],Td=[pr({disabledInModes:["Playback"]})],xd=[pr({disabledInModes:["Playback"]})];var Ld=class{constructor(e){b(Ad,5,this),v(this,"ubique"),v(this,"notificationStream",(e=>{const t=this.ubique.addEventCallback("NotificationEvent",(t=>e({type:Qc[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 n=new Promise(((n,o)=>{r=this.ubique.ubqExecute(e,t,(e=>{try{const t=sr(e);n(t)}catch(e){o(e)}}))}));return sr(r),n}sendKey(e){return this.execute("ubq/inputs/keyboardkey",Id(e))}changeSceneLayout(e,t,r,n){return this.execute("ubq/scene/changeLayout",[e,Zc[t],r,n])}};y(Ad=h(null),1,"getSelectedText",Pd,Ld),y(Ad,1,"hasComponent",Td,Ld),y(Ad,1,"getValue",xd,Ld),m(Ad,Ld);var Rd=!1;var Dd="https://api.img.ly/activate";var Bd=u(vt()),Od="./cesdk-v1.61.0-nightly.20250915-44YCFRT6.data",jd="./cesdk-v1.61.0-nightly.20250915-BFOZKXXQ.wasm",$d=Bd.default,qd=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Ud=-1!==qd.indexOf("Edge"),Wd=!!qd.match(/msie|trident/i),Hd=/\b(iPad|iPhone|iPod)\b/.test(qd)&&/WebKit/.test(qd)&&!/Edge/.test(qd)&&("undefined"==typeof window||!("MSStream"in window)),Nd=/(WOW64|Win32|i[3-6]86)/.test(navigator.userAgent)||/Win32|i[3-6]86|armv[6-7]/.test(navigator.platform),Vd=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function zd(){try{return new WebAssembly.Memory({initial:Gd(Hd?512:32),maximum:Gd(Nd?1024:2048)})}catch(e){return new WebAssembly.Memory({initial:Gd(32),maximum:Gd(Nd?1024:2048)})}}function Gd(e){return 1024*e*1024/65536}async function Xd(e,t){const{core:r}=t,n=t.logger,o=Vd(jd,r.baseURL).toString(),i=Vd(Od,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(Dd,{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")?o:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&n(e,"Info")},printErr:e=>{e&&"undefined"!==e&&n(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:zd()};$d(c).then((async n=>{n.specialHTMLTargets["!canvas"]=e;n.emscripten_ubq_settings_forceWebGL1=Hd||!!t?.forceWebGL1;const o=sr(n.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");sr(e.unlockWithLicense(t))}(o,await a),function(e,t){const r=new EditorAPI(e),n=new AssetAPI(e);if(r.setRole(t.role??"Creator"),Rd){const t=new Ld(e);t.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),t.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e))),t.dispose()}r.setSetting("basePath",t.baseURL),r.setSetting("showBuildVersion",Rd||!1),t.featureFlags?.preventScrolling&&(r.setSetting("touch/singlePointPanning",!1),r.setSetting("touch/dragStartCanSelect",!1)),n.addLocalSource("ly.img.text"),function(){Rd&&(r.setSetting("features/hspSelectiveAdjustmentsEnabled",!1),r.setSetting("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;r.setSetting("features/singlePageModeEnabled",e),r.setSetting("features/effectsEnabled",!0)}(),function(){const t=new VariableAPI(e);(Rd||"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??"")}(o,t),r(o)})).catch(s)}))}var Yd=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?.()}},Kd=u(ht()),Qd=Symbol("NO_VALUE"),Zd=class{callId;_value=Qd;_lastUpdateValue=Qd;_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===Qd||this.revalidate?this.read():this._value}revalidate=!1;invalidate(){this.revalidate=!0}read(){const e=this._readFromEngine();return this.revalidate=!1,(0,Kd.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=Qd,!0}}update(e){this._readFromEngine=e}isDisabledInMode(e){return this._disabledInModes.includes(e)}},Jd=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 Zd(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 Yd(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 n=Vr[r]++;return function(...o){const i=this,s=`${r}${n}-${JSON.stringify(o,null,0)}`;function a(){return Reflect.apply(t,i,o)}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(),n=[];let o=!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(o)throw new Error("Disposed @getter proxy called");const n=this,s=`${r}-${a.toString()}-${JSON.stringify(t,null,0)}`;function c(){return Reflect.apply(i,n,t)}return e._getterCalled(s,c,l),e.read(s,c)};const l=i[hr].disabledInModes;n.push(zr(t,a,i)),t[a]=s}else if("setter"===i[hr].type){let r=function(...t){if(o)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};n.push(zr(t,a,i)),t[a]=r}}var s;return function(){o=!0;for(const e of n)e();n.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear()}},eu='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 tu(e,t){let r;return t.onStateChanged((()=>{const n=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(!Wd&&!Ud)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 eu;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(n!==r){r=n;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(t)&&e.style.setProperty("cursor",n)}}))}var ru=function(e,t,r,n,o){let i,s=null;const a=n.onStateChanged((()=>{i=n.getEditMode(),"Text"!==i||s?"Text"!==i&&s&&(s(),s=null):s=function(){const i=s();return()=>{i?.()};function s(){const i=window.visualViewport?.height;let s=!1,a="";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 l=u();p();const c=f();function d(){const t=window.visualViewport?.height;if(i&&(!(!i||!t)&&i>t)){const t=document.body.offsetHeight-e.getBoundingClientRect().bottom,r=window.visualViewport?.height??0,n=i-r;e.style.height=`${e.offsetHeight-n+t}px`}else e.style.height="",window.visualViewport?.removeEventListener("resize",d),D()}return e.parentElement.appendChild(l),Hd&&window.visualViewport?.addEventListener("resize",d),g(),()=>{c(),h()};function u(){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 h(){l.blur(),l.remove()}function p(){const t=n.getTextCursorPositionInScreenSpaceX(),r=n.getTextCursorPositionInScreenSpaceY(),{left:o,top:i}=e.getBoundingClientRect();l.style.left=`${o+t/window.devicePixelRatio}px`,l.style.top=`${i+r/window.devicePixelRatio}px`}function f(){const t=e.getRootNode();l.addEventListener("input",_),l.addEventListener("keydown",E),l.addEventListener("copy",v),l.addEventListener("cut",w),l.addEventListener("compositionstart",S),l.addEventListener("compositionend",x),l.addEventListener("beforeinput",F),l.addEventListener("focusout",M),t.addEventListener("touchend",A),t.addEventListener("mousedown",A),t.addEventListener("mouseup",P);const r=n.onStateChanged((()=>{p()}));return()=>{l.removeEventListener("input",_),l.removeEventListener("keydown",E),l.removeEventListener("copy",v),l.removeEventListener("cut",w),l.removeEventListener("compositionstart",S),l.removeEventListener("compositionend",x),l.removeEventListener("beforeinput",F),l.removeEventListener("focusout",M),t.removeEventListener("mousedown",A),t.removeEventListener("mouseup",P),t.removeEventListener("touchend",A),r()}}function g(){null!==l.parentElement&&(l.focus(),m()||setTimeout((()=>l.focus()),0))}function m(){return l.getRootNode().activeElement===l}function b(e){return[...e].length}function y(e){const t=e.selectionEnd??e.selectionStart??0;return b(e.value.substring(0,t))}function v(e){try{const r=t.getSelectedText();""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}catch(e){console.error(e)}}function w(e){try{const r=t.getSelectedText();if(""!==r&&e.clipboardData){e.clipboardData.setData("text/plain",r),e.preventDefault();const n={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",n)}}catch(e){console.error(e)}}async function k(){return!(!s||r.unstable_isTextCursorInCompositionRange())&&(await x(),!0)}function _(e){const r=e.target,{value:n}=r;if(s){const e=y(l);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&(r.value="")}function C(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(e){if(k(),1===e.key.length&&(a=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return s&&x(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void D();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=Id(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(l.value="")}async function S(){s=!0,await t.execute("ubq/text/compositionStart")}async function x(){s?(s=!1,l.value="",t.execute("ubq/text/compositionEnd")):l.value=""}async function T(){if(!s)return;o();if(await k())return;const e=r.unstable_getCursorPosition(),t=r.unstable_getCompositionRange(),n=e.end-t.start,i=y(l);e.start>=t.start&&e.start<=1+t.end&&n!==i&&x()}async function P(){T()}async function A(t){T(),t.target===e&&"Text"===n.getEditMode()&&(g(),t.preventDefault())}async function F(e){if(s&&!e.isComposing&&x(),null===e.data)return;const r=e.target,n=e.data;if(await k())C(a);else if(s){const e=b(n);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&("\n"!==n[0]&&C(n),r.value="")}function M(e){if(R(e.relatedTarget)&&I(e.relatedTarget));else{L(e)}}function I(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function L(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),n=e.dispatchEvent(r);return n&&g(),n}function R(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 D(){n.setEditMode("Transform")}}}()}));return()=>{s?.(),a()}};function nu(e,t,r){const n=[],o=r=>{if("touch"===r.pointerType)return;const n=ou(e,r);t.execute("ubq/inputs/mousemove",n)},i=r=>{if("touch"===r.pointerType)return;const n=e.getBoundingClientRect();if(r.clientX>=n.x&&r.clientX<=n.x+n.width&&r.clientY>=n.y&&r.clientY<=n.y+n.height)return;const o={...ou(e,r),position:{x:1/0,y:1/0}};t.execute("ubq/inputs/mousemove",o)},s=o=>{if("touch"===o.pointerType)return;const i={...ou(e,o),button:iu(o.button),state:0,shiftIsHeld:!!o.shiftKey,commandIsHeld:!!o.metaKey};n[o.button]=!1,o.currentTarget.releasePointerCapture(o.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const o={...ou(e,r),button:iu(r.button),state:1,shiftIsHeld:!!r.shiftKey,commandIsHeld:!!r.metaKey};n[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",o)},l=r=>{if("touch"===r.pointerType)return;const o={...ou(e,r),shiftIsHeld:!!r.shiftKey,commandIsHeld:!!r.metaKey};n.forEach(((e,r)=>{if(e){const e={...o,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),n.length=0},c=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointermove",o),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",o),e.removeEventListener("pointerleave",i),e.removeEventListener("lostpointercapture",l),e.removeEventListener("touchmove",c),e=null}}function ou(e,t){const r=e.getBoundingClientRect(),n=r?.top??0,o=r?.left??0;return{position:{x:(t.clientX-o)*window.devicePixelRatio,y:(t.clientY-n)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function iu(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var su=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=md(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=hd((()=>{})),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=ld(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={...ou(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}}},au=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 n=e.touches.item(r);t[r]=lu(n)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),n=this.touches.find((e=>e.identifier===r.identifier));if(!n)return;n.x=r.clientX,n.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,n],o){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 ${o} rgb(${t},${r},${n})`,i.style.borderRadius="50%",i.style.borderStyle=o,i.style.backgroundColor=`rgba(${t},${r},${n}, 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,n){if(!e){const[t,r,o]=n??[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},${o})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${o}, 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(lu)}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 lu(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 cu=class _PanRecognizer extends au{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=uu(this.touches),t=uu(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&du(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function du(e){return Math.sqrt(e.x**2+e.y**2)}function uu(e){let t=0,r=0;for(let n=0;n<e.length;n++){const o=e[n];t+=o.x,r+=o.y}return t/=e.length,r/=e.length,{x:t,y:r}}var hu=class _PinchRecognizer extends au{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}},pu=class _PointRecognizer extends au{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&&du(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},fu=class _RotateRecognizer extends au{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 gu(e,t,r){const n=[],o=new pu;n.push(o.listen(e)),n.push(o.addListener((n=>{"button"in n?(t.execute("ubq/inputs/mousebutton",mu(e,n)),r.update()):t.execute("ubq/inputs/mousemove",mu(e,n))})));const i=new cu;n.push(i.listen(e)),n.push(i.addListener((r=>{t.execute("ubq/inputs/touchpan",mu(e,r))})));const s=new hu;n.push(s.listen(e)),n.push(s.addListener((r=>{t.execute("ubq/inputs/touchpinch",mu(e,r))})));const a=new fu;return n.push(a.listen(e)),n.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",mu(e,r))}))),()=>{n.forEach((e=>e()))}}function mu(e,t){const r=window.devicePixelRatio??1,{top:n,left:o}=e.getBoundingClientRect();if(1===r&&0===n&&0===o)return t;const i=e=>({x:(e.x-o)*r,y:(e.y-n)*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 bu(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var yu="application/javascript";var vu,wu,ku,_u,Cu,Eu,Su={Info:"Info",Warning:"Warning",Error:"Error"};function xu(e){return{msg:"setVisibility",visible:e}}(wu=vu||(vu={})).start=function(e){return{...e,msg:"exportVideo"}},wu.abort=function(){return{msg:"exportVideoAbort"}},wu.finished=function(e){return{...e,msg:"exportVideoFinished"}},wu.error=function(e){return{...e,msg:"exportVideoError"}},wu.progress=function(e){return{...e,msg:"exportVideoProgress"}},wu.log=function(e){return{...e,msg:"exportLog"}},(_u=ku||(ku={})).start=function(e){return{...e,msg:"exportStatic"}},_u.abort=function(){return{msg:"exportStaticAbort"}},_u.finished=function(e){return{...e,msg:"exportStaticFinished"}},_u.error=function(e){return{...e,msg:"exportStaticError"}},_u.log=function(e){return{...e,msg:"exportLog"}},(Eu=Cu||(Cu={})).start=function(e){return{...e,msg:"exportWithColorMask"}},Eu.abort=function(){return{msg:"exportWithColorMaskAbort"}},Eu.finished=function(e){return{...e,msg:"exportWithColorMaskFinished"}},Eu.error=function(e){return{...e,msg:"exportWithColorMaskError"}},Eu.log=function(e){return{...e,msg:"exportLog"}};var Tu=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Pu(this.configuration),l=new Promise(((e,t)=>{if(s.onmessage=({data:n})=>{switch(n.msg){case"exportVideoFinished":{const t=new Blob([n.data],{type:n.mimeType});e(t);break}case"exportVideoError":t(n.error);break;case"exportVideoProgress":r?.onProgress?.(n.renderedFrames,n.encodedFrames,n.totalFrames);break;case"exportLog":this.configuration.logger(n.message,n.logLevel);break;default:console.error("Unknown message received ",n)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(vu.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(vu.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}async export(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Pu(this.configuration),l=new Promise(((e,t)=>{if(s.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)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(ku.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(ku.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}async exportWithColorMask(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Pu(this.configuration),l=new Promise(((e,t)=>{if(s.onmessage=({data:r})=>{switch(r.msg){case"exportWithColorMaskFinished":{const[t,n]=r.data,o=new Blob([t],{type:r.mimeType}),i=new Blob([n],{type:r.mimeType});e([o,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)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(Cu.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(Cu.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}};function Pu(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 Au(e){const t="assets/core/worker-host-v1.61.0-nightly.20250915.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:yu}))}(new URL(t,e.core.baseURL));return new Worker(r)}var Fu=10;globalThis.ubq_browserTabHidden=!0;var Mu={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 Iu(e,t,r){return async(n,o,i,s)=>{Gt("handle",n,Bt());try{Gt("options",o,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",o,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 o?o:{mimeType:o,onProgress:i,...s},c=l.onProgress,d=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),u=r(),h=t.editor.getActiveLicense(),p={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{p.trackingMetadata=t.editor.getTrackingMetadata()}catch{p.trackingMetadata=void 0}const f={block:n,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 Tu({...e,license:h}).exportVideo(d,f,{abortSignal:l.abortSignal,inactivityTimeout:u,onProgress:c},p)}return async function(e,t,r,n,o){let i,s,a=0,l=null;const c=o.visibility??Mu,d=o.inactivityTimeout,u=c.subscribe((()=>{null!==l&&(l=Date.now()),globalThis.ubq_browserTabHidden=!c.value()}));let h=null;function p(){clearTimeout(s),u(),h?.()}try{let u=function(){!0===c.value()&&null!==l&&Date.now()-l>d?i(new Error("Video export timed out due to inactivity.")):(a<Fu&&g.update(),s=setTimeout(u,1))};const f=new OffscreenCanvas(64,64),g=await Xd(f,{...e,audioOutput:"none"}),m=new SceneAPI(g),b=new BlockAPI(g),y=new EditorAPI(g);if(h=()=>{g.delete()},n?.trackingMetadata&&y.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})`);y.setURIResolver(e)}n?.buffers&&y.restoreBuffers(n.buffers),await m.loadFromString(t,!0);const v=b.getDuration(r.block),w=r.mimeType??"video/mp4";u();const k=await new Promise(((t,n)=>{i=n,e.abortSignal?.addEventListener("abort",(()=>{n(new Error("AbortSignal received"))})),g.exportVideoToBuffer(r.block,r.timeOffset??0,r.duration??v,w,((e,t,r)=>{a=e-t,l=Date.now(),o?.onProgress?.(e,t,r)}),(e=>{"error"in e?n(e.error):t(e)}),{h264Profile:r.h264Profile??77,h264Level:r.h264Level??52,framerate:r.framerate??30,videoBitrate:r.videoBitrate??0,audioBitrate:r.audioBitrate??0,useTargetSize:void 0!==r.targetWidth&&void 0!==r.targetHeight,targetWidth:r.targetWidth??0,targetHeight:r.targetHeight??0})})),_=new Uint8Array(k.byteLength);return _.set(k),p(),{data:_,mimeType:w}}catch(e){throw p(),e}}(l.abortSignal?{...e,abortSignal:l.abortSignal}:e,d,f,p,{onProgress:c,visibility:Du,inactivityTimeout:u}).then((({data:e,mimeType:t})=>new Blob([e],{type:t})))}}var Lu,Ru,Du={value:()=>"visible"===document.visibilityState,subscribe:ad((Lu=document,Ru="visibilitychange",function(e){return Lu.addEventListener(Ru,e),function(){Lu.removeEventListener(Ru,e)}}),nd((()=>"visible"===document.visibilityState)))};var CreativeEngine=class{asset;block;editor;event;scene;variable;reactor;version="1.61.0-nightly.20250915";#u;#h;#p;#f;#e;#g;#m=[];constructor(e,t,r){this.#e=e,this.#g=new Ld(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 su(this,e),this.#m.push(this.#f.dispose);const n=new Jd(this.editor.getEditMode());this.reactor=n;const o=[n.decorateObject(this.#g),n.decorateObject(this.block),n.decorateObject(this.editor),n.decorateObject(this.scene),n.decorateObject(this.variable)];let i=(0,_t.default)(n.updateDirtyReactions.bind(n),1e3/120,{leading:!0,trailing:!1}),s=this.addPostUpdateCallback(i);const a=this.editor.onStateChanged((()=>{n.currentMode=this.editor.getEditMode(),i="Playback"===n.currentMode?(0,_t.default)(n.updateDirtyReactions.bind(n),100,{leading:!0,trailing:!1}):(0,_t.default)(n.updateDirtyReactions.bind(n),1e3/120,{leading:!0,trailing:!1});const e=this.addPostUpdateCallback(i);s(),s=e}));this.#m.push((()=>{o.forEach((e=>e())),a(),s(),this.reactor.dispose()})),this.block.exportVideo=Iu(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(n,o,i)=>{Gt("handle",n,Bt());try{Gt("options",o,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(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",o,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(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 o?o:{mimeType:o,...i},l=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),c=r(),d=t.editor.getActiveLicense(),u={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{u.trackingMetadata=t.editor.getTrackingMetadata()}catch{u.trackingMetadata=void 0}const h={block:n,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 Tu({...e,license:d}).export(l,h,{abortSignal:a.abortSignal,inactivityTimeout:c},u)}}(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(n,o,i,s,a,l)=>{Gt("handle",n,Bt());try{Gt("maskColorR",o,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(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",o,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(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 o?(d=o,u=i,h=s,p=a??{}):(d=i,u=s,h=a,p={mimeType:o,...l});const f=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),g=r(),m=t.editor.getActiveLicense(),b={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{b.trackingMetadata=t.editor.getTrackingMetadata()}catch{b.trackingMetadata=void 0}const y={block:n,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 Tu({...e,license:m}).exportWithColorMask(f,y,{abortSignal:p.abortSignal,inactivityTimeout:g},b)}}(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 bd(this),this.#b(),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.legacyAPI=this.#g)}async 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}};await 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,n=t.width*r,o=t.height*r;e.width!==n&&(e.width=n),e.height!==o&&(e.height=o)}#v(){const{width:e,height:t}=this.#h,r="undefined"!=typeof window?window.devicePixelRatio:1,{height:n,width:o,pixelRatio:i}=this.#u.settings.value();if(!bu(o,e,1e-4)||!bu(n,t,1e-4)||!bu(i,r,1e-4)){this.#u.settings.update({height:t,width:e,pixelRatio:r});const n=this.scene.get();if(!bu(i,r,1e-4)&&null!==n&&!1===this.scene.isZoomAutoFitEnabled(n)){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,n=0;if(this.#_)return;const o=()=>{if(this.#_=requestAnimationFrame(o),!r)try{this.#S(e),n=0}catch(e){throw n++,n>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),this.#x()),e}};this.#_=requestAnimationFrame(o)}#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),n=[nu(t,this.#g,r),this.#f.initialize(t),ru(t,this.#g,this.#e,this.editor,r),tu(t,this.editor),gu(t,this.#g,this.#e),Md(this.#h,this.#e,(()=>{this.#h.width=this.#h.width})),ed(t,this.#T)];this.#P=()=>{n.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 n="80b8fc8b",o="1.61.0-nightly.20250915";if(n||o){const e=["[CreativeEngine]"];o&&e.push(`v${o}`),n&&e.push(`Revision ${n}`),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=kd(Sd(Fd,e));if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of Cd(Fd,e))s.logger(t,"Warning");const a=new this(await Xd(r,s),i??r,s);return Object.defineProperty(a,"version",{configurable:!1,writable:!1}),Ed(Fd,s,a),a}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v4",excludeAssetSourceIds:t=[]}={}){return Kc(this,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:n=!1}={}){return Jc(this.asset,this.scene,t,r,n,void 0,e)}get _camera(){return this.#u}get _legacyApi(){return this.#g}};var Bu=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},Ou=1e4,ju=1e6,$u=8;async function qu(){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),n=r.getContext("webgl2");if(!n)throw new Error("Could not create WebGL2 context");return n.clearColor(1,0,1,1),n.clear(n.COLOR_BUFFER_BIT),new Promise(((e,n)=>{setTimeout((()=>{n(new Error("Timed out during video export"))}),Ou);const o=new VideoEncoder({output:()=>e(),error:e=>n(new Error(`Could not create a new VideoEncoder: ${e}`))});try{o.configure(t)}catch(e){throw new Error(`Failed to configure a VideoEncoder object with ${JSON.stringify(t)}: ${e}`)}for(let e=0;e<$u;++e){const n=new VideoFrame(r,{timestamp:e*(ju/t.framerate),duration:ju/t.framerate});o.encode(n,{keyFrame:!0}),n.close()}o.flush().then((()=>{"closed"!==o.state&&o.close()}),(e=>{n(new Error(`Error during video export: ${e}`))}))}))}async function Uu(){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"))}),Ou);const n=new AudioEncoder({output:()=>e(),error:e=>r(new Error(`Could not create a new AudioEncoder with ${JSON.stringify(t)}: ${e}`))});try{n.configure(t)}catch(e){throw new Error(`Failed to configure an AudioEncoder object with ${JSON.stringify(t)}: ${e}`)}const o=1024,i=new Float32Array(o*t.numberOfChannels);for(let e=0;e<o;++e){const t=e/o;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:o,numberOfChannels:t.numberOfChannels,timestamp:e*o/t.sampleRate*ju,data:i});n.encode(r),r.close()}catch(e){throw new Error(`Failed to encode AudioData in an encoder configured with ${JSON.stringify(t)}: ${e}`)}n.flush().then((()=>{"closed"!==n.state&&n.close()}),(e=>{r(new Error(`Error during audio export with ${t}: ${e}`))}))}))}function Wu(){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 Hu(){try{return Wu(),!0}catch{return!1}}async function Nu(){await Promise.all([qu(),Uu()])}async function Vu(){try{return await Nu(),!0}catch(e){return!1}}var zu,Gu,Xu=function(){try{const e=!0,t=!0,r="globalThis"in window,n="BigInt"in window,o="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 Bu()&&e&&t&&r&&n&&o&&i&&s&&a&&l}catch{return!1}};(Gu=zu||(zu={})).combineLatest=dd,Gu.fan=sd,Gu.makeSource=rd,Gu.map=nd,Gu.memo=id,Gu.merge=ld,Gu.pipe=ad,Gu.startWith=od,Gu.switchAll=cd;export{Su as LogLevel,zt as MimeType,Tu as WorkerClient,Ed as _applyFallback,fd as _getBlockStream,kd as _initWithDefaults,md as _makeEngineChannel,hd as _makeValueChannel,gd as _memoizeResult,Sd as _migrateConfigObject,zu as _streams,Cd as _warnKeys,Nu as checkVideoExportSupport,Wu as checkVideoSupport,CreativeEngine as default,yd as defaultLogger,Ml as isCMYKColor,Al as isRGBAColor,Fl as isSpotColor,wd as normalizeBaseURL,Xu as supportsBrowser,Hu as supportsVideo,Vu as supportsVideoExport,Bu as supportsWasm};
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=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,n)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,c=(e,r)=>t(e,"name",{value:r,configurable:!0}),d=(e,t)=>function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports},u=(s,a,l)=>(l=null!=s?e(o(s)):{},((e,o,s,a)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of n(o))i.call(e,l)||l===s||t(e,l,{get:()=>o[l],enumerable:!(a=r(o,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,n,o)=>({kind:p[e],name:t,metadata:n,addInitializer:e=>r._?a("Already initialized"):o.push(f(e||null))}),m=(e,t)=>l(t,s("metadata"),e[3]),b=(e,t,r,n)=>{for(var o=0,i=e[t>>1],s=i&&i.length;o<s;o++)1&t?i[o].call(r):n=i[o].call(r,n);return n},y=(e,n,o,i,s,l)=>{var d,u,h,b,y,v=7&n,w=!!(8&n),C=!!(16&n),x=v>3?e.length+1:v?w?1:2:0,P=p[v+5],T=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[o](){return _(this,l)},set[o](e){return E(this,l,e)}},o));v?C&&v<4&&c(l,(v>2?"set ":v>1?"get ":"")+o):c(s,o);for(var M=i.length-1;M>=0;M--)b=g(v,o,h={},e[3],A),v&&(b.static=w,b.private=C,y=b.access={has:C?e=>k(s,e):e=>o in e},3^v&&(y.get=C?e=>(1^v?_:S)(e,s,4^v?l:F.get):e=>e[o]),v>2&&(y.set=C?(e,t)=>E(e,s,t,4^v?l:F.set):(e,t)=>e[o]=t)),u=(0,i[M])(v?v<4?C?l:F[P]:v>4?void 0:{get:F.get,set:F.set}:s,b),h._=1,4^v||void 0===u?f(u)&&(v>4?T.unshift(u):v?C?l=u:F[P]=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)&&T.unshift(d));return v||m(e,s),F&&t(s,o,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,n)=>(w(e,t,"write to private field"),n?n.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)}}}),P=d({"../../../node_modules/lodash/_freeGlobal.js"(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r}}),T=d({"../../../node_modules/lodash/_root.js"(e,t){var r=P(),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();t.exports=o}}),A=d({"../../../node_modules/lodash/now.js"(e,t){var r=T();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(),n=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(n,""):e}}}),I=d({"../../../node_modules/lodash/_Symbol.js"(e,t){var r=T().Symbol;t.exports=r}}),L=d({"../../../node_modules/lodash/_getRawTag.js"(e,t){var r=I(),n=Object.prototype,o=n.hasOwnProperty,i=n.toString,s=r?r.toStringTag:void 0;t.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var a=i.call(e);return n&&(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(),n=L(),o=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)?n(e):o(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(),n=B();t.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==r(e)}}}),j=d({"../../../node_modules/lodash/toNumber.js"(e,t){var r=M(),n=x(),o=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(o(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(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(),n=A(),o=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,n=c;return l=c=void 0,f=t,u=e.apply(n,r)}function v(e){var r=e-p;return void 0===p||r>=t||r<0||m&&e-f>=d}function w(){var e=n();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=n(),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=o(t)||0,r(a)&&(g=!!a.leading,d=(m="maxWait"in a)?i(o(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(n())},_}}}),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 n=e.length;n--;)if(r(e[n][0],t))return n;return-1}}}),H=d({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=W(),n=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=r(t,e);return!(o<0)&&(o==t.length-1?t.pop():n.call(t,o,1),--this.size,!0)}}}),N=d({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=W();t.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}}}),z=d({"../../../node_modules/lodash/_listCacheHas.js"(e,t){var r=W();t.exports=function(e){return r(this.__data__,e)>-1}}}),V=d({"../../../node_modules/lodash/_listCacheSet.js"(e,t){var r=W();t.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}}}),G=d({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=q(),n=H(),o=N(),i=z(),s=V();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,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(),n=x();t.exports=function(e){if(!n(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=T()["__core-js_shared__"];t.exports=r}}),ee=d({"../../../node_modules/lodash/_isMasked.js"(e,t){var r,n=J(),o=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!o&&o 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(),n=ee(),o=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!(!o(e)||n(e))&&(r(e)?u:s).test(i(e))}}}),ne=d({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),oe=d({"../../../node_modules/lodash/_getNative.js"(e,t){var r=re(),n=ne();t.exports=function(e,t){var o=n(e,t);return r(o)?o:void 0}}}),ie=d({"../../../node_modules/lodash/_Map.js"(e,t){var r=oe()(T(),"Map");t.exports=r}}),se=d({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=oe()(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(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(t,e)?t[e]:void 0}}}),de=d({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=se(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:n.call(t,e)}}}),ue=d({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=se();t.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),he=d({"../../../node_modules/lodash/_Hash.js"(e,t){var r=ae(),n=le(),o=ce(),i=de(),s=ue();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),pe=d({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=he(),n=G(),o=ie();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||n),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 n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.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 n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}}}),we=d({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=pe(),n=me(),o=be(),i=ye(),s=ve();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}a.prototype.clear=r,a.prototype.delete=n,a.prototype.get=o,a.prototype.has=i,a.prototype.set=s,t.exports=a}}),ke=d({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=G(),n=ie(),o=we();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var s=i.__data__;if(!n||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(s)}return i.set(e,t),this.size=i.size,this}}}),_e=d({"../../../node_modules/lodash/_Stack.js"(e,t){var r=G(),n=X(),o=Y(),i=K(),s=Q(),a=ke();function l(e){var t=this.__data__=new r(e);this.size=t.size}l.prototype.clear=n,l.prototype.delete=o,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(),n=Ce(),o=Ee();function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=n,i.prototype.has=o,t.exports=i}}),xe=d({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}}}),Pe=d({"../../../node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),Te=d({"../../../node_modules/lodash/_equalArrays.js"(e,t){var r=Se(),n=xe(),o=Pe();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(!n(t,(function(e,t){if(!o(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=T().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,n){r[++t]=[n,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(),n=Ae(),o=U(),i=Te(),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 n(e),new n(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+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,n=t.length,o=e.length;++r<n;)e[o+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(),n=Re();t.exports=function(e,t,o){var i=t(e);return n(e)?i:r(i,o(e))}}}),Be=d({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var s=e[r];t(s,r,e)&&(i[o++]=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(),n=Oe(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return o.call(e,t)})))}:n;t.exports=s}}),$e=d({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}}),qe=d({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=D(),n=B();t.exports=function(e){return n(e)&&"[object Arguments]"==r(e)}}}),Ue=d({"../../../node_modules/lodash/isArguments.js"(e,t){var r=qe(),n=B(),o=Object.prototype,i=o.hasOwnProperty,s=o.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return n(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=T(),n=We(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,s=i&&i.exports===o?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}}),Ne=d({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}}}),ze=d({"../../../node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),Ve=d({"../../../node_modules/lodash/_baseIsTypedArray.js"(e,t){var r=D(),n=ze(),o=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 o(e)&&n(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=P(),n="object"==typeof e&&e&&!e.nodeType&&e,o=n&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,s=function(){try{var e=o&&o.require&&o.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=Ve(),n=Ge(),o=Xe(),i=o&&o.isTypedArray,s=i?n(i):r;t.exports=s}}),Ke=d({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=$e(),n=Ue(),o=Re(),i=He(),s=Ne(),a=Ye(),l=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),d=!c&&n(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(),n=Je(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return n(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),tt=d({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=Z(),n=ze();t.exports=function(e){return null!=e&&n(e.length)&&!r(e)}}}),rt=d({"../../../node_modules/lodash/keys.js"(e,t){var r=Ke(),n=et(),o=tt();t.exports=function(e){return o(e)?r(e):n(e)}}}),nt=d({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=De(),n=je(),o=rt();t.exports=function(e){return r(e,o,n)}}}),ot=d({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=nt(),n=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,s,a){var l=1&o,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:n.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,o,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=oe()(T(),"DataView");t.exports=r}}),st=d({"../../../node_modules/lodash/_Promise.js"(e,t){var r=oe()(T(),"Promise");t.exports=r}}),at=d({"../../../node_modules/lodash/_Set.js"(e,t){var r=oe()(T(),"Set");t.exports=r}}),lt=d({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=oe()(T(),"WeakMap");t.exports=r}}),ct=d({"../../../node_modules/lodash/_getTag.js"(e,t){var r=it(),n=ie(),o=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(n),m=l(o),b=l(i),y=l(s),v=a;(r&&v(new r(new ArrayBuffer(1)))!=p||n&&v(new n)!=c||o&&v(o.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,n=r?l(r):"";if(n)switch(n){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(),n=Te(),o=Ie(),i=ot(),s=ct(),a=Re(),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)?n(e,t,f,g,m,b):o(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 P=S?e.value():e,T=x?t.value():t;return b||(b=new r),m(P,T,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(),n=B();t.exports=function e(t,o,i,s,a){return t===o||(null==t||null==o||!n(t)&&!n(o)?t!=t&&o!=o:r(t,o,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=$(),n=x();t.exports=function(e,t,o){var i=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return n(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),r(e,t,{leading:i,maxWait:t,trailing:s})}}}),ft=d({"../../../node_modules/lodash/toFinite.js"(e,t){var r=j(),n=1/0;t.exports=function(e){return e?(e=r(e))===n||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),n=t%1;return t==t?n?t-n:t:0}}}),mt=d({"../../../node_modules/lodash/before.js"(e,t){var r=gt();t.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}}}),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,n=(r="undefined"!=typeof document?document.currentScript?.src:void 0,"undefined"!=typeof __filename&&(r=r||__filename),async function(e={}){var t,n,o,i,s,a,l=e,c=new Promise(((e,r)=>{t=e,n=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,n,o,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 n(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),n.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 o=e.files,i=0;i<o.length;++i)new n(o[i].start,o[i].end,o[i].audio||0).open("GET",o[i].filename);function s(o){r(o,"Loading data file failed."),r(o.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var i=new Uint8Array(o);n.prototype.byteArray=i;for(var s=e.files,a=0;a<s.length;++a)n.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,n=c,o=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):o(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(o);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")??n);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,n=0;for(const t of Object.values(l.dataFileDownloads))e+=t.loaded,n+=t.total;return l.setStatus?.(`Downloading data... (${e}/${n})`),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;o(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=o||(o={}))[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=o.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=[],n=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);n(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",n),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const o=new Uint8Array(t);let i=0;for(const e of r)o.set(e,i),i+=e.length;return this.finish(o)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===o.PENDING}isError(){return this.state===o.ERROR}isFinished(){return this.state===o.FINISHED}isAllocated(){return this.state===o.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:o.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:o.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:o.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,n,o,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,n,o,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(),n=t.createReadStream(r(e.uri));return e.readChunks(n)}async _fetchRemote(e,t,r,n,o,i,a,c){const d=l.UTF8ToString(a,c),u=this.getHeaders(r,n),h=t===s.POST?new Uint8Array(new Uint8Array(l.HEAPU8.buffer,o,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 n=0;n<t;n++){const t=l.getValue(e+4*n,"i32"),o=this._headers.get(t);r[o.key]=o.value}return r}createHeader(e,t,r,n){const o=l.UTF8ToString(e,t),i=l.UTF8ToString(r,n),s=this._nextHeaderHandle++;return this._headers.set(s,{key:o,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),n=l._malloc(t.length+1),o=l.HEAPU8.subarray(n,n+t.length+1);for(let e=0;e<t.length;e++)o[e]=t[e];o[t.length]=0,r[1]=n}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 n=new VideoDecoder({output:o=>{const i=n.textures;let s=!1;if((n.shouldDropFrames||n.decodedFrames<n.requestedFrame||n.decodeQueueSize>=i.length)&&(s=!0),!s){var a=l.ctx;const e=n.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(o):o;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,s),a.bindTexture(a.TEXTURE_2D,r)}o.close(),n.decodedFrames++,l.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,n.decodedFrames,s,r)},error:e=>{n.unexpectedError=e,console.error(e)}});return n.decodedFrames=0,n.requestedFrame=0,n.shouldDropFrames=!1,n.isHdr=t,n},l.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const n=new AudioDecoder({output:o=>{if(n.flushing)return void o.close();const i=l.HEAPF32.subarray(e/4,e/4+r),s=l.HEAPF32.subarray(t/4,t/4+r),a=1===o.numberOfChannels?0:1;if("f32-planar"===o.format){let e=n.writtenFrames%r;if(e+o.numberOfFrames<=r)o.copyTo(i.subarray(e),{planeIndex:0,frameCount:o.numberOfFrames}),o.copyTo(s.subarray(e),{planeIndex:a,frameCount:o.numberOfFrames});else{const t=r-e;o.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),o.copyTo(s.subarray(e),{planeIndex:a,frameCount:t}),o.copyTo(i,{planeIndex:0,frameOffset:t}),o.copyTo(s,{planeIndex:a,frameOffset:t})}n.writtenFrames+=o.numberOfFrames}else if("s16-planar"===o.format)if(1===o.numberOfChannels){const e=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let a=n.writtenFrames%r;i[a]=o,s[a]=o,n.writtenFrames++}}else{const e=new Int16Array(o.numberOfFrames),t=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let a=0;a<o.numberOfFrames;a++){let o=n.writtenFrames%r;i[o]=e[a]/32768,s[o]=t[a]/32768,n.writtenFrames++}}else if("s16"===o.format){const e=new Int16Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let a=n.writtenFrames%r;i[a]=o,s[a]=o,n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let a=n.writtenFrames%r;i[a]=e[t*o.numberOfChannels+0]/32768,s[a]=e[t*o.numberOfChannels+1]/32768,n.writtenFrames++}}else if("f32-planar"===o.format)if(1===o.numberOfChannels){const e=new Float32Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){let o=n.writtenFrames%r;i[o]=e[t],s[o]=e[t],n.writtenFrames++}}else{const e=new Float32Array(o.numberOfFrames),t=new Float32Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let a=0;a<o.numberOfFrames;a++){let o=n.writtenFrames%r;i[o]=e[a],s[o]=t[a],n.writtenFrames++}}else if("f32"===o.format){const e=new Float32Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){let o=n.writtenFrames%r;i[o]=e[t],s[o]=e[t],n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let a=n.writtenFrames%r;i[a]=e[t*o.numberOfChannels+0],s[a]=e[t*o.numberOfChannels+1],n.writtenFrames++}}else console.error("Unsupported audio format:",o.format);o.close()},error:e=>{n.unexpectedError=e,console.error(e)}});return n.writtenFrames=0,n},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(),n=r.split("/").filter(Boolean);let o=e;for(let e=0;e<n.length-1;e++)o=await o.getDirectoryHandle(n[e]);const i=await o.getFileHandle(n[n.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 n=l.emscripten_ubq_opfs_CHUNK_SIZE,o=r*n,i=o+n;l.emscripten_ubq_opfs_ensureFile(e,t).then((async e=>{const n=(await e.getFile()).slice(o,i),s=await n.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,n,o){if(n<=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=n=>{n.data&&n.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),o),s.data.bytes===n?e(n):t(new Error("short read")))};i.addEventListener("message",a),c.post({read:{offset:s,size:n,ptr:o,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 n=l.emscripten_ubq_opfs_CHUNK_SIZE,o=r*n,i=o+n;try{const n=await l.emscripten_ubq_opfs_ensureFile(e,t),s=(await n.getFile()).slice(o,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,P,T,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=P=new Int16Array(e),l.HEAPU8=x=new Uint8Array(e),l.HEAPU16=T=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 H(e){U++,l.monitorRunDependencies?.(U)}function N(e){if(U--,l.monitorRunDependencies?.(U),0==U&&W){var t=W;W=null,t()}}function z(e){l.onAbort?.(e),_(e="Aborted("+e+")"),B=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}function V(){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 n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,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}`),z(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 n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&Y)return Y.decode(e.subarray(t,o));for(var i="";t<o;){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),ne=l.noExitRuntime||!0,oe=e=>Zl(e),ie=()=>ec(),se=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ae=(e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-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-o},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 n=r.get_type();if(!n)return he(0),t;for(var o of e){if(0===o||o===n)break;var i=r.ptr+16;if(nc(o,n,i))return he(o),t}return he(n),t},fe={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,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],n=t[1];return r||n?(n&&(n=n.slice(0,-1)),r+n):"."},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,n=e.length-1;n>=-1&&!r;n--){var o=n>=0?e[n]:Pe.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";t=o+"/"+t,r=fe.isAbs(o)}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 n=r(e.split("/")),o=r(t.split("/")),i=Math.min(n.length,o.length),s=i,a=0;a<i;a++)if(n[a]!==o[a]){s=a;break}var l=[];for(a=s;a<n.length;a++)l.push("..");return(l=l.concat(o.slice(s))).join("/")}},be=[],ye=(e,t,r)=>{var n=r>0?r:se(e)+1,o=new Array(n),i=ae(e,o,0,o.length);return t&&(o.length=i),o},ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Pe.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Pe.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,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Pe.ErrnoError(60);for(var i=0,s=0;s<n;s++){var a;try{a=e.tty.ops.get_char(e.tty)}catch(e){throw new Pe.ErrnoError(29)}if(void 0===a&&0===i)throw new Pe.ErrnoError(6);if(null==a)break;i++,t[r+s]=a}return i&&(e.node.atime=Date.now()),i},write(e,t,r,n,o){if(!e.tty||!e.tty.ops.put_char)throw new Pe.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Pe.ErrnoError(29)}return n&&(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,n=process.stdin.fd;try{r=w.readSync(n,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,n){if(Pe.isBlkdev(r)||Pe.isFIFO(r))throw new Pe.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:Pe.chrdev_stream_ops}};var o=Pe.createNode(e,t,r,n);return Pe.isDir(o.mode)?(o.node_ops=_e.ops_table.dir.node,o.stream_ops=_e.ops_table.dir.stream,o.contents={}):Pe.isFile(o.mode)?(o.node_ops=_e.ops_table.file.node,o.stream_ops=_e.ops_table.file.stream,o.usedBytes=0,o.contents=null):Pe.isLink(o.mode)?(o.node_ops=_e.ops_table.link.node,o.stream_ops=_e.ops_table.link.stream):Pe.isChrdev(o.mode)&&(o.node_ops=_e.ops_table.chrdev.node,o.stream_ops=_e.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[t]=o,e.atime=e.mtime=e.ctime=o.atime),o},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 n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.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=Pe.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,Pe.isDir(e.mode)?t.size=4096:Pe.isFile(e.mode)?t.size=e.usedBytes:Pe.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,n)=>_e.createNode(e,t,r,n),rename(e,t,r){var n;try{n=Pe.lookupNode(t,r)}catch(e){}if(n){if(Pe.isDir(e.mode))for(var o in n.contents)throw new Pe.ErrnoError(55);Pe.hashRemoveNode(n)}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=Pe.lookupNode(e,t);for(var n in r.contents)throw new Pe.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,t,r){var n=_e.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Pe.isLink(e.mode))throw new Pe.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&i.subarray)t.set(i.subarray(o,o+s),r);else for(var a=0;a<s;a++)t[r+a]=i[o+a];return s},write(e,t,r,n,o,i){if(t.buffer===S.buffer&&(i=!1),!n)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+n),s.usedBytes=n,n;if(0===s.usedBytes&&0===o)return s.contents=t.slice(r,r+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(t.subarray(r,r+n),o),n}if(_e.expandFileStorage(s,o+n),s.contents.subarray&&t.subarray)s.contents.set(t.subarray(r,r+n),o);else for(var a=0;a<n;a++)s.contents[o+a]=t[r+a];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Pe.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Pe.ErrnoError(28);return n},mmap(e,t,r,n,o){if(!Pe.isFile(e.node.mode))throw new Pe.ErrnoError(43);var i,s,a=e.node.contents;if(2&o||!a||a.buffer!==S.buffer){if(s=!0,!(i=ke(t)))throw new Pe.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,n,o)=>(_e.stream_ops.write(e,t,0,n,r,!1),0)}},Ce=(e,t,r,n,o,i)=>{Pe.createDataFile(e,t,r,n,o,i)},Ee=l.preloadPlugins||[],Se=(e,t,r,n,o,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,n,o,l),i?.(),N()}((e,t,r,n)=>{void 0!==br&&br.init();var o=!1;return Ee.forEach((i=>{o||i.canHandle(t)&&(i.handle(e,t,r,n),o=!0)})),o})(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},Pe={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,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=Pe.nextInode++,this.name=t,this.mode=r,this.rdev=n,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 Pe.isDir(this.mode)}get isDevice(){return Pe.isChrdev(this.mode)}},lookupPath(e,t={}){if(!e)throw new Pe.ErrnoError(44);t.follow_mount??=!0,fe.isAbs(e)||(e=Pe.cwd()+"/"+e);e:for(var r=0;r<40;r++){for(var n=e.split("/").filter((e=>!!e)),o=Pe.root,i="/",s=0;s<n.length;s++){var a=s===n.length-1;if(a&&t.parent)break;if("."!==n[s])if(".."!==n[s]){i=fe.join2(i,n[s]);try{o=Pe.lookupNode(o,n[s])}catch(e){if(44===e?.errno&&a&&t.noent_okay)return{path:i};throw e}if(!Pe.isMountpoint(o)||a&&!t.follow_mount||(o=o.mounted.root),Pe.isLink(o.mode)&&(!a||t.follow)){if(!o.node_ops.readlink)throw new Pe.ErrnoError(52);var l=o.node_ops.readlink(o);fe.isAbs(l)||(l=fe.dirname(i)+"/"+l),e=l+"/"+n.slice(s+1).join("/");continue e}}else i=fe.dirname(i),o=o.parent}return{path:i,node:o}}throw new Pe.ErrnoError(32)},getPath(e){for(var t;;){if(Pe.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,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Pe.nameTable.length},hashAddNode(e){var t=Pe.hashName(e.parent.id,e.name);e.name_next=Pe.nameTable[t],Pe.nameTable[t]=e},hashRemoveNode(e){var t=Pe.hashName(e.parent.id,e.name);if(Pe.nameTable[t]===e)Pe.nameTable[t]=e.name_next;else for(var r=Pe.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Pe.mayLookup(e);if(r)throw new Pe.ErrnoError(r);for(var n=Pe.hashName(e.id,t),o=Pe.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return Pe.lookup(e,t)},createNode(e,t,r,n){var o=new Pe.FSNode(e,t,r,n);return Pe.hashAddNode(o),o},destroyNode(e){Pe.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)=>Pe.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!Pe.isDir(e.mode))return 54;var t=Pe.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){if(!Pe.isDir(e.mode))return 54;try{return Pe.lookupNode(e,t),20}catch(e){}return Pe.nodePermissions(e,"wx")},mayDelete(e,t,r){var n;try{n=Pe.lookupNode(e,t)}catch(e){return e.errno}var o=Pe.nodePermissions(e,"wx");if(o)return o;if(r){if(!Pe.isDir(n.mode))return 54;if(Pe.isRoot(n)||Pe.getPath(n)===Pe.cwd())return 10}else if(Pe.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?Pe.isLink(e.mode)?32:Pe.isDir(e.mode)&&("r"!==Pe.flagsToPermissionString(t)||576&t)?31:Pe.nodePermissions(e,Pe.flagsToPermissionString(t)):44,checkOpExists(e,t){if(!e)throw new Pe.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Pe.MAX_OPEN_FDS;e++)if(!Pe.streams[e])return e;throw new Pe.ErrnoError(33)},getStreamChecked(e){var t=Pe.getStream(e);if(!t)throw new Pe.ErrnoError(8);return t},getStream:e=>Pe.streams[e],createStream:(e,t=-1)=>(e=Object.assign(new Pe.FSStream,e),-1==t&&(t=Pe.nextfd()),e.fd=t,Pe.streams[t]=e,e),closeStream(e){Pe.streams[e]=null},dupStream(e,t=-1){var r=Pe.createStream(e,t);return r.stream_ops?.dup?.(r),r},doSetAttr(e,t,r){var n=e?.stream_ops.setattr,o=n?e:t;n??=t.node_ops.setattr,Pe.checkOpExists(n,63),n(o,r)},chrdev_stream_ops:{open(e){var t=Pe.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Pe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Pe.devices[e]={stream_ops:t}},getDevice:e=>Pe.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push(...n.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Pe.syncFSRequests++,Pe.syncFSRequests>1&&_(`warning: ${Pe.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Pe.getMounts(Pe.root.mount),n=0;function o(e){return Pe.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var n,o="/"===r,i=!r;if(o&&Pe.root)throw new Pe.ErrnoError(10);if(!o&&!i){var s=Pe.lookupPath(r,{follow_mount:!1});if(r=s.path,n=s.node,Pe.isMountpoint(n))throw new Pe.ErrnoError(10);if(!Pe.isDir(n.mode))throw new Pe.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},l=e.mount(a);return l.mount=a,a.root=l,o?Pe.root=l:n&&(n.mounted=a,n.mount&&n.mount.mounts.push(a)),l},unmount(e){var t=Pe.lookupPath(e,{follow_mount:!1});if(!Pe.isMountpoint(t.node))throw new Pe.ErrnoError(28);var r=t.node,n=r.mounted,o=Pe.getMounts(n);Object.keys(Pe.nameTable).forEach((e=>{for(var t=Pe.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&Pe.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Pe.lookupPath(e,{parent:!0}).node,o=fe.basename(e);if(!o)throw new Pe.ErrnoError(28);if("."===o||".."===o)throw new Pe.ErrnoError(20);var i=Pe.mayCreate(n,o);if(i)throw new Pe.ErrnoError(i);if(!n.node_ops.mknod)throw new Pe.ErrnoError(63);return n.node_ops.mknod(n,o,t,r)},statfs:e=>Pe.statfsNode(Pe.lookupPath(e,{follow:!0}).node),statfsStream:e=>Pe.statfsNode(e.node),statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Pe.nextInode,ffree:Pe.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,Pe.mknod(e,t,0)),mkdir:(e,t=511)=>(t&=1023,t|=16384,Pe.mknod(e,t,0)),mkdirTree(e,t){var r=e.split("/"),n="";for(var o of r)if(o){n+="/"+o;try{Pe.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,Pe.mknod(e,t,r)),symlink(e,t){if(!me.resolve(e))throw new Pe.ErrnoError(44);var r=Pe.lookupPath(t,{parent:!0}).node;if(!r)throw new Pe.ErrnoError(44);var n=fe.basename(t),o=Pe.mayCreate(r,n);if(o)throw new Pe.ErrnoError(o);if(!r.node_ops.symlink)throw new Pe.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,o=fe.dirname(e),i=fe.dirname(t),s=fe.basename(e),a=fe.basename(t);if(r=Pe.lookupPath(e,{parent:!0}).node,n=Pe.lookupPath(t,{parent:!0}).node,!r||!n)throw new Pe.ErrnoError(44);if(r.mount!==n.mount)throw new Pe.ErrnoError(75);var l,c=Pe.lookupNode(r,s),d=me.relative(e,i);if("."!==d.charAt(0))throw new Pe.ErrnoError(28);if("."!==(d=me.relative(t,o)).charAt(0))throw new Pe.ErrnoError(55);try{l=Pe.lookupNode(n,a)}catch(e){}if(c!==l){var u=Pe.isDir(c.mode),h=Pe.mayDelete(r,s,u);if(h)throw new Pe.ErrnoError(h);if(h=l?Pe.mayDelete(n,a,u):Pe.mayCreate(n,a))throw new Pe.ErrnoError(h);if(!r.node_ops.rename)throw new Pe.ErrnoError(63);if(Pe.isMountpoint(c)||l&&Pe.isMountpoint(l))throw new Pe.ErrnoError(10);if(n!==r&&(h=Pe.nodePermissions(r,"w")))throw new Pe.ErrnoError(h);Pe.hashRemoveNode(c);try{r.node_ops.rename(c,n,a),c.parent=n}catch(e){throw e}finally{Pe.hashAddNode(c)}}},rmdir(e){var t=Pe.lookupPath(e,{parent:!0}).node,r=fe.basename(e),n=Pe.lookupNode(t,r),o=Pe.mayDelete(t,r,!0);if(o)throw new Pe.ErrnoError(o);if(!t.node_ops.rmdir)throw new Pe.ErrnoError(63);if(Pe.isMountpoint(n))throw new Pe.ErrnoError(10);t.node_ops.rmdir(t,r),Pe.destroyNode(n)},readdir(e){var t=Pe.lookupPath(e,{follow:!0}).node;return Pe.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Pe.lookupPath(e,{parent:!0}).node;if(!t)throw new Pe.ErrnoError(44);var r=fe.basename(e),n=Pe.lookupNode(t,r),o=Pe.mayDelete(t,r,!1);if(o)throw new Pe.ErrnoError(o);if(!t.node_ops.unlink)throw new Pe.ErrnoError(63);if(Pe.isMountpoint(n))throw new Pe.ErrnoError(10);t.node_ops.unlink(t,r),Pe.destroyNode(n)},readlink(e){var t=Pe.lookupPath(e).node;if(!t)throw new Pe.ErrnoError(44);if(!t.node_ops.readlink)throw new Pe.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var r=Pe.lookupPath(e,{follow:!t}).node;return Pe.checkOpExists(r.node_ops.getattr,63)(r)},fstat(e){var t=Pe.getStreamChecked(e),r=t.node,n=t.stream_ops.getattr,o=n?t:r;return n??=r.node_ops.getattr,Pe.checkOpExists(n,63),n(o)},lstat:e=>Pe.stat(e,!0),doChmod(e,t,r,n){Pe.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:n})},chmod(e,t,r){var n;n="string"==typeof e?Pe.lookupPath(e,{follow:!r}).node:e,Pe.doChmod(null,n,t,r)},lchmod(e,t){Pe.chmod(e,t,!0)},fchmod(e,t){var r=Pe.getStreamChecked(e);Pe.doChmod(r,r.node,t,!1)},doChown(e,t,r){Pe.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:r})},chown(e,t,r,n){var o;o="string"==typeof e?Pe.lookupPath(e,{follow:!n}).node:e,Pe.doChown(null,o,n)},lchown(e,t,r){Pe.chown(e,t,r,!0)},fchown(e,t,r){var n=Pe.getStreamChecked(e);Pe.doChown(n,n.node,!1)},doTruncate(e,t,r){if(Pe.isDir(t.mode))throw new Pe.ErrnoError(31);if(!Pe.isFile(t.mode))throw new Pe.ErrnoError(28);var n=Pe.nodePermissions(t,"w");if(n)throw new Pe.ErrnoError(n);Pe.doSetAttr(e,t,{size:r,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Pe.ErrnoError(28);var r;r="string"==typeof e?Pe.lookupPath(e,{follow:!0}).node:e,Pe.doTruncate(null,r,t)},ftruncate(e,t){var r=Pe.getStreamChecked(e);if(t<0||0==(2097155&r.flags))throw new Pe.ErrnoError(28);Pe.doTruncate(r,r.node,t)},utime(e,t,r){var n=Pe.lookupPath(e,{follow:!0}).node;Pe.checkOpExists(n.node_ops.setattr,63)(n,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Pe.ErrnoError(44);var n,o;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)n=e;else{o=e.endsWith("/");var i=Pe.lookupPath(e,{follow:!(131072&t),noent_okay:!0});n=i.node,e=i.path}var s=!1;if(64&t)if(n){if(128&t)throw new Pe.ErrnoError(20)}else{if(o)throw new Pe.ErrnoError(31);n=Pe.mknod(e,511|r,0),s=!0}if(!n)throw new Pe.ErrnoError(44);if(Pe.isChrdev(n.mode)&&(t&=-513),65536&t&&!Pe.isDir(n.mode))throw new Pe.ErrnoError(54);if(!s){var a=Pe.mayOpen(n,t);if(a)throw new Pe.ErrnoError(a)}512&t&&!s&&Pe.truncate(n,0),t&=-131713;var c=Pe.createStream({node:n,path:Pe.getPath(n),flags:t,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&Pe.chmod(n,511&r),!l.logReadFiles||1&t||e in Pe.readFiles||(Pe.readFiles[e]=1),c},close(e){if(Pe.isClosed(e))throw new Pe.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Pe.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Pe.isClosed(e))throw new Pe.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Pe.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Pe.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,n,o){if(n<0||o<0)throw new Pe.ErrnoError(28);if(Pe.isClosed(e))throw new Pe.ErrnoError(8);if(1==(2097155&e.flags))throw new Pe.ErrnoError(8);if(Pe.isDir(e.node.mode))throw new Pe.ErrnoError(31);if(!e.stream_ops.read)throw new Pe.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new Pe.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,t,r,n,o);return i||(e.position+=s),s},write(e,t,r,n,o,i){if(n<0||o<0)throw new Pe.ErrnoError(28);if(Pe.isClosed(e))throw new Pe.ErrnoError(8);if(0==(2097155&e.flags))throw new Pe.ErrnoError(8);if(Pe.isDir(e.node.mode))throw new Pe.ErrnoError(31);if(!e.stream_ops.write)throw new Pe.ErrnoError(28);e.seekable&&1024&e.flags&&Pe.llseek(e,0,2);var s=void 0!==o;if(s){if(!e.seekable)throw new Pe.ErrnoError(70)}else o=e.position;var a=e.stream_ops.write(e,t,r,n,o,i);return s||(e.position+=a),a},mmap(e,t,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new Pe.ErrnoError(2);if(1==(2097155&e.flags))throw new Pe.ErrnoError(2);if(!e.stream_ops.mmap)throw new Pe.ErrnoError(43);if(!t)throw new Pe.ErrnoError(28);return e.stream_ops.mmap(e,t,r,n,o)},msync:(e,t,r,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,o):0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Pe.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,n=Pe.open(e,t.flags),o=Pe.stat(e).size,i=new Uint8Array(o);return Pe.read(n,i,0,o,0),"utf8"===t.encoding?r=K(i):"binary"===t.encoding&&(r=i),Pe.close(n),r},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Pe.open(e,r.flags,r.mode);if("string"==typeof t){var o=new Uint8Array(se(t)+1),i=ae(t,o,0,o.length);Pe.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Pe.write(n,t,0,t.byteLength,void 0,r.canOwn)}Pe.close(n)},cwd:()=>Pe.currentPath,chdir(e){var t=Pe.lookupPath(e,{follow:!0});if(null===t.node)throw new Pe.ErrnoError(44);if(!Pe.isDir(t.node.mode))throw new Pe.ErrnoError(54);var r=Pe.nodePermissions(t.node,"x");if(r)throw new Pe.ErrnoError(r);Pe.currentPath=t.path},createDefaultDirectories(){Pe.mkdir("/tmp"),Pe.mkdir("/home"),Pe.mkdir("/home/web_user")},createDefaultDevices(){Pe.mkdir("/dev"),Pe.registerDevice(Pe.makedev(1,3),{read:()=>0,write:(e,t,r,n,o)=>n,llseek:()=>0}),Pe.mkdev("/dev/null",Pe.makedev(1,3)),ve.register(Pe.makedev(5,0),ve.default_tty_ops),ve.register(Pe.makedev(6,0),ve.default_tty1_ops),Pe.mkdev("/dev/tty",Pe.makedev(5,0)),Pe.mkdev("/dev/tty1",Pe.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(ge(e),t=e.byteLength),e[--t]);Pe.createDevice("/dev","random",r),Pe.createDevice("/dev","urandom",r),Pe.mkdir("/dev/shm"),Pe.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Pe.mkdir("/proc");var e=Pe.mkdir("/proc/self");Pe.mkdir("/proc/self/fd"),Pe.mount({mount(){var t=Pe.createNode(e,"fd",16895,73);return t.stream_ops={llseek:_e.stream_ops.llseek},t.node_ops={lookup(e,t){var r=+t,n=Pe.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:r+1};return o.parent=o,o},readdir:()=>Array.from(Pe.streams.entries()).filter((([e,t])=>t)).map((([e,t])=>e.toString()))},t}},{},"/proc/self/fd")},createStandardStreams(e,t,r){e?Pe.createDevice("/dev","stdin",e):Pe.symlink("/dev/tty","/dev/stdin"),t?Pe.createDevice("/dev","stdout",null,t):Pe.symlink("/dev/tty","/dev/stdout"),r?Pe.createDevice("/dev","stderr",null,r):Pe.symlink("/dev/tty1","/dev/stderr"),Pe.open("/dev/stdin",0),Pe.open("/dev/stdout",1),Pe.open("/dev/stderr",1)},staticInit(){Pe.nameTable=new Array(4096),Pe.mount(_e,{},"/"),Pe.createDefaultDirectories(),Pe.createDefaultDevices(),Pe.createSpecialDirectories(),Pe.filesystems={MEMFS:_e}},init(e,t,r){Pe.initialized=!0,e??=l.stdin,t??=l.stdout,r??=l.stderr,Pe.createStandardStreams(e,t,r)},quit(){for(var e of(Pe.initialized=!1,Pe.streams))e&&Pe.close(e)},findObject(e,t){var r=Pe.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(n=Pe.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 n=Pe.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=fe.basename(e),n=Pe.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Pe.getPath(e);for(var o=t.split("/").reverse();o.length;){var i=o.pop();if(i){var s=fe.join2(e,i);try{Pe.mkdir(s)}catch(e){if(20!=e.errno)throw e}e=s}}return s},createFile(e,t,r,n,o){var i=fe.join2("string"==typeof e?e:Pe.getPath(e),t),s=xe(n,o);return Pe.create(i,s)},createDataFile(e,t,r,n,o,i){var s=t;e&&(e="string"==typeof e?e:Pe.getPath(e),s=t?fe.join2(e,t):e);var a=xe(n,o),l=Pe.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}Pe.chmod(l,146|a);var h=Pe.open(l,577);Pe.write(h,r,0,r.length,0,i),Pe.close(h),Pe.chmod(l,a)}},createDevice(e,t,r,n){var o=fe.join2("string"==typeof e?e:Pe.getPath(e),t),i=xe(!!r,!!n);Pe.createDevice.major??=64;var s=Pe.makedev(Pe.createDevice.major++,0);return Pe.registerDevice(s,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,o,i){for(var s=0,a=0;a<o;a++){var l;try{l=r()}catch(e){throw new Pe.ErrnoError(29)}if(void 0===l&&0===s)throw new Pe.ErrnoError(6);if(null==l)break;s++,t[n+a]=l}return s&&(e.node.atime=Date.now()),s},write(e,t,r,o,i){for(var s=0;s<o;s++)try{n(t[r+s])}catch(e){throw new Pe.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),s}}),Pe.mkdev(o,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 Pe.ErrnoError(29)}},createLazyFile(e,t,r,n,o){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,n=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;o||(s=n);var a=this;a.setDataGetter((e=>{var t=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-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>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==s&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ye(o.responseText||"",!0)})(t,o)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!i&&n||(s=n=1,n=this.getter(0).length,s=n,k("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,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=Pe.createFile(e,t,i,n,o);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,n,o){var i=e.node.contents;if(o>=i.length)return 0;var s=Math.min(i.length-o,n);if(i.slice)for(var a=0;a<s;a++)t[r+a]=i[o+a];else for(a=0;a<s;a++)t[r+a]=i.get(o+a);return s}return Object.keys(s.stream_ops).forEach((e=>{var t=s.stream_ops[e];a[e]=(...e)=>(Pe.forceLoadFile(s),t(...e))})),a.read=(e,t,r,n,o)=>(Pe.forceLoadFile(s),l(e,t,r,n,o)),a.mmap=(e,t,r,n,o)=>{Pe.forceLoadFile(s);var i=ke(t);if(!i)throw new Pe.ErrnoError(48);return l(e,S,i,t,r),{ptr:i,allocated:!0}},s.stream_ops=a,s}},Te={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(fe.isAbs(t))return t;var n;if(n=-100===e?Pe.cwd():Te.getStreamFromFD(e).path,0==t.length){if(!r)throw new Pe.ErrnoError(44);return n}return n+"/"+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(),n=t.mtime.getTime(),o=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(n/1e3)),F[e+64>>2]=n%1e3*1e3*1e3,I[e+72>>3]=BigInt(Math.floor(o/1e3)),F[e+80>>2]=o%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,n,o){if(!Pe.isFile(t.node.mode))throw new Pe.ErrnoError(43);if(2&n)return 0;var i=x.slice(e,e+r);Pe.msync(t,i,o,r,n)},getStreamFromFD:e=>Pe.getStreamChecked(e),varargs:void 0,getStr:e=>Q(e)},Ae=()=>{var e=A[+Te.varargs>>2];return Te.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 n(t){var n=r(t);n.length!==e.length&&$e("Mismatched type converter count");for(var o=0;o<e.length;++o)Ve(e[o],n[o])}e.forEach((e=>Oe[e]=t));var o=new Array(t.length),i=[],s=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?o[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{o[t]=Be[e],++s===i.length&&n(o)})))})),0===i.length&&n(o)},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+=Re[x[r++]];return t},Ne=l.BindingError=class BindingError extends Error{constructor(e){super(e),this.name="BindingError"}},ze=e=>{throw new Ne(e)};function Ve(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||ze(`type "${n}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ze(`Cannot register type '${n}' twice`)}if(Be[e]=t,delete Oe[e],De.hasOwnProperty(e)){var o=De[e];delete De[e],o.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=>P[e>>1]:e=>T[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=>{ze(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 n=Je(e,t,r.baseClass);return null===n?null:r.downcast(n)},et={},tt={},rt=(e,t)=>(t=((e,t)=>{for(void 0===t&&ze("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),tt[t]),nt=(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 ot(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 n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?nt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):nt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,s=this.registeredClass.getActualType(t),a=et[s];if(!a)return o.call(this);i=this.isConst?a.constPointerType:a.pointerType;var l=Je(t,this.registeredClass,i.registeredClass);return null===l?o.call(this):this.isSmartPointer?nt(i.registeredClass.instancePrototype,{ptrType:i,ptr:l,smartPtrType:this,smartPtr:e}):nt(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 n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||ze(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},dt=(e,t,r)=>{l.hasOwnProperty(e)?((void 0===r||void 0!==l[e].overloadTable&&void 0!==l[e].overloadTable[r])&&ze(`Cannot register public name '${e}' twice`),ct(l,e,e),l[e].overloadTable.hasOwnProperty(r)&&ze(`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,n,o,i,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}var ht=(e,t,r)=>{for(;t!==r;)t.upcast||ze(`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&&ze(`null is not a valid ${this.name}`),0;t.$$||ze(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||ze(`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&&ze(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||ze(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||ze(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&ze(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ht(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ze("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ze(`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 o=t.clone();r=this.rawShare(r,Ot.toHandle((()=>o.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:ze("Unsupporting sharing policy")}return r}function gt(e,t){if(null===t)return this.isReference&&ze(`null is not a valid ${this.name}`),0;t.$$||ze(`Cannot pass "${We(t)}" as a ${this.name}`),t.$$.ptr||ze(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&ze(`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,n,o,i,s,a,l,c,d){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=d,o||void 0!==t.baseClass?this.toWireType=ft:n?(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&&ze(`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),Pt=e=>{var t=Wl(e),r=He(t);return Nl(t),r},Tt=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||Be[t]||(Oe[t]?Oe[t].forEach(e):(r.push(t),n[t]=!0))})),new xt(`${e}: `+r.map(Pt).join([", "]))},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(F[t+4*n>>2]);return r};function Ft(e,t,r,n,o,i){var s=t.length;s<2&&ze("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]=o,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 n=a?1:2;n<t.length;n++){var o=1===n?r:u[n-2];null!==t[n].destructorFunction&&t[n].destructorFunction(o)}if(c)return t[0].fromWireType(e)}(n(...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||ze("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(P[e>>1])}:function(e){return this.fromWireType(T[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&&ze(`${t} has unknown type ${Pt(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),Ht="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Nt=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&T[n];)++n;if((r=n<<1)-e>32&&Ht)return Ht.decode(x.subarray(e,r));for(var i="",s=0;!(s>=t/2);++s){var a=P[e+2*s>>1];if(0==a)break;i+=String.fromCharCode(a)}return i},zt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,o=(r-=2)<2*e.length?r/2:e.length,i=0;i<o;++i){var s=e.charCodeAt(i);P[t>>1]=s,t+=2}return P[t>>1]=0,t-n},Vt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=A[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Xt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+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>o)break}return A[t>>2]=0,t-n},Yt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},Kt=0,Qt=(e,t,r)=>{var n=[],o=e.toWireType(n,r);return n.length&&(F[t>>2]=Ot.toHandle(n)),o},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,nr=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),or=[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:or)[e.getMonth()]+e.getDate()-1},ar={},lr=e=>{if(e instanceof ExitStatus||"unwind"==e)return E;y(1,e)},cr=()=>ne||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,n){var o=new Blob([e],{type:br.getMimetype(t)});o.size!==e.length&&(o=new Blob([new Uint8Array(e).buffer],{type:br.getMimetype(t)}));var i=URL.createObjectURL(o),s=new Image;s.onload=()=>{var n=document.createElement("canvas");n.width=s.width,n.height=s.height,n.getContext("2d").drawImage(s,0,0),br.preloadedImages[t]=n,URL.revokeObjectURL(i),r?.(e)},s.onerror=e=>{_(`Image ${i} could not be decoded`),n?.()},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,n){var o=!1;function i(n){o||(o=!0,br.preloadedAudios[t]=n,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){o||(_(`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="",n=0,o=0,i=0;i<e.length;i++)for(n=n<<8|e[i],o+=8;o>=6;){var s=n>>o-6&63;o-=6,r+=t[s]}return 2==o?(r+=t[(3&n)<<4],r+="=="):4==o&&(r+=t[(15&n)<<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",n,!1),document.addEventListener("mozpointerlockchange",n,!1),document.addEventListener("webkitpointerlockchange",n,!1),document.addEventListener("mspointerlockchange",n,!1),l.elementPointerLock&&r.addEventListener("click",(e=>{!br.pointerLock&&br.getCanvas().requestPointerLock&&(br.getCanvas().requestPointerLock(),e.preventDefault())}),!1))}function n(){var e=br.getCanvas();br.pointerLock=document.pointerLockElement===e||document.mozPointerLockElement===e||document.webkitPointerLockElement===e||document.msPointerLockElement===e}},createContext(e,t,r,n){if(t&&l.ctx&&e==br.getCanvas())return l.ctx;var o,i;if(t){var s={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(n)for(var a in n)s[a]=n[a];void 0!==vr&&(i=vr.createContext(e,s))&&(o=vr.getContext(i).GLctx)}else o=e.getContext("2d");return o?(r&&(l.ctx=o,t&&vr.makeContextCurrent(i),br.useWebGL=t,br.moduleContextCreatedCallbacks.forEach((e=>e())),br.init()),o):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 n(){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",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var o=document.createElement("div");r.parentNode.insertBefore(o,r),o.appendChild(r),o.requestFullscreen=o.requestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen||(o.webkitRequestFullscreen?()=>o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(o.webkitRequestFullScreen?()=>o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),o.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(),n=r.getBoundingClientRect(),o=void 0!==window.scrollX?window.scrollX:window.pageXOffset,i=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(o+n.left),a=t-(i+n.top);return{x:s*=r.width/n.width,y:a*=r.height/n.height}},setMouseCoords(e,t){const{x:r,y:n}=br.calculateMouseCoords(e,t);br.mouseMovementX=r-br.mouseX,br.mouseMovementY=n-br.mouseY,br.mouseX=r,br.mouseY=n},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 n=br.touches[t.identifier];n||=r,br.lastTouches[t.identifier]=n,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 n=br.getCanvas();br.updateCanvasDimensions(n,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 n=t,o=r;if(l.forcedAspectRatio>0&&(n/o<l.forcedAspectRatio?n=Math.round(o*l.forcedAspectRatio):o=Math.round(n/l.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/n,screen.height/o);n=Math.round(n*i),o=Math.round(o*i)}br.resizeCanvas?(e.width!=n&&(e.width=n),e.height!=o&&(e.height=o),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&&(n!=t||o!=r?(e.style.setProperty("width",n+"px","important"),e.style.setProperty("height",o+"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,n,o){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&&n||o?(o&&(A[o>>2]=1),r&&n>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,n)=>{for(var o=0;o<e;o++){var i=Mt[r](),s=i&&vr.getNewId(n);i?(i.name=s,n[s]=i):vr.recordError(1282),A[t+4*o>>2]=s}},getSource:(e,t,r,n)=>{for(var o="",i=0;i<t;++i){var s=n?F[n+4*i>>2]:void 0;o+=Q(F[r+4*i>>2],s)}return o},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n: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),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),vr.contexts[r]=n,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 n=((e,t)=>{var r;for(wr.length=0;r=x[e++];){var n=105!=r;t+=(n&=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+=n?8:4}return wr})(t,r);return $l[e](...n)},_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),Pr=(e,t,r)=>{Mt.bindAttribLocation(vr.programs[e],t,Q(r))},Tr=(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,n,o)=>{Mt.bindBufferRange(e,t,vr.buffers[r],n,o)},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,n)=>Mt.blendColor(e,t,r,n),Ur=e=>Mt.blendEquation(e),Wr=(e,t)=>Mt.blendEquationSeparate(e,t),Hr=(e,t)=>Mt.blendFunc(e,t),Nr=(e,t,r,n)=>Mt.blendFuncSeparate(e,t,r,n),zr=(e,t,r,n,o,i,s,a,l,c)=>Mt.blitFramebuffer(e,t,r,n,o,i,s,a,l,c),Vr=(e,t,r,n)=>{vr.currentContext.version>=2?r&&t?Mt.bufferData(e,x,n,r,t):Mt.bufferData(e,t,n):Mt.bufferData(e,r?x.subarray(r,r+t):t,n)},Gr=(e,t,r,n)=>{vr.currentContext.version>=2?r&&Mt.bufferSubData(e,t,x,n,r):Mt.bufferSubData(e,t,x.subarray(n,n+r))},Xr=e=>Mt.checkFramebufferStatus(e),Yr=e=>Mt.clear(e),Kr=(e,t,r,n)=>Mt.clearBufferfi(e,t,r,n),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)},en=(e,t,r,n)=>Mt.clearColor(e,t,r,n),tn=e=>Mt.clearDepth(e),rn=e=>Mt.clearStencil(e),nn=(e,t,r)=>(r=Number(r),Mt.clientWaitSync(vr.syncs[e],t,r)),on=(e,t)=>{Mt.extClipControl.clipControlEXT(e,t)},sn=(e,t,r,n)=>{Mt.colorMask(!!e,!!t,!!r,!!n)},an=e=>{Mt.compileShader(vr.shaders[e])},ln=(e,t,r,n,o,i,s,a)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!s?void Mt.compressedTexImage2D(e,t,r,n,o,i,s,a):void Mt.compressedTexImage2D(e,t,r,n,o,i,x,a,s);Mt.compressedTexImage2D(e,t,r,n,o,i,x.subarray(a,a+s))},cn=(e,t,r,n,o,i,s,a,l)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexImage3D(e,t,r,n,o,i,s,a,l):Mt.compressedTexImage3D(e,t,r,n,o,i,s,x,l,a)},dn=(e,t,r,n,o,i,s,a,l)=>{if(vr.currentContext.version>=2)return Mt.currentPixelUnpackBufferBinding||!a?void Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,a,l):void Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,x,l,a);Mt.compressedTexSubImage2D(e,t,r,n,o,i,s,x.subarray(l,l+a))},un=(e,t,r,n,o,i,s,a,l,c,d)=>{Mt.currentPixelUnpackBufferBinding?Mt.compressedTexSubImage3D(e,t,r,n,o,i,s,a,l,c,d):Mt.compressedTexSubImage3D(e,t,r,n,o,i,s,a,l,x,d,c)},hn=(e,t,r,n,o)=>Mt.copyBufferSubData(e,t,r,n,o),pn=(e,t,r,n,o,i,s,a)=>Mt.copyTexImage2D(e,t,r,n,o,i,s,a),fn=(e,t,r,n,o,i,s,a)=>Mt.copyTexSubImage2D(e,t,r,n,o,i,s,a),gn=(e,t,r,n,o,i,s,a,l)=>Mt.copyTexSubImage3D(e,t,r,n,o,i,s,a,l),mn=()=>{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},bn=e=>{var t=vr.getNewId(vr.shaders);return vr.shaders[t]=Mt.createShader(e),t},yn=e=>Mt.cullFace(e),vn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.buffers[n];o&&(Mt.deleteBuffer(o),o.name=0,vr.buffers[n]=null,n==Mt.currentPixelPackBufferBinding&&(Mt.currentPixelPackBufferBinding=0),n==Mt.currentPixelUnpackBufferBinding&&(Mt.currentPixelUnpackBufferBinding=0))}},wn=(e,t)=>{for(var r=0;r<e;++r){var n=A[t+4*r>>2],o=vr.framebuffers[n];o&&(Mt.deleteFramebuffer(o),o.name=0,vr.framebuffers[n]=null)}},kn=e=>{if(e){var t=vr.programs[e];t?(Mt.deleteProgram(t),t.name=0,vr.programs[e]=null):vr.recordError(1281)}},_n=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.queries[n];o&&(Mt.deleteQuery(o),vr.queries[n]=null)}},Cn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.queries[n];o&&(Mt.disjointTimerQueryExt.deleteQueryEXT(o),vr.queries[n]=null)}},En=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.renderbuffers[n];o&&(Mt.deleteRenderbuffer(o),o.name=0,vr.renderbuffers[n]=null)}},Sn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.samplers[n];o&&(Mt.deleteSampler(o),o.name=0,vr.samplers[n]=null)}},xn=e=>{if(e){var t=vr.shaders[e];t?(Mt.deleteShader(t),vr.shaders[e]=null):vr.recordError(1281)}},Pn=e=>{if(e){var t=vr.syncs[e];t?(Mt.deleteSync(t),t.name=0,vr.syncs[e]=null):vr.recordError(1281)}},Tn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.textures[n];o&&(Mt.deleteTexture(o),o.name=0,vr.textures[n]=null)}},An=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2],o=vr.transformFeedbacks[n];o&&(Mt.deleteTransformFeedback(o),o.name=0,vr.transformFeedbacks[n]=null)}},Fn=(e,t)=>{for(var r=0;r<e;r++){var n=A[t+4*r>>2];Mt.deleteVertexArray(vr.vaos[n]),vr.vaos[n]=null}},Mn=Fn,In=Fn,Ln=In,Rn=e=>Mt.depthFunc(e),Dn=e=>{Mt.depthMask(!!e)},Bn=(e,t)=>Mt.depthRange(e,t),On=(e,t)=>{Mt.detachShader(vr.programs[e],vr.shaders[t])},jn=e=>Mt.disable(e),$n=e=>{Mt.disableVertexAttribArray(e)},qn=(e,t,r)=>{Mt.drawArrays(e,t,r)},Un=(e,t,r,n)=>{Mt.drawArraysInstanced(e,t,r,n)},Wn=Un,Hn=Un,Nn=Hn,zn=Un,Vn=zn,Gn=(e,t,r,n,o)=>{Mt.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,o)},Xn=Un,Yn=Xn,Kn=Un,Qn=Kn,Zn=[],Jn=(e,t)=>{for(var r=Zn[e],n=0;n<e;n++)r[n]=A[t+4*n>>2];Mt.drawBuffers(r)},eo=Jn,to=Jn,ro=to,no=Jn,oo=no,io=(e,t,r,n)=>{Mt.drawElements(e,t,r,n)},so=io,ao=(e,t,r,n,o)=>{Mt.drawElementsInstanced(e,t,r,n,o)},lo=ao,co=ao,uo=co,ho=ao,po=ho,fo=(e,t,r,n,o,i,s)=>{Mt.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,o,i,s)},go=ao,mo=go,bo=ao,yo=bo,vo=(e,t,r,n,o,i)=>{io(e,n,o,i)},wo=e=>Mt.enable(e),ko=e=>{Mt.enableVertexAttribArray(e)},_o=e=>Mt.endQuery(e),Co=e=>{Mt.disjointTimerQueryExt.endQueryEXT(e)},Eo=()=>Mt.endTransformFeedback(),So=(e,t)=>{var r=Mt.fenceSync(e,t);if(r){var n=vr.getNewId(vr.syncs);return r.name=n,vr.syncs[n]=r,n}return 0},xo=()=>Mt.finish(),Po=()=>Mt.flush(),To=(e,t,r,n)=>{Mt.framebufferRenderbuffer(e,t,r,vr.renderbuffers[n])},Ao=(e,t,r,n,o)=>{Mt.framebufferTexture2D(e,t,r,vr.textures[n],o)},Fo=(e,t,r,n,o)=>{Mt.framebufferTextureLayer(e,t,vr.textures[r],n,o)},Mo=e=>Mt.frontFace(e),Io=(e,t)=>{vr.genObject(e,t,"createBuffer",vr.buffers)},Lo=(e,t)=>{vr.genObject(e,t,"createFramebuffer",vr.framebuffers)},Ro=(e,t)=>{vr.genObject(e,t,"createQuery",vr.queries)},Do=(e,t)=>{for(var r=0;r<e;r++){var n=Mt.disjointTimerQueryExt.createQueryEXT();if(!n){for(vr.recordError(1282);r<e;)A[t+4*r++>>2]=0;return}var o=vr.getNewId(vr.queries);n.name=o,vr.queries[o]=n,A[t+4*r>>2]=o}},Bo=(e,t)=>{vr.genObject(e,t,"createRenderbuffer",vr.renderbuffers)},Oo=(e,t)=>{vr.genObject(e,t,"createSampler",vr.samplers)},jo=(e,t)=>{vr.genObject(e,t,"createTexture",vr.textures)},$o=(e,t)=>{vr.genObject(e,t,"createTransformFeedback",vr.transformFeedbacks)},qo=(e,t)=>{vr.genObject(e,t,"createVertexArray",vr.vaos)},Uo=qo,Wo=qo,Ho=Wo,No=e=>Mt.generateMipmap(e),zo=(e,t,r,n,o,i,s,a)=>{t=vr.programs[t];var l=Mt[e](t,r);if(l){var c=a&&le(l.name,a,n);o&&(A[o>>2]=c),i&&(A[i>>2]=l.size),s&&(A[s>>2]=l.type)}},Vo=(e,t,r,n,o,i,s)=>zo("getActiveAttrib",e,t,r,n,o,i,s),Go=(e,t,r,n,o,i,s)=>zo("getActiveUniform",e,t,r,n,o,i,s),Xo=(e,t,r,n,o)=>{e=vr.programs[e];var i=Mt.getActiveUniformBlockName(e,t);if(i)if(o&&r>0){var s=le(i,o,r);n&&(A[n>>2]=s)}else n&&(A[n>>2]=0)},Yo=(e,t,r,n)=>{if(n)if(e=vr.programs[e],35393!=r){var o=Mt.getActiveUniformBlockParameter(e,t,r);if(null!==o)if(35395==r)for(var i=0;i<o.length;i++)A[n+4*i>>2]=o[i];else A[n>>2]=o}else{var s=Mt.getActiveUniformBlockName(e,t);A[n>>2]=s.length+1}else vr.recordError(1281)},Ko=(e,t,r,n,o)=>{if(o)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,n);if(a){var l=a.length;for(s=0;s<l;s++)A[o+4*s>>2]=a[s]}}else vr.recordError(1281)},Qo=(e,t,r,n)=>{var o=Mt.getAttachedShaders(vr.programs[e]),i=o.length;i>t&&(i=t),A[r>>2]=i;for(var s=0;s<i;++s){var a=vr.shaders.indexOf(o[s]);A[n+4*s>>2]=a}},Zo=(e,t)=>Mt.getAttribLocation(vr.programs[e],Q(t)),Jo=(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 n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&vr.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var o=Mt.getParameter(34467);n=o?o.length:0;break;case 33309:if(vr.currentContext.version<2)return void vr.recordError(1282);n=ei().length;break;case 33307:case 33308:if(vr.currentContext.version<2)return void vr.recordError(1280);n=33307==e?3:0}if(void 0===n){var i=Mt.getParameter(e);switch(typeof i){case"number":n=i;break;case"boolean":n=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:n=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{n=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:Jo(t,n);break;case 0:A[t>>2]=n;break;case 2:M[t>>2]=n;break;case 4:S[t]=n?1:0}}else vr.recordError(1281)},ri=(e,t)=>ti(e,t,4),ni=(e,t,r)=>{r?Jo(r,Mt.getBufferParameter(e,t)):vr.recordError(1281)},oi=(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,n)=>{var o=Mt.getFramebufferAttachmentParameter(e,t,r);(o instanceof WebGLRenderbuffer||o instanceof WebGLTexture)&&(o=0|o.name),A[n>>2]=o},ci=(e,t,r,n)=>{if(r){var o,i=Mt.getIndexedParameter(e,t);switch(typeof i){case"boolean":o=i?1:0;break;case"number":o=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:o=0;break;default:return void vr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void vr.recordError(1280);o=0|i.name}break;default:return void vr.recordError(1280)}switch(n){case 1:Jo(r,o);break;case 0:A[r>>2]=o;break;case 2:M[r>>2]=o;break;case 4:S[r]=o?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+n}}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,n,o)=>{if(n<0)vr.recordError(1281);else if(o){var i=Mt.getInternalformatParameter(e,t,r);if(null!==i)for(var s=0;s<i.length&&s<n;++s)A[o+4*s>>2]=i[s]}else vr.recordError(1281)},gi=(e,t,r,n,o)=>{vr.recordError(1282)},mi=(e,t,r,n)=>{var o=Mt.getProgramInfoLog(vr.programs[e]);null===o&&(o="(unknown error)");var i=t>0&&n?le(o,n,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 n=Mt.getProgramInfoLog(e);null===n&&(n="(unknown error)"),A[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var o=Mt.getProgramParameter(e,35718),i=0;i<o;++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 n,o=vr.queries[e];n=vr.currentContext.version<2?Mt.disjointTimerQueryExt.getQueryObjectEXT(o,t):Mt.getQueryParameter(o,t),Jo(r,"boolean"==typeof n?n?1:0:n)}else vr.recordError(1281)},vi=yi,wi=(e,t,r)=>{if(r){var n,o=vr.queries[e],i=Mt.disjointTimerQueryExt.getQueryObjectEXT(o,t);n="boolean"==typeof i?i?1:0:i,A[r>>2]=n}else vr.recordError(1281)},ki=wi,_i=yi,Ci=_i,Ei=(e,t,r)=>{if(r){var n,o=vr.queries[e],i=Mt.getQueryParameter(o,t);n="boolean"==typeof i?i?1:0:i,A[r>>2]=n}else vr.recordError(1281)},Si=wi,xi=Si,Pi=(e,t,r)=>{r?A[r>>2]=Mt.getQuery(e,t):vr.recordError(1281)},Ti=(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,n)=>{var o=Mt.getShaderInfoLog(vr.shaders[e]);null===o&&(o="(unknown error)");var i=t>0&&n?le(o,n,t):0;r&&(A[r>>2]=i)},Li=(e,t,r,n)=>{var o=Mt.getShaderPrecisionFormat(e,t);A[r>>2]=o.rangeMin,A[r+4>>2]=o.rangeMax,A[n>>2]=o.precision},Ri=(e,t,r,n)=>{var o=Mt.getShaderSource(vr.shaders[e]);if(o){var i=t>0&&n?le(o,n,t):0;r&&(A[r>>2]=i)}},Di=(e,t,r)=>{if(r)if(35716==t){var n=Mt.getShaderInfoLog(vr.shaders[e]);null===n&&(n="(unknown error)");var o=n?n.length+1:0;A[r>>2]=o}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 n=Mt.getParameter(7938),o=`OpenGL ES 2.0 (${n})`;vr.currentContext.version>=2&&(o=`OpenGL ES 3.0 (${n})`),t=ce(o);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 n=ei().map(ce);return r=vr.stringiCache[e]=n,t<0||t>=r.length?(vr.recordError(1281),0):r[t]}return vr.recordError(1280),0},ji=(e,t,r,n,o)=>{if(r<0)vr.recordError(1281);else if(o){var i=Mt.getSyncParameter(vr.syncs[e],t);null!==i&&(A[o>>2]=i,n&&(A[n>>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,n,o,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);n&&(A[n>>2]=l)}else n&&(A[n>>2]=0);o&&(A[o>>2]=a.size),i&&(A[i>>2]=a.type)}},Wi=(e,t)=>Mt.getUniformBlockIndex(vr.programs[e],Q(t)),Hi=(e,t,r,n)=>{if(n)if(t>0&&(0==r||0==n))vr.recordError(1281);else{e=vr.programs[e];for(var o=[],i=0;i<t;i++)o.push(Q(A[r+4*i>>2]));var s=Mt.getUniformIndices(e,o);if(s){var a=s.length;for(i=0;i<a;i++)A[n+4*i>>2]=s[i]}}else vr.recordError(1281)},Ni=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),zi=e=>{var t,r,n=e.uniformLocsById,o=e.uniformSizeAndIdsByName;if(!n){e.uniformLocsById=n={},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,o[d]=[l,u],r=0;r<l;++r)n[u]=r,e.uniformArrayNamesById[u++]=d}}},Vi=(e,t)=>{if(t=Q(t),e=vr.programs[e]){zi(e);var r=e.uniformLocsById,n=0,o=t,i=Ni(t);i>0&&(a=t.slice(i+1),n=parseInt(a)>>>0,o=t.slice(0,i));var s=e.uniformSizeAndIdsByName[o];if(s&&n<s[0]&&(r[n+=s[1]]=r[n]||Mt.getUniformLocation(e,t)))return n}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,n)=>{if(r){e=vr.programs[e],zi(e);var o=Mt.getUniform(e,Gi(t));if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:A[r>>2]=o;break;case 2:M[r>>2]=o}else for(var i=0;i<o.length;i++)switch(n){case 0:A[r+4*i>>2]=o[i];break;case 2:M[r+4*i>>2]=o[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,n)=>{if(r){var o=Mt.getVertexAttrib(e,t);if(34975==t)A[r>>2]=o&&o.name;else if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:A[r>>2]=o;break;case 2:M[r>>2]=o;break;case 5:A[r>>2]=Math.fround(o)}else for(var i=0;i<o.length;i++)switch(n){case 0:A[r+4*i>>2]=o[i];break;case 2:M[r+4*i>>2]=o[i];break;case 5:A[r+4*i>>2]=Math.fround(o[i])}}else vr.recordError(1281)},Ji=(e,t,r)=>{Zi(e,t,r,0)},es=Ji,ts=Ji,rs=ts,ns=(e,t,r)=>{r?A[r>>2]=Mt.getVertexAttribOffset(e,t):vr.recordError(1281)},os=(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 n=Zn[t],o=0;o<t;o++)n[o]=A[r+4*o>>2];Mt.invalidateFramebuffer(e,n)},ls=(e,t,r,n,o,i,s)=>{for(var a=Zn[t],l=0;l<t;l++)a[l]=A[r+4*l>>2];Mt.invalidateSubFramebuffer(e,a,n,o,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={}},Ps=(e,t,r,n,o,i)=>{Mt.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,A,t>>2,A,r>>2,A,n>>2,F,o>>2,i)},Ts=(e,t,r,n,o,i,s,a)=>{Mt.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,A,t>>2,r,A,n>>2,A,o>>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,n)=>{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?P:4==e?A:6==e?M:5==e||28922==e||28520==e||30779==e||30782==e?F:T,$s=(e,t)=>e>>>31-Math.clz32(t.BYTES_PER_ELEMENT),qs=(e,t,r,n,o,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 n,o,i=(vr.unpackRowLength||e)*r;return t*(n=i,o=vr.unpackAlignment,n+o-1&-o)})(r,n,a);return s.subarray($s(o,s),$s(o+l,s))},Us=(e,t,r,n,o,i,s)=>{if(vr.currentContext.version>=2){if(Mt.currentPixelPackBufferBinding)return void Mt.readPixels(e,t,r,n,o,i,s);var a=js(i),l=$s(s,a);Mt.readPixels(e,t,r,n,o,i,a,l)}else{var c=qs(i,o,r,n,s);c?Mt.readPixels(e,t,r,n,o,i,c):vr.recordError(1280)}},Ws=()=>{},Hs=(e,t,r,n)=>Mt.renderbufferStorage(e,t,r,n),Ns=(e,t,r,n,o)=>Mt.renderbufferStorageMultisample(e,t,r,n,o),zs=()=>Mt.resumeTransformFeedback(),Vs=(e,t)=>{Mt.sampleCoverage(e,!!t)},Gs=(e,t,r)=>{Mt.samplerParameterf(vr.samplers[e],t,r)},Xs=(e,t,r)=>{var n=M[r>>2];Mt.samplerParameterf(vr.samplers[e],t,n)},Ys=(e,t,r)=>{Mt.samplerParameteri(vr.samplers[e],t,r)},Ks=(e,t,r)=>{var n=A[r>>2];Mt.samplerParameteri(vr.samplers[e],t,n)},Qs=(e,t,r,n)=>Mt.scissor(e,t,r,n),Zs=(e,t,r,n,o)=>{vr.recordError(1280)},Js=(e,t,r,n)=>{var o=vr.getSource(e,t,r,n);if(vr.currentContext.version>=2&&o.includes("#version 100")){var i="";(o=(o=o.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",o=o.replace(/gl_FragColor/g,"GL_FragColor")),o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.includes("attribute")?(o=o.replace(/attribute/g,"in")).replace(/varying/g,"out"):o.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],o)},ea=(e,t,r)=>Mt.stencilFunc(e,t,r),ta=(e,t,r,n)=>Mt.stencilFuncSeparate(e,t,r,n),ra=e=>Mt.stencilMask(e),na=(e,t)=>Mt.stencilMaskSeparate(e,t),oa=(e,t,r)=>Mt.stencilOp(e,t,r),ia=(e,t,r,n)=>Mt.stencilOpSeparate(e,t,r,n),sa=(e,t,r,n,o,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,n,o,i,s,a,l);if(l){var c=js(a),d=$s(l,c);return void Mt.texImage2D(e,t,r,n,o,i,s,a,c,d)}}var u=l?qs(a,s,n,o,l):null;Mt.texImage2D(e,t,r,n,o,i,s,a,u)},aa=(e,t,r,n,o,i,s,a,l,c)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texImage3D(e,t,r,n,o,i,s,a,l,c);else if(c){var d=js(l);Mt.texImage3D(e,t,r,n,o,i,s,a,l,d,$s(c,d))}else Mt.texImage3D(e,t,r,n,o,i,s,a,l,null)},la=(e,t,r)=>Mt.texParameterf(e,t,r),ca=(e,t,r)=>{var n=M[r>>2];Mt.texParameterf(e,t,n)},da=(e,t,r)=>Mt.texParameteri(e,t,r),ua=(e,t,r)=>{var n=A[r>>2];Mt.texParameteri(e,t,n)},ha=(e,t,r,n,o)=>Mt.texStorage2D(e,t,r,n,o),pa=(e,t,r,n,o,i)=>Mt.texStorage3D(e,t,r,n,o,i),fa=(e,t,r,n,o,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,n,o,i,s,a,l);if(l){var c=js(a);return void Mt.texSubImage2D(e,t,r,n,o,i,s,a,c,$s(l,c))}}var d=l?qs(a,s,o,i,l):null;Mt.texSubImage2D(e,t,r,n,o,i,s,a,d)},ga=(e,t,r,n,o,i,s,a,l,c,d)=>{if(Mt.currentPixelUnpackBufferBinding)Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,d);else if(d){var u=js(c);Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,u,$s(d,u))}else Mt.texSubImage3D(e,t,r,n,o,i,s,a,l,c,null)},ma=(e,t,r,n)=>{e=vr.programs[e];for(var o=[],i=0;i<t;i++)o.push(Q(A[r+4*i>>2]));Mt.transformFeedbackVaryings(e,o,n)},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 n=ya[t],o=0;o<t;++o)n[o]=M[r+4*o>>2];else n=M.subarray(r>>2,r+4*t>>2);Mt.uniform1fv(Gi(e),n)}},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 n=ka[t],o=0;o<t;++o)n[o]=A[r+4*o>>2];else n=A.subarray(r>>2,r+4*t>>2);Mt.uniform1iv(Gi(e),n)}},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 n=ya[t*=2],o=0;o<t;o+=2)n[o]=M[r+4*o>>2],n[o+1]=M[r+(4*o+4)>>2];else n=M.subarray(r>>2,r+8*t>>2);Mt.uniform2fv(Gi(e),n)}},Pa=(e,t,r)=>{Mt.uniform2i(Gi(e),t,r)},Ta=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform2iv(Gi(e),A,r>>2,2*t);else{if(t<=144)for(var n=ka[t*=2],o=0;o<t;o+=2)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2];else n=A.subarray(r>>2,r+8*t>>2);Mt.uniform2iv(Gi(e),n)}},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,n)=>{Mt.uniform3f(Gi(e),t,r,n)},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 n=ya[t*=3],o=0;o<t;o+=3)n[o]=M[r+4*o>>2],n[o+1]=M[r+(4*o+4)>>2],n[o+2]=M[r+(4*o+8)>>2];else n=M.subarray(r>>2,r+12*t>>2);Mt.uniform3fv(Gi(e),n)}},La=(e,t,r,n)=>{Mt.uniform3i(Gi(e),t,r,n)},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 n=ka[t*=3],o=0;o<t;o+=3)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2],n[o+2]=A[r+(4*o+8)>>2];else n=A.subarray(r>>2,r+12*t>>2);Mt.uniform3iv(Gi(e),n)}},Da=(e,t,r,n)=>{Mt.uniform3ui(Gi(e),t,r,n)},Ba=(e,t,r)=>{t&&Mt.uniform3uiv(Gi(e),F,r>>2,3*t)},Oa=(e,t,r,n,o)=>{Mt.uniform4f(Gi(e),t,r,n,o)},ja=(e,t,r)=>{if(vr.currentContext.version>=2)t&&Mt.uniform4fv(Gi(e),M,r>>2,4*t);else{if(t<=72){var n=ya[4*t],o=M;r>>=2,t*=4;for(var i=0;i<t;i+=4){var s=r+i;n[i]=o[s],n[i+1]=o[s+1],n[i+2]=o[s+2],n[i+3]=o[s+3]}}else n=M.subarray(r>>2,r+16*t>>2);Mt.uniform4fv(Gi(e),n)}},$a=(e,t,r,n,o)=>{Mt.uniform4i(Gi(e),t,r,n,o)},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 n=ka[t*=4],o=0;o<t;o+=4)n[o]=A[r+4*o>>2],n[o+1]=A[r+(4*o+4)>>2],n[o+2]=A[r+(4*o+8)>>2],n[o+3]=A[r+(4*o+12)>>2];else n=A.subarray(r>>2,r+16*t>>2);Mt.uniform4iv(Gi(e),n)}},Ua=(e,t,r,n,o)=>{Mt.uniform4ui(Gi(e),t,r,n,o)},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,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix2fv(Gi(e),!!r,M,n>>2,4*t);else{if(t<=72)for(var o=ya[t*=4],i=0;i<t;i+=4)o[i]=M[n+4*i>>2],o[i+1]=M[n+(4*i+4)>>2],o[i+2]=M[n+(4*i+8)>>2],o[i+3]=M[n+(4*i+12)>>2];else o=M.subarray(n>>2,n+16*t>>2);Mt.uniformMatrix2fv(Gi(e),!!r,o)}},za=(e,t,r,n)=>{t&&Mt.uniformMatrix2x3fv(Gi(e),!!r,M,n>>2,6*t)},Va=(e,t,r,n)=>{t&&Mt.uniformMatrix2x4fv(Gi(e),!!r,M,n>>2,8*t)},Ga=(e,t,r,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix3fv(Gi(e),!!r,M,n>>2,9*t);else{if(t<=32)for(var o=ya[t*=9],i=0;i<t;i+=9)o[i]=M[n+4*i>>2],o[i+1]=M[n+(4*i+4)>>2],o[i+2]=M[n+(4*i+8)>>2],o[i+3]=M[n+(4*i+12)>>2],o[i+4]=M[n+(4*i+16)>>2],o[i+5]=M[n+(4*i+20)>>2],o[i+6]=M[n+(4*i+24)>>2],o[i+7]=M[n+(4*i+28)>>2],o[i+8]=M[n+(4*i+32)>>2];else o=M.subarray(n>>2,n+36*t>>2);Mt.uniformMatrix3fv(Gi(e),!!r,o)}},Xa=(e,t,r,n)=>{t&&Mt.uniformMatrix3x2fv(Gi(e),!!r,M,n>>2,6*t)},Ya=(e,t,r,n)=>{t&&Mt.uniformMatrix3x4fv(Gi(e),!!r,M,n>>2,12*t)},Ka=(e,t,r,n)=>{if(vr.currentContext.version>=2)t&&Mt.uniformMatrix4fv(Gi(e),!!r,M,n>>2,16*t);else{if(t<=18){var o=ya[16*t],i=M;n>>=2,t*=16;for(var s=0;s<t;s+=16){var a=n+s;o[s]=i[a],o[s+1]=i[a+1],o[s+2]=i[a+2],o[s+3]=i[a+3],o[s+4]=i[a+4],o[s+5]=i[a+5],o[s+6]=i[a+6],o[s+7]=i[a+7],o[s+8]=i[a+8],o[s+9]=i[a+9],o[s+10]=i[a+10],o[s+11]=i[a+11],o[s+12]=i[a+12],o[s+13]=i[a+13],o[s+14]=i[a+14],o[s+15]=i[a+15]}}else o=M.subarray(n>>2,n+64*t>>2);Mt.uniformMatrix4fv(Gi(e),!!r,o)}},Qa=(e,t,r,n)=>{t&&Mt.uniformMatrix4x2fv(Gi(e),!!r,M,n>>2,8*t)},Za=(e,t,r,n)=>{t&&Mt.uniformMatrix4x3fv(Gi(e),!!r,M,n>>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])},nl=(e,t,r)=>Mt.vertexAttrib2f(e,t,r),ol=(e,t)=>{Mt.vertexAttrib2f(e,M[t>>2],M[t+4>>2])},il=(e,t,r,n)=>Mt.vertexAttrib3f(e,t,r,n),sl=(e,t)=>{Mt.vertexAttrib3f(e,M[t>>2],M[t+4>>2],M[t+8>>2])},al=(e,t,r,n,o)=>Mt.vertexAttrib4f(e,t,r,n,o),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,n,o)=>Mt.vertexAttribI4i(e,t,r,n,o),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,n,o)=>Mt.vertexAttribI4ui(e,t,r,n,o),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,n,o)=>{Mt.vertexAttribIPointer(e,t,r,n,o)},wl=(e,t,r,n,o,i)=>{Mt.vertexAttribPointer(e,t,r,!!n,o,i)},kl=(e,t,r,n)=>Mt.viewport(e,t,r,n),_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)},Pl=(e,t)=>{var r=t>>2,n=A[r+2],o={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[n],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?o.explicitSwapControl?0:vr.createContext(i,o):0},Tl={},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 Tl)void 0===Tl[t]?delete e[t]:e[t]=Tl[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);Al.strings=r}return Al.strings},Fl=(e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Pe.read(e,S,s,a,n);if(l<0)return-1;if(o+=l,l<a)break;void 0!==n&&(n+=l)}return o},Ml=e=>Jl(e),Il=e=>{var t=se(e)+1,r=Ml(t);return le(e,r,t),r},Ll=Pe.createPath,Rl=Pe.createLazyFile,Dl=Pe.createDevice;Pe.createPreloadedFile=Se,Pe.staticInit(),l.FS_createPath=Pe.createPath,l.FS_createDataFile=Pe.createDataFile,l.FS_createPreloadedFile=Pe.createPreloadedFile,l.FS_unlink=Pe.unlink,l.FS_createLazyFile=Pe.createLazyFile,l.FS_createDevice=Pe.createDevice,_e.doesNotExistError=new Pe.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 n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o},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&&ze("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&&ze("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:ot}),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)Zn.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={2820528:(e,t,r,n,o)=>"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=n,window.miniaudio.device_state.started=o,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),2822518:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2822682:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2822786:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2822957:(e,t,r,n,o,i)=>{var s=e,a=t,c=r,d=n,u=o,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),n=p.intermediaryBufferView,o=0;o<d;o+=1)n[o*a+t]=r[o];Vl(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(n=p.intermediaryBufferView,o=0;o<d;o+=1)i[o]=n[o*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)},2825740:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2825806: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},2826171:e=>{miniaudio.untrack_device_by_index(e)},2826214:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2826339:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2826465:()=>!!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),oc(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=Te.getStr(e),Pe.chmod(e,t),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Fh:function(e,t){try{return Pe.fchmod(e,t),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},pa:function(e,t,r){Te.varargs=r;try{var n=Te.getStreamFromFD(e);switch(t){case 0:if((o=Ae())<0)return-28;for(;Pe.streams[o];)o++;return Pe.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=Ae();return n.flags|=o,0;case 12:return o=Fe(),P[o+0>>1]=2,0}return-28}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Eh:function(e,t){try{return Te.writeStat(t,Pe.fstat(e))}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Dh:function(e,t,r){Te.varargs=r;try{var n=Te.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=Fe();A[i>>2]=o.c_iflag||0,A[i+4>>2]=o.c_oflag||0,A[i+8>>2]=o.c_cflag||0,A[i+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)S[i+s+17]=o.c_cc[s]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.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 n.tty.ops.ioctl_tcsets(n.tty,t,{c_iflag:a,c_oflag:l,c_cflag:c,c_lflag:d,c_cc:u})}return 0;case 21519:return n.tty?(i=Fe(),A[i>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return i=Fe(),Pe.ioctl(n,t,i);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.tty);i=Fe(),P[i>>1]=h[0],P[i+2>>1]=h[1]}return 0;default:return-28}}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Ch:function(e,t){try{return e=Te.getStr(e),Te.writeStat(t,Pe.lstat(e))}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Bh:function(e,t,r,n){try{t=Te.getStr(t);var o=256&n,i=4096&n;return n&=-6401,t=Te.calculateAt(e,t,i),Te.writeStat(r,o?Pe.lstat(t):Pe.stat(t))}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Ta:function(e,t,r,n){Te.varargs=n;try{t=Te.getStr(t),t=Te.calculateAt(e,t);var o=n?Ae():0;return Pe.open(t,r,o).fd}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},Ah:function(e,t,r,n){try{return t=Te.getStr(t),n=Te.getStr(n),t=Te.calculateAt(e,t),n=Te.calculateAt(r,n),Pe.rename(t,n),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},zh:function(e){try{return e=Te.getStr(e),Pe.rmdir(e),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},yh:function(e,t){try{return e=Te.getStr(e),Te.writeStat(t,Pe.stat(e))}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},xh:function(e,t,r){try{return t=Te.getStr(t),t=Te.calculateAt(e,t),0===r?Pe.unlink(t):512===r?Pe.rmdir(t):z("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},nh:()=>z(""),Ra:e=>{var t=Me[e];delete Me[e];var r=t.elements,n=r.length,o=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,s=t.rawDestructor;qe([e],o,(e=>(r.forEach(((t,r)=>{var o=e[r],i=t.getter,s=t.getterContext,a=e[r+n],l=t.setter,c=t.setterContext;t.read=e=>o.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(n),o=0;o<n;++o)t[o]=r[o].read(e);return s(e),t},toWireType:(e,o)=>{if(n!==o.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${n}, actual=${o.length}`);for(var a=i(),l=0;l<n;++l)r[l].write(a,o[l]);return null!==e&&e.push(s,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:s}])))},z:e=>{var t=Ue[e];delete Ue[e];var r=t.rawConstructor,n=t.rawDestructor,o=t.fields,i=o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType)));qe([e],i,(e=>{var i={};return o.forEach(((t,r)=>{var n=t.fieldName,s=e[r],a=e[r].optional,l=t.getter,c=t.getterContext,d=e[r+o.length],u=t.setter,h=t.setterContext;i[n]={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 n(e),t},toWireType:(e,t)=>{for(var o in i)if(!(o in t)&&!i[o].optional)throw new TypeError(`Missing field: "${o}"`);var s=r();for(o in i)i[o].write(s,t[o]);return null!==e&&e.push(n,s),s},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction:n}]}))},Qa:(e,t,r,n,o)=>{var i=-1!=(t=He(t)).indexOf("u");Ve(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,n)=>{Ve(e,{name:t=He(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:Xe,readValueFromPointer:function(e){return this.fromWireType(x[e])},destructorFunction:null})},s:(e,t,r,n,o,i,s,a,l,c,d,u,h)=>{d=He(d),i=St(o,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(){Tt(`Cannot construct ${d} due to unbound types`,[n])})),qe([e,t,r],n?[n]:[],(t=>{var r,o;t=t[0],o=n?(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(o,{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,n,o,i)=>{var s=At(t,r);o=St(n,o),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]=()=>{Tt(`Cannot construct ${e.name} due to unbound types`,s)},qe([],s,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,n,null,o,i),[]))),[]}))},c:(e,t,r,n,o,i,s,a,l,c)=>{var d=At(r,n);t=He(t),t=It(t),i=St(o,i),qe([],[e],(e=>{var n=`${(e=e[0]).name}.${t}`;function o(){Tt(`Cannot call ${n} 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?(o.argCount=r-2,o.className=e.name,l[t]=o):(ct(l,t,n),l[t].overloadTable[r-2]=o),qe([],d,(o=>{var a=Ft(n,o,e,i,s);return void 0===l[t].overloadTable?(a.argCount=r-2,l[t]=a):l[t].overloadTable[r-2]=a,[]})),[]}))},lh:e=>Ve(e,jt),da:(e,t,r,n)=>{function o(){}t=He(t),o.values={},Ve(e,{name:t,constructor:o,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:Xe,readValueFromPointer:$t(t,r,n),destructorFunction:null}),dt(t,o)},K:(e,t,r)=>{var n=qt(e,"enum");t=He(t);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:lt(`${n.name}_${t}`,(function(){}))}});o.values[r]=i,o[t]=i},Pa:(e,t,r)=>{Ve(e,{name:t=He(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:Xe,readValueFromPointer:Ut(t,r),destructorFunction:null})},P:(e,t,r,n,o,i,s,a)=>{var l=At(t,r);e=He(e),e=It(e),o=St(n,o),dt(e,(function(){Tt(`Cannot call ${e} due to unbound types`,l)}),t-1),qe([],l,(r=>{var n=[r[0],null].concat(r.slice(1));return _t(e,Ft(e,n,null,o,i),t-1),[]}))},N:(e,t,r,n,o)=>{t=He(t),-1===o&&(o=4294967295);var i=e=>e;if(0===n){var s=32-8*r;i=e=>e<<s>>>s}var a=t.includes("unsigned");Ve(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!==n),destructorFunction:null})},E:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function o(e){var t=F[e>>2],r=F[e+4>>2];return new n(S.buffer,r,t)}Ve(e,{name:r=He(r),fromWireType:o,argPackAdvance:Xe,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},Q:(e,t)=>{Ve(e,Wt)},kh:(e,t,r,n,o,i,s,a,l,c,d,u)=>{r=He(r),i=St(o,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,n,i,a,c,u)])))},jh:(e,t)=>{t=He(t),Ve(e,{name:t,fromWireType(e){for(var t,r=F[e>>2],n=e+4,o=n,i=0;i<=r;++i){var s=n+i;if(i==r||0==x[s]){var a=Q(o,s-o);void 0===t?t=a:(t+=String.fromCharCode(0),t+=a),o=s+1}}return Nl(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||ze("Cannot pass non-string to std::string"),r=n?se(t):t.length;var o=Hl(4+r+1),i=o+4;return F[o>>2]=r,n?le(t,i,r+1):x.set(t,i),null!==e&&e.push(Nl,o),o},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Nl(e)}})},na:(e,t,r)=>{var n,o,i,s;r=He(r),2===t?(n=Nt,o=zt,s=Vt,i=e=>T[e>>1]):4===t&&(n=Gt,o=Xt,s=Yt,i=e=>F[e>>2]),Ve(e,{name:r,fromWireType:e=>{for(var r,o=F[e>>2],s=e+4,a=0;a<=o;++a){var l=e+4+a*t;if(a==o||0==i(l)){var c=n(s,l-s);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),s=l+t}}return Nl(e),r},toWireType:(e,n)=>{"string"!=typeof n&&ze(`Cannot pass non-string to C++ string type ${r}`);var i=s(n),a=Hl(4+i+t);return F[a>>2]=i/t,o(n,a+4,i+t),null!==e&&e.push(Nl,a),a},argPackAdvance:Xe,readValueFromPointer:Le,destructorFunction(e){Nl(e)}})},Oa:(e,t,r,n,o,i)=>{Me[e]={name:He(t),rawConstructor:St(r,n),rawDestructor:St(o,i),elements:[]}},M:(e,t,r,n,o,i,s,a,l)=>{Me[e].elements.push({getterReturnType:t,getter:St(r,n),getterContext:o,setterArgumentType:i,setter:St(s,a),setterContext:l})},y:(e,t,r,n,o,i)=>{Ue[e]={name:He(t),rawConstructor:St(r,n),rawDestructor:St(o,i),fields:[]}},l:(e,t,r,n,o,i,s,a,l,c)=>{Ue[e].fields.push({fieldName:He(t),getterReturnType:r,getter:St(n,o),getterContext:i,setterArgumentType:s,setter:St(a,l),setterContext:c})},ih:(e,t)=>{Ve(e,{isVoid:!0,name:t=He(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},hh:()=>{ne=!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,n)=>(e=Zt[e])(null,t=Ot.toValue(t),r,n),J:(e,t,r,n,o)=>(e=Zt[e])(t=Ot.toValue(t),t[r=er(r)],n,o),b:Dt,fh:(e,t)=>(e=Ot.toValue(e))==(t=Ot.toValue(t)),I:e=>0===e?Ot.toHandle(tr()):(e=er(e),Ot.toHandle(tr()[e])),o:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=qt(F[t+4*n>>2],"parameter "+n);return r})(e,t),o=n.shift();e--;var i,s,a=new Array(e),l=`methodCaller<(${n.map((e=>e.name)).join(", ")}) => ${o.name}>`;return i=lt(l,((t,i,s,l)=>{for(var c=0,d=0;d<e;++d)a[d]=n[d].readValueFromPointer(l+c),c+=n[d].argPackAdvance;var u=1===r?rr(i,a):i.apply(t,a);return Qt(o,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)},Y:(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=nr(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 n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),o=(r.getTime()-n)/864e5|0;A[t+28>>2]=o},bh:function(e,t){e=nr(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 n=0|sr(r);A[t+28>>2]=n,A[t+36>>2]=-60*r.getTimezoneOffset();var o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.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],n=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),a=Math.min(s,i);if(r<0)A[e+32>>2]=Number(i!=s&&a==n);else if(r>0!=(a==n)){var l=Math.max(s,i),c=r>0?a:l;t.setTime(t.getTime()+6e4*(c-n))}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,n,o,i,s){o=nr(o);try{if(isNaN(o))return 61;var a=Te.getStreamFromFD(n),l=Pe.mmap(a,e,o,t,r),c=l.ptr;return A[i>>2]=l.allocated,F[s>>2]=c,0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return-e.errno}},_g:function(e,t,r,n,o,i){i=nr(i);try{var s=Te.getStreamFromFD(o);2&r&&Te.doMsync(e,s,t,n,i)}catch(e){if(void 0===Pe||"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,n)=>{var o=(new Date).getFullYear(),i=new Date(o,0,1),s=new Date(o,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,n,17)):(le(u,n,17),le(h,r,17))},Xg:function(e){var t=Q(e);localStorage.removeItem(t)},wh:function(e,t,r){if(t=nr(t),!((n=e)>=0&&n<=3))return 28;var n,o;o=0===e?gr():fr();var i=Math.round(1e3*o*1e3);return I[r>>3]=BigInt(i),0},Ma:(e,t,r,n,o)=>yr.chooseConfig(e,t,r,n,o),La:(e,t,r,n)=>{if(62e3!=e)return yr.setErrorCode(12296),0;for(var o=1;;){var i=A[n>>2];if(12440!=i){if(12344==i)break;return yr.setErrorCode(12292),0}o=A[n+4>>2],n+=8}return o<2||o>3?(yr.setErrorCode(12293),0):(yr.contextAttributes.majorVersion=o-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,n)=>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),W:(e,t,r,n)=>{if(62e3!=e)return yr.setErrorCode(12296),0;if(62002!=t)return yr.setErrorCode(12293),0;if(!n)return yr.setErrorCode(12300),0;switch(yr.setErrorCode(12288),r){case 12320:return A[n>>2]=yr.contextAttributes.alpha?32:24,1;case 12321:return A[n>>2]=yr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return A[n>>2]=8,1;case 12325:return A[n>>2]=yr.contextAttributes.depth?24:0,1;case 12326:return A[n>>2]=yr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return A[n>>2]=12344,1;case 12328:return A[n>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return A[n>>2]=0,1;case 12330:case 12332:return A[n>>2]=4096,1;case 12331:return A[n>>2]=16777216,1;case 12337:return A[n>>2]=yr.contextAttributes.antialias?4:0,1;case 12338:return A[n>>2]=yr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return A[n>>2]=4,1;case 12341:case 12342:case 12343:return A[n>>2]=-1,1;case 12348:return A[n>>2]=1,1;case 12351:return A[n>>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),ca:(e,t,r,n)=>62e3!=e?(yr.setErrorCode(12296),0):0!=n&&62004!=n?(yr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(yr.setErrorCode(12301),0):(vr.makeContextCurrent(n?yr.context:null),yr.currentContext=n,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:Pr,Hg:Tr,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:Hr,tg:Nr,sg:zr,rg:Vr,qg:Gr,pg:Xr,og:Yr,ng:Kr,mg:Qr,lg:Zr,kg:Jr,jg:en,ig:tn,hg:rn,Ga:nn,gg:on,fg:sn,eg:an,dg:ln,cg:cn,bg:dn,ag:un,$f:hn,_f:pn,Zf:fn,Yf:gn,Xf:mn,Wf:bn,Vf:yn,Uf:vn,Tf:wn,Sf:kn,Rf:_n,Qf:Cn,Pf:En,Of:Sn,Nf:xn,Mf:Pn,Lf:Tn,Kf:An,Jf:Mn,If:Ln,Hf:Rn,Gf:Dn,Ff:Bn,Ef:On,Df:jn,Cf:$n,Bf:qn,Af:Wn,zf:Nn,yf:Vn,xf:Gn,wf:Yn,vf:Qn,uf:eo,tf:ro,sf:oo,rf:so,qf:lo,pf:uo,of:po,nf:fo,mf:mo,lf:yo,kf:vo,jf:wo,hf:ko,gf:_o,ff:Co,ef:Eo,df:So,cf:xo,bf:Po,af:To,$e:Ao,_e:Fo,Ze:Mo,Ye:Io,Xe:Lo,We:Ro,Ve:Do,Ue:Bo,Te:Oo,Se:jo,Re:$o,Qe:Uo,Pe:Ho,Oe:No,Ne:Vo,Me:Go,Le:Xo,Ke:Yo,Je:Ko,Ie:Qo,He:Zo,Ge:ri,Fe:ni,Ee:oi,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:Pi,le:Ti,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:Hi,Yd:Vi,Xd:Yi,Wd:Ki,Vd:Qi,Ud:es,Td:rs,Sd:ns,Rd:os,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:Ps,vd:Ts,ud:As,td:Fs,sd:Ms,rd:Is,qd:Ls,pd:Rs,od:Ds,nd:Bs,md:Os,ld:Us,kd:Ws,jd:Hs,id:Ns,hd:zs,gd:Vs,fd:Gs,ed:Xs,dd:Ys,cd:Ks,bd:Qs,ad:Zs,$c:Js,_c:ea,Zc:ta,Yc:ra,Xc:na,Wc:oa,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:Pa,Ac:Ta,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:Ha,kc:Na,jc:za,ic:Va,hc:Ga,gc:Xa,fc:Ya,ec:Ka,dc:Qa,cc:Za,bc:Ja,ac:el,$b:tl,_b:rl,Zb:nl,Yb:ol,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 n=1;n<=4;n*=2){var o=t*(1+.2/n);o=Math.min(o,e+100663296);var i=Math.min(r,we(Math.max(e,o),65536));if(Cl(i))return!0}return!1},Gb:function(e,t,r,n,o,i,s,a,c){const d=l.UTF8ToString(e,e+t),u=l.HEAPU8.subarray(o,o+i),h=l.emscripten_ubq_codec_audioDecoderNextHandle++,p={codec:d,sampleRate:r,numberOfChannels:n,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,n,o,i){const s=l.UTF8ToString(e,e+t),a=l.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:s,sampleRate:r,numberOfChannels:n,bitrate:o};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: "+n,e+="; bit rate: "+o,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:a})},Eb:function(e,t,r,n,o,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:n,description:d,optimizeForLatency:!0,hardwareAcceleration:"prefer-software"};try{const e=l.emscripten_ubq_codec_createVideoDecoder(u,o,a);VideoDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t.supported}),(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,n,o,i,s){const a=l.UTF8ToString(e,e+t),c=l.emscripten_ubq_codec_videoEncoderNextHandle++,d=l.specialHTMLTargets["!canvas"];d.width=r,d.height=n;const u={codec:a,width:r,height:n,avc:{format:"annexb"},framerate:o};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"+n,l.emscripten_ubq_codec_createNativeResult({error:e})}return l.emscripten_ubq_codec_createNativeResult({handle:c})},Cb:function(e,t,r,n,o,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(o,o+i),d=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:n,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,n,o,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(o,o+i),d=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:n,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 n=1e6,o=l.emscripten_ubq_codec_audioEncoders.get(e),i=o.audioEncoderConfig.sampleRate,s=o.audioEncoderConfig.numberOfChannels,a=r/s,c=Math.round(n*(o.frameIndex*a/i)),d=Math.round(n*(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});o.audioEncoder.encode(h),o.frameIndex++,h.close()},zb:function(e,t,r){const n=1e6,o=l.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(n*(o.frameIndex/o.encoderConfig.framerate)),s=o.frameIndex%o.groupOfPictures==0,a=Math.round(n/o.encoderConfig.framerate),c=l.specialHTMLTargets["!canvas"],d=new VideoFrame(c,{timestamp:i,duration:a});o.videoEncoder.encode(d,{keyFrame:s}),d.close(),o.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},V:async function(e,t,r){const n=l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;n.shouldDropFrames=r,n.flushing=!0;try{await n.flush()}catch{}n.flushing=!1,n.shouldDropFrames=!1,n.decodedFrames=t},za:function(e){return l.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},ba:function(e){return l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},aa: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},$:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},tb:function(e,t,r,n,o,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:n,codedHeight:o,description:d})},sb:function(e,t){l.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},rb:function(e,t,r){const n=l.emscripten_ubq_codec_videoDecoders.get(e),o=l.HEAPU32.subarray(t/4,t/4+r);n.videoDecoder.textures=[];for(let e=0;e<r;e++)n.videoDecoder.textures[e]=vr.textures[o[e]]},qb:async function(e,t,r,n,o,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,n,o,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,n){return l.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,n)},nb:function(e){l.emscripten_ubq_asyncFetchManager.deleteHeader(e)},mb:function(e,t,r,n,o,i,s,a,c){return l.emscripten_ubq_asyncFetchManager.fetch(e,t,r,n,o,i,s,a,c).handle},U: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},T: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},ha:function(e,t,r,n,o){const i=Q(e),s=4294967296*(r>>>0)+(t>>>0);if(n<=0)return 0;const a=l.emscripten_ubq_opfs_CHUNK_SIZE,c=l.emscripten_ubq_opfs_getCache(i),d=x.subarray(o,o+n);let u=0,h=s;const p=Math.min(s+n,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,n=Math.min(t.byteLength-r,p-h);d.set(t.subarray(r,r+n),u),u+=n,h+=n}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)},ga:function(e,t,r,n){const o=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(o),c=Math.floor(i/s),d=Math.floor((i+n)/s);for(let e=c;e<=d;++e){if(!a.chunkCache.has(e))return 0;l.emscripten_ubq_opfs_updateAccess(a,e)}return 1},fa:function(e,t,r,n){const o=Q(e),i=4294967296*(r>>>0)+(t>>>0),s=l.emscripten_ubq_opfs_CHUNK_SIZE,a=l.emscripten_ubq_opfs_getCache(o),c=Math.floor(i/s),d=Math.floor((i+n-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(o,a,e));return u?1:0},gb:function(){return!!l.emscripten_ubq_settings_forceWebGL1},ya:Pl,_: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),Z:(e,t)=>{var r=vr.getContext(e),n=Q(t);return n.startsWith("GL_")&&(n=n.slice(3)),!!r.GLctx.getExtension(n)},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 n=r.powerPreference&&El.indexOf(r.powerPreference);return A[t+8>>2]=n,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(((n,o)=>{var i=t+r;F[e+4*o>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)S[t++]=e.charCodeAt(r);S[t]=0})(n,i),r+=n.length+1})),0},uh:(e,t)=>{var r=Al();F[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),F[t>>2]=n,0},xa:hr,oa:function(e){try{var t=Te.getStreamFromFD(e);return Pe.close(t),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},th:function(e,t){try{var r=Te.getStreamFromFD(e),n=r.tty?2:Pe.isDir(r.mode)?3:Pe.isLink(r.mode)?7:4;return S[t]=n,P[t+2>>1]=0,I[t+8>>3]=BigInt(0),I[t+16>>3]=BigInt(0),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},sh:function(e,t,r,n,o){n=nr(n);try{if(isNaN(n))return 61;var i=Te.getStreamFromFD(e),s=Fl(i,t,r,n);return F[o>>2]=s,0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},Sa:function(e,t,r,n){try{var o=Te.getStreamFromFD(e),i=Fl(o,t,r);return F[n>>2]=i,0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},rh:function(e,t,r,n){t=nr(t);try{if(isNaN(t))return 61;var o=Te.getStreamFromFD(e);return Pe.llseek(o,t,r),I[n>>3]=BigInt(o.position),o.getdents&&0===t&&0===r&&(o.getdents=null),0}catch(e){if(void 0===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},qh:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var s=F[t>>2],a=F[t+4>>2];t+=8;var l=Pe.write(e,S,s,a,n);if(l<0)return-1;if(o+=l,l<a)break;void 0!==n&&(n+=l)}return o})(Te.getStreamFromFD(e),t,r);return F[n>>2]=o,0}catch(e){if(void 0===Pe||"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("")},A:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},L:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},F:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},m:function(e,t,r,n){var o=ie();try{return Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},_a:function(e){var t=ie();try{return Et(e)()}catch(e){if(oe(t),e!==e+0)throw e;Kl(1,0)}},wa:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},r:function(e,t){var r=ie();try{return Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},X:function(e,t,r,n,o,i,s,a,l,c,d,u,h,p,f,g){var m=ie();try{return Et(e)(t,r,n,o,i,s,a,l,c,d,u,h,p,f,g)}catch(e){if(oe(m),e!==e+0)throw e;Kl(1,0)}},q:function(e,t,r){var n=ie();try{return Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},t:function(e,t,r,n){var o=ie();try{return Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},S:function(e,t,r,n,o){var i=ie();try{return Et(e)(t,r,n,o)}catch(e){if(oe(i),e!==e+0)throw e;Kl(1,0)}},Za:function(e,t,r,n,o,i){var s=ie();try{return Et(e)(t,r,n,o,i)}catch(e){if(oe(s),e!==e+0)throw e;Kl(1,0)}},va:function(e,t,r,n,o,i,s){var a=ie();try{return Et(e)(t,r,n,o,i,s)}catch(e){if(oe(a),e!==e+0)throw e;Kl(1,0)}},ua:function(e,t,r,n,o,i,s,a,l,c){var d=ie();try{return Et(e)(t,r,n,o,i,s,a,l,c)}catch(e){if(oe(d),e!==e+0)throw e;Kl(1,0)}},R:function(e){var t=ie();try{Et(e)()}catch(e){if(oe(t),e!==e+0)throw e;Kl(1,0)}},w:function(e,t){var r=ie();try{Et(e)(t)}catch(e){if(oe(r),e!==e+0)throw e;Kl(1,0)}},C:function(e,t,r,n){var o=ie();try{Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},B:function(e,t,r){var n=ie();try{Et(e)(t,r)}catch(e){if(oe(n),e!==e+0)throw e;Kl(1,0)}},p:function(e,t,r,n){var o=ie();try{Et(e)(t,r,n)}catch(e){if(oe(o),e!==e+0)throw e;Kl(1,0)}},D:function(e,t,r,n,o){var i=ie();try{Et(e)(t,r,n,o)}catch(e){if(oe(i),e!==e+0)throw e;Kl(1,0)}},Ya:function(e,t,r,n,o,i){var s=ie();try{Et(e)(t,r,n,o,i)}catch(e){if(oe(s),e!==e+0)throw e;Kl(1,0)}},Xa:function(e,t,r,n,o,i,s){var a=ie();try{Et(e)(t,r,n,o,i,s)}catch(e){if(oe(a),e!==e+0)throw e;Kl(1,0)}},Wa:function(e,t,r,n,o,i,s,a){var l=ie();try{Et(e)(t,r,n,o,i,s,a)}catch(e){if(oe(l),e!==e+0)throw e;Kl(1,0)}},Va:function(e,t,r,n,o,i,s,a,l,c){var d=ie();try{Et(e)(t,r,n,o,i,s,a,l,c)}catch(e){if(oe(d),e!==e+0)throw e;Kl(1,0)}},ea: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),n=l.ctx;n.bindTexture(n.TEXTURE_2D,vr.textures[e]),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.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===Pe||"ErrnoError"!==e.name)throw e;return e.errno}},ra:function(e,t){var r=Q(e),n=Q(t);localStorage.setItem(r,n)}},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,n)=>{l.instantiateWasm(t,((t,n)=>{e(t),r(t.exports)}))}));q??=V();try{var r=await X(D,q,t);return e(r.instance)}catch(e){return n(e),Promise.reject(e)}}(),Wl=(Ul.Ih,Ul.Jh),Hl=l._malloc=Ul.Kh,Nl=l._free=Ul.Lh,zl=l._main=Ul.Mh,Vl=(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,nc=Ul.$h,oc=Ul.ai;if(l.addRunDependency=H,l.removeRunDependency=N,l.ccall=(e,t,r,n,o)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=Il(e)),t},array:e=>{var t,r,n=Ml(e.length);return t=e,r=n,S.set(t,r),n}},s=(e=>l["_"+e])(e),a=[],c=0;if(n)for(var d=0;d<n.length;d++){var u=i[r[d]];u?(0===c&&(c=ie()),a[d]=u(n[d])):a[d]=n[d]}var h,p=s(...a);return h=p,0!==c&&oe(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 P[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:z(`invalid type for getValue: ${t}`)}},l.UTF8ToString=Q,l.specialHTMLTargets=Sl,l.FS_createPreloadedFile=Se,l.FS_unlink=e=>Pe.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 n(){l.calledRun=!0,B||(l.noFSInit||Pe.initialized||Pe.init(),ve.init(),Ul.Ih(),Pe.ignorePermissions=!1,t(l),l.onRuntimeInitialized?.(),l.noInitialRun||function(e=[]){var t=zl;e.unshift(b);var r=e.length,n=Ml(4*(r+1)),o=n;e.forEach((e=>{F[o>>2]=Il(e),o+=4})),F[o>>2]=0;try{var i=t(r,n);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),n()}),1)):n())}(),c});"object"==typeof e&&"object"==typeof t?(t.exports=n,t.exports.default=n):"function"==typeof define&&define.amd&&define([],(()=>n))}}),wt=u($()),kt=u(ht()),_t=u(pt()),Ct=class extends TypeError{constructor(e,t){let r;const{message:n,...o}=e,{path:i}=e;super(0===i.length?n:"At path: "+i.join(".")+" -- "+n),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,o),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n: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,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:s}=r,{refinement:a,message:l="Expected a value of type `"+s+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+St(n)+"`"}=e;return{value:n,type:s,refinement:a,key:o[o.length-1],path:o,branch:i,...e,message:l}}function*Pt(e,t,r,n){var o;Et(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]);for(const o of e){const e=xt(o,t,r,n);e&&(yield e)}}function*Tt(e,t,r={}){const{path:n=[],branch:o=[e],coerce:i=!1,mask:s=!1}=r,a={path:n,branch:o};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=Tt(c,d,{path:void 0===r?n:[...n,r],branch:void 0===r?o:[...o,c],coerce:i,mask:s});for(const n of t)n[0]?(l=!1,yield[n[0],void 0]):i&&(c=n[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:n,refiner:o,coercer:i=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=r,this.entries=s,this.coercer=i,this.validator=n?(e,t)=>Pt(n(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Pt(o(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 n=Tt(e,t,r),o=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(o[0]){return[new Ct(o[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,o[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,n]of t.entries())yield[r,n,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(n){if(e&&Et(n)){const o=new Set(Object.keys(n));for(const r of t)o.delete(r),yield[r,n[r],e[r]];for(const e of o)yield[e,n[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 n of t)yield[n,r[n],e[n]]},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,n){const o=[];for(const t of e){const[...e]=Tt(r,t,n),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+St(r),...o]}})}function Wt(e,t,r={}){const{exclusive:n}=r;return zt(e,"max",(r=>n?r<t:r<=t||"Expected a "+e.type+" less than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Ht(e,t,r={}){const{exclusive:n}=r;return zt(e,"min",(r=>n?r>t:r>=t||"Expected a "+e.type+" greater than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Nt(e){return zt(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 zt(e,t,r){return new At({...e,*refiner(n,o){yield*e.refiner(n,o);const i=Pt(r(n,o),o,e,n);for(const e of i)yield{...e,refinement:t}}})}var Vt={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[n]=Ft(t,r);if(n)throw n.message=`Error in argument '${e}': ${n.message}`,n;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 nr(){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 or(){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:nr(),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),n=e.fetchAsset?.bind(e),o=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 n={...t,sortKey:t.sortKey,sortingOrder:t.sortingOrder,sortActiveFirst:t.sortActiveFirst,tags:lr(t.tags),groups:lr(t.groups),excludeGroups:lr(t.excludeGroups)},o=await e.findAssets(n);if(o){const t={...o,assets:o.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`")}}),n?async(t,r)=>{try{const o=await n(t);null===o?r.invoke(null):r.invoke(ur(o,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,o?async(e,t)=>{try{const r=await o(this.#n(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.#n(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.#n(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.#o(e.id,e)}addLocalSource(e,t,r,n){sr(this.#e.addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const n=await r(this.#n(e));t.invoke(n)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,n?async(e,t,r)=>{try{await n(this.#n(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,n)=>{try{r(sr(this.#e.addLocalAssetSourceFromJSONString(e,t)))}catch(e){n(e)}}))}addLocalAssetSourceFromJSONURI(e){return new Promise(((t,r)=>{this.#e.addLocalAssetSourceFromJSONURI(e,(e=>{try{const r=sr(e);t(r)}catch(e){r(e)}}))}))}removeSource(e){sr(this.#e.removeAssetSource(e)),this.#i(e)}findAllSources(){return lr(this.#e.findAllAssetSources())}findAssets(e,t){return new Promise(((r,n)=>{let o=t?.tags??[];Array.isArray(o)||(o=[o]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:o,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){n(e)}}))}))}async fetchAsset(e,t){return Gt("sourceId",e,$t()),Gt("assetId",t,$t()),new Promise(((r,n)=>{this.#e.fetchAssetSourceAsset(e,t,(e=>{try{const t=sr(e);r(t||null)}catch(e){n(e)}}))}))}#n(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))}#o(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,n)=>{this.#e.applyAssetSourceAsset(e,ur(t,e),(e=>{try{const t=sr(e);this.#e.isValid(t)?r(t):r(void 0)}catch(e){n(e)}}))}));if(this.#t.size>0){return Array.from(this.#t).reduce(((e,t)=>(r,n)=>t(r,n,e)),r)(e,t)}return r(e,t)}async applyToBlock(e,t,r){const n=(e,t,r)=>ar((n=>this.#e.applyAssetSourceAssetToBlock(e,ur(t,e),r,n)));if(this.#r.size>0){return Array.from(this.#r).reduce(((e,t)=>(r,n,o)=>t(r,n,o,e)),n)(e,t,r)}return n(e,t,r)}async applyProperty(e,t,r){return ar((n=>this.#e.applyAssetSourceProperty(e,ur(t,e),r,n)))}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,Pr,Tr,Ar,Fr,Mr,Ir,Lr,Rr,Dr,Br,Or,jr,$r,qr,Ur,Wr,Hr,Nr,zr={};function Vr(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],Tr=[pr({disabledInModes:["Playback"]})],Pr=[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,en,tn,rn,nn,on,sn,an,ln,cn,dn,un,hn,pn,fn,gn,mn,bn,yn,vn,wn,kn,_n,Cn,En,Sn,xn,Pn,Tn,An,Fn,Mn,In,Ln,Rn,Dn,Bn,On,jn,$n,qn,Un,Wn,Hn,Nn,zn,Vn,Gn,Xn,Yn,Kn,Qn,Zn,Jn,eo,to,ro,no,oo,io,so,ao,lo,co,uo,ho,po,fo,go,mo,bo,yo,vo,wo,ko,_o,Co,Eo,So,xo,Po,To,Ao,Fo,Mo,Io,Lo,Ro,Do,Bo,Oo,jo,$o,qo,Uo,Wo,Ho,No,zo,Vo,Go,Xo,Yo,Ko,Qo,Zo,Jo,ei,ti,ri,ni,oi,ii,si,ai,li,ci,di,ui,hi,pi,fi,gi,mi,bi,yi,vi,wi,ki,_i,Ci,Ei,Si,xi,Pi,Ti,Ai,Fi,Mi,Ii,Li,Ri,Di,Bi,Oi,ji,$i,qi,Ui,Wi,Hi,Ni,zi,Vi,Gi,Xi,Yi,Ki,Qi,Zi,Ji,es,ts,rs,ns,os,is,ss,as,ls,cs,ds,us,hs,ps,fs,gs,ms,bs,ys,vs,ws,ks,_s,Cs,Es,Ss,xs,Ps,Ts,As,Fs,Ms,Is,Ls,Rs,Ds,Bs,Os,js,$s,qs,Us,Ws,Hs,Ns,zs,Vs,Gs,Xs,Ys,Ks,Qs,Zs,Js,ea,ta,ra,na,oa,ia,sa,aa,la,ca,da,ua,ha,pa,fa,ga,ma,ba,ya,va,wa,ka,_a,Ca,Ea,Sa,xa,Pa,Ta,Aa,Fa,Ma,Ia,La,Ra,Da,Ba,Oa,ja,$a,qa,Ua,Wa,Ha,Na,za,Va,Ga,Xa,Ya,Ka,Qa,Za,Ja,el,tl,rl,nl,ol,il,sl,al,ll,cl,dl,ul,hl,pl,fl,gl,ml,bl,yl,vl,wl,kl,_l,Cl,El,Sl,xl,Pl,Tl,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,t=!1){return Gt("sceneContent",e,$t()),ar((r=>_(this,$r).loadSceneFromString(e,r,t)))}async loadFromURL(e,t=!1){return Gt("url",e,$t()),ar((r=>_(this,$r).loadSceneFromURL(e,r,t)))}async loadFromArchiveURL(e,t=!1){return Gt("url",e,$t()),ar((r=>_(this,$r).loadSceneFromArchiveURL(e,r,t)))}async saveToString(e=["blob","bundle","file","http","https","opfs"],t){const r=this.get();if(null==r)throw new Error("No scene available.");return ar((n=>{_(this,$r).saveSceneToString(r,n,e,t?async(e,r,n)=>{const o=await t(e,r);n&&n.invoke(e,o)}:void 0)}))}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,n="Free",o=0,i=!1){return Gt("url",e,$t()),Gt("dpi",t,Ht(Bt(),0)),Gt("pixelScaleFactor",r,Ht(Bt(),0)),Gt("sceneLayout",n,Zt()),ar((s=>_(this,$r).createSceneFromImage(e,t,r,n,o,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,n,o){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(Ht(Bt(),0)),easing:jt(Jt()),interruptible:jt(Lt())})]))})))}catch(e){try{Gt("paddingLeft",t,jt(Bt())),Gt("paddingTop",r,jt(Bt())),Gt("paddingRight",n,jt(Bt())),Gt("paddingBottom",o,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:n??0,bottom:o??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,n=0,o=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",n,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,0,n,0))):"Vertical"===t?(Gt("paddingBefore",r,Bt()),Gt("paddingAfter",n,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,0,r,0,n))):(Gt("paddingLeft",r,Bt()),Gt("paddingTop",n,Bt()),Gt("paddingRight",o,Bt()),Gt("paddingBottom",i,Bt()),sr(_(this,$r).enableZoomAutoFit(e,t,r,n,o,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,n=0,o=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",n,Bt()),Gt("paddingBottom",o,Bt()),Gt("scaledPaddingLeft",t,Bt()),Gt("scaledPaddingTop",r,Bt()),Gt("scaledPaddingRight",n,Bt()),Gt("scaledPaddingBottom",o,Bt()),sr(_(this,$r).unstable_enableCameraPositionClamping(e,t,r,n,o,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,n=0,o=0,i=0,s=0){return Gt("ids",e,It(Bt())),Gt("minZoomLimit",t,Bt()),Gt("maxZoomLimit",r,Bt()),Gt("paddingLeft",n,Bt()),Gt("paddingTop",o,Bt()),Gt("paddingRight",i,Bt()),Gt("paddingBottom",s,Bt()),sr(_(this,$r).unstable_enableCameraZoomClamping(e,t,r,n,o,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 Al(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}function Fl(e){return"name"in e&&void 0!==e.name}function Ml(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,n=0;if("number"==typeof t.page.size)r=t.page.size,n=t.page.size;else{if("object"!=typeof t.page.size)return;r=t.page.size.width,n=t.page.size.height}const o=_(this,qr).create("page");if(_(this,qr).appendChild(e,o),_(this,qr).setSize(o,r,n),t.page.color){const e=_(this,qr).createFill("color");_(this,qr).setFill(o,e),_(this,qr).setColor(o,"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",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",Tr,SceneAPI),y(Ur,1,"setDesignUnit",Pr,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(Al(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(Ml(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(Fl(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={})),Cl=[fr],_l=[fr],kl=[fr],wl=[fr],vl=[fr],yl=[fr],bl=[fr],ml=[pr({disabledInModes:["Playback"]})],gl=[pr({disabledInModes:["Playback"]})],fl=[fr],pl=[fr],hl=[fr],ul=[pr({disabledInModes:["Playback"]})],dl=[pr({disabledInModes:["Playback"]})],cl=[pr({disabledInModes:["Playback"]})],ll=[fr],al=[fr],sl=[fr],il=[fr],ol=[pr({disabledInModes:["Playback"]})],nl=[fr],rl=[fr],tl=[pr({disabledInModes:["Playback"]})],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=[fr],Ga=[pr({disabledInModes:["Playback"]})],Va=[fr],za=[pr({disabledInModes:["Playback"]})],Na=[fr],Ha=[pr({disabledInModes:["Playback"]})],Wa=[fr],Ua=[pr({disabledInModes:["Playback"]})],qa=[fr],$a=[pr({disabledInModes:["Playback"]})],ja=[pr({disabledInModes:["Playback"]})],Oa=[pr({disabledInModes:["Playback"]})],Ba=[pr({disabledInModes:["Playback"]})],Da=[fr],Ra=[fr],La=[fr],Ia=[fr],Ma=[fr],Fa=[fr],Aa=[pr({disabledInModes:["Playback"]})],Ta=[pr({disabledInModes:["Playback"]})],Pa=[fr],xa=[fr],Sa=[fr],Ea=[fr],Ca=[pr({disabledInModes:["Playback"]})],_a=[fr],ka=[pr({disabledInModes:["Playback"]})],wa=[pr({disabledInModes:["Playback"]})],va=[fr],ya=[fr],ba=[pr({disabledInModes:["Playback"]})],ma=[pr({disabledInModes:["Playback"]})],ga=[pr({disabledInModes:["Playback"]})],fa=[pr({disabledInModes:["Playback"]})],pa=[fr],ha=[fr],ua=[fr],da=[fr],ca=[fr],la=[fr],aa=[pr({disabledInModes:["Playback"]})],sa=[pr({disabledInModes:["Playback"]})],ia=[pr({disabledInModes:["Playback"]})],oa=[pr({disabledInModes:["Playback"]})],na=[fr],ra=[pr({disabledInModes:["Playback"]})],ta=[fr],ea=[fr],Js=[pr({disabledInModes:["Playback"]})],Zs=[pr({disabledInModes:["Playback"]})],Qs=[pr({disabledInModes:["Playback"]})],Ks=[fr],Ys=[fr],Xs=[pr({disabledInModes:["Playback"]})],Gs=[pr({disabledInModes:["Playback"]})],Vs=[pr({disabledInModes:["Playback"]})],zs=[pr({disabledInModes:["Playback"]})],Ns=[pr({disabledInModes:["Playback"]})],Hs=[pr({disabledInModes:["Playback"]})],Ws=[fr],Us=[fr],qs=[pr({disabledInModes:["Playback"]})],$s=[fr],js=[fr],Os=[fr],Bs=[fr],Ds=[fr],Rs=[fr],Ls=[pr({disabledInModes:["Playback"]})],Is=[pr({disabledInModes:["Playback"]})],Ms=[pr({disabledInModes:["Playback"]})],Fs=[pr({disabledInModes:["Playback"]})],As=[pr({disabledInModes:["Playback"]})],Ts=[fr],Ps=[pr({disabledInModes:["Playback"]})],xs=[fr],Ss=[pr({disabledInModes:["Playback"]})],Es=[fr],Cs=[pr({disabledInModes:["Playback"]})],_s=[fr],ks=[pr({disabledInModes:["Playback"]})],ws=[fr],vs=[pr({disabledInModes:["Playback"]})],ys=[fr],bs=[pr({disabledInModes:["Playback"]})],ms=[fr],gs=[pr({disabledInModes:["Playback"]})],fs=[fr],ps=[pr({disabledInModes:["Playback"]})],hs=[pr({disabledInModes:["Playback"]})],us=[fr],ds=[pr({disabledInModes:["Playback"]})],cs=[pr({disabledInModes:["Playback"]})],ls=[fr],as=[fr],ss=[fr],is=[fr],os=[pr({disabledInModes:["Playback"]})],ns=[fr],rs=[fr],ts=[fr],es=[fr],Ji=[fr],Zi=[fr],Qi=[fr],Ki=[pr({disabledInModes:["Playback"]})],Yi=[pr({disabledInModes:["Playback"]})],Xi=[pr({disabledInModes:["Playback"]})],Gi=[pr({disabledInModes:["Playback"]})],Vi=[pr({disabledInModes:["Playback"]})],zi=[pr({disabledInModes:["Playback"]})],Ni=[fr],Hi=[fr],Wi=[fr],Ui=[fr],qi=[pr({disabledInModes:["Playback"]})],$i=[fr],ji=[pr({disabledInModes:["Playback"]})],Oi=[pr({disabledInModes:["Playback"]})],Bi=[fr],Di=[fr],Ri=[pr({disabledInModes:["Playback"]})],Li=[fr],Ii=[pr({disabledInModes:["Playback"]})],Mi=[fr],Fi=[pr()],Ai=[fr],Ti=[fr],Pi=[fr],xi=[fr],Si=[pr({disabledInModes:["Playback"]})],Ei=[fr],Ci=[fr],_i=[pr({disabledInModes:["Playback"]})],ki=[fr],wi=[pr({disabledInModes:["Playback"]})],vi=[fr],yi=[pr({disabledInModes:["Playback"]})],bi=[fr],mi=[pr({disabledInModes:["Playback"]})],gi=[fr],fi=[pr({disabledInModes:["Playback"]})],pi=[fr],hi=[fr],ui=[pr({disabledInModes:["Playback"]})],di=[pr({disabledInModes:["Playback"]})],ci=[fr],li=[pr({disabledInModes:["Playback"]})],ai=[fr],si=[pr({disabledInModes:["Playback"]})],ii=[fr],oi=[pr({disabledInModes:["Playback"]})],ni=[fr],ri=[pr({disabledInModes:["Playback"]})],ti=[fr],ei=[pr({disabledInModes:["Playback"]})],Jo=[fr],Zo=[fr],Qo=[pr({disabledInModes:["Playback"]})],Ko=[pr({disabledInModes:["Playback"]})],Yo=[fr],Xo=[pr({disabledInModes:["Playback"]})],Go=[fr],Vo=[pr({disabledInModes:["Playback"]})],zo=[fr],No=[pr({disabledInModes:["Playback"]})],Ho=[fr],Wo=[pr({disabledInModes:["Playback"]})],Uo=[fr],qo=[pr({disabledInModes:["Playback"]})],$o=[fr],jo=[fr],Oo=[fr],Bo=[fr],Do=[fr],Ro=[fr],Lo=[pr({disabledInModes:["Playback"]})],Io=[fr],Mo=[pr({disabledInModes:["Playback"]})],Fo=[fr],Ao=[pr({disabledInModes:["Playback"]})],To=[fr],Po=[pr({disabledInModes:["Playback"]})],xo=[pr({disabledInModes:["Playback"]})],So=[fr],Eo=[pr({disabledInModes:["Playback"]})],Co=[pr({disabledInModes:["Playback"]})],_o=[fr],ko=[fr],wo=[fr],vo=[fr],yo=[pr({disabledInModes:["Playback"]})],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=[fr],co=[pr({disabledInModes:["Playback"]})],lo=[fr],ao=[fr],so=[pr({disabledInModes:["Playback"]})],io=[fr],oo=[pr({disabledInModes:["Playback"]})],no=[fr],ro=[pr({disabledInModes:["Playback"]})],to=[fr],eo=[pr({disabledInModes:["Playback"]})],Jn=[fr],Zn=[pr({disabledInModes:["Playback"]})],Qn=[fr],Kn=[pr({disabledInModes:["Playback"]})],Yn=[pr({disabledInModes:["Playback"]})],Xn=[fr],Gn=[fr],Vn=[pr({disabledInModes:["Playback"]})],zn=[pr({disabledInModes:["Playback"]})],Nn=[fr],Hn=[pr({disabledInModes:["Playback"]})],Wn=[fr],Un=[pr({disabledInModes:["Playback"]})],qn=[fr],$n=[fr],jn=[pr({disabledInModes:["Playback"]})],On=[fr],Bn=[pr({disabledInModes:["Playback"]})],Dn=[fr],Rn=[pr({disabledInModes:["Playback"]})],Ln=[fr],In=[pr({disabledInModes:["Playback"]})],Mn=[fr],Fn=[pr()],An=[fr],Tn=[pr()],Pn=[pr({disabledInModes:["Playback"]})],xn=[fr],Sn=[pr({disabledInModes:["Playback"]})],En=[fr],Cn=[pr()],_n=[fr],kn=[pr({disabledInModes:["Playback"]})],wn=[fr],vn=[pr({disabledInModes:["Playback"]})],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=[fr],ln=[fr],an=[fr],sn=[pr({disabledInModes:["Playback"]})],on=[pr({disabledInModes:["Playback"]})],nn=[pr({disabledInModes:["Playback"]})],rn=[fr],tn=[pr({disabledInModes:["Playback"]})],en=[fr],Jr=[fr],Zr=[fr],Qr=[fr],Kr=[pr({disabledInModes:["Playback"]})],Yr=[pr({disabledInModes:["Playback"]})],Xr=[fr];var BlockAPI=class{constructor(e){b(xl,5,this),C(this,Pl),C(this,El),C(this,Sl),v(this,"onSelectionChanged",(e=>{const t=_(this,El).subscribeToSelectionChange(e);return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(t))}})),v(this,"onClicked",(e=>{const t=_(this,El).subscribeToBlockClicked(e);return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(t))}})),v(this,"onStateChanged",((e,t)=>{Gt("ids",e,It(Dt()));const r=_(this,El).subscribeToBlockState(e,(e=>{try{t(lr(e,!0))}catch(e){console.error(e)}}));return()=>{_(this,El).isDeleted()||sr(_(this,El).unsubscribe(r))}})),E(this,El,e),E(this,Sl,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(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(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(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 n="object"==typeof t?t:{mimeType:t,...r},o=n.mimeType??"image/png",i=null!=n.targetWidth&&null!=n.targetHeight,s=n.jpegQuality??.9,a=n.webpQuality??1,l=n.pngCompressionLevel??5;return new Promise(((t,r)=>{n.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),_(this,El).exportToBuffer(e,o,(e=>{"error"in e?r(e.error):t(new Blob([e],{type:o}))}),{pngCompressionLevel:l,jpegQuality:s,webpQuality:a,useTargetSize:i,targetWidth:n.targetWidth??0,targetHeight:n.targetHeight??0,exportPdfWithHighCompatibility:n.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:n.exportPdfWithUnderlayer??!1,underlayerSpotColorName:n.underlayerSpotColorName??"",underlayerOffset:n.underlayerOffset??0})}))}async exportWithColorMask(e,t,r,n,o,i){Gt("handle",e,Bt());try{Gt("maskColorR",t,Bt()),Gt("maskColorG",r,Bt()),Gt("maskColorB",n,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(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",n,Bt()),Gt("maskColorB",o,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(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=n,c=o??{}):(s=r,a=n,l=o,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,El).exportWithColorMaskToBuffer(e,d,s,a,l,((e,n)=>{if("error"in e)r(e.error);else if("error"in n)r(n.error);else{const r=new Blob([e],{type:d}),o=new Blob([n],{type:d});t([r,o])}}),{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,n){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,n)=>{_(this,El).unstable_exportAudioToBuffer(e,t.timeOffset??0,t.duration??0,t.mimeType??"audio/wav",t.onProgress??(()=>{}),(e=>{"error"in e?n(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,El).loadBlocksFromString(e,t))).then((e=>lr(e)))}loadFromArchiveURL(e){return Gt("url",e,$t()),ar((t=>_(this,El).loadBlocksFromArchiveURL(e,t))).then((e=>lr(e)))}async saveToString(e,t=["buffer","http","https"],r){return Gt("blocks",e,It(Bt())),ar((n=>_(this,El).saveBlocksToString(e,n,t,r?async(e,t,n)=>{const o=await r(e,t);n&&n.invoke(e,o)}:void 0)))}async saveToArchive(e){return Gt("blocks",e,It(Bt())),new Promise(((t,r)=>{_(this,El).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,El).create(e))}createFill(e){return Gt("type",e,$t()),sr(_(this,El).createFill(e))}getAudioTrackCountFromVideo(e){return Gt("videoFillBlock",e,Dt()),sr(_(this,El).getAudioTrackCountFromVideo(e))}createAudioFromVideo(e,t,r=!1){return Gt("videoFillBlock",e,Dt()),Gt("trackIndex",t,Bt()),Gt("muteOriginalVideo",r,Lt()),sr(_(this,El).createAudioFromVideo(e,t,r))}createAudiosFromVideo(e,t=!1){return Gt("videoFillBlock",e,Dt()),Gt("muteOriginalVideo",t,Lt()),lr(sr(_(this,El).createAudiosFromVideo(e,t)))}getAudioInfoFromVideo(e){return Gt("videoFillBlock",e,Dt()),lr(sr(_(this,El).getAudioInfoFromVideo(e)))}async createCaptionsFromURI(e){return Gt("uri",e,$t()),ar((t=>_(this,El).createCaptionsFromURI(e,t))).then((e=>lr(e)))}getType(e){return Gt("id",e,Dt()),sr(_(this,El).getType(e))}getKind(e){return Gt("id",e,Dt()),sr(_(this,El).getKind(e))}setKind(e,t){Gt("id",e,Dt()),sr(_(this,El).setKind(e,t))}select(e){return Gt("id",e,Dt()),sr(_(this,El).select(e))}setSelected(e,t){return Gt("id",e,Dt()),Gt("selected",t,Lt()),sr(_(this,El).setSelected(e,t))}isSelected(e){return Gt("id",e,Dt()),sr(_(this,El).isSelected(e))}findAllSelected(){return lr(_(this,El).findAllSelected())}isGroupable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isGroupable(e))}group(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).group(e))}ungroup(e){return Gt("id",e,Bt()),sr(_(this,El).ungroup(e))}enterGroup(e){return Gt("id",e,Bt()),sr(_(this,El).enterGroup(e))}exitGroup(e){return Gt("id",e,Bt()),sr(_(this,El).exitGroup(e))}isCombinable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isCombinable(e))}combine(e,t){return Gt("ids",e,It(Bt())),Gt("op",t,$t()),sr(_(this,El).combine(e,t))}setName(e,t){return Gt("id",e,Dt()),Gt("name",t,$t()),sr(_(this,El).setName(e,t))}getName(e){return Gt("id",e,Dt()),sr(_(this,El).getName(e))}getUUID(e){return Gt("id",e,Dt()),sr(_(this,El).getUUID(e))}findByName(e){Gt("name",e,$t());const t=_(this,El).findByName(e);return lr(t)}findByType(e){Gt("type",e,$t());const t=sr(_(this,El).findByType(e));return lr(t)}findByKind(e){Gt("kind",e,$t());const t=sr(_(this,El).findByKind(e));return lr(t)}findAll(){return lr(_(this,El).findAll())}findAllPlaceholders(){return lr(_(this,El).findAllPlaceholders())}createShape(e){return Gt("type",e,$t()),sr(_(this,El).createShape(e))}hasShape(e){return Gt("id",e,Dt()),sr(_(this,El).hasShape(e))}supportsShape(e){return Gt("id",e,Dt()),sr(_(this,El).supportsShape(e))}getShape(e){return Gt("id",e,Dt()),sr(_(this,El).getShape(e))}setShape(e,t){return Gt("id",e,Dt()),Gt("shape",t,Dt()),sr(_(this,El).setShape(e,t))}isVisible(e){return Gt("id",e,Dt()),sr(_(this,El).isVisible(e))}setVisible(e,t){return Gt("id",e,Dt()),Gt("visible",t,Lt()),sr(_(this,El).setVisible(e,t))}isClipped(e){return Gt("id",e,Dt()),sr(_(this,El).isClipped(e))}setClipped(e,t){return Gt("id",e,Dt()),Gt("clipped",t,Lt()),sr(_(this,El).setClipped(e,t))}isTransformLocked(e){return Gt("id",e,Dt()),sr(_(this,El).isTransformLocked(e))}setTransformLocked(e,t){return Gt("id",e,Dt()),Gt("locked",t,Lt()),sr(_(this,El).setTransformLocked(e,t))}getPositionX(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionX(e))}getPositionXMode(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionXMode(e))}getPositionY(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionY(e))}getPositionYMode(e){return Gt("id",e,Dt()),sr(_(this,El).getPositionYMode(e))}setPositionX(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,El).setPositionX(e,t))}setPositionXMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setPositionXMode(e,t))}setPositionY(e,t){return Gt("id",e,Dt()),Gt("value",t,Bt()),sr(_(this,El).setPositionY(e,t))}setPositionYMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Gt("id",e,Dt()),sr(_(this,El).isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Gt("id",e,Dt()),sr(_(this,El).isAlwaysOnBottom(e))}bringToFront(e){return Gt("id",e,Bt()),sr(_(this,El).bringToFront(e))}sendToBack(e){return Gt("id",e,Bt()),sr(_(this,El).sendToBack(e))}bringForward(e){return Gt("id",e,Bt()),sr(_(this,El).bringForward(e))}sendBackward(e){return Gt("id",e,Bt()),sr(_(this,El).sendBackward(e))}getRotation(e){return Gt("id",e,Dt()),sr(_(this,El).getRotation(e))}setRotation(e,t){return Gt("id",e,Dt()),Gt("radians",t,Bt()),sr(_(this,El).setRotation(e,t))}getFlipHorizontal(e){return Gt("id",e,Dt()),sr(_(this,El).getFlip(e)).horizontal}getFlipVertical(e){return Gt("id",e,Dt()),sr(_(this,El).getFlip(e)).vertical}setFlipHorizontal(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,El).setFlipHorizontal(e,t))}setFlipVertical(e,t){return Gt("id",e,Dt()),Gt("flip",t,Lt()),sr(_(this,El).setFlipVertical(e,t))}hasContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).hasContentFillMode(e))}supportsContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).supportsContentFillMode(e))}getWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getWidth(e))}getWidthMode(e){return Gt("id",e,Dt()),sr(_(this,El).getWidthMode(e))}getHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getHeight(e))}getHeightMode(e){return Gt("id",e,Dt()),sr(_(this,El).getHeightMode(e))}setSize(e,t,r,n){return Gt("id",e,Dt()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",n,jt(Ot({maintainCrop:jt(Lt()),sizeMode:jt(tr())}))),null!=n?.sizeMode&&(sr(_(this,El).setWidthMode(e,n.sizeMode)),sr(_(this,El).setHeightMode(e,n.sizeMode))),sr(_(this,El).setWidth(e,t,n?.maintainCrop??!1)),sr(_(this,El).setHeight(e,r,n?.maintainCrop??!1))}setPosition(e,t,r,n){return Gt("id",e,Dt()),Gt("x",t,Bt()),Gt("y",r,Bt()),null!=n?.positionMode&&(sr(_(this,El).setPositionXMode(e,n.positionMode)),sr(_(this,El).setPositionYMode(e,n.positionMode))),sr(_(this,El).setPositionX(e,t)),sr(_(this,El).setPositionY(e,r))}setWidth(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,El).setWidth(e,t,r??!1))}setWidthMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setWidthMode(e,t))}setHeight(e,t,r){return Gt("id",e,Dt()),Gt("value",t,Bt()),Gt("maintainCrop",r??!1,Lt()),sr(_(this,El).setHeight(e,t,r??!1))}setHeightMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setHeightMode(e,t))}getFrameX(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameX(e))}getFrameY(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameY(e))}getFrameWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameWidth(e))}getFrameHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getLastFrameHeight(e))}setContentFillMode(e,t){return Gt("id",e,Dt()),sr(_(this,El).setContentFillMode(e,t))}getContentFillMode(e){return Gt("id",e,Dt()),sr(_(this,El).getContentFillMode(e))}duplicate(e,t=!0){return Gt("id",e,Dt()),sr(_(this,El).duplicate(e,t))}destroy(e){return Gt("id",e,Dt()),sr(_(this,El).destroy(e))}isValid(e){return Gt("id",e,Dt()),_(this,El).isValid(e)}getParent(e){return Gt("id",e,Dt()),sr(_(this,El).hasParent(e))?sr(_(this,El).getParent(e)):null}getChildren(e){Gt("id",e,Dt());const t=sr(_(this,El).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,El).insertChild(e,t,r))}appendChild(e,t){return Gt("parent",e,Bt()),Gt("child",t,Bt()),sr(_(this,El).appendChild(e,t))}referencesAnyVariables(e){return Gt("id",e,Dt()),sr(_(this,El).referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Gt("ids",e,It(Bt())),sr(_(this,El).getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).alignHorizontally(e,t))}alignVertically(e,t){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).alignVertically(e,t))}isAlignable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isAlignable(e))}distributeHorizontally(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).distributeHorizontally(e))}distributeVertically(e){return Gt("ids",e,Nt(It(Bt()))),sr(_(this,El).distributeVertically(e))}isDistributable(e){return Gt("ids",e,It(Bt())),sr(_(this,El).isDistributable(e))}fillParent(e){return Gt("id",e,Dt()),sr(_(this,El).fillParent(e))}resizeContentAware(e,t,r){return Gt("ids",e,It(Bt())),Gt("width",t,Bt()),Gt("height",r,Bt()),sr(_(this,El).resizeContentAware(e,t,r))}scale(e,t,r=0,n=0){return Gt("id",e,Dt()),sr(_(this,El).scale(e,t,r,n))}findAllProperties(e){return Gt("id",e,Dt()),lr(sr(_(this,El).findAllProperties(e)))}isPropertyReadable(e){return Gt("property",e,$t()),_(this,El).isPropertyReadable(e)}isPropertyWritable(e){return Gt("property",e,$t()),_(this,El).isPropertyWritable(e)}getPropertyType(e){Gt("property",e,$t());return sr(_(this,El).getPropertyType(e))}getEnumValues(e){return Gt("enumProperty",e,$t()),lr(sr(_(this,El).getEnumValues(e)))}setBool(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Lt()),sr(_(this,El).setBool(e,t,r))}getBool(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getBool(e,t))}setInt(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Dt()),sr(_(this,El).setInt(e,t,r))}getInt(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getInt(e,t))}setFloat(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,El).setFloat(e,t,r))}getFloat(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getFloat(e,t))}setDouble(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,Bt()),sr(_(this,El).setDouble(e,t,r))}getDouble(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getDouble(e,t))}setString(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,El).setString(e,t,r))}getString(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getString(e,t))}setColor(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,or()),sr(_(this,El).setColor(e,t,Gr.fromColor(r)))}getColor(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),Gr.toColor(sr(_(this,El).getColor(e,t)))}setColorRGBA(e,t,r,n,o,i=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("r",r,Bt()),Gt("g",n,Bt()),Gt("b",o,Bt()),Gt("a",i,Bt()),sr(_(this,El).setColorRGBA(e,t,r,n,o,i))}getColorRGBA(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorRGBA(e,t))}setColorSpot(e,t,r,n=1){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("name",r,$t()),Gt("tint",n,Bt()),sr(_(this,El).setColorSpot(e,t,r,n))}getColorSpotName(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorSpotName(e,t))}getColorSpotTint(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Gt("id",e,Dt()),Gt("property",t,$t());const n=r.map((e=>({color:Gr.fromColor(e.color),stop:e.stop})));return sr(_(this,El).setGradientColorStops(e,t,n))}getGradientColorStops(e,t){Gt("id",e,Dt()),Gt("property",t,$t());const r=sr(_(this,El).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,El).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,El).setSourceSet(e,t,r))}addImageFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((n=>_(this,El).addImageFileURIToSourceSet(e,t,r,n)))}addVideoFileURIToSourceSet(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("uri",r,$t()),ar((n=>_(this,El).addVideoFileURIToSourceSet(e,t,r,n)))}setEnum(e,t,r){return Gt("id",e,Dt()),Gt("property",t,$t()),Gt("value",r,$t()),sr(_(this,El).setEnum(e,t,r))}getEnum(e,t){return Gt("id",e,Dt()),Gt("property",t,$t()),sr(_(this,El).getEnum(e,t))}hasCrop(e){return Gt("id",e,Dt()),sr(_(this,El).hasCrop(e))}supportsCrop(e){return Gt("id",e,Dt()),sr(_(this,El).supportsCrop(e))}setCropScaleX(e,t){return Gt("id",e,Dt()),Gt("scaleX",t,Bt()),sr(_(this,El).setCropScaleX(e,t))}setCropScaleY(e,t){return Gt("id",e,Dt()),Gt("scaleY",t,Bt()),sr(_(this,El).setCropScaleY(e,t))}setCropRotation(e,t){return Gt("id",e,Dt()),Gt("rotation",t,Bt()),sr(_(this,El).setCropRotation(e,t))}setCropScaleRatio(e,t){return Gt("id",e,Dt()),Gt("scaleRatio",t,Bt()),sr(_(this,El).setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Gt("id",e,Dt()),Gt("translationX",t,Bt()),sr(_(this,El).setCropTranslationX(e,t))}setCropTranslationY(e,t){return Gt("id",e,Dt()),Gt("translationY",t,Bt()),sr(_(this,El).setCropTranslationY(e,t))}resetCrop(e){return Gt("id",e,Dt()),sr(_(this,El).resetCrop(e))}getCropScaleX(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleX(e))}getCropScaleY(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleY(e))}getCropRotation(e){return Gt("id",e,Dt()),sr(_(this,El).getCropRotation(e))}getCropScaleRatio(e){return Gt("id",e,Dt()),sr(_(this,El).getCropScaleRatio(e))}getCropTranslationX(e){return Gt("id",e,Dt()),sr(_(this,El).getCropTranslationX(e))}getCropTranslationY(e){return Gt("id",e,Dt()),sr(_(this,El).getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Gt("id",e,Dt()),Gt("minScaleRatio",t,Bt()),sr(_(this,El).adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Gt("id",e,Dt()),sr(_(this,El).flipCropHorizontal(e))}flipCropVertical(e){return Gt("id",e,Dt()),sr(_(this,El).flipCropVertical(e))}hasOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).hasOpacity(e))}supportsOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).supportsOpacity(e))}setOpacity(e,t){return Gt("id",e,Dt()),Gt("opacity",t,Bt()),sr(_(this,El).setOpacity(e,t))}getOpacity(e){return Gt("id",e,Dt()),sr(_(this,El).getOpacity(e))}hasBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).hasBlendMode(e))}supportsBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBlendMode(e))}setBlendMode(e,t){return Gt("id",e,Dt()),Gt("blendMode",t,$t()),sr(_(this,El).setBlendMode(e,t))}getBlendMode(e){return Gt("id",e,Dt()),sr(_(this,El).getBlendMode(e))}hasFillColor(e){return Gt("id",e,Dt()),sr(_(this,El).hasFillColor(e))}isIncludedInExport(e){return Gt("id",e,Dt()),sr(_(this,El).isIncludedInExport(e))}setIncludedInExport(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setFillColorRGBA(e,t,r,n,o))}getFillColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getFillColorRGBA(e))}setFillColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setFillColorEnabled(e,t))}isFillColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isFillColorEnabled(e))}createEffect(e){return Gt("type",e,$t()),sr(_(this,El).createEffect(e))}hasEffects(e){return Gt("id",e,Dt()),sr(_(this,El).hasEffects(e))}supportsEffects(e){return Gt("id",e,Dt()),sr(_(this,El).supportsEffects(e))}getEffects(e){Gt("id",e,Dt());const t=sr(_(this,El).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,El).insertEffect(e,t,r))}appendEffect(e,t){Gt("id",e,Dt()),Gt("effectId",t,Dt()),sr(_(this,El).appendEffect(e,t))}removeEffect(e,t){Gt("id",e,Dt()),Gt("index",t,Ht(Dt(),0)),sr(_(this,El).removeEffect(e,t))}hasEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,El).hasEffectEnabled(e))}setEffectEnabled(e,t){Gt("effectId",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setEffectEnabled(e,t))}isEffectEnabled(e){return Gt("effectId",e,Dt()),sr(_(this,El).isEffectEnabled(e))}createBlur(e){return Gt("type",e,$t()),sr(_(this,El).createBlur(e))}hasBlur(e){return Gt("id",e,Dt()),sr(_(this,El).hasBlur(e))}supportsBlur(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBlur(e))}setBlur(e,t){Gt("id",e,Dt()),Gt("blurId",t,Dt()),sr(_(this,El).setBlur(e,t))}getBlur(e){return Gt("id",e,Dt()),sr(_(this,El).getBlur(e))}setBlurEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setBlurEnabled(e,t))}isBlurEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isBlurEnabled(e))}hasBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,El).hasBackgroundColor(e))}supportsBackgroundColor(e){return Gt("id",e,Dt()),sr(_(this,El).supportsBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setBackgroundColorRGBA(e,t,r,n,o))}getBackgroundColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isBackgroundColorEnabled(e))}hasStroke(e){return Gt("id",e,Dt()),sr(_(this,El).hasStroke(e))}supportsStroke(e){return Gt("id",e,Dt()),sr(_(this,El).supportsStroke(e))}setStrokeEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setStrokeEnabled(e,t))}isStrokeEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setStrokeColorRGBA(e,t,r,n,o))}setStrokeColor(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeColor(e,Gr.fromColor(t)))}getStrokeColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getStrokeColorRGBA(e))}getStrokeColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,El).getStrokeColor(e)))}setStrokeWidth(e,t){return Gt("id",e,Dt()),Gt("width",t,Bt()),sr(_(this,El).setStrokeWidth(e,t))}getStrokeWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getStrokeWidth(e))}setStrokeStyle(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeStyle(e,t))}getStrokeStyle(e){Gt("id",e,Dt());return sr(_(this,El).getStrokeStyle(e))}setStrokePosition(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokePosition(e,t))}getStrokePosition(e){Gt("id",e,Dt());return sr(_(this,El).getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Gt("id",e,Dt()),sr(_(this,El).setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Gt("id",e,Dt());return sr(_(this,El).getStrokeCornerGeometry(e))}hasDropShadow(e){return Gt("id",e,Dt()),sr(_(this,El).hasDropShadow(e))}supportsDropShadow(e){return Gt("id",e,Dt()),sr(_(this,El).supportsDropShadow(e))}setDropShadowEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,n,o=1){return Gt("id",e,Dt()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),Gt("a",o,Bt()),sr(_(this,El).setDropShadowColorRGBA(e,t,r,n,o))}setDropShadowColor(e,t){return Gt("id",e,Dt()),Gt("color",t,or()),sr(_(this,El).setDropShadowColor(e,Gr.fromColor(t)))}getDropShadowColorRGBA(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowColorRGBA(e))}getDropShadowColor(e){return Gt("id",e,Dt()),Gr.toColor(sr(_(this,El).getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Gt("id",e,Dt()),Gt("offsetX",t,Bt()),sr(_(this,El).setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Gt("id",e,Dt()),Gt("offsetY",t,Bt()),sr(_(this,El).setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Gt("id",e,Dt()),Gt("blurRadiusX",t,Bt()),sr(_(this,El).setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Gt("id",e,Dt()),Gt("blurRadiusY",t,Bt()),sr(_(this,El).setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Gt("id",e,Dt()),sr(_(this,El).setDropShadowClip(e,t))}getDropShadowClip(e){return Gt("id",e,Dt()),sr(_(this,El).getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4,n=!0){return Gt("ids",e,It(Dt())),Gt("vectorizeDistanceThreshold",t,Bt()),Gt("maxSmoothingDistance",r,Bt()),Gt("useExistingShapeInformation",n,Lt()),sr(_(this,El).createCutoutFromBlocks(e,t,r,n))}createCutoutFromPath(e){return Gt("path",e,$t()),sr(_(this,El).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,El).createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("text",t,$t()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).replaceText(e,t,r,n))}removeText(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).removeText(e,t,r))}setTextColor(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("color",t,or()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextColor(e,Gr.fromColor(t),r,n))}getTextColors(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt());const n=_(this,El).getTextColors(e,t,r);return lr(sr(n)).map((e=>Gr.toColor(e)))}setTextFontWeight(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontWeight(e,t,r,n))}getTextFontWeights(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTextFontWeights(e,t,r)))}setTextFontSize(e,t,r,n=-1){if(Gt("id",e,Dt()),Gt("fontSize",t,Bt()),"object"==typeof r&&null!==r){Gt("options",r,jt(Ot({unit:jt($t()),from:jt(Dt()),to:jt(Dt())})));const{unit:n="Point",from:o=-1,to:i=-1}=r;let s=t;if("Point"!==n){const e=_(this,Sl).get();if(null==e)throw new Error("No scene found for unit conversion");s=function(e,t,r){switch(t){case"Point":default:return e;case"Pixel":return 72*e/r;case"Millimeter":return 72*e/25.4;case"Inch":return 72*e}}(t,n,this.getFloat(e,"scene/dpi"))}sr(_(this,El).setTextFontSize(e,s,o,i))}else{const o=r??-1;Gt("from",o,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontSize(e,t,o,n))}}getTextFontSizes(e,t=-1,r=-1){if(Gt("id",e,Dt()),"object"==typeof t){Gt("options",t,jt(Ot({unit:jt($t()),from:jt(Dt()),to:jt(Dt())})));const{unit:r="Point",from:n=-1,to:o=-1}=t,i=lr(sr(_(this,El).getTextFontSizes(e,n,o)));if("Point"===r)return i;{const e=_(this,Sl).get();if(null==e)throw new Error("No scene found for unit conversion");const t=this.getFloat(e,"scene/dpi");return i.map((e=>function(e,t,r){switch(t){case"Point":default:return e;case"Pixel":return e*r/72;case"Millimeter":return 25.4*e/72;case"Inch":return e/72}}(e,r,t)))}}return Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTextFontSizes(e,t,r)))}setTextFontStyle(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextFontStyle(e,t,r,n))}getTextFontStyles(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).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,El).getTextCases(e,t,r)))}setTextCase(e,t,r=-1,n=-1){Gt("id",e,Dt()),Gt("textCase",t,$t()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTextCase(e,t,r,n))}canToggleBoldFont(e,t=-1,r=-1){return Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).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,El).canToggleItalicFont(e,t,r))}toggleBoldFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).toggleBoldFont(e,t,r))}toggleItalicFont(e,t=-1,r=-1){Gt("id",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),sr(_(this,El).toggleItalicFont(e,t,r))}setFont(e,t,r){Gt("block",e,Dt()),Gt("fontFileUri",t,$t()),sr(_(this,El).setFont(e,t,r))}setTypeface(e,t,r=-1,n=-1){Gt("block",e,Dt()),Gt("from",r,Dt()),Gt("to",n,Dt()),sr(_(this,El).setTypeface(e,t,r,n))}getTypeface(e){return Gt("block",e,Dt()),sr(_(this,El).getTypeface(e))}getTypefaces(e,t=-1,r=-1){return Gt("block",e,Dt()),Gt("from",t,Dt()),Gt("to",r,Dt()),lr(sr(_(this,El).getTypefaces(e,t,r)))}getTextCursorRange(){return sr(_(this,El).getTextCursorRange())}getTextVisibleLineCount(e){return Gt("id",e,Dt()),sr(_(this,El).getTextVisibleLineCount(e))}getTextVisibleLineGlobalBoundingBoxXYWH(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,El).getTextVisibleLineGlobalBoundingBoxXYWH(e,t))}getTextVisibleLineContent(e,t){return Gt("id",e,Dt()),Gt("lineIndex",t,Dt()),sr(_(this,El).getTextVisibleLineContent(e,t))}hasFill(e){return Gt("id",e,Dt()),sr(_(this,El).hasFill(e))}supportsFill(e){return Gt("id",e,Dt()),sr(_(this,El).supportsFill(e))}isFillEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isFillEnabled(e))}setFillEnabled(e,t){return Gt("id",e,Dt()),sr(_(this,El).setFillEnabled(e,t))}getFill(e){return Gt("id",e,Dt()),sr(_(this,El).getFill(e))}setFill(e,t){return Gt("id",e,Dt()),Gt("fill",t,Dt()),sr(_(this,El).setFill(e,t))}setFillSolidColor(e,t,r,n,o=1){Gt("id",e,Dt()),sr(_(this,El).setFillSolidColor(e,t,r,n,o))}getFillSolidColor(e){return Gt("id",e,Dt()),sr(_(this,El).getFillSolidColor(e))}setPlaceholderEnabled(e,t){Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaceholderBehavior(e))}supportsPlaceholderBehavior(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Gt("id",e,Dt()),sr(_(this,El).setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaceholderControls(e))}supportsPlaceholderControls(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("value",r,$t()),sr(_(this,El).setMetadata(e,t,r))}getMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).getMetadata(e,t))}hasMetadata(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).hasMetadata(e,t))}findAllMetadata(e){return Gt("id",e,Dt()),lr(sr(_(this,El).findAllMetadata(e)))}removeMetadata(e,t){Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).removeMetadata(e,t))}setScopeEnabled(e,t,r){Gt("id",e,Dt()),Gt("key",t,$t()),Gt("enabled",r,Lt()),sr(_(this,El).setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).isScopeEnabled(e,t))}isAllowedByScope(e,t){return Gt("id",e,Dt()),Gt("key",t,$t()),sr(_(this,El).isAllowedByScope(e,t))}hasDuration(e){return Gt("id",e,Dt()),sr(_(this,El).hasDuration(e))}supportsDuration(e){return Gt("id",e,Dt()),sr(_(this,El).supportsDuration(e))}setDuration(e,t){return Gt("id",e,Dt()),Gt("duration",t,Bt()),sr(_(this,El).setDuration(e,t))}getDuration(e){return Gt("id",e,Dt()),sr(_(this,El).getDuration(e))}setPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,El).setPageDurationSource(e,t))}isPageDurationSource(e){return Gt("id",e,Dt()),sr(_(this,El).isPageDurationSource(e))}supportsPageDurationSource(e,t){return Gt("page",e,Dt()),Gt("id",t,Dt()),sr(_(this,El).supportsPageDurationSource(e,t))}removePageDurationSource(e){Gt("id",e,Dt()),sr(_(this,El).removePageDurationSource(e))}hasTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).hasTimeOffset(e))}supportsTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).supportsTimeOffset(e))}setTimeOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,El).setTimeOffset(e,t))}getTimeOffset(e){return Gt("id",e,Dt()),sr(_(this,El).getTimeOffset(e))}hasTrim(e){return Gt("id",e,Dt()),sr(_(this,El).hasTrim(e))}supportsTrim(e){return Gt("id",e,Dt()),sr(_(this,El).supportsTrim(e))}setTrimOffset(e,t){return Gt("id",e,Dt()),Gt("offset",t,Bt()),sr(_(this,El).setTrimOffset(e,t))}getTrimOffset(e){return Gt("id",e,Dt()),sr(_(this,El).getTrimOffset(e))}setTrimLength(e,t){return Gt("id",e,Dt()),Gt("length",t,Bt()),sr(_(this,El).setTrimLength(e,t))}getTrimLength(e){return Gt("id",e,Dt()),sr(_(this,El).getTrimLength(e))}split(e,t,r={}){return Gt("id",e,Dt()),Gt("atTime",t,Bt()),Gt("options",r,Ot({attachToParent:jt(Lt()),createParentTrackIfNeeded:jt(Lt()),selectNewBlock:jt(Lt())})),sr(_(this,El).split(e,t,{attachToParent:r.attachToParent??!0,createParentTrackIfNeeded:r.createParentTrackIfNeeded??!1,selectNewBlock:r.selectNewBlock??!0}))}getTotalSceneDuration(e){return Gt("scene",e,Dt()),sr(_(this,El).getTotalSceneDuration(e))}setPlaying(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setPlaying(e,t))}isPlaying(e){return Gt("id",e,Dt()),sr(_(this,El).isPlaying(e))}hasPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaybackTime(e))}supportsPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaybackTime(e))}setPlaybackTime(e,t){return Gt("id",e,Dt()),Gt("time",t,Bt()),sr(_(this,El).setPlaybackTime(e,t))}getPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Gt("id",e,Dt()),sr(_(this,El).isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,El).setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Gt("id",e,Dt()),sr(_(this,El).isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,El).hasPlaybackControl(e))}supportsPlaybackControl(e){return Gt("id",e,Dt()),sr(_(this,El).supportsPlaybackControl(e))}setLooping(e,t){Gt("id",e,Dt()),Gt("looping",t,Lt()),sr(_(this,El).setLooping(e,t))}isLooping(e){return Gt("id",e,Dt()),sr(_(this,El).isLooping(e))}setMuted(e,t){Gt("id",e,Dt()),Gt("muted",t,Lt()),sr(_(this,El).setMuted(e,t))}isMuted(e){return Gt("id",e,Dt()),sr(_(this,El).isMuted(e))}setVolume(e,t){Gt("id",e,Dt()),Gt("volume",t,Bt()),sr(_(this,El).setVolume(e,t))}getVolume(e){return Gt("id",e,Dt()),sr(_(this,El).getVolume(e))}async forceLoadAVResource(e){return Gt("id",e,Dt()),ar((t=>_(this,El).forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Gt("id",e,Dt()),sr(_(this,El).unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Gt("id",e,Dt()),sr(_(this,El).getAVResourceTotalDuration(e))}getVideoWidth(e){return Gt("id",e,Dt()),sr(_(this,El).getVideoWidth(e))}getVideoHeight(e){return Gt("id",e,Dt()),sr(_(this,El).getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,n,o,i){Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",n,Bt()),Gt("numberOfFrames",o,Dt());const s=_(this,El).generateVideoThumbnailSequence(e,t,r,n,o,(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,El).cancelVideoThumbnailSequenceGeneration(s)}}generateAudioThumbnailSequence(e,t,r,n,o,i,s){Gt("id",e,Dt()),Gt("samplesPerChunk",t,Dt()),Gt("timeBegin",r,Bt()),Gt("timeEnd",n,Bt()),Gt("numberOfSamples",o,Dt()),Gt("numberOfChannels",i,Dt());const a=_(this,El).generateAudioThumbnailSequence(e,t,r,n,o,i,(e=>{"error"in e?s(0,new Error(e.error)):s(e.chunkIndex,e.sampleData)}));return()=>{_(this,El).cancelAudioThumbnailSequenceGeneration(a)}}async getVideoFillThumbnail(e,t){return Gt("id",e,Dt()),Gt("thumbnailHeight",t,Dt()),new Promise(((r,n)=>{_(this,El).getVideoFillThumbnail(e,t,(e=>{"error"in e?n(e.error):r(new Blob([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,n){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),Gt("thumbnailHeight",n,Dt()),new Promise(((o,i)=>{_(this,El).getVideoFillThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new Blob([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,n){return Gt("id",e,Dt()),Gt("numberOfColumns",t,Dt()),Gt("numberOfRows",r,Dt()),new Promise(((o,i)=>{_(this,El).getPageThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new Blob([e],{type:"image/jpeg"}))}))}))}createAnimation(e){return Gt("type",e,$t()),sr(_(this,El).createAnimation(e))}supportsAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).supportsAnimation(e))}setInAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setInAnimation(e,t))}setLoopAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setLoopAnimation(e,t))}setOutAnimation(e,t){Gt("id",e,Dt()),Gt("animation",t,Dt()),sr(_(this,El).setOutAnimation(e,t))}getInAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getInAnimation(e))}getLoopAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getLoopAnimation(e))}getOutAnimation(e){return Gt("id",e,Dt()),sr(_(this,El).getOutAnimation(e))}setNativePixelBuffer(e,t){Gt("id",e,Dt()),t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),sr(_(this,El).setNativePixelBuffer(e,t))}getState(e){return Gt("id",e,Dt()),sr(_(this,El).getState(e))}setState(e,t){Gt("id",e,Dt()),sr(_(this,El).setState(e,t))}async forceLoadResources(e){return Gt("ids",e,It(Dt())),ar((t=>_(this,El).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(or()),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:n,size:o,timeline:i,animation:s,shadow:a,cornerRadius:l,sizeMode:c="Absolute",positionMode:d="Absolute"}=t;let u,h;if(null!=o)"number"==typeof o?(u=o,h=o):(u=o.width,h=o.height);else{const t=await new Promise(((t,r)=>{const n=new Image;n.src=e,n.onerror=r,n.onload=()=>{t({width:n.width,height:n.height})}}));u=t.width,h=t.height}const p=_(this,Sl).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!=n?this.setPositionY(f,n):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,Sl).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,n={}){if(Gt("url",e,$t()),Gt("width",t,Bt()),Gt("height",r,Bt()),Gt("options",n,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(or()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})),cornerRadius:jt(Bt())}))),"Design"===_(this,Sl).getMode())throw new Error("Cannot add video in design mode.");const{x:o,y:i,timeline:s,animation:a,shadow:l,cornerRadius:c,sizeMode:d="Absolute",positionMode:u="Absolute"}=n,h=_(this,Sl).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!=o?this.setPositionX(p,o):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,Pl,Tl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.in.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}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,Pl,Tl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.out.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}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,Pl,Tl).call(this,r,"animationEasing")){const e=this.getEnumValues("animationEasing"),n=t.loop.easing??"Linear";e.includes(n)&&this.setEnum(r,"animationEasing",n)}}}applyDropShadow(e,t={}){Gt("block",e,Dt()),Gt("options",t,jt(Ot({color:jt(or()),offset:jt(Ot({x:jt(Bt()),y:jt(Bt())})),blur:jt(Ot({x:jt(Bt()),y:jt(Bt())}))})));const{color:r,offset:n,blur:o}=t;this.setDropShadowEnabled(e,!0),null!=r&&this.setDropShadowColor(e,r),null!=n&&(null!=n.x&&this.setDropShadowOffsetX(e,n.x),null!=n.y&&this.setDropShadowOffsetY(e,n.y)),null!=o&&(null!=o.x&&this.setDropShadowBlurRadiusX(e,o.x),null!=o.y&&this.setDropShadowBlurRadiusY(e,o.y))}async generateThumbnailAtTimeOffset(e,t){Gt("height",e,Ht(Wt(Dt(),512),1)),Gt("time",t,Bt());const r=_(this,Sl).getCurrentPage();if(null==r)throw new Error("No page to get thumbnail for");if("Design"===_(this,Sl).getMode())throw new Error("Cannot get thumbnail in design mode. Use export instead.");return new Promise(((n,o)=>{_(this,El).generateVideoThumbnailSequence(r,e,t,t,1,(e=>{if("error"in e)o(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 o(new Error("Failed to get canvas context"));i.putImageData(t,0,0),r.toBlob((e=>{e?n(e):o(new Error("Failed to convert to PNG"))}),"image/png")}}))}))}getBackgroundTrack(){if("Design"===_(this,Sl).getMode())throw new Error("Cannot get background track in design mode");if(null==_(this,Sl).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)}};xl=h(null),El=new WeakMap,Sl=new WeakMap,Pl=new WeakSet,Tl=function(e,t){return this.findAllProperties(e).includes(t)},y(xl,1,"loadFromString",Cl,BlockAPI),y(xl,1,"loadFromArchiveURL",_l,BlockAPI),y(xl,1,"create",kl,BlockAPI),y(xl,1,"createFill",wl,BlockAPI),y(xl,1,"createAudioFromVideo",vl,BlockAPI),y(xl,1,"createAudiosFromVideo",yl,BlockAPI),y(xl,1,"createCaptionsFromURI",bl,BlockAPI),y(xl,1,"getType",ml,BlockAPI),y(xl,1,"getKind",gl,BlockAPI),y(xl,1,"setKind",fl,BlockAPI),y(xl,1,"select",pl,BlockAPI),y(xl,1,"setSelected",hl,BlockAPI),y(xl,1,"isSelected",ul,BlockAPI),y(xl,1,"findAllSelected",dl,BlockAPI),y(xl,1,"isGroupable",cl,BlockAPI),y(xl,1,"group",ll,BlockAPI),y(xl,1,"ungroup",al,BlockAPI),y(xl,1,"enterGroup",sl,BlockAPI),y(xl,1,"exitGroup",il,BlockAPI),y(xl,1,"isCombinable",ol,BlockAPI),y(xl,1,"combine",nl,BlockAPI),y(xl,1,"setName",rl,BlockAPI),y(xl,1,"getName",tl,BlockAPI),y(xl,1,"getUUID",el,BlockAPI),y(xl,1,"findByName",Ja,BlockAPI),y(xl,1,"findByType",Za,BlockAPI),y(xl,1,"findByKind",Qa,BlockAPI),y(xl,1,"findAll",Ka,BlockAPI),y(xl,1,"findAllPlaceholders",Ya,BlockAPI),y(xl,1,"createShape",Xa,BlockAPI),y(xl,1,"getShape",Ga,BlockAPI),y(xl,1,"setShape",Va,BlockAPI),y(xl,1,"isVisible",za,BlockAPI),y(xl,1,"setVisible",Na,BlockAPI),y(xl,1,"isClipped",Ha,BlockAPI),y(xl,1,"setClipped",Wa,BlockAPI),y(xl,1,"isTransformLocked",Ua,BlockAPI),y(xl,1,"setTransformLocked",qa,BlockAPI),y(xl,1,"getPositionX",$a,BlockAPI),y(xl,1,"getPositionXMode",ja,BlockAPI),y(xl,1,"getPositionY",Oa,BlockAPI),y(xl,1,"getPositionYMode",Ba,BlockAPI),y(xl,1,"setPositionX",Da,BlockAPI),y(xl,1,"setPositionXMode",Ra,BlockAPI),y(xl,1,"setPositionY",La,BlockAPI),y(xl,1,"setPositionYMode",Ia,BlockAPI),y(xl,1,"setAlwaysOnTop",Ma,BlockAPI),y(xl,1,"setAlwaysOnBottom",Fa,BlockAPI),y(xl,1,"isAlwaysOnTop",Aa,BlockAPI),y(xl,1,"isAlwaysOnBottom",Ta,BlockAPI),y(xl,1,"bringToFront",Pa,BlockAPI),y(xl,1,"sendToBack",xa,BlockAPI),y(xl,1,"bringForward",Sa,BlockAPI),y(xl,1,"sendBackward",Ea,BlockAPI),y(xl,1,"getRotation",Ca,BlockAPI),y(xl,1,"setRotation",_a,BlockAPI),y(xl,1,"getFlipHorizontal",ka,BlockAPI),y(xl,1,"getFlipVertical",wa,BlockAPI),y(xl,1,"setFlipHorizontal",va,BlockAPI),y(xl,1,"setFlipVertical",ya,BlockAPI),y(xl,1,"getWidth",ba,BlockAPI),y(xl,1,"getWidthMode",ma,BlockAPI),y(xl,1,"getHeight",ga,BlockAPI),y(xl,1,"getHeightMode",fa,BlockAPI),y(xl,1,"setSize",pa,BlockAPI),y(xl,1,"setPosition",ha,BlockAPI),y(xl,1,"setWidth",ua,BlockAPI),y(xl,1,"setWidthMode",da,BlockAPI),y(xl,1,"setHeight",ca,BlockAPI),y(xl,1,"setHeightMode",la,BlockAPI),y(xl,1,"getFrameX",aa,BlockAPI),y(xl,1,"getFrameY",sa,BlockAPI),y(xl,1,"getFrameWidth",ia,BlockAPI),y(xl,1,"getFrameHeight",oa,BlockAPI),y(xl,1,"setContentFillMode",na,BlockAPI),y(xl,1,"getContentFillMode",ra,BlockAPI),y(xl,1,"duplicate",ta,BlockAPI),y(xl,1,"destroy",ea,BlockAPI),y(xl,1,"isValid",Js,BlockAPI),y(xl,1,"getParent",Zs,BlockAPI),y(xl,1,"getChildren",Qs,BlockAPI),y(xl,1,"insertChild",Ks,BlockAPI),y(xl,1,"appendChild",Ys,BlockAPI),y(xl,1,"referencesAnyVariables",Xs,BlockAPI),y(xl,1,"getGlobalBoundingBoxX",Gs,BlockAPI),y(xl,1,"getGlobalBoundingBoxY",Vs,BlockAPI),y(xl,1,"getGlobalBoundingBoxWidth",zs,BlockAPI),y(xl,1,"getGlobalBoundingBoxHeight",Ns,BlockAPI),y(xl,1,"getScreenSpaceBoundingBoxXYWH",Hs,BlockAPI),y(xl,1,"alignHorizontally",Ws,BlockAPI),y(xl,1,"alignVertically",Us,BlockAPI),y(xl,1,"isAlignable",qs,BlockAPI),y(xl,1,"distributeHorizontally",$s,BlockAPI),y(xl,1,"distributeVertically",js,BlockAPI),y(xl,1,"isDistributable",Os,BlockAPI),y(xl,1,"fillParent",Bs,BlockAPI),y(xl,1,"resizeContentAware",Ds,BlockAPI),y(xl,1,"scale",Rs,BlockAPI),y(xl,1,"findAllProperties",Ls,BlockAPI),y(xl,1,"isPropertyReadable",Is,BlockAPI),y(xl,1,"isPropertyWritable",Ms,BlockAPI),y(xl,1,"getPropertyType",Fs,BlockAPI),y(xl,1,"getEnumValues",As,BlockAPI),y(xl,1,"setBool",Ts,BlockAPI),y(xl,1,"getBool",Ps,BlockAPI),y(xl,1,"setInt",xs,BlockAPI),y(xl,1,"getInt",Ss,BlockAPI),y(xl,1,"setFloat",Es,BlockAPI),y(xl,1,"getFloat",Cs,BlockAPI),y(xl,1,"setDouble",_s,BlockAPI),y(xl,1,"getDouble",ks,BlockAPI),y(xl,1,"setString",ws,BlockAPI),y(xl,1,"getString",vs,BlockAPI),y(xl,1,"setColor",ys,BlockAPI),y(xl,1,"getColor",bs,BlockAPI),y(xl,1,"setColorRGBA",ms,BlockAPI),y(xl,1,"getColorRGBA",gs,BlockAPI),y(xl,1,"setColorSpot",fs,BlockAPI),y(xl,1,"getColorSpotName",ps,BlockAPI),y(xl,1,"getColorSpotTint",hs,BlockAPI),y(xl,1,"setGradientColorStops",us,BlockAPI),y(xl,1,"getGradientColorStops",ds,BlockAPI),y(xl,1,"getSourceSet",cs,BlockAPI),y(xl,1,"setSourceSet",ls,BlockAPI),y(xl,1,"addImageFileURIToSourceSet",as,BlockAPI),y(xl,1,"addVideoFileURIToSourceSet",ss,BlockAPI),y(xl,1,"setEnum",is,BlockAPI),y(xl,1,"getEnum",os,BlockAPI),y(xl,1,"setCropScaleX",ns,BlockAPI),y(xl,1,"setCropScaleY",rs,BlockAPI),y(xl,1,"setCropRotation",ts,BlockAPI),y(xl,1,"setCropScaleRatio",es,BlockAPI),y(xl,1,"setCropTranslationX",Ji,BlockAPI),y(xl,1,"setCropTranslationY",Zi,BlockAPI),y(xl,1,"resetCrop",Qi,BlockAPI),y(xl,1,"getCropScaleX",Ki,BlockAPI),y(xl,1,"getCropScaleY",Yi,BlockAPI),y(xl,1,"getCropRotation",Xi,BlockAPI),y(xl,1,"getCropScaleRatio",Gi,BlockAPI),y(xl,1,"getCropTranslationX",Vi,BlockAPI),y(xl,1,"getCropTranslationY",zi,BlockAPI),y(xl,1,"adjustCropToFillFrame",Ni,BlockAPI),y(xl,1,"flipCropHorizontal",Hi,BlockAPI),y(xl,1,"flipCropVertical",Wi,BlockAPI),y(xl,1,"setOpacity",Ui,BlockAPI),y(xl,1,"getOpacity",qi,BlockAPI),y(xl,1,"setBlendMode",$i,BlockAPI),y(xl,1,"getBlendMode",ji,BlockAPI),y(xl,1,"isIncludedInExport",Oi,BlockAPI),y(xl,1,"setIncludedInExport",Bi,BlockAPI),y(xl,1,"setFillColorRGBA",Di,BlockAPI),y(xl,1,"getFillColorRGBA",Ri,BlockAPI),y(xl,1,"setFillColorEnabled",Li,BlockAPI),y(xl,1,"isFillColorEnabled",Ii,BlockAPI),y(xl,1,"createEffect",Mi,BlockAPI),y(xl,1,"getEffects",Fi,BlockAPI),y(xl,1,"insertEffect",Ai,BlockAPI),y(xl,1,"appendEffect",Ti,BlockAPI),y(xl,1,"removeEffect",Pi,BlockAPI),y(xl,1,"setEffectEnabled",xi,BlockAPI),y(xl,1,"isEffectEnabled",Si,BlockAPI),y(xl,1,"createBlur",Ei,BlockAPI),y(xl,1,"setBlur",Ci,BlockAPI),y(xl,1,"getBlur",_i,BlockAPI),y(xl,1,"setBlurEnabled",ki,BlockAPI),y(xl,1,"isBlurEnabled",wi,BlockAPI),y(xl,1,"setBackgroundColorRGBA",vi,BlockAPI),y(xl,1,"getBackgroundColorRGBA",yi,BlockAPI),y(xl,1,"setBackgroundColorEnabled",bi,BlockAPI),y(xl,1,"isBackgroundColorEnabled",mi,BlockAPI),y(xl,1,"setStrokeEnabled",gi,BlockAPI),y(xl,1,"isStrokeEnabled",fi,BlockAPI),y(xl,1,"setStrokeColorRGBA",pi,BlockAPI),y(xl,1,"setStrokeColor",hi,BlockAPI),y(xl,1,"getStrokeColorRGBA",ui,BlockAPI),y(xl,1,"getStrokeColor",di,BlockAPI),y(xl,1,"setStrokeWidth",ci,BlockAPI),y(xl,1,"getStrokeWidth",li,BlockAPI),y(xl,1,"setStrokeStyle",ai,BlockAPI),y(xl,1,"getStrokeStyle",si,BlockAPI),y(xl,1,"setStrokePosition",ii,BlockAPI),y(xl,1,"getStrokePosition",oi,BlockAPI),y(xl,1,"setStrokeCornerGeometry",ni,BlockAPI),y(xl,1,"getStrokeCornerGeometry",ri,BlockAPI),y(xl,1,"setDropShadowEnabled",ti,BlockAPI),y(xl,1,"isDropShadowEnabled",ei,BlockAPI),y(xl,1,"setDropShadowColorRGBA",Jo,BlockAPI),y(xl,1,"setDropShadowColor",Zo,BlockAPI),y(xl,1,"getDropShadowColorRGBA",Qo,BlockAPI),y(xl,1,"getDropShadowColor",Ko,BlockAPI),y(xl,1,"setDropShadowOffsetX",Yo,BlockAPI),y(xl,1,"getDropShadowOffsetX",Xo,BlockAPI),y(xl,1,"setDropShadowOffsetY",Go,BlockAPI),y(xl,1,"getDropShadowOffsetY",Vo,BlockAPI),y(xl,1,"setDropShadowBlurRadiusX",zo,BlockAPI),y(xl,1,"getDropShadowBlurRadiusX",No,BlockAPI),y(xl,1,"setDropShadowBlurRadiusY",Ho,BlockAPI),y(xl,1,"getDropShadowBlurRadiusY",Wo,BlockAPI),y(xl,1,"setDropShadowClip",Uo,BlockAPI),y(xl,1,"getDropShadowClip",qo,BlockAPI),y(xl,1,"createCutoutFromBlocks",$o,BlockAPI),y(xl,1,"createCutoutFromPath",jo,BlockAPI),y(xl,1,"createCutoutFromOperation",Oo,BlockAPI),y(xl,1,"replaceText",Bo,BlockAPI),y(xl,1,"removeText",Do,BlockAPI),y(xl,1,"setTextColor",Ro,BlockAPI),y(xl,1,"getTextColors",Lo,BlockAPI),y(xl,1,"setTextFontWeight",Io,BlockAPI),y(xl,1,"getTextFontWeights",Mo,BlockAPI),y(xl,1,"setTextFontSize",Fo,BlockAPI),y(xl,1,"getTextFontSizes",Ao,BlockAPI),y(xl,1,"setTextFontStyle",To,BlockAPI),y(xl,1,"getTextFontStyles",Po,BlockAPI),y(xl,1,"getTextCases",xo,BlockAPI),y(xl,1,"setTextCase",So,BlockAPI),y(xl,1,"canToggleBoldFont",Eo,BlockAPI),y(xl,1,"canToggleItalicFont",Co,BlockAPI),y(xl,1,"toggleBoldFont",_o,BlockAPI),y(xl,1,"toggleItalicFont",ko,BlockAPI),y(xl,1,"setFont",wo,BlockAPI),y(xl,1,"setTypeface",vo,BlockAPI),y(xl,1,"getTypeface",yo,BlockAPI),y(xl,1,"getTypefaces",bo,BlockAPI),y(xl,1,"getTextCursorRange",mo,BlockAPI),y(xl,1,"getTextVisibleLineCount",go,BlockAPI),y(xl,1,"getTextVisibleLineGlobalBoundingBoxXYWH",fo,BlockAPI),y(xl,1,"getTextVisibleLineContent",po,BlockAPI),y(xl,1,"isFillEnabled",ho,BlockAPI),y(xl,1,"setFillEnabled",uo,BlockAPI),y(xl,1,"getFill",co,BlockAPI),y(xl,1,"setFill",lo,BlockAPI),y(xl,1,"setFillSolidColor",ao,BlockAPI),y(xl,1,"getFillSolidColor",so,BlockAPI),y(xl,1,"setPlaceholderEnabled",io,BlockAPI),y(xl,1,"isPlaceholderEnabled",oo,BlockAPI),y(xl,1,"setPlaceholderBehaviorEnabled",no,BlockAPI),y(xl,1,"isPlaceholderBehaviorEnabled",ro,BlockAPI),y(xl,1,"setPlaceholderControlsOverlayEnabled",to,BlockAPI),y(xl,1,"isPlaceholderControlsOverlayEnabled",eo,BlockAPI),y(xl,1,"setPlaceholderControlsButtonEnabled",Jn,BlockAPI),y(xl,1,"isPlaceholderControlsButtonEnabled",Zn,BlockAPI),y(xl,1,"setMetadata",Qn,BlockAPI),y(xl,1,"getMetadata",Kn,BlockAPI),y(xl,1,"findAllMetadata",Yn,BlockAPI),y(xl,1,"removeMetadata",Xn,BlockAPI),y(xl,1,"setScopeEnabled",Gn,BlockAPI),y(xl,1,"isScopeEnabled",Vn,BlockAPI),y(xl,1,"isAllowedByScope",zn,BlockAPI),y(xl,1,"setDuration",Nn,BlockAPI),y(xl,1,"getDuration",Hn,BlockAPI),y(xl,1,"setPageDurationSource",Wn,BlockAPI),y(xl,1,"isPageDurationSource",Un,BlockAPI),y(xl,1,"removePageDurationSource",qn,BlockAPI),y(xl,1,"setTimeOffset",$n,BlockAPI),y(xl,1,"getTimeOffset",jn,BlockAPI),y(xl,1,"setTrimOffset",On,BlockAPI),y(xl,1,"getTrimOffset",Bn,BlockAPI),y(xl,1,"setTrimLength",Dn,BlockAPI),y(xl,1,"getTrimLength",Rn,BlockAPI),y(xl,1,"split",Ln,BlockAPI),y(xl,1,"getTotalSceneDuration",In,BlockAPI),y(xl,1,"setPlaying",Mn,BlockAPI),y(xl,1,"isPlaying",Fn,BlockAPI),y(xl,1,"setPlaybackTime",An,BlockAPI),y(xl,1,"getPlaybackTime",Tn,BlockAPI),y(xl,1,"isVisibleAtCurrentPlaybackTime",Pn,BlockAPI),y(xl,1,"setSoloPlaybackEnabled",xn,BlockAPI),y(xl,1,"isSoloPlaybackEnabled",Sn,BlockAPI),y(xl,1,"setLooping",En,BlockAPI),y(xl,1,"isLooping",Cn,BlockAPI),y(xl,1,"setMuted",_n,BlockAPI),y(xl,1,"isMuted",kn,BlockAPI),y(xl,1,"setVolume",wn,BlockAPI),y(xl,1,"getVolume",vn,BlockAPI),y(xl,1,"forceLoadAVResource",yn,BlockAPI),y(xl,1,"unstable_isAVResourceLoaded",bn,BlockAPI),y(xl,1,"getAVResourceTotalDuration",mn,BlockAPI),y(xl,1,"getVideoWidth",gn,BlockAPI),y(xl,1,"getVideoHeight",fn,BlockAPI),y(xl,1,"getVideoFillThumbnail",pn,BlockAPI),y(xl,1,"getVideoFillThumbnailAtlas",hn,BlockAPI),y(xl,1,"getPageThumbnailAtlas",un,BlockAPI),y(xl,1,"createAnimation",dn,BlockAPI),y(xl,1,"setInAnimation",cn,BlockAPI),y(xl,1,"setLoopAnimation",ln,BlockAPI),y(xl,1,"setOutAnimation",an,BlockAPI),y(xl,1,"getInAnimation",sn,BlockAPI),y(xl,1,"getLoopAnimation",on,BlockAPI),y(xl,1,"getOutAnimation",nn,BlockAPI),y(xl,1,"setNativePixelBuffer",rn,BlockAPI),y(xl,1,"getState",tn,BlockAPI),y(xl,1,"setState",en,BlockAPI),y(xl,1,"forceLoadResources",Jr,BlockAPI),y(xl,1,"applyAnimation",Zr,BlockAPI),y(xl,1,"applyDropShadow",Qr,BlockAPI),y(xl,1,"generateThumbnailAtTimeOffset",Kr,BlockAPI),y(xl,1,"getBackgroundTrack",Yr,BlockAPI),y(xl,1,"moveToBackgroundTrack",Xr,BlockAPI),m(xl,BlockAPI);var Il,Ll,Rl,Dl,Bl,Ol,jl,$l,ql,Ul,Wl,Hl,Nl,zl,Vl,Gl,Xl,Yl,Kl,Ql,Zl,Jl,ec,tc,rc,nc,oc,ic,sc,ac,lc,cc,dc,uc,hc,pc,fc,gc,mc,bc,yc,vc,wc,kc,_c,Cc,Ec,Sc,xc,Pc,Tc,Ac,Fc,Mc,Ic,Lc,Rc,Dc,Bc,Oc,jc,$c,qc=new WeakMap;Oc=[fr],Bc=[fr],Dc=[fr],Rc=[pr({disabledInModes:["Playback"]})],Lc=[pr({disabledInModes:["Playback"]})],Ic=[fr],Mc=[fr],Fc=[pr()],Ac=[pr({disabledInModes:["Playback"]})],Tc=[pr({disabledInModes:["Playback"]})],Pc=[pr({disabledInModes:["Playback"]})],xc=[pr({disabledInModes:["Playback"]})],Sc=[pr({disabledInModes:["Playback"]})],Ec=[fr],Cc=[fr],_c=[fr],kc=[pr({disabledInModes:["Playback"]})],wc=[fr],vc=[fr],yc=[fr],bc=[pr({disabledInModes:["Playback"]})],mc=[pr({disabledInModes:["Playback"]})],gc=[fr],fc=[pr({disabledInModes:["Playback"]})],pc=[fr],hc=[pr({disabledInModes:["Playback"]})],uc=[fr],dc=[pr({disabledInModes:["Playback"]})],cc=[fr],lc=[pr({disabledInModes:["Playback"]})],ac=[fr],sc=[pr({disabledInModes:["Playback"]})],ic=[fr],oc=[pr({disabledInModes:["Playback"]})],nc=[fr],rc=[pr({disabledInModes:["Playback"]})],tc=[fr],ec=[pr({disabledInModes:["Playback"]})],Jl=[fr],Zl=[pr({disabledInModes:["Playback"]})],Ql=[pr({disabledInModes:["Playback"]})],Kl=[pr({disabledInModes:["Playback"]})],Yl=[pr({disabledInModes:["Playback"]})],Xl=[pr({disabledInModes:["Playback"]})],Gl=[fr],Vl=[pr({disabledInModes:["Playback"]})],zl=[pr({disabledInModes:["Playback"]})],Nl=[fr],Hl=[pr({disabledInModes:["Playback"]})],Wl=[pr({disabledInModes:["Playback"]})],Ul=[pr({disabledInModes:["Playback"]})],ql=[pr({disabledInModes:["Playback"]})],$l=[fr],jl=[fr],Ol=[fr],Bl=[fr],Dl=[fr],Rl=[pr({disabledInModes:["Playback"]})],Ll=[pr({disabledInModes:["Playback"]})],Il=[fr];var EditorAPI=class{constructor(e){b($c,5,this),C(this,jc),v(this,"onStateChanged",(e=>{const t=_(this,jc).subscribeToEditorState(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),v(this,"onHistoryUpdated",(e=>{const t=_(this,jc).subscribeToHistory(e);return()=>{_(this,jc).isDeleted()||_(this,jc).unsubscribe(t)}})),v(this,"onSettingsChanged",(e=>{const t=_(this,jc).subscribeToSettings(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),v(this,"onRoleChanged",(e=>{const t=_(this,jc).subscribeToRoleChange(e);return()=>{_(this,jc).isDeleted()||sr(_(this,jc).unsubscribe(t))}})),E(this,jc,e)}unlockWithLicense(e){sr(_(this,jc).unlockWithLicense(e))}startTracking(e,t){_(this,jc).startTracking(e,t,"")}setTrackingMetadata(e){_(this,jc).setTrackingMetadata(e)}getTrackingMetadata(){return sr(_(this,jc).getTrackingMetadata())}getActiveLicense(){return sr(_(this,jc).getActiveLicense())}_update(){_(this,jc).update()}setEditMode(e,t){Gt("mode",e,$t()),Gt("baseMode",t,jt($t())),_(this,jc).setEditMode(e,t??"")}getEditMode(){return _(this,jc).getEditMode()}unstable_isInteractionHappening(){return sr(_(this,jc).unstable_isInteractionHappening())}getCursorType(){return _(this,jc).getCursorType()}getCursorRotation(){return _(this,jc).getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return _(this,jc).getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return _(this,jc).getTextCursorPositionInScreenSpaceY()}createHistory(){return _(this,jc).createHistory()}destroyHistory(e){sr(_(this,jc).destroyHistory(e))}setActiveHistory(e){sr(_(this,jc).setActiveHistory(e))}getActiveHistory(){return _(this,jc).getActiveHistory()}addUndoStep(){sr(_(this,jc).addUndoStep())}undo(){sr(_(this,jc).undo())}redo(){sr(_(this,jc).redo())}canUndo(){return sr(_(this,jc).canUndo())}canRedo(){return sr(_(this,jc).canRedo())}setSetting(e,t){Gt("keypath",e,$t());const r=this.normalizeSettingKey(e);if(!this.isValidSettingKey(r))throw new Error(`Invalid setting key: '${e}'`);switch(this.getSettingTypeForKey(r)){case"Bool":return sr(_(this,jc).setSettingBool(r,t));case"Int":if(!Number.isInteger(t))throw new Error(`Setting '${e}' requires an integer value`);return sr(_(this,jc).setSettingInt(r,t));case"Float":return sr(_(this,jc).setSettingFloat(r,t));case"String":return sr(_(this,jc).setSettingString(r,t));case"Color":{const e=t;return sr(_(this,jc).setSettingColor(r,Gr.fromColor(e)))}case"Enum":return sr(_(this,jc).setSettingEnum(r,t));default:throw new Error(`Unknown setting type for key '${e}'`)}}getSetting(e){Gt("keypath",e,$t());const t=this.normalizeSettingKey(e);if(!this.isValidSettingKey(t))throw new Error(`Invalid setting key: '${e}'`);switch(this.getSettingTypeForKey(t)){case"Bool":return sr(_(this,jc).getSettingBool(t));case"Int":return sr(_(this,jc).getSettingInt(t));case"Float":return sr(_(this,jc).getSettingFloat(t));case"String":return sr(_(this,jc).getSettingString(t));case"Color":return Gr.toColor(sr(_(this,jc).getSettingColor(t)));case"Enum":return sr(_(this,jc).getSettingEnum(t));default:throw new Error(`Unknown setting type for key '${e}'`)}}normalizeSettingKey(e){return e.startsWith("ubq://")?e.slice(6):e}isValidSettingKey(e){return e in{"controlGizmo/showCropHandles":!0,"controlGizmo/showCropScaleHandles":!0,"controlGizmo/showMoveHandles":!0,"controlGizmo/showResizeHandles":!0,"controlGizmo/showRotateHandles":!0,"controlGizmo/showScaleHandles":!0,doubleClickToCropEnabled:!0,"features/singlePageModeEnabled":!0,"features/pageCarouselEnabled":!0,"features/transformEditsRetainCoverMode":!0,"mouse/enableScroll":!0,"mouse/enableZoom":!0,"page/allowCropInteraction":!0,"page/allowMoveInteraction":!0,"page/allowResizeInteraction":!0,"page/allowRotateInteraction":!0,"page/dimOutOfPageAreas":!0,"page/restrictResizeInteractionToFixedAspectRatio":!0,"page/moveChildrenWhenCroppingFill":!0,"page/selectWhenNoBlocksSelected":!0,"page/title/appendPageName":!0,"page/title/show":!0,"page/title/showOnSinglePage":!0,"page/title/showPageTitleTemplate":!0,"placeholderControls/showButton":!0,"placeholderControls/showOverlay":!0,"blockAnimations/enabled":!0,showBuildVersion:!0,"touch/dragStartCanSelect":!0,"touch/singlePointPanning":!0,useSystemFontFallback:!0,forceSystemEmojis:!0,basePath:!0,defaultEmojiFontFileUri:!0,defaultFontFileUri:!0,license:!0,"page/title/fontFileUri":!0,"page/title/separator":!0,fallbackFontUri:!0,"upload/supportedMimeTypes":!0,"controlGizmo/blockScaleDownLimit":!0,positionSnappingThreshold:!0,rotationSnappingThreshold:!0,maxImageSize:!0,borderOutlineColor:!0,clearColor:!0,"colorMaskingSettings/maskColor":!0,cropOverlayColor:!0,errorStateColor:!0,highlightColor:!0,"page/innerBorderColor":!0,"page/marginFillColor":!0,"page/marginFrameColor":!0,"page/outerBorderColor":!0,"page/title/color":!0,placeholderHighlightColor:!0,progressColor:!0,rotationSnappingGuideColor:!0,ruleOfThirdsLineColor:!0,snappingGuideColor:!0,textVariableHighlightColor:!0,handleFillColor:!0,doubleClickSelectionMode:!0,"touch/pinchAction":!0,"touch/rotateAction":!0,"camera/clamping/overshootMode":!0,renderMode:!0,alwaysHighlightPlaceholders:!0,"colorMaskingSettings/secondPass":!0,"debug/enforceScopesInAPIs":!0,"debug/showHandlesInteractionArea":!0,"debug/useDebugMipmaps":!0,"features/effectsEnabled":!0,"features/highQualityMipmaps":!0,"features/hspSelectiveAdjustmentsEnabled":!0,"features/implicitUpdatesEnabled":!0,"features/templatingEnabled":!0,"features/videosEnabled":!0,"features/videoCaptionsEnabled":!0,"features/forceLowQualityVideoPreview":!0,"features/matchThumbnailSourceToFill":!0,"features/p3WorkingColorSpace":!0,"features/removeForegroundTracksOnSceneLoad":!0,"features/videoTranscodingEnabled":!0,renderTextCursorAndSelectionInEngine:!0,clampThumbnailTextureSizes:!0}}getSettingTypeForKey(e){const t=Object.keys({borderOutlineColor:!0,clearColor:!0,"colorMaskingSettings/maskColor":!0,cropOverlayColor:!0,errorStateColor:!0,handleFillColor:!0,highlightColor:!0,"page/innerBorderColor":!0,"page/marginFillColor":!0,"page/marginFrameColor":!0,"page/outerBorderColor":!0,"page/title/color":!0,placeholderHighlightColor:!0,progressColor:!0,rotationSnappingGuideColor:!0,ruleOfThirdsLineColor:!0,snappingGuideColor:!0,textVariableHighlightColor:!0});if(new Set(t).has(e))return"Color";const r=Object.keys({doubleClickSelectionMode:!0,"touch/pinchAction":!0,"touch/rotateAction":!0,"camera/clamping/overshootMode":!0});if(new Set(r).has(e))return"Enum";if(e in{maxImageSize:!0})return"Int";const n=Object.keys({"controlGizmo/blockScaleDownLimit":!0,positionSnappingThreshold:!0,rotationSnappingThreshold:!0});if(new Set(n).has(e))return"Float";const o=Object.keys({basePath:!0,defaultEmojiFontFileUri:!0,defaultFontFileUri:!0,license:!0,"page/title/fontFileUri":!0,"page/title/separator":!0,fallbackFontUri:!0,"upload/supportedMimeTypes":!0});return new Set(o).has(e)?"String":"Bool"}setSettingBool(e,t){return this.setSetting(e,t)}getSettingBool(e){return this.getSetting(e)}setSettingInt(e,t){return this.setSetting(e,t)}getSettingInt(e){return this.getSetting(e)}setSettingFloat(e,t){return this.setSetting(e,t)}getSettingFloat(e){return this.getSetting(e)}setSettingString(e,t){return this.setSetting(e,t)}getSettingString(e){return this.getSetting(e)}setSettingColor(e,t){return this.setSetting(e,t)}getSettingColor(e){return this.getSetting(e)}setSettingColorRGBA(e,t,r,n,o=1){return this.setSetting(e,{r:t,g:r,b:n,a:o})}getSettingColorRGBA(e){const t=this.getSetting(e);if("r"in t)return[t.r,t.g,t.b,t.a];throw new Error(`Setting '${e}' returned non-RGBA color format`)}setSettingEnum(e,t){return this.setSetting(e,t)}getSettingEnum(e){return this.getSetting(e)}getSettingEnumOptions(e){return Gt("keypath",e,$t()),lr(sr(_(this,jc).getSettingEnumOptions(e)))}setRole(e){return sr(_(this,jc).setRole(e))}getRole(){return sr(_(this,jc).getRole())}findAllSettings(){return lr(_(this,jc).findAllSettings())}getSettingType(e){Gt("keypath",e,$t());return sr(_(this,jc).getSettingType(e))}getAvailableMemory(){return sr(_(this,jc).getAvailableMemory())}getUsedMemory(){return sr(_(this,jc).getUsedMemory())}getMaxExportSize(){return sr(_(this,jc).getMaxExportSize())}setURIResolver(e){qc.set(_(this,jc),e);return sr(_(this,jc).setURIResolver((t=>e(t,this.defaultURIResolver.bind(this)))))}unstable_getURIResolver(){return qc.get(_(this,jc))??null}defaultURIResolver(e){return _(this,jc).defaultURIResolver(e)}getAbsoluteURI(e){return sr(_(this,jc).getAbsoluteURI(e))}findAllScopes(){return lr(_(this,jc).findAllScopes())}setGlobalScope(e,t){Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,jc).setGlobalScope(e,t))}getGlobalScope(e){return Gt("key",e,$t()),sr(_(this,jc).getGlobalScope(e))}findAllSpotColors(){return lr(_(this,jc).findAllSpotColors())}getSpotColorRGBA(e){return Gt("name",e,$t()),_(this,jc).getSpotColorRGB(e)}getSpotColorCMYK(e){return Gt("name",e,$t()),_(this,jc).getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,n){return Gt("name",e,$t()),Gt("r",t,Bt()),Gt("g",r,Bt()),Gt("b",n,Bt()),_(this,jc).setSpotColorRGB(e,t,r,n)}setSpotColorCMYK(e,t,r,n,o){return Gt("name",e,$t()),Gt("c",t,Bt()),Gt("m",r,Bt()),Gt("y",n,Bt()),Gt("k",o,Bt()),_(this,jc).setSpotColorCMYK(e,t,r,n,o)}removeSpotColor(e){return Gt("name",e,$t()),sr(_(this,jc).removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Gt("type",e,$t()),Gt("color",t,$t()),sr(_(this,jc).setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Gt("type",e,$t()),sr(_(this,jc).getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Gt("colorSpace",t,$t()),Gr.toColor(sr(_(this,jc).convertColorToColorSpace(Gr.fromColor(e),t)))}createBuffer(){return _(this,jc).createBuffer()}destroyBuffer(e){sr(_(this,jc).destroyBuffer(e))}setBufferData(e,t,r){Gt("offset",t,Dt()),sr(_(this,jc).setBufferData(e,t,r))}getBufferData(e,t,r){Gt("offset",t,Dt()),Gt("length",r,Dt());const n=_(this,jc).getBufferData(e,t,r);if("error"in n)throw new Error(n.error);return n}setBufferLength(e,t){Gt("length",t,Dt()),sr(_(this,jc).setBufferLength(e,t))}getBufferLength(e){return sr(_(this,jc).getBufferLength(e))}cloneBuffers(){return lr(sr(_(this,jc).cloneBuffers()))}restoreBuffers(e){sr(_(this,jc).restoreBuffers(e))}getMimeType(e){return Gt("uri",e,$t()),ar((t=>_(this,jc).getMimeType(e,t)))}findAllTransientResources(){return lr(sr(_(this,jc).findAllTransientResources()))}getResourceData(e,t,r){Gt("uri",e,$t()),Gt("chunkSize",t,Dt()),sr(_(this,jc).getResourceData(e,t,r))}relocateResource(e,t){Gt("currentUrl",e,$t()),Gt("relocatedUrl",t,$t()),sr(_(this,jc).relocateResource(e,t))}isHighlightingEnabled(e){return Gt("id",e,Dt()),sr(_(this,jc).isHighlightingEnabled(e))}setHighlightingEnabled(e,t){return Gt("id",e,Dt()),Gt("enabled",t,Lt()),sr(_(this,jc).setHighlightingEnabled(e,t))}};$c=h(null),jc=new WeakMap,y($c,1,"unlockWithLicense",Oc,EditorAPI),y($c,1,"startTracking",Bc,EditorAPI),y($c,1,"setTrackingMetadata",Dc,EditorAPI),y($c,1,"getTrackingMetadata",Rc,EditorAPI),y($c,1,"getActiveLicense",Lc,EditorAPI),y($c,1,"_update",Ic,EditorAPI),y($c,1,"setEditMode",Mc,EditorAPI),y($c,1,"getEditMode",Fc,EditorAPI),y($c,1,"unstable_isInteractionHappening",Ac,EditorAPI),y($c,1,"getCursorType",Tc,EditorAPI),y($c,1,"getCursorRotation",Pc,EditorAPI),y($c,1,"getTextCursorPositionInScreenSpaceX",xc,EditorAPI),y($c,1,"getTextCursorPositionInScreenSpaceY",Sc,EditorAPI),y($c,1,"createHistory",Ec,EditorAPI),y($c,1,"destroyHistory",Cc,EditorAPI),y($c,1,"setActiveHistory",_c,EditorAPI),y($c,1,"getActiveHistory",kc,EditorAPI),y($c,1,"addUndoStep",wc,EditorAPI),y($c,1,"undo",vc,EditorAPI),y($c,1,"redo",yc,EditorAPI),y($c,1,"canUndo",bc,EditorAPI),y($c,1,"canRedo",mc,EditorAPI),y($c,1,"setSetting",gc,EditorAPI),y($c,1,"getSetting",fc,EditorAPI),y($c,1,"setSettingBool",pc,EditorAPI),y($c,1,"getSettingBool",hc,EditorAPI),y($c,1,"setSettingInt",uc,EditorAPI),y($c,1,"getSettingInt",dc,EditorAPI),y($c,1,"setSettingFloat",cc,EditorAPI),y($c,1,"getSettingFloat",lc,EditorAPI),y($c,1,"setSettingString",ac,EditorAPI),y($c,1,"getSettingString",sc,EditorAPI),y($c,1,"setSettingColor",ic,EditorAPI),y($c,1,"getSettingColor",oc,EditorAPI),y($c,1,"setSettingColorRGBA",nc,EditorAPI),y($c,1,"getSettingColorRGBA",rc,EditorAPI),y($c,1,"setSettingEnum",tc,EditorAPI),y($c,1,"getSettingEnum",ec,EditorAPI),y($c,1,"setRole",Jl,EditorAPI),y($c,1,"getRole",Zl,EditorAPI),y($c,1,"findAllSettings",Ql,EditorAPI),y($c,1,"getAvailableMemory",Kl,EditorAPI),y($c,1,"getUsedMemory",Yl,EditorAPI),y($c,1,"getMaxExportSize",Xl,EditorAPI),y($c,1,"setURIResolver",Gl,EditorAPI),y($c,1,"unstable_getURIResolver",Vl,EditorAPI),y($c,1,"findAllScopes",zl,EditorAPI),y($c,1,"setGlobalScope",Nl,EditorAPI),y($c,1,"getGlobalScope",Hl,EditorAPI),y($c,1,"findAllSpotColors",Wl,EditorAPI),y($c,1,"getSpotColorRGBA",Ul,EditorAPI),y($c,1,"getSpotColorCMYK",ql,EditorAPI),y($c,1,"setSpotColorRGB",$l,EditorAPI),y($c,1,"setSpotColorCMYK",jl,EditorAPI),y($c,1,"removeSpotColor",Ol,EditorAPI),y($c,1,"setSpotColorForCutoutType",Bl,EditorAPI),y($c,1,"getSpotColorForCutoutType",Dl,EditorAPI),y($c,1,"convertColorToColorSpace",Rl,EditorAPI),y($c,1,"isHighlightingEnabled",Ll,EditorAPI),y($c,1,"setHighlightingEnabled",Il,EditorAPI),m($c,EditorAPI);var Uc,Wc,Hc,Nc,zc,Vc,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))}}};Nc=[pr({disabledInModes:["Playback"]})],Hc=[fr],Wc=[pr({disabledInModes:["Playback"]})],Uc=[fr];var VariableAPI=class{constructor(e){b(Vc,5,this),C(this,zc),E(this,zc,e)}findAll(){return lr(_(this,zc).findAllVariables())}setString(e,t){return Gt("key",e,$t()),Gt("value",t,$t()),sr(_(this,zc).setVariableString(e,t))}getString(e){return Gt("key",e,$t()),sr(_(this,zc).getVariableString(e))}remove(e){return Gt("key",e,$t()),sr(_(this,zc).removeVariable(e))}};function Gc(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}Vc=h(null),zc=new WeakMap,y(Vc,1,"findAll",Nc,VariableAPI),y(Vc,1,"setString",Hc,VariableAPI),y(Vc,1,"getString",Wc,VariableAPI),y(Vc,1,"remove",Uc,VariableAPI),m(Vc,VariableAPI);var Xc=async function(e,t,r=fetch,n,o=new Set(n.findAllSources())){const i=e.map((async e=>{const i=Gc(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;o.has(e)||n.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",t);r.meta&&(r.meta[e]=n)}})),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))})),n.addAssetToSource(e,r)}))}))}));await Promise.all(i)},Yc=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=Gc(e,`/${_CaptionPresetAssetSource.assetSourceId}/content.json`),n=await t(r);if(!n.ok)throw new Error(n.statusText);const o=await n.json();if(void 0===o.assets)throw new Error(`Invalid content.json for assets: ${_CaptionPresetAssetSource.assetSourceId}`);return o.assets.map((t=>(t.meta&&Object.entries(t.meta).forEach((([r,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",e);t.meta&&(t.meta[r]=n)}})),t)))}createSource(){this.#s.asset.addSource({id:_CaptionPresetAssetSource.assetSourceId,findAssets:({page:e,perPage:t,excludeGroups:r,groups:n,locale:o="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(n&&n.length>0&&(h=h.filter((e=>e.groups?.some((e=>n.includes(e)))))),i&&""!==i.trim()){const e=i.toLowerCase().trim();h=h.filter((t=>(t.label?.[o]?.toLowerCase()||"").includes(e)))}c&&c.length>0&&(h=h.filter((e=>(e.tags?.[o]??[]).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?.[o]?.toLocaleLowerCase()||"",n=t.label?.[o]?.toLocaleLowerCase()||"";return r<n?"Ascending"===l?-1:1:r>n?"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?.[o],active:e.id===u,context:{id:_CaptionPresetAssetSource.assetSourceId},meta:e.meta,groups:e.groups,tags:e.tags?.[o],payload:{...e.payload,properties:t},locale:o}}));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 n=await this.#l(r);if(!n.ok)throw new Error(`Failed to fetch the preset block from ${r}`);const o=await n.text(),[i]=await this.#s.block.loadFromString(o),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"),n=this.#s.block.getPropertyType(r),o=e.replace("{{blockType}}","caption");switch(n){case"Int":{const e=this.#s.block.getInt(i,r);this.#s.block.setInt(t,o,e);break}case"Float":{const e=this.#s.block.getFloat(i,r);this.#s.block.setFloat(t,o,e);break}case"Double":{const e=this.#s.block.getDouble(i,r);this.#s.block.setDouble(t,o,e);break}case"Bool":{const e=this.#s.block.getBool(i,r);this.#s.block.setBool(t,o,e);break}case"Enum":{if("stroke/position"===r)break;const e=this.#s.block.getEnum(i,r);this.#s.block.setEnum(t,o,e);break}case"Color":{if("fill/solid/color"===r){const[e]=this.#s.block.getTextColors(i);this.#s.block.setColor(t,o,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,o,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,o,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],n=(()=>{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!=n&&this.#s.block.isValid(n)&&this.#s.block.destroy(n),this.#s.block.isValid(r)){const n=this.#s.block.duplicate(r);switch(t){case"in":this.#s.block.setInAnimation(e,n);break;case"loop":this.#s.block.setLoopAnimation(e,n);break;case"out":this.#s.block.setOutAnimation(e,n)}}};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[n]=this.#s.block.findAllSelected(),o="//ly.img.ubq/caption"===(null!=n?this.#s.block.getType(n):void 0)?n:this.#s.block.getChildren(r)[0];if(null!=o){switch(t.type){case"Color":if("fill/solid/color"===t.property){this.#s.block.setColor(o,t.property,t.value),this.#s.block.setTextColor(o,t.value);break}this.#s.block.setColor(o,t.property,t.value);break;case"Int":this.#s.block.setInt(o,t.property,t.value);break;case"Float":if("caption/scale"===t.property){const e=this.fetchCaptionScale(),r=this.#s.block.getTextFontSizes(o)[0]/e,n=Math.round(r*t.value);if(this.#s.block.setTextFontSize(o,n),this.#s.block.isStrokeEnabled(o)){const r=this.#s.block.getStrokeWidth(o)/e*t.value;this.#s.block.setStrokeWidth(o,r)}if(this.#s.block.isDropShadowEnabled(o)){const r=this.#s.block.getDropShadowOffsetX(o),n=this.#s.block.getDropShadowOffsetY(o)/e,i=this.#s.block.getDropShadowBlurRadiusX(o)/e,s=this.#s.block.getDropShadowBlurRadiusY(o)/e,a=r/e*t.value,l=n*t.value,c=i*t.value,d=s*t.value;this.#s.block.setDropShadowOffsetX(o,a),this.#s.block.setDropShadowOffsetY(o,l),this.#s.block.setDropShadowBlurRadiusX(o,c),this.#s.block.setDropShadowBlurRadiusY(o,d)}this.storeCaptionScale(t.value);break}this.#s.block.setFloat(o,t.property,t.value);break;case"Double":this.#s.block.setDouble(o,t.property,t.value);break;case"Boolean":this.#s.block.setBool(o,t.property,t.value);break;case"Enum":this.#s.block.setEnum(o,t.property,t.value);break;case"String":this.#s.block.setString(o,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 n=await _CaptionPresetAssetSource.fetchAssets(t,r);return new _CaptionPresetAssetSource(e,n,r)}};var Kc=async function(e,t,r,n){const o=["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 Xc(o,t,n,e.asset),r.includes("ly.img.captionPresets")||await Yc.create(e,t,n)},Qc=(e=>(e[e.Information=0]="Information",e[e.Warning=1]="Warning",e[e.Error=2]="Error",e))(Qc||{}),Zc=(e=>(e[e.Free=0]="Free",e[e.VerticalStack=1]="VerticalStack",e[e.HorizontalStack=2]="HorizontalStack",e[e.DepthStack=3]="DepthStack",e))(Zc||{});var Jc=async function(e,t,r,n,o,i,s="https://cdn.img.ly/assets/demo/v2"){const a=new Set(e.findAllSources()),l="ly.img.image.upload";!o||r.includes(l)||a.has(l)||e.addLocalSource(l,["image/jpeg","image/png","image/webp","image/svg+xml","image/bmp",..."Design"===n?["image/gif"]:[]]);const c="ly.img.video.upload";"Video"!==n||!o||r.includes(c)||a.has(c)||e.addLocalSource(c,["application/json","video/mp4","video/quicktime","video/webm","video/matroska","image/gif"]);const d="ly.img.audio.upload";"Video"!==n||!o||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"!==n||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 Xc(u,s,i,e)};function ed(e,t){let r;const n=new Set;function o(){const n=window.devicePixelRatio,{width:i,height:s}=e.getBoundingClientRect();t(i*n,s*n,n),r=matchMedia(`(resolution: ${n}dppx)`),r.addEventListener("change",o,{once:!0})}o();const i=new ResizeObserver((function([e]){const{width:r,height:o}=e.target.getBoundingClientRect();if(r<=0||o<=0)return;const i=window.devicePixelRatio,s=setTimeout((function(){n.delete(s),t(r*i,o*i,i)}),0);n.add(s)}));return i.observe(e),()=>{r.removeEventListener("change",o),i.disconnect();for(const e of n)clearTimeout(e);n.clear(),e=null,t=null}}var td=u(ht());function rd(e,t){const r=new Set;function n(n){r.add(n);e?.(((e,...t)=>{n(e);for(const e of t)n(e)}));return()=>{r.delete(n),t?.()}}return n.emit=function(e,...t){for(const n of r){n(e);for(const e of t)n(e)}},n.handlers=r,n}var nd=e=>t=>function(r){return t((function(t){r(e(t))}))};function od(e){return t=>function(r){let n=!1;const o=t((function(e){n=!0,r(e)}));return n||r(e instanceof Function?e():e),o}}var id=(e=((e,t)=>e===t))=>t=>function(r){let n;return t((function(t){e(t,n)||(n=t,r(t))}))},sd=e=>{const t=new Set;let r=null;return function(n){return t.add(n),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(n),0===t.size&&(r?.(),r=null)}}};function ad(e,...t){return t.reduce(((e,t)=>t(e)),e)}var ld=(...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 cd(e){return function(t){let r=null;const n=e((function(e){r?.(),r=e?e(t):e}));return function(){n(),r?.(),r=null}}}function dd(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),n=t.map(((t,n)=>t((function(t){r[n]=t,e(r)}))));return function(){n.forEach((e=>e())),r.length=0}}}var ud=Symbol("NO_VALUE");function hd(e){let t=ud;const r=rd();return{subscribe:r,value:()=>(t===ud&&(t=e()),t),update(e){t=e,r.emit(t)}}}var pd=u(bt());function fd(e,t){const{block:r,event:n}=t;return ad((t=>{const o=r.getType(e),i=(0,pd.default)(n.subscribe([e],(function(n){n.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==o?i():t(n)})));return i}),sd)}function gd(e,t){if(!t)return e;let r;return(...n)=>{const o=e(...n);return t(o,r)||(r=o),r}}var md=function(e,t,r,n){const o=gd(t,n?.equals),i=rd();return{subscribe:ad(ld(e,i),nd(o),id(),sd),update:r,value:o,flush:()=>i.emit()}};var bd=class{settings;clampCamera=!1;clampResult=hd((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#c;viewportPadding=hd((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_legacyApi:n}=e,o=ad(r.onActiveChanged,od(),nd((()=>r.get()))),i=ad(o,nd((r=>null!=r&&t.isValid(r)?ad(fd(r,e),od([]),nd((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),cd),s=ad(o,nd((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:ad(fd(r,e),od([]),nd((()=>r)))})),cd);this.settings={subscribe:ad(s,nd((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),id(td.default),sd),update({width:e,height:r,pixelRatio:n}){const o=t.findByType("camera")[0];null!=o&&(t.setFloat(o,"camera/resolution/width",e),t.setFloat(o,"camera/resolution/height",r),t.setFloat(o,"camera/pixelRatio",n))},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=md(ld(r.onZoomLevelChanged,i),(()=>{const e=r.get(),{pixelRatio:n}=this.settings.value();return null!=e&&t.isValid(e)?r.getZoomLevel()/n:1}),(e=>{const n=r.get(),{pixelRatio:o}=this.settings.value();null!=n&&t.isValid(n)&&r.setZoomLevel(e*o)})),this.#c={subscribe:ad(s,nd((e=>n.getValue(e,"ubq/designblocks/Camera","zoomLevel"))),id()),value(){const e=t.findByType("camera")[0];return null==e?1:n.getValue(e,"ubq/designblocks/Camera","zoomLevel")}},this.autoFit=md(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:ad(this.clampResult.subscribe,nd((e=>e.scrollPercentage)),id(td.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:ad(dd(this.clampResult.subscribe,this.#c.subscribe,this.settings.subscribe),nd((([e,t,r])=>{const n=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},o=t??this.#c.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:n.x*o/i,y:n.y*o/i}})),id(td.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 n=this.#c.value(),o=this.settings.value().pixelRatio,i=e.x*o/n,s=e.y*o/n,a={x:t.getPositionX(r)+i,y:t.getPositionY(r)+s};t.setPositionX(r,a.x),t.setPositionY(r,a.y)}}};function yd(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 vd="1.61.0-nightly.20250916".includes("nightly")?"https://cdn.img.ly/nightlies/1.61.0-nightly.20250916/packages/imgly/cesdk-engine/1.61.0-nightly.20250916/assets":"https://cdn.img.ly/packages/imgly/cesdk-engine/1.61.0-nightly.20250916/assets";function wd(e,t){return t??="undefined"==typeof window?void 0:window.location.href,new URL(e??"",t).href.replace(/\/*$/,"/")}function kd(e={}){const t={...e,license:e.license??"",baseURL:e.baseURL??vd,core:e.core??{baseURL:"core/"},logger:e.logger??yd,presets:e.presets??{}};return t.baseURL=wd(t.baseURL),t.core.baseURL=wd(t.core.baseURL,t.baseURL),t}var _d={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 Cd(e,t){return t?e.flatMap((e=>{const r=e.warnKeys?.(t);return"string"==typeof r?[r]:r??[]})):[]}function Ed(e,t,r){if(t)for(const n of e)n.applyFallback?.(t,r)}function Sd(e,t){return t?e.reduce(((e,t)=>t.migrateConfigObject?t.migrateConfigObject(e):e),t):t}var xd,Pd,Td,Ad,Fd=[_d,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,n]of Object.entries(e.presets.typefaces))r.addAssetToSource(_TypefaceMigration.APIFALLBACK_TYPEFACES_SOURCE_ID,{id:t,payload:{typeface:{name:n.family,fonts:n.fonts.map((e=>({subFamily:`${e.weight} ${e.style}`,style:e.style,uri:e.fontURL,weight:e.weight})))}}})}}catch(e){console.error(e)}}}];function Md(e,t,r=void 0){const n=e=>{sr(t.setContext("")),e.preventDefault()},o=e=>{sr(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",o,!1),()=>{e.removeEventListener("webglcontextlost",n),e.removeEventListener("webglcontextrestored",o)}}function Id(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}Td=[pr({disabledInModes:["Playback"]})],Pd=[pr({disabledInModes:["Playback"]})],xd=[pr({disabledInModes:["Playback"]})];var Ld=class{constructor(e){b(Ad,5,this),v(this,"ubique"),v(this,"notificationStream",(e=>{const t=this.ubique.addEventCallback("NotificationEvent",(t=>e({type:Qc[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 n=new Promise(((n,o)=>{r=this.ubique.ubqExecute(e,t,(e=>{try{const t=sr(e);n(t)}catch(e){o(e)}}))}));return sr(r),n}sendKey(e){return this.execute("ubq/inputs/keyboardkey",Id(e))}changeSceneLayout(e,t,r,n){return this.execute("ubq/scene/changeLayout",[e,Zc[t],r,n])}};y(Ad=h(null),1,"getSelectedText",Td,Ld),y(Ad,1,"hasComponent",Pd,Ld),y(Ad,1,"getValue",xd,Ld),m(Ad,Ld);var Rd=!1;var Dd="https://api.img.ly/activate";var Bd=u(vt()),Od="./cesdk-v1.61.0-nightly.20250916-44YCFRT6.data",jd="./cesdk-v1.61.0-nightly.20250916-AT7VXXNL.wasm",$d=Bd.default,qd=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Ud=-1!==qd.indexOf("Edge"),Wd=!!qd.match(/msie|trident/i),Hd=/\b(iPad|iPhone|iPod)\b/.test(qd)&&/WebKit/.test(qd)&&!/Edge/.test(qd)&&("undefined"==typeof window||!("MSStream"in window)),Nd=/(WOW64|Win32|i[3-6]86)/.test(navigator.userAgent)||/Win32|i[3-6]86|armv[6-7]/.test(navigator.platform),zd=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function Vd(){try{return new WebAssembly.Memory({initial:Gd(Hd?512:32),maximum:Gd(Nd?1024:2048)})}catch(e){return new WebAssembly.Memory({initial:Gd(32),maximum:Gd(Nd?1024:2048)})}}function Gd(e){return 1024*e*1024/65536}async function Xd(e,t){const{core:r}=t,n=t.logger,o=zd(jd,r.baseURL).toString(),i=zd(Od,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(Dd,{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")?o:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&n(e,"Info")},printErr:e=>{e&&"undefined"!==e&&n(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:Vd()};$d(c).then((async n=>{n.specialHTMLTargets["!canvas"]=e;n.emscripten_ubq_settings_forceWebGL1=Hd||!!t?.forceWebGL1;const o=sr(n.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");sr(e.unlockWithLicense(t))}(o,await a),function(e,t){const r=new EditorAPI(e),n=new AssetAPI(e);if(r.setRole(t.role??"Creator"),Rd){const t=new Ld(e);t.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),t.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e))),t.dispose()}r.setSetting("basePath",t.baseURL),r.setSetting("showBuildVersion",Rd||!1),t.featureFlags?.preventScrolling&&(r.setSetting("touch/singlePointPanning",!1),r.setSetting("touch/dragStartCanSelect",!1)),n.addLocalSource("ly.img.text"),function(){Rd&&(r.setSetting("features/hspSelectiveAdjustmentsEnabled",!1),r.setSetting("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;r.setSetting("features/singlePageModeEnabled",e),r.setSetting("features/effectsEnabled",!0)}(),function(){const t=new VariableAPI(e);(Rd||"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??"")}(o,t),r(o)})).catch(s)}))}var Yd=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?.()}},Kd=u(ht()),Qd=Symbol("NO_VALUE"),Zd=class{callId;_value=Qd;_lastUpdateValue=Qd;_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===Qd||this.revalidate?this.read():this._value}revalidate=!1;invalidate(){this.revalidate=!0}read(){const e=this._readFromEngine();return this.revalidate=!1,(0,Kd.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=Qd,!0}}update(e){this._readFromEngine=e}isDisabledInMode(e){return this._disabledInModes.includes(e)}},Jd=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 Zd(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 Yd(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){zr[r]??=0;const n=zr[r]++;return function(...o){const i=this,s=`${r}${n}-${JSON.stringify(o,null,0)}`;function a(){return Reflect.apply(t,i,o)}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(),n=[];let o=!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(o)throw new Error("Disposed @getter proxy called");const n=this,s=`${r}-${a.toString()}-${JSON.stringify(t,null,0)}`;function c(){return Reflect.apply(i,n,t)}return e._getterCalled(s,c,l),e.read(s,c)};const l=i[hr].disabledInModes;n.push(Vr(t,a,i)),t[a]=s}else if("setter"===i[hr].type){let r=function(...t){if(o)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};n.push(Vr(t,a,i)),t[a]=r}}var s;return function(){o=!0;for(const e of n)e();n.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear()}},eu='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 tu(e,t){let r;return t.onStateChanged((()=>{const n=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(!Wd&&!Ud)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 eu;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(n!==r){r=n;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(t)&&e.style.setProperty("cursor",n)}}))}var ru=function(e,t,r,n,o){let i,s=null;const a=n.onStateChanged((()=>{i=n.getEditMode(),"Text"!==i||s?"Text"!==i&&s&&(s(),s=null):s=function(){const i=s();return()=>{i?.()};function s(){const i=window.visualViewport?.height;let s=!1,a="";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 l=u();p();const c=f();function d(){const t=window.visualViewport?.height;if(i&&(!(!i||!t)&&i>t)){const t=document.body.offsetHeight-e.getBoundingClientRect().bottom,r=window.visualViewport?.height??0,n=i-r;e.style.height=`${e.offsetHeight-n+t}px`}else e.style.height="",window.visualViewport?.removeEventListener("resize",d),D()}return e.parentElement.appendChild(l),Hd&&window.visualViewport?.addEventListener("resize",d),g(),()=>{c(),h()};function u(){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 h(){l.blur(),l.remove()}function p(){const t=n.getTextCursorPositionInScreenSpaceX(),r=n.getTextCursorPositionInScreenSpaceY(),{left:o,top:i}=e.getBoundingClientRect();l.style.left=`${o+t/window.devicePixelRatio}px`,l.style.top=`${i+r/window.devicePixelRatio}px`}function f(){const t=e.getRootNode();l.addEventListener("input",_),l.addEventListener("keydown",E),l.addEventListener("copy",v),l.addEventListener("cut",w),l.addEventListener("compositionstart",S),l.addEventListener("compositionend",x),l.addEventListener("beforeinput",F),l.addEventListener("focusout",M),t.addEventListener("touchend",A),t.addEventListener("mousedown",A),t.addEventListener("mouseup",T);const r=n.onStateChanged((()=>{p()}));return()=>{l.removeEventListener("input",_),l.removeEventListener("keydown",E),l.removeEventListener("copy",v),l.removeEventListener("cut",w),l.removeEventListener("compositionstart",S),l.removeEventListener("compositionend",x),l.removeEventListener("beforeinput",F),l.removeEventListener("focusout",M),t.removeEventListener("mousedown",A),t.removeEventListener("mouseup",T),t.removeEventListener("touchend",A),r()}}function g(){null!==l.parentElement&&(l.focus(),m()||setTimeout((()=>l.focus()),0))}function m(){return l.getRootNode().activeElement===l}function b(e){return[...e].length}function y(e){const t=e.selectionEnd??e.selectionStart??0;return b(e.value.substring(0,t))}function v(e){try{const r=t.getSelectedText();""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}catch(e){console.error(e)}}function w(e){try{const r=t.getSelectedText();if(""!==r&&e.clipboardData){e.clipboardData.setData("text/plain",r),e.preventDefault();const n={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",n)}}catch(e){console.error(e)}}async function k(){return!(!s||r.unstable_isTextCursorInCompositionRange())&&(await x(),!0)}function _(e){const r=e.target,{value:n}=r;if(s){const e=y(l);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&(r.value="")}function C(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(e){if(k(),1===e.key.length&&(a=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return s&&x(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void D();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=Id(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(l.value="")}async function S(){s=!0,await t.execute("ubq/text/compositionStart")}async function x(){s?(s=!1,l.value="",t.execute("ubq/text/compositionEnd")):l.value=""}async function P(){if(!s)return;o();if(await k())return;const e=r.unstable_getCursorPosition(),t=r.unstable_getCompositionRange(),n=e.end-t.start,i=y(l);e.start>=t.start&&e.start<=1+t.end&&n!==i&&x()}async function T(){P()}async function A(t){P(),t.target===e&&"Text"===n.getEditMode()&&(g(),t.preventDefault())}async function F(e){if(s&&!e.isComposing&&x(),null===e.data)return;const r=e.target,n=e.data;if(await k())C(a);else if(s){const e=b(n);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&("\n"!==n[0]&&C(n),r.value="")}function M(e){if(R(e.relatedTarget)&&I(e.relatedTarget));else{L(e)}}function I(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function L(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),n=e.dispatchEvent(r);return n&&g(),n}function R(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 D(){n.setEditMode("Transform")}}}()}));return()=>{s?.(),a()}};function nu(e,t,r){const n=[],o=r=>{if("touch"===r.pointerType)return;const n=ou(e,r);t.execute("ubq/inputs/mousemove",n)},i=r=>{if("touch"===r.pointerType)return;const n=e.getBoundingClientRect();if(r.clientX>=n.x&&r.clientX<=n.x+n.width&&r.clientY>=n.y&&r.clientY<=n.y+n.height)return;const o={...ou(e,r),position:{x:1/0,y:1/0}};t.execute("ubq/inputs/mousemove",o)},s=o=>{if("touch"===o.pointerType)return;const i={...ou(e,o),button:iu(o.button),state:0,shiftIsHeld:!!o.shiftKey,commandIsHeld:!!o.metaKey};n[o.button]=!1,o.currentTarget.releasePointerCapture(o.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const o={...ou(e,r),button:iu(r.button),state:1,shiftIsHeld:!!r.shiftKey,commandIsHeld:!!r.metaKey};n[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",o)},l=r=>{if("touch"===r.pointerType)return;const o={...ou(e,r),shiftIsHeld:!!r.shiftKey,commandIsHeld:!!r.metaKey};n.forEach(((e,r)=>{if(e){const e={...o,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),n.length=0},c=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",s),e.addEventListener("pointercancel",s),e.addEventListener("pointermove",o),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",o),e.removeEventListener("pointerleave",i),e.removeEventListener("lostpointercapture",l),e.removeEventListener("touchmove",c),e=null}}function ou(e,t){const r=e.getBoundingClientRect(),n=r?.top??0,o=r?.left??0;return{position:{x:(t.clientX-o)*window.devicePixelRatio,y:(t.clientY-n)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function iu(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var su=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=md(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=hd((()=>{})),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=ld(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={...ou(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}}},au=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 n=e.touches.item(r);t[r]=lu(n)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),n=this.touches.find((e=>e.identifier===r.identifier));if(!n)return;n.x=r.clientX,n.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,n],o){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 ${o} rgb(${t},${r},${n})`,i.style.borderRadius="50%",i.style.borderStyle=o,i.style.backgroundColor=`rgba(${t},${r},${n}, 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,n){if(!e){const[t,r,o]=n??[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},${o})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${o}, 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(lu)}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 lu(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 cu=class _PanRecognizer extends au{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=uu(this.touches),t=uu(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&du(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function du(e){return Math.sqrt(e.x**2+e.y**2)}function uu(e){let t=0,r=0;for(let n=0;n<e.length;n++){const o=e[n];t+=o.x,r+=o.y}return t/=e.length,r/=e.length,{x:t,y:r}}var hu=class _PinchRecognizer extends au{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}},pu=class _PointRecognizer extends au{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&&du(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},fu=class _RotateRecognizer extends au{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 gu(e,t,r){const n=[],o=new pu;n.push(o.listen(e)),n.push(o.addListener((n=>{"button"in n?(t.execute("ubq/inputs/mousebutton",mu(e,n)),r.update()):t.execute("ubq/inputs/mousemove",mu(e,n))})));const i=new cu;n.push(i.listen(e)),n.push(i.addListener((r=>{t.execute("ubq/inputs/touchpan",mu(e,r))})));const s=new hu;n.push(s.listen(e)),n.push(s.addListener((r=>{t.execute("ubq/inputs/touchpinch",mu(e,r))})));const a=new fu;return n.push(a.listen(e)),n.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",mu(e,r))}))),()=>{n.forEach((e=>e()))}}function mu(e,t){const r=window.devicePixelRatio??1,{top:n,left:o}=e.getBoundingClientRect();if(1===r&&0===n&&0===o)return t;const i=e=>({x:(e.x-o)*r,y:(e.y-n)*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 bu(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var yu="application/javascript";var vu,wu,ku,_u,Cu,Eu,Su={Info:"Info",Warning:"Warning",Error:"Error"};function xu(e){return{msg:"setVisibility",visible:e}}(wu=vu||(vu={})).start=function(e){return{...e,msg:"exportVideo"}},wu.abort=function(){return{msg:"exportVideoAbort"}},wu.finished=function(e){return{...e,msg:"exportVideoFinished"}},wu.error=function(e){return{...e,msg:"exportVideoError"}},wu.progress=function(e){return{...e,msg:"exportVideoProgress"}},wu.log=function(e){return{...e,msg:"exportLog"}},(_u=ku||(ku={})).start=function(e){return{...e,msg:"exportStatic"}},_u.abort=function(){return{msg:"exportStaticAbort"}},_u.finished=function(e){return{...e,msg:"exportStaticFinished"}},_u.error=function(e){return{...e,msg:"exportStaticError"}},_u.log=function(e){return{...e,msg:"exportLog"}},(Eu=Cu||(Cu={})).start=function(e){return{...e,msg:"exportWithColorMask"}},Eu.abort=function(){return{msg:"exportWithColorMaskAbort"}},Eu.finished=function(e){return{...e,msg:"exportWithColorMaskFinished"}},Eu.error=function(e){return{...e,msg:"exportWithColorMaskError"}},Eu.log=function(e){return{...e,msg:"exportLog"}};var Pu=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Tu(this.configuration),l=new Promise(((e,t)=>{if(s.onmessage=({data:n})=>{switch(n.msg){case"exportVideoFinished":{const t=new Blob([n.data],{type:n.mimeType});e(t);break}case"exportVideoError":t(n.error);break;case"exportVideoProgress":r?.onProgress?.(n.renderedFrames,n.encodedFrames,n.totalFrames);break;case"exportLog":this.configuration.logger(n.message,n.logLevel);break;default:console.error("Unknown message received ",n)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(vu.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(vu.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}async export(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Tu(this.configuration),l=new Promise(((e,t)=>{if(s.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)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(ku.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(ku.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}async exportWithColorMask(e,t,r,n){const{abortSignal:o,inactivityTimeout:i}=r??{},s=await Au(this.configuration),a=Tu(this.configuration),l=new Promise(((e,t)=>{if(s.onmessage=({data:r})=>{switch(r.msg){case"exportWithColorMaskFinished":{const[t,n]=r.data,o=new Blob([t],{type:r.mimeType}),i=new Blob([n],{type:r.mimeType});e([o,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)}},o){let e=!1;const t=()=>{e||(e=!0,s.postMessage(Cu.abort()))};o.addEventListener("abort",t,{once:!0})}}));s.postMessage(Cu.start({sceneString:e,config:a,exportOptions:t,workerOptions:n,inactivityTimeout:i}));const c=()=>{s.postMessage(xu("visible"===document.visibilityState))};document.addEventListener("visibilitychange",c);try{return await l}finally{s.terminate(),document.removeEventListener("visibilitychange",c)}}};function Tu(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 Au(e){const t="assets/core/worker-host-v1.61.0-nightly.20250916.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:yu}))}(new URL(t,e.core.baseURL));return new Worker(r)}var Fu=10;globalThis.ubq_browserTabHidden=!0;var Mu={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 Iu(e,t,r){return async(n,o,i,s)=>{Gt("handle",n,Bt());try{Gt("options",o,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",o,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 o?o:{mimeType:o,onProgress:i,...s},c=l.onProgress,d=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),u=r(),h=t.editor.getActiveLicense(),p={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{p.trackingMetadata=t.editor.getTrackingMetadata()}catch{p.trackingMetadata=void 0}const f={block:n,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 Pu({...e,license:h}).exportVideo(d,f,{abortSignal:l.abortSignal,inactivityTimeout:u,onProgress:c},p)}return async function(e,t,r,n,o){let i,s,a=0,l=null;const c=o.visibility??Mu,d=o.inactivityTimeout,u=c.subscribe((()=>{null!==l&&(l=Date.now()),globalThis.ubq_browserTabHidden=!c.value()}));let h=null;function p(){clearTimeout(s),u(),h?.()}try{let u=function(){!0===c.value()&&null!==l&&Date.now()-l>d?i(new Error("Video export timed out due to inactivity.")):(a<Fu&&g.update(),s=setTimeout(u,1))};const f=new OffscreenCanvas(64,64),g=await Xd(f,{...e,audioOutput:"none"}),m=new SceneAPI(g),b=new BlockAPI(g),y=new EditorAPI(g);if(h=()=>{g.delete()},n?.trackingMetadata&&y.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})`);y.setURIResolver(e)}n?.buffers&&y.restoreBuffers(n.buffers),await m.loadFromString(t,!0);const v=b.getDuration(r.block),w=r.mimeType??"video/mp4";u();const k=await new Promise(((t,n)=>{i=n,e.abortSignal?.addEventListener("abort",(()=>{n(new Error("AbortSignal received"))})),g.exportVideoToBuffer(r.block,r.timeOffset??0,r.duration??v,w,((e,t,r)=>{a=e-t,l=Date.now(),o?.onProgress?.(e,t,r)}),(e=>{"error"in e?n(e.error):t(e)}),{h264Profile:r.h264Profile??77,h264Level:r.h264Level??52,framerate:r.framerate??30,videoBitrate:r.videoBitrate??0,audioBitrate:r.audioBitrate??0,useTargetSize:void 0!==r.targetWidth&&void 0!==r.targetHeight,targetWidth:r.targetWidth??0,targetHeight:r.targetHeight??0})})),_=new Uint8Array(k.byteLength);return _.set(k),p(),{data:_,mimeType:w}}catch(e){throw p(),e}}(l.abortSignal?{...e,abortSignal:l.abortSignal}:e,d,f,p,{onProgress:c,visibility:Du,inactivityTimeout:u}).then((({data:e,mimeType:t})=>new Blob([e],{type:t})))}}var Lu,Ru,Du={value:()=>"visible"===document.visibilityState,subscribe:ad((Lu=document,Ru="visibilitychange",function(e){return Lu.addEventListener(Ru,e),function(){Lu.removeEventListener(Ru,e)}}),nd((()=>"visible"===document.visibilityState)))};var CreativeEngine=class{asset;block;editor;event;scene;variable;reactor;version="1.61.0-nightly.20250916";#u;#h;#p;#f;#e;#g;#m=[];constructor(e,t,r){this.#e=e,this.#g=new Ld(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 su(this,e),this.#m.push(this.#f.dispose);const n=new Jd(this.editor.getEditMode());this.reactor=n;const o=[n.decorateObject(this.#g),n.decorateObject(this.block),n.decorateObject(this.editor),n.decorateObject(this.scene),n.decorateObject(this.variable)];let i=(0,_t.default)(n.updateDirtyReactions.bind(n),1e3/120,{leading:!0,trailing:!1}),s=this.addPostUpdateCallback(i);const a=this.editor.onStateChanged((()=>{n.currentMode=this.editor.getEditMode(),i="Playback"===n.currentMode?(0,_t.default)(n.updateDirtyReactions.bind(n),100,{leading:!0,trailing:!1}):(0,_t.default)(n.updateDirtyReactions.bind(n),1e3/120,{leading:!0,trailing:!1});const e=this.addPostUpdateCallback(i);s(),s=e}));this.#m.push((()=>{o.forEach((e=>e())),a(),s(),this.reactor.dispose()})),this.block.exportVideo=Iu(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(n,o,i)=>{Gt("handle",n,Bt());try{Gt("options",o,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(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",o,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(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 o?o:{mimeType:o,...i},l=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),c=r(),d=t.editor.getActiveLicense(),u={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{u.trackingMetadata=t.editor.getTrackingMetadata()}catch{u.trackingMetadata=void 0}const h={block:n,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 Pu({...e,license:d}).export(l,h,{abortSignal:a.abortSignal,inactivityTimeout:c},u)}}(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(n,o,i,s,a,l)=>{Gt("handle",n,Bt());try{Gt("maskColorR",o,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(Lt()),exportPdfWithUnderlayer:jt(Lt()),underlayerSpotColorName:jt($t()),underlayerOffset:jt(Bt()),abortSignal:jt(er())})))}catch(e){try{Gt("mimeType",o,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(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 o?(d=o,u=i,h=s,p=a??{}):(d=i,u=s,h=a,p={mimeType:o,...l});const f=await t.scene.saveToString(["blob","bundle","file","http","https","buffer","opfs"]),g=r(),m=t.editor.getActiveLicense(),b={uriResolver:t.editor.unstable_getURIResolver()?.toString(),buffers:t.editor.cloneBuffers()};try{b.trackingMetadata=t.editor.getTrackingMetadata()}catch{b.trackingMetadata=void 0}const y={block:n,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 Pu({...e,license:m}).exportWithColorMask(f,y,{abortSignal:p.abortSignal,inactivityTimeout:g},b)}}(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 bd(this),this.#b(),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.legacyAPI=this.#g)}async 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}};await 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,n=t.width*r,o=t.height*r;e.width!==n&&(e.width=n),e.height!==o&&(e.height=o)}#v(){const{width:e,height:t}=this.#h,r="undefined"!=typeof window?window.devicePixelRatio:1,{height:n,width:o,pixelRatio:i}=this.#u.settings.value();if(!bu(o,e,1e-4)||!bu(n,t,1e-4)||!bu(i,r,1e-4)){this.#u.settings.update({height:t,width:e,pixelRatio:r});const n=this.scene.get();if(!bu(i,r,1e-4)&&null!==n&&!1===this.scene.isZoomAutoFitEnabled(n)){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,n=0;if(this.#_)return;const o=()=>{if(this.#_=requestAnimationFrame(o),!r)try{this.#S(e),n=0}catch(e){throw n++,n>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),this.#x()),e}};this.#_=requestAnimationFrame(o)}#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),n=[nu(t,this.#g,r),this.#f.initialize(t),ru(t,this.#g,this.#e,this.editor,r),tu(t,this.editor),gu(t,this.#g,this.#e),Md(this.#h,this.#e,(()=>{this.#h.width=this.#h.width})),ed(t,this.#P)];this.#T=()=>{n.reverse().forEach((e=>e()))}}setWheelEventTarget(e){return this.#f.setTarget(e)}#P=(0,wt.default)(function(){this.#S()}.bind(this),100,{leading:!0,trailing:!1});#T;#x(){this.#T?.(),this.#T=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 n="44b1b287d2",o="1.61.0-nightly.20250916";if(n||o){const e=["[CreativeEngine]"];o&&e.push(`v${o}`),n&&e.push(`Revision ${n}`),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=kd(Sd(Fd,e));if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of Cd(Fd,e))s.logger(t,"Warning");const a=new this(await Xd(r,s),i??r,s);return Object.defineProperty(a,"version",{configurable:!1,writable:!1}),Ed(Fd,s,a),a}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v4",excludeAssetSourceIds:t=[]}={}){return Kc(this,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:n=!1}={}){return Jc(this.asset,this.scene,t,r,n,void 0,e)}get _camera(){return this.#u}get _legacyApi(){return this.#g}};var Bu=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},Ou=1e4,ju=1e6,$u=8;async function qu(){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),n=r.getContext("webgl2");if(!n)throw new Error("Could not create WebGL2 context");return n.clearColor(1,0,1,1),n.clear(n.COLOR_BUFFER_BIT),new Promise(((e,n)=>{setTimeout((()=>{n(new Error("Timed out during video export"))}),Ou);const o=new VideoEncoder({output:()=>e(),error:e=>n(new Error(`Could not create a new VideoEncoder: ${e}`))});try{o.configure(t)}catch(e){throw new Error(`Failed to configure a VideoEncoder object with ${JSON.stringify(t)}: ${e}`)}for(let e=0;e<$u;++e){const n=new VideoFrame(r,{timestamp:e*(ju/t.framerate),duration:ju/t.framerate});o.encode(n,{keyFrame:!0}),n.close()}o.flush().then((()=>{"closed"!==o.state&&o.close()}),(e=>{n(new Error(`Error during video export: ${e}`))}))}))}async function Uu(){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"))}),Ou);const n=new AudioEncoder({output:()=>e(),error:e=>r(new Error(`Could not create a new AudioEncoder with ${JSON.stringify(t)}: ${e}`))});try{n.configure(t)}catch(e){throw new Error(`Failed to configure an AudioEncoder object with ${JSON.stringify(t)}: ${e}`)}const o=1024,i=new Float32Array(o*t.numberOfChannels);for(let e=0;e<o;++e){const t=e/o;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:o,numberOfChannels:t.numberOfChannels,timestamp:e*o/t.sampleRate*ju,data:i});n.encode(r),r.close()}catch(e){throw new Error(`Failed to encode AudioData in an encoder configured with ${JSON.stringify(t)}: ${e}`)}n.flush().then((()=>{"closed"!==n.state&&n.close()}),(e=>{r(new Error(`Error during audio export with ${t}: ${e}`))}))}))}function Wu(){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 Hu(){try{return Wu(),!0}catch{return!1}}async function Nu(){await Promise.all([qu(),Uu()])}async function zu(){try{return await Nu(),!0}catch(e){return!1}}var Vu,Gu,Xu=function(){try{const e=!0,t=!0,r="globalThis"in window,n="BigInt"in window,o="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 Bu()&&e&&t&&r&&n&&o&&i&&s&&a&&l}catch{return!1}};(Gu=Vu||(Vu={})).combineLatest=dd,Gu.fan=sd,Gu.makeSource=rd,Gu.map=nd,Gu.memo=id,Gu.merge=ld,Gu.pipe=ad,Gu.startWith=od,Gu.switchAll=cd;export{Su as LogLevel,Vt as MimeType,Pu as WorkerClient,Ed as _applyFallback,fd as _getBlockStream,kd as _initWithDefaults,md as _makeEngineChannel,hd as _makeValueChannel,gd as _memoizeResult,Sd as _migrateConfigObject,Vu as _streams,Cd as _warnKeys,Nu as checkVideoExportSupport,Wu as checkVideoSupport,CreativeEngine as default,yd as defaultLogger,Ml as isCMYKColor,Al as isRGBAColor,Fl as isSpotColor,wd as normalizeBaseURL,Xu as supportsBrowser,Hu as supportsVideo,zu as supportsVideoExport,Bu as supportsWasm};
|