diff --git a/README.md b/README.md index dc9edde..bfcd5fe 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Add html code to your html component: | trackScroll | Whether this object should automatically respond to scroll | Boolean | true | | useWebCodecs | Whether the library should use the webcodecs method, see below | Boolean | true | | videoPercentage | Manually specify the position of the video between 0..1, only used for react, vue, and svelte components | Number | | +| onReady | The callback when it's ready to scroll | VoidFunction | | | debug | Whether to log debug information | Boolean | false | diff --git a/docs.js b/docs.js index 3604824..b3d4518 100644 --- a/docs.js +++ b/docs.js @@ -1 +1 @@ -var docs=function(){"use strict";function t(){}function e(t,e){for(const i in e)t[i]=e[i];return t}function i(t){return t()}function r(){return Object.create(null)}function n(t){t.forEach(i)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let o,l;function h(t,e){return o||(o=document.createElement("a")),o.href=e,t===o.href}function d(t,e,i,r){if(t){const n=c(t,e,i,r);return t[0](n)}}function c(t,i,r,n){return t[1]&&n?e(r.ctx.slice(),t[1](n(i))):r.ctx}function p(t,e,i,r){if(t[2]&&r){const n=t[2](r(i));if(void 0===e.dirty)return n;if("object"==typeof n){const t=[],i=Math.max(e.dirty.length,n.length);for(let r=0;r32){const e=[],i=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,i,r)}function $(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function E(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function T(t,e){t.value=null==e?"":e}class z{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,e,i=null){var r;this.e||(this.is_svg?this.e=(r=e.nodeName,document.createElementNS("http://www.w3.org/2000/svg",r)):this.e=w(e.nodeName),this.t=e,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e{const n=t.$$.callbacks[e];if(n){const s=function(t,e,{bubbles:i=!1,cancelable:r=!1}={}){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,i,r,e),n}(e,i,{cancelable:r});return n.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}function F(t,e){return I().$$.context.set(t,e),e}function L(t){return I().$$.context.get(t)}const R=[],D=[],N=[],O=[],M=Promise.resolve();let G=!1;function H(t){N.push(t)}const V=new Set;let Y=0;function j(){if(0!==Y)return;const t=l;do{try{for(;Y{Z.delete(t),r&&(i&&t.d(1),r())})),t.o(e)}else r&&r()}function tt(t,e){const i=e.token={};function r(t,r,n,s){if(e.token!==i)return;e.resolved=s;let a=e.ctx;void 0!==n&&(a=a.slice(),a[n]=s);const o=t&&(e.current=t)(a);let l=!1;e.block&&(e.blocks?e.blocks.forEach(((t,i)=>{i!==r&&t&&(K(),J(t,1,1,(()=>{e.blocks[i]===t&&(e.blocks[i]=null)})),X())})):e.block.d(1),o.c(),Q(o,1),o.m(e.mount(),e.anchor),l=!0),e.block=o,e.blocks&&(e.blocks[r]=o),l&&j()}if(!(n=t)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const i=I();if(t.then((t=>{B(i),r(e.then,1,e.value,t),B(null)}),(t=>{if(B(i),r(e.catch,2,e.error,t),B(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var n}function et(t,e,i){const r=e.slice(),{resolved:n}=t;t.current===t.then&&(r[t.value]=n),t.current===t.catch&&(r[t.error]=n),t.block.p(r,i)}function it(t,e){const i={},r={},n={$$scope:1};let s=t.length;for(;s--;){const a=t[s],o=e[s];if(o){for(const t in a)t in o||(r[t]=1);for(const t in o)n[t]||(i[t]=o[t],n[t]=1);t[s]=o}else for(const t in a)n[t]=1}for(const t in r)t in i||(i[t]=void 0);return i}function rt(t){return"object"==typeof t&&null!==t?t:{}}function nt(t){t&&t.c()}function st(t,e,r,a){const{fragment:o,after_update:l}=t.$$;o&&o.m(e,r),a||H((()=>{const e=t.$$.on_mount.map(i).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):n(e),t.$$.on_mount=[]})),l.forEach(H)}function at(t,e){const i=t.$$;null!==i.fragment&&(n(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function ot(t,e){-1===t.$$.dirty[0]&&(R.push(t),G||(G=!0,M.then(j)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const n=r.length?r[0]:i;return u.ctx&&o(u.ctx[t],u.ctx[t]=n)&&(!u.skip_bound&&u.bound[t]&&u.bound[t](n),f&&ot(e,t)),i})):[],u.update(),f=!0,n(u.before_update),u.fragment=!!a&&a(u.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);u.fragment&&u.fragment.l(t),t.forEach(b)}else u.fragment&&u.fragment.c();i.intro&&Q(e.$$.fragment),st(e,i.target,i.anchor,i.customElement),j()}B(p)}class ht{$destroy(){at(this,1),this.$destroy=t}$on(e,i){if(!s(i))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(i),()=>{const t=r.indexOf(i);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function dt(e){return{c:t,m:t,p:t,d:t}}function ct(e){let i,r,n,s=e[1]+"";return{c(){i=w("pre"),r=v("version "),n=v(s),$(i,"class","svelte-1anaj0w")},m(t,e){y(t,i,e),_(i,r),_(i,n)},p:t,d(t){t&&b(i)}}}function pt(e){return{c:t,m:t,p:t,d:t}}function ut(e){let i,r,n,s,a,o,l,h,d,c={ctx:e,current:null,token:null,hasCatch:!1,pending:pt,then:ct,catch:dt,value:1};return tt(e[0],c),{c(){i=w("div"),c.block.c(),r=S(),n=w("h1"),n.textContent="ScrollyVideo.js",s=S(),a=w("p"),a.textContent="Responsive scrollable videos without obscure video encoding requirements. Compatible with React, Svelte, Vue, and plain HTML.",o=S(),l=w("a"),l.textContent="npm",h=S(),d=w("a"),d.textContent="github",$(n,"class","svelte-1anaj0w"),$(a,"class","svelte-1anaj0w"),$(l,"class","npm svelte-1anaj0w"),$(l,"target","_blank"),$(l,"rel","noopener noreferrer"),$(l,"href","https://www.npmjs.com/package/scrolly-video"),$(d,"class","github svelte-1anaj0w"),$(d,"target","_blank"),$(d,"rel","noopener noreferrer"),$(d,"href","https://github.com/dkaoster/scrolly-video"),$(i,"class","intro svelte-1anaj0w")},m(t,e){y(t,i,e),c.block.m(i,c.anchor=null),c.mount=()=>i,c.anchor=r,_(i,r),_(i,n),_(i,s),_(i,a),_(i,o),_(i,l),_(i,h),_(i,d)},p(t,[i]){et(c,e=t,i)},i:t,o:t,d(t){t&&b(i),c.block.d(),c.token=null,c=null}}}function ft(t){return[L("npm").then((t=>t["dist-tags"].latest))]}class mt extends ht{constructor(t){super(),lt(this,t,ft,ut,a,{})}}var gt,_t,yt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},bt={exports:{}};gt=bt,_t=bt.exports,function(t,e){var i="function",r="undefined",n="object",s="string",a="model",o="name",l="type",h="vendor",d="version",c="architecture",p="console",u="mobile",f="tablet",m="smarttv",g="wearable",_="embedded",y="Amazon",b="Apple",x="ASUS",w="BlackBerry",v="Browser",S="Chrome",U="Firefox",k="Google",$="Huawei",E="LG",T="Microsoft",z="Motorola",A="Opera",B="Samsung",I="Sharp",C="Sony",P="Xiaomi",F="Zebra",L="Facebook",R=function(t){for(var e={},i=0;i0?2===l.length?typeof l[1]==i?this[l[0]]=l[1].call(this,d):this[l[0]]=l[1]:3===l.length?typeof l[1]!==i||l[1].exec&&l[1].test?this[l[0]]=d?d.replace(l[1],l[2]):e:this[l[0]]=d?l[1].call(this,d,l[2]):e:4===l.length&&(this[l[0]]=d?l[3].call(this,d.replace(l[1],l[2])):e):this[l]=d||e;c+=2}},G=function(t,i){for(var r in i)if(typeof i[r]===n&&i[r].length>0){for(var s=0;s350?O(t,350):t,this},this.setUA(u),this};Y.VERSION="1.0.33",Y.BROWSER=R([o,d,"major"]),Y.CPU=R([c]),Y.DEVICE=R([a,h,l,p,u,m,f,g,_]),Y.ENGINE=Y.OS=R([o,d]),gt.exports&&(_t=gt.exports=Y),_t.UAParser=Y;var j=typeof t!==r&&(t.jQuery||t.Zepto);if(j&&!j.ua){var q=new Y;j.ua=q.getResult(),j.ua.get=function(){return q.getUA()},j.ua.set=function(t){q.setUA(t);var e=q.getResult();for(var i in e)j.ua[i]=e[i]}}}("object"==typeof window?window:yt);var xt=bt.exports,wt={};!function(t){var e,i,r,n=(e=new Date,i=4,r={setLogLevel:function(t){i=t==this.debug?1:t==this.info?2:t==this.warn?3:(this.error,4)},debug:function(t,r){void 0===console.debug&&(console.debug=console.log),1>=i&&console.debug("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},log:function(t,e){this.debug(t.msg)},info:function(t,r){2>=i&&console.info("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},warn:function(t,r){3>=i&&console.warn("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},error:function(t,r){4>=i&&console.error("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)}},r);n.getDurationString=function(t,e){var i;function r(t,e){for(var i=(""+t).split(".");i[0].length0){for(var i="",r=0;r0&&(i+=","),i+="["+n.getDurationString(t.start(r))+","+n.getDurationString(t.end(r))+"]";return i}return"(empty)"},t.Log=n;var s=function(t){if(!(t instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=t,this.dataview=new DataView(t),this.position=0};s.prototype.getPosition=function(){return this.position},s.prototype.getEndPosition=function(){return this.buffer.byteLength},s.prototype.getLength=function(){return this.buffer.byteLength},s.prototype.seek=function(t){var e=Math.max(0,Math.min(this.buffer.byteLength,t));return this.position=isNaN(e)||!isFinite(e)?0:e,!0},s.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},s.prototype.readAnyInt=function(t,e){var i=0;if(this.position+t<=this.buffer.byteLength){switch(t){case 1:i=e?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=e?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(e)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=e?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(e)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+t}return this.position+=t,i}throw"Not enough bytes in buffer"},s.prototype.readUint8=function(){return this.readAnyInt(1,!1)},s.prototype.readUint16=function(){return this.readAnyInt(2,!1)},s.prototype.readUint24=function(){return this.readAnyInt(3,!1)},s.prototype.readUint32=function(){return this.readAnyInt(4,!1)},s.prototype.readUint64=function(){return this.readAnyInt(8,!1)},s.prototype.readString=function(t){if(this.position+t<=this.buffer.byteLength){for(var e="",i=0;ithis._byteLength&&(this._byteLength=e);else{for(i<1&&(i=1);e>i;)i*=2;var r=new ArrayBuffer(i),n=new Uint8Array(this._buffer);new Uint8Array(r,0,n.length).set(n),this.buffer=r,this._byteLength=e}}},a.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var t=new ArrayBuffer(this._byteLength),e=new Uint8Array(t),i=new Uint8Array(this._buffer,0,e.length);e.set(i),this.buffer=t}},a.BIG_ENDIAN=!1,a.LITTLE_ENDIAN=!0,a.prototype._byteLength=0,Object.defineProperty(a.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(t){this._buffer=t,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(a.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(t){this._byteOffset=t,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(a.prototype,"dataView",{get:function(){return this._dataView},set:function(t){this._byteOffset=t.byteOffset,this._buffer=t.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+t.byteLength}}),a.prototype.seek=function(t){var e=Math.max(0,Math.min(this.byteLength,t));this.position=isNaN(e)||!isFinite(e)?0:e},a.prototype.isEof=function(){return this.position>=this._byteLength},a.prototype.mapUint8Array=function(t){this._realloc(1*t);var e=new Uint8Array(this._buffer,this.byteOffset+this.position,t);return this.position+=1*t,e},a.prototype.readInt32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Int32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt16Array=function(t,e){t=null==t?this.byteLength-this.position/2:t;var i=new Int16Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt8Array=function(t){t=null==t?this.byteLength-this.position:t;var e=new Int8Array(t);return a.memcpy(e.buffer,0,this.buffer,this.byteOffset+this.position,t*e.BYTES_PER_ELEMENT),this.position+=e.byteLength,e},a.prototype.readUint32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Uint32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readUint16Array=function(t,e){t=null==t?this.byteLength-this.position/2:t;var i=new Uint16Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readUint8Array=function(t){t=null==t?this.byteLength-this.position:t;var e=new Uint8Array(t);return a.memcpy(e.buffer,0,this.buffer,this.byteOffset+this.position,t*e.BYTES_PER_ELEMENT),this.position+=e.byteLength,e},a.prototype.readFloat64Array=function(t,e){t=null==t?this.byteLength-this.position/8:t;var i=new Float64Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readFloat32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Float32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt32=function(t){var e=this._dataView.getInt32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readInt16=function(t){var e=this._dataView.getInt16(this.position,null==t?this.endianness:t);return this.position+=2,e},a.prototype.readInt8=function(){var t=this._dataView.getInt8(this.position);return this.position+=1,t},a.prototype.readUint32=function(t){var e=this._dataView.getUint32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readUint16=function(t){var e=this._dataView.getUint16(this.position,null==t?this.endianness:t);return this.position+=2,e},a.prototype.readUint8=function(){var t=this._dataView.getUint8(this.position);return this.position+=1,t},a.prototype.readFloat32=function(t){var e=this._dataView.getFloat32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readFloat64=function(t){var e=this._dataView.getFloat64(this.position,null==t?this.endianness:t);return this.position+=8,e},a.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,a.memcpy=function(t,e,i,r,n){var s=new Uint8Array(t,e,n),a=new Uint8Array(i,r,n);s.set(a)},a.arrayToNative=function(t,e){return e==this.endianness?t:this.flipArrayEndianness(t)},a.nativeToEndian=function(t,e){return this.endianness==e?t:this.flipArrayEndianness(t)},a.flipArrayEndianness=function(t){for(var e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=0;in;r--,n++){var s=e[n];e[n]=e[r],e[r]=s}return t},a.prototype.failurePosition=0,String.fromCharCodeUint8=function(t){for(var e=[],i=0;i>16),this.writeUint8((65280&t)>>8),this.writeUint8(255&t)},a.prototype.adjustUint32=function(t,e){var i=this.position;this.seek(t),this.writeUint32(e),this.seek(i)},a.prototype.mapInt32Array=function(t,e){this._realloc(4*t);var i=new Int32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i},a.prototype.mapInt16Array=function(t,e){this._realloc(2*t);var i=new Int16Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=2*t,i},a.prototype.mapInt8Array=function(t){this._realloc(1*t);var e=new Int8Array(this._buffer,this.byteOffset+this.position,t);return this.position+=1*t,e},a.prototype.mapUint32Array=function(t,e){this._realloc(4*t);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i},a.prototype.mapUint16Array=function(t,e){this._realloc(2*t);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=2*t,i},a.prototype.mapFloat64Array=function(t,e){this._realloc(8*t);var i=new Float64Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=8*t,i},a.prototype.mapFloat32Array=function(t,e){this._realloc(4*t);var i=new Float32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i};var l=function(t){this.buffers=[],this.bufferIndex=-1,t&&(this.insertBuffer(t),this.bufferIndex=0)};(l.prototype=new a(new ArrayBuffer,0,a.BIG_ENDIAN)).initialized=function(){var t;return this.bufferIndex>-1||(this.buffers.length>0?0===(t=this.buffers[0]).fileStart?(this.buffer=t,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(t,e){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(t.byteLength+e.byteLength));var i=new Uint8Array(t.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(e),t.byteLength),i.buffer},l.prototype.reduceBuffer=function(t,e,i){var r;return(r=new Uint8Array(i)).set(new Uint8Array(t,e,i)),r.buffer.fileStart=t.fileStart+e,r.buffer.usedBytes=0,r.buffer},l.prototype.insertBuffer=function(t){for(var e=!0,i=0;ir.byteLength){this.buffers.splice(i,1),i--;continue}n.warn("MultiBufferStream","Buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+") already appended, ignoring")}else t.fileStart+t.byteLength<=r.fileStart||(t=this.reduceBuffer(t,0,r.fileStart-t.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+")"),this.buffers.splice(i,0,t),0===i&&(this.buffer=t);e=!1;break}if(t.fileStart0)){e=!1;break}t=this.reduceBuffer(t,s,a)}}e&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+")"),this.buffers.push(t),0===i&&(this.buffer=t))},l.prototype.logBufferLevel=function(t){var e,i,r,s,a,o=[],l="";for(r=0,s=0,e=0;e0&&(l+=a.end-1+"]");var h=t?n.info:n.debug;0===this.buffers.length?h("MultiBufferStream","No more buffer in memory"):h("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+r+"/"+s+" bytes), continuous ranges: "+l)},l.prototype.cleanBuffers=function(){var t,e;for(t=0;t"+this.buffer.byteLength+")"),!0}return!1}return!1},l.prototype.findPosition=function(t,e,i){var r,s=null,a=-1;for(r=!0===t?0:this.bufferIndex;r=e?(n.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},l.prototype.findEndContiguousBuf=function(t){var e,i,r,n=void 0!==t?t:this.bufferIndex;if(i=this.buffers[n],this.buffers.length>n+1)for(e=n+1;e>3;return 31===r&&i.data.length>=2&&(r=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),r}return null},i.DecoderConfigDescriptor=function(t){i.Descriptor.call(this,4,t)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(t){this.oti=t.readUint8(),this.streamType=t.readUint8(),this.bufferSize=t.readUint24(),this.maxBitrate=t.readUint32(),this.avgBitrate=t.readUint32(),this.size-=13,this.parseRemainingDescriptors(t)},i.DecoderSpecificInfo=function(t){i.Descriptor.call(this,5,t)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(t){i.Descriptor.call(this,6,t)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=h;var d={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){d.FullBox.prototype=new d.Box,d.ContainerBox.prototype=new d.Box,d.SampleEntry.prototype=new d.Box,d.TrackGroupTypeBox.prototype=new d.FullBox,d.BASIC_BOXES.forEach((function(t){d.createBoxCtor(t)})),d.FULL_BOXES.forEach((function(t){d.createFullBoxCtor(t)})),d.CONTAINER_BOXES.forEach((function(t){d.createContainerBoxCtor(t[0],null,t[1])}))},Box:function(t,e,i){this.type=t,this.size=e,this.uuid=i},FullBox:function(t,e,i){d.Box.call(this,t,e,i),this.flags=0,this.version=0},ContainerBox:function(t,e,i){d.Box.call(this,t,e,i),this.boxes=[]},SampleEntry:function(t,e,i,r){d.ContainerBox.call(this,t,e),this.hdr_size=i,this.start=r},SampleGroupEntry:function(t){this.grouping_type=t},TrackGroupTypeBox:function(t,e){d.FullBox.call(this,t,e)},createBoxCtor:function(t,e){d.boxCodes.push(t),d[t+"Box"]=function(e){d.Box.call(this,t,e)},d[t+"Box"].prototype=new d.Box,e&&(d[t+"Box"].prototype.parse=e)},createFullBoxCtor:function(t,e){d[t+"Box"]=function(e){d.FullBox.call(this,t,e)},d[t+"Box"].prototype=new d.FullBox,d[t+"Box"].prototype.parse=function(t){this.parseFullHeader(t),e&&e.call(this,t)}},addSubBoxArrays:function(t){if(t){this.subBoxNames=t;for(var e=t.length,i=0;ii?(n.error("BoxParser","Box of type '"+c+"' has a size "+h+" greater than its container size "+i),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:h,hdr_size:l,start:o}):o+h>t.getEndPosition()?(t.seek(o),n.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:h,hdr_size:l,start:o}):e?{code:d.OK,type:c,size:h,hdr_size:l,start:o}:(d[c+"Box"]?r=new d[c+"Box"](h):"uuid"!==c?(n.warn("BoxParser","Unknown box type: '"+c+"'"),(r=new d.Box(c,h)).has_unparsed_data=!0):d.UUIDBoxes[a]?r=new d.UUIDBoxes[a](h):(n.warn("BoxParser","Unknown uuid type: '"+a+"'"),(r=new d.Box(c,h)).uuid=a,r.has_unparsed_data=!0),r.hdr_size=l,r.start=o,r.write===d.Box.prototype.write&&"mdat"!==r.type&&(n.info("BoxParser","'"+p+"' box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(t)),r.parse(t),(s=t.getPosition()-(r.start+r.size))<0?(n.warn("BoxParser","Parsing of box '"+p+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),t.seek(r.start+r.size)):s>0&&(n.error("BoxParser","Parsing of box '"+p+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),t.seek(r.start+r.size)),{code:d.OK,box:r,size:r.size})},d.Box.prototype.parse=function(t){"mdat"!=this.type?this.data=t.readUint8Array(this.size-this.hdr_size):0===this.size?t.seek(t.getEndPosition()):t.seek(this.start+this.size)},d.Box.prototype.parseDataAndRewind=function(t){this.data=t.readUint8Array(this.size-this.hdr_size),t.position-=this.size-this.hdr_size},d.FullBox.prototype.parseDataAndRewind=function(t){this.parseFullHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,t.position-=this.size-this.hdr_size},d.FullBox.prototype.parseFullHeader=function(t){this.version=t.readUint8(),this.flags=t.readUint24(),this.hdr_size+=4},d.FullBox.prototype.parse=function(t){this.parseFullHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size)},d.ContainerBox.prototype.parse=function(t){for(var e,i;t.getPosition()>10&31,e[1]=this.language>>5&31,e[2]=31&this.language,this.languageString=String.fromCharCode(e[0]+96,e[1]+96,e[2]+96)},d.SAMPLE_ENTRY_TYPE_VISUAL="Visual",d.SAMPLE_ENTRY_TYPE_AUDIO="Audio",d.SAMPLE_ENTRY_TYPE_HINT="Hint",d.SAMPLE_ENTRY_TYPE_METADATA="Metadata",d.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",d.SAMPLE_ENTRY_TYPE_SYSTEM="System",d.SAMPLE_ENTRY_TYPE_TEXT="Text",d.SampleEntry.prototype.parseHeader=function(t){t.readUint8Array(6),this.data_reference_index=t.readUint16(),this.hdr_size+=8},d.SampleEntry.prototype.parse=function(t){this.parseHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size)},d.SampleEntry.prototype.parseDataAndRewind=function(t){this.parseHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,t.position-=this.size-this.hdr_size},d.SampleEntry.prototype.parseFooter=function(t){d.ContainerBox.prototype.parse.call(this,t)},d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_HINT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,(function(t){var e;this.parseHeader(t),t.readUint16(),t.readUint16(),t.readUint32Array(3),this.width=t.readUint16(),this.height=t.readUint16(),this.horizresolution=t.readUint32(),this.vertresolution=t.readUint32(),t.readUint32(),this.frame_count=t.readUint16(),e=Math.min(31,t.readUint8()),this.compressorname=t.readString(e),e<31&&t.readString(31-e),this.depth=t.readUint16(),t.readUint16(),this.parseFooter(t)})),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,(function(t){this.parseHeader(t),t.readUint32Array(2),this.channel_count=t.readUint16(),this.samplesize=t.readUint16(),t.readUint16(),t.readUint16(),this.samplerate=t.readUint32()/65536,this.parseFooter(t)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT,"enct"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"encm"),d.createBoxCtor("a1lx",(function(t){var e=16*(1+(1&(1&t.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==e?t.readUint16():t.readUint32()})),d.createBoxCtor("a1op",(function(t){this.op_index=t.readUint8()})),d.createFullBoxCtor("auxC",(function(t){this.aux_type=t.readCString();var e=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=t.readUint8Array(e)})),d.createBoxCtor("av1C",(function(t){var e=t.readUint8();if(e>>7&!1)n.error("av1C marker problem");else if(this.version=127&e,1===this.version)if(e=t.readUint8(),this.seq_profile=e>>5&7,this.seq_level_idx_0=31&e,e=t.readUint8(),this.seq_tier_0=e>>7&1,this.high_bitdepth=e>>6&1,this.twelve_bit=e>>5&1,this.monochrome=e>>4&1,this.chroma_subsampling_x=e>>3&1,this.chroma_subsampling_y=e>>2&1,this.chroma_sample_position=3&e,e=t.readUint8(),this.reserved_1=e>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=e>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&e;else if(this.reserved_2=15&e,0!==this.reserved_2)return void n.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=t.readUint8Array(i)}else n.error("av1C reserved_1 parsing problem");else n.error("av1C version "+this.version+" not supported")})),d.createBoxCtor("avcC",(function(t){var e,i;for(this.configurationVersion=t.readUint8(),this.AVCProfileIndication=t.readUint8(),this.profile_compatibility=t.readUint8(),this.AVCLevelIndication=t.readUint8(),this.lengthSizeMinusOne=3&t.readUint8(),this.nb_SPS_nalus=31&t.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],e=0;e0&&(this.ext=t.readUint8Array(i))})),d.createBoxCtor("btrt",(function(t){this.bufferSizeDB=t.readUint32(),this.maxBitrate=t.readUint32(),this.avgBitrate=t.readUint32()})),d.createBoxCtor("clap",(function(t){this.cleanApertureWidthN=t.readUint32(),this.cleanApertureWidthD=t.readUint32(),this.cleanApertureHeightN=t.readUint32(),this.cleanApertureHeightD=t.readUint32(),this.horizOffN=t.readUint32(),this.horizOffD=t.readUint32(),this.vertOffN=t.readUint32(),this.vertOffD=t.readUint32()})),d.createBoxCtor("clli",(function(t){this.max_content_light_level=t.readUint16(),this.max_pic_average_light_level=t.readUint16()})),d.createFullBoxCtor("co64",(function(t){var e,i;if(e=t.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=t.readUint8Array(this.size-4))})),d.createFullBoxCtor("cprt",(function(t){this.parseLanguage(t),this.notice=t.readCString()})),d.createFullBoxCtor("cslg",(function(t){0===this.version&&(this.compositionToDTSShift=t.readInt32(),this.leastDecodeToDisplayDelta=t.readInt32(),this.greatestDecodeToDisplayDelta=t.readInt32(),this.compositionStartTime=t.readInt32(),this.compositionEndTime=t.readInt32())})),d.createFullBoxCtor("ctts",(function(t){var e,i;if(e=t.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=e>>1&31,this.bsmod=(1&e)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|r>>5&7})),d.createBoxCtor("dec3",(function(t){var e=t.readUint16();this.data_rate=e>>3,this.num_ind_sub=7&e,this.ind_subs=[];for(var i=0;i>6,r.bsid=n>>1&31,r.bsmod=(1&n)<<4|s>>4&15,r.acmod=s>>1&7,r.lfeon=1&s,r.num_dep_sub=a>>1&15,r.num_dep_sub>0&&(r.chan_loc=(1&a)<<8|t.readUint8())}})),d.createFullBoxCtor("dfLa",(function(t){var e=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(t);;){var r=t.readUint8(),n=Math.min(127&r,i.length-1);if(n?t.readUint8Array(t.readUint24()):(t.readUint8Array(13),this.samplerate=t.readUint32()>>12,t.readUint8Array(20)),e.push(i[n]),128&r)break}this.numMetadataBlocks=e.length+" ("+e.join(", ")+")"})),d.createBoxCtor("dimm",(function(t){this.bytessent=t.readUint64()})),d.createBoxCtor("dmax",(function(t){this.time=t.readUint32()})),d.createBoxCtor("dmed",(function(t){this.bytessent=t.readUint64()})),d.createFullBoxCtor("dref",(function(t){var e,i;this.entries=[];for(var r=t.readUint32(),n=0;n=4;)this.compatible_brands[i]=t.readString(4),e-=4,i++})),d.createFullBoxCtor("hdlr",(function(t){0===this.version&&(t.readUint32(),this.handler=t.readString(4),t.readUint32Array(3),this.name=t.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),d.createBoxCtor("hvcC",(function(t){var e,i,r,n;this.configurationVersion=t.readUint8(),n=t.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=t.readUint32(),this.general_constraint_indicator=t.readUint8Array(6),this.general_level_idc=t.readUint8(),this.min_spatial_segmentation_idc=4095&t.readUint16(),this.parallelismType=3&t.readUint8(),this.chroma_format_idc=3&t.readUint8(),this.bit_depth_luma_minus8=7&t.readUint8(),this.bit_depth_chroma_minus8=7&t.readUint8(),this.avgFrameRate=t.readUint16(),n=t.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=t.readUint8();for(e=0;e>7,a.nalu_type=63&n;var o=t.readUint16();for(i=0;i>4&15,this.length_size=15&e,e=t.readUint8(),this.base_offset_size=e>>4&15,1===this.version||2===this.version?this.index_size=15&e:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=t.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=t.readUint32()}for(var r=0;r>7,this.axis=1&e})),d.createFullBoxCtor("infe",(function(t){if(0!==this.version&&1!==this.version||(this.item_ID=t.readUint16(),this.item_protection_index=t.readUint16(),this.item_name=t.readCString(),this.content_type=t.readCString(),this.content_encoding=t.readCString()),1===this.version)return this.extension_type=t.readString(4),n.warn("BoxParser","Cannot parse extension type"),void t.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=t.readUint16():3===this.version&&(this.item_ID=t.readUint32()),this.item_protection_index=t.readUint16(),this.item_type=t.readString(4),this.item_name=t.readCString(),"mime"===this.item_type?(this.content_type=t.readCString(),this.content_encoding=t.readCString()):"uri "===this.item_type&&(this.item_uri_type=t.readCString()))})),d.createFullBoxCtor("ipma",(function(t){var e,i;for(entry_count=t.readUint32(),this.associations=[],e=0;e>7==1,1&this.flags?a.property_index=(127&s)<<8|t.readUint8():a.property_index=127&s}}})),d.createFullBoxCtor("iref",(function(t){var e,i;for(this.references=[];t.getPosition()>7,r.assignment_type=127&s,r.assignment_type){case 0:r.grouping_type=t.readString(4);break;case 1:r.grouping_type=t.readString(4),r.grouping_type_parameter=t.readUint32();break;case 2:case 3:break;case 4:r.sub_track_id=t.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}})),d.createBoxCtor("lsel",(function(t){this.layer_id=t.readUint16()})),d.createBoxCtor("maxr",(function(t){this.period=t.readUint32(),this.bytes=t.readUint32()})),d.createBoxCtor("mdcv",(function(t){this.display_primaries=[],this.display_primaries[0]={},this.display_primaries[0].x=t.readUint16(),this.display_primaries[0].y=t.readUint16(),this.display_primaries[1]={},this.display_primaries[1].x=t.readUint16(),this.display_primaries[1].y=t.readUint16(),this.display_primaries[2]={},this.display_primaries[2].x=t.readUint16(),this.display_primaries[2].y=t.readUint16(),this.white_point={},this.white_point.x=t.readUint16(),this.white_point.y=t.readUint16(),this.max_display_mastering_luminance=t.readUint32(),this.min_display_mastering_luminance=t.readUint32()})),d.createFullBoxCtor("mdhd",(function(t){1==this.version?(this.creation_time=t.readUint64(),this.modification_time=t.readUint64(),this.timescale=t.readUint32(),this.duration=t.readUint64()):(this.creation_time=t.readUint32(),this.modification_time=t.readUint32(),this.timescale=t.readUint32(),this.duration=t.readUint32()),this.parseLanguage(t),t.readUint16()})),d.createFullBoxCtor("mehd",(function(t){1&this.flags&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=t.readUint64():this.fragment_duration=t.readUint32()})),d.createFullBoxCtor("meta",(function(t){this.boxes=[],d.ContainerBox.prototype.parse.call(this,t)})),d.createFullBoxCtor("mfhd",(function(t){this.sequence_number=t.readUint32()})),d.createFullBoxCtor("mfro",(function(t){this._size=t.readUint32()})),d.createFullBoxCtor("mvhd",(function(t){1==this.version?(this.creation_time=t.readUint64(),this.modification_time=t.readUint64(),this.timescale=t.readUint32(),this.duration=t.readUint64()):(this.creation_time=t.readUint32(),this.modification_time=t.readUint32(),this.timescale=t.readUint32(),this.duration=t.readUint32()),this.rate=t.readUint32(),this.volume=t.readUint16()>>8,t.readUint16(),t.readUint32Array(2),this.matrix=t.readUint32Array(9),t.readUint32Array(6),this.next_track_id=t.readUint32()})),d.createBoxCtor("npck",(function(t){this.packetssent=t.readUint32()})),d.createBoxCtor("nump",(function(t){this.packetssent=t.readUint64()})),d.createFullBoxCtor("padb",(function(t){var e=t.readUint32();this.padbits=[];for(var i=0;i0){var e=t.readUint32();this.kid=[];for(var i=0;i0&&(this.data=t.readUint8Array(r))})),d.createFullBoxCtor("clef",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createFullBoxCtor("enof",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createFullBoxCtor("prof",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),d.createBoxCtor("rtp ",(function(t){this.descriptionformat=t.readString(4),this.sdptext=t.readString(this.size-this.hdr_size-4)})),d.createFullBoxCtor("saio",(function(t){1&this.flags&&(this.aux_info_type=t.readUint32(),this.aux_info_type_parameter=t.readUint32());var e=t.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=e>>6&1,this.durationFlag&&(this.duration=t.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=t.readUint8(),this.avgBitRate=t.readUint16(),this.avgFrameRate=t.readUint16()),this.dependency=[];for(var i=t.readUint8(),r=0;r>7,this.num_leading_samples=127&e})),d.createSampleGroupCtor("rash",(function(t){if(this.operation_point_count=t.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=t.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=t.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var e=0;e>4,this.skip_byte_block=15&e,this.isProtected=t.readUint8(),this.Per_Sample_IV_Size=t.readUint8(),this.KID=d.parseHex16(t),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=t.readUint8(),this.constant_IV=t.readUint8Array(this.constant_IV_size))})),d.createSampleGroupCtor("stsa",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("sync",(function(t){var e=t.readUint8();this.NAL_unit_type=63&e})),d.createSampleGroupCtor("tele",(function(t){var e=t.readUint8();this.level_independently_decodable=e>>7})),d.createSampleGroupCtor("tsas",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("tscl",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("vipr",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createFullBoxCtor("sbgp",(function(t){this.grouping_type=t.readString(4),1===this.version?this.grouping_type_parameter=t.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var e=t.readUint32(),i=0;i>6,this.sample_depends_on[r]=e>>4&3,this.sample_is_depended_on[r]=e>>2&3,this.sample_has_redundancy[r]=3&e})),d.createFullBoxCtor("senc"),d.createFullBoxCtor("sgpd",(function(t){this.grouping_type=t.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=t.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=t.readUint32()),this.entries=[];for(var e=t.readUint32(),i=0;i>31&1,r.referenced_size=2147483647&n,r.subsegment_duration=t.readUint32(),n=t.readUint32(),r.starts_with_SAP=n>>31&1,r.SAP_type=n>>28&7,r.SAP_delta_time=268435455&n}})),d.SingleItemTypeReferenceBox=function(t,e,i,r){d.Box.call(this,t,e),this.hdr_size=i,this.start=r},d.SingleItemTypeReferenceBox.prototype=new d.Box,d.SingleItemTypeReferenceBox.prototype.parse=function(t){this.from_item_ID=t.readUint16();var e=t.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[e+1]=15&r}else if(8===this.field_size)for(e=0;e0)for(i=0;i>4&15,this.default_skip_byte_block=15&e}this.default_isProtected=t.readUint8(),this.default_Per_Sample_IV_Size=t.readUint8(),this.default_KID=d.parseHex16(t),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=t.readUint8(),this.default_constant_IV=t.readUint8Array(this.default_constant_IV_size))})),d.createFullBoxCtor("tfdt",(function(t){1==this.version?this.baseMediaDecodeTime=t.readUint64():this.baseMediaDecodeTime=t.readUint32()})),d.createFullBoxCtor("tfhd",(function(t){var e=0;this.track_id=t.readUint32(),this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=t.readUint64(),e+=8):this.base_data_offset=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=t.readUint32(),e+=4):this.default_sample_description_index=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=t.readUint32(),e+=4):this.default_sample_duration=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=t.readUint32(),e+=4):this.default_sample_size=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=t.readUint32(),e+=4):this.default_sample_flags=0})),d.createFullBoxCtor("tfra",(function(t){this.track_ID=t.readUint32(),t.readUint24();var e=t.readUint8();this.length_size_of_traf_num=e>>4&3,this.length_size_of_trun_num=e>>2&3,this.length_size_of_sample_num=3&e,this.entries=[];for(var i=t.readUint32(),r=0;r>8,t.readUint16(),this.matrix=t.readInt32Array(9),this.width=t.readUint32(),this.height=t.readUint32()})),d.createBoxCtor("tmax",(function(t){this.time=t.readUint32()})),d.createBoxCtor("tmin",(function(t){this.time=t.readUint32()})),d.createBoxCtor("totl",(function(t){this.bytessent=t.readUint32()})),d.createBoxCtor("tpay",(function(t){this.bytessent=t.readUint32()})),d.createBoxCtor("tpyl",(function(t){this.bytessent=t.readUint64()})),d.TrackGroupTypeBox.prototype.parse=function(t){this.parseFullHeader(t),this.track_group_id=t.readUint32()},d.createTrackGroupCtor("msrc"),d.TrackReferenceTypeBox=function(t,e,i,r){d.Box.call(this,t,e),this.hdr_size=i,this.start=r},d.TrackReferenceTypeBox.prototype=new d.Box,d.TrackReferenceTypeBox.prototype.parse=function(t){this.track_ids=t.readUint32Array((this.size-this.hdr_size)/4)},d.trefBox.prototype.parse=function(t){for(var e,i;t.getPosition()e&&this.flags&d.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=t.readInt32(),e+=4):this.data_offset=0,this.size-this.hdr_size>e&&this.flags&d.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=t.readUint32(),e+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>e)for(var i=0;i0&&(this.location=t.readCString())})),d.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(t){this.LiveServerManifest=t.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),d.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(t){this.system_id=d.parseHex16(t);var e=t.readUint32();e>0&&(this.data=t.readUint8Array(e))})),d.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),d.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(t){this.default_AlgorithmID=t.readUint24(),this.default_IV_size=t.readUint8(),this.default_KID=d.parseHex16(t)})),d.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(t){this.fragment_count=t.readUint8(),this.entries=[];for(var e=0;e>4,this.chromaSubsampling=e>>1&7,this.videoFullRangeFlag=1&e,this.colourPrimaries=t.readUint8(),this.transferCharacteristics=t.readUint8(),this.matrixCoefficients=t.readUint8(),this.codecIntializationDataSize=t.readUint16(),this.codecIntializationData=t.readUint8Array(this.codecIntializationDataSize)):(this.profile=t.readUint8(),this.level=t.readUint8(),e=t.readUint8(),this.bitDepth=e>>4&15,this.colorSpace=15&e,e=t.readUint8(),this.chromaSubsampling=e>>4&15,this.transferFunction=e>>1&7,this.videoFullRangeFlag=1&e,this.codecIntializationDataSize=t.readUint16(),this.codecIntializationData=t.readUint8Array(this.codecIntializationDataSize))})),d.createBoxCtor("vttC",(function(t){this.text=t.readString(this.size-this.hdr_size)})),d.SampleEntry.prototype.isVideo=function(){return!1},d.SampleEntry.prototype.isAudio=function(){return!1},d.SampleEntry.prototype.isSubtitle=function(){return!1},d.SampleEntry.prototype.isMetadata=function(){return!1},d.SampleEntry.prototype.isHint=function(){return!1},d.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},d.SampleEntry.prototype.getWidth=function(){return""},d.SampleEntry.prototype.getHeight=function(){return""},d.SampleEntry.prototype.getChannelCount=function(){return""},d.SampleEntry.prototype.getSampleRate=function(){return""},d.SampleEntry.prototype.getSampleSize=function(){return""},d.VisualSampleEntry.prototype.isVideo=function(){return!0},d.VisualSampleEntry.prototype.getWidth=function(){return this.width},d.VisualSampleEntry.prototype.getHeight=function(){return this.height},d.AudioSampleEntry.prototype.isAudio=function(){return!0},d.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},d.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},d.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},d.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},d.MetadataSampleEntry.prototype.isMetadata=function(){return!0},d.decimalToHex=function(t,e){var i=Number(t).toString(16);for(e=null==e?e=2:e;i.length>=1;e+=d.decimalToHex(r,0),e+=".",0===this.hvcC.general_tier_flag?e+="L":e+="H",e+=this.hvcC.general_level_idc;var n=!1,s="";for(t=5;t>=0;t--)(this.hvcC.general_constraint_indicator[t]||n)&&(s="."+d.decimalToHex(this.hvcC.general_constraint_indicator[t],0)+s,n=!0);e+=s}return e},d.mp4aSampleEntry.prototype.getCodec=function(){var t=d.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var e=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return t+"."+d.decimalToHex(e)+(i?"."+i:"")}return t},d.stxtSampleEntry.prototype.getCodec=function(){var t=d.SampleEntry.prototype.getCodec.call(this);return this.mime_format?t+"."+this.mime_format:t},d.av01SampleEntry.prototype.getCodec=function(){var t,e=d.SampleEntry.prototype.getCodec.call(this);return 2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?t=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(t=1===this.av1C.high_bitdepth?"10":"08"),e+"."+this.av1C.seq_profile+"."+this.av1C.seq_level_idx_0+(this.av1C.seq_tier_0?"H":"M")+"."+t},d.Box.prototype.writeHeader=function(t,e){this.size+=8,this.size>o&&(this.size+=8),"uuid"===this.type&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+t.getPosition()+(e||"")),this.size>o?t.writeUint32(1):(this.sizePosition=t.getPosition(),t.writeUint32(this.size)),t.writeString(this.type,null,4),"uuid"===this.type&&t.writeUint8Array(this.uuid),this.size>o&&t.writeUint64(this.size)},d.FullBox.prototype.writeHeader=function(t){this.size+=4,d.Box.prototype.writeHeader.call(this,t," v="+this.version+" f="+this.flags),t.writeUint8(this.version),t.writeUint24(this.flags)},d.Box.prototype.write=function(t){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(t),t.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(t),this.data&&t.writeUint8Array(this.data))},d.ContainerBox.prototype.write=function(t){this.size=0,this.writeHeader(t);for(var e=0;e=2&&t.writeUint32(this.default_sample_description_index),t.writeUint32(this.entries.length),e=0;e0)for(e=0;e+1e?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(t),1===this.version?t.writeUint64(this.baseMediaDecodeTime):t.writeUint32(this.baseMediaDecodeTime)},d.tfhdBox.prototype.write=function(t){this.version=0,this.size=4,this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(t),t.writeUint32(this.track_id),this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&t.writeUint64(this.base_data_offset),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&t.writeUint32(this.default_sample_description_index),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&t.writeUint32(this.default_sample_duration),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&t.writeUint32(this.default_sample_size),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&t.writeUint32(this.default_sample_flags)},d.tkhdBox.prototype.write=function(t){this.version=0,this.size=80,this.writeHeader(t),t.writeUint32(this.creation_time),t.writeUint32(this.modification_time),t.writeUint32(this.track_id),t.writeUint32(0),t.writeUint32(this.duration),t.writeUint32(0),t.writeUint32(0),t.writeInt16(this.layer),t.writeInt16(this.alternate_group),t.writeInt16(this.volume<<8),t.writeUint16(0),t.writeInt32Array(this.matrix),t.writeUint32(this.width),t.writeUint32(this.height)},d.trexBox.prototype.write=function(t){this.version=0,this.flags=0,this.size=20,this.writeHeader(t),t.writeUint32(this.track_id),t.writeUint32(this.default_sample_description_index),t.writeUint32(this.default_sample_duration),t.writeUint32(this.default_sample_size),t.writeUint32(this.default_sample_flags)},d.trunBox.prototype.write=function(t){this.version=0,this.size=4,this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&d.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&d.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&d.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&d.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(t),t.writeUint32(this.sample_count),this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=t.getPosition(),t.writeInt32(this.data_offset)),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&t.writeUint32(this.first_sample_flags);for(var e=0;e-1||t[i]instanceof d.Box||e[i]instanceof d.Box||void 0===t[i]||void 0===e[i]||"function"==typeof t[i]||"function"==typeof e[i]||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||t[i]===e[i]))return!1;return!0},d.boxEqual=function(t,e){if(!d.boxEqualFields(t,e))return!1;for(var i=0;i1)for(e=1;e-1&&this.fragmentedTracks.splice(e,1)},u.prototype.setExtractionOptions=function(t,e,i){var r=this.getTrackById(t);if(r){var n={};this.extractedTracks.push(n),n.id=t,n.user=e,n.trak=r,r.nextSample=0,n.nb_samples=1e3,n.samples=[],i&&i.nbSamples&&(n.nb_samples=i.nbSamples)}},u.prototype.unsetExtractionOptions=function(t){for(var e=-1,i=0;i-1&&this.extractedTracks.splice(e,1)},u.prototype.parse=function(){var t,e;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(t=d.parseOneBox(this.stream,false)).code===d.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(t))continue;return}return}var i;switch(i="uuid"!==(e=t.box).type?e.type:e.uuid,this.boxes.push(e),i){case"mdat":this.mdats.push(e);break;case"moof":this.moofs.push(e);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&n.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=e}this.updateUsedBytes&&this.updateUsedBytes(e,t)}},u.prototype.checkBuffer=function(t){if(null==t)throw"Buffer must be defined and non empty";if(void 0===t.fileStart)throw"Buffer must have a fileStart property";return 0===t.byteLength?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+t.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+t.fileStart+")"),t.usedBytes=0,this.stream.insertBuffer(t),this.stream.logBufferLevel(),!!this.stream.initialized()||(n.warn("ISOFile","Not ready to start parsing"),!1))},u.prototype.appendBuffer=function(t,e){var i;if(this.checkBuffer(t))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(e),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+t.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},u.prototype.getInfo=function(){var t,e,i,r,n,s={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=null!=this.moov.mvex,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=null!=this.moov.iods,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(a+1e3*this.moov.mvhd.creation_time),s.modified=new Date(a+1e3*this.moov.mvhd.modification_time),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],t=0;t0?s.mime+='video/mp4; codecs="':s.audioTracks&&s.audioTracks.length>0?s.mime+='audio/mp4; codecs="':s.mime+='application/mp4; codecs="',t=0;t=i.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+r.id+" for samples ["+Math.max(0,i.nextSample-r.nb_samples)+","+(i.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(r.id,r.user,r.segmentStream.buffer,i.nextSample,t||i.nextSample>=i.samples.length),r.segmentStream=null,r!==this.fragmentedTracks[e]))break}}if(null!==this.onSamples)for(e=0;e=i.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[e]))break}}}},u.prototype.getBox=function(t){var e=this.getBoxes(t,!0);return e.length?e[0]:null},u.prototype.getBoxes=function(t,e){var i=[];return u._sweep.call(this,t,i,e),i},u._sweep=function(t,e,i){for(var r in this.type&&this.type==t&&e.push(this),this.boxes){if(e.length&&i)return;u._sweep.call(this.boxes[r],t,e,i)}},u.prototype.getTrackSamplesInfo=function(t){var e=this.getTrackById(t);return e?e.samples:void 0},u.prototype.getTrackSample=function(t,e){var i=this.getTrackById(t);return this.getSample(i,e)},u.prototype.releaseUsedSamples=function(t,e){var i=0,r=this.getTrackById(t);r.lastValidSample||(r.lastValidSample=0);for(var s=r.lastValidSample;st*s.timescale){h=r-1;break}e&&s.is_sync&&(l=r)}for(e&&(h=l),t=i.samples[h].cts,i.nextSample=h;i.samples[h].alreadyRead===i.samples[h].size&&i.samples[h+1];)h++;return a=i.samples[h].offset+i.samples[h].alreadyRead,n.info("ISOFile","Seeking to "+(e?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+n.getDurationString(t,o)+" and offset: "+a),{offset:a,time:t/o}},u.prototype.seek=function(t,e){var i,r,s,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;s-1){o=l;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",e.width).set("height",e.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",e.type+" Compressor").set("depth",24),e.avcDecoderConfigRecord){var p=new d.avcCBox,u=new s(e.avcDecoderConfigRecord);p.parse(u),a.addBox(p)}break;case"Audio":n.add("smhd").set("balance",e.balance||0),a.set("channel_count",e.channel_count||2).set("samplesize",e.samplesize||16).set("samplerate",e.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===e.type)a.set("namespace",e.namespace||"nonamespace").set("schema_location",e.schema_location||"").set("auxiliary_mime_types",e.auxiliary_mime_types||"");break;default:n.add("nmhd")}e.description&&a.addBox(e.description),e.description_boxes&&e.description_boxes.forEach((function(t){a.addBox(t)})),n.add("dinf").add("dref").addEntry((new d["url Box"]).set("flags",1));var f=n.add("stbl");return f.add("stsd").addEntry(a),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",e.id).set("default_sample_description_index",e.default_sample_description_index||1).set("default_sample_duration",e.default_sample_duration||0).set("default_sample_size",e.default_sample_size||0).set("default_sample_flags",e.default_sample_flags||0),this.buildTrakSampleLists(i),e.id}},d.Box.prototype.computeSize=function(t){var e=t||new a;e.endianness=a.BIG_ENDIAN,this.write(e)},u.prototype.addSample=function(t,e,i){var r=i||{},n={},s=this.getTrackById(t);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=r.sample_description_index?r.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=e,n.size=e.byteLength,n.alreadyRead=n.size,n.duration=r.duration||1,n.cts=r.cts||0,n.dts=r.dts||0,n.is_sync=r.is_sync||!1,n.is_leading=r.is_leading||0,n.depends_on=r.depends_on||0,n.is_depended_on=r.is_depended_on||0,n.has_redundancy=r.has_redundancy||0,n.degradation_priority=r.degradation_priority||0,n.offset=0,n.subsamples=r.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,s.first_dts||(s.first_dts=r.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(e),n}},u.prototype.createSingleSampleMoof=function(t){var e=0;e=t.is_sync?1<<25:65536;var i=new d.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var r=i.add("traf"),n=this.getTrackById(t.track_id);return r.add("tfhd").set("track_id",t.track_id).set("flags",d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add("tfdt").set("baseMediaDecodeTime",t.dts-n.first_dts),r.add("trun").set("flags",d.TRUN_FLAGS_DATA_OFFSET|d.TRUN_FLAGS_DURATION|d.TRUN_FLAGS_SIZE|d.TRUN_FLAGS_FLAGS|d.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[t.duration]).set("sample_size",[t.size]).set("sample_flags",[e]).set("sample_composition_time_offset",[t.cts-t.dts]),i},u.prototype.lastMoofIndex=0,u.prototype.samplesDataSize=0,u.prototype.resetTables=function(){var t,e,i,r,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,t=0;t=2&&(l=n[a].grouping_type+"/0",(o=new h(n[a].grouping_type,0)).is_fragment=!0,e.sample_groups_info[l]||(e.sample_groups_info[l]=o))}else for(a=0;a=2&&(l=r[a].grouping_type+"/0",o=new h(r[a].grouping_type,0),t.sample_groups_info[l]||(t.sample_groups_info[l]=o))},u.setSampleGroupProperties=function(t,e,i,r){var n,s;for(n in e.sample_groups=[],r){var a;if(e.sample_groups[n]={},e.sample_groups[n].grouping_type=r[n].grouping_type,e.sample_groups[n].grouping_type_parameter=r[n].grouping_type_parameter,i>=r[n].last_sample_in_run&&(r[n].last_sample_in_run<0&&(r[n].last_sample_in_run=0),r[n].entry_index++,r[n].entry_index<=r[n].sbgp.entries.length-1&&(r[n].last_sample_in_run+=r[n].sbgp.entries[r[n].entry_index].sample_count)),r[n].entry_index<=r[n].sbgp.entries.length-1?e.sample_groups[n].group_description_index=r[n].sbgp.entries[r[n].entry_index].group_description_index:e.sample_groups[n].group_description_index=-1,0!==e.sample_groups[n].group_description_index)a=r[n].fragment_description?r[n].fragment_description:r[n].description,e.sample_groups[n].group_description_index>0?(s=e.sample_groups[n].group_description_index>65535?(e.sample_groups[n].group_description_index>>16)-1:e.sample_groups[n].group_description_index-1,a&&s>=0&&(e.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(e.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},u.process_sdtp=function(t,e,i){e&&(t?(e.is_leading=t.is_leading[i],e.depends_on=t.sample_depends_on[i],e.is_depended_on=t.sample_is_depended_on[i],e.has_redundancy=t.sample_has_redundancy[i]):(e.is_leading=0,e.depends_on=0,e.is_depended_on=0,e.has_redundancy=0))},u.prototype.buildSampleLists=function(){var t,e;for(t=0;tb&&(x++,b<0&&(b=0),b+=s.sample_counts[x]),e>0?(t.samples[e-1].duration=s.sample_deltas[x],t.samples_duration+=t.samples[e-1].duration,$.dts=t.samples[e-1].dts+t.samples[e-1].duration):$.dts=0,a?(e>=w&&(v++,w<0&&(w=0),w+=a.sample_counts[v]),$.cts=t.samples[e].dts+a.sample_offsets[v]):$.cts=$.dts,o?(e==o.sample_numbers[S]-1?($.is_sync=!0,S++):($.is_sync=!1,$.degradation_priority=0),h&&h.entries[U].sample_delta+k==e+1&&($.subsamples=h.entries[U].subsamples,k+=h.entries[U].sample_delta,U++)):$.is_sync=!0,u.process_sdtp(t.mdia.minf.stbl.sdtp,$,$.number),$.degradation_priority=p?p.priority[e]:0,h&&h.entries[U].sample_delta+k==e&&($.subsamples=h.entries[U].subsamples,k+=h.entries[U].sample_delta),(d.length>0||c.length>0)&&u.setSampleGroupProperties(t,$,e,t.sample_groups_info)}e>0&&(t.samples[e-1].duration=Math.max(t.mdia.mdhd.duration-t.samples[e-1].dts,0),t.samples_duration+=t.samples[e-1].duration)}},u.prototype.updateSampleLists=function(){var t,e,i,r,n,s,a,o,l,h,c,p,f,m,g;if(void 0!==this.moov)for(;this.lastMoofIndex0&&u.initSampleGroups(p,c,c.sbgps,p.mdia.minf.stbl.sgpds,c.sgpds),e=0;e0?m.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration:(c.tfdt?m.dts=c.tfdt.baseMediaDecodeTime:m.dts=0,p.first_traf_merged=!0),m.cts=m.dts,_.flags&d.TRUN_FLAGS_CTS_OFFSET&&(m.cts=m.dts+_.sample_composition_time_offset[i]),g=a,_.flags&d.TRUN_FLAGS_FLAGS?g=_.sample_flags[i]:0===i&&_.flags&d.TRUN_FLAGS_FIRST_FLAG&&(g=_.first_sample_flags),m.is_sync=!(g>>16&1),m.is_leading=g>>26&3,m.depends_on=g>>24&3,m.is_depended_on=g>>22&3,m.has_redundancy=g>>20&3,m.degradation_priority=65535&g;var y=!!(c.tfhd.flags&d.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(c.tfhd.flags&d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),x=!!(_.flags&d.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:b||0===e?h.start:o,m.offset=0===e&&0===i?x?w+_.data_offset:w:o,o=m.offset+m.size,(c.sbgps.length>0||c.sgpds.length>0||p.mdia.minf.stbl.sbgps.length>0||p.mdia.minf.stbl.sgpds.length>0)&&u.setSampleGroupProperties(p,m,m.number_in_traf,c.sample_groups_info)}}if(c.subs){p.has_fragment_subsamples=!0;var v=c.first_sample_index;for(e=0;e-1))return null;var o=(i=this.stream.buffers[s]).byteLength-(r.offset+r.alreadyRead-i.fileStart);if(r.size-r.alreadyRead<=o)return n.debug("ISOFile","Getting sample #"+e+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+(r.size-r.alreadyRead)+" full size: "+r.size+")"),a.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,r.size-r.alreadyRead),i.usedBytes+=r.size-r.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead=r.size,r;if(0===o)return null;n.debug("ISOFile","Getting sample #"+e+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+r.size+")"),a.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,o),r.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},u.prototype.releaseSample=function(t,e){var i=t.samples[e];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},u.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},u.prototype.getCodecs=function(){var t,e="";for(t=0;t0&&(e+=","),e+=this.moov.traks[t].mdia.minf.stbl.stsd.entries[0].getCodec()}return e},u.prototype.getTrexById=function(t){var e;if(!this.moov||!this.moov.mvex)return null;for(e=0;e0&&(i.protection=s.ipro.protections[s.iinf.item_infos[t].protection_index-1]),s.iinf.item_infos[t].item_type?i.type=s.iinf.item_infos[t].item_type:i.type="mime",i.content_type=s.iinf.item_infos[t].content_type,i.content_encoding=s.iinf.item_infos[t].content_encoding;if(s.iloc)for(t=0;t0&&c.property_index-1-1))return null;var l=(e=this.stream.buffers[o]).byteLength-(s.offset+s.alreadyRead-e.fileStart);if(!(s.length-s.alreadyRead<=l))return n.debug("ISOFile","Getting item #"+t+" extent #"+r+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-e.fileStart)+" read size: "+l+" full extent size: "+s.length+" full item size: "+i.size+")"),a.memcpy(i.data.buffer,i.alreadyRead,e,s.offset+s.alreadyRead-e.fileStart,l),s.alreadyRead+=l,i.alreadyRead+=l,e.usedBytes+=l,this.stream.logBufferLevel(),null;n.debug("ISOFile","Getting item #"+t+" extent #"+r+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-e.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+i.size+")"),a.memcpy(i.data.buffer,i.alreadyRead,e,s.offset+s.alreadyRead-e.fileStart,s.length-s.alreadyRead),e.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return i.alreadyRead===i.size?i:null},u.prototype.releaseItem=function(t){var e=this.items[t];if(e.data){this.itemsDataSize-=e.size,e.data=null,e.alreadyRead=0;for(var i=0;i0?this.moov.traks[t].samples[0].duration:0),e.push(r)}return e},d.Box.prototype.printHeader=function(t){this.size+=8,this.size>o&&(this.size+=8),"uuid"===this.type&&(this.size+=16),t.log(t.indent+"size:"+this.size),t.log(t.indent+"type:"+this.type)},d.FullBox.prototype.printHeader=function(t){this.size+=4,d.Box.prototype.printHeader.call(this,t),t.log(t.indent+"version:"+this.version),t.log(t.indent+"flags:"+this.flags)},d.Box.prototype.print=function(t){this.printHeader(t)},d.ContainerBox.prototype.print=function(t){this.printHeader(t);for(var e=0;e>8)),t.log(t.indent+"matrix: "+this.matrix.join(", ")),t.log(t.indent+"next_track_id: "+this.next_track_id)},d.tkhdBox.prototype.print=function(t){d.FullBox.prototype.printHeader.call(this,t),t.log(t.indent+"creation_time: "+this.creation_time),t.log(t.indent+"modification_time: "+this.modification_time),t.log(t.indent+"track_id: "+this.track_id),t.log(t.indent+"duration: "+this.duration),t.log(t.indent+"volume: "+(this.volume>>8)),t.log(t.indent+"matrix: "+this.matrix.join(", ")),t.log(t.indent+"layer: "+this.layer),t.log(t.indent+"alternate_group: "+this.alternate_group),t.log(t.indent+"width: "+this.width),t.log(t.indent+"height: "+this.height)};var f={createFile:function(t,e){var i=void 0===t||t,r=new u(e);return r.discardMdatData=!i,r}};t.createFile=f.createFile}(wt);class vt{constructor(t){this.data=new Uint8Array(t),this.idx=0,this.size=t}getData(){if(this.idx!==this.size)throw new Error("Mismatch between size reserved and sized used");return this.data.slice(0,this.idx)}writeUint8(t){this.data.set([t],this.idx),this.idx+=1}writeUint16(t){const e=new Uint16Array(1);e[0]=t;const i=new Uint8Array(e.buffer);this.data.set([i[1],i[0]],this.idx),this.idx+=2}writeUint8Array(t){this.data.set(t,this.idx),this.idx+=t.length}}const St=(t,e,{VideoDecoder:i,EncodedVideoChunk:r,debug:n})=>new Promise(((s,a)=>{n&&console.info("Decoding video from",t);try{const o=wt.createFile();let l;const h=new i({output:t=>{createImageBitmap(t,{resizeQuality:"low"}).then((i=>{e(i),t.close(),h.decodeQueueSize<=0&&setTimeout((()=>{"closed"!==h.state&&(h.close(),s())}),500)}))},error:t=>{console.error(t),a(t)}});o.onReady=t=>{if(t&&t.videoTracks&&t.videoTracks[0]){[{codec:l}]=t.videoTracks,n&&console.info("Video with codec:",l);const e=(t=>{let e,i=7;for(e=0;e{for(let t=0;t{const e=t.body.getReader();let i=0;return e.read().then((function t({done:r,value:n}){if(r)return o.flush(),null;const s=n.buffer;return s.fileStart=i,i+=s.byteLength,o.appendBuffer(s),e.read().then(t)}))}))}catch(t){a(t)}}));class Ut{constructor({src:t,scrollyVideoContainer:e,cover:i=!0,sticky:r=!0,full:n=!0,trackScroll:s=!0,transitionSpeed:a=8,frameThreshold:o=.1,useWebCodecs:l=!0,debug:h=!1}){if("object"!=typeof document)return void console.error("ScrollyVideo must be initiated in a DOM context");if(!e)return void console.error("scrollyVideoContainer must be a valid DOM object");if(!t)return void console.error("Must provide valid video src to ScrollyVideo");if(e instanceof Element)this.container=e;else{if("string"!=typeof e)throw new Error("scrollyVideoContainer must be a valid DOM object");if(this.container=document.getElementById(e),!this.container)throw new Error("scrollyVideoContainer must be a valid DOM object")}this.src=t,this.transitionSpeed=a,this.frameThreshold=o,this.useWebCodecs=l,this.cover=i,this.sticky=r,this.full=n,this.trackScroll=s,this.debug=h,this.video=document.createElement("video"),this.video.src=t,this.video.preload="auto",this.video.tabIndex=0,this.video.autobuffer=!0,this.video.playsInline=!0,this.video.muted=!0,this.video.pause(),this.video.load(),this.container.appendChild(this.video),r&&(this.container.style.display="block",this.container.style.position="sticky",this.container.style.top="0"),n&&(this.container.style.width="100%",this.container.style.height="100vh",this.container.style.overflow="hidden"),i&&this.setCoverStyle(this.video);const d=(new xt).getEngine();this.isSafari="WebKit"===d.name,h&&this.isSafari&&console.info("Safari browser detected"),this.currentTime=0,this.targetTime=0,this.canvas=null,this.context=null,this.frames=[],this.frameRate=0,this.updateScrollPercentage=t=>{const e=this.container.parentNode.getBoundingClientRect(),i=-e.top/(e.height-window.innerHeight);this.debug&&console.info("ScrollyVideo scrolled to",i),this.setTargetTimePercent(i,{jump:t})},this.trackScroll?(window.addEventListener("scroll",this.updateScrollPercentage),this.video.addEventListener("loadedmetadata",(()=>this.updateScrollPercentage(!0)),{once:!0})):this.video.addEventListener("loadedmetadata",(()=>this.setTargetTimePercent(0,{jump:!0})),{once:!0}),this.resize=()=>{this.debug&&console.info("ScrollyVideo resizing..."),this.cover&&this.setCoverStyle(this.canvas||this.video),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate))},window.addEventListener("resize",this.resize),this.video.addEventListener("progress",this.resize),this.decodeVideo()}setCoverStyle(t){if(this.cover){t.style.position="absolute",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.minWidth="101%",t.style.minHeight="101%";const{width:e,height:i}=this.container.getBoundingClientRect(),r=t.videoWidth||t.width,n=t.videoHeight||t.height;this.debug&&console.info("Container dimensions:",[e,i]),this.debug&&console.info("Element dimensions:",[r,n]),e/i>r/n?(t.style.width="100%",t.style.height="auto"):(t.style.height="100%",t.style.width="auto")}}decodeVideo(){var t,e,i;this.useWebCodecs&&this.src&&(t=this.src,e=t=>{this.frames.push(t)},i=this.debug,"function"==typeof VideoDecoder&&"function"==typeof EncodedVideoChunk?(i&&console.info("WebCodecs is natively supported, using native version..."),St(t,e,{VideoDecoder:VideoDecoder,EncodedVideoChunk:EncodedVideoChunk,debug:i})):(i&&console.info("WebCodecs is not available in this browser."),Promise.resolve())).catch((()=>{this.debug&&console.error("Error encountered while decoding video"),this.frames=[],this.video.load()})).then((()=>{0!==this.frames.length?(this.frameRate=this.frames.length/this.video.duration,this.debug&&console.info("Received",this.frames.length,"frames"),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.video.style.display="none",this.container.appendChild(this.canvas),this.cover&&this.setCoverStyle(this.canvas),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate))):this.debug&&console.error("No frames were received from webCodecs")}))}paintCanvasFrame(t){if(this.canvas){const e=this.frames[t];if(e){this.debug&&console.info("Painting frame",t),this.canvas.width=e.width,this.canvas.height=e.height;const{width:i,height:r}=this.container.getBoundingClientRect();i/r>e.width/e.height?(this.canvas.style.width="100%",this.canvas.style.height="auto"):(this.canvas.style.height="100%",this.canvas.style.width="auto"),this.context.drawImage(e,0,0,e.width,e.height)}}}transitionToTargetTime({jump:t,transitionSpeed:e=this.transitionSpeed,easing:i=null}){this.debug&&console.info("Transitioning targetTime:",this.targetTime,"currentTime:",this.currentTime);const r=this.targetTime-this.currentTime,n=Math.abs(r),s=1e3*n,a=r>0,o=({startCurrentTime:r,startTimestamp:l,timestamp:h})=>{const d=(h-l)/s,c=a?this.currentTime>=this.targetTime:this.currentTime<=this.targetTime;if(isNaN(this.targetTime)||Math.abs(this.targetTime-this.currentTime)this.video.duration&&(this.targetTime=this.video.duration),this.targetTime<0&&(this.targetTime=0);const p=this.targetTime-this.currentTime,u=i&&Number.isFinite(d)?i(d):null,f=a?r+u*Math.abs(n)*e:r-u*Math.abs(n)*e;if(this.canvas)t?this.currentTime=this.targetTime:u?this.currentTime=f:this.currentTime+=p/(256/e),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate));else if(t||this.isSafari||!a)this.video.pause(),u?this.currentTime=f:this.currentTime+=p/(64/e),t&&(this.currentTime=this.targetTime),this.video.currentTime=this.currentTime;else{const t=Math.max(Math.min(4*p,e,16),1);this.debug&&console.info("ScrollyVideo playbackRate:",t),isNaN(t)||(this.video.playbackRate=t,this.video.play()),this.currentTime=this.video.currentTime}"function"==typeof requestAnimationFrame&&(this.transitioningRaf=requestAnimationFrame((t=>o({startCurrentTime:r,startTimestamp:l,timestamp:t}))))};"function"==typeof requestAnimationFrame&&(this.transitioningRaf=requestAnimationFrame((t=>{o({startCurrentTime:this.currentTime,startTimestamp:t,timestamp:t})})))}setTargetTimePercent(t,e={}){this.targetTime=Math.max(Math.min(t,1),0)*(this.frames.length&&this.frameRate?this.frames.length/this.frameRate:this.video.duration),!e.jump&&Math.abs(this.currentTime-this.targetTime){s&&s.destroy&&s.destroy()},I().$$.on_destroy.push(o),t.$$set=t=>{r(6,i=e(e({},i),m(t)))},t.$$.update=()=>{if(n){const{videoPercentage:t,...e}=i;JSON.stringify(e)!==a&&(s&&s.destroy&&s.destroy(),r(3,s=new Ut({...e,scrollyVideoContainer:n})),r(4,a=JSON.stringify(e))),s&&"number"==typeof t&&t>=0&&t<=1&&(e.trackScroll?s.setScrollPercent(t):s.setTargetTimePercent(t))}},i=m(i),[n,function(...t){s.setTargetTimePercent(...t)},function(...t){s.setScrollPercent(...t)},s,a,function(t){D[t?"unshift":"push"]((()=>{n=t,r(0,n)}))}]}class Et extends ht{constructor(t){super(),lt(this,t,$t,kt,a,{setTargetTimePercent:1,setScrollPercent:2})}get setTargetTimePercent(){return this.$$.ctx[1]}get setScrollPercent(){return this.$$.ctx[2]}}function Tt(t,e,i){const r=t.slice();return r[9]=e[i],r}function zt(t){let e,i;return e=new Et({props:{src:t[1],trackScroll:t[2],videoPercentage:t[3]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};2&i&&(r.src=t[1]),4&i&&(r.trackScroll=t[2]),8&i&&(r.videoPercentage=t[3]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function At(e){let i,r,n,s=e[9]+"";return{c(){i=w("div"),r=w("div"),n=v(s),$(r,"class","card svelte-161tbt5"),$(i,"class","card-wrap svelte-161tbt5")},m(t,e){y(t,i,e),_(i,r),_(r,n)},p:t,d(t){t&&b(i)}}}function Bt(t){let e,i,r,s,a,o,l,h,d,c,p,u=Math.floor(100*t[3])+"";return{c(){e=w("div"),i=w("h3"),i.textContent="Video Position",r=S(),s=w("div"),a=w("label"),o=v(u),l=v("%"),h=S(),d=w("input"),$(i,"class","svelte-161tbt5"),$(a,"for","video-position"),$(a,"class","svelte-161tbt5"),$(d,"id","video-position"),$(d,"type","range"),$(d,"min","0"),$(d,"max","1"),$(d,"step","0.01"),$(d,"class","svelte-161tbt5"),$(s,"class","option-wrap svelte-161tbt5"),$(e,"class","scroll-track svelte-161tbt5")},m(n,u){y(n,e,u),_(e,i),_(e,r),_(e,s),_(s,a),_(a,o),_(a,l),_(s,h),_(s,d),T(d,t[3]),c||(p=[k(d,"change",t[8]),k(d,"input",t[8])],c=!0)},p(t,e){8&e&&u!==(u=Math.floor(100*t[3])+"")&&E(o,u),8&e&&T(d,t[3])},d(t){t&&b(e),c=!1,n(p)}}}function It(t){let e,i,r,s,a,o,l,h,d,c,p,u,f,m,g,v,U,E,z,A;H(t[5]);let B=t[1]&&zt(t),I=t[4],C=[];for(let e=0;e{B=null})),X()),16&n){let i;for(I=t[4],i=0;i{1&t.$$.dirty&&n&&i(1,r=n>760?"https://scrollyvideo.js.org/goldengate.mp4":"https://scrollyvideo.js.org/goldengate_mobile.mp4")},[n,r,s,a,["This kind of scrolling video is common in visual journalism, marketing materials, or other scrollytelling applications.","This library provides a way to easily create these kinds of scrolling video experiences, without fussing with special video encoding formats.","Compatible with React, Svelte, Vue, and plain HTML."],function(){i(0,n=window.innerWidth)},function(){r=this.value,i(1,r),i(0,n)},function(){s=this.checked,i(2,s)},function(){var t;t=this.value,a=""===t?null:+t,i(3,a)}]}class Pt extends ht{constructor(t){super(),lt(this,t,Ct,It,a,{})}}function Ft(t,e,i){const r=t.slice();return r[18]=e[i],r}function Lt(t,e,i){const r=t.slice();return r[18]=e[i],r}function Rt(t,e,i){const r=t.slice();return r[10]=e[i],r}function Dt(t,e,i){const r=t.slice();return r[13]=e[i],r[15]=i,r}function Nt(t,e,i){const r=t.slice();return r[16]=e[i],r[15]=i,r}function Ot(t,e,i){const r=t.slice();return r[7]=e[i],r}function Mt(t){let e,i,r,n;const s=[Yt,Vt,Ht],a=[];function o(t,e){return"table"===t[0]?0:"list"===t[0]?1:2}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Gt(t){let e,i,r=t[1],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Vt(t){let e,i,r,n;const s=[Kt,Wt],a=[];function o(t,e){return t[4]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Yt(t){let e,i,r;var n=t[5].table;function s(t){return{props:{$$slots:{default:[pe]},$$scope:{ctx:t}}}}return n&&(e=A(n,s(t))),{c(){e&&nt(e.$$.fragment),i=U()},m(t,n){e&&st(e,t,n),y(t,i,n),r=!0},p(t,r){const a={};if(8388716&r&&(a.$$scope={dirty:r,ctx:t}),n!==(n=t[5].table)){if(e){K();const t=e;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function jt(e){let i,r=e[6].raw+"";return{c(){i=v(r)},m(t,e){y(t,i,e)},p(t,e){64&e&&r!==(r=t[6].raw+"")&&E(i,r)},i:t,o:t,d(t){t&&b(i)}}}function qt(t){let e,i;return e=new ge({props:{tokens:t[1],renderers:t[5]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};2&i&&(r.tokens=t[1]),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function Zt(t){let e,i,r,n;const s=[qt,jt],a=[];function o(t,e){return t[1]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Wt(t){let i,r,n;const s=[{ordered:t[4]},t[6]];var a=t[5].list;function o(t){let i={$$slots:{default:[Jt]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Kt(t){let i,r,n;const s=[{ordered:t[4]},t[6]];var a=t[5].list;function o(t){let i={$$slots:{default:[ie]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Xt(t){let e,i,r;return e=new ge({props:{tokens:t[18].tokens,renderers:t[5]}}),{c(){nt(e.$$.fragment),i=S()},m(t,n){st(e,t,n),y(t,i,n),r=!0},p(t,i){const r={};64&i&&(r.tokens=t[18].tokens),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){r||(Q(e.$$.fragment,t),r=!0)},o(t){J(e.$$.fragment,t),r=!1},d(t){at(e,t),t&&b(i)}}}function Qt(t){let i,r,n;const s=[t[18]];var a=t[5].unorderedlistitem||t[5].listitem;function o(t){let i={$$slots:{default:[Xt]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Jt(t){let e,i,r=t[6].items,n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function ie(t){let e,i,r=t[6].items,n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function se(t){let e,i,r=t[2],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function oe(t){let e,i;return e=new ge({props:{tokens:t[13].tokens,renderers:t[5]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};8&i&&(r.tokens=t[13].tokens),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function le(t){let e,i,r;var n=t[5].tablecell;function s(t){return{props:{header:!1,align:t[6].align[t[15]]||"center",$$slots:{default:[oe]},$$scope:{ctx:t}}}}return n&&(e=A(n,s(t))),{c(){e&&nt(e.$$.fragment),i=U()},m(t,n){e&&st(e,t,n),y(t,i,n),r=!0},p(t,r){const a={};if(64&r&&(a.align=t[6].align[t[15]]||"center"),8388648&r&&(a.$$scope={dirty:r,ctx:t}),n!==(n=t[5].tablecell)){if(e){K();const t=e;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function he(t){let e,i,r=t[10],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function ce(t){let e,i,r=t[3],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(e=A(a,o(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else a&&e.$set(d);const c={};if(8388712&s&&(c.$$scope={dirty:s,ctx:t}),l!==(l=t[5].tablebody)){if(r){K();const t=r;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}l?(r=A(l,h(t)),nt(r.$$.fragment),Q(r.$$.fragment,1),st(r,n.parentNode,n)):r=null}else l&&r.$set(c)},i(t){s||(e&&Q(e.$$.fragment,t),r&&Q(r.$$.fragment,t),s=!0)},o(t){e&&J(e.$$.fragment,t),r&&J(r.$$.fragment,t),s=!1},d(t){e&&at(e,t),t&&b(i),t&&b(n),r&&at(r,t)}}}function ue(t){let i,r;const n=[t[7],{renderers:t[5]}];let s={};for(let t=0;t{a[l]=null})),X()),~e?(i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r)):i=null)},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){~e&&a[e].d(t),t&&b(r)}}}function me(t,i,r){const n=["type","tokens","header","rows","ordered","renderers"];let s=g(i,n),{type:a}=i,{tokens:o}=i,{header:l}=i,{rows:h}=i,{ordered:d=!1}=i,{renderers:c}=i;return function(){const t=console.warn;console.warn=e=>{e.includes("unknown prop")||e.includes("unexpected slot")||t(e)},C((()=>{console.warn=t}))}(),t.$$set=t=>{i=e(e({},i),m(t)),r(6,s=g(i,n)),"type"in t&&r(0,a=t.type),"tokens"in t&&r(1,o=t.tokens),"header"in t&&r(2,l=t.header),"rows"in t&&r(3,h=t.rows),"ordered"in t&&r(4,d=t.ordered),"renderers"in t&&r(5,c=t.renderers)},[a,o,l,h,d,c,s]}class ge extends ht{constructor(t){super(),lt(this,t,me,fe,a,{type:0,tokens:1,header:2,rows:3,ordered:4,renderers:5})}}function _e(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let ye={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const be=/[&<>"']/,xe=new RegExp(be.source,"g"),we=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ve=new RegExp(we.source,"g"),Se={"&":"&","<":"<",">":">",'"':""","'":"'"},Ue=t=>Se[t];function ke(t,e){if(e){if(be.test(t))return t.replace(xe,Ue)}else if(we.test(t))return t.replace(ve,Ue);return t}const $e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ee(t){return t.replace($e,((t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const Te=/(^|[^\[])\^/g;function ze(t,e){t="string"==typeof t?t:t.source,e=e||"";const i={replace:(e,r)=>(r=(r=r.source||r).replace(Te,"$1"),t=t.replace(e,r),i),getRegex:()=>new RegExp(t,e)};return i}const Ae=/[^\w:]/g,Be=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Ie(t,e,i){if(t){let t;try{t=decodeURIComponent(Ee(i)).replace(Ae,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!Be.test(i)&&(i=function(t,e){Ce[" "+t]||(Pe.test(t)?Ce[" "+t]=t+"/":Ce[" "+t]=Oe(t,"/",!0));t=Ce[" "+t];const i=-1===t.indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(Fe,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(Le,"$1")+e:t+e}(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}const Ce={},Pe=/^[^:]+:\/*[^/]*$/,Fe=/^([^:]+:)[\s\S]*$/,Le=/^([^:]+:\/*[^/]*)[\s\S]*$/;const Re={exec:function(){}};function De(t){let e,i,r=1;for(;r{let r=!1,n=e;for(;--n>=0&&"\\"===i[n];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),i.length>e)i.splice(e);else for(;i.length1;)1&e&&(i+=t),e>>=1,t+=t;return i+t}function He(t,e,i,r){const n=e.href,s=e.title?ke(e.title):null,a=t[1].replace(/\\([\[\]])/g,"$1");if("!"!==t[0].charAt(0)){r.state.inLink=!0;const t={type:"link",raw:i,href:n,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,t}return{type:"image",raw:i,href:n,title:s,text:ke(a)}}class Ve{constructor(t){this.options=t||ye}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Oe(t,"\n")}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0],i=function(t,e){const i=t.match(/^(\s+)(?:```)/);if(null===i)return e;const r=i[1];return e.split("\n").map((t=>{const e=t.match(/^\s+/);if(null===e)return t;const[i]=e;return i.length>=r.length?t.slice(r.length):t})).join("\n")}(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline._escapes,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(/#$/.test(t)){const e=Oe(t,"#");this.options.pedantic?t=e.trim():e&&!/ $/.test(e)||(t=e.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const t=e[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(t);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:r,text:t}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i,r,n,s,a,o,l,h,d,c,p,u,f=e[1].trim();const m=f.length>1,g={type:"list",raw:"",ordered:m,start:m?+f.slice(0,-1):"",loose:!1,items:[]};f=m?`\\d{1,9}\\${f.slice(-1)}`:`\\${f}`,this.options.pedantic&&(f=m?f:"[*+-]");const _=new RegExp(`^( {0,3}${f})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;t&&(u=!1,e=_.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(t=>" ".repeat(3*t.length))),d=t.split("\n",1)[0],this.options.pedantic?(s=2,p=h.trimLeft()):(s=e[2].search(/[^ ]/),s=s>4?1:s,p=h.slice(s),s+=e[1].length),o=!1,!h&&/^ *$/.test(d)&&(i+=d+"\n",t=t.substring(d.length+1),u=!0),!u){const e=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),a=new RegExp(`^ {0,${Math.min(3,s-1)}}#`);for(;t&&(c=t.split("\n",1)[0],d=c,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!n.test(d))&&!a.test(d)&&!e.test(d)&&!r.test(t);){if(d.search(/[^ ]/)>=s||!d.trim())p+="\n"+d.slice(s);else{if(o)break;if(h.search(/[^ ]/)>=4)break;if(n.test(h))break;if(a.test(h))break;if(r.test(h))break;p+="\n"+d}o||d.trim()||(o=!0),i+=c+"\n",t=t.substring(c.length+1),h=d.slice(s)}}g.loose||(l?g.loose=!0:/\n *\n *$/.test(i)&&(l=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(p),r&&(n="[ ] "!==r[0],p=p.replace(/^\[[ xX]\] +/,""))),g.items.push({type:"list_item",raw:i,task:!!r,checked:n,loose:!1,text:p}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=p.trimRight(),g.raw=g.raw.trimRight();const y=g.items.length;for(a=0;a"space"===t.type)),e=t.length>0&&t.some((t=>/\n.*\n/.test(t.raw)));g.loose=e}if(g.loose)for(a=0;a$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:i,title:r}}}table(t){const e=this.rules.block.table.exec(t);if(e){const t={type:"table",header:Ne(e[1]).map((t=>({text:t}))),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];let i,r,n,s,a=t.align.length;for(i=0;i({text:t})));for(a=t.header.length,r=0;r/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):ke(e[0]):e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^$/.test(t))return;const e=Oe(t.slice(0,-1),"\\");if((t.length-e.length)%2==0)return}else{const t=function(t,e){if(-1===t.indexOf(e[1]))return-1;const i=t.length;let r=0,n=0;for(;n-1){const i=(0===e[0].indexOf("!")?5:4)+e[1].length+t;e[2]=e[2].substring(0,t),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){const t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);t&&(i=t[1],r=t[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^$/.test(t)?i.slice(1):i.slice(1,-1)),He(e,{href:i?i.replace(this.rules.inline._escapes,"$1"):i,title:r?r.replace(this.rules.inline._escapes,"$1"):r},e[0],this.lexer)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let t=(i[2]||i[1]).replace(/\s+/g," ");if(t=e[t.toLowerCase()],!t){const t=i[0].charAt(0);return{type:"text",raw:t,text:t}}return He(i,t,i[0],this.lexer)}}emStrong(t,e,i=""){let r=this.rules.inline.emStrong.lDelim.exec(t);if(!r)return;if(r[3]&&i.match(/[\p{L}\p{N}]/u))return;const n=r[1]||r[2]||"";if(!n||n&&(""===i||this.rules.inline.punctuation.exec(i))){const i=r[0].length-1;let n,s,a=i,o=0;const l="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+i);null!=(r=l.exec(e));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(s=n.length,r[3]||r[4]){a+=s;continue}if((r[5]||r[6])&&i%3&&!((i+s)%3)){o+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a+o);const e=t.slice(0,i+r.index+(r[0].length-n.length)+s);if(Math.min(i,s)%2){const t=e.slice(1,-1);return{type:"em",raw:e,text:t,tokens:this.lexer.inlineTokens(t)}}const l=e.slice(2,-2);return{type:"strong",raw:e,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(/\n/g," ");const i=/[^ ]/.test(t),r=/^ /.test(t)&&/ $/.test(t);return i&&r&&(t=t.substring(1,t.length-1)),t=ke(t,!0),{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t,e){const i=this.rules.inline.autolink.exec(t);if(i){let t,r;return"@"===i[2]?(t=ke(this.options.mangle?e(i[1]):i[1]),r="mailto:"+t):(t=ke(i[1]),r=t),{type:"link",raw:i[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t,e){let i;if(i=this.rules.inline.url.exec(t)){let t,r;if("@"===i[2])t=ke(this.options.mangle?e(i[0]):i[0]),r="mailto:"+t;else{let e;do{e=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(e!==i[0]);t=ke(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t,e){const i=this.rules.inline.text.exec(t);if(i){let t;return t=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):ke(i[0]):i[0]:ke(this.options.smartypants?e(i[0]):i[0]),{type:"text",raw:i[0],text:t}}}}const Ye={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Re,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Ye.def=ze(Ye.def).replace("label",Ye._label).replace("title",Ye._title).getRegex(),Ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,Ye.listItemStart=ze(/^( *)(bull) */).replace("bull",Ye.bullet).getRegex(),Ye.list=ze(Ye.list).replace(/bull/g,Ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ye.def.source+")").getRegex(),Ye._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ye._comment=/|$)/,Ye.html=ze(Ye.html,"i").replace("comment",Ye._comment).replace("tag",Ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ye.paragraph=ze(Ye._paragraph).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.blockquote=ze(Ye.blockquote).replace("paragraph",Ye.paragraph).getRegex(),Ye.normal=De({},Ye),Ye.gfm=De({},Ye.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Ye.gfm.table=ze(Ye.gfm.table).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.gfm.paragraph=ze(Ye._paragraph).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Ye.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.pedantic=De({},Ye.normal,{html:ze("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Ye._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Re,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ze(Ye.normal._paragraph).replace("hr",Ye.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const je={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Re,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(i="x"+i.toString(16)),r+="&#"+i+";";return r}je._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",je.punctuation=ze(je.punctuation).replace(/punctuation/g,je._punctuation).getRegex(),je.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,je.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,je._comment=ze(Ye._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),je.emStrong.lDelim=ze(je.emStrong.lDelim).replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimAst=ze(je.emStrong.rDelimAst,"g").replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimUnd=ze(je.emStrong.rDelimUnd,"g").replace(/punct/g,je._punctuation).getRegex(),je._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,je._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,je._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,je.autolink=ze(je.autolink).replace("scheme",je._scheme).replace("email",je._email).getRegex(),je._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,je.tag=ze(je.tag).replace("comment",je._comment).replace("attribute",je._attribute).getRegex(),je._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,je._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,je._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,je.link=ze(je.link).replace("label",je._label).replace("href",je._href).replace("title",je._title).getRegex(),je.reflink=ze(je.reflink).replace("label",je._label).replace("ref",Ye._label).getRegex(),je.nolink=ze(je.nolink).replace("ref",Ye._label).getRegex(),je.reflinkSearch=ze(je.reflinkSearch,"g").replace("reflink",je.reflink).replace("nolink",je.nolink).getRegex(),je.normal=De({},je),je.pedantic=De({},je.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ze(/^!?\[(label)\]\((.*?)\)/).replace("label",je._label).getRegex(),reflink:ze(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",je._label).getRegex()}),je.gfm=De({},je.normal,{escape:ze(je.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\e+" ".repeat(i.length)));t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))))if(i=this.tokenizer.space(t))t=t.substring(i.raw.length),1===i.raw.length&&e.length>0?e[e.length-1].raw+="\n":e.push(i);else if(i=this.tokenizer.code(t))t=t.substring(i.raw.length),r=e[e.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?e.push(i):(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(i=this.tokenizer.fences(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.heading(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.hr(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.blockquote(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.list(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.html(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.def(t))t=t.substring(i.raw.length),r=e[e.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(r.raw+="\n"+i.raw,r.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(i=this.tokenizer.table(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.lheading(t))t=t.substring(i.raw.length),e.push(i);else{if(n=t,this.options.extensions&&this.options.extensions.startBlock){let e=1/0;const i=t.slice(1);let r;this.options.extensions.startBlock.forEach((function(t){r=t.call({lexer:this},i),"number"==typeof r&&r>=0&&(e=Math.min(e,r))})),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n)))r=e[e.length-1],s&&"paragraph"===r.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(i),s=n.length!==t.length,t=t.substring(i.raw.length);else if(i=this.tokenizer.text(t))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===r.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(i);else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let i,r,n,s,a,o,l=t;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(l));)t.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,s.index)+"["+Ge("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,s.index)+"["+Ge("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,s.index+s[0].length-2)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;t;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))))if(i=this.tokenizer.escape(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.tag(t))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===i.type&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(i=this.tokenizer.link(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===i.type&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(i=this.tokenizer.emStrong(t,l,o))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.codespan(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.br(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.del(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.autolink(t,Ze))t=t.substring(i.raw.length),e.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(t,Ze))){if(n=t,this.options.extensions&&this.options.extensions.startInline){let e=1/0;const i=t.slice(1);let r;this.options.extensions.startInline.forEach((function(t){r=t.call({lexer:this},i),"number"==typeof r&&r>=0&&(e=Math.min(e,r))})),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(i=this.tokenizer.inlineText(n,qe))t=t.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(o=i.raw.slice(-1)),a=!0,r=e[e.length-1],r&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}else t=t.substring(i.raw.length),e.push(i);return e}}class Ke{constructor(t){this.options=t||ye}code(t,e,i){const r=(e||"").match(/\S*/)[0];if(this.options.highlight){const e=this.options.highlight(t,r);null!=e&&e!==t&&(i=!0,t=e)}return t=t.replace(/\n$/,"")+"\n",r?'
'+(i?t:ke(t,!0))+"
\n":"
"+(i?t:ke(t,!0))+"
\n"}blockquote(t){return`
\n${t}
\n`}html(t){return t}heading(t,e,i,r){if(this.options.headerIds){return`${t}\n`}return`${t}\n`}hr(){return this.options.xhtml?"
\n":"
\n"}list(t,e,i){const r=e?"ol":"ul";return"<"+r+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"}listitem(t){return`
  • ${t}
  • \n`}checkbox(t){return" "}paragraph(t){return`

    ${t}

    \n`}table(t,e){return e&&(e=`${e}`),"\n\n"+t+"\n"+e+"
    \n"}tablerow(t){return`\n${t}\n`}tablecell(t,e){const i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`\n`}strong(t){return`${t}`}em(t){return`${t}`}codespan(t){return`${t}`}br(){return this.options.xhtml?"
    ":"
    "}del(t){return`${t}`}link(t,e,i){if(null===(t=Ie(this.options.sanitize,this.options.baseUrl,t)))return i;let r='",r}image(t,e,i){if(null===(t=Ie(this.options.sanitize,this.options.baseUrl,t)))return i;let r=`${i}":">",r}text(t){return t}}class Xe{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,i){return""+i}image(t,e,i){return""+i}br(){return""}}class Qe{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,e){let i=t,r=0;if(this.seen.hasOwnProperty(i)){r=this.seen[t];do{r++,i=t+"-"+r}while(this.seen.hasOwnProperty(i))}return e||(this.seen[t]=r,this.seen[i]=0),i}slug(t,e={}){const i=this.serialize(t);return this.getNextSafeSlug(i,e.dryrun)}}class Je{constructor(t){this.options=t||ye,this.options.renderer=this.options.renderer||new Ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Xe,this.slugger=new Qe}static parse(t,e){return new Je(e).parse(t)}static parseInline(t,e){return new Je(e).parseInline(t)}parse(t,e=!0){let i,r,n,s,a,o,l,h,d,c,p,u,f,m,g,_,y,b,x,w="";const v=t.length;for(i=0;i0&&"paragraph"===g.tokens[0].type?(g.tokens[0].text=b+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&"text"===g.tokens[0].tokens[0].type&&(g.tokens[0].tokens[0].text=b+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:b}):m+=b),m+=this.parse(g.tokens,f),d+=this.renderer.listitem(m,y,_);w+=this.renderer.list(d,p,u);continue;case"html":w+=this.renderer.html(c.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(d=c.tokens?this.parseInline(c.tokens):c.text;i+1{r(t.text,t.lang,(function(e,i){if(e)return s(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),a--,0===a&&s()}))}),0))})),void(0===a&&s())}function r(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"

    An error occurred:

    "+ke(t.message+"",!0)+"
    ";throw t}try{const i=We.lex(t,e);if(e.walkTokens){if(e.async)return Promise.all(ti.walkTokens(i,e.walkTokens)).then((()=>Je.parse(i,e))).catch(r);ti.walkTokens(i,e.walkTokens)}return Je.parse(i,e)}catch(t){r(t)}}ti.options=ti.setOptions=function(t){var e;return De(ti.defaults,t),e=ti.defaults,ye=e,ti},ti.getDefaults=_e,ti.defaults=ye,ti.use=function(...t){const e=ti.defaults.extensions||{renderers:{},childTokens:{}};t.forEach((t=>{const i=De({},t);if(i.async=ti.defaults.async||i.async,t.extensions&&(t.extensions.forEach((t=>{if(!t.name)throw new Error("extension name required");if(t.renderer){const i=e.renderers[t.name];e.renderers[t.name]=i?function(...e){let r=t.renderer.apply(this,e);return!1===r&&(r=i.apply(this,e)),r}:t.renderer}if(t.tokenizer){if(!t.level||"block"!==t.level&&"inline"!==t.level)throw new Error("extension level must be 'block' or 'inline'");e[t.level]?e[t.level].unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&("block"===t.level?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:"inline"===t.level&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}t.childTokens&&(e.childTokens[t.name]=t.childTokens)})),i.extensions=e),t.renderer){const e=ti.defaults.renderer||new Ke;for(const i in t.renderer){const r=e[i];e[i]=(...n)=>{let s=t.renderer[i].apply(e,n);return!1===s&&(s=r.apply(e,n)),s}}i.renderer=e}if(t.tokenizer){const e=ti.defaults.tokenizer||new Ve;for(const i in t.tokenizer){const r=e[i];e[i]=(...n)=>{let s=t.tokenizer[i].apply(e,n);return!1===s&&(s=r.apply(e,n)),s}}i.tokenizer=e}if(t.walkTokens){const e=ti.defaults.walkTokens;i.walkTokens=function(i){let r=[];return r.push(t.walkTokens.call(this,i)),e&&(r=r.concat(e.call(this,i))),r}}ti.setOptions(i)}))},ti.walkTokens=function(t,e){let i=[];for(const r of t)switch(i=i.concat(e.call(ti,r)),r.type){case"table":for(const t of r.header)i=i.concat(ti.walkTokens(t.tokens,e));for(const t of r.rows)for(const r of t)i=i.concat(ti.walkTokens(r.tokens,e));break;case"list":i=i.concat(ti.walkTokens(r.items,e));break;default:ti.defaults.extensions&&ti.defaults.extensions.childTokens&&ti.defaults.extensions.childTokens[r.type]?ti.defaults.extensions.childTokens[r.type].forEach((function(t){i=i.concat(ti.walkTokens(r[t],e))})):r.tokens&&(i=i.concat(ti.walkTokens(r.tokens,e)))}return i},ti.parseInline=function(t,e){if(null==t)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");Me(e=De({},ti.defaults,e||{}));try{const i=We.lexInline(t,e);return e.walkTokens&&ti.walkTokens(i,e.walkTokens),Je.parseInline(i,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"

    An error occurred:

    "+ke(t.message+"",!0)+"
    ";throw t}},ti.Parser=Je,ti.parser=Je.parse,ti.Renderer=Ke,ti.TextRenderer=Xe,ti.Lexer=We,ti.lexer=We.lex,ti.Tokenizer=Ve,ti.Slugger=Qe,ti.parse=ti,ti.options,ti.setOptions,ti.use,ti.walkTokens,ti.parseInline,Je.parse,We.lex;const ei={};function ii(e){let i;return{c(){i=v(e[1])},m(t,e){y(t,i,e)},p(t,e){2&e&&E(i,t[1])},i:t,o:t,d(t){t&&b(i)}}}function ri(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h6"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ni(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h5"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function si(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h4"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ai(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h3"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function oi(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h2"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function li(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h1"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function hi(t){let e,i,r,n;const s=[li,oi,ai,si,ni,ri,ii],a=[];function o(t,e){return 1===t[0]?0:2===t[0]?1:3===t[0]?2:4===t[0]?3:5===t[0]?4:6===t[0]?5:6}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function di(t,e,i){let r,{$$slots:n={},$$scope:s}=e,{depth:a}=e,{raw:o}=e,{text:l}=e;const{slug:h,getOptions:d}=L(ei),c=d();return t.$$set=t=>{"depth"in t&&i(0,a=t.depth),"raw"in t&&i(1,o=t.raw),"text"in t&&i(3,l=t.text),"$$scope"in t&&i(4,s=t.$$scope)},t.$$.update=()=>{8&t.$$.dirty&&i(2,r=c.headerIds?c.headerPrefix+h(l):void 0)},[a,o,r,l,s,n]}function ci(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("p"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function pi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function ui(t){let e;const i=t[3].default,r=d(i,t,t[2],null);return{c(){r&&r.c()},m(t,i){r&&r.m(t,i),e=!0},p(t,[n]){r&&r.p&&(!e||4&n)&&u(r,i,t,t[2],e?p(i,t[2],n,null):f(t[2]),null)},i(t){e||(Q(r,t),e=!0)},o(t){J(r,t),e=!1},d(t){r&&r.d(t)}}}function fi(t,e,i){let{$$slots:r={},$$scope:n}=e,{text:s}=e,{raw:a}=e;return t.$$set=t=>{"text"in t&&i(0,s=t.text),"raw"in t&&i(1,a=t.raw),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function mi(e){let i,r;return{c(){i=w("img"),h(i.src,r=e[0])||$(i,"src",r),$(i,"title",e[1]),$(i,"alt",e[2])},m(t,e){y(t,i,e)},p(t,[e]){1&e&&!h(i.src,r=t[0])&&$(i,"src",r),2&e&&$(i,"title",t[1]),4&e&&$(i,"alt",t[2])},i:t,o:t,d(t){t&&b(i)}}}function gi(t,e,i){let{href:r=""}=e,{title:n}=e,{text:s=""}=e;return t.$$set=t=>{"href"in t&&i(0,r=t.href),"title"in t&&i(1,n=t.title),"text"in t&&i(2,s=t.text)},[r,n,s]}function _i(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("a"),n&&n.c(),$(e,"href",t[0]),$(e,"title",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[s]){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||1&s)&&$(e,"href",t[0]),(!i||2&s)&&$(e,"title",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function yi(t,e,i){let{$$slots:r={},$$scope:n}=e,{href:s=""}=e,{title:a}=e;return t.$$set=t=>{"href"in t&&i(0,s=t.href),"title"in t&&i(1,a=t.title),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function bi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("em"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function xi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function wi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("del"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function vi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Si(e){let i,r,n=e[0].replace(/`/g,"")+"";return{c(){i=w("code"),r=v(n)},m(t,e){y(t,i,e),_(i,r)},p(t,[e]){1&e&&n!==(n=t[0].replace(/`/g,"")+"")&&E(r,n)},i:t,o:t,d(t){t&&b(i)}}}function Ui(t,e,i){let{raw:r}=e;return t.$$set=t=>{"raw"in t&&i(0,r=t.raw)},[r]}function ki(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("strong"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function $i(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ei(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("table"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ti(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function zi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("thead"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ai(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Bi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("tbody"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ii(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ci(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("tr"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Pi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Fi(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("td"),n&&n.c(),$(e,"align",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"align",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Li(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("th"),n&&n.c(),$(e,"align",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"align",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ri(t){let e,i,r,n;const s=[Li,Fi],a=[];function o(t,e){return t[0]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Di(t,e,i){let{$$slots:r={},$$scope:n}=e,{header:s}=e,{align:a}=e;return t.$$set=t=>{"header"in t&&i(0,s=t.header),"align"in t&&i(1,a=t.align),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function Ni(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("ul"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,e){n&&n.p&&(!i||4&e)&&u(n,r,t,t[2],i?p(r,t[2],e,null):f(t[2]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Oi(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("ol"),n&&n.c(),$(e,"start",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"start",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Mi(t){let e,i,r,n;const s=[Oi,Ni],a=[];function o(t,e){return t[0]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Gi(t,e,i){let{$$slots:r={},$$scope:n}=e,{ordered:s}=e,{start:a}=e;return t.$$set=t=>{"ordered"in t&&i(0,s=t.ordered),"start"in t&&i(1,a=t.start),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function Hi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("li"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Vi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Yi(e){let i;return{c(){i=w("hr")},m(t,e){y(t,i,e)},p:t,i:t,o:t,d(t){t&&b(i)}}}function ji(e){let i,r;return{c(){i=new z(!1),r=U(),i.a=r},m(t,n){i.m(e[0],t,n),y(t,r,n)},p(t,[e]){1&e&&i.p(t[0])},i:t,o:t,d(t){t&&b(r),t&&i.d()}}}function qi(t,e,i){let{text:r}=e;return t.$$set=t=>{"text"in t&&i(0,r=t.text)},[r]}function Zi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("blockquote"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Wi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ki(e){let i,r,n;return{c(){i=w("pre"),r=w("code"),n=v(e[1]),$(i,"class",e[0])},m(t,e){y(t,i,e),_(i,r),_(r,n)},p(t,[e]){2&e&&E(n,t[1]),1&e&&$(i,"class",t[0])},i:t,o:t,d(t){t&&b(i)}}}function Xi(t,e,i){let{lang:r}=e,{text:n}=e;return t.$$set=t=>{"lang"in t&&i(0,r=t.lang),"text"in t&&i(1,n=t.text)},[r,n]}function Qi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("br"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(t,r),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ji(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}const tr={heading:class extends ht{constructor(t){super(),lt(this,t,di,hi,a,{depth:0,raw:1,text:3})}},paragraph:class extends ht{constructor(t){super(),lt(this,t,pi,ci,a,{})}},text:class extends ht{constructor(t){super(),lt(this,t,fi,ui,a,{text:0,raw:1})}},image:class extends ht{constructor(t){super(),lt(this,t,gi,mi,a,{href:0,title:1,text:2})}},link:class extends ht{constructor(t){super(),lt(this,t,yi,_i,a,{href:0,title:1})}},em:class extends ht{constructor(t){super(),lt(this,t,xi,bi,a,{})}},strong:class extends ht{constructor(t){super(),lt(this,t,$i,ki,a,{})}},codespan:class extends ht{constructor(t){super(),lt(this,t,Ui,Si,a,{raw:0})}},del:class extends ht{constructor(t){super(),lt(this,t,vi,wi,a,{})}},table:class extends ht{constructor(t){super(),lt(this,t,Ti,Ei,a,{})}},tablehead:class extends ht{constructor(t){super(),lt(this,t,Ai,zi,a,{})}},tablebody:class extends ht{constructor(t){super(),lt(this,t,Ii,Bi,a,{})}},tablerow:class extends ht{constructor(t){super(),lt(this,t,Pi,Ci,a,{})}},tablecell:class extends ht{constructor(t){super(),lt(this,t,Di,Ri,a,{header:0,align:1})}},list:class extends ht{constructor(t){super(),lt(this,t,Gi,Mi,a,{ordered:0,start:1})}},orderedlistitem:null,unorderedlistitem:null,listitem:class extends ht{constructor(t){super(),lt(this,t,Vi,Hi,a,{})}},hr:class extends ht{constructor(t){super(),lt(this,t,null,Yi,a,{})}},html:class extends ht{constructor(t){super(),lt(this,t,qi,ji,a,{text:0})}},blockquote:class extends ht{constructor(t){super(),lt(this,t,Wi,Zi,a,{})}},code:class extends ht{constructor(t){super(),lt(this,t,Xi,Ki,a,{lang:0,text:1})}},br:class extends ht{constructor(t){super(),lt(this,t,Ji,Qi,a,{})}}},er={baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,xhtml:!1};function ir(t){let e,i;return e=new ge({props:{tokens:t[0],renderers:t[1]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,[i]){const r={};1&i&&(r.tokens=t[0]),2&i&&(r.renderers=t[1]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function rr(t,e,i){let r,n,s,a,{source:o=[]}=e,{renderers:l={}}=e,{options:h={}}=e,{isInline:d=!1}=e;const c=P();let p,u,f;return F(ei,{slug:t=>n?n.slug(t):"",getOptions:()=>s}),C((()=>{i(7,f=!0)})),t.$$set=t=>{"source"in t&&i(2,o=t.source),"renderers"in t&&i(3,l=t.renderers),"options"in t&&i(4,h=t.options),"isInline"in t&&i(5,d=t.isInline)},t.$$.update=()=>{4&t.$$.dirty&&i(8,r=Array.isArray(o)),4&t.$$.dirty&&(n=o?new Qe:void 0),16&t.$$.dirty&&i(9,s={...er,...h}),869&t.$$.dirty&&(r?i(0,p=o):(i(6,u=new We(s)),i(0,p=d?u.inlineTokens(o):u.lex(o)),c("parsed",{tokens:p}))),8&t.$$.dirty&&i(1,a={...tr,...l}),385&t.$$.dirty&&f&&!r&&c("parsed",{tokens:p})},[p,a,o,l,h,d,u,f,r,s]}class nr extends ht{constructor(t){super(),lt(this,t,rr,ir,a,{source:2,renderers:3,options:4,isInline:5})}}function sr(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("a"),n&&n.c(),$(e,"target","_blank"),$(e,"rel","noopener noreferrer"),$(e,"href",t[0]),$(e,"title",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[s]){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||1&s)&&$(e,"href",t[0]),(!i||2&s)&&$(e,"title",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ar(t,e,i){let{$$slots:r={},$$scope:n}=e,{href:s=""}=e,{title:a}=e;return t.$$set=t=>{"href"in t&&i(0,s=t.href),"title"in t&&i(1,a=t.title),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}class or extends ht{constructor(t){super(),lt(this,t,ar,sr,a,{href:0,title:1})}}function lr(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function hr(e){let i,r;return i=new nr({props:{source:e[2],renderers:e[1]}}),{c(){nt(i.$$.fragment)},m(t,e){st(i,t,e),r=!0},p:t,i(t){r||(Q(i.$$.fragment,t),r=!0)},o(t){J(i.$$.fragment,t),r=!1},d(t){at(i,t)}}}function dr(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function cr(t){let e,i,r={ctx:t,current:null,token:null,hasCatch:!1,pending:dr,then:hr,catch:lr,value:2,blocks:[,,,]};return tt(t[0],r),{c(){e=w("div"),r.block.c(),$(e,"class","docs markdown-body svelte-bew0xw")},m(t,n){y(t,e,n),r.block.m(e,r.anchor=null),r.mount=()=>e,r.anchor=null,i=!0},p(e,[i]){et(r,t=e,i)},i(t){i||(Q(r.block),i=!0)},o(t){for(let t=0;t<3;t+=1){J(r.blocks[t])}i=!1},d(t){t&&b(e),r.block.d(),r.token=null,r=null}}}function pr(t){return[fetch("README.md").then((t=>t.text())),{link:or}]}class ur extends ht{constructor(t){super(),lt(this,t,pr,cr,a,{})}}function fr(e){let i,r,n,s,a,o;return i=new mt({}),n=new Pt({}),a=new ur({}),{c(){nt(i.$$.fragment),r=S(),nt(n.$$.fragment),s=S(),nt(a.$$.fragment)},m(t,e){st(i,t,e),y(t,r,e),st(n,t,e),y(t,s,e),st(a,t,e),o=!0},p:t,i(t){o||(Q(i.$$.fragment,t),Q(n.$$.fragment,t),Q(a.$$.fragment,t),o=!0)},o(t){J(i.$$.fragment,t),J(n.$$.fragment,t),J(a.$$.fragment,t),o=!1},d(t){at(i,t),t&&b(r),at(n,t),t&&b(s),at(a,t)}}}function mr(t){return F("npm",fetch("https://registry.npmjs.org/scrolly-video").then((t=>t.json()))),[]}return new class extends ht{constructor(t){super(),lt(this,t,mr,fr,a,{})}}({target:document.body})}(); +var docs=function(){"use strict";function t(){}function e(t,e){for(const i in e)t[i]=e[i];return t}function i(t){return t()}function r(){return Object.create(null)}function n(t){t.forEach(i)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let o,l;function h(t,e){return o||(o=document.createElement("a")),o.href=e,t===o.href}function d(t,e,i,r){if(t){const n=c(t,e,i,r);return t[0](n)}}function c(t,i,r,n){return t[1]&&n?e(r.ctx.slice(),t[1](n(i))):r.ctx}function p(t,e,i,r){if(t[2]&&r){const n=t[2](r(i));if(void 0===e.dirty)return n;if("object"==typeof n){const t=[],i=Math.max(e.dirty.length,n.length);for(let r=0;r32){const e=[],i=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,i,r)}function $(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function E(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function T(t,e){t.value=null==e?"":e}class z{constructor(t=!1){this.is_svg=!1,this.is_svg=t,this.e=this.n=null}c(t){this.h(t)}m(t,e,i=null){var r;this.e||(this.is_svg?this.e=(r=e.nodeName,document.createElementNS("http://www.w3.org/2000/svg",r)):this.e=w(e.nodeName),this.t=e,this.c(t)),this.i(i)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e{const n=t.$$.callbacks[e];if(n){const s=function(t,e,{bubbles:i=!1,cancelable:r=!1}={}){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,i,r,e),n}(e,i,{cancelable:r});return n.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}function F(t,e){return I().$$.context.set(t,e),e}function L(t){return I().$$.context.get(t)}const R=[],D=[],N=[],O=[],M=Promise.resolve();let G=!1;function H(t){N.push(t)}const V=new Set;let Y=0;function j(){if(0!==Y)return;const t=l;do{try{for(;Y{Z.delete(t),r&&(i&&t.d(1),r())})),t.o(e)}else r&&r()}function tt(t,e){const i=e.token={};function r(t,r,n,s){if(e.token!==i)return;e.resolved=s;let a=e.ctx;void 0!==n&&(a=a.slice(),a[n]=s);const o=t&&(e.current=t)(a);let l=!1;e.block&&(e.blocks?e.blocks.forEach(((t,i)=>{i!==r&&t&&(K(),J(t,1,1,(()=>{e.blocks[i]===t&&(e.blocks[i]=null)})),X())})):e.block.d(1),o.c(),Q(o,1),o.m(e.mount(),e.anchor),l=!0),e.block=o,e.blocks&&(e.blocks[r]=o),l&&j()}if(!(n=t)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then){if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}else{const i=I();if(t.then((t=>{B(i),r(e.then,1,e.value,t),B(null)}),(t=>{if(B(i),r(e.catch,2,e.error,t),B(null),!e.hasCatch)throw t})),e.current!==e.pending)return r(e.pending,0),!0}var n}function et(t,e,i){const r=e.slice(),{resolved:n}=t;t.current===t.then&&(r[t.value]=n),t.current===t.catch&&(r[t.error]=n),t.block.p(r,i)}function it(t,e){const i={},r={},n={$$scope:1};let s=t.length;for(;s--;){const a=t[s],o=e[s];if(o){for(const t in a)t in o||(r[t]=1);for(const t in o)n[t]||(i[t]=o[t],n[t]=1);t[s]=o}else for(const t in a)n[t]=1}for(const t in r)t in i||(i[t]=void 0);return i}function rt(t){return"object"==typeof t&&null!==t?t:{}}function nt(t){t&&t.c()}function st(t,e,r,a){const{fragment:o,after_update:l}=t.$$;o&&o.m(e,r),a||H((()=>{const e=t.$$.on_mount.map(i).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):n(e),t.$$.on_mount=[]})),l.forEach(H)}function at(t,e){const i=t.$$;null!==i.fragment&&(n(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])}function ot(t,e){-1===t.$$.dirty[0]&&(R.push(t),G||(G=!0,M.then(j)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const n=r.length?r[0]:i;return u.ctx&&o(u.ctx[t],u.ctx[t]=n)&&(!u.skip_bound&&u.bound[t]&&u.bound[t](n),f&&ot(e,t)),i})):[],u.update(),f=!0,n(u.before_update),u.fragment=!!a&&a(u.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);u.fragment&&u.fragment.l(t),t.forEach(b)}else u.fragment&&u.fragment.c();i.intro&&Q(e.$$.fragment),st(e,i.target,i.anchor,i.customElement),j()}B(p)}class ht{$destroy(){at(this,1),this.$destroy=t}$on(e,i){if(!s(i))return t;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(i),()=>{const t=r.indexOf(i);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function dt(e){return{c:t,m:t,p:t,d:t}}function ct(e){let i,r,n,s=e[1]+"";return{c(){i=w("pre"),r=v("version "),n=v(s),$(i,"class","svelte-1anaj0w")},m(t,e){y(t,i,e),_(i,r),_(i,n)},p:t,d(t){t&&b(i)}}}function pt(e){return{c:t,m:t,p:t,d:t}}function ut(e){let i,r,n,s,a,o,l,h,d,c={ctx:e,current:null,token:null,hasCatch:!1,pending:pt,then:ct,catch:dt,value:1};return tt(e[0],c),{c(){i=w("div"),c.block.c(),r=S(),n=w("h1"),n.textContent="ScrollyVideo.js",s=S(),a=w("p"),a.textContent="Responsive scrollable videos without obscure video encoding requirements. Compatible with React, Svelte, Vue, and plain HTML.",o=S(),l=w("a"),l.textContent="npm",h=S(),d=w("a"),d.textContent="github",$(n,"class","svelte-1anaj0w"),$(a,"class","svelte-1anaj0w"),$(l,"class","npm svelte-1anaj0w"),$(l,"target","_blank"),$(l,"rel","noopener noreferrer"),$(l,"href","https://www.npmjs.com/package/scrolly-video"),$(d,"class","github svelte-1anaj0w"),$(d,"target","_blank"),$(d,"rel","noopener noreferrer"),$(d,"href","https://github.com/dkaoster/scrolly-video"),$(i,"class","intro svelte-1anaj0w")},m(t,e){y(t,i,e),c.block.m(i,c.anchor=null),c.mount=()=>i,c.anchor=r,_(i,r),_(i,n),_(i,s),_(i,a),_(i,o),_(i,l),_(i,h),_(i,d)},p(t,[i]){et(c,e=t,i)},i:t,o:t,d(t){t&&b(i),c.block.d(),c.token=null,c=null}}}function ft(t){return[L("npm").then((t=>t["dist-tags"].latest))]}class mt extends ht{constructor(t){super(),lt(this,t,ft,ut,a,{})}}var gt,_t,yt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},bt={exports:{}};gt=bt,_t=bt.exports,function(t,e){var i="function",r="undefined",n="object",s="string",a="model",o="name",l="type",h="vendor",d="version",c="architecture",p="console",u="mobile",f="tablet",m="smarttv",g="wearable",_="embedded",y="Amazon",b="Apple",x="ASUS",w="BlackBerry",v="Browser",S="Chrome",U="Firefox",k="Google",$="Huawei",E="LG",T="Microsoft",z="Motorola",A="Opera",B="Samsung",I="Sharp",C="Sony",P="Xiaomi",F="Zebra",L="Facebook",R=function(t){for(var e={},i=0;i0?2===l.length?typeof l[1]==i?this[l[0]]=l[1].call(this,d):this[l[0]]=l[1]:3===l.length?typeof l[1]!==i||l[1].exec&&l[1].test?this[l[0]]=d?d.replace(l[1],l[2]):e:this[l[0]]=d?l[1].call(this,d,l[2]):e:4===l.length&&(this[l[0]]=d?l[3].call(this,d.replace(l[1],l[2])):e):this[l]=d||e;c+=2}},G=function(t,i){for(var r in i)if(typeof i[r]===n&&i[r].length>0){for(var s=0;s350?O(t,350):t,this},this.setUA(u),this};Y.VERSION="1.0.33",Y.BROWSER=R([o,d,"major"]),Y.CPU=R([c]),Y.DEVICE=R([a,h,l,p,u,m,f,g,_]),Y.ENGINE=Y.OS=R([o,d]),gt.exports&&(_t=gt.exports=Y),_t.UAParser=Y;var j=typeof t!==r&&(t.jQuery||t.Zepto);if(j&&!j.ua){var q=new Y;j.ua=q.getResult(),j.ua.get=function(){return q.getUA()},j.ua.set=function(t){q.setUA(t);var e=q.getResult();for(var i in e)j.ua[i]=e[i]}}}("object"==typeof window?window:yt);var xt=bt.exports,wt={};!function(t){var e,i,r,n=(e=new Date,i=4,r={setLogLevel:function(t){i=t==this.debug?1:t==this.info?2:t==this.warn?3:(this.error,4)},debug:function(t,r){void 0===console.debug&&(console.debug=console.log),1>=i&&console.debug("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},log:function(t,e){this.debug(t.msg)},info:function(t,r){2>=i&&console.info("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},warn:function(t,r){3>=i&&console.warn("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)},error:function(t,r){4>=i&&console.error("["+n.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)}},r);n.getDurationString=function(t,e){var i;function r(t,e){for(var i=(""+t).split(".");i[0].length0){for(var i="",r=0;r0&&(i+=","),i+="["+n.getDurationString(t.start(r))+","+n.getDurationString(t.end(r))+"]";return i}return"(empty)"},t.Log=n;var s=function(t){if(!(t instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=t,this.dataview=new DataView(t),this.position=0};s.prototype.getPosition=function(){return this.position},s.prototype.getEndPosition=function(){return this.buffer.byteLength},s.prototype.getLength=function(){return this.buffer.byteLength},s.prototype.seek=function(t){var e=Math.max(0,Math.min(this.buffer.byteLength,t));return this.position=isNaN(e)||!isFinite(e)?0:e,!0},s.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},s.prototype.readAnyInt=function(t,e){var i=0;if(this.position+t<=this.buffer.byteLength){switch(t){case 1:i=e?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=e?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(e)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=e?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(e)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+t}return this.position+=t,i}throw"Not enough bytes in buffer"},s.prototype.readUint8=function(){return this.readAnyInt(1,!1)},s.prototype.readUint16=function(){return this.readAnyInt(2,!1)},s.prototype.readUint24=function(){return this.readAnyInt(3,!1)},s.prototype.readUint32=function(){return this.readAnyInt(4,!1)},s.prototype.readUint64=function(){return this.readAnyInt(8,!1)},s.prototype.readString=function(t){if(this.position+t<=this.buffer.byteLength){for(var e="",i=0;ithis._byteLength&&(this._byteLength=e);else{for(i<1&&(i=1);e>i;)i*=2;var r=new ArrayBuffer(i),n=new Uint8Array(this._buffer);new Uint8Array(r,0,n.length).set(n),this.buffer=r,this._byteLength=e}}},a.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var t=new ArrayBuffer(this._byteLength),e=new Uint8Array(t),i=new Uint8Array(this._buffer,0,e.length);e.set(i),this.buffer=t}},a.BIG_ENDIAN=!1,a.LITTLE_ENDIAN=!0,a.prototype._byteLength=0,Object.defineProperty(a.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(a.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(t){this._buffer=t,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(a.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(t){this._byteOffset=t,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(a.prototype,"dataView",{get:function(){return this._dataView},set:function(t){this._byteOffset=t.byteOffset,this._buffer=t.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+t.byteLength}}),a.prototype.seek=function(t){var e=Math.max(0,Math.min(this.byteLength,t));this.position=isNaN(e)||!isFinite(e)?0:e},a.prototype.isEof=function(){return this.position>=this._byteLength},a.prototype.mapUint8Array=function(t){this._realloc(1*t);var e=new Uint8Array(this._buffer,this.byteOffset+this.position,t);return this.position+=1*t,e},a.prototype.readInt32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Int32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt16Array=function(t,e){t=null==t?this.byteLength-this.position/2:t;var i=new Int16Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt8Array=function(t){t=null==t?this.byteLength-this.position:t;var e=new Int8Array(t);return a.memcpy(e.buffer,0,this.buffer,this.byteOffset+this.position,t*e.BYTES_PER_ELEMENT),this.position+=e.byteLength,e},a.prototype.readUint32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Uint32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readUint16Array=function(t,e){t=null==t?this.byteLength-this.position/2:t;var i=new Uint16Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readUint8Array=function(t){t=null==t?this.byteLength-this.position:t;var e=new Uint8Array(t);return a.memcpy(e.buffer,0,this.buffer,this.byteOffset+this.position,t*e.BYTES_PER_ELEMENT),this.position+=e.byteLength,e},a.prototype.readFloat64Array=function(t,e){t=null==t?this.byteLength-this.position/8:t;var i=new Float64Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readFloat32Array=function(t,e){t=null==t?this.byteLength-this.position/4:t;var i=new Float32Array(t);return a.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,t*i.BYTES_PER_ELEMENT),a.arrayToNative(i,null==e?this.endianness:e),this.position+=i.byteLength,i},a.prototype.readInt32=function(t){var e=this._dataView.getInt32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readInt16=function(t){var e=this._dataView.getInt16(this.position,null==t?this.endianness:t);return this.position+=2,e},a.prototype.readInt8=function(){var t=this._dataView.getInt8(this.position);return this.position+=1,t},a.prototype.readUint32=function(t){var e=this._dataView.getUint32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readUint16=function(t){var e=this._dataView.getUint16(this.position,null==t?this.endianness:t);return this.position+=2,e},a.prototype.readUint8=function(){var t=this._dataView.getUint8(this.position);return this.position+=1,t},a.prototype.readFloat32=function(t){var e=this._dataView.getFloat32(this.position,null==t?this.endianness:t);return this.position+=4,e},a.prototype.readFloat64=function(t){var e=this._dataView.getFloat64(this.position,null==t?this.endianness:t);return this.position+=8,e},a.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,a.memcpy=function(t,e,i,r,n){var s=new Uint8Array(t,e,n),a=new Uint8Array(i,r,n);s.set(a)},a.arrayToNative=function(t,e){return e==this.endianness?t:this.flipArrayEndianness(t)},a.nativeToEndian=function(t,e){return this.endianness==e?t:this.flipArrayEndianness(t)},a.flipArrayEndianness=function(t){for(var e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=0;in;r--,n++){var s=e[n];e[n]=e[r],e[r]=s}return t},a.prototype.failurePosition=0,String.fromCharCodeUint8=function(t){for(var e=[],i=0;i>16),this.writeUint8((65280&t)>>8),this.writeUint8(255&t)},a.prototype.adjustUint32=function(t,e){var i=this.position;this.seek(t),this.writeUint32(e),this.seek(i)},a.prototype.mapInt32Array=function(t,e){this._realloc(4*t);var i=new Int32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i},a.prototype.mapInt16Array=function(t,e){this._realloc(2*t);var i=new Int16Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=2*t,i},a.prototype.mapInt8Array=function(t){this._realloc(1*t);var e=new Int8Array(this._buffer,this.byteOffset+this.position,t);return this.position+=1*t,e},a.prototype.mapUint32Array=function(t,e){this._realloc(4*t);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i},a.prototype.mapUint16Array=function(t,e){this._realloc(2*t);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=2*t,i},a.prototype.mapFloat64Array=function(t,e){this._realloc(8*t);var i=new Float64Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=8*t,i},a.prototype.mapFloat32Array=function(t,e){this._realloc(4*t);var i=new Float32Array(this._buffer,this.byteOffset+this.position,t);return a.arrayToNative(i,null==e?this.endianness:e),this.position+=4*t,i};var l=function(t){this.buffers=[],this.bufferIndex=-1,t&&(this.insertBuffer(t),this.bufferIndex=0)};(l.prototype=new a(new ArrayBuffer,0,a.BIG_ENDIAN)).initialized=function(){var t;return this.bufferIndex>-1||(this.buffers.length>0?0===(t=this.buffers[0]).fileStart?(this.buffer=t,this.bufferIndex=0,n.debug("MultiBufferStream","Stream ready for parsing"),!0):(n.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(n.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(t,e){n.debug("ArrayBuffer","Trying to create a new buffer of size: "+(t.byteLength+e.byteLength));var i=new Uint8Array(t.byteLength+e.byteLength);return i.set(new Uint8Array(t),0),i.set(new Uint8Array(e),t.byteLength),i.buffer},l.prototype.reduceBuffer=function(t,e,i){var r;return(r=new Uint8Array(i)).set(new Uint8Array(t,e,i)),r.buffer.fileStart=t.fileStart+e,r.buffer.usedBytes=0,r.buffer},l.prototype.insertBuffer=function(t){for(var e=!0,i=0;ir.byteLength){this.buffers.splice(i,1),i--;continue}n.warn("MultiBufferStream","Buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+") already appended, ignoring")}else t.fileStart+t.byteLength<=r.fileStart||(t=this.reduceBuffer(t,0,r.fileStart-t.fileStart)),n.debug("MultiBufferStream","Appending new buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+")"),this.buffers.splice(i,0,t),0===i&&(this.buffer=t);e=!1;break}if(t.fileStart0)){e=!1;break}t=this.reduceBuffer(t,s,a)}}e&&(n.debug("MultiBufferStream","Appending new buffer (fileStart: "+t.fileStart+" - Length: "+t.byteLength+")"),this.buffers.push(t),0===i&&(this.buffer=t))},l.prototype.logBufferLevel=function(t){var e,i,r,s,a,o=[],l="";for(r=0,s=0,e=0;e0&&(l+=a.end-1+"]");var h=t?n.info:n.debug;0===this.buffers.length?h("MultiBufferStream","No more buffer in memory"):h("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+r+"/"+s+" bytes), continuous ranges: "+l)},l.prototype.cleanBuffers=function(){var t,e;for(t=0;t"+this.buffer.byteLength+")"),!0}return!1}return!1},l.prototype.findPosition=function(t,e,i){var r,s=null,a=-1;for(r=!0===t?0:this.bufferIndex;r=e?(n.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},l.prototype.findEndContiguousBuf=function(t){var e,i,r,n=void 0!==t?t:this.bufferIndex;if(i=this.buffers[n],this.buffers.length>n+1)for(e=n+1;e>3;return 31===r&&i.data.length>=2&&(r=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),r}return null},i.DecoderConfigDescriptor=function(t){i.Descriptor.call(this,4,t)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(t){this.oti=t.readUint8(),this.streamType=t.readUint8(),this.bufferSize=t.readUint24(),this.maxBitrate=t.readUint32(),this.avgBitrate=t.readUint32(),this.size-=13,this.parseRemainingDescriptors(t)},i.DecoderSpecificInfo=function(t){i.Descriptor.call(this,5,t)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(t){i.Descriptor.call(this,6,t)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=h;var d={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){d.FullBox.prototype=new d.Box,d.ContainerBox.prototype=new d.Box,d.SampleEntry.prototype=new d.Box,d.TrackGroupTypeBox.prototype=new d.FullBox,d.BASIC_BOXES.forEach((function(t){d.createBoxCtor(t)})),d.FULL_BOXES.forEach((function(t){d.createFullBoxCtor(t)})),d.CONTAINER_BOXES.forEach((function(t){d.createContainerBoxCtor(t[0],null,t[1])}))},Box:function(t,e,i){this.type=t,this.size=e,this.uuid=i},FullBox:function(t,e,i){d.Box.call(this,t,e,i),this.flags=0,this.version=0},ContainerBox:function(t,e,i){d.Box.call(this,t,e,i),this.boxes=[]},SampleEntry:function(t,e,i,r){d.ContainerBox.call(this,t,e),this.hdr_size=i,this.start=r},SampleGroupEntry:function(t){this.grouping_type=t},TrackGroupTypeBox:function(t,e){d.FullBox.call(this,t,e)},createBoxCtor:function(t,e){d.boxCodes.push(t),d[t+"Box"]=function(e){d.Box.call(this,t,e)},d[t+"Box"].prototype=new d.Box,e&&(d[t+"Box"].prototype.parse=e)},createFullBoxCtor:function(t,e){d[t+"Box"]=function(e){d.FullBox.call(this,t,e)},d[t+"Box"].prototype=new d.FullBox,d[t+"Box"].prototype.parse=function(t){this.parseFullHeader(t),e&&e.call(this,t)}},addSubBoxArrays:function(t){if(t){this.subBoxNames=t;for(var e=t.length,i=0;ii?(n.error("BoxParser","Box of type '"+c+"' has a size "+h+" greater than its container size "+i),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:h,hdr_size:l,start:o}):o+h>t.getEndPosition()?(t.seek(o),n.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:d.ERR_NOT_ENOUGH_DATA,type:c,size:h,hdr_size:l,start:o}):e?{code:d.OK,type:c,size:h,hdr_size:l,start:o}:(d[c+"Box"]?r=new d[c+"Box"](h):"uuid"!==c?(n.warn("BoxParser","Unknown box type: '"+c+"'"),(r=new d.Box(c,h)).has_unparsed_data=!0):d.UUIDBoxes[a]?r=new d.UUIDBoxes[a](h):(n.warn("BoxParser","Unknown uuid type: '"+a+"'"),(r=new d.Box(c,h)).uuid=a,r.has_unparsed_data=!0),r.hdr_size=l,r.start=o,r.write===d.Box.prototype.write&&"mdat"!==r.type&&(n.info("BoxParser","'"+p+"' box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(t)),r.parse(t),(s=t.getPosition()-(r.start+r.size))<0?(n.warn("BoxParser","Parsing of box '"+p+"' did not read the entire indicated box data size (missing "+-s+" bytes), seeking forward"),t.seek(r.start+r.size)):s>0&&(n.error("BoxParser","Parsing of box '"+p+"' read "+s+" more bytes than the indicated box data size, seeking backwards"),t.seek(r.start+r.size)),{code:d.OK,box:r,size:r.size})},d.Box.prototype.parse=function(t){"mdat"!=this.type?this.data=t.readUint8Array(this.size-this.hdr_size):0===this.size?t.seek(t.getEndPosition()):t.seek(this.start+this.size)},d.Box.prototype.parseDataAndRewind=function(t){this.data=t.readUint8Array(this.size-this.hdr_size),t.position-=this.size-this.hdr_size},d.FullBox.prototype.parseDataAndRewind=function(t){this.parseFullHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,t.position-=this.size-this.hdr_size},d.FullBox.prototype.parseFullHeader=function(t){this.version=t.readUint8(),this.flags=t.readUint24(),this.hdr_size+=4},d.FullBox.prototype.parse=function(t){this.parseFullHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size)},d.ContainerBox.prototype.parse=function(t){for(var e,i;t.getPosition()>10&31,e[1]=this.language>>5&31,e[2]=31&this.language,this.languageString=String.fromCharCode(e[0]+96,e[1]+96,e[2]+96)},d.SAMPLE_ENTRY_TYPE_VISUAL="Visual",d.SAMPLE_ENTRY_TYPE_AUDIO="Audio",d.SAMPLE_ENTRY_TYPE_HINT="Hint",d.SAMPLE_ENTRY_TYPE_METADATA="Metadata",d.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",d.SAMPLE_ENTRY_TYPE_SYSTEM="System",d.SAMPLE_ENTRY_TYPE_TEXT="Text",d.SampleEntry.prototype.parseHeader=function(t){t.readUint8Array(6),this.data_reference_index=t.readUint16(),this.hdr_size+=8},d.SampleEntry.prototype.parse=function(t){this.parseHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size)},d.SampleEntry.prototype.parseDataAndRewind=function(t){this.parseHeader(t),this.data=t.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,t.position-=this.size-this.hdr_size},d.SampleEntry.prototype.parseFooter=function(t){d.ContainerBox.prototype.parse.call(this,t)},d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_HINT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,(function(t){var e;this.parseHeader(t),t.readUint16(),t.readUint16(),t.readUint32Array(3),this.width=t.readUint16(),this.height=t.readUint16(),this.horizresolution=t.readUint32(),this.vertresolution=t.readUint32(),t.readUint32(),this.frame_count=t.readUint16(),e=Math.min(31,t.readUint8()),this.compressorname=t.readString(e),e<31&&t.readString(31-e),this.depth=t.readUint16(),t.readUint16(),this.parseFooter(t)})),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,(function(t){this.parseHeader(t),t.readUint32Array(2),this.channel_count=t.readUint16(),this.samplesize=t.readUint16(),t.readUint16(),t.readUint16(),this.samplerate=t.readUint32()/65536,this.parseFooter(t)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT,"enct"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"encm"),d.createBoxCtor("a1lx",(function(t){var e=16*(1+(1&(1&t.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==e?t.readUint16():t.readUint32()})),d.createBoxCtor("a1op",(function(t){this.op_index=t.readUint8()})),d.createFullBoxCtor("auxC",(function(t){this.aux_type=t.readCString();var e=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=t.readUint8Array(e)})),d.createBoxCtor("av1C",(function(t){var e=t.readUint8();if(e>>7&!1)n.error("av1C marker problem");else if(this.version=127&e,1===this.version)if(e=t.readUint8(),this.seq_profile=e>>5&7,this.seq_level_idx_0=31&e,e=t.readUint8(),this.seq_tier_0=e>>7&1,this.high_bitdepth=e>>6&1,this.twelve_bit=e>>5&1,this.monochrome=e>>4&1,this.chroma_subsampling_x=e>>3&1,this.chroma_subsampling_y=e>>2&1,this.chroma_sample_position=3&e,e=t.readUint8(),this.reserved_1=e>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=e>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&e;else if(this.reserved_2=15&e,0!==this.reserved_2)return void n.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=t.readUint8Array(i)}else n.error("av1C reserved_1 parsing problem");else n.error("av1C version "+this.version+" not supported")})),d.createBoxCtor("avcC",(function(t){var e,i;for(this.configurationVersion=t.readUint8(),this.AVCProfileIndication=t.readUint8(),this.profile_compatibility=t.readUint8(),this.AVCLevelIndication=t.readUint8(),this.lengthSizeMinusOne=3&t.readUint8(),this.nb_SPS_nalus=31&t.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],e=0;e0&&(this.ext=t.readUint8Array(i))})),d.createBoxCtor("btrt",(function(t){this.bufferSizeDB=t.readUint32(),this.maxBitrate=t.readUint32(),this.avgBitrate=t.readUint32()})),d.createBoxCtor("clap",(function(t){this.cleanApertureWidthN=t.readUint32(),this.cleanApertureWidthD=t.readUint32(),this.cleanApertureHeightN=t.readUint32(),this.cleanApertureHeightD=t.readUint32(),this.horizOffN=t.readUint32(),this.horizOffD=t.readUint32(),this.vertOffN=t.readUint32(),this.vertOffD=t.readUint32()})),d.createBoxCtor("clli",(function(t){this.max_content_light_level=t.readUint16(),this.max_pic_average_light_level=t.readUint16()})),d.createFullBoxCtor("co64",(function(t){var e,i;if(e=t.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=t.readUint8Array(this.size-4))})),d.createFullBoxCtor("cprt",(function(t){this.parseLanguage(t),this.notice=t.readCString()})),d.createFullBoxCtor("cslg",(function(t){0===this.version&&(this.compositionToDTSShift=t.readInt32(),this.leastDecodeToDisplayDelta=t.readInt32(),this.greatestDecodeToDisplayDelta=t.readInt32(),this.compositionStartTime=t.readInt32(),this.compositionEndTime=t.readInt32())})),d.createFullBoxCtor("ctts",(function(t){var e,i;if(e=t.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=e>>1&31,this.bsmod=(1&e)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|r>>5&7})),d.createBoxCtor("dec3",(function(t){var e=t.readUint16();this.data_rate=e>>3,this.num_ind_sub=7&e,this.ind_subs=[];for(var i=0;i>6,r.bsid=n>>1&31,r.bsmod=(1&n)<<4|s>>4&15,r.acmod=s>>1&7,r.lfeon=1&s,r.num_dep_sub=a>>1&15,r.num_dep_sub>0&&(r.chan_loc=(1&a)<<8|t.readUint8())}})),d.createFullBoxCtor("dfLa",(function(t){var e=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(t);;){var r=t.readUint8(),n=Math.min(127&r,i.length-1);if(n?t.readUint8Array(t.readUint24()):(t.readUint8Array(13),this.samplerate=t.readUint32()>>12,t.readUint8Array(20)),e.push(i[n]),128&r)break}this.numMetadataBlocks=e.length+" ("+e.join(", ")+")"})),d.createBoxCtor("dimm",(function(t){this.bytessent=t.readUint64()})),d.createBoxCtor("dmax",(function(t){this.time=t.readUint32()})),d.createBoxCtor("dmed",(function(t){this.bytessent=t.readUint64()})),d.createFullBoxCtor("dref",(function(t){var e,i;this.entries=[];for(var r=t.readUint32(),n=0;n=4;)this.compatible_brands[i]=t.readString(4),e-=4,i++})),d.createFullBoxCtor("hdlr",(function(t){0===this.version&&(t.readUint32(),this.handler=t.readString(4),t.readUint32Array(3),this.name=t.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),d.createBoxCtor("hvcC",(function(t){var e,i,r,n;this.configurationVersion=t.readUint8(),n=t.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=t.readUint32(),this.general_constraint_indicator=t.readUint8Array(6),this.general_level_idc=t.readUint8(),this.min_spatial_segmentation_idc=4095&t.readUint16(),this.parallelismType=3&t.readUint8(),this.chroma_format_idc=3&t.readUint8(),this.bit_depth_luma_minus8=7&t.readUint8(),this.bit_depth_chroma_minus8=7&t.readUint8(),this.avgFrameRate=t.readUint16(),n=t.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=t.readUint8();for(e=0;e>7,a.nalu_type=63&n;var o=t.readUint16();for(i=0;i>4&15,this.length_size=15&e,e=t.readUint8(),this.base_offset_size=e>>4&15,1===this.version||2===this.version?this.index_size=15&e:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=t.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=t.readUint32()}for(var r=0;r>7,this.axis=1&e})),d.createFullBoxCtor("infe",(function(t){if(0!==this.version&&1!==this.version||(this.item_ID=t.readUint16(),this.item_protection_index=t.readUint16(),this.item_name=t.readCString(),this.content_type=t.readCString(),this.content_encoding=t.readCString()),1===this.version)return this.extension_type=t.readString(4),n.warn("BoxParser","Cannot parse extension type"),void t.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=t.readUint16():3===this.version&&(this.item_ID=t.readUint32()),this.item_protection_index=t.readUint16(),this.item_type=t.readString(4),this.item_name=t.readCString(),"mime"===this.item_type?(this.content_type=t.readCString(),this.content_encoding=t.readCString()):"uri "===this.item_type&&(this.item_uri_type=t.readCString()))})),d.createFullBoxCtor("ipma",(function(t){var e,i;for(entry_count=t.readUint32(),this.associations=[],e=0;e>7==1,1&this.flags?a.property_index=(127&s)<<8|t.readUint8():a.property_index=127&s}}})),d.createFullBoxCtor("iref",(function(t){var e,i;for(this.references=[];t.getPosition()>7,r.assignment_type=127&s,r.assignment_type){case 0:r.grouping_type=t.readString(4);break;case 1:r.grouping_type=t.readString(4),r.grouping_type_parameter=t.readUint32();break;case 2:case 3:break;case 4:r.sub_track_id=t.readUint32();break;default:n.warn("BoxParser","Unknown leva assignement type")}}})),d.createBoxCtor("lsel",(function(t){this.layer_id=t.readUint16()})),d.createBoxCtor("maxr",(function(t){this.period=t.readUint32(),this.bytes=t.readUint32()})),d.createBoxCtor("mdcv",(function(t){this.display_primaries=[],this.display_primaries[0]={},this.display_primaries[0].x=t.readUint16(),this.display_primaries[0].y=t.readUint16(),this.display_primaries[1]={},this.display_primaries[1].x=t.readUint16(),this.display_primaries[1].y=t.readUint16(),this.display_primaries[2]={},this.display_primaries[2].x=t.readUint16(),this.display_primaries[2].y=t.readUint16(),this.white_point={},this.white_point.x=t.readUint16(),this.white_point.y=t.readUint16(),this.max_display_mastering_luminance=t.readUint32(),this.min_display_mastering_luminance=t.readUint32()})),d.createFullBoxCtor("mdhd",(function(t){1==this.version?(this.creation_time=t.readUint64(),this.modification_time=t.readUint64(),this.timescale=t.readUint32(),this.duration=t.readUint64()):(this.creation_time=t.readUint32(),this.modification_time=t.readUint32(),this.timescale=t.readUint32(),this.duration=t.readUint32()),this.parseLanguage(t),t.readUint16()})),d.createFullBoxCtor("mehd",(function(t){1&this.flags&&(n.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=t.readUint64():this.fragment_duration=t.readUint32()})),d.createFullBoxCtor("meta",(function(t){this.boxes=[],d.ContainerBox.prototype.parse.call(this,t)})),d.createFullBoxCtor("mfhd",(function(t){this.sequence_number=t.readUint32()})),d.createFullBoxCtor("mfro",(function(t){this._size=t.readUint32()})),d.createFullBoxCtor("mvhd",(function(t){1==this.version?(this.creation_time=t.readUint64(),this.modification_time=t.readUint64(),this.timescale=t.readUint32(),this.duration=t.readUint64()):(this.creation_time=t.readUint32(),this.modification_time=t.readUint32(),this.timescale=t.readUint32(),this.duration=t.readUint32()),this.rate=t.readUint32(),this.volume=t.readUint16()>>8,t.readUint16(),t.readUint32Array(2),this.matrix=t.readUint32Array(9),t.readUint32Array(6),this.next_track_id=t.readUint32()})),d.createBoxCtor("npck",(function(t){this.packetssent=t.readUint32()})),d.createBoxCtor("nump",(function(t){this.packetssent=t.readUint64()})),d.createFullBoxCtor("padb",(function(t){var e=t.readUint32();this.padbits=[];for(var i=0;i0){var e=t.readUint32();this.kid=[];for(var i=0;i0&&(this.data=t.readUint8Array(r))})),d.createFullBoxCtor("clef",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createFullBoxCtor("enof",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createFullBoxCtor("prof",(function(t){this.width=t.readUint32(),this.height=t.readUint32()})),d.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),d.createBoxCtor("rtp ",(function(t){this.descriptionformat=t.readString(4),this.sdptext=t.readString(this.size-this.hdr_size-4)})),d.createFullBoxCtor("saio",(function(t){1&this.flags&&(this.aux_info_type=t.readUint32(),this.aux_info_type_parameter=t.readUint32());var e=t.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=e>>6&1,this.durationFlag&&(this.duration=t.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=t.readUint8(),this.avgBitRate=t.readUint16(),this.avgFrameRate=t.readUint16()),this.dependency=[];for(var i=t.readUint8(),r=0;r>7,this.num_leading_samples=127&e})),d.createSampleGroupCtor("rash",(function(t){if(this.operation_point_count=t.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)n.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=t.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=t.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var e=0;e>4,this.skip_byte_block=15&e,this.isProtected=t.readUint8(),this.Per_Sample_IV_Size=t.readUint8(),this.KID=d.parseHex16(t),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=t.readUint8(),this.constant_IV=t.readUint8Array(this.constant_IV_size))})),d.createSampleGroupCtor("stsa",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("sync",(function(t){var e=t.readUint8();this.NAL_unit_type=63&e})),d.createSampleGroupCtor("tele",(function(t){var e=t.readUint8();this.level_independently_decodable=e>>7})),d.createSampleGroupCtor("tsas",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("tscl",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("vipr",(function(t){n.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createFullBoxCtor("sbgp",(function(t){this.grouping_type=t.readString(4),1===this.version?this.grouping_type_parameter=t.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var e=t.readUint32(),i=0;i>6,this.sample_depends_on[r]=e>>4&3,this.sample_is_depended_on[r]=e>>2&3,this.sample_has_redundancy[r]=3&e})),d.createFullBoxCtor("senc"),d.createFullBoxCtor("sgpd",(function(t){this.grouping_type=t.readString(4),n.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=t.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=t.readUint32()),this.entries=[];for(var e=t.readUint32(),i=0;i>31&1,r.referenced_size=2147483647&n,r.subsegment_duration=t.readUint32(),n=t.readUint32(),r.starts_with_SAP=n>>31&1,r.SAP_type=n>>28&7,r.SAP_delta_time=268435455&n}})),d.SingleItemTypeReferenceBox=function(t,e,i,r){d.Box.call(this,t,e),this.hdr_size=i,this.start=r},d.SingleItemTypeReferenceBox.prototype=new d.Box,d.SingleItemTypeReferenceBox.prototype.parse=function(t){this.from_item_ID=t.readUint16();var e=t.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[e+1]=15&r}else if(8===this.field_size)for(e=0;e0)for(i=0;i>4&15,this.default_skip_byte_block=15&e}this.default_isProtected=t.readUint8(),this.default_Per_Sample_IV_Size=t.readUint8(),this.default_KID=d.parseHex16(t),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=t.readUint8(),this.default_constant_IV=t.readUint8Array(this.default_constant_IV_size))})),d.createFullBoxCtor("tfdt",(function(t){1==this.version?this.baseMediaDecodeTime=t.readUint64():this.baseMediaDecodeTime=t.readUint32()})),d.createFullBoxCtor("tfhd",(function(t){var e=0;this.track_id=t.readUint32(),this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=t.readUint64(),e+=8):this.base_data_offset=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=t.readUint32(),e+=4):this.default_sample_description_index=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=t.readUint32(),e+=4):this.default_sample_duration=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=t.readUint32(),e+=4):this.default_sample_size=0,this.size-this.hdr_size>e&&this.flags&d.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=t.readUint32(),e+=4):this.default_sample_flags=0})),d.createFullBoxCtor("tfra",(function(t){this.track_ID=t.readUint32(),t.readUint24();var e=t.readUint8();this.length_size_of_traf_num=e>>4&3,this.length_size_of_trun_num=e>>2&3,this.length_size_of_sample_num=3&e,this.entries=[];for(var i=t.readUint32(),r=0;r>8,t.readUint16(),this.matrix=t.readInt32Array(9),this.width=t.readUint32(),this.height=t.readUint32()})),d.createBoxCtor("tmax",(function(t){this.time=t.readUint32()})),d.createBoxCtor("tmin",(function(t){this.time=t.readUint32()})),d.createBoxCtor("totl",(function(t){this.bytessent=t.readUint32()})),d.createBoxCtor("tpay",(function(t){this.bytessent=t.readUint32()})),d.createBoxCtor("tpyl",(function(t){this.bytessent=t.readUint64()})),d.TrackGroupTypeBox.prototype.parse=function(t){this.parseFullHeader(t),this.track_group_id=t.readUint32()},d.createTrackGroupCtor("msrc"),d.TrackReferenceTypeBox=function(t,e,i,r){d.Box.call(this,t,e),this.hdr_size=i,this.start=r},d.TrackReferenceTypeBox.prototype=new d.Box,d.TrackReferenceTypeBox.prototype.parse=function(t){this.track_ids=t.readUint32Array((this.size-this.hdr_size)/4)},d.trefBox.prototype.parse=function(t){for(var e,i;t.getPosition()e&&this.flags&d.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=t.readInt32(),e+=4):this.data_offset=0,this.size-this.hdr_size>e&&this.flags&d.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=t.readUint32(),e+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>e)for(var i=0;i0&&(this.location=t.readCString())})),d.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(t){this.LiveServerManifest=t.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),d.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(t){this.system_id=d.parseHex16(t);var e=t.readUint32();e>0&&(this.data=t.readUint8Array(e))})),d.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),d.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(t){this.default_AlgorithmID=t.readUint24(),this.default_IV_size=t.readUint8(),this.default_KID=d.parseHex16(t)})),d.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(t){this.fragment_count=t.readUint8(),this.entries=[];for(var e=0;e>4,this.chromaSubsampling=e>>1&7,this.videoFullRangeFlag=1&e,this.colourPrimaries=t.readUint8(),this.transferCharacteristics=t.readUint8(),this.matrixCoefficients=t.readUint8(),this.codecIntializationDataSize=t.readUint16(),this.codecIntializationData=t.readUint8Array(this.codecIntializationDataSize)):(this.profile=t.readUint8(),this.level=t.readUint8(),e=t.readUint8(),this.bitDepth=e>>4&15,this.colorSpace=15&e,e=t.readUint8(),this.chromaSubsampling=e>>4&15,this.transferFunction=e>>1&7,this.videoFullRangeFlag=1&e,this.codecIntializationDataSize=t.readUint16(),this.codecIntializationData=t.readUint8Array(this.codecIntializationDataSize))})),d.createBoxCtor("vttC",(function(t){this.text=t.readString(this.size-this.hdr_size)})),d.SampleEntry.prototype.isVideo=function(){return!1},d.SampleEntry.prototype.isAudio=function(){return!1},d.SampleEntry.prototype.isSubtitle=function(){return!1},d.SampleEntry.prototype.isMetadata=function(){return!1},d.SampleEntry.prototype.isHint=function(){return!1},d.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},d.SampleEntry.prototype.getWidth=function(){return""},d.SampleEntry.prototype.getHeight=function(){return""},d.SampleEntry.prototype.getChannelCount=function(){return""},d.SampleEntry.prototype.getSampleRate=function(){return""},d.SampleEntry.prototype.getSampleSize=function(){return""},d.VisualSampleEntry.prototype.isVideo=function(){return!0},d.VisualSampleEntry.prototype.getWidth=function(){return this.width},d.VisualSampleEntry.prototype.getHeight=function(){return this.height},d.AudioSampleEntry.prototype.isAudio=function(){return!0},d.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},d.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},d.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},d.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},d.MetadataSampleEntry.prototype.isMetadata=function(){return!0},d.decimalToHex=function(t,e){var i=Number(t).toString(16);for(e=null==e?e=2:e;i.length>=1;e+=d.decimalToHex(r,0),e+=".",0===this.hvcC.general_tier_flag?e+="L":e+="H",e+=this.hvcC.general_level_idc;var n=!1,s="";for(t=5;t>=0;t--)(this.hvcC.general_constraint_indicator[t]||n)&&(s="."+d.decimalToHex(this.hvcC.general_constraint_indicator[t],0)+s,n=!0);e+=s}return e},d.mp4aSampleEntry.prototype.getCodec=function(){var t=d.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var e=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return t+"."+d.decimalToHex(e)+(i?"."+i:"")}return t},d.stxtSampleEntry.prototype.getCodec=function(){var t=d.SampleEntry.prototype.getCodec.call(this);return this.mime_format?t+"."+this.mime_format:t},d.av01SampleEntry.prototype.getCodec=function(){var t,e=d.SampleEntry.prototype.getCodec.call(this);return 2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?t=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(t=1===this.av1C.high_bitdepth?"10":"08"),e+"."+this.av1C.seq_profile+"."+this.av1C.seq_level_idx_0+(this.av1C.seq_tier_0?"H":"M")+"."+t},d.Box.prototype.writeHeader=function(t,e){this.size+=8,this.size>o&&(this.size+=8),"uuid"===this.type&&(this.size+=16),n.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+t.getPosition()+(e||"")),this.size>o?t.writeUint32(1):(this.sizePosition=t.getPosition(),t.writeUint32(this.size)),t.writeString(this.type,null,4),"uuid"===this.type&&t.writeUint8Array(this.uuid),this.size>o&&t.writeUint64(this.size)},d.FullBox.prototype.writeHeader=function(t){this.size+=4,d.Box.prototype.writeHeader.call(this,t," v="+this.version+" f="+this.flags),t.writeUint8(this.version),t.writeUint24(this.flags)},d.Box.prototype.write=function(t){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(t),t.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(t),this.data&&t.writeUint8Array(this.data))},d.ContainerBox.prototype.write=function(t){this.size=0,this.writeHeader(t);for(var e=0;e=2&&t.writeUint32(this.default_sample_description_index),t.writeUint32(this.entries.length),e=0;e0)for(e=0;e+1e?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(t),1===this.version?t.writeUint64(this.baseMediaDecodeTime):t.writeUint32(this.baseMediaDecodeTime)},d.tfhdBox.prototype.write=function(t){this.version=0,this.size=4,this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(t),t.writeUint32(this.track_id),this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&t.writeUint64(this.base_data_offset),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&t.writeUint32(this.default_sample_description_index),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&t.writeUint32(this.default_sample_duration),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&t.writeUint32(this.default_sample_size),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&t.writeUint32(this.default_sample_flags)},d.tkhdBox.prototype.write=function(t){this.version=0,this.size=80,this.writeHeader(t),t.writeUint32(this.creation_time),t.writeUint32(this.modification_time),t.writeUint32(this.track_id),t.writeUint32(0),t.writeUint32(this.duration),t.writeUint32(0),t.writeUint32(0),t.writeInt16(this.layer),t.writeInt16(this.alternate_group),t.writeInt16(this.volume<<8),t.writeUint16(0),t.writeInt32Array(this.matrix),t.writeUint32(this.width),t.writeUint32(this.height)},d.trexBox.prototype.write=function(t){this.version=0,this.flags=0,this.size=20,this.writeHeader(t),t.writeUint32(this.track_id),t.writeUint32(this.default_sample_description_index),t.writeUint32(this.default_sample_duration),t.writeUint32(this.default_sample_size),t.writeUint32(this.default_sample_flags)},d.trunBox.prototype.write=function(t){this.version=0,this.size=4,this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&d.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&d.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&d.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&d.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(t),t.writeUint32(this.sample_count),this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=t.getPosition(),t.writeInt32(this.data_offset)),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&t.writeUint32(this.first_sample_flags);for(var e=0;e-1||t[i]instanceof d.Box||e[i]instanceof d.Box||void 0===t[i]||void 0===e[i]||"function"==typeof t[i]||"function"==typeof e[i]||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||t[i]===e[i]))return!1;return!0},d.boxEqual=function(t,e){if(!d.boxEqualFields(t,e))return!1;for(var i=0;i1)for(e=1;e-1&&this.fragmentedTracks.splice(e,1)},u.prototype.setExtractionOptions=function(t,e,i){var r=this.getTrackById(t);if(r){var n={};this.extractedTracks.push(n),n.id=t,n.user=e,n.trak=r,r.nextSample=0,n.nb_samples=1e3,n.samples=[],i&&i.nbSamples&&(n.nb_samples=i.nbSamples)}},u.prototype.unsetExtractionOptions=function(t){for(var e=-1,i=0;i-1&&this.extractedTracks.splice(e,1)},u.prototype.parse=function(){var t,e;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(t=d.parseOneBox(this.stream,false)).code===d.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(t))continue;return}return}var i;switch(i="uuid"!==(e=t.box).type?e.type:e.uuid,this.boxes.push(e),i){case"mdat":this.mdats.push(e);break;case"moof":this.moofs.push(e);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&n.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=e}this.updateUsedBytes&&this.updateUsedBytes(e,t)}},u.prototype.checkBuffer=function(t){if(null==t)throw"Buffer must be defined and non empty";if(void 0===t.fileStart)throw"Buffer must have a fileStart property";return 0===t.byteLength?(n.warn("ISOFile","Ignoring empty buffer (fileStart: "+t.fileStart+")"),this.stream.logBufferLevel(),!1):(n.info("ISOFile","Processing buffer (fileStart: "+t.fileStart+")"),t.usedBytes=0,this.stream.insertBuffer(t),this.stream.logBufferLevel(),!!this.stream.initialized()||(n.warn("ISOFile","Not ready to start parsing"),!1))},u.prototype.appendBuffer=function(t,e){var i;if(this.checkBuffer(t))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(e),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(n.info("ISOFile","Done processing buffer (fileStart: "+t.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},u.prototype.getInfo=function(){var t,e,i,r,n,s={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=null!=this.moov.mvex,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=null!=this.moov.iods,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(a+1e3*this.moov.mvhd.creation_time),s.modified=new Date(a+1e3*this.moov.mvhd.modification_time),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],t=0;t0?s.mime+='video/mp4; codecs="':s.audioTracks&&s.audioTracks.length>0?s.mime+='audio/mp4; codecs="':s.mime+='application/mp4; codecs="',t=0;t=i.samples.length)&&(n.info("ISOFile","Sending fragmented data on track #"+r.id+" for samples ["+Math.max(0,i.nextSample-r.nb_samples)+","+(i.nextSample-1)+"]"),n.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(r.id,r.user,r.segmentStream.buffer,i.nextSample,t||i.nextSample>=i.samples.length),r.segmentStream=null,r!==this.fragmentedTracks[e]))break}}if(null!==this.onSamples)for(e=0;e=i.samples.length)&&(n.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[e]))break}}}},u.prototype.getBox=function(t){var e=this.getBoxes(t,!0);return e.length?e[0]:null},u.prototype.getBoxes=function(t,e){var i=[];return u._sweep.call(this,t,i,e),i},u._sweep=function(t,e,i){for(var r in this.type&&this.type==t&&e.push(this),this.boxes){if(e.length&&i)return;u._sweep.call(this.boxes[r],t,e,i)}},u.prototype.getTrackSamplesInfo=function(t){var e=this.getTrackById(t);return e?e.samples:void 0},u.prototype.getTrackSample=function(t,e){var i=this.getTrackById(t);return this.getSample(i,e)},u.prototype.releaseUsedSamples=function(t,e){var i=0,r=this.getTrackById(t);r.lastValidSample||(r.lastValidSample=0);for(var s=r.lastValidSample;st*s.timescale){h=r-1;break}e&&s.is_sync&&(l=r)}for(e&&(h=l),t=i.samples[h].cts,i.nextSample=h;i.samples[h].alreadyRead===i.samples[h].size&&i.samples[h+1];)h++;return a=i.samples[h].offset+i.samples[h].alreadyRead,n.info("ISOFile","Seeking to "+(e?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+n.getDurationString(t,o)+" and offset: "+a),{offset:a,time:t/o}},u.prototype.seek=function(t,e){var i,r,s,a=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(s=0;s-1){o=l;break}switch(o){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",e.width).set("height",e.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",e.type+" Compressor").set("depth",24),e.avcDecoderConfigRecord){var p=new d.avcCBox,u=new s(e.avcDecoderConfigRecord);p.parse(u),a.addBox(p)}break;case"Audio":n.add("smhd").set("balance",e.balance||0),a.set("channel_count",e.channel_count||2).set("samplesize",e.samplesize||16).set("samplerate",e.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===e.type)a.set("namespace",e.namespace||"nonamespace").set("schema_location",e.schema_location||"").set("auxiliary_mime_types",e.auxiliary_mime_types||"");break;default:n.add("nmhd")}e.description&&a.addBox(e.description),e.description_boxes&&e.description_boxes.forEach((function(t){a.addBox(t)})),n.add("dinf").add("dref").addEntry((new d["url Box"]).set("flags",1));var f=n.add("stbl");return f.add("stsd").addEntry(a),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",e.id).set("default_sample_description_index",e.default_sample_description_index||1).set("default_sample_duration",e.default_sample_duration||0).set("default_sample_size",e.default_sample_size||0).set("default_sample_flags",e.default_sample_flags||0),this.buildTrakSampleLists(i),e.id}},d.Box.prototype.computeSize=function(t){var e=t||new a;e.endianness=a.BIG_ENDIAN,this.write(e)},u.prototype.addSample=function(t,e,i){var r=i||{},n={},s=this.getTrackById(t);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=r.sample_description_index?r.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=e,n.size=e.byteLength,n.alreadyRead=n.size,n.duration=r.duration||1,n.cts=r.cts||0,n.dts=r.dts||0,n.is_sync=r.is_sync||!1,n.is_leading=r.is_leading||0,n.depends_on=r.depends_on||0,n.is_depended_on=r.is_depended_on||0,n.has_redundancy=r.has_redundancy||0,n.degradation_priority=r.degradation_priority||0,n.offset=0,n.subsamples=r.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,s.first_dts||(s.first_dts=r.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(e),n}},u.prototype.createSingleSampleMoof=function(t){var e=0;e=t.is_sync?1<<25:65536;var i=new d.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var r=i.add("traf"),n=this.getTrackById(t.track_id);return r.add("tfhd").set("track_id",t.track_id).set("flags",d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),r.add("tfdt").set("baseMediaDecodeTime",t.dts-n.first_dts),r.add("trun").set("flags",d.TRUN_FLAGS_DATA_OFFSET|d.TRUN_FLAGS_DURATION|d.TRUN_FLAGS_SIZE|d.TRUN_FLAGS_FLAGS|d.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[t.duration]).set("sample_size",[t.size]).set("sample_flags",[e]).set("sample_composition_time_offset",[t.cts-t.dts]),i},u.prototype.lastMoofIndex=0,u.prototype.samplesDataSize=0,u.prototype.resetTables=function(){var t,e,i,r,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,t=0;t=2&&(l=n[a].grouping_type+"/0",(o=new h(n[a].grouping_type,0)).is_fragment=!0,e.sample_groups_info[l]||(e.sample_groups_info[l]=o))}else for(a=0;a=2&&(l=r[a].grouping_type+"/0",o=new h(r[a].grouping_type,0),t.sample_groups_info[l]||(t.sample_groups_info[l]=o))},u.setSampleGroupProperties=function(t,e,i,r){var n,s;for(n in e.sample_groups=[],r){var a;if(e.sample_groups[n]={},e.sample_groups[n].grouping_type=r[n].grouping_type,e.sample_groups[n].grouping_type_parameter=r[n].grouping_type_parameter,i>=r[n].last_sample_in_run&&(r[n].last_sample_in_run<0&&(r[n].last_sample_in_run=0),r[n].entry_index++,r[n].entry_index<=r[n].sbgp.entries.length-1&&(r[n].last_sample_in_run+=r[n].sbgp.entries[r[n].entry_index].sample_count)),r[n].entry_index<=r[n].sbgp.entries.length-1?e.sample_groups[n].group_description_index=r[n].sbgp.entries[r[n].entry_index].group_description_index:e.sample_groups[n].group_description_index=-1,0!==e.sample_groups[n].group_description_index)a=r[n].fragment_description?r[n].fragment_description:r[n].description,e.sample_groups[n].group_description_index>0?(s=e.sample_groups[n].group_description_index>65535?(e.sample_groups[n].group_description_index>>16)-1:e.sample_groups[n].group_description_index-1,a&&s>=0&&(e.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(e.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},u.process_sdtp=function(t,e,i){e&&(t?(e.is_leading=t.is_leading[i],e.depends_on=t.sample_depends_on[i],e.is_depended_on=t.sample_is_depended_on[i],e.has_redundancy=t.sample_has_redundancy[i]):(e.is_leading=0,e.depends_on=0,e.is_depended_on=0,e.has_redundancy=0))},u.prototype.buildSampleLists=function(){var t,e;for(t=0;tb&&(x++,b<0&&(b=0),b+=s.sample_counts[x]),e>0?(t.samples[e-1].duration=s.sample_deltas[x],t.samples_duration+=t.samples[e-1].duration,$.dts=t.samples[e-1].dts+t.samples[e-1].duration):$.dts=0,a?(e>=w&&(v++,w<0&&(w=0),w+=a.sample_counts[v]),$.cts=t.samples[e].dts+a.sample_offsets[v]):$.cts=$.dts,o?(e==o.sample_numbers[S]-1?($.is_sync=!0,S++):($.is_sync=!1,$.degradation_priority=0),h&&h.entries[U].sample_delta+k==e+1&&($.subsamples=h.entries[U].subsamples,k+=h.entries[U].sample_delta,U++)):$.is_sync=!0,u.process_sdtp(t.mdia.minf.stbl.sdtp,$,$.number),$.degradation_priority=p?p.priority[e]:0,h&&h.entries[U].sample_delta+k==e&&($.subsamples=h.entries[U].subsamples,k+=h.entries[U].sample_delta),(d.length>0||c.length>0)&&u.setSampleGroupProperties(t,$,e,t.sample_groups_info)}e>0&&(t.samples[e-1].duration=Math.max(t.mdia.mdhd.duration-t.samples[e-1].dts,0),t.samples_duration+=t.samples[e-1].duration)}},u.prototype.updateSampleLists=function(){var t,e,i,r,n,s,a,o,l,h,c,p,f,m,g;if(void 0!==this.moov)for(;this.lastMoofIndex0&&u.initSampleGroups(p,c,c.sbgps,p.mdia.minf.stbl.sgpds,c.sgpds),e=0;e0?m.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration:(c.tfdt?m.dts=c.tfdt.baseMediaDecodeTime:m.dts=0,p.first_traf_merged=!0),m.cts=m.dts,_.flags&d.TRUN_FLAGS_CTS_OFFSET&&(m.cts=m.dts+_.sample_composition_time_offset[i]),g=a,_.flags&d.TRUN_FLAGS_FLAGS?g=_.sample_flags[i]:0===i&&_.flags&d.TRUN_FLAGS_FIRST_FLAG&&(g=_.first_sample_flags),m.is_sync=!(g>>16&1),m.is_leading=g>>26&3,m.depends_on=g>>24&3,m.is_depended_on=g>>22&3,m.has_redundancy=g>>20&3,m.degradation_priority=65535&g;var y=!!(c.tfhd.flags&d.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(c.tfhd.flags&d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),x=!!(_.flags&d.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:b||0===e?h.start:o,m.offset=0===e&&0===i?x?w+_.data_offset:w:o,o=m.offset+m.size,(c.sbgps.length>0||c.sgpds.length>0||p.mdia.minf.stbl.sbgps.length>0||p.mdia.minf.stbl.sgpds.length>0)&&u.setSampleGroupProperties(p,m,m.number_in_traf,c.sample_groups_info)}}if(c.subs){p.has_fragment_subsamples=!0;var v=c.first_sample_index;for(e=0;e-1))return null;var o=(i=this.stream.buffers[s]).byteLength-(r.offset+r.alreadyRead-i.fileStart);if(r.size-r.alreadyRead<=o)return n.debug("ISOFile","Getting sample #"+e+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+(r.size-r.alreadyRead)+" full size: "+r.size+")"),a.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,r.size-r.alreadyRead),i.usedBytes+=r.size-r.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead=r.size,r;if(0===o)return null;n.debug("ISOFile","Getting sample #"+e+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-i.fileStart)+" read size: "+o+" full size: "+r.size+")"),a.memcpy(r.data.buffer,r.alreadyRead,i,r.offset+r.alreadyRead-i.fileStart,o),r.alreadyRead+=o,i.usedBytes+=o,this.stream.logBufferLevel()}},u.prototype.releaseSample=function(t,e){var i=t.samples[e];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},u.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},u.prototype.getCodecs=function(){var t,e="";for(t=0;t0&&(e+=","),e+=this.moov.traks[t].mdia.minf.stbl.stsd.entries[0].getCodec()}return e},u.prototype.getTrexById=function(t){var e;if(!this.moov||!this.moov.mvex)return null;for(e=0;e0&&(i.protection=s.ipro.protections[s.iinf.item_infos[t].protection_index-1]),s.iinf.item_infos[t].item_type?i.type=s.iinf.item_infos[t].item_type:i.type="mime",i.content_type=s.iinf.item_infos[t].content_type,i.content_encoding=s.iinf.item_infos[t].content_encoding;if(s.iloc)for(t=0;t0&&c.property_index-1-1))return null;var l=(e=this.stream.buffers[o]).byteLength-(s.offset+s.alreadyRead-e.fileStart);if(!(s.length-s.alreadyRead<=l))return n.debug("ISOFile","Getting item #"+t+" extent #"+r+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-e.fileStart)+" read size: "+l+" full extent size: "+s.length+" full item size: "+i.size+")"),a.memcpy(i.data.buffer,i.alreadyRead,e,s.offset+s.alreadyRead-e.fileStart,l),s.alreadyRead+=l,i.alreadyRead+=l,e.usedBytes+=l,this.stream.logBufferLevel(),null;n.debug("ISOFile","Getting item #"+t+" extent #"+r+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-e.fileStart)+" read size: "+(s.length-s.alreadyRead)+" full extent size: "+s.length+" full item size: "+i.size+")"),a.memcpy(i.data.buffer,i.alreadyRead,e,s.offset+s.alreadyRead-e.fileStart,s.length-s.alreadyRead),e.usedBytes+=s.length-s.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=s.length-s.alreadyRead,s.alreadyRead=s.length}}return i.alreadyRead===i.size?i:null},u.prototype.releaseItem=function(t){var e=this.items[t];if(e.data){this.itemsDataSize-=e.size,e.data=null,e.alreadyRead=0;for(var i=0;i0?this.moov.traks[t].samples[0].duration:0),e.push(r)}return e},d.Box.prototype.printHeader=function(t){this.size+=8,this.size>o&&(this.size+=8),"uuid"===this.type&&(this.size+=16),t.log(t.indent+"size:"+this.size),t.log(t.indent+"type:"+this.type)},d.FullBox.prototype.printHeader=function(t){this.size+=4,d.Box.prototype.printHeader.call(this,t),t.log(t.indent+"version:"+this.version),t.log(t.indent+"flags:"+this.flags)},d.Box.prototype.print=function(t){this.printHeader(t)},d.ContainerBox.prototype.print=function(t){this.printHeader(t);for(var e=0;e>8)),t.log(t.indent+"matrix: "+this.matrix.join(", ")),t.log(t.indent+"next_track_id: "+this.next_track_id)},d.tkhdBox.prototype.print=function(t){d.FullBox.prototype.printHeader.call(this,t),t.log(t.indent+"creation_time: "+this.creation_time),t.log(t.indent+"modification_time: "+this.modification_time),t.log(t.indent+"track_id: "+this.track_id),t.log(t.indent+"duration: "+this.duration),t.log(t.indent+"volume: "+(this.volume>>8)),t.log(t.indent+"matrix: "+this.matrix.join(", ")),t.log(t.indent+"layer: "+this.layer),t.log(t.indent+"alternate_group: "+this.alternate_group),t.log(t.indent+"width: "+this.width),t.log(t.indent+"height: "+this.height)};var f={createFile:function(t,e){var i=void 0===t||t,r=new u(e);return r.discardMdatData=!i,r}};t.createFile=f.createFile}(wt);class vt{constructor(t){this.data=new Uint8Array(t),this.idx=0,this.size=t}getData(){if(this.idx!==this.size)throw new Error("Mismatch between size reserved and sized used");return this.data.slice(0,this.idx)}writeUint8(t){this.data.set([t],this.idx),this.idx+=1}writeUint16(t){const e=new Uint16Array(1);e[0]=t;const i=new Uint8Array(e.buffer);this.data.set([i[1],i[0]],this.idx),this.idx+=2}writeUint8Array(t){this.data.set(t,this.idx),this.idx+=t.length}}const St=(t,e,{VideoDecoder:i,EncodedVideoChunk:r,debug:n})=>new Promise(((s,a)=>{n&&console.info("Decoding video from",t);try{const o=wt.createFile();let l;const h=new i({output:t=>{createImageBitmap(t,{resizeQuality:"low"}).then((i=>{e(i),t.close(),h.decodeQueueSize<=0&&setTimeout((()=>{"closed"!==h.state&&(h.close(),s())}),500)}))},error:t=>{console.error(t),a(t)}});o.onReady=t=>{if(t&&t.videoTracks&&t.videoTracks[0]){[{codec:l}]=t.videoTracks,n&&console.info("Video with codec:",l);const e=(t=>{let e,i=7;for(e=0;e{for(let t=0;t{const e=t.body.getReader();let i=0;return e.read().then((function t({done:r,value:n}){if(r)return o.flush(),null;const s=n.buffer;return s.fileStart=i,i+=s.byteLength,o.appendBuffer(s),e.read().then(t)}))}))}catch(t){a(t)}}));class Ut{constructor({src:t,scrollyVideoContainer:e,cover:i=!0,sticky:r=!0,full:n=!0,trackScroll:s=!0,transitionSpeed:a=8,frameThreshold:o=.1,useWebCodecs:l=!0,onReady:h=(()=>{}),debug:d=!1}){if("object"!=typeof document)return void console.error("ScrollyVideo must be initiated in a DOM context");if(!e)return void console.error("scrollyVideoContainer must be a valid DOM object");if(!t)return void console.error("Must provide valid video src to ScrollyVideo");if(e instanceof Element)this.container=e;else{if("string"!=typeof e)throw new Error("scrollyVideoContainer must be a valid DOM object");if(this.container=document.getElementById(e),!this.container)throw new Error("scrollyVideoContainer must be a valid DOM object")}this.src=t,this.transitionSpeed=a,this.frameThreshold=o,this.useWebCodecs=l,this.cover=i,this.sticky=r,this.trackScroll=s,this.onReady=h,this.debug=d,this.video=document.createElement("video"),this.video.src=t,this.video.preload="auto",this.video.tabIndex=0,this.video.autobuffer=!0,this.video.playsInline=!0,this.video.muted=!0,this.video.pause(),this.video.load(),this.container.appendChild(this.video),r&&(this.container.style.display="block",this.container.style.position="sticky",this.container.style.top="0"),n&&(this.container.style.width="100%",this.container.style.height="100vh",this.container.style.overflow="hidden"),i&&this.setCoverStyle(this.video);const c=(new xt).getEngine();this.isSafari="WebKit"===c.name,d&&this.isSafari&&console.info("Safari browser detected"),this.currentTime=0,this.targetTime=0,this.canvas=null,this.context=null,this.frames=[],this.frameRate=0,this.updateScrollPercentage=t=>{const e=this.container.parentNode.getBoundingClientRect(),i=-e.top/(e.height-window.innerHeight);this.debug&&console.info("ScrollyVideo scrolled to",i),this.setTargetTimePercent(i,{jump:t})},this.trackScroll?(window.addEventListener("scroll",this.updateScrollPercentage),this.video.addEventListener("loadedmetadata",(()=>this.updateScrollPercentage(!0)),{once:!0})):this.video.addEventListener("loadedmetadata",(()=>this.setTargetTimePercent(0,{jump:!0})),{once:!0}),this.resize=()=>{this.debug&&console.info("ScrollyVideo resizing..."),this.cover&&this.setCoverStyle(this.canvas||this.video),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate))},window.addEventListener("resize",this.resize),this.video.addEventListener("progress",this.resize),this.decodeVideo()}setCoverStyle(t){if(this.cover){t.style.position="absolute",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.minWidth="101%",t.style.minHeight="101%";const{width:e,height:i}=this.container.getBoundingClientRect(),r=t.videoWidth||t.width,n=t.videoHeight||t.height;this.debug&&console.info("Container dimensions:",[e,i]),this.debug&&console.info("Element dimensions:",[r,n]),e/i>r/n?(t.style.width="100%",t.style.height="auto"):(t.style.height="100%",t.style.width="auto")}}async decodeVideo(){if(this.useWebCodecs)if(this.src){try{await(t=this.src,e=t=>{this.frames.push(t)},i=this.debug,"function"==typeof VideoDecoder&&"function"==typeof EncodedVideoChunk?(i&&console.info("WebCodecs is natively supported, using native version..."),St(t,e,{VideoDecoder:VideoDecoder,EncodedVideoChunk:EncodedVideoChunk,debug:i})):(i&&console.info("WebCodecs is not available in this browser."),Promise.resolve()))}catch(t){this.debug&&console.error("Error encountered while decoding video",t),this.frames=[],this.video.load()}var t,e,i;if(0===this.frames.length)return this.debug&&console.error("No frames were received from webCodecs"),void this.onReady();this.frameRate=this.frames.length/this.video.duration,this.debug&&console.info("Received",this.frames.length,"frames"),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.video.style.display="none",this.container.appendChild(this.canvas),this.cover&&this.setCoverStyle(this.canvas),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate)),this.onReady()}else this.debug&&console.warn("Cannot perform video decode: no `src` found");else this.debug&&console.warn("Cannot perform video decode: `useWebCodes` disabled")}paintCanvasFrame(t){if(this.canvas){const e=this.frames[t];if(e){this.debug&&console.info("Painting frame",t),this.canvas.width=e.width,this.canvas.height=e.height;const{width:i,height:r}=this.container.getBoundingClientRect();i/r>e.width/e.height?(this.canvas.style.width="100%",this.canvas.style.height="auto"):(this.canvas.style.height="100%",this.canvas.style.width="auto"),this.context.drawImage(e,0,0,e.width,e.height)}}}transitionToTargetTime({jump:t,transitionSpeed:e=this.transitionSpeed,easing:i=null}){this.debug&&console.info("Transitioning targetTime:",this.targetTime,"currentTime:",this.currentTime);const r=this.targetTime-this.currentTime,n=Math.abs(r),s=1e3*n,a=r>0,o=({startCurrentTime:r,startTimestamp:l,timestamp:h})=>{const d=(h-l)/s,c=a?this.currentTime>=this.targetTime:this.currentTime<=this.targetTime;if(isNaN(this.targetTime)||Math.abs(this.targetTime-this.currentTime)this.video.duration&&(this.targetTime=this.video.duration),this.targetTime<0&&(this.targetTime=0);const p=this.targetTime-this.currentTime,u=i&&Number.isFinite(d)?i(d):null,f=a?r+u*Math.abs(n)*e:r-u*Math.abs(n)*e;if(this.canvas)t?this.currentTime=this.targetTime:u?this.currentTime=f:this.currentTime+=p/(256/e),this.paintCanvasFrame(Math.floor(this.currentTime*this.frameRate));else if(t||this.isSafari||!a)this.video.pause(),u?this.currentTime=f:this.currentTime+=p/(64/e),t&&(this.currentTime=this.targetTime),this.video.currentTime=this.currentTime;else{const t=Math.max(Math.min(4*p,e,16),1);this.debug&&console.info("ScrollyVideo playbackRate:",t),isNaN(t)||(this.video.playbackRate=t,this.video.play()),this.currentTime=this.video.currentTime}"function"==typeof requestAnimationFrame&&(this.transitioningRaf=requestAnimationFrame((t=>o({startCurrentTime:r,startTimestamp:l,timestamp:t}))))};"function"==typeof requestAnimationFrame&&(this.transitioningRaf=requestAnimationFrame((t=>{o({startCurrentTime:this.currentTime,startTimestamp:t,timestamp:t})})))}setTargetTimePercent(t,e={}){this.targetTime=Math.max(Math.min(t,1),0)*(this.frames.length&&this.frameRate?this.frames.length/this.frameRate:this.video.duration),!e.jump&&Math.abs(this.currentTime-this.targetTime){s&&s.destroy&&s.destroy()},I().$$.on_destroy.push(o),t.$$set=t=>{r(6,i=e(e({},i),m(t)))},t.$$.update=()=>{if(n){const{videoPercentage:t,...e}=i;JSON.stringify(e)!==a&&(s&&s.destroy&&s.destroy(),r(3,s=new Ut({...e,scrollyVideoContainer:n})),r(4,a=JSON.stringify(e))),s&&"number"==typeof t&&t>=0&&t<=1&&(e.trackScroll?s.setScrollPercent(t):s.setTargetTimePercent(t))}},i=m(i),[n,function(...t){s.setTargetTimePercent(...t)},function(...t){s.setScrollPercent(...t)},s,a,function(t){D[t?"unshift":"push"]((()=>{n=t,r(0,n)}))}]}class Et extends ht{constructor(t){super(),lt(this,t,$t,kt,a,{setTargetTimePercent:1,setScrollPercent:2})}get setTargetTimePercent(){return this.$$.ctx[1]}get setScrollPercent(){return this.$$.ctx[2]}}function Tt(t,e,i){const r=t.slice();return r[9]=e[i],r}function zt(t){let e,i;return e=new Et({props:{src:t[1],trackScroll:t[2],videoPercentage:t[3]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};2&i&&(r.src=t[1]),4&i&&(r.trackScroll=t[2]),8&i&&(r.videoPercentage=t[3]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function At(e){let i,r,n,s=e[9]+"";return{c(){i=w("div"),r=w("div"),n=v(s),$(r,"class","card svelte-161tbt5"),$(i,"class","card-wrap svelte-161tbt5")},m(t,e){y(t,i,e),_(i,r),_(r,n)},p:t,d(t){t&&b(i)}}}function Bt(t){let e,i,r,s,a,o,l,h,d,c,p,u=Math.floor(100*t[3])+"";return{c(){e=w("div"),i=w("h3"),i.textContent="Video Position",r=S(),s=w("div"),a=w("label"),o=v(u),l=v("%"),h=S(),d=w("input"),$(i,"class","svelte-161tbt5"),$(a,"for","video-position"),$(a,"class","svelte-161tbt5"),$(d,"id","video-position"),$(d,"type","range"),$(d,"min","0"),$(d,"max","1"),$(d,"step","0.01"),$(d,"class","svelte-161tbt5"),$(s,"class","option-wrap svelte-161tbt5"),$(e,"class","scroll-track svelte-161tbt5")},m(n,u){y(n,e,u),_(e,i),_(e,r),_(e,s),_(s,a),_(a,o),_(a,l),_(s,h),_(s,d),T(d,t[3]),c||(p=[k(d,"change",t[8]),k(d,"input",t[8])],c=!0)},p(t,e){8&e&&u!==(u=Math.floor(100*t[3])+"")&&E(o,u),8&e&&T(d,t[3])},d(t){t&&b(e),c=!1,n(p)}}}function It(t){let e,i,r,s,a,o,l,h,d,c,p,u,f,m,g,v,U,E,z,A;H(t[5]);let B=t[1]&&zt(t),I=t[4],C=[];for(let e=0;e{B=null})),X()),16&n){let i;for(I=t[4],i=0;i{1&t.$$.dirty&&n&&i(1,r=n>760?"https://scrollyvideo.js.org/goldengate.mp4":"https://scrollyvideo.js.org/goldengate_mobile.mp4")},[n,r,s,a,["This kind of scrolling video is common in visual journalism, marketing materials, or other scrollytelling applications.","This library provides a way to easily create these kinds of scrolling video experiences, without fussing with special video encoding formats.","Compatible with React, Svelte, Vue, and plain HTML."],function(){i(0,n=window.innerWidth)},function(){r=this.value,i(1,r),i(0,n)},function(){s=this.checked,i(2,s)},function(){var t;t=this.value,a=""===t?null:+t,i(3,a)}]}class Pt extends ht{constructor(t){super(),lt(this,t,Ct,It,a,{})}}function Ft(t,e,i){const r=t.slice();return r[18]=e[i],r}function Lt(t,e,i){const r=t.slice();return r[18]=e[i],r}function Rt(t,e,i){const r=t.slice();return r[10]=e[i],r}function Dt(t,e,i){const r=t.slice();return r[13]=e[i],r[15]=i,r}function Nt(t,e,i){const r=t.slice();return r[16]=e[i],r[15]=i,r}function Ot(t,e,i){const r=t.slice();return r[7]=e[i],r}function Mt(t){let e,i,r,n;const s=[Yt,Vt,Ht],a=[];function o(t,e){return"table"===t[0]?0:"list"===t[0]?1:2}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Gt(t){let e,i,r=t[1],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Vt(t){let e,i,r,n;const s=[Kt,Wt],a=[];function o(t,e){return t[4]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Yt(t){let e,i,r;var n=t[5].table;function s(t){return{props:{$$slots:{default:[pe]},$$scope:{ctx:t}}}}return n&&(e=A(n,s(t))),{c(){e&&nt(e.$$.fragment),i=U()},m(t,n){e&&st(e,t,n),y(t,i,n),r=!0},p(t,r){const a={};if(8388716&r&&(a.$$scope={dirty:r,ctx:t}),n!==(n=t[5].table)){if(e){K();const t=e;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function jt(e){let i,r=e[6].raw+"";return{c(){i=v(r)},m(t,e){y(t,i,e)},p(t,e){64&e&&r!==(r=t[6].raw+"")&&E(i,r)},i:t,o:t,d(t){t&&b(i)}}}function qt(t){let e,i;return e=new ge({props:{tokens:t[1],renderers:t[5]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};2&i&&(r.tokens=t[1]),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function Zt(t){let e,i,r,n;const s=[qt,jt],a=[];function o(t,e){return t[1]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,n){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Wt(t){let i,r,n;const s=[{ordered:t[4]},t[6]];var a=t[5].list;function o(t){let i={$$slots:{default:[Jt]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Kt(t){let i,r,n;const s=[{ordered:t[4]},t[6]];var a=t[5].list;function o(t){let i={$$slots:{default:[ie]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Xt(t){let e,i,r;return e=new ge({props:{tokens:t[18].tokens,renderers:t[5]}}),{c(){nt(e.$$.fragment),i=S()},m(t,n){st(e,t,n),y(t,i,n),r=!0},p(t,i){const r={};64&i&&(r.tokens=t[18].tokens),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){r||(Q(e.$$.fragment,t),r=!0)},o(t){J(e.$$.fragment,t),r=!1},d(t){at(e,t),t&&b(i)}}}function Qt(t){let i,r,n;const s=[t[18]];var a=t[5].unorderedlistitem||t[5].listitem;function o(t){let i={$$slots:{default:[Xt]},$$scope:{ctx:t}};for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function Jt(t){let e,i,r=t[6].items,n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(i=A(a,o(t)),nt(i.$$.fragment),Q(i.$$.fragment,1),st(i,r.parentNode,r)):i=null}else a&&i.$set(n)},i(t){n||(i&&Q(i.$$.fragment,t),n=!0)},o(t){i&&J(i.$$.fragment,t),n=!1},d(t){t&&b(r),i&&at(i,t)}}}function ie(t){let e,i,r=t[6].items,n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function se(t){let e,i,r=t[2],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function oe(t){let e,i;return e=new ge({props:{tokens:t[13].tokens,renderers:t[5]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,i){const r={};8&i&&(r.tokens=t[13].tokens),32&i&&(r.renderers=t[5]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function le(t){let e,i,r;var n=t[5].tablecell;function s(t){return{props:{header:!1,align:t[6].align[t[15]]||"center",$$slots:{default:[oe]},$$scope:{ctx:t}}}}return n&&(e=A(n,s(t))),{c(){e&&nt(e.$$.fragment),i=U()},m(t,n){e&&st(e,t,n),y(t,i,n),r=!0},p(t,r){const a={};if(64&r&&(a.align=t[6].align[t[15]]||"center"),8388648&r&&(a.$$scope={dirty:r,ctx:t}),n!==(n=t[5].tablecell)){if(e){K();const t=e;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function he(t){let e,i,r=t[10],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}n?(e=A(n,s(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else n&&e.$set(a)},i(t){r||(e&&Q(e.$$.fragment,t),r=!0)},o(t){e&&J(e.$$.fragment,t),r=!1},d(t){t&&b(i),e&&at(e,t)}}}function ce(t){let e,i,r=t[3],n=[];for(let e=0;eJ(n[t],1,1,(()=>{n[t]=null}));return{c(){for(let t=0;t{at(t,1)})),X()}a?(e=A(a,o(t)),nt(e.$$.fragment),Q(e.$$.fragment,1),st(e,i.parentNode,i)):e=null}else a&&e.$set(d);const c={};if(8388712&s&&(c.$$scope={dirty:s,ctx:t}),l!==(l=t[5].tablebody)){if(r){K();const t=r;J(t.$$.fragment,1,0,(()=>{at(t,1)})),X()}l?(r=A(l,h(t)),nt(r.$$.fragment),Q(r.$$.fragment,1),st(r,n.parentNode,n)):r=null}else l&&r.$set(c)},i(t){s||(e&&Q(e.$$.fragment,t),r&&Q(r.$$.fragment,t),s=!0)},o(t){e&&J(e.$$.fragment,t),r&&J(r.$$.fragment,t),s=!1},d(t){e&&at(e,t),t&&b(i),t&&b(n),r&&at(r,t)}}}function ue(t){let i,r;const n=[t[7],{renderers:t[5]}];let s={};for(let t=0;t{a[l]=null})),X()),~e?(i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r)):i=null)},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){~e&&a[e].d(t),t&&b(r)}}}function me(t,i,r){const n=["type","tokens","header","rows","ordered","renderers"];let s=g(i,n),{type:a}=i,{tokens:o}=i,{header:l}=i,{rows:h}=i,{ordered:d=!1}=i,{renderers:c}=i;return function(){const t=console.warn;console.warn=e=>{e.includes("unknown prop")||e.includes("unexpected slot")||t(e)},C((()=>{console.warn=t}))}(),t.$$set=t=>{i=e(e({},i),m(t)),r(6,s=g(i,n)),"type"in t&&r(0,a=t.type),"tokens"in t&&r(1,o=t.tokens),"header"in t&&r(2,l=t.header),"rows"in t&&r(3,h=t.rows),"ordered"in t&&r(4,d=t.ordered),"renderers"in t&&r(5,c=t.renderers)},[a,o,l,h,d,c,s]}class ge extends ht{constructor(t){super(),lt(this,t,me,fe,a,{type:0,tokens:1,header:2,rows:3,ordered:4,renderers:5})}}function _e(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let ye={async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const be=/[&<>"']/,xe=new RegExp(be.source,"g"),we=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ve=new RegExp(we.source,"g"),Se={"&":"&","<":"<",">":">",'"':""","'":"'"},Ue=t=>Se[t];function ke(t,e){if(e){if(be.test(t))return t.replace(xe,Ue)}else if(we.test(t))return t.replace(ve,Ue);return t}const $e=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ee(t){return t.replace($e,((t,e)=>"colon"===(e=e.toLowerCase())?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}const Te=/(^|[^\[])\^/g;function ze(t,e){t="string"==typeof t?t:t.source,e=e||"";const i={replace:(e,r)=>(r=(r=r.source||r).replace(Te,"$1"),t=t.replace(e,r),i),getRegex:()=>new RegExp(t,e)};return i}const Ae=/[^\w:]/g,Be=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Ie(t,e,i){if(t){let t;try{t=decodeURIComponent(Ee(i)).replace(Ae,"").toLowerCase()}catch(t){return null}if(0===t.indexOf("javascript:")||0===t.indexOf("vbscript:")||0===t.indexOf("data:"))return null}e&&!Be.test(i)&&(i=function(t,e){Ce[" "+t]||(Pe.test(t)?Ce[" "+t]=t+"/":Ce[" "+t]=Oe(t,"/",!0));t=Ce[" "+t];const i=-1===t.indexOf(":");return"//"===e.substring(0,2)?i?e:t.replace(Fe,"$1")+e:"/"===e.charAt(0)?i?e:t.replace(Le,"$1")+e:t+e}(e,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(t){return null}return i}const Ce={},Pe=/^[^:]+:\/*[^/]*$/,Fe=/^([^:]+:)[\s\S]*$/,Le=/^([^:]+:\/*[^/]*)[\s\S]*$/;const Re={exec:function(){}};function De(t){let e,i,r=1;for(;r{let r=!1,n=e;for(;--n>=0&&"\\"===i[n];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),i.length>e)i.splice(e);else for(;i.length1;)1&e&&(i+=t),e>>=1,t+=t;return i+t}function He(t,e,i,r){const n=e.href,s=e.title?ke(e.title):null,a=t[1].replace(/\\([\[\]])/g,"$1");if("!"!==t[0].charAt(0)){r.state.inLink=!0;const t={type:"link",raw:i,href:n,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,t}return{type:"image",raw:i,href:n,title:s,text:ke(a)}}class Ve{constructor(t){this.options=t||ye}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Oe(t,"\n")}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const t=e[0],i=function(t,e){const i=t.match(/^(\s+)(?:```)/);if(null===i)return e;const r=i[1];return e.split("\n").map((t=>{const e=t.match(/^\s+/);if(null===e)return t;const[i]=e;return i.length>=r.length?t.slice(r.length):t})).join("\n")}(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline._escapes,"$1"):e[2],text:i}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let t=e[2].trim();if(/#$/.test(t)){const e=Oe(t,"#");this.options.pedantic?t=e.trim():e&&!/ $/.test(e)||(t=e.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:e[0]}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){const t=e[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(t);return this.lexer.state.top=i,{type:"blockquote",raw:e[0],tokens:r,text:t}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i,r,n,s,a,o,l,h,d,c,p,u,f=e[1].trim();const m=f.length>1,g={type:"list",raw:"",ordered:m,start:m?+f.slice(0,-1):"",loose:!1,items:[]};f=m?`\\d{1,9}\\${f.slice(-1)}`:`\\${f}`,this.options.pedantic&&(f=m?f:"[*+-]");const _=new RegExp(`^( {0,3}${f})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;t&&(u=!1,e=_.exec(t))&&!this.rules.block.hr.test(t);){if(i=e[0],t=t.substring(i.length),h=e[2].split("\n",1)[0].replace(/^\t+/,(t=>" ".repeat(3*t.length))),d=t.split("\n",1)[0],this.options.pedantic?(s=2,p=h.trimLeft()):(s=e[2].search(/[^ ]/),s=s>4?1:s,p=h.slice(s),s+=e[1].length),o=!1,!h&&/^ *$/.test(d)&&(i+=d+"\n",t=t.substring(d.length+1),u=!0),!u){const e=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),a=new RegExp(`^ {0,${Math.min(3,s-1)}}#`);for(;t&&(c=t.split("\n",1)[0],d=c,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!n.test(d))&&!a.test(d)&&!e.test(d)&&!r.test(t);){if(d.search(/[^ ]/)>=s||!d.trim())p+="\n"+d.slice(s);else{if(o)break;if(h.search(/[^ ]/)>=4)break;if(n.test(h))break;if(a.test(h))break;if(r.test(h))break;p+="\n"+d}o||d.trim()||(o=!0),i+=c+"\n",t=t.substring(c.length+1),h=d.slice(s)}}g.loose||(l?g.loose=!0:/\n *\n *$/.test(i)&&(l=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(p),r&&(n="[ ] "!==r[0],p=p.replace(/^\[[ xX]\] +/,""))),g.items.push({type:"list_item",raw:i,task:!!r,checked:n,loose:!1,text:p}),g.raw+=i}g.items[g.items.length-1].raw=i.trimRight(),g.items[g.items.length-1].text=p.trimRight(),g.raw=g.raw.trimRight();const y=g.items.length;for(a=0;a"space"===t.type)),e=t.length>0&&t.some((t=>/\n.*\n/.test(t.raw)));g.loose=e}if(g.loose)for(a=0;a$/,"$1").replace(this.rules.inline._escapes,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline._escapes,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:i,title:r}}}table(t){const e=this.rules.block.table.exec(t);if(e){const t={type:"table",header:Ne(e[1]).map((t=>({text:t}))),align:e[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(t.header.length===t.align.length){t.raw=e[0];let i,r,n,s,a=t.align.length;for(i=0;i({text:t})));for(a=t.header.length,r=0;r/i.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(e[0]):ke(e[0]):e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const t=e[2].trim();if(!this.options.pedantic&&/^$/.test(t))return;const e=Oe(t.slice(0,-1),"\\");if((t.length-e.length)%2==0)return}else{const t=function(t,e){if(-1===t.indexOf(e[1]))return-1;const i=t.length;let r=0,n=0;for(;n-1){const i=(0===e[0].indexOf("!")?5:4)+e[1].length+t;e[2]=e[2].substring(0,t),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){const t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);t&&(i=t[1],r=t[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),/^$/.test(t)?i.slice(1):i.slice(1,-1)),He(e,{href:i?i.replace(this.rules.inline._escapes,"$1"):i,title:r?r.replace(this.rules.inline._escapes,"$1"):r},e[0],this.lexer)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let t=(i[2]||i[1]).replace(/\s+/g," ");if(t=e[t.toLowerCase()],!t){const t=i[0].charAt(0);return{type:"text",raw:t,text:t}}return He(i,t,i[0],this.lexer)}}emStrong(t,e,i=""){let r=this.rules.inline.emStrong.lDelim.exec(t);if(!r)return;if(r[3]&&i.match(/[\p{L}\p{N}]/u))return;const n=r[1]||r[2]||"";if(!n||n&&(""===i||this.rules.inline.punctuation.exec(i))){const i=r[0].length-1;let n,s,a=i,o=0;const l="*"===r[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,e=e.slice(-1*t.length+i);null!=(r=l.exec(e));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(s=n.length,r[3]||r[4]){a+=s;continue}if((r[5]||r[6])&&i%3&&!((i+s)%3)){o+=s;continue}if(a-=s,a>0)continue;s=Math.min(s,s+a+o);const e=t.slice(0,i+r.index+(r[0].length-n.length)+s);if(Math.min(i,s)%2){const t=e.slice(1,-1);return{type:"em",raw:e,text:t,tokens:this.lexer.inlineTokens(t)}}const l=e.slice(2,-2);return{type:"strong",raw:e,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let t=e[2].replace(/\n/g," ");const i=/[^ ]/.test(t),r=/^ /.test(t)&&/ $/.test(t);return i&&r&&(t=t.substring(1,t.length-1)),t=ke(t,!0),{type:"codespan",raw:e[0],text:t}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t,e){const i=this.rules.inline.autolink.exec(t);if(i){let t,r;return"@"===i[2]?(t=ke(this.options.mangle?e(i[1]):i[1]),r="mailto:"+t):(t=ke(i[1]),r=t),{type:"link",raw:i[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(t,e){let i;if(i=this.rules.inline.url.exec(t)){let t,r;if("@"===i[2])t=ke(this.options.mangle?e(i[0]):i[0]),r="mailto:"+t;else{let e;do{e=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(e!==i[0]);t=ke(i[0]),r="www."===i[1]?"http://"+i[0]:i[0]}return{type:"link",raw:i[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(t,e){const i=this.rules.inline.text.exec(t);if(i){let t;return t=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):ke(i[0]):i[0]:ke(this.options.smartypants?e(i[0]):i[0]),{type:"text",raw:i[0],text:t}}}}const Ye={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Re,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Ye.def=ze(Ye.def).replace("label",Ye._label).replace("title",Ye._title).getRegex(),Ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,Ye.listItemStart=ze(/^( *)(bull) */).replace("bull",Ye.bullet).getRegex(),Ye.list=ze(Ye.list).replace(/bull/g,Ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ye.def.source+")").getRegex(),Ye._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ye._comment=/|$)/,Ye.html=ze(Ye.html,"i").replace("comment",Ye._comment).replace("tag",Ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ye.paragraph=ze(Ye._paragraph).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.blockquote=ze(Ye.blockquote).replace("paragraph",Ye.paragraph).getRegex(),Ye.normal=De({},Ye),Ye.gfm=De({},Ye.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Ye.gfm.table=ze(Ye.gfm.table).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.gfm.paragraph=ze(Ye._paragraph).replace("hr",Ye.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Ye.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Ye._tag).getRegex(),Ye.pedantic=De({},Ye.normal,{html:ze("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Ye._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Re,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ze(Ye.normal._paragraph).replace("hr",Ye.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const je={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Re,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\.5&&(i="x"+i.toString(16)),r+="&#"+i+";";return r}je._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",je.punctuation=ze(je.punctuation).replace(/punctuation/g,je._punctuation).getRegex(),je.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,je.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,je._comment=ze(Ye._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),je.emStrong.lDelim=ze(je.emStrong.lDelim).replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimAst=ze(je.emStrong.rDelimAst,"g").replace(/punct/g,je._punctuation).getRegex(),je.emStrong.rDelimUnd=ze(je.emStrong.rDelimUnd,"g").replace(/punct/g,je._punctuation).getRegex(),je._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,je._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,je._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,je.autolink=ze(je.autolink).replace("scheme",je._scheme).replace("email",je._email).getRegex(),je._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,je.tag=ze(je.tag).replace("comment",je._comment).replace("attribute",je._attribute).getRegex(),je._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,je._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,je._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,je.link=ze(je.link).replace("label",je._label).replace("href",je._href).replace("title",je._title).getRegex(),je.reflink=ze(je.reflink).replace("label",je._label).replace("ref",Ye._label).getRegex(),je.nolink=ze(je.nolink).replace("ref",Ye._label).getRegex(),je.reflinkSearch=ze(je.reflinkSearch,"g").replace("reflink",je.reflink).replace("nolink",je.nolink).getRegex(),je.normal=De({},je),je.pedantic=De({},je.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ze(/^!?\[(label)\]\((.*?)\)/).replace("label",je._label).getRegex(),reflink:ze(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",je._label).getRegex()}),je.gfm=De({},je.normal,{escape:ze(je.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\e+" ".repeat(i.length)));t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))))if(i=this.tokenizer.space(t))t=t.substring(i.raw.length),1===i.raw.length&&e.length>0?e[e.length-1].raw+="\n":e.push(i);else if(i=this.tokenizer.code(t))t=t.substring(i.raw.length),r=e[e.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?e.push(i):(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(i=this.tokenizer.fences(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.heading(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.hr(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.blockquote(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.list(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.html(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.def(t))t=t.substring(i.raw.length),r=e[e.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(r.raw+="\n"+i.raw,r.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(i=this.tokenizer.table(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.lheading(t))t=t.substring(i.raw.length),e.push(i);else{if(n=t,this.options.extensions&&this.options.extensions.startBlock){let e=1/0;const i=t.slice(1);let r;this.options.extensions.startBlock.forEach((function(t){r=t.call({lexer:this},i),"number"==typeof r&&r>=0&&(e=Math.min(e,r))})),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n)))r=e[e.length-1],s&&"paragraph"===r.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(i),s=n.length!==t.length,t=t.substring(i.raw.length);else if(i=this.tokenizer.text(t))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===r.type?(r.raw+="\n"+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):e.push(i);else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){let i,r,n,s,a,o,l=t;if(this.tokens.links){const t=Object.keys(this.tokens.links);if(t.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(l));)t.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,s.index)+"["+Ge("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,s.index)+"["+Ge("a",s[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.escapedEmSt.exec(l));)l=l.slice(0,s.index+s[0].length-2)+"++"+l.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;t;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(i=r.call({lexer:this},t,e))&&(t=t.substring(i.raw.length),e.push(i),!0)))))if(i=this.tokenizer.escape(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.tag(t))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===i.type&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(i=this.tokenizer.link(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.reflink(t,this.tokens.links))t=t.substring(i.raw.length),r=e[e.length-1],r&&"text"===i.type&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(i=this.tokenizer.emStrong(t,l,o))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.codespan(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.br(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.del(t))t=t.substring(i.raw.length),e.push(i);else if(i=this.tokenizer.autolink(t,Ze))t=t.substring(i.raw.length),e.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(t,Ze))){if(n=t,this.options.extensions&&this.options.extensions.startInline){let e=1/0;const i=t.slice(1);let r;this.options.extensions.startInline.forEach((function(t){r=t.call({lexer:this},i),"number"==typeof r&&r>=0&&(e=Math.min(e,r))})),e<1/0&&e>=0&&(n=t.substring(0,e+1))}if(i=this.tokenizer.inlineText(n,qe))t=t.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(o=i.raw.slice(-1)),a=!0,r=e[e.length-1],r&&"text"===r.type?(r.raw+=i.raw,r.text+=i.text):e.push(i);else if(t){const e="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(e);break}throw new Error(e)}}else t=t.substring(i.raw.length),e.push(i);return e}}class Ke{constructor(t){this.options=t||ye}code(t,e,i){const r=(e||"").match(/\S*/)[0];if(this.options.highlight){const e=this.options.highlight(t,r);null!=e&&e!==t&&(i=!0,t=e)}return t=t.replace(/\n$/,"")+"\n",r?'
    '+(i?t:ke(t,!0))+"
    \n":"
    "+(i?t:ke(t,!0))+"
    \n"}blockquote(t){return`
    \n${t}
    \n`}html(t){return t}heading(t,e,i,r){if(this.options.headerIds){return`${t}\n`}return`${t}\n`}hr(){return this.options.xhtml?"
    \n":"
    \n"}list(t,e,i){const r=e?"ol":"ul";return"<"+r+(e&&1!==i?' start="'+i+'"':"")+">\n"+t+"\n"}listitem(t){return`
  • ${t}
  • \n`}checkbox(t){return" "}paragraph(t){return`

    ${t}

    \n`}table(t,e){return e&&(e=`${e}`),"\n\n"+t+"\n"+e+"
    \n"}tablerow(t){return`\n${t}\n`}tablecell(t,e){const i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`\n`}strong(t){return`${t}`}em(t){return`${t}`}codespan(t){return`${t}`}br(){return this.options.xhtml?"
    ":"
    "}del(t){return`${t}`}link(t,e,i){if(null===(t=Ie(this.options.sanitize,this.options.baseUrl,t)))return i;let r='
    ",r}image(t,e,i){if(null===(t=Ie(this.options.sanitize,this.options.baseUrl,t)))return i;let r=`${i}":">",r}text(t){return t}}class Xe{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,e,i){return""+i}image(t,e,i){return""+i}br(){return""}}class Qe{constructor(){this.seen={}}serialize(t){return t.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(t,e){let i=t,r=0;if(this.seen.hasOwnProperty(i)){r=this.seen[t];do{r++,i=t+"-"+r}while(this.seen.hasOwnProperty(i))}return e||(this.seen[t]=r,this.seen[i]=0),i}slug(t,e={}){const i=this.serialize(t);return this.getNextSafeSlug(i,e.dryrun)}}class Je{constructor(t){this.options=t||ye,this.options.renderer=this.options.renderer||new Ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Xe,this.slugger=new Qe}static parse(t,e){return new Je(e).parse(t)}static parseInline(t,e){return new Je(e).parseInline(t)}parse(t,e=!0){let i,r,n,s,a,o,l,h,d,c,p,u,f,m,g,_,y,b,x,w="";const v=t.length;for(i=0;i0&&"paragraph"===g.tokens[0].type?(g.tokens[0].text=b+" "+g.tokens[0].text,g.tokens[0].tokens&&g.tokens[0].tokens.length>0&&"text"===g.tokens[0].tokens[0].type&&(g.tokens[0].tokens[0].text=b+" "+g.tokens[0].tokens[0].text)):g.tokens.unshift({type:"text",text:b}):m+=b),m+=this.parse(g.tokens,f),d+=this.renderer.listitem(m,y,_);w+=this.renderer.list(d,p,u);continue;case"html":w+=this.renderer.html(c.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(d=c.tokens?this.parseInline(c.tokens):c.text;i+1{r(t.text,t.lang,(function(e,i){if(e)return s(e);null!=i&&i!==t.text&&(t.text=i,t.escaped=!0),a--,0===a&&s()}))}),0))})),void(0===a&&s())}function r(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"

    An error occurred:

    "+ke(t.message+"",!0)+"
    ";throw t}try{const i=We.lex(t,e);if(e.walkTokens){if(e.async)return Promise.all(ti.walkTokens(i,e.walkTokens)).then((()=>Je.parse(i,e))).catch(r);ti.walkTokens(i,e.walkTokens)}return Je.parse(i,e)}catch(t){r(t)}}ti.options=ti.setOptions=function(t){var e;return De(ti.defaults,t),e=ti.defaults,ye=e,ti},ti.getDefaults=_e,ti.defaults=ye,ti.use=function(...t){const e=ti.defaults.extensions||{renderers:{},childTokens:{}};t.forEach((t=>{const i=De({},t);if(i.async=ti.defaults.async||i.async,t.extensions&&(t.extensions.forEach((t=>{if(!t.name)throw new Error("extension name required");if(t.renderer){const i=e.renderers[t.name];e.renderers[t.name]=i?function(...e){let r=t.renderer.apply(this,e);return!1===r&&(r=i.apply(this,e)),r}:t.renderer}if(t.tokenizer){if(!t.level||"block"!==t.level&&"inline"!==t.level)throw new Error("extension level must be 'block' or 'inline'");e[t.level]?e[t.level].unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&("block"===t.level?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:"inline"===t.level&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}t.childTokens&&(e.childTokens[t.name]=t.childTokens)})),i.extensions=e),t.renderer){const e=ti.defaults.renderer||new Ke;for(const i in t.renderer){const r=e[i];e[i]=(...n)=>{let s=t.renderer[i].apply(e,n);return!1===s&&(s=r.apply(e,n)),s}}i.renderer=e}if(t.tokenizer){const e=ti.defaults.tokenizer||new Ve;for(const i in t.tokenizer){const r=e[i];e[i]=(...n)=>{let s=t.tokenizer[i].apply(e,n);return!1===s&&(s=r.apply(e,n)),s}}i.tokenizer=e}if(t.walkTokens){const e=ti.defaults.walkTokens;i.walkTokens=function(i){let r=[];return r.push(t.walkTokens.call(this,i)),e&&(r=r.concat(e.call(this,i))),r}}ti.setOptions(i)}))},ti.walkTokens=function(t,e){let i=[];for(const r of t)switch(i=i.concat(e.call(ti,r)),r.type){case"table":for(const t of r.header)i=i.concat(ti.walkTokens(t.tokens,e));for(const t of r.rows)for(const r of t)i=i.concat(ti.walkTokens(r.tokens,e));break;case"list":i=i.concat(ti.walkTokens(r.items,e));break;default:ti.defaults.extensions&&ti.defaults.extensions.childTokens&&ti.defaults.extensions.childTokens[r.type]?ti.defaults.extensions.childTokens[r.type].forEach((function(t){i=i.concat(ti.walkTokens(r[t],e))})):r.tokens&&(i=i.concat(ti.walkTokens(r.tokens,e)))}return i},ti.parseInline=function(t,e){if(null==t)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof t)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected");Me(e=De({},ti.defaults,e||{}));try{const i=We.lexInline(t,e);return e.walkTokens&&ti.walkTokens(i,e.walkTokens),Je.parseInline(i,e)}catch(t){if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e.silent)return"

    An error occurred:

    "+ke(t.message+"",!0)+"
    ";throw t}},ti.Parser=Je,ti.parser=Je.parse,ti.Renderer=Ke,ti.TextRenderer=Xe,ti.Lexer=We,ti.lexer=We.lex,ti.Tokenizer=Ve,ti.Slugger=Qe,ti.parse=ti,ti.options,ti.setOptions,ti.use,ti.walkTokens,ti.parseInline,Je.parse,We.lex;const ei={};function ii(e){let i;return{c(){i=v(e[1])},m(t,e){y(t,i,e)},p(t,e){2&e&&E(i,t[1])},i:t,o:t,d(t){t&&b(i)}}}function ri(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h6"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ni(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h5"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function si(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h4"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ai(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h3"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function oi(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h2"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function li(t){let e,i;const r=t[5].default,n=d(r,t,t[4],null);return{c(){e=w("h1"),n&&n.c(),$(e,"id",t[2])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||16&s)&&u(n,r,t,t[4],i?p(r,t[4],s,null):f(t[4]),null),(!i||4&s)&&$(e,"id",t[2])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function hi(t){let e,i,r,n;const s=[li,oi,ai,si,ni,ri,ii],a=[];function o(t,e){return 1===t[0]?0:2===t[0]?1:3===t[0]?2:4===t[0]?3:5===t[0]?4:6===t[0]?5:6}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function di(t,e,i){let r,{$$slots:n={},$$scope:s}=e,{depth:a}=e,{raw:o}=e,{text:l}=e;const{slug:h,getOptions:d}=L(ei),c=d();return t.$$set=t=>{"depth"in t&&i(0,a=t.depth),"raw"in t&&i(1,o=t.raw),"text"in t&&i(3,l=t.text),"$$scope"in t&&i(4,s=t.$$scope)},t.$$.update=()=>{8&t.$$.dirty&&i(2,r=c.headerIds?c.headerPrefix+h(l):void 0)},[a,o,r,l,s,n]}function ci(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("p"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function pi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function ui(t){let e;const i=t[3].default,r=d(i,t,t[2],null);return{c(){r&&r.c()},m(t,i){r&&r.m(t,i),e=!0},p(t,[n]){r&&r.p&&(!e||4&n)&&u(r,i,t,t[2],e?p(i,t[2],n,null):f(t[2]),null)},i(t){e||(Q(r,t),e=!0)},o(t){J(r,t),e=!1},d(t){r&&r.d(t)}}}function fi(t,e,i){let{$$slots:r={},$$scope:n}=e,{text:s}=e,{raw:a}=e;return t.$$set=t=>{"text"in t&&i(0,s=t.text),"raw"in t&&i(1,a=t.raw),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function mi(e){let i,r;return{c(){i=w("img"),h(i.src,r=e[0])||$(i,"src",r),$(i,"title",e[1]),$(i,"alt",e[2])},m(t,e){y(t,i,e)},p(t,[e]){1&e&&!h(i.src,r=t[0])&&$(i,"src",r),2&e&&$(i,"title",t[1]),4&e&&$(i,"alt",t[2])},i:t,o:t,d(t){t&&b(i)}}}function gi(t,e,i){let{href:r=""}=e,{title:n}=e,{text:s=""}=e;return t.$$set=t=>{"href"in t&&i(0,r=t.href),"title"in t&&i(1,n=t.title),"text"in t&&i(2,s=t.text)},[r,n,s]}function _i(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("a"),n&&n.c(),$(e,"href",t[0]),$(e,"title",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[s]){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||1&s)&&$(e,"href",t[0]),(!i||2&s)&&$(e,"title",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function yi(t,e,i){let{$$slots:r={},$$scope:n}=e,{href:s=""}=e,{title:a}=e;return t.$$set=t=>{"href"in t&&i(0,s=t.href),"title"in t&&i(1,a=t.title),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function bi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("em"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function xi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function wi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("del"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function vi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Si(e){let i,r,n=e[0].replace(/`/g,"")+"";return{c(){i=w("code"),r=v(n)},m(t,e){y(t,i,e),_(i,r)},p(t,[e]){1&e&&n!==(n=t[0].replace(/`/g,"")+"")&&E(r,n)},i:t,o:t,d(t){t&&b(i)}}}function Ui(t,e,i){let{raw:r}=e;return t.$$set=t=>{"raw"in t&&i(0,r=t.raw)},[r]}function ki(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("strong"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function $i(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ei(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("table"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ti(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function zi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("thead"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ai(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Bi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("tbody"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ii(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ci(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("tr"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Pi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Fi(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("td"),n&&n.c(),$(e,"align",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"align",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Li(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("th"),n&&n.c(),$(e,"align",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"align",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ri(t){let e,i,r,n;const s=[Li,Fi],a=[];function o(t,e){return t[0]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Di(t,e,i){let{$$slots:r={},$$scope:n}=e,{header:s}=e,{align:a}=e;return t.$$set=t=>{"header"in t&&i(0,s=t.header),"align"in t&&i(1,a=t.align),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function Ni(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("ul"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,e){n&&n.p&&(!i||4&e)&&u(n,r,t,t[2],i?p(r,t[2],e,null):f(t[2]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Oi(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("ol"),n&&n.c(),$(e,"start",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,s){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||2&s)&&$(e,"start",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Mi(t){let e,i,r,n;const s=[Oi,Ni],a=[];function o(t,e){return t[0]?0:1}return e=o(t),i=a[e]=s[e](t),{c(){i.c(),r=U()},m(t,i){a[e].m(t,i),y(t,r,i),n=!0},p(t,[n]){let l=e;e=o(t),e===l?a[e].p(t,n):(K(),J(a[l],1,1,(()=>{a[l]=null})),X(),i=a[e],i?i.p(t,n):(i=a[e]=s[e](t),i.c()),Q(i,1),i.m(r.parentNode,r))},i(t){n||(Q(i),n=!0)},o(t){J(i),n=!1},d(t){a[e].d(t),t&&b(r)}}}function Gi(t,e,i){let{$$slots:r={},$$scope:n}=e,{ordered:s}=e,{start:a}=e;return t.$$set=t=>{"ordered"in t&&i(0,s=t.ordered),"start"in t&&i(1,a=t.start),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}function Hi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("li"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Vi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Yi(e){let i;return{c(){i=w("hr")},m(t,e){y(t,i,e)},p:t,i:t,o:t,d(t){t&&b(i)}}}function ji(e){let i,r;return{c(){i=new z(!1),r=U(),i.a=r},m(t,n){i.m(e[0],t,n),y(t,r,n)},p(t,[e]){1&e&&i.p(t[0])},i:t,o:t,d(t){t&&b(r),t&&i.d()}}}function qi(t,e,i){let{text:r}=e;return t.$$set=t=>{"text"in t&&i(0,r=t.text)},[r]}function Zi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("blockquote"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Wi(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}function Ki(e){let i,r,n;return{c(){i=w("pre"),r=w("code"),n=v(e[1]),$(i,"class",e[0])},m(t,e){y(t,i,e),_(i,r),_(r,n)},p(t,[e]){2&e&&E(n,t[1]),1&e&&$(i,"class",t[0])},i:t,o:t,d(t){t&&b(i)}}}function Xi(t,e,i){let{lang:r}=e,{text:n}=e;return t.$$set=t=>{"lang"in t&&i(0,r=t.lang),"text"in t&&i(1,n=t.text)},[r,n]}function Qi(t){let e,i;const r=t[1].default,n=d(r,t,t[0],null);return{c(){e=w("br"),n&&n.c()},m(t,r){y(t,e,r),n&&n.m(t,r),i=!0},p(t,[e]){n&&n.p&&(!i||1&e)&&u(n,r,t,t[0],i?p(r,t[0],e,null):f(t[0]),null)},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function Ji(t,e,i){let{$$slots:r={},$$scope:n}=e;return t.$$set=t=>{"$$scope"in t&&i(0,n=t.$$scope)},[n,r]}const tr={heading:class extends ht{constructor(t){super(),lt(this,t,di,hi,a,{depth:0,raw:1,text:3})}},paragraph:class extends ht{constructor(t){super(),lt(this,t,pi,ci,a,{})}},text:class extends ht{constructor(t){super(),lt(this,t,fi,ui,a,{text:0,raw:1})}},image:class extends ht{constructor(t){super(),lt(this,t,gi,mi,a,{href:0,title:1,text:2})}},link:class extends ht{constructor(t){super(),lt(this,t,yi,_i,a,{href:0,title:1})}},em:class extends ht{constructor(t){super(),lt(this,t,xi,bi,a,{})}},strong:class extends ht{constructor(t){super(),lt(this,t,$i,ki,a,{})}},codespan:class extends ht{constructor(t){super(),lt(this,t,Ui,Si,a,{raw:0})}},del:class extends ht{constructor(t){super(),lt(this,t,vi,wi,a,{})}},table:class extends ht{constructor(t){super(),lt(this,t,Ti,Ei,a,{})}},tablehead:class extends ht{constructor(t){super(),lt(this,t,Ai,zi,a,{})}},tablebody:class extends ht{constructor(t){super(),lt(this,t,Ii,Bi,a,{})}},tablerow:class extends ht{constructor(t){super(),lt(this,t,Pi,Ci,a,{})}},tablecell:class extends ht{constructor(t){super(),lt(this,t,Di,Ri,a,{header:0,align:1})}},list:class extends ht{constructor(t){super(),lt(this,t,Gi,Mi,a,{ordered:0,start:1})}},orderedlistitem:null,unorderedlistitem:null,listitem:class extends ht{constructor(t){super(),lt(this,t,Vi,Hi,a,{})}},hr:class extends ht{constructor(t){super(),lt(this,t,null,Yi,a,{})}},html:class extends ht{constructor(t){super(),lt(this,t,qi,ji,a,{text:0})}},blockquote:class extends ht{constructor(t){super(),lt(this,t,Wi,Zi,a,{})}},code:class extends ht{constructor(t){super(),lt(this,t,Xi,Ki,a,{lang:0,text:1})}},br:class extends ht{constructor(t){super(),lt(this,t,Ji,Qi,a,{})}}},er={baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,xhtml:!1};function ir(t){let e,i;return e=new ge({props:{tokens:t[0],renderers:t[1]}}),{c(){nt(e.$$.fragment)},m(t,r){st(e,t,r),i=!0},p(t,[i]){const r={};1&i&&(r.tokens=t[0]),2&i&&(r.renderers=t[1]),e.$set(r)},i(t){i||(Q(e.$$.fragment,t),i=!0)},o(t){J(e.$$.fragment,t),i=!1},d(t){at(e,t)}}}function rr(t,e,i){let r,n,s,a,{source:o=[]}=e,{renderers:l={}}=e,{options:h={}}=e,{isInline:d=!1}=e;const c=P();let p,u,f;return F(ei,{slug:t=>n?n.slug(t):"",getOptions:()=>s}),C((()=>{i(7,f=!0)})),t.$$set=t=>{"source"in t&&i(2,o=t.source),"renderers"in t&&i(3,l=t.renderers),"options"in t&&i(4,h=t.options),"isInline"in t&&i(5,d=t.isInline)},t.$$.update=()=>{4&t.$$.dirty&&i(8,r=Array.isArray(o)),4&t.$$.dirty&&(n=o?new Qe:void 0),16&t.$$.dirty&&i(9,s={...er,...h}),869&t.$$.dirty&&(r?i(0,p=o):(i(6,u=new We(s)),i(0,p=d?u.inlineTokens(o):u.lex(o)),c("parsed",{tokens:p}))),8&t.$$.dirty&&i(1,a={...tr,...l}),385&t.$$.dirty&&f&&!r&&c("parsed",{tokens:p})},[p,a,o,l,h,d,u,f,r,s]}class nr extends ht{constructor(t){super(),lt(this,t,rr,ir,a,{source:2,renderers:3,options:4,isInline:5})}}function sr(t){let e,i;const r=t[3].default,n=d(r,t,t[2],null);return{c(){e=w("a"),n&&n.c(),$(e,"target","_blank"),$(e,"rel","noopener noreferrer"),$(e,"href",t[0]),$(e,"title",t[1])},m(t,r){y(t,e,r),n&&n.m(e,null),i=!0},p(t,[s]){n&&n.p&&(!i||4&s)&&u(n,r,t,t[2],i?p(r,t[2],s,null):f(t[2]),null),(!i||1&s)&&$(e,"href",t[0]),(!i||2&s)&&$(e,"title",t[1])},i(t){i||(Q(n,t),i=!0)},o(t){J(n,t),i=!1},d(t){t&&b(e),n&&n.d(t)}}}function ar(t,e,i){let{$$slots:r={},$$scope:n}=e,{href:s=""}=e,{title:a}=e;return t.$$set=t=>{"href"in t&&i(0,s=t.href),"title"in t&&i(1,a=t.title),"$$scope"in t&&i(2,n=t.$$scope)},[s,a,n,r]}class or extends ht{constructor(t){super(),lt(this,t,ar,sr,a,{href:0,title:1})}}function lr(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function hr(e){let i,r;return i=new nr({props:{source:e[2],renderers:e[1]}}),{c(){nt(i.$$.fragment)},m(t,e){st(i,t,e),r=!0},p:t,i(t){r||(Q(i.$$.fragment,t),r=!0)},o(t){J(i.$$.fragment,t),r=!1},d(t){at(i,t)}}}function dr(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function cr(t){let e,i,r={ctx:t,current:null,token:null,hasCatch:!1,pending:dr,then:hr,catch:lr,value:2,blocks:[,,,]};return tt(t[0],r),{c(){e=w("div"),r.block.c(),$(e,"class","docs markdown-body svelte-bew0xw")},m(t,n){y(t,e,n),r.block.m(e,r.anchor=null),r.mount=()=>e,r.anchor=null,i=!0},p(e,[i]){et(r,t=e,i)},i(t){i||(Q(r.block),i=!0)},o(t){for(let t=0;t<3;t+=1){J(r.blocks[t])}i=!1},d(t){t&&b(e),r.block.d(),r.token=null,r=null}}}function pr(t){return[fetch("README.md").then((t=>t.text())),{link:or}]}class ur extends ht{constructor(t){super(),lt(this,t,pr,cr,a,{})}}function fr(e){let i,r,n,s,a,o;return i=new mt({}),n=new Pt({}),a=new ur({}),{c(){nt(i.$$.fragment),r=S(),nt(n.$$.fragment),s=S(),nt(a.$$.fragment)},m(t,e){st(i,t,e),y(t,r,e),st(n,t,e),y(t,s,e),st(a,t,e),o=!0},p:t,i(t){o||(Q(i.$$.fragment,t),Q(n.$$.fragment,t),Q(a.$$.fragment,t),o=!0)},o(t){J(i.$$.fragment,t),J(n.$$.fragment,t),J(a.$$.fragment,t),o=!1},d(t){at(i,t),t&&b(r),at(n,t),t&&b(s),at(a,t)}}}function mr(t){return F("npm",fetch("https://registry.npmjs.org/scrolly-video").then((t=>t.json()))),[]}return new class extends ht{constructor(t){super(),lt(this,t,mr,fr,a,{})}}({target:document.body})}();