(this["webpackJsonpnodiant-online"]=this["webpackJsonpnodiant-online"]||[]).push([[0],{10:function(e,t,a){"use strict";a.d(t,"b",(function(){return i})),a.d(t,"m",(function(){return r})),a.d(t,"g",(function(){return c})),a.d(t,"k",(function(){return s})),a.d(t,"n",(function(){return o})),a.d(t,"i",(function(){return l})),a.d(t,"l",(function(){return d})),a.d(t,"c",(function(){return u})),a.d(t,"d",(function(){return j})),a.d(t,"q",(function(){return b})),a.d(t,"r",(function(){return f})),a.d(t,"o",(function(){return h})),a.d(t,"p",(function(){return m})),a.d(t,"e",(function(){return O})),a.d(t,"h",(function(){return g})),a.d(t,"t",(function(){return y})),a.d(t,"j",(function(){return v})),a.d(t,"u",(function(){return k})),a.d(t,"f",(function(){return C})),a.d(t,"s",(function(){return w})),a.d(t,"a",(function(){return N}));var n=a(19),i="16404";function r(e){for(var t=[],a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=a.length,i=0;i<e;i++)t.push(a.charAt(Math.floor(Math.random()*n)));return t.join("")}function c(e){var t=e.reduce((function(e,t){return e+String.fromCharCode(t)}),"");return btoa(t).replace(/.{76}(?=.)/g,"$&\n")}function s(e){var t={};return e.forEach((function(e){""!==e&&(e.key?t[e.key]=!0:t[e]=!0)})),t}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Object(n.a)(Array(e).keys()).map((function(e){return e+t}))}function l(e,t,a,n){if(null===t&&(t=a.filter((function(t){return e.folder===t.key}))[0]),void 0===t)return[];var i=a.filter((function(e){return e.hub&&t.ancestors.includes(e.key)}));return i=i.filter((function(e){return e.managers.includes(n.key)||"System Digital Manager"===n.role||e.users.includes(n.key)})),t.hub&&i.push(t),i.toSorted((function(e,t){return e.ancestors.length-t.ancestors.length}))}function d(e){var t={};return e.forEach((function(e){""!==e&&(t[r(10)]=e)})),t}function u(e){var t="";return void 0===e||0===e.length||(e.forEach((function(e){t+=e,t+=", "})),t.length>1&&(t=t.slice(0,-2))),t}function j(e){var t="";return void 0===e||0===e.length||(e.forEach((function(e){t+=e.text,t+=", "})),t.length>1&&(t=t.slice(0,-2))),t}function b(e,t,a){if(e.owner===a.key)return!0;if(e.users.includes(a.key))return!0;for(var n=function(n){var i=e.groups[n],r=t.filter((function(e){return i===e.key}))[0];if(r&&r.users.filter((function(e){return e.key===a.key})).length>0)return{v:!0}},i=0;i<e.groups.length;i++){var r=n(i);if("object"===typeof r)return r.v}return!1}function f(e,t,a){if(e.owner===a.key)return!0;if(e.users.includes(a.key))return!0;for(var n=function(n){var i=e.groups[n],r=t.filter((function(e){return i===e.key}))[0];if(r&&r.users.filter((function(e){return e.key===a.key})).length>0)return{v:!0}},i=0;i<e.groups.length;i++){var r=n(i);if("object"===typeof r)return r.v}return!1}function h(e,t,a){if(e.uploadedBy&&e.uploadedBy===a.key)return!0;if(e.managers.includes(a.key)||"System Digital Manager"===a.role)return!0;if(a.files.includes(e.key))return!0;for(var n=function(n){var i=e.groups[n],r=t.filter((function(e){return i===e.key}))[0];if(r&&r.users.filter((function(e){return e.key===a.key})).length>0)return{v:!0}},i=0;i<e.groups.length;i++){var r=n(i);if("object"===typeof r)return r.v}return!1}function m(e,t,a){if(e.uploadedBy&&e.uploadedBy===a.key)return!0;if(a.files.includes(e.key))return!0;for(var n=function(n){var i=e.groups[n],r=t.filter((function(e){return i===e.key}))[0];if(r&&r.users.filter((function(e){return e.key===a.key})).length>0)return{v:!0}},i=0;i<e.groups.length;i++){var r=n(i);if("object"===typeof r)return r.v}return!1}function O(e,t){for(var a=0;a<t.length;a++){var n=t[a];if(n.key!==e.key){if(n.original&&n.original===e.key)return console.log("Has Duplicate 1"),!0;if(e.original&&n.key===e.original)return console.log("Has Duplicate 2"),!0;if(n.original&&e.original&&n.original===e.original)return console.log("Has Duplicate 3"),!0}}return console.log("No Duplicate"),!1}var p=[];function g(e,t,a){(p=[]).push({name:t.name,key:t.key,parent:t.parent}),x(t.key,a),p.reverse();var n="";return p.forEach((function(e){n+=e.name+"/"})),n+=e.displayName}function x(e,t){var a=t.filter((function(t){return t.key===e}))[0];if(a){var n=t.filter((function(e){return e.key===a.parent}))[0];n&&(p.push({name:n.name,key:n.key,parent:n.parent}),x(n.key,t))}}function y(e){var t=Math.floor(e);if(t<60)return t<10?"0:0"+t:"0:"+t;if(t>3600){var a=Math.floor(t/3600);t%=3600;var n=Math.floor(t/60),i=t%60;return a+":"+(n<10?"0"+n:n)+":"+(i<10?"0"+i:i)}var r=Math.floor(t/60),c=Math.floor(t%60);return r+":"+(c<10?"0"+c:c)}function v(e){return"string"==typeof e&&(!isNaN(e)&&!isNaN(parseFloat(e)))}function k(e){var t={boolean:{},number:{},string:{}},a=[];return e.filter((function(e){var n=typeof e;return n in t?!t[n].hasOwnProperty(e)&&(t[n][e]=!0):!(a.indexOf(e)>=0)&&a.push(e)}))}function C(e,t,a){var n=new Blob([e],{type:a}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",t),r.click()}function w(e){if(void 0!==e)return"true"===e.toLowerCase()||"false"!==e.toLowerCase()&&void 0}function N(e){if(void 0!==e)return!0===e?"true":!1===e?"false":void 0}},188:function(e,t,a){},194:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return C}));var n=a(2),i=a(1),r=a(552),c=a.n(r),s=a(94),o=a.n(s),l=a(18),d=a(8),u=a(20),j=a(320),b=a(389),f=a(1007),h=a(246),m=a(205),O=a(109),p=a.n(O),g=a(230),x=a.n(g),y=a(10),v=a(0),k=Object(j.a)((function(e){return{root:{width:300},chooseButton:{display:"flex",justifyContent:"center"},avatarRow:{margin:0},avatar:{height:200,width:200},avatarIcon:{fontSize:150}}}));function C(t){var a=k(),r=Object(i.useState)(null),s=Object(n.a)(r,2),j=s[0],O=s[1],g=Object(i.useState)(),C=Object(n.a)(g,2),w=C[0],N=C[1],S=Object(i.useState)(!1),E=Object(n.a)(S,2),T=E[0],F=E[1],B=Object(i.useState)(1),D=Object(n.a)(B,2),R=D[0],P=D[1];Object(i.useEffect)((function(){t.recipient&&(t.recipient.avatarEditor=w),t.recipient&&(t.recipient.avatar?O(t.recipient.avatar):o.a.get(t.recipient.imageURL,{responseType:"arraybuffer"}).then((function(a){var n=e.from(a.data,"base64"),i="data:image/png;base64,"+Object(y.g)(n);O(i),t.recipient.avatar=i})).catch((function(e){console.error(e)})))}),[t.path,t.recipient,w]);var A=function(e){var a=e.target.files;if(FileReader&&a&&a.length){var n=new FileReader;n.onload=function(){O(n.result),t.didChangeAvatar&&t.didChangeAvatar()},n.readAsDataURL(a[0]),F(!0)}};return Object(v.jsx)(l.a,{fluid:!0,className:a.root,children:Object(v.jsx)(u.a,{children:T?Object(v.jsxs)(v.Fragment,{children:[Object(v.jsxs)(h.a,{color:"primary",component:"label",className:a.chooseButton,children:["Choose File",Object(v.jsx)("input",{type:"file",hidden:!0,onChange:A})]}),Object(v.jsx)(d.a,{children:Object(v.jsx)(d.a,{className:a.avatarRow,children:Object(v.jsx)(c.a,{ref:function(e){return N(e)},width:300,height:300,image:j,scale:R,border:35,borderRadius:200})})}),Object(v.jsx)(d.a,{children:Object(v.jsx)(f.a,{value:R,onChange:function(e,t){P(t)},"aria-labelledby":"continuous-slider",min:0,max:3,step:.01})})," "]}):Object(v.jsxs)(v.Fragment,{children:[Object(v.jsx)("input",{accept:"image/*",id:"icon-button-photo",onChange:A,type:"file",hidden:!0}),Object(v.jsx)("label",{htmlFor:"icon-button-photo",children:Object(v.jsx)(b.a,{component:"span",children:Object(v.jsx)(m.a,{alt:"Profile Picture",className:a.avatar,src:j,children:"users"===t.path?Object(v.jsx)(x.a,{className:a.avatarIcon}):Object(v.jsx)(p.a,{className:a.avatarIcon})})})})]})})})}}).call(this,a(44).Buffer)},200:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return f}));var n=a(2),i=a(1),r=a(94),c=a.n(r),s=a(320),o=a(205),l=a(109),d=a.n(l),u=a(10),j=a(0),b=Object(s.a)((function(e){return{}}));function f(t){var a=b(t),r=Object(i.useState)(),s=Object(n.a)(r,2),l=s[0],f=s[1],h=Object(i.useState)(!1),m=Object(n.a)(h,2),O=m[0],p=m[1];return Object(i.useEffect)((function(){!function(){if(t.conversation){if(t.conversation.avatar)return f(t.conversation.avatar),void p(!0);console.log("Downloading Group Avatar from Firebase"),c.a.get(t.conversation.imageURL,{responseType:"arraybuffer"}).then((function(a){var n=e.from(a.data,"base64"),i="data:image/png;base64,"+Object(u.g)(n);f(i),t.conversation.avatar=i,p(!0)})).catch((function(e){console.error(e)}))}}()}),[t.conversation,l]),Object(j.jsx)("div",{children:O?Object(j.jsx)(o.a,{className:a.avatar,alt:"Profile Picture",src:l,variant:t.variant}):Object(j.jsx)(o.a,{className:a.avatar,alt:"Profile Picture",variant:t.variant,children:Object(j.jsx)(d.a,{})})})}}).call(this,a(44).Buffer)},32:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return m}));var n=a(2),i=a(1),r=a(94),c=a.n(r),s=a(320),o=a(205),l=a(230),d=a.n(l),u=a(109),j=a.n(u),b=a(10),f=a(0),h=Object(s.a)((function(e){return{avatar:{width:function(t){return"small"===t.size?e.spacing(3):"medium"===t.size?e.spacing(5):"large"===t.size?e.spacing(7):void 0},height:function(t){return"small"===t.size?e.spacing(3):"medium"===t.size?e.spacing(5):"large"===t.size?e.spacing(7):void 0}}}}));function m(t){var a=Object(i.useState)(),r=Object(n.a)(a,2),s=r[0],l=r[1],u=Object(i.useState)(""),m=Object(n.a)(u,2),O=m[0],p=m[1],g=h(t);return Object(i.useEffect)((function(){t.userOrHub&&(t.userOrHub.firstName?t.userOrHub.firstName[0]&&t.userOrHub.lastName[0]?p(t.userOrHub.firstName[0]+t.userOrHub.lastName[0]):t.userOrHub.firstName[0]?p(t.userOrHub.firstName[0]):t.userOrHub.lastName[0]&&p(t.userOrHub.lastName[0]):t.userOrHub.name&&t.userOrHub.name[0]&&p(t.userOrHub.name[0]),t.userOrHub.avatar?l(t.userOrHub.avatar):"none"!==t.userOrHub.imageURL&&""!==t.userOrHub.imageURL&&(console.log("Downloading Avatar from Firebase"),c.a.get(t.userOrHub.imageURL,{responseType:"arraybuffer"}).then((function(a){var n=e.from(a.data,"base64"),i="data:image/png;base64,"+Object(b.g)(n);l(i),t.userOrHub.avatar=i})).catch((function(e){console.error(e)}))))}),[t.userOrHub,t.path,s]),s?Object(f.jsx)(o.a,{className:g.avatar,alt:"Profile Picture",src:s,variant:t.variant,children:O}):""===O?Object(f.jsx)(o.a,{alt:"Profile Picture",className:g.avatar,src:s,children:t.userOrHub&&t.userOrHub.hub?Object(f.jsx)(j.a,{className:g.avatarIcon}):Object(f.jsx)(d.a,{className:g.avatarIcon})}):Object(f.jsx)(o.a,{className:g.avatar,children:O})}}).call(this,a(44).Buffer)},492:function(e,t){},5:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(135),i={apiKey:"AIzaSyA_GjxeB7UCwclsEiOx9OfN-K3T7gdc_0Y",authDomain:"nodiant-e20a8.firebaseapp.com",databaseURL:"https://nodiant-e20a8-default-rtdb.europe-west1.firebasedatabase.app",projectId:"nodiant-e20a8",storageBucket:"nodiant-e20a8.appspot.com",messagingSenderId:"412204354266",appId:"1:412204354266:web:1173dcab02e3dbf9c073e3",measurementId:"G-99JJLCDVV9"};n.a.initializeApp(i),n.a.analytics(),t.b=n.a},569:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return E}));var n=a(2),i=a(1),r=a(94),c=a.n(r),s=a(92),o=a(126),l=a.n(o),d=a(320),u=a(205),j=a(388),b=a(390),f=a(592),h=a(596),m=a(594),O=a(595),p=a(593),g=a(246),x=a(1006),y=a(109),v=a.n(y),k=a(9),C=a(5),w=a(10),N=a(0),S=Object(d.a)((function(e){return{icon:{width:150,fontSize:120,cursor:"pointer"},label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:140,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginLeft:10,width:150,cursor:"pointer"},avatar:{width:115,height:120,marginLeft:15,cursor:"pointer"}}}));function E(t){var a=Object(i.useState)(),r=Object(n.a)(a,2),o=r[0],d=r[1],y=Object(s.e)(),E=Object(i.useContext)(k.b),T=E.files,F=E.folders,B=S(),D=Object(i.useState)({mouseX:null,mouseY:null}),R=Object(n.a)(D,2),P=R[0],A=R[1],L=Object(i.useContext)(k.d).currentUserData,I=Object(i.useState)(!1),U=Object(n.a)(I,2),W=U[0],M=U[1],H=Object(i.useState)(!1),K=Object(n.a)(H,2),Y=K[0],z=K[1],V=Object(i.useState)(""),G=Object(n.a)(V,2),q=G[0],_=G[1],X=Object(i.useState)(!1),Z=Object(n.a)(X,2),Q=Z[0],J=Z[1];Object(i.useEffect)((function(){t.folder.hub?(console.log("Downloading Hub Avatar from Firebase"),c.a.get(t.folder.imageURL,{responseType:"arraybuffer"}).then((function(t){var a=e.from(t.data,"base64"),n="data:image/png;base64,"+Object(w.g)(a);d(n)})).catch((function(e){console.error(e)})),J(!0)):J(!1),_(t.folder.name)}),[o,t.folder.key,t.folder]);var $=function(e){"renamefolder"===e.target.id?ee():"deletefolder"===e.target.id?te():"edithub"===e.target.id&&y.replace({pathname:"/managehub",hub:t.folder}),A({mouseX:null,mouseY:null})},ee=function(){z(!0)},te=function(){M(!0)},ae=function(e){return function(){(z(!1),"OK"===e)&&((t.folder.managers.includes(L.key)||"System Digital Manager"===L.role)&&C.b.database().ref("folders").child(t.folder.key).update({name:q}))}},ne=function(e){return function(){if(M(!1),"OK"===e&&(t.folder.managers.includes(L.key)||"System Digital Manager"===L.role)){var a=!0;if(F.forEach((function(e){e.parent===t.folder.key&&(a=!1)})),T.forEach((function(e){e.folder===t.folder.key&&(a=!1)})),a)C.b.database().ref("folders").child(t.folder.key).remove()}}};return Object(N.jsx)("div",{className:B.tile,onContextMenu:function(e){e.preventDefault(),(t.folder.managers.includes(L.key)||"System Digital Manager"===L.role)&&A({mouseX:e.clientX-2,mouseY:e.clientY-4})},style:{cursor:"context-menu"},children:Object(N.jsxs)(N.Fragment,{children:[void 0===t.folder.hub?Object(N.jsxs)("div",{onClick:t.handleClick,children:[Object(N.jsx)(l.a,{className:B.icon}),Object(N.jsx)("p",{className:B.label,children:t.folder.name})]}):Object(N.jsxs)("div",{onClick:t.handleClick,children:[Object(N.jsx)(u.a,{variant:"rounded",src:o,className:B.avatar,children:Object(N.jsx)(v.a,{})}),Object(N.jsx)("p",{className:B.label,children:t.folder.name})]}),Object(N.jsx)(j.a,{keepMounted:!0,open:null!==P.mouseY,onClose:$,anchorReference:"anchorPosition",anchorPosition:null!==P.mouseY&&null!==P.mouseX?{top:P.mouseY,left:P.mouseX}:void 0,children:Q?Object(N.jsx)("div",{children:Object(N.jsx)(b.a,{id:"edithub",onClick:$,children:"Edit Hub"})}):Object(N.jsxs)("div",{children:[Object(N.jsx)(b.a,{id:"renamefolder",onClick:$,children:"Rename Folder"}),Object(N.jsx)(b.a,{id:"deletefolder",onClick:$,children:"Delete Folder"})]})}),Object(N.jsxs)(f.a,{open:Y,onClose:ae,"aria-labelledby":"form-dialog-title",children:[Object(N.jsx)(p.a,{id:"form-dialog-title",children:"Rename Folder"}),Object(N.jsxs)(m.a,{children:[Object(N.jsx)(O.a,{children:"Enter a new name for the folder."}),Object(N.jsx)(x.a,{value:q,onChange:function(e){_(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(N.jsxs)(h.a,{children:[Object(N.jsx)(g.a,{onClick:ae("Cancel"),color:"primary",children:"Cancel"}),Object(N.jsx)(g.a,{onClick:ae("OK"),color:"primary",children:"OK"})]})]}),Object(N.jsxs)(f.a,{open:W,onClose:ne,"aria-labelledby":"form-dialog-title",children:[Object(N.jsx)(p.a,{id:"form-dialog-title",children:"Delete Folder"}),Object(N.jsx)(m.a,{children:Object(N.jsx)(O.a,{children:"Are you sure you want to delete this folder?"})}),Object(N.jsxs)(h.a,{children:[Object(N.jsx)(g.a,{onClick:ne("Cancel"),color:"primary",children:"Cancel"}),Object(N.jsx)(g.a,{onClick:ne("OK"),color:"primary",children:"OK"})]})]})]})})}}).call(this,a(44).Buffer)},622:function(e,t,a){},678:function(e,t){},680:function(e,t){},687:function(e,t){},689:function(e,t){},706:function(e,t){},708:function(e,t){},736:function(e,t){},738:function(e,t){},739:function(e,t){},744:function(e,t){},746:function(e,t){},765:function(e,t){},777:function(e,t){},780:function(e,t){},836:function(e,t){},837:function(e,t){},838:function(e,t){},839:function(e,t){},840:function(e,t){},9:function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"d",(function(){return j})),a.d(t,"e",(function(){return b})),a.d(t,"b",(function(){return f})),a.d(t,"c",(function(){return h}));var n=a(2),i=a(1),r=a.n(i),c=a(5),s=a(14),o=a.n(s),l=a(0),d=r.a.createContext(),u=function(e){var t=e.children,a=Object(i.useState)(null),r=Object(n.a)(a,2),s=r[0],o=r[1];return Object(i.useEffect)((function(){c.b.auth().onAuthStateChanged(o)}),[]),Object(l.jsx)(d.Provider,{value:{currentUser:s},children:t})},j=r.a.createContext(),b=function(e){var t=e.children,a=Object(i.useState)(null),r=Object(n.a)(a,2),s=r[0],d=r[1],u=Object(i.useContext)(f).users;return Object(i.useEffect)((function(){if(c.b.auth().currentUser){console.log("Setting Current User Data");var e=u.filter((function(e){return e.uid===c.b.auth().currentUser.uid}))[0];if(e)d(e),console.log("Updating Last Login"),c.b.database().ref("userlogin").child(e.key).update({lastLogin:o()().toString()})}}),[u]),Object(l.jsx)(j.Provider,{value:{currentUserData:s},children:t})},f=r.a.createContext(),h=function(e){var t=e.children,a=Object(i.useContext)(d).currentUser,r=Object(i.useState)([]),s=Object(n.a)(r,2),o=s[0],u=s[1],j=Object(i.useState)([]),b=Object(n.a)(j,2),h=b[0],m=b[1],O=Object(i.useState)([]),p=Object(n.a)(O,2),g=p[0],x=p[1],y=Object(i.useState)([]),v=Object(n.a)(y,2),k=v[0],C=v[1],w=Object(i.useState)([]),N=Object(n.a)(w,2),S=N[0],E=N[1],T=Object(i.useState)([]),F=Object(n.a)(T,2),B=F[0],D=F[1],R=Object(i.useState)([]),P=Object(n.a)(R,2),A=P[0],L=P[1],I=Object(i.useState)([]),U=Object(n.a)(I,2),W=U[0],M=U[1],H=Object(i.useState)([]),K=Object(n.a)(H,2),Y=K[0],z=K[1],V=Object(i.useState)([]),G=Object(n.a)(V,2),q=G[0],_=G[1],X=Object(i.useState)([]),Z=Object(n.a)(X,2),Q=Z[0],J=Z[1],$=Object(i.useState)([]),ee=Object(n.a)($,2),te=ee[0],ae=ee[1],ne=Object(i.useState)([]),ie=Object(n.a)(ne,2),re=ie[0],ce=ie[1],se=Object(i.useState)([]),oe=Object(n.a)(se,2),le=oe[0],de=oe[1],ue=Object(i.useState)([]),je=Object(n.a)(ue,2),be=je[0],fe=je[1],he=Object(i.useState)([]),me=Object(n.a)(he,2),Oe=me[0],pe=me[1],ge=Object(i.useState)([]),xe=Object(n.a)(ge,2),ye=xe[0],ve=xe[1],ke=Object(i.useState)([]),Ce=Object(n.a)(ke,2),we=Ce[0],Ne=Ce[1],Se=Object(i.useState)([]),Ee=Object(n.a)(Se,2),Te=Ee[0],Fe=Ee[1];function Be(){console.log("Getting User consent from Firebase"),c.b.database().ref("userconsent").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val();t.push({key:a,uid:n.uid,name:n.name,hasConsent:n.hasConsent})})),x(t)}))}return Object(i.useEffect)((function(){a?(Be(),console.log("Getting Users from Firebase"),c.b.database().ref("users").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];n.files&&Object.keys(n.files).forEach((function(e){i.push(e)}));var r=[];n.admins&&Object.keys(n.admins).forEach((function(e){r.push(e)}));var c=[];n.faveFiles&&Object.keys(n.faveFiles).forEach((function(e){c.push(e)})),t.push({key:a,uid:n.uid,firstName:n.firstName,lastName:n.lastName,fullName:n.firstName+" "+n.lastName,email:n.email,phone:n.phone,parentFirstName:n.parentFirstName,parentLastName:n.parentLastName,parentEmail:n.parentEmail,parentPhone:n.parentPhone,customRoleName:n.customRoleName,permissions:n.permissions,imageURL:n.imageURL,role:n.role,under18:n.under18,createdBy:n.createdBy,admins:r,files:i,faveFiles:c})})),u(t)})),console.log("Getting User Logins from Firebase"),c.b.database().ref("userlogin").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val();t.push({key:a,lastLogin:n.lastLogin})})),m(t)})),console.log("Getting Notifications from Firebase"),c.b.database().ref("notifications").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];n.users&&Object.keys(n.users).forEach((function(e){i.push(e)}));var r=[];n.managers&&Object.keys(n.managers).forEach((function(e){r.push(e)}));var c=[];n.seenBy&&Object.keys(n.seenBy).forEach((function(e){c.push(e)})),t.push({key:a,users:i,managers:r,seenBy:c,file:n.file,type:n.type,title:n.title,message:n.message,url:n.url,thumbnail:n.thumbnail,date:n.date,fromDate:n.fromDate,hubName:n.hubName})})),C(t)})),console.log("Getting Folders from Firebase"),c.b.database().ref("folders").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.ancestors)for(var r=Object.keys(n.ancestors),c=0;c<r.length;c++)i.push(r[c]);var s=[];if(n.managers)for(var o=Object.keys(n.managers),l=0;l<o.length;l++)s.push(o[l]);var d=[];if(n.users)for(var u=Object.keys(n.users),j=0;j<u.length;j++)d.push(u[j]);t.push({key:a,id:a,name:n.name,hub:n.hub,parent:n.parent,imageURL:n.imageURL,createdBy:n.createdBy,parentNode:{},childNodes:[],managers:s,users:d,ancestors:i})})),D(t)})),console.log("Getting Groups from Firebase"),c.b.database().ref("groups").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];n.users&&Object.keys(n.users).forEach((function(e){i.push({key:e})})),t.push({key:a,name:n.name,hub:n.hub,users:i})})),ae(t)})),console.log("Getting Files from Firebase"),c.b.database().ref("files").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.ancestors)for(var r=Object.keys(n.ancestors),c=0;c<r.length;c++)i.push(r[c]);var s=[];if(n.events)for(var o=Object.keys(n.events),l=0;l<o.length;l++)s.push({key:o[l]});var d=[];if(n.managers)for(var u=Object.keys(n.managers),j=0;j<u.length;j++)d.push(u[j]);var b=[];if(n.groups)for(var f=Object.keys(n.groups),h=0;h<f.length;h++)b.push(f[h]);var m={key:a,filename:n.filename,displayName:n.displayName,folder:n.folder,type:n.type,allowDownloads:n.allowDownloads,allowComments:n.allowComments,allowSharing:n.allowSharing,url:n.url,thumbnail:n.thumbnail,original:n.original,uploadedBy:n.uploadedBy,events:s,managers:d,groups:b,ancestors:i};t.push(m)})),E(t)})),console.log("Getting Comments from Firebase"),c.b.database().ref("comments").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val();t.push({key:a,text:n.text,file:n.file,user:n.user,date:n.date,deleted:n.deleted,parent:n.parent,author:n.author})})),L(t)})),console.log("Getting Events from Firebase"),c.b.database().ref("events").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.files)for(var r=Object.keys(n.files),c=0;c<r.length;c++)i.push({key:r[c]});t.push({key:a,date:n.date,name:n.name,color:"#"+n.color,calendar:n.calendar,files:i})})),M(t)})),console.log("Getting Calendars from Firebase"),c.b.database().ref("calendars").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];n.events&&Object.keys(n.events).forEach((function(e){i.push({key:e})})),t.push({key:a,name:n.name,hub:n.hub,user:n.user,events:i})})),z(t)})),console.log("Getting Conversations from Firebase"),c.b.database().ref("conversations").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.messages)for(var r=Object.keys(n.messages),c=Object.values(n.messages),s=0;s<r.length;s++){var o=c[s].readBy,l=[];o&&(l=Object.keys(o)),i.push({key:r[s],date:c[s].date,message:c[s].message,deleted:c[s].deleted,user:c[s].user,fullName:c[s].fullName,read:c[s].read,readBy:l})}for(var d=[],u=Object.keys(n.participants),j=0;j<u.length;j++)d.push({key:u[j]});var b={key:a,participants:d,messages:i,lastMessage:n.lastMessage,title:n.title,deleted:n.deleted,imageURL:n.imageURL};t.push(b)})),_(t)})),console.log("Getting Playlist Info from Firebase"),c.b.database().ref("playlistinfo").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.groups)for(var r=Object.keys(n.groups),c=0;c<r.length;c++)i.push(r[c]);var s=[];if(n.users)for(var o=Object.keys(n.users),l=0;l<o.length;l++)s.push(o[l]);var d={key:a,name:n.name,lastOpened:n.lastOpened,created:n.created,owner:n.owner,video:n.video,users:s,groups:i};t.push(d)})),ce(t)})),console.log("Getting Playlist Usage from Firebase"),c.b.database().ref("playlistusage").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val();t.push({key:a,playlist:n.playlist,user:n.user,lastOpened:n.lastOpened})})),de(t)})),console.log("Getting TimelineInfo from Firebase"),c.b.database().ref("timelineinfo").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.groups)for(var r=Object.keys(n.groups),c=0;c<r.length;c++)i.push(r[c]);var s=[];if(n.users)for(var o=Object.keys(n.users),l=0;l<o.length;l++)s.push(o[l]);var d={key:a,name:n.name,owner:n.owner,lastOpened:n.lastOpened,created:n.created,video:n.video,users:s,groups:i};t.push(d)})),fe(t)})),console.log("Getting SurveyInfo from Firebase"),c.b.database().ref("surveyinfo").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.groups)for(var r=Object.keys(n.groups),c=Object.values(n.groups),s=0;s<r.length;s++)i.push({key:r[s],canEdit:c[s].canEdit,canViewResults:c[s].canViewResults});var o=[];if(n.users)for(var l=Object.keys(n.users),d=Object.values(n.users),u=0;u<l.length;u++)o.push({key:l[u],canEdit:d[u].canEdit,canViewResults:d[u].canViewResults});var j={key:a,title:n.title,intro:n.intro,createdBy:n.createdBy,createdOn:n.createdOn,lastUpdated:n.lastUpdated,file:n.file,anonymous:n.anonymous,groups:i,users:o};t.push(j)})),pe(t)})),console.log("Getting ProjectInfo from Firebase"),c.b.database().ref("projectinfo").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];if(n.groups)for(var r=Object.keys(n.groups),c=Object.values(n.groups),s=0;s<r.length;s++)i.push({key:r[s],canEdit:c[s].canEdit});var o=[];if(n.users)for(var l=Object.keys(n.users),d=Object.values(n.users),u=0;u<l.length;u++)o.push({key:l[u],canEdit:d[u].canEdit});var j={key:a,title:n.title,intro:n.intro,createdBy:n.createdBy,createdOn:n.createdOn,lastUpdated:n.lastUpdated,groups:i,users:o};t.push(j)})),ve(t)}))):Be()}),[a]),Object(l.jsx)(f.Provider,{value:{userConsent:g,users:o,userLogins:h,notifications:k,files:S,folders:B,comments:A,events:W,calendars:Y,conversations:q,fileUsage:Q,getFileUsage:function(){console.log("Getting File Usage from Firebase"),c.b.database().ref("fileusage").on("value",(function(e){var t=[];e.forEach((function(e){var a=e.key,n=e.val(),i=[];n.usersSharedWith&&Object.keys(n.usersSharedWith).forEach((function(e){i.push({key:e})}));var r=[];n.groupsSharedWith&&Object.keys(n.groupsSharedWith).forEach((function(e){r.push({key:e})})),t.push({key:a,file:n.file,fileName:n.fileName,fileType:n.fileType,user:n.user,action:n.action,date:n.date,usersSharedWith:i,groupsSharedWith:r})})),J(t)}))},groups:te,playlists:we,playlistInfo:re,playlistUsage:le,getPlaylists:function(e){return new Promise((function(t,a){if(!e&&Te.length>0)return console.log("Timelines Already Downloaded"),void t(Te);console.log("Getting Playlists from Firebase"),c.b.database().ref("playlists").on("value",(function(e){var a=[];e.forEach((function(e){var t=e.key,n=e.val(),i=[];if(n.clips)for(var r=Object.keys(n.clips),c=Object.values(n.clips),s=0;s<r.length;s++){var o=[];if(c[s].labels)for(var l=Object.values(c[s].labels),d=0;d<l.length;d++)o.push(l[d]);i.push({key:r[s],index:c[s].index,inTime:c[s].inTime,outTime:c[s].outTime,name:c[s].name,note:c[s].note,labels:o,stars:c[s].stars,video:c[s].video})}var u=[];if(n.groups)for(var j=Object.keys(n.groups),b=0;b<j.length;b++)u.push(j[b]);var f=[];if(n.users)for(var h=Object.keys(n.users),m=0;m<h.length;m++)f.push(h[m]);var O={key:t,clips:i,name:n.name,lastOpened:n.lastOpened,created:n.created,owner:n.owner,video:n.video,users:f,groups:u};a.push(O)})),Ne(a),t(a)}))}))},timelines:Te,timelineInfo:be,getTimelines:function(e){return new Promise((function(t,a){if(!e&&Te.length>0)return console.log("Timelines Already Downloaded"),void t(Te);console.log("Getting Timelines from Firebase"),c.b.database().ref("timelines").on("value",(function(e){var a=[];e.forEach((function(e){var t=e.key,n=e.val(),i=[];if(n.instances)for(var r=Object.keys(n.instances),c=Object.values(n.instances),s=0;s<r.length;s++){var o=[];if(c[s].labels)for(var l=Object.values(c[s].labels),d=0;d<l.length;d++)o.push(l[d]);var u=[];if(c[s].notes)for(var j=Object.values(c[s].notes),b=0;b<j.length;b++)u.push(j[b]);i.push({key:r[s],index:c[s].index,name:c[s].name,labels:o,notes:u,note:c[s].note,stars:c[s].stars,inTime:c[s].inTime,outTime:c[s].outTime})}var f=[];if(n.groups)for(var h=Object.keys(n.groups),m=0;m<h.length;m++)f.push(h[m]);var O=[];if(n.users)for(var p=Object.keys(n.users),g=0;g<p.length;g++)O.push(p[g]);var x={key:t,instances:i,name:n.name,owner:n.owner,lastOpened:n.lastOpened,created:n.created,video:n.video,users:O,groups:f};a.push(x)})),Fe(a),t(a)}))}))},surveyInfo:Oe,projectInfo:ye},children:t})}},995:function(e,t,a){"use strict";a.r(t);var n=a(1),i=a.n(n),r=a(53),c=a.n(r),s=(a(622),a(37)),o=a(92),l=a(532),d=a(112),u=a(113),j=a(1058),b=a(1081),f=a(229),h=a(9),m=a(2),O=a(320),p=a(1052),g=a(1053),x=a(183),y=a(231),v=a.n(y),k=a(1046),C=a(1005),w=a(389),N=a(388),S=a(193),E=a.n(S),T=a(546),F=a.n(T),B=a(32),D=a(5),R=a(14),P=a.n(R),A=a(125),L=a.n(A),I=a(1039),U=a(1044),W=a(1040),M=a(1045),H=a(1043),K=a(246),Y=a(30),z=a.n(Y),V=a(1089),G=a(0),q=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function _(e){var t=q(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/video/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)(H.a,{component:"img",alt:"Video thumbnail",height:"250",image:"https://vz-db0e7359-d70.b-cdn.net/"+e.notification.file+"/thumbnail.jpg",title:e.notification.title,onClick:n(e.notification)}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:"Test Message"})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var X=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},thumbnail:{marginTop:5,maxHeight:500,width:"auto",display:"block",marginLeft:"auto",marginRight:"auto"},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function Z(e){var t=X(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/pdf/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)("img",{src:e.notification.thumbnail,className:t.thumbnail,alt:"thumbnail",onClick:n(e.notification)}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var Q=a(243),J=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},audioPlayer:{paddingTop:40},chip:{marginBottom:10}}}));function $(e){var t=J(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/audio/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)(Q.a,{className:t.audioPlayer,autoPlay:!1,src:e.notification.url,onClick:n(e.notification)}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var ee=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function te(e){var t=ee(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/image/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)(H.a,{component:"img",alt:"Video thumbnail",height:"250",image:e.notification.url,title:e.notification.title,onClick:n(e.notification)}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var ae=a(22),ne=a.n(ae),ie=a(31),re=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function ce(e){var t=re(),a=Object(o.e)(),i=Object(n.useContext)(h.b).getPlaylists,r=function(t){return function(){e.updateSeenBy(e.notification),function(){c.apply(this,arguments)}()}};function c(){return(c=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i(!0).then((function(t){a.push("/playlist?key="+e.notification.key)}));case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsx)(I.a,{className:t.card,variant:"outlined",children:Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)(H.a,{component:"img",alt:"Video thumbnail",height:"250",image:"https://vz-db0e7359-d70.b-cdn.net/"+e.notification.file+"/thumbnail.jpg",title:e.notification.title,onClick:r(e.notification)}),Object(G.jsxs)(U.a,{onClick:r(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]})})}var se=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5}}}));function oe(e){var t=se(),a=Object(o.e)();return Object(G.jsx)(I.a,{className:t.card,variant:"outlined",children:Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsxs)(U.a,{onClick:(e.notification,function(){e.updateSeenBy(e.notification),a.push("/surveys/r?key="+e.notification.key)}),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]})})}var le=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function de(e){var t=le(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),function(){i.apply(this,arguments)}()}};function i(){return(i=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a.push("/analysis?video="+e.notification.file+"&key="+e.notification.key);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsx)(I.a,{className:t.card,variant:"outlined",children:Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsx)(H.a,{component:"img",alt:"Video thumbnail",height:"250",image:"https://vz-db0e7359-d70.b-cdn.net/"+e.notification.file+"/thumbnail.jpg",title:e.notification.title,onClick:n(e.notification)}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]})})}var ue=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function je(e){var t=ue(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/link/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var be=a(10),fe=Object(O.a)((function(e){return{noNotificationsCard:{display:"flex",flexDirection:"column",marginTop:10}}}));function he(){var e=fe();return Object(G.jsx)(I.a,{className:e.noNotificationsCard,variant:"outlined",children:Object(G.jsxs)(W.a,{children:[Object(G.jsx)(H.a,{component:"img",alt:"nodiantlogo",height:"300",image:"/images/logo512alt.png",title:"nodiant"}),Object(G.jsxs)(U.a,{children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:"Welcome to Nodiant"}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:"Announcements and Notifications will appear here"})]})]})})}var me=Object(O.a)((function(e){return{card:{display:"flex",flexDirection:"column",marginTop:"1%",marginLeft:"2%",marginRight:"2%",marginBottom:5},closeButton:{cursor:"pointer",position:"absolute",left:"auto",right:0,paddingTop:5},chip:{marginBottom:10}}}));function Oe(e){var t=me(),a=Object(o.e)(),n=function(t){return function(){e.updateSeenBy(e.notification),a.push("/file/"+t.file)}};return Object(G.jsxs)(I.a,{className:t.card,variant:"outlined",children:[Object(G.jsxs)(W.a,{children:[e.popupFeed&&Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(z.a,{className:t.closeButton,onClick:function(){e.updateSeenBy(e.notification)}})}),Object(G.jsxs)(U.a,{onClick:n(e.notification),children:[Object(G.jsx)(x.a,{gutterBottom:!0,variant:"h5",component:"h2",children:e.notification.title}),e.notification.hubName&&Object(G.jsx)(V.a,{className:t.chip,size:"small",label:e.notification.hubName}),Object(G.jsx)(x.a,{variant:"body2",color:"textSecondary",component:"p",children:e.notification.message})]})]}),Object(G.jsx)(M.a,{children:Object(G.jsxs)(K.a,{size:"small",color:"primary",onClick:n(e.notification),children:["Comments (",e.notification.comments.length,")"]})})]})}var pe=Object(O.a)((function(e){return{noNotificationsMessage:{paddingTop:15,padding:10,alignSelf:"center",color:"rgb(100, 100, 100)"},clearAllButton:{width:"100%"}}}));function ge(e){var t=pe(),a=Object(o.e)(),i=Object(n.useContext)(h.b),r=i.notifications,c=i.comments,s=Object(n.useContext)(h.d).currentUserData,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1];function g(e){if(s){var t=D.b.database().ref("notifications"),a=Object(be.k)(e.seenBy);a[s.key]=!0,t.child(e.key).update({seenBy:a})}}return Object(n.useEffect)((function(){if(s){var t=[];r.forEach((function(e){(e.users.includes(s.key)||e.managers.includes(s.key))&&(e.comments=c.filter((function(t){return t.file===e.file&&!1===t.deleted})),e.comments||(e.comments=[]),(void 0===e.fromDate||P()().isSame(e.fromDate)||P()().isAfter(e.fromDate))&&t.push(e))})),(t=t.filter((function(t){return!t.seenBy.includes(s.key)||!e.popupFeed}))).sort((function(e,t){return P()(t.date).isBefore()>P()(e.date)?1:P()(e.date)>P()(t.date)?-1:0})),p(!0),j(t)}}),[s,r,c,a]),Object(G.jsxs)(G.Fragment,{children:[e.popupFeed&&O&&0===u.length&&Object(G.jsx)("p",{className:t.noNotificationsMessage,children:"You don't have any Notifications"}),!e.popupFeed&&O&&0===u.length&&Object(G.jsx)(he,{}),Object(G.jsxs)(G.Fragment,{children:[e.popupFeed&&u.length>0&&Object(G.jsx)(K.a,{className:t.clearAllButton,color:"primary",onClick:function(){u.forEach((function(e){g(e)}))},children:"Clear All"}),u.map((function(a){return Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsxs)("div",{style:e.popupFeed?{maxWidth:600}:{},children:["announcement"===a.type&&Object(G.jsx)(I.a,{className:t.card,variant:"outlined",children:Object(G.jsxs)(U.a,{children:[Object(G.jsx)(x.a,{variant:"h5",component:"h2",children:"Announcement"}),Object(G.jsx)(x.a,{color:"textSecondary",children:a.title}),Object(G.jsx)(x.a,{variant:"body2",component:"p",children:a.message})]})}),"file"===a.type&&Object(G.jsx)(Oe,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"video"===a.type&&Object(G.jsx)(_,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"playlist"===a.type&&Object(G.jsx)(ce,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"survey"===a.type&&Object(G.jsx)(oe,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"timeline"===a.type&&Object(G.jsx)(de,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"pdf"===a.type&&Object(G.jsx)(Z,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"audio"===a.type&&Object(G.jsx)($,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"image"===a.type&&Object(G.jsx)(te,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a}),"link"===a.type&&Object(G.jsx)(je,{updateSeenBy:g,popupFeed:e.popupFeed,notification:a})]},a.key)},a.key)}))]})]})}var xe=a(1048),ye=Object(O.a)((function(e){return{toolbar:{position:"sticky",top:0,minWidth:210,width:"100%",height:55,background:"white",zIndex:1,padding:0},myAccountButton:{top:0},signOutButton:{position:"absolute",top:0,left:"auto",right:0},avatarDiv:{cursor:"pointer"}}}));function ve(){var e=ye(),t=Object(o.e)(),a=Object(n.useState)(null),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Boolean(r),l=Object(n.useContext)(h.d).currentUserData,d=Object(n.useContext)(h.b).notifications,u=Object(n.useState)(0),j=Object(m.a)(u,2),b=j[0],f=j[1];Object(n.useEffect)((function(){if(l){var e=0;d.forEach((function(t){(t.users.includes(l.key)||t.managers.includes(l.key))&&(t.seenBy.includes(l.key)||e++)})),f(e)}}),[l,d]);return Object(G.jsxs)("div",{children:[Object(G.jsx)(k.a,{badgeContent:b,color:"secondary",children:Object(G.jsx)("div",{onClick:function(e){c(e.currentTarget)},className:e.avatarDiv,children:Object(G.jsx)(B.a,{userOrHub:l,path:"users"})})}),Object(G.jsxs)(N.a,{id:"menu-appbar",anchorEl:r,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:s,onClose:function(){c(null)},MenuListProps:{disablePadding:!0},children:[Object(G.jsxs)("div",{className:e.toolbar,children:[Object(G.jsx)(C.a,{title:"My Account",children:Object(G.jsx)(w.a,{"aria-label":"My Account",className:e.myAccountButton,onClick:function(){t.push({pathname:"/myaccount"})},children:Object(G.jsx)(E.a,{})})}),Object(G.jsx)(C.a,{title:"Sign Out",children:Object(G.jsx)(w.a,{"aria-label":"Sign Out",className:e.signOutButton,onClick:function(){D.b.auth().signOut(),c(null),t.replace("/")},children:Object(G.jsx)(F.a,{})})}),Object(G.jsx)(xe.a,{})]}),Object(G.jsx)(ge,{popupFeed:!0})]})]})}var ke=a(547),Ce=a.n(ke),we=a(126),Ne=a.n(we),Se=a(548),Ee=a.n(Se),Te=a(551),Fe=a.n(Te),Be=a(109),De=a.n(Be),Re=a(230),Pe=a.n(Re),Ae=a(232),Le=a.n(Ae),Ie=a(549),Ue=a.n(Ie),We=a(550),Me=a.n(We),He=a(1047),Ke=a(1e3),Ye=a(1049),ze=a(1050),Ve=a(1051),Ge=Object(O.a)((function(e){return{root:{flexGrow:1},menuButton:{marginRight:e.spacing(2)},title:{flexGrow:1},nested:{paddingLeft:e.spacing(4)}}}));function qe(){var e=Object(o.e)(),t=Ge(),a=Object(n.useState)(!1),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.d).currentUserData,l=Object(n.useState)(!1),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],k=x[1],C=Object(n.useState)(!1),N=Object(m.a)(C,2),S=N[0],T=N[1];function F(){e.replace("/")}function B(){e.replace("/users")}function D(){e.replace("/hubs")}function R(){e.replace("/files")}function P(){e.replace("/calendar")}function A(){e.replace("/messages")}function L(){e.replace("/playlists")}function I(){e.replace("/surveys/s")}function U(){e.replace("/projects/s")}Object(n.useEffect)((function(){s&&s.permissions&&(s.permissions.addEditUsers?j(!0):j(!1),s.permissions.openMessage?T(!0):T(!1),s.permissions.viewCalendar?p(!0):p(!1),"Player"!==s.role&&"FAW Player"!==s.role&&"Club Player"!==s.role&&"Coach Ed Student"!==s.role&&"FAW Coach Ed Student"!==s.role&&"Club Coach Ed Student"!==s.role&&"FAW Parent"!==s.role&&"Club Parent"!==s.role&&"Referee"!==s.role?k(!0):k(!1))}),[s]);var W=function(e){return function(t){("keydown"!==t.type||"Tab"!==t.key&&"Shift"!==t.key)&&c(e)}};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:W(!0),className:t.menuButton,children:Object(G.jsx)(Fe.a,{})}),Object(G.jsx)(Ve.a,{anchor:"left",open:r,onClose:W(!1),children:Object(G.jsxs)("div",{role:"presentation",onClick:W(!1),onKeyDown:W(!1),children:[Object(G.jsx)(He.a,{children:Object(G.jsxs)(Ke.a,{button:!0,onClick:F,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Ce.a,{})}),Object(G.jsx)(ze.a,{primary:"Home"})]})}),Object(G.jsx)(xe.a,{}),Object(G.jsxs)(He.a,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:R,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Ne.a,{})}),Object(G.jsx)(ze.a,{primary:"Files"})]}),S&&Object(G.jsxs)(Ke.a,{button:!0,onClick:A,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(v.a,{})}),Object(G.jsx)(ze.a,{primary:"Messages"})]}),O&&Object(G.jsxs)(Ke.a,{button:!0,onClick:P,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Ee.a,{})}),Object(G.jsx)(ze.a,{primary:"Calendar"})]}),Object(G.jsxs)(Ke.a,{button:!0,onClick:L,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Le.a,{})}),Object(G.jsx)(ze.a,{primary:"Playlists"})]}),Object(G.jsxs)(Ke.a,{button:!0,onClick:I,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Ue.a,{})}),Object(G.jsx)(ze.a,{primary:"Surveys"})]}),Object(G.jsxs)(Ke.a,{button:!0,onClick:U,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Me.a,{})}),Object(G.jsx)(ze.a,{primary:"Projects"})]})]}),y&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(xe.a,{}),Object(G.jsxs)(He.a,{component:"nav","aria-labelledby":"nested-list-subheader",className:t.root,children:[Object(G.jsxs)(Ke.a,{button:!0,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(E.a,{})}),Object(G.jsx)(ze.a,{primary:"Management"})]}),Object(G.jsxs)(He.a,{component:"div",disablePadding:!0,children:[u&&Object(G.jsxs)(Ke.a,{button:!0,className:t.nested,onClick:B,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Pe.a,{})}),Object(G.jsx)(ze.a,{primary:"Users"})]}),Object(G.jsxs)(Ke.a,{button:!0,className:t.nested,onClick:D,children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(De.a,{})}),Object(G.jsx)(ze.a,{primary:"Hubs"})]})]})]})]})]})})]})}var _e=Object(O.a)((function(e){return{root:{flexGrow:1},title:{flexGrow:1},messagesIcon:{marginTop:7.5,marginRight:5,cursor:"pointer"}}}));function Xe(e){var t=_e(),a=Object(o.e)(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b).conversations,c=Object(n.useState)(0),s=Object(m.a)(c,2),l=s[0],d=s[1],u=Object(n.useState)(!1),j=Object(m.a)(u,2),b=j[0],f=j[1];return Object(n.useEffect)((function(){if(d(0),i){!0===i.permissions.openMessage?f(!0):f(!1);var e=r.filter((function(e){return e.participants.filter((function(e){return e.key===i.key})).length>0})),t=0;e.forEach((function(e){e.deleted||e.messages&&e.messages.forEach((function(e){e.user!==i.key&&(e.readBy.includes(i.key)||e.deleted||t++)}))})),d(t)}}),[r,i]),Object(G.jsxs)("div",{className:t.root,children:[Object(G.jsx)(p.a,{position:"fixed",children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(qe,{}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Nodiant "+e.navBarTitle}),b&&l>0&&Object(G.jsx)("div",{className:t.messagesIcon,onClick:function(){a.replace("/messages")},children:Object(G.jsx)(C.a,{title:"You have "+l+" unread messages",children:Object(G.jsx)(k.a,{badgeContent:l,color:"secondary",children:Object(G.jsx)(v.a,{color:"disabled"})})})}),Object(G.jsx)(ve,{})]})}),Object(G.jsx)(g.a,{})]})}var Ze=a(15),Qe=a(205),Je=Object(O.a)((function(e){return{appBar:{top:"auto",bottom:0},logo:{position:"absolute",zIndex:1,top:0,bottom:0,left:0,right:0,margin:"auto"},grow:{flexGrow:1}}}));function $e(){var e=Je();return Object(G.jsx)(p.a,{position:"fixed",color:"default",className:e.appBar,children:Object(G.jsx)(g.a,{children:Object(G.jsx)(Qe.a,{className:e.logo,variant:"square",alt:"FAW Logo",src:"../images/FAW_CLEAR.png"})})})}var et=Object(O.a)((function(e){var t;return{root:(t={paddingBottom:80},Object(Ze.a)(t,e.breakpoints.down("sm"),{marginLeft:"2%",marginRight:"2%"}),Object(Ze.a)(t,e.breakpoints.up("md"),{marginLeft:"30%",marginRight:"30%"}),t)}}));function tt(){var e=et(),t=Object(o.e)(),a=Object(n.useContext)(h.d).currentUserData;return Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||t.replace("/signin")}));return function(){return e()}}),[a,t]),Object(G.jsxs)("div",{className:e.root,children:[Object(G.jsx)(ge,{}),Object(G.jsx)($e,{})]})}var at=a(13),nt=a(1006),it=a(1059),rt=a(1057),ct=a(1060),st=a(1091),ot=a(1084),lt=a(67),dt=a(592),ut=a(1001);function jt(e){return Object(G.jsx)(lt.Email,{children:Object(G.jsxs)(lt.Content,{children:[Object(G.jsx)(lt.Header,{logo:"https://firebasestorage.googleapis.com/v0/b/nodiant-e20a8.appspot.com/o/180.png?alt=media&token=9821b2a9-1a70-4f63-a488-96377bb3a234"}),Object(G.jsx)(lt.Title,{children:"Choose your Password"}),Object(G.jsx)(lt.Paragraph,{children:e.message}),Object(G.jsx)(lt.Paragraph,{children:"Press the button to choose your password."}),Object(G.jsx)(lt.CallToAction,{href:e.link,children:"Choose your password"})]})})}var bt=Object(O.a)((function(e){return{root:{textAlign:"center",paddingLeft:10},title:{marginTop:15},calendarControl:{margin:20},textField:{marginTop:10,marginLeft:20,marginRight:20,marginBottom:20},button:{marginLeft:20,marginRight:20,marginBottom:20}}}));function ft(e){var t=bt(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(!1),o=Object(m.a)(s,2),l=o[0],d=o[1];Object(n.useEffect)((function(){c(e.email)}),[e]);return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)("h5",{className:t.title,children:"Reset Password"}),Object(G.jsx)(nt.a,{className:t.textField,id:"outlined-basic",label:"Enter your email address",variant:"outlined",value:r,onChange:function(e){c(e.target.value)}}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){""!==r&&(d(!0),D.b.functions().httpsCallable("generateEmailActionLink")({email:r}).then((function(t){!function(t){D.b.functions().httpsCallable("sendMail")({dest:r,sender:"Nodiant Online <no.reply.nodiant@gmail.com>",subject:"Choose your Nodiant Online Password",html:Object(lt.render)(Object(G.jsx)(jt,{link:t,message:"Your password has been reset on the Nodiant Online Platform"}))}).then((function(){console.log("Password Email Sent"),d(!1),e.onClose()})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}(t.data.link)})).catch((function(e){console.log("Error"),console.log(e),console.log(e.code),console.log(e.message),console.log(e.details)})))},children:"Reset"}),l&&Object(G.jsx)(ut.a,{})]})})}var ht=Object(O.a)((function(e){return{paper:{marginTop:e.spacing(8),display:"flex",flexDirection:"column",alignItems:"center"},avatar:{margin:e.spacing(1),backgroundColor:e.palette.secondary.main},form:{width:"100%",marginTop:e.spacing(1)},submit:{margin:e.spacing(3,0,2)},center:{display:"flex",justifyContent:"center"},alert:{width:"100%","& > * + *":{marginTop:e.spacing(2)}}}}));function mt(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Ot(e){var t=Object(o.e)(),a=Object(o.f)(),i=ht(),r=Object(n.useContext)(h.b).userConsent,c=Object(n.useState)(""),s=Object(m.a)(c,2),l=s[0],d=s[1],u=Object(n.useState)(""),b=Object(m.a)(u,2),O=b[0],p=b[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(""),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(!1),P=Object(m.a)(R,2),A=P[0],L=P[1];function I(e){"email"===e.target.id?d(e.target.value):"password"===e.target.id&&p(e.target.value)}var U=function(e,t){"clickaway"!==t&&S(!1)};return Object(G.jsxs)(rt.a,{component:"main",maxWidth:"xs",children:[Object(G.jsxs)(f.a,{children:[Object(G.jsx)("meta",{name:"description",content:"FAW Performance Analysis"}),Object(G.jsx)("meta",{name:"og:description",content:"FAW Performance Analysis."})]}),Object(G.jsx)(j.a,{}),Object(G.jsxs)("div",{className:i.paper,children:[Object(G.jsx)(Qe.a,{className:i.avatar,variant:"rounded",alt:"Nodiant Logo",src:"images/logo512.png"}),Object(G.jsx)(x.a,{component:"h1",variant:"h5",children:"Sign in"}),Object(G.jsxs)("form",{className:i.form,noValidate:!0,onSubmit:function(e){e.preventDefault(),k(!0),D.b.auth().signInWithEmailAndPassword(l,O).then((function(e){var n=e.user,i=r.filter((function(e){return e.uid===n.uid}))[0];if(i)if(i.hasConsent){console.log("Signed In: "+n.email);var c=new URLSearchParams(a.search).get("url");c?t.replace(c):t.replace("")}else i.under18?B("Your Parent, Carer or Guardian has to give consent before you can sign in. They should have recieved an email with a link to the consent form."):B("You have to give consent before you can sign in, You should have recieved an email with a link to the consent form."),D.b.auth().signOut(),S(!0);else B("This account has been deactivated or the email address has been changed"),S(!0);k(!1)})).catch((function(e){k(!1),d(""),p(""),B(e.message),S(!0)}))},children:[Object(G.jsx)(nt.a,{value:l,onChange:I,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,id:"email",label:"Email Address",name:"email",autoComplete:"email",autoFocus:!0}),Object(G.jsx)(nt.a,{value:O,onChange:I,variant:"outlined",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password"}),Object(G.jsx)(x.a,{className:i.root,children:Object(G.jsx)(it.a,{href:"#",onClick:function(e){e.preventDefault(),L(!0)},variant:"body2",children:"Forgot Password"})}),Object(G.jsx)(K.a,{type:"submit",fullWidth:!0,variant:"contained",color:"primary",className:i.submit,children:"Sign In"}),v&&Object(G.jsx)("div",{className:i.center,children:Object(G.jsx)(ct.a,{})})]}),Object(G.jsx)("div",{className:i.alert,children:Object(G.jsx)(st.a,{open:N,autoHideDuration:6e3,onClose:U,children:Object(G.jsx)(mt,{onClose:U,severity:"error",children:F})})})]}),Object(G.jsx)(ft,{open:A,onClose:function(){L(!1)},email:l})]})}var pt=a(262),gt=a(1061),xt=a(1002),yt=a(98),vt=a.n(yt),kt=Object(O.a)((function(e){return{position:{position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10}}}));function Ct(e){var t=kt();return Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.position,onClick:e.onClick,children:Object(G.jsx)(vt.a,{})})}var wt=Object(O.a)((function(e){return{message:{padding:e.spacing(2,2,0)}}}));function Nt(){var e=wt();return Object(G.jsx)("h5",{className:e.message,children:"You don't have permission to view this page"})}var St=Object(O.a)((function(e){return{title:{padding:e.spacing(2,2,0)},list:{marginBottom:e.spacing(2)},subheader:{backgroundColor:e.palette.background.paper},grow:{flexGrow:1},container:{paddingBottom:45},avatar:{width:"50px",height:"50px"},listText:{paddingLeft:e.spacing(1)},nameTextField:{marginLeft:75,width:window.innerWidth-75}}}));function Et(){var e=Object(o.e)(),t=Object(o.f)(),a=St(),r=Object(n.useContext)(h.b).users,c=Object(n.useState)(""),s=Object(m.a)(c,2),l=s[0],d=s[1],u=Object(n.useState)(),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useContext)(h.d).currentUserData;Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(a){a||e.replace("/signin?url="+t.pathname)}));return O&&O.permissions&&(O.permissions.addEditUsers?f(!0):f(!1)),function(){return a()}}),[O,e]);var p=function(t){return function(){e.push({pathname:"/manageuser/".concat(t.key),user:t})}};return Object(G.jsxs)(G.Fragment,{children:[b&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:a.container,children:Object(G.jsxs)(pt.a,{square:!0,children:[Object(G.jsx)(x.a,{className:a.title,variant:"h5",gutterBottom:!0,children:"Users"}),Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:a.nameTextField,value:l,onChange:function(e){d(e.target.value)}}),Object(G.jsx)(He.a,{className:a.list,children:r.filter((function(e){return e.admins.includes(O.key)||e.createdBy===O.key||"System Digital Manager"===O.role})).filter((function(e){return e.fullName.toLowerCase().includes(l.toLowerCase())})).sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e,t,n){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:p(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.firstName+" "+e.lastName,secondary:e.customRoleName})]})," ",t<n.length-1&&Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})]})}),Object(G.jsx)(Ct,{onClick:function(){e.push("/newuser")}})]}),!1===b&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{})]})}var Tt=a(1090),Ft=a(1056),Bt=a(1085),Dt=a(233),Rt=a.n(Dt);function Pt(){var e=Object(o.e)();return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(w.a,{onClick:function(){e.goBack()},component:"span",children:Object(G.jsx)(Rt.a,{})})})}var At=a(1062),Lt=a(1087),It=a(82),Ut=a.n(It),Wt=a(18),Mt=a(8),Ht=a(20),Kt=a(1063),Yt=Object(O.a)((function(e){return{margins:{marginLeft:e.spacing(.75),marginTop:e.spacing(.5)}}}));function zt(e){var t=Yt(),a=e.onClose,i=e.open,r=Object(n.useState)({addEditUsers:!1,uploadEditOwnVideo:!0,comment:!0,openMessage:!0,personalMessage:!1,viewCalendar:!0,editCalendar:!1,exportCalendar:!0,createOwnPlaylist:!0,analysis:!0,createSurveys:!1,shareFiles:!1,createProjects:!0}),c=Object(m.a)(r,2),s=c[0],o=c[1];Object(n.useEffect)((function(){o(e.permissions)}),[e.permissions]);var l=function(e){o(Object(at.a)(Object(at.a)({},s),{},Object(Ze.a)({},e.target.name,e.target.checked)))};return Object(G.jsx)(dt.a,{onClose:function(){a(s)},"aria-labelledby":"simple-dialog-title",open:i,maxWidth:"lg",fullWidth:!0,children:Object(G.jsxs)(Wt.a,{fluid:!0,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.addEditUsers,onChange:l,name:"addEditUsers",color:"primary"}),label:"Add/Edit Users",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.uploadEditOwnVideo,onChange:l,name:"uploadEditOwnVideo",color:"primary"}),label:"Upload/Edit Files",className:t.margins})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.comment,onChange:l,name:"comment",color:"primary"}),label:"Comment on Files",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.openMessage,onChange:l,name:"openMessage",color:"primary"}),label:"Open Message",className:t.margins})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.personalMessage,onChange:l,name:"personalMessage",color:"primary"}),label:"Personal Message",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.viewCalendar,onChange:l,name:"viewCalendar",color:"primary"}),label:"View Team / League Calander",className:t.margins})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.editCalendar,onChange:l,name:"editCalendar",color:"primary"}),label:"Edit Calendar",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.exportCalendar,onChange:l,name:"exportCalendar",color:"primary"}),label:"Export Calendar",className:t.margins})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.createOwnPlaylist,onChange:l,name:"createOwnPlaylist",color:"primary"}),label:"Create Own Playlists",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.analysis,onChange:l,name:"analysis",color:"primary"}),label:"Analysis Function",className:t.margins})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.createSurveys,onChange:l,name:"createSurveys",color:"primary"}),label:"Create Polls / Surveys",className:t.margins})}),Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.shareFiles,onChange:l,name:"shareFiles",color:"primary"}),label:"Share Files",className:t.margins})})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{md:4,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:s.createProjects,onChange:l,name:"createProjects",color:"primary"}),label:"Create Projects",className:t.margins})})})]})})}var Vt=a(194),Gt=a(140),qt=a.n(Gt),_t=Object(O.a)((function(e){return{position:{position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10}}}));function Xt(e){var t=_t();return Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.position,onClick:e.onClick,children:Object(G.jsx)(qt.a,{})})}function Zt(e){return Object(G.jsx)(lt.Email,{children:Object(G.jsxs)(lt.Content,{children:[Object(G.jsx)(lt.Header,{logo:"https://firebasestorage.googleapis.com/v0/b/nodiant-e20a8.appspot.com/o/180.png?alt=media&token=9821b2a9-1a70-4f63-a488-96377bb3a234"}),Object(G.jsx)(lt.Title,{children:"Complete Registration"}),Object(G.jsx)(lt.Paragraph,{children:""===e.userName?"You have been registered on the Nodiant Online Platform. To finalise the process, we need your consent.":"".concat(e.userName," has been registered on the Nodiant Online Platform. To finalise the process, we need your consent.")}),Object(G.jsx)(lt.CallToAction,{href:(e.userName,"https://nodiant.faw.cymru/".concat(e.path,"?key=").concat(e.userKey)),children:"Complete Registration"})]})})}function Qt(e){return Object(G.jsx)(lt.Email,{children:Object(G.jsxs)(lt.Content,{children:[Object(G.jsx)(lt.Header,{logo:"https://firebasestorage.googleapis.com/v0/b/nodiant-e20a8.appspot.com/o/180.png?alt=media&token=9821b2a9-1a70-4f63-a488-96377bb3a234"}),Object(G.jsx)(lt.Title,{children:"Complete Registration"}),Object(G.jsx)(lt.Paragraph,{children:"You have been registered on the Nodiant Online Platform."}),Object(G.jsx)(lt.Paragraph,{children:"To finalise the process, we need your consent."}),Object(G.jsx)(lt.CallToAction,{href:"https://nodiant.faw.cymru/".concat(e.path,"?key=").concat(e.userKey,"&email=").concat(e.email),children:"Complete Registration"})]})})}var Jt=a(19),$t=a(998),ea=a(1064),ta=a(1088),aa=a(304),na=a.n(aa),ia=a(553),ra=a.n(ia),ca=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2),flex:1},descendantRow:{marginLeft:50},infoText:{marginLeft:15,marginTop:10},text:{padding:e.spacing(2,2,0)},list:{marginBottom:e.spacing(2)},container:{paddingBottom:45},avatar:{width:"50px",height:"50px"},listText:{paddingLeft:e.spacing(1)},noHubsText:{marginTop:15,marginLeft:15}}})),sa=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function oa(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function la(e){var t=ca(),a=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b),c=r.folders,s=r.groups,o=Object(n.useState)([{name:"Hubs",key:"Root"}]),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)([]),b=Object(m.a)(j,2),f=b[0],O=b[1],y=Object(n.useState)(!1),v=Object(m.a)(y,2),k=v[0],N=v[1],S=Object(n.useState)([]),E=Object(m.a)(S,2),T=E[0],F=E[1],R=Object(n.useState)(!1),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)("error"),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(""),K=Object(m.a)(H,2),Y=K[0],z=K[1];Object(n.useEffect)((function(){if(!e.open){F(e.selectedHubs);var t=c.filter((function(e){return e.hub&&"Root"===e.parent}));if(0===(t=t.sort((function(e,t){return e.name>t.name?1:-1}))).length?N(!0):N(!1),a&&"System Digital Manager"===a.role)O(t);else{var n=[];t.forEach((function(e){c.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(a.key)&&(n.includes(e)||n.push(e))}))})),O(n)}}}),[a,e.selectedHubs,c,e.open]);var V=function(e){return function(){u((function(t){return[].concat(Object(Jt.a)(t),[{name:e.name,key:e.key}])}));var t=c.filter((function(t){return t.hub&&t.parent===e.key}));if(0===(t=t.sort((function(e,t){return e.name>t.name?1:-1}))).length?N(!0):N(!1),a&&"System Digital Manager"===a.role)O(t);else{var n=[];t.forEach((function(e){c.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(a.key)&&(n.includes(e)||n.push(e))}))})),O(n)}}},q=function(e){return function(){var t=0;for(t=0;t<d.length;t++){if(d[t].key===e.key)break}var n=Object(Jt.a)(d);n.length=t+1,u(n);var i=c.filter((function(t){return t.hub&&t.parent===e.key}));if(0===(i=i.sort((function(e,t){return e.name>t.name?1:-1}))).length?N(!0):N(!1),a&&"System Digital Manager"===a.role)O(i);else{var r=[];i.forEach((function(e){c.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(a.key)&&(r.includes(e)||r.push(e))}))})),O(r)}}},_=function(){"newuser"!==e.userKey&&(c.forEach((function(t){if(t.hub){var a={};t.users.forEach((function(t){t!==e.userKey&&(a[t]=!0)})),function(e){if(T.filter((function(t){return t.key===e.key})).length>0)return!0;for(var t=function(t){var a=e.ancestors[t];if(T.filter((function(e){return e.key===a})).length>0)return{v:!0}},a=0;a<e.ancestors.length;a++){var n=t(a);if("object"===typeof n)return n.v}return!1}(t)&&(a[e.userKey]=!0),D.b.database().ref("folders").child(t.key).update({users:a});var n=s.filter((function(e){return e.hub===t.key&&"All Users"===e.name}))[0];if(n)D.b.database().ref("groups").child(n.key).update({users:a})}})),c.filter((function(e){return e.hub})).forEach((function(t){T.includes(t)?t.groups&&t.groups.forEach((function(t){var a=D.b.database().ref("groups").child(t.key);t.users.forEach((function(t){"newuser"===t.key&&(t.key=e.userKey)})),a.update({users:Object(be.k)(t.users)})})):t.groups&&t.groups.forEach((function(t){var a=D.b.database().ref("groups").child(t.key),n={};t.users&&t.users.forEach((function(t){t.key!==e.userKey&&(n[t.key]=!0)})),a.update({users:n})}))}))),e.onClose(T)};var X=function(e){return function(){var t,a=!0;if(e.ancestors.forEach((function(e){T.filter((function(t){return t.key===e})).length>0&&(a=!1)})),!a)return t="The user is a member of a hub higher in the hierarchy",M("error"),z(t),void L(!0);var n=c.filter((function(t){return t.hub&&t.ancestors.includes(e.key)})),i=[];T.forEach((function(t){t.key!==e.key&&0===n.filter((function(e){return e.key===t.key})).length&&i.push(t)})),F(i)}};function Z(e){return!e.managers.includes(a.key)&&"System Digital Manager"!==a.role}var Q=function(e,t){"clickaway"!==t&&L(!1)};return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:_,"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,fullWidth:!0,TransitionComponent:sa,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:_,"aria-label":"close",children:Object(G.jsx)(qt.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:1===T.length?T.length+" Hub Selected":T.length+" Hubs Selected"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsx)("p",{className:t.infoText,children:"Adding the user to a hub also adds them to any hubs lower in the hierarchy"}),Object(G.jsx)("p",{className:t.infoText,children:"The user cannot be removed from a hub if they are a member of a hub higher in the hierarchy"}),Object(G.jsx)("div",{className:t.container,children:Object(G.jsxs)(pt.a,{square:!0,children:[Object(G.jsx)(ta.a,{separator:"\u203a","aria-label":"breadcrumb",className:t.text,children:d.map((function(e){return Object(G.jsx)(it.a,{href:"#",onClick:q(e),children:e.name},e.key)}))}),k&&Object(G.jsx)("h5",{className:t.noHubsText,children:"There are no hubs at this level yet"}),Object(G.jsx)(He.a,{className:t.list,children:f.map((function(e,a,n){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:V(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"hubs",variant:"rounded"})}),Object(G.jsx)(ze.a,{primary:e.name,className:t.listText,secondary:Z(e)&&"You are not a manager of this hub"}),Object(G.jsx)(ea.a,{children:T.filter((function(t){return t.key===e.key})).length>0?Object(G.jsx)(C.a,{title:"Remove user from hub",children:Object(G.jsx)(w.a,{onClick:X(e),color:"secondary",disabled:Z(e),children:Object(G.jsx)(ra.a,{})})}):Object(G.jsx)(C.a,{title:"Add user to hub",children:Object(G.jsx)(w.a,{onClick:(r=e,function(){var e=c.filter((function(e){return e.hub&&e.ancestors.includes(r.key)})),t=[].concat(Object(Jt.a)(T),[r]);e.forEach((function(e){0===T.filter((function(t){return t.key===e.key})).length&&t.push(e)})),F(t)}),color:"primary",disabled:Z(e),children:Object(G.jsx)(na.a,{})})})})]}),a<n.length-1&&Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key);var r}))})]})}),Object(G.jsx)(st.a,{open:A,autoHideDuration:6e3,onClose:Q,children:Object(G.jsx)(oa,{onClose:Q,severity:W,children:Y})})]})}var da=a(596),ua=a(594),ja=a(595),ba=a(593);function fa(e){var t=Object(n.useState)(""),a=Object(m.a)(t,2),i=a[0],r=a[1],c=Object(n.useState)(!1),s=Object(m.a)(c,2),o=s[0],l=s[1];function d(){e.dismiss(),r("")}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:d,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Account Recovery"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"If the user has forgotten their password AND no longer has access to their email address. You can recover the account by entering a new email address here:"}),Object(G.jsx)(nt.a,{value:i,onChange:function(e){r(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"New email address",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:d,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){""!==i&&(l(!0),D.b.functions().httpsCallable("updateUser")({uid:e.user.uid,user:{email:i}}).then((function(){D.b.functions().httpsCallable("generateEmailActionLink")({email:i}).then((function(t){!function(e){D.b.functions().httpsCallable("sendMail")({dest:i,sender:"Nodiant Online <no.reply.nodiant@gmail.com>",subject:"Choose your Nodiant Online Password",html:Object(lt.render)(Object(G.jsx)(jt,{link:e,message:"Your account on the Nodiant Online platform has been recovered."}))}).then((function(){console.log("Email Sent")})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}(t.data.link),D.b.database().ref("users").child(e.user.key).update({email:i}),e.onClose(!0,"",i),r(""),l(!1)}))})).catch((function(t){var a=t.code,n=t.message;console.log(a+":"+n),e.onClose(!1,n,i),l(!1),r("")})))},color:"primary",children:"OK"})]}),o&&Object(G.jsx)(ut.a,{})]})})}var ha=Object(O.a)((function(e){return{root:{textAlign:"center"},appBar:{position:"relative"},title:{flexGrow:1,marginTop:10},button:{marginBottom:10,marginRight:10}}})),ma=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Oa(e){var t=ha(),a=Object(n.useContext)(h.d).currentUserData,i=Object(o.e)();return Object(G.jsx)(dt.a,{onClose:e.onClose,open:e.open,TransitionComponent:ma,children:Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.title,children:"Duplicate User"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("span",{children:"The email address "+e.user.email+" is already in use by the following user:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("div",{className:t.listItem,children:Object(G.jsxs)(Ke.a,{alignItems:"center",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e.user,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{className:t.listText,primary:e.user.firstName+" "+e.user.lastName,secondary:e.user.customRoleName})]})},e.user.key)}),Object(G.jsx)(K.a,{variant:"outlined",className:t.button,onClick:e.onClose,children:"Cancel"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",className:t.button,onClick:function(){var t={};e.user.admins.forEach((function(e){t[e]=!0})),t[a.key]=!0,D.b.database().ref("users").child(e.user.key).update({admins:t}),i.replace("manageuser/"+e.user.key)},children:"Become Administrator"})]})})})}var pa=a(1065),ga=Object(O.a)((function(e){return{root:{textAlign:"center"},title:{marginTop:15,marginLeft:15,marginRight:15},subtitle:{marginLeft:15,marginRight:15,marginBottom:5},doneButton:{marginTop:10,marginBottom:10,marginLeft:"33.3%",width:"33.3%"}}}));function xa(e){var t=ga(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)([]),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)([]),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1];Object(n.useEffect)((function(){a&&(e.hub.managers.includes(a.key)||"System Digital Manager"===a.role)&&O(!0),s(Object(Jt.a)(e.hub.groups)),u(e.hub.groups.filter((function(t){return function(t){if(t.users.filter((function(t){return t.key===e.userKey})).length>0)return!0;return!1}(t)})))}),[e,a]);return Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,className:t.root,children:[Object(G.jsx)("h4",{className:t.title,children:e.hub.name+" - Groups"}),1===c.length?Object(G.jsx)("span",{className:t.subtitle,children:"This hub doesn't have any groups"}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("span",{className:t.subtitle,children:"Choose groups for this user:"}),Object(G.jsx)(xe.a,{})]}),Object(G.jsx)(He.a,{style:{padding:0},children:c.filter((function(e){return"All Users"!==e.name})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(t){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{alignItems:"flex-start",children:[Object(G.jsx)(ze.a,{primary:t.name,secondary:!f&&"You are not a manager of this hub"}),Object(G.jsx)(ea.a,{children:Object(G.jsx)(Lt.a,{edge:"end",onChange:(a=t,function(){if(d.includes(a)){if(e.didRemove(a),u(d.filter((function(e){return e!==a}))),"newuser"!==e.userKey){var t=D.b.database().ref("groups").child(a.key),n={};a.users.forEach((function(t){t.key!==e.userKey&&(n[t.key]=!0)})),t.update({users:n})}}else if(u([].concat(Object(Jt.a)(d),[a])),e.didAdd(a),"newuser"!==e.userKey){var i=D.b.database().ref("groups").child(a.key),r=Object(be.k)(a.users);r[e.userKey]=!0,i.update({users:r})}}),checked:d.includes(t),inputProps:{"aria-labelledby":t.key},disabled:!f})})]},Object(be.m)(10)),Object(G.jsx)(xe.a,{})]});var a}))}),Object(G.jsx)(K.a,{onClick:function(){e.onClose()},variant:"contained",color:"primary",className:t.doneButton,children:"Done"})]})}function ya(e){function t(){e.onClose(!1)}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:t,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:e.message})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:t,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){e.onClose(!0)},color:"primary",children:"Delete"})]}),e.inProgress&&Object(G.jsx)(ut.a,{})]})})}function va(e){function t(){e.onClose(!1)}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:t,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:e.message})}),Object(G.jsx)(da.a,{children:Object(G.jsx)(K.a,{onClick:t,color:"primary",children:"OK"})})]})})}var ka=Object(O.a)((function(e){return{root:{paddingBottom:100},buttonProgress:{color:"rgb(244, 36, 29)",position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10},inputMargin:{margin:e.spacing(1),flex:1},title:{paddingTop:10},sectionHeading:{paddingTop:5,paddingLeft:10},under18Checkbox:{paddingLeft:20},hubTile:{maxWidth:140,cursor:"pointer"},hubAvatar:{paddingLeft:47},hubLabel:{textAlign:"center",width:140,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},deleteButton:{position:"absolute",left:"auto",right:10},editHubsButton:{marginTop:e.spacing(2),marginLeft:10},consentText:{color:"rgb(100, 100, 100)",paddingLeft:10},recoveryButton:{margin:10},noHubsLabel:{color:"rgb(100, 100, 100)",marginLeft:10}}}));function Ca(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function wa(){var e=Object(o.f)(),t=ka(),a=Object(o.e)(),i=Object(n.useState)({}),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)("newuser"),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(""),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(""),y=Object(m.a)(g,2),v=y[0],k=y[1],N=Object(n.useState)(""),S=Object(m.a)(N,2),T=S[0],F=S[1],R=Object(n.useState)(""),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(""),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(""),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(""),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(""),ae=Object(m.a)(te,2),re=ae[0],ce=ae[1],se=Object(n.useState)(""),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=Object(n.useState)(""),je=Object(m.a)(ue,2),fe=je[0],he=je[1],me=Object(n.useState)(""),Oe=Object(m.a)(me,2),pe=Oe[0],ge=Oe[1],xe=Object(n.useState)(!1),ye=Object(m.a)(xe,2),ve=ye[0],ke=ye[1],Ce=Object(n.useState)({}),we=Object(m.a)(Ce,2),Ne=we[0],Se=we[1],Ee=Object(n.useState)(!1),Te=Object(m.a)(Ee,2),Fe=Te[0],Be=Te[1],De=Object(n.useState)(!1),Re=Object(m.a)(De,2),Pe=Re[0],Ae=Re[1],Le=Object(n.useState)(!1),Ie=Object(m.a)(Le,2),Ue=Ie[0],We=Ie[1],Me=Object(n.useState)("error"),He=Object(m.a)(Me,2),Ke=He[0],Ye=He[1],ze=Object(n.useState)(""),Ve=Object(m.a)(ze,2),Ge=Ve[0],qe=Ve[1],_e=Object(n.useState)(!1),Xe=Object(m.a)(_e,2),Ze=Xe[0],Qe=Xe[1],Je=Object(n.useState)(!1),et=Object(m.a)(Je,2),tt=et[0],it=et[1],rt=Object(n.useState)(!1),ot=Object(m.a)(rt,2),dt=ot[0],ut=ot[1],bt=Object(n.useState)(!1),ft=Object(m.a)(bt,2),ht=ft[0],mt=ft[1],Ot=Object(n.useState)(!1),pt=Object(m.a)(Ot,2),gt=pt[0],xt=pt[1],yt=Object(n.useState)(!1),vt=Object(m.a)(yt,2),kt=vt[0],Ct=vt[1],wt=Object(n.useState)(!1),St=Object(m.a)(wt,2),Et=St[0],Dt=St[1],Rt=Object(n.useContext)(h.b),It=Rt.users,Kt=Rt.userLogins,Yt=Rt.files,Gt=Rt.folders,qt=Rt.comments,_t=Rt.conversations,Jt=Rt.groups,$t=Rt.userConsent,ea=Object(n.useState)(),ta=Object(m.a)(ea,2),aa=ta[0],na=ta[1],ia=Object(n.useContext)(h.d).currentUserData,ra=Object(n.useState)([]),ca=Object(m.a)(ra,2),sa=ca[0],oa=ca[1],da=Object(n.useState)([]),ua=Object(m.a)(da,2),ja=ua[0],ba=ua[1],ha=Object(n.useState)(),ma=Object(m.a)(ha,2),ga=ma[0],wa=ma[1],Na=Object(n.useState)(),Sa=Object(m.a)(Na,2),Ea=Sa[0],Ta=Sa[1],Fa=Object(n.useState)(!1),Ba=Object(m.a)(Fa,2),Da=Ba[0],Ra=Ba[1],Pa=Object(n.useState)(),Aa=Object(m.a)(Pa,2),La=Aa[0],Ia=Aa[1],Ua=Object(n.useState)(""),Wa=Object(m.a)(Ua,2),Ma=Wa[0],Ha=Wa[1],Ka=Object(n.useState)(!1),Ya=Object(m.a)(Ka,2),za=Ya[0],Va=Ya[1],Ga=Object(n.useState)(""),qa=Object(m.a)(Ga,2),_a=qa[0],Xa=qa[1],Za=Object(n.useState)(""),Qa=Object(m.a)(Za,2),Ja=Qa[0],$a=Qa[1];function en(e){var t=!1,a=!1,n=!1,i=!1,r=!1,c=!1,s=!1,o=!1,l=!1,d=!1,u=!1,j=!1,b=!0;"System Digital Manager"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0,j=!0):"FAW Team Ops"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,u=!0,j=!0):"FAW Analyst"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0,j=!0):"FAW Coach"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0):"FAW Support Staff"===e?(a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,u=!0,j=!0):"FAW Coach Educator"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0):"FAW Coach Ed Student"===e?(n=!0,i=!0,c=!0,o=!0,l=!0,d=!0,b=!1):"FAW Player"===e?(a=!0,n=!0,i=!0,c=!0,o=!0,l=!0,d=!0):"FAW Parent"===e?(a=!0,n=!0,i=!0,r=!0,c=!0,o=!0):"Club Digital Manager"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0,j=!0):"Club Administrator"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,u=!0,j=!0):"Club Analyst"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0,j=!0):"Club Coach"===e||"Club Coach Educator"===e?(t=!0,a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,l=!0,d=!0,u=!0):"Club Coach Ed Student"===e?(n=!0,i=!0,c=!0,o=!0,l=!0,d=!0,b=!1):"Club Player"===e?(a=!0,n=!0,i=!0,c=!0,o=!0,l=!0,d=!0):"Club Parent"===e?(a=!0,n=!0,i=!0,r=!0,c=!0,o=!0):"Club Support Staff"===e?(a=!0,n=!0,i=!0,r=!0,c=!0,s=!0,o=!0,u=!0,j=!0):"Referee"===e?(a=!0,n=!0,i=!0,c=!0,o=!0,l=!0,d=!0,u=!0,j=!0):"Referee Assessor"===e&&(a=!0,n=!0,i=!0,r=!0,c=!0,o=!0,l=!0,d=!0,u=!0,j=!0),Se({addEditUsers:t,uploadEditOwnVideo:a,comment:n,openMessage:i,personalMessage:r,viewCalendar:c,editCalendar:s,exportCalendar:o,createOwnPlaylist:l,analysis:d,createSurveys:u,shareFiles:j,createProjects:b})}function tn(e){var t=e.target.value;"firstName"===e.target.id?p(t):"lastName"===e.target.id?k(t):"email"===e.target.id?F(t):"phone"===e.target.id?L(t):"parentEmail"===e.target.id?de(t):"parentPhone"===e.target.id?he(t):"parentFirstName"===e.target.id?ee(t):"parentLastName"===e.target.id?ce(t):"role"===e.target.id?(V(t),en(e.target.value)):"customRoleName"===e.target.id&&Z(t)}Object(n.useEffect)((function(){var t=D.b.auth().onAuthStateChanged((function(t){t||a.replace("/signin?url="+e.pathname)}));if(ia&&ia.permissions)if(na(!0),e.pathname.includes("newuser")){if(!ia.permissions.addEditUsers)return void a.goBack();if("FAW Coach Educator"===ia.role){var n="";""===z?(V(n="FAW Coach Ed Student"),en(n)):n=z,s((function(e){return Object(at.a)(Object(at.a)({},e),{},{role:n,key:"newuser"})}))}if("Club Coach Educator"===ia.role){var i="";""===z?(V(i="Club Coach Ed Student"),en(i)):i=z,s((function(e){return Object(at.a)(Object(at.a)({},e),{},{role:i,key:"newuser"})}))}else if(hn()){var r="";""===z?(V(r="Club Player"),en(r)):r=z,s((function(e){return Object(at.a)(Object(at.a)({},e),{},{role:r,key:"newuser"})}))}else if(fn()||"System Digital Manager"===ia.role){var c="";""===z?(V(c="FAW Player"),en(c)):c=z,s((function(e){return Object(at.a)(Object(at.a)({},e),{},{role:c,key:"newuser"})}))}else{var o="";""===z?(V(o="FAW Player"),en(o)):o=z,s((function(e){return Object(at.a)(Object(at.a)({},e),{},{role:o,key:"newuser"})}))}oa(Gt.filter((function(e){return e.hub}))),ba(Gt.filter((function(e){return"RhDWyGntB2ZjyoI1HEj"===e.key||e.ancestors.includes("RhDWyGntB2ZjyoI1HEj")})))}else{var l=e.pathname.replace("/manageuser/",""),d=It.filter((function(e){return e.key===l}))[0];if(d){ke(!0);var u=!1,b=!1;if(ia.permissions.addEditUsers&&("System Digital Manager"===ia.role||d.createdBy===ia.key||d.admins&&d.admins.includes(ia.key))&&(u=!0,b=!0),Ae(b),na(u),!u)return void a.goBack();if(""===T){j(d.key),p(d.firstName),k(d.lastName),F(d.email),L(d.phone),ge(d.imageURL),V(d.role),Z(d.customRoleName),ee(d.parentFirstName),ce(d.parentLastName),de(d.parentEmail),he(d.parentPhone),s(d),d.under18?M(!0):M(!1);var f=Kt.filter((function(e){return e.key===d.key}))[0];f&&Ha(f.lastLogin);var h=$t.filter((function(e){return e.key===d.key}))[0];h&&(h.hasConsent?Ia(!0):Ia(!1))}var m=[],O=[];if(Gt.forEach((function(e){e.hub&&(m.push(e),e.users.includes(d.key)&&(e.groups=Jt.filter((function(t){return t.hub===e.key})),O.push(e)))})),oa(m),ba(O),d.permissions){var g={addEditUsers:d.permissions.addEditUsers,uploadEditOwnVideo:d.permissions.uploadEditOwnVideo,comment:d.permissions.comment,openMessage:d.permissions.openMessage,personalMessage:d.permissions.personalMessage,viewCalendar:d.permissions.viewCalendar,editCalendar:d.permissions.editCalendar,exportCalendar:d.permissions.exportCalendar,createOwnPlaylist:d.permissions.createOwnPlaylist,analysis:d.permissions.analysis,createSurveys:d.permissions.createSurveys,shareFiles:d.permissions.shareFiles,createProjects:d.permissions.createProjects};""===T&&Se(g)}}}return function(){return t()}}),[c.permissions,e.pathname,c.createdBy,a,Gt,Jt,It,ia]);var an=function(e,t){"clickaway"!==t&&Qe(!1)};function nn(e){var t=D.b.functions().httpsCallable("sendMail"),a="userconsent";"FAW Coach Educator"===z||"FAW Coach Ed Student"===z?a="coachedconsent":z.includes("Club")&&(a="clubuserconsent"),t({dest:T,sender:"Nodiant Online <no.reply.nodiant@gmail.com>",subject:"Nodiant Online Consent Form",html:Object(lt.render)(Object(G.jsx)(Qt,{userKey:e,path:a,email:T}))}).then((function(){console.log("Combined Consent and Password Email Sent")})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}function rn(e,t){var a="";a="parent"===t?le:T;var n="consent";z.includes("Club")&&(n="clubconsent"),D.b.functions().httpsCallable("sendMail")({dest:a,sender:"Nodiant Online <no.reply.nodiant@gmail.com>",subject:"Nodiant Online Consent Form",html:Object(lt.render)(Object(G.jsx)(Zt,{userKey:e,path:n,userName:"parent"===t?O+" "+v:""}))}).then((function(){console.log("Consent Email Sent")})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}function cn(e){D.b.functions().httpsCallable("sendMail")({dest:T,sender:"Nodiant Online <no.reply.nodiant@gmail.com>",subject:"Choose your Nodiant Online Password",html:Object(lt.render)(Object(G.jsx)(jt,{link:e,message:"Your password has been reset on the Nodiant Online Platform"}))}).then((function(){console.log("Password Email Sent")})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}function sn(){return(sn=Object(ie.a)(ne.a.mark((function e(){var t,n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:We(!0),t=D.b.initializeApp(D.a,Object(be.m)(15)),n=Object(be.m)(15),t.auth().createUserWithEmailAndPassword(T,n).then((function(e){console.log("Registered User on auth, creating in database");var t=e.user.uid;j(t),jn(t).then((function(e){var n=D.b.database().ref("users"),i=X;""===i&&(i=z),n.child(t).set({uid:t,email:T,phone:A,firstName:O,lastName:v,imageURL:e,role:z,permissions:Ne,parentFirstName:$,parentLastName:re,parentEmail:le,parentPhone:fe,customRoleName:i,admins:dn(),under18:W,createdBy:ia.key}),D.b.database().ref("userlogin").child(t).set({lastLogin:"never"});var r=D.b.database().ref("userconsent"),c=D.b.functions().httpsCallable("generateEmailActionLink");W?(r.child(t).set({uid:t,name:$+" "+re,hasConsent:!1}),rn(t,"parent"),c({email:T}).then((function(e){cn(e.data.link)}))):(r.child(t).set({uid:t,name:O+" "+v,hasConsent:!1}),nn(t)),un(t),We(!1),qe("User Added Successfully"),Ye("success"),Qe(!0),a.goBack()}))})).catch((function(e){var t=e.code,a=e.message;if("auth/email-already-in-use"===t){var n=It.filter((function(e){return e.email===T}))[0];n&&"Player"===n.role?(wa(It.filter((function(e){return e.email===T}))[0]),mt(!0)):(qe(e.message),Ye("error"),Qe(!0))}else qe(e.message),Ye("error"),Qe(!0);console.log(t+":"+a),We(!1)}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function on(){return(on=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(We(!0),!tt){e.next=6;break}return e.next=4,jn(u).then((function(e){ln(e),ve||un(u),We(!1),a.goBack()}));case 4:e.next=10;break;case 6:ln(pe),ve||un(u),We(!1),a.goBack();case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ln(e){var t=D.b.database().ref("users"),a=X;""===a&&(a=z);var n=c.firstName+" "+c.lastName;t.child(u).update({firstName:O,lastName:v,phone:A,role:z,permissions:Ne,imageURL:e,parentFirstName:$,parentLastName:re,parentPhone:fe,parentEmail:le,customRoleName:a,admins:dn(),under18:W}).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),We(!1),qe(e.message),Ye("error"),Qe(!0)})),n!==O+" "+v&&function(){var e=O+" "+v;qt.forEach((function(t){t.user===u&&D.b.database().ref("comments").child(t.key).update({author:e})})),_t.forEach((function(t){t.messages.forEach((function(a){a.user===u&&D.b.database().ref("conversations").child(t.key).child("messages").child(a.key).update({fullName:e})}))}))}()}function dn(){var e={};return ja.forEach((function(t){t.managers.forEach((function(t){e[t]=!0}))})),e}function un(e){Gt.forEach((function(t){if(t.hub){var a={};t.users.forEach((function(t){t!==e&&(a[t]=!0)})),function(e){if(ja.filter((function(t){return t.key===e.key})).length>0)return!0;for(var t=function(t){var a=e.ancestors[t];if(ja.filter((function(e){return e.key===a})).length>0)return{v:!0}},a=0;a<e.ancestors.length;a++){var n=t(a);if("object"===typeof n)return n.v}return!1}(t)&&(a[e]=!0),D.b.database().ref("folders").child(t.key).update({users:a});var n=Jt.filter((function(e){return e.hub===t.key&&"All Users"===e.name}))[0];if(n)D.b.database().ref("groups").child(n.key).update({users:a})}})),sa.forEach((function(t){ja.includes(t)?t.groups&&t.groups.forEach((function(t){var a=D.b.database().ref("groups").child(t.key);t.users.forEach((function(t){"newuser"===t.key&&(t.key=e)})),a.update({users:Object(be.k)(t.users)})})):ve&&t.groups&&t.groups.forEach((function(e){var t=D.b.database().ref("groups").child(e.key),a={};e.users&&e.users.forEach((function(e){e.key!==u&&(a[e.key]=!0)})),t.update({users:a})}))}))}function jn(e){return new Promise((function(t,a){if(c.avatarEditor){var n=D.b.storage();c.avatarEditor.getImageScaledToCanvas().toBlob((function(i){var r=n.ref().child("avatars/users/"+e+"/avatar.png");r.put(i).then((function(e){console.log("Upload Successful"),c.avatar=null,r.getDownloadURL().then((function(e){t(e)}))})).catch((function(e){var t=e.code,n=e.message;console.log(t+":"+n),We(!1),qe(e.message),Ye("error"),Qe(!0),a()}))}))}else t("none")}))}var bn=function(e){return function(){Ta(e),Dt(!0)}};function fn(){return"FAW Team Ops"===ia.role||"FAW Analyst"===ia.role||"FAW Coach"===ia.role||"FAW Coach Educator"===ia.role||"Administrator"===ia.role}function hn(){return"Club Digital Manager"===ia.role||"Club Administrator"===ia.role||"Club Analyst"===ia.role||"Club Coach"===ia.role||"Club Coach Educator"===ia.role}return Object(G.jsxs)(G.Fragment,{children:[aa&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Pt,{}),Pe&&Object(G.jsx)(w.a,{className:t.deleteButton,edge:"end",color:"inherit",onClick:function(){Ra(!0)},children:Object(G.jsx)(Ut.a,{})}),!ve&&Object(G.jsx)(x.a,{className:t.title,variant:"h5",gutterBottom:!0,children:"New User"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Vt.a,{recipient:c,didChangeAvatar:function(){it(!0)},path:"users"})}),!1===La&&Object(G.jsx)(Mt.a,{children:Object(G.jsx)("p",{className:t.consentText,children:"Hasn't signed consent form"})}),""!==Ma&&"newuser"!==u&&Object(G.jsx)(Mt.a,{children:Object(G.jsxs)("p",{className:t.consentText,children:["Last Login: ",Ma]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.sectionHeading,children:"User Details"})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(nt.a,{id:"firstName",label:"First Name",variant:"outlined",value:O,onChange:tn,className:t.inputMargin}),Object(G.jsx)(nt.a,{id:"lastName",label:"Last Name",variant:"outlined",value:v,onChange:tn,className:t.inputMargin})]}),Object(G.jsxs)(Mt.a,{children:[ve?Object(G.jsx)(nt.a,{id:"email",label:"E-mail",variant:"outlined",value:T,onChange:tn,className:t.inputMargin,fullWidth:!0,disabled:!0}):Object(G.jsx)(nt.a,{id:"email",label:"E-mail",variant:"outlined",value:T,onChange:tn,className:t.inputMargin,fullWidth:!0}),Object(G.jsx)(nt.a,{id:"phone",label:"Mobile Number",variant:"outlined",value:A,onChange:tn,className:t.inputMargin,fullWidth:!0})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.under18Checkbox,checked:W,onChange:function(e){M(e.target.checked)},name:"checkboxThree",color:"primary"}),label:"Under 18"})}),W&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.sectionHeading,children:"Parent / Carer / Guardian Details"})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(nt.a,{id:"parentFirstName",label:"First Name",variant:"outlined",value:$,onChange:tn,className:t.inputMargin}),Object(G.jsx)(nt.a,{id:"parentLastName",label:"Last Name",variant:"outlined",value:re,onChange:tn,className:t.inputMargin})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(nt.a,{id:"parentEmail",label:"E-mail",variant:"outlined",value:le,onChange:tn,className:t.inputMargin,fullWidth:!0}),Object(G.jsx)(nt.a,{id:"parentPhone",label:"Mobile Number",variant:"outlined",value:fe,onChange:tn,className:t.inputMargin,fullWidth:!0})]})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.sectionHeading,children:"User Profile"})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ft.a,{variant:"outlined",className:t.inputMargin,children:[Object(G.jsx)(Tt.a,{htmlFor:"outlined-user-role-native-simple",children:"Role"}),Object(G.jsx)(Bt.a,{native:!0,value:z,onChange:tn,label:"Role",inputProps:{name:"role",id:"role"},children:("System Digital Manager"===ia.role?["System Digital Manager","FAW Team Ops","FAW Analyst","FAW Coach","FAW Support Staff","FAW Coach Educator","FAW Coach Ed Student","FAW Player","FAW Parent","Club Digital Manager","Club Administrator","Club Analyst","Club Coach","Club Coach Educator","Club Coach Ed Student","Club Player","Club Parent","Club Support Staff","Referee","Referee Assessor"]:fn()?["FAW Team Ops","FAW Analyst","FAW Coach","FAW Support Staff","FAW Coach Educator","FAW Coach Ed Student","FAW Player","FAW Parent","Club Digital Manager","Club Administrator","Club Analyst","Club Coach","Club Coach Educator","Club Coach Ed Student","Club Player","Club Parent","Club Support Staff","Referee","Referee Assessor"]:hn()?["Club Digital Manager","Club Administrator","Club Analyst","Club Coach","Club Coach Educator","Club Coach Ed Student","Club Player","Club Parent","Club Support Staff"]:["FAW Player"]).map((function(e){return Object(G.jsx)("option",{value:e,children:e})}))})]}),Object(G.jsx)(w.a,{edge:"end",color:"inherit",onClick:function(){ut(!0)},children:Object(G.jsx)(E.a,{})})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.inputMargin,id:"customRoleName",label:"Custom Role Name (Optional)",variant:"outlined",fullWidth:!0,value:X,onChange:tn})}),ve&&Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){xt(!0)},className:t.recoveryButton,children:"Account Recovery"}),Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){D.b.functions().httpsCallable("generateEmailActionLink")({email:c.email}).then((function(e){cn(e.data.link)})).catch((function(e){console.log("Error"),console.log(e),console.log(e.code),console.log(e.message),console.log(e.details)})),qe("Password email sent"),Ye("success"),Qe(!0)},className:t.recoveryButton,children:"Send Password email"}),Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){W?(rn(u,"parent"),qe("Consent email sent to parent")):(nn(u),qe("Consent email sent"),Ye("success"),Qe(!0)),Ye("success"),Qe(!0)},className:t.recoveryButton,children:"Send Consent email"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.sectionHeading,children:"Hubs & Groups"})}),Object(G.jsxs)(Mt.a,{children:[0===ja.length&&Object(G.jsx)("span",{className:t.noHubsLabel,children:"This user has not been added to any hubs"}),Object(G.jsx)(pa.a,{max:50}),ja.sort((function(e,t){return e.ancestors.length>t.ancestors.length?1:e.ancestors.length<t.ancestors.length?-1:0})).map((function(e){return Object(G.jsx)(C.a,{title:"Click to edit groups",children:Object(G.jsxs)(Ht.a,{className:t.hubTile,onClick:bn(e),children:[Object(G.jsx)(Mt.a,{className:t.hubAvatar,children:Object(G.jsx)(B.a,{userOrHub:e,path:"hubs",variant:"rounded"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("span",{className:t.hubLabel,children:e.name})})]},e.key)})}))]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){Ct(!0)},className:t.editHubsButton,children:"Edit Hubs"})}),Object(G.jsx)(zt,{open:dt,onClose:function(e){Se(e),ut(!1)},permissions:Ne}),Object(G.jsx)(Xt,{onClick:function(){return void 0===Ne?($a("Cannot Save User"),Xa("Please select a role for the new user"),void Va(!0)):""===O||""===v?($a("Cannot Save User"),Xa("You need to set a First Name and Last Name for the User"),void Va(!0)):!W||""!==$&&""!==re?void(ve?function(){on.apply(this,arguments)}():function(){sn.apply(this,arguments)}()):($a("Cannot Save User"),Xa("You need to set a First Name and Last Name for the Parent / Carer / Guardian"),void Va(!0))}}),Object(G.jsx)($e,{}),Ue&&Object(G.jsx)(ct.a,{size:56,className:t.buttonProgress}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:Ze,autoHideDuration:6e3,onClose:an,children:Object(G.jsx)(Ca,{onClose:an,severity:Ke,children:Ge})})})]})}),Object(G.jsx)(la,{open:kt,onClose:function(e){Ct(!1),e.forEach((function(e){e.groups=Jt.filter((function(t){return t.hub===e.key}));var t=e.groups.filter((function(e){return"All Users"===e.name}))[0];t&&t.users.push({key:u})})),ba(e)},selectedHubs:ja,hubs:sa,userKey:u}),Object(G.jsx)(fa,{open:gt,onClose:function(e,t,a){xt(!1),e?(qe("Account Reset Successfully"),Ye("success"),Qe(!0),F(a)):(qe(t),Ye("error"),Qe(!0))},dismiss:function(){xt(!1)},user:c}),Ea&&Object(G.jsx)(xa,{open:Et,onClose:function(){Ta(null),Dt(!1)},didAdd:function(e){Ea&&(Ea.groups.forEach((function(t){t.key===e.key&&t.users.push(c)})),Ta(Ea))},didRemove:function(e){Ea&&(Ea.groups.forEach((function(t){t.key===e.key&&(t.users=t.users.filter((function(e){return e.key!==u})))})),Ta(Ea))},hub:Ea,userKey:u}),ga&&Object(G.jsx)(Oa,{open:ht,onClose:function(){mt(!1)},user:ga}),Da&&Object(G.jsx)(ya,{title:"Delete User",message:"Are you sure you want to delete this user?",open:Da,onClose:function(e){!0===e&&ia?(Be(!0),D.b.functions().httpsCallable("deleteUser")({uid:c.uid,user:{email:T}}).then((function(){Jt.forEach((function(e){if(e.users.filter((function(e){return e.key===c.key})).length>0){var t=D.b.database().ref("groups").child(e.key),a=Object(be.k)(e.users.filter((function(e){return e.key!==c.key})));t.update({users:a})}})),Yt.forEach((function(e){if(e.managers.includes(c.key)){var t=D.b.database().ref("files").child(e.key),a=Object(be.k)(e.managers.filter((function(e){return e!==c.key})));t.update({managers:a})}})),Gt.forEach((function(e){if(e.managers.includes(c.key)){var t=D.b.database().ref("folders").child(e.key),a=Object(be.k)(e.managers.filter((function(e){return e!==c.key})));t.update({managers:a})}if(e.users.includes(c.key)){console.log("User is folder user: "+e.key);var n=D.b.database().ref("folders").child(e.key),i=Object(be.k)(e.users.filter((function(e){return e!==c.key})));n.update({users:i})}})),D.b.database().ref("userlogin").child(c.key).remove(),D.b.database().ref("users").child(c.key).remove(),Be(!1),Ra(!1),a.goBack()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a)}))):Ra(!1)},inProgress:Fe}),za&&Object(G.jsx)(va,{open:za,onClose:function(){Va(!1)},title:Ja,message:_a})]}),!1===aa&&Object(G.jsx)(Nt,{})]})}function Na(e){var t=Object(n.useState)(""),a=Object(m.a)(t,2),i=a[0],r=a[1];function c(){e.onClose(i,!1),e.initialValue?r(e.initialValue):r("")}Object(n.useEffect)((function(){e.initialValue&&r(e.initialValue)}),[e.initialValue]);return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:c,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:e.message}),Object(G.jsx)(nt.a,{value:i,onChange:function(e){r(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{id:"cancel",onClick:c,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{id:"ok",onClick:function(){e.onClose(i,!0),r("")},color:"primary",children:"OK"})]})]})})}var Sa=Object(O.a)((function(e){return{text:{padding:e.spacing(2,2,0)},list:{marginBottom:e.spacing(2)},container:{paddingBottom:120},avatar:{width:"50px",height:"50px"},listText:{paddingLeft:e.spacing(1)},noHubsText:{marginTop:15,marginLeft:15}}}));function Ea(){var e=Object(o.e)(),t=Object(o.f)(),a=Sa(),r=Object(n.useState)({name:"Hubs",key:"Root"}),c=Object(m.a)(r,2),s=c[0],l=c[1],d=Object(n.useContext)(h.b),u=d.folders,j=d.users,b=Object(n.useState)(),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)([{name:"Hubs",key:"Root"}]),N=Object(m.a)(C,2),S=N[0],T=N[1],F=Object(n.useContext)(h.d).currentUserData,R=Object(n.useState)([]),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),K=Object(m.a)(H,2),Y=K[0],z=K[1],V=[];function q(e){var t=u.filter((function(t){return t.key===e}))[0];if(t){var a=u.filter((function(e){return e.key===t.parent}))[0];a&&(V.push({name:a.name,key:a.key,parent:a.parent}),q(a.key))}}Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(a){a||e.replace("/signin?url="+t.pathname)}));F&&("Player"===F.role||"FAW Player"===F.role||"Club Player"===F.role||"Coach Ed Student"===F.role||"FAW Coach Ed Student"===F.role||"Club Coach Ed Student"===F.role||"FAW Parent"===F.role||"Club Parent"===F.role||"Referee"===F.role?p(!1):p(!0));var n=t.pathname.replace("/hubs/",""),i=u.filter((function(e){return e.key===n}))[0];if(i){l(i),"System Digital Manager"===F.role||i.managers&&i.managers.includes(F.key)?k(!0):k(!1),V="root"===i.key?[]:[{name:i.name,key:i.key,parent:i.parent}];var r=u.filter((function(e){return e.hub&&e.parent===i.key}));if(0===(r=r.sort((function(e,t){return e.name>t.name?1:-1}))).length?M(!0):M(!1),F&&"System Digital Manager"===F.role)L(r);else{var c=[];r.forEach((function(e){u.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(F.key)&&(c.includes(e)||c.push(e))}))})),L(c)}q(i.key),V.push({name:"Hubs",key:"Root"}),V.reverse(),T(V)}else{var s=u.filter((function(e){return e.hub&&"Root"===e.parent}));if(0===(s=s.sort((function(e,t){return e.name>t.name?1:-1}))).length?M(!0):M(!1),F&&"System Digital Manager"===F.role)k(!0),L(s);else{k(!1);var o=[];s.forEach((function(e){u.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(F.key)&&(o.includes(e)||o.push(e))}))})),L(o)}}return function(){return a()}}),[t.pathname,u,e,F]);var _=function(t){return function(){l(t),T((function(e){return[].concat(Object(Jt.a)(e),[{name:t.name,key:t.key}])})),"Root"===t.name?e.push("/hubs"):e.push("/hubs/".concat(t.key))}},X=function(t){return function(){e.push("/managehub?key="+t.key)}},Z=function(t){return function(){var a=0;for(a=0;a<S.length;a++){if(S[a].key===t.key)break}var n=Object(Jt.a)(S);n.length=a+1,T(n),l(t),"Root"===t.name?e.replace("/hubs"):e.replace("/hubs/".concat(t.key))}};return Object(G.jsxs)(i.a.Fragment,{children:[O&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:a.container,children:Object(G.jsxs)(pt.a,{square:!0,children:[Object(G.jsx)(x.a,{className:a.text,variant:"h5",gutterBottom:!0,children:"Hubs"}),Object(G.jsx)(ta.a,{separator:"\u203a","aria-label":"breadcrumb",className:a.text,children:S.map((function(e){return Object(G.jsx)(it.a,{href:"#",onClick:Z(e),children:e.name},e.key)}))}),W&&Object(G.jsx)("h5",{className:a.noHubsText,children:"There are no hubs at this level yet"}),Object(G.jsx)(He.a,{className:a.list,children:A.map((function(e,t,n){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:_(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"hubs",variant:"rounded"})}),Object(G.jsx)(ze.a,{primary:e.name,className:a.listText}),("System Digital Manager"===F.role||e.managers.includes(F.key))&&Object(G.jsx)(ea.a,{children:Object(G.jsx)(w.a,{edge:"end",onClick:X(e),children:Object(G.jsx)(E.a,{})})})]}),t<n.length-1&&Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})]})}),v&&Object(G.jsx)(Ct,{onClick:function(){z(!0)}})]}),!1===O&&Object(G.jsx)(Nt,{}),Object(G.jsx)(Na,{open:Y,onClose:function(e,t){if(""!==e&&t){var a=D.b.database().ref("folders"),n=[],i=[],r=[];s.ancestors&&"Root"!==s.key&&((n=Object(be.k)(s.ancestors))[s.key]=!0,s.users&&(i=Object(be.k)(s.users)),s.managers,r=Object(be.k)(s.managers));var c=Object(be.m)(19);a.child(c).set({hub:!0,name:e,parent:s.key,ancestors:n,users:i,managers:r,imageURL:""}),D.b.database().ref("groups").push({name:"All Users",hub:c,users:i}),s.users&&s.users.forEach((function(e){var t=j.filter((function(t){return t.key===e}))[0];if(t){var a=D.b.database().ref("users").child(t.key),n={};t.admins.forEach((function(e){n[e]=!0})),s.managers.forEach((function(e){n[e]=!0})),a.update({admins:n})}}))}z(!1)},title:"New Hub",message:"Enter a name for the new Hub."}),Object(G.jsx)($e,{})]})}var Ta=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2),flex:1},list:{width:"100%"},container:{height:"100%"},chip:{marginLeft:15,marginTop:15},nameTextField:{marginLeft:70,marginRight:15,marginTop:5}}})),Fa=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Ba(e){var t=Ta(),a=e.onClose,i=e.open,r=Object(n.useState)([]),c=Object(m.a)(r,2),s=c[0],o=c[1],l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),h=f[0],O=f[1],y=Object(n.useState)(""),v=Object(m.a)(y,2),k=v[0],C=v[1];Object(n.useEffect)((function(){i||(o(e.selectedUsers),j(e.otherUsers))}),[e.otherUsers,e.selectedUsers]);var N=function(){a(s,u,h)},S=function(e){return function(){var t=Object(Jt.a)(s),a=t.indexOf(e);-1!==a&&(t.splice(a,1),o(t));var n=Object(Jt.a)(u);n.push(e),j(n),O(!0)}},E=function(e){return function(){var t=Object(Jt.a)(u),a=t.indexOf(e);-1!==a&&(t.splice(a,1),j(t));var n=Object(Jt.a)(s);n.push(e),o(n),O(!0)}};return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:N,"aria-labelledby":"simple-dialog-title",open:i,maxWidth:"lg",fullWidth:!0,TransitionComponent:Fa,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:N,"aria-label":"close",children:Object(G.jsx)(qt.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:"Edit Managers"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:s.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:!e.cannotRemoveAsManager&&S(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:k,onChange:function(e){C(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:u.filter((function(e){return 0===s.filter((function(t){return t.key===e.key})).length})).filter((function(e){return e.fullName.includes(k)})).sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsxs)("div",{onClick:E(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var Da=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2),flex:1},list:{width:"100%"},container:{height:"100%"},chip:{marginLeft:15,marginTop:15},nameTextField:{marginLeft:70,marginRight:15,marginTop:5}}})),Ra=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Pa(e){var t=Da(),a=e.onClose,i=e.open,r=Object(n.useState)([]),c=Object(m.a)(r,2),s=c[0],o=c[1],l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),h=f[0],O=f[1],y=Object(n.useState)(""),v=Object(m.a)(y,2),k=v[0],C=v[1];Object(n.useEffect)((function(){i||(o(e.selectedUsers),j(e.otherUsers))}),[e.selectedUsers,e.otherUsers]);var N=function(){a(s,u,h)},S=function(e){return function(){var t=Object(Jt.a)(s),a=t.indexOf(e);-1!==a&&(t.splice(a,1),o(t));var n=Object(Jt.a)(u);n.push(e),j(n),O(!0)}},E=function(e){return function(){var t=Object(Jt.a)(u),a=t.indexOf(e);-1!==a&&(t.splice(a,1),j(t));var n=Object(Jt.a)(s);n.push(e),o(n),O(!0)}};return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:N,"aria-labelledby":"simple-dialog-title",open:i,maxWidth:"lg",fullWidth:!0,TransitionComponent:Ra,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:N,"aria-label":"close",children:Object(G.jsx)(qt.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:"Edit Users"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:s.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:!e.cannotRemoveAsUser&&S(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:k,onChange:function(e){C(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:u.filter((function(e){return 0===s.filter((function(t){return t.key===e.key})).length})).filter((function(e){return e.fullName.includes(k)})).sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsxs)("div",{onClick:E(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var Aa=Object(O.a)((function(e){return{topSpacing:{marginTop:e.spacing(2)},avatar:{width:e.spacing(8),height:e.spacing(8)},noSelectionLabel:{color:"rgb(100, 100, 100)"}}}));function La(e){var t=Aa(),a=Object(n.useState)(!1),i=Object(m.a)(a,2),r=i[0],c=i[1];function s(t,a,n){c(!1),n&&e.onChange(t,a)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(x.a,{className:t.topSpacing,variant:"subtitle1",gutterBottom:!0,children:e.title}),0===e.selectedUsers.length&&Object(G.jsx)("span",{className:t.noSelectionLabel,children:"This hub doesn't have any "+e.title}),Object(G.jsx)(pa.a,{max:5,className:t.topSpacing,children:e.selectedUsers.map((function(e){return Object(G.jsx)(B.a,{userOrHub:e,variant:"circular",path:"users"},e.key)}))}),Object(G.jsxs)("div",{children:[Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){c(!0)},className:t.topSpacing,children:"Edit "+e.title}),"Managers"===e.title&&Object(G.jsx)(Ba,{open:r,onClose:s,selectedUsers:e.selectedUsers,otherUsers:e.otherUsers}),"Users"===e.title&&Object(G.jsx)(Pa,{open:r,onClose:s,selectedUsers:e.selectedUsers,otherUsers:e.otherUsers})]})]})}var Ia=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2),flex:1},list:{width:"100%"},container:{height:"100vh",background:"rgb(230, 230, 230)"},chip:{marginLeft:15,marginTop:15},nameTextField:{marginLeft:60,marginRight:15,marginTop:25},filterTextField:{marginLeft:70,marginRight:15,marginTop:0},usersTitle:{marginTop:15,marginLeft:60,marginBottom:0}}})),Ua=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Wa(e){var t=Ia(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(""),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)([]),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)([]),b=Object(m.a)(j,2),f=b[0],O=b[1],y=Object(n.useState)(!1),v=Object(m.a)(y,2),k=v[0],C=v[1],N=Object(n.useState)(""),S=Object(m.a)(N,2),E=S[0],T=S[1];Object(n.useEffect)((function(){var t=[],a=[];e.hubUsers.forEach((function(n){e.group.users.filter((function(e){return e.key===n.key})).length>0?t.push(n):a.push(n)})),t.sort((function(e,t){return e.firstName>t.firstName?1:t.firstName>e.firstName?-1:0})),a.sort((function(e,t){return e.firstName>t.firstName?1:t.firstName>e.firstName?-1:0})),u(t),O(a),T(e.group.name)}),[e.open]);var F=function(e){return function(){var t=Object(Jt.a)(d);t.push(e),u(t),s("")}},D=function(){""!==E&&(s(""),e.onClose(d,e.group))},R=function(e){return function(){var t=d.filter((function(t){return t.key!==e.key}));u(t);var a=[].concat(Object(Jt.a)(f),[e]);O(a)}},P=function(t){"groupName"===t.target.id?(T(t.target.value),e.group.name=t.target.value):"usernameFilter"===t.target.id&&s(t.target.value)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:D,"aria-labelledby":"simple-dialog-title",open:e.open,TransitionComponent:Ua,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:D,"aria-label":"close",children:Object(G.jsx)(qt.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:"Edit Group"}),Object(G.jsx)(w.a,{edge:"end",color:"inherit",onClick:function(){C(!0)},"aria-label":"close",children:Object(G.jsx)(Ut.a,{})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.nameTextField,id:"groupName",label:"Name",variant:"outlined",value:E,onChange:P})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h2",{className:t.usersTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:d.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:R(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"usernameFilter",label:"Type User Name",className:t.filterTextField,fullWidth:!0,value:c,onChange:P})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:f.filter((function(e){return 0===d.filter((function(t){return t.key===e.key})).length})).filter((function(e){return e.fullName.includes(c)})).sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsxs)("div",{onClick:F(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]}),k&&Object(G.jsx)(ya,{title:"Delete Group",message:"Are you sure you want to delete this group?",open:k,onClose:function(t){!0===t&&a&&e.onDelete(e.group),C(!1)}})]})}var Ma=a(1067),Ha=a(1071),Ka=a(1070),Ya=a(1066),za=a(1068),Va=a(1069),Ga=(a(804),a(805),a(554)),qa=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},doneButton:{width:60,margin:10}}}));function _a(e){var t=qa(),a=Object(n.useState)({startDate:new Date,endDate:new Date,key:"selection"}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=function(){e.onClose(P()(r.startDate),P()(r.endDate))};return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(dt.a,{onClose:s,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Ga.DateRangePicker,{ranges:[r],onChange:function(e){c(e.selection)}}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:s,className:t.doneButton,children:"Done"})]})})})}var Xa=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},title:{marginTop:15},doneButton:{width:60,margin:10},groupChip:{marginTop:7.5}}}));function Za(e){var t=Xa(),a=Object(n.useState)(null),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(null),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(null),j=Object(m.a)(u,2),b=j[0],f=j[1],h=Object(n.useState)(null),O=Object(m.a)(h,2),p=O[0],g=O[1],x=Object(n.useState)(null),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)(null),w=Object(m.a)(C,2),N=w[0],S=w[1];Object(n.useEffect)((function(){null===r&&c(e.includeVideo),null===l&&d(e.includeAudio),null===b&&f(e.includeImages),null===p&&g(e.includePDFs),null===v&&k(e.includePresentations),null===N&&S(e.includeDocuments)}),[r,l,b,p,v,N]);var E=function(){e.onClose(r,l,b,p,v,N)},T=function(e){return function(){"Video"===e?c(!r):"Audio"===e?d(!l):"Images"===e?f(!b):"PDF"===e?g(!p):"Presentations"===e?k(!v):"Documents"===e&&S(!N)}};return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(dt.a,{onClose:E,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:"File Type Filter"}),Object(G.jsxs)(He.a,{className:t.list,children:[Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("Video"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:r,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"Video"})]}),Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("Audio"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:l,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"Audio"})]}),Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("Images"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:b,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"Images"})]}),Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("PDF"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:p,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"PDF"})]}),Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("Presentations"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:v,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"Presentations"})]}),Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:T("Documents"),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:N,tabIndex:-1,disableRipple:!0})}),Object(G.jsx)(ze.a,{primary:"Documents"})]})]}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:E,className:t.doneButton,children:"Done"})]})})})}var Qa=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},title:{marginTop:15},doneButton:{width:60,margin:10},groupChip:{marginTop:7.5}}}));function Ja(e){var t=Qa(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1];Object(n.useEffect)((function(){e.files&&(c(e.files),d(e.files.filter((function(e){return e.isIncludedInFilters}))))}),[e.files]);var u=function(){var t=[];r.forEach((function(e){e.isIncludedInFilters||t.push(e.key)})),e.onClose(t)};return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(dt.a,{onClose:u,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:"File Filter"}),Object(G.jsx)(He.a,{className:t.list,children:r.map((function(e){return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:(t=e,function(){l.includes(t)?(t.isIncludedInFilters=!1,d(l.filter((function(e){return e!==t})))):(t.isIncludedInFilters=!0,d([].concat(Object(Jt.a)(l),[t])))}),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:l.includes(e),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":e.key}})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.displayName})]},e.key);var t}))}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:u,className:t.doneButton,children:"Done"})]})})})}var $a=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center"},toolbarTitle:{},title:{marginTop:15},filterButton:{marginTop:15,marginLeft:5,marginRight:5},downloadButton:{position:"absolute",left:"auto",right:10,top:80},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-255,width:window.innerWidth,overflow:"scroll"},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"}}}));function en(e){var t=$a(),a=Object(n.useContext)(h.b),i=a.fileUsage,r=a.getFileUsage,c=a.files,s=a.groups,o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],y=Object(n.useState)(!1),v=Object(m.a)(y,2),k=v[0],C=v[1],N=Object(n.useState)([]),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useState)(null),B=Object(m.a)(F,2),D=B[0],R=B[1],A=Object(n.useState)(null),L=Object(m.a)(A,2),I=L[0],U=L[1];Object(n.useState)([]);var W=Object(n.useState)([]),M=Object(m.a)(W,2),H=M[0],Y=M[1],V=Object(n.useState)([]),q=Object(m.a)(V,2),_=q[0],X=q[1],Z=Object(n.useState)(!0),Q=Object(m.a)(Z,2),J=Q[0],$=Q[1],ee=Object(n.useState)(!0),te=Object(m.a)(ee,2),ae=te[0],ne=te[1],ie=Object(n.useState)(!0),re=Object(m.a)(ie,2),ce=re[0],se=re[1],oe=Object(n.useState)(!0),le=Object(m.a)(oe,2),de=le[0],ue=le[1],je=Object(n.useState)(!0),fe=Object(m.a)(je,2),he=fe[0],me=fe[1],Oe=Object(n.useState)(!0),pe=Object(m.a)(Oe,2),ge=pe[0],xe=pe[1],ye=Object(n.useState)(!1),ve=Object(m.a)(ye,2),ke=ve[0],Ce=ve[1];Object(n.useEffect)((function(){if(e.hub){0===i.length&&r();var t=c.filter((function(t){return t.ancestors.includes(e.hub.key)}));t.forEach((function(e){if(e.type.includes("video"))e.category="Video";else if(e.type.includes("audio"))e.category="Audio";else if(e.type.includes("image"))e.category="Image";else if(e.type.includes("pdf"))e.category="PDF";else if(e.type.includes("presentation"))e.category="Presentation";else{var t=e.filename.substring(e.filename.lastIndexOf(".")+1,e.filename.length)||e.filename;e.category="key"===t?"Presentation":"Document"}})),X(t);var a=[];t.forEach((function(e){if(H.includes(e.key))e.isIncludedInFilters=!1;else if("Video"!==e.category||J)if("Audio"!==e.category||ae)if("Image"!==e.category||ce)if("PDF"!==e.category||de)if("Presentation"!==e.category||he)if("Document"!==e.category||ge){e.isIncludedInFilters=!0;var t=i.filter((function(t){return e.key===t.file})),n=0,r=0,c=0,o=0,l=0,d=null,u=[];t.forEach((function(e){if((null===D||P()(D).isSame(P()(e.date),"day")||P()(D).isBefore(P()(e.date)))&&(null===I||P()(I).isSame(P()(e.date),"day")||P()(I).isAfter(P()(e.date))))if("Open"===e.action)n+=1,u.includes(e.user)||u.push(e.user),(null===d||P()(e.date).isAfter(d))&&(d=P()(e.date));else if("Download"===e.action)r+=1;else if("TimelineCreate"===e.action)c+=1;else if("PlaylistCreate"===e.action)o+=1;else if("PlaylistShare"===e.action){var t=[];e.usersSharedWith.forEach((function(e){t.push(e)})),e.groupsSharedWith.forEach((function(e){var a=s.filter((function(t){return t.key===e.key}))[0];a&&a.users.forEach((function(e){t.push(e.key)}))})),l+=t.length}})),a.push({name:e.displayName,lastViewed:P()(d),viewCount:n,usersViewedCount:u.length,downloadCount:r,timelineCount:c,playlistCount:o,playlistShareCount:l})}else e.isIncludedInFilters=!1;else e.isIncludedInFilters=!1;else e.isIncludedInFilters=!1;else e.isIncludedInFilters=!1;else e.isIncludedInFilters=!1;else e.isIncludedInFilters=!1})),a=a.sort((function(e,t){return e.viewCount<t.viewCount?1:-1})),T(a)}}),[e,i,D,I,H,J,ae,ce,de,he,ge]);var we=function(){e.onClose()};return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:we,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:we,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.toolbarTitle,children:"The data below is for the selected hub only: "+e.hub.name})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)("div",{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){u(!0)},className:t.filterButton,children:"File Type Filter"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){O(!0)},className:t.filterButton,children:"File Filter"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){C(!0)},className:t.filterButton,children:"Date Filter"}),ke&&Object(G.jsx)(K.a,{color:"secondary",onClick:function(){R(null),U(null),Y([]),$(!0),ne(!0),se(!0),ue(!0),me(!0),xe(!0),Ce(!1)},className:t.filterButton,children:"Clear"})]}),Object(G.jsx)(K.a,{onClick:function(){var e="File, Last Viewed, Num Views, Num Users Viewed, Downloads, Timelines Created, Playlists Created, Playlists Shared\n";E.forEach((function(t){e+=t.name.replace(",","")+", ",e+=t.lastViewed.toString().replace(",","")+", ",e+=t.viewCount+", ",e+=t.usersViewedCount+", ",e+=t.downloadCount+", ",e+=t.timelineCount+", ",e+=t.playlistCount+", ",e+=t.playlistShareCount+"\n"})),Object(be.f)(e,"export.csv","text/csv;charset=utf-8;")},className:t.downloadButton,children:"Download Data"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.tableContainer,children:Object(G.jsxs)(Ma.a,{"aria-label":"simple table",children:[Object(G.jsx)(za.a,{className:t.tableHead,children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"File"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Last Viewed"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Num Views"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Num Users Viewed"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Downloads"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Timelines Created"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlists Created"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlists Shared"})]})}),Object(G.jsx)(Ha.a,{children:E.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:"Invalid Date"===P()(e.lastViewed).toString()?"-":P()(e.lastViewed).toString()}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.viewCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.usersViewedCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.downloadCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.timelineCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistShareCount})]},e.key)}))})]})})]}),Object(G.jsx)(Za,{open:d,onClose:function(e,t,a,n,i,r){$(e),ne(t),se(a),ue(n),me(i),xe(r),u(!1),Ce(!0)},includeVideo:J,includeAudio:ae,includeImages:ce,includePDFs:de,includePresentations:he,includeDocuments:ge}),Object(G.jsx)(Ja,{open:f,onClose:function(e){Y(e),O(!1),Ce(!0)},files:_}),Object(G.jsx)(_a,{open:k,onClose:function(e,t){R(e),U(t),C(!1),Ce(!0)}})]})})}var tn=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},title:{marginTop:15},doneButton:{width:60,margin:10},groupChip:{marginTop:7.5}}}));function an(e){var t=tn(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1];Object(n.useEffect)((function(){e.users&&(c(e.users),d(e.users.filter((function(e){return e.isIncludedInFilters}))))}),[e.users]);var u=function(){var t=[];r.forEach((function(e){e.isIncludedInFilters||t.push(e.key)})),e.onClose(t)};return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(dt.a,{onClose:u,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:"User Filter"}),Object(G.jsx)(He.a,{className:t.list,children:r.map((function(e){return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:(t=e,function(){l.includes(t)?(t.isIncludedInFilters=!1,d(l.filter((function(e){return e!==t})))):(t.isIncludedInFilters=!0,d([].concat(Object(Jt.a)(l),[t])))}),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:l.includes(e),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":e.key}})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.fullName})]},e.key);var t}))}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:u,className:t.doneButton,children:"Done"})]})})})}var nn=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},title:{marginTop:15},doneButton:{width:60,margin:10},groupChip:{marginTop:7.5}}}));function rn(e){var t=nn(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1];Object(n.useEffect)((function(){e.groups&&(c(e.groups),d(e.groups.filter((function(e){return e.isIncludedInFilters}))))}),[e.groups]);var u=function(){e.onClose(r.filter((function(e){return e.isIncludedInFilters})))};return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(dt.a,{onClose:u,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:"User Filter"}),Object(G.jsx)(He.a,{className:t.list,children:r.map((function(e){return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:(t=e,function(){l.includes(t)?(t.isIncludedInFilters=!1,d(l.filter((function(e){return e!==t})))):(t.isIncludedInFilters=!0,d([].concat(Object(Jt.a)(l),[t])))}),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:l.includes(e),tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":e.key}})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.name})]},e.key);var t}))}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:u,className:t.doneButton,children:"Done"})]})})})}var cn=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center"},toolbarTitle:{},title:{marginTop:15},filterButton:{marginTop:15,marginLeft:5,marginRight:5},downloadButton:{position:"absolute",left:"auto",right:10,top:80},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-255,width:window.innerWidth,overflow:"scroll"},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"}}}));function sn(e){var t=cn(),a=Object(n.useContext)(h.b),i=a.fileUsage,r=a.users,c=a.files,s=a.userLogins,o=a.groups,l=a.getFileUsage,d=Object(n.useState)(!1),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(!1),O=Object(m.a)(f,2),y=O[0],v=O[1],k=Object(n.useState)(!1),C=Object(m.a)(k,2),N=C[0],S=C[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],B=T[1],D=Object(n.useState)(null),R=Object(m.a)(D,2),A=R[0],L=R[1],I=Object(n.useState)(null),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)([]),Y=Object(m.a)(H,2),V=Y[0],q=Y[1],_=Object(n.useState)([]),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)([]),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)([]),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1],ce=Object(n.useState)(!1),se=Object(m.a)(ce,2),oe=se[0],le=se[1];Object(n.useEffect)((function(){if(e.hub){var t=[];console.log("Compiling Hub User Usage Data:"),0===i.length&&l();var a=c.filter((function(t){return t.ancestors.includes(e.hub.key)}));Q(o.filter((function(t){return t.hub===e.hub.key&&"All Users"!==t.name})));var n=[].concat(Object(Jt.a)(e.hub.users),Object(Jt.a)(e.hub.managers)),d=[];n.forEach((function(e){var n="",c=0,l=0,u=0,j=0,b=0,f=r.filter((function(t){return t.key===e}))[0];if(f)if(d.push(f),ee.includes(f.key)||ie.includes(f.key))f.isIncludedInFilters=!1;else{f.isIncludedInFilters=!0;var h=s.filter((function(e){return e.key===f.key}))[0];h&&(n=h.lastLogin),a.forEach((function(e){i.filter((function(t){return e.key===t.file&&f.key===t.user})).forEach((function(e){if((null===A||P()(A).isSame(P()(e.date),"day")||P()(A).isBefore(P()(e.date)))&&(null===W||P()(W).isSame(P()(e.date),"day")||P()(W).isAfter(P()(e.date))))if("Open"===e.action)c+=1;else if("Download"===e.action)l+=1;else if("TimelineCreate"===e.action)u+=1;else if("PlaylistCreate"===e.action)j+=1;else if("PlaylistShare"===e.action){var t=[];e.usersSharedWith.forEach((function(e){t.push(e)})),e.groupsSharedWith.forEach((function(e){var a=o.filter((function(t){return t.key===e.key}))[0];a&&a.users.forEach((function(e){t.push(e.key)}))})),b+=t.length}}))})),t.push({name:f.fullName,lastLogin:n,viewCount:c,downloadCount:l,timelineCount:u,playlistCount:j,playlistShareCount:b})}})),t=t.sort((function(e,t){return e.viewCount<t.viewCount?1:-1})),q(d),B(t)}}),[e,i,A,W,ee,ie]);var de=function(){e.onClose()};return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:de,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:de,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.toolbarTitle,children:"The data below is for the selected hub only: "+e.hub.name})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)("div",{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){b(!0)},className:t.filterButton,children:"User Filter"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){v(!0)},className:t.filterButton,children:"Group Filter"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){S(!0)},className:t.filterButton,children:"Date Filter"}),oe&&Object(G.jsx)(K.a,{color:"secondary",onClick:function(){L(null),M(null),te([]),re([]),le(!1)},className:t.filterButton,children:"Clear"})]}),Object(G.jsx)(K.a,{onClick:function(){var e="Name, Last Login, Files Accessed, Downloads, Timelines Created, Playlists Created, Playlists Shared\n";F.forEach((function(t){e+=t.name.replace(",","")+", ",e+=t.lastLogin.toString().replace(",","")+", ",e+=t.viewCount+", ",e+=t.downloadCount+", ",e+=t.timelineCount+", ",e+=t.playlistCount+", ",e+=t.playlistShareCount+"\n"})),Object(be.f)(e,"export.csv","text/csv;charset=utf-8;")},className:t.downloadButton,children:"Download Data"})," ",Object(G.jsx)(Ya.a,{component:pt.a,className:t.tableContainer,children:Object(G.jsxs)(Ma.a,{"aria-label":"simple table",children:[Object(G.jsx)(za.a,{className:t.tableHead,children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"User"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Last login"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Files accessed"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Downloads"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Timelines Created"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlists Created"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlists Shared"})]})}),Object(G.jsx)(Ha.a,{children:F.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.lastLogin}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.viewCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.downloadCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.timelineCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistShareCount})]},e.key)}))})]})})]}),Object(G.jsx)(an,{open:j,onClose:function(e){te(e),b(!1),le(!0)},users:V}),Object(G.jsx)(rn,{open:y,onClose:function(e){var t=[];V.forEach((function(a){var n=!1;e.forEach((function(e){e.users.filter((function(e){return e.key===a.key})).length>0&&(n=!0)})),n||t.includes(a.key)||t.push(a.key)})),re(t),v(!1),le(!0)},groups:Z}),Object(G.jsx)(_a,{open:N,onClose:function(e,t){L(e),M(t),S(!1),le(!0)}})]})})}var on=a(55),ln=a(238),dn=a(203),un=a.n(dn),jn=Object(O.a)((function(e){return{container:{margin:5},white:{backgroundColor:"rgb(245, 245, 245)",height:60,padding:5,borderRadius:5},green:{backgroundColor:e.palette.primary.main,color:"white",padding:5,height:60,borderRadius:5},grey:{backgroundColor:"rgb(210, 210, 210 )",padding:5,height:60,borderRadius:5},label:{textAlign:"left",cursor:"pointer",marginTop:17,marginLeft:15,fontSize:16,width:"90%",overflowWrap:"break-word",maxWidth:"90%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},folderIcon:{fontSize:30,padding:0,marginLeft:5},arrowIcon:{fontSize:10}}}));function bn(e){var t=jn(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1];Object(n.useEffect)((function(){a&&(e.archiveHub&&e.folder&&(e.folder.ancestors.includes(e.archiveHub.key)||e.folder.key===e.archiveHub.key)&&u(!0),s(e.selected))}),[e,a]);var j=function(t){t.target.checked?e.handleFolderChecked(e.folder):e.handleFolderUnchecked(e.folder)};function b(){e.handleClick(e.index)}return Object(G.jsx)(on.b,{draggableId:e.folder.id,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:[e.green&&Object(G.jsxs)(Ke.a,{className:t.green,onClick:b,children:[d&&Object(G.jsx)(Lt.a,{checked:c,onChange:j,color:"default",inputProps:{"aria-label":"selected checkbox"}}),e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Ne.a,{className:t.folderIcon}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id),e.grey&&Object(G.jsxs)(Ke.a,{className:t.grey,onClick:b,children:[d&&Object(G.jsx)(Lt.a,{checked:c,onChange:j,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Ne.a,{className:t.folderIcon}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id),e.white&&Object(G.jsxs)(Ke.a,{className:t.white,onClick:b,children:[d&&Object(G.jsx)(Lt.a,{checked:c,onChange:j,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Ne.a,{className:t.folderIcon}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id)]}))}})}var fn=a(196),hn=a.n(fn),mn=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function On(e){var t=mn(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1];function o(){c?(s(!1),e.handleFileDeselect(e.file)):(s(!0),e.handleFileSelect(e.file))}return Object(n.useEffect)((function(){a&&s(e.selected)}),[e,a]),Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsx)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:Object(G.jsxs)(Ke.a,{onClick:o,className:t.listItem,children:[Object(G.jsx)(Lt.a,{checked:c,onChange:o,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.original?"https://vz-db0e7359-d70.b-cdn.net/"+e.file.original+"/thumbnail.jpg":"https://vz-db0e7359-d70.b-cdn.net/"+e.file.key+"/thumbnail.jpg",className:t.thumbnail,children:Object(G.jsx)(hn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]})}))}})}var pn=a(239),gn=a.n(pn),xn=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function yn(e){var t=xn(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1];function o(){c?(s(!1),e.handleFileDeselect(e.file)):(s(!0),e.handleFileSelect(e.file))}return Object(n.useEffect)((function(){a&&s(e.selected)}),[e,a]),Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsx)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:Object(G.jsxs)(Ke.a,{onClick:o,className:t.listItem,children:[Object(G.jsx)(Lt.a,{checked:c,onChange:o,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.thumbnail,children:Object(G.jsx)(gn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]})}))}})}var vn=a(117),kn=a.n(vn),Cn=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function wn(e){var t=Cn(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1];function o(){c?(s(!1),e.handleFileDeselect(e.file)):(s(!0),e.handleFileSelect(e.file))}return Object(n.useEffect)((function(){a&&s(e.selected)}),[e,a]),Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsx)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:Object(G.jsxs)(Ke.a,{onClick:o,className:t.listItem,children:[Object(G.jsx)(Lt.a,{checked:c,onChange:o,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.url,className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]})}))}})}var Nn=a(197),Sn=a.n(Nn),En=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function Tn(e){var t=En(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1];function o(){c?(s(!1),e.handleFileDeselect(e.file)):(s(!0),e.handleFileSelect(e.file))}return Object(n.useEffect)((function(){a&&s(e.selected)}),[e,a]),Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsx)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:Object(G.jsxs)(Ke.a,{onClick:o,className:t.listItem,children:[Object(G.jsx)(Lt.a,{checked:c,onChange:o,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),Object(G.jsx)(Qe.a,{variant:"rounded",children:Object(G.jsx)(Sn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]})}))}})}var Fn=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function Bn(e){var t=Fn(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1];function o(){c?(s(!1),e.handleFileDeselect(e.file)):(s(!0),e.handleFileSelect(e.file))}return Object(n.useEffect)((function(){a&&s(e.selected)}),[e,a]),Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:!0,children:function(a){return Object(G.jsx)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,children:Object(G.jsxs)(Ke.a,{onClick:o,className:t.listItem,children:[Object(G.jsx)(Lt.a,{checked:c,onChange:o,color:"primary",inputProps:{"aria-label":"selected checkbox"}}),Object(G.jsx)(Qe.a,{variant:"rounded",className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]})}))}})}var Dn=Object(O.a)((function(e){return{columnTitle:{marginTop:10,marginBottom:10,marginRight:5,marginLeft:10,padding:0,textAlign:"left",cursor:"pointer",fontSize:18,overflowWrap:"anywhere",width:"99%",minWidth:"99%",height:25,maxHeight:25,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:1,overflow:"hidden"},addButton:{margin:"0 auto",cursor:"pointer",marginTop:11,display:"flex"},titleRowPadding:{margin:0,padding:0}}}));function Rn(e){var t=Dn(),a=Object(o.e)(),i=Object(n.useState)(0),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(0),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(0),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(0),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(0),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)(0),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.d).currentUserData,R=Object(n.useContext)(h.b),P=R.files,A=R.folders;function L(t){console.log(e.index),e.index>0&&(e.column.selectedFolderIndex=t,e.handleFolderSelect(e.index,t))}function I(t){var n=!0;if(A.forEach((function(e){e.parent===t.key&&(n=!1)})),P.forEach((function(e){e.folder===t.key&&(n=!1)})),n){var i=D.b.database().ref("folders").child(t.key),r=e.column.folders[e.column.selectedFolderIndex];r&&r.key===t.key&&a.push("/files/".concat(r.parent)),i.remove(),e.showStatusMessage("Folder deleted successfully","success")}else e.showStatusMessage("Can't delete folders that contain subfolders or files","error")}function U(t){return e.selectedFolders.filter((function(e){return e.key===t.key})).length>0}return Object(n.useEffect)((function(){s(window.innerHeight-145),j(e.column.folders.length);var t=0,a=0,n=0,i=0;e.column.files&&(e.column.files.forEach((function(e){e.type.includes("video")?t++:e.type.includes("audio")?i++:e.type.includes("image")?n++:"application/pdf"===e.type&&a++})),p(t),F(i),N(n),v(a)),window.addEventListener("resize",(function(){s(window.innerHeight-145)}))}),[B]),Object(G.jsx)(on.c,{droppableId:e.column.id,children:function(a,n){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)({ref:a.innerRef},a.droppableProps),{},{style:n.isDraggingOver?{minHeight:c,border:"2px solid rgb(0, 149, 61)",color:"rgba(0,0,0,0.5)"}:{minHeight:c,borderRight:"1px solid lightgrey"},children:[Object(G.jsx)(Mt.a,{className:t.titleRowPadding,children:Object(G.jsx)(Ht.a,{xs:12,sm:12,md:12,lg:12,xl:12,xxl:12,className:t.titleRowPadding,children:Object(G.jsx)("span",{className:t.columnTitle,children:e.column.name})})}),Object(G.jsx)(xe.a,{}),e.column.folders.map((function(t,a){return Object(G.jsx)(bn,{folder:t,index:a,handleClick:L,handleFolderChecked:e.handleFolderChecked,handleFolderUnchecked:e.handleFolderUnchecked,deleteFolder:I,archiveHub:e.archiveHub,showStatusMessage:e.showStatusMessage,selected:U(t),selectedColumn:e.selectedColumnIndex===e.index,unselected:e.column.selectedFolderIndex===a,green:e.column.selectedFolderIndex===a&&e.selectedColumnIndex===e.index,grey:e.column.selectedFolderIndex===a&&e.selectedColumnIndex!==e.index&&e.selectedColumnIndex>=e.index,white:e.column.selectedFolderIndex!==a||e.selectedColumnIndex<e.index},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("video")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(On,{file:t,folder:e.column.folder,index:a+u,selected:e.selectedFiles.includes(t),showStatusMessage:e.showStatusMessage,handleFileSelect:e.handleFileSelect,handleFileDeselect:e.handleFileDeselect},t.key)})),e.column.files&&e.column.files.filter((function(e){return"application/pdf"===e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(yn,{file:t,folder:e.column.folder,index:a+u+O,selected:e.selectedFiles.includes(t),showStatusMessage:e.showStatusMessage,handleFileSelect:e.handleFileSelect,handleFileDeselect:e.handleFileDeselect},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("image")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(wn,{file:t,folder:e.column.folder,index:a+u+O+y,selected:e.selectedFiles.includes(t),showStatusMessage:e.showStatusMessage,handleFileSelect:e.handleFileSelect,handleFileDeselect:e.handleFileDeselect},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("audio")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(Tn,{file:t,folder:e.column.folder,index:a+u+O+y+w,selected:e.selectedFiles.includes(t),showStatusMessage:e.showStatusMessage,handleFileSelect:e.handleFileSelect,handleFileDeselect:e.handleFileDeselect},t.key)})),e.column.files&&e.column.files.filter((function(e){return!e.type.includes("video")&&!e.type.includes("audio")&&!e.type.includes("image")&&"application/pdf"!==e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(Bn,{file:t,folder:e.column.folder,index:a+u+O+y+w+T,selected:e.selectedFiles.includes(t),showStatusMessage:e.showStatusMessage,handleFileSelect:e.handleFileSelect,handleFileDeselect:e.handleFileDeselect},t.key)})),a.placeholder]}))}})}var Pn=a(555),An=a.n(Pn),Ln=a(127),In=a.n(Ln),Un=a(94),Wn=a.n(Un),Mn=a(1082),Hn=Object(O.a)((function(e){return{tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-255,overflow:"scroll"},progress:{maxHeight:35,maxWidth:35}}}));function Kn(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,Object(at.a)({variant:"determinate"},e)),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"textSecondary",children:"".concat(Math.round(e.value),"%")})})]})}function Yn(e){var t=Hn(),i=Object(n.useContext)(h.b),r=i.files,c=i.comments,s=i.playlists,o=i.timelines,l=i.notifications,d=i.events,u=i.users,j=i.getTimelines,b=i.getPlaylists,f=Object(n.useState)(""),O=Object(m.a)(f,2),p=O[0],g=O[1],y=Object(n.useState)(""),v=Object(m.a)(y,2),k=v[0],C=v[1],w=Object(n.useState)(!1),N=Object(m.a)(w,2),S=N[0],E=N[1],T=Object(n.useState)([]),F=Object(m.a)(T,2),B=F[0],R=F[1],P=Object(n.useState)(!1),A=Object(m.a)(P,2),L=A[0],I=A[1],U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useReducer)((function(e){return e+1}),0),z=Object(m.a)(Y,2)[1];function V(){return(V=Object(ie.a)(ne.a.mark((function e(){var t,a,n,i,c;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.clear(),console.log("Downloading Files"),t=new An.a,a="Nodiant Archive",n=t.folder(a),i=ne.a.mark((function e(i){var c,s,o;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=B[i],s=c.filename,o=n.folder(s),!c.type.includes("video")){e.next=8;break}return e.next=6,q(c,o).then((function(e){J(c,o),ee(c,o),$(c,o),console.log("Download Finished: "+c.filename),0===B.filter((function(e){return e.isDownloading})).length&&(t.generateAsync({type:"blob"}).then((function(e){In()(e,a+".zip"),S&&(Object(be.e)(c,r)?Z(c):(Z(c),Q(c)))})),H(!0))}));case 6:e.next=10;break;case 8:return e.next=10,_(c,o).then((function(e){J(c,o),console.log("Download Finished: "+c.filename),0===B.filter((function(e){return e.isDownloading})).length&&(t.generateAsync({type:"blob"}).then((function(e){In()(e,a+".zip"),S&&X(c)})),H(!0))}));case 10:case"end":return e.stop()}}),e)})),c=0;case 7:if(!(c<B.length)){e.next=12;break}return e.delegateYield(i(c),"t0",9);case 9:c++,e.next=7;break;case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(e,t){return new Promise((function(a,n){e.downloadProgress=0;var i=e.key;e.original&&(i=e.original);var r="https://vz-db0e7359-d70.b-cdn.net/"+i+"/original";Wn()({url:r,method:"GET",responseType:"blob",onDownloadProgress:function(t){var a=Math.floor(t.loaded/t.total*100);e.downloadProgress=a,100===e.downloadProgress&&(e.isDownloading=!1),z()}}).then((function(n){t.file(e.filename,n.data),e.isDownloading=!1,a()}))}))}function _(e,t){return new Promise((function(a,n){e.downloadProgress=0,Wn()({url:e.url,method:"GET",responseType:"blob",onDownloadProgress:function(t){var a=Math.floor(t.loaded/t.total*100);e.downloadProgress=a,100===e.downloadProgress&&(e.isDownloading=!1),z()}}).then((function(n){t.file(e.filename,n.data),e.isDownloading=!1,a()}))}))}function X(e){if(console.log("Deleting File: "+e.filename),c.forEach((function(t){t.file===e.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),!Object(be.e)(e,r)){console.log("Deleting From Storage");var t=e.key;e.original&&(t=e.original),D.b.storage().ref("files").child(t).child(e.filename).delete(),D.b.storage().ref("files").child(t).child("thumbnail").delete()}D.b.database().ref("files").child(e.key).remove()}function Z(e){c.forEach((function(t){t.file===e.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),s.forEach((function(t){t.video===e.key&&(D.b.database().ref("playlists").child(t.key).remove(),D.b.database().ref("playlistinfo").child(t.key).remove())})),o.forEach((function(t){t.video===e.key&&(D.b.database().ref("timelines").child(t.key).remove(),D.b.database().ref("timelineinfo").child(t.key).remove())})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.database().ref("files").child(e.key).remove()}function Q(e){return new Promise((function(t,a){D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(n){var i=n.data.key,r=e.key;e.original&&(r=e.original);var c="https://video.bunnycdn.com/library/"+be.b+"/videos/"+r;fetch(c,{method:"DELETE",headers:{AccessKey:i}}).then((function(e){return e.json()})).then((function(e){console.log(e),t()})).catch((function(e){console.error(e),a()}))})).catch((function(e){console.log(e.code),console.log(e.message),console.log(e.details),a()}))}))}function J(e,t){var n=a(284),i=c.filter((function(t){return t.file===e.key})),r=[];i.forEach((function(t){var a=[{user:t.author},{userID:t.user},{date:t.date},{file:t.file},{filename:e.filename},{comment:t.text},{key:t.key}];r.push({comment:a})}));var s=n([{file:[{comments:r}]}],!0),o=new Blob([s],{type:"text/xml"});t.file("comments.xml",o)}function $(e,t){var n=a(284),i=t.folder("timelines");o.filter((function(t){return t.video===e.key})).forEach((function(e){var t=[],a=[];e.instances.sort((function(e,t){return e.index>t.index?1:e.index<t.index?-1:0})).forEach((function(e){t.includes(e.name)||t.push(e.name);var n=[{ID:e.index+1},{start:e.inTime},{end:e.outTime},{code:e.name}];e.stars>0&&n.push({stars:e.stars}),e.labels.forEach((function(e){var t=[{text:e.text}];e.group&&t.push({group:e.group}),e.start&&t.push({start:e.start}),n.push({label:t})})),e.notes.forEach((function(e){n.push({free_text:e})})),a.push({instance:n})}));var r=[];t.forEach((function(e){var t=[{code:e},{R:0},{G:39321},{B:13107},{red:0},{green:.6},{blue:.2},{fontRed:1},{fontGreen:1},{fontBlue:1}];r.push({row:t})}));var c=n([{file:[{ALL_INSTANCES:a},{ROWS:r}]}],!0),s=new Blob([c],{type:"text/xml"}),o=e.name+".xml";i.file(o,s)}))}function ee(e,t){var n=a(284),i=t.folder("playlists");s.filter((function(t){return t.video===e.key})).forEach((function(t){var a=[];t.clips.forEach((function(e){a.push({clip:[{name:e.name},{note:e.note},{index:e.index},{key:e.key},{inTime:e.inTime},{outTime:e.outTime},{stars:e.stars}]})}));var r=[{file:[{name:t.name},{owner:t.owner},{key:t.key},{video:t.video},{videoname:e.filename},{clips:a}]}],c=n(r,!0),s=new Blob([c],{type:"text/xml"}),o=t.name+".xml";i.file(o,s)}))}return Object(n.useEffect)((function(){if(e.files){0===o.length&&j(!0),0===s.length&&b(!0);var t="download";e.delete?(t="download and delete",E(!0)):E(!1),e.files&&R(e.files),C(t),1===e.files.length?g("You are about to "+t+" 1 file, do you want to continue?"):g("You are about to "+t+" "+e.files.length+" files, do you want to continue?")}}),[e]),Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:function(e,t){},"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:k}),!L&&Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:p})}),L?Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:B.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",children:e.filename}),Object(G.jsxs)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:[100===e.downloadProgress&&Object(G.jsx)(x.a,{variant:"body2",children:"Finished"}),e.isDownloading&&Object(G.jsx)(Kn,{edge:"end",variant:"determinate",value:e.downloadProgress,className:t.progress})]})]},e.key)}))})})}):Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:function(){e.close("cancel"),I(!1),H(!1)},color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){B.forEach((function(e){e.downloadProgress=0,e.isDownloading=!0})),I(!0),H(!1),function(){V.apply(this,arguments)}()},color:"primary",children:"Confirm"})]}),M&&Object(G.jsxs)(ua.a,{align:"center",children:[Object(G.jsx)(ja.a,{align:"center",children:"Archive Finished"}),Object(G.jsx)(K.a,{onClick:function(){e.close("finished"),I(!1),H(!1)},color:"primary",children:"Dismiss"}),Object(G.jsx)(da.a,{})]})]})})}var zn=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center"},toolbarTitle:{},bottomToolbarTitle:{color:"rgb(0, 149, 61)",flexGrow:1},title:{marginTop:15},columnsContainer:{display:"flex",flexDirection:"row"},column:{minWidth:"24%",maxWidth:"24%"},bottomToolbar:{top:"auto",bottom:0}}}));function Vn(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Gn(e){var t=zn(),a=Object(n.useContext)(h.b),i=a.files,r=a.groups,c=a.folders,s=Object(n.useContext)(h.d).currentUserData,o=Object(n.useState)([]),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)([]),b=Object(m.a)(j,2),f=b[0],O=b[1],y=Object(n.useRef)(),v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],N=k[1],S=Object(n.useState)("error"),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(""),D=Object(m.a)(B,2),R=D[0],P=D[1],A=Object(n.useState)([]),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)([]),M=Object(m.a)(W,2),H=M[0],Y=M[1],V=Object(n.useState)(!1),q=Object(m.a)(V,2),_=q[0],X=q[1],Z=Object(n.useState)(!1),Q=Object(m.a)(Z,2),J=Q[0],$=Q[1],ee=Object(n.useState)(""),te=Object(m.a)(ee,2),ae=te[0],ne=te[1],ie=Object(n.useState)(""),re=Object(m.a)(ie,2),ce=re[0],se=re[1],oe=Object(n.useState)(!1),le=Object(m.a)(oe,2),de=le[0],ue=le[1];function je(e,t){var a=e.parentNode;void 0!==a&&void 0!==a.id&&(t.push({id:a.id}),je(a,t))}function fe(e,t){var a=d[e].folders[t];O(e);for(var n=[],c=0;c<e+1;c++)n.push(d[c]);n.push({id:a.id,name:a.name,folders:a.folders,folder:a,selectedFolderIndex:0}),n.forEach((function(e){var t=[];i.filter((function(t){return t.folder===e.id})).forEach((function(e){Object(be.o)(e,r,s)&&t.push(e)})),e.files=t})),n.push({id:Object(be.m)(15),name:"",folders:[],selectedFolderIndex:0}),u(n),y.current.scrollToRight()}Object(n.useEffect)((function(){if(e.hub){console.log("Refreshing Folders");var t=function(){var t=c.map((function(e){return{key:e.key,id:e.key,name:e.name,hub:e.hub,parent:e.parent,imageURL:e.imageURL,parentNode:{},folders:[],groups:e.groups,managers:e.managers,users:e.users,ancestors:e.ancestors,createdBy:e.createdBy}})),a=[];return t.forEach((function(n){var i=!1;(n.managers.includes(s.key)||"System Digital Manager"===s.role||n.hub&&n.users.includes(s.key)||n.createdBy&&s&&n.createdBy===s.key)&&(i=!0),n.ancestors.includes(e.hub.key)||(i=!1),i&&(a.push(n),n.ancestors.forEach((function(e){var n=t.filter((function(t){return t.key===e}));n[0]&&a.push(n[0])})))})),(a=Array.from(new Set(a))).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),a}(),a=function(e){for(var t=[],a=function(a){var n=e[a];if("Root"===n.parent)t.push(n);else{var i=e.filter((function(e){return e.key===n.parent}))[0];void 0!==i&&(i.folders.push(n),n.parentNode=i)}},n=0;n<e.length;n++)a(n);return t}(t),n=e.hub.key,o=t.filter((function(e){return e.id===n}))[0];if(o){var l=[{id:"Root",name:"Everything",folders:a,folder:{name:"Root",id:"root"}}],d=[];je(o,d),d.reverse().forEach((function(e){var a=t.filter((function(t){return t.id===e.id}))[0];a&&l.push({id:a.id,name:a.name,folders:a.folders,folder:a})})),l.push({id:o.id,name:o.name,folders:o.folders,folder:o}),l.forEach((function(e){var t=[];i.filter((function(t){return t.folder===e.id})).forEach((function(e){Object(be.o)(e,r,s)&&t.push(e)})),e.files=t})),l.forEach((function(e){e.folders.forEach((function(t,a){(o.ancestors.includes(t.id)||o.id===t.id||o.parent===t.id)&&(e.selectedFolderIndex=a)}))})),O(l.length-2),u(l)}}}),[s]);var he=function(e,t){"clickaway"!==t&&N(!1)};function me(e,t){F(t),P(e),N(!0)}var Oe=function(){e.onClose()};function pe(e){var t=i.filter((function(t){return t.ancestors.includes(e.key)})),a=[].concat(Object(Jt.a)(I),Object(Jt.a)(t));U(Object(be.u)(a));var n=c.filter((function(t){return t.ancestors.includes(e.key)})),r=[].concat(Object(Jt.a)(H),Object(Jt.a)(n),[e]);Y(Object(be.u)(r))}function ge(e){var t=i.filter((function(t){return t.ancestors.includes(e.key)})),a=Object(Jt.a)(I);a.forEach((function(e){t.includes(e)&&(a=a.filter((function(t){return t.key!==e.key})))})),U(a);var n=c.filter((function(t){return t.ancestors.includes(e.key)})),r=Object(Jt.a)(H);(r=r.filter((function(t){return t.key!==e.key}))).forEach((function(e){n.includes(e)&&(r=r.filter((function(t){return t.key!==e.key})))})),Y(r)}function xe(e){var t=[].concat(Object(Jt.a)(I),[e]);U(t)}function ye(e){var t=I.filter((function(t){return t.key!==e.key}));U(t)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:Oe,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:Oe,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.toolbarTitle,children:"Archive Files"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:t.container,children:Object(G.jsxs)("div",{style:{paddingLeft:0,paddingRight:0,marginLeft:0,marginRight:0,paddingTop:15,paddingBottom:65,"&::WebkitScrollbar":{display:"none"}},children:[Object(G.jsx)(ln.Scrollbars,{className:t.scrollbar,style:{width:window.innerWidth,height:window.innerHeight-145},ref:y,children:Object(G.jsx)(on.a,{children:Object(G.jsx)("div",{className:t.columnsContainer,children:d.map((function(a,n){return Object(G.jsx)("div",{className:t.column,children:Object(G.jsx)(Rn,{column:a,index:n,archiveHub:e.hub,selectedFiles:I,selectedFolders:H,handleFolderSelect:fe,handleFolderChecked:pe,handleFolderUnchecked:ge,selectedColumnIndex:f,showStatusMessage:me,handleFileSelect:xe,handleFileDeselect:ye},a.id)},a.id)}))})})}),Object(G.jsx)(st.a,{open:C,autoHideDuration:6e3,onClose:he,children:Object(G.jsx)(Vn,{onClose:he,severity:T,children:R})})]})}),Object(G.jsx)(p.a,{position:"fixed",color:"default",className:t.bottomToolbar,children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(x.a,{variant:"h6",className:t.bottomToolbarTitle,children:1===I.length?I.length+" File Selected":I.length+" Files Selected"}),Object(G.jsx)(K.a,{color:"primary",onClick:function(){0===I.length?(ne("No Files Selected"),se("Select some folders or files first"),X(!0)):(ue(!1),$(!0))},children:"Download"}),Object(G.jsx)(K.a,{color:"primary",onClick:function(){0===I.length?(ne("No Files Selected"),se("Select some folders or files first"),X(!0)):(ue(!0),$(!0))},children:"Download and Delete"})]})})]}),Object(G.jsx)(va,{open:_,onClose:function(){X(!1)},title:ae,message:ce}),Object(G.jsx)(Yn,{open:J,close:function(t){"finished"===t&&e.onClose(),$(!1)},files:I,delete:de})]})}var qn=Object(O.a)((function(e){return{form:{marginTop:e.spacing(1),display:"flex",flexDirection:"column",alignItems:"center",marginLeft:10,marginRight:10,paddingBottom:100},userIcon:{width:"100%",height:"150px"},topSpacing:{marginTop:e.spacing(2)},title:{marginLeft:e.spacing(2)},dividerFullWidth:{margin:"5px 0 0 ".concat(e.spacing(2),"px")},groupChip:{marginTop:7.5},buttonProgress:{color:"rgb(244, 36, 29)",position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10},deleteButton:{position:"absolute",left:"auto",right:10},usageButton:{margin:5,width:90},archiveButton:{margin:5},calendarsButton:{marginTop:e.spacing(1)},noGroupsLabel:{color:"rgb(100, 100, 100)"}}}));function _n(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Xn(){var e=Object(o.f)(),t=qn(),a=Object(o.e)(),i=Object(n.useState)({}),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useContext)(h.b),d=l.users,u=l.folders,j=l.calendars,b=l.groups,f=l.events,O=l.files,p=Object(n.useState)({key:"",name:"",hub:"",users:[]}),g=Object(m.a)(p,2),y=g[0],v=g[1],k=Object(n.useState)({key:"",name:""}),N=Object(m.a)(k,2),S=N[0],E=N[1],T=Object(n.useState)([]),F=Object(m.a)(T,2),B=F[0],R=F[1],P=Object(n.useState)([]),A=Object(m.a)(P,2),L=A[0],I=A[1],U=Object(n.useState)("-"+Object(be.m)(19)),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(""),z=Object(m.a)(Y,2),q=z[0],_=z[1],X=Object(n.useState)([]),Z=Object(m.a)(X,2),Q=Z[0],J=Z[1],$=Object(n.useState)([]),ee=Object(m.a)($,2),te=ee[0],ae=ee[1],re=Object(n.useState)(""),ce=Object(m.a)(re,2),se=ce[0],oe=ce[1],le=Object(n.useState)([]),de=Object(m.a)(le,2),ue=de[0],je=de[1],fe=Object(n.useState)([]),he=Object(m.a)(fe,2),me=he[0],Oe=he[1],pe=Object(n.useState)(!1),ge=Object(m.a)(pe,2),xe=ge[0],ye=ge[1],ve=Object(n.useState)(!1),ke=Object(m.a)(ve,2),Ce=ke[0],we=ke[1],Ne=Object(n.useState)("error"),Se=Object(m.a)(Ne,2),Ee=Se[0],Te=Se[1],Fe=Object(n.useState)(""),Be=Object(m.a)(Fe,2),De=Be[0],Re=Be[1],Pe=Object(n.useState)(!1),Ae=Object(m.a)(Pe,2),Le=Ae[0],Ie=Ae[1],Ue=Object(n.useState)(!1),We=Object(m.a)(Ue,2),Me=We[0],He=We[1],Ke=Object(n.useState)(!1),Ye=Object(m.a)(Ke,2),ze=Ye[0],Ve=Ye[1],Ge=Object(n.useState)(!1),qe=Object(m.a)(Ge,2),_e=qe[0],Xe=qe[1],Ze=Object(n.useState)(!1),Qe=Object(m.a)(Ze,2),Je=Qe[0],et=Qe[1],tt=Object(n.useState)(!1),at=Object(m.a)(tt,2),it=at[0],rt=at[1],ot=Object(n.useState)(!1),lt=Object(m.a)(ot,2),dt=lt[0],ut=lt[1],jt=Object(n.useState)(!1),bt=Object(m.a)(jt,2),ft=bt[0],ht=bt[1],mt=Object(n.useState)(!1),Ot=Object(m.a)(mt,2),pt=Ot[0],gt=Ot[1],xt=Object(n.useState)(),yt=Object(m.a)(xt,2),kt=yt[0],Ct=yt[1],wt=Object(n.useContext)(h.d).currentUserData,St=Object(n.useState)(!1),Et=Object(m.a)(St,2),Tt=Et[0],Ft=Et[1],Bt=Object(n.useState)(!1),Dt=Object(m.a)(Bt,2),Rt=Dt[0],At=Dt[1],Lt=Object(n.useState)(!1),It=Object(m.a)(Lt,2),Wt=It[0],Mt=It[1];Object(n.useEffect)((function(){var t=D.b.auth().onAuthStateChanged((function(t){t||a.replace("/signin?url="+e.pathname)}));if(!wt)return function(){return t()};var n=new URLSearchParams(e.search).get("key");H(n);var i=u.filter((function(e){return e.key===n}))[0],r=!1;(i&&i.managers&&i.managers.includes(wt.key)||"System Digital Manager"===wt.role)&&(r=!0);var c=!1;if("System Digital Manager"!==wt.role&&"FAW Analyst"!==wt.role&&"Club Digital Manager"!==wt.role||(c=!0),i&&r){Ft(!0),At(c),s(i);var o=[],l=[],f=[],h=[];d.forEach((function(e){e.cannotRemoveAsManager=void 0,e.cannotRemoveAsUser=void 0,i.managers&&i.managers.includes(e.key)?(f.push(e),i.ancestors.forEach((function(t){var a=u.filter((function(e){return e.key===t}))[0];a&&a.managers.filter((function(t){return t===e.key})).length>0&&(e.cannotRemoveAsManager=!0)}))):"Player"!==e.role&&"FAW Player"!==e.role&&"Club Player"!==e.role&&h.push(e),(e.admins.includes(wt.key)||e.createdBy===wt.key||"System Digital Manager"===wt.role)&&(i.users&&i.users.includes(e.key)?(o.push(e),i.ancestors.forEach((function(t){var a=u.filter((function(e){return e.key===t}))[0];a&&a.users.filter((function(t){return t===e.key})).length>0&&(e.cannotRemoveAsUser=!0)}))):l.push(e))})),R(b.filter((function(e){return e.hub===i.key}))),""===q&&_(i.name),oe(i.imageURL),I(j.filter((function(e){return e.hub===i.key}))),ae(f),J(o),je(h),Oe(l)}}),[a,wt,M,u,d,b,e.search,j]);var Ht=function(e,t){J(e),Oe(t),function(e){var t=zt(e),a={};u.forEach((function(n){if(n.ancestors.includes(M)&&n.hub){var i={};e.forEach((function(e){i[e.key]=!0})),n.users.forEach((function(e){t.includes(e)||(i[e]=!0)})),a[n.key+"/users"]=i,b.filter((function(e){return e.hub===n.key})).forEach((function(e){if("All Users"===e.name)D.b.database().ref("groups").child(e.key).update({users:i});else{var a={};e.users.forEach((function(e){t.includes(e.key)||(a[e.key]=!0)})),D.b.database().ref("groups").child(e.key).update({users:a})}}))}})),D.b.database().ref("folders").update(a)}(e),Kt(te,e),D.b.database().ref("folders").child(M).update({users:Object(be.k)(e)});var a=zt(e);b.filter((function(e){return e.hub===M})).forEach((function(t){if("All Users"===t.name)D.b.database().ref("groups").child(t.key).update({users:Object(be.k)(e)});else{var n={};t.users.forEach((function(e){a.includes(e.key)||(n[e.key]=!0)})),D.b.database().ref("groups").child(t.key).update({users:n})}}))};function Kt(e,t){var a={};t.forEach((function(t){var n={};t.admins.forEach((function(e){n[e]=!0})),e.forEach((function(e){n[e.key]=!0})),a[t.key+"/admins"]=n})),D.b.database().ref("users").update(a)}var Yt=function(e,t){"clickaway"!==t&&Ie(!1)};function zt(e){var t=[];return c.users.forEach((function(a){0===e.filter((function(e){return e.key===a})).length&&t.push(a)})),t}function Gt(){return(Gt=Object(ie.a)(ne.a.mark((function e(){var t;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(we(!0),t=D.b.database().ref("folders"),!xe){e.next=7;break}return e.next=5,qt().then((function(e){t.child(M).update({name:q,imageURL:e}),we(!1),a.goBack()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),we(!1),Re(e.message),Te("error"),Ie(!0)}));case 5:e.next=10;break;case 7:t.child(M).update({name:q,imageURL:se}),we(!1),a.goBack();case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qt(){return new Promise((function(e,t){if(c.avatarEditor){var a=D.b.storage();c.avatarEditor.getImageScaledToCanvas().toBlob((function(n){var i=a.ref().child("avatars/hubs/"+M+"/avatar.png");i.put(n).then((function(t){console.log("Upload Successful"),c.avatar=null,i.getDownloadURL().then((function(t){e(t)}))})).catch((function(e){var a=e.code,n=e.message;console.log(a+":"+n),we(!1),Re(e.message),Te("error"),Ie(!0),t()}))}))}else e("none")}))}var _t=function(e){return function(){E(e),ut(!0)}};function Zt(e){var t;!0===e&&wt&&(t=kt,O.forEach((function(e){var a=!1,n={};e.events.forEach((function(e){var i=f.filter((function(t){return t.key===e.key}))[0];i&&i.calendar===t.key?a=!0:n[e.key]=!0})),a&&D.b.database().ref("files").child(e.key).update({events:n})})),f.forEach((function(e){e.calendar===t.key&&D.b.database().ref("events").child(e.key).remove()})),D.b.database().ref("calendars").child(t.key).remove()),Ct(null),ht(!1)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsx)(w.a,{className:t.deleteButton,onClick:function(){Mt(!0)},children:Object(G.jsx)(Ut.a,{})}),Tt&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.form,children:[Object(G.jsx)(Vt.a,{recipient:c,didChangeAvatar:function(){ye(!0)},path:"hubs"}),Object(G.jsx)(nt.a,{className:t.topSpacing,id:"name",label:"Hub",variant:"outlined",fullWidth:!0,value:q,onChange:function(e){var t=e.target.value;"name"===e.target.id&&_(t)}}),Object(G.jsx)(La,{title:"Managers",selectedUsers:te,otherUsers:ue,onChange:function(e,t){var a=[];if(e.forEach((function(e){0===te.filter((function(t){return t.key===e.key})).length&&a.push(e)})),a.length>0){var n=Q,i=me;a.forEach((function(e){n.push(e),i=i.filter((function(t){return t.key!==e.key}))})),Ht(n,i)}ae(e),je(t),function(e){var t=function(e){var t=[];return c.managers.forEach((function(a){0===e.filter((function(e){return e.key===a})).length&&t.push(a)})),t}(e),a={};u.forEach((function(n){if(n.ancestors.includes(M)){var i={};e.forEach((function(e){i[e.key]=!0})),n.managers.forEach((function(e){t.includes(e)||(i[e]=!0)})),a[n.key+"/managers"]=i}})),D.b.database().ref("folders").update(a);var n={};O.forEach((function(a){if(a.ancestors.includes(M)){var i={};e.forEach((function(e){i[e.key]=!0})),a.managers.forEach((function(e){t.includes(e)||(i[e]=!0)})),n[a.key+"/managers"]=i}})),D.b.database().ref("files").update(n)}(e),Kt(e,Q),D.b.database().ref("folders").child(M).update({managers:Object(be.k)(e)})}}),Object(G.jsx)(La,{title:"Users",selectedUsers:Q,otherUsers:me,onChange:Ht}),Object(G.jsx)(x.a,{className:t.topSpacing,variant:"subtitle1",gutterBottom:!0,children:"Groups"}),1===B.length&&Object(G.jsx)("span",{className:t.noGroupsLabel,children:"This hub doesn't have any groups"}),B.filter((function(e){return!e.toDelete})).filter((function(e){return"All Users"!==e.name})).map((function(e){return Object(G.jsx)(V.a,{className:t.groupChip,label:1===e.users.length?e.name+" ("+e.users.length+" User)":e.name+" ("+e.users.length+" Users)",onClick:"All Users"!==e.name&&(a=e,function(){v(a),He(!0)})},e.key);var a})),Object(G.jsx)(C.a,{title:"New Group",children:Object(G.jsx)(w.a,{onClick:function(){Ve(!0)},children:Object(G.jsx)(vt.a,{})})}),Object(G.jsx)(x.a,{className:t.topSpacing,variant:"subtitle1",gutterBottom:!0,children:"Calendars"}),0===L.length&&Object(G.jsx)("span",{className:t.noGroupsLabel,children:"This hub doesn't have any Calendars"}),L.map((function(e){return Object(G.jsx)(V.a,{className:t.groupChip,label:e.name,onDelete:(a=e,function(){Ct(a),ht(!0)}),onClick:_t(e)},e.key);var a})),Object(G.jsx)(C.a,{title:"New Calendar",children:Object(G.jsx)(w.a,{onClick:function(){rt(!0)},children:Object(G.jsx)(vt.a,{})})}),Object(G.jsx)(x.a,{className:t.topSpacing,variant:"subtitle1",gutterBottom:!0,children:"Usage Data"}),Object(G.jsxs)("div",{children:[Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){Xe(!0)},className:t.usageButton,children:"User Data"}),Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){et(!0)},className:t.usageButton,children:"File Data"})]}),Rt&&Object(G.jsx)(x.a,{className:t.topSpacing,variant:"subtitle1",gutterBottom:!0,children:"Archive"}),Rt&&Object(G.jsx)("div",{children:Object(G.jsx)(K.a,{variant:"outlined",color:"primary",onClick:function(){gt(!0)},className:t.archiveButton,children:"Archive Files"})})]}),(!!xe||c.name!==q)&&Object(G.jsx)(Xt,{onClick:function(){!function(){Gt.apply(this,arguments)}()}}),Object(G.jsx)($e,{}),Ce&&Object(G.jsx)(ct.a,{size:56,className:t.buttonProgress}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:Le,autoHideDuration:6e3,onClose:Yt,children:Object(G.jsx)(_n,{onClose:Yt,severity:Ee,children:De})})}),Object(G.jsx)(Wa,{open:Me,onClose:function(e,t){e&&t&&(D.b.database().ref("groups").child(t.key).update({name:t.name,users:Object(be.k)(e)}),He(!1),v({name:"",hub:"",users:[]}))},onDelete:function(e){D.b.database().ref("groups").child(e.key).remove(),v({key:"",name:"",hub:"",users:[]}),He(!1)},hubUsers:Q,group:y,hub:c}),Object(G.jsx)(Na,{open:ze,onClose:function(e,t){""!==e&&"All Users"!==e&&t&&D.b.database().ref("groups").push({name:e,hub:M}),Ve(!1)},title:"New Group",message:"Enter a name for the new group."}),Object(G.jsx)(Na,{open:it,onClose:function(e,t){""!==e&&t&&D.b.database().ref("calendars").child(Object(be.m)(19)).set({name:e,hub:M}),rt(!1)},title:"New Calendar",message:"Enter a name for the new Calendar."}),Object(G.jsx)(Na,{open:dt,onClose:function(e,t){""!==e&&t&&D.b.database().ref("calendars").child(S.key).update({name:e}),E({key:"",name:""}),ut(!1)},title:"Edit Calendar",message:"Enter a name for the Calendar.",initialValue:S.name}),ft&&Object(G.jsx)(ya,{title:"Delete Calendar",message:"Are you sure you want to delete this calendar and all it's events?",open:ft,onClose:Zt}),ft&&Object(G.jsx)(ya,{title:"Delete Calendar",message:"Are you sure you want to delete this calendar and all it's events?",open:ft,onClose:Zt}),Wt&&Object(G.jsx)(ya,{title:"Delete Hub",message:"Are you sure you want to delete this hub?",open:Wt,onClose:function(e){!0===e&&wt&&(c.managers.includes(wt.key)||"System Digital Manager"===wt.role)&&(u.filter((function(e){return e.ancestors.includes(c.key)})).length+O.filter((function(e){return e.ancestors.includes(c.key)})).length>0?(Te("error"),Re("This hub contains files and/or folders, you need to delete them before deleting the hub"),Ie(!0)):(console.log("DELETE: "+c.key),D.b.storage().ref().child("avatars/hubs/"+M+"/avatar.png").delete(),j.forEach((function(e){e.hub===c.key&&(e.events.forEach((function(e){D.b.database().ref("events").child(e.key).remove()})),D.b.database().ref("calendars").child(e.key).remove())})),b.forEach((function(e){e.hub===c.key&&D.b.database().ref("groups").child(e.key).remove()})),D.b.database().ref("folders").child(c.key).remove(),a.goBack())),Mt(!1)}}),_e&&Object(G.jsx)(sn,{open:_e,onClose:function(){Xe(!1)},hub:c}),Je&&Object(G.jsx)(en,{open:Je,onClose:function(){et(!1)},hub:c}),pt&&Object(G.jsx)(Gn,{open:pt,onClose:function(){gt(!1)},hub:c})]}),!Tt&&Object(G.jsx)(Nt,{})]})}var Zn=a(556),Qn=a.n(Zn),Jn=Object(O.a)((function(e){return{position:{position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10}}}));function $n(e){var t=Jn();return Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.position,onClick:e.onClick,children:Object(G.jsx)(Qn.a,{})})}var ei=Object(O.a)((function(e){return{topSpacing:{marginTop:e.spacing(2)},dragDropZone:{padding:"2rem",textAlign:"center",margin:10},insideDropArea:{padding:"2rem",textAlign:"center",background:"rgb(200, 200, 200)",margin:10},droppedFiles:{textAlign:"left",fontWeight:"bold",padding:"3px"}}}));function ti(e){var t=ei(),a=e.data,n=e.dispatch;return Object(G.jsxs)(pt.a,{className:a.inDropZone?t.insideDropArea:t.dragDropZone,elevation:2,onDrop:function(e){return function(e){e.preventDefault(),e.stopPropagation();var t=Object(Jt.a)(e.dataTransfer.files);t=t.filter((function(e){return""!==e.type}));for(var i=0;i<t.length;i++)t[i].key=Object(be.m)(25);if(t&&t.length>0){var r=a.fileList.map((function(e){return e.key}));t=t.filter((function(e){return!r.includes(e.key)})),n({type:"ADD_FILE_TO_LIST",files:t}),e.dataTransfer.clearData(),n({type:"SET_DROP_DEPTH",dropDepth:0}),n({type:"SET_IN_DROP_ZONE",inDropZone:!1})}n({type:"SET_IN_DROP_ZONE",inDropZone:!1})}(e)},onDragOver:function(e){return function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",n({type:"SET_IN_DROP_ZONE",inDropZone:!0})}(e)},onDragEnter:function(e){return function(e){e.preventDefault(),e.stopPropagation(),n({type:"SET_DROP_DEPTH",dropDepth:a.dropDepth+1})}(e)},onDragLeave:function(e){return function(e){e.preventDefault(),e.stopPropagation(),n({type:"SET_DROP_DEPTH",dropDepth:a.dropDepth-1}),a.dropDepth>0||n({type:"SET_IN_DROP_ZONE",inDropZone:!1})}(e)},children:[Object(G.jsxs)(K.a,{color:"primary",component:"label",children:["Select",Object(G.jsx)("input",{type:"file",multiple:!0,hidden:!0,onChange:function(e){var t=e.target.files;if(FileReader&&t&&t.length){var i=new FileReader;i.onload=function(){for(var e=Object(Jt.a)(t),i=0;i<t.length;i++)t[i].key=Object(be.m)(25);if(e&&e.length>0){var r=a.fileList.map((function(e){return e.key}));(e=e.filter((function(e){return!r.includes(e.key)}))).forEach((function(e){a.fileList.push(e)})),n({type:"SET_DROP_DEPTH",dropDepth:0}),n({type:"SET_IN_DROP_ZONE",inDropZone:!1})}},i.readAsDataURL(t[0])}}})]}),Object(G.jsx)("span",{children:"or drag files to upload"})]})}var ai=a(119),ni=a(586),ii=a(559),ri=a(560),ci=a.n(ri),si=a(1054),oi=a(1003),li=a(102),di=a.n(li),ui=a(241),ji=a.n(ui),bi=a(567),fi=a.n(bi),hi=a(240),mi=a.n(hi),Oi=a(565),pi=a.n(Oi),gi=a(566),xi=a.n(gi),yi=(a(188),a(584)),vi=Object(O.a)((function(e){return{root:{textAlign:"center",paddingLeft:10},title:{marginTop:15},calendarControl:{margin:20},textField:{marginLeft:20,marginRight:20,marginBottom:20},colorPicker:{paddingLeft:15,paddingRight:15,paddingBottom:15,alignSelf:"center"},button:{marginLeft:20,marginRight:20,marginBottom:20}}}));function ki(e){var t=vi(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)("#f44336"),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(),j=Object(m.a)(u,2),b=j[0],f=j[1];Object(n.useEffect)((function(){!b&&e.calendars[0]&&f(e.calendars[0])}),[e]);return Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)("h4",{className:t.title,children:P()(e.date).format("DD/MM/YYYY")}),Object(G.jsxs)(Ft.a,{className:t.calendarControl,children:[Object(G.jsx)(Tt.a,{htmlFor:"age-native-simple",children:"Calendar"}),Object(G.jsx)(Bt.a,{native:!0,value:b&&b.key,onChange:function(t){var a=e.calendars.filter((function(e){return e.key===t.target.value}))[0];a&&f(a)},children:e.calendars.map((function(e){return Object(G.jsx)("option",{value:e.key,children:e.name},e.key)}))})]}),Object(G.jsx)(nt.a,{className:t.textField,id:"outlined-basic",label:"Event Name",variant:"outlined",value:r,onChange:function(e){c(e.target.value)}}),Object(G.jsx)(yi.a,{onChange:function(e){d(e.hex)},color:l,className:t.colorPicker}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){""!==r&&(e.addEvent(r,b,l),c(""),d("#f44336"))},children:"Add Event"})]})}var Ci=a(144),wi=Object(O.a)((function(e){return{event:Object(at.a)(Object(at.a)({},e.typography.bodyBold),{},{display:"block",marginTop:5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}}));function Ni(e){var t=wi();return Object(G.jsx)(Ci.a,{onChange:function(t){e.handleDateSelect(t)},defaultView:"month",tileContent:function(a){var n=a.date;if("month"===a.view){var i=e.events.filter((function(e){return P()(e.date).isSame(P()(n),"day")}));if(i.length<=3)return i.map((function(a){return Object(G.jsx)(V.a,{color:"primary",className:t.event,label:a.name,onClick:e.handleEventClick&&e.handleEventClick(a),style:{backgroundColor:a.color}},a.key)}));for(var r=[],c=[],s=0;s<i.length;s++){var o=i[s];s<3?r.push(Object(G.jsx)(V.a,{color:"primary",className:t.event,label:o.name,onClick:e.handleEventClick&&e.handleEventClick(o),style:{backgroundColor:o.color}},o.key)):c.push(o)}return r.push(Object(G.jsx)(V.a,{color:"default",className:t.event,label:i.length-3+" more...",onClick:e.handleMoreEventsClick(c),variant:"outlined"},Object(be.m)(15))),r}}})}var Si=Object(O.a)((function(e){return{root:{textAlign:"center",paddingLeft:10},backButton:{position:"fixed",marginLeft:0,paddingLeft:25,paddingRight:25,width:25,zIndex:1},title:{marginTop:9,paddingLeft:35,paddingRight:25},calendarName:{marginTop:10},textField:{margin:20},colorPicker:{paddingLeft:15,paddingRight:15,paddingBottom:15,alignSelf:"center"},button:{marginLeft:20,marginRight:20,marginBottom:20},event:{width:"100%",marginTop:5,marginLeft:5,marginRight:5},noEventsText:{paddingTop:10,color:"rgb(140, 140, 140)"}}}));function Ei(e){var t=Si(),a=Object(n.useState)(),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(!1),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useContext)(h.b).events,p=Object(n.useState)([]),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)([]),k=Object(m.a)(v,2),C=k[0],N=k[1];Object(n.useEffect)((function(){var t=[],a=[];e.calendars.forEach((function(e){var n={name:e.name,eventsOnDay:[]};e.events.forEach((function(e){var t=O.filter((function(t){return t.key===e.key}))[0];t&&(P()(t.date).isSame(P()(r),"day")&&n.eventsOnDay.push(t),a.push(t))})),t.push(n)})),N(a),y(t),d(e.selectedEvents)}),[O,r,e]);return Object(G.jsxs)(dt.a,{onClose:function(){e.onClose(l)},"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[r?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(w.a,{onClick:function(){console.log(l),c()},component:"span",className:t.backButton,children:Object(G.jsx)(Rt.a,{})}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{children:Object(G.jsx)("h3",{className:t.title,children:P()(r).format("DD/MM/YYYY")})})}),0===x.length&&Object(G.jsx)("span",{className:t.noEventsText,children:"There are no Calendars available, create one from the Hub Management Page"}),x.map((function(a){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("h5",{className:t.calendarName,children:a.name}),0===a.eventsOnDay.length&&Object(G.jsx)("span",{className:t.noEventsText,children:"There are no events on this date yet"}),a.eventsOnDay.map((function(a){return Object(G.jsx)(Mt.a,{children:Object(G.jsx)(V.a,{avatar:l.filter((function(e){return e.key===a.key})).length>0&&Object(G.jsx)(pi.a,{style:{backgroundColor:a.color}}),size:"medium",color:"primary",className:t.event,clickable:!0,label:a.name,onClick:(n=a,function(){if(l.filter((function(e){return e.key===n.key}))[0]){var t=l.filter((function(e){return e.key!==n.key}));if(d(t),e.selectionChanged(t),e.file){var a={};e.file.events.forEach((function(e){e.key!==n.key&&(a[e.key]=!0)})),D.b.database().ref("files").child(e.file.key).update({events:a});var i={};n.files.forEach((function(t){t.key!==e.file.key&&(i[t.key]=!0)})),D.b.database().ref("events").child(n.key).update({files:i})}}else{var r=[].concat(Object(Jt.a)(l),[n]);if(d(r),e.selectionChanged(r),e.file){var c=Object(be.k)(e.file.events);c[n.key]=!0,D.b.database().ref("files").child(e.file.key).update({events:c});var s=Object(be.k)(n.files);s[e.file.key]=!0,D.b.database().ref("events").child(n.key).update({files:s})}}}),style:{backgroundColor:a.color}},a.key)},a.key);var n}))]})}))]}),Object(G.jsx)(w.a,{onClick:function(){f(!0)},component:"span",children:Object(G.jsx)(xi.a,{})})]})]}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("h4",{className:t.title,children:"Select a Date"}),Object(G.jsx)("div",{className:t.calendarContainer,children:Object(G.jsx)(Ni,{handleDateSelect:function(e){c(e)},events:C,selectedEvents:l})})]}),Object(G.jsx)(ki,{open:b,onClose:function(){f(!1)},date:r,addEvent:function(e,t,a){var n=D.b.database().ref("events"),i="-"+Object(be.m)(20),c={date:P()(r).toString(),name:e,calendar:t.key,color:a.replace("#","")};n.child(i).set(c),D.b.database().ref("calendars/"+t.key+"/events/").child(i).set(!0),d((function(e){return[].concat(Object(Jt.a)(e),[c])})),f(!1)},calendars:e.calendars})]})}var Ti=a(1072),Fi=Object(O.a)((function(e){return{list:{width:"100%",padding:0},container:{height:"100%",margin:0,paddingLeft:15},chip:{marginLeft:10,marginTop:5,marginBottom:5},nameTextField:{marginLeft:15,marginRight:15},title:{flexGrow:1},sectionTitle:{marginLeft:15,marginTop:10}}})),Bi=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Di(e){var t=Fi(),a=Object(n.useContext)(h.b).users,r=Object(n.useContext)(h.d).currentUserData,c=Object(n.useState)([]),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(""),O=Object(m.a)(f,2),y=O[0],v=O[1],k=Object(n.useState)([]),C=Object(m.a)(k,2),N=C[0],S=C[1];Object(n.useEffect)((function(){l(e.selectedUsers),b(e.managers),S(e.selectedGroups),e.ancestorHubs.forEach((function(e){e.groups.forEach((function(t){"All Users"===t.name&&(t.displayName="All in '"+e.name+"'")}))}))}),[e.open]);var E=function(e){return function(){var t=Object(Jt.a)(o);t.push(e),l(t),v("")}},T=function(e){return function(){var t=Object(Jt.a)(o);e.users.forEach((function(e){var n=a.filter((function(t){return t.key===e.key}));if(1===n.length){var i=n[0];0===t.filter((function(e){return e.key===i.key})).length&&t.push(i),l(t)}}));var n=Object(Jt.a)(N);n.push(e),S(n)}},F=function(e){return function(){var t=o.filter((function(t){return t.key!==e.key}));l(t)}},R=function(e){return function(){var t=Object(Jt.a)(o);e.users.forEach((function(a){var n=!0;N.forEach((function(t){t.key!==e.key&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!1)})),n&&(t=t.filter((function(e){return e.key!==a.key})))})),l(t);var a=N.filter((function(t){return t.key!==e.key}));S(a)}},P=function(){if(v(""),e.file&&(e.file.managers.includes(r.key)||"System Digital Manager"===r.role||e.file.uploadedBy===r.key)){var t=D.b.database().ref("files").child(e.file.key),n=[];N.forEach((function(e){n.push(e.key)})),e.file.groups=n,t.update({groups:Object(be.k)(N)}),o.forEach((function(t){if(!A(t)){var a=D.b.database().ref("users").child(t.key),n={};t.files.forEach((function(e){n[e]=!0})),n[e.file.key]=!0,a.update({files:n}),t.files.push(e.file.key)}})),a.forEach((function(t){if(0===o.filter((function(e){return e.key===t.key})).length){var a=D.b.database().ref("users").child(t.key),n={};t.files.forEach((function(t){t!==e.file.key&&(n[t]=!0)})),a.update({files:n})}}))}e.onClose(o,N)};function A(e){for(var t=0;t<N.length;t++)for(var a=N[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}function I(e){return e.displayName&&""!==e.displayName?1===e.users?e.displayName+" (1 User)":e.displayName+" ("+e.users.length+" Users)":1===e.users?e.name+" (1 User)":e.name+" ("+e.users.length+" Users)"}return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:P,open:e.open,TransitionComponent:Bi,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:P,"aria-label":"close",children:e.file?Object(G.jsx)(qt.a,{}):Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Users and Groups"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Selected"})}),Object(G.jsx)(Mt.a,{children:j.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,color:"primary"},e.key)}))}),Object(G.jsx)(Mt.a,{children:N.map((function(e){return Object(G.jsx)(V.a,{label:I(e),className:t.chip,onDelete:R(e)},e.key)}))}),Object(G.jsx)(Mt.a,{children:o.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return!A(e)&&Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:e.key!==r.key&&F(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Groups"})}),Object(G.jsx)(Mt.a,{style:{margin:0,padding:0},children:Object(G.jsx)(Mt.a,{children:e.ancestorHubs.sort((function(e,t){return e.ancestors.length>t.ancestors.length?1:e.ancestors.length<t.ancestors.length?-1:0})).map((function(e){return e.groups.length>0&&Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:e.groups.filter((function(e){return!N.includes(e)})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(V.a,{label:I(e),className:t.chip,clickable:!0,onClick:T(e)},e.key)}))})]},e.key)}))})}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:y,onChange:function(e){v(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:a.filter((function(t){return function(t){if(t.key===r.key)return!1;var a=!1;if(t.admins.includes(r.key)||t.createdBy===r.key||"System Digital Manager"===r.role)a=!0;else for(var n=0;n<e.ancestorHubs.length;n++)e.ancestorHubs[n].users.includes(t.key)&&(a=!0);return!(!a||0!==o.filter((function(e){return e.key===t.key})).length||0!==j.filter((function(e){return e.key===t.key})).length||!t.fullName.toLowerCase().includes(y.toLowerCase()))}(t)})).sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return Object(G.jsxs)("div",{onClick:E(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var Ri=Object(O.a)((function(e){return{list:{width:"100%"},container:{margin:0},chip:{marginLeft:15,marginTop:15},messageTextField:{margin:15},title:{flexGrow:1},switch:{margin:10},embargoTitle:{marginLeft:15},embargoCalendar:{marginLeft:15,marginRight:15,maxWidth:500},event:Object(at.a)(Object(at.a)({},e.typography.bodyBold),{},{display:"block",marginTop:5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}})),Pi=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Ai(e){var t=Ri(),a=Object(n.useState)(!1),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(P()()),j=Object(m.a)(u,2),b=j[0],f=j[1];Object(n.useEffect)((function(){e.send&&c(e.send),e.message&&d(e.message)}),[e]);var h=function(){e.onClose({sendNotifications:r,message:l,fromDate:b})};return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:h,open:e.open,TransitionComponent:Pi,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:h,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Notifications"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{className:t.switch,control:Object(G.jsx)(Kt.a,{checked:r,onChange:function(e){"send"===e.target.name&&c(e.target.checked)},name:"send",color:"primary"}),label:"Send Notifications"})})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Notification Message",variant:"outlined",multiline:!0,maxRows:15,value:l,onChange:function(e){d(e.target.value)},className:t.messageTextField})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h4",{className:t.embargoTitle,children:"Embargo Date"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("div",{children:Object(G.jsx)(Ci.a,{className:t.embargoCalendar,onChange:function(e){f(e)},defaultView:"month",tileContent:function(e){e.date,e.view}})})})]})]})}var Li=Object(O.a)((function(e){var t;return{paper:(t={margin:10,paddingTop:5,paddingBottom:5},Object(Ze.a)(t,e.breakpoints.up("md"),{height:140}),Object(Ze.a)(t,e.breakpoints.down("sm"),{height:190}),t),container:{padding:0,marginLeft:0},fileTypeIcon:{fontSize:75,position:"relative",top:"15px"},icons:Object(Ze.a)({paddingLeft:10,paddingRight:10,position:"relative",top:"15px",fontSize:75},e.breakpoints.only("xs"),{paddingLeft:5,paddingRight:5,position:"relative",top:"15px",fontSize:50}),switch:{marginTop:e.spacing(1)},pdfPreview:{marginLeft:5,visibility:"hidden"},fileSizeText:{color:"red",marginLeft:5},removeButton:{position:"absolute",cursor:"pointer",right:20,top:0}}}));function Ii(e){var t,a=Li(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b).folders,c=Object(n.useState)(""),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)(!1),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)([]),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(!1),y=Object(m.a)(x,2),v=y[0],N=y[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(!1),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!0),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!0),K=Object(m.a)(H,2),Y=K[0],V=K[1],q=Object(n.useState)([]),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)([]),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)([]),ae=Object(m.a)(te,2),ne=ae[0],ie=ae[1],re=Object(n.useState)(!1),ce=Object(m.a)(re,2),se=ce[0],oe=ce[1],le=Object(n.useState)(""),de=Object(m.a)(le,2),ue=de[0],je=de[1],fe=Object(n.useState)(!1),he=Object(m.a)(fe,2),me=he[0],Oe=he[1],pe=Object(n.useState)(""),ge=Object(m.a)(pe,2),xe=ge[0],ye=ge[1],ve=0;function ke(){if(null!==e.file&&null!==e.file.name){console.log("Starting File Upload");var t=D.b.storage().ref().child("files/"+e.file.key+"/"+e.file.name),a=t.put(e.file);a.on(D.b.storage.TaskEvent.STATE_CHANGED,(function(t){ve=Math.floor(t.bytesTransferred/t.totalBytes*100),e.handleUploadProgress(e.file,ve)})),a.on(D.b.storage.TaskEvent.STATE_CHANGED,{complete:function(){console.log("upload complete!"),t.getDownloadURL().then((function(t){e.file.url=t,Ce(e.file.key)}))}})}else console.log("File is undefined")}function Ce(t){for(var a={},n=0;n<p.length;n++){a[p[n].key]=!0}var c=D.b.database().ref("files"),s=o;""===s&&(s=e.file.name);var l={};X&&X.forEach((function(e){l[e.key]=!0}));var d={};e.folder.ancestors.forEach((function(e){d[e]=!0})),d[e.folder.key]=!0;var u="";e.file.url&&(u=e.file.url);var j="";e.file.thumbnail&&(j=e.file.thumbnail);var b="";i&&(b=i.key),c.child(t).set({filename:e.file.name,displayName:s,folder:e.folder.id,type:e.file.type,allowDownloads:Y,allowComments:W,allowSharing:A,managers:l,events:a,groups:Object(be.k)(ne),ancestors:d,url:u,thumbnail:j,uploadedBy:b});for(var f=D.b.database().ref("events"),h=0;h<p.length;h++){var m=p[h],O={};O[t]=!0,f.child(m.key).child("files").update(O)}var g={};if($.forEach((function(e){if(g[e.key]=!0,!function(e){for(var t=0;t<ne.length;t++)for(var a=ne[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}(e)){var a=D.b.database().ref("users"),n={};n[t]=!0,a.child(e.key).child("files").update(n)}})),se){var x=D.b.database().ref("notifications"),y="file";e.file.type.includes("video")?y="video":"application/pdf"===e.file.type?y="pdf":e.file.type.includes("audio")?y="audio":e.file.type.includes("image")&&(y="image");var v={file:t,title:s,type:y,users:g,managers:l,message:ue,url:u,thumbnail:j,date:P()().toString()},k=Object(be.i)(e.file,e.folder,r,i).reverse()[0];void 0!==k&&(v.hubName=k.name),x.push(v)}console.log("File Added Successfully"),ve=100}function we(e){"downloads"===e.target.name?V(e.target.checked):"comments"===e.target.name?M(e.target.checked):"sharing"===e.target.name&&L(e.target.checked)}return e.biRef.filesForUpload=e.biRef.filesForUpload.filter((function(t){return t.key!==e.file.key})),e.biRef.filesForUpload.push({key:e.file.key,startUpload:function(){e.file&&(e.file.type.includes("video"),e.handleUploadStart(e.file),e.file.type.includes("video")?function(){if(console.clear(),null===e.file||null===e.file.name)return void console.log("File is undefined");D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(a){var n=a.data.key;new ii.BunnyCdnStream({videoLibrary:be.b,apiKey:n}).createVideo({title:e.file.name}).then((function(a){var i=Math.floor(new Date/1e3)+86400,r=be.b+n+i+a.guid,c=ci.a.hash(r);(t=new ni.a(e.file,{endpoint:"https://video.bunnycdn.com/tusupload",retryDelays:[1,1e3,2e3,3e3,4e3,5e3,6e3,7e3,8e3,9e3,1e4,11e3,12e3,13e3,14e3,15e3,16e3,17e3,18e3,19e3,2e4,25e3,3e4,4e4,5e4,6e4,7e4,8e4,9e4,1e5],headers:{AuthorizationSignature:c,AuthorizationExpire:i,VideoId:a.guid,LibraryId:be.b},metadata:{filetype:e.file.type,title:e.file.name,filename:e.file.name},onError:function(e){console.log(e)},onProgress:function(a,n){ve=Math.floor(a/n*100),e.handleUploadProgress(e.file,ve,t)},onSuccess:function(){console.log("Success"),Ce(a.guid)},onShouldRetry:function(e,t,a){return console.log("Error",e),console.log("Request",e.originalRequest),console.log("Response",e.originalResponse),403!==(e.originalResponse?e.originalResponse.getStatus():0)}})).start()}))})).catch((function(e){console.log("Error"),console.log(e.code),console.log(e.message),console.log(e.details)}))}():"application/pdf"===e.file.type?function(){console.log("Uploading PDF Thumbnail");var t=function(e){for(var t=atob(e.split(",")[1]),a=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(t.length),i=new Uint8Array(n),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return new Blob([n],{type:a})}(document.querySelector(".import-pdf-page-"+e.file.key+" canvas").toDataURL("image/png")),a=D.b.storage().ref().child("files/"+e.file.key+"/thumbnail");a.put(t).on(D.b.storage.TaskEvent.STATE_CHANGED,{complete:function(){console.log("thumbnail upload complete!"),a.getDownloadURL().then((function(t){e.file.thumbnail=t,ke()}))}})}():ke())},changeSettings:function(t){t.events.forEach((function(t){t.files.push(e.file.key)})),oe(t.sendNotifications),je(t.notificationMessage),g(t.events),M(t.allowComments),V(t.allowDownloads),L(t.allowSharing),ee(t.selectedUsers),ie(t.selectedGroups),Z(t.managers)}}),Object(n.useEffect)((function(){if(Z(e.managers),0===e.managers.filter((function(e){return e.key===i.key})).length&&0===$.length&&ee([i]),e.file&&e.file.size>5e9){Oe(!0);var t=(e.file.size/1e9).toFixed(2);ye(t.toString()+"GB"),e.showFileSizeMessage()}}),[e.managers]),Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(pt.a,{elevation:1,className:a.paper,children:Object(G.jsx)(Wt.a,{fluid:!0,className:a.container,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{xl:"1",lg:"1",md:"1",sm:"1",xs:"1",className:a.red,children:Object(G.jsx)(ai.a,{file:e.file,className:a.pdfPreview,loading:Object(G.jsx)(G.Fragment,{}),error:Object(G.jsx)(G.Fragment,{}),noData:Object(G.jsx)(G.Fragment,{}),children:Object(G.jsx)(ai.b,{pageNumber:1,className:"import-pdf-page-"+e.file.key,height:112,width:200})})}),Object(G.jsxs)(Ht.a,{xl:"5",lg:"5",md:"10",sm:"10",xs:"10",className:a.blue,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("h5",{children:e.file.name}),me&&Object(G.jsx)("span",{className:a.fileSizeText,children:xe})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(si.a,{value:o,onChange:function(e){l(e.target.value)},placeholder:"Display Name",fullWidth:!0,disableUnderline:!0,endAdornment:!0})})]}),Object(G.jsxs)(Ht.a,{xl:"3",lg:"3",md:"6",sm:"6",xs:"6",className:a.red,children:[Object(G.jsx)(C.a,{title:"Events",children:Object(G.jsx)(w.a,{className:a.icons,onClick:function(){b(!0)},children:Object(G.jsx)(k.a,{badgeContent:p.length,color:"primary",children:Object(G.jsx)(di.a,{})})})}),Object(G.jsx)(C.a,{title:"Notifications",children:Object(G.jsx)(w.a,{className:a.icons,onClick:function(){F(!0)},children:Object(G.jsx)(k.a,{badgeContent:se?Object(G.jsx)(mi.a,{}):Object(G.jsx)(z.a,{}),color:"primary",children:Object(G.jsx)(ji.a,{})})})}),Object(G.jsx)(C.a,{title:"Users and Groups",children:Object(G.jsx)(w.a,{className:a.icons,onClick:function(){N(!0)},children:Object(G.jsx)(k.a,{badgeContent:$.length+X.length,color:"primary",children:Object(G.jsx)(De.a,{})})})}),Object(G.jsx)(C.a,{title:"Copy Settings To All",children:Object(G.jsx)(w.a,{className:a.icons,onClick:function(){var t={events:p,allowComments:W,allowSharing:A,allowDownloads:Y,selectedUsers:$,selectedGroups:ne,managers:X,sendNotifications:se,notificationMessage:ue};e.handleCopyClick(t)},children:Object(G.jsx)(fi.a,{})})})]}),Object(G.jsxs)(Ht.a,{className:a.green,xl:"3",lg:"3",md:"6",sm:"6",xs:"6",children:[Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:Y,onChange:we,name:"downloads",color:"primary"}),label:"Allow Downloads"})}),Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:W,onChange:we,name:"comments",color:"primary"}),label:"Allow Comments"})}),Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:A,onChange:we,name:"sharing",color:"primary"}),label:"Allow Sharing"})}),Object(G.jsx)(z.a,{className:a.removeButton,onClick:function(){e.handleRemoveClick(e.file)}})]})]})})}),Object(G.jsx)(Ei,{open:j,onClose:function(e){g(e),b(!1)},selectionChanged:function(e){g(e)},selectedEvents:p,calendars:e.calendars}),Object(G.jsx)(Di,{open:v,onClose:function(e,t){ie(t),ee(e),N(!1)},selectedUsers:$,selectedGroups:ne,managers:X,ancestorHubs:e.ancestorHubs}),Object(G.jsx)(Ai,{open:T,onClose:function(e){oe(e.sendNotifications),je(e.message),F(!1)},message:ue,send:se})]})}var Ui=a(568),Wi=a.n(Ui),Mi=Object(O.a)((function(e){return{toolbar:{position:"sticky",top:0,minWidth:400,width:"100%",zIndex:1,padding:0},title:{textAlign:"center",margin:5},uploadLabel:{marginLeft:5,marginRight:5,marginBottom:0,padding:0,display:"flex",alignItems:"center",justifyContent:"left",height:"100%"},noUploadsMessage:{marginTop:10,marginBottom:10,justifyContent:"center",alignContent:"center",textAlign:"center",width:"100%",display:"flex",color:"rgb(150, 150, 150)"},uploadProgress:{margin:5},columnPadding:{padding:0},rowPadding:{padding:0}}}));function Hi(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,Object(at.a)({variant:"determinate"},e)),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"textSecondary",children:"".concat(Math.round(e.value),"%")})})]})}function Ki(e){var t=Mi(),a=Object(n.useState)(null),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Boolean(r),o=Object(n.useContext)(h.d).currentUserData,l=Object(n.useReducer)((function(e){return e+1}),0),d=Object(m.a)(l,2)[1],u=Object(n.useState)([]),j=Object(m.a)(u,2),b=j[0],f=j[1];Object(n.useEffect)((function(){o&&f(e.uploads)}),[o,e]);var O=function(e){return 100===e.progress||!!(e.progress>=0&&e.file.type.includes("video"))};return Object(G.jsxs)("div",{children:[Object(G.jsx)("div",{onClick:function(e){c(e.currentTarget)},className:t.avatarDiv,children:Object(G.jsx)(C.a,{title:"Files",children:Object(G.jsx)(k.a,{badgeContent:b.filter((function(e){return!0===e.show&&e.progress<100})).length,color:"primary",overlap:"circular",children:Object(G.jsx)(w.a,{"aria-label":"delete",children:Object(G.jsx)(Wi.a,{})})})})}),Object(G.jsx)(N.a,{id:"menu-appbar",style:{zIndex:35001},anchorEl:r,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:s,onClose:function(){c(null)},MenuListProps:{disablePadding:!0},children:Object(G.jsxs)("div",{className:t.toolbar,children:[Object(G.jsx)("h4",{className:t.title,children:"Uploads"}),Object(G.jsx)(xe.a,{}),b.filter((function(e){return!0===e.show})).map((function(e){return Object(G.jsxs)(Wt.a,{children:[Object(G.jsxs)(Mt.a,{className:t.rowPadding,children:[Object(G.jsx)(Ht.a,{className:t.columnPadding,children:Object(G.jsx)("span",{className:t.uploadLabel,children:e.file.name})}),Object(G.jsx)(Hi,{className:t.uploadProgress,variant:"determinate",color:"primary",value:e.progress}),Object(G.jsx)(w.a,{onClick:(a=e,function(){var e=b.filter((function(e){return e.file.key===a.file.key}))[0];e&&(100===e.progress?e.show=!1:a.file.type.includes("video")&&(!0===e.aborted?e.show=!1:a.tusUpload&&(a.tusUpload.abort(),e.aborted=!0))),d()}),disabled:!O(e),children:Object(G.jsx)(z.a,{})})]}),Object(G.jsx)(xe.a,{})]});var a})),0===b.filter((function(e){return!0===e.show})).length&&Object(G.jsx)("span",{className:t.noUploadsMessage,children:"No Current Uploads"})]})})]})}function Yi(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}var zi=Object(O.a)((function(e){return{root:{paddingBottom:65}}}));function Vi(){var e=zi(),t=Object(o.e)(),a=Object(o.f)(),i=Object(n.useContext)(h.b),r=i.users,c=i.calendars,s=i.folders,l=i.groups,u=Object(n.useState)([]),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(!1),p=Object(m.a)(O,2),g=p[0],x=p[1],y=Object(n.useState)(!1),v=Object(m.a)(y,2),k=v[0],N=v[1],S=Object(n.useState)(),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.d).currentUserData,R=Object(n.useState)([]),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)([]),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(-1),K=Object(m.a)(H,2),Y=K[0],V=K[1],q=Object(n.useState)([]),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useReducer)((function(e){return e+1}),0),J=Object(m.a)(Q,2)[1],$=Object(d.b)(),ee=$.enqueueSnackbar,te=$.closeSnackbar,ae=function(e){return Object(G.jsx)(Mn.a,{position:"relative",display:"inline-flex",children:Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Ki,{uploadCount:Y,uploads:X}),Object(G.jsx)(C.a,{title:"Dismiss",children:Object(G.jsx)(w.a,{onClick:fe,children:Object(G.jsx)(z.a,{})})})]})})},ne={filesForUpload:[]};Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||t.replace("/signin?url="+a.pathname)})),n=[];if(a.folder){a.folder.managers.forEach((function(e){var t=r.filter((function(t){return t.key===e}))[0];t&&n.push(t)}));var i=s.filter((function(e){return e.hub&&a.folder.ancestors.includes(e.key)}));if(i=i.filter((function(e){return e.managers.includes(B.key)||"System Digital Manager"===B.role||e.users.includes(B.key)})),a.folder.hub&&i.push(a.folder),i.forEach((function(e){var t=l.filter((function(t){return t.hub===e.key}));e.groups=t})),M(i),a.folder.managers.includes(B.key)||"System Digital Manager"===B.role||B.permissions.uploadEditOwnVideo){F(!0);var o=[];c.forEach((function(e){var t=!1;(e.user===B.key||e.hub===a.folder.key||a.folder.ancestors.includes(e.hub))&&(t=!0),t&&o.push(e)})),L(o)}else F(!1)}else t.replace("/files");return f(n),function(){return e()}}),[a.folder,r,t,B,c,s,l]);var ie=Object(n.useReducer)((function(e,t){switch(t.type){case"SET_DROP_DEPTH":return Object(at.a)(Object(at.a)({},e),{},{dropDepth:t.dropDepth});case"SET_IN_DROP_ZONE":return Object(at.a)(Object(at.a)({},e),{},{inDropZone:t.inDropZone});case"ADD_FILE_TO_LIST":return Object(at.a)(Object(at.a)({},e),{},{fileList:e.fileList.concat(t.files)});case"REMOVE_FILE_FROM_LIST":return Object(at.a)(Object(at.a)({},e),{},{fileList:e.fileList.filter((function(e){return e.key!==t.file.key}))});default:return e}}),{dropDepth:0,inDropZone:!1,fileList:[]}),re=Object(m.a)(ie,2),ce=re[0],se=re[1];function oe(e){for(var t=0;t<ne.filesForUpload.length;t++)ne.filesForUpload[t].changeSettings(e);x(!0)}var le=function(e,t){"clickaway"!==t&&x(!1)};function de(){N(!0)}function ue(e){se({type:"REMOVE_FILE_FROM_LIST",file:e})}function je(e){var t=X;t.push({file:e,progress:0,show:!0}),Z(t)}function be(e,t,a){var n=X.filter((function(t){return t.file.key===e.key}))[0];n&&(n.tusUpload=a,n.progress=t),Z(X),J(),ee("Uploading files",{variant:"default",action:ae,persist:!0,key:"fileUpload",preventDuplicate:!0})}function fe(){te("fileUpload")}return Object(G.jsxs)(G.Fragment,{children:[T&&Object(G.jsxs)("div",{className:e.root,onDrop:function(e){return function(e){e.preventDefault(),e.stopPropagation()}(e)},onDragOver:function(e){return function(e){e.preventDefault(),e.stopPropagation()}(e)},onDragEnter:function(e){return function(e){e.preventDefault(),e.stopPropagation()}(e)},onDragLeave:function(e){return function(e){e.preventDefault(),e.stopPropagation()}(e)},children:[Object(G.jsx)(Pt,{}),Object(G.jsx)(ti,{data:ce,dispatch:se}),ce.fileList.map((function(e){return Object(G.jsx)(Ii,{file:e,managers:b,folder:a.folder,biRef:ne,handleCopyClick:oe,handleRemoveClick:ue,calendars:A,ancestorHubs:W,showFileSizeMessage:de,handleUploadStart:je,handleUploadProgress:be},e.name)})),Object(G.jsx)($n,{onClick:function(){V(ne.filesForUpload.length),Z([]),ee("Uploading files",{variant:"default",action:ae,persist:!0,key:"fileUpload",preventDuplicate:!0});for(var e=0;e<ne.filesForUpload.length;e++)ne.filesForUpload[e].startUpload();t.goBack()}}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:g,autoHideDuration:6e3,onClose:le,children:Object(G.jsx)(Yi,{onClose:le,severity:"success",children:"Settings copied to all files"})})})]}),!1===T&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),Object(G.jsx)(va,{open:k,onClose:function(){N(!1)},title:"File Size Warning",message:"One or more of the selected files is larger than 5GB"})]})}var Gi=Object(O.a)((function(e){var t;return{paper:(t={margin:10,paddingTop:5,paddingBottom:5},Object(Ze.a)(t,e.breakpoints.up("md"),{height:140}),Object(Ze.a)(t,e.breakpoints.down("sm"),{height:190}),t),container:{marginLeft:15},fileTypeIcon:{fontSize:75,position:"relative",top:"15px"},icons:Object(Ze.a)({paddingLeft:10,paddingRight:10,position:"relative",top:"15px",fontSize:75},e.breakpoints.only("xs"),{paddingLeft:5,paddingRight:5,position:"relative",top:"15px",fontSize:50}),switch:{marginTop:e.spacing(1)}}}));function qi(e){var t=Gi(),a=Object(o.e)(),i=Object(o.f)(),r=Object(n.useContext)(h.b),c=r.users,s=r.calendars,l=r.folders,d=r.groups,u=Object(n.useContext)(h.d).currentUserData,j=Object(n.useState)(),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(""),N=Object(m.a)(v,2),S=N[0],E=N[1],T=Object(n.useState)(!1),F=Object(m.a)(T,2),B=F[0],R=F[1],A=Object(n.useState)([]),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)(!1),M=Object(m.a)(W,2),H=M[0],Y=M[1],V=Object(n.useState)(!1),q=Object(m.a)(V,2),_=q[0],X=q[1],Z=Object(n.useState)(!1),Q=Object(m.a)(Z,2),J=Q[0],$=Q[1],ee=Object(n.useState)(!0),te=Object(m.a)(ee,2),ae=te[0],ne=te[1],ie=Object(n.useState)([]),re=Object(m.a)(ie,2),ce=re[0],se=re[1],oe=Object(n.useState)([]),le=Object(m.a)(oe,2),de=le[0],ue=le[1],je=Object(n.useState)([]),fe=Object(m.a)(je,2),he=fe[0],me=fe[1],Oe=Object(n.useState)(!1),pe=Object(m.a)(Oe,2),ge=pe[0],xe=pe[1],ye=Object(n.useState)(""),ve=Object(m.a)(ye,2),ke=ve[0],Ce=ve[1],we=Object(n.useState)([]),Ne=Object(m.a)(we,2),Se=Ne[0],Ee=Ne[1],Te=Object(n.useState)([]),Fe=Object(m.a)(Te,2),Be=Fe[0],Re=Fe[1],Pe=Object(n.useState)(!1),Ae=Object(m.a)(Pe,2),Le=Ae[0],Ie=Ae[1],Ue=Object(n.useState)(""),We=Object(m.a)(Ue,2),Me=We[0],He=We[1];function Ke(e){"comments"===e.target.name?ne(e.target.checked):"sharing"===e.target.name&&$(e.target.checked)}return Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||a.replace("/signin?url="+i.pathname)})),t=[];if(i.folder){i.folder.managers.forEach((function(e){var a=c.filter((function(t){return t.key===e}))[0];a&&t.push(a)}));var n=l.filter((function(e){return e.hub&&i.folder.ancestors.includes(e.key)}));if(n=n.filter((function(e){return e.managers.includes(u.key)||"System Digital Manager"===u.role||e.users.includes(u.key)})),i.folder.hub&&n.push(i.folder),n.forEach((function(e){var t=d.filter((function(t){return t.hub===e.key}));e.groups=t})),Re(n),i.folder.managers.includes(u.key)||"System Digital Manager"===u.role||u.permissions.uploadEditOwnVideo){O(!0);var r=[];s.forEach((function(e){var t=!1;(e.user===u.key||e.hub===i.folder.key||i.folder.ancestors.includes(e.hub))&&(t=!0),t&&r.push(e)})),Ee(r)}else O(!1)}else a.replace("/files");return se(t),0===t.filter((function(e){return e.key===u.key})).length&&0===de.length&&ue([u]),function(){return e()}}),[i.folder,c,a,u,s,l,d]),Object(G.jsx)(G.Fragment,{children:f&&Object(G.jsxs)("div",{children:[Object(G.jsx)(Pt,{}),Object(G.jsxs)(pt.a,{elevation:1,className:t.paper,children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.container,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{xl:"6",lg:"6",md:"12",sm:"12",xs:"12",children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(si.a,{value:x,onChange:function(e){y(e.target.value)},placeholder:"URL",fullWidth:!0,disableUnderline:!0,endAdornment:!0}),Object(G.jsx)(si.a,{value:S,onChange:function(e){E(e.target.value)},placeholder:"Display Name",fullWidth:!0,disableUnderline:!0,endAdornment:!0})]})}),Object(G.jsxs)(Ht.a,{xl:"3",lg:"3",md:"6",sm:"6",xs:"6",children:[Object(G.jsx)(C.a,{title:"Events",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){R(!0)},children:Object(G.jsx)(k.a,{badgeContent:I.length,color:"primary",children:Object(G.jsx)(di.a,{})})})}),Object(G.jsx)(C.a,{title:"Notifications",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){X(!0)},children:Object(G.jsx)(k.a,{badgeContent:ge?Object(G.jsx)(mi.a,{}):Object(G.jsx)(z.a,{}),color:"primary",children:Object(G.jsx)(ji.a,{})})})}),Object(G.jsx)(C.a,{title:"Users and Groups",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){Y(!0)},children:Object(G.jsx)(k.a,{badgeContent:de.length+ce.length,color:"primary",children:Object(G.jsx)(De.a,{})})})})]}),Object(G.jsxs)(Ht.a,{xl:"3",lg:"3",md:"6",sm:"6",xs:"6",children:[Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:ae,onChange:Ke,name:"comments",color:"primary"}),label:"Allow Comments"})}),Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:J,onChange:Ke,name:"sharing",color:"primary"}),label:"Allow Sharing"})})]})]})}),Object(G.jsx)(K.a,{id:"ok",onClick:function(){i.folder&&(x.includes("https://")||x.includes("http://")?function(e){for(var t={},n=0;n<I.length;n++){t[I[n].key]=!0}var r=D.b.database().ref("files"),c=S;""===c&&(c=x);var s={};ce&&ce.forEach((function(e){s[e.key]=!0}));var o={};i.folder.ancestors.forEach((function(e){o[e]=!0})),o[i.folder.key]=!0;var l="";u&&(l=u.key);r.child(e).set({filename:x,displayName:c,folder:i.folder.id,type:"link",allowDownloads:!1,allowComments:ae,allowSharing:J,managers:s,events:t,groups:Object(be.k)(he),ancestors:o,uploadedBy:l});for(var d=D.b.database().ref("events"),j=0;j<I.length;j++){var b=I[j],f={};f[e]=!0,d.child(b.key).child("files").update(f)}var h={};if(de.forEach((function(t){if(h[t.key]=!0,!function(e){for(var t=0;t<he.length;t++)for(var a=he[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}(t)){var a=D.b.database().ref("users"),n={};n[e]=!0,a.child(t.key).child("files").update(n)}})),ge){D.b.database().ref("notifications").push({file:e,title:c,type:"link",users:h,managers:s,message:ke,url:x,date:P()().toString()})}console.log("File Added Successfully"),a.goBack()}(Object(be.m)(19)):(He("Please include the full link, starting with http:// or https://"),Ie(!0)))},color:"primary",children:"Add Link"})]}),Object(G.jsx)(Ei,{open:B,onClose:function(e){U(e),R(!1)},selectionChanged:function(e){U(e)},selectedEvents:I,calendars:Se}),Object(G.jsx)(Di,{open:H,onClose:function(e,t){me(t),ue(e),Y(!1)},selectedUsers:de,selectedGroups:he,managers:ce,ancestorHubs:Be}),Object(G.jsx)(Ai,{open:_,onClose:function(e){xe(e.sendNotifications),Ce(e.message),X(!1)},message:ke,send:ge}),Object(G.jsx)(va,{open:Le,onClose:function(){Ie(!1)},title:"Invalid Link",message:Me})]})})}var _i=a(569),Xi=a(390),Zi=Object(O.a)((function(e){return{icon:{fontSize:120,cursor:"pointer"},label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:190,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginLeft:20,width:200,height:185,cursor:"pointer"},thumbnail:{marginTop:5,width:200,height:112}}}));function Qi(e){var t=Zi(),a=Object(n.useState)({mouseX:null,mouseY:null}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.comments,l=s.notifications,d=s.events,u=s.users,j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(""),C=Object(m.a)(k,2),w=C[0],S=C[1];Object(n.useEffect)((function(){S(e.file.displayName)}),[e]);var E=function(e){"renamefile"===e.target.id?T():"deletefile"===e.target.id&&B(),c({mouseX:null,mouseY:null})},T=function(){v(!0)},F=function(t){return function(){(v(!1),"OK"===t)&&((e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&(D.b.database().ref("files").child(e.file.key).update({displayName:w}),e.file.displayName=w))}},B=function(){p(!0)},R=function(t){return function(){p(!1),"OK"===t&&(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&function(){P.apply(this,arguments)}()}};function P(){return(P=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.storage().ref("files").child(e.file.key).child(e.file.filename).delete(),D.b.database().ref("files").child(e.file.key).remove();case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.tile,onClick:e.handleClick,onContextMenu:function(t){t.preventDefault(),(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&c({mouseX:t.clientX-2,mouseY:t.clientY-4})},children:[Object(G.jsx)(Qe.a,{variant:"rounded",className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==r.mouseY,onClose:E,anchorReference:"anchorPosition",anchorPosition:null!==r.mouseY&&null!==r.mouseX?{top:r.mouseY,left:r.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefile",onClick:E,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:E,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:y,onClose:F,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:w,onChange:function(e){S(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:F("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:F("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:O,onClose:R,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:R("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:R("OK"),color:"primary",children:"OK"})]})]})]})}var Ji=Object(O.a)((function(e){return{label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:190,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginBottom:20,width:200,height:140,marginLeft:10,cursor:"pointer"},page:{marginTop:3,textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",margin:"auto",width:"100%"},skeleton:{marginLeft:50},thumbnail:{maxHeight:112,width:"auto",display:"block",marginLeft:"auto",marginRight:"auto"}}}));function $i(e){var t=Ji(),a=Object(n.useState)({mouseX:null,mouseY:null}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.comments,l=s.notifications,d=s.events,u=s.users,j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(""),C=Object(m.a)(k,2),w=C[0],S=C[1];Object(n.useEffect)((function(){S(e.file.displayName)}),[e]);var E=function(e){"renamefile"===e.target.id?T():"deletefile"===e.target.id&&B(),c({mouseX:null,mouseY:null})},T=function(){v(!0)},F=function(t){return function(){(v(!1),"OK"===t)&&((e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&(D.b.database().ref("files").child(e.file.key).update({displayName:w}),e.file.displayName=w))}},B=function(){p(!0)},R=function(t){return function(){p(!1),"OK"===t&&(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&function(){P.apply(this,arguments)}()}};function P(){return(P=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.storage().ref("files").child(e.file.key).child(e.file.filename).delete(),D.b.storage().ref("files").child(e.file.key).child("thumbnail").delete(),D.b.database().ref("files").child(e.file.key).remove();case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.tile,onClick:e.handleClick,onContextMenu:function(t){t.preventDefault(),(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&c({mouseX:t.clientX-2,mouseY:t.clientY-4})},children:[Object(G.jsx)("img",{src:e.file.thumbnail,className:t.thumbnail,alt:"thumbnail"}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==r.mouseY,onClose:E,anchorReference:"anchorPosition",anchorPosition:null!==r.mouseY&&null!==r.mouseX?{top:r.mouseY,left:r.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefile",onClick:E,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:E,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:y,onClose:F,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:w,onChange:function(e){S(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:F("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:F("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:O,onClose:R,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:R("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:R("OK"),color:"primary",children:"OK"})]})]})]})}var er=Object(O.a)((function(e){return{icon:{fontSize:120,cursor:"pointer"},label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:190,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginLeft:20,width:200,height:185,cursor:"pointer"},thumbnail:{marginTop:5,width:200,height:112}}}));function tr(e){var t=er(),a=Object(n.useState)({mouseX:null,mouseY:null}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.comments,l=s.notifications,d=s.events,u=s.users,j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(""),C=Object(m.a)(k,2),w=C[0],S=C[1];Object(n.useEffect)((function(){S(e.file.displayName)}),[e]);var E=function(e){"renamefile"===e.target.id?T():"deletefile"===e.target.id&&B(),c({mouseX:null,mouseY:null})},T=function(){v(!0)},F=function(t){return function(){(v(!1),"OK"===t)&&((e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&(D.b.database().ref("files").child(e.file.key).update({displayName:w}),e.file.displayName=w))}},B=function(){p(!0)},R=function(t){return function(){p(!1),"OK"===t&&(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&function(){P.apply(this,arguments)}()}};function P(){return(P=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.storage().ref("files").child(e.file.key).child(e.file.filename).delete(),D.b.database().ref("files").child(e.file.key).remove();case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.tile,onClick:e.handleClick,onContextMenu:function(t){t.preventDefault(),(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&c({mouseX:t.clientX-2,mouseY:t.clientY-4})},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.url,className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==r.mouseY,onClose:E,anchorReference:"anchorPosition",anchorPosition:null!==r.mouseY&&null!==r.mouseX?{top:r.mouseY,left:r.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefile",onClick:E,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:E,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:y,onClose:F,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:w,onChange:function(e){S(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:F("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:F("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:O,onClose:R,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:R("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:R("OK"),color:"primary",children:"OK"})]})]})]})}var ar=Object(O.a)((function(e){return{icon:{fontSize:120,cursor:"pointer"},label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:190,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginLeft:20,width:200,height:185,cursor:"pointer"},thumbnail:{marginTop:5,width:200,height:112}}}));function nr(e){var t=ar(),a=Object(n.useState)({mouseX:null,mouseY:null}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.comments,l=s.notifications,d=s.events,u=s.users,j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(""),C=Object(m.a)(k,2),w=C[0],S=C[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1];Object(n.useEffect)((function(){S(e.file.displayName)}),[e]);var R=function(e){"renamefile"===e.target.id?P():"deletefile"===e.target.id&&L(),c({mouseX:null,mouseY:null})},P=function(){v(!0)},A=function(t){return function(){(v(!1),"OK"===t)&&((e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&(D.b.database().ref("files").child(e.file.key).update({displayName:w}),e.file.displayName=w))}},L=function(){p(!0)},I=function(t){return function(){p(!1),"OK"===t&&(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&function(){U.apply(this,arguments)}()}};function U(){return(U=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return B(!0),e.next=3,M().then((function(){W()}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){o.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.database().ref("files").child(e.file.key).remove(),B(!1)}function M(){return new Promise((function(t,a){D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(n){var i=n.data.key,r="https://video.bunnycdn.com/library/"+be.b+"/videos/"+e.file.key;fetch(r,{method:"DELETE",headers:{AccessKey:i}}).then((function(e){return e.json()})).then((function(e){console.log(e),t()})).catch((function(e){console.error(e),a()}))})).catch((function(e){console.log(e.code),console.log(e.message),console.log(e.details),a()}))}))}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.tile,onClick:e.handleClick,onContextMenu:function(t){t.preventDefault(),(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&c({mouseX:t.clientX-2,mouseY:t.clientY-4})},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:"https://vz-db0e7359-d70.b-cdn.net/"+e.file.key+"/thumbnail.jpg",className:t.thumbnail,children:Object(G.jsx)(hn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==r.mouseY,onClose:R,anchorReference:"anchorPosition",anchorPosition:null!==r.mouseY&&null!==r.mouseX?{top:r.mouseY,left:r.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefile",onClick:R,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:R,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:y,onClose:A,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:w,onChange:function(e){S(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:A("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:A("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:O,onClose:I,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:I("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:I("OK"),color:"primary",children:"OK"})]}),F&&Object(G.jsx)(ut.a,{})]})]})}var ir=Object(O.a)((function(e){return{icon:{fontSize:120,cursor:"pointer"},label:{textAlign:"center",cursor:"pointer",marginTop:3,marginLeft:5,width:190,overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:3,overflow:"hidden",textOverflow:"ellipsis"},tile:{marginTop:10,marginLeft:20,width:200,height:185,cursor:"pointer"},thumbnail:{marginTop:5,width:200,height:112}}}));function rr(e){var t=ir(),a=Object(n.useState)({mouseX:null,mouseY:null}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.comments,l=s.notifications,d=s.events,u=s.users,j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(""),C=Object(m.a)(k,2),w=C[0],S=C[1];Object(n.useEffect)((function(){S(e.file.displayName)}),[e]);var E=function(e){"renamefile"===e.target.id?T():"deletefile"===e.target.id&&B(),c({mouseX:null,mouseY:null})},T=function(){v(!0)},F=function(t){return function(){(v(!1),"OK"===t)&&((e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&(D.b.database().ref("files").child(e.file.key).update({displayName:w}),e.file.displayName=w))}},B=function(){p(!0)},R=function(t){return function(){p(!1),"OK"===t&&(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&function(){P.apply(this,arguments)}()}};function P(){return(P=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),l.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),d.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),u.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.storage().ref("files").child(e.file.key).child(e.file.filename).delete(),D.b.database().ref("files").child(e.file.key).remove();case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:t.tile,onClick:e.handleClick,onContextMenu:function(t){t.preventDefault(),(e.file.managers.includes(j.key)||"System Digital Manager"===j.role)&&c({mouseX:t.clientX-2,mouseY:t.clientY-4})},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:"https://vz-db0e7359-d70.b-cdn.net/"+e.file.key+"/thumbnail.jpg",className:t.thumbnail,children:Object(G.jsx)(Sn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==r.mouseY,onClose:E,anchorReference:"anchorPosition",anchorPosition:null!==r.mouseY&&null!==r.mouseX?{top:r.mouseY,left:r.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefile",onClick:E,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:E,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:y,onClose:F,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:w,onChange:function(e){S(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:F("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:F("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:O,onClose:R,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:R("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:R("OK"),color:"primary",children:"OK"})]})]})]})}var cr=a(1093),sr=a(1094),or=a(1073),lr=a(570),dr=a.n(lr),ur=Object(O.a)((function(e){return{position:{position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10},speedDial:{position:"absolute",bottom:e.spacing(2),right:e.spacing(2)}}}));function jr(e){var t,a=ur(),i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(""),b=Object(m.a)(j,2),f=b[0],h=b[1],O=function(t){return function(){s(!1),u(!1),"OK"===t&&e.onFolderClick(f)}};return Object(G.jsxs)("div",{className:a.position,children:[Object(G.jsxs)(cr.a,{ariaLabel:"SpeedDial example",className:a.speedDial,hidden:!1,icon:Object(G.jsx)(sr.a,{}),onClose:function(){s(!1)},onOpen:function(){s(!0)},open:c,direction:"up",children:[Object(G.jsx)(or.a,{icon:Object(G.jsx)(Ne.a,{}),tooltipTitle:"Folder",tooltipOpen:!0,onClick:function(){h(""),u(!0)}},"Folder"),Object(G.jsx)(or.a,{icon:Object(G.jsx)(dr.a,{}),tooltipTitle:"File",tooltipOpen:!0,onClick:(t="File",function(){"Folder"===t?e.onFolderClick():"File"===t&&e.onFileClick()})},"File")]}),Object(G.jsxs)(dt.a,{open:d,onClose:O,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"New Folder"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a name for the new folder."}),Object(G.jsx)(nt.a,{value:f,onChange:function(e){h(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:O("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:O("OK"),color:"primary",children:"OK"})]})]})]})}var br=a(69),fr=a(59),hr=a(34),mr=a(88),Or=a(244),pr=a(387),gr=function(e){Object(mr.a)(a,e);var t=Object(Or.a)(a);function a(e){var n;return Object(br.a)(this,a),(n=t.call(this,e)).state={nodeData:[],showIcon:"hidden",isActive:""},n}return Object(fr.a)(a,[{key:"render",value:function(){var e=this;return this.props.nodeData.length<0?null:Object(G.jsx)("div",{style:{textAlign:"left"},children:Object(G.jsx)(pr.a,{open:this.props.open,content:Object(G.jsx)("div",{style:Object(at.a)({},this.props.style.node),children:Object(G.jsx)("span",{value:this.props.content,className:"treeNode",style:this.props.isActive&&this.props.id===this.props.isActive.id?this.props.style.selected:this.props.style.node,onClick:this.props.treeNodeClick?function(){return e.props.treeNodeClick({id:e.props.id,name:e.props.content,parentNode:e.props.parentNode,childNodes:e.props.nodeData})}:null,children:this.props.content},this.props.id)}),children:this.props.nodeData.sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(t,n){return!t.childNodes.length>0?Object(G.jsx)(pr.a,{content:Object(G.jsx)("div",{style:Object(at.a)({},e.props.style.node),children:Object(G.jsx)("span",{style:e.props.isActive&&t.id===e.props.isActive.id?e.props.style.selected:null,value:t.id,className:"treeNode",onClick:e.props.treeNodeClick?function(){return e.props.treeNodeClick(t)}:null,children:t.name},t.id)})},t.id):Object(G.jsx)(a,{nodeData:t.childNodes,isActive:e.props.isActive,id:t.id,parentNode:t.parentNode,content:t.name,treeNodeClick:e.props.treeNodeClick,open:e.props.breadcrumbIds&&e.props.breadcrumbIds.includes(t.id),style:e.props.style,breadcrumbIds:e.props.breadcrumbIds},t.id)}))},this.props.id)})}}]),a}(n.Component),xr={leaf:{cursor:"pointer",display:"inline"},node:{cursor:"pointer",display:"inline",color:"black"},icon:{width:"1em",height:"1em",marginLeft:5,cursor:"cursor"},selected:{color:"rgb(0, 149, 61)"}},yr=function(e){Object(mr.a)(a,e);var t=Object(Or.a)(a);function a(e){var n;return Object(br.a)(this,a),(n=t.call(this,e)).handleTreeNodeClick=function(e){n.setState({selected:e}),n.props.onClick&&n.props.onClick(e)},n.state={selected:null},n.handleTreeNodeClick=n.handleTreeNodeClick.bind(Object(hr.a)(n)),n}return Object(fr.a)(a,[{key:"render",value:function(){var e=this.props,t=e.id,a=e.data,n=e.name,i=e.style;return Object(G.jsx)("div",{children:Object(G.jsx)(gr,{id:t,nodeData:a,content:n,open:!0,treeNodeClick:this.handleTreeNodeClick,isActive:this.props.isActive,breadcrumbIds:this.props.breadcrumbIds,style:Object(at.a)(Object(at.a)({},xr),i)},"dynamicTree")})}}]),a}(i.a.Component),vr=Object(O.a)((function(e){return{foldersColumn:Object(Ze.a)({background:"rgb(230, 230, 230)"},e.breakpoints.down("sm"),{display:"none"}),filesColumn:{background:"rgb(240, 240, 240)"},container:{height:"100vh"},fullHeightRow:{height:"100%"},text:{padding:e.spacing(2,2,0)},contentRow:{paddingBottom:110},list:{width:"100%",paddingBottom:63}}}));function kr(){var e=Object(o.e)(),t=Object(o.f)(),a=vr(),r=Object(n.useState)("Folder"),c=Object(m.a)(r,2),s=c[0],l=c[1],d=Object(n.useState)([]),j=Object(m.a)(d,2),b=j[0],f=j[1],O=Object(n.useState)([]),p=Object(m.a)(O,2),g=p[0],x=p[1],y=Object(n.useState)([]),v=Object(m.a)(y,2),k=v[0],C=v[1],w=Object(n.useState)([]),N=Object(m.a)(w,2),S=N[0],E=N[1],T=Object(n.useState)(),F=Object(m.a)(T,2),R=F[0],A=F[1],L=Object(n.useState)([{name:"Everything",id:"Root",childNodes:[]}]),I=Object(m.a)(L,2),U=I[0],W=I[1],M=Object(n.useContext)(h.b),H=M.files,K=M.folders,Y=M.groups,z=Object(n.useContext)(h.d).currentUserData,V=Object(n.useState)(!1),q=Object(m.a)(V,2),_=q[0],X=q[1],Z=[];function Q(e){var t=e.parentNode;void 0!==t&&void 0!==t.id&&(Z.push({name:t.name,id:t.id,childNodes:t.childNodes}),Q(t))}Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(a){a||e.replace("/signin?url="+t.pathname)}));if(z){u.isMobile&&l("List");var n=K.map((function(e){return{key:e.key,id:e.key,name:e.name,hub:e.hub,parent:e.parent,imageURL:e.imageURL,parentNode:{},childNodes:[],groups:e.groups,managers:e.managers,users:e.users,ancestors:e.ancestors}})),i=[];n.forEach((function(e){var t=!1;(e.managers.includes(z.key)||"System Digital Manager"===z.role||e.hub&&e.users.includes(z.key))&&(t=!0),t&&(i.push(e),e.ancestors.forEach((function(e){var t=n.filter((function(t){return t.key===e}));t[0]&&i.push(t[0])})))})),H.forEach((function(e){Object(be.o)(e,Y,z)&&e.ancestors.forEach((function(e){var t=n.filter((function(t){return t.key===e}));t[0]&&i.push(t[0])}))})),i=Array.from(new Set(i));for(var r=[],c=function(e){var t=i[e];if("Root"===t.parent)r.push(t);else{var a=i.filter((function(e){return e.key===t.parent}))[0];void 0!==a&&(a.childNodes.push(t),t.parentNode=a)}},s=0;s<i.length;s++)c(s);var o=t.pathname.replace("/files/","");if("/files"===o)A(),E(r),C([]);else{var d=i.filter((function(e){return e.id===o}))[0];if(d){var j=i.filter((function(e){return e.key===d.id}))[0];A(j),j&&j.managers&&j.managers.includes(z.key)||"System Digital Manager"===z.role?X(!0):X(!1),E(d.childNodes);var b=[];H.filter((function(e){return e.folder===d.id})).forEach((function(e){Object(be.o)(e,Y,z)&&b.push(e)})),C(b),Z="root"===d.id?[]:[{name:d.name,id:d.id,childNodes:d.childNodes}],Q(d),Z.push({name:"Everything",id:"Root",childNodes:[g]}),Z.reverse(),W(Z)}}f(i),x(r)}return function(){return a()}}),[K,H,t.pathname]);var J=function(t,a){return function(){var a=b.filter((function(e){return e.key===t.id}))[0];a&&a.managers&&a.managers.includes(z.key)||"System Digital Manager"===z.role?X(!0):X(!1),A(a),E(t.childNodes);var n=[];H.filter((function(e){return e.folder===t.id})).forEach((function(e){Object(be.o)(e,Y,z)&&n.push(e)})),C(n),W((function(e){return[].concat(Object(Jt.a)(e),[{name:t.name,id:t.id,childNodes:t.childNodes}])})),e.push("/files/".concat(t.id))}},$=function(t){return function(){D.b.database().ref("fileusage").push({file:t.key,fileName:t.displayName,fileType:t.type,user:z.key,action:"Open",date:P()().toString()}),t.type.includes("video")?e.push({pathname:"/video/".concat(t.key),file:t,folder:R}):t.type.includes("audio")?e.push({pathname:"/audio/".concat(t.key),file:t,folder:R}):t.type.includes("image")?e.push({pathname:"/image/".concat(t.key),file:t,folder:R}):"application/pdf"===t.type?e.push({pathname:"/pdf/".concat(t.key),file:t,folder:R}):e.push({pathname:"/file/".concat(t.key),file:t,folder:R})}},ee=function(t){return function(){var a=0;for(a=0;a<U.length;a++){if(U[a].id===t.id)break}var n=Object(Jt.a)(U);if(n.length=a+1,W(n),"Root"===t.id)X(!1),A(),E(g),C([]),e.push("/files");else{var i=U.filter((function(e){return e.id===t.id}))[0];if(void 0!==i){var r=b.filter((function(e){return e.key===i.id}))[0];r&&r.managers&&r.managers.includes(z.key)||r&&"System Digital Manager"===z.role?X(!0):X(!1),A(r),E(i.childNodes);var c=[];H.filter((function(e){return e.folder===i.id})).forEach((function(e){Object(be.o)(e,Y,z)&&c.push(e)})),C(c),e.push("/files/".concat(i.id))}}}};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:a.container,children:Object(G.jsxs)(Mt.a,{className:a.fullHeightRow,children:[Object(G.jsx)(Ht.a,{className:a.foldersColumn,lg:3,md:3,sm:0,children:Object(G.jsx)(yr,{id:"root",data:Object(Jt.a)(g),name:"Everything",onClick:function(t){var a=b.filter((function(e){return e.key===t.id}))[0];a&&a.managers&&a.managers.includes(z.key)||a&&"System Digital Manager"===z.role?X(!0):X(!1),A(a),E(t.childNodes);var n=[];H.filter((function(e){return e.folder===t.id})).forEach((function(e){Object(be.o)(e,Y,z)&&n.push(e)})),C(n),Z="root"===t.id?[]:[{name:t.name,id:t.id,childNodes:t.childNodes}],Q(t),Z.push({name:"Everything",id:"Root",childNodes:[g]}),Z.reverse(),W(Z),"root"===t.id?e.push("/files"):e.push("/files/".concat(t.id))},isActive:U[U.length-1],breadcrumbIds:U.map((function(e){return e.id}))},"root")}),Object(G.jsxs)(Ht.a,{className:a.filesColumn,lg:9,md:12,sm:12,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(ta.a,{separator:"\u203a","aria-label":"breadcrumb",className:a.text,maxItems:4,itemsBeforeCollapse:0,itemsAfterCollapse:4,children:U.map((function(e){return Object(G.jsx)(it.a,{href:"#",onClick:ee(e),children:e.name},e.id)}))})}),Object(G.jsx)(xe.a,{}),"List"===s&&Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(He.a,{className:a.list,children:[S.sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:J(e),children:[Object(G.jsx)(gt.a,{children:e.hub?Object(G.jsx)(B.a,{userOrHub:e,path:"hubs",variant:"rounded"}):Object(G.jsx)(Ne.a,{})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.name})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})})),k.filter((function(e){return e.type.includes("video")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:$(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(Qe.a,{variant:"rounded",src:"https://vz-db0e7359-d70.b-cdn.net/"+e.key+"/thumbnail.jpg",children:Object(G.jsx)(hn.a,{})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.displayName})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})})),k.filter((function(e){return e.type.includes("audio")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:$(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(Qe.a,{variant:"rounded",src:"https://vz-db0e7359-d70.b-cdn.net/"+e.key+"/thumbnail.jpg",children:Object(G.jsx)(Sn.a,{})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.displayName})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})})),k.filter((function(e){return e.type.includes("image")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:$(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(Qe.a,{variant:"rounded",src:e.url,children:Object(G.jsx)(kn.a,{})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.displayName})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})})),k.filter((function(e){return"application/pdf"===e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:$(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(Qe.a,{variant:"rounded",src:e.thumbnail,children:Object(G.jsx)(gn.a,{})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.displayName})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})})),k.filter((function(e){return!e.type.includes("video")&&!e.type.includes("audio")&&!e.type.includes("image")&&"application/pdf"!==e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:$(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(Qe.a,{variant:"rounded",children:Object(G.jsx)(kn.a,{})})}),Object(G.jsx)(ze.a,{className:a.listText,primary:e.displayName})]},e.key),Object(G.jsx)(xe.a,{variant:"fullWidth",component:"li"})]})}))]})}),"Folder"===s&&Object(G.jsxs)(Mt.a,{className:a.contentRow,children:[S.sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)(_i.a,{folder:e,handleClick:J(e)})},e.key)})),k.filter((function(e){return e.type.includes("video")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)(nr,{file:e,handleClick:$(e)})},e.key)})),k.filter((function(e){return e.type.includes("audio")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)(rr,{file:e,handleClick:$(e)})},e.key)})),k.filter((function(e){return e.type.includes("image")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)(tr,{file:e,handleClick:$(e)})},e.key)})),k.filter((function(e){return"application/pdf"===e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)($i,{file:e,handleClick:$(e)})},e.key)})),k.filter((function(e){return!e.type.includes("video")&&!e.type.includes("audio")&&!e.type.includes("image")&&"application/pdf"!==e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(e){return Object(G.jsx)(i.a.Fragment,{children:Object(G.jsx)(Qi,{file:e,handleClick:$(e)})},e.key)}))]})]})]})}),_&&Object(G.jsx)(jr,{onFileClick:function(){e.push({pathname:"/upload/",folder:R})},onFolderClick:function(e){if(""!==e){var t={};R.managers.forEach((function(e){t[e]=!0}));var a={};R.ancestors.forEach((function(e){a[e]=!0})),a[R.id]=!0,D.b.database().ref("folders").child(Object(be.m)(18)).set({name:e,parent:R.id,managers:t,ancestors:a})}}}),Object(G.jsx)($e,{})]})}var Cr=a(52),wr=a.n(Cr);function Nr(e){return"faves_fggh2973jgbvbiu"===e.folderKey?Object(G.jsx)(wr.a,{style:{fontSize:30,padding:0,marginLeft:5}}):Object(G.jsx)(Ne.a,{style:{fontSize:30,padding:0,marginLeft:5}})}var Sr=Object(O.a)((function(e){return{container:{margin:5},white:{backgroundColor:"rgb(245, 245, 245)",height:60,padding:5,borderRadius:5},green:{backgroundColor:e.palette.primary.main,color:"white",padding:5,height:60,borderRadius:5},grey:{backgroundColor:"rgb(210, 210, 210 )",padding:5,height:60,borderRadius:5},label:{textAlign:"left",cursor:"pointer",marginTop:17,marginLeft:15,fontSize:16,width:"90%",overflowWrap:"break-word",maxWidth:"90%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},folderIcon:{fontSize:30,padding:0,marginLeft:5},arrowIcon:{fontSize:10}}}));function Er(e){var t=Sr(),a=Object(o.e)(),i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useContext)(h.d).currentUserData,d=Object(n.useState)(!1),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(!1),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(""),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),S=w[0],E=w[1],T=Object(n.useState)(!1),F=Object(m.a)(T,2),R=F[0],P=F[1],A=Object(n.useState)(!1),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)(!0),M=Object(m.a)(W,2),H=M[0],Y=M[1];function z(){e.handleClick(e.index)}Object(n.useEffect)((function(){e.folder.hub?E(!0):E(!1),l&&(e.folder.managers.includes(l.key)||"System Digital Manager"===l.role||e.folder.createdBy===l.key?U(!0):U(!1)),!0===e.embedded&&Y(!1),k(e.folder.name)}),[e,l]);var V=function(e){!0===H&&(e.preventDefault(),I&&(s({mouseX:e.clientX-2,mouseY:e.clientY-4}),P(!0)))},q=function(t){"renamefolder"===t.target.id?_():"deletefolder"===t.target.id?X():"editusers"===t.target.id||"edithub"===t.target.id&&a.push("/managehub?key="+e.folder.key),s({mouseX:null,mouseY:null}),P(!1)},_=function(){g(!0)},X=function(){b(!0)},Z=function(t){return function(){(g(!1),H)&&("OK"===t?D.b.database().ref("folders").child(e.folder.key).update({name:v}):k(e.folder.name))}},Q=function(t){return function(){b(!1),H&&"OK"===t&&e.deleteFolder(e.folder)}},J=function(e){k(e.target.value)};return Object(G.jsx)(on.b,{draggableId:e.folder.id,index:e.index,isDragDisabled:"Player"===l.role||"FAW Player"===l.role||"Club Player"===l.role||"Coach Ed Student"===l.role||"FAW Coach Ed Student"===l.role||"Club Coach Ed Student"===l.role||"FAW Parent"===l.role||"Club Parent"===l.role||"Referee"===l.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:V,children:[e.green&&Object(G.jsxs)(Ke.a,{className:t.green,onClick:z,style:R?{border:"2px solid black"}:{},children:[e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Nr,{className:t.folderIcon,folderKey:e.folder.key}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id),e.grey&&Object(G.jsxs)(Ke.a,{className:t.grey,onClick:z,style:R?{border:"2px solid rgb(0, 149, 61)"}:{},children:[e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Nr,{className:t.folderIcon,folderKey:e.folder.key}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id),e.white&&Object(G.jsxs)(Ke.a,{className:t.white,onClick:z,style:R?{border:"2px solid rgb(0, 149, 61)"}:{},children:[e.folder.hub?Object(G.jsx)(B.a,{userOrHub:e.folder,path:"hubs",variant:"rounded"}):Object(G.jsx)(Nr,{className:t.folderIcon,folderKey:e.folder.key}),Object(G.jsx)("p",{className:t.label,children:e.folder.name}),Object(G.jsx)(un.a,{className:t.arrowIcon})]},e.folder.id),Object(G.jsxs)(G.Fragment,{children:[H&&Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:q,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:S?Object(G.jsx)("div",{children:Object(G.jsx)(Xi.a,{id:"edithub",onClick:q,children:"Edit Hub"})}):Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"renamefolder",onClick:q,children:"Rename Folder"}),Object(G.jsx)(Xi.a,{id:"deletefolder",onClick:q,children:"Delete Folder"})]})}),H&&Object(G.jsxs)(dt.a,{open:p,onClose:Z,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename Folder"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the folder."}),Object(G.jsx)(nt.a,{value:v,onChange:J,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:Z("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:Z("OK"),color:"primary",children:"OK"})]})]}),H&&Object(G.jsxs)(dt.a,{open:j,onClose:Q,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete Folder"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this folder?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:Q("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:Q("OK"),color:"primary",children:"OK"})]})]})]})]}))}})}function Tr(e){function t(){e.onClose(!1)}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:t,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:e.message})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:t,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){e.onClose(!0)},color:"primary",children:"Confirm"})]})]})})}var Fr=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2),flex:1},descendantRow:{marginLeft:50},infoText:{marginLeft:15,marginTop:10},text:{padding:e.spacing(2,2,0)},list:{marginBottom:e.spacing(2)},container:{paddingBottom:45},avatar:{width:"50px",height:"50px"},listText:{paddingLeft:e.spacing(1)},noHubsText:{marginTop:15,marginLeft:15}}})),Br=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Dr(e){var t=Fr(),a=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b).folders,c=Object(n.useState)([{name:"Hubs",key:"Root"}]),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(!1),O=Object(m.a)(f,2),y=O[0],v=O[1],k=Object(n.useState)(),N=Object(m.a)(k,2),S=N[0],E=N[1],T=Object(n.useState)(!1),F=Object(m.a)(T,2),R=F[0],P=F[1];Object(n.useEffect)((function(){var e=r.filter((function(e){return e.hub&&"Root"===e.parent}));if(0===(e=e.sort((function(e,t){return e.name>t.name?1:-1}))).length?v(!0):v(!1),a&&"System Digital Manager"===a.role)b(e);else{var t=[];e.forEach((function(e){r.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(n){n.managers.includes(a.key)&&(t.includes(e)||t.push(e))}))})),b(t)}}),[a,r,e.open]);var A=function(e){return function(){l((function(t){return[].concat(Object(Jt.a)(t),[{name:e.name,key:e.key}])}));var t=r.filter((function(t){return t.hub&&t.parent===e.key}));if(0===(t=t.sort((function(e,t){return e.name>t.name?1:-1}))).length?v(!0):v(!1),a&&"System Digital Manager"===a.role)b(t);else{var n=[];t.forEach((function(e){r.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(a.key)&&(n.includes(e)||n.push(e))}))})),b(n)}}},L=function(e){return function(){var t=0;for(t=0;t<o.length;t++){if(o[t].key===e.key)break}var n=Object(Jt.a)(o);n.length=t+1,l(n);var i=r.filter((function(t){return t.hub&&t.parent===e.key}));if(0===(i=i.sort((function(e,t){return e.name>t.name?1:-1}))).length?v(!0):v(!1),a&&"System Digital Manager"===a.role)b(i);else{var c=[];i.forEach((function(e){r.filter((function(t){return t.hub&&(t.ancestors.includes(e.key)||t.key===e.key)})).forEach((function(t){t.managers.includes(a.key)&&(c.includes(e)||c.push(e))}))})),b(c)}}};function I(e){return"System Digital Manager"===a.role||!!e.managers.includes(a.key)}return Object(G.jsxs)(dt.a,{fullScreen:!0,"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,fullWidth:!0,TransitionComponent:Br,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){e.onClose(!1)},"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:"Select Hub"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)("div",{className:t.container,children:[Object(G.jsxs)(pt.a,{square:!0,children:[Object(G.jsx)(ta.a,{separator:"\u203a","aria-label":"breadcrumb",className:t.text,children:o.map((function(e){return Object(G.jsx)(it.a,{href:"#",onClick:L(e),children:e.name},e.key)}))}),y&&Object(G.jsx)("h5",{className:t.noHubsText,children:"There are no hubs at this level yet"}),Object(G.jsx)(He.a,{className:t.list,children:j.map((function(e,a,n){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsxs)(Ke.a,{button:!0,onClick:A(e),children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"hubs",variant:"rounded"})}),Object(G.jsx)(ze.a,{primary:e.name,className:t.listText,secondary:!I(e)&&"You are not a manager of this hub"}),Object(G.jsx)(ea.a,{children:Object(G.jsx)(C.a,{title:"Share with Hub",children:Object(G.jsx)(K.a,{color:"primary",disabled:!I(e),onClick:(r=e,function(){E(r),P(!0)}),children:"Select"})})})]}),a<n.length-1&&Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key);var r}))})]}),S&&Object(G.jsx)(Tr,{open:R,onClose:function(t){if(!0===t){if(S){var n=D.b.database().ref("files"),i=e.file.key;e.file.original&&(i=e.file.original);var r="";a&&(r=a.key),n.push({filename:e.file.filename,displayName:e.file.displayName,folder:S.key,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:r,managers:Object(be.k)(S.managers),ancestors:Object(be.k)(S.ancestors),url:e.file.url,thumbnail:e.file.thumbnail,original:i}),e.onClose(!0)}}else E(null);P(!1)},title:"Confirm Share",message:"Are you sure you want to share the file with "+S.name+"?"})]})]})}var Rr=a(167),Pr=a.n(Rr),Ar=a(385),Lr=a.n(Ar),Ir=a(386),Ur=a(111),Wr=a.n(Ur),Mr=a(576),Hr=a.n(Mr),Kr=a(54),Yr=a.n(Kr),zr=a(572),Vr=a.n(zr),Gr=Object(O.a)((function(e){return{root:{paddingTop:0,paddingBottom:5},avatar:{paddingTop:10},cancelButton:{flexGrow:1,minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:0},commentButton:{minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:5,marginRight:14},popover:{padding:e.spacing(2),cursor:"pointer"},clockIcon:{padding:8}}}));function qr(e){var t=Gr(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(!1),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useContext)(h.d).currentUserData;function j(e,t){for(var a=0,n=0,i="";n<t.length;)e[a]!==t[n]||a===e.length?i+=t[n]:a++,n++;return i}function b(){return!e.isReply&&(""===r||void 0)}return Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(B.a,{className:t.avatar,userOrHub:u,size:e.avatarSize,path:"users"}),Object(G.jsx)(Ht.a,{children:Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:e.isReply?"Add a reply...":"Add a comment...",multiline:!0,value:r,fullWidth:!0,onChange:function(e){var t=j(r,e.target.value),a=j(e.target.value,r);"@"!==t&&"@"!==a&&c(e.target.value)},onSelect:function(){d(!0),e.setIsTyping&&e.setIsTyping(!0)}})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("span",{style:{flex:1}}),l&&e.videoPlayer&&Object(G.jsx)(C.a,{title:"Add Timestamp",children:Object(G.jsx)(w.a,{onClick:function(){if(e.videoPlayer){var t=Math.floor(e.videoPlayer.current.getCurrentTime());if(t<60)c(t<10?r+"@0:0"+t+"@ ":r+"@0:"+t+"@ ");else if(t>3600){var a=Math.floor(t/3600);t%=3600;var n=Math.floor(t/60),i=t%60;c(r+"@"+a+":"+(n<10?"0"+n:n)+":"+(i<10?"0"+i:i)+"@")}else{var s=Math.floor(t/60),o=Math.floor(t%60);c(r+"@"+s+":"+(o<10?"0"+o:o)+"@")}console.log(t)}},className:t.clockIcon,children:Object(G.jsx)(Vr.a,{})})}),Object(G.jsx)(K.a,{className:t.cancelButton,variant:"contained",color:"default",disableElevation:!0,hidden:b(),onClick:function(){c(""),d(!1),e.isReply&&e.hide(),e.setIsTyping&&e.setIsTyping(!1)},children:"Cancel"}),Object(G.jsx)(K.a,{className:t.commentButton,variant:"contained",color:"primary",disableElevation:!0,hidden:b(),onClick:function(){var t=D.b.database().ref("comments");e.isReply?(t.push({text:r,deleted:!1,user:u.key,file:e.file.key,date:P()().toString(),parent:e.parent,author:u.fullName}),e.closeInput()):t.push({text:r,deleted:!1,user:u.key,file:e.file.key,date:P()().toString(),author:u.fullName}),c(""),e.setIsTyping&&e.setIsTyping(!1)},disabled:""===r,children:"Comment"})]})]})})}var _r=a(242),Xr=a.n(_r),Zr=Object(O.a)((function(e){return{root:{paddingTop:10,width:"100%"},nameText:Object(at.a)({},e.typography.bodyBold),dateText:{color:"rgb(140, 140, 140)",paddingLeft:5},textColumn:{paddingLeft:function(e){return"small"===e.avatarSize?25:30}},commentText:{flexWrap:"wrap"},replyPadding:{paddingLeft:35},replyButton:{maxWidth:25,minWidth:25},moreButton:{width:30,height:30}}}));function Qr(e){var t=Zr(e),a=Object(n.useState)(Date.now()),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(!1),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(null),k=Object(m.a)(v,2),C=k[0],S=k[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],R=T[1],A=Object(n.useState)([]),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useContext)(h.d).currentUserData;function M(){O(!1)}Object(n.useEffect)((function(){var t=setInterval((function(){return c(Date.now())}),5e3),a=P()(e.comment.date),n=P()(),i=[{interval:"years",value:n.diff(a,"years")},{interval:"months",value:n.diff(a,"months")},{interval:"weeks",value:n.diff(a,"weeks")},{interval:"days",value:n.diff(a,"days")},{interval:"hours",value:n.diff(a,"hours")},{interval:"minutes",value:n.diff(a,"minutes")}].filter((function(e){return e.value>0}));if(0===i.length)e.comment.dateString="a moment ago",d(e.comment.dateString);else{var r=i[0];1===r.value?(e.comment.dateString=r.value+" "+r.interval.replace("s","")+" ago ",d(e.comment.dateString)):(e.comment.dateString=r.value+" "+r.interval+" ago ",d(e.comment.dateString))}var s=[];return e.comment.text.split("@").forEach((function(e){!function(e){var t=new RegExp(/[a-zA-Z]/g);if(e.includes(":")&&!t.test(e)){var a=e.split(":");if(2===a.length){var n=a[0],i=a[1];if(Object(be.j)(n)&&Object(be.j)(i))return!0}else if(3===a.length){var r=a[0],c=a[1],s=a[2];if(Object(be.j)(r)&&Object(be.j)(c)&&Object(be.j)(s))return!0}return!0}return!1}(e)?s.push({text:e,isLink:!1}):s.push({text:e,isLink:!0})})),U(s),function(){clearInterval(t)}}),[e.comment,r]);var H=function(){S(null),R(!1)};function Y(t){var a=t.split(":");if(2===a.length){var n=Number(a[0]),i=Number(a[1]);if(void 0!==n&&void 0!==i){var r=60*n;r+=i,e.videoPlayer.current.seekTo(r,"seconds")}}else if(3===a.length){var c=Number(a[0]),s=Number(a[1]),o=Number(a[2]);if(void 0!==c&&void 0!==s&&void 0!==o){var l=3600*c;l+=60*s,l+=o,e.videoPlayer.current.seekTo(l,"seconds")}}}return Object(G.jsxs)("div",{className:t.root,children:[Object(G.jsx)(Wt.a,{fluid:!0,onMouseEnter:function(){e.comment.user===W.key&&y(!0)},onMouseLeave:function(){y(!1)},children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(B.a,{userOrHub:e.comment.userObject,size:e.avatarSize,path:"users"}),Object(G.jsxs)(Ht.a,{className:t.textColumn,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("span",{className:t.nameText,children:e.comment.author}),Object(G.jsx)("span",{className:t.dateText,children:l})]}),Object(G.jsx)(Mt.a,{children:I.map((function(e){return Object(G.jsx)(Jr,{isLink:e.isLink,text:e.text,handleSeekClick:Y},Object(be.m)(5))}))}),!e.isReply&&Object(G.jsx)(Mt.a,{children:Object(G.jsx)(K.a,{className:t.replyButton,color:"primary",size:"small",onClick:function(){O(!0)},fullWidth:!0,children:"Reply"})})]}),Object(G.jsx)(w.a,{className:t.moreButton,hidden:!x&&!F&&!u.isMobile,onClick:function(e){R(!0),S(e.target)},children:Object(G.jsx)(Xr.a,{})})]}),f&&Object(G.jsx)(Mt.a,{className:t.replyPadding,children:Object(G.jsx)(qr,{file:e.file,isReply:!0,hide:M,parent:e.comment.key,closeInput:M,avatarSize:"small",videoPlayer:e.videoPlayer,setIsTyping:e.setIsTyping})})]})}),Object(G.jsx)(Wt.a,{fluid:!0,children:Object(G.jsx)(Ht.a,{children:void 0!==e.replies&&e.replies.map((function(a){return Object(G.jsx)(Mt.a,{className:t.replyPadding,children:Object(G.jsx)(Qr,{comment:a,isReply:!0,avatarSize:"small",videoPlayer:e.videoPlayer})},a.key)}))})}),Object(G.jsx)(N.a,{id:"comment-menu",anchorEl:C,open:Boolean(C),onClose:H,children:Object(G.jsx)(Xi.a,{onClick:function(){if(e.replies)for(var t=0;t<e.replies.length;t++){D.b.database().ref("comments/"+e.replies[t].key).update({deleted:!0})}D.b.database().ref("comments/"+e.comment.key).update({deleted:!0}),H()},children:"Delete Comment"})})]})}function Jr(e){return Object(G.jsx)(G.Fragment,{children:e.isLink?Object(G.jsx)(it.a,{onClick:function(t){t.preventDefault(),e.handleSeekClick(e.text)},style:{cursor:"pointer",whiteSpace:"pre-wrap"},children:e.text}):Object(G.jsx)("span",{style:{whiteSpace:"pre-wrap"},children:e.text})})}var $r=Object(O.a)((function(e){return{root:{paddingBottom:15},commentCountText:Object(Ze.a)({paddingTop:15,paddingLeft:15,paddingBottom:5},e.breakpoints.down("sm"),{paddingLeft:15})}}));function ec(e){var t=$r(),a=Object(n.useContext)(h.b),i=a.comments,r=a.users,c=Object(n.useState)([]),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)(!1),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useContext)(h.d).currentUserData;return Object(n.useEffect)((function(){for(var t=[],a=function(a){var n=i[a];if(n.file===e.file.key&&!n.deleted){if(void 0===n.userObject){var c=r.filter((function(e){return e.key===n.user}))[0];void 0!==c&&(n.userObject=c)}n.dateString="",t.push(n)}},n=0;n<i.length;n++)a(n);t.sort((function(e,t){return P()(e.date)<P()(t.date)?1:P()(t.date)<P()(e.date)?-1:0})),l(t),f&&f.permissions&&(f.permissions.comment?b(!0):b(!1))}),[i,r,e,f]),Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.root,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h6",{className:t.commentCountText,children:1===o.length?o.length+" Comment":o.length+" Comments"})}),Object(G.jsx)(Mt.a,{children:j&&Object(G.jsx)(qr,{file:e.file,isReply:!1,avatarSize:"medium",videoPlayer:e.videoPlayer,setIsTyping:e.setIsTyping})}),o.filter((function(e){return void 0===e.parent})).map((function(t){return Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Qr,{file:e.file,comment:t,avatarSize:"medium",videoPlayer:e.videoPlayer,isReply:!1,setIsTyping:e.setIsTyping,replies:o.filter((function(e){return e.parent===t.key})).reverse()})},t.key)}))]})})}var tc=a(1095),ac=a(1074),nc=a(1075),ic=a(311),rc=a.n(ic),cc=a(1076),sc=a(199),oc=a.n(sc),lc=a(198),dc=a.n(lc),uc=a(574),jc=a.n(uc),bc=a(573),fc=a.n(bc),hc=Object(O.a)((function(e){return{root:{width:"100%"},accordionSummary:{fontSize:e.typography.pxToRem(20)},pageContainer:{paddingTop:15}}})),mc=0,Oc=function(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,{variant:"determinate",value:mc}),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(mc),"%")})})]})};function pc(e){var t=hc(),a=Object(d.b)(),i=a.enqueueSnackbar,r=a.closeSnackbar,c=Object(n.useState)(0),s=Object(m.a)(c,2),l=s[0],u=s[1],j=Object(n.useState)(1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(o.e)(),g=Object(n.useContext)(h.d).currentUserData,x=Object(n.useState)([]),y=Object(m.a)(x,2),v=y[0],k=y[1],N=Object(n.useContext)(h.b),S=N.comments,E=N.notifications,T=N.events,F=N.users,B=N.groups,R=Object(n.useState)(!1),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(),U=Object(m.a)(I,2),W=U[0],M=U[1];function H(e){var t=e.numPages;u(t)}function Y(){O(f+1)}function z(){O(f-1)}Object(n.useEffect)((function(){!function(){var t=[];e.files.forEach((function(e){Object(be.o)(e,B,g)&&t.push(e)})),k(t)}()}),[e,g,B]);var V=function(e){return function(){e.type.includes("video")?function(e){var t="https://vz-db0e7359-d70.b-cdn.net/"+e.key+"/original";i("Downloading: "+e.filename,{variant:"default",action:Oc,persist:!0,key:e.key}),Wn()({url:t,method:"GET",responseType:"blob",onDownloadProgress:function(t){var a=Math.floor(t.loaded/t.total*100);mc=a,i("Downloading: "+e.filename,{variant:"default",action:Oc,persist:!0,key:e.key,preventDuplicate:!0})}}).then((function(t){In()(t.data,e.filename),mc=0,r(e.key)}))}(e):function(e){i("Downloading: "+e.filename,{variant:"default",action:Oc,persist:!0,key:e.key}),Wn()({url:e.url,method:"GET",responseType:"blob",onDownloadProgress:function(t){var a=Math.floor(t.loaded/t.total*100);mc=a,i("Downloading: "+e.filename,{variant:"default",action:Oc,persist:!0,key:e.key,preventDuplicate:!0})}}).then((function(t){In()(t.data,e.filename),mc=0,r(e.key)}))}(e)}};var q=function(e){return function(){e.type.includes("video")?p.push({pathname:"/video/".concat(e.key),file:e}):e.type.includes("image")?p.push({pathname:"/image/".concat(e.key),file:e}):"application/pdf"===e.type?p.push({pathname:"/pdf/".concat(e.key),file:e}):"link"===e.type?p.push({pathname:"/link/".concat(e.key),file:e}):p.push({pathname:"/file/".concat(e.key),file:e})}};function _(){L(!1)}function X(){S.forEach((function(e){e.file===W.key&&D.b.database().ref("comments").child(e.key).remove()})),E.forEach((function(e){e.file===W.key&&D.b.database().ref("notifications").child(e.key).remove()})),T.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===W.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),F.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===W.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),D.b.database().ref("files").child(W.key).remove(),k(v.filter((function(e){return e.key!==W.key}))),M(),L(!1)}return Object(G.jsxs)(Wt.a,{fluid:!0,className:t.pageContainer,children:[v.map((function(a,n){return Object(G.jsxs)(tc.a,{TransitionProps:{unmountOnExit:!0},children:[Object(G.jsx)(ac.a,{expandIcon:Object(G.jsx)(rc.a,{}),children:Object(G.jsx)("h1",{className:t.accordionSummary,children:a.displayName})}),Object(G.jsx)(nc.a,{children:Object(G.jsx)(Ht.a,{sm:12,md:6,children:Object(G.jsxs)(G.Fragment,{children:[a&&a.type.includes("video")&&Object(G.jsx)(Pr.a,{className:t.videoPlayer,url:"https://vz-db0e7359-d70.b-cdn.net/"+a.key+"/playlist.m3u8",autoPlay:!1,controls:!0,width:"100%",height:"auto"}),a&&a.type.includes("image")&&Object(G.jsx)("img",{src:a.url,alt:"animage"}),a&&"application/pdf"===a.type&&Object(G.jsxs)(ai.a,{file:a.url,onLoadSuccess:H,className:t.document,children:[Object(G.jsx)(cc.a,{steps:l,position:"static",variant:"text",activeStep:f-1,nextButton:Object(G.jsxs)(K.a,{size:"small",onClick:Y,disabled:f===l,children:["Next",Object(G.jsx)(dc.a,{})]}),backButton:Object(G.jsxs)(K.a,{size:"small",onClick:z,disabled:1===f,children:[Object(G.jsx)(oc.a,{}),"Prev"]})}),Object(G.jsx)(ai.b,{pageNumber:f,className:t.page})]}),e.fromFile&&e.fromFile.key===a.key?Object(G.jsx)(G.Fragment,{}):Object(G.jsx)(C.a,{title:"Go to File",children:Object(G.jsx)(w.a,{onClick:q(a),children:Object(G.jsx)(fc.a,{})})}),Object(G.jsx)(C.a,{title:"Download File",children:Object(G.jsx)(w.a,{disabled:!a.allowDownloads,onClick:V(a),children:Object(G.jsx)(jc.a,{})})})]})})})]},a.key)})),A&&Object(G.jsxs)(dt.a,{open:A,onClose:_,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:_,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){W&&(W.type.includes("video")?(new Promise((function(e,t){D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(a){var n=a.data.key,i="https://video.bunnycdn.com/library/"+be.b+"/videos/"+W.key;fetch(i,{method:"DELETE",headers:{AccessKey:n}}).then((function(e){return e.json()})).then((function(t){console.log(t),e()})).catch((function(e){console.error(e),t()}))})).catch((function(e){console.log(e.code),console.log(e.message),console.log(e.details),t()}))})),X()):(D.b.storage().ref("files").child(W.key).child(W.filename).delete(),D.b.database().ref("files").child(W.key).remove(),X()))},color:"primary",children:"Delete"})]})]})]})}var gc=a(575),xc=a.n(gc),yc=a(135),vc=Object(O.a)((function(e){return{titleText:{marginLeft:e.spacing(2)},dateText:Object(at.a)(Object(at.a)({marginLeft:e.spacing(2)},e.typography.body1),{},{flexGrow:1})}})),kc=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Cc(e){var t=vc(),a=Object(n.useContext)(h.b),i=a.files,r=a.folders,c=a.calendars,s=e.event,o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useContext)(h.d).currentUserData,b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],y=f[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),N=k[0],S=k[1];Object(n.useEffect)((function(){if(s){s.files.forEach((function(e){var t=i.filter((function(t){return t.key===e.key}))[0];t&&Object.assign(e,t)}));var e=c.filter((function(e){return e.key===s.calendar}))[0];if(e)if(e.user===j.key)y(!0);else{var t=r.filter((function(t){return t.key===e.hub}))[0];t&&t.managers.includes(j.key)&&y(!0)}}}),[s,j]);var E=function(){e.onClose()};var T=function(e){return function(){if(u(!1),"OK"===e){var t=[];i.forEach((function(e){var a=!1,n=[];if(e.events.forEach((function(i){i.key===s.key?(t.push(e),a=!0):n.push(i.key)})),a){var i=yc.a.database().ref("files").child(e.key),r={};n.forEach((function(e){r[e]=!0})),i.update({events:r})}}));var a=c.filter((function(e){return e.key===s.calendar}))[0];if(a){var n=[];a.events.forEach((function(e){e.key!==s.key&&n.push(e.key)}));var r=yc.a.database().ref("calendars").child(a.key),o={};n.forEach((function(e){o[e]=!0})),r.update({events:o})}yc.a.database().ref("events").child(s.key).remove(),E()}}};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(dt.a,{fullScreen:!0,onClose:E,"aria-labelledby":"simple-dialog-title",open:e.open,TransitionComponent:kc,children:s&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:E,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:s.name}),Object(G.jsx)(x.a,{variant:"h6",className:t.dateText,children:P()(s.date).format("dddd, MMMM D, YYYY").toString()}),O&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(C.a,{title:"Edit Event",children:Object(G.jsx)(w.a,{edge:"right",color:"inherit",onClick:function(){S(!0)},"aria-label":"close",children:Object(G.jsx)(xc.a,{})})}),Object(G.jsx)(C.a,{title:"Delete Event",children:Object(G.jsx)(w.a,{edge:"right",color:"inherit",onClick:function(){u(!0)},"aria-label":"close",children:Object(G.jsx)(Ut.a,{})})})]})]})}),Object(G.jsx)(g.a,{}),Object(G.jsx)(pc,{files:s.files,fromFile:e.fromFile})]})}),Object(G.jsxs)(dt.a,{open:d,onClose:T,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete Event"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this event?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:T("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:T("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsx)(Na,{open:N,onClose:function(e,t){if(""!==e&&t){var a=yc.a.database().ref("events").child(s.key);s.name=e,a.update({name:e})}S(!1)},title:"Edit Event",message:"Enter a new name for the event.",initialValue:s&&s.name})]})}var wc=Object(O.a)((function(e){return{event:Object(at.a)(Object(at.a)({},e.typography.bodyBold),{},{display:"block",textAlign:"center",margin:5,padding:5,width:250,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}),noEventsText:{margin:10,color:"rgb(100, 100, 100)"}}}));function Nc(e){var t=wc(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.b),o=s.events,l=s.calendars,d=s.folders,u=Object(n.useState)(!1),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(),p=Object(m.a)(O,2),g=p[0],x=p[1],y=Object(n.useContext)(h.d).currentUserData;Object(n.useEffect)((function(){if(e.file){var t=[];o.forEach((function(a){if(a.files&&a.files.filter((function(t){return t.key===e.file.key})).length>0){var n=l.filter((function(e){return e.key===a.calendar}))[0];if(n)if(console.log("HERE:"),console.log(n),n.user===y.key)t.push(a);else{var i=d.filter((function(e){return e.key===n.hub}))[0];i&&(i.managers.includes(y.key)||i.users.includes(y.key))&&t.push(a)}}})),c(t)}}),[o,l,d,e,y]);var v=function(e){return function(){x(e),f(!0)}};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[0===r.length&&Object(G.jsx)("span",{className:t.noEventsText,children:"The file is not linked to any events"}),r.map((function(e){return Object(G.jsx)(V.a,{color:"primary",className:t.event,label:e.name,onClick:v(e),style:{backgroundColor:e.color}},e.key)}))]}),Object(G.jsx)(Cc,{open:b,onClose:function(){f(!1)},event:g,fromFile:e.file})]})}var Sc=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},title:{marginTop:15},icons:{marginTop:15},saveButton:{marginLeft:20,marginRight:20,marginBottom:20}}}));function Ec(e){var t=Sc(),a=Object(n.useContext)(h.b),i=a.users,r=a.calendars,c=a.notifications,s=a.groups,o=a.folders,l=Object(n.useContext)(h.d).currentUserData,d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(""),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(!0),y=Object(m.a)(x,2),v=y[0],N=y[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(!0),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(""),Y=Object(m.a)(H,2),V=Y[0],q=Y[1],_=Object(n.useState)(P()()),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)([]),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)([]),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1],ce=Object(n.useState)([]),se=Object(m.a)(ce,2),oe=se[0],le=se[1],de=Object(n.useState)([]),ue=Object(m.a)(de,2),je=ue[0],fe=ue[1],he=Object(n.useState)(!1),me=Object(m.a)(he,2),Oe=me[0],pe=me[1],ge=Object(n.useState)(!1),xe=Object(m.a)(ge,2),ye=xe[0],ve=xe[1],ke=Object(n.useState)(!1),Ce=Object(m.a)(ke,2),we=Ce[0],Ne=Ce[1],Se=Object(n.useState)([]),Ee=Object(m.a)(Se,2),Te=Ee[0],Fe=Ee[1];Object(n.useEffect)((function(){if(e.file&&e.folder){""===p&&g(e.file.displayName),N(e.file.allowComments),L(e.file.allowDownloads),F(e.file.allowSharing),b(e.file.events);var t=[],a=[];i.forEach((function(n){e.file.managers.includes(n.key)?a.push(n):Object(be.p)(e.file,s,n)&&t.push(n)})),le(a);var n=Object(be.i)(e.file,e.folder,o,l),c=[];n.forEach((function(t){var a=s.filter((function(e){return e.hub===t.key}));a.forEach((function(t){e.file.groups.filter((function(e){return e===t.key})).length>0?(t.didSelect=!0,c.push(t)):t.didSelect=!1})),t.groups=a})),re(c),Fe(n),te(t);var d=[];r.forEach((function(t){var a=!1;(t.user===l.key||t.hub===e.folder.key||e.folder.ancestors.includes(t.hub))&&(a=!0),a&&d.push(t)})),fe(d)}}),[l,r,e.file]);function Be(t){var a=D.b.database().ref("files").child(e.file.key);"downloads"===t.target.name?(L(t.target.checked),a.update({allowDownloads:t.target.checked})):"comments"===t.target.name?(N(t.target.checked),a.update({allowComments:t.target.checked})):"sharing"===t.target.name&&(F(t.target.checked),a.update({allowSharing:t.target.checked}))}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:"Edit File"}),Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",value:p,onChange:function(e){g(e.target.value)},placeholder:"Display Name",label:"Display Name",fullWidth:!0,multiline:!0}),Object(G.jsx)(C.a,{title:"Events",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){pe(!0)},children:Object(G.jsx)(k.a,{badgeContent:j.length,color:"primary",children:Object(G.jsx)(di.a,{})})})}),Object(G.jsx)(C.a,{title:"Notifications",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){Ne(!0)},children:Object(G.jsx)(k.a,{badgeContent:W?Object(G.jsx)(mi.a,{}):Object(G.jsx)(z.a,{}),color:"primary",children:Object(G.jsx)(ji.a,{})})})}),Object(G.jsx)(C.a,{title:"Users",children:Object(G.jsx)(w.a,{className:t.icons,onClick:function(){ve(!0)},children:Object(G.jsx)(k.a,{badgeContent:ee.length+oe.length,color:"primary",children:Object(G.jsx)(De.a,{})})})}),!e.file.type.includes("link")&&Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:A,onChange:Be,name:"downloads",color:"primary"}),label:"Allow Downloads"})}),Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:v,onChange:Be,name:"comments",color:"primary"}),label:"Allow Comments"})}),Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:T,onChange:Be,name:"sharing",color:"primary"}),label:"Allow Sharing"})}),Object(G.jsx)(K.a,{className:t.saveButton,variant:"contained",color:"primary",onClick:function(){if(e.file.managers.includes(l.key)||"System Digital Manager"===l.role||e.file.uploadedBy===l.key){var t=D.b.database().ref("files").child(e.file.key),a={},n=[];if(oe.forEach((function(e){a[e.key]=!0,n.push(e.key)})),e.file.displayName=p,t.update({displayName:p}),c.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).update({title:e.file.displayName})})),W){console.log("Send Notifications");var i=D.b.database().ref("notifications"),r="file";e.file.type.includes("video")?r="video":"application/pdf"===e.file.type?r="pdf":e.file.type.includes("audio")?r="audio":e.file.type.includes("image")?r="image":"link"===e.file.type&&(r="link");var s={file:e.file.key,title:e.file.displayName,type:r,users:Object(be.k)(ee),managers:a,message:V,date:P()().toString(),fromDate:Z.toString()};void 0!==e.file.url&&(s.url=e.file.url),void 0!==e.file.thumbnail&&(s.thumbnail=e.file.thumbnail);var o=Te.reverse()[0];void 0!==o&&(s.hubName=o.name),i.push(s)}e.onClose()}},children:"Done"})]})}),Object(G.jsx)(Ei,{open:Oe,onClose:function(e){b(e),pe(!1)},selectionChanged:function(e){b(e)},selectedEvents:j,file:e.file,calendars:je}),Object(G.jsx)(Di,{open:ye,onClose:function(e,t){re(t),te(e),ve(!1)},selectedUsers:ee,managers:oe,ancestorHubs:Te,selectedGroups:ie,file:e.file}),Object(G.jsx)(Ai,{open:we,onClose:function(e){M(e.sendNotifications),q(e.message),Q(e.fromDate),Ne(!1)},message:V,send:W})]})}var Tc=Object(O.a)((function(e){return{root:{textAlign:"center",alignItems:"center",paddingLeft:10},toolbarTitle:{},title:{marginTop:15},downloadButton:{position:"absolute",left:"auto",right:10,top:75},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-255,width:window.innerWidth,overflow:"scroll"},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"}}}));function Fc(e){var t=Tc(),a=Object(n.useContext)(h.b),i=a.fileUsage,r=a.getFileUsage,c=a.users,s=a.groups,o=a.comments,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],y=f[1];Object(n.useEffect)((function(){if(e.file){var t=[];console.log("Compiling Usage Data:"),0===i.length&&r();var a=0,n=0,l=0,d=0,u=0,b=0;c.forEach((function(r){if(e.file.managers.includes(r.key)||Object(be.p)(e.file,s,r)){var c=0,j=0,f=0,h=0,m=0;i.filter((function(t){return e.file.key===t.file&&r.key===t.user})).forEach((function(e){if("Open"===e.action)c+=1;else if("Download"===e.action)j+=1;else if("TimelineCreate"===e.action)f+=1;else if("PlaylistCreate"===e.action)h+=1;else if("PlaylistShare"===e.action){var t=[];e.usersSharedWith.forEach((function(e){t.push(e)})),e.groupsSharedWith.forEach((function(e){var a=s.filter((function(t){return t.key===e.key}))[0];a&&a.users.forEach((function(e){t.push(e.key)}))})),m+=t.length}}));var O;O=o.filter((function(t){return e.file.key===t.file&&r.key===t.user})).length,t.push({name:r.fullName,viewCount:c,commentCount:O,downloadCount:j,timelineCount:f,playlistCount:h,playlistShareCount:m}),a+=c,l+=O,n+=j,d+=f,u+=h,b+=m}})),(t=t.sort((function(e,t){return e.viewCount<t.viewCount?1:-1}))).push({name:"Total",viewCount:a,commentCount:l,downloadCount:n,timelineCount:d,playlistCount:u,playlistShareCount:b}),j(t),e.isVideo&&y(!0)}}),[e,i]);var v=function(){e.onClose()};return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:v,"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:v,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.toolbarTitle,children:"File Usage Data"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)("h4",{className:t.title,children:e.file.displayName}),Object(G.jsx)("div",{children:Object(G.jsx)(K.a,{onClick:function(){var e="Shared With, Page View Count, Comment Count, Download Count, Timeline Count, Playlist Count, Playlist Share Count\n";u.forEach((function(t){e+=t.name.replace(",","")+", ",e+=t.viewCount+", ",e+=t.commentCount+", ",e+=t.downloadCount+", ",e+=t.timelineCount+", ",e+=t.playlistCount+", ",e+=t.playlistShareCount+"\n"})),Object(be.f)(e,"export.csv","text/csv;charset=utf-8;")},className:t.downloadButton,children:"Download Data"})}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.tableContainer,children:Object(G.jsxs)(Ma.a,{"aria-label":"simple table",children:[Object(G.jsx)(za.a,{className:t.tableHead,children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Shared With"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Page View Count"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Comment Count"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Download Count"}),O&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Timeline Count"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlist Count"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlist Share Count"})]})]})}),Object(G.jsx)(Ha.a,{children:u.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.viewCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.commentCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.downloadCount}),O&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.timelineCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistCount}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.playlistShareCount})]})]},e.key)}))})]})})]})]})})}var Bc=Object(O.a)((function(e){return{root:{textAlign:"center"},title:{marginTop:15},addButton:{flexGrow:1,margin:10,cursor:"pointer"},cancelButton:{position:"absolute",top:5,left:5,bottom:"auto",right:"auto",padding:2},chip:{marginLeft:"2%",width:"96%",marginBottom:5,minWidth:250}}}));function Dc(e){var t=Bc(),a=Object(o.e)(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b),c=r.timelineInfo,s=r.groups,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1];Object(n.useEffect)((function(){if(i&&e.file){var t=[];c.forEach((function(a){Object(be.r)(a,s,i)&&a.video===e.file.key&&(t.push(a),a.owner===i.key&&(a.isOwner=!0))})),j(t)}}),[e,i,c]);return Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,className:t.root,children:[Object(G.jsx)(Wt.a,{fluid:!0,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h4",{className:t.title,children:"Timelines"}),0===u.length?Object(G.jsx)("span",{children:"You haven't created any timelines for this video"}):Object(G.jsx)(He.a,{children:u.map((function(n){return Object(G.jsx)(Mt.a,{children:Object(G.jsx)(V.a,{className:t.chip,label:n.name,onClick:(i=n,function(){e.file&&e.file.key&&a.push("/analysis?video="+e.file.key+"&key="+i.key)}),style:n.isOwner?{backgroundColor:"rgb(0, 149, 61)",color:"white"}:{backgroundColor:"rgb(220, 220, 220)"}})},n.key);var i}))}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(C.a,{title:"New Timeline",children:Object(G.jsx)(vt.a,{className:t.addButton,onClick:function(){p(!0)}})})})]})}),Object(G.jsx)(Na,{open:O,onClose:function(t,a){if(""!==t&&a){D.b.database().ref("fileusage").push({file:e.file.key,fileName:e.file.displayName,fileType:e.file.type,user:i.key,action:"TimelineCreate",date:P()().toString()});var n=D.b.database().ref("timelines"),r=Object(be.m)(19);n.child(r).set({name:t,owner:i.key,video:e.file.key,created:P()().toString()}),D.b.database().ref("timelineinfo").child(r).set({name:t,owner:i.key,video:e.file.key,created:P()().toString()})}p(!1)},title:"New Timeline",message:"Enter a name for the new timeline."})]})}var Rc=Object(O.a)((function(e){return{root:{textAlign:"center"},title:{marginTop:15},cancelButton:{position:"absolute",top:5,left:5,bottom:"auto",right:"auto",padding:2},chip:{marginLeft:"2%",width:"96%",marginBottom:5,minWidth:250}}}));function Pc(e){var t=Rc(),a=Object(o.e)(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b),c=r.playlistInfo,s=r.groups,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1];Object(n.useEffect)((function(){if(i&&e.file){var t=[];c.forEach((function(a){Object(be.q)(a,s,i)&&a.video===e.file.key&&(t.push(a),a.owner===i.key&&(a.isOwner=!0))})),j(t)}}),[e,c,i]);return Object(G.jsx)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,className:t.root,children:Object(G.jsx)(Wt.a,{fluid:!0,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h4",{className:t.title,children:"Playlists"}),0===u.length?Object(G.jsx)("span",{children:"You haven't created any playlists for this video"}):Object(G.jsx)(He.a,{children:u.map((function(n){return Object(G.jsx)(Mt.a,{children:Object(G.jsx)(V.a,{className:t.chip,label:n.name,onClick:(i=n,function(){e.file&&e.file.key&&a.push("/playlist?key="+i.key)}),style:n.isOwner?{backgroundColor:"rgb(0, 149, 61)",color:"white"}:{backgroundColor:"rgb(220, 220, 220)"}})},n.key);var i}))})]})})})}var Ac=Object(O.a)((function(e){var t,a,n,i,r;return{videoPlayer:Object(Ze.a)({marginTop:15},e.breakpoints.down("sm"),{marginTop:0}),columnPadding:(t={},Object(Ze.a)(t,e.breakpoints.down("sm"),{paddingLeft:0}),Object(Ze.a)(t,"paddingRight",0),t),pageContainer:{paddingBottom:65},videoContainer:{position:"relative",paddingTop:"56.25%",marginTop:10},commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:Object(Ze.a)({width:55,height:55},e.breakpoints.down("sm"),{marginRight:15}),menuButtonColored:(a={width:55,height:55},Object(Ze.a)(a,e.breakpoints.down("sm"),{marginRight:15}),Object(Ze.a)(a,"color","rgb(0, 149, 61)"),a),displayName:(n={flexGrow:1,paddingTop:10,fontSize:24},Object(Ze.a)(n,e.breakpoints.down("sm"),{paddingLeft:15,fontSize:19}),Object(Ze.a)(n,"overflowWrap","break-word"),Object(Ze.a)(n,"maxWidth","100%"),Object(Ze.a)(n,"display","-webkit-box"),Object(Ze.a)(n,"WebkitLineClamp",2),Object(Ze.a)(n,"textOverflow","ellipsis"),n),dateText:(i={},Object(Ze.a)(i,e.breakpoints.down("sm"),{paddingLeft:15}),Object(Ze.a)(i,"color","rgb(140, 140, 140)"),i),commentSection:(r={},Object(Ze.a)(r,e.breakpoints.down("sm"),{paddingLeft:15}),Object(Ze.a)(r,"marginRight",0),r),titleRow:{marginRight:0},uploadedByText:{color:"grey"}}})),Lc=0;function Ic(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Uc(e){var t=Ac(),a=Object(o.e)(),r=Object(o.f)(),c=Object(d.b)(),s=c.enqueueSnackbar,l=c.closeSnackbar,u=Object(n.useContext)(h.b),j=u.files,b=u.folders,O=u.comments,p=u.notifications,g=u.events,y=u.users,v=u.groups,k=u.timelineInfo,S=u.playlistInfo,E=Object(n.useState)(),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(),A=Object(m.a)(R,2),L=A[0],I=A[1],U=Object(n.useState)(""),W=Object(m.a)(U,2),M=(W[0],W[1]),H=i.a.useRef(),Y=Object(n.useContext)(h.d).currentUserData,z=Object(n.useState)(null),V=Object(m.a)(z,2),q=V[0],_=V[1],X=Object(n.useState)(),Z=Object(m.a)(X,2),Q=Z[0],J=Z[1],$=Object(n.useState)(!1),ee=Object(m.a)($,2),te=ee[0],ae=ee[1],re=Object(n.useState)(!1),ce=Object(m.a)(re,2),se=ce[0],oe=ce[1],le=Object(n.useState)(!1),de=Object(m.a)(le,2),ue=de[0],je=de[1],fe=Object(n.useState)(!1),he=Object(m.a)(fe,2),me=he[0],Oe=he[1],pe=Object(n.useState)(!1),ge=Object(m.a)(pe,2),ye=ge[0],ve=ge[1],ke=Object(n.useState)(!1),Ce=Object(m.a)(ke,2),we=Ce[0],Ne=Ce[1],Se=Object(n.useState)(!1),Ee=Object(m.a)(Se,2),Te=Ee[0],Fe=Ee[1],Be=Object(n.useState)(!1),De=Object(m.a)(Be,2),Re=De[0],Pe=De[1],Ae=Object(n.useState)(!1),Ie=Object(m.a)(Ae,2),Ue=Ie[0],We=Ie[1],Me=Object(n.useState)(!1),He=Object(m.a)(Me,2),Ke=He[0],Ye=He[1],ze=Object(n.useState)(!1),Ve=Object(m.a)(ze,2),Ge=Ve[0],qe=Ve[1],_e=Object(n.useState)("error"),Xe=Object(m.a)(_e,2),Ze=Xe[0],Qe=Xe[1],Je=Object(n.useState)(""),et=Object(m.a)(Je,2),tt=et[0],at=et[1],nt=Object(n.useState)(""),it=Object(m.a)(nt,2),rt=it[0],ct=it[1],ot=Object(n.useState)(!1),lt=Object(m.a)(ot,2),jt=lt[0],bt=lt[1],ft=Object(n.useState)(!1),ht=Object(m.a)(ft,2),mt=ht[0],Ot=ht[1],pt=0,gt=function(e){return Object(G.jsx)(Mn.a,{position:"relative",display:"inline-flex",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(pt/1048576)," MB")})})};Object(n.useEffect)((function(){var t=D.b.auth().onAuthStateChanged((function(e){e||a.replace("/signin?url="+r.pathname)}));Lc=0;var n="";if(n=e.fileKey?e.fileKey:r.pathname.replace("/video/",""),M(n),Y){!0===Y.permissions.createOwnPlaylist?oe(!0):oe(!1),!0===Y.permissions.analysis?ae(!0):ae(!1);var i=j.filter((function(e){return e.key===n}))[0];if(i){I(i);var c=b.filter((function(e){return e.key===i.folder}))[0];if(c&&B(c),Object(be.o)(i,v,Y)?J(!0):J(!1),Y.faveFiles&&Y.faveFiles.includes(i.key)?Ot(!0):Ot(!1),je(i.managers.includes(Y.key)||"System Digital Manager"===Y.role||i.uploadedBy===Y.key),i.uploadedBy){var s=y.filter((function(e){return e.key===i.uploadedBy}))[0];s&&ct(s.firstName+" "+s.lastName)}if(!jt)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:i.key,fileName:i.displayName,fileType:i.type,user:Y.key,action:"Open",date:P()().toString()}),bt(!0)}}return function(){return t()}}),[j,L,r.pathname,a,Y]),Object(n.useLayoutEffect)((function(){return function(){}}),[]),window.onbeforeunload=function(){};var xt=function(){_(null)};function yt(){Oe(!1)}function vt(){return(vt=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ue){e.next=8;break}if(Ye(!0),!Object(be.e)(L,j)){e.next=6;break}kt(),e.next=8;break;case 6:return e.next=8,Ct().then((function(){kt()}));case 8:Oe(!1);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kt(){O.forEach((function(e){e.file===L.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),p.forEach((function(e){e.file===L.key&&D.b.database().ref("notifications").child(e.key).remove()})),g.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===L.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),S.forEach((function(e){e.video===L.key&&(D.b.database().ref("playlists").child(e.key).remove(),D.b.database().ref("playlistinfo").child(e.key).remove())})),k.forEach((function(e){e.video===L.key&&(D.b.database().ref("timelines").child(e.key).remove(),D.b.database().ref("timelineinfo").child(e.key).remove())})),y.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===L.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),D.b.database().ref("files").child(L.key).remove(),Ye(!1),void 0===e.fileKey?a.goBack():e.onClose()}function Ct(){return new Promise((function(e,t){D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(a){var n=a.data.key,i=L.key;L.original&&(i=L.original);var r="https://video.bunnycdn.com/library/"+be.b+"/videos/"+i;fetch(r,{method:"DELETE",headers:{AccessKey:n}}).then((function(e){return e.json()})).then((function(t){console.log(t),e()})).catch((function(e){console.error(e),t()}))})).catch((function(e){console.log(e.code),console.log(e.message),console.log(e.details),t()}))}))}function wt(){return(wt=Object(ie.a)(ne.a.mark((function e(){var t,a,n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:L&&(t=L.key,L.original&&(t=L.original),a="https://vz-db0e7359-d70.b-cdn.net/"+t+"/original",n=Lr.a.createWriteStream(L.filename,{}),xt(),s("Downloading: "+L.filename,{variant:"default",action:gt,persist:!0,key:L.key,preventDuplicate:!0}),pt=0,fetch(a,{method:"GET",headers:{accept:"*/*"}}).then((function(e){console.log(e);var t=e.body;window.WritableStream||(console.log("Set writable stream"),Lr.a.WritableStream=Ir.a,window.WritableStream=Ir.a),window.writer=n.getWriter();var a=t.getReader();!function e(){return a.read().then((function(t){t.done?(console.log("CLOSE"),l(L.key),window.writer.close()):(pt+=t.value.length,s("Downloading: "+L.filename,{variant:"default",action:gt,persist:!0,key:L.key,preventDuplicate:!0}),window.writer.write(t.value).then(e))}))}()})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var St=function(e,t){"clickaway"!==t&&qe(!1)};function Et(){return(Et=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Pe(!0);case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tt(){return(Tt=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:We(!0);case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ft=function(e){return t.menuButton};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(f.a,{children:Object(G.jsx)("meta",{name:"description",content:L?L.displayName:"Nodiant Video Link"})}),Q&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.pageContainer,children:[Object(G.jsx)(Mt.a,{}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{className:t.columnPadding,lg:7,md:12,sm:12,children:L&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pr.a,{className:t.videoPlayer,ref:H,url:L.original?"https://vz-db0e7359-d70.b-cdn.net/"+L.original+"/playlist.m3u8":"https://vz-db0e7359-d70.b-cdn.net/"+L.key+"/playlist.m3u8",autoPlay:!1,controls:!0,onProgress:function(e){var t=e.playedSeconds;Math.abs(Lc-t),Lc=t},width:"100%",height:"auto"}),Object(G.jsxs)(Mt.a,{className:t.titleRow,children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(x.a,{className:t.displayName,children:L.displayName}),""!==rt&&Object(G.jsxs)("span",{className:t.uploadedByText,children:["Uploaded By:",rt]})]}),Object(G.jsx)(C.a,{title:"Events",children:Object(G.jsx)(w.a,{onClick:function(){ve(!0)},className:t.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})})}),te&&Object(G.jsx)(C.a,{title:"Analysis",children:Object(G.jsx)(w.a,{onClick:function(){return Et.apply(this,arguments)},className:Ft(),"aria-label":"analysis",children:Object(G.jsx)(Hr.a,{})})}),se&&Object(G.jsx)(C.a,{title:"Playlists",children:Object(G.jsx)(w.a,{onClick:function(){return Tt.apply(this,arguments)},className:Ft(),"aria-label":"playlists",children:Object(G.jsx)(Le.a,{})})}),mt?Object(G.jsx)(C.a,{title:"Remove From Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};Y.faveFiles.forEach((function(t){t!==L.key&&(e[t]=!0)})),D.b.database().ref("users").child(Y.key).update({faveFiles:e})},className:t.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(wr.a,{})})}):Object(G.jsx)(C.a,{title:"Add to Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};Y.faveFiles.forEach((function(t){e[t]=!0})),e[L.key]=!0,D.b.database().ref("users").child(Y.key).update({faveFiles:e})},className:t.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Yr.a,{})})}),Object(G.jsx)(C.a,{title:"More",children:Object(G.jsx)(w.a,{onClick:function(e){_(e.target)},className:t.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Wr.a,{})})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{className:t.commentSection,children:L.allowComments?Object(G.jsx)(ec,{file:L,videoPlayer:H}):Object(G.jsx)("span",{className:t.commentsDisabled,children:"Comments are disabled for this file"})})]})})})]}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:q,open:Boolean(q),onClose:xt,children:[Object(G.jsx)(Xi.a,{onClick:function(){var e="https://"+window.location.host+"/video/"+L.key;navigator.clipboard.writeText(e),_(null)},children:"Copy Link"}),ue&&Object(G.jsx)(Xi.a,{onClick:function(){_(null),Ne(!0)},children:"Edit File"}),ue&&Object(G.jsx)(Xi.a,{onClick:function(){_(null),Oe(!0)},children:"Delete File"}),ue&&Object(G.jsx)(Xi.a,{onClick:function(){_(null),Fe(!0)},children:"File Usage Data"}),Object(G.jsx)(Xi.a,{disabled:!L.allowDownloads,onClick:function(){return wt.apply(this,arguments)},children:"Download File"})]})]}),me&&Object(G.jsxs)(dt.a,{open:me,onClose:yt,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:yt,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){return vt.apply(this,arguments)},color:"primary",children:"Delete"})]}),Ke&&Object(G.jsx)(ut.a,{})]}),!1===Q&&Object(G.jsx)(Nt,{}),Object(G.jsx)(st.a,{open:Ge,autoHideDuration:6e3,onClose:St,children:Object(G.jsx)(Ic,{onClose:St,severity:Ze,children:tt})}),Object(G.jsx)($e,{}),ye&&Object(G.jsx)(Nc,{open:ye,onClose:function(){ve(!1)},file:L}),we&&Object(G.jsx)(Ec,{open:we,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",Qe("success"),at(t),qe(!0)),Ne(!1)},file:L,folder:F}),Re&&Object(G.jsx)(Dc,{open:Re,onClose:function(){Pe(!1)},file:L}),Ue&&Object(G.jsx)(Pc,{open:Ue,onClose:function(){We(!1)},file:L}),Te&&Object(G.jsx)(Fc,{open:Te,onClose:function(){Fe(!1)},file:L,isVideo:!0})]})}var Wc=a(312),Mc=a.n(Wc),Hc=Object(O.a)((function(e){return{document:{paddingTop:65}}})),Kc=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Yc(e){var t=Hc(),a=Object(n.useState)(0),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(1),o=Object(m.a)(s,2),l=o[0],d=o[1],j=Object(n.useState)(),b=Object(m.a)(j,2),f=b[0],h=b[1];Object(n.useEffect)((function(){u.isMobile?h(window.innerWidth):h(.85*window.innerWidth),window.addEventListener("resize",(function(){u.isMobile?h(window.innerWidth):h(.85*window.innerWidth)}))}),[]);var O=function(){e.onClose()};return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:O,"aria-labelledby":"simple-dialog-title",open:e.open,TransitionComponent:Kc,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:O,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.titleText,children:e.file.displayName})]})}),Object(G.jsxs)(ai.a,{file:e.file.url,onLoadSuccess:function(e){var t=e.numPages;c(t)},className:t.document,children:[Object(G.jsx)(cc.a,{steps:r,position:"static",variant:"text",activeStep:l-1,nextButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){d(l+1)},disabled:l===r,children:["Next",Object(G.jsx)(dc.a,{})]}),backButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){d(l-1)},disabled:1===l,children:[Object(G.jsx)(oc.a,{}),"Prev"]})}),Object(G.jsx)(ai.b,{pageNumber:l,className:t.page,width:f})]})]})})}var zc=Object(O.a)((function(e){var t,a;return{root:Object(Ze.a)({paddingTop:15,paddingBottom:80},e.breakpoints.down("sm"),{paddingLeft:0}),page:(t={},Object(Ze.a)(t,e.breakpoints.down("sm"),{paddingLeft:0}),Object(Ze.a)(t,"paddingLeft",15),t),displayName:(a={flexGrow:1,paddingTop:10,fontSize:24},Object(Ze.a)(a,e.breakpoints.down("sm"),{paddingLeft:0,fontSize:19}),Object(Ze.a)(a,"overflowWrap","break-word"),Object(Ze.a)(a,"maxWidth","100%"),Object(Ze.a)(a,"display","-webkit-box"),Object(Ze.a)(a,"WebkitLineClamp",2),Object(Ze.a)(a,"textOverflow","ellipsis"),a),commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:{width:55,height:55},fullScreenButton:{width:55,height:55},uploadedByText:{color:"grey"}}}));function Vc(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Gc(e){var t=Object(o.f)(),a=zc(),i=Object(o.e)(),r=Object(d.b)(),c=r.enqueueSnackbar,s=r.closeSnackbar,l=Object(n.useState)(0),j=Object(m.a)(l,2),b=j[0],f=j[1],O=Object(n.useState)(1),p=Object(m.a)(O,2),g=p[0],y=p[1],v=Object(n.useState)(),k=Object(m.a)(v,2),S=k[0],E=k[1],T=Object(n.useState)(),F=Object(m.a)(T,2),B=F[0],R=F[1],A=Object(n.useState)(),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)(null),M=Object(m.a)(W,2),H=M[0],Y=M[1],z=Object(n.useContext)(h.b),V=z.files,q=z.comments,_=z.notifications,X=z.events,Z=z.users,Q=z.folders,J=z.groups,$=Object(n.useState)(),ee=Object(m.a)($,2),te=ee[0],ae=ee[1],ne=Object(n.useState)(!1),ie=Object(m.a)(ne,2),re=ie[0],ce=ie[1],se=Object(n.useState)(!1),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=Object(n.useState)(!1),je=Object(m.a)(ue,2),fe=je[0],he=je[1],me=Object(n.useState)(!1),Oe=Object(m.a)(me,2),pe=Oe[0],ge=Oe[1],ye=Object(n.useState)(!1),ve=Object(m.a)(ye,2),ke=ve[0],Ce=ve[1],we=Object(n.useState)(!1),Ne=Object(m.a)(we,2),Se=Ne[0],Ee=Ne[1],Te=Object(n.useContext)(h.d).currentUserData,Fe=0,Be=Object(n.useState)(!1),De=Object(m.a)(Be,2),Re=De[0],Pe=De[1],Ae=Object(n.useState)("error"),Le=Object(m.a)(Ae,2),Ie=Le[0],Ue=Le[1],We=Object(n.useState)(""),Me=Object(m.a)(We,2),He=Me[0],Ke=Me[1],Ye=Object(n.useState)(!0),ze=Object(m.a)(Ye,2),Ve=ze[0],Ge=ze[1],qe=Object(n.useState)(""),_e=Object(m.a)(qe,2),Xe=_e[0],Ze=_e[1],Qe=Object(n.useState)(!1),Je=Object(m.a)(Qe,2),et=Je[0],tt=Je[1],at=Object(n.useState)(!1),nt=Object(m.a)(at,2),it=nt[0],rt=nt[1],ot=function(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,{variant:"determinate",value:Fe}),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(Fe),"%")})})]})};Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(e){e||i.replace("/signin?url="+t.pathname)})),n="";n=e.fileKey?e.fileKey:t.pathname.replace("/pdf/","");var r=V.filter((function(e){return e.key===n}))[0];if(r&&Te){R(r),Ge(r.allowComments);var c=Q.filter((function(e){return e.key===r.folder}))[0];if(c&&E(c),Object(be.o)(r,J,Te)?ae(!0):ae(!1),Te.faveFiles&&Te.faveFiles.includes(r.key)?rt(!0):rt(!1),ce(r.managers.includes(Te.key)||"System Digital Manager"===Te.role||r.uploadedBy===Te.key),r.uploadedBy){var s=Z.filter((function(e){return e.key===r.uploadedBy}))[0];s&&Ze(s.firstName+" "+s.lastName)}if(!et)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:r.key,fileName:r.displayName,fileType:r.type,user:Te.key,action:"Open",date:P()().toString()}),tt(!0)}return u.isMobile?U(window.innerWidth):U(window.innerWidth/2.5),window.addEventListener("resize",(function(){u.isMobile?U(window.innerWidth):U(window.innerWidth/2.5)})),function(){return a()}}),[V,B,t.pathname,i,Te]);var lt=function(){Y(null)};function ut(){de(!1)}var jt=function(e,t){"clickaway"!==t&&Pe(!1)};return Object(G.jsxs)(G.Fragment,{children:[te&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:a.root,children:B&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ht.a,{sm:6,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(ai.a,{file:B.url,onLoadSuccess:function(e){var t=e.numPages;f(t)},className:a.document,children:[Object(G.jsx)(cc.a,{steps:b,position:"static",variant:"text",activeStep:g-1,nextButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){y(g+1)},disabled:g===b,children:["Next",Object(G.jsx)(dc.a,{})]}),backButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){y(g-1)},disabled:1===g,children:[Object(G.jsx)(oc.a,{}),"Prev"]})}),Object(G.jsx)(ai.b,{pageNumber:g,className:a.page,width:I})]})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(x.a,{className:a.displayName,children:B.displayName}),""!==Xe&&Object(G.jsxs)("span",{className:a.uploadedByText,children:["Uploaded By: ",Xe]})]}),Object(G.jsx)(w.a,{onClick:function(){he(!0)},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})}),Object(G.jsx)(w.a,{onClick:function(){Ee(!0)},className:a.fullScreenButton,children:Object(G.jsx)(Mc.a,{})}),it?Object(G.jsx)(C.a,{title:"Remove From Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};Te.faveFiles.forEach((function(t){t!==B.key&&(e[t]=!0)})),D.b.database().ref("users").child(Te.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(wr.a,{})})}):Object(G.jsx)(C.a,{title:"Add to Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};Te.faveFiles.forEach((function(t){e[t]=!0})),e[B.key]=!0,D.b.database().ref("users").child(Te.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Yr.a,{})})}),Object(G.jsx)(w.a,{onClick:function(e){Y(e.target)},className:a.menuButton,children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{children:Ve?Object(G.jsx)(ec,{file:B}):Object(G.jsx)("span",{className:a.commentsDisabled,children:"Comments are disabled for this file"})})]})})}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:H,open:Boolean(H),onClose:lt,children:[Object(G.jsx)(Xi.a,{onClick:function(){var e="http://"+window.location.host+"/pdf/"+B.key;navigator.clipboard.writeText(e),Y(null)},children:"Copy Link"}),re&&Object(G.jsx)(Xi.a,{onClick:function(){Y(null),ge(!0)},children:"Edit File"}),re&&Object(G.jsx)(Xi.a,{onClick:function(){Y(null),de(!0)},children:"Delete File"}),re&&Object(G.jsx)(Xi.a,{onClick:function(){Y(null),Ce(!0)},children:"File Usage Data"}),Object(G.jsx)(Xi.a,{disabled:!B.allowDownloads,onClick:function(){B&&(c("Downloading: "+B.filename,{variant:"default",action:ot,persist:!0,key:B.key}),Wn()({url:B.url,method:"GET",responseType:"blob",onDownloadProgress:function(e){var t=Math.floor(e.loaded/e.total*100);Fe=t,c("Downloading: "+B.filename,{variant:"default",action:ot,persist:!0,key:B.key,preventDuplicate:!0})}}).then((function(e){In()(e.data,B.filename),D.b.database().ref("fileusage").push({file:B.key,fileName:B.displayName,fileType:B.type,user:Te.key,action:"Download",date:P()().toString()}),Fe=0,s(B.key)})),lt())},children:"Download File"})]})]}),le&&Object(G.jsxs)(dt.a,{open:le,onClose:ut,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:ut,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){if(re){if(q.forEach((function(e){e.file===B.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),_.forEach((function(e){e.file===B.key&&D.b.database().ref("notifications").child(e.key).remove()})),X.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===B.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),Z.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===B.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),!Object(be.e)(B,V)){console.log("Deleting From Storage");var t=B.key;B.original&&(t=B.original),D.b.storage().ref("files").child(t).child(B.filename).delete(),D.b.storage().ref("files").child(t).child("thumbnail").delete()}D.b.database().ref("files").child(B.key).remove(),void 0===e.fileKey?i.goBack():e.onClose()}de(!1)},color:"primary",children:"Delete"})]})]}),!1===te&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),Object(G.jsx)(st.a,{open:Re,autoHideDuration:6e3,onClose:jt,children:Object(G.jsx)(Vc,{onClose:jt,severity:Ie,children:He})}),B&&Object(G.jsxs)(G.Fragment,{children:[fe&&Object(G.jsx)(Nc,{open:fe,onClose:function(){he(!1)},file:B}),Se&&Object(G.jsx)(Yc,{open:Se,onClose:function(){Ee(!1)},file:B}),pe&&Object(G.jsx)(Ec,{open:pe,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",Ue("success"),Ke(t),Pe(!0)),Ge(B.allowComments),ge(!1)},file:B,folder:S}),ke&&Object(G.jsx)(Fc,{open:ke,onClose:function(){Ce(!1)},file:B})]})]})}a(529);var qc=Object(O.a)((function(e){return{root:{paddingTop:15,paddingBottom:80},document:{},page:{paddingLeft:15},displayName:{flexGrow:1,paddingTop:5},commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:{width:55,height:55},fullScreenButton:{width:55,height:55},uploadedByText:{color:"grey"}}}));function _c(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Xc(e){var t=Object(o.f)(),a=qc(),i=Object(o.e)(),r=Object(n.useState)(),c=Object(m.a)(r,2),s=c[0],l=c[1],u=Object(n.useState)(),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(d.b)(),p=O.enqueueSnackbar,g=O.closeSnackbar,y=Object(n.useState)(null),v=Object(m.a)(y,2),k=v[0],S=v[1],E=Object(n.useContext)(h.b),T=E.files,F=E.comments,B=E.notifications,R=E.events,A=E.users,L=E.folders,I=E.groups,U=Object(n.useState)(),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],J=X[1],$=Object(n.useState)(!1),ee=Object(m.a)($,2),te=ee[0],ae=ee[1],ne=Object(n.useState)(!1),ie=Object(m.a)(ne,2),re=ie[0],ce=ie[1],se=Object(n.useState)(!1),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=Object(n.useContext)(h.d).currentUserData,je=0,fe=Object(n.useState)(!1),he=Object(m.a)(fe,2),me=he[0],Oe=he[1],pe=Object(n.useState)("error"),ge=Object(m.a)(pe,2),ye=ge[0],ve=ge[1],ke=Object(n.useState)(""),Ce=Object(m.a)(ke,2),we=Ce[0],Ne=Ce[1],Se=Object(n.useState)(""),Ee=Object(m.a)(Se,2),Te=Ee[0],Fe=Ee[1],Be=Object(n.useState)(!1),De=Object(m.a)(Be,2),Re=De[0],Pe=De[1],Ae=Object(n.useState)(!1),Le=Object(m.a)(Ae,2),Ie=Le[0],Ue=Le[1],We=function(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,{variant:"determinate",value:je}),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(je),"%")})})]})};Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(e){e||i.replace("/signin?url="+t.pathname)})),n="";n=e.fileKey?e.fileKey:t.pathname.replace("/audio/","");var r=T.filter((function(e){return e.key===n}))[0];if(r&&ue){f(r);var c=L.filter((function(e){return e.key===r.folder}))[0];if(c&&l(c),Object(be.o)(r,I,ue)?H(!0):H(!1),ue.faveFiles&&ue.faveFiles.includes(r.key)?Ue(!0):Ue(!1),q(r.managers.includes(ue.key)||"System Digital Manager"===ue.role||r.uploadedBy===ue.key),r.uploadedBy){var s=A.filter((function(e){return e.key===r.uploadedBy}))[0];s&&Fe(s.firstName+" "+s.lastName)}if(!Re)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:r.key,fileName:r.displayName,fileType:r.type,user:ue.key,action:"Open",date:P()().toString()}),Pe(!0)}return function(){return a()}}),[t.file,T,t.pathname,i,ue]);var Me=function(){S(null)};function He(){J(!1)}var Ke=function(e,t){"clickaway"!==t&&Oe(!1)};return Object(G.jsxs)(G.Fragment,{children:[M&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:a.root,children:b&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ht.a,{sm:6,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Q.a,{autoPlay:!1,src:b.url})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h2",{className:a.displayName,children:b.displayName}),""!==Te&&Object(G.jsxs)("span",{className:a.uploadedByText,children:["Uploaded By: ",Te]})]}),Object(G.jsx)(w.a,{onClick:function(){ae(!0)},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})}),Ie?Object(G.jsx)(C.a,{title:"Remove From Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};ue.faveFiles.forEach((function(t){t!==b.key&&(e[t]=!0)})),D.b.database().ref("users").child(ue.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(wr.a,{})})}):Object(G.jsx)(C.a,{title:"Add to Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};ue.faveFiles.forEach((function(t){e[t]=!0})),e[b.key]=!0,D.b.database().ref("users").child(ue.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Yr.a,{})})}),Object(G.jsx)(w.a,{onClick:function(e){S(e.target)},className:a.menuButton,children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{children:b.allowComments?Object(G.jsx)(ec,{file:b}):Object(G.jsx)("span",{className:a.commentsDisabled,children:"Comments are disabled for this file"})})]})})}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:k,open:Boolean(k),onClose:Me,children:[Object(G.jsx)(Xi.a,{onClick:function(){var e="http://"+window.location.host+"/audio/"+b.key;navigator.clipboard.writeText(e),S(null)},children:"Copy Link"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),ce(!0)},children:"Edit File"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),J(!0)},children:"Delete File"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),de(!0)},children:"File Usage Data"}),Object(G.jsx)(Xi.a,{disabled:!b.allowDownloads,onClick:function(){b&&(p("Downloading: "+b.filename,{variant:"default",action:We,persist:!0,key:b.key}),Wn()({url:b.url,method:"GET",responseType:"blob",onDownloadProgress:function(e){var t=Math.floor(e.loaded/e.total*100);je=t,p("Downloading: "+b.filename,{variant:"default",action:We,persist:!0,key:b.key,preventDuplicate:!0})}}).then((function(e){In()(e.data,b.filename),D.b.database().ref("fileusage").push({file:b.key,fileName:b.displayName,fileType:b.type,user:ue.key,action:"Download",date:P()().toString()}),je=0,g(b.key)})),Me())},children:"Download File"})]})]}),Object(G.jsx)(st.a,{open:me,autoHideDuration:6e3,onClose:Ke,children:Object(G.jsx)(_c,{onClose:Ke,severity:ye,children:we})}),Z&&Object(G.jsxs)(dt.a,{open:Z,onClose:He,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:He,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){if(V){if(F.forEach((function(e){e.file===b.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),B.forEach((function(e){e.file===b.key&&D.b.database().ref("notifications").child(e.key).remove()})),R.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===b.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),A.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===b.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),!Object(be.e)(b,T)){console.log("Deleting From Storage");var t=b.key;b.original&&(t=b.original),D.b.storage().ref("files").child(t).child(b.filename).delete()}D.b.database().ref("files").child(b.key).remove(),void 0===e.fileKey?i.goBack():e.onClose()}J(!1)},color:"primary",children:"Delete"})]})]}),!1===M&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),te&&Object(G.jsx)(Nc,{open:te,onClose:function(){ae(!1)},file:b}),re&&Object(G.jsx)(Ec,{open:re,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",ve("success"),Ne(t),Oe(!0)),ce(!1)},file:b,folder:s}),le&&Object(G.jsx)(Fc,{open:le,onClose:function(){de(!1)},file:b})]})}var Zc=Object(O.a)((function(e){return{root:{paddingTop:15,paddingBottom:80},page:{paddingLeft:15},image:{width:"100%"},displayName:{flexGrow:1,paddingTop:5},commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:{width:55,height:55},fullScreenButton:{width:55,height:55},uploadedByText:{color:"grey"}}}));function Qc(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Jc(e){var t=Object(o.f)(),a=Zc(),i=Object(o.e)(),r=Object(n.useState)(),c=Object(m.a)(r,2),s=c[0],l=c[1],u=Object(n.useState)(),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(d.b)(),p=O.enqueueSnackbar,g=O.closeSnackbar,y=Object(n.useState)(null),v=Object(m.a)(y,2),k=v[0],S=v[1],E=Object(n.useContext)(h.b),T=E.files,F=E.comments,B=E.notifications,R=E.events,A=E.users,L=E.folders,I=E.groups,U=Object(n.useState)(),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!1),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1],ce=Object(n.useState)(!1),se=Object(m.a)(ce,2),oe=se[0],le=se[1],de=Object(n.useContext)(h.d).currentUserData,ue=0,je=Object(n.useState)(!1),fe=Object(m.a)(je,2),he=fe[0],me=fe[1],Oe=Object(n.useState)("error"),pe=Object(m.a)(Oe,2),ge=pe[0],ye=pe[1],ve=Object(n.useState)(""),ke=Object(m.a)(ve,2),Ce=ke[0],we=ke[1],Ne=Object(n.useState)(""),Se=Object(m.a)(Ne,2),Ee=Se[0],Te=Se[1],Fe=Object(n.useState)(!1),Be=Object(m.a)(Fe,2),De=Be[0],Re=Be[1],Pe=Object(n.useState)(!1),Ae=Object(m.a)(Pe,2),Le=Ae[0],Ie=Ae[1],Ue=function(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,{variant:"determinate",value:ue}),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(ue),"%")})})]})};Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(e){e||i.replace("/signin?url="+t.pathname)})),n="";n=e.fileKey?e.fileKey:t.pathname.replace("/image/","");var r=T.filter((function(e){return e.key===n}))[0];if(r&&de){f(r);var c=L.filter((function(e){return e.key===r.folder}))[0];if(c&&l(c),Object(be.o)(r,I,de)?H(!0):H(!1),de.faveFiles&&de.faveFiles.includes(r.key)?Ie(!0):Ie(!1),q(r.managers.includes(de.key)||"System Digital Manager"===de.role||r.uploadedBy===de.key),r.uploadedBy){var s=A.filter((function(e){return e.key===r.uploadedBy}))[0];s&&Te(s.firstName+" "+s.lastName)}if(!De)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:r.key,fileName:r.displayName,fileType:r.type,user:de.key,action:"Open",date:P()().toString()}),Re(!0)}return function(){return a()}}),[t.file,T,t.pathname,i,de]);var We=function(){S(null)};function Me(){Q(!1)}var He=function(e,t){"clickaway"!==t&&me(!1)};return Object(G.jsxs)(G.Fragment,{children:[M&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:a.root,children:b&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ht.a,{sm:6,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)("img",{className:a.image,src:b.url,alt:"animage"})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h2",{className:a.displayName,children:b.displayName}),""!==Ee&&Object(G.jsxs)("span",{className:a.uploadedByText,children:["Uploaded By: ",Ee]})]}),Object(G.jsx)(w.a,{onClick:function(){te(!0)},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})}),Object(G.jsx)(w.a,{onClick:function(){},className:a.fullScreenButton,children:Object(G.jsx)(it.a,{target:"_blank",href:b.url,color:"inherit",children:Object(G.jsx)(Mc.a,{})})}),Le?Object(G.jsx)(C.a,{title:"Remove From Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};de.faveFiles.forEach((function(t){t!==b.key&&(e[t]=!0)})),D.b.database().ref("users").child(de.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(wr.a,{})})}):Object(G.jsx)(C.a,{title:"Add to Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};de.faveFiles.forEach((function(t){e[t]=!0})),e[b.key]=!0,D.b.database().ref("users").child(de.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Yr.a,{})})}),Object(G.jsx)(w.a,{onClick:function(e){S(e.target)},className:a.menuButton,children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{children:b.allowComments?Object(G.jsx)(ec,{file:b}):Object(G.jsx)("span",{className:a.commentsDisabled,children:"Comments are disabled for this file"})})]})})}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:k,open:Boolean(k),onClose:We,children:[Object(G.jsx)(Xi.a,{onClick:function(){var e="http://"+window.location.host+"/image/"+b.key;navigator.clipboard.writeText(e),S(null)},children:"Copy Link"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),re(!0)},children:"Edit File"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),Q(!0)},children:"Delete File"}),V&&Object(G.jsx)(Xi.a,{onClick:function(){S(null),le(!0)},children:"File Usage Data"}),Object(G.jsx)(Xi.a,{disabled:!b.allowDownloads,onClick:function(){b&&(p("Downloading: "+b.filename,{variant:"default",action:Ue,persist:!0,key:b.key}),Wn()({url:b.url,method:"GET",responseType:"blob",onDownloadProgress:function(e){var t=Math.floor(e.loaded/e.total*100);ue=t,p("Downloading: "+b.filename,{variant:"default",action:Ue,persist:!0,key:b.key,preventDuplicate:!0})}}).then((function(e){In()(e.data,b.filename),D.b.database().ref("fileusage").push({file:b.key,fileName:b.displayName,fileType:b.type,user:de.key,action:"Download",date:P()().toString()}),ue=0,g(b.key)})),We())},children:"Download File"})]})]}),Object(G.jsx)(st.a,{open:he,autoHideDuration:6e3,onClose:He,children:Object(G.jsx)(Qc,{onClose:He,severity:ge,children:Ce})}),Z&&Object(G.jsxs)(dt.a,{open:Z,onClose:Me,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:Me,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){if(V){if(F.forEach((function(e){e.file===b.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),B.forEach((function(e){e.file===b.key&&D.b.database().ref("notifications").child(e.key).remove()})),R.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===b.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),A.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===b.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),!Object(be.e)(b,T)){console.log("Deleting From Storage");var t=b.key;b.original&&(t=b.original),D.b.storage().ref("files").child(t).child(b.filename).delete()}D.b.database().ref("files").child(b.key).remove(),void 0===e.fileKey?i.goBack():e.onClose()}Q(!1)},color:"primary",children:"Delete"})]})]}),!1===M&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),ee&&Object(G.jsx)(Nc,{open:ee,onClose:function(){te(!1)},file:b}),ie&&Object(G.jsx)(Ec,{open:ie,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",ye("success"),we(t),me(!0)),re(!1)},file:b,folder:s}),oe&&Object(G.jsx)(Fc,{open:oe,onClose:function(){le(!1)},file:b})]})}var $c=Object(O.a)((function(e){return{root:{paddingTop:15,paddingBottom:65},displayName:{flexGrow:1,paddingTop:5},commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:{width:55,height:55},uploadedByText:{color:"grey"}}}));function es(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function ts(e){var t=Object(o.f)(),a=$c(),i=Object(o.e)(),r=Object(d.b)(),c=r.enqueueSnackbar,s=r.closeSnackbar,l=Object(n.useState)(null),u=Object(m.a)(l,2),j=u[0],b=u[1],f=Object(n.useState)(),O=Object(m.a)(f,2),p=O[0],g=O[1],y=Object(n.useState)(),v=Object(m.a)(y,2),k=v[0],S=v[1],E=Object(n.useContext)(h.b),T=E.files,F=E.comments,B=E.notifications,R=E.events,A=E.users,L=E.folders,I=E.groups,U=Object(n.useContext)(h.d).currentUserData,W=Object(n.useState)(),M=Object(m.a)(W,2),H=M[0],Y=M[1],z=Object(n.useState)(!1),V=Object(m.a)(z,2),q=V[0],_=V[1],X=Object(n.useState)(!1),Z=Object(m.a)(X,2),Q=Z[0],J=Z[1],$=Object(n.useState)(!1),ee=Object(m.a)($,2),te=ee[0],ae=ee[1],ne=Object(n.useState)(!1),ie=Object(m.a)(ne,2),re=ie[0],ce=ie[1],se=Object(n.useState)(!1),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=0,je=Object(n.useState)(!1),fe=Object(m.a)(je,2),he=fe[0],me=fe[1],Oe=Object(n.useState)("error"),pe=Object(m.a)(Oe,2),ge=pe[0],ye=pe[1],ve=Object(n.useState)(""),ke=Object(m.a)(ve,2),Ce=ke[0],we=ke[1],Ne=Object(n.useState)(""),Se=Object(m.a)(Ne,2),Ee=Se[0],Te=Se[1],Fe=Object(n.useState)(!1),Be=Object(m.a)(Fe,2),De=Be[0],Re=Be[1],Pe=Object(n.useState)(!1),Ae=Object(m.a)(Pe,2),Le=Ae[0],Ie=Ae[1],Ue=function(e){return Object(G.jsxs)(Mn.a,{position:"relative",display:"inline-flex",children:[Object(G.jsx)(ct.a,{variant:"determinate",value:ue}),Object(G.jsx)(Mn.a,{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",children:Object(G.jsx)(x.a,{variant:"caption",component:"div",color:"inherit",children:"".concat(Math.round(ue),"%")})})]})};Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(e){e||i.replace("/signin?url="+t.pathname)})),n="";n=e.fileKey?e.fileKey:t.pathname.replace("/file/","");var r=T.filter((function(e){return e.key===n}))[0];if(r&&U){S(r);var c=L.filter((function(e){return e.key===r.folder}))[0];if(c&&g(c),Object(be.o)(r,I,U)?Y(!0):Y(!1),U.faveFiles&&U.faveFiles.includes(r.key)?Ie(!0):Ie(!1),_(r.managers.includes(U.key)||"System Digital Manager"===U.role||r.uploadedBy===U.key),r.uploadedBy){var s=A.filter((function(e){return e.key===r.uploadedBy}))[0];s&&Te(s.firstName+" "+s.lastName)}if(!De)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:r.key,fileName:r.displayName,fileType:r.type,user:U.key,action:"Open",date:P()().toString()}),Re(!0)}return function(){return a()}}),[t.file,T,t.pathname,i,U]);var We=function(){b(null)};function Me(){J(!1)}var He=function(e,t){"clickaway"!==t&&me(!1)};return Object(G.jsxs)(G.Fragment,{children:[H&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:a.root,children:k&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ht.a,{sm:6,children:[Object(G.jsx)(Mt.a,{}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h2",{className:a.displayName,children:k.displayName}),""!==Ee&&Object(G.jsxs)("span",{className:a.uploadedByText,children:["Uploaded By: ",Ee]})]}),Object(G.jsx)(w.a,{onClick:function(){ae(!0)},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})}),Le?Object(G.jsx)(C.a,{title:"Remove From Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};U.faveFiles.forEach((function(t){t!==k.key&&(e[t]=!0)})),D.b.database().ref("users").child(U.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(wr.a,{})})}):Object(G.jsx)(C.a,{title:"Add to Favourites",children:Object(G.jsx)(w.a,{onClick:function(){var e={};U.faveFiles.forEach((function(t){e[t]=!0})),e[k.key]=!0,D.b.database().ref("users").child(U.key).update({faveFiles:e})},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(Yr.a,{})})}),Object(G.jsx)(w.a,{onClick:function(e){b(e.target)},className:a.menuButton,children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{children:k.allowComments?Object(G.jsx)(ec,{file:k}):Object(G.jsx)("span",{className:a.commentsDisabled,children:"Comments are disabled for this file"})})]})})}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:j,open:Boolean(j),onClose:We,children:[Object(G.jsx)(Xi.a,{onClick:function(){var e="http://"+window.location.host+"/file/"+k.key;navigator.clipboard.writeText(e),b(null)},children:"Copy Link"}),q&&Object(G.jsx)(Xi.a,{onClick:function(){b(null),ce(!0)},children:"Edit File"}),q&&Object(G.jsx)(Xi.a,{onClick:function(){b(null),J(!0)},children:"Delete File"}),q&&Object(G.jsx)(Xi.a,{onClick:function(){b(null),de(!0)},children:"File Usage Data"}),Object(G.jsx)(Xi.a,{disabled:!k.allowDownloads,onClick:function(){k&&(c("Downloading: "+k.filename,{variant:"default",action:Ue,persist:!0,key:k.key}),Wn()({url:k.url,method:"GET",responseType:"blob",onDownloadProgress:function(e){var t=Math.floor(e.loaded/e.total*100);ue=t,c("Downloading: "+k.filename,{variant:"default",action:Ue,persist:!0,key:k.key,preventDuplicate:!0})}}).then((function(e){In()(e.data,k.filename),D.b.database().ref("fileusage").push({file:k.key,fileName:k.displayName,fileType:k.type,user:U.key,action:"Download",date:P()().toString()}),ue=0,s(k.key)})),We())},children:"Download File"})]})]}),Q&&Object(G.jsxs)(dt.a,{open:Q,onClose:Me,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:Me,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){if(q){if(F.forEach((function(e){e.file===k.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),B.forEach((function(e){e.file===k.key&&D.b.database().ref("notifications").child(e.key).remove()})),R.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===k.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),A.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===k.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),!Object(be.e)(k,T)){console.log("Deleting From Storage");var t=k.key;k.original&&(t=k.original),D.b.storage().ref("files").child(t).child(k.filename).delete()}D.b.database().ref("files").child(k.key).remove(),void 0===e.fileKey?i.goBack():e.onClose()}J(!1)},color:"primary",children:"Delete"})]})]}),Object(G.jsx)(st.a,{open:he,autoHideDuration:6e3,onClose:He,children:Object(G.jsx)(es,{onClose:He,severity:ge,children:Ce})}),!1===H&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),te&&Object(G.jsx)(Nc,{open:te,onClose:function(){ae(!1)},file:k}),re&&Object(G.jsx)(Ec,{open:re,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",ye("success"),we(t),me(!0)),ce(!1)},file:k,folder:p}),le&&Object(G.jsx)(Fc,{open:le,onClose:function(){de(!1)},file:k})]})}var as=a(577),ns=a.n(as),is=Object(O.a)((function(e){return{root:{paddingTop:15,paddingBottom:65},displayName:{flexGrow:1,paddingTop:5},commentsDisabled:{paddingTop:10,paddingBottom:10,paddingLeft:15},menuButton:{width:55,height:55},uploadedByText:{color:"grey"}}}));function rs(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function cs(e){var t=Object(o.f)(),a=is(),i=Object(o.e)(),r=Object(n.useState)(null),c=Object(m.a)(r,2),s=c[0],l=c[1],d=Object(n.useState)(),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useContext)(h.b),y=x.files,v=x.comments,k=x.notifications,C=x.events,S=x.users,E=x.folders,T=x.groups,F=Object(n.useContext)(h.d).currentUserData,B=Object(n.useState)(),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(!1),ae=Object(m.a)(te,2),ne=ae[0],ie=ae[1],re=Object(n.useState)(!1),ce=Object(m.a)(re,2),se=ce[0],oe=ce[1],le=Object(n.useState)("error"),de=Object(m.a)(le,2),ue=de[0],je=de[1],fe=Object(n.useState)(""),he=Object(m.a)(fe,2),me=he[0],Oe=he[1],pe=Object(n.useState)(""),ge=Object(m.a)(pe,2),ye=ge[0],ve=ge[1],ke=Object(n.useState)(!1),Ce=Object(m.a)(ke,2),we=Ce[0],Ne=Ce[1],Se=Object(n.useState)(!1),Ee=Object(m.a)(Se,2),Te=Ee[0],Fe=Ee[1],Be=Object(n.useState)(""),De=Object(m.a)(Be,2),Re=De[0],Pe=De[1],Ae=Object(n.useState)(!1),Le=Object(m.a)(Ae,2),Ie=Le[0],Ue=Le[1],We=Object(n.useState)(!1),Me=Object(m.a)(We,2),He=Me[0],Ke=Me[1];Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(e){e||i.replace("/signin?url="+t.pathname)})),n="";n=e.fileKey?e.fileKey:t.pathname.replace("/link/","");var r=y.filter((function(e){return e.key===n}))[0];if(r&&F){g(r);var c=E.filter((function(e){return e.key===r.folder}))[0];if(c&&b(c),Object(be.o)(r,T,F)?L(!0):L(!1),M(r.managers.includes(F.key)||"System Digital Manager"===F.role||r.uploadedBy===F.key),r.uploadedBy){var s=S.filter((function(e){return e.key===r.uploadedBy}))[0];s&&ve(s.firstName+" "+s.lastName)}if(r.filename.includes("youtube")){if(r.filename.includes("embed"))Pe(r.filename);else{var o=r.filename,l=o.substring(0,o.indexOf("v=")+"v=".length),d=r.filename.replace(l,"");Pe("https://www.youtube.com/embed/"+d)}Fe(!0)}else r.filename.includes("docs.google.com")&&(Ue(!0),Ke(!0));if(!we)console.log("Log File Usage"),D.b.database().ref("fileusage").push({file:r.key,fileName:r.displayName,fileType:r.type,user:F.key,action:"Open",date:P()().toString()}),Ne(!0)}return function(){return a()}}),[t.file,y,t.pathname,i,F]);function Ye(){V(!1)}var ze=function(e,t){"clickaway"!==t&&oe(!1)};return Object(G.jsxs)(G.Fragment,{children:[A&&Object(G.jsxs)(G.Fragment,{children:[void 0===e.fileKey&&Object(G.jsx)(Pt,{}),Object(G.jsx)(Wt.a,{fluid:!0,className:a.root,children:p&&Object(G.jsxs)(G.Fragment,{children:[Ie&&Object(G.jsx)(ns.a,{url:p.filename,width:window.innerWidth-100,height:window.innerHeight-400,iframeWidth:window.innerWidth-100,iframeHeight:window.innerHeight-400,interactive:He}),Te&&Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{lg:6,md:12,sm:12,children:Object(G.jsx)("iframe",{width:"100%",height:window.innerWidth/4,src:Re,title:p.filename,frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:!0})})}),Object(G.jsxs)(Ht.a,{sm:6,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("div",{children:Object(G.jsx)(it.a,{target:"_blank",className:a.displayName,variant:"h4",href:p.filename,children:p.displayName})}),""!==ye&&Object(G.jsxs)("span",{className:a.uploadedByText,children:["Added By: ",ye]})]}),Object(G.jsx)(w.a,{onClick:function(){Z(!0)},className:a.menuButton,"aria-label":"moreVideoEditOptions",children:Object(G.jsx)(di.a,{})}),Object(G.jsx)(w.a,{onClick:function(e){l(e.target)},className:a.menuButton,children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),Object(G.jsx)(Mt.a,{children:p.allowComments?Object(G.jsx)(ec,{file:p}):Object(G.jsx)("span",{className:a.commentsDisabled,children:"Comments are disabled for this file"})})]})]})}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:s,open:Boolean(s),onClose:function(){l(null)},children:[W&&Object(G.jsx)(Xi.a,{onClick:function(){l(null),ee(!0)},children:"Edit File"}),W&&Object(G.jsx)(Xi.a,{onClick:function(){l(null),V(!0)},children:"Delete File"}),W&&Object(G.jsx)(Xi.a,{onClick:function(){l(null),ie(!0)},children:"File Usage Data"})]})]}),z&&Object(G.jsxs)(dt.a,{open:z,onClose:Ye,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:Ye,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){W&&(v.forEach((function(e){e.file===p.key&&D.b.database().ref("comments").child(e.key).update({deleted:!0})})),k.forEach((function(e){e.file===p.key&&D.b.database().ref("notifications").child(e.key).remove()})),C.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e.key===p.key?a=!0:t.push(e.key)})),a){var n=D.b.database().ref("events").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),S.forEach((function(e){var t=[],a=!1;if(e.files.forEach((function(e){e===p.key?a=!0:t.push(e)})),a){var n=D.b.database().ref("users").child(e.key),i={};t.forEach((function(e){i[e]=!0})),n.update({files:i})}})),D.b.database().ref("files").child(p.key).remove(),void 0===e.fileKey?i.goBack():e.onClose()),V(!1)},color:"primary",children:"Delete"})]})]}),Object(G.jsx)(st.a,{open:se,autoHideDuration:6e3,onClose:ze,children:Object(G.jsx)(rs,{onClose:ze,severity:ue,children:me})}),!1===A&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{}),X&&Object(G.jsx)(Nc,{open:X,onClose:function(){Z(!1)},file:p}),$&&Object(G.jsx)(Ec,{open:$,onClose:function(e){var t;"saved"===e&&(t="File edited successfully",je("success"),Oe(t),oe(!0)),ee(!1)},file:p,folder:j}),ne&&Object(G.jsx)(Fc,{open:ne,onClose:function(){ie(!1)},file:p})]})}var ss=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function os(e){return Object(G.jsxs)(dt.a,{fullScreen:!0,"aria-labelledby":"simple-dialog-title",maxWidth:"lg",open:e.open,fullWidth:!0,TransitionComponent:ss,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){e.onClose()},"aria-label":"close",children:Object(G.jsx)(Rt.a,{})}),Object(G.jsx)(x.a,{variant:"h6",children:e.fileName})]})}),Object(G.jsx)(g.a,{}),"Video"===e.fileType&&Object(G.jsx)(Uc,{fileKey:e.fileKey,onClose:e.onClose}),"PDF"===e.fileType&&Object(G.jsx)(Gc,{fileKey:e.fileKey,onClose:e.onClose}),"Audio"===e.fileType&&Object(G.jsx)(Xc,{fileKey:e.fileKey,onClose:e.onClose}),"Image"===e.fileType&&Object(G.jsx)(Jc,{fileKey:e.fileKey,onClose:e.onClose}),"Misc"===e.fileType&&Object(G.jsx)(ts,{fileKey:e.fileKey,onClose:e.onClose}),"Link"===e.fileType&&Object(G.jsx)(cs,{fileKey:e.fileKey,onClose:e.onClose})]})}var ls=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function ds(e){var t=ls(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.b),R=B.comments,P=B.notifications,A=B.events,L=B.users,I=B.files,U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!0),re=Object(m.a)(ae,2),ce=re[0],se=re[1];function oe(){ce?te(!0):e.handleFileSelect&&e.handleFileSelect(e.file)}function le(){te(!1)}function de(e){ce&&(e.preventDefault(),M&&(w(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4})))}Object(n.useEffect)((function(){y(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?H(!0):H(!1),a.permissions.shareFiles?q(!0):q(!1),e.file.allowSharing?Q(!0):Q(!1)),"faves_fggh2973jgbvbiu"===e.folder.id&&H(!1),!0===e.embedded&&(se(!1),H(!1))}),[e,a]);var ue=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){if(ce){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key),t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,thumbnail:e.file.thumbnail,original:n})}}():"sharefile"===t.target.id&&F(!0),s({mouseX:null,mouseY:null}),w(!1)},je=function(e){y(e.target.value)},fe=function(t){return function(){(O(!1),ce)&&("OK"===t?M&&(D.b.database().ref("files").child(e.file.key).update({displayName:x}),e.file.displayName=x):y(e.file.displayName))}},he=function(e){return function(){u(!1),ce&&"OK"===e&&M&&function(){me.apply(this,arguments)}()}};function me(){return(me=Object(ie.a)(ne.a.mark((function t(){var a;return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:ce&&(R.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),P.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),A.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),L.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),Object(be.e)(e.file,I)||(console.log("Deleting From Storage"),a=e.file.key,e.file.original&&(a=e.file.original),D.b.storage().ref("files").child(a).child(e.file.filename).delete(),D.b.storage().ref("files").child(a).child("thumbnail").delete()),D.b.database().ref("files").child(e.file.key).remove(),e.showStatusMessage("File deleted successfully","success"));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oe(){F(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:de,children:[Object(G.jsxs)(Ke.a,{onClick:oe,className:t.listItem,style:C?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.thumbnail,children:Object(G.jsx)(gn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:ue,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[V&&Z&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:ue,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:ue,children:"Rename"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:ue,children:"Duplicate"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:ue,children:"Delete"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:fe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:x,onChange:je,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:fe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:fe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:he,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:he("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:he("OK"),color:"primary",children:"OK"})]})]}),T&&Object(G.jsx)(Dr,{open:T,onClose:Oe,file:e.file}),ee&&Object(G.jsx)(os,{open:ee,onClose:le,fileKey:e.file.key,fileName:e.file.displayName,fileType:"PDF"})]}))}})}var us=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function js(e){var t=us(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(!1),R=Object(m.a)(B,2),P=R[0],A=R[1],L=Object(n.useContext)(h.b),I=L.comments,U=L.notifications,W=L.events,M=L.users,H=L.files,Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!1),re=Object(m.a)(ae,2),ce=re[0],se=re[1],oe=Object(n.useState)(!0),le=Object(m.a)(oe,2),de=le[0],ue=le[1];function je(){de?se(!0):e.handleFileSelect&&e.handleFileSelect(e.file)}function fe(){se(!1)}function he(e){de&&(e.preventDefault(),V&&(w(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4})))}Object(n.useEffect)((function(){y(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?q(!0):q(!1),a.permissions.shareFiles?Q(!0):Q(!1),e.file.allowSharing?te(!0):te(!1)),"faves_fggh2973jgbvbiu"===e.folder.id&&q(!1),!0===e.embedded&&(ue(!1),q(!1))}),[e,a]);var me=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){if(de){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key),t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,original:n})}}():"sharefile"===t.target.id&&F(!0),s({mouseX:null,mouseY:null}),w(!1)},Oe=function(e){y(e.target.value)},pe=function(t){return function(){(O(!1),de)&&("OK"===t?V&&(D.b.database().ref("files").child(e.file.key).update({displayName:x}),e.file.displayName=x):y(e.file.displayName))}},ge=function(e){return function(){"OK"===e&&de?V&&function(){xe.apply(this,arguments)}():u(!1)}};function xe(){return(xe=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!de){t.next=8;break}if(A(!0),!Object(be.e)(e.file,H)){t.next=6;break}ye(),t.next=8;break;case 6:return t.next=8,ve().then((function(){ye()}));case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ye(){de&&(I.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),U.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),W.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),M.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.database().ref("files").child(e.file.key).remove(),A(!1),u(!1),e.showStatusMessage("File deleted successfully","success"))}function ve(){return new Promise((function(t,a){D.b.functions().httpsCallable("getBunnyStreamAPIKey")().then((function(n){var i=n.data.key,r=e.file.key;e.file.original&&(r=e.file.original);var c="https://video.bunnycdn.com/library/"+be.b+"/videos/"+r;fetch(c,{method:"DELETE",headers:{AccessKey:i}}).then((function(e){return e.json()})).then((function(e){console.log(e),t()})).catch((function(e){console.error(e),a()}))})).catch((function(e){console.log(e.code),console.log(e.message),console.log(e.details),a()}))}))}function ke(){F(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:he,children:[Object(G.jsxs)(Ke.a,{onClick:je,className:t.listItem,style:C?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.original?"https://vz-db0e7359-d70.b-cdn.net/"+e.file.original+"/thumbnail.jpg":"https://vz-db0e7359-d70.b-cdn.net/"+e.file.key+"/thumbnail.jpg",className:t.thumbnail,children:Object(G.jsx)(hn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:me,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Z&&ee&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:me,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:me,children:"Rename"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:me,children:"Duplicate"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:me,children:"Delete"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:pe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:x,onChange:Oe,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:pe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:pe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:ge,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:ge("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:ge("OK"),color:"primary",children:"OK"})]}),P&&Object(G.jsx)(ut.a,{})]}),T&&Object(G.jsx)(Dr,{open:T,onClose:ke,file:e.file}),ce&&Object(G.jsx)(os,{open:ce,onClose:fe,fileKey:e.file.key,fileName:e.file.displayName,fileType:"Video"})]}))}})}var bs=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function fs(e){var t=bs(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.b),R=B.comments,P=B.notifications,A=B.events,L=B.users,I=B.files,U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!0),re=Object(m.a)(ae,2),ce=re[0],se=re[1];function oe(){ce?te(!0):e.handleFileSelect&&e.handleFileSelect(e.file)}function le(){te(!1)}function de(e){ce&&(e.preventDefault(),M&&(w(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4})))}Object(n.useEffect)((function(){y(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?H(!0):H(!1),a.permissions.shareFiles?q(!0):q(!1),e.file.allowSharing?Q(!0):Q(!1)),"faves_fggh2973jgbvbiu"===e.folder.id&&H(!1),!0===e.embedded&&(se(!1),H(!1))}),[e,a]);var ue=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){if(ce){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key),t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,original:n})}}():"sharefile"===t.target.id&&F(!0),s({mouseX:null,mouseY:null}),w(!1)},je=function(e){y(e.target.value)},fe=function(t){return function(){(O(!1),ce)&&("OK"===t?M&&(D.b.database().ref("files").child(e.file.key).update({displayName:x}),e.file.displayName=x):y(e.file.displayName))}},he=function(e){return function(){u(!1),ce&&"OK"===e&&M&&function(){me.apply(this,arguments)}()}};function me(){return(me=Object(ie.a)(ne.a.mark((function t(){var a;return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:ce&&(R.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),P.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),A.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),L.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),Object(be.e)(e.file,I)||(console.log("Deleting From Storage"),a=e.file.key,e.file.original&&(a=e.file.original),D.b.storage().ref("files").child(a).child(e.file.filename).delete()),D.b.database().ref("files").child(e.file.key).remove(),e.showStatusMessage("File deleted successfully","success"));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oe(){F(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:de,children:[Object(G.jsxs)(Ke.a,{onClick:oe,className:t.listItem,style:C?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",src:e.file.url,className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:ue,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[V&&Z&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:ue,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:ue,children:"Rename"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:ue,children:"Duplicate"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:ue,children:"Delete"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:fe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:x,onChange:je,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:fe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:fe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:he,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:he("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:he("OK"),color:"primary",children:"OK"})]})]}),T&&Object(G.jsx)(Dr,{open:T,onClose:Oe,file:e.file}),ee&&Object(G.jsx)(os,{open:ee,onClose:le,fileKey:e.file.key,fileName:e.file.displayName,fileType:"Image"})]}))}})}var hs=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function ms(e){var t=hs(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(!1),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(""),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.b),R=B.comments,P=B.notifications,A=B.events,L=B.users,I=B.files,U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!0),re=Object(m.a)(ae,2),ce=re[0],se=re[1];function oe(){ce?te(!0):e.handleFileSelect&&e.handleFileSelect(e.file)}function le(){te(!1)}function de(e){ce&&(e.preventDefault(),M&&(F(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4})))}Object(n.useEffect)((function(){w(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?H(!0):H(!1),a.permissions.shareFiles?q(!0):q(!1),e.file.allowSharing?Q(!0):Q(!1)),"faves_fggh2973jgbvbiu"===e.folder.id&&H(!1),!0===e.embedded&&(se(!1),H(!1))}),[e,a]);var ue=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){if(ce){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key),t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,original:n})}}():"sharefile"===t.target.id&&y(!0),s({mouseX:null,mouseY:null}),F(!1)},je=function(e){w(e.target.value)},fe=function(t){return function(){(O(!1),ce)&&("OK"===t?M&&(D.b.database().ref("files").child(e.file.key).update({displayName:C}),e.file.displayName=C):w(e.file.displayName))}},he=function(e){return function(){u(!1),ce&&"OK"===e&&M&&function(){me.apply(this,arguments)}()}};function me(){return(me=Object(ie.a)(ne.a.mark((function t(){var a;return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:ce&&(R.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),P.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),A.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),L.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),Object(be.e)(e.file,I)||(console.log("Deleting From Storage"),a=e.file.key,e.file.original&&(a=e.file.original),D.b.storage().ref("files").child(a).child(e.file.filename).delete()),D.b.database().ref("files").child(e.file.key).remove(),e.showStatusMessage("File deleted successfully","success"));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oe(t){!0===t&&e.showStatusMessage("File shared successfully","success"),y(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:de,children:[Object(G.jsxs)(Ke.a,{onClick:oe,className:t.listItem,style:T?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",children:Object(G.jsx)(Sn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:ue,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[V&&Z&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:ue,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:ue,children:"Rename File"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:ue,children:"Duplicate File"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:ue,children:"Delete File"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:fe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:C,onChange:je,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:fe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:fe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:he,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:he("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:he("OK"),color:"primary",children:"OK"})]})]}),x&&Object(G.jsx)(Dr,{open:x,onClose:Oe,file:e.file}),ee&&Object(G.jsx)(os,{open:ee,onClose:le,fileKey:e.file.key,fileName:e.file.displayName,fileType:"Audio"})]}))}})}var Os=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function ps(e){var t=Os(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.b),R=B.comments,P=B.notifications,A=B.events,L=B.users,I=B.files,U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!0),re=Object(m.a)(ae,2),ce=re[0],se=re[1];function oe(){ce?te(!0):e.handleFileSelect&&e.handleFileSelect(e.file)}function le(){te(!1)}function de(e){ce&&(e.preventDefault(),M&&(w(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4})))}Object(n.useEffect)((function(){y(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?H(!0):H(!1),a.permissions.shareFiles?q(!0):q(!1),e.file.allowSharing?Q(!0):Q(!1)),"faves_fggh2973jgbvbiu"===e.folder.id&&H(!1),!0===e.embedded&&(se(!1),H(!1))}),[e,a]);var ue=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){if(ce){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key),t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,original:n})}}():"sharefile"===t.target.id&&F(!0),s({mouseX:null,mouseY:null}),w(!1)},je=function(e){y(e.target.value)},fe=function(t){return function(){(O(!1),ce)&&("OK"===t?M&&(D.b.database().ref("files").child(e.file.key).update({displayName:x}),e.file.displayName=x):y(e.file.displayName))}},he=function(e){return function(){u(!1),ce&&"OK"===e&&M&&function(){me.apply(this,arguments)}()}};function me(){return(me=Object(ie.a)(ne.a.mark((function t(){var a;return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:ce&&(R.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),P.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),A.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),L.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),Object(be.e)(e.file,I)||(console.log("Deleting From Storage"),a=e.file.key,e.file.original&&(a=e.file.original),D.b.storage().ref("files").child(a).child(e.file.filename).delete()),D.b.database().ref("files").child(e.file.key).remove(),e.showStatusMessage("File deleted successfully","success"));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Oe(){F(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:de,children:[Object(G.jsxs)(Ke.a,{onClick:oe,className:t.listItem,style:C?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",className:t.thumbnail,children:Object(G.jsx)(kn.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:ue,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[V&&Z&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:ue,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:ue,children:"Rename"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:ue,children:"Duplicate"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:ue,children:"Delete"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:fe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:x,onChange:je,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:fe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:fe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:he,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete File"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this file?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:he("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:he("OK"),color:"primary",children:"OK"})]})]}),T&&Object(G.jsx)(Dr,{open:T,onClose:Oe,file:e.file}),ee&&Object(G.jsx)(os,{open:ee,onClose:le,fileKey:e.file.key,fileName:e.file.displayName,fileType:"Misc"})]}))}})}var gs=a(578),xs=a.n(gs),ys=Object(O.a)((function(e){return{container:{paddingRight:10},label:{textAlign:"left",cursor:"pointer",marginTop:15,marginLeft:10,width:"100%",overflowWrap:"break-word",maxWidth:"100%",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis"},listItem:{backgroundColor:"rgb(245, 245, 245)",padding:5,height:60,borderRadius:5,margin:5}}}));function vs(e){var t=ys(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(!1),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(""),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],w=k[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useContext)(h.b),R=B.comments,P=B.notifications,A=B.events,L=B.users,I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1];function te(){ee(!0)}function ae(){ee(!1)}function re(e){e.preventDefault(),W&&(w(!0),s({mouseX:e.clientX-2,mouseY:e.clientY-4}))}Object(n.useEffect)((function(){y(e.file.displayName),a&&(e.folder.managers.includes(a.key)||"System Digital Manager"===a.role||e.file.uploadedBy===a.key?M(!0):M(!1),a.permissions.shareFiles?V(!0):V(!1),e.file.allowSharing?Z(!0):Z(!1))}),[e,a]);var ce=function(t){"renamefile"===t.target.id?O(!0):"deletefile"===t.target.id?u(!0):"duplicatefile"===t.target.id?function(){var t=D.b.database().ref("files"),n=e.file.key;e.file.original&&(n=e.file.original);var i="";a&&(i=a.key);t.push({filename:e.file.filename,displayName:e.file.displayName+" Copy",folder:e.file.folder,type:e.file.type,allowDownloads:e.file.allowDownloads,allowComments:e.file.allowComments,uploadedBy:i,managers:Object(be.k)(e.file.managers),groups:Object(be.k)(e.file.groups),ancestors:Object(be.k)(e.file.ancestors),url:e.file.url,original:n})}():"sharefile"===t.target.id&&F(!0),s({mouseX:null,mouseY:null}),w(!1)},se=function(e){y(e.target.value)},oe=function(t){return function(){(O(!1),"OK"===t)?W&&(D.b.database().ref("files").child(e.file.key).update({displayName:x}),e.file.displayName=x):y(e.file.displayName)}},le=function(e){return function(){u(!1),"OK"===e&&W&&function(){de.apply(this,arguments)}()}};function de(){return(de=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:R.forEach((function(t){t.file===e.file.key&&D.b.database().ref("comments").child(t.key).update({deleted:!0})})),P.forEach((function(t){t.file===e.file.key&&D.b.database().ref("notifications").child(t.key).remove()})),A.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t.key===e.file.key?n=!0:a.push(t.key)})),n){var i=D.b.database().ref("events").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),L.forEach((function(t){var a=[],n=!1;if(t.files.forEach((function(t){t===e.file.key?n=!0:a.push(t)})),n){var i=D.b.database().ref("users").child(t.key),r={};a.forEach((function(e){r[e]=!0})),i.update({files:r})}})),D.b.database().ref("files").child(e.file.key).remove(),e.showStatusMessage("File deleted successfully","success");case 7:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ue(){F(!1)}return Object(G.jsx)(on.b,{draggableId:e.file.key,index:e.index,isDragDisabled:"Player"===a.role||"FAW Player"===a.role||"Club Player"===a.role||"Coach Ed Student"===a.role||"FAW Coach Ed Student"===a.role||"Club Coach Ed Student"===a.role||"FAW Parent"===a.role||"Club Parent"===a.role||"Referee"===a.role,children:function(a){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)(Object(at.a)({},a.draggableProps),a.dragHandleProps),{},{className:t.container,ref:a.innerRef,onContextMenu:re,children:[Object(G.jsxs)(Ke.a,{onClick:te,className:t.listItem,style:C?{border:"2px solid rgb(0, 149, 61)"}:{},children:[Object(G.jsx)(Qe.a,{variant:"rounded",className:t.thumbnail,children:Object(G.jsx)(xs.a,{})}),Object(G.jsx)("p",{className:t.label,children:e.file.displayName})]}),Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:ce,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[z&&X&&Object(G.jsx)(Xi.a,{id:"sharefile",onClick:ce,children:"Share to Hub"}),Object(G.jsx)(Xi.a,{id:"renamefile",onClick:ce,children:"Rename"}),Object(G.jsx)(Xi.a,{id:"duplicatefile",onClick:ce,children:"Duplicate"}),Object(G.jsx)(Xi.a,{id:"deletefile",onClick:ce,children:"Delete"})]})}),Object(G.jsxs)(dt.a,{open:f,onClose:oe,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Rename File"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a new name for the file."}),Object(G.jsx)(nt.a,{value:x,onChange:se,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:oe("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:oe("OK"),color:"primary",children:"OK"})]})]}),Object(G.jsxs)(dt.a,{open:d,onClose:le,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"Delete Link"}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:"Are you sure you want to delete this link?"})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:le("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:le("OK"),color:"primary",children:"OK"})]})]}),T&&Object(G.jsx)(Dr,{open:T,onClose:ue,file:e.file}),$&&Object(G.jsx)(os,{open:$,onClose:ae,fileKey:e.file.key,fileName:e.file.displayName,fileType:"Link"})]}))}})}var ks=Object(O.a)((function(e){return{column:{overflowY:"scroll",maxHeight:"80vh",position:"relative"},columnTitle:{marginTop:10,marginBottom:10,marginRight:5,marginLeft:10,padding:0,textAlign:"left",cursor:"pointer",fontSize:18,overflowWrap:"anywhere",width:"99%",minWidth:"99%",height:25,maxHeight:25,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:1,overflow:"hidden"},addButton:{margin:"0 auto",cursor:"pointer",marginTop:11,display:"flex"},titleRowPadding:{margin:0,padding:0}}}));function Cs(e){var t=ks(),a=Object(o.e)(),i=Object(n.useState)({mouseX:null,mouseY:null}),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(0),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(0),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(0),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(0),C=Object(m.a)(k,2),w=C[0],S=C[1],E=Object(n.useState)(0),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(0),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useContext)(h.d).currentUserData,U=Object(n.useContext)(h.b),W=U.files,M=U.folders,H=U.groups,Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(!1),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(""),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!0),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1];function ce(t){e.column.selectedFolderIndex=t,e.handleFolderSelect(e.index,t)}function se(t){var n=!0;if(M.forEach((function(e){e.parent===t.key&&(n=!1)})),W.forEach((function(e){e.folder===t.key&&(n=!1)})),n){var i=D.b.database().ref("folders").child(t.key),r=e.column.folders[e.column.selectedFolderIndex];r&&r.key===t.key&&a.push("/files/".concat(r.parent)),i.remove(),e.showStatusMessage("Folder deleted successfully","success")}else e.showStatusMessage("Can't delete folders that contain subfolders or files","error")}function oe(e){s({mouseX:e.clientX-2,mouseY:e.clientY-2})}Object(n.useEffect)((function(){j(window.innerHeight-145),p(e.column.folders.length);var t=0,a=0,n=0,i=0;if(e.column.files&&(e.column.files.forEach((function(e){e.type.includes("video")?t++:e.type.includes("audio")?i++:e.type.includes("image")?n++:"application/pdf"===e.type&&a++})),v(t),L(i),B(n),S(a)),e.column.folder&&"root"!==e.column.folder.id&&(e.column.folder&&e.column.folder.managers&&(e.column.folder.managers.includes(I.key)||"System Digital Manager"===I.role)&&q(!0),I&&I.permissions&&e.column.folder.users&&I.permissions.uploadEditOwnVideo))if(e.column.folder.users.includes(I.key))q(!0);else{var r=M.filter((function(t){return t.key===e.column.folder.parent}))[0];r&&r.users.includes(I.key)&&q(!0),e.column.folder.ancestors.forEach((function(e){var t=M.filter((function(t){return t.key===e}))[0];t&&t.users.includes(I.key)&&q(!0)}))}"faves_fggh2973jgbvbiu"===e.column.id&&(q(!1),I.faveFiles.forEach((function(t){var a=W.filter((function(e){return e.key===t}))[0];a&&Object(be.o)(a,H,I)&&0===e.column.files.filter((function(e){return e.key===t})).length&&e.column.files.push(a)}))),!0===e.embedded&&(re(!1),q(!1)),window.addEventListener("resize",(function(){j(window.innerHeight-145)}))}),[e,I]);var le=function(t){if("newfolder"===t.target.id)te(""),Q(!0);else if("newfile"===t.target.id){var n=e.column.folder;n&&a.push({pathname:"/upload/",folder:n})}else if("newlink"===t.target.id){var i=e.column.folder;i&&a.push({pathname:"/addlink/",folder:i})}s({mouseX:null,mouseY:null})},de=function(t){return function(){if("OK"===t){if(""!==ee){var a=e.column.folder;if(a){var n=Object(be.k)(a.managers),i=Object(be.k)(a.ancestors);i[a.id]=!0;var r="";I&&(r=I.key),D.b.database().ref("folders").child(Object(be.m)(18)).set({name:ee,parent:a.id,createdBy:r,managers:n,ancestors:i})}Q(!1)}}else Q(!1)}},ue=function(e){te(e.target.value)};return Object(G.jsx)(on.c,{droppableId:e.column.id,children:function(a,n){return Object(G.jsxs)("div",Object(at.a)(Object(at.a)({className:t.column,ref:a.innerRef},a.droppableProps),{},{style:n.isDraggingOver?{minHeight:u,border:"2px solid rgb(0, 149, 61)",color:"rgba(0,0,0,0.5)"}:{minHeight:u,borderRight:"1px solid lightgrey"},children:[Object(G.jsxs)(Mt.a,{className:t.titleRowPadding,children:[Object(G.jsx)(Ht.a,{xs:9,sm:10,md:10,lg:11,xl:11,xxl:11,className:t.titleRowPadding,children:Object(G.jsx)("span",{className:t.columnTitle,children:e.column.name})}),Object(G.jsx)(Ht.a,{xs:3,sm:2,md:2,lg:1,xl:1,xxl:1,className:t.titleRowPadding,children:Object(G.jsx)(na.a,{color:"primary","aria-label":"add",className:t.addButton,onClick:oe,disabled:!V,style:V?{}:{visibility:"hidden"}})})]}),Object(G.jsx)(xe.a,{}),e.column.folders.map((function(t,a){return Object(G.jsx)(Er,{embedded:e.embedded,folder:t,index:a,handleClick:ce,deleteFolder:se,showStatusMessage:e.showStatusMessage,selectedColumn:e.selectedColumnIndex===e.index,unselected:e.column.selectedFolderIndex===a,green:e.column.selectedFolderIndex===a&&e.selectedColumnIndex===e.index,grey:e.column.selectedFolderIndex===a&&e.selectedColumnIndex!==e.index&&e.selectedColumnIndex>=e.index,white:e.column.selectedFolderIndex!==a||e.selectedColumnIndex<e.index},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("video")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(js,{embedded:e.embedded,handleFileSelect:e.handleFileSelect,file:t,folder:e.column.folder,index:a+O,showStatusMessage:e.showStatusMessage},t.key)})),e.column.files&&e.column.files.filter((function(e){return"application/pdf"===e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(ds,{embedded:e.embedded,handleFileSelect:e.handleFileSelect,file:t,folder:e.column.folder,index:a+O+y,showStatusMessage:e.showStatusMessage},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("image")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(fs,{embedded:e.embedded,handleFileSelect:e.handleFileSelect,file:t,folder:e.column.folder,index:a+O+y+w,showStatusMessage:e.showStatusMessage},t.key)})),e.column.files&&e.column.files.filter((function(e){return e.type.includes("audio")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(ms,{embedded:e.embedded,handleFileSelect:e.handleFileSelect,file:t,folder:e.column.folder,index:a+O+y+w+F,showStatusMessage:e.showStatusMessage},t.key)})),ie&&e.column.files&&e.column.files.filter((function(e){return e.type.includes("link")})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(vs,{file:t,folder:e.column.folder,index:a+O+y+w+F,showStatusMessage:e.showStatusMessage},t.key)})),e.column.files&&e.column.files.filter((function(e){return!e.type.includes("video")&&!e.type.includes("audio")&&!e.type.includes("image")&&!e.type.includes("link")&&"application/pdf"!==e.type})).sort((function(e,t){return e.displayName>t.displayName?1:e.displayName<t.displayName?-1:0})).map((function(t,a){return Object(G.jsx)(ps,{embedded:e.embedded,handleFileSelect:e.handleFileSelect,file:t,folder:e.column.folder,index:a+O+y+w+F+A,showStatusMessage:e.showStatusMessage},t.key)})),a.placeholder,ie&&Object(G.jsx)(N.a,{keepMounted:!0,open:null!==c.mouseY,onClose:le,anchorReference:"anchorPosition",anchorPosition:null!==c.mouseY&&null!==c.mouseX?{top:c.mouseY,left:c.mouseX}:void 0,children:Object(G.jsxs)("div",{children:[Object(G.jsx)(Xi.a,{id:"newfolder",onClick:le,children:"Add Folder"}),Object(G.jsx)(Xi.a,{id:"newfile",onClick:le,children:"Add Files"}),Object(G.jsx)(Xi.a,{id:"newlink",onClick:le,children:"Add Link"})]})}),ie&&Object(G.jsxs)(dt.a,{open:Z,onClose:de,"aria-labelledby":"form-dialog-title",children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:"New Folder"}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:"Enter a name for the new folder."}),Object(G.jsx)(nt.a,{value:ee,onChange:ue,autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:de("Cancel"),color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:de("OK"),color:"primary",children:"OK"})]})]})]}))}})}var ws=Object(O.a)((function(e){return{columnsContainer:{display:"flex",flexDirection:"row"},column:{minWidth:"24%",maxWidth:"24%"}}}));function Ns(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Ss(){var e=Object(o.e)(),t=Object(o.f)(),a=ws(),i=Object(n.useContext)(h.b),r=i.files,c=i.folders,s=i.groups,l=Object(n.useContext)(h.d).currentUserData,d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)([]),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)([]),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useRef)(),w=Object(n.useState)(!1),N=Object(m.a)(w,2),S=N[0],E=N[1],T=Object(n.useState)("error"),F=Object(m.a)(T,2),B=F[0],R=F[1],P=Object(n.useState)(""),A=Object(m.a)(P,2),L=A[0],I=A[1];function U(e,t){var a=e.parentNode;void 0!==a&&void 0!==a.id&&(t.push({id:a.id}),U(a,t))}function W(){var e=c.map((function(e){return{key:e.key,id:e.key,name:e.name,hub:e.hub,parent:e.parent,imageURL:e.imageURL,parentNode:{},folders:[],groups:e.groups,managers:e.managers,users:e.users,ancestors:e.ancestors,createdBy:e.createdBy}})),t=[];e.forEach((function(a){var n=!1;(a.managers.includes(l.key)||"System Digital Manager"===l.role||a.hub&&a.users.includes(l.key)||a.createdBy&&l&&a.createdBy===l.key)&&(n=!0),n&&(t.push(a),a.ancestors.forEach((function(a){var n=e.filter((function(e){return e.key===a}));n[0]&&t.push(n[0])})))})),r.forEach((function(a){Object(be.o)(a,s,l)&&a.ancestors.forEach((function(a){var n=e.filter((function(e){return e.key===a}));n[0]&&t.push(n[0])}))})),(t=Array.from(new Set(t))).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}));return t.unshift({id:"faves_fggh2973jgbvbiu",key:"faves_fggh2973jgbvbiu",name:"Favourites",parent:"Root",ancestors:[],folders:[],files:[],hub:!1,parentNode:{},users:[],managers:[]}),t}function M(e){for(var t=[],a=function(a){var n=e[a];if("Root"===n.parent)t.push(n);else{var i=e.filter((function(e){return e.key===n.parent}))[0];void 0!==i&&(i.folders.push(n),n.parentNode=i)}},n=0;n<e.length;n++)a(n);return t}function H(t,a){var n=p[t].folders[a];k(t);for(var i=[],c=0;c<t+1;c++)i.push(p[c]);i.push({id:n.id,name:n.name,folders:n.folders,folder:n,selectedFolderIndex:0}),i.forEach((function(e){var t=[];r.filter((function(t){return t.folder===e.id})).forEach((function(e){Object(be.o)(e,s,l)&&t.push(e)})),e.files=t})),e.push("/files/".concat(n.id)),i.push({id:Object(be.m)(15),name:"",folders:[],selectedFolderIndex:0}),g(i),C.current.scrollToRight()}Object(n.useEffect)((function(){var a=D.b.auth().onAuthStateChanged((function(a){a||e.replace("/signin?url="+t.pathname)}));if(console.log("FinderPage useEffect"),l){var n=W(),i=M(n),c=t.pathname.replace("/files/","");if("/files"===c){g([{id:"Root",name:"Everything",folders:i,folder:{name:"Root",id:"root"}}])}else{var o=W(),d=M(o),u=o.filter((function(e){return e.id===c}))[0];if(u){var j=[{id:"Root",name:"Everything",folders:d,folder:{name:"Root",id:"root"}}],f=[];U(u,f),f.reverse().forEach((function(e){var t=o.filter((function(t){return t.id===e.id}))[0];t&&j.push({id:t.id,name:t.name,folders:t.folders,folder:t})})),j.push({id:u.id,name:u.name,folders:u.folders,folder:u}),j.forEach((function(e){var t=[];r.filter((function(t){return t.folder===e.id})).forEach((function(e){Object(be.o)(e,s,l)&&t.push(e)})),e.files=t})),j.forEach((function(e){e.folders.forEach((function(t,a){(u.ancestors.includes(t.id)||u.id===t.id||u.parent===t.id)&&(e.selectedFolderIndex=a)}))})),k(j.length-2),g(j),C.current.scrollToRight()}}b(n)}return function(){return a()}}),[c,r,l]);var K=function(e,t){"clickaway"!==t&&E(!1)};function Y(e,t){R(t),I(e),E(!0)}return Object(G.jsxs)("div",{style:{paddingLeft:0,paddingRight:0,marginLeft:0,marginRight:0,paddingTop:15,paddingBottom:65,"&::WebkitScrollbar":{display:"none"}},children:[Object(G.jsx)(ln.Scrollbars,{className:a.scrollbar,style:{width:window.innerWidth,height:window.innerHeight-145},ref:C,children:Object(G.jsx)(on.a,{onDragEnd:function(e){var t=p.filter((function(t){return t.id===e.source.droppableId}))[0];t&&(t.folders.filter((function(t){return t.key===e.draggableId})).length>0?function(e){var t=e.destination,a=e.source;if(!t)return;var n=e.draggableId,i=a.droppableId,c=t.droppableId;if(c===i&&t.index===a.index)return;if("Root"===c)return void Y("Can't move a folder here","error");if(n===c)return void Y("Can't move a folder into itself","error");var s=j.filter((function(e){return e.key===c}))[0];if(!s)return;if(!s.managers.includes(l.key)&&"System Digital Manager"!==l.role)return void Y("Cannot move the folder here, you are not a manager of the destination folder","error");var o=j.filter((function(e){return e.key===i}))[0],d=j.filter((function(e){return e.key===n}))[0];if(!d.managers.includes(l.key)&&"System Digital Manager"!==l.role)return void Y("You are not a manager of this folder","error");if(d.hub&&!s.hub)return void Y("Can't move a hub into a folder","error");if(s&&o&&d){d.parent=s.key,d.ancestors=Object(Jt.a)(s.ancestors),d.managers=Object(Jt.a)(s.managers);var u=j.filter((function(e){return e.ancestors.includes(d.key)})).sort((function(e,t){return e.ancestors.length>t.ancestors.length?1:e.ancestors.length<t.ancestors.length?-1:0}));u.forEach((function(e,t){if(0===t)e.ancestors=[].concat(Object(Jt.a)(d.ancestors),[d.parent,e.parent]),e.managers=d.managers;else if(t>0){var a=u[t-1];if(a)if(e.parent===a.parent)e.ancestors=Object(Jt.a)(a.ancestors),e.managers=a.managers;else{var n=u.filter((function(t){return t.key===e.parent}))[0];n&&(e.ancestors=[].concat(Object(Jt.a)(n.ancestors),[e.parent]),e.managers=n.managers)}}}));var b=D.b.database().ref("folders");u.forEach((function(e){b.child(e.id).update({ancestors:Object(be.k)(e.ancestors),managers:Object(be.k)(e.managers)}),r.filter((function(t){return t.folder===e.id})).forEach((function(t){t.ancestors=[].concat(Object(Jt.a)(e.ancestors),[e.key]),D.b.database().ref("files").child(t.key).update({ancestors:Object(be.k)(t.ancestors),managers:Object(be.k)(e.managers)})}))}));var f=Object(be.k)(s.ancestors);f[s.key]=!0,b.child(n).update({parent:s.key,ancestors:f,managers:Object(be.k)(s.managers)}),r.filter((function(e){return e.folder===n})).forEach((function(e){e.ancestors=[].concat(Object(Jt.a)(s.ancestors),[s.key,d.key]),D.b.database().ref("files").child(e.key).update({ancestors:Object(be.k)(e.ancestors),managers:Object(be.k)(s.managers)})}))}}(e):t.files.filter((function(t){return t.key===e.draggableId})).length>0&&function(e){var t=e.destination,a=e.source;if(!t)return;var n=t.droppableId,i=a.droppableId;if(n===i&&t.index===a.index)return;if("Root"===n)return void Y("Can't move a file here","error");var c=j.filter((function(e){return e.key===n}))[0];if(!c)return;if(!c.managers.includes(l.key)&&"System Digital Manager"!==l.role)return void Y("Cannot move the file here, you are not a manager of the destination folder","error");var s=r.filter((function(t){return t.key===e.draggableId}))[0];if(!s.managers.includes(l.key)&&"System Digital Manager"!==l.role)return void Y("You are not a manager of this file","error");if(s&&c){var o=D.b.database().ref("files").child(s.key),d=Object(be.k)(c.ancestors);d[c.id]=!0,o.update({folder:c.id,ancestors:d,managers:Object(be.k)(c.managers)})}}(e))},children:Object(G.jsx)("div",{className:a.columnsContainer,children:p.map((function(e,t){return Object(G.jsx)("div",{className:a.column,children:Object(G.jsx)(Cs,{column:e,index:t,handleFolderSelect:H,selectedColumnIndex:v,showStatusMessage:Y},e.id)},e.id)}))})})}),Object(G.jsx)(st.a,{open:S,autoHideDuration:6e3,onClose:K,children:Object(G.jsx)(Ns,{onClose:K,severity:B,children:L})}),Object(G.jsx)($e,{})]})}var Es=a(12),Ts=a(1083),Fs=a(1077),Bs=Object(O.a)((function(e){return{event:Object(at.a)(Object(at.a)({},e.typography.bodyBold),{},{display:"block",textAlign:"center",margin:5,padding:5,width:250,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}}));function Ds(e){var t=Bs();return Object(G.jsx)(dt.a,{onClose:function(){e.onClose()},"aria-labelledby":"simple-dialog-title",open:e.open,children:e.events.map((function(a){return Object(G.jsx)(V.a,{color:"primary",className:t.event,label:a.name,onClick:e.handleEventClick(a),style:{backgroundColor:a.color}},a.key)}))})}var Rs=Object(O.a)((function(e){return{listContainer:{paddingBottom:125},eventChip:Object(at.a)(Object(at.a)({},e.typography.bodyBold),{},{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"})}}));function Ps(e){var t=Rs(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1];return Object(n.useEffect)((function(){var t=[];e.events.filter((function(e){return e.visible})).forEach((function(e){var a=t.filter((function(t){return P()(t.date).isSame(P()(e.date))}))[0];null!=a?a.events.push(e):t.push({date:e.date,events:[e]})})),t.sort((function(e,t){return P()(e.date).isAfter(P()(t.date))?1:-1})),c(t)}),[e]),Object(G.jsx)("div",{className:t.listContainer,children:r.map((function(a){return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(tc.a,{defaultExpanded:!0,children:[Object(G.jsx)(ac.a,{expandIcon:Object(G.jsx)(rc.a,{}),"aria-controls":"panel1a-content",id:"panel1a-header",children:Object(G.jsx)(x.a,{className:t.heading,children:P()(a.date).format("dddd, MMMM D, YYYY")})}),Object(G.jsx)(nc.a,{children:Object(G.jsx)(He.a,{children:a.events.map((function(a){return Object(G.jsx)(Ke.a,{children:Object(G.jsx)(V.a,{color:"primary",className:t.eventChip,label:a.name,onClick:e.handleEventClick&&e.handleEventClick(a),style:{backgroundColor:a.color}},a.key)})}))})})]})})}))})}var As=Object(O.a)((function(e){return{calendarContainer:{padding:10,paddingBottom:100},dropdownMenu:{margin:15,maxWidth:window.innerWidth-25}}}));function Ls(e){var t=e.children,a=e.value,n=e.index,i=Object(Es.a)(e,["children","value","index"]);return Object(G.jsx)("div",Object(at.a)(Object(at.a)({role:"tabpanel",hidden:a!==n,id:"simple-tabpanel-".concat(n),"aria-labelledby":"simple-tab-".concat(n)},i),{},{children:a===n&&Object(G.jsx)(Mn.a,{p:3,children:Object(G.jsx)(x.a,{children:t})})}))}function Is(){var e=As(),t=Object(o.e)(),a=Object(o.f)(),i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(!1),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(new Date),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)([]),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useContext)(h.d).currentUserData,K=Object(n.useContext)(h.b),Y=K.calendars,z=K.events,V=K.folders,q=Object(n.useState)([]),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(),ae=Object(m.a)(te,2),ne=ae[0],ie=ae[1],re=Object(n.useState)(0),ce=Object(m.a)(re,2),se=ce[0],oe=ce[1];Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||t.replace("/signin?url="+a.pathname)}));if(console.log("useEffect:CalendarPage"),H&&H.permissions){if(H.permissions.viewCalendar){L(!0);var n=[],i=[];Y.forEach((function(e){var t=!1;if(e.user===H.key)t=!0;else{var a=V.filter((function(t){return t.key===e.hub}))[0];a&&(a.users.includes(H.key)||a.managers.includes(H.key))&&(t=!0)}t&&(n.push(e),z.filter((function(t){return t.calendar===e.key})).forEach((function(t){i.push(t),t.visible=!$||$.filter((function(t){return t.key===e.key})).length>0})))})),Z(i),$||(ee(n),ie(n))}else L(!1);H.permissions.editCalendar&&M(!0)}return function(){return e()}}),[H,t,z,Y,V]);var le=function(e){return function(){N(e),j(!0)}};function de(e){return $.filter((function(t){return t.key===e.key})).length>0}return Object(G.jsxs)(G.Fragment,{children:[A&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(pt.a,{square:!0,children:Object(G.jsxs)(Ts.a,{value:se,indicatorColor:"primary",textColor:"primary",onChange:function(e,t){oe(t)},centered:!0,children:[Object(G.jsx)(Fs.a,{label:"Calendar View"}),Object(G.jsx)(Fs.a,{label:"List View"})]})}),Object(G.jsx)(Ft.a,{className:e.dropdownMenu,children:Object(G.jsx)(Bt.a,{multiple:!0,value:$,onChange:function(e){var t=[],a=[];e.target.value.forEach((function(e){var t=ne.filter((function(t){return e.key===t.key}))[0];t&&a.push(t)})),a.forEach((function(e){z.filter((function(t){return t.calendar===e.key})).forEach((function(e){e.visible=!0,t.push(e)}))})),Z(t),ee(a)},input:Object(G.jsx)(si.a,{}),renderValue:function(e){return e.map((function(e){return e.name})).join(", ")},children:ne.map((function(e){return Object(G.jsxs)(Xi.a,{value:e,children:[Object(G.jsx)(Lt.a,{checked:de(e),color:"primary"}),Object(G.jsx)(ze.a,{primary:e.name})]},e.key)}))})}),Object(G.jsxs)(Ls,{value:se,index:0,children:[Object(G.jsx)("div",{className:e.calendarContainer,children:Object(G.jsx)(Ni,{handleEventClick:le,handleDateSelect:function(e){v(e)},handleMoreEventsClick:function(e){return function(){F(e),p(!0)}},events:X.filter((function(e){return e.visible}))})}),W&&Object(G.jsx)(Ct,{onClick:function(){s(!0)}})]}),Object(G.jsx)(Ls,{value:se,index:1,children:Object(G.jsx)(Ps,{handleEventClick:le,events:X})}),Object(G.jsx)(ki,{open:c,onClose:function(){s(!1)},date:y,addEvent:function(e,t,a){var n=D.b.database().ref("events"),i="-"+Object(be.m)(20);n.child(i).set({date:P()(y).toString(),name:e,calendar:t.key,color:a.replace("#","")}),D.b.database().ref("calendars/"+t.key+"/events/").child(i).set(!0),s(!1)},calendars:ne}),Object(G.jsx)(Cc,{open:u,onClose:function(){j(!1)},event:w}),Object(G.jsx)(Ds,{open:O,onClose:function(){p(!1)},events:T,handleEventClick:le})]}),!1===A&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{})]})}var Us=a(200),Ws=Object(O.a)((function(e){return{root:{cursor:"pointer",paddingBottom:70,paddingTop:0},addButton:{position:"fixed",zIndex:1,top:"auto",bottom:70,left:10}}}));function Ms(e){var t=Ws();return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(He.a,{className:t.root,children:e.conversations.filter((function(e){return!1===e.deleted})).map((function(t,a){return Object(G.jsxs)("div",{onClick:(n=t,function(){e.handleSelect(n)}),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",selected:e.selected&&e.selected.key===t.key,children:[Object(G.jsx)(gt.a,{children:1===t.otherUsers.length?Object(G.jsx)(k.a,{badgeContent:t.unreadMessagesCount,color:"secondary",children:Object(G.jsx)(B.a,{userOrHub:t.otherUsers[0],path:"users",variant:"circular"})}):Object(G.jsx)(k.a,{badgeContent:t.unreadMessagesCount,color:"secondary",children:Object(G.jsx)(Us.a,{conversation:t})})}),Object(G.jsx)(ze.a,{primary:t.title,secondary:Object(G.jsx)(G.Fragment,{children:t.messages.length>0&&(t.messages[t.messages.length-1].message.length<22?t.messages[t.messages.length-1].message:t.messages[t.messages.length-1].message.substring(0,22)+"...")})})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},t.key);var n}))}),e.canAdd&&Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.addButton,onClick:e.handleAddClick,children:Object(G.jsx)(vt.a,{})})]})}var Hs=a(313),Ks=a.n(Hs),Ys=Object(O.a)((function(e){return{dateText:{color:"rgb(140, 140, 140)",paddingTop:15},moreButton:{width:30,height:30}}}));function zs(e){var t=Ys(),a=Object(n.useState)(Date.now()),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],j=Object(n.useContext)(h.b).users,b=Object(n.useState)(),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(null),S=Object(m.a)(C,2),E=S[0],T=S[1],F=Object(n.useState)(!1),D=Object(m.a)(F,2),R=D[0],A=D[1],L=Object(n.useContext)(h.d).currentUserData;Object(n.useEffect)((function(){var t=setInterval((function(){return c(Date.now())}),5e3),a=P()(e.message.date),n=P()();if(!e.message.user.fullName){var i=e.message.user;p(j.filter((function(e){return e.key===i}))[0])}var r=[{interval:"years",value:n.diff(a,"years")},{interval:"months",value:n.diff(a,"months")},{interval:"weeks",value:n.diff(a,"weeks")},{interval:"days",value:n.diff(a,"days")},{interval:"hours",value:n.diff(a,"hours")},{interval:"minutes",value:n.diff(a,"minutes")}].filter((function(e){return e.value>0}));if(0===r.length)e.message.dateString="a moment ago",d(e.message.dateString);else{var s=r[0];1===s.value?(e.message.dateString=s.value+" "+s.interval.replace("s","")+" ago ",d(e.message.dateString)):(e.message.dateString=s.value+" "+s.interval+" ago ",d(e.message.dateString))}return function(){clearInterval(t)}}),[e.message,r,j]);var I=function(){T(null),A(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Wt.a,{fluid:!0,onMouseEnter:function(){L&&e.message.user===L.key&&k(!0)},onMouseLeave:function(){k(!1)},children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{children:Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(Ke.a,{alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:O,path:"users",size:"small"})}),Object(G.jsx)(ze.a,{primary:Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(x.a,{component:"span",variant:"body2",className:t.inline,color:"textPrimary",children:e.message.fullName}),Object(G.jsx)(x.a,{component:"span",variant:"body2",className:t.inline,color:"textSecondary",children:" "+l})]}),secondary:e.message.message})]})})}),!e.hideMenu&&Object(G.jsx)(w.a,{className:t.moreButton,hidden:!v&&!R&&!u.isMobile,onClick:function(e){A(!0),T(e.target)},children:Object(G.jsx)(Xr.a,{})})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.message.key),Object(G.jsx)(N.a,{id:"comment-menu",anchorEl:E,open:Boolean(E),onClose:I,children:Object(G.jsx)(Xi.a,{onClick:function(){yc.a.database().ref("conversations").child(e.conversation.key).child("messages").child(e.message.key).update({deleted:!0}),I()},children:"Delete Message"})})]})}var Vs=Object(O.a)((function(e){return{title:{marginLeft:15},topLine:{paddingTop:10,paddingLeft:10,paddingBottom:10},headingText:{paddingTop:4},messagesContainer:{marginTop:45,paddingBottom:110},messageInputContainer:{position:"fixed",display:"flex",top:"auto",bottom:0,width:"100%",background:"rgb(240, 240, 240)",paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5},inputTextField:{marginLeft:10},inputAvatar:{marginTop:15},messageInput:{marginTop:5,marginLeft:5},cancelButton:{flexGrow:1,minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:0,marginBottom:5},commentButton:{minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:5,marginRight:14,marginBottom:5}}})),Gs=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"left",ref:t},e))})),qs=function(){var e=Object(n.useRef)();return Object(n.useEffect)((function(){return e.current.scrollIntoView()})),Object(G.jsx)("div",{ref:e})};function _s(e){var t=Vs(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(!1),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useContext)(h.d).currentUserData,j=Object(n.useState)(),b=Object(m.a)(j,2),f=b[0],O=b[1];return Object(n.useEffect)((function(){e.conversation&&(!1===e.conversation.deleted&&O(e.conversation),e.conversation.messages.forEach((function(t){if(!t.read){var a=D.b.database().ref("conversations").child(e.conversation.key).child("messages").child(t.key),n=Object(be.k)(t.readBy);n[u.key]=!0,a.update({readBy:n}),t.readBy.push(u.key)}})))}),[e,u]),Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:Gs,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:e.onClose,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),f&&1===f.otherUsers.length?Object(G.jsx)(B.a,{userOrHub:f.otherUsers[0],path:"users",variant:"circular"}):Object(G.jsx)(Us.a,{conversation:f}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:f&&f.title})]})}),f&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.messagesContainer,children:Object(G.jsx)(He.a,{children:f.messages.filter((function(e){return!1===e.deleted})).sort((function(e,t){return P()(e.date)>P()(t.date)?1:P()(t.date)>P()(e.date)?-1:0})).map((function(e){return Object(G.jsx)(zs,{conversation:f,message:e,hideMenu:!0},e.key)}))})}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.messageInputContainer,children:[Object(G.jsx)(B.a,{userOrHub:f.user,size:e.avatarSize,path:"users"}),Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Add a message...",multiline:!0,value:r,fullWidth:!0,onChange:function(e){c(e.target.value)},className:t.inputTextField}),Object(G.jsx)(w.a,{onClick:function(){if(f){var e=D.b.database().ref("conversations/"+f.key+"/messages").push(),t={id:e.key,message:r,date:P()().toString(),user:f.user.key,fullName:f.user.fullName,deleted:!1};e.set(t),t.readBy=[],t.key=t.id,D.b.database().ref("conversations").child(f.key).update({lastMessage:P()().toString()}),c(""),f.messages.push(t),O(f)}},children:Object(G.jsx)(Ks.a,{})})]}),l&&Object(G.jsx)(ya,{title:"Delete Conversation",message:"Are you sure you want to delete this conversation?",open:l,onClose:function(e){!0===e&&u&&f&&(D.b.database().ref("conversations").child(f.key).update({deleted:!0}),f.deleted=!0,O(void 0)),d(!1)}})]}),Object(G.jsx)(qs,{})]})}var Xs=Object(O.a)((function(e){return{root:{cursor:"pointer",paddingBottom:140},addButton:{position:"fixed",zIndex:1,top:"auto",bottom:70,marginLeft:15}}}));function Zs(e){var t=Xs(),a=Object(n.useState)(!1),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(),o=Object(m.a)(s,2),l=o[0],d=o[1];return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(He.a,{className:t.root,children:e.conversations.filter((function(e){return!1===e.deleted})).map((function(e,t){return Object(G.jsxs)("div",{onClick:(a=e,function(){c(!0),d(a)}),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:1===e.otherUsers.length?Object(G.jsx)(k.a,{badgeContent:e.unreadMessagesCount,color:"secondary",children:Object(G.jsx)(B.a,{userOrHub:e.otherUsers[0],path:"users",variant:"circular"})}):Object(G.jsx)(k.a,{badgeContent:e.unreadMessagesCount,color:"secondary",children:Object(G.jsx)(Us.a,{conversation:e})})}),Object(G.jsx)(ze.a,{primary:e.title,secondary:Object(G.jsx)(G.Fragment,{children:e.messages.length>0&&(e.messages[e.messages.length-1].message.length<22?e.messages[e.messages.length-1].message:e.messages[e.messages.length-1].message.substring(0,22)+"...")})})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key);var a}))}),e.canAdd&&Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.addButton,onClick:e.handleAddClick,children:Object(G.jsx)(vt.a,{})}),Object(G.jsx)(_s,{open:r,onClose:function(){c(!1)},conversation:l}),Object(G.jsx)($e,{})]})}var Qs=Object(O.a)((function(e){return{topLine:{background:"rgb(240, 240, 240)",bottom:"auto",top:64,position:"fixed",zIndex:1,width:"83%",height:60},topLineContainer:{marginLeft:15,paddingTop:10},headingText:{paddingTop:4},messagesContainer:{paddingBottom:110},messageInputContainer:{position:"fixed",display:"flex",top:"auto",bottom:64,width:"83%",background:"rgb(240, 240, 240)",paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5},messageInputRow:{marginLeft:0,paddingTop:2.5,paddingBottom:5},inputTextField:{marginLeft:10,width:"100%"},deleteIcon:{marginRight:18}}})),Js=function(){var e=Object(n.useRef)();return Object(n.useEffect)((function(){return e.current.scrollIntoView()})),Object(G.jsx)("div",{ref:e})};function $s(e){var t=Qs(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(!1),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useContext)(h.d).currentUserData,p=Object(n.useState)(),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],N=k[1];return Object(n.useEffect)((function(){e.conversation&&!1===e.conversation.deleted&&(y(e.conversation),d(e.conversation.messages.sort((function(e,t){return P()(e.date)>P()(t.date)?1:P()(t.date)>P()(e.date)?-1:0}))),e.conversation.messages.forEach((function(t){if(!t.read){var a=D.b.database().ref("conversations").child(e.conversation.key).child("messages").child(t.key),n=Object(be.k)(t.readBy);n[O.key]=!0,a.update({readBy:n}),t.readBy.push(O.key)}})),e.conversation.user&&O&&(e.conversation.user.key===O.key?N(!0):N(!1)))}),[e,O]),Object(G.jsx)("div",{style:{height:"100%"},children:x&&Object(G.jsxs)("div",{style:{height:"100%"},children:[Object(G.jsxs)("div",{className:t.topLine,children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.topLineContainer,children:Object(G.jsxs)(Mt.a,{children:[1===x.otherUsers.length?Object(G.jsx)(B.a,{userOrHub:x.otherUsers[0],path:"users",variant:"circular"}):Object(G.jsx)(Us.a,{conversation:x}),Object(G.jsx)(Ht.a,{children:Object(G.jsx)("h3",{className:t.headingText,children:x.title})}),C&&Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){f(!0)},children:Object(G.jsx)(Ut.a,{})})]})}),Object(G.jsx)(xe.a,{})]}),Object(G.jsx)("div",{className:t.messagesContainer,style:{paddingTop:45},children:Object(G.jsx)(He.a,{children:l.filter((function(e){return!1===e.deleted})).map((function(e){return Object(G.jsx)(zs,{conversation:x,message:e,hideMenu:!0},e.key)}))})}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.messageInputContainer,children:[Object(G.jsx)(B.a,{userOrHub:x.user,size:e.avatarSize,path:"users"}),Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Add a message...",multiline:!0,value:r,fullWidth:!0,onChange:function(e){c(e.target.value)},className:t.inputTextField}),Object(G.jsx)(w.a,{onClick:function(){if(x&&""!==r){var e=D.b.database().ref("conversations/"+x.key+"/messages").push(),t={id:e.key,message:r,date:P()().toString(),user:x.user.key,fullName:x.user.fullName,deleted:!1};e.set(t),t.readBy=[],t.key=t.id,D.b.database().ref("conversations").child(x.key).update({lastMessage:P()().toString()}),c(""),x.messages.push(t),y(x)}},children:Object(G.jsx)(Ks.a,{})})]}),Object(G.jsx)(Js,{}),b&&Object(G.jsx)(ya,{title:"Delete Conversation",message:"Are you sure you want to delete this conversation?",open:b,onClose:function(e){!0===e&&O&&x&&C&&(D.b.database().ref("conversations").child(x.key).update({deleted:!0}),x.deleted=!0,y(void 0)),f(!1)}})]})})}var eo=a(579),to=a.n(eo),ao=Object(O.a)((function(e){return{root:{textAlign:"center",paddingLeft:10},title:{marginTop:10},textField:{marginTop:10,marginLeft:20,marginRight:20},button:{margin:20}}}));function no(e){var t=ao(),a=Object(n.useState)({key:Object(be.m)(19)}),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(!1),o=Object(m.a)(s,2),l=o[0],d=o[1];function u(){return(u=Object(ie.a)(ne.a.mark((function t(){return ne.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""===r.title){t.next=4;break}return d(!0),t.next=4,j().then((function(t){e.createGroup(r,t),d(!1)}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function j(){return new Promise((function(e,t){var a=D.b.storage();r.avatarEditor?r.avatarEditor.getImageScaledToCanvas().toBlob((function(n){var i=a.ref().child("avatars/conversations/"+r.key+"/avatar.png");i.put(n).then((function(t){console.log("Upload Successful"),r.avatar=null,i.getDownloadURL().then((function(t){e(t)}))})).catch((function(e){var a=e.code,n=e.message;console.log(a+":"+n),d(!1),t()}))})):e()}))}return Object(G.jsxs)(dt.a,{onClose:function(){e.onClose()},open:e.open,className:t.root,children:[Object(G.jsx)("h4",{className:t.title,children:"New Group"}),Object(G.jsx)(Vt.a,{recipient:r,path:"conversations"}),Object(G.jsx)(nt.a,{className:t.textField,id:"outlined-basic",label:"Name",variant:"outlined",value:r.title,onChange:function(e){c((function(t){return Object(at.a)(Object(at.a)({},t),{},{title:e.target.value})}))}}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){return u.apply(this,arguments)},children:"Create Group"}),l&&Object(G.jsx)(ut.a,{})]})}var io=Object(O.a)((function(e){return{list:{width:"100%"},appBar:{position:"relative"},container:{height:"100%"},chip:{marginLeft:15,marginTop:15},nameTextField:{marginLeft:70,marginRight:15,marginTop:5},title:{flexGrow:1}}})),ro=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function co(e){var t=io(),a=Object(n.useContext)(h.b),i=a.users,r=a.folders,c=Object(n.useState)([]),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(""),O=Object(m.a)(f,2),y=O[0],v=O[1],k=Object(n.useState)(!1),C=Object(m.a)(k,2),N=C[0],S=C[1],E=Object(n.useContext)(h.d).currentUserData;Object(n.useEffect)((function(){if(E){var e=[];r.filter((function(e){return e.hub})).forEach((function(t){t.users&&t.users.includes(E.key)&&(t.managers.filter((function(e){return e!==E.key})).forEach((function(t){e.push(t)})),t.users.filter((function(e){return e!==E.key})).forEach((function(t){e.push(t)}))),t.managers&&t.managers.includes(E.key)&&(t.managers.filter((function(e){return e!==E.key})).forEach((function(t){e.push(t)})),t.users.filter((function(e){return e!==E.key})).forEach((function(t){e.push(t)})))}));var t=[];Object(be.u)(e).forEach((function(e){var a=i.filter((function(t){return t.key===e}))[0];a&&t.push(a)})),l(t)}}),[E,i,r]);var T=function(e){return function(){var t=Object(Jt.a)(j);t.push(e),b(t),v("")}},F=function(e){return function(){var t=j.filter((function(t){return t.key!==e.key}));b(t)}},R=function(t){v(""),b([]),e.onClose(t)};return Object(G.jsxs)(dt.a,{fullScreen:!0,onClose:R,open:e.open,TransitionComponent:ro,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:R,"aria-label":"close",children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"New Conversation"}),Object(G.jsx)(w.a,{edge:"end",color:"inherit",onClick:function(){if(1===j.length){var e,t=D.b.database().ref().child("conversations"),a=j[0].key,n={participants:(e={},Object(Ze.a)(e,E.key,!0),Object(Ze.a)(e,a,!0),e),lastMessage:P()().toString(),deleted:!1};t.push(n),R(!0)}else j.length>1&&S(!0)},className:t.menuButton,children:Object(G.jsx)(to.a,{})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:j.map((function(e){return Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:F(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:y,onChange:function(e){v(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:E&&o.filter((function(e){return e.key!==E.key&&0===j.filter((function(t){return t.key===e.key})).length})).filter((function(e){return e.fullName.includes(y)})).map((function(e){return Object(G.jsxs)("div",{onClick:T(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(L.a,{overflow:!0,children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})})}),Object(G.jsx)(ze.a,{primary:e.fullName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]}),Object(G.jsx)(no,{open:N,onClose:function(){S(!1)},createGroup:function(e,t){S(!1);var a=D.b.database().ref().child("conversations"),n=Object(Ze.a)({},E.key,!0);j.forEach((function(e){var t=e.key;n[t]=!0})),a.child(e.key).set({title:e.title,participants:n,imageURL:t,lastMessage:P()().toString(),deleted:!1}),R(!0)}})]})}var so=Object(O.a)((function(e){return{conversationList:{background:"rgb(230, 230, 230)"},conversationDetail:{background:"rgb(240, 240, 240)"},container:{marginTop:0,display:"flex",background:"red",height:window.innerHeight-125},fullHeightRow:{height:"100%"},list:{height:"100%",flex:2,backgroundColor:"rgb(230, 230, 230)",overflow:"scroll"},detail:{height:"100%",flex:10,backgroundColor:"rgb(240, 240, 240)",overflow:"scroll"},topBar:{height:100,marginLeft:500}}}));function oo(){var e=so(),t=Object(o.e)(),a=Object(o.f)(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useContext)(h.b),c=r.conversations,s=r.users,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(!1),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)(),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(),D=Object(m.a)(B,2),R=D[0],A=D[1];function L(){v(!0)}return Object(n.useEffect)((function(){var e=yc.a.auth().onAuthStateChanged((function(e){e||t.replace("/signin?url="+a.pathname)}));if(i){!0===i.permissions.openMessage?F(!0):F(!1),!0===i.permissions.personalMessage?A(!0):A(!1),console.log("Refreshing Conversations");var n=c.filter((function(e){return e.participants.filter((function(e){return e.key===i.key})).length>0}));n.forEach((function(e){e.user=i,e.otherUsers=[],e.participants.forEach((function(t){if(t.key!==i.key){var a=s.filter((function(e){return e.key===t.key}))[0];if(a)e.otherUsers.push(a),void 0===e.title&&(e.title=a.fullName);else{var n=Object(be.m)(19),r={key:n,uid:n,email:"",phone:"",firstName:"Deleted",lastName:"User",fullName:"Deleted User"};e.otherUsers.push(r),void 0===e.title&&(e.title=r.fullName)}}}));var t=0;e.deleted||e.messages&&e.messages.forEach((function(a){a.user!==i.key&&(a.readBy.includes(i.key)||a.deleted||t++,"Deleted User"===e.title&&(e.title=a.fullName))})),e.unreadMessagesCount=t,O&&e.key===O.key&&p(e)})),n.length>0&&(j(n.sort((function(e,t){return P()(e.lastMessage)<P()(t.lastMessage)?1:P()(t.lastMessage)<P()(e.lastMessage)?-1:0}))),O||p(n[0]))}return window.innerWidth<576?N(!0):N(!1),window.addEventListener("resize",(function(){window.innerWidth<576?N(!0):N(!1)})),function(){return e()}}),[c,s,i,O,t]),Object(G.jsxs)(G.Fragment,{children:[T&&Object(G.jsxs)("div",{style:{"&::-webkit-scrollbar":{display:"none"}},children:[w?Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Zs,{conversations:u,handleAddClick:L,canAdd:R})}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)("div",{className:e.container,style:{"&::-webkit-scrollbar":{display:"none"}},children:[Object(G.jsx)("div",{className:e.list,children:Object(G.jsx)(Ms,{conversations:u,handleSelect:function(e){p(e)},canAdd:R,handleAddClick:L,selected:O})}),Object(G.jsx)("div",{className:e.detail,children:Object(G.jsx)($s,{conversation:O})})]}),Object(G.jsx)($e,{})]}),R&&Object(G.jsx)(co,{open:y,onClose:function(e){e&&p(null),v(!1)}})]}),!1===T&&Object(G.jsx)(Nt,{})]})}var lo=Object(O.a)((function(e){return{container:{marginTop:10,marginLeft:15,marginRight:15},textField:{marginTop:10},button:{marginTop:15,marginRight:50,marginLeft:20,marginBottom:15}}}));function uo(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function jo(e){var t=lo(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(""),j=Object(m.a)(u,2),b=j[0],f=j[1],h=Object(n.useState)(!1),O=Object(m.a)(h,2),p=O[0],g=O[1],x=Object(n.useState)(""),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=function(e){"currentpassword"===e.target.id?c(e.target.value):"newpassword"===e.target.id?d(e.target.value):"confirmednewpassword"===e.target.id&&f(e.target.value)},T=function(e,t){"clickaway"!==t&&S(!1)};return Object(G.jsxs)(dt.a,{onClose:function(){c(""),d(""),f(""),S(!1),k(""),e.onClose()},open:e.open,children:[Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.textField,id:"currentpassword",label:"Current Password",type:"password",autoComplete:"current-password",variant:"outlined",value:r,onChange:E})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.textField,id:"newpassword",label:"New Password",type:"password",autoComplete:"new-password",variant:"outlined",value:l,onChange:E})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.textField,id:"confirmednewpassword",label:"Confirm New Password",type:"password",autoComplete:"new-password",variant:"outlined",value:b,onChange:E})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){var t=D.b.auth().currentUser;if(g(!0),t){var a=D.b.auth.EmailAuthProvider.credential(t.email,r);t.reauthenticateWithCredential(a).then((function(a){l===b?t.updatePassword(l).then((function(t){g(!1),e.onSuccess(),c(""),d(""),f(""),S(!1),k("")})).catch((function(e){g(!1),k(e.message),S(!0)})):(g(!1),k("New Passwords do not match"),S(!0))})).catch((function(e){c(""),d(""),f(""),k("Current Password is incorrect"),S(!0),g(!1)}))}},className:t.button,fullWidth:!0,children:"OK"})})]}),Object(G.jsx)(st.a,{open:N,autoHideDuration:6e3,onClose:T,children:Object(G.jsx)(uo,{onClose:T,severity:"error",children:v})}),p&&Object(G.jsx)(ut.a,{})]})}var bo=Object(O.a)((function(e){return{container:{marginTop:10,marginLeft:15,marginRight:15},textField:{marginTop:10},button:{marginTop:15,marginRight:50,marginLeft:20,marginBottom:15}}}));function fo(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function ho(e){var t=bo(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(!1),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(""),p=Object(m.a)(O,2),g=p[0],x=p[1],y=Object(n.useState)(!1),v=Object(m.a)(y,2),k=v[0],C=v[1],w=Object(n.useContext)(h.d).currentUserData,N=function(e){"currentpassword"===e.target.id?c(e.target.value):"email"===e.target.id&&d(e.target.value)},S=function(e,t){"clickaway"!==t&&C(!1)};return Object(G.jsxs)(dt.a,{onClose:function(){c(""),d(""),C(!1),x(""),e.onClose()},open:e.open,children:[Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.textField,id:"currentpassword",label:"Enter Your Password",type:"password",autoComplete:"current-password",variant:"outlined",value:r,onChange:N})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{className:t.textField,id:"email",label:"New Email",type:"email",autoComplete:"new-email",variant:"outlined",value:l,onChange:N})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){var t=D.b.auth().currentUser;if(f(!0),t){var a=D.b.auth.EmailAuthProvider.credential(t.email,r);t.reauthenticateWithCredential(a).then((function(a){t.updateEmail(l).then((function(t){f(!1),D.b.database().ref("users").child(w.key).update({email:l}).then((function(){e.onSuccess(),c(""),d(""),C(!1),x("")}))})).catch((function(e){f(!1),x(e.message),C(!0)}))})).catch((function(e){c(""),d(""),x("Password is incorrect"),C(!0),f(!1)}))}},className:t.button,fullWidth:!0,children:"OK"})})]}),Object(G.jsx)(st.a,{open:k,autoHideDuration:6e3,onClose:S,children:Object(G.jsx)(fo,{onClose:S,severity:"error",children:g})}),b&&Object(G.jsx)(ut.a,{})]})}var mo=Object(O.a)((function(e){return{root:{paddingBottom:100},buttonProgress:{color:"rgb(244, 36, 29)",position:"fixed",zIndex:1,top:"auto",bottom:70,left:"auto",right:10},inputMargin:{margin:e.spacing(1),flex:1},button:{marginLeft:10},title:{paddingTop:10}}}));function Oo(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function po(){var e=mo(),t=Object(o.e)(),a=Object(o.f)(),i=Object(n.useContext)(h.d).currentUserData,r=Object(n.useState)(!1),c=Object(m.a)(r,2),s=c[0],l=c[1],d=Object(n.useState)(""),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(""),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(""),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)(""),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(!1),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(""),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(""),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useContext)(h.b),ae=te.comments,re=te.conversations;function ce(e){var t=e.target.value;"firstName"===e.target.id?g(t):"lastName"===e.target.id?k(t):"phone"===e.target.id&&S(t)}function se(){return(se=Object(ie.a)(ne.a.mark((function e(){var a,n,r;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=D.b.database().ref("users"),ee(!0),n=i.key,!s){e.next=8;break}return e.next=6,je(n).then((function(e){var r=i.firstName+" "+i.lastName;a.child(n).update({firstName:p,lastName:v,phone:N,imageURL:e}).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),ee(!1),M(e.message),V("error"),Z(!0)})),r!==p+" "+v&&oe(),ee(!1),t.goBack()}));case 6:e.next=13;break;case 8:r=i.firstName+" "+i.lastName,a.child(n).update({firstName:p,lastName:v,phone:N}).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),ee(!1),M(e.message),V("error"),Z(!0)})),r!==p+" "+v&&oe(),ee(!1),t.goBack();case 13:t.goBack();case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){var e=p+" "+v,t=i.key;ae.forEach((function(a){a.user===t&&D.b.database().ref("comments").child(a.key).update({author:e})})),re.forEach((function(a){a.messages.forEach((function(n){n.user===t&&D.b.database().ref("conversations").child(a.key).child("messages").child(n.key).update({fullName:e})}))}))}function le(){B(!1)}function de(){L(!1)}Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||t.replace("/signin?url="+a.pathname)}));return i&&(b(i.email),g(i.firstName),k(i.lastName),S(i.phone)),function(){return e()}}),[i,t]);var ue=function(e,t){"clickaway"!==t&&Z(!1)};function je(e){return new Promise((function(t,a){var n=D.b.storage();i.avatarEditor.getImageScaledToCanvas().toBlob((function(r){var c=n.ref().child("avatars/users/"+e+"/avatar.png");c.put(r).then((function(e){console.log("Upload Successful"),i.avatar=null,c.getDownloadURL().then((function(e){t(e)}))})).catch((function(e){var t=e.code,n=e.message;console.log(t+":"+n),ee(!1),M(e.message),V("error"),Z(!0),a()}))}))}))}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:e.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Vt.a,{recipient:i,didChangeAvatar:function(){l(!0)},path:"users"})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(nt.a,{id:"firstName",label:"First Name",variant:"outlined",value:p,onChange:ce,className:e.inputMargin}),Object(G.jsx)(nt.a,{id:"lastName",label:"Last Name",variant:"outlined",value:v,onChange:ce,className:e.inputMargin})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"phone",label:"Mobile Number",variant:"outlined",value:N,onChange:ce,className:e.inputMargin,fullWidth:!0})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"email",label:"E-mail",variant:"outlined",value:j,onChange:ce,className:e.inputMargin,fullWidth:!0,disabled:!0})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){L(!0)},className:e.button,children:"Update Email"}),Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){B(!0)},className:e.button,children:"Update Password"})]})]})}),Object(G.jsx)(Xt,{onClick:function(){return se.apply(this,arguments)}}),$&&Object(G.jsx)(ct.a,{size:56,className:e.buttonProgress}),Object(G.jsx)($e,{}),Object(G.jsx)(st.a,{open:X,autoHideDuration:6e3,onClose:ue,children:Object(G.jsx)(Oo,{onClose:ue,severity:z,children:W})}),Object(G.jsx)(jo,{open:F,onClose:le,onSuccess:function(){le(),V("success"),M("Password Updated"),Z(!0)}}),Object(G.jsx)(ho,{open:A,onClose:de,onSuccess:function(){de(),V("success"),M("Email Updated"),Z(!0)}})]})}var go=a(580),xo={root:{width:"100%"},canvas:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem",width:"90%"},clearButton:{margin:10},confirmButton:{marginTop:10,marginBottom:10}},yo=function(e){Object(mr.a)(a,e);var t=Object(Or.a)(a);function a(e){var i;return Object(br.a)(this,a),(i=t.call(this,e)).canvas=n.createRef(),i}return Object(fr.a)(a,[{key:"render",value:function(){var e=this;return Object(G.jsx)(Wt.a,{fluid:!0,className:xo.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(go.a,{ref:this.canvas,strokeWidth:5,strokeColor:"black",style:xo.canvas,withTimestamp:!0}),Object(G.jsx)(K.a,{variant:"contained",color:"default",style:xo.clearButton,onClick:function(){e.canvas.current.clearCanvas()},children:"Clear"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(K.a,{variant:"contained",color:"primary",style:xo.confirmButton,onClick:function(){e.canvas.current.getSketchingTime().then((function(t){e.canvas.current.exportImage("png").then((function(a){e.props.imageData(a,t)})).catch((function(e){console.log(e)}))}))},children:"Confirm"})})]})})}}]),a}(n.Component),vo=Object(O.a)((function(e){return{headerImage:{height:100,marginTop:15},headerText:{height:100,padding:e.spacing(3,2),display:"flex",flexDirection:"column",justifyContent:"center"},bodyText:{margin:15},sectionTitle:{marginLeft:15},checkBox:{marginLeft:15},signatureBox:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem"}}}));function ko(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Co(){var e=Object(o.f)(),t=vo(),a=Object(n.useContext)(h.b).userConsent,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(""),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),K=Object(m.a)(H,2),Y=K[0],z=K[1];function V(){return(V=Object(ie.a)(ne.a.mark((function e(t,a){var n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(O&&v&&N&&F)){e.next=12;break}if(0!==a){e.next=6;break}j("Please sign in the white box"),s(!0),e.next=10;break;case 6:if(!A){e.next=10;break}return n=D.b.database().ref("userconsent"),e.next=10,q(A.key,t).then((function(){n.child(A.key).update({hasConsent:!0}),console.log("Verified"),z(!0)}));case 10:e.next=14;break;case 12:j("Please select all checkboxes"),s(!0);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(e,t){return new Promise((function(a,n){var i=D.b.storage(),r="signature.png";""!==W&&(r=W+".png"),i.ref().child("signatures/"+e+"/"+r).putString(t.split(",")[1],"base64",{contentType:"image/png"}).then((function(){console.log("Upload Successful"),a()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),j(e.message),s(!0),n()}))}))}Object(n.useEffect)((function(){var t=new URLSearchParams(e.search).get("key"),n=a.filter((function(e){return e.key===t}))[0];n&&(L(n),M(n.name))}),[a,e]);var _=function(e){"checkboxOne"===e.target.name?p(e.target.checked):"checkboxTwo"===e.target.name?k(e.target.checked):"checkboxThree"===e.target.name?S(e.target.checked):"checkboxFour"===e.target.name&&B(e.target.checked)},X=function(e,t){"clickaway"!==t&&s(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsx)(Ht.a,{children:Y?Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Registration Completed, Thank You."})}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("img",{className:t.headerImage,src:"images/behind_the_line.png",alt:"behind_the_line_image"}),Object(G.jsx)(x.a,{className:t.headerText,variant:"h3",gutterBottom:!0,children:"Are You Onside?"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["Nodiant Online is an online\xa0player management\xa0system built around the\xa0sharing of files\xa0in a secure environment so that team members can login to their own personalised website, view/download these files and then comment around them to encourage\xa0self-reflection, analysis of performance together with communication\xa0and development away from direct contact.\xa0 Nodiant will be used for some or all of the following purposes:",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in matches"}),Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in training"}),Object(G.jsx)("li",{children:"Sharing of video files relating to opposition analysis"}),Object(G.jsx)("li",{children:"Closed dialogue between staff members and individual players relating to performance"}),Object(G.jsx)("li",{children:"Open dialogue between staff members and groups of players and/or the whole squad relating to performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player data relating to tactical, technical, physical and psychological aspects of performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player\u2019s medical data"}),Object(G.jsx)("li",{children:"Sharing of administrative data amongst the squad"})]}),"We all have a responsibility to ensure that everyone involved in football finds it to be a fun, safe and positive experience."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["A copy of the FAW Safeguarding Policy is available from"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://www.safeguarding.cymru/",target:"_blank",rel:"noopener noreferrer",children:"https://www.safeguarding.cymru/"}),". If you are using this platform as a member of a Cymru Premier club or academy, or an Adran Premier club, please consult your club officials regarding the club / academy safeguarding policy. The Football Association of Wales (FAW), FAW Trust and end user clubs and academies will take all steps to ensure that images / videos of players and support staff are used solely for their intended purposes.\xa0 If you become aware that these images are being used inappropriately, please contact the FAW Safeguarding Department on 02920 435830."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"ICT Acceptable Use"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The Football Association of Wales (FAW) and FAW Trust understands the importance of technology for children and young people and their development.\xa0 However, we also recognise the need for vital safeguards to be in place to ensure player welfare remains paramount whilst online or using social media. \xa0 We ask that all players, support staff and parents/guardians take the time to read through this document and discuss the policy with their child/children.",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"I will be responsible for my behaviour when using resources provided by the Football Association of Wales, FAW Trust and their affiliated partners and when accessing online platforms or portals."}),Object(G.jsx)("li",{children:"I will not deliberately browse, download or access material that could be considered offensive. If I accidentally come across such material I will immediately report this to Team Operations."}),Object(G.jsx)("li",{children:"I will not use social media or the internet to send anyone material that could be considered threatening, offensive, bullying or illegal."}),Object(G.jsx)("li",{children:"I understand that my use of the internet whilst on international duty on FAW or FAW Trust issued resources can be monitored, logged and made available to essential and relevant personnel if necessary."}),Object(G.jsx)("li",{children:"I will not give out my personal information such as name, age, address or telephone number to strangers."}),Object(G.jsx)("li",{children:"I will not share my log-on details with anybody."}),Object(G.jsx)("li",{children:"I will not arrange to meet anybody unless accompanied by a member of FAW or FAW Trust staff or a parent/guardian."}),Object(G.jsx)("li",{children:"I understand that these rules are designed to ensure my safety and if they are not followed my parent/guardian may be contacted and I could be subject to disciplinary action."})]})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"Consent"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Please tick the boxes below:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:O,onChange:_,name:"checkboxOne",color:"primary"}),label:"I give my consent for my / my child\u2019s details, medical information, football related images and videos to be securely stored on the Nodiant Online platform and understand that this information may be shared with relevant and essential personnel."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:v,onChange:_,name:"checkboxTwo",color:"primary"}),label:"I give my consent for relevant and essential personnel to communicate with myself / my child in relation to my / their football related activities, performance and progress."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:N,onChange:_,name:"checkboxThree",color:"primary"}),label:"I hereby grant the Football Association of Wales (FAW) and its\u2019 affiliated partners the right to use the photograph(s) and any reproductions or adaptations of the photograph(s) for all general purposes in relation to the FAW\u2019s and its\u2019 affiliated partners work including, without limitation, the right to use them in publicity materials, books, newspapers, magazine articles, and on the FAW and its\u2019 affiliated partners\u2019 websites and social media outlets."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:F,onChange:_,name:"checkboxFour",color:"primary"}),label:"I / my child understands and agrees to support the safe use of ICT whilst on international duty for the FAW and FAW Trust."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The FAW & FAW Trust are committed to safeguarding the privacy of the personal data you have supplied. The supplied data will be held in accordance with data protection legislation and principles and as per the provisions of the General Data Protection Regulation (GDPR). The information that we are obliged to provide you in accordance with the provisions of the GDPR is contained in the"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://faw.cymru/privacy-policy/",target:"_blank",rel:"noopener noreferrer",children:"FAW Trust Privacy Notice"}),". By signing this form, you confirm that you have read and understood the FAW / FAW Trust Privacy Notices."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"If you are using this platform as a member of a Cymru Premier club or academy, or an Adran Premier club, please consult your club officials regarding the club / academy GDPR policies. By signing this form, you confirm that you have read and understood your club / academy Privacy Notices."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body2",children:"Signed By: ".concat(W)})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(yo,{imageData:function(e,t){return V.apply(this,arguments)}})})]})})}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:c,autoHideDuration:6e3,onClose:X,children:Object(G.jsx)(ko,{onClose:X,severity:"error",children:u})})})]})}var wo=Object(O.a)((function(e){return{headerImage:{height:100,marginTop:15},headerText:{height:100,padding:e.spacing(3,2),display:"flex",flexDirection:"column",justifyContent:"center"},bodyText:{margin:15},sectionTitle:{marginLeft:15},checkBox:{marginLeft:15},choosePasswordButton:{marginLeft:15},signatureBox:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem"},progress:{marginLeft:10}}}));function No(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function So(){var e=Object(o.f)(),t=wo(),a=Object(n.useContext)(h.b).userConsent,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(""),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(""),ae=Object(m.a)(te,2),re=ae[0],ce=ae[1];function se(){return(se=Object(ie.a)(ne.a.mark((function e(t,a){var n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(O&&v&&N&&F)){e.next=13;break}if(0!==a){e.next=6;break}j("Please sign in the white box"),s(!0),e.next=11;break;case 6:if(Z(!0),!A){e.next=11;break}return n=D.b.database().ref("userconsent"),e.next=11,oe(A.key,t).then((function(){n.child(A.key).update({hasConsent:!0}),console.log("Verified"),V(!0),Z(!1)}));case 11:e.next=15;break;case 13:j("Please select all checkboxes"),s(!0);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(e,t){return new Promise((function(a,n){var i=D.b.storage(),r="signature.png";""!==W&&(r=W+".png"),i.ref().child("signatures/"+e+"/"+r).putString(t.split(",")[1],"base64",{contentType:"image/png"}).then((function(){console.log("Upload Successful"),a()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),j(e.message),s(!0),n()}))}))}Object(n.useEffect)((function(){var t=new URLSearchParams(e.search),n=t.get("key");ce(t.get("email"));var i=a.filter((function(e){return e.key===n}))[0];i&&(L(i),M(i.name))}),[a,e]);var le=function(e){"checkboxOne"===e.target.name?p(e.target.checked):"checkboxTwo"===e.target.name?k(e.target.checked):"checkboxThree"===e.target.name?S(e.target.checked):"checkboxFour"===e.target.name&&B(e.target.checked)},de=function(e,t){"clickaway"!==t&&s(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsx)(Ht.a,{children:z?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Registration Completed, Thank You."})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){ee(!0),D.b.functions().httpsCallable("generateEmailActionLink")({email:re}).then((function(e){var t=e.data.link;ee(!1),window.location.replace(t)})).catch((function(e){console.log("Error"),console.log(e),console.log(e.code),console.log(e.message),console.log(e.details)}))},className:t.choosePasswordButton,children:"Choose Your Password"}),$&&Object(G.jsx)(ct.a,{className:t.progress})]})]}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("img",{className:t.headerImage,src:"images/behind_the_line.png",alt:"behind_the_line_image"}),Object(G.jsx)(x.a,{className:t.headerText,variant:"h3",gutterBottom:!0,children:"Are You Onside?"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["Nodiant Online is an online\xa0player management\xa0system built around the\xa0sharing of files\xa0in a secure environment so that team members can login to their own personalised website, view/download these files and then comment around them to encourage\xa0self-reflection, analysis of performance together with communication\xa0and development away from direct contact.\xa0 Nodiant will be used for some or all of the following purposes:",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in matches"}),Object(G.jsx)("li",{children:"Sharing of video files relating to opposition analysis"}),Object(G.jsx)("li",{children:"Closed dialogue between staff members and individual players relating to performance"}),Object(G.jsx)("li",{children:"Open dialogue between staff members and groups of players and/or the whole squad relating to performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player data relating to tactical, technical, physical and psychological aspects of performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player\u2019s medical data"}),Object(G.jsx)("li",{children:"Sharing of administrative data amongst the squad"})]}),"We all have a responsibility to ensure that everyone involved in football finds it to be a fun, safe and positive experience."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["A copy of the FAW Safeguarding Policy is available from"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://www.safeguarding.cymru/",target:"_blank",rel:"noopener noreferrer",children:"https://www.safeguarding.cymru/"}),". If you are using this platform as a member of a Cymru Premier club or academy, or an Adran Premier club, please consult your club officials regarding the club / academy safeguarding policy. The Football Association of Wales (FAW), FAW Trust and end user clubs and academies will take all steps to ensure that images / videos of players and support staff are used solely for their intended purposes.\xa0 If you become aware that these images are being used inappropriately, please contact the FAW Safeguarding Department on 02920 435830."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"ICT Acceptable Use"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The Football Association of Wales (FAW) and FAW Trust understands the importance of technology for children and young people and their development.\xa0 However, we also recognise the need for vital safeguards to be in place to ensure player welfare remains paramount whilst online or using social media. \xa0 We ask that all players, support staff and parents/guardians take the time to read through this document and discuss the policy with their child/children.",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"I will be responsible for my behaviour when using resources provided by the Football Association of Wales, FAW Trust and their affiliated partners and when accessing online platforms or portals."}),Object(G.jsx)("li",{children:"I will not deliberately browse, download or access material that could be considered offensive. If I accidentally come across such material I will immediately report this to Team Operations."}),Object(G.jsx)("li",{children:"I will not use social media or the internet to send anyone material that could be considered threatening, offensive, bullying or illegal."}),Object(G.jsx)("li",{children:"I understand that my use of the internet whilst on international duty on FAW or FAW Trust issued resources can be monitored, logged and made available to essential and relevant personnel if necessary."}),Object(G.jsx)("li",{children:"I will not give out my personal information such as name, age, address or telephone number to strangers."}),Object(G.jsx)("li",{children:"I will not share my log-on details with anybody."}),Object(G.jsx)("li",{children:"I understand that these rules are designed to ensure my safety and if they are not followed I could be subject to disciplinary action."})]})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"Consent"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Please tick the boxes below:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:O,onChange:le,name:"checkboxOne",color:"primary"}),label:"I give my consent for my medical information, football related images and videos to be securely stored on the Nodiant Online platform and understand that this information may be shared with relevant and essential personnel."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:v,onChange:le,name:"checkboxTwo",color:"primary"}),label:"I give my consent for relevant and essential personnel to communicate with myself in relation to my football related activities, performance and progress."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:N,onChange:le,name:"checkboxThree",color:"primary"}),label:"I hereby grant the Football Association of Wales (FAW) and its\u2019 affiliated partners the right to use the photograph(s) and any reproductions or adaptations of the photograph(s) for all general purposes in relation to the FAW\u2019s and its\u2019 affiliated partners work including, without limitation, the right to use them in publicity materials, books, newspapers, magazine articles, and on the FAW and its\u2019 affiliated partners\u2019 websites and social media outlets."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:F,onChange:le,name:"checkboxFour",color:"primary"}),label:"I understand and agree to support the safe use of ICT whilst on international duty for the FAW and FAW Trust."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The FAW & FAW Trust are committed to safeguarding the privacy of the personal data you have supplied. The supplied data will be held in accordance with data protection legislation and principles and as per the provisions of the General Data Protection Regulation (GDPR). The information that we are obliged to provide you in accordance with the provisions of the GDPR is contained in the"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://faw.cymru/privacy-policy/ ",target:"_blank",rel:"noopener noreferrer",children:"FAW Trust Privacy Notice"}),". By signing this form, you confirm that you have read and understood the FAW / FAW Trust Privacy Notices."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"If you are using this platform as a member of a Cymru Premier club or academy, or an Adran Premier club, please consult your club officials regarding the club / academy GDPR policies. By signing this form, you confirm that you have read and understood your club / academy Privacy Notices."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body2",children:"Signed By: ".concat(W)})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(yo,{imageData:function(e,t){return se.apply(this,arguments)}})})]})})}),X&&Object(G.jsx)(ut.a,{}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:c,autoHideDuration:6e3,onClose:de,children:Object(G.jsx)(No,{onClose:de,severity:"error",children:u})})})]})}var Eo=Object(O.a)((function(e){return{headerImage:{height:100,marginTop:15},headerText:{height:100,padding:e.spacing(3,2),display:"flex",flexDirection:"column",justifyContent:"center"},bodyText:{margin:15},sectionTitle:{marginLeft:15},checkBox:{marginLeft:15},choosePasswordButton:{marginLeft:15},signatureBox:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem"},progress:{marginLeft:10}}}));function To(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Fo(){var e=Object(o.f)(),t=Eo(),a=Object(n.useContext)(h.b).userConsent,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(""),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(""),J=Object(m.a)(Q,2),$=J[0],ee=J[1];function te(){return(te=Object(ie.a)(ne.a.mark((function e(t,a){var n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(O&&v&&N)){e.next=13;break}if(0!==a){e.next=6;break}j("Please sign in the white box"),s(!0),e.next=11;break;case 6:if(V(!0),!F){e.next=11;break}return n=D.b.database().ref("userconsent"),e.next=11,ae(F.key,t).then((function(){n.child(F.key).update({hasConsent:!0}),console.log("Verified"),M(!0),V(!1)}));case 11:e.next=15;break;case 13:j("Please select all checkboxes"),s(!0);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(e,t){return new Promise((function(a,n){var i=D.b.storage(),r="signature.png";""!==A&&(r=A+".png"),i.ref().child("signatures/"+e+"/"+r).putString(t.split(",")[1],"base64",{contentType:"image/png"}).then((function(){console.log("Upload Successful"),a()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),j(e.message),s(!0),n()}))}))}Object(n.useEffect)((function(){var t=new URLSearchParams(e.search),n=t.get("key");ee(t.get("email"));var i=a.filter((function(e){return e.key===n}))[0];i&&(B(i),L(i.name))}),[a,e]);var re=function(e){"checkboxOne"===e.target.name?p(e.target.checked):"checkboxTwo"===e.target.name?k(e.target.checked):"checkboxThree"===e.target.name&&S(e.target.checked)},ce=function(e,t){"clickaway"!==t&&s(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsx)(Ht.a,{children:W?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Registration Completed, Thank You."})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){Z(!0),D.b.functions().httpsCallable("generateEmailActionLink")({email:$}).then((function(e){var t=e.data.link;Z(!1),window.location.replace(t)})).catch((function(e){console.log("Error"),console.log(e),console.log(e.code),console.log(e.message),console.log(e.details)}))},className:t.choosePasswordButton,children:"Choose Your Password"}),X&&Object(G.jsx)(ct.a,{className:t.progress})]})]}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("img",{className:t.headerImage,src:"images/behind_the_line.png",alt:"behind_the_line_image"}),Object(G.jsx)(x.a,{className:t.headerText,variant:"h3",gutterBottom:!0,children:"Are You Onside?"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["Nodiant Online is an online\xa0player management\xa0system made available to the Club by the Football Association of Wales (FAW). It is built around the\xa0sharing of files\xa0in a secure environment so that team members can login to their own personalised website, view/download these files and then comment around them to encourage\xa0self-reflection, analysis of performance together with communication\xa0and development away from direct contact.\xa0 Nodiant will be used for some or all of the following purposes:",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in matches"}),Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in training"}),Object(G.jsx)("li",{children:"Sharing of video files relating to opposition analysis"}),Object(G.jsx)("li",{children:"Closed dialogue between staff members and individual players relating to performance"}),Object(G.jsx)("li",{children:"Open dialogue between staff members and groups of players and/or the whole squad relating to performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player data relating to tactical, technical, physical and psychological aspects of performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player\u2019s medical data"}),Object(G.jsx)("li",{children:"Sharing of administrative data amongst the squad"})]}),"We all have a responsibility to ensure that everyone involved in football finds it to be a fun, safe and positive experience."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["A copy of the Club's safeguarding polich should be available from your club. A copy of the FAW Safeguarding Policy is available from"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://www.safeguarding.cymru/",target:"_blank",rel:"noopener noreferrer",children:"https://www.safeguarding.cymru/"}),"."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"The FAW and end user clubs and academies will take all steps to ensure that images / videos of players and support staff are used solely for their intended purposes.\xa0 If you become aware that these images are being used inappropriately, please contact the Club and the FAW Safeguarding Department on 02920 435830 immediately."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"ICT Acceptable Use"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The Club understands the importance of technology for player development. However, we also recognise the need for vital safeguards to be in place to ensure player welfare remains paramount whilst online or using social media. \xa0 We ask that all players and support staff take the time to read through this document.",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"I will be responsible for my behaviour when using resources provided by the Club and/or the FAW and their affiliated partners and when accessing online platforms or portals."}),Object(G.jsx)("li",{children:"I will not deliberately browse, download or access material that could be considered offensive. If I accidentally come across such material I will immediately report this to the Club."}),Object(G.jsx)("li",{children:"I will not use social media or the internet to send anyone material that could be considered threatening, offensive, bullying or illegal."}),Object(G.jsx)("li",{children:"I understand that my use of the internet whilst on international duty on FAW issued resources can be monitored, logged and made available to essential and relevant personnel if necessary."}),Object(G.jsx)("li",{children:"I will not give out my personal information such as name, age, address or telephone number to strangers."}),Object(G.jsx)("li",{children:"I will not share my log-on details with anybody."}),Object(G.jsx)("li",{children:"I understand that these rules are designed to ensure my safety and if they are not followed I could be subject to disciplinary action."})]})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"Consent"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Please tick the boxes below:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:O,onChange:re,name:"checkboxOne",color:"primary"}),label:"I give my consent for my medical information, football related images and videos to be securely stored on the Nodiant Online platform and understand that this information may be shared with relevant and essential personnel."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:v,onChange:re,name:"checkboxTwo",color:"primary"}),label:"I give my consent for relevant and essential personnel to communicate with myself in relation to my football related activities, performance and progress."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:N,onChange:re,name:"checkboxThree",color:"primary"}),label:" I hereby grant the Club, the FAW and its\u2019 affiliated partners the right to use the photograph(s) and any reproductions or adaptations of the photograph(s) for all general purposes in relation to the Club\u2019s, the FAW\u2019s and its\u2019 affiliated partners work including, without limitation, the right to use them in publicity materials, books, newspapers, magazine articles, and on the Club\u2019s , the FAW\u2019s and its\u2019 affiliated partners\u2019 websites and social media outlets."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"The Club and the FAW are committed to safeguarding the privacy of the personal data you have supplied. The supplied data will be held in accordance with data protection legislation and principles and as per the provisions of the UK General Data Protection Regulation (UK GDPR). The information that we are obliged to provide you in accordance with the provisions of the UK GDPR is contained in the Club\u2019s Privacy Notice (this should be made available to you by your club). By signing this form, you confirm that you have read and understood the Club\u2019s Privacy Notice."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body2",children:"Signed By: ".concat(A)})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(yo,{imageData:function(e,t){return te.apply(this,arguments)}})})]})})}),z&&Object(G.jsx)(ut.a,{}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:c,autoHideDuration:6e3,onClose:ce,children:Object(G.jsx)(To,{onClose:ce,severity:"error",children:u})})})]})}var Bo=Object(O.a)((function(e){return{headerImage:{height:100,marginTop:15},headerText:{height:100,padding:e.spacing(3,2),display:"flex",flexDirection:"column",justifyContent:"center"},bodyText:{margin:15},sectionTitle:{marginLeft:15},checkBox:{marginLeft:15},choosePasswordButton:{marginLeft:15},signatureBox:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem"},progress:{marginLeft:10}}}));function Do(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Ro(){var e=Object(o.f)(),t=Bo(),a=Object(n.useContext)(h.b).userConsent,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(""),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),K=Object(m.a)(H,2),Y=K[0],z=K[1];function V(){return(V=Object(ie.a)(ne.a.mark((function e(t,a){var n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(O&&v&&N)){e.next=13;break}if(0!==a){e.next=6;break}j("Please sign in the white box"),s(!0),e.next=11;break;case 6:if(z(!0),!F){e.next=11;break}return n=D.b.database().ref("userconsent"),e.next=11,q(F.key,t).then((function(){n.child(F.key).update({hasConsent:!0}),console.log("Verified"),M(!0),z(!1)}));case 11:e.next=15;break;case 13:j("Please select all checkboxes"),s(!0);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(e,t){return new Promise((function(a,n){var i=D.b.storage(),r="signature.png";""!==A&&(r=A+".png"),i.ref().child("signatures/"+e+"/"+r).putString(t.split(",")[1],"base64",{contentType:"image/png"}).then((function(){console.log("Upload Successful"),a()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),j(e.message),s(!0),n()}))}))}Object(n.useEffect)((function(){var t=new URLSearchParams(e.search).get("key"),n=a.filter((function(e){return e.key===t}))[0];n&&(B(n),L(n.name))}),[a,e]);var _=function(e){"checkboxOne"===e.target.name?p(e.target.checked):"checkboxTwo"===e.target.name?k(e.target.checked):"checkboxThree"===e.target.name&&S(e.target.checked)},X=function(e,t){"clickaway"!==t&&s(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsx)(Ht.a,{children:W?Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Registration Completed, Thank You."})})}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("img",{className:t.headerImage,src:"images/behind_the_line.png",alt:"behind_the_line_image"}),Object(G.jsx)(x.a,{className:t.headerText,variant:"h3",gutterBottom:!0,children:"Are You Onside?"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["Nodiant Online is an online\xa0player management\xa0system made available to the Club by the Football Association of Wales (FAW). It is built around the\xa0sharing of files\xa0in a secure environment so that team members can login to their own personalised website, view/download these files and then comment around them to encourage\xa0self-reflection, analysis of performance together with communication\xa0and development away from direct contact.\xa0 Nodiant will be used for some or all of the following purposes:",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in matches"}),Object(G.jsx)("li",{children:"Sharing of video files amongst the squad relating to team and/or individual performances in training"}),Object(G.jsx)("li",{children:"Sharing of video files relating to opposition analysis"}),Object(G.jsx)("li",{children:"Closed dialogue between staff members and individual players relating to performance"}),Object(G.jsx)("li",{children:"Open dialogue between staff members and groups of players and/or the whole squad relating to performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player data relating to tactical, technical, physical and psychological aspects of performance"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of player\u2019s medical data"}),Object(G.jsx)("li",{children:"Sharing of administrative data amongst the squad"})]}),"We all have a responsibility to ensure that everyone involved in football finds it to be a fun, safe and positive experience."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["A copy of the Club's safeguarding polich should be available from your club. A copy of the FAW Safeguarding Policy is available from"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://www.safeguarding.cymru/",target:"_blank",rel:"noopener noreferrer",children:"https://www.safeguarding.cymru/"}),"."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"The FAW and end user clubs and academies will take all steps to ensure that images / videos of players and support staff are used solely for their intended purposes.\xa0 If you become aware that these images are being used inappropriately, please contact the Club and the FAW Safeguarding Department on 02920 435830 immediately."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"ICT Acceptable Use"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The Club understands the importance of technology for children and young people and their development.\xa0 However, we also recognise the need for vital safeguards to be in place to ensure player welfare remains paramount whilst online or using social media. \xa0 We ask that all players, support staff and parents/guardians take the time to read through this document and discuss the policy with their child/children.",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"I will be responsible for my behaviour when using resources provided by the Club and/or the FAW and their affiliated partners and when accessing online platforms or portals."}),Object(G.jsx)("li",{children:"I will not deliberately browse, download or access material that could be considered offensive. If I accidentally come across such material I will immediately report this to the Club."}),Object(G.jsx)("li",{children:"I will not use social media or the internet to send anyone material that could be considered threatening, offensive, bullying or illegal."}),Object(G.jsx)("li",{children:"I will not give out my personal information such as name, age, address or telephone number to strangers."}),Object(G.jsx)("li",{children:"I will not share my log-on details with anybody."}),Object(G.jsx)("li",{children:"I will not arrange to meet anybody unless accompanied by a member of the Club, the FAW or a parent/guardian."}),Object(G.jsx)("li",{children:"I understand that these rules are designed to ensure my safety and if they are not followed my parent/guardian may be contacted and I could be subject to disciplinary action."})]})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"Consent"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Please tick the boxes below:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:O,onChange:_,name:"checkboxOne",color:"primary"}),label:"I give my consent for my / my child\u2019s details, medical information, football related images and videos to be securely stored on the Nodiant Online platform and understand that this information may be shared with relevant and essential personnel."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:v,onChange:_,name:"checkboxTwo",color:"primary"}),label:"I give my consent for relevant and essential personnel to communicate with myself / my child in relation to my / their football related activities, performance and progress."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:N,onChange:_,name:"checkboxThree",color:"primary"}),label:" I hereby grant the Club, the FAW and its\u2019 affiliated partners the right to use the photograph(s) and any reproductions or adaptations of the photograph(s) for all general purposes in relation to the Club\u2019s, the FAW\u2019s and its\u2019 affiliated partners work including, without limitation, the right to use them in publicity materials, books, newspapers, magazine articles, and on the Club\u2019s, the FAW\u2019s and its\u2019 affiliated partners\u2019 websites and social media outlets."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"The Club and the FAW is committed to safeguarding the privacy of the personal data you have supplied. The supplied data will be held in accordance with data protection legislation and principles and as per the provisions of the UK General Data Protection Regulation (UK GDPR). The information that we are obliged to provide you in accordance with the provisions of the UK GDPR is contained in the Club\u2019s Privacy Notice (this should be made available to you by your club). By signing this form, you confirm that you have read and understood the Club\u2019s Privacy Notice."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"If you are using this platform as a member of a Cymru Premier club or academy, or an Adran Premier club, please consult your club officials regarding the club / academy GDPR policies. By signing this form, you confirm that you have read and understood your club / academy Privacy Notices."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body2",children:"Signed By: ".concat(A)})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(yo,{imageData:function(e,t){return V.apply(this,arguments)}})})]})})}),Y&&Object(G.jsx)(ut.a,{}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:c,autoHideDuration:6e3,onClose:X,children:Object(G.jsx)(Do,{onClose:X,severity:"error",children:u})})})]})}var Po=a(582),Ao=a.n(Po),Lo=a(314),Io=a.n(Lo),Uo=a(1078),Wo=a(581),Mo=a.n(Wo),Ho=Object(O.a)((function(e){return{root:{textAlign:"center",paddingLeft:10},title:{marginTop:15},calendarControl:{margin:20},timeTextField:{marginTop:50,margin:20},nameTextField:{margin:20},notesTextField:{marginLeft:20,marginRight:20,marginBottom:20},colorPicker:{paddingLeft:15,paddingRight:15,paddingBottom:15,alignSelf:"center"},button:{marginLeft:20,marginRight:20,marginBottom:20},deleteButton:{position:"absolute",right:5},starIcon:{color:e.palette.primary.main,cursor:"pointer"},starsRow:{marginBottom:15}}}));function Ko(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Yo(e){var t=Ho(),a=Object(n.useState)(),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(0),o=Object(m.a)(s,2),l=o[0],d=o[1],u=Object(n.useState)(0),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(""),p=Object(m.a)(O,2),g=p[0],x=p[1],y=Object(n.useState)([""]),v=Object(m.a)(y,2),k=v[0],C=v[1],N=Object(n.useState)(0),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useContext)(h.d).currentUserData,B=Object(n.useState)(!1),D=Object(m.a)(B,2),R=D[0],P=D[1],A=Object(n.useState)(!1),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)("error"),M=Object(m.a)(W,2),H=M[0],Y=M[1],z=Object(n.useState)(""),V=Object(m.a)(z,2),q=V[0],_=V[1],X=Object(n.useReducer)((function(e){return e+1}),0),Z=Object(m.a)(X,2)[1];Object(n.useEffect)((function(){if(e.rowToEdit){var t=e.rowToEdit;c(t),d(t.inTime),f(t.outTime),x(t.name),0===t.notes.length?C([""]):C(t.notes),T(t.stars)}else c(null),x(""),C([""]),T(0)}),[e.rowToEdit]);var Q=function(e){"Mark Name"===e.target.id?x(e.target.value):"In Time"===e.target.id?d(e.target.value):"Out Time"===e.target.id?f(e.target.value):Object(be.j)(e.target.id)&&(k[e.target.id]=e.target.value,Z())};function J(){T(1)}function $(){T(2)}function ee(){T(3)}var te=function(e,t){"clickaway"!==t&&U(!1)};function ae(e,t){Y(t),_(e),U(!0)}return Object(G.jsxs)(dt.a,{"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,onClose:function(){e.onClose(),x(""),T(0),d(0),f(0),C([""])},children:[r&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(w.a,{onClick:function(){P(!0)},className:t.deleteButton,children:Object(G.jsx)(Ut.a,{})}),Object(G.jsxs)("div",{children:[Object(G.jsx)(nt.a,{className:t.timeTextField,id:"In Time",label:"In Time (Sec)",variant:"outlined",value:l,onChange:Q,endAdornment:Object(G.jsx)(Uo.a,{position:"end",children:"Seconds"})}),Object(G.jsx)(nt.a,{className:t.timeTextField,id:"Out Time",label:"Out Time (Sec)",variant:"outlined",value:b,onChange:Q})]})]}),Object(G.jsx)(nt.a,{className:t.nameTextField,id:"Mark Name",label:"Mark Name",variant:"outlined",value:g,onChange:Q}),k.map((function(e,a){return Object(G.jsx)(nt.a,{className:t.notesTextField,id:a.toString(),label:"Note",variant:"outlined",value:k[a],onChange:Q},a)})),Object(G.jsxs)("div",{className:t.starsRow,children:[Object(G.jsx)(w.a,{onClick:function(){E>0&&T(E-1)},children:Object(G.jsx)(Mo.a,{})}),0===E&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Yr.a,{onClick:J,className:t.starIcon}),Object(G.jsx)(Yr.a,{onClick:$,className:t.starIcon}),Object(G.jsx)(Yr.a,{onClick:ee,className:t.starIcon})]}),1===E&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(wr.a,{onClick:J,className:t.starIcon}),Object(G.jsx)(Yr.a,{onClick:$,className:t.starIcon}),Object(G.jsx)(Yr.a,{onClick:ee,className:t.starIcon})]}),2===E&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(wr.a,{onClick:J,className:t.starIcon}),Object(G.jsx)(wr.a,{onClick:$,className:t.starIcon}),Object(G.jsx)(Yr.a,{onClick:ee,className:t.starIcon})]}),3===E&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(wr.a,{onClick:J,className:t.starIcon}),Object(G.jsx)(wr.a,{onClick:$,className:t.starIcon}),Object(G.jsx)(wr.a,{onClick:ee,className:t.starIcon})]}),Object(G.jsx)(w.a,{onClick:function(){E<3&&T(E+1)},children:Object(G.jsx)(vt.a,{})})]}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){""!==g?Object(be.j)(l.toString())?Object(be.j)(b.toString())?l<0?ae("In time cannot be below zero","error"):b<0?ae("Out time cannot be below zero","error"):l>b?ae("In Time must be smaller than Out Time","error"):(r?(r.inTime=l,r.outTime=b,r.name=g,r.notes=k.filter((function(e){return""!==e})),r.stars=E,e.onEdit(r)):e.onAdd(g,k.filter((function(e){return""!==e})),E),x(""),C([""]),T(0),d(0),f(0)):ae("Out Time must be a number","error"):ae("In Time must be a number","error"):ae("Name can't be blank","error")},children:"Done"}),R&&Object(G.jsx)(ya,{title:"Delete Row",message:"Are you sure you want to delete this row?",open:R,onClose:function(t){!0===t&&F&&e.onDelete(r),P(!1)}}),Object(G.jsx)(st.a,{open:I,autoHideDuration:6e3,onClose:te,children:Object(G.jsx)(Ko,{onClose:te,severity:H,children:q})})]})}function zo(e){return Object(n.useEffect)((function(){var t=function(t){e.keyWasPressed(t)};return window.addEventListener("keydown",t),function(){window.removeEventListener("keydown",t)}}),[e]),Object(G.jsx)(G.Fragment,{})}var Vo=a(204),Go=a.n(Vo),qo=Object(O.a)((function(e){return{root:{textAlign:"center"},pageContainer:{maxHeight:window.innerHeight-100,overflow:"scroll"},title:{marginTop:15},toggleButton:{marginLeft:20,width:30,height:30},button:{marginTop:5,marginLeft:5,marginRight:5,marginBottom:5},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-100},starIcon:{color:e.palette.primary.main},labelListItem:{paddingLeft:70}}}));function _o(e){var t=qo(),a=Object(n.useReducer)((function(e){return e+1}),0),i=Object(m.a)(a,2)[1],r=Object(n.useState)([]),c=Object(m.a)(r,2),s=c[0],o=c[1],l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)([]),f=Object(m.a)(b,2),h=f[0],O=f[1];function p(){var t=[];s.forEach((function(e){e.selected&&t.push(e.code)}));var a=[];u.forEach((function(e){e.labels.forEach((function(e){e.selected&&a.push(e.text)}))}));var n=[];h.forEach((function(e){e.selected&&n.push(e.stars)})),e.onClose(t,a,n,u)}Object(n.useEffect)((function(){if(e.rows){var t=[],a=e.groupsAfterFiltering;e.rows.forEach((function(e){if(0===t.filter((function(t){return t.code===e.name})).length&&t.push({code:e.name,selected:!e.filteredOutByCode}),0===e.labels.length){var n=a.filter((function(e){return"(No Group)"===e.group}))[0];n?0===n.labels.filter((function(e){return"(No Detail)"===e.text})).length&&(n.labels=[{text:"(No Detail)",selected:!0}].concat(Object(Jt.a)(n.labels))):a=[{group:"(No Group)",labels:[{text:"(No Detail)",selected:!0}],selected:!0}].concat(Object(Jt.a)(a))}else e.labels.forEach((function(e){if(e.group){var t=a.filter((function(t){return t.group===e.group}))[0];t?0===t.labels.filter((function(t){return t.text===e.text})).length&&t.labels.push({text:e.text,selected:!0}):a.push({group:e.group,labels:[{text:e.text,selected:!0}],selected:!0})}else{var n=a.filter((function(e){return"(No Group)"===e.group}))[0];n?0===n.labels.filter((function(t){return t.text===e.text})).length&&n.labels.push({text:e.text,selected:!0}):a=[{group:"(No Group)",labels:[{text:e.text,selected:!0}],selected:!0}].concat(Object(Jt.a)(a))}}))})),t.sort((function(e,t){return e.code.toLowerCase()>t.code.toLowerCase()?1:-1})),o(t),j(a),O(e.ratings)}}),[e]);var g=function(e){return function(){e.selected=!e.selected,e.group&&e.labels.forEach((function(t){t.selected=e.selected})),i()}},x=function(e){return function(){var t=e[0];if(t){var a=!1;t.group?(a=!t.selected,e.forEach((function(e){e.selected=a,e.labels.forEach((function(e){e.selected=a}))}))):(a=!t.selected,e.forEach((function(e){e.selected=a}))),i()}}};return Object(G.jsxs)(dt.a,{"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,onClose:p,fullWidth:!0,maxWidth:"lg",children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.pageContainer,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Rows"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(s),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:s.map((function(e){var t="checkbox-list-label-".concat(e.code);return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":t}})}),Object(G.jsx)(ze.a,{id:t,primary:e.code})]},e.code)}))})})})]}),Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Detail"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(u),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:u.map((function(e){var a="checkbox-list-label-".concat(e.group);return Object(G.jsxs)(n.Fragment,{children:[Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a},onClick:g(e)})}),Object(G.jsx)(ze.a,{id:a,primary:e.group})]}),e.labels.map((function(e){return Object(G.jsxs)(Ke.a,{className:t.labelListItem,role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a}})}),Object(G.jsx)(ze.a,{id:a,primary:e.text})]},e.text)}))]},e.groups)}))})})})]}),Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Rating"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(h),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:h.map((function(e){var a="checkbox-list-label-".concat(e.stars);return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a}})}),0===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),1===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),2===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),3===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon})]})]},e.stars)}))})})})]})]})}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){p()},children:"Done"})]})}var Xo=a(201),Zo=a.n(Xo),Qo=Object(O.a)((function(e){return{list:{width:"100%",padding:0},container:{height:"100%",margin:0,paddingLeft:15},chip:{marginLeft:10,marginTop:5,marginBottom:5},nameTextField:{marginLeft:15,marginRight:15},title:{flexGrow:1},sectionTitle:{marginLeft:15,marginTop:10},notificationsSwitch:{marginLeft:15,marginTop:20},notificationsMessage:{marginLeft:25,marginRight:15,marginTop:10}}})),Jo=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function $o(e){var t=Qo(),a=Object(n.useContext)(h.b),r=a.users,c=a.groups,s=a.folders,o=Object(n.useContext)(h.d).currentUserData,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(""),f=Object(m.a)(b,2),O=f[0],y=f[1],v=Object(n.useState)([]),k=Object(m.a)(v,2),N=k[0],S=k[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],R=T[1],A=Object(n.useState)(!1),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)(""),M=Object(m.a)(W,2),H=M[0],K=M[1];Object(n.useEffect)((function(){var t=[];e.timeline.users&&e.timeline.users.forEach((function(e){var a=r.filter((function(t){return t.key===e}))[0];a&&t.push(a)})),j(t);var a=[];e.timeline.groups&&e.timeline.groups.forEach((function(e){var t=c.filter((function(t){return t.key===e}))[0];t&&a.push(t)})),S(a);var n=[];e.file.groups&&0===F.length&&(e.file.groups.forEach((function(e){var t=c.filter((function(t){return t.key===e}))[0];if(t){var a=n.filter((function(e){return e.key===t.hub}))[0];if(a)"All Users"===t.name?t.displayName="All in '"+a.name+"'":t.displayName=t.name,a.groups.push(t);else{var i=s.filter((function(e){return e.key===t.hub}))[0];i&&("All Users"===t.name?t.displayName="All in '"+i.name+"'":t.displayName=t.name,n.push({key:t.hub,name:i.name,groups:[t]}))}}})),R(n))}),[e.open]);var Y=function(e){return function(){var t=Object(Jt.a)(u);t.push(e),j(t),y("")}},q=function(e){return function(){var t=Object(Jt.a)(u);e.users.forEach((function(e){var a=r.filter((function(t){return t.key===e.key}));if(1===a.length){var n=a[0];0===t.filter((function(e){return e.key===n.key})).length&&t.push(n),j(t)}}));var a=Object(Jt.a)(N);a.push(e),S(a)}},_=function(e){return function(){var t=u.filter((function(t){return t.key!==e.key}));j(t)}},X=function(e){return function(){var t=Object(Jt.a)(u);e.users.forEach((function(a){var n=!0;N.forEach((function(t){t.key!==e.key&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!1)})),n&&(t=t.filter((function(e){return e.key!==a.key})))})),j(t);var a=N.filter((function(t){return t.key!==e.key}));S(a)}};function Z(e){for(var t=0;t<N.length;t++)for(var a=N[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}function Q(e){return e.displayName&&""!==e.displayName?1===e.users?e.displayName+" (1 User)":e.displayName+" ("+e.users.length+" Users)":1===e.users?e.name+" (1 User)":e.name+" ("+e.users.length+" Users)"}return Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:Jo,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){y(""),K(""),U(!1),S([]),j([]),e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Share Timeline"}),Object(G.jsx)(C.a,{title:"Confirm",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){var t=Object(be.k)(N),a={};u.forEach((function(e){Z(e)||(a[e.key]=!0)})),D.b.database().ref("timelines").child(e.timeline.key).update({users:a,groups:t}),D.b.database().ref("timelineinfo").child(e.timeline.key).update({users:a,groups:t}),D.b.database().ref("fileusage").push({file:e.file.key,fileName:e.file.displayName,fileType:e.file.type,user:o.key,action:"TimelineShare",usersSharedWith:a,groupsSharedWith:t,date:P()().toString()}),I&&D.b.database().ref("notifications").child(e.timeline.key).set({file:e.timeline.video,title:e.timeline.name,type:"timeline",users:Object(be.k)(u),message:H,date:P()().toString()});var n=u.length;y(""),K(""),U(!1),S([]),j([]),e.onClose(n),j([])},"aria-label":"close",children:Object(G.jsx)(Zo.a,{})})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:I,onChange:function(e){"send"===e.target.name&&U(e.target.checked)},name:"send",color:"primary"}),label:"Send Notifications",className:t.notificationsSwitch})}),I&&Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Notification Message",variant:"outlined",maxRows:15,value:H,onChange:function(e){K(e.target.value)},className:t.notificationsMessage})]}),Object(G.jsx)(xe.a,{style:{marginTop:10}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Selected"})}),Object(G.jsx)(Mt.a,{children:N.map((function(e){return Object(G.jsx)(V.a,{label:Q(e),className:t.chip,onDelete:X(e)},e.key)}))}),Object(G.jsx)(Mt.a,{children:u.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return!Z(e)&&Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:e.key!==o.key&&_(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Groups"})}),Object(G.jsx)(Mt.a,{style:{margin:0,padding:0},children:Object(G.jsx)(Mt.a,{children:F.map((function(e){return e.groups&&e.groups.length>0&&Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:e.groups.filter((function(e){return!N.includes(e)})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(V.a,{label:Q(e),className:t.chip,clickable:!0,onClick:q(e)},e.key)}))})]},e.key)}))})}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:O,onChange:function(e){y(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:r.filter((function(t){return function(t){if(o){if(t.key===o.key)return!1;var a=!1;if(e.file.managers&&e.file.managers.includes(t.key)&&(a=!0),t.files.includes(e.file.key)&&(a=!0),F.forEach((function(e){e.groups.forEach((function(e){"Matthew"===t.firstName&&t.lastName,e.users.filter((function(e){return e.key===t.key})).length>0&&(a=!0)}))})),a&&0===u.filter((function(e){return e.key===t.key})).length&&t.fullName.toLowerCase().includes(O.toLowerCase()))return!0}return!1}(t)})).map((function(e){return Object(G.jsxs)("div",{onClick:Y(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}function el(e){function t(){e.onClose(!1)}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:t,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:e.message})}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{onClick:t,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{onClick:function(){e.onClose(!0)},color:"primary",children:"Create Own Copy"})]})]})})}function tl(e){var t=Object(n.useState)(""),a=Object(m.a)(t,2),i=a[0],r=a[1],c=Object(n.useState)(!0),s=Object(m.a)(c,2),o=s[0],l=s[1];function d(){e.onClose(i,!1,o),e.initialValue?r(e.initialValue):r("")}Object(n.useEffect)((function(){e.initialValue&&r(e.initialValue)}),[e.initialValue]);return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:d,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsxs)(ua.a,{children:[Object(G.jsx)(ja.a,{children:e.message}),Object(G.jsx)(nt.a,{value:i,onChange:function(e){r(e.target.value)},autoFocus:!0,margin:"dense",id:"name",label:"",type:"",fullWidth:!0}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:o,onChange:function(){l(!o)},name:"checkboxFour",color:"primary"}),label:"Include Notes"})]}),Object(G.jsxs)(da.a,{children:[Object(G.jsx)(K.a,{id:"cancel",onClick:d,color:"primary",children:"Cancel"}),Object(G.jsx)(K.a,{id:"ok",onClick:function(){e.onClose(i,!0,o),r("")},color:"primary",children:"OK"})]})]})})}var al=Object(O.a)((function(e){var t,a;return{videoPlayer:{marginTop:0},columnPadding:(t={},Object(Ze.a)(t,e.breakpoints.down("sm"),{paddingLeft:0}),Object(Ze.a)(t,"paddingRight",0),t),pageContainer:{paddingBottom:65},displayName:(a={flexGrow:1,paddingTop:10,fontSize:24},Object(Ze.a)(a,e.breakpoints.down("sm"),{paddingLeft:15,fontSize:19}),Object(Ze.a)(a,"overflowWrap","break-word"),Object(Ze.a)(a,"maxWidth","100%"),Object(Ze.a)(a,"display","-webkit-box"),Object(Ze.a)(a,"WebkitLineClamp",2),Object(Ze.a)(a,"textOverflow","ellipsis"),a),titleRow:{marginRight:0},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-255,overflow:"scroll"},starIcon:{color:e.palette.primary.main},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)",cursor:"pointer"},previewHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)",width:50},markInButton:{width:"100%"},filterButton:{position:"absolute",right:0,left:"auto"}}}));function nl(e,t,a,n,i,r,c,s){return{key:e,index:t,inTime:a,outTime:n,name:i,labels:r,notes:c,stars:s,selected:!0,filteredOutByCode:!1,filteredOutByRating:!1,filteredOutByLabels:!1}}function il(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function rl(e){var t=al(),r=Object(o.e)(),c=Object(o.f)(),s=Object(n.useContext)(h.b),l=s.files,d=s.groups,u=Object(n.useState)(),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(),p=Object(m.a)(O,2),g=p[0],y=p[1],v=i.a.useRef(),k=Object(n.useContext)(h.d).currentUserData,S=Object(n.useState)(null),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)("Mark In"),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)([]),ae=Object(m.a)(te,2),re=ae[0],ce=ae[1],se=Object(n.useState)(!1),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=Object(n.useState)(!1),je=Object(m.a)(ue,2),fe=je[0],he=je[1],me=Object(n.useState)(),Oe=Object(m.a)(me,2),pe=Oe[0],ge=Oe[1],xe=Object(n.useState)(!1),ye=Object(m.a)(xe,2),ve=ye[0],ke=ye[1],Ce=Object(n.useState)(!1),we=Object(m.a)(Ce,2),Ne=we[0],Se=we[1],Ee=Object(n.useState)(!1),Te=Object(m.a)(Ee,2),Fe=Te[0],Be=Te[1],De=Object(n.useState)(""),Re=Object(m.a)(De,2),Pe=Re[0],Ae=Re[1],Ie=Object(n.useState)(""),Ue=Object(m.a)(Ie,2),We=Ue[0],Me=Ue[1],He=Object(n.useState)(""),Ke=Object(m.a)(He,2),Ye=Ke[0],ze=Ke[1],Ve=Object(n.useState)(""),Ge=Object(m.a)(Ve,2),qe=Ge[0],_e=Ge[1],Xe=Object(n.useState)(!1),Ze=Object(m.a)(Xe,2),Qe=Ze[0],Je=Ze[1],et=Object(n.useState)(!1),tt=Object(m.a)(et,2),at=tt[0],nt=tt[1],it=Object(n.useState)(),rt=Object(m.a)(it,2),ct=rt[0],ot=rt[1],lt=Object(n.useState)(!1),dt=Object(m.a)(lt,2),ut=dt[0],jt=dt[1],bt=Object(n.useState)("Ascending"),ft=Object(m.a)(bt,2),ht=ft[0],mt=ft[1],Ot=Object(n.useState)(!1),gt=Object(m.a)(Ot,2),xt=gt[0],yt=gt[1],vt=Object(n.useReducer)((function(e){return e+1}),0),kt=Object(m.a)(vt,2)[1],Ct=Object(n.useState)("error"),wt=Object(m.a)(Ct,2),St=wt[0],Et=wt[1],Tt=Object(n.useState)(""),Ft=Object(m.a)(Tt,2),Bt=Ft[0],Dt=Ft[1],Rt=Object(n.useState)(!1),At=Object(m.a)(Rt,2),It=At[0],Ut=At[1],Kt=Object(n.useState)(!1),Yt=Object(m.a)(Kt,2),zt=Yt[0],Vt=Yt[1],Gt=Object(n.useState)([]),qt=Object(m.a)(Gt,2),_t=qt[0],Xt=qt[1],Zt=Object(n.useState)([]),Qt=Object(m.a)(Zt,2),$t=Qt[0],ea=Qt[1],ta=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("timelines").child(t),b?console.log("Already Read Timeline"):(console.log("Reading Timeline from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val();if(a){var n=[];if(a.instances)for(var i=Object.keys(a.instances),r=Object.values(a.instances),c=0;c<i.length;c++){var s=[];if(r[c].labels)for(var o=Object.values(r[c].labels),l=0;l<o.length;l++)s.push(o[l]);var d=[];if(r[c].notes)for(var u=Object.values(r[c].notes),j=0;j<u.length;j++)d.push(u[j]);n.push({key:i[c],index:r[c].index,name:r[c].name,labels:s,notes:d,note:r[c].note,stars:r[c].stars,inTime:r[c].inTime,outTime:r[c].outTime})}var b=[];if(a.groups)for(var h=Object.keys(a.groups),m=0;m<h.length;m++)b.push(h[m]);var O=[];if(a.users)for(var p=Object.keys(a.users),g=0;g<p.length;g++)O.push(p[g]);var x={key:t,instances:n,name:a.name,owner:a.owner,lastOpened:a.lastOpened,created:a.created,video:a.video,users:O,groups:b};f(x)}else console.log("No Data")})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[b]);function aa(){he(!0)}function na(){he(!1)}Object(n.useEffect)((function(){var e=D.b.auth().onAuthStateChanged((function(e){e||r.replace("/signin?url="+c.pathname)}));if(k&&0===re.length){var t=new URLSearchParams(c.search),a=t.get("key"),n=t.get("video"),i=l.filter((function(e){return e.key===n}))[0];if(!0===k.permissions.createOwnPlaylist?M(!0):M(!1),i&&Object(be.o)(i,d,k)){L(!0),y(i);var s=!1;if(ta(a),b){ze(b.key),_e(b.name),b.owner===k.key?Vt(!0):Vt(!1);var o=[];b.instances.sort((function(e,t){return e.index>t.index?1:e.index<t.index?-1:0})).forEach((function(e){e.labels.length>0&&(s=!0),e.labels.forEach((function(e){e.filteredOutByLabel=!1})),o.push(nl(e.key,e.index,e.inTime,e.outTime,e.name,e.labels,e.notes,e.stars))})),jt(s),ce(o),Xt([{stars:0,selected:!0},{stars:1,selected:!0},{stars:2,selected:!0},{stars:3,selected:!0}]);var u=D.b.database().ref("timelines");console.log("Updating Timeline Last Opened"),u.child(b.key).update({lastOpened:P()().toString()}),D.b.database().ref("timelineinfo").child(b.key).update({lastOpened:P()().toString()})}}else L(!1)}return function(){return e()}}),[k,b]);var ia=function(e){return function(){if(!zt)return Ae("Cannot edit shared timeline"),Me("Create your own copy of this timeline, which you can then edit?"),void Be(!0);he(!1),ge(e),de(!0)}},ra=function(e){return function(){ot(e),v.current.seekTo(e.inTime),he(!0)}};function ca(){return(ca=Object(ie.a)(ne.a.mark((function e(){return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:sa(),Se(!0),he(!1);case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var sa=function(){F(null)};function oa(){ge(null),V("Mark In"),Z(),de(!1)}var la=function(e){return function(){e.selected=!e.selected,ce(Object(Jt.a)(re))}};var da=function(e){if(sa(),!zt)return Ae("Cannot edit shared timeline"),Me("Create your own copy of this timeline, which you can then edit?"),void Be(!0);var t=e.target.files;if(FileReader&&t&&t.length){var n=new FileReader,i=a(990);n.onload=function(){for(var e=Object(Jt.a)(t),a=0;a<t.length;a++)t[a].key=Object(be.m)(25);if(1===e.length){var n=new FileReader;n.readAsText(e[0]),n.onloadend=function(){var e=n.result,t=i.xml2json(e,{compact:!0,spaces:4}),a=JSON.parse(t).file.ALL_INSTANCES.instance,r=[];a.forEach((function(e){var t=e.code._text,a=parseFloat(e.start._text),n=parseFloat(e.end._text),i=[],c=e.label;if(void 0!==c)if(Array.isArray(c))c.forEach((function(e){var t={};t.text=e.text._text,t.filteredOutByLabel=!1,e.group&&(t.group=e.group._text),e.start&&(t.start=e.start._text),i.push(t)}));else{var s={};s.text=c.text._text,s.filteredOutByLabel=!1,c.group&&(s.group=c.group._text),c.start&&(s.start=c.start._text),i.push(s)}var o=[],l=e.free_text;void 0!==l&&(Array.isArray(l)?l.forEach((function(e){o.push(e._text)})):o.push(l._text)),r.push({code:t,start:a,end:n,labels:i,notes:o})})),function(e){var t=re,a=re.length,n=!1;e.forEach((function(e){var i=D.b.database().ref("timelines"),r=Object(be.m)(19);i.child(Ye).child("instances").child(r).set({index:a,inTime:e.start,outTime:e.end,name:e.code,labels:Object(be.l)(e.labels),notes:Object(be.l)(e.notes),stars:0}),t=[].concat(Object(Jt.a)(t),[nl(r,a,e.start,e.end,e.code,e.labels,e.notes,0)]),e.labels.length>0&&(n=!0),a+=1})),jt(n),ce(t)}(r)}}},n.readAsDataURL(t[0])}};var ua=function(e,t){"clickaway"!==t&&Ut(!1)};function ja(e){var t=!1;return!0===e.filteredOutByCode&&(t=!0),0===e.labels.length?!0===e.filteredOutByLabels&&(t=!0):0===e.labels.filter((function(e){return!1===e.filteredOutByLabel})).length&&(t=!0),!0===e.filteredOutByRating&&(t=!0),!0!==t}return Object(G.jsxs)(G.Fragment,{children:[A&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsx)(C.a,{title:"Filter",children:Object(G.jsx)(w.a,{className:t.filterButton,component:"span",onClick:function(){yt(!0)},"aria-label":"openFilterButtonPress",children:Object(G.jsx)(Io.a,{})})}),Object(G.jsx)(Wt.a,{fluid:!0,className:t.pageContainer,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{className:t.columnPadding,lg:6,md:12,sm:12,children:g&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pr.a,{className:t.videoPlayer,ref:v,url:"https://vz-db0e7359-d70.b-cdn.net/"+g.key+"/playlist.m3u8",controls:!0,playing:fe,onPlay:aa,onPause:na,onEnded:na,onProgress:function(e){ct&&e.playedSeconds>ct.outTime&&(he(!1),ot(null))},width:"100%",height:"auto"}),Object(G.jsxs)(Mt.a,{className:t.titleRow,children:[Object(G.jsx)(Ht.a,{children:Object(G.jsx)(x.a,{className:t.displayName,children:g.displayName+" - "+qe})}),W&&Object(G.jsx)(C.a,{title:"Create Playlist",children:Object(G.jsx)(w.a,{onClick:function(){return ca.apply(this,arguments)},className:t.menuButton,"aria-label":"createPlaylistButtonPress",children:Object(G.jsx)(Le.a,{})})}),Object(G.jsx)(w.a,{onClick:function(e){F(e.target)},className:t.menuButton,"aria-label":"moreButtonPress",children:Object(G.jsx)(Wr.a,{})})]})]})}),Object(G.jsxs)(Ht.a,{lg:6,md:12,sm:12,children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){if(!zt)return Ae("Cannot edit shared timeline"),Me("Create your own copy of this timeline, which you can then edit?"),void Be(!0);"Mark In"===z?(V("Mark Out"),Z(v.current.getCurrentTime())):(ee(v.current.getCurrentTime()),he(!1),de(!0))},className:t.markInButton,children:z}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.tableContainer,children:Object(G.jsxs)(Ma.a,{"aria-label":"simple table",children:[Object(G.jsx)(za.a,{className:t.tableHead,children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{className:t.previewHeaderCell,align:"center"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",onClick:function(){"Ascending"===ht?(ce(re.sort((function(e,t){return e.inTime>t.inTime?1:-1}))),mt("Descending")):(ce(re.sort((function(e,t){return e.inTime<t.inTime?1:-1}))),mt("Ascending"))},children:"Time"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",onClick:function(){"Ascending"===ht?(ce(re.sort((function(e,t){return e.name.toLowerCase()>t.name.toLowerCase()?1:-1}))),mt("Descending")):(ce(re.sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?1:-1}))),mt("Ascending"))},children:"Name"}),ut&&Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",onClick:function(){"Ascending"===ht?(ce(re.sort((function(e,t){return Object(be.c)(e.labels)>Object(be.c)(t.labels)?1:-1}))),mt("Descending")):(ce(re.sort((function(e,t){return Object(be.c)(e.labels)<Object(be.c)(t.labels)?1:-1}))),mt("Ascending"))},children:"Details"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",onClick:function(){"Ascending"===ht?(ce(re.sort((function(e,t){return Object(be.c)(e.notes)>Object(be.c)(t.notes)?1:-1}))),mt("Descending")):(ce(re.sort((function(e,t){return Object(be.c)(e.notes)<Object(be.c)(t.notes)?1:-1}))),mt("Ascending"))},children:"Note"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",onClick:function(){"Ascending"===ht?(ce(re.sort((function(e,t){return e.stars>t.stars?1:-1}))),mt("Descending")):(ce(re.sort((function(e,t){return e.stars<t.stars?1:-1}))),mt("Ascending"))},children:"Stars"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Playlist"})]})}),0===re.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:re.filter((function(e){return!0===ja(e)})).map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:ra(e),component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:Object(G.jsx)(w.a,{onClick:ra(e),children:Object(G.jsx)(Ao.a,{})})}),Object(G.jsx)(Ka.a,{onClick:ia(e),component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:Object(be.t)(e.inTime)}),Object(G.jsx)(Ka.a,{onClick:ia(e),align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),ut&&Object(G.jsx)(Ka.a,{onClick:ia(e),align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:Object(be.d)(e.labels)}),Object(G.jsx)(Ka.a,{onClick:ia(e),align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:Object(be.c)(e.notes)}),Object(G.jsxs)(Ka.a,{onClick:ia(e),align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:[0===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),1===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),2===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),3===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon})]})]}),Object(G.jsx)(Ka.a,{align:"center",children:Object(G.jsx)("div",{children:Object(G.jsx)(Lt.a,{checked:e.selected,onChange:la(e),color:"primary"})})})]},e.key)}))})]})})]})]})})]}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:T,open:Boolean(T),onClose:sa,children:[Object(G.jsx)(Xi.a,{onClick:function(){if(!zt)return Ae("Cannot share timeline"),Me("Create your own copy of this timeline, which you can then share?"),void Be(!0);sa(),nt(!0)},children:"Share Timeline"}),zt?Object(G.jsxs)("div",{children:[Object(G.jsx)("input",{type:"file",id:"xml-input",onChange:da,hidden:!0}),Object(G.jsx)("label",{htmlFor:"xml-input",children:Object(G.jsx)(Xi.a,{htmlFor:"xml-input",children:"Import XML Timeline"})})]}):Object(G.jsx)(Xi.a,{htmlFor:"xml-input",onClick:da,children:"Import XML Timeline"}),Object(G.jsx)(Xi.a,{onClick:function(){!function(e,t){var n=a(284),i=[],r=[];e.sort((function(e,t){return e.index>t.index?1:e.index<t.index?-1:0})).forEach((function(e){i.includes(e.name)||i.push(e.name);var t=[{ID:e.index+1},{start:e.inTime},{end:e.outTime},{code:e.name}];e.stars>0&&t.push({stars:e.stars}),e.labels.forEach((function(e){var a=[{text:e.text}];e.group&&a.push({group:e.group}),e.start&&a.push({start:e.start}),t.push({label:a})})),e.notes.forEach((function(e){t.push({free_text:e})})),r.push({instance:t})}));var c=[];i.forEach((function(e){var t=[{code:e},{R:0},{G:39321},{B:13107},{red:0},{green:.6},{blue:.2},{fontRed:1},{fontGreen:1},{fontBlue:1}];c.push({row:t})}));var s=n([{file:[{ALL_INSTANCES:r},{ROWS:c}]}],!0),o=new Blob([s],{type:"text/xml"}),l=URL.createObjectURL(o),d=document.createElement("a");d.download=t+".xml",d.href=l,d.click()}(b.instances,b.name),F(null)},children:"Export XML Timeline"}),Object(G.jsx)(Xi.a,{onClick:function(){if(sa(),!zt)return Ae("Cannot rename shared timeline"),Me("Create your own copy of this timeline, which you can then edit?"),void Be(!0);ke(!0)},children:"Rename Timeline"}),zt&&Object(G.jsx)(Xi.a,{onClick:function(){sa(),Je(!0)},children:"Delete Timeline"})]}),Object(G.jsx)(Yo,{open:le,onClose:oa,onAdd:function(e,t,a){if(e){var n=D.b.database().ref("timelines"),i=Object(be.m)(19);n.child(Ye).child("instances").child(i).set({index:re.length,inTime:X,outTime:$,name:e,notes:Object(be.l)(t),stars:a}),ce([].concat(Object(Jt.a)(re),[nl(i,re.length,X,$,e,[],t,a)]))}he(!0),oa()},onEdit:function(e){D.b.database().ref("timelines").child(Ye).child("instances").child(e.key).update({inTime:e.inTime,outTime:e.outTime,name:e.name,notes:Object(be.l)(e.notes),stars:e.stars}),oa()},onDelete:function(e){var t=D.b.database().ref("timelines");ce(re.filter((function(t){return t.key!==e.key}))),t.child(Ye).child("instances").child(e.key).remove(),oa()},rowToEdit:pe}),xt&&Object(G.jsx)(_o,{open:xt,onClose:function(e,t,a,n){e&&re.forEach((function(t){e.includes(t.name)?t.filteredOutByCode=!1:t.filteredOutByCode=!0})),ea(n),t&&re.forEach((function(e){0===e.labels.length?t.includes("(No Detail)")?e.filteredOutByLabels=!1:e.filteredOutByLabels=!0:e.labels.forEach((function(e){t.includes(e.text)?e.filteredOutByLabel=!1:e.filteredOutByLabel=!0}))})),a&&re.forEach((function(e){a.includes(e.stars)?e.filteredOutByRating=!1:e.filteredOutByRating=!0})),kt(),yt(!1)},rows:re,ratings:_t,groupsAfterFiltering:$t}),Object(G.jsx)(Na,{open:ve,onClose:function(e,t){""!==e&&t&&(D.b.database().ref("timelines").child(Ye).update({name:e}),D.b.database().ref("timelineinfo").child(Ye).update({name:e}),_e(e)),ke(!1)},title:"Rename Timeline",message:"Enter a name for the timeline.",initialValue:qe}),Object(G.jsx)(tl,{open:Ne,onClose:function(e,t,a){""!==e&&t&&function(e,t,a){if(e&&t){D.b.database().ref("fileusage").push({file:g.key,fileName:g.displayName,fileType:g.type,user:k.key,action:"PlaylistCreate",date:P()().toString()});var n=D.b.database().ref("playlists"),i={},c=[],s=0;e.forEach((function(e){if(e.selected&&ja(e)){var t="";a&&(t=Object(be.c)(e.notes));var n={index:s,inTime:e.inTime,outTime:e.outTime,name:e.name,note:t,labels:Object(be.l)(e.labels),stars:e.stars,video:g.key};s++,i[e.key]=n,c.push(n)}}));var o=Object(be.m)(19),l={key:o,name:t,owner:k.key,video:g.key,clips:i,created:P()().toString()};n.child(o).set(l),D.b.database().ref("playlistinfo").child(o).set({key:o,name:t,owner:k.key,video:g.key,created:P()().toString()}),r.replace("/playlist?key="+o)}}(re,e,a),Se(!1)},title:"Save Playlist",message:"Enter a name for the playlist."}),Qe&&Object(G.jsx)(ya,{title:"Delete Timeline",message:"Are you sure you want to delete this timeline?",open:Qe,onClose:function(e){!0===e&&k&&(D.b.database().ref("timelines").child(Ye).remove(),D.b.database().ref("timelineinfo").child(Ye).remove(),r.goBack()),Je(!1)}}),at&&Object(G.jsx)($o,{open:at,onClose:function(e){e>0&&(Dt(1===e?"Timeline Shared with 1 User":"Timeline Shared with "+e+" Users"),Et("success"),Ut(!0)),nt(!1)},timeline:b,file:g}),Fe&&Object(G.jsx)(el,{open:Fe,onClose:function(e){if(!0===e){console.log("Creating Own Copy of Timeline");var t=D.b.database().ref("timelines"),a={};b.instances.forEach((function(e){var t={index:e.index,inTime:e.inTime,outTime:e.outTime,name:e.name,stars:e.stars,labels:Object(be.l)(e.labels),notes:Object(be.l)(e.notes)};a[e.key]=t}));var n=Object(be.m)(19);t.child(n).set({name:qe+" (My Copy)",owner:k.key,video:g.key,created:P()().toString(),instances:a}),D.b.database().ref("timelineinfo").child(n).set({name:qe+" (My Copy)",owner:k.key,video:g.key,created:P()().toString()}),Dt("Timeline Copied Successfully"),Et("success"),Ut(!0),ce([]),f(null),r.replace("/analysis?video="+b.video+"&key="+n)}Be(!1)},title:Pe,message:We}),!1===A&&Object(G.jsx)(Nt,{}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:It,autoHideDuration:6e3,onClose:ua,children:Object(G.jsx)(il,{onClose:ua,severity:St,children:Bt})})}),Object(G.jsx)($e,{}),Object(G.jsx)(zo,{keyWasPressed:function(e){le||Ne||ve||Qe||at||"VIDEO"===e.target.nodeName||"Space"===e.code&&(e.preventDefault(),!0===fe?na():aa())}})]})}var cl=a(583),sl=a.n(cl),ol=Object(O.a)((function(e){return{list:{width:"100%",padding:0},container:{height:"100%",margin:0,paddingLeft:15},chip:{marginLeft:10,marginTop:5,marginBottom:5},nameTextField:{marginLeft:15,marginRight:15},title:{flexGrow:1},sectionTitle:{marginLeft:15,marginTop:10},notificationsSwitch:{marginLeft:15,marginTop:20},notificationsMessage:{marginLeft:25,marginRight:15,marginTop:10}}})),ll=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function dl(e){var t=ol(),a=Object(n.useContext)(h.b),r=a.users,c=a.groups,s=a.folders,o=Object(n.useContext)(h.d).currentUserData,l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(""),f=Object(m.a)(b,2),O=f[0],y=f[1],v=Object(n.useState)([]),k=Object(m.a)(v,2),N=k[0],S=k[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],R=T[1],A=Object(n.useState)(!1),L=Object(m.a)(A,2),I=L[0],U=L[1],W=Object(n.useState)(""),M=Object(m.a)(W,2),H=M[0],K=M[1];Object(n.useEffect)((function(){if(e.playlist){var t=[];e.playlist.users&&e.playlist.users.forEach((function(e){var a=r.filter((function(t){return t.key===e}))[0];a&&t.push(a)})),j(t);var a=[];e.playlist.groups&&e.playlist.groups.forEach((function(e){var t=c.filter((function(t){return t.key===e}))[0];t&&a.push(t)})),S(a);var n=[];e.file.groups&&0===F.length&&(e.file.groups.forEach((function(e){var t=c.filter((function(t){return t.key===e}))[0];if(t){var a=n.filter((function(e){return e.key===t.hub}))[0];if(a)"All Users"===t.name?t.displayName="All in '"+a.name+"'":t.displayName=t.name,a.groups.push(t);else{var i=s.filter((function(e){return e.key===t.hub}))[0];i&&("All Users"===t.name?t.displayName="All in '"+i.name+"'":t.displayName=t.name,n.push({key:t.hub,name:i.name,groups:[t]}))}}})),R(n))}}),[e.open]);var Y=function(e){return function(){var t=Object(Jt.a)(u);t.push(e),j(t),y("")}},q=function(e){return function(){var t=Object(Jt.a)(u);e.users.forEach((function(e){var a=r.filter((function(t){return t.key===e.key}));if(1===a.length){var n=a[0];0===t.filter((function(e){return e.key===n.key})).length&&t.push(n),j(t)}}));var a=Object(Jt.a)(N);a.push(e),S(a)}},_=function(e){return function(){var t=u.filter((function(t){return t.key!==e.key}));j(t)}},X=function(e){return function(){var t=Object(Jt.a)(u);e.users.forEach((function(a){var n=!0;N.forEach((function(t){t.key!==e.key&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!1)})),n&&(t=t.filter((function(e){return e.key!==a.key})))})),j(t);var a=N.filter((function(t){return t.key!==e.key}));S(a)}};function Z(e){for(var t=0;t<N.length;t++)for(var a=N[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}function Q(e){return e.displayName&&""!==e.displayName?1===e.users?e.displayName+" (1 User)":e.displayName+" ("+e.users.length+" Users)":1===e.users?e.name+" (1 User)":e.name+" ("+e.users.length+" Users)"}return Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:ll,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){y(""),K(""),U(!1),S([]),j([]),e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Share Playlist"}),Object(G.jsx)(C.a,{title:"Confirm",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){var t={};e.playlist.clips.forEach((function(e){var a={index:e.index,inTime:e.inTime,outTime:e.outTime,name:e.name,note:e.note,stars:e.stars,video:e.key};t[e.key]=a}));var a=Object(be.k)(N),n={};u.forEach((function(e){Z(e)||(n[e.key]=!0)})),D.b.database().ref("playlists").child(e.playlist.key).update({users:n,groups:a}),D.b.database().ref("playlistinfo").child(e.playlist.key).update({users:n,groups:a}),D.b.database().ref("fileusage").push({file:e.file.key,fileName:e.file.displayName,fileType:e.file.type,user:o.key,action:"PlaylistShare",usersSharedWith:n,groupsSharedWith:a,date:P()().toString()}),I&&D.b.database().ref("notifications").child(e.playlist.key).set({file:e.playlist.video,title:e.playlist.name,type:"playlist",users:Object(be.k)(u),message:H,date:P()().toString()});var i=u.length;y(""),K(""),U(!1),S([]),j([]),e.onClose(i),j([])},"aria-label":"close",children:Object(G.jsx)(Zo.a,{})})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:I,onChange:function(e){"send"===e.target.name&&U(e.target.checked)},name:"send",color:"primary"}),label:"Send Notifications",className:t.notificationsSwitch})}),I&&Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Notification Message",variant:"outlined",maxRows:15,value:H,onChange:function(e){K(e.target.value)},className:t.notificationsMessage})]}),Object(G.jsx)(xe.a,{style:{marginTop:10}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Selected"})}),Object(G.jsx)(Mt.a,{children:N.map((function(e){return Object(G.jsx)(V.a,{label:Q(e),className:t.chip,onDelete:X(e)},e.key)}))}),Object(G.jsx)(Mt.a,{children:u.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return!Z(e)&&Object(G.jsx)(V.a,{avatar:Object(G.jsx)(Qe.a,{alt:e.fullName,src:e.avatar}),label:e.fullName,className:t.chip,onDelete:e.key!==o.key&&_(e),variant:"outlined"},e.key)}))}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Groups"})}),Object(G.jsx)(Mt.a,{style:{margin:0,padding:0},children:Object(G.jsx)(Mt.a,{children:F.map((function(e){return e.groups&&e.groups.length>0&&Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:e.groups.filter((function(e){return!N.includes(e)})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(V.a,{label:Q(e),className:t.chip,clickable:!0,onClick:q(e)},e.key)}))})]},e.key)}))})}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:O,onChange:function(e){y(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:r.filter((function(t){return function(t){if(o){if(t.key===o.key)return!1;var a=!1;if(e.file.managers&&e.file.managers.includes(t.key)&&(a=!0),t.files.includes(e.file.key)&&(a=!0),F.forEach((function(e){e.groups.forEach((function(e){"Matthew"===t.firstName&&t.lastName,e.users.filter((function(e){return e.key===t.key})).length>0&&(a=!0)}))})),a&&0===u.filter((function(e){return e.key===t.key})).length&&t.fullName.toLowerCase().includes(O.toLowerCase()))return!0}return!1}(t)})).map((function(e){return Object(G.jsxs)("div",{onClick:Y(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var ul=a(168),jl=a.n(ul),bl=a(169),fl=a.n(bl),hl=Object(O.a)((function(e){return{listItem:{},reorderUpButton:{position:"absolute",top:0,padding:5},reorderDownButton:{position:"absolute",bottom:0,padding:5,margin:0},padding:{minWidth:35,width:35},normalPadding:{minWidth:15,width:15},reorderPadding:{minWidth:35,width:35}}}));function ml(e){var t=hl();return Object(G.jsx)("div",{children:Object(G.jsxs)(Ke.a,{className:t.listItem,button:!0,onClick:function(t){e.isReorderingClips||e.handleClipSelect(e.index,e.clip,t)},style:e.currentClip===e.clip?{background:"rgb(0, 149, 61)",color:"white",minHeight:75,padding:0}:{background:"rgb(230,230,230)",minHeight:75,padding:0,margin:0},children:[e.isReorderingClips?Object(G.jsxs)("div",{children:[Object(G.jsx)("div",{className:t.reorderPadding}),Object(G.jsx)(w.a,{className:t.reorderUpButton,component:"span",onClick:function(){e.handleMoveClipUpward(e.clip)},children:Object(G.jsx)(jl.a,{})}),Object(G.jsx)(w.a,{className:t.reorderDownButton,component:"span",onClick:function(){e.handleMoveClipDownward(e.clip)},children:Object(G.jsx)(fl.a,{})})]}):Object(G.jsx)("div",{className:t.normalPadding}),Object(G.jsx)(ze.a,{primary:e.clip.name,primaryTypographyProps:{style:{paddingRight:75,overflow:"hidden",WebkitLineClamp:1,WebkitBoxOrient:"vertical",display:"-webkit-box"}},secondary:function(e){var t="";return e.labels&&(t+=Object(be.d)(e.labels)),e.note&&""!==e.note&&(t+=" ("+e.note+")"),t}(e.clip),secondaryTypographyProps:{style:{paddingRight:100,overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",textAlign:"justify",textJustify:"inter-word"}}}),Object(G.jsx)(ea.a,{style:e.currentClip===e.clip?{color:"white"}:{},children:Object(be.t)(e.clip.inTime)+" - "+Object(be.t)(e.clip.outTime)})]})})}var Ol=Object(O.a)((function(e){return{root:{textAlign:"center"},pageContainer:{maxHeight:window.innerHeight-100,overflow:"scroll"},title:{marginTop:15},toggleButton:{marginLeft:20,width:30,height:30},button:{marginTop:5,marginLeft:5,marginRight:5,marginBottom:5},tableContainer:{marginTop:15,marginBottom:10,maxHeight:window.innerHeight-100},starIcon:{color:e.palette.primary.main},labelListItem:{paddingLeft:70}}}));function pl(e){var t=Ol(),a=Object(n.useReducer)((function(e){return e+1}),0),i=Object(m.a)(a,2)[1],r=Object(n.useState)([]),c=Object(m.a)(r,2),s=c[0],o=c[1],l=Object(n.useState)([]),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)([]),f=Object(m.a)(b,2),h=f[0],O=f[1];function p(){var t=[];s.forEach((function(e){e.selected&&t.push(e.code)}));var a=[];u.forEach((function(e){e.labels.forEach((function(e){e.selected&&a.push(e.text)}))}));var n=[];h.forEach((function(e){e.selected&&n.push(e.stars)})),e.onClose(t,a,n,u)}Object(n.useEffect)((function(){if(e.rows){var t=[],a=e.groupsAfterFiltering;e.rows.forEach((function(e){if(0===t.filter((function(t){return t.code===e.name})).length&&t.push({code:e.name,selected:!e.filteredOutByCode}),0===e.labels.length){var n=a.filter((function(e){return"(No Group)"===e.group}))[0];n?0===n.labels.filter((function(e){return"(No Detail)"===e.text})).length&&(n.labels=[{text:"(No Detail)",selected:!0}].concat(Object(Jt.a)(n.labels))):a=[{group:"(No Group)",labels:[{text:"(No Detail)",selected:!0}],selected:!0}].concat(Object(Jt.a)(a))}else e.labels.forEach((function(e){if(e.group){var t=a.filter((function(t){return t.group===e.group}))[0];t?0===t.labels.filter((function(t){return t.text===e.text})).length&&t.labels.push({text:e.text,selected:!0}):a.push({group:e.group,labels:[{text:e.text,selected:!0}],selected:!0})}else{var n=a.filter((function(e){return"(No Group)"===e.group}))[0];n?0===n.labels.filter((function(t){return t.text===e.text})).length&&n.labels.push({text:e.text,selected:!0}):a=[{group:"(No Group)",labels:[{text:e.text,selected:!0}],selected:!0}].concat(Object(Jt.a)(a))}}))})),t.sort((function(e,t){return e.code.toLowerCase()>t.code.toLowerCase()?1:-1})),o(t),j(a),O(e.ratings)}}),[e.open]);var g=function(e){return function(){e.selected=!e.selected,e.group&&e.labels.forEach((function(t){t.selected=e.selected})),i()}},x=function(e){return function(){var t=e[0];if(t){var a=!1;t.group?(a=!t.selected,e.forEach((function(e){e.selected=a,e.labels.forEach((function(e){e.selected=a}))}))):(a=!t.selected,e.forEach((function(e){e.selected=a}))),i()}}};return Object(G.jsxs)(dt.a,{"aria-labelledby":"simple-dialog-title",open:e.open,className:t.root,onClose:p,fullWidth:!0,maxWidth:"lg",children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.pageContainer,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Rows"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(s),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:s.map((function(e){var t="checkbox-list-label-".concat(e.code);return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":t}})}),Object(G.jsx)(ze.a,{id:t,primary:e.code})]},e.code)}))})})})]}),Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Detail"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(u),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:u.map((function(e){var a="checkbox-list-label-".concat(e.group);return Object(G.jsxs)(n.Fragment,{children:[Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a},onClick:g(e)})}),Object(G.jsx)(ze.a,{id:a,primary:e.group})]}),e.labels.map((function(e){return Object(G.jsxs)(Ke.a,{className:t.labelListItem,role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a}})}),Object(G.jsx)(ze.a,{id:a,primary:e.text})]},e.text)}))]},e.groups)}))})})})]}),Object(G.jsxs)(Ht.a,{lg:4,md:12,sm:12,children:[Object(G.jsx)("h4",{className:t.title,children:"Filter Rating"}),Object(G.jsx)(C.a,{title:"Toggle All",children:Object(G.jsx)(w.a,{onClick:x(h),className:t.toggleButton,"aria-label":"toggleAllButtonPress",children:Object(G.jsx)(Go.a,{})})}),Object(G.jsx)(Ya.a,{className:t.tableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:h.map((function(e){var a="checkbox-list-label-".concat(e.stars);return Object(G.jsxs)(Ke.a,{role:void 0,dense:!0,button:!0,onClick:g(e),children:[Object(G.jsx)(Ye.a,{children:Object(G.jsx)(Lt.a,{edge:"start",checked:e.selected,tabIndex:-1,disableRipple:!0,inputProps:{"aria-labelledby":a}})}),0===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),1===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),2===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(Yr.a,{className:t.starIcon})]}),3===e.stars&&Object(G.jsxs)("div",{children:[Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon}),Object(G.jsx)(wr.a,{className:t.starIcon})]})]},e.stars)}))})})})]})]})}),Object(G.jsx)(K.a,{className:t.button,variant:"contained",color:"primary",onClick:function(){p()},children:"Done"})]})}var gl=Object(O.a)((function(e){var t,a;return{videoPlayer:Object(Ze.a)({marginTop:0},e.breakpoints.down("sm"),{marginTop:0}),videoColumn:(t={},Object(Ze.a)(t,e.breakpoints.down("sm"),{paddingLeft:0}),Object(Ze.a)(t,"paddingRight",0),t),listColumn:{padding:0},eventList:{paddingTop:0,paddingLeft:10,paddingRight:10,maxHeight:window.innerHeight-180,overflow:"scroll"},pageContainer:{paddingBottom:65},embeddedPageContainer:{paddingBottom:30,paddingLeft:0},videoContainer:{position:"relative",paddingTop:"56.25%",marginTop:10},displayName:(a={flexGrow:1,paddingTop:10,fontSize:24},Object(Ze.a)(a,e.breakpoints.down("sm"),{paddingLeft:15,fontSize:19}),Object(Ze.a)(a,"overflowWrap","break-word"),Object(Ze.a)(a,"maxWidth","100%"),Object(Ze.a)(a,"display","-webkit-box"),Object(Ze.a)(a,"WebkitLineClamp",2),Object(Ze.a)(a,"textOverflow","ellipsis"),a),titleRow:{marginRight:0},starIcon:{color:e.palette.primary.main},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"},reorderButton:{position:"absolute",right:0,left:"auto"},filterButton:{position:"absolute",right:40,left:"auto"},uploadedByText:{color:"grey"}}}));function xl(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function yl(e){var t=gl(),a=Object(o.e)(),r=Object(o.f)(),c=Object(n.useState)(null),s=Object(m.a)(c,2),l=s[0],d=s[1],u=Object(n.useContext)(h.b),j=u.files,b=u.groups,f=u.users,O=u.playlistUsage,p=i.a.useRef(),g=Object(n.useContext)(h.d).currentUserData,y=Object(n.useState)(),v=Object(m.a)(y,2),k=v[0],S=v[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(),A=Object(m.a)(R,2),L=A[0],I=A[1],U=Object(n.useState)({}),W=Object(m.a)(U,2),M=W[0],H=W[1],K=Object(n.useState)(),Y=Object(m.a)(K,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(!1),ae=Object(m.a)(te,2),re=ae[0],ce=ae[1],se=Object(n.useState)("error"),oe=Object(m.a)(se,2),le=oe[0],de=oe[1],ue=Object(n.useState)(""),je=Object(m.a)(ue,2),fe=je[0],he=je[1],me=Object(n.useState)(!1),Oe=Object(m.a)(me,2),pe=Oe[0],ge=Oe[1],ye=Object(n.useState)(!1),ve=Object(m.a)(ye,2),ke=ve[0],Ce=ve[1],we=Object(n.useState)(!1),Ne=Object(m.a)(we,2),Se=Ne[0],Ee=Ne[1],Te=Object(n.useState)(!1),Fe=Object(m.a)(Te,2),Be=Fe[0],De=Fe[1],Re=Object(n.useState)(!1),Pe=Object(m.a)(Re,2),Ae=Pe[0],Le=Pe[1],Ie=Object(n.useState)([]),Ue=Object(m.a)(Ie,2),We=Ue[0],Me=Ue[1],Ke=Object(n.useState)([]),Ye=Object(m.a)(Ke,2),ze=Ye[0],Ve=Ye[1],Ge=Object(n.useState)(""),qe=Object(m.a)(Ge,2),_e=qe[0],Xe=qe[1],Ze=Object(n.useState)(""),Qe=Object(m.a)(Ze,2),Je=Qe[0],et=Qe[1],tt=Object(n.useState)(!0),nt=Object(m.a)(tt,2),it=nt[0],rt=nt[1],ct=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("playlists").child(t),L?console.log("Already Read Playlist"):(console.log("Reading Playlist from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.clips)for(var i=Object.keys(a.clips),r=Object.values(a.clips),c=0;c<i.length;c++){var s=[];if(r[c].labels)for(var o=Object.values(r[c].labels),l=0;l<o.length;l++)s.push(o[l]);s.forEach((function(e){e.filteredOutByLabel=!1})),n.push({key:i[c],index:r[c].index,inTime:r[c].inTime,outTime:r[c].outTime,name:r[c].name,note:r[c].note,labels:s,stars:r[c].stars,video:r[c].video,filteredOutByCode:!1,filteredOutByRating:!1,filteredOutByLabels:!1})}var d=[];if(a&&a.groups)for(var u=Object.keys(a.groups),j=0;j<u.length;j++)d.push(u[j]);var b=[];if(a&&a.users)for(var f=Object.keys(a.users),h=0;h<f.length;h++)b.push(f[h]);if(a){var m={key:t,clips:n,name:a.name,created:a.created,owner:a.owner,video:a.video,users:b,groups:d};I(m)}})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[L]);function ot(){B(!0)}function lt(){B(!1)}function dt(e,t,a){V(t),p.current.seekTo(t.inTime,"seconds"),B(!0)}Object(n.useEffect)((function(){var t=D.b.auth().onAuthStateChanged((function(e){e||a.replace("/signin?url="+r.pathname)}));if(g){var n=new URLSearchParams(r.search),i="";if(e.playlistKey?(i=e.playlistKey,rt(!1)):(i=n.get("key"),rt(!0)),ct(i),L)if(Object(be.q)(L,b,g)){if(L.owner===g.key?De(!0):De(!1),L.owner){var c=f.filter((function(e){return e.key===L.owner}))[0];c&&Xe(c.firstName+" "+c.lastName)}L.created&&et(P()(L.created).format("MMMM D, YYYY"));var s=j.filter((function(e){return e.key===L.video}))[0];if(s)if(H(s),Object(be.o)(s,b,g)){S(!0),Me([{stars:0,selected:!0},{stars:1,selected:!0},{stars:2,selected:!0},{stars:3,selected:!0}]);var o=D.b.database().ref("playlistusage"),l=O.filter((function(e){return e.user===g.key&&e.playlist===L.key}))[0];l?o.child(l.key).update({lastOpened:P()().toString()}):O.length>0&&o.push({playlist:L.key,user:g.key,lastOpened:P()().toString()})}else S(!1)}else S(!1)}return function(){return t()}}),[g,L]);var ut=function(){d(null)};var jt=function(e,t){"clickaway"!==t&&ge(!1)};function bt(e){if(0!==e.index){var t=e.index,a=L.clips[t-1];a.index=t,e.index=t-1;var n=D.b.database().ref("playlists").child(L.key).child("clips");n.child(a.key).update({index:a.index}),n.child(e.key).update({index:e.index})}}function ft(e){if(e.index!==L.clips.length-1){var t=e.index,a=L.clips[t+1];a.index=t,e.index=t+1;var n=D.b.database().ref("playlists").child(L.key).child("clips");n.child(a.key).update({index:a.index}),n.child(e.key).update({index:e.index})}}function ht(e){var t=!1;return!0===e.filteredOutByCode&&(t=!0),0===e.labels.length?!0===e.filteredOutByLabels&&(t=!0):0===e.labels.filter((function(e){return!1===e.filteredOutByLabel})).length&&(t=!0),!0===e.filteredOutByRating&&(t=!0),!0!==t}return Object(G.jsxs)(G.Fragment,{children:[k&&Object(G.jsxs)(G.Fragment,{children:[it&&Object(G.jsx)(Pt,{}),it&&Object(G.jsx)(C.a,{title:"Edit Clip Order",children:Object(G.jsx)(w.a,{className:t.reorderButton,component:"span",onClick:function(){B(!1),V(null),Ee(!Se)},children:Object(G.jsx)(sl.a,{})})}),it&&Object(G.jsx)(C.a,{title:"Filter",children:Object(G.jsx)(w.a,{className:t.filterButton,component:"span",onClick:function(){Le(!0)},"aria-label":"openFilterButtonPress",children:Object(G.jsx)(Io.a,{})})}),Object(G.jsx)(Wt.a,{fluid:!0,className:it?t.pageContainer:t.embeddedPageContainer,children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(Ht.a,{className:t.videoColumn,lg:8,md:12,sm:12,children:M&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pr.a,{className:t.videoPlayer,ref:p,url:"https://vz-db0e7359-d70.b-cdn.net/"+M.key+"/playlist.m3u8",autoPlay:!1,controls:!0,playing:F,onPlay:ot,onPause:lt,onEnded:lt,onProgress:function(e){if(z&&e.playedSeconds>z.outTime){for(var t=L.clips.sort((function(e,t){return e.index>t.index?1:e.index<t.index?-1:0})).filter((function(e){return e.index>z.index})),a=0;a<t.length;a++){var n=t[a];if(ht(n))return p.current.seekTo(n.inTime,"seconds"),void V(n)}B(!1)}},onSeek:function(e){},width:"100%",height:"auto"}),Object(G.jsxs)(Mt.a,{className:t.titleRow,children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(x.a,{className:t.displayName,children:L.name}),it&&""!==_e&&Object(G.jsxs)("span",{className:t.uploadedByText,children:["Created By:",_e]}),it&&""!==Je&&Object(G.jsx)("span",{className:t.uploadedByText,children:" on "+Je})]}),it&&Object(G.jsx)(w.a,{onClick:function(e){d(e.target)},className:t.menuButton,"aria-label":"moreButtonPress",children:Object(G.jsx)(Wr.a,{})})]}),Object(G.jsx)(xe.a,{}),it&&Object(G.jsx)(ec,{file:L,videoPlayer:p,setIsTyping:function(e){Ce(e)}})]})}),Object(G.jsx)(Ht.a,{className:t.listColumn,lg:4,md:12,sm:12,children:Object(G.jsx)(He.a,{className:t.eventList,children:L.clips.filter((function(e){return!0===ht(e)})).sort((function(e,t){return e.index>t.index?1:e.index<t.index?-1:0})).map((function(e,t){return Object(G.jsxs)("div",{children:[Object(G.jsx)(ml,{clip:e,index:t,isReorderingClips:Se,currentClip:z,handleClipSelect:dt,handleMoveClipUpward:bt,handleMoveClipDownward:ft}),Object(G.jsx)(xe.a,{})]},e.key)}))})})]})})]}),!1===k&&Object(G.jsx)(Nt,{}),Object(G.jsxs)(N.a,{id:"menu",anchorEl:l,open:Boolean(l),onClose:ut,children:[Object(G.jsx)(Xi.a,{onClick:function(){ut(),ce(!0)},children:"Share Playlist"}),Be&&Object(G.jsx)(Xi.a,{onClick:function(){ut(),ee(!0)},children:"Rename Playlist"}),Be&&Object(G.jsx)(Xi.a,{onClick:function(){ut(),Z(!0)},children:"Delete Playlist"})]}),L&&Object(G.jsx)(Na,{open:$,onClose:function(e,t){""!==e&&t&&(D.b.database().ref("playlists").child(L.key).update({name:e}),D.b.database().ref("playlistinfo").child(L.key).update({name:e}),I((function(t){return Object(at.a)(Object(at.a)({},t),{},{name:e})}))),ee(!1)},title:"Rename Playlist",message:"Enter a name for the Playlist.",initialValue:L.name}),X&&Object(G.jsx)(ya,{title:"Delete Playlist",message:"Are you sure you want to delete this Playlist?",open:X,onClose:function(e){!0===e&&g&&(D.b.database().ref("playlists").child(L.key).remove(),D.b.database().ref("playlistinfo").child(L.key).remove(),D.b.database().ref("notifications").child(L.key).remove(),a.goBack()),Z(!1)}}),Ae&&Object(G.jsx)(pl,{open:Ae,onClose:function(e,t,a,n){e&&L.clips.forEach((function(t){e.includes(t.name)?t.filteredOutByCode=!1:t.filteredOutByCode=!0})),Ve(n),t&&L.clips.forEach((function(e){0===e.labels.length?t.includes("(No Detail)")?e.filteredOutByLabels=!1:e.filteredOutByLabels=!0:e.labels.forEach((function(e){t.includes(e.text)?e.filteredOutByLabel=!1:e.filteredOutByLabel=!0}))})),a&&L.clips.forEach((function(e){a.includes(e.stars)?e.filteredOutByRating=!1:e.filteredOutByRating=!0})),Le(!1)},rows:L.clips,ratings:We,groupsAfterFiltering:ze}),Object(G.jsx)(dl,{open:re,onClose:function(e){e>0&&(he(1===e?"Playlist Shared with 1 User":"Playlist Shared with "+e+" Users"),de("success"),ge(!0)),ce(!1)},playlist:L,file:M}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:pe,autoHideDuration:6e3,onClose:jt,children:Object(G.jsx)(xl,{onClose:jt,severity:le,children:fe})})}),Object(G.jsx)($e,{}),Object(G.jsx)(zo,{keyWasPressed:function(e){if(it){if(ke||re||$||X||"VIDEO"===e.target.nodeName)return;"Space"===e.code&&(e.preventDefault(),!0===F?lt():ot())}}})]})}var vl=a.p+"static/media/Draig-Regular.c0e3698f.otf",kl=a.p+"static/media/Draig-Bold.8e76faf6.otf",Cl=a.p+"static/media/Quatro-Slab-Regular.004e0572.ttf",wl=a.p+"static/media/FFGoodHeadline-Regular.fc5784ae.otf",Nl=a(585),Sl={fontFamily:"DraigRegular",fontStyle:"regular",fontDisplay:"swap",fontWeight:"600",src:"\n      local('Draig-Regular'),\n      url(".concat(vl,")\n    "),unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF"},El={fontFamily:"DraigBold",fontStyle:"bold",fontDisplay:"swap",fontWeight:"600",src:"\n      local('Draig-Bold'),\n      url(".concat(kl,")\n    "),unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF"},Tl={fontFamily:"QuatroRegular",fontStyle:"regular",fontDisplay:"swap",fontWeight:"600",src:"\n      local('Quatro-Slab-Regular'),\n      url(".concat(Cl,")\n    "),unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF"},Fl={fontFamily:"GoodHeadlineRegular",fontStyle:"regular",fontDisplay:"swap",fontWeight:"600",src:"\n      local('FFGoodHeadline-Regular'),\n      url(".concat(wl,")\n    "),unicodeRange:"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF"},Bl=Object(Nl.a)({typography:{fontFamily:['"Open Sans"',"QuatroRegular","Roboto"].join(","),h1:{fontFamily:"DraigRegular"},h2:{fontFamily:"DraigRegular"},h3:{fontFamily:"DraigRegular"},h4:{fontFamily:"DraigRegular"},h5:{fontFamily:"DraigRegular",fontSize:"30px"},h6:{fontFamily:"DraigRegular",fontSize:"22px"},button:{fontFamily:"DraigRegular"},body1:{fontFamily:"QuatroRegular"},bodyBold:{fontFamily:"QuatroRegular"}},overrides:{MuiCssBaseline:{"@global":{"@font-face":[El,Sl,Tl,Fl]}}},palette:{type:"light",primary:{main:"rgb(0, 149, 61)"},secondary:{main:"rgb(244, 36, 29)"}}}),Dl=Object(O.a)((function(e){return{headerImage:{height:100,marginTop:15},headerText:{height:100,padding:e.spacing(3,2),display:"flex",flexDirection:"column",justifyContent:"center"},bodyText:{margin:15},sectionTitle:{marginLeft:15},checkBox:{marginLeft:15},choosePasswordButton:{marginLeft:15},signatureBox:{border:"0.0625rem solid #9c9c9c",borderRadius:"0.25rem"},progress:{marginLeft:10}}}));function Rl(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Pl(){var e=Object(o.f)(),t=Dl(),a=Object(n.useContext)(h.b).userConsent,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(!1),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(!1),y=Object(m.a)(g,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)(),P=Object(m.a)(R,2),A=P[0],L=P[1],I=Object(n.useState)(""),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useState)(!1),_=Object(m.a)(q,2),X=_[0],Z=_[1],Q=Object(n.useState)(!1),J=Object(m.a)(Q,2),$=J[0],ee=J[1],te=Object(n.useState)(""),ae=Object(m.a)(te,2),re=ae[0],ce=ae[1];function se(){return(se=Object(ie.a)(ne.a.mark((function e(t,a){var n;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(O&&v&&N&&F)){e.next=13;break}if(0!==a){e.next=6;break}j("Please sign in the white box"),s(!0),e.next=11;break;case 6:if(Z(!0),!A){e.next=11;break}return n=D.b.database().ref("userconsent"),e.next=11,oe(A.key,t).then((function(){n.child(A.key).update({hasConsent:!0}),console.log("Verified"),V(!0),Z(!1)}));case 11:e.next=15;break;case 13:j("Please select all checkboxes"),s(!0);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(e,t){return new Promise((function(a,n){var i=D.b.storage(),r="signature.png";""!==W&&(r=W+".png"),i.ref().child("signatures/"+e+"/"+r).putString(t.split(",")[1],"base64",{contentType:"image/png"}).then((function(){console.log("Upload Successful"),a()})).catch((function(e){var t=e.code,a=e.message;console.log(t+":"+a),j(e.message),s(!0),n()}))}))}Object(n.useEffect)((function(){var t=new URLSearchParams(e.search),n=t.get("key");ce(t.get("email"));var i=a.filter((function(e){return e.key===n}))[0];i&&(L(i),M(i.name))}),[a,e]);var le=function(e){"checkboxOne"===e.target.name?p(e.target.checked):"checkboxTwo"===e.target.name?k(e.target.checked):"checkboxThree"===e.target.name?S(e.target.checked):"checkboxFour"===e.target.name&&B(e.target.checked)},de=function(e,t){"clickaway"!==t&&s(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsx)(Ht.a,{children:z?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Registration Completed, Thank You."})}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(K.a,{variant:"contained",color:"primary",onClick:function(){ee(!0),D.b.functions().httpsCallable("generateEmailActionLink")({email:re}).then((function(e){var t=e.data.link;ee(!1),window.location.replace(t)})).catch((function(e){console.log("Error"),console.log(e),console.log(e.code),console.log(e.message),console.log(e.details)}))},className:t.choosePasswordButton,children:"Choose Your Password"}),$&&Object(G.jsx)(ct.a,{className:t.progress})]})]}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("img",{className:t.headerImage,src:"images/behind_the_line.png",alt:"behind_the_line_image"}),Object(G.jsx)(x.a,{className:t.headerText,variant:"h3",gutterBottom:!0,children:"Are You Onside?"})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["Nodiant Online is an online management system built around the sharing of files in a secure environment so that team members / coach education students can login to their own personalised website, view/download these files and then comment around them to encourage self-reflection, analysis of performance together with communication and development away from direct contact. Nodiant will be used for some or all of the following purposes:",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"Sharing of video files amongst coach education students relating to course content"}),Object(G.jsx)("li",{children:"Sharing of video files amongst coach education students relating to mentoring sessions"}),Object(G.jsx)("li",{children:"Sharing of video files relating to course tasks"}),Object(G.jsx)("li",{children:"Closed dialogue between Coach Educators and individual coach education students relating to course content and / or mentoring"}),Object(G.jsx)("li",{children:"Open dialogue between Coach Educators and groups of coach education students"}),Object(G.jsx)("li",{children:"Collection, storage and where appropriate sharing of data relating to the course"}),Object(G.jsx)("li",{children:"Sharing of administrative data amongst coach educators and coach education students"})]}),"We all have a responsibility to ensure that everyone involved in football finds it to be a fun, safe and positive experience."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["A copy of the FAW Safeguarding Policy is available from"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"//faw.org.uk/safeguarding",target:"_blank",rel:"noopener noreferrer",children:"www.faw.org.uk/safeguarding"}),". The Football Association of Wales (FAW) and FAW Trust will take all steps to ensure that images / videos of coach education students are used solely for their intended purposes. If you become aware that these images are being used inappropriately, please contact the FAW Safeguarding Department on 02920 435830"]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"ICT Acceptable Use"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The Football Association of Wales (FAW) and FAW Trust understands the importance of technology for enhancing coach education and course content. However, we also recognise the need for vital safeguards to be in place to ensure coach education student welfare remains paramount whilst online or using social media.",Object(G.jsx)("p",{}),"We ask that all coach education students and coach educators take the time to read through this document.",Object(G.jsx)("p",{}),Object(G.jsxs)("ul",{children:[Object(G.jsx)("li",{children:"I will be responsible for my behaviour when using resources provided by the Football Association of Wales, FAW Trust and their affiliated partners and when accessing online platforms or portals."}),Object(G.jsx)("li",{children:"I will not deliberately browse, download or access material that could be considered offensive. If I accidentally come across such material I will immediately report this to the Course Leader."}),Object(G.jsx)("li",{children:"I will not use social media or the internet to send anyone material that could be considered threatening, offensive, bullying or illegal."}),Object(G.jsx)("li",{children:"I understand that my use of the internet whilst on Coach Education Courses on FAW or FAW Trust issued resources can be monitored, logged and made available to essential and relevant personnel if necessary."}),Object(G.jsx)("li",{children:"I will not give out my personal information such as name, age, address or telephone number to strangers."}),Object(G.jsx)("li",{children:"I will not share my log-on details with anybody."}),Object(G.jsx)("li",{children:"I will not download and share course content with anybody."}),Object(G.jsx)("li",{children:"I understand that these rules are designed to ensure my safety and if they are not followed I could be subject to disciplinary action."})]})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.sectionTitle,variant:"h5",gutterBottom:!0,children:"Consent"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:"Please tick the boxes below:"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:O,onChange:le,name:"checkboxOne",color:"primary"}),label:"I give my consent for my administrative data, course related images and videos to be securely stored on the Nodiant Online platform and understand that this information may be shared with relevant and essential personnel."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:v,onChange:le,name:"checkboxTwo",color:"primary"}),label:"I give my consent for relevant and essential personnel to communicate with myself in relation to my course related activities, performance and progress."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:N,onChange:le,name:"checkboxThree",color:"primary"}),label:"I hereby grant the Football Association of Wales (FAW) and it's affiliated partners the right to use the photograph(s) and any reproductions or adaptations of the photograph(s) for all general purposes in relation to the FAW's and it's affiliated partners work including, without limitation, the right to use them in publicity materials, books, newspapers, magazine articles, and on the FAW and its affiliated partners' websites and social media outlets."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{className:t.checkBox,checked:F,onChange:le,name:"checkboxFour",color:"primary"}),label:"I understand and agree to support the safe use of ICT whilst on coach education courses wtih the FAW and FAW Trust."})}),Object(G.jsx)(Mt.a,{children:Object(G.jsxs)(x.a,{className:t.bodyText,variant:"body1",gutterBottom:!0,children:["The FAW & FAW Trust are committed to safeguarding the privacy of the personal data you have supplied. The supplied data will be held in accordance with data protection legislation and principles and as per the provisions of the General Data Protection Regulation (GDPR). The information that we are obliged to provide you in accordance with the provisions of the GDPR is contained in the"," ",Object(G.jsx)("a",{style:{display:"inline"},href:"https://faw.cymru/privacy-policy/",target:"_blank",rel:"noopener noreferrer",children:"FAW Trust Privacy Notice"})," ",". By signing this form, you confirm that you have read and understood the FAW / FAW Trust Privacy Notices."]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(x.a,{className:t.bodyText,variant:"body2",children:"Signed By: ".concat(W)})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(yo,{imageData:function(e,t){return se.apply(this,arguments)}})})]})})}),X&&Object(G.jsx)(ut.a,{}),Object(G.jsx)("div",{children:Object(G.jsx)(st.a,{open:c,autoHideDuration:6e3,onClose:de,children:Object(G.jsx)(Rl,{onClose:de,severity:"error",children:u})})})]})}var Al=Object(O.a)((function(e){return{recentTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},allTableContainer:{marginTop:15,marginBottom:50,overflow:"scroll"}}}));function Ll(e){var t=e.children,a=e.value,n=e.index,i=Object(Es.a)(e,["children","value","index"]);return Object(G.jsx)("div",Object(at.a)(Object(at.a)({role:"tabpanel",hidden:a!==n,id:"simple-tabpanel-".concat(n),"aria-labelledby":"simple-tab-".concat(n)},i),{},{children:a===n&&Object(G.jsx)(Mn.a,{p:3,children:Object(G.jsx)(x.a,{children:t})})}))}function Il(e){var t=Al(),a=Object(n.useContext)(h.d).currentUserData,i=Object(o.e)(),r=Object(n.useContext)(h.b),c=r.files,s=r.folders,l=r.playlistInfo,d=r.playlistUsage,u=r.timelineInfo,j=r.groups,b=Object(n.useState)(0),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)([]),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)([]),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)([]),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)([]),D=Object(m.a)(B,2),R=D[0],A=D[1];Object(n.useEffect)((function(){if(a){var e=[],t=[];l.forEach((function(n){if(Object(be.q)(n,j,a)){n.owner===a.key&&(n.isOwner=!0);var i=c.filter((function(e){return e.key===n.video}))[0];if(i){var r=s.filter((function(e){return e.key===i.folder}))[0];n.filePath=Object(be.h)(i,r,s)}e.push(n);var o=d.filter((function(e){return e.user===a.key&&e.playlist===n.key}))[0];o&&(n.lastOpened=o.lastOpened,t.push(n))}})),t.sort((function(e,t){return P()(e.lastOpened)<P()(t.lastOpened)?1:P()(t.lastOpened)<P()(e.lastOpened)?-1:0})),e.sort((function(e,t){return e.name>t.name?1:t.name>e.name?-1:0})),N(t),v(e);var n=[],i=[];u.forEach((function(e){if(Object(be.r)(e,j,a)){e.owner===a.key&&(e.isOwner=!0);var t=c.filter((function(t){return t.key===e.video}))[0];if(t){var r=s.filter((function(e){return e.key===t.folder}))[0];e.filePath=Object(be.h)(t,r,s)}n.push(e),e.lastOpened&&i.push(e)}})),i.sort((function(e,t){return P()(e.lastOpened)<P()(t.lastOpened)?1:P()(t.lastOpened)<P()(e.lastOpened)?-1:0})),n.sort((function(e,t){return e.name>t.name?1:t.name>e.name?-1:0})),A(i),F(n)}}),[a,l,u,d]);var L=function(e){return function(){i.push("/playlist?key="+e.key)}},I=function(e){return function(){i.push("/analysis?video="+e.video+"&key="+e.key)}};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(pt.a,{square:!0,children:Object(G.jsxs)(Ts.a,{value:O,indicatorColor:"primary",textColor:"primary",onChange:function(e,t){p(t)},centered:!0,children:[Object(G.jsx)(Fs.a,{label:"Playlists"}),Object(G.jsx)(Fs.a,{label:"Timelines"})]})}),Object(G.jsxs)(Ll,{value:O,index:0,children:[Object(G.jsx)("h5",{children:"Recent Playlists"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.recentTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===w.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:w.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:L(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:L(e),align:"left",style:e.isOwner&&{color:"rgb(0, 149, 61)"},children:e.filePath})]},e.key)}))})})}),Object(G.jsx)("h5",{children:"All Playlists"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.allTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===y.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:y.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:L(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:L(e),align:"left",style:e.isOwner&&{color:"rgb(0, 149, 61)"},children:e.filePath})]},e.key)}))})})})]}),Object(G.jsxs)(Ll,{value:O,index:1,children:[Object(G.jsx)("h5",{children:"Recent Timelines"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.recentTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===R.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)",color:"rgb(0, 149, 61)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:R.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:I(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:I(e),align:"left",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.filePath})]},e.key)}))})})}),Object(G.jsx)("h5",{children:"All Timelines"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.allTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===T.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:T.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:I(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:I(e),align:"left",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.filePath})]},e.key)}))})})})]}),Object(G.jsx)($e,{})]})}var Ul=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:75},newSurveyButton:{marginBottom:15},addButton:{color:"rgb(0, 149, 61)"},searchResultsTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},mySurveysTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},sharedSurveysTableContainer:{marginTop:15,marginBottom:50,overflow:"scroll"},userNameSearchTextField:{marginTop:10},fromCalendar:{maxWidth:300},toCalendar:{maxWidth:300},searchButton:{marginTop:15},dividerDiv:{height:15,width:"100%"},paper:{padding:15}}}));function Wl(e){var t=Ul(),a=Object(n.useContext)(h.d).currentUserData,i=Object(o.e)(),r=Object(n.useContext)(h.b),c=r.surveyInfo,s=r.users,l=r.groups,d=Object(n.useState)(),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)([]),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)([]),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)([]),A=Object(m.a)(R,2),L=A[0],I=A[1],U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(""),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(""),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!1),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1];Object(n.useEffect)((function(){if(a){var e=[],t=[],n=[];a.permissions.createSurveys&&re(!0),c.forEach((function(i){i.createdBy===a.key&&(i.canEdit=!0,i.canViewResults=!0,i.canTake=!0,e.push(i),n.push(i));var r=i.users.filter((function(e){return e.key===a.key}))[0];r&&(i.canTake||(i.canEdit=r.canEdit,i.canViewResults=r.canViewResults,i.canTake=!0,t.push(i),n.push(i))),i.groups.forEach((function(e){var r=l.filter((function(t){return t.key===e.key}))[0];r&&r.users.filter((function(e){return e.key===a.key})).length>0&&(i.canTake||(i.canEdit=e.canEdit,i.canViewResults=e.canViewResults,i.canTake=!0,t.push(i),n.push(i)))}))})),S(e),B(t),k(n)}}),[a,c,i]);var ce=function(e){return function(){i.push("/surveys/e?key="+e.key)}},se=function(e){return function(){i.push("/surveys/a?key="+e.key)}},oe=function(e){return function(){i.push("/surveys/r?key="+e.key)}};function le(e){var t=e.target.value;"surveyNameSearch"===e.target.id?Q(t):"userNameSearch"===e.target.id&&te(t)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Wt.a,{className:t.pageContainer,children:[ie&&Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.newSurveyButton,onClick:function(){H(!0)},children:"New Survey"}),Object(G.jsx)("h5",{children:"Search"}),Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(nt.a,{fullWidth:!0,value:Z,id:"surveyNameSearch",onChange:le,label:"Survey Name",variant:"outlined"}),Object(G.jsx)(nt.a,{fullWidth:!0,className:t.userNameSearchTextField,value:ee,id:"userNameSearch",onChange:le,label:"From User",variant:"outlined"})]}),Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h6",{children:"From"}),Object(G.jsx)(Ci.a,{className:t.fromCalendar,onChange:function(e){b(e)},defaultView:"month",value:j})]}),Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h6",{children:"To"}),Object(G.jsx)(Ci.a,{className:t.toCalendar,onChange:function(e){g(e)},defaultView:"month",value:p})]})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{children:Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.searchButton,onClick:function(){var e=[];console.clear(),v.forEach((function(t){console.log(t);var a=!1;if(""!==Z&&(t.title.toLowerCase().includes(Z.toLowerCase())||(a=!0)),""!==ee){var n=s.filter((function(e){return e.key===t.createdBy}))[0];n&&(n.fullName.toLowerCase().includes(ee.toLowerCase())||(a=!0))}void 0!==j&&void 0!==j?(P()(t.lastUpdated).isBefore(j)&&(a=!0),P()(t.lastUpdated).isAfter(p)&&(a=!0)):void 0!==j?P()(t.lastUpdated).isBefore(j)&&(a=!0):void 0!==p&&P()(t.lastUpdated).isAfter(p)&&(a=!0),a||e.push(t)})),I(e),q(!0)},children:"Search"})})})]}),V&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"Search Results"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:L.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}),e.canViewResults?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}),Object(G.jsx)(Ka.a,{onClick:oe(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Take Survey"})]},e.key)}))})})})})]}),N.length>0&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"My Surveys"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:N.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}),e.canViewResults?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}),Object(G.jsx)(Ka.a,{onClick:oe(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Take Survey"})]},e.key)}))})})})})]}),F.length>0&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"Surveys Shared With Me"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:F.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Questions"}),e.canViewResults?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Results"}),Object(G.jsx)(Ka.a,{onClick:oe(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Take Survey"})]},e.key)}))})})})})]})]}),Object(G.jsx)($e,{}),Object(G.jsx)(Na,{open:M,onClose:function(e,t){if(t){if(""!==e){var n=D.b.database().ref("surveyinfo"),r=Object(be.m)(15),c={createdBy:a.key,createdOn:P()().toString(),lastUpdated:P()().toString(),intro:"",title:e,anonymous:!0};n.child(r).set(c),H(!1),i.push("/surveys/e?key="+r)}}else H(!1)},title:"New Survey",message:"Enter a name for the survey.",initialValue:""})]})}var Ml=a(1086),Hl=a(1079),Kl=Object(O.a)((function(e){return{pageContainer:{padding:0},paper:{padding:15},dividerDiv:{height:15,width:"100%"},divider:{marginTop:20,marginBottom:20,width:"100%"},row:{padding:0,margin:0},inputTextField:{},formControl:{minWidth:120},numericAnswerControl:{minWidth:160},calendar:{maxWidth:350},deleteIcon:{},switch:{marginTop:0,marginBottom:0}}}));function Yl(e){var t=Kl(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useReducer)((function(e){return e+1}),0),r=Object(m.a)(i,2)[1],c=Object(n.useState)({}),s=Object(m.a)(c,2),o=s[0],l=s[1],d=Object(n.useState)(""),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)("Short Text"),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(!1),y=Object(m.a)(x,2),v=y[0],k=y[1],N=Object(n.useState)([]),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useState)([]),B=Object(m.a)(F,2),R=B[0],P=B[1];function A(){return D.b.database().ref("surveys/"+e.surveyKey+"/questions/"+o.key)}function L(e){var t=e.target.value;"questionText"===e.target.id&&(o.questionText=t,b(t),A().child("questionText").set(t))}function I(e){var t=E.filter((function(t){return t.index===parseInt(e.target.id)}))[0];if(t){var a=e.target.value;t.text=a,A().child("multipleChoiceOptions").child(t.key).child("text").set(a),r()}}function U(){var e=E.length,t={index:e,text:"Option "+(e+1),key:Object(be.m)(20)},a=[].concat(Object(Jt.a)(E),[t]);o.multipleChoiceOptions=a,T(a),A().child("multipleChoiceOptions").child(t.key).set(t)}Object(n.useEffect)((function(){a&&(P(Object(be.n)(151,0)),e.question&&(l(e.question),b(e.question.questionText),g(e.question.answerFormat),k(e.question.answerRequired),T(e.question.multipleChoiceOptions)))}),[a]);var W=function(e){return function(){var t=E.filter((function(t){return t.index===parseInt(e)}))[0];t&&A().child("multipleChoiceOptions").child(t.key).remove();var a=E.filter((function(t){return t.index!==parseInt(e)})),n=0;a.sort((function(e,t){return e.index>t.index?1:-1})).forEach((function(e){e.index=n,n+=1,A().child("multipleChoiceOptions").child(e.key).set(e)})),o.multipleChoiceOptions=a,T(a),r()}};return Object(G.jsx)(Wt.a,{fluid:!0,className:t.pageContainer,children:Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:j,onChange:L,id:"questionText",label:"Question",variant:"outlined"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(xe.a,{className:t.divider})}),Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsxs)(Ft.a,{variant:"outlined",className:t.formControl,children:[Object(G.jsx)(Tt.a,{id:"demo-simple-select-outlined-label",children:"Answer Format"}),Object(G.jsxs)(Bt.a,{labelId:"demo-simple-select-outlined-label",id:"demo-simple-select-outlined",value:p,onChange:function(e){var t=e.target.value;g(t),o.answerFormat=t,A().child("answerFormat").set(t)},label:"Answer Format",children:[Object(G.jsx)(Xi.a,{value:"Short Text",children:"Short Text"}),Object(G.jsx)(Xi.a,{value:"Long Text",children:"Long Text"}),Object(G.jsx)(Xi.a,{value:"Number",children:"Number"}),Object(G.jsx)(Xi.a,{value:"True or False",children:"True or False"}),Object(G.jsx)(Xi.a,{value:"Checkboxes",children:"Checkboxes"}),Object(G.jsx)(Xi.a,{value:"Multiple Choice",children:"Multiple Choice"}),Object(G.jsx)(Xi.a,{value:"Date",children:"Date"})]})]})}),Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)("div",{className:t.dividerDiv})}),"Short Text"===p&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:"",onChange:L,label:"Short Text Answer",variant:"outlined"})}),"Long Text"===p&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:"",onChange:L,label:"Long Text Answer",variant:"outlined"})}),"Number"===p&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsxs)(Ft.a,{className:t.numericAnswerControl,children:[Object(G.jsx)(Tt.a,{id:"demo-simple-select-label",children:"Numeric Answer"}),Object(G.jsx)(Bt.a,{labelId:"demo-simple-select-label",id:"demo-simple-select",value:1,children:R.map((function(e){return Object(G.jsx)(Xi.a,{value:e,children:e},e)}))})]})}),"True or False"===p&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsxs)(Hl.a,{"aria-label":"",name:"",value:!1,children:[Object(G.jsx)(At.a,{value:"True",control:Object(G.jsx)(Ml.a,{}),label:"True"}),Object(G.jsx)(At.a,{value:"False",control:Object(G.jsx)(Ml.a,{}),label:"False"})]})})}),"Checkboxes"===p&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsx)(Hl.a,{"aria-label":"",name:"",value:!1,children:E.sort((function(e,t){return e.index>t.index?1:-1})).map((function(e){return Object(G.jsxs)(Mt.a,{className:t.row,children:[Object(G.jsx)(At.a,{value:e.text,control:Object(G.jsx)(Lt.a,{disabled:!0}),label:Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:e.text,onChange:I,id:e.index.toString()})}),Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:W(e.index),"aria-label":"deleteoption",children:Object(G.jsx)(z.a,{})})]},e.key)}))})})}),Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(C.a,{title:"Add Option",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:U,"aria-label":"addoption",children:Object(G.jsx)(vt.a,{})})})})]}),"Multiple Choice"===p&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsx)(Hl.a,{"aria-label":"",name:"",value:!1,children:E.sort((function(e,t){return e.index>t.index?1:-1})).map((function(e){return Object(G.jsxs)(Mt.a,{className:t.row,children:[Object(G.jsx)(At.a,{value:e.text,control:Object(G.jsx)(Ml.a,{}),label:Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:e.text,onChange:I,id:e.index.toString()})}),Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:W(e.index),"aria-label":"deleteoption",children:Object(G.jsx)(z.a,{})})]},e.key)}))})})}),Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(C.a,{title:"Add Option",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:U,"aria-label":"addoption",children:Object(G.jsx)(vt.a,{})})})})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(xe.a,{className:t.divider})}),Object(G.jsxs)(Mt.a,{className:t.row,children:[Object(G.jsx)(At.a,{className:t.switch,control:Object(G.jsx)(Kt.a,{checked:v,onChange:function(){var e=!v;o.answerRequired=e,k(e),A().child("answerRequired").set(Object(be.a)(e))},name:"checkedB",color:"primary"}),label:"Answer Required"}),Object(G.jsx)(C.a,{title:"Delete Question",children:Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){e.handleDeleteQuestionClick(o)},children:Object(G.jsx)(Ut.a,{})})})]})]})})}var zl=Object(O.a)((function(e){return{list:{width:"100%",padding:0},container:{height:"100%",margin:0,paddingLeft:15},chip:{marginLeft:10,marginTop:5,marginBottom:5},nameTextField:{marginLeft:15,marginRight:15},title:{flexGrow:1},sectionTitle:{marginLeft:15,marginTop:10},notificationsSwitch:{marginLeft:15,marginTop:20},notificationsMessage:{marginLeft:25,marginRight:15,marginTop:10},noGroupsText:{marginLeft:30}}})),Vl=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Gl(e){var t=zl(),a=Object(n.useReducer)((function(e){return e+1}),0),r=Object(m.a)(a,2)[1],c=Object(n.useContext)(h.b),s=c.users,o=c.groups,l=c.folders,d=Object(n.useContext)(h.d).currentUserData,u=Object(n.useState)([]),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)([]),y=Object(m.a)(O,2),v=y[0],k=y[1],N=Object(n.useState)(""),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useState)([]),R=Object(m.a)(F,2),A=R[0],L=R[1],I=Object(n.useState)([]),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),K=Object(m.a)(H,2),Y=K[0],q=K[1],_=Object(n.useState)(""),X=Object(m.a)(_,2),Z=X[0],Q=X[1];Object(n.useEffect)((function(){if(e.surveyInfo){var t=[],a=[];e.surveyInfo.users&&s.forEach((function(n){if(n.canEdit=!1,n.canViewResults=!1,function(e){if(d){if(e.key===d.key)return!1;var t=!1;if((e.admins.includes(d.key)||e.createdBy===d.key||"System Digital Manager"===d.role)&&(t=!0),t)return!0}return!1}(n)){a.push(n);var i=e.surveyInfo.users.filter((function(e){return e.key===n.key}))[0];i&&(n.canEdit=i.canEdit,n.canViewResults=i.canViewResults,t.push(n))}})),k(a),f(t);var n=l.filter((function(e){return e.hub&&(e.managers.includes(d.key)||e.users.includes(d.key))})),i=[];n.forEach((function(t){var a=o.filter((function(e){return e.hub===t.key}));a.forEach((function(a){a.hubName=t.name,a.canEdit=!1,a.canViewResults=!1;var n=e.surveyInfo.groups.filter((function(e){return e.key===a.key}))[0];n&&(a.canEdit=n.canEdit,a.canViewResults=n.canViewResults,i.push(a))})),t.groups=a})),M(n),L(i)}}),[e.open]);var J=function(e){return function(){e.canEdit=!1,e.canViewResults=!1;var t=Object(Jt.a)(b);t.push(e),f(t),T("")}},$=function(e){return function(){e.canEdit=!1,e.canViewResults=!1;var t=Object(Jt.a)(A);t.push(e),L(t)}},ee=function(e){return function(){var t=b.filter((function(t){return t.key!==e.key}));f(t)}},te=function(e,t){return function(){"edit"===e?t.canEdit=!t.canEdit:"viewResults"===e&&(t.canViewResults=!t.canViewResults),r()}},ae=function(e){return function(){var t=Object(Jt.a)(b);e.users.forEach((function(a){var n=!0;A.forEach((function(t){t.key!==e.key&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!1)})),n&&(t=t.filter((function(e){return e.key!==a.key})))})),f(t);var a=A.filter((function(t){return t.key!==e.key}));L(a)}};function ne(e){return e.displayName&&""!==e.displayName?1===e.users?e.displayName+" (1 User)":e.displayName+" ("+e.users.length+" Users)":1===e.users?e.name+" (1 User)":e.name+" ("+e.users.length+" Users)"}return Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:Vl,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){T(""),Q(""),q(!1),L([]),f([]),e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Share Survey"}),Object(G.jsx)(C.a,{title:"Confirm",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){var t={};b.forEach((function(e){var a={};a.canEdit=e.canEdit,a.canViewResults=e.canViewResults,t[e.key]=a}));var a={};A.forEach((function(e){var t={};t.canEdit=e.canEdit,t.canViewResults=e.canViewResults,a[e.key]=t})),D.b.database().ref("surveyinfo").child(e.surveyInfo.key).update({users:t,groups:a}),Y&&D.b.database().ref("notifications").child(e.surveyInfo.key).set({title:e.surveyInfo.title,type:"survey",users:Object(be.k)(b),message:Z,date:P()().toString()});var n=b.length,i=A.length;T(""),Q(""),q(!1),L([]),f([]),e.onClose(n,i),f([])},"aria-label":"close",children:Object(G.jsx)(Zo.a,{})})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(oi.a,{row:!0,children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:Y,onChange:function(e){"send"===e.target.name&&q(e.target.checked)},name:"send",color:"primary"}),label:"Send Notifications",className:t.notificationsSwitch})}),Y&&Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Notification Message",variant:"outlined",value:Z,onChange:function(e){Q(e.target.value)},className:t.notificationsMessage})]}),Object(G.jsx)(xe.a,{style:{marginTop:10}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Selected"})}),Object(G.jsx)(Mt.a,{children:A.map((function(e){return Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(w.a,{"aria-label":"delete",onClick:ae(e),children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.name,secondary:e.hubName}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canEdit,onChange:te("edit",e),name:"checkedB",color:"primary"}),label:"Can Edit Questions"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canViewResults,onChange:te("viewResults",e),name:"checkedB",color:"primary"}),label:"Can View Answers"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:!0,name:"checkedB",color:"primary"}),label:"Can Take Survey"})]})}))}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(He.a,{dense:!0,className:t.root}),b.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return!function(e){for(var t=0;t<A.length;t++)for(var a=A[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}(e)&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(w.a,{"aria-label":"delete",onClick:ee(e),children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.fullName}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canEdit,onChange:te("edit",e),name:"checkedB",color:"primary"}),label:"Can Edit Questions"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canViewResults,onChange:te("viewResults",e),name:"checkedB",color:"primary"}),label:"Can View Answers"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:!0,name:"checkedB",color:"primary"}),label:"Can Take Survey"})]})})}))]}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Groups"})}),Object(G.jsx)(Mt.a,{style:{margin:0,padding:0},children:Object(G.jsx)(Mt.a,{children:W.map((function(e){return e.groups&&e.groups.length>0?Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:e.groups.filter((function(e){return!A.includes(e)})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(V.a,{label:ne(e),className:t.chip,clickable:!0,onClick:$(e)},e.key)}))})]},e.key):Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:Object(G.jsx)("span",{className:t.noGroupsText,children:"No Groups"})})]},e.key)}))})}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:E,onChange:function(e){T(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:v.filter((function(e){return function(e){return!!e.fullName.toLowerCase().includes(E.toLowerCase())}(e)&&!function(e){return 1===b.filter((function(t){return t.key===e.key})).length}(e)})).map((function(e){return Object(G.jsxs)("div",{onClick:J(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var ql=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:150},paper:{padding:15},dividerDiv:{height:15,width:"100%"},inputTextField:{},shareButton:{marginTop:0,marginLeft:0,marginBottom:15},appBar:{top:"auto",bottom:65,height:50},fabButton:{position:"absolute",zIndex:1,top:-30,left:0,right:0,margin:"0 auto"},deleteButton:{marginBottom:15},grow:{flexGrow:1},anonymousSwitch:{marginBottom:5}}}));function _l(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Xl(e){var t=ql(),a=Object(n.useContext)(h.d).currentUserData,r=Object(o.f)(),c=Object(o.e)(),s=Object(n.useContext)(h.b),l=s.surveyInfo,d=s.groups,u=Object(n.useState)(""),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(""),x=Object(m.a)(O,2),y=x[0],v=x[1],k=Object(n.useState)(""),N=Object(m.a)(k,2),S=N[0],E=N[1],T=Object(n.useState)(),F=Object(m.a)(T,2),B=F[0],R=F[1],P=Object(n.useState)(),A=Object(m.a)(P,2),L=A[0],I=A[1],U=Object(n.useReducer)((function(e){return e+1}),0),W=Object(m.a)(U,2)[1],M=Object(n.useState)("error"),H=Object(m.a)(M,2),Y=H[0],z=H[1],V=Object(n.useState)(""),q=Object(m.a)(V,2),_=q[0],X=q[1],Z=Object(n.useState)(!1),Q=Object(m.a)(Z,2),J=Q[0],$=Q[1],ee=Object(n.useState)(!1),te=Object(m.a)(ee,2),ae=te[0],re=te[1],ce=Object(n.useState)(!1),se=Object(m.a)(ce,2),oe=se[0],le=se[1],de=Object(n.useState)(!1),ue=Object(m.a)(de,2),je=ue[0],fe=ue[1],he=Object(n.useState)(!0),me=Object(m.a)(he,2),Oe=me[0],pe=me[1],ge=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("surveys").child(t),B?console.log("Already Read Survey"):(console.log("Reading Survey from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.questions)for(var i=Object.keys(a.questions),r=Object.values(a.questions),c=0;c<i.length;c++){var s=[],o={key:i[c],row:r[c].row,questionText:r[c].questionText,answerFormat:r[c].answerFormat,answerRequired:Object(be.s)(r[c].answerRequired)};if(r[c].multipleChoiceOptions)for(var l=Object.keys(r[c].multipleChoiceOptions),d=Object.values(r[c].multipleChoiceOptions),u=0;u<l.length;u++){var j={key:l[u],index:d[u].index,text:d[u].text};s.push(j)}o.multipleChoiceOptions=s,n.push(o)}var b={key:t,questions:n.sort((function(e,t){return e.row>t.row?1:-1}))};R(b)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[B]);function xe(e){var t=e.target.value;"surveyTitle"===e.target.id?(D.b.database().ref("surveyinfo").child(B.key).child("title").set(t),f(t)):"surveyIntro"===e.target.id&&(D.b.database().ref("surveyinfo").child(B.key).child("intro").set(t),v(t))}function ye(e){console.clear(),console.log(e),D.b.database().ref("surveys/"+B.key+"/questions/"+e.key).remove();var t=B.questions.filter((function(t){return t.key!==e.key})),a=0;t.sort((function(e,t){return e.row>t.row?1:-1})).forEach((function(e){e.row=a,D.b.database().ref("surveys/"+B.key+"/questions/"+e.key).child("row").set(a),a+=1})),B.questions=t,W()}Object(n.useEffect)((function(){var e=new URLSearchParams(r.search).get("key"),t=l.filter((function(t){return t.key===e}))[0];if(t&&a){var n=!1;t.createdBy===a.key&&(n=!0);var i=t.users.filter((function(e){return e.key===a.key}))[0];i&&i.canEdit&&(n=!0),pe(t.anonymous),t.groups.forEach((function(e){var t=d.filter((function(t){return t.key===e.key}))[0];t&&t.users.filter((function(e){return e.key===a.key})).length>0&&e.canEdit&&(n=!0)})),n&&(a.permissions.createSurveys&&le(!0),I(t),E(t.key),f(t.title),v(t.intro),ge(e)),B&&console.log("Have read survey succesfully")}}),[a,l,B]);var ve=function(e,t){"clickaway"!==t&&$(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsxs)(rt.a,{className:t.pageContainer,children:[Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:b,onChange:xe,id:"surveyTitle",label:"Survey Title",variant:"outlined"}),Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)(nt.a,{fullWidth:!0,multiline:!0,rows:5,className:t.inputTextField,value:y,onChange:xe,id:"surveyIntro",label:"Introduction",variant:"outlined"})]}),Object(G.jsx)("div",{className:t.dividerDiv}),B&&B.questions.map((function(e){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Yl,{surveyKey:B.key,question:e,handleDeleteQuestionClick:ye},e.key),Object(G.jsx)("div",{className:t.dividerDiv})]},e.key)})),oe&&L&&Object(G.jsx)(Gl,{open:ae,onClose:function(e,t){(e>0||t>0)&&(X("Survey shared with "+e+" Users and "+t+" Groups"),z("success"),$(!0)),re(!1)},surveyInfo:L})]}),Object(G.jsx)(st.a,{open:J,autoHideDuration:6e3,onClose:ve,children:Object(G.jsx)(_l,{onClose:ve,severity:Y,children:_})}),Object(G.jsx)(p.a,{position:"fixed",color:"white",className:t.appBar,children:Object(G.jsxs)(g.a,{children:[oe&&Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.shareButton,onClick:function(){re(!0)},children:"Share Survey"}),Object(G.jsx)(C.a,{title:"Add Question",children:Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.fabButton,onClick:function(){var e={questionText:"",answerRequired:"true",answerFormat:"Short Text",row:B.questions.length};B.questions=[].concat(Object(Jt.a)(B.questions),[e]);var t=D.b.database().ref("surveys/"+S+"/questions").push();t.set(e);var a=Object(be.m)(20);t.child("multipleChoiceOptions").child(a).set({index:0,text:"Option 1",key:a}),W()},children:Object(G.jsx)(vt.a,{})})}),Object(G.jsx)("div",{className:t.grow}),Object(G.jsx)(C.a,{title:"If this is selected, user names will not appear in the survey results",children:Object(G.jsx)(At.a,{control:Object(G.jsx)(Kt.a,{checked:Oe,onChange:function(){var e=!Oe;D.b.database().ref("surveyinfo").child(L.key).update({anonymous:e}),pe(!e)},name:"checkedB",color:"primary"}),label:"Anonymous Answers"})}),Object(G.jsx)(C.a,{title:"Delete Survey",children:Object(G.jsx)(w.a,{className:t.deleteButton,edge:"end",onClick:function(){fe(!0)},children:Object(G.jsx)(Ut.a,{})})})]})}),je&&Object(G.jsx)(Tr,{open:je,onClose:function(e){!0===e&&(D.b.database().ref("surveyinfo").child(L.key).remove(),D.b.database().ref("surveys").child(L.key).remove(),c.replace("/surveys/s")),fe(!1)},title:"Confirm Delete",message:"Are you sure you want to delete this survey?"}),Object(G.jsx)($e,{})]})}var Zl=Object(O.a)((function(e){return{pageContainer:{padding:0},paper:{padding:15},dividerDiv:{height:15,width:"100%"},divider:{marginTop:20,marginBottom:20,width:"100%"},row:{padding:0,margin:0},inputTextField:{},formControl:{minWidth:120},numericAnswerControl:{minWidth:160},calendar:{maxWidth:350},deleteIcon:{},switch:{marginTop:0,marginBottom:0},requiredIndicator:{color:"red"},requiredText:{color:"red",paddingTop:10}}}));function Ql(e){var t=Zl(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)({}),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(""),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)("Short Text"),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(!1),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)([]),k=Object(m.a)(v,2),C=k[0],w=k[1],N=Object(n.useState)([]),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useState)(""),B=Object(m.a)(F,2),D=B[0],R=B[1],P=Object(n.useState)(1),A=Object(m.a)(P,2),L=A[0],I=A[1],U=Object(n.useState)([]),W=Object(m.a)(U,2),M=W[0],H=W[1],K=Object(n.useState)(),Y=Object(m.a)(K,2),z=Y[0],V=Y[1];function q(e){var t=e.target.value;"textAnswer"===e.target.id&&(R(t),c.responseTextAnswer=t)}function _(e){var t=e.target.value;if(M.includes(t)){var a=M.filter((function(e){return e!==t}));H(a),c.responseCheckboxAnswers=a}else{var n=[].concat(Object(Jt.a)(M),[t]);H(n),c.responseCheckboxAnswers=n}}function X(e){var t=e.target.value;R(t),c.responseTextAnswer=t}function Z(){return!(!x||!e.showRequiredText)&&!e.questionHasBeenAnswered(c)}return Object(n.useEffect)((function(){a&&(T(Object(be.n)(151,0)),e.question&&(s(e.question),u(e.question.questionText),O(e.question.answerFormat),y(e.question.answerRequired),w(e.question.multipleChoiceOptions)))}),[a]),Object(G.jsx)(Wt.a,{fluid:!0,className:t.pageContainer,children:Object(G.jsxs)(pt.a,{style:Z()?{padding:15,borderColor:"red"}:{padding:15},variant:"outlined",children:[Object(G.jsxs)(Mt.a,{className:t.row,children:[Object(G.jsx)("h5",{children:d}),x&&Object(G.jsx)("h6",{className:t.requiredIndicator,children:"*"})]}),"Short Text"===f&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(nt.a,{fullWidth:!0,rows:1,className:t.inputTextField,value:D,id:"textAnswer",onChange:q,label:"Your Answer"})}),"Long Text"===f&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(nt.a,{fullWidth:!0,multiline:!0,className:t.inputTextField,value:D,id:"textAnswer",onChange:q,label:"Your Answer"})}),"Number"===f&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsxs)(Ft.a,{className:t.numericAnswerControl,children:[Object(G.jsx)(Tt.a,{children:"Your Answer"}),Object(G.jsx)(Bt.a,{id:"numberAnswer",value:L,onChange:function(e){var t=e.target.value;I(t),c.responseNumberAnswer=t},children:E.map((function(e){return Object(G.jsx)(Xi.a,{value:e,children:e},e)}))})]})}),"True or False"===f&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsxs)(Hl.a,{"aria-label":"",name:"",value:D,onChange:X,children:[Object(G.jsx)(At.a,{value:"True",control:Object(G.jsx)(Ml.a,{}),label:"True"}),Object(G.jsx)(At.a,{value:"False",control:Object(G.jsx)(Ml.a,{}),label:"False"})]})})}),"Checkboxes"===f&&Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsx)(Hl.a,{"aria-label":"",name:"",value:!1,children:C.sort((function(e,t){return e.index>t.index?1:-1})).map((function(e){return Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(At.a,{value:e.text,control:Object(G.jsx)(Lt.a,{}),onChange:_,label:e.text})},e.key)}))})})})}),"Multiple Choice"===f&&Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(Ft.a,{component:"fieldset",children:Object(G.jsx)(Hl.a,{"aria-label":"",name:"",value:D,onChange:X,children:C.sort((function(e,t){return e.index>t.index?1:-1})).map((function(e){return Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)(At.a,{value:e.text,control:Object(G.jsx)(Ml.a,{}),label:e.text})},e.key)}))})})})}),"Date"===f&&Object(G.jsx)(Ci.a,{className:t.calendar,onChange:function(e){V(e),c.responseDateAnswer=e},defaultView:"month",value:z}),Z()&&Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsx)("div",{className:t.requiredText,children:"This is a required question"})})]})})}var Jl=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:75},paper:{padding:15},dividerDiv:{height:15,width:"100%"},divider:{marginTop:20,marginBottom:20,width:"100%"},submitButton:{marginLeft:0}}}));function $l(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function ed(e){var t=Jl(),a=Object(n.useContext)(h.d).currentUserData,r=Object(o.f)(),c=Object(o.e)(),s=Object(n.useContext)(h.b).surveyInfo,l=Object(n.useState)(""),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(""),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)(!1),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)("error"),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)(""),R=Object(m.a)(B,2),A=R[0],L=R[1],I=Object(n.useState)(!1),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!0),Y=Object(m.a)(H,2),z=Y[0],V=Y[1],q=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("surveys").child(t),y?console.log("Already Read Survey"):(console.log("Reading Survey from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.questions)for(var i=Object.keys(a.questions),r=Object.values(a.questions),c=0;c<i.length;c++){var s=[],o={key:i[c],row:r[c].row,questionText:r[c].questionText,answerFormat:r[c].answerFormat,answerRequired:Object(be.s)(r[c].answerRequired)};if(r[c].multipleChoiceOptions)for(var l=Object.keys(r[c].multipleChoiceOptions),d=Object.values(r[c].multipleChoiceOptions),u=0;u<l.length;u++){var j={key:l[u],index:d[u].index,text:d[u].text};s.push(j)}o.multipleChoiceOptions=s,n.push(o)}var b={key:t,questions:n.sort((function(e,t){return e.row>t.row?1:-1}))};v(b)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[y]);function _(e){if("Short Text"===e.answerFormat||"Long Text"===e.answerFormat||"True or False"===e.answerFormat||"Multiple Choice"===e.answerFormat)return void 0!==e.responseTextAnswer&&""!==e.responseTextAnswer;if("Number"===e.answerFormat)return void 0!==e.responseNumberAnswer;if("Checkboxes"===e.answerFormat){if(e.responseCheckboxAnswers)return void 0!==e.responseCheckboxAnswers&&0!==e.responseCheckboxAnswers.length}else if("Date"===e.answerFormat)return void 0!==e.responseDateAnswer;return!1}Object(n.useEffect)((function(){var e=new URLSearchParams(r.search).get("key"),t=s.filter((function(t){return t.key===e}))[0];t&&a&&(j(t.title),p(t.intro),V(t.anonymous),q(e),y&&console.log("Have read survey succesfully"))}),[a,s,y]);var X=function(e,t){"clickaway"!==t&&N(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsxs)(rt.a,{className:t.pageContainer,children:[Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsx)("h2",{children:u}),Object(G.jsx)(xe.a,{className:t.divider}),Object(G.jsx)("h6",{children:O})]}),Object(G.jsx)("div",{className:t.dividerDiv}),y&&0===y.questions.length&&Object(G.jsx)("h6",{children:"The survey doesn't have any questions"}),y&&y.questions.map((function(e){return Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ql,{surveyKey:y.key,question:e,showRequiredText:W,questionHasBeenAnswered:_},e.key),Object(G.jsx)("div",{className:t.dividerDiv})]},e.key)})),Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.submitButton,onClick:function(){if(!1===function(){if(0===y.questions.length)return!1;var e=!0;return y.questions.forEach((function(t){t.answerRequired&&(_(t)||(e=!1))})),e}())return e="Please give answers for all the required questions",F("error"),L(e),N(!0),void M(!0);var e,t=Object(be.m)(19),n=D.b.database().ref("surveyresponses/").child(t),i="Anonymous";!1===z&&(i=a.key);var r={survey:y.key,surveyTitle:u,submissionDate:P()().toString(),user:i};n.set(r),y.questions.forEach((function(e){var t={question:e.key,questionText:e.questionText,answerFormat:e.answerFormat};if("Short Text"===e.answerFormat||"Long Text"===e.answerFormat||"True or False"===e.answerFormat||"Multiple Choice"===e.answerFormat)t.answer=e.responseTextAnswer;else if("Number"===e.answerFormat)t.answer=e.responseNumberAnswer.toString();else if("Checkboxes"===e.answerFormat){if(e.responseCheckboxAnswers){var a="";e.responseCheckboxAnswers.forEach((function(e){a+=e+"\xa3$%"})),""!==a&&(a=a.substring(0,a.length-3)),t.answer=a}}else"Date"===e.answerFormat&&(t.answer=e.responseDateAnswer.toString());void 0!==t.answer&&n.child("answers").push(t)})),c.goBack()},children:"Submit"})]}),Object(G.jsx)(st.a,{open:w,autoHideDuration:5e3,onClose:X,children:Object(G.jsx)($l,{onClose:X,severity:T,children:A})}),Object(G.jsx)($e,{})]})}var td=Object(O.a)((function(e){return{tableContainer:{marginTop:30,marginLeft:0,marginRight:0,marginBottom:10,maxHeight:window.innerHeight-255,overflow:"scroll"},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"}}}));function ad(e){var t=td(),a=Object(n.useState)(),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)([]),o=Object(m.a)(s,2),l=o[0],d=o[1];return Object(n.useEffect)((function(){c(e.rows),d(e.columns)}),[e]),Object(G.jsxs)(rt.a,{className:t.pageContainer,children:[Object(G.jsx)(K.a,{onClick:function(){var t="";t=e.anonymous?"Timestamp, ":"User, Timestamp, ",l.forEach((function(e){t+=e.text.replace(",",""),t+=", "})),t=t.substring(0,t.length-2),t+="\n",r.forEach((function(a){!1===e.anonymous&&(t+=a.user.replace(",","")+", "),t+=a.submissionDate.replace(",","")+", ",a.answers.forEach((function(e){t+=e.replace(",","")+", "})),t=t.substring(0,t.length-2),t+="\n"})),Object(be.f)(t,"export.csv","text/csv;charset=utf-8;")},className:t.downloadButton,children:"Download Data"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.tableContainer,children:Object(G.jsxs)(Ma.a,{"aria-label":"simple table",children:[Object(G.jsx)(za.a,{className:t.tableHead,children:Object(G.jsxs)(Va.a,{children:[!1===e.anonymous&&Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"User"}),Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:"Timestamp"}),l&&l.map((function(e){return Object(G.jsx)(Ka.a,{className:t.tableHeaderCell,align:"center",children:e.text},e.key)}))]})}),Object(G.jsx)(Ha.a,{children:r&&r.map((function(t){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[!1===e.anonymous&&Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:t.user}),Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:t.submissionDate}),t.answers&&t.answers.map((function(e){return Object(G.jsx)(Ka.a,{component:"th",scope:"row",align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e},Object(be.m)(5))}))]},t.key)}))})]})})]})}var nd=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:75},paper:{padding:0},dividerDiv:{height:15,width:"100%"},divider:{marginTop:20,marginBottom:20,width:"100%"},tableContainer:{marginTop:30,marginLeft:0,marginRight:0,marginBottom:10,maxHeight:window.innerHeight-255,overflow:"scroll"},tableHead:{background:e.palette.primary.main},tableHeaderCell:{color:"white",borderRight:"1px solid rgb(200,200,200)"},downloadButton:{position:"absolute",left:"auto",right:10,top:75}}}));function id(e){var t=e.children,a=e.value,n=e.index,i=Object(Es.a)(e,["children","value","index"]);return Object(G.jsx)("div",Object(at.a)(Object(at.a)({role:"tabpanel",hidden:a!==n,id:"simple-tabpanel-".concat(n),"aria-labelledby":"simple-tab-".concat(n)},i),{},{children:a===n&&Object(G.jsx)(Mn.a,{p:3,children:Object(G.jsx)(x.a,{children:t})})}))}function rd(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function cd(e){nd();var t=Object(n.useContext)(h.d).currentUserData,a=Object(o.f)(),i=(Object(o.e)(),Object(n.useContext)(h.b)),r=i.surveyInfo,c=i.users,s=i.groups,l=Object(n.useState)(),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(),f=Object(m.a)(b,2),O=f[0],p=f[1],g=Object(n.useState)(),x=Object(m.a)(g,2),y=x[0],v=x[1],k=Object(n.useState)([]),C=Object(m.a)(k,2),w=C[0],N=C[1],S=Object(n.useState)(!1),E=Object(m.a)(S,2),T=E[0],F=E[1],B=Object(n.useState)("error"),R=Object(m.a)(B,2),P=R[0],A=(R[1],Object(n.useState)("")),L=Object(m.a)(A,2),I=L[0],U=(L[1],Object(n.useState)(!1)),W=Object(m.a)(U,2),M=(W[0],W[1],Object(n.useState)(0)),H=Object(m.a)(M,2),K=H[0],Y=H[1],z=Object(n.useState)(!0),V=Object(m.a)(z,2),q=V[0],_=V[1],X=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("surveys").child(t),u?console.log("Already Read Survey"):(console.log("Reading Survey from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.questions)for(var i=Object.keys(a.questions),r=Object.values(a.questions),c=0;c<i.length;c++){var s=[],o={key:i[c],row:r[c].row,questionText:r[c].questionText,answerFormat:r[c].answerFormat,answerRequired:Object(be.s)(r[c].answerRequired)};if(r[c].multipleChoiceOptions)for(var l=Object.keys(r[c].multipleChoiceOptions),d=Object.values(r[c].multipleChoiceOptions),u=0;u<l.length;u++){var b={key:l[u],index:d[u].index,text:d[u].text};s.push(b)}o.multipleChoiceOptions=s,n.push(o)}var f={key:t,questions:n.sort((function(e,t){return e.row>t.row?1:-1}))};j(f)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[u]),Z=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("surveyresponses/"),O?console.log("Already Read Responses"):(console.log("Reading Reponses from Firebase"),a.on("value",(function(e){var a=[];e.forEach((function(e){var n=e.key,i=e.val(),r=[];if(i.survey===t){if(i&&i.answers)for(var c=Object.keys(i.answers),s=Object.values(i.answers),o=0;o<c.length;o++){var l={key:c[o],answer:s[o].answer,answerFormat:s[o].answerFormat,question:s[o].question,questionText:s[o].questionText};r.push(l)}var d={key:n,submissionDate:i.submissionDate,user:i.user,survey:i.survey,surveyTitle:i.surveyTitle,answers:r};a.push(d)}})),p(a),Q(a)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[O]);function Q(e){if(!y){var t=[],a=[];e.forEach((function(e){e.answers.forEach((function(e){var t=e.questionText;0===a.filter((function(t){return t.key===e.question})).length&&(a.includes(t)||a.push({key:e.question,text:t}))}))})),e.forEach((function(e){var n={},i=[];n.key=e.key;var r=c.filter((function(t){return t.key===e.user}))[0];n.user=r?r.fullName:e.user,n.submissionDate=e.submissionDate,a.forEach((function(t){var a=e.answers.filter((function(e){return e.question===t.key}))[0];if(a){var n=function(e){var t=e.answer;if(""===t)return t;t.includes("\xa3$%")&&(t=t.replace("\xa3$%",", "));return t}(a);i.push(n)}else i.push("")})),n.answers=i,t.push(n)})),v(t),N(a)}}Object(n.useEffect)((function(){var e=new URLSearchParams(a.search).get("key"),n=r.filter((function(t){return t.key===e}))[0];if(n&&t){var i=!1;n.createdBy===t.key&&(i=!0);var c=n.users.filter((function(e){return e.key===t.key}))[0];c&&c.canViewResults&&(i=!0),_(n.anonymous),n.groups.forEach((function(e){var a=s.filter((function(t){return t.key===e.key}))[0];a&&a.users.filter((function(e){return e.key===t.key})).length>0&&e.canViewResults&&(i=!0)})),i&&(X(e),Z(e)),u&&console.log("Have read survey succesfully")}}),[t,r,u]);var J=function(e,t){"clickaway"!==t&&F(!1)};return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(pt.a,{square:!0,children:Object(G.jsxs)(Ts.a,{value:K,indicatorColor:"primary",textColor:"primary",onChange:function(e,t){Y(t)},centered:!0,children:[Object(G.jsx)(Fs.a,{label:"Survey Results"}),Object(G.jsx)(Fs.a,{label:""})]})}),Object(G.jsx)(Pt,{}),Object(G.jsx)(id,{value:K,index:0,children:Object(G.jsx)(ad,{rows:y,columns:w,anonymous:q})}),Object(G.jsx)(st.a,{open:T,autoHideDuration:5e3,onClose:J,children:Object(G.jsx)(rd,{onClose:J,severity:P,children:I})}),Object(G.jsx)($e,{})]})}var sd=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:75},newProjectButton:{marginBottom:15},addButton:{color:"rgb(0, 149, 61)"},searchResultsTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},myProjectsTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},sharedProjectsTableContainer:{marginTop:15,marginBottom:50,overflow:"scroll"},userNameSearchTextField:{marginTop:10},fromCalendar:{maxWidth:300},toCalendar:{maxWidth:300},searchButton:{marginTop:15},dividerDiv:{height:15,width:"100%"},paper:{padding:15}}}));function od(e){var t=sd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(o.e)(),r=Object(n.useContext)(h.b),c=r.projectInfo,s=r.users,l=r.groups,d=Object(n.useState)(),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)([]),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)([]),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useState)([]),A=Object(m.a)(R,2),L=A[0],I=A[1],U=Object(n.useState)(!1),W=Object(m.a)(U,2),M=W[0],H=W[1],Y=Object(n.useState)(!1),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(""),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(""),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!1),ne=Object(m.a)(ae,2),ie=ne[0],re=ne[1];Object(n.useEffect)((function(){if(a){var e=[],t=[],n=[];a.permissions.createProjects&&re(!0),c.forEach((function(i){i.createdBy===a.key&&(i.canEdit=!0,i.canView=!0,e.push(i),n.push(i));var r=i.users.filter((function(e){return e.key===a.key}))[0];r&&(i.canEdit||(i.canEdit=r.canEdit,i.canView=!0,t.push(i),n.push(i))),i.groups.forEach((function(e){var r=l.filter((function(t){return t.key===e.key}))[0];r&&r.users.filter((function(e){return e.key===a.key})).length>0&&(i.canEdit||(i.canEdit=e.canEdit,i.canView=!0,t.push(i),n.push(i)))}))})),S(e),B(t),k(n)}}),[a,c,i]);var ce=function(e){return function(){i.push("/projects/e?key="+e.key)}},se=function(e){return function(){i.push("/projects/v?key="+e.key)}};function oe(e){var t=e.target.value;"projectNameSearch"===e.target.id?Q(t):"userNameSearch"===e.target.id&&te(t)}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(Wt.a,{className:t.pageContainer,children:[ie&&Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.newProjectButton,onClick:function(){H(!0)},children:"New Project"}),Object(G.jsx)("h5",{children:"Search"}),Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)(nt.a,{fullWidth:!0,value:Z,id:"projectNameSearch",onChange:oe,label:"Project Name",variant:"outlined"}),Object(G.jsx)(nt.a,{fullWidth:!0,className:t.userNameSearchTextField,value:ee,id:"userNameSearch",onChange:oe,label:"From User",variant:"outlined"})]}),Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h6",{children:"From"}),Object(G.jsx)(Ci.a,{className:t.fromCalendar,onChange:function(e){b(e)},defaultView:"month",value:j})]}),Object(G.jsxs)(Ht.a,{children:[Object(G.jsx)("h6",{children:"To"}),Object(G.jsx)(Ci.a,{className:t.toCalendar,onChange:function(e){g(e)},defaultView:"month",value:p})]})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(Ht.a,{children:Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.searchButton,onClick:function(){var e=[];console.clear(),v.forEach((function(t){console.log(t);var a=!1;if(""!==Z&&(t.title.toLowerCase().includes(Z.toLowerCase())||(a=!0)),""!==ee){var n=s.filter((function(e){return e.key===t.createdBy}))[0];n&&(n.fullName.toLowerCase().includes(ee.toLowerCase())||(a=!0))}void 0!==j&&void 0!==j?(P()(t.lastUpdated).isBefore(j)&&(a=!0),P()(t.lastUpdated).isAfter(p)&&(a=!0)):void 0!==j?P()(t.lastUpdated).isBefore(j)&&(a=!0):void 0!==p&&P()(t.lastUpdated).isAfter(p)&&(a=!0),a||e.push(t)})),I(e),q(!0)},children:"Search"})})})]}),V&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"Search Results"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:L.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}),e.canView?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"})]},e.key)}))})})})})]}),N.length>0&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"My Projects"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:N.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}),e.canView?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"})]},e.key)}))})})})})]}),F.length>0&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)("h5",{children:"Projects Shared With Me"}),Object(G.jsx)(pt.a,{className:t.paper,variant:"outlined",children:Object(G.jsx)(Ya.a,{component:pt.a,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:Object(G.jsx)(Ha.a,{children:F.map((function(e){return Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{align:"center",style:{borderRight:"1px solid rgb(200,200,200)"},children:e.title}),e.canEdit?Object(G.jsx)(Ka.a,{onClick:ce(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"Edit Project"}),e.canView?Object(G.jsx)(Ka.a,{onClick:se(e),align:"center",style:{cursor:"pointer",color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"}):Object(G.jsx)(Ka.a,{align:"center",style:{cursor:"default",color:"rgb(200,200,200)",borderRight:"1px solid rgb(200,200,200)"},children:"View Project"})]},e.key)}))})})})})]})]}),Object(G.jsx)($e,{}),Object(G.jsx)(Na,{open:M,onClose:function(e,t){if(t){if(""!==e){var n=D.b.database().ref("projectinfo"),r=Object(be.m)(15),c={createdBy:a.key,createdOn:P()().toString(),lastUpdated:P()().toString(),intro:"",title:e};n.child(r).set(c),H(!1),i.push("/projects/e?key="+r)}}else H(!1)},title:"New Project",message:"Enter a name for the Project.",initialValue:""})]})}var ld=a(1080),dd=Object(O.a)((function(e){return{pageContainer:{padding:0},row:{padding:0,margin:0},arrowIcon:{padding:0},titleButton:{paddingLeft:0},deleteIcon:{padding:0}}}));function ud(e){var t=dd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(""),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(""),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(),g=Object(m.a)(p,2),x=g[0],y=g[1];return Object(n.useEffect)((function(){if(a){e.component&&(s(e.projectKey),O(e.isEditing),u(e.component.text));var t=window.innerWidth-150;t>1150&&(t=1150),y(t),window.addEventListener("resize",(function(){var e=window.innerWidth-150;e>1150&&(e=1150),y(e)}))}}),[a]),Object(G.jsx)(G.Fragment,{children:f?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(nt.a,{style:{minHeight:35,width:x},variant:"outlined",rows:1,value:d,id:"text",onChange:function(t){var a=t.target.value;"text"===t.target.id&&(u(a),e.component.text=a,""!==c&&D.b.database().ref("projects").child(c).child("components").child(e.component.key).child("text").set(a))},placeholder:"Your Title"}),Object(G.jsxs)(ld.a,{orientation:"vertical",children:[Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveUp",onClick:function(){e.moveUp(e.component)},children:Object(G.jsx)(jl.a,{})}),Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveDown",onClick:function(){e.moveDown(e.component)},children:Object(G.jsx)(fl.a,{})})]}),Object(G.jsx)(C.a,{title:"Delete",children:Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){e.delete(e.component)},children:Object(G.jsx)(Ut.a,{})})})]}):Object(G.jsx)(K.a,{className:t.titleButton,color:"primary",children:d})})}var jd=Object(O.a)((function(e){return{root:{paddingTop:10,width:"100%"},nameText:Object(at.a)({},e.typography.bodyBold),dateText:{color:"rgb(140, 140, 140)",paddingLeft:5},textColumn:{paddingLeft:function(e){return"small"===e.avatarSize?25:30}},commentText:{flexWrap:"wrap"},replyPadding:{paddingLeft:35},replyButton:{maxWidth:25,minWidth:25},moreButton:{width:30,height:30}}}));function bd(e){var t=jd(e),a=Object(n.useState)(Date.now()),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useState)(""),o=Object(m.a)(s,2),l=o[0],d=o[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(null),g=Object(m.a)(p,2),x=g[0],y=g[1],v=Object(n.useState)(!1),k=Object(m.a)(v,2),C=k[0],S=k[1],E=Object(n.useState)([]),T=Object(m.a)(E,2),F=T[0],R=T[1],A=Object(n.useContext)(h.d).currentUserData,L=Object(n.useState)(!1),I=Object(m.a)(L,2),U=I[0],W=I[1];Object(n.useEffect)((function(){var t=setInterval((function(){return c(Date.now())}),5e3),a=P()(e.comment.date),n=P()(),i=[{interval:"years",value:n.diff(a,"years")},{interval:"months",value:n.diff(a,"months")},{interval:"weeks",value:n.diff(a,"weeks")},{interval:"days",value:n.diff(a,"days")},{interval:"hours",value:n.diff(a,"hours")},{interval:"minutes",value:n.diff(a,"minutes")}].filter((function(e){return e.value>0}));if(0===i.length)e.comment.dateString="a moment ago",d(e.comment.dateString);else{var r=i[0];1===r.value?(e.comment.dateString=r.value+" "+r.interval.replace("s","")+" ago ",d(e.comment.dateString)):(e.comment.dateString=r.value+" "+r.interval+" ago ",d(e.comment.dateString))}var s=[];return e.comment.text.split("@").forEach((function(e){!function(e){var t=new RegExp(/[a-zA-Z]/g);if(e.includes(":")&&!t.test(e)){var a=e.split(":");if(2===a.length){var n=a[0],i=a[1];if(Object(be.j)(n)&&Object(be.j)(i))return!0}else if(3===a.length){var r=a[0],c=a[1],s=a[2];if(Object(be.j)(r)&&Object(be.j)(c)&&Object(be.j)(s))return!0}return!0}return!1}(e)?s.push({text:e,isLink:!1}):s.push({text:e,isLink:!0})})),R(s),W(e.isOwnComment),function(){clearInterval(t)}}),[e.comment,r,e.isOwnComment]);var M=function(){y(null),S(!1)};return Object(G.jsxs)("div",{className:t.root,children:[Object(G.jsx)(Wt.a,{fluid:!0,onMouseEnter:function(){e.comment.user===A.key&&O(!0)},onMouseLeave:function(){O(!1)},children:Object(G.jsx)(Ht.a,{children:Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(B.a,{userOrHub:e.comment.userObject,size:e.avatarSize,path:"users"}),Object(G.jsxs)(Ht.a,{className:t.textColumn,children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("span",{className:t.nameText,children:e.comment.userName}),Object(G.jsx)("span",{className:t.dateText,children:l})]}),Object(G.jsx)(Mt.a,{children:F.map((function(e){return Object(G.jsx)(fd,{isLink:e.isLink,text:e.text},Object(be.m)(5))}))})]}),U&&Object(G.jsx)(w.a,{className:t.moreButton,hidden:!f&&!C&&!u.isMobile,onClick:function(e){S(!0),y(e.target)},children:Object(G.jsx)(Xr.a,{})})]})})}),Object(G.jsx)(N.a,{id:"comment-menu",anchorEl:x,open:Boolean(x),onClose:M,children:Object(G.jsx)(Xi.a,{onClick:function(){D.b.database().ref("projects").child(e.projectKey).child("components").child(e.component.key).child("comments").child(e.comment.key).remove(),M()},children:"Delete Comment"})})]})}function fd(e){return Object(G.jsx)(G.Fragment,{children:e.isLink?Object(G.jsx)(it.a,{onClick:function(t){t.preventDefault(),e.handleSeekClick(e.text)},style:{cursor:"pointer",whiteSpace:"pre-wrap"},children:e.text}):Object(G.jsx)("span",{style:{whiteSpace:"pre-wrap"},children:e.text})})}var hd=Object(O.a)((function(e){return{root:{paddingTop:0,paddingBottom:5},avatar:{paddingTop:10},cancelButton:{flexGrow:1,minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:0},commentButton:{minWidth:60,maxWidth:60,minHeight:25,maxHeight:25,fontSize:13,marginTop:7,marginLeft:5,marginRight:14},popover:{padding:e.spacing(2),cursor:"pointer"},clockIcon:{padding:8}}}));function md(e){var t=hd(),a=Object(n.useState)(""),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.d).currentUserData;function o(e,t){for(var a=0,n=0,i="";n<t.length;)e[a]!==t[n]||a===e.length?i+=t[n]:a++,n++;return i}function l(){return!e.isReply&&(""===r||void 0)}return Object(G.jsx)(Wt.a,{fluid:!0,className:t.root,children:Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(B.a,{className:t.avatar,userOrHub:s,size:e.avatarSize,path:"users"}),Object(G.jsx)(Ht.a,{children:Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Add a comment...",multiline:!0,value:r,fullWidth:!0,onChange:function(e){var t=o(r,e.target.value),a=o(e.target.value,r);"@"!==t&&"@"!==a&&c(e.target.value)}})})]}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)("span",{style:{flex:1}}),Object(G.jsx)(K.a,{className:t.cancelButton,variant:"contained",color:"default",disableElevation:!0,hidden:l(),onClick:function(){c("")},children:"Cancel"}),Object(G.jsx)(K.a,{className:t.commentButton,variant:"contained",color:"primary",disableElevation:!0,hidden:l(),onClick:function(){""!==r&&e.component&&""!==e.projectKey&&(D.b.database().ref("projects").child(e.projectKey).child("components").child(e.component.key).child("comments").push({text:r,user:s.key,userName:s.fullName,date:P()().toString()}),c(""))},disabled:""===r,children:"Comment"})]})]})})}var Od=Object(O.a)((function(e){return{root:{paddingBottom:15},commentCountText:Object(Ze.a)({paddingTop:15,paddingLeft:15,paddingBottom:5},e.breakpoints.down("sm"),{paddingLeft:15})}}));function pd(e){var t=Od(),a=Object(n.useState)([]),i=Object(m.a)(a,2),r=i[0],c=i[1],s=Object(n.useContext)(h.d).currentUserData;return Object(n.useEffect)((function(){var t=[];e.component.comments.forEach((function(a){(e.canEdit||a.user===s.key)&&t.push(a)})),t.sort((function(e,t){return P()(e.date)<P()(t.date)?1:P()(t.date)<P()(e.date)?-1:0})),c(t)}),[e,s]),Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Wt.a,{fluid:!0,className:t.root,children:[Object(G.jsx)(Mt.a,{children:Object(G.jsx)(md,{component:e.component,projectKey:e.projectKey,avatarSize:"medium"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h6",{className:t.commentCountText,children:1===r.length?r.length+" Comment":r.length+" Comments"})}),r.map((function(t){return Object(G.jsx)(Mt.a,{children:Object(G.jsx)(bd,{comment:t,component:e.component,projectKey:e.projectKey,avatarSize:"medium",isOwnComment:t.user===s.key})},t.key)}))]})})}function gd(e){function t(){e.onClose(!1)}return Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(dt.a,{onClose:t,"aria-labelledby":"simple-dialog-title",open:e.open,children:[Object(G.jsx)(ba.a,{id:"form-dialog-title",children:e.title}),Object(G.jsx)(ua.a,{children:Object(G.jsx)(ja.a,{children:e.message})}),Object(G.jsx)(pd,{component:e.component,projectKey:e.projectKey,canEdit:e.canEdit}),Object(G.jsx)(da.a,{children:Object(G.jsx)(K.a,{onClick:t,color:"primary",children:"OK"})})]})})}var xd=Object(O.a)((function(e){return{pageContainer:{padding:0},row:{padding:0,margin:0},arrowIcon:{padding:0},addedByText:{color:"rgb(180, 180, 180)",fontSize:"12px"},commentsIcon:{padding:15}}}));function yd(e){var t=xd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(""),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(""),l=Object(m.a)(o,2),d=l[0],u=l[1],j=Object(n.useState)(!1),b=Object(m.a)(j,2),f=b[0],O=b[1],p=Object(n.useState)(),g=Object(m.a)(p,2),x=g[0],y=g[1],k=Object(n.useState)(!1),N=Object(m.a)(k,2),S=N[0],E=N[1],T=Object(n.useState)(!1),F=Object(m.a)(T,2),B=F[0],R=F[1];Object(n.useEffect)((function(){if(a){e.component&&(s(e.projectKey),O(e.isEditing),u(e.component.text),E(e.component.allowComments));var t=window.innerWidth-150;t>1150&&(t=1150),y(t),window.addEventListener("resize",(function(){var e=window.innerWidth-150;e>1150&&(e=1150),y(e)}))}}),[a]);return Object(G.jsxs)(G.Fragment,{children:[f?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(nt.a,{style:{minHeight:35,width:x},multiline:!0,width:x,variant:"outlined",rows:5,value:d,id:"text",onChange:function(t){var a=t.target.value;"text"===t.target.id&&(u(a),e.component.text=a,""!==c&&D.b.database().ref("projects").child(c).child("components").child(e.component.key).child("text").set(a))},placeholder:"Your Text"}),Object(G.jsxs)(ld.a,{orientation:"vertical",children:[Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveUp",onClick:function(){e.moveUp(e.component)},children:Object(G.jsx)(jl.a,{})}),Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveDown",onClick:function(){e.moveDown(e.component)},children:Object(G.jsx)(fl.a,{})})]}),Object(G.jsx)(C.a,{title:"Delete",children:Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){e.delete(e.component)},children:Object(G.jsx)(Ut.a,{})})}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{color:"Primary",checked:S,onChange:function(t){E(t.target.checked),""!==c&&D.b.database().ref("projects").child(c).child("components").child(e.component.key).child("allowComments").set(t.target.checked)}}),label:"Allow Comments"}),Object(G.jsx)("h5",{className:t.addedByText,children:e.component.addedByName+" ("+P()(e.component.addedOn).format("DD/MM/YYYY")+")"})]}):Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(nt.a,{style:S?{minHeight:35,width:x}:{minHeight:35},multiline:!0,fullWidth:!S,width:x,variant:"outlined",value:d,id:"text"}),!0===S&&Object(G.jsx)(C.a,{title:"Comments",children:Object(G.jsx)(w.a,{className:t.commentsIcon,"aria-label":"Comments",onClick:function(){R(!0)},children:Object(G.jsx)(v.a,{})})}),Object(G.jsx)("h5",{className:t.addedByText,children:e.component.addedByName+" ("+P()(e.component.addedOn).format("DD/MM/YYYY")+")"})]}),Object(G.jsx)(gd,{open:B,onClose:function(){R(!1)},component:e.component,canEdit:e.canEdit,projectKey:c})]})}var vd=Object(O.a)((function(e){return{pageContainer:{padding:0},row:{padding:0,margin:0},arrowIcon:{padding:0},deleteIcon:{padding:0},addedByText:{color:"rgb(180, 180, 180)",fontSize:"12px",paddingTop:0,marginTop:0}}}));function kd(e){var t=vd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(!1),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(),l=Object(m.a)(o,2),d=l[0],u=l[1];return Object(n.useEffect)((function(){if(a){e.component&&s(e.isEditing);var t=window.innerWidth-150;t>1150&&(t=1150),u(t),window.addEventListener("resize",(function(){var e=window.innerWidth-150;e>1150&&(e=1150),u(e)}))}}),[a]),Object(G.jsx)(G.Fragment,{children:c?Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)("span",{style:{minHeight:35,width:d,display:"inline-block"},children:Object(G.jsx)(yl,{playlistKey:e.component.linkKey})}),Object(G.jsxs)("span",{className:t.buttonGroup,children:[Object(G.jsxs)(ld.a,{orientation:"vertical",children:[Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveUp",onClick:function(){e.moveUp(e.component)},children:Object(G.jsx)(jl.a,{})}),Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveDown",onClick:function(){e.moveDown(e.component)},children:Object(G.jsx)(fl.a,{})})]}),Object(G.jsx)(C.a,{title:"Delete",children:Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){e.delete(e.component)},children:Object(G.jsx)(Ut.a,{})})}),Object(G.jsx)("h5",{className:t.addedByText,children:e.component.addedByName+" ("+P()(e.component.addedOn).format("DD/MM/YYYY")+")"})]})]}):Object(G.jsx)(yl,{playlistKey:e.component.linkKey})})}var Cd=Object(O.a)((function(e){return{recentTableContainer:{marginTop:15,marginBottom:15,maxHeight:264,overflow:"scroll"},allTableContainer:{marginTop:15,marginBottom:50,overflow:"scroll"},contentContainer:{paddingLeft:15,paddingTop:15}}})),wd=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Nd(e){var t=Cd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useContext)(h.b),r=i.files,c=i.folders,s=i.playlistInfo,o=i.playlistUsage,l=i.groups,d=Object(n.useState)([]),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)([]),O=Object(m.a)(f,2),y=O[0],v=O[1];Object(n.useEffect)((function(){if(a){var e=[],t=[];s.forEach((function(n){if(Object(be.q)(n,l,a)){n.owner===a.key&&(n.isOwner=!0);var i=r.filter((function(e){return e.key===n.video}))[0];if(i){var s=c.filter((function(e){return e.key===i.folder}))[0];n.filePath=Object(be.h)(i,s,c)}e.push(n);var d=o.filter((function(e){return e.user===a.key&&e.playlist===n.key}))[0];d&&(n.lastOpened=d.lastOpened,t.push(n))}})),t.sort((function(e,t){return P()(e.lastOpened)<P()(t.lastOpened)?1:P()(t.lastOpened)<P()(e.lastOpened)?-1:0})),e.sort((function(e,t){return e.name>t.name?1:t.name>e.name?-1:0})),v(t),b(e)}}),[a,s,o]);var k=function(t){return function(){e.onClose(t)}};return Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:wd,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Select Playlist"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)("div",{className:t.contentContainer,children:[Object(G.jsx)("h5",{children:"Recent Playlists"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.recentTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===y.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:y.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:k(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:k(e),align:"left",style:e.isOwner&&{color:"rgb(0, 149, 61)"},children:e.filePath})]},e.key)}))})})}),Object(G.jsx)("h5",{children:"All Playlists"}),Object(G.jsx)(Ya.a,{component:pt.a,className:t.allTableContainer,children:Object(G.jsx)(Ma.a,{"aria-label":"simple table",children:0===j.length?Object(G.jsx)(Ha.a,{children:Object(G.jsxs)(Va.a,{children:[Object(G.jsx)(Ka.a,{style:{borderRight:"1px solid rgb(200,200,200)"}}),Object(G.jsx)(Ka.a,{})]})}):Object(G.jsx)(Ha.a,{children:j.map((function(e){return Object(G.jsxs)(Va.a,{style:{cursor:"pointer"},children:[Object(G.jsx)(Ka.a,{onClick:k(e),align:"center",style:e.isOwner?{color:"rgb(0, 149, 61)",borderRight:"1px solid rgb(200,200,200)"}:{borderRight:"1px solid rgb(200,200,200)"},children:e.name}),Object(G.jsx)(Ka.a,{onClick:k(e),align:"left",style:e.isOwner&&{color:"rgb(0, 149, 61)"},children:e.filePath})]},e.key)}))})})})]})]})}var Sd=Object(O.a)((function(e){return{list:{width:"100%",padding:0},container:{height:"100%",margin:0,paddingLeft:15},chip:{marginLeft:10,marginTop:5,marginBottom:5},nameTextField:{marginLeft:15,marginRight:15},title:{flexGrow:1},sectionTitle:{marginLeft:15,marginTop:10},notificationsSwitch:{marginLeft:15,marginTop:20},notificationsMessage:{marginLeft:25,marginRight:15,marginTop:10},noGroupsText:{marginLeft:30}}})),Ed=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Td(e){var t=Sd(),a=Object(n.useReducer)((function(e){return e+1}),0),r=Object(m.a)(a,2)[1],c=Object(n.useContext)(h.b),s=c.users,o=c.groups,l=c.folders,d=Object(n.useContext)(h.d).currentUserData,u=Object(n.useState)([]),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)([]),y=Object(m.a)(O,2),v=y[0],k=y[1],N=Object(n.useState)(""),S=Object(m.a)(N,2),E=S[0],T=S[1],F=Object(n.useState)([]),R=Object(m.a)(F,2),A=R[0],L=R[1],I=Object(n.useState)([]),U=Object(m.a)(I,2),W=U[0],M=U[1],H=Object(n.useState)(!1),K=Object(m.a)(H,2),Y=K[0],q=K[1],_=Object(n.useState)(""),X=Object(m.a)(_,2),Z=X[0],Q=X[1];Object(n.useEffect)((function(){if(e.projectInfo){var t=[],a=[];e.projectInfo.users&&s.forEach((function(n){if(n.canEdit=!1,function(e){if(d){if(e.key===d.key)return!1;var t=!1;if((e.admins.includes(d.key)||e.createdBy===d.key||"System Digital Manager"===d.role)&&(t=!0),t)return!0}return!1}(n)){a.push(n);var i=e.projectInfo.users.filter((function(e){return e.key===n.key}))[0];i&&(n.canEdit=i.canEdit,t.push(n))}})),k(a),f(t);var n=l.filter((function(e){return e.hub&&(e.managers.includes(d.key)||e.users.includes(d.key))})),i=[];n.forEach((function(t){var a=o.filter((function(e){return e.hub===t.key}));a.forEach((function(a){a.hubName=t.name,a.canEdit=!1;var n=e.projectInfo.groups.filter((function(e){return e.key===a.key}))[0];n&&(a.canEdit=n.canEdit,i.push(a))})),t.groups=a})),M(n),L(i)}}),[e.open]);var J=function(e){return function(){e.canEdit=!1;var t=Object(Jt.a)(b);t.push(e),f(t),T("")}},$=function(e){return function(){e.canEdit=!1;var t=Object(Jt.a)(A);t.push(e),L(t)}},ee=function(e){return function(){var t=b.filter((function(t){return t.key!==e.key}));f(t)}},te=function(e,t){return function(){"edit"===e&&(t.canEdit=!t.canEdit),r()}},ae=function(e){return function(){var t=Object(Jt.a)(b);e.users.forEach((function(a){var n=!0;A.forEach((function(t){t.key!==e.key&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!1)})),n&&(t=t.filter((function(e){return e.key!==a.key})))})),f(t);var a=A.filter((function(t){return t.key!==e.key}));L(a)}};function ne(e){return e.displayName&&""!==e.displayName?1===e.users?e.displayName+" (1 User)":e.displayName+" ("+e.users.length+" Users)":1===e.users?e.name+" (1 User)":e.name+" ("+e.users.length+" Users)"}return Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:Ed,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){T(""),Q(""),q(!1),L([]),f([]),e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:t.title,children:"Share Project"}),Object(G.jsx)(C.a,{title:"Confirm",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){var t={};b.forEach((function(e){var a={};a.canEdit=e.canEdit,t[e.key]=a}));var a={};A.forEach((function(e){var t={};t.canEdit=e.canEdit,a[e.key]=t})),D.b.database().ref("projectinfo").child(e.projectInfo.key).update({users:t,groups:a}),Y&&D.b.database().ref("notifications").child(e.projectInfo.key).set({title:e.projectInfo.title,type:"project",users:Object(be.k)(b),message:Z,date:P()().toString()});var n=b.length,i=A.length;T(""),Q(""),q(!1),L([]),f([]),e.onClose(n,i),f([])},"aria-label":"close",children:Object(G.jsx)(Zo.a,{})})})]})}),Object(G.jsx)(g.a,{}),Object(G.jsxs)(Wt.a,{fluid:!0,className:t.container,children:[Object(G.jsx)(Mt.a,{children:Y&&Object(G.jsx)(nt.a,{id:"standard-multiline-flexible",label:"Notification Message",variant:"outlined",value:Z,onChange:function(e){Q(e.target.value)},className:t.notificationsMessage})}),Object(G.jsx)(xe.a,{style:{marginTop:10}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Selected"})}),Object(G.jsx)(Mt.a,{children:A.map((function(e){return Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(w.a,{"aria-label":"delete",onClick:ae(e),children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.name,secondary:e.hubName}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canEdit,onChange:te("edit",e),name:"checkedB",color:"primary"}),label:"Can Collaborate"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:!0,name:"checkedB",color:"primary"}),label:"Can View Project"})]})}))}),Object(G.jsxs)(Mt.a,{children:[Object(G.jsx)(He.a,{dense:!0,className:t.root}),b.sort((function(e,t){return e.lastName.toLowerCase()>t.lastName.toLowerCase()?1:-1})).map((function(e){return!function(e){for(var t=0;t<A.length;t++)for(var a=A[t],n=0;n<a.users.length;n++){var i=a.users[n];if(e.key===i.key)return!0}return!1}(e)&&Object(G.jsx)(G.Fragment,{children:Object(G.jsxs)(Ke.a,{children:[Object(G.jsx)(w.a,{"aria-label":"delete",onClick:ee(e),children:Object(G.jsx)(z.a,{})}),Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{id:e.key,primary:e.fullName}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:e.canEdit,onChange:te("edit",e),name:"checkedB",color:"primary"}),label:"Can Collaborate"}),Object(G.jsx)(At.a,{control:Object(G.jsx)(Lt.a,{checked:!0,name:"checkedB",color:"primary"}),label:"Can View Project"})]})})}))]}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Groups"})}),Object(G.jsx)(Mt.a,{style:{margin:0,padding:0},children:Object(G.jsx)(Mt.a,{children:W.map((function(e){return e.groups&&e.groups.length>0?Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:e.groups.filter((function(e){return!A.includes(e)})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})).map((function(e){return Object(G.jsx)(V.a,{label:ne(e),className:t.chip,clickable:!0,onClick:$(e)},e.key)}))})]},e.key):Object(G.jsxs)(i.a.Fragment,{children:[Object(G.jsx)(Ti.a,{children:e.name}),Object(G.jsx)(Ke.a,{style:{margin:0,padding:0},children:Object(G.jsx)("span",{className:t.noGroupsText,children:"No Groups"})})]},e.key)}))})}),Object(G.jsx)(xe.a,{style:{marginTop:25}}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h3",{className:t.sectionTitle,children:"Users"})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(nt.a,{id:"standard-basic",label:"Type User Name",className:t.nameTextField,fullWidth:!0,value:E,onChange:function(e){T(e.target.value)}})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)(He.a,{className:t.list,children:v.filter((function(e){return function(e){return!!e.fullName.toLowerCase().includes(E.toLowerCase())}(e)&&!function(e){return 1===b.filter((function(t){return t.key===e.key})).length}(e)})).map((function(e){return Object(G.jsxs)("div",{onClick:J(e),children:[Object(G.jsxs)(Ke.a,{button:!0,alignItems:"flex-start",children:[Object(G.jsx)(gt.a,{children:Object(G.jsx)(B.a,{userOrHub:e,path:"users",variant:"circular"})}),Object(G.jsx)(ze.a,{primary:e.fullName,secondary:e.customRoleName})]}),Object(G.jsx)(xe.a,{variant:"inset",component:"li"})]},e.key)}))})})]})]})}var Fd=Object(O.a)((function(e){return{columnsContainer:{display:"flex",flexDirection:"row"},column:{minWidth:"24%",maxWidth:"24%"},contentContainer:{paddingLeft:15,paddingTop:15}}})),Bd=i.a.forwardRef((function(e,t){return Object(G.jsx)($t.a,Object(at.a)({direction:"up",ref:t},e))}));function Dd(e){var t=Object(o.f)(),a=Fd(),i=Object(n.useContext)(h.b),r=i.files,c=i.folders,s=i.groups,l=Object(n.useContext)(h.d).currentUserData,d=Object(n.useState)([]),u=Object(m.a)(d,2),j=(u[0],u[1]),b=Object(n.useState)([]),f=Object(m.a)(b,2),O=f[0],y=f[1],v=Object(n.useState)([]),k=Object(m.a)(v,2),N=k[0],S=k[1],E=Object(n.useRef)();function T(e,t){var a=O[e].folders[t];S(e);for(var n=[],i=0;i<e+1;i++)n.push(O[i]);n.push({id:a.id,name:a.name,folders:a.folders,folder:a,selectedFolderIndex:0}),n.forEach((function(e){var t=[];r.filter((function(t){return t.folder===e.id})).forEach((function(e){Object(be.o)(e,s,l)&&t.push(e)})),e.files=t})),n.push({id:Object(be.m)(15),name:"",folders:[],selectedFolderIndex:0}),y(n),E.current.scrollToRight()}function F(t){e.onClose(t)}return Object(n.useEffect)((function(){if(l){console.log("ProjectSelectFileDialog:useEffect");var e=function(){var e=c.map((function(e){return{key:e.key,id:e.key,name:e.name,hub:e.hub,parent:e.parent,imageURL:e.imageURL,parentNode:{},folders:[],groups:e.groups,managers:e.managers,users:e.users,ancestors:e.ancestors,createdBy:e.createdBy}})),t=[];e.forEach((function(a){var n=!1;(a.managers.includes(l.key)||"System Digital Manager"===l.role||a.hub&&a.users.includes(l.key)||a.createdBy&&l&&a.createdBy===l.key)&&(n=!0),n&&(t.push(a),a.ancestors.forEach((function(a){var n=e.filter((function(e){return e.key===a}));n[0]&&t.push(n[0])})))})),r.forEach((function(a){Object(be.o)(a,s,l)&&a.ancestors.forEach((function(a){var n=e.filter((function(e){return e.key===a}));n[0]&&t.push(n[0])}))})),(t=Array.from(new Set(t))).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0}));var a={id:"faves_fggh2973jgbvbiu",key:"faves_fggh2973jgbvbiu",name:"Favourites",parent:"Root",ancestors:[],folders:[],files:[],hub:!1,parentNode:{},users:[],managers:[]};return t.unshift(a),t}(),a=function(e){for(var t=[],a=function(a){var n=e[a];if("Root"===n.parent)t.push(n);else{var i=e.filter((function(e){return e.key===n.parent}))[0];void 0!==i&&(i.folders.push(n),n.parentNode=i)}},n=0;n<e.length;n++)a(n);return t}(e),n=(t.pathname.replace("/files/",""),[{id:"Root",name:"Everything",folders:a,folder:{name:"Root",id:"root"}}]);console.log(n),y(n),j(e)}}),[c,r,l]),Object(G.jsxs)(dt.a,{fullScreen:!0,open:e.open,TransitionComponent:Bd,children:[Object(G.jsx)(p.a,{children:Object(G.jsxs)(g.a,{children:[Object(G.jsx)(C.a,{title:"Cancel",children:Object(G.jsx)(w.a,{edge:"start",color:"inherit",onClick:function(){e.onClose()},"aria-label":"close",children:Object(G.jsx)(z.a,{})})}),Object(G.jsx)(x.a,{variant:"h6",className:a.title,children:"Select File"})]})}),Object(G.jsx)(g.a,{}),Object(G.jsx)("div",{style:{paddingLeft:0,paddingRight:0,marginLeft:0,marginRight:0,paddingTop:15,paddingBottom:65,"&::WebkitScrollbar":{display:"none"}},children:Object(G.jsx)(ln.Scrollbars,{className:a.scrollbar,style:{width:window.innerWidth,height:window.innerHeight-145},ref:E,children:Object(G.jsx)(on.a,{onDragEnd:function(e){},children:Object(G.jsx)("div",{className:a.columnsContainer,children:O.map((function(e,t){return Object(G.jsx)("div",{className:a.column,children:Object(G.jsx)(Cs,{embedded:!0,column:e,index:t,handleFileSelect:F,handleFolderSelect:T,selectedColumnIndex:N},e.id)},e.id)}))})})})})]})}var Rd=Object(O.a)((function(e){var t;return{document:{},page:(t={},Object(Ze.a)(t,e.breakpoints.down("sm"),{paddingLeft:0}),Object(Ze.a)(t,"paddingLeft",0),t)}}));function Pd(e){var t=Rd(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useState)(0),r=Object(m.a)(i,2),c=r[0],s=r[1],o=Object(n.useState)(1),l=Object(m.a)(o,2),d=l[0],u=l[1];return Object(n.useEffect)((function(){}),[a]),Object(G.jsx)(G.Fragment,{children:e.file&&Object(G.jsxs)(ai.a,{file:e.file.url,onLoadSuccess:function(e){var t=e.numPages;s(t)},className:t.document,children:[Object(G.jsx)(cc.a,{style:{maxWidth:e.contentWidth},steps:c,position:"static",variant:"text",activeStep:d-1,nextButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){u(d+1)},disabled:d===c,children:["Next",Object(G.jsx)(dc.a,{})]}),backButton:Object(G.jsxs)(K.a,{size:"small",onClick:function(){u(d-1)},disabled:1===d,children:[Object(G.jsx)(oc.a,{}),"Prev"]})}),Object(G.jsx)(ai.b,{pageNumber:d,className:t.page,width:e.contentWidth})]})})}function Ad(e){var t=i.a.useRef();return Object(G.jsx)(G.Fragment,{children:e.file&&Object(G.jsx)(Pr.a,{style:{maxWidth:e.contentWidth},ref:t,url:e.file.original?"https://vz-db0e7359-d70.b-cdn.net/"+e.file.original+"/playlist.m3u8":"https://vz-db0e7359-d70.b-cdn.net/"+e.file.key+"/playlist.m3u8",autoPlay:!1,controls:!0,width:"100%",height:"auto"})})}function Ld(e){return Object(G.jsx)(G.Fragment,{children:e.file&&Object(G.jsx)(Q.a,{autoPlay:!1,src:e.file.url})})}function Id(e){return Object(G.jsx)(G.Fragment,{children:e.file&&Object(G.jsx)("img",{style:{maxWidth:e.contentWidth},src:e.file.url,alt:"animage"})})}var Ud=Object(O.a)((function(e){return{container:{padding:0,margin:0},row:{padding:0,margin:0},col:{padding:0,margin:0},arrowIcon:{padding:0},deleteIcon:{padding:0},addedByText:{color:"rgb(180, 180, 180)",fontSize:"12px",paddingLeft:15}}}));function Wd(e){var t=Ud(),a=Object(n.useContext)(h.d).currentUserData,i=Object(n.useContext)(h.b).files,r=Object(n.useState)(!1),c=Object(m.a)(r,2),s=c[0],o=c[1],l=Object(n.useState)(),d=Object(m.a)(l,2),u=d[0],j=d[1],b=Object(n.useState)(),f=Object(m.a)(b,2),O=f[0],p=f[1];return Object(n.useEffect)((function(){if(a){if(e.component){o(e.isEditing);var t=i.filter((function(t){return t.key===e.component.linkKey}))[0];null!==t?p(t):console.log("No matching file found")}var n=window.innerWidth-500;n>900&&(n=900),j(n),window.addEventListener("resize",(function(){var e=window.innerWidth-500;e>900&&(e=900),j(e)}))}}),[a]),Object(G.jsx)(G.Fragment,{children:s?Object(G.jsxs)(Wt.a,{className:t.container,children:[Object(G.jsxs)(Mt.a,{className:t.row,children:[Object(G.jsxs)(Ht.a,{className:t.col,children:[e.component.fileType.includes("video")&&Object(G.jsx)(Ad,{file:O,contentWidth:u}),e.component.fileType.includes("image")&&Object(G.jsx)(Id,{file:O,contentWidth:u}),e.component.fileType.includes("audio")&&Object(G.jsx)(Ld,{file:O,contentWidth:u}),"application/pdf"===e.component.fileType&&Object(G.jsx)(Pd,{file:O,contentWidth:u})]}),Object(G.jsxs)(Ht.a,{children:[Object(G.jsxs)(ld.a,{orientation:"vertical",children:[Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveUp",onClick:function(){e.moveUp(e.component)},children:Object(G.jsx)(jl.a,{})}),Object(G.jsx)(w.a,{className:t.arrowIcon,"aria-label":"moveDown",onClick:function(){e.moveDown(e.component)},children:Object(G.jsx)(fl.a,{})})]}),Object(G.jsx)(C.a,{title:"Delete",children:Object(G.jsx)(w.a,{className:t.deleteIcon,"aria-label":"delete",onClick:function(){e.delete(e.component)},children:Object(G.jsx)(Ut.a,{})})})]})]}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h5",{className:t.addedByText,children:e.component.addedByName+" ("+P()(e.component.addedOn).format("DD/MM/YYYY")+")"})})]}):Object(G.jsxs)(Wt.a,{className:t.container,children:[Object(G.jsx)(Mt.a,{className:t.row,children:Object(G.jsxs)(Ht.a,{className:t.col,children:[e.component.fileType.includes("video")&&Object(G.jsx)(Ad,{file:O,contentWidth:u}),e.component.fileType.includes("image")&&Object(G.jsx)(Id,{file:O,contentWidth:u}),e.component.fileType.includes("audio")&&Object(G.jsx)(Ld,{file:O,contentWidth:u}),"application/pdf"===e.component.fileType&&Object(G.jsx)(Pd,{file:O,contentWidth:u})]})}),Object(G.jsx)(Mt.a,{children:Object(G.jsx)("h5",{className:t.addedByText,children:e.component.addedByName+" ("+P()(e.component.addedOn).format("DD/MM/YYYY")+")"})})]})})}var Md=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:150},paper:{padding:15},dividerDiv:{height:15,width:"100%"},inputTextField:{},shareButton:{marginTop:0,marginLeft:0,marginBottom:15},appBar:{top:"auto",bottom:65,height:50},fabButton:{position:"absolute",zIndex:1,top:-30,left:0,right:0,margin:"0 auto"},deleteButton:{marginBottom:15},grow:{flexGrow:1},anonymousSwitch:{marginBottom:5}}}));function Hd(e){return Object(G.jsx)(ot.a,Object(at.a)({elevation:6,variant:"filled"},e))}function Kd(e){var t=Md(),a=Object(n.useContext)(h.d).currentUserData,r=Object(o.f)(),c=Object(o.e)(),s=Object(n.useContext)(h.b),l=s.projectInfo,d=s.groups,u=Object(n.useState)(""),j=Object(m.a)(u,2),b=j[0],f=j[1],O=Object(n.useState)(""),x=Object(m.a)(O,2),y=x[0],v=x[1],k=Object(n.useState)(""),S=Object(m.a)(k,2),E=S[0],T=S[1],F=Object(n.useState)(),B=Object(m.a)(F,2),R=B[0],A=B[1],L=Object(n.useState)(),I=Object(m.a)(L,2),U=I[0],W=I[1],M=Object(n.useReducer)((function(e){return e+1}),0),H=Object(m.a)(M,2)[1],Y=Object(n.useState)("error"),z=Object(m.a)(Y,2),V=z[0],q=z[1],_=Object(n.useState)(""),X=Object(m.a)(_,2),Z=X[0],Q=X[1],J=Object(n.useState)(!1),$=Object(m.a)(J,2),ee=$[0],te=$[1],ae=Object(n.useState)(!1),re=Object(m.a)(ae,2),ce=re[0],se=re[1],oe=Object(n.useState)(!1),le=Object(m.a)(oe,2),de=le[0],ue=le[1],je=Object(n.useState)(!1),be=Object(m.a)(je,2),fe=be[0],he=be[1],me=Object(n.useState)(!1),Oe=Object(m.a)(me,2),pe=Oe[0],ge=Oe[1],xe=Object(n.useState)(!1),ye=Object(m.a)(xe,2),ve=ye[0],ke=ye[1],Ce=Object(n.useState)(null),we=Object(m.a)(Ce,2),Ne=we[0],Se=we[1],Ee=Object(n.useState)(!1),Te=Object(m.a)(Ee,2),Fe=Te[0],Be=Te[1],De=Object(n.useState)(!1),Re=Object(m.a)(De,2),Pe=Re[0],Ae=Re[1],Le=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("projects").child(t),R?console.log("Already Read Project"):(console.log("Reading Project from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.components)for(var i=Object.keys(a.components),r=Object.values(a.components),c=0;c<i.length;c++){var s=[];if(r[c].comments)for(var o=Object.keys(r[c].comments),l=Object.values(r[c].comments),d=0;d<o.length;d++){var u=l[d];u.key=o[d],s.push(u)}var j={key:i[c],row:r[c].row,type:r[c].type,fileType:r[c].fileType,text:r[c].text,linkKey:r[c].linkKey,addedBy:r[c].addedBy,addedByName:r[c].addedByName,addedOn:r[c].addedOn,allowComments:r[c].allowComments,comments:s};n.push(j)}var b={key:t,components:n.sort((function(e,t){return e.row>t.row?1:-1}))};A(b)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[R]);function Ie(e){var t=e.target.value;"projectTitle"===e.target.id?(D.b.database().ref("projectinfo").child(R.key).child("title").set(t),f(t)):"projectIntro"===e.target.id&&(D.b.database().ref("projectinfo").child(R.key).child("intro").set(t),v(t))}Object(n.useEffect)((function(){var e=new URLSearchParams(r.search).get("key"),t=l.filter((function(t){return t.key===e}))[0];if(t&&a){var n=!1;t.createdBy===a.key?(n=!0,Ae(!0)):Ae(!1);var i=t.users.filter((function(e){return e.key===a.key}))[0];i&&i.canEdit&&(n=!0),t.groups.forEach((function(e){var t=d.filter((function(t){return t.key===e.key}))[0];t&&t.users.filter((function(e){return e.key===a.key})).length>0&&e.canEdit&&(n=!0)})),n?(ue(!0),W(t),T(t.key),f(t.title),v(t.intro),Le(e),Be(!0)):Be(!1),R&&console.log("Have read project succesfully")}}),[a,l,R]);var Ue=function(e,t){"clickaway"!==t&&te(!1)};function We(e){if(0!==e.row){var t=R.components[e.row-1];D.b.database().ref("projects").child(E).child("components").child(t.key).update({row:e.row}),D.b.database().ref("projects").child(E).child("components").child(e.key).update({row:e.row-1})}}function Me(e){if(e.row!==R.components.length-1){var t=R.components[e.row+1];D.b.database().ref("projects").child(E).child("components").child(t.key).update({row:e.row}),D.b.database().ref("projects").child(E).child("components").child(e.key).update({row:e.row+1})}}function He(e){var t=0;R.components.filter((function(t){return t.key!==e.key})).forEach((function(e){D.b.database().ref("projects").child(E).child("components").child(e.key).update({row:t}),t+=1})),D.b.database().ref("projects").child(E).child("components").child(e.key).remove()}return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsxs)(rt.a,{className:t.pageContainer,children:[Fe&&Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:b,onChange:Ie,id:"projectTitle",label:"Project Title",variant:"outlined"}),Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)(nt.a,{fullWidth:!0,multiline:!0,rows:5,className:t.inputTextField,value:y,onChange:Ie,id:"projectIntro",label:"Project Description",variant:"outlined"})]}),Object(G.jsx)("div",{className:t.dividerDiv}),R&&R.components.map((function(e){return Object(G.jsxs)(i.a.Fragment,{children:["Title"===e.type&&Object(G.jsx)(ud,{projectKey:R.key,isEditing:!0,component:e,moveUp:We,moveDown:Me,delete:He}),"Textbox"===e.type&&Object(G.jsx)(yd,{projectKey:R.key,isEditing:!0,component:e,moveUp:We,moveDown:Me,delete:He}),"Playlist"===e.type&&Object(G.jsx)(kd,{projectKey:R.key,isEditing:!0,component:e,moveUp:We,moveDown:Me,delete:He}),"File"===e.type&&Object(G.jsx)(Wd,{projectKey:R.key,isEditing:!0,component:e,moveUp:We,moveDown:Me,delete:He}),Object(G.jsx)("div",{className:t.dividerDiv})]},e.key)})),de&&U&&Object(G.jsx)(Td,{open:ce,onClose:function(e,t){(e>0||t>0)&&(Q("Project shared with "+e+" Users and "+t+" Groups"),q("success"),te(!0)),se(!1)},projectInfo:U})]}),Object(G.jsx)(st.a,{open:ee,autoHideDuration:6e3,onClose:Ue,children:Object(G.jsx)(Hd,{onClose:Ue,severity:V,children:Z})}),Fe&&Object(G.jsx)(p.a,{position:"fixed",color:"white",className:t.appBar,children:Object(G.jsxs)(g.a,{children:[de&&Object(G.jsx)(K.a,{color:"primary",variant:"contained",className:t.shareButton,onClick:function(){se(!0)},children:"Share Project"}),Object(G.jsx)(C.a,{title:"Add Component",children:Object(G.jsx)(xt.a,{color:"primary","aria-label":"add",className:t.fabButton,onClick:function(e){Se(e.target)},children:Object(G.jsx)(vt.a,{})})}),Object(G.jsx)("div",{className:t.grow}),Pe&&Object(G.jsx)(C.a,{title:"Delete Project",children:Object(G.jsx)(w.a,{className:t.deleteButton,edge:"end",onClick:function(){he(!0)},children:Object(G.jsx)(Ut.a,{})})})]})}),fe&&Object(G.jsx)(Tr,{open:fe,onClose:function(e){!0===e&&(D.b.database().ref("projectinfo").child(U.key).remove(),D.b.database().ref("projects").child(U.key).remove(),c.replace("/projects/s")),he(!1)},title:"Confirm Delete",message:"Are you sure you want to delete this project?"}),pe&&Object(G.jsx)(Nd,{open:pe,onClose:function(e){if(e){var t={type:"Playlist",addedBy:a.key,addedByName:a.fullName,addedOn:P()().toString(),linkKey:e.key,row:R.components.length};R.components=[].concat(Object(Jt.a)(R.components),[t]),D.b.database().ref("projects/"+E+"/components").push().set(t),H()}ge(!1)}}),ve&&Object(G.jsx)(Dd,{open:ve,onClose:function(e){if(e){var t={type:"File",fileType:e.type,addedBy:a.key,addedByName:a.fullName,addedOn:P()().toString(),linkKey:e.key,row:R.components.length};R.components=[].concat(Object(Jt.a)(R.components),[t]),D.b.database().ref("projects/"+E+"/components").push().set(t),H()}ke(!1)}}),Object(G.jsxs)(N.a,{id:"comment-menu",anchorEl:Ne,open:Boolean(Ne),onClose:function(){Se(null)},children:[Object(G.jsx)(Xi.a,{onClick:function(){var e={type:"Title",text:"",addedBy:a.key,addedByName:a.fullName,addedOn:P()().toString(),row:R.components.length};R.components=[].concat(Object(Jt.a)(R.components),[e]),D.b.database().ref("projects/"+E+"/components").push().set(e),H(),Se(null)},children:"Add Title"}),Object(G.jsx)(Xi.a,{onClick:function(){var e={type:"Textbox",text:"",addedBy:a.key,addedByName:a.fullName,addedOn:P()().toString(),allowComments:!1,row:R.components.length};R.components=[].concat(Object(Jt.a)(R.components),[e]),D.b.database().ref("projects/"+E+"/components").push().set(e),H(),Se(null)},children:"Add Text Box"}),Object(G.jsx)(Xi.a,{onClick:function(){ge(!0),Se(null)},children:"Add Playlist"}),Object(G.jsx)(Xi.a,{onClick:function(){ke(!0),Se(null)},children:"Add Resource from Files"})]}),!Fe&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{})]})}var Yd=Object(O.a)((function(e){return{pageContainer:{padding:15,paddingBottom:150},paper:{padding:15},dividerDiv:{height:15,width:"100%"},inputTextField:{},shareButton:{marginTop:0,marginLeft:0,marginBottom:15},appBar:{top:"auto",bottom:65,height:50},fabButton:{position:"absolute",zIndex:1,top:-30,left:0,right:0,margin:"0 auto"},deleteButton:{marginBottom:15},grow:{flexGrow:1},anonymousSwitch:{marginBottom:5}}}));function zd(e){var t=Yd(),a=Object(n.useContext)(h.d).currentUserData,r=Object(o.f)(),c=Object(n.useContext)(h.b),s=c.projectInfo,l=c.groups,d=Object(n.useState)(""),u=Object(m.a)(d,2),j=u[0],b=u[1],f=Object(n.useState)(""),O=Object(m.a)(f,2),p=O[0],g=O[1],x=Object(n.useState)(),y=Object(m.a)(x,2),v=y[0],k=y[1],C=Object(n.useState)(!1),w=Object(m.a)(C,2),N=w[0],S=w[1],E=Object(n.useState)(!1),T=Object(m.a)(E,2),F=T[0],B=T[1],R=Object(n.useCallback)(function(){var e=Object(ie.a)(ne.a.mark((function e(t){var a;return ne.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=D.b.database().ref("projects").child(t),v?console.log("Already Read Project"):(console.log("Reading Project from Firebase"),a.on("value",(function(e){var t=e.key,a=e.val(),n=[];if(a&&a.components)for(var i=Object.keys(a.components),r=Object.values(a.components),c=0;c<i.length;c++){var s=[];if(r[c].comments)for(var o=Object.keys(r[c].comments),l=Object.values(r[c].comments),d=0;d<o.length;d++){var u=l[d];u.key=o[d],s.push(u)}var j={key:i[c],row:r[c].row,type:r[c].type,fileType:r[c].fileType,text:r[c].text,linkKey:r[c].linkKey,addedBy:r[c].addedBy,addedByName:r[c].addedByName,addedOn:r[c].addedOn,allowComments:r[c].allowComments,comments:s};n.push(j)}var b={key:t,components:n.sort((function(e,t){return e.row>t.row?1:-1}))};k(b)})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[v]);return Object(n.useEffect)((function(){var e=new URLSearchParams(r.search).get("key"),t=s.filter((function(t){return t.key===e}))[0];if(t&&a){var n=!1;t.createdBy===a.key&&(n=!0,S(!0));var i=t.users.filter((function(e){return e.key===a.key}))[0];i&&(n=!0,i.canEdit&&S(!0)),t.groups.forEach((function(e){var t=l.filter((function(t){return t.key===e.key}))[0];t&&t.users.filter((function(e){return e.key===a.key})).length>0&&(n=!0,e.canEdit&&S(!0))})),n?(b(t.title),g(t.intro),R(e),B(!0)):B(!1),v&&console.log("Have read project succesfully")}}),[a,s,v]),Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Pt,{}),Object(G.jsx)(rt.a,{className:t.pageContainer,children:F&&Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(pt.a,{className:t.paper,variant:"outlined",children:[Object(G.jsx)(nt.a,{fullWidth:!0,className:t.inputTextField,value:j,id:"projectTitle",label:"Project Title",variant:"outlined"}),Object(G.jsx)("div",{className:t.dividerDiv}),Object(G.jsx)(nt.a,{fullWidth:!0,multiline:!0,rows:5,className:t.inputTextField,value:p,id:"projectIntro",label:"Project Description",variant:"outlined"})]}),Object(G.jsx)("div",{className:t.dividerDiv}),v&&v.components.map((function(e){return Object(G.jsxs)(i.a.Fragment,{children:["Title"===e.type&&Object(G.jsx)(ud,{projectKey:v.key,isEditing:!1,component:e}),"Textbox"===e.type&&Object(G.jsx)(yd,{projectKey:v.key,isEditing:!1,canEdit:N,component:e}),"Playlist"===e.type&&Object(G.jsx)(kd,{projectKey:v.key,isEditing:!1,component:e}),"File"===e.type&&Object(G.jsx)(Wd,{projectKey:v.key,isEditing:!1,component:e}),Object(G.jsx)("div",{className:t.dividerDiv})]},e.key)}))]})}),!F&&Object(G.jsx)(Nt,{}),Object(G.jsx)($e,{})]})}window.addEventListener("dragover",(function(e){e.preventDefault()}),!1),window.addEventListener("drop",(function(e){e.preventDefault()}),!1);var Vd=function(){function e(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Management"}),Object(G.jsx)(wa,{})]})}function t(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Management"}),Object(G.jsx)(Xn,{})]})}return l.CleanConsole.init(),localStorage.clear(),sessionStorage.clear(),Object(G.jsxs)(G.Fragment,{children:[Object(G.jsxs)(f.a,{children:[Object(G.jsx)("meta",{charSet:"utf-8"}),Object(G.jsx)("title",{children:"Nodiant"}),Object(G.jsx)("meta",{name:"og:description",content:"FAW Performance Analysis."}),Object(G.jsx)("meta",{name:"description",content:"FAW Performance Analysis"})]}),Object(G.jsx)(h.a,{children:Object(G.jsx)(h.c,{children:Object(G.jsx)(h.e,{children:Object(G.jsx)(s.a,{children:Object(G.jsx)(b.a,{theme:Bl,children:Object(G.jsxs)(d.a,{maxSnack:99,children:[Object(G.jsx)(j.a,{}),Object(G.jsx)(o.a,{path:"/",exact:!0,component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:""}),Object(G.jsx)(tt,{})]})}}),Object(G.jsx)(o.a,{path:"/signin",component:function(){return Object(G.jsx)(Ot,{})}}),Object(G.jsx)(o.a,{path:"/hubs",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Management"}),Object(G.jsx)(Ea,{})]})}}),Object(G.jsx)(o.a,{path:"/newhub",component:t}),Object(G.jsx)(o.a,{path:"/managehub",component:t}),Object(G.jsx)(o.a,{path:"/users",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Management"}),Object(G.jsx)(Et,{})]})}}),Object(G.jsx)(o.a,{path:"/newuser",component:e}),Object(G.jsx)(o.a,{path:"/manageuser",component:e}),Object(G.jsx)(o.a,{path:"/calendar",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Calendar"}),Object(G.jsx)(Is,{})]})}}),Object(G.jsx)(o.a,{path:"/myaccount",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| My Account"}),Object(G.jsx)(po,{})]})}}),Object(G.jsx)(o.a,{path:"/messages",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Messages"}),Object(G.jsx)(oo,{})]})}}),Object(G.jsx)(o.a,{path:"/video",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Uc,{})]})}}),Object(G.jsx)(o.a,{path:"/audio",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Xc,{})]})}}),Object(G.jsx)(o.a,{path:"/pdf",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Gc,{})]})}}),Object(G.jsx)(o.a,{path:"/image",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Jc,{})]})}}),Object(G.jsx)(o.a,{path:"/file",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(ts,{})]})}}),Object(G.jsx)(o.a,{path:"/link",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(cs,{})]})}}),Object(G.jsx)(o.a,{path:"/consent",component:function(){return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Co,{})})}}),Object(G.jsx)(o.a,{path:"/userconsent",component:function(){return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(So,{})})}}),Object(G.jsx)(o.a,{path:"/clubconsent",component:function(){return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Ro,{})})}}),Object(G.jsx)(o.a,{path:"/clubuserconsent",component:function(){return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Fo,{})})}}),Object(G.jsx)(o.a,{path:"/coachedconsent",component:function(){return Object(G.jsx)(G.Fragment,{children:Object(G.jsx)(Pl,{})})}}),Object(G.jsx)(o.a,{path:"/upload",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Vi,{})]})}}),Object(G.jsx)(o.a,{path:"/addlink",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(qi,{})]})}}),Object(G.jsx)(o.a,{path:"/files",component:u.isMobile?function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(kr,{})]})}:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(Ss,{})]})}}),Object(G.jsx)(o.a,{path:"/analysis",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(rl,{})]})}}),Object(G.jsx)(o.a,{path:"/playlist",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Files"}),Object(G.jsx)(yl,{})]})}}),Object(G.jsx)(o.a,{path:"/playlists",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Playlists & Timelines"}),Object(G.jsx)(Il,{})]})}}),Object(G.jsx)(o.a,{path:"/surveys/s",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Surveys"}),Object(G.jsx)(Wl,{})]})}}),Object(G.jsx)(o.a,{path:"/surveys/e",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Surveys"}),Object(G.jsx)(Xl,{})]})}}),Object(G.jsx)(o.a,{path:"/surveys/r",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Surveys"}),Object(G.jsx)(ed,{})]})}}),Object(G.jsx)(o.a,{path:"/surveys/a",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Surveys"}),Object(G.jsx)(cd,{})]})}}),Object(G.jsx)(o.a,{path:"/projects/s",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Projects"}),Object(G.jsx)(od,{})]})}}),Object(G.jsx)(o.a,{path:"/projects/e",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Projects"}),Object(G.jsx)(Kd,{})]})}}),Object(G.jsx)(o.a,{path:"/projects/v",component:function(){return Object(G.jsxs)(G.Fragment,{children:[Object(G.jsx)(Xe,{navBarTitle:"| Projects"}),Object(G.jsx)(zd,{})]})}})]})})})})})})]})},Gd=function(e){e&&e instanceof Function&&a.e(3).then(a.bind(null,1097)).then((function(t){var a=t.getCLS,n=t.getFID,i=t.getFCP,r=t.getLCP,c=t.getTTFB;a(e),n(e),i(e),r(e),c(e)}))};a(994);c.a.render(Object(G.jsx)(Vd,{}),document.getElementById("root")),Gd()}},[[995,1,2]]]);
//# sourceMappingURL=main.1afc69e1.chunk.js.map