@dev-anywhere/relay 0.9.21 → 0.10.1

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.
@@ -1,4 +1,4 @@
1
- import{g as Te,a as _e}from"./index-CTVBM14S.js";import{_ as Le}from"./__vite-browser-external-D7Ct-6yo.js";function Ge(R,Y){for(var L=0;L<Y.length;L++){const w=Y[L];if(typeof w!="string"&&!Array.isArray(w)){for(const S in w)if(S!=="default"&&!(S in R)){const g=Object.getOwnPropertyDescriptor(w,S);g&&Object.defineProperty(R,S,g.get?g:{enumerable:!0,get:()=>w[S]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}var K={exports:{}};const Ie=Te(Le);var Re=K.exports,ge;function Oe(){return ge||(ge=1,(function(R,Y){(function(L,w){R.exports=w(Ie)})(Re,function(L){function w(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function S(r,e,t){return e=F(e),(function(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i})(n)})(r,ie()?Reflect.construct(e,t||[],F(r).constructor):e.apply(r,t))}function g(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,se(n.key),n)}}function b(r,e,t){return e&&ne(r.prototype,e),t&&ne(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function C(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=J(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(s){throw s},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
1
+ import{g as Te,a as _e}from"./index-T5NTU40d.js";import{_ as Le}from"./__vite-browser-external-D7Ct-6yo.js";function Ge(R,Y){for(var L=0;L<Y.length;L++){const w=Y[L];if(typeof w!="string"&&!Array.isArray(w)){for(const S in w)if(S!=="default"&&!(S in R)){const g=Object.getOwnPropertyDescriptor(w,S);g&&Object.defineProperty(R,S,g.get?g:{enumerable:!0,get:()=>w[S]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}var K={exports:{}};const Ie=Te(Le);var Re=K.exports,ge;function Oe(){return ge||(ge=1,(function(R,Y){(function(L,w){R.exports=w(Ie)})(Re,function(L){function w(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function S(r,e,t){return e=F(e),(function(n,a){if(a&&(typeof a=="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i})(n)})(r,ie()?Reflect.construct(e,t||[],F(r).constructor):e.apply(r,t))}function g(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,se(n.key),n)}}function b(r,e,t){return e&&ne(r.prototype,e),t&&ne(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function C(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=J(r))||e){t&&(r=t);var n=0,a=function(){};return{s:a,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(s){throw s},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var s=t.next();return o=s.done,s},e:function(s){u=!0,i=s},f:function(){try{o||t.return==null||t.return()}finally{if(u)throw i}}}}function k(r,e,t){return(e=se(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function F(r){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(r)}function P(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&$(r,e)}function ie(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ie=function(){return!!r})()}function $(r,e){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$(r,e)}function ae(r,e){return(function(t){if(Array.isArray(t))return t})(r)||(function(t,n){var a=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(a!=null){var i,o,u,s,f=[],l=!0,c=!1;try{if(u=(a=a.call(t)).next,n!==0)for(;!(l=(i=u.call(a)).done)&&(f.push(i.value),f.length!==n);l=!0);}catch(p){c=!0,o=p}finally{try{if(!l&&a.return!=null&&(s=a.return(),Object(s)!==s))return}finally{if(c)throw o}}return f}})(r,e)||J(r,e)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function M(r){return(function(e){if(Array.isArray(e))return w(e)})(r)||(function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)})(r)||J(r)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function se(r){var e=(function(t,n){if(typeof t!="object"||!t)return t;var a=t[Symbol.toPrimitive];if(a!==void 0){var i=a.call(t,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)})(r,"string");return typeof e=="symbol"?e:e+""}function W(r){return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(r)}function J(r,e){if(r){if(typeof r=="string")return w(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?w(r,e):void 0}}var Z,Q;function v(r){if(Z){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];Z.apply(void 0,[r].concat(t))}}function A(r){if(Q){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];Q.apply(void 0,[r].concat(t))}}var j=(function(){return b(function r(e){g(this,r),this.listener={},this.type=""|e},[{key:"on",value:function(r,e){return this.listener[r]||(this.listener[r]=[]),this.listener[r].push(e),!0}},{key:"off",value:function(r,e){if(this.listener[r]){var t=this.listener[r].indexOf(e);return t>-1&&this.listener[r].splice(t,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return!!this.listener[r]&&(this.listener[r].map(function(a){a.apply(null,t)}),!0)}}])})(),N=(function(){function r(){g(this,r)}return b(r,null,[{key:"init",value:function(){var e;for(e in r.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hev1:[],hvcC:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},r.types)r.types.hasOwnProperty(e)&&(r.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);r.HDLR_TYPES={video:t,audio:n};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);r.STTS=r.STSC=r.STCO=i,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);r.FTYP=r.box(r.types.ftyp,o,s,o,u),r.DINF=r.box(r.types.dinf,r.box(r.types.dref,a))}},{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];for(var i,o=8,u=n.length,s=u;u--;)o+=n[u].byteLength;for((i=new Uint8Array(o))[0]=o>>24&255,i[1]=o>>16&255,i[2]=o>>8&255,i[3]=255&o,i.set(e,4),u=0,o=8;u<s;++u)i.set(n[u],o),o+=n[u].byteLength;return i}},{key:"hdlr",value:function(e){return r.box(r.types.hdlr,r.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return r.box(r.types.mdat,e)}},{key:"mdhd",value:function(e,t){return r.box(r.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"mdia",value:function(e){return r.box(r.types.mdia,r.mdhd(e.timescale,e.duration),r.hdlr(e.type),r.minf(e))}},{key:"mfhd",value:function(e){return r.box(r.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"minf",value:function(e){return e.type==="audio"?r.box(r.types.minf,r.box(r.types.smhd,r.SMHD),r.DINF,r.stbl(e)):r.box(r.types.minf,r.box(r.types.vmhd,r.VMHD),r.DINF,r.stbl(e))}},{key:"moof",value:function(e,t,n){return r.box(r.types.moof,r.mfhd(e),r.traf(n,t))}},{key:"moov",value:function(e,t,n){for(var a=e.length,i=[];a--;)i[a]=r.trak(e[a]);return r.box.apply(null,[r.types.moov,r.mvhd(n,t)].concat(i).concat(r.mvex(e)))}},{key:"mvex",value:function(e){for(var t=e.length,n=[];t--;)n[t]=r.trex(e[t]);return r.box.apply(null,[r.types.mvex].concat(n))}},{key:"mvhd",value:function(e,t){var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,e>>24&255,e>>16&255,e>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return r.box(r.types.mvhd,n)}},{key:"sdtp",value:function(e){var t,n,a=e.samples||[],i=new Uint8Array(4+a.length);for(n=0;n<a.length;n++)t=a[n].flags,i[n+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return r.box(r.types.sdtp,i)}},{key:"stbl",value:function(e){return r.box(r.types.stbl,r.stsd(e),r.box(r.types.stts,r.STTS),r.box(r.types.stsc,r.STSC),r.box(r.types.stsz,r.STSZ),r.box(r.types.stco,r.STCO))}},{key:"avc1",value:function(e){var t,n,a,i=[],o=[];for(t=0;t<e.sps.length;t++)a=(n=e.sps[t]).byteLength,i.push(a>>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(t=0;t<e.pps.length;t++)a=(n=e.pps[t]).byteLength,o.push(a>>>8&255),o.push(255&a),o=o.concat(Array.prototype.slice.call(n));var u=r.box(r.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|e.sps.length].concat(i).concat([e.pps.length]).concat(o))),s=e.width,f=e.height;return r.box(r.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,255&s,f>>8&255,255&f,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,r.box(r.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"hev1",value:function(e){for(var t,n,a=[],i=[],o=[],u=0;u<(((s=e.vps)===null||s===void 0?void 0:s.length)||0);u++){var s;n=(t=e.vps[u]).byteLength,a.push(n>>>8&255,255&n),a=a.concat(Array.prototype.slice.call(t))}for(var f=0;f<(((l=e.sps)===null||l===void 0?void 0:l.length)||0);f++){var l;n=(t=e.sps[f]).byteLength,i.push(n>>>8&255,255&n),i=i.concat(Array.prototype.slice.call(t))}for(var c=0;c<(((p=e.pps)===null||p===void 0?void 0:p.length)||0);c++){var p;n=(t=e.pps[c]).byteLength,o.push(n>>>8&255,255&n),o=o.concat(Array.prototype.slice.call(t))}var y=e.hvcC,B=y.profile_space,m=y.tier_flag,U=y.profile_idc,h=y.profile_compatibility_flags,E=y.constraint_indicator_flags,x=y.level_idc,I=y.chroma_format_idc,_=r.box(r.types.hvcC,new Uint8Array([1,B<<6|m<<5|U,h>>24&255,h>>16&255,h>>8&255,255&h].concat(M(E),[x,240,0,252,252|I,248,248,0,0,3,3,32,0,1],M(a),[33,0,1],M(i),[34,0,1],M(o)))),d=e.width,D=e.height;return r.box(r.types.hev1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,255&d,D>>8&255,255&D,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,r.box(r.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,n=new Uint8Array(26+t+3);return n.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),n.set(e.config,26),n.set([6,1,2],26+t),n}},{key:"mp4a",value:function(e){var t=e.audiosamplerate;return r.box(r.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),r.box(r.types.esds,r.esds(e)))}},{key:"stsd",value:function(e){return e.type==="audio"?r.box(r.types.stsd,r.STSD,r.mp4a(e)):e.codec.startsWith("hvc1")?r.box(r.types.stsd,r.STSD,r.hev1(e)):r.box(r.types.stsd,r.STSD,r.avc1(e))}},{key:"tkhd",value:function(e){var t=e.id,n=e.duration,a=e.width,i=e.height,o=e.volume;return r.box(r.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,255&o,o%1*10&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,i>>8&255,255&i,0,0]))}},{key:"traf",value:function(e,t){var n=r.sdtp(e),a=e.id;return r.box(r.types.traf,r.box(r.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),r.box(r.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),r.trun(e,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(e){return e.duration=e.duration||4294967295,r.box(r.types.trak,r.tkhd(e),r.mdia(e))}},{key:"trex",value:function(e){var t=e.id;return r.box(r.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(e,t){var n,a,i,o,u,s,f=e.samples||[],l=f.length,c=12+16*l,p=new Uint8Array(c);for(t+=8+c,p.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),n=0;n<l;n++)i=(a=f[n]).duration,o=a.size,u=a.flags,s=a.cts,p.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,o>>>24&255,o>>>16&255,o>>>8&255,255&o,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,61440&u.degradPrio,15&u.degradPrio,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12+16*n);return r.box(r.types.trun,p)}},{key:"initSegment",value:function(e,t,n){r.types||r.init();var a,i=r.moov(e,t,n);return(a=new Uint8Array(r.FTYP.byteLength+i.byteLength)).set(r.FTYP),a.set(i,r.FTYP.byteLength),a}}])})(),be=(function(){function r(){g(this,r)}return b(r,null,[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return!(e[0]!==255||240&~e[1]||6&e[1])}},{key:"extractAAC",value:function(e){var t,n,a=0,i=e.byteLength,o=[];if(!r.isAACPattern(e))return A("Invalid ADTS audio format"),{valid:!1};t=r.getHeaderLength(e);for(var u=e.subarray(0,t);a<i;)n=r.getFrameLength(e),o.push(e.subarray(t,n)),e=e.slice(n),a+=n;return{valid:!0,header:u,slices:o}}}])})(),Ue=1,G=(function(r){function e(){return g(this,e),S(this,e,arguments)}return P(e,r),b(e,[{key:"flush",value:function(){this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return Ue++}}])})(j),Se=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["AACRemuxer"])).frameDuration=a,i.readyToDecode=!1,i.header=null,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:t,duration:n,samples:[],config:"",codec:""},i.samples=[],i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.header=null,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale,this.nextDts=0,this.dts=0}},{key:"feed",value:function(t,n){var a=be.extractAAC(t),i=a.valid,o=a.header,u=a.slices;return this.header||(this.header=o),i&&u.length>0?(this.remux(this.getAudioFrames(u,n)),!0):(A("Failed to extract audio data from:",t),this.dispatch("outOfData"),!1)}},{key:"getAudioFrames",value:function(t,n){var a,i,o=[],u=0,s=C(t);try{for(s.s();!(i=s.n()).done;){var f=i.value;o.push({units:f})}}catch(l){s.e(l)}finally{s.f()}return a=n?n/o.length|0:this.frameDuration,u=n?n-a*o.length:0,o.map(function(l){l.duration=a,u>0&&(l.duration++,u--)}),o}},{key:"remux",value:function(t){if(t.length>0)for(var n=0;n<t.length;n++){var a=t[n],i=a.units,o=i.byteLength;this.samples.push({units:i,size:o,duration:a.duration}),this.mp4track.len+=o,this.readyToDecode||this.setAACConfig()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift();u.units,(n=u.duration)<=0?(v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size):(this.nextDts+=n,t={size:u.size,duration:n,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},a.set(u.units,i),i+=u.size,o.push(t))}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"setAACConfig",value:function(){var t,n,a,i=new Uint8Array(2);this.header&&(t=((192&this.header[2])>>>6)+1,n=(60&this.header[2])>>>2,a=(1&this.header[2])<<2,a|=(192&this.header[3])>>>6,i[0]=t<<3,i[0]|=(14&n)>>1,i[1]|=(1&n)<<7,i[1]|=a<<3,this.mp4track.codec="mp4a.40."+t,this.mp4track.channelCount=a,this.mp4track.config=i,this.readyToDecode=!0)}}])})(G),z=(function(){return b(function r(e){g(this,r),this.data=e,this.index=0,this.bitLength=8*e.byteLength},[{key:"setData",value:function(r){this.data=r,this.index=0,this.bitLength=8*r.byteLength}},{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(r){if(this.bitsAvailable<r)return!1;this.index+=r}},{key:"readBits",value:function(r){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return this.getBits(r,this.index,e)}},{key:"getBits",value:function(r,e){var t=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(this.bitsAvailable<r)return 0;var n=e%8,a=this.data[e/8|0]&255>>>n,i=8-n;if(i>=r)return t&&(this.index+=r),a>>i-r;t&&(this.index+=i);var o=r-i;return a<<o|this.getBits(o,e+i,t)}},{key:"skipLZ",value:function(){var r;for(r=0;r<this.bitLength-this.index;++r)if(this.getBits(1,this.index+r,!1)!==0)return this.index+=r,r;return r}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var r=this.skipLZ();return this.readBits(r+1)-1}},{key:"readEG",value:function(){var r=this.readUEG();return 1&r?1+r>>>1:-1*(r>>>1)}},{key:"readBoolean",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.readBits(8*r)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}])})(),oe=(function(){function r(){g(this,r)}return b(r,null,[{key:"extractNALu",value:function(e){for(var t=0,n=e.byteLength,a=[],i=0,o=0;t<n;){var u=e[t++];if(u===0)o++;else if(u===1&&o>=2){var s=o+1;i!==t-s&&a.push(e.subarray(i,t-s)),i=t,o=0}else o=0}var f=null;return i<n&&(f=e.subarray(i,n)),[a,f]}},{key:"skipScalingList",value:function(e,t){for(var n=8,a=8,i=0;i<t;i++)a!==0&&(a=(n+e.readEG()+256)%256),n=a===0?n:a}},{key:"readSPS",value:function(e){var t,n,a,i,o,u,s=new z(e),f=0,l=0,c=0,p=0,y=1,B=0;s.readUByte();for(var m=[],U=e.byteLength,h=1;h<U;h++)h+2<U&&s.readBits(24,!1)===3?(m.push(s.readBits(8)),m.push(s.readBits(8)),h+=2,s.readBits(8)):m.push(s.readBits(8));if(s.setData(new Uint8Array(m)),t=s.readUByte(),s.readBits(5),s.skipBits(3),s.readUByte(),s.skipUEG(),t===100||t===110||t===122||t===244||t===44||t===83||t===86||t===118||t===128){var E=s.readUEG();if(E===3&&s.skipBits(1),s.skipUEG(),s.skipUEG(),s.skipBits(1),s.readBoolean()){u=E!==3?8:12;for(var x=0;x<u;++x)s.readBoolean()&&(x<6?r.skipScalingList(s,16):r.skipScalingList(s,64))}}s.skipUEG();var I=s.readUEG();if(I===0)s.readUEG();else if(I===1){s.skipBits(1),s.skipEG(),s.skipEG(),n=s.readUEG();for(var _=0;_<n;++_)s.skipEG()}if(s.skipUEG(),s.skipBits(1),a=s.readUEG(),i=s.readUEG(),(o=s.readBits(1))===0&&s.skipBits(1),s.skipBits(1),s.readBoolean()&&(f=s.readUEG(),l=s.readUEG(),c=s.readUEG(),p=s.readUEG()),s.readBoolean()){if(s.readBoolean()){var d;switch(s.readUByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[s.readUByte()<<8|s.readUByte(),s.readUByte()<<8|s.readUByte()]}d&&d[0]>0&&d[1]>0&&(y=d[0]/d[1])}if(s.readBoolean()&&s.skipBits(1),s.readBoolean()&&(s.skipBits(4),s.readBoolean()&&s.skipBits(24)),s.readBoolean()&&(s.skipUEG(),s.skipUEG()),s.readBoolean()){var D=s.readUInt(),H=s.readUInt();s.readBoolean(),B=H/(2*D)}}return{fps:B>0?B:void 0,width:Math.ceil((16*(a+1)-2*f-2*l)*y),height:(2-o)*(i+1)*16-(o?2:4)*(c+p)}}}])})(),O=(function(){function r(e){g(this,r),this.payload=e,this.nri=(96&this.payload[0])>>5,this.nalUnitType=31&this.payload[0],this._sliceType=null,this._isFirstSlice=!1}return b(r,[{key:"toString",value:function(){return"".concat(r.TYPES[this.type()]||"UNKNOWN",": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return this.nalUnitType===r.IDR}},{key:"isVCL",get:function(){return this.nalUnitType==r.IDR||this.nalUnitType==r.NDR}},{key:"parseHeader",value:function(){var e=new z(this.getPayload());e.readUByte(),this._isFirstSlice=e.readUEG()===0,this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){return k(k(k(k(k(k({},r.IDR,"IDR"),r.SEI,"SEI"),r.SPS,"SPS"),r.PPS,"PPS"),r.NDR,"NDR"),r.AUD,"AUD")}}])})();function V(r,e){var t=new Uint8Array((0|r.byteLength)+(0|e.byteLength));return t.set(r,0),t.set(e,0|r.byteLength),t}function Be(r){var e,t,n,a="";return e=Math.floor(r),(t=parseInt(e/3600,10)%24)>0&&(a+=(t<10?"0"+t:t)+":"),a+=((n=parseInt(e/60,10)%60)<10?"0"+n:n)+":"+((e=e<0?0:e%60)<10?"0"+e:e)}var we=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["H264Remuxer"])).frameDuration=a,i.readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},i.samples=[],i.remainingData=new Uint8Array,i.kfCounter=0,i.pendingUnits={},i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps="",this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(t,n,a){var i,o=arguments.length>3&&arguments[3]!==void 0&&arguments[3],u=[];t=V(this.remainingData,t);var s=ae(oe.extractNALu(t),2);return u=s[0],(i=s[1])?o?(u.push(i),this.remainingData=new Uint8Array):this.remainingData=i:this.remainingData=new Uint8Array,u.length>0?(this.remux(this.getVideoFrames(u,n,a)),!0):(v("Failed to extract any NAL units from video data:",i),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(t,n,a){var i,o=this,u=[],s=[],f=0,l=!1,c=!1;this.pendingUnits.units&&(u=this.pendingUnits.units,c=this.pendingUnits.vcl,l=this.pendingUnits.keyFrame,this.pendingUnits={});var p,y=C(t);try{for(y.s();!(p=y.n()).done;){var B=p.value,m=new O(B);this.parseNAL(m)&&(u.length&&c&&(m.isFirstSlice||!m.isVCL)&&(s.push({units:u,keyFrame:l}),u=[],l=!1,c=!1),u.push(m),l=l||m.isKeyframe,c=c||m.isVCL)}}catch(h){y.e(h)}finally{y.f()}if(u.length)if(n)if(c)s.push({units:u,keyFrame:l});else{var U=s.length-1;U>=0&&(s[U].units=s[U].units.concat(u))}else this.pendingUnits={units:u,keyFrame:l,vcl:c};return i=n?n/s.length|0:this.frameDuration,f=n?n-i*s.length:0,s.map(function(h){h.duration=i,h.compositionTimeOffset=a,f>0&&(h.duration++,f--),o.kfCounter++,h.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*i/1e3)}),v("jmuxer: No. of H264 frames of the last chunk: ".concat(s.length)),s}},{key:"remux",value:function(t){var n,a=C(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.units.reduce(function(u,s){return u+s.getSize()},0);i.units.length>0&&this.readyToDecode&&(this.mp4track.len+=o,this.samples.push({units:i.units,size:o,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(u){a.e(u)}finally{a.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),s=u.units;if((n=u.duration)<=0)v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size;else{this.nextDts+=n,t={size:u.size,duration:n,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var f,l=C(s);try{for(l.s();!(f=l.n()).done;){var c=f.value;a.set(c.getData(),i),i+=c.getSize()}}catch(p){l.e(p)}finally{l.f()}o.push(t)}}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(t){var n=oe.readSPS(new Uint8Array(t));this.mp4track.fps=n.fps||this.mp4track.fps,this.mp4track.width=n.width,this.mp4track.height=n.height,this.mp4track.sps=[new Uint8Array(t)],this.mp4track.codec="avc1.";for(var a=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var o=a.getUint8(i).toString(16);o.length<2&&(o="0"+o),this.mp4track.codec+=o}}},{key:"parsePPS",value:function(t){this.mp4track.pps=[new Uint8Array(t)]}},{key:"parseNAL",value:function(t){if(!t)return!1;if(t.isVCL)return!0;var n=!1;switch(t.type()){case O.PPS:this.mp4track.pps||this.parsePPS(t.getPayload()),n=!0;break;case O.SPS:this.mp4track.sps||this.parseSPS(t.getPayload()),n=!0;break;case O.AUD:v("AUD - ignoing");break;case O.SEI:v("SEI - ignoing")}return!this.readyToDecode&&this.mp4track.pps&&this.mp4track.sps&&(this.readyToDecode=!0),n}}])})(G),X=(function(){return b(function r(){g(this,r)},null,[{key:"extractNALu",value:function(r){for(var e=0,t=r.byteLength,n=[],a=0,i=0;e<t;){var o=r[e++];if(o===0)i++;else if(o===1&&i>=2){var u=i+1;a!==e-u&&n.push(r.subarray(a,e-u)),a=e,i=0}else i=0}var s=null;return a<t&&(s=r.subarray(a,t)),[n,s]}},{key:"removeEmulationPreventionBytes",value:function(r){for(var e=[],t=0,n=0;n<r.length;n++){var a=r[n];t!==2||a!==3?(e.push(a),a===0?t++:t=0):t=0}return new Uint8Array(e)}},{key:"readSPS",value:function(r){var e=new z(r);e.readUByte(),e.readUByte(),e.readBits(4);var t=e.readBits(3);e.readBits(1);for(var n=e.readBits(2),a=e.readBits(1),i=e.readBits(5),o=e.readUInt(),u=new Uint8Array(6),s=0;s<6;s++)u[s]=e.readUByte();var f=e.readUByte();e.readUEG();var l=e.readUEG();l===3&&e.readBits(1);var c=e.readUEG(),p=e.readUEG(),y=0,B=0,m=0,U=0;e.readBoolean()&&(y=e.readUEG(),B=e.readUEG(),m=e.readUEG(),U=e.readUEG()),e.readUEG(),e.readUEG(),e.readUEG();for(var h=e.readBits(1)?0:t;h<=t;h++)e.readUEG(),e.readUEG(),e.readUEG();if(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readBits(1)&&e.readBits(1))for(var E=0;E<4;E++)for(var x=0;x<(E===3?2:6);x++)if(e.readBits(1)){var I=Math.min(64,1<<4+(E<<1));E>1&&e.readEG();for(var _=0;_<I;_++)e.readEG()}else e.readUEG();e.readBits(1),e.readBits(1),e.readBits(1)&&(e.readBits(4),e.readBits(4),e.readUEG(),e.readUEG(),e.readBits(1));for(var d=e.readUEG(),D=0;D<d;D++){var H=!1;if(D!==0&&(H=e.readBoolean()),H)e.readUEG(),e.readBits(1),e.readUEG();else{for(var De=e.readUEG(),Ce=e.readUEG(),ue=0;ue<De;ue++)e.readUEG(),e.readBits(1);for(var le=0;le<Ce;le++)e.readUEG(),e.readBits(1)}}if(e.readBits(1))for(var Pe=e.readUEG(),fe=0;fe<Pe;fe++)e.readUEG(),e.readBits(1);e.readBits(1),e.readBits(1);var ce=null;if(e.readBoolean()){if(e.readBoolean()&&e.readUByte()===255&&(e.readUShort(),e.readUShort()),e.readBoolean()&&e.readBoolean(),e.readBoolean()&&(e.readBits(3),e.readBoolean(),e.readBoolean()&&(e.readUByte(),e.readUByte(),e.readUByte())),e.readBoolean()&&(e.readUEG(),e.readUEG()),e.readBoolean(),e.readBoolean(),e.readBoolean(),e.readBoolean()&&(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG()),e.readBoolean()){var de=e.readUInt(),he=e.readUInt();if(e.readBoolean()&&e.readUEG(),e.readBoolean()){var ee=!1,te=!1,q=!1;ee=e.readBoolean(),te=e.readBoolean(),(ee||te)&&((q=e.readBoolean())&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),q&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5));for(var pe=0;pe<=t;pe++){var ye=!1,re=0;if(e.readBoolean()||e.readBoolean()?e.readUEG():ye=e.readBoolean(),ye||(re=e.readUEG()),ee)for(var me=0;me<=re;me++)e.readUEG(),e.readUEG(),q&&(e.readUEG(),e.readUEG()),e.readBits(1);if(te)for(var ve=0;ve<=re;ve++)e.readUEG(),e.readUEG(),q&&(e.readUEG(),e.readUEG()),e.readBits(1)}}de>0&&he>0&&(ce=he/de)}e.readBoolean()&&(e.readBoolean(),e.readBoolean(),e.readBoolean(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG())}return{width:c-(l===1||l===2?2:1)*(B+y),height:p-(l===1?2:1)*(m+U),profile_space:n,tier_flag:a,profile_idc:i,profile_compatibility_flags:o,constraint_indicator_flags:u,level_idc:f,chroma_format_idc:l,fps:ce}}}])})(),T=(function(){function r(e){g(this,r),this.payload=e,this.nalUnitType=(126&e[0])>>1,this.nuhLayerId=(1&e[0])<<5|(248&e[1])>>3,this.nuhTemporalIdPlus1=7&e[1],this._isFirstSlice=null,this._sliceType=null}return b(r,[{key:"toString",value:function(){return"".concat(r.TYPES[this.type()]||"UNKNOWN ("+this.type()+")",": Layer: ").concat(this.nuhLayerId,", Temporal Id: ").concat(this.nuhTemporalIdPlus1)}},{key:"type",value:function(){return this.nalUnitType}},{key:"isKeyframe",get:function(){return[r.IDR_W_RADL,r.IDR_N_LP,r.CRA].includes(this.nalUnitType)}},{key:"isVCL",get:function(){return this.nalUnitType<=31}},{key:"parseHeader",value:function(){var e=new z(this.getPayload());e.readUByte(),e.readUByte(),this._isFirstSlice=e.readBoolean(),this.isKeyframe&&e.readBits(1),e.readUEG(),this._sliceType=e.readUEG()}},{key:"isFirstSlice",get:function(){return this._isFirstSlice||this.parseHeader(),this._isFirstSlice}},{key:"sliceType",get:function(){return this._sliceType||this.parseHeader(),this._sliceType}},{key:"getPayload",value:function(){return this.payload}},{key:"getPayloadSize",value:function(){return this.payload.byteLength}},{key:"getSize",value:function(){return 4+this.getPayloadSize()}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.getPayload(),4),e}}],[{key:"TRAIL_N",get:function(){return 0}},{key:"TRAIL_R",get:function(){return 1}},{key:"IDR_W_RADL",get:function(){return 19}},{key:"IDR_N_LP",get:function(){return 20}},{key:"CRA",get:function(){return 21}},{key:"VPS",get:function(){return 32}},{key:"SPS",get:function(){return 33}},{key:"PPS",get:function(){return 34}},{key:"AUD",get:function(){return 35}},{key:"SEI",get:function(){return 39}},{key:"SEI2",get:function(){return 40}},{key:"TYPES",get:function(){var e;return k(k(k(k(k(k(k(k(k(k(e={},r.TRAIL_N,"TRAIL_N"),r.TRAIL_R,"TRAIL_R"),r.IDR_W_RADL,"IDR"),r.IDR_N_LP,"IDR2"),r.CRA,"CRA"),r.VPS,"VPS"),r.SPS,"SPS"),r.PPS,"PPS"),r.AUD,"AUD"),r.SEI,"SEI"),k(e,r.SEI2,"SEI2")}}])})(),Ee=(function(r){function e(t,n,a){var i;return g(this,e),(i=S(this,e,["H264Remuxer"])).frameDuration=a,i.readyToDecode=!1,i.nextDts=0,i.dts=0,i.mp4track={id:G.getTrackID(),type:"video",len:0,fragmented:!0,vps:"",sps:"",pps:"",hvcC:{},fps:30,width:0,height:0,timescale:t,duration:n,samples:[]},i.samples=[],i.remainingData=new Uint8Array,i.kfCounter=0,i.pendingUnits={},i}return P(e,r),b(e,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.vps="",this.mp4track.sps="",this.mp4track.pps="",this.mp4track.hvcC={},this.nextDts=0,this.dts=0,this.remainingData=new Uint8Array,this.kfCounter=0,this.pendingUnits={}}},{key:"feed",value:function(t,n,a){var i,o=arguments.length>3&&arguments[3]!==void 0&&arguments[3],u=[];t=V(this.remainingData,t);var s=ae(X.extractNALu(t),2);return u=s[0],(i=s[1])?o?(u.push(i),this.remainingData=new Uint8Array):this.remainingData=i:this.remainingData=new Uint8Array,u.length>0?(this.remux(this.getVideoFrames(u,n,a)),!0):(v("Failed to extract any NAL units from video data:",i),this.dispatch("outOfData"),!1)}},{key:"getVideoFrames",value:function(t,n,a){var i,o=this,u=[],s=[],f=0,l=!1,c=!1;this.pendingUnits.units&&(u=this.pendingUnits.units,c=this.pendingUnits.vcl,l=this.pendingUnits.keyFrame,this.pendingUnits={});var p,y=C(t);try{for(y.s();!(p=y.n()).done;){var B=p.value,m=new T(B);this.parseNAL(m)&&(u.length&&c&&(m.isFirstSlice||!m.isVCL)&&(s.push({units:u,keyFrame:l}),u=[],l=!1,c=!1),u.push(m),l=l||m.isKeyframe,c=c||m.isVCL)}}catch(h){y.e(h)}finally{y.f()}if(u.length)if(n)if(c)s.push({units:u,keyFrame:l});else{var U=s.length-1;U>=0&&(s[U].units=s[U].units.concat(u))}else this.pendingUnits={units:u,keyFrame:l,vcl:c};return i=n?n/s.length|0:this.frameDuration,f=n?n-i*s.length:0,s.map(function(h){h.duration=i,h.compositionTimeOffset=a,f>0&&(h.duration++,f--),o.kfCounter++,h.keyFrame&&o.dispatch("keyframePosition",o.kfCounter*i/1e3)}),v("jmuxer: No. of H265 frames of the last chunk: ".concat(s.length)),s}},{key:"remux",value:function(t){var n,a=C(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.units.reduce(function(u,s){return u+s.getSize()},0);i.units.length>0&&this.readyToDecode&&(this.mp4track.len+=o,this.samples.push({units:i.units,size:o,keyFrame:i.keyFrame,duration:i.duration,compositionTimeOffset:i.compositionTimeOffset}))}}catch(u){a.e(u)}finally{a.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var t,n,a=new Uint8Array(this.mp4track.len),i=0,o=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var u=this.samples.shift(),s=u.units;if((n=u.duration)<=0)v("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(n)),this.mp4track.len-=u.size;else{this.nextDts+=n,t={size:u.size,duration:n,cts:u.compositionTimeOffset||0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:u.keyFrame?0:1,dependsOn:u.keyFrame?2:1}};var f,l=C(s);try{for(l.s();!(f=l.n()).done;){var c=f.value;a.set(c.getData(),i),i+=c.getSize()}}catch(p){l.e(p)}finally{l.f()}o.push(t)}}return o.length?new Uint8Array(a.buffer,0,this.mp4track.len):null}},{key:"parseSPS",value:function(t){this.mp4track.sps=[new Uint8Array(t)],t=X.removeEmulationPreventionBytes(t);var n=X.readSPS(new Uint8Array(t));this.mp4track.fps=n.fps||this.mp4track.fps,this.mp4track.width=n.width,this.mp4track.height=n.height,this.mp4track.codec="hvc1."+(n.profile_space?String.fromCharCode(64+n.profile_space):"")+n.profile_idc+"."+(function(a){for(var i=0,o=0;o<32;o++)i<<=1,i|=1&a,a>>>=1;return i>>>0})(n.profile_compatibility_flags).toString(16)+"."+(n.tier_flag?"H":"L")+n.level_idc+"."+n.constraint_indicator_flags.map(function(a){return a.toString(16)}).join(".").toUpperCase().replace(/(?:\.0)+$/,""),this.mp4track.hvcC={profile_space:n.profile_space,tier_flag:n.tier_flag,profile_idc:n.profile_idc,profile_compatibility_flags:n.profile_compatibility_flags,constraint_indicator_flags:n.constraint_indicator_flags,level_idc:n.level_idc,chroma_format_idc:n.chroma_format_idc}}},{key:"parsePPS",value:function(t){this.mp4track.pps=[t]}},{key:"parseVPS",value:function(t){this.mp4track.vps=[t]}},{key:"parseNAL",value:function(t){if(!t)return!1;if(t.isVCL)return!0;var n=!1;switch(t.type()){case T.VPS:this.mp4track.vps||this.parseVPS(t.getPayload()),n=!0;break;case T.SPS:this.mp4track.sps||this.parseSPS(t.getPayload()),n=!0;break;case T.PPS:this.mp4track.pps||this.parsePPS(t.getPayload()),n=!0;break;case T.AUD:v("AUD - ignoing");break;case T.SEI:case T.SEI2:v("SEI - ignoing")}return!this.readyToDecode&&this.mp4track.vps&&this.mp4track.sps&&this.mp4track.pps&&(this.readyToDecode=!0),n}}])})(G),Ae=(function(r){function e(t,n,a,i){var o;return g(this,e),(o=S(this,e,["remuxer"])).videoCodec=a,o.frameDuration=i,o.initialized=!1,o.tracks={},o.seq=1,o.env=t,o.timescale=1e3,o.mediaDuration=n?4294967295:0,o}return P(e,r),b(e,[{key:"addTrack",value:function(t){var n=this;if(t!=="video"&&t!=="both"||(this.videoCodec=="H265"?this.tracks.video=new Ee(this.timescale,this.mediaDuration,this.frameDuration):this.tracks.video=new we(this.timescale,this.mediaDuration,this.frameDuration),this.tracks.video.on("outOfData",function(){n.dispatch("missingVideoFrames")}),this.tracks.video.on("keyframePosition",function(i){n.dispatch("keyframePosition",i)})),t==="audio"||t==="both"){var a=new Se(this.timescale,this.mediaDuration,this.frameDuration);this.tracks.audio=a,this.tracks.audio.on("outOfData",function(){n.dispatch("missingAudioFrames")})}}},{key:"reset",value:function(){for(var t in this.tracks)this.tracks[t].resetTrack();this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(!this.initialized){if(!this.isReady())return;this.dispatch("ready"),this.initSegment(),this.initialized=!0}for(var t in this.tracks){var n=this.tracks[t],a=n.getPayload();if(a&&a.byteLength){var i={type:t,payload:V(N.moof(this.seq,n.dts,n.mp4track),N.mdat(a)),dts:n.dts};t==="video"&&(i.fps=n.mp4track.fps),this.dispatch("buffer",i);var o=Be(n.dts/this.timescale);v("put segment (".concat(t,"): dts: ").concat(n.dts," frames: ").concat(n.mp4track.samples.length," second: ").concat(o)),n.flush(),this.seq++}}}},{key:"initSegment",value:function(){var t=[];for(var n in this.tracks){var a=this.tracks[n];if(this.env=="browser"){var i={type:n,payload:N.initSegment([a.mp4track],this.mediaDuration,this.timescale)};this.dispatch("buffer",i)}else t.push(a.mp4track)}if(this.env=="node"){var o={type:"all",payload:N.initSegment(t,this.mediaDuration,this.timescale)};this.dispatch("buffer",o)}v("Initial segment generated.")}},{key:"isReady",value:function(){for(var t in this.tracks)if(!this.tracks[t].readyToDecode||!this.tracks[t].samples.length)return!1;return!0}},{key:"feed",value:function(t){var n=!1;t.video&&this.tracks.video&&(n|=this.tracks.video.feed(t.video,t.duration,t.compositionTimeOffset,t.isLastVideoFrameComplete)),t.audio&&this.tracks.audio&&(n|=this.tracks.audio.feed(t.audio,t.duration)),n?this.flush():A("Input object must have video and/or audio property. Make sure it is a valid typed array")}}])})(j),xe=(function(r){function e(t,n){var a;return g(this,e),(a=S(this,e,["buffer"])).type=n,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=t,a.sourceBuffer.addEventListener("updateend",function(){a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()}),a.sourceBuffer.addEventListener("error",function(){a.dispatch("error",{type:a.type,name:"buffer",error:"buffer error"})}),a}return P(e,r),b(e,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var t=this.cleanRanges.shift();v("".concat(this.type," remove range [").concat(t[0]," - ").concat(t[1],")")),this.cleaning=!0,this.sourceBuffer.remove(t[0],t[1])}else this.cleaning=!1}},{key:"initCleanup",value:function(t){try{if(this.sourceBuffer.updating)return void(this.pendingCleaning=t);if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var n=0;n<this.sourceBuffer.buffered.length;++n){var a=this.sourceBuffer.buffered.start(n),i=this.sourceBuffer.buffered.end(n);t-a>this.cleanOffset&&a<(i=t-this.cleanOffset)&&this.cleanRanges.push([a,i])}this.doCleanup()}}catch(o){A("Error occured while cleaning ".concat(this.type," buffer - ").concat(o.name,": ").concat(o.message))}}},{key:"doAppend",value:function(){if(this.queue.length&&this.sourceBuffer&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(n){var t="unexpectedError";n.name==="QuotaExceededError"?(v("".concat(this.type," buffer quota full")),t="QuotaExceeded"):(A("Error occured while appending ".concat(this.type," buffer - ").concat(n.name,": ").concat(n.message)),t="InvalidStateError"),this.dispatch("error",{type:this.type,name:t,error:"buffer error"})}}},{key:"feed",value:function(t){this.queue=V(this.queue,t)}}])})(j);return(function(r){function e(t){var n;g(this,e),(n=S(this,e,["jmuxer"])).isReset=!1;var a={node:"",mode:"both",videoCodec:"H264",flushingTime:500,maxDelay:500,clearBuffer:!0,fps:30,readFpsFromTrack:!1,debug:!1,onReady:function(){},onData:function(){},onError:function(){},onUnsupportedCodec:function(){},onMissingVideoFrames:function(){},onMissingAudioFrames:function(){},onKeyframePosition:function(){},onLoggerLog:console.log,onLoggerErr:console.error};return n.options=Object.assign({},a,t),n.env=(typeof process>"u"?"undefined":W(process))==="object"&&typeof window>"u"?"node":"browser",n.options.debug&&(function(i,o){Z=i,Q=o})(n.options.onLoggerLog,n.options.onLoggerErr),n.options.fps||(n.options.fps=30),n.frameDuration=1e3/n.options.fps|0,n.remuxController=new Ae(n.env,t.live,n.options.videoCodec,n.frameDuration),n.remuxController.addTrack(n.options.mode),n.initData(),n.remuxController.on("buffer",n.onBuffer.bind(n)),n.env=="browser"&&(n.remuxController.on("ready",n.createBuffer.bind(n)),n.initBrowser()),n.remuxController.on("missingVideoFrames",function(){typeof n.options.onMissingVideoFrames=="function"&&n.options.onMissingVideoFrames.call(null)}),n.remuxController.on("missingAudioFrames",function(){typeof n.options.onMissingAudioFrames=="function"&&n.options.onMissingAudioFrames.call(null)}),n.clearBuffer&&n.remuxController.on("keyframePosition",function(i){n.kfPosition.push(i)}),typeof n.options.onKeyframePosition=="function"&&n.remuxController.on("keyframePosition",function(i){n.options.onKeyframePosition.call(null,i)}),n}return P(e,r),b(e,[{key:"initData",value:function(){this.lastCleaningTime=Date.now(),this.kfPosition=[],this.pendingUnits={},this.remainingData=new Uint8Array,this.startInterval()}},{key:"initBrowser",value:function(){typeof this.options.node=="string"&&this.options.node==""&&A("no video element were found to render, provide a valid video element"),this.node=typeof this.options.node=="string"?document.getElementById(this.options.node):this.options.node,this.mseReady=!1,this.setupMSE()}},{key:"createStream",value:function(){var t=this.feed.bind(this),n=this.destroy.bind(this);return this.stream=new L.Duplex({writableObjectMode:!0,read:function(a){},write:function(a,i,o){t(a),o()},final:function(a){n(),a()}}),this.stream}},{key:"setupMSE",value:function(){if(window.MediaSource=window.MediaSource||window.WebKitMediaSource||window.ManagedMediaSource,!window.MediaSource)throw"Oops! Browser does not support Media Source Extension or Managed Media Source (IOS 17+).";if(this.isMSESupported=!!window.MediaSource,this.mediaSource=new window.MediaSource,this.url=URL.createObjectURL(this.mediaSource),window.MediaSource===window.ManagedMediaSource)try{this.node.removeAttribute("src"),this.node.disableRemotePlayback=!0;var t=document.createElement("source");t.type="video/mp4",t.src=this.url,this.node.appendChild(t),this.node.load()}catch{this.node.src=this.url}else this.node.src=this.url;this.mseEnded=!1,this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"endMSE",value:function(){if(!this.mseEnded)try{this.mseEnded=!0,this.mediaSource.endOfStream()}catch{A("mediasource is not available to end")}}},{key:"feed",value:function(t){t&&this.remuxController&&(t.duration=t.duration?parseInt(t.duration):0,this.remuxController.feed(t))}},{key:"destroy",value:function(){if(this.stopInterval(),this.stream&&(this.remuxController.flush(),this.stream.push(null),this.stream=null),this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var t in this.bufferControllers)this.bufferControllers[t].destroy();this.bufferControllers=null,this.endMSE()}this.node=!1,this.mseReady=!1,this.videoStarted=!1,this.mediaSource=null}},{key:"reset",value:function(){if(this.stopInterval(),this.isReset=!0,this.node.pause(),this.remuxController&&this.remuxController.reset(),this.bufferControllers){for(var t in this.bufferControllers)this.bufferControllers[t].destroy();this.bufferControllers=null,this.endMSE()}this.initData(),this.env=="browser"&&this.initBrowser(),v("JMuxer was reset")}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var t in this.bufferControllers={},this.remuxController.tracks){var n=this.remuxController.tracks[t];if(!e.isSupported("".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"')))return A("Browser does not support codec: ".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"')),typeof this.options.onUnsupportedCodec=="function"&&this.options.onUnsupportedCodec.call(null,n.mp4track.codec),!1;var a=this.mediaSource.addSourceBuffer("".concat(t,'/mp4; codecs="').concat(n.mp4track.codec,'"'));this.bufferControllers[t]=new xe(a,t),this.bufferControllers[t].on("error",this.onBufferError.bind(this))}}},{key:"startInterval",value:function(){var t=this;this.interval=setInterval(function(){t.options.flushingTime?t.applyAndClearBuffer():t.bufferControllers&&t.cancelDelay()},this.options.flushingTime||1e3)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"cancelDelay",value:function(){if(this.node.buffered&&this.node.buffered.length>0&&!this.node.seeking){var t=this.node.buffered.end(0);t-this.node.currentTime>this.options.maxDelay/1e3&&(v("delay"),this.node.paused&&this.node.play().catch(A),this.node.currentTime=t-.001)}}},{key:"releaseBuffer",value:function(){for(var t in this.bufferControllers)this.bufferControllers[t].doAppend()}},{key:"applyAndClearBuffer",value:function(){this.bufferControllers&&(this.releaseBuffer(),this.clearBuffer())}},{key:"getSafeClearOffsetOfBuffer",value:function(t){for(var n,a=this.options.mode==="audio"&&t||0,i=0;i<this.kfPosition.length&&!(this.kfPosition[i]>=t);i++)n=this.kfPosition[i];return n&&(this.kfPosition=this.kfPosition.filter(function(o){return o<n&&(a=o),o>=n})),a}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var t in this.bufferControllers){var n=this.getSafeClearOffsetOfBuffer(this.node.currentTime);this.bufferControllers[t].initCleanup(n)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(t){this.options.readFpsFromTrack&&t.fps!==void 0&&this.options.fps!=t.fps&&(this.options.fps=t.fps,this.frameDuration=Math.ceil(1e3/t.fps),v("JMuxer changed FPS to ".concat(t.fps," from track data"))),this.env=="browser"?this.bufferControllers&&this.bufferControllers[t.type]&&this.bufferControllers[t.type].feed(t.payload):this.stream&&this.stream.push(t.payload),this.options.onData&&this.options.onData(t.payload),this.options.flushingTime===0&&this.applyAndClearBuffer()}},{key:"onMSEOpen",value:function(){this.mseReady=!0,URL.revokeObjectURL(this.url),typeof this.options.onReady=="function"&&this.options.onReady.call(null,this.isReset,this.mediaSource)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(t){if(t.name=="QuotaExceeded")return v("JMuxer cleaning ".concat(t.type," buffer due to QuotaExceeded error")),void this.bufferControllers[t.type].initCleanup(this.node.currentTime);t.name=="InvalidStateError"?(v("JMuxer is reseting due to InvalidStateError"),this.reset()):this.endMSE(),typeof this.options.onError=="function"&&this.options.onError.call(null,t)}}],[{key:"isSupported",value:function(t){return window.MediaSource&&window.MediaSource.isTypeSupported(t)}}])})(j)})})(K)),K.exports}var ke=Oe();const Fe=_e(ke),Ne=Ge({__proto__:null,default:Fe},[ke]);export{Ne as j};
@@ -44,8 +44,8 @@
44
44
  <link rel="icon" type="image/svg+xml" href="/brand-icon.svg" />
45
45
  <link rel="icon" type="image/png" sizes="64x64" href="/pwa-64x64.png" />
46
46
  <link rel="apple-touch-icon" href="/apple-touch-icon-180x180.png" />
47
- <script type="module" crossorigin src="/assets/index-CTVBM14S.js"></script>
48
- <link rel="stylesheet" crossorigin href="/assets/index-CKcK9Gip.css">
47
+ <script type="module" crossorigin src="/assets/index-T5NTU40d.js"></script>
48
+ <link rel="stylesheet" crossorigin href="/assets/index-DU6oplEW.css">
49
49
  <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
50
50
  <body class="bg-background text-foreground">
51
51
  <div id="root"></div>
@@ -0,0 +1,21 @@
1
+ Copyright (c) Microsoft Corporation. All rights reserved.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/assets/web/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const f=e=>i(e,t),c={module:{uri:t},exports:o,require:f};s[t]=Promise.all(n.map(e=>c[e]||f(e))).then(e=>(r(...e),o))}}define(["./workbox-10a3128e"],function(e){"use strict";importScripts("notification-sw.js"),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"notification-sw.js",revision:"ee0be62f4c1f36625b92680b3060becb"},{url:"index.html",revision:"923af142ef510e2bdb1f8a1ff8272185"},{url:"assets/jmuxer.min-DNcvBLce.js",revision:null},{url:"assets/index-CTVBM14S.js",revision:null},{url:"assets/index-CKcK9Gip.css",revision:null},{url:"assets/fvad-DYxbW2my.wasm",revision:null},{url:"assets/fvad-CLXTqQ8w.js",revision:null},{url:"assets/__vite-browser-external-D7Ct-6yo.js",revision:null},{url:"brand-icon.svg",revision:"efe8505a7b7ef12cbb3a4bcd286254bd"},{url:"maskable-icon-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-192x192.png",revision:"4e4603ce0f22528eded553ba7f2ffbc5"},{url:"pwa-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-64x64.png",revision:"d322160ad1dc08ba9e133cb3d296ae63"},{url:"manifest.webmanifest",revision:"4daa295c44052f4ce59a1fcfd6f06ab8"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/proxy(\/|$|\?)/,/^\/client(\/|$|\?)/,/^\/voice(\/|$|\?)/,/^\/fonts\//,/^\/health/,/^\/status/,/^\/api\//]})),e.registerRoute(/^\/fonts\/.*\.(woff2|woff|ttf|otf|css)$/,new e.CacheFirst({cacheName:"dev-anywhere-fonts",plugins:[new e.ExpirationPlugin({maxEntries:40,maxAgeSeconds:15552e3})]}),"GET")});
1
+ if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-10a3128e"],function(e){"use strict";importScripts("notification-sw.js"),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"notification-sw.js",revision:"ee0be62f4c1f36625b92680b3060becb"},{url:"index.html",revision:"05dac686c4be3842a923834156ba4463"},{url:"assets/jmuxer.min-MLQiheJs.js",revision:null},{url:"assets/index-T5NTU40d.js",revision:null},{url:"assets/index-DU6oplEW.css",revision:null},{url:"assets/fvad-DujGeLmz.js",revision:null},{url:"assets/fvad-DYxbW2my.wasm",revision:null},{url:"assets/__vite-browser-external-D7Ct-6yo.js",revision:null},{url:"brand-icon.svg",revision:"efe8505a7b7ef12cbb3a4bcd286254bd"},{url:"maskable-icon-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-192x192.png",revision:"4e4603ce0f22528eded553ba7f2ffbc5"},{url:"pwa-512x512.png",revision:"e762ff07cdedcd78f8650f59c6881727"},{url:"pwa-64x64.png",revision:"d322160ad1dc08ba9e133cb3d296ae63"},{url:"manifest.webmanifest",revision:"4daa295c44052f4ce59a1fcfd6f06ab8"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"),{denylist:[/^\/proxy(\/|$|\?)/,/^\/client(\/|$|\?)/,/^\/voice(\/|$|\?)/,/^\/fonts\//,/^\/health/,/^\/status/,/^\/api\//]})),e.registerRoute(/^\/fonts\/.*\.(woff2|woff|ttf|otf|css)$/,new e.CacheFirst({cacheName:"dev-anywhere-fonts",plugins:[new e.ExpirationPlugin({maxEntries:40,maxAgeSeconds:15552e3})]}),"GET")});
@@ -49,21 +49,101 @@ var ApprovalOptionSchema = z3.object({
49
49
  name: z3.string().min(1),
50
50
  kind: ApprovalOptionKindSchema
51
51
  });
52
+ var CursorTodoStatusSchema = z3.enum(["pending", "in_progress", "completed", "cancelled"]);
53
+ var CursorTodoSchema = z3.object({
54
+ id: IdSchema,
55
+ content: z3.string(),
56
+ status: CursorTodoStatusSchema
57
+ });
58
+ var CursorAskQuestionPromptSchema = z3.object({
59
+ type: z3.literal("ask_question"),
60
+ toolCallId: IdSchema.optional(),
61
+ title: z3.string().optional(),
62
+ questions: z3.array(z3.object({
63
+ id: IdSchema,
64
+ prompt: z3.string(),
65
+ options: z3.array(z3.object({ id: IdSchema, label: z3.string() })),
66
+ allowMultiple: z3.boolean().optional()
67
+ }))
68
+ });
69
+ var CursorCreatePlanPromptSchema = z3.object({
70
+ type: z3.literal("create_plan"),
71
+ toolCallId: IdSchema.optional(),
72
+ name: z3.string().optional(),
73
+ overview: z3.string().optional(),
74
+ plan: z3.string(),
75
+ todos: z3.array(CursorTodoSchema).optional(),
76
+ isProject: z3.boolean().optional(),
77
+ phases: z3.array(z3.object({
78
+ name: z3.string(),
79
+ todos: z3.array(CursorTodoSchema)
80
+ })).optional()
81
+ });
82
+ var CursorPromptSchema = z3.discriminatedUnion("type", [
83
+ CursorAskQuestionPromptSchema,
84
+ CursorCreatePlanPromptSchema
85
+ ]);
86
+ var CursorAskQuestionAnswerSchema = z3.object({
87
+ type: z3.literal("ask_question"),
88
+ outcome: z3.enum(["answered", "skipped", "cancelled"]),
89
+ answers: z3.array(z3.object({
90
+ questionId: IdSchema,
91
+ selectedOptionIds: z3.array(IdSchema)
92
+ })).optional(),
93
+ reason: z3.string().optional()
94
+ });
95
+ var CursorCreatePlanAnswerSchema = z3.object({
96
+ type: z3.literal("create_plan"),
97
+ outcome: z3.enum(["accepted", "rejected", "cancelled"]),
98
+ reason: z3.string().optional()
99
+ });
100
+ var CursorAnswerSchema = z3.discriminatedUnion("type", [
101
+ CursorAskQuestionAnswerSchema,
102
+ CursorCreatePlanAnswerSchema
103
+ ]);
104
+ var CursorSessionUiSchema = z3.discriminatedUnion("kind", [
105
+ z3.object({
106
+ kind: z3.literal("todos"),
107
+ toolCallId: IdSchema.optional(),
108
+ todos: z3.array(CursorTodoSchema),
109
+ merge: z3.boolean()
110
+ }),
111
+ z3.object({
112
+ kind: z3.literal("task"),
113
+ toolCallId: IdSchema.optional(),
114
+ description: z3.string(),
115
+ prompt: z3.string().optional(),
116
+ subagentType: z3.unknown().optional(),
117
+ model: z3.string().optional(),
118
+ agentId: z3.string().optional(),
119
+ durationMs: z3.number().optional()
120
+ }),
121
+ z3.object({
122
+ kind: z3.literal("image"),
123
+ toolCallId: IdSchema.optional(),
124
+ description: z3.string(),
125
+ filePath: z3.string().optional(),
126
+ referenceImagePaths: z3.array(z3.string()).optional()
127
+ })
128
+ ]);
52
129
  var ToolUseRequestPayloadSchema = z3.object({
53
130
  toolName: z3.string(),
54
131
  toolId: IdSchema,
55
132
  parameters: z3.record(z3.string(), z3.unknown()),
56
- options: z3.array(ApprovalOptionSchema).optional()
133
+ options: z3.array(ApprovalOptionSchema).optional(),
134
+ cursorPrompt: CursorPromptSchema.optional()
57
135
  });
58
136
  var ToolApprovePayloadSchema = z3.object({
59
137
  toolId: IdSchema,
60
138
  whitelistTool: z3.boolean().optional(),
61
- optionId: IdSchema.optional()
139
+ optionId: IdSchema.optional(),
140
+ cursorAnswer: CursorAnswerSchema.optional()
62
141
  });
63
142
  var ToolDenyPayloadSchema = z3.object({
64
143
  toolId: IdSchema,
65
144
  reason: z3.string().optional(),
66
- optionId: IdSchema.optional()
145
+ optionId: IdSchema.optional(),
146
+ cursorAnswer: CursorAnswerSchema.optional()
67
147
  });
68
148
  var ToolResultPayloadSchema = z3.object({
69
149
  toolId: IdSchema,
@@ -75,7 +155,7 @@ var ToolResultPayloadSchema = z3.object({
75
155
  import { z as z4 } from "zod";
76
156
 
77
157
  // ../../packages/shared/dist/constants/enums.js
78
- var providerValues = ["claude", "codex", "kimi"];
158
+ var providerValues = ["claude", "codex", "kimi", "cursor"];
79
159
  var ptyOwnerValues = ["local-terminal", "proxy-hosted"];
80
160
  var sessionModeValues = ["pty", "json"];
81
161
 
@@ -930,13 +1010,25 @@ var AgentCliAvailabilitySchema = z13.object({
930
1010
  available: z13.boolean(),
931
1011
  command: z13.string().optional(),
932
1012
  error: z13.string().optional(),
933
- suggestions: z13.array(z13.string()).optional()
1013
+ suggestions: z13.array(z13.string()).optional(),
1014
+ /** 开发机没有上报该 Agent 的状态(例如旧版 Proxy 不认识新增的 Agent)。 */
1015
+ notReported: z13.boolean().optional()
934
1016
  });
1017
+ var AGENT_CLI_NOT_REPORTED_MESSAGE = "\u5F00\u53D1\u673A\u672A\u4E0A\u62A5\u8BE5 Agent \u7684\u72B6\u6001\uFF0C\u6682\u4E0D\u53EF\u7528";
1018
+ function notReportedAgentCli() {
1019
+ return { available: false, error: AGENT_CLI_NOT_REPORTED_MESSAGE, notReported: true };
1020
+ }
935
1021
  var AgentCliStatusSchema = z13.object({
936
- claude: AgentCliAvailabilitySchema,
937
- codex: AgentCliAvailabilitySchema,
938
- kimi: AgentCliAvailabilitySchema
939
- });
1022
+ claude: AgentCliAvailabilitySchema.optional(),
1023
+ codex: AgentCliAvailabilitySchema.optional(),
1024
+ kimi: AgentCliAvailabilitySchema.optional(),
1025
+ cursor: AgentCliAvailabilitySchema.optional()
1026
+ }).transform((status) => ({
1027
+ claude: status.claude ?? notReportedAgentCli(),
1028
+ codex: status.codex ?? notReportedAgentCli(),
1029
+ kimi: status.kimi ?? notReportedAgentCli(),
1030
+ cursor: status.cursor ?? notReportedAgentCli()
1031
+ }));
940
1032
  var TerminalShellSchema = z13.enum(["powershell", "cmd"]);
941
1033
  var TerminalShellOptionSchema = z13.object({
942
1034
  id: TerminalShellSchema,
@@ -2129,9 +2221,14 @@ var relayControlDefinitions = [
2129
2221
  requestId: IdSchema,
2130
2222
  toolName: z13.string(),
2131
2223
  input: z13.record(z13.string(), z13.unknown()),
2132
- options: z13.array(ApprovalOptionSchema).optional()
2224
+ options: z13.array(ApprovalOptionSchema).optional(),
2225
+ cursorPrompt: CursorPromptSchema.optional()
2133
2226
  }))
2134
2227
  }, "proxy_to_client"),
2228
+ control("cursor_session_ui", {
2229
+ sessionId: IdSchema,
2230
+ payload: CursorSessionUiSchema
2231
+ }, "proxy_to_client"),
2135
2232
  // Voice Pilot speech summaries are produced by proxy-side Claude Code so it can read project context.
2136
2233
  control("voice_summary_request", {
2137
2234
  ...RequestIdShape,
@@ -9042,4 +9139,4 @@ export {
9042
9139
  parseRelayChaosFromEnv,
9043
9140
  createRelayServer
9044
9141
  };
9045
- //# sourceMappingURL=chunk-QQQVGCCU.js.map
9142
+ //# sourceMappingURL=chunk-DJC4P5O3.js.map