polotno-node 2.15.15 → 2.15.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/assets/{chunk-DseTPa7n.js → chunk-DECur_0Z.js} +1 -1
- package/dist/assets/{html2canvas--2MclApJ.js → html2canvas-CFzV-G5G.js} +2 -2
- package/dist/assets/id3-D55z-fRR.js +15 -0
- package/dist/assets/index-QaF0YGOe.js +330 -0
- package/dist/assets/index.es-DGqSPkoI.js +5 -0
- package/dist/assets/jspdf.es.min-DQ47o5Bu.js +79 -0
- package/dist/assets/lib-DjVS41Qk.js +65 -0
- package/dist/assets/preload-helper-xBbMyY7u.js +1 -0
- package/dist/assets/purify.es-CuTrUsFy.js +2 -0
- package/dist/index.html +4 -2
- package/instance.js +107 -68
- package/package.json +11 -11
- package/dist/assets/index-B1NWkbV5.js +0 -332
- package/dist/assets/index.es-CmkIkXI3.js +0 -5
- package/dist/assets/jspdf.es.min-CBRoYge0.js +0 -79
- package/dist/assets/lib-Cm7bIAAZ.js +0 -65
- package/dist/assets/purify.es-COCIDc1i.js +0 -2
- /package/dist/assets/{typeof-GPCnPm50.js → typeof-B5P0Path.js} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import"./chunk-DECur_0Z.js";import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as ee,T as te,U as ne,V as re,W as ie,X as ae,Y as oe,Z as se,_ as ce,_t as le,a as ue,at as de,b as fe,c as pe,ct as y,d as me,dt as he,et as ge,f as _e,ft as ve,g as ye,gt as b,h as x,ht as S,i as be,it as xe,j as C,k as w,l as Se,lt as Ce,m as we,mt as Te,n as Ee,nt as De,o as Oe,ot as T,p as ke,pt as Ae,q as je,r as Me,rt as E,s as Ne,st as Pe,t as Fe,tt as D,ut as O,v as Ie,w as Le,x as Re,y as ze,z as Be}from"./id3-D55z-fRR.js";var Ve=class{constructor(e){this.mutex=new ae,this.firstMediaStreamTimestamp=null,this.trackTimestampInfo=new WeakMap,this.output=e}onTrackClose(e){}validateAndNormalizeTimestamp(e,t,n){if(t+=e.source._timestampOffset,t<0)throw Error(`Timestamps must be non-negative (got ${t}s).`);let r=this.trackTimestampInfo.get(e);if(r){if(n&&(r.maxTimestampBeforeLastKeyPacket=r.maxTimestamp),r.maxTimestampBeforeLastKeyPacket!==null&&t<r.maxTimestampBeforeLastKeyPacket)throw Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key packet and ends right before the next key packet). Got ${t}s, but largest timestamp is ${r.maxTimestampBeforeLastKeyPacket}s.`);r.maxTimestamp=Math.max(r.maxTimestamp,t)}else{if(!n)throw Error(`First packet must be a key packet.`);r={maxTimestamp:t,maxTimestampBeforeLastKeyPacket:null},this.trackTimestampInfo.set(e,r)}return t}},He=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g,Ue=e=>{let t=Math.floor(e/(3600*1e3)),n=Math.floor(e%(3600*1e3)/(60*1e3)),r=Math.floor(e%(60*1e3)/1e3),i=e%1e3;return t.toString().padStart(2,`0`)+`:`+n.toString().padStart(2,`0`)+`:`+r.toString().padStart(2,`0`)+`.`+i.toString().padStart(3,`0`)},We=class{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,Math.floor(e/2**32),!1),this.helperView.setUint32(4,e,!1),this.writer.write(this.helper.subarray(0,8))}writeAscii(e){for(let t=0;t<e.length;t++)this.helperView.setUint8(t%8,e.charCodeAt(t)),t%8==7&&this.writer.write(this.helper);e.length%8!=0&&this.writer.write(this.helper.subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.writer.getPos()),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.writer.write(e.contents);else{let t=this.writer.getPos();if(this.writeBoxHeader(e,0),e.contents&&this.writer.write(e.contents),e.children)for(let t of e.children)t&&this.writeBox(t);let n=this.writer.getPos(),r=e.size??n-t;this.writer.seek(t),this.writeBoxHeader(e,r),this.writer.seek(n)}}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.offsets.get(e);D(t!==void 0);let n=this.writer.getPos();this.writer.seek(t),this.writeBox(e),this.writer.seek(n)}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 n of e.children)n&&(t+=this.measureBox(n));return t}}},k=new Uint8Array(8),A=new DataView(k.buffer),j=e=>[(e%256+256)%256],M=e=>(A.setUint16(0,e,!1),[k[0],k[1]]),Ge=e=>(A.setInt16(0,e,!1),[k[0],k[1]]),Ke=e=>(A.setUint32(0,e,!1),[k[1],k[2],k[3]]),N=e=>(A.setUint32(0,e,!1),[k[0],k[1],k[2],k[3]]),P=e=>(A.setInt32(0,e,!1),[k[0],k[1],k[2],k[3]]),F=e=>(A.setUint32(0,Math.floor(e/2**32),!1),A.setUint32(4,e,!1),[k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7]]),qe=e=>(A.setInt16(0,2**8*e,!1),[k[0],k[1]]),I=e=>(A.setInt32(0,2**16*e,!1),[k[0],k[1],k[2],k[3]]),Je=e=>(A.setInt32(0,2**30*e,!1),[k[0],k[1],k[2],k[3]]),Ye=(e,t)=>{let n=[],r=e;do{let e=r&127;r>>=7,n.length>0&&(e|=128),n.push(e),t!==void 0&&t--}while(r>0||t);return n.reverse()},L=(e,t=!1)=>{let n=Array(e.length).fill(null).map((t,n)=>e.charCodeAt(n));return t&&n.push(0),n},Xe=e=>{let t=null;for(let n of e)(!t||n.timestamp>t.timestamp)&&(t=n);return t},Ze=e=>{let t=Math.PI/180*e,n=Math.round(Math.cos(t)),r=Math.round(Math.sin(t));return[n,r,0,-r,n,0,0,0,1]},Qe=Ze(0),$e=e=>[I(e[0]),I(e[1]),Je(e[2]),I(e[3]),I(e[4]),Je(e[5]),I(e[6]),I(e[7]),Je(e[8])],R=(e,t,n)=>({type:e,contents:t&&new Uint8Array(t.flat(10)),children:n}),z=(e,t,n,r,i)=>R(e,[j(t),Ke(n),r??[]],i),et=e=>e.isQuickTime?R(`ftyp`,[L(`qt `),N(512),L(`qt `)]):e.fragmented?R(`ftyp`,[L(`iso5`),N(512),L(`iso5`),L(`iso6`),L(`mp41`)]):R(`ftyp`,[L(`isom`),N(512),L(`isom`),e.holdsAvc?L(`avc1`):[],L(`mp41`)]),B=e=>({type:`mdat`,largeSize:e}),tt=e=>({type:`free`,size:e}),V=e=>R(`moov`,void 0,[nt(e.creationTime,e.trackDatas),...e.trackDatas.map(t=>rt(t,e.creationTime)),e.isFragmented?zt(e.trackDatas):null,en(e)]),nt=(e,t)=>{let n=Y(Math.max(0,...t.filter(e=>e.samples.length>0).map(e=>{let t=Xe(e.samples);return t.timestamp+t.duration})),J),r=Math.max(0,...t.map(e=>e.track.id))+1,i=!y(e)||!y(n),a=i?F:N;return z(`mvhd`,+i,0,[a(e),a(e),N(J),a(n),I(1),qe(1),Array(10).fill(0),$e(Qe),Array(24).fill(0),N(r)])},rt=(e,t)=>{let n=xn(e);return R(`trak`,void 0,[it(e,t),at(e,t),n.name===void 0?null:R(`udta`,void 0,[R(`name`,[...S.encode(n.name)])])])},it=(e,t)=>{let n=Xe(e.samples),r=Y(n?n.timestamp+n.duration:0,J),i=!y(t)||!y(r),a=i?F:N,o;if(e.type===`video`){let t=e.track.metadata.rotation;o=Ze(t??0)}else o=Qe;let s=2;return e.track.metadata.disposition?.default!==!1&&(s|=1),z(`tkhd`,+i,s,[a(t),a(t),N(e.track.id),N(0),a(r),Array(8).fill(0),M(0),M(e.track.id),qe(+(e.type===`audio`)),M(0),$e(o),I(e.type===`video`?e.info.width:0),I(e.type===`video`?e.info.height:0)])},at=(e,t)=>R(`mdia`,void 0,[ot(e,t),H(!0,st[e.type],ct[e.type]),lt(e)]),ot=(e,t)=>{let n=Xe(e.samples),r=Y(n?n.timestamp+n.duration:0,e.timescale),i=!y(t)||!y(r),a=i?F:N;return z(`mdhd`,+i,0,[a(t),a(t),N(e.timescale),a(r),M(pn(e.track.metadata.languageCode??`und`)),M(0)])},st={video:`vide`,audio:`soun`,subtitle:`text`},ct={video:`MediabunnyVideoHandler`,audio:`MediabunnySoundHandler`,subtitle:`MediabunnyTextHandler`},H=(e,t,n,r=`\0\0\0\0`)=>z(`hdlr`,0,0,[e?L(`mhlr`):N(0),L(t),L(r),N(0),N(0),L(n,!0)]),lt=e=>R(`minf`,void 0,[ut[e.type](),dt(),mt(e)]),ut={video:()=>z(`vmhd`,0,1,[M(0),M(0),M(0),M(0)]),audio:()=>z(`smhd`,0,0,[M(0),M(0)]),subtitle:()=>z(`nmhd`,0,0)},dt=()=>R(`dinf`,void 0,[ft()]),ft=()=>z(`dref`,0,0,[N(1)],[pt()]),pt=()=>z(`url `,0,1),mt=e=>{let t=e.compositionTimeOffsetTable.length>1||e.compositionTimeOffsetTable.some(e=>e.sampleCompositionTimeOffset!==0);return R(`stbl`,void 0,[ht(e),Mt(e),t?Lt(e):null,t?Rt(e):null,Pt(e),Ft(e),It(e),Nt(e)])},ht=e=>{let t;if(e.type===`video`)t=gt(sn(e.track.source._codec,e.info.decoderConfig.codec),e);else if(e.type===`audio`){let n=ln(e.track.source._codec,e.muxer.isQuickTime);D(n),t=Ct(n,e)}else e.type===`subtitle`&&(t=At(dn[e.track.source._codec],e));return D(t),z(`stsd`,0,0,[N(1)],[t])},gt=(e,t)=>R(e,[[,,,,,,].fill(0),M(1),M(0),M(0),Array(12).fill(0),M(t.info.width),M(t.info.height),N(4718592),N(4718592),N(0),M(1),Array(32).fill(0),M(24),Ge(65535)],[cn[t.track.source._codec](t),_t(t),xe(t.info.decoderConfig.colorSpace)?vt(t):null]),_t=e=>e.info.pixelAspectRatio.num===e.info.pixelAspectRatio.den?null:R(`pasp`,[N(e.info.pixelAspectRatio.num),N(e.info.pixelAspectRatio.den)]),vt=t=>R(`colr`,[L(`nclx`),M(se[t.info.decoderConfig.colorSpace.primaries]),M(ge[t.info.decoderConfig.colorSpace.transfer]),M(e[t.info.decoderConfig.colorSpace.matrix]),j(!!t.info.decoderConfig.colorSpace.fullRange<<7)]),yt=e=>e.info.decoderConfig&&R(`avcC`,[...b(e.info.decoderConfig.description)]),bt=e=>e.info.decoderConfig&&R(`hvcC`,[...b(e.info.decoderConfig.description)]),xt=t=>{if(!t.info.decoderConfig)return null;let n=t.info.decoderConfig,r=n.codec.split(`.`),i=Number(r[1]),a=Number(r[2]),o=Number(r[3]),s=r[4]?Number(r[4]):1,c=r[8]?Number(r[8]):Number(n.colorSpace?.fullRange??0),l=(o<<4)+(s<<1)+c,u=r[5]?Number(r[5]):n.colorSpace?.primaries?se[n.colorSpace.primaries]:2,d=r[6]?Number(r[6]):n.colorSpace?.transfer?ge[n.colorSpace.transfer]:2,f=r[7]?Number(r[7]):n.colorSpace?.matrix?e[n.colorSpace.matrix]:2;return z(`vpcC`,1,0,[j(i),j(a),j(l),j(u),j(d),j(f),M(0)])},St=e=>R(`av1C`,g(e.info.decoderConfig.codec)),Ct=(e,t)=>{let n=0,r,i=16,a=w.includes(t.track.source._codec);if(a){let e=t.track.source._codec,{sampleSize:r}=v(e);i=8*r,i>16&&(n=1)}if(t.muxer.isQuickTime&&(n=1),n===0)r=[[,,,,,,].fill(0),M(1),M(n),M(0),N(0),M(t.info.numberOfChannels),M(i),M(0),M(0),M(t.info.sampleRate<2**16?t.info.sampleRate:0),M(0)];else{let e=a?0:-2;r=[[,,,,,,].fill(0),M(1),M(n),M(0),N(0),M(t.info.numberOfChannels),M(Math.min(i,16)),Ge(e),M(0),M(t.info.sampleRate<2**16?t.info.sampleRate:0),M(0),a?[N(1),N(i/8),N(t.info.numberOfChannels*i/8)]:[N(0),N(0),N(0)],N(2)]}return R(e,r,[un(t.track.source._codec,t.muxer.isQuickTime)?.(t)??null])},U=e=>{let t;switch(e.track.source._codec){case`aac`:t=64;break;case`mp3`:t=107;break;case`vorbis`:t=221;break;default:throw Error(`Unhandled audio codec: ${e.track.source._codec}`)}let n=[...j(t),...j(21),...Ke(0),...N(0),...N(0)];if(e.info.decoderConfig.description){let t=b(e.info.decoderConfig.description);n=[...n,...j(5),...Ye(t.byteLength),...t]}return n=[...M(1),...j(0),...j(4),...Ye(n.length),...n,...j(6),...j(1),...j(2)],n=[...j(3),...Ye(n.length),...n],z(`esds`,0,0,n)},W=e=>R(`wave`,void 0,[wt(e),Tt(e),R(`\0\0\0\0`)]),wt=e=>R(`frma`,[L(ln(e.track.source._codec,e.muxer.isQuickTime))]),Tt=e=>{let{littleEndian:t}=v(e.track.source._codec);return R(`enda`,[M(+t)])},Et=e=>{let t=e.info.numberOfChannels,n=3840,r=e.info.sampleRate,i=0,a=0,o=new Uint8Array,s=e.info.decoderConfig?.description;if(s){D(s.byteLength>=18);let e=Le(b(s));t=e.outputChannelCount,n=e.preSkip,r=e.inputSampleRate,i=e.outputGain,a=e.channelMappingFamily,e.channelMappingTable&&(o=e.channelMappingTable)}return R(`dOps`,[j(0),j(t),M(n),N(r),Ge(i),j(a),...o])},Dt=e=>{let t=e.info.decoderConfig?.description;return D(t),z(`dfLa`,0,0,[...b(t).subarray(4)])},G=e=>{let{littleEndian:t,sampleSize:n}=v(e.track.source._codec);return z(`pcmC`,0,0,[j(+t),j(8*n)])},Ot=e=>{let t=ee(e.info.firstPacket.data);if(!t)throw Error(`Couldn't extract AC-3 frame info from the audio packet. Ensure the packets contain valid AC-3 sync frames (as specified in ETSI TS 102 366).`);let n=new Uint8Array(3),r=new d(n);return r.writeBits(2,t.fscod),r.writeBits(5,t.bsid),r.writeBits(3,t.bsmod),r.writeBits(3,t.acmod),r.writeBits(1,t.lfeon),r.writeBits(5,t.bitRateCode),r.writeBits(5,0),R(`dac3`,[...n])},kt=e=>{let t=r(e.info.firstPacket.data);if(!t)throw Error(`Couldn't extract E-AC-3 frame info from the audio packet. Ensure the packets contain valid E-AC-3 sync frames (as specified in ETSI TS 102 366).`);let n=16;for(let e of t.substreams)n+=23,e.numDepSub>0?n+=9:n+=1;let i=Math.ceil(n/8),a=new Uint8Array(i),o=new d(a);o.writeBits(13,t.dataRate),o.writeBits(3,t.substreams.length-1);for(let e of t.substreams)o.writeBits(2,e.fscod),o.writeBits(5,e.bsid),o.writeBits(1,0),o.writeBits(1,0),o.writeBits(3,e.bsmod),o.writeBits(3,e.acmod),o.writeBits(1,e.lfeon),o.writeBits(3,0),o.writeBits(4,e.numDepSub),e.numDepSub>0?o.writeBits(9,e.chanLoc):o.writeBits(1,0);return R(`dec3`,[...a])},At=(e,t)=>R(e,[[,,,,,,].fill(0),M(1)],[fn[t.track.source._codec](t)]),jt=e=>R(`vttC`,[...S.encode(e.info.config.description)]),Mt=e=>z(`stts`,0,0,[N(e.timeToSampleTable.length),e.timeToSampleTable.map(e=>[N(e.sampleCount),N(e.sampleDelta)])]),Nt=e=>{if(e.samples.every(e=>e.type===`key`))return null;let t=[...e.samples.entries()].filter(([,e])=>e.type===`key`);return z(`stss`,0,0,[N(t.length),t.map(([e])=>N(e+1))])},Pt=e=>z(`stsc`,0,0,[N(e.compactlyCodedChunkTable.length),e.compactlyCodedChunkTable.map(e=>[N(e.firstChunk),N(e.samplesPerChunk),N(1)])]),Ft=e=>{if(e.type===`audio`&&e.info.requiresPcmTransformation){let{sampleSize:t}=v(e.track.source._codec);return z(`stsz`,0,0,[N(t*e.info.numberOfChannels),N(e.samples.reduce((t,n)=>t+Y(n.duration,e.timescale),0))])}return z(`stsz`,0,0,[N(0),N(e.samples.length),e.samples.map(e=>N(e.size))])},It=e=>e.finalizedChunks.length>0&&O(e.finalizedChunks).offset>=2**32?z(`co64`,0,0,[N(e.finalizedChunks.length),e.finalizedChunks.map(e=>F(e.offset))]):z(`stco`,0,0,[N(e.finalizedChunks.length),e.finalizedChunks.map(e=>N(e.offset))]),Lt=e=>z(`ctts`,1,0,[N(e.compositionTimeOffsetTable.length),e.compositionTimeOffsetTable.map(e=>[N(e.sampleCount),P(e.sampleCompositionTimeOffset)])]),Rt=e=>{let t=1/0,n=-1/0,r=1/0,i=-1/0;D(e.compositionTimeOffsetTable.length>0),D(e.samples.length>0);for(let r=0;r<e.compositionTimeOffsetTable.length;r++){let i=e.compositionTimeOffsetTable[r];t=Math.min(t,i.sampleCompositionTimeOffset),n=Math.max(n,i.sampleCompositionTimeOffset)}for(let t=0;t<e.samples.length;t++){let n=e.samples[t];r=Math.min(r,Y(n.timestamp,e.timescale)),i=Math.max(i,Y(n.timestamp+n.duration,e.timescale))}let a=Math.max(-t,0);return i>=2**31?null:z(`cslg`,0,0,[P(a),P(t),P(n),P(r),P(i)])},zt=e=>R(`mvex`,void 0,e.map(Bt)),Bt=e=>z(`trex`,0,0,[N(e.track.id),N(1),N(0),N(0),N(0)]),Vt=(e,t)=>R(`moof`,void 0,[Ht(e),...t.map(Wt)]),Ht=e=>z(`mfhd`,0,0,[N(e)]),Ut=e=>{let t=0,n=0,r=e.type===`delta`;return n|=+r,r?t|=1:t|=2,t<<24|n<<16|0},Wt=e=>R(`traf`,void 0,[Gt(e),Kt(e),qt(e)]),Gt=e=>{D(e.currentChunk);let t=0;t|=8,t|=16,t|=32,t|=131072;let n=e.currentChunk.samples[1]??e.currentChunk.samples[0],r={duration:n.timescaleUnitsToNextSample,size:n.size,flags:Ut(n)};return z(`tfhd`,0,t,[N(e.track.id),N(r.duration),N(r.size),N(r.flags)])},Kt=e=>(D(e.currentChunk),z(`tfdt`,1,0,[F(Y(e.currentChunk.startTimestamp,e.timescale))])),qt=e=>{D(e.currentChunk);let t=e.currentChunk.samples.map(e=>e.timescaleUnitsToNextSample),n=e.currentChunk.samples.map(e=>e.size),r=e.currentChunk.samples.map(Ut),i=e.currentChunk.samples.map(t=>Y(t.timestamp-t.decodeTimestamp,e.timescale)),a=new Set(t),o=new Set(n),s=new Set(r),c=new Set(i),l=s.size===2&&r[0]!==r[1],u=a.size>1,d=o.size>1,f=!l&&s.size>1,p=c.size>1||[...c].some(e=>e!==0),m=0;return m|=1,m|=4*l,m|=256*u,m|=512*d,m|=1024*f,m|=2048*p,z(`trun`,1,m,[N(e.currentChunk.samples.length),N(e.currentChunk.offset-e.currentChunk.moofOffset||0),l?N(r[0]):[],e.currentChunk.samples.map((e,a)=>[u?N(t[a]):[],d?N(n[a]):[],f?N(r[a]):[],p?P(i[a]):[]])])},Jt=e=>R(`mfra`,void 0,[...e.map(Yt),Xt()]),Yt=(e,t)=>z(`tfra`,1,0,[N(e.track.id),N(63),N(e.finalizedChunks.length),e.finalizedChunks.map(n=>[F(Y(n.samples[0].timestamp,e.timescale)),F(n.moofOffset),N(t+1),N(1),N(1)])]),Xt=()=>z(`mfro`,0,0,[N(0)]),Zt=()=>R(`vtte`),Qt=(e,t,n,r,i)=>R(`vttc`,void 0,[i===null?null:R(`vsid`,[P(i)]),n===null?null:R(`iden`,[...S.encode(n)]),t===null?null:R(`ctim`,[...S.encode(Ue(t))]),r===null?null:R(`sttg`,[...S.encode(r)]),R(`payl`,[...S.encode(e)])]),$t=e=>R(`vtta`,[...S.encode(e)]),en=e=>{let t=[],n=e.format._options.metadataFormat??`auto`,r=e.output._metadataTags;if(n===`mdir`||n===`auto`&&!e.isQuickTime){let e=an(r);e&&t.push(e)}else if(n===`mdta`){let e=on(r);e&&t.push(e)}else (n===`udta`||n===`auto`&&e.isQuickTime)&&tn(t,e.output._metadataTags);return t.length===0?null:R(`udta`,void 0,t)},tn=(e,t)=>{for(let{key:n,value:r}of Ce(t))switch(n){case`title`:e.push(K(`©nam`,r));break;case`description`:e.push(K(`©des`,r));break;case`artist`:e.push(K(`©ART`,r));break;case`album`:e.push(K(`©alb`,r));break;case`albumArtist`:e.push(K(`albr`,r));break;case`genre`:e.push(K(`©gen`,r));break;case`date`:e.push(K(`©day`,r.toISOString().slice(0,10)));break;case`comment`:e.push(K(`©cmt`,r));break;case`lyrics`:e.push(K(`©lyr`,r));break;case`raw`:break;case`discNumber`:case`discsTotal`:case`trackNumber`:case`tracksTotal`:case`images`:break;default:De(n)}if(t.raw)for(let n in t.raw){let r=t.raw[n];r==null||n.length!==4||e.some(e=>e.type===n)||(typeof r==`string`?e.push(K(n,r)):r instanceof Uint8Array&&e.push(R(n,Array.from(r))))}},K=(e,t)=>{let n=S.encode(t);return R(e,[M(n.length),M(pn(`und`)),Array.from(n)])},nn={"image/jpeg":13,"image/png":14,"image/bmp":27},rn=(e,t)=>{let n=[];for(let{key:r,value:i}of Ce(e))switch(r){case`title`:n.push({key:t?`title`:`©nam`,value:q(i)});break;case`description`:n.push({key:t?`description`:`©des`,value:q(i)});break;case`artist`:n.push({key:t?`artist`:`©ART`,value:q(i)});break;case`album`:n.push({key:t?`album`:`©alb`,value:q(i)});break;case`albumArtist`:n.push({key:t?`album_artist`:`aART`,value:q(i)});break;case`comment`:n.push({key:t?`comment`:`©cmt`,value:q(i)});break;case`genre`:n.push({key:t?`genre`:`©gen`,value:q(i)});break;case`lyrics`:n.push({key:t?`lyrics`:`©lyr`,value:q(i)});break;case`date`:n.push({key:t?`date`:`©day`,value:q(i.toISOString().slice(0,10))});break;case`images`:for(let e of i)e.kind===`coverFront`&&n.push({key:`covr`,value:R(`data`,[N(nn[e.mimeType]??0),N(0),Array.from(e.data)])});break;case`trackNumber`:if(t){let t=e.tracksTotal===void 0?i.toString():`${i}/${e.tracksTotal}`;n.push({key:`track`,value:q(t)})}else n.push({key:`trkn`,value:R(`data`,[N(0),N(0),M(0),M(i),M(e.tracksTotal??0),M(0)])});break;case`discNumber`:t||n.push({key:`disc`,value:R(`data`,[N(0),N(0),M(0),M(i),M(e.discsTotal??0),M(0)])});break;case`tracksTotal`:case`discsTotal`:break;case`raw`:break;default:De(r)}if(e.raw)for(let r in e.raw){let i=e.raw[r];i==null||!t&&r.length!==4||n.some(e=>e.key===r)||(typeof i==`string`?n.push({key:r,value:q(i)}):i instanceof Uint8Array?n.push({key:r,value:R(`data`,[N(0),N(0),Array.from(i)])}):i instanceof je&&n.push({key:r,value:R(`data`,[N(nn[i.mimeType]??0),N(0),Array.from(i.data)])}))}return n},an=e=>{let t=rn(e,!1);return t.length===0?null:z(`meta`,0,0,void 0,[H(!1,`mdir`,``,`appl`),R(`ilst`,void 0,t.map(e=>R(e.key,void 0,[e.value])))])},on=e=>{let t=rn(e,!0);return t.length===0?null:R(`meta`,void 0,[H(!1,`mdta`,``),z(`keys`,0,0,[N(t.length)],t.map(e=>R(`mdta`,[...S.encode(e.key)]))),R(`ilst`,void 0,t.map((e,t)=>R(String.fromCharCode(...N(t+1)),void 0,[e.value])))])},q=e=>R(`data`,[N(1),N(0),...S.encode(e)]),sn=(e,t)=>{switch(e){case`avc`:return t.startsWith(`avc3`)?`avc3`:`avc1`;case`hevc`:return`hvc1`;case`vp8`:return`vp08`;case`vp9`:return`vp09`;case`av1`:return`av01`}},cn={avc:yt,hevc:bt,vp8:xt,vp9:xt,av1:St},ln=(e,t)=>{switch(e){case`aac`:return`mp4a`;case`mp3`:return`mp4a`;case`opus`:return`Opus`;case`vorbis`:return`mp4a`;case`flac`:return`fLaC`;case`ulaw`:return`ulaw`;case`alaw`:return`alaw`;case`pcm-u8`:return`raw `;case`pcm-s8`:return`sowt`;case`ac3`:return`ac-3`;case`eac3`:return`ec-3`}if(t)switch(e){case`pcm-s16`:return`sowt`;case`pcm-s16be`:return`twos`;case`pcm-s24`:return`in24`;case`pcm-s24be`:return`in24`;case`pcm-s32`:return`in32`;case`pcm-s32be`:return`in32`;case`pcm-f32`:return`fl32`;case`pcm-f32be`:return`fl32`;case`pcm-f64`:return`fl64`;case`pcm-f64be`:return`fl64`}else switch(e){case`pcm-s16`:return`ipcm`;case`pcm-s16be`:return`ipcm`;case`pcm-s24`:return`ipcm`;case`pcm-s24be`:return`ipcm`;case`pcm-s32`:return`ipcm`;case`pcm-s32be`:return`ipcm`;case`pcm-f32`:return`fpcm`;case`pcm-f32be`:return`fpcm`;case`pcm-f64`:return`fpcm`;case`pcm-f64be`:return`fpcm`}},un=(e,t)=>{switch(e){case`aac`:return U;case`mp3`:return U;case`opus`:return Et;case`vorbis`:return U;case`flac`:return Dt;case`ac3`:return Ot;case`eac3`:return kt}if(t)switch(e){case`pcm-s24`:return W;case`pcm-s24be`:return W;case`pcm-s32`:return W;case`pcm-s32be`:return W;case`pcm-f32`:return W;case`pcm-f32be`:return W;case`pcm-f64`:return W;case`pcm-f64be`:return W}else switch(e){case`pcm-s16`:return G;case`pcm-s16be`:return G;case`pcm-s24`:return G;case`pcm-s24be`:return G;case`pcm-s32`:return G;case`pcm-s32be`:return G;case`pcm-f32`:return G;case`pcm-f32be`:return G;case`pcm-f64`:return G;case`pcm-f64be`:return G}return null},dn={webvtt:`wvtt`},fn={webvtt:jt},pn=e=>{D(e.length===3);let t=0;for(let n=0;n<3;n++)t<<=5,t+=e.charCodeAt(n)-96;return t},mn=class{constructor(){this.ensureMonotonicity=!1,this.trackedWrites=null,this.trackedStart=-1,this.trackedEnd=-1}start(){}maybeTrackWrites(e){if(!this.trackedWrites)return;let t=this.getPos();if(t<this.trackedStart){if(t+e.byteLength<=this.trackedStart)return;e=e.subarray(this.trackedStart-t),t=0}let n=t+e.byteLength-this.trackedStart,r=this.trackedWrites.byteLength;for(;r<n;)r*=2;if(r!==this.trackedWrites.byteLength){let e=new Uint8Array(r);e.set(this.trackedWrites,0),this.trackedWrites=e}this.trackedWrites.set(e,t-this.trackedStart),this.trackedEnd=Math.max(this.trackedEnd,t+e.byteLength)}startTrackingWrites(){this.trackedWrites=new Uint8Array(2**10),this.trackedStart=this.getPos(),this.trackedEnd=this.trackedStart}stopTrackingWrites(){if(!this.trackedWrites)throw Error(`Internal error: Can't get tracked writes since nothing was tracked.`);let e={data:this.trackedWrites.subarray(0,this.trackedEnd-this.trackedStart),start:this.trackedStart,end:this.trackedEnd};return this.trackedWrites=null,e}},hn=2**16,gn=2**32,_n=class extends mn{constructor(e){if(super(),this.pos=0,this.maxPos=0,this.target=e,this.supportsResize=`resize`in new ArrayBuffer(0),this.supportsResize)try{this.buffer=new ArrayBuffer(hn,{maxByteLength:gn})}catch{this.buffer=new ArrayBuffer(hn),this.supportsResize=!1}else this.buffer=new ArrayBuffer(hn);this.bytes=new Uint8Array(this.buffer)}ensureSize(e){let t=this.buffer.byteLength;for(;t<e;)t*=2;if(t!==this.buffer.byteLength){if(t>gn)throw Error(`ArrayBuffer exceeded maximum size of ${gn} bytes. Please consider using another target.`);if(this.supportsResize)this.buffer.resize(t);else{let e=new ArrayBuffer(t),n=new Uint8Array(e);n.set(this.bytes,0),this.buffer=e,this.bytes=n}}}write(e){this.maybeTrackWrites(e),this.ensureSize(this.pos+e.byteLength),this.bytes.set(e,this.pos),this.target.onwrite?.(this.pos,this.pos+e.byteLength),this.pos+=e.byteLength,this.maxPos=Math.max(this.maxPos,this.pos)}seek(e){this.pos=e}getPos(){return this.pos}async flush(){}async finalize(){this.ensureSize(this.pos),this.target.buffer=this.buffer.slice(0,Math.max(this.maxPos,this.pos))}async close(){}getSlice(e,t){return this.bytes.slice(e,t)}};ue();var vn=class{constructor(){this._output=null,this.onwrite=null}},yn=class extends vn{constructor(){super(...arguments),this.buffer=null}_createWriter(){return new _n(this)}},J=1e3,bn=2082844800,xn=e=>{let t={},n=e.track;return n.metadata.name!==void 0&&(t.name=n.metadata.name),t},Y=(e,t,n=!0)=>{let r=e*t;return n?Math.round(r):r},Sn=class extends Ve{constructor(e,t){super(e),this.auxTarget=new yn,this.auxWriter=this.auxTarget._createWriter(),this.auxBoxWriter=new We(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=he(),this.creationTime=Math.floor(Date.now()/1e3)+bn,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.format=t,this.writer=e._writer,this.boxWriter=new We(this.writer),this.isQuickTime=t instanceof En;let n=this.writer instanceof _n?`in-memory`:!1;this.fastStart=t._options.fastStart??n,this.isFragmented=this.fastStart===`fragmented`,(this.fastStart===`in-memory`||this.isFragmented)&&(this.writer.ensureMonotonicity=!0),this.minimumFragmentDuration=t._options.minimumFragmentDuration??1}async start(){let e=await this.mutex.acquire(),t=this.output._tracks.some(e=>e.type===`video`&&e.source._codec===`avc`);if(this.format._options.onFtyp&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(et({isQuickTime:this.isQuickTime,holdsAvc:t,fragmented:this.isFragmented})),this.format._options.onFtyp){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onFtyp(e,t)}if(this.ftypSize=this.writer.getPos(),this.fastStart!==`in-memory`)if(this.fastStart===`reserve`){for(let e of this.output._tracks)if(e.metadata.maximumPacketCount===void 0)throw Error(`All tracks must specify maximumPacketCount in their metadata when using fastStart: 'reserve'.`)}else this.isFragmented||(this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=B(!0),this.boxWriter.writeBox(this.mdat));await this.writer.flush(),e()}allTracksAreKnown(){for(let e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(t=>t.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;let e=this.trackDatas.map(e=>e.type===`video`||e.type===`audio`?e.info.decoderConfig.codec:{webvtt:`wvtt`}[e.track.source._codec]);return pe({isQuickTime:this.isQuickTime,hasVideo:this.trackDatas.some(e=>e.type===`video`),hasAudio:this.trackDatas.some(e=>e.type===`audio`),codecStrings:e})}getVideoTrackData(e,t,n){let r=this.trackDatas.find(t=>t.track===e);if(r)return r;re(n),D(n),D(n.decoderConfig);let i={...n.decoderConfig};D(i.codedWidth!==void 0),D(i.codedHeight!==void 0);let o=!1;if(e.source._codec===`avc`&&!i.description){let e=ze(t.data);if(!e)throw Error(`Couldn't extract an AVCDecoderConfigurationRecord from the AVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.264) when not providing a description, or provide a description (must be an AVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in AVCC format.`);i.description=te(e),o=!0}else if(e.source._codec===`hevc`&&!i.description){let e=fe(t.data);if(!e)throw Error(`Couldn't extract an HEVCDecoderConfigurationRecord from the HEVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.265) when not providing a description, or provide a description (must be an HEVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in HEVC format.`);i.description=a(e),o=!0}let s=de(1/(e.metadata.frameRate??57600),1e6).denominator,c=i.displayAspectWidth,l=i.displayAspectHeight,u=c===void 0||l===void 0?{num:1,den:1}:Te({num:c*i.codedHeight,den:l*i.codedWidth}),d={muxer:this,track:e,type:`video`,info:{width:i.codedWidth,height:i.codedHeight,pixelAspectRatio:u,decoderConfig:i,requiresAnnexBTransformation:o},timescale:s,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(d),this.trackDatas.sort((e,t)=>e.track.id-t.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),d}getAudioTrackData(e,t,n){let r=this.trackDatas.find(t=>t.track===e);if(r)return r;Be(n),D(n),D(n.decoderConfig);let i={...n.decoderConfig},a=!1;if(e.source._codec===`aac`&&!i.description){let e=Ne(Fe.tempFromBytes(t.data));if(!e)throw Error(`Couldn't parse ADTS header from the AAC packet. Make sure the packets are in ADTS format (as specified in ISO 13818-7) when not providing a description, or provide a description (must be an AudioSpecificConfig as specified in ISO 14496-3) and ensure the packets are raw AAC data.`);let n=ne[e.samplingFrequencyIndex],r=c[e.channelConfiguration];if(n===void 0||r===void 0)throw Error(`Invalid ADTS frame header.`);i.description=ie({objectType:e.objectType,sampleRate:n,numberOfChannels:r}),a=!0}let o={muxer:this,track:e,type:`audio`,info:{numberOfChannels:n.decoderConfig.numberOfChannels,sampleRate:n.decoderConfig.sampleRate,decoderConfig:i,requiresPcmTransformation:!this.isFragmented&&w.includes(e.source._codec),requiresAdtsStripping:a,firstPacket:t},timescale:i.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(o),this.trackDatas.sort((e,t)=>e.track.id-t.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),o}getSubtitleTrackData(e,t){let r=this.trackDatas.find(t=>t.track===e);if(r)return r;n(t),D(t),D(t.config);let i={muxer:this,track:e,type:`subtitle`,info:{config:t.config},timescale:1e3,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],lastCueEndTimestamp:0,cueQueue:[],nextSourceId:0,cueToSourceId:new WeakMap};return this.trackDatas.push(i),this.trackDatas.sort((e,t)=>e.track.id-t.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),i}async addEncodedVideoPacket(e,t,n){let r=await this.mutex.acquire();try{let r=this.getVideoTrackData(e,t,n),i=t.data;if(r.info.requiresAnnexBTransformation){let e=[...Re(i)].map(e=>i.subarray(e.offset,e.offset+e.length));if(e.length===0)throw Error(`Failed to transform packet data. Make sure all packets are provided in Annex B format, as specified in ITU-T-REC-H.264 and ITU-T-REC-H.265.`);i=Ie(e,4)}let a=this.validateAndNormalizeTimestamp(r.track,t.timestamp,t.type===`key`),o=this.createSampleForTrack(r,i,a,t.duration,t.type);await this.registerSample(r,o)}finally{r()}}async addEncodedAudioPacket(e,t,n){let r=await this.mutex.acquire();try{let r=this.getAudioTrackData(e,t,n),i=t.data;if(r.info.requiresAdtsStripping){let e=Ne(Fe.tempFromBytes(i));if(!e)throw Error(`Expected ADTS frame, didn't get one.`);let t=e.crcCheck===null?7:9;i=i.subarray(t)}let a=this.validateAndNormalizeTimestamp(r.track,t.timestamp,t.type===`key`),o=this.createSampleForTrack(r,i,a,t.duration,t.type);r.info.requiresPcmTransformation&&await this.maybePadWithSilence(r,a),await this.registerSample(r,o)}finally{r()}}async maybePadWithSilence(e,t){let n=O(e.samples),r=n?n.timestamp+n.duration:0,i=t-r,a=Y(i,e.timescale);if(a>0){let{sampleSize:t,silentValue:n}=v(e.info.decoderConfig.codec),o=a*e.info.numberOfChannels,s=new Uint8Array(t*o).fill(n),c=this.createSampleForTrack(e,new Uint8Array(s.buffer),r,i,`key`);await this.registerSample(e,c)}}async addSubtitleCue(e,t,n){let r=await this.mutex.acquire();try{let r=this.getSubtitleTrackData(e,n);this.validateAndNormalizeTimestamp(r.track,t.timestamp,!0),e.source._codec===`webvtt`&&(r.cueQueue.push(t),await this.processWebVTTCues(r,t.timestamp))}finally{r()}}async processWebVTTCues(e,t){for(;e.cueQueue.length>0;){let n=new Set([]);for(let r of e.cueQueue)D(r.timestamp<=t),D(e.lastCueEndTimestamp<=r.timestamp+r.duration),n.add(Math.max(r.timestamp,e.lastCueEndTimestamp)),n.add(r.timestamp+r.duration);let r=[...n].sort((e,t)=>e-t),i=r[0],a=r[1]??i;if(t<a)break;if(e.lastCueEndTimestamp<i){this.auxWriter.seek(0);let t=Zt();this.auxBoxWriter.writeBox(t);let n=this.auxWriter.getSlice(0,this.auxWriter.getPos()),r=this.createSampleForTrack(e,n,e.lastCueEndTimestamp,i-e.lastCueEndTimestamp,`key`);await this.registerSample(e,r),e.lastCueEndTimestamp=i}this.auxWriter.seek(0);for(let t=0;t<e.cueQueue.length;t++){let n=e.cueQueue[t];if(n.timestamp>=a)break;He.lastIndex=0;let r=He.test(n.text),o=n.timestamp+n.duration,s=e.cueToSourceId.get(n);if(s===void 0&&a<o&&(s=e.nextSourceId++,e.cueToSourceId.set(n,s)),n.notes){let e=$t(n.notes);this.auxBoxWriter.writeBox(e)}let c=Qt(n.text,r?i:null,n.identifier??null,n.settings??null,s??null);this.auxBoxWriter.writeBox(c),o===a&&e.cueQueue.splice(t--,1)}let o=this.auxWriter.getSlice(0,this.auxWriter.getPos()),s=this.createSampleForTrack(e,o,i,a-i,`key`);await this.registerSample(e,s),e.lastCueEndTimestamp=a}}createSampleForTrack(e,t,n,r,i){return{timestamp:n,decodeTimestamp:n,duration:r,data:t,size:t.byteLength,type:i,timescaleUnitsToNextSample:Y(r,e.timescale)}}processTimestamps(e,t){if(e.timestampProcessingQueue.length===0)return;if(e.type===`audio`&&e.info.requiresPcmTransformation){let t=0;for(let n=0;n<e.timestampProcessingQueue.length;n++){let r=e.timestampProcessingQueue[n],i=Y(r.duration,e.timescale);t+=i}if(e.timeToSampleTable.length===0)e.timeToSampleTable.push({sampleCount:t,sampleDelta:1});else{let n=O(e.timeToSampleTable);n.sampleCount+=t}e.timestampProcessingQueue.length=0;return}let n=e.timestampProcessingQueue.map(e=>e.timestamp).sort((e,t)=>e-t);for(let t=0;t<e.timestampProcessingQueue.length;t++){let r=e.timestampProcessingQueue[t];r.decodeTimestamp=n[t],!this.isFragmented&&e.lastTimescaleUnits===null&&(r.decodeTimestamp=0);let i=Y(r.timestamp-r.decodeTimestamp,e.timescale),a=Y(r.duration,e.timescale);if(e.lastTimescaleUnits!==null){D(e.lastSample);let t=Y(r.decodeTimestamp,e.timescale,!1),n=Math.round(t-e.lastTimescaleUnits);if(D(n>=0),e.lastTimescaleUnits+=n,e.lastSample.timescaleUnitsToNextSample=n,!this.isFragmented){let t=O(e.timeToSampleTable);if(D(t),t.sampleCount===1){t.sampleDelta=n;let r=e.timeToSampleTable[e.timeToSampleTable.length-2];r&&r.sampleDelta===n&&(r.sampleCount++,e.timeToSampleTable.pop(),t=r)}else t.sampleDelta!==n&&(t.sampleCount--,e.timeToSampleTable.push(t={sampleCount:1,sampleDelta:n}));t.sampleDelta===a?t.sampleCount++:e.timeToSampleTable.push({sampleCount:1,sampleDelta:a});let r=O(e.compositionTimeOffsetTable);D(r),r.sampleCompositionTimeOffset===i?r.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:i})}}else e.lastTimescaleUnits=Y(r.decodeTimestamp,e.timescale,!1),this.isFragmented||(e.timeToSampleTable.push({sampleCount:1,sampleDelta:a}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:i}));e.lastSample=r}if(e.timestampProcessingQueue.length=0,D(e.lastSample),D(e.lastTimescaleUnits!==null),t!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){D(t.type===`key`);let n=Y(t.timestamp,e.timescale,!1),r=Math.round(n-e.lastTimescaleUnits);e.lastSample.timescaleUnitsToNextSample=r}}async registerSample(e,t){t.type===`key`&&this.processTimestamps(e,t),e.timestampProcessingQueue.push(t),this.isFragmented?(e.sampleQueue.push(t),await this.interleaveSamples()):this.fastStart===`reserve`?await this.registerSampleFastStartReserve(e,t):await this.addSampleToTrack(e,t)}async addSampleToTrack(e,t){if(!this.isFragmented&&(e.samples.push(t),this.fastStart===`reserve`)){let t=e.track.metadata.maximumPacketCount;if(D(t!==void 0),e.samples.length>t)throw Error(`Track #${e.track.id} has already reached the maximum packet count (${t}). Either add less packets or increase the maximum packet count.`)}let n=!1;if(!e.currentChunk)n=!0;else{e.currentChunk.startTimestamp=Math.min(e.currentChunk.startTimestamp,t.timestamp);let r=t.timestamp-e.currentChunk.startTimestamp;if(this.isFragmented){let i=this.trackDatas.every(n=>{if(e===n)return t.type===`key`;let r=n.sampleQueue[0];return r?r.type===`key`:n.track.source._closed});r>=this.minimumFragmentDuration&&i&&t.timestamp>this.maxWrittenTimestamp&&(n=!0,await this.finalizeFragment())}else n=r>=.5}n&&(e.currentChunk&&await this.finalizeCurrentChunk(e),e.currentChunk={startTimestamp:t.timestamp,samples:[],offset:null,moofOffset:null}),D(e.currentChunk),e.currentChunk.samples.push(t),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,t.timestamp))}async finalizeCurrentChunk(e){if(D(!this.isFragmented),!e.currentChunk)return;e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk);let t=e.currentChunk.samples.length;if(e.type===`audio`&&e.info.requiresPcmTransformation&&(t=e.currentChunk.samples.reduce((t,n)=>t+Y(n.duration,e.timescale),0)),(e.compactlyCodedChunkTable.length===0||O(e.compactlyCodedChunkTable).samplesPerChunk!==t)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:t}),this.fastStart===`in-memory`){e.currentChunk.offset=0;return}e.currentChunk.offset=this.writer.getPos();for(let t of e.currentChunk.samples)D(t.data),this.writer.write(t.data),t.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(D(this.isFragmented),!(!e&&!this.allTracksAreKnown()))outer:for(;;){let t=null,n=1/0;for(let r of this.trackDatas){if(!e&&r.sampleQueue.length===0&&!r.track.source._closed)break outer;r.sampleQueue.length>0&&r.sampleQueue[0].timestamp<n&&(t=r,n=r.sampleQueue[0].timestamp)}if(!t)break;let r=t.sampleQueue.shift();await this.addSampleToTrack(t,r)}}async finalizeFragment(e=!0){D(this.isFragmented);let t=this.nextFragmentNumber++;if(t===1){this.format._options.onMoov&&this.writer.startTrackingWrites();let e=V(this);if(this.boxWriter.writeBox(e),this.format._options.onMoov){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMoov(e,t)}}let n=this.trackDatas.filter(e=>e.currentChunk),r=Vt(t,n),i=this.writer.getPos(),a=i+this.boxWriter.measureBox(r),o=a+8,s=1/0;for(let e of n){e.currentChunk.offset=o,e.currentChunk.moofOffset=i;for(let t of e.currentChunk.samples)o+=t.size;s=Math.min(s,e.currentChunk.startTimestamp)}let c=o-a,l=c>=2**32;if(l)for(let e of n)e.currentChunk.offset+=8;this.format._options.onMoof&&this.writer.startTrackingWrites();let u=Vt(t,n);if(this.boxWriter.writeBox(u),this.format._options.onMoof){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMoof(e,t,s)}D(this.writer.getPos()===a),this.format._options.onMdat&&this.writer.startTrackingWrites();let d=B(l);d.size=c,this.boxWriter.writeBox(d),this.writer.seek(a+(l?16:8));for(let e of n)for(let t of e.currentChunk.samples)this.writer.write(t.data),t.data=null;if(this.format._options.onMdat){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMdat(e,t)}for(let e of n)e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk),e.currentChunk=null;e&&await this.writer.flush()}async registerSampleFastStartReserve(e,t){if(this.allTracksAreKnown()){if(!this.mdat){let e=V(this),t=this.boxWriter.measureBox(e)+this.computeSampleTableSizeUpperBound()+4096;D(this.ftypSize!==null),this.writer.seek(this.ftypSize+t),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=B(!0),this.boxWriter.writeBox(this.mdat);for(let e of this.trackDatas){for(let t of e.sampleQueue)await this.addSampleToTrack(e,t);e.sampleQueue.length=0}}await this.addSampleToTrack(e,t)}else e.sampleQueue.push(t)}computeSampleTableSizeUpperBound(){D(this.fastStart===`reserve`);let e=0;for(let t of this.trackDatas){let n=t.track.metadata.maximumPacketCount;D(n!==void 0),e+=8*Math.ceil(2/3*n),e+=4*n,e+=8*Math.ceil(2/3*n),e+=12*Math.ceil(2/3*n),e+=4*n,e+=8*n}return e}async onTrackClose(e){let t=await this.mutex.acquire(),n=this.trackDatas.find(t=>t.track===e);n&&(n.type===`subtitle`&&e.source._codec===`webvtt`&&await this.processWebVTTCues(n,1/0),this.processTimestamps(n)),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),this.isFragmented&&await this.interleaveSamples(),t()}async finalize(){let e=await this.mutex.acquire();this.allTracksKnown.resolve();for(let e of this.trackDatas)e.type===`subtitle`&&e.track.source._codec===`webvtt`&&await this.processWebVTTCues(e,1/0),this.processTimestamps(e);if(this.isFragmented)await this.interleaveSamples(!0),await this.finalizeFragment(!1);else for(let e of this.trackDatas)await this.finalizeCurrentChunk(e);if(this.fastStart===`in-memory`){this.mdat=B(!1);let e;for(let t=0;t<2;t++){let t=V(this),n=this.boxWriter.measureBox(t);e=this.boxWriter.measureBox(this.mdat);let r=this.writer.getPos()+n+e;for(let t of this.finalizedChunks){t.offset=r;for(let{data:n}of t.samples)D(n),r+=n.byteLength,e+=n.byteLength}if(r<2**32)break;e>=2**32&&(this.mdat.largeSize=!0)}this.format._options.onMoov&&this.writer.startTrackingWrites();let t=V(this);if(this.boxWriter.writeBox(t),this.format._options.onMoov){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMoov(e,t)}this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat.size=e,this.boxWriter.writeBox(this.mdat);for(let e of this.finalizedChunks)for(let t of e.samples)D(t.data),this.writer.write(t.data),t.data=null;if(this.format._options.onMdat){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMdat(e,t)}}else if(this.isFragmented){let e=this.writer.getPos(),t=Jt(this.trackDatas);this.boxWriter.writeBox(t);let n=this.writer.getPos()-e;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(n)}else{D(this.mdat);let e=this.boxWriter.offsets.get(this.mdat);D(e!==void 0);let t=this.writer.getPos()-e;if(this.mdat.size=t,this.mdat.largeSize=t>=2**32,this.boxWriter.patchBox(this.mdat),this.format._options.onMdat){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMdat(e,t)}let n=V(this);if(this.fastStart===`reserve`){D(this.ftypSize!==null),this.writer.seek(this.ftypSize),this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(n);let e=this.boxWriter.offsets.get(this.mdat)-this.writer.getPos();this.boxWriter.writeBox(tt(e))}else this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(n);if(this.format._options.onMoov){let{data:e,start:t}=this.writer.stopTrackingWrites();this.format._options.onMoov(e,t)}}e()}},Cn=class{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>C.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>i.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>t.includes(e))}_codecUnsupportedHint(e){return``}},wn=class extends Cn{constructor(e={}){if(!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(e.fastStart!==void 0&&![!1,`in-memory`,`reserve`,`fragmented`].includes(e.fastStart))throw TypeError(`options.fastStart, when provided, must be false, 'in-memory', 'reserve', or 'fragmented'.`);if(e.minimumFragmentDuration!==void 0&&(!Number.isFinite(e.minimumFragmentDuration)||e.minimumFragmentDuration<0))throw TypeError(`options.minimumFragmentDuration, when provided, must be a non-negative number.`);if(e.onFtyp!==void 0&&typeof e.onFtyp!=`function`)throw TypeError(`options.onFtyp, when provided, must be a function.`);if(e.onMoov!==void 0&&typeof e.onMoov!=`function`)throw TypeError(`options.onMoov, when provided, must be a function.`);if(e.onMdat!==void 0&&typeof e.onMdat!=`function`)throw TypeError(`options.onMdat, when provided, must be a function.`);if(e.onMoof!==void 0&&typeof e.onMoof!=`function`)throw TypeError(`options.onMoof, when provided, must be a function.`);if(e.metadataFormat!==void 0&&![`mdir`,`mdta`,`udta`,`auto`].includes(e.metadataFormat))throw TypeError(`options.metadataFormat, when provided, must be either 'auto', 'mdir', 'mdta', or 'udta'.`);super(),this._options=e}getSupportedTrackCounts(){let e=2**32-1;return{video:{min:0,max:e},audio:{min:0,max:e},subtitle:{min:0,max:e},total:{min:1,max:e}}}get supportsVideoRotationMetadata(){return!0}get supportsTimestampedMediaData(){return!0}_createMuxer(e){return new Sn(e,this)}},Tn=class extends wn{constructor(e){super(e)}get _name(){return`MP4`}get fileExtension(){return`.mp4`}get mimeType(){return`video/mp4`}getSupportedCodecs(){return[...C,...h,`pcm-s16`,`pcm-s16be`,`pcm-s24`,`pcm-s24be`,`pcm-s32`,`pcm-s32be`,`pcm-f32`,`pcm-f32be`,`pcm-f64`,`pcm-f64be`,...t]}_codecUnsupportedHint(e){return new En().getSupportedCodecs().includes(e)?` Switching to MOV will grant support for this codec.`:``}},En=class extends wn{constructor(e){super(e)}get _name(){return`MOV`}get fileExtension(){return`.mov`}get mimeType(){return`video/quicktime`}getSupportedCodecs(){return[...C,...i]}_codecUnsupportedHint(e){return new Tn().getSupportedCodecs().includes(e)?` Switching to MP4 will grant support for this codec.`:``}},Dn=e=>{if(!e||typeof e!=`object`)throw TypeError(`Encoding config must be an object.`);if(!C.includes(e.codec))throw TypeError(`Invalid video codec '${e.codec}'. Must be one of: ${C.join(`, `)}.`);if(!(e.bitrate instanceof X)&&(!Number.isInteger(e.bitrate)||e.bitrate<=0))throw TypeError(`config.bitrate must be a positive integer or a quality.`);if(e.keyFrameInterval!==void 0&&(!Number.isFinite(e.keyFrameInterval)||e.keyFrameInterval<0))throw TypeError(`config.keyFrameInterval, when provided, must be a non-negative number.`);if(e.sizeChangeBehavior!==void 0&&![`deny`,`passThrough`,`fill`,`contain`,`cover`].includes(e.sizeChangeBehavior))throw TypeError(`config.sizeChangeBehavior, when provided, must be 'deny', 'passThrough', 'fill', 'contain' or 'cover'.`);if(e.onEncodedPacket!==void 0&&typeof e.onEncodedPacket!=`function`)throw TypeError(`config.onEncodedChunk, when provided, must be a function.`);if(e.onEncoderConfig!==void 0&&typeof e.onEncoderConfig!=`function`)throw TypeError(`config.onEncoderConfig, when provided, must be a function.`);On(e.codec,e)},On=(e,t)=>{if(!t||typeof t!=`object`)throw TypeError(`Encoding options must be an object.`);if(t.alpha!==void 0&&![`discard`,`keep`].includes(t.alpha))throw TypeError(`options.alpha, when provided, must be 'discard' or 'keep'.`);if(t.bitrateMode!==void 0&&![`constant`,`variable`].includes(t.bitrateMode))throw TypeError(`bitrateMode, when provided, must be 'constant' or 'variable'.`);if(t.latencyMode!==void 0&&![`quality`,`realtime`].includes(t.latencyMode))throw TypeError(`latencyMode, when provided, must be 'quality' or 'realtime'.`);if(t.fullCodecString!==void 0&&typeof t.fullCodecString!=`string`)throw TypeError(`fullCodecString, when provided, must be a string.`);if(t.fullCodecString!==void 0&&f(t.fullCodecString)!==e)throw TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${e}).`);if(t.hardwareAcceleration!==void 0&&![`no-preference`,`prefer-hardware`,`prefer-software`].includes(t.hardwareAcceleration))throw TypeError(`hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.`);if(t.scalabilityMode!==void 0&&typeof t.scalabilityMode!=`string`)throw TypeError(`scalabilityMode, when provided, must be a string.`);if(t.contentHint!==void 0&&typeof t.contentHint!=`string`)throw TypeError(`contentHint, when provided, must be a string.`)},kn=e=>{let t=e.bitrate instanceof X?e.bitrate._toVideoBitrate(e.codec,e.width,e.height):e.bitrate;return{codec:e.fullCodecString??m(e.codec,e.width,e.height,t),width:e.width,height:e.height,displayWidth:e.squarePixelWidth,displayHeight:e.squarePixelHeight,bitrate:t,bitrateMode:e.bitrateMode,alpha:e.alpha??`discard`,framerate:e.framerate,latencyMode:e.latencyMode,hardwareAcceleration:e.hardwareAcceleration,scalabilityMode:e.scalabilityMode,contentHint:e.contentHint,...l(e.codec)}},An=e=>{if(!e||typeof e!=`object`)throw TypeError(`Encoding config must be an object.`);if(!i.includes(e.codec))throw TypeError(`Invalid audio codec '${e.codec}'. Must be one of: ${i.join(`, `)}.`);if(e.bitrate===void 0&&(!w.includes(e.codec)||e.codec===`flac`))throw TypeError(`config.bitrate must be provided for compressed audio codecs.`);if(e.bitrate!==void 0&&!(e.bitrate instanceof X)&&(!Number.isInteger(e.bitrate)||e.bitrate<=0))throw TypeError(`config.bitrate, when provided, must be a positive integer or a quality.`);if(e.onEncodedPacket!==void 0&&typeof e.onEncodedPacket!=`function`)throw TypeError(`config.onEncodedChunk, when provided, must be a function.`);if(e.onEncoderConfig!==void 0&&typeof e.onEncoderConfig!=`function`)throw TypeError(`config.onEncoderConfig, when provided, must be a function.`);jn(e.codec,e)},jn=(e,t)=>{if(!t||typeof t!=`object`)throw TypeError(`Encoding options must be an object.`);if(t.bitrateMode!==void 0&&![`constant`,`variable`].includes(t.bitrateMode))throw TypeError(`bitrateMode, when provided, must be 'constant' or 'variable'.`);if(t.fullCodecString!==void 0&&typeof t.fullCodecString!=`string`)throw TypeError(`fullCodecString, when provided, must be a string.`);if(t.fullCodecString!==void 0&&f(t.fullCodecString)!==e)throw TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${e}).`)},Mn=e=>{let t=e.bitrate instanceof X?e.bitrate._toAudioBitrate(e.codec):e.bitrate;return{codec:e.fullCodecString??p(e.codec,e.numberOfChannels,e.sampleRate),numberOfChannels:e.numberOfChannels,sampleRate:e.sampleRate,bitrate:t,bitrateMode:e.bitrateMode,...o(e.codec)}},X=class{constructor(e){this._factor=e}_toVideoBitrate(e,t,n){let r=3e6*(t*n/(1920*1080))**.95*{avc:1,hevc:.6,vp9:.6,av1:.4,vp8:1.2}[e]*this._factor;return Math.ceil(r/1e3)*1e3}_toAudioBitrate(e){if(w.includes(e)||e===`flac`)return;let t={aac:128e3,opus:64e3,mp3:16e4,vorbis:64e3,ac3:384e3,eac3:192e3}[e];if(!t)throw Error(`Unhandled codec: ${e}`);let n=t*this._factor;return e===`aac`?n=[96e3,128e3,16e4,192e3].reduce((e,t)=>Math.abs(t-n)<Math.abs(e-n)?t:e):e===`opus`||e===`vorbis`?n=Math.max(6e3,n):e===`mp3`&&(n=[8e3,16e3,24e3,32e3,4e4,48e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4].reduce((e,t)=>Math.abs(t-n)<Math.abs(e-n)?t:e)),Math.round(n/1e3)*1e3}},Nn=new X(2),Pn=async(e,t={})=>{let{width:n=1280,height:r=720,bitrate:i=1e6,...a}=t;if(!C.includes(e))return!1;if(!Number.isInteger(n)||n<=0)throw TypeError(`width must be a positive integer.`);if(!Number.isInteger(r)||r<=0)throw TypeError(`height must be a positive integer.`);if(!(i instanceof X)&&(!Number.isInteger(i)||i<=0))throw TypeError(`bitrate must be a positive integer or a quality.`);On(e,a);let o=null;return ce.length>0&&(o??=kn({codec:e,width:n,height:r,bitrate:i,framerate:void 0,...a}),ce.some(t=>t.supports(e,o)))?!0:typeof VideoEncoder>`u`||(n%2==1||r%2==1)&&(e===`avc`||e===`hevc`)||(o??=kn({codec:e,width:n,height:r,bitrate:i,framerate:void 0,...a,alpha:`discard`}),!(await VideoEncoder.isConfigSupported(o)).supported)?!1:T()?new Promise(async e=>{try{let t=new VideoEncoder({output:()=>{},error:()=>e(!1)});t.configure(o);let i=new Uint8Array(n*r*4),a=new VideoFrame(i,{format:`RGBA`,codedWidth:n,codedHeight:r,timestamp:0});t.encode(a),a.close(),await t.flush(),e(!0)}catch{e(!1)}}):!0},Fn=async(e,t={})=>{let{numberOfChannels:n=2,sampleRate:r=48e3,bitrate:a=128e3,...o}=t;if(!i.includes(e))return!1;if(!Number.isInteger(n)||n<=0)throw TypeError(`numberOfChannels must be a positive integer.`);if(!Number.isInteger(r)||r<=0)throw TypeError(`sampleRate must be a positive integer.`);if(!(a instanceof X)&&(!Number.isInteger(a)||a<=0))throw TypeError(`bitrate must be a positive integer.`);jn(e,o);let s=null;return ye.length>0&&(s??=Mn({codec:e,numberOfChannels:n,sampleRate:r,bitrate:a,...o}),ye.some(t=>t.supports(e,s)))||w.includes(e)?!0:typeof AudioEncoder>`u`?!1:(s??=Mn({codec:e,numberOfChannels:n,sampleRate:r,bitrate:a,...o}),(await AudioEncoder.isConfigSupported(s)).supported===!0)},In=async(e,t)=>{for(let n of e)if(await Pn(n,t))return n;return null},Ln=async(e,t)=>{for(let n of e)if(await Fn(n,t))return n;return null},Rn=class{constructor(){this._connectedTrack=null,this._closingPromise=null,this._closed=!1,this._timestampOffset=0}_ensureValidAdd(){if(!this._connectedTrack)throw Error(`Source is not connected to an output track.`);if(this._connectedTrack.output.state===`canceled`)throw Error(`Output has been canceled.`);if(this._connectedTrack.output.state===`finalizing`||this._connectedTrack.output.state===`finalized`)throw Error(`Output has been finalized.`);if(this._connectedTrack.output.state===`pending`)throw Error(`Output has not started.`);if(this._closed)throw Error(`Source is closed.`)}async _start(){}async _flushAndClose(e){}close(){if(this._closingPromise)return;let e=this._connectedTrack;if(!e)throw Error(`Cannot call close without connecting the source to an output track.`);if(e.output.state===`pending`)throw Error(`Cannot call close before output has been started.`);this._closingPromise=(async()=>{await this._flushAndClose(!1),this._closed=!0,!(e.output.state===`finalizing`||e.output.state===`finalized`)&&e.output._muxer.onTrackClose(e)})()}async _flushOrWaitForOngoingClose(e){return this._closingPromise??=(async()=>{await this._flushAndClose(e),this._closed=!0})()}},zn=class extends Rn{constructor(e){if(super(),this._connectedTrack=null,!C.includes(e))throw TypeError(`Invalid video codec '${e}'. Must be one of: ${C.join(`, `)}.`);this._codec=e}},Bn=class{constructor(e,t){this.source=e,this.encodingConfig=t,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastMultipleOfKeyFrameInterval=-1,this.codedWidth=null,this.codedHeight=null,this.resizeCanvas=null,this.customEncoder=null,this.customEncoderCallSerializer=new _,this.customEncoderQueueSize=0,this.alphaEncoder=null,this.splitter=null,this.splitterCreationFailed=!1,this.alphaFrameQueue=[],this.error=null}async add(e,t,n){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.codedWidth!==null&&this.codedHeight!==null){if(e.codedWidth!==this.codedWidth||e.codedHeight!==this.codedHeight){let n=this.encodingConfig.sizeChangeBehavior??`deny`;if(n!==`passThrough`){if(n===`deny`)throw Error(`Video sample size must remain constant. Expected ${this.codedWidth}x${this.codedHeight}, got ${e.codedWidth}x${e.codedHeight}. To allow the sample size to change over time, set \`sizeChangeBehavior\` to a value other than 'strict' in the encoding options.`);{let r=!1;this.resizeCanvas||(typeof document<`u`?(this.resizeCanvas=document.createElement(`canvas`),this.resizeCanvas.width=this.codedWidth,this.resizeCanvas.height=this.codedHeight):this.resizeCanvas=new OffscreenCanvas(this.codedWidth,this.codedHeight),r=!0);let i=this.resizeCanvas.getContext(`2d`,{alpha:T()});D(i),r||(T()?(i.fillStyle=`black`,i.fillRect(0,0,this.codedWidth,this.codedHeight)):i.clearRect(0,0,this.codedWidth,this.codedHeight)),e.drawWithFit(i,{fit:n}),t&&e.close(),e=new _e(this.resizeCanvas,{timestamp:e.timestamp,duration:e.duration,rotation:e.rotation}),t=!0}}}}else this.codedWidth=e.codedWidth,this.codedHeight=e.codedHeight;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),D(this.encoderInitialized);let r=this.encodingConfig.keyFrameInterval??5,i=Math.floor(e.timestamp/r),a={...n,keyFrame:n?.keyFrame||r===0||i!==this.lastMultipleOfKeyFrameInterval};if(this.lastMultipleOfKeyFrameInterval=i,this.customEncoder){this.customEncoderQueueSize++;let t=e.clone(),n=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(t,a)).then(()=>this.customEncoderQueueSize--).catch(e=>this.error??=e).finally(()=>{t.close()});this.customEncoderQueueSize>=4&&await n}else{D(this.encoder);let n=e.toVideoFrame();if(!this.alphaEncoder)this.encoder.encode(n,a),n.close();else if(n.format&&!n.format.includes(`A`)||this.splitterCreationFailed)this.alphaFrameQueue.push(null),this.encoder.encode(n,a),n.close();else{let e=n.displayWidth,t=n.displayHeight;if(!this.splitter)try{this.splitter=new Vn(e,t)}catch(e){console.error(`Due to an error, only color data will be encoded.`,e),this.splitterCreationFailed=!0,this.alphaFrameQueue.push(null),this.encoder.encode(n,a),n.close()}if(this.splitter){let e=this.splitter.extractColor(n),t=this.splitter.extractAlpha(n);this.alphaFrameQueue.push(t),this.encoder.encode(e,a),e.close(),n.close()}}t&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(e=>this.encoder.addEventListener(`dequeue`,e,{once:!0}))}await this.muxer.mutex.currentPromise}finally{t&&e.close()}}ensureEncoder(e){this.ensureEncoderPromise=(async()=>{let t=kn({width:e.codedWidth,height:e.codedHeight,squarePixelWidth:e.squarePixelWidth,squarePixelHeight:e.squarePixelHeight,...this.encodingConfig,framerate:this.source._connectedTrack?.metadata.frameRate});this.encodingConfig.onEncoderConfig?.(t);let n=ce.find(e=>e.supports(this.encodingConfig.codec,t));if(n)this.customEncoder=new n,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=t,this.customEncoder.onPacket=(e,t)=>{if(!(e instanceof x))throw TypeError(`The first argument passed to onPacket must be an EncodedPacket.`);if(t!==void 0&&(!t||typeof t!=`object`))throw TypeError(`The second argument passed to onPacket must be an object or undefined.`);this.encodingConfig.onEncodedPacket?.(e,t),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,e,t).catch(e=>{this.error??=e})},await this.customEncoder.init();else{if(typeof VideoEncoder>`u`)throw Error(`VideoEncoder is not supported by this browser.`);if(t.alpha=`discard`,this.encodingConfig.alpha===`keep`&&(t.latencyMode=`quality`),(t.width%2==1||t.height%2==1)&&(this.encodingConfig.codec===`avc`||this.encodingConfig.codec===`hevc`))throw Error(`The dimensions ${t.width}x${t.height} are not supported for codec '${this.encodingConfig.codec}'; both width and height must be even numbers. Make sure to round your dimensions to the nearest even number.`);if(!(await VideoEncoder.isConfigSupported(t)).supported)throw Error(`This specific encoder configuration (${t.codec}, ${t.bitrate} bps, ${t.width}x${t.height}, hardware acceleration: ${t.hardwareAcceleration??`no-preference`}) is not supported by this browser. Consider using another codec or changing your video parameters.`);let e=[],n=[],r=0,i=0,a=(e,t,n)=>{let r={};if(t){let e=new Uint8Array(t.byteLength);t.copyTo(e),r.alpha=e}let i=x.fromEncodedChunk(e,r);this.encodingConfig.onEncodedPacket?.(i,n),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,i,n).catch(e=>{this.error??=e})},o=Error(`Encoding error`).stack;if(this.encoder=new VideoEncoder({output:(t,o)=>{if(!this.alphaEncoder){a(t,null,o);return}let s=this.alphaFrameQueue.shift();D(s!==void 0),s?(this.alphaEncoder.encode(s,{keyFrame:t.type===`key`}),i++,s.close(),e.push({chunk:t,meta:o})):i===0?a(t,null,o):(n.push(r+i),e.push({chunk:t,meta:o}))},error:e=>{e.stack=o,this.error??=e}}),this.encoder.configure(t),this.encodingConfig.alpha===`keep`){let o=Error(`Encoding error`).stack;this.alphaEncoder=new VideoEncoder({output:(t,o)=>{i--;let s=e.shift();for(D(s!==void 0),a(s.chunk,t,s.meta),r++;n.length>0&&n[0]===r;){n.shift();let t=e.shift();D(t!==void 0),a(t.chunk,null,t.meta)}},error:e=>{e.stack=o,this.error??=e}}),this.alphaEncoder.configure(t)}}D(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||(await this.encoder.flush(),await this.alphaEncoder?.flush()),this.encoder.state!==`closed`&&this.encoder.close(),this.alphaEncoder&&this.alphaEncoder.state!==`closed`&&this.alphaEncoder.close(),this.alphaFrameQueue.forEach(e=>e?.close()),this.splitter?.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.error}},Vn=class{constructor(e,t){this.lastFrame=null,typeof OffscreenCanvas<`u`?this.canvas=new OffscreenCanvas(e,t):(this.canvas=document.createElement(`canvas`),this.canvas.width=e,this.canvas.height=t);let n=this.canvas.getContext(`webgl2`,{alpha:!0});if(!n)throw Error(`Couldn't acquire WebGL 2 context.`);this.gl=n,this.colorProgram=this.createColorProgram(),this.alphaProgram=this.createAlphaProgram(),this.vao=this.createVAO(),this.sourceTexture=this.createTexture(),this.alphaResolutionLocation=this.gl.getUniformLocation(this.alphaProgram,`u_resolution`),this.gl.useProgram(this.colorProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.colorProgram,`u_sourceTexture`),0),this.gl.useProgram(this.alphaProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.alphaProgram,`u_sourceTexture`),0)}createVertexShader(){return this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
|
|
2
|
+
in vec2 a_position;
|
|
3
|
+
in vec2 a_texCoord;
|
|
4
|
+
out vec2 v_texCoord;
|
|
5
|
+
|
|
6
|
+
void main() {
|
|
7
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
8
|
+
v_texCoord = a_texCoord;
|
|
9
|
+
}
|
|
10
|
+
`)}createColorProgram(){let e=this.createVertexShader(),t=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
|
|
11
|
+
precision highp float;
|
|
12
|
+
|
|
13
|
+
uniform sampler2D u_sourceTexture;
|
|
14
|
+
in vec2 v_texCoord;
|
|
15
|
+
out vec4 fragColor;
|
|
16
|
+
|
|
17
|
+
void main() {
|
|
18
|
+
vec4 source = texture(u_sourceTexture, v_texCoord);
|
|
19
|
+
fragColor = vec4(source.rgb, 1.0);
|
|
20
|
+
}
|
|
21
|
+
`),n=this.gl.createProgram();return this.gl.attachShader(n,e),this.gl.attachShader(n,t),this.gl.linkProgram(n),n}createAlphaProgram(){let e=this.createVertexShader(),t=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
|
|
22
|
+
precision highp float;
|
|
23
|
+
|
|
24
|
+
uniform sampler2D u_sourceTexture;
|
|
25
|
+
uniform vec2 u_resolution; // The width and height of the canvas
|
|
26
|
+
in vec2 v_texCoord;
|
|
27
|
+
out vec4 fragColor;
|
|
28
|
+
|
|
29
|
+
// This function determines the value for a single byte in the YUV stream
|
|
30
|
+
float getByteValue(float byteOffset) {
|
|
31
|
+
float width = u_resolution.x;
|
|
32
|
+
float height = u_resolution.y;
|
|
33
|
+
|
|
34
|
+
float yPlaneSize = width * height;
|
|
35
|
+
|
|
36
|
+
if (byteOffset < yPlaneSize) {
|
|
37
|
+
// This byte is in the luma plane. Find the corresponding pixel coordinates to sample from
|
|
38
|
+
float y = floor(byteOffset / width);
|
|
39
|
+
float x = mod(byteOffset, width);
|
|
40
|
+
|
|
41
|
+
// Add 0.5 to sample the center of the texel
|
|
42
|
+
vec2 sampleCoord = (vec2(x, y) + 0.5) / u_resolution;
|
|
43
|
+
|
|
44
|
+
// The luma value is the alpha from the source texture
|
|
45
|
+
return texture(u_sourceTexture, sampleCoord).a;
|
|
46
|
+
} else {
|
|
47
|
+
// Write a fixed value for chroma and beyond
|
|
48
|
+
return 128.0 / 255.0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void main() {
|
|
53
|
+
// Each fragment writes 4 bytes (R, G, B, A)
|
|
54
|
+
float pixelIndex = floor(gl_FragCoord.y) * u_resolution.x + floor(gl_FragCoord.x);
|
|
55
|
+
float baseByteOffset = pixelIndex * 4.0;
|
|
56
|
+
|
|
57
|
+
vec4 result;
|
|
58
|
+
for (int i = 0; i < 4; i++) {
|
|
59
|
+
float currentByteOffset = baseByteOffset + float(i);
|
|
60
|
+
result[i] = getByteValue(currentByteOffset);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fragColor = result;
|
|
64
|
+
}
|
|
65
|
+
`),n=this.gl.createProgram();return this.gl.attachShader(n,e),this.gl.attachShader(n,t),this.gl.linkProgram(n),n}createShader(e,t){let n=this.gl.createShader(e);return this.gl.shaderSource(n,t),this.gl.compileShader(n),this.gl.getShaderParameter(n,this.gl.COMPILE_STATUS)||console.error(`Shader compile error:`,this.gl.getShaderInfoLog(n)),n}createVAO(){let e=this.gl.createVertexArray();this.gl.bindVertexArray(e);let t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),n=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,n),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW);let r=this.gl.getAttribLocation(this.colorProgram,`a_position`),i=this.gl.getAttribLocation(this.colorProgram,`a_texCoord`);return this.gl.enableVertexAttribArray(r),this.gl.vertexAttribPointer(r,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(i),this.gl.vertexAttribPointer(i,2,this.gl.FLOAT,!1,16,8),e}createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}updateTexture(e){this.lastFrame!==e&&((e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.sourceTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.lastFrame=e)}extractColor(e){return this.updateTexture(e),this.gl.useProgram(this.colorProgram),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0,alpha:`discard`})}extractAlpha(e){this.updateTexture(e),this.gl.useProgram(this.alphaProgram),this.gl.uniform2f(this.alphaResolutionLocation,this.canvas.width,this.canvas.height),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);let{width:t,height:n}=this.canvas,r=Math.ceil(t/2)*Math.ceil(n/2),i=t*n+r*2,a=Math.ceil(i/(t*4)),o=new Uint8Array(4*t*a);this.gl.readPixels(0,0,t,a,this.gl.RGBA,this.gl.UNSIGNED_BYTE,o),o=o.subarray(0,i),D(o[t*n]===128),D(o[o.length-1]===128);let s={format:`I420`,codedWidth:t,codedHeight:n,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[o.buffer]};return new VideoFrame(o,s)}close(){this.gl.getExtension(`WEBGL_lose_context`)?.loseContext(),this.gl=null}},Hn=class extends zn{constructor(e,t){if(!(typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas))throw TypeError(`canvas must be an HTMLCanvasElement or OffscreenCanvas.`);Dn(t),super(t.codec),this._encoder=new Bn(this,t),this._canvas=e}add(e,t=0,n){if(!Number.isFinite(e)||e<0)throw TypeError(`timestamp must be a non-negative number.`);if(!Number.isFinite(t)||t<0)throw TypeError(`duration must be a non-negative number.`);let r=new _e(this._canvas,{timestamp:e,duration:t});return this._encoder.add(r,!0,n)}_flushAndClose(e){return this._encoder.flushAndClose(e)}},Un=class extends Rn{constructor(e){if(super(),this._connectedTrack=null,!i.includes(e))throw TypeError(`Invalid audio codec '${e}'. Must be one of: ${i.join(`, `)}.`);this._codec=e}},Wn=class{constructor(e,t){this.source=e,this.encodingConfig=t,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastNumberOfChannels=null,this.lastSampleRate=null,this.isPcmEncoder=!1,this.outputSampleSize=null,this.writeOutputValue=null,this.customEncoder=null,this.customEncoderCallSerializer=new _,this.customEncoderQueueSize=0,this.lastEndSampleIndex=null,this.error=null}async add(e,t){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.lastNumberOfChannels!==null&&this.lastSampleRate!==null){if(e.numberOfChannels!==this.lastNumberOfChannels||e.sampleRate!==this.lastSampleRate)throw Error(`Audio parameters must remain constant. Expected ${this.lastNumberOfChannels} channels at ${this.lastSampleRate} Hz, got ${e.numberOfChannels} channels at ${e.sampleRate} Hz.`)}else this.lastNumberOfChannels=e.numberOfChannels,this.lastSampleRate=e.sampleRate;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),D(this.encoderInitialized);{let t=Math.round(e.timestamp*e.sampleRate),n=Math.round((e.timestamp+e.duration)*e.sampleRate);if(this.lastEndSampleIndex===null)this.lastEndSampleIndex=n;else{let n=t-this.lastEndSampleIndex;if(n>=64){let t=new me({data:new Float32Array(n*e.numberOfChannels),format:`f32-planar`,sampleRate:e.sampleRate,numberOfChannels:e.numberOfChannels,numberOfFrames:n,timestamp:this.lastEndSampleIndex/e.sampleRate});await this.add(t,!0)}this.lastEndSampleIndex+=e.numberOfFrames}}if(this.customEncoder){this.customEncoderQueueSize++;let t=e.clone(),n=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(t)).then(()=>this.customEncoderQueueSize--).catch(e=>this.error??=e).finally(()=>{t.close()});this.customEncoderQueueSize>=4&&await n,await this.muxer.mutex.currentPromise}else if(this.isPcmEncoder)await this.doPcmEncoding(e,t);else{D(this.encoder);let n=e.toAudioData();this.encoder.encode(n),n.close(),t&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(e=>this.encoder.addEventListener(`dequeue`,e,{once:!0})),await this.muxer.mutex.currentPromise}}finally{t&&e.close()}}async doPcmEncoding(e,t){D(this.outputSampleSize),D(this.writeOutputValue);let{numberOfChannels:n,numberOfFrames:r,sampleRate:i,timestamp:a}=e,o=2048,s=[];for(let t=0;t<r;t+=o){let r=Math.min(o,e.numberOfFrames-t),i=r*n*this.outputSampleSize,a=new ArrayBuffer(i),c=new DataView(a);s.push({frameCount:r,view:c})}let c=e.allocationSize({planeIndex:0,format:`f32-planar`}),l=new Float32Array(c/Float32Array.BYTES_PER_ELEMENT);for(let t=0;t<n;t++){e.copyTo(l,{planeIndex:t,format:`f32-planar`});for(let e=0;e<s.length;e++){let{frameCount:r,view:i}=s[e];for(let a=0;a<r;a++)this.writeOutputValue(i,(a*n+t)*this.outputSampleSize,l[e*o+a])}}t&&e.close();let u={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:n,sampleRate:i}};for(let e=0;e<s.length;e++){let{frameCount:t,view:n}=s[e],r=n.buffer,c=e*o,l=new x(new Uint8Array(r),`key`,a+c/i,t/i);this.encodingConfig.onEncodedPacket?.(l,u),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,l,u)}}ensureEncoder(e){this.ensureEncoderPromise=(async()=>{let{numberOfChannels:t,sampleRate:n}=e,r=Mn({numberOfChannels:t,sampleRate:n,...this.encodingConfig});this.encodingConfig.onEncoderConfig?.(r);let i=ye.find(e=>e.supports(this.encodingConfig.codec,r));if(i)this.customEncoder=new i,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=r,this.customEncoder.onPacket=(e,t)=>{if(!(e instanceof x))throw TypeError(`The first argument passed to onPacket must be an EncodedPacket.`);if(t!==void 0&&(!t||typeof t!=`object`))throw TypeError(`The second argument passed to onPacket must be an object or undefined.`);this.encodingConfig.onEncodedPacket?.(e,t),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,e,t).catch(e=>{this.error??=e})},await this.customEncoder.init();else if(w.includes(this.encodingConfig.codec))this.initPcmEncoder();else{if(typeof AudioEncoder>`u`)throw Error(`AudioEncoder is not supported by this browser.`);if(!(await AudioEncoder.isConfigSupported(r)).supported)throw Error(`This specific encoder configuration (${r.codec}, ${r.bitrate} bps, ${r.numberOfChannels} channels, ${r.sampleRate} Hz) is not supported by this browser. Consider using another codec or changing your audio parameters.`);let e=Error(`Encoding error`).stack;this.encoder=new AudioEncoder({output:(e,t)=>{if(this.encodingConfig.codec===`aac`&&t?.decoderConfig){let e=!1;if(e=!t.decoderConfig.description||t.decoderConfig.description.byteLength<2?!0:s(b(t.decoderConfig.description)).objectType===0,e){let e=Number(O(r.codec.split(`.`)));t.decoderConfig.description=ie({objectType:e,numberOfChannels:t.decoderConfig.numberOfChannels,sampleRate:t.decoderConfig.sampleRate})}}let n=x.fromEncodedChunk(e);this.encodingConfig.onEncodedPacket?.(n,t),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,n,t).catch(e=>{this.error??=e})},error:t=>{t.stack=e,this.error??=t}}),this.encoder.configure(r)}D(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}initPcmEncoder(){this.isPcmEncoder=!0;let e=this.encodingConfig.codec,{dataType:t,sampleSize:n,littleEndian:r}=v(e);switch(this.outputSampleSize=n,n){case 1:t===`unsigned`?this.writeOutputValue=(e,t,n)=>e.setUint8(t,E((n+1)*127.5,0,255)):t===`signed`?this.writeOutputValue=(e,t,n)=>{e.setInt8(t,E(Math.round(n*128),-128,127))}:t===`ulaw`?this.writeOutputValue=(e,t,n)=>{let r=E(Math.floor(n*32767),-32768,32767);e.setUint8(t,we(r))}:t===`alaw`?this.writeOutputValue=(e,t,n)=>{let r=E(Math.floor(n*32767),-32768,32767);e.setUint8(t,ke(r))}:D(!1);break;case 2:t===`unsigned`?this.writeOutputValue=(e,t,n)=>e.setUint16(t,E((n+1)*32767.5,0,65535),r):t===`signed`?this.writeOutputValue=(e,t,n)=>e.setInt16(t,E(Math.round(n*32767),-32768,32767),r):D(!1);break;case 3:t===`unsigned`?this.writeOutputValue=(e,t,n)=>Ae(e,t,E((n+1)*8388607.5,0,16777215),r):t===`signed`?this.writeOutputValue=(e,t,n)=>ve(e,t,E(Math.round(n*8388607),-8388608,8388607),r):D(!1);break;case 4:t===`unsigned`?this.writeOutputValue=(e,t,n)=>e.setUint32(t,E((n+1)*2147483647.5,0,4294967295),r):t===`signed`?this.writeOutputValue=(e,t,n)=>e.setInt32(t,E(Math.round(n*2147483647),-2147483648,2147483647),r):t===`float`?this.writeOutputValue=(e,t,n)=>e.setFloat32(t,n,r):D(!1);break;case 8:t===`float`?this.writeOutputValue=(e,t,n)=>e.setFloat64(t,n,r):D(!1);break;default:De(n),D(!1)}}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||await this.encoder.flush(),this.encoder.state!==`closed`&&this.encoder.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.isPcmEncoder?0:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.error}},Gn=class extends Un{constructor(e){An(e),super(e.codec),this._accumulatedTime=0,this._encoder=new Wn(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw TypeError(`audioBuffer must be an AudioBuffer.`);let t=me._fromAudioBuffer(e,this._accumulatedTime);this._accumulatedTime+=e.duration;for(let e of t)await this._encoder.add(e,!0)}_flushAndClose(e){return this._encoder.flushAndClose(e)}},Kn=class extends Rn{constructor(e){if(super(),this._connectedTrack=null,!t.includes(e))throw TypeError(`Invalid subtitle codec '${e}'. Must be one of: ${t.join(`, `)}.`);this._codec=e}},qn=[`video`,`audio`,`subtitle`],Jn=e=>{if(!e||typeof e!=`object`)throw TypeError(`metadata must be an object.`);if(e.languageCode!==void 0&&!Pe(e.languageCode))throw TypeError(`metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.`);if(e.name!==void 0&&typeof e.name!=`string`)throw TypeError(`metadata.name, when provided, must be a string.`);if(e.disposition!==void 0&&oe(e.disposition),e.maximumPacketCount!==void 0&&(!Number.isInteger(e.maximumPacketCount)||e.maximumPacketCount<0))throw TypeError(`metadata.maximumPacketCount, when provided, must be a non-negative integer.`)},Yn=class{constructor(e){if(this.state=`pending`,this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new ae,this._metadataTags={},!e||typeof e!=`object`)throw TypeError(`options must be an object.`);if(!(e.format instanceof Cn))throw TypeError(`options.format must be an OutputFormat.`);if(!(e.target instanceof vn))throw TypeError(`options.target must be a Target.`);if(e.target._output)throw Error(`Target is already used for another output.`);e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,t={}){if(!(e instanceof zn))throw TypeError(`source must be a VideoSource.`);if(Jn(t),t.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError(`Invalid video rotation: ${t.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&t.rotation)throw Error(`${this.format._name} does not support video rotation metadata.`);if(t.frameRate!==void 0&&(!Number.isFinite(t.frameRate)||t.frameRate<=0))throw TypeError(`Invalid video frame rate: ${t.frameRate}. Must be a positive number.`);this._addTrack(`video`,e,t)}addAudioTrack(e,t={}){if(!(e instanceof Un))throw TypeError(`source must be an AudioSource.`);Jn(t),this._addTrack(`audio`,e,t)}addSubtitleTrack(e,t={}){if(!(e instanceof Kn))throw TypeError(`source must be a SubtitleSource.`);Jn(t),this._addTrack(`subtitle`,e,t)}setMetadataTags(e){if(u(e),this.state!==`pending`)throw Error(`Cannot set metadata tags after output has been started or canceled.`);this._metadataTags=e}_addTrack(e,t,n){if(this.state!==`pending`)throw Error(`Cannot add track after output has been started or canceled.`);if(t._connectedTrack)throw Error(`Source is already used for a track.`);let r=this.format.getSupportedTrackCounts(),i=this._tracks.reduce((t,n)=>t+ +(n.type===e),0),a=r[e].max;if(i===a)throw Error(a===0?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${a} ${e} track${a===1?``:`s`}.`);let o=r.total.max;if(this._tracks.length===o)throw Error(`${this.format._name} does not support more than ${o} tracks${o===1?``:`s`} in total.`);let s={id:this._tracks.length+1,output:this,type:e,source:t,metadata:n};if(s.type===`video`){let e=this.format.getSupportedVideoCodecs();if(e.length===0)throw Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${e.map(e=>`'${e}'`).join(`, `)}.`+this.format._codecUnsupportedHint(s.source._codec))}else if(s.type===`audio`){let e=this.format.getSupportedAudioCodecs();if(e.length===0)throw Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${e.map(e=>`'${e}'`).join(`, `)}.`+this.format._codecUnsupportedHint(s.source._codec))}else if(s.type===`subtitle`){let e=this.format.getSupportedSubtitleCodecs();if(e.length===0)throw Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${e.map(e=>`'${e}'`).join(`, `)}.`+this.format._codecUnsupportedHint(s.source._codec))}this._tracks.push(s),t._connectedTrack=s}async start(){let e=this.format.getSupportedTrackCounts();for(let t of qn){let n=this._tracks.reduce((e,n)=>e+ +(n.type===t),0),r=e[t].min;if(n<r)throw Error(r===e[t].max?`${this.format._name} requires exactly ${r} ${t} track${r===1?``:`s`}.`:`${this.format._name} requires at least ${r} ${t} track${r===1?``:`s`}.`)}let t=e.total.min;if(this._tracks.length<t)throw Error(t===e.total.max?`${this.format._name} requires exactly ${t} track${t===1?``:`s`}.`:`${this.format._name} requires at least ${t} track${t===1?``:`s`}.`);if(this.state===`canceled`)throw Error(`Output has been canceled.`);return this._startPromise?(console.warn(`Output has already been started.`),this._startPromise):this._startPromise=(async()=>{this.state=`started`,this._writer.start();let e=await this._mutex.acquire();await this._muxer.start();let t=this._tracks.map(e=>e.source._start());await Promise.all(t),e()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){if(this._cancelPromise)return console.warn(`Output has already been canceled.`),this._cancelPromise;if(this.state===`finalizing`||this.state===`finalized`){console.warn(`Output has already been finalized.`);return}return this._cancelPromise=(async()=>{this.state=`canceled`;let e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!0));await Promise.all(t),await this._writer.close(),e()})()}async finalize(){if(this.state===`pending`)throw Error(`Cannot finalize before starting.`);if(this.state===`canceled`)throw Error(`Cannot finalize after canceling.`);return this._finalizePromise?(console.warn(`Output has already been finalized.`),this._finalizePromise):this._finalizePromise=(async()=>{this.state=`finalizing`;let e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!1));await Promise.all(t),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state=`finalized`,e()})()}};function Z(){try{if(typeof DOMException<`u`)return new DOMException(`The operation was aborted.`,`AbortError`);throw Error(`DOMException is not available`)}catch{let e=Error(`The operation was aborted.`);return e.name=`AbortError`,e}}function Q(e){return!!e&&typeof e==`object`&&`name`in e&&e.name===`AbortError`}function $(e){if(e?.aborted)throw Z()}function Xn(e){return Math.round(e/2)*2}function Zn(e){return e.pages.reduce((e,t)=>e+(t.duration||5e3),0)}function Qn(e){let t=0;return e.pages.map(e=>{let n=t,r=e.duration||5e3;return t=n+r,{id:e.id,startTime:n,duration:r}})}function $n(e){let t=e.width,n=e.height;for(let r of e.pages){let i=r.width===`auto`?e.width:r.width,a=r.height===`auto`?e.height:r.height;t=Math.max(t,i),n=Math.max(n,a)}return{width:Xn(t),height:Xn(n)}}function er(e){let t=[],n=0;for(let r of e.pages){let e=r.duration||5e3;for(let i of r.children)if(i.type===`video`){let r=i.volume===void 0?1:i.volume;if(r===0)continue;let a=i.startTime||0,o=i.endTime||1,s=i.duration||5e3;t.push({id:i.id,src:i.src,volume:r,startTime:a,endTime:o,duration:s,pageStartTime:n,pageDuration:e})}n+=e}return t}function tr(e,t){let n=[];for(let r of e.pages)n.push({pageId:r.id,width:r.width,height:r.height}),r.set({width:t.width,height:t.height});return n}function nr(e,t){for(let{pageId:n,width:r,height:i}of t){let t=e.pages.find(e=>e.id===n);t&&t.set({width:r,height:i})}}function rr(e,t){let n=le(),r=n.sceneCanvas._canvas;if(r.width=e.width*t,r.height=e.height*t,r.width<=0||r.height<=0)throw Error(`Invalid canvas dimensions: ${r.width}x${r.height}`);return{canvas:r,canvases:n}}async function ir(e,t){let n=new Yn({target:new yn,format:new Tn}),r=await In(n.format.getSupportedVideoCodecs(),{width:e.width,height:e.height});if(!r)throw Error(`Your browser doesn't support video encoding.`);let i=new Hn(e,{codec:r,bitrate:Nn});return n.addVideoTrack(i,{frameRate:t}),{output:n,canvasSource:i}}async function ar(e,t,n){if(!n)return{audioBufferSource:null};let r=t.audios&&t.audios.length>0,i=er(t).length>0;if(!r&&!i)return{audioBufferSource:null};let a=e.format.getSupportedAudioCodecs(),o=[`aac`,`mp3`,`flac`],s=[...o.filter(e=>a.includes(e)),...a.filter(e=>!o.includes(e))],c=await Ln(s,{numberOfChannels:2,sampleRate:44100});if(!c)return console.warn(`[polotno-video-export] Browser doesn't support audio encoding, video will be generated without audio. Tried codecs: `+s.join(`, `)),{audioBufferSource:null};let l=new Gn({codec:c,bitrate:Nn});return e.addAudioTrack(l),{audioBufferSource:l,audioCodec:c}}function or(e,t,n){let r=t[n];return r&&e>=r.startTime&&e<r.startTime+r.duration?n:t.findIndex(t=>e>=t.startTime&&e<t.startTime+t.duration)}async function sr(e,t,n,r,i){e.setCurrentTime(t),await e._toCanvas({pixelRatio:r,pageId:e.pages[n]?.id,_skipTimeout:!0,_exportCanvases:i})}async function cr(e,t,n,r,i,a,o,s,c){let l=1e3/a,u=Math.floor(i/1e3*a)||1;try{$(c),e.setElementsPixelRatio(o);let d=-1,f=0;for(let p=0;p<u;p++){$(c);let m=Date.now(),h=p/a,g=1/a,_=h*1e3;p===0&&(_=1),p===u-1&&(_=Math.min(i-1,(p+1)*l-1));let v=or(_,r,d);if(v!==d&&v>=0&&(e.activePage.set({_rendering:!1}),e.selectPage(e.pages[v].id),e.activePage.set({_rendering:!0}),await e.waitLoading(),$(c),d=v),await sr(e,_,v,o,n),$(c),await t.add(h,g),s){let e=Date.now();if(p===u-1||e-f>=300){let t=e-m;s((p+1)/u*.95,t),f=e}}}}finally{e.pages.forEach(e=>{e.set({_rendering:!1})}),e.setCurrentTime(0)}}async function lr(e,t){let n=await fetch(e,t?{signal:t}:void 0);if(!n.ok)throw Error(`Failed to download audio from ${e}`);return n.arrayBuffer()}async function ur(e,t){return e.decodeAudioData(t)}function dr(e){return e.startsWith(`data:`)}function fr(e){return e.startsWith(`file://`)}function pr(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function mr(e){let t=e.split(`,`)[1],n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}async function hr(e,t){try{return pr(e)?new Ee({source:new be(e),formats:Oe}):dr(e)?new Ee({source:new Me(mr(e)),formats:Oe}):(fr(e),new Ee({source:new Me(await(await fetch(e,t?{signal:t}:void 0)).arrayBuffer()),formats:Oe}))}catch(n){return Q(n)||t?.aborted||console.error(`Failed to create input from ${e.slice(0,50)}:`,n),null}}async function gr(e,t){try{$(t);let n=await hr(e,t);if(!n)return console.log(`[polotno-video-export] checkVideoAudio: createInputFromSource returned null for ${e.slice(0,80)}`),{hasAudio:!1,input:null};let r=await n.getAudioTracks();if(t?.aborted)throw n.dispose(),Z();return r.length===0?(n.dispose(),{hasAudio:!1,input:null}):{hasAudio:!0,input:n}}catch(n){if(Q(n))throw n;if(t?.aborted)throw Z();return console.error(`Failed to check audio for ${e.slice(0,50)}:`,n),{hasAudio:!1,input:null}}}function _r(e,t){let n=e.audios||[],r=er(e);return{storeAudios:n.map(e=>({audio:e,bufferPromise:lr(e.src,t).catch(n=>(Q(n)||t?.aborted||console.error(`Failed to download audio ${e.src}:`,n),null))})),videoAudios:r.map(e=>({video:e,inputPromise:gr(e.src,t).catch(e=>{if(Q(e)||t?.aborted)return{hasAudio:!1,input:null};throw e})}))}}function vr(e,t,n){let r=(e.delay||0)/1e3,i=e.volume===void 0?1:e.volume,a=e.startTime||0,o=e.endTime||1,s=e.duration||n.totalDuration,c=a*s/1e3,l=s*(o-a)/1e3,u=r,d=c,f=Math.min(l,t.duration-c);if(u<0&&(d+=Math.abs(u),f-=Math.abs(u),u=0),f<=0||d>=t.duration)return;let p=n.offlineContext.createBufferSource();p.buffer=t;let m=n.offlineContext.createGain();m.gain.value=i,p.connect(m),m.connect(n.offlineContext.destination),p.start(u,d,f)}function yr(e,t,n){let r=e.startTime*e.duration/1e3,i=e.duration*(e.endTime-e.startTime)/1e3,a=e.pageStartTime/1e3,o=Math.max(0,a),s=Math.max(0,r),c=Math.min(i,t.duration-s,e.pageDuration/1e3);if(c<=0||s>=t.duration)return;let l=n.offlineContext.createBufferSource();l.buffer=t;let u=n.offlineContext.createGain();u.gain.value=e.volume,l.connect(u),u.connect(n.offlineContext.destination),l.start(o,s,c)}async function br(e,t,n,r,i,a,o){$(o);let s=i||_r(e,o);if(s.storeAudios.length+s.videoAudios.length===0)return;let c=44100,l=typeof r==`string`?r:typeof r?.codec==`string`?r.codec:void 0,u=l?.includes(`opus`)?960:1024,d=l===`aac`?3:l?.includes(`opus`)?2:0,f=Math.floor(n/1e3*c),p=Math.floor(f/u)*u,m=d*u,h=Math.max(u,p-m),g=new OfflineAudioContext(2,h,c),_={offlineContext:g,sampleRate:c,totalDuration:n};a?.(.95);let[v,ee]=await Promise.all([Promise.all(s.storeAudios.map(async({audio:e,bufferPromise:t})=>{try{$(o);let n=await t;return $(o),n?{audio:e,audioBuffer:await ur(g,n)}:null}catch(t){if(Q(t))throw t;return console.error(`Failed to process audio ${e.src}:`,t),null}})),Promise.all(s.videoAudios.map(async({video:e,inputPromise:t})=>{try{$(o);let{hasAudio:n,input:r}=await t;if($(o),!n||!r)return console.log(`[polotno-video-export] Video ${e.id} has no audio track or input failed. hasAudio=${n}, input=${!!r}`),null;let i=await r.getPrimaryAudioTrack();if(!i)return console.log(`[polotno-video-export] Video ${e.id} getPrimaryAudioTrack returned null`),r.dispose(),null;let a=new Se(i),s=[];for await(let e of a.buffers())$(o),s.push(e.buffer);if(r.dispose(),$(o),s.length===0)return console.log(`[polotno-video-export] Video ${e.id} AudioBufferSink returned 0 buffers`),null;let c=s.reduce((e,t)=>e+t.length,0),l=g.createBuffer(s[0].numberOfChannels,c,s[0].sampleRate),u=0;for(let e of s){for(let t=0;t<e.numberOfChannels;t++)l.getChannelData(t).set(e.getChannelData(t),u);u+=e.length}return{video:e,audioBuffer:l}}catch(t){if(Q(t))throw t;return console.error(`Failed to extract video audio ${e.src}:`,t),null}}))]);a?.(.97),$(o);for(let e of v)e&&vr(e.audio,e.audioBuffer,_);for(let e of ee)e&&yr(e.video,e.audioBuffer,_);$(o);let te=await g.startRendering();a?.(.99),$(o),await t.add(te)}async function xr({store:e,fps:t=30,pixelRatio:n=1,onProgress:r,includeAudio:i=!0,signal:a}){let o=$n(e),s=tr(e,o),c=null,l=null,u=null,d=null,f=!1;if(a){$(a);let e=()=>{try{l?.close()}catch{}try{u?.close()}catch{}c?.cancel().catch(()=>{})};a.addEventListener(`abort`,e,{once:!0}),d=()=>a.removeEventListener(`abort`,e)}try{$(a);let s=Zn(e);if(s===0)throw Error(`Video duration is 0`);let d=Qn(e),{canvas:p,canvases:m}=rr(o,n),h=await ir(p,t);c=h.output,l=h.canvasSource;let g=await ar(c,e,i);u=g.audioBufferSource||null;let _=g.audioCodec;$(a),await c.start(),await cr(e,l,m,d,s,t,n,r,a),l.close();let v=u?_r(e,a):null;u&&v&&(await br(e,u,s,_,v,r,a),u.close()),$(a),await c.finalize();let ee=c.target,te=new Blob([ee.buffer],{type:c.format.mimeType});return f=!0,te}catch(e){throw Q(e)?e:a?.aborted?Z():e}finally{if(d?.(),!f&&c)try{await c.cancel()}catch{}nr(e,s)}}export{xr as storeToVideo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`modulepreload`,t=function(e,t){return new URL(e,t).href},n={},r=function(r,i,a){let o=Promise.resolve();if(i&&i.length>0){let r=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(i.map(i=>{if(i=t(i,a),i in n)return;n[i]=!0;let o=i.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(a)for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.href===i&&(!o||t.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${i}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:e,o||(l.as=`script`),l.crossOrigin=``,l.href=i,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,t)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(e=>{for(let t of e||[])t.status===`rejected`&&s(t.reason);return r().catch(s)})};export{r as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},l||=function(e){return new e(...[...arguments].slice(1))};var u=_(Array.prototype.forEach),d=_(Array.prototype.lastIndexOf),ee=_(Array.prototype.pop),f=_(Array.prototype.push),te=_(Array.prototype.splice),ne=_(String.prototype.toLowerCase),re=_(String.prototype.toString),ie=_(String.prototype.match),p=_(String.prototype.replace),ae=_(String.prototype.indexOf),oe=_(String.prototype.trim),m=_(Object.prototype.hasOwnProperty),h=_(RegExp.prototype.test),g=se(TypeError);function _(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return c(e,t,n)}}function se(e){return function(){return l(e,[...arguments])}}function v(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ne;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function y(e){for(let t=0;t<e.length;t++)m(e,t)||(e[t]=null);return e}function b(t){let n=s(null);for(let[r,i]of e(t))m(t,r)&&(Array.isArray(i)?n[r]=y(i):i&&typeof i==`object`&&i.constructor===Object?n[r]=b(i):n[r]=i);return n}function x(e,t){for(;e!==null;){let n=i(e,t);if(n){if(n.get)return _(n.get);if(typeof n.value==`function`)return _(n.value)}e=r(e)}function n(){return null}return n}var ce=a(`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`.split(`.`)),le=a(`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`.split(`.`)),ue=a([`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`]),de=a([`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`]),fe=a(`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`.split(`.`)),pe=a([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),me=a([`#text`]),he=a(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.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.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),ge=a(`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.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-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`.split(`.`)),_e=a(`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`.split(`.`)),S=a([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ve=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ye=o(/<%[\w\W]*|[\w\W]*%>/gm),be=o(/\$\{[\w\W]*/gm),C=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),w=o(/^aria-[\-\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Se=o(/^(?:\w+script|data):/i),Ce=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\w]*(-[.\w]+)+$/i),Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:C,DOCTYPE_NAME:we,ERB_EXPR:ye,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:ve,TMPLIT_EXPR:be}),T={element:1,text:3,progressingInstruction:7,comment:8,document:9},De=function(){return typeof window>`u`?null:window},Oe=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ke=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ae(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De(),n=e=>Ae(e);if(n.version=`3.4.0`,n.removed=[],!t||!t.document||t.document.nodeType!==T.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:_,Element:se,NodeFilter:y,NamedNodeMap:ve=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ye,DOMParser:be,trustedTypes:C}=t,w=se.prototype,Se=x(w,`cloneNode`),Ce=x(w,`remove`),Te=x(w,`nextSibling`),je=x(w,`childNodes`),Me=x(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let E,D=``,{implementation:Ne,createNodeIterator:Pe,createDocumentFragment:Fe,getElementsByTagName:Ie}=r,{importNode:Le}=i,O=ke();n.isSupported=typeof e==`function`&&typeof Me==`function`&&Ne&&Ne.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:k,ERB_EXPR:A,TMPLIT_EXPR:j,DATA_ATTR:Re,ARIA_ATTR:ze,IS_SCRIPT_OR_DATA:Be,ATTR_WHITESPACE:Ve,CUSTOM_ELEMENT:He}=Ee,{IS_ALLOWED_URI:Ue}=Ee,M=null,We=v({},[...ce,...le,...ue,...fe,...me]),N=null,Ge=v({},[...he,...ge,..._e,...S]),P=Object.seal(s(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}})),F=null,Ke=null,I=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),qe=!0,Je=!0,Ye=!1,Xe=!0,L=!1,R=!0,z=!1,Ze=!1,Qe=!1,B=!1,V=!1,H=!1,$e=!0,et=!1,tt=!0,U=!1,W={},G=null,nt=v({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),rt=null,it=v({},[`audio`,`video`,`img`,`source`,`image`,`track`]),at=null,ot=v({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),st=`http://www.w3.org/1998/Math/MathML`,ct=`http://www.w3.org/2000/svg`,K=`http://www.w3.org/1999/xhtml`,q=K,lt=!1,ut=null,dt=v({},[st,ct,K],re),ft=v({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),pt=v({},[`annotation-xml`]),mt=v({},[`title`,`style`,`font`,`a`,`script`]),J=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=r.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=b(e),J=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=J===`application/xhtml+xml`?re:ne,M=m(e,`ALLOWED_TAGS`)?v({},e.ALLOWED_TAGS,Y):We,N=m(e,`ALLOWED_ATTR`)?v({},e.ALLOWED_ATTR,Y):Ge,ut=m(e,`ALLOWED_NAMESPACES`)?v({},e.ALLOWED_NAMESPACES,re):dt,at=m(e,`ADD_URI_SAFE_ATTR`)?v(b(ot),e.ADD_URI_SAFE_ATTR,Y):ot,rt=m(e,`ADD_DATA_URI_TAGS`)?v(b(it),e.ADD_DATA_URI_TAGS,Y):it,G=m(e,`FORBID_CONTENTS`)?v({},e.FORBID_CONTENTS,Y):nt,F=m(e,`FORBID_TAGS`)?v({},e.FORBID_TAGS,Y):b({}),Ke=m(e,`FORBID_ATTR`)?v({},e.FORBID_ATTR,Y):b({}),W=m(e,`USE_PROFILES`)?e.USE_PROFILES:!1,qe=e.ALLOW_ARIA_ATTR!==!1,Je=e.ALLOW_DATA_ATTR!==!1,Ye=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,L=e.SAFE_FOR_TEMPLATES||!1,R=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,B=e.RETURN_DOM||!1,V=e.RETURN_DOM_FRAGMENT||!1,H=e.RETURN_TRUSTED_TYPE||!1,Qe=e.FORCE_BODY||!1,$e=e.SANITIZE_DOM!==!1,et=e.SANITIZE_NAMED_PROPS||!1,tt=e.KEEP_CONTENT!==!1,U=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||xe,q=e.NAMESPACE||K,ft=e.MATHML_TEXT_INTEGRATION_POINTS||ft,pt=e.HTML_INTEGRATION_POINTS||pt,P=e.CUSTOM_ELEMENT_HANDLING||s(null),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(P.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),L&&(Je=!1),V&&(B=!0),W&&(M=v({},me),N=s(null),W.html===!0&&(v(M,ce),v(N,he)),W.svg===!0&&(v(M,le),v(N,ge),v(N,S)),W.svgFilters===!0&&(v(M,ue),v(N,ge),v(N,S)),W.mathMl===!0&&(v(M,fe),v(N,_e),v(N,S))),I.tagCheck=null,I.attributeCheck=null,e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?I.tagCheck=e.ADD_TAGS:(M===We&&(M=b(M)),v(M,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?I.attributeCheck=e.ADD_ATTR:(N===Ge&&(N=b(N)),v(N,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&v(at,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(G===nt&&(G=b(G)),v(G,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(G===nt&&(G=b(G)),v(G,e.ADD_FORBID_CONTENTS,Y)),tt&&(M[`#text`]=!0),z&&v(M,[`html`,`head`,`body`]),M.table&&(v(M,[`tbody`]),delete F.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw g(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw g(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);E=e.TRUSTED_TYPES_POLICY,D=E.createHTML(``)}else E===void 0&&(E=Oe(C,o)),E!==null&&typeof D==`string`&&(D=E.createHTML(``));a&&a(e),X=e}},yt=v({},[...le,...ue,...de]),bt=v({},[...fe,...pe]),xt=function(e){let t=Me(e);(!t||!t.tagName)&&(t={namespaceURI:q,tagName:`template`});let n=ne(e.tagName),r=ne(t.tagName);return ut[e.namespaceURI]?e.namespaceURI===ct?t.namespaceURI===K?n===`svg`:t.namespaceURI===st?n===`svg`&&(r===`annotation-xml`||ft[r]):!!yt[n]:e.namespaceURI===st?t.namespaceURI===K?n===`math`:t.namespaceURI===ct?n===`math`&&pt[r]:!!bt[n]:e.namespaceURI===K?t.namespaceURI===ct&&!pt[r]||t.namespaceURI===st&&!ft[r]?!1:!bt[n]&&(mt[n]||!yt[n]):!!(J===`application/xhtml+xml`&&ut[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{Me(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(B||V)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},St=function(e){let t=null,n=null;if(Qe)e=`<remove></remove>`+e;else{let t=ie(e,/^[\r\n\t ]+/);n=t&&t[0]}J===`application/xhtml+xml`&&q===K&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=E?E.createHTML(e):e;if(q===K)try{t=new be().parseFromString(i,J)}catch{}if(!t||!t.documentElement){t=Ne.createDocument(q,`template`,null);try{t.documentElement.innerHTML=lt?D:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),q===K?Ie.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},Ct=function(e){return Pe.call(e.ownerDocument||e,e,y.SHOW_ELEMENT|y.SHOW_COMMENT|y.SHOW_TEXT|y.SHOW_PROCESSING_INSTRUCTION|y.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof ye&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof ve)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof _==`function`&&e instanceof _};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Et=function(e){let t=null;if($(O.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(O.uponSanitizeElement,e,{tagName:r,allowedTags:M}),R&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||R&&e.namespaceURI===K&&r===`style`&&Tt(e.firstElementChild)||e.nodeType===T.progressingInstruction||R&&e.nodeType===T.comment&&h(/<[/\w]/g,e.data))return Z(e),!0;if(F[r]||!(I.tagCheck instanceof Function&&I.tagCheck(r))&&!M[r]){if(!F[r]&&Ot(r)&&(P.tagNameCheck instanceof RegExp&&h(P.tagNameCheck,r)||P.tagNameCheck instanceof Function&&P.tagNameCheck(r)))return!1;if(tt&&!G[r]){let t=Me(e)||e.parentNode,n=je(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof se&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(L&&e.nodeType===T.text&&(t=e.textContent,u([k,A,j],e=>{t=p(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(O.afterSanitizeElements,e,null),!1)},Dt=function(e,t,n){if(Ke[t]||$e&&(t===`id`||t===`name`)&&(n in r||n in gt))return!1;if(!(Je&&!Ke[t]&&h(Re,t))&&!(qe&&h(ze,t))&&!(I.attributeCheck instanceof Function&&I.attributeCheck(t,e))){if(!N[t]||Ke[t]){if(!(Ot(e)&&(P.tagNameCheck instanceof RegExp&&h(P.tagNameCheck,e)||P.tagNameCheck instanceof Function&&P.tagNameCheck(e))&&(P.attributeNameCheck instanceof RegExp&&h(P.attributeNameCheck,t)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(t,e))||t===`is`&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&h(P.tagNameCheck,n)||P.tagNameCheck instanceof Function&&P.tagNameCheck(n))))return!1}else if(!at[t]&&!h(Ue,p(n,Ve,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ae(n,`data:`)===0&&rt[e])&&!(Ye&&!h(Be,p(n,Ve,``)))&&n)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&ie(e,He)},kt=function(e){$(O.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:N,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=s,d=a===`value`?l:oe(l);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(O.uponSanitizeAttribute,e,r),d=r.attrValue,et&&(c===`id`||c===`name`)&&(Q(a,e),d=`user-content-`+d),R&&h(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Q(a,e);continue}if(c===`attributename`&&ie(d,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Xe&&h(/\/>/i,d)){Q(a,e);continue}L&&u([k,A,j],e=>{d=p(d,e,` `)});let f=Y(e.nodeName);if(!Dt(f,c,d)){Q(a,e);continue}if(E&&typeof C==`object`&&typeof C.getAttributeType==`function`&&!o)switch(C.getAttributeType(f,c)){case`TrustedHTML`:d=E.createHTML(d);break;case`TrustedScriptURL`:d=E.createScriptURL(d);break}if(d!==l)try{o?e.setAttributeNS(o,a,d):e.setAttribute(a,d),wt(e)?Z(e):ee(n.removed)}catch{Q(a,e)}}$(O.afterSanitizeAttributes,e,null)},At=function(e){let t=null,n=Ct(e);for($(O.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)$(O.uponSanitizeShadowNode,t,null),Et(t),kt(t),t.content instanceof c&&At(t.content);$(O.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(lt=!e,lt&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw g(`dirty is not a string, aborting`)}else throw g(`toString is not a function`);if(!n.isSupported)return e;if(Ze||vt(t),n.removed=[],typeof e==`string`&&(U=!1),U){if(e.nodeName){let t=Y(e.nodeName);if(!M[t]||F[t])throw g(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof _)r=St(`<!---->`),a=r.ownerDocument.importNode(e,!0),a.nodeType===T.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!B&&!L&&!z&&e.indexOf(`<`)===-1)return E&&H?E.createHTML(e):e;if(r=St(e),!r)return B?null:H?D:``}r&&Qe&&Z(r.firstChild);let l=Ct(U?e:r);for(;o=l.nextNode();)Et(o),kt(o),o.content instanceof c&&At(o.content);if(U)return e;if(B){if(L){r.normalize();let e=r.innerHTML;u([k,A,j],t=>{e=p(e,t,` `)}),r.innerHTML=e}if(V)for(s=Fe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(N.shadowroot||N.shadowrootmode)&&(s=Le.call(i,s,!0)),s}let d=z?r.outerHTML:r.innerHTML;return z&&M[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&h(we,r.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+r.ownerDocument.doctype.name+`>
|
|
2
|
+
`+d),L&&u([k,A,j],e=>{d=p(d,e,` `)}),E&&H?E.createHTML(d):d},n.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ze=!0},n.clearConfig=function(){X=null,Ze=!1},n.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},n.addHook=function(e,t){typeof t==`function`&&f(O[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(O[e],t);return n===-1?void 0:te(O[e],n,1)[0]}return ee(O[e])},n.removeHooks=function(e){O[e]=[]},n.removeAllHooks=function(){O=ke()},n}var je=Ae();export{je as default};
|
package/dist/index.html
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
}
|
|
9
9
|
</style>
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/chunk-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-QaF0YGOe.js"></script>
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/chunk-DECur_0Z.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="./assets/preload-helper-xBbMyY7u.js">
|
|
14
|
+
<link rel="modulepreload" crossorigin href="./assets/id3-D55z-fRR.js">
|
|
13
15
|
</head>
|
|
14
16
|
<body>
|
|
15
17
|
<div id="root"></div>
|