jassub 1.7.12 → 1.7.14

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.
Files changed (175) hide show
  1. package/dist/jassub-worker-modern.wasm +0 -0
  2. package/dist/jassub-worker.js +11 -11
  3. package/dist/jassub-worker.wasm +0 -0
  4. package/dist/jassub-worker.wasm.js +1 -1
  5. package/package.json +4 -2
  6. package/dist/js/jassub-worker-modern.js +0 -10
  7. package/dist/js/jassub-worker-modern.wasm +0 -0
  8. package/dist/js/jassub-worker.js +0 -10
  9. package/dist/js/jassub-worker.wasm +0 -0
  10. package/dist/js/jassub-worker.wasm.js +0 -84
  11. package/dist/js/jassub.js +0 -832
  12. package/dist/libraries/bin/brotli.js +0 -1
  13. package/dist/libraries/include/ass/ass.h +0 -812
  14. package/dist/libraries/include/ass/ass_types.h +0 -292
  15. package/dist/libraries/include/brotli/decode.h +0 -344
  16. package/dist/libraries/include/brotli/encode.h +0 -448
  17. package/dist/libraries/include/brotli/port.h +0 -288
  18. package/dist/libraries/include/brotli/types.h +0 -83
  19. package/dist/libraries/include/expat.h +0 -1064
  20. package/dist/libraries/include/expat_config.h +0 -115
  21. package/dist/libraries/include/expat_external.h +0 -165
  22. package/dist/libraries/include/fontconfig/fcfreetype.h +0 -59
  23. package/dist/libraries/include/fontconfig/fcprivate.h +0 -134
  24. package/dist/libraries/include/fontconfig/fontconfig.h +0 -1154
  25. package/dist/libraries/include/freetype2/freetype/config/ftconfig.h +0 -63
  26. package/dist/libraries/include/freetype2/freetype/config/ftheader.h +0 -824
  27. package/dist/libraries/include/freetype2/freetype/config/ftmodule.h +0 -20
  28. package/dist/libraries/include/freetype2/freetype/config/ftoption.h +0 -1011
  29. package/dist/libraries/include/freetype2/freetype/config/ftstdlib.h +0 -175
  30. package/dist/libraries/include/freetype2/freetype/config/integer-types.h +0 -245
  31. package/dist/libraries/include/freetype2/freetype/config/mac-support.h +0 -49
  32. package/dist/libraries/include/freetype2/freetype/config/public-macros.h +0 -120
  33. package/dist/libraries/include/freetype2/freetype/freetype.h +0 -4833
  34. package/dist/libraries/include/freetype2/freetype/ftadvanc.h +0 -188
  35. package/dist/libraries/include/freetype2/freetype/ftbbox.h +0 -101
  36. package/dist/libraries/include/freetype2/freetype/ftbdf.h +0 -212
  37. package/dist/libraries/include/freetype2/freetype/ftbitmap.h +0 -329
  38. package/dist/libraries/include/freetype2/freetype/ftbzip2.h +0 -102
  39. package/dist/libraries/include/freetype2/freetype/ftcache.h +0 -1087
  40. package/dist/libraries/include/freetype2/freetype/ftchapters.h +0 -147
  41. package/dist/libraries/include/freetype2/freetype/ftcid.h +0 -167
  42. package/dist/libraries/include/freetype2/freetype/ftcolor.h +0 -1609
  43. package/dist/libraries/include/freetype2/freetype/ftdriver.h +0 -1193
  44. package/dist/libraries/include/freetype2/freetype/fterrdef.h +0 -279
  45. package/dist/libraries/include/freetype2/freetype/fterrors.h +0 -296
  46. package/dist/libraries/include/freetype2/freetype/ftfntfmt.h +0 -93
  47. package/dist/libraries/include/freetype2/freetype/ftgasp.h +0 -143
  48. package/dist/libraries/include/freetype2/freetype/ftglyph.h +0 -664
  49. package/dist/libraries/include/freetype2/freetype/ftgxval.h +0 -354
  50. package/dist/libraries/include/freetype2/freetype/ftgzip.h +0 -151
  51. package/dist/libraries/include/freetype2/freetype/ftimage.h +0 -1276
  52. package/dist/libraries/include/freetype2/freetype/ftincrem.h +0 -348
  53. package/dist/libraries/include/freetype2/freetype/ftlcdfil.h +0 -323
  54. package/dist/libraries/include/freetype2/freetype/ftlist.h +0 -296
  55. package/dist/libraries/include/freetype2/freetype/ftlogging.h +0 -184
  56. package/dist/libraries/include/freetype2/freetype/ftlzw.h +0 -100
  57. package/dist/libraries/include/freetype2/freetype/ftmac.h +0 -289
  58. package/dist/libraries/include/freetype2/freetype/ftmm.h +0 -752
  59. package/dist/libraries/include/freetype2/freetype/ftmodapi.h +0 -806
  60. package/dist/libraries/include/freetype2/freetype/ftmoderr.h +0 -204
  61. package/dist/libraries/include/freetype2/freetype/ftotval.h +0 -206
  62. package/dist/libraries/include/freetype2/freetype/ftoutln.h +0 -586
  63. package/dist/libraries/include/freetype2/freetype/ftparams.h +0 -203
  64. package/dist/libraries/include/freetype2/freetype/ftpfr.h +0 -179
  65. package/dist/libraries/include/freetype2/freetype/ftrender.h +0 -244
  66. package/dist/libraries/include/freetype2/freetype/ftsizes.h +0 -159
  67. package/dist/libraries/include/freetype2/freetype/ftsnames.h +0 -272
  68. package/dist/libraries/include/freetype2/freetype/ftstroke.h +0 -773
  69. package/dist/libraries/include/freetype2/freetype/ftsynth.h +0 -83
  70. package/dist/libraries/include/freetype2/freetype/ftsystem.h +0 -352
  71. package/dist/libraries/include/freetype2/freetype/fttrigon.h +0 -350
  72. package/dist/libraries/include/freetype2/freetype/fttypes.h +0 -615
  73. package/dist/libraries/include/freetype2/freetype/ftwinfnt.h +0 -276
  74. package/dist/libraries/include/freetype2/freetype/t1tables.h +0 -773
  75. package/dist/libraries/include/freetype2/freetype/ttnameid.h +0 -1235
  76. package/dist/libraries/include/freetype2/freetype/tttables.h +0 -855
  77. package/dist/libraries/include/freetype2/freetype/tttags.h +0 -123
  78. package/dist/libraries/include/freetype2/ft2build.h +0 -42
  79. package/dist/libraries/include/fribidi/fribidi-arabic.h +0 -81
  80. package/dist/libraries/include/fribidi/fribidi-begindecls.h +0 -3
  81. package/dist/libraries/include/fribidi/fribidi-bidi-types-list.h +0 -96
  82. package/dist/libraries/include/fribidi/fribidi-bidi-types.h +0 -405
  83. package/dist/libraries/include/fribidi/fribidi-bidi.h +0 -142
  84. package/dist/libraries/include/fribidi/fribidi-brackets.h +0 -89
  85. package/dist/libraries/include/fribidi/fribidi-char-sets-list.h +0 -54
  86. package/dist/libraries/include/fribidi/fribidi-char-sets.h +0 -106
  87. package/dist/libraries/include/fribidi/fribidi-common.h +0 -158
  88. package/dist/libraries/include/fribidi/fribidi-config.h +0 -23
  89. package/dist/libraries/include/fribidi/fribidi-deprecated.h +0 -175
  90. package/dist/libraries/include/fribidi/fribidi-enddecls.h +0 -3
  91. package/dist/libraries/include/fribidi/fribidi-flags.h +0 -72
  92. package/dist/libraries/include/fribidi/fribidi-joining-types-list.h +0 -44
  93. package/dist/libraries/include/fribidi/fribidi-joining-types.h +0 -249
  94. package/dist/libraries/include/fribidi/fribidi-joining.h +0 -74
  95. package/dist/libraries/include/fribidi/fribidi-mirroring.h +0 -86
  96. package/dist/libraries/include/fribidi/fribidi-shape.h +0 -71
  97. package/dist/libraries/include/fribidi/fribidi-types.h +0 -79
  98. package/dist/libraries/include/fribidi/fribidi-unicode-version.h +0 -10
  99. package/dist/libraries/include/fribidi/fribidi-unicode.h +0 -105
  100. package/dist/libraries/include/fribidi/fribidi.h +0 -129
  101. package/dist/libraries/include/harfbuzz/hb-aat-layout.h +0 -795
  102. package/dist/libraries/include/harfbuzz/hb-aat.h +0 -38
  103. package/dist/libraries/include/harfbuzz/hb-blob.h +0 -160
  104. package/dist/libraries/include/harfbuzz/hb-buffer.h +0 -799
  105. package/dist/libraries/include/harfbuzz/hb-common.h +0 -902
  106. package/dist/libraries/include/harfbuzz/hb-cplusplus.hh +0 -221
  107. package/dist/libraries/include/harfbuzz/hb-deprecated.h +0 -251
  108. package/dist/libraries/include/harfbuzz/hb-draw.h +0 -325
  109. package/dist/libraries/include/harfbuzz/hb-face.h +0 -181
  110. package/dist/libraries/include/harfbuzz/hb-font.h +0 -1108
  111. package/dist/libraries/include/harfbuzz/hb-ft.h +0 -145
  112. package/dist/libraries/include/harfbuzz/hb-map.h +0 -124
  113. package/dist/libraries/include/harfbuzz/hb-ot-color.h +0 -146
  114. package/dist/libraries/include/harfbuzz/hb-ot-deprecated.h +0 -141
  115. package/dist/libraries/include/harfbuzz/hb-ot-font.h +0 -45
  116. package/dist/libraries/include/harfbuzz/hb-ot-layout.h +0 -503
  117. package/dist/libraries/include/harfbuzz/hb-ot-math.h +0 -333
  118. package/dist/libraries/include/harfbuzz/hb-ot-meta.h +0 -72
  119. package/dist/libraries/include/harfbuzz/hb-ot-metrics.h +0 -129
  120. package/dist/libraries/include/harfbuzz/hb-ot-name.h +0 -158
  121. package/dist/libraries/include/harfbuzz/hb-ot-shape.h +0 -53
  122. package/dist/libraries/include/harfbuzz/hb-ot-var.h +0 -191
  123. package/dist/libraries/include/harfbuzz/hb-ot.h +0 -49
  124. package/dist/libraries/include/harfbuzz/hb-set.h +0 -200
  125. package/dist/libraries/include/harfbuzz/hb-shape-plan.h +0 -122
  126. package/dist/libraries/include/harfbuzz/hb-shape.h +0 -62
  127. package/dist/libraries/include/harfbuzz/hb-style.h +0 -81
  128. package/dist/libraries/include/harfbuzz/hb-subset-repacker.h +0 -81
  129. package/dist/libraries/include/harfbuzz/hb-subset.h +0 -234
  130. package/dist/libraries/include/harfbuzz/hb-unicode.h +0 -643
  131. package/dist/libraries/include/harfbuzz/hb-version.h +0 -95
  132. package/dist/libraries/include/harfbuzz/hb.h +0 -50
  133. package/dist/libraries/lib/cmake/expat-2.4.7/expat-config-version.cmake +0 -70
  134. package/dist/libraries/lib/cmake/expat-2.4.7/expat-config.cmake +0 -99
  135. package/dist/libraries/lib/cmake/expat-2.4.7/expat-noconfig.cmake +0 -19
  136. package/dist/libraries/lib/cmake/expat-2.4.7/expat.cmake +0 -99
  137. package/dist/libraries/lib/libass.a +0 -0
  138. package/dist/libraries/lib/libass.la +0 -41
  139. package/dist/libraries/lib/libbrotlicommon.a +0 -0
  140. package/dist/libraries/lib/libbrotlidec.a +0 -0
  141. package/dist/libraries/lib/libbrotlienc.a +0 -0
  142. package/dist/libraries/lib/libexpat.a +0 -0
  143. package/dist/libraries/lib/libfontconfig.a +0 -0
  144. package/dist/libraries/lib/libfontconfig.la +0 -41
  145. package/dist/libraries/lib/libfreetype.a +0 -0
  146. package/dist/libraries/lib/libfreetype.la +0 -41
  147. package/dist/libraries/lib/libfribidi.a +0 -0
  148. package/dist/libraries/lib/libfribidi.la +0 -41
  149. package/dist/libraries/lib/libharfbuzz-subset.a +0 -0
  150. package/dist/libraries/lib/libharfbuzz-subset.la +0 -41
  151. package/dist/libraries/lib/libharfbuzz.a +0 -0
  152. package/dist/libraries/lib/libharfbuzz.la +0 -41
  153. package/dist/libraries/lib/pkgconfig/expat.pc +0 -11
  154. package/dist/libraries/lib/pkgconfig/fontconfig.pc +0 -18
  155. package/dist/libraries/lib/pkgconfig/freetype2.pc +0 -14
  156. package/dist/libraries/lib/pkgconfig/fribidi.pc +0 -13
  157. package/dist/libraries/lib/pkgconfig/harfbuzz-subset.pc +0 -12
  158. package/dist/libraries/lib/pkgconfig/harfbuzz.pc +0 -13
  159. package/dist/libraries/lib/pkgconfig/libass.pc +0 -13
  160. package/dist/libraries/lib/pkgconfig/libbrotlicommon.pc +0 -11
  161. package/dist/libraries/lib/pkgconfig/libbrotlidec.pc +0 -12
  162. package/dist/libraries/lib/pkgconfig/libbrotlienc.pc +0 -12
  163. package/dist/libraries/share/aclocal/freetype2.m4 +0 -194
  164. package/dist/libraries/share/doc/expat/AUTHORS +0 -10
  165. package/dist/libraries/share/doc/expat/changelog +0 -1161
  166. package/dist/license/all +0 -951
  167. package/dist/license/all.tmp +0 -307
  168. package/dist/license/brotli +0 -12
  169. package/dist/license/expat +0 -71
  170. package/dist/license/fontconfig +0 -46
  171. package/dist/license/freetype +0 -92
  172. package/dist/license/fribidi +0 -15
  173. package/dist/license/harfbuzz +0 -32
  174. package/dist/license/jassub +0 -0
  175. package/dist/license/libass +0 -28
