conformtools 0.6.5 → 0.6.7

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 (149) hide show
  1. package/README.md +18 -13
  2. package/dist/account-DJTD3KYK.js +3 -0
  3. package/dist/arriraw-YIJ3BYNN.js +525 -0
  4. package/dist/avid-panel/MANIFEST.json +11 -0
  5. package/dist/avid-panel/avid-manifest.json +46 -0
  6. package/dist/avid-panel/icon.svg +4 -0
  7. package/dist/avid-panel/icons/conformtools.svg +4 -0
  8. package/dist/avid-panel/index.html +26 -0
  9. package/dist/avid-panel/panel.css +12 -0
  10. package/dist/avid-panel/panel.js +7 -0
  11. package/dist/bridge-JQF4V3V2.js +3 -0
  12. package/dist/browser/timeline_core_bg.wasm +0 -0
  13. package/dist/chunk-2BPR6LK6.js +3 -0
  14. package/dist/chunk-3D3Z4TBR.js +3 -0
  15. package/dist/chunk-55BKURYP.js +378 -0
  16. package/dist/chunk-5WEZRGXG.js +39 -0
  17. package/dist/chunk-6V4OEOOX.js +3 -0
  18. package/dist/chunk-7D7H6VFW.js +3 -0
  19. package/dist/chunk-A7FNR3T5.js +3 -0
  20. package/dist/chunk-AACY2V3L.js +3 -0
  21. package/dist/chunk-AMRJXYL4.js +3 -0
  22. package/dist/chunk-C2ESM27Z.js +3 -0
  23. package/dist/chunk-D4WPRRBT.js +3 -0
  24. package/dist/chunk-D6YDLKSA.js +3 -0
  25. package/dist/chunk-DKGGJM6Z.js +3 -0
  26. package/dist/chunk-EUBXH67N.js +7 -0
  27. package/dist/chunk-GK4YYKJ6.js +19 -0
  28. package/dist/chunk-GM6QKY7W.js +3 -0
  29. package/dist/chunk-J2JXLEAI.js +3 -0
  30. package/dist/chunk-JV7TZDKJ.js +3 -0
  31. package/dist/chunk-NAFLOZER.js +9 -0
  32. package/dist/chunk-NFJHWZJX.js +3 -0
  33. package/dist/chunk-NU3X7P4N.js +3 -0
  34. package/dist/chunk-P2LL3JMC.js +20 -0
  35. package/dist/chunk-PFISREY4.js +3 -0
  36. package/dist/chunk-PFZVET7S.js +3 -0
  37. package/dist/chunk-PHAMF4JF.js +4 -0
  38. package/dist/chunk-PLRB2YXJ.js +3 -0
  39. package/dist/chunk-PSANHDZM.js +3 -0
  40. package/dist/chunk-RGMTLNMF.js +3 -0
  41. package/dist/chunk-RJ6JA2LZ.js +3 -0
  42. package/dist/chunk-S5JDS5PQ.js +5 -0
  43. package/dist/chunk-SGLQY53R.js +3 -0
  44. package/dist/chunk-SKFMOLUO.js +8 -0
  45. package/dist/chunk-SNTAZJ5A.js +6 -0
  46. package/dist/chunk-TK55FA56.js +3 -0
  47. package/dist/chunk-TXQR2HI2.js +4 -0
  48. package/dist/chunk-VIBEEWPC.js +10 -0
  49. package/dist/chunk-WN53ARHJ.js +3 -0
  50. package/dist/chunk-XLEINKFL.js +5 -0
  51. package/dist/claude-setup-IIWUB4CE.js +5 -0
  52. package/dist/cli.js +17 -0
  53. package/dist/clip-state-B6JOX3JE.js +3 -0
  54. package/dist/conformtools-analyze +0 -0
  55. package/dist/conformtools-decode +0 -0
  56. package/dist/cr3-wasm-HLJWEV2S.js +3 -0
  57. package/dist/dng-wasm-CQDLPM5V.js +3 -0
  58. package/dist/dpx-wasm-TLGMM7BO.js +3 -0
  59. package/dist/engine-P6H5P6HP.js +5 -0
  60. package/dist/esm-SFFBP7PS.js +3 -0
  61. package/dist/exr-wasm-2NPKPTVB.js +3 -0
  62. package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
  63. package/dist/flame/hook/conformtools_flame/building.py +191 -0
  64. package/dist/flame/hook/conformtools_flame/hook.py +177 -0
  65. package/dist/flame/hook/conformtools_flame/render.py +622 -0
  66. package/dist/flame/hook/conformtools_flame/util.py +33 -0
  67. package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
  68. package/dist/flame/hook/conformtools_flame_hook.py +42 -0
  69. package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
  70. package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
  71. package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
  72. package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
  73. package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
  74. package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
  75. package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
  76. package/dist/fonts/gfx/OFL.txt +100 -0
  77. package/dist/framing-SWOD4CWB.js +3 -0
  78. package/dist/gfx-worker.js +3 -0
  79. package/dist/h264-JJMZSUWW.js +3 -0
  80. package/dist/h264-mxf-DCUOGLDU.js +3 -0
  81. package/dist/host-relink-TWAF6WIG.js +10 -0
  82. package/dist/hosts-Z666EF7V.js +3 -0
  83. package/dist/http.js +5 -0
  84. package/dist/i2o-transfer +0 -0
  85. package/dist/inspect-FJKYPEXL.js +68 -0
  86. package/dist/isobmff-VJOWP4MH.js +3 -0
  87. package/dist/mc-video-5MGGOQN4.js +3 -0
  88. package/dist/mcp.js +13 -0
  89. package/dist/media-NZYVREUF.js +3 -0
  90. package/dist/media_core-YZ3PABEG.js +9 -0
  91. package/dist/media_core_bg-FDL7GJZP.js +3 -0
  92. package/dist/media_core_bg-XRBVKQZH.js +3 -0
  93. package/dist/mxf-FJSRFLJC.js +3 -0
  94. package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
  95. package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
  96. package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
  97. package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
  98. package/dist/ops-X7NAREC4.js +3 -0
  99. package/dist/peer-kit/ctpeer/__init__.py +21 -0
  100. package/dist/peer-kit/ctpeer/client.py +247 -0
  101. package/dist/peer-kit/ctpeer/neutral.py +178 -0
  102. package/dist/peer-kit/ctpeer/pairing.py +139 -0
  103. package/dist/peer-kit/ctpeer/protocol.py +209 -0
  104. package/dist/peer-kit/ctpeer/websocket.py +289 -0
  105. package/dist/premiere-uxp/icons/panel.png +0 -0
  106. package/dist/premiere-uxp/icons/panel@2x.png +0 -0
  107. package/dist/premiere-uxp/icons/plugin.png +0 -0
  108. package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
  109. package/dist/premiere-uxp/index.html +38 -0
  110. package/dist/premiere-uxp/index.js +93 -0
  111. package/dist/premiere-uxp/lib/clipmeta.js +170 -0
  112. package/dist/premiere-uxp/lib/ctx.js +68 -0
  113. package/dist/premiere-uxp/lib/edit.js +516 -0
  114. package/dist/premiere-uxp/lib/handles.js +57 -0
  115. package/dist/premiere-uxp/lib/markers.js +198 -0
  116. package/dist/premiere-uxp/lib/pairing.js +67 -0
  117. package/dist/premiere-uxp/lib/premiere.js +91 -0
  118. package/dist/premiere-uxp/lib/probe.js +452 -0
  119. package/dist/premiere-uxp/lib/protocol.js +165 -0
  120. package/dist/premiere-uxp/lib/render.js +45 -0
  121. package/dist/premiere-uxp/lib/session.js +85 -0
  122. package/dist/premiere-uxp/lib/sizing.js +325 -0
  123. package/dist/premiere-uxp/lib/time.js +88 -0
  124. package/dist/premiere-uxp/lib/timeline.js +336 -0
  125. package/dist/premiere-uxp/lib/verbs.js +21 -0
  126. package/dist/premiere-uxp/lib/write.js +97 -0
  127. package/dist/premiere-uxp/manifest.json +102 -0
  128. package/dist/probe-F7WQHMIA.js +3 -0
  129. package/dist/prores-RIG37OIH.js +526 -0
  130. package/dist/r3d-CXUNG6VS.js +1025 -0
  131. package/dist/r3d-T5O6IIZZ.js +3 -0
  132. package/dist/resolve-bridge.py +2286 -0
  133. package/dist/resolve-presets/conform.tools.xml +127 -0
  134. package/dist/source-QGWWLMME.js +3 -0
  135. package/dist/statusline-GMMCFMOA.js +4 -0
  136. package/dist/statusline.js +3 -0
  137. package/dist/still-P4JJNTEO.js +3 -0
  138. package/dist/still-wasm-DN5LPASS.js +3 -0
  139. package/dist/store-7IOEBOZY.js +3 -0
  140. package/dist/tiff-wasm-BPRDR6EB.js +3 -0
  141. package/dist/timeline-DQG6TVPF.js +3 -0
  142. package/dist/timeline_core-IOENXK4Z.js +3 -0
  143. package/dist/timeline_core_bg-JW42YM3G.js +3 -0
  144. package/dist/udf_bg-B37GKRIH.js +3 -0
  145. package/dist/wasm/media_core_bg.wasm +0 -0
  146. package/dist/wasm/udf_bg.wasm +0 -0
  147. package/dist/wasm-threads/media_core_bg.wasm +0 -0
  148. package/dist/wav-64SC6P7U.js +3 -0
  149. package/package.json +6 -4
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{d as ba}from"./chunk-NU3X7P4N.js";import{Ha as va,a as xa}from"./chunk-RJ6JA2LZ.js";import{a as ke}from"./chunk-PHAMF4JF.js";import{I as jn,J as ma,K as ya,V as st,W as tn,X as it,Y as ve,b as Ms,d as Ps,g as Bs,k as fa,l as pa,m as ha,p as _n,r as da,s as ga,t as en,u as Gt,v as Gn,w as Hn,x as Ns,y as Vn}from"./chunk-PLRB2YXJ.js";import{c as ah,f as ih}from"./chunk-PSANHDZM.js";var Fa=ah((Ia,Yn)=>{var Aa=(()=>{var i=Object.defineProperty,p=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,y=Object.prototype.hasOwnProperty,x=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h(t))!y.call(e,o)&&o!==n&&i(e,o,{get:()=>t[o],enumerable:!(s=p(t,o))||s.enumerable});return e},b=e=>d(i({},"__esModule",{value:!0}),e),T={};x(T,{BoundingBox:()=>Qe,Font:()=>aa,Glyph:()=>Ut,Path:()=>xt,_parse:()=>N,load:()=>sh,loadSync:()=>oh,parse:()=>nh});var C=0,L=-3;function A(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function E(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new A,this.dtree=new A}var F=new A,B=new A,U=new Uint8Array(30),R=new Uint16Array(30),M=new Uint8Array(30),D=new Uint16Array(30),_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),X=new A,Z=new Uint8Array(320);function Q(e,t,n,s){var o,r;for(o=0;o<n;++o)e[o]=0;for(o=0;o<30-n;++o)e[o+n]=o/n|0;for(r=s,o=0;o<30;++o)t[o]=r,r+=1<<e[o]}function se(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n}var K=new Uint16Array(16);function fe(e,t,n,s){var o,r;for(o=0;o<16;++o)e.table[o]=0;for(o=0;o<s;++o)e.table[t[n+o]]++;for(e.table[0]=0,r=0,o=0;o<16;++o)K[o]=r,r+=e.table[o];for(o=0;o<s;++o)t[n+o]&&(e.trans[K[t[n+o]]++]=o)}function Se(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=e.tag&1;return e.tag>>>=1,t}function Te(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var s=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,s+n}function Rt(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,s=0,o=0,r=e.tag;do s=2*s+(r&1),r>>>=1,++o,n+=t.table[o],s-=t.table[o];while(s>=0);return e.tag=r,e.bitcount-=o,t.trans[n+s]}function ne(e,t,n){var s,o,r,a,l,c;for(s=Te(e,5,257),o=Te(e,5,1),r=Te(e,4,4),a=0;a<19;++a)Z[a]=0;for(a=0;a<r;++a){var f=Te(e,3,0);Z[_[a]]=f}for(fe(X,Z,0,19),l=0;l<s+o;){var u=Rt(e,X);switch(u){case 16:var m=Z[l-1];for(c=Te(e,2,3);c;--c)Z[l++]=m;break;case 17:for(c=Te(e,3,3);c;--c)Z[l++]=0;break;case 18:for(c=Te(e,7,11);c;--c)Z[l++]=0;break;default:Z[l++]=u;break}}fe(t,Z,0,s),fe(n,Z,s,o)}function te(e,t,n){for(;;){var s=Rt(e,t);if(s===256)return C;if(s<256)e.dest[e.destLen++]=s;else{var o,r,a,l;for(s-=257,o=Te(e,U[s],R[s]),r=Rt(e,n),a=e.destLen-Te(e,M[r],D[r]),l=a;l<a+o;++l)e.dest[e.destLen++]=e.dest[l]}}}function ge(e){for(var t,n,s;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],n=e.source[e.sourceIndex+3],n=256*n+e.source[e.sourceIndex+2],t!==(~n&65535))return L;for(e.sourceIndex+=4,s=t;s;--s)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,C}function Ee(e,t){var n=new E(e,t),s,o,r;do{switch(s=Se(n),o=Te(n,2,0),o){case 0:r=ge(n);break;case 1:r=te(n,F,B);break;case 2:ne(n,n.ltree,n.dtree),r=te(n,n.ltree,n.dtree);break;default:r=L}if(r!==C)throw new Error("Data error")}while(!s);return n.destLen<n.dest.length?typeof n.dest.slice=="function"?n.dest.slice(0,n.destLen):n.dest.subarray(0,n.destLen):n.dest}se(F,B),Q(U,R,4,3),Q(M,D,2,1),U[28]=0,R[28]=258;function Ue(e,t,n,s,o){return Math.pow(1-o,3)*e+3*Math.pow(1-o,2)*o*t+3*(1-o)*Math.pow(o,2)*n+Math.pow(o,3)*s}function he(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}he.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},he.prototype.addPoint=function(e,t){typeof e=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),typeof t=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},he.prototype.addX=function(e){this.addPoint(e,null)},he.prototype.addY=function(e){this.addPoint(null,e)},he.prototype.addBezier=function(e,t,n,s,o,r,a,l){let c=[e,t],f=[n,s],u=[o,r],m=[a,l];this.addPoint(e,t),this.addPoint(a,l);for(let g=0;g<=1;g++){let S=6*c[g]-12*f[g]+6*u[g],v=-3*c[g]+9*f[g]-9*u[g]+3*m[g],k=3*f[g]-3*c[g];if(v===0){if(S===0)continue;let Y=-k/S;0<Y&&Y<1&&(g===0&&this.addX(Ue(c[g],f[g],u[g],m[g],Y)),g===1&&this.addY(Ue(c[g],f[g],u[g],m[g],Y)));continue}let O=Math.pow(S,2)-4*k*v;if(O<0)continue;let W=(-S+Math.sqrt(O))/(2*v);0<W&&W<1&&(g===0&&this.addX(Ue(c[g],f[g],u[g],m[g],W)),g===1&&this.addY(Ue(c[g],f[g],u[g],m[g],W)));let V=(-S-Math.sqrt(O))/(2*v);0<V&&V<1&&(g===0&&this.addX(Ue(c[g],f[g],u[g],m[g],V)),g===1&&this.addY(Ue(c[g],f[g],u[g],m[g],V)))}},he.prototype.addQuad=function(e,t,n,s,o,r){let a=e+.6666666666666666*(n-e),l=t+2/3*(s-t),c=a+1/3*(o-e),f=l+1/3*(r-t);this.addBezier(e,t,a,l,c,f,o,r)};var Qe=he;function de(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var Wt={};function xo(e,t){let n=Math.floor(e),s=e-n;if(Wt[t]||(Wt[t]={}),Wt[t][s]!==void 0){let r=Wt[t][s];return n+r}let o=+(Math.round(s+"e+"+t)+"e-"+t);return Wt[t][s]=o,n+o}function vo(e){let t=[[]],n=0,s=0;for(let o=0;o<e.length;o+=1){let r=t[t.length-1],a=e[o],l=r[0],c=r[1],f=r[r.length-1],u=e[o+1];r.push(a),a.type==="M"?(n=a.x,s=a.y):a.type==="L"&&(!u||u.type==="Z")?Math.abs(a.x-n)>1||Math.abs(a.y-s)>1||r.pop():a.type==="L"&&f&&f.x===a.x&&f.y===a.y?r.pop():a.type==="Z"&&(l&&c&&f&&l.type==="M"&&c.type==="L"&&f.type==="L"&&f.x===l.x&&f.y===l.y&&(r.shift(),r[0].type="M"),o+1<e.length&&t.push([]))}return e=[].concat.apply([],t),e}function gi(e){return Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0,scale:1,x:0,y:0},e)}function mi(e){return parseInt(e)===e&&(e={decimalPlaces:e,flipY:!1}),Object.assign({},{decimalPlaces:2,optimize:!0,flipY:!0,flipYBase:void 0},e)}de.prototype.fromSVG=function(e,t={}){typeof SVGPathElement<"u"&&e instanceof SVGPathElement&&(e=e.getAttribute("d")),t=gi(t),this.commands=[];let n="0123456789",s="MmLlQqCcZzHhVv",o="SsTtAa",r="-+",a={},l=[""],c=!1;function f(v){return v.filter(k=>k.length).map(k=>{let O=parseFloat(k);return(t.decimalPlaces||t.decimalPlaces===0)&&(O=xo(O,t.decimalPlaces)),O})}function u(v){if(!this.commands.length)return v;let k=this.commands[this.commands.length-1];for(let O=0;O<v.length;O++)v[O]+=k[O&1?"y":"x"];return v}function m(){if(a.type===void 0)return;let v=a.type.toUpperCase(),k=v!=="Z"&&a.type.toUpperCase()!==a.type,O=f(l);if(l=[""],!O.length&&v!=="Z")return;k&&v!=="H"&&v!=="V"&&(O=u.apply(this,[O]));let W=this.commands.length&&this.commands[this.commands.length-1].x||0,V=this.commands.length&&this.commands[this.commands.length-1].y||0;switch(v){case"M":this.moveTo(...O);break;case"L":this.lineTo(...O);break;case"V":for(let Y=0;Y<O.length;Y++){let J=0;k&&(J=this.commands.length&&this.commands[this.commands.length-1].y||0),this.lineTo(W,O[Y]+J)}break;case"H":for(let Y=0;Y<O.length;Y++){let J=0;k&&(J=this.commands.length&&this.commands[this.commands.length-1].x||0),this.lineTo(O[Y]+J,V)}break;case"C":this.bezierCurveTo(...O);break;case"Q":this.quadraticCurveTo(...O);break;case"Z":(this.commands.length<1||this.commands[this.commands.length-1].type!=="Z")&&this.close();break}if(this.commands.length)for(let Y in this.commands[this.commands.length-1])this.commands[this.commands.length-1][Y]===void 0&&(this.commands[this.commands.length-1][Y]=0)}for(let v=0;v<e.length;v++){let k=e.charAt(v),O=l[l.length-1];if(n.indexOf(k)>-1)l[l.length-1]+=k;else if(r.indexOf(k)>-1)if(!a.type&&!this.commands.length&&(a.type="L"),k==="-")!a.type||O.indexOf("-")>0?c=!0:O.length?l.push("-"):l[l.length-1]=k;else if(!a.type||O.length>0)c=!0;else continue;else if(s.indexOf(k)>-1)a.type?(m.apply(this),a={type:k}):a.type=k;else{if(o.indexOf(k)>-1)throw new Error("Unsupported path command: "+k+". Currently supported commands are "+s.split("").join(", ")+".");` ,
4
+ \r\f\v`.indexOf(k)>-1?l.push(""):k==="."?!a.type||O.indexOf(k)>-1?c=!0:l[l.length-1]+=k:c=!0}if(c)throw new Error("Unexpected character: "+k+" at offset "+v)}m.apply(this),t.optimize&&(this.commands=vo(this.commands));let g=t.flipY,S=t.flipYBase;if(g===!0&&t.flipYBase===void 0){let v=this.getBoundingBox();S=v.y1+v.y2}for(let v in this.commands){let k=this.commands[v];for(let O in k)["x","x1","x2"].includes(O)?this.commands[v][O]=t.x+k[O]*t.scale:["y","y1","y2"].includes(O)&&(this.commands[v][O]=t.y+(g?S-k[O]:k[O])*t.scale)}return this},de.fromSVG=function(e,t){return new de().fromSVG(e,t)},de.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})},de.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})},de.prototype.curveTo=de.prototype.bezierCurveTo=function(e,t,n,s,o,r){this.commands.push({type:"C",x1:e,y1:t,x2:n,y2:s,x:o,y:r})},de.prototype.quadTo=de.prototype.quadraticCurveTo=function(e,t,n,s){this.commands.push({type:"Q",x1:e,y1:t,x:n,y:s})},de.prototype.close=de.prototype.closePath=function(){this.commands.push({type:"Z"})},de.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof Qe){let t=e;this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),this.close();return}Array.prototype.push.apply(this.commands,e)},de.prototype.getBoundingBox=function(){let e=new Qe,t=0,n=0,s=0,o=0;for(let r=0;r<this.commands.length;r++){let a=this.commands[r];switch(a.type){case"M":e.addPoint(a.x,a.y),t=s=a.x,n=o=a.y;break;case"L":e.addPoint(a.x,a.y),s=a.x,o=a.y;break;case"Q":e.addQuad(s,o,a.x1,a.y1,a.x,a.y),s=a.x,o=a.y;break;case"C":e.addBezier(s,o,a.x1,a.y1,a.x2,a.y2,a.x,a.y),s=a.x,o=a.y;break;case"Z":s=t,o=n;break;default:throw new Error("Unexpected path command "+a.type)}}return e.isEmpty()&&e.addPoint(0,0),e},de.prototype.draw=function(e){let t=this._layers;if(t&&t.length){for(let s=0;s<t.length;s++)this.draw.call(t[s],e);return}let n=this._image;if(n){e.drawImage(n.image,n.x,n.y,n.width,n.height);return}e.beginPath();for(let s=0;s<this.commands.length;s+=1){let o=this.commands[s];o.type==="M"?e.moveTo(o.x,o.y):o.type==="L"?e.lineTo(o.x,o.y):o.type==="C"?e.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y):o.type==="Q"?e.quadraticCurveTo(o.x1,o.y1,o.x,o.y):o.type==="Z"&&this.stroke&&this.strokeWidth&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},de.prototype.toPathData=function(e){e=mi(e);function t(l){let c=xo(l,e.decimalPlaces);return Math.round(l)===c?""+c:c.toFixed(e.decimalPlaces)}function n(){let l="";for(let c=0;c<arguments.length;c+=1){let f=arguments[c];f>=0&&c>0&&(l+=" "),l+=t(f)}return l}let s=this.commands;e.optimize&&(s=JSON.parse(JSON.stringify(this.commands)),s=vo(s));let o=e.flipY,r=e.flipYBase;if(o===!0&&r===void 0){let l=new de;l.extend(s);let c=l.getBoundingBox();r=c.y1+c.y2}let a="";for(let l=0;l<s.length;l+=1){let c=s[l];c.type==="M"?a+="M"+n(c.x,o?r-c.y:c.y):c.type==="L"?a+="L"+n(c.x,o?r-c.y:c.y):c.type==="C"?a+="C"+n(c.x1,o?r-c.y1:c.y1,c.x2,o?r-c.y2:c.y2,c.x,o?r-c.y:c.y):c.type==="Q"?a+="Q"+n(c.x1,o?r-c.y1:c.y1,c.x,o?r-c.y:c.y):c.type==="Z"&&(a+="Z")}return a},de.prototype.toSVG=function(e,t){this._layers&&this._layers.length&&console.warn("toSVG() does not support colr font layers yet"),this._image&&console.warn("toSVG() does not support SVG glyphs yet"),t||(t=this.toPathData(e));let n='<path d="';return n+=t,n+='"',this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?n+=' fill="none"':n+=' fill="'+this.fill+'"'),this.stroke&&(n+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),n+="/>",n},de.prototype.toDOMElement=function(e,t){this._layers&&this._layers.length&&console.warn("toDOMElement() does not support colr font layers yet"),t||(t=this.toPathData(e));let n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",t),this.fill!==void 0&&this.fill!=="black"&&(this.fill===null?n.setAttribute("fill","none"):n.setAttribute("fill",this.fill)),this.stroke&&(n.setAttribute("stroke",this.stroke),n.setAttribute("stroke-width",this.strokeWidth)),n};var xt=de;function So(e){throw new Error(e)}function ko(e,t){e||So(t)}var $={fail:So,argument:ko,assert:ko},To=32768,wo=2147483648,yi=-32768,bi=32767+1/65536,At={},P={},q={};function We(e){return function(){return e}}P.BYTE=function(e){return $.argument(e>=0&&e<=255,"Byte value should be between 0 and 255."),[e]},q.BYTE=We(1),P.CHAR=function(e){return[e.charCodeAt(0)]},q.CHAR=We(1),P.CHARARRAY=function(e){(e===null||typeof e>"u")&&(e="",console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));let t=[];for(let n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t},q.CHARARRAY=function(e){return typeof e>"u"?0:e.length},P.USHORT=function(e){return[e>>8&255,e&255]},q.USHORT=We(2),P.SHORT=function(e){return e>=To&&(e=-(2*To-e)),[e>>8&255,e&255]},q.SHORT=We(2),P.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]},q.UINT24=We(3),P.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]},q.ULONG=We(4),P.LONG=function(e){return e>=wo&&(e=-(2*wo-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]},q.LONG=We(4),P.FLOAT=function(e){if(e>bi||e<yi)throw new Error(`Value ${e} is outside the range of representable values in 16.16 format`);let t=Math.round(e*65536)<<0;return P.ULONG(t)},q.FLOAT=q.ULONG,P.FIXED=P.ULONG,q.FIXED=q.ULONG,P.FWORD=P.SHORT,q.FWORD=q.SHORT,P.UFWORD=P.USHORT,q.UFWORD=q.USHORT,P.F2DOT14=function(e){return P.USHORT(e*16384)},q.F2DOT14=q.USHORT,P.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]},q.LONGDATETIME=We(8),P.TAG=function(e){return $.argument(e.length===4,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},q.TAG=We(4),P.Card8=P.BYTE,q.Card8=q.BYTE,P.Card16=P.USHORT,q.Card16=q.USHORT,P.OffSize=P.BYTE,q.OffSize=q.BYTE,P.SID=P.USHORT,q.SID=q.USHORT,P.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?(e=e-108,[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e<=32767?P.NUMBER16(e):P.NUMBER32(e)},q.NUMBER=function(e){return P.NUMBER(e).length},P.NUMBER16=function(e){return[28,e>>8&255,e&255]},q.NUMBER16=We(3),P.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]},q.NUMBER32=We(5),P.REAL=function(e){let t=e.toString(),n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(n){let r=parseFloat("1e"+((n[2]?+n[2]:0)+n[1].length));t=(Math.round(e*r)/r).toString()}let s="";for(let r=0,a=t.length;r<a;r+=1){let l=t[r];l==="e"?s+=t[++r]==="-"?"c":"b":l==="."?s+="a":l==="-"?s+="e":s+=l}s+=s.length&1?"f":"ff";let o=[30];for(let r=0,a=s.length;r<a;r+=2)o.push(parseInt(s.substr(r,2),16));return o},q.REAL=function(e){return P.REAL(e).length},P.NAME=P.CHARARRAY,q.NAME=q.CHARARRAY,P.STRING=P.CHARARRAY,q.STRING=q.CHARARRAY,At.UTF8=function(e,t,n){let s=[],o=n;for(let r=0;r<o;r++,t+=1)s[r]=e.getUint8(t);return String.fromCharCode.apply(null,s)},At.UTF16=function(e,t,n){let s=[],o=n/2;for(let r=0;r<o;r++,t+=2)s[r]=e.getUint16(t);return String.fromCharCode.apply(null,s)},P.UTF16=function(e){let t=[];for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);t[t.length]=s>>8&255,t[t.length]=s&255}return t},q.UTF16=function(e){return e.length*2};var un={"x-mac-croatian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\u0160\u2122\xB4\xA8\u2260\u017D\xD8\u221E\xB1\u2264\u2265\u2206\xB5\u2202\u2211\u220F\u0161\u222B\xAA\xBA\u03A9\u017E\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u0106\xAB\u010C\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u0110\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\uF8FF\xA9\u2044\u20AC\u2039\u203A\xC6\xBB\u2013\xB7\u201A\u201E\u2030\xC2\u0107\xC1\u010D\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u0111\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u03C0\xCB\u02DA\xB8\xCA\xE6\u02C7","x-mac-cyrillic":"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\u0490\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E","x-mac-gaelic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u1E02\xB1\u2264\u2265\u1E03\u010A\u010B\u1E0A\u1E0B\u1E1E\u1E1F\u0120\u0121\u1E40\xE6\xF8\u1E41\u1E56\u1E57\u027C\u0192\u017F\u1E60\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\u1E61\u1E9B\xFF\u0178\u1E6A\u20AC\u2039\u203A\u0176\u0177\u1E6B\xB7\u1EF2\u1EF3\u204A\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u2663\xD2\xDA\xDB\xD9\u0131\xDD\xFD\u0174\u0175\u1E84\u1E85\u1E80\u1E81\u1E82\u1E83","x-mac-greek":"\xC4\xB9\xB2\xC9\xB3\xD6\xDC\u0385\xE0\xE2\xE4\u0384\xA8\xE7\xE9\xE8\xEA\xEB\xA3\u2122\xEE\xEF\u2022\xBD\u2030\xF4\xF6\xA6\u20AC\xF9\xFB\xFC\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\xDF\xAE\xA9\u03A3\u03AA\xA7\u2260\xB0\xB7\u0391\xB1\u2264\u2265\xA5\u0392\u0395\u0396\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9\u03AC\u039D\xAC\u039F\u03A1\u2248\u03A4\xAB\xBB\u2026\xA0\u03A5\u03A7\u0386\u0388\u0153\u2013\u2015\u201C\u201D\u2018\u2019\xF7\u0389\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\xAD","x-mac-icelandic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\xDD\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\xD0\xF0\xDE\xFE\xFD\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-inuit":"\u1403\u1404\u1405\u1406\u140A\u140B\u1431\u1432\u1433\u1434\u1438\u1439\u1449\u144E\u144F\u1450\u1451\u1455\u1456\u1466\u146D\u146E\u146F\u1470\u1472\u1473\u1483\u148B\u148C\u148D\u148E\u1490\u1491\xB0\u14A1\u14A5\u14A6\u2022\xB6\u14A7\xAE\xA9\u2122\u14A8\u14AA\u14AB\u14BB\u14C2\u14C3\u14C4\u14C5\u14C7\u14C8\u14D0\u14EF\u14F0\u14F1\u14F2\u14F4\u14F5\u1505\u14D5\u14D6\u14D7\u14D8\u14DA\u14DB\u14EA\u1528\u1529\u152A\u152B\u152D\u2026\xA0\u152E\u153E\u1555\u1556\u1557\u2013\u2014\u201C\u201D\u2018\u2019\u1558\u1559\u155A\u155D\u1546\u1547\u1548\u1549\u154B\u154C\u1550\u157F\u1580\u1581\u1582\u1583\u1584\u1585\u158F\u1590\u1591\u1592\u1593\u1594\u1595\u1671\u1672\u1673\u1674\u1675\u1676\u1596\u15A0\u15A1\u15A2\u15A3\u15A4\u15A5\u15A6\u157C\u0141\u0142","x-mac-ce":"\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7",macintosh:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-romanian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\u0102\u0218\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\u0103\u0219\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\u021A\u021B\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-turkish":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u011E\u011F\u0130\u0131\u015E\u015F\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\uF8A0\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"};At.MACSTRING=function(e,t,n,s){let o=un[s];if(o===void 0)return;let r="";for(let a=0;a<n;a++){let l=e.getUint8(t+a);l<=127?r+=String.fromCharCode(l):r+=o[l&127]}return r};var fn=typeof WeakMap=="function"&&new WeakMap,pn,xi=function(e){if(!pn){pn={};for(let o in un)pn[o]=new String(o)}let t=pn[e];if(t===void 0)return;if(fn){let o=fn.get(t);if(o!==void 0)return o}let n=un[e];if(n===void 0)return;let s={};for(let o=0;o<n.length;o++)s[n.charCodeAt(o)]=o+128;return fn&&fn.set(t,s),s};P.MACSTRING=function(e,t){let n=xi(t);if(n===void 0)return;let s=[];for(let o=0;o<e.length;o++){let r=e.charCodeAt(o);if(r>=128&&(r=n[r],r===void 0))return;s[o]=r}return s},q.MACSTRING=function(e,t){let n=P.MACSTRING(e,t);return n!==void 0?n.length:0};function ss(e){return e>=-128&&e<=127}function vi(e,t,n){let s=0,o=e.length;for(;t<o&&s<64&&e[t]===0;)++t,++s;return n.push(128|s-1),t}function Si(e,t,n){let s=0,o=e.length,r=t;for(;r<o&&s<64;){let a=e[r];if(!ss(a)||a===0&&r+1<o&&e[r+1]===0)break;++r,++s}n.push(s-1);for(let a=t;a<r;++a)n.push(e[a]+256&255);return r}function ki(e,t,n){let s=0,o=e.length,r=t;for(;r<o&&s<64;){let a=e[r];if(a===0||ss(a)&&r+1<o&&ss(e[r+1]))break;++r,++s}n.push(64|s-1);for(let a=t;a<r;++a){let l=e[a];n.push(l+65536>>8&255,l+256&255)}return r}P.VARDELTAS=function(e){let t=0,n=[];for(;t<e.length;){let s=e[t];s===0?t=vi(e,t,n):s>=-128&&s<=127?t=Si(e,t,n):t=ki(e,t,n)}return n},P.INDEX=function(e){let t=1,n=[t],s=[];for(let l=0;l<e.length;l+=1){let c=P.OBJECT(e[l]);Array.prototype.push.apply(s,c),t+=c.length,n.push(t)}if(s.length===0)return[0,0];let o=[],r=1+Math.floor(Math.log(t)/Math.log(2))/8|0,a=[void 0,P.BYTE,P.USHORT,P.UINT24,P.ULONG][r];for(let l=0;l<n.length;l+=1){let c=a(n[l]);Array.prototype.push.apply(o,c)}return Array.prototype.concat(P.Card16(e.length),P.OffSize(r),o,s)},q.INDEX=function(e){return P.INDEX(e).length},P.DICT=function(e){let t=[],n=Object.keys(e),s=n.length;for(let o=0;o<s;o+=1){let r=parseInt(n[o],0),a=e[r],l=P.OPERAND(a.value,a.type),c=P.OPERATOR(r);for(let f=0;f<l.length;f++)t.push(l[f]);for(let f=0;f<c.length;f++)t.push(c[f])}return t},q.DICT=function(e){return P.DICT(e).length},P.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},P.OPERAND=function(e,t){let n=[];if(Array.isArray(t))for(let s=0;s<t.length;s+=1){$.argument(e.length===t.length,"Not enough arguments given for type"+t);let o=P.OPERAND(e[s],t[s]);for(let r=0;r<o.length;r++)n.push(o[r])}else if(t==="SID"){let s=P.NUMBER(e);for(let o=0;o<s.length;o++)n.push(s[o])}else if(t==="offset"){let s=P.NUMBER32(e);for(let o=0;o<s.length;o++)n.push(s[o])}else if(t==="number"){let s=P.NUMBER(e);for(let o=0;o<s.length;o++)n.push(s[o])}else if(t==="real"){let s=P.REAL(e);for(let o=0;o<s.length;o++)n.push(s[o])}else throw new Error("Unknown operand type "+t);return n},P.OP=P.BYTE,q.OP=q.BYTE;var hn=typeof WeakMap=="function"&&new WeakMap;P.CHARSTRING=function(e){if(hn){let s=hn.get(e);if(s!==void 0)return s}let t=[],n=e.length;for(let s=0;s<n;s+=1){let o=e[s],r=P[o.type](o.value);for(let a=0;a<r.length;a++)t.push(r[a])}return hn&&hn.set(e,t),t},q.CHARSTRING=function(e){return P.CHARSTRING(e).length},P.OBJECT=function(e){let t=P[e.type];return $.argument(t!==void 0,"No encoding function for type "+e.type),t(e.value)},q.OBJECT=function(e){let t=q[e.type];return $.argument(t!==void 0,"No sizeOf function for type "+e.type),t(e.value)},P.TABLE=function(e){let t=[],n=(e.fields||[]).length,s=[],o=[];for(let r=0;r<n;r+=1){let a=e.fields[r],l=P[a.type];$.argument(l!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");let c=e[a.name];c===void 0&&(c=a.value);let f=l(c);if(a.type==="TABLE")c.fields!==null&&(o.push(t.length),s.push(f)),t.push(0,0);else for(let u=0;u<f.length;u++)t.push(f[u])}for(let r=0;r<s.length;r+=1){let a=o[r],l=t.length;$.argument(l<65536,"Table "+e.tableName+" too big."),t[a]=l>>8,t[a+1]=l&255;for(let c=0;c<s[r].length;c++)t.push(s[r][c])}return t},q.TABLE=function(e){let t=0,n=(e.fields||[]).length;for(let s=0;s<n;s+=1){let o=e.fields[s],r=q[o.type];$.argument(r!==void 0,"No sizeOf function for field type "+o.type+" ("+o.name+")");let a=e[o.name];a===void 0&&(a=o.value),t+=r(a),o.type==="TABLE"&&(t+=2)}return t},P.RECORD=P.TABLE,q.RECORD=q.TABLE,P.LITERAL=function(e){return e},q.LITERAL=function(e){return e.length};function ye(e,t,n){if(t&&t.length)for(let s=0;s<t.length;s+=1){let o=t[s];this[o.name]=o.value}if(this.tableName=e,this.fields=t,n){let s=Object.keys(n);for(let o=0;o<s.length;o+=1){let r=s[o],a=n[r];this[r]!==void 0&&(this[r]=a)}}}ye.prototype.encode=function(){return P.TABLE(this)},ye.prototype.sizeOf=function(){return q.TABLE(this)};function It(e,t,n){n===void 0&&(n=t.length);let s=new Array(t.length+1);s[0]={name:e+"Count",type:"USHORT",value:n};for(let o=0;o<t.length;o++)s[o+1]={name:e+o,type:"USHORT",value:t[o]};return s}function os(e,t,n){let s=t.length,o=new Array(s+1);o[0]={name:e+"Count",type:"USHORT",value:s};for(let r=0;r<s;r++)o[r+1]={name:e+r,type:"TABLE",value:n(t[r],r)};return o}function Ft(e,t,n){let s=t.length,o=[];o[0]={name:e+"Count",type:"USHORT",value:s};for(let r=0;r<s;r++)o=o.concat(n(t[r],r));return o}function dn(e){e.format===1?ye.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(It("glyph",e.glyphs))):e.format===2?ye.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Ft("rangeRecord",e.ranges,function(t,n){return[{name:"startGlyphID"+n,type:"USHORT",value:t.start},{name:"endGlyphID"+n,type:"USHORT",value:t.end},{name:"startCoverageIndex"+n,type:"USHORT",value:t.index}]}))):$.assert(!1,"Coverage format must be 1 or 2.")}dn.prototype=Object.create(ye.prototype),dn.prototype.constructor=dn;function gn(e){ye.call(this,"scriptListTable",Ft("scriptRecord",e,function(t,n){let s=t.script,o=s.defaultLangSys;return $.assert(!!o,"Unable to write GSUB: script "+t.tag+" has no default language system."),[{name:"scriptTag"+n,type:"TAG",value:t.tag},{name:"script"+n,type:"TABLE",value:new ye("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new ye("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(It("featureIndex",o.featureIndexes)))}].concat(Ft("langSys",s.langSysRecords,function(r,a){let l=r.langSys;return[{name:"langSysTag"+a,type:"TAG",value:r.tag},{name:"langSys"+a,type:"TABLE",value:new ye("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:l.reqFeatureIndex}].concat(It("featureIndex",l.featureIndexes)))}]})))}]}))}gn.prototype=Object.create(ye.prototype),gn.prototype.constructor=gn;function mn(e){ye.call(this,"featureListTable",Ft("featureRecord",e,function(t,n){let s=t.feature;return[{name:"featureTag"+n,type:"TAG",value:t.tag},{name:"feature"+n,type:"TABLE",value:new ye("featureTable",[{name:"featureParams",type:"USHORT",value:s.featureParams}].concat(It("lookupListIndex",s.lookupListIndexes)))}]}))}mn.prototype=Object.create(ye.prototype),mn.prototype.constructor=mn;function yn(e,t){ye.call(this,"lookupListTable",os("lookup",e,function(n){let s=t[n.lookupType];return $.assert(!!s,"Unable to write GSUB lookup type "+n.lookupType+" tables."),new ye("lookupTable",[{name:"lookupType",type:"USHORT",value:n.lookupType},{name:"lookupFlag",type:"USHORT",value:n.lookupFlag}].concat(os("subtable",n.subtables,s)))}))}yn.prototype=Object.create(ye.prototype),yn.prototype.constructor=yn;function bn(e){e.format===1?ye.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:1},{name:"startGlyphID",type:"USHORT",value:e.startGlyph}].concat(It("glyph",e.classes))):e.format===2?ye.call(this,"classDefTable",[{name:"classFormat",type:"USHORT",value:2}].concat(Ft("rangeRecord",e.ranges,function(t,n){return[{name:"startGlyphID"+n,type:"USHORT",value:t.start},{name:"endGlyphID"+n,type:"USHORT",value:t.end},{name:"class"+n,type:"USHORT",value:t.classId}]}))):$.assert(!1,"Class format must be 1 or 2.")}bn.prototype=Object.create(ye.prototype),bn.prototype.constructor=bn;var I={Table:ye,Record:ye,Coverage:dn,ClassDef:bn,ScriptList:gn,FeatureList:mn,LookupList:yn,ushortList:It,tableList:os,recordList:Ft};function Co(e,t){return e.getUint8(t)}function xn(e,t){return e.getUint16(t,!1)}function Ti(e,t){return e.getInt16(t,!1)}function Oo(e,t){return(e.getUint16(t)<<8)+e.getUint8(t+2)}function rs(e,t){return e.getUint32(t,!1)}function wi(e,t){return e.getInt32(t,!1)}function Lo(e,t){let n=e.getInt16(t,!1),s=e.getUint16(t+2,!1);return n+s/65535}function Ci(e,t){let n="";for(let s=t;s<t+4;s+=1)n+=String.fromCharCode(e.getInt8(s));return n}function Oi(e,t,n){let s=0;for(let o=0;o<n;o+=1)s<<=8,s+=e.getUint8(t+o);return s}function Li(e,t,n){let s=[];for(let o=t;o<n;o+=1)s.push(e.getUint8(o));return s}function Ei(e){let t="";for(let n=0;n<e.length;n+=1)t+=String.fromCharCode(e[n]);return t}var Ri={byte:1,uShort:2,f2dot14:2,short:2,uInt24:3,uLong:4,fixed:4,longDateTime:8,tag:4},we={LONG_WORDS:32768,WORD_DELTA_COUNT_MASK:32767,SHARED_POINT_NUMBERS:32768,COUNT_MASK:4095,EMBEDDED_PEAK_TUPLE:32768,INTERMEDIATE_REGION:16384,PRIVATE_POINT_NUMBERS:8192,TUPLE_INDEX_MASK:4095,POINTS_ARE_WORDS:128,POINT_RUN_COUNT_MASK:127,DELTAS_ARE_ZERO:128,DELTAS_ARE_WORDS:64,DELTA_RUN_COUNT_MASK:63,INNER_INDEX_BIT_COUNT_MASK:15,MAP_ENTRY_SIZE_MASK:48};function w(e,t){this.data=e,this.offset=t,this.relativeOffset=0}w.prototype.parseByte=function(){let e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},w.prototype.parseChar=function(){let e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},w.prototype.parseCard8=w.prototype.parseByte,w.prototype.parseUShort=function(){let e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},w.prototype.parseCard16=w.prototype.parseUShort,w.prototype.parseSID=w.prototype.parseUShort,w.prototype.parseOffset16=w.prototype.parseUShort,w.prototype.parseShort=function(){let e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},w.prototype.parseF2Dot14=function(){let e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},w.prototype.parseUInt24=function(){let e=Oo(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=3,e},w.prototype.parseULong=function(){let e=rs(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},w.prototype.parseLong=function(){let e=wi(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},w.prototype.parseOffset32=w.prototype.parseULong,w.prototype.parseFixed=function(){let e=Lo(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},w.prototype.parseString=function(e){let t=this.data,n=this.offset+this.relativeOffset,s="";this.relativeOffset+=e;for(let o=0;o<e;o++)s+=String.fromCharCode(t.getUint8(n+o));return s},w.prototype.parseTag=function(){return this.parseString(4)},w.prototype.parseLongDateTime=function(){let e=rs(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},w.prototype.parseVersion=function(e){let t=xn(this.data,this.offset+this.relativeOffset),n=xn(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,e===void 0&&(e=4096),t+n/e/10},w.prototype.skip=function(e,t){t===void 0&&(t=1),this.relativeOffset+=Ri[e]*t},w.prototype.parseULongList=function(e){e===void 0&&(e=this.parseULong());let t=new Array(e),n=this.data,s=this.offset+this.relativeOffset;for(let o=0;o<e;o++)t[o]=n.getUint32(s),s+=4;return this.relativeOffset+=e*4,t},w.prototype.parseOffset16List=w.prototype.parseUShortList=function(e){e===void 0&&(e=this.parseUShort());let t=new Array(e),n=this.data,s=this.offset+this.relativeOffset;for(let o=0;o<e;o++)t[o]=n.getUint16(s),s+=2;return this.relativeOffset+=e*2,t},w.prototype.parseShortList=function(e){let t=new Array(e),n=this.data,s=this.offset+this.relativeOffset;for(let o=0;o<e;o++)t[o]=n.getInt16(s),s+=2;return this.relativeOffset+=e*2,t},w.prototype.parseByteList=function(e){let t=new Array(e),n=this.data,s=this.offset+this.relativeOffset;for(let o=0;o<e;o++)t[o]=n.getUint8(s++);return this.relativeOffset+=e,t},w.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());let n=new Array(e);for(let s=0;s<e;s++)n[s]=t.call(this);return n},w.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());let n=new Array(e);for(let s=0;s<e;s++)n[s]=t.call(this);return n},w.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());let n=new Array(e),s=Object.keys(t);for(let o=0;o<e;o++){let r={};for(let a=0;a<s.length;a++){let l=s[a],c=t[l];r[l]=c.call(this)}n[o]=r}return n},w.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());let n=new Array(e),s=Object.keys(t);for(let o=0;o<e;o++){let r={};for(let a=0;a<s.length;a++){let l=s[a],c=t[l];r[l]=c.call(this)}n[o]=r}return n},w.prototype.parseTupleRecords=function(e,t){let n=[];for(let s=0;s<e;s++){let o=[];for(let r=0;r<t;r++)o.push(this.parseF2Dot14());n.push(o)}return n},w.prototype.parseStruct=function(e){if(typeof e=="function")return e.call(this);{let t=Object.keys(e),n={};for(let s=0;s<t.length;s++){let o=t[s],r=e[o];n[o]=r.call(this)}return n}},w.prototype.parseValueRecord=function(e){if(e===void 0&&(e=this.parseUShort()),e===0)return;let t={};return e&1&&(t.xPlacement=this.parseShort()),e&2&&(t.yPlacement=this.parseShort()),e&4&&(t.xAdvance=this.parseShort()),e&8&&(t.yAdvance=this.parseShort()),e&16&&(t.xPlaDevice=void 0,this.parseShort()),e&32&&(t.yPlaDevice=void 0,this.parseShort()),e&64&&(t.xAdvDevice=void 0,this.parseShort()),e&128&&(t.yAdvDevice=void 0,this.parseShort()),t},w.prototype.parseValueRecordList=function(){let e=this.parseUShort(),t=this.parseUShort(),n=new Array(t);for(let s=0;s<t;s++)n[s]=this.parseValueRecord(e);return n},w.prototype.parsePointer=function(e){let t=this.parseOffset16();if(t>0)return new w(this.data,this.offset+t).parseStruct(e)},w.prototype.parsePointer32=function(e){let t=this.parseOffset32();if(t>0)return new w(this.data,this.offset+t).parseStruct(e)},w.prototype.parseListOfLists=function(e){let t=this.parseOffset16List(),n=t.length,s=this.relativeOffset,o=new Array(n);for(let r=0;r<n;r++){let a=t[r];if(a===0){o[r]=void 0;continue}if(this.relativeOffset=a,e){let l=this.parseOffset16List(),c=new Array(l.length);for(let f=0;f<l.length;f++)this.relativeOffset=a+l[f],c[f]=e.call(this);o[r]=c}else o[r]=this.parseUShortList()}return this.relativeOffset=s,o},w.prototype.parseCoverage=function(){let e=this.offset+this.relativeOffset,t=this.parseUShort(),n=this.parseUShort();if(t===1)return{format:1,glyphs:this.parseUShortList(n)};if(t===2){let s=new Array(n);for(let o=0;o<n;o++)s[o]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:s}}throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.")},w.prototype.parseClassDef=function(){let e=this.offset+this.relativeOffset,t=this.parseUShort();return t===1?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:t===2?{format:2,ranges:this.parseRecordList({start:w.uShort,end:w.uShort,classId:w.uShort})}:(console.warn(`0x${e.toString(16)}: This font file uses an invalid ClassDef format of ${t}. It might be corrupted and should be reacquired if it doesn't display as intended.`),{format:t})},w.list=function(e,t){return function(){return this.parseList(e,t)}},w.list32=function(e,t){return function(){return this.parseList32(e,t)}},w.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},w.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},w.pointer=function(e){return function(){return this.parsePointer(e)}},w.pointer32=function(e){return function(){return this.parsePointer32(e)}},w.tag=w.prototype.parseTag,w.byte=w.prototype.parseByte,w.uShort=w.offset16=w.prototype.parseUShort,w.uShortList=w.prototype.parseUShortList,w.uInt24=w.prototype.parseUInt24,w.uLong=w.offset32=w.prototype.parseULong,w.uLongList=w.prototype.parseULongList,w.fixed=w.prototype.parseFixed,w.f2Dot14=w.prototype.parseF2Dot14,w.struct=w.prototype.parseStruct,w.coverage=w.prototype.parseCoverage,w.classDef=w.prototype.parseClassDef;var Eo={reserved:w.uShort,reqFeatureIndex:w.uShort,featureIndexes:w.uShortList};w.prototype.parseScriptList=function(){return this.parsePointer(w.recordList({tag:w.tag,script:w.pointer({defaultLangSys:w.pointer(Eo),langSysRecords:w.recordList({tag:w.tag,langSys:w.pointer(Eo)})})}))||[]},w.prototype.parseFeatureList=function(){return this.parsePointer(w.recordList({tag:w.tag,feature:w.pointer({featureParams:w.offset16,lookupListIndexes:w.uShortList})}))||[]},w.prototype.parseLookupList=function(e){return this.parsePointer(w.list(w.pointer(function(){let t=this.parseUShort();$.argument(1<=t&&t<=9,"GPOS/GSUB lookup type "+t+" unknown.");let n=this.parseUShort(),s=n&16;return{lookupType:t,lookupFlag:n,subtables:this.parseList(w.pointer(e[t])),markFilteringSet:s?this.parseUShort():void 0}})))||[]},w.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){let e=this.parseUShort(),t=this.parseUShort();return $.argument(e===1&&t<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:w.offset32,featureTableSubstitutionOffset:w.offset32})})||[]},w.prototype.parseVariationStore=function(){let e=this.relativeOffset,t=this.parseUShort(),n={itemVariationStore:this.parseItemVariationStore()};return this.relativeOffset=e+t+2,n},w.prototype.parseItemVariationStore=function(){let e=this.relativeOffset,t={format:this.parseUShort(),variationRegions:[],itemVariationSubtables:[]},n=this.parseOffset32(),s=this.parseUShort(),o=this.parseULongList(s);this.relativeOffset=e+n,t.variationRegions=this.parseVariationRegionList();for(let r=0;r<s;r++){let a=o[r];this.relativeOffset=e+a,t.itemVariationSubtables.push(this.parseItemVariationSubtable())}return t},w.prototype.parseVariationRegionList=function(){let e=this.parseUShort(),t=this.parseUShort();return this.parseRecordList(t,{regionAxes:w.recordList(e,{startCoord:w.f2Dot14,peakCoord:w.f2Dot14,endCoord:w.f2Dot14})})},w.prototype.parseItemVariationSubtable=function(){let e=this.parseUShort(),t=this.parseUShort(),n=this.parseUShortList(),s=n.length;return{regionIndexes:n,deltaSets:e&&s?this.parseDeltaSets(e,t,s):[]}},w.prototype.parseDeltaSetIndexMap=function(){let e=this.parseByte(),t=this.parseByte(),n=[],s=0;switch(e){case 0:s=this.parseUShort();break;case 1:s=this.parseULong();break;default:console.error(`unsupported DeltaSetIndexMap format ${e}`)}if(!s)return{format:e,entryFormat:t};let o=(t&we.INNER_INDEX_BIT_COUNT_MASK)+1,r=((t&we.MAP_ENTRY_SIZE_MASK)>>4)+1;for(let a=0;a<s;a++){let l;if(r===1)l=this.parseByte();else if(r===2)l=this.parseUShort();else if(r===3)l=this.parseUInt24();else if(r===4)l=this.parseULong();else throw new Error(`Invalid entry size of ${r}`);let c=l>>o,f=l&(1<<o)-1;n.push({outerIndex:c,innerIndex:f})}return{format:e,entryFormat:t,map:n}},w.prototype.parseDeltaSets=function(e,t,n){let s=Array.from({length:e},()=>[]),o=t&we.LONG_WORDS,r=t&we.WORD_DELTA_COUNT_MASK;if(r>n)throw Error("wordCount must be less than or equal to regionIndexCount");let a=(o?this.parseLong:this.parseShort).bind(this),l=(o?this.parseShort:this.parseChar).bind(this);for(let c=0;c<e;c++)for(let f=0;f<n;f++)f<r?s[c].push(a()):s[c].push(l());return s},w.prototype.parseTupleVariationStoreList=function(e,t,n){let s=this.parseUShort(),r=this.parseUShort()&1,a=this.parseOffset32(),l=(r?this.parseULong:this.parseUShort).bind(this),c={},f=l();r||(f*=2);let u;for(let m=0;m<s;m++){u=l(),r||(u*=2);let g=u-f;c[m]=g?this.parseTupleVariationStore(a+f,e,t,n,m):void 0,f=u}return c},w.prototype.parseTupleVariationStore=function(e,t,n,s,o){let r=this.relativeOffset;this.relativeOffset=e,n==="cvar"&&(this.relativeOffset+=4);let a=this.parseUShort(),l=!!(a&we.SHARED_POINT_NUMBERS),c=a&we.COUNT_MASK,f=this.parseOffset16(),u=[],m=[];for(let v=0;v<c;v++){let k=this.parseTupleVariationHeader(t,n);u.push(k)}this.relativeOffset!==e+f&&(console.warn(`Unexpected offset after parsing tuple variation headers! Expected ${e+f}, actually ${this.relativeOffset}`),this.relativeOffset=e+f),l&&(m=this.parsePackedPointNumbers());let g=this.relativeOffset;for(let v=0;v<c;v++){let k=u[v];k.privatePoints=[],this.relativeOffset=g,n==="cvar"&&!k.peakTuple&&console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."),k.flags.privatePointNumbers&&(k.privatePoints=this.parsePackedPointNumbers()),delete k.flags;let O=this.offset,W=this.relativeOffset,V=Y=>{let J,ie,ce=()=>{let ue=0;if(n==="gvar"){if(ue=k.privatePoints.length||m.length,!ue){let xe=s.get(o);xe.path,ue=xe.points.length,ue+=4}}else n==="cvar"&&(ue=s.length);this.offset=O,this.relativeOffset=W,J=this.parsePackedDeltas(ue),n==="gvar"&&(ie=this.parsePackedDeltas(ue))};return{configurable:!0,get:function(){return J===void 0&&ce(),Y==="deltasY"?ie:J},set:function(ue){J===void 0&&ce(),Y==="deltasY"?ie=ue:J=ue}}};Object.defineProperty(k,"deltas",V.call(this,"deltas")),n==="gvar"&&Object.defineProperty(k,"deltasY",V.call(this,"deltasY")),g+=k.variationDataSize,delete k.variationDataSize}this.relativeOffset=r;let S={headers:u};return S.sharedPoints=m,S},w.prototype.parseTupleVariationHeader=function(e,t){let n=this.parseUShort(),s=this.parseUShort(),o=!!(s&we.EMBEDDED_PEAK_TUPLE),r=!!(s&we.INTERMEDIATE_REGION),a=!!(s&we.PRIVATE_POINT_NUMBERS),l=o?void 0:s&we.TUPLE_INDEX_MASK,c=o?this.parseTupleRecords(1,e)[0]:void 0,f=r?this.parseTupleRecords(1,e)[0]:void 0,u=r?this.parseTupleRecords(1,e)[0]:void 0,m={variationDataSize:n,peakTuple:c,intermediateStartTuple:f,intermediateEndTuple:u,flags:{embeddedPeakTuple:o,intermediateRegion:r,privatePointNumbers:a}};return t==="gvar"&&(m.sharedTupleRecordsIndex=l),m},w.prototype.parsePackedPointNumbers=function(){let e=this.parseByte(),t=[],n=e;if(e>=128){let o=this.parseByte();n=(e&we.POINT_RUN_COUNT_MASK)<<8|o}let s=0;for(;t.length<n;){let o=this.parseByte(),r=!!(o&we.POINTS_ARE_WORDS),a=(o&we.POINT_RUN_COUNT_MASK)+1;for(let l=0;l<a&&t.length<n;l++){let c;r?c=this.parseUShort():c=this.parseByte(),s=s+c,t.push(s)}}return t},w.prototype.parsePackedDeltas=function(e){let t=[];for(;t.length<e;){let n=this.parseByte(),s=!!(n&we.DELTAS_ARE_ZERO),o=!!(n&we.DELTAS_ARE_WORDS),r=(n&we.DELTA_RUN_COUNT_MASK)+1;for(let a=0;a<r&&t.length<e;a++)s?t.push(0):o?t.push(this.parseShort()):t.push(this.parseChar())}return t};var N={getByte:Co,getCard8:Co,getUShort:xn,getCard16:xn,getShort:Ti,getUInt24:Oo,getULong:rs,getFixed:Lo,getTag:Ci,getOffset:Oi,getBytes:Li,bytesToString:Ei,Parser:w},vn=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ro={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},Ai={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Ao={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Ii(e,t,n){switch(e){case 0:if(t===65535)return"und";if(n)return n[t];break;case 1:return Ro[t];case 3:return Ao[t]}}var as="utf-16",Fi={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Di={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function is(e,t,n){switch(e){case 0:return as;case 1:return Di[n]||Fi[t];case 3:if(t===1||t===10)return as;break}}var Io={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Ui(e){return Io[e]}function Mi(e,t,n){let s={},o=new N.Parser(e,t),r=o.parseUShort(),a=o.parseUShort(),l=o.offset+o.parseUShort();for(let c=0;c<a;c++){let f=o.parseUShort(),u=o.parseUShort(),m=o.parseUShort(),g=o.parseUShort(),S=vn[g]||g,v=o.parseUShort(),k=o.parseUShort(),O=Ii(f,m,n),W=is(f,u,m),V=Ui(f);if(W!==void 0&&O!==void 0&&V!==void 0){let Y;if(W===as?Y=At.UTF16(e,l+k,v):Y=At.MACSTRING(e,l+k,v,W),Y){let J=s[V];J===void 0&&(J=s[V]={});let ie=J[S];ie===void 0&&(ie=J[S]={}),ie[O]=Y}}}return r===1&&o.parseUShort(),s}function Sn(e){let t={};for(let n in e)t[e[n]]=parseInt(n);return t}function Fo(e,t,n,s,o,r){return new I.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:t},{name:"languageID",type:"USHORT",value:n},{name:"nameID",type:"USHORT",value:s},{name:"length",type:"USHORT",value:o},{name:"offset",type:"USHORT",value:r}])}function Pi(e,t){let n=e.length,s=t.length-n+1;e:for(let o=0;o<s;o++)for(;o<s;o++){for(let r=0;r<n;r++)if(t[o+r]!==e[r])continue e;return o}return-1}function Do(e,t){let n=Pi(e,t);if(n<0){n=t.length;let s=0,o=e.length;for(;s<o;++s)t.push(e[s])}return n}function Bi(e,t){let n=Sn(Io),s=Sn(Ro),o=Sn(Ao),r=[],a=[];for(let c in e){let f,u=[],m={},g=Sn(vn),S=n[c];for(let v in e[c]){let k=g[v];if(k===void 0&&(k=v),f=parseInt(k),isNaN(f))throw new Error('Name table entry "'+v+'" does not exist, see nameTableNames for complete list.');m[f]=e[c][v],u.push(f)}for(let v=0;v<u.length;v++){f=u[v];let k=m[f];for(let O in k){let W=k[O];if(S===1||S===0){let V=s[O],Y=Ai[V],J=is(S,Y,V),ie=P.MACSTRING(W,J);if(S===0&&(V=t.indexOf(O),V<0&&(V=t.length,t.push(O)),Y=4,ie=P.UTF16(W)),ie!==void 0){let ce=Do(ie,a);r.push(Fo(S,Y,V,f,ie.length,ce))}}if(S===3){let V=o[O];if(V!==void 0){let Y=P.UTF16(W),J=Do(Y,a);r.push(Fo(3,1,V,f,Y.length,J))}}}}}r.sort(function(c,f){return c.platformID-f.platformID||c.encodingID-f.encodingID||c.languageID-f.languageID||c.nameID-f.nameID});let l=new I.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:r.length},{name:"stringOffset",type:"USHORT",value:6+r.length*12}]);for(let c=0;c<r.length;c++)l.fields.push({name:"record_"+c,type:"RECORD",value:r[c]});return l.fields.push({name:"strings",type:"LITERAL",value:a}),l}function kn(e,t,n=[]){if(t<256&&t in vn){if(n.length&&!n.includes(parseInt(t)))return;t=vn[t]}for(let s in e)for(let o in e[s])if(o===t||parseInt(o)===t)return e[s][o]}var Uo={parse:Mi,make:Bi,getNameByID:kn};function Ni(e,t,n,s){e.length=t.parseUShort(),e.language=t.parseUShort()-1;let o=t.parseByteList(e.length),r=Object.assign({},o),a=is(n,s,e.language),l=un[a];for(let c=0;c<l.length;c++)r[l.charCodeAt(c)]=o[128+c];e.glyphIndexMap=r}function _i(e,t,n){t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong();let s;e.groupCount=s=t.parseULong(),e.glyphIndexMap={};for(let o=0;o<s;o+=1){let r=t.parseULong(),a=t.parseULong(),l=t.parseULong();for(let c=r;c<=a;c+=1)e.glyphIndexMap[c]=l,n===12&&l++}}function Gi(e,t,n,s,o){e.length=t.parseUShort(),e.language=t.parseUShort();let r;e.segCount=r=t.parseUShort()>>1,t.skip("uShort",3),e.glyphIndexMap={};let a=new N.Parser(n,s+o+14),l=new N.Parser(n,s+o+16+r*2),c=new N.Parser(n,s+o+16+r*4),f=new N.Parser(n,s+o+16+r*6),u=s+o+16+r*8;for(let m=0;m<r-1;m+=1){let g,S=a.parseUShort(),v=l.parseUShort(),k=c.parseShort(),O=f.parseUShort();for(let W=v;W<=S;W+=1)O!==0?(u=f.offset+f.relativeOffset-2,u+=O,u+=(W-v)*2,g=N.getUShort(n,u),g!==0&&(g=g+k&65535)):g=W+k&65535,e.glyphIndexMap[W]=g}}function Hi(e,t){let n={};t.skip("uLong");let s=t.parseULong();for(let o=0;o<s;o+=1){let r=t.parseUInt24(),a={varSelector:r},l=t.parseOffset32(),c=t.parseOffset32(),f=t.relativeOffset;l&&(t.relativeOffset=l,a.defaultUVS=t.parseStruct({ranges:function(){return t.parseRecordList32({startUnicodeValue:t.parseUInt24,additionalCount:t.parseByte})}})),c&&(t.relativeOffset=c,a.nonDefaultUVS=t.parseStruct({uvsMappings:function(){let u={},m=t.parseRecordList32({unicodeValue:t.parseUInt24,glyphID:t.parseUShort});for(let g=0;g<m.length;g+=1)u[m[g].unicodeValue]=m[g];return u}})),n[r]=a,t.relativeOffset=f}e.varSelectorList=n}function Vi(e,t){let n={};n.version=N.getUShort(e,t),$.argument(n.version===0,"cmap table version should be 0."),n.numTables=N.getUShort(e,t+2);let s=null,o=-1,r=-1,a=null,l=null,c=[0,1,2,3,4,6],f=[0,1,10];for(let m=n.numTables-1;m>=0;m-=1)if(a=N.getUShort(e,t+4+m*8),l=N.getUShort(e,t+4+m*8+2),a===3&&f.includes(l)||a===0&&c.includes(l)||a===1&&l===0){if(r>0)continue;if(r=N.getULong(e,t+4+m*8+4),s)break}else if(a===0&&l===5){if(o=N.getULong(e,t+4+m*8+4),s=new N.Parser(e,t+o),s.parseUShort()!==14)o=-1,s=null;else if(r>0)break}if(r===-1)throw new Error("No valid cmap sub-tables found.");let u=new N.Parser(e,t+r);if(n.format=u.parseUShort(),n.format===0)Ni(n,u,a,l);else if(n.format===12||n.format===13)_i(n,u,n.format);else if(n.format===4)Gi(n,u,e,t,r);else throw new Error("Only format 0 (platformId 1, encodingId 0), 4, 12 and 14 cmap tables are supported (found format "+n.format+", platformId "+a+", encodingId "+l+").");return s&&Hi(n,s),n}function ji(e,t,n){e.segments.push({end:t,start:t,delta:-(t-n),offset:0,glyphIndex:n})}function $i(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function Wi(e){if(e.length===0)return e;let t=[e[0]];for(let n=1;n<e.length;n++){let s=t[t.length-1],o=e[n];s.end+1===o.start&&s.delta===o.delta&&o.end!==65535?s.end=o.end:t.push(o)}return t}function zi(e){let t=!0,n;for(n=e.length-1;n>0;n-=1)if(e.get(n).unicode>65535){t=!1;break}let s=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:t?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:t?12:20}];t||s.push({name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}),s.push({name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0});let o=new I.Table("cmap",s);for(o.segments=[],n=0;n<e.length;n+=1){let S=e.get(n);for(let v=0;v<S.unicodes.length;v+=1)ji(o,S.unicodes[v],n)}o.segments.sort(function(S,v){return S.start-v.start}),o.segments=Wi(o.segments),$i(o);let r=o.segments.length,a=0,l=[],c=[],f=[],u=[],m=[],g=[];for(n=0;n<r;n+=1){let S=o.segments[n];S.end<=65535&&S.start<=65535?(l.push({name:"end_"+n,type:"USHORT",value:S.end}),c.push({name:"start_"+n,type:"USHORT",value:S.start}),f.push({name:"idDelta_"+n,type:"SHORT",value:S.delta}),u.push({name:"idRangeOffset_"+n,type:"USHORT",value:S.offset}),S.glyphId!==void 0&&m.push({name:"glyph_"+n,type:"USHORT",value:S.glyphId})):a+=1,!t&&S.glyphIndex!==void 0&&(g.push({name:"cmap12Start_"+n,type:"ULONG",value:S.start}),g.push({name:"cmap12End_"+n,type:"ULONG",value:S.end}),g.push({name:"cmap12Glyph_"+n,type:"ULONG",value:S.glyphIndex}))}o.segCountX2=(r-a)*2,o.searchRange=Math.pow(2,Math.floor(Math.log(r-a)/Math.log(2)))*2,o.entrySelector=Math.log(o.searchRange/2)/Math.log(2),o.rangeShift=o.segCountX2-o.searchRange;for(let S=0;S<l.length;S++)o.fields.push(l[S]);o.fields.push({name:"reservedPad",type:"USHORT",value:0});for(let S=0;S<c.length;S++)o.fields.push(c[S]);for(let S=0;S<f.length;S++)o.fields.push(f[S]);for(let S=0;S<u.length;S++)o.fields.push(u[S]);for(let S=0;S<m.length;S++)o.fields.push(m[S]);if(o.cmap4Length=14+l.length*2+2+c.length*2+f.length*2+u.length*2+m.length*2,!t){let S=16+g.length*4;o.cmap12Offset=20+o.cmap4Length,o.fields.push({name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:S},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:g.length/3});for(let v=0;v<g.length;v++)o.fields.push(g[v])}return o}var Mo={parse:Vi,make:zi},Tn=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Xi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Yi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],qi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],ls=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Zi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],vt=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Po(e){this.font=e}Po.prototype.charToGlyphIndex=function(e){let t=e.codePointAt(0),n=this.font.glyphs;if(n)for(let s=0;s<n.length;s+=1){let o=n.get(s);for(let r=0;r<o.unicodes.length;r+=1)if(o.unicodes[r]===t)return s}return null};function Bo(e){this.cmap=e}Bo.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0};function No(e,t){this.encoding=e,this.charset=t}No.prototype.charToGlyphIndex=function(e){let t=e.codePointAt(0),n=this.encoding[t];return this.charset.indexOf(n)};function cs(e){switch(e.version){case 1:this.names=vt.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(let t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<vt.length?this.names[t]=vt[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-vt.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(let t=0;t<e.numberOfGlyphs;t++)this.names[t]=vt[t+e.glyphNameIndex[t]];break;case 3:this.names=[];break;default:this.names=[];break}}cs.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},cs.prototype.glyphIndexToName=function(e){return this.names[e]};function Ki(e){let t,n=e.tables.cmap.glyphIndexMap,s=Object.keys(n);for(let o=0;o<s.length;o+=1){let r=s[o],a=n[r];t=e.glyphs.get(a),t.addUnicode(parseInt(r))}for(let o=0;o<e.glyphs.length;o+=1)t=e.glyphs.get(o),e.cffEncoding?t.name=e.cffEncoding.charset[o]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(o))}function Qi(e){e._IndexToUnicodeMap={};let t=e.tables.cmap.glyphIndexMap,n=Object.keys(t);for(let s=0;s<n.length;s+=1){let o=n[s],r=t[o];e._IndexToUnicodeMap[r]===void 0?e._IndexToUnicodeMap[r]={unicodes:[parseInt(o)]}:e._IndexToUnicodeMap[r].unicodes.push(parseInt(o))}}function Ji(e,t){t.lowMemory?Qi(e):Ki(e)}function el(e,t,n,s,o){e.beginPath(),e.moveTo(t,n),e.lineTo(s,o),e.stroke()}var St={line:el};function tl(e,t){let n=new w(e,t),s=n.parseShort();s!==0&&console.warn("Only CPALv0 is currently fully supported.");let o=n.parseShort(),r=n.parseShort(),a=n.parseShort(),l=n.parseOffset32(),c=n.parseUShortList(r);n.relativeOffset=l;let f=n.parseULongList(a);return n.relativeOffset=l,{version:s,numPaletteEntries:o,colorRecords:f,colorRecordIndices:c}}function nl({version:e=0,numPaletteEntries:t=0,colorRecords:n=[],colorRecordIndices:s=[0]}){return $.argument(e===0,"Only CPALv0 are supported."),$.argument(n.length,"No colorRecords given."),$.argument(s.length,"No colorRecordIndices given."),s.length>1&&$.argument(t,"Can't infer numPaletteEntries on multiple colorRecordIndices"),new I.Table("CPAL",[{name:"version",type:"USHORT",value:e},{name:"numPaletteEntries",type:"USHORT",value:t||n.length},{name:"numPalettes",type:"USHORT",value:s.length},{name:"numColorRecords",type:"USHORT",value:n.length},{name:"colorRecordsArrayOffset",type:"ULONG",value:12+2*s.length},...s.map((o,r)=>({name:"colorRecordIndices_"+r,type:"USHORT",value:o})),...n.map((o,r)=>({name:"colorRecords_"+r,type:"ULONG",value:o}))])}function _o(e){var t=(e&4278190080)>>24,n=(e&16711680)>>16,s=(e&65280)>>8,o=e&255;return t=t+256&255,n=n+256&255,s=s+256&255,o=(o+256&255)/255,{b:t,g:n,r:s,a:o}}function us(e,t,n=0,s="hexa"){if(t==65535)return"currentColor";let o=e&&e.tables&&e.tables.cpal;if(!o)return"currentColor";if(n>o.colorRecordIndices.length-1)throw new Error(`Palette index out of range (colorRecordIndices.length: ${o.colorRecordIndices.length}, index: ${t})`);if(t>o.numPaletteEntries)throw new Error(`Color index out of range (numPaletteEntries: ${o.numPaletteEntries}, index: ${t})`);let r=o.colorRecordIndices[n]+t;if(r>o.colorRecords)throw new Error(`Color index out of range (colorRecords.length: ${o.colorRecords.length}, lookupIndex: ${r})`);let a=_o(o.colorRecords[r]);return s==="bgra"?a:Dt(a,s)}function ze(e){return("0"+parseInt(e).toString(16)).slice(-2)}function sl(e){let t=e.r/255,n=e.g/255,s=e.b/255,o=Math.max(t,n,s),r=Math.min(t,n,s),a,l,c=(o+r)/2;if(o===r)a=l=0;else{let f=o-r;switch(l=c>.5?f/(2-o-r):f/(o+r),o){case t:a=(n-s)/f+(n<s?6:0);break;case n:a=(s-t)/f+2;break;case s:a=(t-n)/f+4;break}a/=6}return{h:a*360,s:l*100,l:c*100}}function ol(e){let{h:t,s:n,l:s,a:o}=e;t=t%360,n/=100,s/=100;let r=(1-Math.abs(2*s-1))*n,a=r*(1-Math.abs(t/60%2-1)),l=s-r/2,c=0,f=0,u=0;return 0<=t&&t<60?(c=r,f=a,u=0):60<=t&&t<120?(c=a,f=r,u=0):120<=t&&t<180?(c=0,f=r,u=a):180<=t&&t<240?(c=0,f=a,u=r):240<=t&&t<300?(c=a,f=0,u=r):300<=t&&t<=360&&(c=r,f=0,u=a),{r:Math.round((c+l)*255),g:Math.round((f+l)*255),b:Math.round((u+l)*255),a:o}}function Go(e){return parseInt(`0x${ze(e.b)}${ze(e.g)}${ze(e.r)}${ze(e.a*255)}`,16)}function wn(e,t="hexa"){let n=t=="raw"||t=="cpal",s=Number.isInteger(e),o=!0;if(s&&n||e==="currentColor")return e;if(typeof e=="object"){if(t=="bgra")return e;if(n)return Go(e)}else if(!s&&/^#([a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})$/i.test(e.trim())){switch(e=e.trim().substring(1),e.length){case 3:e={r:parseInt(e[0].repeat(2),16),g:parseInt(e[1].repeat(2),16),b:parseInt(e[2].repeat(2),16),a:1};break;case 4:e={r:parseInt(e[0].repeat(2),16),g:parseInt(e[1].repeat(2),16),b:parseInt(e[2].repeat(2),16),a:parseInt(e[3].repeat(2),16)/255};break;case 6:e={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16),a:1};break;case 8:e={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16),a:parseInt(e[6]+e[7],16)/255};break}if(t=="bgra")return e}else if(typeof document<"u"&&/^[a-z]+$/i.test(e)){let r=document.createElement("canvas").getContext("2d");r.fillStyle=e;let a=Dt(r.fillStyle,"hexa");a==="#000000ff"&&e.toLowerCase()!=="black"?o=!1:e=a}else{e=e.trim();let r=/rgba?\(\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:,|\s*)\s*(?:(\d*\.\d+)(%?)|(\d+)(%?))\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(r.test(e)){let a=e.match(r).filter(l=>typeof l<"u");e={r:Math.round(parseFloat(a[1])/(a[2]?.39215686274509803:1)),g:Math.round(parseFloat(a[3])/(a[4]?.39215686274509803:1)),b:Math.round(parseFloat(a[5])/(a[6]?.39215686274509803:1)),a:a[7]?parseFloat(a[7])/(a[8]?100:1):1}}else{let a=/hsla?\(\s*(?:(\d*\.\d+|\d+)(deg|turn|))\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:,|\s*)\s*(?:(\d*\.\d+)%?|(\d+)%?)\s*(?:(?:,|\s|\/)\s*(?:(0*(?:\.\d+)?()|0*1(?:\.0+)?())|(?:\.\d+)|(\d+)(%)|(\d*\.\d+)(%)))?\s*\)/;if(a.test(e)){let l=e.match(a).filter(c=>typeof c<"u");e=ol({h:parseFloat(l[1])*(l[2]==="turn"?360:1),s:parseFloat(l[3]),l:parseFloat(l[4]),a:l[5]?parseFloat(l[5])/(l[6]?100:1):1})}else o=!1}}if(!o)throw new Error(`Invalid color format: ${e}`);return Dt(e,t)}function Dt(e,t="hexa"){if(e==="currentColor")return e;if(Number.isInteger(e)){if(t=="raw"||t=="cpal")return e;e=_o(e)}else typeof e!="object"&&(e=wn(e,"bgra"));let n=["hsl","hsla"].includes(t)?sl(e):null;switch(t){case"rgba":return`rgba(${e.r}, ${e.g}, ${e.b}, ${parseFloat(e.a.toFixed(3))})`;case"rgb":return`rgb(${e.r}, ${e.g}, ${e.b})`;case"hex":case"hex6":case"hex-6":return`#${ze(e.r)}${ze(e.g)}${ze(e.b)}`;case"hexa":case"hex8":case"hex-8":return`#${ze(e.r)}${ze(e.g)}${ze(e.b)}${ze(e.a*255)}`;case"hsl":return`hsl(${n.h.toFixed(2)}, ${n.s.toFixed(2)}%, ${n.l.toFixed(2)}%)`;case"hsla":return`hsla(${n.h.toFixed(2)}, ${n.s.toFixed(2)}%, ${n.l.toFixed(2)}%, ${parseFloat(e.a.toFixed(3))})`;case"bgra":return e;case"raw":case"cpal":return Go(e);default:throw new Error("Unknown color format: "+t)}}var Ho={parse:tl,make:nl,getPaletteColor:us,parseColor:wn,formatColor:Dt};function rl(e,t){let n=t||new xt;return{configurable:!0,get:function(){return typeof n=="function"&&(n=n()),n},set:function(s){n=s}}}function Ce(e){this.bindConstructorValues(e)}Ce.prototype.bindConstructorValues=function(e){if(this.index=e.index||0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=e.name||null,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),"xMin"in e&&(this.xMin=e.xMin),"yMin"in e&&(this.yMin=e.yMin),"xMax"in e&&(this.xMax=e.xMax),"yMax"in e&&(this.yMax=e.yMax),"advanceWidth"in e&&(this.advanceWidth=e.advanceWidth),"leftSideBearing"in e&&(this.leftSideBearing=e.leftSideBearing),"points"in e&&(this.points=e.points),Object.defineProperty(this,"path",rl(this,e.path))},Ce.prototype.addUnicode=function(e){this.unicodes.length===0&&(this.unicode=e),this.unicodes.push(e)},Ce.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},Ce.prototype.getPath=function(e,t,n,s,o){e=e!==void 0?e:0,t=t!==void 0?t:0,n=n!==void 0?n:72,s=Object.assign({},o&&o.defaultRenderOptions,s);let r,a,l=s.xScale,c=s.yScale,f=1/(this.path.unitsPerEm||1e3)*n,u=this;o&&o.variation&&(u=o.variation.getTransform(this,s.variation),r=u.path.commands),s.hinting&&o&&o.hinting&&(a=u.path&&o.hinting.exec(u,n,s)),a?(r=o.hinting.getCommands(a),e=Math.round(e),t=Math.round(t),l=c=1):(r=u.path.commands,l===void 0&&(l=f),c===void 0&&(c=f));let m=new xt;if(s.drawSVG){let g=this.getSvgImage(o);if(g){let S=new xt;return S._image={image:g.image,x:e+g.leftSideBearing*f,y:t-g.baseline*f,width:g.image.width*f,height:g.image.height*f},m._layers=[S],m}}if(s.drawLayers){let g=this.getLayers(o);if(g&&g.length){m._layers=[];for(let S=0;S<g.length;S+=1){let v=g[S],k=us(o,v.paletteIndex,s.usePalette);k==="currentColor"?k=s.fill||"black":k=Dt(k,s.colorFormat||"rgba"),s=Object.assign({},s,{fill:k}),m._layers.push(this.getPath.call(v.glyph,e,t,n,s,o))}return m}}m.fill=s.fill||this.path.fill,m.stroke=this.path.stroke,m.strokeWidth=this.path.strokeWidth*f;for(let g=0;g<r.length;g+=1){let S=r[g];S.type==="M"?m.moveTo(e+S.x*l,t+-S.y*c):S.type==="L"?m.lineTo(e+S.x*l,t+-S.y*c):S.type==="Q"?m.quadraticCurveTo(e+S.x1*l,t+-S.y1*c,e+S.x*l,t+-S.y*c):S.type==="C"?m.curveTo(e+S.x1*l,t+-S.y1*c,e+S.x2*l,t+-S.y2*c,e+S.x*l,t+-S.y*c):S.type==="Z"&&m.stroke&&m.strokeWidth&&m.closePath()}return m},Ce.prototype.getLayers=function(e){if(!e)throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");return e.layers.get(this.index)},Ce.prototype.getSvgImage=function(e){if(!e)throw new Error("The font object is required to read the svg table in order to get the image.");return e.svgImages.get(this.index)},Ce.prototype.getContours=function(e=null){if(this.points===void 0&&!e)return[];let t=[],n=[],s=e||this.points;for(let o=0;o<s.length;o+=1){let r=s[o];n.push(r),r.lastPointOfContour&&(t.push(n),n=[])}return $.argument(n.length===0,"There are still points left in the current contour."),t},Ce.prototype.getMetrics=function(){let e=this.path.commands,t=[],n=[];for(let o=0;o<e.length;o+=1){let r=e[o];r.type!=="Z"&&(t.push(r.x),n.push(r.y)),(r.type==="Q"||r.type==="C")&&(t.push(r.x1),n.push(r.y1)),r.type==="C"&&(t.push(r.x2),n.push(r.y2))}let s={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,n),leftSideBearing:this.leftSideBearing};return isFinite(s.xMin)||(s.xMin=0),isFinite(s.xMax)||(s.xMax=this.advanceWidth),isFinite(s.yMin)||(s.yMin=0),isFinite(s.yMax)||(s.yMax=0),s.rightSideBearing=this.advanceWidth-s.leftSideBearing-(s.xMax-s.xMin),s},Ce.prototype.draw=function(e,t,n,s,o,r){o=Object.assign({},r&&r.defaultRenderOptions,o),this.getPath(t,n,s,o,r).draw(e)},Ce.prototype.drawPoints=function(e,t,n,s,o,r){if(o=Object.assign({},r&&r.defaultRenderOptions,o),o.drawLayers){let g=this.getLayers(r);if(g&&g.length){for(let S=0;S<g.length;S+=1)g[S].glyph.index!==this.index&&this.drawPoints.call(g[S].glyph,e,t,n,s);return}}function a(g,S,v,k){e.beginPath();for(let O=0;O<g.length;O+=1)e.moveTo(S+g[O].x*k,v+g[O].y*k),e.arc(S+g[O].x*k,v+g[O].y*k,2,0,Math.PI*2,!1);e.fill()}t=t!==void 0?t:0,n=n!==void 0?n:0,s=s!==void 0?s:24;let l=1/this.path.unitsPerEm*s,c=[],f=[],m=this.path.commands;r&&r.variation&&(m=r.variation.getTransform(this,o.variation).path.commands);for(let g=0;g<m.length;g+=1){let S=m[g];S.x!==void 0&&c.push({x:S.x,y:-S.y}),S.x1!==void 0&&f.push({x:S.x1,y:-S.y1}),S.x2!==void 0&&f.push({x:S.x2,y:-S.y2})}e.fillStyle="blue",a(c,t,n,l),e.fillStyle="red",a(f,t,n,l)},Ce.prototype.drawMetrics=function(e,t,n,s){let o;t=t!==void 0?t:0,n=n!==void 0?n:0,s=s!==void 0?s:24,o=1/this.path.unitsPerEm*s,e.lineWidth=1,e.strokeStyle="black",St.line(e,t,-1e4,t,1e4),St.line(e,-1e4,n,1e4,n);let r=this.xMin||0,a=this.yMin||0,l=this.xMax||0,c=this.yMax||0,f=this.advanceWidth||0;e.strokeStyle="blue",St.line(e,t+r*o,-1e4,t+r*o,1e4),St.line(e,t+l*o,-1e4,t+l*o,1e4),St.line(e,-1e4,n+-a*o,1e4,n+-a*o),St.line(e,-1e4,n+-c*o,1e4,n+-c*o),e.strokeStyle="green",St.line(e,t+f*o,-1e4,t+f*o,1e4)},Ce.prototype.toPathData=function(e,t){e=Object.assign({},{variation:t&&t.defaultRenderOptions.variation},e);let n=this;t&&t.variation&&(n=t.variation.getTransform(this,e.variation));let s=n.points&&e.pointsTransform?e.pointsTransform(n.points):n.path;return e.pathTransform&&(s=e.pathTransform(s)),s.toPathData(e)},Ce.prototype.fromSVG=function(e,t={}){return this.path.fromSVG(e,t)},Ce.prototype.toSVG=function(e,t){let n=this.toPathData.apply(this,[e,t]);return this.path.toSVG(e,n)},Ce.prototype.toDOMElement=function(e,t){e=Object.assign({},{variation:t&&t.defaultRenderOptions.variation},e);let n=this.path;return t&&t.variation&&(n=t.variation.getTransform(this,e.variation).path),n.toDOMElement(e)};var Ut=Ce;function Mt(e,t,n){Object.defineProperty(e,t,{get:function(){return typeof e[n]>"u"&&e.path,e[n]},set:function(s){e[n]=s},enumerable:!0,configurable:!0})}function Cn(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(let n=0;n<t.length;n++){let s=t[n];s.path.unitsPerEm=e.unitsPerEm,this.glyphs[n]=s}this.length=t&&t.length||0}typeof Symbol<"u"&&Symbol.iterator&&(Cn.prototype[Symbol.iterator]=function(){let e=-1;return{next:function(){e++;let t=e>=this.length-1;return{value:this.get(e),done:t}}.bind(this)}}),Cn.prototype.get=function(e){if(this.font._push&&this.glyphs[e]===void 0){this.font._push(e),typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());let t=this.glyphs[e],n=this.font._IndexToUnicodeMap[e];if(n)for(let s=0;s<n.unicodes.length;s++)t.addUnicode(n.unicodes[s]);this.font.cffEncoding?t.name=this.font.cffEncoding.charset[e]:this.font.glyphNames.names&&(t.name=this.font.glyphNames.glyphIndexToName(e)),this.glyphs[e].advanceWidth=this.font._hmtxTableData[e].advanceWidth,this.glyphs[e].leftSideBearing=this.font._hmtxTableData[e].leftSideBearing}else typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());return this.glyphs[e]},Cn.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};function al(e,t){return new Ut({index:t,font:e})}function il(e,t,n,s,o,r){return function(){let a=new Ut({index:t,font:e});return a.path=function(){n(a,s,o);let l=r(e.glyphs,a);return l.unitsPerEm=e.unitsPerEm,l},Mt(a,"numberOfContours","_numberOfContours"),Mt(a,"xMin","_xMin"),Mt(a,"xMax","_xMax"),Mt(a,"yMin","_yMin"),Mt(a,"yMax","_yMax"),Mt(a,"points","_points"),a}}function ll(e,t,n,s,o){return function(){let r=new Ut({index:t,font:e});return r.path=function(){let a=n(e,r,s,o);return a.unitsPerEm=e.unitsPerEm,a},r}}var Je={GlyphSet:Cn,glyphLoader:al,ttfGlyphLoader:il,cffGlyphLoader:ll};function Vo(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Vo(e[n],t[n]))return!1;return!0}else return!1}var jo=10;function On(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}function et(e,t,n,s){let o=[],r=[],a=s>1?N.getULong(e,t):N.getCard16(e,t),l=s>1?4:2,c,f;if(a!==0){let u=N.getByte(e,t+l);c=t+(a+1)*u+l;let m=t+l+1;for(let g=0;g<a+1;g+=1)o.push(N.getOffset(e,m,u)),m+=u;f=c+o[a]}else f=t+l;for(let u=0;u<o.length-1;u+=1){let m=N.getBytes(e,c+o[u],c+o[u+1]);n&&(m=n(m,e,t,s)),r.push(m)}return{objects:r,startOffset:t,endOffset:f}}function cl(e,t,n){let s=[],o=n>1?N.getULong(e,t):N.getCard16(e,t),r=n>1?4:2,a,l;if(o!==0){let c=N.getByte(e,t+r);a=t+(o+1)*c+r;let f=t+r+1;for(let u=0;u<o+1;u+=1)s.push(N.getOffset(e,f,c)),f+=c;l=a+s[o]}else l=t+r;return{offsets:s,startOffset:t,endOffset:l}}function ul(e,t,n,s,o,r){let a=r>1?N.getULong(n,s):N.getCard16(n,s),l=r>1?4:2,c=0;if(a!==0){let u=N.getByte(n,s+l);c=s+(a+1)*u+l}let f=N.getBytes(n,c+t[e],c+t[e+1]);return o&&(f=o(f)),f}function fl(e){let t="",s=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){let o=e.parseByte(),r=o>>4,a=o&15;if(r===15||(t+=s[r],a===15))break;t+=s[a]}return parseFloat(t)}function pl(e,t){let n,s,o,r;if(t===28)return n=e.parseByte(),s=e.parseByte(),n<<8|s;if(t===29)return n=e.parseByte(),s=e.parseByte(),o=e.parseByte(),r=e.parseByte(),n<<24|s<<16|o<<8|r;if(t===30)return fl(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=e.parseByte(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=e.parseByte(),-(t-251)*256-n-108;throw new Error("Invalid b0 "+t)}function hl(e){let t={};for(let n=0;n<e.length;n+=1){let s=e[n][0],o=e[n][1],r;if(o.length===1?r=o[0]:r=o,Object.prototype.hasOwnProperty.call(t,s)&&!isNaN(t[s]))throw new Error("Object "+t+" already has key "+s);t[s]=r}return t}function fs(e,t,n,s){t=t!==void 0?t:0;let o=new N.Parser(e,t),r=[],a=[];n=n!==void 0?n:e.byteLength;let l=s<2?22:28;for(;o.relativeOffset<n;){let c=o.parseByte();if(c<l){if(c===12&&(c=1200+o.parseByte()),s>1&&c===23){Sl(a);continue}r.push([c,a]),a=[]}else a.push(pl(o,c,s))}return hl(r)}function zt(e,t){return t<=390?t=Tn[t]:e?t=e[t-391]:t=void 0,t}function ps(e,t,n){let s={},o;for(let r=0;r<t.length;r+=1){let a=t[r];if(Array.isArray(a.type)){let l=[];l.length=a.type.length;for(let c=0;c<a.type.length;c++)o=e[a.op]!==void 0?e[a.op][c]:void 0,o===void 0&&(o=a.value!==void 0&&a.value[c]!==void 0?a.value[c]:null),a.type[c]==="SID"&&(o=zt(n,o)),l[c]=o;s[a.name]=l}else o=e[a.op],o===void 0&&(o=a.value!==void 0?a.value:null),a.type==="SID"&&(o=zt(n,o)),s[a.name]=o}return s}function dl(e,t){let n={};if(n.formatMajor=N.getCard8(e,t),n.formatMinor=N.getCard8(e,t+1),n.formatMajor>2)throw new Error(`Unsupported CFF table version ${n.formatMajor}.${n.formatMinor}`);return n.size=N.getCard8(e,t+2),n.formatMajor<2?(n.offsetSize=N.getCard8(e,t+3),n.startOffset=t,n.endOffset=t+4):(n.topDictLength=N.getCard16(e,t+3),n.endOffset=t+8),n}var $o=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Wo=[{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"charStrings",op:17,type:"offset"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"vstore",op:24,type:"offset"}],zo=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}],Xo=[{name:"blueValues",op:6,type:"delta"},{name:"otherBlues",op:7,type:"delta"},{name:"familyBlues",op:7,type:"delta"},{name:"familyBlues",op:8,type:"delta"},{name:"familyOtherBlues",op:9,type:"delta"},{name:"blueScale",op:1209,type:"number",value:.039625},{name:"blueShift",op:1210,type:"number",value:7},{name:"blueFuzz",op:1211,type:"number",value:1},{name:"stdHW",op:10,type:"number"},{name:"stdVW",op:11,type:"number"},{name:"stemSnapH",op:1212,type:"number"},{name:"stemSnapV",op:1213,type:"number"},{name:"languageGroup",op:1217,type:"number",value:0},{name:"expansionFactor",op:1218,type:"number",value:.06},{name:"vsindex",op:22,type:"number",value:0},{name:"subrs",op:19,type:"offset"}],gl=[{name:"private",op:18,type:["number","offset"],value:[0,0]}];function ml(e,t,n,s){let o=fs(e,t,e.byteLength,s);return ps(o,s>1?Wo:$o,n)}function hs(e,t,n,s,o){let r=fs(e,t,n,o);return ps(r,o>1?Xo:zo,s)}function yl(e,t,n){let s=fs(e,t,void 0,n);return ps(s,gl)}function bl(e,t,n){let s=[];for(let o=0;o<n.length;o++){let r=new DataView(new Uint8Array(n[o]).buffer),a=yl(r,0,2),l=a.private[0],c=a.private[1];if(l!==0&&c!==0){let f=hs(e,c+t,l,[],2);if(f.subrs){let u=c+f.subrs,m=et(e,u+t,void 0,2);a._subrs=m.objects,a._subrsBias=On(a._subrs)}a._privateDict=f}s.push(a)}return s}function ds(e,t,n,s,o){let r=[];for(let a=0;a<n.length;a+=1){let l=new DataView(new Uint8Array(n[a]).buffer),c=ml(l,0,s,o);c._subrs=[],c._subrsBias=0,c._defaultWidthX=0,c._nominalWidthX=0;let f=o<2?c.private[0]:0,u=o<2?c.private[1]:0;if(f!==0&&u!==0){let m=hs(e,u+t,f,s,o);if(c._defaultWidthX=m.defaultWidthX,c._nominalWidthX=m.nominalWidthX,m.subrs!==0){let g=u+m.subrs,S=et(e,g+t,void 0,o);c._subrs=S.objects,c._subrsBias=On(c._subrs)}c._privateDict=m}r.push(c)}return r}function xl(e,t,n,s,o){let r,a,l=new N.Parser(e,t);n-=1;let c=[".notdef"],f=l.parseCard8();if(f===0)for(let u=0;u<n;u+=1)r=l.parseSID(),o?c.push(r):c.push(zt(s,r)||r);else if(f===1)for(;c.length<=n;){r=l.parseSID(),a=l.parseCard8();for(let u=0;u<=a;u+=1)o?c.push("cid"+("00000"+r).slice(-5)):c.push(zt(s,r)||r),r+=1}else if(f===2)for(;c.length<=n;){r=l.parseSID(),a=l.parseCard16();for(let u=0;u<=a;u+=1)o?c.push("cid"+("00000"+r).slice(-5)):c.push(zt(s,r)||r),r+=1}else throw new Error("Unknown charset format "+f);return c}function vl(e,t){let n,s={},o=new N.Parser(e,t),r=o.parseCard8();if(r===0){let a=o.parseCard8();for(let l=0;l<a;l+=1)n=o.parseCard8(),s[n]=l}else if(r===1){let a=o.parseCard8();n=1;for(let l=0;l<a;l+=1){let c=o.parseCard8(),f=o.parseCard8();for(let u=c;u<=c+f;u+=1)s[u]=n,n+=1}}else throw new Error("Unknown encoding format "+r);return s}function Sl(e){let t=e.pop();for(;e.length>t;)e.pop()}function Yo(e,t){let n=e.tables.cff&&e.tables.cff.topDict&&e.tables.cff.topDict.paintType||0;return n===2&&(t.fill=null,t.stroke="black",t.strokeWidth=e.tables.cff.topDict.strokeWidth||0),n}function gs(e,t,n,s,o){let r,a,l,c,f=new xt,u=[],m=0,g=!1,S=!1,v=0,k=0,O,W,V,Y,J=0,ie=[],ce,ue=0,xe=e.tables.cff2||e.tables.cff;if(V=xe.topDict._defaultWidthX,Y=xe.topDict._nominalWidthX,o=o||e.variation&&e.variation.get(),t.getBlendPath||(t.getBlendPath=function(G){return gs(e,t,n,s,G)}),e.isCIDFont||s>1){let G=xe.topDict._fdSelect?xe.topDict._fdSelect[t.index]:0,H=xe.topDict._fdArray[G];O=H._subrs,W=H._subrsBias,s>1?(ie=xe.topDict._vstore.itemVariationStore,J=H._privateDict.vsindex):(V=H._defaultWidthX,Y=H._nominalWidthX)}else O=xe.topDict._subrs,W=xe.topDict._subrsBias;let qe=Yo(e,f),ee=V;function Ne(G,H){S&&qe!==2&&f.closePath(),f.moveTo(G,H),S=!0}function Ae(){let G;G=(u.length&1)!==0,G&&!g&&(ee=u.shift()+Y),m+=u.length>>1,u.length=0,g=!0}function z(G){let H,Oe,gt,Pn,Ct,Ze,Ie,Ve,Le,_e,Fe,De,be=0;for(;be<G.length;){let $e=G[be];switch(be+=1,$e){case 1:Ae();break;case 3:Ae();break;case 4:u.length>1&&!g&&(ee=u.shift()+Y,g=!0),k+=u.pop(),Ne(v,k);break;case 5:for(;u.length>0;)v+=u.shift(),k+=u.shift(),f.lineTo(v,k);break;case 6:for(;u.length>0&&(v+=u.shift(),f.lineTo(v,k),u.length!==0);)k+=u.shift(),f.lineTo(v,k);break;case 7:for(;u.length>0&&(k+=u.shift(),f.lineTo(v,k),u.length!==0);)v+=u.shift(),f.lineTo(v,k);break;case 8:for(;u.length>0;)r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c+u.shift(),f.curveTo(r,a,l,c,v,k);break;case 10:if(Ct=u.pop()+W,Ze=O[Ct],Ze){if(ue>=jo){console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");break}ue++,z(Ze),ue--}break;case 11:if(s>1){console.error("CFF CharString operator return (11) is not supported in CFF2");break}return;case 12:switch($e=G[be],be+=1,$e){case 35:r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),Ie=l+u.shift(),Ve=c+u.shift(),Le=Ie+u.shift(),_e=Ve+u.shift(),Fe=Le+u.shift(),De=_e+u.shift(),v=Fe+u.shift(),k=De+u.shift(),u.shift(),f.curveTo(r,a,l,c,Ie,Ve),f.curveTo(Le,_e,Fe,De,v,k);break;case 34:r=v+u.shift(),a=k,l=r+u.shift(),c=a+u.shift(),Ie=l+u.shift(),Ve=c,Le=Ie+u.shift(),_e=c,Fe=Le+u.shift(),De=k,v=Fe+u.shift(),f.curveTo(r,a,l,c,Ie,Ve),f.curveTo(Le,_e,Fe,De,v,k);break;case 36:r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),Ie=l+u.shift(),Ve=c,Le=Ie+u.shift(),_e=c,Fe=Le+u.shift(),De=_e+u.shift(),v=Fe+u.shift(),f.curveTo(r,a,l,c,Ie,Ve),f.curveTo(Le,_e,Fe,De,v,k);break;case 37:r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),Ie=l+u.shift(),Ve=c+u.shift(),Le=Ie+u.shift(),_e=Ve+u.shift(),Fe=Le+u.shift(),De=_e+u.shift(),Math.abs(Fe-v)>Math.abs(De-k)?v=Fe+u.shift():k=De+u.shift(),f.curveTo(r,a,l,c,Ie,Ve),f.curveTo(Le,_e,Fe,De,v,k);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+$e),u.length=0}break;case 14:if(s>1){console.error("CFF CharString operator endchar (14) is not supported in CFF2");break}if(u.length>=4){let Ot=ls[u.pop()],_t=ls[u.pop()],Bn=u.pop(),Nn=u.pop();if(Ot&&_t){t.isComposite=!0,t.components=[];let ca=e.cffEncoding.charset.indexOf(Ot),ua=e.cffEncoding.charset.indexOf(_t);t.components.push({glyphIndex:ua,dx:0,dy:0}),t.components.push({glyphIndex:ca,dx:Nn,dy:Bn}),f.extend(e.glyphs.get(ua).path);let rh=e.glyphs.get(ca),Ds=JSON.parse(JSON.stringify(rh.path.commands));for(let Us=0;Us<Ds.length;Us+=1){let nt=Ds[Us];nt.type!=="Z"&&(nt.x+=Nn,nt.y+=Bn),(nt.type==="Q"||nt.type==="C")&&(nt.x1+=Nn,nt.y1+=Bn),nt.type==="C"&&(nt.x2+=Nn,nt.y2+=Bn)}f.extend(Ds)}}else u.length>0&&!g&&(ee=u.shift()+Y,g=!0);S&&qe!==2&&(f.closePath(),S=!1);break;case 15:if(s<2){console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");break}J=u.pop();break;case 16:if(s<2){console.error("CFF2 CharString operator blend (16) is not supported in CFF");break}ce||(ce=e.variation&&o&&e.variation.process.getBlendVector(ie,J,o));var pe=u.pop(),Me=ce?ce.length:ie.itemVariationSubtables[J].regionIndexes.length,je=pe*Me,Ke=u.length-je,at=Ke-pe;if(ce)for(let Ot=0;Ot<pe;Ot++){var la=u[at+Ot];for(let _t=0;_t<Me;_t++)la+=ce[_t]*u[Ke++];u[at+Ot]=la}for(;je--;)u.pop();break;case 18:Ae();break;case 19:case 20:Ae(),be+=m+7>>3;break;case 21:u.length>2&&!g&&(ee=u.shift()+Y,g=!0),k+=u.pop(),v+=u.pop(),Ne(v,k);break;case 22:u.length>1&&!g&&(ee=u.shift()+Y,g=!0),v+=u.pop(),Ne(v,k);break;case 23:Ae();break;case 24:for(;u.length>2;)r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c+u.shift(),f.curveTo(r,a,l,c,v,k);v+=u.shift(),k+=u.shift(),f.lineTo(v,k);break;case 25:for(;u.length>6;)v+=u.shift(),k+=u.shift(),f.lineTo(v,k);r=v+u.shift(),a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c+u.shift(),f.curveTo(r,a,l,c,v,k);break;case 26:for(u.length&1&&(v+=u.shift());u.length>0;)r=v,a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l,k=c+u.shift(),f.curveTo(r,a,l,c,v,k);break;case 27:for(u.length&1&&(k+=u.shift());u.length>0;)r=v+u.shift(),a=k,l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c,f.curveTo(r,a,l,c,v,k);break;case 28:H=G[be],Oe=G[be+1],u.push((H<<24|Oe<<16)>>16),be+=2;break;case 29:if(Ct=u.pop()+e.gsubrsBias,Ze=e.gsubrs[Ct],Ze){if(ue>=jo){console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");break}ue++,z(Ze),ue--}break;case 30:for(;u.length>0&&(r=v,a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c+(u.length===1?u.shift():0),f.curveTo(r,a,l,c,v,k),u.length!==0);)r=v+u.shift(),a=k,l=r+u.shift(),c=a+u.shift(),k=c+u.shift(),v=l+(u.length===1?u.shift():0),f.curveTo(r,a,l,c,v,k);break;case 31:for(;u.length>0&&(r=v+u.shift(),a=k,l=r+u.shift(),c=a+u.shift(),k=c+u.shift(),v=l+(u.length===1?u.shift():0),f.curveTo(r,a,l,c,v,k),u.length!==0);)r=v,a=k+u.shift(),l=r+u.shift(),c=a+u.shift(),v=l+u.shift(),k=c+(u.length===1?u.shift():0),f.curveTo(r,a,l,c,v,k);break;default:$e<32?console.log("Glyph "+t.index+": unknown operator "+$e):$e<247?u.push($e-139):$e<251?(H=G[be],be+=1,u.push(($e-247)*256+H+108)):$e<255?(H=G[be],be+=1,u.push(-($e-251)*256-H-108)):(H=G[be],Oe=G[be+1],gt=G[be+2],Pn=G[be+3],be+=4,u.push((H<<24|Oe<<16|gt<<8|Pn)/65536))}}}return z(n),e.variation&&o&&(f.commands=f.commands.map(G=>{let H=Object.keys(G);for(let Oe=0;Oe<H.length;Oe++){let gt=H[Oe];gt!=="type"&&(G[gt]=Math.round(G[gt]))}return G})),g&&(t.advanceWidth=ee),f}function qo(e,t,n,s,o){let r=[],a,l=new N.Parser(e,t),c=l.parseCard8();if(c===0)for(let f=0;f<n;f++){if(a=l.parseCard8(),a>=s)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+s+")");r.push(a)}else if(c===3||o>1&&c===4){let f=c===4?l.parseULong():l.parseCard16(),u=c===4?l.parseULong():l.parseCard16();if(u!==0)throw new Error(`CFF Table CID Font FDSelect format ${c} range has bad initial GID ${u}`);let m;for(let g=0;g<f;g++){if(a=c===4?l.parseUShort():l.parseCard8(),m=c===4?l.parseULong():l.parseCard16(),a>=s)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+s+")");if(m>n)throw new Error(`CFF Table CID Font FDSelect format ${o} range has bad GID ${m}`);for(;u<m;u++)r.push(a);u=m}if(m!==n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final (Sentinal) GID "+m)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+c);return r}function kl(e,t,n,s){let o,r=dl(e,t);r.formatMajor===2?o=n.tables.cff2={}:o=n.tables.cff={};let a=r.formatMajor>1?null:et(e,r.endOffset,N.bytesToString),l=r.formatMajor>1?null:et(e,a.endOffset),c=r.formatMajor>1?null:et(e,l.endOffset,N.bytesToString),f=et(e,r.formatMajor>1?t+r.size+r.topDictLength:c.endOffset,void 0,r.formatMajor);n.gsubrs=f.objects,n.gsubrsBias=On(n.gsubrs);let u;if(r.formatMajor>1){let g=t+r.size,S=N.getBytes(e,g,g+r.topDictLength);u=ds(e,0,[S],void 0,r.formatMajor)[0]}else{let g=ds(e,t,l.objects,c.objects,r.formatMajor);if(g.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+g.length);u=g[0]}if(o.topDict=u,u._privateDict&&(n.defaultWidthX=u._privateDict.defaultWidthX,n.nominalWidthX=u._privateDict.nominalWidthX),r.formatMajor<2&&u.ros[0]!==void 0&&u.ros[1]!==void 0&&(n.isCIDFont=!0),r.formatMajor>1){let g=u.fdArray,S=u.fdSelect;if(!g)throw new Error("This is a CFF2 font, but FDArray information is missing");let v=et(e,t+g,null,r.formatMajor),k=bl(e,t,v.objects);u._fdArray=k,S&&(u._fdSelect=qo(e,t+S,n.numGlyphs,k.length,r.formatMajor))}else if(n.isCIDFont){let g=u.fdArray,S=u.fdSelect;if(g===0||S===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");g+=t;let v=et(e,g),k=ds(e,t,v.objects,c.objects,r.formatMajor);u._fdArray=k,S+=t,u._fdSelect=qo(e,S,n.numGlyphs,k.length,r.formatMajor)}if(r.formatMajor<2){let g=t+u.private[1],S=hs(e,g,u.private[0],c.objects,r.formatMajor);if(n.defaultWidthX=S.defaultWidthX,n.nominalWidthX=S.nominalWidthX,S.subrs!==0){let v=g+S.subrs,k=et(e,v);n.subrs=k.objects,n.subrsBias=On(n.subrs)}else n.subrs=[],n.subrsBias=0}let m;if(s.lowMemory?(m=cl(e,t+u.charStrings,r.formatMajor),n.nGlyphs=m.offsets.length-(r.formatMajor>1?1:0)):(m=et(e,t+u.charStrings,null,r.formatMajor),n.nGlyphs=m.objects.length),r.formatMajor>1&&n.tables.maxp&&n.nGlyphs!==n.tables.maxp.numGlyphs&&console.error(`Glyph count in the CFF2 table (${n.nGlyphs}) must correspond to the glyph count in the maxp table (${n.tables.maxp.numGlyphs})`),r.formatMajor<2){let g=[],S=[];u.charset===0?g=Xi:u.charset===1?g=Yi:u.charset===2?g=qi:g=xl(e,t+u.charset,n.nGlyphs,c.objects,n.isCIDFont),u.encoding===0?S=ls:u.encoding===1?S=Zi:S=vl(e,t+u.encoding),n.cffEncoding=new No(S,g),n.encoding=n.encoding||n.cffEncoding}if(n.glyphs=new Je.GlyphSet(n),s.lowMemory)n._push=function(g){let S=ul(g,m.offsets,e,t+u.charStrings,void 0,r.formatMajor);n.glyphs.push(g,Je.cffGlyphLoader(n,g,gs,S,r.formatMajor))};else for(let g=0;g<n.nGlyphs;g+=1){let S=m.objects[g];n.glyphs.push(g,Je.cffGlyphLoader(n,g,gs,S,r.formatMajor))}if(u.vstore){let g=new N.Parser(e,t+u.vstore);u._vstore=g.parseVariationStore()}}function Zo(e,t){let n,s=Tn.indexOf(e);return s>=0&&(n=s),s=t.indexOf(e),s>=0?n=s+Tn.length:(n=Tn.length+t.length,t.push(e)),n}function Tl(){return new I.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function wl(e){let t=new I.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(let n=0;n<e.length;n+=1)t.names.push({name:"name_"+n,type:"NAME",value:e[n]});return t}function Ko(e,t,n){let s={};for(let o=0;o<e.length;o+=1){let r=e[o],a=t[r.name];a!==void 0&&!Vo(a,r.value)&&(r.type==="SID"&&(a=Zo(a,n)),s[r.op]={name:r.name,type:r.type,value:a})}return s}function Qo(e,t,n){let s=new I.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return s.dict=Ko(n>1?Wo:$o,e,t),s}function Jo(e){let t=new I.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return t.topDicts=[{name:"topDict_0",type:"TABLE",value:e}],t}function Cl(e){let t=new I.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);t.strings=[];for(let n=0;n<e.length;n+=1)t.strings.push({name:"string_"+n,type:"STRING",value:e[n]});return t}function Ol(){return new I.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Ll(e,t){let n=new I.Record("Charsets",[{name:"format",type:"Card8",value:0}]);for(let s=0;s<e.length;s+=1){let o=e[s],r=Zo(o,t);n.fields.push({name:"glyph_"+s,type:"SID",value:r})}return n}function El(e,t){let n=[],s=e.path;t<2&&n.push({name:"width",type:"NUMBER",value:e.advanceWidth});let o=0,r=0;for(let a=0;a<s.commands.length;a+=1){let l,c,f=s.commands[a];if(f.type==="Q"){let u=.3333333333333333,m=2/3;f={type:"C",x:f.x,y:f.y,x1:Math.round(u*o+m*f.x1),y1:Math.round(u*r+m*f.y1),x2:Math.round(u*f.x+m*f.x1),y2:Math.round(u*f.y+m*f.y1)}}if(f.type==="M")l=Math.round(f.x-o),c=Math.round(f.y-r),n.push({name:"dx",type:"NUMBER",value:l}),n.push({name:"dy",type:"NUMBER",value:c}),n.push({name:"rmoveto",type:"OP",value:21}),o=Math.round(f.x),r=Math.round(f.y);else if(f.type==="L")l=Math.round(f.x-o),c=Math.round(f.y-r),n.push({name:"dx",type:"NUMBER",value:l}),n.push({name:"dy",type:"NUMBER",value:c}),n.push({name:"rlineto",type:"OP",value:5}),o=Math.round(f.x),r=Math.round(f.y);else if(f.type==="C"){let u=Math.round(f.x1-o),m=Math.round(f.y1-r),g=Math.round(f.x2-f.x1),S=Math.round(f.y2-f.y1);l=Math.round(f.x-f.x2),c=Math.round(f.y-f.y2),n.push({name:"dx1",type:"NUMBER",value:u}),n.push({name:"dy1",type:"NUMBER",value:m}),n.push({name:"dx2",type:"NUMBER",value:g}),n.push({name:"dy2",type:"NUMBER",value:S}),n.push({name:"dx",type:"NUMBER",value:l}),n.push({name:"dy",type:"NUMBER",value:c}),n.push({name:"rrcurveto",type:"OP",value:8}),o=Math.round(f.x),r=Math.round(f.y)}}return t<2&&n.push({name:"endchar",type:"OP",value:14}),n}function Rl(e,t){let n=new I.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]);for(let s=0;s<e.length;s+=1){let o=e.get(s),r=El(o,t);n.charStrings.push({name:o.name,type:"CHARSTRING",value:r})}return n}function Al(e,t,n){let s=new I.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return s.dict=Ko(n>1?Xo:zo,e,t),s}function Il(e,t){let s=new I.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),o=1/t.unitsPerEm,r={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[o,0,0,o,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},a=t&&t.topDict||{};a.paintType&&(r.paintType=a.paintType,r.strokeWidth=a.strokeWidth||0);let l={},c=[],f;for(let S=1;S<e.length;S+=1)f=e.get(S),c.push(f.name);let u=[];s.header=Tl(),s.nameIndex=wl([t.postScriptName]);let m=Qo(r,u);s.topDictIndex=Jo(m),s.globalSubrIndex=Ol(),s.charsets=Ll(c,u),s.charStringsIndex=Rl(e,1),s.privateDict=Al(l,u),s.stringIndex=Cl(u);let g=s.header.sizeOf()+s.nameIndex.sizeOf()+s.topDictIndex.sizeOf()+s.stringIndex.sizeOf()+s.globalSubrIndex.sizeOf();return r.charset=g,r.encoding=0,r.charStrings=r.charset+s.charsets.sizeOf(),r.private[1]=r.charStrings+s.charStringsIndex.sizeOf(),m=Qo(r,u),s.topDictIndex=Jo(m),s}var ms={parse:kl,make:Il};function Fl(e,t){let n={},s=new N.Parser(e,t);return n.version=s.parseVersion(),n.fontRevision=Math.round(s.parseFixed()*1e3)/1e3,n.checkSumAdjustment=s.parseULong(),n.magicNumber=s.parseULong(),$.argument(n.magicNumber===1594834165,"Font header has wrong magic number."),n.flags=s.parseUShort(),n.unitsPerEm=s.parseUShort(),n.created=s.parseLongDateTime(),n.modified=s.parseLongDateTime(),n.xMin=s.parseShort(),n.yMin=s.parseShort(),n.xMax=s.parseShort(),n.yMax=s.parseShort(),n.macStyle=s.parseUShort(),n.lowestRecPPEM=s.parseUShort(),n.fontDirectionHint=s.parseShort(),n.indexToLocFormat=s.parseShort(),n.glyphDataFormat=s.parseShort(),n}function Dl(e){let t=Math.round(new Date().getTime()/1e3)+2082844800,n=t,s=e.macStyle||0;return e.createdTimestamp&&(n=e.createdTimestamp+2082844800),new I.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:n},{name:"modified",type:"LONGDATETIME",value:t},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:s},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)}var er={parse:Fl,make:Dl};function Ul(e,t){let n={},s=new N.Parser(e,t);return n.version=s.parseVersion(),n.ascender=s.parseShort(),n.descender=s.parseShort(),n.lineGap=s.parseShort(),n.advanceWidthMax=s.parseUShort(),n.minLeftSideBearing=s.parseShort(),n.minRightSideBearing=s.parseShort(),n.xMaxExtent=s.parseShort(),n.caretSlopeRise=s.parseShort(),n.caretSlopeRun=s.parseShort(),n.caretOffset=s.parseShort(),s.relativeOffset+=8,n.metricDataFormat=s.parseShort(),n.numberOfHMetrics=s.parseUShort(),n}function Ml(e){return new I.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)}var tr={parse:Ul,make:Ml};function Pl(e,t,n,s,o){let r,a,l=new N.Parser(e,t);for(let c=0;c<s;c+=1){c<n&&(r=l.parseUShort(),a=l.parseShort());let f=o.get(c);f.advanceWidth=r,f.leftSideBearing=a}}function Bl(e,t,n,s,o){e._hmtxTableData={};let r,a,l=new N.Parser(t,n);for(let c=0;c<o;c+=1)c<s&&(r=l.parseUShort(),a=l.parseShort()),e._hmtxTableData[c]={advanceWidth:r,leftSideBearing:a}}function Nl(e,t,n,s,o,r,a){a.lowMemory?Bl(e,t,n,s,o):Pl(t,n,s,o,r)}function _l(e){let t=new I.Table("hmtx",[]);for(let n=0;n<e.length;n+=1){let s=e.get(n),o=s.advanceWidth||0,r=s.leftSideBearing||0;t.fields.push({name:"advanceWidth_"+n,type:"USHORT",value:o}),t.fields.push({name:"leftSideBearing_"+n,type:"SHORT",value:r})}return t}var nr={parse:Nl,make:_l};function Gl(e){let t=new I.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]),n="",s=12+e.length*4;for(let o=0;o<e.length;++o){let r=n.indexOf(e[o]);r<0&&(r=n.length,n+=e[o]),t.fields.push({name:"offset "+o,type:"USHORT",value:s+r}),t.fields.push({name:"length "+o,type:"USHORT",value:e[o].length})}return t.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),t}function Hl(e,t){let n=new N.Parser(e,t),s=n.parseULong();$.argument(s===1,"Unsupported ltag table version."),n.skip("uLong",1);let o=n.parseULong(),r=[];for(let a=0;a<o;a++){let l="",c=t+n.parseUShort(),f=n.parseUShort();for(let u=c;u<c+f;++u)l+=String.fromCharCode(e.getInt8(u));r.push(l)}return r}var sr={make:Gl,parse:Hl};function Vl(e,t){let n={},s=new N.Parser(e,t);return n.version=s.parseVersion(),n.numGlyphs=s.parseUShort(),n.version===1&&(n.maxPoints=s.parseUShort(),n.maxContours=s.parseUShort(),n.maxCompositePoints=s.parseUShort(),n.maxCompositeContours=s.parseUShort(),n.maxZones=s.parseUShort(),n.maxTwilightPoints=s.parseUShort(),n.maxStorage=s.parseUShort(),n.maxFunctionDefs=s.parseUShort(),n.maxInstructionDefs=s.parseUShort(),n.maxStackElements=s.parseUShort(),n.maxSizeOfInstructions=s.parseUShort(),n.maxComponentElements=s.parseUShort(),n.maxComponentDepth=s.parseUShort()),n}function jl(e){return new I.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])}var or={parse:Vl,make:jl},ys=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function $l(e){for(let t=0;t<ys.length;t+=1){let n=ys[t];if(e>=n.begin&&e<n.end)return t}return-1}function Wl(e,t){let n={},s=new N.Parser(e,t);n.version=s.parseUShort(),n.xAvgCharWidth=s.parseShort(),n.usWeightClass=s.parseUShort(),n.usWidthClass=s.parseUShort(),n.fsType=s.parseUShort(),n.ySubscriptXSize=s.parseShort(),n.ySubscriptYSize=s.parseShort(),n.ySubscriptXOffset=s.parseShort(),n.ySubscriptYOffset=s.parseShort(),n.ySuperscriptXSize=s.parseShort(),n.ySuperscriptYSize=s.parseShort(),n.ySuperscriptXOffset=s.parseShort(),n.ySuperscriptYOffset=s.parseShort(),n.yStrikeoutSize=s.parseShort(),n.yStrikeoutPosition=s.parseShort(),n.sFamilyClass=s.parseShort(),n.panose=[];for(let o=0;o<10;o++)n.panose[o]=s.parseByte();return n.ulUnicodeRange1=s.parseULong(),n.ulUnicodeRange2=s.parseULong(),n.ulUnicodeRange3=s.parseULong(),n.ulUnicodeRange4=s.parseULong(),n.achVendID=String.fromCharCode(s.parseByte(),s.parseByte(),s.parseByte(),s.parseByte()),n.fsSelection=s.parseUShort(),n.usFirstCharIndex=s.parseUShort(),n.usLastCharIndex=s.parseUShort(),n.sTypoAscender=s.parseShort(),n.sTypoDescender=s.parseShort(),n.sTypoLineGap=s.parseShort(),n.usWinAscent=s.parseUShort(),n.usWinDescent=s.parseUShort(),n.version>=1&&(n.ulCodePageRange1=s.parseULong(),n.ulCodePageRange2=s.parseULong()),n.version>=2&&(n.sxHeight=s.parseShort(),n.sCapHeight=s.parseShort(),n.usDefaultChar=s.parseUShort(),n.usBreakChar=s.parseUShort(),n.usMaxContent=s.parseUShort()),n}function zl(e){return new I.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],e)}var bs={parse:Wl,make:zl,unicodeRanges:ys,getUnicodeRange:$l};function Xl(e,t){let n={},s=new N.Parser(e,t);switch(n.version=s.parseVersion(),n.italicAngle=s.parseFixed(),n.underlinePosition=s.parseShort(),n.underlineThickness=s.parseShort(),n.isFixedPitch=s.parseULong(),n.minMemType42=s.parseULong(),n.maxMemType42=s.parseULong(),n.minMemType1=s.parseULong(),n.maxMemType1=s.parseULong(),n.version){case 1:n.names=vt.slice();break;case 2:n.numberOfGlyphs=s.parseUShort(),n.glyphNameIndex=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)n.glyphNameIndex[o]=s.parseUShort();n.names=[];for(let o=0;o<n.numberOfGlyphs;o++)if(n.glyphNameIndex[o]>=vt.length){let r=s.parseChar();n.names.push(s.parseString(r))}break;case 2.5:n.numberOfGlyphs=s.parseUShort(),n.offset=new Array(n.numberOfGlyphs);for(let o=0;o<n.numberOfGlyphs;o++)n.offset[o]=s.parseChar();break}return n}function Yl(e){let{italicAngle:t=Math.round((e.italicAngle||0)*65536),underlinePosition:n=0,underlineThickness:s=0,isFixedPitch:o=0,minMemType42:r=0,maxMemType42:a=0,minMemType1:l=0,maxMemType1:c=0}=e.tables.post||{};return new I.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:t},{name:"underlinePosition",type:"FWORD",value:n},{name:"underlineThickness",type:"FWORD",value:s},{name:"isFixedPitch",type:"ULONG",value:o},{name:"minMemType42",type:"ULONG",value:r},{name:"maxMemType42",type:"ULONG",value:a},{name:"minMemType1",type:"ULONG",value:l},{name:"maxMemType1",type:"ULONG",value:c}])}var rr={parse:Xl,make:Yl},Xe=new Array(9);Xe[1]=function(){let t=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:1,coverage:this.parsePointer(w.coverage),deltaGlyphId:this.parseShort()};if(n===2)return{substFormat:2,coverage:this.parsePointer(w.coverage),substitute:this.parseOffset16List()};$.assert(!1,"0x"+t.toString(16)+": lookup type 1 format must be 1 or 2.")},Xe[2]=function(){let t=this.parseUShort();return $.argument(t===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:t,coverage:this.parsePointer(w.coverage),sequences:this.parseListOfLists()}},Xe[3]=function(){let t=this.parseUShort();return $.argument(t===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:t,coverage:this.parsePointer(w.coverage),alternateSets:this.parseListOfLists()}},Xe[4]=function(){let t=this.parseUShort();return $.argument(t===1,"GSUB ligature table identifier-format must be 1"),{substFormat:t,coverage:this.parsePointer(w.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Pt={sequenceIndex:w.uShort,lookupListIndex:w.uShort};Xe[5]=function(){let t=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:n,coverage:this.parsePointer(w.coverage),ruleSets:this.parseListOfLists(function(){let s=this.parseUShort(),o=this.parseUShort();return{input:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(o,Pt)}})};if(n===2)return{substFormat:n,coverage:this.parsePointer(w.coverage),classDef:this.parsePointer(w.classDef),classSets:this.parseListOfLists(function(){let s=this.parseUShort(),o=this.parseUShort();return{classes:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(o,Pt)}})};if(n===3){let s=this.parseUShort(),o=this.parseUShort();return{substFormat:n,coverages:this.parseList(s,w.pointer(w.coverage)),lookupRecords:this.parseRecordList(o,Pt)}}$.assert(!1,"0x"+t.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Xe[6]=function(){let t=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:1,coverage:this.parsePointer(w.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pt)}})};if(n===2)return{substFormat:2,coverage:this.parsePointer(w.coverage),backtrackClassDef:this.parsePointer(w.classDef),inputClassDef:this.parsePointer(w.classDef),lookaheadClassDef:this.parsePointer(w.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pt)}})};if(n===3)return{substFormat:3,backtrackCoverage:this.parseList(w.pointer(w.coverage)),inputCoverage:this.parseList(w.pointer(w.coverage)),lookaheadCoverage:this.parseList(w.pointer(w.coverage)),lookupRecords:this.parseRecordList(Pt)};$.assert(!1,"0x"+t.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Xe[7]=function(){let t=this.parseUShort();$.argument(t===1,"GSUB Extension Substitution subtable identifier-format must be 1");let n=this.parseUShort(),s=new w(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:n,extension:Xe[n].call(s)}},Xe[8]=function(){let t=this.parseUShort();return $.argument(t===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:t,coverage:this.parsePointer(w.coverage),backtrackCoverage:this.parseList(w.pointer(w.coverage)),lookaheadCoverage:this.parseList(w.pointer(w.coverage)),substitutes:this.parseUShortList()}};function ql(e,t){t=t||0;let n=new w(e,t),s=n.parseVersion(1);return $.argument(s===1||s===1.1,"Unsupported GSUB table version."),s===1?{version:s,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Xe)}:{version:s,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Xe),variations:n.parseFeatureVariationsList()}}var kt=new Array(9);kt[1]=function(t){if(t.substFormat===1)return new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)},{name:"deltaGlyphID",type:"SHORT",value:t.deltaGlyphId}]);if(t.substFormat===2)return new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.ushortList("substitute",t.substitute)));$.fail("Lookup type 1 substFormat must be 1 or 2.")},kt[2]=function(t){return $.assert(t.substFormat===1,"Lookup type 2 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.tableList("seqSet",t.sequences,function(n){return new I.Table("sequenceSetTable",I.ushortList("sequence",n))})))},kt[3]=function(t){return $.assert(t.substFormat===1,"Lookup type 3 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.tableList("altSet",t.alternateSets,function(n){return new I.Table("alternateSetTable",I.ushortList("alternate",n))})))},kt[4]=function(t){return $.assert(t.substFormat===1,"Lookup type 4 substFormat must be 1."),new I.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.tableList("ligSet",t.ligatureSets,function(n){return new I.Table("ligatureSetTable",I.tableList("ligature",n,function(s){return new I.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:s.ligGlyph}].concat(I.ushortList("component",s.components,s.components.length+1)))}))})))},kt[5]=function(t){if(t.substFormat===1)return new I.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:t.substFormat},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.tableList("sequenceRuleSet",t.ruleSets,function(n){return n?new I.Table("sequenceRuleSetTable",I.tableList("sequenceRule",n,function(s){let o=I.ushortList("seqLookup",[],s.lookupRecords.length).concat(I.ushortList("inputSequence",s.input,s.input.length+1));[o[0],o[1]]=[o[1],o[0]];for(let r=0;r<s.lookupRecords.length;r++){let a=s.lookupRecords[r];o=o.concat({name:"sequenceIndex"+r,type:"USHORT",value:a.sequenceIndex}).concat({name:"lookupListIndex"+r,type:"USHORT",value:a.lookupListIndex})}return new I.Table("sequenceRuleTable",o)})):new I.Table("NULL",null)})));if(t.substFormat===2)return new I.Table("contextualSubstitutionTable",[{name:"substFormat",type:"USHORT",value:t.substFormat},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)},{name:"classDef",type:"TABLE",value:new I.ClassDef(t.classDef)}].concat(I.tableList("classSeqRuleSet",t.classSets,function(n){return n?new I.Table("classSeqRuleSetTable",I.tableList("classSeqRule",n,function(s){let o=I.ushortList("classes",s.classes,s.classes.length+1).concat(I.ushortList("seqLookupCount",[],s.lookupRecords.length));for(let r=0;r<s.lookupRecords.length;r++){let a=s.lookupRecords[r];o=o.concat({name:"sequenceIndex"+r,type:"USHORT",value:a.sequenceIndex}).concat({name:"lookupListIndex"+r,type:"USHORT",value:a.lookupListIndex})}return new I.Table("classSeqRuleTable",o)})):new I.Table("NULL",null)})));if(t.substFormat===3){let n=[{name:"substFormat",type:"USHORT",value:t.substFormat}];n.push({name:"inputGlyphCount",type:"USHORT",value:t.coverages.length}),n.push({name:"substitutionCount",type:"USHORT",value:t.lookupRecords.length});for(let o=0;o<t.coverages.length;o++){let r=t.coverages[o];n.push({name:"inputCoverage"+o,type:"TABLE",value:new I.Coverage(r)})}for(let o=0;o<t.lookupRecords.length;o++){let r=t.lookupRecords[o];n=n.concat({name:"sequenceIndex"+o,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+o,type:"USHORT",value:r.lookupListIndex})}return new I.Table("contextualSubstitutionTable",n)}$.assert(!1,"lookup type 5 format must be 1, 2 or 3.")},kt[6]=function(t){if(t.substFormat===1)return new I.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:t.substFormat},{name:"coverage",type:"TABLE",value:new I.Coverage(t.coverage)}].concat(I.tableList("chainRuleSet",t.chainRuleSets,function(s){return new I.Table("chainRuleSetTable",I.tableList("chainRule",s,function(o){let r=I.ushortList("backtrackGlyph",o.backtrack,o.backtrack.length).concat(I.ushortList("inputGlyph",o.input,o.input.length+1)).concat(I.ushortList("lookaheadGlyph",o.lookahead,o.lookahead.length)).concat(I.ushortList("substitution",[],o.lookupRecords.length));for(let a=0;a<o.lookupRecords.length;a++){let l=o.lookupRecords[a];r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:l.lookupListIndex})}return new I.Table("chainRuleTable",r)}))})));if(t.substFormat===2)$.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(t.substFormat===3){let n=[{name:"substFormat",type:"USHORT",value:t.substFormat}];n.push({name:"backtrackGlyphCount",type:"USHORT",value:t.backtrackCoverage.length});for(let o=0;o<t.backtrackCoverage.length;o++){let r=t.backtrackCoverage[o];n.push({name:"backtrackCoverage"+o,type:"TABLE",value:new I.Coverage(r)})}n.push({name:"inputGlyphCount",type:"USHORT",value:t.inputCoverage.length});for(let o=0;o<t.inputCoverage.length;o++){let r=t.inputCoverage[o];n.push({name:"inputCoverage"+o,type:"TABLE",value:new I.Coverage(r)})}n.push({name:"lookaheadGlyphCount",type:"USHORT",value:t.lookaheadCoverage.length});for(let o=0;o<t.lookaheadCoverage.length;o++){let r=t.lookaheadCoverage[o];n.push({name:"lookaheadCoverage"+o,type:"TABLE",value:new I.Coverage(r)})}n.push({name:"substitutionCount",type:"USHORT",value:t.lookupRecords.length});for(let o=0;o<t.lookupRecords.length;o++){let r=t.lookupRecords[o];n=n.concat({name:"sequenceIndex"+o,type:"USHORT",value:r.sequenceIndex}).concat({name:"lookupListIndex"+o,type:"USHORT",value:r.lookupListIndex})}return new I.Table("chainContextTable",n)}$.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function Zl(e){return new I.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new I.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new I.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new I.LookupList(e.lookups,kt)}])}var ar={parse:ql,make:Zl};function Kl(e,t){let n=new N.Parser(e,t),s=n.parseULong();$.argument(s===1,"Unsupported META table version."),n.parseULong(),n.parseULong();let o=n.parseULong(),r={};for(let a=0;a<o;a++){let l=n.parseTag(),c=n.parseULong(),f=n.parseULong();if(l==="appl"||l==="bild")continue;let u=At.UTF8(e,t+c,f);r[l]=u}return r}function Ql(e){let t=Object.keys(e).length,n="",s=16+t*12,o=new I.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:s},{name:"numTags",type:"ULONG",value:t}]);for(let r in e){let a=n.length;n+=e[r],o.fields.push({name:"tag "+r,type:"TAG",value:r}),o.fields.push({name:"offset "+r,type:"ULONG",value:s+a}),o.fields.push({name:"length "+r,type:"ULONG",value:e[r].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),o}var ir={parse:Kl,make:Ql};function Jl(e,t){let n=new w(e,t),s=n.parseUShort();s!==0&&console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");let o=n.parseUShort(),r=n.parseOffset32(),a=n.parseOffset32(),l=n.parseUShort();n.relativeOffset=r;let c=n.parseRecordList(o,{glyphID:w.uShort,firstLayerIndex:w.uShort,numLayers:w.uShort});n.relativeOffset=a;let f=n.parseRecordList(l,{glyphID:w.uShort,paletteIndex:w.uShort});return{version:s,baseGlyphRecords:c,layerRecords:f}}function ec({version:e=0,baseGlyphRecords:t=[],layerRecords:n=[]}){$.argument(e===0,"Only COLRv0 supported.");let s=14,o=s+t.length*6;return new I.Table("COLR",[{name:"version",type:"USHORT",value:e},{name:"numBaseGlyphRecords",type:"USHORT",value:t.length},{name:"baseGlyphRecordsOffset",type:"ULONG",value:s},{name:"layerRecordsOffset",type:"ULONG",value:o},{name:"numLayerRecords",type:"USHORT",value:n.length},...t.map((r,a)=>[{name:"glyphID_"+a,type:"USHORT",value:r.glyphID},{name:"firstLayerIndex_"+a,type:"USHORT",value:r.firstLayerIndex},{name:"numLayers_"+a,type:"USHORT",value:r.numLayers}]).flat(),...n.map((r,a)=>[{name:"LayerGlyphID_"+a,type:"USHORT",value:r.glyphID},{name:"paletteIndex_"+a,type:"USHORT",value:r.paletteIndex}]).flat()])}var lr={parse:Jl,make:ec};function tc(e,t){return[{name:"tag_"+e,type:"TAG",value:t.tag},{name:"minValue_"+e,type:"FIXED",value:t.minValue<<16},{name:"defaultValue_"+e,type:"FIXED",value:t.defaultValue<<16},{name:"maxValue_"+e,type:"FIXED",value:t.maxValue<<16},{name:"flags_"+e,type:"USHORT",value:0},{name:"nameID_"+e,type:"USHORT",value:t.axisNameID}]}function nc(e,t,n){let s={},o=new N.Parser(e,t);s.tag=o.parseTag(),s.minValue=o.parseFixed(),s.defaultValue=o.parseFixed(),s.maxValue=o.parseFixed(),o.skip("uShort",1);let r=o.parseUShort();return s.axisNameID=r,s.name=kn(n,r),s}function sc(e,t,n,s={}){let o=[{name:"nameID_"+e,type:"USHORT",value:t.subfamilyNameID},{name:"flags_"+e,type:"USHORT",value:0}];for(let r=0;r<n.length;++r){let a=n[r].tag;o.push({name:"axis_"+e+" "+a,type:"FIXED",value:t.coordinates[a]<<16})}return s&&s.postScriptNameID&&o.push({name:"postScriptNameID_",type:"USHORT",value:t.postScriptNameID!==void 0?t.postScriptNameID:65535}),o}function oc(e,t,n,s,o){let r={},a=new N.Parser(e,t),l=a.parseUShort();r.subfamilyNameID=l,r.name=kn(s,l,[2,17]),a.skip("uShort",1),r.coordinates={};for(let f=0;f<n.length;++f)r.coordinates[n[f].tag]=a.parseFixed();if(a.relativeOffset===o)return r.postScriptNameID=void 0,r.postScriptName=void 0,r;let c=a.parseUShort();return r.postScriptNameID=c==65535?void 0:c,r.postScriptName=r.postScriptNameID!==void 0?kn(s,c,[6]):"",r}function rc(e,t){let n=new I.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:e.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:e.instances.length},{name:"instanceSize",type:"USHORT",value:4+e.axes.length*4}]);n.offsetToData=n.sizeOf();for(let o=0;o<e.axes.length;o++)n.fields=n.fields.concat(tc(o,e.axes[o],t));let s={};for(let o=0;o<e.instances.length;o++)if(e.instances[o].postScriptNameID!==void 0){n.instanceSize+=2,s.postScriptNameID=!0;break}for(let o=0;o<e.instances.length;o++)n.fields=n.fields.concat(sc(o,e.instances[o],e.axes,s));return n}function ac(e,t,n){let s=new N.Parser(e,t),o=s.parseULong();$.argument(o===65536,"Unsupported fvar table version.");let r=s.parseOffset16();s.skip("uShort",1);let a=s.parseUShort(),l=s.parseUShort(),c=s.parseUShort(),f=s.parseUShort(),u=[];for(let S=0;S<a;S++)u.push(nc(e,t+r+S*l,n));let m=[],g=t+r+a*l;for(let S=0;S<c;S++)m.push(oc(e,g+S*f,u,n,f));return{axes:u,instances:m}}var cr={make:rc,parse:ac},ic={tag:w.tag,nameID:w.uShort,ordering:w.uShort},Xt=new Array(5);Xt[1]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed()}},Xt[2]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),nominalValue:this.parseFixed(),rangeMinValue:this.parseFixed(),rangeMaxValue:this.parseFixed()}},Xt[3]=function(){return{axisIndex:this.parseUShort(),flags:this.parseUShort(),valueNameID:this.parseUShort(),value:this.parseFixed(),linkedValue:this.parseFixed()}},Xt[4]=function(){let t=this.parseUShort();return{flags:this.parseUShort(),valueNameID:this.parseUShort(),axisValues:this.parseList(t,function(){return{axisIndex:this.parseUShort(),value:this.parseFixed()}})}};function lc(){let e=this.parseUShort(),t=Xt[e],n={format:e};return t===void 0?(console.warn(`Unknown axis value table format ${e}`),n):Object.assign(n,this.parseStruct(t.bind(this)))}function cc(e,t,n){t||(t=0);let s=new N.Parser(e,t),o=s.parseUShort(),r=s.parseUShort();o!==1&&console.warn(`Unsupported STAT table version ${o}.${r}`);let a=[o,r],l=s.parseUShort(),c=s.parseUShort(),f=s.parseOffset32(),u=s.parseUShort(),m=s.parseOffset32(),g=o>1||r>0?s.parseUShort():void 0;n!==void 0&&$.argument(c>=n.axes.length,"STAT axis count must be greater than or equal to fvar axis count"),u>0&&$.argument(c>=0,"STAT axis count must be greater than 0 if STAT axis value count is greater than 0");let S=[];for(let O=0;O<c;O++)s.offset=t+f,s.relativeOffset=O*l,S.push(s.parseStruct(ic));s.offset=t,s.relativeOffset=m;let v=s.parseUShortList(u),k=[];for(let O=0;O<u;O++)s.offset=t+m,s.relativeOffset=v[O],k.push(lc.apply(s));return{version:a,axes:S,values:k,elidedFallbackNameID:g}}var Yt=new Array(5);Yt[1]=function(t,n){return[{name:`format${t}`,type:"USHORT",value:1},{name:`axisIndex${t}`,type:"USHORT",value:n.axisIndex},{name:`flags${t}`,type:"USHORT",value:n.flags},{name:`valueNameID${t}`,type:"USHORT",value:n.valueNameID},{name:`value${t}`,type:"FLOAT",value:n.value}]},Yt[2]=function(t,n){return[{name:`format${t}`,type:"USHORT",value:2},{name:`axisIndex${t}`,type:"USHORT",value:n.axisIndex},{name:`flags${t}`,type:"USHORT",value:n.flags},{name:`valueNameID${t}`,type:"USHORT",value:n.valueNameID},{name:`nominalValue${t}`,type:"FLOAT",value:n.nominalValue},{name:`rangeMinValue${t}`,type:"FLOAT",value:n.rangeMinValue},{name:`rangeMaxValue${t}`,type:"FLOAT",value:n.rangeMaxValue}]},Yt[3]=function(t,n){return[{name:`format${t}`,type:"USHORT",value:3},{name:`axisIndex${t}`,type:"USHORT",value:n.axisIndex},{name:`flags${t}`,type:"USHORT",value:n.flags},{name:`valueNameID${t}`,type:"USHORT",value:n.valueNameID},{name:`value${t}`,type:"FLOAT",value:n.value},{name:`linkedValue${t}`,type:"FLOAT",value:n.linkedValue}]},Yt[4]=function(t,n){let s=[{name:`format${t}`,type:"USHORT",value:4},{name:`axisCount${t}`,type:"USHORT",value:n.axisValues.length},{name:`flags${t}`,type:"USHORT",value:n.flags},{name:`valueNameID${t}`,type:"USHORT",value:n.valueNameID}];for(let o=0;o<n.axisValues.length;o++)s=s.concat([{name:`format${t}axisIndex${o}`,type:"USHORT",value:n.axisValues[o].axisIndex},{name:`format${t}value${o}`,type:"FLOAT",value:n.axisValues[o].value}]);return s};function uc(e,t){return new I.Record("axisRecord_"+e,[{name:"axisTag_"+e,type:"TAG",value:t.tag},{name:"axisNameID_"+e,type:"USHORT",value:t.nameID},{name:"axisOrdering_"+e,type:"USHORT",value:t.ordering}])}function fc(e,t){let n=t.format,s=Yt[n];$.argument(s!==void 0,`Unknown axis value table format ${n}`);let o=s(e,t);return new I.Table("axisValueTable_"+e,o)}function pc(e){let t=new I.Table("STAT",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:2},{name:"designAxisSize",type:"USHORT",value:8},{name:"designAxisCount",type:"USHORT",value:e.axes.length},{name:"designAxesOffset",type:"ULONG",value:0},{name:"axisValueCount",type:"USHORT",value:e.values.length},{name:"offsetToAxisValueOffsets",type:"ULONG",value:0},{name:"elidedFallbackNameID",type:"USHORT",value:e.elidedFallbackNameID}]);t.designAxesOffset=t.offsetToAxisValueOffsets=t.sizeOf();for(let r=0;r<e.axes.length;r++){let a=uc(r,e.axes[r]);t.offsetToAxisValueOffsets+=a.sizeOf(),t.fields=t.fields.concat(a.fields)}let n=[],s=[],o=e.values.length*2;for(let r=0;r<e.values.length;r++){let a=fc(r,e.values[r]);n.push({name:"offset_"+r,type:"USHORT",value:o}),o+=a.sizeOf(),s=s.concat(a.fields)}return t.fields=t.fields.concat(n),t.fields=t.fields.concat(s),t}var ur={make:pc,parse:cc};function hc(e,t){return new I.Record("axisValueMap_"+e,[{name:"fromCoordinate_"+e,type:"F2DOT14",value:t.fromCoordinate},{name:"toCoordinate_"+e,type:"F2DOT14",value:t.toCoordinate}])}function dc(e,t){let n=new I.Record("segmentMap_"+e,[{name:"positionMapCount_"+e,type:"USHORT",value:t.axisValueMaps.length}]),s=[];for(let o=0;o<t.axisValueMaps.length;o++){let r=hc(`${e}_${o}`,t.axisValueMaps[o]);s=s.concat(r.fields)}return n.fields=n.fields.concat(s),n}function gc(e,t){$.argument(e.axisSegmentMaps.length===t.axes.length,"avar axis count must correspond to fvar axis count");let n=new I.Table("avar",[{name:"majorVersion",type:"USHORT",value:1},{name:"minorVersion",type:"USHORT",value:0},{name:"reserved",type:"USHORT",value:0},{name:"axisCount",type:"USHORT",value:e.axisSegmentMaps.length}]);for(let s=0;s<e.axisSegmentMaps.length;s++){let o=dc(s,e.axisSegmentMaps[s]);n.fields=n.fields.concat(o.fields)}return n}function mc(e,t,n){t||(t=0);let s=new w(e,t),o=s.parseUShort(),r=s.parseUShort();o!==1&&console.warn(`Unsupported avar table version ${o}.${r}`),s.skip("uShort",1);let a=s.parseUShort();$.argument(a===n.axes.length,"avar axis count must correspond to fvar axis count");let l=[];for(let c=0;c<a;c++){let f=[],u=s.parseUShort();for(let m=0;m<u;m++){let g=s.parseF2Dot14(),S=s.parseF2Dot14();f.push({fromCoordinate:g,toCoordinate:S})}l.push({axisValueMaps:f})}return{version:[o,r],axisSegmentMaps:l}}var fr={make:gc,parse:mc};function yc(e,t,n,s){let o=new N.Parser(e,t),r=o.parseTupleVariationStore(o.relativeOffset,n.axes.length,"cvar",s),a=o.parseUShort(),l=o.parseUShort();return a!==1&&console.warn(`Unsupported cvar table version ${a}.${l}`),{version:[a,l],...r}}function bc(){console.warn("Writing of cvar tables is not yet supported.")}var pr={make:bc,parse:yc};function xc(e,t,n,s){let o=new N.Parser(e,t),r=o.parseUShort(),a=o.parseUShort();r!==1&&console.warn(`Unsupported gvar table version ${r}.${a}`);let l=o.parseUShort();l!==n.axes.length&&console.warn(`axisCount ${l} in gvar table does not match the number of axes ${n.axes.length} in the fvar table!`);let c=o.parseUShort(),f=o.parsePointer32(function(){return this.parseTupleRecords(c,l)}),u=o.parseTupleVariationStoreList(l,"gvar",s);return{version:[r,a],sharedTuples:f,glyphVariations:u}}function vc(){console.warn("Writing of gvar tables is not yet supported.")}var hr={make:vc,parse:xc};function Sc(e,t){let n={},s=new N.Parser(e,t);n.version=s.parseUShort(),$.argument(n.version<=1,"Unsupported gasp table version."),n.numRanges=s.parseUShort(),n.gaspRanges=[];for(let o=0;o<n.numRanges;o++)n.gaspRanges[o]={rangeMaxPPEM:s.parseUShort(),rangeGaspBehavior:s.parseUShort()};return n}function kc(e){let t=new I.Table("gasp",[{name:"version",type:"USHORT",value:1},{name:"numRanges",type:"USHORT",value:e.numRanges}]);for(let n in e.gaspRanges)t.fields.push({name:"rangeMaxPPEM",type:"USHORT",value:e.gaspRanges[n].rangeMaxPPEM}),t.fields.push({name:"rangeGaspBehavior",type:"USHORT",value:e.gaspRanges[n].rangeGaspBehavior});return t}var dr={parse:Sc,make:kc};function Tc(e,t){let n=new Map,s=e.buffer,o=new w(e,t);if(o.parseUShort()!==0)return n;o.relativeOffset=o.parseOffset32();let a=e.byteOffset+t+o.relativeOffset,l=o.parseUShort(),c=new Map;for(let f=0;f<l;f++){let u=o.parseUShort(),m=o.parseUShort(),g=a+o.parseOffset32(),S=o.parseULong(),v=c.get(g);v===void 0&&(v=new Uint8Array(s,g,S),c.set(g,v));for(let k=u;k<=m;k++)n.set(k,v)}return n}function wc(e){let t=Array.from(e.keys()).sort(),n=[],s=[],o=new Map,r=0,a={endGlyphID:null};for(let g=0,S=t.length;g<S;g++){let v=t[g],k=e.get(v),O=o.get(k);O===void 0&&(O=r,s.push(k),o.set(k,O),r+=k.byteLength),v-1===a.endGlyphID&&O===a.svgDocOffset?a.endGlyphID=v:(a={startGlyphID:v,endGlyphID:v,svgDocOffset:O,svgDocLength:k.byteLength},n.push(a))}let l=n.length,c=s.length,f=2+l*12,u=new Array(4+l*4+c),m=0;u[m++]={name:"version",type:"USHORT",value:0},u[m++]={name:"svgDocumentListOffset",type:"ULONG",value:10},u[m++]={name:"reserved",type:"ULONG",value:0},u[m++]={name:"numEntries",type:"USHORT",value:l};for(let g=0;g<l;g++){let S="documentRecord_"+g,{startGlyphID:v,endGlyphID:k,svgDocOffset:O,svgDocLength:W}=n[g];u[m++]={name:S+"_startGlyphID",type:"USHORT",value:v},u[m++]={name:S+"_endGlyphID",type:"USHORT",value:k},u[m++]={name:S+"_svgDocOffset",type:"ULONG",value:f+O},u[m++]={name:S+"_svgDocLength",type:"ULONG",value:W}}for(let g=0;g<c;g++)u[m++]={name:"svgDoc_"+g,type:"LITERAL",value:s[g]};return new I.Table("SVG ",u)}var gr={make:wc,parse:Tc};function mr(e){return Math.log(e)/Math.log(2)|0}function xs(e){for(;e.length%4!==0;)e.push(0);let t=0;for(let n=0;n<e.length;n+=4)t+=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];return t%=Math.pow(2,32),t}function yr(e,t,n,s){return new I.Record("Table Record",[{name:"tag",type:"TAG",value:e!==void 0?e:""},{name:"checkSum",type:"ULONG",value:t!==void 0?t:0},{name:"offset",type:"ULONG",value:n!==void 0?n:0},{name:"length",type:"ULONG",value:s!==void 0?s:0}])}function br(e){let t=new I.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);t.tables=e,t.numTables=e.length;let n=Math.pow(2,mr(t.numTables));t.searchRange=16*n,t.entrySelector=mr(n),t.rangeShift=t.numTables*16-t.searchRange;let s=[],o=[],r=t.sizeOf()+yr().sizeOf()*t.numTables;for(;r%4!==0;)r+=1,o.push({name:"padding",type:"BYTE",value:0});for(let a=0;a<e.length;a+=1){let l=e[a];$.argument(l.tableName.length===4,"Table name"+l.tableName+" is invalid.");let c=l.sizeOf(),f=yr(l.tableName,xs(l.encode()),r,c);for(s.push({name:f.tag+" Table Record",type:"RECORD",value:f}),o.push({name:l.tableName+" table",type:"RECORD",value:l}),r+=c,$.argument(!isNaN(r),"Something went wrong calculating the offset.");r%4!==0;)r+=1,o.push({name:"padding",type:"BYTE",value:0})}return s.sort(function(a,l){return a.value.tag>l.value.tag?1:-1}),t.fields=t.fields.concat(s),t.fields=t.fields.concat(o),t}function xr(e,t,n){for(let s=0;s<t.length;s+=1){let o=e.charToGlyphIndex(t[s]);if(o>0)return e.glyphs.get(o).getMetrics()}return n}function Cc(e){let t=0;for(let n=0;n<e.length;n+=1)t+=e[n];return t/e.length}function Oc(e){let t=[],n=[],s=[],o=[],r=[],a=[],l=[],c,f=0,u=0,m=0,g=0,S=0;for(let pe=0;pe<e.glyphs.length;pe+=1){let Me=e.glyphs.get(pe),je=Me.unicode|0;if(isNaN(Me.advanceWidth))throw new Error("Glyph "+Me.name+" ("+pe+"): advanceWidth is not a number.");(c>je||c===void 0)&&je>0&&(c=je),f<je&&(f=je);let Ke=bs.getUnicodeRange(je);if(Ke<32)u|=1<<Ke;else if(Ke<64)m|=1<<Ke-32;else if(Ke<96)g|=1<<Ke-64;else if(Ke<123)S|=1<<Ke-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(Me.name===".notdef")continue;let at=Me.getMetrics();t.push(at.xMin),n.push(at.yMin),s.push(at.xMax),o.push(at.yMax),a.push(at.leftSideBearing),l.push(at.rightSideBearing),r.push(Me.advanceWidth)}let v={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,s),yMax:Math.max.apply(null,o),advanceWidthMax:Math.max.apply(null,r),advanceWidthAvg:Cc(r),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,l)};v.ascender=e.ascender,v.descender=e.descender;let k=0;e.weightClass>=600&&(k|=e.macStyleValues.BOLD),e.italicAngle<0&&(k|=e.macStyleValues.ITALIC);let O=er.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:v.xMin,yMin:v.yMin,xMax:v.xMax,yMax:v.yMax,lowestRecPPEM:3,macStyle:k,createdTimestamp:e.createdTimestamp}),W=tr.make({ascender:v.ascender,descender:v.descender,advanceWidthMax:v.advanceWidthMax,minLeftSideBearing:v.minLeftSideBearing,minRightSideBearing:v.minRightSideBearing,xMaxExtent:v.maxLeftSideBearing+(v.xMax-v.xMin),numberOfHMetrics:e.glyphs.length}),V=or.make(e.glyphs.length),Y=bs.make(Object.assign({xAvgCharWidth:Math.round(v.advanceWidthAvg),usFirstCharIndex:c,usLastCharIndex:f,ulUnicodeRange1:u,ulUnicodeRange2:m,ulUnicodeRange3:g,ulUnicodeRange4:S,sTypoAscender:v.ascender,sTypoDescender:v.descender,sTypoLineGap:0,usWinAscent:v.yMax,usWinDescent:Math.abs(v.yMin),ulCodePageRange1:1,sxHeight:xr(e,"xyvw",{yMax:Math.round(v.ascender/2)}).yMax,sCapHeight:xr(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",v).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0},e.tables.os2)),J=nr.make(e.glyphs),ie=Mo.make(e.glyphs),ce=e.getEnglishName("fontFamily"),ue=e.getEnglishName("fontSubfamily"),xe=ce+" "+ue,qe=e.getEnglishName("postScriptName");qe||(qe=ce.replace(/\s/g,"")+"-"+ue);let ee={};for(let pe in e.names)ee[pe]=e.names[pe];ee.unicode=ee.unicode||{},ee.macintosh=ee.macintosh||{},ee.windows=ee.windows||{};let Ne=e.names.unicode||{},Ae=e.names.macintosh||{},z=e.names.windows||{};for(let pe in ee){if(ee[pe]=ee[pe]||{},!ee[pe].uniqueID){let Me=e.getEnglishName("manufacturer")||"";ee[pe].uniqueID={en:`${Me}: ${xe}`}}ee[pe].postScriptName||(ee[pe].postScriptName={en:qe})}ee.unicode.preferredFamily||(ee.unicode.preferredFamily=Ne.fontFamily||Ae.fontFamily||z.fontFamily),ee.macintosh.preferredFamily||(ee.macintosh.preferredFamily=Ae.fontFamily||Ne.fontFamily||z.fontFamily),ee.windows.preferredFamily||(ee.windows.preferredFamily=z.fontFamily||Ne.fontFamily||Ae.fontFamily),ee.unicode.preferredSubfamily||(ee.unicode.preferredSubfamily=Ne.fontSubfamily||Ae.fontSubfamily||z.fontSubfamily),ee.macintosh.preferredSubfamily||(ee.macintosh.preferredSubfamily=Ae.fontSubfamily||Ne.fontSubfamily||z.fontSubfamily),ee.windows.preferredSubfamily||(ee.windows.preferredSubfamily=z.fontSubfamily||Ne.fontSubfamily||Ae.fontSubfamily);let G=[],H=Uo.make(ee,G),Oe=G.length>0?sr.make(G):void 0,gt=rr.make(e),Pn=ms.make(e.glyphs,{version:e.getEnglishName("version"),fullName:xe,familyName:ce,weightName:ue,postScriptName:qe,unitsPerEm:e.unitsPerEm,fontBBox:[0,v.yMin,v.ascender,v.advanceWidthMax],topDict:e.tables.cff&&e.tables.cff.topDict||{}}),Ct=e.metas&&Object.keys(e.metas).length>0?ir.make(e.metas):void 0,Ze=[O,W,V,Y,H,ie,gt,Pn,J];Oe&&Ze.push(Oe);let Ie={gsub:ar,cpal:Ho,colr:lr,stat:ur,avar:fr,cvar:pr,fvar:cr,gvar:hr,gasp:dr,svg:gr},Ve={avar:[e.tables.fvar],fvar:[e.names]};for(let pe in Ie){let Me=e.tables[pe];if(Me){let je=Ie[pe].make.call(e,Me,...Ve[pe]||[]);je&&Ze.push(je)}}Ct&&Ze.push(Ct);let Le=br(Ze),_e=Le.encode(),Fe=xs(_e),De=Le.fields,be=!1;for(let pe=0;pe<De.length;pe+=1)if(De[pe].name==="head table"){De[pe].value.checkSumAdjustment=2981146554-Fe,be=!0;break}if(!be)throw new Error("Could not find head table with checkSum to adjust.");return Le}var Lc={make:br,fontToTable:Oc,computeCheckSum:xs};function vs(e,t){let n=0,s=e.length-1;for(;n<=s;){let o=n+s>>>1,r=e[o].tag;if(r===t)return o;r<t?n=o+1:s=o-1}return-n-1}function vr(e,t){let n=0,s=e.length-1;for(;n<=s;){let o=n+s>>>1,r=e[o];if(r===t)return o;r<t?n=o+1:s=o-1}return-n-1}function Sr(e,t){let n,s=0,o=e.length-1;for(;s<=o;){let r=s+o>>>1;n=e[r];let a=n.start;if(a===t)return n;a<t?s=r+1:o=r-1}if(s>0)return n=e[s-1],t>n.end?0:n}function kr(e,t){this.font=e,this.tableName=t}kr.prototype={searchTag:vs,binSearch:vr,getTable:function(e){let t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){let e=this.getTable();return e?e.scripts.map(function(t){return t.tag}):[]},getDefaultScriptName:function(){let e=this.getTable();if(!e)return;let t=!1;for(let n=0;n<e.scripts.length;n++){let s=e.scripts[n].tag;if(s==="DFLT")return s;s==="latn"&&(t=!0)}if(t)return"latn"},getScriptTable:function(e,t){let n=this.getTable(t);if(n){e=e||"DFLT";let s=n.scripts,o=vs(n.scripts,e);if(o>=0)return s[o].script;if(t){let r={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return s.splice(-1-o,0,r),r.script}}},getLangSysTable:function(e,t,n){let s=this.getScriptTable(e,n);if(s){if(!t||t==="dflt"||t==="DFLT")return s.defaultLangSys;let o=vs(s.langSysRecords,t);if(o>=0)return s.langSysRecords[o].langSys;if(n){let r={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return s.langSysRecords.splice(-1-o,0,r),r.langSys}}},getFeatureTable:function(e,t,n,s){let o=this.getLangSysTable(e,t,s);if(o){let r,a=o.featureIndexes,l=this.font.tables[this.tableName].features;for(let c=0;c<a.length;c++)if(r=l[a[c]],r.tag===n)return r.feature;if(s){let c=l.length;return $.assert(c===0||n>=l[c-1].tag,"Features must be added in alphabetical order."),r={tag:n,feature:{params:0,lookupListIndexes:[]}},l.push(r),a.push(c),r.feature}}},getLookupTables:function(e,t,n,s,o){let r=this.getFeatureTable(e,t,n,o),a=[];if(r){let l,c=r.lookupListIndexes,f=this.font.tables[this.tableName].lookups;for(let u=0;u<c.length;u++)l=f[c[u]],l.lookupType===s&&a.push(l);if(a.length===0&&o){l={lookupType:s,lookupFlag:0,subtables:[],markFilteringSet:void 0};let u=f.length;return f.push(l),c.push(u),[l]}}return a},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:{let n=Sr(e.ranges,t);return n?n.classId:0}}},getCoverageIndex:function(e,t){switch(e.format){case 1:{let n=vr(e.glyphs,t);return n>=0?n:-1}case 2:{let n=Sr(e.ranges,t);return n?n.index+t-n.start:-1}}},expandCoverage:function(e){if(e.format===1)return e.glyphs;{let t=[],n=e.ranges;for(let s=0;s<n.length;s++){let o=n[s],r=o.start,a=o.end;for(let l=r;l<=a;l++)t.push(l)}return t}}};var Ln=kr;function qt(e){Ln.call(this,e,"gpos")}qt.prototype=Ln.prototype,qt.prototype.init=function(){let e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)},qt.prototype.getKerningValue=function(e,t,n){for(let s=0;s<e.length;s++){let o=e[s].subtables;for(let r=0;r<o.length;r++){let a=o[r],l=this.getCoverageIndex(a.coverage,t);if(!(l<0))switch(a.posFormat){case 1:{let c=a.pairSets[l];for(let f=0;f<c.length;f++){let u=c[f];if(u.secondGlyph===n)return u.value1&&u.value1.xAdvance||0}break}case 2:{let c=this.getGlyphClass(a.classDef1,t),f=this.getGlyphClass(a.classDef2,n),u=a.classRecords[c][f];return u.value1&&u.value1.xAdvance||0}}}}return 0},qt.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,"kern",2)};var Ec=qt;function Rc(e,t){let n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}function Ac(e,t,n){let s=0,o=e.length-1,r=null;for(;s<=o;){let a=Math.floor((s+o)/2),l=e[a],c=l[t];if(c<n)s=a+1;else if(c>n)o=a-1;else{r=l;break}}return r}function Ic(e,t,n){let s=0,o=e.length-1;for(;s<=o;){let r=Math.floor((s+o)/2),a=e[r];if(a[t]<n)s=r+1;else if(a[t]>n)o=r-1;else return r}return-1}function Fc(e,t,n){let s=0,o=e.length,r=(a,l)=>a[t]-l[t];for(;s<o;){let a=s+o>>>1;r(e[a],n)<0?s=a+1:o=a}return e.splice(s,0,n),s}function Tr(e){return e[0]===31&&e[1]===139&&e[2]===8}function Dc(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=10,s=e.byteLength-8,o=t.getInt8(3);if(o&4&&(n+=2+t.getUint16(n,!0)),o&8)for(;n<s&&e[n++]!==0;);if(o&16)for(;n<s&&e[n++]!==0;);if(o&2&&(n+=2),n>=s)throw new Error("Can't find compressed blocks");let r=t.getUint32(t.byteLength-4,!0);return Ee(e.subarray(n,s),new Uint8Array(r))}function wr(e){return{x:e.x,y:e.y,onCurve:e.onCurve,lastPointOfContour:e.lastPointOfContour}}function Uc(e){return{glyphIndex:e.glyphIndex,xScale:e.xScale,scale01:e.scale01,scale10:e.scale10,yScale:e.yScale,dx:e.dx,dy:e.dy}}function Pe(e){Ln.call(this,e,"gsub")}function Ss(e,t,n){let s=e.subtables;for(let o=0;o<s.length;o++){let r=s[o];if(r.substFormat===t)return r}if(n)return s.push(n),n}Pe.prototype=Ln.prototype,Pe.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Pe.prototype.getSingle=function(e,t,n){let s=[],o=this.getLookupTables(t,n,e,1);for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],f=this.expandCoverage(c.coverage),u;if(c.substFormat===1){let m=c.deltaGlyphId;for(u=0;u<f.length;u++){let g=f[u];s.push({sub:g,by:g+m})}}else{let m=c.substitute;for(u=0;u<f.length;u++)s.push({sub:f[u],by:m[u]})}}}return s},Pe.prototype.getMultiple=function(e,t,n){let s=[],o=this.getLookupTables(t,n,e,2);for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],f=this.expandCoverage(c.coverage),u;for(u=0;u<f.length;u++){let m=f[u],g=c.sequences[u];s.push({sub:m,by:g})}}}return s},Pe.prototype.getAlternates=function(e,t,n){let s=[],o=this.getLookupTables(t,n,e,3);for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],f=this.expandCoverage(c.coverage),u=c.alternateSets;for(let m=0;m<f.length;m++)s.push({sub:f[m],by:u[m]})}}return s},Pe.prototype.getLigatures=function(e,t,n){let s=[],o=this.getLookupTables(t,n,e,4);for(let r=0;r<o.length;r++){let a=o[r].subtables;for(let l=0;l<a.length;l++){let c=a[l],f=this.expandCoverage(c.coverage),u=c.ligatureSets;for(let m=0;m<f.length;m++){let g=f[m],S=u[m];for(let v=0;v<S.length;v++){let k=S[v];s.push({sub:[g].concat(k.components),by:k.ligGlyph})}}}}return s},Pe.prototype.addSingle=function(e,t,n,s){let o=this.getLookupTables(n,s,e,1,!0)[0],r=Ss(o,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});$.assert(r.coverage.format===1,"Single: unable to modify coverage table format "+r.coverage.format);let a=t.sub,l=this.binSearch(r.coverage.glyphs,a);l<0&&(l=-1-l,r.coverage.glyphs.splice(l,0,a),r.substitute.splice(l,0,0)),r.substitute[l]=t.by},Pe.prototype.addMultiple=function(e,t,n,s){$.assert(t.by instanceof Array&&t.by.length>1,'Multiple: "by" must be an array of two or more ids');let o=this.getLookupTables(n,s,e,2,!0)[0],r=Ss(o,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});$.assert(r.coverage.format===1,"Multiple: unable to modify coverage table format "+r.coverage.format);let a=t.sub,l=this.binSearch(r.coverage.glyphs,a);l<0&&(l=-1-l,r.coverage.glyphs.splice(l,0,a),r.sequences.splice(l,0,0)),r.sequences[l]=t.by},Pe.prototype.addAlternate=function(e,t,n,s){let o=this.getLookupTables(n,s,e,3,!0)[0],r=Ss(o,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});$.assert(r.coverage.format===1,"Alternate: unable to modify coverage table format "+r.coverage.format);let a=t.sub,l=this.binSearch(r.coverage.glyphs,a);l<0&&(l=-1-l,r.coverage.glyphs.splice(l,0,a),r.alternateSets.splice(l,0,0)),r.alternateSets[l]=t.by},Pe.prototype.addLigature=function(e,t,n,s){let o=this.getLookupTables(n,s,e,4,!0)[0],r=o.subtables[0];r||(r={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},o.subtables[0]=r),$.assert(r.coverage.format===1,"Ligature: unable to modify coverage table format "+r.coverage.format);let a=t.sub[0],l=t.sub.slice(1),c={ligGlyph:t.by,components:l},f=this.binSearch(r.coverage.glyphs,a);if(f>=0){let u=r.ligatureSets[f];for(let m=0;m<u.length;m++)if(Rc(u[m].components,l))return;u.push(c)}else f=-1-f,r.coverage.glyphs.splice(f,0,a),r.ligatureSets.splice(f,0,[c])},Pe.prototype.getFeature=function(e,t,n){if(/ss\d\d/.test(e))return this.getSingle(e,t,n);switch(e){case"aalt":case"salt":return this.getSingle(e,t,n).concat(this.getAlternates(e,t,n));case"dlig":case"liga":case"rlig":return this.getLigatures(e,t,n);case"ccmp":return this.getMultiple(e,t,n).concat(this.getLigatures(e,t,n));case"stch":return this.getMultiple(e,t,n)}},Pe.prototype.add=function(e,t,n,s){if(/ss\d\d/.test(e))return this.addSingle(e,t,n,s);switch(e){case"aalt":case"salt":return typeof t.by=="number"?this.addSingle(e,t,n,s):this.addAlternate(e,t,n,s);case"dlig":case"liga":case"rlig":return this.addLigature(e,t,n,s);case"ccmp":return t.by instanceof Array?this.addMultiple(e,t,n,s):this.addLigature(e,t,n,s)}};var Mc=Pe,Cr=class{constructor(e){this.defaultValue=255,this.font=e}cpal(){return this.font.tables&&this.font.tables.cpal?this.font.tables.cpal:!1}getAll(e){let t=[],n=this.cpal();if(!n)return t;for(let s=0;s<n.colorRecordIndices.length;s++){let o=n.colorRecordIndices[s],r=[];for(let a=o;a<o+n.numPaletteEntries;a++)r.push(Dt(n.colorRecords[a],e||"hexa"));t.push(r)}return t}toCPALcolor(e){return Array.isArray(e)?e.map(t=>wn(t,"raw")):wn(e,"raw")}fillPalette(e,t=[],n=this.cpal().numPaletteEntries){return e=Number.isInteger(e)?this.get(e,"raw"):e,Object.assign(Array(n).fill(this.defaultValue),this.toCPALcolor(e).concat(this.toCPALcolor(t)))}extend(e){if(this.ensureCPAL(Array(e).fill(this.defaultValue)))return;let t=this.cpal(),n=t.numPaletteEntries+e,s=this.getAll().map(o=>this.fillPalette(o,[],n));t.numPaletteEntries=n,t.colorRecords=this.toCPALcolor(s.flat()),this.updateIndices()}get(e,t="hexa"){return this.getAll(t)[e]||null}getColor(e,t=0,n="hexa"){return us(this.font,e,t,n)}setColor(e,t,n=0){e=parseInt(e),n=parseInt(n);let s=this.getAll("raw"),o=s[n];if(!o)throw Error(`paletteIndex ${n} out of range`);let r=this.cpal(),a=r.numPaletteEntries;Array.isArray(t)||(t=[t]),t.length+e>a&&(this.extend(t.length+e-a),s=this.getAll("raw"),o=s[n]);for(let l=0;l<t.length;l++)o[l+e]=this.toCPALcolor(t[l]);r.colorRecords=s.flat(),this.updateIndices()}add(e){if(this.ensureCPAL(e))return;let t=this.cpal(),n=t.numPaletteEntries;e&&e.length?(e=this.toCPALcolor(e),e.length>n?this.extend(e.length-n):e.length<n&&(e=this.fillPalette(e)),t.colorRecordIndices.push(t.colorRecords.length),t.colorRecords.push(...e)):(t.colorRecordIndices.push(t.colorRecords.length),t.colorRecords.push(...Array(n).fill(this.defaultValue)))}delete(e){let t=this.getAll("raw");delete t[e];let n=this.cpal();n.colorRecordIndices.pop(),n.colorRecords=t.flat()}deleteColor(e,t){if(e===t)throw Error("replacementIndex cannot be the same as colorIndex");let n=this.cpal(),s=this.getAll("raw"),o=[];if(t>n.numPaletteEntries-1)throw Error(`Replacement index out of range: numPaletteEntries after deletion: ${n.numPaletteEntries-1}, replacementIndex: ${t})`);for(let l=0;l<s.length;l++){let f=s[l].filter((u,m)=>m!==e);o.push(f)}let r=this.font.tables.colr;if(r){let l=r.layerRecords;for(let c=0;c<l.length;c++){let f=l[c].paletteIndex;if(f>e)l[c].paletteIndex-=1;else if(f===e){let u=0;for(let m=0;m<s.length;m++)if(t>e&&t<=e+s[m].length){u++;break}l[c].paletteIndex=t-u}}this.font.tables.colr={...r,layerRecords:l}}let a=o.flat();for(let l=0;l<s.length;l++)n.colorRecordIndices[l]-=l;n.numPaletteEntries=Math.max(0,n.numPaletteEntries-1),n.colorRecords=this.toCPALcolor(a)}ensureCPAL(e){return this.cpal()?!1:(!e||!e.length?e=[this.defaultValue]:e=this.toCPALcolor(e),this.font.tables.cpal={version:0,numPaletteEntries:e.length,colorRecords:e,colorRecordIndices:[0]},!0)}updateIndices(){let e=this.cpal(),t=Math.ceil(e.colorRecords.length/e.numPaletteEntries);e.colorRecordIndices=[];for(let n=0;n<t;n++)e.colorRecordIndices.push(n*e.numPaletteEntries)}},Pc=class{constructor(e){this.font=e}ensureCOLR(){return this.font.tables.colr||(this.font.tables.colr={version:0,baseGlyphRecords:[],layerRecords:[]}),this.font}get(e){let t=this.font,n=[],s=t.tables.colr,o=t.tables.cpal;if(!s||!o)return n;let r=Ac(s.baseGlyphRecords,"glyphID",e);if(!r)return n;let a=r.firstLayerIndex,l=r.numLayers;for(let c=0;c<l;c++){let f=s.layerRecords[a+c];n.push({glyph:t.glyphs.get(f.glyphID),paletteIndex:f.paletteIndex})}return n}add(e,t,n){let s=this.get(e);t=Array.isArray(t)?t:[t],n===void 0||n===1/0||n>s.length?n=s.length:n<0&&(n=s.length+1+n%(s.length+1),n>=s.length+1&&(n-=s.length+1));let o=[];for(let r=0;r<n;r++){let a=Number.isInteger(s[r].glyph)?s[r].glyph:s[r].glyph.index;o.push({glyphID:a,paletteIndex:s[r].paletteIndex})}for(let r of t){let a=Number.isInteger(r.glyph)?r.glyph:r.glyph.index;o.push({glyphID:a,paletteIndex:r.paletteIndex})}for(let r=n;r<s.length;r++){let a=Number.isInteger(s[r].glyph)?s[r].glyph:s[r].glyph.index;o.push({glyphID:a,paletteIndex:s[r].paletteIndex})}this.updateColrTable(e,o)}setPaletteIndex(e,t,n){let s=this.get(e);s[t]?(s=s.map((o,r)=>({glyphID:o.glyph.index,paletteIndex:r===t?n:o.paletteIndex})),this.updateColrTable(e,s)):console.error("Invalid layer index")}remove(e,t,n=t){let s=this.get(e);s=s.map(o=>({glyphID:o.glyph.index,paletteIndex:o.paletteIndex})),s.splice(t,n-t+1),this.updateColrTable(e,s)}updateColrTable(e,t){this.ensureCOLR();let s=this.font.tables.colr,o=Ic(s.baseGlyphRecords,"glyphID",e);if(o===-1){let u={glyphID:e,firstLayerIndex:s.layerRecords.length,numLayers:0};o=Fc(s.baseGlyphRecords,"glyphID",u)}let a=s.baseGlyphRecords[o],l=a.numLayers,c=t.length,f=c-l;if(f>0){let u=t.slice(l).map(m=>({glyphID:m.glyphID,paletteIndex:m.paletteIndex}));s.layerRecords.splice(a.firstLayerIndex+l,0,...u)}else f<0&&s.layerRecords.splice(a.firstLayerIndex+c,-f);for(let u=0;u<Math.min(l,c);u++)s.layerRecords[a.firstLayerIndex+u]={glyphID:t[u].glyphID,paletteIndex:t[u].paletteIndex};if(a.numLayers=c,f!==0)for(let u=0;u<s.baseGlyphRecords.length;u++){let m=s.baseGlyphRecords[u];u===o||m.firstLayerIndex<a.firstLayerIndex||(s.baseGlyphRecords[u].firstLayerIndex+=f)}}},Bc=class{constructor(e){this.font=e,this.cache=new WeakMap}get(e){let t=this.getOrCreateSvgImageCacheEntry(e);return t&&t.image}getAsync(e){let t=this.getOrCreateSvgImageCacheEntry(e);return t&&t.promise}getOrCreateSvgImageCacheEntry(e){let t=this.font.tables.svg;if(t===void 0)return;let n=t.get(e);if(n===void 0)return;let s=this.cache.get(n);s===void 0&&(s=Nc(n),this.cache.set(n,s));let o=s.images.get(e);return o===void 0&&(o=_c(this.font,s.template,e),o.promise.then(r=>{if(o.image=r,typeof this.font.onGlyphUpdated=="function")try{this.font.onGlyphUpdated(e)}catch(a){console.error("font.onGlyphUpdated",e,a)}}),s.images.set(e,o)),o}};function Nc(e){return{template:Gc(e).then(jc),images:new Map}}function _c(e,t,n){return{promise:t.then(s=>{let o;typeof s=="string"?o=s:(s[4]=n,o=s.join(""));let r=$c(o,e.unitsPerEm);return r.image.decode().then(()=>r)}),image:void 0}}var Gc=typeof DecompressionStream=="function"?Vc:Hc;function Hc(e){try{return Promise.resolve(new TextDecoder().decode(Tr(e)?Dc(e):e))}catch(t){return Promise.reject(t)}}function Vc(e){if(Tr(e))return new Response(new Response(e).body.pipeThrough(new DecompressionStream("gzip"))).text();try{return Promise.resolve(new TextDecoder().decode(e))}catch(t){return Promise.reject(t)}}function jc(e){let t=e.indexOf("<svg"),n=e.indexOf(">",t+4)+1;if(/ id=['"]glyph\d+['"]/.test(e.substring(t,n)))return e;let s=e.lastIndexOf("</svg>");return[e.substring(0,n),"<defs>",e.substring(n,s),'</defs><use href="#glyph',"",'"/>',e.substring(s)]}function $c(e,t){let s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement,o=s.viewBox.baseVal,r=s.width.baseVal,a=s.height.baseVal,l=1,c=1;o.width>0&&o.height>0&&(r.unitType===1?(l=r.valueInSpecifiedUnits/o.width,c=a.unitType===1?a.valueInSpecifiedUnits/o.height:l):a.unitType===1?(c=a.valueInSpecifiedUnits/o.height,l=c):t&&(l=t/o.width,c=t/o.height));let f=document.createElement("div");f.style.position="fixed",f.style.visibility="hidden",f.appendChild(s),document.body.appendChild(f);let u=s.getBBox();document.body.removeChild(f);let m=(u.x-o.x)*l,g=(o.y-u.y)*c,S=u.width*l,v=u.height*c;s.setAttribute("viewBox",[u.x,u.y,u.width,u.height].join(" ")),l!==1&&s.setAttribute("width",S),c!==1&&s.setAttribute("height",v);let k=new Image(S,v);return k.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(s.outerHTML),{leftSideBearing:m,baseline:g,image:k}}var ks=new WeakMap;function Or(e,t,n,s,o){let r;return(t&s)>0?(r=e.parseByte(),(t&o)===0&&(r=-r),r=n+r):(t&o)>0?r=n:r=n+e.parseShort(),r}function Lr(e,t,n){let s=new N.Parser(t,n);e._numberOfContours=s.parseShort(),e._xMin=s.parseShort(),e._yMin=s.parseShort(),e._xMax=s.parseShort(),e._yMax=s.parseShort();let o,r;if(e._numberOfContours>0){let a=e.endPointIndices=[];for(let c=0;c<e._numberOfContours;c+=1)a.push(s.parseUShort());e.instructionLength=s.parseUShort(),e.instructions=[];for(let c=0;c<e.instructionLength;c+=1)e.instructions.push(s.parseByte());let l=a[a.length-1]+1;o=[];for(let c=0;c<l;c+=1)if(r=s.parseByte(),o.push(r),(r&8)>0){let f=s.parseByte();for(let u=0;u<f;u+=1)o.push(r),c+=1}if($.argument(o.length===l,"Bad flags."),a.length>0){let c=[],f;if(l>0){for(let g=0;g<l;g+=1)r=o[g],f={},f.onCurve=!!(r&1),f.lastPointOfContour=a.indexOf(g)>=0,c.push(f);let u=0;for(let g=0;g<l;g+=1)r=o[g],f=c[g],f.x=Or(s,r,u,2,16),u=f.x;let m=0;for(let g=0;g<l;g+=1)r=o[g],f=c[g],f.y=Or(s,r,m,4,32),m=f.y}e.points=c}else e.points=[]}else if(e._numberOfContours===0)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];let a=!0;for(;a;){o=s.parseUShort();let l={glyphIndex:s.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(o&1)>0?(o&2)>0?(l.dx=s.parseShort(),l.dy=s.parseShort()):l.matchedPoints=[s.parseUShort(),s.parseUShort()]:(o&2)>0?(l.dx=s.parseChar(),l.dy=s.parseChar()):l.matchedPoints=[s.parseByte(),s.parseByte()],(o&8)>0?l.xScale=l.yScale=s.parseF2Dot14():(o&64)>0?(l.xScale=s.parseF2Dot14(),l.yScale=s.parseF2Dot14()):(o&128)>0&&(l.xScale=s.parseF2Dot14(),l.scale01=s.parseF2Dot14(),l.scale10=s.parseF2Dot14(),l.yScale=s.parseF2Dot14()),e.components.push(l),a=!!(o&32)}if(o&256){e.instructionLength=s.parseUShort(),e.instructions=[];for(let l=0;l<e.instructionLength;l+=1)e.instructions.push(s.parseByte())}}}function En(e,t){let n=[];for(let s=0;s<e.length;s+=1){let o=e[s],r={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(r)}return n}function Wc(e){let t=[],n=[];for(let s=0;s<e.length;s+=1){let o=e[s];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return $.argument(n.length===0,"There are still points left in the current contour."),t}function Ts(e){let t=new xt;if(!e)return t;let n=Wc(e);for(let s=0;s<n.length;++s){let o=n[s],r=o[o.length-1],a=o[0];if(r.onCurve)t.moveTo(r.x,r.y);else if(a.onCurve)t.moveTo(a.x,a.y);else{let l={x:(r.x+a.x)*.5,y:(r.y+a.y)*.5};t.moveTo(l.x,l.y)}for(let l=0;l<o.length;++l)if(r=a,a=o[(l+1)%o.length],r.onCurve)t.lineTo(r.x,r.y);else{let c=a;a.onCurve||(c={x:(r.x+a.x)*.5,y:(r.y+a.y)*.5}),t.quadraticCurveTo(r.x,r.y,c.x,c.y)}t.closePath()}return t}function Er(e,t){if(t.isComposite){ks.has(e)||ks.set(e,new Set);let n=ks.get(e);n.add(t.index);try{for(let s=0;s<t.components.length;s+=1){let o=t.components[s];if(n.has(o.glyphIndex))continue;let r=e.get(o.glyphIndex);if(r.getPath(),r.points){let a;if(o.matchedPoints===void 0)a=En(r.points,o);else{if(o.matchedPoints[0]>t.points.length-1||o.matchedPoints[1]>r.points.length-1)throw Error("Matched points out of range in "+t.name);let l=t.points[o.matchedPoints[0]],c=r.points[o.matchedPoints[1]],f={xScale:o.xScale,scale01:o.scale01,scale10:o.scale10,yScale:o.yScale,dx:0,dy:0};c=En([c],f)[0],f.dx=l.x-c.x,f.dy=l.y-c.y,a=En(r.points,f)}t.points=t.points.concat(a)}}}finally{n.delete(t.index)}}return Ts(t.points)}function zc(e,t,n,s){let o=new Je.GlyphSet(s);for(let r=0;r<n.length-1;r+=1){let a=n[r],l=n[r+1];a!==l?o.push(r,Je.ttfGlyphLoader(s,r,Lr,e,t+a,Er)):o.push(r,Je.glyphLoader(s,r))}return o}function Xc(e,t,n,s){let o=new Je.GlyphSet(s);return s._push=function(r){let a=n[r],l=n[r+1];a!==l?o.push(r,Je.ttfGlyphLoader(s,r,Lr,e,t+a,Er)):o.push(r,Je.glyphLoader(s,r))},o}function Yc(e,t,n,s,o){return o.lowMemory?Xc(e,t,n,s):zc(e,t,n,s)}var Rr={getPath:Ts,parse:Yc},qc=class{constructor(e){this.font=e}normalizeCoordTags(e){for(let t in e)if(t.length<4){let n=t.padEnd(4," ");e[n]===void 0&&(e[n]=e[t]),delete e[t]}}getNormalizedCoords(e){e||(e=this.font.variation.get());let t=[];this.normalizeCoordTags(e);for(let n=0;n<this.fvar().axes.length;n++){let s=this.fvar().axes[n],o=e[s.tag];o===void 0&&(o=s.defaultValue),o<s.defaultValue?t.push((o-s.defaultValue+Number.EPSILON)/(s.defaultValue-s.minValue+Number.EPSILON)):t.push((o-s.defaultValue+Number.EPSILON)/(s.maxValue-s.defaultValue+Number.EPSILON))}if(this.avar())for(let n=0;n<this.avar().axisSegmentMaps.length;n++){let s=this.avar().axisSegmentMaps[n];for(let o=0;o<s.axisValueMaps.length;o++){let r=s.axisValueMaps[o];if(o>=1&&t[n]<r.fromCoordinate){let a=s.axisValueMaps[o-1];t[n]=((t[n]-a.fromCoordinate)*(r.toCoordinate-a.toCoordinate)+Number.EPSILON)/(r.fromCoordinate-a.fromCoordinate+Number.EPSILON)+a.toCoordinate;break}}}return t}interpolatePoints(e,t,n){if(e.length===0)return;let s=0;for(;s<e.length;){let o=s,r=s,a=e[r];for(;!a.lastPointOfContour;)a=e[++r];for(;s<=r&&!n[s];)s++;if(s>r)continue;let l=s,c=s;for(s++;s<=r;)n[s]&&(this.deltaInterpolate(c+1,s-1,c,s,t,e),c=s),s++;c===l?this.deltaShift(o,r,c,t,e):(this.deltaInterpolate(c+1,r,c,l,t,e),l>0&&this.deltaInterpolate(o,l-1,c,l,t,e)),s=r+1}}deltaInterpolate(e,t,n,s,o,r){if(e>t)return;let a=["x","y"];for(let c=0;c<a.length;c++){let f=a[c];if(o[n][f]>o[s][f]){var l=n;n=s,s=l}let u=o[n][f],m=o[s][f],g=r[n][f],S=r[s][f];if(u!==m||g===S){let v=u===m?0:(S-g)/(m-u);for(let k=e;k<=t;k++){let O=o[k][f];O<=u?O+=g-u:O>=m?O+=S-m:O=g+(O-u)*v,r[k][f]=O}}}}deltaShift(e,t,n,s,o){let r=o[n].x-s[n].x,a=o[n].y-s[n].y;if(!(r===0&&a===0))for(let l=e;l<=t;l++)l!==n&&(o[l].x+=r,o[l].y+=a)}transformComponents(e,t,n,s,o,r){let a=0;for(let l=0;l<e.components.length;l++){let c=e.components[l],f=this.font.glyphs.get(c.glyphIndex),u=Uc(c),m=s.indexOf(l);m>-1&&(u.dx+=Math.round(o.deltas[m]*r),u.dy+=Math.round(o.deltasY[m]*r));let g=En(this.getTransform(f,n).points,u);t.splice(a,g.length,...g),a+=f.points.length}}applyTupleVariationStore(e,t,n,s="gvar",o={}){n||(n=this.font.variation.get());let r=this.getNormalizedCoords(n),{headers:a,sharedPoints:l}=e,c=this.fvar().axes.length,f;s==="gvar"?f=t.map(wr):s==="cvar"&&(f=[...t]);for(let u=0;u<a.length;u++){let m=a[u],g=1;for(let v=0;v<c;v++){let k=[0];switch(s){case"gvar":k=m.peakTuple?m.peakTuple:this.gvar().sharedTuples[m.sharedTupleRecordsIndex];break;case"cvar":k=m.peakTuple;break}if(k[v]!==0){if(r[v]===0){g=0;break}if(m.intermediateStartTuple)if(r[v]<m.intermediateStartTuple[v]||r[v]>m.intermediateEndTuple[v]){g=0;break}else r[v]<k[v]?g=g*(r[v]-m.intermediateStartTuple[v]+Number.EPSILON)/(k[v]-m.intermediateStartTuple[v]+Number.EPSILON):g=g*(m.intermediateEndTuple[v]-r[v]+Number.EPSILON)/(m.intermediateEndTuple[v]-k[v]+Number.EPSILON);else{if(r[v]<Math.min(0,k[v])||r[v]>Math.max(0,k[v])){g=0;break}g=(g*r[v]+Number.EPSILON)/(k[v]+Number.EPSILON)}}}if(g===0)continue;let S=m.privatePoints.length?m.privatePoints:l;if(s==="gvar"&&o.glyph&&o.glyph.isComposite)this.transformComponents(o.glyph,f,n,S,m,g);else if(S.length===0)for(let v=0;v<f.length;v++){let k=f[v];s==="gvar"?f[v]={x:Math.round(k.x+m.deltas[v]*g),y:Math.round(k.y+m.deltasY[v]*g),onCurve:k.onCurve,lastPointOfContour:k.lastPointOfContour}:s==="cvar"&&(f[v]=Math.round(k+m.deltas[v]*g))}else{let v;s==="gvar"?v=f.map(wr):s==="cvar"&&(v=f);let k=Array(t.length).fill(!1);for(let O=0;O<S.length;O++){let W=S[O];if(W<t.length){let V=v[W];s==="gvar"?(k[W]=!0,V.x+=m.deltas[O]*g,V.y+=m.deltasY[O]*g):s==="cvar"&&(f[W]=Math.round(V+m.deltas[O]*g))}}if(s==="gvar"){this.interpolatePoints(v,f,k);for(let O=0;O<t.length;O++){let W=v[O].x-f[O].x,V=v[O].y-f[O].y;f[O].x=Math.round(f[O].x+W),f[O].y=Math.round(f[O].y+V)}}}}return f}getTransform(e,t){Number.isInteger(e)&&(e=this.font.glyphs.get(e));let n=e.getBlendPath,s=!!(e.points&&e.points.length),o=e;if(n||s){if(t||(t=this.font.variation.get()),s){let r=this.gvar()&&this.gvar().glyphVariations[e.index];if(r){let a=e.points,l=this.applyTupleVariationStore(r,a,t,"gvar",{glyph:e});o=new Ut(Object.assign({},e,{points:l,path:Ts(l)}))}}else if(n){let r=e.getBlendPath(t);o=new Ut(Object.assign({},e,{path:r}))}}return this.font.tables.hvar&&(e._advanceWidth=typeof e._advanceWidth<"u"?e._advanceWidth:e.advanceWidth,e.advanceWidth=o.advanceWidth=Math.round(e._advanceWidth+this.getVariableAdjustment(o.index,"hvar","advanceWidth",t)),e._leftSideBearing=typeof e._leftSideBearing<"u"?e._leftSideBearing:e.leftSideBearing,e.leftSideBearing=o.leftSideBearing=Math.round(e._leftSideBearing+this.getVariableAdjustment(o.index,"hvar","lsb",t))),o}getCvarTransform(e){let t=this.font.tables.cvt,n=this.cvar();return!t||!t.length||!n||!n.headers.length?t:this.applyTupleVariationStore(n,t,e,"cvar")}getVariableAdjustment(e,t,n,s){s=s||this.font.variation.get();let o,r,a=this.font.tables[t];if(!a)throw Error(`trying to get variation adjustment from non-existent table "${a}"`);if(!a.itemVariationStore)throw Error(`trying to get variation adjustment from table "${a}" which does not have an itemVariationStore`);let l=a[n]&&a[n].map.length;if(l){let c=e;c>=l&&(c=l-1),{outerIndex:o,innerIndex:r}=a[n].map[c]}else o=0,r=e;return this.getDelta(a.itemVariationStore,o,r,s)}getDelta(e,t,n,s){if(t>=e.itemVariationSubtables.length)return 0;let o=e.itemVariationSubtables[t];if(n>=o.deltaSets.length)return 0;let r=o.deltaSets[n],a=this.getBlendVector(e,t,s),l=0;for(let c=0;c<o.regionIndexes.length;c++)l+=r[c]*a[c];return l}getBlendVector(e,t,n){n||(n=this.font.variation.get());let s=e.itemVariationSubtables[t],o=this.getNormalizedCoords(n),r=[];for(let a=0;a<s.regionIndexes.length;a++){let l=1,c=s.regionIndexes[a],f=e.variationRegions[c].regionAxes;for(let u=0;u<f.length;u++){let m=f[u],g;m.startCoord>m.peakCoord||m.peakCoord>m.endCoord||m.startCoord<0&&m.endCoord>0&&m.peakCoord!==0||m.peakCoord===0?g=1:o[u]<m.startCoord||o[u]>m.endCoord?g=0:o[u]===m.peakCoord?g=1:o[u]<m.peakCoord?g=(o[u]-m.startCoord+Number.EPSILON)/(m.peakCoord-m.startCoord+Number.EPSILON):g=(m.endCoord-o[u]+Number.EPSILON)/(m.endCoord-m.peakCoord+Number.EPSILON),l*=g}r[a]=l}return r}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Zc=class{constructor(e){this.font=e,this.process=new qc(this.font),this.activateDefaultVariation(),this.getTransform=this.process.getTransform.bind(this.process)}activateDefaultVariation(){let e=this.getDefaultInstanceIndex();e>-1?this.set(e):this.set(this.getDefaultCoordinates())}getDefaultCoordinates(){return this.fvar().axes.reduce((e,t)=>(e[t.tag]=t.defaultValue,e),{})}getDefaultInstanceIndex(){let e=this.getDefaultCoordinates(),t=this.getInstanceIndex(e);return t<0&&(t=this.fvar().instances.findIndex(n=>n.name&&n.name.en==="Regular")),t}getInstanceIndex(e){return this.fvar().instances.findIndex(t=>Object.keys(e).every(n=>t.coordinates[n]===e[n]))}getInstance(e){return this.fvar().instances&&this.fvar().instances[e]}set(e){let t;if(Number.isInteger(e)){let n=this.getInstance(e);if(!n)throw Error(`Invalid instance index ${e}`);t={...n.coordinates}}else t=e,this.process.normalizeCoordTags(t);t=Object.assign({},this.font.defaultRenderOptions.variation,t),this.font.defaultRenderOptions=Object.assign({},this.font.defaultRenderOptions,{variation:t})}get(){return Object.assign({},this.font.defaultRenderOptions.variation)}avar(){return this.font.tables.avar}cvar(){return this.font.tables.cvar}fvar(){return this.font.tables.fvar}gvar(){return this.font.tables.gvar}hvar(){return this.font.tables.hvar}},Ar=1e6,Rn=64,An=1e4,Ir,Tt,Fr,ws;function Dr(e){this.font=e,this.getCommands=function(t){return Rr.getPath(t).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function Kc(e){return e}function Ur(e){return Math.sign(e)*Math.round(Math.abs(e))}function Qc(e){return Math.sign(e)*Math.round(Math.abs(e*2))/2}function Jc(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function eu(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function tu(e){return Math.sign(e)*Math.floor(Math.abs(e))}var Mr=function(e){let t=this.srPeriod,n=this.srPhase,s=this.srThreshold,o=1;return e<0&&(e=-e,o=-1),e+=s-n,e=Math.trunc(e/t)*t,e+=n,e<0?n*o:e*o},tt={x:1,y:0,axis:"x",distance:function(e,t,n,s){return(n?e.xo:e.x)-(s?t.xo:t.x)},interpolate:function(e,t,n,s){let o,r,a,l,c,f,u;if(!s||s===this){if(o=e.xo-t.xo,r=e.xo-n.xo,c=t.x-t.xo,f=n.x-n.xo,a=Math.abs(o),l=Math.abs(r),u=a+l,u===0){e.x=e.xo+(c+f)/2;return}e.x=e.xo+(c*l+f*a)/u;return}if(o=s.distance(e,t,!0,!0),r=s.distance(e,n,!0,!0),c=s.distance(t,t,!1,!0),f=s.distance(n,n,!1,!0),a=Math.abs(o),l=Math.abs(r),u=a+l,u===0){tt.setRelative(e,e,(c+f)/2,s,!0);return}tt.setRelative(e,e,(c*l+f*a)/u,s,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,n,s,o){if(!s||s===this){e.x=(o?t.xo:t.x)+n;return}let r=o?t.xo:t.x,a=o?t.yo:t.y,l=r+n*s.x,c=a+n*s.y;e.x=l+(e.y-c)/s.normalSlope},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},ot={x:0,y:1,axis:"y",distance:function(e,t,n,s){return(n?e.yo:e.y)-(s?t.yo:t.y)},interpolate:function(e,t,n,s){let o,r,a,l,c,f,u;if(!s||s===this){if(o=e.yo-t.yo,r=e.yo-n.yo,c=t.y-t.yo,f=n.y-n.yo,a=Math.abs(o),l=Math.abs(r),u=a+l,u===0){e.y=e.yo+(c+f)/2;return}e.y=e.yo+(c*l+f*a)/u;return}if(o=s.distance(e,t,!0,!0),r=s.distance(e,n,!0,!0),c=s.distance(t,t,!1,!0),f=s.distance(n,n,!1,!0),a=Math.abs(o),l=Math.abs(r),u=a+l,u===0){ot.setRelative(e,e,(c+f)/2,s,!0);return}ot.setRelative(e,e,(c*l+f*a)/u,s,!0)},normalSlope:0,setRelative:function(e,t,n,s,o){if(!s||s===this){e.y=(o?t.yo:t.y)+n;return}let r=o?t.xo:t.x,a=o?t.yo:t.y,l=r+n*s.x,c=a+n*s.y;e.y=c+s.normalSlope*(e.x-l)},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};Object.freeze(tt),Object.freeze(ot);function Zt(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}Zt.prototype.distance=function(e,t,n,s){return this.x*tt.distance(e,t,n,s)+this.y*ot.distance(e,t,n,s)},Zt.prototype.interpolate=function(e,t,n,s){let o,r,a,l,c,f,u;if(a=s.distance(e,t,!0,!0),l=s.distance(e,n,!0,!0),o=s.distance(t,t,!1,!0),r=s.distance(n,n,!1,!0),c=Math.abs(a),f=Math.abs(l),u=c+f,u===0){this.setRelative(e,e,(o+r)/2,s,!0);return}this.setRelative(e,e,(o*f+r*c)/u,s,!0)},Zt.prototype.setRelative=function(e,t,n,s,o){s=s||this;let r=o?t.xo:t.x,a=o?t.yo:t.y,l=r+n*s.x,c=a+n*s.y,f=s.normalSlope,u=this.slope,m=e.x,g=e.y;e.x=(u*m-f*l+c-g)/(u-f),e.y=u*(e.x-m)+g},Zt.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0};function Kt(e,t){let n=Math.sqrt(e*e+t*t);return e/=n,t/=n,e===1&&t===0?tt:e===0&&t===1?ot:new Zt(e,t)}function rt(e,t,n,s){this.x=this.xo=Math.round(e*64)/64,this.y=this.yo=Math.round(t*64)/64,this.lastPointOfContour=n,this.onCurve=s,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}rt.prototype.nextTouched=function(e){let t=this.nextPointOnContour;for(;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},rt.prototype.prevTouched=function(e){let t=this.prevPointOnContour;for(;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var Qt=Object.freeze(new rt(0,0)),nu={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function lt(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=tt,this.round=Ur}}Dr.prototype.exec=function(e,t){if(typeof t!="number")throw new Error("Point size is not a number!");if(this._errorState>2)return;let n=this.font,s=this._prepState;if(!s||s.ppem!==t){let o=this._fpgmState;if(!o){lt.prototype=nu,o=this._fpgmState=new lt("fpgm",n.tables.fpgm),o.funcs=[],o.font=n,o.instructionCount=0,o.callDepth=0;try{Tt(o)}catch(a){console.log("Hinting error in FPGM:"+a),this._errorState=3;return}}lt.prototype=o,s=this._prepState=new lt("prep",n.tables.prep),s.ppem=t,s.instructionCount=0,s.callDepth=0;let r=n.variation&&n.variation.process.getCvarTransform()||n.tables.cvt;if(r){let a=s.cvt=new Array(r.length),l=t/n.unitsPerEm;for(let c=0;c<r.length;c++)a[c]=r[c]*l}else s.cvt=[];try{Tt(s)}catch(a){this._errorState<2&&console.log("Hinting error in PREP:"+a),this._errorState=2}}if(!(this._errorState>1))try{return Fr(e,s)}catch(o){this._errorState<1&&(console.log("Hinting error:"+o),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}},Fr=function(e,t){let n=t.ppem/t.font.unitsPerEm,s=n,o=e.components,r,a,l;if(lt.prototype=t,!o)l=new lt("glyf",e.instructions),l.instructionCount=0,l.callDepth=0,ws(e,l,n,s),a=l.gZone;else{let c=t.font;a=[],r=[];for(let f=0;f<o.length;f++){let u=o[f],m=c.glyphs.get(u.glyphIndex);l=new lt("glyf",m.instructions),l.instructionCount=0,l.callDepth=0,ws(m,l,n,s);let g=Math.round(u.dx*n),S=Math.round(u.dy*s),v=l.gZone,k=l.contours;for(let W=0;W<v.length;W++){let V=v[W];V.xTouched=V.yTouched=!1,V.xo=V.x=V.x+g,V.yo=V.y=V.y+S}let O=a.length;a.push.apply(a,v);for(let W=0;W<k.length;W++)r.push(k[W]+O)}e.instructions&&!l.inhibitGridFit&&(l=new lt("glyf",e.instructions),l.gZone=l.z0=l.z1=l.z2=a,l.contours=r,a.push(new rt(0,0),new rt(Math.round(e.advanceWidth*n),0)),Tt(l),a.length-=2)}return a},ws=function(e,t,n,s){let o=e.points||[],r=o.length,a=t.gZone=t.z0=t.z1=t.z2=[],l=t.contours=[],c;for(let m=0;m<r;m++)c=o[m],a[m]=new rt(c.x*n,c.y*s,c.lastPointOfContour,c.onCurve);let f,u;for(let m=0;m<r;m++)c=a[m],f||(f=c,l.push(m)),c.lastPointOfContour?(c.nextPointOnContour=f,f.prevPointOnContour=c,f=void 0):(u=a[m+1],c.nextPointOnContour=u,u.prevPointOnContour=c);t.inhibitGridFit||(a.push(new rt(0,0),new rt(Math.round(e.advanceWidth*n),0)),Tt(t),a.length-=2)},Tt=function(e){let t=e.prog;if(!t)return;let n=t.length,s;for(e.ip=0;e.ip<n;e.ip++){if(++e.instructionCount>Ar)throw new Error("Hinting instructions exceeded maximum of "+Ar);if(s=Ir[t[e.ip]],!s)throw new Error("unknown instruction: 0x"+Number(t[e.ip]).toString(16));s(e)}};function In(e){let t=e.tZone=new Array(e.gZone.length);for(let n=0;n<t.length;n++)t[n]=new rt(0,0)}function Pr(e,t){let n=e.prog,s=e.ip,o=1,r;do if(r=n[++s],r===88)o++;else if(r===89)o--;else if(r===64)s+=n[s+1]+1;else if(r===65)s+=2*n[s+1]+1;else if(r>=176&&r<=183)s+=r-176+1;else if(r>=184&&r<=191)s+=(r-184+1)*2;else if(t&&o===1&&r===27)break;while(o>0);e.ip=s}function Br(e,t){t.fv=t.pv=t.dpv=e}function Nr(e,t){t.pv=t.dpv=e}function _r(e,t){t.fv=e}function Gr(e,t){let n=t.stack,s=n.pop(),o=n.pop(),r=t.z2[s],a=t.z1[o],l,c;e?(l=r.y-a.y,c=a.x-r.x):(l=a.x-r.x,c=a.y-r.y),t.pv=t.dpv=Kt(l,c)}function Hr(e,t){let n=t.stack,s=n.pop(),o=n.pop(),r=t.z2[s],a=t.z1[o],l,c;e?(l=r.y-a.y,c=a.x-r.x):(l=a.x-r.x,c=a.y-r.y),t.fv=Kt(l,c)}function su(e){let t=e.stack,n=t.pop(),s=t.pop();e.pv=e.dpv=Kt(s,n)}function ou(e){let t=e.stack,n=t.pop(),s=t.pop();e.fv=Kt(s,n)}function ru(e){let t=e.stack,n=e.pv;t.push(n.x*16384),t.push(n.y*16384)}function au(e){let t=e.stack,n=e.fv;t.push(n.x*16384),t.push(n.y*16384)}function iu(e){e.fv=e.pv}function lu(e){let t=e.stack,n=t.pop(),s=t.pop(),o=t.pop(),r=t.pop(),a=t.pop(),l=e.z0,c=e.z1,f=l[n],u=l[s],m=c[o],g=c[r],S=e.z2[a],v=f.x,k=f.y,O=u.x,W=u.y,V=m.x,Y=m.y,J=g.x,ie=g.y,ce=(v-O)*(Y-ie)-(k-W)*(V-J),ue=v*W-k*O,xe=V*ie-Y*J;S.x=(ue*(V-J)-xe*(v-O))/ce,S.y=(ue*(Y-ie)-xe*(k-W))/ce}function cu(e){e.rp0=e.stack.pop()}function uu(e){e.rp1=e.stack.pop()}function fu(e){e.rp2=e.stack.pop()}function pu(e){let t=e.stack.pop();switch(e.zp0=t,t){case 0:e.tZone||In(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function hu(e){let t=e.stack.pop();switch(e.zp1=t,t){case 0:e.tZone||In(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function du(e){let t=e.stack.pop();switch(e.zp2=t,t){case 0:e.tZone||In(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function gu(e){let t=e.stack.pop();switch(e.zp0=e.zp1=e.zp2=t,t){case 0:e.tZone||In(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function mu(e){e.loop=e.stack.pop(),e.loop>An&&(e.loop=An)}function yu(e){e.round=Ur}function bu(e){e.round=Jc}function xu(e){let t=e.stack.pop();e.minDis=t/64}function vu(e){Pr(e,!1)}function Su(e){let t=e.stack.pop();e.ip+=t-1}function ku(e){let t=e.stack.pop();e.cvCutIn=t/64}function Tu(e){let t=e.stack;t.push(t[t.length-1])}function Cs(e){e.stack.pop()}function wu(e){e.stack.length=0}function Cu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(n),t.push(s)}function Ou(e){let t=e.stack;t.push(t.length)}function Lu(e){let t=e.stack,n=t.pop(),s=t.pop();if(s>An&&(s=An),++e.callDepth>Rn)throw new Error("Hinting call depth exceeded maximum of "+Rn);let o=e.ip,r=e.prog;e.prog=e.funcs[n];for(let a=0;a<s;a++)Tt(e);e.ip=o,e.prog=r,e.callDepth--}function Eu(e){let t=e.stack.pop();if(++e.callDepth>Rn)throw new Error("Hinting call depth exceeded maximum of "+Rn);let n=e.ip,s=e.prog;e.prog=e.funcs[t],Tt(e),e.ip=n,e.prog=s,e.callDepth--}function Ru(e){let t=e.stack,n=t.pop();t.push(t[t.length-n])}function Au(e){let t=e.stack,n=t.pop();t.push(t.splice(t.length-n,1)[0])}function Iu(e){if(e.env!=="fpgm")throw new Error("FDEF not allowed here");let t=e.stack,n=e.prog,s=e.ip,o=t.pop(),r=s;for(;n[++s]!==45;);e.ip=s,e.funcs[o]=n.slice(r+1,s)}function Vr(e,t){let n=t.stack.pop(),s=t.z0[n],o=t.fv,r=t.pv,a=r.distance(s,Qt);e&&(a=t.round(a)),o.setRelative(s,Qt,a,r),o.touch(s),t.rp0=t.rp1=n}function jr(e,t){let n=t.z2,s=n.length-2,o,r,a;for(let l=0;l<s;l++)o=n[l],!e.touched(o)&&(r=o.prevTouched(e),r!==o&&(a=o.nextTouched(e),r===a&&e.setRelative(o,o,e.distance(r,r,!1,!0),e,!0),e.interpolate(o,r,a,e)))}function $r(e,t){let n=t.stack,s=e?t.rp1:t.rp2,o=(e?t.z0:t.z1)[s],r=t.fv,a=t.pv,l=t.loop,c=t.z2;for(;l--;){let f=n.pop(),u=c[f],m=a.distance(o,o,!1,!0);r.setRelative(u,u,m,a),r.touch(u)}t.loop=1}function Wr(e,t){let n=t.stack,s=e?t.rp1:t.rp2,o=(e?t.z0:t.z1)[s],r=t.fv,a=t.pv,l=n.pop(),c=t.z2[t.contours[l]],f=c,u=a.distance(o,o,!1,!0);do f!==o&&r.setRelative(f,f,u,a),f=f.nextPointOnContour;while(f!==c)}function zr(e,t){let n=t.stack,s=e?t.rp1:t.rp2,o=(e?t.z0:t.z1)[s],r=t.fv,a=t.pv,l=n.pop(),c;switch(l){case 0:c=t.tZone;break;case 1:c=t.gZone;break;default:throw new Error("Invalid zone")}let f,u=a.distance(o,o,!1,!0),m=c.length-2;for(let g=0;g<m;g++)f=c[g],r.setRelative(f,f,u,a)}function Fu(e){let t=e.stack,n=e.loop,s=e.fv,o=t.pop()/64,r=e.z2;for(;n--;){let a=t.pop(),l=r[a];s.setRelative(l,l,o),s.touch(l)}e.loop=1}function Du(e){let t=e.stack,n=e.rp1,s=e.rp2,o=e.loop,r=e.z0[n],a=e.z1[s],l=e.fv,c=e.dpv,f=e.z2;for(;o--;){let u=t.pop(),m=f[u];l.interpolate(m,r,a,c),l.touch(m)}e.loop=1}function Xr(e,t){let n=t.stack,s=n.pop()/64,o=n.pop(),r=t.z1[o],a=t.z0[t.rp0],l=t.fv,c=t.pv;l.setRelative(r,a,s,c),l.touch(r),t.rp1=t.rp0,t.rp2=o,e&&(t.rp0=o)}function Uu(e){let t=e.stack,n=e.rp0,s=e.z0[n],o=e.loop,r=e.fv,a=e.pv,l=e.z1;for(;o--;){let c=t.pop(),f=l[c];r.setRelative(f,s,0,a),r.touch(f)}e.loop=1}function Mu(e){e.round=Qc}function Yr(e,t){let n=t.stack,s=n.pop(),o=n.pop(),r=t.z0[o],a=t.fv,l=t.pv,c=t.cvt[s],f=l.distance(r,Qt);e&&(Math.abs(f-c)<t.cvCutIn&&(f=c),f=t.round(f)),a.setRelative(r,Qt,f,l),t.zp0===0&&(r.xo=r.x,r.yo=r.y),a.touch(r),t.rp0=t.rp1=o}function Pu(e){let t=e.prog,n=e.ip,s=e.stack,o=t[++n];for(let r=0;r<o;r++)s.push(t[++n]);e.ip=n}function Bu(e){let t=e.ip,n=e.prog,s=e.stack,o=n[++t];for(let r=0;r<o;r++){let a=n[++t]<<8|n[++t];a&32768&&(a=-((a^65535)+1)),s.push(a)}e.ip=t}function Nu(e){let t=e.stack,n=e.store;n||(n=e.store=[]);let s=t.pop(),o=t.pop();n[o]=s}function _u(e){let t=e.stack,n=e.store,s=t.pop(),o=n&&n[s]||0;t.push(o)}function Gu(e){let t=e.stack,n=t.pop(),s=t.pop();e.cvt[s]=n/64}function Hu(e){let t=e.stack,n=t.pop();t.push(e.cvt[n]*64)}function qr(e,t){let n=t.stack,s=n.pop(),o=t.z2[s];n.push(t.dpv.distance(o,Qt,e,!1)*64)}function Zr(e,t){let n=t.stack,s=n.pop(),o=n.pop(),r=t.z1[s],a=t.z0[o],l=t.dpv.distance(a,r,e,e);t.stack.push(Math.round(l*64))}function Vu(e){e.stack.push(e.ppem)}function ju(e){e.autoFlip=!0}function $u(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s<n?1:0)}function Wu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s<=n?1:0)}function zu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s>n?1:0)}function Xu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s>=n?1:0)}function Yu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(n===s?1:0)}function qu(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(n!==s?1:0)}function Zu(e){let t=e.stack,n=t.pop();t.push(Math.trunc(n)&1?1:0)}function Ku(e){let t=e.stack,n=t.pop();t.push(Math.trunc(n)&1?0:1)}function Qu(e){let t=e.stack.pop(),n;t||Pr(e,!0)}function Ju(e){}function ef(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(n&&s?1:0)}function tf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(n||s?1:0)}function nf(e){let t=e.stack,n=t.pop();t.push(n?0:1)}function Os(e,t){let n=t.stack,s=n.pop(),o=t.fv,r=t.pv,a=t.ppem,l=t.deltaBase+(e-1)*16,c=t.deltaShift,f=t.z0;for(let u=0;u<s;u++){let m=n.pop(),g=n.pop();if(l+((g&240)>>4)!==a)continue;let v=(g&15)-8;v>=0&&v++;let k=f[m];o.setRelative(k,k,v*c,r)}}function sf(e){let n=e.stack.pop();e.deltaBase=n}function of(e){let n=e.stack.pop();e.deltaShift=Math.pow(.5,n)}function rf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s+n)}function af(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s-n)}function lf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s*64/n)}function cf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(s*n/64)}function uf(e){let t=e.stack,n=t.pop();t.push(Math.abs(n))}function ff(e){let t=e.stack,n=t.pop();t.push(-n)}function pf(e){let t=e.stack,n=t.pop();t.push(Math.floor(n/64)*64)}function hf(e){let t=e.stack,n=t.pop();t.push(Math.ceil(n/64)*64)}function Fn(e,t){let n=t.stack,s=n.pop();n.push(t.round(s/64)*64)}function df(e){let t=e.stack,n=t.pop(),s=t.pop();e.cvt[s]=n*e.ppem/e.font.unitsPerEm}function Ls(e,t){let n=t.stack,s=n.pop(),o=t.ppem,r=t.deltaBase+(e-1)*16,a=t.deltaShift;for(let l=0;l<s;l++){let c=n.pop(),f=n.pop();if(r+((f&240)>>4)!==o)continue;let m=(f&15)-8;m>=0&&m++;let g=m*a;t.cvt[c]+=g}}function gf(e){let t=e.stack.pop();e.round=Mr;let n;switch(t&192){case 0:n=.5;break;case 64:n=1;break;case 128:n=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=n,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid SROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*n}function mf(e){let t=e.stack.pop();e.round=Mr;let n;switch(t&192){case 0:n=Math.sqrt(2)/2;break;case 64:n=Math.sqrt(2);break;case 128:n=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=n,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid S45ROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*n}function yf(e){e.round=Kc}function bf(e){e.round=eu}function xf(e){e.round=tu}function vf(e){let t=e.stack.pop()}function Kr(e,t){let n=t.stack,s=n.pop(),o=n.pop(),r=t.z2[s],a=t.z1[o],l,c;e?(l=r.y-a.y,c=a.x-r.x):(l=a.x-r.x,c=a.y-r.y),t.dpv=Kt(l,c)}function Sf(e){let t=e.stack,n=t.pop(),s=0;n&1&&(s=35),n&32&&(s|=4096),t.push(s)}function kf(e){let t=e.stack,n=t.pop(),s=t.pop(),o=t.pop();t.push(s),t.push(n),t.push(o)}function Tf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(Math.max(s,n))}function wf(e){let t=e.stack,n=t.pop(),s=t.pop();t.push(Math.min(s,n))}function Cf(e){let t=e.stack.pop()}function Of(e){let t=e.stack.pop(),n=e.stack.pop();switch(t){case 1:e.inhibitGridFit=!!n;return;case 2:e.ignoreCvt=!!n;return;default:throw new Error("invalid INSTCTRL[] selector")}}function ct(e,t){let n=t.stack,s=t.prog,o=t.ip;for(let r=0;r<e;r++)n.push(s[++o]);t.ip=o}function ut(e,t){let n=t.ip,s=t.prog,o=t.stack;for(let r=0;r<e;r++){let a=s[++n]<<8|s[++n];a&32768&&(a=-((a^65535)+1)),o.push(a)}t.ip=n}function j(e,t,n,s,o,r){let a=r.stack,l=e&&a.pop(),c=a.pop(),f=r.rp0,u=r.z0[f],m=r.z1[c],g=r.minDis,S=r.fv,v=r.dpv,k,O,W,V;O=k=v.distance(m,u,!0,!0),W=O>=0?1:-1,O=Math.abs(O),e&&(V=r.cvt[l],s&&Math.abs(O-V)<r.cvCutIn&&(O=V)),n&&O<g&&(O=g),s&&(O=r.round(O)),S.setRelative(m,u,W*O,v),S.touch(m),r.rp1=r.rp0,r.rp2=c,t&&(r.rp0=c)}Ir=[Br.bind(void 0,ot),Br.bind(void 0,tt),Nr.bind(void 0,ot),Nr.bind(void 0,tt),_r.bind(void 0,ot),_r.bind(void 0,tt),Gr.bind(void 0,0),Gr.bind(void 0,1),Hr.bind(void 0,0),Hr.bind(void 0,1),su,ou,ru,au,iu,lu,cu,uu,fu,pu,hu,du,gu,mu,yu,bu,xu,vu,Su,ku,void 0,void 0,Tu,Cs,wu,Cu,Ou,Ru,Au,void 0,void 0,void 0,Lu,Eu,Iu,void 0,Vr.bind(void 0,0),Vr.bind(void 0,1),jr.bind(void 0,ot),jr.bind(void 0,tt),$r.bind(void 0,0),$r.bind(void 0,1),Wr.bind(void 0,0),Wr.bind(void 0,1),zr.bind(void 0,0),zr.bind(void 0,1),Fu,Du,Xr.bind(void 0,0),Xr.bind(void 0,1),Uu,Mu,Yr.bind(void 0,0),Yr.bind(void 0,1),Pu,Bu,Nu,_u,Gu,Hu,qr.bind(void 0,0),qr.bind(void 0,1),void 0,Zr.bind(void 0,0),Zr.bind(void 0,1),Vu,void 0,ju,void 0,void 0,$u,Wu,zu,Xu,Yu,qu,Zu,Ku,Qu,Ju,ef,tf,nf,Os.bind(void 0,1),sf,of,rf,af,lf,cf,uf,ff,pf,hf,Fn.bind(void 0,0),Fn.bind(void 0,1),Fn.bind(void 0,2),Fn.bind(void 0,3),void 0,void 0,void 0,void 0,df,Os.bind(void 0,2),Os.bind(void 0,3),Ls.bind(void 0,1),Ls.bind(void 0,2),Ls.bind(void 0,3),gf,mf,void 0,void 0,yf,void 0,bf,xf,Cs,Cs,void 0,void 0,void 0,void 0,void 0,vf,Kr.bind(void 0,0),Kr.bind(void 0,1),Sf,void 0,kf,Tf,wf,Cf,Of,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ct.bind(void 0,1),ct.bind(void 0,2),ct.bind(void 0,3),ct.bind(void 0,4),ct.bind(void 0,5),ct.bind(void 0,6),ct.bind(void 0,7),ct.bind(void 0,8),ut.bind(void 0,1),ut.bind(void 0,2),ut.bind(void 0,3),ut.bind(void 0,4),ut.bind(void 0,5),ut.bind(void 0,6),ut.bind(void 0,7),ut.bind(void 0,8),j.bind(void 0,0,0,0,0,0),j.bind(void 0,0,0,0,0,1),j.bind(void 0,0,0,0,0,2),j.bind(void 0,0,0,0,0,3),j.bind(void 0,0,0,0,1,0),j.bind(void 0,0,0,0,1,1),j.bind(void 0,0,0,0,1,2),j.bind(void 0,0,0,0,1,3),j.bind(void 0,0,0,1,0,0),j.bind(void 0,0,0,1,0,1),j.bind(void 0,0,0,1,0,2),j.bind(void 0,0,0,1,0,3),j.bind(void 0,0,0,1,1,0),j.bind(void 0,0,0,1,1,1),j.bind(void 0,0,0,1,1,2),j.bind(void 0,0,0,1,1,3),j.bind(void 0,0,1,0,0,0),j.bind(void 0,0,1,0,0,1),j.bind(void 0,0,1,0,0,2),j.bind(void 0,0,1,0,0,3),j.bind(void 0,0,1,0,1,0),j.bind(void 0,0,1,0,1,1),j.bind(void 0,0,1,0,1,2),j.bind(void 0,0,1,0,1,3),j.bind(void 0,0,1,1,0,0),j.bind(void 0,0,1,1,0,1),j.bind(void 0,0,1,1,0,2),j.bind(void 0,0,1,1,0,3),j.bind(void 0,0,1,1,1,0),j.bind(void 0,0,1,1,1,1),j.bind(void 0,0,1,1,1,2),j.bind(void 0,0,1,1,1,3),j.bind(void 0,1,0,0,0,0),j.bind(void 0,1,0,0,0,1),j.bind(void 0,1,0,0,0,2),j.bind(void 0,1,0,0,0,3),j.bind(void 0,1,0,0,1,0),j.bind(void 0,1,0,0,1,1),j.bind(void 0,1,0,0,1,2),j.bind(void 0,1,0,0,1,3),j.bind(void 0,1,0,1,0,0),j.bind(void 0,1,0,1,0,1),j.bind(void 0,1,0,1,0,2),j.bind(void 0,1,0,1,0,3),j.bind(void 0,1,0,1,1,0),j.bind(void 0,1,0,1,1,1),j.bind(void 0,1,0,1,1,2),j.bind(void 0,1,0,1,1,3),j.bind(void 0,1,1,0,0,0),j.bind(void 0,1,1,0,0,1),j.bind(void 0,1,1,0,0,2),j.bind(void 0,1,1,0,0,3),j.bind(void 0,1,1,0,1,0),j.bind(void 0,1,1,0,1,1),j.bind(void 0,1,1,0,1,2),j.bind(void 0,1,1,0,1,3),j.bind(void 0,1,1,1,0,0),j.bind(void 0,1,1,1,0,1),j.bind(void 0,1,1,1,0,2),j.bind(void 0,1,1,1,0,3),j.bind(void 0,1,1,1,1,0),j.bind(void 0,1,1,1,1,1),j.bind(void 0,1,1,1,1,2),j.bind(void 0,1,1,1,1,3)];var Lf=Dr;function Bt(e){this.char=e,this.state={},this.activeState=null}function Es(e,t,n){this.contextName=n,this.startIndex=e,this.endOffset=t}function Ef(e,t,n){this.contextName=e,this.openRange=null,this.ranges=[],this.checkStart=t,this.checkEnd=n}function Re(e,t){this.context=e,this.index=t,this.length=e.length,this.current=e[t],this.backtrack=e.slice(0,t),this.lookahead=e.slice(t+1)}function Dn(e){this.eventId=e,this.subscribers=[]}function Rf(e){let t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];for(let s=0;s<t.length;s++){let o=t[s];Object.defineProperty(this.events,o,{value:new Dn(o)})}if(e)for(let s=0;s<t.length;s++){let o=t[s],r=e[o];typeof r=="function"&&this.events[o].subscribe(r)}let n=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];for(let s=0;s<n.length;s++){let o=n[s];this.events[o].subscribe(this.updateContextsRanges)}}function me(e){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Rf.call(this,e)}Bt.prototype.setState=function(e,t){return this.state[e]=t,this.activeState={key:e,value:this.state[e]},this.activeState},Bt.prototype.getState=function(e){return this.state[e]||null},me.prototype.inboundIndex=function(e){return e>=0&&e<this.tokens.length},me.prototype.composeRUD=function(e){let n=e.map(o=>this[o[0]].apply(this,o.slice(1).concat(!0))),s=o=>typeof o=="object"&&Object.prototype.hasOwnProperty.call(o,"FAIL");if(n.every(s))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:n.filter(s)};this.dispatch("composeRUD",[n.filter(o=>!s(o))])},me.prototype.replaceRange=function(e,t,n,s){t=t!==null?t:this.tokens.length;let o=n.every(r=>r instanceof Bt);if(!isNaN(e)&&this.inboundIndex(e)&&o){let r=this.tokens.splice.apply(this.tokens,[e,t].concat(n));return s||this.dispatch("replaceToken",[e,t,n]),[r,n]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},me.prototype.replaceToken=function(e,t,n){if(!isNaN(e)&&this.inboundIndex(e)&&t instanceof Bt){let s=this.tokens.splice(e,1,t);return n||this.dispatch("replaceToken",[e,t]),[s[0],t]}else return{FAIL:"replaceToken: invalid token or index."}},me.prototype.removeRange=function(e,t,n){t=isNaN(t)?this.tokens.length:t;let s=this.tokens.splice(e,t);return n||this.dispatch("removeRange",[s,e,t]),s},me.prototype.removeToken=function(e,t){if(!isNaN(e)&&this.inboundIndex(e)){let n=this.tokens.splice(e,1);return t||this.dispatch("removeToken",[n,e]),n}else return{FAIL:"removeToken: invalid token index."}},me.prototype.insertToken=function(e,t,n){return e.every(o=>o instanceof Bt)?(this.tokens.splice.apply(this.tokens,[t,0].concat(e)),n||this.dispatch("insertToken",[e,t]),e):{FAIL:"insertToken: invalid token(s)."}},me.prototype.registerModifier=function(e,t,n){this.events.newToken.subscribe(function(s,o){let r=[s,o],a=t===null||t.apply(this,r)===!0,l=[s,o];if(a){let c=n.apply(this,l);s.setState(e,c)}}),this.registeredModifiers.push(e)},Dn.prototype.subscribe=function(e){return typeof e=="function"?this.subscribers.push(e)-1:{FAIL:`invalid '${this.eventId}' event handler`}},Dn.prototype.unsubscribe=function(e){this.subscribers.splice(e,1)},Re.prototype.setCurrentIndex=function(e){this.index=e,this.current=this.context[e],this.backtrack=this.context.slice(0,e),this.lookahead=this.context.slice(e+1)},Re.prototype.get=function(e){switch(!0){case e===0:return this.current;case(e<0&&Math.abs(e)<=this.backtrack.length):return this.backtrack.slice(e)[0];case(e>0&&e<=this.lookahead.length):return this.lookahead[e-1];default:return null}},me.prototype.rangeToText=function(e){if(e instanceof Es)return this.getRangeTokens(e).map(t=>t.char).join("")},me.prototype.getText=function(){return this.tokens.map(e=>e.char).join("")},me.prototype.getContext=function(e){let t=this.registeredContexts[e];return t||null},me.prototype.on=function(e,t){let n=this.events[e];return n?n.subscribe(t):null},me.prototype.dispatch=function(e,t){let n=this.events[e];if(n instanceof Dn)for(let s=0;s<n.subscribers.length;s++)n.subscribers[s].apply(this,t||[])},me.prototype.registerContextChecker=function(e,t,n){if(this.getContext(e))return{FAIL:`context name '${e}' is already registered.`};if(typeof t!="function")return{FAIL:"missing context start check."};if(typeof n!="function")return{FAIL:"missing context end check."};let s=new Ef(e,t,n);return this.registeredContexts[e]=s,this.contextCheckers.push(s),s},me.prototype.getRangeTokens=function(e){let t=e.startIndex+e.endOffset;return[].concat(this.tokens.slice(e.startIndex,t))},me.prototype.getContextRanges=function(e){let t=this.getContext(e);return t?t.ranges:{FAIL:`context checker '${e}' is not registered.`}},me.prototype.resetContextsRanges=function(){let e=this.registeredContexts;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=e[t];n.ranges=[]}},me.prototype.updateContextsRanges=function(){this.resetContextsRanges();let e=this.tokens.map(t=>t.char);for(let t=0;t<e.length;t++){let n=new Re(e,t);this.runContextCheck(n)}this.dispatch("updateContextsRanges",[this.registeredContexts])},me.prototype.setEndOffset=function(e,t){let n=this.getContext(t).openRange.startIndex,s=new Es(n,e,t),o=this.getContext(t).ranges;return s.rangeId=`${t}.${o.length}`,o.push(s),this.getContext(t).openRange=null,s},me.prototype.runContextCheck=function(e){let t=e.index;for(let n=0;n<this.contextCheckers.length;n++){let s=this.contextCheckers[n],o=s.contextName,r=this.getContext(o).openRange;if(!r&&s.checkStart(e)&&(r=new Es(t,null,o),this.getContext(o).openRange=r,this.dispatch("contextStart",[o,t])),r&&s.checkEnd(e)){let a=t-r.startIndex+1,l=this.setEndOffset(a,o);this.dispatch("contextEnd",[o,l])}}},me.prototype.tokenize=function(e){this.tokens=[],this.resetContextsRanges();let t=Array.from(e);this.dispatch("start");for(let n=0;n<t.length;n++){let s=t[n],o=new Re(t,n);this.dispatch("next",[o]),this.runContextCheck(o);let r=new Bt(s);this.tokens.push(r),this.dispatch("newToken",[r,o])}return this.dispatch("end",[this.tokens]),this.tokens};var Af=me;function ft(e){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(e)}function Qr(e){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(e)}function pt(e){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(e)}function Un(e){return/[\u0E00-\u0E7F]/.test(e)}function Mn(e){return/[A-z]/.test(e)}function If(e){return/\s/.test(e)}function Be(e){this.font=e,this.features={}}function ht(e){this.id=e.id,this.tag=e.tag,this.substitution=e.substitution}function dt(e,t){if(!e)return-1;switch(t.format){case 1:return t.glyphs.indexOf(e);case 2:{let n=t.ranges;for(let s=0;s<n.length;s++){let o=n[s];if(e>=o.start&&e<=o.end){let r=e-o.start;return o.index+r}}break}default:return-1}return-1}function Ff(e,t){return dt(e,t.coverage)===-1?null:e+t.deltaGlyphId}function Df(e,t){let n=dt(e,t.coverage);return n===-1?null:t.substitute[n]}function Rs(e,t){let n=[];for(let s=0;s<e.length;s++){let o=e[s],r=t.current;r=Array.isArray(r)?r[0]:r;let a=dt(r,o);a!==-1&&n.push(a)}return n.length!==e.length?-1:n}function Uf(e,t){let n=t.inputCoverage.length+t.lookaheadCoverage.length+t.backtrackCoverage.length;if(e.context.length<n)return[];let s=Rs(t.inputCoverage,e);if(s===-1)return[];let o=t.inputCoverage.length-1;if(e.lookahead.length<t.lookaheadCoverage.length)return[];let r=e.lookahead.slice(o);for(;r.length&&pt(r[0].char);)r.shift();let a=new Re(r,0),l=Rs(t.lookaheadCoverage,a),c=[].concat(e.backtrack);for(c.reverse();c.length&&pt(c[0].char);)c.shift();if(c.length<t.backtrackCoverage.length)return[];let f=new Re(c,0),u=Rs(t.backtrackCoverage,f),m=s.length===t.inputCoverage.length&&l.length===t.lookaheadCoverage.length&&u.length===t.backtrackCoverage.length,g=[];if(m)for(let S=0;S<t.lookupRecords.length;S++){let v=t.lookupRecords[S],k=v.lookupListIndex,O=this.getLookupByIndex(k);for(let W=0;W<O.subtables.length;W++){let V=O.subtables[W],Y,J=this.getSubstitutionType(O,V);if(J==="71"?(J=this.getSubstitutionType(V,V.extension),Y=this.getLookupMethod(V,V.extension),V=V.extension):Y=this.getLookupMethod(O,V),J==="12"){let ie=e.get(v.sequenceIndex),ce=Y(ie);ce&&g.push(ce)}else if(J==="21"){let ie=e.get(v.sequenceIndex),ce=Y(ie);ce&&g.push(ce)}else throw new Error(`Substitution type ${J} is not supported in chaining substitution`)}}return g}function Mf(e,t){let n=e.current,s=dt(n,t.coverage);if(s===-1)return null;let o,r=t.ligatureSets[s];for(let a=0;a<r.length;a++){o=r[a];for(let l=0;l<o.components.length;l++){let c=e.lookahead[l],f=o.components[l];if(c!==f)break;if(l===o.components.length-1)return o}}return null}function Pf(e,t){let n=e.current;if(dt(n,t.coverage)===-1)return null;for(let o of t.ruleSets)for(let r of o){let a=!0;for(let l=0;l<r.input.length;l++)if(e.lookahead[l]!==r.input[l]){a=!1;break}if(a){let l=[];l.push(n);for(let f=0;f<r.input.length;f++)l.push(r.input[f]);let c=(f,u)=>{let{lookupListIndex:m,sequenceIndex:g}=u,{subtables:S}=this.getLookupByIndex(m);for(let v of S)dt(f[g],v.coverage)!==-1&&(f[g]=v.deltaGlyphId)};for(let f=0;f<r.lookupRecords.length;f++){let u=r.lookupRecords[f];c(l,u)}return l}}return null}function Bf(e,t){if(e.context.length<t.coverages.length)return[];for(let s=0;s<t.coverages.length;s++){let o=e.get(s);if(o=Array.isArray(o)?o[0]:o,dt(o,t.coverages[s])===-1)return[]}let n=[];for(let s=0;s<t.lookupRecords.length;s++){let o=t.lookupRecords[s],r=o.lookupListIndex,a=this.getLookupByIndex(r);for(let l=0;l<a.subtables.length;l++){let c=a.subtables[l],f,u=this.getSubstitutionType(a,c);if(u==="71"?(u=this.getSubstitutionType(c,c.extension),f=this.getLookupMethod(c,c.extension),c=c.extension):f=this.getLookupMethod(a,c),u==="12"){let m=e.get(o.sequenceIndex),g=f(m);g&&n.push(g)}else if(u==="21"){let m=e.get(o.sequenceIndex),g=f(m);g&&n.push(g)}}}return n}function Nf(e,t){let n=dt(e,t.coverage);return n===-1?null:t.sequences[n]}Be.prototype.getDefaultScriptFeaturesIndexes=function(){let e=this.font.tables.gsub.scripts;for(let t=0;t<e.length;t++){let n=e[t];if(n.tag==="DFLT")return n.script.defaultLangSys.featureIndexes}return[]},Be.prototype.getScriptFeaturesIndexes=function(e){if(!this.font.tables.gsub)return[];if(!e)return this.getDefaultScriptFeaturesIndexes();let n=this.font.tables.gsub.scripts;for(let s=0;s<n.length;s++){let o=n[s];if(o.tag===e&&o.script.defaultLangSys)return o.script.defaultLangSys.featureIndexes;{let r=o.langSysRecords;if(r)for(let a=0;a<r.length;a++){let l=r[a];if(l.tag===e)return l.langSys.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},Be.prototype.mapTagsToFeatures=function(e,t){let n={};for(let s=0;s<e.length;s++){let o=e[s].tag,r=e[s].feature;n[o]=r}this.features[t].tags=n},Be.prototype.getScriptFeatures=function(e){let t=this.features[e];if(Object.prototype.hasOwnProperty.call(this.features,e))return t;let n=this.getScriptFeaturesIndexes(e);if(!n)return null;let s=this.font.tables.gsub;return t=n.map(o=>s.features[o]),this.features[e]=t,this.mapTagsToFeatures(t,e),t},Be.prototype.getSubstitutionType=function(e,t){let n=e.lookupType.toString(),s=t.substFormat.toString();return n+s},Be.prototype.getLookupMethod=function(e,t){let n=this.getSubstitutionType(e,t);switch(n){case"11":return s=>Ff.apply(this,[s,t]);case"12":return s=>Df.apply(this,[s,t]);case"63":return s=>Uf.apply(this,[s,t]);case"41":return s=>Mf.apply(this,[s,t]);case"21":return s=>Nf.apply(this,[s,t]);case"51":return s=>Pf.apply(this,[s,t]);case"53":return s=>Bf.apply(this,[s,t]);default:throw new Error(`substitutionType : ${n} lookupType: ${e.lookupType} - substFormat: ${t.substFormat} is not yet supported`)}},Be.prototype.lookupFeature=function(e){let t=e.contextParams,n=t.index,s=this.getFeature({tag:e.tag,script:e.script});if(!s)return new Error(`font '${(this.font.names.unicode||this.font.names.windows||this.font.names.macintosh).fullName.en}' doesn't support feature '${e.tag}' for script '${e.script}'.`);let o=this.getFeatureLookups(s),r=[].concat(t.context);for(let a=0;a<o.length;a++){let l=o[a],c=this.getLookupSubtables(l);for(let f=0;f<c.length;f++){let u=c[f],m=this.getSubstitutionType(l,u),g;m==="71"?(m=this.getSubstitutionType(u,u.extension),g=this.getLookupMethod(u,u.extension),u=u.extension):g=this.getLookupMethod(l,u);let S;switch(m){case"11":S=g(t.current),S&&r.splice(n,1,new ht({id:11,tag:e.tag,substitution:S}));break;case"12":S=g(t.current),S&&r.splice(n,1,new ht({id:12,tag:e.tag,substitution:S}));break;case"63":S=g(t),Array.isArray(S)&&S.length&&r.splice(n,1,new ht({id:63,tag:e.tag,substitution:S}));break;case"41":S=g(t),S&&r.splice(n,1,new ht({id:41,tag:e.tag,substitution:S}));break;case"21":S=g(t.current),S&&r.splice(n,1,new ht({id:21,tag:e.tag,substitution:S}));break;case"51":case"53":S=g(t),Array.isArray(S)&&S.length&&r.splice(n,1,new ht({id:parseInt(m),tag:e.tag,substitution:S}));break}t=new Re(r,n),!(Array.isArray(S)&&!S.length)&&(S=null)}}return r.length?r:null},Be.prototype.supports=function(e){if(!e.script)return!1;this.getScriptFeatures(e.script);let t=Object.prototype.hasOwnProperty.call(this.features,e.script);if(!e.tag)return t;let n=this.features[e.script].some(s=>s.tag===e.tag);return t&&n},Be.prototype.getLookupSubtables=function(e){return e.subtables||null},Be.prototype.getLookupByIndex=function(e){return this.font.tables.gsub.lookups[e]||null},Be.prototype.getFeatureLookups=function(e){return e.lookupListIndexes.map(this.getLookupByIndex.bind(this))},Be.prototype.getFeature=function(t){if(!this.font)return{FAIL:"No font was found"};Object.prototype.hasOwnProperty.call(this.features,t.script)||this.getScriptFeatures(t.script);let n=this.features[t.script];return n?n.tags[t.tag]?this.features[t.script].tags[t.tag]:null:{FAIL:`No feature for script ${t.script}`}};var _f=Be;function Gf(e){let t=e.current,n=e.get(-1);return n===null&&ft(t)||!ft(n)&&ft(t)}function Hf(e){let t=e.get(1);return t===null||!ft(t)}var Vf={startCheck:Gf,endCheck:Hf};function jf(e){let t=e.current,n=e.get(-1);return(ft(t)||pt(t))&&!ft(n)}function $f(e){let t=e.get(1);switch(!0){case t===null:return!0;case(!ft(t)&&!pt(t)):{let n=If(t);if(!n)return!0;if(n){let s=!1;if(s=e.lookahead.some(o=>ft(o)||pt(o)),!s)return!0}break}default:return!1}}var Wf={startCheck:jf,endCheck:$f};function zf(e,t,n){t[n].setState(e.tag,e.substitution)}function Xf(e,t,n){t[n].setState(e.tag,e.substitution)}function As(e,t,n){for(let s=0;s<e.substitution.length;s++){let o=e.substitution[s],r=t[n+s];if(Array.isArray(o)){o.length?r.setState(e.tag,o[0]):r.setState("deleted",!0);continue}r.setState(e.tag,o)}}function Yf(e,t,n){let s=t[n];s.setState(e.tag,e.substitution.ligGlyph);let o=e.substitution.components.length;for(let r=0;r<o;r++)s=t[n+r+1],s.setState("deleted",!0)}var Jr={11:zf,12:Xf,63:As,41:Yf,51:As,53:As};function qf(e,t,n){e instanceof ht&&Jr[e.id]&&Jr[e.id](e,t,n)}var wt=qf;function Zf(e){let t=[].concat(e.backtrack);for(let n=t.length-1;n>=0;n--){let s=t[n],o=Qr(s),r=pt(s);if(!o&&!r)return!0;if(o)return!1}return!1}function Kf(e){if(Qr(e.current))return!1;for(let t=0;t<e.lookahead.length;t++){let n=e.lookahead[t];if(!pt(n))return!0}return!1}function Qf(e){let t="arab",n=this.featuresTags[t],s=this.tokenizer.getRangeTokens(e);if(s.length===1)return;let o=new Re(s.map(a=>a.getState("glyphIndex")),0),r=new Re(s.map(a=>a.char),0);for(let a=0;a<s.length;a++){let l=s[a];if(pt(l.char))continue;o.setCurrentIndex(a),r.setCurrentIndex(a);let c=0;Zf(r)&&(c|=1),Kf(r)&&(c|=2);let f;switch(c){case 1:f="fina";break;case 2:f="init";break;case 3:f="medi";break}if(n.indexOf(f)===-1)continue;let u=this.query.lookupFeature({tag:f,script:t,contextParams:o});if(u instanceof Error){console.info(u.message);continue}for(let m=0;m<u.length;m++){let g=u[m];g instanceof ht&&(wt(g,s,m),o.context[m]=g.substitution)}}}var Jf=Qf;function ea(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function ep(e){let t="arab",n=this.tokenizer.getRangeTokens(e),s=ea(n);for(let o=0;o<s.context.length;o++){s.setCurrentIndex(o);let r=this.query.lookupFeature({tag:"rlig",script:t,contextParams:s});if(r.length){for(let a=0;a<r.length;a++){let l=r[a];wt(l,n,o)}s=ea(n)}}}var tp=ep;function np(e){return e.index===0&&e.context.length>1}function sp(e){return e.index===e.context.length-1}var op={startCheck:np,endCheck:sp};function ta(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function rp(e){let t="delf",n="ccmp",s=this.tokenizer.getRangeTokens(e),o=ta(s);for(let r=0;r<o.context.length;r++){if(!this.query.getFeature({tag:n,script:t,contextParams:o}))continue;o.setCurrentIndex(r);let a=this.query.lookupFeature({tag:n,script:t,contextParams:o});if(a.length){for(let l=0;l<a.length;l++){let c=a[l];wt(c,s,r)}o=ta(s)}}}var ap=rp;function ip(e){let t=e.current,n=e.get(-1);return n===null&&Mn(t)||!Mn(n)&&Mn(t)}function lp(e){let t=e.get(1);return t===null||!Mn(t)}var cp={startCheck:ip,endCheck:lp};function na(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function up(e){let t="latn",n=this.tokenizer.getRangeTokens(e),s=na(n);for(let o=0;o<s.context.length;o++){s.setCurrentIndex(o);let r=this.query.lookupFeature({tag:"liga",script:t,contextParams:s});if(r.length){for(let a=0;a<r.length;a++){let l=r[a];wt(l,n,o)}s=na(n)}}}var fp=up;function pp(e){let t=e.current,n=e.get(-1);return n===null&&Un(t)||!Un(n)&&Un(t)}function hp(e){let t=e.get(1);return t===null||!Un(t)}var dp={startCheck:pp,endCheck:hp};function sa(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function gp(e){let t="thai",n=this.tokenizer.getRangeTokens(e),s=sa(n,0);for(let o=0;o<s.context.length;o++){s.setCurrentIndex(o);let r=this.query.lookupFeature({tag:"ccmp",script:t,contextParams:s});if(r.length){for(let a=0;a<r.length;a++){let l=r[a];wt(l,n,o)}s=sa(n,o)}}}var mp=gp;function oa(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function yp(e){let t="thai",n=this.tokenizer.getRangeTokens(e),s=oa(n,0);for(let o=0;o<s.context.length;o++){s.setCurrentIndex(o);let r=this.query.lookupFeature({tag:"liga",script:t,contextParams:s});if(r.length){for(let a=0;a<r.length;a++){let l=r[a];wt(l,n,o)}s=oa(n,o)}}}var bp=yp;function ra(e,t){let n=e.map(s=>s.activeState.value);return new Re(n,t||0)}function xp(e){let t="thai",n=this.tokenizer.getRangeTokens(e),s=ra(n,0);for(let o=0;o<s.context.length;o++){s.setCurrentIndex(o);let r=this.query.lookupFeature({tag:"rlig",script:t,contextParams:s});if(r.length){for(let a=0;a<r.length;a++){let l=r[a];wt(l,n,o)}s=ra(n,o)}}}var vp=xp;function Is(e){if(e===null)return!1;let t=e.codePointAt(0);return t>=6155&&t<=6157||t>=65024&&t<=65039||t>=917760&&t<=917999}function Sp(e){let t=e.current,n=e.get(1);return n===null&&Is(t)||Is(n)}function kp(e){let t=e.get(1);return t===null||!Is(t)}var Tp={startCheck:Sp,endCheck:kp};function wp(e){let t=this.query.font,n=this.tokenizer.getRangeTokens(e);if(n[1].setState("deleted",!0),t.tables.cmap&&t.tables.cmap.varSelectorList){let s=n[0].char.codePointAt(0),o=n[1].char.codePointAt(0),r=t.tables.cmap.varSelectorList[o];if(r!==void 0&&r.nonDefaultUVS){let a=r.nonDefaultUVS.uvsMappings;if(a[s]){let l=a[s].glyphID;t.glyphs.glyphs[l]!==void 0&&n[0].setState("glyphIndex",l)}}}}var Cp=wp;function He(e){this.baseDir=e||"ltr",this.tokenizer=new Af,this.featuresTags={}}He.prototype.setText=function(e){this.text=e},He.prototype.contextChecks={ccmpReplacementCheck:op,latinWordCheck:cp,arabicWordCheck:Vf,arabicSentenceCheck:Wf,thaiWordCheck:dp,unicodeVariationSequenceCheck:Tp};function Nt(e){let t=this.contextChecks[`${e}Check`];return this.tokenizer.registerContextChecker(e,t.startCheck,t.endCheck)}function Op(){return Nt.call(this,"ccmpReplacement"),Nt.call(this,"latinWord"),Nt.call(this,"arabicWord"),Nt.call(this,"arabicSentence"),Nt.call(this,"thaiWord"),Nt.call(this,"unicodeVariationSequence"),this.tokenizer.tokenize(this.text)}function Lp(){let e=this.tokenizer.getContextRanges("arabicSentence");for(let t=0;t<e.length;t++){let n=e[t],s=this.tokenizer.getRangeTokens(n);this.tokenizer.replaceRange(n.startIndex,n.endOffset,s.reverse())}}He.prototype.registerFeatures=function(e,t){let n=t.filter(s=>this.query.supports({script:e,tag:s}));Object.prototype.hasOwnProperty.call(this.featuresTags,e)?this.featuresTags[e]=this.featuresTags[e].concat(n):this.featuresTags[e]=n},He.prototype.applyFeatures=function(e,t){if(!e)throw new Error("No valid font was provided to apply features");this.query||(this.query=new _f(e));for(let n=0;n<t.length;n++){let s=t[n];this.query.supports({script:s.script})&&this.registerFeatures(s.script,s.tags)}},He.prototype.registerModifier=function(e,t,n){this.tokenizer.registerModifier(e,t,n)};function Jt(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Ep(){if(!Object.prototype.hasOwnProperty.call(this.featuresTags,"arab"))return;Jt.call(this);let t=this.tokenizer.getContextRanges("arabicWord");for(let n=0;n<t.length;n++){let s=t[n];Jf.call(this,s)}}function Rp(){Jt.call(this);let e=this.tokenizer.getContextRanges("ccmpReplacement");for(let t=0;t<e.length;t++){let n=e[t];ap.call(this,n)}}function Ap(){if(!this.hasFeatureEnabled("arab","rlig"))return;Jt.call(this);let e=this.tokenizer.getContextRanges("arabicWord");for(let t=0;t<e.length;t++){let n=e[t];tp.call(this,n)}}function Ip(){if(!this.hasFeatureEnabled("latn","liga"))return;Jt.call(this);let e=this.tokenizer.getContextRanges("latinWord");for(let t=0;t<e.length;t++){let n=e[t];fp.call(this,n)}}function Fp(){let e=this.tokenizer.getContextRanges("unicodeVariationSequence");for(let t=0;t<e.length;t++){let n=e[t];Cp.call(this,n)}}function Dp(){Jt.call(this);let e=this.tokenizer.getContextRanges("thaiWord");for(let t=0;t<e.length;t++){let n=e[t];this.hasFeatureEnabled("thai","liga")&&bp.call(this,n),this.hasFeatureEnabled("thai","rlig")&&vp.call(this,n),this.hasFeatureEnabled("thai","ccmp")&&mp.call(this,n)}}He.prototype.checkContextReady=function(e){return!!this.tokenizer.getContext(e)},He.prototype.applyFeaturesToContexts=function(){this.checkContextReady("ccmpReplacement")&&Rp.call(this),this.checkContextReady("arabicWord")&&(Ep.call(this),Ap.call(this)),this.checkContextReady("latinWord")&&Ip.call(this),this.checkContextReady("arabicSentence")&&Lp.call(this),this.checkContextReady("thaiWord")&&Dp.call(this),this.checkContextReady("unicodeVariationSequence")&&Fp.call(this)},He.prototype.hasFeatureEnabled=function(e,t){return(this.featuresTags[e]||[]).indexOf(t)!==-1},He.prototype.processText=function(e){(!this.text||this.text!==e)&&(this.setText(e),Op.call(this),this.applyFeaturesToContexts())},He.prototype.getBidiText=function(e){return this.processText(e),this.tokenizer.getText()},He.prototype.getTextGlyphs=function(e){this.processText(e);let t=[];for(let n=0;n<this.tokenizer.tokens.length;n++){let s=this.tokenizer.tokens[n];if(s.state.deleted)continue;let o=s.activeState.value;t.push(Array.isArray(o)?o[0]:o)}return t};var Up=He;function Fs(e){return{fontFamily:{en:e.familyName||" "},fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\s/g,"")},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}}}function le(e){if(e=e||{},e.tables=e.tables||{},!e.empty){if(!e.familyName)throw new Error("When creating a new Font object, familyName is required.");if(!e.styleName)throw new Error("When creating a new Font object, styleName is required.");if(!e.unitsPerEm)throw new Error("When creating a new Font object, unitsPerEm is required.");if(!e.ascender)throw new Error("When creating a new Font object, ascender is required.");if(e.descender>0)throw new Error("When creating a new Font object, negative descender value is required.");this.names={},this.names.unicode=Fs(e),this.names.macintosh=Fs(e),this.names.windows=Fs(e),this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.italicAngle=e.italicAngle||0,this.weightClass=e.weightClass||0;let t=0;e.fsSelection?t=e.fsSelection:(this.italicAngle<0?t|=this.fsSelectionValues.ITALIC:this.italicAngle>0&&(t|=this.fsSelectionValues.OBLIQUE),this.weightClass>=600&&(t|=this.fsSelectionValues.BOLD),t===0&&(t=this.fsSelectionValues.REGULAR)),(!e.panose||!Array.isArray(e.panose))&&(e.panose=[0,0,0,0,0,0,0,0,0]),this.tables=Object.assign(e.tables,{os2:Object.assign({usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,bFamilyType:e.panose[0]||0,bSerifStyle:e.panose[1]||0,bWeight:e.panose[2]||0,bProportion:e.panose[3]||0,bContrast:e.panose[4]||0,bStrokeVariation:e.panose[5]||0,bArmStyle:e.panose[6]||0,bLetterform:e.panose[7]||0,bMidline:e.panose[8]||0,bXHeight:e.panose[9]||0,fsSelection:t},e.tables.os2)})}this.supported=!0,this.glyphs=new Je.GlyphSet(this,e.glyphs||[]),this.encoding=new Po(this),this.position=new Ec(this),this.substitution=new Mc(this),this.tables=this.tables||{},this.tables=new Proxy(this.tables,{set:(t,n,s)=>(t[n]=s,t.fvar&&(t.gvar||t.cff2)&&!this.variation&&(this.variation=new Zc(this)),!0)}),this.palettes=new Cr(this),this.layers=new Pc(this),this.svgImages=new Bc(this),this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:this.outlinesFormat==="truetype"?this._hinting=new Lf(this):null}})}le.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)>0},le.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},le.prototype.charToGlyph=function(e){let t=this.charToGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},le.prototype.updateFeatures=function(e){return this.defaultRenderOptions.features.map(t=>t.script==="latn"?{script:"latn",tags:t.tags.filter(n=>e[n])}:t)},le.prototype.stringToGlyphIndexes=function(e,t){let n=new Up,s=r=>this.charToGlyphIndex(r.char);n.registerModifier("glyphIndex",null,s);let o=t?this.updateFeatures(t.features):this.defaultRenderOptions.features;return n.applyFeatures(this,o),n.getTextGlyphs(e)},le.prototype.stringToGlyphs=function(e,t){let n=this.stringToGlyphIndexes(e,t),s=n.length,o=new Array(s),r=this.glyphs.get(0);for(let a=0;a<s;a+=1)o[a]=this.glyphs.get(n[a])||r;return o},le.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},le.prototype.nameToGlyph=function(e){let t=this.nameToGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},le.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""},le.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;let n=this.position.defaultKerningTables;return n?this.position.getKerningValue(n,e,t):this.kerningPairs[e+","+t]||0},le.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]},{script:"thai",tags:["liga","rlig","ccmp"]}],hinting:!1,usePalette:0,drawLayers:!0,drawSVG:!0},le.prototype.forEachGlyph=function(e,t,n,s,o,r){t=t!==void 0?t:0,n=n!==void 0?n:0,s=s!==void 0?s:72,o=Object.assign({},this.defaultRenderOptions,o);let a=1/this.unitsPerEm*s,l=this.stringToGlyphs(e,o),c;if(o.kerning){let f=o.script||this.position.getDefaultScriptName();c=this.position.getKerningTables(f,o.language)}for(let f=0;f<l.length;f+=1){let u=l[f];if(r.call(this,u,t,n,s,o),u.advanceWidth&&(t+=u.advanceWidth*a),o.kerning&&f<l.length-1){let m=c?this.position.getKerningValue(c,u.index,l[f+1].index):this.getKerningValue(u,l[f+1]);t+=m*a}o.letterSpacing?t+=o.letterSpacing*s:o.tracking&&(t+=o.tracking/1e3*s)}return t},le.prototype.getPath=function(e,t,n,s,o){o=Object.assign({},this.defaultRenderOptions,o);let r=new xt;if(r._layers=[],Yo(this,r,s),r.stroke){let a=1/(r.unitsPerEm||1e3)*s;r.strokeWidth*=a}return this.forEachGlyph(e,t,n,s,o,(a,l,c,f)=>{let u=a.getPath(l,c,f,o,this);if(o.drawSVG||o.drawLayers){let m=u._layers;if(m&&m.length){for(let g=0;g<m.length;g++){let S=m[g];r._layers.push(S)}return}}r.extend(u)}),r},le.prototype.getPaths=function(e,t,n,s,o){o=Object.assign({},this.defaultRenderOptions,o);let r=[];return this.forEachGlyph(e,t,n,s,o,function(a,l,c,f){let u=a.getPath(l,c,f,o,this);r.push(u)}),r},le.prototype.getAdvanceWidth=function(e,t,n){return n=Object.assign({},this.defaultRenderOptions,n),this.forEachGlyph(e,0,0,t,n,function(){})},le.prototype.draw=function(e,t,n,s,o,r){this.getPath(t,n,s,o,r).draw(e)},le.prototype.drawPoints=function(e,t,n,s,o,r){r=Object.assign({},this.defaultRenderOptions,r),this.forEachGlyph(t,n,s,o,r,function(a,l,c,f){a.drawPoints(e,l,c,f,r,this)})},le.prototype.drawMetrics=function(e,t,n,s,o,r){r=Object.assign({},this.defaultRenderOptions,r),this.forEachGlyph(t,n,s,o,r,function(a,l,c,f){a.drawMetrics(e,l,c,f)})},le.prototype.getEnglishName=function(e){let t=(this.names.unicode||this.names.macintosh||this.names.windows)[e];if(t)return t.en},le.prototype.validate=function(){let e=[],t=this;function n(o,r){o||(console.warn(`[opentype.js] ${r}`),e.push(r))}function s(o){let r=t.getEnglishName(o);n(r&&r.trim().length>0,"No English "+o+" specified.")}if(s("fontFamily"),s("weightName"),s("manufacturer"),s("copyright"),s("version"),n(this.unitsPerEm>0,"No unitsPerEm specified."),this.tables.colr){let o=this.tables.colr.baseGlyphRecords,r=-1;for(let a=0;a<o.length;a++){let l=o[a].glyphID;if(n(r<o[a].glyphID,`baseGlyphs must be sorted by GlyphID in ascending order, but glyphID ${l} comes after ${r}`),r>o[a].glyphID)break;r=l}}return e},le.prototype.toTables=function(){return Lc.fontToTable(this)},le.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},le.prototype.toArrayBuffer=function(){let t=this.toTables().encode(),n=new ArrayBuffer(t.length),s=new Uint8Array(n);for(let o=0;o<t.length;o++)s[o]=t[o];return n},le.prototype.download=function(){console.error("DEPRECATED: platform-specific actions are to be implemented on user-side")},le.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},le.prototype.macStyleValues={BOLD:1,ITALIC:2,UNDERLINE:4,OUTLINED:8,SHADOW:16,CONDENSED:32,EXTENDED:64},le.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},le.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var aa=le;function Mp(e,t){let n=new N.Parser(e,t),s=n.parseUShort(),o=n.parseUShort();s!==1&&console.warn(`Unsupported hvar table version ${s}.${o}`);let r=[s,o],a=n.parsePointer32(function(){return this.parseItemVariationStore()}),l=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),c=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()}),f=n.parsePointer32(function(){return this.parseDeltaSetIndexMap()});return{version:r,itemVariationStore:a,advanceWidth:l,lsb:c,rsb:f}}function Pp(){console.warn("Writing of hvar tables is not yet supported.")}var Bp={make:Pp,parse:Mp},Np=function(){return{coverage:this.parsePointer(w.coverage),attachPoints:this.parseList(w.pointer(w.uShortList))}},_p=function(){var e=this.parseUShort();if($.argument(e===1||e===2||e===3,"Unsupported CaretValue table version."),e===1)return{coordinate:this.parseShort()};if(e===2)return{pointindex:this.parseShort()};if(e===3)return{coordinate:this.parseShort()}},Gp=function(){return this.parseList(w.pointer(_p))},Hp=function(){return{coverage:this.parsePointer(w.coverage),ligGlyphs:this.parseList(w.pointer(Gp))}},Vp=function(){return this.parseUShort(),this.parseList(w.pointer(w.coverage))};function jp(e,t){t=t||0;let n=new w(e,t),s=n.parseVersion(1);$.argument(s===1||s===1.2||s===1.3,"Unsupported GDEF table version.");var o={version:s,classDef:n.parsePointer(w.classDef),attachList:n.parsePointer(Np),ligCaretList:n.parsePointer(Hp),markAttachClassDef:n.parsePointer(w.classDef)};return s>=1.2&&(o.markGlyphSets=n.parsePointer(Vp)),o}var $p={parse:jp},Ye=new Array(10);Ye[1]=function(){let t=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{posFormat:1,coverage:this.parsePointer(w.coverage),value:this.parseValueRecord()};if(n===2)return{posFormat:2,coverage:this.parsePointer(w.coverage),values:this.parseValueRecordList()};$.assert(!1,"0x"+t.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Ye[2]=function(){let t=this.offset+this.relativeOffset,n=this.parseUShort();$.assert(n===1||n===2,"0x"+t.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");let s=this.parsePointer(w.coverage),o=this.parseUShort(),r=this.parseUShort();if(n===1)return{posFormat:n,coverage:s,valueFormat1:o,valueFormat2:r,pairSets:this.parseList(w.pointer(w.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(o),value2:this.parseValueRecord(r)}})))};if(n===2){let a=this.parsePointer(w.classDef),l=this.parsePointer(w.classDef),c=this.parseUShort(),f=this.parseUShort();return{posFormat:n,coverage:s,valueFormat1:o,valueFormat2:r,classDef1:a,classDef2:l,class1Count:c,class2Count:f,classRecords:this.parseList(c,w.list(f,function(){return{value1:this.parseValueRecord(o),value2:this.parseValueRecord(r)}}))}}},Ye[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Ye[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Ye[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Ye[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Ye[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Ye[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Ye[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Wp(e,t){t=t||0;let n=new w(e,t),s=n.parseVersion(1);return $.argument(s===1||s===1.1,"Unsupported GPOS table version "+s),s===1?{version:s,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Ye)}:{version:s,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Ye),variations:n.parseFeatureVariationsList()}}var zp=new Array(10);function Xp(e){return new I.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new I.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new I.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new I.LookupList(e.lookups,zp)}])}var Yp={parse:Wp,make:Xp};function qp(e){let t={};e.skip("uShort");let n=e.parseUShort();$.argument(n===0,"Unsupported kern sub-table version."),e.skip("uShort",2);let s=e.parseUShort();e.skip("uShort",3);for(let o=0;o<s;o+=1){let r=e.parseUShort(),a=e.parseUShort(),l=e.parseShort();t[r+","+a]=l}return t}function Zp(e){let t={};e.skip("uShort"),e.parseULong()>1&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");let o=e.parseUShort()&255;if(e.skip("uShort"),o===0){let r=e.parseUShort();e.skip("uShort",3);for(let a=0;a<r;a+=1){let l=e.parseUShort(),c=e.parseUShort(),f=e.parseShort();t[l+","+c]=f}}return t}function Kp(e,t){let n=new N.Parser(e,t),s=n.parseUShort();if(s===0)return qp(n);if(s===1)return Zp(n);throw new Error("Unsupported kern table version ("+s+").")}var Qp={parse:Kp};function Jp(e,t,n,s){let o=new N.Parser(e,t),r=s?o.parseUShort:o.parseULong,a=[];for(let l=0;l<n+1;l+=1){let c=r.call(o);s&&(c*=2),a.push(c)}return a}var eh={parse:Jp};function ia(e,t){let n=[],s=12;for(let o=0;o<t;o+=1){let r=N.getTag(e,s),a=N.getULong(e,s+4),l=N.getULong(e,s+8),c=N.getULong(e,s+12);n.push({tag:r,checksum:a,offset:l,length:c,compression:!1}),s+=16}return n}function th(e,t){let n=[],s=44;for(let o=0;o<t;o+=1){let r=N.getTag(e,s),a=N.getULong(e,s+4),l=N.getULong(e,s+8),c=N.getULong(e,s+12),f;l<c?f="WOFF":f=!1,n.push({tag:r,offset:a,compression:f,compressedLength:l,length:c}),s+=20}return n}function ae(e,t){if(t.compression==="WOFF"){let n=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),s=new Uint8Array(t.length);if(Ee(n,s),s.byteLength!==t.length)throw new Error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length");return{data:new DataView(s.buffer,0),offset:0}}else return{data:e,offset:t.offset}}function nh(e,t={}){let n,s,o=new aa({empty:!0});e.constructor!==ArrayBuffer&&(e=new Uint8Array(e).buffer);let r=new DataView(e,0),a,l=[],c=N.getTag(r,0);if(c==="\0\0\0"||c==="true"||c==="typ1")o.outlinesFormat="truetype",a=N.getUShort(r,4),l=ia(r,a);else if(c==="OTTO")o.outlinesFormat="cff",a=N.getUShort(r,4),l=ia(r,a);else if(c==="wOFF"){let z=N.getTag(r,4);if(z==="\0\0\0")o.outlinesFormat="truetype";else if(z==="OTTO")o.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+c);a=N.getUShort(r,12),l=th(r,a)}else if(c==="wOF2"){let z="https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";throw new Error("WOFF2 require an external decompressor library, see examples at: "+z)}else throw new Error("Unsupported OpenType signature "+c);let f,u,m,g,S,v,k,O,W,V,Y,J,ie,ce,ue,xe,qe,ee;for(let z=0;z<a;z+=1){let G=l[z],H;switch(G.tag){case"avar":k=G;break;case"cmap":H=ae(r,G),o.tables.cmap=Mo.parse(H.data,H.offset),o.encoding=new Bo(o.tables.cmap);break;case"cvt ":H=ae(r,G),ee=new N.Parser(H.data,H.offset),o.tables.cvt=ee.parseShortList(G.length/2);break;case"fvar":m=G;break;case"STAT":g=G;break;case"gvar":S=G;break;case"cvar":v=G;break;case"fpgm":H=ae(r,G),ee=new N.Parser(H.data,H.offset),o.tables.fpgm=ee.parseByteList(G.length);break;case"head":H=ae(r,G),o.tables.head=er.parse(H.data,H.offset),o.unitsPerEm=o.tables.head.unitsPerEm,n=o.tables.head.indexToLocFormat;break;case"hhea":H=ae(r,G),o.tables.hhea=tr.parse(H.data,H.offset),o.ascender=o.tables.hhea.ascender,o.descender=o.tables.hhea.descender,o.numberOfHMetrics=o.tables.hhea.numberOfHMetrics;break;case"HVAR":ie=G;break;case"hmtx":J=G;break;case"ltag":H=ae(r,G),s=sr.parse(H.data,H.offset);break;case"COLR":H=ae(r,G),o.tables.colr=lr.parse(H.data,H.offset);break;case"CPAL":H=ae(r,G),o.tables.cpal=Ho.parse(H.data,H.offset);break;case"maxp":H=ae(r,G),o.tables.maxp=or.parse(H.data,H.offset),o.numGlyphs=o.tables.maxp.numGlyphs;break;case"name":xe=G;break;case"OS/2":H=ae(r,G),o.tables.os2=bs.parse(H.data,H.offset);break;case"post":H=ae(r,G),o.tables.post=rr.parse(H.data,H.offset),o.glyphNames=new cs(o.tables.post);break;case"prep":H=ae(r,G),ee=new N.Parser(H.data,H.offset),o.tables.prep=ee.parseByteList(G.length);break;case"glyf":O=G;break;case"loca":ue=G;break;case"CFF ":f=G;break;case"CFF2":u=G;break;case"kern":ce=G;break;case"GDEF":W=G;break;case"GPOS":V=G;break;case"GSUB":Y=G;break;case"meta":qe=G;break;case"gasp":try{H=ae(r,G),o.tables.gasp=dr.parse(H.data,H.offset)}catch(Oe){console.warn("Failed to parse gasp table, skipping."),console.warn(Oe)}break;case"SVG ":H=ae(r,G),o.tables.svg=gr.parse(H.data,H.offset);break;default:break}}let Ne=ae(r,xe);if(o.tables.name=Uo.parse(Ne.data,Ne.offset,s),o.names=o.tables.name,O&&ue){let z=n===0,G=ae(r,ue),H=eh.parse(G.data,G.offset,o.numGlyphs,z),Oe=ae(r,O);o.glyphs=Rr.parse(Oe.data,Oe.offset,H,o,t)}else if(f){let z=ae(r,f);ms.parse(z.data,z.offset,o,t)}else if(u){let z=ae(r,u);ms.parse(z.data,z.offset,o,t)}else throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");let Ae=ae(r,J);if(nr.parse(o,Ae.data,Ae.offset,o.numberOfHMetrics,o.numGlyphs,o.glyphs,t),Ji(o,t),ce){let z=ae(r,ce);o.kerningPairs=Qp.parse(z.data,z.offset)}else o.kerningPairs={};if(W){let z=ae(r,W);o.tables.gdef=$p.parse(z.data,z.offset)}if(V){let z=ae(r,V);o.tables.gpos=Yp.parse(z.data,z.offset),o.position.init()}if(Y){let z=ae(r,Y);o.tables.gsub=ar.parse(z.data,z.offset)}if(m){let z=ae(r,m);o.tables.fvar=cr.parse(z.data,z.offset,o.names)}if(g){let z=ae(r,g);o.tables.stat=ur.parse(z.data,z.offset,o.tables.fvar)}if(S){m||console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."),O||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let z=ae(r,S);o.tables.gvar=hr.parse(z.data,z.offset,o.tables.fvar,o.glyphs)}if(v){m||console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."),o.tables.cvt||console.warn("This font provides a cvar table, but no cvt table which could be made variable."),O||console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");let z=ae(r,v);o.tables.cvar=pr.parse(z.data,z.offset,o.tables.fvar,o.tables.cvt||[])}if(k){m||console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");let z=ae(r,k);o.tables.avar=fr.parse(z.data,z.offset,o.tables.fvar)}if(ie){m||console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."),J||console.warn("This font provides an HVAR table, but no hmtx table to vary.");let z=ae(r,ie);o.tables.hvar=Bp.parse(z.data,z.offset,o.tables.fvar)}if(qe){let z=ae(r,qe);o.tables.meta=ir.parse(z.data,z.offset),o.metas=o.tables.meta}return o.palettes=new Cr(o),o}function sh(){console.error("DEPRECATED! migrate to: opentype.parse(buffer, opt) See: https://github.com/opentypejs/opentype.js/issues/675")}function oh(){console.error('DEPRECATED! migrate to: opentype.parse(require("fs").readFileSync(url), opt)')}return b(T)})();(function(i,p){typeof define=="function"&&define.amd?define(p):typeof Yn=="object"&&Yn.exports?Yn.exports=p():i.opentype=p()})(typeof self<"u"?self:Ia,()=>({...Aa,default:Aa}))});function mt(i){return Math.min(i.w,i.h)/100}function nn(i,p=.04){let h=i.w*p,y=i.h*p,x=i.w*(1-p),d=i.h*(1-p),b=i.chrome;return b&&(b.left&&(h=Math.max(h,i.w*b.left)),b.right&&(x=Math.min(x,i.w*(1-b.right))),b.top&&(y=Math.max(y,i.h*b.top)),b.bottom&&(d=Math.min(d,i.h*(1-b.bottom)))),{x0:h,y0:y,x1:x,y1:d,w:x-h,h:d-y}}var Sa={"top-left":{rx:0,ry:0,bx:0,by:0,sx:1,sy:1},top:{rx:.5,ry:0,bx:.5,by:0,sx:0,sy:1},"top-right":{rx:1,ry:0,bx:1,by:0,sx:-1,sy:1},left:{rx:0,ry:.5,bx:0,by:.5,sx:1,sy:0},center:{rx:.5,ry:.5,bx:.5,by:.5,sx:0,sy:0},right:{rx:1,ry:.5,bx:1,by:.5,sx:-1,sy:0},"bottom-left":{rx:0,ry:1,bx:0,by:1,sx:1,sy:-1},bottom:{rx:.5,ry:1,bx:.5,by:1,sx:0,sy:-1},"bottom-right":{rx:1,ry:1,bx:1,by:1,sx:-1,sy:-1}};function lh(i,p,h,y,x,d){let b=Sa[h]||Sa["bottom-left"],T=mt(i),C=p.x0+b.rx*p.w-b.bx*x+b.sx*(y?.x??0)*T,L=p.y0+b.ry*p.h-b.by*d+b.sy*(y?.y??0)*T;return{x:C,y:L}}function ch(i,p,h=mt(p)){let y=i.sizeHpct!=null?i.sizeHpct/100*p.h:i.sizeLu*h;return i.minLu!=null&&(y=Math.max(y,i.minLu*h)),y}function _s(i,p,h,y,x,d){let b=String(p??"").split(/\s+/).filter(Boolean);if(!b.length)return[""];let T=[],C=b[0];for(let L=1;L<b.length;L++){let A=C+" "+b[L];i(A,h,y,x)<=d?C=A:(T.push(C),C=b[L])}return T.push(C),T}function $n(i,p,h,y={}){let x=mt(i),d=y.safe||nn(i,y.actionPct),b=(p.plate?.padLu??0)*x,T=Math.min(p.maxWidthLu!=null?p.maxWidthLu*x:d.w,d.w)-2*b,C=0,L=0,A=(p.gapLu??1.5)*x,E=p.children.map((_,X)=>{let Z=ch(_,i,x),Q=_.family||"system",se=Z*(_.lineHeight??1.18),K=_s(h,_.text,Z,_.weight??400,Q,T),fe=0;for(let Te of K)fe=Math.max(fe,h(Te,Z,_.weight??400,Q));let Se=K.length*se;return C=Math.max(C,fe),L+=Se+(X>0?A:0),{run:_,lines:K,fontPx:Z,lineHeightPx:se,w:fe,h:Se,family:Q}}),F=C+2*b,B=L+2*b,{x:U,y:R}=lh(i,d,p.anchor,p.inset,F,B),M=R+b;for(let _ of E){let X=_.run.align||"left";_.x=X==="center"?U+F/2:X==="right"?U+F-b:U+b,_.align=X,_.y=M,M+=_.h+A}let D=p.plate?{x:U,y:R,w:F,h:B,radiusPx:(p.plate.radiusLu??0)*x}:null;return{box:{x:U,y:R,w:F,h:B},plate:D,runs:E,safe:d}}var Ht={system:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif',mono:"ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",serif:'Georgia,"Times New Roman",serif'},Vt=[{id:"inter",label:"Inter",kind:"sans",cssFamily:"GFX Inter",license:"OFL-1.1",embeddable:!0,files:{400:"/fonts/gfx/Inter-Regular.ttf",700:"/fonts/gfx/Inter-Bold.ttf"}},{id:"condensed",label:"Barlow Condensed",kind:"sans",cssFamily:"GFX Barlow Condensed",license:"OFL-1.1",embeddable:!0,files:{400:"/fonts/gfx/BarlowCondensed-Regular.ttf",700:"/fonts/gfx/BarlowCondensed-Bold.ttf"}},{id:"jetmono",label:"JetBrains Mono",kind:"mono",cssFamily:"GFX JetBrains Mono",license:"OFL-1.1",embeddable:!0,files:{400:"/fonts/gfx/JetBrainsMono-Regular.ttf",700:"/fonts/gfx/JetBrainsMono-Bold.ttf"}},{id:"instrument",label:"Instrument Serif",kind:"serif",cssFamily:"GFX Instrument Serif",license:"OFL-1.1",embeddable:!0,files:{400:"/fonts/gfx/InstrumentSerif-Regular.ttf"}},{id:"system",label:"System sans",kind:"sans",stack:Ht.system,embeddable:!1,files:{}},{id:"mono",label:"System mono",kind:"mono",stack:Ht.mono,embeddable:!1,files:{}},{id:"serif",label:"System serif",kind:"serif",stack:Ht.serif,embeddable:!1,files:{}}],uh=Object.fromEntries(Vt.map(i=>[i.id,i])),ka=new Map;function Ta({id:i,label:p,cssFamily:h,kind:y="sans",embeddable:x=!0,outlines:d=!1}){let b={id:i,label:p,kind:y,cssFamily:h,embeddable:x,outlines:d,custom:!0,files:{}};return ka.set(i,b),b}function Wn(i){return uh[i]??ka.get(i)}function Gs(i){let p=Wn(i);return p?p.cssFamily?`"${p.cssFamily}", ${Ht[p.kind]||Ht.system}`:p.stack:Ht.system}function fh(i,p,h,y){let x=3*i,d=3*(h-i)-x,b=1-x-d,T=3*p,C=3*(y-p)-T,L=1-T-C,A=U=>((b*U+d)*U+x)*U,E=U=>((L*U+C)*U+T)*U,F=U=>(3*b*U+2*d)*U+x,B=U=>{let R=U;for(let _=0;_<8;_++){let X=A(R)-U;if(Math.abs(X)<1e-7)return R;let Z=F(R);if(Math.abs(Z)<1e-7)break;R-=X/Z}let M=0,D=1;R=U;for(let _=0;_<40;_++){let X=A(R)-U;if(Math.abs(X)<1e-7)break;X<0?M=R:D=R,R=(M+D)/2}return R};return U=>U<=0?0:U>=1?1:E(B(U))}var sn={linear:{x1:.333,y1:.333,x2:.667,y2:.667},inOut:{x1:.42,y1:0,x2:.58,y2:1},inSine:{x1:.12,y1:0,x2:.39,y2:0},outSine:{x1:.61,y1:1,x2:.88,y2:1},inOutSine:{x1:.37,y1:0,x2:.63,y2:1},inQuad:{x1:.11,y1:0,x2:.5,y2:0},outQuad:{x1:.5,y1:1,x2:.89,y2:1},inOutQuad:{x1:.45,y1:0,x2:.55,y2:1},inCubic:{x1:.32,y1:0,x2:.67,y2:0},outCubic:{x1:.215,y1:.61,x2:.355,y2:1},inOutCubic:{x1:.65,y1:0,x2:.35,y2:1},inQuart:{x1:.5,y1:0,x2:.75,y2:0},outQuart:{x1:.25,y1:1,x2:.5,y2:1},inOutQuart:{x1:.76,y1:0,x2:.24,y2:1},inExpo:{x1:.7,y1:0,x2:.84,y2:0},outExpo:{x1:.16,y1:1,x2:.3,y2:1},inOutExpo:{x1:.87,y1:0,x2:.13,y2:1},inCirc:{x1:.55,y1:0,x2:1,y2:.45},outCirc:{x1:0,y1:.55,x2:.45,y2:1},inOutCirc:{x1:.85,y1:0,x2:.15,y2:1},inBack:{x1:.36,y1:0,x2:.66,y2:-.56},outBack:{x1:.34,y1:1.56,x2:.64,y2:1},inOutBack:{x1:.68,y1:-.6,x2:.32,y2:1.6}};function Hs(i=.5){let p=Math.max(0,Math.min(1,i)),h=1-.85*p,y=6+12*p,x=y*Math.sqrt(Math.max(1e-6,1-h*h)),d=T=>1-Math.exp(-h*y*T)*(Math.cos(x*T)+h*y/x*Math.sin(x*T)),b=d(1)||1;return T=>T<=0?0:T>=1?1:d(T)/b}var on={springSoft:Hs(.15),outSpring:Hs(.5),springLoose:Hs(.9),outElastic:i=>i<=0?0:i>=1?1:Math.pow(2,-10*i)*Math.sin((i*10-.75)*(2*Math.PI/3))+1,outBounce:i=>i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},hd=[...Object.keys(sn),...Object.keys(on)],wa=i=>Object.hasOwn(on,i),ph=24;function Ca(i,p=ph){let h=on[i];if(!h)return[];let y=[];for(let x=1;x<p;x++){let d=x/p;y.push({x:d,y:h(d)})}return y}function Oa(i){if(i==="linear"||!i)return h=>h;if(on[i]){let h=on[i];return y=>y<=0?0:y>=1?1:h(y)}let p=sn[i]||sn.linear;return fh(p.x1,p.y1,p.x2,p.y2)}function jt(i){let p=sn[i]||sn.linear;return{o:{x:[p.x1],y:[p.y1]},i:{x:[p.x2],y:[p.y2]}}}var $t=(i,p,h)=>`${i} ${p}px ${Gs(h)}`,La=new Proxy({},{get:(i,p)=>Oa(p)});function rn(i,p){if(!i||!i.length)return;if(p<=i[0].t)return i[0].v;let h=i[i.length-1];if(p>=h.t)return h.v;for(let y=0;y<i.length-1;y++){let x=i[y],d=i[y+1];if(p>=x.t&&p<=d.t){let b=(p-x.t)/(d.t-x.t||1),T=(La[d.ease]||La.linear)(b);return x.v+(d.v-x.v)*T}}return h.v}function zn(i,p){let h=i.variants&&i.variants[p.group];if(!h)return i;let y={...i,...h};return h.inset&&(y.inset={...i.inset,...h.inset}),h.plate&&(y.plate={...i.plate,...h.plate}),h.children&&i.children&&(y.children=i.children.map((x,d)=>h.children[d]?{...x,...h.children[d]}:x)),delete y.variants,y}function Xn(i){return(p,h,y,x)=>(i.font=$t(y,h,x),i.measureText(p).width)}function Vs(i,p,h,y,x,d){d=Math.max(0,Math.min(d,y/2,x/2)),i.beginPath(),i.moveTo(p+d,h),i.arcTo(p+y,h,p+y,h+x,d),i.arcTo(p+y,h+x,p,h+x,d),i.arcTo(p,h+x,p,h,d),i.arcTo(p,h,p+y,h,d),i.closePath()}function $s(i,p,h){let y=p.w,x=mt(p),d=i.lineLu*x,b=y*(i.paraWidthFrac??.8),T=[],C=0;for(let A of i.rows){let E,F;if(A.gap!=null)E=d*A.gap;else if(A.head!=null)E=d*1.8;else if(A.images!=null)E=(A.images.heightLu??i.lineLu*4)*x+d*.4;else if(A.image!=null)E=(A.image.heightLu??i.lineLu*4)*x+d*.4;else if(A.para!=null){let B=Math.round(d*(i.paraLuFactor??.48));F=h?_s(h,A.para,B,400,i.family||"system",b):[String(A.para)],E=F.length*B*(i.paraLineHeight??1.35)+d*.4}else E=d;T.push({row:A,h:E,lines:F}),C+=E}let L=C+p.h+d;return{rows:T,total:C,travel:L,line:d,u:x,paraW:b}}function hh(i,p,h,y,x,d,b){let T=x.w,C=x.h,{rows:L,travel:A,line:E,u:F}=$s(p,x,d),B=T*(p.gutterFrac??.5),U=(p.colGapLu??3)*F,R=-C+h/y*A;i.save(),i.textBaseline="middle";let M=-R;for(let{row:D,h:_,lines:X}of L)if(M+=_,!(M<-_-E||M>C+_+E)&&D.gap==null)if(D.head!=null)i.fillStyle=p.headColor||"#ffffff",i.textAlign="center",i.font=$t(700,Math.round(E*.6),p.family),i.fillText(String(D.head).toUpperCase(),T/2,M);else if(D.images!=null){let Z=(D.images.heightLu??p.lineLu*4)*F,Q=(p.imageGapLu??3)*F,se=D.images.srcs.map(K=>b?.[K]).filter(Boolean).map(K=>({d:K,w:Z*((K.width||1)/(K.height||1))}));if(se.length){let K=se.reduce((Se,Te)=>Se+Te.w,0)+Q*(se.length-1),fe=T/2-K/2;for(let Se of se)i.drawImage(Se.d,fe,M-Z,Se.w,Z),fe+=Se.w+Q}}else if(D.image!=null){let Z=b?.[D.image.src];if(Z){let Q=(D.image.heightLu??p.lineLu*4)*F,se=D.image.widthLu!=null?D.image.widthLu*F:Q*((Z.width||1)/(Z.height||1));i.drawImage(Z,T/2-se/2,M-Q,se,Q)}}else if(D.para!=null){let Z=Math.round(E*(p.paraLuFactor??.48)),Q=Z*(p.paraLineHeight??1.35);i.font=$t(400,Z,p.family),i.fillStyle=D.color||p.nameColor||"#ffffff",i.textAlign="center";let se=X??[String(D.para)];for(let K=0;K<se.length;K++)i.fillText(se[K],T/2,M-(se.length-1-K)*Q)}else D.text!=null?(i.font=$t(D.weight??500,Math.round(E*.48),p.family),i.fillStyle=D.color||p.nameColor||"#ffffff",i.textAlign="center",i.fillText(String(D.text),T/2,M)):(i.font=$t(400,Math.round(E*.48),p.family),i.fillStyle=p.roleColor||"#b9c2cc",i.textAlign="right",i.fillText(D.role||"",B-U/2,M),i.fillStyle=p.nameColor||"#ffffff",i.textAlign="left",i.fillText(D.name||"",B+U/2,M));i.restore()}function Ra(i){for(let p of i?.elements??[])for(let h of p.rows??[])if(h.image!=null||h.images!=null)return!0;return!1}function js(i,p){let h=i.anim;return{alpha:h?.opacity?rn(h.opacity,p):i.opacity??1,slideLu:h?.slideLu?rn(h.slideLu,p):i.slideLu??0,riseLu:h?.riseLu?rn(h.riseLu,p):i.riseLu??0,scale:h?.scale?rn(h.scale,p):i.scale??1,reveal:h?.reveal?rn(h.reveal,p):i.reveal??1,revealAxis:h?.revealAxis||"x"}}function dh(i,p,h){let y=Math.max(1,i.children?.length??1);for(let x=0;x<y;x++){let d=js(i,p-x*h);if(d.alpha>0&&d.reveal>0)return!0}return!1}function gh(i,p,h,y="",x="x"){if(i.beginPath(),x==="y"){let b=p.h*h,T=y.startsWith("top")?p.y:p.y+p.h-b;i.rect(p.x-2,T,p.w+4,b)}else{let b=p.w*h,T=y.includes("right")?p.x+p.w-b:y.includes("left")?p.x:p.x+(p.w-b)/2;i.rect(T,p.y-2,b,p.h+4)}i.clip()}function Ea(i,p,h,y,x){if(i.translate(p.slideLu*y,p.riseLu*y),p.scale!==1){let d=h.box.x+h.box.w/2,b=h.box.y+h.box.h/2;i.translate(d,b),i.scale(p.scale,p.scale),i.translate(-d,-b)}p.reveal<1&&gh(i,h.box,p.reveal,x,p.revealAxis)}function Ws(i,p,h,y,x,d){let b=y.w,T=y.h,C=mt(y);i.clearRect(0,0,b,T),p.bg&&(i.fillStyle=p.bg,i.fillRect(0,0,b,T));let L=nn(y,p.actionPct);for(let A of p.elements){let E=zn(A,y);if(E.type==="crawl"){hh(i,E,h,p.duration,y,x,d);continue}let F=E.stagger??0,B=js(E,h);if(!dh(E,h,F))continue;let U=$n(y,E,x,{safe:L});if(U.plate&&E.plate&&B.alpha>0){i.save(),Ea(i,B,U,C,E.anchor),i.globalAlpha=B.alpha;let R=U.plate,M=E.plate;if(M.color){if(M.colorB){let D=i.createLinearGradient(R.x,0,R.x+R.w,0);D.addColorStop(0,M.color),D.addColorStop(1,M.colorB),i.fillStyle=D}else i.fillStyle=M.color;Vs(i,R.x,R.y,R.w,R.h,R.radiusPx),i.fill()}if(M.stroke){let D=Math.max(1,(M.strokeLu??.25)*C);i.strokeStyle=M.stroke,i.lineWidth=D,Vs(i,R.x+D/2,R.y+D/2,R.w-D,R.h-D,Math.max(0,R.radiusPx-D/2)),i.stroke()}M.accent&&(i.fillStyle=M.accent,Vs(i,R.x,R.y,Math.max(2,(M.accentLu??.7)*C),R.h,R.radiusPx),i.fill()),i.restore()}for(let R=0;R<U.runs.length;R++){let M=U.runs[R],D=F?js(E,h-R*F):B;if(!(D.alpha<=0)){i.save(),Ea(i,D,U,C,E.anchor),i.globalAlpha=D.alpha,i.textBaseline="top",i.font=$t(M.run.weight??400,M.fontPx,M.family),i.fillStyle=M.run.color||"#ffffff",i.textAlign=M.align;for(let _=0;_<M.lines.length;_++)i.fillText(M.lines[_],M.x,M.y+_*M.lineHeightPx);i.restore()}}}i.globalAlpha=1}var ci=ih(Fa(),1);import{createCanvas as cn,GlobalFonts as po,loadImage as li}from"@napi-rs/canvas";import{Buffer as $h}from"node:buffer";import{Worker as zh}from"node:worker_threads";import{existsSync as Xh}from"node:fs";var zs=[{id:"16x9",label:"16 : 9 \xB7 Landscape master",w:1920,h:1080,group:"landscape"},{id:"9x16",label:"9 : 16 \xB7 Reels / Stories / Shorts",w:1080,h:1920,group:"portrait",chrome:{right:.14,bottom:.18}},{id:"1x1",label:"1 : 1 \xB7 Square feed",w:1080,h:1080,group:"square"},{id:"4x5",label:"4 : 5 \xB7 Portrait feed",w:1080,h:1350,group:"portrait"},{id:"2x3",label:"2 : 3 \xB7 Portrait / Pinterest",w:1080,h:1620,group:"portrait"},{id:"4x3",label:"4 : 3 \xB7 Broadcast / legacy",w:1440,h:1080,group:"landscape"},{id:"239x1",label:"2.39 : 1 \xB7 Scope / cinema",w:2048,h:858,group:"landscape"}],Xs=Object.fromEntries(zs.map(i=>[i.id,i])),Cd=Xs["16x9"],mh=[{id:"hd",label:"HD (1080)",factor:1},{id:"uhd",label:"UHD (2160)",factor:2}],Ua=Object.fromEntries(mh.map(i=>[i.id,i])),Da=i=>2*Math.round(i/2);function Ma(i,p){return p===1?i:{...i,w:Da(i.w*p),h:Da(i.h*p)}}var Pa=i=>i.includes("left")?"left":i.includes("right")?"right":"center",Lt=(i,p,h)=>[{t:0,v:0},{t:p,v:1,ease:"outCubic"},{t:i-h,v:1},{t:i,v:0,ease:"linear"}],qn=(i,p,h,y,x,d="outBack",b="outCubic")=>[{t:0,v:y},{t:p,v:0,ease:d},{t:i-h,v:0},{t:i,v:x,ease:b}],Ys={slide:({duration:i,anchor:p,inT:h,outT:y,dist:x})=>{let d=Pa(p);if(d==="center")return{opacity:Lt(i,h,y),riseLu:qn(i,h,y,x*.7,x*.4)};let b=d==="right"?1:-1;return{opacity:Lt(i,h,y),slideLu:qn(i,h,y,b*x,b*x*.6)}},fade:({duration:i,inT:p,outT:h})=>({opacity:Lt(i,p,h)}),rise:({duration:i,inT:p,outT:h,dist:y})=>({opacity:Lt(i,p,h),riseLu:qn(i,p,h,y*.7,y*.4)}),pop:({duration:i,inT:p,outT:h})=>({opacity:Lt(i,p,h),scale:[{t:0,v:.72},{t:p,v:1,ease:"outBack"},{t:i-h,v:1},{t:i,v:.88,ease:"outCubic"}]}),wipe:({duration:i,inT:p,outT:h})=>({opacity:[{t:0,v:1},{t:i-h,v:1},{t:i,v:1}],reveal:[{t:0,v:0},{t:p,v:1,ease:"outCubic"},{t:i-h,v:1},{t:i,v:0,ease:"inOutCubic"}],revealAxis:"x"}),wipeUp:({duration:i,inT:p,outT:h})=>({opacity:[{t:0,v:1},{t:i-h,v:1},{t:i,v:1}],reveal:[{t:0,v:0},{t:p,v:1,ease:"outCubic"},{t:i-h,v:1},{t:i,v:0,ease:"inOutCubic"}],revealAxis:"y"}),expand:({duration:i,inT:p,outT:h})=>({opacity:Lt(i,p*.6,h*.6),reveal:[{t:0,v:.12},{t:p,v:1,ease:"outCubic"},{t:i-h,v:1},{t:i,v:.12,ease:"outCubic"}],revealAxis:"x"}),none:()=>({}),drift:({duration:i,anchor:p,inT:h,outT:y,dist:x})=>{let d=Pa(p),T=d==="center"?0:(d==="right"?1:-1)*x*.5;return{opacity:Lt(i,h,y),[d==="center"?"riseLu":"slideLu"]:qn(i,h,y,T||x*.5,(T||x*.5)*1.6,"outCubic","linear")}}},Ld=(()=>{let i=new Set,p=h=>{if(Array.isArray(h)){for(let y of h)p(y);return}if(h&&typeof h=="object"){typeof h.ease=="string"&&i.add(h.ease);for(let y of Object.values(h))p(y)}};for(let h of Object.values(Ys))for(let y of["bottom-left","bottom","bottom-right"])p(h({duration:6,anchor:y,inT:.5,outT:.5,dist:4}));return[...i]})(),Ba=[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"rise",label:"Rise"},{id:"pop",label:"Pop"},{id:"drift",label:"Drift"},{id:"wipe",label:"Wipe"},{id:"wipeUp",label:"Wipe up"},{id:"expand",label:"Expand"},{id:"none",label:"None (hold)"}],yh=[{id:"none",label:"Together",seconds:0},{id:"subtle",label:"Subtle",seconds:.06},{id:"clear",label:"Clear",seconds:.12},{id:"slow",label:"Slow",seconds:.2}],Ed=Object.fromEntries(yh.map(i=>[i.id,i]));function Zn(i,{duration:p,anchor:h="bottom-left",inT:y=.55,outT:x=.5,dist:d=3.5,ease:b}={}){let T=(Ys[i]||Ys.slide)({duration:p,anchor:h,inT:y,outT:x,dist:d});if(!b)return T;let C={};for(let[L,A]of Object.entries(T)){if(!Array.isArray(A)){C[L]=A;continue}C[L]=A.map((E,F)=>F===1&&E.ease?{...E,ease:b}:E)}return C}var an={solid:(i,{radiusLu:p,padLu:h})=>({color:i,padLu:h,radiusLu:p}),gradient:(i,{radiusLu:p,padLu:h})=>({color:i,colorB:`${i}00`,padLu:h,radiusLu:p}),tick:(i,{radiusLu:p,padLu:h})=>({color:i,colorB:`${i}00`,accent:i,padLu:h,radiusLu:p}),outline:(i,{radiusLu:p,padLu:h})=>({stroke:i,strokeLu:.28,padLu:h,radiusLu:p}),scrim:(i,{radiusLu:p,padLu:h})=>({color:"#000000a6",accent:i,accentLu:.55,padLu:h,radiusLu:p}),rule:(i,{padLu:p})=>({accent:i,accentLu:.9,padLu:p,radiusLu:0}),none:()=>{}},_a=Object.keys(an).map(i=>({id:i,label:i[0].toUpperCase()+i.slice(1)})),qs=(i,p)=>p?String(i).toUpperCase():i;function bh({name:i="Ava Reyes",title:p="Director of Photography",duration:h=6,anchor:y="bottom-left",color:x="#0a84ff",nameColor:d="#ffffff",titleColor:b="#cfe0ff",nameLu:T=5.4,titleLu:C=3.2,family:L="system",center:A=!1,style:E="slide",stagger:F=0,plate:B="tick",radiusLu:U=1.2,padLu:R=2.4,uppercase:M=!1,tracking:D=0,ease:_}={}){let X={type:"group",anchor:y,inset:{x:4,y:5},gapLu:1.1,maxWidthLu:62,stagger:F,plate:(an[B]??an.tick)(x,{radiusLu:U,padLu:R}),anim:Zn(E,{duration:h,anchor:y,ease:_}),children:[{text:qs(i,M),sizeLu:T,weight:700,color:d,family:L,lineHeight:1.1,tracking:D},{text:p,sizeLu:C,weight:500,color:b,family:L,lineHeight:1.15,tracking:D}]};if(A){let Z=y.startsWith("top")?"top":y.startsWith("bottom")?"bottom":"center",Q=(se,K,fe)=>({anchor:Z,inset:{y:K},maxWidthLu:fe,plate:{accent:null},children:[{sizeLu:T+se,align:"center"},{sizeLu:C+se*.5,align:"center"}]});X.variants={square:Q(.6,8,76),portrait:Q(1,11,80)}}return{duration:h,elements:[X]}}function xh({text:i="*Terms and conditions apply. Offer ends 12/31/26. Financing from 3.9% APR for qualified buyers. See dealer for details. \xA92026 Acme Corp.",duration:p=6,anchor:h="bottom",align:y="left",color:x="#ffffff",sizeLu:d=2,minLu:b=1.6,sizeHpct:T=null,family:C="system",scrim:L=!1,style:A="fade"}={}){return{duration:p,elements:[{type:"group",anchor:h,inset:{x:5,y:5},gapLu:.4,plate:L?{color:"#00000073",padLu:1.6,radiusLu:.5}:void 0,anim:Zn(A,{duration:p,anchor:h,inT:.35,outT:.35,dist:1.2}),children:[{text:i,sizeLu:d,minLu:b,sizeHpct:T,weight:500,color:x,family:C,lineHeight:1.28,align:y}]}]}}function vh({location:i="PARIS, FRANCE",sub:p="EXT. \u2014 DAY",duration:h=5,anchor:y="top-left",color:x="#000000cc",locColor:d="#ffffff",subColor:b="#a8b3bf",locLu:T=3.6,subLu:C=2.4,family:L="mono",style:A="slide",stagger:E=0,plate:F="solid",radiusLu:B=.8,padLu:U=1.8,uppercase:R=!1,tracking:M=.04,ease:D}={}){return{duration:h,elements:[{type:"group",anchor:y,inset:{x:3,y:3},gapLu:.6,maxWidthLu:50,stagger:E,plate:(an[F]??an.solid)(x,{radiusLu:B,padLu:U}),anim:Zn(A,{duration:h,anchor:y,inT:.4,outT:.4,dist:2.2,ease:D}),children:[{text:qs(i,R),sizeLu:T,weight:700,color:d,family:L,tracking:M},...p?[{text:qs(p,R),sizeLu:C,weight:400,color:b,family:L,tracking:M}]:[]]}]}}var Sh=`# Directed By
5
+ Director | Ava Reyes
6
+ # Cast
7
+ Lead | Jordan Blake
8
+ Support | Sam Okafor
9
+ # Post Production
10
+ Editor | Dana Liu
11
+ Colorist | Priya Nair
12
+ VFX | Marco Vitale
13
+ # Music
14
+ Composer | Th\xE9o Marchand`;function kh(i,p={}){let h=/[\t|]/,y=String(i??"").split(`
15
+ `),x=p.capsHeads??y.some(b=>h.test(b)&&!b.trim().startsWith("#")),d=[];for(let b of y){let T=b.trim();if(!T){if(!d.length)continue;let C=d[d.length-1];C.gap!=null?C.gap+=.5:d.push({gap:.5});continue}if(T.startsWith("#")){d.push({head:T.slice(1).trim()});continue}if(T.startsWith(">")){d.push({para:T.slice(1).trim()});continue}if(T.startsWith("@image")){let C=T.slice(6).trim(),L=C.match(/^(.*?)(?:\s+(\d+(?:\.\d+)?))?$/),A=(L?.[1]??C).trim(),E=L?.[2]?Number(L[2]):void 0,F=A.split("|").map(B=>B.trim()).filter(Boolean);F.length===1?d.push({image:{src:F[0],heightLu:E}}):F.length>1&&d.push({images:{srcs:F,heightLu:E}});continue}if(h.test(T)){let C=T.split(h).map(L=>L.trim());d.push({role:C[0]||"",name:C.slice(1).filter(Boolean).join(" ")});continue}if(x&&T===T.toUpperCase()&&/[A-Z]/.test(T)){d.push({head:T});continue}d.push({text:T})}for(;d.length&&d[d.length-1].gap!=null;)d.pop();return d}function Th({credits:i=Sh,duration:p=12,lineLu:h=5.2,colGapLu:y=3,gutterFrac:x=.5,paraWidthFrac:d=.8,paraLineHeight:b=1.35,headColor:T="#ffffff",nameColor:C="#ffffff",roleColor:L="#b9c2cc",family:A="system"}={}){let E=Array.isArray(i)?i:kh(i);return{duration:p,elements:[{type:"crawl",rows:E,lineLu:h,colGapLu:y,gutterFrac:x,paraWidthFrac:d,paraLineHeight:b,headColor:T,nameColor:C,roleColor:L,family:A}]}}var wh=[{id:"lowerThird",label:"Lower Third",base:"lower_third",make:bh,fan:"positions",defaultPositions:["bottom-left","bottom","bottom-right"],look:{accent:["color"],primary:["nameColor"],secondary:["titleColor"]},takes:["family","style","stagger","plate","radiusLu","padLu","uppercase","tracking","ease"]},{id:"locator",label:"Locator",base:"locator",make:vh,fan:"positions",defaultPositions:["top-left","top-right"],look:{accent:["color"],primary:["locColor"],secondary:["subColor"]},takes:["family","style","stagger","plate","radiusLu","padLu","uppercase","tracking","ease"]},{id:"legalLine",label:"Legal Line",base:"legal",make:xh,fan:"positions",defaultPositions:["bottom"],look:{primary:["color"]},takes:["family","style"]},{id:"endCrawl",label:"End Crawl",base:"end_crawl",make:Th,fan:"none",defaultPositions:[],look:{primary:["headColor","nameColor"],secondary:["roleColor"]},takes:["family"]}],Zs=Object.fromEntries(wh.map(i=>[i.id,i])),Ks=[{id:"top-left",label:"Left",slug:"top_left",band:"top"},{id:"top",label:"Center",slug:"top_center",band:"top"},{id:"top-right",label:"Right",slug:"top_right",band:"top"},{id:"left",label:"Left",slug:"middle_left",band:"middle"},{id:"center",label:"Center",slug:"middle_center",band:"middle"},{id:"right",label:"Right",slug:"middle_right",band:"middle"},{id:"bottom-left",label:"Left",slug:"bottom_left",band:"bottom"},{id:"bottom",label:"Center",slug:"bottom_center",band:"bottom"},{id:"bottom-right",label:"Right",slug:"bottom_right",band:"bottom"}],Na=Object.fromEntries(Ks.map(i=>[i.id,i]));function Ga(i,p={},h){let y=Zs[i];if(!y)throw new Error(`unknown graphic type: ${i}`);if(y.fan!=="positions")return[{key:"main",scene:y.make(p)}];let x=(h??y.defaultPositions).filter(d=>Na[d]);return x.length?x.map(d=>({position:Na[d],scene:y.make({...p,anchor:d})})):[{key:"main",scene:y.make(p)}]}var Qs=["family","style","stagger","ease","plate","radiusLu","padLu","uppercase","tracking"],Ha=["accent","primary","secondary"],Va=[...Ha,...Qs],Js={family:"inter",accent:"#0a84ff",primary:"#ffffff",secondary:"#cfe0ff",style:"slide",stagger:.06,ease:"outBack",plate:"tick",radiusLu:1.2,padLu:2.4,uppercase:!1,tracking:0},eo=[{id:"studio",label:"Studio",note:"The house default \u2014 a gradient slab with an accent rule.",look:{...Js}},{id:"broadcast",label:"Broadcast",note:"Hard-edged scrim, no radius, tracked caps. Reads at any size.",look:{family:"condensed",accent:"#e11d2e",primary:"#ffffff",secondary:"#c9ced6",style:"wipe",stagger:.05,ease:"outExpo",plate:"scrim",radiusLu:0,padLu:2.2,uppercase:!0,tracking:.08}},{id:"editorial",label:"Editorial",note:"Serif on a hairline outline. Nothing shouts.",look:{family:"instrument",accent:"#e8e2d4",primary:"#f7f4ec",secondary:"#b3ab99",style:"fade",stagger:.12,ease:"outSine",plate:"outline",radiusLu:.2,padLu:2.8,uppercase:!1,tracking:.01}},{id:"social",label:"Social",note:"Fat pill, bright fill, springs in. Built for a small screen.",look:{family:"inter",accent:"#7c3aed",primary:"#ffffff",secondary:"#ddd0ff",style:"pop",stagger:.06,ease:"outSpring",plate:"solid",radiusLu:3.2,padLu:2.8,uppercase:!1,tracking:0}},{id:"documentary",label:"Documentary",note:"A rule and nothing else. The type carries it.",look:{family:"inter",accent:"#f5c451",primary:"#ffffff",secondary:"#b8b2a4",style:"rise",stagger:.14,ease:"outQuart",plate:"rule",radiusLu:0,padLu:1.6,uppercase:!1,tracking:.015}},{id:"terminal",label:"Terminal",note:"Mono caps in a boxed outline. Technical, deliberate.",look:{family:"jetmono",accent:"#31e07f",primary:"#d8ffe9",secondary:"#5f8f76",style:"wipeUp",stagger:.04,ease:"outCirc",plate:"outline",radiusLu:0,padLu:2,uppercase:!0,tracking:.06}},{id:"minimal",label:"Minimal",note:"No plate at all. Drifts on, drifts off.",look:{family:"inter",accent:"#ffffff",primary:"#ffffff",secondary:"#9aa2ad",style:"drift",stagger:.1,ease:"outSine",plate:"none",radiusLu:0,padLu:0,uppercase:!1,tracking:.02}},{id:"noir",label:"Noir",note:"Condensed caps, deep scrim, slow. For titles over picture.",look:{family:"condensed",accent:"#c8a24a",primary:"#f4efe3",secondary:"#9b917c",style:"expand",stagger:.2,ease:"inOutCubic",plate:"scrim",radiusLu:.4,padLu:3,uppercase:!0,tracking:.12}}],ja=Object.fromEntries(eo.map(i=>[i.id,i]));function $a(i,p,h,y={}){let x=new Set(y.skip??[]),d=new Set(i?.takes??Qs),b={...p};for(let C of Qs)x.has(C)||!d.has(C)||h[C]!==void 0&&(b[C]=h[C]);let T=i?.look??{};for(let C of Ha)if(!(x.has(C)||h[C]===void 0))for(let L of T[C]??[])b[L]=h[C];return b}function Wa(i,p={}){let h={kind:"gfx.look",version:1,...p};for(let y of Va)i[y]!==void 0&&(h[y]=i[y]);return h}function za(i){let p=typeof i=="string"?JSON.parse(i):i;if(!p||typeof p!="object")throw new Error("not a look");if(p.kind!==void 0&&p.kind!=="gfx.look")throw new Error(`not a look (kind: ${JSON.stringify(p.kind)})`);let h={};for(let y of Va)p[y]!==void 0&&(h[y]=p[y]);if(!Object.keys(h).length)throw new Error("that look file carries no recognised fields");return{look:h,label:typeof p.label=="string"?p.label:void 0}}var Xa=(i,p,h)=>{let y=p.position?p.position.slug:p.key||"main",x=h.id===`${h.w}x${h.h}`?h.id:`${h.id}_${h.w}x${h.h}`;return`${i}/${y}/${i}_${y}_${x}.mov`};function to(i){let p=[],h=[],y="",x=!1,d=String(i??"").replace(/\r\n?/g,`
16
+ `);for(let b=0;b<d.length;b++){let T=d[b];if(x){T==='"'?d[b+1]==='"'?(y+='"',b++):x=!1:y+=T;continue}if(T==='"'){x=!0;continue}if(T===","){h.push(y),y="";continue}if(T===`
17
+ `){h.push(y),p.push(h),h=[],y="";continue}y+=T}for(h.push(y),p.push(h);p.length&&p[p.length-1].every(b=>b.trim()==="");)p.pop();return p.map(b=>b.map(T=>T.trim()))}var Ch={section:["section","head","heading","category","group"],role:["role","job title","job","position","credit","department"],name:["name","name/company","person","company","crew","value"],text:["text","line","centered"],note:["paragraph","special thanks","special thanks text","thanks","blurb"],kind:["type","graphic","kind"]};function Ya(i){let p={};return i.forEach((h,y)=>{let x=h.toLowerCase().trim();for(let[d,b]of Object.entries(Ch))b.includes(x)&&p[d]===void 0&&(p[d]=y)}),p}function Oh(i){let p=Ya(i);return Object.keys(p).length>=2||p.role!==void 0&&p.name!==void 0}function qa(i){let p=to(i),h=[];if(!p.length)return{text:"",warnings:["No credit rows were recognised in that file."],imported:0};let y=Oh(p[0]),x=y?Ya(p[0]):{},d=y?p.slice(1):p,b=!y||x.role===void 0&&x.name===void 0&&x.section===void 0&&x.text===void 0&&x.note===void 0;if(y){let E=p[0].length,F=d.filter(B=>B.some(U=>U!=="")&&B.length!==E).length;F&&h.push(`${F} row${F===1?"":"s"} had a different number of columns than the header \u2014 check that the right cells landed in the right place.`)}let T=[],C=null,L=E=>{E===""&&(T.length===0||T[T.length-1]==="")||T.push(E)};for(let E of d){if(E.every(_=>_==="")){L("");continue}let F=_=>_===void 0?"":(E[_]??"").trim();if(x.kind!==void 0){let _=F(x.kind).toLowerCase();if(_&&!_.startsWith("credit"))continue}if(b){let[_="",X=""]=E;_&&X?L(`${_} | ${X}`):_?L(_):X&&L(X);continue}let B=F(x.section),U=F(x.role),R=F(x.name),M=F(x.text),D=F(x.note);B&&B!==C&&(T.length&&L(""),L(`# ${B}`),C=B),U&&R?L(`${U} | ${R}`):(U||R)&&L(U||R),M&&L(M),D&&L(`> ${D}`)}for(;T.length&&T[T.length-1]==="";)T.pop();let A=T.join(`
18
+ `);return A||h.push("No credit rows were recognised in that file."),{text:A,warnings:h,imported:T.filter(E=>E!=="").length}}var Lh=(()=>{let i=new Uint32Array(256);for(let p=0;p<256;p++){let h=p;for(let y=0;y<8;y++)h=h&1?3988292384^h>>>1:h>>>1;i[p]=h>>>0}return i})();function Eh(i){let p=4294967295;for(let h=0;h<i.length;h++)p=Lh[(p^i[h])&255]^p>>>8;return(p^4294967295)>>>0}function no(i){let p=new TextEncoder,h=[],y=[],x=0,d=R=>new Uint8Array([R&255,R>>>8&255]),b=R=>new Uint8Array([R&255,R>>>8&255,R>>>16&255,R>>>24&255]),T=(R,...M)=>{for(let D of M)R.push(D instanceof Uint8Array?D:new Uint8Array(D))};for(let R of i){let M=p.encode(R.name),D=Eh(R.data),_=R.data.length,X=[];T(X,b(67324752),d(20),d(0),d(0),d(0),d(0),b(D),b(_),b(_),d(M.length),d(0),M,R.data);for(let Z of X)h.push(Z);T(y,b(33639248),d(20),d(20),d(0),d(0),d(0),d(0),b(D),b(_),b(_),d(M.length),d(0),d(0),d(0),d(0),b(0),b(x),M),x+=X.reduce((Z,Q)=>Z+Q.length,0)}let C=x,L=y.reduce((R,M)=>R+M.length,0),A=[];T(A,b(101010256),d(0),d(0),d(i.length),d(i.length),b(L),b(C),d(0));let E=[...h,...y,...A],F=E.reduce((R,M)=>R+M.length,0),B=new Uint8Array(F),U=0;for(let R of E)B.set(R,U),U+=R.length;return B}var oe=i=>({a:0,k:i}),re=(i,p=3)=>{let h=10**p;return Math.round(i*h)/h};function Et(i){let p=String(i).replace("#","").trim();p.length===3&&(p=p.split("").map(b=>b+b).join(""));let h=parseInt(p.slice(0,2),16)/255,y=parseInt(p.slice(2,4),16)/255,x=parseInt(p.slice(4,6),16)/255,d=p.length>=8?parseInt(p.slice(6,8),16)/255:1;return{c:[re(h),re(y),re(x)],a:re(d)}}function Kn(i,p,h){if(!i||!i.length)return oe(h(0));if(i.length===1)return oe(h(i[0].v));let y=[];for(let x=0;x<i.length;x++){let d=i[x],b=i[x+1];if(y.push({t:re(d.t*p,3),s:h(d.v),o:jt(b?b.ease:"linear").o,i:jt(x>0?d.ease:"linear").i}),b&&wa(b.ease)){let T=d.t,C=b.t,L=d.v,A=b.v;for(let E of Ca(b.ease))y.push({t:re((T+(C-T)*E.x)*p,3),s:h(L+(A-L)*E.y),o:jt("linear").o,i:jt("linear").i})}}return{a:1,k:y}}var Ka=0,Jn=()=>++Ka;function oo(i,p,h,y,x){let d=i?.opacity?Kn(i.opacity,x,C=>[re(C*100,2)]):oe(100),b=i?.scale?Kn(i.scale,x,C=>[re(C*100,2),re(C*100,2),100]):oe([100,100,100]),T;return i?.slideLu?T=Kn(i.slideLu,x,C=>[re(p+C*y,2),re(h,2)]):i?.riseLu?T=Kn(i.riseLu,x,C=>[re(p,2),re(h+C*y,2)]):T=oe([re(p,2),re(h,2)]),{o:d,r:oe(0),p:T,a:oe([0,0,0]),s:b}}var Qa=()=>({ty:"tr",p:oe([0,0]),a:oe([0,0]),s:oe([100,100]),r:oe(0),o:oe(100)}),Za=(i,p)=>({ty:"gr",nm:p,it:[...i,Qa()]});function Rh(i,p){if(!i._colorB){let{c:d,a:b}=Et(i._color);return{ty:"fl",c:oe([...d,1]),o:oe(re(b*100,2)),r:1,bm:0,nm:"fill"}}let h=Et(i._color),y=Et(i._colorB),x=[0,...h.c,1,...y.c,0,h.a,1,y.a].map(d=>re(d,4));return{ty:"gf",o:oe(100),r:1,bm:0,nm:"grad",t:1,g:{p:2,k:oe(x)},s:oe([re(-p/2,2),0]),e:oe([re(p/2,2),0])}}function Ah(i,p,h,y,x){let d=i.x+i.w/2,b=i.y+i.h/2,T=re(i.w,2),C=re(i.h,2),L=re(i.radiusPx||0,2),A=[];if(i._accent){let E=Math.max(2,.7*h),{c:F}=Et(i._accent);A.push(Za([{ty:"rc",d:1,s:oe([re(E,2),C]),p:oe([re(-T/2+E/2,2),0]),r:oe(L)},{ty:"fl",c:oe([...F,1]),o:oe(100),r:1,bm:0,nm:"accent"}],"accent"))}return A.push(Za([{ty:"rc",d:1,s:oe([T,C]),p:oe([0,0]),r:oe(L)},Rh(i,T)],"plate")),{ddd:0,ind:Jn(),ty:4,nm:"plate",mn:"tbd:role:plate",sr:1,ks:oo(p,d,b,h,y),ao:0,ip:0,op:x,st:0,bm:0,shapes:A}}function Ih(i){let p=[],h=null,y=null,x=()=>{h&&h.v.length&&p.push({ty:"sh",ks:{a:0,k:{i:h.i,o:h.o,v:h.v,c:!0}}}),h=null};for(let d of i)if(d.type==="M")x(),h={v:[[d.x,d.y]],i:[[0,0]],o:[[0,0]]},y=[d.x,d.y];else if(d.type==="L")h.v.push([d.x,d.y]),h.i.push([0,0]),h.o.push([0,0]),y=[d.x,d.y];else if(d.type==="C"){let b=h.v.length-1;h.o[b]=[d.x1-y[0],d.y1-y[1]],h.v.push([d.x,d.y]),h.i.push([d.x2-d.x,d.y2-d.y]),h.o.push([0,0]),y=[d.x,d.y]}else if(d.type==="Q"){let b=h.v.length-1,T=y,C=[d.x,d.y];h.o[b]=[2/3*(d.x1-T[0]),2/3*(d.y1-T[1])],h.v.push(C),h.i.push([2/3*(d.x1-C[0]),2/3*(d.y1-C[1])]),h.o.push([0,0]),y=C}else d.type==="Z"&&x();return x(),p}function Fh(i,p,h,y,x,d){let b=i.fontPx,T=i.lineHeightPx,C=[];i.lines.forEach((E,F)=>{let B=d.getAdvanceWidth(E,b),U=i.align==="center"?-B/2:i.align==="right"?-B:0,R=d.getPath(E,U,F*T,b);C.push(...Ih(R.commands))});let{c:L}=Et(i.run.color||"#ffffff");C.push({ty:"fl",c:oe([...L,1]),o:oe(100),r:1,bm:0,nm:"fill"}),C.push(Qa());let A=i.y+b*.8;return{ddd:0,ind:Jn(),ty:4,nm:`text:${i.run.text?.slice(0,16)||""}`,mn:"tbd:role:text",sr:1,ks:oo(p,i.x,A,h,y),ao:0,ip:0,op:x,st:0,bm:0,shapes:[{ty:"gr",nm:"glyphs",it:C}]}}function Dh(i,p,h,y,x,d){let{c:b}=Et(i.run.color||"#ffffff"),T=i.align==="center"?2:i.align==="right"?1:0,C=i.y+i.fontPx*.8;return{ddd:0,ind:Jn(),ty:5,nm:`text:${i.run.text?.slice(0,16)||""}`,mn:"tbd:role:text",sr:1,ks:oo(p,i.x,C,h,y),ao:0,ip:0,op:x,st:0,bm:0,t:{d:{k:[{t:0,s:{t:i.lines.join("\r"),f:d,s:re(i.fontPx,2),fc:b,j:T,tr:re((i.run.tracking||0)*1e3,1),lh:re(i.lineHeightPx,2),ls:0,of:!1}}]},p:{},m:{g:1,a:oe([0,0])},a:[]}}}function Uh(i,p,h,y,x,d){let b=p.w,T=p.h,{rows:C,travel:L,line:A}=$s(i,p,d),E=b*(i.gutterFrac??.5),F=(i.colGapLu??3)*h,B=jt("linear"),U=(X,Z,Q)=>({a:1,k:[{t:0,s:[re(X,2),re(Z+T+Q,2)],o:B.o,i:B.i},{t:x,s:[re(X,2),re(Z+T+Q-L,2)]}]}),R=(X,Z,Q,se,K,fe)=>({ddd:0,ind:Jn(),ty:5,nm:`crawl:${String(X).slice(0,12)}`,mn:"tbd:role:crawl",sr:1,ks:{o:oe(100),r:oe(0),p:U(Z,Q,se*.35),a:oe([0,0,0]),s:oe([100,100,100])},ao:0,ip:0,op:x,st:0,bm:0,t:{d:{k:[{t:0,s:{t:String(X),f:ro(i.family),s:re(se,2),fc:Et(K).c,j:fe,tr:0,lh:re(se,2),ls:0,of:!1}}]},p:{},m:{g:1,a:oe([0,0])},a:[]}}),M=[],D=0,_=Math.round(A*.48);for(let{row:X,h:Z,lines:Q}of C)if(D+=Z,X.gap==null&&!(X.image!=null||X.images!=null))if(X.head!=null)M.push(R(String(X.head).toUpperCase(),b/2,D,Math.round(A*.6),i.headColor||"#ffffff",2));else if(X.para!=null){let se=_*(i.paraLineHeight??1.35),K=Q??[String(X.para)];for(let fe=0;fe<K.length;fe++)M.push(R(K[fe],b/2,D-(K.length-1-fe)*se,_,X.color||i.nameColor||"#ffffff",2))}else X.text!=null?M.push(R(String(X.text),b/2,D,_,X.color||i.nameColor||"#ffffff",2)):(M.push(R(X.role||"",E-F/2,D,_,i.roleColor||"#b9c2cc",1)),M.push(R(X.name||"",E+F/2,D,_,i.nameColor||"#ffffff",0)));return M}function Ja(i,p,h,y={}){Ka=0;let x=mt(p),d=y.fps??30,b=Math.max(1,Math.round(i.duration*d)),T=nn(p,i.actionPct),C=[];for(let L of i.elements){let A=zn(L,p);if(A.type==="crawl"){for(let F of Uh(A,p,x,d,b,h))C.push(F);continue}if(A.type!=="group")continue;let E=$n(p,A,h,{safe:T});for(let F of E.runs){let B=Mh(y.fonts,F.family,F.run.weight);C.push(B?Fh(F,A.anim,x,d,b,B):Dh(F,A.anim,x,d,b,ro(F.family)))}E.plate&&A.plate&&(E.plate._color=A.plate.color,E.plate._colorB=A.plate.colorB,E.plate._accent=A.plate.accent,C.push(Ah(E.plate,A.anim,x,d,b)))}return{v:"5.9.0",fr:d,ip:0,op:b,w:p.w,h:p.h,nm:y.name||"gfx",ddd:0,assets:[],layers:C,fonts:{list:Bh(i,p,h)},meta:{g:"tbd-gfx",tbdGfx:{profile:1,format:p.id,scene:so(i),...y.look?{look:so(y.look)}:{}}}}}var so=i=>typeof structuredClone=="function"?structuredClone(i):JSON.parse(JSON.stringify(i));function ei(i){let p=i?.meta?.tbdGfx?.look;return p&&typeof p=="object"?so(p):null}var ro=i=>`tbd-${i||"system"}`,Qn=(i,p)=>`${i||"system"}:${p??400}`;function Mh(i,p,h){if(i)return i[Qn(p,h)]??i[Qn(p,400)]??i[p||"system"]??i.system}var Ph={system:"Arial",mono:"Courier New",serif:"Georgia"};function Bh(i,p){let h=new Set(["system"]);for(let y of i.elements){let x=zn(y,p);if(x.type==="crawl"){h.add(x.family||"system");continue}if(x.type==="group")for(let d of x.children||[])h.add(d.family||"system")}return[...h].map(y=>({fName:ro(y),fFamily:Ph[y]||"Arial",fStyle:"Regular",ascent:75}))}var Nh="1.0.0",_h=i=>String(i).replace(/\.[a-z0-9]+$/i,"").replace(/[^a-zA-Z0-9_-]+/g,"_").replace(/^_+|_+$/g,"")||"animation";function ti(i,p={}){if(!i?.length)throw new Error("a .lottie needs at least one animation");let h=p.loop??!0,y=p.autoplay??!0,x=p.speed??1,d=new Set,b=[],T=[];for(let L of i){let A=_h(L.id);if(d.has(A)){let E=2;for(;d.has(`${A}_${E}`);)E++;A=`${A}_${E}`}d.add(A),T.push({id:A,direction:1,speed:x,playMode:"normal",loop:h,autoplay:y}),b.push({name:`animations/${A}.json`,data:new TextEncoder().encode(JSON.stringify(L.data))})}let C={version:Nh,generator:p.generator??"conform.tools/gfx",revision:1,animations:T};return b.unshift({name:"manifest.json",data:new TextEncoder().encode(JSON.stringify(C))}),no(b)}var si=new Set([".ttf",".otf",".ttc",".otc"]),Ge=(i,p)=>i[p]<<8|i[p+1],yt=(i,p)=>(i[p]<<24>>>0)+(i[p+1]<<16)+(i[p+2]<<8)+i[p+3],ln=(i,p)=>String.fromCharCode(i[p],i[p+1],i[p+2],i[p+3]);async function Gh(i){let p=await i(0,12);if(p.length<12)return[];if(ln(p,0)==="ttcf"){let y=Math.min(yt(p,8),256),x=await i(12,4*y);return Array.from({length:y},(d,b)=>yt(x,4*b))}return yt(p,0)===65536||ln(p,0)==="OTTO"||ln(p,0)==="true"?[0]:[]}async function Hh(i,p){let h=await i(p,12),y=Ge(h,4),x=await i(p+12,16*y),d=new Map;for(let b=0;b<y;b++)d.set(ln(x,16*b),{offset:yt(x,16*b+8),length:yt(x,16*b+12)});return d}function Vh(i){let p=Ge(i,2),h=Ge(i,4),y=new Map;for(let x=0;x<p;x++){let d=6+12*x,b=Ge(i,d),T=Ge(i,d+2),C=Ge(i,d+4),L=Ge(i,d+6),A=Ge(i,d+8),E=Ge(i,d+10);if(![1,2,4,16,17].includes(L))continue;let F=i.subarray(h+E,h+E+A),B,U;if(b===3&&(T===1||T===0)){B=C===1033?0:2,U="";for(let M=0;M+1<F.length;M+=2)U+=String.fromCharCode(F[M]<<8|F[M+1])}else if(b===1&&T===0)B=C===0?1:3,U=new TextDecoder("latin1").decode(F);else continue;let R=y.get(L);(!R||B<R.rank)&&y.set(L,{rank:B,s:U})}return new Map([...y].map(([x,d])=>[x,d.s]))}async function ao(i){if(!si.has(it(i).toLowerCase()))return[];let p=await ma(i);try{let h=(x,d)=>p.readAt(x,d),y=[];for(let[x,d]of(await Gh(h)).entries()){let b=await Hh(h,d),T=b.get("name"),C=b.get("OS/2");if(!T)continue;let L=Vh(await h(T.offset,T.length)),A=L.get(16)??L.get(1);if(!A)continue;let E=L.get(17)??L.get(2)??"Regular",F=400,B=5,U=/italic|oblique/i.test(E);if(C&&C.length>=64){let R=await h(C.offset,64);F=Ge(R,4)||400,B=Ge(R,6)||5,U=U||(Ge(R,62)&1)===1}y.push({path:i,index:x,family:A,subfamily:E,weight:F,width:B,italic:U})}return y}catch{return[]}finally{await p.close()}}function io(i,p){if(ln(i,0)!=="ttcf")return i;let h=yt(i,12+4*p),y=Ge(i,h+4),x=Array.from({length:y},(L,A)=>{let E=h+12+16*A;return{r:E,offset:yt(i,E+8),length:yt(i,E+12)}}),d=12+16*y,b=d;for(let L of x)b+=L.length+3&-4;let T=new Uint8Array(b);T.set(i.subarray(h,h+12),0);let C=d;return x.forEach((L,A)=>{let E=12+16*A;T.set(i.subarray(L.r,L.r+8),E),new DataView(T.buffer).setUint32(E+8,C),new DataView(T.buffer).setUint32(E+12,L.length),T.set(i.subarray(L.offset,L.offset+L.length),C),C+=L.length+3&-4}),T}function jh(){let i=pa();if(Bs()==="darwin")return["/System/Library/Fonts","/System/Library/Fonts/Supplemental","/Library/Fonts",ve(i,"Library/Fonts")];if(Bs()==="win32"){let p=Ms("WINDIR")??"C:\\Windows";return[ve(p,"Fonts"),ve(Ms("LOCALAPPDATA")??ve(i,"AppData/Local"),"Microsoft/Windows/Fonts")]}return["/usr/share/fonts","/usr/local/share/fonts",ve(i,".fonts"),ve(i,".local/share/fonts")]}async function*oi(i,p=0){if(!(p>4||!await en(i)))for await(let h of jn(i)){let y=ve(i,h.name);h.isDirectory?yield*oi(y,p+1):h.isFile&&si.has(it(h.name).toLowerCase())&&(yield y)}}var ni=null;function es(){return ni??=(async()=>{let i=new Map,p=new Set;for(let h of jh())for await(let y of oi(h))if(!p.has(y)){p.add(y);for(let x of await ao(y)){if(x.family.startsWith("."))continue;let d=i.get(x.family)??[];d.push(x),i.set(x.family,d)}}return i})(),ni}async function ri(i){let p=await es(),h=i.trim().toLowerCase();for(let[y,x]of p)if(y.toLowerCase()===h)return{family:y,faces:x};return null}function lo(i){let p=i.filter(b=>!b.italic),h=p.length?p:i,y=h.filter(b=>b.width===5),x=y.length?y:h,d=new Map;for(let b of x)d.has(b.weight)||d.set(b.weight,b);return[...d.values()].sort((b,T)=>b.weight-T.weight)}var Wh=i=>ci.default.parse(i),ai={lower_third:"lowerThird",locator:"locator",legal:"legalLine",end_crawl:"endCrawl"},ui=zs.map(i=>i.id),co=Ks.map(i=>i.id),Yh=eo.map(i=>i.id),hg=_a.map(i=>i.id),dg=Ba.map(i=>i.id),gg=Vt.map(i=>i.id),ho=new Set([".ttf",".otf",".ttc",".otc",".woff",".woff2"]);async function qh(){for(let i of["./fonts/gfx/","../../public/fonts/gfx/"]){let p=_n(new URL(i,import.meta.url));if(await en(p))return p}throw new ke("engine","the shipped graphics fonts are missing from this install (fonts/gfx)")}var bt=new Map,ii=null;function ns(){return ii??=(async()=>{let i=await qh();for(let p of Vt){if(!p.cssFamily)continue;let h=[];for(let[y,x]of Object.entries(p.files)){let d=ve(i,st(x));po.registerFromPath(d,p.cssFamily),h.push({path:d,index:0,weight:Number(y),embeddable:p.embeddable})}bt.set(p.id,h)}})(),ii}var mo={faces:[],custom:[]},Zh=()=>structuredClone(mo);function yo(i,p,h,y){h<0?po.registerFromPath(p,i):po.register($h.from(io(y,h)),i),mo.faces.push({alias:i,path:p,index:h})}function bo(i){Wn(i.id)||(Ta(i),mo.custom.push(i))}async function mg(i){await ns();let p=new Map;for(let h of i.faces)h.index>=0&&!p.has(h.path)&&p.set(h.path,await Gt(h.path)),yo(h.alias,h.path,h.index,p.get(h.path));for(let h of i.custom)bo(h)}var ts=i=>`CT ${i}`;async function fi(i,p,h){let y=bt.get(i)??[],x=new Map;for(let d of p)y.some(b=>b.path===d.path&&b.index===d.index)||(x.has(d.path)||x.set(d.path,await Gt(d.path)),yo(ts(i),d.path,d.index,x.get(d.path)),y.push({path:d.path,index:d.index,weight:d.weight,embeddable:h}));y.sort((d,b)=>d.weight-b.weight),bt.set(i,y),bo({id:i,label:i,cssFamily:ts(i),embeddable:h,outlines:h})}async function Kh(i){if(await ga(i))return ho.has(it(i).toLowerCase())?[i]:[];if(!await en(i))throw new ke("not_found",`font not found: ${st(i)}`);let p=[];for await(let h of jn(i))h.isFile&&ho.has(it(h.name).toLowerCase())&&p.push(ve(i,h.name));return p.sort()}async function pi(i){let p=new Map;for(let h of i)for(let y of await Kh(h)){let x=await ao(y);if(x.length){for(let C of x)p.set(C.family,[...p.get(C.family)??[],C]);continue}let d=st(y,it(y)),b=d.split(/[-_]/)[0],T=/black|heavy/i.test(d)?900:/bold/i.test(d)?700:/semi|demi/i.test(d)?600:/medium/i.test(d)?500:/light/i.test(d)?300:400;yo(ts(b),y,-1),bt.set(b,[...bt.get(b)??[],{path:y,index:0,weight:T,embeddable:!1}]),bo({id:b,label:b,cssFamily:ts(b),embeddable:!1,outlines:!1}),p.set(b,p.get(b)??[])}for(let[h,y]of p)y.length&&await fi(h,y,!0);return[...p.keys()]}var uo=i=>[...new Set((bt.get(i)??[]).map(p=>p.weight))].sort((p,h)=>p-h);async function Qh(i){await ns();let p=Vt.find(b=>b.id===i);if(p)return{id:i,resolved:p.label,source:"shipped",weights:Object.keys(p.files).map(Number)};if(/[/\\~]/.test(i)||ho.has(it(i).toLowerCase())){let b=await pi([ha(i)]);if(!b.length)throw new ke("not_found",`no font files in ${st(i)}`);return{id:b[0],resolved:b[0],source:"file",weights:uo(b[0])}}let h=[...bt.keys()].find(b=>b.toLowerCase()===i.toLowerCase()&&Wn(b)?.custom);if(h)return{id:h,resolved:h,source:"file",weights:uo(h)};let y=await ri(i);if(y)return await fi(y.family,lo(y.faces),!1),{id:y.family,resolved:y.family,source:"installed",weights:uo(y.family)};let x=i.toLowerCase().slice(0,4),d=[...(await es()).keys()].filter(b=>b.toLowerCase().includes(x)).slice(0,8);throw new ke("not_found",`font family '${i}' is not installed and is not a font file${d.length?` (close: ${d.join(", ")})`:""}; pass the font file or folder as family= or fonts=, or list faces with gfx_fonts`)}async function yg(i){await ns();let p=i?.toLowerCase(),h=Vt.map(x=>({id:x.id,label:x.label,weights:Object.keys(x.files).map(Number)})).filter(x=>!p||x.id.includes(p)||x.label.toLowerCase().includes(p)),y=[...await es()].filter(([x])=>!p||x.toLowerCase().includes(p)).map(([x,d])=>({family:x,weights:lo(d).map(b=>b.weight)})).sort((x,d)=>x.family.localeCompare(d.family));return{shipped:h,installed:y}}async function Jh(i){let p={...Js};if(i.look_path){let h=JSON.parse(await Gn(i.look_path));p={...p,...za(ei(h)??h).look}}if(typeof i.look=="string"){let h=ja[i.look];if(!h)throw new ke("invalid_args",`unknown look '${i.look}' (${Yh.join(", ")})`);p={...p,...h.look}}else i.look&&(p={...p,...i.look});return p}var ed=i=>i.normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"").toLowerCase().slice(0,48)||"graphic",td={lower_third:["name","title"],locator:["location","sub"],legal:["text"],end_crawl:["credits"]};async function nd(i,p){let h=td[i.type];if(i.type==="end_crawl"){let d=i.credits,b=i.credits_path??i.csv_path;if(b){let T=await Gn(b);if(it(b).toLowerCase()===".csv"){let C=qa(T);p.push(...C.warnings),d=C.text}else d=T}if(!d?.trim())throw new ke("invalid_args","end_crawl needs credits (paste dialect: '# Section', 'Role | Name', '> paragraph', '@image logo.png') or credits_path (.txt or .csv)");return[{label:"end_crawl",content:{credits:d}}]}let y=i.items??[];if(i.csv_path){let d=to(await Gn(i.csv_path)),b=d[0]?.map(L=>L.toLowerCase())??[],T=h.some(L=>b.includes(L)),C=T?h.map(L=>b.indexOf(L)):h.map((L,A)=>A);y=[...y,...d.slice(T?1:0).map(L=>Object.fromEntries(h.map((A,E)=>[A,C[E]>=0?L[C[E]]??"":""])))]}let x=Object.fromEntries(h.filter(d=>i[d]!=null).map(d=>[d,i[d]]));if(Object.keys(x).length&&(y=[x,...y]),y=y.filter(d=>h.some(b=>String(d[b]??"").trim())),!y.length)throw new ke("invalid_args",`${i.type} needs its text: ${h.join(" + ")} (or items=[\u2026] / csv_path for many)`);return y.map(d=>({label:String(d[h[0]]??h[0]),content:Object.fromEntries(h.filter(b=>d[b]!=null).map(b=>[b,String(d[b])]))}))}function sd(i){let p=Xs[i];if(p)return p;let h=i.match(/^(\d{2,5})\s*[x×:]\s*(\d{2,5})$/i);if(!h)throw new ke("invalid_args",`unknown format '${i}' (${ui.join(", ")}, or a raster like 1280x720)`);let y=Number(h[1]),x=Number(h[2]);if(y%2||x%2)throw new ke("invalid_args",`format ${i}: width and height must be even`);let d=y/x;return{id:`${y}x${x}`,w:y,h:x,group:d>1.05?"landscape":d<.95?"portrait":"square"}}function od(i){let p=Math.round(i);if(Math.abs(i-p)<1e-6)return{num:p,den:1,base:p};if(Math.abs(i-p*1e3/1001)<.01)return{num:p*1e3,den:1001,base:p};throw new ke("invalid_args",`fps ${i}: use 23.976, 24, 25, 29.97, 30, 47.952, 48, 50, 59.94 or 60`)}var fo=24,go=class{constructor(p,h){this.idle=[];this.all=[];this.waiting=[];this.pending=new Map;let y=_n(new URL("./gfx-worker.js",import.meta.url)),x=Xh(y)?y:_n(new URL("./gfx-worker.ts",import.meta.url));for(let d=0;d<p;d++){let b=new zh(x,{workerData:h});b.on("message",T=>{let C=this.pending.get(T.id);this.pending.delete(T.id),this.release(b),C?.resolve(T)}),b.on("error",T=>{for(let[C,L]of this.pending)L.w===b&&(this.pending.delete(C),L.resolve({id:C,samples:[],error:T.message}))}),this.all.push(b),this.idle.push(b)}}release(p){let h=this.waiting.shift();h?h(p):this.idle.push(p)}async run(p){let h=this.idle.pop()??await new Promise(y=>this.waiting.push(y));return await new Promise(y=>{this.pending.set(p.id,{resolve:y,w:h}),h.postMessage(p)})}async close(){await Promise.all(this.all.map(p=>p.terminate()))}};async function rd(i,p,h,y){let x=new xa(i.fmt.w,i.fmt.h,h.num,h.den);x.set_alpha(y.alpha),x.set_profile(y.alpha?"ap4h":"apch"),x.set_qscale(4),x.set_start_timecode(BigInt(y.startTc),y.df),x.reserve_large_mdat(i.fmt.w*i.fmt.h*i.frames>3e9),await Vn(tn(p));let d=await ya(p),b=0,T=null,C=0,L=async A=>{await d.writeAt(b,A),b+=A.length};return await L(x.header()),{async add(A){for(let E of A){let F=E??T;if(!F)throw new ke("engine","a repeated frame with nothing before it");E&&C++,x.push_sample(F),await L(F),T=F}},async finish(){try{return await L(x.finish()),await d.writeAt(Number(x.mdat_box_offset()),x.mdat_box_header()),{bytes:b,encoded:C}}finally{await d.close(),x.free()}},async abort(){await d.close(),x.free()}}}async function ad(i,p,h,y,x,d){let b=i.flatMap(({cell:B},U)=>Array.from({length:Math.ceil(B.frames/fo)},(R,M)=>({ci:U,from:M*fo,to:Math.min(B.frames,(M+1)*fo)}))),T=new go(Math.max(1,Math.min(8,Ps()-1,b.length)),Zh()),C=[],L=[],A=new Map,E=p.num/p.den,F=0;try{for(;F<b.length||L.length;){for(;F<b.length&&L.length<id(Ps());){let D=b[F],_=i[D.ci].cell;L.push({ci:D.ci,p:T.run({id:F,scene:_.scene,fmt:_.fmt,from:D.from,to:D.to,fps:E,alpha:h.alpha,images:y})}),F++}if(x?.aborted)throw new ke("cancelled","cancelled");let{ci:B,p:U}=L.shift(),R=await U;if(R.error)throw new ke("engine",`render failed on ${st(i[B].path)}: ${R.error}`);A.has(B)||A.set(B,await rd(i[B].cell,i[B].path,p,h)),await A.get(B).add(R.samples),d?.(R.samples.length,i[B].path),L.every(D=>D.ci!==B)&&(F>=b.length||b[F].ci!==B)&&(C[B]=await A.get(B).finish(),A.delete(B))}return C}finally{for(let B of A.values())await B.abort();await T.close()}}var id=i=>2*Math.max(1,Math.min(8,i-1));function bg(i,p){if(i.length!==p.length)return!1;let h=i.length>>2,y=new Uint32Array(i.buffer,i.byteOffset,h),x=new Uint32Array(p.buffer,p.byteOffset,h);for(let d=0;d<h;d++)if(y[d]!==x[d])return!1;return!0}function hi(i){return i.elements.some(p=>p.type==="crawl")?i.duration*.45:i.duration*.5}function ld(i,p,h){let y=[...new Set(i.map(R=>R.variant.position?.slug??R.variant.key??"main"))],x=[...new Set(i.map(R=>R.fmt.id))],d=Math.max(...i.map(R=>R.fmt.h)),b=420/d,T=x.map(R=>Math.round(i.find(M=>M.fmt.id===R).fmt.w*b)),C=18,L=22,A=40,E=C+T.reduce((R,M)=>R+M+C,0),F=A+y.length*(Math.round(d*b)+L+C)+C,B=cn(E,F),U=B.getContext("2d");return U.fillStyle="#1c1d21",U.fillRect(0,0,E,F),U.fillStyle="#e9eaee",U.font="600 18px sans-serif",U.textBaseline="top",U.fillText(h,C,12),y.forEach((R,M)=>{let D=A+M*(Math.round(d*b)+L+C),_=C;x.forEach((X,Z)=>{let Q=i.find(K=>K.fmt.id===X&&(K.variant.position?.slug??K.variant.key??"main")===R),se=T[Z];if(Q){let K=Math.round(Q.fmt.h*b),fe=cn(Q.fmt.w,Q.fmt.h),Se=fe.getContext("2d");Ws(Se,Q.scene,hi(Q.scene),Q.fmt,Xn(Se),p),di(U,_,D,se,K),U.drawImage(fe,_,D,se,K),U.strokeStyle="#4a4d55",U.lineWidth=1,U.strokeRect(_+.5,D+.5,se-1,K-1),U.fillStyle="#a9adb8",U.font="500 12px sans-serif",U.fillText(`${R} \xB7 ${Q.fmt.id} ${Q.fmt.w}\xD7${Q.fmt.h}`,_,D+K+5)}_+=se+C})}),B}function di(i,p,h,y,x,d=12){i.save(),i.beginPath(),i.rect(p,h,y,x),i.clip();for(let b=0;b*d<x;b++)for(let T=0;T*d<y;T++)i.fillStyle=(T+b)%2?"#5a5d66":"#6b6e78",i.fillRect(p+T*d,h+b*d,d,d);i.restore()}async function cd(i){let p={};for(let h of i)for(let y of h.elements){let x=y.type==="crawl"?[{family:y.family,weight:400},{family:y.family,weight:700}]:y.children??[];for(let d of x){let b=d.family||"system",T=d.weight??400,C=Qn(b,T);if(C in p)continue;let L=(bt.get(b)??[]).filter(E=>E.embeddable);if(!L.length)continue;let A=L.reduce((E,F)=>Math.abs(F.weight-T)<=Math.abs(E.weight-T)?F:E);try{let E=io(await Gt(A.path),A.index);p[C]=Wh(E.buffer.slice(E.byteOffset,E.byteOffset+E.byteLength))}catch{}}}return p}async function ud(i,p,h){let y={},x=new Set;for(let d of i)for(let b of d.elements)for(let T of b.rows??[]){T.image&&x.add(T.image.src);for(let C of T.images?.srcs??[])x.add(C)}for(let d of x){let b=/^([/~]|[A-Za-z]:\\)/.test(d)||!p?d:ve(p,d);if(!await da(b)){h.push(`logo ${st(d)} not found${p?` in ${st(p)}`:""}; its row is left out`);continue}try{await li(await Gt(b)),y[d]=b}catch(T){h.push(`logo ${st(d)} could not be read: ${T.message}`)}}return y}async function xg(i,p,h){let y=performance.now(),x=[],d=ai[i.type],b=Zs[d];if(!b)throw new ke("invalid_args",`type must be one of ${Object.keys(ai).join(", ")}`);await ns(),i.fonts?.length&&await pi(i.fonts);let T=await Jh(i),C=await Qh(i.family??String(T.family??"inter"));T.family=C.id,C.weights.length&&!C.weights.some(ne=>ne>=600)&&i.type!=="legal"&&x.push(`${C.resolved} has no bold face here (weights ${C.weights.join(", ")}); the bold lines are drawn heavier from the regular \u2014 give the bold file in fonts= for the real one`);let L=od(i.fps??23.976),A=Ua[i.resolution??"hd"],E=(i.formats?.length?i.formats:ui).map(sd).map(ne=>Ma(ne,A.factor)),F=b.fan==="positions"?i.positions?.includes("all")?co:i.positions?.length?i.positions:b.defaultPositions:[];for(let ne of F)if(!co.includes(ne))throw new ke("invalid_args",`unknown position '${ne}' (${co.join(", ")}, or all)`);let B=i.start_tc?ba(i.start_tc,L.base):0;if(B==null)throw new ke("invalid_args",`start_tc '${i.start_tc}' is not a timecode`);let U=/;/.test(i.start_tc??""),R=i.background_color&&/^#?[0-9a-f]{6}$/i.test(i.background_color)?`#${i.background_color.replace("#","")}`:null;if(i.background_color&&!R)throw new ke("invalid_args",`background_color '${i.background_color}': a hex colour like #000000`);let M=await nd(i,x),D=i.out_dir??ve(fa(),"gfx",`${b.base}_${new Date().toISOString().slice(0,19).replace(/[-:T]/g,"")}`);await Vn(D);let _=[],X=new Set;for(let ne of M){let te=i.type==="end_crawl"?b.base:`${b.base}_${ed(ne.label)}`;for(let he=2;X.has(te);he++)te=`${te.replace(/_\d+$/,"")}_${he}`;X.add(te);let ge=$a(b,{...i.options,...ne.content,...i.duration?{duration:i.duration}:{}},T),Ue=Ga(d,ge,F.length?F:void 0).flatMap(he=>E.map(Qe=>{let de={...he.scene,...R?{bg:R}:{}};return{base:te,variant:he,fmt:Qe,scene:de,frames:Math.max(1,Math.round(de.duration*L.num/L.den))}}));_.push({base:te,cells:Ue})}let Z=_.flatMap(ne=>ne.cells.map(te=>te.scene)),Q=Z.some(Ra)?await ud(Z,i.images_dir??(i.credits_path?tn(i.credits_path):i.csv_path?tn(i.csv_path):void 0),x):{},se={};for(let[ne,te]of Object.entries(Q))se[ne]=await li(await Gt(te));let K={out_dir:D,type:i.type,graphics:[],look:T,family:C,fps:i.fps??23.976,resolution:A.id,formats:E.map(ne=>ne.id),positions:F,issues:x,seconds:0};for(let ne of _){let te=ve(D,ne.base,"preview.png");await Vn(tn(te)),await Hn(te,ld(ne.cells,se,`${ne.base} \xB7 ${C.resolved} \xB7 hold frame`).toBuffer("image/png"));let ge=ne.cells[0],Ee=ve(D,ne.base,"still.png"),Ue=cn(ge.fmt.w,ge.fmt.h),he=Ue.getContext("2d"),Qe=cn(ge.fmt.w,ge.fmt.h),de=Qe.getContext("2d");Ws(de,ge.scene,hi(ge.scene),ge.fmt,Xn(de),se),di(he,0,0,ge.fmt.w,ge.fmt.h,Math.round(ge.fmt.h/36)),he.drawImage(Qe,0,0),await Hn(Ee,Ue.toBuffer("image/png")),K.graphics.push({base:ne.base,preview:te,still:Ee,files:[]})}if(i.preview_only)return K.seconds=(performance.now()-y)/1e3,K;let fe=_.flatMap((ne,te)=>ne.cells.map(ge=>{let Ee=Xa(ne.base,ge.variant,ge.fmt);return R&&(Ee=Ee.replace(/\.mov$/,`_on_${R.slice(1).toLowerCase()}.mov`)),{gi:te,cell:ge,path:ve(D,Ee)}})),Se=fe.reduce((ne,te)=>ne+te.cell.frames,0);await va();let Te=0;p?.(0,Se,"rendering");let Rt=await ad(fe,L,{alpha:!R,startTc:B,df:U},Q,h,(ne,te)=>{Te+=ne,p?.(Te,Se,te.slice(D.length+1))});fe.forEach(({gi:ne,cell:te,path:ge},Ee)=>K.graphics[ne].files.push({path:ge,base:_[ne].base,position:te.variant.position?.slug??te.variant.key??"main",format:te.fmt.id,width:te.fmt.w,height:te.fmt.h,frames:te.frames,encoded:Rt[Ee].encoded,bytes:Rt[Ee].bytes}));for(let[ne,te]of _.entries())if(i.lottie){let ge=await cd(te.cells.map(he=>he.scene)),Ee=te.cells.map(he=>{let Qe=cn(he.fmt.w,he.fmt.h);return{id:`${he.variant.position?.slug??he.variant.key??"main"}_${he.fmt.id}`,data:Ja(he.scene,he.fmt,Xn(Qe.getContext("2d")),{fps:L.num/L.den,fonts:ge,look:T,name:te.base})}}),Ue=ve(D,te.base,`${te.base}.lottie`);await Hn(Ue,ti(Ee)),K.graphics[ne].lottie=Ue,Object.keys(ge).length||x.push(`${te.base}.lottie names ${C.resolved} as live text (an installed face is not embedded); players without it substitute`)}return p?.(Se,Se,"done"),await Ns(ve(D,"look.json"),JSON.stringify(Wa(T,{name:st(D)}),null,2)),K.manifest=ve(D,"manifest.json"),K.seconds=(performance.now()-y)/1e3,await Ns(K.manifest,JSON.stringify({...K,manifest:void 0},null,2)),K}function vg(i){let p=i.graphics.flatMap(d=>d.files),h=p.reduce((d,b)=>d+b.bytes,0)/1e9;return[p.length?`${p.length} ProRes ${i.graphics[0]?.files[0]?.path.includes("_on_")?"422 HQ":"4444 + alpha"} file(s), ${h.toFixed(2)} GB, in ${i.seconds.toFixed(1)} s \u2192 ${i.out_dir}`:`preview only (no ProRes rendered) \u2192 ${i.out_dir}`,`${i.type} \xB7 ${i.graphics.length} graphic(s) \xD7 ${Math.max(1,i.positions.length)} position(s) \xD7 ${i.formats.length} format(s) [${i.formats.join(", ")}] \xB7 ${i.resolution.toUpperCase()} \xB7 ${i.fps} fps`,`font: ${i.family.resolved} (${i.family.source}${i.family.weights.length?`, weights ${i.family.weights.join("/")}`:""}) \xB7 look: plate ${i.look.plate}, motion ${i.look.style}, accent ${i.look.accent}`,...i.graphics.map(d=>` ${d.base}: preview ${d.preview} \xB7 still ${d.still}${d.lottie?` \xB7 lottie ${d.lottie}`:""}${d.files.length?` \xB7 ${d.files.length} movs (${d.files.reduce((b,T)=>b+T.encoded,0)} of ${d.files.reduce((b,T)=>b+T.frames,0)} frames encoded, holds reused)`:""}`),...i.issues.map(d=>` ! ${d}`),p.length?`manifest: ${i.manifest} \xB7 look: ${ve(i.out_dir,"look.json")} (reuse with look_path=)`:"Open the preview(s) to check the design, then run again without preview_only to render."].join(`
19
+ `)}export{eo as a,wh as b,Na as c,mh as d,Xn as e,Ws as f,ai as g,ui as h,co as i,Yh as j,hg as k,dg as l,gg as m,mg as n,yg as o,bg as p,xg as q,vg as r};