From 81c74a715615f3dee608bafe33570d5efdbe3b44 Mon Sep 17 00:00:00 2001 From: Editor Deployment Bot Date: Tue, 7 May 2024 10:07:10 +0000 Subject: [PATCH] Build Tue May 7 10:07:10 UTC 2024 --- assets/{index-FxIIL7_F.js => index-gsNNkYcJ.js} | 4 ++-- index.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename assets/{index-FxIIL7_F.js => index-gsNNkYcJ.js} (98%) diff --git a/assets/index-FxIIL7_F.js b/assets/index-gsNNkYcJ.js similarity index 98% rename from assets/index-FxIIL7_F.js rename to assets/index-gsNNkYcJ.js index fa013e4bb..10483c8cb 100644 --- a/assets/index-FxIIL7_F.js +++ b/assets/index-gsNNkYcJ.js @@ -50,7 +50,7 @@ Error generating stack: `+rt.message+` `,et+=rt+" ";for(let st=0;st<$.col;++st)et+=" ";et+=`^ `}else et+=it+": "+tt[ot]+` `}}return $.message=et+` -`,$}var parseString_1=parseString;const TOMLParser=tomlParserExports,prettyError=parsePrettyError;function parseString($){globalThis.Buffer&&globalThis.Buffer.isBuffer($)&&($=$.toString("utf8"));const _e=new TOMLParser;try{return _e.parse($),_e.finish()}catch(et){throw prettyError(et,$)}}const parseToml=getDefaultExportFromCjs(parseString_1);var isMergeableObject=function $(_e){return isNonNullObject(_e)&&!isSpecial(_e)};function isNonNullObject($){return!!$&&typeof $=="object"}function isSpecial($){var _e=Object.prototype.toString.call($);return _e==="[object RegExp]"||_e==="[object Date]"||isReactElement($)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement($){return $.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget($){return Array.isArray($)?[]:{}}function cloneUnlessOtherwiseSpecified($,_e){return _e.clone!==!1&&_e.isMergeableObject($)?deepmerge$1(emptyTarget($),$,_e):$}function defaultArrayMerge($,_e,et){return $.concat(_e).map(function(tt){return cloneUnlessOtherwiseSpecified(tt,et)})}function getMergeFunction($,_e){if(!_e.customMerge)return deepmerge$1;var et=_e.customMerge($);return typeof et=="function"?et:deepmerge$1}function getEnumerableOwnPropertySymbols($){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols($).filter(function(_e){return Object.propertyIsEnumerable.call($,_e)}):[]}function getKeys($){return Object.keys($).concat(getEnumerableOwnPropertySymbols($))}function propertyIsOnObject($,_e){try{return _e in $}catch{return!1}}function propertyIsUnsafe($,_e){return propertyIsOnObject($,_e)&&!(Object.hasOwnProperty.call($,_e)&&Object.propertyIsEnumerable.call($,_e))}function mergeObject($,_e,et){var tt={};return et.isMergeableObject($)&&getKeys($).forEach(function(nt){tt[nt]=cloneUnlessOtherwiseSpecified($[nt],et)}),getKeys(_e).forEach(function(nt){propertyIsUnsafe($,nt)||(propertyIsOnObject($,nt)&&et.isMergeableObject(_e[nt])?tt[nt]=getMergeFunction(nt,et)($[nt],_e[nt],et):tt[nt]=cloneUnlessOtherwiseSpecified(_e[nt],et))}),tt}function deepmerge$1($,_e,et){et=et||{},et.arrayMerge=et.arrayMerge||defaultArrayMerge,et.isMergeableObject=et.isMergeableObject||isMergeableObject,et.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var tt=Array.isArray(_e),nt=Array.isArray($),rt=tt===nt;return rt?tt?et.arrayMerge($,_e,et):mergeObject($,_e,et):cloneUnlessOtherwiseSpecified(_e,et)}deepmerge$1.all=function $(_e,et){if(!Array.isArray(_e))throw new Error("first argument should be an array");return _e.reduce(function(tt,nt){return deepmerge$1(tt,nt,et)},{})};var deepmerge_1=deepmerge$1,cjs$1=deepmerge_1;const deepmerge$2=getDefaultExportFromCjs(cjs$1);var define_import_meta_env_default={BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1,VITE_GIT_COMMIT_HASH:"a03c4d0f47147a2c616215d25f4ee2bdc9674432",VITE_APP_BUILD_DATE:"2024-05-07T08:07:58.919Z"};const CONTEXT_SETTINGS_FILE="editor-settings.toml",SRC_SERVER="src-server",SRC_URL="src-url",defaultSettings={id:void 0,allowedCallbackPrefixes:[],callbackUrl:void 0,callbackSystem:void 0,opencast:{url:window.location.origin,name:void 0,password:void 0,local:!0},metadata:{show:!0,configureFields:void 0},trackSelection:{show:!0},thumbnail:{show:!1,simpleMode:!1},subtitles:{show:!1,mainFlavor:"captions",languages:{},icons:void 0,defaultVideoFlavor:void 0}};let configFileSettings,urlParameterSettings,settings;const init=async()=>{let $=window.localStorage.getItem("colorScheme");if($===null||!["light","dark","light-high-contrast","dark-high-contrast"].includes($)){const tt=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",nt=window.matchMedia("(prefers-contrast: more)").matches?"-high-contrast":"";$=`${tt}${nt}`}document.documentElement.dataset.colorScheme=$,await loadContextSettings().then(tt=>{configFileSettings=validate(tt,!1,SRC_SERVER,"from server settings file")});const _e=new URLSearchParams(window.location.search),et={};_e.forEach((tt,nt)=>{let rt=et;if(nt.startsWith("opencast.")||nt==="allowedCallbackPrefixes")return;nt==="mediaPackageId"&&(nt="id");const ot=nt.split(".");ot.slice(0,-1).forEach(it=>{it in rt||(rt[it]={}),rt=rt[it]}),rt[ot[ot.length-1]]=tt}),urlParameterSettings=validate(et,!0,SRC_URL,"given as URL GET parameter"),settings=merge$1.all([defaultSettings,configFileSettings,urlParameterSettings]),settings.opencast.local=settings.opencast.local&&settings.opencast.url===window.location.origin,settings.callbackUrl=settings.allowedCallbackPrefixes.some(tt=>{var nt;return(nt=settings.callbackUrl)==null?void 0:nt.startsWith(tt)})?settings.callbackUrl:void 0},loadContextSettings=async()=>{var rt;let $="./";$.endsWith("/")||($+="/");const _e=define_import_meta_env_default.VITE_APP_SETTINGS_PATH||CONTEXT_SETTINGS_FILE,et=_e.startsWith("/")?"":$,tt=new URL(et.concat(_e),window.location.origin);let nt;try{nt=await fetch(tt)}catch(ot){return console.warn(`Could not access "${_e}" due to network error!`,ot||""),null}if(nt.status===404)return console.debug(`"${_e}" returned 404: ignoring`),null;if(!nt.ok)return console.error(`Fetching "${_e}" failed: ${nt.status} ${nt.statusText}`),null;if((rt=nt.headers.get("Content-Type"))!=null&&rt.startsWith("text/html"))return console.warn(`"${_e}" request has "Content-Type: text/html" -> ignoring...`),null;try{return parseToml(await nt.text())}catch(ot){throw console.error(`Could not parse "${_e}" as TOML: `,ot),new SyntaxError(`Could not parse "${_e}" as TOML: ${ot}`)}},validate=($,_e,et,tt)=>{const nt=(it,st,lt)=>typeof it=="function"?rt(it,st,lt):ot(it,st,lt),rt=(it,st,lt)=>{try{const ct=it(st,_e,et);return ct===void 0?st:ct}catch(ct){return console.warn(`Validation of setting "${lt}" (${tt}) with value "${st}" failed: ${ct}. Ignoring.`),null}},ot=(it,st,lt)=>{const ct={};for(const ft in st){const dt=lt?`${lt}.${ft}`:ft;if(ft in it){const pt=nt(it[ft],st[ft],dt);pt!==null&&(ct[ft]=pt)}else console.warn(`"${dt}" (${tt}) is not a valid settings key. Ignoring.`)}return ct};return nt(SCHEMA,$,"")},types={string:($,_e)=>{if(typeof $!="string")throw new Error("is not a string, but should be")},boolean:($,_e)=>{if(typeof $!="boolean")if(_e){if($==="true")return!0;if($==="false")return!1;throw new Error("cant be parsed as boolean")}else throw new Error("is not a boolean")},array:($,_e)=>{if(!Array.isArray($))throw new Error("is not an array, but should be");for(const et in $)if(typeof et!="string")throw new Error("is not a string, but should be")},map:($,_e)=>{for(const et in $){if(typeof et!="string")throw new Error("is not a string, but should be");if(typeof $[et]!="string")throw new Error("is not a string, but should be")}},objectsWithinObjects:($,_e)=>{for(const et in $){if(typeof et!="string")throw new Error("is not a string, but should be");for(const tt in $[et]){if(typeof tt!="string")throw new Error("is not a string, but should be");for(const nt in $[et][tt]){if(typeof nt!="string")throw new Error("is not a string, but should be");if(nt==="show"&&typeof $[et][tt][nt]!="boolean")throw new Error("is not a boolean");if(nt==="readonly"&&typeof $[et][tt][nt]!="boolean")throw new Error("is not a boolean")}}}}},SCHEMA={id:types.string,allowedCallbackPrefixes:types.array,callbackUrl:types.string,callbackSystem:types.string,opencast:{url:types.string,name:types.string,password:types.string},metadata:{show:types.boolean,configureFields:types.objectsWithinObjects},trackSelection:{show:types.boolean},subtitles:{show:types.boolean,mainFlavor:types.string,languages:types.objectsWithinObjects,icons:types.map,defaultVideoFlavor:types.map},thumbnail:{show:types.boolean,simpleMode:types.boolean}},merge$1=($,_e)=>deepmerge$2($,_e,{arrayMerge});merge$1.all=$=>deepmerge$2.all($,{arrayMerge});const arrayMerge=($,_e,et)=>_e;async function client($,{body:_e,...et}={}){const tt={"Content-Type":"application/json"};let nt={};settings.opencast.name&&settings.opencast.password&&(nt={Authorization:`Basic ${btoa(unescape(encodeURIComponent(settings.opencast.name+":"+settings.opencast.password)))}`});const rt={method:_e?"POST":"GET",...et,headers:{...tt,...et.headers,...nt}};_e&&(rt.headers["Content-Type"].includes("urlencoded")?rt.body=_e:rt.body=JSON.stringify(_e));let ot,it,st;try{if(st=await window.fetch($,rt),it=await st.text(),st.url.includes("login.html"))throw new Error("Got redirected to login page, authentification failed.");if(st.ok)return ot=it.length?it:"",ot;throw new Error(st.statusText)}catch(lt){return Promise.reject(st.status?"Status "+st.status+": "+it:lt.message)}}client.get=function($,_e={}){return client($,{..._e,method:"GET"})};client.post=function($,_e,et={}){return client($,{...et,body:_e})};client.delete=function($,_e={}){return client($,{..._e,method:"DELETE"})};var parser={};(function($){(function(){var _e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},et=function(it){it||(it={"&":"&","<":"<",">":">","&lrm":"‎","&rlm":"‏"," ":" "}),this.entities=it,this.parse=function(st,lt){st=st.replace(/\0/g,"�");var ct=/\r\n|\r|\n/,ft=Date.now(),dt=0,pt=st.split(ct),ht=!1,gt=[],yt=[],vt=[];function Et(kt,Nt){vt.push({message:kt,line:dt+1,col:Nt})}var Tt=pt[dt],Ot=Tt.length,wt="WEBVTT",$t=0,xt=wt.length;for(Tt[0]==="\uFEFF"&&($t=1,xt+=1),(Otxt&&Tt[xt]!==" "&&Tt[xt]!==" ")&&Et('No valid signature. (File needs to start with "WEBVTT".)'),dt++;pt[dt]!=""&&pt[dt]!=null;){if(Et("No blank line after the signature."),pt[dt].indexOf("-->")!=-1){ht=!0;break}dt++}for(;pt[dt]!=null;){for(var mt;!ht&&pt[dt]=="";)dt++;if(!ht&&pt[dt]==null)break;mt=Object.assign({},_e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var Ct=!0;if(pt[dt].indexOf("-->")==-1){if(mt.id=pt[dt],/^NOTE($|[ \t])/.test(mt.id)){for(dt++;pt[dt]!=""&&pt[dt]!=null;)pt[dt].indexOf("-->")!=-1&&Et("Cannot have timestamp in a comment."),dt++;continue}if(/^STYLE($|[ \t])/.test(mt.id)){var bt=[],Pt=!1;for(dt++;pt[dt]!=""&&pt[dt]!=null;)pt[dt].indexOf("-->")!=-1&&(Et("Cannot have timestamp in a style block."),Pt=!0),bt.push(pt[dt]),dt++;if(yt.length){Et("Style blocks cannot appear after the first cue.");continue}Pt||gt.push(bt.join(` +`,$}var parseString_1=parseString;const TOMLParser=tomlParserExports,prettyError=parsePrettyError;function parseString($){globalThis.Buffer&&globalThis.Buffer.isBuffer($)&&($=$.toString("utf8"));const _e=new TOMLParser;try{return _e.parse($),_e.finish()}catch(et){throw prettyError(et,$)}}const parseToml=getDefaultExportFromCjs(parseString_1);var isMergeableObject=function $(_e){return isNonNullObject(_e)&&!isSpecial(_e)};function isNonNullObject($){return!!$&&typeof $=="object"}function isSpecial($){var _e=Object.prototype.toString.call($);return _e==="[object RegExp]"||_e==="[object Date]"||isReactElement($)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement($){return $.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget($){return Array.isArray($)?[]:{}}function cloneUnlessOtherwiseSpecified($,_e){return _e.clone!==!1&&_e.isMergeableObject($)?deepmerge$1(emptyTarget($),$,_e):$}function defaultArrayMerge($,_e,et){return $.concat(_e).map(function(tt){return cloneUnlessOtherwiseSpecified(tt,et)})}function getMergeFunction($,_e){if(!_e.customMerge)return deepmerge$1;var et=_e.customMerge($);return typeof et=="function"?et:deepmerge$1}function getEnumerableOwnPropertySymbols($){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols($).filter(function(_e){return Object.propertyIsEnumerable.call($,_e)}):[]}function getKeys($){return Object.keys($).concat(getEnumerableOwnPropertySymbols($))}function propertyIsOnObject($,_e){try{return _e in $}catch{return!1}}function propertyIsUnsafe($,_e){return propertyIsOnObject($,_e)&&!(Object.hasOwnProperty.call($,_e)&&Object.propertyIsEnumerable.call($,_e))}function mergeObject($,_e,et){var tt={};return et.isMergeableObject($)&&getKeys($).forEach(function(nt){tt[nt]=cloneUnlessOtherwiseSpecified($[nt],et)}),getKeys(_e).forEach(function(nt){propertyIsUnsafe($,nt)||(propertyIsOnObject($,nt)&&et.isMergeableObject(_e[nt])?tt[nt]=getMergeFunction(nt,et)($[nt],_e[nt],et):tt[nt]=cloneUnlessOtherwiseSpecified(_e[nt],et))}),tt}function deepmerge$1($,_e,et){et=et||{},et.arrayMerge=et.arrayMerge||defaultArrayMerge,et.isMergeableObject=et.isMergeableObject||isMergeableObject,et.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var tt=Array.isArray(_e),nt=Array.isArray($),rt=tt===nt;return rt?tt?et.arrayMerge($,_e,et):mergeObject($,_e,et):cloneUnlessOtherwiseSpecified(_e,et)}deepmerge$1.all=function $(_e,et){if(!Array.isArray(_e))throw new Error("first argument should be an array");return _e.reduce(function(tt,nt){return deepmerge$1(tt,nt,et)},{})};var deepmerge_1=deepmerge$1,cjs$1=deepmerge_1;const deepmerge$2=getDefaultExportFromCjs(cjs$1);var define_import_meta_env_default={BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1,VITE_GIT_COMMIT_HASH:"d8160de1bf35d9323f5b20b44dfc55b0c86c9312",VITE_APP_BUILD_DATE:"2024-05-07T10:06:41.999Z"};const CONTEXT_SETTINGS_FILE="editor-settings.toml",SRC_SERVER="src-server",SRC_URL="src-url",defaultSettings={id:void 0,allowedCallbackPrefixes:[],callbackUrl:void 0,callbackSystem:void 0,opencast:{url:window.location.origin,name:void 0,password:void 0,local:!0},metadata:{show:!0,configureFields:void 0},trackSelection:{show:!0},thumbnail:{show:!1,simpleMode:!1},subtitles:{show:!1,mainFlavor:"captions",languages:{},icons:void 0,defaultVideoFlavor:void 0}};let configFileSettings,urlParameterSettings,settings;const init=async()=>{let $=window.localStorage.getItem("colorScheme");if($===null||!["light","dark","light-high-contrast","dark-high-contrast"].includes($)){const tt=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",nt=window.matchMedia("(prefers-contrast: more)").matches?"-high-contrast":"";$=`${tt}${nt}`}document.documentElement.dataset.colorScheme=$,await loadContextSettings().then(tt=>{configFileSettings=validate(tt,!1,SRC_SERVER,"from server settings file")});const _e=new URLSearchParams(window.location.search),et={};_e.forEach((tt,nt)=>{let rt=et;if(nt.startsWith("opencast.")||nt==="allowedCallbackPrefixes")return;nt==="mediaPackageId"&&(nt="id");const ot=nt.split(".");ot.slice(0,-1).forEach(it=>{it in rt||(rt[it]={}),rt=rt[it]}),rt[ot[ot.length-1]]=tt}),urlParameterSettings=validate(et,!0,SRC_URL,"given as URL GET parameter"),settings=merge$1.all([defaultSettings,configFileSettings,urlParameterSettings]),settings.opencast.local=settings.opencast.local&&settings.opencast.url===window.location.origin,settings.callbackUrl=settings.allowedCallbackPrefixes.some(tt=>{var nt;return(nt=settings.callbackUrl)==null?void 0:nt.startsWith(tt)})?settings.callbackUrl:void 0},loadContextSettings=async()=>{var rt;let $="./";$.endsWith("/")||($+="/");const _e=define_import_meta_env_default.VITE_APP_SETTINGS_PATH||CONTEXT_SETTINGS_FILE,et=_e.startsWith("/")?"":$,tt=new URL(et.concat(_e),window.location.origin);let nt;try{nt=await fetch(tt)}catch(ot){return console.warn(`Could not access "${_e}" due to network error!`,ot||""),null}if(nt.status===404)return console.debug(`"${_e}" returned 404: ignoring`),null;if(!nt.ok)return console.error(`Fetching "${_e}" failed: ${nt.status} ${nt.statusText}`),null;if((rt=nt.headers.get("Content-Type"))!=null&&rt.startsWith("text/html"))return console.warn(`"${_e}" request has "Content-Type: text/html" -> ignoring...`),null;try{return parseToml(await nt.text())}catch(ot){throw console.error(`Could not parse "${_e}" as TOML: `,ot),new SyntaxError(`Could not parse "${_e}" as TOML: ${ot}`)}},validate=($,_e,et,tt)=>{const nt=(it,st,lt)=>typeof it=="function"?rt(it,st,lt):ot(it,st,lt),rt=(it,st,lt)=>{try{const ct=it(st,_e,et);return ct===void 0?st:ct}catch(ct){return console.warn(`Validation of setting "${lt}" (${tt}) with value "${st}" failed: ${ct}. Ignoring.`),null}},ot=(it,st,lt)=>{const ct={};for(const ft in st){const dt=lt?`${lt}.${ft}`:ft;if(ft in it){const pt=nt(it[ft],st[ft],dt);pt!==null&&(ct[ft]=pt)}else console.warn(`"${dt}" (${tt}) is not a valid settings key. Ignoring.`)}return ct};return nt(SCHEMA,$,"")},types={string:($,_e)=>{if(typeof $!="string")throw new Error("is not a string, but should be")},boolean:($,_e)=>{if(typeof $!="boolean")if(_e){if($==="true")return!0;if($==="false")return!1;throw new Error("cant be parsed as boolean")}else throw new Error("is not a boolean")},array:($,_e)=>{if(!Array.isArray($))throw new Error("is not an array, but should be");for(const et in $)if(typeof et!="string")throw new Error("is not a string, but should be")},map:($,_e)=>{for(const et in $){if(typeof et!="string")throw new Error("is not a string, but should be");if(typeof $[et]!="string")throw new Error("is not a string, but should be")}},objectsWithinObjects:($,_e)=>{for(const et in $){if(typeof et!="string")throw new Error("is not a string, but should be");for(const tt in $[et]){if(typeof tt!="string")throw new Error("is not a string, but should be");for(const nt in $[et][tt]){if(typeof nt!="string")throw new Error("is not a string, but should be");if(nt==="show"&&typeof $[et][tt][nt]!="boolean")throw new Error("is not a boolean");if(nt==="readonly"&&typeof $[et][tt][nt]!="boolean")throw new Error("is not a boolean")}}}}},SCHEMA={id:types.string,allowedCallbackPrefixes:types.array,callbackUrl:types.string,callbackSystem:types.string,opencast:{url:types.string,name:types.string,password:types.string},metadata:{show:types.boolean,configureFields:types.objectsWithinObjects},trackSelection:{show:types.boolean},subtitles:{show:types.boolean,mainFlavor:types.string,languages:types.objectsWithinObjects,icons:types.map,defaultVideoFlavor:types.map},thumbnail:{show:types.boolean,simpleMode:types.boolean}},merge$1=($,_e)=>deepmerge$2($,_e,{arrayMerge});merge$1.all=$=>deepmerge$2.all($,{arrayMerge});const arrayMerge=($,_e,et)=>_e;async function client($,{body:_e,...et}={}){const tt={"Content-Type":"application/json"};let nt={};settings.opencast.name&&settings.opencast.password&&(nt={Authorization:`Basic ${btoa(unescape(encodeURIComponent(settings.opencast.name+":"+settings.opencast.password)))}`});const rt={method:_e?"POST":"GET",...et,headers:{...tt,...et.headers,...nt}};_e&&(rt.headers["Content-Type"].includes("urlencoded")?rt.body=_e:rt.body=JSON.stringify(_e));let ot,it,st;try{if(st=await window.fetch($,rt),it=await st.text(),st.url.includes("login.html"))throw new Error("Got redirected to login page, authentification failed.");if(st.ok)return ot=it.length?it:"",ot;throw new Error(st.statusText)}catch(lt){return Promise.reject(st.status?"Status "+st.status+": "+it:lt.message)}}client.get=function($,_e={}){return client($,{..._e,method:"GET"})};client.post=function($,_e,et={}){return client($,{...et,body:_e})};client.delete=function($,_e={}){return client($,{..._e,method:"DELETE"})};var parser={};(function($){(function(){var _e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},et=function(it){it||(it={"&":"&","<":"<",">":">","&lrm":"‎","&rlm":"‏"," ":" "}),this.entities=it,this.parse=function(st,lt){st=st.replace(/\0/g,"�");var ct=/\r\n|\r|\n/,ft=Date.now(),dt=0,pt=st.split(ct),ht=!1,gt=[],yt=[],vt=[];function Et(kt,Nt){vt.push({message:kt,line:dt+1,col:Nt})}var Tt=pt[dt],Ot=Tt.length,wt="WEBVTT",$t=0,xt=wt.length;for(Tt[0]==="\uFEFF"&&($t=1,xt+=1),(Otxt&&Tt[xt]!==" "&&Tt[xt]!==" ")&&Et('No valid signature. (File needs to start with "WEBVTT".)'),dt++;pt[dt]!=""&&pt[dt]!=null;){if(Et("No blank line after the signature."),pt[dt].indexOf("-->")!=-1){ht=!0;break}dt++}for(;pt[dt]!=null;){for(var mt;!ht&&pt[dt]=="";)dt++;if(!ht&&pt[dt]==null)break;mt=Object.assign({},_e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var Ct=!0;if(pt[dt].indexOf("-->")==-1){if(mt.id=pt[dt],/^NOTE($|[ \t])/.test(mt.id)){for(dt++;pt[dt]!=""&&pt[dt]!=null;)pt[dt].indexOf("-->")!=-1&&Et("Cannot have timestamp in a comment."),dt++;continue}if(/^STYLE($|[ \t])/.test(mt.id)){var bt=[],Pt=!1;for(dt++;pt[dt]!=""&&pt[dt]!=null;)pt[dt].indexOf("-->")!=-1&&(Et("Cannot have timestamp in a style block."),Pt=!0),bt.push(pt[dt]),dt++;if(yt.length){Et("Style blocks cannot appear after the first cue.");continue}Pt||gt.push(bt.join(` `));continue}if(dt++,pt[dt]==""||pt[dt]==null){Et("Cue identifier cannot be standalone.");continue}if(pt[dt].indexOf("-->")==-1){Ct=!1,Et("Cue identifier needs to be followed by timestamp.");continue}}ht=!1;var It=new tt(pt[dt],Et),Mt=0;if(yt.length>0&&(Mt=yt[yt.length-1].startTime),Ct&&!It.parse(mt,Mt)){for(mt=null,dt++;pt[dt]!=""&&pt[dt]!=null;){if(pt[dt].indexOf("-->")!=-1){ht=!0;break}dt++}continue}for(dt++;pt[dt]!=""&&pt[dt]!=null;){if(pt[dt].indexOf("-->")!=-1){Et("Blank line missing before cue."),ht=!0;break}mt.text!=""&&(mt.text+=` `),mt.text+=pt[dt],dt++}var Rt=new nt(mt.text,Et,lt,it);mt.tree=Rt.parse(mt.startTime,mt.endTime),yt.push(mt)}return yt.sort(function(kt,Nt){return kt.startTimeNt.startTime?1:kt.endTime>Nt.endTime?-1:kt.endTime2||parseInt(Tt,10)>59)&&(Et="hours"),ft[dt]!=":"){pt("No time unit separator found.");return}if(dt++,Ot=gt(/\d/),Ot.length!=2){pt("Must be exactly two digits.");return}if(Et=="hours"||ft[dt]==":"){if(ft[dt]!=":"){pt("No seconds found or minutes is greater than 59.");return}if(dt++,wt=gt(/\d/),wt.length!=2){pt("Must be exactly two digits.");return}}else{if(Tt.length!=2){pt("Must be exactly two digits.");return}wt=Ot,Ot=Tt,Tt="0"}if(ft[dt]!="."){pt('No decimal separator (".") found.');return}if(dt++,$t=gt(/\d/),$t.length!=3){pt("Milliseconds must be given in three digits.");return}if(parseInt(Ot,10)>59){pt("You cannot have more than 59 minutes.");return}if(parseInt(wt,10)>59){pt("You cannot have more than 59 seconds.");return}return parseInt(Tt,10)*60*60+parseInt(Ot,10)*60+parseInt(wt,10)+parseInt($t,10)/1e3}function vt(Et,Tt){for(var Ot=Et.split(lt),wt=[],$t=0;$t100)){pt("Line position cannot be >100%.");continue}if(It===""||isNaN(It)||!isFinite(It)){pt("Line position needs to be a number");continue}if(Pt!==void 0){if(!["start","center","end"].includes(Pt)){pt("Line alignment needs to be one of start, center or end");continue}Tt.lineAlign=Pt}Tt.snapToLines=!Mt,Tt.linePosition=parseFloat(It),parseFloat(It).toString()!==It&&(Tt.nonSerializable=!0)}else if(mt=="position"){if(/,/.test(Ct)){var bt=Ct.split(",");Ct=bt[0];var Rt=bt[1]}if(Ct[Ct.length-1]!="%"){pt("Text position must be a percentage.");continue}if(parseInt(Ct,10)>100||parseInt(Ct,10)<0){pt("Text position needs to be between 0 and 100%.");continue}if(It=Ct.slice(0,Ct.length-1),It===""||isNaN(It)||!isFinite(It)){pt("Line position needs to be a number");continue}if(Rt!==void 0){if(!["line-left","center","line-right"].includes(Rt)){pt("Position alignment needs to be one of line-left, center or line-right");continue}Tt.positionAlign=Rt}Tt.textPosition=parseFloat(It)}else if(mt=="size"){if(Ct[Ct.length-1]!="%"){pt("Size must be a percentage.");continue}if(parseInt(Ct,10)>100){pt("Size cannot be >100%.");continue}var kt=Ct.slice(0,Ct.length-1);if(kt===void 0||kt===""||isNaN(kt)){pt("Size needs to be a number"),kt=100;continue}else if(kt=parseFloat(kt),kt<0||kt>100){pt("Size needs to be between 0 and 100%.");continue}Tt.size=kt}else if(mt=="align"){var Nt=["start","center","end","left","right"];if(Nt.indexOf(Ct)==-1){pt("Alignment can only be set to one of "+Nt.join(", ")+".");continue}Tt.alignment=Ct}else pt("Invalid setting.")}}this.parse=function(Et,Tt){if(ht(lt),Et.startTime=yt(),Et.startTime!=null){if(Et.startTime' by whitespace."),ht(lt),ft[dt]!="-"){pt("No valid timestamp separator found.");return}if(dt++,ft[dt]!="-"){pt("No valid timestamp separator found.");return}if(dt++,ft[dt]!=">"){pt("No valid timestamp separator found.");return}if(dt++,ct.test(ft[dt])&&pt("'-->' not separated from timestamp by whitespace."),ht(lt),Et.endTime=yt(),Et.endTime!=null)return Et.endTime<=Et.startTime&&pt("End timestamp is not greater than start timestamp."),ct.test(ft[dt]),ht(lt),vt(ft.substring(dt),Et),!0}},this.parseTimestamp=function(){var Et=yt();if(ft[dt]!=null){pt("Timestamp must not have trailing characters.");return}return Et}},nt=function(dt,st,lt,ct){this.entities=ct;var ft=this,dt=dt,pt=0,ht=function(yt){lt!="metadata"&&st(yt,pt+1)};this.parse=function(yt,vt){function Et(It){const Mt={...It};return It.children&&(Mt.children=It.children.map(Et)),Mt.parent&&delete Mt.parent,Mt}var Tt={children:[]},Ot=Tt,wt=[];function $t(It){Ot.children.push({type:"object",name:It[1],classes:It[2],children:[],parent:Ot}),Ot=Ot.children[Ot.children.length-1]}function xt(It){for(var Mt=Ot;Mt;){if(Mt.name==It)return!0;Mt=Mt.parent}}for(;dt[pt]!=null;){var mt=gt();if(mt[0]=="text")Ot.children.push({type:"text",value:mt[1],parent:Ot});else if(mt[0]=="start tag"){lt=="chapters"&&ht("Start tags not allowed in chapter title text.");var Ct=mt[1];Ct!="v"&&Ct!="lang"&&mt[3]!=""&&ht("Only and can have an annotation."),Ct=="c"||Ct=="i"||Ct=="b"||Ct=="u"||Ct=="ruby"||Ct=="rt"&&Ot.name=="ruby"?$t(mt):Ct=="v"?(xt("v")&&ht(" cannot be nested inside itself."),$t(mt),Ot.value=mt[3],mt[3]||ht(" requires an annotation.")):Ct=="lang"?($t(mt),Ot.value=mt[3]):ht("Incorrect start tag.")}else if(mt[0]=="end tag")lt=="chapters"&&ht("End tags not allowed in chapter title text."),mt[1]==Ot.name?Ot=Ot.parent:mt[1]=="ruby"&&Ot.name=="rt"?Ot=Ot.parent.parent:ht("Incorrect end tag.");else if(mt[0]=="timestamp"){lt=="chapters"&&ht("Timestamp not allowed in chapter title text.");var bt=new tt(mt[1],ht),Pt=bt.parseTimestamp();Pt!=null&&((Pt<=yt||Pt>=vt)&&ht("Timestamp must be between start timestamp and end timestamp."),wt.length>0&&wt[wt.length-1]>=Pt&&ht("Timestamp must be greater than any previous timestamp."),Ot.children.push({type:"timestamp",value:Pt,parent:Ot}),wt.push(Pt))}}for(;Ot.parent;)Ot.name!="v"&&ht("Required end tag missing."),Ot=Ot.parent;return Et(Tt)};function gt(){for(var yt="data",vt="",Et="",Tt=[];dt[pt-1]!=null||pt==0;){var Ot=dt[pt];if(yt=="data")if(Ot=="&")Et=Ot,yt="escape";else if(Ot=="<"&&vt=="")yt="tag";else{if(Ot=="<"||Ot==null)return["text",vt];vt+=Ot}else if(yt=="escape")if(Ot=="<"||Ot==null){ht("Incorrect escape.");let wt;return(wt=Et.match(/^&#([0-9]+)$/))?vt+=String.fromCharCode(wt[1]):ft.entities[Et]?vt+=ft.entities[Et]:vt+=Et,["text",vt]}else if(Ot=="&")ht("Incorrect escape."),vt+=Et,Et=Ot;else if(/[a-z#0-9]/i.test(Ot))Et+=Ot;else if(Ot==";"){let wt;(wt=Et.match(/^&#(x?[0-9]+)$/))?vt+=String.fromCharCode("0"+wt[1]):ft.entities[Et+Ot]?vt+=ft.entities[Et+Ot]:(wt=Object.keys(ct).find($t=>Et.startsWith($t)))?vt+=ft.entities[wt]+Et.slice(wt.length)+Ot:(ht("Incorrect escape."),vt+=Et+";"),yt="data"}else ht("Incorrect escape."),vt+=Et+Ot,yt="data";else if(yt=="tag")if(Ot==" "||Ot==` `||Ot=="\f"||Ot==" ")yt="start tag annotation";else if(Ot==".")yt="start tag class";else if(Ot=="/")yt="end tag";else if(/\d/.test(Ot))vt=Ot,yt="timestamp tag";else{if(Ot==">"||Ot==null)return Ot==">"&&pt++,["start tag","",[],""];vt=Ot,yt="start tag"}else if(yt=="start tag")if(Ot==" "||Ot=="\f"||Ot==" ")yt="start tag annotation";else if(Ot==` @@ -65,7 +65,7 @@ Error generating stack: `+rt.message+` `}this.serialize=function(dt,pt){var ht=`WEBVTT `;if(pt)for(var gt=0;gt{const et=Math.pow(10,_e);return Math.round(($+Number.EPSILON)*et)/et},sleep=$=>new Promise((_e,et)=>setTimeout(_e,$)),convertMsToReadableString=$=>{const _e=new Date($||0).toISOString().substr(11,2),et=new Date($||0).toISOString().substr(14,2),tt=new Date($||0).toISOString().substr(17,2),nt=[];return parseInt(_e)>0&&nt.push(_e+" hours, "),(parseInt(et)>0||parseInt(_e)>0)&&nt.push(et+" minutes, "),nt.push(tt+" seconds"),nt.join("")};let flexGapIsSupported;function checkFlexGapSupport(){if(flexGapIsSupported!==void 0)return flexGapIsSupported;const $=document.createElement("div");return $.style.display="flex",$.style.flexDirection="column",$.style.rowGap="1px",$.style.position="absolute",$.appendChild(document.createElement("div")),$.appendChild(document.createElement("div")),document.body.appendChild($),flexGapIsSupported=$.scrollHeight===1,$.parentNode&&$.parentNode.removeChild($),flexGapIsSupported}function serializeSubtitle($){const _e=new parser.WebVTTSerializer;let et=0;const tt=[...$];for(let nt of $)nt={...nt},nt.startTime=nt.startTime/1e3,nt.endTime=nt.endTime/1e3,nt={id:nt.id?nt.id:void 0,idInternal:nt.idInternal,text:nt.text,startTime:nt.startTime,endTime:nt.endTime,tree:nt.tree,alignment:"center",direction:"horizontal",lineAlign:"start",linePosition:"auto",positionAlign:"auto",size:100,textPosition:"auto"},tt[et]=nt,et++;return _e.serialize(tt)}function parseSubtitle($){const et=new parser.WebVTTParser().parse($,"metadata");if(et.errors.length!==0){const nt=[];for(const rt of et.errors)nt.push("On line: "+rt.line+" col: "+rt.col+" error occured: "+rt.message);throw new Error(nt.join(` -`))}let tt=0;for(const nt of et.cues)nt.id||(nt.idInternal=nanoid(),et.cues[tt]=nt),nt.startTime=nt.startTime*1e3,nt.endTime=nt.endTime*1e3,et.cues[tt]=nt,tt++;return et.cues}function languageCodeToName($){if(!$)return;const _e=window.navigator.language,et=new Intl.DisplayNames(_e,{type:"language"});try{return et.of($.trim())}catch{return}}function useInterval($,_e){const et=reactExports.useRef(null);reactExports.useEffect(()=>{et.current=$}),reactExports.useEffect(()=>{function tt(){et.current!==null&&et.current()}if(_e!==null){const nt=setInterval(tt,_e);return()=>{clearInterval(nt)}}},[$,_e])}const initialState$6={isPlaying:!1,isPlayPreview:!0,isMuted:!1,volume:1,currentlyAt:0,segments:[{id:nanoid(),start:0,end:1,deleted:!1}],tracks:[],subtitlesFromOpencast:[],activeSegmentIndex:0,selectedWorkflowId:"",previewTriggered:!1,clickTriggered:!1,jumpTriggered:!1,aspectRatios:[],hasChanges:!1,waveformImages:[],originalThumbnails:[],videoURLs:[],videoCount:0,duration:0,title:"",presenters:[],workflows:[],lockingActive:!1,lockRefresh:null,lockState:!1,lock:{uuid:"",user:""},status:"idle",error:void 0,errorReason:"unknown"},fetchVideoInformation=createAsyncThunk("video/fetchVideoInformation",async()=>{if(!settings.id)throw new Error("Missing media package identifier");const $=await client.get(`${settings.opencast.url}/editor/${settings.id}/edit.json`);return JSON.parse($)}),updateCurrentlyAt$1=($,_e)=>{$.currentlyAt=roundToDecimalPlace(_e,0),$.currentlyAt<0&&($.currentlyAt=0),$.duration!==0&&$.duration<$.currentlyAt&&($.currentlyAt=$.duration),updateActiveSegment($),skipDeletedSegments($)},videoSlice=createSlice({name:"videoState",initialState:initialState$6,reducers:{setTrackEnabled:($,_e)=>{for(const et of $.tracks)et.id===_e.payload.id&&(et.audio_stream.enabled=_e.payload.enabled,et.video_stream.enabled=_e.payload.enabled);$.hasChanges=!0},setIsPlaying:($,_e)=>{$.isPlaying=_e.payload},setIsPlayPreview:($,_e)=>{$.isPlayPreview=_e.payload},setIsMuted:($,_e)=>{$.isMuted=_e.payload},setVolume:($,_e)=>{$.volume=_e.payload},setPreviewTriggered:($,_e)=>{$.previewTriggered=_e.payload},setClickTriggered:($,_e)=>{$.clickTriggered=_e.payload},setJumpTriggered:($,_e)=>{$.jumpTriggered=_e.payload},setCurrentlyAt:($,_e)=>{updateCurrentlyAt$1($,_e.payload)},setCurrentlyAtInSeconds:($,_e)=>{updateCurrentlyAt$1($,roundToDecimalPlace(_e.payload*1e3,0))},jumpToPreviousSegment:$=>{let _e=$.activeSegmentIndex-1;$.currentlyAt>=$.segments[$.activeSegmentIndex].start+3e3&&(_e=$.activeSegmentIndex),$.activeSegmentIndex==0&&(_e=$.activeSegmentIndex),updateCurrentlyAt$1($,$.segments[_e].start),$.jumpTriggered=!0},jumpToNextSegment:$=>{let _e=$.activeSegmentIndex+1;$.activeSegmentIndex+1>=$.segments.length&&(_e=$.activeSegmentIndex),updateCurrentlyAt$1($,$.segments[_e].start),$.jumpTriggered=!0},addSegment:($,_e)=>{$.segments.push(_e.payload)},setAspectRatio:($,_e)=>{$.aspectRatios[_e.payload.dataKey]={width:_e.payload.width,height:_e.payload.height}},setHasChanges:($,_e)=>{$.hasChanges=_e.payload},setWaveformImages:($,_e)=>{$.waveformImages=_e.payload},setThumbnail:($,_e)=>{setThumbnailHelper($,_e.payload.id,_e.payload.uri)},setThumbnails:($,_e)=>{for(const et of _e.payload)setThumbnailHelper($,et.id,et.uri)},removeThumbnail:($,_e)=>{const et=$.tracks.findIndex(tt=>tt.id===_e.payload);$.tracks[et].thumbnailUri=void 0},setLock:($,_e)=>{$.lockState=_e.payload},cut:$=>{if($.segments[$.activeSegmentIndex].start===$.currentlyAt||$.segments[$.activeSegmentIndex].end===$.currentlyAt)return;const _e={id:nanoid(),start:$.segments[$.activeSegmentIndex].start,end:$.currentlyAt,deleted:$.segments[$.activeSegmentIndex].deleted},et={id:nanoid(),start:$.currentlyAt,end:$.segments[$.activeSegmentIndex].end,deleted:$.segments[$.activeSegmentIndex].deleted};$.segments.splice($.activeSegmentIndex,1,_e,et),$.hasChanges=!0},moveCut:($,_e)=>{const et=_e.payload.leftSegmentIndex,tt=_e.payload.leftSegmentIndex+1,nt=roundToDecimalPlace(_e.payload.time,0);if(!(et<0||tt>=$.segments.length)){if(nt<=$.segments[et].start){mergeSegments($,tt,et),$.hasChanges=!0;return}if(nt>=$.segments[tt].end){mergeSegments($,et,tt),$.hasChanges=!0;return}$.segments[et].end=nt,$.segments[tt].start=nt,$.hasChanges=!0}},markAsDeletedOrAlive:$=>{$.segments[$.activeSegmentIndex].deleted=!$.segments[$.activeSegmentIndex].deleted,$.hasChanges=!0},setSelectedWorkflowIndex:($,_e)=>{$.selectedWorkflowId=_e.payload},mergeLeft:$=>{mergeSegments($,$.activeSegmentIndex,$.activeSegmentIndex-1),$.hasChanges=!0},mergeRight:$=>{mergeSegments($,$.activeSegmentIndex,$.activeSegmentIndex+1),$.hasChanges=!0},mergeAll:$=>{mergeSegments($,$.activeSegmentIndex,0),mergeSegments($,$.activeSegmentIndex,$.segments.length-1),$.hasChanges=!0}},extraReducers:$=>{$.addCase(fetchVideoInformation.pending,(_e,et)=>{_e.status="loading"}),$.addCase(fetchVideoInformation.fulfilled,(_e,et)=>{_e.status="success",et.payload.workflow_active&&(_e.status="failed",_e.errorReason="workflowActive",_e.error="This event is being processed. Please wait until the process is finished."),_e.tracks=et.payload.tracks.sort((nt,rt)=>nt.thumbnailPriority-rt.thumbnailPriority).map(nt=>(et.payload.local&&settings.opencast.local&&(console.debug("Replacing track URL"),nt.uri=nt.uri.replace(/https?:\/\/[^/]*/g,window.location.origin)),nt));const tt=_e.tracks.filter(nt=>nt.video_stream.available===!0);_e.videoURLs=tt.reduce((nt,rt)=>(nt.push(rt.uri),nt),[]),_e.videoCount=_e.videoURLs.length,_e.subtitlesFromOpencast=et.payload.subtitles?_e.subtitlesFromOpencast=et.payload.subtitles:[],_e.duration=et.payload.duration,_e.title=et.payload.title,_e.segments=parseSegments(et.payload.segments,et.payload.duration),_e.workflows=et.payload.workflows,_e.waveformImages=et.payload.waveformURIs?et.payload.waveformURIs:_e.waveformImages,_e.originalThumbnails=_e.tracks.map(nt=>({id:nt.id,uri:nt.thumbnailUri})),_e.aspectRatios=new Array(_e.videoCount),_e.lockingActive=et.payload.locking_active,_e.lockRefresh=et.payload.lock_refresh,_e.lock.uuid=et.payload.lock_uuid,_e.lock.user=et.payload.lock_user}),$.addCase(fetchVideoInformation.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectIsPlaying:$=>$.isPlaying,selectIsPlayPreview:$=>$.isPlayPreview,selectIsMuted:$=>$.isMuted,selectVolume:$=>$.volume,selectPreviewTriggered:$=>$.previewTriggered,selectClickTriggered:$=>$.clickTriggered,selectJumpTriggered:$=>$.jumpTriggered,selectCurrentlyAt:$=>$.currentlyAt,selectCurrentlyAtInSeconds:$=>$.currentlyAt/1e3,selectSegments:$=>$.segments,selectActiveSegmentIndex:$=>$.activeSegmentIndex,selectIsCurrentSegmentAlive:$=>!$.segments[$.activeSegmentIndex].deleted,selectSelectedWorkflowId:$=>$.selectedWorkflowId,selectHasChanges:$=>$.hasChanges,selectWaveformImages:$=>$.waveformImages,selectOriginalThumbnails:$=>$.originalThumbnails,selectVideoURL:$=>$.videoURLs,selectVideoCount:$=>$.videoCount,selectDuration:$=>$.duration,selectDurationInSeconds:$=>$.duration/1e3,selectTitle:$=>$.title,selectTracks:$=>$.tracks,selectWorkflows:$=>$.workflows,selectAspectRatio:$=>calculateTotalAspectRatio($.aspectRatios),selectSubtitlesFromOpencast:$=>$.subtitlesFromOpencast,selectSubtitlesFromOpencastById:($,_e)=>{for(const et of $.subtitlesFromOpencast)if(et.id===_e)return et}}}),updateActiveSegment=$=>{$.activeSegmentIndex=$.segments.findLastIndex(_e=>_e.start<=$.currentlyAt&&_e.end>=$.currentlyAt),$.activeSegmentIndex<0&&($.activeSegmentIndex=0)},parseSegments=($,_e)=>{const et=[];return $.length===0&&et.push({id:nanoid(),start:0,end:_e,deleted:!1}),$.forEach(tt=>{et.push({id:nanoid(),start:tt.start,end:tt.end,deleted:tt.deleted})}),et},mergeSegments=($,_e,et)=>{et<0||et>$.segments.length-1||($.segments[_e].start=Math.min($.segments[_e].start,$.segments[et].start),$.segments[_e].end=Math.max($.segments[_e].end,$.segments[et].end),$.segments.splice(_e{if($.isPlaying&&$.segments[$.activeSegmentIndex].deleted&&$.isPlayPreview){let _e=$.segments[$.activeSegmentIndex].end;for(let et=$.activeSegmentIndex;et<$.segments.length;et++){if(_e=$.segments[et].end,!$.segments[et].deleted){_e=$.segments[et].start+1;break}if(et+1===$.segments.length){$.isPlaying=!1;for(let tt=0;tt<$.segments.length;tt++)if(!$.segments[tt].deleted){_e=$.segments[tt].start;break}}}$.currentlyAt=_e,$.previewTriggered=!0,updateActiveSegment($)}},calculateTotalAspectRatio=$=>{let _e=Math.min(...$.map(tt=>tt.height)),et=Math.min(...$.map(tt=>tt.width));return(!_e||!et)&&(_e=720,et=1280),et*=$.length,Math.min(_e/et*100,9/32*100)},setThumbnailHelper=($,_e,et)=>{const tt=$.tracks.findIndex(nt=>nt.id===_e);tt>=0&&($.tracks[tt].thumbnailUri=et)},{setTrackEnabled,setIsPlaying:setIsPlaying$1,setIsPlayPreview:setIsPlayPreview$1,setIsMuted,setVolume,setCurrentlyAt:setCurrentlyAt$1,setCurrentlyAtInSeconds:setCurrentlyAtInSeconds$1,addSegment,setAspectRatio:setAspectRatio$1,setHasChanges:setHasChanges$2,setWaveformImages,setThumbnails,setThumbnail,removeThumbnail,setLock,cut,moveCut,markAsDeletedOrAlive,setSelectedWorkflowIndex,mergeLeft,mergeRight,mergeAll,setPreviewTriggered:setPreviewTriggered$1,setClickTriggered:setClickTriggered$1,setJumpTriggered,jumpToPreviousSegment,jumpToNextSegment}=videoSlice.actions,selectVideos=createSelector([$=>$.videoState.tracks],$=>$.filter(_e=>_e.video_stream.available===!0)),{selectIsPlaying:selectIsPlaying$1,selectIsPlayPreview:selectIsPlayPreview$1,selectIsMuted,selectVolume,selectPreviewTriggered:selectPreviewTriggered$1,selectClickTriggered:selectClickTriggered$1,selectJumpTriggered,selectCurrentlyAt:selectCurrentlyAt$1,selectCurrentlyAtInSeconds:selectCurrentlyAtInSeconds$1,selectSegments,selectActiveSegmentIndex,selectIsCurrentSegmentAlive,selectSelectedWorkflowId,selectHasChanges:selectHasChanges$2,selectWaveformImages,selectOriginalThumbnails,selectVideoURL,selectVideoCount,selectDuration,selectDurationInSeconds,selectTitle,selectTracks,selectWorkflows,selectAspectRatio:selectAspectRatio$1,selectSubtitlesFromOpencast,selectSubtitlesFromOpencastById}=videoSlice.selectors,videoReducer=videoSlice.reducer,initialState$5={status:"idle",error:void 0,errorReason:"unknown"},postVideoInformation=createAsyncThunk("video/postVideoInformation",async $=>{if(!settings.id)throw new Error("Missing media package id");return await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,{segments:convertSegments($.segments),tracks:$.tracks,subtitles:$.subtitles})}),workflowPostSlice=createSlice({name:"workflowPostState",initialState:initialState$5,reducers:{resetPostRequestState:$=>{$.status="idle"}},extraReducers:$=>{$.addCase(postVideoInformation.pending,(_e,et)=>{_e.status="loading"}),$.addCase(postVideoInformation.fulfilled,(_e,et)=>{_e.status="success"}),$.addCase(postVideoInformation.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectStatus:$=>$.status,selectError:$=>$.error}}),convertSegments=$=>{const _e=[];return $.forEach(et=>{_e.push({start:et.start,end:et.end,deleted:et.deleted,selected:!1})}),_e},{resetPostRequestState:resetPostRequestState$1}=workflowPostSlice.actions,{selectStatus:selectStatus$1,selectError:selectError$1}=workflowPostSlice.selectors,workflowPostReducer=workflowPostSlice.reducer,initialState$4={status:"idle",error:void 0,errorReason:"unknown"},postVideoInformationWithWorkflow=createAsyncThunk("video/postVideoInformationWithWorkflow",async $=>{if(!settings.id)throw new Error("Missing media package identifier");return await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,{segments:convertSegments($.segments),tracks:$.tracks,subtitles:$.subtitles,workflows:$.workflow})}),workflowPostAndProcessSlice=createSlice({name:"workflowPostAndProcessState",initialState:initialState$4,reducers:{},extraReducers:$=>{$.addCase(postVideoInformationWithWorkflow.pending,(_e,et)=>{_e.status="loading"}),$.addCase(postVideoInformationWithWorkflow.fulfilled,(_e,et)=>{_e.status="success"}),$.addCase(postVideoInformationWithWorkflow.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectStatus:$=>$.status,selectError:$=>$.error}}),{selectStatus,selectError}=workflowPostAndProcessSlice.selectors,workflowPostAndProcessReducer=workflowPostAndProcessSlice.reducer,initialState$3={end:!1,value:"success"},endSlice=createSlice({name:"endState",initialState:initialState$3,reducers:{setEnd:($,_e)=>{$.end=_e.payload.hasEnded,$.value=_e.payload.value}},selectors:{selectIsEnd:$=>$.end,selectEndState:$=>$.value}}),{setEnd}=endSlice.actions,{selectIsEnd,selectEndState}=endSlice.selectors,endReducer=endSlice.reducer,initialState$2={catalogs:[],hasChanges:!1,status:"idle",error:void 0,errorReason:"unknown",postStatus:"idle",postError:void 0,postErrorReason:"unknown"},fetchMetadata=createAsyncThunk("metadata/fetchMetadata",async()=>{if(!settings.id)throw new Error("Missing media package identifier");const $=await client.get(`${settings.opencast.url}/editor/${settings.id}/metadata.json`);return JSON.parse($)}),postMetadata=createAsyncThunk("metadata/postMetadata",async($,{getState:_e})=>{if(!settings.id)throw new Error("Missing media package identifier");const et=_e();await client.post(`${settings.opencast.url}/editor/${settings.id}/metadata.json`,et.metadataState.catalogs)}),metadataSlice=createSlice({name:"metadataState",initialState:initialState$2,reducers:{setFieldValue:($,_e)=>{$.catalogs[_e.payload.catalogIndex].fields[_e.payload.fieldIndex].value=_e.payload.value,$.hasChanges=!0},setFieldReadonly:($,_e)=>{$.catalogs[_e.payload.catalogIndex].fields[_e.payload.fieldIndex].readOnly=_e.payload.value},setHasChanges:($,_e)=>{$.hasChanges=_e.payload},resetPostRequestState:$=>{$.postStatus="idle"}},extraReducers:$=>{$.addCase(fetchMetadata.pending,(_e,et)=>{_e.status="loading"}),$.addCase(fetchMetadata.fulfilled,(_e,et)=>{_e.catalogs=et.payload,_e.status="success"}),$.addCase(fetchMetadata.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message}),$.addCase(postMetadata.pending,(_e,et)=>{_e.postStatus="loading"}),$.addCase(postMetadata.fulfilled,(_e,et)=>{_e.postStatus="success"}),$.addCase(postMetadata.rejected,(_e,et)=>{_e.postStatus="failed",_e.postError=et.error.message})},selectors:{selectCatalogs:$=>$.catalogs,selectHasChanges:$=>$.hasChanges,selectGetStatus:$=>$.status,selectGetError:$=>$.error,selectPostStatus:$=>$.postStatus,selectPostError:$=>$.postError,selectTitleFromEpisodeDc:$=>{for(const _e of $.catalogs)if(_e.flavor==="dublincore/episode"){for(const et of _e.fields)if(et.id==="title")return et.value}}}}),{setFieldValue,setHasChanges:setHasChanges$1,setFieldReadonly,resetPostRequestState}=metadataSlice.actions,{selectCatalogs,selectHasChanges:selectHasChanges$1,selectGetStatus,selectGetError,selectPostStatus,selectPostError,selectTitleFromEpisodeDc}=metadataSlice.selectors,metadataReducer=metadataSlice.reducer,initialState$1={isDisplayEditView:!1,isPlaying:!1,isPlayPreview:!0,previewTriggered:!1,currentlyAt:0,clickTriggered:!1,subtitles:{},selectedSubtitleId:"",focusSegmentTriggered:!1,focusSegmentId:"",focusSegmentTriggered2:!1,aspectRatios:[],hasChanges:!1},updateCurrentlyAt=($,_e)=>{$.currentlyAt=roundToDecimalPlace(_e,0),$.currentlyAt<0&&($.currentlyAt=0)},subtitleSlice=createSlice({name:"subtitleState",initialState:initialState$1,reducers:{setIsDisplayEditView:($,_e)=>{$.isDisplayEditView=_e.payload},setIsPlaying:($,_e)=>{$.isPlaying=_e.payload},setIsPlayPreview:($,_e)=>{$.isPlayPreview=_e.payload},setPreviewTriggered:($,_e)=>{$.previewTriggered=_e.payload},setCurrentlyAt:($,_e)=>{updateCurrentlyAt($,_e.payload)},setCurrentlyAtInSeconds:($,_e)=>{updateCurrentlyAt($,roundToDecimalPlace(_e.payload*1e3,0))},setClickTriggered:($,_e)=>{$.clickTriggered=_e.payload},setSubtitle:($,_e)=>{$.subtitles[_e.payload.identifier]=_e.payload.subtitles},setCueAtIndex:($,_e)=>{if(_e.payload.cueIndex<0||_e.payload.cueIndex>=$.subtitles[_e.payload.identifier].cues.length){console.warn("Tried to set segment for subtitle "+_e.payload.identifier+" but was out of range");return}const et=$.subtitles[_e.payload.identifier].cues[_e.payload.cueIndex];et.id=_e.payload.newCue.id,et.idInternal=_e.payload.newCue.idInternal,et.text=_e.payload.newCue.text,et.startTime=Math.round(_e.payload.newCue.startTime),et.endTime=Math.round(_e.payload.newCue.endTime),et.tree.children.length<=0&&(et.tree.children[0]={type:"text",value:_e.payload.newCue.text}),et.tree.children[0].value=_e.payload.newCue.text,$.subtitles[_e.payload.identifier].cues[_e.payload.cueIndex]=et,sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},addCueAtIndex:($,_e)=>{const et=_e.payload.startTime>=0?_e.payload.startTime:0,tt={id:void 0,idInternal:nanoid(),text:_e.payload.text,startTime:Math.round(et),endTime:Math.round(_e.payload.endTime),tree:{children:[{type:"text",value:_e.payload.text}]}};$.focusSegmentTriggered=!0,$.focusSegmentTriggered2=!0,$.focusSegmentId=tt.idInternal,_e.payload.cueIndex<0&&$.subtitles[_e.payload.identifier].cues.splice(0,0,tt),(_e.payload.cueIndex>=0||_e.payload.cueIndex<$.subtitles[_e.payload.identifier].cues.length)&&$.subtitles[_e.payload.identifier].cues.splice(_e.payload.cueIndex,0,tt),_e.payload.cueIndex>=$.subtitles[_e.payload.identifier].cues.length&&$.subtitles[_e.payload.identifier].cues.push(tt),sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},removeCue:($,_e)=>{const et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.cue.idInternal);et>-1&&$.subtitles[_e.payload.identifier].cues.splice(et,1),sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},setSelectedSubtitleId:($,_e)=>{$.selectedSubtitleId=_e.payload},setFocusSegmentTriggered:($,_e)=>{$.focusSegmentTriggered=_e.payload,$.focusSegmentTriggered2=_e.payload},setFocusSegmentId:($,_e)=>{$.focusSegmentId=_e.payload},setFocusSegmentTriggered2:($,_e)=>{$.focusSegmentTriggered2=_e.payload},setFocusToSegmentAboveId:($,_e)=>{let et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.segmentId);et=et-1,et<0&&(et=0),$.focusSegmentId=$.subtitles[_e.payload.identifier].cues[et].idInternal},setFocusToSegmentBelowId:($,_e)=>{let et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.segmentId);et=et+1,et>=$.subtitles[_e.payload.identifier].cues.length&&(et=$.subtitles[_e.payload.identifier].cues.length-1),$.focusSegmentId=$.subtitles[_e.payload.identifier].cues[et].idInternal},setAspectRatio:($,_e)=>{$.aspectRatios[_e.payload.dataKey]={width:_e.payload.width,height:_e.payload.height}},setHasChanges:($,_e)=>{$.hasChanges=_e.payload}},selectors:{selectIsDisplayEditView:$=>$.isDisplayEditView,selectIsPlaying:$=>$.isPlaying,selectIsPlayPreview:$=>$.isPlayPreview,selectPreviewTriggered:$=>$.previewTriggered,selectCurrentlyAt:$=>$.currentlyAt,selectCurrentlyAtInSeconds:$=>$.currentlyAt/1e3,selectClickTriggered:$=>$.clickTriggered,selectFocusSegmentTriggered:$=>$.focusSegmentTriggered,selectFocusSegmentId:$=>$.focusSegmentId,selectFocusSegmentTriggered2:$=>$.focusSegmentTriggered2,selectAspectRatio:()=>50,selectSubtitles:$=>$.subtitles,selectSelectedSubtitleId:$=>$.selectedSubtitleId,selectSelectedSubtitleById:$=>$.subtitles[$.selectedSubtitleId],selectHasChanges:$=>$.hasChanges}}),sortSubtitle=($,_e)=>{$.subtitles[_e].cues.sort((et,tt)=>et.startTime-tt.startTime)},{setIsDisplayEditView,setIsPlaying,setIsPlayPreview,setPreviewTriggered,setCurrentlyAt,setCurrentlyAtInSeconds,setClickTriggered,setSubtitle,setCueAtIndex,addCueAtIndex,removeCue,setSelectedSubtitleId,setFocusSegmentTriggered,setFocusSegmentId,setFocusSegmentTriggered2,setFocusToSegmentAboveId,setFocusToSegmentBelowId,setAspectRatio,setHasChanges}=subtitleSlice.actions,{selectIsDisplayEditView,selectIsPlaying,selectIsPlayPreview,selectPreviewTriggered,selectCurrentlyAt,selectCurrentlyAtInSeconds,selectClickTriggered,selectFocusSegmentTriggered,selectFocusSegmentId,selectFocusSegmentTriggered2,selectAspectRatio,selectSubtitles,selectSelectedSubtitleId,selectSelectedSubtitleById,selectHasChanges}=subtitleSlice.selectors,setCurrentlyAtAndTriggerPreview=createAsyncThunk("subtitleState/setCurrentlyAtAndTriggerPreview",async($,{getState:_e,dispatch:et})=>{$=roundToDecimalPlace($,0),$<0&&($=0);const tt=_e(),nt=tt.videoState.segments;let rt=!1;if(tt.subtitleState.isPlayPreview){for(let ot=0;ot$){if(nt[ot].deleted){$=nt[ot].end+1;for(let it=ot;it{$.error=_e.payload.error,$.errorTitle=_e.payload.errorTitle,$.errorMessage=_e.payload.errorMessage,$.errorDetails=_e.payload.errorDetails,$.errorIcon=_e.payload.errorIcon}},selectors:{selectIsError:$=>$.error,selectErrorTitle:$=>$.errorTitle,selectErrorMessage:$=>$.errorMessage,selectErrorDetails:$=>$.errorDetails,selectErrorIcon:$=>$.errorIcon}}),{setError}=errorSlice.actions,{selectIsError,selectErrorTitle,selectErrorMessage,selectErrorDetails,selectErrorIcon}=errorSlice.selectors,errorReducer=errorSlice.reducer;var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** +`))}let tt=0;for(const nt of et.cues)nt.id||(nt.idInternal=nanoid(),et.cues[tt]=nt),nt.startTime=nt.startTime*1e3,nt.endTime=nt.endTime*1e3,et.cues[tt]=nt,tt++;return et.cues}function languageCodeToName($){if(!$)return;const _e=window.navigator.language,et=new Intl.DisplayNames(_e,{type:"language"});try{return et.of($.trim())}catch{return}}function useInterval($,_e){const et=reactExports.useRef(null);reactExports.useEffect(()=>{et.current=$}),reactExports.useEffect(()=>{function tt(){et.current!==null&&et.current()}if(_e!==null){const nt=setInterval(tt,_e);return()=>{clearInterval(nt)}}},[$,_e])}const initialState$6={isPlaying:!1,isPlayPreview:!0,isMuted:!1,volume:1,currentlyAt:0,segments:[{id:nanoid(),start:0,end:1,deleted:!1}],tracks:[],subtitlesFromOpencast:[],activeSegmentIndex:0,selectedWorkflowId:"",previewTriggered:!1,clickTriggered:!1,jumpTriggered:!1,aspectRatios:[],hasChanges:!1,waveformImages:[],originalThumbnails:[],videoURLs:[],videoCount:0,duration:0,title:"",presenters:[],workflows:[],lockingActive:!1,lockRefresh:null,lockState:!1,lock:{uuid:"",user:""},status:"idle",error:void 0,errorReason:"unknown"},fetchVideoInformation=createAsyncThunk("video/fetchVideoInformation",async()=>{if(!settings.id)throw new Error("Missing media package identifier");const $=await client.get(`${settings.opencast.url}/editor/${settings.id}/edit.json`);return JSON.parse($)}),updateCurrentlyAt$1=($,_e)=>{$.currentlyAt=roundToDecimalPlace(_e,0),$.currentlyAt<0&&($.currentlyAt=0),$.duration!==0&&$.duration<$.currentlyAt&&($.currentlyAt=$.duration),updateActiveSegment($),skipDeletedSegments($)},videoSlice=createSlice({name:"videoState",initialState:initialState$6,reducers:{setTrackEnabled:($,_e)=>{for(const et of $.tracks)et.id===_e.payload.id&&(et.audio_stream.enabled=_e.payload.enabled,et.video_stream.enabled=_e.payload.enabled);$.hasChanges=!0},setIsPlaying:($,_e)=>{$.isPlaying=_e.payload},setIsPlayPreview:($,_e)=>{$.isPlayPreview=_e.payload},setIsMuted:($,_e)=>{$.isMuted=_e.payload},setVolume:($,_e)=>{$.volume=_e.payload},setPreviewTriggered:($,_e)=>{$.previewTriggered=_e.payload},setClickTriggered:($,_e)=>{$.clickTriggered=_e.payload},setJumpTriggered:($,_e)=>{$.jumpTriggered=_e.payload},setCurrentlyAt:($,_e)=>{updateCurrentlyAt$1($,_e.payload)},setCurrentlyAtInSeconds:($,_e)=>{updateCurrentlyAt$1($,roundToDecimalPlace(_e.payload*1e3,0))},jumpToPreviousSegment:$=>{let _e=$.activeSegmentIndex-1;const et=Math.max(Math.min($.duration/100,3e3),500);$.currentlyAt>=$.segments[$.activeSegmentIndex].start+et&&(_e=$.activeSegmentIndex),$.activeSegmentIndex==0&&(_e=0),updateCurrentlyAt$1($,$.segments[_e].start),$.jumpTriggered=!0},jumpToNextSegment:$=>{let _e=$.activeSegmentIndex+1;$.activeSegmentIndex+1>=$.segments.length&&(_e=$.activeSegmentIndex),updateCurrentlyAt$1($,$.segments[_e].start),$.jumpTriggered=!0},addSegment:($,_e)=>{$.segments.push(_e.payload)},setAspectRatio:($,_e)=>{$.aspectRatios[_e.payload.dataKey]={width:_e.payload.width,height:_e.payload.height}},setHasChanges:($,_e)=>{$.hasChanges=_e.payload},setWaveformImages:($,_e)=>{$.waveformImages=_e.payload},setThumbnail:($,_e)=>{setThumbnailHelper($,_e.payload.id,_e.payload.uri)},setThumbnails:($,_e)=>{for(const et of _e.payload)setThumbnailHelper($,et.id,et.uri)},removeThumbnail:($,_e)=>{const et=$.tracks.findIndex(tt=>tt.id===_e.payload);$.tracks[et].thumbnailUri=void 0},setLock:($,_e)=>{$.lockState=_e.payload},cut:$=>{if($.segments[$.activeSegmentIndex].start===$.currentlyAt||$.segments[$.activeSegmentIndex].end===$.currentlyAt)return;const _e={id:nanoid(),start:$.segments[$.activeSegmentIndex].start,end:$.currentlyAt,deleted:$.segments[$.activeSegmentIndex].deleted},et={id:nanoid(),start:$.currentlyAt,end:$.segments[$.activeSegmentIndex].end,deleted:$.segments[$.activeSegmentIndex].deleted};$.segments.splice($.activeSegmentIndex,1,_e,et),$.hasChanges=!0},moveCut:($,_e)=>{const et=_e.payload.leftSegmentIndex,tt=_e.payload.leftSegmentIndex+1,nt=roundToDecimalPlace(_e.payload.time,0);if(!(et<0||tt>=$.segments.length)){if(nt<=$.segments[et].start){mergeSegments($,tt,et),$.hasChanges=!0;return}if(nt>=$.segments[tt].end){mergeSegments($,et,tt),$.hasChanges=!0;return}$.segments[et].end=nt,$.segments[tt].start=nt,$.hasChanges=!0}},markAsDeletedOrAlive:$=>{$.segments[$.activeSegmentIndex].deleted=!$.segments[$.activeSegmentIndex].deleted,$.hasChanges=!0},setSelectedWorkflowIndex:($,_e)=>{$.selectedWorkflowId=_e.payload},mergeLeft:$=>{mergeSegments($,$.activeSegmentIndex,$.activeSegmentIndex-1),$.hasChanges=!0},mergeRight:$=>{mergeSegments($,$.activeSegmentIndex,$.activeSegmentIndex+1),$.hasChanges=!0},mergeAll:$=>{mergeSegments($,$.activeSegmentIndex,0),mergeSegments($,$.activeSegmentIndex,$.segments.length-1),$.hasChanges=!0}},extraReducers:$=>{$.addCase(fetchVideoInformation.pending,(_e,et)=>{_e.status="loading"}),$.addCase(fetchVideoInformation.fulfilled,(_e,et)=>{_e.status="success",et.payload.workflow_active&&(_e.status="failed",_e.errorReason="workflowActive",_e.error="This event is being processed. Please wait until the process is finished."),_e.tracks=et.payload.tracks.sort((nt,rt)=>nt.thumbnailPriority-rt.thumbnailPriority).map(nt=>(et.payload.local&&settings.opencast.local&&(console.debug("Replacing track URL"),nt.uri=nt.uri.replace(/https?:\/\/[^/]*/g,window.location.origin)),nt));const tt=_e.tracks.filter(nt=>nt.video_stream.available===!0);_e.videoURLs=tt.reduce((nt,rt)=>(nt.push(rt.uri),nt),[]),_e.videoCount=_e.videoURLs.length,_e.subtitlesFromOpencast=et.payload.subtitles?_e.subtitlesFromOpencast=et.payload.subtitles:[],_e.duration=et.payload.duration,_e.title=et.payload.title,_e.segments=parseSegments(et.payload.segments,et.payload.duration),_e.workflows=et.payload.workflows,_e.waveformImages=et.payload.waveformURIs?et.payload.waveformURIs:_e.waveformImages,_e.originalThumbnails=_e.tracks.map(nt=>({id:nt.id,uri:nt.thumbnailUri})),_e.aspectRatios=new Array(_e.videoCount),_e.lockingActive=et.payload.locking_active,_e.lockRefresh=et.payload.lock_refresh,_e.lock.uuid=et.payload.lock_uuid,_e.lock.user=et.payload.lock_user}),$.addCase(fetchVideoInformation.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectIsPlaying:$=>$.isPlaying,selectIsPlayPreview:$=>$.isPlayPreview,selectIsMuted:$=>$.isMuted,selectVolume:$=>$.volume,selectPreviewTriggered:$=>$.previewTriggered,selectClickTriggered:$=>$.clickTriggered,selectJumpTriggered:$=>$.jumpTriggered,selectCurrentlyAt:$=>$.currentlyAt,selectCurrentlyAtInSeconds:$=>$.currentlyAt/1e3,selectSegments:$=>$.segments,selectActiveSegmentIndex:$=>$.activeSegmentIndex,selectIsCurrentSegmentAlive:$=>!$.segments[$.activeSegmentIndex].deleted,selectSelectedWorkflowId:$=>$.selectedWorkflowId,selectHasChanges:$=>$.hasChanges,selectWaveformImages:$=>$.waveformImages,selectOriginalThumbnails:$=>$.originalThumbnails,selectVideoURL:$=>$.videoURLs,selectVideoCount:$=>$.videoCount,selectDuration:$=>$.duration,selectDurationInSeconds:$=>$.duration/1e3,selectTitle:$=>$.title,selectTracks:$=>$.tracks,selectWorkflows:$=>$.workflows,selectAspectRatio:$=>calculateTotalAspectRatio($.aspectRatios),selectSubtitlesFromOpencast:$=>$.subtitlesFromOpencast,selectSubtitlesFromOpencastById:($,_e)=>{for(const et of $.subtitlesFromOpencast)if(et.id===_e)return et}}}),updateActiveSegment=$=>{$.activeSegmentIndex=$.segments.findLastIndex(_e=>_e.start<=$.currentlyAt&&_e.end>=$.currentlyAt),$.activeSegmentIndex<0&&($.activeSegmentIndex=0)},parseSegments=($,_e)=>{const et=[];return $.length===0&&et.push({id:nanoid(),start:0,end:_e,deleted:!1}),$.forEach(tt=>{et.push({id:nanoid(),start:tt.start,end:tt.end,deleted:tt.deleted})}),et},mergeSegments=($,_e,et)=>{et<0||et>$.segments.length-1||($.segments[_e].start=Math.min($.segments[_e].start,$.segments[et].start),$.segments[_e].end=Math.max($.segments[_e].end,$.segments[et].end),$.segments.splice(_e{if($.isPlaying&&$.segments[$.activeSegmentIndex].deleted&&$.isPlayPreview){let _e=$.segments[$.activeSegmentIndex].end;for(let et=$.activeSegmentIndex;et<$.segments.length;et++){if(_e=$.segments[et].end,!$.segments[et].deleted){_e=$.segments[et].start+1;break}if(et+1===$.segments.length){$.isPlaying=!1;for(let tt=0;tt<$.segments.length;tt++)if(!$.segments[tt].deleted){_e=$.segments[tt].start;break}}}$.currentlyAt=_e,$.previewTriggered=!0,updateActiveSegment($)}},calculateTotalAspectRatio=$=>{let _e=Math.min(...$.map(tt=>tt.height)),et=Math.min(...$.map(tt=>tt.width));return(!_e||!et)&&(_e=720,et=1280),et*=$.length,Math.min(_e/et*100,9/32*100)},setThumbnailHelper=($,_e,et)=>{const tt=$.tracks.findIndex(nt=>nt.id===_e);tt>=0&&($.tracks[tt].thumbnailUri=et)},{setTrackEnabled,setIsPlaying:setIsPlaying$1,setIsPlayPreview:setIsPlayPreview$1,setIsMuted,setVolume,setCurrentlyAt:setCurrentlyAt$1,setCurrentlyAtInSeconds:setCurrentlyAtInSeconds$1,addSegment,setAspectRatio:setAspectRatio$1,setHasChanges:setHasChanges$2,setWaveformImages,setThumbnails,setThumbnail,removeThumbnail,setLock,cut,moveCut,markAsDeletedOrAlive,setSelectedWorkflowIndex,mergeLeft,mergeRight,mergeAll,setPreviewTriggered:setPreviewTriggered$1,setClickTriggered:setClickTriggered$1,setJumpTriggered,jumpToPreviousSegment,jumpToNextSegment}=videoSlice.actions,selectVideos=createSelector([$=>$.videoState.tracks],$=>$.filter(_e=>_e.video_stream.available===!0)),{selectIsPlaying:selectIsPlaying$1,selectIsPlayPreview:selectIsPlayPreview$1,selectIsMuted,selectVolume,selectPreviewTriggered:selectPreviewTriggered$1,selectClickTriggered:selectClickTriggered$1,selectJumpTriggered,selectCurrentlyAt:selectCurrentlyAt$1,selectCurrentlyAtInSeconds:selectCurrentlyAtInSeconds$1,selectSegments,selectActiveSegmentIndex,selectIsCurrentSegmentAlive,selectSelectedWorkflowId,selectHasChanges:selectHasChanges$2,selectWaveformImages,selectOriginalThumbnails,selectVideoURL,selectVideoCount,selectDuration,selectDurationInSeconds,selectTitle,selectTracks,selectWorkflows,selectAspectRatio:selectAspectRatio$1,selectSubtitlesFromOpencast,selectSubtitlesFromOpencastById}=videoSlice.selectors,videoReducer=videoSlice.reducer,initialState$5={status:"idle",error:void 0,errorReason:"unknown"},postVideoInformation=createAsyncThunk("video/postVideoInformation",async $=>{if(!settings.id)throw new Error("Missing media package id");return await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,{segments:convertSegments($.segments),tracks:$.tracks,subtitles:$.subtitles})}),workflowPostSlice=createSlice({name:"workflowPostState",initialState:initialState$5,reducers:{resetPostRequestState:$=>{$.status="idle"}},extraReducers:$=>{$.addCase(postVideoInformation.pending,(_e,et)=>{_e.status="loading"}),$.addCase(postVideoInformation.fulfilled,(_e,et)=>{_e.status="success"}),$.addCase(postVideoInformation.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectStatus:$=>$.status,selectError:$=>$.error}}),convertSegments=$=>{const _e=[];return $.forEach(et=>{_e.push({start:et.start,end:et.end,deleted:et.deleted,selected:!1})}),_e},{resetPostRequestState:resetPostRequestState$1}=workflowPostSlice.actions,{selectStatus:selectStatus$1,selectError:selectError$1}=workflowPostSlice.selectors,workflowPostReducer=workflowPostSlice.reducer,initialState$4={status:"idle",error:void 0,errorReason:"unknown"},postVideoInformationWithWorkflow=createAsyncThunk("video/postVideoInformationWithWorkflow",async $=>{if(!settings.id)throw new Error("Missing media package identifier");return await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`,{segments:convertSegments($.segments),tracks:$.tracks,subtitles:$.subtitles,workflows:$.workflow})}),workflowPostAndProcessSlice=createSlice({name:"workflowPostAndProcessState",initialState:initialState$4,reducers:{},extraReducers:$=>{$.addCase(postVideoInformationWithWorkflow.pending,(_e,et)=>{_e.status="loading"}),$.addCase(postVideoInformationWithWorkflow.fulfilled,(_e,et)=>{_e.status="success"}),$.addCase(postVideoInformationWithWorkflow.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message})},selectors:{selectStatus:$=>$.status,selectError:$=>$.error}}),{selectStatus,selectError}=workflowPostAndProcessSlice.selectors,workflowPostAndProcessReducer=workflowPostAndProcessSlice.reducer,initialState$3={end:!1,value:"success"},endSlice=createSlice({name:"endState",initialState:initialState$3,reducers:{setEnd:($,_e)=>{$.end=_e.payload.hasEnded,$.value=_e.payload.value}},selectors:{selectIsEnd:$=>$.end,selectEndState:$=>$.value}}),{setEnd}=endSlice.actions,{selectIsEnd,selectEndState}=endSlice.selectors,endReducer=endSlice.reducer,initialState$2={catalogs:[],hasChanges:!1,status:"idle",error:void 0,errorReason:"unknown",postStatus:"idle",postError:void 0,postErrorReason:"unknown"},fetchMetadata=createAsyncThunk("metadata/fetchMetadata",async()=>{if(!settings.id)throw new Error("Missing media package identifier");const $=await client.get(`${settings.opencast.url}/editor/${settings.id}/metadata.json`);return JSON.parse($)}),postMetadata=createAsyncThunk("metadata/postMetadata",async($,{getState:_e})=>{if(!settings.id)throw new Error("Missing media package identifier");const et=_e();await client.post(`${settings.opencast.url}/editor/${settings.id}/metadata.json`,et.metadataState.catalogs)}),metadataSlice=createSlice({name:"metadataState",initialState:initialState$2,reducers:{setFieldValue:($,_e)=>{$.catalogs[_e.payload.catalogIndex].fields[_e.payload.fieldIndex].value=_e.payload.value,$.hasChanges=!0},setFieldReadonly:($,_e)=>{$.catalogs[_e.payload.catalogIndex].fields[_e.payload.fieldIndex].readOnly=_e.payload.value},setHasChanges:($,_e)=>{$.hasChanges=_e.payload},resetPostRequestState:$=>{$.postStatus="idle"}},extraReducers:$=>{$.addCase(fetchMetadata.pending,(_e,et)=>{_e.status="loading"}),$.addCase(fetchMetadata.fulfilled,(_e,et)=>{_e.catalogs=et.payload,_e.status="success"}),$.addCase(fetchMetadata.rejected,(_e,et)=>{_e.status="failed",_e.error=et.error.message}),$.addCase(postMetadata.pending,(_e,et)=>{_e.postStatus="loading"}),$.addCase(postMetadata.fulfilled,(_e,et)=>{_e.postStatus="success"}),$.addCase(postMetadata.rejected,(_e,et)=>{_e.postStatus="failed",_e.postError=et.error.message})},selectors:{selectCatalogs:$=>$.catalogs,selectHasChanges:$=>$.hasChanges,selectGetStatus:$=>$.status,selectGetError:$=>$.error,selectPostStatus:$=>$.postStatus,selectPostError:$=>$.postError,selectTitleFromEpisodeDc:$=>{for(const _e of $.catalogs)if(_e.flavor==="dublincore/episode"){for(const et of _e.fields)if(et.id==="title")return et.value}}}}),{setFieldValue,setHasChanges:setHasChanges$1,setFieldReadonly,resetPostRequestState}=metadataSlice.actions,{selectCatalogs,selectHasChanges:selectHasChanges$1,selectGetStatus,selectGetError,selectPostStatus,selectPostError,selectTitleFromEpisodeDc}=metadataSlice.selectors,metadataReducer=metadataSlice.reducer,initialState$1={isDisplayEditView:!1,isPlaying:!1,isPlayPreview:!0,previewTriggered:!1,currentlyAt:0,clickTriggered:!1,subtitles:{},selectedSubtitleId:"",focusSegmentTriggered:!1,focusSegmentId:"",focusSegmentTriggered2:!1,aspectRatios:[],hasChanges:!1},updateCurrentlyAt=($,_e)=>{$.currentlyAt=roundToDecimalPlace(_e,0),$.currentlyAt<0&&($.currentlyAt=0)},subtitleSlice=createSlice({name:"subtitleState",initialState:initialState$1,reducers:{setIsDisplayEditView:($,_e)=>{$.isDisplayEditView=_e.payload},setIsPlaying:($,_e)=>{$.isPlaying=_e.payload},setIsPlayPreview:($,_e)=>{$.isPlayPreview=_e.payload},setPreviewTriggered:($,_e)=>{$.previewTriggered=_e.payload},setCurrentlyAt:($,_e)=>{updateCurrentlyAt($,_e.payload)},setCurrentlyAtInSeconds:($,_e)=>{updateCurrentlyAt($,roundToDecimalPlace(_e.payload*1e3,0))},setClickTriggered:($,_e)=>{$.clickTriggered=_e.payload},setSubtitle:($,_e)=>{$.subtitles[_e.payload.identifier]=_e.payload.subtitles},setCueAtIndex:($,_e)=>{if(_e.payload.cueIndex<0||_e.payload.cueIndex>=$.subtitles[_e.payload.identifier].cues.length){console.warn("Tried to set segment for subtitle "+_e.payload.identifier+" but was out of range");return}const et=$.subtitles[_e.payload.identifier].cues[_e.payload.cueIndex];et.id=_e.payload.newCue.id,et.idInternal=_e.payload.newCue.idInternal,et.text=_e.payload.newCue.text,et.startTime=Math.round(_e.payload.newCue.startTime),et.endTime=Math.round(_e.payload.newCue.endTime),et.tree.children.length<=0&&(et.tree.children[0]={type:"text",value:_e.payload.newCue.text}),et.tree.children[0].value=_e.payload.newCue.text,$.subtitles[_e.payload.identifier].cues[_e.payload.cueIndex]=et,sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},addCueAtIndex:($,_e)=>{const et=_e.payload.startTime>=0?_e.payload.startTime:0,tt={id:void 0,idInternal:nanoid(),text:_e.payload.text,startTime:Math.round(et),endTime:Math.round(_e.payload.endTime),tree:{children:[{type:"text",value:_e.payload.text}]}};$.focusSegmentTriggered=!0,$.focusSegmentTriggered2=!0,$.focusSegmentId=tt.idInternal,_e.payload.cueIndex<0&&$.subtitles[_e.payload.identifier].cues.splice(0,0,tt),(_e.payload.cueIndex>=0||_e.payload.cueIndex<$.subtitles[_e.payload.identifier].cues.length)&&$.subtitles[_e.payload.identifier].cues.splice(_e.payload.cueIndex,0,tt),_e.payload.cueIndex>=$.subtitles[_e.payload.identifier].cues.length&&$.subtitles[_e.payload.identifier].cues.push(tt),sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},removeCue:($,_e)=>{const et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.cue.idInternal);et>-1&&$.subtitles[_e.payload.identifier].cues.splice(et,1),sortSubtitle($,_e.payload.identifier),$.hasChanges=!0},setSelectedSubtitleId:($,_e)=>{$.selectedSubtitleId=_e.payload},setFocusSegmentTriggered:($,_e)=>{$.focusSegmentTriggered=_e.payload,$.focusSegmentTriggered2=_e.payload},setFocusSegmentId:($,_e)=>{$.focusSegmentId=_e.payload},setFocusSegmentTriggered2:($,_e)=>{$.focusSegmentTriggered2=_e.payload},setFocusToSegmentAboveId:($,_e)=>{let et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.segmentId);et=et-1,et<0&&(et=0),$.focusSegmentId=$.subtitles[_e.payload.identifier].cues[et].idInternal},setFocusToSegmentBelowId:($,_e)=>{let et=$.subtitles[_e.payload.identifier].cues.findIndex(tt=>tt.idInternal===_e.payload.segmentId);et=et+1,et>=$.subtitles[_e.payload.identifier].cues.length&&(et=$.subtitles[_e.payload.identifier].cues.length-1),$.focusSegmentId=$.subtitles[_e.payload.identifier].cues[et].idInternal},setAspectRatio:($,_e)=>{$.aspectRatios[_e.payload.dataKey]={width:_e.payload.width,height:_e.payload.height}},setHasChanges:($,_e)=>{$.hasChanges=_e.payload}},selectors:{selectIsDisplayEditView:$=>$.isDisplayEditView,selectIsPlaying:$=>$.isPlaying,selectIsPlayPreview:$=>$.isPlayPreview,selectPreviewTriggered:$=>$.previewTriggered,selectCurrentlyAt:$=>$.currentlyAt,selectCurrentlyAtInSeconds:$=>$.currentlyAt/1e3,selectClickTriggered:$=>$.clickTriggered,selectFocusSegmentTriggered:$=>$.focusSegmentTriggered,selectFocusSegmentId:$=>$.focusSegmentId,selectFocusSegmentTriggered2:$=>$.focusSegmentTriggered2,selectAspectRatio:()=>50,selectSubtitles:$=>$.subtitles,selectSelectedSubtitleId:$=>$.selectedSubtitleId,selectSelectedSubtitleById:$=>$.subtitles[$.selectedSubtitleId],selectHasChanges:$=>$.hasChanges}}),sortSubtitle=($,_e)=>{$.subtitles[_e].cues.sort((et,tt)=>et.startTime-tt.startTime)},{setIsDisplayEditView,setIsPlaying,setIsPlayPreview,setPreviewTriggered,setCurrentlyAt,setCurrentlyAtInSeconds,setClickTriggered,setSubtitle,setCueAtIndex,addCueAtIndex,removeCue,setSelectedSubtitleId,setFocusSegmentTriggered,setFocusSegmentId,setFocusSegmentTriggered2,setFocusToSegmentAboveId,setFocusToSegmentBelowId,setAspectRatio,setHasChanges}=subtitleSlice.actions,{selectIsDisplayEditView,selectIsPlaying,selectIsPlayPreview,selectPreviewTriggered,selectCurrentlyAt,selectCurrentlyAtInSeconds,selectClickTriggered,selectFocusSegmentTriggered,selectFocusSegmentId,selectFocusSegmentTriggered2,selectAspectRatio,selectSubtitles,selectSelectedSubtitleId,selectSelectedSubtitleById,selectHasChanges}=subtitleSlice.selectors,setCurrentlyAtAndTriggerPreview=createAsyncThunk("subtitleState/setCurrentlyAtAndTriggerPreview",async($,{getState:_e,dispatch:et})=>{$=roundToDecimalPlace($,0),$<0&&($=0);const tt=_e(),nt=tt.videoState.segments;let rt=!1;if(tt.subtitleState.isPlayPreview){for(let ot=0;ot$){if(nt[ot].deleted){$=nt[ot].end+1;for(let it=ot;it{$.error=_e.payload.error,$.errorTitle=_e.payload.errorTitle,$.errorMessage=_e.payload.errorMessage,$.errorDetails=_e.payload.errorDetails,$.errorIcon=_e.payload.errorIcon}},selectors:{selectIsError:$=>$.error,selectErrorTitle:$=>$.errorTitle,selectErrorMessage:$=>$.errorMessage,selectErrorDetails:$=>$.errorDetails,selectErrorIcon:$=>$.errorIcon}}),{setError}=errorSlice.actions,{selectIsError,selectErrorTitle,selectErrorMessage,selectErrorDetails,selectErrorIcon}=errorSlice.selectors,errorReducer=errorSlice.reducer;var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** * @license React * use-sync-external-store-with-selector.production.min.js * diff --git a/index.html b/index.html index fcf1be693..672bf5f80 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,8 @@ - - + + @@ -49,7 +49,7 @@ stroke-linecap: round; } - +