@vidispine/vdt-react 23.4.0-pre.1 → 23.4.0-pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +198 -200
- package/dist/index.umd.cjs +6 -6
- package/package.json +14 -13
package/dist/index.umd.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(g,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@vidispine/vdt-api"),require("@vidispine/vdt-js"),require("lz-string"),require("use-deep-compare-effect"),require("lodash.debounce"),require("react/jsx-runtime"),require("react-cookie"),require("react-is")):typeof define=="function"&&define.amd?define(["exports","react","@vidispine/vdt-api","@vidispine/vdt-js","lz-string","use-deep-compare-effect","lodash.debounce","react/jsx-runtime","react-cookie","react-is"],a):(g=typeof globalThis<"u"?globalThis:g||self,a(g["@vidispine/vdt-react"]={},g.react,g.vdtApi,g.vdtJs,g.lzString,g.useDeepCompareEffect,g._debounce,g.jsxRuntime,g.reactCookie,g.reactIs))})(this,function(g,a,C,z,ve,Q,Ne,V,_e,Ie){"use strict";const lt=({hasLoaded:e=!1,isLoading:t=!0,isError:r=!1,response:n=void 0,data:s=void 0}={},o=void 0)=>({isLoading:t,hasLoaded:e,isError:r,response:n,data:o&&o.current?o.current:s}),ft=(e,t)=>{switch(t.type){case"START":return{...e,isLoading:!0,isError:!1};case"SUCCESS":{const{responseType:r}=t.response,n={isLoading:!1,isError:!1,hasLoaded:!0,response:t.response,data:t.response.data};return r&&(n[r]=t.response[r]),n}case"ERROR":return{isLoading:!1,isError:!0,hasLoaded:!0,response:t.response,data:t.response.data};case"CANCEL":return{...e,isLoading:!1,isError:!1,hasLoaded:!0};case"RESET":return{...t.initialState};default:return e}};function j(e,t,r){const n=a.useRef(()=>null),s=lt(t,r),o=a.useRef(s),[u,i]=a.useReducer(ft,s),f=a.useCallback(E=>(i({type:"START"}),new Promise((h,d)=>{e({cancelToken:new C.utils.CancelToken(p=>{n.current=p}),...E}).then(p=>{h(p),i({type:"SUCCESS",response:p}),r&&(r.current=p.data)}).catch(p=>{p.__CANCEL__?i({type:"CANCEL"}):(d(p),i({type:"ERROR",response:p}))})})),[e,r]),l=a.useCallback(()=>i({type:"RESET",initialState:o.current}),[]),c=a.useCallback(()=>n.current(),[]);return a.useEffect(()=>()=>{c(),l()},[c,l]),{request:f,reset:l,cancel:c,...u}}const k={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_SEARCHTEXT:"CHANGE_SEARCHTEXT",CHANGE_SEARCHFIELD:"CHANGE_SEARCHFIELD",CHANGE_SEARCHFIELDFACET:"CHANGE_SEARCHFIELDFACET",CHANGE_SEARCHFILTER:"CHANGE_SEARCHFILTER",CHANGE_SEARCHFILTERFACET:"CHANGE_SEARCHFILTERFACET",CHANGE_PARENT_COLLECTION:"CHANGE_PARENT_COLLECTION",CHANGE_FACET:"CHANGE_FACET",CHANGE_ITEMSEARCHDOCUMENT:"CHANGE_ITEMSEARCHDOCUMENT",CHANGE_QUERYPARAMS:"CHANGE_QUERYPARAMS",CHANGE_MATRIXPARAMS:"CHANGE_MATRIXPARAMS",CHANGE_SUGGESTION:"CHANGE_SUGGESTION"},dt=({queryParams:e={},matrixParams:t={},itemSearchDocument:r={},rowsPerPage:n=10,page:s=0,...o}={})=>({...o,queryParams:{content:"metadata",interval:"generic",...e},matrixParams:{first:s*n+1,number:n,...t},itemSearchDocument:{intervals:"generic",filter:[],...r},rowsPerPage:n,page:s}),mt=(e,t)=>{switch(t.type){case k.CHANGE_ITEMSEARCHDOCUMENT:return{...e,page:Number.isInteger(t.page)?t.page:e.page,itemSearchDocument:t.itemSearchDocument,matrixParams:{...e.matrixParams,first:Number.isInteger(t.page)?t.page*e.rowsPerPage+1:e.matrixParams.first}};case k.CHANGE_QUERYPARAMS:return{...e,queryParams:t.queryParams};case k.CHANGE_MATRIXPARAMS:return{...e,matrixParams:t.matrixParams};case k.CHANGE_PAGE:return{...e,page:t.page,matrixParams:{...e.matrixParams,first:t.page*e.rowsPerPage+1}};case k.CHANGE_ROWS:return{...e,rowsPerPage:t.rowsPerPage,page:0,matrixParams:{...e.matrixParams,first:1,number:t.rowsPerPage}};case k.CHANGE_SORT:return{...e,page:0,searchText:t.value,sort:t.value,itemSearchDocument:{...e.itemSearchDocument,sort:t.field?[{field:t.field,order:t.order||"descending"}]:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHTEXT:return{...e,page:0,searchText:t.value,itemSearchDocument:t.value?{...e.itemSearchDocument,text:[{value:`${t.value}`}]}:{...e.itemSearchDocument,text:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFIELD:return{...e,page:0,field:t.field,itemSearchDocument:t.field?{...e.itemSearchDocument,field:t.field}:{...e.itemSearchDocument,field:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFIELDFACET:return{...e,page:0,field:t.field,facet:t.facet,itemSearchDocument:t.field?{...e.itemSearchDocument,field:t.field,facet:t.facet}:{...e.itemSearchDocument,field:[],facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFILTER:return{...e,page:0,filter:t.filter,itemSearchDocument:t.filter?{...e.itemSearchDocument,filter:t.filter}:{...e.itemSearchDocument,filter:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFILTERFACET:return{...e,page:0,filter:t.filter,itemSearchDocument:t.filter?{...e.itemSearchDocument,filter:t.filter,facet:t.facet}:{...e.itemSearchDocument,filter:[],facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_FACET:return{...e,page:0,facet:t.facet,itemSearchDocument:t.facet?{...e.itemSearchDocument,facet:t.facet}:{...e.itemSearchDocument,facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_PARENT_COLLECTION:return{...e,page:0,parentCollection:t.value,itemSearchDocument:t.value?{...e.itemSearchDocument,operator:{field:[{name:"__parent_collection",value:[{value:`${t.value}`}]},{name:"__collection",value:[{value:`${t.value}`}]}],operation:"OR"}}:{...e.itemSearchDocument,operator:void 0},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SUGGESTION:return{...e,itemSearchDocument:{...e.itemSearchDocument,suggestion:t.suggestion}};default:return e}};function He(e){const t=dt(e),[r,n]=a.useReducer(mt,t),s=({target:{value:y}}={})=>n({type:k.CHANGE_ROWS,rowsPerPage:y}),o=({page:y})=>n({type:k.CHANGE_PAGE,page:y}),u=(y,A,b)=>n({type:k.CHANGE_SORT,field:A,order:b}),i=a.useCallback(y=>n({type:k.CHANGE_SEARCHTEXT,value:y}),[]),f=a.useCallback((y,A)=>n({type:k.CHANGE_ITEMSEARCHDOCUMENT,itemSearchDocument:y,page:A}),[]),l=a.useCallback(y=>n({type:k.CHANGE_QUERYPARAMS,queryParams:y}),[]),c=a.useCallback(y=>n({type:k.CHANGE_MATRIXPARAMS,matrixParams:y}),[]),E=a.useCallback(y=>n({type:k.CHANGE_SEARCHFIELD,field:y}),[]),h=a.useCallback(y=>{const A=y.map(({name:b})=>({field:b,count:!0}));n({type:k.CHANGE_SEARCHFIELDFACET,field:y,facet:A})},[]),d=a.useCallback(y=>n({type:k.CHANGE_SEARCHFILTER,filter:y}),[]),p=a.useCallback(y=>{const b=y.reduce((v,{field:R=[]})=>v.concat(R),[]).map(({name:v})=>({name:v,field:v,count:!0,exclude:[v]}));n({type:k.CHANGE_SEARCHFILTERFACET,filter:y,facet:b})},[n]),m=a.useCallback(y=>{n({type:k.CHANGE_FACET,facet:y})},[n]),T=a.useCallback(y=>n({type:k.CHANGE_PARENT_COLLECTION,value:y}),[]),P=a.useCallback(y=>{n({type:k.CHANGE_SUGGESTION,suggestion:y})},[]);return{state:r,onChangeRowsPerPage:s,onChangePage:o,onChangeSort:u,setSearchText:i,setSearchField:E,setSearchFieldFacet:h,setSearchFilter:d,setSearchFilterFacet:p,setFacet:m,setItemSearchDocument:f,setQueryParams:l,setMatrixParams:c,setParentCollection:T,setSuggestion:P}}function me(e,t){const r=a.useRef(!1);a.useEffect(()=>{r.current?e():r.current=!0},t)}const ht=({field:e=void 0,text:t="",maximumSuggestions:r=10}={})=>({field:e,text:t,maximumSuggestions:r});function Et(e){const t=ht(e),[r,n]=a.useState(t),s=a.useCallback((l,c="")=>{n(E=>({...E,field:l,text:c}))},[]),o=a.useCallback(l=>{n(c=>({...c,text:l}))},[]),u=a.useCallback(l=>{n(c=>({...c,maximumSuggestions:l}))},[]),{request:i,data:{suggestion:f=[]}={}}=j(C.search.searchAutoComplete);return me(()=>{i({autocompleteRequestDocument:r})},[r]),{suggestions:f,setAutocompleteField:s,setAutocompleteText:o,setAutocompleteMaxSuggestions:u}}const pt=(e="id",t=[])=>{const[r,n]=a.useState(t);return{selected:r,onSelect:(i,f,l)=>{const c=l[e],E=r.findIndex(h=>h[e]===c);if(E===-1&&f===!0)f===!0&&n([...r,l]);else if(E>-1&&f===!1){const h=[...r];h.splice(E,1),n(h)}},onClear:()=>n([]),isSelected:i=>{const f=i[e];return r.findIndex(c=>c[e]===f)>-1}}},Ct=e=>{const[t,r]=a.useState(e);return{activeTab:t,changeTab:(s,o)=>r(o)}};function gt(e,t){const r=a.useRef();a.useEffect(()=>{r.current=e},[e]),a.useEffect(()=>{const s=setInterval(()=>r.current(),t);return()=>clearInterval(s)},[t])}function St(e=[]){const t=a.useRef(),r=a.useMemo(()=>Math.floor(e.length/2),[e]),[n,s]=a.useState(),o=a.useRef(n);if(a.useEffect(()=>()=>t.current&&clearInterval(t.current),[]),e.length===0)return{width:0};o.current=n;const u=()=>{const E=()=>{o.current===void 0?s(0):o.current===e.length-1?clearInterval(t.current):s(o.current+1)};t.current=setInterval(E,500)},i=()=>{s(),clearInterval(t.current)},f=e[n===void 0?r:n],l=n===void 0?0:`${Math.floor(n/(e.length-1)*100)}%`;return{imageSrc:f,onMouseEnter:u,onMouseLeave:i,width:l}}const Y={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_TYPE:"CHANGE_TYPE",CHANGE_STATE:"CHANGE_STATE",CHANGE_PRIORITY:"CHANGE_PRIORITY",CHANGE_STARTTIME:"CHANGE_STARTTIME",CHANGE_FINISHTIME:"CHANGE_FINISHTIME"},yt=({queryParams:e={},matrixParams:t={}}={})=>({queryParams:e,matrixParams:{first:1,number:10,...t},rowsPerPage:10,page:0,jobMetadata:[]}),Tt=(e,t)=>{const{type:r,...n}=t;switch(r){case Y.CHANGE_PAGE:{const{page:s=0}=t,{rowsPerPage:o=10}=e;return{...e,page:s,matrixParams:{...e.matrixParams,first:s*o+1}}}case Y.CHANGE_ROWS:{const{rowsPerPage:s}=t;return{...e,rowsPerPage:s,page:0,matrixParams:{...e.matrixParams,first:1,number:s}}}case Y.CHANGE_SORT:{const{field:s,order:o="desc"}=t;return{...e,page:0,matrixParams:{...e.matrixParams,first:1,sort:`${s} ${o}`}}}case Y.CHANGE_TYPE:case Y.CHANGE_STATE:case Y.CHANGE_PRIORITY:{const{field:s,value:o=[]}=n;let u;if(o)u={...e.matrixParams,first:1,[s]:Array.isArray(o)?o.join(","):o};else{const{[s]:i,...f}=e.matrixParams;u={...f,first:1}}return{...e,page:0,matrixParams:u}}case Y.CHANGE_STARTTIME:case Y.CHANGE_FINISHTIME:{const{field:s,value:o=[]}=n;let u;if(o)u={...e.queryParams,first:1,[s]:o};else{const{[s]:i,...f}=e.queryParams;u={...f,first:1}}return{...e,page:0,queryParams:u}}case Y.CHANGE_JOBMETADATA:{const{field:s,value:o=[]}=n;let u;if(o.length)u={...e.queryParams,first:1,[s]:o};else{const{[s]:i,...f}=e.queryParams;u={...f,first:1}}return{...e,page:0,queryParams:u,jobMetadata:o}}default:return e}};function At(e){const t=yt(e),[r,n]=a.useReducer(Tt,t);return{state:r,onChangePage:({page:d})=>n({type:Y.CHANGE_PAGE,page:d}),onChangeSort:(d,p,m)=>{const T=typeof p=="object"?p.value:p;n({type:Y.CHANGE_SORT,field:T,order:m})},onChangeType:({field:d=[]})=>{const[{name:p="type",value:m=[]}]=d;n({type:Y.CHANGE_TYPE,field:p,value:m.length?m[0].value:null})},onChangeState:({field:d=[]})=>{const[{name:p="state",value:m=[]}]=d;n({type:Y.CHANGE_STATE,field:p,value:m.length?m[0].value:null})},onChangePriority:({field:d=[]})=>{const[{name:p="priority",value:m=[]}]=d;n({type:Y.CHANGE_PRIORITY,field:p,value:m.length?m[0].value:null})},onChangeStarttime:({field:d=[]})=>{const[{name:p="starttime-from",value:m=[]}]=d;n({type:Y.CHANGE_STARTTIME,field:p,value:m.length?m[0].value:null})},onChangeFinishtime:({field:d=[]})=>{const[{name:p="finishtime-from",value:m=[]}]=d;n({type:Y.CHANGE_FINISHTIME,field:p,value:m.length?m[0].value:null})},onChangeRowsPerPage:({target:{value:d}}={})=>n({type:Y.CHANGE_ROWS,rowsPerPage:d}),onChangeJobmetadata:d=>{n({type:Y.CHANGE_JOBMETADATA,field:"jobmetadata",value:d})}}}const Rt=(e,t)=>{const[r,n]=a.useState(JSON.parse(window.localStorage.getItem(e)||JSON.stringify(t)));return a.useEffect(()=>{window.localStorage.setItem(e,JSON.stringify(r))},[e,r]),[r,n,()=>JSON.parse(window.localStorage.getItem(e))]};function we(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function Pt(e){return ve.compressToEncodedURIComponent(e)}function bt(e){return e.slice(-1)==="="?decodeURIComponent(atob(e).split("").map(t=>`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")):ve.decompressFromEncodedURIComponent(e)}const Gt=["__mp3_160k"],vt=["__mp4"],Nt=["__png"],_t="audio",It="video",Ht="image",wt=["application/mxf"],Ot=[],Dt=[],Mt=e=>{if(!e||!e.type)return[];const t=e.type.toLowerCase();return t.startsWith(_t)||Dt.includes(t)?Gt:t.startsWith(It)||wt.includes(t)?vt:t.startsWith(Ht)||Ot.includes(t)?Nt:[]},Lt=(e,t={})=>new Promise((r,n)=>{const s=new C.ChunkedTransferManager,o=new C.ChunkedUpload(e,{onFail:u=>n(u),onComplete:u=>r(u),...t});s.addChunkedUpload(o),s.upload()}),Ut=({file:e,collectionId:t,onProgress:r,metadata:n={},placeholderParams:s={},importParams:o={},chunkedUploadProps:u={},generateTransferId:i=we,getShapeTags:f=Mt})=>new Promise((l,c)=>{try{let E;r({});const h=f(e),d=e.name,p=e.type,[m]=p.split("/"),T={originalFilename:d,mimeType:p,mediaType:m,...n},P=z.createMetadataType(T);C.vsimport.createImportPlaceholder({metadataDocument:P,queryParams:{container:1,...s}}).then(({data:y})=>{if(E=y.id,!t)return Promise.resolve();const A=Array.isArray(t)?t:[t];return Promise.all(A.map(b=>C.collection.addCollectionEntity({collectionId:b,entityId:E})))}).then(()=>{const y=i(),A={filename:d,transferId:y,tag:h,...o};return Lt(e,{api:{method:C.vsimport.createImportComponentRaw,props:{itemId:E,component:"container",queryParams:A}},onProgress:r,...u})}).then(y=>{l({...y,itemId:E,collectionId:t})}).catch(y=>c(y))}catch(E){console.error(E),c(E)}});function Ft({onUploadFile:e=Ut,initialMetadata:t={},...r}){const[n,s]=a.useState([]);a.useEffect(()=>()=>{n.forEach(h=>URL.revokeObjectURL(h.preview))},[n]);const o=a.useCallback((h=[])=>{const d=h.map(p=>({file:p,metadata:{title:p.name,...t}}));s(p=>d.concat(p))},[t]),u=a.useCallback((h,d={})=>{s(p=>{const m=p[h],{metadata:T,progress:P}=d,{metadata:y={},progress:A={}}=m,b=[...p],v={...m};return T&&(v.metadata={...y,...T}),P&&(v.progress={...A,...P}),b[h]=v,b})},[s]),i=a.useCallback(h=>(d={})=>{u(h,{progress:d})},[u]),f=a.useCallback(h=>(d={})=>{u(h,{metadata:d})},[u]),l=a.useCallback(h=>n.reduce((d,p,m)=>d.then(T=>p.progress?d:e({file:p.file,onProgress:i(m),metadata:p.metadata,...h,...r}).then(P=>[...T,P])),Promise.resolve([])),[n,e,i,r]),c=a.useCallback(h=>()=>{s([...n].filter((d,p)=>p!==h))},[s,n]),E=a.useCallback(h=>()=>{s([...n].filter((d,p)=>!h.includes(p)))},[s,n]);return{onAddFiles:o,onChangeFile:u,onChangeMetadata:f,onUpload:l,onRemoveFile:c,onRemoveFiles:E,files:n,setFiles:s}}function kt({history:e,navigate:t,location:r,queryName:n="q",defaultState:s=void 0}){const o=a.useRef(s);return{queryInitialState:a.useMemo(()=>{const{location:i=r}=e||{},l=new URLSearchParams(i.search).get(n);if(!l)return o.current;try{const c=bt(l);return JSON.parse(c)}catch{e?e.replace({pathName:e.location.pathName,search:""}):t&&t(i.pathName,{replace:!0})}},[e,t,r,n])}}function qt({history:e,navigate:t,location:r,state:n,queryName:s="q"}){const o=a.useCallback(()=>{const{location:u=r}=e||{},i=Pt(JSON.stringify(n));e?e.replace({pathName:u.pathName,search:`?${s}=${i}`}):t&&t(`${u.pathName}?${s}=${i}`,{replace:!0})},[e,t,r,s,n]);me(()=>{o(n)},[o,n])}const $t=({entityId:e,entityType:t})=>{const{request:r,data:n={},isLoading:s}=j(C.access.listEntityAccess),o=a.useCallback((f={})=>r({entityId:e,entityType:t,...f}),[e,t]),u=a.useCallback(({accessId:f,...l})=>C.access.removeEntityAccess({accessId:f,entityId:e,entityType:t,...l}),[e,t]),i=a.useCallback(({accessControlDocument:f,...l})=>C.access.createEntityAccess({entityType:t,entityId:e,accessControlDocument:f,...l}),[e,t]);return{accessControlList:n,isLoading:s,onList:o,onRemove:u,onAdd:i}},Oe=({data:e=[]}={},t=void 0)=>{if(!t)return;const{value:r}=e.find(n=>n.key===t)||{};return r},jt=(e,t)=>Object.assign({},...t.map(r=>({[r]:Oe(e,r)}))),xt=({values:{field:e}={}}={})=>e?e.map(t=>({value:t.value,label:t.key||t.value})):void 0,Wt=e=>{const r=new DOMParser().parseFromString(e,"application/xml").getElementsByTagName("field");if(!r.length)return;const n={field:[]};for(let s=0;s<r.length;s+=1){const[o,u]=r[s].childNodes;n.field.push({[o.nodeName]:o.firstChild.nodeValue,[u.nodeName]:u.firstChild.nodeValue})}return n},Vt=({fields:e,groups:t,getDataAttributes:r=jt,fieldDataToInclude:n="label,displayType,required",groupDataToInclude:s="label,order",fieldQueryParams:o={},groupQueryParams:u={},getAttributes:i=!0})=>{const[f,l]=a.useState(!1),[c,E]=a.useState(e),[h,d]=a.useState(t);return Q(()=>{let p=!1;if(i===!1)return()=>{p=!0};const m=(y=[],A={})=>y.map(({name:b,...v})=>{const R=A[b]||{},{label:N,...I}=r(R,n.split(","));return{name:b,label:N||b,type:R.type,constraint:R.constraint,options:xt(R),...I,...v}}),T=(y=[],A={},b={})=>y.map(({name:v,field:R,group:N,...I})=>{const H=A[v]||{},x=R||H&&H.field,W=N||H&&H.group,{label:B,...K}=r(H,s.split(","));return{name:v,label:B||v,order:Oe(H,"order"),fields:m(x,b),groups:T(W,A,b),...K,...I}});async function P(){l(!0);const y={},A={};let b=[];if(e){const R={...o,data:n};b=e.map(async({name:N})=>{try{const{data:I}=await C.metadatafield.getMetadataField({fieldName:N,queryParams:R});y[N]=I}catch{console.warn(`Could not retrieve attributes for ${N}`)}})}let v=[];if(t){const R=[...t],N={...u,data:s};v=R.map(async({name:I})=>{try{const{data:H}=await C.fieldgroup.getFieldGroup({groupName:I,queryParams:N}),{field:x=[],group:W=[]}=H;x.forEach(B=>{const K=B.data&&B.data.find(Z=>Z.key==="__values");if(K){const Z=Wt(K.value);y[B.name]={...B,values:Z}}}),W.forEach(B=>{R.push(B)}),A[I]=H}catch{console.warn(`Could not retrieve attributes for ${I}`)}})}await Promise.all([...b,...v]),p||(Object.values(y).some(R=>R)&&E(()=>m(e,y)),Object.values(A).some(R=>R)&&d(()=>{const R=T(t,A,y);return R.forEach(N=>{const{order:I}=N;I&&N.fields.sort((H,x)=>I.indexOf(H.name)-I.indexOf(x.name))}),R}),l(!1))}return P(),()=>{p=!0}},[e,t,n,s,o,u,i]),{fieldsWithAttributes:c,groupsWithAttributes:h,isLoading:f}},Yt=1e3,Bt="TRANSIENT";function Qt({metadata:e,markerField:t,markerValue:r,itemSearchDocument:n}){return C.item.searchItem({queryParams:{result:"library",updateMode:Bt,updateFrequency:Yt},itemSearchDocument:n}).then(({data:{library:s}})=>C.collection.createCollection({collectionDocument:{metadata:t?z.createMetadataType({[t]:r||s,...e}):e,content:[{id:s,type:"library"}]}}))}const De=({collectionId:e})=>new Promise((t,r)=>{C.collection.getCollection({collectionId:e,queryParams:{children:"library"}}).then(({data:n})=>{const{content:s=[]}=n,[o]=s;o||r(new Error("No Libraries")),t(o)})}),Xt=({collectionId:e})=>De({collectionId:e}).then(({id:t})=>Promise.all([C.library.removeLibrary({libraryId:t}),C.collection.removeCollection({collectionId:e})]));function Jt({libraryId:e}){return new Promise(t=>{C.library.getLibrarySettings({libraryId:e}).then(({data:{query:r}})=>{t(r)})})}const zt=({collectionId:e})=>new Promise(t=>{De({collectionId:e}).then(({id:r})=>Jt({libraryId:r})).then(t)});function Kt({markerField:e,markerValue:t,initialSearchState:r,onSaveSearch:n=Qt,onDeleteSearch:s=Xt,onUpdateSearchMetadata:o=C.collection.updateCollectionMetadata,onGetSavedSearchSettings:u=zt}){const i=a.useCallback(({metadata:h,itemSearchDocument:d})=>n({metadata:h,markerField:e,markerValue:t,itemSearchDocument:d}),[e,t,n]),f=(h={})=>({...h,operator:{field:[{name:e,value:[{value:t||"*"}]}],operator:h.operator?[h.operator]:[],operation:"AND"}}),l=He({...r,itemSearchDocument:f()}),{setItemSearchDocument:c,...E}=l;return{onSaveSearch:i,onDeleteSearch:s,onUpdateSearchMetadata:o,onGetSavedSearchSettings:u,searchProps:{setItemSearchDocument:h=>c(f(h)),...E}}}function Me({itemSearchDocument:e,queryParams:t,matrixParams:r}){const{request:n,data:s={},isLoading:o,isError:u,cancel:i}=j(C.item.searchItem),f=()=>n({itemSearchDocument:e,queryParams:t,matrixParams:r});return Q(()=>{f()},[e,t,r]),{itemListType:s,isLoading:o,isError:u,onRefresh:f,cancel:i}}const Zt=()=>{const[e,t]=a.useState({x:0,y:0});return a.useEffect(()=>{const r=n=>t({x:n.clientX,y:n.clientY});return window.addEventListener("mousedown",r),()=>{window.removeEventListener("mousedown",r)}},[]),e};function Le({collectionId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.collection.getCollection),i=()=>n({collectionId:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{collectionType:s,isLoading:o,isError:u,onRefresh:i}}function en({collectionId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={}}=j(C.collection.getCollectionItem),o=()=>n({collectionId:e,queryParams:t});return Q(()=>{r&&o()},[e,t]),{itemListType:s,onRefresh:o}}const tn=({entityId:e,entityType:t})=>{let r,n,s;switch(t){case"collection":r="collectionType",s="collectionId",n=C.collection.getCollection;break;case"library":r="libraryType",s="libraryId",n=C.library.getLibrary;break;case"item":r="itemType",s="itemId",n=C.item.getItem;break;default:throw new Error("unknown entityType")}const{request:o,data:u,...i}=j(n),f=a.useCallback(l=>o({[s]:e,...l}),[e,s,o]);return{[r]:u,[s]:e,onGetEntity:f,...i}};function nn(e){const{data:t,request:r}=j(C.user.getUser,{data:e}),{userName:n}=t||{},s=a.useCallback(()=>r({userName:n}),[r,n]);a.useEffect(()=>{n&&s()},[s,n]);const o=a.useCallback(({userDocument:h})=>C.user.updateUser({userName:n,userDocument:h}).then(()=>r({userName:h.userName})),[r,n]),u=a.useCallback(({groups:h=[]})=>C.user.updateUserGroup({userName:n,groupListDocument:{group:h.map(d=>({groupName:d}))}}).then(s),[s,n]),i=a.useCallback(h=>C.group.removeGroupUser({groupName:h,userName:n}).then(s),[s,n]),f=a.useCallback(h=>C.user.updateUser({userName:n,userDocument:{password:h},queryParams:{passwordType:"raw"}}),[n]);return{userType:t,getUser:s,updateUser:o,updateUserGroups:u,removeUserFromGroup:i,disableUser:h=>C.user.disableUser({userName:n,...h}).then(s),enableUser:h=>C.user.enableUser({userName:n,...h}).then(s),deleteUser:({queryParams:h={}}={})=>C.user.disableUser({userName:n,queryParams:{hard:!0,...h}}),changePassword:f}}const ne={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_QUERY:"CHANGE_QUERY"},rn=({queryParams:e={},rowsPerPage:t=10,page:r=0}={})=>({queryParams:{first:r*t+1,number:t,...e},rowsPerPage:t,page:r,userSearchDocument:{sort:[{field:"username",order:"ascending"}]}}),sn=(e,t)=>{const{type:r}=t;switch(r){case ne.CHANGE_PAGE:{const{page:n}=t;return{...e,page:n,queryParams:{...e.queryParams,first:n*e.rowsPerPage+1}}}case ne.CHANGE_ROWS:{const{rowsPerPage:n}=t;return{...e,rowsPerPage:n,page:0,queryParams:{...e.queryParams,first:1,number:n}}}case ne.CHANGE_QUERY:return{...e,page:0,userSearchDocument:{...e.userSearchDocument,field:[{name:t.field||"username",value:t.query||""}]},queryParams:{...e.queryParams,first:1}};default:return e}};function on(e){const t=rn(e),[r,n]=a.useReducer(sn,t),{data:s,request:o,hasLoaded:u,isError:i}=j(C.user.searchUser),f=()=>o({userSearchDocument:r.userSearchDocument,queryParams:r.queryParams});return a.useEffect(()=>{f()},[r.queryParams,r.userSearchDocument]),{...r,hasLoaded:u,isError:i,userListDocument:s,onSearchUser:f,onChangePage:({page:d})=>n({type:ne.CHANGE_PAGE,page:d}),onChangeSort:(d,p,m)=>{const T=typeof p=="object"?p.value:p;n({type:ne.CHANGE_SORT,field:T,order:m})},onChangeRowsPerPage:({target:{value:d}}={})=>n({type:ne.CHANGE_ROWS,rowsPerPage:d}),onChangeQuery:(d,p)=>{n({type:ne.CHANGE_QUERY,field:d,query:p})}}}const an=e=>{const{request:t,data:r={},isLoading:n}=j(C.group.listGroup),s=()=>t(e);return a.useEffect(()=>{s()},[e]),{onRefresh:s,groupListType:r,isLoading:n}},un=e=>{const{request:t,data:r={},isLoading:n}=j(C.user.listUser),s=()=>t(e);return a.useEffect(()=>{s()},[e]),{onRefresh:s,userListType:r,isLoading:n}},ee={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_QUERY:"CHANGE_QUERY",HIDE_ROLES:"HIDE_ROLES"},cn=({queryParams:e={},rowsPerPage:t=10,page:r=0}={})=>({queryParams:{first:r*t+1,number:t,...e},rowsPerPage:t,page:r,groupSearchDocument:{}}),ln=(e,t)=>{const{type:r}=t;switch(r){case ee.CHANGE_PAGE:{const{page:n}=t;return{...e,page:n,queryParams:{...e.queryParams,first:n*e.rowsPerPage+1}}}case ee.CHANGE_ROWS:{const{rowsPerPage:n}=t;return{...e,rowsPerPage:n,page:0,queryParams:{...e.queryParams,first:1,number:n}}}case ee.HIDE_ROLES:{const{hideRoles:n}=t,s=n===!0?!1:void 0;return{...e,page:0,queryParams:{...e.queryParams,first:1,role:s}}}case ee.CHANGE_QUERY:return{...e,page:0,groupSearchDocument:{...e.groupSearchDocument,field:[{name:t.field||"groupname",value:t.query||""}]},queryParams:{...e.queryParams,first:1}};default:return e}};function fn(e){const t=cn(e),[r,n]=a.useReducer(ln,t),{data:s,request:o,hasLoaded:u,isError:i}=j(C.group.searchGroup),f=()=>o({groupSearchDocument:r.groupSearchDocument,queryParams:r.queryParams});return a.useEffect(()=>{f()},[r.queryParams,r.groupSearchDocument]),{...r,hasLoaded:u,isError:i,groupListDocument:s,onSearchGroup:f,onChangePage:({page:p})=>n({type:ee.CHANGE_PAGE,page:p}),onChangeSort:(p,m,T)=>{const P=typeof m=="object"?m.value:m;n({type:ee.CHANGE_SORT,field:P,order:T})},onChangeRowsPerPage:({target:{value:p}}={})=>n({type:ee.CHANGE_ROWS,rowsPerPage:p}),onChangeQuery:(p,m)=>{n({type:ee.CHANGE_QUERY,field:p,query:m})},onHideRoles:({hideRoles:p})=>n({type:ee.HIDE_ROLES,hideRoles:p})}}function dn(e){const{data:t,request:r}=j(C.group.getGroup,{data:e}),{groupName:n}=t||{},s=a.useCallback(()=>r({groupName:n}),[r,n]);a.useEffect(()=>{n&&s()},[s,n]);const o=a.useCallback(({groupDocument:d})=>C.group.updateGroup({groupName:n,groupDocument:d}).then(s),[s,n]),u=a.useCallback(({groups:d})=>C.group.updateGroup({groupName:n,groupDocument:{childGroupList:{group:d.map(p=>({groupName:p}))}}}).then(s),[s,n]),i=a.useCallback(({groups:d})=>C.group.updateGroup({groupName:n,groupDocument:{parentGroupList:{group:d.map(p=>({groupName:p}))}}}).then(s),[s,n]),f=a.useCallback(({users:d})=>C.group.updateGroup({groupName:n,groupDocument:{userList:{user:d.map(p=>({userName:p}))}}}).then(s),[s,n]),l=a.useCallback(d=>C.group.removeGroupUser({groupName:n,userName:d}).then(s),[s,n]),c=a.useCallback(d=>C.group.removeGroupChildren({groupName:n,childGroupName:d}).then(s),[s,n]),E=a.useCallback(d=>C.group.removeGroupChildren({groupName:d,childGroupName:n}).then(s),[s,n]),h=a.useCallback(()=>C.group.removeGroup({groupName:n}),[n]);return{groupType:t,getGroup:s,updateGroup:o,removeGroup:h,addChildGroups:u,addParentGroups:i,addUsersToGroup:f,removeUserFromGroup:l,removeChildGroup:c,removeFromParentGroup:E}}function Ue({itemId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.item.getItem),i=()=>n({itemId:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{itemType:s,isLoading:o,isError:u,onRefresh:i}}const mn=({collectionId:e,defaultEnabled:t=!0})=>{const[r,n]=a.useState(),[s,o]=a.useState(t),u=E=>o(h=>E!==void 0?E:!h),i=a.useRef(),f=a.useRef(),l=a.useRef(),c=a.useCallback(({itemId:E})=>{if(s===!1)return;const h={field:[{name:"mediaType",value:[{value:"video"},{value:"audio"}]}]},d=({first:p,number:m}={})=>{const{current:T}=i,{current:P}=f;if(!Array.isArray(T)){Promise.all([C.collection.getCollection({collectionId:e,queryParams:{children:"item"}}),C.collection.searchCollectionItem({collectionId:e,searchDocument:h,queryParams:{first:p,number:m}})]).then(([{data:R},{data:N}])=>{const{hits:I,item:H=[]}=N;i.current=H.map(({id:W})=>W),l.current=I;const{content:x}=R;f.current=x,d({first:1,number:100})});return}const{current:y}=l,A=P.findIndex(({id:R})=>R===E);if(A+1===P.length){n();return}if(A===-1&&y>T.length){C.collection.searchCollectionItem({collectionId:e,searchDocument:h,queryParams:{first:p+m,number:m}}).then(({data:R})=>{const{item:N=[]}=R;i.current.push(...N.map(({id:I})=>I)),d({first:p+m,number:m})});return}const v=P.slice(A+1).find(({id:R})=>T.includes(R));n(v)};d()},[e,s]);return{isAutoPlayEnabled:s,toggleAutoPlay:u,setNextPlaying:n,nextPlaying:r,onNext:c}},hn=e=>{const t=[];for(let r=0;r<e.length;r+=1){const n=e[r];if(n&&typeof n=="string")try{const s=n.split("version")[1].split("/")[1].split("?")[0],o=z.formatTimeCodeText(s);t.push(o)}catch{}}return t};function En(e=[],t=0,r=void 0,n=hn){const[s,o]=a.useState(0),[u,i]=a.useState(0),[f,l]=a.useState(!1),[c,E]=a.useState([]),[h,d]=a.useState(),[p,m]=a.useState(0),T=a.useRef(Ne(R=>{i(R)},10)).current,P=R=>{try{return Math.round(R.getBoundingClientRect().left)}catch{return 0}},y=a.useCallback(R=>{const N=R.clientX-P(R.currentTarget)-t,I=R.currentTarget.offsetWidth;return N<0?0:N>I?I:N},[t]),A=(R,N)=>{let I=N[0],H=Math.abs(R-I),x=0;for(let W=0;W<N.length;W+=1){const B=Math.abs(R-N[W]),K=R-N[W]>0;B<H&&K&&(H=B,I=N[W],x=W)}return x},b=R=>{if(r){const N=y(R);o(N-1),p!==R.currentTarget.offsetWidth&&m(R.currentTarget.offsetWidth);const I=N/(R.currentTarget.offsetWidth/+r);d(z.formatTimeCodeSeconds(I));const H=A(I,c.map(x=>x.toSeconds().toFixed(0)));H!==u&&T(H)}};return Q(()=>{const R=n(e);E(R)},[e]),{thumbnailIndex:u,thumbnailTimeCode:h,thumbnailWidth:p,showScrub:f,scrubPosition:s,handleShowScrub:R=>()=>{r>0&&l(R)},onMouseMove:b}}function pn({searchDoc:e,queryParams:t,debounceTime:r,suggestionSettings:n={maximumSuggestions:10,accuracy:1},triggerLength:s=1,apiCall:o=C.item.searchItem}){const[u,i]=a.useState(""),f=a.useRef(Ne(i,r)).current,{data:{autocomplete:l=[]}={},request:c}=j(o),{suggestion:E=[]}=l[0]||{};return Q(()=>{e&&u&&u.length>=s&&c({body:{...e,suggestion:n,autocomplete:[{text:u}],text:[{value:u}]},queryParams:{count:!1,number:0,...t}})},[c,u,t,s]),{suggestion:E,handleAutocompleteChange:f}}function Cn(){const{request:e,data:{value:t=[]}={},isLoading:r}=j(C.metadatafield.getMetadataFieldAllowedValues);return{getMetadataDataset:(s,o,u)=>{s&&e({fieldName:s,metadataFieldValueConstraintListDocument:{constraint:o?[{field:u,value:o}]:[]}})},dataset:t,isLoading:r}}const gn=1e3,Sn="TRANSIENT",Fe=e=>e.find(t=>t.name==="title").value[0].value;function yn({childFolders:e=[],queryParams:t={content:["metadata"]},markerProps:r={markerValue:"savedSearch",markerField:"eidr_referentType"},expand:n}){const[s,o]=a.useState(e),[u,i]=a.useState([]),[f,l]=a.useState(),c=a.useCallback(()=>{Promise.all(s.map(async m=>{const{data:{content:T,metadata:P={}}}=await C.collection.getCollection({collectionId:m,queryParams:t}),{field:y}=P.timespan[0];return T&&T[0].type==="library"?{id:m,libraryId:T[0].id,title:Fe(y),type:"query",metadata:P}:{id:m,title:Fe(y),subFolders:T&&T.map(A=>A.id),type:"folder",metadata:P}})).then(m=>{i(T=>[...m,...T])}).catch(m=>{l(m)})},[s,t]),E=(m,T,P,y,A)=>{C.collection.createCollection({collectionDocument:{metadata:z.createMetadataType({[T]:P,title:y})}}).then(({data:{id:b}})=>m?C.collection.updateCollection({collectionId:m,collectionDocument:{content:[{id:b,mode:"add",type:"collection"}]}}).then(({data:{content:v}})=>{v&&(o(v.filter(R=>R.id===b).map(R=>R.id)),A&&A())}).catch(v=>{l(v)}):null).catch(b=>{l(b)})},h=(m,T,P,y)=>{try{C.item.searchItem({queryParams:{result:"library",updateMode:Sn,updateFrequency:gn},itemSearchDocument:P}).then(({data:{library:A}})=>C.collection.createCollection({collectionDocument:{metadata:z.createMetadataType({[r.markerField]:r.markerValue,title:T}),content:[{id:A,type:"library"}]}})).then(({data:{id:A}})=>C.collection.updateCollection({collectionId:m,collectionDocument:{content:[{id:A,mode:"add",type:"collection"}]}}).then(({data:{content:b}})=>{b&&(o(b.filter(v=>v.id===A).map(v=>v.id)),y&&y())}).catch(b=>{l(b)})).catch(A=>{l(A)})}catch(A){l(A)}},d=m=>C.collection.removeCollection({collectionId:m}).catch(T=>{l(T)}),p=m=>{i(T=>T.filter(P=>P.id!==m))};return Q(()=>{s.length>0&&n&&c()},[s,n]),a.useEffect(()=>{!n&&typeof n=="boolean"&&(o(()=>u.map(m=>m.id)),i([]))},[n]),{createFolder:E,saveSearch:h,getSubFolders:c,deleteFolder:d,removeItem:p,subFolders:u,setSubFolders:i,setCurrentFolders:o,errors:f}}const Tn=({collectionId:e,onError:t})=>{const[r,n]=a.useState([]),o=async()=>{try{if(!e)throw Error("Missing collectionId");const{data:l={}}=await C.collection.getCollectionMetadata({collectionId:e,queryParams:{content:"metadata",field:"representativeItems"}}).catch(E=>{t&&t(E)}),{representativeItems:c=[]}=z.parseMetadataType(l,{flat:!0,includeValueAttributes:!0});n(()=>c)}catch(l){t&&t(l)}},u=async l=>{try{const c=z.createMetadataType({representativeItems:Array.isArray(l)?l:[l]}),E=await C.collection.updateCollectionMetadata({collectionId:e,metadataDocument:c});return o(),E}catch(c){t&&t(c);return}},i=l=>u({value:l,mode:"add"}),f=l=>{try{const c=r.filter(E=>E.value===l).map(E=>E.uuid);return c.length?u(c.map(E=>({uuid:E,mode:"remove"}))):void 0}catch(c){t&&t(c);return}};return a.useEffect(()=>{o()},[e]),{representativeItems:r,onRefresh:o,onAdd:i,onRemove:f}};function An(){return C.storage.listStorage().then(t=>({id:t.data.storage[0].id,uri:t.data.storage[0].method[0].uri}))}function Rn(e){return C.library.createLibrary({itemListDocument:{item:[...e.item.map(({id:t})=>({id:t}))]}})}function Pn(e,t,r){const{fileName:n="output",outputFormat:s="csv"}=r,{uri:o}=t,{data:{uri:[u]=[]}={}}=e,f=encodeURIComponent((()=>{if(o.includes("s3")){const[l,c]=o.split("?region");return`${l}${n}.${s}?region${c}`}return`${o}${n}.${s}`})());return C.library.getLibraryBatch({libraryId:u,queryParams:{destinationUri:f,...r}})}const bn=["FINISHED","FINISHED_WARNING"],Gn=["FINISHED","FINISHED_WARNING","FAILED_TOTAL","ABORTED"];function ke(e,t,r,n){const{data:{jobId:s}={}}=e,{id:o}=t,{fileName:u="output",outputFormat:i="csv"}=r,f=`${u}.${i}`;C.job.getJob({jobId:s}).then(({data:{status:l}={}}={})=>{if(bn.includes(l))try{C.file.listFileStorage({storageId:o,queryParams:{path:f,methodMetadata:[{key:"format",value:"SIGNED-AUTO"},{key:"contentDisposition",value:`attachment;+filename=${f}`}],"noauth-url":!0}}).then(c=>window.open(c.data.file[0].uri[0]))}catch(c){console.error(`Download error:
|
|
2
|
-
${c}`),n({message:"Download failed"})}else
|
|
3
|
-
${l}`),onGetFile:s=ke,onCreateList:o=Rn,onList:u=Pn,onGetStorage:i=An})=>({onDownload:()=>i().then(l=>Promise.all([o(e).then(c=>u(c,l,t)).then(r()).then(c=>s(c,l,t,n))]))});function Nn(e,t,r,n,s,o,u,i){const f=r[0].fields.map(d=>d),[l,c]=a.useState(n),E=(d,p,m,T)=>{const{value:P}=d.target,A=n.map(b=>b).map((b,v)=>m===v?{...p,[T]:P}:b);s(A),c(A)},h=async(d,p)=>{const m=z.createMetadataType(d),{timespan:T}=m,P=[];T.forEach((v,R)=>{const N={field:[],name:"V3_sport_Team",mode:"add"};v.field.forEach(I=>{N.field.push(I)}),p.includes(R)&&P.push(N)});const y={timespan:[{start:"-INF",end:"+INF",field:[],group:P}]},A=[...new Set(p)],b=[];A.forEach(v=>{const R=t.itemType.metadata.timespan[0].group.find((N,I)=>v===I);b.push(R.uuid)});try{await b.forEach(v=>setTimeout(C.metadata.removeMetadata({metadataUuid:v}),500)),await C.item.updateItemMetadata({itemId:e,metadataDocument:y}),await o(),s(l),u()}catch(v){i(v)}};return Q(()=>{s(t.group)},[t]),{tableColumns:f,onChange:E,onSubmit:h}}function qe({entity:e,entityId:t,queryParams:r={},refreshOnMount:n=!0}){const{request:s,data:o={},isLoading:u,isError:i}=j(C.metadata.getEntityMetadata),f=()=>s({entity:e,entityId:t,queryParams:r});return Q(()=>{n&&f()},[e,t,r]),{metadataType:o,isLoading:u,isError:i,onRefresh:f}}function $e({groupName:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.fieldgroup.getFieldGroup),i=()=>n({groupName:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{metadataFieldGroupType:s,isLoading:o,isError:u,onRefresh:i}}function _n({itemType:e,collectionType:t,metadataType:r,joinValue:n=",",flat:s=!0,groupAsList:o=!0,children:u,...i}){let f=r;if(e||t){const h=e||t||{};f=h==null?void 0:h.metadata}const l=a.useMemo(()=>z.parseMetadataType(f,{joinValue:n,flat:s,groupAsList:o}),[s,o,n,f]),c={...i,...l,itemType:e},E=h=>a.cloneElement(h,c);return a.Children.map(u,E)}function In({itemSearchDocument:e,queryParams:t,matrixParams:r,responseRef:n,initialState:s,children:o}){const{request:u,data:i={},isLoading:f,isError:l}=j(C.collection.searchCollection,s,n),c=()=>u({itemSearchDocument:e,queryParams:t,matrixParams:r});Q(()=>{c()},[e,t,r]);const E={itemSearchDocument:e,matrixParams:r,queryParams:t,collectionListType:i,onRefresh:c,isLoading:f,isError:l},h=d=>a.cloneElement(d,E);return a.Children.map(o,h)}function Hn({itemSearchDocument:e,queryParams:t,matrixParams:r,children:n}){const{itemListType:s,onRefresh:o,isLoading:u,isError:i}=Me({itemSearchDocument:e,queryParams:t,matrixParams:r}),f={itemSearchDocument:e,matrixParams:r,queryParams:t,itemListType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function wn({itemSearchDocument:e,queryParams:t,matrixParams:r,children:n}){const{request:s,data:o={},isLoading:u,isError:i}=j(C.search.searchItemCollection),f=()=>s({itemSearchDocument:e,queryParams:t,matrixParams:r});Q(()=>{f()},[e,t,r]);const l={itemSearchDocument:e,matrixParams:r,queryParams:t,searchResultType:o,onRefresh:f,isLoading:u,isError:i},c=E=>a.cloneElement(E,l);return a.Children.map(n,c)}function On({itemId:e,queryParams:t,refreshOnMount:r,children:n}){const{itemType:s,onRefresh:o,isLoading:u,isError:i}=Ue({itemId:e,queryParams:t,refreshOnMount:r}),f={itemId:e,queryParams:t,itemType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function Dn({collectionId:e,queryParams:t,refreshOnMount:r,children:n}){const{collectionType:s,onRefresh:o,isLoading:u,isError:i}=Le({collectionId:e,queryParams:t,refreshOnMount:r}),f={collectionId:e,queryParams:t,collectionType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function Mn({matrixParams:e,queryParams:t,children:r}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.job.listJob),i=()=>n({matrixParams:e,queryParams:t});Q(()=>{i()},[e,t]);const f={matrixParams:e,queryParams:t,onRefresh:i,isLoading:o,isError:u,jobs:s},l=c=>a.cloneElement(c,f);return a.Children.map(r,l)}function Ln({entityId:e,entityType:t,queryParams:r,children:n}){const{request:s,data:o={},isLoading:u}=j(C.access.listEntityAccess),i=()=>s({entityId:e,entityType:t,queryParams:r});a.useEffect(()=>{i()},[e,t,r]);const f={entityId:e,entityType:t,queryParams:r,accessControlList:o,onRefresh:i,isLoading:u},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}class he extends a.Component{constructor(t){super(t);const{serverUrl:r,token:n,username:s,password:o,runAs:u}=t;r&&(C.utils.defaultClient.defaults.baseURL=r),n?C.utils.defaultClient.defaults.headers.Authorization=`token ${n}`:C.utils.defaultClient.defaults.auth={username:s,password:o},u&&(C.utils.defaultClient.defaults.headers.RunAs=u)}componentDidUpdate(t){const{serverUrl:r,token:n,username:s,password:o,runAs:u}=this.props;t.serverUrl!==r&&(r?C.utils.defaultClient.defaults.baseURL=r:delete C.utils.defaultClient.defaults.baseURL),t.token!==n&&(n?C.utils.defaultClient.defaults.headers.Authorization=`token ${n}`:delete C.utils.defaultClient.defaults.headers.Authorization),!n&&(t.username!==s||t.password!==o)&&(C.utils.defaultClient.defaults.auth={username:s,password:o}),t.runAs!==u&&(u?C.utils.defaultClient.defaults.headers.RunAs=u:delete C.utils.defaultClient.defaults.headers.RunAs)}render(){const{children:t,username:r,serverUrl:n}=this.props,s={username:r,serverUrl:n},o=u=>a.cloneElement(u,s);return a.Children.map(t,o)}}const ae="VIDISPINE-TOKEN",ue="VIDISPINE-USERNAME",ie="VIDISPINE-SERVER-URL",ce="VIDISPINE-REMEMBER-ME",Un=({userName:e,password:t,serverUrl:r})=>{r&&(C.utils.defaultClient.defaults.baseURL=r);const n={seconds:2592e3,autoRefresh:"true"},s={password:t,username:e};try{C.user.getToken({queryParams:n,headers:s}).then(({data:o})=>o).catch(({response:o={},message:u="Unknown error."})=>{let i=u;throw o.status===401&&(i="Incorrect Username/Password"),i})}catch{throw"Incorrect Username/Password"}};function Fn({LoginComponent:e,LoginProps:t={},AppComponent:r,AppProps:n={},onGetToken:s=Un,onSuccess:o,onError:u,cookieOptions:i={maxAge:604800,path:"/"},...f}){const[l,c,E]=_e.useCookies([ae,ue,ie,ce]),{[ae]:h,[ue]:d,[ie]:p}=l,m=l[ce]==="true",T=y=>{let A;try{s(y).then(b=>{const{userName:v,serverUrl:R,rememberMe:N}=y;v&&c(ue,v,i),R&&c(ie,R,i),N&&c(ce,N,i),b&&c(ae,b,i),o&&o(y)}).catch(b=>{if(A=b,u)return u(A);throw A})}catch(b){if(A=b,u)return u(A)}return A},P=()=>{E(ae,i),m||(E(ue,i),E(ie,i),E(ce,i))};return h?V.jsx(he,{token:h,username:d,serverUrl:p,children:V.jsx(r,{onLogout:P,...f,...n})}):V.jsx(e,{onLogin:T,userName:d,serverUrl:p,rememberMe:m,...f,...t})}function kn({error:e,info:t}){return V.jsxs("div",{style:{height:"100%",maxHeight:"100vh",width:"100%",maxWidth:"100vw",backgroundColor:"red",color:"white"},children:[e&&V.jsx("div",{children:e.toString()}),t&&V.jsx("div",{children:t.componentStack})]})}class je extends a.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{error:t,hasError:!0}}shouldComponentUpdate(t,r){const{hasError:n,info:s}=this.state,{info:o}=r;return!(s===o&&n===!0)}componentDidCatch(t,r){const{onError:n}=this.props;if(typeof n=="function")try{n(t,r)}catch{return}this.setState({info:r})}render(){const{children:t}=this.props,{hasError:r,error:n,info:s}=this.state;return r?V.jsx(kn,{info:s,error:n}):t}}function qn({groupName:e,queryParams:t,refreshOnMount:r,children:n}){const{metadataFieldGroupType:s,onRefresh:o,isLoading:u,isError:i}=$e({groupName:e,queryParams:t,refreshOnMount:r}),f={groupName:e,queryParams:t,metadataFieldGroupType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}const xe=a.createContext();function $n({intialState:e={},onRefresh:t,userName:r,children:n}){const[s,o]=a.useState(e),u=()=>{if(r)C.user.getUserRole({userName:r}).then(({data:i})=>{o(i),t&&t(i)});else{let i;C.user.whoAmI().then(({data:f})=>(i=f,C.user.getUserRole({userName:f}))).then(({data:f})=>{o(f),t&&t(f,i)})}};return a.useEffect(u,[r]),V.jsx(xe.Provider,{value:s,children:n})}function We(){const e=a.useContext(xe);if(e===void 0)throw new Error("useRoles must be used within RolesContext");return{hasRole:r=>{if(r===void 0)throw new Error("roleName is undefined");const{group:n}=e;if(!Array.isArray(n))return null;const s=n.map(({groupName:o})=>o);return s.includes(z.ROLE_NAMES.SUPER_ACCESS_USER)?!0:Array.isArray(r)?r.findIndex(o=>s.includes(o))>-1:s.includes(r)},groupListType:e}}function jn({roleName:e,allow:t,deny:r,loading:n}){if(e===void 0)throw new Error("roleName is undefined");const{hasRole:s}=We(),o=s(e);return a.isValidElement(t)&&o===!0?t:a.isValidElement(r)&&o===!1?r:a.isValidElement(n)&&o===null?n:null}function xn({providers:e=[],children:t,...r}){return e.reduceRight((n,s)=>{if(typeof s=="function")return V.jsx(s,{...r,children:n});const{provider:o,...u}=s;return V.jsx(o,{...r,...u,children:n})},t)}function Wn({entity:e,entityId:t,queryParams:r,refreshOnMount:n,children:s}){const{metadataType:o,onRefresh:u,isLoading:i,isError:f}=qe({entity:e,entityId:t,queryParams:r,refreshOnMount:n}),l={entity:e,entityId:t,queryParams:r,metadataType:o,onRefresh:u,isLoading:i,isError:f};e==="collection"?l.collectionId=t:e==="item"&&(l.itemId=t);const c=E=>a.cloneElement(E,l);return a.Children.map(s,c)}const Vn=(e,t={})=>r=>V.jsx(je,{...t,children:V.jsx(e,{...r})}),Yn=(...e)=>e.reduce((t,r)=>(...n)=>t(r(...n)),t=>t),Ve=a.createContext(),Bn=(e,{entityId:t,entityType:r,entityTimespan:{start:n,end:s,field:[{name:o}={}]=[]}={}})=>{const u=e.some(f=>f.entity.id===t&&f.entityType===r);let i=!1;return u&&e.filter(l=>l.entity.id===t&&l.entityType===r).forEach(({entityTimespan:{start:l,end:c,field:[{name:E}={}]=[]}={}})=>{n===l&&s===c&&o===E&&(i=!0)}),!u||!i};function Qn({onChange:e,children:t,initialState:r=[],allowDuplicates:n=!1,isUniqueBinItem:s=Bn}){const[o,u]=a.useState(r),[i,f]=a.useState(n),l=a.useCallback(m=>{if(!m||!["string","number"].includes(typeof m)){console.error("BinProvider onDelete called without a binId of the entity to delete");return}u(T=>{const P=T.filter(y=>y.binId!==m);return e&&e(P),P})},[e]),c=a.useCallback(()=>{u([]),e&&e([])},[e]),E=m=>{const[T]=we().split("-");return{binId:T,...m}},h=a.useCallback(({dragInfo:m={}}={})=>{const{entityId:T,entityType:P,entity:y}=m;if(!T||!P||!y)throw new Error("Dragged element needs to have entityId, entityType and entity props");u((A=[])=>{if(s(A,m)||i){const b=[...A,E(m)];return e&&e(b),b}return A})},[i,s,e]),d=a.useCallback(({dragId:m,hoverId:T,originalDragIndex:P})=>{m===void 0||T===void 0&&P===void 0||u(y=>{const A=[...y],b=o.findIndex(N=>N.binId===m),v=o.findIndex(N=>N.binId===T),R=v>-1?v:P;return[A[R],A[b]]=[A[b],A[R]],e&&e(A),A})},[o,e]),p=a.useMemo(()=>({setBin:u,bin:o,allowDuplicates:i,setAllowDuplicates:f,onDrop:h,onSort:d,onFind:()=>null,onEmptyBin:c,onDelete:l}),[i,o,h,d,l,c]);return V.jsx(Ve.Provider,{value:p,children:t})}function Xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};/*
|
|
1
|
+
(function(g,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("@vidispine/vdt-api"),require("@vidispine/vdt-js"),require("lz-string"),require("use-deep-compare-effect"),require("lodash.debounce"),require("react/jsx-runtime"),require("react-cookie"),require("react-is")):typeof define=="function"&&define.amd?define(["exports","react","@vidispine/vdt-api","@vidispine/vdt-js","lz-string","use-deep-compare-effect","lodash.debounce","react/jsx-runtime","react-cookie","react-is"],a):(g=typeof globalThis<"u"?globalThis:g||self,a(g["@vidispine/vdt-react"]={},g.react,g.vdtApi,g.vdtJs,g.lzString,g.useDeepCompareEffect,g._debounce,g.jsxRuntime,g.reactCookie,g.reactIs))})(this,function(g,a,C,z,ve,Q,Ne,V,_e,Ie){"use strict";const lt=({hasLoaded:e=!1,isLoading:t=!0,isError:r=!1,response:n=void 0,data:s=void 0}={},o=void 0)=>({isLoading:t,hasLoaded:e,isError:r,response:n,data:o&&o.current?o.current:s}),ft=(e,t)=>{switch(t.type){case"START":return{...e,isLoading:!0,isError:!1};case"SUCCESS":{const{responseType:r}=t.response,n={isLoading:!1,isError:!1,hasLoaded:!0,response:t.response,data:t.response.data};return r&&(n[r]=t.response[r]),n}case"ERROR":return{isLoading:!1,isError:!0,hasLoaded:!0,response:t.response,data:t.response.data};case"CANCEL":return{...e,isLoading:!1,isError:!1,hasLoaded:!0};case"RESET":return{...t.initialState};default:return e}};function j(e,t,r){const n=a.useRef(()=>null),s=lt(t,r),o=a.useRef(s),[u,i]=a.useReducer(ft,s),f=a.useCallback(E=>(i({type:"START"}),new Promise((h,d)=>{e({cancelToken:new C.utils.CancelToken(p=>{n.current=p}),...E}).then(p=>{h(p),i({type:"SUCCESS",response:p}),r&&(r.current=p.data)}).catch(p=>{p.__CANCEL__?i({type:"CANCEL"}):(d(p),i({type:"ERROR",response:p}))})})),[e,r]),l=a.useCallback(()=>i({type:"RESET",initialState:o.current}),[]),c=a.useCallback(()=>n.current(),[]);return a.useEffect(()=>()=>{c(),l()},[c,l]),{request:f,reset:l,cancel:c,...u}}const k={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_SEARCHTEXT:"CHANGE_SEARCHTEXT",CHANGE_SEARCHFIELD:"CHANGE_SEARCHFIELD",CHANGE_SEARCHFIELDFACET:"CHANGE_SEARCHFIELDFACET",CHANGE_SEARCHFILTER:"CHANGE_SEARCHFILTER",CHANGE_SEARCHFILTERFACET:"CHANGE_SEARCHFILTERFACET",CHANGE_PARENT_COLLECTION:"CHANGE_PARENT_COLLECTION",CHANGE_FACET:"CHANGE_FACET",CHANGE_ITEMSEARCHDOCUMENT:"CHANGE_ITEMSEARCHDOCUMENT",CHANGE_QUERYPARAMS:"CHANGE_QUERYPARAMS",CHANGE_MATRIXPARAMS:"CHANGE_MATRIXPARAMS",CHANGE_SUGGESTION:"CHANGE_SUGGESTION"},dt=({queryParams:e={},matrixParams:t={},itemSearchDocument:r={},rowsPerPage:n=10,page:s=0,...o}={})=>({...o,queryParams:{content:"metadata",interval:"generic",...e},matrixParams:{first:s*n+1,number:n,...t},itemSearchDocument:{intervals:"generic",filter:[],...r},rowsPerPage:n,page:s}),mt=(e,t)=>{switch(t.type){case k.CHANGE_ITEMSEARCHDOCUMENT:return{...e,page:Number.isInteger(t.page)?t.page:e.page,itemSearchDocument:t.itemSearchDocument,matrixParams:{...e.matrixParams,first:Number.isInteger(t.page)?t.page*e.rowsPerPage+1:e.matrixParams.first}};case k.CHANGE_QUERYPARAMS:return{...e,queryParams:t.queryParams};case k.CHANGE_MATRIXPARAMS:return{...e,matrixParams:t.matrixParams};case k.CHANGE_PAGE:return{...e,page:t.page,matrixParams:{...e.matrixParams,first:t.page*e.rowsPerPage+1}};case k.CHANGE_ROWS:return{...e,rowsPerPage:t.rowsPerPage,page:0,matrixParams:{...e.matrixParams,first:1,number:t.rowsPerPage}};case k.CHANGE_SORT:return{...e,page:0,searchText:t.value,sort:t.value,itemSearchDocument:{...e.itemSearchDocument,sort:t.field?[{field:t.field,order:t.order||"descending"}]:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHTEXT:return{...e,page:0,searchText:t.value,itemSearchDocument:t.value?{...e.itemSearchDocument,text:[{value:`${t.value}`}]}:{...e.itemSearchDocument,text:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFIELD:return{...e,page:0,field:t.field,itemSearchDocument:t.field?{...e.itemSearchDocument,field:t.field}:{...e.itemSearchDocument,field:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFIELDFACET:return{...e,page:0,field:t.field,facet:t.facet,itemSearchDocument:t.field?{...e.itemSearchDocument,field:t.field,facet:t.facet}:{...e.itemSearchDocument,field:[],facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFILTER:return{...e,page:0,filter:t.filter,itemSearchDocument:t.filter?{...e.itemSearchDocument,filter:t.filter}:{...e.itemSearchDocument,filter:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SEARCHFILTERFACET:return{...e,page:0,filter:t.filter,itemSearchDocument:t.filter?{...e.itemSearchDocument,filter:t.filter,facet:t.facet}:{...e.itemSearchDocument,filter:[],facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_FACET:return{...e,page:0,facet:t.facet,itemSearchDocument:t.facet?{...e.itemSearchDocument,facet:t.facet}:{...e.itemSearchDocument,facet:[]},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_PARENT_COLLECTION:return{...e,page:0,parentCollection:t.value,itemSearchDocument:t.value?{...e.itemSearchDocument,operator:{field:[{name:"__parent_collection",value:[{value:`${t.value}`}]},{name:"__collection",value:[{value:`${t.value}`}]}],operation:"OR"}}:{...e.itemSearchDocument,operator:void 0},matrixParams:{...e.matrixParams,first:1}};case k.CHANGE_SUGGESTION:return{...e,itemSearchDocument:{...e.itemSearchDocument,suggestion:t.suggestion}};default:return e}};function He(e){const t=dt(e),[r,n]=a.useReducer(mt,t),s=({target:{value:y}}={})=>n({type:k.CHANGE_ROWS,rowsPerPage:y}),o=({page:y})=>n({type:k.CHANGE_PAGE,page:y}),u=(y,A,b)=>n({type:k.CHANGE_SORT,field:A,order:b}),i=a.useCallback(y=>n({type:k.CHANGE_SEARCHTEXT,value:y}),[]),f=a.useCallback((y,A)=>n({type:k.CHANGE_ITEMSEARCHDOCUMENT,itemSearchDocument:y,page:A}),[]),l=a.useCallback(y=>n({type:k.CHANGE_QUERYPARAMS,queryParams:y}),[]),c=a.useCallback(y=>n({type:k.CHANGE_MATRIXPARAMS,matrixParams:y}),[]),E=a.useCallback(y=>n({type:k.CHANGE_SEARCHFIELD,field:y}),[]),h=a.useCallback(y=>{const A=y.map(({name:b})=>({field:b,count:!0}));n({type:k.CHANGE_SEARCHFIELDFACET,field:y,facet:A})},[]),d=a.useCallback(y=>n({type:k.CHANGE_SEARCHFILTER,filter:y}),[]),p=a.useCallback(y=>{const b=y.reduce((v,{field:R=[]})=>v.concat(R),[]).map(({name:v})=>({name:v,field:v,count:!0,exclude:[v]}));n({type:k.CHANGE_SEARCHFILTERFACET,filter:y,facet:b})},[n]),m=a.useCallback(y=>{n({type:k.CHANGE_FACET,facet:y})},[n]),T=a.useCallback(y=>n({type:k.CHANGE_PARENT_COLLECTION,value:y}),[]),P=a.useCallback(y=>{n({type:k.CHANGE_SUGGESTION,suggestion:y})},[]);return{state:r,onChangeRowsPerPage:s,onChangePage:o,onChangeSort:u,setSearchText:i,setSearchField:E,setSearchFieldFacet:h,setSearchFilter:d,setSearchFilterFacet:p,setFacet:m,setItemSearchDocument:f,setQueryParams:l,setMatrixParams:c,setParentCollection:T,setSuggestion:P}}function me(e,t){const r=a.useRef(!1);a.useEffect(()=>{r.current?e():r.current=!0},t)}const ht=({field:e=void 0,text:t="",maximumSuggestions:r=10}={})=>({field:e,text:t,maximumSuggestions:r});function Et(e){const t=ht(e),[r,n]=a.useState(t),s=a.useCallback((l,c="")=>{n(E=>({...E,field:l,text:c}))},[]),o=a.useCallback(l=>{n(c=>({...c,text:l}))},[]),u=a.useCallback(l=>{n(c=>({...c,maximumSuggestions:l}))},[]),{request:i,data:{suggestion:f=[]}={}}=j(C.search.searchAutoComplete);return me(()=>{i({autocompleteRequestDocument:r})},[r]),{suggestions:f,setAutocompleteField:s,setAutocompleteText:o,setAutocompleteMaxSuggestions:u}}const pt=(e="id",t=[])=>{const[r,n]=a.useState(t);return{selected:r,onSelect:(i,f,l)=>{const c=l[e],E=r.findIndex(h=>h[e]===c);if(E===-1&&f===!0)f===!0&&n([...r,l]);else if(E>-1&&f===!1){const h=[...r];h.splice(E,1),n(h)}},onClear:()=>n([]),isSelected:i=>{const f=i[e];return r.findIndex(c=>c[e]===f)>-1}}},Ct=e=>{const[t,r]=a.useState(e);return{activeTab:t,changeTab:(s,o)=>r(o)}};function gt(e,t){const r=a.useRef();a.useEffect(()=>{r.current=e},[e]),a.useEffect(()=>{const s=setInterval(()=>r.current(),t);return()=>clearInterval(s)},[t])}function St(e=[]){const t=a.useRef(),r=a.useMemo(()=>Math.floor(e.length/2),[e]),[n,s]=a.useState(),o=a.useRef(n);if(a.useEffect(()=>()=>t.current&&clearInterval(t.current),[]),e.length===0)return{width:0};o.current=n;const u=()=>{const E=()=>{o.current===void 0?s(0):o.current===e.length-1?clearInterval(t.current):s(o.current+1)};t.current=setInterval(E,500)},i=()=>{s(),clearInterval(t.current)},f=e[n===void 0?r:n],l=n===void 0?0:`${Math.floor(n/(e.length-1)*100)}%`;return{imageSrc:f,onMouseEnter:u,onMouseLeave:i,width:l}}const Y={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_TYPE:"CHANGE_TYPE",CHANGE_STATE:"CHANGE_STATE",CHANGE_PRIORITY:"CHANGE_PRIORITY",CHANGE_STARTTIME:"CHANGE_STARTTIME",CHANGE_FINISHTIME:"CHANGE_FINISHTIME"},yt=({queryParams:e={},matrixParams:t={}}={})=>({queryParams:e,matrixParams:{first:1,number:10,...t},rowsPerPage:10,page:0,jobMetadata:[]}),Tt=(e,t)=>{const{type:r,...n}=t;switch(r){case Y.CHANGE_PAGE:{const{page:s=0}=t,{rowsPerPage:o=10}=e;return{...e,page:s,matrixParams:{...e.matrixParams,first:s*o+1}}}case Y.CHANGE_ROWS:{const{rowsPerPage:s}=t;return{...e,rowsPerPage:s,page:0,matrixParams:{...e.matrixParams,first:1,number:s}}}case Y.CHANGE_SORT:{const{field:s,order:o="desc"}=t;return{...e,page:0,matrixParams:{...e.matrixParams,first:1,sort:`${s} ${o}`}}}case Y.CHANGE_TYPE:case Y.CHANGE_STATE:case Y.CHANGE_PRIORITY:{const{field:s,value:o=[]}=n;let u;if(o)u={...e.matrixParams,first:1,[s]:Array.isArray(o)?o.join(","):o};else{const{[s]:i,...f}=e.matrixParams;u={...f,first:1}}return{...e,page:0,matrixParams:u}}case Y.CHANGE_STARTTIME:case Y.CHANGE_FINISHTIME:{const{field:s,value:o=[]}=n;let u;if(o)u={...e.queryParams,first:1,[s]:o};else{const{[s]:i,...f}=e.queryParams;u={...f,first:1}}return{...e,page:0,queryParams:u}}case Y.CHANGE_JOBMETADATA:{const{field:s,value:o=[]}=n;let u;if(o.length)u={...e.queryParams,first:1,[s]:o};else{const{[s]:i,...f}=e.queryParams;u={...f,first:1}}return{...e,page:0,queryParams:u,jobMetadata:o}}default:return e}};function At(e){const t=yt(e),[r,n]=a.useReducer(Tt,t);return{state:r,onChangePage:({page:d})=>n({type:Y.CHANGE_PAGE,page:d}),onChangeSort:(d,p,m)=>{const T=typeof p=="object"?p.value:p;n({type:Y.CHANGE_SORT,field:T,order:m})},onChangeType:({field:d=[]})=>{const[{name:p="type",value:m=[]}]=d;n({type:Y.CHANGE_TYPE,field:p,value:m.length?m[0].value:null})},onChangeState:({field:d=[]})=>{const[{name:p="state",value:m=[]}]=d;n({type:Y.CHANGE_STATE,field:p,value:m.length?m[0].value:null})},onChangePriority:({field:d=[]})=>{const[{name:p="priority",value:m=[]}]=d;n({type:Y.CHANGE_PRIORITY,field:p,value:m.length?m[0].value:null})},onChangeStarttime:({field:d=[]})=>{const[{name:p="starttime-from",value:m=[]}]=d;n({type:Y.CHANGE_STARTTIME,field:p,value:m.length?m[0].value:null})},onChangeFinishtime:({field:d=[]})=>{const[{name:p="finishtime-from",value:m=[]}]=d;n({type:Y.CHANGE_FINISHTIME,field:p,value:m.length?m[0].value:null})},onChangeRowsPerPage:({target:{value:d}}={})=>n({type:Y.CHANGE_ROWS,rowsPerPage:d}),onChangeJobmetadata:d=>{n({type:Y.CHANGE_JOBMETADATA,field:"jobmetadata",value:d})}}}const Rt=(e,t)=>{const[r,n]=a.useState(JSON.parse(window.localStorage.getItem(e)||JSON.stringify(t)));return a.useEffect(()=>{window.localStorage.setItem(e,JSON.stringify(r))},[e,r]),[r,n,()=>JSON.parse(window.localStorage.getItem(e))]};function we(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}function Pt(e){return ve.compressToEncodedURIComponent(e)}function bt(e){return e.slice(-1)==="="?decodeURIComponent(atob(e).split("").map(t=>`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")):ve.decompressFromEncodedURIComponent(e)}const Gt=["__mp3_160k"],vt=["__mp4"],Nt=["__png"],_t="audio",It="video",Ht="image",wt=["application/mxf"],Ot=[],Dt=[],Mt=e=>{if(!e||!e.type)return[];const t=e.type.toLowerCase();return t.startsWith(_t)||Dt.includes(t)?Gt:t.startsWith(It)||wt.includes(t)?vt:t.startsWith(Ht)||Ot.includes(t)?Nt:[]},Lt=(e,t={})=>new Promise((r,n)=>{const s=new C.ChunkedTransferManager,o=new C.ChunkedUpload(e,{onFail:u=>n(u),onComplete:u=>r(u),...t});s.addChunkedUpload(o),s.upload()}),Ut=({file:e,collectionId:t,onProgress:r,metadata:n={},placeholderParams:s={},importParams:o={},chunkedUploadProps:u={},generateTransferId:i=we,getShapeTags:f=Mt})=>new Promise((l,c)=>{try{let E;r({});const h=f(e),d=e.name,p=e.type,[m]=p.split("/"),T={originalFilename:d,mimeType:p,mediaType:m,...n},P=z.createMetadataType(T);C.vsimport.createImportPlaceholder({metadataDocument:P,queryParams:{container:1,...s}}).then(({data:y})=>{if(E=y.id,!t)return Promise.resolve();const A=Array.isArray(t)?t:[t];return Promise.all(A.map(b=>C.collection.addCollectionEntity({collectionId:b,entityId:E})))}).then(()=>{const y=i(),A={filename:d,transferId:y,tag:h,...o};return Lt(e,{api:{method:C.vsimport.createImportComponentRaw,props:{itemId:E,component:"container",queryParams:A}},onProgress:r,...u})}).then(y=>{l({...y,itemId:E,collectionId:t})}).catch(y=>c(y))}catch(E){console.error(E),c(E)}});function Ft({onUploadFile:e=Ut,initialMetadata:t={},...r}){const[n,s]=a.useState([]);a.useEffect(()=>()=>{n.forEach(h=>URL.revokeObjectURL(h.preview))},[n]);const o=a.useCallback((h=[])=>{const d=h.map(p=>({file:p,metadata:{title:p.name,...t}}));s(p=>d.concat(p))},[t]),u=a.useCallback((h,d={})=>{s(p=>{const m=p[h],{metadata:T,progress:P}=d,{metadata:y={},progress:A={}}=m,b=[...p],v={...m};return T&&(v.metadata={...y,...T}),P&&(v.progress={...A,...P}),b[h]=v,b})},[s]),i=a.useCallback(h=>(d={})=>{u(h,{progress:d})},[u]),f=a.useCallback(h=>(d={})=>{u(h,{metadata:d})},[u]),l=a.useCallback(h=>n.reduce((d,p,m)=>d.then(T=>p.progress?d:e({file:p.file,onProgress:i(m),metadata:p.metadata,...h,...r}).then(P=>[...T,P])),Promise.resolve([])),[n,e,i,r]),c=a.useCallback(h=>()=>{s([...n].filter((d,p)=>p!==h))},[s,n]),E=a.useCallback(h=>()=>{s([...n].filter((d,p)=>!h.includes(p)))},[s,n]);return{onAddFiles:o,onChangeFile:u,onChangeMetadata:f,onUpload:l,onRemoveFile:c,onRemoveFiles:E,files:n,setFiles:s}}function kt({history:e,navigate:t,location:r,queryName:n="q",defaultState:s=void 0}){const o=a.useRef(s);return{queryInitialState:a.useMemo(()=>{const{location:i=r}=e||{},l=new URLSearchParams(i.search).get(n);if(!l)return o.current;try{const c=bt(l);return JSON.parse(c)}catch{e?e.replace({pathName:e.location.pathName,search:""}):t&&t(i.pathName,{replace:!0})}},[e,t,r,n])}}function qt({history:e,navigate:t,location:r,state:n,queryName:s="q"}){const o=a.useCallback(()=>{const{location:u=r}=e||{},i=Pt(JSON.stringify(n));e?e.replace({pathName:u.pathName,search:`?${s}=${i}`}):t&&t(`${u.pathName}?${s}=${i}`,{replace:!0})},[e,t,r,s,n]);me(()=>{o(n)},[o,n])}const $t=({entityId:e,entityType:t})=>{const{request:r,data:n={},isLoading:s}=j(C.access.listEntityAccess),o=a.useCallback((f={})=>r({entityId:e,entityType:t,...f}),[e,t]),u=a.useCallback(({accessId:f,...l})=>C.access.removeEntityAccess({accessId:f,entityId:e,entityType:t,...l}),[e,t]),i=a.useCallback(({accessControlDocument:f,...l})=>C.access.createEntityAccess({entityType:t,entityId:e,accessControlDocument:f,...l}),[e,t]);return{accessControlList:n,isLoading:s,onList:o,onRemove:u,onAdd:i}},Oe=({data:e=[]}={},t=void 0)=>{if(!t)return;const{value:r}=e.find(n=>n.key===t)||{};return r},jt=(e,t)=>Object.assign({},...t.map(r=>({[r]:Oe(e,r)}))),xt=({values:{field:e}={}}={})=>e?e.map(t=>({value:t.value,label:t.key||t.value})):void 0,Wt=e=>{const r=new DOMParser().parseFromString(e,"application/xml").getElementsByTagName("field");if(!r.length)return;const n={field:[]};for(let s=0;s<r.length;s+=1){const[o,u]=r[s].childNodes;n.field.push({[o.nodeName]:o.firstChild.nodeValue,[u.nodeName]:u.firstChild.nodeValue})}return n},Vt=({fields:e,groups:t,getDataAttributes:r=jt,fieldDataToInclude:n="label,displayType,required",groupDataToInclude:s="label,order",fieldQueryParams:o={},groupQueryParams:u={},getAttributes:i=!0})=>{const[f,l]=a.useState(!1),[c,E]=a.useState(e),[h,d]=a.useState(t);return Q(()=>{let p=!1;if(i===!1)return()=>{p=!0};const m=(y=[],A={})=>y.map(({name:b,...v})=>{const R=A[b]||{},{label:N,...I}=r(R,n.split(","));return{name:b,label:N||b,type:R.type,constraint:R.constraint,options:xt(R),...I,...v}}),T=(y=[],A={},b={})=>y.map(({name:v,field:R,group:N,...I})=>{const H=A[v]||{},x=R||H&&H.field,W=N||H&&H.group,{label:B,...K}=r(H,s.split(","));return{name:v,label:B||v,order:Oe(H,"order"),fields:m(x,b),groups:T(W,A,b),...K,...I}});async function P(){l(!0);const y={},A={};let b=[];if(e){const R={...o,data:n};b=e.map(async({name:N})=>{try{const{data:I}=await C.metadatafield.getMetadataField({fieldName:N,queryParams:R});y[N]=I}catch{console.warn(`Could not retrieve attributes for ${N}`)}})}let v=[];if(t){const R=[...t],N={...u,data:s};v=R.map(async({name:I})=>{try{const{data:H}=await C.fieldgroup.getFieldGroup({groupName:I,queryParams:N}),{field:x=[],group:W=[]}=H;x.forEach(B=>{const K=B.data&&B.data.find(Z=>Z.key==="__values");if(K){const Z=Wt(K.value);y[B.name]={...B,values:Z}}}),W.forEach(B=>{R.push(B)}),A[I]=H}catch{console.warn(`Could not retrieve attributes for ${I}`)}})}await Promise.all([...b,...v]),p||(Object.values(y).some(R=>R)&&E(()=>m(e,y)),Object.values(A).some(R=>R)&&d(()=>{const R=T(t,A,y);return R.forEach(N=>{const{order:I}=N;I&&N.fields.sort((H,x)=>I.indexOf(H.name)-I.indexOf(x.name))}),R}),l(!1))}return P(),()=>{p=!0}},[e,t,n,s,o,u,i]),{fieldsWithAttributes:c,groupsWithAttributes:h,isLoading:f}},Yt="TRANSIENT";function Bt({metadata:e,markerField:t,markerValue:r,itemSearchDocument:n}){return C.item.searchItem({queryParams:{result:"library",updateMode:Yt},itemSearchDocument:n}).then(({data:{library:s}})=>C.collection.createCollection({collectionDocument:{metadata:t?z.createMetadataType({[t]:r||s,...e}):e,content:[{id:s,type:"library"}]}}))}const De=({collectionId:e})=>new Promise((t,r)=>{C.collection.getCollection({collectionId:e,queryParams:{children:"library"}}).then(({data:n})=>{const{content:s=[]}=n,[o]=s;o||r(new Error("No Libraries")),t(o)})}),Qt=({collectionId:e})=>De({collectionId:e}).then(({id:t})=>Promise.all([C.library.removeLibrary({libraryId:t}),C.collection.removeCollection({collectionId:e})]));function Xt({libraryId:e}){return new Promise(t=>{C.library.getLibrarySettings({libraryId:e}).then(({data:{query:r}})=>{t(r)})})}const Jt=({collectionId:e})=>new Promise(t=>{De({collectionId:e}).then(({id:r})=>Xt({libraryId:r})).then(t)});function zt({markerField:e,markerValue:t,initialSearchState:r,onSaveSearch:n=Bt,onDeleteSearch:s=Qt,onUpdateSearchMetadata:o=C.collection.updateCollectionMetadata,onGetSavedSearchSettings:u=Jt}){const i=a.useCallback(({metadata:h,itemSearchDocument:d})=>n({metadata:h,markerField:e,markerValue:t,itemSearchDocument:d}),[e,t,n]),f=(h={})=>({...h,operator:{field:[{name:e,value:[{value:t||"*"}]}],operator:h.operator?[h.operator]:[],operation:"AND"}}),l=He({...r,itemSearchDocument:f()}),{setItemSearchDocument:c,...E}=l;return{onSaveSearch:i,onDeleteSearch:s,onUpdateSearchMetadata:o,onGetSavedSearchSettings:u,searchProps:{setItemSearchDocument:h=>c(f(h)),...E}}}function Me({itemSearchDocument:e,queryParams:t,matrixParams:r}){const{request:n,data:s={},isLoading:o,isError:u,cancel:i}=j(C.item.searchItem),f=()=>n({itemSearchDocument:e,queryParams:t,matrixParams:r});return Q(()=>{f()},[e,t,r]),{itemListType:s,isLoading:o,isError:u,onRefresh:f,cancel:i}}const Kt=()=>{const[e,t]=a.useState({x:0,y:0});return a.useEffect(()=>{const r=n=>t({x:n.clientX,y:n.clientY});return window.addEventListener("mousedown",r),()=>{window.removeEventListener("mousedown",r)}},[]),e};function Le({collectionId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.collection.getCollection),i=()=>n({collectionId:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{collectionType:s,isLoading:o,isError:u,onRefresh:i}}function Zt({collectionId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={}}=j(C.collection.getCollectionItem),o=()=>n({collectionId:e,queryParams:t});return Q(()=>{r&&o()},[e,t]),{itemListType:s,onRefresh:o}}const en=({entityId:e,entityType:t})=>{let r,n,s;switch(t){case"collection":r="collectionType",s="collectionId",n=C.collection.getCollection;break;case"library":r="libraryType",s="libraryId",n=C.library.getLibrary;break;case"item":r="itemType",s="itemId",n=C.item.getItem;break;default:throw new Error("unknown entityType")}const{request:o,data:u,...i}=j(n),f=a.useCallback(l=>o({[s]:e,...l}),[e,s,o]);return{[r]:u,[s]:e,onGetEntity:f,...i}};function tn(e){const{data:t,request:r}=j(C.user.getUser,{data:e}),{userName:n}=t||{},s=a.useCallback(()=>r({userName:n}),[r,n]);a.useEffect(()=>{n&&s()},[s,n]);const o=a.useCallback(({userDocument:h})=>C.user.updateUser({userName:n,userDocument:h}).then(()=>r({userName:h.userName})),[r,n]),u=a.useCallback(({groups:h=[]})=>C.user.updateUserGroup({userName:n,groupListDocument:{group:h.map(d=>({groupName:d}))}}).then(s),[s,n]),i=a.useCallback(h=>C.group.removeGroupUser({groupName:h,userName:n}).then(s),[s,n]),f=a.useCallback(h=>C.user.updateUser({userName:n,userDocument:{password:h},queryParams:{passwordType:"raw"}}),[n]);return{userType:t,getUser:s,updateUser:o,updateUserGroups:u,removeUserFromGroup:i,disableUser:h=>C.user.disableUser({userName:n,...h}).then(s),enableUser:h=>C.user.enableUser({userName:n,...h}).then(s),deleteUser:({queryParams:h={}}={})=>C.user.disableUser({userName:n,queryParams:{hard:!0,...h}}),changePassword:f}}const ne={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_QUERY:"CHANGE_QUERY"},nn=({queryParams:e={},rowsPerPage:t=10,page:r=0}={})=>({queryParams:{first:r*t+1,number:t,...e},rowsPerPage:t,page:r,userSearchDocument:{sort:[{field:"username",order:"ascending"}]}}),rn=(e,t)=>{const{type:r}=t;switch(r){case ne.CHANGE_PAGE:{const{page:n}=t;return{...e,page:n,queryParams:{...e.queryParams,first:n*e.rowsPerPage+1}}}case ne.CHANGE_ROWS:{const{rowsPerPage:n}=t;return{...e,rowsPerPage:n,page:0,queryParams:{...e.queryParams,first:1,number:n}}}case ne.CHANGE_QUERY:return{...e,page:0,userSearchDocument:{...e.userSearchDocument,field:[{name:t.field||"username",value:t.query||""}]},queryParams:{...e.queryParams,first:1}};default:return e}};function sn(e){const t=nn(e),[r,n]=a.useReducer(rn,t),{data:s,request:o,hasLoaded:u,isError:i}=j(C.user.searchUser),f=()=>o({userSearchDocument:r.userSearchDocument,queryParams:r.queryParams});return a.useEffect(()=>{f()},[r.queryParams,r.userSearchDocument]),{...r,hasLoaded:u,isError:i,userListDocument:s,onSearchUser:f,onChangePage:({page:d})=>n({type:ne.CHANGE_PAGE,page:d}),onChangeSort:(d,p,m)=>{const T=typeof p=="object"?p.value:p;n({type:ne.CHANGE_SORT,field:T,order:m})},onChangeRowsPerPage:({target:{value:d}}={})=>n({type:ne.CHANGE_ROWS,rowsPerPage:d}),onChangeQuery:(d,p)=>{n({type:ne.CHANGE_QUERY,field:d,query:p})}}}const on=e=>{const{request:t,data:r={},isLoading:n}=j(C.group.listGroup),s=()=>t(e);return a.useEffect(()=>{s()},[e]),{onRefresh:s,groupListType:r,isLoading:n}},an=e=>{const{request:t,data:r={},isLoading:n}=j(C.user.listUser),s=()=>t(e);return a.useEffect(()=>{s()},[e]),{onRefresh:s,userListType:r,isLoading:n}},ee={CHANGE_PAGE:"CHANGE_PAGE",CHANGE_ROWS:"CHANGE_ROWS",CHANGE_SORT:"CHANGE_SORT",CHANGE_QUERY:"CHANGE_QUERY",HIDE_ROLES:"HIDE_ROLES"},un=({queryParams:e={},rowsPerPage:t=10,page:r=0}={})=>({queryParams:{first:r*t+1,number:t,...e},rowsPerPage:t,page:r,groupSearchDocument:{}}),cn=(e,t)=>{const{type:r}=t;switch(r){case ee.CHANGE_PAGE:{const{page:n}=t;return{...e,page:n,queryParams:{...e.queryParams,first:n*e.rowsPerPage+1}}}case ee.CHANGE_ROWS:{const{rowsPerPage:n}=t;return{...e,rowsPerPage:n,page:0,queryParams:{...e.queryParams,first:1,number:n}}}case ee.HIDE_ROLES:{const{hideRoles:n}=t,s=n===!0?!1:void 0;return{...e,page:0,queryParams:{...e.queryParams,first:1,role:s}}}case ee.CHANGE_QUERY:return{...e,page:0,groupSearchDocument:{...e.groupSearchDocument,field:[{name:t.field||"groupname",value:t.query||""}]},queryParams:{...e.queryParams,first:1}};default:return e}};function ln(e){const t=un(e),[r,n]=a.useReducer(cn,t),{data:s,request:o,hasLoaded:u,isError:i}=j(C.group.searchGroup),f=()=>o({groupSearchDocument:r.groupSearchDocument,queryParams:r.queryParams});return a.useEffect(()=>{f()},[r.queryParams,r.groupSearchDocument]),{...r,hasLoaded:u,isError:i,groupListDocument:s,onSearchGroup:f,onChangePage:({page:p})=>n({type:ee.CHANGE_PAGE,page:p}),onChangeSort:(p,m,T)=>{const P=typeof m=="object"?m.value:m;n({type:ee.CHANGE_SORT,field:P,order:T})},onChangeRowsPerPage:({target:{value:p}}={})=>n({type:ee.CHANGE_ROWS,rowsPerPage:p}),onChangeQuery:(p,m)=>{n({type:ee.CHANGE_QUERY,field:p,query:m})},onHideRoles:({hideRoles:p})=>n({type:ee.HIDE_ROLES,hideRoles:p})}}function fn(e){const{data:t,request:r}=j(C.group.getGroup,{data:e}),{groupName:n}=t||{},s=a.useCallback(()=>r({groupName:n}),[r,n]);a.useEffect(()=>{n&&s()},[s,n]);const o=a.useCallback(({groupDocument:d})=>C.group.updateGroup({groupName:n,groupDocument:d}).then(s),[s,n]),u=a.useCallback(({groups:d})=>C.group.updateGroup({groupName:n,groupDocument:{childGroupList:{group:d.map(p=>({groupName:p}))}}}).then(s),[s,n]),i=a.useCallback(({groups:d})=>C.group.updateGroup({groupName:n,groupDocument:{parentGroupList:{group:d.map(p=>({groupName:p}))}}}).then(s),[s,n]),f=a.useCallback(({users:d})=>C.group.updateGroup({groupName:n,groupDocument:{userList:{user:d.map(p=>({userName:p}))}}}).then(s),[s,n]),l=a.useCallback(d=>C.group.removeGroupUser({groupName:n,userName:d}).then(s),[s,n]),c=a.useCallback(d=>C.group.removeGroupChildren({groupName:n,childGroupName:d}).then(s),[s,n]),E=a.useCallback(d=>C.group.removeGroupChildren({groupName:d,childGroupName:n}).then(s),[s,n]),h=a.useCallback(()=>C.group.removeGroup({groupName:n}),[n]);return{groupType:t,getGroup:s,updateGroup:o,removeGroup:h,addChildGroups:u,addParentGroups:i,addUsersToGroup:f,removeUserFromGroup:l,removeChildGroup:c,removeFromParentGroup:E}}function Ue({itemId:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.item.getItem),i=()=>n({itemId:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{itemType:s,isLoading:o,isError:u,onRefresh:i}}const dn=({collectionId:e,defaultEnabled:t=!0})=>{const[r,n]=a.useState(),[s,o]=a.useState(t),u=E=>o(h=>E!==void 0?E:!h),i=a.useRef(),f=a.useRef(),l=a.useRef(),c=a.useCallback(({itemId:E})=>{if(s===!1)return;const h={field:[{name:"mediaType",value:[{value:"video"},{value:"audio"}]}]},d=({first:p,number:m}={})=>{const{current:T}=i,{current:P}=f;if(!Array.isArray(T)){Promise.all([C.collection.getCollection({collectionId:e,queryParams:{children:"item"}}),C.collection.searchCollectionItem({collectionId:e,searchDocument:h,queryParams:{first:p,number:m}})]).then(([{data:R},{data:N}])=>{const{hits:I,item:H=[]}=N;i.current=H.map(({id:W})=>W),l.current=I;const{content:x}=R;f.current=x,d({first:1,number:100})});return}const{current:y}=l,A=P.findIndex(({id:R})=>R===E);if(A+1===P.length){n();return}if(A===-1&&y>T.length){C.collection.searchCollectionItem({collectionId:e,searchDocument:h,queryParams:{first:p+m,number:m}}).then(({data:R})=>{const{item:N=[]}=R;i.current.push(...N.map(({id:I})=>I)),d({first:p+m,number:m})});return}const v=P.slice(A+1).find(({id:R})=>T.includes(R));n(v)};d()},[e,s]);return{isAutoPlayEnabled:s,toggleAutoPlay:u,setNextPlaying:n,nextPlaying:r,onNext:c}},mn=e=>{const t=[];for(let r=0;r<e.length;r+=1){const n=e[r];if(n&&typeof n=="string")try{const s=n.split("version")[1].split("/")[1].split("?")[0],o=z.formatTimeCodeText(s);t.push(o)}catch{}}return t};function hn(e=[],t=0,r=void 0,n=mn){const[s,o]=a.useState(0),[u,i]=a.useState(0),[f,l]=a.useState(!1),[c,E]=a.useState([]),[h,d]=a.useState(),[p,m]=a.useState(0),T=a.useRef(Ne(R=>{i(R)},10)).current,P=R=>{try{return Math.round(R.getBoundingClientRect().left)}catch{return 0}},y=a.useCallback(R=>{const N=R.clientX-P(R.currentTarget)-t,I=R.currentTarget.offsetWidth;return N<0?0:N>I?I:N},[t]),A=(R,N)=>{let I=N[0],H=Math.abs(R-I),x=0;for(let W=0;W<N.length;W+=1){const B=Math.abs(R-N[W]),K=R-N[W]>0;B<H&&K&&(H=B,I=N[W],x=W)}return x},b=R=>{if(r){const N=y(R);o(N-1),p!==R.currentTarget.offsetWidth&&m(R.currentTarget.offsetWidth);const I=N/(R.currentTarget.offsetWidth/+r);d(z.formatTimeCodeSeconds(I));const H=A(I,c.map(x=>x.toSeconds().toFixed(0)));H!==u&&T(H)}};return Q(()=>{const R=n(e);E(R)},[e]),{thumbnailIndex:u,thumbnailTimeCode:h,thumbnailWidth:p,showScrub:f,scrubPosition:s,handleShowScrub:R=>()=>{r>0&&l(R)},onMouseMove:b}}function En({searchDoc:e,queryParams:t,debounceTime:r,suggestionSettings:n={maximumSuggestions:10,accuracy:1},triggerLength:s=1,apiCall:o=C.item.searchItem}){const[u,i]=a.useState(""),f=a.useRef(Ne(i,r)).current,{data:{autocomplete:l=[]}={},request:c}=j(o),{suggestion:E=[]}=l[0]||{};return Q(()=>{e&&u&&u.length>=s&&c({body:{...e,suggestion:n,autocomplete:[{text:u}],text:[{value:u}]},queryParams:{count:!1,number:0,...t}})},[c,u,t,s]),{suggestion:E,handleAutocompleteChange:f}}function pn(){const{request:e,data:{value:t=[]}={},isLoading:r}=j(C.metadatafield.getMetadataFieldAllowedValues);return{getMetadataDataset:(s,o,u)=>{s&&e({fieldName:s,metadataFieldValueConstraintListDocument:{constraint:o?[{field:u,value:o}]:[]}})},dataset:t,isLoading:r}}const Cn="TRANSIENT",Fe=e=>e.find(t=>t.name==="title").value[0].value;function gn({childFolders:e=[],queryParams:t={content:["metadata"]},markerProps:r={markerValue:"savedSearch",markerField:"eidr_referentType"},expand:n}){const[s,o]=a.useState(e),[u,i]=a.useState([]),[f,l]=a.useState(),c=a.useCallback(()=>{Promise.all(s.map(async m=>{const{data:{content:T,metadata:P={}}}=await C.collection.getCollection({collectionId:m,queryParams:t}),{field:y}=P.timespan[0];return T&&T[0].type==="library"?{id:m,libraryId:T[0].id,title:Fe(y),type:"query",metadata:P}:{id:m,title:Fe(y),subFolders:T&&T.map(A=>A.id),type:"folder",metadata:P}})).then(m=>{i(T=>[...m,...T])}).catch(m=>{l(m)})},[s,t]),E=(m,T,P,y,A)=>{C.collection.createCollection({collectionDocument:{metadata:z.createMetadataType({[T]:P,title:y})}}).then(({data:{id:b}})=>m?C.collection.updateCollection({collectionId:m,collectionDocument:{content:[{id:b,mode:"add",type:"collection"}]}}).then(({data:{content:v}})=>{v&&(o(v.filter(R=>R.id===b).map(R=>R.id)),A&&A())}).catch(v=>{l(v)}):null).catch(b=>{l(b)})},h=(m,T,P,y)=>{try{C.item.searchItem({queryParams:{result:"library",updateMode:Cn},itemSearchDocument:P}).then(({data:{library:A}})=>C.collection.createCollection({collectionDocument:{metadata:z.createMetadataType({[r.markerField]:r.markerValue,title:T}),content:[{id:A,type:"library"}]}})).then(({data:{id:A}})=>C.collection.updateCollection({collectionId:m,collectionDocument:{content:[{id:A,mode:"add",type:"collection"}]}}).then(({data:{content:b}})=>{b&&(o(b.filter(v=>v.id===A).map(v=>v.id)),y&&y())}).catch(b=>{l(b)})).catch(A=>{l(A)})}catch(A){l(A)}},d=m=>C.collection.removeCollection({collectionId:m}).catch(T=>{l(T)}),p=m=>{i(T=>T.filter(P=>P.id!==m))};return Q(()=>{s.length>0&&n&&c()},[s,n]),a.useEffect(()=>{!n&&typeof n=="boolean"&&(o(()=>u.map(m=>m.id)),i([]))},[n]),{createFolder:E,saveSearch:h,getSubFolders:c,deleteFolder:d,removeItem:p,subFolders:u,setSubFolders:i,setCurrentFolders:o,errors:f}}const Sn=({collectionId:e,onError:t})=>{const[r,n]=a.useState([]),o=async()=>{try{if(!e)throw Error("Missing collectionId");const{data:l={}}=await C.collection.getCollectionMetadata({collectionId:e,queryParams:{content:"metadata",field:"representativeItems"}}).catch(E=>{t&&t(E)}),{representativeItems:c=[]}=z.parseMetadataType(l,{flat:!0,includeValueAttributes:!0});n(()=>c)}catch(l){t&&t(l)}},u=async l=>{try{const c=z.createMetadataType({representativeItems:Array.isArray(l)?l:[l]}),E=await C.collection.updateCollectionMetadata({collectionId:e,metadataDocument:c});return o(),E}catch(c){t&&t(c);return}},i=l=>u({value:l,mode:"add"}),f=l=>{try{const c=r.filter(E=>E.value===l).map(E=>E.uuid);return c.length?u(c.map(E=>({uuid:E,mode:"remove"}))):void 0}catch(c){t&&t(c);return}};return a.useEffect(()=>{o()},[e]),{representativeItems:r,onRefresh:o,onAdd:i,onRemove:f}};function yn(){return C.storage.listStorage().then(t=>({id:t.data.storage[0].id,uri:t.data.storage[0].method[0].uri}))}function Tn(e){return C.library.createLibrary({itemListDocument:{item:[...e.item.map(({id:t})=>({id:t}))]}})}function An(e,t,r){const{fileName:n="output",outputFormat:s="csv"}=r,{uri:o}=t,{data:{uri:[u]=[]}={}}=e,f=encodeURIComponent((()=>{if(o.includes("s3")){const[l,c]=o.split("?region");return`${l}${n}.${s}?region${c}`}return`${o}${n}.${s}`})());return C.library.getLibraryBatch({libraryId:u,queryParams:{destinationUri:f,...r}})}const Rn=["FINISHED","FINISHED_WARNING"],Pn=["FINISHED","FINISHED_WARNING","FAILED_TOTAL","ABORTED"];function ke(e,t,r,n){const{data:{jobId:s}={}}=e,{id:o}=t,{fileName:u="output",outputFormat:i="csv"}=r,f=`${u}.${i}`;C.job.getJob({jobId:s}).then(({data:{status:l}={}}={})=>{if(Rn.includes(l))try{C.file.listFileStorage({storageId:o,queryParams:{path:f,methodMetadata:[{key:"format",value:"SIGNED-AUTO"},{key:"contentDisposition",value:`attachment;+filename=${f}`}],"noauth-url":!0}}).then(c=>window.open(c.data.file[0].uri[0]))}catch(c){console.error(`Download error:
|
|
2
|
+
${c}`),n({message:"Download failed"})}else Pn.includes(l)?n({message:"Download failed"}):setTimeout(()=>{ke(e,t,r,n)},1e3)})}const bn=({itemListType:e,queryParams:t,onSuccess:r,onError:n=({message:f,error:l})=>console.error(`${f}
|
|
3
|
+
${l}`),onGetFile:s=ke,onCreateList:o=Tn,onList:u=An,onGetStorage:i=yn})=>({onDownload:()=>i().then(l=>Promise.all([o(e).then(c=>u(c,l,t)).then(r()).then(c=>s(c,l,t,n))]))});function Gn(e,t,r,n,s,o,u,i){const f=r[0].fields.map(d=>d),[l,c]=a.useState(n),E=(d,p,m,T)=>{const{value:P}=d.target,A=n.map(b=>b).map((b,v)=>m===v?{...p,[T]:P}:b);s(A),c(A)},h=async(d,p)=>{const m=z.createMetadataType(d),{timespan:T}=m,P=[];T.forEach((v,R)=>{const N={field:[],name:"V3_sport_Team",mode:"add"};v.field.forEach(I=>{N.field.push(I)}),p.includes(R)&&P.push(N)});const y={timespan:[{start:"-INF",end:"+INF",field:[],group:P}]},A=[...new Set(p)],b=[];A.forEach(v=>{const R=t.itemType.metadata.timespan[0].group.find((N,I)=>v===I);b.push(R.uuid)});try{await b.forEach(v=>setTimeout(C.metadata.removeMetadata({metadataUuid:v}),500)),await C.item.updateItemMetadata({itemId:e,metadataDocument:y}),await o(),s(l),u()}catch(v){i(v)}};return Q(()=>{s(t.group)},[t]),{tableColumns:f,onChange:E,onSubmit:h}}function qe({entity:e,entityId:t,queryParams:r={},refreshOnMount:n=!0}){const{request:s,data:o={},isLoading:u,isError:i}=j(C.metadata.getEntityMetadata),f=()=>s({entity:e,entityId:t,queryParams:r});return Q(()=>{n&&f()},[e,t,r]),{metadataType:o,isLoading:u,isError:i,onRefresh:f}}function $e({groupName:e,queryParams:t={},refreshOnMount:r=!0}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.fieldgroup.getFieldGroup),i=()=>n({groupName:e,queryParams:t});return Q(()=>{r&&i()},[e,t]),{metadataFieldGroupType:s,isLoading:o,isError:u,onRefresh:i}}function vn({itemType:e,collectionType:t,metadataType:r,joinValue:n=",",flat:s=!0,groupAsList:o=!0,children:u,...i}){let f=r;if(e||t){const h=e||t||{};f=h==null?void 0:h.metadata}const l=a.useMemo(()=>z.parseMetadataType(f,{joinValue:n,flat:s,groupAsList:o}),[s,o,n,f]),c={...i,...l,itemType:e},E=h=>a.cloneElement(h,c);return a.Children.map(u,E)}function Nn({itemSearchDocument:e,queryParams:t,matrixParams:r,responseRef:n,initialState:s,children:o}){const{request:u,data:i={},isLoading:f,isError:l}=j(C.collection.searchCollection,s,n),c=()=>u({itemSearchDocument:e,queryParams:t,matrixParams:r});Q(()=>{c()},[e,t,r]);const E={itemSearchDocument:e,matrixParams:r,queryParams:t,collectionListType:i,onRefresh:c,isLoading:f,isError:l},h=d=>a.cloneElement(d,E);return a.Children.map(o,h)}function _n({itemSearchDocument:e,queryParams:t,matrixParams:r,children:n}){const{itemListType:s,onRefresh:o,isLoading:u,isError:i}=Me({itemSearchDocument:e,queryParams:t,matrixParams:r}),f={itemSearchDocument:e,matrixParams:r,queryParams:t,itemListType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function In({itemSearchDocument:e,queryParams:t,matrixParams:r,children:n}){const{request:s,data:o={},isLoading:u,isError:i}=j(C.search.searchItemCollection),f=()=>s({itemSearchDocument:e,queryParams:t,matrixParams:r});Q(()=>{f()},[e,t,r]);const l={itemSearchDocument:e,matrixParams:r,queryParams:t,searchResultType:o,onRefresh:f,isLoading:u,isError:i},c=E=>a.cloneElement(E,l);return a.Children.map(n,c)}function Hn({itemId:e,queryParams:t,refreshOnMount:r,children:n}){const{itemType:s,onRefresh:o,isLoading:u,isError:i}=Ue({itemId:e,queryParams:t,refreshOnMount:r}),f={itemId:e,queryParams:t,itemType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function wn({collectionId:e,queryParams:t,refreshOnMount:r,children:n}){const{collectionType:s,onRefresh:o,isLoading:u,isError:i}=Le({collectionId:e,queryParams:t,refreshOnMount:r}),f={collectionId:e,queryParams:t,collectionType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}function On({matrixParams:e,queryParams:t,children:r}){const{request:n,data:s={},isLoading:o,isError:u}=j(C.job.listJob),i=()=>n({matrixParams:e,queryParams:t});Q(()=>{i()},[e,t]);const f={matrixParams:e,queryParams:t,onRefresh:i,isLoading:o,isError:u,jobs:s},l=c=>a.cloneElement(c,f);return a.Children.map(r,l)}function Dn({entityId:e,entityType:t,queryParams:r,children:n}){const{request:s,data:o={},isLoading:u}=j(C.access.listEntityAccess),i=()=>s({entityId:e,entityType:t,queryParams:r});a.useEffect(()=>{i()},[e,t,r]);const f={entityId:e,entityType:t,queryParams:r,accessControlList:o,onRefresh:i,isLoading:u},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}class he extends a.Component{constructor(t){super(t);const{serverUrl:r,token:n,username:s,password:o,runAs:u}=t;r&&(C.utils.defaultClient.defaults.baseURL=r),n?C.utils.defaultClient.defaults.headers.Authorization=`token ${n}`:C.utils.defaultClient.defaults.auth={username:s,password:o},u&&(C.utils.defaultClient.defaults.headers.RunAs=u)}componentDidUpdate(t){const{serverUrl:r,token:n,username:s,password:o,runAs:u}=this.props;t.serverUrl!==r&&(r?C.utils.defaultClient.defaults.baseURL=r:delete C.utils.defaultClient.defaults.baseURL),t.token!==n&&(n?C.utils.defaultClient.defaults.headers.Authorization=`token ${n}`:delete C.utils.defaultClient.defaults.headers.Authorization),!n&&(t.username!==s||t.password!==o)&&(C.utils.defaultClient.defaults.auth={username:s,password:o}),t.runAs!==u&&(u?C.utils.defaultClient.defaults.headers.RunAs=u:delete C.utils.defaultClient.defaults.headers.RunAs)}render(){const{children:t,username:r,serverUrl:n}=this.props,s={username:r,serverUrl:n},o=u=>a.cloneElement(u,s);return a.Children.map(t,o)}}const ae="VIDISPINE-TOKEN",ue="VIDISPINE-USERNAME",ie="VIDISPINE-SERVER-URL",ce="VIDISPINE-REMEMBER-ME",Mn=({userName:e,password:t,serverUrl:r})=>{r&&(C.utils.defaultClient.defaults.baseURL=r);const n={seconds:2592e3,autoRefresh:"true"},s={password:t,username:e};try{C.user.getToken({queryParams:n,headers:s}).then(({data:o})=>o).catch(({response:o={},message:u="Unknown error."})=>{let i=u;throw o.status===401&&(i="Incorrect Username/Password"),i})}catch{throw"Incorrect Username/Password"}};function Ln({LoginComponent:e,LoginProps:t={},AppComponent:r,AppProps:n={},onGetToken:s=Mn,onSuccess:o,onError:u,cookieOptions:i={maxAge:604800,path:"/"},...f}){const[l,c,E]=_e.useCookies([ae,ue,ie,ce]),{[ae]:h,[ue]:d,[ie]:p}=l,m=l[ce]==="true",T=y=>{let A;try{s(y).then(b=>{const{userName:v,serverUrl:R,rememberMe:N}=y;v&&c(ue,v,i),R&&c(ie,R,i),N&&c(ce,N,i),b&&c(ae,b,i),o&&o(y)}).catch(b=>{if(A=b,u)return u(A);throw A})}catch(b){if(A=b,u)return u(A)}return A},P=()=>{E(ae,i),m||(E(ue,i),E(ie,i),E(ce,i))};return h?V.jsx(he,{token:h,username:d,serverUrl:p,children:V.jsx(r,{onLogout:P,...f,...n})}):V.jsx(e,{onLogin:T,userName:d,serverUrl:p,rememberMe:m,...f,...t})}function Un({error:e,info:t}){return V.jsxs("div",{style:{height:"100%",maxHeight:"100vh",width:"100%",maxWidth:"100vw",backgroundColor:"red",color:"white"},children:[e&&V.jsx("div",{children:e.toString()}),t&&V.jsx("div",{children:t.componentStack})]})}class je extends a.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{error:t,hasError:!0}}shouldComponentUpdate(t,r){const{hasError:n,info:s}=this.state,{info:o}=r;return!(s===o&&n===!0)}componentDidCatch(t,r){const{onError:n}=this.props;if(typeof n=="function")try{n(t,r)}catch{return}this.setState({info:r})}render(){const{children:t}=this.props,{hasError:r,error:n,info:s}=this.state;return r?V.jsx(Un,{info:s,error:n}):t}}function Fn({groupName:e,queryParams:t,refreshOnMount:r,children:n}){const{metadataFieldGroupType:s,onRefresh:o,isLoading:u,isError:i}=$e({groupName:e,queryParams:t,refreshOnMount:r}),f={groupName:e,queryParams:t,metadataFieldGroupType:s,onRefresh:o,isLoading:u,isError:i},l=c=>a.cloneElement(c,f);return a.Children.map(n,l)}const xe=a.createContext();function kn({intialState:e={},onRefresh:t,userName:r,children:n}){const[s,o]=a.useState(e),u=()=>{if(r)C.user.getUserRole({userName:r}).then(({data:i})=>{o(i),t&&t(i)});else{let i;C.user.whoAmI().then(({data:f})=>(i=f,C.user.getUserRole({userName:f}))).then(({data:f})=>{o(f),t&&t(f,i)})}};return a.useEffect(u,[r]),V.jsx(xe.Provider,{value:s,children:n})}function We(){const e=a.useContext(xe);if(e===void 0)throw new Error("useRoles must be used within RolesContext");return{hasRole:r=>{if(r===void 0)throw new Error("roleName is undefined");const{group:n}=e;if(!Array.isArray(n))return null;const s=n.map(({groupName:o})=>o);return s.includes(z.ROLE_NAMES.SUPER_ACCESS_USER)?!0:Array.isArray(r)?r.findIndex(o=>s.includes(o))>-1:s.includes(r)},groupListType:e}}function qn({roleName:e,allow:t,deny:r,loading:n}){if(e===void 0)throw new Error("roleName is undefined");const{hasRole:s}=We(),o=s(e);return a.isValidElement(t)&&o===!0?t:a.isValidElement(r)&&o===!1?r:a.isValidElement(n)&&o===null?n:null}function $n({providers:e=[],children:t,...r}){return e.reduceRight((n,s)=>{if(typeof s=="function")return V.jsx(s,{...r,children:n});const{provider:o,...u}=s;return V.jsx(o,{...r,...u,children:n})},t)}function jn({entity:e,entityId:t,queryParams:r,refreshOnMount:n,children:s}){const{metadataType:o,onRefresh:u,isLoading:i,isError:f}=qe({entity:e,entityId:t,queryParams:r,refreshOnMount:n}),l={entity:e,entityId:t,queryParams:r,metadataType:o,onRefresh:u,isLoading:i,isError:f};e==="collection"?l.collectionId=t:e==="item"&&(l.itemId=t);const c=E=>a.cloneElement(E,l);return a.Children.map(s,c)}const xn=(e,t={})=>r=>V.jsx(je,{...t,children:V.jsx(e,{...r})}),Wn=(...e)=>e.reduce((t,r)=>(...n)=>t(r(...n)),t=>t),Ve=a.createContext(),Vn=(e,{entityId:t,entityType:r,entityTimespan:{start:n,end:s,field:[{name:o}={}]=[]}={}})=>{const u=e.some(f=>f.entity.id===t&&f.entityType===r);let i=!1;return u&&e.filter(l=>l.entity.id===t&&l.entityType===r).forEach(({entityTimespan:{start:l,end:c,field:[{name:E}={}]=[]}={}})=>{n===l&&s===c&&o===E&&(i=!0)}),!u||!i};function Yn({onChange:e,children:t,initialState:r=[],allowDuplicates:n=!1,isUniqueBinItem:s=Vn}){const[o,u]=a.useState(r),[i,f]=a.useState(n),l=a.useCallback(m=>{if(!m||!["string","number"].includes(typeof m)){console.error("BinProvider onDelete called without a binId of the entity to delete");return}u(T=>{const P=T.filter(y=>y.binId!==m);return e&&e(P),P})},[e]),c=a.useCallback(()=>{u([]),e&&e([])},[e]),E=m=>{const[T]=we().split("-");return{binId:T,...m}},h=a.useCallback(({dragInfo:m={}}={})=>{const{entityId:T,entityType:P,entity:y}=m;if(!T||!P||!y)throw new Error("Dragged element needs to have entityId, entityType and entity props");u((A=[])=>{if(s(A,m)||i){const b=[...A,E(m)];return e&&e(b),b}return A})},[i,s,e]),d=a.useCallback(({dragId:m,hoverId:T,originalDragIndex:P})=>{m===void 0||T===void 0&&P===void 0||u(y=>{const A=[...y],b=o.findIndex(N=>N.binId===m),v=o.findIndex(N=>N.binId===T),R=v>-1?v:P;return[A[R],A[b]]=[A[b],A[R]],e&&e(A),A})},[o,e]),p=a.useMemo(()=>({setBin:u,bin:o,allowDuplicates:i,setAllowDuplicates:f,onDrop:h,onSort:d,onFind:()=>null,onEmptyBin:c,onDelete:l}),[i,o,h,d,l,c]);return V.jsx(Ve.Provider,{value:p,children:t})}function Bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}};/*
|
|
4
4
|
object-assign
|
|
5
5
|
(c) Sindre Sorhus
|
|
6
6
|
@license MIT
|
|
7
|
-
*/var pe,Ye;function
|
|
8
|
-
Valid keys: `+JSON.stringify(Object.keys(S),null," "));var X=J(D,F,_,L,w+"."+F,r);if(X)return X}return null}return T(G)}function Z(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(Z);if(S===null||i(S))return!0;var G=E(S);if(G){var M=G.call(S),O;if(G!==S.entries){for(;!(O=M.next()).done;)if(!Z(O.value))return!1}else for(;!(O=M.next()).done;){var _=O.value;if(_&&!Z(_[1]))return!1}}else return!1;return!0;default:return!1}}function
|
|
7
|
+
*/var pe,Ye;function Qn(){if(Ye)return pe;Ye=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function s(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var u={},i=0;i<10;i++)u["_"+String.fromCharCode(i)]=i;var f=Object.getOwnPropertyNames(u).map(function(c){return u[c]});if(f.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(c){l[c]=c}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return pe=s()?Object.assign:function(o,u){for(var i,f=n(o),l,c=1;c<arguments.length;c++){i=Object(arguments[c]);for(var E in i)t.call(i,E)&&(f[E]=i[E]);if(e){l=e(i);for(var h=0;h<l.length;h++)r.call(i,l[h])&&(f[l[h]]=i[l[h]])}}return f},pe}var Ce,Be;function ge(){if(Be)return Ce;Be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ce=e,Ce}var Se,Qe;function Xe(){return Qe||(Qe=1,Se=Function.call.bind(Object.prototype.hasOwnProperty)),Se}var ye,Je;function Xn(){if(Je)return ye;Je=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ge(),r={},n=Xe();e=function(o){var u="Warning: "+o;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function s(o,u,i,f,l){if(process.env.NODE_ENV!=="production"){for(var c in o)if(n(o,c)){var E;try{if(typeof o[c]!="function"){var h=Error((f||"React class")+": "+i+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}E=o[c](u,c,f,i,null,t)}catch(p){E=p}if(E&&!(E instanceof Error)&&e((f||"React class")+": type specification of "+i+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof E+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),E instanceof Error&&!(E.message in r)){r[E.message]=!0;var d=l?l():"";e("Failed "+i+" type: "+E.message+(d??""))}}}}return s.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},ye=s,ye}var Te,ze;function Jn(){if(ze)return Te;ze=1;var e=Ie,t=Qn(),r=ge(),n=Xe(),s=Xn(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(i){var f="Warning: "+i;typeof console<"u"&&console.error(f);try{throw new Error(f)}catch{}});function u(){return null}return Te=function(i,f){var l=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function E(S){var G=S&&(l&&S[l]||S[c]);if(typeof G=="function")return G}var h="<<anonymous>>",d={array:P("array"),bigint:P("bigint"),bool:P("boolean"),func:P("function"),number:P("number"),object:P("object"),string:P("string"),symbol:P("symbol"),any:y(),arrayOf:A,element:b(),elementType:v(),instanceOf:R,node:x(),objectOf:I,oneOf:N,oneOfType:H,shape:B,exact:K};function p(S,G){return S===G?S!==0||1/S===1/G:S!==S&&G!==G}function m(S,G){this.message=S,this.data=G&&typeof G=="object"?G:{},this.stack=""}m.prototype=Error.prototype;function T(S){if(process.env.NODE_ENV!=="production")var G={},M=0;function O(L,w,D,U,q,F,J){if(U=U||h,F=F||D,J!==r){if(f){var X=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var re=U+":"+D;!G[re]&&M<3&&(o("You are manually calling a React.PropTypes validation function for the `"+F+"` prop on `"+U+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),G[re]=!0,M++)}}return w[D]==null?L?w[D]===null?new m("The "+q+" `"+F+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new m("The "+q+" `"+F+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:S(w,D,U,q,F)}var _=O.bind(null,!1);return _.isRequired=O.bind(null,!0),_}function P(S){function G(M,O,_,L,w,D){var U=M[O],q=te(U);if(q!==S){var F=oe(U);return new m("Invalid "+L+" `"+w+"` of type "+("`"+F+"` supplied to `"+_+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return T(G)}function y(){return T(u)}function A(S){function G(M,O,_,L,w){if(typeof S!="function")return new m("Property `"+w+"` of component `"+_+"` has invalid PropType notation inside arrayOf.");var D=M[O];if(!Array.isArray(D)){var U=te(D);return new m("Invalid "+L+" `"+w+"` of type "+("`"+U+"` supplied to `"+_+"`, expected an array."))}for(var q=0;q<D.length;q++){var F=S(D,q,_,L,w+"["+q+"]",r);if(F instanceof Error)return F}return null}return T(G)}function b(){function S(G,M,O,_,L){var w=G[M];if(!i(w)){var D=te(w);return new m("Invalid "+_+" `"+L+"` of type "+("`"+D+"` supplied to `"+O+"`, expected a single ReactElement."))}return null}return T(S)}function v(){function S(G,M,O,_,L){var w=G[M];if(!e.isValidElementType(w)){var D=te(w);return new m("Invalid "+_+" `"+L+"` of type "+("`"+D+"` supplied to `"+O+"`, expected a single ReactElement type."))}return null}return T(S)}function R(S){function G(M,O,_,L,w){if(!(M[O]instanceof S)){var D=S.name||h,U=mr(M[O]);return new m("Invalid "+L+" `"+w+"` of type "+("`"+U+"` supplied to `"+_+"`, expected ")+("instance of `"+D+"`."))}return null}return T(G)}function N(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),u;function G(M,O,_,L,w){for(var D=M[O],U=0;U<S.length;U++)if(p(D,S[U]))return null;var q=JSON.stringify(S,function(J,X){var re=oe(X);return re==="symbol"?String(X):X});return new m("Invalid "+L+" `"+w+"` of value `"+String(D)+"` "+("supplied to `"+_+"`, expected one of "+q+"."))}return T(G)}function I(S){function G(M,O,_,L,w){if(typeof S!="function")return new m("Property `"+w+"` of component `"+_+"` has invalid PropType notation inside objectOf.");var D=M[O],U=te(D);if(U!=="object")return new m("Invalid "+L+" `"+w+"` of type "+("`"+U+"` supplied to `"+_+"`, expected an object."));for(var q in D)if(n(D,q)){var F=S(D,q,_,L,w+"."+q,r);if(F instanceof Error)return F}return null}return T(G)}function H(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var G=0;G<S.length;G++){var M=S[G];if(typeof M!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+dr(M)+" at index "+G+"."),u}function O(_,L,w,D,U){for(var q=[],F=0;F<S.length;F++){var J=S[F],X=J(_,L,w,D,U,r);if(X==null)return null;X.data&&n(X.data,"expectedType")&&q.push(X.data.expectedType)}var re=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new m("Invalid "+D+" `"+U+"` supplied to "+("`"+w+"`"+re+"."))}return T(O)}function x(){function S(G,M,O,_,L){return Z(G[M])?null:new m("Invalid "+_+" `"+L+"` supplied to "+("`"+O+"`, expected a ReactNode."))}return T(S)}function W(S,G,M,O,_){return new m((S||"React class")+": "+G+" type `"+M+"."+O+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+_+"`.")}function B(S){function G(M,O,_,L,w){var D=M[O],U=te(D);if(U!=="object")return new m("Invalid "+L+" `"+w+"` of type `"+U+"` "+("supplied to `"+_+"`, expected `object`."));for(var q in S){var F=S[q];if(typeof F!="function")return W(_,L,w,q,oe(F));var J=F(D,q,_,L,w+"."+q,r);if(J)return J}return null}return T(G)}function K(S){function G(M,O,_,L,w){var D=M[O],U=te(D);if(U!=="object")return new m("Invalid "+L+" `"+w+"` of type `"+U+"` "+("supplied to `"+_+"`, expected `object`."));var q=t({},M[O],S);for(var F in q){var J=S[F];if(n(S,F)&&typeof J!="function")return W(_,L,w,F,oe(J));if(!J)return new m("Invalid "+L+" `"+w+"` key `"+F+"` supplied to `"+_+"`.\nBad object: "+JSON.stringify(M[O],null," ")+`
|
|
8
|
+
Valid keys: `+JSON.stringify(Object.keys(S),null," "));var X=J(D,F,_,L,w+"."+F,r);if(X)return X}return null}return T(G)}function Z(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(Z);if(S===null||i(S))return!0;var G=E(S);if(G){var M=G.call(S),O;if(G!==S.entries){for(;!(O=M.next()).done;)if(!Z(O.value))return!1}else for(;!(O=M.next()).done;){var _=O.value;if(_&&!Z(_[1]))return!1}}else return!1;return!0;default:return!1}}function fr(S,G){return S==="symbol"?!0:G?G["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&G instanceof Symbol:!1}function te(S){var G=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":fr(G,S)?"symbol":G}function oe(S){if(typeof S>"u"||S===null)return""+S;var G=te(S);if(G==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return G}function dr(S){var G=oe(S);switch(G){case"array":case"object":return"an "+G;case"boolean":case"date":case"regexp":return"a "+G;default:return G}}function mr(S){return!S.constructor||!S.constructor.name?h:S.constructor.name}return d.checkPropTypes=s,d.resetWarningCache=s.resetWarningCache,d.PropTypes=d,d},Te}var Ae,Ke;function zn(){if(Ke)return Ae;Ke=1;var e=ge();function t(){}function r(){}return r.resetWarningCache=t,Ae=function(){function n(u,i,f,l,c,E){if(E!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}n.isRequired=n;function s(){return n}var o={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:s,element:n,elementType:n,instanceOf:s,node:n,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:t};return o.PropTypes=o,o},Ae}if(process.env.NODE_ENV!=="production"){var Kn=Ie,Zn=!0;Ee.exports=Jn()(Kn.isElement,Zn)}else Ee.exports=zn()();var er=Ee.exports;const $=Bn(er),Ze=a.createContext(),et=a.createContext(),Re="UPDATE_ALL_SETTINGS",tt="UPDATE_SETTING",nt="UPDATE_USERNAME",rt="REMOVE_SETTING",tr=(e,t)=>{switch(t.type){case nt:return{...e,userName:t.userName};case Re:return{...e,settings:t.settings};case tt:{const r={...e.settings,...t.setting};return{...e,settings:r}}case rt:{const r={...e.settings};return delete r[t.key],{...e,settings:r}}default:return e}};function Pe({userName:e,settingsKey:t,children:r,initialSettings:n,onChange:s,getSettingsApi:o,updateSettingsApi:u}){const[i,f]=a.useReducer(tr,{settings:n,userName:e}),l=a.useRef();return a.useEffect(()=>{const{userName:c}=i;!o||!c||o({entityType:"user",entityId:c,key:t}).then(({data:E})=>{f({type:Re,settings:E,userName:c,settingsKey:t}),l.current=JSON.stringify(E)}).catch(E=>{const{response:h}=E;if(h.status!==404)throw new Error(E)})},[i.userName]),a.useEffect(()=>{s&&s(i.settings);const{userName:c}=i;if(!u||!c)return;const E=JSON.stringify(i.settings),h=l.current;!h||E===h||(u({entityType:"user",entityId:c,key:t,value:E}),l.current=E)},[i.settings]),V.jsx(et.Provider,{value:i,children:V.jsx(Ze.Provider,{value:f,children:r})})}const nr=()=>{const e=a.useContext(et);if(!e)throw new Error("useSettingsState must be used within SettingsStateContext");return e},rr=()=>{const e=a.useContext(Ze);if(!e)throw new Error("useSettingsDispatch must be used within SettingsDispatchContext");return e},st=()=>{const e=rr(),t=a.useCallback(o=>e({type:Re,settings:o}),[]),r=a.useCallback(o=>e({type:tt,setting:o}),[]),n=a.useCallback(o=>e({type:nt,userName:o}),[]),s=a.useCallback(o=>e({type:rt,key:o}),[]);return{updateAllSettings:t,updateSetting:r,updateUsername:n,removeSetting:s}},sr=()=>{const{settings:e={}}=nr();return{...st(),settings:e}};Pe.propTypes={userName:$.string,settingsKey:$.string,children:$.objectOf($.any),initialSettings:$.objectOf($.any),onChange:$.func,getSettingsApi:$.func,updateSettingsApi:$.func},Pe.defaultProps={userName:void 0,settingsKey:void 0,children:null,initialSettings:{},onChange:null,getSettingsApi:C.metadata.getSimpleMetadataKey,updateSettingsApi:C.metadata.updateSimpleMetadataKey};const le="VIDISPINE-TOKEN",se="VIDISPINE-USERNAME",fe="VIDISPINE-SERVER-URL",de="VIDISPINE-REMEMBER-ME",or="Incorrect username or password",ot="Offline or CORS not configured",at="Session expired",ar="VIDISPINE_URL mismatch",ut=e=>{try{return C.noauth.getSelfTest({baseURL:e}).then(()=>or).catch(()=>ot)}catch{return Promise.resolve(ot)}},ur=({maxAge:e=60,userName:t,password:r,serverUrl:n})=>{try{return C.user.getToken({queryParams:{seconds:e,autoRefresh:"true"},headers:{password:r,username:t},baseURL:n}).then(({data:s})=>s).catch(()=>ut(n).then(s=>{throw Error(s)}))}catch{return ut(n).then(o=>{throw Error(o)})}},be=a.createContext({serverUrl:null,token:null,userType:null,userName:null,onLogin:()=>null,onLogout:()=>null});function Ge({cookieOptions:e,LoginComponent:t,LoginProps:r,onGetToken:n,onSuccess:s,onError:o,serverUrl:u,userName:i,token:f,children:l}){const{data:c,request:E}=j(C.user.getUser),[h,d,p]=_e.useCookies([le,se,fe,de]),{[le]:m=f,[se]:T=i,[fe]:P=u}=h,y=h[de]==="true",{maxAge:A}=e,b=a.useCallback(H=>{let x;try{return n({maxAge:A,...H}).then(W=>{const{userName:B,serverUrl:K,rememberMe:Z}=H;B&&d(se,B,e),K&&d(fe,K,e),Z&&d(de,Z,e),W&&d(le,W,e),E({userName:B}),s&&s(H)}).catch(W=>{x=W,o&&o(x)})}catch(W){x=W,o&&o(x)}return x},[e,A,o,n,s,E,d]),v=a.useCallback(()=>{p(le,e),y||(p(se,e),p(fe,e),p(de,e))},[e,y,p]),R=a.useRef(),N=a.useRef();a.useEffect(()=>(m&&(R.current&&C.utils.defaultClient.interceptors.response.eject(R.current),R.current=C.utils.defaultClient.interceptors.response.use(H=>H,H=>{if(H.response)H.response.status===401&&(v(),o&&o(Error(at)));else{const{config:{baseURL:x}={}}=H;N.current!==!0&&(N.current=!0,C.noauth.getSelfTest({baseURL:x}).then(()=>{N.current=void 0,v(),o&&o(Error(at))}).catch(()=>(N.current=void 0,null)))}return Promise.reject(H)})),()=>{R.current&&C.utils.defaultClient.interceptors.response.eject(R.current)}),[v,o,m]),a.useEffect(()=>{m&&T===void 0&&C.user.whoAmI().then(({data:H})=>d(se,H,e))},[T,m]),a.useEffect(()=>{m&&P&&u&&P!==u&&(v(),o&&o(Error(ar)))},[m,P,u,v,o]);const I=a.useMemo(()=>({serverUrl:P,token:m,userType:c,userName:T,onLogin:b,onLogout:v}),[b,v,P,m,T,c]);return m?V.jsx(he,{token:m,username:T,serverUrl:P,children:V.jsx(be.Provider,{value:I,children:l})}):V.jsx(t,{onLogin:b,userName:T,serverUrl:P,rememberMe:y,...r})}Ge.propTypes={cookieOptions:$.shape({maxAge:$.number,path:$.string}),LoginComponent:$.elementType.isRequired,LoginProps:$.objectOf($.any),onGetToken:$.func,children:$.oneOfType([$.arrayOf($.element),$.element]),onSuccess:$.func,onError:$.func,serverUrl:$.string.isRequired,userName:$.string,token:$.string},Ge.defaultProps={cookieOptions:{maxAge:604800,path:"/"},LoginProps:{},onGetToken:ur,children:null,onSuccess:null,onError:null,userName:null,token:null};const ir=()=>{const e=a.useContext(be);if(e===void 0)throw new Error("useAuth must be used within an AuthContext");return e},it=({entityId:e,entityType:t,collectionId:r,rootParentId:n,onError:s})=>{if(r&&r!==n)try{return C.collection.addCollectionEntity({collectionId:r,entityId:e,queryParams:{type:t.toLowerCase()}})}catch(o){s({message:`Could not add ${e} to collection ${r}`,error:o})}},ct=({entityId:e,entityType:t,collectionId:r,rootParentId:n,onError:s})=>{if(r&&r!==n)try{return C.collection.removeCollectionEntity({collectionId:r,entityId:e,queryParams:{type:t.toLowerCase()}})}catch(o){s({message:`Could not remove ${e} from collection ${r}`,error:o})}},cr=({entityId:e,entityType:t,addToCollectionId:r,removeFromCollectionId:n,rootParentId:s,onAddEntity:o=it,onRemoveEntity:u=ct,onMoved:i=()=>null,onAdded:f=()=>null,onRemoved:l=()=>null,onError:c=({message:E,error:h})=>console.error(`${E}
|
|
9
9
|
${h}`)})=>{if(!r){c({message:"Missing the collection id to add entity to",error:""});return}if(!n){c({message:"Missing the collection id to remove entity from",error:""});return}try{const E=o({entityId:e,entityType:t,rootParentId:s,collectionId:r,onError:c}),h=u({entityId:e,entityType:t,rootParentId:s,collectionId:n,onError:c}),d=[E,h].filter(p=>p!==void 0);Promise.allSettled(d).then(p=>{const m=p.filter(A=>A.status!=="fulfilled"),T=m.length===0,P=m.length===d.length,y=m.length===1;if(T)i(),f(),l();else if(P)c({message:`Could not move ${e} from ${n} to ${r}`,error:m.map(A=>A.reason).join(`
|
|
10
|
-
`)});else if(y){const A=m[0].reason.config.method,b=A==="delete",v=A==="put";c({message:b?`Could not remove ${e} from collection ${n}`:`Could not add ${e} to collection ${r}`,error:m[0].reason});let R;b?R=u({entityId:e,entityType:t,collectionId:r,onError:c}):v&&(R=o({entityId:e,entityType:t,collectionId:n,onError:c})),R&&R.then(()=>{console.info(`Rollbacked moving ${e} from ${n} to ${r}`)}).catch(N=>{c({message:"Could not rollback after moving entity",error:N})})}}).catch(p=>{c({message:`Could not add ${e} to collection ${r}`,error:p})})}catch(E){c({message:`Could not move ${e} from ${n} to collection ${r}`,error:E})}};function
|
|
10
|
+
`)});else if(y){const A=m[0].reason.config.method,b=A==="delete",v=A==="put";c({message:b?`Could not remove ${e} from collection ${n}`:`Could not add ${e} to collection ${r}`,error:m[0].reason});let R;b?R=u({entityId:e,entityType:t,collectionId:r,onError:c}):v&&(R=o({entityId:e,entityType:t,collectionId:n,onError:c})),R&&R.then(()=>{console.info(`Rollbacked moving ${e} from ${n} to ${r}`)}).catch(N=>{c({message:"Could not rollback after moving entity",error:N})})}}).catch(p=>{c({message:`Could not add ${e} to collection ${r}`,error:p})})}catch(E){c({message:`Could not move ${e} from ${n} to collection ${r}`,error:E})}};function lr({children:e,setDrag:t,onDrop:r,onDragEnter:n,onDragOver:s,onDragLeave:o,style:u}){const[i,f]=a.useState(0),l=d=>{d.preventDefault(),d.stopPropagation(),t(!1),r&&r(d)},c=d=>{d.preventDefault(),d.stopPropagation(),f(i+1),i===0&&t(!0),n&&n(d)},E=d=>{d.preventDefault(),d.stopPropagation(),s&&s(d)},h=d=>{d.preventDefault(),d.stopPropagation(),f(i-1),i===1&&t(!1),o&&o(d)};return V.jsx("div",{onDragEnter:d=>c(d),onDragOver:d=>E(d),onDrop:d=>l(d),onDragLeave:d=>h(d),style:u,children:e})}g.Auth=Ln,g.AuthContext=be,g.AuthProvider=Ge,g.BinContext=Ve,g.BinProvider=Yn,g.ComposeProviders=$n,g.DropArea=lr,g.ErrorBoundary=je,g.GetCollection=wn,g.GetEntityMetadata=jn,g.GetFieldGroup=Fn,g.GetItem=Hn,g.GetJobs=On,g.HasRole=qn,g.ListEntityAccess=Dn,g.MetadataType=vn,g.RolesProvider=kn,g.SearchCollection=Nn,g.SearchItem=_n,g.SearchItemCollection=In,g.SettingsProvider=Pe,g.VidispineApi=he,g.compose=Wn,g.handleAddEntity=it,g.handleMoveEntity=cr,g.handleRemoveEntity=ct,g.useAddMetadataFieldAttributes=Vt,g.useApi=j,g.useAuthContext=ir,g.useAutocomplete=Et,g.useCollectionAutoPlay=dn,g.useCompoundMetadata=Gn,g.useCsvDownload=bn,g.useDocSearchAutocomplete=En,g.useEntityAccess=$t,g.useGetCollection=Le,g.useGetCollectionItem=Zt,g.useGetEntity=en,g.useGetEntityMetadata=qe,g.useGetFieldGroup=$e,g.useGetFieldMetadataDataset=pn,g.useGetItem=Ue,g.useGetSavedSearchFolders=gn,g.useGroup=fn,g.useHoverScrub=hn,g.useInterval=gt,g.useJobSearch=At,g.useListGroup=on,g.useListUser=an,g.useLocalStorage=Rt,g.useMouseDownPosition=Kt,g.useQueryInitialState=kt,g.useRepresentativeItems=Sn,g.useRoles=We,g.useSavedSearch=zt,g.useSearch=He,g.useSearchGroup=ln,g.useSearchItem=Me,g.useSearchUser=sn,g.useSelected=pt,g.useSettings=sr,g.useSettingsActions=st,g.useTab=Ct,g.useThumbnailScrub=St,g.useUpdateEffect=me,g.useUpdateQueryState=qt,g.useUploadFiles=Ft,g.useUser=tn,g.withErrorBoundary=xn,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidispine/vdt-react",
|
|
3
|
-
"version": "23.4.0-pre.
|
|
3
|
+
"version": "23.4.0-pre.3",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org"
|
|
7
8
|
},
|
|
8
9
|
"description": "React SDK for VidiCore",
|
|
9
10
|
"homepage": "https://vidispine.github.io/vdt/?path=/docs/vdt-react",
|
|
@@ -31,26 +32,26 @@
|
|
|
31
32
|
"format": "prettier . --check"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@vidispine/vdt-api": "23.4.0-pre.
|
|
35
|
-
"@vidispine/vdt-js": "23.4.0-pre.
|
|
35
|
+
"@vidispine/vdt-api": "23.4.0-pre.3",
|
|
36
|
+
"@vidispine/vdt-js": "23.4.0-pre.3",
|
|
36
37
|
"lodash.debounce": "^4.0.8",
|
|
37
38
|
"lz-string": "^1.5.0",
|
|
38
39
|
"react-cookie": "^4.1.1",
|
|
39
40
|
"use-deep-compare-effect": "^1.8.1"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"react": "^17.0.0"
|
|
43
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@vidispine/eslint-config-react": "23.4.0-pre.
|
|
46
|
-
"@vidispine/eslint-config-storybook": "23.4.0-pre.
|
|
47
|
-
"@vidispine/prettier-config": "23.4.0-pre.
|
|
48
|
-
"@vitejs/plugin-react": "
|
|
49
|
-
"axios-mock-adapter": "1.
|
|
50
|
-
"eslint": "8.
|
|
51
|
-
"prettier": "
|
|
46
|
+
"@vidispine/eslint-config-react": "23.4.0-pre.3",
|
|
47
|
+
"@vidispine/eslint-config-storybook": "23.4.0-pre.3",
|
|
48
|
+
"@vidispine/prettier-config": "23.4.0-pre.3",
|
|
49
|
+
"@vitejs/plugin-react": "4.2.1",
|
|
50
|
+
"axios-mock-adapter": "1.22.0",
|
|
51
|
+
"eslint": "8.55.0",
|
|
52
|
+
"prettier": "3.1.0",
|
|
52
53
|
"prop-types": "15.8.1",
|
|
53
|
-
"vite": "4.
|
|
54
|
+
"vite": "4.5.1"
|
|
54
55
|
},
|
|
55
56
|
"eslintConfig": {
|
|
56
57
|
"extends": [
|