!function(){var e,t={463:function(e,t,n){"use strict";n.d(t,{c:function(){return o}});var r=n(4571),a=n.n(r);function o(e,t){let n=a()(e,{});return""!==n.origin&&"null"!==n.origin&&n.origin||(n=a()(t+"/"+e.replace(/^\//g,""),{})),n.toString()}},977:function(e,t,n){"use strict";n.d(t,{A:function(){return a}});var r=n(7143);function a(e,t){return r.register(e[t].bind(e)),e}},1702:function(e,t,n){"use strict";n.d(t,{R:function(){return a},e:function(){return o}});var r=n(6403);const a=function(e,t,n){return void 0===e[t]||(a=e[t])===Math.trunc(a)&&a>=0?null:(0,r.m)(["Invalid prop `"+t+"` of type `"+typeof e[t]+"` supplied to `"+(n||"N/A")+"`, expected `positive integer or zero` ("+e[t]+")."]);var a},o=function(e,t,n){return void 0===e[t]||(a=e[t])===Math.trunc(a)&&a>0?null:(0,r.m)(["Invalid prop `"+t+"` of type `"+typeof e[t]+"` supplied to `"+(n||"N/A")+"`, expected `positive integer` ("+e[t]+")."]);var a}},1936:function(e,t,n){"use strict";n.d(t,{PageHeader:function(){return r.z},PageMain:function(){return a.P},PageSidebar:function(){return o.E}});var r=n(1254),a=n(3212),o=n(795);n(1470)},4853:function(e,t,n){"use strict";n.r(t),n.d(t,{useBulkActions:function(){return o}});var r=n(9471),a=n(7591);function o(){const[e,t]=(0,r.useState)(new Set),[n,o]=(0,r.useState)([]),[s,i]=(0,r.useState)(!1),[l,u]=(0,r.useState)(null),[c,d]=(0,r.useState)(""),[m,f]=(0,r.useState)(0),[h,g]=(0,r.useState)(""),[p,y]=(0,r.useState)(!1),[S,b]=(0,r.useState)("success"),[w,v]=(0,r.useState)(!1),[P,C]=(0,r.useState)(null),[M,k]=(0,r.useState)(!1),[I,E]=(0,r.useState)(!1),[O,T]=(0,r.useState)(!1),[A,_]=(0,r.useState)(!1),[R,j]=(0,r.useState)(!1),F=()=>{let e=null;if(document.cookie&&""!==document.cookie){const t=document.cookie.split(";");for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:"success";g(e),y(!0),b(t),setTimeout((()=>{y(!1)}),5e3)},L=()=>{t(new Set)},N=()=>{t(new Set),f((e=>e+1))};return{selectedMedia:e,availableMediaIds:n,listKey:m,showConfirmModal:s,confirmMessage:c,notificationMessage:h,showNotification:p,notificationType:S,showPermissionModal:w,permissionType:P,showPlaylistModal:M,showChangeOwnerModal:I,showPublishStateModal:O,showCategoryModal:A,showTagModal:R,handleMediaSelection:(e,n)=>{t((t=>{const r=new Set(t);return n?r.add(e):r.delete(e),r}))},handleItemsUpdate:e=>{const t=e.map((e=>e.friendly_token||e.uid||e.id));o(t)},handleSelectAll:()=>{t(new Set(n))},handleDeselectAll:()=>{t(new Set)},handleBulkAction:t=>{const n=e.size;0!==n&&("delete-media"===t?(i(!0),u(t),d((0,a.translateString)("You are going to delete")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"enable-comments"===t?(i(!0),u(t),d((0,a.translateString)("You are going to enable comments to")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"disable-comments"===t?(i(!0),u(t),d((0,a.translateString)("You are going to disable comments to")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"enable-download"===t?(i(!0),u(t),d((0,a.translateString)("You are going to enable download for")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"disable-download"===t?(i(!0),u(t),d((0,a.translateString)("You are going to disable download for")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"copy-media"===t?(i(!0),u(t),d((0,a.translateString)("You are going to copy")+` ${n} `+(0,a.translateString)("media, are you sure?"))):"add-remove-coviewers"===t?(v(!0),C("viewer")):"add-remove-coeditors"===t?(v(!0),C("editor")):"add-remove-coowners"===t?(v(!0),C("owner")):"add-remove-playlist"===t?k(!0):"change-owner"===t?E(!0):"publish-state"===t?T(!0):"add-remove-category"===t?_(!0):"add-remove-tags"===t&&j(!0))},handleConfirmCancel:()=>{i(!1),u(null),d("")},handleConfirmProceed:()=>{const t=l;i(!1),u(null),d(""),"delete-media"===t?(()=>{const t=Array.from(e),n=t.length;fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"delete_media",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to delete media");return e.json()})).then((e=>{const t=1===n?(0,a.translateString)("The media was deleted successfully."):(0,a.translateString)("Successfully deleted")+` ${n} `+(0,a.translateString)("media.");x(t),N()})).catch((e=>{x((0,a.translateString)("Failed to delete media. Please try again."),"error"),N()}))})():"enable-comments"===t?(()=>{const t=Array.from(e);fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"enable_comments",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to enable comments");return e.json()})).then((e=>{x((0,a.translateString)("Successfully Enabled comments")),L()})).catch((e=>{x((0,a.translateString)("Failed to enable comments."),"error"),L()}))})():"disable-comments"===t?(()=>{const t=Array.from(e);fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"disable_comments",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to disable comments");return e.json()})).then((e=>{x((0,a.translateString)("Successfully Disabled comments")),L()})).catch((e=>{x((0,a.translateString)("Failed to disable comments."),"error"),L()}))})():"enable-download"===t?(()=>{const t=Array.from(e);fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"enable_download",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to enable download");return e.json()})).then((e=>{x((0,a.translateString)("Successfully Enabled Download")),L()})).catch((e=>{x((0,a.translateString)("Failed to enable download."),"error"),L()}))})():"disable-download"===t?(()=>{const t=Array.from(e);fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"disable_download",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to disable download");return e.json()})).then((e=>{x((0,a.translateString)("Successfully Disabled Download")),L()})).catch((e=>{x((0,a.translateString)("Failed to disable download."),"error"),L()}))})():"copy-media"===t&&(()=>{const t=Array.from(e);fetch("/api/v1/media/user/bulk_actions",{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":F()},body:JSON.stringify({action:"copy_media",media_ids:t})}).then((e=>{if(!e.ok)throw new Error("Failed to copy media");return e.json()})).then((e=>{x((0,a.translateString)("Successfully Copied")),N()})).catch((e=>{x((0,a.translateString)("Failed to copy media."),"error"),L()}))})()},handlePermissionModalCancel:()=>{v(!1),C(null)},handlePermissionModalSuccess:e=>{x(e),L(),v(!1),C(null)},handlePermissionModalError:e=>{x(e,"error"),v(!1),C(null)},handlePlaylistModalCancel:()=>{k(!1)},handlePlaylistModalSuccess:e=>{x(e),L(),k(!1)},handlePlaylistModalError:e=>{x(e,"error"),k(!1)},handleChangeOwnerModalCancel:()=>{E(!1)},handleChangeOwnerModalSuccess:e=>{x(e),N(),E(!1)},handleChangeOwnerModalError:e=>{x(e,"error"),E(!1)},handlePublishStateModalCancel:()=>{T(!1)},handlePublishStateModalSuccess:e=>{x(e),N(),T(!1)},handlePublishStateModalError:e=>{x(e,"error"),T(!1)},handleCategoryModalCancel:()=>{_(!1)},handleCategoryModalSuccess:e=>{x(e),L(),_(!1)},handleCategoryModalError:e=>{x(e,"error"),_(!1)},handleTagModalCancel:()=>{j(!1)},handleTagModalSuccess:e=>{x(e),L(),j(!1)},handleTagModalError:e=>{x(e,"error"),j(!1)},getCsrfToken:F,clearSelection:L,clearSelectionAndRefresh:N}}},5633:function(e,t,n){"use strict";n.d(t,{B:function(){return o}});var r=n(7460),a=n(7591);function o(e,t,n,o,s,i,l){const u={maxItems:t||255,pageItems:e?Math.min(t,e):1},c={totalItems:0,totalPages:0,nextRequestUrl:(0,a.formatInnerLink)(o,r.PageStore.get("config-site").url)},d={pageItems:0,requestResponse:!1};let m=null;const f=[],h=[];function g(e){let t,n;if(e=isNaN(e)?u.pageItems:e,d.pageItems&&d.pageItems<=h.length?(t=d.pageItems,n=!1,d.pageItems=0):(t=Math.min(e,h.length),n=e>h.length&&!!c.nextRequestUrl,d.pageItems=n?e-h.length:0),t){let e=0;for(;eh.length;)null!==m&&m===r[a].url||h.push(r[a]),a+=1;c.nextRequestUrl=n.next&&u.maxItems>h.length?n.next:null,e&&(c.totalItems=n.count?n.count:h.length,c.totalItems=Math.min(u.maxItems,c.totalItems),c.totalPages=Math.ceil(c.totalItems/u.pageItems),"function"==typeof s&&s(c.totalItems),"function"==typeof l&&l(n)),g()})),c.nextRequestUrl=null}return null!=n?(0,a.getRequest)((0,a.formatInnerLink)(n,r.PageStore.get("config-site").url),!1,(function(e){if(e&&e.data){let t=e.data,n=void 0!==t.results?t.results:t;n.length&&(m=n[0].url,f.push(n[0]))}p(!0)})):p(!0),{loadItems:function(e){!d.requestResponse&&f.length(d(new u.B(e.pageItems,e.maxItems,e.firstItemRequestUrl,e.requestUrl,f,h,e.onResponseDataLoaded)),a.PageStore.on("window_scroll",g),a.PageStore.on("document_visibility_change",p),g(),()=>{a.PageStore.removeListener("window_scroll",g),a.PageStore.removeListener("document_visibility_change",p),s&&(s.cancelAll(),d(null))})),[]),(0,r.useEffect)((()=>{e.onItemsUpdate&&t.length>0&&e.onItemsUpdate(t)}),[t]),n?t.length?r.createElement("div",{className:m.listOuter},b(),r.createElement("div",{ref:y,className:"items-list-wrap"},r.createElement("div",{ref:S,className:m.list},t.map(((t,n)=>r.createElement(l.c,c({key:n},(0,l.k)(e,t,n),{showSelection:e.showSelection,hasAnySelection:e.hasAnySelection,isSelected:e.selectedMedia&&e.selectedMedia.has(t.friendly_token||t.uid||t.id),onSelectionChange:e.onMediaSelection,mediaId:t.friendly_token||t.uid||t.id})))))),w()):null:r.createElement(i.e,{className:m.listOuter})}d.propTypes={...s.ItemListAsync.propTypes},d.defaultProps={...s.ItemListAsync.defaultProps,pageItems:2}},8004:function(e,t,n){"use strict";n.d(t,{R:function(){return o},z:function(){return s}});var r=n(8974);const a=function(){for(var e=arguments.length,t=new Array(e),n=0;na.createElement(l.MediaListWrapper,{title:-1=o)&&Object.keys(r.O).every((function(e){return r.O[e](n[l])}))?n.splice(l--,1):(i=!1,o0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,a,o]},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.j=956,function(){var e={956:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,o,s=n[0],i=n[1],l=n[2],u=0;if(s.some((function(t){return 0!==e[t]}))){for(a in i)r.o(i,a)&&(r.m[a]=i[a]);if(l)var c=l(r)}for(t&&t(n);u