@byomakase/omakase-react-components 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -4,9 +4,9 @@
4
4
  * https://github.com/MikeMcl/decimal.js
5
5
  * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
6
6
  * MIT Licence
7
- */var Ge=9e15,le=1e9,Ye="0123456789abcdef",_e="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",xe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ze={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:Ge,crypto:!1},wt,se,L=!0,Ne="[DecimalError] ",fe=Ne+"Invalid argument: ",Et=Ne+"Precision limit exceeded",St=Ne+"crypto unavailable",Tt="[object Decimal]",q=Math.floor,K=Math.pow,Fn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Vn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Bn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,yt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q=1e7,M=7,Pn=9007199254740991,Rn=_e.length-1,Je=xe.length-1,g={toStringTag:Tt};g.absoluteValue=g.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),C(t)},g.ceil=function(){return C(new this.constructor(this),this.e+1,2)},g.clampedTo=g.clamp=function(t,e){var n,r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(fe+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)},g.comparedTo=g.cmp=function(t){var e,n,r,i,o=this,s=o.d,u=(t=new o.constructor(t)).d,c=o.s,a=t.s;if(!s||!u)return!c||!a?NaN:c!==a?c:s===u?0:!s^c<0?1:-1;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=u.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},g.cosine=g.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+M,r.rounding=1,n=Un(r,Ot(r,n)),r.precision=t,r.rounding=e,C(se==2||se==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)},g.cubeRoot=g.cbrt=function(){var t,e,n,r,i,o,s,u,c,a,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(L=!1,o=l.s*K(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=Z(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=K(n,1/3),t=q((t+1)/3)-(t%3==(t<0?-1:2)),o==1/0?n="5e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new f(n),r.s=l.s):r=new f(o.toString()),s=(t=f.precision)+3;;)if(u=r,c=u.times(u).times(u),a=c.plus(l),r=F(a.plus(l).times(u),a.plus(c),s+2,1),Z(u.d).slice(0,s)===(n=Z(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(C(u,t+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(C(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return L=!0,C(r,t,f.rounding,e)},g.decimalPlaces=g.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-q(this.e/M))*M,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},g.dividedBy=g.div=function(t){return F(this,new this.constructor(t))},g.dividedToIntegerBy=g.divToInt=function(t){var e=this,n=e.constructor;return C(F(e,new n(t),0,1,1),n.precision,n.rounding)},g.equals=g.eq=function(t){return this.cmp(t)===0},g.floor=function(){return C(new this.constructor(this),this.e+1,3)},g.greaterThan=g.gt=function(t){return this.cmp(t)>0},g.greaterThanOrEqualTo=g.gte=function(t){var e=this.cmp(t);return e==1||e===0},g.hyperbolicCosine=g.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(t=Math.ceil(i/3),e=(1/Ve(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=be(s,1,o.times(e),new s(1),!0);for(var c,a=t,l=new s(8);a--;)c=o.times(o),o=u.minus(c.times(l.minus(c.times(l))));return C(o,s.precision=n,s.rounding=r,!0)},g.hyperbolicSine=g.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=be(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/Ve(5,t)),i=be(o,2,i,i,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);t--;)s=i.times(i),i=i.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=n,C(i,e,n,!0)},g.hyperbolicTangent=g.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,F(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},g.inverseCosine=g.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?e.isNeg()?ee(n,i,o):new n(0):new n(NaN):e.isZero()?ee(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ee(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},g.inverseHyperbolicCosine=g.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,L=!1,n=n.times(n).minus(1).sqrt().plus(n),L=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},g.inverseHyperbolicSine=g.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,L=!1,n=n.times(n).plus(1).sqrt().plus(n),L=!0,r.precision=t,r.rounding=e,n.ln())},g.inverseHyperbolicTangent=g.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?C(new o(i),t,e,!0):(o.precision=n=r-i.e,i=F(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},g.inverseSine=g.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,e!==-1?e===0?(t=ee(o,n+4,r).times(.5),t.s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},g.inverseTangent=g.atan=function(){var t,e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(a.isFinite()){if(a.isZero())return new l(a);if(a.abs().eq(1)&&f+4<=Je)return s=ee(l,f+4,d).times(.25),s.s=a.s,s}else{if(!a.s)return new l(NaN);if(f+4<=Je)return s=ee(l,f+4,d).times(.5),s.s=a.s,s}for(l.precision=u=f+10,l.rounding=1,n=Math.min(28,u/M+2|0),t=n;t;--t)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(L=!1,e=Math.ceil(u/M),r=1,c=a.times(a),s=new l(a),i=a;t!==-1;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<<n-1)),L=!0,C(s,l.precision=f,l.rounding=d,!0)},g.isFinite=function(){return!!this.d},g.isInteger=g.isInt=function(){return!!this.d&&q(this.e/M)>this.d.length-2},g.isNaN=function(){return!this.s},g.isNegative=g.isNeg=function(){return this.s<0},g.isPositive=g.isPos=function(){return this.s>0},g.isZero=function(){return!!this.d&&this.d[0]===0},g.lessThan=g.lt=function(t){return this.cmp(t)<0},g.lessThanOrEqualTo=g.lte=function(t){return this.cmp(t)<1},g.logarithm=g.log=function(t){var e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding,m=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),n=t.d,t.s<0||!n||!n[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(n=a.d,a.s<0||!n||!n[0]||a.eq(1))return new l(n&&!n[0]?-1/0:a.s!=1?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(L=!1,u=f+m,s=me(a,u),r=e?Fe(l,u+10):me(t,u),c=F(s,r,u,1),Ce(c.d,i=f,d))do if(u+=10,s=me(a,u),r=e?Fe(l,u+10):me(t,u),c=F(s,r,u,1),!o){+Z(c.d).slice(i+1,i+15)+1==1e14&&(c=C(c,f+1,0));break}while(Ce(c.d,i+=10,d));return L=!0,C(c,f,d)},g.minus=g.sub=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.constructor;if(t=new h(t),!m.d||!t.d)return!m.s||!t.s?t=new h(NaN):m.d?t.s=-t.s:t=new h(t.d||m.s!==t.s?m:NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(a=m.d,d=t.d,u=h.precision,c=h.rounding,!a[0]||!d[0]){if(d[0])t.s=-t.s;else if(a[0])t=new h(m);else return new h(c===3?-0:0);return L?C(t,u,c):t}if(n=q(t.e/M),l=q(m.e/M),a=a.slice(),o=l-n,o){for(f=o<0,f?(e=a,o=-o,s=d.length):(e=d,n=l,s=a.length),r=Math.max(Math.ceil(u/M),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=a.length,s=d.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(a[r]!=d[r]){f=a[r]<d[r];break}o=0}for(f&&(e=a,a=d,d=e,t.s=-t.s),s=a.length,r=d.length-s;r>0;--r)a[s++]=0;for(r=d.length;r>o;){if(a[--r]<d[r]){for(i=r;i&&a[--i]===0;)a[i]=Q-1;--a[i],a[r]+=Q}a[r]-=d[r]}for(;a[--s]===0;)a.pop();for(;a[0]===0;a.shift())--n;return a[0]?(t.d=a,t.e=De(a,n),L?C(t,u,c):t):new h(c===3?-0:0)},g.modulo=g.mod=function(t){var e,n=this,r=n.constructor;return t=new r(t),!n.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||n.d&&!n.d[0]?C(new r(n),r.precision,r.rounding):(L=!1,r.modulo==9?(e=F(n,t.abs(),0,3,1),e.s*=t.s):e=F(n,t,0,r.modulo,1),e=e.times(t),L=!0,n.minus(e))},g.naturalExponential=g.exp=function(){return Qe(this)},g.naturalLogarithm=g.ln=function(){return me(this)},g.negated=g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,C(t)},g.plus=g.add=function(t){var e,n,r,i,o,s,u,c,a,l,f=this,d=f.constructor;if(t=new d(t),!f.d||!t.d)return!f.s||!t.s?t=new d(NaN):f.d||(t=new d(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(a=f.d,l=t.d,u=d.precision,c=d.rounding,!a[0]||!l[0])return l[0]||(t=new d(f)),L?C(t,u,c):t;if(o=q(f.e/M),r=q(t.e/M),a=a.slice(),i=o-r,i){for(i<0?(n=a,i=-i,s=l.length):(n=l,r=o,s=a.length),o=Math.ceil(u/M),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=a.length,i=l.length,s-i<0&&(i=s,n=l,l=a,a=n),e=0;i;)e=(a[--i]=a[i]+l[i]+e)/Q|0,a[i]%=Q;for(e&&(a.unshift(e),++r),s=a.length;a[--s]==0;)a.pop();return t.d=a,t.e=De(a,r),L?C(t,u,c):t},g.precision=g.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(fe+t);return n.d?(e=Ct(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},g.round=function(){var t=this,e=t.constructor;return C(new e(t),t.e+1,e.rounding)},g.sine=g.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+M,r.rounding=1,n=Hn(r,Ot(r,n)),r.precision=t,r.rounding=e,C(se>2?n.neg():n,t,e,!0)):new r(NaN)},g.squareRoot=g.sqrt=function(){var t,e,n,r,i,o,s=this,u=s.d,c=s.e,a=s.s,l=s.constructor;if(a!==1||!u||!u[0])return new l(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(L=!1,a=Math.sqrt(+s),a==0||a==1/0?(e=Z(u),(e.length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=q((c+1)/2)-(c<0||c%2),a==1/0?e="5e"+c:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(a.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(F(s,o,n+2,1)).times(.5),Z(o.d).slice(0,n)===(e=Z(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(C(o,c+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(C(r,c+1,1),t=!r.times(r).eq(s));break}return L=!0,C(r,c,l.rounding,t)},g.tangent=g.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,n=n.sin(),n.s=1,n=F(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,C(se==2||se==4?n.neg():n,t,e,!0)):new r(NaN)},g.times=g.mul=function(t){var e,n,r,i,o,s,u,c,a,l=this,f=l.constructor,d=l.d,m=(t=new f(t)).d;if(t.s*=l.s,!d||!d[0]||!m||!m[0])return new f(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?t.s/0:t.s*0);for(n=q(l.e/M)+q(t.e/M),c=d.length,a=m.length,c<a&&(o=d,d=m,m=o,s=c,c=a,a=s),o=[],s=c+a,r=s;r--;)o.push(0);for(r=a;--r>=0;){for(e=0,i=c+r;i>r;)u=o[i]+m[r]*d[i-r-1]+e,o[i--]=u%Q|0,e=u/Q|0;o[i]=(o[i]+e)%Q|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=De(o,n),L?C(t,f.precision,f.rounding):t},g.toBinary=function(t,e){return tt(this,2,t,e)},g.toDecimalPlaces=g.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(j(t,0,le),e===void 0?e=r.rounding:j(e,0,8),C(n,t+n.e+1,e))},g.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=re(r,!0):(j(t,0,le),e===void 0?e=i.rounding:j(e,0,8),r=C(new i(r),t+1,e),n=re(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},g.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=re(i):(j(t,0,le),e===void 0?e=o.rounding:j(e,0,8),r=C(new o(i),t+i.e+1,e),n=re(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},g.toFraction=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.d,p=m.constructor;if(!h)return new p(m);if(a=n=new p(1),r=c=new p(0),e=new p(r),o=e.e=Ct(h)-m.e-1,s=o%M,e.d[0]=K(10,s<0?M+s:s),t==null)t=o>0?e:a;else{if(u=new p(t),!u.isInt()||u.lt(a))throw Error(fe+u);t=u.gt(e)?o>0?e:a:u}for(L=!1,u=new p(Z(h)),l=p.precision,p.precision=o=h.length*M*2;f=F(u,e,0,1,1),i=n.plus(f.times(r)),i.cmp(t)!=1;)n=r,r=i,i=a,a=c.plus(f.times(i)),c=i,i=e,e=u.minus(f.times(i)),u=i;return i=F(t.minus(n),r,0,1,1),c=c.plus(i.times(a)),n=n.plus(i.times(r)),c.s=a.s=m.s,d=F(a,r,o,1).minus(m).abs().cmp(F(c,n,o,1).minus(m).abs())<1?[a,r]:[c,n],p.precision=l,L=!0,d},g.toHexadecimal=g.toHex=function(t,e){return tt(this,16,t,e)},g.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),t==null){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),e===void 0?e=r.rounding:j(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(L=!1,n=F(n,t,0,e,1).times(t),L=!0,C(n)):(t.s=n.s,n=t),n},g.toNumber=function(){return+this},g.toOctal=function(t,e){return tt(this,8,t,e)},g.toPower=g.pow=function(t){var e,n,r,i,o,s,u=this,c=u.constructor,a=+(t=new c(t));if(!u.d||!t.d||!u.d[0]||!t.d[0])return new c(K(+u,a));if(u=new c(u),u.eq(1))return u;if(r=c.precision,o=c.rounding,t.eq(1))return C(u,r,o);if(e=q(t.e/M),e>=t.d.length-1&&(n=a<0?-a:a)<=Pn)return i=Mt(c,u,n,r),t.s<0?new c(1).div(i):C(i,r,o);if(s=u.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=s,u}return n=K(+u,a),e=n==0||!isFinite(n)?q(a*(Math.log("0."+Z(u.d))/Math.LN10+u.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(L=!1,c.rounding=u.s=1,n=Math.min(12,(e+"").length),i=Qe(t.times(me(u,r+n)),r),i.d&&(i=C(i,r+5,1),Ce(i.d,r,o)&&(e=r+10,i=C(Qe(t.times(me(u,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=C(i,r+1,0)))),i.s=s,L=!0,c.rounding=o,C(i,r,o))},g.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=re(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(j(t,1,le),e===void 0?e=i.rounding:j(e,0,8),r=C(new i(r),t,e),n=re(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},g.toSignificantDigits=g.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(j(t,1,le),e===void 0?e=r.rounding:j(e,0,8)),C(new r(n),t,e)},g.toString=function(){var t=this,e=t.constructor,n=re(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},g.truncated=g.trunc=function(){return C(new this.constructor(this),this.e+1,1)},g.valueOf=g.toJSON=function(){var t=this,e=t.constructor,n=re(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function Z(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)r=t[e]+"",n=M-r.length,n&&(o+=de(n)),o+=r;s=t[e],r=s+"",n=M-r.length,n&&(o+=de(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function j(t,e,n){if(t!==~~t||t<e||t>n)throw Error(fe+t)}function Ce(t,e,n,r){var i,o,s,u;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=M,i=0):(i=Math.ceil((e+1)/M),e%=M),o=K(10,M-e),u=t[i]%o|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),s=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(t[i+1]/o/100|0)==K(10,e-2)-1||(u==o/2||u==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),s=(r||n<4)&&u==9999||!r&&n>3&&u==4999):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(t[i+1]/o/1e3|0)==K(10,e-3)-1,s}function ke(t,e,n){for(var r,i=[0],o,s=0,u=t.length;s<u;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=Ye.indexOf(t.charAt(s++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Un(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/Ve(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=be(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}var F=function(){function t(r,i,o){var s,u=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+u,r[c]=s%o|0,u=s/o|0;return u&&r.unshift(u),r}function e(r,i,o,s){var u,c;if(o!=s)c=o>s?1:-1;else for(u=c=0;u<o;u++)if(r[u]!=i[u]){c=r[u]>i[u]?1:-1;break}return c}function n(r,i,o,s){for(var u=0;o--;)r[o]-=u,u=r[o]<i[o]?1:0,r[o]=u*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,u,c){var a,l,f,d,m,h,p,w,E,x,A,D,V,_,Y,oe,z,Te,$,ue,ce=r.constructor,ye=r.s==i.s?1:-1,U=r.d,k=i.d;if(!U||!U[0]||!k||!k[0])return new ce(!r.s||!i.s||(U?k&&U[0]==k[0]:!k)?NaN:U&&U[0]==0||!k?ye*0:ye/0);for(c?(m=1,l=r.e-i.e):(c=Q,m=M,l=q(r.e/m)-q(i.e/m)),$=k.length,z=U.length,E=new ce(ye),x=E.d=[],f=0;k[f]==(U[f]||0);f++);if(k[f]>(U[f]||0)&&l--,o==null?(_=o=ce.precision,s=ce.rounding):u?_=o+(r.e-i.e)+1:_=o,_<0)x.push(1),h=!0;else{if(_=_/m+2|0,f=0,$==1){for(d=0,k=k[0],_++;(f<z||d)&&_--;f++)Y=d*c+(U[f]||0),x[f]=Y/k|0,d=Y%k|0;h=d||f<z}else{for(d=c/(k[0]+1)|0,d>1&&(k=t(k,d,c),U=t(U,d,c),$=k.length,z=U.length),oe=$,A=U.slice(0,$),D=A.length;D<$;)A[D++]=0;ue=k.slice(),ue.unshift(0),Te=k[0],k[1]>=c/2&&++Te;do d=0,a=e(k,A,$,D),a<0?(V=A[0],$!=D&&(V=V*c+(A[1]||0)),d=V/Te|0,d>1?(d>=c&&(d=c-1),p=t(k,d,c),w=p.length,D=A.length,a=e(p,A,w,D),a==1&&(d--,n(p,$<w?ue:k,w,c))):(d==0&&(a=d=1),p=k.slice()),w=p.length,w<D&&p.unshift(0),n(A,p,D,c),a==-1&&(D=A.length,a=e(k,A,$,D),a<1&&(d++,n(A,$<D?ue:k,D,c))),D=A.length):a===0&&(d++,A=[0]),x[f++]=d,a&&A[0]?A[D++]=U[oe]||0:(A=[U[oe]],D=1);while((oe++<z||A[0]!==void 0)&&_--);h=A[0]!==void 0}x[0]||x.shift()}if(m==1)E.e=l,wt=h;else{for(f=1,d=x[0];d>=10;d/=10)f++;E.e=f+l*m-1,C(E,u?o+E.e+1:o,s,h)}return E}}();function C(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,u=f[0];u>=10;u/=10)i++;if(o=e-i,o<0)o+=M,s=e,l=f[d=0],c=l/K(10,i-s-1)%10|0;else if(d=Math.ceil((o+1)/M),u=f.length,d>=u)if(r){for(;u++<=d;)f.push(0);l=c=0,i=1,o%=M,s=o-M+1}else break e;else{for(l=u=f[d],i=1;u>=10;u/=10)i++;o%=M,s=o-M+i,c=s<0?0:l/K(10,i-s-1)%10|0}if(r=r||e<0||f[d+1]!==void 0||(s<0?l:l%K(10,i-s-1)),a=n<4?(c||r)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(o>0?s>0?l/K(10,i-s):0:f[d-1])%10&1||n==(t.s<0?8:7)),e<1||!f[0])return f.length=0,a?(e-=t.e+1,f[0]=K(10,(M-e%M)%M),t.e=-e||0):f[0]=t.e=0,t;if(o==0?(f.length=d,u=1,d--):(f.length=d+1,u=K(10,M-o),f[d]=s>0?(l/K(10,i-s)%K(10,s)|0)*u:0),a)for(;;)if(d==0){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(t.e++,f[0]==Q&&(f[0]=1));break}else{if(f[d]+=u,f[d]!=Q)break;f[d--]=0,u=1}for(o=f.length;f[--o]===0;)f.pop()}return L&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function re(t,e,n){if(!t.isFinite())return It(t);var r,i=t.e,o=Z(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+de(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+de(-i-1)+o,n&&(r=n-s)>0&&(o+=de(r))):i>=s?(o+=de(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+de(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=de(r))),o}function De(t,e){var n=t[0];for(e*=M;n>=10;n/=10)e++;return e}function Fe(t,e,n){if(e>Rn)throw L=!0,n&&(t.precision=n),Error(Et);return C(new t(_e),e,1,!0)}function ee(t,e,n){if(e>Je)throw Error(Et);return C(new t(xe),e,n,!0)}function Ct(t){var e=t.length-1,n=e*M+1;if(e=t[e],e){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function de(t){for(var e="";t--;)e+="0";return e}function Mt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/M+4);for(L=!1;;){if(n%2&&(o=o.times(e),_t(o.d,s)&&(i=!0)),n=q(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),_t(e.d,s)}return L=!0,o}function Lt(t){return t.d[t.d.length-1]&1}function At(t,e,n){for(var r,i=new t(e[0]),o=0;++o<e.length;)if(r=new t(e[o]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function Qe(t,e){var n,r,i,o,s,u,c,a=0,l=0,f=0,d=t.constructor,m=d.rounding,h=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(L=!1,c=h):c=e,u=new d(.03125);t.e>-2;)t=t.times(u),f+=5;for(r=Math.log(K(2,f))/Math.LN10*2+5|0,c+=r,n=o=s=new d(1),d.precision=c;;){if(o=C(o.times(t),c,1),n=n.times(++l),u=s.plus(F(o,n,c,1)),Z(u.d).slice(0,c)===Z(s.d).slice(0,c)){for(i=f;i--;)s=C(s.times(s),c,1);if(e==null)if(a<3&&Ce(s.d,c-r,m,a))d.precision=c+=10,n=o=u=new d(1),l=0,a++;else return C(s,d.precision=h,m,L=!0);else return d.precision=h,s}s=u}}function me(t,e){var n,r,i,o,s,u,c,a,l,f,d,m=1,h=10,p=t,w=p.d,E=p.constructor,x=E.rounding,A=E.precision;if(p.s<0||!w||!w[0]||!p.e&&w[0]==1&&w.length==1)return new E(w&&!w[0]?-1/0:p.s!=1?NaN:w?0:p);if(e==null?(L=!1,l=A):l=e,E.precision=l+=h,n=Z(w),r=n.charAt(0),Math.abs(o=p.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Z(p.d),r=n.charAt(0),m++;o=p.e,r>1?(p=new E("0."+n),o++):p=new E(r+"."+n.slice(1))}else return a=Fe(E,l+2,A).times(o+""),p=me(new E(r+"."+n.slice(1)),l-h).plus(a),E.precision=A,e==null?C(p,A,x,L=!0):p;for(f=p,c=s=p=F(p.minus(1),p.plus(1),l,1),d=C(p.times(p),l,1),i=3;;){if(s=C(s.times(d),l,1),a=c.plus(F(s,new E(i),l,1)),Z(a.d).slice(0,l)===Z(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Fe(E,l+2,A).times(o+""))),c=F(c,new E(m),l,1),e==null)if(Ce(c.d,l-h,x,u))E.precision=l+=h,a=s=p=F(f.minus(1),f.plus(1),l,1),d=C(p.times(p),l,1),i=u=1;else return C(c,E.precision=A,x,L=!0);else return E.precision=A,c;c=a,i+=2}}function It(t){return String(t.s*t.s/0)}function et(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%M,n<0&&(r+=M),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=M;r<i;)t.d.push(+e.slice(r,r+=M));e=e.slice(r),r=M-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),L&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Kn(t,e){var n,r,i,o,s,u,c,a,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),yt.test(e))return et(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Vn.test(e))n=16,e=e.toLowerCase();else if(Fn.test(e))n=2;else if(Bn.test(e))n=8;else throw Error(fe+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,r=t.constructor,s&&(e=e.replace(".",""),u=e.length,o=u-o,i=Mt(r,new r(n),o,o*2)),a=ke(e,n,Q),l=a.length-1,o=l;a[o]===0;--o)a.pop();return o<0?new r(t.s*0):(t.e=De(a,l),t.d=a,L=!1,s&&(t=F(t,i,u*4)),c&&(t=t.times(Math.abs(c)<54?K(2,c):Me.pow(2,c))),L=!0,t)}function Hn(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:be(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/Ve(5,n)),e=be(t,2,e,e);for(var i,o=new t(5),s=new t(16),u=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(u))));return e}function be(t,e,n,r,i){var o,s,u,c,a=t.precision,l=Math.ceil(a/M);for(L=!1,c=n.times(n),u=new t(r);;){if(s=F(u.times(c),new t(e++*e++),a,1),u=i?r.plus(s):r.minus(s),r=F(s.times(c),new t(e++*e++),a,1),s=u.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=s,s=o}return L=!0,s.d.length=l+1,s}function Ve(t,e){for(var n=t;--e;)n*=t;return n}function Ot(t,e){var n,r=e.s<0,i=ee(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return se=r?4:1,e;if(n=e.divToInt(i),n.isZero())se=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return se=Lt(n)?r?2:3:r?4:1,e;se=Lt(n)?r?1:4:r?3:2}return e.minus(i).abs()}function tt(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor,h=n!==void 0;if(h?(j(n,1,le),r===void 0?r=m.rounding:j(r,0,8)):(n=m.precision,r=m.rounding),!t.isFinite())l=It(t);else{for(l=re(t),s=l.indexOf("."),h?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new m(1),d.e=l.length-s,d.d=ke(re(d),10,i),d.e=d.d.length),f=ke(l,10,i),o=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(s<0?o--:(t=new m(t),t.d=f,t.e=o,t=F(t,d,n,r,0,i),f=t.d,o=t.e,a=wt),s=f[n],u=i/2,a=a||f[n+1]!==void 0,a=r<4?(s!==void 0||a)&&(r===0||r===(t.s<0?3:2)):s>u||s===u&&(r===4||a||r===6&&f[n-1]&1||r===(t.s<0?8:7)),f.length=n,a)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=Ye.charAt(f[s]);if(h){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(f=ke(l,i,e),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Ye.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function _t(t,e){if(t.length>e)return t.length=e,!0}function $n(t){return new this(t).abs()}function Zn(t){return new this(t).acos()}function qn(t){return new this(t).acosh()}function Xn(t,e){return new this(t).plus(e)}function Wn(t){return new this(t).asin()}function jn(t){return new this(t).asinh()}function Gn(t){return new this(t).atan()}function Yn(t){return new this(t).atanh()}function zn(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return!t.s||!e.s?n=new this(NaN):!t.d&&!e.d?(n=ee(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ee(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ee(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(F(t,e,o,1)),e=ee(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(F(t,e,o,1)),n}function Jn(t){return new this(t).cbrt()}function Qn(t){return C(t=new this(t),t.e+1,2)}function er(t,e,n){return new this(t).clamp(e,n)}function tr(t){if(!t||typeof t!="object")throw Error(Ne+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,le,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,Ge,"maxE",0,Ge,"minE",-9e15,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=ze[n]),(r=t[n])!==void 0)if(q(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(fe+n+": "+r);if(n="crypto",i&&(this[n]=ze[n]),(r=t[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(St);else this[n]=!1;else throw Error(fe+n+": "+r);return this}function nr(t){return new this(t).cos()}function rr(t){return new this(t).cosh()}function xt(t){var e,n,r;function i(o){var s,u,c,a=this;if(!(a instanceof i))return new i(o);if(a.constructor=i,Nt(o)){a.s=o.s,L?!o.d||o.e>i.maxE?(a.e=NaN,a.d=null):o.e<i.minE?(a.e=0,a.d=[0]):(a.e=o.e,a.d=o.d.slice()):(a.e=o.e,a.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){a.s=1/o<0?-1:1,a.e=0,a.d=[0];return}if(o<0?(o=-o,a.s=-1):a.s=1,o===~~o&&o<1e7){for(s=0,u=o;u>=10;u/=10)s++;L?s>i.maxE?(a.e=NaN,a.d=null):s<i.minE?(a.e=0,a.d=[0]):(a.e=s,a.d=[o]):(a.e=s,a.d=[o]);return}else if(o*0!==0){o||(a.s=NaN),a.e=NaN,a.d=null;return}return et(a,o.toString())}else if(c!=="string")throw Error(fe+o);return(u=o.charCodeAt(0))===45?(o=o.slice(1),a.s=-1):(u===43&&(o=o.slice(1)),a.s=1),yt.test(o)?et(a,o):Kn(a,o)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=tr,i.clone=xt,i.isDecimal=Nt,i.abs=$n,i.acos=Zn,i.acosh=qn,i.add=Xn,i.asin=Wn,i.asinh=jn,i.atan=Gn,i.atanh=Yn,i.atan2=zn,i.cbrt=Jn,i.ceil=Qn,i.clamp=er,i.cos=nr,i.cosh=rr,i.div=ir,i.exp=or,i.floor=sr,i.hypot=ar,i.ln=ur,i.log=cr,i.log10=fr,i.log2=lr,i.max=dr,i.min=mr,i.mod=hr,i.mul=pr,i.pow=gr,i.random=vr,i.round=br,i.sign=wr,i.sin=Er,i.sinh=Sr,i.sqrt=Tr,i.sub=yr,i.sum=Cr,i.tan=Mr,i.tanh=Lr,i.trunc=Ar,t===void 0&&(t={}),t&&t.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function ir(t,e){return new this(t).div(e)}function or(t){return new this(t).exp()}function sr(t){return C(t=new this(t),t.e+1,3)}function ar(){var t,e,n=new this(0);for(L=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)n.d&&(n=n.plus(e.times(e)));else{if(e.s)return L=!0,new this(1/0);n=e}return L=!0,n.sqrt()}function Nt(t){return t instanceof Me||t&&t.toStringTag===Tt||!1}function ur(t){return new this(t).ln()}function cr(t,e){return new this(t).log(e)}function lr(t){return new this(t).log(2)}function fr(t){return new this(t).log(10)}function dr(){return At(this,arguments,"lt")}function mr(){return At(this,arguments,"gt")}function hr(t,e){return new this(t).mod(e)}function pr(t,e){return new this(t).mul(e)}function gr(t,e){return new this(t).pow(e)}function vr(t){var e,n,r,i,o=0,s=new this(1),u=[];if(t===void 0?t=this.precision:j(t,1,le),r=Math.ceil(t/M),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);o<r;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(St);else for(;o<r;)u[o++]=Math.random()*1e7|0;for(r=u[--o],t%=M,r&&t&&(i=K(10,M-t),u[o]=(r/i|0)*i);u[o]===0;o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;u[0]===0;n-=M)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<M&&(n-=M-r)}return s.e=n,s.d=u,s}function br(t){return C(t=new this(t),t.e+1,this.rounding)}function wr(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function Er(t){return new this(t).sin()}function Sr(t){return new this(t).sinh()}function Tr(t){return new this(t).sqrt()}function yr(t,e){return new this(t).sub(e)}function Cr(){var t=0,e=arguments,n=new this(e[t]);for(L=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return L=!0,C(n,this.precision,this.rounding)}function Mr(t){return new this(t).tan()}function Lr(t){return new this(t).tanh()}function Ar(t){return C(t=new this(t),t.e+1,1)}g[Symbol.for("nodejs.util.inspect.custom")]=g.toString,g[Symbol.toStringTag]="Decimal";var Me=g.constructor=xt(ze);_e=new Me(_e),xe=new Me(xe);class ie{static formatToTimecode(e,n,r=!1){let i=new Me(n),o,s=i.round();o=i.mul(e).floor();let u,c,a,l,f=s.mul(86400),d=o.mod(f),m=s.mul(3600),h=s.mul(60);return l=d.divToInt(m),d=d.minus(l.mul(m)),a=d.divToInt(h),d=d.minus(a.mul(h)),c=d.divToInt(s),u=d.minus(c.mul(s)),ie.formatTimecodeText(l.toNumber(),a.toNumber(),c.toNumber(),u.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${ie.padZero(e)}:${ie.padZero(n)}:${ie.padZero(r)}${s}${ie.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Ir{static resolveFrameRateValueFromFraction(e){return 30}}const ne=class ne{static parseTimeMoment(e){const[n,r]=e.split(":").map(Number);return[n,r]}static parseTimeRange(e){const n=e.match(this.timeRangePattern);if(!n)throw new Error("Not valid timerange: "+e);const r=n[1]==="[",i=n[5]==="]",o=n[2]?this.parseTimeMoment(n[2]):void 0,s=n[4]?this.parseTimeMoment(n[4]):void 0;return{start:o,end:s,isStartInclusive:r,isEndInclusive:i}}static timeMomentToSeconds(e){return ne.timeMomentToMilliseconds(e)/1e3}static timeMomentToMilliseconds(e){return e[0]*1e3+e[1]/1e6}static timeMomentToDate(e){const r=e[0]*1e3+e[1]/1e6;return new Date(r)}static formatTimeMomentToTimecodeText(e,n,r=!1){let i=Ir.resolveFrameRateValueFromFraction(n);return ie.formatToTimecode(ne.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=ne.parseTimeRange(e),o=i.start?ne.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?ne.formatTimeMomentToTimecodeText(i.end,n,r):"?";return`${o} - ${s}`}static nanosecondsToSeconds(e){return e/1e9}static nanosecondsToTimeMoment(e){const n=Math.floor(e/1e9),r=Math.ceil(e%1e9);return[n,r]}static secondsToTimeMoment(e){return this.nanosecondsToTimeMoment(e*1e9)}static timerangeExprDuration(e){return this.timeRangeDuration(this.parseTimeRange(e))}static timeRangeDuration(e){const{start:n,end:r}=e;if(n===void 0||r===void 0)return 0;{const i=r[0]-n[0],o=r[1]-n[1],s=i+o/1e9;return parseFloat(s.toFixed(3))}}static formatTimeMomentExpr(e){return`${e[0]}:${e[1]}`}static formatNanosecondsToTimeMomentExpr(e){return this.formatTimeMomentExpr(this.nanosecondsToTimeMoment(e))}static toTimeRange(e,n,r=!0,i=!0){return{start:e,end:n,isStartInclusive:r,isEndInclusive:i}}static formatTimeRangeExpr(e){const n=e.isStartInclusive?"[":"(",r=e.isEndInclusive?"]":")",i=e.start?`${e.start[0]}:${e.start[1]}`:"",o=e.end?`${e.end[0]}:${e.end[1]}`:"";return`${n}${i}_${o}${r}`}static timerangeDuration(e){let n=ne.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=ne.timeMomentToSeconds(n.start);return ne.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};ne.timeRangePattern=/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/;let R=ne;function Or(t){return t.format==="urn:x-nmos:format:data"&&t.container==="text/vtt"}function _r(t){var e,n,r;return{id:kt(t.id),label:((e=t.tags)==null?void 0:e.hls_name)??t.label??"Subtitles",default:((n=t.tags)==null?void 0:n.hls_default)==="YES",language:((r=t.tags)==null?void 0:r.hls_language)??"unknown",embedded:!1}}function kt(t){return`subtitles-${t}`}function xr(t,e){const n=t.filter(f=>e.get(f.id).length>0).map(f=>{const d=e.get(f.id);let m,h=!1;if(f.format==="urn:x-nmos:format:video"){const p=f.essence_parameters.frame_rate;p&&(m=p.numerator/(p.denominator??1),(p.numerator===6e4||p.numerator===3e4)&&p.denominator===1001&&(h=!0))}return{start:R.timeMomentToSeconds(R.parseTimeRange(d.at(0).timerange).start),frameRate:m,dropFrame:h}}).sort((f,d)=>f.start-d.start),r=n.find(f=>f.frameRate!==void 0),i=(r==null?void 0:r.start)??n.at(0).start,o=new Date(i*1e3),s=o.getUTCHours(),u=o.getUTCMinutes(),c=o.getUTCSeconds(),a=o.getUTCMilliseconds(),l=s*3600+u*60+c+a/1e3;return r===void 0?{ffom:ie.formatToTimecode(l,100,!1),mediaStartTime:i,frameRate:100,dropFrame:!1}:{ffom:ie.formatToTimecode(l,r.frameRate,r.dropFrame),mediaStartTime:r.start,frameRate:r.frameRate,dropFrame:r.dropFrame}}class Nr{constructor(e){y(this,"_lanes",[]);y(this,"_markersLaneMap",new Map);y(this,"_laneNodenMap",new Map);this.omakasePlayer=e}addMarkerLane(e){const n={config:e,type:"marker"};this._lanes.push(n)}addMarkers(e,n){this._markersLaneMap.get(e)===void 0&&this._markersLaneMap.set(e,[]),this._markersLaneMap.get(e).push(...n)}addTimelineNode(e,n){this._laneNodenMap.get(e)||this._laneNodenMap.set(e,[]),this._laneNodenMap.get(e).push(n)}addThumbnailLane(e){const n={config:e,type:"thumbnail"};this._lanes.push(n)}addLabelLane(e){const n={config:e,type:"label"};this._lanes.push(n)}addSubtitlesLane(e){const n={config:e,type:"subtitles"};this._lanes.push(n)}buildAndAttachTimeline(e){this.omakasePlayer.createTimeline(e).subscribe({next:n=>{this.buildAttachedTimeline(n)}})}buildAttachedTimeline(e){this._lanes.forEach(n=>this._createAndAttachLane(e,n))}_createAndAttachLane(e,n){let r;if(n.type==="marker"){r=new O.MarkerLane(n.config),e.addTimelineLane(r);const o=this._markersLaneMap.get(r.id);o==null||o.forEach(s=>r.addMarker(s))}else n.type==="thumbnail"?(r=new O.ThumbnailLane(n.config),e.addTimelineLane(r)):n.type==="label"?(r=new O.LabelLane(n.config),e.addTimelineLane(r)):n.type==="subtitles"&&(r=new O.SubtitlesLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var nt=function(t,e){return nt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},nt(t,e)};function Le(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");nt(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function kr(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(f){s(f)}}function c(l){try{a(r.throw(l))}catch(f){s(f)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function Dt(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function we(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Pe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Ee(t){return this instanceof Ee?(this.v=t,this):new Ee(t)}function Dr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(m){return function(h){return Promise.resolve(h).then(m,f)}}function u(m,h){r[m]&&(i[m]=function(p){return new Promise(function(w,E){o.push([m,p,w,E])>1||c(m,p)})},h&&(i[m]=h(i[m])))}function c(m,h){try{a(r[m](h))}catch(p){d(o[0][3],p)}}function a(m){m.value instanceof Ee?Promise.resolve(m.value.v).then(l,f):d(o[0][2],m)}function l(m){c("next",m)}function f(m){c("throw",m)}function d(m,h){m(h),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Fr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof we=="function"?we(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(a){o({value:a,done:u})},s)}}typeof SuppressedError=="function"&&SuppressedError;function H(t){return typeof t=="function"}function rt(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var it=rt(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
7
+ */var Ge=9e15,le=1e9,Ye="0123456789abcdef",_e="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",xe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ze={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:Ge,crypto:!1},wt,se,L=!0,Ne="[DecimalError] ",fe=Ne+"Invalid argument: ",Et=Ne+"Precision limit exceeded",St=Ne+"crypto unavailable",Tt="[object Decimal]",q=Math.floor,K=Math.pow,Fn=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Vn=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Bn=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,yt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Q=1e7,M=7,Pn=9007199254740991,Rn=_e.length-1,Je=xe.length-1,g={toStringTag:Tt};g.absoluteValue=g.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),C(t)},g.ceil=function(){return C(new this.constructor(this),this.e+1,2)},g.clampedTo=g.clamp=function(t,e){var n,r=this,i=r.constructor;if(t=new i(t),e=new i(e),!t.s||!e.s)return new i(NaN);if(t.gt(e))throw Error(fe+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)},g.comparedTo=g.cmp=function(t){var e,n,r,i,o=this,s=o.d,u=(t=new o.constructor(t)).d,c=o.s,a=t.s;if(!s||!u)return!c||!a?NaN:c!==a?c:s===u?0:!s^c<0?1:-1;if(!s[0]||!u[0])return s[0]?c:u[0]?-a:0;if(c!==a)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=u.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==u[e])return s[e]>u[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},g.cosine=g.cos=function(){var t,e,n=this,r=n.constructor;return n.d?n.d[0]?(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+M,r.rounding=1,n=Un(r,Ot(r,n)),r.precision=t,r.rounding=e,C(se==2||se==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)},g.cubeRoot=g.cbrt=function(){var t,e,n,r,i,o,s,u,c,a,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(L=!1,o=l.s*K(l.s*l,1/3),!o||Math.abs(o)==1/0?(n=Z(l.d),t=l.e,(o=(t-n.length+1)%3)&&(n+=o==1||o==-2?"0":"00"),o=K(n,1/3),t=q((t+1)/3)-(t%3==(t<0?-1:2)),o==1/0?n="5e"+t:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+t),r=new f(n),r.s=l.s):r=new f(o.toString()),s=(t=f.precision)+3;;)if(u=r,c=u.times(u).times(u),a=c.plus(l),r=F(a.plus(l).times(u),a.plus(c),s+2,1),Z(u.d).slice(0,s)===(n=Z(r.d)).slice(0,s))if(n=n.slice(s-3,s+1),n=="9999"||!i&&n=="4999"){if(!i&&(C(u,t+1,0),u.times(u).times(u).eq(l))){r=u;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(C(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return L=!0,C(r,t,f.rounding,e)},g.decimalPlaces=g.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-q(this.e/M))*M,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},g.dividedBy=g.div=function(t){return F(this,new this.constructor(t))},g.dividedToIntegerBy=g.divToInt=function(t){var e=this,n=e.constructor;return C(F(e,new n(t),0,1,1),n.precision,n.rounding)},g.equals=g.eq=function(t){return this.cmp(t)===0},g.floor=function(){return C(new this.constructor(this),this.e+1,3)},g.greaterThan=g.gt=function(t){return this.cmp(t)>0},g.greaterThanOrEqualTo=g.gte=function(t){var e=this.cmp(t);return e==1||e===0},g.hyperbolicCosine=g.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,u=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return u;n=s.precision,r=s.rounding,s.precision=n+Math.max(o.e,o.sd())+4,s.rounding=1,i=o.d.length,i<32?(t=Math.ceil(i/3),e=(1/Ve(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=be(s,1,o.times(e),new s(1),!0);for(var c,a=t,l=new s(8);a--;)c=o.times(o),o=u.minus(c.times(l.minus(c.times(l))));return C(o,s.precision=n,s.rounding=r,!0)},g.hyperbolicSine=g.sinh=function(){var t,e,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(e=o.precision,n=o.rounding,o.precision=e+Math.max(i.e,i.sd())+4,o.rounding=1,r=i.d.length,r<3)i=be(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/Ve(5,t)),i=be(o,2,i,i,!0);for(var s,u=new o(5),c=new o(16),a=new o(20);t--;)s=i.times(i),i=i.times(u.plus(s.times(c.times(s).plus(a))))}return o.precision=e,o.rounding=n,C(i,e,n,!0)},g.hyperbolicTangent=g.tanh=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+7,r.rounding=1,F(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},g.inverseCosine=g.acos=function(){var t,e=this,n=e.constructor,r=e.abs().cmp(1),i=n.precision,o=n.rounding;return r!==-1?r===0?e.isNeg()?ee(n,i,o):new n(0):new n(NaN):e.isZero()?ee(n,i+4,o).times(.5):(n.precision=i+6,n.rounding=1,e=e.asin(),t=ee(n,i+4,o).times(.5),n.precision=i,n.rounding=o,t.minus(e))},g.inverseHyperbolicCosine=g.acosh=function(){var t,e,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(t=r.precision,e=r.rounding,r.precision=t+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,L=!1,n=n.times(n).minus(1).sqrt().plus(n),L=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},g.inverseHyperbolicSine=g.asinh=function(){var t,e,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,L=!1,n=n.times(n).plus(1).sqrt().plus(n),L=!0,r.precision=t,r.rounding=e,n.ln())},g.inverseHyperbolicTangent=g.atanh=function(){var t,e,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=o.precision,e=o.rounding,r=i.sd(),Math.max(r,t)<2*-i.e-1?C(new o(i),t,e,!0):(o.precision=n=r-i.e,i=F(i.plus(1),new o(1).minus(i),n+t,1),o.precision=t+4,o.rounding=1,i=i.ln(),o.precision=t,o.rounding=e,i.times(.5))):new o(NaN)},g.inverseSine=g.asin=function(){var t,e,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(e=i.abs().cmp(1),n=o.precision,r=o.rounding,e!==-1?e===0?(t=ee(o,n+4,r).times(.5),t.s=i.s,t):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},g.inverseTangent=g.atan=function(){var t,e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding;if(a.isFinite()){if(a.isZero())return new l(a);if(a.abs().eq(1)&&f+4<=Je)return s=ee(l,f+4,d).times(.25),s.s=a.s,s}else{if(!a.s)return new l(NaN);if(f+4<=Je)return s=ee(l,f+4,d).times(.5),s.s=a.s,s}for(l.precision=u=f+10,l.rounding=1,n=Math.min(28,u/M+2|0),t=n;t;--t)a=a.div(a.times(a).plus(1).sqrt().plus(1));for(L=!1,e=Math.ceil(u/M),r=1,c=a.times(a),s=new l(a),i=a;t!==-1;)if(i=i.times(c),o=s.minus(i.div(r+=2)),i=i.times(c),s=o.plus(i.div(r+=2)),s.d[e]!==void 0)for(t=e;s.d[t]===o.d[t]&&t--;);return n&&(s=s.times(2<<n-1)),L=!0,C(s,l.precision=f,l.rounding=d,!0)},g.isFinite=function(){return!!this.d},g.isInteger=g.isInt=function(){return!!this.d&&q(this.e/M)>this.d.length-2},g.isNaN=function(){return!this.s},g.isNegative=g.isNeg=function(){return this.s<0},g.isPositive=g.isPos=function(){return this.s>0},g.isZero=function(){return!!this.d&&this.d[0]===0},g.lessThan=g.lt=function(t){return this.cmp(t)<0},g.lessThanOrEqualTo=g.lte=function(t){return this.cmp(t)<1},g.logarithm=g.log=function(t){var e,n,r,i,o,s,u,c,a=this,l=a.constructor,f=l.precision,d=l.rounding,m=5;if(t==null)t=new l(10),e=!0;else{if(t=new l(t),n=t.d,t.s<0||!n||!n[0]||t.eq(1))return new l(NaN);e=t.eq(10)}if(n=a.d,a.s<0||!n||!n[0]||a.eq(1))return new l(n&&!n[0]?-1/0:a.s!=1?NaN:n?0:1/0);if(e)if(n.length>1)o=!0;else{for(i=n[0];i%10===0;)i/=10;o=i!==1}if(L=!1,u=f+m,s=me(a,u),r=e?Fe(l,u+10):me(t,u),c=F(s,r,u,1),Ce(c.d,i=f,d))do if(u+=10,s=me(a,u),r=e?Fe(l,u+10):me(t,u),c=F(s,r,u,1),!o){+Z(c.d).slice(i+1,i+15)+1==1e14&&(c=C(c,f+1,0));break}while(Ce(c.d,i+=10,d));return L=!0,C(c,f,d)},g.minus=g.sub=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.constructor;if(t=new h(t),!m.d||!t.d)return!m.s||!t.s?t=new h(NaN):m.d?t.s=-t.s:t=new h(t.d||m.s!==t.s?m:NaN),t;if(m.s!=t.s)return t.s=-t.s,m.plus(t);if(a=m.d,d=t.d,u=h.precision,c=h.rounding,!a[0]||!d[0]){if(d[0])t.s=-t.s;else if(a[0])t=new h(m);else return new h(c===3?-0:0);return L?C(t,u,c):t}if(n=q(t.e/M),l=q(m.e/M),a=a.slice(),o=l-n,o){for(f=o<0,f?(e=a,o=-o,s=d.length):(e=d,n=l,s=a.length),r=Math.max(Math.ceil(u/M),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=a.length,s=d.length,f=r<s,f&&(s=r),r=0;r<s;r++)if(a[r]!=d[r]){f=a[r]<d[r];break}o=0}for(f&&(e=a,a=d,d=e,t.s=-t.s),s=a.length,r=d.length-s;r>0;--r)a[s++]=0;for(r=d.length;r>o;){if(a[--r]<d[r]){for(i=r;i&&a[--i]===0;)a[i]=Q-1;--a[i],a[r]+=Q}a[r]-=d[r]}for(;a[--s]===0;)a.pop();for(;a[0]===0;a.shift())--n;return a[0]?(t.d=a,t.e=De(a,n),L?C(t,u,c):t):new h(c===3?-0:0)},g.modulo=g.mod=function(t){var e,n=this,r=n.constructor;return t=new r(t),!n.d||!t.s||t.d&&!t.d[0]?new r(NaN):!t.d||n.d&&!n.d[0]?C(new r(n),r.precision,r.rounding):(L=!1,r.modulo==9?(e=F(n,t.abs(),0,3,1),e.s*=t.s):e=F(n,t,0,r.modulo,1),e=e.times(t),L=!0,n.minus(e))},g.naturalExponential=g.exp=function(){return Qe(this)},g.naturalLogarithm=g.ln=function(){return me(this)},g.negated=g.neg=function(){var t=new this.constructor(this);return t.s=-t.s,C(t)},g.plus=g.add=function(t){var e,n,r,i,o,s,u,c,a,l,f=this,d=f.constructor;if(t=new d(t),!f.d||!t.d)return!f.s||!t.s?t=new d(NaN):f.d||(t=new d(t.d||f.s===t.s?f:NaN)),t;if(f.s!=t.s)return t.s=-t.s,f.minus(t);if(a=f.d,l=t.d,u=d.precision,c=d.rounding,!a[0]||!l[0])return l[0]||(t=new d(f)),L?C(t,u,c):t;if(o=q(f.e/M),r=q(t.e/M),a=a.slice(),i=o-r,i){for(i<0?(n=a,i=-i,s=l.length):(n=l,r=o,s=a.length),o=Math.ceil(u/M),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=a.length,i=l.length,s-i<0&&(i=s,n=l,l=a,a=n),e=0;i;)e=(a[--i]=a[i]+l[i]+e)/Q|0,a[i]%=Q;for(e&&(a.unshift(e),++r),s=a.length;a[--s]==0;)a.pop();return t.d=a,t.e=De(a,r),L?C(t,u,c):t},g.precision=g.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(fe+t);return n.d?(e=Ct(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},g.round=function(){var t=this,e=t.constructor;return C(new e(t),t.e+1,e.rounding)},g.sine=g.sin=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+Math.max(n.e,n.sd())+M,r.rounding=1,n=Hn(r,Ot(r,n)),r.precision=t,r.rounding=e,C(se>2?n.neg():n,t,e,!0)):new r(NaN)},g.squareRoot=g.sqrt=function(){var t,e,n,r,i,o,s=this,u=s.d,c=s.e,a=s.s,l=s.constructor;if(a!==1||!u||!u[0])return new l(!a||a<0&&(!u||u[0])?NaN:u?s:1/0);for(L=!1,a=Math.sqrt(+s),a==0||a==1/0?(e=Z(u),(e.length+c)%2==0&&(e+="0"),a=Math.sqrt(e),c=q((c+1)/2)-(c<0||c%2),a==1/0?e="5e"+c:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(a.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(F(s,o,n+2,1)).times(.5),Z(o.d).slice(0,n)===(e=Z(r.d)).slice(0,n))if(e=e.slice(n-3,n+1),e=="9999"||!i&&e=="4999"){if(!i&&(C(o,c+1,0),o.times(o).eq(s))){r=o;break}n+=4,i=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(C(r,c+1,1),t=!r.times(r).eq(s));break}return L=!0,C(r,c,l.rounding,t)},g.tangent=g.tan=function(){var t,e,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(t=r.precision,e=r.rounding,r.precision=t+10,r.rounding=1,n=n.sin(),n.s=1,n=F(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,C(se==2||se==4?n.neg():n,t,e,!0)):new r(NaN)},g.times=g.mul=function(t){var e,n,r,i,o,s,u,c,a,l=this,f=l.constructor,d=l.d,m=(t=new f(t)).d;if(t.s*=l.s,!d||!d[0]||!m||!m[0])return new f(!t.s||d&&!d[0]&&!m||m&&!m[0]&&!d?NaN:!d||!m?t.s/0:t.s*0);for(n=q(l.e/M)+q(t.e/M),c=d.length,a=m.length,c<a&&(o=d,d=m,m=o,s=c,c=a,a=s),o=[],s=c+a,r=s;r--;)o.push(0);for(r=a;--r>=0;){for(e=0,i=c+r;i>r;)u=o[i]+m[r]*d[i-r-1]+e,o[i--]=u%Q|0,e=u/Q|0;o[i]=(o[i]+e)%Q|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=De(o,n),L?C(t,f.precision,f.rounding):t},g.toBinary=function(t,e){return tt(this,2,t,e)},g.toDecimalPlaces=g.toDP=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(j(t,0,le),e===void 0?e=r.rounding:j(e,0,8),C(n,t+n.e+1,e))},g.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=re(r,!0):(j(t,0,le),e===void 0?e=i.rounding:j(e,0,8),r=C(new i(r),t+1,e),n=re(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},g.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=re(i):(j(t,0,le),e===void 0?e=o.rounding:j(e,0,8),r=C(new o(i),t+i.e+1,e),n=re(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},g.toFraction=function(t){var e,n,r,i,o,s,u,c,a,l,f,d,m=this,h=m.d,p=m.constructor;if(!h)return new p(m);if(a=n=new p(1),r=c=new p(0),e=new p(r),o=e.e=Ct(h)-m.e-1,s=o%M,e.d[0]=K(10,s<0?M+s:s),t==null)t=o>0?e:a;else{if(u=new p(t),!u.isInt()||u.lt(a))throw Error(fe+u);t=u.gt(e)?o>0?e:a:u}for(L=!1,u=new p(Z(h)),l=p.precision,p.precision=o=h.length*M*2;f=F(u,e,0,1,1),i=n.plus(f.times(r)),i.cmp(t)!=1;)n=r,r=i,i=a,a=c.plus(f.times(i)),c=i,i=e,e=u.minus(f.times(i)),u=i;return i=F(t.minus(n),r,0,1,1),c=c.plus(i.times(a)),n=n.plus(i.times(r)),c.s=a.s=m.s,d=F(a,r,o,1).minus(m).abs().cmp(F(c,n,o,1).minus(m).abs())<1?[a,r]:[c,n],p.precision=l,L=!0,d},g.toHexadecimal=g.toHex=function(t,e){return tt(this,16,t,e)},g.toNearest=function(t,e){var n=this,r=n.constructor;if(n=new r(n),t==null){if(!n.d)return n;t=new r(1),e=r.rounding}else{if(t=new r(t),e===void 0?e=r.rounding:j(e,0,8),!n.d)return t.s?n:t;if(!t.d)return t.s&&(t.s=n.s),t}return t.d[0]?(L=!1,n=F(n,t,0,e,1).times(t),L=!0,C(n)):(t.s=n.s,n=t),n},g.toNumber=function(){return+this},g.toOctal=function(t,e){return tt(this,8,t,e)},g.toPower=g.pow=function(t){var e,n,r,i,o,s,u=this,c=u.constructor,a=+(t=new c(t));if(!u.d||!t.d||!u.d[0]||!t.d[0])return new c(K(+u,a));if(u=new c(u),u.eq(1))return u;if(r=c.precision,o=c.rounding,t.eq(1))return C(u,r,o);if(e=q(t.e/M),e>=t.d.length-1&&(n=a<0?-a:a)<=Pn)return i=Mt(c,u,n,r),t.s<0?new c(1).div(i):C(i,r,o);if(s=u.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=s,u}return n=K(+u,a),e=n==0||!isFinite(n)?q(a*(Math.log("0."+Z(u.d))/Math.LN10+u.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(L=!1,c.rounding=u.s=1,n=Math.min(12,(e+"").length),i=Qe(t.times(me(u,r+n)),r),i.d&&(i=C(i,r+5,1),Ce(i.d,r,o)&&(e=r+10,i=C(Qe(t.times(me(u,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=C(i,r+1,0)))),i.s=s,L=!0,c.rounding=o,C(i,r,o))},g.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=re(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(j(t,1,le),e===void 0?e=i.rounding:j(e,0,8),r=C(new i(r),t,e),n=re(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},g.toSignificantDigits=g.toSD=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(j(t,1,le),e===void 0?e=r.rounding:j(e,0,8)),C(new r(n),t,e)},g.toString=function(){var t=this,e=t.constructor,n=re(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},g.truncated=g.trunc=function(){return C(new this.constructor(this),this.e+1,1)},g.valueOf=g.toJSON=function(){var t=this,e=t.constructor,n=re(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+n:n};function Z(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;e<i;e++)r=t[e]+"",n=M-r.length,n&&(o+=de(n)),o+=r;s=t[e],r=s+"",n=M-r.length,n&&(o+=de(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return o+s}function j(t,e,n){if(t!==~~t||t<e||t>n)throw Error(fe+t)}function Ce(t,e,n,r){var i,o,s,u;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=M,i=0):(i=Math.ceil((e+1)/M),e%=M),o=K(10,M-e),u=t[i]%o|0,r==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),s=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):s=(n<4&&u+1==o||n>3&&u+1==o/2)&&(t[i+1]/o/100|0)==K(10,e-2)-1||(u==o/2||u==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),s=(r||n<4)&&u==9999||!r&&n>3&&u==4999):s=((r||n<4)&&u+1==o||!r&&n>3&&u+1==o/2)&&(t[i+1]/o/1e3|0)==K(10,e-3)-1,s}function ke(t,e,n){for(var r,i=[0],o,s=0,u=t.length;s<u;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=Ye.indexOf(t.charAt(s++)),r=0;r<i.length;r++)i[r]>n-1&&(i[r+1]===void 0&&(i[r+1]=0),i[r+1]+=i[r]/n|0,i[r]%=n)}return i.reverse()}function Un(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/Ve(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=be(t,1,e.times(i),new t(1));for(var o=n;o--;){var s=e.times(e);e=s.times(s).minus(s).times(8).plus(1)}return t.precision-=n,e}var F=function(){function t(r,i,o){var s,u=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+u,r[c]=s%o|0,u=s/o|0;return u&&r.unshift(u),r}function e(r,i,o,s){var u,c;if(o!=s)c=o>s?1:-1;else for(u=c=0;u<o;u++)if(r[u]!=i[u]){c=r[u]>i[u]?1:-1;break}return c}function n(r,i,o,s){for(var u=0;o--;)r[o]-=u,u=r[o]<i[o]?1:0,r[o]=u*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,u,c){var a,l,f,d,m,h,p,w,E,x,A,D,V,_,Y,oe,z,Te,$,ue,ce=r.constructor,ye=r.s==i.s?1:-1,U=r.d,k=i.d;if(!U||!U[0]||!k||!k[0])return new ce(!r.s||!i.s||(U?k&&U[0]==k[0]:!k)?NaN:U&&U[0]==0||!k?ye*0:ye/0);for(c?(m=1,l=r.e-i.e):(c=Q,m=M,l=q(r.e/m)-q(i.e/m)),$=k.length,z=U.length,E=new ce(ye),x=E.d=[],f=0;k[f]==(U[f]||0);f++);if(k[f]>(U[f]||0)&&l--,o==null?(_=o=ce.precision,s=ce.rounding):u?_=o+(r.e-i.e)+1:_=o,_<0)x.push(1),h=!0;else{if(_=_/m+2|0,f=0,$==1){for(d=0,k=k[0],_++;(f<z||d)&&_--;f++)Y=d*c+(U[f]||0),x[f]=Y/k|0,d=Y%k|0;h=d||f<z}else{for(d=c/(k[0]+1)|0,d>1&&(k=t(k,d,c),U=t(U,d,c),$=k.length,z=U.length),oe=$,A=U.slice(0,$),D=A.length;D<$;)A[D++]=0;ue=k.slice(),ue.unshift(0),Te=k[0],k[1]>=c/2&&++Te;do d=0,a=e(k,A,$,D),a<0?(V=A[0],$!=D&&(V=V*c+(A[1]||0)),d=V/Te|0,d>1?(d>=c&&(d=c-1),p=t(k,d,c),w=p.length,D=A.length,a=e(p,A,w,D),a==1&&(d--,n(p,$<w?ue:k,w,c))):(d==0&&(a=d=1),p=k.slice()),w=p.length,w<D&&p.unshift(0),n(A,p,D,c),a==-1&&(D=A.length,a=e(k,A,$,D),a<1&&(d++,n(A,$<D?ue:k,D,c))),D=A.length):a===0&&(d++,A=[0]),x[f++]=d,a&&A[0]?A[D++]=U[oe]||0:(A=[U[oe]],D=1);while((oe++<z||A[0]!==void 0)&&_--);h=A[0]!==void 0}x[0]||x.shift()}if(m==1)E.e=l,wt=h;else{for(f=1,d=x[0];d>=10;d/=10)f++;E.e=f+l*m-1,C(E,u?o+E.e+1:o,s,h)}return E}}();function C(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor;e:if(e!=null){if(f=t.d,!f)return t;for(i=1,u=f[0];u>=10;u/=10)i++;if(o=e-i,o<0)o+=M,s=e,l=f[d=0],c=l/K(10,i-s-1)%10|0;else if(d=Math.ceil((o+1)/M),u=f.length,d>=u)if(r){for(;u++<=d;)f.push(0);l=c=0,i=1,o%=M,s=o-M+1}else break e;else{for(l=u=f[d],i=1;u>=10;u/=10)i++;o%=M,s=o-M+i,c=s<0?0:l/K(10,i-s-1)%10|0}if(r=r||e<0||f[d+1]!==void 0||(s<0?l:l%K(10,i-s-1)),a=n<4?(c||r)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||r||n==6&&(o>0?s>0?l/K(10,i-s):0:f[d-1])%10&1||n==(t.s<0?8:7)),e<1||!f[0])return f.length=0,a?(e-=t.e+1,f[0]=K(10,(M-e%M)%M),t.e=-e||0):f[0]=t.e=0,t;if(o==0?(f.length=d,u=1,d--):(f.length=d+1,u=K(10,M-o),f[d]=s>0?(l/K(10,i-s)%K(10,s)|0)*u:0),a)for(;;)if(d==0){for(o=1,s=f[0];s>=10;s/=10)o++;for(s=f[0]+=u,u=1;s>=10;s/=10)u++;o!=u&&(t.e++,f[0]==Q&&(f[0]=1));break}else{if(f[d]+=u,f[d]!=Q)break;f[d--]=0,u=1}for(o=f.length;f[--o]===0;)f.pop()}return L&&(t.e>m.maxE?(t.d=null,t.e=NaN):t.e<m.minE&&(t.e=0,t.d=[0])),t}function re(t,e,n){if(!t.isFinite())return It(t);var r,i=t.e,o=Z(t.d),s=o.length;return e?(n&&(r=n-s)>0?o=o.charAt(0)+"."+o.slice(1)+de(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+de(-i-1)+o,n&&(r=n-s)>0&&(o+=de(r))):i>=s?(o+=de(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+de(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=de(r))),o}function De(t,e){var n=t[0];for(e*=M;n>=10;n/=10)e++;return e}function Fe(t,e,n){if(e>Rn)throw L=!0,n&&(t.precision=n),Error(Et);return C(new t(_e),e,1,!0)}function ee(t,e,n){if(e>Je)throw Error(Et);return C(new t(xe),e,n,!0)}function Ct(t){var e=t.length-1,n=e*M+1;if(e=t[e],e){for(;e%10==0;e/=10)n--;for(e=t[0];e>=10;e/=10)n++}return n}function de(t){for(var e="";t--;)e+="0";return e}function Mt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/M+4);for(L=!1;;){if(n%2&&(o=o.times(e),_t(o.d,s)&&(i=!0)),n=q(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),_t(e.d,s)}return L=!0,o}function Lt(t){return t.d[t.d.length-1]&1}function At(t,e,n){for(var r,i=new t(e[0]),o=0;++o<e.length;)if(r=new t(e[o]),r.s)i[n](r)&&(i=r);else{i=r;break}return i}function Qe(t,e){var n,r,i,o,s,u,c,a=0,l=0,f=0,d=t.constructor,m=d.rounding,h=d.precision;if(!t.d||!t.d[0]||t.e>17)return new d(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(L=!1,c=h):c=e,u=new d(.03125);t.e>-2;)t=t.times(u),f+=5;for(r=Math.log(K(2,f))/Math.LN10*2+5|0,c+=r,n=o=s=new d(1),d.precision=c;;){if(o=C(o.times(t),c,1),n=n.times(++l),u=s.plus(F(o,n,c,1)),Z(u.d).slice(0,c)===Z(s.d).slice(0,c)){for(i=f;i--;)s=C(s.times(s),c,1);if(e==null)if(a<3&&Ce(s.d,c-r,m,a))d.precision=c+=10,n=o=u=new d(1),l=0,a++;else return C(s,d.precision=h,m,L=!0);else return d.precision=h,s}s=u}}function me(t,e){var n,r,i,o,s,u,c,a,l,f,d,m=1,h=10,p=t,w=p.d,E=p.constructor,x=E.rounding,A=E.precision;if(p.s<0||!w||!w[0]||!p.e&&w[0]==1&&w.length==1)return new E(w&&!w[0]?-1/0:p.s!=1?NaN:w?0:p);if(e==null?(L=!1,l=A):l=e,E.precision=l+=h,n=Z(w),r=n.charAt(0),Math.abs(o=p.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Z(p.d),r=n.charAt(0),m++;o=p.e,r>1?(p=new E("0."+n),o++):p=new E(r+"."+n.slice(1))}else return a=Fe(E,l+2,A).times(o+""),p=me(new E(r+"."+n.slice(1)),l-h).plus(a),E.precision=A,e==null?C(p,A,x,L=!0):p;for(f=p,c=s=p=F(p.minus(1),p.plus(1),l,1),d=C(p.times(p),l,1),i=3;;){if(s=C(s.times(d),l,1),a=c.plus(F(s,new E(i),l,1)),Z(a.d).slice(0,l)===Z(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(Fe(E,l+2,A).times(o+""))),c=F(c,new E(m),l,1),e==null)if(Ce(c.d,l-h,x,u))E.precision=l+=h,a=s=p=F(f.minus(1),f.plus(1),l,1),d=C(p.times(p),l,1),i=u=1;else return C(c,E.precision=A,x,L=!0);else return E.precision=A,c;c=a,i+=2}}function It(t){return String(t.s*t.s/0)}function et(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;r++);for(i=e.length;e.charCodeAt(i-1)===48;--i);if(e=e.slice(r,i),e){if(i-=r,t.e=n=n-r-1,t.d=[],r=(n+1)%M,n<0&&(r+=M),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=M;r<i;)t.d.push(+e.slice(r,r+=M));e=e.slice(r),r=M-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),L&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function Kn(t,e){var n,r,i,o,s,u,c,a,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),yt.test(e))return et(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Vn.test(e))n=16,e=e.toLowerCase();else if(Fn.test(e))n=2;else if(Bn.test(e))n=8;else throw Error(fe+e);for(o=e.search(/p/i),o>0?(c=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),o=e.indexOf("."),s=o>=0,r=t.constructor,s&&(e=e.replace(".",""),u=e.length,o=u-o,i=Mt(r,new r(n),o,o*2)),a=ke(e,n,Q),l=a.length-1,o=l;a[o]===0;--o)a.pop();return o<0?new r(t.s*0):(t.e=De(a,l),t.d=a,L=!1,s&&(t=F(t,i,u*4)),c&&(t=t.times(Math.abs(c)<54?K(2,c):Me.pow(2,c))),L=!0,t)}function Hn(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:be(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/Ve(5,n)),e=be(t,2,e,e);for(var i,o=new t(5),s=new t(16),u=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(u))));return e}function be(t,e,n,r,i){var o,s,u,c,a=t.precision,l=Math.ceil(a/M);for(L=!1,c=n.times(n),u=new t(r);;){if(s=F(u.times(c),new t(e++*e++),a,1),u=i?r.plus(s):r.minus(s),r=F(s.times(c),new t(e++*e++),a,1),s=u.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===u.d[o]&&o--;);if(o==-1)break}o=u,u=r,r=s,s=o}return L=!0,s.d.length=l+1,s}function Ve(t,e){for(var n=t;--e;)n*=t;return n}function Ot(t,e){var n,r=e.s<0,i=ee(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return se=r?4:1,e;if(n=e.divToInt(i),n.isZero())se=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return se=Lt(n)?r?2:3:r?4:1,e;se=Lt(n)?r?1:4:r?3:2}return e.minus(i).abs()}function tt(t,e,n,r){var i,o,s,u,c,a,l,f,d,m=t.constructor,h=n!==void 0;if(h?(j(n,1,le),r===void 0?r=m.rounding:j(r,0,8)):(n=m.precision,r=m.rounding),!t.isFinite())l=It(t);else{for(l=re(t),s=l.indexOf("."),h?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),d=new m(1),d.e=l.length-s,d.d=ke(re(d),10,i),d.e=d.d.length),f=ke(l,10,i),o=c=f.length;f[--c]==0;)f.pop();if(!f[0])l=h?"0p+0":"0";else{if(s<0?o--:(t=new m(t),t.d=f,t.e=o,t=F(t,d,n,r,0,i),f=t.d,o=t.e,a=wt),s=f[n],u=i/2,a=a||f[n+1]!==void 0,a=r<4?(s!==void 0||a)&&(r===0||r===(t.s<0?3:2)):s>u||s===u&&(r===4||a||r===6&&f[n-1]&1||r===(t.s<0?8:7)),f.length=n,a)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(c=f.length;!f[c-1];--c);for(s=0,l="";s<c;s++)l+=Ye.charAt(f[s]);if(h){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(f=ke(l,i,e),c=f.length;!f[c-1];--c);for(s=1,l="1.";s<c;s++)l+=Ye.charAt(f[s])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>c)for(o-=c;o--;)l+="0";else o<c&&(l=l.slice(0,o)+"."+l.slice(o))}l=(e==16?"0x":e==2?"0b":e==8?"0o":"")+l}return t.s<0?"-"+l:l}function _t(t,e){if(t.length>e)return t.length=e,!0}function $n(t){return new this(t).abs()}function Zn(t){return new this(t).acos()}function qn(t){return new this(t).acosh()}function Xn(t,e){return new this(t).plus(e)}function Wn(t){return new this(t).asin()}function jn(t){return new this(t).asinh()}function Gn(t){return new this(t).atan()}function Yn(t){return new this(t).atanh()}function zn(t,e){t=new this(t),e=new this(e);var n,r=this.precision,i=this.rounding,o=r+4;return!t.s||!e.s?n=new this(NaN):!t.d&&!e.d?(n=ee(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ee(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ee(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(F(t,e,o,1)),e=ee(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(F(t,e,o,1)),n}function Jn(t){return new this(t).cbrt()}function Qn(t){return C(t=new this(t),t.e+1,2)}function er(t,e,n){return new this(t).clamp(e,n)}function tr(t){if(!t||typeof t!="object")throw Error(Ne+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,le,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,Ge,"maxE",0,Ge,"minE",-9e15,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=ze[n]),(r=t[n])!==void 0)if(q(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(fe+n+": "+r);if(n="crypto",i&&(this[n]=ze[n]),(r=t[n])!==void 0)if(r===!0||r===!1||r===0||r===1)if(r)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(St);else this[n]=!1;else throw Error(fe+n+": "+r);return this}function nr(t){return new this(t).cos()}function rr(t){return new this(t).cosh()}function xt(t){var e,n,r;function i(o){var s,u,c,a=this;if(!(a instanceof i))return new i(o);if(a.constructor=i,Nt(o)){a.s=o.s,L?!o.d||o.e>i.maxE?(a.e=NaN,a.d=null):o.e<i.minE?(a.e=0,a.d=[0]):(a.e=o.e,a.d=o.d.slice()):(a.e=o.e,a.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){a.s=1/o<0?-1:1,a.e=0,a.d=[0];return}if(o<0?(o=-o,a.s=-1):a.s=1,o===~~o&&o<1e7){for(s=0,u=o;u>=10;u/=10)s++;L?s>i.maxE?(a.e=NaN,a.d=null):s<i.minE?(a.e=0,a.d=[0]):(a.e=s,a.d=[o]):(a.e=s,a.d=[o]);return}else if(o*0!==0){o||(a.s=NaN),a.e=NaN,a.d=null;return}return et(a,o.toString())}else if(c!=="string")throw Error(fe+o);return(u=o.charCodeAt(0))===45?(o=o.slice(1),a.s=-1):(u===43&&(o=o.slice(1)),a.s=1),yt.test(o)?et(a,o):Kn(a,o)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=tr,i.clone=xt,i.isDecimal=Nt,i.abs=$n,i.acos=Zn,i.acosh=qn,i.add=Xn,i.asin=Wn,i.asinh=jn,i.atan=Gn,i.atanh=Yn,i.atan2=zn,i.cbrt=Jn,i.ceil=Qn,i.clamp=er,i.cos=nr,i.cosh=rr,i.div=ir,i.exp=or,i.floor=sr,i.hypot=ar,i.ln=ur,i.log=cr,i.log10=fr,i.log2=lr,i.max=dr,i.min=mr,i.mod=hr,i.mul=pr,i.pow=gr,i.random=vr,i.round=br,i.sign=wr,i.sin=Er,i.sinh=Sr,i.sqrt=Tr,i.sub=yr,i.sum=Cr,i.tan=Mr,i.tanh=Lr,i.trunc=Ar,t===void 0&&(t={}),t&&t.defaults!==!0)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return i.config(t),i}function ir(t,e){return new this(t).div(e)}function or(t){return new this(t).exp()}function sr(t){return C(t=new this(t),t.e+1,3)}function ar(){var t,e,n=new this(0);for(L=!1,t=0;t<arguments.length;)if(e=new this(arguments[t++]),e.d)n.d&&(n=n.plus(e.times(e)));else{if(e.s)return L=!0,new this(1/0);n=e}return L=!0,n.sqrt()}function Nt(t){return t instanceof Me||t&&t.toStringTag===Tt||!1}function ur(t){return new this(t).ln()}function cr(t,e){return new this(t).log(e)}function lr(t){return new this(t).log(2)}function fr(t){return new this(t).log(10)}function dr(){return At(this,arguments,"lt")}function mr(){return At(this,arguments,"gt")}function hr(t,e){return new this(t).mod(e)}function pr(t,e){return new this(t).mul(e)}function gr(t,e){return new this(t).pow(e)}function vr(t){var e,n,r,i,o=0,s=new this(1),u=[];if(t===void 0?t=this.precision:j(t,1,le),r=Math.ceil(t/M),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(r));o<r;)i=e[o],i>=429e7?e[o]=crypto.getRandomValues(new Uint32Array(1))[0]:u[o++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(r*=4);o<r;)i=e[o]+(e[o+1]<<8)+(e[o+2]<<16)+((e[o+3]&127)<<24),i>=214e7?crypto.randomBytes(4).copy(e,o):(u.push(i%1e7),o+=4);o=r/4}else throw Error(St);else for(;o<r;)u[o++]=Math.random()*1e7|0;for(r=u[--o],t%=M,r&&t&&(i=K(10,M-t),u[o]=(r/i|0)*i);u[o]===0;o--)u.pop();if(o<0)n=0,u=[0];else{for(n=-1;u[0]===0;n-=M)u.shift();for(r=1,i=u[0];i>=10;i/=10)r++;r<M&&(n-=M-r)}return s.e=n,s.d=u,s}function br(t){return C(t=new this(t),t.e+1,this.rounding)}function wr(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function Er(t){return new this(t).sin()}function Sr(t){return new this(t).sinh()}function Tr(t){return new this(t).sqrt()}function yr(t,e){return new this(t).sub(e)}function Cr(){var t=0,e=arguments,n=new this(e[t]);for(L=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return L=!0,C(n,this.precision,this.rounding)}function Mr(t){return new this(t).tan()}function Lr(t){return new this(t).tanh()}function Ar(t){return C(t=new this(t),t.e+1,1)}g[Symbol.for("nodejs.util.inspect.custom")]=g.toString,g[Symbol.toStringTag]="Decimal";var Me=g.constructor=xt(ze);_e=new Me(_e),xe=new Me(xe);class ie{static formatToTimecode(e,n,r=!1,i=!1){let o=new Me(n),s,u=o.round();s=o.mul(e).floor();let c,a,l,f,d=u.mul(86400),m=s.mod(d),h=u.mul(3600),p=u.mul(60);return f=m.divToInt(h),m=m.minus(f.mul(h)),l=m.divToInt(p),m=m.minus(l.mul(p)),a=m.divToInt(u),c=m.minus(a.mul(u)),ie.formatTimecodeText(f.toNumber(),l.toNumber(),a.toNumber(),c.toNumber(),r,i)}static formatTimecodeText(e,n,r,i,o=!1,s=!1){let u=s?".":o?";":":";return`${ie.padZero(e)}:${ie.padZero(n)}:${ie.padZero(r)}${u}${ie.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Ir{static resolveFrameRateValueFromFraction(e){return 30}}const ne=class ne{static parseTimeMoment(e){const[n,r]=e.split(":").map(Number);return[n,r]}static parseTimeRange(e){const n=e.match(this.timeRangePattern);if(!n)throw new Error("Not valid timerange: "+e);const r=n[1]==="[",i=n[5]==="]",o=n[2]?this.parseTimeMoment(n[2]):void 0,s=n[4]?this.parseTimeMoment(n[4]):void 0;return{start:o,end:s,isStartInclusive:r,isEndInclusive:i}}static timeMomentToSeconds(e){return ne.timeMomentToMilliseconds(e)/1e3}static timeMomentToMilliseconds(e){return e[0]*1e3+e[1]/1e6}static timeMomentToDate(e){const r=e[0]*1e3+e[1]/1e6;return new Date(r)}static formatTimeMomentToTimecodeText(e,n,r=!1){let i=Ir.resolveFrameRateValueFromFraction(n);return ie.formatToTimecode(ne.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=ne.parseTimeRange(e),o=i.start?ne.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?ne.formatTimeMomentToTimecodeText(i.end,n,r):"?";return`${o} - ${s}`}static nanosecondsToSeconds(e){return e/1e9}static nanosecondsToTimeMoment(e){const n=Math.floor(e/1e9),r=Math.ceil(e%1e9);return[n,r]}static secondsToTimeMoment(e){return this.nanosecondsToTimeMoment(e*1e9)}static timerangeExprDuration(e){return this.timeRangeDuration(this.parseTimeRange(e))}static timeRangeDuration(e){const{start:n,end:r}=e;if(n===void 0||r===void 0)return 0;{const i=r[0]-n[0],o=r[1]-n[1],s=i+o/1e9;return parseFloat(s.toFixed(3))}}static formatTimeMomentExpr(e){return`${e[0]}:${e[1]}`}static formatNanosecondsToTimeMomentExpr(e){return this.formatTimeMomentExpr(this.nanosecondsToTimeMoment(e))}static toTimeRange(e,n,r=!0,i=!0){return{start:e,end:n,isStartInclusive:r,isEndInclusive:i}}static formatTimeRangeExpr(e){const n=e.isStartInclusive?"[":"(",r=e.isEndInclusive?"]":")",i=e.start?`${e.start[0]}:${e.start[1]}`:"",o=e.end?`${e.end[0]}:${e.end[1]}`:"";return`${n}${i}_${o}${r}`}static timerangeDuration(e){let n=ne.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=ne.timeMomentToSeconds(n.start);return ne.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};ne.timeRangePattern=/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/;let R=ne;function Or(t){return t.format==="urn:x-nmos:format:data"&&t.container==="text/vtt"}function _r(t){var e,n,r;return{id:kt(t.id),label:((e=t.tags)==null?void 0:e.hls_name)??t.label??"Subtitles",default:((n=t.tags)==null?void 0:n.hls_default)==="YES",language:((r=t.tags)==null?void 0:r.hls_language)??"unknown",embedded:!1}}function kt(t){return`subtitles-${t}`}function xr(t,e){const n=t.filter(f=>e.get(f.id).length>0).map(f=>{const d=e.get(f.id);let m,h=!1;if(f.format==="urn:x-nmos:format:video"){const p=f.essence_parameters.frame_rate;p&&(m=p.numerator/(p.denominator??1),(p.numerator===6e4||p.numerator===3e4)&&p.denominator===1001&&(h=!0))}return{start:R.timeMomentToSeconds(R.parseTimeRange(d.at(0).timerange).start),frameRate:m,dropFrame:h}}).sort((f,d)=>f.start-d.start),r=n.find(f=>f.frameRate!==void 0),i=(r==null?void 0:r.start)??n.at(0).start,o=new Date(i*1e3),s=o.getUTCHours(),u=o.getUTCMinutes(),c=o.getUTCSeconds(),a=o.getUTCMilliseconds(),l=s*3600+u*60+c+a/1e3;return r===void 0?{ffom:ie.formatToTimecode(l,100,!1,!0),mediaStartTime:i,frameRate:100,dropFrame:!1}:{ffom:ie.formatToTimecode(l,r.frameRate,r.dropFrame),mediaStartTime:r.start,frameRate:r.frameRate,dropFrame:r.dropFrame}}class Nr{constructor(e){y(this,"_lanes",[]);y(this,"_markersLaneMap",new Map);y(this,"_laneNodenMap",new Map);this.omakasePlayer=e}addMarkerLane(e){const n={config:e,type:"marker"};this._lanes.push(n)}addMarkers(e,n){this._markersLaneMap.get(e)===void 0&&this._markersLaneMap.set(e,[]),this._markersLaneMap.get(e).push(...n)}addTimelineNode(e,n){this._laneNodenMap.get(e)||this._laneNodenMap.set(e,[]),this._laneNodenMap.get(e).push(n)}addThumbnailLane(e){const n={config:e,type:"thumbnail"};this._lanes.push(n)}addLabelLane(e){const n={config:e,type:"label"};this._lanes.push(n)}addSubtitlesLane(e){const n={config:e,type:"subtitles"};this._lanes.push(n)}buildAndAttachTimeline(e){this.omakasePlayer.createTimeline(e).subscribe({next:n=>{this.buildAttachedTimeline(n)}})}buildAttachedTimeline(e){this._lanes.forEach(n=>this._createAndAttachLane(e,n))}_createAndAttachLane(e,n){let r;if(n.type==="marker"){r=new O.MarkerLane(n.config),e.addTimelineLane(r);const o=this._markersLaneMap.get(r.id);o==null||o.forEach(s=>r.addMarker(s))}else n.type==="thumbnail"?(r=new O.ThumbnailLane(n.config),e.addTimelineLane(r)):n.type==="label"?(r=new O.LabelLane(n.config),e.addTimelineLane(r)):n.type==="subtitles"&&(r=new O.SubtitlesLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var nt=function(t,e){return nt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},nt(t,e)};function Le(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");nt(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function kr(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(f){s(f)}}function c(l){try{a(r.throw(l))}catch(f){s(f)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function Dt(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function we(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Pe(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Ee(t){return this instanceof Ee?(this.v=t,this):new Ee(t)}function Dr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(m){return function(h){return Promise.resolve(h).then(m,f)}}function u(m,h){r[m]&&(i[m]=function(p){return new Promise(function(w,E){o.push([m,p,w,E])>1||c(m,p)})},h&&(i[m]=h(i[m])))}function c(m,h){try{a(r[m](h))}catch(p){d(o[0][3],p)}}function a(m){m.value instanceof Ee?Promise.resolve(m.value.v).then(l,f):d(o[0][2],m)}function l(m){c("next",m)}function f(m){c("throw",m)}function d(m,h){m(h),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Fr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof we=="function"?we(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(a){o({value:a,done:u})},s)}}typeof SuppressedError=="function"&&SuppressedError;function H(t){return typeof t=="function"}function rt(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var it=rt(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
8
8
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
9
- `):"",this.name="UnsubscriptionError",this.errors=n}});function ot(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Re=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=we(s),c=u.next();!c.done;c=u.next()){var a=c.value;a.remove(this)}}catch(p){e={error:p}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(H(l))try{l()}catch(p){o=p instanceof it?p.errors:[p]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=we(f),m=d.next();!m.done;m=d.next()){var h=m.value;try{Bt(h)}catch(p){o=o??[],p instanceof it?o=Pe(Pe([],Be(o)),Be(p.errors)):o.push(p)}}}catch(p){r={error:p}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}if(o)throw new it(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Bt(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&ot(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&ot(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Ft=Re.EMPTY;function Vt(t){return t instanceof Re||t&&"closed"in t&&H(t.remove)&&H(t.add)&&H(t.unsubscribe)}function Bt(t){H(t)?t():t.unsubscribe()}var Vr={Promise:void 0},Br={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Pe([t,e],Be(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Pt(t){Br.setTimeout(function(){throw t})}function st(){}function Ue(t){t()}var at=function(t){Le(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Vt(n)&&n.add(r)):r.destination=Ur,r}return e.create=function(n,r,i){return new ut(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Re),Pr=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Ke(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Ke(r)}else Ke(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Ke(n)}},t}(),ut=function(t){Le(e,t);function e(n,r,i){var o=t.call(this)||this,s;return H(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Pr(s),o}return e}(at);function Ke(t){Pt(t)}function Rr(t){throw t}var Ur={closed:!0,next:st,error:Rr,complete:st},ct=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function He(t){return t}function Kr(t){return t.length===0?He:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var G=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=$r(e)?e:new ut(e,n,r);return Ue(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Rt(n),new n(function(i,o){var s=new ut({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[ct]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Kr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Rt(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function Rt(t){var e;return(e=t??Vr.Promise)!==null&&e!==void 0?e:Promise}function Hr(t){return t&&H(t.next)&&H(t.error)&&H(t.complete)}function $r(t){return t&&t instanceof at||Hr(t)&&Vt(t)}function Zr(t){return H(t==null?void 0:t.lift)}function he(t){return function(e){if(Zr(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ae(t,e,n,r,i){return new qr(t,e,n,r,i)}var qr=function(t){Le(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(a){try{r(a)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(a){try{o(a)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(at),Xr=rt(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),pe=function(t){Le(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new Ut(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Xr},e.prototype.next=function(n){var r=this;Ue(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=we(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(a){i={error:a}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Ue(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;Ue(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?Ft:(this.currentObservers=null,u.push(n),new Re(function(){r.currentObservers=null,ot(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new G;return n.source=this,n},e.create=function(n,r){return new Ut(n,r)},e}(G),Ut=function(t){Le(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:Ft},e}(pe),Wr=new G(function(t){return t.complete()});function jr(t){return t&&H(t.schedule)}function Kt(t){return t[t.length-1]}function Ht(t){return H(Kt(t))?t.pop():void 0}function Gr(t){return jr(Kt(t))?t.pop():void 0}var $t=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Zt(t){return H(t==null?void 0:t.then)}function qt(t){return H(t[ct])}function Xt(t){return Symbol.asyncIterator&&H(t==null?void 0:t[Symbol.asyncIterator])}function Wt(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var jt=Yr();function Gt(t){return H(t==null?void 0:t[jt])}function Yt(t){return Dr(this,arguments,function(){var n,r,i,o;return Dt(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ee(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Ee(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ee(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function zt(t){return H(t==null?void 0:t.getReader)}function Ae(t){if(t instanceof G)return t;if(t!=null){if(qt(t))return zr(t);if($t(t))return Jr(t);if(Zt(t))return Qr(t);if(Xt(t))return Jt(t);if(Gt(t))return ei(t);if(zt(t))return ti(t)}throw Wt(t)}function zr(t){return new G(function(e){var n=t[ct]();if(H(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Jr(t){return new G(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Qr(t){return new G(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Pt)})}function ei(t){return new G(function(e){var n,r;try{for(var i=we(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Jt(t){return new G(function(e){ni(t,e).catch(function(n){return e.error(n)})})}function ti(t){return Jt(Yt(t))}function ni(t,e){var n,r,i,o;return kr(this,void 0,void 0,function(){var s,u;return Dt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Fr(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ge(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Qt(t,e){return e===void 0&&(e=0),he(function(n,r){n.subscribe(ae(r,function(i){return ge(r,t,function(){return r.next(i)},e)},function(){return ge(r,t,function(){return r.complete()},e)},function(i){return ge(r,t,function(){return r.error(i)},e)}))})}function en(t,e){return e===void 0&&(e=0),he(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function ri(t,e){return Ae(t).pipe(en(e),Qt(e))}function ii(t,e){return Ae(t).pipe(en(e),Qt(e))}function oi(t,e){return new G(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function si(t,e){return new G(function(n){var r;return ge(n,e,function(){r=t[jt](),ge(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return H(r==null?void 0:r.return)&&r.return()}})}function tn(t,e){if(!t)throw new Error("Iterable cannot be null");return new G(function(n){ge(n,e,function(){var r=t[Symbol.asyncIterator]();ge(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ai(t,e){return tn(Yt(t),e)}function ui(t,e){if(t!=null){if(qt(t))return ri(t,e);if($t(t))return oi(t,e);if(Zt(t))return ii(t,e);if(Xt(t))return tn(t,e);if(Gt(t))return si(t,e);if(zt(t))return ai(t,e)}throw Wt(t)}function nn(t,e){return e?ui(t,e):Ae(t)}var rn=rt(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function ci(t,e){return he(function(n,r){var i=0;n.subscribe(ae(r,function(o){r.next(t.call(e,o,i++))}))})}var li=Array.isArray;function fi(t,e){return li(e)?t.apply(void 0,Pe([],Be(e))):t(e)}function on(t){return ci(function(e){return fi(t,e)})}var di=Array.isArray,mi=Object.getPrototypeOf,hi=Object.prototype,pi=Object.keys;function sn(t){if(t.length===1){var e=t[0];if(di(e))return{args:e,keys:null};if(gi(e)){var n=pi(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function gi(t){return t&&typeof t=="object"&&mi(t)===hi}function an(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function vi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Gr(t),r=Ht(t),i=sn(t),o=i.args,s=i.keys;if(o.length===0)return nn([],n);var u=new G(bi(o,n,s?function(c){return an(s,c)}:He));return r?u.pipe(on(r)):u}function bi(t,e,n){return n===void 0&&(n=He),function(r){un(e,function(){for(var i=t.length,o=new Array(i),s=i,u=i,c=function(l){un(e,function(){var f=nn(t[l],e),d=!1;f.subscribe(ae(r,function(m){o[l]=m,d||(d=!0,u--),u||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},a=0;a<i;a++)c(a)},r)}}function un(t,e,n){t?ge(n,t,e):e()}function wi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ht(t),r=sn(t),i=r.args,o=r.keys,s=new G(function(u){var c=i.length;if(!c){u.complete();return}for(var a=new Array(c),l=c,f=c,d=function(h){var p=!1;Ae(i[h]).subscribe(ae(u,function(w){p||(p=!0,f--),a[h]=w},function(){return l--},void 0,function(){(!l||!p)&&(f||u.next(o?an(o,a):a),u.complete())}))},m=0;m<c;m++)d(m)});return n?s.pipe(on(n)):s}function Ei(t,e){return he(function(n,r){var i=0;n.subscribe(ae(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Si(t){return he(function(e,n){var r=!1;e.subscribe(ae(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function Ti(t){return t<=0?function(){return Wr}:he(function(e,n){var r=0;e.subscribe(ae(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function yi(t){return t===void 0&&(t=Ci),he(function(e,n){var r=!1;e.subscribe(ae(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function Ci(){return new rn}function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(He,Ti(1),n?Si(e):yi(function(){return new rn}))}}function X(t){return he(function(e,n){Ae(t).subscribe(ae(n,function(){return n.complete()},st)),!n.closed&&e.subscribe(n)})}class Mi{constructor(){y(this,"actionZoomIn");y(this,"actionZoomOut");y(this,"actionResetZoom");y(this,"actionToggleNextAudioTrack");y(this,"actionTogglePreviousAudioTrack");y(this,"actionToggleCti")}getKeyboardShortcutsHelpMenuGroup(){let e=(...i)=>i.join(" + "),n="shift".toUpperCase();return{name:"Timeline function shortcuts",items:[{description:"Timeline Zoom In",name:e("=")},{description:"Timeline Zoom Out",name:e("-")},{description:"Timeline Zoom level 100%",name:e("0")},{description:"Toggle Next Audio Track",name:e(n,"e")},{description:"Toggle Previous Audio Track",name:e("e")},{description:"Toggle CTI into / out-of Interactive Mode",name:e("'")}]}}handleKeyboardEvent(e){const n=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(n.tagName.toUpperCase())?!1:e.code==="Equal"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomIn&&this.actionZoomIn(),!0):e.code==="Minus"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomOut&&this.actionZoomOut(),!0):e.code==="Digit0"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionResetZoom&&this.actionResetZoom(),!0):e.code==="KeyE"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionToggleNextAudioTrack&&this.actionToggleNextAudioTrack():this.actionTogglePreviousAudioTrack&&this.actionTogglePreviousAudioTrack(),!0):e.code==="Quote"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionToggleCti&&this.actionToggleCti(),!0):!1}}const Li=v.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(v.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{vi([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(Ei(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new Mi;i.actionToggleCti=()=>{var u;return(u=t.timeline)==null?void 0:u.toggleTimecodeEdit()},i.actionResetZoom=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomToEased(100)},i.actionZoomIn=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomInEased()},i.actionZoomOut=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomOutEased()};const o=u=>{const c=t.audio.getAudioTracks(),a=t.audio.getActiveAudioTrack(),f=c.findIndex(d=>d.id===(a==null?void 0:a.id))+(u?-1:1);f>=0&&f<c.length&&t.audio.setActiveAudioTrack(c.at(f).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=u=>{i.handleKeyboardEvent(u)&&(u.preventDefault(),u.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),v.createElement("div",{id:n.timelineHTMLElementId})));class cn{static get window(){return window}static get navigator(){return window.navigator}static get userAgent(){var n;const e=((n=this.navigator)==null?void 0:n.userAgent)||"";return/Android/i.test(e)?"android":/Firefox/i.test(e)?"firefox":/Edg/i.test(e)?"edge":(/Chrome/i.test(e)||/CriOS/i.test(e))&&!/Edg/i.test(e)?"chrome":/Chrome/i.test(e)||/CriOS/i.test(e)?"chromium":/Safari/i.test(e)?"safari":"unknown"}static get platform(){var n,r,i;const e=((r=(n=this.navigator)==null?void 0:n.userAgentData)==null?void 0:r.platform)||((i=this.navigator)==null?void 0:i.platform);return e!=null&&e.toUpperCase().includes("MAC")?"macos":e!=null&&e.toUpperCase().includes("WIN")?"windows":e!=null&&e.toUpperCase().includes("LINUX")?"linux":"unknown"}static isUserAgent(e){return this.userAgent===e}static isPlatform(e){return this.platform===e}static open(e,n="_blank"){this.window.open(e,n)}}const Ie=[.25,.5,.75,1,2,4,8];class ln{static getKeyboardShortcutsHelpMenuGroup(){let e=(...o)=>o.join(" + "),n="shift".toUpperCase(),r="ctrl".toUpperCase();return{name:"Playback function shortcuts",items:[{description:"Play / Pause",name:e("Space")},{description:"Toggle Sound",name:e("s")},{description:"Toggle Text On / Off",name:e("d")},{description:"Toggle Full Screen",name:e("f")},{description:"Increase Volume",name:e(n,"\\")},{description:"Reduce Volume",name:e("\\")},{description:"One Frame Forward",name:e("Right Arrow")},{description:"One Frame Backward",name:e("Left Arrow")},{description:"10 Frames Forward",name:e(n,"Right Arrow")},{description:"10 Frames Backwards",name:e(n,"Left Arrow")},{description:"Stop shuttle and pause",name:e("k")},{description:"Decrease Shuttle Forwards",name:e("l")},{description:"Increase Shuttle Forwards",name:e(n,"l")},{description:"Set playhead to Start of Media and Stop",name:e("1 / Home")},{description:"Set playhead to End of Media and Stop",name:e(r,"1")+" / End"}]}}static handleKeyboardEvent(e,n){const r=e.target,i=["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"],o=cn.userAgent;if(i.includes(r.tagName.toUpperCase()))return!1;if(n&&n.video){if(e.code==="Space"&&(o!=="safari"||!n.video.isFullscreen()))return n.video.togglePlayPause(),!0;if(e.code==="KeyS"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)return n.video.toggleMuteUnmute(),!0;if(e.code==="Backslash"){let s=10,u=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*u;c>=100?c=100:c<=0&&(c=0),n.video.setVolume(c/100)}if(e.code==="KeyD"&&!(e.ctrlKey&&e.shiftKey&&e.metaKey))return n.subtitles.toggleShowHideActiveTrack(),!0;if(e.code==="KeyK"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey&&(n.video.setPlaybackRate(1),n.video.pause()),e.code==="KeyL"&&!e.ctrlKey&&!e.metaKey){let s=e.shiftKey?1:-1;const u=Ie.indexOf(n.video.getPlaybackRate())+s;let c;return u<0?c=Ie.at(0):u>=Ie.length?c=Ie.at(-1):c=Ie.at(u),n.video.setPlaybackRate(c),n.video.isPaused()&&n.video.play(),!0}if(n.video.isVideoLoaded()){if(["ArrowLeft","ArrowRight"].includes(e.key)&&!e.metaKey&&!e.altKey){let s=e.key==="ArrowRight"?1:-1,u=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(u*s),!0}if(e.code==="Digit1"&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey||e.code==="Home")return n.video.pause().subscribe(()=>n.video.seekToFrame(0)),!0;if(e.code==="Digit1"&&e.ctrlKey||e.code==="End")return n.video.isPlaying()?n.video.pause().subscribe(()=>n.video.seekToEnd()):n.video.seekToEnd(),!0}if(e.code==="KeyF"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey)return n.video.toggleFullscreen(),!0}return!1}}const fn=v.memo(function({videoUrl:e,config:n,videoLoadOptions:r,onVideoLoadedCallback:i,enableHotkeys:o}){return n&&(n==null?void 0:n.playerHTMLElementId)===void 0&&(n.playerHTMLElementId="omakase-player"),v.useEffect(()=>{var c,a;let s=new O.OmakasePlayer(n);const u=l=>{ln.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(a=document.querySelector("media-controller"))==null||a.setAttribute("tabindex","-1"),window.addEventListener("keydown",u),s.video.appendHelpMenuGroup(ln.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",u)}},[e]),v.createElement("div",{id:n.playerHTMLElementId})}),Ai=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M10.5675 21C10.2375 21 9.9675 20.73 9.9675 20.4V16.7925L5.6325 12.3675L9.9675 8.235V3.6C9.9675 3.27 10.2375 3 10.5675 3C10.8975 3 11.1675 3.27 11.1675 3.6V8.7525L7.3425 12.3975L11.1675 16.305V20.4C11.1675 20.73 10.8975 21 10.5675 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.7675 17.145C17.61 17.145 17.46 17.085 17.34 16.965L12.8325 12.3675L17.355 8.0625C17.595 7.8375 17.9775 7.845 18.2025 8.085C18.4275 8.325 18.42 8.7075 18.18 8.9325L14.5425 12.3975L18.195 16.125C18.4275 16.365 18.42 16.74 18.1875 16.9725C18.075 17.085 17.9175 17.145 17.7675 17.145Z",fill:"#CACFEA"})),Ii=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M13.4325 21C13.7625 21 14.0325 20.73 14.0325 20.4V16.7925L18.3675 12.3675L14.0325 8.235V3.6C14.0325 3.27 13.7625 3 13.4325 3C13.1025 3 12.8325 3.27 12.8325 3.6V8.7525L16.6575 12.3975L12.8325 16.305V20.4C12.8325 20.73 13.1025 21 13.4325 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M6.2325 17.145C6.39 17.145 6.54 17.085 6.66 16.965L11.1675 12.3675L6.645 8.0625C6.405 7.8375 6.0225 7.845 5.7975 8.085C5.5725 8.325 5.58 8.7075 5.82 8.9325L9.4575 12.3975L5.805 16.125C5.5725 16.365 5.58 16.74 5.8125 16.9725C5.925 17.085 6.0825 17.145 6.2325 17.145Z",fill:"#CACFEA"})),Oi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M14.1675 21C13.8375 21 13.5675 20.73 13.5675 20.4V16.7925L9.2325 12.3675L13.5675 8.235V3.6C13.5675 3.27 13.8375 3 14.1675 3C14.4975 3 14.7675 3.27 14.7675 3.6V8.7525L10.9425 12.3975L14.7675 16.305V20.4C14.7675 20.73 14.4975 21 14.1675 21Z",fill:"#CACFEA"})),_i=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M9.8325 21C10.1625 21 10.4325 20.73 10.4325 20.4V16.7925L14.7675 12.3675L10.4325 8.235V3.6C10.4325 3.27 10.1625 3 9.8325 3C9.5025 3 9.2325 3.27 9.2325 3.6V8.7525L13.0575 12.3975L9.2325 16.305V20.4C9.2325 20.73 9.5025 21 9.8325 21Z",fill:"#CACFEA"})),xi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),v.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Ni=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M6.39001 3V21L12 17.0175L17.61 21V3H6.38251H6.39001ZM16.44 3.84L7.23001 18.7125V3.84H16.44ZM12 15.9975L8.25751 18.6525L16.77 4.89V19.3725L12 15.9825V15.9975Z",fill:"#CACFEA"})),Di=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.3075 8.0175L14.4525 5.8725C14.6175 5.7075 14.6175 5.43 14.4525 5.265L12.3 3.12C12.135 2.955 11.8575 2.955 11.6925 3.12C11.5275 3.285 11.5275 3.5625 11.6925 3.7275L13.1025 5.1375H6.64499C5.22749 5.1375 4.07249 6.2925 4.07249 7.71V16.2825C4.07249 17.7 5.22749 18.855 6.64499 18.855C6.87749 18.855 7.07249 18.66 7.07249 18.4275C7.07249 18.195 6.87749 18 6.64499 18C5.69249 18 4.93499 17.2275 4.93499 16.29V7.7175C4.93499 6.765 5.70749 6.0075 6.64499 6.0075H13.11L11.7 7.4175C11.535 7.5825 11.535 7.86 11.7 8.025C11.865 8.19 12.1425 8.19 12.3075 8.025V8.0175Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.355 18.8625C18.7725 18.8625 19.9275 17.7075 19.9275 16.29V7.7175C19.9275 6.3 18.7725 5.145 17.355 5.145C17.1225 5.145 16.9275 5.34 16.9275 5.5725C16.9275 5.805 17.1225 6 17.355 6C18.3075 6 19.065 6.7725 19.065 7.71V16.2825C19.065 17.235 18.2925 17.9925 17.355 17.9925H10.89L12.3075 16.5825C12.3825 16.5075 12.435 16.395 12.435 16.2825C12.435 16.17 12.3975 16.0575 12.3075 15.9825C12.15 15.8175 11.8575 15.825 11.7 15.9825L9.52501 18.1575V18.18C9.45751 18.255 9.42751 18.345 9.42751 18.435C9.42751 18.555 9.46501 18.66 9.55501 18.735L11.7 20.88C11.8575 21.045 12.15 21.045 12.3075 20.88C12.4725 20.715 12.4725 20.4375 12.3075 20.2725L10.89 18.8625H17.355Z",fill:"#CACFEA"})),Fi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_237)"},v.createElement("path",{d:"M13.02 19.95C17.42 19.95 21 16.37 21 11.97C21 7.57 17.42 4 13.02 4C8.88 4 5.39 7.24 5.08 11.37L5.02 12.14L3.56 10.68C3.49 10.61 3.41 10.58 3.33 10.58C3.25 10.58 3.17 10.61 3.1 10.68C3.03 10.75 3 10.83 3 10.92C3 11 3.03 11.08 3.1 11.15L5.22 13.27C5.35 13.4 5.55 13.43 5.65 13.3L7.8 11.15C7.87 11.08 7.9 11 7.9 10.92C7.9 10.84 7.86 10.76 7.8 10.69C7.73 10.62 7.65 10.59 7.57 10.59C7.49 10.59 7.41 10.62 7.34 10.69L5.9 12.13L6.03 11.11C6.45 7.57 9.46 4.91 13.02 4.91C16.91 4.91 20.08 8.08 20.08 11.97C20.08 15.86 16.91 19.03 13.02 19.03C12.77 19.03 12.56 19.24 12.56 19.49C12.56 19.74 12.77 19.95 13.02 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M14.95 13.19C14.95 13.72 14.75 14.14 14.36 14.45C13.97 14.76 13.43 14.91 12.75 14.91C12.16 14.91 11.69 14.81 11.32 14.62V13.53C11.7 13.81 12.14 13.95 12.65 13.95C12.98 13.95 13.23 13.88 13.41 13.74C13.59 13.6 13.67 13.41 13.67 13.17C13.67 12.93 13.56 12.72 13.34 12.58C13.12 12.44 12.82 12.37 12.43 12.37H11.92V11.41H12.39C13.13 11.41 13.5 11.16 13.5 10.67C13.5 10.21 13.22 9.98 12.65 9.98C12.26 9.98 11.89 10.1 11.54 10.35V9.33C11.93 9.13 12.4 9.03 12.94 9.03C13.48 9.03 13.94 9.16 14.28 9.41C14.62 9.66 14.79 10.01 14.79 10.44C14.79 11.19 14.41 11.65 13.66 11.84V11.86C14.06 11.91 14.37 12.05 14.61 12.29C14.85 12.53 14.96 12.83 14.96 13.19H14.95Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_237"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Vi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_260)"},v.createElement("path",{d:"M10.98 19.95C6.58 19.95 3 16.37 3 11.98C3 7.58 6.58 4 10.98 4C15.12 4 18.61 7.24 18.93 11.37L18.99 12.14L20.45 10.68C20.52 10.61 20.6 10.58 20.68 10.58C20.76 10.58 20.84 10.61 20.91 10.68C20.98 10.75 21.01 10.83 21.01 10.91C21.01 10.99 20.98 11.07 20.91 11.14L18.79 13.26C18.66 13.39 18.46 13.42 18.36 13.29L16.21 11.14C16.14 11.07 16.11 10.99 16.11 10.91C16.11 10.83 16.15 10.75 16.21 10.68C16.28 10.61 16.36 10.58 16.44 10.58C16.52 10.58 16.6 10.61 16.67 10.68L18.11 12.12L17.98 11.1C17.55 7.57 14.54 4.91 10.98 4.91C7.09 4.91 3.92 8.08 3.92 11.97C3.92 15.86 7.09 19.03 10.98 19.03C11.23 19.03 11.44 19.24 11.44 19.49C11.44 19.74 11.23 19.95 10.98 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.91 13.19C12.91 13.72 12.71 14.14 12.32 14.45C11.93 14.76 11.39 14.91 10.71 14.91C10.12 14.91 9.65 14.81 9.28 14.62V13.53C9.66 13.81 10.1 13.95 10.61 13.95C10.94 13.95 11.19 13.88 11.37 13.74C11.55 13.6 11.63 13.41 11.63 13.17C11.63 12.93 11.52 12.72 11.3 12.58C11.08 12.44 10.78 12.37 10.39 12.37H9.88V11.41H10.35C11.09 11.41 11.46 11.16 11.46 10.67C11.46 10.21 11.18 9.98 10.61 9.98C10.22 9.98 9.85 10.1 9.5 10.35V9.33C9.89 9.13 10.36 9.03 10.9 9.03C11.44 9.03 11.9 9.16 12.24 9.41C12.58 9.66 12.75 10.01 12.75 10.44C12.75 11.19 12.37 11.65 11.62 11.84V11.86C12.02 11.91 12.33 12.05 12.57 12.29C12.81 12.53 12.92 12.83 12.92 13.19H12.91Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_260"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),J=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>v.createElement("button",{disabled:o,onClick:e},v.createElement(t,{width:n,height:r})," ",i),Bi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),v.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Pi=({width:t,height:e})=>v.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),v.createElement("path",{d:"M7.16667 6.33333V6.83333H7.66667H10.3333C10.4257 6.83333 10.5 6.90769 10.5 7C10.5 7.09231 10.4257 7.16667 10.3333 7.16667H7.66667H7.16667V7.66667V10.3333C7.16667 10.4257 7.09231 10.5 7 10.5C6.90769 10.5 6.83333 10.4257 6.83333 10.3333V7.66667V7.16667H6.33333H3.66667C3.57468 7.16667 3.5 7.09199 3.5 7C3.5 6.90801 3.57468 6.83333 3.66667 6.83333H6.33333H6.83333V6.33333V3.66667C6.83333 3.57468 6.90801 3.5 7 3.5C7.09199 3.5 7.16667 3.57468 7.16667 3.66667V6.33333Z",fill:"#CACFEA",stroke:"#CACFEA"}));function te(t){t.next(),t.complete()}class Ri{constructor(){y(this,"actionMarkerInOut");y(this,"actionMarkerSplit");y(this,"actionMarkerDelete");y(this,"actionPreviousMarkerToggle");y(this,"actionNextMarkerToggle");y(this,"actionSetMarkerStartToPlayhead");y(this,"actionSetMarkerEndToPlayhead");y(this,"actionSetPlayheadToMarkerStart");y(this,"actionSetPlayheadToMarkerEnd");y(this,"actionRewind3SecondsAndPlayToCurrent");y(this,"actionPlay3SecondsAndRewindToCurrent");y(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=cn.platform;let i=r==="windows"?"win":r==="linux"?"super":"cmd";return{name:"Segmentation function shortcuts",items:[{description:"Mark In / Out",name:e("m")},{description:"Split Active Marker",name:e(".")},{description:"Delete Active Marker",name:e("n")},{description:"Toggle Previous Marker",name:e("/")},{description:"Toggle Next Marker",name:e(n,"/")},{description:"Set Start of Active Marker to Playhead Position",name:e("i")},{description:"Set End of Active Marker to Playhead Position",name:e("o")},{description:"Set Playhead to Start of Active Marker",name:e("[")},{description:"Set Playhead to End of Active Marker",name:e("]")},{description:"Rewind 3 Seconds and Play to Current Playhead",name:e(i,"Arrow Left")},{description:"Play 3 Seconds and Rewind to Current Playhead",name:e(i,"Arrow Right")},{description:"Loop on Active Marker",name:e("p")}]}}handleKeyboardEvent(e,n){const r=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(r.tagName.toUpperCase())?!1:e.code==="KeyM"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerInOut&&this.actionMarkerInOut(),!0):e.code==="Period"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerSplit&&this.actionMarkerSplit(),!0):e.code==="KeyN"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerDelete&&this.actionMarkerDelete(),!0):e.code==="Slash"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionNextMarkerToggle&&this.actionNextMarkerToggle():this.actionPreviousMarkerToggle&&this.actionPreviousMarkerToggle(),!0):e.code==="KeyI"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerStartToPlayhead&&this.actionSetMarkerStartToPlayhead(),!0):e.code==="KeyO"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerEndToPlayhead&&this.actionSetMarkerEndToPlayhead(),!0):e.code==="BracketLeft"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerStart&&this.actionSetPlayheadToMarkerStart(),!0):e.code==="BracketRight"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerEnd&&this.actionSetPlayheadToMarkerEnd(),!0):e.code==="ArrowLeft"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionRewind3SecondsAndPlayToCurrent&&this.actionRewind3SecondsAndPlayToCurrent(),!0):e.code==="ArrowRight"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionPlay3SecondsAndRewindToCurrent&&this.actionPlay3SecondsAndRewindToCurrent(),!0):e.code==="KeyP"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionLoopActiveMarker&&this.actionLoopActiveMarker(),!0):!1}}const $e=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof O.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,u=i.timeObservation.end,c=o.start,a=n??o.end;if(c!=null&&a!=null)return r||c<=u&&a>=s}return r},!1);function Ze(t,e,n){if(!t||!(t instanceof O.PeriodMarker))return!0;const r=t.timeObservation.start,i=t.timeObservation.end;if(r==null||i==null)return!0;const o=n.video.calculateTimeToFrame(i),s=n.video.calculateTimeToFrame(r),u=n.video.getCurrentFrame();return e<r||o-u<2||u-s<1}function qe(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Ui=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:u,setSource:c,source:a,constants:l})=>{const f=v.useRef(void 0),d=v.useRef(void 0),m=new pe,h=v.useRef(!1),p=(b,S,I)=>{const B=S??e.video.getCurrentTime();return b.getMarkers().reduce((N,W)=>W instanceof O.PeriodMarker&&W.timeObservation.start!==void 0&&W.timeObservation.end!==void 0&&W.id!==(I==null?void 0:I.id)?N||B>=W.timeObservation.start&&B<=W.timeObservation.end:N,!1)},w=b=>{if(_===void 0)return!0;const S=_.timeObservation.start,I=b??e.video.getCurrentTime();return!!(S==null||S>=I||$e(a,_,I))},E=b=>_!==void 0||a===void 0?!0:p(a,b,_),[x,A]=v.useState(void 0),[D,V]=v.useState(Ze(t,e.video.getCurrentTime(),e)),[_,Y]=v.useState(void 0),[oe,z]=v.useState(w()),[Te,$]=v.useState(E()),ue=b=>{if(b===void 0||a===void 0||!(b instanceof O.PeriodMarker))return!0;const S=$e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof O.PeriodMarker){const I=b.timeObservation.end;if(I!=null&&e.video.getCurrentTime()>=I)return!0}return!1},ce=b=>{if(b===void 0||a===void 0||!(b instanceof O.PeriodMarker))return!0;const S=$e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof O.PeriodMarker){if(b.timeObservation.end==null)return!0;const I=b.timeObservation.start;if(I!=null&&e.video.getCurrentTime()<=I)return!0}return!1},[ye,U]=v.useState(ue(t)),[k,gt]=v.useState(ce(t));v.useEffect(()=>{if(z(()=>w()),$(()=>E()),_&&_!==t){const b=i.find(S=>S.getMarker(_.id));b==null||b.removeMarker(_.id),Y(void 0)}},[t,_,i,Y]),v.useEffect(()=>()=>te(m),[]),v.useEffect(()=>{if(U(ue(t)),gt(ce(t)),t){const b=Ze(t,e.video.getCurrentTime(),e);V(b);const S=e.video.onVideoTimeChange$.pipe(X(m)).subscribe({next:I=>{V(B=>Ze(t,I.currentTime,e)),U(()=>ue(t)),gt(()=>ce(t))}});return()=>S.unsubscribe()}},[t]),v.useEffect(()=>{e.video.onSeeking$.pipe(X(m)).subscribe({next:S=>{z(()=>w(S.toTime)),$(()=>E(S.toTime))}});const b=e.video.onVideoTimeChange$.pipe(X(m)).subscribe({next:S=>{z(()=>w()),$(()=>E())}});return()=>b.unsubscribe()},[_,a]),v.useEffect(()=>{const b=i.map(S=>S.onMarkerUpdate$.pipe(X(m)).subscribe({next:I=>{(t==null?void 0:t.id)===I.marker.id&&(V(B=>Ze(t,e.video.getCurrentTime(),e)),U(()=>ue(t)),gt(()=>ce(t)))}}));return()=>b.forEach(S=>S.unsubscribe())},[i,t]),v.useEffect(()=>{x&&(x.marker.style={...x.marker.style,color:x.color},x.marker.timeObservation={...x.marker.timeObservation},A(void 0))},[t]),v.useEffect(()=>{if(a){z(()=>w()),$(()=>E());const b=a.onMarkerDelete$.pipe(X(m)).subscribe({next:I=>{const B=I.marker;A(N=>{if((N==null?void 0:N.marker.id)!==B.id)return N}),s(N=>{if((N==null?void 0:N.id)!==B.id)return N}),Y(N=>{if((N==null?void 0:N.id)!==B.id)return N}),z(()=>w()),$(()=>E())}}),S=a.onMarkerUpdate$.pipe(X(m)).subscribe({next:()=>{z(()=>w()),$(()=>E())}});return()=>{b.unsubscribe(),S.unsubscribe()}}},[a]);const Cn=(b,S)=>{if(S===void 0)return;const I=S.timeObservation;b.video.seekToTime(I.start)},Mn=(b,S)=>{if(S===void 0)return;const I=S.timeObservation;b.video.seekToTime(I.end)},Ln=(b,S)=>{S instanceof O.PeriodMarker&&S.timeObservation.start!==void 0&&(S.timeObservation={...S.timeObservation,start:b.video.getCurrentTime()})},An=(b,S)=>{S instanceof O.PeriodMarker&&S.timeObservation.end!==void 0&&(S.timeObservation={...S.timeObservation,end:b.video.getCurrentTime()})},In=(b,S)=>{f.current&&te(f.current),f.current=new pe,b.video.pause();const I=b.video.getCurrentFrame(),B=b.video.getFrameRate(),N=I-S*B,W=N>=0?N:0;b.video.seekToFrame(W).pipe(Se()).subscribe(()=>{}),b.video.play(),b.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(je=>{je.frame>=I-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})}),te(f.current))})},On=(b,S)=>{f.current&&te(f.current),f.current=new pe,d.current&&te(d.current),d.current=new pe;const I=b.video.getCurrentFrame(),B=b.video.getFrameRate(),N=I+S*B;b.video.play(),b.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(W=>{W.frame>=N-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})}),te(f.current))}),b.video.onEnded$.pipe(X(d.current),X(m)).subscribe(W=>{setTimeout(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})},1),te(d.current)})},vt=b=>{a.removeMarker(b.id),(_==null?void 0:_.id)===b.id&&Y(void 0)},_n=(b,S)=>{if(!(S instanceof O.PeriodMarker))return;const I=S.timeObservation.start,B=S.timeObservation.end,N=b.video.getCurrentTime();if(I==null||B==null)return;const W=I,je=N,ao=je+1/b.video.getFrameRate(),uo=B;vt(S);const bt=new O.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:W,end:je},editable:!0});bt.onClick$.subscribe({next:()=>u(bt)});const Oe=new O.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:ao,end:uo},editable:!0});Oe.onClick$.subscribe({next:()=>u(Oe)}),a.addMarker(bt),a.addMarker(Oe),u(Oe),setTimeout(()=>{A({marker:Oe,color:l.PERIOD_MARKER_STYLE.color})},0)},xn=()=>{const b=e.video.getCurrentTime(),S=new O.PeriodMarker({timeObservation:{start:b},style:l.PERIOD_MARKER_STYLE,editable:!0});S.onClick$.subscribe({next:()=>u(S)}),a.addMarker(S),Y(S),z(w()),u(S)},Nn=()=>{const b=e.video.getCurrentTime();_.timeObservation={..._.timeObservation,end:b},Y(void 0)},kn=b=>{f.current&&te(f.current),f.current=new pe,d.current&&te(d.current),d.current=new pe;const S=e.video.calculateTimeToFrame(b.timeObservation.start),I=e.video.calculateTimeToFrame(b.timeObservation.end);e.video.pause(),e.video.seekToFrame(S),e.video.play(),e.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(B=>{B.frame>=I-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(S).pipe(Se()).subscribe(()=>{})}),te(f.current))}),e.video.onEnded$.pipe(X(d.current),X(m)).subscribe(B=>{setTimeout(()=>{e.video.seekToFrame(S).pipe(Se()).subscribe(()=>{})},1),te(d.current)})},so=()=>{const b=i.length,S=`Segmentation ${i.length+1}`,I=new O.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:S});I.onMarkerUpdate$.subscribe({next:B=>{$e(I,B.marker)&&(B.marker.timeObservation=B.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(I,b+1),o([...i,I]),u(void 0),c(I)},Dn=b=>{if(!a)return;const S=a.getMarkers().filter(N=>N instanceof O.PeriodMarker).sort((N,W)=>N.timeObservation.start??0-(W.timeObservation.start??0));if(t===void 0){u(S.at(0));return}const B=S.findIndex(N=>N.id===t.id)+(b?-1:1);B>=0&&B<S.length&&u(S.at(B))};return v.useEffect(()=>{if(!r)return;const b=new Ri;b.actionLoopActiveMarker=()=>t instanceof O.PeriodMarker&&qe(t)&&kn(t),b.actionSetPlayheadToMarkerStart=()=>t&&Cn(e,t),b.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof O.PeriodMarker&&qe(t)&&Mn(e,t),b.actionSetMarkerStartToPlayhead=()=>!ye&&Ln(e,t),b.actionSetMarkerEndToPlayhead=()=>!k&&An(e,t),b.actionMarkerSplit=()=>!D&&_n(e,t),b.actionMarkerDelete=()=>t&&vt(t),b.actionMarkerInOut=()=>{_===void 0?!Te&&xn():!oe&&Nn()},b.actionPlay3SecondsAndRewindToCurrent=()=>On(e,3),b.actionRewind3SecondsAndPlayToCurrent=()=>In(e,3),b.actionNextMarkerToggle=()=>Dn(!1),b.actionPreviousMarkerToggle=()=>Dn(!0);const S=I=>{b.handleKeyboardEvent(I,e)&&(I.stopPropagation(),I.preventDefault())};return window.addEventListener("keydown",S),h.current||(e.video.appendHelpMenuGroup(b.getKeyboardShortcutsHelpMenuGroup()),h.current=!0),()=>window.removeEventListener("keydown",S)}),v.createElement("div",{className:"control-panel-wrapper"},v.createElement("div",{className:"control-panel"},v.createElement(J,{Icon:Ai,onClick:()=>Cn(e,t),disabled:t===void 0}),v.createElement(J,{Icon:Ii,onClick:()=>Mn(e,t),disabled:t===void 0||t instanceof O.PeriodMarker&&!qe(t)}),v.createElement(J,{Icon:Oi,onClick:()=>Ln(e,t),disabled:ye}),v.createElement(J,{Icon:_i,onClick:()=>An(e,t),disabled:k}),_===void 0?v.createElement(J,{Icon:xi,onClick:xn,disabled:Te}):v.createElement(J,{Icon:Bi,onClick:Nn,disabled:oe}),v.createElement(J,{Icon:ki,onClick:()=>vt(t),disabled:t===void 0}),v.createElement(J,{Icon:Ni,onClick:()=>_n(e,t),disabled:D||t===void 0}),v.createElement(J,{Icon:Di,onClick:()=>kn(t),disabled:!(t instanceof O.PeriodMarker&&qe(t))}),v.createElement(J,{Icon:Fi,onClick:()=>In(e,3)}),v.createElement(J,{Icon:Vi,onClick:()=>On(e,3)})),v.createElement("div",{className:"control-panel"},v.createElement("div",{className:"segmentation-button-wrapper"},v.createElement(J,{Icon:Pi,text:"NEW SEGMENTATION",onClick:()=>so(),disabled:i.length>=3}))))};class ve{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ve.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ve.isNullUndefinedOrWhitespace(e)&&!ve.isNullUndefinedOrWhitespace(n)?e.indexOf(n,e.length-n.length)!==-1:!1}static toMixedCase(e){let n={NBCU:"NBCU",REDBEE:"Red Bee",CMORE:"C More",TV2:"TV2",BBC:"BBC"};return e.replace(/_/g," ").split(" ").map(r=>r in n?n[r]:`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()}`).join(" ")}static replaceWhitespace(e,n){return e&&e.trim().replace(/([\n ]*,[\n ]*|[\n ]+)/g,n).replace(new RegExp(`${n}$`),"")}static whitespacesToCommas(e){return ve.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ve.replaceWhitespace(e," ").split(" "):void 0}}class Ki{constructor(e=3,n=!1){this.targetDuration=null,this.mediaSequence=null,this.programDateTime=null,this.playlistType=null,this.streams=[],this.media=[],this.segments=[],this.endList=!1,this.version=e,this.independentSegments=n}}class lt{constructor(e,n,r,i,o){this.bandwidth=e,this.averageBandwidth=n,this.resolution=r,this.frameRate=i,this.uri=o}}class Hi{constructor(e,n,r,i,o,s,u){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=u}}class $i{constructor(e,n){this.duration=e,this.uri=n}}class dn{constructor(){this.playlist=new Ki}setVersion(e){return this.playlist.version=e,this}setIndependentSegments(e){return this.playlist.independentSegments=e,this}setTargetDuration(e){return this.playlist.targetDuration=e,this}setMediaSequence(e){return this.playlist.mediaSequence=e,this}setProgramDateTime(e){return this.playlist.programDateTime=e,this}setPlaylistType(e){return this.playlist.playlistType=e,this}addStreamInfo(e){return this.playlist.streams.push(e),this}addMedia(e){return this.playlist.media.push(e),this}addSegment(e,n=!1){const r={...e,gap:n};return this.playlist.segments.push(r),this}setEndList(){return this.playlist.endList=!0,this}setStartOffset(e){return this.playlist.startOffset=e,this}build(){return this.playlist}}class mn{static write(e){let n=`#EXTM3U
9
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function ot(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Re=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=we(s),c=u.next();!c.done;c=u.next()){var a=c.value;a.remove(this)}}catch(p){e={error:p}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(H(l))try{l()}catch(p){o=p instanceof it?p.errors:[p]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var d=we(f),m=d.next();!m.done;m=d.next()){var h=m.value;try{Bt(h)}catch(p){o=o??[],p instanceof it?o=Pe(Pe([],Be(o)),Be(p.errors)):o.push(p)}}}catch(p){r={error:p}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}if(o)throw new it(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Bt(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&ot(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&ot(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Ft=Re.EMPTY;function Vt(t){return t instanceof Re||t&&"closed"in t&&H(t.remove)&&H(t.add)&&H(t.unsubscribe)}function Bt(t){H(t)?t():t.unsubscribe()}var Vr={Promise:void 0},Br={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Pe([t,e],Be(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Pt(t){Br.setTimeout(function(){throw t})}function st(){}function Ue(t){t()}var at=function(t){Le(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Vt(n)&&n.add(r)):r.destination=Ur,r}return e.create=function(n,r,i){return new ut(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Re),Pr=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){Ke(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Ke(r)}else Ke(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Ke(n)}},t}(),ut=function(t){Le(e,t);function e(n,r,i){var o=t.call(this)||this,s;return H(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Pr(s),o}return e}(at);function Ke(t){Pt(t)}function Rr(t){throw t}var Ur={closed:!0,next:st,error:Rr,complete:st},ct=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function He(t){return t}function Kr(t){return t.length===0?He:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var G=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=$r(e)?e:new ut(e,n,r);return Ue(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Rt(n),new n(function(i,o){var s=new ut({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[ct]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Kr(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Rt(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function Rt(t){var e;return(e=t??Vr.Promise)!==null&&e!==void 0?e:Promise}function Hr(t){return t&&H(t.next)&&H(t.error)&&H(t.complete)}function $r(t){return t&&t instanceof at||Hr(t)&&Vt(t)}function Zr(t){return H(t==null?void 0:t.lift)}function he(t){return function(e){if(Zr(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ae(t,e,n,r,i){return new qr(t,e,n,r,i)}var qr=function(t){Le(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(a){try{r(a)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(a){try{o(a)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(at),Xr=rt(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),pe=function(t){Le(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new Ut(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Xr},e.prototype.next=function(n){var r=this;Ue(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=we(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(a){i={error:a}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Ue(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;Ue(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?Ft:(this.currentObservers=null,u.push(n),new Re(function(){r.currentObservers=null,ot(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new G;return n.source=this,n},e.create=function(n,r){return new Ut(n,r)},e}(G),Ut=function(t){Le(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:Ft},e}(pe),Wr=new G(function(t){return t.complete()});function jr(t){return t&&H(t.schedule)}function Kt(t){return t[t.length-1]}function Ht(t){return H(Kt(t))?t.pop():void 0}function Gr(t){return jr(Kt(t))?t.pop():void 0}var $t=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Zt(t){return H(t==null?void 0:t.then)}function qt(t){return H(t[ct])}function Xt(t){return Symbol.asyncIterator&&H(t==null?void 0:t[Symbol.asyncIterator])}function Wt(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Yr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var jt=Yr();function Gt(t){return H(t==null?void 0:t[jt])}function Yt(t){return Dr(this,arguments,function(){var n,r,i,o;return Dt(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ee(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Ee(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ee(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function zt(t){return H(t==null?void 0:t.getReader)}function Ae(t){if(t instanceof G)return t;if(t!=null){if(qt(t))return zr(t);if($t(t))return Jr(t);if(Zt(t))return Qr(t);if(Xt(t))return Jt(t);if(Gt(t))return ei(t);if(zt(t))return ti(t)}throw Wt(t)}function zr(t){return new G(function(e){var n=t[ct]();if(H(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Jr(t){return new G(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Qr(t){return new G(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,Pt)})}function ei(t){return new G(function(e){var n,r;try{for(var i=we(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Jt(t){return new G(function(e){ni(t,e).catch(function(n){return e.error(n)})})}function ti(t){return Jt(Yt(t))}function ni(t,e){var n,r,i,o;return kr(this,void 0,void 0,function(){var s,u;return Dt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Fr(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ge(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Qt(t,e){return e===void 0&&(e=0),he(function(n,r){n.subscribe(ae(r,function(i){return ge(r,t,function(){return r.next(i)},e)},function(){return ge(r,t,function(){return r.complete()},e)},function(i){return ge(r,t,function(){return r.error(i)},e)}))})}function en(t,e){return e===void 0&&(e=0),he(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function ri(t,e){return Ae(t).pipe(en(e),Qt(e))}function ii(t,e){return Ae(t).pipe(en(e),Qt(e))}function oi(t,e){return new G(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function si(t,e){return new G(function(n){var r;return ge(n,e,function(){r=t[jt](),ge(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return H(r==null?void 0:r.return)&&r.return()}})}function tn(t,e){if(!t)throw new Error("Iterable cannot be null");return new G(function(n){ge(n,e,function(){var r=t[Symbol.asyncIterator]();ge(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ai(t,e){return tn(Yt(t),e)}function ui(t,e){if(t!=null){if(qt(t))return ri(t,e);if($t(t))return oi(t,e);if(Zt(t))return ii(t,e);if(Xt(t))return tn(t,e);if(Gt(t))return si(t,e);if(zt(t))return ai(t,e)}throw Wt(t)}function nn(t,e){return e?ui(t,e):Ae(t)}var rn=rt(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function ci(t,e){return he(function(n,r){var i=0;n.subscribe(ae(r,function(o){r.next(t.call(e,o,i++))}))})}var li=Array.isArray;function fi(t,e){return li(e)?t.apply(void 0,Pe([],Be(e))):t(e)}function on(t){return ci(function(e){return fi(t,e)})}var di=Array.isArray,mi=Object.getPrototypeOf,hi=Object.prototype,pi=Object.keys;function sn(t){if(t.length===1){var e=t[0];if(di(e))return{args:e,keys:null};if(gi(e)){var n=pi(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function gi(t){return t&&typeof t=="object"&&mi(t)===hi}function an(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function vi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Gr(t),r=Ht(t),i=sn(t),o=i.args,s=i.keys;if(o.length===0)return nn([],n);var u=new G(bi(o,n,s?function(c){return an(s,c)}:He));return r?u.pipe(on(r)):u}function bi(t,e,n){return n===void 0&&(n=He),function(r){un(e,function(){for(var i=t.length,o=new Array(i),s=i,u=i,c=function(l){un(e,function(){var f=nn(t[l],e),d=!1;f.subscribe(ae(r,function(m){o[l]=m,d||(d=!0,u--),u||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},a=0;a<i;a++)c(a)},r)}}function un(t,e,n){t?ge(n,t,e):e()}function wi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ht(t),r=sn(t),i=r.args,o=r.keys,s=new G(function(u){var c=i.length;if(!c){u.complete();return}for(var a=new Array(c),l=c,f=c,d=function(h){var p=!1;Ae(i[h]).subscribe(ae(u,function(w){p||(p=!0,f--),a[h]=w},function(){return l--},void 0,function(){(!l||!p)&&(f||u.next(o?an(o,a):a),u.complete())}))},m=0;m<c;m++)d(m)});return n?s.pipe(on(n)):s}function Ei(t,e){return he(function(n,r){var i=0;n.subscribe(ae(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Si(t){return he(function(e,n){var r=!1;e.subscribe(ae(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function Ti(t){return t<=0?function(){return Wr}:he(function(e,n){var r=0;e.subscribe(ae(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function yi(t){return t===void 0&&(t=Ci),he(function(e,n){var r=!1;e.subscribe(ae(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function Ci(){return new rn}function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(He,Ti(1),n?Si(e):yi(function(){return new rn}))}}function X(t){return he(function(e,n){Ae(t).subscribe(ae(n,function(){return n.complete()},st)),!n.closed&&e.subscribe(n)})}class Mi{constructor(){y(this,"actionZoomIn");y(this,"actionZoomOut");y(this,"actionResetZoom");y(this,"actionToggleNextAudioTrack");y(this,"actionTogglePreviousAudioTrack");y(this,"actionToggleCti")}getKeyboardShortcutsHelpMenuGroup(){let e=(...i)=>i.join(" + "),n="shift".toUpperCase();return{name:"Timeline function shortcuts",items:[{description:"Timeline Zoom In",name:e("=")},{description:"Timeline Zoom Out",name:e("-")},{description:"Timeline Zoom level 100%",name:e("0")},{description:"Toggle Next Audio Track",name:e(n,"e")},{description:"Toggle Previous Audio Track",name:e("e")},{description:"Toggle CTI into / out-of Interactive Mode",name:e("'")}]}}handleKeyboardEvent(e){const n=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(n.tagName.toUpperCase())?!1:e.code==="Equal"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomIn&&this.actionZoomIn(),!0):e.code==="Minus"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionZoomOut&&this.actionZoomOut(),!0):e.code==="Digit0"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionResetZoom&&this.actionResetZoom(),!0):e.code==="KeyE"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionToggleNextAudioTrack&&this.actionToggleNextAudioTrack():this.actionTogglePreviousAudioTrack&&this.actionTogglePreviousAudioTrack(),!0):e.code==="Quote"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionToggleCti&&this.actionToggleCti(),!0):!1}}const Li=v.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(v.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{vi([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(Ei(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new Mi;i.actionToggleCti=()=>{var u;return(u=t.timeline)==null?void 0:u.toggleTimecodeEdit()},i.actionResetZoom=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomToEased(100)},i.actionZoomIn=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomInEased()},i.actionZoomOut=()=>{var u;return(u=t.timeline)==null?void 0:u.zoomOutEased()};const o=u=>{const c=t.audio.getAudioTracks(),a=t.audio.getActiveAudioTrack(),f=c.findIndex(d=>d.id===(a==null?void 0:a.id))+(u?-1:1);f>=0&&f<c.length&&t.audio.setActiveAudioTrack(c.at(f).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=u=>{i.handleKeyboardEvent(u)&&(u.preventDefault(),u.stopPropagation())};return window.addEventListener("keydown",s),t.chroming.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),v.createElement("div",{id:n.timelineHTMLElementId})));class cn{static get window(){return window}static get navigator(){return window.navigator}static get userAgent(){var n;const e=((n=this.navigator)==null?void 0:n.userAgent)||"";return/Android/i.test(e)?"android":/Firefox/i.test(e)?"firefox":/Edg/i.test(e)?"edge":(/Chrome/i.test(e)||/CriOS/i.test(e))&&!/Edg/i.test(e)?"chrome":/Chrome/i.test(e)||/CriOS/i.test(e)?"chromium":/Safari/i.test(e)?"safari":"unknown"}static get platform(){var n,r,i;const e=((r=(n=this.navigator)==null?void 0:n.userAgentData)==null?void 0:r.platform)||((i=this.navigator)==null?void 0:i.platform);return e!=null&&e.toUpperCase().includes("MAC")?"macos":e!=null&&e.toUpperCase().includes("WIN")?"windows":e!=null&&e.toUpperCase().includes("LINUX")?"linux":"unknown"}static isUserAgent(e){return this.userAgent===e}static isPlatform(e){return this.platform===e}static open(e,n="_blank"){this.window.open(e,n)}}const Ie=[.25,.5,.75,1,2,4,8];class ln{static getKeyboardShortcutsHelpMenuGroup(){let e=(...o)=>o.join(" + "),n="shift".toUpperCase(),r="ctrl".toUpperCase();return{name:"Playback function shortcuts",items:[{description:"Play / Pause",name:e("Space")},{description:"Toggle Sound",name:e("s")},{description:"Toggle Text On / Off",name:e("d")},{description:"Toggle Full Screen",name:e("f")},{description:"Increase Volume",name:e(n,"\\")},{description:"Reduce Volume",name:e("\\")},{description:"One Frame Forward",name:e("Right Arrow")},{description:"One Frame Backward",name:e("Left Arrow")},{description:"10 Frames Forward",name:e(n,"Right Arrow")},{description:"10 Frames Backwards",name:e(n,"Left Arrow")},{description:"Stop shuttle and pause",name:e("k")},{description:"Decrease Shuttle Forwards",name:e("l")},{description:"Increase Shuttle Forwards",name:e(n,"l")},{description:"Set playhead to Start of Media and Stop",name:e("1 / Home")},{description:"Set playhead to End of Media and Stop",name:e(r,"1")+" / End"}]}}static handleKeyboardEvent(e,n){const r=e.target,i=["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"],o=cn.userAgent;if(i.includes(r.tagName.toUpperCase()))return!1;if(n&&n.video){if(e.code==="Space"&&(o!=="safari"||!n.video.isFullscreen()))return n.video.togglePlayPause(),!0;if(e.code==="KeyS"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey)return n.video.toggleMuteUnmute(),!0;if(e.code==="Backslash"){let s=10,u=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*u;c>=100?c=100:c<=0&&(c=0),n.video.setVolume(c/100)}if(e.code==="KeyD"&&!(e.ctrlKey&&e.shiftKey&&e.metaKey))return n.subtitles.toggleShowHideActiveTrack(),!0;if(e.code==="KeyK"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey&&(n.video.setPlaybackRate(1),n.video.pause()),e.code==="KeyL"&&!e.ctrlKey&&!e.metaKey){let s=e.shiftKey?1:-1;const u=Ie.indexOf(n.video.getPlaybackRate())+s;let c;return u<0?c=Ie.at(0):u>=Ie.length?c=Ie.at(-1):c=Ie.at(u),n.video.setPlaybackRate(c),n.video.isPaused()&&n.video.play(),!0}if(n.video.isVideoLoaded()){if(["ArrowLeft","ArrowRight"].includes(e.key)&&!e.metaKey&&!e.altKey){let s=e.key==="ArrowRight"?1:-1,u=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(u*s),!0}if(e.code==="Digit1"&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey||e.code==="Home")return n.video.pause().subscribe(()=>n.video.seekToFrame(0)),!0;if(e.code==="Digit1"&&e.ctrlKey||e.code==="End")return n.video.isPlaying()?n.video.pause().subscribe(()=>n.video.seekToEnd()):n.video.seekToEnd(),!0}if(e.code==="KeyF"&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey)return n.video.toggleFullscreen(),!0}return!1}}const fn=v.memo(function({videoUrl:e,config:n,videoLoadOptions:r,onVideoLoadedCallback:i,enableHotkeys:o}){return n&&(n==null?void 0:n.playerHTMLElementId)===void 0&&(n.playerHTMLElementId="omakase-player"),v.useEffect(()=>{var c,a;let s=new O.OmakasePlayer(n);const u=l=>{ln.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(a=document.querySelector("media-controller"))==null||a.setAttribute("tabindex","-1"),window.addEventListener("keydown",u),s.chroming.appendHelpMenuGroup(ln.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",u)}},[e]),v.createElement("div",{id:n.playerHTMLElementId})}),Ai=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M10.5675 21C10.2375 21 9.9675 20.73 9.9675 20.4V16.7925L5.6325 12.3675L9.9675 8.235V3.6C9.9675 3.27 10.2375 3 10.5675 3C10.8975 3 11.1675 3.27 11.1675 3.6V8.7525L7.3425 12.3975L11.1675 16.305V20.4C11.1675 20.73 10.8975 21 10.5675 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.7675 17.145C17.61 17.145 17.46 17.085 17.34 16.965L12.8325 12.3675L17.355 8.0625C17.595 7.8375 17.9775 7.845 18.2025 8.085C18.4275 8.325 18.42 8.7075 18.18 8.9325L14.5425 12.3975L18.195 16.125C18.4275 16.365 18.42 16.74 18.1875 16.9725C18.075 17.085 17.9175 17.145 17.7675 17.145Z",fill:"#CACFEA"})),Ii=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M13.4325 21C13.7625 21 14.0325 20.73 14.0325 20.4V16.7925L18.3675 12.3675L14.0325 8.235V3.6C14.0325 3.27 13.7625 3 13.4325 3C13.1025 3 12.8325 3.27 12.8325 3.6V8.7525L16.6575 12.3975L12.8325 16.305V20.4C12.8325 20.73 13.1025 21 13.4325 21Z",fill:"#CACFEA"}),v.createElement("path",{d:"M6.2325 17.145C6.39 17.145 6.54 17.085 6.66 16.965L11.1675 12.3675L6.645 8.0625C6.405 7.8375 6.0225 7.845 5.7975 8.085C5.5725 8.325 5.58 8.7075 5.82 8.9325L9.4575 12.3975L5.805 16.125C5.5725 16.365 5.58 16.74 5.8125 16.9725C5.925 17.085 6.0825 17.145 6.2325 17.145Z",fill:"#CACFEA"})),Oi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M14.1675 21C13.8375 21 13.5675 20.73 13.5675 20.4V16.7925L9.2325 12.3675L13.5675 8.235V3.6C13.5675 3.27 13.8375 3 14.1675 3C14.4975 3 14.7675 3.27 14.7675 3.6V8.7525L10.9425 12.3975L14.7675 16.305V20.4C14.7675 20.73 14.4975 21 14.1675 21Z",fill:"#CACFEA"})),_i=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M9.8325 21C10.1625 21 10.4325 20.73 10.4325 20.4V16.7925L14.7675 12.3675L10.4325 8.235V3.6C10.4325 3.27 10.1625 3 9.8325 3C9.5025 3 9.2325 3.27 9.2325 3.6V8.7525L13.0575 12.3975L9.2325 16.305V20.4C9.2325 20.73 9.5025 21 9.8325 21Z",fill:"#CACFEA"})),xi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),v.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Ni=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),ki=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M6.39001 3V21L12 17.0175L17.61 21V3H6.38251H6.39001ZM16.44 3.84L7.23001 18.7125V3.84H16.44ZM12 15.9975L8.25751 18.6525L16.77 4.89V19.3725L12 15.9825V15.9975Z",fill:"#CACFEA"})),Di=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.3075 8.0175L14.4525 5.8725C14.6175 5.7075 14.6175 5.43 14.4525 5.265L12.3 3.12C12.135 2.955 11.8575 2.955 11.6925 3.12C11.5275 3.285 11.5275 3.5625 11.6925 3.7275L13.1025 5.1375H6.64499C5.22749 5.1375 4.07249 6.2925 4.07249 7.71V16.2825C4.07249 17.7 5.22749 18.855 6.64499 18.855C6.87749 18.855 7.07249 18.66 7.07249 18.4275C7.07249 18.195 6.87749 18 6.64499 18C5.69249 18 4.93499 17.2275 4.93499 16.29V7.7175C4.93499 6.765 5.70749 6.0075 6.64499 6.0075H13.11L11.7 7.4175C11.535 7.5825 11.535 7.86 11.7 8.025C11.865 8.19 12.1425 8.19 12.3075 8.025V8.0175Z",fill:"#CACFEA"}),v.createElement("path",{d:"M17.355 18.8625C18.7725 18.8625 19.9275 17.7075 19.9275 16.29V7.7175C19.9275 6.3 18.7725 5.145 17.355 5.145C17.1225 5.145 16.9275 5.34 16.9275 5.5725C16.9275 5.805 17.1225 6 17.355 6C18.3075 6 19.065 6.7725 19.065 7.71V16.2825C19.065 17.235 18.2925 17.9925 17.355 17.9925H10.89L12.3075 16.5825C12.3825 16.5075 12.435 16.395 12.435 16.2825C12.435 16.17 12.3975 16.0575 12.3075 15.9825C12.15 15.8175 11.8575 15.825 11.7 15.9825L9.52501 18.1575V18.18C9.45751 18.255 9.42751 18.345 9.42751 18.435C9.42751 18.555 9.46501 18.66 9.55501 18.735L11.7 20.88C11.8575 21.045 12.15 21.045 12.3075 20.88C12.4725 20.715 12.4725 20.4375 12.3075 20.2725L10.89 18.8625H17.355Z",fill:"#CACFEA"})),Fi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_237)"},v.createElement("path",{d:"M13.02 19.95C17.42 19.95 21 16.37 21 11.97C21 7.57 17.42 4 13.02 4C8.88 4 5.39 7.24 5.08 11.37L5.02 12.14L3.56 10.68C3.49 10.61 3.41 10.58 3.33 10.58C3.25 10.58 3.17 10.61 3.1 10.68C3.03 10.75 3 10.83 3 10.92C3 11 3.03 11.08 3.1 11.15L5.22 13.27C5.35 13.4 5.55 13.43 5.65 13.3L7.8 11.15C7.87 11.08 7.9 11 7.9 10.92C7.9 10.84 7.86 10.76 7.8 10.69C7.73 10.62 7.65 10.59 7.57 10.59C7.49 10.59 7.41 10.62 7.34 10.69L5.9 12.13L6.03 11.11C6.45 7.57 9.46 4.91 13.02 4.91C16.91 4.91 20.08 8.08 20.08 11.97C20.08 15.86 16.91 19.03 13.02 19.03C12.77 19.03 12.56 19.24 12.56 19.49C12.56 19.74 12.77 19.95 13.02 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M14.95 13.19C14.95 13.72 14.75 14.14 14.36 14.45C13.97 14.76 13.43 14.91 12.75 14.91C12.16 14.91 11.69 14.81 11.32 14.62V13.53C11.7 13.81 12.14 13.95 12.65 13.95C12.98 13.95 13.23 13.88 13.41 13.74C13.59 13.6 13.67 13.41 13.67 13.17C13.67 12.93 13.56 12.72 13.34 12.58C13.12 12.44 12.82 12.37 12.43 12.37H11.92V11.41H12.39C13.13 11.41 13.5 11.16 13.5 10.67C13.5 10.21 13.22 9.98 12.65 9.98C12.26 9.98 11.89 10.1 11.54 10.35V9.33C11.93 9.13 12.4 9.03 12.94 9.03C13.48 9.03 13.94 9.16 14.28 9.41C14.62 9.66 14.79 10.01 14.79 10.44C14.79 11.19 14.41 11.65 13.66 11.84V11.86C14.06 11.91 14.37 12.05 14.61 12.29C14.85 12.53 14.96 12.83 14.96 13.19H14.95Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_237"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Vi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("g",{clipPath:"url(#clip0_3377_260)"},v.createElement("path",{d:"M10.98 19.95C6.58 19.95 3 16.37 3 11.98C3 7.58 6.58 4 10.98 4C15.12 4 18.61 7.24 18.93 11.37L18.99 12.14L20.45 10.68C20.52 10.61 20.6 10.58 20.68 10.58C20.76 10.58 20.84 10.61 20.91 10.68C20.98 10.75 21.01 10.83 21.01 10.91C21.01 10.99 20.98 11.07 20.91 11.14L18.79 13.26C18.66 13.39 18.46 13.42 18.36 13.29L16.21 11.14C16.14 11.07 16.11 10.99 16.11 10.91C16.11 10.83 16.15 10.75 16.21 10.68C16.28 10.61 16.36 10.58 16.44 10.58C16.52 10.58 16.6 10.61 16.67 10.68L18.11 12.12L17.98 11.1C17.55 7.57 14.54 4.91 10.98 4.91C7.09 4.91 3.92 8.08 3.92 11.97C3.92 15.86 7.09 19.03 10.98 19.03C11.23 19.03 11.44 19.24 11.44 19.49C11.44 19.74 11.23 19.95 10.98 19.95Z",fill:"#CACFEA"}),v.createElement("path",{d:"M12.91 13.19C12.91 13.72 12.71 14.14 12.32 14.45C11.93 14.76 11.39 14.91 10.71 14.91C10.12 14.91 9.65 14.81 9.28 14.62V13.53C9.66 13.81 10.1 13.95 10.61 13.95C10.94 13.95 11.19 13.88 11.37 13.74C11.55 13.6 11.63 13.41 11.63 13.17C11.63 12.93 11.52 12.72 11.3 12.58C11.08 12.44 10.78 12.37 10.39 12.37H9.88V11.41H10.35C11.09 11.41 11.46 11.16 11.46 10.67C11.46 10.21 11.18 9.98 10.61 9.98C10.22 9.98 9.85 10.1 9.5 10.35V9.33C9.89 9.13 10.36 9.03 10.9 9.03C11.44 9.03 11.9 9.16 12.24 9.41C12.58 9.66 12.75 10.01 12.75 10.44C12.75 11.19 12.37 11.65 11.62 11.84V11.86C12.02 11.91 12.33 12.05 12.57 12.29C12.81 12.53 12.92 12.83 12.92 13.19H12.91Z",fill:"#CACFEA"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip0_3377_260"},v.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),J=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>v.createElement("button",{disabled:o,onClick:e},v.createElement(t,{width:n,height:r})," ",i),Bi=({width:t,height:e})=>v.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),v.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Pi=({width:t,height:e})=>v.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),v.createElement("path",{d:"M7.16667 6.33333V6.83333H7.66667H10.3333C10.4257 6.83333 10.5 6.90769 10.5 7C10.5 7.09231 10.4257 7.16667 10.3333 7.16667H7.66667H7.16667V7.66667V10.3333C7.16667 10.4257 7.09231 10.5 7 10.5C6.90769 10.5 6.83333 10.4257 6.83333 10.3333V7.66667V7.16667H6.33333H3.66667C3.57468 7.16667 3.5 7.09199 3.5 7C3.5 6.90801 3.57468 6.83333 3.66667 6.83333H6.33333H6.83333V6.33333V3.66667C6.83333 3.57468 6.90801 3.5 7 3.5C7.09199 3.5 7.16667 3.57468 7.16667 3.66667V6.33333Z",fill:"#CACFEA",stroke:"#CACFEA"}));function te(t){t.next(),t.complete()}class Ri{constructor(){y(this,"actionMarkerInOut");y(this,"actionMarkerSplit");y(this,"actionMarkerDelete");y(this,"actionPreviousMarkerToggle");y(this,"actionNextMarkerToggle");y(this,"actionSetMarkerStartToPlayhead");y(this,"actionSetMarkerEndToPlayhead");y(this,"actionSetPlayheadToMarkerStart");y(this,"actionSetPlayheadToMarkerEnd");y(this,"actionRewind3SecondsAndPlayToCurrent");y(this,"actionPlay3SecondsAndRewindToCurrent");y(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=cn.platform;let i=r==="windows"?"win":r==="linux"?"super":"cmd";return{name:"Segmentation function shortcuts",items:[{description:"Mark In / Out",name:e("m")},{description:"Split Active Marker",name:e(".")},{description:"Delete Active Marker",name:e("n")},{description:"Toggle Previous Marker",name:e("/")},{description:"Toggle Next Marker",name:e(n,"/")},{description:"Set Start of Active Marker to Playhead Position",name:e("i")},{description:"Set End of Active Marker to Playhead Position",name:e("o")},{description:"Set Playhead to Start of Active Marker",name:e("[")},{description:"Set Playhead to End of Active Marker",name:e("]")},{description:"Rewind 3 Seconds and Play to Current Playhead",name:e(i,"Arrow Left")},{description:"Play 3 Seconds and Rewind to Current Playhead",name:e(i,"Arrow Right")},{description:"Loop on Active Marker",name:e("p")}]}}handleKeyboardEvent(e,n){const r=e.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(r.tagName.toUpperCase())?!1:e.code==="KeyM"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerInOut&&this.actionMarkerInOut(),!0):e.code==="Period"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerSplit&&this.actionMarkerSplit(),!0):e.code==="KeyN"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionMarkerDelete&&this.actionMarkerDelete(),!0):e.code==="Slash"&&!e.ctrlKey&&!e.metaKey?(e.shiftKey?this.actionNextMarkerToggle&&this.actionNextMarkerToggle():this.actionPreviousMarkerToggle&&this.actionPreviousMarkerToggle(),!0):e.code==="KeyI"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerStartToPlayhead&&this.actionSetMarkerStartToPlayhead(),!0):e.code==="KeyO"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetMarkerEndToPlayhead&&this.actionSetMarkerEndToPlayhead(),!0):e.code==="BracketLeft"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerStart&&this.actionSetPlayheadToMarkerStart(),!0):e.code==="BracketRight"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionSetPlayheadToMarkerEnd&&this.actionSetPlayheadToMarkerEnd(),!0):e.code==="ArrowLeft"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionRewind3SecondsAndPlayToCurrent&&this.actionRewind3SecondsAndPlayToCurrent(),!0):e.code==="ArrowRight"&&!e.shiftKey&&!e.ctrlKey&&e.metaKey?(this.actionPlay3SecondsAndRewindToCurrent&&this.actionPlay3SecondsAndRewindToCurrent(),!0):e.code==="KeyP"&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey?(this.actionLoopActiveMarker&&this.actionLoopActiveMarker(),!0):!1}}const $e=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof O.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,u=i.timeObservation.end,c=o.start,a=n??o.end;if(c!=null&&a!=null)return r||c<=u&&a>=s}return r},!1);function Ze(t,e,n){if(!t||!(t instanceof O.PeriodMarker))return!0;const r=t.timeObservation.start,i=t.timeObservation.end;if(r==null||i==null)return!0;const o=n.video.calculateTimeToFrame(i),s=n.video.calculateTimeToFrame(r),u=n.video.getCurrentFrame();return e<r||o-u<2||u-s<1}function qe(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Ui=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:u,setSource:c,source:a,constants:l})=>{const f=v.useRef(void 0),d=v.useRef(void 0),m=new pe,h=v.useRef(!1),p=(b,S,I)=>{const B=S??e.video.getCurrentTime();return b.getMarkers().reduce((N,W)=>W instanceof O.PeriodMarker&&W.timeObservation.start!==void 0&&W.timeObservation.end!==void 0&&W.id!==(I==null?void 0:I.id)?N||B>=W.timeObservation.start&&B<=W.timeObservation.end:N,!1)},w=b=>{if(_===void 0)return!0;const S=_.timeObservation.start,I=b??e.video.getCurrentTime();return!!(S==null||S>=I||$e(a,_,I))},E=b=>_!==void 0||a===void 0?!0:p(a,b,_),[x,A]=v.useState(void 0),[D,V]=v.useState(Ze(t,e.video.getCurrentTime(),e)),[_,Y]=v.useState(void 0),[oe,z]=v.useState(w()),[Te,$]=v.useState(E()),ue=b=>{if(b===void 0||a===void 0||!(b instanceof O.PeriodMarker))return!0;const S=$e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof O.PeriodMarker){const I=b.timeObservation.end;if(I!=null&&e.video.getCurrentTime()>=I)return!0}return!1},ce=b=>{if(b===void 0||a===void 0||!(b instanceof O.PeriodMarker))return!0;const S=$e(a,b,e.video.getCurrentTime());if(S)return S;if(b instanceof O.PeriodMarker){if(b.timeObservation.end==null)return!0;const I=b.timeObservation.start;if(I!=null&&e.video.getCurrentTime()<=I)return!0}return!1},[ye,U]=v.useState(ue(t)),[k,gt]=v.useState(ce(t));v.useEffect(()=>{if(z(()=>w()),$(()=>E()),_&&_!==t){const b=i.find(S=>S.getMarker(_.id));b==null||b.removeMarker(_.id),Y(void 0)}},[t,_,i,Y]),v.useEffect(()=>()=>te(m),[]),v.useEffect(()=>{if(U(ue(t)),gt(ce(t)),t){const b=Ze(t,e.video.getCurrentTime(),e);V(b);const S=e.video.onVideoTimeChange$.pipe(X(m)).subscribe({next:I=>{V(B=>Ze(t,I.currentTime,e)),U(()=>ue(t)),gt(()=>ce(t))}});return()=>S.unsubscribe()}},[t]),v.useEffect(()=>{e.video.onSeeking$.pipe(X(m)).subscribe({next:S=>{z(()=>w(S.toTime)),$(()=>E(S.toTime))}});const b=e.video.onVideoTimeChange$.pipe(X(m)).subscribe({next:S=>{z(()=>w()),$(()=>E())}});return()=>b.unsubscribe()},[_,a]),v.useEffect(()=>{const b=i.map(S=>S.onMarkerUpdate$.pipe(X(m)).subscribe({next:I=>{(t==null?void 0:t.id)===I.marker.id&&(V(B=>Ze(t,e.video.getCurrentTime(),e)),U(()=>ue(t)),gt(()=>ce(t)))}}));return()=>b.forEach(S=>S.unsubscribe())},[i,t]),v.useEffect(()=>{x&&(x.marker.style={...x.marker.style,color:x.color},x.marker.timeObservation={...x.marker.timeObservation},A(void 0))},[t]),v.useEffect(()=>{if(a){z(()=>w()),$(()=>E());const b=a.onMarkerDelete$.pipe(X(m)).subscribe({next:I=>{const B=I.marker;A(N=>{if((N==null?void 0:N.marker.id)!==B.id)return N}),s(N=>{if((N==null?void 0:N.id)!==B.id)return N}),Y(N=>{if((N==null?void 0:N.id)!==B.id)return N}),z(()=>w()),$(()=>E())}}),S=a.onMarkerUpdate$.pipe(X(m)).subscribe({next:()=>{z(()=>w()),$(()=>E())}});return()=>{b.unsubscribe(),S.unsubscribe()}}},[a]);const Cn=(b,S)=>{if(S===void 0)return;const I=S.timeObservation;b.video.seekToTime(I.start)},Mn=(b,S)=>{if(S===void 0)return;const I=S.timeObservation;b.video.seekToTime(I.end)},Ln=(b,S)=>{S instanceof O.PeriodMarker&&S.timeObservation.start!==void 0&&(S.timeObservation={...S.timeObservation,start:b.video.getCurrentTime()})},An=(b,S)=>{S instanceof O.PeriodMarker&&S.timeObservation.end!==void 0&&(S.timeObservation={...S.timeObservation,end:b.video.getCurrentTime()})},In=(b,S)=>{f.current&&te(f.current),f.current=new pe,b.video.pause();const I=b.video.getCurrentFrame(),B=b.video.getFrameRate(),N=I-S*B,W=N>=0?N:0;b.video.seekToFrame(W).pipe(Se()).subscribe(()=>{}),b.video.play(),b.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(je=>{je.frame>=I-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})}),te(f.current))})},On=(b,S)=>{f.current&&te(f.current),f.current=new pe,d.current&&te(d.current),d.current=new pe;const I=b.video.getCurrentFrame(),B=b.video.getFrameRate(),N=I+S*B;b.video.play(),b.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(W=>{W.frame>=N-1&&(b.video.pause().subscribe(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})}),te(f.current))}),b.video.onEnded$.pipe(X(d.current),X(m)).subscribe(W=>{setTimeout(()=>{b.video.seekToFrame(I).pipe(Se()).subscribe(()=>{})},1),te(d.current)})},vt=b=>{a.removeMarker(b.id),(_==null?void 0:_.id)===b.id&&Y(void 0)},_n=(b,S)=>{if(!(S instanceof O.PeriodMarker))return;const I=S.timeObservation.start,B=S.timeObservation.end,N=b.video.getCurrentTime();if(I==null||B==null)return;const W=I,je=N,ao=je+1/b.video.getFrameRate(),uo=B;vt(S);const bt=new O.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:W,end:je},editable:!0});bt.onClick$.subscribe({next:()=>u(bt)});const Oe=new O.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:ao,end:uo},editable:!0});Oe.onClick$.subscribe({next:()=>u(Oe)}),a.addMarker(bt),a.addMarker(Oe),u(Oe),setTimeout(()=>{A({marker:Oe,color:l.PERIOD_MARKER_STYLE.color})},0)},xn=()=>{const b=e.video.getCurrentTime(),S=new O.PeriodMarker({timeObservation:{start:b},style:l.PERIOD_MARKER_STYLE,editable:!0});S.onClick$.subscribe({next:()=>u(S)}),a.addMarker(S),Y(S),z(w()),u(S)},Nn=()=>{const b=e.video.getCurrentTime();_.timeObservation={..._.timeObservation,end:b},Y(void 0)},kn=b=>{f.current&&te(f.current),f.current=new pe,d.current&&te(d.current),d.current=new pe;const S=e.video.calculateTimeToFrame(b.timeObservation.start),I=e.video.calculateTimeToFrame(b.timeObservation.end);e.video.pause(),e.video.seekToFrame(S),e.video.play(),e.video.onVideoTimeChange$.pipe(X(f.current),X(m)).subscribe(B=>{B.frame>=I-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(S).pipe(Se()).subscribe(()=>{})}),te(f.current))}),e.video.onEnded$.pipe(X(d.current),X(m)).subscribe(B=>{setTimeout(()=>{e.video.seekToFrame(S).pipe(Se()).subscribe(()=>{})},1),te(d.current)})},so=()=>{const b=i.length,S=`Segmentation ${i.length+1}`,I=new O.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:S});I.onMarkerUpdate$.subscribe({next:B=>{$e(I,B.marker)&&(B.marker.timeObservation=B.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(I,b+1),o([...i,I]),u(void 0),c(I)},Dn=b=>{if(!a)return;const S=a.getMarkers().filter(N=>N instanceof O.PeriodMarker).sort((N,W)=>N.timeObservation.start??0-(W.timeObservation.start??0));if(t===void 0){u(S.at(0));return}const B=S.findIndex(N=>N.id===t.id)+(b?-1:1);B>=0&&B<S.length&&u(S.at(B))};return v.useEffect(()=>{if(!r)return;const b=new Ri;b.actionLoopActiveMarker=()=>t instanceof O.PeriodMarker&&qe(t)&&kn(t),b.actionSetPlayheadToMarkerStart=()=>t&&Cn(e,t),b.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof O.PeriodMarker&&qe(t)&&Mn(e,t),b.actionSetMarkerStartToPlayhead=()=>!ye&&Ln(e,t),b.actionSetMarkerEndToPlayhead=()=>!k&&An(e,t),b.actionMarkerSplit=()=>!D&&_n(e,t),b.actionMarkerDelete=()=>t&&vt(t),b.actionMarkerInOut=()=>{_===void 0?!Te&&xn():!oe&&Nn()},b.actionPlay3SecondsAndRewindToCurrent=()=>On(e,3),b.actionRewind3SecondsAndPlayToCurrent=()=>In(e,3),b.actionNextMarkerToggle=()=>Dn(!1),b.actionPreviousMarkerToggle=()=>Dn(!0);const S=I=>{b.handleKeyboardEvent(I,e)&&(I.stopPropagation(),I.preventDefault())};return window.addEventListener("keydown",S),h.current||(e.chroming.appendHelpMenuGroup(b.getKeyboardShortcutsHelpMenuGroup()),h.current=!0),()=>window.removeEventListener("keydown",S)}),v.createElement("div",{className:"control-panel-wrapper"},v.createElement("div",{className:"control-panel"},v.createElement(J,{Icon:Ai,onClick:()=>Cn(e,t),disabled:t===void 0}),v.createElement(J,{Icon:Ii,onClick:()=>Mn(e,t),disabled:t===void 0||t instanceof O.PeriodMarker&&!qe(t)}),v.createElement(J,{Icon:Oi,onClick:()=>Ln(e,t),disabled:ye}),v.createElement(J,{Icon:_i,onClick:()=>An(e,t),disabled:k}),_===void 0?v.createElement(J,{Icon:xi,onClick:xn,disabled:Te}):v.createElement(J,{Icon:Bi,onClick:Nn,disabled:oe}),v.createElement(J,{Icon:ki,onClick:()=>vt(t),disabled:t===void 0}),v.createElement(J,{Icon:Ni,onClick:()=>_n(e,t),disabled:D||t===void 0}),v.createElement(J,{Icon:Di,onClick:()=>kn(t),disabled:!(t instanceof O.PeriodMarker&&qe(t))}),v.createElement(J,{Icon:Fi,onClick:()=>In(e,3)}),v.createElement(J,{Icon:Vi,onClick:()=>On(e,3)})),v.createElement("div",{className:"control-panel"},v.createElement("div",{className:"segmentation-button-wrapper"},v.createElement(J,{Icon:Pi,text:"NEW SEGMENTATION",onClick:()=>so(),disabled:i.length>=3}))))};class ve{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ve.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ve.isNullUndefinedOrWhitespace(e)&&!ve.isNullUndefinedOrWhitespace(n)?e.indexOf(n,e.length-n.length)!==-1:!1}static toMixedCase(e){let n={NBCU:"NBCU",REDBEE:"Red Bee",CMORE:"C More",TV2:"TV2",BBC:"BBC"};return e.replace(/_/g," ").split(" ").map(r=>r in n?n[r]:`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()}`).join(" ")}static replaceWhitespace(e,n){return e&&e.trim().replace(/([\n ]*,[\n ]*|[\n ]+)/g,n).replace(new RegExp(`${n}$`),"")}static whitespacesToCommas(e){return ve.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ve.replaceWhitespace(e," ").split(" "):void 0}}class Ki{constructor(e=3,n=!1){this.targetDuration=null,this.mediaSequence=null,this.programDateTime=null,this.playlistType=null,this.streams=[],this.media=[],this.segments=[],this.endList=!1,this.version=e,this.independentSegments=n}}class lt{constructor(e,n,r,i,o){this.bandwidth=e,this.averageBandwidth=n,this.resolution=r,this.frameRate=i,this.uri=o}}class Hi{constructor(e,n,r,i,o,s,u){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=u}}class $i{constructor(e,n){this.duration=e,this.uri=n}}class dn{constructor(){this.playlist=new Ki}setVersion(e){return this.playlist.version=e,this}setIndependentSegments(e){return this.playlist.independentSegments=e,this}setTargetDuration(e){return this.playlist.targetDuration=e,this}setMediaSequence(e){return this.playlist.mediaSequence=e,this}setProgramDateTime(e){return this.playlist.programDateTime=e,this}setPlaylistType(e){return this.playlist.playlistType=e,this}addStreamInfo(e){return this.playlist.streams.push(e),this}addMedia(e){return this.playlist.media.push(e),this}addSegment(e,n=!1){const r={...e,gap:n};return this.playlist.segments.push(r),this}setEndList(){return this.playlist.endList=!0,this}setStartOffset(e){return this.playlist.startOffset=e,this}build(){return this.playlist}}class mn{static write(e){let n=`#EXTM3U
10
10
  `;return n+=`#EXT-X-VERSION:${e.version}
11
11
  `,e.independentSegments&&(n+=`#EXT-X-INDEPENDENT-SEGMENTS
12
12
  `),e.targetDuration!==null&&(n+=`#EXT-X-TARGETDURATION:${e.targetDuration}