'use strict';let __workerContext=undefined;self['getLanguag'+'eDirection'+'FromLangua'+'ge']=function(K){const n={'wsDuo':'LTR'},M=self['__language'+'DirectionM'+'ap'];return M&&M[K]||n['wsDuo'];},self['g_profanit'+'y_list']={},self['test_76_ge'+'t_caption_'+'render_par'+'ams']=function(){return null;},self['g_caption_'+'last_rende'+'red_params']=null,self['debounce']=function(K){return K;},self['EXPORT_VID'+'EO_FRAMERA'+'TE']=-0x72d+-0xe8b+0x15d6,importScripts('../utils/c'+'anvasRound'+'edRect.js'),importScripts('helpers.js');function assertContext(){const K={'XZrvR':function(n,M){return n===M;},'VBHLc':'Caption\x20wo'+'rker\x20not\x20i'+'nitialized'};if(K['XZrvR'](__workerContext,undefined))throw new Error(K['VBHLc']);return __workerContext;}function loadPrefetchedFonts(K){const n={'dhEMq':function(Y,g){return Y||g;},'PYxyG':function(Y,g){return Y===g;}},M=self['fonts'];if(n['dhEMq'](!M,!K)||n['PYxyG'](K['length'],-0x4d*-0x22+0x1d3*-0x11+0x1*0x14c9))return Promise['resolve']();return Promise['all'](K['map'](function(Y){const g={'style':Y['style'],'weight':Y['weight']};Y['unicodeRan'+'ge']&&(g['unicodeRan'+'ge']=Y['unicodeRan'+'ge']);const h=new FontFace(Y['family'],Y['dataBuffer'],g);return h['load']()['then'](function(){M['add'](h);});}));}function warmupFonts(K){const n={'ahyNx':function(Y,g){return Y===g;}},M=self['fonts'];if(!M||!K||n['ahyNx'](K['length'],0x33b*0x9+-0x31f*-0x9+-0x392a))return Promise['resolve']();return Promise['allSettled'](K['map'](function(Y){return M['load'](Y['fontString']);}));}function renderImage(K){const n={'BVwyN':function(W,o){return W-o;},'oSDLo':function(W){return W();},'SqWch':function(W,o,L,b,f,X,m,d,j){return W(o,L,b,f,X,m,d,j);},'WyBdy':'image/png'},M=n['oSDLo'](assertContext),Y=M['sequenceWi'+'dth'],g=M['sequenceHe'+'ight'],h=M['captionRen'+'derParams'],P=M['formattedC'+'aptionsChu'+'nks'],w=h['language']||'en',R=new OffscreenCanvas(Y,g),G=new OffscreenCanvas(Y,g),D=new OffscreenCanvas(Y,g),C=G['getContext']('2d'),J=D['getContext']('2d'),Q={'language':w,'tempTextCtx':C,'tempShadowCtx':J},I=Date['now'](),z=n['SqWch'](test_74_render_captions_by_index,R,K['chunkIndex'],K['wordIndex'],h,K['layer'],P,![],Q),q=n['BVwyN'](Date['now'](),I),O=Date['now']();return R['convertToB'+'lob']({'type':n['WyBdy']})['then'](function(W){return W['arrayBuffe'+'r']();})['then'](function(W){const o=n['BVwyN'](Date['now'](),O);return{'pngBuffer':W,'boxPosition':z,'drawMs':q,'encodeMs':o};});}function formatWorkerError(K){const n={'WYUyI':function(M,Y){return M(Y);}};return{'message':K&&K['message']?K['message']:n['WYUyI'](String,K),'stack':K&&K['stack']};}self['addEventLi'+'stener']('message',function(K){const n={'ZVWre':function(Y,g){return Y(g);},'JrBsC':'ready','JIoFd':'error','CGute':function(Y,g){return Y===g;},'VcsjX':'dispose','rASiu':function(Y,g){return Y===g;},'iysZw':'init'},M=K['data'];if(n['CGute'](M['type'],n['VcsjX'])){__workerContext=undefined;return;}if(n['rASiu'](M['type'],n['iysZw'])){const Y=M['payload'];self['__language'+'DirectionM'+'ap']=Y['languageDi'+'rectionMap']||{},self['g_profanit'+'y_list']=Y['profanityL'+'ist']||{},n['ZVWre'](loadPrefetchedFonts,Y['prefetched'+'Fonts']||[])['then'](function(){return n['ZVWre'](warmupFonts,Y['fontWarmup'+'s']||[]);})['then'](function(){__workerContext={'captionRenderParams':Y['captionRen'+'derParams'],'formattedCaptionsChunks':Y['formattedC'+'aptionsChu'+'nks'],'sequenceWidth':Y['sequenceWi'+'dth'],'sequenceHeight':Y['sequenceHe'+'ight']},self['postMessag'+'e']({'type':n['JrBsC']});})['catch'](function(g){self['postMessag'+'e']({'type':n['JIoFd'],...formatWorkerError(g)});});return;}if(M['type']==='render-ima'+'ge'){const g=M['payload'];n['ZVWre'](renderImage,g)['then'](function(h){self['postMessag'+'e']({'type':'render-ima'+'ge-result','requestId':g['requestId'],'pngBuffer':h['pngBuffer'],'boxPosition':h['boxPositio'+'n'],'drawMs':h['drawMs'],'encodeMs':h['encodeMs']},[h['pngBuffer']]);})['catch'](function(h){self['postMessag'+'e']({'type':n['JIoFd'],'requestId':g['requestId'],...formatWorkerError(h)});});}});