easyproctor 1.1.5 → 1.1.6

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.
package/esm/index.js CHANGED
@@ -15054,7 +15054,15 @@ async function checkPermissions() {
15054
15054
  async function checkIfhasMultipleMonitors() {
15055
15055
  return new Promise((resolve, reject) => {
15056
15056
  const checked = window.screen.isExtended;
15057
- resolve(checked);
15057
+ if (checked) {
15058
+ resolve(checked);
15059
+ } else {
15060
+ let totalScreens = [];
15061
+ window.getScreenDetails().then(function(details) {
15062
+ totalScreens = details;
15063
+ resolve(totalScreens.screens.length >= 2);
15064
+ });
15065
+ }
15058
15066
  });
15059
15067
  }
15060
15068
 
package/index.js CHANGED
@@ -25774,7 +25774,15 @@ async function checkPermissions() {
25774
25774
  async function checkIfhasMultipleMonitors() {
25775
25775
  return new Promise((resolve, reject) => {
25776
25776
  const checked = window.screen.isExtended;
25777
- resolve(checked);
25777
+ if (checked) {
25778
+ resolve(checked);
25779
+ } else {
25780
+ let totalScreens = [];
25781
+ window.getScreenDetails().then(function(details) {
25782
+ totalScreens = details;
25783
+ resolve(totalScreens.screens.length >= 2);
25784
+ });
25785
+ }
25778
25786
  });
25779
25787
  }
25780
25788
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -11,7 +11,7 @@ data bits: %d
11
11
  total bits: %d (remainder: %d)
12
12
  bitsperframe: %d
13
13
  `,8*o.main_data_begin,i.ResvSize,o.resvDrain_post,o.resvDrain_pre,8*i.sideinfo_len,r-o.resvDrain_post-8*i.sideinfo_len,r,r%8,m),Kt.err.println("This is a fatal error. It has several possible causes:"),Kt.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),Kt.err.println(" 9%% Your system is overclocked"),Kt.err.println(" 1%% bug in LAME encoding library"),i.ResvSize=o.main_data_begin*8),Ve(ve%8==0),ve>1e9){var l;for(l=0;l<Qe.MAX_HEADER_BUF;++l)i.header[l].write_timing-=ve;ve=0}return 0},this.copy_buffer=function(v,i,o,m,r){var l=F+1;if(l<=0)return 0;if(m!=0&&l>m)return-1;if(Kt.arraycopy(me,0,i,o,l),F=-1,J=0,r!=0){var f=Js(1);if(f[0]=v.nMusicCRC,te.updateMusicCRC(f,i,o,l),v.nMusicCRC=f[0],l>0&&(v.VBR_seek_table.nBytesWritten+=l),v.decode_on_the_fly){for(var p=Qs([2,1152]),H=l,g=-1,D;g!=0;)if(g=ce.hip_decode1_unclipped(v.hip,i,o,H,p[0],p[1]),H=0,g==-1&&(g=0),g>0){if(Ve(g<=1152),v.findPeakSample){for(D=0;D<g;D++)p[0][D]>v.PeakSample?v.PeakSample=p[0][D]:-p[0][D]>v.PeakSample&&(v.PeakSample=-p[0][D]);if(v.channels_out>1)for(D=0;D<g;D++)p[1][D]>v.PeakSample?v.PeakSample=p[1][D]:-p[1][D]>v.PeakSample&&(v.PeakSample=-p[1][D])}if(v.findReplayGain&&z.AnalyzeSamples(v.rgdata,p[0],0,p[1],0,g,v.channels_out)==Kr.GAIN_ANALYSIS_ERROR)return-6}}}return l},this.init_bit_stream_w=function(v){me=Zs(Ze.LAME_MAXMP3BUFFER),v.h_ptr=v.w_ptr=0,v.header[v.h_ptr].write_timing=0,F=-1,J=0,ve=0}}var lr=x0,en=ne.System,Je=ne.VbrMode,ca=ne.ShortBlock,Er=ne.new_float,ai=ne.new_int_n,tn=ne.new_short_n,Ct=ne.assert;function ht(){var w=this,X=128*1024;ht.V9=410,ht.V8=420,ht.V7=430,ht.V6=440,ht.V5=450,ht.V4=460,ht.V3=470,ht.V2=480,ht.V1=490,ht.V0=500,ht.R3MIX=1e3,ht.STANDARD=1001,ht.EXTREME=1002,ht.INSANE=1003,ht.STANDARD_FAST=1004,ht.EXTREME_FAST=1005,ht.MEDIUM=1006,ht.MEDIUM_FAST=1007;var K=16384+X;ht.LAME_MAXMP3BUFFER=K;var z,ce,Y,te,me,ve=new ia,F,J,ae,A;this.enc=new R,this.setModules=function(s,u,Q,se,pe,Re,Me,Ae,De){z=s,ce=u,Y=Q,te=se,me=pe,F=Re,J=Me,ae=Ae,A=De,this.enc.setModules(ce,ve,te,F)};function V(){this.mask_adjust=0,this.mask_adjust_short=0,this.bo_l_weight=Er(R.SBMAX_l),this.bo_s_weight=Er(R.SBMAX_s)}function e(){this.lowerlimit=0}function E(s,u){this.lowpass=u}var P=4294479419;function B(s){var u;return s.class_id=P,u=s.internal_flags=new Qe,s.mode=mt.NOT_SET,s.original=1,s.in_samplerate=44100,s.num_channels=2,s.num_samples=-1,s.bWriteVbrTag=!0,s.quality=-1,s.short_blocks=null,u.subblock_gain=-1,s.lowpassfreq=0,s.highpassfreq=0,s.lowpasswidth=-1,s.highpasswidth=-1,s.VBR=Je.vbr_off,s.VBR_q=4,s.ATHcurve=-1,s.VBR_mean_bitrate_kbps=128,s.VBR_min_bitrate_kbps=0,s.VBR_max_bitrate_kbps=0,s.VBR_hard_min=0,u.VBR_min_bitrate=1,u.VBR_max_bitrate=13,s.quant_comp=-1,s.quant_comp_short=-1,s.msfix=-1,u.resample_ratio=1,u.OldValue[0]=180,u.OldValue[1]=180,u.CurrentStep[0]=4,u.CurrentStep[1]=4,u.masking_lower=1,u.nsPsy.attackthre=-1,u.nsPsy.attackthre_s=-1,s.scale=-1,s.athaa_type=-1,s.ATHtype=-1,s.athaa_loudapprox=-1,s.athaa_sensitivity=0,s.useTemporal=null,s.interChRatio=-1,u.mf_samples_to_encode=R.ENCDELAY+R.POSTDELAY,s.encoder_padding=0,u.mf_size=R.ENCDELAY-R.MDCTDELAY,s.findReplayGain=!1,s.decode_on_the_fly=!1,u.decode_on_the_fly=!1,u.findReplayGain=!1,u.findPeakSample=!1,u.RadioGain=0,u.AudiophileGain=0,u.noclipGainChange=0,u.noclipScale=-1,s.preset=0,s.write_id3tag_automatic=!0,0}this.lame_init=function(){var s=new As,u=B(s);return u!=0?null:(s.lame_allocated_gfp=1,s)};function d(s){return s>1?0:s<=0?1:Math.cos(Math.PI/2*s)}this.nearestBitrateFullIndex=function(s){var u=[8,16,24,32,40,48,56,64,80,96,112,128,160,192,224,256,320],Q=0,se=0,pe=0,Re=0;Re=u[16],pe=16,se=u[16],Q=16;for(var Me=0;Me<16;Me++)if(Math.max(s,u[Me+1])!=s){Re=u[Me+1],pe=Me+1,se=u[Me],Q=Me;break}return Re-s>s-se?Q:pe};function _(s,u){var Q=44100;return u>=48e3?Q=48e3:u>=44100?Q=44100:u>=32e3?Q=32e3:u>=24e3?Q=24e3:u>=22050?Q=22050:u>=16e3?Q=16e3:u>=12e3?Q=12e3:u>=11025?Q=11025:u>=8e3&&(Q=8e3),s==-1?Q:(s<=15960&&(Q=44100),s<=15250&&(Q=32e3),s<=11220&&(Q=24e3),s<=9970&&(Q=22050),s<=7230&&(Q=16e3),s<=5420&&(Q=12e3),s<=4510&&(Q=11025),s<=3970&&(Q=8e3),u<Q?u>44100?48e3:u>32e3?44100:u>24e3?32e3:u>22050?24e3:u>16e3?22050:u>12e3?16e3:u>11025?12e3:u>8e3?11025:8e3:Q)}function T(s,u){switch(s){case 44100:return u.version=1,0;case 48e3:return u.version=1,1;case 32e3:return u.version=1,2;case 22050:return u.version=0,0;case 24e3:return u.version=0,1;case 16e3:return u.version=0,2;case 11025:return u.version=0,0;case 12e3:return u.version=0,1;case 8e3:return u.version=0,2;default:return u.version=0,-1}}function L(s,u,Q){Q<16e3&&(u=2);for(var se=ze.bitrate_table[u][1],pe=2;pe<=14;pe++)ze.bitrate_table[u][pe]>0&&Math.abs(ze.bitrate_table[u][pe]-s)<Math.abs(se-s)&&(se=ze.bitrate_table[u][pe]);return se}function b(s,u,Q){Q<16e3&&(u=2);for(var se=0;se<=14;se++)if(ze.bitrate_table[u][se]>0&&ze.bitrate_table[u][se]==s)return se;return-1}function a(s,u){var Q=[new E(8,2e3),new E(16,3700),new E(24,3900),new E(32,5500),new E(40,7e3),new E(48,7500),new E(56,1e4),new E(64,11e3),new E(80,13500),new E(96,15100),new E(112,15600),new E(128,17e3),new E(160,17500),new E(192,18600),new E(224,19400),new E(256,19700),new E(320,20500)],se=w.nearestBitrateFullIndex(u);s.lowerlimit=Q[se].lowpass}function I(s){var u=s.internal_flags,Q=32,se=-1;if(u.lowpass1>0){for(var pe=999,Re=0;Re<=31;Re++){var Me=Re/31;Me>=u.lowpass2&&(Q=Math.min(Q,Re)),u.lowpass1<Me&&Me<u.lowpass2&&(pe=Math.min(pe,Re))}pe==999?u.lowpass1=(Q-.75)/31:u.lowpass1=(pe-.75)/31,u.lowpass2=Q/31}if(u.highpass2>0&&u.highpass2<.9*(.75/31)&&(u.highpass1=0,u.highpass2=0,en.err.println(`Warning: highpass filter disabled. highpass frequency too small
14
- `)),u.highpass2>0){for(var Ae=-1,Re=0;Re<=31;Re++){var Me=Re/31;Me<=u.highpass1&&(se=Math.max(se,Re)),u.highpass1<Me&&Me<u.highpass2&&(Ae=Math.max(Ae,Re))}u.highpass1=se/31,Ae==-1?u.highpass2=(se+.75)/31:u.highpass2=(Ae+.75)/31}for(var Re=0;Re<32;Re++){var De,Ie,Me=Re/31;u.highpass2>u.highpass1?De=d((u.highpass2-Me)/(u.highpass2-u.highpass1+1e-20)):De=1,u.lowpass2>u.lowpass1?Ie=d((Me-u.lowpass1)/(u.lowpass2-u.lowpass1+1e-20)):Ie=1,u.amp_filter[Re]=De*Ie}}function v(s){var u=s.internal_flags;switch(s.quality){default:case 9:u.psymodel=0,u.noise_shaping=0,u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.use_best_huffman=0,u.full_outer_loop=0;break;case 8:s.quality=7;case 7:u.psymodel=1,u.noise_shaping=0,u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.use_best_huffman=0,u.full_outer_loop=0;break;case 6:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=0,u.full_outer_loop=0;break;case 5:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=0,u.full_outer_loop=0;break;case 4:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 3:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=1,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 2:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=1,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 1:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=2,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 0:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=2,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break}}function i(s){var u=s.internal_flags;s.frameNum=0,s.write_id3tag_automatic&&ae.id3tag_write_v2(s),u.bitrate_stereoMode_Hist=ai([16,4+1]),u.bitrate_blockType_Hist=ai([16,4+1+1]),u.PeakSample=0,s.bWriteVbrTag&&F.InitVbrTag(s)}this.lame_init_params=function(s){var u=s.internal_flags;if(u.Class_ID=0,u.ATH==null&&(u.ATH=new Vs),u.PSY==null&&(u.PSY=new V),u.rgdata==null&&(u.rgdata=new qs),u.channels_in=s.num_channels,u.channels_in==1&&(s.mode=mt.MONO),u.channels_out=s.mode==mt.MONO?1:2,u.mode_ext=R.MPG_MD_MS_LR,s.mode==mt.MONO&&(s.force_ms=!1),s.VBR==Je.vbr_off&&s.VBR_mean_bitrate_kbps!=128&&s.brate==0&&(s.brate=s.VBR_mean_bitrate_kbps),s.VBR==Je.vbr_off||s.VBR==Je.vbr_mtrh||s.VBR==Je.vbr_mt||(s.free_format=!1),s.VBR==Je.vbr_off&&s.brate==0&&lr.EQ(s.compression_ratio,0)&&(s.compression_ratio=11.025),s.VBR==Je.vbr_off&&s.compression_ratio>0&&(s.out_samplerate==0&&(s.out_samplerate=map2MP3Frequency(int(.97*s.in_samplerate))),s.brate=0|s.out_samplerate*16*u.channels_out/(1e3*s.compression_ratio),u.samplerate_index=T(s.out_samplerate,s),s.free_format||(s.brate=L(s.brate,s.version,s.out_samplerate))),s.out_samplerate!=0&&(s.out_samplerate<16e3?(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,8),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,64)):s.out_samplerate<32e3?(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,8),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,160)):(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,32),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,320))),s.lowpassfreq==0){var Q=16e3;switch(s.VBR){case Je.vbr_off:{var se=new e;a(se,s.brate),Q=se.lowerlimit;break}case Je.vbr_abr:{var se=new e;a(se,s.VBR_mean_bitrate_kbps),Q=se.lowerlimit;break}case Je.vbr_rh:{var pe=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=s.VBR_q&&s.VBR_q<=9){var Re=pe[s.VBR_q],Me=pe[s.VBR_q+1],Ae=s.VBR_q_frac;Q=linear_int(Re,Me,Ae)}else Q=19500;break}default:{var pe=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=s.VBR_q&&s.VBR_q<=9){var Re=pe[s.VBR_q],Me=pe[s.VBR_q+1],Ae=s.VBR_q_frac;Q=linear_int(Re,Me,Ae)}else Q=19500}}s.mode==mt.MONO&&(s.VBR==Je.vbr_off||s.VBR==Je.vbr_abr)&&(Q*=1.5),s.lowpassfreq=Q|0}if(s.out_samplerate==0&&(2*s.lowpassfreq>s.in_samplerate&&(s.lowpassfreq=s.in_samplerate/2),s.out_samplerate=_(s.lowpassfreq|0,s.in_samplerate)),s.lowpassfreq=Math.min(20500,s.lowpassfreq),s.lowpassfreq=Math.min(s.out_samplerate/2,s.lowpassfreq),s.VBR==Je.vbr_off&&(s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.brate)),s.VBR==Je.vbr_abr&&(s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.VBR_mean_bitrate_kbps)),s.bWriteVbrTag||(s.findReplayGain=!1,s.decode_on_the_fly=!1,u.findPeakSample=!1),u.findReplayGain=s.findReplayGain,u.decode_on_the_fly=s.decode_on_the_fly,u.decode_on_the_fly&&(u.findPeakSample=!0),u.findReplayGain&&z.InitGainAnalysis(u.rgdata,s.out_samplerate)==Kr.INIT_GAIN_ANALYSIS_ERROR)return s.internal_flags=null,-6;switch(u.decode_on_the_fly&&!s.decode_only&&(u.hip!=null&&A.hip_decode_exit(u.hip),u.hip=A.hip_decode_init()),u.mode_gr=s.out_samplerate<=24e3?1:2,s.framesize=576*u.mode_gr,s.encoder_delay=R.ENCDELAY,u.resample_ratio=s.in_samplerate/s.out_samplerate,s.VBR){case Je.vbr_mt:case Je.vbr_rh:case Je.vbr_mtrh:{var De=[5.7,6.5,7.3,8.2,10,11.9,13,14,15,16.5];s.compression_ratio=De[s.VBR_q]}break;case Je.vbr_abr:s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.VBR_mean_bitrate_kbps);break;default:s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.brate);break}if(s.mode==mt.NOT_SET&&(s.mode=mt.JOINT_STEREO),s.highpassfreq>0?(u.highpass1=2*s.highpassfreq,s.highpasswidth>=0?u.highpass2=2*(s.highpassfreq+s.highpasswidth):u.highpass2=(1+0)*2*s.highpassfreq,u.highpass1/=s.out_samplerate,u.highpass2/=s.out_samplerate):(u.highpass1=0,u.highpass2=0),s.lowpassfreq>0?(u.lowpass2=2*s.lowpassfreq,s.lowpasswidth>=0?(u.lowpass1=2*(s.lowpassfreq-s.lowpasswidth),u.lowpass1<0&&(u.lowpass1=0)):u.lowpass1=(1-0)*2*s.lowpassfreq,u.lowpass1/=s.out_samplerate,u.lowpass2/=s.out_samplerate):(u.lowpass1=0,u.lowpass2=0),I(s),u.samplerate_index=T(s.out_samplerate,s),u.samplerate_index<0)return s.internal_flags=null,-1;if(s.VBR==Je.vbr_off){if(s.free_format)u.bitrate_index=0;else if(s.brate=L(s.brate,s.version,s.out_samplerate),u.bitrate_index=b(s.brate,s.version,s.out_samplerate),u.bitrate_index<=0)return s.internal_flags=null,-1}else u.bitrate_index=1;s.analysis&&(s.bWriteVbrTag=!1),u.pinfo!=null&&(s.bWriteVbrTag=!1),ce.init_bit_stream_w(u);for(var Ie=u.samplerate_index+3*s.version+6*(s.out_samplerate<16e3?1:0),Ee=0;Ee<R.SBMAX_l+1;Ee++)u.scalefac_band.l[Ee]=te.sfBandIndex[Ie].l[Ee];for(var Ee=0;Ee<R.PSFB21+1;Ee++){var Ge=(u.scalefac_band.l[22]-u.scalefac_band.l[21])/R.PSFB21,tt=u.scalefac_band.l[21]+Ee*Ge;u.scalefac_band.psfb21[Ee]=tt}u.scalefac_band.psfb21[R.PSFB21]=576;for(var Ee=0;Ee<R.SBMAX_s+1;Ee++)u.scalefac_band.s[Ee]=te.sfBandIndex[Ie].s[Ee];for(var Ee=0;Ee<R.PSFB12+1;Ee++){var Ge=(u.scalefac_band.s[13]-u.scalefac_band.s[12])/R.PSFB12,tt=u.scalefac_band.s[12]+Ee*Ge;u.scalefac_band.psfb12[Ee]=tt}u.scalefac_band.psfb12[R.PSFB12]=192,s.version==1?u.sideinfo_len=u.channels_out==1?4+17:4+32:u.sideinfo_len=u.channels_out==1?4+9:4+17,s.error_protection&&(u.sideinfo_len+=2),i(s),u.Class_ID=P;{var We;for(We=0;We<19;We++)u.nsPsy.pefirbuf[We]=700*u.mode_gr*u.channels_out;s.ATHtype==-1&&(s.ATHtype=4)}switch(Ct(s.VBR_q<=9),Ct(s.VBR_q>=0),s.VBR){case Je.vbr_mt:s.VBR=Je.vbr_mtrh;case Je.vbr_mtrh:{s.useTemporal==null&&(s.useTemporal=!1),Y.apply_preset(s,500-s.VBR_q*10,0),s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),s.quality<5&&(s.quality=0),s.quality>5&&(s.quality=5),u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,s.experimentalY?u.sfb21_extra=!1:u.sfb21_extra=s.out_samplerate>44e3,u.iteration_loop=new VBRNewIterationLoop(me);break}case Je.vbr_rh:{Y.apply_preset(s,500-s.VBR_q*10,0),u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,s.experimentalY?u.sfb21_extra=!1:u.sfb21_extra=s.out_samplerate>44e3,s.quality>6&&(s.quality=6),s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),u.iteration_loop=new VBROldIterationLoop(me);break}default:{var rt;u.sfb21_extra=!1,s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),rt=s.VBR,rt==Je.vbr_off&&(s.VBR_mean_bitrate_kbps=s.brate),Y.apply_preset(s,s.VBR_mean_bitrate_kbps,0),s.VBR=rt,u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,rt==Je.vbr_off?u.iteration_loop=new Gs(me):u.iteration_loop=new ABRIterationLoop(me);break}}if(Ct(s.scale>=0),s.VBR!=Je.vbr_off){if(u.VBR_min_bitrate=1,u.VBR_max_bitrate=14,s.out_samplerate<16e3&&(u.VBR_max_bitrate=8),s.VBR_min_bitrate_kbps!=0&&(s.VBR_min_bitrate_kbps=L(s.VBR_min_bitrate_kbps,s.version,s.out_samplerate),u.VBR_min_bitrate=b(s.VBR_min_bitrate_kbps,s.version,s.out_samplerate),u.VBR_min_bitrate<0)||s.VBR_max_bitrate_kbps!=0&&(s.VBR_max_bitrate_kbps=L(s.VBR_max_bitrate_kbps,s.version,s.out_samplerate),u.VBR_max_bitrate=b(s.VBR_max_bitrate_kbps,s.version,s.out_samplerate),u.VBR_max_bitrate<0))return-1;s.VBR_min_bitrate_kbps=ze.bitrate_table[s.version][u.VBR_min_bitrate],s.VBR_max_bitrate_kbps=ze.bitrate_table[s.version][u.VBR_max_bitrate],s.VBR_mean_bitrate_kbps=Math.min(ze.bitrate_table[s.version][u.VBR_max_bitrate],s.VBR_mean_bitrate_kbps),s.VBR_mean_bitrate_kbps=Math.max(ze.bitrate_table[s.version][u.VBR_min_bitrate],s.VBR_mean_bitrate_kbps)}return s.tune&&(u.PSY.mask_adjust+=s.tune_value_a,u.PSY.mask_adjust_short+=s.tune_value_a),v(s),Ct(s.scale>=0),s.athaa_type<0?u.ATH.useAdjust=3:u.ATH.useAdjust=s.athaa_type,u.ATH.aaSensitivityP=Math.pow(10,s.athaa_sensitivity/-10),s.short_blocks==null&&(s.short_blocks=ca.short_block_allowed),s.short_blocks==ca.short_block_allowed&&(s.mode==mt.JOINT_STEREO||s.mode==mt.STEREO)&&(s.short_blocks=ca.short_block_coupled),s.quant_comp<0&&(s.quant_comp=1),s.quant_comp_short<0&&(s.quant_comp_short=0),s.msfix<0&&(s.msfix=0),s.exp_nspsytune=s.exp_nspsytune|1,s.internal_flags.nsPsy.attackthre<0&&(s.internal_flags.nsPsy.attackthre=ia.NSATTACKTHRE),s.internal_flags.nsPsy.attackthre_s<0&&(s.internal_flags.nsPsy.attackthre_s=ia.NSATTACKTHRE_S),Ct(s.scale>=0),s.scale<0&&(s.scale=1),s.ATHtype<0&&(s.ATHtype=4),s.ATHcurve<0&&(s.ATHcurve=4),s.athaa_loudapprox<0&&(s.athaa_loudapprox=2),s.interChRatio<0&&(s.interChRatio=0),s.useTemporal==null&&(s.useTemporal=!0),u.slot_lag=u.frac_SpF=0,s.VBR==Je.vbr_off&&(u.slot_lag=u.frac_SpF=(s.version+1)*72e3*s.brate%s.out_samplerate|0),te.iteration_init(s),ve.psymodel_init(s),Ct(s.scale>=0),0};function o(s,u){(s.in_buffer_0==null||s.in_buffer_nsamples<u)&&(s.in_buffer_0=Er(u),s.in_buffer_1=Er(u),s.in_buffer_nsamples=u)}this.lame_encode_flush=function(s,u,Q,se){var pe=s.internal_flags,Re=tn([2,1152]),Me=0,Ae,De,Ie,Ee,Ge=pe.mf_samples_to_encode-R.POSTDELAY,tt=m(s);if(pe.mf_samples_to_encode<1)return 0;for(Ae=0,s.in_samplerate!=s.out_samplerate&&(Ge+=16*s.out_samplerate/s.in_samplerate),Ie=s.framesize-Ge%s.framesize,Ie<576&&(Ie+=s.framesize),s.encoder_padding=Ie,Ee=(Ge+Ie)/s.framesize;Ee>0&&Me>=0;){var We=tt-pe.mf_size,rt=s.frameNum;We*=s.in_samplerate,We/=s.out_samplerate,We>1152&&(We=1152),We<1&&(We=1),De=se-Ae,se==0&&(De=0),Me=this.lame_encode_buffer(s,Re[0],Re[1],We,u,Q,De),Q+=Me,Ae+=Me,Ee-=rt!=s.frameNum?1:0}if(pe.mf_samples_to_encode=0,Me<0||(De=se-Ae,se==0&&(De=0),ce.flush_bitstream(s),Me=ce.copy_buffer(pe,u,Q,De,1),Me<0))return Me;if(Q+=Me,Ae+=Me,De=se-Ae,se==0&&(De=0),s.write_id3tag_automatic){if(ae.id3tag_write_v1(s),Me=ce.copy_buffer(pe,u,Q,De,0),Me<0)return Me;Ae+=Me}return Ae},this.lame_encode_buffer=function(s,u,Q,se,pe,Re,Me){var Ae=s.internal_flags,De=[null,null];if(Ae.Class_ID!=P)return-3;if(se==0)return 0;o(Ae,se),De[0]=Ae.in_buffer_0,De[1]=Ae.in_buffer_1;for(var Ie=0;Ie<se;Ie++)De[0][Ie]=u[Ie],Ae.channels_in>1&&(De[1][Ie]=Q[Ie]);return r(s,De[0],De[1],se,pe,Re,Me)};function m(s){var u=R.BLKSIZE+s.framesize-R.FFTOFFSET;return u=Math.max(u,512+s.framesize-32),Ct(Qe.MFSIZE>=u),u}function r(s,u,Q,se,pe,Re,Me){var Ae=s.internal_flags,De=0,Ie,Ee,Ge,tt,We,rt=[null,null],lt=[null,null];if(Ae.Class_ID!=P)return-3;if(se==0)return 0;if(We=ce.copy_buffer(Ae,pe,Re,Me,0),We<0)return We;if(Re+=We,De+=We,lt[0]=u,lt[1]=Q,lr.NEQ(s.scale,0)&&lr.NEQ(s.scale,1))for(Ee=0;Ee<se;++Ee)lt[0][Ee]*=s.scale,Ae.channels_out==2&&(lt[1][Ee]*=s.scale);if(lr.NEQ(s.scale_left,0)&&lr.NEQ(s.scale_left,1))for(Ee=0;Ee<se;++Ee)lt[0][Ee]*=s.scale_left;if(lr.NEQ(s.scale_right,0)&&lr.NEQ(s.scale_right,1))for(Ee=0;Ee<se;++Ee)lt[1][Ee]*=s.scale_right;if(s.num_channels==2&&Ae.channels_out==1)for(Ee=0;Ee<se;++Ee)lt[0][Ee]=.5*(lt[0][Ee]+lt[1][Ee]),lt[1][Ee]=0;tt=m(s),rt[0]=Ae.mfbuf[0],rt[1]=Ae.mfbuf[1];for(var _t=0;se>0;){var pt=[null,null],Qt=0,At=0;pt[0]=lt[0],pt[1]=lt[1];var Mt=new f;if(oe(s,rt,pt,_t,se,Mt),Qt=Mt.n_in,At=Mt.n_out,Ae.findReplayGain&&!Ae.decode_on_the_fly&&z.AnalyzeSamples(Ae.rgdata,rt[0],Ae.mf_size,rt[1],Ae.mf_size,At,Ae.channels_out)==Kr.GAIN_ANALYSIS_ERROR)return-6;if(se-=Qt,_t+=Qt,Ae.channels_out==2,Ae.mf_size+=At,Ct(Ae.mf_size<=Qe.MFSIZE),Ae.mf_samples_to_encode<1&&(Ae.mf_samples_to_encode=R.ENCDELAY+R.POSTDELAY),Ae.mf_samples_to_encode+=At,Ae.mf_size>=tt){var Ut=Me-De;if(Me==0&&(Ut=0),Ie=l(s,rt[0],rt[1],pe,Re,Ut),Ie<0)return Ie;for(Re+=Ie,De+=Ie,Ae.mf_size-=s.framesize,Ae.mf_samples_to_encode-=s.framesize,Ge=0;Ge<Ae.channels_out;Ge++)for(Ee=0;Ee<Ae.mf_size;Ee++)rt[Ge][Ee]=rt[Ge][Ee+s.framesize]}}return Ct(se==0),De}function l(s,u,Q,se,pe,Re){var Me=w.enc.lame_encode_mp3_frame(s,u,Q,se,pe,Re);return s.frameNum++,Me}function f(){this.n_in=0,this.n_out=0}function p(){this.num_used=0}function H(s,u){return u!=0?H(u,s%u):s}function g(s,u,Q){var se=Math.PI*u;s/=Q,s<0&&(s=0),s>1&&(s=1);var pe=s-.5,Re=.42-.5*Math.cos(2*s*Math.PI)+.08*Math.cos(4*s*Math.PI);return Math.abs(pe)<1e-9?se/Math.PI:Re*Math.sin(Q*se*pe)/(Math.PI*Q*pe)}function D(s,u,Q,se,pe,Re,Me,Ae,De){var Ie=s.internal_flags,Ee,Ge=0,tt,We=s.out_samplerate/H(s.out_samplerate,s.in_samplerate);We>Qe.BPC&&(We=Qe.BPC);var rt=Math.abs(Ie.resample_ratio-Math.floor(.5+Ie.resample_ratio))<1e-4?1:0,lt=1/Ie.resample_ratio;lt>1&&(lt=1);var _t=31;_t%2==0&&--_t,_t+=rt;var pt=_t+1;if(Ie.fill_buffer_resample_init==0){for(Ie.inbuf_old[0]=Er(pt),Ie.inbuf_old[1]=Er(pt),Ee=0;Ee<=2*We;++Ee)Ie.blackfilt[Ee]=Er(pt);for(Ie.itime[0]=0,Ie.itime[1]=0,Ge=0;Ge<=2*We;Ge++){var Qt=0,At=(Ge-We)/(2*We);for(Ee=0;Ee<=_t;Ee++)Qt+=Ie.blackfilt[Ge][Ee]=g(Ee-At,lt,_t);for(Ee=0;Ee<=_t;Ee++)Ie.blackfilt[Ge][Ee]/=Qt}Ie.fill_buffer_resample_init=1}var Mt=Ie.inbuf_old[De];for(tt=0;tt<se;tt++){var Ut,wr;if(Ut=tt*Ie.resample_ratio,Ge=0|Math.floor(Ut-Ie.itime[De]),_t+Ge-_t/2>=Me)break;var At=Ut-Ie.itime[De]-(Ge+.5*(_t%2));Ct(Math.abs(At)<=.501),wr=0|Math.floor(At*2*We+We+.5);var Ar=0;for(Ee=0;Ee<=_t;++Ee){var qt=Ee+Ge-_t/2,Rt;Ct(qt<Me),Ct(qt+pt>=0),Rt=qt<0?Mt[pt+qt]:pe[Re+qt],Ar+=Rt*Ie.blackfilt[wr][Ee]}u[Q+tt]=Ar}if(Ae.num_used=Math.min(Me,_t+Ge-_t/2),Ie.itime[De]+=Ae.num_used-tt*Ie.resample_ratio,Ae.num_used>=pt)for(Ee=0;Ee<pt;Ee++)Mt[Ee]=pe[Re+Ae.num_used+Ee-pt];else{var _r=pt-Ae.num_used;for(Ee=0;Ee<_r;++Ee)Mt[Ee]=Mt[Ee+Ae.num_used];for(Ge=0;Ee<pt;++Ee,++Ge)Mt[Ee]=pe[Re+Ge];Ct(Ge==Ae.num_used)}return tt}function oe(s,u,Q,se,pe,Re){var Me=s.internal_flags;if(Me.resample_ratio<.9999||Me.resample_ratio>1.0001)for(var Ae=0;Ae<Me.channels_out;Ae++){var De=new p;Re.n_out=D(s,u[Ae],Me.mf_size,s.framesize,Q[Ae],se,pe,De,Ae),Re.n_in=De.num_used}else{Re.n_out=Math.min(s.framesize,pe),Re.n_in=Re.n_out;for(var Ie=0;Ie<Re.n_out;++Ie)u[0][Me.mf_size+Ie]=Q[0][se+Ie],Me.channels_out==2&&(u[1][Me.mf_size+Ie]=Q[1][se+Ie])}}}var rn=ht,Wt=ne.VbrMode;function an(){function w(F,J,ae,A,V,e,E,P,B,d,_,T,L,b,a){this.vbr_q=F,this.quant_comp=J,this.quant_comp_s=ae,this.expY=A,this.st_lrm=V,this.st_s=e,this.masking_adj=E,this.masking_adj_short=P,this.ath_lower=B,this.ath_curve=d,this.ath_sensitivity=_,this.interch=T,this.safejoint=L,this.sfb21mod=b,this.msfix=a}function X(F,J,ae,A,V,e,E,P,B,d,_,T,L,b){this.quant_comp=J,this.quant_comp_s=ae,this.safejoint=A,this.nsmsfix=V,this.st_lrm=e,this.st_s=E,this.nsbass=P,this.scale=B,this.masking_adj=d,this.ath_lower=_,this.ath_curve=T,this.interch=L,this.sfscale=b}var K;this.setModules=function(F){K=F};var z=[new w(0,9,9,0,5.2,125,-4.2,-6.3,4.8,1,0,0,2,21,.97),new w(1,9,9,0,5.3,125,-3.6,-5.6,4.5,1.5,0,0,2,21,1.35),new w(2,9,9,0,5.6,125,-2.2,-3.5,2.8,2,0,0,2,21,1.49),new w(3,9,9,1,5.8,130,-1.8,-2.8,2.6,3,-4,0,2,20,1.64),new w(4,9,9,1,6,135,-.7,-1.1,1.1,3.5,-8,0,2,0,1.79),new w(5,9,9,1,6.4,140,.5,.4,-7.5,4,-12,2e-4,0,0,1.95),new w(6,9,9,1,6.6,145,.67,.65,-14.7,6.5,-19,4e-4,0,0,2.3),new w(7,9,9,1,6.6,145,.8,.75,-19.7,8,-22,6e-4,0,0,2.7),new w(8,9,9,1,6.6,145,1.2,1.15,-27.5,10,-23,7e-4,0,0,0),new w(9,9,9,1,6.6,145,1.6,1.6,-36,11,-25,8e-4,0,0,0),new w(10,9,9,1,6.6,145,2,2,-36,12,-25,8e-4,0,0,0)],ce=[new w(0,9,9,0,4.2,25,-7,-4,7.5,1,0,0,2,26,.97),new w(1,9,9,0,4.2,25,-5.6,-3.6,4.5,1.5,0,0,2,21,1.35),new w(2,9,9,0,4.2,25,-4.4,-1.8,2,2,0,0,2,18,1.49),new w(3,9,9,1,4.2,25,-3.4,-1.25,1.1,3,-4,0,2,15,1.64),new w(4,9,9,1,4.2,25,-2.2,.1,0,3.5,-8,0,2,0,1.79),new w(5,9,9,1,4.2,25,-1,1.65,-7.7,4,-12,2e-4,0,0,1.95),new w(6,9,9,1,4.2,25,-0,2.47,-7.7,6.5,-19,4e-4,0,0,2),new w(7,9,9,1,4.2,25,.5,2,-14.5,8,-22,6e-4,0,0,2),new w(8,9,9,1,4.2,25,1,2.4,-22,10,-23,7e-4,0,0,2),new w(9,9,9,1,4.2,25,1.5,2.95,-30,11,-25,8e-4,0,0,2),new w(10,9,9,1,4.2,25,2,2.95,-36,12,-30,8e-4,0,0,2)];function Y(F,J,ae){var A=F.VBR==Wt.vbr_rh?z:ce,V=F.VBR_q_frac,e=A[J],E=A[J+1],P=e;e.st_lrm=e.st_lrm+V*(E.st_lrm-e.st_lrm),e.st_s=e.st_s+V*(E.st_s-e.st_s),e.masking_adj=e.masking_adj+V*(E.masking_adj-e.masking_adj),e.masking_adj_short=e.masking_adj_short+V*(E.masking_adj_short-e.masking_adj_short),e.ath_lower=e.ath_lower+V*(E.ath_lower-e.ath_lower),e.ath_curve=e.ath_curve+V*(E.ath_curve-e.ath_curve),e.ath_sensitivity=e.ath_sensitivity+V*(E.ath_sensitivity-e.ath_sensitivity),e.interch=e.interch+V*(E.interch-e.interch),e.msfix=e.msfix+V*(E.msfix-e.msfix),ve(F,P.vbr_q),ae!=0?F.quant_comp=P.quant_comp:Math.abs(F.quant_comp- -1)>0||(F.quant_comp=P.quant_comp),ae!=0?F.quant_comp_short=P.quant_comp_s:Math.abs(F.quant_comp_short- -1)>0||(F.quant_comp_short=P.quant_comp_s),P.expY!=0&&(F.experimentalY=P.expY!=0),ae!=0?F.internal_flags.nsPsy.attackthre=P.st_lrm:Math.abs(F.internal_flags.nsPsy.attackthre- -1)>0||(F.internal_flags.nsPsy.attackthre=P.st_lrm),ae!=0?F.internal_flags.nsPsy.attackthre_s=P.st_s:Math.abs(F.internal_flags.nsPsy.attackthre_s- -1)>0||(F.internal_flags.nsPsy.attackthre_s=P.st_s),ae!=0?F.maskingadjust=P.masking_adj:Math.abs(F.maskingadjust-0)>0||(F.maskingadjust=P.masking_adj),ae!=0?F.maskingadjust_short=P.masking_adj_short:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=P.masking_adj_short),ae!=0?F.ATHlower=-P.ath_lower/10:Math.abs(-F.ATHlower*10-0)>0||(F.ATHlower=-P.ath_lower/10),ae!=0?F.ATHcurve=P.ath_curve:Math.abs(F.ATHcurve- -1)>0||(F.ATHcurve=P.ath_curve),ae!=0?F.athaa_sensitivity=P.ath_sensitivity:Math.abs(F.athaa_sensitivity- -1)>0||(F.athaa_sensitivity=P.ath_sensitivity),P.interch>0&&(ae!=0?F.interChRatio=P.interch:Math.abs(F.interChRatio- -1)>0||(F.interChRatio=P.interch)),P.safejoint>0&&(F.exp_nspsytune=F.exp_nspsytune|P.safejoint),P.sfb21mod>0&&(F.exp_nspsytune=F.exp_nspsytune|P.sfb21mod<<20),ae!=0?F.msfix=P.msfix:Math.abs(F.msfix- -1)>0||(F.msfix=P.msfix),ae==0&&(F.VBR_q=J,F.VBR_q_frac=V)}var te=[new X(8,9,9,0,0,6.6,145,0,.95,0,-30,11,.0012,1),new X(16,9,9,0,0,6.6,145,0,.95,0,-25,11,.001,1),new X(24,9,9,0,0,6.6,145,0,.95,0,-20,11,.001,1),new X(32,9,9,0,0,6.6,145,0,.95,0,-15,11,.001,1),new X(40,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new X(48,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new X(56,9,9,0,0,6.6,145,0,.95,0,-6,11,8e-4,1),new X(64,9,9,0,0,6.6,145,0,.95,0,-2,11,8e-4,1),new X(80,9,9,0,0,6.6,145,0,.95,0,0,8,7e-4,1),new X(96,9,9,0,2.5,6.6,145,0,.95,0,1,5.5,6e-4,1),new X(112,9,9,0,2.25,6.6,145,0,.95,0,2,4.5,5e-4,1),new X(128,9,9,0,1.95,6.4,140,0,.95,0,3,4,2e-4,1),new X(160,9,9,1,1.79,6,135,0,.95,-2,5,3.5,0,1),new X(192,9,9,1,1.49,5.6,125,0,.97,-4,7,3,0,0),new X(224,9,9,1,1.25,5.2,125,0,.98,-6,9,2,0,0),new X(256,9,9,1,.97,5.2,125,0,1,-8,10,1,0,0),new X(320,9,9,1,.9,5.2,125,0,1,-10,12,0,0,0)];function me(F,J,ae){var A=J,V=K.nearestBitrateFullIndex(J);if(F.VBR=Wt.vbr_abr,F.VBR_mean_bitrate_kbps=A,F.VBR_mean_bitrate_kbps=Math.min(F.VBR_mean_bitrate_kbps,320),F.VBR_mean_bitrate_kbps=Math.max(F.VBR_mean_bitrate_kbps,8),F.brate=F.VBR_mean_bitrate_kbps,F.VBR_mean_bitrate_kbps>320&&(F.disable_reservoir=!0),te[V].safejoint>0&&(F.exp_nspsytune=F.exp_nspsytune|2),te[V].sfscale>0&&(F.internal_flags.noise_shaping=2),Math.abs(te[V].nsbass)>0){var e=int(te[V].nsbass*4);e<0&&(e+=64),F.exp_nspsytune=F.exp_nspsytune|e<<2}return ae!=0?F.quant_comp=te[V].quant_comp:Math.abs(F.quant_comp- -1)>0||(F.quant_comp=te[V].quant_comp),ae!=0?F.quant_comp_short=te[V].quant_comp_s:Math.abs(F.quant_comp_short- -1)>0||(F.quant_comp_short=te[V].quant_comp_s),ae!=0?F.msfix=te[V].nsmsfix:Math.abs(F.msfix- -1)>0||(F.msfix=te[V].nsmsfix),ae!=0?F.internal_flags.nsPsy.attackthre=te[V].st_lrm:Math.abs(F.internal_flags.nsPsy.attackthre- -1)>0||(F.internal_flags.nsPsy.attackthre=te[V].st_lrm),ae!=0?F.internal_flags.nsPsy.attackthre_s=te[V].st_s:Math.abs(F.internal_flags.nsPsy.attackthre_s- -1)>0||(F.internal_flags.nsPsy.attackthre_s=te[V].st_s),ae!=0?F.scale=te[V].scale:Math.abs(F.scale- -1)>0||(F.scale=te[V].scale),ae!=0?F.maskingadjust=te[V].masking_adj:Math.abs(F.maskingadjust-0)>0||(F.maskingadjust=te[V].masking_adj),te[V].masking_adj>0?ae!=0?F.maskingadjust_short=te[V].masking_adj*.9:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=te[V].masking_adj*.9):ae!=0?F.maskingadjust_short=te[V].masking_adj*1.1:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=te[V].masking_adj*1.1),ae!=0?F.ATHlower=-te[V].ath_lower/10:Math.abs(-F.ATHlower*10-0)>0||(F.ATHlower=-te[V].ath_lower/10),ae!=0?F.ATHcurve=te[V].ath_curve:Math.abs(F.ATHcurve- -1)>0||(F.ATHcurve=te[V].ath_curve),ae!=0?F.interChRatio=te[V].interch:Math.abs(F.interChRatio- -1)>0||(F.interChRatio=te[V].interch),J}this.apply_preset=function(F,J,ae){switch(J){case Ze.R3MIX:{J=Ze.V3,F.VBR=Wt.vbr_mtrh;break}case Ze.MEDIUM:{J=Ze.V4,F.VBR=Wt.vbr_rh;break}case Ze.MEDIUM_FAST:{J=Ze.V4,F.VBR=Wt.vbr_mtrh;break}case Ze.STANDARD:{J=Ze.V2,F.VBR=Wt.vbr_rh;break}case Ze.STANDARD_FAST:{J=Ze.V2,F.VBR=Wt.vbr_mtrh;break}case Ze.EXTREME:{J=Ze.V0,F.VBR=Wt.vbr_rh;break}case Ze.EXTREME_FAST:{J=Ze.V0,F.VBR=Wt.vbr_mtrh;break}case Ze.INSANE:return J=320,F.preset=J,me(F,J,ae),F.VBR=Wt.vbr_off,J}switch(F.preset=J,J){case Ze.V9:return Y(F,9,ae),J;case Ze.V8:return Y(F,8,ae),J;case Ze.V7:return Y(F,7,ae),J;case Ze.V6:return Y(F,6,ae),J;case Ze.V5:return Y(F,5,ae),J;case Ze.V4:return Y(F,4,ae),J;case Ze.V3:return Y(F,3,ae),J;case Ze.V2:return Y(F,2,ae),J;case Ze.V1:return Y(F,1,ae),J;case Ze.V0:return Y(F,0,ae),J;default:break}return 8<=J&&J<=320?me(F,J,ae):(F.preset=0,J)};function ve(F,J){var ae=0;return 0>J&&(ae=-1,J=0),9<J&&(ae=-1,J=9),F.VBR_q=J,F.VBR_q_frac=0,ae}}var sn=an;function nn(){var w,X;this.setModules=function(K,z){w=K,X=z}}var on=nn;function ln(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}var _a=ln,ii=ne.new_float,cn=ne.new_int;function _n(){this.global_gain=0,this.sfb_count1=0,this.step=cn(39),this.noise=ii(39),this.noise_log=ii(39)}var un=_n,cr=ne.System,si=ne.VbrMode,ua=ne.Util,gr=ne.Arrays,jr=ne.new_float,Dt=ne.assert;function dn(){var w;this.rv=null;var X;this.qupvt=null;var K,z=new on,ce;this.setModules=function(B,d,_,T){w=B,X=d,this.rv=d,K=_,this.qupvt=_,ce=T,z.setModules(K,ce)},this.ms_convert=function(B,d){for(var _=0;_<576;++_){var T=B.tt[d][0].xr[_],L=B.tt[d][1].xr[_];B.tt[d][0].xr[_]=(T+L)*(ua.SQRT2*.5),B.tt[d][1].xr[_]=(T-L)*(ua.SQRT2*.5)}};function Y(B,d,_,T){T=0;for(var L=0;L<=_;++L){var b=Math.abs(B.xr[L]);T+=b,d[L]=Math.sqrt(b*Math.sqrt(b)),d[L]>B.xrpow_max&&(B.xrpow_max=d[L])}return T}this.init_xrpow=function(B,d,_){var T=0,L=0|d.max_nonzero_coeff;if(Dt(_!=null),d.xrpow_max=0,Dt(0<=L&&L<=575),gr.fill(_,L,576,0),T=Y(d,_,L,T),T>1e-20){var b=0;(B.substep_shaping&2)!=0&&(b=1);for(var a=0;a<d.psymax;a++)B.pseudohalf[a]=b;return!0}return gr.fill(d.l3_enc,0,576,0),!1};function te(B,d){var _=B.ATH,T=d.xr;if(d.block_type!=R.SHORT_TYPE)for(var L=!1,b=R.PSFB21-1;b>=0&&!L;b--){var a=B.scalefac_band.psfb21[b],I=B.scalefac_band.psfb21[b+1],v=K.athAdjust(_.adjust,_.psfb21[b],_.floor);B.nsPsy.longfact[21]>1e-12&&(v*=B.nsPsy.longfact[21]);for(var i=I-1;i>=a;i--)if(Math.abs(T[i])<v)T[i]=0;else{L=!0;break}}else for(var o=0;o<3;o++)for(var L=!1,b=R.PSFB12-1;b>=0&&!L;b--){var a=B.scalefac_band.s[12]*3+(B.scalefac_band.s[13]-B.scalefac_band.s[12])*o+(B.scalefac_band.psfb12[b]-B.scalefac_band.psfb12[0]),I=a+(B.scalefac_band.psfb12[b+1]-B.scalefac_band.psfb12[b]),m=K.athAdjust(_.adjust,_.psfb12[b],_.floor);B.nsPsy.shortfact[12]>1e-12&&(m*=B.nsPsy.shortfact[12]);for(var i=I-1;i>=a;i--)if(Math.abs(T[i])<m)T[i]=0;else{L=!0;break}}}this.init_outer_loop=function(B,d){d.part2_3_length=0,d.big_values=0,d.count1=0,d.global_gain=210,d.scalefac_compress=0,d.table_select[0]=0,d.table_select[1]=0,d.table_select[2]=0,d.subblock_gain[0]=0,d.subblock_gain[1]=0,d.subblock_gain[2]=0,d.subblock_gain[3]=0,d.region0_count=0,d.region1_count=0,d.preflag=0,d.scalefac_scale=0,d.count1table_select=0,d.part2_length=0,d.sfb_lmax=R.SBPSY_l,d.sfb_smin=R.SBPSY_s,d.psy_lmax=B.sfb21_extra?R.SBMAX_l:R.SBPSY_l,d.psymax=d.psy_lmax,d.sfbmax=d.sfb_lmax,d.sfbdivide=11;for(var _=0;_<R.SBMAX_l;_++)d.width[_]=B.scalefac_band.l[_+1]-B.scalefac_band.l[_],d.window[_]=3;if(d.block_type==R.SHORT_TYPE){var T=jr(576);d.sfb_smin=0,d.sfb_lmax=0,d.mixed_block_flag!=0&&(d.sfb_smin=3,d.sfb_lmax=B.mode_gr*2+4),d.psymax=d.sfb_lmax+3*((B.sfb21_extra?R.SBMAX_s:R.SBPSY_s)-d.sfb_smin),d.sfbmax=d.sfb_lmax+3*(R.SBPSY_s-d.sfb_smin),d.sfbdivide=d.sfbmax-18,d.psy_lmax=d.sfb_lmax;var L=B.scalefac_band.l[d.sfb_lmax];cr.arraycopy(d.xr,0,T,0,576);for(var _=d.sfb_smin;_<R.SBMAX_s;_++)for(var b=B.scalefac_band.s[_],a=B.scalefac_band.s[_+1],I=0;I<3;I++)for(var v=b;v<a;v++)d.xr[L++]=T[3*v+I];for(var i=d.sfb_lmax,_=d.sfb_smin;_<R.SBMAX_s;_++)d.width[i]=d.width[i+1]=d.width[i+2]=B.scalefac_band.s[_+1]-B.scalefac_band.s[_],d.window[i]=0,d.window[i+1]=1,d.window[i+2]=2,i+=3}d.count1bits=0,d.sfb_partition_table=K.nr_of_sfb_block[0][0],d.slen[0]=0,d.slen[1]=0,d.slen[2]=0,d.slen[3]=0,d.max_nonzero_coeff=575,gr.fill(d.scalefac,0),te(B,d)};function me(B){this.ordinal=B}me.BINSEARCH_NONE=new me(0),me.BINSEARCH_UP=new me(1),me.BINSEARCH_DOWN=new me(2);function ve(B,d,_,T,L){var b,a=B.CurrentStep[T],I=!1,v=B.OldValue[T],i=me.BINSEARCH_NONE;for(d.global_gain=v,_-=d.part2_length,Dt(a!=0);;){var o;if(b=ce.count_bits(B,L,d,null),a==1||b==_)break;b>_?(i==me.BINSEARCH_DOWN&&(I=!0),I&&(a/=2),i=me.BINSEARCH_UP,o=a):(i==me.BINSEARCH_UP&&(I=!0),I&&(a/=2),i=me.BINSEARCH_DOWN,o=-a),d.global_gain+=o,d.global_gain<0&&(d.global_gain=0,I=!0),d.global_gain>255&&(d.global_gain=255,I=!0)}for(Dt(d.global_gain>=0),Dt(d.global_gain<256);b>_&&d.global_gain<255;)d.global_gain++,b=ce.count_bits(B,L,d,null);return B.CurrentStep[T]=v-d.global_gain>=4?4:2,B.OldValue[T]=d.global_gain,d.part2_3_length=b,b}this.trancate_smallspectrums=function(B,d,_,T){var L=jr(pr.SFBMAX);if(!((B.substep_shaping&4)==0&&d.block_type==R.SHORT_TYPE||(B.substep_shaping&128)!=0)){K.calc_noise(d,_,L,new _a,null);for(var a=0;a<576;a++){var b=0;d.l3_enc[a]!=0&&(b=Math.abs(d.xr[a])),T[a]=b}var a=0,I=8;d.block_type==R.SHORT_TYPE&&(I=6);do{var v,i,o,m,r=d.width[I];if(a+=r,!(L[I]>=1)&&(gr.sort(T,a-r,r),!ir.EQ(T[a-1],0))){v=(1-L[I])*_[I],i=0,m=0;do{var l;for(o=1;m+o<r&&!ir.NEQ(T[m+a-r],T[m+a+o-r]);o++);if(l=T[m+a-r]*T[m+a-r]*o,v<l){m!=0&&(i=T[m+a-r-1]);break}v-=l,m+=o}while(m<r);if(!ir.EQ(i,0))do Math.abs(d.xr[a-r])<=i&&(d.l3_enc[a-r]=0);while(--r>0)}}while(++I<d.psymax);d.part2_3_length=ce.noquant_count_bits(B,d,null)}};function F(B){for(var d=0;d<B.sfbmax;d++)if(B.scalefac[d]+B.subblock_gain[B.window[d]]==0)return!1;return!0}function J(B){return ua.FAST_LOG10(.368+.632*B*B*B)}function ae(B,d){for(var _=1e-37,T=0;T<d.psymax;T++)_+=J(B[T]);return Math.max(1e-20,_)}function A(B,d,_,T,L){var b;switch(B){default:case 9:{d.over_count>0?(b=_.over_SSD<=d.over_SSD,_.over_SSD==d.over_SSD&&(b=_.bits<d.bits)):b=_.max_noise<0&&_.max_noise*10+_.bits<=d.max_noise*10+d.bits;break}case 0:b=_.over_count<d.over_count||_.over_count==d.over_count&&_.over_noise<d.over_noise||_.over_count==d.over_count&&ir.EQ(_.over_noise,d.over_noise)&&_.tot_noise<d.tot_noise;break;case 8:_.max_noise=ae(L,T);case 1:b=_.max_noise<d.max_noise;break;case 2:b=_.tot_noise<d.tot_noise;break;case 3:b=_.tot_noise<d.tot_noise&&_.max_noise<d.max_noise;break;case 4:b=_.max_noise<=0&&d.max_noise>.2||_.max_noise<=0&&d.max_noise<0&&d.max_noise>_.max_noise-.2&&_.tot_noise<d.tot_noise||_.max_noise<=0&&d.max_noise>0&&d.max_noise>_.max_noise-.2&&_.tot_noise<d.tot_noise+d.over_noise||_.max_noise>0&&d.max_noise>-.05&&d.max_noise>_.max_noise-.1&&_.tot_noise+_.over_noise<d.tot_noise+d.over_noise||_.max_noise>0&&d.max_noise>-.1&&d.max_noise>_.max_noise-.15&&_.tot_noise+_.over_noise+_.over_noise<d.tot_noise+d.over_noise+d.over_noise;break;case 5:b=_.over_noise<d.over_noise||ir.EQ(_.over_noise,d.over_noise)&&_.tot_noise<d.tot_noise;break;case 6:b=_.over_noise<d.over_noise||ir.EQ(_.over_noise,d.over_noise)&&(_.max_noise<d.max_noise||ir.EQ(_.max_noise,d.max_noise)&&_.tot_noise<=d.tot_noise);break;case 7:b=_.over_count<d.over_count||_.over_noise<d.over_noise;break}return d.over_count==0&&(b=b&&_.bits<d.bits),b}function V(B,d,_,T,L){var b=B.internal_flags,a;d.scalefac_scale==0?a=1.2968395546510096:a=1.6817928305074292;for(var I=0,v=0;v<d.sfbmax;v++)I<_[v]&&(I=_[v]);var i=b.noise_shaping_amp;switch(i==3&&(L?i=2:i=1),i){case 2:break;case 1:I>1?I=Math.pow(I,.5):I*=.95;break;case 0:default:I>1?I=1:I*=.95;break}for(var o=0,v=0;v<d.sfbmax;v++){var m=d.width[v],r;if(o+=m,!(_[v]<I)){if((b.substep_shaping&2)!=0&&(b.pseudohalf[v]=b.pseudohalf[v]==0?1:0,b.pseudohalf[v]==0&&b.noise_shaping_amp==2))return;for(d.scalefac[v]++,r=-m;r<0;r++)T[o+r]*=a,T[o+r]>d.xrpow_max&&(d.xrpow_max=T[o+r]);if(b.noise_shaping_amp==2)return}}}function e(B,d){for(var _=1.2968395546510096,T=0,L=0;L<B.sfbmax;L++){var b=B.width[L],a=B.scalefac[L];if(B.preflag!=0&&(a+=K.pretab[L]),T+=b,(a&1)!=0){a++;for(var I=-b;I<0;I++)d[T+I]*=_,d[T+I]>B.xrpow_max&&(B.xrpow_max=d[T+I])}B.scalefac[L]=a>>1}B.preflag=0,B.scalefac_scale=1}function E(B,d,_){var T,L=d.scalefac;for(T=0;T<d.sfb_lmax;T++)if(L[T]>=16)return!0;for(var b=0;b<3;b++){var a=0,I=0;for(T=d.sfb_lmax+b;T<d.sfbdivide;T+=3)a<L[T]&&(a=L[T]);for(;T<d.sfbmax;T+=3)I<L[T]&&(I=L[T]);if(!(a<16&&I<8)){if(d.subblock_gain[b]>=7)return!0;d.subblock_gain[b]++;var v=B.scalefac_band.l[d.sfb_lmax];for(T=d.sfb_lmax+b;T<d.sfbmax;T+=3){var i,o=d.width[T],m=L[T];if(Dt(m>=0),m=m-(4>>d.scalefac_scale),m>=0){L[T]=m,v+=o*3;continue}L[T]=0;{var r=210+(m<<d.scalefac_scale+1);i=K.IPOW20(r)}v+=o*(b+1);for(var l=-o;l<0;l++)_[v+l]*=i,_[v+l]>d.xrpow_max&&(d.xrpow_max=_[v+l]);v+=o*(3-b-1)}{var i=K.IPOW20(202);v+=d.width[T]*(b+1);for(var l=-d.width[T];l<0;l++)_[v+l]*=i,_[v+l]>d.xrpow_max&&(d.xrpow_max=_[v+l])}}}return!1}function P(B,d,_,T,L){var b=B.internal_flags;V(B,d,_,T,L);var a=F(d);return a?!1:(b.mode_gr==2?a=ce.scale_bitcount(d):a=ce.scale_bitcount_lsf(b,d),a?(b.noise_shaping>1&&(gr.fill(b.pseudohalf,0),d.scalefac_scale==0?(e(d,T),a=!1):d.block_type==R.SHORT_TYPE&&b.subblock_gain>0&&(a=E(b,d,T)||F(d))),a||(b.mode_gr==2?a=ce.scale_bitcount(d):a=ce.scale_bitcount_lsf(b,d)),!a):!0)}this.outer_loop=function(B,d,_,T,L,b){var a=B.internal_flags,I=new p0,v=jr(576),i=jr(pr.SFBMAX),o=new _a,m,r=new un,l=9999999,f=!1,p=!1,H=0;if(ve(a,d,b,L,T),a.noise_shaping==0)return 100;K.calc_noise(d,_,i,o,r),o.bits=d.part2_3_length,I.assign(d);var g=0;for(cr.arraycopy(T,0,v,0,576);!f;){do{var D=new _a,oe,s=255;if((a.substep_shaping&2)!=0?oe=20:oe=3,a.sfb21_extra&&(i[I.sfbmax]>1||I.block_type==R.SHORT_TYPE&&(i[I.sfbmax+1]>1||i[I.sfbmax+2]>1))||!P(B,I,i,T,p))break;I.scalefac_scale!=0&&(s=254);var u=b-I.part2_length;if(u<=0)break;for(;(I.part2_3_length=ce.count_bits(a,T,I,r))>u&&I.global_gain<=s;)I.global_gain++;if(I.global_gain>s)break;if(o.over_count==0){for(;(I.part2_3_length=ce.count_bits(a,T,I,r))>l&&I.global_gain<=s;)I.global_gain++;if(I.global_gain>s)break}if(K.calc_noise(I,_,i,D,r),D.bits=I.part2_3_length,d.block_type!=R.SHORT_TYPE?m=B.quant_comp:m=B.quant_comp_short,m=A(m,o,D,I,i)?1:0,m!=0)l=d.part2_3_length,o=D,d.assign(I),g=0,cr.arraycopy(T,0,v,0,576);else if(a.full_outer_loop==0&&(++g>oe&&o.over_count==0||a.noise_shaping_amp==3&&p&&g>30||a.noise_shaping_amp==3&&p&&I.global_gain-H>15))break}while(I.global_gain+I.scalefac_scale<255);a.noise_shaping_amp==3?p?f=!0:(I.assign(d),cr.arraycopy(v,0,T,0,576),g=0,H=I.global_gain,p=!0):f=!0}return Dt(d.global_gain+d.scalefac_scale<=255),B.VBR==si.vbr_rh||B.VBR==si.vbr_mtrh?cr.arraycopy(v,0,T,0,576):(a.substep_shaping&1)!=0&&trancate_smallspectrums(a,d,_,T),o.over_count},this.iteration_finish_one=function(B,d,_){var T=B.l3_side,L=T.tt[d][_];ce.best_scalefac_store(B,d,_,T),B.use_best_huffman==1&&ce.best_huffman_divide(B,L),X.ResvAdjust(B,L)},this.VBR_encode_granule=function(B,d,_,T,L,b,a){var I=B.internal_flags,v=new p0,i=jr(576),o=a,m=a+1,r=(a+b)/2,l,f,p=0,H=I.sfb21_extra;Dt(o<=LameInternalFlags.MAX_BITS_PER_CHANNEL),gr.fill(v.l3_enc,0);do Dt(r>=b),Dt(r<=a),Dt(b<=a),r>o-42?I.sfb21_extra=!1:I.sfb21_extra=H,f=outer_loop(B,d,_,T,L,r),f<=0?(p=1,m=d.part2_3_length,v.assign(d),cr.arraycopy(T,0,i,0,576),a=m-32,l=a-b,r=(a+b)/2):(b=r+32,l=a-b,r=(a+b)/2,p!=0&&(p=2,d.assign(v),cr.arraycopy(i,0,T,0,576)));while(l>12);I.sfb21_extra=H,p==2&&cr.arraycopy(v.l3_enc,0,d.l3_enc,0,576),Dt(d.part2_3_length<=o)},this.get_framebits=function(B,d){var _=B.internal_flags;_.bitrate_index=_.VBR_min_bitrate;var T=w.getframebits(B);_.bitrate_index=1,T=w.getframebits(B);for(var L=1;L<=_.VBR_max_bitrate;L++){_.bitrate_index=L;var b=new MeanBits(T);d[L]=X.ResvFrameBegin(B,b),T=b.bits}},this.VBR_old_prepare=function(B,d,_,T,L,b,a,I,v){var i=B.internal_flags,o,m=0,r=1,l=0;i.bitrate_index=i.VBR_max_bitrate;var f=X.ResvFrameBegin(B,new MeanBits(0))/i.mode_gr;get_framebits(B,b);for(var p=0;p<i.mode_gr;p++){var H=K.on_pe(B,d,I[p],f,p,0);i.mode_ext==R.MPG_MD_MS_LR&&(ms_convert(i.l3_side,p),K.reduce_side(I[p],_[p],f,H));for(var g=0;g<i.channels_out;++g){var D=i.l3_side.tt[p][g];D.block_type!=R.SHORT_TYPE?(m=1.28/(1+Math.exp(3.5-d[p][g]/300))-.05,o=i.PSY.mask_adjust-m):(m=2.56/(1+Math.exp(3.5-d[p][g]/300))-.14,o=i.PSY.mask_adjust_short-m),i.masking_lower=Math.pow(10,o*.1),init_outer_loop(i,D),v[p][g]=K.calc_xmin(B,T[p][g],D,L[p][g]),v[p][g]!=0&&(r=0),a[p][g]=126,l+=I[p][g]}}for(var p=0;p<i.mode_gr;p++)for(var g=0;g<i.channels_out;g++)l>b[i.VBR_max_bitrate]&&(I[p][g]*=b[i.VBR_max_bitrate],I[p][g]/=l),a[p][g]>I[p][g]&&(a[p][g]=I[p][g]);return r},this.bitpressure_strategy=function(B,d,_,T){for(var L=0;L<B.mode_gr;L++)for(var b=0;b<B.channels_out;b++){for(var a=B.l3_side.tt[L][b],I=d[L][b],v=0,i=0;i<a.psy_lmax;i++)I[v++]*=1+.029*i*i/R.SBMAX_l/R.SBMAX_l;if(a.block_type==R.SHORT_TYPE)for(var i=a.sfb_smin;i<R.SBMAX_s;i++)I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s,I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s,I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s;T[L][b]=0|Math.max(_[L][b],.9*T[L][b])}},this.VBR_new_prepare=function(B,d,_,T,L,b){var a=B.internal_flags,I=1,v=0,i=0,o;if(B.free_format){a.bitrate_index=0;var m=new MeanBits(v);o=X.ResvFrameBegin(B,m),v=m.bits,L[0]=o}else{a.bitrate_index=a.VBR_max_bitrate;var m=new MeanBits(v);X.ResvFrameBegin(B,m),v=m.bits,get_framebits(B,L),o=L[a.VBR_max_bitrate]}for(var r=0;r<a.mode_gr;r++){K.on_pe(B,d,b[r],v,r,0),a.mode_ext==R.MPG_MD_MS_LR&&ms_convert(a.l3_side,r);for(var l=0;l<a.channels_out;++l){var f=a.l3_side.tt[r][l];a.masking_lower=Math.pow(10,a.PSY.mask_adjust*.1),init_outer_loop(a,f),K.calc_xmin(B,_[r][l],f,T[r][l])!=0&&(I=0),i+=b[r][l]}}for(var r=0;r<a.mode_gr;r++)for(var l=0;l<a.channels_out;l++)i>o&&(b[r][l]*=o,b[r][l]/=i);return I},this.calc_target_bits=function(B,d,_,T,L,b){var a=B.internal_flags,I=a.l3_side,v,i,o,m,r=0;a.bitrate_index=a.VBR_max_bitrate;var l=new MeanBits(r);for(b[0]=X.ResvFrameBegin(B,l),r=l.bits,a.bitrate_index=1,r=w.getframebits(B)-a.sideinfo_len*8,L[0]=r/(a.mode_gr*a.channels_out),r=B.VBR_mean_bitrate_kbps*B.framesize*1e3,(a.substep_shaping&1)!=0&&(r*=1.09),r/=B.out_samplerate,r-=a.sideinfo_len*8,r/=a.mode_gr*a.channels_out,v=.93+.07*(11-B.compression_ratio)/(11-5.5),v<.9&&(v=.9),v>1&&(v=1),i=0;i<a.mode_gr;i++){var f=0;for(o=0;o<a.channels_out;o++){if(T[i][o]=int(v*r),d[i][o]>700){var p=int((d[i][o]-700)/1.4),H=I.tt[i][o];T[i][o]=int(v*r),H.block_type==R.SHORT_TYPE&&p<r/2&&(p=r/2),p>r*3/2?p=r*3/2:p<0&&(p=0),T[i][o]+=p}T[i][o]>LameInternalFlags.MAX_BITS_PER_CHANNEL&&(T[i][o]=LameInternalFlags.MAX_BITS_PER_CHANNEL),f+=T[i][o]}if(f>LameInternalFlags.MAX_BITS_PER_GRANULE)for(o=0;o<a.channels_out;++o)T[i][o]*=LameInternalFlags.MAX_BITS_PER_GRANULE,T[i][o]/=f}if(a.mode_ext==R.MPG_MD_MS_LR)for(i=0;i<a.mode_gr;i++)K.reduce_side(T[i],_[i],r*a.channels_out,LameInternalFlags.MAX_BITS_PER_GRANULE);for(m=0,i=0;i<a.mode_gr;i++)for(o=0;o<a.channels_out;o++)T[i][o]>LameInternalFlags.MAX_BITS_PER_CHANNEL&&(T[i][o]=LameInternalFlags.MAX_BITS_PER_CHANNEL),m+=T[i][o];if(m>b[0])for(i=0;i<a.mode_gr;i++)for(o=0;o<a.channels_out;o++)T[i][o]*=b[0],T[i][o]/=m}}var hn=dn,E0=ne.assert;function mn(){var w;this.setModules=function(X){w=X},this.ResvFrameBegin=function(X,K){var z=X.internal_flags,ce,Y=z.l3_side,te=w.getframebits(X);K.bits=(te-z.sideinfo_len*8)/z.mode_gr;var me=8*256*z.mode_gr-8;X.brate>320?ce=8*int(X.brate*1e3/(X.out_samplerate/1152)/8+.5):(ce=8*1440,X.strict_ISO&&(ce=8*int(32e4/(X.out_samplerate/1152)/8+.5))),z.ResvMax=ce-te,z.ResvMax>me&&(z.ResvMax=me),(z.ResvMax<0||X.disable_reservoir)&&(z.ResvMax=0);var ve=K.bits*z.mode_gr+Math.min(z.ResvSize,z.ResvMax);return ve>ce&&(ve=ce),E0(z.ResvMax%8==0),E0(z.ResvMax>=0),Y.resvDrain_pre=0,z.pinfo!=null&&(z.pinfo.mean_bits=K.bits/2,z.pinfo.resvsize=z.ResvSize),ve},this.ResvMaxBits=function(X,K,z,ce){var Y=X.internal_flags,te,me=Y.ResvSize,ve=Y.ResvMax;ce!=0&&(me+=K),(Y.substep_shaping&1)!=0&&(ve*=.9),z.bits=K,me*10>ve*9?(te=me-ve*9/10,z.bits+=te,Y.substep_shaping|=128):(te=0,Y.substep_shaping&=127,!X.disable_reservoir&&(Y.substep_shaping&1)==0&&(z.bits-=.1*K));var F=me<Y.ResvMax*6/10?me:Y.ResvMax*6/10;return F-=te,F<0&&(F=0),F},this.ResvAdjust=function(X,K){X.ResvSize-=K.part2_3_length+K.part2_length},this.ResvFrameEnd=function(X,K){var z,ce=X.l3_side;X.ResvSize+=K*X.mode_gr;var Y=0;ce.resvDrain_post=0,ce.resvDrain_pre=0,(z=X.ResvSize%8)!=0&&(Y+=z),z=X.ResvSize-Y-X.ResvMax,z>0&&(E0(z%8==0),E0(z>=0),Y+=z);{var te=Math.min(ce.main_data_begin*8,Y)/8;ce.resvDrain_pre+=8*te,Y-=8*te,X.ResvSize-=8*te,ce.main_data_begin-=te}ce.resvDrain_post+=Y,X.ResvSize-=Y}}var fn=mn;function vn(){var w="http://www.mp3dev.org/",X=3,K=98,z=4,ce=0,Y=93;this.getLameVersion=function(){return X+"."+K+"."+z},this.getLameShortVersion=function(){return X+"."+K+"."+z},this.getLameVeryShortVersion=function(){return"LAME"+X+"."+K+"r"},this.getPsyVersion=function(){return ce+"."+Y},this.getLameUrl=function(){return w},this.getLameOsBitness=function(){return"32bits"}}var pn=vn,bn=ne.System,da=ne.VbrMode,ni=ne.ShortBlock,Sn=ne.Arrays,w0=ne.new_byte,yn=ne.assert;$r.NUMTOCENTRIES=100,$r.MAXFRAMESIZE=2880;function $r(){var w,X,K;this.setModules=function(r,l,f){w=r,X=l,K=f};var z=1,ce=2,Y=4,te=8,me=$r.NUMTOCENTRIES,ve=$r.MAXFRAMESIZE,F=me+4+4+4+4+4,J=F+9+1+1+8+1+1+3+1+1+2+4+2+2,ae=128,A=64,V=32,e=null,E="Xing",P="Info",B=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];function d(r,l){if(r.nVbrNumFrames++,r.sum+=l,r.seen++,!(r.seen<r.want)&&(r.pos<r.size&&(r.bag[r.pos]=r.sum,r.pos++,r.seen=0),r.pos==r.size)){for(var f=1;f<r.size;f+=2)r.bag[f/2]=r.bag[f];r.want*=2,r.pos/=2}}function _(r,l){if(!(r.pos<=0))for(var f=1;f<me;++f){var p=f/me,H,g,D=0|Math.floor(p*r.pos);D>r.pos-1&&(D=r.pos-1),H=r.bag[D],g=r.sum;var oe=0|256*H/g;oe>255&&(oe=255),l[f]=255&oe}}this.addVbrFrame=function(r){var l=r.internal_flags,f=Tables.bitrate_table[r.version][l.bitrate_index];yn(l.VBR_seek_table.bag!=null),d(l.VBR_seek_table,f)};function T(r,l){var f=r[l+0]&255;return f<<=8,f|=r[l+1]&255,f<<=8,f|=r[l+2]&255,f<<=8,f|=r[l+3]&255,f}function L(r,l,f){r[l+0]=255&(f>>24&255),r[l+1]=255&(f>>16&255),r[l+2]=255&(f>>8&255),r[l+3]=255&(f&255)}function b(r,l,f){r[l+0]=255&(f>>8&255),r[l+1]=255&(f&255)}function a(r,l){return new String(r,l,E.length(),e).equals(E)||new String(r,l,P.length(),e).equals(P)}function I(r,l,f){return 255&(r<<l|f&~(-1<<l))}function v(r,l){var f=r.internal_flags;l[0]=I(l[0],8,255),l[1]=I(l[1],3,7),l[1]=I(l[1],1,r.out_samplerate<16e3?0:1),l[1]=I(l[1],1,r.version),l[1]=I(l[1],2,4-3),l[1]=I(l[1],1,r.error_protection?0:1),l[2]=I(l[2],4,f.bitrate_index),l[2]=I(l[2],2,f.samplerate_index),l[2]=I(l[2],1,0),l[2]=I(l[2],1,r.extension),l[3]=I(l[3],2,r.mode.ordinal()),l[3]=I(l[3],2,f.mode_ext),l[3]=I(l[3],1,r.copyright),l[3]=I(l[3],1,r.original),l[3]=I(l[3],2,r.emphasis),l[0]=255;var p=255&(l[1]&241),H;r.version==1?H=ae:r.out_samplerate<16e3?H=V:H=A,r.VBR==da.vbr_off&&(H=r.brate);var g;r.free_format?g=0:g=255&16*w.BitrateIndex(H,r.version,r.out_samplerate),r.version==1?(l[1]=255&(p|10),p=255&(l[2]&13),l[2]=255&(g|p)):(l[1]=255&(p|2),p=255&(l[2]&13),l[2]=255&(g|p))}this.getVbrTag=function(r){var l=new VBRTagData,f=0;l.flags=0;var p=r[f+1]>>3&1,H=r[f+2]>>2&3,g=r[f+3]>>6&3,D=r[f+2]>>4&15;if(D=Tables.bitrate_table[p][D],r[f+1]>>4==14?l.samprate=Tables.samplerate_table[2][H]:l.samprate=Tables.samplerate_table[p][H],p!=0?g!=3?f+=32+4:f+=17+4:g!=3?f+=17+4:f+=9+4,!a(r,f))return null;f+=4,l.hId=p;var oe=l.flags=T(r,f);if(f+=4,(oe&z)!=0&&(l.frames=T(r,f),f+=4),(oe&ce)!=0&&(l.bytes=T(r,f),f+=4),(oe&Y)!=0){if(l.toc!=null)for(var s=0;s<me;s++)l.toc[s]=r[f+s];f+=me}l.vbrScale=-1,(oe&te)!=0&&(l.vbrScale=T(r,f),f+=4),l.headersize=(p+1)*72e3*D/l.samprate,f+=21;var u=r[f+0]<<4;u+=r[f+1]>>4;var Q=(r[f+1]&15)<<8;return Q+=r[f+2]&255,(u<0||u>3e3)&&(u=-1),(Q<0||Q>3e3)&&(Q=-1),l.encDelay=u,l.encPadding=Q,l},this.InitVbrTag=function(r){var l=r.internal_flags,f;r.version==1?f=ae:r.out_samplerate<16e3?f=V:f=A,r.VBR==da.vbr_off&&(f=r.brate);var p=(r.version+1)*72e3*f/r.out_samplerate,H=l.sideinfo_len+J;if(l.VBR_seek_table.TotalFrameSize=p,p<H||p>ve){r.bWriteVbrTag=!1;return}l.VBR_seek_table.nVbrNumFrames=0,l.VBR_seek_table.nBytesWritten=0,l.VBR_seek_table.sum=0,l.VBR_seek_table.seen=0,l.VBR_seek_table.want=1,l.VBR_seek_table.pos=0,l.VBR_seek_table.bag==null&&(l.VBR_seek_table.bag=new int[400],l.VBR_seek_table.size=400);var g=w0(ve);v(r,g);for(var D=l.VBR_seek_table.TotalFrameSize,oe=0;oe<D;++oe)X.add_dummy_byte(r,g[oe]&255,1)};function i(r,l){var f=l^r;return l=l>>8^B[f&255],l}this.updateMusicCRC=function(r,l,f,p){for(var H=0;H<p;++H)r[0]=i(l[f+H],r[0])};function o(r,l,f,p,H){var g=r.internal_flags,D=0,oe=r.encoder_delay,s=r.encoder_padding,u=100-10*r.VBR_q-r.quality,Q=K.getLameVeryShortVersion(),se,pe=0,Re,Me=[1,5,3,2,4,0,3],Ae=0|(r.lowpassfreq/100+.5>255?255:r.lowpassfreq/100+.5),De=0,Ie=0,Ee=0,Ge=r.internal_flags.noise_shaping,tt=0,We=0,rt=0,lt=0,_t=0,pt=(r.exp_nspsytune&1)!=0,Qt=(r.exp_nspsytune&2)!=0,At=!1,Mt=!1,Ut=r.internal_flags.nogap_total,wr=r.internal_flags.nogap_current,Ar=r.ATHtype,qt=0,Rt;switch(r.VBR){case vbr_abr:Rt=r.VBR_mean_bitrate_kbps;break;case vbr_off:Rt=r.brate;break;default:Rt=r.VBR_min_bitrate_kbps}switch(r.VBR.ordinal()<Me.length?se=Me[r.VBR.ordinal()]:se=0,Re=16*pe+se,g.findReplayGain&&(g.RadioGain>510&&(g.RadioGain=510),g.RadioGain<-510&&(g.RadioGain=-510),Ie=8192,Ie|=3072,g.RadioGain>=0?Ie|=g.RadioGain:(Ie|=512,Ie|=-g.RadioGain)),g.findPeakSample&&(De=Math.abs(0|g.PeakSample/32767*Math.pow(2,23)+.5)),Ut!=-1&&(wr>0&&(Mt=!0),wr<Ut-1&&(At=!0)),qt=Ar+((pt?1:0)<<4)+((Qt?1:0)<<5)+((At?1:0)<<6)+((Mt?1:0)<<7),u<0&&(u=0),r.mode){case MONO:tt=0;break;case STEREO:tt=1;break;case DUAL_CHANNEL:tt=2;break;case JOINT_STEREO:r.force_ms?tt=4:tt=3;break;case NOT_SET:default:tt=7;break}r.in_samplerate<=32e3?rt=0:r.in_samplerate==48e3?rt=2:r.in_samplerate>48e3?rt=3:rt=1,(r.short_blocks==ni.short_block_forced||r.short_blocks==ni.short_block_dispensed||r.lowpassfreq==-1&&r.highpassfreq==-1||r.scale_left<r.scale_right||r.scale_left>r.scale_right||r.disable_reservoir&&r.brate<320||r.noATH||r.ATHonly||Ar==0||r.in_samplerate<=32e3)&&(We=1),lt=Ge+(tt<<2)+(We<<5)+(rt<<6),_t=g.nMusicCRC,L(f,p+D,u),D+=4;for(var _r=0;_r<9;_r++)f[p+D+_r]=255&Q.charAt(_r);D+=9,f[p+D]=255&Re,D++,f[p+D]=255&Ae,D++,L(f,p+D,De),D+=4,b(f,p+D,Ie),D+=2,b(f,p+D,Ee),D+=2,f[p+D]=255&qt,D++,Rt>=255?f[p+D]=255:f[p+D]=255&Rt,D++,f[p+D]=255&oe>>4,f[p+D+1]=255&(oe<<4)+(s>>8),f[p+D+2]=255&s,D+=3,f[p+D]=255&lt,D++,f[p+D++]=0,b(f,p+D,r.preset),D+=2,L(f,p+D,l),D+=4,b(f,p+D,_t),D+=2;for(var Wr=0;Wr<D;Wr++)H=i(f[p+Wr],H);return b(f,p+D,H),D+=2,D}function m(r){r.seek(0);var l=w0(10);r.readFully(l);var f;return new String(l,"ISO-8859-1").startsWith("ID3")?f=0:f=((l[6]&127)<<21|(l[7]&127)<<14|(l[8]&127)<<7|l[9]&127)+l.length,f}this.getLameTagFrame=function(r,l){var f=r.internal_flags;if(!r.bWriteVbrTag||f.Class_ID!=Ze.LAME_ID||f.VBR_seek_table.pos<=0)return 0;if(l.length<f.VBR_seek_table.TotalFrameSize)return f.VBR_seek_table.TotalFrameSize;Sn.fill(l,0,f.VBR_seek_table.TotalFrameSize,0),v(r,l);var p=w0(me);if(r.free_format)for(var H=1;H<me;++H)p[H]=255&255*H/100;else _(f.VBR_seek_table,p);var g=f.sideinfo_len;r.error_protection&&(g-=2),r.VBR==da.vbr_off?(l[g++]=255&P.charAt(0),l[g++]=255&P.charAt(1),l[g++]=255&P.charAt(2),l[g++]=255&P.charAt(3)):(l[g++]=255&E.charAt(0),l[g++]=255&E.charAt(1),l[g++]=255&E.charAt(2),l[g++]=255&E.charAt(3)),L(l,g,z+ce+Y+te),g+=4,L(l,g,f.VBR_seek_table.nVbrNumFrames),g+=4;var D=f.VBR_seek_table.nBytesWritten+f.VBR_seek_table.TotalFrameSize;L(l,g,0|D),g+=4,bn.arraycopy(p,0,l,g,p.length),g+=p.length,r.error_protection&&X.CRC_writeheader(f,l);for(var oe=0,H=0;H<g;H++)oe=i(l[H],oe);return g+=o(r,D,l,g,oe),f.VBR_seek_table.TotalFrameSize},this.putVbrTag=function(r,l){var f=r.internal_flags;if(f.VBR_seek_table.pos<=0||(l.seek(l.length()),l.length()==0))return-1;var p=m(l);l.seek(p);var H=w0(ve),g=getLameTagFrame(r,H);return g>H.length?-1:(g<1||l.write(H,0,g),0)}}var Rn=$r,oi=ne.new_byte,li=ne.assert,Ze=rn,xn=sn,Kr=yt,En=or,wn=hn,An=la,Mn=fn,mt=Ka,ir=lr;function Tn(){var w,X;this.setModules=function(K,z){w=K,X=z}}function Bn(){var w,X,K;this.setModules=function(z,ce,Y){w=z,X=ce,K=Y}}function In(){}function Cn(){var w,X;this.setModules=function(K,z){w=K,X=z}}function On(w,X,K){arguments.length!=3&&(console.error("WARN: Mp3Encoder(channels, samplerate, kbps) not specified"),w=1,X=44100,K=128);var z=new Ze,ce=new Tn,Y=new Kr,te=new ir,me=new xn,ve=new En,F=new wn,J=new Rn,ae=new pn,A=new Cn,V=new Mn,e=new An,E=new Bn,P=new In;z.setModules(Y,te,me,ve,F,J,ae,A,P),te.setModules(Y,P,ae,J),A.setModules(te,ae),me.setModules(z),F.setModules(te,V,ve,e),ve.setModules(e,V,z.enc.psy),V.setModules(te),e.setModules(ve),J.setModules(z,te,ae),ce.setModules(E,P),E.setModules(ae,A,me);var B=z.lame_init();B.num_channels=w,B.in_samplerate=X,B.brate=K,B.mode=mt.STEREO,B.quality=3,B.bWriteVbrTag=!1,B.disable_reservoir=!0,B.write_id3tag_automatic=!1;var d=z.lame_init_params(B);li(d==0);var _=1152,T=0|1.25*_+7200,L=oi(T);this.encodeBuffer=function(b,a){w==1&&(a=b),li(b.length==a.length),b.length>_&&(_=b.length,T=0|1.25*_+7200,L=oi(T));var I=z.lame_encode_buffer(B,b,a,b.length,L,0,T);return new Int8Array(L.subarray(0,I))},this.flush=function(){var b=z.lame_encode_flush(B,L,0,T);return new Int8Array(L.subarray(0,b))}}function Zt(){this.dataOffset=0,this.dataLen=0,this.channels=0,this.sampleRate=0}function A0(w){return w.charCodeAt(0)<<24|w.charCodeAt(1)<<16|w.charCodeAt(2)<<8|w.charCodeAt(3)}Zt.RIFF=A0("RIFF"),Zt.WAVE=A0("WAVE"),Zt.fmt_=A0("fmt "),Zt.data=A0("data"),Zt.readHeader=function(w){var X=new Zt,K=w.getUint32(0,!1);if(Zt.RIFF==K){var z=w.getUint32(4,!0);if(Zt.WAVE==w.getUint32(8,!1)&&Zt.fmt_==w.getUint32(12,!1)){var ce=w.getUint32(16,!0),Y=16+4;switch(ce){case 16:case 18:X.channels=w.getUint16(Y+2,!0),X.sampleRate=w.getUint32(Y+4,!0);break;default:throw"extended fmt chunk not implemented"}Y+=ce;for(var te=Zt.data,me=0;te!=K&&(K=w.getUint32(Y,!1),me=w.getUint32(Y+4,!0),te!=K);)Y+=me+8;return X.dataLen=me,X.dataOffset=Y+8,X}}};var kn=On,ci=function(w,X){if(!(w instanceof X))throw new TypeError("Cannot call a class as a function")},_i=function(){function w(X,K){for(var z=0;z<K.length;z++){var ce=K[z];ce.enumerable=ce.enumerable||!1,ce.configurable=!0,"value"in ce&&(ce.writable=!0),Object.defineProperty(X,ce.key,ce)}}return function(X,K,z){return K&&w(X.prototype,K),z&&w(X,z),X}}(),gn=function(){function w(X){ci(this,w),this.config={sampleRate:44100,bitRate:128},Object.assign(this.config,X),this.mp3Encoder=new kn(1,this.config.sampleRate,this.config.bitRate),this.maxSamples=1152,this.samplesMono=null,this.clearBuffer()}return _i(w,[{key:"clearBuffer",value:function(){this.dataBuffer=[]}},{key:"appendToBuffer",value:function(K){this.dataBuffer.push(new Int8Array(K))}},{key:"floatTo16BitPCM",value:function(K,z){for(var ce=0;ce<K.length;ce++){var Y=Math.max(-1,Math.min(1,K[ce]));z[ce]=Y<0?Y*32768:Y*32767}}},{key:"convertBuffer",value:function(K){var z=new Float32Array(K),ce=new Int16Array(K.length);return this.floatTo16BitPCM(z,ce),ce}},{key:"encode",value:function(K){this.samplesMono=this.convertBuffer(K);for(var z=this.samplesMono.length,ce=0;z>=0;ce+=this.maxSamples){var Y=this.samplesMono.subarray(ce,ce+this.maxSamples),te=this.mp3Encoder.encodeBuffer(Y);this.appendToBuffer(te),z-=this.maxSamples}}},{key:"finish",value:function(){return this.appendToBuffer(this.mp3Encoder.flush()),this.dataBuffer}}]),w}(),Pn=function(){function w(X){ci(this,w),this.config={bitRate:128,startRecordingAt:300,deviceId:null},this.activeStream=null,this.context=null,this.microphone=null,this.processor=null,this.startTime=0,Object.assign(this.config,X)}return _i(w,[{key:"addMicrophoneListener",value:function(K){var z=this;this.activeStream=K,this.timerToStart=setTimeout(function(){delete z.timerToStart},this.config.startRecordingAt),this.microphone=this.context.createMediaStreamSource(K),this.processor=this.context.createScriptProcessor(0,1,1),this.processor.onaudioprocess=function(ce){z.timerToStart||z.lameEncoder.encode(ce.inputBuffer.getChannelData(0))},this.microphone.connect(this.processor),this.processor.connect(this.context.destination)}},{key:"stop",value:function(){return this.processor&&this.microphone&&(this.microphone.disconnect(),this.processor.disconnect(),this.context&&this.context.state!=="closed"&&this.context.close(),this.processor.onaudioprocess=null,this.activeStream.getAudioTracks().forEach(function(K){return K.stop()})),this}},{key:"start",value:function(){var K=this,z=window.AudioContext||window.webkitAudioContext;this.context=new z,this.config.sampleRate=this.context.sampleRate,this.lameEncoder=new gn(this.config);var ce=this.config.deviceId?{deviceId:{exact:this.config.deviceId}}:!0;return new Promise(function(Y,te){navigator.mediaDevices.getUserMedia({audio:ce}).then(function(me){K.addMicrophoneListener(me),Y(me)}).catch(function(me){te(me)})})}},{key:"getMp3",value:function(){var K=this,z=this.lameEncoder.finish();return new Promise(function(ce,Y){z.length===0?Y(new Error("No buffer to send")):(ce([z,new Blob(z,{type:"audio/mp3"})]),K.lameEncoder.clearBuffer())})}}]),w}();return Pn})});async function B0(){try{let c={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(c)).getTracks().forEach(n=>{n.stop()}),!0}catch{return!1}}async function I0(){return new Promise((c,t)=>{let n=window.screen.isExtended;c(n)})}async function Yt(){let c=["OBS","ManyCam","Snap Camera","Virtual"],n=(await navigator.mediaDevices.enumerateDevices()).filter(x=>!c.some(C=>x.deviceId.includes(C)||x.label.includes(C)));return{cameras:n.filter(x=>x.kind=="videoinput"&&x.deviceId).map(x=>({label:x.label||"Generic Device",id:x.deviceId})),microphones:n.filter(x=>x.kind=="audioinput"&&x.deviceId).map(x=>({label:x.label||"Generic Device",id:x.deviceId}))}}var C0=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var Ra,yi=c=>(Ra=c,Ra),Gt={START:"start",FINISH:"finish",ERROR:"error",UPLOAD_VIDEO:"upload_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",BROWSER_NOT_SUPPORTED:"browser_not_supported"},jt=(c,t)=>Ra.log(c,t),et={registerStart:(c,t,n)=>jt(Gt.START,{proctoringId:c,success:t,description:n}),registerFinish:(c,t,n)=>jt(Gt.FINISH,{proctoringId:c,success:t,description:n}),registerError:(c,t)=>jt(Gt.ERROR,{proctoringId:c,description:t}),registerBrowserNotSupported:(c,t)=>jt(Gt.BROWSER_NOT_SUPPORTED,{proctoringId:c,description:t}),registerUpload:(c,t,n,h,x)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,success:t,description:n,serviceType:h,uploadTime:x}),registerUploadFile:(c,t,n)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t,fileType:n}),registerChangeDevice:(c,t,n)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,inOrOut:t,devicesChanged:n}),registerStopSharingScreen:(c,t)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t}),registerErrorRecorderRTC:(c,t)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t}),registerOnBufferSizeError:(c,t)=>jt(Gt.BUFFER_SIZE,{proctoringId:c,description:t}),registerAnotherStream:(c,t)=>jt(Gt.ANOTHER_STREAM,{proctoringId:c,description:t})};function t0(c,t,n,h=!1,x,C=!1){let O,W=!1,be,le,ye={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};C&&(ye={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let fe=new MediaRecorder(c,ye);fe.ondataavailable=ne=>{t.push(ne.data),W?(ne.data.size>0,C&&fe.state=="inactive"&&(t=[new Blob(t,{type:"audio/mpeg-3"})]),O&&O()):((le&&ne.data.size===le.data.size||ne.data.size===0)&&(x&&x(),n&&le&&ne.data.size===le.data.size&&et.registerOnBufferSizeError(n,`onBufferSizeError: Recorder size freezed: ${ne.data.size} Mb`),n&&ne.data.size===0&&et.registerOnBufferSizeError(n,"onBufferSizeError: Recorder size equal 0 Mb")),le=ne)};function Ne(){return new Promise(ne=>{O=ne,fe.start(),W=!1,h&&(be=setInterval(async()=>{await fe.requestData()},3e4))})}function Oe(){return new Promise(ne=>{fe.state=="recording"?(O=ne,fe.stop(),W=!0,clearInterval(be),c.getTracks().forEach(je=>{je.stop()})):ne()})}function Se(){return new Promise(ne=>{fe.state=="recording"&&fe.pause(),ne()})}function ge(){return new Promise(ne=>{fe.state=="paused"&&fe.resume(),ne()})}return{startRecording:Ne,stopRecording:Oe,pauseRecording:Se,resumeRecording:ge}}function r0(c,t){return function(){return c.apply(t,arguments)}}var{toString:Dn}=Object.prototype,{getPrototypeOf:wa}=Object,k0=(c=>t=>{let n=Dn.call(t);return c[n]||(c[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),er=c=>(c=c.toLowerCase(),t=>k0(t)===c),g0=c=>t=>typeof t===c,{isArray:Lr}=Array,a0=g0("undefined");function Fn(c){return c!==null&&!a0(c)&&c.constructor!==null&&!a0(c.constructor)&&Ft(c.constructor.isBuffer)&&c.constructor.isBuffer(c)}var Ei=er("ArrayBuffer");function Hn(c){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(c):t=c&&c.buffer&&Ei(c.buffer),t}var Vn=g0("string"),Ft=g0("function"),wi=g0("number"),P0=c=>c!==null&&typeof c=="object",Un=c=>c===!0||c===!1,O0=c=>{if(k0(c)!=="object")return!1;let t=wa(c);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in c)&&!(Symbol.iterator in c)},qn=er("Date"),Xn=er("File"),zn=er("Blob"),Yn=er("FileList"),Gn=c=>P0(c)&&Ft(c.pipe),jn=c=>{let t;return c&&(typeof FormData=="function"&&c instanceof FormData||Ft(c.append)&&((t=k0(c))==="formdata"||t==="object"&&Ft(c.toString)&&c.toString()==="[object FormData]"))},$n=er("URLSearchParams"),Kn=c=>c.trim?c.trim():c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function i0(c,t,{allOwnKeys:n=!1}={}){if(c===null||typeof c>"u")return;let h,x;if(typeof c!="object"&&(c=[c]),Lr(c))for(h=0,x=c.length;h<x;h++)t.call(null,c[h],h,c);else{let C=n?Object.getOwnPropertyNames(c):Object.keys(c),O=C.length,W;for(h=0;h<O;h++)W=C[h],t.call(null,c[W],W,c)}}function Ai(c,t){t=t.toLowerCase();let n=Object.keys(c),h=n.length,x;for(;h-- >0;)if(x=n[h],t===x.toLowerCase())return x;return null}var Mi=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Ti=c=>!a0(c)&&c!==Mi;function Ea(){let{caseless:c}=Ti(this)&&this||{},t={},n=(h,x)=>{let C=c&&Ai(t,x)||x;O0(t[C])&&O0(h)?t[C]=Ea(t[C],h):O0(h)?t[C]=Ea({},h):Lr(h)?t[C]=h.slice():t[C]=h};for(let h=0,x=arguments.length;h<x;h++)arguments[h]&&i0(arguments[h],n);return t}var Wn=(c,t,n,{allOwnKeys:h}={})=>(i0(t,(x,C)=>{n&&Ft(x)?c[C]=r0(x,n):c[C]=x},{allOwnKeys:h}),c),Zn=c=>(c.charCodeAt(0)===65279&&(c=c.slice(1)),c),Qn=(c,t,n,h)=>{c.prototype=Object.create(t.prototype,h),c.prototype.constructor=c,Object.defineProperty(c,"super",{value:t.prototype}),n&&Object.assign(c.prototype,n)},Jn=(c,t,n,h)=>{let x,C,O,W={};if(t=t||{},c==null)return t;do{for(x=Object.getOwnPropertyNames(c),C=x.length;C-- >0;)O=x[C],(!h||h(O,c,t))&&!W[O]&&(t[O]=c[O],W[O]=!0);c=n!==!1&&wa(c)}while(c&&(!n||n(c,t))&&c!==Object.prototype);return t},eo=(c,t,n)=>{c=String(c),(n===void 0||n>c.length)&&(n=c.length),n-=t.length;let h=c.indexOf(t,n);return h!==-1&&h===n},to=c=>{if(!c)return null;if(Lr(c))return c;let t=c.length;if(!wi(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=c[t];return n},ro=(c=>t=>c&&t instanceof c)(typeof Uint8Array<"u"&&wa(Uint8Array)),ao=(c,t)=>{let h=(c&&c[Symbol.iterator]).call(c),x;for(;(x=h.next())&&!x.done;){let C=x.value;t.call(c,C[0],C[1])}},io=(c,t)=>{let n,h=[];for(;(n=c.exec(t))!==null;)h.push(n);return h},so=er("HTMLFormElement"),no=c=>c.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,h,x){return h.toUpperCase()+x}),Ri=(({hasOwnProperty:c})=>(t,n)=>c.call(t,n))(Object.prototype),oo=er("RegExp"),Bi=(c,t)=>{let n=Object.getOwnPropertyDescriptors(c),h={};i0(n,(x,C)=>{let O;(O=t(x,C,c))!==!1&&(h[C]=O||x)}),Object.defineProperties(c,h)},lo=c=>{Bi(c,(t,n)=>{if(Ft(c)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let h=c[n];if(!!Ft(h)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},co=(c,t)=>{let n={},h=x=>{x.forEach(C=>{n[C]=!0})};return Lr(c)?h(c):h(String(c).split(t)),n},_o=()=>{},uo=(c,t)=>(c=+c,Number.isFinite(c)?c:t),xa="abcdefghijklmnopqrstuvwxyz",xi="0123456789",Ii={DIGIT:xi,ALPHA:xa,ALPHA_DIGIT:xa+xa.toUpperCase()+xi},ho=(c=16,t=Ii.ALPHA_DIGIT)=>{let n="",{length:h}=t;for(;c--;)n+=t[Math.random()*h|0];return n};function mo(c){return!!(c&&Ft(c.append)&&c[Symbol.toStringTag]==="FormData"&&c[Symbol.iterator])}var fo=c=>{let t=new Array(10),n=(h,x)=>{if(P0(h)){if(t.indexOf(h)>=0)return;if(!("toJSON"in h)){t[x]=h;let C=Lr(h)?[]:{};return i0(h,(O,W)=>{let be=n(O,x+1);!a0(be)&&(C[W]=be)}),t[x]=void 0,C}}return h};return n(c,0)},vo=er("AsyncFunction"),po=c=>c&&(P0(c)||Ft(c))&&Ft(c.then)&&Ft(c.catch),ie={isArray:Lr,isArrayBuffer:Ei,isBuffer:Fn,isFormData:jn,isArrayBufferView:Hn,isString:Vn,isNumber:wi,isBoolean:Un,isObject:P0,isPlainObject:O0,isUndefined:a0,isDate:qn,isFile:Xn,isBlob:zn,isRegExp:oo,isFunction:Ft,isStream:Gn,isURLSearchParams:$n,isTypedArray:ro,isFileList:Yn,forEach:i0,merge:Ea,extend:Wn,trim:Kn,stripBOM:Zn,inherits:Qn,toFlatObject:Jn,kindOf:k0,kindOfTest:er,endsWith:eo,toArray:to,forEachEntry:ao,matchAll:io,isHTMLForm:so,hasOwnProperty:Ri,hasOwnProp:Ri,reduceDescriptors:Bi,freezeMethods:lo,toObjectSet:co,toCamelCase:no,noop:_o,toFiniteNumber:uo,findKey:Ai,global:Mi,isContextDefined:Ti,ALPHABET:Ii,generateString:ho,isSpecCompliantForm:mo,toJSONObject:fo,isAsyncFn:vo,isThenable:po};function Dr(c,t,n,h,x){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=c,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),h&&(this.request=h),x&&(this.response=x)}ie.inherits(Dr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ci=Dr.prototype,Oi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(c=>{Oi[c]={value:c}});Object.defineProperties(Dr,Oi);Object.defineProperty(Ci,"isAxiosError",{value:!0});Dr.from=(c,t,n,h,x,C)=>{let O=Object.create(Ci);return ie.toFlatObject(c,O,function(be){return be!==Error.prototype},W=>W!=="isAxiosError"),Dr.call(O,c.message,t,n,h,x),O.cause=c,O.name=c.name,C&&Object.assign(O,C),O};var Ye=Dr;var N0=null;function Aa(c){return ie.isPlainObject(c)||ie.isArray(c)}function gi(c){return ie.endsWith(c,"[]")?c.slice(0,-2):c}function ki(c,t,n){return c?c.concat(t).map(function(x,C){return x=gi(x),!n&&C?"["+x+"]":x}).join(n?".":""):t}function bo(c){return ie.isArray(c)&&!c.some(Aa)}var So=ie.toFlatObject(ie,{},null,function(t){return/^is[A-Z]/.test(t)});function yo(c,t,n){if(!ie.isObject(c))throw new TypeError("target must be an object");t=t||new(N0||FormData),n=ie.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(ge,ne){return!ie.isUndefined(ne[ge])});let h=n.metaTokens,x=n.visitor||ye,C=n.dots,O=n.indexes,be=(n.Blob||typeof Blob<"u"&&Blob)&&ie.isSpecCompliantForm(t);if(!ie.isFunction(x))throw new TypeError("visitor must be a function");function le(Se){if(Se===null)return"";if(ie.isDate(Se))return Se.toISOString();if(!be&&ie.isBlob(Se))throw new Ye("Blob is not supported. Use a Buffer instead.");return ie.isArrayBuffer(Se)||ie.isTypedArray(Se)?be&&typeof Blob=="function"?new Blob([Se]):Buffer.from(Se):Se}function ye(Se,ge,ne){let je=Se;if(Se&&!ne&&typeof Se=="object"){if(ie.endsWith(ge,"{}"))ge=h?ge:ge.slice(0,-2),Se=JSON.stringify(Se);else if(ie.isArray(Se)&&bo(Se)||(ie.isFileList(Se)||ie.endsWith(ge,"[]"))&&(je=ie.toArray(Se)))return ge=gi(ge),je.forEach(function(Ke,ct){!(ie.isUndefined(Ke)||Ke===null)&&t.append(O===!0?ki([ge],ct,C):O===null?ge:ge+"[]",le(Ke))}),!1}return Aa(Se)?!0:(t.append(ki(ne,ge,C),le(Se)),!1)}let fe=[],Ne=Object.assign(So,{defaultVisitor:ye,convertValue:le,isVisitable:Aa});function Oe(Se,ge){if(!ie.isUndefined(Se)){if(fe.indexOf(Se)!==-1)throw Error("Circular reference detected in "+ge.join("."));fe.push(Se),ie.forEach(Se,function(je,Fe){(!(ie.isUndefined(je)||je===null)&&x.call(t,je,ie.isString(Fe)?Fe.trim():Fe,ge,Ne))===!0&&Oe(je,ge?ge.concat(Fe):[Fe])}),fe.pop()}}if(!ie.isObject(c))throw new TypeError("data must be an object");return Oe(c),t}var dr=yo;function Pi(c){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(c).replace(/[!'()~]|%20|%00/g,function(h){return t[h]})}function Ni(c,t){this._pairs=[],c&&dr(c,this,t)}var Li=Ni.prototype;Li.append=function(t,n){this._pairs.push([t,n])};Li.toString=function(t){let n=t?function(h){return t.call(this,h,Pi)}:Pi;return this._pairs.map(function(x){return n(x[0])+"="+n(x[1])},"").join("&")};var L0=Ni;function Ro(c){return encodeURIComponent(c).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s0(c,t,n){if(!t)return c;let h=n&&n.encode||Ro,x=n&&n.serialize,C;if(x?C=x(t,n):C=ie.isURLSearchParams(t)?t.toString():new L0(t,n).toString(h),C){let O=c.indexOf("#");O!==-1&&(c=c.slice(0,O)),c+=(c.indexOf("?")===-1?"?":"&")+C}return c}var Ma=class{constructor(){this.handlers=[]}use(t,n,h){return this.handlers.push({fulfilled:t,rejected:n,synchronous:h?h.synchronous:!1,runWhen:h?h.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ie.forEach(this.handlers,function(h){h!==null&&t(h)})}},Ta=Ma;var D0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Di=typeof URLSearchParams<"u"?URLSearchParams:L0;var Fi=typeof FormData<"u"?FormData:null;var Hi=typeof Blob<"u"?Blob:null;var xo=(()=>{let c;return typeof navigator<"u"&&((c=navigator.product)==="ReactNative"||c==="NativeScript"||c==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Eo=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),bt={isBrowser:!0,classes:{URLSearchParams:Di,FormData:Fi,Blob:Hi},isStandardBrowserEnv:xo,isStandardBrowserWebWorkerEnv:Eo,protocols:["http","https","file","blob","url","data"]};function Ba(c,t){return dr(c,new bt.classes.URLSearchParams,Object.assign({visitor:function(n,h,x,C){return bt.isNode&&ie.isBuffer(n)?(this.append(h,n.toString("base64")),!1):C.defaultVisitor.apply(this,arguments)}},t))}function wo(c){return ie.matchAll(/\w+|\[(\w*)]/g,c).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ao(c){let t={},n=Object.keys(c),h,x=n.length,C;for(h=0;h<x;h++)C=n[h],t[C]=c[C];return t}function Mo(c){function t(n,h,x,C){let O=n[C++],W=Number.isFinite(+O),be=C>=n.length;return O=!O&&ie.isArray(x)?x.length:O,be?(ie.hasOwnProp(x,O)?x[O]=[x[O],h]:x[O]=h,!W):((!x[O]||!ie.isObject(x[O]))&&(x[O]=[]),t(n,h,x[O],C)&&ie.isArray(x[O])&&(x[O]=Ao(x[O])),!W)}if(ie.isFormData(c)&&ie.isFunction(c.entries)){let n={};return ie.forEachEntry(c,(h,x)=>{t(wo(h),x,n,0)}),n}return null}var F0=Mo;function To(c,t,n){if(ie.isString(c))try{return(t||JSON.parse)(c),ie.trim(c)}catch(h){if(h.name!=="SyntaxError")throw h}return(n||JSON.stringify)(c)}var Ia={transitional:D0,adapter:bt.isNode?"http":"xhr",transformRequest:[function(t,n){let h=n.getContentType()||"",x=h.indexOf("application/json")>-1,C=ie.isObject(t);if(C&&ie.isHTMLForm(t)&&(t=new FormData(t)),ie.isFormData(t))return x&&x?JSON.stringify(F0(t)):t;if(ie.isArrayBuffer(t)||ie.isBuffer(t)||ie.isStream(t)||ie.isFile(t)||ie.isBlob(t))return t;if(ie.isArrayBufferView(t))return t.buffer;if(ie.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let W;if(C){if(h.indexOf("application/x-www-form-urlencoded")>-1)return Ba(t,this.formSerializer).toString();if((W=ie.isFileList(t))||h.indexOf("multipart/form-data")>-1){let be=this.env&&this.env.FormData;return dr(W?{"files[]":t}:t,be&&new be,this.formSerializer)}}return C||x?(n.setContentType("application/json",!1),To(t)):t}],transformResponse:[function(t){let n=this.transitional||Ia.transitional,h=n&&n.forcedJSONParsing,x=this.responseType==="json";if(t&&ie.isString(t)&&(h&&!this.responseType||x)){let O=!(n&&n.silentJSONParsing)&&x;try{return JSON.parse(t)}catch(W){if(O)throw W.name==="SyntaxError"?Ye.from(W,Ye.ERR_BAD_RESPONSE,this,null,this.response):W}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bt.classes.FormData,Blob:bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ie.forEach(["delete","get","head","post","put","patch"],c=>{Ia.headers[c]={}});var Fr=Ia;var Bo=ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Vi=c=>{let t={},n,h,x;return c&&c.split(`
14
+ `)),u.highpass2>0){for(var Ae=-1,Re=0;Re<=31;Re++){var Me=Re/31;Me<=u.highpass1&&(se=Math.max(se,Re)),u.highpass1<Me&&Me<u.highpass2&&(Ae=Math.max(Ae,Re))}u.highpass1=se/31,Ae==-1?u.highpass2=(se+.75)/31:u.highpass2=(Ae+.75)/31}for(var Re=0;Re<32;Re++){var De,Ie,Me=Re/31;u.highpass2>u.highpass1?De=d((u.highpass2-Me)/(u.highpass2-u.highpass1+1e-20)):De=1,u.lowpass2>u.lowpass1?Ie=d((Me-u.lowpass1)/(u.lowpass2-u.lowpass1+1e-20)):Ie=1,u.amp_filter[Re]=De*Ie}}function v(s){var u=s.internal_flags;switch(s.quality){default:case 9:u.psymodel=0,u.noise_shaping=0,u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.use_best_huffman=0,u.full_outer_loop=0;break;case 8:s.quality=7;case 7:u.psymodel=1,u.noise_shaping=0,u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.use_best_huffman=0,u.full_outer_loop=0;break;case 6:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=0,u.full_outer_loop=0;break;case 5:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=0,u.full_outer_loop=0;break;case 4:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=0,u.noise_shaping_stop=0,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 3:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.noise_shaping_amp=1,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 2:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=1,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 1:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=2,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break;case 0:u.psymodel=1,u.noise_shaping==0&&(u.noise_shaping=1),u.substep_shaping==0&&(u.substep_shaping=2),u.noise_shaping_amp=2,u.noise_shaping_stop=1,u.subblock_gain==-1&&(u.subblock_gain=1),u.use_best_huffman=1,u.full_outer_loop=0;break}}function i(s){var u=s.internal_flags;s.frameNum=0,s.write_id3tag_automatic&&ae.id3tag_write_v2(s),u.bitrate_stereoMode_Hist=ai([16,4+1]),u.bitrate_blockType_Hist=ai([16,4+1+1]),u.PeakSample=0,s.bWriteVbrTag&&F.InitVbrTag(s)}this.lame_init_params=function(s){var u=s.internal_flags;if(u.Class_ID=0,u.ATH==null&&(u.ATH=new Vs),u.PSY==null&&(u.PSY=new V),u.rgdata==null&&(u.rgdata=new qs),u.channels_in=s.num_channels,u.channels_in==1&&(s.mode=mt.MONO),u.channels_out=s.mode==mt.MONO?1:2,u.mode_ext=R.MPG_MD_MS_LR,s.mode==mt.MONO&&(s.force_ms=!1),s.VBR==Je.vbr_off&&s.VBR_mean_bitrate_kbps!=128&&s.brate==0&&(s.brate=s.VBR_mean_bitrate_kbps),s.VBR==Je.vbr_off||s.VBR==Je.vbr_mtrh||s.VBR==Je.vbr_mt||(s.free_format=!1),s.VBR==Je.vbr_off&&s.brate==0&&lr.EQ(s.compression_ratio,0)&&(s.compression_ratio=11.025),s.VBR==Je.vbr_off&&s.compression_ratio>0&&(s.out_samplerate==0&&(s.out_samplerate=map2MP3Frequency(int(.97*s.in_samplerate))),s.brate=0|s.out_samplerate*16*u.channels_out/(1e3*s.compression_ratio),u.samplerate_index=T(s.out_samplerate,s),s.free_format||(s.brate=L(s.brate,s.version,s.out_samplerate))),s.out_samplerate!=0&&(s.out_samplerate<16e3?(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,8),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,64)):s.out_samplerate<32e3?(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,8),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,160)):(s.VBR_mean_bitrate_kbps=Math.max(s.VBR_mean_bitrate_kbps,32),s.VBR_mean_bitrate_kbps=Math.min(s.VBR_mean_bitrate_kbps,320))),s.lowpassfreq==0){var Q=16e3;switch(s.VBR){case Je.vbr_off:{var se=new e;a(se,s.brate),Q=se.lowerlimit;break}case Je.vbr_abr:{var se=new e;a(se,s.VBR_mean_bitrate_kbps),Q=se.lowerlimit;break}case Je.vbr_rh:{var pe=[19500,19e3,18600,18e3,17500,16e3,15600,14900,12500,1e4,3950];if(0<=s.VBR_q&&s.VBR_q<=9){var Re=pe[s.VBR_q],Me=pe[s.VBR_q+1],Ae=s.VBR_q_frac;Q=linear_int(Re,Me,Ae)}else Q=19500;break}default:{var pe=[19500,19e3,18500,18e3,17500,16500,15500,14500,12500,9500,3950];if(0<=s.VBR_q&&s.VBR_q<=9){var Re=pe[s.VBR_q],Me=pe[s.VBR_q+1],Ae=s.VBR_q_frac;Q=linear_int(Re,Me,Ae)}else Q=19500}}s.mode==mt.MONO&&(s.VBR==Je.vbr_off||s.VBR==Je.vbr_abr)&&(Q*=1.5),s.lowpassfreq=Q|0}if(s.out_samplerate==0&&(2*s.lowpassfreq>s.in_samplerate&&(s.lowpassfreq=s.in_samplerate/2),s.out_samplerate=_(s.lowpassfreq|0,s.in_samplerate)),s.lowpassfreq=Math.min(20500,s.lowpassfreq),s.lowpassfreq=Math.min(s.out_samplerate/2,s.lowpassfreq),s.VBR==Je.vbr_off&&(s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.brate)),s.VBR==Je.vbr_abr&&(s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.VBR_mean_bitrate_kbps)),s.bWriteVbrTag||(s.findReplayGain=!1,s.decode_on_the_fly=!1,u.findPeakSample=!1),u.findReplayGain=s.findReplayGain,u.decode_on_the_fly=s.decode_on_the_fly,u.decode_on_the_fly&&(u.findPeakSample=!0),u.findReplayGain&&z.InitGainAnalysis(u.rgdata,s.out_samplerate)==Kr.INIT_GAIN_ANALYSIS_ERROR)return s.internal_flags=null,-6;switch(u.decode_on_the_fly&&!s.decode_only&&(u.hip!=null&&A.hip_decode_exit(u.hip),u.hip=A.hip_decode_init()),u.mode_gr=s.out_samplerate<=24e3?1:2,s.framesize=576*u.mode_gr,s.encoder_delay=R.ENCDELAY,u.resample_ratio=s.in_samplerate/s.out_samplerate,s.VBR){case Je.vbr_mt:case Je.vbr_rh:case Je.vbr_mtrh:{var De=[5.7,6.5,7.3,8.2,10,11.9,13,14,15,16.5];s.compression_ratio=De[s.VBR_q]}break;case Je.vbr_abr:s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.VBR_mean_bitrate_kbps);break;default:s.compression_ratio=s.out_samplerate*16*u.channels_out/(1e3*s.brate);break}if(s.mode==mt.NOT_SET&&(s.mode=mt.JOINT_STEREO),s.highpassfreq>0?(u.highpass1=2*s.highpassfreq,s.highpasswidth>=0?u.highpass2=2*(s.highpassfreq+s.highpasswidth):u.highpass2=(1+0)*2*s.highpassfreq,u.highpass1/=s.out_samplerate,u.highpass2/=s.out_samplerate):(u.highpass1=0,u.highpass2=0),s.lowpassfreq>0?(u.lowpass2=2*s.lowpassfreq,s.lowpasswidth>=0?(u.lowpass1=2*(s.lowpassfreq-s.lowpasswidth),u.lowpass1<0&&(u.lowpass1=0)):u.lowpass1=(1-0)*2*s.lowpassfreq,u.lowpass1/=s.out_samplerate,u.lowpass2/=s.out_samplerate):(u.lowpass1=0,u.lowpass2=0),I(s),u.samplerate_index=T(s.out_samplerate,s),u.samplerate_index<0)return s.internal_flags=null,-1;if(s.VBR==Je.vbr_off){if(s.free_format)u.bitrate_index=0;else if(s.brate=L(s.brate,s.version,s.out_samplerate),u.bitrate_index=b(s.brate,s.version,s.out_samplerate),u.bitrate_index<=0)return s.internal_flags=null,-1}else u.bitrate_index=1;s.analysis&&(s.bWriteVbrTag=!1),u.pinfo!=null&&(s.bWriteVbrTag=!1),ce.init_bit_stream_w(u);for(var Ie=u.samplerate_index+3*s.version+6*(s.out_samplerate<16e3?1:0),Ee=0;Ee<R.SBMAX_l+1;Ee++)u.scalefac_band.l[Ee]=te.sfBandIndex[Ie].l[Ee];for(var Ee=0;Ee<R.PSFB21+1;Ee++){var Ge=(u.scalefac_band.l[22]-u.scalefac_band.l[21])/R.PSFB21,tt=u.scalefac_band.l[21]+Ee*Ge;u.scalefac_band.psfb21[Ee]=tt}u.scalefac_band.psfb21[R.PSFB21]=576;for(var Ee=0;Ee<R.SBMAX_s+1;Ee++)u.scalefac_band.s[Ee]=te.sfBandIndex[Ie].s[Ee];for(var Ee=0;Ee<R.PSFB12+1;Ee++){var Ge=(u.scalefac_band.s[13]-u.scalefac_band.s[12])/R.PSFB12,tt=u.scalefac_band.s[12]+Ee*Ge;u.scalefac_band.psfb12[Ee]=tt}u.scalefac_band.psfb12[R.PSFB12]=192,s.version==1?u.sideinfo_len=u.channels_out==1?4+17:4+32:u.sideinfo_len=u.channels_out==1?4+9:4+17,s.error_protection&&(u.sideinfo_len+=2),i(s),u.Class_ID=P;{var We;for(We=0;We<19;We++)u.nsPsy.pefirbuf[We]=700*u.mode_gr*u.channels_out;s.ATHtype==-1&&(s.ATHtype=4)}switch(Ct(s.VBR_q<=9),Ct(s.VBR_q>=0),s.VBR){case Je.vbr_mt:s.VBR=Je.vbr_mtrh;case Je.vbr_mtrh:{s.useTemporal==null&&(s.useTemporal=!1),Y.apply_preset(s,500-s.VBR_q*10,0),s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),s.quality<5&&(s.quality=0),s.quality>5&&(s.quality=5),u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,s.experimentalY?u.sfb21_extra=!1:u.sfb21_extra=s.out_samplerate>44e3,u.iteration_loop=new VBRNewIterationLoop(me);break}case Je.vbr_rh:{Y.apply_preset(s,500-s.VBR_q*10,0),u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,s.experimentalY?u.sfb21_extra=!1:u.sfb21_extra=s.out_samplerate>44e3,s.quality>6&&(s.quality=6),s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),u.iteration_loop=new VBROldIterationLoop(me);break}default:{var rt;u.sfb21_extra=!1,s.quality<0&&(s.quality=LAME_DEFAULT_QUALITY),rt=s.VBR,rt==Je.vbr_off&&(s.VBR_mean_bitrate_kbps=s.brate),Y.apply_preset(s,s.VBR_mean_bitrate_kbps,0),s.VBR=rt,u.PSY.mask_adjust=s.maskingadjust,u.PSY.mask_adjust_short=s.maskingadjust_short,rt==Je.vbr_off?u.iteration_loop=new Gs(me):u.iteration_loop=new ABRIterationLoop(me);break}}if(Ct(s.scale>=0),s.VBR!=Je.vbr_off){if(u.VBR_min_bitrate=1,u.VBR_max_bitrate=14,s.out_samplerate<16e3&&(u.VBR_max_bitrate=8),s.VBR_min_bitrate_kbps!=0&&(s.VBR_min_bitrate_kbps=L(s.VBR_min_bitrate_kbps,s.version,s.out_samplerate),u.VBR_min_bitrate=b(s.VBR_min_bitrate_kbps,s.version,s.out_samplerate),u.VBR_min_bitrate<0)||s.VBR_max_bitrate_kbps!=0&&(s.VBR_max_bitrate_kbps=L(s.VBR_max_bitrate_kbps,s.version,s.out_samplerate),u.VBR_max_bitrate=b(s.VBR_max_bitrate_kbps,s.version,s.out_samplerate),u.VBR_max_bitrate<0))return-1;s.VBR_min_bitrate_kbps=ze.bitrate_table[s.version][u.VBR_min_bitrate],s.VBR_max_bitrate_kbps=ze.bitrate_table[s.version][u.VBR_max_bitrate],s.VBR_mean_bitrate_kbps=Math.min(ze.bitrate_table[s.version][u.VBR_max_bitrate],s.VBR_mean_bitrate_kbps),s.VBR_mean_bitrate_kbps=Math.max(ze.bitrate_table[s.version][u.VBR_min_bitrate],s.VBR_mean_bitrate_kbps)}return s.tune&&(u.PSY.mask_adjust+=s.tune_value_a,u.PSY.mask_adjust_short+=s.tune_value_a),v(s),Ct(s.scale>=0),s.athaa_type<0?u.ATH.useAdjust=3:u.ATH.useAdjust=s.athaa_type,u.ATH.aaSensitivityP=Math.pow(10,s.athaa_sensitivity/-10),s.short_blocks==null&&(s.short_blocks=ca.short_block_allowed),s.short_blocks==ca.short_block_allowed&&(s.mode==mt.JOINT_STEREO||s.mode==mt.STEREO)&&(s.short_blocks=ca.short_block_coupled),s.quant_comp<0&&(s.quant_comp=1),s.quant_comp_short<0&&(s.quant_comp_short=0),s.msfix<0&&(s.msfix=0),s.exp_nspsytune=s.exp_nspsytune|1,s.internal_flags.nsPsy.attackthre<0&&(s.internal_flags.nsPsy.attackthre=ia.NSATTACKTHRE),s.internal_flags.nsPsy.attackthre_s<0&&(s.internal_flags.nsPsy.attackthre_s=ia.NSATTACKTHRE_S),Ct(s.scale>=0),s.scale<0&&(s.scale=1),s.ATHtype<0&&(s.ATHtype=4),s.ATHcurve<0&&(s.ATHcurve=4),s.athaa_loudapprox<0&&(s.athaa_loudapprox=2),s.interChRatio<0&&(s.interChRatio=0),s.useTemporal==null&&(s.useTemporal=!0),u.slot_lag=u.frac_SpF=0,s.VBR==Je.vbr_off&&(u.slot_lag=u.frac_SpF=(s.version+1)*72e3*s.brate%s.out_samplerate|0),te.iteration_init(s),ve.psymodel_init(s),Ct(s.scale>=0),0};function o(s,u){(s.in_buffer_0==null||s.in_buffer_nsamples<u)&&(s.in_buffer_0=Er(u),s.in_buffer_1=Er(u),s.in_buffer_nsamples=u)}this.lame_encode_flush=function(s,u,Q,se){var pe=s.internal_flags,Re=tn([2,1152]),Me=0,Ae,De,Ie,Ee,Ge=pe.mf_samples_to_encode-R.POSTDELAY,tt=m(s);if(pe.mf_samples_to_encode<1)return 0;for(Ae=0,s.in_samplerate!=s.out_samplerate&&(Ge+=16*s.out_samplerate/s.in_samplerate),Ie=s.framesize-Ge%s.framesize,Ie<576&&(Ie+=s.framesize),s.encoder_padding=Ie,Ee=(Ge+Ie)/s.framesize;Ee>0&&Me>=0;){var We=tt-pe.mf_size,rt=s.frameNum;We*=s.in_samplerate,We/=s.out_samplerate,We>1152&&(We=1152),We<1&&(We=1),De=se-Ae,se==0&&(De=0),Me=this.lame_encode_buffer(s,Re[0],Re[1],We,u,Q,De),Q+=Me,Ae+=Me,Ee-=rt!=s.frameNum?1:0}if(pe.mf_samples_to_encode=0,Me<0||(De=se-Ae,se==0&&(De=0),ce.flush_bitstream(s),Me=ce.copy_buffer(pe,u,Q,De,1),Me<0))return Me;if(Q+=Me,Ae+=Me,De=se-Ae,se==0&&(De=0),s.write_id3tag_automatic){if(ae.id3tag_write_v1(s),Me=ce.copy_buffer(pe,u,Q,De,0),Me<0)return Me;Ae+=Me}return Ae},this.lame_encode_buffer=function(s,u,Q,se,pe,Re,Me){var Ae=s.internal_flags,De=[null,null];if(Ae.Class_ID!=P)return-3;if(se==0)return 0;o(Ae,se),De[0]=Ae.in_buffer_0,De[1]=Ae.in_buffer_1;for(var Ie=0;Ie<se;Ie++)De[0][Ie]=u[Ie],Ae.channels_in>1&&(De[1][Ie]=Q[Ie]);return r(s,De[0],De[1],se,pe,Re,Me)};function m(s){var u=R.BLKSIZE+s.framesize-R.FFTOFFSET;return u=Math.max(u,512+s.framesize-32),Ct(Qe.MFSIZE>=u),u}function r(s,u,Q,se,pe,Re,Me){var Ae=s.internal_flags,De=0,Ie,Ee,Ge,tt,We,rt=[null,null],lt=[null,null];if(Ae.Class_ID!=P)return-3;if(se==0)return 0;if(We=ce.copy_buffer(Ae,pe,Re,Me,0),We<0)return We;if(Re+=We,De+=We,lt[0]=u,lt[1]=Q,lr.NEQ(s.scale,0)&&lr.NEQ(s.scale,1))for(Ee=0;Ee<se;++Ee)lt[0][Ee]*=s.scale,Ae.channels_out==2&&(lt[1][Ee]*=s.scale);if(lr.NEQ(s.scale_left,0)&&lr.NEQ(s.scale_left,1))for(Ee=0;Ee<se;++Ee)lt[0][Ee]*=s.scale_left;if(lr.NEQ(s.scale_right,0)&&lr.NEQ(s.scale_right,1))for(Ee=0;Ee<se;++Ee)lt[1][Ee]*=s.scale_right;if(s.num_channels==2&&Ae.channels_out==1)for(Ee=0;Ee<se;++Ee)lt[0][Ee]=.5*(lt[0][Ee]+lt[1][Ee]),lt[1][Ee]=0;tt=m(s),rt[0]=Ae.mfbuf[0],rt[1]=Ae.mfbuf[1];for(var _t=0;se>0;){var pt=[null,null],Qt=0,At=0;pt[0]=lt[0],pt[1]=lt[1];var Mt=new f;if(oe(s,rt,pt,_t,se,Mt),Qt=Mt.n_in,At=Mt.n_out,Ae.findReplayGain&&!Ae.decode_on_the_fly&&z.AnalyzeSamples(Ae.rgdata,rt[0],Ae.mf_size,rt[1],Ae.mf_size,At,Ae.channels_out)==Kr.GAIN_ANALYSIS_ERROR)return-6;if(se-=Qt,_t+=Qt,Ae.channels_out==2,Ae.mf_size+=At,Ct(Ae.mf_size<=Qe.MFSIZE),Ae.mf_samples_to_encode<1&&(Ae.mf_samples_to_encode=R.ENCDELAY+R.POSTDELAY),Ae.mf_samples_to_encode+=At,Ae.mf_size>=tt){var Ut=Me-De;if(Me==0&&(Ut=0),Ie=l(s,rt[0],rt[1],pe,Re,Ut),Ie<0)return Ie;for(Re+=Ie,De+=Ie,Ae.mf_size-=s.framesize,Ae.mf_samples_to_encode-=s.framesize,Ge=0;Ge<Ae.channels_out;Ge++)for(Ee=0;Ee<Ae.mf_size;Ee++)rt[Ge][Ee]=rt[Ge][Ee+s.framesize]}}return Ct(se==0),De}function l(s,u,Q,se,pe,Re){var Me=w.enc.lame_encode_mp3_frame(s,u,Q,se,pe,Re);return s.frameNum++,Me}function f(){this.n_in=0,this.n_out=0}function p(){this.num_used=0}function H(s,u){return u!=0?H(u,s%u):s}function g(s,u,Q){var se=Math.PI*u;s/=Q,s<0&&(s=0),s>1&&(s=1);var pe=s-.5,Re=.42-.5*Math.cos(2*s*Math.PI)+.08*Math.cos(4*s*Math.PI);return Math.abs(pe)<1e-9?se/Math.PI:Re*Math.sin(Q*se*pe)/(Math.PI*Q*pe)}function D(s,u,Q,se,pe,Re,Me,Ae,De){var Ie=s.internal_flags,Ee,Ge=0,tt,We=s.out_samplerate/H(s.out_samplerate,s.in_samplerate);We>Qe.BPC&&(We=Qe.BPC);var rt=Math.abs(Ie.resample_ratio-Math.floor(.5+Ie.resample_ratio))<1e-4?1:0,lt=1/Ie.resample_ratio;lt>1&&(lt=1);var _t=31;_t%2==0&&--_t,_t+=rt;var pt=_t+1;if(Ie.fill_buffer_resample_init==0){for(Ie.inbuf_old[0]=Er(pt),Ie.inbuf_old[1]=Er(pt),Ee=0;Ee<=2*We;++Ee)Ie.blackfilt[Ee]=Er(pt);for(Ie.itime[0]=0,Ie.itime[1]=0,Ge=0;Ge<=2*We;Ge++){var Qt=0,At=(Ge-We)/(2*We);for(Ee=0;Ee<=_t;Ee++)Qt+=Ie.blackfilt[Ge][Ee]=g(Ee-At,lt,_t);for(Ee=0;Ee<=_t;Ee++)Ie.blackfilt[Ge][Ee]/=Qt}Ie.fill_buffer_resample_init=1}var Mt=Ie.inbuf_old[De];for(tt=0;tt<se;tt++){var Ut,wr;if(Ut=tt*Ie.resample_ratio,Ge=0|Math.floor(Ut-Ie.itime[De]),_t+Ge-_t/2>=Me)break;var At=Ut-Ie.itime[De]-(Ge+.5*(_t%2));Ct(Math.abs(At)<=.501),wr=0|Math.floor(At*2*We+We+.5);var Ar=0;for(Ee=0;Ee<=_t;++Ee){var qt=Ee+Ge-_t/2,Rt;Ct(qt<Me),Ct(qt+pt>=0),Rt=qt<0?Mt[pt+qt]:pe[Re+qt],Ar+=Rt*Ie.blackfilt[wr][Ee]}u[Q+tt]=Ar}if(Ae.num_used=Math.min(Me,_t+Ge-_t/2),Ie.itime[De]+=Ae.num_used-tt*Ie.resample_ratio,Ae.num_used>=pt)for(Ee=0;Ee<pt;Ee++)Mt[Ee]=pe[Re+Ae.num_used+Ee-pt];else{var _r=pt-Ae.num_used;for(Ee=0;Ee<_r;++Ee)Mt[Ee]=Mt[Ee+Ae.num_used];for(Ge=0;Ee<pt;++Ee,++Ge)Mt[Ee]=pe[Re+Ge];Ct(Ge==Ae.num_used)}return tt}function oe(s,u,Q,se,pe,Re){var Me=s.internal_flags;if(Me.resample_ratio<.9999||Me.resample_ratio>1.0001)for(var Ae=0;Ae<Me.channels_out;Ae++){var De=new p;Re.n_out=D(s,u[Ae],Me.mf_size,s.framesize,Q[Ae],se,pe,De,Ae),Re.n_in=De.num_used}else{Re.n_out=Math.min(s.framesize,pe),Re.n_in=Re.n_out;for(var Ie=0;Ie<Re.n_out;++Ie)u[0][Me.mf_size+Ie]=Q[0][se+Ie],Me.channels_out==2&&(u[1][Me.mf_size+Ie]=Q[1][se+Ie])}}}var rn=ht,Wt=ne.VbrMode;function an(){function w(F,J,ae,A,V,e,E,P,B,d,_,T,L,b,a){this.vbr_q=F,this.quant_comp=J,this.quant_comp_s=ae,this.expY=A,this.st_lrm=V,this.st_s=e,this.masking_adj=E,this.masking_adj_short=P,this.ath_lower=B,this.ath_curve=d,this.ath_sensitivity=_,this.interch=T,this.safejoint=L,this.sfb21mod=b,this.msfix=a}function X(F,J,ae,A,V,e,E,P,B,d,_,T,L,b){this.quant_comp=J,this.quant_comp_s=ae,this.safejoint=A,this.nsmsfix=V,this.st_lrm=e,this.st_s=E,this.nsbass=P,this.scale=B,this.masking_adj=d,this.ath_lower=_,this.ath_curve=T,this.interch=L,this.sfscale=b}var K;this.setModules=function(F){K=F};var z=[new w(0,9,9,0,5.2,125,-4.2,-6.3,4.8,1,0,0,2,21,.97),new w(1,9,9,0,5.3,125,-3.6,-5.6,4.5,1.5,0,0,2,21,1.35),new w(2,9,9,0,5.6,125,-2.2,-3.5,2.8,2,0,0,2,21,1.49),new w(3,9,9,1,5.8,130,-1.8,-2.8,2.6,3,-4,0,2,20,1.64),new w(4,9,9,1,6,135,-.7,-1.1,1.1,3.5,-8,0,2,0,1.79),new w(5,9,9,1,6.4,140,.5,.4,-7.5,4,-12,2e-4,0,0,1.95),new w(6,9,9,1,6.6,145,.67,.65,-14.7,6.5,-19,4e-4,0,0,2.3),new w(7,9,9,1,6.6,145,.8,.75,-19.7,8,-22,6e-4,0,0,2.7),new w(8,9,9,1,6.6,145,1.2,1.15,-27.5,10,-23,7e-4,0,0,0),new w(9,9,9,1,6.6,145,1.6,1.6,-36,11,-25,8e-4,0,0,0),new w(10,9,9,1,6.6,145,2,2,-36,12,-25,8e-4,0,0,0)],ce=[new w(0,9,9,0,4.2,25,-7,-4,7.5,1,0,0,2,26,.97),new w(1,9,9,0,4.2,25,-5.6,-3.6,4.5,1.5,0,0,2,21,1.35),new w(2,9,9,0,4.2,25,-4.4,-1.8,2,2,0,0,2,18,1.49),new w(3,9,9,1,4.2,25,-3.4,-1.25,1.1,3,-4,0,2,15,1.64),new w(4,9,9,1,4.2,25,-2.2,.1,0,3.5,-8,0,2,0,1.79),new w(5,9,9,1,4.2,25,-1,1.65,-7.7,4,-12,2e-4,0,0,1.95),new w(6,9,9,1,4.2,25,-0,2.47,-7.7,6.5,-19,4e-4,0,0,2),new w(7,9,9,1,4.2,25,.5,2,-14.5,8,-22,6e-4,0,0,2),new w(8,9,9,1,4.2,25,1,2.4,-22,10,-23,7e-4,0,0,2),new w(9,9,9,1,4.2,25,1.5,2.95,-30,11,-25,8e-4,0,0,2),new w(10,9,9,1,4.2,25,2,2.95,-36,12,-30,8e-4,0,0,2)];function Y(F,J,ae){var A=F.VBR==Wt.vbr_rh?z:ce,V=F.VBR_q_frac,e=A[J],E=A[J+1],P=e;e.st_lrm=e.st_lrm+V*(E.st_lrm-e.st_lrm),e.st_s=e.st_s+V*(E.st_s-e.st_s),e.masking_adj=e.masking_adj+V*(E.masking_adj-e.masking_adj),e.masking_adj_short=e.masking_adj_short+V*(E.masking_adj_short-e.masking_adj_short),e.ath_lower=e.ath_lower+V*(E.ath_lower-e.ath_lower),e.ath_curve=e.ath_curve+V*(E.ath_curve-e.ath_curve),e.ath_sensitivity=e.ath_sensitivity+V*(E.ath_sensitivity-e.ath_sensitivity),e.interch=e.interch+V*(E.interch-e.interch),e.msfix=e.msfix+V*(E.msfix-e.msfix),ve(F,P.vbr_q),ae!=0?F.quant_comp=P.quant_comp:Math.abs(F.quant_comp- -1)>0||(F.quant_comp=P.quant_comp),ae!=0?F.quant_comp_short=P.quant_comp_s:Math.abs(F.quant_comp_short- -1)>0||(F.quant_comp_short=P.quant_comp_s),P.expY!=0&&(F.experimentalY=P.expY!=0),ae!=0?F.internal_flags.nsPsy.attackthre=P.st_lrm:Math.abs(F.internal_flags.nsPsy.attackthre- -1)>0||(F.internal_flags.nsPsy.attackthre=P.st_lrm),ae!=0?F.internal_flags.nsPsy.attackthre_s=P.st_s:Math.abs(F.internal_flags.nsPsy.attackthre_s- -1)>0||(F.internal_flags.nsPsy.attackthre_s=P.st_s),ae!=0?F.maskingadjust=P.masking_adj:Math.abs(F.maskingadjust-0)>0||(F.maskingadjust=P.masking_adj),ae!=0?F.maskingadjust_short=P.masking_adj_short:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=P.masking_adj_short),ae!=0?F.ATHlower=-P.ath_lower/10:Math.abs(-F.ATHlower*10-0)>0||(F.ATHlower=-P.ath_lower/10),ae!=0?F.ATHcurve=P.ath_curve:Math.abs(F.ATHcurve- -1)>0||(F.ATHcurve=P.ath_curve),ae!=0?F.athaa_sensitivity=P.ath_sensitivity:Math.abs(F.athaa_sensitivity- -1)>0||(F.athaa_sensitivity=P.ath_sensitivity),P.interch>0&&(ae!=0?F.interChRatio=P.interch:Math.abs(F.interChRatio- -1)>0||(F.interChRatio=P.interch)),P.safejoint>0&&(F.exp_nspsytune=F.exp_nspsytune|P.safejoint),P.sfb21mod>0&&(F.exp_nspsytune=F.exp_nspsytune|P.sfb21mod<<20),ae!=0?F.msfix=P.msfix:Math.abs(F.msfix- -1)>0||(F.msfix=P.msfix),ae==0&&(F.VBR_q=J,F.VBR_q_frac=V)}var te=[new X(8,9,9,0,0,6.6,145,0,.95,0,-30,11,.0012,1),new X(16,9,9,0,0,6.6,145,0,.95,0,-25,11,.001,1),new X(24,9,9,0,0,6.6,145,0,.95,0,-20,11,.001,1),new X(32,9,9,0,0,6.6,145,0,.95,0,-15,11,.001,1),new X(40,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new X(48,9,9,0,0,6.6,145,0,.95,0,-10,11,9e-4,1),new X(56,9,9,0,0,6.6,145,0,.95,0,-6,11,8e-4,1),new X(64,9,9,0,0,6.6,145,0,.95,0,-2,11,8e-4,1),new X(80,9,9,0,0,6.6,145,0,.95,0,0,8,7e-4,1),new X(96,9,9,0,2.5,6.6,145,0,.95,0,1,5.5,6e-4,1),new X(112,9,9,0,2.25,6.6,145,0,.95,0,2,4.5,5e-4,1),new X(128,9,9,0,1.95,6.4,140,0,.95,0,3,4,2e-4,1),new X(160,9,9,1,1.79,6,135,0,.95,-2,5,3.5,0,1),new X(192,9,9,1,1.49,5.6,125,0,.97,-4,7,3,0,0),new X(224,9,9,1,1.25,5.2,125,0,.98,-6,9,2,0,0),new X(256,9,9,1,.97,5.2,125,0,1,-8,10,1,0,0),new X(320,9,9,1,.9,5.2,125,0,1,-10,12,0,0,0)];function me(F,J,ae){var A=J,V=K.nearestBitrateFullIndex(J);if(F.VBR=Wt.vbr_abr,F.VBR_mean_bitrate_kbps=A,F.VBR_mean_bitrate_kbps=Math.min(F.VBR_mean_bitrate_kbps,320),F.VBR_mean_bitrate_kbps=Math.max(F.VBR_mean_bitrate_kbps,8),F.brate=F.VBR_mean_bitrate_kbps,F.VBR_mean_bitrate_kbps>320&&(F.disable_reservoir=!0),te[V].safejoint>0&&(F.exp_nspsytune=F.exp_nspsytune|2),te[V].sfscale>0&&(F.internal_flags.noise_shaping=2),Math.abs(te[V].nsbass)>0){var e=int(te[V].nsbass*4);e<0&&(e+=64),F.exp_nspsytune=F.exp_nspsytune|e<<2}return ae!=0?F.quant_comp=te[V].quant_comp:Math.abs(F.quant_comp- -1)>0||(F.quant_comp=te[V].quant_comp),ae!=0?F.quant_comp_short=te[V].quant_comp_s:Math.abs(F.quant_comp_short- -1)>0||(F.quant_comp_short=te[V].quant_comp_s),ae!=0?F.msfix=te[V].nsmsfix:Math.abs(F.msfix- -1)>0||(F.msfix=te[V].nsmsfix),ae!=0?F.internal_flags.nsPsy.attackthre=te[V].st_lrm:Math.abs(F.internal_flags.nsPsy.attackthre- -1)>0||(F.internal_flags.nsPsy.attackthre=te[V].st_lrm),ae!=0?F.internal_flags.nsPsy.attackthre_s=te[V].st_s:Math.abs(F.internal_flags.nsPsy.attackthre_s- -1)>0||(F.internal_flags.nsPsy.attackthre_s=te[V].st_s),ae!=0?F.scale=te[V].scale:Math.abs(F.scale- -1)>0||(F.scale=te[V].scale),ae!=0?F.maskingadjust=te[V].masking_adj:Math.abs(F.maskingadjust-0)>0||(F.maskingadjust=te[V].masking_adj),te[V].masking_adj>0?ae!=0?F.maskingadjust_short=te[V].masking_adj*.9:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=te[V].masking_adj*.9):ae!=0?F.maskingadjust_short=te[V].masking_adj*1.1:Math.abs(F.maskingadjust_short-0)>0||(F.maskingadjust_short=te[V].masking_adj*1.1),ae!=0?F.ATHlower=-te[V].ath_lower/10:Math.abs(-F.ATHlower*10-0)>0||(F.ATHlower=-te[V].ath_lower/10),ae!=0?F.ATHcurve=te[V].ath_curve:Math.abs(F.ATHcurve- -1)>0||(F.ATHcurve=te[V].ath_curve),ae!=0?F.interChRatio=te[V].interch:Math.abs(F.interChRatio- -1)>0||(F.interChRatio=te[V].interch),J}this.apply_preset=function(F,J,ae){switch(J){case Ze.R3MIX:{J=Ze.V3,F.VBR=Wt.vbr_mtrh;break}case Ze.MEDIUM:{J=Ze.V4,F.VBR=Wt.vbr_rh;break}case Ze.MEDIUM_FAST:{J=Ze.V4,F.VBR=Wt.vbr_mtrh;break}case Ze.STANDARD:{J=Ze.V2,F.VBR=Wt.vbr_rh;break}case Ze.STANDARD_FAST:{J=Ze.V2,F.VBR=Wt.vbr_mtrh;break}case Ze.EXTREME:{J=Ze.V0,F.VBR=Wt.vbr_rh;break}case Ze.EXTREME_FAST:{J=Ze.V0,F.VBR=Wt.vbr_mtrh;break}case Ze.INSANE:return J=320,F.preset=J,me(F,J,ae),F.VBR=Wt.vbr_off,J}switch(F.preset=J,J){case Ze.V9:return Y(F,9,ae),J;case Ze.V8:return Y(F,8,ae),J;case Ze.V7:return Y(F,7,ae),J;case Ze.V6:return Y(F,6,ae),J;case Ze.V5:return Y(F,5,ae),J;case Ze.V4:return Y(F,4,ae),J;case Ze.V3:return Y(F,3,ae),J;case Ze.V2:return Y(F,2,ae),J;case Ze.V1:return Y(F,1,ae),J;case Ze.V0:return Y(F,0,ae),J;default:break}return 8<=J&&J<=320?me(F,J,ae):(F.preset=0,J)};function ve(F,J){var ae=0;return 0>J&&(ae=-1,J=0),9<J&&(ae=-1,J=9),F.VBR_q=J,F.VBR_q_frac=0,ae}}var sn=an;function nn(){var w,X;this.setModules=function(K,z){w=K,X=z}}var on=nn;function ln(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}var _a=ln,ii=ne.new_float,cn=ne.new_int;function _n(){this.global_gain=0,this.sfb_count1=0,this.step=cn(39),this.noise=ii(39),this.noise_log=ii(39)}var un=_n,cr=ne.System,si=ne.VbrMode,ua=ne.Util,gr=ne.Arrays,jr=ne.new_float,Dt=ne.assert;function dn(){var w;this.rv=null;var X;this.qupvt=null;var K,z=new on,ce;this.setModules=function(B,d,_,T){w=B,X=d,this.rv=d,K=_,this.qupvt=_,ce=T,z.setModules(K,ce)},this.ms_convert=function(B,d){for(var _=0;_<576;++_){var T=B.tt[d][0].xr[_],L=B.tt[d][1].xr[_];B.tt[d][0].xr[_]=(T+L)*(ua.SQRT2*.5),B.tt[d][1].xr[_]=(T-L)*(ua.SQRT2*.5)}};function Y(B,d,_,T){T=0;for(var L=0;L<=_;++L){var b=Math.abs(B.xr[L]);T+=b,d[L]=Math.sqrt(b*Math.sqrt(b)),d[L]>B.xrpow_max&&(B.xrpow_max=d[L])}return T}this.init_xrpow=function(B,d,_){var T=0,L=0|d.max_nonzero_coeff;if(Dt(_!=null),d.xrpow_max=0,Dt(0<=L&&L<=575),gr.fill(_,L,576,0),T=Y(d,_,L,T),T>1e-20){var b=0;(B.substep_shaping&2)!=0&&(b=1);for(var a=0;a<d.psymax;a++)B.pseudohalf[a]=b;return!0}return gr.fill(d.l3_enc,0,576,0),!1};function te(B,d){var _=B.ATH,T=d.xr;if(d.block_type!=R.SHORT_TYPE)for(var L=!1,b=R.PSFB21-1;b>=0&&!L;b--){var a=B.scalefac_band.psfb21[b],I=B.scalefac_band.psfb21[b+1],v=K.athAdjust(_.adjust,_.psfb21[b],_.floor);B.nsPsy.longfact[21]>1e-12&&(v*=B.nsPsy.longfact[21]);for(var i=I-1;i>=a;i--)if(Math.abs(T[i])<v)T[i]=0;else{L=!0;break}}else for(var o=0;o<3;o++)for(var L=!1,b=R.PSFB12-1;b>=0&&!L;b--){var a=B.scalefac_band.s[12]*3+(B.scalefac_band.s[13]-B.scalefac_band.s[12])*o+(B.scalefac_band.psfb12[b]-B.scalefac_band.psfb12[0]),I=a+(B.scalefac_band.psfb12[b+1]-B.scalefac_band.psfb12[b]),m=K.athAdjust(_.adjust,_.psfb12[b],_.floor);B.nsPsy.shortfact[12]>1e-12&&(m*=B.nsPsy.shortfact[12]);for(var i=I-1;i>=a;i--)if(Math.abs(T[i])<m)T[i]=0;else{L=!0;break}}}this.init_outer_loop=function(B,d){d.part2_3_length=0,d.big_values=0,d.count1=0,d.global_gain=210,d.scalefac_compress=0,d.table_select[0]=0,d.table_select[1]=0,d.table_select[2]=0,d.subblock_gain[0]=0,d.subblock_gain[1]=0,d.subblock_gain[2]=0,d.subblock_gain[3]=0,d.region0_count=0,d.region1_count=0,d.preflag=0,d.scalefac_scale=0,d.count1table_select=0,d.part2_length=0,d.sfb_lmax=R.SBPSY_l,d.sfb_smin=R.SBPSY_s,d.psy_lmax=B.sfb21_extra?R.SBMAX_l:R.SBPSY_l,d.psymax=d.psy_lmax,d.sfbmax=d.sfb_lmax,d.sfbdivide=11;for(var _=0;_<R.SBMAX_l;_++)d.width[_]=B.scalefac_band.l[_+1]-B.scalefac_band.l[_],d.window[_]=3;if(d.block_type==R.SHORT_TYPE){var T=jr(576);d.sfb_smin=0,d.sfb_lmax=0,d.mixed_block_flag!=0&&(d.sfb_smin=3,d.sfb_lmax=B.mode_gr*2+4),d.psymax=d.sfb_lmax+3*((B.sfb21_extra?R.SBMAX_s:R.SBPSY_s)-d.sfb_smin),d.sfbmax=d.sfb_lmax+3*(R.SBPSY_s-d.sfb_smin),d.sfbdivide=d.sfbmax-18,d.psy_lmax=d.sfb_lmax;var L=B.scalefac_band.l[d.sfb_lmax];cr.arraycopy(d.xr,0,T,0,576);for(var _=d.sfb_smin;_<R.SBMAX_s;_++)for(var b=B.scalefac_band.s[_],a=B.scalefac_band.s[_+1],I=0;I<3;I++)for(var v=b;v<a;v++)d.xr[L++]=T[3*v+I];for(var i=d.sfb_lmax,_=d.sfb_smin;_<R.SBMAX_s;_++)d.width[i]=d.width[i+1]=d.width[i+2]=B.scalefac_band.s[_+1]-B.scalefac_band.s[_],d.window[i]=0,d.window[i+1]=1,d.window[i+2]=2,i+=3}d.count1bits=0,d.sfb_partition_table=K.nr_of_sfb_block[0][0],d.slen[0]=0,d.slen[1]=0,d.slen[2]=0,d.slen[3]=0,d.max_nonzero_coeff=575,gr.fill(d.scalefac,0),te(B,d)};function me(B){this.ordinal=B}me.BINSEARCH_NONE=new me(0),me.BINSEARCH_UP=new me(1),me.BINSEARCH_DOWN=new me(2);function ve(B,d,_,T,L){var b,a=B.CurrentStep[T],I=!1,v=B.OldValue[T],i=me.BINSEARCH_NONE;for(d.global_gain=v,_-=d.part2_length,Dt(a!=0);;){var o;if(b=ce.count_bits(B,L,d,null),a==1||b==_)break;b>_?(i==me.BINSEARCH_DOWN&&(I=!0),I&&(a/=2),i=me.BINSEARCH_UP,o=a):(i==me.BINSEARCH_UP&&(I=!0),I&&(a/=2),i=me.BINSEARCH_DOWN,o=-a),d.global_gain+=o,d.global_gain<0&&(d.global_gain=0,I=!0),d.global_gain>255&&(d.global_gain=255,I=!0)}for(Dt(d.global_gain>=0),Dt(d.global_gain<256);b>_&&d.global_gain<255;)d.global_gain++,b=ce.count_bits(B,L,d,null);return B.CurrentStep[T]=v-d.global_gain>=4?4:2,B.OldValue[T]=d.global_gain,d.part2_3_length=b,b}this.trancate_smallspectrums=function(B,d,_,T){var L=jr(pr.SFBMAX);if(!((B.substep_shaping&4)==0&&d.block_type==R.SHORT_TYPE||(B.substep_shaping&128)!=0)){K.calc_noise(d,_,L,new _a,null);for(var a=0;a<576;a++){var b=0;d.l3_enc[a]!=0&&(b=Math.abs(d.xr[a])),T[a]=b}var a=0,I=8;d.block_type==R.SHORT_TYPE&&(I=6);do{var v,i,o,m,r=d.width[I];if(a+=r,!(L[I]>=1)&&(gr.sort(T,a-r,r),!ir.EQ(T[a-1],0))){v=(1-L[I])*_[I],i=0,m=0;do{var l;for(o=1;m+o<r&&!ir.NEQ(T[m+a-r],T[m+a+o-r]);o++);if(l=T[m+a-r]*T[m+a-r]*o,v<l){m!=0&&(i=T[m+a-r-1]);break}v-=l,m+=o}while(m<r);if(!ir.EQ(i,0))do Math.abs(d.xr[a-r])<=i&&(d.l3_enc[a-r]=0);while(--r>0)}}while(++I<d.psymax);d.part2_3_length=ce.noquant_count_bits(B,d,null)}};function F(B){for(var d=0;d<B.sfbmax;d++)if(B.scalefac[d]+B.subblock_gain[B.window[d]]==0)return!1;return!0}function J(B){return ua.FAST_LOG10(.368+.632*B*B*B)}function ae(B,d){for(var _=1e-37,T=0;T<d.psymax;T++)_+=J(B[T]);return Math.max(1e-20,_)}function A(B,d,_,T,L){var b;switch(B){default:case 9:{d.over_count>0?(b=_.over_SSD<=d.over_SSD,_.over_SSD==d.over_SSD&&(b=_.bits<d.bits)):b=_.max_noise<0&&_.max_noise*10+_.bits<=d.max_noise*10+d.bits;break}case 0:b=_.over_count<d.over_count||_.over_count==d.over_count&&_.over_noise<d.over_noise||_.over_count==d.over_count&&ir.EQ(_.over_noise,d.over_noise)&&_.tot_noise<d.tot_noise;break;case 8:_.max_noise=ae(L,T);case 1:b=_.max_noise<d.max_noise;break;case 2:b=_.tot_noise<d.tot_noise;break;case 3:b=_.tot_noise<d.tot_noise&&_.max_noise<d.max_noise;break;case 4:b=_.max_noise<=0&&d.max_noise>.2||_.max_noise<=0&&d.max_noise<0&&d.max_noise>_.max_noise-.2&&_.tot_noise<d.tot_noise||_.max_noise<=0&&d.max_noise>0&&d.max_noise>_.max_noise-.2&&_.tot_noise<d.tot_noise+d.over_noise||_.max_noise>0&&d.max_noise>-.05&&d.max_noise>_.max_noise-.1&&_.tot_noise+_.over_noise<d.tot_noise+d.over_noise||_.max_noise>0&&d.max_noise>-.1&&d.max_noise>_.max_noise-.15&&_.tot_noise+_.over_noise+_.over_noise<d.tot_noise+d.over_noise+d.over_noise;break;case 5:b=_.over_noise<d.over_noise||ir.EQ(_.over_noise,d.over_noise)&&_.tot_noise<d.tot_noise;break;case 6:b=_.over_noise<d.over_noise||ir.EQ(_.over_noise,d.over_noise)&&(_.max_noise<d.max_noise||ir.EQ(_.max_noise,d.max_noise)&&_.tot_noise<=d.tot_noise);break;case 7:b=_.over_count<d.over_count||_.over_noise<d.over_noise;break}return d.over_count==0&&(b=b&&_.bits<d.bits),b}function V(B,d,_,T,L){var b=B.internal_flags,a;d.scalefac_scale==0?a=1.2968395546510096:a=1.6817928305074292;for(var I=0,v=0;v<d.sfbmax;v++)I<_[v]&&(I=_[v]);var i=b.noise_shaping_amp;switch(i==3&&(L?i=2:i=1),i){case 2:break;case 1:I>1?I=Math.pow(I,.5):I*=.95;break;case 0:default:I>1?I=1:I*=.95;break}for(var o=0,v=0;v<d.sfbmax;v++){var m=d.width[v],r;if(o+=m,!(_[v]<I)){if((b.substep_shaping&2)!=0&&(b.pseudohalf[v]=b.pseudohalf[v]==0?1:0,b.pseudohalf[v]==0&&b.noise_shaping_amp==2))return;for(d.scalefac[v]++,r=-m;r<0;r++)T[o+r]*=a,T[o+r]>d.xrpow_max&&(d.xrpow_max=T[o+r]);if(b.noise_shaping_amp==2)return}}}function e(B,d){for(var _=1.2968395546510096,T=0,L=0;L<B.sfbmax;L++){var b=B.width[L],a=B.scalefac[L];if(B.preflag!=0&&(a+=K.pretab[L]),T+=b,(a&1)!=0){a++;for(var I=-b;I<0;I++)d[T+I]*=_,d[T+I]>B.xrpow_max&&(B.xrpow_max=d[T+I])}B.scalefac[L]=a>>1}B.preflag=0,B.scalefac_scale=1}function E(B,d,_){var T,L=d.scalefac;for(T=0;T<d.sfb_lmax;T++)if(L[T]>=16)return!0;for(var b=0;b<3;b++){var a=0,I=0;for(T=d.sfb_lmax+b;T<d.sfbdivide;T+=3)a<L[T]&&(a=L[T]);for(;T<d.sfbmax;T+=3)I<L[T]&&(I=L[T]);if(!(a<16&&I<8)){if(d.subblock_gain[b]>=7)return!0;d.subblock_gain[b]++;var v=B.scalefac_band.l[d.sfb_lmax];for(T=d.sfb_lmax+b;T<d.sfbmax;T+=3){var i,o=d.width[T],m=L[T];if(Dt(m>=0),m=m-(4>>d.scalefac_scale),m>=0){L[T]=m,v+=o*3;continue}L[T]=0;{var r=210+(m<<d.scalefac_scale+1);i=K.IPOW20(r)}v+=o*(b+1);for(var l=-o;l<0;l++)_[v+l]*=i,_[v+l]>d.xrpow_max&&(d.xrpow_max=_[v+l]);v+=o*(3-b-1)}{var i=K.IPOW20(202);v+=d.width[T]*(b+1);for(var l=-d.width[T];l<0;l++)_[v+l]*=i,_[v+l]>d.xrpow_max&&(d.xrpow_max=_[v+l])}}}return!1}function P(B,d,_,T,L){var b=B.internal_flags;V(B,d,_,T,L);var a=F(d);return a?!1:(b.mode_gr==2?a=ce.scale_bitcount(d):a=ce.scale_bitcount_lsf(b,d),a?(b.noise_shaping>1&&(gr.fill(b.pseudohalf,0),d.scalefac_scale==0?(e(d,T),a=!1):d.block_type==R.SHORT_TYPE&&b.subblock_gain>0&&(a=E(b,d,T)||F(d))),a||(b.mode_gr==2?a=ce.scale_bitcount(d):a=ce.scale_bitcount_lsf(b,d)),!a):!0)}this.outer_loop=function(B,d,_,T,L,b){var a=B.internal_flags,I=new p0,v=jr(576),i=jr(pr.SFBMAX),o=new _a,m,r=new un,l=9999999,f=!1,p=!1,H=0;if(ve(a,d,b,L,T),a.noise_shaping==0)return 100;K.calc_noise(d,_,i,o,r),o.bits=d.part2_3_length,I.assign(d);var g=0;for(cr.arraycopy(T,0,v,0,576);!f;){do{var D=new _a,oe,s=255;if((a.substep_shaping&2)!=0?oe=20:oe=3,a.sfb21_extra&&(i[I.sfbmax]>1||I.block_type==R.SHORT_TYPE&&(i[I.sfbmax+1]>1||i[I.sfbmax+2]>1))||!P(B,I,i,T,p))break;I.scalefac_scale!=0&&(s=254);var u=b-I.part2_length;if(u<=0)break;for(;(I.part2_3_length=ce.count_bits(a,T,I,r))>u&&I.global_gain<=s;)I.global_gain++;if(I.global_gain>s)break;if(o.over_count==0){for(;(I.part2_3_length=ce.count_bits(a,T,I,r))>l&&I.global_gain<=s;)I.global_gain++;if(I.global_gain>s)break}if(K.calc_noise(I,_,i,D,r),D.bits=I.part2_3_length,d.block_type!=R.SHORT_TYPE?m=B.quant_comp:m=B.quant_comp_short,m=A(m,o,D,I,i)?1:0,m!=0)l=d.part2_3_length,o=D,d.assign(I),g=0,cr.arraycopy(T,0,v,0,576);else if(a.full_outer_loop==0&&(++g>oe&&o.over_count==0||a.noise_shaping_amp==3&&p&&g>30||a.noise_shaping_amp==3&&p&&I.global_gain-H>15))break}while(I.global_gain+I.scalefac_scale<255);a.noise_shaping_amp==3?p?f=!0:(I.assign(d),cr.arraycopy(v,0,T,0,576),g=0,H=I.global_gain,p=!0):f=!0}return Dt(d.global_gain+d.scalefac_scale<=255),B.VBR==si.vbr_rh||B.VBR==si.vbr_mtrh?cr.arraycopy(v,0,T,0,576):(a.substep_shaping&1)!=0&&trancate_smallspectrums(a,d,_,T),o.over_count},this.iteration_finish_one=function(B,d,_){var T=B.l3_side,L=T.tt[d][_];ce.best_scalefac_store(B,d,_,T),B.use_best_huffman==1&&ce.best_huffman_divide(B,L),X.ResvAdjust(B,L)},this.VBR_encode_granule=function(B,d,_,T,L,b,a){var I=B.internal_flags,v=new p0,i=jr(576),o=a,m=a+1,r=(a+b)/2,l,f,p=0,H=I.sfb21_extra;Dt(o<=LameInternalFlags.MAX_BITS_PER_CHANNEL),gr.fill(v.l3_enc,0);do Dt(r>=b),Dt(r<=a),Dt(b<=a),r>o-42?I.sfb21_extra=!1:I.sfb21_extra=H,f=outer_loop(B,d,_,T,L,r),f<=0?(p=1,m=d.part2_3_length,v.assign(d),cr.arraycopy(T,0,i,0,576),a=m-32,l=a-b,r=(a+b)/2):(b=r+32,l=a-b,r=(a+b)/2,p!=0&&(p=2,d.assign(v),cr.arraycopy(i,0,T,0,576)));while(l>12);I.sfb21_extra=H,p==2&&cr.arraycopy(v.l3_enc,0,d.l3_enc,0,576),Dt(d.part2_3_length<=o)},this.get_framebits=function(B,d){var _=B.internal_flags;_.bitrate_index=_.VBR_min_bitrate;var T=w.getframebits(B);_.bitrate_index=1,T=w.getframebits(B);for(var L=1;L<=_.VBR_max_bitrate;L++){_.bitrate_index=L;var b=new MeanBits(T);d[L]=X.ResvFrameBegin(B,b),T=b.bits}},this.VBR_old_prepare=function(B,d,_,T,L,b,a,I,v){var i=B.internal_flags,o,m=0,r=1,l=0;i.bitrate_index=i.VBR_max_bitrate;var f=X.ResvFrameBegin(B,new MeanBits(0))/i.mode_gr;get_framebits(B,b);for(var p=0;p<i.mode_gr;p++){var H=K.on_pe(B,d,I[p],f,p,0);i.mode_ext==R.MPG_MD_MS_LR&&(ms_convert(i.l3_side,p),K.reduce_side(I[p],_[p],f,H));for(var g=0;g<i.channels_out;++g){var D=i.l3_side.tt[p][g];D.block_type!=R.SHORT_TYPE?(m=1.28/(1+Math.exp(3.5-d[p][g]/300))-.05,o=i.PSY.mask_adjust-m):(m=2.56/(1+Math.exp(3.5-d[p][g]/300))-.14,o=i.PSY.mask_adjust_short-m),i.masking_lower=Math.pow(10,o*.1),init_outer_loop(i,D),v[p][g]=K.calc_xmin(B,T[p][g],D,L[p][g]),v[p][g]!=0&&(r=0),a[p][g]=126,l+=I[p][g]}}for(var p=0;p<i.mode_gr;p++)for(var g=0;g<i.channels_out;g++)l>b[i.VBR_max_bitrate]&&(I[p][g]*=b[i.VBR_max_bitrate],I[p][g]/=l),a[p][g]>I[p][g]&&(a[p][g]=I[p][g]);return r},this.bitpressure_strategy=function(B,d,_,T){for(var L=0;L<B.mode_gr;L++)for(var b=0;b<B.channels_out;b++){for(var a=B.l3_side.tt[L][b],I=d[L][b],v=0,i=0;i<a.psy_lmax;i++)I[v++]*=1+.029*i*i/R.SBMAX_l/R.SBMAX_l;if(a.block_type==R.SHORT_TYPE)for(var i=a.sfb_smin;i<R.SBMAX_s;i++)I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s,I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s,I[v++]*=1+.029*i*i/R.SBMAX_s/R.SBMAX_s;T[L][b]=0|Math.max(_[L][b],.9*T[L][b])}},this.VBR_new_prepare=function(B,d,_,T,L,b){var a=B.internal_flags,I=1,v=0,i=0,o;if(B.free_format){a.bitrate_index=0;var m=new MeanBits(v);o=X.ResvFrameBegin(B,m),v=m.bits,L[0]=o}else{a.bitrate_index=a.VBR_max_bitrate;var m=new MeanBits(v);X.ResvFrameBegin(B,m),v=m.bits,get_framebits(B,L),o=L[a.VBR_max_bitrate]}for(var r=0;r<a.mode_gr;r++){K.on_pe(B,d,b[r],v,r,0),a.mode_ext==R.MPG_MD_MS_LR&&ms_convert(a.l3_side,r);for(var l=0;l<a.channels_out;++l){var f=a.l3_side.tt[r][l];a.masking_lower=Math.pow(10,a.PSY.mask_adjust*.1),init_outer_loop(a,f),K.calc_xmin(B,_[r][l],f,T[r][l])!=0&&(I=0),i+=b[r][l]}}for(var r=0;r<a.mode_gr;r++)for(var l=0;l<a.channels_out;l++)i>o&&(b[r][l]*=o,b[r][l]/=i);return I},this.calc_target_bits=function(B,d,_,T,L,b){var a=B.internal_flags,I=a.l3_side,v,i,o,m,r=0;a.bitrate_index=a.VBR_max_bitrate;var l=new MeanBits(r);for(b[0]=X.ResvFrameBegin(B,l),r=l.bits,a.bitrate_index=1,r=w.getframebits(B)-a.sideinfo_len*8,L[0]=r/(a.mode_gr*a.channels_out),r=B.VBR_mean_bitrate_kbps*B.framesize*1e3,(a.substep_shaping&1)!=0&&(r*=1.09),r/=B.out_samplerate,r-=a.sideinfo_len*8,r/=a.mode_gr*a.channels_out,v=.93+.07*(11-B.compression_ratio)/(11-5.5),v<.9&&(v=.9),v>1&&(v=1),i=0;i<a.mode_gr;i++){var f=0;for(o=0;o<a.channels_out;o++){if(T[i][o]=int(v*r),d[i][o]>700){var p=int((d[i][o]-700)/1.4),H=I.tt[i][o];T[i][o]=int(v*r),H.block_type==R.SHORT_TYPE&&p<r/2&&(p=r/2),p>r*3/2?p=r*3/2:p<0&&(p=0),T[i][o]+=p}T[i][o]>LameInternalFlags.MAX_BITS_PER_CHANNEL&&(T[i][o]=LameInternalFlags.MAX_BITS_PER_CHANNEL),f+=T[i][o]}if(f>LameInternalFlags.MAX_BITS_PER_GRANULE)for(o=0;o<a.channels_out;++o)T[i][o]*=LameInternalFlags.MAX_BITS_PER_GRANULE,T[i][o]/=f}if(a.mode_ext==R.MPG_MD_MS_LR)for(i=0;i<a.mode_gr;i++)K.reduce_side(T[i],_[i],r*a.channels_out,LameInternalFlags.MAX_BITS_PER_GRANULE);for(m=0,i=0;i<a.mode_gr;i++)for(o=0;o<a.channels_out;o++)T[i][o]>LameInternalFlags.MAX_BITS_PER_CHANNEL&&(T[i][o]=LameInternalFlags.MAX_BITS_PER_CHANNEL),m+=T[i][o];if(m>b[0])for(i=0;i<a.mode_gr;i++)for(o=0;o<a.channels_out;o++)T[i][o]*=b[0],T[i][o]/=m}}var hn=dn,E0=ne.assert;function mn(){var w;this.setModules=function(X){w=X},this.ResvFrameBegin=function(X,K){var z=X.internal_flags,ce,Y=z.l3_side,te=w.getframebits(X);K.bits=(te-z.sideinfo_len*8)/z.mode_gr;var me=8*256*z.mode_gr-8;X.brate>320?ce=8*int(X.brate*1e3/(X.out_samplerate/1152)/8+.5):(ce=8*1440,X.strict_ISO&&(ce=8*int(32e4/(X.out_samplerate/1152)/8+.5))),z.ResvMax=ce-te,z.ResvMax>me&&(z.ResvMax=me),(z.ResvMax<0||X.disable_reservoir)&&(z.ResvMax=0);var ve=K.bits*z.mode_gr+Math.min(z.ResvSize,z.ResvMax);return ve>ce&&(ve=ce),E0(z.ResvMax%8==0),E0(z.ResvMax>=0),Y.resvDrain_pre=0,z.pinfo!=null&&(z.pinfo.mean_bits=K.bits/2,z.pinfo.resvsize=z.ResvSize),ve},this.ResvMaxBits=function(X,K,z,ce){var Y=X.internal_flags,te,me=Y.ResvSize,ve=Y.ResvMax;ce!=0&&(me+=K),(Y.substep_shaping&1)!=0&&(ve*=.9),z.bits=K,me*10>ve*9?(te=me-ve*9/10,z.bits+=te,Y.substep_shaping|=128):(te=0,Y.substep_shaping&=127,!X.disable_reservoir&&(Y.substep_shaping&1)==0&&(z.bits-=.1*K));var F=me<Y.ResvMax*6/10?me:Y.ResvMax*6/10;return F-=te,F<0&&(F=0),F},this.ResvAdjust=function(X,K){X.ResvSize-=K.part2_3_length+K.part2_length},this.ResvFrameEnd=function(X,K){var z,ce=X.l3_side;X.ResvSize+=K*X.mode_gr;var Y=0;ce.resvDrain_post=0,ce.resvDrain_pre=0,(z=X.ResvSize%8)!=0&&(Y+=z),z=X.ResvSize-Y-X.ResvMax,z>0&&(E0(z%8==0),E0(z>=0),Y+=z);{var te=Math.min(ce.main_data_begin*8,Y)/8;ce.resvDrain_pre+=8*te,Y-=8*te,X.ResvSize-=8*te,ce.main_data_begin-=te}ce.resvDrain_post+=Y,X.ResvSize-=Y}}var fn=mn;function vn(){var w="http://www.mp3dev.org/",X=3,K=98,z=4,ce=0,Y=93;this.getLameVersion=function(){return X+"."+K+"."+z},this.getLameShortVersion=function(){return X+"."+K+"."+z},this.getLameVeryShortVersion=function(){return"LAME"+X+"."+K+"r"},this.getPsyVersion=function(){return ce+"."+Y},this.getLameUrl=function(){return w},this.getLameOsBitness=function(){return"32bits"}}var pn=vn,bn=ne.System,da=ne.VbrMode,ni=ne.ShortBlock,Sn=ne.Arrays,w0=ne.new_byte,yn=ne.assert;$r.NUMTOCENTRIES=100,$r.MAXFRAMESIZE=2880;function $r(){var w,X,K;this.setModules=function(r,l,f){w=r,X=l,K=f};var z=1,ce=2,Y=4,te=8,me=$r.NUMTOCENTRIES,ve=$r.MAXFRAMESIZE,F=me+4+4+4+4+4,J=F+9+1+1+8+1+1+3+1+1+2+4+2+2,ae=128,A=64,V=32,e=null,E="Xing",P="Info",B=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];function d(r,l){if(r.nVbrNumFrames++,r.sum+=l,r.seen++,!(r.seen<r.want)&&(r.pos<r.size&&(r.bag[r.pos]=r.sum,r.pos++,r.seen=0),r.pos==r.size)){for(var f=1;f<r.size;f+=2)r.bag[f/2]=r.bag[f];r.want*=2,r.pos/=2}}function _(r,l){if(!(r.pos<=0))for(var f=1;f<me;++f){var p=f/me,H,g,D=0|Math.floor(p*r.pos);D>r.pos-1&&(D=r.pos-1),H=r.bag[D],g=r.sum;var oe=0|256*H/g;oe>255&&(oe=255),l[f]=255&oe}}this.addVbrFrame=function(r){var l=r.internal_flags,f=Tables.bitrate_table[r.version][l.bitrate_index];yn(l.VBR_seek_table.bag!=null),d(l.VBR_seek_table,f)};function T(r,l){var f=r[l+0]&255;return f<<=8,f|=r[l+1]&255,f<<=8,f|=r[l+2]&255,f<<=8,f|=r[l+3]&255,f}function L(r,l,f){r[l+0]=255&(f>>24&255),r[l+1]=255&(f>>16&255),r[l+2]=255&(f>>8&255),r[l+3]=255&(f&255)}function b(r,l,f){r[l+0]=255&(f>>8&255),r[l+1]=255&(f&255)}function a(r,l){return new String(r,l,E.length(),e).equals(E)||new String(r,l,P.length(),e).equals(P)}function I(r,l,f){return 255&(r<<l|f&~(-1<<l))}function v(r,l){var f=r.internal_flags;l[0]=I(l[0],8,255),l[1]=I(l[1],3,7),l[1]=I(l[1],1,r.out_samplerate<16e3?0:1),l[1]=I(l[1],1,r.version),l[1]=I(l[1],2,4-3),l[1]=I(l[1],1,r.error_protection?0:1),l[2]=I(l[2],4,f.bitrate_index),l[2]=I(l[2],2,f.samplerate_index),l[2]=I(l[2],1,0),l[2]=I(l[2],1,r.extension),l[3]=I(l[3],2,r.mode.ordinal()),l[3]=I(l[3],2,f.mode_ext),l[3]=I(l[3],1,r.copyright),l[3]=I(l[3],1,r.original),l[3]=I(l[3],2,r.emphasis),l[0]=255;var p=255&(l[1]&241),H;r.version==1?H=ae:r.out_samplerate<16e3?H=V:H=A,r.VBR==da.vbr_off&&(H=r.brate);var g;r.free_format?g=0:g=255&16*w.BitrateIndex(H,r.version,r.out_samplerate),r.version==1?(l[1]=255&(p|10),p=255&(l[2]&13),l[2]=255&(g|p)):(l[1]=255&(p|2),p=255&(l[2]&13),l[2]=255&(g|p))}this.getVbrTag=function(r){var l=new VBRTagData,f=0;l.flags=0;var p=r[f+1]>>3&1,H=r[f+2]>>2&3,g=r[f+3]>>6&3,D=r[f+2]>>4&15;if(D=Tables.bitrate_table[p][D],r[f+1]>>4==14?l.samprate=Tables.samplerate_table[2][H]:l.samprate=Tables.samplerate_table[p][H],p!=0?g!=3?f+=32+4:f+=17+4:g!=3?f+=17+4:f+=9+4,!a(r,f))return null;f+=4,l.hId=p;var oe=l.flags=T(r,f);if(f+=4,(oe&z)!=0&&(l.frames=T(r,f),f+=4),(oe&ce)!=0&&(l.bytes=T(r,f),f+=4),(oe&Y)!=0){if(l.toc!=null)for(var s=0;s<me;s++)l.toc[s]=r[f+s];f+=me}l.vbrScale=-1,(oe&te)!=0&&(l.vbrScale=T(r,f),f+=4),l.headersize=(p+1)*72e3*D/l.samprate,f+=21;var u=r[f+0]<<4;u+=r[f+1]>>4;var Q=(r[f+1]&15)<<8;return Q+=r[f+2]&255,(u<0||u>3e3)&&(u=-1),(Q<0||Q>3e3)&&(Q=-1),l.encDelay=u,l.encPadding=Q,l},this.InitVbrTag=function(r){var l=r.internal_flags,f;r.version==1?f=ae:r.out_samplerate<16e3?f=V:f=A,r.VBR==da.vbr_off&&(f=r.brate);var p=(r.version+1)*72e3*f/r.out_samplerate,H=l.sideinfo_len+J;if(l.VBR_seek_table.TotalFrameSize=p,p<H||p>ve){r.bWriteVbrTag=!1;return}l.VBR_seek_table.nVbrNumFrames=0,l.VBR_seek_table.nBytesWritten=0,l.VBR_seek_table.sum=0,l.VBR_seek_table.seen=0,l.VBR_seek_table.want=1,l.VBR_seek_table.pos=0,l.VBR_seek_table.bag==null&&(l.VBR_seek_table.bag=new int[400],l.VBR_seek_table.size=400);var g=w0(ve);v(r,g);for(var D=l.VBR_seek_table.TotalFrameSize,oe=0;oe<D;++oe)X.add_dummy_byte(r,g[oe]&255,1)};function i(r,l){var f=l^r;return l=l>>8^B[f&255],l}this.updateMusicCRC=function(r,l,f,p){for(var H=0;H<p;++H)r[0]=i(l[f+H],r[0])};function o(r,l,f,p,H){var g=r.internal_flags,D=0,oe=r.encoder_delay,s=r.encoder_padding,u=100-10*r.VBR_q-r.quality,Q=K.getLameVeryShortVersion(),se,pe=0,Re,Me=[1,5,3,2,4,0,3],Ae=0|(r.lowpassfreq/100+.5>255?255:r.lowpassfreq/100+.5),De=0,Ie=0,Ee=0,Ge=r.internal_flags.noise_shaping,tt=0,We=0,rt=0,lt=0,_t=0,pt=(r.exp_nspsytune&1)!=0,Qt=(r.exp_nspsytune&2)!=0,At=!1,Mt=!1,Ut=r.internal_flags.nogap_total,wr=r.internal_flags.nogap_current,Ar=r.ATHtype,qt=0,Rt;switch(r.VBR){case vbr_abr:Rt=r.VBR_mean_bitrate_kbps;break;case vbr_off:Rt=r.brate;break;default:Rt=r.VBR_min_bitrate_kbps}switch(r.VBR.ordinal()<Me.length?se=Me[r.VBR.ordinal()]:se=0,Re=16*pe+se,g.findReplayGain&&(g.RadioGain>510&&(g.RadioGain=510),g.RadioGain<-510&&(g.RadioGain=-510),Ie=8192,Ie|=3072,g.RadioGain>=0?Ie|=g.RadioGain:(Ie|=512,Ie|=-g.RadioGain)),g.findPeakSample&&(De=Math.abs(0|g.PeakSample/32767*Math.pow(2,23)+.5)),Ut!=-1&&(wr>0&&(Mt=!0),wr<Ut-1&&(At=!0)),qt=Ar+((pt?1:0)<<4)+((Qt?1:0)<<5)+((At?1:0)<<6)+((Mt?1:0)<<7),u<0&&(u=0),r.mode){case MONO:tt=0;break;case STEREO:tt=1;break;case DUAL_CHANNEL:tt=2;break;case JOINT_STEREO:r.force_ms?tt=4:tt=3;break;case NOT_SET:default:tt=7;break}r.in_samplerate<=32e3?rt=0:r.in_samplerate==48e3?rt=2:r.in_samplerate>48e3?rt=3:rt=1,(r.short_blocks==ni.short_block_forced||r.short_blocks==ni.short_block_dispensed||r.lowpassfreq==-1&&r.highpassfreq==-1||r.scale_left<r.scale_right||r.scale_left>r.scale_right||r.disable_reservoir&&r.brate<320||r.noATH||r.ATHonly||Ar==0||r.in_samplerate<=32e3)&&(We=1),lt=Ge+(tt<<2)+(We<<5)+(rt<<6),_t=g.nMusicCRC,L(f,p+D,u),D+=4;for(var _r=0;_r<9;_r++)f[p+D+_r]=255&Q.charAt(_r);D+=9,f[p+D]=255&Re,D++,f[p+D]=255&Ae,D++,L(f,p+D,De),D+=4,b(f,p+D,Ie),D+=2,b(f,p+D,Ee),D+=2,f[p+D]=255&qt,D++,Rt>=255?f[p+D]=255:f[p+D]=255&Rt,D++,f[p+D]=255&oe>>4,f[p+D+1]=255&(oe<<4)+(s>>8),f[p+D+2]=255&s,D+=3,f[p+D]=255&lt,D++,f[p+D++]=0,b(f,p+D,r.preset),D+=2,L(f,p+D,l),D+=4,b(f,p+D,_t),D+=2;for(var Wr=0;Wr<D;Wr++)H=i(f[p+Wr],H);return b(f,p+D,H),D+=2,D}function m(r){r.seek(0);var l=w0(10);r.readFully(l);var f;return new String(l,"ISO-8859-1").startsWith("ID3")?f=0:f=((l[6]&127)<<21|(l[7]&127)<<14|(l[8]&127)<<7|l[9]&127)+l.length,f}this.getLameTagFrame=function(r,l){var f=r.internal_flags;if(!r.bWriteVbrTag||f.Class_ID!=Ze.LAME_ID||f.VBR_seek_table.pos<=0)return 0;if(l.length<f.VBR_seek_table.TotalFrameSize)return f.VBR_seek_table.TotalFrameSize;Sn.fill(l,0,f.VBR_seek_table.TotalFrameSize,0),v(r,l);var p=w0(me);if(r.free_format)for(var H=1;H<me;++H)p[H]=255&255*H/100;else _(f.VBR_seek_table,p);var g=f.sideinfo_len;r.error_protection&&(g-=2),r.VBR==da.vbr_off?(l[g++]=255&P.charAt(0),l[g++]=255&P.charAt(1),l[g++]=255&P.charAt(2),l[g++]=255&P.charAt(3)):(l[g++]=255&E.charAt(0),l[g++]=255&E.charAt(1),l[g++]=255&E.charAt(2),l[g++]=255&E.charAt(3)),L(l,g,z+ce+Y+te),g+=4,L(l,g,f.VBR_seek_table.nVbrNumFrames),g+=4;var D=f.VBR_seek_table.nBytesWritten+f.VBR_seek_table.TotalFrameSize;L(l,g,0|D),g+=4,bn.arraycopy(p,0,l,g,p.length),g+=p.length,r.error_protection&&X.CRC_writeheader(f,l);for(var oe=0,H=0;H<g;H++)oe=i(l[H],oe);return g+=o(r,D,l,g,oe),f.VBR_seek_table.TotalFrameSize},this.putVbrTag=function(r,l){var f=r.internal_flags;if(f.VBR_seek_table.pos<=0||(l.seek(l.length()),l.length()==0))return-1;var p=m(l);l.seek(p);var H=w0(ve),g=getLameTagFrame(r,H);return g>H.length?-1:(g<1||l.write(H,0,g),0)}}var Rn=$r,oi=ne.new_byte,li=ne.assert,Ze=rn,xn=sn,Kr=yt,En=or,wn=hn,An=la,Mn=fn,mt=Ka,ir=lr;function Tn(){var w,X;this.setModules=function(K,z){w=K,X=z}}function Bn(){var w,X,K;this.setModules=function(z,ce,Y){w=z,X=ce,K=Y}}function In(){}function Cn(){var w,X;this.setModules=function(K,z){w=K,X=z}}function On(w,X,K){arguments.length!=3&&(console.error("WARN: Mp3Encoder(channels, samplerate, kbps) not specified"),w=1,X=44100,K=128);var z=new Ze,ce=new Tn,Y=new Kr,te=new ir,me=new xn,ve=new En,F=new wn,J=new Rn,ae=new pn,A=new Cn,V=new Mn,e=new An,E=new Bn,P=new In;z.setModules(Y,te,me,ve,F,J,ae,A,P),te.setModules(Y,P,ae,J),A.setModules(te,ae),me.setModules(z),F.setModules(te,V,ve,e),ve.setModules(e,V,z.enc.psy),V.setModules(te),e.setModules(ve),J.setModules(z,te,ae),ce.setModules(E,P),E.setModules(ae,A,me);var B=z.lame_init();B.num_channels=w,B.in_samplerate=X,B.brate=K,B.mode=mt.STEREO,B.quality=3,B.bWriteVbrTag=!1,B.disable_reservoir=!0,B.write_id3tag_automatic=!1;var d=z.lame_init_params(B);li(d==0);var _=1152,T=0|1.25*_+7200,L=oi(T);this.encodeBuffer=function(b,a){w==1&&(a=b),li(b.length==a.length),b.length>_&&(_=b.length,T=0|1.25*_+7200,L=oi(T));var I=z.lame_encode_buffer(B,b,a,b.length,L,0,T);return new Int8Array(L.subarray(0,I))},this.flush=function(){var b=z.lame_encode_flush(B,L,0,T);return new Int8Array(L.subarray(0,b))}}function Zt(){this.dataOffset=0,this.dataLen=0,this.channels=0,this.sampleRate=0}function A0(w){return w.charCodeAt(0)<<24|w.charCodeAt(1)<<16|w.charCodeAt(2)<<8|w.charCodeAt(3)}Zt.RIFF=A0("RIFF"),Zt.WAVE=A0("WAVE"),Zt.fmt_=A0("fmt "),Zt.data=A0("data"),Zt.readHeader=function(w){var X=new Zt,K=w.getUint32(0,!1);if(Zt.RIFF==K){var z=w.getUint32(4,!0);if(Zt.WAVE==w.getUint32(8,!1)&&Zt.fmt_==w.getUint32(12,!1)){var ce=w.getUint32(16,!0),Y=16+4;switch(ce){case 16:case 18:X.channels=w.getUint16(Y+2,!0),X.sampleRate=w.getUint32(Y+4,!0);break;default:throw"extended fmt chunk not implemented"}Y+=ce;for(var te=Zt.data,me=0;te!=K&&(K=w.getUint32(Y,!1),me=w.getUint32(Y+4,!0),te!=K);)Y+=me+8;return X.dataLen=me,X.dataOffset=Y+8,X}}};var kn=On,ci=function(w,X){if(!(w instanceof X))throw new TypeError("Cannot call a class as a function")},_i=function(){function w(X,K){for(var z=0;z<K.length;z++){var ce=K[z];ce.enumerable=ce.enumerable||!1,ce.configurable=!0,"value"in ce&&(ce.writable=!0),Object.defineProperty(X,ce.key,ce)}}return function(X,K,z){return K&&w(X.prototype,K),z&&w(X,z),X}}(),gn=function(){function w(X){ci(this,w),this.config={sampleRate:44100,bitRate:128},Object.assign(this.config,X),this.mp3Encoder=new kn(1,this.config.sampleRate,this.config.bitRate),this.maxSamples=1152,this.samplesMono=null,this.clearBuffer()}return _i(w,[{key:"clearBuffer",value:function(){this.dataBuffer=[]}},{key:"appendToBuffer",value:function(K){this.dataBuffer.push(new Int8Array(K))}},{key:"floatTo16BitPCM",value:function(K,z){for(var ce=0;ce<K.length;ce++){var Y=Math.max(-1,Math.min(1,K[ce]));z[ce]=Y<0?Y*32768:Y*32767}}},{key:"convertBuffer",value:function(K){var z=new Float32Array(K),ce=new Int16Array(K.length);return this.floatTo16BitPCM(z,ce),ce}},{key:"encode",value:function(K){this.samplesMono=this.convertBuffer(K);for(var z=this.samplesMono.length,ce=0;z>=0;ce+=this.maxSamples){var Y=this.samplesMono.subarray(ce,ce+this.maxSamples),te=this.mp3Encoder.encodeBuffer(Y);this.appendToBuffer(te),z-=this.maxSamples}}},{key:"finish",value:function(){return this.appendToBuffer(this.mp3Encoder.flush()),this.dataBuffer}}]),w}(),Pn=function(){function w(X){ci(this,w),this.config={bitRate:128,startRecordingAt:300,deviceId:null},this.activeStream=null,this.context=null,this.microphone=null,this.processor=null,this.startTime=0,Object.assign(this.config,X)}return _i(w,[{key:"addMicrophoneListener",value:function(K){var z=this;this.activeStream=K,this.timerToStart=setTimeout(function(){delete z.timerToStart},this.config.startRecordingAt),this.microphone=this.context.createMediaStreamSource(K),this.processor=this.context.createScriptProcessor(0,1,1),this.processor.onaudioprocess=function(ce){z.timerToStart||z.lameEncoder.encode(ce.inputBuffer.getChannelData(0))},this.microphone.connect(this.processor),this.processor.connect(this.context.destination)}},{key:"stop",value:function(){return this.processor&&this.microphone&&(this.microphone.disconnect(),this.processor.disconnect(),this.context&&this.context.state!=="closed"&&this.context.close(),this.processor.onaudioprocess=null,this.activeStream.getAudioTracks().forEach(function(K){return K.stop()})),this}},{key:"start",value:function(){var K=this,z=window.AudioContext||window.webkitAudioContext;this.context=new z,this.config.sampleRate=this.context.sampleRate,this.lameEncoder=new gn(this.config);var ce=this.config.deviceId?{deviceId:{exact:this.config.deviceId}}:!0;return new Promise(function(Y,te){navigator.mediaDevices.getUserMedia({audio:ce}).then(function(me){K.addMicrophoneListener(me),Y(me)}).catch(function(me){te(me)})})}},{key:"getMp3",value:function(){var K=this,z=this.lameEncoder.finish();return new Promise(function(ce,Y){z.length===0?Y(new Error("No buffer to send")):(ce([z,new Blob(z,{type:"audio/mp3"})]),K.lameEncoder.clearBuffer())})}}]),w}();return Pn})});async function B0(){try{let c={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(c)).getTracks().forEach(n=>{n.stop()}),!0}catch{return!1}}async function I0(){return new Promise((c,t)=>{let n=window.screen.isExtended;if(n)c(n);else{let h=[];window.getScreenDetails().then(function(x){h=x,c(h.screens.length>=2)})}})}async function Yt(){let c=["OBS","ManyCam","Snap Camera","Virtual"],n=(await navigator.mediaDevices.enumerateDevices()).filter(x=>!c.some(C=>x.deviceId.includes(C)||x.label.includes(C)));return{cameras:n.filter(x=>x.kind=="videoinput"&&x.deviceId).map(x=>({label:x.label||"Generic Device",id:x.deviceId})),microphones:n.filter(x=>x.kind=="audioinput"&&x.deviceId).map(x=>({label:x.label||"Generic Device",id:x.deviceId}))}}var C0=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var Ra,yi=c=>(Ra=c,Ra),Gt={START:"start",FINISH:"finish",ERROR:"error",UPLOAD_VIDEO:"upload_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",BROWSER_NOT_SUPPORTED:"browser_not_supported"},jt=(c,t)=>Ra.log(c,t),et={registerStart:(c,t,n)=>jt(Gt.START,{proctoringId:c,success:t,description:n}),registerFinish:(c,t,n)=>jt(Gt.FINISH,{proctoringId:c,success:t,description:n}),registerError:(c,t)=>jt(Gt.ERROR,{proctoringId:c,description:t}),registerBrowserNotSupported:(c,t)=>jt(Gt.BROWSER_NOT_SUPPORTED,{proctoringId:c,description:t}),registerUpload:(c,t,n,h,x)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,success:t,description:n,serviceType:h,uploadTime:x}),registerUploadFile:(c,t,n)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t,fileType:n}),registerChangeDevice:(c,t,n)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,inOrOut:t,devicesChanged:n}),registerStopSharingScreen:(c,t)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t}),registerErrorRecorderRTC:(c,t)=>jt(Gt.UPLOAD_VIDEO,{proctoringId:c,description:t}),registerOnBufferSizeError:(c,t)=>jt(Gt.BUFFER_SIZE,{proctoringId:c,description:t}),registerAnotherStream:(c,t)=>jt(Gt.ANOTHER_STREAM,{proctoringId:c,description:t})};function t0(c,t,n,h=!1,x,C=!1){let O,W=!1,be,le,ye={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};C&&(ye={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let fe=new MediaRecorder(c,ye);fe.ondataavailable=ne=>{t.push(ne.data),W?(ne.data.size>0,C&&fe.state=="inactive"&&(t=[new Blob(t,{type:"audio/mpeg-3"})]),O&&O()):((le&&ne.data.size===le.data.size||ne.data.size===0)&&(x&&x(),n&&le&&ne.data.size===le.data.size&&et.registerOnBufferSizeError(n,`onBufferSizeError: Recorder size freezed: ${ne.data.size} Mb`),n&&ne.data.size===0&&et.registerOnBufferSizeError(n,"onBufferSizeError: Recorder size equal 0 Mb")),le=ne)};function Ne(){return new Promise(ne=>{O=ne,fe.start(),W=!1,h&&(be=setInterval(async()=>{await fe.requestData()},3e4))})}function Oe(){return new Promise(ne=>{fe.state=="recording"?(O=ne,fe.stop(),W=!0,clearInterval(be),c.getTracks().forEach(je=>{je.stop()})):ne()})}function Se(){return new Promise(ne=>{fe.state=="recording"&&fe.pause(),ne()})}function ge(){return new Promise(ne=>{fe.state=="paused"&&fe.resume(),ne()})}return{startRecording:Ne,stopRecording:Oe,pauseRecording:Se,resumeRecording:ge}}function r0(c,t){return function(){return c.apply(t,arguments)}}var{toString:Dn}=Object.prototype,{getPrototypeOf:wa}=Object,k0=(c=>t=>{let n=Dn.call(t);return c[n]||(c[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),er=c=>(c=c.toLowerCase(),t=>k0(t)===c),g0=c=>t=>typeof t===c,{isArray:Lr}=Array,a0=g0("undefined");function Fn(c){return c!==null&&!a0(c)&&c.constructor!==null&&!a0(c.constructor)&&Ft(c.constructor.isBuffer)&&c.constructor.isBuffer(c)}var Ei=er("ArrayBuffer");function Hn(c){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(c):t=c&&c.buffer&&Ei(c.buffer),t}var Vn=g0("string"),Ft=g0("function"),wi=g0("number"),P0=c=>c!==null&&typeof c=="object",Un=c=>c===!0||c===!1,O0=c=>{if(k0(c)!=="object")return!1;let t=wa(c);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in c)&&!(Symbol.iterator in c)},qn=er("Date"),Xn=er("File"),zn=er("Blob"),Yn=er("FileList"),Gn=c=>P0(c)&&Ft(c.pipe),jn=c=>{let t;return c&&(typeof FormData=="function"&&c instanceof FormData||Ft(c.append)&&((t=k0(c))==="formdata"||t==="object"&&Ft(c.toString)&&c.toString()==="[object FormData]"))},$n=er("URLSearchParams"),Kn=c=>c.trim?c.trim():c.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function i0(c,t,{allOwnKeys:n=!1}={}){if(c===null||typeof c>"u")return;let h,x;if(typeof c!="object"&&(c=[c]),Lr(c))for(h=0,x=c.length;h<x;h++)t.call(null,c[h],h,c);else{let C=n?Object.getOwnPropertyNames(c):Object.keys(c),O=C.length,W;for(h=0;h<O;h++)W=C[h],t.call(null,c[W],W,c)}}function Ai(c,t){t=t.toLowerCase();let n=Object.keys(c),h=n.length,x;for(;h-- >0;)if(x=n[h],t===x.toLowerCase())return x;return null}var Mi=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Ti=c=>!a0(c)&&c!==Mi;function Ea(){let{caseless:c}=Ti(this)&&this||{},t={},n=(h,x)=>{let C=c&&Ai(t,x)||x;O0(t[C])&&O0(h)?t[C]=Ea(t[C],h):O0(h)?t[C]=Ea({},h):Lr(h)?t[C]=h.slice():t[C]=h};for(let h=0,x=arguments.length;h<x;h++)arguments[h]&&i0(arguments[h],n);return t}var Wn=(c,t,n,{allOwnKeys:h}={})=>(i0(t,(x,C)=>{n&&Ft(x)?c[C]=r0(x,n):c[C]=x},{allOwnKeys:h}),c),Zn=c=>(c.charCodeAt(0)===65279&&(c=c.slice(1)),c),Qn=(c,t,n,h)=>{c.prototype=Object.create(t.prototype,h),c.prototype.constructor=c,Object.defineProperty(c,"super",{value:t.prototype}),n&&Object.assign(c.prototype,n)},Jn=(c,t,n,h)=>{let x,C,O,W={};if(t=t||{},c==null)return t;do{for(x=Object.getOwnPropertyNames(c),C=x.length;C-- >0;)O=x[C],(!h||h(O,c,t))&&!W[O]&&(t[O]=c[O],W[O]=!0);c=n!==!1&&wa(c)}while(c&&(!n||n(c,t))&&c!==Object.prototype);return t},eo=(c,t,n)=>{c=String(c),(n===void 0||n>c.length)&&(n=c.length),n-=t.length;let h=c.indexOf(t,n);return h!==-1&&h===n},to=c=>{if(!c)return null;if(Lr(c))return c;let t=c.length;if(!wi(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=c[t];return n},ro=(c=>t=>c&&t instanceof c)(typeof Uint8Array<"u"&&wa(Uint8Array)),ao=(c,t)=>{let h=(c&&c[Symbol.iterator]).call(c),x;for(;(x=h.next())&&!x.done;){let C=x.value;t.call(c,C[0],C[1])}},io=(c,t)=>{let n,h=[];for(;(n=c.exec(t))!==null;)h.push(n);return h},so=er("HTMLFormElement"),no=c=>c.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,h,x){return h.toUpperCase()+x}),Ri=(({hasOwnProperty:c})=>(t,n)=>c.call(t,n))(Object.prototype),oo=er("RegExp"),Bi=(c,t)=>{let n=Object.getOwnPropertyDescriptors(c),h={};i0(n,(x,C)=>{let O;(O=t(x,C,c))!==!1&&(h[C]=O||x)}),Object.defineProperties(c,h)},lo=c=>{Bi(c,(t,n)=>{if(Ft(c)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let h=c[n];if(!!Ft(h)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},co=(c,t)=>{let n={},h=x=>{x.forEach(C=>{n[C]=!0})};return Lr(c)?h(c):h(String(c).split(t)),n},_o=()=>{},uo=(c,t)=>(c=+c,Number.isFinite(c)?c:t),xa="abcdefghijklmnopqrstuvwxyz",xi="0123456789",Ii={DIGIT:xi,ALPHA:xa,ALPHA_DIGIT:xa+xa.toUpperCase()+xi},ho=(c=16,t=Ii.ALPHA_DIGIT)=>{let n="",{length:h}=t;for(;c--;)n+=t[Math.random()*h|0];return n};function mo(c){return!!(c&&Ft(c.append)&&c[Symbol.toStringTag]==="FormData"&&c[Symbol.iterator])}var fo=c=>{let t=new Array(10),n=(h,x)=>{if(P0(h)){if(t.indexOf(h)>=0)return;if(!("toJSON"in h)){t[x]=h;let C=Lr(h)?[]:{};return i0(h,(O,W)=>{let be=n(O,x+1);!a0(be)&&(C[W]=be)}),t[x]=void 0,C}}return h};return n(c,0)},vo=er("AsyncFunction"),po=c=>c&&(P0(c)||Ft(c))&&Ft(c.then)&&Ft(c.catch),ie={isArray:Lr,isArrayBuffer:Ei,isBuffer:Fn,isFormData:jn,isArrayBufferView:Hn,isString:Vn,isNumber:wi,isBoolean:Un,isObject:P0,isPlainObject:O0,isUndefined:a0,isDate:qn,isFile:Xn,isBlob:zn,isRegExp:oo,isFunction:Ft,isStream:Gn,isURLSearchParams:$n,isTypedArray:ro,isFileList:Yn,forEach:i0,merge:Ea,extend:Wn,trim:Kn,stripBOM:Zn,inherits:Qn,toFlatObject:Jn,kindOf:k0,kindOfTest:er,endsWith:eo,toArray:to,forEachEntry:ao,matchAll:io,isHTMLForm:so,hasOwnProperty:Ri,hasOwnProp:Ri,reduceDescriptors:Bi,freezeMethods:lo,toObjectSet:co,toCamelCase:no,noop:_o,toFiniteNumber:uo,findKey:Ai,global:Mi,isContextDefined:Ti,ALPHABET:Ii,generateString:ho,isSpecCompliantForm:mo,toJSONObject:fo,isAsyncFn:vo,isThenable:po};function Dr(c,t,n,h,x){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=c,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),h&&(this.request=h),x&&(this.response=x)}ie.inherits(Dr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ci=Dr.prototype,Oi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(c=>{Oi[c]={value:c}});Object.defineProperties(Dr,Oi);Object.defineProperty(Ci,"isAxiosError",{value:!0});Dr.from=(c,t,n,h,x,C)=>{let O=Object.create(Ci);return ie.toFlatObject(c,O,function(be){return be!==Error.prototype},W=>W!=="isAxiosError"),Dr.call(O,c.message,t,n,h,x),O.cause=c,O.name=c.name,C&&Object.assign(O,C),O};var Ye=Dr;var N0=null;function Aa(c){return ie.isPlainObject(c)||ie.isArray(c)}function gi(c){return ie.endsWith(c,"[]")?c.slice(0,-2):c}function ki(c,t,n){return c?c.concat(t).map(function(x,C){return x=gi(x),!n&&C?"["+x+"]":x}).join(n?".":""):t}function bo(c){return ie.isArray(c)&&!c.some(Aa)}var So=ie.toFlatObject(ie,{},null,function(t){return/^is[A-Z]/.test(t)});function yo(c,t,n){if(!ie.isObject(c))throw new TypeError("target must be an object");t=t||new(N0||FormData),n=ie.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(ge,ne){return!ie.isUndefined(ne[ge])});let h=n.metaTokens,x=n.visitor||ye,C=n.dots,O=n.indexes,be=(n.Blob||typeof Blob<"u"&&Blob)&&ie.isSpecCompliantForm(t);if(!ie.isFunction(x))throw new TypeError("visitor must be a function");function le(Se){if(Se===null)return"";if(ie.isDate(Se))return Se.toISOString();if(!be&&ie.isBlob(Se))throw new Ye("Blob is not supported. Use a Buffer instead.");return ie.isArrayBuffer(Se)||ie.isTypedArray(Se)?be&&typeof Blob=="function"?new Blob([Se]):Buffer.from(Se):Se}function ye(Se,ge,ne){let je=Se;if(Se&&!ne&&typeof Se=="object"){if(ie.endsWith(ge,"{}"))ge=h?ge:ge.slice(0,-2),Se=JSON.stringify(Se);else if(ie.isArray(Se)&&bo(Se)||(ie.isFileList(Se)||ie.endsWith(ge,"[]"))&&(je=ie.toArray(Se)))return ge=gi(ge),je.forEach(function(Ke,ct){!(ie.isUndefined(Ke)||Ke===null)&&t.append(O===!0?ki([ge],ct,C):O===null?ge:ge+"[]",le(Ke))}),!1}return Aa(Se)?!0:(t.append(ki(ne,ge,C),le(Se)),!1)}let fe=[],Ne=Object.assign(So,{defaultVisitor:ye,convertValue:le,isVisitable:Aa});function Oe(Se,ge){if(!ie.isUndefined(Se)){if(fe.indexOf(Se)!==-1)throw Error("Circular reference detected in "+ge.join("."));fe.push(Se),ie.forEach(Se,function(je,Fe){(!(ie.isUndefined(je)||je===null)&&x.call(t,je,ie.isString(Fe)?Fe.trim():Fe,ge,Ne))===!0&&Oe(je,ge?ge.concat(Fe):[Fe])}),fe.pop()}}if(!ie.isObject(c))throw new TypeError("data must be an object");return Oe(c),t}var dr=yo;function Pi(c){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(c).replace(/[!'()~]|%20|%00/g,function(h){return t[h]})}function Ni(c,t){this._pairs=[],c&&dr(c,this,t)}var Li=Ni.prototype;Li.append=function(t,n){this._pairs.push([t,n])};Li.toString=function(t){let n=t?function(h){return t.call(this,h,Pi)}:Pi;return this._pairs.map(function(x){return n(x[0])+"="+n(x[1])},"").join("&")};var L0=Ni;function Ro(c){return encodeURIComponent(c).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s0(c,t,n){if(!t)return c;let h=n&&n.encode||Ro,x=n&&n.serialize,C;if(x?C=x(t,n):C=ie.isURLSearchParams(t)?t.toString():new L0(t,n).toString(h),C){let O=c.indexOf("#");O!==-1&&(c=c.slice(0,O)),c+=(c.indexOf("?")===-1?"?":"&")+C}return c}var Ma=class{constructor(){this.handlers=[]}use(t,n,h){return this.handlers.push({fulfilled:t,rejected:n,synchronous:h?h.synchronous:!1,runWhen:h?h.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ie.forEach(this.handlers,function(h){h!==null&&t(h)})}},Ta=Ma;var D0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Di=typeof URLSearchParams<"u"?URLSearchParams:L0;var Fi=typeof FormData<"u"?FormData:null;var Hi=typeof Blob<"u"?Blob:null;var xo=(()=>{let c;return typeof navigator<"u"&&((c=navigator.product)==="ReactNative"||c==="NativeScript"||c==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Eo=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),bt={isBrowser:!0,classes:{URLSearchParams:Di,FormData:Fi,Blob:Hi},isStandardBrowserEnv:xo,isStandardBrowserWebWorkerEnv:Eo,protocols:["http","https","file","blob","url","data"]};function Ba(c,t){return dr(c,new bt.classes.URLSearchParams,Object.assign({visitor:function(n,h,x,C){return bt.isNode&&ie.isBuffer(n)?(this.append(h,n.toString("base64")),!1):C.defaultVisitor.apply(this,arguments)}},t))}function wo(c){return ie.matchAll(/\w+|\[(\w*)]/g,c).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ao(c){let t={},n=Object.keys(c),h,x=n.length,C;for(h=0;h<x;h++)C=n[h],t[C]=c[C];return t}function Mo(c){function t(n,h,x,C){let O=n[C++],W=Number.isFinite(+O),be=C>=n.length;return O=!O&&ie.isArray(x)?x.length:O,be?(ie.hasOwnProp(x,O)?x[O]=[x[O],h]:x[O]=h,!W):((!x[O]||!ie.isObject(x[O]))&&(x[O]=[]),t(n,h,x[O],C)&&ie.isArray(x[O])&&(x[O]=Ao(x[O])),!W)}if(ie.isFormData(c)&&ie.isFunction(c.entries)){let n={};return ie.forEachEntry(c,(h,x)=>{t(wo(h),x,n,0)}),n}return null}var F0=Mo;function To(c,t,n){if(ie.isString(c))try{return(t||JSON.parse)(c),ie.trim(c)}catch(h){if(h.name!=="SyntaxError")throw h}return(n||JSON.stringify)(c)}var Ia={transitional:D0,adapter:bt.isNode?"http":"xhr",transformRequest:[function(t,n){let h=n.getContentType()||"",x=h.indexOf("application/json")>-1,C=ie.isObject(t);if(C&&ie.isHTMLForm(t)&&(t=new FormData(t)),ie.isFormData(t))return x&&x?JSON.stringify(F0(t)):t;if(ie.isArrayBuffer(t)||ie.isBuffer(t)||ie.isStream(t)||ie.isFile(t)||ie.isBlob(t))return t;if(ie.isArrayBufferView(t))return t.buffer;if(ie.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let W;if(C){if(h.indexOf("application/x-www-form-urlencoded")>-1)return Ba(t,this.formSerializer).toString();if((W=ie.isFileList(t))||h.indexOf("multipart/form-data")>-1){let be=this.env&&this.env.FormData;return dr(W?{"files[]":t}:t,be&&new be,this.formSerializer)}}return C||x?(n.setContentType("application/json",!1),To(t)):t}],transformResponse:[function(t){let n=this.transitional||Ia.transitional,h=n&&n.forcedJSONParsing,x=this.responseType==="json";if(t&&ie.isString(t)&&(h&&!this.responseType||x)){let O=!(n&&n.silentJSONParsing)&&x;try{return JSON.parse(t)}catch(W){if(O)throw W.name==="SyntaxError"?Ye.from(W,Ye.ERR_BAD_RESPONSE,this,null,this.response):W}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bt.classes.FormData,Blob:bt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ie.forEach(["delete","get","head","post","put","patch"],c=>{Ia.headers[c]={}});var Fr=Ia;var Bo=ie.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Vi=c=>{let t={},n,h,x;return c&&c.split(`
15
15
  `).forEach(function(O){x=O.indexOf(":"),n=O.substring(0,x).trim().toLowerCase(),h=O.substring(x+1).trim(),!(!n||t[n]&&Bo[n])&&(n==="set-cookie"?t[n]?t[n].push(h):t[n]=[h]:t[n]=t[n]?t[n]+", "+h:h)}),t};var Ui=Symbol("internals");function n0(c){return c&&String(c).trim().toLowerCase()}function H0(c){return c===!1||c==null?c:ie.isArray(c)?c.map(H0):String(c)}function Io(c){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,h;for(;h=n.exec(c);)t[h[1]]=h[2];return t}var Co=c=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(c.trim());function Ca(c,t,n,h,x){if(ie.isFunction(h))return h.call(this,t,n);if(x&&(t=n),!!ie.isString(t)){if(ie.isString(h))return t.indexOf(h)!==-1;if(ie.isRegExp(h))return h.test(t)}}function Oo(c){return c.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,h)=>n.toUpperCase()+h)}function ko(c,t){let n=ie.toCamelCase(" "+t);["get","set","has"].forEach(h=>{Object.defineProperty(c,h+n,{value:function(x,C,O){return this[h].call(this,t,x,C,O)},configurable:!0})})}var Hr=class{constructor(t){t&&this.set(t)}set(t,n,h){let x=this;function C(W,be,le){let ye=n0(be);if(!ye)throw new Error("header name must be a non-empty string");let fe=ie.findKey(x,ye);(!fe||x[fe]===void 0||le===!0||le===void 0&&x[fe]!==!1)&&(x[fe||be]=H0(W))}let O=(W,be)=>ie.forEach(W,(le,ye)=>C(le,ye,be));return ie.isPlainObject(t)||t instanceof this.constructor?O(t,n):ie.isString(t)&&(t=t.trim())&&!Co(t)?O(Vi(t),n):t!=null&&C(n,t,h),this}get(t,n){if(t=n0(t),t){let h=ie.findKey(this,t);if(h){let x=this[h];if(!n)return x;if(n===!0)return Io(x);if(ie.isFunction(n))return n.call(this,x,h);if(ie.isRegExp(n))return n.exec(x);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=n0(t),t){let h=ie.findKey(this,t);return!!(h&&this[h]!==void 0&&(!n||Ca(this,this[h],h,n)))}return!1}delete(t,n){let h=this,x=!1;function C(O){if(O=n0(O),O){let W=ie.findKey(h,O);W&&(!n||Ca(h,h[W],W,n))&&(delete h[W],x=!0)}}return ie.isArray(t)?t.forEach(C):C(t),x}clear(t){let n=Object.keys(this),h=n.length,x=!1;for(;h--;){let C=n[h];(!t||Ca(this,this[C],C,t,!0))&&(delete this[C],x=!0)}return x}normalize(t){let n=this,h={};return ie.forEach(this,(x,C)=>{let O=ie.findKey(h,C);if(O){n[O]=H0(x),delete n[C];return}let W=t?Oo(C):String(C).trim();W!==C&&delete n[C],n[W]=H0(x),h[W]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let n=Object.create(null);return ie.forEach(this,(h,x)=>{h!=null&&h!==!1&&(n[x]=t&&ie.isArray(h)?h.join(", "):h)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
16
16
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){let h=new this(t);return n.forEach(x=>h.set(x)),h}static accessor(t){let h=(this[Ui]=this[Ui]={accessors:{}}).accessors,x=this.prototype;function C(O){let W=n0(O);h[W]||(ko(x,O),h[W]=!0)}return ie.isArray(t)?t.forEach(C):C(t),this}};Hr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ie.reduceDescriptors(Hr.prototype,({value:c},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>c,set(h){this[n]=h}}});ie.freezeMethods(Hr);var xt=Hr;function o0(c,t){let n=this||Fr,h=t||n,x=xt.from(h.headers),C=h.data;return ie.forEach(c,function(W){C=W.call(n,C,x.normalize(),t?t.status:void 0)}),x.normalize(),C}function l0(c){return!!(c&&c.__CANCEL__)}function qi(c,t,n){Ye.call(this,c??"canceled",Ye.ERR_CANCELED,t,n),this.name="CanceledError"}ie.inherits(qi,Ye,{__CANCEL__:!0});var hr=qi;function Oa(c,t,n){let h=n.config.validateStatus;!n.status||!h||h(n.status)?c(n):t(new Ye("Request failed with status code "+n.status,[Ye.ERR_BAD_REQUEST,Ye.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}var Xi=bt.isStandardBrowserEnv?function(){return{write:function(n,h,x,C,O,W){let be=[];be.push(n+"="+encodeURIComponent(h)),ie.isNumber(x)&&be.push("expires="+new Date(x).toGMTString()),ie.isString(C)&&be.push("path="+C),ie.isString(O)&&be.push("domain="+O),W===!0&&be.push("secure"),document.cookie=be.join("; ")},read:function(n){let h=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return h?decodeURIComponent(h[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function ka(c){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(c)}function ga(c,t){return t?c.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):c}function c0(c,t){return c&&!ka(t)?ga(c,t):t}var zi=bt.isStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),h;function x(C){let O=C;return t&&(n.setAttribute("href",O),O=n.href),n.setAttribute("href",O),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return h=x(window.location.href),function(O){let W=ie.isString(O)?x(O):O;return W.protocol===h.protocol&&W.host===h.host}}():function(){return function(){return!0}}();function Pa(c){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(c);return t&&t[1]||""}function go(c,t){c=c||10;let n=new Array(c),h=new Array(c),x=0,C=0,O;return t=t!==void 0?t:1e3,function(be){let le=Date.now(),ye=h[C];O||(O=le),n[x]=be,h[x]=le;let fe=C,Ne=0;for(;fe!==x;)Ne+=n[fe++],fe=fe%c;if(x=(x+1)%c,x===C&&(C=(C+1)%c),le-O<t)return;let Oe=ye&&le-ye;return Oe?Math.round(Ne*1e3/Oe):void 0}}var Yi=go;function Gi(c,t){let n=0,h=Yi(50,250);return x=>{let C=x.loaded,O=x.lengthComputable?x.total:void 0,W=C-n,be=h(W),le=C<=O;n=C;let ye={loaded:C,total:O,progress:O?C/O:void 0,bytes:W,rate:be||void 0,estimated:be&&O&&le?(O-C)/be:void 0,event:x};ye[t?"download":"upload"]=!0,c(ye)}}var Po=typeof XMLHttpRequest<"u",ji=Po&&function(c){return new Promise(function(n,h){let x=c.data,C=xt.from(c.headers).normalize(),O=c.responseType,W;function be(){c.cancelToken&&c.cancelToken.unsubscribe(W),c.signal&&c.signal.removeEventListener("abort",W)}ie.isFormData(x)&&(bt.isStandardBrowserEnv||bt.isStandardBrowserWebWorkerEnv?C.setContentType(!1):C.setContentType("multipart/form-data;",!1));let le=new XMLHttpRequest;if(c.auth){let Oe=c.auth.username||"",Se=c.auth.password?unescape(encodeURIComponent(c.auth.password)):"";C.set("Authorization","Basic "+btoa(Oe+":"+Se))}let ye=c0(c.baseURL,c.url);le.open(c.method.toUpperCase(),s0(ye,c.params,c.paramsSerializer),!0),le.timeout=c.timeout;function fe(){if(!le)return;let Oe=xt.from("getAllResponseHeaders"in le&&le.getAllResponseHeaders()),ge={data:!O||O==="text"||O==="json"?le.responseText:le.response,status:le.status,statusText:le.statusText,headers:Oe,config:c,request:le};Oa(function(je){n(je),be()},function(je){h(je),be()},ge),le=null}if("onloadend"in le?le.onloadend=fe:le.onreadystatechange=function(){!le||le.readyState!==4||le.status===0&&!(le.responseURL&&le.responseURL.indexOf("file:")===0)||setTimeout(fe)},le.onabort=function(){!le||(h(new Ye("Request aborted",Ye.ECONNABORTED,c,le)),le=null)},le.onerror=function(){h(new Ye("Network Error",Ye.ERR_NETWORK,c,le)),le=null},le.ontimeout=function(){let Se=c.timeout?"timeout of "+c.timeout+"ms exceeded":"timeout exceeded",ge=c.transitional||D0;c.timeoutErrorMessage&&(Se=c.timeoutErrorMessage),h(new Ye(Se,ge.clarifyTimeoutError?Ye.ETIMEDOUT:Ye.ECONNABORTED,c,le)),le=null},bt.isStandardBrowserEnv){let Oe=(c.withCredentials||zi(ye))&&c.xsrfCookieName&&Xi.read(c.xsrfCookieName);Oe&&C.set(c.xsrfHeaderName,Oe)}x===void 0&&C.setContentType(null),"setRequestHeader"in le&&ie.forEach(C.toJSON(),function(Se,ge){le.setRequestHeader(ge,Se)}),ie.isUndefined(c.withCredentials)||(le.withCredentials=!!c.withCredentials),O&&O!=="json"&&(le.responseType=c.responseType),typeof c.onDownloadProgress=="function"&&le.addEventListener("progress",Gi(c.onDownloadProgress,!0)),typeof c.onUploadProgress=="function"&&le.upload&&le.upload.addEventListener("progress",Gi(c.onUploadProgress)),(c.cancelToken||c.signal)&&(W=Oe=>{!le||(h(!Oe||Oe.type?new hr(null,c,le):Oe),le.abort(),le=null)},c.cancelToken&&c.cancelToken.subscribe(W),c.signal&&(c.signal.aborted?W():c.signal.addEventListener("abort",W)));let Ne=Pa(ye);if(Ne&&bt.protocols.indexOf(Ne)===-1){h(new Ye("Unsupported protocol "+Ne+":",Ye.ERR_BAD_REQUEST,c));return}le.send(x||null)})};var V0={http:N0,xhr:ji};ie.forEach(V0,(c,t)=>{if(c){try{Object.defineProperty(c,"name",{value:t})}catch{}Object.defineProperty(c,"adapterName",{value:t})}});var U0={getAdapter:c=>{c=ie.isArray(c)?c:[c];let{length:t}=c,n,h;for(let x=0;x<t&&(n=c[x],!(h=ie.isString(n)?V0[n.toLowerCase()]:n));x++);if(!h)throw h===!1?new Ye(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(ie.hasOwnProp(V0,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`);if(!ie.isFunction(h))throw new TypeError("adapter is not a function");return h},adapters:V0};function Na(c){if(c.cancelToken&&c.cancelToken.throwIfRequested(),c.signal&&c.signal.aborted)throw new hr(null,c)}function q0(c){return Na(c),c.headers=xt.from(c.headers),c.data=o0.call(c,c.transformRequest),["post","put","patch"].indexOf(c.method)!==-1&&c.headers.setContentType("application/x-www-form-urlencoded",!1),U0.getAdapter(c.adapter||Fr.adapter)(c).then(function(h){return Na(c),h.data=o0.call(c,c.transformResponse,h),h.headers=xt.from(h.headers),h},function(h){return l0(h)||(Na(c),h&&h.response&&(h.response.data=o0.call(c,c.transformResponse,h.response),h.response.headers=xt.from(h.response.headers))),Promise.reject(h)})}var $i=c=>c instanceof xt?c.toJSON():c;function sr(c,t){t=t||{};let n={};function h(le,ye,fe){return ie.isPlainObject(le)&&ie.isPlainObject(ye)?ie.merge.call({caseless:fe},le,ye):ie.isPlainObject(ye)?ie.merge({},ye):ie.isArray(ye)?ye.slice():ye}function x(le,ye,fe){if(ie.isUndefined(ye)){if(!ie.isUndefined(le))return h(void 0,le,fe)}else return h(le,ye,fe)}function C(le,ye){if(!ie.isUndefined(ye))return h(void 0,ye)}function O(le,ye){if(ie.isUndefined(ye)){if(!ie.isUndefined(le))return h(void 0,le)}else return h(void 0,ye)}function W(le,ye,fe){if(fe in t)return h(le,ye);if(fe in c)return h(void 0,le)}let be={url:C,method:C,data:C,baseURL:O,transformRequest:O,transformResponse:O,paramsSerializer:O,timeout:O,timeoutMessage:O,withCredentials:O,adapter:O,responseType:O,xsrfCookieName:O,xsrfHeaderName:O,onUploadProgress:O,onDownloadProgress:O,decompress:O,maxContentLength:O,maxBodyLength:O,beforeRedirect:O,transport:O,httpAgent:O,httpsAgent:O,cancelToken:O,socketPath:O,responseEncoding:O,validateStatus:W,headers:(le,ye)=>x($i(le),$i(ye),!0)};return ie.forEach(Object.keys(Object.assign({},c,t)),function(ye){let fe=be[ye]||x,Ne=fe(c[ye],t[ye],ye);ie.isUndefined(Ne)&&fe!==W||(n[ye]=Ne)}),n}var X0="1.5.0";var La={};["object","boolean","number","function","string","symbol"].forEach((c,t)=>{La[c]=function(h){return typeof h===c||"a"+(t<1?"n ":" ")+c}});var Ki={};La.transitional=function(t,n,h){function x(C,O){return"[Axios v"+X0+"] Transitional option '"+C+"'"+O+(h?". "+h:"")}return(C,O,W)=>{if(t===!1)throw new Ye(x(O," has been removed"+(n?" in "+n:"")),Ye.ERR_DEPRECATED);return n&&!Ki[O]&&(Ki[O]=!0,console.warn(x(O," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(C,O,W):!0}};function No(c,t,n){if(typeof c!="object")throw new Ye("options must be an object",Ye.ERR_BAD_OPTION_VALUE);let h=Object.keys(c),x=h.length;for(;x-- >0;){let C=h[x],O=t[C];if(O){let W=c[C],be=W===void 0||O(W,C,c);if(be!==!0)throw new Ye("option "+C+" must be "+be,Ye.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ye("Unknown option "+C,Ye.ERR_BAD_OPTION)}}var z0={assertOptions:No,validators:La};var mr=z0.validators,Vr=class{constructor(t){this.defaults=t,this.interceptors={request:new Ta,response:new Ta}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=sr(this.defaults,n);let{transitional:h,paramsSerializer:x,headers:C}=n;h!==void 0&&z0.assertOptions(h,{silentJSONParsing:mr.transitional(mr.boolean),forcedJSONParsing:mr.transitional(mr.boolean),clarifyTimeoutError:mr.transitional(mr.boolean)},!1),x!=null&&(ie.isFunction(x)?n.paramsSerializer={serialize:x}:z0.assertOptions(x,{encode:mr.function,serialize:mr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let O=C&&ie.merge(C.common,C[n.method]);C&&ie.forEach(["delete","get","head","post","put","patch","common"],Se=>{delete C[Se]}),n.headers=xt.concat(O,C);let W=[],be=!0;this.interceptors.request.forEach(function(ge){typeof ge.runWhen=="function"&&ge.runWhen(n)===!1||(be=be&&ge.synchronous,W.unshift(ge.fulfilled,ge.rejected))});let le=[];this.interceptors.response.forEach(function(ge){le.push(ge.fulfilled,ge.rejected)});let ye,fe=0,Ne;if(!be){let Se=[q0.bind(this),void 0];for(Se.unshift.apply(Se,W),Se.push.apply(Se,le),Ne=Se.length,ye=Promise.resolve(n);fe<Ne;)ye=ye.then(Se[fe++],Se[fe++]);return ye}Ne=W.length;let Oe=n;for(fe=0;fe<Ne;){let Se=W[fe++],ge=W[fe++];try{Oe=Se(Oe)}catch(ne){ge.call(this,ne);break}}try{ye=q0.call(this,Oe)}catch(Se){return Promise.reject(Se)}for(fe=0,Ne=le.length;fe<Ne;)ye=ye.then(le[fe++],le[fe++]);return ye}getUri(t){t=sr(this.defaults,t);let n=c0(t.baseURL,t.url);return s0(n,t.params,t.paramsSerializer)}};ie.forEach(["delete","get","head","options"],function(t){Vr.prototype[t]=function(n,h){return this.request(sr(h||{},{method:t,url:n,data:(h||{}).data}))}});ie.forEach(["post","put","patch"],function(t){function n(h){return function(C,O,W){return this.request(sr(W||{},{method:t,headers:h?{"Content-Type":"multipart/form-data"}:{},url:C,data:O}))}}Vr.prototype[t]=n(),Vr.prototype[t+"Form"]=n(!0)});var _0=Vr;var u0=class{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(C){n=C});let h=this;this.promise.then(x=>{if(!h._listeners)return;let C=h._listeners.length;for(;C-- >0;)h._listeners[C](x);h._listeners=null}),this.promise.then=x=>{let C,O=new Promise(W=>{h.subscribe(W),C=W}).then(x);return O.cancel=function(){h.unsubscribe(C)},O},t(function(C,O,W){h.reason||(h.reason=new hr(C,O,W),n(h.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new u0(function(x){t=x}),cancel:t}}},Wi=u0;function Da(c){return function(n){return c.apply(null,n)}}function Fa(c){return ie.isObject(c)&&c.isAxiosError===!0}var Ha={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ha).forEach(([c,t])=>{Ha[t]=c});var Zi=Ha;function Qi(c){let t=new _0(c),n=r0(_0.prototype.request,t);return ie.extend(n,_0.prototype,t,{allOwnKeys:!0}),ie.extend(n,t,null,{allOwnKeys:!0}),n.create=function(x){return Qi(sr(c,x))},n}var ft=Qi(Fr);ft.Axios=_0;ft.CanceledError=hr;ft.CancelToken=Wi;ft.isCancel=l0;ft.VERSION=X0;ft.toFormData=dr;ft.AxiosError=Ye;ft.Cancel=ft.CanceledError;ft.all=function(t){return Promise.all(t)};ft.spread=Da;ft.isAxiosError=Fa;ft.mergeConfig=sr;ft.AxiosHeaders=xt;ft.formToJSON=c=>F0(ie.isHTMLForm(c)?new FormData(c):c);ft.getAdapter=U0.getAdapter;ft.HttpStatusCode=Zi;ft.default=ft;var Br=ft;var{Axios:x2,AxiosError:E2,CanceledError:w2,isCancel:A2,CancelToken:M2,VERSION:T2,all:B2,Cancel:I2,isAxiosError:C2,spread:O2,toFormData:k2,AxiosHeaders:g2,HttpStatusCode:P2,formToJSON:N2,getAdapter:L2,mergeConfig:D2}=Br;var Ir=class{constructor(t,n){this.backend=n;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async upload(t,n,h){let{file:x,onProgress:C}=t;try{let O=le=>{let ye=le.loadedBytes/x.size*100;C&&C(Math.round(ye))},W;if(h){if(this.imageBatchNum===this.contImages){let le=[];for(let fe=this.imageBatchNum;fe<this.imageBatchNum+20;fe++)le.push({objectName:`${this.proctoringId}/${this.proctoringId}_${fe+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(n,le)).map(fe=>{this.imageUrlPackage.push(fe)}),this.imageBatchNum+=20}}else W=await this.backend.getSignedUrl(n,x,this.proctoringId);let be=!1;return h?be=await Br.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":x.type,"x-ms-blob-type":"BlockBlob"},data:x,onUploadProgress:le=>{O({loadedBytes:le.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):be=await Br.request({url:W,method:"PUT",headers:{"Content-Type":x.type,"x-ms-blob-type":"BlockBlob"},data:x,onUploadProgress:le=>{O({loadedBytes:le.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:W,uploaded:be}}catch{throw et.registerError(this.proctoringId,`Failed to upload to AWS
17
17
  File name: ${x.name}