@vidispine/vdt-js 23.4.0-pre.3 → 23.4.0
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.d.ts +349 -10
- package/dist/index.js +1437 -885
- package/dist/index.umd.cjs +3 -3
- package/package.json +15 -14
package/dist/index.umd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(T,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("filesize"),require("url-join")):typeof define=="function"&&define.amd?define(["exports","filesize","url-join"],b):(T=typeof globalThis<"u"?globalThis:T||self,b(T["@vidispine/vdt-js"]={},T.filesize,T.urlJoin))})(this,function(T,b,Xe){"use strict";const ae=(e,t)=>t?ae(t,e%t):e,K=e=>{const{width:t,height:r}=e||{};if(t===void 0||r===void 0)return;const i=ae(t,r);let n=t/i,o=r/i;return n>21&&(o=1,n=(t/r).toFixed(2)),[n,o].join(":")},y=e=>Object.fromEntries((e==null?void 0:e.map(({key:t,value:r})=>[t,r]))||[]),Qe={ACCESSCONTROL_READ:"_accesscontrol_read",ACCESSCONTROL_WRITE:"_accesscontrol_write",ADMINISTRATOR:"_administrator",AUTO_PROJECTION_READ:"_auto_projection_read",AUTO_PROJECTION_WRITE:"_auto_projection_write",COLLECTION_NOTIFICATION_READ:"_collection_notification_read",COLLECTION_NOTIFICATION_WRITE:"_collection_notification_write",COLLECTION_READ:"_collection_read",COLLECTION_WRITE:"_collection_write",CONFIGURATION_READ:"_configuration_read",DELETION_LOCK_NOTIFICATION_READ:"_deletion_lock_notification_read",DELETION_LOCK_NOTIFICATION_WRITE:"_deletion_lock_notification_write",DELETION_LOCK_READ:"_deletion_lock_read",DELETION_LOCK_WRITE:"_deletion_lock_write",DOCUMENT_NOTIFICATION_READ:"_document_notification_read",DOCUMENT_NOTIFICATION_WRITE:"_document_notification_write",DOCUMENT_READ:"_document_read",DOCUMENT_WRITE:"_document_write",ERROR_READ:"_error_read",ERROR_WRITE:"_error_write",EXPORT:"_export",EXPORT_TEMPLATE_READ:"_export_template_read",EXPORT_TEMPLATE_WRITE:"_export_template_write",EXTERNAL_ID_READ:"_external_id_read",EXTERNAL_ID_WRITE:"_external_id_write",FILE_NOTIFICATION_READ:"_file_notification_read",FILE_NOTIFICATION_WRITE:"_file_notification_write",FILE_READ:"_file_read",FILE_WRITE:"_file_write",GROUP_READ:"_group_read",GROUP_WRITE:"_group_write",IMPORT_WRITE:"_import",ITEM_ID_READ:"_item_id_read",ITEM_ID_WRITE:"_item_id_write",ITEM_NOTIFICATION_READ:"_item_notification_read",ITEM_NOTIFICATION_WRITE:"_item_notification_write",ITEM_WRITE:"_item_write",ITEM_SEARCH:"_item_search",ITEM_SHAPE_READ:"_item_shape_read",ITEM_SHAPE_WRITE:"_item_shape_write",ITEM_TIMELINE_READ:"_item_timeline_read",ITEM_TIMELINE_WRITE:"_item_timeline_write",ITEM_URI:"_item_uri",JOB_NOTIFICATION_READ:"_job_notification_read",JOB_NOTIFICATION_WRITE:"_job_notification_write",JOB_READ:"_job_read",JOB_WRITE:"_job_write",LIBRARY_READ:"_library_read",LIBRARY_WRITE:"_library_write",LOCK_READ:"_lock_read",LOCK_WRITE:"_lock_write",LOG_READ:"_log_read",METADATA_DATASET_READ:"_metadata_dataset_read",METADATA_DATASET_WRITE:"_metadata_dataset_write",METADATA_FIELD_GROUP_READ:"_metadata_field_group_read",METADATA_FIELD_GROUP_WRITE:"_metadata_field_group_write",METADATA_FIELD_READ:"_metadata_field_read",METADATA_FIELD_WRITE:"_metadata_field_write",METADATA_GLOBAL_READ:"_metadata_global_read",METADATA_GLOBAL_WRITE:"_metadata_global_write",METADATA_LOCK_READ:"_metadata_lock_read",METADATA_LOCK_WRITE:"_metadata_lock_write",METADATA_READ:"_metadata_read",METADATA_SCHEMA_READ:"_metadata_schema_read",METADATA_SCHEMA_WRITE:"_metadata_schema_write",METADATA_WRITE:"_metadata_write",OTIF_ANALYZE:"_otif_analyze",OTIF_READ:"_otif_read",OTIF_WRITE:"_otif_write",PLACEHOLDER_NOTIFICATION_READ:"_placeholder_notification_read",PLACEHOLDER_NOTIFICATION_WRITE:"_placeholder_notification_write",PROJECTION_READ:"_projection_read",PROJECTION_WRITE:"_projection_write",QUOTA_NOTIFICATION_READ:"_quota_notification_read",QUOTA_NOTIFICATION_WRITE:"_quota_notification_write",QUOTA_READ:"_quota_read",QUOTA_WRITE:"_quota_write",RELATION_READ:"_relation_read",RELATION_WRITE:"_relation_write",RESOURCE_READ:"_resource_read",RESOURCE_WRITE:"_resource_write",RUN_AS:"_run_as",SEARCH:"_search",SEQUENCE_READ:"_sequence_read",SEQUENCE_WRITE:"_sequence_write",SHAPE_TAG_READ:"_shape_tag_read",SHAPE_TAG_WRITE:"_shape_tag_write",SITE_MANAGER:"_site_manager",SITE_RULE_READ:"_site_rule_read",SITE_RULE_WRITE:"_site_rule_write",STORAGE_GROUP_READ:"_storage_group_read",STORAGE_GROUP_WRITE:"_storage_group_write",STORAGE_NOTIFICATION_READ:"_storage_notification_read",STORAGE_NOTIFICATION_WRITE:"_storage_notification_write",STORAGE_READ:"_storage_read",STORAGE_RULE_READ:"_storage_rule_read",STORAGE_RULE_WRITE:"_storage_rule_write",STORAGE_WRITE:"_storage_write",SUPER_ACCESS_USER:"_super_access_user",TASKDEFINITION_READ:"_taskdefinition_read",TASKDEFINITION_WRITE:"_taskdefinition_write",THUMBNAIL_READ:"_thumbnail_read",THUMBNAIL_WRITE:"_thumbnail_write",TRANSCODER:"_transcoder",TRANSFER_READ:"_transfer_read",TRANSFER_WRITE:"_transfer_write",USER:"_user",VXA:"_vxa",VXA_READ:"_vxa_read"},Ze=["stl_subtitle","stl_tti","stl_gsi","mrk_marker","pho_validation","pho_resource","pho_error","facedetect_rect","facedetect_face","originalTrackFilename","stl_gsiHeader"],et=["title","user","shapeTag","representativeThumbnail","representativeThumbnailNoAuth","representativeItems","itemId","collectionId","mediaType","mimeType","created","startTimeCode","startSeconds","fieldValidationError","schemaValidationError","originalFilename","originalUri","originalAudioCodec","originalVideoCodec","originalHeight","originalWidth","originalFormat","durationSeconds","durationTimeCode","solr-index","__user","__collection","__collection_size","__ancestor_collection","__ancestor_collection_size","__shape","__shape_size","__shape_last_added","__placeholder_shape_size","__version","__version_count","__storage","__storage_size","__shapetag_{tag}_hash_{hash}","__storage_{tag}","__storage_{tag}_size","__storagegroup","__storagegroup_size","__sequence","__sequence_size","__metadata_last_modified","__external_id","__deletion_lock_id","__deletion_lock_expiry","__child_collection","__child_collection_size","__parent_collection","__parent_collection_size","__items_size","stl_text","stl_justification","stl_xrelative","stl_yrelative","stl_vertical","stl_verticalbase","stl_horizontalbase","stl_sizerelative","stl_color","stl_outline","stl_outlinecolor","stl_outlinesize","stl_font","stl_service","stl_tti","stl_gsi","cct","tcd","tcf","oet","cd","mnc","cpn","dfc","tcp","tcs","tet","tnb","tnd","en","co","tng","rd","mnr","dsc","opt","lc","tpt","tn","slr","tns","rn","pub","dsn","ecd","mrk_zerolength","mrk_text","mrk_color","pho_resource_name","pho_error_level","pho_error_code","pho_error_description","facedetect_rect_width","facedetect_rect_height","facedetect_rect_y","facedetect_rect_x","facedetect_pid","facedetect_rect","trackId","eidr_actor","eidr_alternateId","eidr_countryOfOrigin","eidr_director","eidr_id","eidr_referentType","eidr_releaseDate","eidr_resourceName","eidr_status","eidr_sync","ttml_div","ttml_root","vxa_collection_id","vxaId","vxaLocalPath","tco","cs","ebn","tf","cf","sgn","tci","jc","vp","sn"],z=["uuid","user","timestamp","change","conflict","mode"],ce=["name","id","referenced","data","inheritance"],de=[...z,"value","lang"],ue=[...z,...ce,"value","reference","type","track"],le=[...z,...ce,"cycle","field","group"],J=e=>Object.prototype.toString.call(e)==="[object Object]"&&e.value!==void 0,me=e=>["string","boolean","number"].includes(typeof e),_e=e=>J(e)&&((e==null?void 0:e.value)===null||J(e.value)||me(e.value)),tt=e=>Object.prototype.toString.call(e)==="[object Object]",fe=e=>Object.prototype.toString.call(e)==="[object Date]",pe=e=>e===null?!0:Array.isArray(e)?e.some(pe):me(e)||_e(e)||fe(e),Te=e=>{const t=r=>tt(r)&&r.value===void 0&&!!Object.entries(e);return Array.isArray(e)?e.every(Te):t(e)},rt=(e,t)=>e+(t.length>1?"s":""),Ee=(e,t)=>{const r=e.filter(i=>!t.includes(i));if(r.length)throw Error(`Unsupported ${rt("key",r)} (${r.join(", ")})`)},he=e=>{if(Array.isArray(e))throw Error("Invalid value inside value object, cannot be array");return[void 0,null].includes(e)?{}:fe(e)?{value:e.toISOString()}:{value:e.toString()}},nt=e=>{if(Ee(Object.keys(e),de),Object.keys(e).length===0)throw Error("Invalid value object, cannot be empty object");if(typeof(e==null?void 0:e.value)=="string")return e;const t=he(e==null?void 0:e.value);return{...e,...t!==void 0?t:{}}},q=e=>{if(![void 0,null].includes(e))return Array.isArray(e)?e.flatMap(q):J(e)?nt(e):he(e)},it=e=>{Ee(Object.keys(e),ue);const t=q(e==null?void 0:e.value);if(t===void 0){const{value:r,...i}=e;return i}return{...e,value:[...Array.isArray(t)?t:[t]]}},ot=e=>{if(_e(e))return it(e);const t=q(e);if(t!==void 0)return{value:[...Array.isArray(t)?t:[t]]}},Ae=e=>{const t=[],r=[];let i={};return Object.entries(e||{}).forEach(([n,o])=>{if(le.includes(n))i={...i,[n]:o};else if(pe(o))try{r.push({name:n,...ot(o)})}catch(a){throw Error(a.message+(n?` for field "${n}"`:""))}else if(Te(o))(Array.isArray(o)?o:[o]).forEach(a=>{t.push({name:n,...Ae(a)})});else throw Error(`Unhandled value for "${n}"`)}),{...i,...t.length>0?{group:t}:{},...r.length>0?{field:r}:{}}},st=e=>{const{start:t="-INF",end:r="+INF",base:i=void 0,...n}=e,{group:o,field:a}=Ae(n);return{...o?{group:o}:{},...a?{field:a}:{},start:t.toString(),end:r.toString(),...i?{base:i}:{}}},at=e=>({timespan:(Array.isArray(e)?e:[e||{}]).map(t=>st(t))}),ct=(e,t)=>{var n,o;const[r]=((n=e==null?void 0:e.start)==null?void 0:n.split("@"))||[],[i]=((o=t==null?void 0:t.start)==null?void 0:o.split("@"))||[];return Number(r)<Number(i)?-1:Number(r)>Number(i)?1:0},M=e=>Array.isArray(e)?e:e&&[e]||[],Ie=e=>Array.isArray(e)?e.pop():e,dt=e=>(e==null?void 0:e.every(t=>typeof t=="string"))||!1,Oe={includeValueAttributes:!1};function ut(e,t){const{includeValueAttributes:r}={...Oe,...t||{}};if(r===!1)return e==null?void 0:e.value;const{value:i,...n}=e;return{...r===!0&&n||Array.isArray(r)&&Object.fromEntries(Object.entries(n).filter(([a])=>r.includes(a)))||{},value:i}}const Se={...Oe,joinValue:void 0,arrayOnSingleValue:!0};function lt(e,t){const{joinValue:r,arrayOnSingleValue:i,...n}={...Se,...t||{}},o=e==null?void 0:e.map(a=>ut(a,n));return dt(o)&&r?o==null?void 0:o.join(r):i!==!0&&(o==null?void 0:o.length)<=1?o==null?void 0:o[0]:o}const ge={includeFieldAttributes:!1,...Se},mt=(e,t)=>{const{includeFieldAttributes:r,...i}={...ge,...t||{}},{value:n,...o}=e,a=lt(n,i),s=r===!0&&o||Array.isArray(r)&&Object.fromEntries(Object.entries(o).filter(([c])=>r.includes(c)))||{};return r?{...s,value:a}:a},$={...ge,fieldAsList:!1,arrayOnSingleField:!1,overrideField:void 0},X=(e,t)=>{const r={...$,...t||{}},{fieldAsList:i,arrayOnSingleField:n,overrideField:o}=r,a=o===!0&&i===!1,s={};return e==null||e.forEach(c=>{const{name:f}=c,d=mt(c,r),l=n===!0?M(d):d,m=s[f];m?a?s[f]=d:s[f]=[M(m),M(d)].flat():s[f]=l}),i===!0?Object.values(s).flat():s},Re={...$,includeGroupAttributes:!1,groupAsList:!1,arrayOnSingleGroup:!1,overrideGroup:void 0},_t=(e,t)=>{const r={...Re,...t||{}},{includeGroupAttributes:i}=r,n=Object.fromEntries(Object.entries(r).filter(([l])=>Object.keys($).includes(l))),{field:o,group:a,...s}=e,c=o&&X(o,n),f=a&&Z(a,r);return{...i===!0&&s||Array.isArray(i)&&Object.fromEntries(Object.entries(s).filter(([l])=>i.includes(l)))||{},...n!=null&&n.fieldAsList?c&&{field:c}||{}:c,...r!=null&&r.groupAsList?f&&{group:f}||{}:f}},Q=Re,Z=(e,t)=>{const r={...Q,...t||{}},{groupAsList:i,arrayOnSingleGroup:n,overrideGroup:o}=r,a=o===!0&&i===!1,s={};return e==null||e.forEach(c=>{const{name:f}=c,d=_t(c,r),l=n===!0?M(d):d,m=s[f];m?a?s[f]=d:s[f]=[M(m),M(d)].flat():s[f]=l}),i?Object.values(s).flat():s},be={...Q,includeTimespanAttributes:!1,flat:!1,arrayOnSingle:!1,arrayOnSingleValue:!0,arrayOnSingleGroup:void 0,arrayOnSingleField:void 0},Ne=(e,t)=>{const r={...be,...t||{}},{includeTimespanAttributes:i,arrayOnSingle:n,flat:o}=r,a=Object.fromEntries(Object.entries(t).map(([u,_])=>{if(Object.keys(Q).includes(u))return["arrayOnSingleGroup","arrayOnSingleField","arrayOnSingleValue"].includes(u)&&(_!==void 0?_:n===!0)?[u,!0]:["overrideGroup","overrideField"].includes(u)&&(_!==void 0?_:o===!0)?[u,!0]:[u,_]}).filter(u=>!!u)),s=Object.fromEntries(Object.entries(t).map(([u,_])=>{if(Object.keys($).includes(u))return["arrayOnSingleField","arrayOnSingleValue"].includes(u)&&(_!==void 0?_:n===!0)?[u,!0]:["overrideField"].includes(u)&&(_!==void 0?_:o===!0)?[u,!0]:[u,_]}).filter(u=>!!u)),{field:c,group:f,...d}=e||{},l=c&&X(c,s),m=f&&Z(f,a);return{...i===!0&&d||Array.isArray(i)&&Object.fromEntries(Object.entries(d).filter(([u])=>i.includes(u)))||{},...s!=null&&s.fieldAsList?{field:l}:l,...a!=null&&a.groupAsList?{group:m}:m}},ee={...be,timespanAsList:!1,joinTimespan:"_",sortTimespan:!1,flat:!1,flatTimespan:void 0},te=(e,t)=>{const r={...ee,...t||{}},{timespanAsList:i,joinTimespan:n,sortTimespan:o,flat:a,flatTimespan:s,...c}=r,f={flat:a,...c};o&&e.sort(ct);const d=(s!==void 0?s===!0:a===!0)&&i===!1,l={};return e==null||e.forEach(m=>{const{start:p,end:u}=m,_=d?"flat":[p,u].join(n),E=Ne(m,f),h=l[_];h?d?p==="-INF"&&u==="+INF"?l[_]={...Ie(h),...E}:l[_]={...E,...Ie(h)}:l[_]=[...M(h),E]:l[_]=E}),i===!0?Object.values(l):d?Object.values(l).pop():l},ft={...ee,includeMetadataAttributes:!1,flat:!1};function ye(e,t){const r={...ft,...t||{}},{includeMetadataAttributes:i,flat:n}=r,{timespan:o=[],...a}=e||{},s=Object.fromEntries(Object.entries(t).map(([d,l])=>{if(Object.keys(ee).includes(d))return["onlyGeneric","overrideGroup","overrideField"].includes(d)&&(l!==void 0?l:n===!0)?[d,!0]:[d,l]}).filter(d=>!!d)),c=te(o,s);return{...i===!0&&{...a,...a.revision?{revision:a.revision.split(",")}:{}}||Array.isArray(i)&&Object.fromEntries(Object.entries(a).map(([d,l])=>{if(i.includes(d))return[d,d==="revision"&&typeof l=="string"?l.split(","):l]}).filter(d=>!!d))||{},...s!=null&&s.timespanAsList?{timespan:c}:c}}const pt=e=>{const{field:t=[]}=e||{};return y(t)},re={PAL:{denominator:25,numerator:1},NTSC:{denominator:3e4,numerator:1001},NTSC30:{denominator:30,numerator:1},29.97:{denominator:3e4,numerator:1001},59.94:{denominator:6e4,numerator:1001},23.976:{denominator:48e3,numerator:2002},23.98:{denominator:48e3,numerator:2002}},De=Object.keys(re),Me={toText:{constant:!1,fraction:!1},toRate:{fixed:!0,rounded:!1}};class g{constructor(t){this.numerator=1,this.denominator=1;const{numerator:r=1,denominator:i=1}=t||{};this.numerator=Number(r),this.denominator=Number(i)}toConstant(){let t;return Object.entries(re).find(r=>{const[i,n]=r,{numerator:o,denominator:a}=n;return o===this.numerator&&a===this.denominator?(t=i,!0):!1}),t}toText(t){const{constant:r,fraction:i}={...Me.toText,...t};if(r){const o=this.toConstant();if(o)return o}return i||this.numerator>1?[this.denominator,this.numerator].join(":"):String(this.denominator)}toRate(t){const r=this.denominator/this.numerator;if(Number.isInteger(r))return r;const{rounded:i,fixed:n}={...Me.toRate,...t||{}};return i?Math.round(r):n===!0||typeof n=="number"?Number(r.toFixed(typeof n=="boolean"?2:n)):r}toObject(){return{denominator:this.denominator,numerator:this.numerator}}toJson(){return console.warn("Deprecated - use toObject instead"),this.toObject()}}const G=e=>{if(e===void 0)return new g;if(typeof e=="number")return new g({denominator:e});if(typeof e=="string"&&e.includes(":")){const[t,r]=e.split(":");return new g({denominator:t,numerator:r})}if(De.includes(e))return new g(re[e]);if(!["string","number"].includes(typeof e)||Number.isNaN(Number(e)))throw new Error(`timeBaseText must be a number or ${De.join(",")} - is ${JSON.stringify(e)}`);return new g({denominator:Number(e)})},v=e=>new g(e),j=e=>e instanceof g?e:typeof e=="string"||typeof e=="number"?G(e):v(e),ne=e=>{const t=e.toConstant();return t==="59.94"&&4||["NTSC","29.97"].includes(t)&&2||void 0},Fe=e=>ne(e)>0,ve=e=>{const{samples:t,timeBase:r}=e,i=ne(r);if(!i)return 0;const n=r.toRate({rounded:!0}),o=60*n,a=60*n-i,s=10*(o-i)+i,c=Math.floor((t+1)/s),f=Math.max(0,(t+1)%s-o),d=Math.floor(f/a),m=f%a>0?i:0;return c*9*i+d*i+m},ie={conformTimeBase:{dropFrame:void 0,frameSeparator:void 0},toText:{constant:!1,fraction:!1,includeTimeBaseForSeconds:!1},toDuration:{format:void 0}};class N{constructor(t,r){this.samples=0,this.timeBase=new g;const{samples:i,timeBase:n}=t||{};if(i!==void 0)if(typeof i=="number")this.samples=i;else if(typeof i=="string")i==="-INF"?this.samples=-1/0:i==="+INF"?this.samples=1/0:this.samples=Number(i);else throw new Error(`samples is not number/string/-Inf/+Inf is: ${i}`);n!==void 0&&(n instanceof g?this.timeBase=n:this.timeBase=j(n)),this.dropFrame=(r==null?void 0:r.dropFrame)??Fe(this.timeBase),this.frameSeparator=(r==null?void 0:r.frameSeparator)??(this.dropFrame?";":":")}add(t){if(!(t!=null&&t.timeBase)||(t==null?void 0:t.samples)===void 0)throw Error("Invalid timeCodeType, cannot be added");const{numerator:r,denominator:i}=(t==null?void 0:t.timeBase)||{};let n=t;(r!==this.timeBase.numerator||i!==this.timeBase.denominator)&&(n=t.conformTimeBase(this.timeBase));const{samples:o}=n;return new N({samples:this.samples+o,timeBase:this.timeBase})}subtract(t){if(!(t!=null&&t.timeBase)||(t==null?void 0:t.samples)===void 0)throw Error("Invalid timeCodeType, cannot be subtracted");const{timeBase:{numerator:r,denominator:i}={}}=t;let n=t;(r!==this.timeBase.numerator||i!==this.timeBase.denominator)&&(n=t.conformTimeBase(this.timeBase));const{samples:o}=n;return new N({samples:this.samples-o,timeBase:this.timeBase})}conformTimeBase(t,r){const i=t instanceof g?t:j(t),n=(r==null?void 0:r.roundingMode)??"floor";if(!["floor","ceil","round"].includes(n))throw Error(`Invalid mode selection "${n}". Has to be one of "${["floor","ceil","round"].join(", ")}"`);const o=Math[n](this.samples/(this.timeBase.toRate({fixed:!1})/i.toRate({fixed:!1}))),a={...ie.conformTimeBase,...r||{}};return new N({samples:o,timeBase:i},a)}toText(t){let r=`${this.samples}`;const i={...ie.toText,...t||{}},n=this.timeBase.toText(i);return(t!=null&&t.includeTimeBaseForSeconds||!["1","1:1"].includes(n))&&(r=[this.samples,n].join("@")),r}toUnits(){if(this.samples===1/0)return{hours:1/0,minutes:1/0,seconds:1/0,frames:1/0};const t=this.samples+(this.dropFrame?ve(this):0);let r=this.timeBase.toRate({rounded:!0});["23.976","23.98"].includes(this.timeBase.toConstant())&&(r=this.timeBase.toRate({fixed:!0}));const i=Math.floor(t/(3600*r)),n=Math.floor(t/(60*r))%60,o=Math.floor(t/r)%60,a=Math.floor(t%r);return{hours:i,minutes:n,seconds:o,frames:a}}toTime(){const t=this.samples+ve(this),{hours:r,minutes:i,seconds:n}=this.toUnits(),o=this.timeBase.toRate({rounded:!0}),a=t%o,s=Math.floor(1e3*a/o),c=a/o;return{hours:r,minutes:i,seconds:n,milliseconds:s,partialSeconds:c}}toSeconds(t){const{numerator:r,denominator:i}=this.timeBase,n=+(this.samples*r/i);return t!=null&&t.round?Math.round(1e3*n)/1e3:n}toDuration(t){const{format:r}={...ie.toDuration,...t||{}},{hours:i,...n}=this.toTime();let{minutes:o,seconds:a,milliseconds:s}=n;if(r&&typeof r!="string")throw Error("format has to be a string");const c=(m,p)=>!r.includes(m)||!p.some(u=>r.includes(u)&&r.lastIndexOf(m)>r.indexOf(u));if(r&&!(c("h",["m","s","S"])&&c("m",["s","S"])&&c("s",["S"])))throw Error("format order is unsupported (has to be h, m, s then S)");if(!r)return`${i>0?`${i}:${`${o}`.padStart(2,"0")}`:o}:${`${a}`.padStart(2,"0")}`;const f=(m,p)=>{let u=m;for(;p[u]===p[u+1];)u+=1;return u-m+1},d=["h","m","s","S"],l=[];return[...r].forEach((m,p,u)=>{switch(m){case"h":{if(u[p-1]==="h")break;const _=f(p,u);l.push(`${i}`.padStart(_,"0")),d.includes(u[p+_])&&l.push(":");break}case"m":{if(u[p-1]==="m")break;const _=f(p,u);r.includes("h")||(o+=i*60),l.push(`${o}`.padStart(_,"0")),d.includes(u[p+_])&&l.push(":");break}case"s":{if(u[p-1]==="s")break;const _=f(p,u);r.includes("m")||(a+=o*60),l.push(`${a}`.padStart(_,"0")),d.includes(u[p+_])&&l.push(".");break}case"S":{if(u[p-1]==="S")break;const _=f(p,u);r.includes("s")||(s+=a*1e3),l.push(`${Math.round(s/10**(3-_))}`.padStart(_,"0"));break}default:l.push(m)}}),l.join("")}toSmpte(){if(this.samples===-1/0)return"00:00:00:00";const{hours:t,minutes:r,seconds:i,frames:n}=this.toUnits(),o=[t.toFixed().padStart(2,"0"),r.toFixed().padStart(2,"0"),i.toFixed().padStart(2,"0")].join(":"),a=Math.max(2,`${this.timeBase.toRate({rounded:!0})-1}`.length);return[o,`${n}`.padStart(a,"0")].join(this.frameSeparator)}toObject(){return{samples:this.samples,timeBase:this.timeBase.toObject()}}toJson(){return console.warn("Deprecated - use toObject instead"),this.toObject()}}const Tt=(e,t)=>{let r=Math.abs(e),i=Math.abs(t);for(;r&&i&&r!==i;)r>i?[r,i]=[r-i,i]:[r,i]=[r,i-r];return r||i},Ce=(e,t)=>{const{timeBase:r,useGCD:i=!1,roundingMode:n,...o}=t||{},a=`${e}`.replace(/,/g,".");if(Number.isNaN(+a))throw new Error(`seconds must be digits, is ${e}`);let s=1,c;if(Number.isInteger(+a))c=+a*s;else{const[,d]=a.split("."),l=Math.min((d==null?void 0:d.length)??0,16);s*=10**l,c=Math.round(Number(a)*s)}if(r===void 0&&i){const d=Tt(s,c);c/=d,s/=d}const f=new N({samples:c,timeBase:{denominator:s,numerator:1}},o);return r!==void 0?f.conformTimeBase(r,{...o,roundingMode:n}):f},Et=([e,t,r,i],n,o)=>{const a=o.toRate({rounded:!0}),s=ne(o);if(n===0||!s)return 0;const c=t%10!==0,f=c&&r===0,d=e*(3600*a-54*s),l=t*60*a-(t-Math.ceil(t/10))*s,m=r*a-(c&&r>1?s:0);if(f&&i<s)throw new Error(`Frame does not exist for ${o.toConstant()||o.toRate()} drop-frame`);const p=f?i-s:i,u=d+l+m+p;return n-u},oe=(e,t,r)=>{const[i,n,o,a]=e,s=t.toRate({rounded:!0}),c=i*3600*s+n*60*s+o*s+a;return c-(r?Et(e,c,t):0)},ht=e=>{const[t]=(e==null?void 0:e.match(/[^0-9:\-_]/))||[];let r=[];if(t){const[n,o]=e.split(t);r=[...n.split(":"),o]}else r=e.split(":");if(r.length!==4)throw new Error('Invalid format, must be "##:##:##:##');if(r.some(n=>Number.isNaN(n)))throw new Error("Invalid format, values must be numbers");const i=t||":";return{smpteValues:r.map(Number),smpteFrameSeparator:i}},At=["error","add","ignore"],It={exceedingMode:"error",timeBase:void 0,dropFrame:void 0,frameSeparator:void 0},Le=(e,t)=>{const{exceedingMode:r,timeBase:i,...n}={...It,...t};if([null,void 0].includes(e))throw new Error("smpte cannot be undefined or null");if(typeof e!="string")throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);const{smpteValues:o,smpteFrameSeparator:a}=ht(e),s=j(i),c={...n,frameSeparator:(n==null?void 0:n.frameSeparator)||a,...(n==null?void 0:n.dropFrame)===void 0?{dropFrame:i!==void 0?Fe(s):[";",","].includes(a)}:{}},f=s.toRate({rounded:!0}),d=Math.max(0,f-1);if(o.some(m=>m<0))throw new Error("Negative values are not supported");let l;switch(r){case"error":{const[m,p,u,_]=o;if(m>=100||p>=60)throw Error("Minutes has to be less than 60");if(u>=60)throw Error("Seconds has to be less than 60");if(_>d)throw Error(`Frames has to be less or equal to ${d}`);l=oe(o,s,c==null?void 0:c.dropFrame);break}case"ignore":{const[m,p,u,_]=o,E=[Math.min(100,m),Math.min(59,p),Math.min(59,u),Math.min(d,_)];l=oe(E,s,c==null?void 0:c.dropFrame);break}case"add":{l=oe(o,s,c==null?void 0:c.dropFrame);break}default:throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(At)}`)}return new N({samples:l,timeBase:s},c)},Ot={timeBase:void 0,dropFrame:void 0,frameSeparator:void 0},W=(e,t)=>{const{timeBase:r,...i}={...Ot,...t};let n;if(e===void 0)n={samples:0};else if(typeof e=="number")n={samples:e};else if(e.includes("@")){const[a,s]=e.split("@");n={samples:Number(a),timeBase:G(s)}}else e==="-INF"?n={samples:-1/0}:e==="+INF"?n={samples:1/0}:n={samples:Number(e)};if(Number.isNaN(n==null?void 0:n.samples)||n.timeBase&&!(n.timeBase instanceof g))throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);const o=new N(n,i);return r?o.conformTimeBase(j(r),i):o},St={dropFrame:void 0,frameSeparator:void 0},C=(e,t)=>new N(e,{...St,...t}),gt=e=>!!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/),Rt=e=>!Number.isNaN(Number(e)),L=(e,t)=>{if(e instanceof N)return e;if(typeof e!="string"&&typeof e!="number")return C(e,t);if(typeof e=="string"&>(e))return Le(e,t);if(["string","number"].includes(typeof e)&&Rt(e))return Ce(e,t);if(typeof e=="string")return W(e,t)};function we({hours:e=0,minutes:t=0,seconds:r=0,partialSeconds:i=0}){const n=e.toFixed().padStart(2,"0"),o=t.toFixed().padStart(2,"0"),a=r.toFixed().padStart(2,"0"),s=(i*10).toFixed().padStart(3,"0");return`${n}:${o}:${a}.${s}`}const bt={subtitleGroup:"stl_subtitle",subtitleField:"stl_text"},Nt=(e,t)=>{const{subtitleGroup:r,subtitleField:i}={...bt,...t||{}},{timespan:n=[]}=e||{};if(n.length===0)return"";const a=te(n,{includeTimespanAttributes:!0,sortTimespan:!0,timespanAsList:!0,overrideGroup:!0,joinValue:","}).map(s=>{const{start:c,end:f,[r]:{[i]:d}={}}=(Array.isArray(s)?s[0]:s)||{};if(!d)return"";const l=we(W(c).toTime()),m=we(W(f).toTime());return`${l} --> ${m} line:0%\r${d}\r`});if(a.some(s=>!!s))return`WEBVTT
|
|
1
|
+
(function(p,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("filesize"),require("url-join"),require("lodash.merge")):typeof define=="function"&&define.amd?define(["exports","filesize","url-join","lodash.merge"],v):(p=typeof globalThis<"u"?globalThis:p||self,v(p["@vidispine/vdt-js"]={},p.filesize,p.urlJoin,p._merge))})(this,function(p,v,se,re){"use strict";const lt=(e,t)=>t?lt(t,e%t):e,J=e=>{const{width:t,height:s}=e||{};if(t===void 0||s===void 0)return;const i=lt(t,s);let r=t/i,n=s/i;return r>21&&(n=1,r=(t/s).toFixed(2)),[r,n].join(":")},M=e=>Object.fromEntries((e==null?void 0:e.map(({key:t,value:s})=>[t,s]))||[]),ie=(e,t,s)=>{let i;return r=>{const o=()=>{i=null,s||e.apply(void 0,r)},a=s&&!i;clearTimeout(i),i=setTimeout(o,t),a&&e.apply(void 0,r)}};function ne(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}const ae={ACCESSCONTROL_READ:"_accesscontrol_read",ACCESSCONTROL_WRITE:"_accesscontrol_write",ADMINISTRATOR:"_administrator",AUTO_PROJECTION_READ:"_auto_projection_read",AUTO_PROJECTION_WRITE:"_auto_projection_write",COLLECTION_NOTIFICATION_READ:"_collection_notification_read",COLLECTION_NOTIFICATION_WRITE:"_collection_notification_write",COLLECTION_READ:"_collection_read",COLLECTION_WRITE:"_collection_write",CONFIGURATION_READ:"_configuration_read",DELETION_LOCK_NOTIFICATION_READ:"_deletion_lock_notification_read",DELETION_LOCK_NOTIFICATION_WRITE:"_deletion_lock_notification_write",DELETION_LOCK_READ:"_deletion_lock_read",DELETION_LOCK_WRITE:"_deletion_lock_write",DOCUMENT_NOTIFICATION_READ:"_document_notification_read",DOCUMENT_NOTIFICATION_WRITE:"_document_notification_write",DOCUMENT_READ:"_document_read",DOCUMENT_WRITE:"_document_write",ERROR_READ:"_error_read",ERROR_WRITE:"_error_write",EXPORT:"_export",EXPORT_TEMPLATE_READ:"_export_template_read",EXPORT_TEMPLATE_WRITE:"_export_template_write",EXTERNAL_ID_READ:"_external_id_read",EXTERNAL_ID_WRITE:"_external_id_write",FILE_NOTIFICATION_READ:"_file_notification_read",FILE_NOTIFICATION_WRITE:"_file_notification_write",FILE_READ:"_file_read",FILE_WRITE:"_file_write",GROUP_READ:"_group_read",GROUP_WRITE:"_group_write",IMPORT_WRITE:"_import",ITEM_ID_READ:"_item_id_read",ITEM_ID_WRITE:"_item_id_write",ITEM_NOTIFICATION_READ:"_item_notification_read",ITEM_NOTIFICATION_WRITE:"_item_notification_write",ITEM_WRITE:"_item_write",ITEM_SEARCH:"_item_search",ITEM_SHAPE_READ:"_item_shape_read",ITEM_SHAPE_WRITE:"_item_shape_write",ITEM_TIMELINE_READ:"_item_timeline_read",ITEM_TIMELINE_WRITE:"_item_timeline_write",ITEM_URI:"_item_uri",JOB_NOTIFICATION_READ:"_job_notification_read",JOB_NOTIFICATION_WRITE:"_job_notification_write",JOB_READ:"_job_read",JOB_WRITE:"_job_write",LIBRARY_READ:"_library_read",LIBRARY_WRITE:"_library_write",LOCK_READ:"_lock_read",LOCK_WRITE:"_lock_write",LOG_READ:"_log_read",METADATA_DATASET_READ:"_metadata_dataset_read",METADATA_DATASET_WRITE:"_metadata_dataset_write",METADATA_FIELD_GROUP_READ:"_metadata_field_group_read",METADATA_FIELD_GROUP_WRITE:"_metadata_field_group_write",METADATA_FIELD_READ:"_metadata_field_read",METADATA_FIELD_WRITE:"_metadata_field_write",METADATA_GLOBAL_READ:"_metadata_global_read",METADATA_GLOBAL_WRITE:"_metadata_global_write",METADATA_LOCK_READ:"_metadata_lock_read",METADATA_LOCK_WRITE:"_metadata_lock_write",METADATA_READ:"_metadata_read",METADATA_SCHEMA_READ:"_metadata_schema_read",METADATA_SCHEMA_WRITE:"_metadata_schema_write",METADATA_WRITE:"_metadata_write",OTIF_ANALYZE:"_otif_analyze",OTIF_READ:"_otif_read",OTIF_WRITE:"_otif_write",PLACEHOLDER_NOTIFICATION_READ:"_placeholder_notification_read",PLACEHOLDER_NOTIFICATION_WRITE:"_placeholder_notification_write",PROJECTION_READ:"_projection_read",PROJECTION_WRITE:"_projection_write",QUOTA_NOTIFICATION_READ:"_quota_notification_read",QUOTA_NOTIFICATION_WRITE:"_quota_notification_write",QUOTA_READ:"_quota_read",QUOTA_WRITE:"_quota_write",RELATION_READ:"_relation_read",RELATION_WRITE:"_relation_write",RESOURCE_READ:"_resource_read",RESOURCE_WRITE:"_resource_write",RUN_AS:"_run_as",SEARCH:"_search",SEQUENCE_READ:"_sequence_read",SEQUENCE_WRITE:"_sequence_write",SHAPE_TAG_READ:"_shape_tag_read",SHAPE_TAG_WRITE:"_shape_tag_write",SITE_MANAGER:"_site_manager",SITE_RULE_READ:"_site_rule_read",SITE_RULE_WRITE:"_site_rule_write",STORAGE_GROUP_READ:"_storage_group_read",STORAGE_GROUP_WRITE:"_storage_group_write",STORAGE_NOTIFICATION_READ:"_storage_notification_read",STORAGE_NOTIFICATION_WRITE:"_storage_notification_write",STORAGE_READ:"_storage_read",STORAGE_RULE_READ:"_storage_rule_read",STORAGE_RULE_WRITE:"_storage_rule_write",STORAGE_WRITE:"_storage_write",SUPER_ACCESS_USER:"_super_access_user",TASKDEFINITION_READ:"_taskdefinition_read",TASKDEFINITION_WRITE:"_taskdefinition_write",THUMBNAIL_READ:"_thumbnail_read",THUMBNAIL_WRITE:"_thumbnail_write",TRANSCODER:"_transcoder",TRANSFER_READ:"_transfer_read",TRANSFER_WRITE:"_transfer_write",USER:"_user",VXA:"_vxa",VXA_READ:"_vxa_read"},oe=["stl_subtitle","stl_tti","stl_gsi","mrk_marker","pho_validation","pho_resource","pho_error","facedetect_rect","facedetect_face","originalTrackFilename","stl_gsiHeader"],ce=["title","user","shapeTag","representativeThumbnail","representativeThumbnailNoAuth","representativeItems","itemId","collectionId","mediaType","mimeType","created","startTimeCode","startSeconds","fieldValidationError","schemaValidationError","originalFilename","originalUri","originalAudioCodec","originalVideoCodec","originalHeight","originalWidth","originalFormat","durationSeconds","durationTimeCode","solr-index","__user","__collection","__collection_size","__ancestor_collection","__ancestor_collection_size","__shape","__shape_size","__shape_last_added","__placeholder_shape_size","__version","__version_count","__storage","__storage_size","__shapetag_{tag}_hash_{hash}","__storage_{tag}","__storage_{tag}_size","__storagegroup","__storagegroup_size","__sequence","__sequence_size","__metadata_last_modified","__external_id","__deletion_lock_id","__deletion_lock_expiry","__child_collection","__child_collection_size","__parent_collection","__parent_collection_size","__items_size","stl_text","stl_justification","stl_xrelative","stl_yrelative","stl_vertical","stl_verticalbase","stl_horizontalbase","stl_sizerelative","stl_color","stl_outline","stl_outlinecolor","stl_outlinesize","stl_font","stl_service","stl_tti","stl_gsi","cct","tcd","tcf","oet","cd","mnc","cpn","dfc","tcp","tcs","tet","tnb","tnd","en","co","tng","rd","mnr","dsc","opt","lc","tpt","tn","slr","tns","rn","pub","dsn","ecd","mrk_zerolength","mrk_text","mrk_color","pho_resource_name","pho_error_level","pho_error_code","pho_error_description","facedetect_rect_width","facedetect_rect_height","facedetect_rect_y","facedetect_rect_x","facedetect_pid","facedetect_rect","trackId","eidr_actor","eidr_alternateId","eidr_countryOfOrigin","eidr_director","eidr_id","eidr_referentType","eidr_releaseDate","eidr_resourceName","eidr_status","eidr_sync","ttml_div","ttml_root","vxa_collection_id","vxaId","vxaLocalPath","tco","cs","ebn","tf","cf","sgn","tci","jc","vp","sn"],X=["uuid","user","timestamp","change","conflict","mode"],ft=["name","id","referenced","data","inheritance"],mt=[...X,"value","lang"],ht=[...X,...ft,"value","reference","type","track"],pt=[...X,...ft,"cycle","field","group"],Q=e=>Object.prototype.toString.call(e)==="[object Object]"&&e.value!==void 0,_t=e=>["string","boolean","number"].includes(typeof e),Tt=e=>Q(e)&&((e==null?void 0:e.value)===null||Q(e.value)||_t(e.value)),ue=e=>Object.prototype.toString.call(e)==="[object Object]",Et=e=>Object.prototype.toString.call(e)==="[object Date]",gt=e=>e===null?!0:Array.isArray(e)?e.some(gt):_t(e)||Tt(e)||Et(e),At=e=>{const t=s=>ue(s)&&s.value===void 0&&!!Object.entries(e);return Array.isArray(e)?e.every(At):t(e)},de=(e,t)=>e+(t.length>1?"s":""),It=(e,t)=>{const s=e.filter(i=>!t.includes(i));if(s.length)throw Error(`Unsupported ${de("key",s)} (${s.join(", ")})`)},Ot=e=>{if(Array.isArray(e))throw Error("Invalid value inside value object, cannot be array");return[void 0,null].includes(e)?{}:Et(e)?{value:e.toISOString()}:{value:e.toString()}},le=e=>{if(It(Object.keys(e),mt),Object.keys(e).length===0)throw Error("Invalid value object, cannot be empty object");if(typeof(e==null?void 0:e.value)=="string")return e;const t=Ot(e==null?void 0:e.value);return{...e,...t!==void 0?t:{}}},Z=e=>{if(![void 0,null].includes(e))return Array.isArray(e)?e.flatMap(Z):Q(e)?le(e):Ot(e)},fe=e=>{It(Object.keys(e),ht);const t=Z(e==null?void 0:e.value);if(t===void 0){const{value:s,...i}=e;return i}return{...e,value:[...Array.isArray(t)?t:[t]]}},me=e=>{if(Tt(e))return fe(e);const t=Z(e);if(t!==void 0)return{value:[...Array.isArray(t)?t:[t]]}},bt=e=>{const t=[],s=[];let i={};return Object.entries(e||{}).forEach(([r,n])=>{if(pt.includes(r))i={...i,[r]:n};else if(gt(n))try{s.push({name:r,...me(n)})}catch(o){throw Error(o.message+(r?` for field "${r}"`:""))}else if(At(n))(Array.isArray(n)?n:[n]).forEach(o=>{t.push({name:r,...bt(o)})});else throw Error(`Unhandled value for "${r}"`)}),{...i,...t.length>0?{group:t}:{},...s.length>0?{field:s}:{}}},he=e=>{const{start:t="-INF",end:s="+INF",base:i=void 0,...r}=e,{group:n,field:o}=bt(r);return{...n?{group:n}:{},...o?{field:o}:{},start:t.toString(),end:s.toString(),...i?{base:i}:{}}},pe=e=>({timespan:(Array.isArray(e)?e:[e||{}]).map(t=>he(t))}),_e=(e,t)=>{var r,n;const[s]=((r=e==null?void 0:e.start)==null?void 0:r.split("@"))||[],[i]=((n=t==null?void 0:t.start)==null?void 0:n.split("@"))||[];return Number(s)<Number(i)?-1:Number(s)>Number(i)?1:0},C=e=>Array.isArray(e)?e:e&&[e]||[],St=e=>Array.isArray(e)?e.pop():e,Te=e=>(e==null?void 0:e.every(t=>typeof t=="string"))||!1,Rt={includeValueAttributes:!1};function Ee(e,t){const{includeValueAttributes:s}={...Rt,...t||{}};if(s===!1)return e==null?void 0:e.value;const{value:i,...r}=e;return{...s===!0&&r||Array.isArray(s)&&Object.fromEntries(Object.entries(r).filter(([o])=>s.includes(o)))||{},value:i}}const yt={...Rt,joinValue:void 0,arrayOnSingleValue:!0};function ge(e,t){const{joinValue:s,arrayOnSingleValue:i,...r}={...yt,...t||{}},n=e==null?void 0:e.map(o=>Ee(o,r));return Te(n)&&s?n==null?void 0:n.join(s):i!==!0&&(n==null?void 0:n.length)<=1?n==null?void 0:n[0]:n}const vt={includeFieldAttributes:!1,...yt},Ae=(e,t)=>{const{includeFieldAttributes:s,...i}={...vt,...t||{}},{value:r,...n}=e,o=ge(r,i),a=s===!0&&n||Array.isArray(s)&&Object.fromEntries(Object.entries(n).filter(([c])=>s.includes(c)))||{};return s?{...a,value:o}:o},x={...vt,fieldAsList:!1,arrayOnSingleField:!1,overrideField:void 0},tt=(e,t)=>{const s={...x,...t||{}},{fieldAsList:i,arrayOnSingleField:r,overrideField:n}=s,o=n===!0&&i===!1,a={};return e==null||e.forEach(c=>{const{name:l}=c,u=Ae(c,s),f=r===!0?C(u):u,m=a[l];m?o?a[l]=u:a[l]=[C(m),C(u)].flat():a[l]=f}),i===!0?Object.values(a).flat():a},Ft={...x,includeGroupAttributes:!1,groupAsList:!1,arrayOnSingleGroup:!1,overrideGroup:void 0},Ie=(e,t)=>{const s={...Ft,...t||{}},{includeGroupAttributes:i}=s,r=Object.fromEntries(Object.entries(s).filter(([f])=>Object.keys(x).includes(f))),{field:n,group:o,...a}=e,c=n&&tt(n,r),l=o&&st(o,s);return{...i===!0&&a||Array.isArray(i)&&Object.fromEntries(Object.entries(a).filter(([f])=>i.includes(f)))||{},...r!=null&&r.fieldAsList?c&&{field:c}||{}:c,...s!=null&&s.groupAsList?l&&{group:l}||{}:l}},et=Ft,st=(e,t)=>{const s={...et,...t||{}},{groupAsList:i,arrayOnSingleGroup:r,overrideGroup:n}=s,o=n===!0&&i===!1,a={};return e==null||e.forEach(c=>{const{name:l}=c,u=Ie(c,s),f=r===!0?C(u):u,m=a[l];m?o?a[l]=u:a[l]=[C(m),C(u)].flat():a[l]=f}),i?Object.values(a).flat():a},Mt={...et,includeTimespanAttributes:!1,flat:!1,arrayOnSingle:!1,arrayOnSingleValue:!0,arrayOnSingleGroup:void 0,arrayOnSingleField:void 0},Dt=(e,t)=>{const s={...Mt,...t||{}},{includeTimespanAttributes:i,arrayOnSingle:r,flat:n}=s,o=Object.fromEntries(Object.entries(t).map(([d,h])=>{if(Object.keys(et).includes(d))return["arrayOnSingleGroup","arrayOnSingleField","arrayOnSingleValue"].includes(d)&&(h!==void 0?h:r===!0)?[d,!0]:["overrideGroup","overrideField"].includes(d)&&(h!==void 0?h:n===!0)?[d,!0]:[d,h]}).filter(d=>!!d)),a=Object.fromEntries(Object.entries(t).map(([d,h])=>{if(Object.keys(x).includes(d))return["arrayOnSingleField","arrayOnSingleValue"].includes(d)&&(h!==void 0?h:r===!0)?[d,!0]:["overrideField"].includes(d)&&(h!==void 0?h:n===!0)?[d,!0]:[d,h]}).filter(d=>!!d)),{field:c,group:l,...u}=e||{},f=c&&tt(c,a),m=l&&st(l,o);return{...i===!0&&u||Array.isArray(i)&&Object.fromEntries(Object.entries(u).filter(([d])=>i.includes(d)))||{},...a!=null&&a.fieldAsList?{field:f}:f,...o!=null&&o.groupAsList?{group:m}:m}},rt={...Mt,timespanAsList:!1,joinTimespan:"_",sortTimespan:!1,flat:!1,flatTimespan:void 0},it=(e,t)=>{const s={...rt,...t||{}},{timespanAsList:i,joinTimespan:r,sortTimespan:n,flat:o,flatTimespan:a,...c}=s,l={flat:o,...c};n&&e.sort(_e);const u=(a!==void 0?a===!0:o===!0)&&i===!1,f={};return e==null||e.forEach(m=>{const{start:_,end:d}=m,h=u?"flat":[_,d].join(r),g=Dt(m,l),A=f[h];A?u?_==="-INF"&&d==="+INF"?f[h]={...St(A),...g}:f[h]={...g,...St(A)}:f[h]=[...C(A),g]:f[h]=g}),i===!0?Object.values(f):u?Object.values(f).pop():f},Oe={...rt,includeMetadataAttributes:!1,flat:!1};function Ct(e,t){const s={...Oe,...t||{}},{includeMetadataAttributes:i,flat:r}=s,{timespan:n=[],...o}=e||{},a=Object.fromEntries(Object.entries(t).map(([u,f])=>{if(Object.keys(rt).includes(u))return["onlyGeneric","overrideGroup","overrideField"].includes(u)&&(f!==void 0?f:r===!0)?[u,!0]:[u,f]}).filter(u=>!!u)),c=it(n,a);return{...i===!0&&{...o,...o.revision?{revision:o.revision.split(",")}:{}}||Array.isArray(i)&&Object.fromEntries(Object.entries(o).map(([u,f])=>{if(i.includes(u))return[u,u==="revision"&&typeof f=="string"?f.split(","):f]}).filter(u=>!!u))||{},...a!=null&&a.timespanAsList?{timespan:c}:c}}const be=e=>{const{field:t=[]}=e||{};return M(t)},nt={PAL:{denominator:25,numerator:1},NTSC:{denominator:3e4,numerator:1001},NTSC30:{denominator:30,numerator:1},29.97:{denominator:3e4,numerator:1001},59.94:{denominator:6e4,numerator:1001},23.976:{denominator:48e3,numerator:2002},23.98:{denominator:48e3,numerator:2002}},Nt=Object.keys(nt),wt={toText:{constant:!1,fraction:!1},toRate:{fixed:!0,rounded:!1}};class R{constructor(t){this.numerator=1,this.denominator=1;const{numerator:s=1,denominator:i=1}=t||{};this.numerator=Number(s),this.denominator=Number(i)}toConstant(){let t;return Object.entries(nt).find(s=>{const[i,r]=s,{numerator:n,denominator:o}=r;return n===this.numerator&&o===this.denominator?(t=i,!0):!1}),t}toText(t){const{constant:s,fraction:i}={...wt.toText,...t};if(s){const n=this.toConstant();if(n)return n}return i||this.numerator>1?[this.denominator,this.numerator].join(":"):String(this.denominator)}toRate(t){const s=this.denominator/this.numerator;if(Number.isInteger(s))return s;const{rounded:i,fixed:r}={...wt.toRate,...t||{}};return i?Math.round(s):r===!0||typeof r=="number"?Number(s.toFixed(typeof r=="boolean"?2:r)):s}toObject(){return{denominator:this.denominator,numerator:this.numerator}}toJson(){return console.warn("Deprecated - use toObject instead"),this.toObject()}}const G=e=>{if(e===void 0)return new R;if(typeof e=="number")return new R({denominator:e});if(typeof e=="string"&&e.includes(":")){const[t,s]=e.split(":");return new R({denominator:t,numerator:s})}if(Nt.includes(e))return new R(nt[e]);if(!["string","number"].includes(typeof e)||Number.isNaN(Number(e)))throw new Error(`timeBaseText must be a number or ${Nt.join(",")} - is ${JSON.stringify(e)}`);return new R({denominator:Number(e)})},w=e=>new R(e),W=e=>e instanceof R?e:typeof e=="string"||typeof e=="number"?G(e):w(e),at=e=>{const t=e.toConstant();return t==="59.94"&&4||["NTSC","29.97"].includes(t)&&2||void 0},Bt=e=>at(e)>0,Lt=e=>{const{samples:t,timeBase:s}=e,i=at(s);if(!i)return 0;const r=s.toRate({rounded:!0}),n=60*r,o=60*r-i,a=10*(n-i)+i,c=Math.floor((t+1)/a),l=Math.max(0,(t+1)%a-n),u=Math.floor(l/o),m=l%o>0?i:0;return c*9*i+u*i+m},ot={conformTimeBase:{dropFrame:void 0,frameSeparator:void 0},toText:{constant:!1,fraction:!1,includeTimeBaseForSeconds:!1},toDuration:{format:void 0}};class F{constructor(t,s){this.samples=0,this.timeBase=new R;const{samples:i,timeBase:r}=t||{};if(i!==void 0)if(typeof i=="number")this.samples=i;else if(typeof i=="string")i==="-INF"?this.samples=-1/0:i==="+INF"?this.samples=1/0:this.samples=Number(i);else throw new Error(`samples is not number/string/-Inf/+Inf is: ${i}`);r!==void 0&&(r instanceof R?this.timeBase=r:this.timeBase=W(r)),this.dropFrame=(s==null?void 0:s.dropFrame)??Bt(this.timeBase),this.frameSeparator=(s==null?void 0:s.frameSeparator)??(this.dropFrame?";":":")}add(t){if(!(t!=null&&t.timeBase)||(t==null?void 0:t.samples)===void 0)throw Error("Invalid timeCodeType, cannot be added");const{numerator:s,denominator:i}=(t==null?void 0:t.timeBase)||{};let r=t;(s!==this.timeBase.numerator||i!==this.timeBase.denominator)&&(r=t.conformTimeBase(this.timeBase));const{samples:n}=r;return new F({samples:this.samples+n,timeBase:this.timeBase})}subtract(t){if(!(t!=null&&t.timeBase)||(t==null?void 0:t.samples)===void 0)throw Error("Invalid timeCodeType, cannot be subtracted");const{timeBase:{numerator:s,denominator:i}={}}=t;let r=t;(s!==this.timeBase.numerator||i!==this.timeBase.denominator)&&(r=t.conformTimeBase(this.timeBase));const{samples:n}=r;return new F({samples:this.samples-n,timeBase:this.timeBase})}conformTimeBase(t,s){const i=t instanceof R?t:W(t),r=(s==null?void 0:s.roundingMode)??"floor";if(!["floor","ceil","round"].includes(r))throw Error(`Invalid mode selection "${r}". Has to be one of "${["floor","ceil","round"].join(", ")}"`);const n=Math[r](this.samples/(this.timeBase.toRate({fixed:!1})/i.toRate({fixed:!1}))),o={...ot.conformTimeBase,...s||{}};return new F({samples:n,timeBase:i},o)}toText(t){let s=`${this.samples}`;const i={...ot.toText,...t||{}},r=this.timeBase.toText(i);return(t!=null&&t.includeTimeBaseForSeconds||!["1","1:1"].includes(r))&&(s=[this.samples,r].join("@")),s}toUnits(){if(this.samples===1/0)return{hours:1/0,minutes:1/0,seconds:1/0,frames:1/0};const t=this.samples+(this.dropFrame?Lt(this):0);let s=this.timeBase.toRate({rounded:!0});["23.976","23.98"].includes(this.timeBase.toConstant())&&(s=this.timeBase.toRate({fixed:!0}));const i=Math.floor(t/(3600*s)),r=Math.floor(t/(60*s))%60,n=Math.floor(t/s)%60,o=Math.floor(t%s);return{hours:i,minutes:r,seconds:n,frames:o}}toTime(){const t=this.samples+Lt(this),{hours:s,minutes:i,seconds:r}=this.toUnits(),n=this.timeBase.toRate({rounded:!0}),o=t%n,a=Math.floor(1e3*o/n),c=o/n;return{hours:s,minutes:i,seconds:r,milliseconds:a,partialSeconds:c}}toSeconds(t){const{numerator:s,denominator:i}=this.timeBase,r=+(this.samples*s/i);return t!=null&&t.round?Math.round(1e3*r)/1e3:r}toDuration(t){const{format:s}={...ot.toDuration,...t||{}},{hours:i,...r}=this.toTime();let{minutes:n,seconds:o,milliseconds:a}=r;if(s&&typeof s!="string")throw Error("format has to be a string");const c=(m,_)=>!s.includes(m)||!_.some(d=>s.includes(d)&&s.lastIndexOf(m)>s.indexOf(d));if(s&&!(c("h",["m","s","S"])&&c("m",["s","S"])&&c("s",["S"])))throw Error("format order is unsupported (has to be h, m, s then S)");if(!s)return`${i>0?`${i}:${`${n}`.padStart(2,"0")}`:n}:${`${o}`.padStart(2,"0")}`;const l=(m,_)=>{let d=m;for(;_[d]===_[d+1];)d+=1;return d-m+1},u=["h","m","s","S"],f=[];return[...s].forEach((m,_,d)=>{switch(m){case"h":{if(d[_-1]==="h")break;const h=l(_,d);f.push(`${i}`.padStart(h,"0")),u.includes(d[_+h])&&f.push(":");break}case"m":{if(d[_-1]==="m")break;const h=l(_,d);s.includes("h")||(n+=i*60),f.push(`${n}`.padStart(h,"0")),u.includes(d[_+h])&&f.push(":");break}case"s":{if(d[_-1]==="s")break;const h=l(_,d);s.includes("m")||(o+=n*60),f.push(`${o}`.padStart(h,"0")),u.includes(d[_+h])&&f.push(".");break}case"S":{if(d[_-1]==="S")break;const h=l(_,d);s.includes("s")||(a+=o*1e3),f.push(`${Math.round(a/10**(3-h))}`.padStart(h,"0"));break}default:f.push(m)}}),f.join("")}toSmpte(t){const{uniformSeparators:s}={uniformSeparators:!1,...t};if(this.samples===-1/0)return"00:00:00:00";const{hours:i,minutes:r,seconds:n,frames:o}=this.toUnits(),a=s?this.frameSeparator:":",c=[i.toFixed().padStart(2,"0"),r.toFixed().padStart(2,"0"),n.toFixed().padStart(2,"0")].join(a),l=Math.max(2,`${this.timeBase.toRate({rounded:!0})-1}`.length);return[c,`${o}`.padStart(l,"0")].join(this.frameSeparator)}toObject(){return{samples:this.samples,timeBase:this.timeBase.toObject()}}toJson(){return console.warn("Deprecated - use toObject instead"),this.toObject()}}const Se=(e,t)=>{let s=Math.abs(e),i=Math.abs(t);for(;s&&i&&s!==i;)s>i?[s,i]=[s-i,i]:[s,i]=[s,i-s];return s||i},Pt=(e,t)=>{const{timeBase:s,useGCD:i=!1,roundingMode:r,...n}=t||{},o=`${e}`.replace(/,/g,".");if(Number.isNaN(+o))throw new Error(`seconds must be digits, is ${e}`);let a=1,c;if(Number.isInteger(+o))c=+o*a;else{const[,u]=o.split("."),f=Math.min((u==null?void 0:u.length)??0,16);a*=10**f,c=Math.round(Number(o)*a)}if(s===void 0&&i){const u=Se(a,c);c/=u,a/=u}const l=new F({samples:c,timeBase:{denominator:a,numerator:1}},n);return s!==void 0?l.conformTimeBase(s,{...n,roundingMode:r}):l},Re=([e,t,s,i],r,n)=>{const o=n.toRate({rounded:!0}),a=at(n);if(r===0||!a)return 0;const c=t%10!==0,l=c&&s===0,u=e*(3600*o-54*a),f=t*60*o-(t-Math.ceil(t/10))*a,m=s*o-(c&&s>1?a:0);if(l&&i<a)throw new Error(`Frame does not exist for ${n.toConstant()||n.toRate()} drop-frame`);const _=l?i-a:i,d=u+f+m+_;return r-d},ct=(e,t,s)=>{const[i,r,n,o]=e,a=t.toRate({rounded:!0}),c=i*3600*a+r*60*a+n*a+o;return c-(s?Re(e,c,t):0)},ye=e=>{const[t]=(e==null?void 0:e.match(/[^0-9:\-_]/))||[];let s=[];if(t){const[r,n]=e.split(t);s=[...r.split(":"),n]}else s=e.split(":");if(s.length!==4)throw new Error('Invalid format, must be "##:##:##:##');if(s.some(r=>Number.isNaN(r)))throw new Error("Invalid format, values must be numbers");const i=t||":";return{smpteValues:s.map(Number),smpteFrameSeparator:i}},ve=["error","add","ignore"],Fe={exceedingMode:"error",timeBase:void 0,dropFrame:void 0,frameSeparator:void 0},jt=(e,t)=>{const{exceedingMode:s,timeBase:i,...r}={...Fe,...t};if([null,void 0].includes(e))throw new Error("smpte cannot be undefined or null");if(typeof e!="string")throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);const{smpteValues:n,smpteFrameSeparator:o}=ye(e),a=W(i),c={...r,frameSeparator:(r==null?void 0:r.frameSeparator)||o,...(r==null?void 0:r.dropFrame)===void 0?{dropFrame:i!==void 0?Bt(a):[";",","].includes(o)}:{}},l=a.toRate({rounded:!0}),u=Math.max(0,l-1);if(n.some(m=>m<0))throw new Error("Negative values are not supported");let f;switch(s){case"error":{const[m,_,d,h]=n;if(m>=100||_>=60)throw Error("Minutes has to be less than 60");if(d>=60)throw Error("Seconds has to be less than 60");if(h>u)throw Error(`Frames has to be less or equal to ${u}`);f=ct(n,a,c==null?void 0:c.dropFrame);break}case"ignore":{const[m,_,d,h]=n,g=[Math.min(100,m),Math.min(59,_),Math.min(59,d),Math.min(u,h)];f=ct(g,a,c==null?void 0:c.dropFrame);break}case"add":{f=ct(n,a,c==null?void 0:c.dropFrame);break}default:throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(ve)}`)}return new F({samples:f,timeBase:a},c)},Me={timeBase:void 0,dropFrame:void 0,frameSeparator:void 0},$=(e,t)=>{const{timeBase:s,...i}={...Me,...t};let r;if(e===void 0)r={samples:0};else if(typeof e=="number")r={samples:e};else if(e.includes("@")){const[o,a]=e.split("@");r={samples:Number(o),timeBase:G(a)}}else e==="-INF"?r={samples:-1/0}:e==="+INF"?r={samples:1/0}:r={samples:Number(e)};if(Number.isNaN(r==null?void 0:r.samples)||r.timeBase&&!(r.timeBase instanceof R))throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);const n=new F(r,i);return s?n.conformTimeBase(W(s),i):n},De={dropFrame:void 0,frameSeparator:void 0},B=(e,t)=>new F(e,{...De,...t}),Ce=e=>!!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/),Ne=e=>!Number.isNaN(Number(e)),L=(e,t)=>{if(e instanceof F)return e;if(typeof e!="string"&&typeof e!="number")return B(e,t);if(typeof e=="string"&&Ce(e))return jt(e,t);if(["string","number"].includes(typeof e)&&Ne(e))return Pt(e,t);if(typeof e=="string")return $(e,t)};function kt({hours:e=0,minutes:t=0,seconds:s=0,partialSeconds:i=0}){const r=e.toFixed().padStart(2,"0"),n=t.toFixed().padStart(2,"0"),o=s.toFixed().padStart(2,"0"),a=(i*10).toFixed().padStart(3,"0");return`${r}:${n}:${o}.${a}`}const we={subtitleGroup:"stl_subtitle",subtitleField:"stl_text"},Be=(e,t)=>{const{subtitleGroup:s,subtitleField:i}={...we,...t||{}},{timespan:r=[]}=e||{};if(r.length===0)return"";const o=it(r,{includeTimespanAttributes:!0,sortTimespan:!0,timespanAsList:!0,overrideGroup:!0,joinValue:","}).map(a=>{const{start:c,end:l,[s]:{[i]:u}={}}=(Array.isArray(a)?a[0]:a)||{};if(!u)return"";const f=kt($(c).toTime()),m=kt($(l).toTime());return`${f} --> ${m} line:0%\r${u}\r`});if(o.some(a=>!!a))return`WEBVTT
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
${
|
|
5
|
-
`)}`},yt={count:!0,exclude:!0},Dt=(e=[],t={})=>{const r={...yt,...t},{count:i,exclude:n}=r;return e.map(o=>typeof o=="string"?{field:o,name:o,count:i,...n===!0?{exclude:[o]}:{}}:o)},Mt=(e=[])=>e==null?void 0:e.map(({name:t,field:r,count:i,range:n})=>({facetName:t,fieldName:r,count:i==null?void 0:i.reduce((o,{fieldValue:a,value:s})=>({...o,[a]:s}),{}),...n?{range:n.map(({value:o,start:a,end:s})=>({start:Number.isNaN(+a)?a:Number(a),end:Number.isNaN(+s)?s:Number(s),count:Number(o)||0}))}:{}})),Ft=(e=[])=>{const t={};return e.forEach(({name:r,field:i,count:n})=>{t[r||i]=n.reduce((o,{fieldValue:a,value:s})=>({...o,[a]:s}),{})}),t},Be={arrayOnSingle:!0,joinValue:void 0,timespanAsList:!1},V=(e,t)=>{const{arrayOnSingle:r=!0,joinValue:i=void 0,timespanAsList:n=!1}={...Be,...t||{}},{field:o=[],start:a,end:s}=e||{},c=n?{start:a,end:s}:{};return o.reduce((d,l)=>{const{name:m,value:p=[]}=l;if(p.length===0)return d;let u;return r===!1&&p.length===1?[u]=p:i?u=p.join(i):u=p,{...d,[m]:u}},c)},vt={...Be,timespanAsList:!1,joinTimespan:"_",flat:!1,flatTimespan:!1},Ct=(e=[],t)=>{const{timespanAsList:r,joinTimespan:i="_",flat:n,flatTimespan:o,...a}={...vt,...t||{}};return r===!0?e.map(s=>V(s,{...a,timespanAsList:r})):n===!0||o===!0?e.reduce((s,c)=>({...s,...V(c,t)}),{}):e.reduce((s,c)=>({...s,[[c.start,c.end].join(i)]:V(c,t)}),{})},Pe=(e,t)=>{const r=L(t).toSeconds(),{thumbnails:i={}}=e||{},{uri:n=[]}=i,o=n.map(s=>{const c=s.split("/").pop().split("?").shift();return W(c).toSeconds()}),a=o.reduce((s,c,f)=>Math.abs(c-r)<Math.abs(o[s]-r)?f:s,0);return n[a]},je={includeGroupMetadata:!1,flatEvents:!1,includeEntityType:!1,includeNearestThumbnail:!1},Lt=({start:e,end:t,group:r=[{id:"unknown",name:"unknown"}]})=>{const[{id:i,name:n}]=r,o=L(e).toSeconds(),a=L(t).toSeconds();return{start:e,end:t,startSeconds:o,endSeconds:a,group:{uuid:i,name:n}}},wt=(e={},t)=>{const{entry:r=[]}=e,i={...je,...t||{}},{includeGroupMetadata:n,flatEvents:o,includeEntityType:a,includeNearestThumbnail:s}=i,c=r.map(f=>{const{type:d,item:{metadata:l={},id:m,thumbnails:p={}}={},timespan:u,item:_}=f;let E=u.map(h=>Lt(h));if(s&&d==="Item"&&p.uri&&(E=E.map(h=>{const{start:A}=h,O=Pe(_,L(A));return{...h,thumbnail:O}})),n&&d==="Item"){const{timespan:h=[]}=l,A=h.flatMap(O=>O.group);if(A.length>0){const O=E.map(I=>{const{group:{uuid:S}}=I,[F]=S.split("/"),{field:B=[],group:P=[]}=A.find(({uuid:D})=>D===F);return{...I,group:{...I.group,field:B,group:P}}});return{entityType:"Item",entityId:m,events:O.sort((I,S)=>I.startSeconds-S.startSeconds),...a?{itemType:_}:{}}}}return{entityType:d==="Item"?"Item":"Collection",entityId:m,events:E.sort((h,A)=>h.startSeconds-A.startSeconds),...a&&d==="Item"?{itemType:_}:{},...a&&d==="Collection"?{collectionType:_}:{}}});return o?c.flatMap(({events:f,entityType:d,entityId:l,itemType:m,collectionType:p})=>f.map(u=>({...u,entityType:d,entityId:l,...m&&{itemType:m},...p&&{collectionType:p}}))).sort((f,d)=>f.startSeconds-d.startSeconds):c},Bt=(e="NOW")=>{if(e.startsWith("NOW")){if(e==="NOW")return new Date;const t=e[3],r=Number(e.match(/(\d+)/)[0]),i=e.match(/(\d.*)/)[0].replace(/\d/g,""),n=new Date;switch(i){case"HOUR":case"HOURS":t==="+"&&n.setHours(n.getHours()+r),t==="-"&&n.setHours(n.getHours()-r);break;case"DAY":case"DAYS":t==="+"&&n.setDate(n.getDate()+r),t==="-"&&n.setDate(n.getDate()-r);break;case"MONTH":case"MONTHS":t==="+"&&n.setMonth(n.getMonth()+r),t==="-"&&n.setMonth(n.getMonth()-r);break;case"YEAR":case"YEARS":t==="+"&&n.setFullYear(n.getFullYear()+r),t==="-"&&n.setFullYear(n.getFullYear()-r);break}return n}return new Date(e)},x=e=>{const{property:t=[],...r}=e||{};return{...y(t),...r}},Pt=e=>x(e),jt=e=>x(e),Wt={kB:"kHz",B:"Hz",mB:"mHz"},We={kB:"kbps",B:"bps",MB:"mbps"},Ue=e=>{var E;const{timeBase:t,channelCount:r,codec:i,mediaInfo:n,bitrate:o,metadata:a}=e,s=Pt(n),{Format:c,Resolution:f,Bit_rate_mode:d}=s,l=y(a||[]),m=t!=null&&t.denominator?((t==null?void 0:t.denominator)||1)/((t==null?void 0:t.numerator)||1):void 0,p=m!==void 0?b.filesize(m,{base:10,round:1,symbols:Wt}):void 0;let u,_;return o!==void 0&&(u=b.filesize(o,{round:2,symbols:We}),_=Number((E=b.filesize(o,{exponent:1,symbols:We}).split(" kbps"))==null?void 0:E[0])),{audioFormat:c,audioCodec:i,audioSamplerate:p,audioSamplerateSamples:m,audioBitDepth:f,audioBitrate:u,audioBitrateKbps:_,audioBitRateMode:d,audioChannels:r,audioMediaInfo:s,audioMetadata:l}},Ut={NONE:"NONE",OPEN:"OPEN",CLOSED:"CLOSED",UNKNOWN:"UNKNOWN",MISSING:"MISSING",LOST:"LOST",TO_APPEAR:"TO_APPEAR",TO_BE_DELETED:"TO_BE_DELETED",BEING_READ:"BEING_READ",ARCHIVED:"ARCHIVED",AWAITING_SYNC:"AWAITING_SYNC"},se=e=>{const{uri:t=[],size:r,hash:i,path:n,id:o,storage:a}=e,[s]=t,c=r!==void 0?b.filesize(r,{base:2,standard:"jedec"}):"",f=(n==null?void 0:n.split("/"))||[],d=f.pop()||"",l=f.map(m=>`${m}/`).join("")||void 0;return{uri:s,hash:i,fileSize:c,fileSizeBytes:r,path:n,fileName:d,fileId:o,storageId:a,folderPath:l}},$e=(e={})=>{const{file:t,mediaInfo:r,metadata:i=[]}=e,n=y(i),o=x(r);let a={binaryMetadata:n,binaryMediaInfo:o};if(t){const[s]=t,c=se(s);a={...a,...c}}return a},Ge=(e={})=>{const{mediaInfo:t,metadata:r,file:i,duration:n,startTimestamp:o,startTimecode:a,timeCodeTimeBase:s}=e,c=y(r||[]),f=x(t);let{Format:d}=f;const{Video_Format_List:l,Audio_Format_List:m,Text_Format_List:p}=f;if(d===void 0){const{format:_}=e;d=_,_&&_.includes(",")&&([d]=_.split(","))}let u={containerFormat:d,videoFormat:l,audioFormat:m,textFormat:p,containerMetadata:c,containerMediaInfo:f};if(c.componentOriginalFilename&&(u.originalFilename=c.componentOriginalFilename),n!==void 0&&n.samples!==0){const _=C(n);u.durationTimeCode=_.toObject(),u.duration=_.toDuration()}if(o&&(u.startTimestamp=C(o).toObject()),a!==void 0&&s&&(u.startTimecode=C({samples:a,timeBase:s})),i){const[_]=i,E=se(_);u={...u,...E}}return u},Ve={kB:"kbps",B:"bps",MB:"mbps"},xe=(e={})=>{var H;const{codec:t,bitrate:r,fieldOrder:i,resolution:n,mediaInfo:o,metadata:a=[]}=e,s=jt(o),c=y(a),{Format:f,"Frame rate":d,"Color space":l,"Color primaries":m,Colorimetry:p}=s;let u;const{averageFrameRate:_,realBaseFrameRate:E}=e;E!==void 0?u=v({numerator:E.denominator,denominator:E.numerator}):d!==void 0?u=G(d):_!==void 0&&(u=v({numerator:_.denominator,denominator:_.numerator}));let{"Frame count":h}=s;if(h===void 0){const{numberOfPackets:qe}=e;qe!==void 0&&(h=qe.toString())}let A,O,I;h&&u&&(A=C({samples:h,timeBase:u}),O=A.timeBase.toConstant()||A.timeBase.toRate(),I=A.toSmpte());const{height:S,width:F}=n||{},B=K(n),P=`${F}x${S}`;let D,U;return r!==void 0&&(D=b.filesize(r,{round:2,symbols:Ve}),U=Number((H=b.filesize(r,{exponent:2,symbols:Ve}).split(" mbps"))==null?void 0:H[0])),{videoFormat:f,dimension:P,frameRate:O,height:S,width:F,timeBase:u,timeCode:A,videoCodec:t,smpte:I,videoBitrate:D,videoBitrateMbps:U,fieldOrder:i,colorSpace:l,chromaSubsampling:p,aspectRatio:B,colorPrimaries:m,videoMetadata:c,videoMediaInfo:s}},Y=(e={},t={})=>{let r={};const{priority:i=["container","video","audio","binary"]}=t,{containerComponent:n,videoComponent:o,audioComponent:a,binaryComponent:s,mimeType:c=[],tag:f=[]}=e;[r.tag]=f,[r.mimeType]=c;const d=(l,m)=>Object.fromEntries([...new Set([...Object.keys(m),...Object.keys(l)])].map(p=>[p,m[p]??l[p]]));return i.reverse().forEach(l=>{switch(l){case"container":n&&(r=d(r,Ge(n)));break;case"video":if(o){const[m]=o;r=d(r,xe(m))}break;case"audio":if(a){const[m]=a;r=d(r,Ue(m))}break;case"binary":if(s){const[m]=s;r=d(r,$e(m))}break}}),r},w={PDF:"PDF",TEXT:"TEXT",MSWORD:"MSWORD",JSON:"JSON",XML:"XML"},R={IMAGE:"IMAGE",AUDIO:"AUDIO",VIDEO:"VIDEO",DOCUMENT:"DOCUMENT",BINARY:"BINARY"},$t=(e={})=>{const{mimeType:t}=e,r=Array.isArray(t)?t[0]:t;if(r){if(r.endsWith("/pdf"))return w.PDF;if(r.startsWith("text/"))return w.TEXT;if(r.endsWith("/msword"))return w.MSWORD;if(r.endsWith("/json"))return w.JSON;if(r.endsWith("/xml"))return w.XML}},Gt=["image/apng","image/bmp","image/gif","image/jpeg","image/x-icon","image/png","image/svg+xml"],Vt=["video/mp4"],xt=["audio/mp4","audio/mpeg","audio/x-aac","audio/aac","audio/x-wav","audio/wav","audio/accp","audio/ogg","audio/webm","audio/x-flac"],Yt=[...Vt,...Gt,...xt],kt=["http","https"],Ht="video/mp4",Kt="video/quicktime",zt="video/x-m4v",Jt="MPEG-4",qt="mov",Xt="h264",k=["__mp4","__mp3_160k","__png","__jpeg","__gif","original"].reverse(),Ye=({parsedShape:{tag:e}},{parsedShape:{tag:t}})=>k.includes(e)||k.includes(t)?k.indexOf(t)-k.indexOf(e):e.toLowerCase().localeCompare(t.toLowerCase()),Qt=(e,t)=>{const{allowedMimeTypes:r=Yt,allowedMethods:i=kt,sortPriority:n=Ye,sourceKey:o="src",mimeTypeKey:a="type",shapeKey:s="shape",parsedShapeKey:c="parsedShape"}=t||{},{shape:f=[]}=e||{},d=f.reduce((l,m)=>{let p,u;const _=Y(m),{uri:E,mimeType:h,containerFormat:A,videoCodec:O}=_;if(h&&(p=h,(h===Kt||h===zt)&&(A===Jt||A===qt)&&O===Xt&&(p=Ht)),E)if(i){const[I]=E.split("://");i.includes(I)&&(u=E)}else u=E;return u&&r.includes(p)&&l.push({[o]:u,[a]:p,[s]:m,[c]:_}),l},[]);return typeof n=="function"&&d.sort(Ye),d},Zt=e=>{const t=Y(e),{mimeType:r,videoCodec:i,audioCodec:n}=t;if(r){if(r.startsWith("audio/")&&n!==void 0)return R.AUDIO;if(r.startsWith("video/")){if(i!==void 0)return R.VIDEO;if(n!==void 0)return R.AUDIO}if(r.startsWith("image/"))return R.IMAGE;if(r.endsWith("/pdf")||r.startsWith("text/")||r.endsWith("/msword")||r.endsWith("/json")||r.endsWith("/xml"))return R.DOCUMENT;if(r.endsWith("/octet-stream"))return R.BINARY}},ke="video/mp4",He="video/quicktime",Ke="video/x-m4v",er="MPEG-4",tr="mov",rr="h264",nr=[ke,He,Ke],ze=["video/x-mxf-h264","video/x-mxf-h264-aac","video/x-mxf-h264-pcm_s24le","video/x-mxf-mpeg2video-pcm_s24le","video/x-mxf-mpeg2video-pcm_s16le","video/x-mxf-prores-pcm_s16le","video/x-mxf-h264-pcm_s16le"],ir=[...nr,...ze],or=["audio/mp4","audio/mpeg","audio/x-aac","audio/aac","audio/x-wav","audio/wav","audio/accp","audio/ogg","audio/webm","audio/x-flac"],sr=[...ir,...or],ar=["http","https"],cr=({streamingServers:e,url:t,ending:r})=>Xe(e[0],window.btoa(t),`.${r}`),dr=(e,t)=>{const{allowedMimeTypes:r=sr,allowedMethods:i=ar,streamingServers:n=[]}=t||{},{shape:o=[]}=e||{},{startTimeCode:a}=ye(e==null?void 0:e.metadata,{flat:!0,arrayOnSingleValue:!1});return o.reduce((c,f)=>{var F,B,P;let d,l,m;const p=Y(f),{uri:u,mimeType:_,containerFormat:E,videoCodec:h}=p;if(!(r!=null&&r.includes(_))||!(i!=null&&i.includes((F=u==null?void 0:u.split("://"))==null?void 0:F[0])))return c;if(m=p.tag,!m){const D=(P=(B=_==null?void 0:_.split)==null?void 0:B.call(_,"/"))==null?void 0:P.pop(),U=c.filter(H=>H.label===D).length;U===0?m=D:m=D+(U+1)}const{timeBase:A,startTimecode:O}=p,I=a??O,S=I&&L(I);return l=u,d=_,(_===He||_===Ke)&&(E===er||E===tr)&&h===rr&&(d=ke),n!=null&&n.length&&ze.includes(_)&&(l=cr({url:u,streamingServers:n,ending:"mpd"}),d="application/dash+xml"),l&&c.push({src:l,...d?{type:d}:{},...m?{label:m}:{},...A?{timeBase:A}:{},...S?{startTimeCode:S}:{}}),c},[])},Je=e=>{const t={},{outputSetting:r=[]}=e||{};if(r.length===0)return t;const i=JSON.parse(r[0]),{Settings:{ContainerSettings:n,VideoDescription:o,AudioDescriptions:a}={}}=i;if(n&&(t.containerFormat=n.Container),o){const{CodecSettings:s={}}=o,{Codec:c,...f}=s;t.videoFormat=c;const{Height:d,Width:l}=o;t.height=d,t.width=l,d&&l&&(t.dimension=`${l}x${d}`,t.aspectRatio=K({height:d,width:l}));const[m]=Object.values(f);if(m){t.fieldOrder=m.InterlaceMode,t.fieldOrder&&t.fieldOrder.includes("TOP")&&(t.fieldOrder="interlaced"),t.videoBitrate=m.Bitrate;const p=m.FramerateDenominator,u=m.FramerateNumerator,_=v({denominator:u,numerator:p});t.timeBase=_,t.frameRate=_.toConstant()||_.toRate()}}if(a&&a.length>0){const{CodecSettings:s={}}=a[0],{Codec:c,...f}=s;t.audioFormat=c;const[d]=Object.values(f);d&&(t.audioSamplerate=d.SampleRate,t.audioBitrate=d.Bitrate,t.audioBitRateMode=d.RateControlMode)}return t},ur=e=>{const t={},{description:r,format:i,audio:n,video:o,mediaconvert:a}=e||{};if(a)return{description:r,...Je(a)};if(t.description=r,t.containerFormat=i,o){if(t.videoFormat=o.codec,t.videoBitrate=o.bitrate,o.framerate){const s=v(o.framerate);t.timeBase=s,t.frameRate=s.toConstant()||s.toRate()}if(o.scaling){const{height:s,width:c}=o.scaling;t.height=s,t.width=c,s&&c&&(t.dimension=`${c}x${s}`,t.aspectRatio=K({height:s,width:c}))}}if(n){const{codec:s,channel:c}=n;t.audioFormat=s,c&&(t.audioChannels=c.length)}return t},lr=e=>{if(!e)return;const{name:t,type:r,defaultValue:i,stringRestriction:n,floatRestriction:o,integerRestriction:a,longRestriction:s,data:c,values:f,system:d}=e,{minLength:l,maxLength:m,pattern:p}=n||{},{minInclusive:u,maxInclusive:_}=o||a||s||{},E=((f==null?void 0:f.field)||[]).map(({key:I,value:S})=>({label:S??I,value:I})),A=(I=>Object.fromEntries(Object.entries(I).filter(([,S])=>S!==void 0)))({min:u,max:_,minLength:l,maxLength:m,pattern:p?new RegExp(p):void 0}),O=y(c);return{name:t,type:r,defaultValue:i,required:u!==void 0||l!==void 0&&l>0,restrictions:A,data:O,options:E,system:d==="true"}},mr=e=>e==null?void 0:e.map(lr).filter(t=>!!t),_r=["date","float","integer","long","string","string-exact","boolean","timeCode"];T.DOCUMENT_TYPES=w,T.FIELD_ATTRIBUTE_KEYS=ue,T.FIELD_DEFINITION_TYPES=_r,T.FIELD_VALUE_ATTRIBUTE_KEYS=de,T.FILE_STATES=Ut,T.GROUP_ATTRIBUTE_KEYS=le,T.ROLE_NAMES=Qe,T.SHAPE_MEDIA_TYPES=R,T.SYSTEM_FIELDGROUPS=Ze,T.SYSTEM_FIELDS=et,T.TimeBase=g,T.TimeCode=N,T.createMetadataType=at,T.createSearchFacetList=Dt,T.createTimeBase=j,T.createTimeCode=L,T.defaultOptions=je,T.filterShapeSource=Qt,T.findNearestThumbnail=Pe,T.formatTimeBaseText=G,T.formatTimeBaseType=v,T.formatTimeCodeSeconds=Ce,T.formatTimeCodeSmpte=Le,T.formatTimeCodeText=W,T.formatTimeCodeType=C,T.getPlayerSources=dr,T.getShapeDocumentType=$t,T.getShapeMediaType=Zt,T.metadataTypeToWebVtt=Nt,T.parseAudioComponent=Ue,T.parseBinaryComponent=$e,T.parseContainerComponent=Ge,T.parseFacetList=Mt,T.parseFacetType=Ft,T.parseFieldDefinitionList=mr,T.parseFieldList=X,T.parseFileType=se,T.parseGroupList=Z,T.parseHighlightTimespan=V,T.parseHighlightTimespanList=Ct,T.parseKeyValuePairType=y,T.parseMediaConvertPreset=Je,T.parseMetadataType=ye,T.parseNowDate=Bt,T.parseSearchResultEvents=wt,T.parseShapeType=Y,T.parseSimpleMetadataType=pt,T.parseTimespan=Ne,T.parseTimespanList=te,T.parseTranscodePreset=ur,T.parseVideoComponent=xe,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
${o.join(`
|
|
5
|
+
`)}`},Le={count:!0,exclude:!0},Pe=(e=[],t={})=>{const s={...Le,...t},{count:i,exclude:r}=s;return e.map(n=>typeof n=="string"?{field:n,name:n,count:i,...r===!0?{exclude:[n]}:{}}:n)},je=(e=[])=>e==null?void 0:e.map(({name:t,field:s,count:i,range:r})=>({facetName:t,fieldName:s,count:i==null?void 0:i.reduce((n,{fieldValue:o,value:a})=>({...n,[o]:a}),{}),...r?{range:r.map(({value:n,start:o,end:a})=>({start:Number.isNaN(+o)?o:Number(o),end:Number.isNaN(+a)?a:Number(a),count:Number(n)||0}))}:{}})),ke=(e=[])=>{const t={};return e.forEach(({name:s,field:i,count:r})=>{t[s||i]=r.reduce((n,{fieldValue:o,value:a})=>({...n,[o]:a}),{})}),t},Wt={arrayOnSingle:!0,joinValue:void 0,timespanAsList:!1},z=(e,t)=>{const{arrayOnSingle:s=!0,joinValue:i=void 0,timespanAsList:r=!1}={...Wt,...t||{}},{field:n=[],start:o,end:a}=e||{},c=r?{start:o,end:a}:{};return n.reduce((u,f)=>{const{name:m,value:_=[]}=f;if(_.length===0)return u;let d;return s===!1&&_.length===1?[d]=_:i?d=_.join(i):d=_,{...u,[m]:d}},c)},We={...Wt,timespanAsList:!1,joinTimespan:"_",flat:!1,flatTimespan:!1},$e=(e=[],t)=>{const{timespanAsList:s,joinTimespan:i="_",flat:r,flatTimespan:n,...o}={...We,...t||{}};return s===!0?e.map(a=>z(a,{...o,timespanAsList:s})):r===!0||n===!0?e.reduce((a,c)=>({...a,...z(c,t)}),{}):e.reduce((a,c)=>({...a,[[c.start,c.end].join(i)]:z(c,t)}),{})},$t=(e,t)=>{const s=L(t).toSeconds(),{thumbnails:i={}}=e||{},{uri:r=[]}=i,n=r.map(a=>{const c=a.split("/").pop().split("?").shift();return $(c).toSeconds()}),o=n.reduce((a,c,l)=>Math.abs(c-s)<Math.abs(n[a]-s)?l:a,0);return r[o]},Ue={includeGroupMetadata:!1,flatEvents:!1,includeEntityType:!1,includeNearestThumbnail:!1},xe=({start:e,end:t,group:s=[{id:"unknown",name:"unknown"}]})=>{const[{id:i,name:r}]=s,n=L(e).toSeconds(),o=L(t).toSeconds();return{start:e,end:t,startSeconds:n,endSeconds:o,group:{uuid:i,name:r}}},Ge=(e={},t)=>{const{entry:s=[]}=e,i={...Ue,...t||{}},{includeGroupMetadata:r,flatEvents:n,includeEntityType:o,includeNearestThumbnail:a}=i,c=s.map(l=>{const{type:u,item:{metadata:f={},id:m,thumbnails:_={}}={},timespan:d,item:h}=l;let g=d.map(A=>xe(A));if(a&&u==="Item"&&_.uri&&(g=g.map(A=>{const{start:I}=A,b=$t(h,L(I));return{...A,thumbnail:b}})),r&&u==="Item"){const{timespan:A=[]}=f,I=A.flatMap(b=>b.group);if(I.length>0){const b=g.map(O=>{const{group:{uuid:S}}=O,[N]=S.split("/"),{field:j=[],group:k=[]}=I.find(({uuid:D})=>D===N);return{...O,group:{...O.group,field:j,group:k}}});return{entityType:"Item",entityId:m,events:b.sort((O,S)=>O.startSeconds-S.startSeconds),...o?{itemType:h}:{}}}}return{entityType:u==="Item"?"Item":"Collection",entityId:m,events:g.sort((A,I)=>A.startSeconds-I.startSeconds),...o&&u==="Item"?{itemType:h}:{},...o&&u==="Collection"?{collectionType:h}:{}}});return n?c.flatMap(({events:l,entityType:u,entityId:f,itemType:m,collectionType:_})=>l.map(d=>({...d,entityType:u,entityId:f,...m&&{itemType:m},..._&&{collectionType:_}}))).sort((l,u)=>l.startSeconds-u.startSeconds):c},ze=(e="NOW")=>{if(e.startsWith("NOW")){if(e==="NOW")return new Date;const t=e[3],s=Number(e.match(/(\d+)/)[0]),i=e.match(/(\d.*)/)[0].replace(/\d/g,""),r=new Date;switch(i){case"HOUR":case"HOURS":t==="+"&&r.setHours(r.getHours()+s),t==="-"&&r.setHours(r.getHours()-s);break;case"DAY":case"DAYS":t==="+"&&r.setDate(r.getDate()+s),t==="-"&&r.setDate(r.getDate()-s);break;case"MONTH":case"MONTHS":t==="+"&&r.setMonth(r.getMonth()+s),t==="-"&&r.setMonth(r.getMonth()-s);break;case"YEAR":case"YEARS":t==="+"&&r.setFullYear(r.getFullYear()+s),t==="-"&&r.setFullYear(r.getFullYear()-s);break}return r}return new Date(e)},V=e=>{const{property:t=[],...s}=e||{};return{...M(t),...s}},Ve=e=>V(e),Ye=e=>V(e),He={kB:"kHz",B:"Hz",mB:"mHz"},Ut={kB:"kbps",B:"bps",MB:"mbps"},xt=e=>{var g;const{timeBase:t,channelCount:s,codec:i,mediaInfo:r,bitrate:n,metadata:o}=e,a=Ve(r),{Format:c,Resolution:l,Bit_rate_mode:u}=a,f=M(o||[]),m=t!=null&&t.denominator?((t==null?void 0:t.denominator)||1)/((t==null?void 0:t.numerator)||1):void 0,_=m!==void 0?v.filesize(m,{base:10,round:1,symbols:He}):void 0;let d,h;return n!==void 0&&(d=v.filesize(n,{round:2,symbols:Ut}),h=Number((g=v.filesize(n,{exponent:1,symbols:Ut}).split(" kbps"))==null?void 0:g[0])),{audioFormat:c,audioCodec:i,audioSamplerate:_,audioSamplerateSamples:m,audioBitDepth:l,audioBitrate:d,audioBitrateKbps:h,audioBitRateMode:u,audioChannels:s,audioMediaInfo:a,audioMetadata:f}},Ke={NONE:"NONE",OPEN:"OPEN",CLOSED:"CLOSED",UNKNOWN:"UNKNOWN",MISSING:"MISSING",LOST:"LOST",TO_APPEAR:"TO_APPEAR",TO_BE_DELETED:"TO_BE_DELETED",BEING_READ:"BEING_READ",ARCHIVED:"ARCHIVED",AWAITING_SYNC:"AWAITING_SYNC"},ut=e=>{const{uri:t=[],size:s,hash:i,path:r,id:n,storage:o}=e,[a]=t,c=s!==void 0?v.filesize(s,{base:2,standard:"jedec"}):"",l=(r==null?void 0:r.split("/"))||[],u=l.pop()||"",f=l.map(m=>`${m}/`).join("")||void 0;return{uri:a,hash:i,fileSize:c,fileSizeBytes:s,path:r,fileName:u,fileId:n,storageId:o,folderPath:f}},Gt=(e={})=>{const{file:t,mediaInfo:s,metadata:i=[]}=e,r=M(i),n=V(s);let o={binaryMetadata:r,binaryMediaInfo:n};if(t){const[a]=t,c=ut(a);o={...o,...c}}return o},zt=(e={})=>{const{mediaInfo:t,metadata:s,file:i,duration:r,startTimestamp:n,startTimecode:o,timeCodeTimeBase:a}=e,c=M(s||[]),l=V(t);let{Format:u}=l;const{Video_Format_List:f,Audio_Format_List:m,Text_Format_List:_}=l;if(u===void 0){const{format:h}=e;u=h,h&&h.includes(",")&&([u]=h.split(","))}let d={containerFormat:u,videoFormat:f,audioFormat:m,textFormat:_,containerMetadata:c,containerMediaInfo:l};if(c.componentOriginalFilename&&(d.originalFilename=c.componentOriginalFilename),r!==void 0&&r.samples!==0){const h=B(r);d.durationTimeCode=h.toObject(),d.duration=h.toDuration()}if(n&&(d.startTimestamp=B(n).toObject()),o!==void 0&&a&&(d.startTimecode=B({samples:o,timeBase:a})),i){const[h]=i,g=ut(h);d={...d,...g}}return d},Vt={kB:"kbps",B:"bps",MB:"mbps"},Yt=(e={})=>{var q;const{codec:t,bitrate:s,fieldOrder:i,resolution:r,mediaInfo:n,metadata:o=[]}=e,a=Ye(n),c=M(o),{Format:l,"Frame rate":u,"Color space":f,"Color primaries":m,Colorimetry:_}=a;let d;const{averageFrameRate:h,realBaseFrameRate:g}=e;g!==void 0?d=w({numerator:g.denominator,denominator:g.numerator}):u!==void 0?d=G(u):h!==void 0&&(d=w({numerator:h.denominator,denominator:h.numerator}));let{"Frame count":A}=a;if(A===void 0){const{numberOfPackets:ee}=e;ee!==void 0&&(A=ee.toString())}let I,b,O;A&&d&&(I=B({samples:A,timeBase:d}),b=I.timeBase.toConstant()||I.timeBase.toRate(),O=I.toSmpte());const{height:S,width:N}=r||{},j=J(r),k=`${N}x${S}`;let D,U;return s!==void 0&&(D=v.filesize(s,{round:2,symbols:Vt}),U=Number((q=v.filesize(s,{exponent:2,symbols:Vt}).split(" mbps"))==null?void 0:q[0])),{videoFormat:l,dimension:k,frameRate:b,height:S,width:N,timeBase:d,timeCode:I,videoCodec:t,smpte:O,videoBitrate:D,videoBitrateMbps:U,fieldOrder:i,colorSpace:f,chromaSubsampling:_,aspectRatio:j,colorPrimaries:m,videoMetadata:c,videoMediaInfo:a}},Y=(e={},t={})=>{let s={};const{priority:i=["container","video","audio","binary"]}=t,{containerComponent:r,videoComponent:n,audioComponent:o,binaryComponent:a,mimeType:c=[],tag:l=[]}=e;[s.tag]=l,[s.mimeType]=c;const u=(f,m)=>Object.fromEntries([...new Set([...Object.keys(m),...Object.keys(f)])].map(_=>[_,m[_]??f[_]]));return i.reverse().forEach(f=>{switch(f){case"container":r&&(s=u(s,zt(r)));break;case"video":if(n){const[m]=n;s=u(s,Yt(m))}break;case"audio":if(o){const[m]=o;s=u(s,xt(m))}break;case"binary":if(a){const[m]=a;s=u(s,Gt(m))}break}}),s},P={PDF:"PDF",TEXT:"TEXT",MSWORD:"MSWORD",JSON:"JSON",XML:"XML"},y={IMAGE:"IMAGE",AUDIO:"AUDIO",VIDEO:"VIDEO",DOCUMENT:"DOCUMENT",BINARY:"BINARY"},qe=(e={})=>{const{mimeType:t}=e,s=Array.isArray(t)?t[0]:t;if(s){if(s.endsWith("/pdf"))return P.PDF;if(s.startsWith("text/"))return P.TEXT;if(s.endsWith("/msword"))return P.MSWORD;if(s.endsWith("/json"))return P.JSON;if(s.endsWith("/xml"))return P.XML}},Je=["image/apng","image/bmp","image/gif","image/jpeg","image/x-icon","image/png","image/svg+xml"],Xe=["video/mp4"],Qe=["audio/mp4","audio/mpeg","audio/x-aac","audio/aac","audio/x-wav","audio/wav","audio/accp","audio/ogg","audio/webm","audio/x-flac"],Ze=[...Xe,...Je,...Qe],ts=["http","https"],es="video/mp4",ss="video/quicktime",rs="video/x-m4v",is="MPEG-4",ns="mov",as="h264",H=["__mp4","__mp3_160k","__png","__jpeg","__gif","original"].reverse(),Ht=({parsedShape:{tag:e}},{parsedShape:{tag:t}})=>H.includes(e)||H.includes(t)?H.indexOf(t)-H.indexOf(e):e.toLowerCase().localeCompare(t.toLowerCase()),os=(e,t)=>{const{allowedMimeTypes:s=Ze,allowedMethods:i=ts,sortPriority:r=Ht,sourceKey:n="src",mimeTypeKey:o="type",shapeKey:a="shape",parsedShapeKey:c="parsedShape"}=t||{},{shape:l=[]}=e||{},u=l.reduce((f,m)=>{let _,d;const h=Y(m),{uri:g,mimeType:A,containerFormat:I,videoCodec:b}=h;if(A&&(_=A,(A===ss||A===rs)&&(I===is||I===ns)&&b===as&&(_=es)),g)if(i){const[O]=g.split("://");i.includes(O)&&(d=g)}else d=g;return d&&s.includes(_)&&f.push({[n]:d,[o]:_,[a]:m,[c]:h}),f},[]);return typeof r=="function"&&u.sort(Ht),u},cs=e=>{const t=Y(e),{mimeType:s,videoCodec:i,audioCodec:r}=t;if(s){if(s.startsWith("audio/")&&r!==void 0)return y.AUDIO;if(s.startsWith("video/")){if(i!==void 0)return y.VIDEO;if(r!==void 0)return y.AUDIO}if(s.startsWith("image/"))return y.IMAGE;if(s.endsWith("/pdf")||s.startsWith("text/")||s.endsWith("/msword")||s.endsWith("/json")||s.endsWith("/xml"))return y.DOCUMENT;if(s.endsWith("/octet-stream"))return y.BINARY}},Kt="video/mp4",qt="video/quicktime",Jt="video/x-m4v",us="MPEG-4",ds="mov",ls="h264",fs=[Kt,qt,Jt],Xt=["video/x-mxf-h264","video/x-mxf-h264-aac","video/x-mxf-h264-pcm_s24le","video/x-mxf-mpeg2video-pcm_s24le","video/x-mxf-mpeg2video-pcm_s16le","video/x-mxf-prores-pcm_s16le","video/x-mxf-h264-pcm_s16le"],ms=[...fs,...Xt],hs=["audio/mp4","audio/mpeg","audio/x-aac","audio/aac","audio/x-wav","audio/wav","audio/accp","audio/ogg","audio/webm","audio/x-flac"],ps=[...ms,...hs],_s=["http","https"],Ts=({streamingServers:e,url:t,ending:s})=>se(e[0],window.btoa(t),`.${s}`),Es=(e,t)=>{const{allowedMimeTypes:s=ps,allowedMethods:i=_s,streamingServers:r=[]}=t||{},{shape:n=[]}=e||{},{startTimeCode:o}=Ct(e==null?void 0:e.metadata,{flat:!0,arrayOnSingleValue:!1});return n.reduce((c,l)=>{var N,j,k;let u,f,m;const _=Y(l),{uri:d,mimeType:h,containerFormat:g,videoCodec:A}=_;if(!(s!=null&&s.includes(h))||!(i!=null&&i.includes((N=d==null?void 0:d.split("://"))==null?void 0:N[0])))return c;if(m=_.tag,!m){const D=(k=(j=h==null?void 0:h.split)==null?void 0:j.call(h,"/"))==null?void 0:k.pop(),U=c.filter(q=>q.label===D).length;U===0?m=D:m=D+(U+1)}const{timeBase:I,startTimecode:b}=_,O=o??b,S=O&&L(O);return f=d,u=h,(h===qt||h===Jt)&&(g===us||g===ds)&&A===ls&&(u=Kt),r!=null&&r.length&&Xt.includes(h)&&(f=Ts({url:d,streamingServers:r,ending:"mpd"}),u="application/dash+xml"),f&&c.push({src:f,...u?{type:u}:{},...m?{label:m}:{},...I?{timeBase:I}:{},...S?{startTimeCode:S}:{}}),c},[])},Qt=e=>{const t={},{outputSetting:s=[]}=e||{};if(s.length===0)return t;const i=JSON.parse(s[0]),{Settings:{ContainerSettings:r,VideoDescription:n,AudioDescriptions:o}={}}=i;if(r&&(t.containerFormat=r.Container),n){const{CodecSettings:a={}}=n,{Codec:c,...l}=a;t.videoFormat=c;const{Height:u,Width:f}=n;t.height=u,t.width=f,u&&f&&(t.dimension=`${f}x${u}`,t.aspectRatio=J({height:u,width:f}));const[m]=Object.values(l);if(m){t.fieldOrder=m.InterlaceMode,t.fieldOrder&&t.fieldOrder.includes("TOP")&&(t.fieldOrder="interlaced"),t.videoBitrate=m.Bitrate;const _=m.FramerateDenominator,d=m.FramerateNumerator,h=w({denominator:d,numerator:_});t.timeBase=h,t.frameRate=h.toConstant()||h.toRate()}}if(o&&o.length>0){const{CodecSettings:a={}}=o[0],{Codec:c,...l}=a;t.audioFormat=c;const[u]=Object.values(l);u&&(t.audioSamplerate=u.SampleRate,t.audioBitrate=u.Bitrate,t.audioBitRateMode=u.RateControlMode)}return t},gs=e=>{const t={},{description:s,format:i,audio:r,video:n,mediaconvert:o}=e||{};if(o)return{description:s,...Qt(o)};if(t.description=s,t.containerFormat=i,n){if(t.videoFormat=n.codec,t.videoBitrate=n.bitrate,n.framerate){const a=w(n.framerate);t.timeBase=a,t.frameRate=a.toConstant()||a.toRate()}if(n.scaling){const{height:a,width:c}=n.scaling;t.height=a,t.width=c,a&&c&&(t.dimension=`${c}x${a}`,t.aspectRatio=J({height:a,width:c}))}}if(r){const{codec:a,channel:c}=r;t.audioFormat=a,c&&(t.audioChannels=c.length)}return t},As=e=>{if(!e)return;const{name:t,type:s,defaultValue:i,stringRestriction:r,floatRestriction:n,integerRestriction:o,longRestriction:a,data:c,values:l,system:u}=e,{minLength:f,maxLength:m,pattern:_}=r||{},{minInclusive:d,maxInclusive:h}=n||o||a||{},g=((l==null?void 0:l.field)||[]).map(({key:O,value:S})=>({label:S??O,value:O})),I=(O=>Object.fromEntries(Object.entries(O).filter(([,S])=>S!==void 0)))({min:d,max:h,minLength:f,maxLength:m,pattern:_?new RegExp(_):void 0}),b=M(c);return{name:t,type:s,defaultValue:i,required:d!==void 0||f!==void 0&&f>0,restrictions:I,data:b,options:g,system:u!==void 0?u==="true":void 0}},Is=e=>e==null?void 0:e.map(As).filter(t=>!!t),Os=["date","float","integer","long","string","string-exact","boolean","timeCode"];class K{constructor(){this.events={}}on(t,s){const i=this.events[t]||[];i.push(s),this.events[t]=i}off(t){this.events[t]&&(this.events[t]=[])}trigger(t,s,i){const r=this.events[t];!r||r.length<1||r.forEach(n=>{n(s,i)})}}var T=(e=>(e[e.transferring=1]="transferring",e[e.paused=2]="paused",e[e.complete=3]="complete",e[e.failed=4]="failed",e[e.idle=5]="idle",e[e.canceled=6]="canceled",e[e.offline=7]="offline",e))(T||{}),E=(e=>(e.progress="progress",e.update="update",e.complete="complete",e.error="error",e.added="upload-added",e.removed="upload-removed",e.failed="upload-failed",e.retry="retry",e.pausing="pausing",e.paused="paused",e.resuming="resuming",e.offline="offline",e.online="online",e))(E||{});class Zt{constructor(t={}){this.blobSlice=(t==null?void 0:t.blobSlice)??null,this.fileSize=(t==null?void 0:t.fileSize)??null,this.start=(t==null?void 0:t.start)??null,this.end=(t==null?void 0:t.end)??null,this.api=(t==null?void 0:t.api)??null,this.state={retries:0,status:T.idle,startTime:null,completeTime:null,response:null,bytesTransferred:null},this.eventBus=new K}tryTransfer(){return this.state.status=T.transferring,this.state.startTime=performance.now(),new Promise((t,s)=>{const i=()=>{this.transfer().then(r=>{this.state.response=r,this.onComplete(),t(this)}).catch(()=>{this.state.retries>3?(this.state.status=T.failed,s(new Error(`Chunk ${this.start}-${this.end} failed`))):this.state.status!==T.paused?(this.state.retries+=1,this.tryTimeout=setTimeout(()=>{i()},1e3)):clearTimeout(this.tryTimeout)})};i(),window.addEventListener(E.online,()=>{this.resume()}),window.addEventListener(E.offline,()=>{this.pause()})})}transfer(){let t={file:this.blobSlice,onUploadProgress:s=>{[T.complete,T.offline].includes(this.state.status)||(this.state.bytesTransferred=s==null?void 0:s.loaded,this.eventBus.trigger(E.progress,this.state))}};return this.end-this.start!==this.fileSize&&(t.headers={index:this.start,size:this.fileSize}),t={...t,...this.api.props||{}},this.transferPromise=this.api.method(t),this.state.status=T.transferring,this.transferPromise}pause(){this.state.status!==T.complete&&(this.state.status=T.paused)}resume(){this.state.status!==T.complete&&(this.state.status=T.transferring)}cancel(){this.state.status!==T.complete&&(this.state.status=T.canceled)}get transferRate(){if(this.state.bytesTransferred){const t=(this.state.completeTime-this.state.startTime)/1e3;return this.state.bytesTransferred/t}return 0}onComplete(){this.state.status=T.complete,this.state.bytesTransferred=this.end-this.start,this.state.completeTime=performance.now(),this.eventBus.trigger(E.complete,this.state)}}class dt{constructor(t,s){var i,r,n,o,a,c;if(this.DEFAULT_OPTIONS=Object.freeze({targetRate:4e6,chunkSize:8388608,minChunkSize:8388608,maxConcurrentTransfers:1,maxConcurrentFileTransfers:1,autoMaxConcurrentTransfers:!1,minFileSize:104857600,autoResume:!0,api:void 0}),this.eventBus=new K,!s.api.method)throw new Error("No api method specified");console.log(s),this.options={...this.DEFAULT_OPTIONS,...s,api:{...s.api??{},props:{...((i=s.api)==null?void 0:i.props)??{},queryParams:{transferId:ne(),...((n=(r=s.api)==null?void 0:r.props)==null?void 0:n.queryParams)??{}}}}},this.state={blob:null,chunks:[],transferPromises:[],targetRate:this.options.targetRate,rate:0,autoMaxConcurrentTransfers:this.options.autoMaxConcurrentTransfers,maxConcurrentTransfers:this.options.maxConcurrentTransfers,mime:"",status:T.idle,transferId:(c=(a=(o=s.api)==null?void 0:o.props)==null?void 0:a.queryParams)==null?void 0:c.transferId,lastStats:{}},typeof t=="object"?(this.state.blob=t,this.state.mime=t.type,this.addChunksFromBlob(t)):console.error(new Error(`Expected a File or a Blob object, but got ${typeof t}`))}upload(){const{status:t}=this.state;if(console.log("status",t),t!==T.complete)if(t===T.idle||t===T.transferring){this.state.transferPromises=[];const s=()=>{const i=this.state.chunks[0].state.status,r=this.state.transferPromises.length<this.state.maxConcurrentTransfers&&i!==T.transferring;return console.log("isOK",r),console.log("this.state",this.state),r};s()&&(console.log("this.state.chunks",this.state.chunks),this.state.chunks.forEach(i=>{i.state.status!==T.complete&&i.state.status!==T.transferring&&s()&&(this.state.status=T.transferring,this.state.transferPromises.push(i.tryTransfer()))}),this.state.transferPromises.length>0&&Promise.all(this.state.transferPromises).then(()=>{this.upload()}).catch(i=>{console.log("Failed on this upload() cycle, check connectivity and try to resume :(",i),this.state.status!==T.offline?(this.state.status=T.failed,this.eventBus.trigger(E.failed,this.state,i)):setTimeout(()=>this.retry(),5e3)}))}else this.retry()}getByteRangesForChunks(t,s=this.options.chunkSize){const i=[],{minChunkSize:r}=this.options;let o=s>=r?s:r,a=Math.floor(t.size/o);if(t.size-(t.size-t.size/a)>=r||(a-=1,o=Math.floor(t.size/a)),a<2||t.size<this.options.minFileSize)i.push({start:0,end:t.size});else for(let c=0;c<=a;c+=1){const l=o*c;let u=o*c+o;t.size-o*c<=r&&(u=t.size);const m={start:l,end:u};if(i.push(m),u===t.size)break}return i}addChunksFromBlob(t){this.getByteRangesForChunks(t).forEach(i=>{const r=new Zt({start:i.start,end:i.end,blobSlice:t.slice(i.start,i.end),fileSize:t.size,api:this.options.api});r.eventBus.on(E.progress,()=>{this.onProgress()}),r.eventBus.on(E.complete,()=>{this.onProgress()}),this.state.chunks.push(r)})}retry(){this.state.status===T.failed&&(this.resume(),this.eventBus.trigger(E.retry,this.state))}resume(){this.state.status=T.transferring,this.eventBus.trigger(E.resuming,this.state),this.state.chunks.length>0&&this.state.chunks.forEach(t=>{t.resume()})}pause(){this.state.status=T.paused,this.state.chunks.length>0&&this.state.chunks.forEach(s=>{s.pause()});const t=Promise.all(this.state.transferPromises);return this.eventBus.trigger(E.pausing,this.state),t.then(()=>{this.eventBus.trigger(E.paused,this.state)}),Promise.all(this.state.transferPromises)}cancel(){this.state.status=T.canceled,this.state.chunks.length>0&&this.state.chunks.forEach(s=>{s.cancel()}),this.upload=()=>{};const t=Promise.all(this.state.transferPromises);return t.then(()=>{this.eventBus.trigger(E.removed,this.state)}),t}autoAdjustMaxConcurrentTransfers(t){if(this.state.autoMaxConcurrentTransfers&&this.state.status!==T.complete){const s=t.avgTransferRate/this.state.targetRate;if(s>1.2)this.state.maxConcurrentTransfers+=1;else if(s<.3)this.state.maxConcurrentTransfers=1;else{const i=this.options.maxConcurrentTransfers-1;this.state.maxConcurrentTransfers=Math.max(this.options.maxConcurrentTransfers,Math.min(i,this.options.maxConcurrentTransfers))}}}onProgress(){try{const t=this.getStats();t!==this.state.lastStats&&(this.state.lastStats=t,ie(()=>{this.autoAdjustMaxConcurrentTransfers(t)},1e3,!1)({}),this.state.status!==T.complete&&(t.totalChunks===t.completedChunks?this.onComplete():(this.eventBus.trigger(E.progress,this.state),this.options.onProgress&&this.options.onProgress(t))))}catch(t){console.error(t)}}onComplete(){const t=this.getStats();this.state.lastStats=t,this.state.status=T.complete,this.eventBus.trigger(E.complete,this.state),this.options.onComplete&&this.options.onComplete(this.finalResponse)}getStats(){const t=this.state.chunks.length,s=this.state.chunks.filter(l=>l.state.status===T.complete),i=this.state.chunks.filter(l=>l.state.status===T.transferring),r=s.length;let n=0,o=0;s.forEach(l=>{n+=l.transferRate,o+=l.blobSlice.size}),i.forEach(l=>{o+=l.state.bytesTransferred});const a=n/r,c={totalChunks:t,completedChunks:r,totalBytes:this.state.blob.size,transferredBytes:o,avgTransferRate:a,concurrentTransfers:this.state.maxConcurrentTransfers};return this.state.rate=c.avgTransferRate,c}set concurrentTransfers(t){this.state.autoMaxConcurrentTransfers=!1,this.state.maxConcurrentTransfers=t}set rate(t){this.state.targetRate=t}get rate(){return this.state.rate}get finalResponse(){const t=this.state.chunks.length-1,s=!1;for(let i=t;i>=0;i-=1){const r=this.state.chunks[i];if(typeof r.state.response.data=="object")return r.state.response}return s}get transferId(){return this.state.transferId}}function bs(e,t){return e===0||t===0?0:Math.floor(e/t*100)}const Ss={maxConcurrentFileTransfers:1,autoResume:!0};class Rs{constructor(t){this.initialState=Object.freeze({status:T.idle,transfers:[],bytesDone:0,bytesTotal:0,lastStats:{bytesDone:0,bytesTotal:0}}),this.state={...this.initialState},this.options={...Ss,...t},this.events=new K,this.bindNetworkEvents()}get transfers(){return Object.values(this.state.transfers)||[]}get status(){return this.state.status}set status(t){this.events.trigger(E.update,this.state),this.state.status=t}get bytesTotal(){let t=0;return this.transfers.forEach(s=>{t+=s.state.blob.size}),t}get bytesDone(){let t=0;return this.transfers.forEach(s=>{t+=s.getStats().transferredBytes}),t}get isUploading(){return this.state.status===T.transferring}get paused(){let t=!0;return this.transfers.forEach(s=>{s.state.status!==T.paused&&(t=!1)}),t}bindNetworkEvents(){typeof window>"u"||(window.addEventListener(E.online,()=>{this.events.trigger(E.online,this.state),this.state.status=T.transferring,this.options.autoResume&&setTimeout(()=>{this.retry()},1500)}),window.addEventListener(E.offline,()=>{this.events.trigger(E.offline,this.state),this.state.status=T.offline}))}addChunkedUpload(t){console.log("chunkedUpload",t),t.transferId!==null&&(this.state.transfers[t.transferId]=t,t.eventBus.on(E.progress,()=>{this.onProgress()}),t.eventBus.on(E.complete,()=>{this.upload(),this.onProgress()}),t.eventBus.on(E.failed,(s,i)=>{this.onFail(i,s)}),t.eventBus.on(E.retry,()=>{this.events.trigger(E.retry,this.state)}),t.eventBus.on(E.paused,()=>{this.paused&&this.events.trigger(E.paused,this.state)}),this.updateStats(),this.events.trigger(E.added,this.state),this.events.trigger(E.update,this.state))}removeChunkedUpload(t,s=!1){const i=r=>r?r.state.status===T.complete&&!s?(console.error("Can't cancel complete transfers, pass true as a second argument in .removeChunkedUpload() to force removal."),!1):(Object.keys(this.state.transfers).forEach(n=>{r===this.state.transfers[n]&&delete this.state.transfers[n]}),this.events.trigger(E.removed,this.state),r.cancel(),!0):(console.error("Could not find a matching transfer to cancel."),!1);t instanceof dt?i(t):t instanceof File?i(this.exists(t)):typeof t=="string"?i(this.transfers.find(r=>r.transferId===t)):console.error("Invalid object to remove - has to be either ChunkedUpload, File or transferId")}onProgress(){this.updateStats(),this.hasCompleted?this.onComplete():this.state.bytesDone!==this.state.lastStats.bytesDone&&(this.state.status=T.transferring,this.events.trigger(E.progress,this.state))}onComplete(){this.state.status=T.complete,this.events.trigger(E.complete,this.state)}exists(t){let s;for(let i=0;i<this.transfers.length;i+=1){const r=this.transfers[i];if(r.state.blob.name===t.name&&r.state.blob.lastModified===t.lastModified&&r.state.blob.size&&t.size)return s=r,s}return s}isTransferAvailable(t){return t.state.status!==T.complete&&t.state.status!==T.transferring||t.state.status===T.idle}pause(){let t=Promise.resolve(!0);if(!this.paused){this.events.trigger(E.pausing,this.state);const s=[];this.transfers.forEach(i=>{s.push(i.pause())}),t=Promise.all(s),t.then(()=>{this.events.trigger(E.paused,this.state)})}return t}resume(){this.events.trigger(E.update,this.state),this.transfers.forEach(t=>{this.isTransferAvailable(t)&&t.state.status!==T.idle&&t.resume()})}retry(){this.status===T.failed&&(this.resume(),this.events.trigger(E.retry,this.state))}upload(){let t=0;console.log("this.transfers",this.transfers),console.log("this.options.maxConcurrentFileTransfers",this.options.maxConcurrentFileTransfers),console.log("before ongoingTransfers",t),this.transfers.forEach(s=>{this.isTransferAvailable(s)?t<this.options.maxConcurrentFileTransfers&&(this.events.trigger(E.update,this.state),s.upload(),t+=1):s.state.status!==T.complete&&(t+=1)}),t>0&&(this.status=T.transferring),t<this.options.maxConcurrentFileTransfers&&this.transfers.length<t&&this.upload(),console.log("after ongoingTransfers",t)}onFail(t,s){this.status=T.failed,this.events.trigger(E.error,s,t)}reset(){this.transfers.forEach(t=>{t.constructor.name===dt.name&&this.removeChunkedUpload(t,!0)}),this.state={...this.initialState},this.events.trigger(E.update,this.state),this.events.trigger(E.complete,this.state)}destroy(){this.reset()}get hasCompleted(){let t=!0;return this.transfers.forEach(s=>{s.state.status!==T.complete&&(t=!1)}),t}updateStats(){this.state.lastStats.bytesDone=this.state.bytesDone,this.state.lastStats.bytesTotal=this.state.bytesTotal,this.state.bytesTotal=this.bytesTotal,this.state.bytesDone=this.bytesDone}get percentDone(){return bs(this.state.bytesDone,this.state.bytesTotal)}get fileList(){const t=[];return this.transfers.forEach(s=>{const i=s.getStats(),{totalChunks:r,completedChunks:n}=i,o={name:s.state.blob.name,bytesDone:i.transferredBytes,bytesTotal:s.state.blob.size,totalChunks:r,completedChunks:n,transfer:s};t.push(o)}),t}}const te=(e,t,s="")=>{const i=a=>{const c=a.startsWith("/")?a.slice(1):a,l=(c==null?void 0:c.search("/"))??-1;return l===-1?[c]:[c.slice(0,l),c.slice(l+1)]},[r,n]=i(t),o=[s,r].filter(Boolean).join("/");return n?{[r]:{file:new File([e],r,{...e,type:"folder"}),path:o,progress:{totalBytes:e.size??0,transferredBytes:0},files:te(e,n,o)}}:{[r]:{file:e,path:o,progress:{totalBytes:e.size??0,transferredBytes:0}}}},ys=e=>e.map(t=>te(t,t.path??t.webkitRelativePath)).reduce((t,s)=>re(t,s),{});p.Chunk=Zt,p.ChunkedTransferManager=Rs,p.ChunkedUpload=dt,p.ChunkedUploadEventBus=K,p.DOCUMENT_TYPES=P,p.EVENTS=E,p.FIELD_ATTRIBUTE_KEYS=ht,p.FIELD_DEFINITION_TYPES=Os,p.FIELD_VALUE_ATTRIBUTE_KEYS=mt,p.FILE_STATES=Ke,p.GROUP_ATTRIBUTE_KEYS=pt,p.ROLE_NAMES=ae,p.SHAPE_MEDIA_TYPES=y,p.STATUSES=T,p.SYSTEM_FIELDGROUPS=oe,p.SYSTEM_FIELDS=ce,p.TimeBase=R,p.TimeCode=F,p.createMetadataType=pe,p.createSearchFacetList=Pe,p.createTimeBase=W,p.createTimeCode=L,p.fileListToFileTree=ys,p.filterShapeSource=os,p.findNearestThumbnail=$t,p.formatTimeBaseText=G,p.formatTimeBaseType=w,p.formatTimeCodeSeconds=Pt,p.formatTimeCodeSmpte=jt,p.formatTimeCodeText=$,p.formatTimeCodeType=B,p.getPlayerSources=Es,p.getShapeDocumentType=qe,p.getShapeMediaType=cs,p.metadataTypeToWebVtt=Be,p.parseAudioComponent=xt,p.parseBinaryComponent=Gt,p.parseContainerComponent=zt,p.parseFacetList=je,p.parseFacetType=ke,p.parseFieldDefinitionList=Is,p.parseFieldList=tt,p.parseFileType=ut,p.parseGroupList=st,p.parseHighlightTimespan=z,p.parseHighlightTimespanList=$e,p.parseKeyValuePairType=M,p.parseMediaConvertPreset=Qt,p.parseMetadataType=Ct,p.parseNowDate=ze,p.parseSearchResultEvents=Ge,p.parseShapeType=Y,p.parseSimpleMetadataType=be,p.parseTimespan=Dt,p.parseTimespanList=it,p.parseTranscodePreset=gs,p.parseVideoComponent=Yt,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidispine/vdt-js",
|
|
3
|
-
"version": "23.4.0
|
|
3
|
+
"version": "23.4.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -29,32 +29,33 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "yarn vite build",
|
|
31
31
|
"build:watch": "yarn vite build --watch --mode development",
|
|
32
|
-
"build:docs": "yarn typedoc --out ../../docs/build/vdt-js",
|
|
33
|
-
"update:docs": "yarn typedoc --logLevel Error && echo \"vdt-js docs updated\"",
|
|
32
|
+
"build:docs": "yarn typedoc --plugin typedoc-plugin-missing-exports --internalModule @vidispine/types --out ../../docs/build/vdt-js",
|
|
33
|
+
"update:docs": "yarn typedoc --plugin typedoc-plugin-missing-exports --internalModule @vidispine/types --logLevel Error && echo \"vdt-js docs updated\"",
|
|
34
34
|
"start:docs": "rimraf build/docs && yarn update:docs && yarn vite serve -c vite.docs.config",
|
|
35
35
|
"type-check": "tsc --noEmit --emitDeclarationOnly false",
|
|
36
|
-
"typedoc-check": "yarn typedoc --emit none --treatWarningsAsErrors --validation.invalidLink true --validation.notExported
|
|
36
|
+
"typedoc-check": "yarn typedoc --emit none --treatWarningsAsErrors --validation.invalidLink true --validation.notExported false --validation.notDocumented true",
|
|
37
37
|
"lint": "yarn type-check && eslint . --cache --max-warnings=0 --ext .js,.jsx,.ts,.tsx,.md,.mdx",
|
|
38
38
|
"format": "prettier . --check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vidispine/types": "23.4.0
|
|
41
|
+
"@vidispine/types": "23.4.0",
|
|
42
42
|
"filesize": "^10.1.0",
|
|
43
|
+
"lodash.merge": "^4.6.2",
|
|
43
44
|
"url-join": "^5.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@vidispine/eslint-config-base": "23.4.0
|
|
47
|
-
"@vidispine/eslint-config-mdx": "23.4.0
|
|
48
|
-
"@vidispine/eslint-config-storybook": "23.4.0
|
|
49
|
-
"@vidispine/tests": "23.4.0
|
|
50
|
-
"@vidispine/types": "23.4.0
|
|
51
|
-
"@vidispine/vdt-storybook": "23.4.0
|
|
47
|
+
"@vidispine/eslint-config-base": "23.4.0",
|
|
48
|
+
"@vidispine/eslint-config-mdx": "23.4.0",
|
|
49
|
+
"@vidispine/eslint-config-storybook": "23.4.0",
|
|
50
|
+
"@vidispine/tests": "23.4.0",
|
|
51
|
+
"@vidispine/types": "23.4.0",
|
|
52
|
+
"@vidispine/vdt-storybook": "23.4.0",
|
|
52
53
|
"eslint": "8.55.0",
|
|
53
54
|
"eslint-plugin-testing-library": "6.2.0",
|
|
54
|
-
"prettier": "3.1.
|
|
55
|
+
"prettier": "3.1.1",
|
|
55
56
|
"rimraf": "5.0.5",
|
|
56
|
-
"typedoc": "0.
|
|
57
|
-
"typedoc-plugin-missing-exports": "1.0
|
|
57
|
+
"typedoc": "0.25.4",
|
|
58
|
+
"typedoc-plugin-missing-exports": "2.1.0",
|
|
58
59
|
"typescript": "5.0.4",
|
|
59
60
|
"vite": "4.5.1",
|
|
60
61
|
"vite-plugin-dts": "3.6.4"
|