@byomakase/omakase-react-components 1.0.1 → 1.0.2

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
@@ -1,12 +1,12 @@
1
- (function(S,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("@byomakase/omakase-player"),require("react")):typeof define=="function"&&define.amd?define(["exports","@byomakase/omakase-player","react"],I):(S=typeof globalThis<"u"?globalThis:S||self,I(S["@byomakase/omakase-react-components"]={},S.OmakasePlayer,S.React))})(this,function(S,I,p){"use strict";var Ki=Object.defineProperty;var Ui=(S,I,p)=>I in S?Ki(S,I,{enumerable:!0,configurable:!0,writable:!0,value:p}):S[I]=p;var E=(S,I,p)=>Ui(S,typeof I!="symbol"?I+"":I,p);class vn{constructor(e){E(this,"_lanes",[]);E(this,"_markersLaneMap",new Map);E(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)}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 I.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 I.ThumbnailLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var Ye=function(t,e){return Ye=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])},Ye(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");Ye(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function wn(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 a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((r=r.apply(t,e||[])).next())})}function mt(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=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[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 _e(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(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function xe(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 be(t){return this instanceof be?(this.v=t,this):new be(t)}function bn(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),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(v){return Promise.resolve(v).then(h,d)}}function a(h,v){r[h]&&(i[h]=function(w){return new Promise(function(C,A){o.push([h,w,C,A])>1||c(h,w)})},v&&(i[h]=v(i[h])))}function c(h,v){try{u(r[h](v))}catch(w){f(o[0][3],w)}}function u(h){h.value instanceof be?Promise.resolve(h.value.v).then(l,d):f(o[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,v){h(v),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Sn(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(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function K(t){return typeof t=="function"}function Qe(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 Je=Qe(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(S,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("@byomakase/omakase-player"),require("react")):typeof define=="function"&&define.amd?define(["exports","@byomakase/omakase-player","react"],I):(S=typeof globalThis<"u"?globalThis:S||self,I(S["@byomakase/omakase-react-components"]={},S.OmakasePlayer,S.React))})(this,function(S,I,p){"use strict";var Ki=Object.defineProperty;var Ui=(S,I,p)=>I in S?Ki(S,I,{enumerable:!0,configurable:!0,writable:!0,value:p}):S[I]=p;var E=(S,I,p)=>Ui(S,typeof I!="symbol"?I+"":I,p);class vn{constructor(e){E(this,"_lanes",[]);E(this,"_markersLaneMap",new Map);E(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)}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 I.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 I.ThumbnailLane(n.config),e.addTimelineLane(r));const i=this._laneNodenMap.get(r.id);i==null||i.forEach(o=>{r.addTimelineNode(o.config)})}}var Ye=function(t,e){return Ye=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])},Ye(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");Ye(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function wn(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 a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):i(l.value).then(a,c)}u((r=r.apply(t,e||[])).next())})}function mt(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=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(l){u=[6,l],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[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 _e(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(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function xe(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 be(t){return this instanceof be?(this.v=t,this):new be(t)}function bn(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),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(h){return function(w){return Promise.resolve(w).then(h,d)}}function a(h,w){r[h]&&(i[h]=function(v){return new Promise(function(M,A){o.push([h,v,M,A])>1||c(h,v)})},w&&(i[h]=w(i[h])))}function c(h,w){try{u(r[h](w))}catch(v){f(o[0][3],v)}}function u(h){h.value instanceof be?Promise.resolve(h.value.v).then(l,d):f(o[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,w){h(w),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Sn(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(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;function K(t){return typeof t=="function"}function Qe(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 Je=Qe(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function et(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Ne=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 a=we(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(w){e={error:w}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(K(l))try{l()}catch(w){o=w instanceof Je?w.errors:[w]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=we(d),h=f.next();!h.done;h=f.next()){var v=h.value;try{vt(v)}catch(w){o=o??[],w instanceof Je?o=xe(xe([],_e(o)),_e(w.errors)):o.push(w)}}}catch(w){r={error:w}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(o)throw new Je(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)vt(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)&&et(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&et(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),pt=Ne.EMPTY;function gt(t){return t instanceof Ne||t&&"closed"in t&&K(t.remove)&&K(t.add)&&K(t.unsubscribe)}function vt(t){K(t)?t():t.unsubscribe()}var En={Promise:void 0},Tn={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,xe([t,e],_e(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function wt(t){Tn.setTimeout(function(){throw t})}function tt(){}function ke(t){t()}var nt=function(t){Le(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,gt(n)&&n.add(r)):r.destination=Ln,r}return e.create=function(n,r,i){return new rt(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}(Ne),yn=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){De(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){De(r)}else De(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){De(n)}},t}(),rt=function(t){Le(e,t);function e(n,r,i){var o=t.call(this)||this,s;return K(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new yn(s),o}return e}(nt);function De(t){wt(t)}function Cn(t){throw t}var Ln={closed:!0,next:tt,error:Cn,complete:tt},it=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ve(t){return t}function Mn(t){return t.length===0?Ve:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var $=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=In(e)?e:new rt(e,n,r);return ke(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.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=bt(n),new n(function(i,o){var s=new rt({next:function(a){try{e(a)}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[it]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Mn(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=bt(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 bt(t){var e;return(e=t??En.Promise)!==null&&e!==void 0?e:Promise}function An(t){return t&&K(t.next)&&K(t.error)&&K(t.complete)}function In(t){return t&&t instanceof nt||An(t)&&gt(t)}function On(t){return K(t==null?void 0:t.lift)}function ae(t){return function(e){if(On(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 ue(t,e,n,r,i){return new _n(t,e,n,r,i)}var _n=function(t){Le(e,t);function e(n,r,i,o,s,a){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(u){try{o(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}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}(nt),xn=Qe(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 St(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new xn},e.prototype.next=function(n){var r=this;ke(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=we(r.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(n)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;ke(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;ke(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,a=i.observers;return o||s?pt:(this.currentObservers=null,a.push(n),new Ne(function(){r.currentObservers=null,et(a,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 $;return n.source=this,n},e.create=function(n,r){return new St(n,r)},e}($),St=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:pt},e}(pe),Nn=new $(function(t){return t.complete()});function kn(t){return t&&K(t.schedule)}function Et(t){return t[t.length-1]}function Dn(t){return K(Et(t))?t.pop():void 0}function Vn(t){return kn(Et(t))?t.pop():void 0}var Tt=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function yt(t){return K(t==null?void 0:t.then)}function Ct(t){return K(t[it])}function Lt(t){return Symbol.asyncIterator&&K(t==null?void 0:t[Symbol.asyncIterator])}function Mt(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 Fn(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var At=Fn();function It(t){return K(t==null?void 0:t[At])}function Ot(t){return bn(this,arguments,function(){var n,r,i,o;return mt(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,be(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,be(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,be(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 _t(t){return K(t==null?void 0:t.getReader)}function Fe(t){if(t instanceof $)return t;if(t!=null){if(Ct(t))return Bn(t);if(Tt(t))return Pn(t);if(yt(t))return Kn(t);if(Lt(t))return xt(t);if(It(t))return Un(t);if(_t(t))return Hn(t)}throw Mt(t)}function Bn(t){return new $(function(e){var n=t[it]();if(K(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Pn(t){return new $(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Kn(t){return new $(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,wt)})}function Un(t){return new $(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(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function xt(t){return new $(function(e){Rn(t,e).catch(function(n){return e.error(n)})})}function Hn(t){return xt(Ot(t))}function Rn(t,e){var n,r,i,o;return wn(this,void 0,void 0,function(){var s,a;return mt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Sn(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 a=c.sent(),i={error:a},[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 ce(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 Nt(t,e){return e===void 0&&(e=0),ae(function(n,r){n.subscribe(ue(r,function(i){return ce(r,t,function(){return r.next(i)},e)},function(){return ce(r,t,function(){return r.complete()},e)},function(i){return ce(r,t,function(){return r.error(i)},e)}))})}function kt(t,e){return e===void 0&&(e=0),ae(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Zn(t,e){return Fe(t).pipe(kt(e),Nt(e))}function qn(t,e){return Fe(t).pipe(kt(e),Nt(e))}function Wn(t,e){return new $(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Xn(t,e){return new $(function(n){var r;return ce(n,e,function(){r=t[At](),ce(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return K(r==null?void 0:r.return)&&r.return()}})}function Dt(t,e){if(!t)throw new Error("Iterable cannot be null");return new $(function(n){ce(n,e,function(){var r=t[Symbol.asyncIterator]();ce(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Gn(t,e){return Dt(Ot(t),e)}function jn(t,e){if(t!=null){if(Ct(t))return Zn(t,e);if(Tt(t))return Wn(t,e);if(yt(t))return qn(t,e);if(Lt(t))return Dt(t,e);if(It(t))return Xn(t,e);if(_t(t))return Gn(t,e)}throw Mt(t)}function Vt(t,e){return e?jn(t,e):Fe(t)}var Ft=Qe(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function $n(t,e){return ae(function(n,r){var i=0;n.subscribe(ue(r,function(o){r.next(t.call(e,o,i++))}))})}var zn=Array.isArray;function Yn(t,e){return zn(e)?t.apply(void 0,xe([],_e(e))):t(e)}function Qn(t){return $n(function(e){return Yn(t,e)})}var Jn=Array.isArray,er=Object.getPrototypeOf,tr=Object.prototype,nr=Object.keys;function rr(t){if(t.length===1){var e=t[0];if(Jn(e))return{args:e,keys:null};if(ir(e)){var n=nr(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function ir(t){return t&&typeof t=="object"&&er(t)===tr}function or(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function sr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Vn(t),r=Dn(t),i=rr(t),o=i.args,s=i.keys;if(o.length===0)return Vt([],n);var a=new $(ar(o,n,s?function(c){return or(s,c)}:Ve));return r?a.pipe(Qn(r)):a}function ar(t,e,n){return n===void 0&&(n=Ve),function(r){Bt(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,c=function(l){Bt(e,function(){var d=Vt(t[l],e),f=!1;d.subscribe(ue(r,function(h){o[l]=h,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},u=0;u<i;u++)c(u)},r)}}function Bt(t,e,n){t?ce(n,t,e):e()}function ur(t,e){return ae(function(n,r){var i=0;n.subscribe(ue(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function cr(t){return ae(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function lr(t){return t<=0?function(){return Nn}:ae(function(e,n){var r=0;e.subscribe(ue(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function dr(t){return t===void 0&&(t=fr),ae(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function fr(){return new Ft}function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(Ve,lr(1),n?cr(e):dr(function(){return new Ft}))}}function W(t){return ae(function(e,n){Fe(t).subscribe(ue(n,function(){return n.complete()},tt)),!n.closed&&e.subscribe(n)})}class hr{constructor(){E(this,"actionZoomIn");E(this,"actionZoomOut");E(this,"actionResetZoom");E(this,"actionToggleNextAudioTrack");E(this,"actionTogglePreviousAudioTrack");E(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 mr=p.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(p.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{sr([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(ur(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new hr;i.actionToggleCti=()=>{var a;return(a=t.timeline)==null?void 0:a.toggleTimecodeEdit()},i.actionResetZoom=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomToEased(100)},i.actionZoomIn=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomInEased()},i.actionZoomOut=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomOutEased()};const o=a=>{const c=t.audio.getAudioTracks(),u=t.audio.getActiveAudioTrack(),d=c.findIndex(f=>f.id===(u==null?void 0:u.id))+(a?-1:1);d>=0&&d<c.length&&t.audio.setActiveAudioTrack(c.at(d).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=a=>{i.handleKeyboardEvent(a)&&(a.preventDefault(),a.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),p.createElement("div",{id:n.timelineHTMLElementId})));class Pt{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 Me=[.25,.5,.75,1,2,4,8];class Kt{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=Pt.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,a=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*a;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 a=Me.indexOf(n.video.getPlaybackRate())+s;let c;return a<0?c=Me.at(0):a>=Me.length?c=Me.at(-1):c=Me.at(a),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,a=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(a*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 Ut=p.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"),p.useEffect(()=>{var c,u;let s=new I.OmakasePlayer(n);const a=l=>{Kt.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(u=document.querySelector("media-controller"))==null||u.setAttribute("tabindex","-1"),window.addEventListener("keydown",a),s.video.appendHelpMenuGroup(Kt.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",a)}},[e]),p.createElement("div",{id:n.playerHTMLElementId})}),pr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),gr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),vr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),wr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),br=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),p.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Sr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),p.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Er=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Tr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),yr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_237)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_237"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Cr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_260)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_260"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Y=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>p.createElement("button",{disabled:o,onClick:e},p.createElement(t,{width:n,height:r})," ",i),Lr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),p.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Mr=({width:t,height:e})=>p.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),p.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 Q(t){t.next(),t.complete()}class Ar{constructor(){E(this,"actionMarkerInOut");E(this,"actionMarkerSplit");E(this,"actionMarkerDelete");E(this,"actionPreviousMarkerToggle");E(this,"actionNextMarkerToggle");E(this,"actionSetMarkerStartToPlayhead");E(this,"actionSetMarkerEndToPlayhead");E(this,"actionSetPlayheadToMarkerStart");E(this,"actionSetPlayheadToMarkerEnd");E(this,"actionRewind3SecondsAndPlayToCurrent");E(this,"actionPlay3SecondsAndRewindToCurrent");E(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=Pt.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 Be=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof I.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,a=i.timeObservation.end,c=o.start,u=n??o.end;if(c!=null&&u!=null)return r||c<=a&&u>=s}return r},!1);function Pe(t,e,n){if(!t||!(t instanceof I.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),a=n.video.getCurrentFrame();return e<r||o-a<2||a-s<1}function Ke(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Ir=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:a,setSource:c,source:u,constants:l})=>{const d=p.useRef(void 0),f=p.useRef(void 0),h=new pe,v=p.useRef(!1),w=(g,b,M)=>{const D=b??e.video.getCurrentTime();return g.getMarkers().reduce((x,G)=>G instanceof I.PeriodMarker&&G.timeObservation.start!==void 0&&G.timeObservation.end!==void 0&&G.id!==(M==null?void 0:M.id)?x||D>=G.timeObservation.start&&D<=G.timeObservation.end:x,!1)},C=g=>{if(_===void 0)return!0;const b=_.timeObservation.start,M=g??e.video.getCurrentTime();return!!(b==null||b>=M||Be(u,_,M))},A=g=>_!==void 0||u===void 0?!0:w(u,g,_),[B,O]=p.useState(void 0),[F,q]=p.useState(Pe(t,e.video.getCurrentTime(),e)),[_,re]=p.useState(void 0),[ve,z]=p.useState(C()),[ye,R]=p.useState(A()),oe=g=>{if(g===void 0||u===void 0||!(g instanceof I.PeriodMarker))return!0;const b=Be(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof I.PeriodMarker){const M=g.timeObservation.end;if(M!=null&&e.video.getCurrentTime()>=M)return!0}return!1},se=g=>{if(g===void 0||u===void 0||!(g instanceof I.PeriodMarker))return!0;const b=Be(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof I.PeriodMarker){if(g.timeObservation.end==null)return!0;const M=g.timeObservation.start;if(M!=null&&e.video.getCurrentTime()<=M)return!0}return!1},[Ce,P]=p.useState(oe(t)),[N,dt]=p.useState(se(t));p.useEffect(()=>{if(z(()=>C()),R(()=>A()),_&&_!==t){const g=i.find(b=>b.getMarker(_.id));g==null||g.removeMarker(_.id),re(void 0)}},[t,_,i,re]),p.useEffect(()=>()=>Q(h),[]),p.useEffect(()=>{if(P(oe(t)),dt(se(t)),t){const g=Pe(t,e.video.getCurrentTime(),e);q(g);const b=e.video.onVideoTimeChange$.pipe(W(h)).subscribe({next:M=>{q(D=>Pe(t,M.currentTime,e)),P(()=>oe(t)),dt(()=>se(t))}});return()=>b.unsubscribe()}},[t]),p.useEffect(()=>{e.video.onSeeking$.pipe(W(h)).subscribe({next:b=>{z(()=>C(b.toTime)),R(()=>A(b.toTime))}});const g=e.video.onVideoTimeChange$.pipe(W(h)).subscribe({next:b=>{z(()=>C()),R(()=>A())}});return()=>g.unsubscribe()},[_,u]),p.useEffect(()=>{const g=i.map(b=>b.onMarkerUpdate$.pipe(W(h)).subscribe({next:M=>{(t==null?void 0:t.id)===M.marker.id&&(q(D=>Pe(t,e.video.getCurrentTime(),e)),P(()=>oe(t)),dt(()=>se(t)))}}));return()=>g.forEach(b=>b.unsubscribe())},[i,t]),p.useEffect(()=>{B&&(B.marker.style={...B.marker.style,color:B.color},B.marker.timeObservation={...B.marker.timeObservation},O(void 0))},[t]),p.useEffect(()=>{if(u){z(()=>C()),R(()=>A());const g=u.onMarkerDelete$.pipe(W(h)).subscribe({next:M=>{const D=M.marker;O(x=>{if((x==null?void 0:x.marker.id)!==D.id)return x}),s(x=>{if((x==null?void 0:x.id)!==D.id)return x}),re(x=>{if((x==null?void 0:x.id)!==D.id)return x}),z(()=>C()),R(()=>A())}}),b=u.onMarkerUpdate$.pipe(W(h)).subscribe({next:()=>{z(()=>C()),R(()=>A())}});return()=>{g.unsubscribe(),b.unsubscribe()}}},[u]);const sn=(g,b)=>{if(b===void 0)return;const M=b.timeObservation;g.video.seekToTime(M.start)},an=(g,b)=>{if(b===void 0)return;const M=b.timeObservation;g.video.seekToTime(M.end)},un=(g,b)=>{b instanceof I.PeriodMarker&&b.timeObservation.start!==void 0&&(b.timeObservation={...b.timeObservation,start:g.video.getCurrentTime()})},cn=(g,b)=>{b instanceof I.PeriodMarker&&b.timeObservation.end!==void 0&&(b.timeObservation={...b.timeObservation,end:g.video.getCurrentTime()})},ln=(g,b)=>{d.current&&Q(d.current),d.current=new pe,g.video.pause();const M=g.video.getCurrentFrame(),D=g.video.getFrameRate(),x=M-b*D,G=x>=0?x:0;g.video.seekToFrame(G).pipe(Se()).subscribe(()=>{}),g.video.play(),g.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(ze=>{ze.frame>=M-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(M).pipe(Se()).subscribe(()=>{})}),Q(d.current))})},dn=(g,b)=>{d.current&&Q(d.current),d.current=new pe,f.current&&Q(f.current),f.current=new pe;const M=g.video.getCurrentFrame(),D=g.video.getFrameRate(),x=M+b*D;g.video.play(),g.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(G=>{G.frame>=x-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(M).pipe(Se()).subscribe(()=>{})}),Q(d.current))}),g.video.onEnded$.pipe(W(f.current),W(h)).subscribe(G=>{setTimeout(()=>{g.video.seekToFrame(M).pipe(Se()).subscribe(()=>{})},1),Q(f.current)})},ft=g=>{u.removeMarker(g.id),(_==null?void 0:_.id)===g.id&&re(void 0)},fn=(g,b)=>{if(!(b instanceof I.PeriodMarker))return;const M=b.timeObservation.start,D=b.timeObservation.end,x=g.video.getCurrentTime();if(M==null||D==null)return;const G=M,ze=x,Bi=ze+1/g.video.getFrameRate(),Pi=D;ft(b);const ht=new I.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:G,end:ze},editable:!0});ht.onClick$.subscribe({next:()=>a(ht)});const Oe=new I.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:Bi,end:Pi},editable:!0});Oe.onClick$.subscribe({next:()=>a(Oe)}),u.addMarker(ht),u.addMarker(Oe),a(Oe),setTimeout(()=>{O({marker:Oe,color:l.PERIOD_MARKER_STYLE.color})},0)},hn=()=>{const g=e.video.getCurrentTime(),b=new I.PeriodMarker({timeObservation:{start:g},style:l.PERIOD_MARKER_STYLE,editable:!0});b.onClick$.subscribe({next:()=>a(b)}),u.addMarker(b),re(b),z(C()),a(b)},mn=()=>{const g=e.video.getCurrentTime();_.timeObservation={..._.timeObservation,end:g},re(void 0)},pn=g=>{d.current&&Q(d.current),d.current=new pe,f.current&&Q(f.current),f.current=new pe;const b=e.video.calculateTimeToFrame(g.timeObservation.start),M=e.video.calculateTimeToFrame(g.timeObservation.end);e.video.pause(),e.video.seekToFrame(b),e.video.play(),e.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(D=>{D.frame>=M-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(b).pipe(Se()).subscribe(()=>{})}),Q(d.current))}),e.video.onEnded$.pipe(W(f.current),W(h)).subscribe(D=>{setTimeout(()=>{e.video.seekToFrame(b).pipe(Se()).subscribe(()=>{})},1),Q(f.current)})},Fi=()=>{const g=i.length,b=`Segmentation ${i.length+1}`,M=new I.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:b});M.onMarkerUpdate$.subscribe({next:D=>{Be(M,D.marker)&&(D.marker.timeObservation=D.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(M,g+1),o([...i,M]),a(void 0),c(M)},gn=g=>{if(!u)return;const b=u.getMarkers().filter(x=>x instanceof I.PeriodMarker).sort((x,G)=>x.timeObservation.start??0-(G.timeObservation.start??0));if(t===void 0){a(b.at(0));return}const D=b.findIndex(x=>x.id===t.id)+(g?-1:1);D>=0&&D<b.length&&a(b.at(D))};return p.useEffect(()=>{if(!r)return;const g=new Ar;g.actionLoopActiveMarker=()=>t instanceof I.PeriodMarker&&Ke(t)&&pn(t),g.actionSetPlayheadToMarkerStart=()=>t&&sn(e,t),g.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof I.PeriodMarker&&Ke(t)&&an(e,t),g.actionSetMarkerStartToPlayhead=()=>!Ce&&un(e,t),g.actionSetMarkerEndToPlayhead=()=>!N&&cn(e,t),g.actionMarkerSplit=()=>!F&&fn(e,t),g.actionMarkerDelete=()=>t&&ft(t),g.actionMarkerInOut=()=>{_===void 0?!ye&&hn():!ve&&mn()},g.actionPlay3SecondsAndRewindToCurrent=()=>dn(e,3),g.actionRewind3SecondsAndPlayToCurrent=()=>ln(e,3),g.actionNextMarkerToggle=()=>gn(!1),g.actionPreviousMarkerToggle=()=>gn(!0);const b=M=>{g.handleKeyboardEvent(M,e)&&(M.stopPropagation(),M.preventDefault())};return window.addEventListener("keydown",b),v.current||(e.video.appendHelpMenuGroup(g.getKeyboardShortcutsHelpMenuGroup()),v.current=!0),()=>window.removeEventListener("keydown",b)}),p.createElement("div",{className:"control-panel-wrapper"},p.createElement("div",{className:"control-panel"},p.createElement(Y,{Icon:pr,onClick:()=>sn(e,t),disabled:t===void 0}),p.createElement(Y,{Icon:gr,onClick:()=>an(e,t),disabled:t===void 0||t instanceof I.PeriodMarker&&!Ke(t)}),p.createElement(Y,{Icon:vr,onClick:()=>un(e,t),disabled:Ce}),p.createElement(Y,{Icon:wr,onClick:()=>cn(e,t),disabled:N}),_===void 0?p.createElement(Y,{Icon:br,onClick:hn,disabled:ye}):p.createElement(Y,{Icon:Lr,onClick:mn,disabled:ve}),p.createElement(Y,{Icon:Er,onClick:()=>ft(t),disabled:t===void 0}),p.createElement(Y,{Icon:Sr,onClick:()=>fn(e,t),disabled:F||t===void 0}),p.createElement(Y,{Icon:Tr,onClick:()=>pn(t),disabled:!(t instanceof I.PeriodMarker&&Ke(t))}),p.createElement(Y,{Icon:yr,onClick:()=>ln(e,3)}),p.createElement(Y,{Icon:Cr,onClick:()=>dn(e,3)})),p.createElement("div",{className:"control-panel"},p.createElement("div",{className:"segmentation-button-wrapper"},p.createElement(Y,{Icon:Mr,text:"NEW SEGMENTATION",onClick:()=>Fi(),disabled:i.length>=3}))))};class ge{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ge.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ge.isNullUndefinedOrWhitespace(e)&&!ge.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 ge.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ge.replaceWhitespace(e," ").split(" "):void 0}}/*!
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function et(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Ne=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 a=we(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(v){e={error:v}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(K(l))try{l()}catch(v){o=v instanceof Je?v.errors:[v]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=we(d),h=f.next();!h.done;h=f.next()){var w=h.value;try{vt(w)}catch(v){o=o??[],v instanceof Je?o=xe(xe([],_e(o)),_e(v.errors)):o.push(v)}}}catch(v){r={error:v}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(o)throw new Je(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)vt(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)&&et(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&et(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),pt=Ne.EMPTY;function gt(t){return t instanceof Ne||t&&"closed"in t&&K(t.remove)&&K(t.add)&&K(t.unsubscribe)}function vt(t){K(t)?t():t.unsubscribe()}var En={Promise:void 0},Tn={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,xe([t,e],_e(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function wt(t){Tn.setTimeout(function(){throw t})}function tt(){}function ke(t){t()}var nt=function(t){Le(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,gt(n)&&n.add(r)):r.destination=Ln,r}return e.create=function(n,r,i){return new rt(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}(Ne),yn=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){De(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){De(r)}else De(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){De(n)}},t}(),rt=function(t){Le(e,t);function e(n,r,i){var o=t.call(this)||this,s;return K(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new yn(s),o}return e}(nt);function De(t){wt(t)}function Cn(t){throw t}var Ln={closed:!0,next:tt,error:Cn,complete:tt},it=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Fe(t){return t}function Mn(t){return t.length===0?Fe:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var $=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=In(e)?e:new rt(e,n,r);return ke(function(){var s=i,a=s.operator,c=s.source;o.add(a?a.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=bt(n),new n(function(i,o){var s=new rt({next:function(a){try{e(a)}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[it]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Mn(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=bt(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 bt(t){var e;return(e=t??En.Promise)!==null&&e!==void 0?e:Promise}function An(t){return t&&K(t.next)&&K(t.error)&&K(t.complete)}function In(t){return t&&t instanceof nt||An(t)&&gt(t)}function On(t){return K(t==null?void 0:t.lift)}function ae(t){return function(e){if(On(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 ue(t,e,n,r,i){return new _n(t,e,n,r,i)}var _n=function(t){Le(e,t);function e(n,r,i,o,s,a){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:t.prototype._next,c._error=o?function(u){try{o(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}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}(nt),xn=Qe(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 St(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new xn},e.prototype.next=function(n){var r=this;ke(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=we(r.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(n)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;ke(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;ke(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,a=i.observers;return o||s?pt:(this.currentObservers=null,a.push(n),new Ne(function(){r.currentObservers=null,et(a,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 $;return n.source=this,n},e.create=function(n,r){return new St(n,r)},e}($),St=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:pt},e}(pe),Nn=new $(function(t){return t.complete()});function kn(t){return t&&K(t.schedule)}function Et(t){return t[t.length-1]}function Dn(t){return K(Et(t))?t.pop():void 0}function Fn(t){return kn(Et(t))?t.pop():void 0}var Tt=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function yt(t){return K(t==null?void 0:t.then)}function Ct(t){return K(t[it])}function Lt(t){return Symbol.asyncIterator&&K(t==null?void 0:t[Symbol.asyncIterator])}function Mt(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 Vn(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var At=Vn();function It(t){return K(t==null?void 0:t[At])}function Ot(t){return bn(this,arguments,function(){var n,r,i,o;return mt(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,be(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,be(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,be(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 _t(t){return K(t==null?void 0:t.getReader)}function Ve(t){if(t instanceof $)return t;if(t!=null){if(Ct(t))return Bn(t);if(Tt(t))return Pn(t);if(yt(t))return Kn(t);if(Lt(t))return xt(t);if(It(t))return Un(t);if(_t(t))return Hn(t)}throw Mt(t)}function Bn(t){return new $(function(e){var n=t[it]();if(K(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Pn(t){return new $(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Kn(t){return new $(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,wt)})}function Un(t){return new $(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(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function xt(t){return new $(function(e){Rn(t,e).catch(function(n){return e.error(n)})})}function Hn(t){return xt(Ot(t))}function Rn(t,e){var n,r,i,o;return wn(this,void 0,void 0,function(){var s,a;return mt(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Sn(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 a=c.sent(),i={error:a},[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 ce(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 Nt(t,e){return e===void 0&&(e=0),ae(function(n,r){n.subscribe(ue(r,function(i){return ce(r,t,function(){return r.next(i)},e)},function(){return ce(r,t,function(){return r.complete()},e)},function(i){return ce(r,t,function(){return r.error(i)},e)}))})}function kt(t,e){return e===void 0&&(e=0),ae(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Zn(t,e){return Ve(t).pipe(kt(e),Nt(e))}function qn(t,e){return Ve(t).pipe(kt(e),Nt(e))}function Wn(t,e){return new $(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Xn(t,e){return new $(function(n){var r;return ce(n,e,function(){r=t[At](),ce(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(a){n.error(a);return}s?n.complete():n.next(o)},0,!0)}),function(){return K(r==null?void 0:r.return)&&r.return()}})}function Dt(t,e){if(!t)throw new Error("Iterable cannot be null");return new $(function(n){ce(n,e,function(){var r=t[Symbol.asyncIterator]();ce(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Gn(t,e){return Dt(Ot(t),e)}function jn(t,e){if(t!=null){if(Ct(t))return Zn(t,e);if(Tt(t))return Wn(t,e);if(yt(t))return qn(t,e);if(Lt(t))return Dt(t,e);if(It(t))return Xn(t,e);if(_t(t))return Gn(t,e)}throw Mt(t)}function Ft(t,e){return e?jn(t,e):Ve(t)}var Vt=Qe(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function $n(t,e){return ae(function(n,r){var i=0;n.subscribe(ue(r,function(o){r.next(t.call(e,o,i++))}))})}var zn=Array.isArray;function Yn(t,e){return zn(e)?t.apply(void 0,xe([],_e(e))):t(e)}function Qn(t){return $n(function(e){return Yn(t,e)})}var Jn=Array.isArray,er=Object.getPrototypeOf,tr=Object.prototype,nr=Object.keys;function rr(t){if(t.length===1){var e=t[0];if(Jn(e))return{args:e,keys:null};if(ir(e)){var n=nr(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function ir(t){return t&&typeof t=="object"&&er(t)===tr}function or(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function sr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Fn(t),r=Dn(t),i=rr(t),o=i.args,s=i.keys;if(o.length===0)return Ft([],n);var a=new $(ar(o,n,s?function(c){return or(s,c)}:Fe));return r?a.pipe(Qn(r)):a}function ar(t,e,n){return n===void 0&&(n=Fe),function(r){Bt(e,function(){for(var i=t.length,o=new Array(i),s=i,a=i,c=function(l){Bt(e,function(){var d=Ft(t[l],e),f=!1;d.subscribe(ue(r,function(h){o[l]=h,f||(f=!0,a--),a||r.next(n(o.slice()))},function(){--s||r.complete()}))},r)},u=0;u<i;u++)c(u)},r)}}function Bt(t,e,n){t?ce(n,t,e):e()}function ur(t,e){return ae(function(n,r){var i=0;n.subscribe(ue(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function cr(t){return ae(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){r||n.next(t),n.complete()}))})}function lr(t){return t<=0?function(){return Nn}:ae(function(e,n){var r=0;e.subscribe(ue(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function dr(t){return t===void 0&&(t=fr),ae(function(e,n){var r=!1;e.subscribe(ue(n,function(i){r=!0,n.next(i)},function(){return r?n.complete():n.error(t())}))})}function fr(){return new Vt}function Se(t,e){var n=arguments.length>=2;return function(r){return r.pipe(Fe,lr(1),n?cr(e):dr(function(){return new Vt}))}}function W(t){return ae(function(e,n){Ve(t).subscribe(ue(n,function(){return n.complete()},tt)),!n.closed&&e.subscribe(n)})}class hr{constructor(){E(this,"actionZoomIn");E(this,"actionZoomOut");E(this,"actionResetZoom");E(this,"actionToggleNextAudioTrack");E(this,"actionTogglePreviousAudioTrack");E(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 mr=p.memo(({omakasePlayer:t,onTimelineCreatedCallback:e,timelineConfig:n,enableHotKeys:r})=>(p.useEffect(()=>{if(n.timelineHTMLElementId===void 0&&(n.timelineHTMLElementId="omakase-timeline"),t.createTimeline(n).subscribe({next:i=>{sr([t.timeline.onReady$,t.video.onVideoLoaded$.pipe(ur(o=>!!o))]).subscribe({next:()=>e(i)})}}),r===void 0||r){const i=new hr;i.actionToggleCti=()=>{var a;return(a=t.timeline)==null?void 0:a.toggleTimecodeEdit()},i.actionResetZoom=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomToEased(100)},i.actionZoomIn=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomInEased()},i.actionZoomOut=()=>{var a;return(a=t.timeline)==null?void 0:a.zoomOutEased()};const o=a=>{const c=t.audio.getAudioTracks(),u=t.audio.getActiveAudioTrack(),d=c.findIndex(f=>f.id===(u==null?void 0:u.id))+(a?-1:1);d>=0&&d<c.length&&t.audio.setActiveAudioTrack(c.at(d).id)};i.actionTogglePreviousAudioTrack=()=>o(!0),i.actionToggleNextAudioTrack=()=>o(!1);const s=a=>{i.handleKeyboardEvent(a)&&(a.preventDefault(),a.stopPropagation())};return window.addEventListener("keydown",s),t.video.appendHelpMenuGroup(i.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",s)}}},[t]),p.createElement("div",{id:n.timelineHTMLElementId})));class Pt{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 Me=[.25,.5,.75,1,2,4,8];class Kt{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=Pt.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,a=e.shiftKey?1:-1,c=n.video.getVolume()*100+s*a;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 a=Me.indexOf(n.video.getPlaybackRate())+s;let c;return a<0?c=Me.at(0):a>=Me.length?c=Me.at(-1):c=Me.at(a),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,a=e.shiftKey?10:1;return n.video.isPlaying()&&n.video.pause(),n.video.seekFromCurrentFrame(a*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 Ut=p.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"),p.useEffect(()=>{var c,u;let s=new I.OmakasePlayer(n);const a=l=>{Kt.handleKeyboardEvent(l,s)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((c=document.querySelector("media-controller"))==null||c.setAttribute("nohotkeys",""),(u=document.querySelector("media-controller"))==null||u.setAttribute("tabindex","-1"),window.addEventListener("keydown",a),s.video.appendHelpMenuGroup(Kt.getKeyboardShortcutsHelpMenuGroup())),s.loadVideo(e,r).subscribe({next:l=>{i&&i(s,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",a)}},[e]),p.createElement("div",{id:n.playerHTMLElementId})}),pr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),gr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),vr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),wr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),br=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"#CACFEA"}),p.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"#CACFEA"})),Sr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"#CACFEA"}),p.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"#CACFEA"})),Er=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"})),Tr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.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"}),p.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"})),yr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_237)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_237"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Cr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("g",{clipPath:"url(#clip0_3377_260)"},p.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"}),p.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"})),p.createElement("defs",null,p.createElement("clipPath",{id:"clip0_3377_260"},p.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Y=({Icon:t,onClick:e,width:n,height:r,text:i,disabled:o})=>p.createElement("button",{disabled:o,onClick:e},p.createElement(t,{width:n,height:r})," ",i),Lr=({width:t,height:e})=>p.createElement("svg",{width:t??24,height:e??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"#CACFEA"}),p.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"#CACFEA"})),Mr=({width:t,height:e})=>p.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},p.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"#CACFEA"}),p.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 Q(t){t.next(),t.complete()}class Ar{constructor(){E(this,"actionMarkerInOut");E(this,"actionMarkerSplit");E(this,"actionMarkerDelete");E(this,"actionPreviousMarkerToggle");E(this,"actionNextMarkerToggle");E(this,"actionSetMarkerStartToPlayhead");E(this,"actionSetMarkerEndToPlayhead");E(this,"actionSetPlayheadToMarkerStart");E(this,"actionSetPlayheadToMarkerEnd");E(this,"actionRewind3SecondsAndPlayToCurrent");E(this,"actionPlay3SecondsAndRewindToCurrent");E(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let e=(...s)=>s.join(" + "),n="shift".toUpperCase();const r=Pt.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 Be=(t,e,n)=>t.getMarkers().reduce((r,i)=>{if(e.id===i.id)return r;if(i instanceof I.PeriodMarker&&i.timeObservation.start!=null&&i.timeObservation.end!=null){const o=e.timeObservation,s=i.timeObservation.start,a=i.timeObservation.end,c=o.start,u=n??o.end;if(c!=null&&u!=null)return r||c<=a&&u>=s}return r},!1);function Pe(t,e,n){if(!t||!(t instanceof I.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),a=n.video.getCurrentFrame();return e<r||o-a<2||a-s<1}function Ke(t){return!(t.timeObservation.start==null||t.timeObservation.end==null)}const Ir=({selectedMarker:t,omakasePlayer:e,markerListApi:n,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:o,setSelectedMarker:s,onMarkerClickCallback:a,setSource:c,source:u,constants:l})=>{const d=p.useRef(void 0),f=p.useRef(void 0),h=new pe,w=p.useRef(!1),v=(g,b,L)=>{const D=b??e.video.getCurrentTime();return g.getMarkers().reduce((x,G)=>G instanceof I.PeriodMarker&&G.timeObservation.start!==void 0&&G.timeObservation.end!==void 0&&G.id!==(L==null?void 0:L.id)?x||D>=G.timeObservation.start&&D<=G.timeObservation.end:x,!1)},M=g=>{if(_===void 0)return!0;const b=_.timeObservation.start,L=g??e.video.getCurrentTime();return!!(b==null||b>=L||Be(u,_,L))},A=g=>_!==void 0||u===void 0?!0:v(u,g,_),[B,O]=p.useState(void 0),[V,q]=p.useState(Pe(t,e.video.getCurrentTime(),e)),[_,re]=p.useState(void 0),[ve,z]=p.useState(M()),[ye,R]=p.useState(A()),oe=g=>{if(g===void 0||u===void 0||!(g instanceof I.PeriodMarker))return!0;const b=Be(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof I.PeriodMarker){const L=g.timeObservation.end;if(L!=null&&e.video.getCurrentTime()>=L)return!0}return!1},se=g=>{if(g===void 0||u===void 0||!(g instanceof I.PeriodMarker))return!0;const b=Be(u,g,e.video.getCurrentTime());if(b)return b;if(g instanceof I.PeriodMarker){if(g.timeObservation.end==null)return!0;const L=g.timeObservation.start;if(L!=null&&e.video.getCurrentTime()<=L)return!0}return!1},[Ce,P]=p.useState(oe(t)),[N,dt]=p.useState(se(t));p.useEffect(()=>{if(z(()=>M()),R(()=>A()),_&&_!==t){const g=i.find(b=>b.getMarker(_.id));g==null||g.removeMarker(_.id),re(void 0)}},[t,_,i,re]),p.useEffect(()=>()=>Q(h),[]),p.useEffect(()=>{if(P(oe(t)),dt(se(t)),t){const g=Pe(t,e.video.getCurrentTime(),e);q(g);const b=e.video.onVideoTimeChange$.pipe(W(h)).subscribe({next:L=>{q(D=>Pe(t,L.currentTime,e)),P(()=>oe(t)),dt(()=>se(t))}});return()=>b.unsubscribe()}},[t]),p.useEffect(()=>{e.video.onSeeking$.pipe(W(h)).subscribe({next:b=>{z(()=>M(b.toTime)),R(()=>A(b.toTime))}});const g=e.video.onVideoTimeChange$.pipe(W(h)).subscribe({next:b=>{z(()=>M()),R(()=>A())}});return()=>g.unsubscribe()},[_,u]),p.useEffect(()=>{const g=i.map(b=>b.onMarkerUpdate$.pipe(W(h)).subscribe({next:L=>{(t==null?void 0:t.id)===L.marker.id&&(q(D=>Pe(t,e.video.getCurrentTime(),e)),P(()=>oe(t)),dt(()=>se(t)))}}));return()=>g.forEach(b=>b.unsubscribe())},[i,t]),p.useEffect(()=>{B&&(B.marker.style={...B.marker.style,color:B.color},B.marker.timeObservation={...B.marker.timeObservation},O(void 0))},[t]),p.useEffect(()=>{if(u){z(()=>M()),R(()=>A());const g=u.onMarkerDelete$.pipe(W(h)).subscribe({next:L=>{const D=L.marker;O(x=>{if((x==null?void 0:x.marker.id)!==D.id)return x}),s(x=>{if((x==null?void 0:x.id)!==D.id)return x}),re(x=>{if((x==null?void 0:x.id)!==D.id)return x}),z(()=>M()),R(()=>A())}}),b=u.onMarkerUpdate$.pipe(W(h)).subscribe({next:()=>{z(()=>M()),R(()=>A())}});return()=>{g.unsubscribe(),b.unsubscribe()}}},[u]);const sn=(g,b)=>{if(b===void 0)return;const L=b.timeObservation;g.video.seekToTime(L.start)},an=(g,b)=>{if(b===void 0)return;const L=b.timeObservation;g.video.seekToTime(L.end)},un=(g,b)=>{b instanceof I.PeriodMarker&&b.timeObservation.start!==void 0&&(b.timeObservation={...b.timeObservation,start:g.video.getCurrentTime()})},cn=(g,b)=>{b instanceof I.PeriodMarker&&b.timeObservation.end!==void 0&&(b.timeObservation={...b.timeObservation,end:g.video.getCurrentTime()})},ln=(g,b)=>{d.current&&Q(d.current),d.current=new pe,g.video.pause();const L=g.video.getCurrentFrame(),D=g.video.getFrameRate(),x=L-b*D,G=x>=0?x:0;g.video.seekToFrame(G).pipe(Se()).subscribe(()=>{}),g.video.play(),g.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(ze=>{ze.frame>=L-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(L).pipe(Se()).subscribe(()=>{})}),Q(d.current))})},dn=(g,b)=>{d.current&&Q(d.current),d.current=new pe,f.current&&Q(f.current),f.current=new pe;const L=g.video.getCurrentFrame(),D=g.video.getFrameRate(),x=L+b*D;g.video.play(),g.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(G=>{G.frame>=x-1&&(g.video.pause().subscribe(()=>{g.video.seekToFrame(L).pipe(Se()).subscribe(()=>{})}),Q(d.current))}),g.video.onEnded$.pipe(W(f.current),W(h)).subscribe(G=>{setTimeout(()=>{g.video.seekToFrame(L).pipe(Se()).subscribe(()=>{})},1),Q(f.current)})},ft=g=>{u.removeMarker(g.id),(_==null?void 0:_.id)===g.id&&re(void 0)},fn=(g,b)=>{if(!(b instanceof I.PeriodMarker))return;const L=b.timeObservation.start,D=b.timeObservation.end,x=g.video.getCurrentTime();if(L==null||D==null)return;const G=L,ze=x,Bi=ze+1/g.video.getFrameRate(),Pi=D;ft(b);const ht=new I.PeriodMarker({style:l.PERIOD_MARKER_STYLE,timeObservation:{start:G,end:ze},editable:!0});ht.onClick$.subscribe({next:()=>a(ht)});const Oe=new I.PeriodMarker({style:l.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:Bi,end:Pi},editable:!0});Oe.onClick$.subscribe({next:()=>a(Oe)}),u.addMarker(ht),u.addMarker(Oe),a(Oe),setTimeout(()=>{O({marker:Oe,color:l.PERIOD_MARKER_STYLE.color})},0)},hn=()=>{const g=e.video.getCurrentTime(),b=new I.PeriodMarker({timeObservation:{start:g},style:l.PERIOD_MARKER_STYLE,editable:!0});b.onClick$.subscribe({next:()=>a(b)}),u.addMarker(b),re(b),z(M()),a(b)},mn=()=>{const g=e.video.getCurrentTime();_.timeObservation={..._.timeObservation,end:g},re(void 0)},pn=g=>{d.current&&Q(d.current),d.current=new pe,f.current&&Q(f.current),f.current=new pe;const b=e.video.calculateTimeToFrame(g.timeObservation.start),L=e.video.calculateTimeToFrame(g.timeObservation.end);e.video.pause(),e.video.seekToFrame(b),e.video.play(),e.video.onVideoTimeChange$.pipe(W(d.current),W(h)).subscribe(D=>{D.frame>=L-1&&(e.video.pause().subscribe(()=>{e.video.seekToFrame(b).pipe(Se()).subscribe(()=>{})}),Q(d.current))}),e.video.onEnded$.pipe(W(f.current),W(h)).subscribe(D=>{setTimeout(()=>{e.video.seekToFrame(b).pipe(Se()).subscribe(()=>{})},1),Q(f.current)})},Vi=()=>{const g=i.length,b=`Segmentation ${i.length+1}`,L=new I.MarkerLane({style:l.TIMELINE_LANE_STYLE,description:b});L.onMarkerUpdate$.subscribe({next:D=>{Be(L,D.marker)&&(D.marker.timeObservation=D.oldValue.timeObservation)}}),e.timeline.addTimelineLaneAtIndex(L,g+1),o([...i,L]),a(void 0),c(L)},gn=g=>{if(!u)return;const b=u.getMarkers().filter(x=>x instanceof I.PeriodMarker).sort((x,G)=>x.timeObservation.start??0-(G.timeObservation.start??0));if(t===void 0){a(b.at(0));return}const D=b.findIndex(x=>x.id===t.id)+(g?-1:1);D>=0&&D<b.length&&a(b.at(D))};return p.useEffect(()=>{if(!r)return;const g=new Ar;g.actionLoopActiveMarker=()=>t instanceof I.PeriodMarker&&Ke(t)&&pn(t),g.actionSetPlayheadToMarkerStart=()=>t&&sn(e,t),g.actionSetPlayheadToMarkerEnd=()=>t&&t instanceof I.PeriodMarker&&Ke(t)&&an(e,t),g.actionSetMarkerStartToPlayhead=()=>!Ce&&un(e,t),g.actionSetMarkerEndToPlayhead=()=>!N&&cn(e,t),g.actionMarkerSplit=()=>!V&&fn(e,t),g.actionMarkerDelete=()=>t&&ft(t),g.actionMarkerInOut=()=>{_===void 0?!ye&&hn():!ve&&mn()},g.actionPlay3SecondsAndRewindToCurrent=()=>dn(e,3),g.actionRewind3SecondsAndPlayToCurrent=()=>ln(e,3),g.actionNextMarkerToggle=()=>gn(!1),g.actionPreviousMarkerToggle=()=>gn(!0);const b=L=>{g.handleKeyboardEvent(L,e)&&(L.stopPropagation(),L.preventDefault())};return window.addEventListener("keydown",b),w.current||(e.video.appendHelpMenuGroup(g.getKeyboardShortcutsHelpMenuGroup()),w.current=!0),()=>window.removeEventListener("keydown",b)}),p.createElement("div",{className:"control-panel-wrapper"},p.createElement("div",{className:"control-panel"},p.createElement(Y,{Icon:pr,onClick:()=>sn(e,t),disabled:t===void 0}),p.createElement(Y,{Icon:gr,onClick:()=>an(e,t),disabled:t===void 0||t instanceof I.PeriodMarker&&!Ke(t)}),p.createElement(Y,{Icon:vr,onClick:()=>un(e,t),disabled:Ce}),p.createElement(Y,{Icon:wr,onClick:()=>cn(e,t),disabled:N}),_===void 0?p.createElement(Y,{Icon:br,onClick:hn,disabled:ye}):p.createElement(Y,{Icon:Lr,onClick:mn,disabled:ve}),p.createElement(Y,{Icon:Er,onClick:()=>ft(t),disabled:t===void 0}),p.createElement(Y,{Icon:Sr,onClick:()=>fn(e,t),disabled:V||t===void 0}),p.createElement(Y,{Icon:Tr,onClick:()=>pn(t),disabled:!(t instanceof I.PeriodMarker&&Ke(t))}),p.createElement(Y,{Icon:yr,onClick:()=>ln(e,3)}),p.createElement(Y,{Icon:Cr,onClick:()=>dn(e,3)})),p.createElement("div",{className:"control-panel"},p.createElement("div",{className:"segmentation-button-wrapper"},p.createElement(Y,{Icon:Mr,text:"NEW SEGMENTATION",onClick:()=>Vi(),disabled:i.length>=3}))))};class ge{static isNullUndefinedOrWhitespace(e){return typeof e===void 0||e==null?!0:`${e}`.replace(/\s/g,"").length<1}static isNonEmpty(e){return!ge.isNullUndefinedOrWhitespace(e)}static endsWith(e,n){return!ge.isNullUndefinedOrWhitespace(e)&&!ge.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 ge.replaceWhitespace(e,",")}static tokenizeWhitespaceSeparated(e){return e?ge.replaceWhitespace(e," ").split(" "):void 0}}/*!
4
4
  * decimal.js v10.5.0
5
5
  * An arbitrary-precision Decimal type for JavaScript.
6
6
  * https://github.com/MikeMcl/decimal.js
7
7
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
8
8
  * MIT Licence
9
- */var Ee=9e15,le=1e9,ot="0123456789abcdef",Ue="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",He="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",st={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ee,maxE:Ee,crypto:!1},Ht,ie,L=!0,Re="[DecimalError] ",de=Re+"Invalid argument: ",Rt=Re+"Precision limit exceeded",Zt=Re+"crypto unavailable",qt="[object Decimal]",X=Math.floor,U=Math.pow,Or=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_r=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,xr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Wt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,J=1e7,y=7,Nr=9007199254740991,kr=Ue.length-1,at=He.length-1,m={toStringTag:qt};m.absoluteValue=m.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),T(t)},m.ceil=function(){return T(new this.constructor(this),this.e+1,2)},m.clampedTo=m.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(de+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)},m.comparedTo=m.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,c=o.s,u=t.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=a.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},m.cosine=m.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())+y,r.rounding=1,n=Dr(r,Yt(r,n)),r.precision=t,r.rounding=e,T(ie==2||ie==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)},m.cubeRoot=m.cbrt=function(){var t,e,n,r,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(L=!1,o=l.s*U(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=U(n,1/3),t=X((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 d(n),r.s=l.s):r=new d(o.toString()),s=(t=d.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=k(u.plus(l).times(a),u.plus(c),s+2,1),Z(a.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&&(T(a,t+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(T(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return L=!0,T(r,t,d.rounding,e)},m.decimalPlaces=m.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-X(this.e/y))*y,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},m.dividedBy=m.div=function(t){return k(this,new this.constructor(t))},m.dividedToIntegerBy=m.divToInt=function(t){var e=this,n=e.constructor;return T(k(e,new n(t),0,1,1),n.precision,n.rounding)},m.equals=m.eq=function(t){return this.cmp(t)===0},m.floor=function(){return T(new this.constructor(this),this.e+1,3)},m.greaterThan=m.gt=function(t){return this.cmp(t)>0},m.greaterThanOrEqualTo=m.gte=function(t){var e=this.cmp(t);return e==1||e===0},m.hyperbolicCosine=m.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;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/Ge(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=Te(s,1,o.times(e),new s(1),!0);for(var c,u=t,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return T(o,s.precision=n,s.rounding=r,!0)},m.hyperbolicSine=m.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=Te(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/Ge(5,t)),i=Te(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=n,T(i,e,n,!0)},m.hyperbolicTangent=m.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,k(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},m.inverseCosine=m.acos=function(){var t=this,e=t.constructor,n=t.abs().cmp(1),r=e.precision,i=e.rounding;return n!==-1?n===0?t.isNeg()?ne(e,r,i):new e(0):new e(NaN):t.isZero()?ne(e,r+4,i).times(.5):(e.precision=r+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=r,e.rounding=i,t.times(2))},m.inverseHyperbolicCosine=m.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)},m.inverseHyperbolicSine=m.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())},m.inverseHyperbolicTangent=m.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?T(new o(i),t,e,!0):(o.precision=n=r-i.e,i=k(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)},m.inverseSine=m.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=ne(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)))},m.inverseTangent=m.atan=function(){var t,e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=at)return s=ne(l,d+4,f).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=at)return s=ne(l,d+4,f).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,n=Math.min(28,a/y+2|0),t=n;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(L=!1,e=Math.ceil(a/y),r=1,c=u.times(u),s=new l(u),i=u;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,T(s,l.precision=d,l.rounding=f,!0)},m.isFinite=function(){return!!this.d},m.isInteger=m.isInt=function(){return!!this.d&&X(this.e/y)>this.d.length-2},m.isNaN=function(){return!this.s},m.isNegative=m.isNeg=function(){return this.s<0},m.isPositive=m.isPos=function(){return this.s>0},m.isZero=function(){return!!this.d&&this.d[0]===0},m.lessThan=m.lt=function(t){return this.cmp(t)<0},m.lessThanOrEqualTo=m.lte=function(t){return this.cmp(t)<1},m.logarithm=m.log=function(t){var e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding,h=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=u.d,u.s<0||!n||!n[0]||u.eq(1))return new l(n&&!n[0]?-1/0:u.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,a=d+h,s=he(u,a),r=e?We(l,a+10):he(t,a),c=k(s,r,a,1),Ae(c.d,i=d,f))do if(a+=10,s=he(u,a),r=e?We(l,a+10):he(t,a),c=k(s,r,a,1),!o){+Z(c.d).slice(i+1,i+15)+1==1e14&&(c=T(c,d+1,0));break}while(Ae(c.d,i+=10,f));return L=!0,T(c,d,f)},m.minus=m.sub=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,v=h.constructor;if(t=new v(t),!h.d||!t.d)return!h.s||!t.s?t=new v(NaN):h.d?t.s=-t.s:t=new v(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(u=h.d,f=t.d,a=v.precision,c=v.rounding,!u[0]||!f[0]){if(f[0])t.s=-t.s;else if(u[0])t=new v(h);else return new v(c===3?-0:0);return L?T(t,a,c):t}if(n=X(t.e/y),l=X(h.e/y),u=u.slice(),o=l-n,o){for(d=o<0,d?(e=u,o=-o,s=f.length):(e=f,n=l,s=u.length),r=Math.max(Math.ceil(a/y),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=u.length,s=f.length,d=r<s,d&&(s=r),r=0;r<s;r++)if(u[r]!=f[r]){d=u[r]<f[r];break}o=0}for(d&&(e=u,u=f,f=e,t.s=-t.s),s=u.length,r=f.length-s;r>0;--r)u[s++]=0;for(r=f.length;r>o;){if(u[--r]<f[r]){for(i=r;i&&u[--i]===0;)u[i]=J-1;--u[i],u[r]+=J}u[r]-=f[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=qe(u,n),L?T(t,a,c):t):new v(c===3?-0:0)},m.modulo=m.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]?T(new r(n),r.precision,r.rounding):(L=!1,r.modulo==9?(e=k(n,t.abs(),0,3,1),e.s*=t.s):e=k(n,t,0,r.modulo,1),e=e.times(t),L=!0,n.minus(e))},m.naturalExponential=m.exp=function(){return ut(this)},m.naturalLogarithm=m.ln=function(){return he(this)},m.negated=m.neg=function(){var t=new this.constructor(this);return t.s=-t.s,T(t)},m.plus=m.add=function(t){var e,n,r,i,o,s,a,c,u,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(u=d.d,l=t.d,a=f.precision,c=f.rounding,!u[0]||!l[0])return l[0]||(t=new f(d)),L?T(t,a,c):t;if(o=X(d.e/y),r=X(t.e/y),u=u.slice(),i=o-r,i){for(i<0?(n=u,i=-i,s=l.length):(n=l,r=o,s=u.length),o=Math.ceil(a/y),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,n=l,l=u,u=n),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/J|0,u[i]%=J;for(e&&(u.unshift(e),++r),s=u.length;u[--s]==0;)u.pop();return t.d=u,t.e=qe(u,r),L?T(t,a,c):t},m.precision=m.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(de+t);return n.d?(e=Xt(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},m.round=function(){var t=this,e=t.constructor;return T(new e(t),t.e+1,e.rounding)},m.sine=m.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())+y,r.rounding=1,n=Fr(r,Yt(r,n)),r.precision=t,r.rounding=e,T(ie>2?n.neg():n,t,e,!0)):new r(NaN)},m.squareRoot=m.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(L=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=Z(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=X((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(u.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(k(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&&(T(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")&&(T(r,c+1,1),t=!r.times(r).eq(s));break}return L=!0,T(r,c,l.rounding,t)},m.tangent=m.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=k(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,T(ie==2||ie==4?n.neg():n,t,e,!0)):new r(NaN)},m.times=m.mul=function(t){var e,n,r,i,o,s,a,c,u,l=this,d=l.constructor,f=l.d,h=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(n=X(l.e/y)+X(t.e/y),c=f.length,u=h.length,c<u&&(o=f,f=h,h=o,s=c,c=u,u=s),o=[],s=c+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(e=0,i=c+r;i>r;)a=o[i]+h[r]*f[i-r-1]+e,o[i--]=a%J|0,e=a/J|0;o[i]=(o[i]+e)%J|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=qe(o,n),L?T(t,d.precision,d.rounding):t},m.toBinary=function(t,e){return ct(this,2,t,e)},m.toDecimalPlaces=m.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),T(n,t+n.e+1,e))},m.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=te(r,!0):(j(t,0,le),e===void 0?e=i.rounding:j(e,0,8),r=T(new i(r),t+1,e),n=te(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},m.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=te(i):(j(t,0,le),e===void 0?e=o.rounding:j(e,0,8),r=T(new o(i),t+i.e+1,e),n=te(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},m.toFraction=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,v=h.d,w=h.constructor;if(!v)return new w(h);if(u=n=new w(1),r=c=new w(0),e=new w(r),o=e.e=Xt(v)-h.e-1,s=o%y,e.d[0]=U(10,s<0?y+s:s),t==null)t=o>0?e:u;else{if(a=new w(t),!a.isInt()||a.lt(u))throw Error(de+a);t=a.gt(e)?o>0?e:u:a}for(L=!1,a=new w(Z(v)),l=w.precision,w.precision=o=v.length*y*2;d=k(a,e,0,1,1),i=n.plus(d.times(r)),i.cmp(t)!=1;)n=r,r=i,i=u,u=c.plus(d.times(i)),c=i,i=e,e=a.minus(d.times(i)),a=i;return i=k(t.minus(n),r,0,1,1),c=c.plus(i.times(u)),n=n.plus(i.times(r)),c.s=u.s=h.s,f=k(u,r,o,1).minus(h).abs().cmp(k(c,n,o,1).minus(h).abs())<1?[u,r]:[c,n],w.precision=l,L=!0,f},m.toHexadecimal=m.toHex=function(t,e){return ct(this,16,t,e)},m.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=k(n,t,0,e,1).times(t),L=!0,T(n)):(t.s=n.s,n=t),n},m.toNumber=function(){return+this},m.toOctal=function(t,e){return ct(this,8,t,e)},m.toPower=m.pow=function(t){var e,n,r,i,o,s,a=this,c=a.constructor,u=+(t=new c(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new c(U(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,o=c.rounding,t.eq(1))return T(a,r,o);if(e=X(t.e/y),e>=t.d.length-1&&(n=u<0?-u:u)<=Nr)return i=Gt(c,a,n,r),t.s<0?new c(1).div(i):T(i,r,o);if(s=a.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=U(+a,u),e=n==0||!isFinite(n)?X(u*(Math.log("0."+Z(a.d))/Math.LN10+a.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=a.s=1,n=Math.min(12,(e+"").length),i=ut(t.times(he(a,r+n)),r),i.d&&(i=T(i,r+5,1),Ae(i.d,r,o)&&(e=r+10,i=T(ut(t.times(he(a,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=T(i,r+1,0)))),i.s=s,L=!0,c.rounding=o,T(i,r,o))},m.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=te(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(j(t,1,le),e===void 0?e=i.rounding:j(e,0,8),r=T(new i(r),t,e),n=te(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},m.toSignificantDigits=m.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)),T(new r(n),t,e)},m.toString=function(){var t=this,e=t.constructor,n=te(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},m.truncated=m.trunc=function(){return T(new this.constructor(this),this.e+1,1)},m.valueOf=m.toJSON=function(){var t=this,e=t.constructor,n=te(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=y-r.length,n&&(o+=fe(n)),o+=r;s=t[e],r=s+"",n=y-r.length,n&&(o+=fe(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(de+t)}function Ae(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=y,i=0):(i=Math.ceil((e+1)/y),e%=y),o=U(10,y-e),a=t[i]%o|0,r==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==U(10,e-2)-1||(a==o/2||a==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==U(10,e-3)-1,s}function Ze(t,e,n){for(var r,i=[0],o,s=0,a=t.length;s<a;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=ot.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 Dr(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/Ge(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=Te(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 k=function(){function t(r,i,o){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+a,r[c]=s%o|0,a=s/o|0;return a&&r.unshift(a),r}function e(r,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(r[a]!=i[a]){c=r[a]>i[a]?1:-1;break}return c}function n(r,i,o,s){for(var a=0;o--;)r[o]-=a,a=r[o]<i[o]?1:0,r[o]=a*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,a,c){var u,l,d,f,h,v,w,C,A,B,O,F,q,_,re,ve,z,ye,R,oe,se=r.constructor,Ce=r.s==i.s?1:-1,P=r.d,N=i.d;if(!P||!P[0]||!N||!N[0])return new se(!r.s||!i.s||(P?N&&P[0]==N[0]:!N)?NaN:P&&P[0]==0||!N?Ce*0:Ce/0);for(c?(h=1,l=r.e-i.e):(c=J,h=y,l=X(r.e/h)-X(i.e/h)),R=N.length,z=P.length,A=new se(Ce),B=A.d=[],d=0;N[d]==(P[d]||0);d++);if(N[d]>(P[d]||0)&&l--,o==null?(_=o=se.precision,s=se.rounding):a?_=o+(r.e-i.e)+1:_=o,_<0)B.push(1),v=!0;else{if(_=_/h+2|0,d=0,R==1){for(f=0,N=N[0],_++;(d<z||f)&&_--;d++)re=f*c+(P[d]||0),B[d]=re/N|0,f=re%N|0;v=f||d<z}else{for(f=c/(N[0]+1)|0,f>1&&(N=t(N,f,c),P=t(P,f,c),R=N.length,z=P.length),ve=R,O=P.slice(0,R),F=O.length;F<R;)O[F++]=0;oe=N.slice(),oe.unshift(0),ye=N[0],N[1]>=c/2&&++ye;do f=0,u=e(N,O,R,F),u<0?(q=O[0],R!=F&&(q=q*c+(O[1]||0)),f=q/ye|0,f>1?(f>=c&&(f=c-1),w=t(N,f,c),C=w.length,F=O.length,u=e(w,O,C,F),u==1&&(f--,n(w,R<C?oe:N,C,c))):(f==0&&(u=f=1),w=N.slice()),C=w.length,C<F&&w.unshift(0),n(O,w,F,c),u==-1&&(F=O.length,u=e(N,O,R,F),u<1&&(f++,n(O,R<F?oe:N,F,c))),F=O.length):u===0&&(f++,O=[0]),B[d++]=f,u&&O[0]?O[F++]=P[ve]||0:(O=[P[ve]],F=1);while((ve++<z||O[0]!==void 0)&&_--);v=O[0]!==void 0}B[0]||B.shift()}if(h==1)A.e=l,Ht=v;else{for(d=1,f=B[0];f>=10;f/=10)d++;A.e=d+l*h-1,T(A,a?o+A.e+1:o,s,v)}return A}}();function T(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=y,s=e,l=d[f=0],c=l/U(10,i-s-1)%10|0;else if(f=Math.ceil((o+1)/y),a=d.length,f>=a)if(r){for(;a++<=f;)d.push(0);l=c=0,i=1,o%=y,s=o-y+1}else break e;else{for(l=a=d[f],i=1;a>=10;a/=10)i++;o%=y,s=o-y+i,c=s<0?0:l/U(10,i-s-1)%10|0}if(r=r||e<0||d[f+1]!==void 0||(s<0?l:l%U(10,i-s-1)),u=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/U(10,i-s):0:d[f-1])%10&1||n==(t.s<0?8:7)),e<1||!d[0])return d.length=0,u?(e-=t.e+1,d[0]=U(10,(y-e%y)%y),t.e=-e||0):d[0]=t.e=0,t;if(o==0?(d.length=f,a=1,f--):(d.length=f+1,a=U(10,y-o),d[f]=s>0?(l/U(10,i-s)%U(10,s)|0)*a:0),u)for(;;)if(f==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,d[0]==J&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=J)break;d[f--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return L&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function te(t,e,n){if(!t.isFinite())return zt(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)+fe(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+fe(-i-1)+o,n&&(r=n-s)>0&&(o+=fe(r))):i>=s?(o+=fe(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+fe(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=fe(r))),o}function qe(t,e){var n=t[0];for(e*=y;n>=10;n/=10)e++;return e}function We(t,e,n){if(e>kr)throw L=!0,n&&(t.precision=n),Error(Rt);return T(new t(Ue),e,1,!0)}function ne(t,e,n){if(e>at)throw Error(Rt);return T(new t(He),e,n,!0)}function Xt(t){var e=t.length-1,n=e*y+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 fe(t){for(var e="";t--;)e+="0";return e}function Gt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/y+4);for(L=!1;;){if(n%2&&(o=o.times(e),Qt(o.d,s)&&(i=!0)),n=X(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),Qt(e.d,s)}return L=!0,o}function jt(t){return t.d[t.d.length-1]&1}function $t(t,e,n){for(var r,i,o=new t(e[0]),s=0;++s<e.length;){if(i=new t(e[s]),!i.s){o=i;break}r=o.cmp(i),(r===n||r===0&&o.s===n)&&(o=i)}return o}function ut(t,e){var n,r,i,o,s,a,c,u=0,l=0,d=0,f=t.constructor,h=f.rounding,v=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(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=v):c=e,a=new f(.03125);t.e>-2;)t=t.times(a),d+=5;for(r=Math.log(U(2,d))/Math.LN10*2+5|0,c+=r,n=o=s=new f(1),f.precision=c;;){if(o=T(o.times(t),c,1),n=n.times(++l),a=s.plus(k(o,n,c,1)),Z(a.d).slice(0,c)===Z(s.d).slice(0,c)){for(i=d;i--;)s=T(s.times(s),c,1);if(e==null)if(u<3&&Ae(s.d,c-r,h,u))f.precision=c+=10,n=o=a=new f(1),l=0,u++;else return T(s,f.precision=v,h,L=!0);else return f.precision=v,s}s=a}}function he(t,e){var n,r,i,o,s,a,c,u,l,d,f,h=1,v=10,w=t,C=w.d,A=w.constructor,B=A.rounding,O=A.precision;if(w.s<0||!C||!C[0]||!w.e&&C[0]==1&&C.length==1)return new A(C&&!C[0]?-1/0:w.s!=1?NaN:C?0:w);if(e==null?(L=!1,l=O):l=e,A.precision=l+=v,n=Z(C),r=n.charAt(0),Math.abs(o=w.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)w=w.times(t),n=Z(w.d),r=n.charAt(0),h++;o=w.e,r>1?(w=new A("0."+n),o++):w=new A(r+"."+n.slice(1))}else return u=We(A,l+2,O).times(o+""),w=he(new A(r+"."+n.slice(1)),l-v).plus(u),A.precision=O,e==null?T(w,O,B,L=!0):w;for(d=w,c=s=w=k(w.minus(1),w.plus(1),l,1),f=T(w.times(w),l,1),i=3;;){if(s=T(s.times(f),l,1),u=c.plus(k(s,new A(i),l,1)),Z(u.d).slice(0,l)===Z(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(We(A,l+2,O).times(o+""))),c=k(c,new A(h),l,1),e==null)if(Ae(c.d,l-v,B,a))A.precision=l+=v,u=s=w=k(d.minus(1),d.plus(1),l,1),f=T(w.times(w),l,1),i=a=1;else return T(c,A.precision=O,B,L=!0);else return A.precision=O,c;c=u,i+=2}}function zt(t){return String(t.s*t.s/0)}function Xe(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)%y,n<0&&(r+=y),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=y;r<i;)t.d.push(+e.slice(r,r+=y));e=e.slice(r),r=y-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 Vr(t,e){var n,r,i,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Wt.test(e))return Xe(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(_r.test(e))n=16,e=e.toLowerCase();else if(Or.test(e))n=2;else if(xr.test(e))n=8;else throw Error(de+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(".",""),a=e.length,o=a-o,i=Gt(r,new r(n),o,o*2)),u=Ze(e,n,J),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new r(t.s*0):(t.e=qe(u,l),t.d=u,L=!1,s&&(t=k(t,i,a*4)),c&&(t=t.times(Math.abs(c)<54?U(2,c):Ie.pow(2,c))),L=!0,t)}function Fr(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:Te(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/Ge(5,n)),e=Te(t,2,e,e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function Te(t,e,n,r,i){var o,s,a,c,u=t.precision,l=Math.ceil(u/y);for(L=!1,c=n.times(n),a=new t(r);;){if(s=k(a.times(c),new t(e++*e++),u,1),a=i?r.plus(s):r.minus(s),r=k(s.times(c),new t(e++*e++),u,1),s=a.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=r,r=s,s=o}return L=!0,s.d.length=l+1,s}function Ge(t,e){for(var n=t;--e;)n*=t;return n}function Yt(t,e){var n,r=e.s<0,i=ne(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return ie=r?4:1,e;if(n=e.divToInt(i),n.isZero())ie=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return ie=jt(n)?r?2:3:r?4:1,e;ie=jt(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ct(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor,v=n!==void 0;if(v?(j(n,1,le),r===void 0?r=h.rounding:j(r,0,8)):(n=h.precision,r=h.rounding),!t.isFinite())l=zt(t);else{for(l=te(t),s=l.indexOf("."),v?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new h(1),f.e=l.length-s,f.d=Ze(te(f),10,i),f.e=f.d.length),d=Ze(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=v?"0p+0":"0";else{if(s<0?o--:(t=new h(t),t.d=d,t.e=o,t=k(t,f,n,r,0,i),d=t.d,o=t.e,u=Ht),s=d[n],a=i/2,u=u||d[n+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(t.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&d[n-1]&1||r===(t.s<0?8:7)),d.length=n,u)for(;++d[--n]>i-1;)d[n]=0,n||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=ot.charAt(d[s]);if(v){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(d=Ze(l,i,e),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=ot.charAt(d[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 Qt(t,e){if(t.length>e)return t.length=e,!0}function Br(t){return new this(t).abs()}function Pr(t){return new this(t).acos()}function Kr(t){return new this(t).acosh()}function Ur(t,e){return new this(t).plus(e)}function Hr(t){return new this(t).asin()}function Rr(t){return new this(t).asinh()}function Zr(t){return new this(t).atan()}function qr(t){return new this(t).atanh()}function Wr(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=ne(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ne(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ne(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(t,e,o,1)),e=ne(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(k(t,e,o,1)),n}function Xr(t){return new this(t).cbrt()}function Gr(t){return T(t=new this(t),t.e+1,2)}function jr(t,e,n){return new this(t).clamp(e,n)}function $r(t){if(!t||typeof t!="object")throw Error(Re+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,le,"rounding",0,8,"toExpNeg",-Ee,0,"toExpPos",0,Ee,"maxE",0,Ee,"minE",-Ee,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=st[n]),(r=t[n])!==void 0)if(X(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(de+n+": "+r);if(n="crypto",i&&(this[n]=st[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(Zt);else this[n]=!1;else throw Error(de+n+": "+r);return this}function zr(t){return new this(t).cos()}function Yr(t){return new this(t).cosh()}function Jt(t){var e,n,r;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,en(o)){u.s=o.s,L?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;L?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Xe(u,o.toString())}if(c==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Wt.test(o)?Xe(u,o):Vr(u,o);if(c==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Xe(u,o.toString());throw Error(de+o)}if(i.prototype=m,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=$r,i.clone=Jt,i.isDecimal=en,i.abs=Br,i.acos=Pr,i.acosh=Kr,i.add=Ur,i.asin=Hr,i.asinh=Rr,i.atan=Zr,i.atanh=qr,i.atan2=Wr,i.cbrt=Xr,i.ceil=Gr,i.clamp=jr,i.cos=zr,i.cosh=Yr,i.div=Qr,i.exp=Jr,i.floor=ei,i.hypot=ti,i.ln=ni,i.log=ri,i.log10=oi,i.log2=ii,i.max=si,i.min=ai,i.mod=ui,i.mul=ci,i.pow=li,i.random=di,i.round=fi,i.sign=hi,i.sin=mi,i.sinh=pi,i.sqrt=gi,i.sub=vi,i.sum=wi,i.tan=bi,i.tanh=Si,i.trunc=Ei,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 Qr(t,e){return new this(t).div(e)}function Jr(t){return new this(t).exp()}function ei(t){return T(t=new this(t),t.e+1,3)}function ti(){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 en(t){return t instanceof Ie||t&&t.toStringTag===qt||!1}function ni(t){return new this(t).ln()}function ri(t,e){return new this(t).log(e)}function ii(t){return new this(t).log(2)}function oi(t){return new this(t).log(10)}function si(){return $t(this,arguments,-1)}function ai(){return $t(this,arguments,1)}function ui(t,e){return new this(t).mod(e)}function ci(t,e){return new this(t).mul(e)}function li(t,e){return new this(t).pow(e)}function di(t){var e,n,r,i,o=0,s=new this(1),a=[];if(t===void 0?t=this.precision:j(t,1,le),r=Math.ceil(t/y),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]:a[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):(a.push(i%1e7),o+=4);o=r/4}else throw Error(Zt);else for(;o<r;)a[o++]=Math.random()*1e7|0;for(r=a[--o],t%=y,r&&t&&(i=U(10,y-t),a[o]=(r/i|0)*i);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=y)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<y&&(n-=y-r)}return s.e=n,s.d=a,s}function fi(t){return T(t=new this(t),t.e+1,this.rounding)}function hi(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function mi(t){return new this(t).sin()}function pi(t){return new this(t).sinh()}function gi(t){return new this(t).sqrt()}function vi(t,e){return new this(t).sub(e)}function wi(){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,T(n,this.precision,this.rounding)}function bi(t){return new this(t).tan()}function Si(t){return new this(t).tanh()}function Ei(t){return T(t=new this(t),t.e+1,1)}m[Symbol.for("nodejs.util.inspect.custom")]=m.toString,m[Symbol.toStringTag]="Decimal";var Ie=m.constructor=Jt(st);Ue=new Ie(Ue),He=new Ie(He);class me{static formatToTimecode(e,n,r=!1){let i=new Ie(n),o,s=i.round();o=i.mul(e).floor();let a,c,u,l,d=s.mul(86400),f=o.mod(d),h=s.mul(3600),v=s.mul(60);return l=f.divToInt(h),f=f.minus(l.mul(h)),u=f.divToInt(v),f=f.minus(u.mul(v)),c=f.divToInt(s),a=f.minus(c.mul(s)),me.formatTimecodeText(l.toNumber(),u.toNumber(),c.toNumber(),a.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${me.padZero(e)}:${me.padZero(n)}:${me.padZero(r)}${s}${me.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Ti{static resolveFrameRateValueFromFraction(e){return 30}}const ee=class ee{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 ee.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=Ti.resolveFrameRateValueFromFraction(n);return me.formatToTimecode(ee.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=ee.parseTimeRange(e),o=i.start?ee.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?ee.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=ee.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=ee.timeMomentToSeconds(n.start);return ee.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};E(ee,"timeRangePattern",/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/);let H=ee;class yi{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 Ci{constructor(e,n,r,i,o,s,a){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=a}}class Li{constructor(e,n){this.duration=e,this.uri=n}}class tn{constructor(){this.playlist=new yi}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 nn{static write(e){let n=`#EXTM3U
9
+ */var Ee=9e15,le=1e9,ot="0123456789abcdef",Ue="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",He="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",st={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ee,maxE:Ee,crypto:!1},Ht,ie,C=!0,Re="[DecimalError] ",de=Re+"Invalid argument: ",Rt=Re+"Precision limit exceeded",Zt=Re+"crypto unavailable",qt="[object Decimal]",X=Math.floor,U=Math.pow,Or=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,_r=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,xr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Wt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,J=1e7,y=7,Nr=9007199254740991,kr=Ue.length-1,at=He.length-1,m={toStringTag:qt};m.absoluteValue=m.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),T(t)},m.ceil=function(){return T(new this.constructor(this),this.e+1,2)},m.clampedTo=m.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(de+e);return n=r.cmp(t),n<0?t:r.cmp(e)>0?e:new i(r)},m.comparedTo=m.cmp=function(t){var e,n,r,i,o=this,s=o.d,a=(t=new o.constructor(t)).d,c=o.s,u=t.s;if(!s||!a)return!c||!u?NaN:c!==u?c:s===a?0:!s^c<0?1:-1;if(!s[0]||!a[0])return s[0]?c:a[0]?-u:0;if(c!==u)return c;if(o.e!==t.e)return o.e>t.e^c<0?1:-1;for(r=s.length,i=a.length,e=0,n=r<i?r:i;e<n;++e)if(s[e]!==a[e])return s[e]>a[e]^c<0?1:-1;return r===i?0:r>i^c<0?1:-1},m.cosine=m.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())+y,r.rounding=1,n=Dr(r,Yt(r,n)),r.precision=t,r.rounding=e,T(ie==2||ie==3?n.neg():n,t,e,!0)):new r(1):new r(NaN)},m.cubeRoot=m.cbrt=function(){var t,e,n,r,i,o,s,a,c,u,l=this,d=l.constructor;if(!l.isFinite()||l.isZero())return new d(l);for(C=!1,o=l.s*U(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=U(n,1/3),t=X((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 d(n),r.s=l.s):r=new d(o.toString()),s=(t=d.precision)+3;;)if(a=r,c=a.times(a).times(a),u=c.plus(l),r=k(u.plus(l).times(a),u.plus(c),s+2,1),Z(a.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&&(T(a,t+1,0),a.times(a).times(a).eq(l))){r=a;break}s+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(T(r,t+1,1),e=!r.times(r).times(r).eq(l));break}return C=!0,T(r,t,d.rounding,e)},m.decimalPlaces=m.dp=function(){var t,e=this.d,n=NaN;if(e){if(t=e.length-1,n=(t-X(this.e/y))*y,t=e[t],t)for(;t%10==0;t/=10)n--;n<0&&(n=0)}return n},m.dividedBy=m.div=function(t){return k(this,new this.constructor(t))},m.dividedToIntegerBy=m.divToInt=function(t){var e=this,n=e.constructor;return T(k(e,new n(t),0,1,1),n.precision,n.rounding)},m.equals=m.eq=function(t){return this.cmp(t)===0},m.floor=function(){return T(new this.constructor(this),this.e+1,3)},m.greaterThan=m.gt=function(t){return this.cmp(t)>0},m.greaterThanOrEqualTo=m.gte=function(t){var e=this.cmp(t);return e==1||e===0},m.hyperbolicCosine=m.cosh=function(){var t,e,n,r,i,o=this,s=o.constructor,a=new s(1);if(!o.isFinite())return new s(o.s?1/0:NaN);if(o.isZero())return a;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/Ge(4,t)).toString()):(t=16,e="2.3283064365386962890625e-10"),o=Te(s,1,o.times(e),new s(1),!0);for(var c,u=t,l=new s(8);u--;)c=o.times(o),o=a.minus(c.times(l.minus(c.times(l))));return T(o,s.precision=n,s.rounding=r,!0)},m.hyperbolicSine=m.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=Te(o,2,i,i,!0);else{t=1.4*Math.sqrt(r),t=t>16?16:t|0,i=i.times(1/Ge(5,t)),i=Te(o,2,i,i,!0);for(var s,a=new o(5),c=new o(16),u=new o(20);t--;)s=i.times(i),i=i.times(a.plus(s.times(c.times(s).plus(u))))}return o.precision=e,o.rounding=n,T(i,e,n,!0)},m.hyperbolicTangent=m.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,k(n.sinh(),n.cosh(),r.precision=t,r.rounding=e)):new r(n.s)},m.inverseCosine=m.acos=function(){var t=this,e=t.constructor,n=t.abs().cmp(1),r=e.precision,i=e.rounding;return n!==-1?n===0?t.isNeg()?ne(e,r,i):new e(0):new e(NaN):t.isZero()?ne(e,r+4,i).times(.5):(e.precision=r+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=r,e.rounding=i,t.times(2))},m.inverseHyperbolicCosine=m.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,C=!1,n=n.times(n).minus(1).sqrt().plus(n),C=!0,r.precision=t,r.rounding=e,n.ln()):new r(n)},m.inverseHyperbolicSine=m.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,C=!1,n=n.times(n).plus(1).sqrt().plus(n),C=!0,r.precision=t,r.rounding=e,n.ln())},m.inverseHyperbolicTangent=m.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?T(new o(i),t,e,!0):(o.precision=n=r-i.e,i=k(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)},m.inverseSine=m.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=ne(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)))},m.inverseTangent=m.atan=function(){var t,e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding;if(u.isFinite()){if(u.isZero())return new l(u);if(u.abs().eq(1)&&d+4<=at)return s=ne(l,d+4,f).times(.25),s.s=u.s,s}else{if(!u.s)return new l(NaN);if(d+4<=at)return s=ne(l,d+4,f).times(.5),s.s=u.s,s}for(l.precision=a=d+10,l.rounding=1,n=Math.min(28,a/y+2|0),t=n;t;--t)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(C=!1,e=Math.ceil(a/y),r=1,c=u.times(u),s=new l(u),i=u;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)),C=!0,T(s,l.precision=d,l.rounding=f,!0)},m.isFinite=function(){return!!this.d},m.isInteger=m.isInt=function(){return!!this.d&&X(this.e/y)>this.d.length-2},m.isNaN=function(){return!this.s},m.isNegative=m.isNeg=function(){return this.s<0},m.isPositive=m.isPos=function(){return this.s>0},m.isZero=function(){return!!this.d&&this.d[0]===0},m.lessThan=m.lt=function(t){return this.cmp(t)<0},m.lessThanOrEqualTo=m.lte=function(t){return this.cmp(t)<1},m.logarithm=m.log=function(t){var e,n,r,i,o,s,a,c,u=this,l=u.constructor,d=l.precision,f=l.rounding,h=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=u.d,u.s<0||!n||!n[0]||u.eq(1))return new l(n&&!n[0]?-1/0:u.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(C=!1,a=d+h,s=he(u,a),r=e?We(l,a+10):he(t,a),c=k(s,r,a,1),Ae(c.d,i=d,f))do if(a+=10,s=he(u,a),r=e?We(l,a+10):he(t,a),c=k(s,r,a,1),!o){+Z(c.d).slice(i+1,i+15)+1==1e14&&(c=T(c,d+1,0));break}while(Ae(c.d,i+=10,f));return C=!0,T(c,d,f)},m.minus=m.sub=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,w=h.constructor;if(t=new w(t),!h.d||!t.d)return!h.s||!t.s?t=new w(NaN):h.d?t.s=-t.s:t=new w(t.d||h.s!==t.s?h:NaN),t;if(h.s!=t.s)return t.s=-t.s,h.plus(t);if(u=h.d,f=t.d,a=w.precision,c=w.rounding,!u[0]||!f[0]){if(f[0])t.s=-t.s;else if(u[0])t=new w(h);else return new w(c===3?-0:0);return C?T(t,a,c):t}if(n=X(t.e/y),l=X(h.e/y),u=u.slice(),o=l-n,o){for(d=o<0,d?(e=u,o=-o,s=f.length):(e=f,n=l,s=u.length),r=Math.max(Math.ceil(a/y),s)+2,o>r&&(o=r,e.length=1),e.reverse(),r=o;r--;)e.push(0);e.reverse()}else{for(r=u.length,s=f.length,d=r<s,d&&(s=r),r=0;r<s;r++)if(u[r]!=f[r]){d=u[r]<f[r];break}o=0}for(d&&(e=u,u=f,f=e,t.s=-t.s),s=u.length,r=f.length-s;r>0;--r)u[s++]=0;for(r=f.length;r>o;){if(u[--r]<f[r]){for(i=r;i&&u[--i]===0;)u[i]=J-1;--u[i],u[r]+=J}u[r]-=f[r]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=qe(u,n),C?T(t,a,c):t):new w(c===3?-0:0)},m.modulo=m.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]?T(new r(n),r.precision,r.rounding):(C=!1,r.modulo==9?(e=k(n,t.abs(),0,3,1),e.s*=t.s):e=k(n,t,0,r.modulo,1),e=e.times(t),C=!0,n.minus(e))},m.naturalExponential=m.exp=function(){return ut(this)},m.naturalLogarithm=m.ln=function(){return he(this)},m.negated=m.neg=function(){var t=new this.constructor(this);return t.s=-t.s,T(t)},m.plus=m.add=function(t){var e,n,r,i,o,s,a,c,u,l,d=this,f=d.constructor;if(t=new f(t),!d.d||!t.d)return!d.s||!t.s?t=new f(NaN):d.d||(t=new f(t.d||d.s===t.s?d:NaN)),t;if(d.s!=t.s)return t.s=-t.s,d.minus(t);if(u=d.d,l=t.d,a=f.precision,c=f.rounding,!u[0]||!l[0])return l[0]||(t=new f(d)),C?T(t,a,c):t;if(o=X(d.e/y),r=X(t.e/y),u=u.slice(),i=o-r,i){for(i<0?(n=u,i=-i,s=l.length):(n=l,r=o,s=u.length),o=Math.ceil(a/y),s=o>s?o+1:s+1,i>s&&(i=s,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(s=u.length,i=l.length,s-i<0&&(i=s,n=l,l=u,u=n),e=0;i;)e=(u[--i]=u[i]+l[i]+e)/J|0,u[i]%=J;for(e&&(u.unshift(e),++r),s=u.length;u[--s]==0;)u.pop();return t.d=u,t.e=qe(u,r),C?T(t,a,c):t},m.precision=m.sd=function(t){var e,n=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(de+t);return n.d?(e=Xt(n.d),t&&n.e+1>e&&(e=n.e+1)):e=NaN,e},m.round=function(){var t=this,e=t.constructor;return T(new e(t),t.e+1,e.rounding)},m.sine=m.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())+y,r.rounding=1,n=Vr(r,Yt(r,n)),r.precision=t,r.rounding=e,T(ie>2?n.neg():n,t,e,!0)):new r(NaN)},m.squareRoot=m.sqrt=function(){var t,e,n,r,i,o,s=this,a=s.d,c=s.e,u=s.s,l=s.constructor;if(u!==1||!a||!a[0])return new l(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);for(C=!1,u=Math.sqrt(+s),u==0||u==1/0?(e=Z(a),(e.length+c)%2==0&&(e+="0"),u=Math.sqrt(e),c=X((c+1)/2)-(c<0||c%2),u==1/0?e="5e"+c:(e=u.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),r=new l(e)):r=new l(u.toString()),n=(c=l.precision)+3;;)if(o=r,r=o.plus(k(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&&(T(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")&&(T(r,c+1,1),t=!r.times(r).eq(s));break}return C=!0,T(r,c,l.rounding,t)},m.tangent=m.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=k(n,new r(1).minus(n.times(n)).sqrt(),t+10,0),r.precision=t,r.rounding=e,T(ie==2||ie==4?n.neg():n,t,e,!0)):new r(NaN)},m.times=m.mul=function(t){var e,n,r,i,o,s,a,c,u,l=this,d=l.constructor,f=l.d,h=(t=new d(t)).d;if(t.s*=l.s,!f||!f[0]||!h||!h[0])return new d(!t.s||f&&!f[0]&&!h||h&&!h[0]&&!f?NaN:!f||!h?t.s/0:t.s*0);for(n=X(l.e/y)+X(t.e/y),c=f.length,u=h.length,c<u&&(o=f,f=h,h=o,s=c,c=u,u=s),o=[],s=c+u,r=s;r--;)o.push(0);for(r=u;--r>=0;){for(e=0,i=c+r;i>r;)a=o[i]+h[r]*f[i-r-1]+e,o[i--]=a%J|0,e=a/J|0;o[i]=(o[i]+e)%J|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=qe(o,n),C?T(t,d.precision,d.rounding):t},m.toBinary=function(t,e){return ct(this,2,t,e)},m.toDecimalPlaces=m.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),T(n,t+n.e+1,e))},m.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=te(r,!0):(j(t,0,le),e===void 0?e=i.rounding:j(e,0,8),r=T(new i(r),t+1,e),n=te(r,!0,t+1)),r.isNeg()&&!r.isZero()?"-"+n:n},m.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?n=te(i):(j(t,0,le),e===void 0?e=o.rounding:j(e,0,8),r=T(new o(i),t+i.e+1,e),n=te(r,!1,t+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},m.toFraction=function(t){var e,n,r,i,o,s,a,c,u,l,d,f,h=this,w=h.d,v=h.constructor;if(!w)return new v(h);if(u=n=new v(1),r=c=new v(0),e=new v(r),o=e.e=Xt(w)-h.e-1,s=o%y,e.d[0]=U(10,s<0?y+s:s),t==null)t=o>0?e:u;else{if(a=new v(t),!a.isInt()||a.lt(u))throw Error(de+a);t=a.gt(e)?o>0?e:u:a}for(C=!1,a=new v(Z(w)),l=v.precision,v.precision=o=w.length*y*2;d=k(a,e,0,1,1),i=n.plus(d.times(r)),i.cmp(t)!=1;)n=r,r=i,i=u,u=c.plus(d.times(i)),c=i,i=e,e=a.minus(d.times(i)),a=i;return i=k(t.minus(n),r,0,1,1),c=c.plus(i.times(u)),n=n.plus(i.times(r)),c.s=u.s=h.s,f=k(u,r,o,1).minus(h).abs().cmp(k(c,n,o,1).minus(h).abs())<1?[u,r]:[c,n],v.precision=l,C=!0,f},m.toHexadecimal=m.toHex=function(t,e){return ct(this,16,t,e)},m.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]?(C=!1,n=k(n,t,0,e,1).times(t),C=!0,T(n)):(t.s=n.s,n=t),n},m.toNumber=function(){return+this},m.toOctal=function(t,e){return ct(this,8,t,e)},m.toPower=m.pow=function(t){var e,n,r,i,o,s,a=this,c=a.constructor,u=+(t=new c(t));if(!a.d||!t.d||!a.d[0]||!t.d[0])return new c(U(+a,u));if(a=new c(a),a.eq(1))return a;if(r=c.precision,o=c.rounding,t.eq(1))return T(a,r,o);if(e=X(t.e/y),e>=t.d.length-1&&(n=u<0?-u:u)<=Nr)return i=Gt(c,a,n,r),t.s<0?new c(1).div(i):T(i,r,o);if(s=a.s,s<0){if(e<t.d.length-1)return new c(NaN);if((t.d[e]&1)==0&&(s=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=s,a}return n=U(+a,u),e=n==0||!isFinite(n)?X(u*(Math.log("0."+Z(a.d))/Math.LN10+a.e+1)):new c(n+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?s/0:0):(C=!1,c.rounding=a.s=1,n=Math.min(12,(e+"").length),i=ut(t.times(he(a,r+n)),r),i.d&&(i=T(i,r+5,1),Ae(i.d,r,o)&&(e=r+10,i=T(ut(t.times(he(a,e+n)),e),e+5,1),+Z(i.d).slice(r+1,r+15)+1==1e14&&(i=T(i,r+1,0)))),i.s=s,C=!0,c.rounding=o,T(i,r,o))},m.toPrecision=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=te(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(j(t,1,le),e===void 0?e=i.rounding:j(e,0,8),r=T(new i(r),t,e),n=te(r,t<=r.e||r.e<=i.toExpNeg,t)),r.isNeg()&&!r.isZero()?"-"+n:n},m.toSignificantDigits=m.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)),T(new r(n),t,e)},m.toString=function(){var t=this,e=t.constructor,n=te(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+n:n},m.truncated=m.trunc=function(){return T(new this.constructor(this),this.e+1,1)},m.valueOf=m.toJSON=function(){var t=this,e=t.constructor,n=te(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=y-r.length,n&&(o+=fe(n)),o+=r;s=t[e],r=s+"",n=y-r.length,n&&(o+=fe(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(de+t)}function Ae(t,e,n,r){var i,o,s,a;for(o=t[0];o>=10;o/=10)--e;return--e<0?(e+=y,i=0):(i=Math.ceil((e+1)/y),e%=y),o=U(10,y-e),a=t[i]%o|0,r==null?e<3?(e==0?a=a/100|0:e==1&&(a=a/10|0),s=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):s=(n<4&&a+1==o||n>3&&a+1==o/2)&&(t[i+1]/o/100|0)==U(10,e-2)-1||(a==o/2||a==0)&&(t[i+1]/o/100|0)==0:e<4?(e==0?a=a/1e3|0:e==1?a=a/100|0:e==2&&(a=a/10|0),s=(r||n<4)&&a==9999||!r&&n>3&&a==4999):s=((r||n<4)&&a+1==o||!r&&n>3&&a+1==o/2)&&(t[i+1]/o/1e3|0)==U(10,e-3)-1,s}function Ze(t,e,n){for(var r,i=[0],o,s=0,a=t.length;s<a;){for(o=i.length;o--;)i[o]*=e;for(i[0]+=ot.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 Dr(t,e){var n,r,i;if(e.isZero())return e;r=e.d.length,r<32?(n=Math.ceil(r/3),i=(1/Ge(4,n)).toString()):(n=16,i="2.3283064365386962890625e-10"),t.precision+=n,e=Te(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 k=function(){function t(r,i,o){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*i+a,r[c]=s%o|0,a=s/o|0;return a&&r.unshift(a),r}function e(r,i,o,s){var a,c;if(o!=s)c=o>s?1:-1;else for(a=c=0;a<o;a++)if(r[a]!=i[a]){c=r[a]>i[a]?1:-1;break}return c}function n(r,i,o,s){for(var a=0;o--;)r[o]-=a,a=r[o]<i[o]?1:0,r[o]=a*s+r[o]-i[o];for(;!r[0]&&r.length>1;)r.shift()}return function(r,i,o,s,a,c){var u,l,d,f,h,w,v,M,A,B,O,V,q,_,re,ve,z,ye,R,oe,se=r.constructor,Ce=r.s==i.s?1:-1,P=r.d,N=i.d;if(!P||!P[0]||!N||!N[0])return new se(!r.s||!i.s||(P?N&&P[0]==N[0]:!N)?NaN:P&&P[0]==0||!N?Ce*0:Ce/0);for(c?(h=1,l=r.e-i.e):(c=J,h=y,l=X(r.e/h)-X(i.e/h)),R=N.length,z=P.length,A=new se(Ce),B=A.d=[],d=0;N[d]==(P[d]||0);d++);if(N[d]>(P[d]||0)&&l--,o==null?(_=o=se.precision,s=se.rounding):a?_=o+(r.e-i.e)+1:_=o,_<0)B.push(1),w=!0;else{if(_=_/h+2|0,d=0,R==1){for(f=0,N=N[0],_++;(d<z||f)&&_--;d++)re=f*c+(P[d]||0),B[d]=re/N|0,f=re%N|0;w=f||d<z}else{for(f=c/(N[0]+1)|0,f>1&&(N=t(N,f,c),P=t(P,f,c),R=N.length,z=P.length),ve=R,O=P.slice(0,R),V=O.length;V<R;)O[V++]=0;oe=N.slice(),oe.unshift(0),ye=N[0],N[1]>=c/2&&++ye;do f=0,u=e(N,O,R,V),u<0?(q=O[0],R!=V&&(q=q*c+(O[1]||0)),f=q/ye|0,f>1?(f>=c&&(f=c-1),v=t(N,f,c),M=v.length,V=O.length,u=e(v,O,M,V),u==1&&(f--,n(v,R<M?oe:N,M,c))):(f==0&&(u=f=1),v=N.slice()),M=v.length,M<V&&v.unshift(0),n(O,v,V,c),u==-1&&(V=O.length,u=e(N,O,R,V),u<1&&(f++,n(O,R<V?oe:N,V,c))),V=O.length):u===0&&(f++,O=[0]),B[d++]=f,u&&O[0]?O[V++]=P[ve]||0:(O=[P[ve]],V=1);while((ve++<z||O[0]!==void 0)&&_--);w=O[0]!==void 0}B[0]||B.shift()}if(h==1)A.e=l,Ht=w;else{for(d=1,f=B[0];f>=10;f/=10)d++;A.e=d+l*h-1,T(A,a?o+A.e+1:o,s,w)}return A}}();function T(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor;e:if(e!=null){if(d=t.d,!d)return t;for(i=1,a=d[0];a>=10;a/=10)i++;if(o=e-i,o<0)o+=y,s=e,l=d[f=0],c=l/U(10,i-s-1)%10|0;else if(f=Math.ceil((o+1)/y),a=d.length,f>=a)if(r){for(;a++<=f;)d.push(0);l=c=0,i=1,o%=y,s=o-y+1}else break e;else{for(l=a=d[f],i=1;a>=10;a/=10)i++;o%=y,s=o-y+i,c=s<0?0:l/U(10,i-s-1)%10|0}if(r=r||e<0||d[f+1]!==void 0||(s<0?l:l%U(10,i-s-1)),u=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/U(10,i-s):0:d[f-1])%10&1||n==(t.s<0?8:7)),e<1||!d[0])return d.length=0,u?(e-=t.e+1,d[0]=U(10,(y-e%y)%y),t.e=-e||0):d[0]=t.e=0,t;if(o==0?(d.length=f,a=1,f--):(d.length=f+1,a=U(10,y-o),d[f]=s>0?(l/U(10,i-s)%U(10,s)|0)*a:0),u)for(;;)if(f==0){for(o=1,s=d[0];s>=10;s/=10)o++;for(s=d[0]+=a,a=1;s>=10;s/=10)a++;o!=a&&(t.e++,d[0]==J&&(d[0]=1));break}else{if(d[f]+=a,d[f]!=J)break;d[f--]=0,a=1}for(o=d.length;d[--o]===0;)d.pop()}return C&&(t.e>h.maxE?(t.d=null,t.e=NaN):t.e<h.minE&&(t.e=0,t.d=[0])),t}function te(t,e,n){if(!t.isFinite())return zt(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)+fe(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(t.e<0?"e":"e+")+t.e):i<0?(o="0."+fe(-i-1)+o,n&&(r=n-s)>0&&(o+=fe(r))):i>=s?(o+=fe(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+fe(r))):((r=i+1)<s&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-s)>0&&(i+1===s&&(o+="."),o+=fe(r))),o}function qe(t,e){var n=t[0];for(e*=y;n>=10;n/=10)e++;return e}function We(t,e,n){if(e>kr)throw C=!0,n&&(t.precision=n),Error(Rt);return T(new t(Ue),e,1,!0)}function ne(t,e,n){if(e>at)throw Error(Rt);return T(new t(He),e,n,!0)}function Xt(t){var e=t.length-1,n=e*y+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 fe(t){for(var e="";t--;)e+="0";return e}function Gt(t,e,n,r){var i,o=new t(1),s=Math.ceil(r/y+4);for(C=!1;;){if(n%2&&(o=o.times(e),Qt(o.d,s)&&(i=!0)),n=X(n/2),n===0){n=o.d.length-1,i&&o.d[n]===0&&++o.d[n];break}e=e.times(e),Qt(e.d,s)}return C=!0,o}function jt(t){return t.d[t.d.length-1]&1}function $t(t,e,n){for(var r,i,o=new t(e[0]),s=0;++s<e.length;){if(i=new t(e[s]),!i.s){o=i;break}r=o.cmp(i),(r===n||r===0&&o.s===n)&&(o=i)}return o}function ut(t,e){var n,r,i,o,s,a,c,u=0,l=0,d=0,f=t.constructor,h=f.rounding,w=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(e==null?(C=!1,c=w):c=e,a=new f(.03125);t.e>-2;)t=t.times(a),d+=5;for(r=Math.log(U(2,d))/Math.LN10*2+5|0,c+=r,n=o=s=new f(1),f.precision=c;;){if(o=T(o.times(t),c,1),n=n.times(++l),a=s.plus(k(o,n,c,1)),Z(a.d).slice(0,c)===Z(s.d).slice(0,c)){for(i=d;i--;)s=T(s.times(s),c,1);if(e==null)if(u<3&&Ae(s.d,c-r,h,u))f.precision=c+=10,n=o=a=new f(1),l=0,u++;else return T(s,f.precision=w,h,C=!0);else return f.precision=w,s}s=a}}function he(t,e){var n,r,i,o,s,a,c,u,l,d,f,h=1,w=10,v=t,M=v.d,A=v.constructor,B=A.rounding,O=A.precision;if(v.s<0||!M||!M[0]||!v.e&&M[0]==1&&M.length==1)return new A(M&&!M[0]?-1/0:v.s!=1?NaN:M?0:v);if(e==null?(C=!1,l=O):l=e,A.precision=l+=w,n=Z(M),r=n.charAt(0),Math.abs(o=v.e)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)v=v.times(t),n=Z(v.d),r=n.charAt(0),h++;o=v.e,r>1?(v=new A("0."+n),o++):v=new A(r+"."+n.slice(1))}else return u=We(A,l+2,O).times(o+""),v=he(new A(r+"."+n.slice(1)),l-w).plus(u),A.precision=O,e==null?T(v,O,B,C=!0):v;for(d=v,c=s=v=k(v.minus(1),v.plus(1),l,1),f=T(v.times(v),l,1),i=3;;){if(s=T(s.times(f),l,1),u=c.plus(k(s,new A(i),l,1)),Z(u.d).slice(0,l)===Z(c.d).slice(0,l))if(c=c.times(2),o!==0&&(c=c.plus(We(A,l+2,O).times(o+""))),c=k(c,new A(h),l,1),e==null)if(Ae(c.d,l-w,B,a))A.precision=l+=w,u=s=v=k(d.minus(1),d.plus(1),l,1),f=T(v.times(v),l,1),i=a=1;else return T(c,A.precision=O,B,C=!0);else return A.precision=O,c;c=u,i+=2}}function zt(t){return String(t.s*t.s/0)}function Xe(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)%y,n<0&&(r+=y),r<i){for(r&&t.d.push(+e.slice(0,r)),i-=y;r<i;)t.d.push(+e.slice(r,r+=y));e=e.slice(r),r=y-e.length}else r-=i;for(;r--;)e+="0";t.d.push(+e),C&&(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 Fr(t,e){var n,r,i,o,s,a,c,u,l;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Wt.test(e))return Xe(t,e)}else if(e==="Infinity"||e==="NaN")return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(_r.test(e))n=16,e=e.toLowerCase();else if(Or.test(e))n=2;else if(xr.test(e))n=8;else throw Error(de+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(".",""),a=e.length,o=a-o,i=Gt(r,new r(n),o,o*2)),u=Ze(e,n,J),l=u.length-1,o=l;u[o]===0;--o)u.pop();return o<0?new r(t.s*0):(t.e=qe(u,l),t.d=u,C=!1,s&&(t=k(t,i,a*4)),c&&(t=t.times(Math.abs(c)<54?U(2,c):Ie.pow(2,c))),C=!0,t)}function Vr(t,e){var n,r=e.d.length;if(r<3)return e.isZero()?e:Te(t,2,e,e);n=1.4*Math.sqrt(r),n=n>16?16:n|0,e=e.times(1/Ge(5,n)),e=Te(t,2,e,e);for(var i,o=new t(5),s=new t(16),a=new t(20);n--;)i=e.times(e),e=e.times(o.plus(i.times(s.times(i).minus(a))));return e}function Te(t,e,n,r,i){var o,s,a,c,u=t.precision,l=Math.ceil(u/y);for(C=!1,c=n.times(n),a=new t(r);;){if(s=k(a.times(c),new t(e++*e++),u,1),a=i?r.plus(s):r.minus(s),r=k(s.times(c),new t(e++*e++),u,1),s=a.plus(r),s.d[l]!==void 0){for(o=l;s.d[o]===a.d[o]&&o--;);if(o==-1)break}o=a,a=r,r=s,s=o}return C=!0,s.d.length=l+1,s}function Ge(t,e){for(var n=t;--e;)n*=t;return n}function Yt(t,e){var n,r=e.s<0,i=ne(t,t.precision,1),o=i.times(.5);if(e=e.abs(),e.lte(o))return ie=r?4:1,e;if(n=e.divToInt(i),n.isZero())ie=r?3:2;else{if(e=e.minus(n.times(i)),e.lte(o))return ie=jt(n)?r?2:3:r?4:1,e;ie=jt(n)?r?1:4:r?3:2}return e.minus(i).abs()}function ct(t,e,n,r){var i,o,s,a,c,u,l,d,f,h=t.constructor,w=n!==void 0;if(w?(j(n,1,le),r===void 0?r=h.rounding:j(r,0,8)):(n=h.precision,r=h.rounding),!t.isFinite())l=zt(t);else{for(l=te(t),s=l.indexOf("."),w?(i=2,e==16?n=n*4-3:e==8&&(n=n*3-2)):i=e,s>=0&&(l=l.replace(".",""),f=new h(1),f.e=l.length-s,f.d=Ze(te(f),10,i),f.e=f.d.length),d=Ze(l,10,i),o=c=d.length;d[--c]==0;)d.pop();if(!d[0])l=w?"0p+0":"0";else{if(s<0?o--:(t=new h(t),t.d=d,t.e=o,t=k(t,f,n,r,0,i),d=t.d,o=t.e,u=Ht),s=d[n],a=i/2,u=u||d[n+1]!==void 0,u=r<4?(s!==void 0||u)&&(r===0||r===(t.s<0?3:2)):s>a||s===a&&(r===4||u||r===6&&d[n-1]&1||r===(t.s<0?8:7)),d.length=n,u)for(;++d[--n]>i-1;)d[n]=0,n||(++o,d.unshift(1));for(c=d.length;!d[c-1];--c);for(s=0,l="";s<c;s++)l+=ot.charAt(d[s]);if(w){if(c>1)if(e==16||e==8){for(s=e==16?4:3,--c;c%s;c++)l+="0";for(d=Ze(l,i,e),c=d.length;!d[c-1];--c);for(s=1,l="1.";s<c;s++)l+=ot.charAt(d[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 Qt(t,e){if(t.length>e)return t.length=e,!0}function Br(t){return new this(t).abs()}function Pr(t){return new this(t).acos()}function Kr(t){return new this(t).acosh()}function Ur(t,e){return new this(t).plus(e)}function Hr(t){return new this(t).asin()}function Rr(t){return new this(t).asinh()}function Zr(t){return new this(t).atan()}function qr(t){return new this(t).atanh()}function Wr(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=ne(this,o,1).times(e.s>0?.25:.75),n.s=t.s):!e.d||t.isZero()?(n=e.s<0?ne(this,r,i):new this(0),n.s=t.s):!t.d||e.isZero()?(n=ne(this,o,1).times(.5),n.s=t.s):e.s<0?(this.precision=o,this.rounding=1,n=this.atan(k(t,e,o,1)),e=ne(this,o,1),this.precision=r,this.rounding=i,n=t.s<0?n.minus(e):n.plus(e)):n=this.atan(k(t,e,o,1)),n}function Xr(t){return new this(t).cbrt()}function Gr(t){return T(t=new this(t),t.e+1,2)}function jr(t,e,n){return new this(t).clamp(e,n)}function $r(t){if(!t||typeof t!="object")throw Error(Re+"Object expected");var e,n,r,i=t.defaults===!0,o=["precision",1,le,"rounding",0,8,"toExpNeg",-Ee,0,"toExpPos",0,Ee,"maxE",0,Ee,"minE",-Ee,0,"modulo",0,9];for(e=0;e<o.length;e+=3)if(n=o[e],i&&(this[n]=st[n]),(r=t[n])!==void 0)if(X(r)===r&&r>=o[e+1]&&r<=o[e+2])this[n]=r;else throw Error(de+n+": "+r);if(n="crypto",i&&(this[n]=st[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(Zt);else this[n]=!1;else throw Error(de+n+": "+r);return this}function zr(t){return new this(t).cos()}function Yr(t){return new this(t).cosh()}function Jt(t){var e,n,r;function i(o){var s,a,c,u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,en(o)){u.s=o.s,C?!o.d||o.e>i.maxE?(u.e=NaN,u.d=null):o.e<i.minE?(u.e=0,u.d=[0]):(u.e=o.e,u.d=o.d.slice()):(u.e=o.e,u.d=o.d?o.d.slice():o.d);return}if(c=typeof o,c==="number"){if(o===0){u.s=1/o<0?-1:1,u.e=0,u.d=[0];return}if(o<0?(o=-o,u.s=-1):u.s=1,o===~~o&&o<1e7){for(s=0,a=o;a>=10;a/=10)s++;C?s>i.maxE?(u.e=NaN,u.d=null):s<i.minE?(u.e=0,u.d=[0]):(u.e=s,u.d=[o]):(u.e=s,u.d=[o]);return}if(o*0!==0){o||(u.s=NaN),u.e=NaN,u.d=null;return}return Xe(u,o.toString())}if(c==="string")return(a=o.charCodeAt(0))===45?(o=o.slice(1),u.s=-1):(a===43&&(o=o.slice(1)),u.s=1),Wt.test(o)?Xe(u,o):Fr(u,o);if(c==="bigint")return o<0?(o=-o,u.s=-1):u.s=1,Xe(u,o.toString());throw Error(de+o)}if(i.prototype=m,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=$r,i.clone=Jt,i.isDecimal=en,i.abs=Br,i.acos=Pr,i.acosh=Kr,i.add=Ur,i.asin=Hr,i.asinh=Rr,i.atan=Zr,i.atanh=qr,i.atan2=Wr,i.cbrt=Xr,i.ceil=Gr,i.clamp=jr,i.cos=zr,i.cosh=Yr,i.div=Qr,i.exp=Jr,i.floor=ei,i.hypot=ti,i.ln=ni,i.log=ri,i.log10=oi,i.log2=ii,i.max=si,i.min=ai,i.mod=ui,i.mul=ci,i.pow=li,i.random=di,i.round=fi,i.sign=hi,i.sin=mi,i.sinh=pi,i.sqrt=gi,i.sub=vi,i.sum=wi,i.tan=bi,i.tanh=Si,i.trunc=Ei,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 Qr(t,e){return new this(t).div(e)}function Jr(t){return new this(t).exp()}function ei(t){return T(t=new this(t),t.e+1,3)}function ti(){var t,e,n=new this(0);for(C=!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 C=!0,new this(1/0);n=e}return C=!0,n.sqrt()}function en(t){return t instanceof Ie||t&&t.toStringTag===qt||!1}function ni(t){return new this(t).ln()}function ri(t,e){return new this(t).log(e)}function ii(t){return new this(t).log(2)}function oi(t){return new this(t).log(10)}function si(){return $t(this,arguments,-1)}function ai(){return $t(this,arguments,1)}function ui(t,e){return new this(t).mod(e)}function ci(t,e){return new this(t).mul(e)}function li(t,e){return new this(t).pow(e)}function di(t){var e,n,r,i,o=0,s=new this(1),a=[];if(t===void 0?t=this.precision:j(t,1,le),r=Math.ceil(t/y),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]:a[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):(a.push(i%1e7),o+=4);o=r/4}else throw Error(Zt);else for(;o<r;)a[o++]=Math.random()*1e7|0;for(r=a[--o],t%=y,r&&t&&(i=U(10,y-t),a[o]=(r/i|0)*i);a[o]===0;o--)a.pop();if(o<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=y)a.shift();for(r=1,i=a[0];i>=10;i/=10)r++;r<y&&(n-=y-r)}return s.e=n,s.d=a,s}function fi(t){return T(t=new this(t),t.e+1,this.rounding)}function hi(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function mi(t){return new this(t).sin()}function pi(t){return new this(t).sinh()}function gi(t){return new this(t).sqrt()}function vi(t,e){return new this(t).sub(e)}function wi(){var t=0,e=arguments,n=new this(e[t]);for(C=!1;n.s&&++t<e.length;)n=n.plus(e[t]);return C=!0,T(n,this.precision,this.rounding)}function bi(t){return new this(t).tan()}function Si(t){return new this(t).tanh()}function Ei(t){return T(t=new this(t),t.e+1,1)}m[Symbol.for("nodejs.util.inspect.custom")]=m.toString,m[Symbol.toStringTag]="Decimal";var Ie=m.constructor=Jt(st);Ue=new Ie(Ue),He=new Ie(He);class me{static formatToTimecode(e,n,r=!1){let i=new Ie(n),o,s=i.round();o=i.mul(e).floor();let a,c,u,l,d=s.mul(86400),f=o.mod(d),h=s.mul(3600),w=s.mul(60);return l=f.divToInt(h),f=f.minus(l.mul(h)),u=f.divToInt(w),f=f.minus(u.mul(w)),c=f.divToInt(s),a=f.minus(c.mul(s)),me.formatTimecodeText(l.toNumber(),u.toNumber(),c.toNumber(),a.toNumber(),r)}static formatTimecodeText(e,n,r,i,o=!1){let s=o?".":":";return`${me.padZero(e)}:${me.padZero(n)}:${me.padZero(r)}${s}${me.padZero(i)}`}static padZero(e){return e<10?`0${e}`:`${e}`}}class Ti{static resolveFrameRateValueFromFraction(e){return 30}}const ee=class ee{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 ee.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=Ti.resolveFrameRateValueFromFraction(n);return me.formatToTimecode(ee.timeMomentToSeconds(e),i,r)}static formatTimerangeToTimecodeText(e,n,r=!1){let i=ee.parseTimeRange(e),o=i.start?ee.formatTimeMomentToTimecodeText(i.start,n,r):"?",s=i.end?ee.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=ee.parseTimeRange(e);if(n.start===void 0||n.end===void 0)return 1/0;{let r=ee.timeMomentToSeconds(n.start);return ee.timeMomentToSeconds(n.end)-r}}static padZero(e){return e<10?`0${e}`:`${e}`}};E(ee,"timeRangePattern",/^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$/);let H=ee;class yi{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 Ci{constructor(e,n,r,i,o,s,a){this.type=e,this.groupId=n,this.name=r,this.isDefault=i,this.autoSelect=o,this.channels=s,this.uri=a}}class Li{constructor(e,n){this.duration=e,this.uri=n}}class tn{constructor(){this.playlist=new yi}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 nn{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}
@@ -21,7 +21,7 @@ ${r.uri}`),n+=`
21
21
  `),n+=`#EXTINF:${r.duration},
22
22
  ${r.uri}
23
23
  `}),e.endList&&(n+=`#EXT-X-ENDLIST
24
- `),n}}function Mi(t,e){if(!t.some(l=>{var d;return l.streamInfo||((d=l.mediaInfo)==null?void 0:d.type)==="AUDIO"}))throw new Error("Can't create an hls manifest without audio or video source");const r=new tn().setVersion(10).setIndependentSegments(e.independentSegments);let i=t.some(({streamInfo:l,mediaInfo:d})=>l&&!d),o=!1;for(let l=0;l<t.length;l++){const{segments:d,metadata:f,streamInfo:h,mediaInfo:v}=t[l];let w=f.targetDuration;w===void 0&&(w=Math.max(...d.map(q=>q.duration),1));const C=new tn().setVersion(f.version??3).setIndependentSegments(f.independentSegments??!0).setTargetDuration(Math.ceil(w));f.programDateTime&&C.setProgramDateTime(f.programDateTime),f.playlistType&&C.setPlaylistType(f.playlistType),d.forEach(q=>C.addSegment(q,q.uri==="http://byomakase.org/non-playable-gap")),C.setEndList();const A=C.build(),B=nn.write(A),O=new Blob([B],{type:"application/vnd.apple.mpegurl"}),F=URL.createObjectURL(O);if(h&&!v){const q=new lt(h.bandwidth,h.averageBandwidth,h.resolution,h.frameRate,F);r.addStreamInfo(q)}else if(v){const q=new Ci(v.type,v.groupId??v.type.toLowerCase(),v.name??"",v.isDefault,v.autoSelect,v.channels,F);if(r.addMedia(q),!i&&v.type==="AUDIO"&&!o){const _=new lt((h==null?void 0:h.bandwidth)??0,(h==null?void 0:h.averageBandwidth)??0,null,null,F);r.addStreamInfo(_),o=!0}}}const s=r.build(),a=nn.write(s),c=new Blob([a],{type:"application/vnd.apple.mpegurl"});return URL.createObjectURL(c)}function Ai(t){return t===void 0?t:t.flatMap((e,n)=>{var a;if(t.length-1===n)return[e];const r=t.at(n+1),i=H.timeMomentToSeconds(H.parseTimeRange(e.timerange).end),o=H.timeMomentToSeconds(H.parseTimeRange(r.timerange).start);if(Math.abs(i-o)<.001)return[e];const s=H.toTimeRange(H.secondsToTimeMoment(i),H.secondsToTimeMoment(o),!0,!1);return[e,{timerange:H.formatTimeRangeExpr(s),ts_offset:e.ts_offset,get_urls:(a=e.get_urls)==null?void 0:a.map(()=>"http://byomakase.org/non-playable-gap"),object_id:"non-playable-gap"}]})}function Ii(t,e,n,r){const i=[],o=(a,c)=>{var f;if(a.format!=="urn:x-nmos:format:video"&&a.format!=="urn:x-nmos:format:audio")return;const u=((f=Ai(c))==null?void 0:f.map(h=>{var w,C;const v=H.timerangeExprDuration(h.timerange);return new Li(v,((C=(w=h.get_urls)==null?void 0:w.at(-1))==null?void 0:C.url)??"http://byomakase.org/non-playable-gap")}))??[],l=Math.max(...u.map(h=>h.duration),1),d={playlistType:"VOD",targetDuration:Math.ceil(l),version:3,independentSegments:!0};if(a.format==="urn:x-nmos:format:video"){const v=a.essence_parameters,w={width:v.frame_width,height:v.frame_height},C=v.frame_rate?v.frame_rate.denominator?v.frame_rate.numerator/v.frame_rate.denominator:v.frame_rate.numerator:null,A=new lt(a.avg_bit_rate??0,a.avg_bit_rate??0,w,C,"");i.push({segments:u,metadata:d,streamInfo:A})}else if(a.format==="urn:x-nmos:format:audio"){const v=a.essence_parameters,w={type:"AUDIO",groupId:"audio",name:ge.isNullUndefinedOrWhitespace(a.description)?"":a.description,isDefault:!0,autoSelect:!0,channels:v.channels.toString()},C={bandwidth:a.avg_bit_rate??0,averageBandwidth:a.avg_bit_rate??0,resolution:null,frameRate:null,uri:""};i.push({segments:u,metadata:d,mediaInfo:w,streamInfo:C})}};return t.format==="urn:x-nmos:format:multi"?n==null||n.forEach(a=>{const c=r==null?void 0:r.get(a.id);o(a,c)}):o(t,e),Mi(i,{independentSegments:!0})}const Oi=p.memo(function({flow:e,childFlows:n,flowSegments:r,childFlowsSegments:i,videoLoadOptions:o,onVideoLoadedCallback:s,config:a,timerange:c,enableHotkey:u}){const l=p.useMemo(()=>Ii(e,r,n,i),[e,r,n,i,c]);return p.createElement(Ut,{videoUrl:l,videoLoadOptions:o,onVideoLoadedCallback:s,config:a,enableHotkeys:u})});function je(t){const e=new Date(t*1e3),n=e.getUTCHours();let r=e.getUTCMinutes();return e.getUTCSeconds()>=30&&r++,`${n}h ${r}min`}const _i=`
24
+ `),n}}function Mi(t,e){if(!t.some(l=>{var d;return l.streamInfo||((d=l.mediaInfo)==null?void 0:d.type)==="AUDIO"}))throw new Error("Can't create an hls manifest without audio or video source");const r=new tn().setVersion(10).setIndependentSegments(e.independentSegments);let i=t.some(({streamInfo:l,mediaInfo:d})=>l&&!d),o=!1;for(let l=0;l<t.length;l++){const{segments:d,metadata:f,streamInfo:h,mediaInfo:w}=t[l];let v=f.targetDuration;v===void 0&&(v=Math.max(...d.map(q=>q.duration),1));const M=new tn().setVersion(f.version??3).setIndependentSegments(f.independentSegments??!0).setTargetDuration(Math.ceil(v));f.programDateTime&&M.setProgramDateTime(f.programDateTime),f.playlistType&&M.setPlaylistType(f.playlistType),d.forEach(q=>M.addSegment(q,q.uri==="http://byomakase.org/non-playable-gap")),M.setEndList();const A=M.build(),B=nn.write(A),O=new Blob([B],{type:"application/vnd.apple.mpegurl"}),V=URL.createObjectURL(O);if(h&&!w){const q=new lt(h.bandwidth,h.averageBandwidth,h.resolution,h.frameRate,V);r.addStreamInfo(q)}else if(w){const q=new Ci(w.type,w.groupId??w.type.toLowerCase(),w.name??"",w.isDefault,w.autoSelect,w.channels,V);if(r.addMedia(q),!i&&w.type==="AUDIO"&&!o){const _=new lt((h==null?void 0:h.bandwidth)??0,(h==null?void 0:h.averageBandwidth)??0,null,null,V);r.addStreamInfo(_),o=!0}}}const s=r.build(),a=nn.write(s),c=new Blob([a],{type:"application/vnd.apple.mpegurl"});return URL.createObjectURL(c)}function Ai(t){return t===void 0?t:t.flatMap((e,n)=>{var a;if(t.length-1===n)return[e];const r=t.at(n+1),i=H.timeMomentToSeconds(H.parseTimeRange(e.timerange).end),o=H.timeMomentToSeconds(H.parseTimeRange(r.timerange).start);if(Math.abs(i-o)<.001)return[e];const s=H.toTimeRange(H.secondsToTimeMoment(i),H.secondsToTimeMoment(o),!0,!1);return[e,{timerange:H.formatTimeRangeExpr(s),ts_offset:e.ts_offset,get_urls:(a=e.get_urls)==null?void 0:a.map(()=>"http://byomakase.org/non-playable-gap"),object_id:"non-playable-gap"}]})}function Ii(t,e,n){const r=[],i=(s,a)=>{var d;if(s.format!=="urn:x-nmos:format:video"&&s.format!=="urn:x-nmos:format:audio")return;const c=((d=Ai(a))==null?void 0:d.map(f=>{var w,v;const h=H.timerangeExprDuration(f.timerange);return new Li(h,((v=(w=f.get_urls)==null?void 0:w.at(-1))==null?void 0:v.url)??"http://byomakase.org/non-playable-gap")}))??[],u=Math.max(...c.map(f=>f.duration),1),l={playlistType:"VOD",targetDuration:Math.ceil(u),version:3,independentSegments:!0};if(s.format==="urn:x-nmos:format:video"){const h=s.essence_parameters,w={width:h.frame_width,height:h.frame_height},v=h.frame_rate?h.frame_rate.denominator?h.frame_rate.numerator/h.frame_rate.denominator:h.frame_rate.numerator:null,M=new lt(s.avg_bit_rate??0,s.avg_bit_rate??0,w,v,"");r.push({segments:c,metadata:l,streamInfo:M})}else if(s.format==="urn:x-nmos:format:audio"){const h=s.essence_parameters,w={type:"AUDIO",groupId:"audio",name:ge.isNullUndefinedOrWhitespace(s.description)?"":s.description,isDefault:!0,autoSelect:!0,channels:h.channels.toString()},v={bandwidth:s.avg_bit_rate??0,averageBandwidth:s.avg_bit_rate??0,resolution:null,frameRate:null,uri:""};r.push({segments:c,metadata:l,mediaInfo:w,streamInfo:v})}};return t.format==="urn:x-nmos:format:multi"?e==null||e.forEach(s=>{const a=n==null?void 0:n.get(s.id);i(s,a)}):i(t,n==null?void 0:n.get(t.id)),Mi(r,{independentSegments:!0})}const Oi=p.memo(function({flow:e,childFlows:n,flowsSegments:r,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,timerange:a,enableHotkey:c}){const u=p.useMemo(()=>Ii(e,n,r),[e,r,n,a]);return p.createElement(Ut,{videoUrl:u,videoLoadOptions:i,onVideoLoadedCallback:o,config:s,enableHotkeys:c})});function je(t){const e=new Date(t*1e3),n=e.getUTCHours();let r=e.getUTCMinutes();return e.getUTCSeconds()>=30&&r++,`${n}h ${r}min`}const _i=`
25
25
  .omakase-time-range-selector-segments {
26
26
  display: flex;
27
27
  width: 700px;
@@ -215,5 +215,5 @@ ${r.uri}
215
215
  </defs>
216
216
  </svg>
217
217
 
218
- `,V={container:"omakase-time-range-selector-container",segments:"omakase-time-range-selector-segments",segment:"omakase-time-range-selector-segment",segmentMarker:"omakase-time-range-selector-segment-marker",segmentTick:"omakase-time-range-selector-segment-tick",segmentLabel:"omakase-time-range-selector-segment-label",firstSegmentLabel:"omakase-time-range-selector-segment-first-label",secondSegmentLabel:"omakase-time-range-selector-segment-second-label",rangeSelector:"omakase-time-range-selector-range-selector",rangeSelectorHandle:"omakase-time-range-selector-range-selector-handle",rangeSelectorDuration:"omakase-time-range-selector-range-selector-duration",buttonContainer:"omakase-time-range-selector-button-container",invisible:"omakase-time-range-selector-invisible"},$e={leftHandle:"omakase-time-range-selector-range-selector-left-handle",rightHandle:"omakase-time-range-selector-range-selector-right-handle",rangeDuration:"omakase-time-range-selector-range-selector-range-duration",segments:"omakase-time-range-selector-segments"};class rn extends HTMLElement{constructor(){super();E(this,"_container");E(this,"_rangeSelector");E(this,"_rangeSelectorLeftHandle");E(this,"_rangeSelectorRightHandle");E(this,"_rangeSelectorRangeDisplay");E(this,"_buttonContainer");E(this,"_segments");E(this,"_numberOfSegments",5);E(this,"_firstLabelIndex",0);E(this,"_initialFirstLabelIndex",0);E(this,"_labels",[]);E(this,"minWidth",10);E(this,"minValue");E(this,"maxValue");E(this,"maxRange");E(this,"segmentSize");E(this,"sliderStart");E(this,"sliderEnd");E(this,"maxWidthPercent");E(this,"onCheckmarkClickCallback");E(this,"currentStart",0);E(this,"currentEnd",100);E(this,"resetSegments",()=>{this._container.removeChild(this._segments),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.classList.add(V.segments),this._container.append(this._segments)});E(this,"getBounds",()=>({wrapperLeft:this._container.offsetLeft,wrapperRight:this._container.offsetLeft+this._container.offsetWidth,wrapperWidth:this._container.offsetWidth,selectorLeft:this._rangeSelector.offsetLeft,selectorWidth:this._rangeSelector.offsetWidth}));E(this,"getSliderValues",()=>{const{wrapperWidth:n,selectorLeft:r,selectorWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round(o+r/n*(s-o)),c=Math.round(o+(r+i)/n*(s-o));return{start:a,end:c}});E(this,"getSelectorBounds",(n,r)=>{const{wrapperWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round((n-o)/(s-o)*i),c=Math.round((r-n)/(s-o)*i);return{selectorLeft:a,selectorWidth:c}});E(this,"initSlider",(n,r)=>{const i=this.getSelectorBounds(n,r);this._rangeSelector.style.left=i.selectorLeft.toString()+"px",this._rangeSelector.style.width=i.selectorWidth.toString()+"px",this.updateDuration()});E(this,"showButtons",()=>{const{start:n,end:r}=this.getSliderValues();n===this.currentStart&&r===this.currentEnd||this._buttonContainer.classList.remove(V.invisible)});E(this,"hideButtons",()=>{this._buttonContainer.classList.add(V.invisible)});E(this,"updateDuration",()=>{const{start:n,end:r}=this.getSliderValues(),i=r-n;this._rangeSelectorRangeDisplay.textContent=je(i)});E(this,"onXclick",()=>{this.firstLabelIndex=this._initialFirstLabelIndex,this.resetSegments();const n=this.getSelectorBounds(this.currentStart,this.currentEnd);this._rangeSelector.style.left=n.selectorLeft.toString()+"px",this._rangeSelector.style.width=n.selectorWidth.toString()+"px",this.updateDuration(),this.hideButtons()});E(this,"onCheckmarkClick",()=>{const{start:n,end:r}=this.getSliderValues();this.currentStart=n,this.currentEnd=r,this._initialFirstLabelIndex=this.firstLabelIndex,this.updateDuration(),this.hideButtons(),this.onCheckmarkClickCallback!==void 0&&this.onCheckmarkClickCallback(n,r)});E(this,"onMouseDownRight",n=>{n.preventDefault();const r=n.clientX,{selectorWidth:i,wrapperWidth:o,selectorLeft:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=Math.max(this.minWidth,i+f);const v=Math.min(o*this.maxWidthPercent,o-s),w=h>v,C=performance.now();w?a===null&&(a=C,c=window.setTimeout(()=>{this.outOfBoundsCallback(!0),c=window.setInterval(()=>this.outOfBoundsCallback(!0),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h=Math.min(h,v),this._rangeSelector.style.width=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});E(this,"onMouseDownLeft",n=>{n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const v=h<0,w=performance.now();v?a===null&&(a=w,c=window.setTimeout(()=>{this.outOfBoundsCallback(!1),c=window.setInterval(()=>this.outOfBoundsCallback(!1),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h<0&&(f=-i,h=0);let C=Math.min(Math.max(this.minWidth,o-f),s);h+C>s&&(h=s-C),C>this.minWidth&&C<s*this.maxWidthPercent&&(this._rangeSelector.style.left=`${h}px`,this._rangeSelector.style.width=`${C}px`),this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});E(this,"outOfBoundsCallback",n=>{n?this.firstLabelIndex+=1:this.firstLabelIndex-=1,this.resetSegments()});E(this,"onMouseDownDrag",n=>{if(n.target instanceof HTMLElement&&n.target.classList.contains(V.rangeSelectorHandle))return;n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const v=s-o,w=h<0||h>v,C=performance.now();if(w){if(a===null){const A=h>v;a=C,c=window.setTimeout(()=>{this.outOfBoundsCallback(A),c=window.setInterval(()=>this.outOfBoundsCallback(A),400)},500)}}else c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null;h=Math.max(0,Math.min(h,v)),this._rangeSelector.style.left=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c))};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)})}set numberOfSegments(n){n>2&&(this._numberOfSegments=n)}get numberOfSegments(){return this._numberOfSegments}static get observedAttributes(){return["minValue","maxValue","maxRange","segmentSize","sliderStart","sliderEnd","numberOfSegments"]}get firstLabelIndex(){return this._firstLabelIndex}set firstLabelIndex(n){if(n+this._numberOfSegments+1>=this._labels.length){this._firstLabelIndex=this._labels.length-1-this.numberOfSegments;return}if(n<0){this._firstLabelIndex=0;return}this._firstLabelIndex=n}get lastLabelIndex(){return this._firstLabelIndex+this._numberOfSegments}connectedCallback(){if(this.minValue=Number.parseInt(this.getAttribute("minValue")??"NaN"),this.maxValue=Number.parseInt(this.getAttribute("maxValue")??"NaN"),this.maxRange=Number.parseInt(this.getAttribute("maxRange")??"NaN"),this.segmentSize=Number.parseInt(this.getAttribute("segmentSize")??"NaN"),this.getAttribute("numberOfSegments")){const l=Number.parseInt(this.getAttribute("numberOfSegments"));if(Number.isNaN(l))throw new Error("Invalid atribute value");this._numberOfSegments=l}if(Number.isNaN(this.minValue)||Number.isNaN(this.maxValue)||Number.isNaN(this.maxRange)||Number.isNaN(this.segmentSize))throw new Error("Invalid attribute values.");const n=this.maxValue-this.minValue;if(n<this.numberOfSegments*this.segmentSize&&(this.segmentSize=n/this.numberOfSegments),this.maxWidthPercent=this.maxRange>this.numberOfSegments*this.segmentSize?1:this.maxRange/(this.numberOfSegments*this.segmentSize),this._labels=this.calculateLabels(),this.maxValue<this.minValue)throw new Error("Max value is lesser than min value");let r,i;if(this.getAttribute("sliderStart")&&this.getAttribute("sliderEnd")){if(r=Number.parseFloat(this.getAttribute("sliderStart")),i=Number.parseFloat(this.getAttribute("sliderEnd")),r>i)throw new Error("Slider start is bigger than slider end");if(r<this.minValue)throw new Error("Slider start is smaller than minimal value");i>this.maxValue&&(i=this.maxValue),this.currentStart=r,this.currentEnd=i}else r=this.minValue,i=this.segmentSize;this.resolveInitialSegment(r,i),this._container=document.createElement("div"),this._container.classList.add(V.container);const o=document.createElement("style");o.textContent=_i,this._container.append(o),this._buttonContainer=document.createElement("div"),this._buttonContainer.classList.add(V.buttonContainer,V.invisible);const s=this.createButtonSvg(xi),a=this.createButtonSvg(Ni);s.onclick=this.onCheckmarkClick,a.onclick=this.onXclick,this._buttonContainer.append(s,a),this._container.append(this._buttonContainer),this._rangeSelector=document.createElement("div"),this._rangeSelector.classList.add(V.rangeSelector),this._rangeSelectorLeftHandle=document.createElement("div"),this._rangeSelectorLeftHandle.classList.add(V.rangeSelectorHandle),this._rangeSelectorLeftHandle.id=$e.leftHandle,this._rangeSelectorRightHandle=document.createElement("div"),this._rangeSelectorRightHandle.classList.add(V.rangeSelectorHandle),this._rangeSelectorRightHandle.id=$e.rightHandle,this._rangeSelectorRangeDisplay=document.createElement("div"),this._rangeSelectorRangeDisplay.classList.add(V.rangeSelectorDuration),this._rangeSelectorRangeDisplay.id=$e.rangeDuration,this._rangeSelector.append(this._rangeSelectorLeftHandle,this._rangeSelectorRangeDisplay,this._rangeSelectorRightHandle),this._container.append(this._rangeSelector),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.id=$e.segments,this._segments.classList.add(V.segments),this._container.append(this._segments),this._rangeSelectorLeftHandle.addEventListener("mousedown",this.onMouseDownLeft),this._rangeSelectorRightHandle.addEventListener("mousedown",this.onMouseDownRight),this._rangeSelector.addEventListener("mousedown",this.onMouseDownDrag),this.append(this._container),this.initSlider(r,i);const{start:c,end:u}=this.getSliderValues();this.currentStart=c,this.currentEnd=u,this.updateDuration()}resolveInitialSegment(n,r){const i=this._numberOfSegments*this.segmentSize,o=r-n,s=this.maxValue-this.minValue,a=n-this.minValue,c=Math.ceil(s/this.segmentSize);let u=Math.floor(a/s*c);u+=Math.floor((i-o)/this.segmentSize);const d=u+Math.ceil(o/this.segmentSize)-this._numberOfSegments;this.firstLabelIndex=d,this._initialFirstLabelIndex=d}createButtonSvg(n){const r=document.createElement("button");return r.innerHTML=n,r}calculateLabels(){const n=this.minValue,r=this.maxValue,i=Math.floor((this.maxValue-this.minValue)/this.segmentSize)-1,o=[n];let s=this.minValue;for(let a=0;a<i;a++)s+=this.segmentSize,o.push(s);return o.push(r),o}buildSegments(n){const r=document.createElement("div");n.slice(0,-2).forEach(u=>{const l=document.createElement("div");l.classList.add(V.segment);const d=document.createElement("div");d.classList.add(V.segmentMarker);const f=document.createElement("div");f.classList.add(V.segmentTick);const h=document.createElement("div");h.classList.add(V.segmentLabel),h.innerHTML=je(u),l.append(d,f,h),r.append(l)});const i=document.createElement("div");i.classList.add(V.segment);const o=document.createElement("div");o.classList.add(V.segmentMarker);const s=document.createElement("div");s.classList.add(V.segmentTick);const a=document.createElement("div");a.classList.add(V.segmentLabel,V.firstSegmentLabel),a.innerHTML=je(n.at(-2));const c=document.createElement("div");return c.classList.add(V.segmentLabel,V.secondSegmentLabel),c.innerHTML=je(n.at(-1)),i.append(o,s,a,c),r.append(i),r}}const on="omakase-time-range-selector-react-div",ki=({timeRange:t,maxTimeRange:e,numberOfSegments:n,segmentSize:r,maxSliderRange:i,onCheckmarkClickCallback:o})=>(customElements.get("omakase-time-range-selector")||customElements.define("omakase-time-range-selector",rn),p.useEffect(()=>{var h;const s=H.parseTimeRange(e),a=H.timeMomentToSeconds(s.start),c=H.timeMomentToSeconds(s.end),u=H.parseTimeRange(t),l=H.timeMomentToSeconds(u.start),d=H.timeMomentToSeconds(u.end),f=new rn;f.setAttribute("minValue",a.toString()),f.setAttribute("maxValue",c.toString()),f.setAttribute("maxRange",i.toString()),f.setAttribute("segmentSize",r.toString()),f.setAttribute("numberOfSegments",n.toString()),f.setAttribute("sliderStart",l.toString()),f.setAttribute("sliderEnd",d.toString()),f.onCheckmarkClickCallback=o,(h=document.getElementById(on))==null||h.append(f)},[]),p.createElement("div",{id:on})),Di=p.memo(({omakasePlayer:t,config:e,onCreateMarkerListCallback:n})=>(p.useEffect(()=>{const r=t.createMarkerList(e).subscribe({next:i=>{n==null||n(i)}});return()=>{r.unsubscribe()}},[e.source]),p.createElement("div",{id:e.markerListHTMLElementId})));S.AudioFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformataudio:"urn:x-nmos:format:audio"}})(S.AudioFlow||(S.AudioFlow={}));const Vi={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"};S.DataFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-nmos:format:data"}})(S.DataFlow||(S.DataFlow={})),S.DeletionRequest=void 0,(t=>{t.StatusEnum={Created:"created",Started:"started",Done:"done",Error:"error"}})(S.DeletionRequest||(S.DeletionRequest={})),S.MediaBucketObjectStorePreInner=void 0,(t=>{t.ActionEnum={CreateBucket:"create_bucket"}})(S.MediaBucketObjectStorePreInner||(S.MediaBucketObjectStorePreInner={})),S.MultiEssenceFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatmulti:"urn:x-nmos:format:multi"}})(S.MultiEssenceFlow||(S.MultiEssenceFlow={})),S.ServiceMediaStore=void 0,(t=>{t.TypeEnum={HttpObjectStore:"http_object_store"}})(S.ServiceMediaStore||(S.ServiceMediaStore={})),S.Source=void 0,(t=>{t.FormatEnum={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"}})(S.Source||(S.Source={})),S.UncompressedAudioParameters=void 0,(t=>{t.UncTypeEnum={Interleaved:"interleaved",Planar:"planar",Pairs:"pairs"}})(S.UncompressedAudioParameters||(S.UncompressedAudioParameters={})),S.UncompressedVideoParameters=void 0,(t=>{t.UncTypeEnum={Planar:"planar",Yuyv:"YUYV",Uyvy:"UYVY",Ayuv:"AYUV",V210:"v210",V216:"v216",Rgb:"RGB",Rgbx:"RGBx",XRgb:"xRGB",Bgrx:"BGRx",XBgr:"xBGR",Rgba:"RGBA",Argb:"ARGB",Bgra:"BGRA",Abgr:"ABGR",Alpha:"alpha"}})(S.UncompressedVideoParameters||(S.UncompressedVideoParameters={})),S.VideoFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatvideo:"urn:x-nmos:format:video"}})(S.VideoFlow||(S.VideoFlow={})),S.VideoFlowEssenceParameters=void 0,(t=>{t.InterlaceModeEnum={Progressive:"progressive",InterlacedTff:"interlaced_tff",InterlacedBff:"interlaced_bff",InterlacedPsf:"interlaced_psf"},t.ColorspaceEnum={Bt601:"BT601",Bt709:"BT709",Bt2020:"BT2020",Bt2100:"BT2100"},t.TransferCharacteristicEnum={Sdr:"SDR",Hlg:"HLG",Pq:"PQ"},t.ComponentTypeEnum={YcbCr:"YCbCr",Rgb:"RGB"}})(S.VideoFlowEssenceParameters||(S.VideoFlowEssenceParameters={})),S.ImageFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-nmos:format:image"}})(S.ImageFlow||(S.ImageFlow={})),S.Contentformat=Vi,S.OmakaseMarkerListComponent=Di,S.OmakasePlayerComponent=Ut,S.OmakasePlayerTimelineBuilder=vn,S.OmakasePlayerTimelineComponent=mr,S.OmakasePlayerTimelineControlsToolbar=Ir,S.OmakaseTamsPlayerComponent=Oi,S.OmakaseTimeRangePicker=ki,S.TimeRangeUtil=H,S.TimecodeUtil=me,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
218
+ `,F={container:"omakase-time-range-selector-container",segments:"omakase-time-range-selector-segments",segment:"omakase-time-range-selector-segment",segmentMarker:"omakase-time-range-selector-segment-marker",segmentTick:"omakase-time-range-selector-segment-tick",segmentLabel:"omakase-time-range-selector-segment-label",firstSegmentLabel:"omakase-time-range-selector-segment-first-label",secondSegmentLabel:"omakase-time-range-selector-segment-second-label",rangeSelector:"omakase-time-range-selector-range-selector",rangeSelectorHandle:"omakase-time-range-selector-range-selector-handle",rangeSelectorDuration:"omakase-time-range-selector-range-selector-duration",buttonContainer:"omakase-time-range-selector-button-container",invisible:"omakase-time-range-selector-invisible"},$e={leftHandle:"omakase-time-range-selector-range-selector-left-handle",rightHandle:"omakase-time-range-selector-range-selector-right-handle",rangeDuration:"omakase-time-range-selector-range-selector-range-duration",segments:"omakase-time-range-selector-segments"};class rn extends HTMLElement{constructor(){super();E(this,"_container");E(this,"_rangeSelector");E(this,"_rangeSelectorLeftHandle");E(this,"_rangeSelectorRightHandle");E(this,"_rangeSelectorRangeDisplay");E(this,"_buttonContainer");E(this,"_segments");E(this,"_numberOfSegments",5);E(this,"_firstLabelIndex",0);E(this,"_initialFirstLabelIndex",0);E(this,"_labels",[]);E(this,"minWidth",10);E(this,"minValue");E(this,"maxValue");E(this,"maxRange");E(this,"segmentSize");E(this,"sliderStart");E(this,"sliderEnd");E(this,"maxWidthPercent");E(this,"onCheckmarkClickCallback");E(this,"currentStart",0);E(this,"currentEnd",100);E(this,"resetSegments",()=>{this._container.removeChild(this._segments),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.classList.add(F.segments),this._container.append(this._segments)});E(this,"getBounds",()=>({wrapperLeft:this._container.offsetLeft,wrapperRight:this._container.offsetLeft+this._container.offsetWidth,wrapperWidth:this._container.offsetWidth,selectorLeft:this._rangeSelector.offsetLeft,selectorWidth:this._rangeSelector.offsetWidth}));E(this,"getSliderValues",()=>{const{wrapperWidth:n,selectorLeft:r,selectorWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round(o+r/n*(s-o)),c=Math.round(o+(r+i)/n*(s-o));return{start:a,end:c}});E(this,"getSelectorBounds",(n,r)=>{const{wrapperWidth:i}=this.getBounds(),o=this._labels.at(this.firstLabelIndex),s=this._labels.at(this.lastLabelIndex),a=Math.round((n-o)/(s-o)*i),c=Math.round((r-n)/(s-o)*i);return{selectorLeft:a,selectorWidth:c}});E(this,"initSlider",(n,r)=>{const i=this.getSelectorBounds(n,r);this._rangeSelector.style.left=i.selectorLeft.toString()+"px",this._rangeSelector.style.width=i.selectorWidth.toString()+"px",this.updateDuration()});E(this,"showButtons",()=>{const{start:n,end:r}=this.getSliderValues();n===this.currentStart&&r===this.currentEnd||this._buttonContainer.classList.remove(F.invisible)});E(this,"hideButtons",()=>{this._buttonContainer.classList.add(F.invisible)});E(this,"updateDuration",()=>{const{start:n,end:r}=this.getSliderValues(),i=r-n;this._rangeSelectorRangeDisplay.textContent=je(i)});E(this,"onXclick",()=>{this.firstLabelIndex=this._initialFirstLabelIndex,this.resetSegments();const n=this.getSelectorBounds(this.currentStart,this.currentEnd);this._rangeSelector.style.left=n.selectorLeft.toString()+"px",this._rangeSelector.style.width=n.selectorWidth.toString()+"px",this.updateDuration(),this.hideButtons()});E(this,"onCheckmarkClick",()=>{const{start:n,end:r}=this.getSliderValues();this.currentStart=n,this.currentEnd=r,this._initialFirstLabelIndex=this.firstLabelIndex,this.updateDuration(),this.hideButtons(),this.onCheckmarkClickCallback!==void 0&&this.onCheckmarkClickCallback(n,r)});E(this,"onMouseDownRight",n=>{n.preventDefault();const r=n.clientX,{selectorWidth:i,wrapperWidth:o,selectorLeft:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=Math.max(this.minWidth,i+f);const w=Math.min(o*this.maxWidthPercent,o-s),v=h>w,M=performance.now();v?a===null&&(a=M,c=window.setTimeout(()=>{this.outOfBoundsCallback(!0),c=window.setInterval(()=>this.outOfBoundsCallback(!0),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h=Math.min(h,w),this._rangeSelector.style.width=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});E(this,"onMouseDownLeft",n=>{n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const w=h<0,v=performance.now();w?a===null&&(a=v,c=window.setTimeout(()=>{this.outOfBoundsCallback(!1),c=window.setInterval(()=>this.outOfBoundsCallback(!1),400)},500)):(c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null),h<0&&(f=-i,h=0);let M=Math.min(Math.max(this.minWidth,o-f),s);h+M>s&&(h=s-M),M>this.minWidth&&M<s*this.maxWidthPercent&&(this._rangeSelector.style.left=`${h}px`,this._rangeSelector.style.width=`${M}px`),this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)});E(this,"outOfBoundsCallback",n=>{n?this.firstLabelIndex+=1:this.firstLabelIndex-=1,this.resetSegments()});E(this,"onMouseDownDrag",n=>{if(n.target instanceof HTMLElement&&n.target.classList.contains(F.rangeSelectorHandle))return;n.preventDefault();const r=n.clientX,{selectorLeft:i,selectorWidth:o,wrapperWidth:s}=this.getBounds();let a=null,c=null;const u=d=>{let f=d.clientX-r,h=i+f;const w=s-o,v=h<0||h>w,M=performance.now();if(v){if(a===null){const A=h>w;a=M,c=window.setTimeout(()=>{this.outOfBoundsCallback(A),c=window.setInterval(()=>this.outOfBoundsCallback(A),400)},500)}}else c!==null&&(clearTimeout(c),clearInterval(c),c=null),a=null;h=Math.max(0,Math.min(h,w)),this._rangeSelector.style.left=`${h}px`,this.updateDuration()},l=()=>{this.showButtons(),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",l),c!==null&&(clearTimeout(c),clearInterval(c))};document.addEventListener("mousemove",u),document.addEventListener("mouseup",l)})}set numberOfSegments(n){n>2&&(this._numberOfSegments=n)}get numberOfSegments(){return this._numberOfSegments}static get observedAttributes(){return["minValue","maxValue","maxRange","segmentSize","sliderStart","sliderEnd","numberOfSegments"]}get firstLabelIndex(){return this._firstLabelIndex}set firstLabelIndex(n){if(n+this._numberOfSegments+1>=this._labels.length){this._firstLabelIndex=this._labels.length-1-this.numberOfSegments;return}if(n<0){this._firstLabelIndex=0;return}this._firstLabelIndex=n}get lastLabelIndex(){return this._firstLabelIndex+this._numberOfSegments}connectedCallback(){if(this.minValue=Number.parseInt(this.getAttribute("minValue")??"NaN"),this.maxValue=Number.parseInt(this.getAttribute("maxValue")??"NaN"),this.maxRange=Number.parseInt(this.getAttribute("maxRange")??"NaN"),this.segmentSize=Number.parseInt(this.getAttribute("segmentSize")??"NaN"),this.getAttribute("numberOfSegments")){const l=Number.parseInt(this.getAttribute("numberOfSegments"));if(Number.isNaN(l))throw new Error("Invalid atribute value");this._numberOfSegments=l}if(Number.isNaN(this.minValue)||Number.isNaN(this.maxValue)||Number.isNaN(this.maxRange)||Number.isNaN(this.segmentSize))throw new Error("Invalid attribute values.");const n=this.maxValue-this.minValue;if(n<this.numberOfSegments*this.segmentSize&&(this.segmentSize=n/this.numberOfSegments),this.maxWidthPercent=this.maxRange>this.numberOfSegments*this.segmentSize?1:this.maxRange/(this.numberOfSegments*this.segmentSize),this._labels=this.calculateLabels(),this.maxValue<this.minValue)throw new Error("Max value is lesser than min value");let r,i;if(this.getAttribute("sliderStart")&&this.getAttribute("sliderEnd")){if(r=Number.parseFloat(this.getAttribute("sliderStart")),i=Number.parseFloat(this.getAttribute("sliderEnd")),r>i)throw new Error("Slider start is bigger than slider end");if(r<this.minValue)throw new Error("Slider start is smaller than minimal value");i>this.maxValue&&(i=this.maxValue),this.currentStart=r,this.currentEnd=i}else r=this.minValue,i=this.segmentSize;this.resolveInitialSegment(r,i),this._container=document.createElement("div"),this._container.classList.add(F.container);const o=document.createElement("style");o.textContent=_i,this._container.append(o),this._buttonContainer=document.createElement("div"),this._buttonContainer.classList.add(F.buttonContainer,F.invisible);const s=this.createButtonSvg(xi),a=this.createButtonSvg(Ni);s.onclick=this.onCheckmarkClick,a.onclick=this.onXclick,this._buttonContainer.append(s,a),this._container.append(this._buttonContainer),this._rangeSelector=document.createElement("div"),this._rangeSelector.classList.add(F.rangeSelector),this._rangeSelectorLeftHandle=document.createElement("div"),this._rangeSelectorLeftHandle.classList.add(F.rangeSelectorHandle),this._rangeSelectorLeftHandle.id=$e.leftHandle,this._rangeSelectorRightHandle=document.createElement("div"),this._rangeSelectorRightHandle.classList.add(F.rangeSelectorHandle),this._rangeSelectorRightHandle.id=$e.rightHandle,this._rangeSelectorRangeDisplay=document.createElement("div"),this._rangeSelectorRangeDisplay.classList.add(F.rangeSelectorDuration),this._rangeSelectorRangeDisplay.id=$e.rangeDuration,this._rangeSelector.append(this._rangeSelectorLeftHandle,this._rangeSelectorRangeDisplay,this._rangeSelectorRightHandle),this._container.append(this._rangeSelector),this._segments=this.buildSegments(this._labels.slice(this.firstLabelIndex,this.lastLabelIndex+1)),this._segments.id=$e.segments,this._segments.classList.add(F.segments),this._container.append(this._segments),this._rangeSelectorLeftHandle.addEventListener("mousedown",this.onMouseDownLeft),this._rangeSelectorRightHandle.addEventListener("mousedown",this.onMouseDownRight),this._rangeSelector.addEventListener("mousedown",this.onMouseDownDrag),this.append(this._container),this.initSlider(r,i);const{start:c,end:u}=this.getSliderValues();this.currentStart=c,this.currentEnd=u,this.updateDuration()}resolveInitialSegment(n,r){const i=this._numberOfSegments*this.segmentSize,o=r-n,s=this.maxValue-this.minValue,a=n-this.minValue,c=Math.ceil(s/this.segmentSize);let u=Math.floor(a/s*c);u+=Math.floor((i-o)/this.segmentSize);const d=u+Math.ceil(o/this.segmentSize)-this._numberOfSegments;this.firstLabelIndex=d,this._initialFirstLabelIndex=d}createButtonSvg(n){const r=document.createElement("button");return r.innerHTML=n,r}calculateLabels(){const n=this.minValue,r=this.maxValue,i=Math.floor((this.maxValue-this.minValue)/this.segmentSize)-1,o=[n];let s=this.minValue;for(let a=0;a<i;a++)s+=this.segmentSize,o.push(s);return o.push(r),o}buildSegments(n){const r=document.createElement("div");n.slice(0,-2).forEach(u=>{const l=document.createElement("div");l.classList.add(F.segment);const d=document.createElement("div");d.classList.add(F.segmentMarker);const f=document.createElement("div");f.classList.add(F.segmentTick);const h=document.createElement("div");h.classList.add(F.segmentLabel),h.innerHTML=je(u),l.append(d,f,h),r.append(l)});const i=document.createElement("div");i.classList.add(F.segment);const o=document.createElement("div");o.classList.add(F.segmentMarker);const s=document.createElement("div");s.classList.add(F.segmentTick);const a=document.createElement("div");a.classList.add(F.segmentLabel,F.firstSegmentLabel),a.innerHTML=je(n.at(-2));const c=document.createElement("div");return c.classList.add(F.segmentLabel,F.secondSegmentLabel),c.innerHTML=je(n.at(-1)),i.append(o,s,a,c),r.append(i),r}}const on="omakase-time-range-selector-react-div",ki=({timeRange:t,maxTimeRange:e,numberOfSegments:n,segmentSize:r,maxSliderRange:i,onCheckmarkClickCallback:o})=>(customElements.get("omakase-time-range-selector")||customElements.define("omakase-time-range-selector",rn),p.useEffect(()=>{var h;const s=H.parseTimeRange(e),a=H.timeMomentToSeconds(s.start),c=H.timeMomentToSeconds(s.end),u=H.parseTimeRange(t),l=H.timeMomentToSeconds(u.start),d=H.timeMomentToSeconds(u.end),f=new rn;f.setAttribute("minValue",a.toString()),f.setAttribute("maxValue",c.toString()),f.setAttribute("maxRange",i.toString()),f.setAttribute("segmentSize",r.toString()),f.setAttribute("numberOfSegments",n.toString()),f.setAttribute("sliderStart",l.toString()),f.setAttribute("sliderEnd",d.toString()),f.onCheckmarkClickCallback=o,(h=document.getElementById(on))==null||h.append(f)},[]),p.createElement("div",{id:on})),Di=p.memo(({omakasePlayer:t,config:e,onCreateMarkerListCallback:n})=>(p.useEffect(()=>{const r=t.createMarkerList(e).subscribe({next:i=>{n==null||n(i)}});return()=>{r.unsubscribe()}},[e.source]),p.createElement("div",{id:e.markerListHTMLElementId})));S.AudioFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformataudio:"urn:x-nmos:format:audio"}})(S.AudioFlow||(S.AudioFlow={}));const Fi={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"};S.DataFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-nmos:format:data"}})(S.DataFlow||(S.DataFlow={})),S.DeletionRequest=void 0,(t=>{t.StatusEnum={Created:"created",Started:"started",Done:"done",Error:"error"}})(S.DeletionRequest||(S.DeletionRequest={})),S.MediaBucketObjectStorePreInner=void 0,(t=>{t.ActionEnum={CreateBucket:"create_bucket"}})(S.MediaBucketObjectStorePreInner||(S.MediaBucketObjectStorePreInner={})),S.MultiEssenceFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatmulti:"urn:x-nmos:format:multi"}})(S.MultiEssenceFlow||(S.MultiEssenceFlow={})),S.ServiceMediaStore=void 0,(t=>{t.TypeEnum={HttpObjectStore:"http_object_store"}})(S.ServiceMediaStore||(S.ServiceMediaStore={})),S.Source=void 0,(t=>{t.FormatEnum={Video:"urn:x-nmos:format:video",Audio:"urn:x-nmos:format:audio",Data:"urn:x-nmos:format:data",Multi:"urn:x-nmos:format:multi"}})(S.Source||(S.Source={})),S.UncompressedAudioParameters=void 0,(t=>{t.UncTypeEnum={Interleaved:"interleaved",Planar:"planar",Pairs:"pairs"}})(S.UncompressedAudioParameters||(S.UncompressedAudioParameters={})),S.UncompressedVideoParameters=void 0,(t=>{t.UncTypeEnum={Planar:"planar",Yuyv:"YUYV",Uyvy:"UYVY",Ayuv:"AYUV",V210:"v210",V216:"v216",Rgb:"RGB",Rgbx:"RGBx",XRgb:"xRGB",Bgrx:"BGRx",XBgr:"xBGR",Rgba:"RGBA",Argb:"ARGB",Bgra:"BGRA",Abgr:"ABGR",Alpha:"alpha"}})(S.UncompressedVideoParameters||(S.UncompressedVideoParameters={})),S.VideoFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatvideo:"urn:x-nmos:format:video"}})(S.VideoFlow||(S.VideoFlow={})),S.VideoFlowEssenceParameters=void 0,(t=>{t.InterlaceModeEnum={Progressive:"progressive",InterlacedTff:"interlaced_tff",InterlacedBff:"interlaced_bff",InterlacedPsf:"interlaced_psf"},t.ColorspaceEnum={Bt601:"BT601",Bt709:"BT709",Bt2020:"BT2020",Bt2100:"BT2100"},t.TransferCharacteristicEnum={Sdr:"SDR",Hlg:"HLG",Pq:"PQ"},t.ComponentTypeEnum={YcbCr:"YCbCr",Rgb:"RGB"}})(S.VideoFlowEssenceParameters||(S.VideoFlowEssenceParameters={})),S.ImageFlow=void 0,(t=>{t.FormatEnum={UrnxNmosformatdata:"urn:x-tam:format:image"}})(S.ImageFlow||(S.ImageFlow={})),S.Contentformat=Fi,S.OmakaseMarkerListComponent=Di,S.OmakasePlayerComponent=Ut,S.OmakasePlayerTimelineBuilder=vn,S.OmakasePlayerTimelineComponent=mr,S.OmakasePlayerTimelineControlsToolbar=Ir,S.OmakaseTamsPlayerComponent=Oi,S.OmakaseTimeRangePicker=ki,S.TimeRangeUtil=H,S.TimecodeUtil=me,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
219
219
  //# sourceMappingURL=index.umd.js.map