Binary file
@@ -1,15 +1,15 @@
1
- "use strict";var Module=function(f={}){var f=f,h;f.ready=new Promise((t,r)=>{h=t});var w=t=>console.log(t),y=t=>console.error(t);function _(){h(f)}function P(t,r){if(!t)throw r}let C=null;w=t=>{t==="JASSUB: No usable fontconfig configuration file found, using fallback."?console.debug(t):console.log(t)},y=t=>{t==="Fontconfig error: Cannot load default config file: No such file: (null)"?console.debug(t):console.error(t)},Y=(t=>()=>{t(),self.wasmMemory=H,self.HEAPU8C=new Uint8ClampedArray(H.buffer),self.HEAPU8=new Uint8Array(H.buffer)})(Y);function A(t){throw t}var j,E,k,O,G,U,le,fe,H,ue;function Y(){var t=H.buffer;j=new Int8Array(t),E=new Int16Array(t),k=new Int32Array(t),O=new Uint8Array(t),G=new Uint16Array(t),U=new Uint32Array(t),le=new Float32Array(t),fe=new Float64Array(t)}H=new WebAssembly.Memory({initial:256,maximum:32768}),Y();var ce=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function de(t,r,n){for(var i=r+n,o=r;t[o]&&!(o>=i);)++o;if(o-r>16&&t.buffer&&ce)return ce.decode(t.subarray(r,o));for(var u="";r<o;){var p=t[r++];if(!(p&128)){u+=String.fromCharCode(p);continue}var l=t[r++]&63;if((p&224)==192){u+=String.fromCharCode((p&31)<<6|l);continue}var v=t[r++]&63;if((p&240)==224?p=(p&15)<<12|l<<6|v:p=(p&7)<<18|l<<12|v<<6|t[r++]&63,p<65536)u+=String.fromCharCode(p);else{var g=p-65536;u+=String.fromCharCode(55296|g>>10,56320|g&1023)}}return u}function X(t,r){return t?de(O,t,r):""}function _e(t,r,n,i){A(`Assertion failed: ${X(t)}, at: `+[r?X(r):"unknown filename",n,i?X(i):"unknown function"])}function $e(t,r,n){return 0}function Te(t,r){}function Pe(t,r,n,i){if(!(i>0))return 0;for(var o=n,u=n+i-1,p=0;p<t.length;++p){var l=t.charCodeAt(p);if(l>=55296&&l<=57343){var v=t.charCodeAt(++p);l=65536+((l&1023)<<10)|v&1023}if(l<=127){if(n>=u)break;r[n++]=l}else if(l<=2047){if(n+1>=u)break;r[n++]=192|l>>6,r[n++]=128|l&63}else if(l<=65535){if(n+2>=u)break;r[n++]=224|l>>12,r[n++]=128|l>>6&63,r[n++]=128|l&63}else{if(n+3>=u)break;r[n++]=240|l>>18,r[n++]=128|l>>12&63,r[n++]=128|l>>6&63,r[n++]=128|l&63}}return r[n]=0,n-o}function Ae(t,r,n){return Pe(t,O,r,n)}function at(t,r,n){}function st(t,r,n){return 0}function ot(t,r,n,i){}function lt(t,r,n,i){}function ft(t,r){}function ut(t,r,n,i,o){}function Fe(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${t}`)}}function ct(){for(var t=new Array(256),r=0;r<256;++r)t[r]=String.fromCharCode(r);De=t}var De=void 0;function D(t){for(var r="",n=t;O[n];)r+=De[O[n++]];return r}var Q={},Z={},pe={},dt=48,pt=57;function Se(t){if(t===void 0)return"_unknown";t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=dt&&r<=pt?`_${t}`:t}function je(t,r){return t=Se(t),{[t]:function(){return r.apply(this,arguments)}}[t]}function Oe(t,r){var n=je(r,function(i){this.name=r,this.message=i;var o=new Error(i).stack;o!==void 0&&(this.stack=this.toString()+`
2
- `+o.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},n}var N=void 0;function $(t){throw new N(t)}var xe=void 0;function ge(t){throw new xe(t)}function K(t,r,n){t.forEach(function(l){pe[l]=r});function i(l){var v=n(l);v.length!==t.length&&ge("Mismatched type converter count");for(var g=0;g<t.length;++g)B(t[g],v[g])}var o=new Array(r.length),u=[],p=0;r.forEach((l,v)=>{Z.hasOwnProperty(l)?o[v]=Z[l]:(u.push(l),Q.hasOwnProperty(l)||(Q[l]=[]),Q[l].push(()=>{o[v]=Z[l],++p,p===u.length&&i(o)}))}),u.length===0&&i(o)}function B(t,r,n={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=r.name;if(t||$(`type "${i}" must have a positive integer typeid pointer`),Z.hasOwnProperty(t)){if(n.ignoreDuplicateRegistrations)return;$(`Cannot register type '${i}' twice`)}if(Z[t]=r,delete pe[t],Q.hasOwnProperty(t)){var o=Q[t];delete Q[t],o.forEach(u=>u())}}function gt(t,r,n,i,o){var u=Fe(n);r=D(r),B(t,{name:r,fromWireType:function(p){return!!p},toWireType:function(p,l){return l?i:o},argPackAdvance:8,readValueFromPointer:function(p){var l;if(n===1)l=j;else if(n===2)l=E;else if(n===4)l=k;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(l[p>>u])},destructorFunction:null})}function ht(t){if(!(this instanceof z)||!(t instanceof z))return!1;for(var r=this.$$.ptrType.registeredClass,n=this.$$.ptr,i=t.$$.ptrType.registeredClass,o=t.$$.ptr;r.baseClass;)n=r.upcast(n),r=r.baseClass;for(;i.baseClass;)o=i.upcast(o),i=i.baseClass;return r===i&&n===o}function vt(t){return{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}}function Ee(t){function r(n){return n.$$.ptrType.registeredClass.name}$(r(t)+" instance already deleted")}var ke=!1;function Le(t){}function yt(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}function He(t){t.count.value-=1;var r=t.count.value===0;r&&yt(t)}function Be(t,r,n){if(r===n)return t;if(n.baseClass===void 0)return null;var i=Be(t,r,n.baseClass);return i===null?null:n.downcast(i)}var Ve={};function bt(){return Object.keys(re).length}function mt(){var t=[];for(var r in re)re.hasOwnProperty(r)&&t.push(re[r]);return t}var ee=[];function Ue(){for(;ee.length;){var t=ee.pop();t.$$.deleteScheduled=!1,t.delete()}}var te=void 0;function Ct(t){te=t,ee.length&&te&&te(Ue)}function wt(){f.getInheritedInstanceCount=bt,f.getLiveInheritedInstances=mt,f.flushPendingDeletes=Ue,f.setDelayFunction=Ct}var re={};function _t(t,r){for(r===void 0&&$("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r}function $t(t,r){return r=_t(t,r),re[r]}function he(t,r){(!r.ptrType||!r.ptr)&&ge("makeClassHandle requires ptr and ptrType");var n=!!r.smartPtrType,i=!!r.smartPtr;return n!==i&&ge("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(t,{$$:{value:r}}))}function Tt(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var n=$t(this.registeredClass,r);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=r,n.$$.smartPtr=t,n.clone();var i=n.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?he(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):he(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var u=this.registeredClass.getActualType(r),p=Ve[u];if(!p)return o.call(this);var l;this.isConst?l=p.constPointerType:l=p.pointerType;var v=Be(r,this.registeredClass,l.registeredClass);return v===null?o.call(this):this.isSmartPointer?he(l.registeredClass.instancePrototype,{ptrType:l,ptr:v,smartPtrType:this,smartPtr:t}):he(l.registeredClass.instancePrototype,{ptrType:l,ptr:v})}function ne(t){return typeof FinalizationRegistry>"u"?(ne=r=>r,t):(ke=new FinalizationRegistry(r=>{He(r.$$)}),ne=r=>{var n=r.$$,i=!!n.smartPtr;if(i){var o={$$:n};ke.register(r,o,r)}return r},Le=r=>ke.unregister(r),ne(t))}function Pt(){if(this.$$.ptr||Ee(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:vt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function At(){this.$$.ptr||Ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),Le(this),He(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ft(){return!this.$$.ptr}function St(){return this.$$.ptr||Ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),ee.push(this),ee.length===1&&te&&te(Ue),this.$$.deleteScheduled=!0,this}function jt(){z.prototype.isAliasOf=ht,z.prototype.clone=Pt,z.prototype.delete=At,z.prototype.isDeleted=Ft,z.prototype.deleteLater=St}function z(){}function Je(t,r,n){if(t[r].overloadTable===void 0){var i=t[r];t[r]=function(){return t[r].overloadTable.hasOwnProperty(arguments.length)||$(`Function '${n}' called with an invalid number of arguments (${arguments.length}) - expects one of (${t[r].overloadTable})!`),t[r].overloadTable[arguments.length].apply(this,arguments)},t[r].overloadTable=[],t[r].overloadTable[i.argCount]=i}}function Ot(t,r,n){f.hasOwnProperty(t)?((n===void 0||f[t].overloadTable!==void 0&&f[t].overloadTable[n]!==void 0)&&$(`Cannot register public name '${t}' twice`),Je(f,t,t),f.hasOwnProperty(n)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),f[t].overloadTable[n]=r):(f[t]=r,n!==void 0&&(f[t].numArguments=n))}function Et(t,r,n,i,o,u,p,l){this.name=t,this.constructor=r,this.instancePrototype=n,this.rawDestructor=i,this.baseClass=o,this.getActualType=u,this.upcast=p,this.downcast=l,this.pureVirtualFunctions=[]}function ve(t,r,n){for(;r!==n;)r.upcast||$(`Expected null or instance of ${n.name}, got an instance of ${r.name}`),t=r.upcast(t),r=r.baseClass;return t}function kt(t,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=r.$$.ptrType.registeredClass,i=ve(r.$$.ptr,n,this.registeredClass);return i}function Ut(t,r){var n;if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,n),n):0;r.$$||$(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var i=r.$$.ptrType.registeredClass;if(n=ve(r.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&$("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?n=r.$$.smartPtr:$(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)n=r.$$.smartPtr;else{var o=r.clone();n=this.rawShare(n,Me.toHandle(function(){o.delete()})),t!==null&&t.push(this.rawDestructor,n)}break;default:$("Unsupporting sharing policy")}return n}function Mt(t,r){if(r===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;r.$$||$(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&$(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var n=r.$$.ptrType.registeredClass,i=ve(r.$$.ptr,n,this.registeredClass);return i}function ye(t){return this.fromWireType(k[t>>2])}function Rt(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function Wt(t){this.rawDestructor&&this.rawDestructor(t)}function It(t){t!==null&&t.delete()}function Dt(){V.prototype.getPointee=Rt,V.prototype.destructor=Wt,V.prototype.argPackAdvance=8,V.prototype.readValueFromPointer=ye,V.prototype.deleteObject=It,V.prototype.fromWireType=Tt}function V(t,r,n,i,o,u,p,l,v,g,m){this.name=t,this.registeredClass=r,this.isReference=n,this.isConst=i,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=p,this.rawGetPointee=l,this.rawConstructor=v,this.rawShare=g,this.rawDestructor=m,!o&&r.baseClass===void 0?i?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=Mt,this.destructorFunction=null):this.toWireType=Ut}function xt(t,r,n){f.hasOwnProperty(t)||ge("Replacing nonexistant public symbol"),f[t].overloadTable!==void 0&&n!==void 0?f[t].overloadTable[n]=r:(f[t]=r,f[t].argCount=n)}function Lt(t,r,n){var i=dynCalls[t];return n&&n.length?i.apply(null,[r].concat(n)):i.call(null,r)}var be=[];function ie(t){var r=be[t];return r||(t>=be.length&&(be.length=t+1),be[t]=r=ue.get(t)),r}function Ht(t,r,n){if(t.includes("j"))return Lt(t,r,n);var i=ie(r).apply(null,n);return i}function Bt(t,r){var n=[];return function(){return n.length=0,Object.assign(n,arguments),Ht(t,r,n)}}function q(t,r){t=D(t);function n(){return t.includes("j")?Bt(t,r):ie(r)}var i=n();return typeof i!="function"&&$(`unknown function pointer with signature ${t}: ${r}`),i}var Ge=void 0;function Vt(t){var r=Ne(t),n=D(r);return J(r),n}function ae(t,r){var n=[],i={};function o(u){if(!i[u]&&!Z[u]){if(pe[u]){pe[u].forEach(o);return}n.push(u),i[u]=!0}}throw r.forEach(o),new Ge(`${t}: `+n.map(Vt).join([", "]))}function Jt(t,r,n,i,o,u,p,l,v,g,m,T,F){m=D(m),u=q(o,u),l&&(l=q(p,l)),g&&(g=q(v,g)),F=q(T,F);var S=Se(m);Ot(S,function(){ae(`Cannot construct ${m} due to unbound types`,[i])}),K([t,r,n],i?[i]:[],function(M){M=M[0];var W,R;i?(W=M.registeredClass,R=W.instancePrototype):R=z.prototype;var x=je(S,function(){if(Object.getPrototypeOf(this)!==oe)throw new N("Use 'new' to construct "+m);if(I.constructor_body===void 0)throw new N(m+" has no accessible constructor");var it=I.constructor_body[arguments.length];if(it===void 0)throw new N(`Tried to invoke ctor of ${m} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(I.constructor_body).toString()}) parameters instead!`);return it.apply(this,arguments)}),oe=Object.create(R,{constructor:{value:x}});x.prototype=oe;var I=new Et(m,x,oe,F,W,u,l,g);I.baseClass&&(I.baseClass.__derivedClasses===void 0&&(I.baseClass.__derivedClasses=[]),I.baseClass.__derivedClasses.push(I));var xr=new V(m,I,!0,!1,!1),rt=new V(m+"*",I,!1,!1,!1),nt=new V(m+" const*",I,!1,!0,!1);return Ve[t]={pointerType:rt,constPointerType:nt},xt(S,x),[xr,rt,nt]})}function ze(t,r){for(var n=[],i=0;i<t;i++)n.push(U[r+i*4>>2]);return n}function qe(t){for(;t.length;){var r=t.pop(),n=t.pop();n(r)}}function Gt(t,r){if(!(t instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof t} which is not a function`);var n=je(t.name||"unknownFunctionName",function(){});n.prototype=t.prototype;var i=new n,o=t.apply(i,r);return o instanceof Object?o:i}function Ke(t,r,n,i,o,u){var p=r.length;p<2&&$("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var l=r[1]!==null&&n!==null,v=!1,g=1;g<r.length;++g)if(r[g]!==null&&r[g].destructorFunction===void 0){v=!0;break}for(var m=r[0].name!=="void",T="",F="",g=0;g<p-2;++g)T+=(g!==0?", ":"")+"arg"+g,F+=(g!==0?", ":"")+"arg"+g+"Wired";var S=`
3
- return function ${Se(t)}(${T}) {
4
- if (arguments.length !== ${p-2}) {
5
- throwBindingError('function ${t} called with ${arguments.length} arguments, expected ${p-2} args!');
1
+ "use strict";var Module=function(l={}){var l=l,h;l.ready=new Promise(function(t,r){h=t});var C=function(t){return console.log(t)},y=function(t){return console.error(t)};function _(){h(l)}function A(t,r){if(!t)throw r}var w=null;C=function(t){t==="JASSUB: No usable fontconfig configuration file found, using fallback."?console.debug(t):console.log(t)},y=function(t){t==="Fontconfig error: Cannot load default config file: No such file: (null)"?console.debug(t):console.error(t)},Y=function(t){return function(){t(),self.wasmMemory=B,self.HEAPU8C=new Uint8ClampedArray(B.buffer),self.HEAPU8=new Uint8Array(B.buffer)}}(Y);function F(t){throw t}var j,E,M,O,J,k,fe,le,B,ue;function Y(){var t=B.buffer;j=new Int8Array(t),E=new Int16Array(t),M=new Int32Array(t),O=new Uint8Array(t),J=new Uint16Array(t),k=new Uint32Array(t),fe=new Float32Array(t),le=new Float64Array(t)}if(B=new WebAssembly.Memory({initial:256,maximum:32768}),Y(),(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function(t,r){var n=t>>>16,i=t&65535,o=r>>>16,u=r&65535;return i*u+(n*u+i*o<<16)|0}),!Math.fround){var ce=new Float32Array(1);Math.fround=function(t){return ce[0]=t,ce[0]}}Math.clz32||(Math.clz32=function(t){var r=32,n=t>>16;return n&&(r-=16,t=n),n=t>>8,n&&(r-=8,t=n),n=t>>4,n&&(r-=4,t=n),n=t>>2,n&&(r-=2,t=n),n=t>>1,n?r-2:r-t}),Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)});var de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function pe(t,r,n){for(var i=r+n,o=r;t[o]&&!(o>=i);)++o;if(o-r>16&&t.buffer&&de)return de.decode(t.subarray(r,o));for(var u="";r<o;){var p=t[r++];if(!(p&128)){u+=String.fromCharCode(p);continue}var f=t[r++]&63;if((p&224)==192){u+=String.fromCharCode((p&31)<<6|f);continue}var v=t[r++]&63;if((p&240)==224?p=(p&15)<<12|f<<6|v:p=(p&7)<<18|f<<12|v<<6|t[r++]&63,p<65536)u+=String.fromCharCode(p);else{var g=p-65536;u+=String.fromCharCode(55296|g>>10,56320|g&1023)}}return u}function X(t,r){return t?pe(O,t,r):""}function Te(t,r,n,i){F("Assertion failed: "+X(t)+", at: "+[r?X(r):"unknown filename",n,i?X(i):"unknown function"])}function Pe(t,r,n){return 0}function Ae(t,r){}function Fe(t,r,n,i){if(!(i>0))return 0;for(var o=n,u=n+i-1,p=0;p<t.length;++p){var f=t.charCodeAt(p);if(f>=55296&&f<=57343){var v=t.charCodeAt(++p);f=65536+((f&1023)<<10)|v&1023}if(f<=127){if(n>=u)break;r[n++]=f}else if(f<=2047){if(n+1>=u)break;r[n++]=192|f>>6,r[n++]=128|f&63}else if(f<=65535){if(n+2>=u)break;r[n++]=224|f>>12,r[n++]=128|f>>6&63,r[n++]=128|f&63}else{if(n+3>=u)break;r[n++]=240|f>>18,r[n++]=128|f>>12&63,r[n++]=128|f>>6&63,r[n++]=128|f&63}}return r[n]=0,n-o}function at(t,r,n){return Fe(t,O,r,n)}function st(t,r,n){}function ot(t,r,n){return 0}function ft(t,r,n,i){}function lt(t,r,n,i){}function ut(t,r){}function ct(t,r,n,i,o){}function $e(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function dt(){for(var t=new Array(256),r=0;r<256;++r)t[r]=String.fromCharCode(r);Le=t}var Le=void 0;function D(t){for(var r="",n=t;O[n];)r+=Le[O[n++]];return r}var Q={},Z={},ge={},pt=48,gt=57;function Se(t){if(t===void 0)return"_unknown";t=t.replace(/[^a-zA-Z0-9_]/g,"$");var r=t.charCodeAt(0);return r>=pt&&r<=gt?"_"+t:t}function je(t,r){t=Se(t);var n={};return(n[t]=function(){return r.apply(this,arguments)},n)[t]}function Oe(t,r){var n=je(r,function(i){this.name=r,this.message=i;var o=new Error(i).stack;o!==void 0&&(this.stack=this.toString()+`
2
+ `+o.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var N=void 0;function T(t){throw new N(t)}var He=void 0;function he(t){throw new He(t)}function K(t,r,n){t.forEach(function(f){ge[f]=r});function i(f){var v=n(f);v.length!==t.length&&he("Mismatched type converter count");for(var g=0;g<t.length;++g)x(t[g],v[g])}var o=new Array(r.length),u=[],p=0;r.forEach(function(f,v){Z.hasOwnProperty(f)?o[v]=Z[f]:(u.push(f),Q.hasOwnProperty(f)||(Q[f]=[]),Q[f].push(function(){o[v]=Z[f],++p,p===u.length&&i(o)}))}),u.length===0&&i(o)}function x(t,r,n){if(n=n===void 0?{}:n,!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=r.name;if(t||T('type "'+i+'" must have a positive integer typeid pointer'),Z.hasOwnProperty(t)){if(n.ignoreDuplicateRegistrations)return;T("Cannot register type '"+i+"' twice")}if(Z[t]=r,delete ge[t],Q.hasOwnProperty(t)){var o=Q[t];delete Q[t],o.forEach(function(u){return u()})}}function ht(t,r,n,i,o){var u=$e(n);r=D(r),x(t,{name:r,fromWireType:function(p){return!!p},toWireType:function(p,f){return f?i:o},argPackAdvance:8,readValueFromPointer:function(p){var f;if(n===1)f=j;else if(n===2)f=E;else if(n===4)f=M;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(f[p>>u])},destructorFunction:null})}function vt(t){if(!(this instanceof G)||!(t instanceof G))return!1;for(var r=this.$$.ptrType.registeredClass,n=this.$$.ptr,i=t.$$.ptrType.registeredClass,o=t.$$.ptr;r.baseClass;)n=r.upcast(n),r=r.baseClass;for(;i.baseClass;)o=i.upcast(o),i=i.baseClass;return r===i&&n===o}function yt(t){return{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}}function Ee(t){function r(n){return n.$$.ptrType.registeredClass.name}T(r(t)+" instance already deleted")}var Me=!1;function Be(t){}function bt(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}function xe(t){t.count.value-=1;var r=t.count.value===0;r&&bt(t)}function Ve(t,r,n){if(r===n)return t;if(n.baseClass===void 0)return null;var i=Ve(t,r,n.baseClass);return i===null?null:n.downcast(i)}var ze={};function mt(){return Object.keys(re).length}function wt(){var t=[];for(var r in re)re.hasOwnProperty(r)&&t.push(re[r]);return t}var ee=[];function ke(){for(;ee.length;){var t=ee.pop();t.$$.deleteScheduled=!1,t.delete()}}var te=void 0;function Ct(t){te=t,ee.length&&te&&te(ke)}function _t(){l.getInheritedInstanceCount=mt,l.getLiveInheritedInstances=wt,l.flushPendingDeletes=ke,l.setDelayFunction=Ct}var re={};function Tt(t,r){for(r===void 0&&T("ptr should not be undefined");t.baseClass;)r=t.upcast(r),t=t.baseClass;return r}function Pt(t,r){return r=Tt(t,r),re[r]}function ve(t,r){(!r.ptrType||!r.ptr)&&he("makeClassHandle requires ptr and ptrType");var n=!!r.smartPtrType,i=!!r.smartPtr;return n!==i&&he("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(t,{$$:{value:r}}))}function At(t){var r=this.getPointee(t);if(!r)return this.destructor(t),null;var n=Pt(this.registeredClass,r);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=r,n.$$.smartPtr=t,n.clone();var i=n.clone();return this.destructor(t),i}function o(){return this.isSmartPointer?ve(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:t}):ve(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var u=this.registeredClass.getActualType(r),p=ze[u];if(!p)return o.call(this);var f;this.isConst?f=p.constPointerType:f=p.pointerType;var v=Ve(r,this.registeredClass,f.registeredClass);return v===null?o.call(this):this.isSmartPointer?ve(f.registeredClass.instancePrototype,{ptrType:f,ptr:v,smartPtrType:this,smartPtr:t}):ve(f.registeredClass.instancePrototype,{ptrType:f,ptr:v})}function ne(t){return typeof FinalizationRegistry>"u"?(ne=function(r){return r},t):(Me=new FinalizationRegistry(function(r){xe(r.$$)}),ne=function(r){var n=r.$$,i=!!n.smartPtr;if(i){var o={$$:n};Me.register(r,o,r)}return r},Be=function(r){return Me.unregister(r)},ne(t))}function Ft(){if(this.$$.ptr||Ee(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:yt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function $t(){this.$$.ptr||Ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),Be(this),xe(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function St(){return!this.$$.ptr}function jt(){return this.$$.ptr||Ee(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&T("Object already scheduled for deletion"),ee.push(this),ee.length===1&&te&&te(ke),this.$$.deleteScheduled=!0,this}function Ot(){G.prototype.isAliasOf=vt,G.prototype.clone=Ft,G.prototype.delete=$t,G.prototype.isDeleted=St,G.prototype.deleteLater=jt}function G(){}function Je(t,r,n){if(t[r].overloadTable===void 0){var i=t[r];t[r]=function(){return t[r].overloadTable.hasOwnProperty(arguments.length)||T("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[r].overloadTable+")!"),t[r].overloadTable[arguments.length].apply(this,arguments)},t[r].overloadTable=[],t[r].overloadTable[i.argCount]=i}}function Et(t,r,n){l.hasOwnProperty(t)?((n===void 0||l[t].overloadTable!==void 0&&l[t].overloadTable[n]!==void 0)&&T("Cannot register public name '"+t+"' twice"),Je(l,t,t),l.hasOwnProperty(n)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),l[t].overloadTable[n]=r):(l[t]=r,n!==void 0&&(l[t].numArguments=n))}function Mt(t,r,n,i,o,u,p,f){this.name=t,this.constructor=r,this.instancePrototype=n,this.rawDestructor=i,this.baseClass=o,this.getActualType=u,this.upcast=p,this.downcast=f,this.pureVirtualFunctions=[]}function ye(t,r,n){for(;r!==n;)r.upcast||T("Expected null or instance of "+n.name+", got an instance of "+r.name),t=r.upcast(t),r=r.baseClass;return t}function kt(t,r){if(r===null)return this.isReference&&T("null is not a valid "+this.name),0;r.$$||T('Cannot pass "'+Re(r)+'" as a '+this.name),r.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name);var n=r.$$.ptrType.registeredClass,i=ye(r.$$.ptr,n,this.registeredClass);return i}function Ut(t,r){var n;if(r===null)return this.isReference&&T("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,n),n):0;r.$$||T('Cannot pass "'+Re(r)+'" as a '+this.name),r.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&r.$$.ptrType.isConst&&T("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);var i=r.$$.ptrType.registeredClass;if(n=ye(r.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&T("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?n=r.$$.smartPtr:T("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)n=r.$$.smartPtr;else{var o=r.clone();n=this.rawShare(n,Ue.toHandle(function(){o.delete()})),t!==null&&t.push(this.rawDestructor,n)}break;default:T("Unsupporting sharing policy")}return n}function Rt(t,r){if(r===null)return this.isReference&&T("null is not a valid "+this.name),0;r.$$||T('Cannot pass "'+Re(r)+'" as a '+this.name),r.$$.ptr||T("Cannot pass deleted object as a pointer of type "+this.name),r.$$.ptrType.isConst&&T("Cannot convert argument of type "+r.$$.ptrType.name+" to parameter type "+this.name);var n=r.$$.ptrType.registeredClass,i=ye(r.$$.ptr,n,this.registeredClass);return i}function be(t){return this.fromWireType(M[t>>2])}function Wt(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function It(t){this.rawDestructor&&this.rawDestructor(t)}function Dt(t){t!==null&&t.delete()}function Lt(){V.prototype.getPointee=Wt,V.prototype.destructor=It,V.prototype.argPackAdvance=8,V.prototype.readValueFromPointer=be,V.prototype.deleteObject=Dt,V.prototype.fromWireType=At}function V(t,r,n,i,o,u,p,f,v,g,m){this.name=t,this.registeredClass=r,this.isReference=n,this.isConst=i,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=p,this.rawGetPointee=f,this.rawConstructor=v,this.rawShare=g,this.rawDestructor=m,!o&&r.baseClass===void 0?i?(this.toWireType=kt,this.destructorFunction=null):(this.toWireType=Rt,this.destructorFunction=null):this.toWireType=Ut}function Ht(t,r,n){l.hasOwnProperty(t)||he("Replacing nonexistant public symbol"),l[t].overloadTable!==void 0&&n!==void 0?l[t].overloadTable[n]=r:(l[t]=r,l[t].argCount=n)}function Bt(t,r,n){var i=dynCalls[t];return n&&n.length?i.apply(null,[r].concat(n)):i.call(null,r)}var me=[];function ie(t){var r=me[t];return r||(t>=me.length&&(me.length=t+1),me[t]=r=ue.get(t)),r}function xt(t,r,n){if(t.includes("j"))return Bt(t,r,n);var i=ie(r).apply(null,n);return i}function Vt(t,r){var n=[];return function(){return n.length=0,Object.assign(n,arguments),xt(t,r,n)}}function q(t,r){t=D(t);function n(){return t.includes("j")?Vt(t,r):ie(r)}var i=n();return typeof i!="function"&&T("unknown function pointer with signature "+t+": "+r),i}var Ge=void 0;function zt(t){var r=Ne(t),n=D(r);return z(r),n}function ae(t,r){var n=[],i={};function o(u){if(!i[u]&&!Z[u]){if(ge[u]){ge[u].forEach(o);return}n.push(u),i[u]=!0}}throw r.forEach(o),new Ge(t+": "+n.map(zt).join([", "]))}function Jt(t,r,n,i,o,u,p,f,v,g,m,P,$){m=D(m),u=q(o,u),f&&(f=q(p,f)),g&&(g=q(v,g)),$=q(P,$);var S=Se(m);Et(S,function(){ae("Cannot construct "+m+" due to unbound types",[i])}),K([t,r,n],i?[i]:[],function(U){U=U[0];var W,R;i?(W=U.registeredClass,R=W.instancePrototype):R=G.prototype;var L=je(S,function(){if(Object.getPrototypeOf(this)!==oe)throw new N("Use 'new' to construct "+m);if(I.constructor_body===void 0)throw new N(m+" has no accessible constructor");var it=I.constructor_body[arguments.length];if(it===void 0)throw new N("Tried to invoke ctor of "+m+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(I.constructor_body).toString()+") parameters instead!");return it.apply(this,arguments)}),oe=Object.create(R,{constructor:{value:L}});L.prototype=oe;var I=new Mt(m,L,oe,$,W,u,f,g);I.baseClass&&(I.baseClass.__derivedClasses===void 0&&(I.baseClass.__derivedClasses=[]),I.baseClass.__derivedClasses.push(I));var Hr=new V(m,I,!0,!1,!1),rt=new V(m+"*",I,!1,!1,!1),nt=new V(m+" const*",I,!1,!0,!1);return ze[t]={pointerType:rt,constPointerType:nt},Ht(S,L),[Hr,rt,nt]})}function qe(t,r){for(var n=[],i=0;i<t;i++)n.push(k[r+i*4>>2]);return n}function Ke(t){for(;t.length;){var r=t.pop(),n=t.pop();n(r)}}function Gt(t,r){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type "+typeof t+" which is not a function");var n=je(t.name||"unknownFunctionName",function(){});n.prototype=t.prototype;var i=new n,o=t.apply(i,r);return o instanceof Object?o:i}function Ye(t,r,n,i,o,u){var p=r.length;p<2&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&n!==null,v=!1,g=1;g<r.length;++g)if(r[g]!==null&&r[g].destructorFunction===void 0){v=!0;break}for(var m=r[0].name!=="void",P="",$="",g=0;g<p-2;++g)P+=(g!==0?", ":"")+"arg"+g,$+=(g!==0?", ":"")+"arg"+g+"Wired";var S=`
3
+ return function `+Se(t)+"("+P+`) {
4
+ if (arguments.length !== `+(p-2)+`) {
5
+ throwBindingError('function `+t+" called with "+arguments.length+" arguments, expected "+(p-2)+` args!');
6
6
  }`;v&&(S+=`var destructors = [];
7
- `);var M=v?"destructors":"null",W=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],R=[$,i,o,qe,r[0],r[1]];l&&(S+="var thisWired = classParam.toWireType("+M+`, this);
8
- `);for(var g=0;g<p-2;++g)S+="var arg"+g+"Wired = argType"+g+".toWireType("+M+", arg"+g+"); // "+r[g+2].name+`
9
- `,W.push("argType"+g),R.push(r[g+2]);if(l&&(F="thisWired"+(F.length>0?", ":"")+F),S+=(m||u?"var rv = ":"")+"invoker(fn"+(F.length>0?", ":"")+F+`);
7
+ `);var U=v?"destructors":"null",W=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],R=[T,i,o,Ke,r[0],r[1]];f&&(S+="var thisWired = classParam.toWireType("+U+`, this);
8
+ `);for(var g=0;g<p-2;++g)S+="var arg"+g+"Wired = argType"+g+".toWireType("+U+", arg"+g+"); // "+r[g+2].name+`
9
+ `,W.push("argType"+g),R.push(r[g+2]);if(f&&($="thisWired"+($.length>0?", ":"")+$),S+=(m||u?"var rv = ":"")+"invoker(fn"+($.length>0?", ":"")+$+`);
10
10
  `,v)S+=`runDestructors(destructors);
11
- `;else for(var g=l?1:2;g<r.length;++g){var x=g===1?"thisWired":"arg"+(g-2)+"Wired";r[g].destructorFunction!==null&&(S+=x+"_dtor("+x+"); // "+r[g].name+`
12
- `,W.push(x+"_dtor"),R.push(r[g].destructorFunction))}return m&&(S+=`var ret = retType.fromWireType(rv);
11
+ `;else for(var g=f?1:2;g<r.length;++g){var L=g===1?"thisWired":"arg"+(g-2)+"Wired";r[g].destructorFunction!==null&&(S+=L+"_dtor("+L+"); // "+r[g].name+`
12
+ `,W.push(L+"_dtor"),R.push(r[g].destructorFunction))}return m&&(S+=`var ret = retType.fromWireType(rv);
13
13
  return ret;
14
14
  `),S+=`}
15
- `,W.push(S),Gt(Function,W).apply(null,R)}function zt(t,r,n,i,o,u){P(r>0);var p=ze(r,n);o=q(i,o),K([],[t],function(l){l=l[0];var v=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[r-1]!==void 0)throw new N(`Cannot register multiple constructors with identical number of parameters (${r-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[r-1]=()=>{ae(`Cannot construct ${l.name} due to unbound types`,p)},K([],p,function(g){return g.splice(1,0,null),l.registeredClass.constructor_body[r-1]=Ke(v,g,null,o,u),[]}),[]})}function qt(t,r,n,i,o,u,p,l,v){var g=ze(n,i);r=D(r),u=q(o,u),K([],[t],function(m){m=m[0];var T=`${m.name}.${r}`;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),l&&m.registeredClass.pureVirtualFunctions.push(r);function F(){ae(`Cannot call ${T} due to unbound types`,g)}var S=m.registeredClass.instancePrototype,M=S[r];return M===void 0||M.overloadTable===void 0&&M.className!==m.name&&M.argCount===n-2?(F.argCount=n-2,F.className=m.name,S[r]=F):(Je(S,r,T),S[r].overloadTable[n-2]=F),K([],g,function(W){var R=Ke(T,W,m,u,p,v);return S[r].overloadTable===void 0?(R.argCount=n-2,S[r]=R):S[r].overloadTable[n-2]=R,[]}),[]})}function Ye(t,r,n){return t instanceof Object||$(`${n} with invalid "this": ${t}`),t instanceof r.registeredClass.constructor||$(`${n} incompatible with "this" of type ${t.constructor.name}`),t.$$.ptr||$(`cannot call emscripten binding method ${n} on deleted object`),ve(t.$$.ptr,t.$$.ptrType.registeredClass,r.registeredClass)}function Kt(t,r,n,i,o,u,p,l,v,g){r=D(r),o=q(i,o),K([],[t],function(m){m=m[0];var T=`${m.name}.${r}`,F={get:function(){ae(`Cannot access ${T} due to unbound types`,[n,p])},enumerable:!0,configurable:!0};return v?F.set=()=>{ae(`Cannot access ${T} due to unbound types`,[n,p])}:F.set=S=>{$(T+" is a read-only property")},Object.defineProperty(m.registeredClass.instancePrototype,r,F),K([],v?[n,p]:[n],function(S){var M=S[0],W={get:function(){var x=Ye(this,m,T+" getter");return M.fromWireType(o(u,x))},enumerable:!0};if(v){v=q(l,v);var R=S[1];W.set=function(x){var oe=Ye(this,m,T+" setter"),I=[];v(g,oe,R.toWireType(I,x)),qe(I)}}return Object.defineProperty(m.registeredClass.instancePrototype,r,W),[]}),[]})}function Yt(){this.allocated=[void 0],this.freelist=[],this.get=function(t){return this.allocated[t]},this.has=function(t){return this.allocated[t]!==void 0},this.allocate=function(t){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=t,r},this.free=function(t){this.allocated[t]=void 0,this.freelist.push(t)}}var L=new Yt;function Xt(t){t>=L.reserved&&--L.get(t).refcount===0&&L.free(t)}function Qt(){for(var t=0,r=L.reserved;r<L.allocated.length;++r)L.allocated[r]!==void 0&&++t;return t}function Zt(){L.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),L.reserved=L.allocated.length,f.count_emval_handles=Qt}var Me={toValue:t=>(t||$("Cannot use deleted val. handle = "+t),L.get(t).value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return L.allocate({refcount:1,value:t})}}};function Nt(t,r){r=D(r),B(t,{name:r,fromWireType:function(n){var i=Me.toValue(n);return Xt(n),i},toWireType:function(n,i){return Me.toHandle(i)},argPackAdvance:8,readValueFromPointer:ye,destructorFunction:null})}function Re(t){if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t}function er(t,r){switch(r){case 2:return function(n){return this.fromWireType(le[n>>2])};case 3:return function(n){return this.fromWireType(fe[n>>3])};default:throw new TypeError("Unknown float type: "+t)}}function tr(t,r,n){var i=Fe(n);r=D(r),B(t,{name:r,fromWireType:function(o){return o},toWireType:function(o,u){return u},argPackAdvance:8,readValueFromPointer:er(r,i),destructorFunction:null})}function rr(t,r,n){switch(r){case 0:return n?function(o){return j[o]}:function(o){return O[o]};case 1:return n?function(o){return E[o>>1]}:function(o){return G[o>>1]};case 2:return n?function(o){return k[o>>2]}:function(o){return U[o>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function nr(t,r,n,i,o){r=D(r);var u=Fe(n),p=T=>T;if(i===0){var l=32-8*n;p=T=>T<<l>>>l}var v=r.includes("unsigned"),g=(T,F)=>{},m;v?m=function(T,F){return g(F,this.name),F>>>0}:m=function(T,F){return g(F,this.name),F},B(t,{name:r,fromWireType:p,toWireType:m,argPackAdvance:8,readValueFromPointer:rr(r,u,i!==0),destructorFunction:null})}function ir(t,r,n){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=i[r];function u(p){p=p>>2;var l=U,v=l[p],g=l[p+1];return new o(l.buffer,g,v)}n=D(n),B(t,{name:n,fromWireType:u,argPackAdvance:8,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})}function ar(t){for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++n):r+=3}return r}function sr(t,r){r=D(r);var n=r==="std::string";B(t,{name:r,fromWireType:function(i){var o=U[i>>2],u=i+4,p;if(n)for(var l=u,v=0;v<=o;++v){var g=u+v;if(v==o||O[g]==0){var m=g-l,T=X(l,m);p===void 0?p=T:(p+=String.fromCharCode(0),p+=T),l=g+1}}else{for(var F=new Array(o),v=0;v<o;++v)F[v]=String.fromCharCode(O[u+v]);p=F.join("")}return J(i),p},toWireType:function(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var u,p=typeof o=="string";p||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||$("Cannot pass non-string to std::string"),n&&p?u=ar(o):u=o.length;var l=Ie(4+u+1),v=l+4;if(U[l>>2]=u,n&&p)Ae(o,v,u+1);else if(p)for(var g=0;g<u;++g){var m=o.charCodeAt(g);m>255&&(J(v),$("String has UTF-16 code units that do not fit in 8 bits")),O[v+g]=m}else for(var g=0;g<u;++g)O[v+g]=o[g];return i!==null&&i.push(J,l),l},argPackAdvance:8,readValueFromPointer:ye,destructorFunction:function(i){J(i)}})}var Xe=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function or(t,r){for(var n=t,i=n>>1,o=i+r/2;!(i>=o)&&G[i];)++i;if(n=i<<1,n-t>32&&Xe)return Xe.decode(O.subarray(t,n));for(var u="",p=0;!(p>=r/2);++p){var l=E[t+p*2>>1];if(l==0)break;u+=String.fromCharCode(l)}return u}function lr(t,r,n){if(n===void 0&&(n=2147483647),n<2)return 0;n-=2;for(var i=r,o=n<t.length*2?n/2:t.length,u=0;u<o;++u){var p=t.charCodeAt(u);E[r>>1]=p,r+=2}return E[r>>1]=0,r-i}function fr(t){return t.length*2}function ur(t,r){for(var n=0,i="";!(n>=r/4);){var o=k[t+n*4>>2];if(o==0)break;if(++n,o>=65536){var u=o-65536;i+=String.fromCharCode(55296|u>>10,56320|u&1023)}else i+=String.fromCharCode(o)}return i}function cr(t,r,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var i=r,o=i+n-4,u=0;u<t.length;++u){var p=t.charCodeAt(u);if(p>=55296&&p<=57343){var l=t.charCodeAt(++u);p=65536+((p&1023)<<10)|l&1023}if(k[r>>2]=p,r+=4,r+4>o)break}return k[r>>2]=0,r-i}function dr(t){for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i>=55296&&i<=57343&&++n,r+=4}return r}function pr(t,r,n){n=D(n);var i,o,u,p,l;r===2?(i=or,o=lr,p=fr,u=()=>G,l=1):r===4&&(i=ur,o=cr,p=dr,u=()=>U,l=2),B(t,{name:n,fromWireType:function(v){for(var g=U[v>>2],m=u(),T,F=v+4,S=0;S<=g;++S){var M=v+4+S*r;if(S==g||m[M>>l]==0){var W=M-F,R=i(F,W);T===void 0?T=R:(T+=String.fromCharCode(0),T+=R),F=M+r}}return J(v),T},toWireType:function(v,g){typeof g!="string"&&$(`Cannot pass non-string to C++ string type ${n}`);var m=p(g),T=Ie(4+m+r);return U[T>>2]=m>>l,o(g,T+4,m+r),v!==null&&v.push(J,T),T},argPackAdvance:8,readValueFromPointer:ye,destructorFunction:function(v){J(v)}})}function gr(t,r){r=D(r),B(t,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(n,i){}})}function hr(){throw 1/0}function vr(t,r,n,i,o,u,p){return-52}function yr(t,r,n,i,o,u){}function br(){A("")}var Qe;Qe=()=>performance.now();function mr(){return 2147483648}function Cr(t){var r=H.buffer;try{return H.grow(t-r.byteLength+65535>>>16),Y(),1}catch{}}function wr(t){var r=O.length;t=t>>>0;var n=mr();if(t>n)return!1;for(var i=(v,g)=>v+(g-v%g)%g,o=1;o<=4;o*=2){var u=r*(1+.2/o);u=Math.min(u,t+100663296);var p=Math.min(n,i(Math.max(t,u),65536)),l=Cr(p);if(l)return!0}return!1}var We={};function _r(){return"./this.program"}function se(){if(!se.strings){var t=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:t,_:_r()};for(var n in We)We[n]===void 0?delete r[n]:r[n]=We[n];var i=[];for(var n in r)i.push(`${n}=${r[n]}`);se.strings=i}return se.strings}function $r(t,r){for(var n=0;n<t.length;++n)j[r++>>0]=t.charCodeAt(n);j[r>>0]=0}function Tr(t,r){var n=0;return se().forEach(function(i,o){var u=r+n;U[t+o*4>>2]=u,$r(i,u),n+=i.length+1}),0}function Pr(t,r){var n=se();U[t>>2]=n.length;var i=0;return n.forEach(function(o){i+=o.length+1}),U[r>>2]=i,0}function Ar(t){throw`exit(${t})`}var Fr=Ar;function Sr(t){return 52}function jr(t,r,n,i){return 52}function Or(t,r,n,i,o){return 70}var Er=[null,[],[]];function kr(t,r){var n=Er[t];r===0||r===10?((t===1?w:y)(de(n,0)),n.length=0):n.push(r)}function Ur(t,r,n,i){for(var o=0,u=0;u<n;u++){var p=U[r>>2],l=U[r+4>>2];r+=8;for(var v=0;v<l;v++)kr(t,O[p+v]);o+=l}return U[i>>2]=o,0}ct(),N=f.BindingError=Oe(Error,"BindingError"),xe=f.InternalError=Oe(Error,"InternalError"),jt(),wt(),Dt(),Ge=f.UnboundTypeError=Oe(Error,"UnboundTypeError"),Zt();var Mr={b:_e,k:$e,I:Te,B:at,K:st,G:ot,n:lt,H:ft,u:ut,r:gt,j:Jt,A:zt,d:qt,c:Kt,L:Nt,p:tr,g:nr,e:ir,q:sr,l:pr,s:gr,y:hr,C:vr,D:yr,f:br,m:Qe,z:wr,E:Tr,F:Pr,h:Fr,i:Sr,o:jr,t:Or,J:Ur,x:Rr,v:Ir,w:Wr,a:H};function Rr(t,r,n){var i=Ce();try{return ie(t)(r,n)}catch(o){if(we(i),o!==o+0)throw o;me(1,0)}}function Wr(t,r,n,i,o){var u=Ce();try{return ie(t)(r,n,i,o)}catch(p){if(we(u),p!==p+0)throw p;me(1,0)}}function Ir(t,r,n,i){var o=Ce();try{return ie(t)(r,n,i)}catch(u){if(we(o),u!==u+0)throw u;me(1,0)}}f.getTempRet0=tt,f.setTempRet0=et;function Dr(t){t.M()}var Ze={a:Mr},Ie,J,Ne,me,et,tt,Ce,we;return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(fetch("jassub-worker-modern.wasm"),Ze):WebAssembly.instantiate(f.wasm,Ze)).then(function(t){C=(t.instance||t).exports,f._malloc=Ie=C.N,J=C.O,Ne=C.P,f.__embind_initialize_bindings=C.Q,me=C.S,et=C.T,tt=C.U,Ce=C.V,we=C.W,C.X,C.Y,C.Z,C._,ue=C.R,Dr(C),_()}),f.ready};String.prototype.startsWith||(String.prototype.startsWith=function(s,f=0){return this.substring(f,s.length)===s});String.prototype.includes||(String.prototype.includes=function(s,f){return this.indexOf(s,f)!==-1});Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(s,f){return new Uint8Array(this.subarray(s,f))});function toAbsoluteIndex(s,f){const h=s>>0;return h<0?Math.max(h+f,0):Math.min(h,f)}Uint8Array.prototype.fill||(Int8Array.prototype.fill=Int16Array.prototype.fill=Int32Array.prototype.fill=Uint8Array.prototype.fill=Uint16Array.prototype.fill=Uint32Array.prototype.fill=Float32Array.prototype.fill=Float64Array.prototype.fill=Array.prototype.fill=function(s){if(this==null)throw new TypeError("this is null or not defined");const f=Object(this),h=f.length>>>0,w=arguments.length;let y=toAbsoluteIndex(w>1?arguments[1]:void 0,h);const _=w>2?arguments[2]:void 0,P=_===void 0?h:toAbsoluteIndex(_,h);for(;P>y;)f[y++]=s;return f});Uint8Array.prototype.copyWithin||(Int8Array.prototype.copyWithin=Int16Array.prototype.copyWithin=Int32Array.prototype.copyWithin=Uint8Array.prototype.copyWithin=Uint16Array.prototype.copyWithin=Uint32Array.prototype.copyWithin=Float32Array.prototype.copyWithin=Float64Array.prototype.copyWithin=Array.prototype.copyWithin=function(s,f){const h=Object(this),w=h.length>>>0;let y=toAbsoluteIndex(s,w),_=toAbsoluteIndex(f,w);const P=arguments.length>2?arguments[2]:void 0;let C=Math.min((P===void 0?w:toAbsoluteIndex(P,w))-_,w-y),A=1;for(_<y&&y<_+C&&(A=-1,_+=C-1,y+=C-1);C-- >0;)_ in h?h[y]=h[_]:delete h[y],y+=A,_+=A;return h});Date.now||(Date.now=()=>new Date().getTime());"performance"in self||(self.performance={now:()=>Date.now()});if(typeof console>"u"){const s=(f,h)=>{postMessage({target:"console",command:f,content:JSON.stringify(Array.prototype.slice.call(h))})};self.console={log:function(){s("log",arguments)},debug:function(){s("debug",arguments)},info:function(){s("info",arguments)},warn:function(){s("warn",arguments)},error:function(){s("error",arguments)}},console.log("Detected lack of console, overridden console")}typeof Promise>"u"&&(self.Promise=function(s){let f=()=>{};return s(h=>setTimeout(()=>f(h),0)),{then:h=>f=h}});const read_=(s,f)=>{const h=new XMLHttpRequest;return h.open("GET",s,!1),h.responseType=f?"arraybuffer":"text",h.send(null),h.response},readAsync=(s,f,h)=>{const w=new XMLHttpRequest;w.open("GET",s,!0),w.responseType="arraybuffer",w.onload=()=>{if((w.status===200||w.status===0)&&w.response)return f(w.response)},w.onerror=h,w.send(null)};let lastCurrentTime=0;const rate=1;let rafId=null,nextIsRaf=!1,lastCurrentTimeReceivedAt=Date.now(),targetFps=24,useLocalFonts=!1,blendMode="js",availableFonts={};const fontMap_={};let fontId=0,debug;self.width=0;self.height=0;let asyncRender=!1;self.addFont=({font:s})=>asyncWrite(s);const findAvailableFonts=s=>{s=s.trim().toLowerCase(),s.startsWith("@")&&(s=s.substring(1)),!fontMap_[s]&&(fontMap_[s]=!0,availableFonts[s]?asyncWrite(availableFonts[s]):useLocalFonts&&postMessage({target:"getLocalFont",font:s}))},asyncWrite=s=>{typeof s=="string"?readAsync(s,f=>{allocFont(new Uint8Array(f))},console.error):allocFont(s)},allocFont=s=>{const f=_malloc(s.byteLength);self.HEAPU8.set(s,f),jassubObj.addFont("font-"+fontId++,f,s.byteLength),jassubObj.reloadFonts()},processAvailableFonts=s=>{if(!availableFonts)return;const f=parseAss(s);for(let y=0;y<f.length;y++)for(let _=0;_<f[y].body.length;_++)f[y].body[_].key==="Style"&&findAvailableFonts(f[y].body[_].value.Fontname);const h=/\\fn([^\\}]*?)[\\}]/g;let w;for(;(w=h.exec(s))!==null;)findAvailableFonts(w[1])};self.setTrack=({content:s})=>{processAvailableFonts(s),dropAllBlur&&(s=dropBlur(s)),jassubObj.createTrackMem(s),subtitleColorSpace=libassYCbCrMap[jassubObj.trackColorSpace],postMessage({target:"verifyColorSpace",subtitleColorSpace})};self.getColorSpace=()=>postMessage({target:"verifyColorSpace",subtitleColorSpace});self.freeTrack=()=>{jassubObj.removeTrack()};self.setTrackByUrl=({url:s})=>{self.setTrack({content:read_(s)})};const getCurrentTime=()=>{const s=(Date.now()-lastCurrentTimeReceivedAt)/1e3;return _isPaused?lastCurrentTime:(s>5&&(console.error("Didn't received currentTime > 5 seconds. Assuming video was paused."),setIsPaused(!0)),lastCurrentTime+s*rate)},setCurrentTime=s=>{lastCurrentTime=s,lastCurrentTimeReceivedAt=Date.now(),rafId||(nextIsRaf?rafId=requestAnimationFrame(renderLoop):(renderLoop(),setTimeout(()=>{nextIsRaf=!1},20)))};let _isPaused=!0;const setIsPaused=s=>{s!==_isPaused&&(_isPaused=s,s?rafId&&(clearTimeout(rafId),rafId=null):(lastCurrentTimeReceivedAt=Date.now(),rafId=requestAnimationFrame(renderLoop)))},a="BT601",b="BT709",c="SMPTE240M",d="FCC",libassYCbCrMap=[null,a,null,a,a,b,b,c,c,d,d],render=(s,f)=>{const h={},w=performance.now(),y=blendMode==="wasm"?jassubObj.renderBlend(s,f||0):jassubObj.renderImage(s,f||0);if(debug){const _=performance.now(),P=jassubObj.time;h.WASMRenderTime=P-w,h.WASMBitmapDecodeTime=_-P,h.JSRenderTime=Date.now()}if(jassubObj.changed!==0||f){const _=[],P=[];if(!y)return paintImages({images:_,buffers:P,times:h});if(asyncRender){const C=[];for(let A=y,j=0;j<jassubObj.count;A=A.next,++j){const E={w:A.w,h:A.h,x:A.x,y:A.y},k=A.image,O=hasBitmapBug?self.HEAPU8C.slice(k,k+E.w*E.h*4):self.HEAPU8C.subarray(k,k+E.w*E.h*4);C.push(createImageBitmap(new ImageData(O,E.w,E.h))),_.push(E)}Promise.all(C).then(A=>{for(let j=0;j<_.length;j++)_[j].image=A[j];debug&&(h.JSBitmapGenerationTime=Date.now()-h.JSRenderTime),paintImages({images:_,buffers:A,times:h})})}else{for(let C=y,A=0;A<jassubObj.count;C=C.next,++A){const j={w:C.w,h:C.h,x:C.x,y:C.y,image:C.image};if(!offCanvasCtx){const E=self.wasmMemory.buffer.slice(C.image,C.image+C.w*C.h*4);P.push(E),j.image=E}_.push(j)}paintImages({images:_,buffers:P,times:h})}}else postMessage({target:"unbusy"})};self.demand=({time:s})=>{lastCurrentTime=s,render(s)};const renderLoop=s=>{rafId=0,render(getCurrentTime(),s),_isPaused||(rafId=requestAnimationFrame(renderLoop))},paintImages=({times:s,images:f,buffers:h})=>{const w={target:"render",asyncRender,images:f,times:s,width:self.width,height:self.height,colorSpace:subtitleColorSpace};if(offscreenRender){(offCanvas.height!==self.height||offCanvas.width!==self.width)&&(offCanvas.width=self.width,offCanvas.height=self.height),offCanvasCtx.clearRect(0,0,self.width,self.height);for(const y of f)y.image&&(asyncRender?(offCanvasCtx.drawImage(y.image,y.x,y.y),y.image.close()):(bufferCanvas.width=y.w,bufferCanvas.height=y.h,bufferCtx.putImageData(new ImageData(self.HEAPU8C.subarray(y.image,y.image+y.w*y.h*4),y.w,y.h),0,0),offCanvasCtx.drawImage(bufferCanvas,y.x,y.y)));if(offscreenRender==="hybrid"){if(!f.length)return postMessage(w);debug&&(s.bitmaps=f.length);try{const y=offCanvas.transferToImageBitmap();w.images=[{image:y,x:0,y:0}],w.asyncRender=!0,postMessage(w,[y])}catch{postMessage({target:"unbusy"})}}else{if(debug){s.JSRenderTime=Date.now()-s.JSRenderTime-(s.JSBitmapGenerationTime||0);let y=0;for(const _ in s)y+=s[_];console.log("Bitmaps: "+f.length+" Total: "+(y|0)+"ms",s)}postMessage({target:"unbusy"})}}else postMessage(w,h)},parseAss=s=>{let f,h,w,y,_,P,C,A,j,E;const k=[],O=s.split(/[\r\n]+/g);for(A=0;A<O.length;A++)if(f=O[A].match(/^\[(.*)\]$/),f)h=null,k.push({name:f[1],body:[]});else{if(/^\s*$/.test(O[A])||k.length===0)continue;if(E=k[k.length-1].body,O[A][0]===";")E.push({type:"comment",value:O[A].substring(1)});else{if(y=O[A].split(":"),_=y[0],P=y.slice(1).join(":").trim(),(h||_==="Format")&&(P=P.split(","),h&&P.length>h.length&&(w=P.slice(h.length-1).join(","),P=P.slice(0,h.length-1),P.push(w)),P=P.map(G=>G.trim()),h)){for(C={},j=0;j<P.length;j++)C[h[j]]=P[j];P=C}_==="Format"&&(h=P),E.push({key:_,value:P})}}return k},blurRegex=/\\blur(?:[0-9]+\.)?[0-9]+/gm,dropBlur=s=>s.replace(blurRegex,""),requestAnimationFrame=(()=>{let s=0;return f=>{const h=Date.now();if(s===0)s=h+1e3/targetFps;else for(;h+2>=s;)s+=1e3/targetFps;const w=Math.max(s-h,0);return setTimeout(f,w)}})(),_applyKeys=(s,f)=>{for(const h of Object.keys(s))f[h]=s[h]};let offCanvas,offCanvasCtx,offscreenRender,bufferCanvas,bufferCtx,jassubObj,subtitleColorSpace,dropAllBlur,_malloc,hasBitmapBug;self.init=data=>{hasBitmapBug=data.hasBitmapBug;try{const s=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(s instanceof WebAssembly.Module)||!(new WebAssembly.Instance(s)instanceof WebAssembly.Instance))throw new Error("WASM not supported")}catch(e){console.warn(e),eval(read_(data.legacyWasmUrl))}if(WebAssembly.instantiateStreaming){const s=self.fetch;self.fetch=f=>s(data.wasmUrl)}Module({wasm:!WebAssembly.instantiateStreaming&&read_(data.wasmUrl,!0)}).then(s=>{_malloc=s._malloc,self.width=data.width,self.height=data.height,blendMode=data.blendMode,asyncRender=data.asyncRender,asyncRender&&typeof createImageBitmap>"u"&&(asyncRender=!1,console.error("'createImageBitmap' needed for 'asyncRender' unsupported!")),availableFonts=data.availableFonts,debug=data.debug,targetFps=data.targetFps||targetFps,useLocalFonts=data.useLocalFonts,dropAllBlur=data.dropAllBlur;const f=data.fallbackFont.toLowerCase();jassubObj=new s.JASSUB(self.width,self.height,f||null,debug),f&&findAvailableFonts(f);let h=data.subContent;h||(h=read_(data.subUrl)),processAvailableFonts(h),dropAllBlur&&(h=dropBlur(h));for(const w of data.fonts||[])asyncWrite(w);jassubObj.createTrackMem(h),subtitleColorSpace=libassYCbCrMap[jassubObj.trackColorSpace],jassubObj.setDropAnimations(data.dropAllAnimations||0),(data.libassMemoryLimit>0||data.libassGlyphLimit>0)&&jassubObj.setMemoryLimits(data.libassGlyphLimit||0,data.libassMemoryLimit||0),postMessage({target:"ready"}),postMessage({target:"verifyColorSpace",subtitleColorSpace})})};self.offscreenCanvas=({transferable:s})=>{offCanvas=s[0],offCanvasCtx=offCanvas.getContext("2d"),asyncRender||(bufferCanvas=new OffscreenCanvas(self.height,self.width),bufferCtx=bufferCanvas.getContext("2d",{desynchronized:!0})),offscreenRender=!0};self.detachOffscreen=()=>{offCanvas=new OffscreenCanvas(self.height,self.width),offCanvasCtx=offCanvas.getContext("2d",{desynchronized:!0}),offscreenRender="hybrid"};self.canvas=({width:s,height:f,force:h})=>{if(s==null)throw new Error("Invalid canvas size specified");self.width=s,self.height=f,jassubObj&&jassubObj.resizeCanvas(s,f),h&&render(lastCurrentTime,!0)};self.video=({currentTime:s,isPaused:f,rate:h})=>{s!=null&&setCurrentTime(s),f!=null&&setIsPaused(f),h=h||h};self.destroy=()=>{jassubObj.quitLibrary()};self.createEvent=({event:s})=>{_applyKeys(s,jassubObj.getEvent(jassubObj.allocEvent()))};self.getEvents=()=>{const s=[];for(let f=0;f<jassubObj.getEventCount();f++){const{Start:h,Duration:w,ReadOrder:y,Layer:_,Style:P,MarginL:C,MarginR:A,MarginV:j,Name:E,Text:k,Effect:O}=jassubObj.getEvent(f);s.push({Start:h,Duration:w,ReadOrder:y,Layer:_,Style:P,MarginL:C,MarginR:A,MarginV:j,Name:E,Text:k,Effect:O})}postMessage({target:"getEvents",events:s})};self.setEvent=({event:s,index:f})=>{_applyKeys(s,jassubObj.getEvent(f))};self.removeEvent=({index:s})=>{jassubObj.removeEvent(s)};self.createStyle=({style:s})=>{_applyKeys(s,jassubObj.getStyle(jassubObj.allocStyle()))};self.getStyles=()=>{const s=[];for(let f=0;f<jassubObj.getStyleCount();f++){const{Name:h,FontName:w,FontSize:y,PrimaryColour:_,SecondaryColour:P,OutlineColour:C,BackColour:A,Bold:j,Italic:E,Underline:k,StrikeOut:O,ScaleX:G,ScaleY:U,Spacing:le,Angle:fe,BorderStyle:H,Outline:ue,Shadow:Y,Alignment:ce,MarginL:de,MarginR:X,MarginV:_e,Encoding:$e,treat_fontname_as_pattern:Te,Blur:Pe,Justify:Ae}=jassubObj.getStyle(f);s.push({Name:h,FontName:w,FontSize:y,PrimaryColour:_,SecondaryColour:P,OutlineColour:C,BackColour:A,Bold:j,Italic:E,Underline:k,StrikeOut:O,ScaleX:G,ScaleY:U,Spacing:le,Angle:fe,BorderStyle:H,Outline:ue,Shadow:Y,Alignment:ce,MarginL:de,MarginR:X,MarginV:_e,Encoding:$e,treat_fontname_as_pattern:Te,Blur:Pe,Justify:Ae})}postMessage({target:"getStyles",time:Date.now(),styles:s})};self.setStyle=({style:s,index:f})=>{_applyKeys(s,jassubObj.getStyle(f))};self.removeStyle=({index:s})=>{jassubObj.removeStyle(s)};onmessage=({data:s})=>{if(self[s.target])self[s.target](s);else throw new Error("Unknown event target "+s.target)};
15
+ `,W.push(S),Gt(Function,W).apply(null,R)}function qt(t,r,n,i,o,u){A(r>0);var p=qe(r,n);o=q(i,o),K([],[t],function(f){f=f[0];var v="constructor "+f.name;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[r-1]!==void 0)throw new N("Cannot register multiple constructors with identical number of parameters ("+(r-1)+") for class '"+f.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return f.registeredClass.constructor_body[r-1]=function(){ae("Cannot construct "+f.name+" due to unbound types",p)},K([],p,function(g){return g.splice(1,0,null),f.registeredClass.constructor_body[r-1]=Ye(v,g,null,o,u),[]}),[]})}function Kt(t,r,n,i,o,u,p,f,v){var g=qe(n,i);r=D(r),u=q(o,u),K([],[t],function(m){m=m[0];var P=m.name+"."+r;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),f&&m.registeredClass.pureVirtualFunctions.push(r);function $(){ae("Cannot call "+P+" due to unbound types",g)}var S=m.registeredClass.instancePrototype,U=S[r];return U===void 0||U.overloadTable===void 0&&U.className!==m.name&&U.argCount===n-2?($.argCount=n-2,$.className=m.name,S[r]=$):(Je(S,r,P),S[r].overloadTable[n-2]=$),K([],g,function(W){var R=Ye(P,W,m,u,p,v);return S[r].overloadTable===void 0?(R.argCount=n-2,S[r]=R):S[r].overloadTable[n-2]=R,[]}),[]})}function Xe(t,r,n){return t instanceof Object||T(n+' with invalid "this": '+t),t instanceof r.registeredClass.constructor||T(n+' incompatible with "this" of type '+t.constructor.name),t.$$.ptr||T("cannot call emscripten binding method "+n+" on deleted object"),ye(t.$$.ptr,t.$$.ptrType.registeredClass,r.registeredClass)}function Yt(t,r,n,i,o,u,p,f,v,g){r=D(r),o=q(i,o),K([],[t],function(m){m=m[0];var P=m.name+"."+r,$={get:function(){ae("Cannot access "+P+" due to unbound types",[n,p])},enumerable:!0,configurable:!0};return v?$.set=function(){ae("Cannot access "+P+" due to unbound types",[n,p])}:$.set=function(S){T(P+" is a read-only property")},Object.defineProperty(m.registeredClass.instancePrototype,r,$),K([],v?[n,p]:[n],function(S){var U=S[0],W={get:function(){var L=Xe(this,m,P+" getter");return U.fromWireType(o(u,L))},enumerable:!0};if(v){v=q(f,v);var R=S[1];W.set=function(L){var oe=Xe(this,m,P+" setter"),I=[];v(g,oe,R.toWireType(I,L)),Ke(I)}}return Object.defineProperty(m.registeredClass.instancePrototype,r,W),[]}),[]})}function Xt(){this.allocated=[void 0],this.freelist=[],this.get=function(t){return this.allocated[t]},this.has=function(t){return this.allocated[t]!==void 0},this.allocate=function(t){var r=this.freelist.pop()||this.allocated.length;return this.allocated[r]=t,r},this.free=function(t){this.allocated[t]=void 0,this.freelist.push(t)}}var H=new Xt;function Qt(t){t>=H.reserved&&--H.get(t).refcount===0&&H.free(t)}function Zt(){for(var t=0,r=H.reserved;r<H.allocated.length;++r)H.allocated[r]!==void 0&&++t;return t}function Nt(){H.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),H.reserved=H.allocated.length,l.count_emval_handles=Zt}var Ue={toValue:function(t){return t||T("Cannot use deleted val. handle = "+t),H.get(t).value},toHandle:function(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return H.allocate({refcount:1,value:t})}}};function er(t,r){r=D(r),x(t,{name:r,fromWireType:function(n){var i=Ue.toValue(n);return Qt(n),i},toWireType:function(n,i){return Ue.toHandle(i)},argPackAdvance:8,readValueFromPointer:be,destructorFunction:null})}function Re(t){if(t===null)return"null";var r=typeof t;return r==="object"||r==="array"||r==="function"?t.toString():""+t}function tr(t,r){switch(r){case 2:return function(n){return this.fromWireType(fe[n>>2])};case 3:return function(n){return this.fromWireType(le[n>>3])};default:throw new TypeError("Unknown float type: "+t)}}function rr(t,r,n){var i=$e(n);r=D(r),x(t,{name:r,fromWireType:function(o){return o},toWireType:function(o,u){return u},argPackAdvance:8,readValueFromPointer:tr(r,i),destructorFunction:null})}function nr(t,r,n){switch(r){case 0:return n?function(o){return j[o]}:function(o){return O[o]};case 1:return n?function(o){return E[o>>1]}:function(o){return J[o>>1]};case 2:return n?function(o){return M[o>>2]}:function(o){return k[o>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function ir(t,r,n,i,o){r=D(r);var u=$e(n),p=function(P){return P};if(i===0){var f=32-8*n;p=function(P){return P<<f>>>f}}var v=r.includes("unsigned"),g=function(P,$){},m;v?m=function(P,$){return g($,this.name),$>>>0}:m=function(P,$){return g($,this.name),$},x(t,{name:r,fromWireType:p,toWireType:m,argPackAdvance:8,readValueFromPointer:nr(r,u,i!==0),destructorFunction:null})}function ar(t,r,n){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=i[r];function u(p){p=p>>2;var f=k,v=f[p],g=f[p+1];return new o(f.buffer,g,v)}n=D(n),x(t,{name:n,fromWireType:u,argPackAdvance:8,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})}function sr(t){for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++n):r+=3}return r}function or(t,r){r=D(r);var n=r==="std::string";x(t,{name:r,fromWireType:function(i){var o=k[i>>2],u=i+4,p;if(n)for(var f=u,v=0;v<=o;++v){var g=u+v;if(v==o||O[g]==0){var m=g-f,P=X(f,m);p===void 0?p=P:(p+=String.fromCharCode(0),p+=P),f=g+1}}else{for(var $=new Array(o),v=0;v<o;++v)$[v]=String.fromCharCode(O[u+v]);p=$.join("")}return z(i),p},toWireType:function(i,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var u,p=typeof o=="string";p||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int8Array||T("Cannot pass non-string to std::string"),n&&p?u=sr(o):u=o.length;var f=De(4+u+1),v=f+4;if(k[f>>2]=u,n&&p)at(o,v,u+1);else if(p)for(var g=0;g<u;++g){var m=o.charCodeAt(g);m>255&&(z(v),T("String has UTF-16 code units that do not fit in 8 bits")),O[v+g]=m}else for(var g=0;g<u;++g)O[v+g]=o[g];return i!==null&&i.push(z,f),f},argPackAdvance:8,readValueFromPointer:be,destructorFunction:function(i){z(i)}})}var Qe=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function fr(t,r){for(var n=t,i=n>>1,o=i+r/2;!(i>=o)&&J[i];)++i;if(n=i<<1,n-t>32&&Qe)return Qe.decode(O.subarray(t,n));for(var u="",p=0;!(p>=r/2);++p){var f=E[t+p*2>>1];if(f==0)break;u+=String.fromCharCode(f)}return u}function lr(t,r,n){if(n===void 0&&(n=2147483647),n<2)return 0;n-=2;for(var i=r,o=n<t.length*2?n/2:t.length,u=0;u<o;++u){var p=t.charCodeAt(u);E[r>>1]=p,r+=2}return E[r>>1]=0,r-i}function ur(t){return t.length*2}function cr(t,r){for(var n=0,i="";!(n>=r/4);){var o=M[t+n*4>>2];if(o==0)break;if(++n,o>=65536){var u=o-65536;i+=String.fromCharCode(55296|u>>10,56320|u&1023)}else i+=String.fromCharCode(o)}return i}function dr(t,r,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var i=r,o=i+n-4,u=0;u<t.length;++u){var p=t.charCodeAt(u);if(p>=55296&&p<=57343){var f=t.charCodeAt(++u);p=65536+((p&1023)<<10)|f&1023}if(M[r>>2]=p,r+=4,r+4>o)break}return M[r>>2]=0,r-i}function pr(t){for(var r=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i>=55296&&i<=57343&&++n,r+=4}return r}function gr(t,r,n){n=D(n);var i,o,u,p,f;r===2?(i=fr,o=lr,p=ur,u=function(){return J},f=1):r===4&&(i=cr,o=dr,p=pr,u=function(){return k},f=2),x(t,{name:n,fromWireType:function(v){for(var g=k[v>>2],m=u(),P,$=v+4,S=0;S<=g;++S){var U=v+4+S*r;if(S==g||m[U>>f]==0){var W=U-$,R=i($,W);P===void 0?P=R:(P+=String.fromCharCode(0),P+=R),$=U+r}}return z(v),P},toWireType:function(v,g){typeof g!="string"&&T("Cannot pass non-string to C++ string type "+n);var m=p(g),P=De(4+m+r);return k[P>>2]=m>>f,o(g,P+4,m+r),v!==null&&v.push(z,P),P},argPackAdvance:8,readValueFromPointer:be,destructorFunction:function(v){z(v)}})}function hr(t,r){r=D(r),x(t,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(n,i){}})}function vr(){throw 1/0}function yr(t,r,n,i,o,u,p){return-52}function br(t,r,n,i,o,u){}function mr(){F("")}var We;typeof performance<"u"&&performance.now?We=function(){return performance.now()}:We=Date.now;function wr(){return 2147483648}function Cr(t){var r=B.buffer;try{return B.grow(t-r.byteLength+65535>>>16),Y(),1}catch{}}function _r(t){var r=O.length;t=t>>>0;var n=wr();if(t>n)return!1;for(var i=function(v,g){return v+(g-v%g)%g},o=1;o<=4;o*=2){var u=r*(1+.2/o);u=Math.min(u,t+100663296);var p=Math.min(n,i(Math.max(t,u),65536)),f=Cr(p);if(f)return!0}return!1}var Ie={};function Tr(){return"./this.program"}function se(){if(!se.strings){var t=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:t,_:Tr()};for(var n in Ie)Ie[n]===void 0?delete r[n]:r[n]=Ie[n];var i=[];for(var n in r)i.push(n+"="+r[n]);se.strings=i}return se.strings}function Pr(t,r){for(var n=0;n<t.length;++n)j[r++>>0]=t.charCodeAt(n);j[r>>0]=0}function Ar(t,r){var n=0;return se().forEach(function(i,o){var u=r+n;k[t+o*4>>2]=u,Pr(i,u),n+=i.length+1}),0}function Fr(t,r){var n=se();k[t>>2]=n.length;var i=0;return n.forEach(function(o){i+=o.length+1}),k[r>>2]=i,0}function $r(t){throw"exit("+t+")"}var Sr=$r;function jr(t){return 52}function Or(t,r,n,i){return 52}function Er(t,r,n,i,o){return 70}var Mr=[null,[],[]];function kr(t,r){var n=Mr[t];r===0||r===10?((t===1?C:y)(pe(n,0)),n.length=0):n.push(r)}function Ur(t,r,n,i){for(var o=0,u=0;u<n;u++){var p=k[r>>2],f=k[r+4>>2];r+=8;for(var v=0;v<f;v++)kr(t,O[p+v]);o+=f}return k[i>>2]=o,0}dt(),N=l.BindingError=Oe(Error,"BindingError"),He=l.InternalError=Oe(Error,"InternalError"),Ot(),_t(),Lt(),Ge=l.UnboundTypeError=Oe(Error,"UnboundTypeError"),Nt();var Rr={b:Te,k:Pe,I:Ae,B:st,K:ot,G:ft,n:lt,H:ut,u:ct,r:ht,j:Jt,A:qt,d:Kt,c:Yt,L:er,p:rr,g:ir,e:ar,q:or,l:gr,s:hr,y:vr,C:yr,D:br,f:mr,m:We,z:_r,E:Ar,F:Fr,h:Sr,i:jr,o:Or,t:Er,J:Ur,x:Wr,v:Dr,w:Ir,a:B};function Wr(t,r,n){var i=Ce();try{return ie(t)(r,n)}catch(o){if(_e(i),o!==o+0)throw o;we(1,0)}}function Ir(t,r,n,i,o){var u=Ce();try{return ie(t)(r,n,i,o)}catch(p){if(_e(u),p!==p+0)throw p;we(1,0)}}function Dr(t,r,n,i){var o=Ce();try{return ie(t)(r,n,i)}catch(u){if(_e(o),u!==u+0)throw u;we(1,0)}}l.getTempRet0=tt,l.setTempRet0=et;function Lr(t){t.M()}var Ze={a:Rr},De,z,Ne,we,et,tt,Ce,_e;return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(fetch("jassub-worker-modern.wasm"),Ze):WebAssembly.instantiate(l.wasm,Ze)).then(function(t){w=(t.instance||t).exports,l._malloc=De=w.N,z=w.O,Ne=w.P,l.__embind_initialize_bindings=w.Q,we=w.S,et=w.T,tt=w.U,Ce=w.V,_e=w.W,w.X,w.Y,w.Z,w._,ue=w.R,Lr(w),_()}),l.ready};String.prototype.startsWith||(String.prototype.startsWith=function(s,l=0){return this.substring(l,s.length)===s});String.prototype.includes||(String.prototype.includes=function(s,l){return this.indexOf(s,l)!==-1});Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(s,l){return new Uint8Array(this.subarray(s,l))});function toAbsoluteIndex(s,l){const h=s>>0;return h<0?Math.max(h+l,0):Math.min(h,l)}Uint8Array.prototype.fill||(Int8Array.prototype.fill=Int16Array.prototype.fill=Int32Array.prototype.fill=Uint8Array.prototype.fill=Uint16Array.prototype.fill=Uint32Array.prototype.fill=Float32Array.prototype.fill=Float64Array.prototype.fill=Array.prototype.fill=function(s){if(this==null)throw new TypeError("this is null or not defined");const l=Object(this),h=l.length>>>0,C=arguments.length;let y=toAbsoluteIndex(C>1?arguments[1]:void 0,h);const _=C>2?arguments[2]:void 0,A=_===void 0?h:toAbsoluteIndex(_,h);for(;A>y;)l[y++]=s;return l});Uint8Array.prototype.copyWithin||(Int8Array.prototype.copyWithin=Int16Array.prototype.copyWithin=Int32Array.prototype.copyWithin=Uint8Array.prototype.copyWithin=Uint16Array.prototype.copyWithin=Uint32Array.prototype.copyWithin=Float32Array.prototype.copyWithin=Float64Array.prototype.copyWithin=Array.prototype.copyWithin=function(s,l){const h=Object(this),C=h.length>>>0;let y=toAbsoluteIndex(s,C),_=toAbsoluteIndex(l,C);const A=arguments.length>2?arguments[2]:void 0;let w=Math.min((A===void 0?C:toAbsoluteIndex(A,C))-_,C-y),F=1;for(_<y&&y<_+w&&(F=-1,_+=w-1,y+=w-1);w-- >0;)_ in h?h[y]=h[_]:delete h[y],y+=F,_+=F;return h});Date.now||(Date.now=()=>new Date().getTime());"performance"in self||(self.performance={now:()=>Date.now()});if(typeof console>"u"){const s=(l,h)=>{postMessage({target:"console",command:l,content:JSON.stringify(Array.prototype.slice.call(h))})};self.console={log:function(){s("log",arguments)},debug:function(){s("debug",arguments)},info:function(){s("info",arguments)},warn:function(){s("warn",arguments)},error:function(){s("error",arguments)}},console.log("Detected lack of console, overridden console")}typeof Promise>"u"&&(self.Promise=function(s){let l=()=>{};return s(h=>setTimeout(()=>l(h),0)),{then:h=>l=h}});const read_=(s,l)=>{const h=new XMLHttpRequest;return h.open("GET",s,!1),h.responseType=l?"arraybuffer":"text",h.send(null),h.response},readAsync=(s,l,h)=>{const C=new XMLHttpRequest;C.open("GET",s,!0),C.responseType="arraybuffer",C.onload=()=>{if((C.status===200||C.status===0)&&C.response)return l(C.response)},C.onerror=h,C.send(null)};let lastCurrentTime=0;const rate=1;let rafId=null,nextIsRaf=!1,lastCurrentTimeReceivedAt=Date.now(),targetFps=24,useLocalFonts=!1,blendMode="js",availableFonts={};const fontMap_={};let fontId=0,debug;self.width=0;self.height=0;let asyncRender=!1;self.addFont=({font:s})=>asyncWrite(s);const findAvailableFonts=s=>{s=s.trim().toLowerCase(),s.startsWith("@")&&(s=s.substring(1)),!fontMap_[s]&&(fontMap_[s]=!0,availableFonts[s]?asyncWrite(availableFonts[s]):useLocalFonts&&postMessage({target:"getLocalFont",font:s}))},asyncWrite=s=>{typeof s=="string"?readAsync(s,l=>{allocFont(new Uint8Array(l))},console.error):allocFont(s)},allocFont=s=>{const l=_malloc(s.byteLength);self.HEAPU8.set(s,l),jassubObj.addFont("font-"+fontId++,l,s.byteLength),jassubObj.reloadFonts()},processAvailableFonts=s=>{if(!availableFonts)return;const l=parseAss(s);for(let y=0;y<l.length;y++)for(let _=0;_<l[y].body.length;_++)l[y].body[_].key==="Style"&&findAvailableFonts(l[y].body[_].value.Fontname);const h=/\\fn([^\\}]*?)[\\}]/g;let C;for(;(C=h.exec(s))!==null;)findAvailableFonts(C[1])};self.setTrack=({content:s})=>{processAvailableFonts(s),dropAllBlur&&(s=dropBlur(s)),jassubObj.createTrackMem(s),subtitleColorSpace=libassYCbCrMap[jassubObj.trackColorSpace],postMessage({target:"verifyColorSpace",subtitleColorSpace})};self.getColorSpace=()=>postMessage({target:"verifyColorSpace",subtitleColorSpace});self.freeTrack=()=>{jassubObj.removeTrack()};self.setTrackByUrl=({url:s})=>{self.setTrack({content:read_(s)})};const getCurrentTime=()=>{const s=(Date.now()-lastCurrentTimeReceivedAt)/1e3;return _isPaused?lastCurrentTime:(s>5&&(console.error("Didn't received currentTime > 5 seconds. Assuming video was paused."),setIsPaused(!0)),lastCurrentTime+s*rate)},setCurrentTime=s=>{lastCurrentTime=s,lastCurrentTimeReceivedAt=Date.now(),rafId||(nextIsRaf?rafId=requestAnimationFrame(renderLoop):(renderLoop(),setTimeout(()=>{nextIsRaf=!1},20)))};let _isPaused=!0;const setIsPaused=s=>{s!==_isPaused&&(_isPaused=s,s?rafId&&(clearTimeout(rafId),rafId=null):(lastCurrentTimeReceivedAt=Date.now(),rafId=requestAnimationFrame(renderLoop)))},a="BT601",b="BT709",c="SMPTE240M",d="FCC",libassYCbCrMap=[null,a,null,a,a,b,b,c,c,d,d],render=(s,l)=>{const h={},C=performance.now(),y=blendMode==="wasm"?jassubObj.renderBlend(s,l||0):jassubObj.renderImage(s,l||0);if(debug){const _=performance.now(),A=jassubObj.time;h.WASMRenderTime=A-C,h.WASMBitmapDecodeTime=_-A,h.JSRenderTime=Date.now()}if(jassubObj.changed!==0||l){const _=[],A=[];if(!y)return paintImages({images:_,buffers:A,times:h});if(asyncRender){const w=[];for(let F=y,j=0;j<jassubObj.count;F=F.next,++j){const E={w:F.w,h:F.h,x:F.x,y:F.y},M=F.image,O=hasBitmapBug?self.HEAPU8C.slice(M,M+E.w*E.h*4):self.HEAPU8C.subarray(M,M+E.w*E.h*4);w.push(createImageBitmap(new ImageData(O,E.w,E.h))),_.push(E)}Promise.all(w).then(F=>{for(let j=0;j<_.length;j++)_[j].image=F[j];debug&&(h.JSBitmapGenerationTime=Date.now()-h.JSRenderTime),paintImages({images:_,buffers:F,times:h})})}else{for(let w=y,F=0;F<jassubObj.count;w=w.next,++F){const j={w:w.w,h:w.h,x:w.x,y:w.y,image:w.image};if(!offCanvasCtx){const E=self.wasmMemory.buffer.slice(w.image,w.image+w.w*w.h*4);A.push(E),j.image=E}_.push(j)}paintImages({images:_,buffers:A,times:h})}}else postMessage({target:"unbusy"})};self.demand=({time:s})=>{lastCurrentTime=s,render(s)};const renderLoop=s=>{rafId=0,render(getCurrentTime(),s),_isPaused||(rafId=requestAnimationFrame(renderLoop))},paintImages=({times:s,images:l,buffers:h})=>{const C={target:"render",asyncRender,images:l,times:s,width:self.width,height:self.height,colorSpace:subtitleColorSpace};if(offscreenRender){(offCanvas.height!==self.height||offCanvas.width!==self.width)&&(offCanvas.width=self.width,offCanvas.height=self.height),offCanvasCtx.clearRect(0,0,self.width,self.height);for(const y of l)y.image&&(asyncRender?(offCanvasCtx.drawImage(y.image,y.x,y.y),y.image.close()):(bufferCanvas.width=y.w,bufferCanvas.height=y.h,bufferCtx.putImageData(new ImageData(self.HEAPU8C.subarray(y.image,y.image+y.w*y.h*4),y.w,y.h),0,0),offCanvasCtx.drawImage(bufferCanvas,y.x,y.y)));if(offscreenRender==="hybrid"){if(!l.length)return postMessage(C);debug&&(s.bitmaps=l.length);try{const y=offCanvas.transferToImageBitmap();C.images=[{image:y,x:0,y:0}],C.asyncRender=!0,postMessage(C,[y])}catch{postMessage({target:"unbusy"})}}else{if(debug){s.JSRenderTime=Date.now()-s.JSRenderTime-(s.JSBitmapGenerationTime||0);let y=0;for(const _ in s)y+=s[_];console.log("Bitmaps: "+l.length+" Total: "+(y|0)+"ms",s)}postMessage({target:"unbusy"})}}else postMessage(C,h)},parseAss=s=>{let l,h,C,y,_,A,w,F,j,E;const M=[],O=s.split(/[\r\n]+/g);for(F=0;F<O.length;F++)if(l=O[F].match(/^\[(.*)\]$/),l)h=null,M.push({name:l[1],body:[]});else{if(/^\s*$/.test(O[F])||M.length===0)continue;if(E=M[M.length-1].body,O[F][0]===";")E.push({type:"comment",value:O[F].substring(1)});else{if(y=O[F].split(":"),_=y[0],A=y.slice(1).join(":").trim(),(h||_==="Format")&&(A=A.split(","),h&&A.length>h.length&&(C=A.slice(h.length-1).join(","),A=A.slice(0,h.length-1),A.push(C)),A=A.map(J=>J.trim()),h)){for(w={},j=0;j<A.length;j++)w[h[j]]=A[j];A=w}_==="Format"&&(h=A),E.push({key:_,value:A})}}return M},blurRegex=/\\blur(?:[0-9]+\.)?[0-9]+/gm,dropBlur=s=>s.replace(blurRegex,""),requestAnimationFrame=(()=>{let s=0;return l=>{const h=Date.now();if(s===0)s=h+1e3/targetFps;else for(;h+2>=s;)s+=1e3/targetFps;const C=Math.max(s-h,0);return setTimeout(l,C)}})(),_applyKeys=(s,l)=>{for(const h of Object.keys(s))l[h]=s[h]};let offCanvas,offCanvasCtx,offscreenRender,bufferCanvas,bufferCtx,jassubObj,subtitleColorSpace,dropAllBlur,_malloc,hasBitmapBug;self.init=data=>{hasBitmapBug=data.hasBitmapBug;try{const s=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(s instanceof WebAssembly.Module)||!(new WebAssembly.Instance(s)instanceof WebAssembly.Instance))throw new Error("WASM not supported")}catch(e){console.warn(e),eval(read_(data.legacyWasmUrl))}if(WebAssembly.instantiateStreaming){const s=self.fetch;self.fetch=l=>s(data.wasmUrl)}Module({wasm:!WebAssembly.instantiateStreaming&&read_(data.wasmUrl,!0)}).then(s=>{_malloc=s._malloc,self.width=data.width,self.height=data.height,blendMode=data.blendMode,asyncRender=data.asyncRender,asyncRender&&typeof createImageBitmap>"u"&&(asyncRender=!1,console.error("'createImageBitmap' needed for 'asyncRender' unsupported!")),availableFonts=data.availableFonts,debug=data.debug,targetFps=data.targetFps||targetFps,useLocalFonts=data.useLocalFonts,dropAllBlur=data.dropAllBlur;const l=data.fallbackFont.toLowerCase();jassubObj=new s.JASSUB(self.width,self.height,l||null,debug),l&&findAvailableFonts(l);let h=data.subContent;h||(h=read_(data.subUrl)),processAvailableFonts(h),dropAllBlur&&(h=dropBlur(h));for(const C of data.fonts||[])asyncWrite(C);jassubObj.createTrackMem(h),subtitleColorSpace=libassYCbCrMap[jassubObj.trackColorSpace],jassubObj.setDropAnimations(data.dropAllAnimations||0),(data.libassMemoryLimit>0||data.libassGlyphLimit>0)&&jassubObj.setMemoryLimits(data.libassGlyphLimit||0,data.libassMemoryLimit||0),postMessage({target:"ready"}),postMessage({target:"verifyColorSpace",subtitleColorSpace})})};self.offscreenCanvas=({transferable:s})=>{offCanvas=s[0],offCanvasCtx=offCanvas.getContext("2d"),asyncRender||(bufferCanvas=new OffscreenCanvas(self.height,self.width),bufferCtx=bufferCanvas.getContext("2d",{desynchronized:!0})),offscreenRender=!0};self.detachOffscreen=()=>{offCanvas=new OffscreenCanvas(self.height,self.width),offCanvasCtx=offCanvas.getContext("2d",{desynchronized:!0}),offscreenRender="hybrid"};self.canvas=({width:s,height:l,force:h})=>{if(s==null)throw new Error("Invalid canvas size specified");self.width=s,self.height=l,jassubObj&&jassubObj.resizeCanvas(s,l),h&&render(lastCurrentTime,!0)};self.video=({currentTime:s,isPaused:l,rate:h})=>{s!=null&&setCurrentTime(s),l!=null&&setIsPaused(l),h=h||h};self.destroy=()=>{jassubObj.quitLibrary()};self.createEvent=({event:s})=>{_applyKeys(s,jassubObj.getEvent(jassubObj.allocEvent()))};self.getEvents=()=>{const s=[];for(let l=0;l<jassubObj.getEventCount();l++){const{Start:h,Duration:C,ReadOrder:y,Layer:_,Style:A,MarginL:w,MarginR:F,MarginV:j,Name:E,Text:M,Effect:O}=jassubObj.getEvent(l);s.push({Start:h,Duration:C,ReadOrder:y,Layer:_,Style:A,MarginL:w,MarginR:F,MarginV:j,Name:E,Text:M,Effect:O})}postMessage({target:"getEvents",events:s})};self.setEvent=({event:s,index:l})=>{_applyKeys(s,jassubObj.getEvent(l))};self.removeEvent=({index:s})=>{jassubObj.removeEvent(s)};self.createStyle=({style:s})=>{_applyKeys(s,jassubObj.getStyle(jassubObj.allocStyle()))};self.getStyles=()=>{const s=[];for(let l=0;l<jassubObj.getStyleCount();l++){const{Name:h,FontName:C,FontSize:y,PrimaryColour:_,SecondaryColour:A,OutlineColour:w,BackColour:F,Bold:j,Italic:E,Underline:M,StrikeOut:O,ScaleX:J,ScaleY:k,Spacing:fe,Angle:le,BorderStyle:B,Outline:ue,Shadow:Y,Alignment:ce,MarginL:de,MarginR:pe,MarginV:X,Encoding:Te,treat_fontname_as_pattern:Pe,Blur:Ae,Justify:Fe}=jassubObj.getStyle(l);s.push({Name:h,FontName:C,FontSize:y,PrimaryColour:_,SecondaryColour:A,OutlineColour:w,BackColour:F,Bold:j,Italic:E,Underline:M,StrikeOut:O,ScaleX:J,ScaleY:k,Spacing:fe,Angle:le,BorderStyle:B,Outline:ue,Shadow:Y,Alignment:ce,MarginL:de,MarginR:pe,MarginV:X,Encoding:Te,treat_fontname_as_pattern:Pe,Blur:Ae,Justify:Fe})}postMessage({target:"getStyles",time:Date.now(),styles:s})};self.setStyle=({style:s,index:l})=>{_applyKeys(s,jassubObj.getStyle(l))};self.removeStyle=({index:s})=>{jassubObj.removeStyle(s)};onmessage=({data:s})=>{if(self[s.target])self[s.target](s);else throw new Error("Unknown event target "+s.target)};
Binary file