@byomakase/omakase-react-components 1.4.1 → 1.4.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.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +34 -28
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -97,8 +97,8 @@ ${n(m)}`)}),d.join(`
|
|
|
97
97
|
`)}function s(l){const d=[];l.identifier&&d.push(l.identifier);const f=c(l.start),m=c(l.end),h=l.styles?`${l.styles}`:"";return d.push(`${f} --> ${m} ${h}`),d.push(l.text),d.join(`
|
|
98
98
|
`)}function c(l){const d=(l%1).toFixed(3);l=Math.round(l-d);const f=Math.floor(l/3600),m=Math.floor((l-f*3600)/60),h=l-f*3600-m*60;return`${`${i(f,2)}:`}${i(m,2)}:${i(h,2)}.${i(d*1e3,3)}`}return aa={hlsSegment:t,hlsSegmentPlaylist:r},aa}var ua,Om;function d1(){if(Om)return ua;Om=1;const e=Im().parse,t=s1().compile,r=zm().segment,i=l1();return ua={parse:e,compile:t,segment:r,hls:i},ua}var f1=d1();async function m1(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch: ${e}`);const r=await t.arrayBuffer();return new TextDecoder("utf-8").decode(r)}function Um(e){e<0&&(e=0);const t=Math.floor(e/3600).toString().padStart(2,"0"),r=Math.floor(e%3600/60).toString().padStart(2,"0"),i=(e%60).toFixed(3).padStart(6,"0");return`${t}:${r}:${i}`}async function p1(e,t){return e.length?await Promise.all(e.map(async i=>{const n=await m1(i),o=f1.parse(n,{strict:!1,meta:!0});let a=o.cues;t!==void 0&&(a=a.map(l=>({...l,start:l.start-t,end:l.end-t})).filter(l=>l.end>0).map(l=>({...l,start:Math.max(0,l.start),end:Math.max(0,l.end)})));const u=[];u.push("WEBVTT"),o.meta&&o.meta["X-TIMESTAMP-MAP=LOCAL"]&&u.push(`X-TIMESTAMP-MAP=LOCAL${o.meta["X-TIMESTAMP-MAP=LOCAL"]}`),u.push("");for(const l of a)u.push(`${Um(l.start)} --> ${Um(l.end)}`),u.push(l.text),u.push("");const s=u.join(`
|
|
99
99
|
`).trim()+`
|
|
100
|
-
`,c=new Blob([s],{type:"text/vtt"});return URL.createObjectURL(c)})):[]}class h1{static slewSubtitlesFlows(t,r){return new be(i=>{(async()=>{var n;try{const o=(n=t.subflows)==null?void 0:n.filter(
|
|
101
|
-
`)}static generateThumbnailVttBlob(t,r,i){const n=this.generateThumbnailVtt(t,r,i),o=new Blob([n],{type:"text/vtt"});return URL.createObjectURL(o)}static toTimestamp(t){const r=Math.floor(t/3600),i=Math.floor(t%3600/60),n=Math.floor(t%60),o=Math.round(t%1*1e3);return`${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}.${String(o).padStart(3,"0")}`}static generateThumbnailTrackUrl(t,r,i,n){const o=this.resolveLowestQualityImageFlow(t);return o?this.generateThumbnailVttBlob(r.get(o.id),i,n):void 0}}class Dm{constructor(t){k(this,"_player");k(this,"_videoApiProxy");k(this,"_authenticationData");k(this,"_tamsEndpoint");this._player=new M.OmakasePlayer(t),this._videoApiProxy=new ru(this._player),this._authenticationData=t==null?void 0:t.authentication}loadVideo(t,r){if(r!=null&&r.duration&&(r!=null&&r.timerange)&&console.warn("Duration and timerange are both set. Using timerange."),this._videoApiProxy.loadOptions=structuredClone(r),this._videoApiProxy.requestedDuration=r==null?void 0:r.duration,typeof t=="string")if((r==null?void 0:r.protocol)===void 0){const i=this._tamsEndpoint??ym(t).at(0);if(i===null)throw Error("Provided URL is not pointing to TAMS");const n=new Sm(i,this._authenticationData?wm(this._authenticationData):void 0),o=(r==null?void 0:r.timerange)??(r==null?void 0:r.duration);return na(a=>{n.fetchManifestResources(t,o).pipe(ei(u=>this._loadTamsMedia(u,r))).subscribe(a)})}else return this._player.loadVideo(t,r);else if(Array.isArray(t)){if(r!=null&&r.protocol)throw new Error(`Protocol ${r.protocol} can't be used with TAMS media`);const i=this._tamsEndpoint??ym(t.at(0)).at(0);if(i===null)throw Error("Provided URL is not pointing to TAMS");const n=new Sm(i,this._authenticationData?wm(this._authenticationData):void 0),o=(r==null?void 0:r.timerange)??(r==null?void 0:r.duration);return na(a=>{n.fetchManifestResourcesForMultipleFlows(t,o).pipe(ei(u=>this._loadTamsMedia(u,r).pipe(nu(s=>{var c;return s.tamsMediaData&&(s.tamsMediaData.flow=void 0,(c=s.tamsMediaData.flowsSegments)==null||c.delete(Ir)),s})))).subscribe(a)})}else return this._loadTamsMedia(t,r)}_loadTamsMedia(t,r){return na(i=>{const n=lh([t.flow,...t.subflows??[]],t.flowsSegments,r==null?void 0:r.ffomTimeZoneOffset),o={protocol:"hls",ffom:n.ffom,frameRate:n.frameRate,dropFrame:n.dropFrame};let a;r?(r.protocol="hls",a={...o,...r,ffom:o.ffom}):a=o,delete a.duration,this._videoApiProxy.requestedDuration=r==null?void 0:r.duration;const u=Va(t.flow,t.subflows,t.flowsSegments);if(!u.valid){i.error(u.message);return}if(r&&!c1(r)){i.error("Invalid ffomTimeZoneOffset");return}h1.slewSubtitlesFlows(t,n).pipe(ei(
|
|
100
|
+
`,c=new Blob([s],{type:"text/vtt"});return URL.createObjectURL(c)})):[]}class h1{static slewSubtitlesFlows(t,r){return new be(i=>{(async()=>{var n;try{const o=new Map,a=(n=t.subflows)==null?void 0:n.filter(u=>u.format==="urn:x-nmos:format:data"&&u.container==="text/vtt");a!=null&&a.length&&await Promise.all(a.map(async u=>{const s=t.flowsSegments.get(u.id),c=s.map(f=>{var m;return(m=f.get_urls)==null?void 0:m.at(-1).url});let l=await p1(c,r.mediaStartTime);l=l.map(f=>u1(f));const d=s.map((f,m)=>({...f,get_urls:[{url:l.at(m)}]}));o.set(u.id,d)})),i.next(o),i.complete()}catch(o){i.error(o)}})()})}}class g1{static resolveLowestQualityImageFlow(t){const r=t.filter(n=>n.format==="urn:x-tam:format:image");return r.length===0?void 0:r.reduce((n,o)=>{if(n===void 0)return o;const a=n.essence_parameters.frame_width*n.essence_parameters.frame_height;return o.essence_parameters.frame_height*o.essence_parameters.frame_width<a?o:n},void 0)}static generateThumbnailVtt(t,r,i){let n=["WEBVTT",""];return t.forEach((o,a)=>{if((o.get_urls||[]).length===0)return;const s=A.timeMomentToSeconds(A.parseTimeRange(o.timerange).start);let c;if(a===t.length-1?c=r-.001:c=A.timeMomentToSeconds(A.parseTimeRange(t.at(a+1).timerange).start)-.001,c<=s){console.debug(`Malformed thumbnail vtt cue, skipped ${s} --> ${c}`);return}const l=this.toTimestamp(s-i),d=this.toTimestamp(c-i);n.push(`${l} --> ${d}`),n.push(o.get_urls.at(-1).url),n.push("")}),n.join(`
|
|
101
|
+
`)}static generateThumbnailVttBlob(t,r,i){const n=this.generateThumbnailVtt(t,r,i),o=new Blob([n],{type:"text/vtt"});return URL.createObjectURL(o)}static toTimestamp(t){const r=Math.floor(t/3600),i=Math.floor(t%3600/60),n=Math.floor(t%60),o=Math.round(t%1*1e3);return`${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}.${String(o).padStart(3,"0")}`}static generateThumbnailTrackUrl(t,r,i,n){const o=this.resolveLowestQualityImageFlow(t);return o?this.generateThumbnailVttBlob(r.get(o.id),i,n):void 0}}class Dm{constructor(t){k(this,"_player");k(this,"_videoApiProxy");k(this,"_authenticationData");k(this,"_tamsEndpoint");this._player=new M.OmakasePlayer(t),this._videoApiProxy=new ru(this._player),this._authenticationData=t==null?void 0:t.authentication}loadVideo(t,r){if(r!=null&&r.duration&&(r!=null&&r.timerange)&&console.warn("Duration and timerange are both set. Using timerange."),this._videoApiProxy.loadOptions=structuredClone(r),this._videoApiProxy.requestedDuration=r==null?void 0:r.duration,typeof t=="string")if((r==null?void 0:r.protocol)===void 0){const i=this._tamsEndpoint??ym(t).at(0);if(i===null)throw Error("Provided URL is not pointing to TAMS");const n=new Sm(i,this._authenticationData?wm(this._authenticationData):void 0),o=(r==null?void 0:r.timerange)??(r==null?void 0:r.duration);return na(a=>{n.fetchManifestResources(t,o).pipe(ei(u=>this._loadTamsMedia(u,r))).subscribe(a)})}else return this._player.loadVideo(t,r);else if(Array.isArray(t)){if(r!=null&&r.protocol)throw new Error(`Protocol ${r.protocol} can't be used with TAMS media`);const i=this._tamsEndpoint??ym(t.at(0)).at(0);if(i===null)throw Error("Provided URL is not pointing to TAMS");const n=new Sm(i,this._authenticationData?wm(this._authenticationData):void 0),o=(r==null?void 0:r.timerange)??(r==null?void 0:r.duration);return na(a=>{n.fetchManifestResourcesForMultipleFlows(t,o).pipe(ei(u=>this._loadTamsMedia(u,r).pipe(nu(s=>{var c;return s.tamsMediaData&&(s.tamsMediaData.flow=void 0,(c=s.tamsMediaData.flowsSegments)==null||c.delete(Ir)),s})))).subscribe(a)})}else return this._loadTamsMedia(t,r)}_loadTamsMedia(t,r){return na(i=>{const n=lh([t.flow,...t.subflows??[]],t.flowsSegments,r==null?void 0:r.ffomTimeZoneOffset),o={protocol:"hls",ffom:n.ffom,frameRate:n.frameRate,dropFrame:n.dropFrame};let a;r?(r.protocol="hls",a={...o,...r,ffom:o.ffom}):a=o,delete a.duration,this._videoApiProxy.requestedDuration=r==null?void 0:r.duration;const u=Va(t.flow,t.subflows,t.flowsSegments);if(!u.valid){i.error(u.message);return}if(r&&!c1(r)){i.error("Invalid ffomTimeZoneOffset");return}h1.slewSubtitlesFlows(t,n).pipe(ei(s=>{const c=new Map([...t.flowsSegments,...s]),l=Ba(t.flow,t.subflows,c);return this._player.loadVideo(l.url,a).pipe(nu(d=>{this._videoApiProxy.mediaStartTime=n.mediaStartTime;const f=g1.generateThumbnailTrackUrl(t.subflows??[],c,this._player.video.getDuration()+n.mediaStartTime,n.mediaStartTime);return f&&this._player.chroming.setThumbnailVttUrl(f),{...d,mediaStartTime:n.mediaStartTime,tamsMediaData:r!=null&&r.returnTamsMediaData?t:void 0,thumbnailVttTrackUrl:f,videoUrls:l.video,audioUrls:l.audio,textUrls:l.text}}),qh(d=>{this._videoApiProxy.setTamsVideo(d),this._videoApiProxy.emitVideoLoadedEvent()}))})).subscribe(i)})}createTimeline(t){return this._player.createTimeline(t)}createMarkerList(t){return this._player.createMarkerList(t)}initializeRouterVisualization(t){return this._player.initializeRouterVisualization(t)}setAuthentication(t){return this._authenticationData=t,this._player.setAuthentication(t)}get timeline(){return this._player.timeline}get audio(){return this._player.audio}get subtitles(){return this._player.subtitles}get config(){return this._player.config}set config(t){this._player.config=t}get chroming(){return this._player.chroming}destroy(){return this._player.destroy()}get video(){return this._videoApiProxy.proxy}setTamsEndpoint(t){this._tamsEndpoint=t}}class v1{constructor(t){k(this,"_lanes",[]);k(this,"_markersLaneMap",new Map);k(this,"_laneNodenMap",new Map);this.omakasePlayer=t}addMarkerLane(t){const r={config:t,type:"marker"};this._lanes.push(r)}addMarkers(t,r){this._markersLaneMap.get(t)===void 0&&this._markersLaneMap.set(t,[]),this._markersLaneMap.get(t).push(...r)}addTimelineNode(t,r){this._laneNodenMap.get(t)||this._laneNodenMap.set(t,[]),this._laneNodenMap.get(t).push(r)}addThumbnailLane(t){const r={config:t,type:"thumbnail"};this._lanes.push(r)}addLabelLane(t){const r={config:t,type:"label"};this._lanes.push(r)}addSubtitlesLane(t){const r={config:t,type:"subtitles"};this._lanes.push(r)}buildAndAttachTimeline(t){this.omakasePlayer.createTimeline(t).subscribe({next:r=>{this.buildAttachedTimeline(r)}})}buildAttachedTimeline(t){this._lanes.forEach(r=>this._createAndAttachLane(t,r))}_createAndAttachLane(t,r){let i;if(r.type==="marker"){i=new M.MarkerLane(r.config),t.addTimelineLane(i);const o=this._markersLaneMap.get(i.id);o==null||o.forEach(a=>i.addMarker(a))}else r.type==="thumbnail"?(i=new M.ThumbnailLane(r.config),t.addTimelineLane(i)):r.type==="label"?(i=new M.LabelLane(r.config),t.addTimelineLane(i)):r.type==="subtitles"&&(i=new M.SubtitlesLane(r.config),t.addTimelineLane(i));const n=this._laneNodenMap.get(i.id);n==null||n.forEach(o=>{i.addTimelineNode(o.config)})}}var ca=function(e,t){return ca=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},ca(e,t)};function rn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ca(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function b1(e,t,r,i){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function u(l){try{c(i.next(l))}catch(d){a(d)}}function s(l){try{c(i.throw(l))}catch(d){a(d)}}function c(l){l.done?o(l.value):n(l.value).then(u,s)}c((i=i.apply(e,t||[])).next())})}function Nm(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(i=1,n&&(o=c[0]&2?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],n=0}finally{i=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $t(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function xr(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var i=r.call(e),n,o=[],a;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}function Tr(e,t,r){if(r||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function _1(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(m){return function(h){return Promise.resolve(h).then(m,d)}}function u(m,h){i[m]&&(n[m]=function(p){return new Promise(function(v,w){o.push([m,p,v,w])>1||s(m,p)})},h&&(n[m]=h(n[m])))}function s(m,h){try{c(i[m](h))}catch(p){f(o[0][3],p)}}function c(m){m.value instanceof wt?Promise.resolve(m.value.v).then(l,d):f(o[0][2],m)}function l(m){s("next",m)}function d(m){s("throw",m)}function f(m,h){m(h),o.shift(),o.length&&s(o[0][0],o[0][1])}}function y1(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof $t=="function"?$t(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(o){r[o]=e[o]&&function(a){return new Promise(function(u,s){a=e[o](a),n(u,s,a.done,a.value)})}}function n(o,a,u,s){Promise.resolve(s).then(function(c){o({value:c,done:u})},a)}}typeof SuppressedError=="function"&&SuppressedError;function re(e){return typeof e=="function"}function sa(e){var t=function(i){Error.call(i),i.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var la=sa(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
102
102
|
`+r.map(function(i,n){return n+1+") "+i.toString()}).join(`
|
|
103
103
|
`):"",this.name="UnsubscriptionError",this.errors=r}});function da(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var zr=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,i,n,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=$t(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(p){t={error:p}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(re(l))try{l()}catch(p){o=p instanceof la?p.errors:[p]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=$t(d),m=f.next();!m.done;m=f.next()){var h=m.value;try{Am(h)}catch(p){o=o??[],p instanceof la?o=Tr(Tr([],xr(o)),xr(p.errors)):o.push(p)}}}catch(p){i={error:p}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}}if(o)throw new la(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Am(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&da(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&da(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),jm=zr.EMPTY;function Pm(e){return e instanceof zr||e&&"closed"in e&&re(e.remove)&&re(e.add)&&re(e.unsubscribe)}function Am(e){re(e)?e():e.unsubscribe()}var $1={Promise:void 0},w1={setTimeout:function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return setTimeout.apply(void 0,Tr([e,t],xr(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Lm(e){w1.setTimeout(function(){throw e})}function fa(){}function Er(e){e()}var ma=(function(e){rn(t,e);function t(r){var i=e.call(this)||this;return i.isStopped=!1,r?(i.destination=r,Pm(r)&&r.add(i)):i.destination=I1,i}return t.create=function(r,i,n){return new pa(r,i,n)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(zr),S1=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(i){Or(i)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(i){Or(i)}else Or(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Or(r)}},e})(),pa=(function(e){rn(t,e);function t(r,i,n){var o=e.call(this)||this,a;return re(r)||!r?a={next:r??void 0,error:i??void 0,complete:n??void 0}:a=r,o.destination=new S1(a),o}return t})(ma);function Or(e){Lm(e)}function k1(e){throw e}var I1={closed:!0,next:fa,error:k1,complete:fa},ha=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ur(e){return e}function x1(e){return e.length===0?Ur:e.length===1?e[0]:function(r){return e.reduce(function(i,n){return n(i)},r)}}var ve=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,i){var n=this,o=z1(t)?t:new pa(t,r,i);return Er(function(){var a=n,u=a.operator,s=a.source;o.add(u?u.call(o,s):s?n._subscribe(o):n._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var i=this;return r=Cm(r),new r(function(n,o){var a=new pa({next:function(u){try{t(u)}catch(s){o(s),a.unsubscribe()}},error:o,complete:n});i.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[ha]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return x1(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Cm(t),new t(function(i,n){var o;r.subscribe(function(a){return o=a},function(a){return n(a)},function(){return i(o)})})},e.create=function(t){return new e(t)},e})();function Cm(e){var t;return(t=e??$1.Promise)!==null&&t!==void 0?t:Promise}function T1(e){return e&&re(e.next)&&re(e.error)&&re(e.complete)}function z1(e){return e&&e instanceof ma||T1(e)&&Pm(e)}function E1(e){return re(e==null?void 0:e.lift)}function Ke(e){return function(t){if(E1(t))return t.lift(function(r){try{return e(r,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}function Je(e,t,r,i,n){return new O1(e,t,r,i,n)}var O1=(function(e){rn(t,e);function t(r,i,n,o,a,u){var s=e.call(this,r)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=i?function(c){try{i(c)}catch(l){r.error(l)}}:e.prototype._next,s._error=o?function(c){try{o(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=n?function(){try{n()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;e.prototype.unsubscribe.call(this),!i&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(ma),U1=sa(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),rt=(function(e){rn(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var i=new Zm(this,this);return i.operator=r,i},t.prototype._throwIfClosed=function(){if(this.closed)throw new U1},t.prototype.next=function(r){var i=this;Er(function(){var n,o;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var a=$t(i.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(r)}}catch(c){n={error:c}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}})},t.prototype.error=function(r){var i=this;Er(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=r;for(var n=i.observers;n.length;)n.shift().error(r)}})},t.prototype.complete=function(){var r=this;Er(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var i=r.observers;i.length;)i.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var i=this,n=this,o=n.hasError,a=n.isStopped,u=n.observers;return o||a?jm:(this.currentObservers=null,u.push(r),new zr(function(){i.currentObservers=null,da(u,r)}))},t.prototype._checkFinalizedStatuses=function(r){var i=this,n=i.hasError,o=i.thrownError,a=i.isStopped;n?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new ve;return r.source=this,r},t.create=function(r,i){return new Zm(r,i)},t})(ve),Zm=(function(e){rn(t,e);function t(r,i){var n=e.call(this)||this;return n.destination=r,n.source=i,n}return t.prototype.next=function(r){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.next)===null||n===void 0||n.call(i,r)},t.prototype.error=function(r){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.error)===null||n===void 0||n.call(i,r)},t.prototype.complete=function(){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||i===void 0||i.call(r)},t.prototype._subscribe=function(r){var i,n;return(n=(i=this.source)===null||i===void 0?void 0:i.subscribe(r))!==null&&n!==void 0?n:jm},t})(rt),D1=new ve(function(e){return e.complete()});function N1(e){return e&&re(e.schedule)}function Mm(e){return e[e.length-1]}function j1(e){return re(Mm(e))?e.pop():void 0}function P1(e){return N1(Mm(e))?e.pop():void 0}var Fm=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function Rm(e){return re(e==null?void 0:e.then)}function Vm(e){return re(e[ha])}function Bm(e){return Symbol.asyncIterator&&re(e==null?void 0:e[Symbol.asyncIterator])}function Km(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function A1(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Jm=A1();function Gm(e){return re(e==null?void 0:e[Jm])}function qm(e){return _1(this,arguments,function(){var r,i,n,o;return Nm(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,wt(r.read())];case 3:return i=a.sent(),n=i.value,o=i.done,o?[4,wt(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,wt(n)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Wm(e){return re(e==null?void 0:e.getReader)}function Dr(e){if(e instanceof ve)return e;if(e!=null){if(Vm(e))return L1(e);if(Fm(e))return C1(e);if(Rm(e))return Z1(e);if(Bm(e))return Hm(e);if(Gm(e))return M1(e);if(Wm(e))return F1(e)}throw Km(e)}function L1(e){return new ve(function(t){var r=e[ha]();if(re(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function C1(e){return new ve(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Z1(e){return new ve(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Lm)})}function M1(e){return new ve(function(t){var r,i;try{for(var n=$t(e),o=n.next();!o.done;o=n.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(u){r={error:u}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}t.complete()})}function Hm(e){return new ve(function(t){R1(e,t).catch(function(r){return t.error(r)})})}function F1(e){return Hm(qm(e))}function R1(e,t){var r,i,n,o;return b1(this,void 0,void 0,function(){var a,u;return Nm(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=y1(e),s.label=1;case 1:return[4,r.next()];case 2:if(i=s.sent(),!!i.done)return[3,4];if(a=i.value,t.next(a),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),n={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),i&&!i.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Ge(e,t,r,i,n){i===void 0&&(i=0),n===void 0&&(n=!1);var o=t.schedule(function(){r(),n?e.add(this.schedule(null,i)):this.unsubscribe()},i);if(e.add(o),!n)return o}function Xm(e,t){return t===void 0&&(t=0),Ke(function(r,i){r.subscribe(Je(i,function(n){return Ge(i,e,function(){return i.next(n)},t)},function(){return Ge(i,e,function(){return i.complete()},t)},function(n){return Ge(i,e,function(){return i.error(n)},t)}))})}function Ym(e,t){return t===void 0&&(t=0),Ke(function(r,i){i.add(e.schedule(function(){return r.subscribe(i)},t))})}function V1(e,t){return Dr(e).pipe(Ym(t),Xm(t))}function B1(e,t){return Dr(e).pipe(Ym(t),Xm(t))}function K1(e,t){return new ve(function(r){var i=0;return t.schedule(function(){i===e.length?r.complete():(r.next(e[i++]),r.closed||this.schedule())})})}function J1(e,t){return new ve(function(r){var i;return Ge(r,t,function(){i=e[Jm](),Ge(r,t,function(){var n,o,a;try{n=i.next(),o=n.value,a=n.done}catch(u){r.error(u);return}a?r.complete():r.next(o)},0,!0)}),function(){return re(i==null?void 0:i.return)&&i.return()}})}function Qm(e,t){if(!e)throw new Error("Iterable cannot be null");return new ve(function(r){Ge(r,t,function(){var i=e[Symbol.asyncIterator]();Ge(r,t,function(){i.next().then(function(n){n.done?r.complete():r.next(n.value)})},0,!0)})})}function G1(e,t){return Qm(qm(e),t)}function q1(e,t){if(e!=null){if(Vm(e))return V1(e,t);if(Fm(e))return K1(e,t);if(Rm(e))return B1(e,t);if(Bm(e))return Qm(e,t);if(Gm(e))return J1(e,t);if(Wm(e))return G1(e,t)}throw Km(e)}function ep(e,t){return t?q1(e,t):Dr(e)}var tp=sa(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function W1(e,t){return Ke(function(r,i){var n=0;r.subscribe(Je(i,function(o){i.next(e.call(t,o,n++))}))})}var H1=Array.isArray;function X1(e,t){return H1(t)?e.apply(void 0,Tr([],xr(t))):e(t)}function Y1(e){return W1(function(t){return X1(e,t)})}var Q1=Array.isArray,e0=Object.getPrototypeOf,t0=Object.prototype,n0=Object.keys;function r0(e){if(e.length===1){var t=e[0];if(Q1(t))return{args:t,keys:null};if(i0(t)){var r=n0(t);return{args:r.map(function(i){return t[i]}),keys:r}}}return{args:e,keys:null}}function i0(e){return e&&typeof e=="object"&&e0(e)===t0}function o0(e,t){return e.reduce(function(r,i,n){return r[i]=t[n],r},{})}function a0(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=P1(e),i=j1(e),n=r0(e),o=n.args,a=n.keys;if(o.length===0)return ep([],r);var u=new ve(u0(o,r,a?function(s){return o0(a,s)}:Ur));return i?u.pipe(Y1(i)):u}function u0(e,t,r){return r===void 0&&(r=Ur),function(i){np(t,function(){for(var n=e.length,o=new Array(n),a=n,u=n,s=function(l){np(t,function(){var d=ep(e[l],t),f=!1;d.subscribe(Je(i,function(m){o[l]=m,f||(f=!0,u--),u||i.next(r(o.slice()))},function(){--a||i.complete()}))},i)},c=0;c<n;c++)s(c)},i)}}function np(e,t,r){e?Ge(r,e,t):t()}function c0(e,t){return Ke(function(r,i){var n=0;r.subscribe(Je(i,function(o){return e.call(t,o,n++)&&i.next(o)}))})}function s0(e){return Ke(function(t,r){var i=!1;t.subscribe(Je(r,function(n){i=!0,r.next(n)},function(){i||r.next(e),r.complete()}))})}function l0(e){return e<=0?function(){return D1}:Ke(function(t,r){var i=0;t.subscribe(Je(r,function(n){++i<=e&&(r.next(n),e<=i&&r.complete())}))})}function d0(e){return e===void 0&&(e=f0),Ke(function(t,r){var i=!1;t.subscribe(Je(r,function(n){i=!0,r.next(n)},function(){return i?r.complete():r.error(e())}))})}function f0(){return new tp}function St(e,t){var r=arguments.length>=2;return function(i){return i.pipe(Ur,l0(1),r?s0(t):d0(function(){return new tp}))}}function ue(e){return Ke(function(t,r){Dr(e).subscribe(Je(r,function(){return r.complete()},fa)),!r.closed&&t.subscribe(r)})}class m0{constructor(){k(this,"actionZoomIn");k(this,"actionZoomOut");k(this,"actionResetZoom");k(this,"actionToggleNextAudioTrack");k(this,"actionTogglePreviousAudioTrack");k(this,"actionToggleCti")}getKeyboardShortcutsHelpMenuGroup(){let t=(...n)=>n.join(" + "),r="shift".toUpperCase();return{name:"Timeline function shortcuts",items:[{description:"Timeline Zoom In",name:t("=")},{description:"Timeline Zoom Out",name:t("-")},{description:"Timeline Zoom level 100%",name:t("0")},{description:"Toggle Next Audio Track",name:t(r,"e")},{description:"Toggle Previous Audio Track",name:t("e")},{description:"Toggle CTI into / out-of Interactive Mode",name:t("'")}]}}handleKeyboardEvent(t){const r=t.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(r.tagName.toUpperCase())?!1:t.code==="Equal"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionZoomIn&&this.actionZoomIn(),!0):t.code==="Minus"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionZoomOut&&this.actionZoomOut(),!0):t.code==="Digit0"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionResetZoom&&this.actionResetZoom(),!0):t.code==="KeyE"&&!t.ctrlKey&&!t.metaKey?(t.shiftKey?this.actionToggleNextAudioTrack&&this.actionToggleNextAudioTrack():this.actionTogglePreviousAudioTrack&&this.actionTogglePreviousAudioTrack(),!0):t.code==="Quote"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionToggleCti&&this.actionToggleCti(),!0):!1}}const p0=y.memo(({omakasePlayer:e,onTimelineCreatedCallback:t,timelineConfig:r,enableHotKeys:i})=>(y.useEffect(()=>{if(r.timelineHTMLElementId===void 0&&(r.timelineHTMLElementId="omakase-timeline"),e.createTimeline(r).subscribe({next:n=>{a0([e.timeline.onReady$,e.video.onVideoLoaded$.pipe(c0(o=>!!o))]).subscribe({next:()=>t(n)})}}),i===void 0||i){const n=new m0;n.actionToggleCti=()=>{var u;return(u=e.timeline)==null?void 0:u.toggleTimecodeEdit()},n.actionResetZoom=()=>{var u;return(u=e.timeline)==null?void 0:u.zoomToEased(100)},n.actionZoomIn=()=>{var u;return(u=e.timeline)==null?void 0:u.zoomInEased()},n.actionZoomOut=()=>{var u;return(u=e.timeline)==null?void 0:u.zoomOutEased()};const o=u=>{const s=e.audio.getAudioTracks(),c=e.audio.getActiveAudioTrack(),d=s.findIndex(f=>f.id===(c==null?void 0:c.id))+(u?-1:1);d>=0&&d<s.length&&e.audio.setActiveAudioTrack(s.at(d).id)};n.actionTogglePreviousAudioTrack=()=>o(!0),n.actionToggleNextAudioTrack=()=>o(!1);const a=u=>{n.handleKeyboardEvent(u)&&(u.preventDefault(),u.stopPropagation())};return window.addEventListener("keydown",a),e.chroming.appendHelpMenuGroup(n.getKeyboardShortcutsHelpMenuGroup()),()=>{window.removeEventListener("keydown",a)}}},[e]),y.createElement("div",{id:r.timelineHTMLElementId})));class rp{static get window(){return window}static get navigator(){return window.navigator}static get userAgent(){var r;const t=((r=this.navigator)==null?void 0:r.userAgent)||"";return/Android/i.test(t)?"android":/Firefox/i.test(t)?"firefox":/Edg/i.test(t)?"edge":(/Chrome/i.test(t)||/CriOS/i.test(t))&&!/Edg/i.test(t)?"chrome":/Chrome/i.test(t)||/CriOS/i.test(t)?"chromium":/Safari/i.test(t)?"safari":"unknown"}static get platform(){var r,i,n;const t=((i=(r=this.navigator)==null?void 0:r.userAgentData)==null?void 0:i.platform)||((n=this.navigator)==null?void 0:n.platform);return t!=null&&t.toUpperCase().includes("MAC")?"macos":t!=null&&t.toUpperCase().includes("WIN")?"windows":t!=null&&t.toUpperCase().includes("LINUX")?"linux":"unknown"}static isUserAgent(t){return this.userAgent===t}static isPlatform(t){return this.platform===t}static open(t,r="_blank"){this.window.open(t,r)}}const on=[.25,.5,.75,1,2,4,8];class Nr{static getKeyboardShortcutsHelpMenuGroup(){let t=(...o)=>o.join(" + "),r="shift".toUpperCase(),i="ctrl".toUpperCase();return{name:"Playback function shortcuts",items:[{description:"Play / Pause",name:t("Space")},{description:"Toggle Sound",name:t("s")},{description:"Toggle Text On / Off",name:t("d")},{description:"Toggle Full Screen",name:t("f")},{description:"Increase Volume",name:t(r,"\\")},{description:"Reduce Volume",name:t("\\")},{description:"One Frame Forward",name:t("Right Arrow")},{description:"One Frame Backward",name:t("Left Arrow")},{description:"10 Frames Forward",name:t(r,"Right Arrow")},{description:"10 Frames Backwards",name:t(r,"Left Arrow")},{description:"Stop shuttle and pause",name:t("k")},{description:"Decrease Shuttle Forwards",name:t("l")},{description:"Increase Shuttle Forwards",name:t(r,"l")},{description:"Set playhead to Start of Media and Stop",name:t("1 / Home")},{description:"Set playhead to End of Media and Stop",name:t(i,"1")+" / End"}]}}static handleKeyboardEvent(t,r){const i=t.target,n=["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"],o=rp.userAgent;if(n.includes(i.tagName.toUpperCase()))return!1;if(r&&r.video){if(t.code==="Space"&&(o!=="safari"||!r.video.isFullscreen()))return r.video.togglePlayPause(),!0;if(t.code==="KeyS"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey)return r.audio.toggleAudioOutputMuteUnmute(),!0;if(t.code==="Backslash"){let a=10,u=t.shiftKey?1:-1,s=r.audio.getAudioOutputVolume()*100+a*u;s>=100?s=100:s<=0&&(s=0),r.audio.setAudioOutputVolume(s/100)}if(t.code==="KeyD"&&!(t.ctrlKey&&t.shiftKey&&t.metaKey))return r.subtitles.toggleShowHideActiveTrack(),!0;if(t.code==="KeyK"&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey&&(r.video.setPlaybackRate(1),r.video.pause()),t.code==="KeyL"&&!t.ctrlKey&&!t.metaKey){let a=t.shiftKey?1:-1;const u=on.indexOf(r.video.getPlaybackRate())+a;let s;return u<0?s=on.at(0):u>=on.length?s=on.at(-1):s=on.at(u),r.video.setPlaybackRate(s),r.video.isPaused()&&r.video.play(),!0}if(r.video.isVideoLoaded()){if(["ArrowLeft","ArrowRight"].includes(t.key)&&!t.metaKey&&!t.altKey){let a=t.key==="ArrowRight"?1:-1,u=t.shiftKey?10:1;return r.video.isPlaying()&&r.video.pause(),r.video.seekFromCurrentFrame(u*a),!0}if(t.code==="Digit1"&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey&&!t.altKey||t.code==="Home")return r.video.pause().subscribe(()=>r.video.seekToFrame(0)),!0;if(t.code==="Digit1"&&t.ctrlKey||t.code==="End")return r.video.isPlaying()?r.video.pause().subscribe(()=>r.video.seekToEnd()):r.video.seekToEnd(),!0}if(t.code==="KeyF"&&!t.ctrlKey&&!t.shiftKey&&!t.metaKey)return r.video.toggleFullscreen(),!0}return!1}}const h0=y.memo(function({videoUrl:t,config:r,videoLoadOptions:i,onVideoLoadedCallback:n,enableHotkeys:o}){return r&&(r==null?void 0:r.playerHTMLElementId)===void 0&&(r.playerHTMLElementId="omakase-player"),y.useEffect(()=>{var s,c;let a=new M.OmakasePlayer(r);const u=l=>{Nr.handleKeyboardEvent(l,a)&&(l.stopPropagation(),l.preventDefault())};return(o===void 0||o)&&((s=document.querySelector("media-controller"))==null||s.setAttribute("nohotkeys",""),(c=document.querySelector("media-controller"))==null||c.setAttribute("tabindex","-1"),window.addEventListener("keydown",u),a.chroming.appendHelpMenuGroup(Nr.getKeyboardShortcutsHelpMenuGroup())),a.loadVideo(t,i).subscribe({next:l=>{n&&n(a,l)}}),()=>{(o===void 0||o)&&window.removeEventListener("keydown",u)}},[t]),y.createElement("div",{id:r.playerHTMLElementId})}),g0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"}),y.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:"currentColor"})),v0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"}),y.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:"currentColor"})),b0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"})),_0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"})),y0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("path",{d:"M11.3475 3H5.775V21L11.3475 17.0475V3Z",fill:"currentColor"}),y.createElement("path",{d:"M18.225 21L12.6525 17.0475V3H18.225V21ZM13.7775 16.47L17.1 18.825V4.125H13.7775V16.47Z",fill:"currentColor"})),$0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("path",{d:"M4.6875 3V21L8.0625 17.0475L11.4375 21V3H4.6875Z",fill:"currentColor"}),y.createElement("path",{d:"M12.5625 3V21L15.9375 17.0475L19.3125 21V3H12.5625Z",fill:"currentColor"})),w0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"})),S0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.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:"currentColor"}),y.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:"currentColor"})),k0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("g",{clipPath:"url(#clip0_3377_237)"},y.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:"currentColor"}),y.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:"currentColor"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_3377_237"},y.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),I0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("g",{clipPath:"url(#clip0_3377_260)"},y.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:"currentColor"}),y.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:"currentColor"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_3377_260"},y.createElement("rect",{width:"18",height:"15.95",fill:"white",transform:"translate(3 4)"})))),Se=({Icon:e,onClick:t,width:r,height:i,text:n,disabled:o})=>y.createElement("button",{disabled:o,onClick:t},y.createElement(e,{width:r,height:i})," ",n),x0=({width:e,height:t})=>y.createElement("svg",{width:e??24,height:t??24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("path",{d:"M12.6525 17.0475L18.225 21V3H12.6525V17.0475Z",fill:"currentColor"}),y.createElement("path",{d:"M5.775 3H11.3475V17.0475L5.775 21V3ZM10.2225 4.125H6.9V18.825L10.2225 16.47V4.125Z",fill:"currentColor"})),T0=({width:e,height:t})=>y.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("rect",{x:"0.5",y:"0.5",width:"13",height:"13",rx:"2.5",stroke:"currentColor"}),y.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:"currentColor",stroke:"currentColor"}));function xe(e){e.next(),e.complete()}class z0{constructor(){k(this,"actionMarkerInOut");k(this,"actionMarkerSplit");k(this,"actionMarkerDelete");k(this,"actionPreviousMarkerToggle");k(this,"actionNextMarkerToggle");k(this,"actionSetMarkerStartToPlayhead");k(this,"actionSetMarkerEndToPlayhead");k(this,"actionSetPlayheadToMarkerStart");k(this,"actionSetPlayheadToMarkerEnd");k(this,"actionRewind3SecondsAndPlayToCurrent");k(this,"actionPlay3SecondsAndRewindToCurrent");k(this,"actionLoopActiveMarker")}getKeyboardShortcutsHelpMenuGroup(){let t=(...a)=>a.join(" + "),r="shift".toUpperCase();const i=rp.platform;let n=i==="windows"?"win":i==="linux"?"super":"cmd";return{name:"Segmentation function shortcuts",items:[{description:"Mark In / Out",name:t("m")},{description:"Split Active Marker",name:t(".")},{description:"Delete Active Marker",name:t("n")},{description:"Toggle Previous Marker",name:t("/")},{description:"Toggle Next Marker",name:t(r,"/")},{description:"Set Start of Active Marker to Playhead Position",name:t("i")},{description:"Set End of Active Marker to Playhead Position",name:t("o")},{description:"Set Playhead to Start of Active Marker",name:t("[")},{description:"Set Playhead to End of Active Marker",name:t("]")},{description:"Rewind 3 Seconds and Play to Current Playhead",name:t(n,"Arrow Left")},{description:"Play 3 Seconds and Rewind to Current Playhead",name:t(n,"Arrow Right")},{description:"Loop on Active Marker",name:t("p")}]}}handleKeyboardEvent(t,r){const i=t.target;return["INPUT","TEXTAREA","OMAKASE-MARKER-LIST"].includes(i.tagName.toUpperCase())?!1:t.code==="KeyM"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionMarkerInOut&&this.actionMarkerInOut(),!0):t.code==="Period"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionMarkerSplit&&this.actionMarkerSplit(),!0):t.code==="KeyN"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionMarkerDelete&&this.actionMarkerDelete(),!0):t.code==="Slash"&&!t.ctrlKey&&!t.metaKey?(t.shiftKey?this.actionNextMarkerToggle&&this.actionNextMarkerToggle():this.actionPreviousMarkerToggle&&this.actionPreviousMarkerToggle(),!0):t.code==="KeyI"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionSetMarkerStartToPlayhead&&this.actionSetMarkerStartToPlayhead(),!0):t.code==="KeyO"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionSetMarkerEndToPlayhead&&this.actionSetMarkerEndToPlayhead(),!0):t.code==="BracketLeft"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionSetPlayheadToMarkerStart&&this.actionSetPlayheadToMarkerStart(),!0):t.code==="BracketRight"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionSetPlayheadToMarkerEnd&&this.actionSetPlayheadToMarkerEnd(),!0):t.code==="ArrowLeft"&&!t.shiftKey&&!t.ctrlKey&&t.metaKey?(this.actionRewind3SecondsAndPlayToCurrent&&this.actionRewind3SecondsAndPlayToCurrent(),!0):t.code==="ArrowRight"&&!t.shiftKey&&!t.ctrlKey&&t.metaKey?(this.actionPlay3SecondsAndRewindToCurrent&&this.actionPlay3SecondsAndRewindToCurrent(),!0):t.code==="KeyP"&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey?(this.actionLoopActiveMarker&&this.actionLoopActiveMarker(),!0):!1}}const an=(e,t,r)=>e.getMarkers().reduce((i,n)=>{if(t.id===n.id)return i;if(n instanceof M.PeriodMarker&&n.timeObservation.start!=null&&n.timeObservation.end!=null){const o=t.timeObservation,a=n.timeObservation.start,u=n.timeObservation.end,s=(r==null?void 0:r.start)??o.start,c=(r==null?void 0:r.end)??o.end;if(Number.isFinite(s)&&Number.isFinite(c))return i||s<=u&&c>=a;if(Number.isFinite(s))return i||s>=a&&s<=u;if(Number.isFinite(c))return i||c>=a&&c<=u}return i},!1);function jr(e,t,r){if(!e||!(e instanceof M.PeriodMarker)||!r.video.isVideoLoaded())return!0;const i=e.timeObservation.start,n=e.timeObservation.end;if(i==null||n==null)return!0;const o=r.video.calculateTimeToFrame(n),a=r.video.calculateTimeToFrame(i),u=r.video.getCurrentFrame();return t<i||o-u<2||u-a<1}function Pr(e){return!(e.timeObservation.start==null||e.timeObservation.end==null)}const E0=({selectedMarker:e,omakasePlayer:t,enableHotKeys:r,segmentationLanes:i,setSegmentationLanes:n,setSelectedMarker:o,onMarkerClickCallback:a,setSource:u,source:s,constants:c})=>{const l=y.useRef(void 0),d=y.useRef(void 0),f=y.useRef(new rt),m=y.useRef(!1),h=S=>{if(E===void 0||!t.video.isVideoLoaded())return!0;const x=E.timeObservation.start,L=S??t.video.getCurrentTime();return!!(x==null||x>=L||an(s,E,{end:L}))},p=S=>{if(E!==void 0||s===void 0||!t.video.isVideoLoaded())return!0;const x=S??t.video.getCurrentTime(),L=t.video.calculateTimeToFrame(x);if(L+1>t.video.getTotalFrames())return!0;const H=new M.PeriodMarker({timeObservation:{start:t.video.calculateFrameToTime(L),end:t.video.calculateFrameToTime(L+2)}});return an(s,H)},[v,w]=y.useState(void 0),[O,z]=y.useState(jr(e,t.video.getCurrentTime(),t)),[E,R]=y.useState(void 0),[V,ee]=y.useState(h()),[ie,Q]=y.useState(p()),Ne=S=>{if(S===void 0||s===void 0||!(S instanceof M.PeriodMarker))return!0;const x=an(s,S,{start:t.video.getCurrentTime()});if(x)return x;if(S instanceof M.PeriodMarker){const L=S.timeObservation.end;if(L!=null&&t.video.getCurrentTime()>=L)return!0}return!1},de=S=>{if(S===void 0||s===void 0||!(S instanceof M.PeriodMarker))return!0;const x=an(s,S,{end:t.video.getCurrentTime()});if(x)return x;if(S instanceof M.PeriodMarker){if(S.timeObservation.end==null)return!0;const L=S.timeObservation.start;if(L!=null&&t.video.getCurrentTime()<=L)return!0}return!1},[it,qe]=y.useState(Ne(e)),[kt,te]=y.useState(de(e));y.useEffect(()=>{if(ee(()=>h()),Q(()=>p()),E&&E!==e){const S=i.find(x=>x.getMarker(E.id));S==null||S.removeMarker(E.id),R(void 0)}},[e,E,i,R]),y.useEffect(()=>()=>xe(f.current),[]),y.useEffect(()=>{if(qe(Ne(e)),te(de(e)),e){const S=jr(e,t.video.getCurrentTime(),t);z(S);const x=t.video.onVideoTimeChange$.pipe(ue(f.current)).subscribe({next:L=>{z(H=>jr(e,L.currentTime,t)),qe(()=>Ne(e)),te(()=>de(e))}});return()=>x.unsubscribe()}},[e]),y.useEffect(()=>{t.video.onSeeking$.pipe(ue(f.current)).subscribe({next:x=>{ee(()=>h(x.toTime)),Q(()=>p(x.toTime))}});const S=t.video.onVideoTimeChange$.pipe(ue(f.current)).subscribe({next:x=>{ee(()=>h()),Q(()=>p())}});return()=>S.unsubscribe()},[E,s]),y.useEffect(()=>{const S=i.map(x=>x.onMarkerUpdate$.pipe(ue(f.current)).subscribe({next:L=>{(e==null?void 0:e.id)===L.marker.id&&(z(H=>jr(e,t.video.getCurrentTime(),t)),qe(()=>Ne(e)),te(()=>de(e)))}}));return()=>S.forEach(x=>x.unsubscribe())},[i,e]),y.useEffect(()=>{v&&(v.marker.style={...v.marker.style,color:v.color},v.marker.timeObservation={...v.marker.timeObservation},w(void 0))},[e]),y.useEffect(()=>{if(s){ee(()=>h()),Q(()=>p());const S=s.onMarkerDelete$.pipe(ue(f.current)).subscribe({next:L=>{const H=L.marker;w(W=>{if((W==null?void 0:W.marker.id)!==H.id)return W}),o(W=>{if((W==null?void 0:W.id)!==H.id)return W}),R(W=>{if((W==null?void 0:W.id)!==H.id)return W}),ee(()=>h()),Q(()=>p())}}),x=s.onMarkerUpdate$.pipe(ue(f.current)).subscribe({next:()=>{ee(()=>h()),Q(()=>p())}});return()=>{S.unsubscribe(),x.unsubscribe()}}},[s]);const B=(S,x)=>{if(x===void 0)return;const L=x.timeObservation;S.video.seekToTime(L.start)},op=(S,x)=>{if(x===void 0)return;const L=x.timeObservation;S.video.seekToTime(L.end)},ap=(S,x)=>{x instanceof M.PeriodMarker&&x.timeObservation.start!==void 0&&(x.timeObservation={...x.timeObservation,start:S.video.getCurrentTime()})},up=(S,x)=>{x instanceof M.PeriodMarker&&x.timeObservation.end!==void 0&&(x.timeObservation={...x.timeObservation,end:S.video.getCurrentTime()})},cp=(S,x)=>{l.current&&xe(l.current),l.current=new rt,S.video.pause();const L=S.video.getCurrentFrame(),H=S.video.getFrameRate(),W=L-x*H,We=W>=0?W:0;S.video.seekToFrame(We).pipe(St()).subscribe(()=>{}),S.video.play(),S.video.onVideoTimeChange$.pipe(ue(l.current),ue(f.current)).subscribe(Lr=>{Lr.frame>=L-1&&(S.video.pause().subscribe(()=>{S.video.seekToFrame(L).pipe(St()).subscribe(()=>{})}),xe(l.current))})},sp=(S,x)=>{l.current&&xe(l.current),l.current=new rt,d.current&&xe(d.current),d.current=new rt;const L=S.video.getCurrentFrame(),H=S.video.getFrameRate(),W=L+x*H;S.video.play(),S.video.onVideoTimeChange$.pipe(ue(l.current),ue(f.current)).subscribe(We=>{We.frame>=W-1&&(S.video.pause().subscribe(()=>{S.video.seekToFrame(L).pipe(St()).subscribe(()=>{})}),xe(l.current))}),S.video.onEnded$.pipe(ue(d.current),ue(f.current)).subscribe(We=>{setTimeout(()=>{S.video.seekToFrame(L).pipe(St()).subscribe(()=>{})},1),xe(d.current)})},va=S=>{s.removeMarker(S.id),(E==null?void 0:E.id)===S.id&&R(void 0)},lp=(S,x)=>{if(!(x instanceof M.PeriodMarker))return;const L=x.timeObservation.start,H=x.timeObservation.end,W=S.video.getCurrentTime();if(L==null||H==null)return;const We=L,Lr=W,M0=Lr+1/S.video.getFrameRate(),F0=H;va(x);const ba=new M.PeriodMarker({style:c.PERIOD_MARKER_STYLE,timeObservation:{start:We,end:Lr},editable:!0});ba.onClick$.subscribe({next:()=>a(ba)});const un=new M.PeriodMarker({style:c.HIGHLIGHTED_PERIOD_MARKER_STYLE,timeObservation:{start:M0,end:F0},editable:!0});un.onClick$.subscribe({next:()=>a(un)}),s.addMarker(ba),s.addMarker(un),a(un),setTimeout(()=>{w({marker:un,color:c.PERIOD_MARKER_STYLE.color})},0)},dp=()=>{const S=t.video.getCurrentTime(),x=new M.PeriodMarker({timeObservation:{start:S},style:c.PERIOD_MARKER_STYLE,editable:!0});x.onClick$.subscribe({next:()=>a(x)}),s.addMarker(x),R(x),ee(h()),a(x)},fp=()=>{const S=t.video.getCurrentTime();E.timeObservation={...E.timeObservation,end:S},R(void 0)},mp=S=>{l.current&&xe(l.current),l.current=new rt,d.current&&xe(d.current),d.current=new rt;const x=t.video.calculateTimeToFrame(S.timeObservation.start),L=t.video.calculateTimeToFrame(S.timeObservation.end);t.video.pause(),t.video.seekToFrame(x),t.video.play(),t.video.onVideoTimeChange$.pipe(ue(l.current),ue(f.current)).subscribe(H=>{H.frame>=L-1&&(t.video.pause().subscribe(()=>{t.video.seekToFrame(x).pipe(St()).subscribe(()=>{})}),xe(l.current))}),t.video.onEnded$.pipe(ue(d.current),ue(f.current)).subscribe(H=>{setTimeout(()=>{t.video.seekToFrame(x).pipe(St()).subscribe(()=>{})},1),xe(d.current)})},Z0=()=>{const S=i.length,x=`Segmentation ${i.length+1}`,L=new M.MarkerLane({style:c.TIMELINE_LANE_STYLE,description:x});L.onMarkerUpdate$.pipe(ue(f.current)).subscribe({next:H=>{an(L,H.marker)&&(H.marker.timeObservation=H.oldValue.timeObservation)}}),t.timeline.addTimelineLaneAtIndex(L,S+1),n([...i,L]),a(void 0),u(L)},pp=S=>{if(!s)return;const x=s.getMarkers().filter(W=>W instanceof M.PeriodMarker).sort((W,We)=>(W.timeObservation.start??0)-(We.timeObservation.start??0));if(e===void 0){a(x.at(0));return}const H=x.findIndex(W=>W.id===e.id)+(S?-1:1);H>=0&&H<x.length&&a(x.at(H))};return y.useEffect(()=>{if(!r)return;const S=new z0;S.actionLoopActiveMarker=()=>e instanceof M.PeriodMarker&&Pr(e)&&mp(e),S.actionSetPlayheadToMarkerStart=()=>e&&B(t,e),S.actionSetPlayheadToMarkerEnd=()=>e&&e instanceof M.PeriodMarker&&Pr(e)&&op(t,e),S.actionSetMarkerStartToPlayhead=()=>!it&&ap(t,e),S.actionSetMarkerEndToPlayhead=()=>!kt&&up(t,e),S.actionMarkerSplit=()=>!O&&lp(t,e),S.actionMarkerDelete=()=>e&&va(e),S.actionMarkerInOut=()=>{E===void 0?!ie&&dp():!V&&fp()},S.actionPlay3SecondsAndRewindToCurrent=()=>sp(t,3),S.actionRewind3SecondsAndPlayToCurrent=()=>cp(t,3),S.actionNextMarkerToggle=()=>pp(!1),S.actionPreviousMarkerToggle=()=>pp(!0);const x=L=>{S.handleKeyboardEvent(L,t)&&(L.stopPropagation(),L.preventDefault())};return window.addEventListener("keydown",x),m.current||(t.chroming.appendHelpMenuGroup(S.getKeyboardShortcutsHelpMenuGroup()),m.current=!0),()=>window.removeEventListener("keydown",x)}),y.createElement("div",{className:"omakase-player-timeline-controls-toolbar"},y.createElement("div",{className:"omakase-player-timeline-controls-toolbar-control-panel"},y.createElement(Se,{Icon:g0,onClick:()=>B(t,e),disabled:e===void 0}),y.createElement(Se,{Icon:v0,onClick:()=>op(t,e),disabled:e===void 0||e instanceof M.PeriodMarker&&!Pr(e)}),y.createElement(Se,{Icon:b0,onClick:()=>ap(t,e),disabled:it}),y.createElement(Se,{Icon:_0,onClick:()=>up(t,e),disabled:kt}),E===void 0?y.createElement(Se,{Icon:y0,onClick:dp,disabled:ie}):y.createElement(Se,{Icon:x0,onClick:fp,disabled:V}),y.createElement(Se,{Icon:w0,onClick:()=>va(e),disabled:e===void 0}),y.createElement(Se,{Icon:$0,onClick:()=>lp(t,e),disabled:O||e===void 0}),y.createElement(Se,{Icon:S0,onClick:()=>mp(e),disabled:!(e instanceof M.PeriodMarker&&Pr(e))}),y.createElement(Se,{Icon:k0,onClick:()=>cp(t,3)}),y.createElement(Se,{Icon:I0,onClick:()=>sp(t,3)})),y.createElement("div",{className:"omakase-player-timeline-controls-toolbar-control-panel"},y.createElement("div",{className:"segmentation-button-wrapper"},y.createElement(Se,{Icon:T0,text:"NEW SEGMENTATION",onClick:()=>Z0(),disabled:i.length>=3}))))},O0=y.memo(function({flow:t,subflows:r,flowsSegments:i,onVideoLoadedCallback:n,config:o,timerange:a,videoLoadOptions:u,enableHotkeys:s}){return o&&(o==null?void 0:o.playerHTMLElementId)===void 0&&(o.playerHTMLElementId="omakase-player"),y.useEffect(()=>{var d,f;let c=new Dm(o);const l=m=>{Nr.handleKeyboardEvent(m,c)&&(m.stopPropagation(),m.preventDefault())};return(s===void 0||s)&&((d=document.querySelector("media-controller"))==null||d.setAttribute("nohotkeys",""),(f=document.querySelector("media-controller"))==null||f.setAttribute("tabindex","-1"),window.addEventListener("keydown",l),c.video.appendHelpMenuGroup(Nr.getKeyboardShortcutsHelpMenuGroup())),c.loadVideo({flow:t,subflows:r,flowsSegments:i},u).subscribe({next:m=>{n&&n(c,m)}}),()=>{(s===void 0||s)&&window.removeEventListener("keydown",l)}},[t,a]),y.createElement("div",{id:o.playerHTMLElementId})});function U0(e){const t=Math.round(e/60)*60,r=new Date(t*1e3);return`${r.getUTCHours()}h ${r.getUTCMinutes()}min`}function D0(e){const t=Math.round(e/60)*60,r=Math.floor(t/86400),i=new Date(t*1e3);return r>=1?`${r}d ${i.getUTCHours()}h ${i.getUTCMinutes()}min`:`${i.getUTCHours()}h ${i.getUTCMinutes()}min`}const N0=`
|
|
104
104
|
:root {
|