PageSourceSearch

https://vrew.ai/try/assets/decoder.worker-BdB5LWGp.js

js vrew.ai collected 2026-10-02 05:04:22 UTC 122,941 bytes, 13 lines download raw bytes

1const m={};(function(){function r(i){if(i=i||[0,97,115,109,1,0,0,0],typeof WebAssembly!="object"||typeof WebAssembly.instantiate!="function")return!1;try{var i=new WebAssembly.Module(new Uint8Array(i));if(i instanceof WebAssembly.Module)return new WebAssembly.Instance(i)instanceof WebAssembly.Instance}catch{}return!1}function e(){try{var i=new WebAssembly.Memory({initial:1,maximum:1,shared:!0});return i.buffer instanceof SharedArrayBuffer}catch{}return!1}var t=typeof process<"u";m.base||(m.base=import.meta.url,m.base=m.base.replace(/\/[^\/]*$/,"")),m.isWebAssemblySupported=r,m.isThreadingSupported=e;function s(i){i=i||{};var c=!i.nowasm&&r(),l=i.yesthreads&&c&&!i.nothreads&&e();return c?l?"thr":"wasm":"asm"}m.target=s,m.VER="0.18.8.0",m.CONFIG="vrew",m.DBG="",m.factories={};var a={};a.NULL=0,a.i64tof64=function(i,c){return!c&&i>=0||c===-1&&i<0?i:c*4294967296+i+(i<0?4294967296:0)},a.f64toi64=function(i){return[~~i,Math.floor(i/4294967296)]},a.i64ToBigInt=function(i,c){var l=new DataView(new ArrayBuffer(8));return l.setInt32(0,i,!0),l.setInt32(4,c,!0),l.getBigInt64(0,!0)},a.bigIntToi64=function(i){var c=new DataView(new ArrayBuffer(8));return c.setBigInt64(0,i,!0),[c.getInt32(0,!0),c.getInt32(4,!0)]},a.ff_channel_layout=function(i){return i.channel_layout?i.channel_layout:i.channels&&i.channels!==1?(1<<i.channels)-1:4},a.ff_channels=function(i){if(i.channels)return i.channels;if(i.channel_layout){for(var c=0,l=i.channel_layout;l;)c+=l&1,l>>=1;return c}else return 1},a.AV_VERSION_INT=function(i,c,l){return i<<16|c<<8|l};function o(i,c){typeof c===void 0&&(c=0);var l=c;i.forEach(function(A){a[A]=l++})}a.AV_TIME_BASE=1e6,a.AV_NOPTS_VALUE_I64=[0,-2147483648],a.AV_NOPTS_VALUE_LO=0,a.AV_NOPTS_VALUE_HI=-2147483648,a.AV_NOPTS_VALUE=a.i64tof64(0,-2147483648),a.AV_OPT_SEARCH_CHILDREN=1,o(["AVMEDIA_TYPE_UNKNOWN","AVMEDIA_TYPE_VIDEO","AVMEDIA_TYPE_AUDIO","AVMEDIA_TYPE_DATA","AVMEDIA_TYPE_SUBTITLE","AVMEDIA_TYPE_ATTACHMENT"],-1),o(["AV_SAMPLE_FMT_NONE","AV_SAMPLE_FMT_U8","AV_SAMPLE_FMT_S16","AV_SAMPLE_FMT_S32","AV_SAMPLE_FMT_FLT","AV_SAMPLE_FMT_DBL","AV_SAMPLE_FMT_U8P","AV_SAMPLE_FMT_S16P","AV_SAMPLE_FMT_S32P","AV_SAMPLE_FMT_FLTP","AV_SAMPLE_FMT_DBLP","AV_SAMPLE_FMT_S64","AV_SAMPLE_FMT_S64P","AV_SAMPLE_FMT_NB"],-1),o(["AV_PIX_FMT_NONE","AV_PIX_FMT_YUV420P","AV_PIX_FMT_YUYV422","AV_PIX_FMT_RGB24","AV_PIX_FMT_BGR24","AV_PIX_FMT_YUV422P","AV_PIX_FMT_YUV444P","AV_PIX_FMT_YUV410P","AV_PIX_FMT_YUV411P","AV_PIX_FMT_GRAY8","AV_PIX_FMT_MONOWHITE","AV_PIX_FMT_MONOBLACK","AV_PIX_FMT_PAL8","AV_PIX_FMT_YUVJ420P","AV_PIX_FMT_YUVJ422P","AV_PIX_FMT_YUVJ444P","AV_PIX_FMT_UYVY422","AV_PIX_FMT_UYYVYY411","AV_PIX_FMT_BGR8","AV_PIX_FMT_BGR4","AV_PIX_FMT_BGR4_BYTE","AV_PIX_FMT_RGB8","AV_PIX_FMT_RGB4","AV_PIX_FMT_RGB4_BYTE","AV_PIX_FMT_NV12","AV_PIX_FMT_NV21","AV_PIX_FMT_ARGB","AV_PIX_FMT_RGBA","AV_PIX_FMT_ABGR","AV_PIX_FMT_BGRA","AV_PIX_FMT_GRAY16BE","AV_PIX_FMT_GRAY16LE","AV_PIX_FMT_YUV440P","AV_PIX_FMT_YUVJ440P","AV_PIX_FMT_YUVA420P","AV_PIX_FMT_RGB48BE","AV_PIX_FMT_RGB48LE","AV_PIX_FMT_RGB565BE","AV_PIX_FMT_RGB565LE","AV_PIX_FMT_RGB555BE","AV_PIX_FMT_RGB555LE","AV_PIX_FMT_BGR565BE","AV_PIX_FMT_BGR565LE","AV_PIX_FMT_BGR555BE","AV_PIX_FMT_BGR555LE"],-1),a.AVCOL_PRI_RESERVED0=0,a.AVCOL_PRI_BT709=1,a.AVCOL_PRI_UNSPECIFIED=2,a.AVCOL_PRI_RESERVED=3,a.AVCOL_PRI_BT470M=4,a.AVCOL_PRI_BT470BG=5,a.AVCOL_PRI_SMPTE170M=6,a.AVCOL_PRI_SMPTE240M=7,a.AVCOL_PRI_FILM=8,a.AVCOL_PRI_BT2020=9,a.AVCOL_PRI_SMPTE428=10,a.AVCOL_PRI_SMPTEST428_1=a.AVCOL_PRI_SMPTE428,a.AVCOL_PRI_SMPTE431=11,a.AVCOL_PRI_SMPTE432=12,a.AVCOL_PRI_EBU3213=22,a.AVCOL_PRI_JEDEC_P22=a.AVCOL_PRI_EBU3213,a.AVCOL_TRC_RESERVED0=0,a.AVCOL_TRC_BT709=1,a.AVCOL_TRC_UNSPECIFIED=2,a.AVCOL_TRC_RESERVED=3,a.AVCOL_TRC_GAMMA22=4,a.AVCOL_TRC_GAMMA28=5,a.AVCOL_TRC_SMPTE170M=6,a.AVCOL_TRC_SMPTE240M=7,a.AVCOL_TRC_LINEAR=8,a.AVCOL_TRC_LOG=9,a.AVCOL_TRC_LOG_SQRT=10,a.AVCOL_TRC_IEC61966_2_4=11,a.AVCOL_TRC_BT1361_ECG=12,a.AVCOL_TRC_IEC61966_2_1=13,a.AVCOL_TRC_BT2020_10=14,a.AVCOL_TRC_BT2020_12=15,a.AVCOL_TRC_SMPTE2084=16,a.AVCOL_TRC_SMPTEST2084=a.AVCOL_TRC_SMPTE2084,a.AVCOL_TRC_SMPTE428=17,a.AVCOL_TRC_SMPTEST428_1=a.AVCOL_TRC_SMPTE428,a.AVCOL_TRC_ARIB_STD_B67=18,a.AVCOL_SPC_RGB=0,a.AVCOL_SPC_BT709=1,a.AVCOL_SPC_UNSPECIFIED=2,a.AVCOL_SPC_RESERVED=3,a.AVCOL_SPC_FCC=4,a.AVCOL_SPC_BT470BG=5,a.AVCOL_SPC_SMPTE170M=6,a.AVCOL_SPC_SMPTE240M=7,a.AVCOL_SPC_YCGCO=8,a.AVCOL_SPC_YCOCG=a.AVCOL_SPC_YCGCO,a.AVCOL_SPC_BT2020_NCL=9,a.AVCOL_SPC_BT2020_CL=10,a.AVCOL_SPC_SMPTE2085=11,a.AVCOL_SPC_CHROMA_DERIVED_NCL=12,a.AVCOL_SPC_CHROMA_DERIVED_CL=13,a.AVCOL_SPC_ICTCP=14,a.AVCOL_RANGE_UNSPECIFIED=0,a.AVCOL_RANGE_MPEG=1,a.AVCOL_RANGE_JPEG=2,a.AVIO_FLAG_READ=1,a.AVIO_FLAG_WRITE=2,a.AVIO_FLAG_READ_WRITE=3,a.AVIO_FLAG_NONBLOCK=8,a.AVIO_FLAG_DIRECT=32768,a.AVFMT_FLAG_NOBUFFER=64,a.AVFMT_FLAG_FLUSH_PACKETS=512,a.AVSEEK_FLAG_BACKWARD=1,a.AVSEEK_FLAG_BYTE=2,a.AVSEEK_FLAG_ANY=4,a.AVSEEK_FLAG_FRAME=8,a.AVDISCARD_NONE=-16,a.AVDISCARD_DEFAULT=0,a.AVDISCARD_NONREF=8,a.AVDISCARD_BIDIR=16,a.AVDISCARD_NONINTRA=24,a.AVDISCARD_NONKEY=32,a.AVDISCARD_ALL=48,a.AV_LOG_QUIET=-8,a.AV_LOG_PANIC=0,a.AV_LOG_FATAL=8,a.AV_LOG_ERROR=16,a.AV_LOG_WARNING=24,a.AV_LOG_INFO=32,a.AV_LOG_VERBOSE=40,a.AV_LOG_DEBUG=48,a.AV_LOG_TRACE=56,a.AV_PKT_FLAG_KEY=1,a.AV_PKT_FLAG_CORRUPT=2,a.AV_PKT_FLAG_DISCARD=4,a.AV_PKT_FLAG_TRUSTED=8,a.AV_PKT_FLAG_DISPOSABLE=16,a.SWS_FAST_BILINEAR=1,a.SWS_BILINEAR=2,a.SWS_BICUBIC=4,a.SWS_X=8,a.SWS_POINT=16,a.SWS_AREA=32,a.SWS_BICUBLIN=64,a.SWS_GAUSS=128,a.SWS_SINC=256,a.SWS_LANCZOS=512,a.SWS_SPLINE=1024,o(["E2BIG","EPERM","EADDRINUSE","EADDRNOTAVAIL","EAFNOSUPPORT","EAGAIN","EALREADY","
1EBADF","EBADMSG","EBUSY","ECANCELED","ECHILD","ECONNABORTED","ECONNREFUSED","ECONNRESET","EDEADLOCK","EDESTADDRREQ","EDOM","EDQUOT","EEXIST","EFAULT","EFBIG","EHOSTUNREACH","EIDRM","EILSEQ","EINPROGRESS","EINTR","EINVAL","EIO","EISCONN","EISDIR","ELOOP","EMFILE","EMLINK","EMSGSIZE","EMULTIHOP","ENAMETOOLONG","ENETDOWN","ENETRESET","ENETUNREACH","ENFILE","ENOBUFS","ENODEV","ENOENT"],1),a.AVERROR_EOF=-541478725,Object.assign(m,a),m.LibAV=function(i){i=i||{};var c=i.base||m.base,l=s(i),A=i.variant||m.variant||"vrew",h=!0;h&&(i.noes6||m.noes6)&&(h=!1);var E=i.toImport||m.toImport||c+"/libav-0.18.8.0-"+A+"."+l+"."+(h?"mjs":"js"),u,T="direct";return l==="thr"?T="threads":!t&&!i.noworker&&typeof Worker<"u"&&(T="worker"),Promise.all([]).then(function(){if(i.factory||m.factory)return i.factory||m.factory;if(m.factories[E])return m.factories[E];if(T!=="worker")return h?import(E).then(function(D){return m.factories[E]=D.default,D.default}):t?m.factories[E]=require(E):typeof importScripts<"u"?(importScripts(E),m.factories[E]=LibAVFactory):new Promise(function(D,y){var P=document.createElement("script");P.src=E,P.addEventListener("load",D),P.addEventListener("error",y),P.async=!0,document.body.appendChild(P)}).then(function(){return m.factories[E]=LibAVFactory})}).then(function(D){return T==="worker"?(u={},u.worker=new Worker(E,{type:h?"module":"classic"}),new Promise(function(y,P){u.worker.onerror=g=>{console.error(g),P(g.error||new Error(g.message))},u.worker.postMessage({config:{variant:i.variant||m.variant,wasmurl:i.wasmurl||m.wasmurl}}),u.on=1,u.handlers={error:[function(g){P(g)},null],onready:[function(){y()},null],onwrite:[function(g){u.onwrite&&u.onwrite.apply(u,g)},null],onread:[function(g){try{var O=null;u.onread&&(O=u.onread.apply(u,g)),O&&O.then&&O.catch&&O.catch(function(S){u.ff_reader_dev_send(g[0],null,{error:S})})}catch(S){u.ff_reader_dev_send(g[0],null,{error:S})}},null],onblockread:[function(g){try{var O=null;u.onblockread&&(O=u.onblockread.apply(u,g)),O&&O.then&&O.catch&&O.catch(function(S){u.ff_block_reader_dev_send(g[0],g[1],null,{error:S})})}catch(S){u.ff_block_reader_dev_send(g[0],g[1],null,{error:S})}},null]},u.c=function(){for(var g=Array.prototype.slice.call(arguments),O=[],S=0;S<g.length;S++)g[S]&&g[S].libavjsTransfer&&O.push.apply(O,g[S].libavjsTransfer);return new Promise(function($,te){var L=u.on++;g=[L].concat(g),u.handlers[L]=[$,te],u.worker.postMessage(g,O)})};function b(g){var O=g.data[0],S=u.handlers[O];S&&(g.data[2]?S[0](g.data[3]):S[1](g.data[3]),typeof O=="number"&&delete u.handlers[O])}u.worker.onmessage=b,u.terminate=function(){u.worker.terminate()}})):T==="threads"?Promise.all([]).then(function(){return D({wasmurl:i.wasmurl||m.wasmurl,variant:i.variant||m.variant})}).then(function(y){u=y;var P=u.libavjs_create_main_thread(),b=u.PThread.pthreads[P],g=1,O={},S=null,$=new Promise(function(L){S=L});u.c=function(){var L=Array.prototype.slice.call(arguments);return new Promise(function(B,re){var le=g++;L=[le].concat(L),O[le]=[B,re],b.postMessage({c:"libavjs_run",a:L})})};var te=b.onmessage;return b.onmessage=function(L){if(L.data&&L.data.c==="libavjs_ret"){var B=L.data.a,re=O[B[0]];re&&(B[2]?re[0](B[3]):re[1](B[3]),delete O[B[0]])}else if(L.data&&L.data.c==="libavjs_wait_reader")if(u.readerDevReady(L.data.fd))b.postMessage({c:"libavjs_wait_reader",fd:L.data.fd});else{var le=u.fdName(L.data.fd),_e=u.ff_reader_dev_waiters[le];_e||(_e=u.ff_reader_dev_waiters[le]=[]),_e.push(function(){b.postMessage({c:"libavjs_wait_reader",fd:L.data.fd})})}else if(L.data&&L.data.c==="libavjs_ready")S();else return te.apply(this,arguments)},u.terminate=function(){u.PThread.unusedWorkers.concat(u.PThread.runningWorkers).forEach(function(L){L.terminate()})},$}):Promise.all([]).then(function(){return D({wasmurl:i.wasmurl||m.wasmurl,variant:i.variant||m.variant})}).then(function(y){u=y,u.worker=!1,u.c=function(P){var b=Array.prototype.slice.call(arguments,1);return new Promise(function(g,O){try{g(u[P].apply(u,b))}catch(S){O(S)}})},u.terminate=function(){}})}).then(function(){function D(g){g.forEach(function(O){u[O]=function(){return u.c.apply(u,[O].concat(Array.prototype.slice.call(arguments)))}})}function y(g){g.forEach(function(O){var S=u[O+"_sync"]=u[O];u[O]=function(){var $=arguments;return new Promise(function(te,L){try{var B=S.apply(u,$);typeof B=="object"&&B!==null&&B.then?B.then(te).catch(L):te(B)}catch(re){L(re)}})}})}var P=["calloc","close","dup2","free","malloc","mallinfo_uordblks","open","strerror","libavjs_create_main_thread","libavjs_with_
1swscale","ff_malloc_int32_list","ff_malloc_int64_list","av_compare_ts_js","av_dict_copy_js","av_dict_free","av_dict_set_js","av_log_get_level","av_log_set_level","av_opt_set","av_opt_set_int_list_js","av_strdup","ff_error","ff_nothing","LIBAVUTIL_VERSION_INT","av_dict_free_js","sws_getContext","sws_freeContext","sws_scale_frame","av_find_best_stream","av_find_input_format","avformat_alloc_context","avformat_alloc_output_context2_js","avformat_close_input","avformat_find_stream_info","avformat_flush","avformat_free_context","avformat_new_stream","avformat_open_input","avformat_open_input_js","avformat_seek_file","avformat_seek_file_min","avformat_seek_file_max","avformat_seek_file_approx","avformat_write_header","avformat_get_rotation","av_interleaved_write_frame","avio_open2_js","avio_close","avio_flush","av_read_frame","av_seek_frame","av_write_frame","av_write_trailer","avstream_get_frame_rate","avstream_get_sample_aspect_ratio_num","avstream_get_sample_aspect_ratio_den","ff_get_media_duration","ff_get_timecode","ff_get_input_format_name","ff_get_major_brand","ff_slice_audio","ff_extract_audio","ff_convert_audio_to_mp3","convert_to_hls","LIBAVFORMAT_VERSION_INT","ff_init_muxer","ff_free_muxer","ff_init_demuxer_file","ff_write_multi","ff_read_frame_multi","ff_read_multi","AVFormatContext_duration","AVFormatContext_duration_s","AVFormatContext_durationhi","AVFormatContext_durationhi_s","AVFormatContext_flags","AVFormatContext_flags_s","AVFormatContext_nb_streams","AVFormatContext_nb_streams_s","AVFormatContext_oformat","AVFormatContext_oformat_s","AVFormatContext_pb","AVFormatContext_pb_s","AVFormatContext_start_time","AVFormatContext_start_time_s","AVFormatContext_start_timehi","AVFormatContext_start_timehi_s","AVFormatContext_streams_a","AVFormatContext_streams_a_s","AVStream_codecpar","AVStream_codecpar_s","AVStream_discard","AVStream_discard_s","AVStream_duration","AVStream_duration_s","AVStream_durationhi","AVStream_durationhi_s","AVStream_start_time","AVStream_start_time_s","AVStream_start_timehi","AVStream_start_timehi_s","AVStream_time_base_num","AVStream_time_base_den","AVStream_time_base_num_s","AVStream_time_base_den_s","AVStream_time_base_s","avformat_close_input_js","avcodec_descriptor_get","avcodec_descriptor_get_by_name","avcodec_descriptor_next","av_grow_packet","av_packet_alloc","av_packet_clone","av_packet_free","av_packet_make_writable","av_packet_new_side_data","av_packet_ref","av_packet_rescale_ts_js","AVPacketSideData_data","AVPacketSideData_size","AVPacketSideData_type","av_packet_unref","av_shrink_packet","ff_codecpar_new_side_data","av_channel_layout_default_mask","LIBAVCODEC_VERSION_INT","ff_set_packet","ff_copyout_packet","ff_copyout_packet_ptr","ff_copyin_packet","AVCodecDescriptor_id","AVCodecDescriptor_id_s","AVCodecDescriptor_long_name","AVCodecDescriptor_mime_types_a","AVCodecDescriptor_mime_types_a_s","AVCodecDescriptor_name","AVCodecDescriptor_props","AVCodecDescriptor_props_s","AVCodecDescriptor_type","AVCodecDescriptor_type_s","AVCodecParameters_bit_rate","AVCodecParameters_bit_rate_s","AVCodecParameters_channel_layoutmask","AVCodecParameters_channel_layoutmask_s","AVCodecParameters_channels","AVCodecParameters_channels_s","AVCodecParameters_ch_layout_nb_channels","AVCodecParameters_ch_layout_nb_channels_s","AVCodecParameters_chroma_location","AVCodecParameters_chroma_location_s","AVCodecParameters_codec_id","AVCodecParameters_codec_id_s","AVCodecParameters_codec_tag","AVCodecParameters_codec_tag_s","AVCodecParameters_codec_type","AVCodecParameters_codec_type_s","AVCodecParameters_coded_side_data","AVCodecParameters_coded_side_data_s","AVCodecParameters_color_primaries","AVCodecParameters_color_primaries_s","AVCodecParameters_color_range","AVCodecParameters_color_range_s","AVCodecParameters_color_space","AVCodecParameters_color_space_s","AVCodecParameters_color_trc","AVCodecParameters_color_trc_s","AVCodecParameters_extradata","AVCodecParameters_extradata_s","AVCodecParameters_extradata_size","AVCodecParameters_extradata_size_s","AVCodecParameters_format","AVCodecParameters_format_s","AVCodecParameters_framerate_num","AVCodecParameters_framerate_den","AVCodecParameters_framerate_num_s","AVCodecParameters_framerate_den_s","AVCodecParameters_framerate_s","AVCodecParameters_height","AVCodecParameters_height_s","AVCodecParameters_level","AVCodecParameters_level_s","AVCodecParameters_nb_coded_side_data","AVCodecParameters_nb_coded_side_data_s","AVCodecParameters_profile","AVCodecParameters_profile_s","AVCodecParameters_sample_rate","AVCodecParameters_sample_rate_s","AVCodecParameters_width","AVCodecParameters_width_s","AVCodecParameters_block_align","AVCodecParameters_block_align_s","AVCodecParameters_frame_size","AVCodecParameters_frame_size_s","AVCodecParameters_initial_padding","AVCodecParameters_initial_padding_s","AVCodecParameters_trailing_padding","AVCodecParameters_trailing_padding_s","AVCodecParameters_seek_preroll","AVCodecParameters_seek_preroll_s","AVPacket_data","AVPacket_data_s","AVPacket_dts","AVPacket_dts_s","AVPacket_dtshi","AVPacket_dtshi_s","AVPacket_duration","AVPacket_duration_s","AVPacket_durationhi","AVPacket_durationhi_s","AVPacket_flags","AVPacket_flags_s","AVPacket_pos","AVPacket_pos_s","AVPacket_poshi","AVPacket_poshi_s","AVPacket_pts","AVPacket_pts_s","AVPacket_ptshi","AVPacket_ptshi_s","AVPacket_side_data","AVPacket_side_data_s","AVPacket_side_data_elems","AVPacket_side_data_elems_s","AVPacket_size","AVPacket_size_s","AVPacket_stream_index","AVPacket_stream_index_s","AVPacket_time_base_num","AVPacket_time_base_den","AVPacket_time_base_num_s","AVPacket_time_base_den_s","AVPacket_time_base_s","av_packet_free_js","avcodec_parameters_free_js","avcodec_alloc_context3","avcodec_find_decoder","avcodec_find_decoder_by_name","avcodec_find_encoder","avcodec_find_encoder_by_name","avcodec_flush_buffers","avcodec_free_context","avcodec_get_name","avcodec_open2","avcodec_open2_js","avcodec_parameters_alloc","avcodec_parameters_copy","avcodec_parameters_free","avcodec_parameters_from_context","avcodec_parameters_to_context","avcodec_receive_frame","avcodec_receive_packet","avcodec_send_frame","avcodec_send_packet","ff_get_colorspace_name","ff_get_pix_fmt_name","ff_get_color_range_name","ff_init_encoder","ff_init_decoder","ff_free_encoder","ff_free_decoder","ff_encode_multi","ff_decode_multi","ff_copyout_codecpar","ff_copyin_codecpar","AVCodec_name","AVCodec_sample_fmts","AVCodec_sample_fmts_s","AVCodec_sample_fmts_a","AVCodec_sample_fmts_a_s","AVCodec_supported_samplerates","AVCodec_supported_samplerates_s","AVCodec_supported_samplerates_a","AVCodec_supported_samplerates_a_s","AVCodec_type","AVCodec_type_s","AVCodecContext_codec_id","AVCodecContext_codec_id_s","AVCodecContext_codec_type","AVCodecContext_codec_type_s","AVCodecContext_bit_rate","AVCodecContext_bit_rate_s","AVCodecContext_bit_ratehi","AVCodecContext_bit_ratehi_s","AVCodecContext_channel_layout","AVCodecContext_channel_layout_s","AVCodecContext_channel_layouthi","AVCodecContext_channel_layouthi_s","AVCodecContext_channels","AVCodecContext_channels_s","AVCodecContext_channel_layoutmask","AVCodecContext_channel_layoutmask_s","AVCodecContext_ch_layout_nb_channels","AVCodecContext_ch_layout_nb_channels_s","AVCodecContext_coded_side_data","AVCodecContext_coded_side_data_s","AVCodecContext_compression_level","AVCodecContext_compression_level_s","AVCodecContext_extradata","AVCodecContext_extradata_s","AVCodecContext_extradata_size","AVCodecContext_extradata_size_s","AVCodecContext_frame_size","AVCodecContext_frame_size_s","AVCodecContext_framerate_num","AVCodecContext_framerate_den","AVCodecContext_framerate_num_s","AVCodecContext_framerate_den_s","AVCodecContext_framerate_s","AVCodecContext_gop_size","AVCodecContext_gop_size_s","AVCodecContext_height","AVCodecContext_height_s","AVCodecContext_keyint_min","AVCodecContext_keyint_min_s","AVCodecContext_level","AVCodecContext_level_s","AVCodecContext_max_b_frames","AVCodecContext_max_b_frames_s","AVCodecContext_nb_coded_side_data","AVCodecContext_nb_coded_side_data_s","AVCodecContext_pix_fmt","AVCodecContext_pix_fmt_s","AVCodecContext_profile","AVCodecContext_profile_s","AVCodecContext_rc_max_rate","AVCodecContext_rc_max_rate_s","AVCodecContext_rc_max_ratehi","AVCodecContext_rc_max_ratehi_s","AVCodecContext_rc_min_rate","AVCodecContext_rc_min_rate_s","AVCodecContext_rc_min_ratehi","AVCodecContext_rc_min_ratehi_s","AVCodecContext_sample_aspect_ratio_num","AVCodecContext_sample_aspect_ratio_den","AVCodecContext_sample_aspect_ratio_num_s","AVCodecContext_sample_aspect_ratio_den_s","AVCodecContext_sample_aspect_ratio_s","AVCodecContext_sample_fmt","AVCodecContext_sample_fmt_s","AVCodecContext_sample_rate","AVCodecContext_sample_rate_s","AVCodecContext_str
1ict_std_compliance","AVCodecContext_strict_std_compliance_s","AVCodecContext_time_base_num","AVCodecContext_time_base_den","AVCodecContext_time_base_num_s","AVCodecContext_time_base_den_s","AVCodecContext_time_base_s","AVCodecContext_pkt_timebase_num","AVCodecContext_pkt_timebase_den","AVCodecContext_pkt_timebase_num_s","AVCodecContext_pkt_timebase_den_s","AVCodecContext_pkt_timebase_s","AVCodecContext_qmax","AVCodecContext_qmax_s","AVCodecContext_qmin","AVCodecContext_qmin_s","AVCodecContext_width","AVCodecContext_width_s","avcodec_free_context_js","av_frame_alloc","av_frame_clone","av_frame_free","av_frame_get_buffer","av_frame_make_writable","av_frame_ref","av_frame_unref","av_get_bytes_per_sample","av_get_sample_fmt_name","av_pix_fmt_desc_get","AVPixFmtDescriptor_comp_depth","ff_frame_rescale_ts_js","ff_copyout_frame","ff_copyout_frame_video","ff_frame_video_packed_size","ff_copyout_frame_video_packed","ff_copyout_frame_video_imagedata","ff_copyout_frame_ptr","ff_copyin_frame","AVFrame_channel_layout","AVFrame_channel_layout_s","AVFrame_channel_layouthi","AVFrame_channel_layouthi_s","AVFrame_channels","AVFrame_channels_s","AVFrame_channel_layoutmask","AVFrame_channel_layoutmask_s","AVFrame_ch_layout_nb_channels","AVFrame_ch_layout_nb_channels_s","AVFrame_crop_bottom","AVFrame_crop_bottom_s","AVFrame_crop_left","AVFrame_crop_left_s","AVFrame_crop_right","AVFrame_crop_right_s","AVFrame_crop_top","AVFrame_crop_top_s","AVFrame_data_a","AVFrame_data_a_s","AVFrame_flags","AVFrame_flags_s","AVFrame_format","AVFrame_format_s","AVFrame_height","AVFrame_height_s","AVFrame_key_frame","AVFrame_key_frame_s","AVFrame_linesize_a","AVFrame_linesize_a_s","AVFrame_nb_samples","AVFrame_nb_samples_s","AVFrame_pict_type","AVFrame_pict_type_s","AVFrame_pts","AVFrame_pts_s","AVFrame_ptshi","AVFrame_ptshi_s","AVFrame_duration","AVFrame_duration_s","AVFrame_durationhi","AVFrame_durationhi_s","AVFrame_sample_aspect_ratio_num","AVFrame_sample_aspect_ratio_den","AVFrame_sample_aspect_ratio_num_s","AVFrame_sample_aspect_ratio_den_s","AVFrame_sample_aspect_ratio_s","AVFrame_sample_rate","AVFrame_sample_rate_s","AVFrame_time_base_num","AVFrame_time_base_den","AVFrame_time_base_num_s","AVFrame_time_base_den_s","AVFrame_time_base_s","AVFrame_width","AVFrame_width_s","AVPixFmtDescriptor_flags","AVPixFmtDescriptor_flags_s","AVPixFmtDescriptor_log2_chroma_h","AVPixFmtDescriptor_log2_chroma_h_s","AVPixFmtDescriptor_log2_chroma_w","AVPixFmtDescriptor_log2_chroma_w_s","AVPixFmtDescriptor_nb_components","AVPixFmtDescriptor_nb_components_s","av_frame_free_js","avcodec_descriptor_get","avcodec_descriptor_get_by_name","avcodec_descriptor_next","av_grow_packet","av_packet_alloc","av_packet_clone","av_packet_free","av_packet_make_writable","av_packet_new_side_data","av_packet_ref","av_packet_rescale_ts_js","AVPacketSideData_data","AVPacketSideData_size","AVPacketSideData_type","av_packet_unref","av_shrink_packet","ff_codecpar_new_side_data","av_channel_layout_default_mask","LIBAVCODEC_VERSION_INT","ff_set_packet","ff_copyout_packet","ff_copyout_packet_ptr","ff_copyin_packet","AVCodecDescriptor_id","AVCodecDescriptor_id_s","AVCodecDescriptor_long_name","AVCodecDescriptor_mime_types_a","AVCodecDescriptor_mime_types_a_s","AVCodecDescriptor_name","AVCodecDescriptor_props","AVCodecDescriptor_props_s","AVCodecDescriptor_type","AVCodecDescriptor_type_s","AVCodecParameters_bit_rate","AVCodecParameters_bit_rate_s","AVCodecParameters_channel_layoutmask","AVCodecParameters_channel_layoutmask_s","AVCodecParameters_channels","AVCodecParameters_channels_s","AVCodecParameters_ch_layout_nb_channels","AVCodecParameters_ch_layout_nb_channels_s","AVCodecParameters_chroma_location","AVCodecParameters_chroma_location_s","AVCodecParameters_codec_id","AVCodecParameters_codec_id_s","AVCodecParameters_codec_tag","AVCodecParameters_codec_tag_s","AVCodecParameters_codec_type","AVCodecParameters_codec_type_s","AVCodecParameters_coded_side_data","AVCodecParameters_coded_side_data_s","AVCodecParameters_color_primaries","AVCodecParameters_color_primaries_s","AVCodecParameters_color_range","AVCodecParameters_color_range_s","AVCodecParameters_color_space","AVCodecParameters_color_space_s","AVCodecParameters_color_trc","AVCodecParameters_color_trc_s","AVCodecParameters_extradata","AVCodecParameters_extradata_s","AVCodecParameters_extradata_size","AVCodecParameters_extradata_size_s","AVCodecParameters_format","AVCodecParameters_format_s","AVCodecParameters_framerate_num","AVCodecParameters_framerate_den","AVCodecParameters_framerate_num_s","AVCodecParameters_framerate_den_s","AVCodecParameters_framerate_s","AVCodecParameters_height","AVCodecParameters_height_s","AVCodecParameters_level","AVCodecParameters_level_s","AVCodecParameters_nb_coded_side_data","AVCodecParameters_nb_coded_side_data_s","AVCodecParameters_profile","AVCodecParameters_profile_s","AVCodecParameters_sample_rate","AVCodecParameters_sample_rate_s","AVCodecParameters_width","AVCodecParameters_width_s","AVCodecParameters_block_align","AVCodecParameters_block_align_s","AVCodecParameters_frame_size","AVCodecParameters_frame_size_s","AVCodecParameters_initial_padding","AVCodecParameters_initial_padding_s","AVCodecParameters_trailing_padding","AVCodecParameters_trailing_padding_s","AVCodecParameters_seek_preroll","AVCodecParameters_seek_preroll_s","AVPacket_data","AVPacket_data_s","AVPacket_dts","AVPacket_dts_s","AVPacket_dtshi","AVPacket_dtshi_s","AVPacket_duration","AVPacket_duration_s","AVPacket_durationhi","AVPacket_durationhi_s","AVPacket_flags","AVPacket_flags_s","AVPacket_pos","AVPacket_pos_s","AVPacket_poshi","AVPacket_poshi_s","AVPacket_pts","AVPacket_pts_s","AVPacket_ptshi","AVPacket_ptshi_s","AVPacket_side_data","AVPacket_side_data_s","AVPacket_side_data_elems","AVPacket_side_data_elems_s","AVPacket_size","AVPacket_size_s","AVPacket_stream_index","AVPacket_stream_index_s","AVPacket_time_base_num","AVPacket_time_base_den","AVPacket_time_base_num_s","AVPacket_time_base_den_s","AVPacket_time_base_s","av_packet_free_js","avcodec_parameters_free_js","av_bsf_flush","av_bsf_free","av_bsf_init","av_bsf_list_parse_str","av_bsf_list_parse_str_js","av_bsf_receive_packet","av_bsf_send_packet","ff_bsf_multi","AVBSFContext_par_in","AVBSFContext_par_in_s","AVBSFContext_par_out","AVBSFContext_par_out_s","AVBSFContext_time_base_in_num","AVBSFContext_time_base_in_den","AVBSFContext_time_base_in_num_s","AVBSFContext_time_base_in_den_s","AVBSFContext_time_base_in_s","AVBSFContext_time_base_out_num","AVBSFContext_time_base_out_den","AVBSFContext_time_base_out_num_s","AVBSFContext_time_base_out_den_s","AVBSFContext_time_base_out_s","av_bsf_free_js","av_buffersink_get_frame","av_buffersink_get_time_base_num","av_buffersink_get_time_base_den","av_buffersink_set_frame_size","ff_buffersink_set_ch_layout","av_buffersrc_add_frame_flags","avfilter_free","avfilter_get_by_name","avfilter_graph_alloc","avfilter_graph_config","avfilter_graph_create_filter_js","avfilter_graph_free","avfilter_graph_parse","avfilter_inout_alloc","avfilter_inout_free","avfilter_link","LIBAVFILTER_VERSION_INT","ff_init_filter_graph","ff_filter_multi","ff_decode_filter_multi","AVFilterInOut_filter_ctx","AVFilterInOut_filter_ctx_s","AVFilterInOut_name","AVFilterInOut_name_s","AVFilterInOut_next","AVFilterInOut_next_s","AVFilterInOut_pad_idx","AVFilterInOut_pad_idx_s","avfilter_graph_free_js","avfilter_inout_free_js"],b=["copyin_u8","copyout_u8","copyin_s16","copyout_s16","copyin_s32","copyout_s32","copyin_f32","copyout_f32","createLazyFile","ff_block_reader_dev_send","ff_reader_dev_send","ff_reader_dev_waiting","mkblockreaderdev","mkdev","mkfsfhfile","mkreadaheadfile","mkreaderdev","mkstreamwriterdev","mkworkerfsfile","mkwriterdev","mountwriterfs","readFile","unlink","unlinkfsfhfile","unlinkreadaheadfile","unlinkworkerfsfile","unmount","writeFile"];return u.libavjsMode=T,T==="worker"?(D(P),D(b)):T==="threads"?(D(P),y(b)):(y(P),y(b)),Object.assign(u,a),u})}})();const{base:hi,isWebAssemblySupported:Ei,isThreadingSupported:pi,target:Vi,VER:Ci,CONFIG:Ti,DBG:gi,factories:Ri,NULL:Si,i64tof64:Pi,f64toi64:Oi,i64ToBigInt:Ii,bigIntToi64:Li,ff_channel_layout:Di,ff_channels:bi,AV_VERSION_INT:wi,AV_TIME_BASE:yi,AV_NOPTS_VALUE_I64:Mi,AV_NOPTS_VALUE_LO:vi,AV_NOPTS_VALUE_HI:Fi,AV_NOPTS_VALUE:Ni,AV_OPT_SEARCH_CHILDREN:xi,AVMEDIA_TYPE_UNKNOWN:ki,AVMEDIA_TYPE_VIDEO:Gi,AVMEDIA_TYPE_AUDIO:Bi,AVMEDIA_TYPE_DATA:Ui,AVMEDIA_TYPE_SUBTITLE:Wi,AVMEDIA_TYPE_ATTACHMENT:Xi,AV_SAMPLE_FMT_NONE:Yi,AV_SAMPLE_FMT_U8:zi,AV_SAMPLE_FMT_S16:Hi,AV_SAMPLE_FMT_S32:$i,AV_SAMPLE_FMT_FLT:qi,AV_SAMPLE_FMT_DBL:ji,AV_SAMPLE_FMT_U8P:Ki,AV_SAMPLE_FMT_S16P:Qi,AV_SAMPLE_FMT_S32P:Ji,AV_SAMPLE_FMT_FLTP:Zi,AV_SAMPLE_FMT_DBLP:eo,AV_SAMPLE_FMT_S64:to,AV_SAMPLE_FMT_S64P:ro,AV_SAMPLE_FMT_NB:ao,AV_PIX_FMT_NONE:so,AV_PIX_FMT_YUV420P:no,AV_PIX_FMT_YUYV422:io,AV_PIX_FMT_RGB24:oo,AV_PIX_FMT_BGR24:_o,AV_PIX_FMT_YUV422P:co,AV_PIX_FMT_YUV444P:lo,AV_PIX_FMT_YUV410P:uo,AV_PIX_FMT_YUV411P:fo,AV_PIX_FMT_GRAY8:Ao,AV_PIX_FMT_MONOWHITE:mo,AV_PIX_FMT_MONOBLACK:ho,AV_PIX_FMT_PAL8:Eo,AV_PIX_FMT_YUVJ420P:po,AV_PIX_FMT_YUVJ422P:Vo,AV_PIX_FMT_YUVJ444P:Co,AV_PIX_FMT_UYVY422:To,AV_PIX_FMT_UYYVYY411:go,AV_PIX_FMT_BGR8:Ro,AV_PIX_FMT_BGR4:So,AV_PIX_FMT_BGR4_BYTE:Po,AV_PIX_FMT_RGB8:Oo,AV_PIX_FMT_RGB4:Io,AV_PIX_FMT_RGB4_BYTE:Lo,AV_PIX_FMT_NV12:Do,AV_PIX_FMT_NV21:bo,AV_PIX_FMT_ARGB:wo,AV_PIX_FMT_RGBA:yo,AV_PIX_FMT_ABGR:Mo,AV_PIX_FMT_BGRA:vo,AV_PIX_FMT_GRAY16BE:Fo,AV_PIX_FMT_GRAY16LE:No,AV_PIX_FMT_YUV440P:xo,AV_PIX_FMT_YUVJ440P:ko,AV_PIX_FMT_YUVA420P:Go,AV_PIX_FMT_RGB48BE:Bo,AV_PIX_FMT_RGB48LE:Uo,AV_PIX_FMT_RGB565BE:Wo,AV_PIX_FMT_RGB565LE:Xo,AV_PIX_FMT_RGB555BE:Yo,AV_PIX_FMT_RGB555LE:zo,AV_PIX_FMT_BGR565BE:Ho,AV_PIX_FMT_BGR565LE:$o,AV_PIX_FMT_BGR555BE:qo,AV_PIX_FMT_BGR555LE:jo,AVCOL_PRI_RESERVED0:Ko,AVCOL_PRI_BT709:Qo,AVCOL_PRI_UNSPECIFIED:Jo,AVCOL_PRI_RESERVED:Zo,AVCOL_PRI_BT470M:e_,AVCOL_PRI_BT470BG:t_,AVCOL_PRI_SMPTE170M:r_,AVCOL_PRI_SMPTE240M:a_,AVCOL_PRI_FILM:s_,AVCOL_PRI_BT2020:n_,AVCOL_PRI_SMPTE428:i_,AVCOL_PRI_SMPTEST428_1:o_,AVCOL_PRI_SMPTE431:__,AVCOL_PRI_SMPTE432:c_,AVCOL_PRI_EBU3213:l_,AVCOL_PRI_JEDEC_P22:u_,AVCOL_TRC_RESERVED0:d_,AVCOL_TRC_BT709:f_,AVCOL_TRC_UNSPECIFIED:A_,AVCOL_TRC_RESERVED:m_,AVCOL_TRC_GAMMA22:h_,AVCOL_TRC_GAMMA28:E_,AVCOL_TRC_SMPTE170M:p_,AVCOL_TRC_SMPTE240M:V_,AVCOL_TRC_LINEAR:C_,AVCOL_TRC_LOG:T_,AVCOL_TRC_LOG_SQRT:g_,AVCOL_TRC_IEC61966_2_4:R_,AVCOL_TRC_BT1361_ECG:S_,AVCOL_TRC_IEC61966_2_1:P_,AVCOL_TRC_BT2020_10:O_,AVCOL_TRC_BT2020_12:I_,AVCOL_TRC_SMPTE2084:L_,AVCOL_TRC_SMPTEST2084:D_,AVCOL_TRC_SMPTE428:b_,AVCOL_TRC_SMPTEST428_1:w_,AVCOL_TRC_ARIB_STD_B67:y_,AVCOL_SPC_RGB:M_,AVCOL_SPC_BT709:v_,AVCOL_SPC_UNSPECIFIED:F_,AVCOL_SPC_RESERVED:N_,AVCOL_SPC_FCC:x_,AVCOL_SPC_BT470BG:k_,AVCOL_SPC_SMPTE170M:G_,AVCOL_SPC_SMPTE240M:B_,AVCOL_SPC_YCGCO:U_,AVCOL_SPC_YCOCG:W_,AVCOL_SPC_BT2020_NCL:X_,AVCOL_SPC_BT2020_CL:Y_,AVCOL_SPC_SMPTE2085:z_,AVCOL_SPC_CHROMA_DERIVED_NCL:H_,AVCOL_SPC_CHROMA_DERIVED_CL:$_,AVCOL_SPC_ICTCP:q_,AVCOL_RANGE_UNSPECIFIED:j_,AVCOL_RANGE_MPEG:K_,AVCOL_RANGE_JPEG:Q_,AVIO_FLAG_READ:J_,AVIO_FLAG_WRITE:Z_,AVIO_FLAG_READ_WRITE:ec,AVIO_FLAG_NONBLOCK:tc,AVIO_FLAG_DIRECT:rc,AVFMT_FLAG_NOBUFFER:ac,AVFMT_FLAG_FLUSH_PACKETS:sc,AVSEEK_FLAG_BACKWARD:nc,AVSEEK_FLAG_BYTE:ic,AVSEEK_FLAG_ANY:oc,AVSEEK_FLAG_FRAME:_c,AVDISCARD_NONE:cc,AVDISCARD_DEFAULT:lc,AVDISCARD_NONREF:uc,AVDISCARD_BIDIR:dc,AVDISCARD_NONINTRA:fc,AVDISCARD_NONKEY:Ac,AVDISCARD_ALL:mc,AV_LOG_QUIET:hc,AV_LOG_PANIC:Ec,AV_LOG_FATAL:pc,AV_LOG_ERROR:Vc,AV_LOG_WARNING:Cc,AV_LOG_INFO:Tc,AV_LOG_VERBOSE:gc,AV_LOG_DEBUG:Rc,AV_LOG_TRACE:Sc,AV_PKT_FLAG_KEY:Pc,AV_PKT_FLAG_CORRUPT:Oc,AV_PKT_FLAG_DISCARD:Ic,AV_PKT_FLAG_TRUSTED:Lc,AV_PKT_FLAG_DISPOSABLE:Dc,SWS_FAST_BILINEAR:bc,SWS_BILINEAR:wc,SWS_BICUBIC:yc,SWS_X:Mc,SWS_POINT:vc,SWS_AREA:Fc,SWS_BICUBLIN:Nc,SWS_GAUSS:xc,SWS_SINC:kc,SWS_LANCZOS:Gc,SWS_SPLINE:Bc,E2BIG:Uc,EPERM:Wc,EADDRINUSE:Xc,EADDRNOTAVAIL:Yc,EAFNOSUPPORT:zc,EAGAIN:Hc,EALREADY:$c,EBADF:qc,EBADMSG:jc,EBUSY:Kc,ECANCELED:Qc,ECHILD:Jc,ECONNABORTED:Zc,ECONNREFUSED:el,ECONNRESET:tl,EDEADLOCK:rl,EDESTADDRREQ:al,EDOM:sl,EDQUOT:nl,EEXIST:il,EFAULT:ol,EFBIG:_l,EHOSTUNREACH:cl,EIDRM:ll,EILSEQ:ul,EINPROGRESS:dl,EINTR:fl,EINVAL:Al,EIO:ml,EISCONN:hl,EISDIR:El,ELOOP:pl,EMFILE:Vl,EMLINK:Cl,EMSGSIZE:Tl,EMULTIHOP:gl,ENAMETOOLONG:Rl,ENETDOWN:Sl,ENETRESET:Pl,ENETUNREACH:Ol,ENFILE:Il,ENOBUFS:Ll,ENODEV:Dl,ENOENT:bl,AVERROR_EOF:wl,LibAV:os}=m,ht={fullRange:!1,primaries:"bt709",transfer:"bt709",matrix:"bt709"},_s=({primaries:r,trc:e,matrix:t})=>{const s=(r>=m.AVCOL_PRI_BT709&&r<=m.AVCOL_PRI_SMPTE432||r===m.AVCOL_PRI_EBU3213)&&r!==m.AVCOL_PRI_RESERVED&&r!==m.AVCOL_PRI_UNSPECIFIED,a=e>=m.AVCOL_TRC_BT709&&e<=m.AVCOL_TRC_ARIB_STD_B67&&e!==m.AVCOL_TRC_RESERVED&&e!==m.AVCOL_TRC_UNSPECIFIED,o=t>
1=m.AVCOL_SPC_RGB&&t<=m.AVCOL_SPC_ICTCP&&t!==m.AVCOL_SPC_RESERVED&&t!==m.AVCOL_SPC_UNSPECIFIED;return s&&a&&o},cs=r=>{let e;switch(r.primaries){case m.AVCOL_PRI_BT709:e="bt709";break;case m.AVCOL_PRI_BT470BG:e="bt470bg";break;case m.AVCOL_PRI_SMPTE170M:e="smpte170m";break;case m.AVCOL_PRI_BT2020:e="bt2020";break;case m.AVCOL_PRI_SMPTE432:e="smpte432";break}let t;switch(r.trc){case m.AVCOL_TRC_BT709:t="bt709";break;case m.AVCOL_TRC_SMPTE170M:t="smpte170m";break;case m.AVCOL_TRC_IEC61966_2_1:t="iec61966-2-1";break;case m.AVCOL_TRC_LINEAR:t="linear";break;case m.AVCOL_TRC_SMPTE2084:case m.AVCOL_TRC_SMPTEST2084:t="pq";break;case m.AVCOL_TRC_ARIB_STD_B67:t="hlg";break}let s;switch(r.matrix){case m.AVCOL_SPC_RGB:s="rgb";break;case m.AVCOL_SPC_BT709:s="bt709";break;case m.AVCOL_SPC_BT470BG:s="bt470bg";break;case m.AVCOL_SPC_SMPTE170M:s="smpte170m";break;case m.AVCOL_SPC_BT2020_NCL:s="bt2020-ncl";break}if(!(!e||!t||!s))return{fullRange:r.range===m.AVCOL_RANGE_JPEG,primaries:e,transfer:t,matrix:s}},Vt=(r,e)=>(r==="h264"||r==="hevc")&&e===m.AVCOL_SPC_RGB,ls=new Set(["yuv444p","yuvj444p","gbrp","yuv444p9le","gbrp9le","yuv444p10le","gbrp10le","yuv444p12le","gbrp12le"]),us=r=>r!==null&&ls.has(r),ia=async(r,e,t,s,a)=>{const o=r.libav,[i,c,l,A,h,E]=await Promise.all([o.avcodec_get_name(e.codec_id),o.AVCodecParameters_color_range(t),o.AVCodecParameters_color_primaries(t),o.AVCodecParameters_color_trc(t),o.AVCodecParameters_color_space(t),o.AVCodecParameters_height(t)]),u={range:c,primaries:l,trc:A,matrix:h},T=r.getContainerVideoColorSpace(e.index),D=Vt(i,u.matrix)||T!==void 0&&Vt(i,T.matrix),y=a??(D?await o.AVCodecParameters_format(t):void 0),P=y!==void 0&&D?await o.ff_get_pix_fmt_name(y):null;return{codecName:i,codedHeight:s??E,naturalHeight:E,isChroma444:us(P),analyzed:u,container:T}},ds=async(r,e,t)=>oa(await ia(r,e,e.codecpar,t)),fs=async(r,e,t,s,a)=>{const o=r.libav,i=await o.avcodec_parameters_alloc();try{const c=await o.avcodec_parameters_from_context(i,t);if(c<0)throw new Error(`Failed to read decoded video parameters: ${await o.ff_error(c)}`);return oa(await ia(r,e,i,a,s),ht)??null}finally{await o.avcodec_parameters_free_js(i)}},oa=({codecName:r,codedHeight:e,naturalHeight:t,isChroma444:s,analyzed:a,container:o},i)=>{const l=(r==="vp9"?[o,a]:[a,o]).filter(A=>A!==void 0&&_s(A));if(Vt(r,a.matrix)&&!s)return ht;for(const A of l){const h=cs(A);if(h)return Vt(r,A.matrix)&&!s?ht:h}if(!(l.length>0))return r==="vp9"||r==="av1"?i:(t||e)<720?{fullRange:!1,primaries:"smpte170m",transfer:"smpte170m",matrix:"smpte170m"}:ht};class U{static _zero=new U(0);_micros;constructor(e){this._micros=e}static fromUS(e){return new U(Math.round(e))}static fromMS(e){return new U(Math.round(e*1e3))}static fromSec(e){return new U(Math.round(e*1e6))}static zero(){return U._zero}static doOverlap(e,t,s,a){return e.lt(a)&&s.lt(t)}get as(){return{us:(e="raw",t)=>
1U._round(this._micros,e,t),ms:(e="raw",t)=>U._round(this._micros/1e3,e,t),sec:(e="raw",t)=>U._round(this._micros/1e6,e,t)}}lt(e){return this._micros<e._micros}lte(e){return this._micros<=e._micros}gt(e){return this._micros>e._micros}gte(e){return this._micros>=e._micros}eq(e,t=0){return Math.abs(this._micros-e._micros)<=t}add(e){return new U(this._micros+e._micros)}sub(e){return new U(this._micros-e._micros)}mul(e){return new U(Math.round(this._micros*e))}div(e){if(e===0)throw new Error("Division by zero at Time.div");return new U(Math.round(this._micros/e))}mod(e){if(e._micros===0)throw new Error("Division by zero at Time.mod");const t=this._micros%e._micros;return new U(t)}roundTo(e=0){return U.fromUS(this.as.us("round",e))}static compare(e,t){return e._micros-t._micros}static min(...e){if(e.length===0)throw new Error("Time.min requires at least one Time argument");let t=e[0];for(const s of e)s._micros<t._micros&&(t=s);return t}static max(...e){if(e.length===0)throw new Error("Time.max requires at least one Time argument");let t=e[0];for(const s of e)s._micros>t._micros&&(t=s);return t}static _round(e,t,s){if(t==="raw")return e;const a=10**(s??0);switch(t){case"round":return Math.round(e/a)*a;case"floor":return Math.floor(e/a)*a;case"ceil":return Math.ceil(e/a)*a}}}const V=(r=C.UNKNOWN_ERR,e,t,s)=>{const a=Wt(e)?e.type:ms(e)?C.NETWORK_FAILED_ERR:r,o=_a(e)||Wt(e)?e.message:"",i=o?`${o}
2    ${t??""}: ${xe(e)}`:`${t??""}: ${xe(e)}`,c=Wt(e)&&e.errorArgs!==void 0?e.errorArgs:s;return{__internal:"MediaProcessingError",type:a,message:i,errorArgs:c}},Wt=r=>typeof r=="object"&&r!==null&&"__internal"in r,_a=r=>r instanceof Error,As=r=>r instanceof DOMException,ms=r=>_a(r)&&r.name==="TypeError"&&r.message==="Network request failed",hs=r=>{if(As(r))return`DOMException ${r.name}(${r.code}): ${r.message}`;const e=Object.getOwnPropertyNames(r);try{return JSON.stringify(r,e)}catch(t){return`{${e.map(a=>`${a}: ${r[a]}`).join(", ")}} (stringify failed: ${t})`}},xe=r=>{switch(typeof r){case"string":return r;case"undefined":return"undefined";case"function":return`function ${r.name}`;case"number":case"bigint":case"symbol":case"boolean":return r.toString();case"object":return r!==null?hs(r):"null"}};
2class Es extends Error{}class me extends Es{constructor(){super("Zone is an abstract class")}}function Qe(r){return typeof r>"u"}function ps(){try{return typeof Intl<"u"&&Intl.DateTimeFormat}catch{return!1}}function Vs(){return!Qe(Intl.DateTimeFormat.prototype.formatToParts)}function ut(r,e=2){return r.toString().length<e?("0".repeat(e)+r).slice(-e):r.toString()}function ca(r){if(!(Qe(r)||r===null||r===""))return parseInt(r,10)}function Cs(r){if(!(Qe(r)||r===null||r==="")){const e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Ts(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function gs(r,e,t,s=null){const a=new Date(r),o={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(o.timeZone=s);const i=Object.assign({timeZoneName:e},o),c=ps();if(c&&Vs()){const l=new Intl.DateTimeFormat(t,i).formatToParts(a).find(A=>A.type.toLowerCase()==="timezonename");return l?l.value:null}else if(c){const l=new Intl.DateTimeFormat(t,o).format(a);return new Intl.DateTimeFormat(t,i).format(a).substring(l.length).replace(/^[, \u200e]+/,"")}else return null}function la(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,a=t<0||Object.is(t,-0)?-s:s;return t*60+a}function er(r,e){const t=Math.trunc(r/60),s=Math.abs(r%60),a=t>=0&&!Object.is(t,-0)?"+":"-",o=`${a}${Math.abs(t)}`;switch(e){case"short":return`${a}${ut(Math.abs(t),2)}:${ut(s,2)}`;case"narrow":return s>0?`${o}:${s}`:o;case"techie":return`${a}${ut(Math.abs(t),2)}${ut(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}const ua=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;class da{get type(){throw new me}get name(){throw new me}get universal(){throw new me}offsetName(e,t){throw new me}formatOffset(e,t){throw new me}offset(e){throw new me}equals(e){throw new me}get isValid(){throw new me}}const Rs=RegExp(`^${ua.source}$`);let Et={};function Ss(r){return Et[r]||(Et[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Et[r]}const Ps={year:0,month:1,day:2,hour:3,minute:4,second:5};function Os(r,e){const t=r.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),[,a,o,i,c,l,A]=s;return[i,a,o,c,l,A]}function Is(r,e){const t=r.formatToParts(e),s=[];for(let a=0;a<t.length;a++){const{type:o,value:i}=t[a],c=Ps[o];Qe(c)||(s[c]=parseInt(i,10))}return s}let dt={};class Ct extends da{static create(e){return dt[e]||(dt[e]=new Ct(e)),dt[e]}static resetCache(){dt={},Et={}}static isValidSpecifier(e){return!!(e&&e.match(Rs))}static isValidZone(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}static parseGMTOffset(e){if(e){const t=e.match(/^Etc\/GMT([+-]\d{1,2})$/i);if(t)return-60*parseInt(t[1])}return null}constructor(e){super(),this.zoneName=e,this.valid=Ct.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get universal(){return!1}offsetName(e,{format:t,locale:s}){return gs(e,t,s,this.name)}formatOffset(e,t){return er(this.offset(e),t)}offset(e){const t=new Date(e),s=Ss(this.name),[a,o,i,c,l,A]=s.formatToParts?Is(s,t):Os(s,t),E=Ts({year:a,month:o,day:i,hour:c===24?0:c,minute:l,second:A,millisecond:0});let u=+t;const T=u%1e3;return u-=T>=0?T:1e3+T,(E-u)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Xt=null;class ve extends da{static get utcInstance(){return Xt===null&&(Xt=new ve(0)),Xt}static instance(e){return e===0?ve.utcInstance:new ve(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new ve(la(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${er(this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return er(this.fixed,t)}get universal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}function ke(...r){const e=r.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}function Ge(...r){return e=>r.reduce(([t,s,a],o)=>{const[i,c,l]=o(e,a);return[Object.assign(t,i),s||c,l]},[{},null,1]).slice(0,2)}function fa(...r){return(e,t)=>{const s={};let a;for(a=0;a<r.length;a++)s[r[a]]=ca(e[t+a]);return[s,null,t+a]}}const Aa=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,ma=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/,ha=RegExp(`${ma.source}${Aa.source}?`),ir=RegExp(`(?:T${ha.source})?`),Ls=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ds=/(\d{4})-?W(\d\d)(?:-?(\d))?/,bs=/(\d{4})-?(\d{3})/,ws=fa("weekYear","weekNumber","weekDay"),ys=fa("year","ordinal"),Ms=/(\d{4})-(\d\d)-(\d\d)/,Ea=RegExp(`${ma.source} ?(?:${Aa.source}|(${ua.source}))?`),vs=RegExp(`(?: ${Ea.source})?`);function Ne(r,e,t){const s=r[e];return Qe(s)?t:ca(s)}function pa(r,e){return[{year:Ne(r,e),month:Ne(r,e+1,1),day:Ne(r,e+2,1)},null,e+3]}function Be(r,e){return[{hour:Ne(r,e,0),minute:Ne(r,e+1,0),second:Ne(r,e+2,0),millisecond:Cs(r[e+3])},null,e+4]}function Je(r,e){const t=!r[e]&&!r[e+1],s=la(r[e+1],r[e+2]),a=t?null:ve.instance(s);return[{},a,e+3]}function Va(r,e){const t=r[e]?Ct.create(r[e]):null;return[{},t,e+1]}ke(Ls,ir);ke(Ds,ir);ke(bs,ir);ke(ha);Ge(pa,Be,Je);Ge(ws,Be,Je);Ge(ys,Be);Ge(Be,Je);ke(Ms,vs);ke(Ea);Ge(pa,Be,Je,Va);Ge(Be,Je,Va);const Ca={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}};Object.assign({years:{months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3}},Ca);const Z=146097/400,De=146097/4800;Object.assign({years:{months:12,weeks:Z/7,days:Z,hours:Z*24,minutes:Z*24*60,seconds:Z*24*60*60,milliseconds:Z*24*60*60*1e3},quarters:{months:3,weeks:Z/28,days:Z/4,hours:Z*24/4,minutes:Z*24*60/4,seconds:Z*24*60*60/4,milliseconds:Z*24*60*60*1e3/4},months:{weeks:De/7,days:De,hours:De*24,minutes:De*24*60,seconds:De*24*60*60,milliseconds:De*24*60*60*1e3}},Ca);const Fs=(r,e,t)=>Math.max(e,Math.min(r,t)),Ns=r=>new Promise(e=>setTimeout(e,r)),Ke=(r,e,t)=>{const s=setTimeout(()=>t(),e);return r.then(()=>clearTimeout(s),()=>clearTimeout(s)),r},tr=(r,e)=>{let t;return new Promise((s,a)=>{t=setTimeout(()=>a(new Error("Timeout")),e),r.then(s,a).finally(()=>clearTimeout(t))})},xs=["SecurityError","NotSupportedError","InvalidStateError","DataCloneError"],ks=async r=>{let s=0;for(;s<4;)try{return r.transferToImageBitmap()}catch(a){if(a instanceof DOMException&&xs.includes(a.name))throw V(C.BITMAP_CREATION_ERR,a);s++;const o=Math.floor(Math.random()*10),i=10*(1<<s-1)+o;await Ns(i)}throw V(C.BITMAP_CREATION_ERR,"Error in transferToImageBitmap")},rr=r=>{try{r instanceof VideoFrame&&r.close(),r instanceof ImageBitmap&&r.close()}catch{}};function Fr(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=Array(e);t<e;t++)s[t]=r[t];return s}function Gs(r){if(Array.isArray(r))return r}function Bs(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var s,a,o,i,c=[],l=!0,A=!1;try{if(o=(t=t.call(r)).next,e!==0)for(;
vendor: 6,709 bytes, lines 2-3
2!(l=(s=o.call(t)).done)&&(c.push(s.value),c.length!==e);l=!0);}catch(h){A=!0,a=h}finally{try{if(!l&&t.return!=null&&(i=t.return(),Object(i)!==i))return}finally{if(A)throw a}}return c}}function Us(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ws(r,e){return Gs(r)||Bs(r,e)||Xs(r,e)||Us()}function Xs(r,e){if(r){if(typeof r=="string")return Fr(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Fr(r,e):void 0}}const Ta=Object.entries,Nr=Object.setPrototypeOf,Ys=Object.isFrozen,zs=Object.getPrototypeOf,Hs=Object.getOwnPropertyDescriptor;let z=Object.freeze,H=Object.seal,ye=Object.create,ga=typeof Reflect<"u"&&Reflect,ar=ga.apply,sr=ga.construct;z||(z=function(e){return e});H||(H=function(e){return e});ar||(ar=function(e,t){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;o<s;o++)a[o-2]=arguments[o];return e.apply(t,a)});sr||(sr=function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];return new e(...s)});const be=W(Array.prototype.forEach),$s=W(Array.prototype.lastIndexOf),xr=W(Array.prototype.pop),we=W(Array.prototype.push),qs=W(Array.prototype.splice),pe=Array.isArray,$e=W(String.prototype.toLowerCase),Yt=W(String.prototype.toString),kr=W(String.prototype.match),ze=W(String.prototype.replace),Gr=W(String.prototype.indexOf),js=W(String.prototype.trim),Ks=W(Number.prototype.toString),Qs=W(Boolean.prototype.toString),Br=typeof BigInt>"u"?null:W(BigInt.prototype.toString),Ur=typeof Symbol>"u"?null:W(Symbol.prototype.toString),Y=W(Object.prototype.hasOwnProperty),He=W(Object.prototype.toString),X=W(RegExp.prototype.test),Te=Js(TypeError);function W(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,s=new Array(t>1?t-1:0),a=1;a<t;a++)s[a-1]=arguments[a];return ar(r,e,s)}}function Js(r){return function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return sr(r,t)}}function w(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$e;if(Nr&&Nr(r,null),!pe(e))return r;let s=e.length;for(;s--;){let a=e[s];if(typeof a=="string"){const o=t(a);o!==a&&(Ys(e)||(e[s]=o),a=o)}r[a]=!0}return r}function Zs(r){for(let e=0;e<r.length;e++)Y(r,e)||(r[e]=null);return r}function q(r){const e=ye(null);for(const s of Ta(r)){var t=Ws(s,2);const a=t[0],o=t[1];Y(r,a)&&(pe(o)?e[a]=Zs(o):o&&typeof o=="object"&&o.constructor===Object?e[a]=q(o):e[a]=o)}return e}function en(r){switch(typeof r){case"string":return r;case"number":return Ks(r);case"boolean":return Qs(r);case"bigint":return Br?Br(r):"0";case"symbol":return Ur?Ur(r):"Symbol()";case"undefined":return He(r);case"function":case"object":{if(r===null)return He(r);const e=r,t=ae(e,"toString");if(typeof t=="function"){const s=t(e);return typeof s=="string"?s:He(s)}return He(r)}default:return He(r)}}function ae(r,e){for(;r!==null;){const s=Hs(r,e);if(s){if(s.get)return W(s.get);if(typeof s.value=="function")return W(s.value)}r=zs(r)}function t(){return null}return t}function tn(r){try{return X(r,""),!0}catch{return!1}}const Wr=z(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zt=z(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ht=z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),rn=z(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),$t=z(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),an=z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xr=z(["#text"]),Yr=z(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
3spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),qt=z(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),zr=z(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ft=z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sn=H(/{{[\w\W]*|^[\w\W]*}}/g),nn=H(/<%[\w\W]*|^[\w\W]*%>/g),on=H(/\${[\w\W]*/g),_n=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),cn=H(/^aria-[\-\w]+$/),Hr=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ln=H(/^(?:\w+script|data):/i),un=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dn=H(/^html$/i),fn=H(/^[a-z][.\w]*(-[.\w]+)+$/i),$r=H(/<[/\w!]/g),qr=H(/<[/\w]/g),An=H(/<\/no(script|embed|frames)/i),mn=H(/\/>/i),J={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hn=function(){return typeof window>"u"?null:window},En=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let s=null;const a="data-tt-policy-suffix";t&&t.hasAttribute(a)&&(s=t.getAttribute(a));const o="dompurify"+(s?"#"+s:"");try{return e.createPolicy(o,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},jr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},he=function(e,t,s,a){return Y(e,t)&&pe(e[t])?w(a.base?q(a.base):{},e[t],a.transform):s};function Ra(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hn();const e=f=>Ra(f);if(e.version="3.4.13",e.removed=[],!r||!r.document||r.document.nodeType!==J.document||!r.Element)return e.isSupported=!1,e;let t=r.document;const s=t,a=s.currentScript;r.DocumentFragment;const o=r.HTMLTemplateElement,i=r.Node,c=r.Element,l=r.NodeFilter,A=r.NamedNodeMap;A===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;const h=r.DOMParser,E=r.trustedTypes,u=c.prototype,T=ae(u,"cloneNode"),D=ae(u,"remove"),y=ae(u,"nextSibling"),P=ae(u,"childNodes"),b=ae(u,"parentNode"),g=ae(u,"shadowRoot"),O=ae(u,"attributes"),S=i&&i.prototype?ae(i.prototype,"nodeType"):null,$=i&&i.prototype?ae(i.prototype,"nodeName"):null,te=i&&i.prototype?ae(i.prototype,"ownerDocument"):null;if(typeof o=="function"){const f=t.createElement("template");f.content&&f.content.ownerDocument&&(t=f.content.ownerDocument)}let L,B="",re,le=!1,_e=0;const cr=function(){if(_e>0)throw Te('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Re=function(n){cr(),_e++;try{return L.createHTML(n)}finally{_e--}},Ma=function(n){cr(),_e++;try{return L.createScriptURL(n)}finally{_e--}},va=function(){return le||(re=En(E,a),le=!0),re},Ze=t,Pt=Ze.implementation,lr=Ze.createNodeIterator,Fa=Ze.createDocumentFragment,Na=Ze.getElementsByTagName,xa=s.importNode;let v=jr();e.isSupported=typeof Ta=="function"&&typeof b=="function"&&Pt&&Pt.createHTMLDocument!==void 0;const ka=sn,Ga=nn,Ba=on,Ua=_n,Wa=cn,Xa=ln,ur=un,Ya=fn;let dr=Hr,F=null;const Ot=w({},[...Wr,...zt,...Ht,...$t,...Xr]);let N=null;const It=w({},[...Yr,...qt,...zr,...ft]);let G=Object.seal(ye(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ue=null,fr=null;const ue=Object.seal(ye(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ar=!0,Lt=!0,mr=!1,hr=!0,de=!1,fe=!0,Ve=!1,Dt=!1,et=null,tt=null,bt=!1,Se=!1,rt=!1,at=!1,Er=!0,pr=!1;const Vr="user-content-";let wt=!0,st=!1,Pe={},se=null;const yt=w({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Cr=null;const Tr=w({},["audio","video","img","source","image","track"]);let Mt=null;const gr=w({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",it="http://www.w3.org/2000/svg",ne="http://www.w3.org/1999/xhtml";let Oe=ne,vt=!1,Ft=null;const za=w({},[nt,it,ne],Yt),Rr=z(["mi","mo","mn","ms","mtext"]);let Nt=w({},Rr);const Sr=z(["annotation-xml"]);let xt=w({},Sr);const Ha=w({},["title","style","font","a","script"]);let We=null;const $a=["application/xhtml+xml","text/html"],qa="text/html";let x=null,Ie=null;const ja=t.createElement("form"),Pr=function(n){return n instanceof RegExp||n instanceof Function},kt=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ie&&Ie===n)return;(!n||typeof n!="object")&&(n={}
vendor: 2,497 bytes, line 3
3),n=q(n),We=$a.indexOf(n.PARSER_MEDIA_TYPE)===-1?qa:n.PARSER_MEDIA_TYPE,x=We==="application/xhtml+xml"?Yt:$e,F=he(n,"ALLOWED_TAGS",Ot,{transform:x}),N=he(n,"ALLOWED_ATTR",It,{transform:x}),Ft=he(n,"ALLOWED_NAMESPACES",za,{transform:Yt}),Mt=he(n,"ADD_URI_SAFE_ATTR",gr,{transform:x,base:gr}),Cr=he(n,"ADD_DATA_URI_TAGS",Tr,{transform:x,base:Tr}),se=he(n,"FORBID_CONTENTS",yt,{transform:x}),Ue=he(n,"FORBID_TAGS",q({}),{transform:x}),fr=he(n,"FORBID_ATTR",q({}),{transform:x}),Pe=Y(n,"USE_PROFILES")?n.USE_PROFILES&&typeof n.USE_PROFILES=="object"?q(n.USE_PROFILES):n.USE_PROFILES:!1,Ar=n.ALLOW_ARIA_ATTR!==!1,Lt=n.ALLOW_DATA_ATTR!==!1,mr=n.ALLOW_UNKNOWN_PROTOCOLS||!1,hr=n.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=n.SAFE_FOR_TEMPLATES||!1,fe=n.SAFE_FOR_XML!==!1,Ve=n.WHOLE_DOCUMENT||!1,Se=n.RETURN_DOM||!1,rt=n.RETURN_DOM_FRAGMENT||!1,at=n.RETURN_TRUSTED_TYPE||!1,bt=n.FORCE_BODY||!1,Er=n.SANITIZE_DOM!==!1,pr=n.SANITIZE_NAMED_PROPS||!1,wt=n.KEEP_CONTENT!==!1,st=n.IN_PLACE||!1,dr=tn(n.ALLOWED_URI_REGEXP)?n.ALLOWED_URI_REGEXP:Hr,Oe=typeof n.NAMESPACE=="string"?n.NAMESPACE:ne,Nt=Y(n,"MATHML_TEXT_INTEGRATION_POINTS")&&n.MATHML_TEXT_INTEGRATION_POINTS&&typeof n.MATHML_TEXT_INTEGRATION_POINTS=="object"?q(n.MATHML_TEXT_INTEGRATION_POINTS):w({},Rr),xt=Y(n,"HTML_INTEGRATION_POINTS")&&n.HTML_INTEGRATION_POINTS&&typeof n.HTML_INTEGRATION_POINTS=="object"?q(n.HTML_INTEGRATION_POINTS):w({},Sr);const _=Y(n,"CUSTOM_ELEMENT_HANDLING")&&n.CUSTOM_ELEMENT_HANDLING&&typeof n.CUSTOM_ELEMENT_HANDLING=="object"?q(n.CUSTOM_ELEMENT_HANDLING):ye(null);if(G=ye(null),Y(_,"tagNameCheck")&&Pr(_.tagNameCheck)&&(G.tagNameCheck=_.tagNameCheck),Y(_,"attributeNameCheck")&&Pr(_.attributeNameCheck)&&(G.attributeNameCheck=_.attributeNameCheck),Y(_,"allowCustomizedBuiltInElements")&&typeof _.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=_.allowCustomizedBuiltInElements),H(G),de&&(Lt=!1),rt&&(Se=!0),Pe&&(F=w({},Xr),N=ye(null),Pe.html===!0&&(w(F,Wr),w(N,Yr)),Pe.svg===!0&&(w(F,zt),w(N,qt),w(N,ft)),Pe.svgFilters===!0&&(w(F,Ht),w(N,qt),w(N,ft)),Pe.mathMl===!0&&(w(F,$t),w(N,zr),w(N,ft))),ue.tagCheck=null,ue.attributeCheck=null,Y(n,"ADD_TAGS")&&(typeof n.ADD_TAGS=="function"?ue.tagCheck=n.ADD_TAGS:pe(n.ADD_TAGS)&&(F===Ot&&(F=q(F)),w(F,n.ADD_TAGS,x))),Y(n,"ADD_ATTR")&&(typeof n.ADD_ATTR=="function"?ue.attributeCheck=n.ADD_ATTR:pe(n.ADD_ATTR)&&(N===It&&(N=q(N)),w(N,n.ADD_ATTR,x))),Y(n,"ADD_URI_SAFE_ATTR")&&pe(n.ADD_URI_SAFE_ATTR)&&w(Mt,n.ADD_URI_SAFE_ATTR,x),Y(n,"FORBID_CONTENTS")&&pe(n.FORB
3ID_CONTENTS)&&(se===yt&&(se=q(se)),w(se,n.FORBID_CONTENTS,x)),Y(n,"ADD_FORBID_CONTENTS")&&pe(n.ADD_FORBID_CONTENTS)&&(se===yt&&(se=q(se)),w(se,n.ADD_FORBID_CONTENTS,x)),wt&&(F["#text"]=!0),Ve&&w(F,["html","head","body"]),F.table&&(w(F,["tbody"]),delete Ue.tbody),n.TRUSTED_TYPES_POLICY){if(typeof n.TRUSTED_TYPES_POLICY.createHTML!="function")throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof n.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Te('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const d=L;L=n.TRUSTED_TYPES_POLICY;try{B=Re("")}catch(p){throw L=d,p}}else n.TRUSTED_TYPES_POLICY===null?(L=void 0,B=""):(L===void 0&&(L=va()),L&&typeof B=="string"&&(B=Re("")));z&&z(n),Ie=n},Or=w({},[...zt,...Ht,...rn]),Ir=w({},[...$t,...an]),Ka=function(n,_,d){return _.namespaceURI===ne?n==="svg":_.namespaceURI===nt?n==="svg"&&(d==="annotation-xml"||Nt[d]):!!Or[n]},Qa=function(n,_,d){return _.namespaceURI===ne?n==="math":_.namespaceURI===it?n==="math"&&xt[d]:!!Ir[n]},Ja=function(n,_,d){return _.namespaceURI===it&&!xt[d]||_.namespaceURI===nt&&!Nt[d]?!1:!Ir[n]&&(Ha[n]||!Or[n])},Za=function(n){let _=b(n);(!_||!_.tagName)&&(_={namespaceURI:Oe,tagName:"template"});const d=$e(n.tagName),p=$e(_.tagName);return Ft[n.namespaceURI]?n.namespaceURI===it?Ka(d,_,p):n.namespaceURI===nt?Qa(d,_,p):n.namespaceURI===ne?Ja(d,_,p):!!(We==="application/xhtml+xml"&&Ft[n.namespaceURI]):!1},Ae=function(n){we(e.removed,{element:n});try{b(n).removeChild(n)}catch{if(D(n),!b(n))throw Te("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ot=function(n){Xe(n);const _=P(n);if(_){const p=[];be(_,R=>{we(p,R)}),be(p,R=>{try{D(R)}catch{}})}const d=O(n);if(d)for(let p=d.length-1;p>=0;--p){const R=d[p],I=R&&R.name;if(typeof I=="string")try{n.removeAttribute(I)}catch{}}},Ce=function(n,_){try{we(e.removed,{attribute:_.getAttributeNode(n),from:_})}catch{we(e.removed,{attribute:null,from:_})}if(_.removeAttribute(n),n==="is")if(Se||rt)try{Ae(_)}catch{}else try{_.setAttribute(n,"")}catch{}},es=function(n){const _=O(n);if(_)for(let d=_.length-1;d>=0;--d){const p=_[d],R=p&&p.name;if(!(typeof R!="string"||N[x(R)]))try{n.removeAttribute(R)}catch{}}},Xe=function(n){const _=[n];for(;_.length>0;){const d=_.pop();(S?S(d):d.nodeType)===J.element&&es(d);const R=P(d);if(R)for(let I=R.length-1;I>=0;--I)_.push(R[I])}},ts=function(n){if(!fe)return;const _=[n];for(;_.length>0;){const d=_.pop(),p=S?S(d):d.nodeType;if(p===J.processingInstruction||p===J.comment&&X(qr,d.data)){try{D(d)}catch{}continue}if(p===J.element){const I=d,M=x($?$(d):d.nodeName);try{I.hasAttribute&&I.hasAttribute("patchsrc")&&I.removeAttribute("patchsrc"),I.hasAttribute&&I.hasAttribute("for")&&M!=="label"&&M!=="output"&&I.removeAttribute("for")}catch{}}const R=P(d);if(R)for(let I=R.length-1;I>=0;--I)_.push(R[I])}},Lr=function(n){let _=null,d=null;if(bt)n="<remove></remove>"+n;else{const I=kr(n,/^[\r\n\t ]+/);d=I&&I[0]}We==="application/xhtml+xml"&&Oe===ne&&(n='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+n+"</body></html>");const p=L?Re(n):n;if(Oe===ne)try{_=new h().parseFromString(p,We)}catch{}if(!_||!_.documentElement){_=Pt.createDocument(Oe,"template",null);try{_.documentElement.innerHTML=vt?B:p}catch{}}const R=_.body||_.documentElement;return n&&d&&R.insertBefore(t.createTextNode(d),R.childNodes[0]||null),Oe===ne?Na.call(_,Ve?"html":"body")[0]:Ve?_.documentElement:R},Dr=function(n){const _=te?te(n):n.ownerDocument;return lr.call(_||n,n,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},_t=function(n){return n=ze(n,ka," "),n=ze(n,Ga," "),n=ze(n,Ba," "),n},Gt=function(n){var _;n.normalize();const d=te?te(n):n.ownerDocument,p=lr.call(d||n,n,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let R=p.nextNode();for(;R;)R.data=_t(R.data),R=p.nextNode();const I=(_=n.querySelectorAll)===null||_===void 0?void 0:_.call(n,"template");I&&be(I,M=>{Le(M.content)&&Gt(M.content)})},ct=function(n){const _=$?$(n):null;return typeof _!="string"||x(_)!=="form"?!1:typeof n.nodeName!="string"||typeof n.textContent!="string"||typeof n.removeChild!="function"||n.attributes!==O(n)||typeof n.removeAttribute!="function"||typeof n.setAttribute!="function"||typeof n.namespaceURI!="string"||typeof n.insertBefore!="function"||typeof n.hasChildNodes!="function"||n.nodeType!==S(n)||n.childNodes!==P(n)},Le=function(n){if(!S||typeof n!="object"||n===null)return!1;try{return S(n)===J.documentFragment}catch{return!1}},Ye=function(n){if(!S||typeof n!="object"||n===null)return!1;try{return typeof S(n)=="number"}catch{return!1}};function ie(f,n,_){f.length!==0&&be(f,d=>{d.call(e,n,_,Ie)})}const rs=function(n,_){return!!(fe&&n.hasChildNodes()&&!Ye(n.firstElementChild)&&X($r,n.textContent)&&X($r,n.innerHTML)||fe&&n.namespaceURI===ne&&_==="style"&&Ye(n.firstElementChild)||n.nodeType===J.processingInstruction||fe&&n.nodeType===J.comment&&X(qr,n.data))},as=function(n,_,d){if(!Ue[_]&&Mr(_)&&(G.tagNameCheck instanceof RegExp&&X(G.tagNameCheck,_)||G.tagNameCheck instanceof Function&&G.tagNameCheck(_)))return!1;if(wt&&!se[_]){const p=b(n),R=P(n);if(R&&p){const I=R.length;for(let M=I-1;M>=0;--M){const k=n===d?T(R[M],!0):R[M];p.insertBefore(k,y(n))}}}return Ae(n),!0},br=function(n,_,d,p){return n.length===0?_:_===d||_===p?q(_):_},wr=function(n,_){if(ie(v.beforeSanitizeElements,n,null),n!==_&&b(n)===null)return st&&Xe(n),!0;if(ct(n))return Ae(n),!0;const d=x($?$(n):n.nodeName);if(F=br(v.uponSanitizeElement,F,Ot,et),ie(v.uponSanitizeElement,n,{tagName:d,allowedTags:F}),n!==_&&b(n)===null)return st&&Xe(n),!0;if(rs(n,d))return Ae(n),!0;if(Ue[d]||!(ue.tagCheck instanceof Function&&ue.tagCheck(d))&&!F[d]){const R=as(n,d,_);return R===!1&&ie(v.afterSanitizeElements,n,null),R}if((S?S(n):n.nodeType)===J.element&&!Za(n)||(d==="noscript"||d==="noembed"||d==="noframes")&&X(An,n.innerHTML))return Ae(n),!0;if(de&&n.nodeType===J.text){const R=_t(n.textContent);n.textContent!==R&&(we(e.removed,{element:n.cloneNode()}
3),n.textContent=R)}return ie(v.afterSanitizeElements,n,null),!1},yr=function(n,_,d){if(fr[_]||fe&&_==="patchsrc"||fe&&_==="for"&&n!=="label"&&n!=="output"||Er&&(_==="id"||_==="name")&&(d in t||d in ja))return!1;const p=N[_]||ue.attributeCheck instanceof Function&&ue.attributeCheck(_,n);if(!(Lt&&X(Ua,_))){if(!(Ar&&X(Wa,_))){if(p){if(!Mt[_]){if(!X(dr,ze(d,ur,""))){if(!((_==="src"||_==="xlink:href"||_==="href")&&n!=="script"&&Gr(d,"data:")===0&&Cr[n])){if(!(mr&&!X(Xa,ze(d,ur,"")))){if(d)return!1}}}}}else if(!(Mr(n)&&(G.tagNameCheck instanceof RegExp&&X(G.tagNameCheck,n)||G.tagNameCheck instanceof Function&&G.tagNameCheck(n))&&(G.attributeNameCheck instanceof RegExp&&X(G.attributeNameCheck,_)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(_,n))||_==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&X(G.tagNameCheck,d)||G.tagNameCheck instanceof Function&&G.tagNameCheck(d))))return!1}}return!0},ss=w({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Mr=function(n){return!ss[$e(n)]&&X(Ya,n)},ns=function(n,_,d,p){if(L&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!d)switch(E.getAttributeType(n,_)){case"TrustedHTML":return Re(p);case"TrustedScriptURL":return Ma(p)}return p},is=function(n,_,d,p){try{d?n.setAttributeNS(d,_,p):n.setAttribute(_,p),ct(n)?Ae(n):xr(e.removed)}catch{Ce(_,n)}},vr=function(n){ie(v.beforeSanitizeAttributes,n,null);const _=n.attributes;if(!_||ct(n))return;N=br(v.uponSanitizeAttribute,N,It,tt);const d={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0};let p=_.length;const R=x(n.nodeName);for(;p--;){const I=_[p],M=I.name,k=I.namespaceURI,K=I.value,Q=x(M),Ut=K;let j=M==="value"?Ut:js(Ut);if(d.attrName=Q,d.attrValue=j,d.keepAttr=!0,d.forceKeepAttr=void 0,ie(v.uponSanitizeAttribute,n,d),j=d.attrValue,pr&&(Q==="id"||Q==="name")&&Gr(j,Vr)!==0&&(Ce(M,n),j=Vr+j),fe&&X(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,j)){Ce(M,n);continue}if(Q==="attributename"&&kr(j,"href")){Ce(M,n);continue}if(!d.forceKeepAttr){if(!d.keepAttr){Ce(M,n);continue}if(!hr&&X(mn,j)){Ce(M,n);continue}if(de&&(j=_t(j)),!yr(R,Q,j)){Ce(M,n);continue}j=ns(R,Q,k,j),j!==Ut&&is(n,M,k,j)}}ie(v.afterSanitizeAttributes,n,null)},lt=function(n){let _=null;const d=Dr(n);for(ie(v.beforeSanitizeShadowDOM,n,null);_=d.nextNode();)if(ie(v.uponSanitizeShadowNode,_,null),wr(_,n),vr(_),Le(_.content)&&lt(_.content),(S?S(_):_.nodeType)===J.element){const R=g(_);Le(R)&&(Bt(R),lt(R))}ie(v.afterSanitizeShadowDOM,n,null)},Bt=function(n){const _=[{node:n,shadow:null}];for(;_.length>0;){const d=_.pop();if(d.shadow){lt(d.shadow);continue}const p=d.node,I=(S?S(p):p.nodeType)===J.element,M=P(p);if(M)for(let k=M.length-1;k>=0;--k)_.push({node:M[k],shadow:null});if(I){const k=$?$(p):null;if(typeof k=="string"&&x(k)==="template"){const K=p.content;Le(K)&&_.push({node:K,shadow:null})}}if(I){const k=g(p);Le(k)&&_.push({node:null,shadow:k},{node:k,shadow:null})}}};return e.sanitize=function(f){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=null,d=null,p=null,R=null;if(vt=!f,vt&&(f="<!-->"),typeof f!="string"&&!Ye(f)&&(f=en(f),typeof f!="string"))throw Te("dirty is not a string, aborting");if(!e.isSupported)return f;Dt?(F=et,N=tt):kt(n),(v.uponSanitizeElement.length>0||v.uponSanitizeAttribute.length>0)&&(F=q(F)),v.uponSanitizeAttribute.length>0&&(N=q(N)),e.removed=[];const I=st&&typeof f!="string"&&Ye(f);if(I){ts(f);const K=$?$(f):f.nodeName;if(typeof K=="string"){const Q=x(K);if(!F[Q]||Ue[Q])throw ot(f),Te("root node is forbidden and cannot be sanitized in-place")}if(ct(f))throw ot(f),Te("root node is clobbered and cannot be sanitized in-place");try{Bt(f)}catch(Q){throw ot(f),Q}}else if(Ye(f))_=Lr("<!---->"),d=_.ownerDocument.importNode(f,!0),d.nodeType===J.element&&d.nodeName==="BODY"||d.nodeName==="HTML"?_=d:_.appendChild(d),Bt(d);else{if(!Se&&!de&&!Ve&&f.indexOf("<")===-1)return L&&at?Re(f):f;if(_=Lr(f),!_)return Se?null:at?B:""}_&&bt&&Ae(_.firstChild);const M=I?f:_;try{const K=Dr(M);for(;p=K.nextNode();)wr(p,M),vr(p),Le(p.content)&&lt(p.content)}catch(K){throw I&&(ot(f),be(e.removed,Q=>{Q.element&&Xe(Q.element)})),K}if(I)return be(e.removed,K=>{K.element&&Xe(K.element)}),de&&Gt(f),f;if(Se){if(de&&Gt(_),rt)for(R=Fa.call(_.ownerDocument);_.firstChild;)R.appendChild(_.firstChild);else R=_;return(N.shadowroot||N.shadowrootmode)&&(R=xa.call(s,R,!0)),R}let k=Ve?_.outerHTML:_.innerHTML;return Ve&&F["!doctype"]&&_.ownerDocument&&_.ownerDocument.doctype&&_.ownerDocument.doctype.name&&X(dn,_.ownerDocument.doctype.name)&&(k="<!DOCTYPE "+_.ownerDocument.doctype.name+`>
4`+k),de&&(k=_t(k)),L&&at?Re(k):k},e.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kt(f),Dt=!0,et=F,tt=N},e.clearConfig=function(){Ie=null,Dt=!1,et=null,tt=null,L=re,B=""},e.isValidAttribute=function(f,n,_){Ie||kt({});const d=x(f),p=x(n);return yr(d,p,_)},e.addHook=function(f,n){typeof n=="function"&&Y(v,f)&&we(v[f],n)},e.removeHook=function(f,n){if(Y(v,f)){if(n!==void 0){const _=$s(v[f],n);return _===-1?void 0:qs(v[f],_,1)[0]}return xr(v[f])}},e.removeHooks=function(f){Y(v,f)&&(v[f]=[])},e.removeAllHooks=function(){v=jr()},e}Ra();
4var C=(r=>(r.NOT_IMPLEMENTED="EEE",r.LOGIC_ERR="E00",r.UNKNOWN_ERR="E01",r.IMAGE_ASSET_LOST="E02",r.VIDEO_ASSET_LOST="E03",r.FFMPEG_SPAWN_FAILED="E04",r.FILE_READ_ERROR="E05",r.VIDEO_FORMAT_ERR="E06",r.VIDEO_DECODE_ERR="E07",r.VIDEO_RENDER_ERR="E08",r.CANVAS_CTX_ERR="E09",r.VIDEO_ENCODE_ERR="E10",r.NO_SUPPORTED_CONFIG="E11",r.ENCODED_VIDEO_NOT_FOUND="E12",r.CHAR_ASSET_LOST="E13",r.SIMPLE_CHARACTER_ASSET_LOST="E14",r.WATERMARK_LOST="E15",r.DISK_WRITE_ERR="E16",r.DISK_NO_SPACE="E17",r.MUXER_ERR="E18",r.CANVAS_RENDER_EMPTY_BLOB="E19",r.MUXING_AUDIO_FAILED="E20",r.AUDIO_EXPORT_ERR="E21",r.SOURCE_LOST="E22",r.ALPHA_MODE_ERR="E23",r.ASSET_CHUNK_LOST="E24",r.CTX_LOST="E25",r.ENCODER_TIMEOUT="E26",r.ENCODER_OPERATION_ERR="E27",r.NETWORK_FAILED_ERR="E28",r.BITMAP_CREATION_ERR="E29",r.AUDIO_LOGIC_ERR="E30",r.AUDIO_DECODE_ERR="E31",r.AUDIO_ENCODE_ERR="E32",r.AUDIO_DECODER_CONFIG_ERR="E33",r.DECODER_WORKER_SPAWN_ERR="E34",r.AUDIO_FORMAT_ERR="E35",r.IMAGE_EXPORT_GENERAL_ERROR="E36",r.RENDERER_INIT_HWACCEL_UNAVAILABLE="E37",r.AUDIO_ENCODER_TIMEOUT="E38",r.AUDIO_ENCODER_CONFIG_ERR="E39",r))(C||{});const pn=()=>["avc1.64001e","avc1.64001f","avc1.640020","avc1.640028","avc1.640029","avc1.64002a","avc1.640032","avc1.640033","avc1.640034","avc1.4d401f","avc1.4d4020","avc1.4d4028","avc1.4d4029","avc1.4d401e","avc1.42E01E","avc1.42E01F","avc1.42E028"],Vn=()=>["av01.0.01M.08","av01.0.04M.08","av01.0.05M.08","av01.0.08M.08","av01.0.09M.08","av01.0.12M.08","av01.0.13M.08","av01.0.16M.08","av01.0.17M.08","av01.0.01M.10","av01.0.04M.10","av01.0.05M.10","av01.0.08M.10","av01.0.09M.10","av01.0.12M.10","av01.0.13M.10","av01.1.04M.08","av01.1.05M.08","av01.1.08M.08","av01.1.09M.08","av01.1.12M.08","av01.1.13M.08","av01.1.04M.10","av01.1.05M.10","av01.1.08M.10","av01.1.09M.10","av01.1.12M.10","av01.1.13M.10","av01.2.04M.08","av01.2.05M.08","av01.2.08M.08","av01.2.09M.08","av01.2.12M.08","av01.2.13M.08","av01.2.04M.10","av01.2.05M.10","av01.2.08M.10","av01.2.09M.10","av01.2.12M.10","av01.2.13M.10","av01.2.04M.12","av01.2.05M.12","av01.2.08M.12","av01.2.09M.12","av01.2.12M.12","av01.2.13M.12"],Cn=async(r,e)=>{for(const t of e)await r.av_packet_free_js(t)},Tn=r=>typeof r=="object"&&r!==null&&["frame"].every(t=>t in r),gn=async(r,e)=>{const t=r.codec.startsWith("avc1"),s=r.codec.startsWith("av01"),a=[r.codec,...t?pn():s?Vn():[]].flatMap(o=>{const i={...r,codec:o,hardwareAcceleration:e?"prefer-hardware":"prefer-software",optimizeForLatency:!0};return[i,{...i,hardwareAcceleration:"no-preference"}]});for(const o of a)try{if((await VideoDecoder.isConfigSupported(o)).supported)return o}catch{continue}throw V(C.NO_SUPPORTED_CONFIG,`No supported video configuration found for ${JSON.stringify(r)}`)},Fe=(r,e)=>r*4294967296+(e>>>0),qe=(r,e,t)=>e===0||t===0?U.fromSec(r):U.fromSec(r*e/t),Rn=r=>{const e=r<0?-1:1,t=Math.abs(r),s=t>>>0;return[(t/4294967296>>>0)*e,s]},Sn=(r,e,t)=>r.mul(e/t).as.sec("round");class or{_listeners={};on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;const s=this._listeners[e].indexOf(t);return s!==-1&&this._listeners[e].splice(s,1),this}subscribe(e,t){return this.on(e,t),()=>this.off(e,t)}emit(e,...t){this._listeners[e]&&this._listeners[e].forEach(s=>s(...t))}clear(){this._listeners={}}}class St{future=null;current=null;_isResolved=!1;promise(e=!1){return e&&this.reset(),this.current?this.current:this.current=new Promise((t,s)=>{this.future={resolve:t,reject:s}})}resolve(e,t=!0,s=!1){if(!this.future){if(s)return;throw new Error("No promise")}this._isResolved||(this.future.resolve(e),this._isResolved=!0,t&&this.reset())}reject(e,t=!0,s=!1){if(!this.future){if(s)return;throw new Error("No promise")}this._isResolved||(this.future.reject(e),this._isResolved=!0,t&&this.reset())}reset(){return this.current=null,this.future=null,this._isResolved=!1,this}}const Pn=8,On=4;class In extends or{_session;_logger;_decoderCtx=null;_scaleCtx=null;_eofReached=!1;_isDecodingLoopRunning=!1;_effectiveDuration=null;_lastValidTimestamp=null;_lastValidDuration=0;_packets=[];_results=[];
4_future=new St;constructor(e,t){super(),this._session=e,this._logger=t}async initialize(){return await this._setupDecoder(),this}get name(){return"LibAVDecoder"}async _setupDecoder(){this._logger.verbose(null,"setting up libav decoder"),await this._freeDecoder(),this._logger.verbose(null,"freed decoder");const e=this._session.libav,t=this._session.getVideoStream();this._logger.verbose(null,`stream: ${t.codec_id}`);try{const[,s,a,o]=await e.ff_init_decoder(t.codec_id,{codecpar:t.codecpar,time_base:[t.time_base_num,t.time_base_den]});return this._decoderCtx={stream:t,codecCtx:s,pkt:a,frame:o},this._logger.debug(null,`LibAVDecoder initialized with codec_id ${t.codec_id}`),this}catch(s){const o=xe(s).toLowerCase().includes("codec not found")?C.NO_SUPPORTED_CONFIG:C.VIDEO_DECODE_ERR;throw V(o,s)}}async destroy(){await this._freeDecoder(),await this._freeScaleContext(),this._logger.debug(null,"LibAVDecoder destroyed successfully")}async decode(e){try{const t=this._checkQueue(e)??await this._decode(e);if(t===null)return null;const s=Ln(t.frame);return{...t,frame:s}}catch(t){throw this._onError(t),t}}async seek(e){if(!this._decoderCtx)throw V(C.LOGIC_ERR,"DecoderCtx is null in seek");this._logger.debug(null,`Seeking to ${e*1e3}`),await this._session.seekFrame(e,this._decoderCtx.stream.index),await this._flushDecoder()}async _resetDecoderState(){this._eofReached=!1,this._isDecodingLoopRunning=!1,this._effectiveDuration=null,this._lastValidTimestamp=null,this._lastValidDuration=0,this._results.forEach(({frame:t})=>t.close()),this._results.splice(0,this._results.length);const e=this._packets.splice(0,this._packets.length);this._future.reset(),e.length!==0&&await Cn(this._session.libav,e)}async _flushDecoder(){if(!this._decoderCtx)return;await this._session.libav.avcodec_flush_buffers(this._decoderCtx.codecCtx),await this._resetDecoderState()}async _freeDecoder(){if(this._decoderCtx)try{const e=this._session.libav;await e.ff_free_decoder(this._decoderCtx.codecCtx,e.NULL,this._decoderCtx.frame)}finally{this._decoderCtx=null,await this._resetDecoderState()}}async _freeScaleContext(){if(!this._scaleCtx)return;const e=this._session.libav;await e.sws_freeContext(this._scaleCtx.sctx),await e.av_frame_free_js(this._scaleCtx.sout),this._scaleCtx=null}_updateEffectiveDuration(e,t){const s=t-e;s<=0||(this._effectiveDuration=s)}_checkQueue(e){for(this._logger.debug(e,`Checking cache for ${e}, top: ${this._results.at(0)?.frame.timestamp}, length: ${this._results.length}`);this._results.length>0;){const t=this._results[0],s=this._results.at(1);s&&this._updateEffectiveDuration(t.frame.timestamp,s.frame.timestamp);const a=s?s.frame.timestamp:t.frame.timestamp+(this._effectiveDuration??t.frame.duration??1),o=!this._hasMorePackets()&&!s&&e>=t.frame.timestamp;if(a>e||o)return this._logger.debug(e,`Found frame@${t.frame.timestamp}+${t.frame.duration} in cache for ${e}`),t;t.frame.close(),this._results.shift()}return null}async _decode(e){return this._logger.debug(e,`Requesting decode for ${e}`),queueMicrotask(async()=>{try{await Ke(this._decodingLoop(e),5e3,()=>this._logger.verbose(null,"LibAVDecoder decoding loop not finished after 5 seconds"))}catch(t){this._future.reject(t)}}),this._future.promise(!0)}async _decodingLoop(e){if(!this._isDecodingLoopRunning){this._isDecodingLoopRunning=!0;try{await this._runDecodingLoop(e)}catch(t){throw this._onError(t),t}finally{this._isDecodingLoopRunning=!1}}}async _runDecodingLoop(e){const t=this._session.libav;if(!this._decoderCtx)throw V(C.LOGIC_ERR,"LibAVDecoder is not initialized properly");const{index:s}=this._decoderCtx.stream;if(this._packets.length===0){const[i,c]=await Ke(this._session.readPacketsPtr(s,4194304),5e3,()=>this._logger.verbose(null,"LibAVDecoder read packets not finished after 5 seconds"));this._packets.push(...c),i&&(this._logger.verbose(e,"EOF reached",this._packets.length),this._eofReached=!0),this._hasMorePackets()||this._logger.debug(e,"No more packets to decode",this._packets.length)}const a=this._packets.splice(0,Pn);this._logger.debug(e,`Decoding ${a.length} packets`);const o=await t.ff_decode_multi(this._decoderCtx.codecCtx,this._decoderCtx.pkt,this._decoderCtx.frame,a,{ignoreErrors:!0,copyoutFrame:"ptr",fin:!this._hasMorePackets()});for(const i of o){const c=this._future.current!==null,l=await this._handleFrame(i,e);l&&(this._results.push(l),c&&(this._future.resolve(l),await new Promise(A=>queueMicrotask(()=>A()))))}this._hasMorePackets()&&this._results.length<On&&await this._runDecodingLoop(e),!this._hasMorePackets()&&this._future.current!==null&&this._results.length===0&&this._future.resolve(null,!1,!0)}async _handleFrame(e,t){const s=this._session.libav,[a,o]=await this._getTimestampAndDuration(e,t);if(a+o<t&&this._hasMorePackets())return await s.av_frame_free_js(e),null;const i=await this._toVideoFrame(e,a,o);return this._logger.debug(t,`Decoded frame@${a}+${o} for ${t}`),{frame:i,rotation:this._decoderCtx.stream.rotation}}_isNoPts(e,t){return e===void 0||t===void 0?!0:e===m.AV_NOPTS_VALUE_HI&&t===m.AV_NOPTS_VALUE_LO}_resolveTimestampAndDuration(e,t,s,a,o,i,c){const l=this._isNoPts(s,a)?0:qe(Fe(s,a),o,i).as.us("round"),A=Math.max(1,l||this._effectiveDuration||1),h=this._isNoPts(e,t)?this._lastValidTimestamp!==null?this._lastValidTimestamp+this._lastValidDuration:c:qe(Fe(e,t),o,i).as.us("round");return this._lastValidTimestamp=h,this._lastValidDuration=A,[h,l]}async _getTimestampAndDuration(e,t){if(!this._decoderCtx)throw V(C.LOGIC_ERR,"Stream is null in getTimestampAndDuration");const s=this._session.libav,a=this._decoderCtx.stream.time_base_num,o=this._decoderCtx.stream.time_base_den,i=await s.AVFrame_pts(e),c=await s.AVFrame_ptshi(e),l=await s.AVFrame_duration(e),A=await s.AVFrame_durationhi(e);return this._resolveTimestampAndDuration(c,i,A,l,a,o,t)}async _initializeScaleContext(e){this._logger.debug(null,"Initializing scale context"),await this._freeScaleContext();const t=this._session.libav,s=await t.AVFrame_width(e),a=await t.AVFrame_height(e),o=await t.AVFrame_format(e);return this._scaleCtx={sctx:await t.sws_getContext(s,a,o,s,a,m.AV_PIX_FMT_NV12,m.SWS_BILINEAR,t.NULL,t.NULL,t.NULL),sout:await t.av_frame_alloc()}}async _toVideoFrame(e,t,s){const a=this._session.libav,o=this._decoderCtx;if(!o)throw V(C.LOGIC_ERR,"LibAVDecoder is not initialized");const[i,c]=await Promise.all([a.AVFrame_format(e),a.AVFrame_height(e)]);let l=Kr(i);if(l===null)switch(await a.ff_get_pix_fmt_name(i)){case"yuv420p9le":case"yuv420p10le":l="I420P10";break;case"yuv420p12le":l="I420P12";break;case"yuv422p9le":case"yuv422p10le":l="I422P10";break;case"yuv422p12le":l="I422P12";break;case"gbrp":l="I444";break;case"yuv444p9le":case"gbrp9le":case"yuv444p10le":case"gbrp10le":l="I444P10";break;case"yuv444p12le":case"gbrp12le":l="I444P12";break}
4try{o.colorSpace===void 0&&(o.colorSpace=await fs(this._session,o.stream,o.codecCtx,i,c))}catch(A){throw await a.av_frame_free_js(e),A}if(l){const A=await a.ff_copyout_frame(e);return await a.av_frame_free_js(e),this._frameToVideoFrame(A,t,s,l)}return this._frameToVideoFrame(await this._scaleFrame(e),t,s)}async _scaleFrame(e){const t=this._session.libav,s=this._scaleCtx??await this._initializeScaleContext(e);await t.sws_scale_frame(s.sctx,s.sout,e);const a=await t.ff_copyout_frame(s.sout);return await t.av_frame_free_js(e),await t.av_frame_unref(s.sout),a}_frameToVideoFrame(e,t,s,a=Kr(e.format)){const o=this._decoderCtx;if(!a||!o)throw V(C.VIDEO_DECODE_ERR,`Invalid frame format ${e.format}`);return new VideoFrame(e.data,{format:a,codedWidth:e.width,codedHeight:e.height,timestamp:t,duration:s||0,layout:e.layout,displayWidth:e.sample_aspect_ratio?.at(0)?e.width*e.sample_aspect_ratio[0]/e.sample_aspect_ratio[1]:e.width,displayHeight:e.height,...o.colorSpace?{colorSpace:o.colorSpace}:{}})}_onError(e){const t=V(C.VIDEO_DECODE_ERR,e);this.emit("error",t)}_hasMorePackets(){return this._packets.length>0||!this._eofReached}}const Ln=r=>r.clone(),Kr=r=>{switch(r){case m.AV_PIX_FMT_YUV420P:case m.AV_PIX_FMT_YUVJ420P:return"I420";case m.AV_PIX_FMT_YUV422P:case m.AV_PIX_FMT_YUVJ422P:return"I422";case m.AV_PIX_FMT_YUV444P:case m.AV_PIX_FMT_YUVJ444P:return"I444";case m.AV_PIX_FMT_YUVA420P:return"I420A";case m.AV_PIX_FMT_NV12:return"NV12";case m.AV_PIX_FMT_RGBA:return"RGBA";case m.AV_PIX_FMT_BGRA:return"BGRA";default:return null}};class Dn{_queue=[];_logger;_effectiveDuration=null;_eof=!1;constructor(e){this._logger=e}setEof(e){this._eof=e}push(e,t=null){const s={frame:e,alphaFrame:t},a=this._queue.length;if(a===0){this._queue.push(s);return}const o=this._queue[a-1],i=e.timestamp-o.frame.timestamp;if(i>0&&(this._effectiveDuration=i),e.timestamp>=o.frame.timestamp){this._queue.push(s);return}this._logger.warn(null,`Out-of-order frame inserted: ts=${e.timestamp}, last=${o.frame.timestamp}`);let c=a-1;for(;c>=0&&this._queue[c].frame.timestamp>e.timestamp;)c--;this._queue.splice(c+1,0,s)}get(e){for(;this._queue.length>0;){const t=this._queue[0],s=t.frame.timestamp;if(e<s)return t;const a=this._queue[1];if(!a&&this._eof)return t;const o=a?a.frame.timestamp:s+(t.frame.duration||this._effectiveDuration||1);if(e<o)return t;if(!a)return null;t.frame.close(),t.alphaFrame?.close(),this._queue.shift()}return null}clear(){for(const{frame:e,alphaFrame:t}of this._queue)e.close(),t?.close();this._queue.length=0,this._effectiveDuration=null,this._eof=!1}}const bn=15,Qr=10,Jr=30;class wn{_decoder;_colorQueue=[];_alphaQueue=[];_onComposited;_onError;_logger;_queueWarned=!1;constructor(e,t,s,a){this._onComposited=t,this._onError=s,this._logger=a,this._decoder=new VideoDecoder({output:o=>this._onAlphaOutput(o),error:s}),this._decoder.configure(e)}decode(e){this._decoder.decode(e)}pushNull(){this._alphaQueue.push(null),this._tryPair()}onColorFrame(e){this._colorQueue.push(e),this._enforceQueueLimit(),this._tryPair()}_onAlphaOutput(e){this._alphaQueue.push(e),this._enforceQueueLimit(),this._tryPair()}_enforceQueueLimit(){const e=Math.max(this._colorQueue.length,this._alphaQueue.length);for(!this._queueWarned&&e>=Qr&&(this._queueWarned=!0,this._logger.warn(null,`Alpha pipeline queue depth ${e} exceeds threshold ${Qr}`));this._colorQueue.length>Jr;)this._colorQueue.shift()?.close();for(;this._alphaQueue.length>Jr;)this._alphaQueue.shift()?.close()}_tryPair(){try{for(;this._colorQueue.length>0&&this._alphaQueue.length>0;){const e=this._colorQueue.shift(),t=this._alphaQueue.shift();if(!t){this._onComposited(e,null);continue}if(Math.abs(e.timestamp-t.timestamp)>1e3){this._logger.warn(null,`Alpha/color timestamp mismatch: color=${e.timestamp} alpha=${t.timestamp}`),t.close(),this._onComposited(e,null);continue}this._onComposited(e,t)}}catch(e){this.clearQueues(),this._onError(e)}}setOnDequeue(e){this._decoder.ondequeue=e}get decodeQueueSize(){return this._decoder.decodeQueueSize}async flush(){this._decoder.state==="configured"&&await this._decoder.flush()}reset(){this._decoder.state!=="closed"&&this._decoder.reset(),this.clearQueues()}close(){this._decoder.state!=="closed"&&this._decoder.close(),this.clearQueues()}destroy(){this.close()}recreate(e){this._decoder.state!=="closed"&&this._decoder.close(),this._decoder=new VideoDecoder({output:t=>this._onAlphaOutput(t),error:this._onError}),this._decoder.configure(e),this.clearQueues()}clearQueues(){for(const e of this._colorQueue)e.close();for(const e of this._alphaQueue)e&&e.close();this._colorQueue=[],this._alphaQueue=[],this._queueWarned=!1}}class yn{_promise;constructor(){this._promise=Promise.resolve()}next(e){const t={run:()=>{}},s=new Promise((a,o)=>{t.run=()=>{try{const i=e();return i&&i instanceof Promise?i.then(a).catch(o):(a(i),i)}catch(i){return o(i),i}}});return this._promise=this._promise.then(t.run,t.run),s}}class je extends or{constructor(e,t,s){super(),this._demuxer=e,this._logger=t,this._config=s,this._frameQueue=new Dn(this._logger),this._decoder=new VideoDecoder({output:this._onOutput,error:this._handleError}),this._decoder.configure(this._config)}_demuxer;_logger;_config;_strand=new yn;_frameQueue;static DECODE_QUEUE_HIGH_WATERMARK=4;static DECODE_QUEUE_LOW_WATERMARK=2;static MAX_GOP_WINDOW=2;_isDecodingLoopRunning=!1;_isRerunning=!1;_generation=0;_forceSW=!1;_isSwConfigured=!1;_decoder;_currentRequest=null;_alphaPipeline=null;_ensureAlphaPipeline(){this._alphaPipeline||(this._alphaPipeline=new wn(this._config,(e,t)=>this._processFrame(e,t),this._handleError,this._logger))}get name(){return"WebcodecsDecoder"}async initialize(){return this}async destroy(){return this._strand.next(async()=>{try{await this._clear(),this._decoder.state!=="closed"&&this._decoder.close(),this._alphaPipeline?.destroy()}catch(e){const t=V(C.VIDEO_DECODE_ERR,e);this._logger.warn(null,"Error while destroying decoder",t.message)}finally{super.clear()}})}async clear(){return this._strand.next(async()=>{await this._clear();try{this._decoder.state!=="closed"&&this._decoder.reset(),this._alphaPipeline?.reset()}catch(e){const t=V(C.VIDEO_DECODE_ERR,e);this._logger.warn(null,"Error while resetting decoder",t.message)}finally{super.clear()}})}async _flush(){const e=[];this._decoder.state==="configured"&&e.push(tr(this._decoder.flush(),15e3)),this._alphaPipeline&&e.push(tr(this._alphaPipeline.flush(),15e3));try{await Promise.all(e)}catch(t){throw t instanceof Error&&t.message==="Timeout"?V(C.VIDEO_DECODE_ERR,"Decoder flush timeout"):t}}async _clear(){try{this._decoder.ondequeue=null,this._alphaPipeline?.setOnDequeue(null),await this._flush()}catch(e){const t=V(C.VIDEO_DECODE_ERR,e);this._logger.warn(null,"Error while clearing decoder",t.message)}finally{this._currentRequest?.future?.reject("Decoder Cleared",!0,!0),this._currentRequest=null,this._frameQueue.clear(),this._alphaPipeline?.clearQueues()}}async seek(e){return this._strand.next(async()=>{this._logger.verbose(e,"Decoder seek started"),this._currentRequest?.future?.reject(new Error("Decoder seek"),!0,
4!0),this._currentRequest=null,this._decoder.ondequeue=null,this._alphaPipeline?.setOnDequeue(null),await this._flush(),this._frameQueue.clear(),this._alphaPipeline?.clearQueues(),await this._seek(e),this._logger.verbose(e,"Decoder seek finished")})}async _seek(e,t=1){let s=e;for(;t>0&&s>=0;){if(await this._demuxer.seek(s),t===1)return;const a=await this._demuxer.next();if(!a)return;s=a.chunk.timestamp-1,t--}}async decode(e){if(e>=this._demuxer.timeRange[1])return this._logger.verbose(e,`Decoder decode: time out of range (${e} >= ${this._demuxer.timeRange[1]})`),null;const t=await Ke(this._decode(e),15e3,()=>{this._handleError(V(C.VIDEO_DECODE_ERR,"Decoder decode timeout"))});return t?{frame:t.frame,alphaFrame:t.alphaFrame??void 0,rotation:this._demuxer.rot}:null}async _decode(e){const t=this._frameQueue.get(e);return t?{frame:t.frame.clone(),alphaFrame:t.alphaFrame?.clone()??null}:this._currentRequest?.future?.promise()??this._strand.next(()=>this._scheduleDecode(e))}_scheduleDecode(e){const t={time:e,future:new St,gopWindow:1};return this._currentRequest=t,queueMicrotask(()=>this._startDecode()),t.future.promise()}_startDecode(){this._currentRequest?.future&&this._runDecodingLoopIfIdle()}_runDecodingLoopIfIdle(){this._isDecodingLoopRunning||this._currentRequest?.future&&(this._isDecodingLoopRunning=!0,this._decodingLoop().catch(e=>this._handleError(e)))}_decodingLoop=async()=>{const e=this._generation;try{for(this._decoder.ondequeue=null;this._currentRequest?.future;){const t=await this._demuxer.next();if(e!==this._generation)return;if(!t){try{await this._flush()}catch(a){this._logger.warn(Math.round(this._currentRequest.time/1e3),V(void 0,a).message,"Error in EOF")}finally{if(this._frameQueue.setEof(!0),this._currentRequest?.future){const a=this._frameQueue.get(this._currentRequest.time);a?this._currentRequest.future.resolve({frame:a.frame.clone(),alphaFrame:a.alphaFrame?.clone()??null},!0,!0):this._currentRequest.future.resolve(null,!0,!0),this._currentRequest=null,this._decoder.ondequeue=null,this._alphaPipeline?.setOnDequeue(null)}}return}if(this._decoder.state!=="configured"){const a=V(C.VIDEO_DECODE_ERR,`Decoder is ${this._decoder.state}, cannot decode`);try{this._currentRequest?.future?.reject(a,!1,!0)}finally{this._currentRequest=null,this._decoder.ondequeue=null}return}if(this._decodeAlphaData(t),this._decoder.decode(t.chunk),Math.max(this._decoder.decodeQueueSize,this._alphaPipeline?.decodeQueueSize??0)>=je.DECODE_QUEUE_HIGH_WATERMARK){const a=()=>{Math.max(this._decoder.decodeQueueSize,this._alphaPipeline?.decodeQueueSize??0)<je.DECODE_QUEUE_LOW_WATERMARK&&this._runDecodingLoopIfIdle()};this._decoder.ondequeue=a,this._alphaPipeline?.setOnDequeue(a);return}}}catch(t){e===this._generation&&this._handleError(t)}finally{e===this._generation&&(this._isDecodingLoopRunning=!1)}};_onOutput=e=>{this._alphaPipeline?this._alphaPipeline.onColorFrame(e):this._processFrame(e,null)};_decodeAlphaData(e){const t=e.sideData?.find(c=>c.type===bn),s=8,a=10*1024*1024;if(!t||t.data.length<=s){this._alphaPipeline?.pushNull();return}if(t.data.length>a){this._logger.warn(null,`BlockAdditional side data too large: ${t.data.length} bytes, skipping`),this._alphaPipeline?.pushNull();return}this._ensureAlphaPipeline();const o=t.data.subarray(s),i=new EncodedVideoChunk({type:e.chunk.type,timestamp:e.chunk.timestamp,duration:e.chunk.duration??void 0,data:o});this._alphaPipeline.decode(i)}_processFrame=(e,t)=>{try{if(!this._currentRequest){e.close(),t?.close();return}if(this._frameQueue.push(e,t),!this._currentRequest.future)return;const s=this._frameQueue.get(this._currentRequest.time);if(!s)return;this._currentRequest.future.resolve({frame:s.frame.clone(),alphaFrame:s.alphaFrame?.clone()??null}),this._currentRequest.gopWindow=1,this._currentRequest.future=null}catch(s){this._handleError(s)}};_handleError=e=>{if(this._isRerunning){this._logger.verbose(null,"Already rerunning, skip error handling");return}const t=V(C.VIDEO_DECODE_ERR,e);try{if(e instanceof DOMException)switch(e.name){case"AbortError":this._logger.verbose(null,"Decoder AbortError, do nothing");return;case"QuotaExceededError":this._logger.warn(null,"Decoder Quota Exceeded, reconfigure"),this._scheduleRerun();return;case"DataError":if(this._logger.warn(null,"Decoder DataError, reconfigure",e.message),this._currentRequest&&(this._currentRequest.gopWindow+=1,this._currentRequest.gopWindow>je.MAX_GOP_WINDOW))throw this._logger.verbose(null,"Decoder DataError, gopWindow too large, throw error"),V(C.VIDEO_DECODE_ERR,e);this._scheduleRerun();return}if(this._config.hardwareAcceleration!=="prefer-software"&&!this._forceSW){this._logger.warn(null,"Decoder Error, try to reconfigure with SW acceleration: ",t.message),this._forceSW=!0,this._scheduleRerun();return}}catch(s){this._logger.warn(null,"Another error while handling error",V(void 0,s).message)}this._fatal(t)};_scheduleRerun(){if(this._isRerunning){this._logger.verbose(null,"Already rerunning, skip schedule");return}queueMicrotask(()=>{this._tryRerun().catch(e=>{this._logger.warn(null,"Error in rerun",V(void 0,e).message),this._fatal(V(C.VIDEO_DECODE_ERR,e))})})}async _tryRerun(){if(this._isRerunning){this._logger.verbose(null,"Already rerunning, skip");return}const e=this._currentRequest,t=this._forceSW&&!this._isSwConfigured;if(!e?.future&&!t){this._logger.verbose(null,"No current request, skip rerun");return}this._isRerunning=!0,this._generation++,this._isDecodingLoopRunning=!1,this._decoder.ondequeue=null,this._alphaPipeline?.setOnDequeue(null),this._alphaPipeline?.clearQueues();try{this._decoder.state!=="closed"&&this._decoder.close(),this._decoder=new VideoDecoder({output:this._onOutput,error:this._handleError}),this._reconfigureDecoder(),e?.future?(this._frameQueue.clear(),this._logger.verbose(null,`seek to ${e.time} with window ${e.gopWindow}`),await this._seek(e.time,e.gopWindow),this._logger.verbose(null,`rerun decoder window ${e.gopWindow}`),this._startDecode()):this._logger.verbose(null,"No pending request after reconfigure")}finally{this._isRerunning=!1}}_reconfigureDecoder(){this._forceSW?(this._logger.warn(null,"force software acceleration"),this._config={...this._config,hardwareAcceleration:"prefer-software"},this._decoder.configure(this._config),this._alphaPipeline?.recreate(this._config),this._isSwConfigured=!0):(this._logger.warn(null,"try to reconfigure"),this._decoder.configure(this._config),this._alphaPipeline?.recreate(this._config))}_fatal(e){this._logger.warn(null,"Fatal Decoder Error",e.message);try{this._currentRequest?.future&&this._currentRequest.future.reject(e,!1,!0)}finally{this._currentRequest=null,this._decoder.ondequeue=null,this._alphaPipeline?.setOnDequeue(null)}
4this.emit("error",e),this.destroy()}}const Mn=r=>r.colorSpace.transfer==="pq"||r.colorSpace.transfer==="hlg"||r.colorSpace.primaries==="bt2020"||r.colorSpace.matrix==="bt2020-ncl";let Ee;const vn=(r,e)=>{if(Ee===void 0){const t=new OffscreenCanvas(r,e),s=t.getContext("2d",{colorSpace:"srgb"});return s?(Ee={canvas:t,context:s},Ee):void 0}return(Ee.canvas.width!==r||Ee.canvas.height!==e)&&(Ee.canvas.width=r,Ee.canvas.height=e),Ee},Fn=async r=>{if(!Mn(r))return r;try{const e=vn(r.displayWidth,r.displayHeight);if(!e)return r;e.context.drawImage(r,0,0,r.displayWidth,r.displayHeight);const t=await ks(e.canvas);return rr(r),t}catch{return r}};async function Nn(r,e){let t;e.codecpar?t=await r.ff_copyout_codecpar(e.codecpar):t=e;const s=await r.avcodec_get_name(t.codec_id),a={codec:"",codedWidth:t.width,codedHeight:t.height},o=t.extradata;let i=t.profile,c=t.level;switch(s){case"av1":{let l="av01";i<0&&(i=0),l+=`.0${i}`,c<0&&(c=0);let A=c.toString();A.length<2&&(A=`0${c}`),l+=`.${A}M`;const E=t.format,u=await r.av_pix_fmt_desc_get(E);let T=(await r.AVPixFmtDescriptor_comp_depth(u,0)).toString();T.length<2&&(T=`0${T}`),l+=`.${T}`;const D=await r.AVPixFmtDescriptor_nb_components(u);D<2?l+=".1":l+=".0";let y=0,P=0;const b=0;D<2?(y=1,P=1):(y=await r.AVPixFmtDescriptor_log2_chroma_w(u),P=await r.AVPixFmtDescriptor_log2_chroma_h(u)),l+=`.${y}${P}${b}`,a.codec=l;break}case"h264":{let l="avc1";if(o&&(o[0]|o[1]|o[2])===0&&o[3]===1&&(o[4]&31)===7){l+=".";for(let A=5;A<=7;A++){let h=o[A].toString(16);h.length<2&&(h="0"+h),l+=h}}else{i<0&&(i=77);const A=i&255;let h=A.toString(16);h.length<2&&(h=`0${h}`),l+=`.${h}`;let E=0;if(i&256)if(A===66)E|=224;else if(A===77)E|=96;else if(i===88)E|=32;else break;let u=E.toString(16);u.length<2&&(u=`0${u}`),l+=u,c<0&&(c=10);let T=c.toString(16);T.length<2&&(T=`0${T}`),l+=T}a.codec=l,o&&o[0]&&(a.description=o);break}case"hevc":{let l;if(o&&o.length>12){l="hvc1";const A=new DataView(o.buffer);switch(a.description=o,l+=".",o[1]>>6){case 1:l+="A";break;case 2:l+="B";break;case 3:l+="C";break}const E=o[1]&31;l+=E+".";let T=A.getUint32(2),D=0;for(let g=0;g<32&&(D|=T&1,g!==31);g++)D<<=1,T>>=1;l+=D.toString(16)+".",(o[1]&32)>>5===0?l+="L":l+="H";const P=o[12];l+=P;let b="";for(let g=11;g>=6;g--){const O=o[g];(O||b)&&(b="."+O.toString(16)+b)}l+=b}else i<0&&(i=0),c<0&&(c=0),l=`hev1.${i}.4.L${c}.B01`;a.codec=l;break}case"vp8":a.codec="vp8";break;case"vp9":{let l="vp09",A=i.toString();i<0&&(A="00"),A.length<2&&(A=`0${A}`),l+=`.${A}`;let h=c.toString();c<0&&(h="10"),h.length<2&&(h=`0${h}`),l+=`.${h}`;const E=t.format,u=await r.av_pix_fmt_desc_get(E);let T=(await r.AVPixFmtDescriptor_comp_depth(u,0)).toString();T==="0"&&(T="08"),T.length<2&&(T=`0${T}`),l+=`.${T}`;const D=await r.AVPixFmtDescriptor_log2_chroma_w(u),y=await r.AVPixFmtDescriptor_log2_chroma_h(u);let P=0;D>0&&y>0?P=1:D>0||y>0?P=2:P=3,l+=`.0${P}`,l+=".1.1.1.0",a.codec=l;break}}if(a.codec)return a;throw new Error(`Unsupported video codec: ${s}`)}function xn(r,e,t){let s=(r.durationhi||0)*4294967296+(r.duration||0),a=(r.ptshi||0)*4294967296+(r.pts||0);t&&t.i64tof64&&(s=t.i64tof64(r.duration||0,r.durationhi||0),a=t.i64tof64(r.pts||0,r.ptshi||0));let o=r.time_base_num,i=r.time_base_den;if(!o)if(e.length){const A=e;o=A[0],i=A[1]}else{const A=e;o=A.time_base_num,i=A.time_base_den}const c=Math.round(s*o/(i||1)*1e6);return{timestamp:Math.round(a*o/(i||1)*1e6),duration:c}}function kn(r,e,t){const{timestamp:s,duration:a}=xn(r,e,t);return new EncodedVideoChunk({type:(r.flags||0)&1?"key":"delta",timestamp:s,duration:a,data:r.data.buffer})}class Gn{_logger;_libAVSession;_packets=[];_isFetching=null;_stream=null;_timeRange=null;_rot=0;_eofReached=!1;constructor(e,t){this._libAVSession=e,this._logger=t}get timeRange(){if(this._timeRange===null)throw V(C.LOGIC_ERR,"timeRange is null in LibAVDemuxer");return this._timeRange}get rot(){return this._rot}async init(){this._stream=this._libAVSession.getVideoStream(),this._rot=this._stream.rotation;const e=this._libAVSession.containerStart,t=this._stream.duration>0?U.fromSec(this._stream.duration):await this._libAVSession.estimateDuration();return this._timeRange=[e.as.us("round"),e.add(t).as.us("round")],this._logger.verbose(null,`libav demuxer initialized, ${JSON.stringify(this._stream)}`,`timeRange: ${this._timeRange.join(" - ")}`,`rot: ${this._rot}`),this}async clear(){this._isFetching&&await this._isFetching,this._clear(),this._isFetching=null,this._eofReached=!1,this._stream=null,this._rot=0,this._timeRange=null}async destroy(){await this.clear()}async seek(e){if(this._stream===null)throw V(C.LOGIC_ERR,"LibAVContext is null in seek()");await this._isFetching,this._eofReached=!1,await this._libAVSession.seekFrame(e,this._stream?.index),this._clear()}async next(){if(this._packets.length===0)if(!this._eofReached&&this._isFetching===null){const t=this._read();await Ke(t,3e3,()=>{this._logger.verbose(null,"demuxer not finished after 3 seconds")})}else await this._isFetching;const e=this._packets.shift();return this._packets.length<10&&this._isFetching===null&&this._read(),e?{chunk:this._toEncodedVideoChunk(e),sideData:e.side_data}:null}async toVideoDecoderConfig(e){if(this._stream===null)throw V(C.LOGIC_ERR,"stream is null in toVideoDecoderConfig()");try{const t=await Nn(this._libAVSession.libav,this._stream),s=await this._readColorSpace(this._stream,t.codedHeight??0);
4return s&&(t.colorSpace=s),await gn(t,e)}catch(t){throw V(C.VIDEO_FORMAT_ERR,t,"error in toVideoDecoderConfig")}}async _readColorSpace(e,t){try{return await ds(this._libAVSession,e,t)}catch(s){this._logger.verbose(null,`failed to read color space, skipping injection: ${xe(s)}`);return}}serialize(){return this._packets.map(e=>`${e.pts}+${e.duration}`).join(",")}async _read(){const e=new St;this._isFetching=e.promise();try{if(this._stream===null)throw V(C.LOGIC_ERR,"LibAVContext is null in _read()");const[t,s]=await this._libAVSession.readPackets(this._stream.index,4*1024*1024);this._eofReached=t;for(const a of s)this._packets.push(a)}finally{e.resolve(),this._isFetching=null}}_toEncodedVideoChunk(e){if(this._stream===null)throw V(C.LOGIC_ERR,"LibAVContext is null in toEncodedVideoChunk()");return kn(e,this._stream,this._libAVSession.libav)}_clear(){this._packets.splice(0,this._packets.length)}}const Bn=r=>{if(!r)return r;const e=r.toLowerCase(),t=/^\/(assets|worklet|libav|locales|src|@fs)\//,s=t.test(r)||r.startsWith("/try/")&&t.test(`/${r.slice(5)}`);if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("blob:")||e.startsWith("data:")||e.startsWith("vrew-file:")||s)return r;throw V(C.LOGIC_ERR,`[assertLoadableUrl] Unconverted path reached core: ${r}`)};function Un(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var At={exports:{}},Zr;function Sa(){if(Zr)return At.exports;Zr=1;var r=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(r){var e=new Uint8Array(16);At.exports=function(){return r(e),e}}else{var t=new Array(16);At.exports=function(){for(var a=0,o;a<16;a++)(a&3)===0&&(o=Math.random()*4294967296),t[a]=o>>>((a&3)<<3)&255;return t}}return At.exports}var jt,ea;function Pa(){if(ea)return jt;ea=1;for(var r=[],e=0;e<256;++e)r[e]=(e+256).toString(16).substr(1);function t(s,a){var o=a||0,i=r;return[i[s[o++]],i[s[o++]],i[s[o++]],i[s[o++]],"-",i[s[o++]],i[s[o++]],"-",i[s[o++]],i[s[o++]],"-",i[s[o++]],i[s[o++]],"-",i[s[o++]],i[s[o++]],i[s[o++]],i[s[o++]],i[s[o++]],i[s[o++]]].join("")}return jt=t,jt}var Kt,ta;function Wn(){if(ta)return Kt;ta=1;var r=Sa(),e=Pa(),t,s,a=0,o=0;function i(c,l,A){var h=l&&A||0,E=l||[];c=c||{};var u=c.node||t,T=c.clockseq!==void 0?c.clockseq:s;if(u==null||T==null){var D=r();u==null&&(u=t=[D[0]|1,D[1],D[2],D[3],D[4],D[5]]),T==null&&(T=s=(D[6]<<8|D[7])&16383)}var y=c.msecs!==void 0?c.msecs:new Date().getTime(),P=c.nsecs!==void 0?c.nsecs:o+1,b=y-a+(P-o)/1e4;if(b<0&&c.clockseq===void 0&&(T=T+1&16383),(b<0||y>a)&&c.nsecs===void 0&&(P=0),P>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=y,o=P,s=T,y+=122192928e5;var g=((y&268435455)*1e4+P)%4294967296;E[h++]=g>>>24&255,E[h++]=g>>>16&255,E[h++]=g>>>8&255,E[h++]=g&255;var O=y/4294967296*1e4&268435455;E[h++]=O>>>8&255,E[h++]=O&255,E[h++]=O>>>24&15|16,E[h++]=O>>>16&255,E[h++]=T>>>8|128,E[h++]=T&255;for(var S=0;S<6;++S)E[h+S]=u[S];return l||e(E)}return Kt=i,Kt}var Qt,ra;function Xn(){if(ra)return Qt;ra=1;var r=Sa(),e=Pa();function t(s,a,o){var i=a&&o||0;typeof s=="string"&&(a=s==="binary"?new Array(16):null,s=null),s=s||{};var c=s.random||(s.rng||r)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,a)for(var l=0;l<16;++l)a[i+l]=c[l];return a||e(c)}return Qt=t,Qt}var Jt,aa;function Yn(){if(aa)return Jt;aa=1;var r=Wn(),e=Xn(),t=e;return t.v1=r,t.v4=e,Jt=t,Jt}var zn=Yn(),Hn=Un(zn);const sa="jsfetch:";class $n{constructor(e,t,s){this._mjsUrl=e,this._wasmUrl=t,this._logger=s}_mjsUrl;_wasmUrl;_logger;_libav=null;_libAVState=null;_lastError=null;get libav(){if(!this._libav)throw V(C.LOGIC_ERR,"LibAV is null");return this._libav}get lastError(){return this._lastError?V(void 0,this._lastError).message:""}async init(){return this._libav=await os({toImport:this._mjsUrl,wasmurl:this._wasmUrl,noworker:!0}),this}get containerStart(){if(!this._libAVState)throw V(C.LOGIC_ERR,"LibAVState is null");return this._libAVState.containerStart}getContainerVideoColorSpace(e){return this._libAVState?.containerVideoColorSpaces.get(e)}async clear(){if(!this._libAVState)return;const e=this._libav;if(!e){this._libAVState=null;return}try{this._libAVState.pkt&&await e.av_packet_free_js(this._libAVState.pkt),this._libAVState.fmt_ctx&&await e.avformat_close_input_js(this._libAVState.fmt_ctx),this._libAVState.filename&&!this._libAVState.filename.startsWith(sa)&&await e.unlinkreadaheadfile(this._libAVState.filename),this._lastError=null}catch(t){this._logger.warn(null,"Error while clearing libAV resources:",V(void 0,t).message),this._lastError=t}finally{this._libAVState=null}}async destroy(){await this.clear(),this._libav?.terminate(),this._libav=null,this._lastError=null}async openFileWithUri(e){if(!this._libav)throw V(C.LOGIC_ERR,"LibAV is null while opening file with uri");const t=Bn(e),s=sa+t;try{await this.openFile(s)}
4catch(a){throw V(navigator.onLine?C.FILE_READ_ERROR:C.NETWORK_FAILED_ERR,a,`openFileWithUri failed (navigator.onLine: ${navigator.onLine})`)}}async openFileWithBlob(e){if(!this._libav)throw V(C.LOGIC_ERR,"LibAV is null while opening file with blob");const t=Hn.v4();await this._libav.mkreadaheadfile(t,e),await this.openFile(t)}async openFile(e){return this._handleErrorAsync("openFile",async()=>{if(!this._libav)throw V(C.LOGIC_ERR,"LibAV is null while opening file");const t=this._libav;let s=0;try{if(s=await t.avformat_open_input_js(e,0,0),s===0)throw new Error("Could not open source file");const a=await this.snapshotPreAnalysisContainerVideoColorSpaces(t,s);await t.avformat_find_stream_info(s,0);const o=await this.parseStreams(t,s),i=qe(Fe(await t.AVFormatContext_start_timehi(s),await t.AVFormatContext_start_time(s)),1,1e6);this._libAVState={filename:e,fmt_ctx:s,streams:o,pkt:await t.av_packet_alloc(),containerStart:i,containerVideoColorSpaces:a}}catch(a){if(s!==0)try{await t.avformat_close_input_js(s)}catch(o){this._logger.warn(null,"Error while closing failed libAV input:",V(void 0,o).message)}throw a}})}async snapshotPreAnalysisContainerVideoColorSpaces(e,t){const s=new Map,a=await e.AVFormatContext_nb_streams(t);for(let o=0;o<a;o++){const i=await e.AVFormatContext_streams_a(t,o),c=await e.AVStream_codecpar(i);if(await e.AVCodecParameters_codec_type(c)===e.AVMEDIA_TYPE_VIDEO){const[l,A,h,E]=await Promise.all([e.AVCodecParameters_color_range(c),e.AVCodecParameters_color_primaries(c),e.AVCodecParameters_color_trc(c),e.AVCodecParameters_color_space(c)]);s.set(o,{range:l,primaries:A,trc:h,matrix:E})}}return s}async parseStreams(e,t){const s=[],a=await e.AVFormatContext_nb_streams(t);for(let o=0;o<a;o++){const i=await e.AVFormatContext_streams_a(t,o),c=await e.AVStream_codecpar(i),[l,A,h,E,u,T,D,y,P]=await Promise.all([e.AVCodecParameters_codec_type(c),e.AVCodecParameters_codec_id(c),e.AVStream_start_time(i),e.AVStream_start_timehi(i),e.AVStream_time_base_num(i),e.AVStream_time_base_den(i),e.AVStream_duration(i),e.AVStream_durationhi(i),e.avformat_get_rotation(i)]),b=Fe(y,D);s.push({ptr:i,index:o,codecpar:c,codec_type:l,codec_id:A,start_time:h,start_timehi:E,time_base_num:u,time_base_den:T,duration_time_base:b,duration:b*u/T,rotation:P})}return s}getVideoStream(){return this._handleError("getVideoStream",()=>{if(!this._libav||!this._libAVState?.streams)throw V(C.LOGIC_ERR,"libav or stream is null while getting video stream");const e=this._libav,t=this._libAVState.streams.find(s=>s.codec_type===e.AVMEDIA_TYPE_VIDEO);if(!t)throw V(C.VIDEO_FORMAT_ERR,`no video stream found, streams length: ${this._libAVState.streams.length}`);return{...t,rotation:t.rotation===-2147483648?0:t.rotation}})}async getAudioStream(){return this._handleErrorAsync("getAudioStream",async()=>{if(!this._libav||!this._libAVState?.streams)throw V(C.LOGIC_ERR,"libav or stream is null while getting audio stream");const e=this._libav,t=this._libAVState.fmt_ctx,s=this._libAVState.streams.find(a=>a.codec_type===e.AVMEDIA_TYPE_AUDIO);if(!s)throw V(C.AUDIO_FORMAT_ERR,`no audio stream found, streams length: ${this._libAVState.streams.length}`);return s.duration<0&&(s.duration=await this._libav.ff_get_media_duration(t)),s})}async estimateDuration(){return this._handleErrorAsync("estimateDuration",async()=>{if(!this._libav||!this._libAVState)throw V(C.LOGIC_ERR,"LibAV or LibAVState is null");const e=this.getVideoStream(),t=await this._libav.av_seek_frame(this._libAVState.fmt_ctx,e.index,4294967295,2147483647,this._libav.AVSEEK_FLAG_BACKWARD);if(t<0)throw V(C.VIDEO_FORMAT_ERR,`error seeking in estimateDuration(): [${t}] 
5        ff_error: ${await this._libav.ff_error(t)}
6        strerror: ${await this._libav.strerror(t)}`);const[,s]=await this.readPackets(e.index,2147483647);return await this._libav.av_seek_frame(this._libAVState.fmt_ctx,e.index,0,0,this._libav.AVSEEK_FLAG_BACKWARD),U.max(...s.map(a=>qe(Fe(a.ptshi,a.pts),e.time_base_num,e.time_base_den).add(qe(Fe(a.durationhi,a.duration),e.time_base_num,e.time_base_den))))})}async seekFrame(e,t){return this._handleErrorAsync("seekFrame",async()=>
6{if(!this._libav||!this._libAVState)throw V(C.LOGIC_ERR,"LibAV or LibAVState is null");const[s,a]=Rn(Sn(U.fromUS(e),this._libAVState.streams[t].time_base_den,this._libAVState.streams[t].time_base_num)),o=this._libAVState.streams[t].codec_type===this._libav.AVMEDIA_TYPE_VIDEO,i=this._libav.AVSEEK_FLAG_BACKWARD|(o?0:this._libav.AVSEEK_FLAG_ANY),c=await this._libav.av_seek_frame(this._libAVState.fmt_ctx,t,a,s,i);if(c<0)throw V(o?C.VIDEO_FORMAT_ERR:C.AUDIO_FORMAT_ERR,`error in av_seek_frame: [${c}] 
7        ff_error: ${await this._libav.ff_error(c)}
8        strerror: ${await this._libav.strerror(c)}`)})}async readPackets(e,t){return this._handleErrorAsync("readPackets",async()=>{if(!this._libav||!this._libAVState)throw V(C.LOGIC_ERR,"LibAV or LibAVState is null");const[s,a]=await this._libav.ff_read_frame_multi(this._libAVState.fmt_ctx,this._libAVState.pkt,{index:e,limit:t});if(s<0&&s!==-this._libav.EAGAIN&&s!==this._libav.AVERROR_EOF){const c=this._libAVState.streams[e].codec_type===this._libav.AVMEDIA_TYPE_VIDEO;throw V(c?C.VIDEO_FORMAT_ERR:C.AUDIO_FORMAT_ERR,`error in ff_read_frame_multi: [${s}] 
9        ff_error: ${await this._libav.ff_error(s)}
10        strerror: ${await this._libav.strerror(s)}`)}const o=a[e]??[];return[s===this._libav.AVERROR_EOF,o]})}async readPacketsPtr(e,t){return this._handleErrorAsync("readPacketsPtr",async()=>{if(!this._libav||!this._libAVState)throw V(C.LOGIC_ERR,"LibAV or LibAVState is null");const[s,a]=await this._libav.ff_read_frame_multi(this._libAVState.fmt_ctx,this._libAVState.pkt,{index:e,limit:t,copyoutPacket:"ptr"}),o=a[e]??[],i=s===this._libav.AVERROR_EOF;if(s<0&&s!==-this._libav.EAGAIN&&s!==this._libav.AVERROR_EOF){const c=this._libAVState.streams[e].codec_type===this._libav.AVMEDIA_TYPE_VIDEO;throw V(c?C.VIDEO_FORMAT_ERR:C.AUDIO_FORMAT_ERR,`error in ff_read_frame_multi: [${s}] 
11        ff_error: ${await this._libav.ff_error(s)}
12        strerror: ${await this._libav.strerror(s)}`)}return[i,o]})}_handleError(e,t){try{return t()}catch(s){throw this._lastError=s,this._logger.error(null,`error while ${e}`,V(void 0,s).message),s}}async _handleErrorAsync(e,t){try{return await t()}catch(s){throw this._lastError=s,this._logger.error(null,`error while ${e}`,V(void 0,s).message),s}}}const Oa=Symbol("Comlink.proxy"),qn=Symbol("Comlink.endpoint"),jn=Symbol("Comlink.releaseProxy"),Zt=Symbol("Comlink.finalizer"),pt=Symbol("Comlink.thrown"),Ia=r=>typeof r=="object"&&r!==null||typeof r=="function",Kn={canHandle:r=>Ia(r)&&r[Oa],serialize(r){const{port1:e,port2:t}=new MessageChannel;return _r(r,e),[t,[t]]},deserialize(r){return r.start(),ei(r)}},Qn={canHandle:r=>Ia(r)&&pt in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},La=new Map([["proxy",Kn],["throw",Qn]]);function Jn(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function _r(r,e=globalThis,t=["*"]){e.addEventListener("message",function s(a){if(!a||!a.data)return;if(!Jn(t,a.origin)){console.warn(`Invalid origin '${a.origin}' for comlink proxy`);return}const{id:o,type:i,path:c}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(ge);let A;try{const h=c.slice(0,-1).reduce((u,T)=>u[T],r),E=c.reduce((u,T)=>u[T],r);switch(i){case"GET":A=E;break;case"SET":h[c.slice(-1)[0]]=ge(a.data.value),A=!0;break;case"APPLY":A=E.apply(h,l);break;case"CONSTRUCT":{const u=new E(...l);A=si(u)}break;case"ENDPOINT":{const{port1:u,port2:T}=new MessageChannel;_r(r,T),A=ya(u,[u])}break;case"RELEASE":A=void 0;break;default:return}}catch(h){A={value:h,[pt]:0}}Promise.resolve(A).catch(h=>({value:h,[pt]:0})).then(h=>{const[E,u]=Rt(h);e.postMessage(Object.assign(Object.assign({},E),{id:o}),u),i==="RELEASE"&&(e.removeEventListener("message",s),Da(e),Zt in r&&typeof r[Zt]=="function"&&r[Zt]())}).catch(h=>{const[E,u]=Rt({value:new TypeError("Unserializable return value"),[pt]:0});e.postMessage(Object.assign(Object.assign({},E),{id:o}),u)})}),e.start&&e.start()}function Zn(r){return r.constructor.name==="MessagePort"}function Da(r){Zn(r)&&r.close()}function ei(r,e){const t=new Map;return r.addEventListener("message",function(a){const{data:o}=a;if(!o||!o.id)return;const i=t.get(o.id);if(i)try{i(o)}finally{t.delete(o.id)}}),nr(r,t,[],e)}function mt(r){if(r)throw new Error("Proxy has been released and is not useable")}function ba(r){return Me(r,new Map,{type:"RELEASE"}).then(()=>{Da(r)})}const Tt=new WeakMap,gt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(Tt.get(r)||0)-1;Tt.set(r,e),e===0&&ba(r)});function ti(r,e){const t=(Tt.get(e)||0)+1;Tt.set(e,t),gt&&gt.register(r,e,r)}function ri(r){gt&&gt.unregister(r)}function nr(r,e,t=[],s=function(){}){let a=!1;const o=new Proxy(s,{get(i,c){if(mt(a),c===jn)return()=>{ri(o),ba(r),e.clear(),a=!0};if(c==="then"){if(t.length===0)return{then:()=>o};const l=Me(r,e,{type:"GET",path:t.map(A=>A.toString())}).then(ge);return l.then.bind(l)}return nr(r,e,[...t,c])},set(i,c,l){mt(a);const[A,h]=Rt(l);return Me(r,e,{type:"SET",path:[...t,c].map(E=>E.toString()),value:A},h).then(ge)},apply(i,c,l){mt(a);const A=t[t.length-1];if(A===qn)return Me(r,e,{type:"ENDPOINT"}).then(ge);if(A==="bind")return nr(r,e,t.slice(0,-1));const[h,E]=na(l);
12return Me(r,e,{type:"APPLY",path:t.map(u=>u.toString()),argumentList:h},E).then(ge)},construct(i,c){mt(a);const[l,A]=na(c);return Me(r,e,{type:"CONSTRUCT",path:t.map(h=>h.toString()),argumentList:l},A).then(ge)}});return ti(o,r),o}function ai(r){return Array.prototype.concat.apply([],r)}function na(r){const e=r.map(Rt);return[e.map(t=>t[0]),ai(e.map(t=>t[1]))]}const wa=new WeakMap;function ya(r,e){return wa.set(r,e),r}function si(r){return Object.assign(r,{[Oa]:!0})}function Rt(r){for(const[e,t]of La)if(t.canHandle(r)){const[s,a]=t.serialize(r);return[{type:"HANDLER",name:e,value:s},a]}return[{type:"RAW",value:r},wa.get(r)||[]]}function ge(r){switch(r.type){case"HANDLER":return La.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Me(r,e,t,s){return new Promise(a=>{const o=ni();e.set(o,a),r.start&&r.start(),r.postMessage(Object.assign({id:o},t),s)})}function ni(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const ii=(r,e)=>ya(r,e),oi=(r,e,t)=>({debug:t?(...s)=>r.debug(...s):()=>{},verbose:(...s)=>r.verbose(...s),info:(...s)=>r.info(...s),warn:(...s)=>r.warn(...s),error:(...s)=>r.error(...s)});let oe=null,ce=null,ee=null;const _i=async(r,e,t,s,a,{forceLibAV:o,verbose:i,debug:c})=>{const l=oi(t,i,c);ee=await ci(r,s,a,l),l.verbose(null,"libAVSession initialized"),ce=await li(ee,l),l.verbose(null,"demuxer initialized"),oe=await ui(ce,ee,e,o,l),l.verbose(null,"decoder initialized")},ci=async(r,e,t,s)=>(ee?(s.verbose(null,"libAVSession already initialized, clearing"),await ee.clear()):(s.verbose(null,"initializing libAVSession"),ee=await new $n(e,t,s).init()),s.verbose(null,"opening file"),r.kind==="uri"?await ee.openFileWithUri(r.uri):await ee.openFileWithBlob(r.blob),ee),li=async(r,e)=>(ce?(e.verbose(null,"demuxer already initialized, clearing"),await ce.clear()):ce=new Gn(r,e),ce.init()),ui=async(r,e,t,s,a)=>(oe?await oe.clear():oe=new mi(a),oe.init(r,e,t,s)),di=async(r,e)=>{if(!oe)throw V(C.LOGIC_ERR,"Decoder Worker is not initialized in decode");return oe.decode(U.fromUS(r),e)},fi=async()=>{try{try{await oe?.destroy()}finally{oe=null}try{await ce?.destroy()}finally{ce=null}try{await ee?.destroy()}finally{ee=null}}finally{globalThis.close()}},Ai=async()=>{await oe?.clear(),await ce?.clear(),await ee?.clear()};class mi extends or{_logger;_factories=[];_errorFuture=new St;_timeRange=[0,Number.MAX_SAFE_INTEGER];_current=null;_lastDecodeRequest=-1;_onDecoderError=e=>{this._errorFuture.resolve(e,!1,!0)};constructor(e){super(),this._logger=e}async init(e,t,s,a){if(this._logger.verbose(null,"decoder demuxer initialized"),this._timeRange[0]=e.timeRange[0],this._timeRange[1]=e.timeRange[1],!a)try{const o=await e.toVideoDecoderConfig(s);this._factories.push(()=>new je(e,this._logger,o))}catch(o){this._logger.warn(null,`Failed to get WebCodecs config: ${xe(o)}, will use LibAV fallback`)}return this._factories.push(()=>new In(t,this._logger)),await this._next(),this}async decode(e,t){return Ke(this._decode(e,t),5e3,()=>this._logger.warn(null,"Decoder decode not finished after 5 seconds"))}async _decode(e,t){if(!this._current)throw V(C.LOGIC_ERR,"No decoder available in decode");let s;for(;;){this._errorFuture.reset();const a=this._getSeek(e,t);try{if((this._lastDecodeRequest<0||this._lastDecodeRequest>a||a-this._lastDecodeRequest>1e6)&&(this._logger.debug(Math.round(a/1e3),`Seeking from ${Math.round(this._lastDecodeRequest/1e3)} to ${Math.round(a/1e3)}`),await this._current.seek(a)),s=await Promise.race([this._errorFuture.promise(!0),this._current.decode(a)]),Tn(s)){this._lastDecodeRequest=a;try{const i=await Fn(s.frame),c=s.alphaFrame,l=[i];return c&&l.push(c),ii({frame:i,alphaFrame:c,rotation:s.rotation},l)}catch(i){throw rr(s.frame),s.alphaFrame&&rr(s.alphaFrame),i}}else if(s===null)return null}catch(i){s=V(C.VIDEO_DECODE_ERR,i)}if(this._factories.length===0)throw s;this._logger.warn(Math.round(a/1e3),`decoder error(${s?.type}): ${s?.message}, trying to recover using next decoder: ${this._factories.length}`);let o=!1;for(;this._factories.length>0;)try{await this._next(),o=!0;break}catch(i){const c=V(C.VIDEO_DECODE_ERR,i,"another error occurred while trying to switch to next decoder");this._logger.warn(null,c.message)}if(!o)throw s}}async destroy(){super.clear(),await this._current?.destroy()}async clear(){try{await this._current?.destroy()}finally{super.clear(),this._current=null,this._factories.splice(0,this._factories.length),this._errorFuture.reset(),this._lastDecodeRequest=-1}}async _next(){if(this._current){this._current.off("error",this._onDecoderError),this._logger.verbose(null,`destroying current decoder ${this._current.name}, switching to next decoder`);try{await tr(this._current.destroy(),5e3)}catch(s){this._logger.warn(null,`error while destroying current decoder: ${xe(s)}`)}}this._lastDecodeRequest=-1;const e=this._factories.shift();if(!e)throw V(C.VIDEO_DECODE_ERR,"No decoder fallback available");this._logger.verbose(null,"initializing next decoder");const t=e();await t.initialize(),this._logger.verbose(null,`next decoder ${t.name} initialized`),t.on("error",this._onDecoderError),this._logger.info(null,"decoder initialized"),this._current=t,this._errorFuture.reset()}_getSeek(e,t){const s=e.as.us("round");return t==="loop"&&s>this._timeRange[1]&&this._timeRange[1]!==0?Math.round(s%this._timeRange[1]):Fs(s,this._timeRange[0],this._timeRange[1]-1)}}_r({init:_i,decode:di,clear:Ai,destroy:fi});
13//# sourceMappingURL=decoder.worker-BdB5LWGp.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.