import{a as Pt}from"./_commonjsHelpers-DsqdWQfm.js";function Et(G,_){for(var r=0;r<_.length;r++){const U=_[r];if(typeof U!="string"&&!Array.isArray(U)){for(const F in U)if(F!=="default"&&!(F in G)){const P=Object.getOwnPropertyDescriptor(U,F);P&&Object.defineProperty(G,F,P.get?P:{enumerable:!0,get:()=>U[F]})}}}return Object.freeze(Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}))}var V={exports:{}},q;function At(){if(q)return V.exports;q=1;function G(_){var r=_.wasmExports,U=new TextDecoder("utf8"),F=new TextEncoder("utf8");let P=_.addFunction,D=_.removeFunction,A=_.stackSave,y=_.stackRestore,b=_.stackAlloc;var Q=P(function(s){r.free(s)},"vi");const k=0,X=1,K=2,d=128,M=2,tt=-1,$=65535,rt={0:"INVALID",1:"UNICODE",2:"GLYPHS"},nt={DEFAULT:0,NO_CLUSTERS:1,NO_POSITIONS:2,NO_GLYPH_NAMES:4,GLYPH_EXTENTS:8,GLYPH_FLAGS:16,NO_ADVANCES:32},et={DEFAULT:0,BOT:1,EOT:2,PRESERVE_DEFAULT_IGNORABLES:4,REMOVE_DEFAULT_IGNORABLES:8,DO_NOT_INSERT_DOTTED_CIRCLE:16,VERIFY:32,PRODUCE_UNSAFE_TO_CONCAT:64,PRODUCE_SAFE_TO_INSERT_TATWEEL:128};function H(s){return(s.charCodeAt(0)&255)<<24|(s.charCodeAt(1)&255)<<16|(s.charCodeAt(2)&255)<<8|(s.charCodeAt(3)&255)<<0}function C(s){return[String.fromCharCode(s>>24&255),String.fromCharCode(s>>16&255),String.fromCharCode(s>>8&255),String.fromCharCode(s>>0&255)].join("")}function L(s,n){let t;return n===void 0?t=_.HEAPU8.indexOf(0,s):t=s+n,U.decode(_.HEAPU8.subarray(s,t))}function at(s,n){let t=s/2+n;return String.fromCharCode.apply(null,_.HEAPU16.subarray(s/2,t))}function R(s){const n=r.malloc(s.length+1);for(let t=0;t127)throw new Error("Expected ASCII text");_.HEAPU8[n+t]=e}return _.HEAPU8[n+s.length]=0,{ptr:n,length:s.length,free:function(){r.free(n)}}}function _t(s){const n=r.malloc(s.length);return F.encodeInto(s,_.HEAPU8.subarray(n,n+s.length)),{ptr:n,length:s.length,free:function(){r.free(n)}}}function ft(s){const n=r.malloc(s.length*2),t=new Uint16Array(_.wasmMemory.buffer,n,s.length);for(let e=0;e>2,f=_.HEAPU32.subarray(e,e+n);return _.HEAPU32.set(f,e),r.hb_set_next_many(s,tt,t,n),f}function it(s,n){var t=r.hb_face_create(s.ptr,n);const e=r.hb_face_get_upem(t);return{ptr:t,upem:e,reference_table:function(f){var a=r.hb_face_reference_table(t,H(f)),u=r.hb_blob_get_length(a);if(u){var c=r.hb_blob_get_data(a,null),i=_.HEAPU8.subarray(c,c+u);return i}},getAxisInfos:function(){var f=A(),a=b(2048),u=b(4);_.HEAPU32[u/4]=64,r.hb_ot_var_get_axis_infos(t,0,u,a);var c={};return Array.from({length:_.HEAPU32[u/4]}).forEach(function(i,o){c[C(_.HEAPU32[a/4+o*8+1])]={min:_.HEAPF32[a/4+o*8+4],default:_.HEAPF32[a/4+o*8+5],max:_.HEAPF32[a/4+o*8+6]}}),y(f),c},collectUnicodes:function(){var f=r.hb_set_create();r.hb_face_collect_unicodes(t,f);var a=ot(f);return r.hb_set_destroy(f),a},getTableScriptTags:function(f){for(var a=A(),u=H(f),c=0,i=d,o=b(4),h=b(d*4),l=[];i==d;){_.HEAPU32[o/4]=i,r.hb_ot_layout_table_get_script_tags(t,u,c,o,h),i=_.HEAPU32[o/4];var g=_.HEAPU32.subarray(h/4,h/4+i);l.push(...Array.from(g).map(C)),c+=i}return y(a),l},getTableFeatureTags:function(f){for(var a=A(),u=H(f),c=0,i=d,o=b(4),h=b(d*4),l=[];i==d;){_.HEAPU32[o/4]=i,r.hb_ot_layout_table_get_feature_tags(t,u,c,o,h),i=_.HEAPU32[o/4];var g=_.HEAPU32.subarray(h/4,h/4+i);l.push(...Array.from(g).map(C)),c+=i}return y(a),l},getScriptLanguageTags:function(f,a){for(var u=A(),c=H(f),i=0,o=d,h=b(4),l=b(d*4),g=[];o==d;){_.HEAPU32[h/4]=o,r.hb_ot_layout_script_get_language_tags(t,c,a,i,h,l),o=_.HEAPU32[h/4];var p=_.HEAPU32.subarray(l/4,l/4+o);g.push(...Array.from(p).map(C)),i+=o}return y(u),g},getLanguageFeatureTags:function(f,a,u){for(var c=A(),i=H(f),o=0,h=d,l=b(4),g=b(d*4),p=[];h==d;){_.HEAPU32[l/4]=h,r.hb_ot_layout_language_get_feature_tags(t,i,a,u,o,l,g),h=_.HEAPU32[l/4];var v=_.HEAPU32.subarray(g/4,g/4+h);p.push(...Array.from(v).map(C)),o+=h}return y(c),p},listNames:function(){for(var f=A(),a=b(4),u=r.hb_ot_name_list_names(t,a),c=_.HEAPU32[a/4],i=[],o=0;ow+O);v={uiLabelNameId:E==$?null:E,uiTooltipTextNameId:B==$?null:B,sampleTextNameId:N==$?null:N,paramUiLabelNameIds:T}}return y(u),v},destroy:function(){r.hb_face_destroy(t)}}}var S="";function m(s,t){var t=t?r.hb_font_reference(t):r.hb_font_create(s.ptr),e=null,f=null,a=null,u=null,c=null,i=null;function o(l){if(!e){var g=function(N,I,w,T,x,O){S+=`M${T},${x}`},p=function(N,I,w,T,x,O){S+=`L${T},${x}`},v=function(N,I,w,T,x,O,j,J,bt,mt){S+=`C${T},${x} ${O},${j} ${J},${bt}`},E=function(N,I,w,T,x,O,j,J){S+=`Q${T},${x} ${O},${j}`},B=function(N,I,w,T){S+="Z"};f=P(g,"viiiffi"),a=P(p,"viiiffi"),u=P(v,"viiiffffffi"),c=P(E,"viiiffffi"),i=P(B,"viiii"),e=r.hb_draw_funcs_create(),r.hb_draw_funcs_set_move_to_func(e,f,0,0),r.hb_draw_funcs_set_line_to_func(e,a,0,0),r.hb_draw_funcs_set_cubic_to_func(e,u,0,0),r.hb_draw_funcs_set_quadratic_to_func(e,c,0,0),r.hb_draw_funcs_set_close_path_func(e,i,0,0)}return S="",r.hb_font_draw_glyph(t,l,e,0),S}function h(l){var g=A(),p=256,v=b(p);r.hb_font_glyph_to_string(t,l,v,p);var E=L(v);return y(g),E}return{ptr:t,subFont:function(){return m(null,r.hb_font_create_sub_font(t))},hExtents:function(){var l=A(),g=b(12);r.hb_font_get_h_extents(t,g);var p={ascender:_.HEAP32[g/4],descender:_.HEAP32[g/4+1],lineGap:_.HEAP32[g/4+2]};return y(l),p},vExtents:function(){var l=A(),g=b(12);r.hb_font_get_v_extents(t,g);var p={ascender:_.HEAP32[g/4],descender:_.HEAP32[g/4+1],lineGap:_.HEAP32[g/4+2]};return y(l),p},glyphName:h,glyphToPath:o,glyphHAdvance:function(l){return r.hb_font_get_glyph_h_advance(t,l)},glyphVAdvance:function(l){return r.hb_font_get_glyph_v_advance(t,l)},glyphHOrigin:function(l){var g=A();let p=b(4),v=b(4),E=null;return r.hb_font_get_glyph_h_origin(t,l,p,v)&&(E=[_.HEAP32[p/4],_.HEAP32[v/4]]),y(g),E},glyphVOrigin:function(l){var g=A();let p=b(4),v=b(4),E=null;return r.hb_font_get_glyph_v_origin(t,l,p,v)&&(E=[_.HEAP32[p/4],_.HEAP32[v/4]]),y(g),E},glyphExtents:function(l){var g=A(),p=b(16),v=null;return r.hb_font_get_glyph_extents(t,l,p)&&(v={xBearing:_.HEAP32[p/4],yBearing:_.HEAP32[p/4+1],width:_.HEAP32[p/4+2],height:_.HEAP32[p/4+3]}),y(g),v},glyphFromName:function(l){var g=A(),p=b(4),v=_t(l),E=null;return r.hb_font_get_glyph_from_name(t,v.ptr,v.length,p)&&(E=_.HEAPU32[p/4]),v.free(),y(g),E},glyphToJson:function(l){var g=o(l);return g.replace(/([MLQCZ])/g,"|$1 ").split("|").filter(function(p){return p.length}).map(function(p){var v=p.split(/[ ,]/g);return{type:v[0],values:v.slice(1).filter(function(E){return E.length}).map(function(E){return+E})}})},setScale:function(l,g){r.hb_font_set_scale(t,l,g)},setVariations:function(l){var g=Object.entries(l),p=r.malloc(8*g.length);g.forEach(function(v,E){_.HEAPU32[p/4+E*2+0]=H(v[0]),_.HEAPF32[p/4+E*2+1]=v[1]}),r.hb_font_set_variations(t,p,g.length),r.free(p)},setFuncs:function(l){r.hb_font_set_funcs(t,l.ptr)},destroy:function(){r.hb_font_destroy(t),e&&(r.hb_draw_funcs_destroy(e),e=null,D(f),D(a),D(u),D(c),D(i))}}}function ct(){var s=r.hb_font_funcs_create();return{ptr:s,setGlyphExtentsFunc:function(n){let t=P(function(e,f,a,u,c){let i=m(null,e),o=n(i,a);return i.destroy(),o?(_.HEAP32[u/4]=o.xBearing,_.HEAP32[u/4+1]=o.yBearing,_.HEAP32[u/4+2]=o.width,_.HEAP32[u/4+3]=o.height,1):0},"ippipp");r.hb_font_funcs_set_glyph_extents_func(s,t,0,0)},setGlyphFromNameFunc:function(n){let t=P(function(e,f,a,u,c,i){let o=m(null,e),h=L(a,u),l=n(o,h);return o.destroy(),l?(_.HEAPU32[c/4]=l,1):0},"ipppipp");r.hb_font_funcs_set_glyph_from_name_func(s,t,0,0)},setGlyphHAdvanceFunc:function(n){let t=P(function(e,f,a,u){let c=m(null,e),i=n(c,a);return c.destroy(),i},"ippip");r.hb_font_funcs_set_glyph_h_advance_func(s,t,0,0)},setGlyphVAdvanceFunc:function(n){let t=P(function(e,f,a,u){let c=m(null,e),i=n(c,a);return c.destroy(),i},"ippip");r.hb_font_funcs_set_glyph_v_advance_func(s,t,0,0)},setGlyphHOriginFunc:function(n){let t=P(function(e,f,a,u,c,i){let o=m(null,e),h=n(o,a);return o.destroy(),h?(_.HEAP32[u/4]=h[0],_.HEAP32[c/4]=h[1],1):0},"ippippp");r.hb_font_funcs_set_glyph_h_origin_func(s,t,0,0)},setGlyphVOriginFunc:function(n){let t=P(function(e,f,a,u,c,i){let o=m(null,e),h=n(o,a);return o.destroy(),h?(_.HEAP32[u/4]=h[0],_.HEAP32[c/4]=h[1],1):0},"ippippp");r.hb_font_funcs_set_glyph_v_origin_func(s,t,0,0)},setGlyphHKerningFunc:function(n){let t=P(function(e,f,a,u,c){let i=m(null,e),o=n(i,a,u);return i.destroy(),o},"ippiip");r.hb_font_funcs_set_glyph_h_kerning_func(s,t,0,0)},setGlyphNameFunc:function(n){let t=P(function(e,f,a,u,c,i){let o=m(null,e),h=n(o,a);return o.destroy(),h?(F.encodeInto(h,_.HEAPU8.subarray(u,u+c)),1):0},"ippipip");r.hb_font_funcs_set_glyph_name_func(s,t,0,0)},setNominalGlyphFunc:function(n){let t=P(function(e,f,a,u,c){let i=m(null,e),o=n(i,a);return i.destroy(),o?(_.HEAPU32[u/4]=o,1):0},"ippipp");r.hb_font_funcs_set_nominal_glyph_func(s,t,0,0)},setVariationGlyphFunc:function(n){let t=P(function(e,f,a,u,c,i){let o=m(null,e),h=n(o,a,u);return o.destroy(),h?(_.HEAPU32[c/4]=h,1):0},"ippiipp");r.hb_font_funcs_set_variation_glyph_func(s,t,0,0)},setFontHExtentsFunc:function(n){let t=P(function(e,f,a,u){let c=m(null,e),i=n(c);return c.destroy(),i?(_.HEAP32[a/4]=i.ascender,_.HEAP32[a/4+1]=i.descender,_.HEAP32[a/4+2]=i.lineGap,1):0},"ipppp");r.hb_font_funcs_set_font_h_extents_func(s,t,0,0)},setFontVExtentsFunc:function(n){let t=P(function(e,f,a,u){let c=m(null,e),i=n(c);return c.destroy(),i?(_.HEAP32[a/4]=i.ascender,_.HEAP32[a/4+1]=i.descender,_.HEAP32[a/4+2]=i.lineGap,1):0},"ipppp");r.hb_font_funcs_set_font_v_extents_func(s,t,0,0)},destroy:function(){r.hb_font_funcs_destroy(s)}}}function z(n){var n=n?r.hb_buffer_reference(n):r.hb_buffer_create();return{ptr:n,addText:function(t,e=0,f=null){const a=ft(t);f==null&&(f=a.length),r.hb_buffer_add_utf16(n,a.ptr,a.length,e,f),a.free()},addCodePoints:function(t,e=0,f=null){let a=r.malloc(t.length*4);new Uint32Array(_.wasmMemory.buffer,a,t.length).set(t),f==null&&(f=t.length),r.hb_buffer_add_codepoints(n,a,t.length,e,f),r.free(a)},guessSegmentProperties:function(){return r.hb_buffer_guess_segment_properties(n)},setDirection:function(t){r.hb_buffer_set_direction(n,{ltr:4,rtl:5,ttb:6,btt:7}[t]||0)},setFlags:function(t){var e=0;t.forEach(f=>e|=et[f]||0),r.hb_buffer_set_flags(n,e)},setLanguage:function(t){var e=R(t);r.hb_buffer_set_language(n,r.hb_language_from_string(e.ptr,-1)),e.free()},setScript:function(t){var e=R(t);r.hb_buffer_set_script(n,r.hb_script_from_string(e.ptr,-1)),e.free()},setClusterLevel:function(t){r.hb_buffer_set_cluster_level(n,t)},reset:function(){r.hb_buffer_reset(n)},clearContents:function(){r.hb_buffer_clear_contents(n)},setMessageFunc:function(t){var e=function(a,u,c,i){var o=L(c),h=z(a),l=m(null,u),g=t(h,l,o);return h.destroy(),l.destroy(),g?1:0},f=P(e,"iiiii");r.hb_buffer_set_message_func(n,f,0,0)},getLength:function(){return r.hb_buffer_get_length(n)},getGlyphInfos:function(){for(var t=r.hb_buffer_get_glyph_infos(n,0)/4,e=_.HEAPU32.subarray(t,t+this.getLength()*5),f=[],a=0;al|=nt[v]||0);for(var g="";e{if(h.startsWith("start table GSUB")?u=X:h.startsWith("start table GPOS")&&(u=K),u!=f&&(c=!1),f!=k&&u==f&&h.startsWith("end lookup "+e)&&(c=!0),c)return!1;var l=i.serialize(o,0,null,"JSON",["NO_GLYPH_NAMES"]);return a.push({m:h,t:JSON.parse(l),glyphs:i.getContentType()=="GLYPHS"}),!0}),W(s,n,t),a}function ht(){var s=A(),n=b(12);r.hb_version(n,n+4,n+8);var t={major:_.HEAPU32[n/4],minor:_.HEAPU32[(n+4)/4],micro:_.HEAPU32[(n+8)/4]};return y(s),t}function gt(){var s=r.hb_version_string();return L(s)}function pt(s){var n=H(s),t=r.hb_ot_tag_to_script(n);return C(t)}function vt(s){var n=H(s),t=r.hb_ot_tag_to_language(n);return Y(t)}return{createBlob:ut,createFace:it,createFont:m,createFontFuncs:ct,createBuffer:z,shape:W,shapeWithTrace:lt,version:ht,version_string:gt,otTagToScript:pt,otTagToLanguage:vt}}try{V.exports=G}catch{}return V.exports}var Z=At();const yt=Pt(Z),Ht=Et({__proto__:null,default:yt},[Z]);export{Ht as h};