1import{k as _t,v as Et,g as Je}from"./messageComposition-RIfY45ev.js";import{c as At}from"./videoPoster-CBhV6PGa.js";var Ve=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},i=(e,t,r)=>(Ve(e,t,"read from private field"),r?r.call(e):t.get(e)),d=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},_=(e,t,r,s)=>(Ve(e,t,"write to private field"),t.set(e,r),r),zt=(e,t,r,s)=>({set _(a){_(e,t,a)},get _(){return i(e,t,s)}}),m=(e,t,r)=>(Ve(e,t,"access private method"),r),w=new Uint8Array(8),F=new DataView(w.buffer),S=e=>[(e%256+256)%256],v=e=>(F.setUint16(0,e,!1),[w[0],w[1]]),Mt=e=>(F.setInt16(0,e,!1),[w[0],w[1]]),st=e=>(F.setUint32(0,e,!1),[w[1],w[2],w[3]]),l=e=>(F.setUint32(0,e,!1),[w[0],w[1],w[2],w[3]]),Bt=e=>(F.setInt32(0,e,!1),[w[0],w[1],w[2],w[3]]),Z=e=>(F.setUint32(0,Math.floor(e/2**32),!1),F.setUint32(4,e,!1),[w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7]]),Le=e=>(F.setInt16(0,2**8*e,!1),[w[0],w[1]]),D=e=>(F.setInt32(0,2**16*e,!1),[w[0],w[1],w[2],w[3]]),Be=e=>(F.setInt32(0,2**30*e,!1),[w[0],w[1],w[2],w[3]]),B=(e,t=!1)=>{let r=Array(e.length).fill(null).map((s,a)=>e.charCodeAt(a));return t&&r.push(0),r},Ce=e=>e&&e[e.length-1],Pe=e=>{let t;for(let r of e)(!t||r.presentationTimestamp>t.presentationTimestamp)&&(t=r);return t},U=(e,t,r=!0)=>{let s=e*t;return r?Math.round(s):s},at=e=>{let t=e*(Math.PI/180),r=Math.cos(t),s=Math.sin(t);return[r,s,0,-s,r,0,0,0,1]},nt=at(0),ot=e=>[D(e[0]),D(e[1]),Be(e[2]),D(e[3]),D(e[4]),Be(e[5]),D(e[6]),D(e[7]),Be(e[8])],ne=e=>!e||typeof e!="object"?e:Array.isArray(e)?e.map(ne):Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ne(r)])),ee=e=>e>=0&&e<2**32,T=(e,t,r)=>({type:e,contents:t&&new Uint8Array(t.flat(10)),children:r}),y=(e,t,r,s,a)=>T(e,[S(t),st(r),s??[]],a),It=e=>{let t=512;return e.fragmented?T("ftyp",[B("iso5"),l(t),B("iso5"),B("iso6"),B("mp41")]):T("ftyp",[B("isom"),l(t),B("isom"),e.holdsAvc?B("avc1"):[],B("mp41")])},Ie=e=>({type:"mdat",largeSize:e}),Ot=e=>({type:"free",size:e}),pe=(e,t,r=!1)=>T("moov",null,[Dt(t,e),...e.map(s=>Ut(s,t)),r?ui(e):null]),Dt=(e,t)=>{let r=U(Math.max(0,...t.filter(o=>o.samples.length>0).map(o=>{const h=Pe(o.samples);return h.presentationTimestamp+h.duration})),Ue),s=Math.max(...t.map(o=>o.id))+1,a=!ee(e)||!ee(r),n=a?Z:l;return y("mvhd",+a,0,[n(e),n(e),l(Ue),n(r),D(1),Le(1),Array(10).fill(0),ot(nt),Array(24).fill(0),l(s)])},Ut=(e,t)=>T("trak",null,[Ft(e,t),Rt(e,t)]),Ft=(e,t)=>{let r=Pe(e.samples),s=U(r?r.presentationTimestamp+r.duration:0,Ue),a=!ee(t)||!ee(s),n=a?Z:l,o;return e.info.type==="video"?o=typeof e.info.rotation=="number"?at(e.info.rotation):e.info.rotation:o=nt,y("tkhd",+a,3,[n(t),n(t),l(e.id),l(0),n(s),Array(8).fill(0),v(0),v(0),Le(e.info.type==="audio"?1:0),v(0),ot(o),D(e.info.type==="video"?e.info.width:0),D(e.info.type==="video"?e.info.height:0)])},Rt=(e,t)=>T("mdia",null,[xt(e,t),Nt(e.info.type==="video"?"vide":"soun"),Wt(e)]),xt=(e,t)=>{let r=Pe(e.samples),s=U(r?r.presentationTimestamp+r.duration:0,e.timescale),a=!ee(t)||!ee(s),n=a?Z:l;return y("mdhd",+a,0,[n(t),n(t),l(e.timescale),n(s),v(21956),v(0)])},Nt=e=>y("hdlr",0,0,[B("mhlr"),B(e),l(0),l(0),l(0),B("mp4-muxer-hdlr",!0)]),Wt=e=>T("minf",null,[e.info.type==="video"?Vt():Lt(),Pt(),$t(e)]),Vt=()=>y("vmhd",0,1,[v(0),v(0),v(0),v(0)]),Lt=()=>y("smhd",0,0,[v(0),v(0)]),Pt=()=>T("dinf",null,[jt()]),jt=()=>y("dref",0,0,[l(1)],[Ht()]),Ht=()=>y("url ",0,1),$t=e=>{const t=e.compositionTimeOffsetTable.length>1||e.compositionTimeOffsetTable.some(r=>
1r.sampleCompositionTimeOffset!==0);return T("stbl",null,[qt(e),ai(e),ni(e),oi(e),li(e),hi(e),t?fi(e):null])},qt=e=>y("stsd",0,0,[l(1)],[e.info.type==="video"?Xt(bi[e.info.codec],e):ii(Si[e.info.codec],e)]),Xt=(e,t)=>T(e,[Array(6).fill(0),v(1),v(0),v(0),Array(12).fill(0),v(t.info.width),v(t.info.height),l(4718592),l(4718592),l(0),v(1),Array(32).fill(0),v(24),Mt(65535)],[Ti[t.info.codec](t),t.info.decoderConfig.colorSpace?Kt(t):null]),Gt={bt709:1,bt470bg:5,smpte170m:6},Yt={bt709:1,smpte170m:6,"iec61966-2-1":13},Zt={rgb:0,bt709:1,bt470bg:5,smpte170m:6},Kt=e=>T("colr",[B("nclx"),v(Gt[e.info.decoderConfig.colorSpace.primaries]),v(Yt[e.info.decoderConfig.colorSpace.transfer]),v(Zt[e.info.decoderConfig.colorSpace.matrix]),S((e.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),Qt=e=>e.info.decoderConfig&&T("avcC",[...new Uint8Array(e.info.decoderConfig.description)]),Jt=e=>e.info.decoderConfig&&T("hvcC",[...new Uint8Array(e.info.decoderConfig.description)]),ei=e=>{if(!e.info.decoderConfig)return null;let t=e.info.decoderConfig;if(!t.colorSpace)throw new Error("'colorSpace' is required in the decoder config for VP9.");let r=t.codec.split("."),s=Number(r[1]),a=Number(r[2]),h=(Number(r[3])<<4)+(0<<1)+Number(t.colorSpace.fullRange);return y("vpcC",1,0,[S(s),S(a),S(h),S(2),S(2),S(2),v(0)])},ti=()=>{let r=(1<<7)+1;return T("av1C",[r,0,0,0])},ii=(e,t)=>T(e,[Array(6).fill(0),v(1),v(0),v(0),l(0),v(t.info.numberOfChannels),v(16),v(0),v(0),D(t.info.sampleRate)],[ki[t.info.codec](t)]),ri=e=>{let t=new Uint8Array(e.info.decoderConfig.description);return y("esds",0,0,[l(58753152),S(32+t.byteLength),v(1),S(0),l(75530368),S(18+t.byteLength),S(64),S(21),st(0),l(130071),l(130071),l(92307584),S(t.byteLength),...t,l(109084800),S(1),S(2)])},si=e=>{var a;let t=3840,r=0;const s=(a=e.info.decoderConfig)==null?void 0:a.description;if(s){if(s.byteLength<18)throw new TypeError("Invalid decoder description provided for Opus; must be at least 18 bytes long.");const n=ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s);t=n.getUint16(10,!0),r=n.getInt16(14,!0)}return T("dOps",[S(0),S(e.info.numberOfChannels),v(t),l(e.info.sampleRate),Le(r),S(0)])},ai=e=>y("stts",0,0,[l(e.timeToSampleTable.length),e.timeToSampleTable.map(t=>[l(t.sampleCount),l(t.sampleDelta)])]),ni=e=>{if(e.samples.every(r=>r.type==="key"))return null;let t=[...e.samples.entries()].filter(([,r])=>r.type==="key");return y("stss",0,0,[l(t.length),t.map(([r])=>l(r+1))])},oi=e=>y("stsc",0,0,[l(e.compactlyCodedChunkTable.length),e.compactlyCodedChunkTable.map(t=>[l(t.firstChunk),l(t.samplesPerChunk),l(1)])]),li=e=>y("stsz",0,0,[l(0),l(e.samples.length),e.samples.map(t=>l(t.size))]),hi=e=>e.finalizedChunks.length>0&&Ce(e.finalizedChunks).offset>=2**32?y("co64",0,0,[l(e.finalizedChunks.length),e.finalizedChunks.map(t=>Z(t.offset))]):y("stco",0,0,[l(e.finalizedChunks.length),e.finalizedChunks.map(t=>l(t.offset))]),fi=e=>y("ctts",0,0,[l(e.compositionTimeOffsetTable.length),e.compositionTimeOffsetTable.map(t=>[l(t.sampleCount),l(t.sampleCompositionTimeOffset)])]),ui=e=>T("mvex",null,e.map(di)),di=e=>y("trex",0,0,[l(e.id),l(1),l(0),l(0),l(0)]),et=(e,t)=>T("moof",null,[mi(e),...t.map(ci)]),mi=e=>y("mfhd",0,0,[l(e)]),lt=e=>{let t=0,r=0,s=0,a=0,n=e.type==="delta";return r|=+n,n?t|=1:t|=2,t<<24|r<<16|s<<8|a},ci=e=>T("traf",null,[pi(e),wi(e),vi(e)]),pi=e=>{let t=0;t|=8,t|=16,t|=32,t|=131072;let r=e.currentChunk.samples[1]??e.currentChunk.samples[0],s={duration:r.timescaleUnitsToNextSample,size:r.size,flags:lt(r)};return y("tfhd",0,t,[l(e.id),l(s.duration),l(s.size),l(s.flags)])},wi=e=>y("tfdt",1,0,[Z(U(e.currentChunk.startTimestamp,e.timescale))]),vi=e=>{let t=e.currentChunk.samples.map(C=>C.timescaleUnitsToNextSample),r=e.currentChunk.samples.map(C=>C.size),s=e.currentChunk.samples.map(lt),a=e.currentChunk.samples.map(C=>U(C.presentationTimestamp-C.decodeTimestamp,e.timescale)),n=new Set(t),o=new Set(r),h=new Set(s),c=new Set(a),b=h.size===2&&s[0]!==s[1],A=n.size>1,I=o.size>1,W=!b&&h.size>1,R=c.size>1||[...c].some(C=>C!==0),p=0;return p|=1,p|=4*+b,p|=256*+A,p|=512*+I,p|=1024*+W,p|=2048*+R,y("trun",1,p,[l(e.currentChunk.samples.length),l(e.currentChunk.offset-e.currentChunk.moofOff
1set||0),b?l(s[0]):[],e.currentChunk.samples.map((C,g)=>[A?l(t[g]):[],I?l(r[g]):[],W?l(s[g]):[],R?Bt(a[g]):[]])])},gi=e=>T("mfra",null,[...e.map(yi),Ci()]),yi=(e,t)=>y("tfra",1,0,[l(e.id),l(63),l(e.finalizedChunks.length),e.finalizedChunks.map(s=>[Z(U(s.startTimestamp,e.timescale)),Z(s.moofOffset),l(t+1),l(1),l(1)])]),Ci=()=>y("mfro",0,0,[l(0)]),bi={avc:"avc1",hevc:"hvc1",vp9:"vp09",av1:"av01"},Ti={avc:Qt,hevc:Jt,vp9:ei,av1:ti},Si={aac:"mp4a",opus:"Opus"},ki={aac:ri,opus:si},Ae=class{},ht=class extends Ae{constructor(){super(...arguments),this.buffer=null}},ft=class extends Ae{constructor(e){if(super(),this.options=e,typeof e!="object")throw new TypeError("StreamTarget requires an options object to be passed to its constructor.");if(e.onData){if(typeof e.onData!="function")throw new TypeError("options.onData, when provided, must be a function.");if(e.onData.length<2)throw new TypeError("options.onData, when provided, must be a function that takes in at least two arguments (data and position). Ignoring the position argument, which specifies the byte offset at which the data is to be written, can lead to broken outputs.")}if(e.chunked!==void 0&&typeof e.chunked!="boolean")throw new TypeError("options.chunked, when provided, must be a boolean.");if(e.chunkSize!==void 0&&(!Number.isInteger(e.chunkSize)||e.chunkSize<1024))throw new TypeError("options.chunkSize, when provided, must be an integer and not smaller than 1024.")}},_i=class extends Ae{constructor(e,t){if(super(),this.stream=e,this.options=t,!(e instanceof FileSystemWritableFileStream))throw new TypeError("FileSystemWritableFileStreamTarget requires a FileSystemWritableFileStream instance.");if(t!==void 0&&typeof t!="object")throw new TypeError("FileSystemWritableFileStreamTarget's options, when provided, must be an object.");if(t&&t.chunkSize!==void 0&&(!Number.isInteger(t.chunkSize)||t.chunkSize<=0))throw new TypeError("options.chunkSize, when provided, must be a positive integer")}},$,K,ut=class{constructor(){this.pos=0,d(this,$,new Uint8Array(8)),d(this,K,new DataView(i(this,$).buffer)),this.offsets=new WeakMap}seek(e){this.pos=e}writeU32(e){i(this,K).setUint32(0,e,!1),this.write(i(this,$).subarray(0,4))}writeU64(e){i(this,K).setUint32(0,Math.floor(e/2**32),!1),i(this,K).setUint32(4,e,!1),this.write(i(this,$).subarray(0,8))}writeAscii(e){for(let t=0;t<e.length;t++)i(this,K).setUint8(t%8,e.charCodeAt(t)),t%8===7&&this.write(i(this,$));e.length%8!==0&&this.write(i(this,$).subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.pos),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.write(e.contents);else{let t=this.pos;if(this.writeBoxHeader(e,0),e.contents&&this.write(e.contents),e.children)for(let a of e.children)a&&this.writeBox(a);let r=this.pos,s=e.size??r-t;this.seek(t),this.writeBoxHeader(e,s),this.seek(r)}}writeBoxHeader(e,t){this.writeU32(e.largeSize?1:t),this.writeAscii(e.type),e.largeSize&&this.writeU64(t)}measureBoxHeader(e){return 8+(e.largeSize?8:0)}patchBox(e){let t=this.pos;this.seek(this.offsets.get(e)),this.writeBox(e),this.seek(t)}measureBox(e){if(e.contents&&!e.children)return this.measureBoxHeader(e)+e.contents.byteLength;{let t=this.measureBoxHeader(e);if(e.contents&&(t+=e.contents.byteLength),e.children)for(let r of e.children)r&&(t+=this.measureBox(r));return t}}};$=new WeakMap;K=new WeakMap;var we,Y,ue,se,ve,Oe,Ei=class extends ut{constructor(e){super(),d(this,ve),d(this,we,void 0),d(this,Y,new ArrayBuffer(2**16)),d(this,ue,new Uint8Array(i(this,Y))),d(this,se,0),_(this,we,e)}write(e){m(this,ve,Oe).call(this,this.pos+e.byteLength),i(this,ue).set(e,this.pos),this.pos+=e.byteLength,_(this,se,Math.max(i(this,se),this.pos))}finalize(){m(this,ve,Oe).call(this,this.pos),i(this,we).buffer=i(this,Y).slice(0,Math.max(i(this,se),this.pos))}};we=new WeakMap;Y=new WeakMap;ue=new WeakMap;se=new WeakMap;ve=new WeakSet;Oe=function(e){let t=i(this,Y).byteLength;for(;t<e;)t*=2;if(t===i(this,Y).byteLength)return;let r=new ArrayBuffer(t),s=new Uint8Array(r);s.set(i(this,ue),0),_(this,Y,r),_(this,ue,s)};var Ai=2**24,zi=2,oe,q,ae,N,M,be,De,je,dt,He,mt,le,Te,$e=class extends ut{constructor(e){var t,r;super(),d(this,be),d(this,je),d(this,He),d(this,le),d(this,oe,void 0),d(this,q,[]),d(this,ae,void 0),d(this,N,void 0),d(this,M,[]),_(this,oe,e),_(this,ae,((t=e.options)==null?void 0:t.chunked)??!1),_(this,N,((r=e.options)==null?void 0:r.chunkSize)??Ai)}write(e){i(this,q).push({data:e.slice(),start:this.pos}),this.pos+=e.byteLength}flush(){var r,s;if(i(this,q).length===0)return;let e=[],t=[...i(this,q)].sort((a,n)=>a.start-n.start);e.push({start:t[0].start,size:t[0].data.byteLength});for(let a=1;a<t.length;a++){let n=e[e.length-1],o=t[a];o.start<=n.start+n.size?n.size=Math.max(n.size,o.start+o.data.byteLength-n.start):e.push({start:o.start,size:o.data.byteLength})}for(let a of e){a.data=new Uint8Array(a.size);for(let n of i(this,q))a.start<=n.start&&n.start<a.start+a.size&&a.data.set(n.data,n.start-a.start);i(this,ae)?(m(this,be,De).call(this,a.data,a.start),m(this,le,Te).call(this)):(s=(r=i(this,oe).options).onData)==null||s.call(r,a.data,a.start)}i(this,q).length=0}finalize(){i(this,ae)&&m(this,le,Te).call(this,!0)}};oe=new WeakMap;q=new WeakMap;ae=new WeakMap;N=new WeakMap;M=new WeakMap;
1be=new WeakSet;De=function(e,t){let r=i(this,M).findIndex(h=>h.start<=t&&t<h.start+i(this,N));r===-1&&(r=m(this,He,mt).call(this,t));let s=i(this,M)[r],a=t-s.start,n=e.subarray(0,Math.min(i(this,N)-a,e.byteLength));s.data.set(n,a);let o={start:a,end:a+n.byteLength};if(m(this,je,dt).call(this,s,o),s.written[0].start===0&&s.written[0].end===i(this,N)&&(s.shouldFlush=!0),i(this,M).length>zi){for(let h=0;h<i(this,M).length-1;h++)i(this,M)[h].shouldFlush=!0;m(this,le,Te).call(this)}n.byteLength<e.byteLength&&m(this,be,De).call(this,e.subarray(n.byteLength),t+n.byteLength)};je=new WeakSet;dt=function(e,t){let r=0,s=e.written.length-1,a=-1;for(;r<=s;){let n=Math.floor(r+(s-r+1)/2);e.written[n].start<=t.start?(r=n+1,a=n):s=n-1}for(e.written.splice(a+1,0,t),(a===-1||e.written[a].end<t.start)&&a++;a<e.written.length-1&&e.written[a].end>=e.written[a+1].start;)e.written[a].end=Math.max(e.written[a].end,e.written[a+1].end),e.written.splice(a+1,1)};He=new WeakSet;mt=function(e){let r={start:Math.floor(e/i(this,N))*i(this,N),data:new Uint8Array(i(this,N)),written:[],shouldFlush:!1};return i(this,M).push(r),i(this,M).sort((s,a)=>s.start-a.start),i(this,M).indexOf(r)};le=new WeakSet;Te=function(e=!1){var t,r;for(let s=0;s<i(this,M).length;s++){let a=i(this,M)[s];if(!(!a.shouldFlush&&!e)){for(let n of a.written)(r=(t=i(this,oe).options).onData)==null||r.call(t,a.data.subarray(n.start,n.end),a.start+n.start);i(this,M).splice(s--,1)}}};var Mi=class extends $e{constructor(e){var t;super(new ft({onData:(r,s)=>e.stream.write({type:"write",data:r,position:s}),chunked:!0,chunkSize:(t=e.options)==null?void 0:t.chunkSize}))}},Ue=1e3,Bi=["avc","hevc","vp9","av1"],Ii=["aac","opus"],Oi=2082844800,Di=["strict","offset","cross-track-offset"],f,u,Se,z,E,k,Q,J,qe,X,G,he,Fe,ct,Re,pt,Xe,wt,xe,vt,Ge,gt,ge,Ne,O,x,Ye,yt,fe,ke,_e,Ze,te,de,ye,We,Ui=class{constructor(e){if(d(this,Fe),d(this,Re),d(this,Xe),d(this,xe),d(this,Ge),d(this,ge),d(this,O),d(this,Ye),d(this,fe),d(this,_e),d(this,te),d(this,ye),d(this,f,void 0),d(this,u,void 0),d(this,Se,void 0),d(this,z,void 0),d(this,E,null),d(this,k,null),d(this,Q,Math.floor(Date.now()/1e3)+Oi),d(this,J,[]),d(this,qe,1),d(this,X,[]),d(this,G,[]),d(this,he,!1),m(this,Fe,ct).call(this,e),e.video=ne(e.video),e.audio=ne(e.audio),e.fastStart=ne(e.fastStart),this.target=e.target,_(this,f,{firstTimestampBehavior:"strict",...e}),e.target instanceof ht)_(this,u,new Ei(e.target));else if(e.target instanceof ft)_(this,u,new $e(e.target));else if(e.target instanceof _i)_(this,u,new Mi(e.target));else throw new Error(`Invalid target: ${e.target}`);m(this,xe,vt).call(this),m(this,Re,pt).call(this)}addVideoChunk(e,t,r,s){if(!(e instanceof EncodedVideoChunk))throw new TypeError("addVideoChunk's first argument (sample) must be of type EncodedVideoChunk.");if(t&&typeof t!="object")throw new TypeError("addVideoChunk's second argument (meta), when provided, must be an object.");if(r!==void 0&&(!Number.isFinite(r)||r<0))throw new TypeError("addVideoChunk's third argument (timestamp), when provided, must be a non-negative real number.");if(s!==void 0&&!Number.isFinite(s))throw new TypeError("addVideoChunk's fourth argument (compositionTimeOffset), when provided, must be a real number.");let a=new Uint8Array(e.byteLength);e.copyTo(a),this.addVideoChunkRaw(a,e.type,r??e.timestamp,e.duration,t,s)}addVideoChunkRaw(e,t,r,s,a,n){if(!(e instanceof Uint8Array))throw new TypeError("addVideoChunkRaw's first argument (data) must be an instance of Uint8Array.");if(t!=="key"&&t!=="delta")throw new TypeError("addVideoChunkRaw's second argument (type) must be either 'key' or 'delta'.");if(!Number.isFinite(r)||r<0)throw new TypeError("addVideoChunkRaw's third argument (timestamp) must be a non-negative real number.");if(!Number.isFinite(s)||s<0)throw new TypeError("addVideoChunkRaw's fourth argument (duration) must be a non-negative real number.");if(a&&typeof a!="object")throw new TypeError("addVideoChunkRaw's fifth argument (meta), when provided, must be an object.");if(n!==void 0&&!Number.isFinite(n))throw new TypeError("addVideoChunkRaw's sixth argument (compositionTimeOffset), when provided, must be a real number.");if(m(this,ye,We).call(this),!i(this,f).video)throw new Error("No video track declared.");
1if(typeof i(this,f).fastStart=="object"&&i(this,E).samples.length===i(this,f).fastStart.expectedVideoChunks)throw new Error(`Cannot add more video chunks than specified in 'fastStart' (${i(this,f).fastStart.expectedVideoChunks}).`);let o=m(this,ge,Ne).call(this,i(this,E),e,t,r,s,a,n);if(i(this,f).fastStart==="fragmented"&&i(this,k)){for(;i(this,G).length>0&&i(this,G)[0].decodeTimestamp<=o.decodeTimestamp;){let h=i(this,G).shift();m(this,O,x).call(this,i(this,k),h)}o.decodeTimestamp<=i(this,k).lastDecodeTimestamp?m(this,O,x).call(this,i(this,E),o):i(this,X).push(o)}else m(this,O,x).call(this,i(this,E),o)}addAudioChunk(e,t,r){if(!(e instanceof EncodedAudioChunk))throw new TypeError("addAudioChunk's first argument (sample) must be of type EncodedAudioChunk.");if(t&&typeof t!="object")throw new TypeError("addAudioChunk's second argument (meta), when provided, must be an object.");if(r!==void 0&&(!Number.isFinite(r)||r<0))throw new TypeError("addAudioChunk's third argument (timestamp), when provided, must be a non-negative real number.");let s=new Uint8Array(e.byteLength);e.copyTo(s),this.addAudioChunkRaw(s,e.type,r??e.timestamp,e.duration,t)}addAudioChunkRaw(e,t,r,s,a){if(!(e instanceof Uint8Array))throw new TypeError("addAudioChunkRaw's first argument (data) must be an instance of Uint8Array.");if(t!=="key"&&t!=="delta")throw new TypeError("addAudioChunkRaw's second argument (type) must be either 'key' or 'delta'.");if(!Number.isFinite(r)||r<0)throw new TypeError("addAudioChunkRaw's third argument (timestamp) must be a non-negative real number.");if(!Number.isFinite(s)||s<0)throw new TypeError("addAudioChunkRaw's fourth argument (duration) must be a non-negative real number.");if(a&&typeof a!="object")throw new TypeError("addAudioChunkRaw's fifth argument (meta), when provided, must be an object.");if(m(this,ye,We).call(this),!i(this,f).audio)throw new Error("No audio track declared.");if(typeof i(this,f).fastStart=="object"&&i(this,k).samples.length===i(this,f).fastStart.expectedAudioChunks)throw new Error(`Cannot add more audio chunks than specified in 'fastStart' (${i(this,f).fastStart.expectedAudioChunks}).`);let n=m(this,ge,Ne).call(this,i(this,k),e,t,r,s,a);if(i(this,f).fastStart==="fragmented"&&i(this,E)){for(;i(this,X).length>0&&i(this,X)[0].decodeTimestamp<=n.decodeTimestamp;){let o=i(this,X).shift();m(this,O,x).call(this,i(this,E),o)}n.decodeTimestamp<=i(this,E).lastDecodeTimestamp?m(this,O,x).call(this,i(this,k),n):i(this,G).push(n)}else m(this,O,x).call(this,i(this,k),n)}finalize(){if(i(this,he))throw new Error("Cannot finalize a muxer more than once.");if(i(this,f).fastStart==="fragmented"){for(let t of i(this,X))m(this,O,x).call(this,i(this,E),t);for(let t of i(this,G))m(this,O,x).call(this,i(this,k),t);m(this,_e,Ze).call(this,!1)}else i(this,E)&&m(this,fe,ke).call(this,i(this,E)),i(this,k)&&m(this,fe,ke).call(this,i(this,k));let e=[i(this,E),i(this,k)].filter(Boolean);if(i(this,f).fastStart==="in-memory"){let t;for(let s=0;s<2;s++){let a=pe(e,i(this,Q)),n=i(this,u).measureBox(a);t=i(this,u).measureBox(i(this,z));let o=i(this,u).pos+n+t;for(let h of i(this,J)){h.offset=o;for(let{data:c}of h.samples)o+=c.byteLength,t+=c.byteLength}if(o<2**32)break;t>=2**32&&(i(this,z).largeSize=!0)}let r=pe(e,i(this,Q));i(this,u).writeBox(r),i(this,z).size=t,i(this,u).writeBox(i(this,z));for(let s of i(this,J))for(let a of s.samples)i(this,u).write(a.data),a.data=null}else if(i(this,f).fastStart==="fragmented"){let t=i(this,u).pos,r=gi(e);i(this,u).writeBox(r);let s=i(this,u).pos-t;i(this,u).seek(i(this,u).pos-4),i(this,u).writeU32(s)}else{let t=i(this,u).offsets.get(i(this,z)),r=i(this,u).pos-t;i(this,z).size=r,i(this,z).largeSize=r>=2**32,i(this,u).patchBox(i(this,z));let s=pe(e,i(this,Q));if(typeof i(this,f).fastStart=="object"){i(this,u).seek(i(this,Se)),i(this,u).writeBox(s);let a=t-i(this,u).pos;i(this,u).writeBox(Ot(a))}else i(this,u).writeBox(s)}m(this,te,de).call(this),i(this,u).finalize(),_(this,he,!0)}};f=new WeakMap;u=new WeakMap;Se=new WeakMap;z=new WeakMap;E=new WeakMap;k=new WeakMap;Q=new WeakMap;J=new WeakMap;qe=new WeakMap;X=new WeakMap;G=new WeakMap;he=new WeakMap;Fe=new WeakSet;ct=function(e){if(typeof e!="object")throw new TypeError("The muxer requires an options object to be passed to its constructor.");if(!(e.target instanceof Ae))throw new TypeError("The target must be provided and an instance of Target.");if(e.video){if(!Bi.includes(e.video.codec))throw new TypeError(`Unsupported video codec: ${e.video.codec}`);if(!Number.isInteger(e.video.width)||e.video.width<=0)throw new TypeError(`Invalid video width: ${e.video.width}. Must be a positive integer.`);if(!Number.isInteger(e.video.height)||e.video.height<=0)throw new TypeError(`Invalid video height: ${e.video.height}. Must be a positive integer.`);const t=e.video.rotation;if(typeof t=="number"&&![0,90,180,270].includes(t))throw new TypeError(`Invalid video rotation: ${t}. Has to be 0, 90, 180 or 270.`);if(Array.isArray(t)&&(t.length!==9||t.some(r=>typeof r!="number")))throw new TypeError(`Invalid video transformation matrix: ${t.join()}`);if(e.video.frameRate!==void 0&&(!Number.isInteger(e.video.frameRate)||e.video.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${e.video.frameRate}. Must be a positive integer.`)}if(e.audio){if(!Ii.includes(e.audio.codec))throw new TypeError(`Unsupported audio codec: ${e.audio.codec}`);if(!Number.isInteger(e.audio.numberOfChannels)||e.audio.numberOfChannels<=0)throw new TypeError(`Invalid number of audio channels: ${e.audio.numberOfChannels}. Must be a positive integer.`);if(!Number.isInteger(e.audio.sampleRate)||e.audio.sampleRate<=0)throw new TypeError(`Invalid audio sample rate: ${e.audio.sampleRate}. Must be a positive integer.`)}if(e.firstTimestampBehavior&&!Di.includes(e.firstTimestampBehavior))throw new TypeError(`Invalid first timestamp behavior: ${e.firstTimestampBehavior}`);if(typeof e.fastStart=="object"){if(e.video){if(e.fastStart.expectedVideoChunks===void 0)throw new TypeError("'fastStart' is an object but is missing property 'expectedVideoChunks'.");if(!Number.isInteger(e.fastStart.expectedVideoChunks)||e.fastStart.expectedVideoChunks<0)throw new TypeError("'expectedVideoChunks' must be a non-negative integer.")}if(e.audio){if(e.fastStart.expectedAudioChunks===void 0)throw new TypeError("'fastStart' is an object but is missing property 'expectedAudioChunks'.");if(!Number.isInteger(e.fastStart.expectedAudioChunks)||e.fastStart.expectedAudioChunks<0)throw new TypeError("'expectedAudioChunks' must be a non-negative integer.")}}else if(![!1,"in-memory","fragmented"].includes(e.fastStart))throw new TypeError("'fastStart' option must be false, 'in-memory', 'fragmented' or an object.");if(e.minFragmentDuration!==void 0&&(!Number.isFinite(e.minFragmentDuration)||e.minFragmentDuration<0))throw new TypeError("'minFragmentDuration' must be a non-negative number.")};Re=new WeakSet;pt=function(){var e;if(i(this,u).writeBox(It({holdsAvc:((e=i(this,f).video)==null?void 0:e.codec)==="avc",fragmented:i(this,f).fastStart==="fragmented"})),_(this,Se,i(this,u).pos),i(this,f).fastStart==="in-memory")_(this,z,Ie(!1));else if(i(this,f).fastStart!=="fragmented"){if(typeof i(this,f).fastStart=="object"){let t=m(this,Xe,wt).call(this);i(this,u).seek(i(this,u).pos+t)}_(this,z,Ie(!0)),i(this,u).writeBox(i(this,z))}m(this,te,de).call(this)};Xe=new WeakSet;wt=function(){if(typeof i(this,f).fastStart!="object")return;let e=0,t=[i(this,f).fastStart.expectedVideoChunks,i(this,f).fastStart.expectedAudioChunks];for(let r of t)r&&(e+=8*Math.ceil(2/3*r),e+=4*r,e+=12*Math.ceil(2/3*r),e+=4*r,e+=8*r);return e+=4096,e};xe=new WeakSet;vt=function(){if(i(this,f).video&&_(this,E,{id:1,info:{type:"video",codec:i(this,f).video.codec,width:i(this,f).video.width,height:i(this,f).video.height,rotation:i(this,f).video.rotation??0,decoderConfig:null},timescale:i(this,f).video.frameRate??57600,samples:[],finalizedChunks:[],currentChunk:null,firstDecodeTimestamp:void 0,lastDecodeTimestamp:-1,timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,compactlyCodedChunkTable:[]}),i(this,f).audio&&(_(this,k,{id:i(this,f).video?2:1,info:{type:"audio",codec:i(this,f).audio.codec,numberOfChannels:i(this,f).audio.numberOfChannels,sampleRate:i(this,f).audio.sampleRate,decoderConfig:null},timescale:i(this,f).audio.sampleRate,samples:[],finalizedChunks:[],currentChunk:null,firstDecodeTimestamp:void 0,lastDecodeTimestamp:-1,timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,compactlyCodedChunkTable:[]}),i(this,f).audio.codec==="aac")){let e=m(this,Ge,gt).call(this,2,i(this,f).audio.sampleRate,i(this,f).audio.numberOfChannels);i(this,k).info.decoderConfig={codec:i(this,f).audio.codec,description:e,numberOfChannels:i(this,f).audio.numberOfChannels,sampleRate:i(this,f).audio.sampleRate}}};Ge=new WeakSet;
1gt=function(e,t,r){let a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350].indexOf(t),n=r,o="";o+=e.toString(2).padStart(5,"0"),o+=a.toString(2).padStart(4,"0"),a===15&&(o+=t.toString(2).padStart(24,"0")),o+=n.toString(2).padStart(4,"0");let h=Math.ceil(o.length/8)*8;o=o.padEnd(h,"0");let c=new Uint8Array(o.length/8);for(let b=0;b<o.length;b+=8)c[b/8]=parseInt(o.slice(b,b+8),2);return c};ge=new WeakSet;Ne=function(e,t,r,s,a,n,o){let h=s/1e6,c=(s-(o??0))/1e6,b=a/1e6,A=m(this,Ye,yt).call(this,h,c,e);return h=A.presentationTimestamp,c=A.decodeTimestamp,n!=null&&n.decoderConfig&&(e.info.decoderConfig===null?e.info.decoderConfig=n.decoderConfig:Object.assign(e.info.decoderConfig,n.decoderConfig)),{presentationTimestamp:h,decodeTimestamp:c,duration:b,data:t,size:t.byteLength,type:r,timescaleUnitsToNextSample:U(b,e.timescale)}};O=new WeakSet;x=function(e,t){i(this,f).fastStart!=="fragmented"&&e.samples.push(t);const r=U(t.presentationTimestamp-t.decodeTimestamp,e.timescale);if(e.lastTimescaleUnits!==null){let a=U(t.decodeTimestamp,e.timescale,!1),n=Math.round(a-e.lastTimescaleUnits);if(e.lastTimescaleUnits+=n,e.lastSample.timescaleUnitsToNextSample=n,i(this,f).fastStart!=="fragmented"){let o=Ce(e.timeToSampleTable);o.sampleCount===1?(o.sampleDelta=n,o.sampleCount++):o.sampleDelta===n?o.sampleCount++:(o.sampleCount--,e.timeToSampleTable.push({sampleCount:2,sampleDelta:n}));const h=Ce(e.compositionTimeOffsetTable);h.sampleCompositionTimeOffset===r?h.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:r})}}else e.lastTimescaleUnits=0,i(this,f).fastStart!=="fragmented"&&(e.timeToSampleTable.push({sampleCount:1,sampleDelta:U(t.duration,e.timescale)}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:r}));e.lastSample=t;let s=!1;if(!e.currentChunk)s=!0;else{let a=t.presentationTimestamp-e.currentChunk.startTimestamp;if(i(this,f).fastStart==="fragmented"){let n=i(this,E)??i(this,k);const o=i(this,f).minFragmentDuration??1;e===n&&t.type==="key"&&a>=o&&(s=!0,m(this,_e,Ze).call(this))}else s=a>=.5}s&&(e.currentChunk&&m(this,fe,ke).call(this,e),e.currentChunk={startTimestamp:t.presentationTimestamp,samples:[]}),e.currentChunk.samples.push(t)};Ye=new WeakSet;yt=function(e,t,r){var o,h;const s=i(this,f).firstTimestampBehavior==="strict",a=r.lastDecodeTimestamp===-1;if(s&&a&&t!==0)throw new Error(`The first chunk for your media track must have a timestamp of 0 (received DTS=${t}).Non-zero first timestamps are often caused by directly piping frames or audio data from a MediaStreamTrack into the encoder. Their timestamps are typically relative to the age of thedocument, which is probably what you want. 2 3If you want to offset all timestamps of a track such that the first one is zero, set firstTimestampBehavior: 'offset' in the options. 4`);if(i(this,f).firstTimestampBehavior==="offset"||i(this,f).firstTimestampBehavior==="cross-track-offset"){r.firstDecodeTimestamp===void 0&&(r.firstDecodeTimestamp=t);let c;i(this,f).firstTimestampBehavior==="offset"?c=r.firstDecodeTimestamp:c=Math.min(((o=i(this,E))==null?void 0:o.firstDecodeTimestamp)??1/0,((h=i(this,k))==null?void 0:h.firstDecodeTimestamp)??1/0),t-=c,e-=c}if(t<r.lastDecodeTimestamp)throw new Error(`Timestamps must be monotonically increasing (DTS went from ${r.lastDecodeTimestamp*1e6} to ${t*1e6}).`);return r.lastDecodeTimestamp=t,{presentationTimestamp:e,decodeTimestamp:t}};fe=new WeakSet;ke=function(e){if(i(this,f).fastStart==="fragmented")throw new Error("Can't finalize individual chunks if 'fastStart' is set to 'fragmented'.");if(e.currentChunk){if(e.finalizedChunks.push(e.currentChunk),i(this,J).push(e.currentChunk),(e.compactlyCodedChunkTable.length===0||Ce(e.compactlyCodedChunkTable).samplesPerChunk!==e.currentChunk.samples.length)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:e.currentChunk.samples.length}),i(this,f).fastStart==="in-memory"){e.currentChunk.offset=0;return}e.currentChunk.offset=i(this,u).pos;for(let t of e.currentChunk.samples)i(this,u).write(t.data),t.data=null;m(this,te,de).call(this)}};_e=new WeakSet;Ze=function(e=!0){if(i(this,f).fastStart!=="fragmented")throw new Error("Can't finalize a fragment unless 'fastStart' is set to 'fragmented'.");let t=[i(this,E),i(this,k)].filter(h=>h&&h.currentChunk);if(t.length===0)return;let r=zt(this,qe)._++;if(r===1){let h=pe(t,i(this,Q),!0);i(this,u).writeBox(h)}let s=i(this,u).pos,a=et(r,t);i(this,u).writeBox(a);{let h=Ie(!1),c=0;for(let A of t)for(let I of A.currentChunk.samples)c+=I.size;let b=i(this,u).measureBox(h)+c;b>=2**32&&(h.largeSize=!0,b=i(this,u).measureBox(h)+c),h.size=b,i(this,u).writeBox(h)}for(let h of t){h.currentChunk.offset=i(this,u).pos,h.currentChunk.moofOff
4set=s;for(let c of h.currentChunk.samples)i(this,u).write(c.data),c.data=null}let n=i(this,u).pos;i(this,u).seek(i(this,u).offsets.get(a));let o=et(r,t);i(this,u).writeBox(o),i(this,u).seek(n);for(let h of t)h.finalizedChunks.push(h.currentChunk),i(this,J).push(h.currentChunk),h.currentChunk=null;e&&m(this,te,de).call(this)};te=new WeakSet;de=function(){i(this,u)instanceof $e&&i(this,u).flush()};ye=new WeakSet;We=function(){if(i(this,he))throw new Error("Cannot add new video or audio chunks after the file has been finalized.")};const Ke=13*1024*1024,Ct=1280,Ee=4e5,Fi=4e6,bt="avc1.42001f";function Ri(e,t,r=Ct){const s=Math.round(Number(e)||0),a=Math.round(Number(t)||0);if(s<=0||a<=0)return null;const n=s>r?r/s:1,o=h=>Math.max(2,Math.round(h/2)*2);return{width:o(s*n),height:o(a*n)}}function xi(e,t=Ke){const r=Number(e);if(!Number.isFinite(r)||r<=0)return Ee;const s=t*8;return Math.min(Fi,Math.max(Ee,Math.floor(s/r)))}function Ni(e,t=Ke){const r=Number(e);return!Number.isFinite(r)||r<=0?!1:Ee*r/8>t}function tt(e,t){return Number(e||0)>Number(t||0)}async function Tt(e={}){const{VideoEncoderImpl:t=typeof VideoEncoder<"u"?VideoEncoder:null}=e;if(!t)return{ok:!1,reason:"no_webcodecs"};try{const r=await t.isConfigSupported({codec:bt,width:640,height:360,bitrate:Ee});return r!=null&&r.supported?{ok:!0}:{ok:!1,reason:"no_h264"}}catch{return{ok:!1,reason:"no_h264"}}}function Wi(e){return typeof e.mozHasAudio=="boolean"?e.mozHasAudio:typeof e.webkitAudioDecodedByteCount=="number"?e.webkitAudioDecodedByteCount>0:e.audioTracks&&typeof e.audioTracks.length=="number"?e.audioTracks.length>0:!1}async function Vi(e,{targetBytes:t=Ke,maxWidth:r=Ct,onProgress:s,deps:a={}}={}){const{VideoEncoderImpl:n=typeof VideoEncoder<"u"?VideoEncoder:null,VideoFrameImpl:o=typeof VideoFrame<"u"?VideoFrame:null,MuxerImpl:h=Ui,TargetImpl:c=ht,createObjectURL:b=g=>URL.createObjectURL(g),revokeObjectURL:A=g=>URL.revokeObjectURL(g),createVideo:I=()=>document.createElement("video")}=a;if(!e)return{ok:!1,reason:"no_file"};const W=await Tt({VideoEncoderImpl:n});if(!W.ok)return{ok:!1,reason:W.reason};if(!o)return{ok:!1,reason:"no_webcodecs"};let R="";try{R=b(e)}catch{return{ok:!1,reason:"no_file"}}const p=I();let C=null;try{const g=await new Promise(j=>{const V=H=>j(H);p.addEventListener("error",()=>V(null),{once:!0}),p.addEventListener("loadedmetadata",()=>V({width:p.videoWidth,height:p.videoHeight,duration:p.duration}),{once:!0}),p.muted=!0,p.playsInline=!0,p.preload="auto",p.src=R});if(!g)return{ok:!1,reason:"undecodable"};const L=Ri(g.width,g.height,r);if(!L)return{ok:!1,reason:"undecodable"};const P=Number.isFinite(g.duration)&&g.duration>0?g.duration:0;if(!P)return{ok:!1,reason:"unknown_duration"};if(Ni(P,t))return{ok:!1,reason:"too_long",durationSec:P};const ze=new h({target:new c,video:{codec:"avc",width:L.width,height:L.height},fastStart:"in-memory"});let ie=null;C=new n({output:(j,V)=>{try{ze.addVideoChunk(j,V)}catch(H){ie=H}},error:j=>{ie=j}}),C.configure({codec:bt,width:L.width,height:L.height,bitrate:xi(P,t),framerate:30,avc:{format:"avc"}});const St=Wi(p);let me=0;if(await new Promise((j,V)=>{const H=()=>j();p.addEventListener("ended",H,{once:!0}),p.addEventListener("error",()=>V(new Error("playback")),{once:!0});const Qe=(Li,Me)=>{if(ie)return H();try{const ce=new o(p,{timestamp:Math.round(((Me==null?void 0:Me.mediaTime)??p.currentTime)*1e6)});C.encode(ce,{keyFrame:me%60===0}),ce.close(),me+=1,s&&P&&s(Math.min(.99,p.currentTime/P))}catch(ce){return ie=ce,H()}p.ended||p.requestVideoFrameCallback(Qe)};if(typeof p.requestVideoFrameCallback!="function")return V(new Error("no_rvfc"));p.requestVideoFrameCallback(Qe),p.play().catch(()=>V(new Error("playback")))}),ie)return{ok:!1,reason:"encode_failed"};if(!me)return{ok:!1,reason:"no_frames"};await C.flush(),ze.finalize();const re=ze.target.buffer;if(!re||!re.byteLength)return{ok:!1,reason:"encode_failed"};if(re.byteLength>=e.size)return{ok:!1,reason:"no_gain",bytes:re.byteLength};const kt=String(e.name||"video").replace(/\.[^.]+$/,"");return{ok:!0,file:new File([re],`${kt}.mp4`,{type:"video/mp4"}),droppedAudio:St,width:L.width,height:L.height,durationSec:P,frames:me}}catch(g){return{ok:!1,reason:(g==null?void 0:g.message)==="no_rvfc"?"no_frame_callback":"encode_failed"}}finally{try{C&&C.state!=="closed"&&C.close()}catch{}try{p.pause(),p.removeAttribute("src"),p.load()}catch{}try{A(R)}catch{}s&&s(1)}}const it={no_webcodecs:"××פ××¤× ××× ×× ×ª××× ××××סת ×××××. × ×¡× ×-Chrome ×× ×-Edge ××¢×××× ××, ×× ××¢×× ×§×××¥ ×§×× ×-16MB.",no_h264:"××פ××¤× ××× ×× ××××¢ ××§××× H.264. × ×¡× ×-Chrome ×× ×-Edge ××¢×××× ××, ×× ××¢×× ×§×××¥ ×§×× ×-16MB.",no_frame_callback:"××פ××¤× ××× ×× ×ª××× ×קר××ת פר××××× ××סר×××. × ×¡× ×-Chrome ×× ×-Edge ××¢×××× ××.",undecodable:"×× × ××ª× ×קר×× ×ת ×סר×××. ×××× ×©××× ×§×××¥ MP4 תק××.",unknown_duration:"×× × ××ª× ××§×××¢ ×ת ×××¨× ×סר×××, ×××× ×× ×פשר ×××©× ×××ס×.",no_frames:"×× × ×§×¨×× ×¤×¨××××× ××סר×××.",encode_failed:"×××××¡× × ×ש××. × ×¡× ×§×××¥ ××ר ×× ××¢×× ×¡×¨××× ×§×× ×-16MB.",no_file:"×× × ××ר ×§×××¥.",too_long:"×סר××× ×ר×× ××× ×××× ××××× ×¡ ×××××ת 16MB ×©× Meta ×× ×××¨× ×××ס×. ×§×¦×¨× ×××ª× ×× ×¡× ×©××.",no_gain:"×סר××× ××ר ×××ס ×××¢×××ת â ××××¡× × ×ספת רק ת×××× ××ת×. × ×רש ×§×××¥ קצר ×× ×§×× ××תר."},rt=e=>it[e]||it.encode_failed;async function Hi(e,t={}){var R,p;const{upload:r,ask:s=async()=>!0,onStage:a=()=>{},onProgress:n=()=>{},limit:o=_t}=t;if(!e)return{ok:!1,error:"×× × ××ר ×§×××¥"};if(typeof r!="function")return{ok:!1,error:"×× ×××××¨× ×¤×× ×§×¦××ת ××¢×××"};
4a("validating");const h=Et(e);if(!h.ok&&!tt(e.size,o))return{ok:!1,error:h.error};if(!h.ok&&!/×××× ×××/.test(h.error||""))return{ok:!1,error:h.error};let c=e,b=!1,A=!1;if(tt(e.size,o)){const C=await Tt();if(!C.ok)return{ok:!1,error:rt(C.reason)};if(!await s(`×סר××× ×©××§× ${Je(e.size)} â ××¢× ××××ת 16MB ×©× Meta. 5 6××××ס ×××ª× ×¢×ש××? ×××××¡× ×¨×¦× ××פ××¤× ×××ר×ת ××¢×¨× ××××¨× ×סר×××.`))return{ok:!1,cancelled:!0};a("compressing");const g=await Vi(e,{onProgress:n});if(!g.ok)return{ok:!1,error:rt(g.reason)};if(g.droppedAudio&&!await s(`×××××¡× ××פ××¤× ××× × ×©××רת ×ת פס ××§××, ××סר××× ××ש×× ××× ×××××. 7 8×××ש××?`))return{ok:!1,cancelled:!0};if(c=g.file,b=!0,A=g.droppedAudio,c.size>o)return{ok:!1,error:`×× ×××¨× ××××¡× ×סר××× ×©××§× ${Je(c.size)}, ××¢× ××××ת 16MB. ×§×¦×¨× ×××ª× ×× ×¡× ×©××.`}}a("uploading");let I="";try{I=((R=await r(c))==null?void 0:R.file_url)||""}catch{return{ok:!1,error:"ש×××× ×××¢××ת ×סר×××"}}if(!I)return{ok:!1,error:"ש×××× ×××¢××ת ×סר×××"};a("poster");let W="";try{const C=await At(c);C&&(W=((p=await r(C))==null?void 0:p.file_url)||"")}catch{}return{ok:!0,url:I,poster:W,name:c.name,size:c.size,compressed:b,droppedAudio:A}}const $i={validating:"××××§ ×ת ××§×××¥â¦",compressing:"×××ס ×ת ×סר×××â¦",uploading:"××¢×× ×ת ×סר×××â¦",poster:"×××× ×ª××× × ××סר×××â¦"};export{$i as V,Hi as p};
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.