'use strict';let __workerContext=undefined;self['getLanguag'+'eDirection'+'FromLangua'+'ge']=function(N){const l=self['__language'+'DirectionM'+'ap'];return l&&l[N]||'LTR';},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(N){return N;},self['EXPORT_VID'+'EO_FRAMERA'+'TE']=0x1b16+0x7a+-0x1b72,importScripts('../utils/c'+'anvasRound'+'edRect.js'),importScripts('helpers.js');function assertContext(){const N={'eJyvx':function(l,L){return l===L;},'rLQCd':'Caption\x20wo'+'rker\x20not\x20i'+'nitialized'};if(N['eJyvx'](__workerContext,undefined))throw new Error(N['rLQCd']);return __workerContext;}function loadPrefetchedFonts(N){const l={'ClxZz':function(p,M){return p||M;},'fuXJa':function(p,M){return p===M;}},L=self['fonts'];if(l['ClxZz'](!L,!N)||l['fuXJa'](N['length'],-0x121b+0x1*-0x22a9+0x34c4*0x1))return Promise['resolve']();return Promise['all'](N['map'](function(y){const p={'style':y['style'],'weight':y['weight']};y['unicodeRan'+'ge']&&(p['unicodeRan'+'ge']=y['unicodeRan'+'ge']);const M=new FontFace(y['family'],y['dataBuffer'],p);return M['load']()['then'](function(){L['add'](M);});}));}function warmupFonts(N){const l={'LyXSf':function(p,M){return p||M;}},L=self['fonts'];if(l['LyXSf'](!L,!N)||N['length']===-0x930+-0xb*-0x16c+0x674*-0x1)return Promise['resolve']();return Promise['allSettled'](N['map'](function(y){return L['load'](y['fontString']);}));}function renderImage(N){const l={'IoCwV':function(A,w){return A-w;},'XOjQD':function(A){return A();},'JTCLG':function(A,w,S,E,g,U,Z,j,z){return A(w,S,E,g,U,Z,j,z);},'eICqm':'image/png'},L=l['XOjQD'](assertContext),y=L['sequenceWi'+'dth'],p=L['sequenceHe'+'ight'],M=L['captionRen'+'derParams'],O=L['formattedC'+'aptionsChu'+'nks'],P=M['language']||'en',t=new OffscreenCanvas(y,p),R=new OffscreenCanvas(y,p),Q=new OffscreenCanvas(y,p),H=R['getContext']('2d'),a=Q['getContext']('2d'),c={'language':P,'tempTextCtx':H,'tempShadowCtx':a},Y=Date['now'](),C=l['JTCLG'](test_74_render_captions_by_index,t,N['chunkIndex'],N['wordIndex'],M,N['layer'],O,![],c),n=l['IoCwV'](Date['now'](),Y),d=Date['now']();return t['convertToB'+'lob']({'type':l['eICqm']})['then'](function(A){return A['arrayBuffe'+'r']();})['then'](function(A){const w=l['IoCwV'](Date['now'](),d);return{'pngBuffer':A,'boxPosition':C,'drawMs':n,'encodeMs':w};});}function formatWorkerError(N){const l={'CWBqw':function(L,y){return L(y);}};return{'message':N&&N['message']?N['message']:l['CWBqw'](String,N),'stack':N&&N['stack']};}self['addEventLi'+'stener']('message',function(N){const l={'qwFpF':'ready','ZIdld':'error','SFtqi':function(y,p){return y(p);},'ErJal':'render-ima'+'ge-result','mgRjw':'dispose','UnCke':function(p,M){return p===M;},'kNxCx':'init','RdtDk':function(y,p){return y(p);},'VsMKj':function(p,M){return p===M;},'rqdyS':'render-ima'+'ge'},L=N['data'];if(L['type']===l['mgRjw']){__workerContext=undefined;return;}if(l['UnCke'](L['type'],l['kNxCx'])){const y=L['payload'];self['__language'+'DirectionM'+'ap']=y['languageDi'+'rectionMap']||{},self['g_profanit'+'y_list']=y['profanityL'+'ist']||{},l['RdtDk'](loadPrefetchedFonts,y['prefetched'+'Fonts']||[])['then'](function(){return 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':l['qwFpF']});})['catch'](function(p){self['postMessag'+'e']({'type':l['ZIdld'],...l['SFtqi'](formatWorkerError,p)});});return;}if(l['VsMKj'](L['type'],l['rqdyS'])){const p=L['payload'];l['SFtqi'](renderImage,p)['then'](function(M){self['postMessag'+'e']({'type':l['ErJal'],'requestId':p['requestId'],'pngBuffer':M['pngBuffer'],'boxPosition':M['boxPositio'+'n'],'drawMs':M['drawMs'],'encodeMs':M['encodeMs']},[M['pngBuffer']]);})['catch'](function(M){self['postMessag'+'e']({'type':l['ZIdld'],'requestId':p['requestId'],...formatWorkerError(M)});});}});