mediacms/static/js/search.js
2024-10-04 13:17:40 +03:00

1 line
39 KiB
JavaScript

!function(){var e,t={1213:function(e,t,n){"use strict";var r=n(2541),i=(n(7441),n(2322),n(9006),n(5101),n(3080),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(5466)),a=n(3613),o=n(8578),l=n(4234),u=n(5910),s=n(824),c=(n(288),n(4458),n(3675),n(9751),n(8833),n(815),n(5090),n(9174),n(2546));function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){return i.createElement("div",{className:"media-filter-option"},i.createElement("button",{className:e.selected?"active":"",onClick:function(){e.onSelect(e.id)}},e.label))}function b(e){var t=m((0,i.useState)(e.default),2),n=t[0],r=t[1];function a(t){r(t),"function"==typeof e.onSelect&&e.onSelect(t)}return i.createElement("div",{className:"media-filter-option-list"},function(t){for(var n=[],r=0;r<e.items.length;)e.hideOptionOnSelect?e.items[r].id!==t&&n.push(i.createElement(h,{key:e.items[r].id,id:e.items[r].id,label:e.items[r].label,selected:e.items[r].id===t,onSelect:a})):n.push(i.createElement(h,{key:e.items[r].id,id:e.items[r].id,label:e.items[r].label,selected:e.items[r].id===t,onSelect:a})),r+=1;return n}(n))}function v(e){var t=m((0,c.useMediaFilter)(e.default),6),n=t[0],r=t[1],a=t[2],o=t[3],u=t[4],s=t[5],f=m((0,i.useState)(e.label),2),d=f[0],p=f[1];return(0,i.useEffect)((function(){if(o.current.tryToHide(),e.updateTriggerButtonOnChange)for(var t=0;t<e.options.length;){if(r===e.options[t].id){p(e.options[t].label);break}t+=1}"function"==typeof e.onSelect&&e.onSelect(r)}),[r]),i.createElement("div",{ref:n,className:"media-filter"},i.createElement(s,{contentRef:o},i.createElement("button",{className:"popup-trigger","aria-label":"Filter"},i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},d),i.createElement(l.MaterialIcon,{type:"arrow_drop_down"})))),i.createElement(u,{contentRef:o},i.createElement("div",{className:"main-options"},i.createElement(l.PopupMain,null,i.createElement(b,{items:e.options,default:r,onSelect:a,hideOptionOnSelect:e.hideOptionOnSelect})))))}function g(e){var t=m((0,c.useMediaFilter)(e.default),6),n=t[0],r=t[1],a=t[2],o=t[3],u=t[4],s=t[5];return(0,i.useEffect)((function(){o.current.tryToHide(),"function"==typeof e.onSelect&&e.onSelect(r)}),[r]),i.createElement("div",{ref:n,className:"media-filter"},i.createElement(s,{contentRef:o},i.createElement("button",{className:"popup-trigger","aria-label":"Filter"},i.createElement(l.MaterialIcon,{type:"sort"}),i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},e.label)))),i.createElement(u,{contentRef:o},i.createElement("div",{className:"main-options"},i.createElement(l.PopupMain,null,i.createElement(b,{items:e.options,default:r,onSelect:a})))))}var O=[{id:"all",label:"All media types"},{id:"video",label:"Video"},{id:"audio",label:"Audio"},{id:"image",label:"Images"},{id:"pdf",label:"Pdf"}],w=[{id:"date_added_desc",label:"Upload date (newest)"},{id:"date_added_asc",label:"Upload date (oldest)"},{id:"most_views",label:"View count"},{id:"most_likes",label:"Like count"}];function E(e){var t=m((0,i.useState)("all"),2),n=t[0],r=t[1],a=m((0,i.useState)("date_added_desc"),2),o=a[0],l=a[1],u=m((0,i.useState)({sort_by:null,ordering:null,media_type:null}),2),s=u[0],c=u[1];function f(){var e=d(d({},s),{},{media_type:null,sort_by:null,ordering:null});switch(n){case"video":e.media_type="video";break;case"audio":e.media_type="audio";break;case"image":e.media_type="image";break;case"pdf":e.media_type="pdf"}switch(o){case"most_views":e.sort_by="views",e.ordering=null;break;case"most_likes":e.sort_by="likes",e.ordering=null;break;case"date_added_asc":e.sort_by=null,e.ordering="asc"}c(e)}return(0,i.useEffect)((function(){f()}),[n,o]),(0,i.useEffect)((function(){"function"==typeof e.onFiltersUpdate&&e.onFiltersUpdate(s)}),[s]),(0,i.useEffect)((function(){f()}),[]),i.createElement("div",{className:"media-filters-row"},i.createElement("div",{className:"media-filters-row-inner"},i.createElement("div",{className:"media-type-filters"},i.createElement(v,{label:O[0].label,default:O[0].id,options:O,onSelect:function(e){r(e)},updateTriggerButtonOnChange:!0,hideOptionOnSelect:!0})),i.createElement("div",{className:"media-filters-sort"},i.createElement(g,{label:"SORT BY",default:w[0].id,options:w,onSelect:function(e){l(e)},updateTriggerButtonOnChange:!1,hideOptionOnSelect:!1}))))}var S=n(3074),_=n.n(S);function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var j={media_type:[{id:"all",title:"All"},{id:"video",title:"Video"},{id:"audio",title:"Audio"},{id:"image",title:"Image"},{id:"pdf",title:"Pdf"}],upload_date:[{id:"all",title:"All"},{id:"today",title:"Today"},{id:"this_week",title:"This week"},{id:"this_month",title:"This month"},{id:"this_year",title:"This year"}],sort_by:[{id:"date_added_desc",title:"Upload date (newest)"},{id:"date_added_asc",title:"Upload date (oldest)"},{id:"most_views",title:"View count"},{id:"most_likes",title:"Like count"}]};function P(e){var t=k((0,i.useState)(e.hidden),2),n=t[0],r=t[1],a=k((0,i.useState)("all"),2),u=a[0],s=a[1],c=k((0,i.useState)("all"),2),f=c[0],d=c[1],p=k((0,i.useState)("date_added_desc"),2),m=p[0],y=p[1],h=(0,i.useRef)(null),b=(0,i.useRef)(null);function v(){n||(h.current.style.height=24+b.current.offsetHeight+"px")}function g(t){var n={media_type:u,upload_date:f,sort_by:m};switch(t.currentTarget.getAttribute("filter")){case"media_type":n.media_type=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),s(n.media_type);break;case"upload_date":n.upload_date=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),d(n.upload_date);break;case"sort_by":n.sort_by=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),y(n.sort_by)}}return(0,i.useEffect)((function(){r(e.hidden),v()}),[e.hidden]),(0,i.useEffect)((function(){return o.PageStore.on("window_resize",v),function(){return o.PageStore.removeListener("window_resize",v)}}),[]),i.createElement("div",{ref:h,className:"mi-filters-row"+(n?" hidden":"")},i.createElement("div",{ref:b,className:"mi-filters-row-inner"},i.createElement("div",{className:"mi-filter"},i.createElement("div",{className:"mi-filter-title"},"MEDIA TYPE"),i.createElement("div",{className:"mi-filter-options"},i.createElement(l.FilterOptions,{id:"media_type",options:j.media_type,selected:u,onSelect:g}))),i.createElement("div",{className:"mi-filter"},i.createElement("div",{className:"mi-filter-title"},"UPLOAD DATE"),i.createElement("div",{className:"mi-filter-options"},i.createElement(l.FilterOptions,{id:"upload_date",options:j.upload_date,selected:f,onSelect:g}))),i.createElement("div",{className:"mi-filter"},i.createElement("div",{className:"mi-filter-title"},"SORT BY"),i.createElement("div",{className:"mi-filter-options"},i.createElement(l.FilterOptions,{id:"sort_by",options:j.sort_by,selected:m,onSelect:g})))))}P.propTypes={hidden:_().bool},P.defaultProps={hidden:!1};var N=n(8204),T=n(473);function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e,t){return!t||"object"!==C(t)&&"function"!=typeof t?x(e):t}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var M=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(d,e);var t,n,r,c,f=(r=d,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=R(r);if(c){var n=R(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return U(this,e)});function d(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(t=f.call(this,e,"search-results")).state={validQuery:!1,requestUrl:null,filterArgs:"",resultsTitle:null,resultsCount:null,searchQuery:o.SearchFieldStore.get("search-query"),searchCategories:o.SearchFieldStore.get("search-categories"),searchTags:o.SearchFieldStore.get("search-tags"),hiddenFilters:!0},t.getCountFunc=t.getCountFunc.bind(x(t)),t.updateRequestUrl=t.updateRequestUrl.bind(x(t)),t.onFilterArgsUpdate=t.onFilterArgsUpdate.bind(x(t)),t.onToggleFiltersClick=t.onToggleFiltersClick.bind(x(t)),t.onFiltersUpdate=t.onFiltersUpdate.bind(x(t)),t.didMount=!1,t.updateRequestUrl(),t}return t=d,(n=[{key:"componentDidMount",value:function(){this.didMount=!0}},{key:"onToggleFiltersClick",value:function(){this.setState({hiddenFilters:!this.state.hiddenFilters})}},{key:"onFiltersUpdate",value:function(e){var t={media_type:null,upload_date:null,sort_by:null,ordering:null};switch(e.media_type){case"video":case"audio":case"image":case"pdf":t.media_type=e.media_type}switch(e.upload_date){case"today":case"this_week":case"this_month":case"this_year":t.upload_date=e.upload_date}switch(e.sort_by){case"most_views":t.sort_by="views";break;case"most_likes":t.sort_by="likes";break;case"date_added_asc":t.ordering="asc"}var n=[];for(var r in t)null!==t[r]&&n.push(r+"="+t[r]);this.setState({filterArgs:n.length?"&"+n.join("&"):""},(function(){this.updateRequestUrl()}))}},{key:"updateRequestUrl",value:function(){var e=this.state.searchQuery||this.state.searchCategories||this.state.searchTags,t=null;null!==this.state.resultsCount&&(e?this.state.searchCategories?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=" "+(0,T.translateString)("media in category")+' "'+this.state.searchCategories+'"'):this.state.searchTags?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=" "+(0,T.translateString)("media in tag")+' "'+this.state.searchTags+'"'):t=null===this.state.resultsCount||0===this.state.resultsCount?(0,T.translateString)("No results for")+' "'+this.state.searchQuery+'"':this.state.resultsCount+" result"+(1<this.state.resultsCount?"s":"")+' for "'+this.state.searchQuery+'"':t='No results for "'+this.state.searchQuery+'"');var n=(this.state.searchQuery||"")+(this.state.searchTags?"&t="+this.state.searchTags:"")+(this.state.searchCategories?"&c="+this.state.searchCategories:""),r=a.ApiUrlContext._currentValue.search.query+n+this.state.filterArgs;this.didMount?this.setState({validQuery:e,requestUrl:r,resultsTitle:t}):(this.state.validQuery=e,this.state.requestUrl=r,this.state.resultsTitle=t)}},{key:"onFilterArgsUpdate",value:function(e){var t=[];for(var n in e)null!==e[n]&&t.push(n+"="+e[n]);this.setState({filterArgs:t.length?"&"+t.join("&"):""},(function(){this.updateRequestUrl()}))}},{key:"getCountFunc",value:function(e){this.setState({resultsCount:e},(function(){this.updateRequestUrl()}))}},{key:"pageContent",value:function(){var e=o.PageStore.get("config-options").pages.search.advancedFilters;return i.createElement(u.MediaListWrapper,{className:"search-results-wrap items-list-hor",title:null===this.state.resultsTitle?null:this.state.resultsTitle},e?i.createElement(l.FiltersToggleButton,{onClick:this.onToggleFiltersClick}):null,e?i.createElement(P,{hidden:this.state.hiddenFilters,onFiltersUpdate:this.onFiltersUpdate}):null,e?null:i.createElement(E,{onFiltersUpdate:this.onFilterArgsUpdate}),this.state.validQuery?i.createElement(s.LazyLoadItemListAsync,{key:this.state.requestUrl,singleLinkContent:!1,horizontalItemsOrientation:!0,itemsCountCallback:this.getCountFunc,requestUrl:this.state.requestUrl,preferSummary:!0,hideViews:!o.PageStore.get("config-media-item").displayViews,hideAuthor:!o.PageStore.get("config-media-item").displayAuthor,hideDate:!o.PageStore.get("config-media-item").displayPublishDate}):null)}}])&&F(t.prototype,n),d}(N.T);(0,r.X)("page-search",M)},7714:function(e,t,n){"use strict";n.d(t,{M:function(){return l}}),n(4517);var r=n(5466),i=n(3074),a=n.n(i);function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e){var t=r.createElement("span",null,r.createElement("span",null,e.children)),n={tabIndex:e.tabIndex||null,title:e.title||null,className:"circle-icon-button"+(void 0!==e.className?" "+e.className:"")+(e.buttonShadow?" button-shadow":"")};return void 0!==e["data-page-id"]&&(n["data-page-id"]=e["data-page-id"]),void 0!==e["aria-label"]&&(n["aria-label"]=e["aria-label"]),"link"===e.type?r.createElement("a",o({},n,{href:e.href||null,rel:e.rel||null}),t):"span"===e.type?r.createElement("span",o({},n,{onClick:e.onClick||null}),t):r.createElement("button",o({},n,{onClick:e.onClick||null}),t)}l.propTypes={type:a().oneOf(["button","link","span"]),buttonShadow:a().bool,className:a().string},l.defaultProps={type:"button",buttonShadow:!1}},7446:function(e,t,n){"use strict";n.d(t,{j:function(){return l}}),n(2070);var r=n(5466),i=n(3074),a=n.n(i),o=n(2299);function l(e){return e.options.map((function(t){return r.createElement("div",{key:t.id,className:t.id===e.selected?"active":""},r.createElement("button",{onClick:e.onSelect,filter:e.id,value:t.id},r.createElement("span",null,t.title),t.id===e.selected?r.createElement(o.O,{type:"close"}):null))}))}l.propTypes={id:a().string.isRequired,selected:a().string.isRequired,onSelect:a().func.isRequired}},2915:function(e,t,n){"use strict";n.d(t,{_:function(){return u}}),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675);var r=n(5466),i=n(3074),a=n.n(i),o=n(2299);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t,n,i=(t=(0,r.useState)(e.active),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=i[0],u=i[1];return r.createElement("div",{className:"mi-filters-toggle"},r.createElement("button",{className:a?"active":"","aria-label":"Filter",onClick:function(){u(!a),void 0!==e.onClick&&e.onClick()}},r.createElement(o.O,{type:"filter_list"}),r.createElement("span",{className:"filter-button-label"},r.createElement("span",{className:"filter-button-label-text"},"FILTERS"))))}u.propTypes={onClick:a().func,active:a().bool},u.defaultProps={active:!1}},4234:function(e,t,n){"use strict";n.d(t,{CircleIconButton:function(){return r.M},FilterOptions:function(){return i.j},FiltersToggleButton:function(){return a._},MaterialIcon:function(){return o.O},NavigationContentApp:function(){return l.o},NavigationMenuList:function(){return u.S},Notifications:function(){return s.T},PopupMain:function(){return c.W8},PopupTop:function(){return c.HF},SpinnerLoader:function(){return f.i},UserThumbnail:function(){return d.q}});var r=n(7714),i=n(7446),a=n(2915),o=n(2299),l=n(2917),u=n(5671),s=n(2436),c=(n(5517),n(940)),f=n(6309),d=n(6142)},2299:function(e,t,n){"use strict";n.d(t,{O:function(){return i}});var r=n(5466),i=function(e){var t=e.type;return t?r.createElement("i",{className:"material-icons","data-icon":t}):null}},2917:function(e,t,n){"use strict";n.d(t,{o:function(){return u}}),n(3233),n(9751),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675);var r=n(5466),i=n(6116),a=n(3074),o=n.n(a);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t,n,a=(0,r.useRef)(null),o=(t=(0,r.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=o[0],s=o[1],c=[];function f(t,n){var r;n.preventDefault(),n.stopPropagation(),r=c[t].id,void 0!==e.pages[r]&&s(r)}return(0,r.useEffect)((function(){void 0!==e.pages[e.initPage]?s(e.initPage):Object.keys(e.pages).length?s(Object.keys(e.pages)[0]):s(null)}),[e.initPage]),(0,r.useEffect)((function(){!function(){for(var e=0;e<c.length;)c[e].elem.removeEventListener("click",c[e].listener),e+=1;c=[]}(),u&&(function(){var t,n,r=(0,i.findDOMNode)(a.current),o=r.querySelectorAll(e.pageChangeSelector);if(o.length)for(t=0;t<o.length;)(n=(n=o[t].getAttribute(e.pageIdSelectorAttr))?n.trim():n)&&(c[t]={id:n,elem:o[t]},c[t].listener=function(e){return function(t){return f(e,t)}}(t),c[t].elem.addEventListener("click",c[t].listener)),t+=1;e.focusFirstItemOnPageChange&&r.focus()}(),"function"==typeof e.pageChangeCallback&&e.pageChangeCallback(u))}),[u]),u?r.createElement("div",{ref:a},r.cloneElement(e.pages[u])):null}u.propTypes={initPage:o().string,pages:o().object.isRequired,pageChangeSelector:o().string.isRequired,pageIdSelectorAttr:o().string.isRequired,focusFirstItemOnPageChange:o().bool,pageChangeCallback:o().func},u.defaultProps={focusFirstItemOnPageChange:!0}},5671:function(e,t,n){"use strict";n.d(t,{S:function(){return s}}),n(9808),n(3233),n(2070),n(4517);var r=n(5466),i=n(3074),a=n.n(i),o=n(2299);function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e){var t=[],n=e.itemAttr||{};void 0===n.className?n.className="":n.className&&(n.className+=" ");var i=e.text?e.icon&&"right"!==e.iconPos?1:0:-1,a=e.icon?e.text&&"right"===e.iconPos?1:0:-1;switch(-1<i&&(t[i]=r.createElement("span",{key:"Text"},e.text)),-1<a&&(t[a]=r.createElement("span",{key:"Icon",className:"right"===e.iconPos?"menu-item-icon-right":"menu-item-icon"},r.createElement(o.O,{type:e.icon}))),e.itemType){case"link":t=r.createElement("a",l({},e.linkAttr||{},{href:e.link,title:e.text||null}),t),n.className+="link-item"+(e.active?" active":"");break;case"button":case"open-subpage":t=r.createElement("button",l({},e.buttonAttr||{},{key:"button"}),t);break;case"label":t=r.createElement("button",l({},e.buttonAttr||{},{key:"button"}),r.createElement("span",null,e.text||null)),n.className="label-item";break;case"div":t=r.createElement("div",l({},e.divAttr||{},{key:"div"}),e.text||null)}return""!==n.className&&(n.className=" "+n.className),n.className=n.className.trim(),r.createElement("li",n,t)}function s(e){var t=e.items.map((function(e,t){return r.createElement(u,l({key:t},e))}));return t.length?r.createElement("div",{className:"nav-menu"+(e.removeVerticalPadding?" pv0":"")},r.createElement("nav",null,r.createElement("ul",null,t))):null}u.propTypes={itemType:a().oneOf(["link","open-subpage","button","label","div"]),link:a().string,icon:a().string,iconPos:a().oneOf(["left","right"]),text:a().string,active:a().bool,divAttr:a().object,buttonAttr:a().object,itemAttr:a().object,linkAttr:a().object},u.defaultProps={itemType:"link",iconPos:"left",active:!1},s.propTypes={removeVerticalPadding:a().bool,items:a().arrayOf(a().shape(u.propTypes)).isRequired},s.defaultProps={removeVerticalPadding:!1}},5517:function(e,t,n){"use strict";n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675),n(5466);var r=n(3074),i=n.n(r);i().string,i().array.isRequired,i().string,i().number,i().number,i().number,i().func,i().func},940:function(e,t,n){"use strict";n.d(t,{HF:function(){return a},W8:function(){return o}});var r=n(5466),i=r.forwardRef((function(e,t){return void 0!==e.children?r.createElement("div",{ref:t,className:"popup"+(void 0!==e.className?" "+e.className:""),style:e.style},e.children):null}));function a(e){return void 0!==e.children?r.createElement("div",{className:"popup-top"+(void 0!==e.className?" "+e.className:""),style:e.style},e.children):null}function o(e){return void 0!==e.children?r.createElement("div",{className:"popup-main"+(void 0!==e.className?" "+e.className:""),style:e.style},e.children):null}t.ZP=i},8982:function(e,t,n){"use strict";n.d(t,{ItemListAsync:function(){return h}}),n(2070),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675),n(4517),n(9751),n(8833),n(815),n(5090),n(9174);var r=n(5466),i=n(3074),a=n.n(i),o=n(2546),l=n(7777),u=n(2832),s=n(3632),c=n(8986);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t,n,i=(t=(0,o.useItemListSync)(e),n=11,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=i[0],l=i[1],f=i[2],d=i[3],p=i[4],h=i[5],b=i[6],v=i[7],g=i[8],O=i[9],w=i[10];return(0,r.useEffect)((function(){return d(new c.g(e.pageItems,e.maxItems,e.firstItemRequestUrl,e.requestUrl,v,g)),function(){f&&(f.cancelAll(),d(null))}}),[]),a?l.length?r.createElement("div",{className:p.listOuter},O(),r.createElement("div",{ref:h,className:"items-list-wrap"},r.createElement("div",{ref:b,className:p.list},l.map((function(t,n){return r.createElement(s.H,m({key:n},(0,s.j)(e,t,n)))})))),w()):null:r.createElement(u.K,{className:p.listOuter})}h.propTypes=d(d({},l.s.propTypes),{},{items:a().array,requestUrl:a().string.isRequired,firstItemRequestUrl:a().string}),h.defaultProps=d(d({},l.s.defaultProps),{},{requestUrl:null,firstItemRequestUrl:null,pageItems:24})},824:function(e,t,n){"use strict";n.d(t,{LazyLoadItemListAsync:function(){return y}}),n(2070),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(288),n(4458),n(3675),n(4517),n(9751),n(8833),n(815),n(5090),n(9174);var r=n(5466),i=n(8578),a=n(2546),o=n(8982),l=n(2832),u=n(3632),s=n(8986);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t,n,o=(t=(0,a.useItemListLazyLoad)(e),n=13,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){l=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(l)throw i}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],f=o[1],d=o[2],y=o[3],h=o[4],b=o[5],v=o[6],g=o[7],O=o[8],w=o[9],E=o[10],S=o[11],_=o[12];return(0,r.useEffect)((function(){return y(new s.g(e.pageItems,e.maxItems,e.firstItemRequestUrl,e.requestUrl,b,v)),i.PageStore.on("window_scroll",g),i.PageStore.on("document_visibility_change",O),g(),function(){i.PageStore.removeListener("window_scroll",g),i.PageStore.removeListener("document_visibility_change",O),d&&(d.cancelAll(),y(null))}}),[]),f?c.length?r.createElement("div",{className:h.listOuter},S(),r.createElement("div",{ref:w,className:"items-list-wrap"},r.createElement("div",{ref:E,className:h.list},c.map((function(t,n){return r.createElement(u.H,p({key:n},(0,u.j)(e,t,n)))})))),_()):null:r.createElement(l.K,{className:h.listOuter})}y.propTypes=f({},o.ItemListAsync.propTypes),y.defaultProps=f(f({},o.ItemListAsync.defaultProps),{},{pageItems:2})},2083:function(e,t,n){var r=n(4835).Dispatcher;e.exports=new r},1450:function(e,t,n){"use strict";function r(){var e,t,n,r=null;if(document.cookie&&""!==document.cookie)for(t=document.cookie.split(";"),e=0;e<t.length;){if("csrftoken="===(n=t[e].trim()).substring(0,10)){r=decodeURIComponent(n.substring(10));break}e+=1}return r}n.d(t,{o:function(){return r}}),n(2322),n(9268),n(3233)},9039:function(e,t,n){"use strict";n.d(t,{O:function(){return o},a:function(){return l}}),n(1646),n(288),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(3675),n(4458);var r=n(4646);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t,n){var r,a;switch(n){case TypeError:case RangeError:case SyntaxError:case ReferenceError:r=new n(t[0]);break;default:r=new Error(t[0])}return e.apply(void 0,[r.message].concat(function(e){if(Array.isArray(e))return i(e)}(a=t.slice(1))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),r}function o(e,t){return a(r.v,e,t)}function l(e,t){return a(r.Z,e,t)}},9264:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2083);function i(e,t){return r.register(e[t].bind(e)),e}},1397:function(e,t,n){"use strict";n.d(t,{U:function(){return a}}),n(2322),n(3296),n(6394),n(4669);var r=n(137),i=n.n(r);function a(e,t){var n=i()(e,{});return""!==n.origin&&"null"!==n.origin&&n.origin||(n=i()(t+"/"+e.replace(/^\//g,""),{})),n.toString()}},705:function(e,t,n){"use strict";function r(e,t){function n(e,t,n){return Number(parseFloat(e/t).toFixed(e<10*t?1:0))+n}return t?e.toLocaleString():function(e,t,r,i,a,o){for(;t>=i;)a*=r,i*=r,e+=1;return e<o.length?n(t,a,o[e]):n(t*(r*(e-(o.length-1))),a,o[o.length-1])}(0,e,1e3,1e3,1,["","K","M","B","T"])}n.d(t,{Z:function(){return r}}),n(717),n(6660)},4646:function(e,t,n){"use strict";n.d(t,{Z:function(){return l},v:function(){return u}}),n(288),n(1646),n(2004),n(8407),n(6394),n(8288),n(5677),n(2129),n(4655),n(3675),n(4458);var r=n(1283);function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var o=function(){for(var e,t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return(e=r)[n[0]].apply(e,i(n.slice(1)))},l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.apply(void 0,["warn"].concat(t))},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.apply(void 0,["error"].concat(t))}},408:function(e,t,n){"use strict";n.d(t,{ju:function(){return r},Fr:function(){return i},hj:function(){return a},U:function(){return o},xP:function(){return l},r:function(){return u},aP:function(){return s},ZU:function(){return c},$A:function(){return f}}),n(5777);var r=function(e,t){return e>t},i=function(e){return 0===e},a=function(e){return!isNaN(e)&&e===0+e},o=function(e){return e===Math.trunc(e)},l=function(e){return r(e,0)},u=function(e){return a(e)&&l(e)},s=function(e){return o(e)&&l(e)},c=function(e){return o(e)&&(l(e)||i(e))},f=function e(t,n){return n?e(n,t%n):t}},1024:function(e,t,n){"use strict";function r(e){for(var t in window.REPLACEMENTS)e=e.replace(t,window.REPLACEMENTS[t]);return e}n.d(t,{G:function(){return r}}),n(2322),n(3296)},447:function(e,t,n){"use strict";n.d(t,{A_:function(){return l},j0:function(){return s},GH:function(){return f},Jl:function(){return p}}),n(7588),n(6394),n(5334);var r=n(4559),i=n.n(r);function a(e,t,n,r,i,a,o){try{var l=e[a](o),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function l(e){a(o,r,i,l,u,"next",e)}function u(e){a(o,r,i,l,u,"throw",e)}l(void 0)}))}}function l(e,t,n,r){return u.apply(this,arguments)}function u(){return(u=o(regeneratorRuntime.mark((function e(t,n,i,a){var o,l,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){if(a instanceof Function){var t=e;if(void 0===e.response)t={type:"network",error:e};else if(void 0!==e.response.status)switch(e.response.status){case 401:t={type:"private",error:e,message:"Media is private"};break;case 400:t={type:"unavailable",error:e,message:"Media is unavailable"}}a(t)}},l=function(e){i instanceof Function&&i(e)},o={timeout:null,maxContentLength:null},!n){e.next=8;break}return e.next=6,(0,r.get)(t,o).then(l).catch(u||null);case 6:e.next=9;break;case 8:(0,r.get)(t,o).then(l).catch(u||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function s(e,t,n,r,i,a){return c.apply(this,arguments)}function c(){return(c=o(regeneratorRuntime.mark((function e(t,n,i,a,o,l){var u,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e){l instanceof Function&&l(e)},u=function(e){o instanceof Function&&o(e)},n=n||{},!a){e.next=8;break}return e.next=6,(0,r.post)(t,n,i||null).then(u).catch(s||null);case 6:e.next=9;break;case 8:(0,r.post)(t,n,i||null).then(u).catch(s||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(e,t,n,r,i,a){return d.apply(this,arguments)}function d(){return(d=o(regeneratorRuntime.mark((function e(t,n,i,a,o,l){var u,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(e){l instanceof Function&&l(e)},u=function(e){o instanceof Function&&o(e)},n=n||{},!a){e.next=8;break}return e.next=6,(0,r.put)(t,n,i||null).then(u).catch(s||null);case 6:e.next=9;break;case 8:(0,r.put)(t,n,i||null).then(u).catch(s||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(e,t,n,r,i){return m.apply(this,arguments)}function m(){return(m=o(regeneratorRuntime.mark((function e(t,n,r,a,o){var l,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){o instanceof Function&&o(e)},l=function(e){a instanceof Function&&a(e)},n=n||{},!r){e.next=8;break}return e.next=6,i().delete(t,n||null).then(l).catch(u||null);case 6:e.next=9;break;case 8:i().delete(t,n||null).then(l).catch(u||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},5910:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaListWrapper=void 0;var i=r(n(5466)),a=n(7180);n(3804),t.MediaListWrapper=function(e){var t=e.title,n=e.viewAllLink,r=e.viewAllText,o=e.className,l=e.style,u=e.children;return i.default.createElement("div",{className:(o?o+" ":"")+"media-list-wrapper",style:l},i.default.createElement(a.MediaListRow,{title:t,viewAllLink:n,viewAllText:r},u||null))}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var a=n[e]={exports:{}};return t[e].call(a.exports,a,a.exports,r),a.exports}r.m=t,e=[],r.O=function(t,n,i,a){if(!n){var o=1/0;for(s=0;s<e.length;s++){n=e[s][0],i=e[s][1],a=e[s][2];for(var l=!0,u=0;u<n.length;u++)(!1&a||o>=a)&&Object.keys(r.O).every((function(e){return r.O[e](n[u])}))?n.splice(u--,1):(l=!1,a<o&&(o=a));l&&(e.splice(s--,1),t=i())}return t}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[n,i,a]},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=464,function(){var e={464:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var i,a,o=n[0],l=n[1],u=n[2],s=0;for(i in l)r.o(l,i)&&(r.m[i]=l[i]);if(u)var c=u(r);for(t&&t(n);s<o.length;s++)a=o[s],r.o(e,a)&&e[a]&&e[a][0](),e[o[s]]=0;return r.O(c)},n=self.webpackChunkmediacms_frontend=self.webpackChunkmediacms_frontend||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var i=r.O(void 0,[431],(function(){return r(1213)}));i=r.O(i)}();