mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 17:55:16 +01:00
1 line
38 KiB
JavaScript
1 line
38 KiB
JavaScript
!function(){"use strict";var e={4e3:function(e,t,n){var r=n(2667),i=(n(7441),n(5101),n(2322),n(9006),n(5466)),o=n(1346),s=n(8204),a=n(4426),l=n(4830),c=n(9174),u=(n(2701),n(5261)),p=n(3074),f=n.n(p),d=n(7207),h=n(2836),m=n(2331);function y(e){return(y="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 g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 v(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),e}function w(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&&S(e,t)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=k(e);if(t){var i=k(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return E(this,n)}}function E(e,t){return!t||"object"!==y(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(8534),n(3562);var C=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).onSelectOption=r.onSelectOption.bind(_(r)),r}return v(n,[{key:"onSelectOption",value:function(){this.props.onSelect(this.props.id)}},{key:"render",value:function(){return i.createElement("div",{className:"media-filter-option"},i.createElement("button",{className:this.props.selected?"active":"",onClick:this.onSelectOption},this.props.label))}}]),n}(i.PureComponent),P=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).state={selected:r.props.default},r.onSelectOption=r.onSelectOption.bind(_(r)),r}return v(n,[{key:"onSelectOption",value:function(e){this.setState({selected:e},(function(){"function"==typeof this.props.onSelect&&this.props.onSelect(this.state.selected)}))}},{key:"renderOptions",value:function(e){for(var t=[],n=0;n<this.props.items.length;)this.props.hideOptionOnSelect?this.props.items[n].id!==e&&t.push(i.createElement(C,{key:this.props.items[n].id,id:this.props.items[n].id,label:this.props.items[n].label,selected:this.props.items[n].id===e,onSelect:this.onSelectOption})):t.push(i.createElement(C,{key:this.props.items[n].id,id:this.props.items[n].id,label:this.props.items[n].label,selected:this.props.items[n].id===e,onSelect:this.onSelectOption})),n+=1;return t}},{key:"render",value:function(){return i.createElement("div",{className:"media-filter-option-list"},this.renderOptions(this.state.selected))}}]),n}(i.PureComponent),T=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).state={value:r.props.default,visiblePopup:!1},r.triggerButtonDomElem=null,r.onSelectOption=r.onSelectOption.bind(_(r)),r.onPopupsDisplayChange=r.onPopupsDisplayChange.bind(_(r)),r.popup=new d.Z(i.createElement("button",{className:"popup-trigger","aria-label":"Filter"},i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},r.props.label),i.createElement(m.O,{type:"arrow_drop_down"}))),i.createElement("div",{className:"main-options"},i.createElement(h.W8,null,i.createElement(P,{items:r.props.options,default:r.state.value,onSelect:r.onSelectOption,hideOptionOnSelect:r.props.hideOptionOnSelect}))),r.onPopupsDisplayChange),r}return v(n,[{key:"updatePopupContent",value:function(){this.popup.setComponent(i.createElement("div",{className:"main-options"},i.createElement(h.W8,null,i.createElement(P,{items:this.props.options,default:this.state.value,onSelect:this.onSelectOption,hideOptionOnSelect:this.props.hideOptionOnSelect}))))}},{key:"onSelectOption",value:function(e){this.setState({value:e},(function(){if(this.props.updateTriggerButtonOnChange&&null!==this.triggerButtonDomElem)for(var e=0;e<this.props.options.length;){if(this.state.value===this.props.options[e].id){this.triggerButtonDomElem.innerHTML=this.props.options[e].label;break}e+=1}this.popup.setOpenPopupState(!1),this.updatePopupContent(),"function"==typeof this.props.onSelect&&this.props.onSelect(this.state.value)}))}},{key:"onPopupsDisplayChange",value:function(){this.setState({visiblePopup:this.popup.isPopupOpen()},(function(){this.state.visiblePopup&&this.props.updateTriggerButtonOnChange&&(this.triggerButtonDomElem=this.refs.MediaFilter.querySelector(".filter-button-label-text"))}))}},{key:"render",value:function(){return i.createElement("div",{ref:"MediaFilter",className:"media-filter"},this.popup.triggerComponent(),this.state.visiblePopup?this.popup.contentComponent():null)}}]),n}(i.PureComponent),A=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).popup=new d.Z(i.createElement("button",{className:"popup-trigger","aria-label":"Filter"},i.createElement(m.O,{type:"sort"}),i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},r.props.label))),i.createElement("div",{className:"main-options"},i.createElement(h.W8,null,i.createElement(P,{items:r.props.options,default:r.state.value,onSelect:r.onSelectOption}))),r.onPopupsDisplayChange),r}return n}(T),N=function(e){w(n,e);var t=O(n);function n(e){var r;return g(this,n),(r=t.call(this,e)).state={selectedFilterTypeId:"all",selectedSortId:"date_added_desc"},r.typeFilters=[{id:"all",label:"All media types"},{id:"video",label:"Video"},{id:"audio",label:"Audio"},{id:"image",label:"Images"},{id:"pdf",label:"Pdf"}],r.sortingOptions=[{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"}],r.args={sort_by:null,ordering:null,media_type:null},r.onSelectFilterTypeOption=r.onSelectFilterTypeOption.bind(_(r)),r.onSelectSortOption=r.onSelectSortOption.bind(_(r)),r.updateFiltersArgs(),r}return v(n,[{key:"updateFiltersArgs",value:function(){if("function"==typeof this.props.onFiltersUpdate){switch(this.state.selectedFilterTypeId){case"video":this.args.media_type="video";break;case"audio":this.args.media_type="audio";break;case"image":this.args.media_type="image";break;case"pdf":this.args.media_type="pdf";break;default:this.args.media_type=null}switch(this.state.selectedSortId){case"most_views":this.args.sort_by="views",this.args.ordering=null;break;case"most_likes":this.args.sort_by="likes",this.args.ordering=null;break;case"date_added_asc":this.args.sort_by=null,this.args.ordering="asc";break;default:this.args.sort_by=null,this.args.ordering=null}this.props.onFiltersUpdate(this.args)}}},{key:"onSelectFilterTypeOption",value:function(e){this.setState({selectedFilterTypeId:e},(function(){this.updateFiltersArgs()}))}},{key:"onSelectSortOption",value:function(e){this.setState({selectedSortId:e},(function(){this.updateFiltersArgs()}))}},{key:"render",value:function(){return i.createElement("div",{className:"media-filters-row"},i.createElement("div",{className:"media-filters-row-inner"},i.createElement("div",{className:"media-type-filters"},i.createElement(T,{label:this.typeFilters[0].label,default:this.typeFilters[0].id,options:this.typeFilters,onSelect:this.onSelectFilterTypeOption,updateTriggerButtonOnChange:!0,hideOptionOnSelect:!0})),i.createElement("div",{className:"media-filters-sort"},i.createElement(A,{label:"SORT BY",default:this.sortingOptions[0].id,options:this.sortingOptions,onSelect:this.onSelectSortOption,updateTriggerButtonOnChange:!1,hideOptionOnSelect:!1}))))}}]),n}(i.PureComponent);function j(e){return e.options.map((function(t){return i.createElement("div",{key:t.id,className:t.id===e.selected?"active":""},i.createElement("button",{onClick:e.onSelect,filter:e.id,value:t.id},i.createElement("span",null,t.title),t.id===e.selected?i.createElement(m.O,{type:"close"}):null))}))}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(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)?F(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 F(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}n(2070),j.propTypes={id:f().string.isRequired,selected:f().string.isRequired,onSelect:f().func.isRequired};var R={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"}],license:[{id:"all",title:"All"},{id:"5",title:"Attribution 4.0 International"},{id:"6",title:"Attribution-ShareAlike 4.0 International"},{id:"7",title:"Attribution-NoDerivatives 4.0 International"},{id:"8",title:"Attribution-NonCommercial 4.0 International"},{id:"9",title:"Attribution-NonCommercial-ShareAlike 4.0 International"},{id:"10",title:"Attribution-NonCommercial-NoDerivatives 4.0 International"},{id:"no_license",title:"No license"}]};function I(e){var t=x((0,i.useState)(e.hidden),2),n=t[0],r=t[1],o=x((0,i.useState)("all"),2),s=o[0],l=o[1],c=x((0,i.useState)("all"),2),u=c[0],p=c[1],f=x((0,i.useState)("date_added_desc"),2),d=f[0],h=f[1],m=x((0,i.useState)("all"),2),y=m[0],g=m[1],b=(0,i.useRef)(null),v=(0,i.useRef)(null);function w(){n||(b.current.style.height=24+v.current.offsetHeight+"px")}function S(t){var n={media_type:s,upload_date:u,license:y,sort_by:d};switch(t.currentTarget.getAttribute("filter")){case"media_type":n.media_type=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),l(n.media_type);break;case"upload_date":n.upload_date=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),p(n.upload_date);break;case"license":n.license=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),g(n.license);break;case"sort_by":n.sort_by=t.currentTarget.getAttribute("value"),e.onFiltersUpdate(n),h(n.sort_by)}}return(0,i.useEffect)((function(){r(e.hidden),w()}),[e.hidden]),(0,i.useEffect)((function(){return a.Z.on("window_resize",w),function(){return a.Z.removeListener("window_resize",w)}}),[]),i.createElement("div",{ref:b,className:"mi-filters-row"+(n?" hidden":"")},i.createElement("div",{ref:v,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(j,{id:"media_type",options:R.media_type,selected:s,onSelect:S}))),i.createElement("div",{className:"mi-filter"},i.createElement("div",{className:"mi-filter-title"},"UPLOAD DATE"),i.createElement("div",{className:"mi-filter-options"},i.createElement(j,{id:"upload_date",options:R.upload_date,selected:u,onSelect:S}))),i.createElement("div",{className:"mi-filter"},i.createElement("div",{className:"mi-filter-title"},"SORT BY"),i.createElement("div",{className:"mi-filter-options"},i.createElement(j,{id:"sort_by",options:R.sort_by,selected:d,onSelect:S}))),a.Z.get("config-options").pages.search.enabledLicenses?i.createElement("div",{className:"mi-filter mi-filter-license"},i.createElement("div",{className:"mi-filter-title"},"LICENSE"),i.createElement("div",{className:"mi-filter-options"},i.createElement(j,{id:"license",options:R.license,selected:y,onSelect:S}))):null))}function U(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 D(e){var t,n,r=(t=(0,i.useState)(e.active),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return U(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)?U(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.")}()),o=r[0],s=r[1];return i.createElement("div",{className:"mi-filters-toggle"},i.createElement("button",{className:o?"active":"","aria-label":"Filter",onClick:function(){s(!o),void 0!==e.onClick&&e.onClick()}},i.createElement(m.O,{type:"filter_list"}),i.createElement("span",{className:"filter-button-label"},i.createElement("span",{className:"filter-button-label-text"},"FILTERS"))))}function L(e){return(L="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 Z(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 q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?V(e):t}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}I.propTypes={hidden:f().bool},I.defaultProps={hidden:!1},D.propTypes={onClick:f().func,active:f().bool},D.defaultProps={active:!1};var B=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&&q(e,t)}(f,e);var t,n,r,s,p=(r=f,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=W(r);if(s){var n=W(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return M(this,e)});function f(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(t=p.call(this,e,"search-results")).state={validQuery:!1,requestUrl:null,filterArgs:"",resultsTitle:null,resultsCount:null,searchQuery:l.Z.get("search-query"),searchCategories:l.Z.get("search-categories"),searchTags:l.Z.get("search-tags"),searchCountries:l.Z.get("search-countries"),searchLanguages:l.Z.get("search-languages"),searchTopics:l.Z.get("search-topics"),hiddenFilters:!0},t.getCountFunc=t.getCountFunc.bind(V(t)),t.updateRequestUrl=t.updateRequestUrl.bind(V(t)),t.onFilterArgsUpdate=t.onFilterArgsUpdate.bind(V(t)),t.onToggleFiltersClick=t.onToggleFiltersClick.bind(V(t)),t.onFiltersUpdate=t.onFiltersUpdate.bind(V(t)),t.didMount=!1,t.updateRequestUrl(),t}return t=f,(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,license: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.license){case"5":case"6":case"7":case"8":case"9":case"10":case"no_license":t.license=e.license}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||this.state.searchCountries||this.state.searchLanguages||this.state.searchTopics,t=null;null!==this.state.resultsCount&&(e?this.state.searchCategories?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=' media in category "'+this.state.searchCategories+'"'):this.state.searchTags?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=' media in tag "'+this.state.searchTags+'"'):this.state.searchTopics?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=' media in topic "'+this.state.searchTopics+'"'):this.state.searchCountries?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=' media in country "'+this.state.searchCountries+'"'):this.state.searchLanguages?(t=null===this.state.resultsCount||0===this.state.resultsCount?"No":this.state.resultsCount,t+=' media in language "'+this.state.searchLanguages+'"'):t=null===this.state.resultsCount||0===this.state.resultsCount?'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:"")+(this.state.searchTopics?"&topic="+this.state.searchTopics:"")+(this.state.searchLanguages?"&language="+this.state.searchLanguages:"")+(this.state.searchCountries?"&country="+this.state.searchCountries:""),r=o.Z._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=a.Z.get("config-options").pages.search.advancedFilters;return i.createElement(c._,{className:"search-results-wrap items-list-hor",title:null===this.state.resultsTitle?null:this.state.resultsTitle},e?i.createElement(D,{onClick:this.onToggleFiltersClick}):null,e?i.createElement(I,{hidden:this.state.hiddenFilters,onFiltersUpdate:this.onFiltersUpdate}):null,e?null:i.createElement(N,{onFiltersUpdate:this.onFilterArgsUpdate}),this.state.validQuery?i.createElement(u.J,{key:this.state.requestUrl,singleLinkContent:!1,horizontalItemsOrientation:!0,itemsCountCallback:this.getCountFunc,requestUrl:this.state.requestUrl,preferSummary:!0,hideViews:!a.Z.get("config-media-item").displayViews,hideAuthor:!a.Z.get("config-media-item").displayAuthor,hideDate:!a.Z.get("config-media-item").displayPublishDate}):null)}}])&&Z(t.prototype,n),f}(s.T);(0,r.X)("page-search",B)},4860:function(e,t,n){n.d(t,{Z:function(){return o}}),n(7228),n(9751);var r=n(6228);function i(){var e="test-slug";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}function o(e,t){return t=parseInt(t,10)||3600,i||console.warn(["Current browser does not support localStorage."]),e?{prefix:e,seconds:t,set:function(n,o,s,a){if(i){(s=s||t)||(a=(0,r.a)(["Invalid cache expiration value",s]));try{localStorage.setItem(e+"["+n+"]",JSON.stringify({value:o,expire:(new Date).getTime()+1e3*s})),a=!0}catch(e){a=(0,r.a)([e])}}return a},get:function(t,n){return null!==(n=(n=i?localStorage.getItem(e+"["+t+"]"):null)?JSON.parse(n):null)?void 0!==n.expire&&n.expire>(new Date).getTime()?n.value:null:n},clear:function(){var t;if(i&&Object.keys(localStorage).length)for(t in localStorage)localStorage.hasOwnProperty(t)&&0===t.indexOf(e)&&localStorage.removeItem(t);return!0}}:(0,r.O)(["Cache object prefix is required"])}},2431:function(e,t,n){n.d(t,{M:function(){return a}}),n(4517);var r=n(5466),i=n(3074),o=n.n(i);function s(){return(s=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 a(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",s({},n,{href:e.href||null,rel:e.rel||null}),t):"span"===e.type?r.createElement("span",s({},n,{onClick:e.onClick||null}),t):r.createElement("button",s({},n,{onClick:e.onClick||null}),t)}a.propTypes={type:o().oneOf(["button","link","span"]),buttonShadow:o().bool,className:o().string},a.defaultProps={type:"button",buttonShadow:!1}},2331:function(e,t,n){n.d(t,{O:function(){return s}});var r=n(5466),i=n(3074),o=n.n(i);function s(e){return e.type&&""!==e.type?r.createElement("i",{className:"material-icons","data-icon":e.type}):null}s.propTypes={type:o().string.isRequired}},8534:function(e,t,n){n.d(t,{S:function(){return c}}),n(2070),n(4517),n(9808);var r=n(5466),i=n(3074),o=n.n(i),s=n(2331);function a(){return(a=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=[],n=e.itemAttr||{};void 0===n.className?n.className="":n.className+=" ";var i=e.text?e.icon&&"right"!==e.iconPos?1:0:-1,o=e.icon?e.text&&"right"===e.iconPos?1:0:-1;switch(-1<i&&(t[i]=r.createElement("span",{key:"Text"},e.text)),-1<o&&(t[o]=r.createElement("span",{key:"Icon",className:"right"===e.iconPos?"menu-item-icon-right":"menu-item-icon"},r.createElement(s.O,{type:e.icon}))),e.itemType){case"link":t=r.createElement("a",a({},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",a({},e.buttonAttr||{},{key:"button"}),t);break;case"label":t=r.createElement("button",a({},e.buttonAttr||{},{key:"button"}),r.createElement("span",null,e.text||null)),n.className="label-item";break;case"div":t=r.createElement("div",a({},e.divAttr||{},{key:"div"}),e.text||null)}return""!==n.className&&(n.className=" "+n.className),r.createElement("li",n,t)}function c(e){var t=e.items.map((function(e,t){return r.createElement(l,a({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}l.propTypes={itemType:o().oneOf(["link","open-subpage","button","label","div"]),link:o().string,icon:o().string,iconPos:o().oneOf(["left","right"]),text:o().string,active:o().bool,divAttr:o().object,buttonAttr:o().object,itemAttr:o().object,linkAttr:o().object},l.defaultProps={itemType:"link",iconPos:"left",active:!1},c.propTypes={removeVerticalPadding:o().bool,items:o().arrayOf(o().shape(l.propTypes)).isRequired},c.defaultProps={removeVerticalPadding:!1}},5261:function(e,t,n){n.d(t,{J:function(){return w}}),n(5101),n(5466),n(6116);var r=n(4426),i=n(8421);function o(e){return(o="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 s(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 a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=n(5953);function f(e){return(f="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 d(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=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&&g(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=v(t);if(n){var i=v(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return b(this,e)});function i(){return y(this,i),r.apply(this,arguments)}return i}(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&&a(e,t)}(d,e);var t,n,o,p,f=(o=d,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=u(o);if(p){var n=u(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return l(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)).onWindowScroll=t.onWindowScroll.bind(c(t)),t.onDocumentVisibilityChange=t.onDocumentVisibilityChange.bind(c(t)),t}return t=d,(n=[{key:"componentDidMount",value:function(){this.listHandler=new i.g(this.props.pageItems,this.props.maxItems,this.props.firstItemRequestUrl,this.props.requestUrl,this.onItemsCount,this.onItemsLoad),r.Z.on("window_scroll",this.onWindowScroll),r.Z.on("document_visibility_change",this.onDocumentVisibilityChange)}},{key:"componentWillUnmount",value:function(){this.listHandler.cancelAll(),this.listHandler=null,r.Z.removeListener("window_scroll",this.onWindowScroll),r.Z.removeListener("document_visibility_change",this.onDocumentVisibilityChange)}},{key:"onWindowScroll",value:function(){void 0!==this.refs.ItemsList&&window.scrollY+2*window.outerHeight>=this.refs.ItemsList.offsetTop+this.refs.ItemsList.offsetHeight&&this.listHandler.loadItems()}},{key:"onDocumentVisibilityChange",value:function(){document.hidden||setTimeout(this.onWindowScroll,10)}},{key:"afterItemsLoad",value:function(){this.onWindowScroll(),this.listHandler.loadedAllItems()&&r.Z.removeListener("window_scroll",this.onWindowScroll)}}])&&s(t.prototype,n),d}(p.g));w.defaultProps=h(h({},p.g.defaultProps),{},{pageItems:2})},3562:function(e,t,n){n.d(t,{o:function(){return f}}),n(9751),n(3233);var r=n(5466),i=n(6116),o=n(3074),s=n.n(o);function a(e){return(a="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 l(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 c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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&&c(e,t)}(a,e);var t,n,r,o,s=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=p(r);if(o){var n=p(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return u(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).state={current:t.props.initPage&&void 0!==t.props.pages[t.props.initPage]?t.props.initPage:Object.keys(t.props.pages).length?Object.keys(t.props.pages)[0]:null},t.changePageElements=[],t}return t=a,(n=[{key:"componentDidMount",value:function(){this.initEvents()}},{key:"componentDidUpdate",value:function(){this.initEvents()}},{key:"UNSAFE_componentWillUpdate",value:function(){this.clearEvents()}},{key:"componentWillUnmount",value:function(){this.clearEvents()}},{key:"initEvents",value:function(){var e,t,n=i.findDOMNode(this),r=n.querySelectorAll(this.props.pageChangeSelector);if(r.length)for(e=0;e<r.length;)(t=(t=r[e].getAttribute(this.props.pageIdSelectorAttr))?t.trim():t)&&(this.changePageElements[e]={id:t,elem:r[e]},this.changePageElements[e].listener=this.changePageListener.bind(this,e),this.changePageElements[e].elem.addEventListener("click",this.changePageElements[e].listener)),e+=1;this.props.focusFirstItemOnPageChange&&n.focus()}},{key:"clearEvents",value:function(){for(var e=0;e<this.changePageElements.length;)this.changePageElements[e].elem.removeEventListener("click",this.changePageElements[e].listener),e+=1;this.changePageElements=[]}},{key:"changePageListener",value:function(e,t){t.preventDefault(),t.stopPropagation(),this.changePage(this.changePageElements[e].id)}},{key:"changePage",value:function(e){void 0!==this.props.pages[e]&&this.setState({current:e},(function(){void 0!==this.props.pageChangeCallback&&this.props.pageChangeCallback(e)}))}},{key:"render",value:function(){return this.props.pages[this.state.current]||null}}])&&l(t.prototype,n),a}(r.PureComponent);f.propTypes={initPage:s().string,pages:s().object.isRequired,pageChangeSelector:s().string.isRequired,pageIdSelectorAttr:s().string.isRequired,focusFirstItemOnPageChange:s().bool,pageChangeCallback:s().func},f.defaultProps={focusFirstItemOnPageChange:!0}},1346:function(e,t,n){var r=n(5466),i=n(4547),o=r.createContext((0,i.v)(window.MediaCMS).api);o.Consumer,t.Z=o},1589:function(e,t,n){n.d(t,{x:function(){return s}});var r=n(5466),i=n(4547),o=r.createContext((0,i.v)(window.MediaCMS).url),s=o.Consumer;t.Z=o},2880:function(e,t,n){var r=n(5466),i=n(4547),o=r.createContext((0,i.v)(window.MediaCMS).member);o.Consumer,t.Z=o},7188:function(e,t,n){n(9751),n(3233)},9009:function(e,t,n){n(6394),n(5334),n(7588),n(4559),n(6028)},6203:function(e,t,n){n(2322),n(9268),n(3233),t.Z=function(){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}},1712:function(e,t,n){n(6394),n(5334),n(7588);var r=n(4559);function i(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var s=e.apply(t,n);function a(e){i(s,r,o,a,l,"next",e)}function l(e){i(s,r,o,a,l,"throw",e)}a(void 0)}))}}function s(){return(s=o(regeneratorRuntime.mark((function e(t,n,i,o){var s,a,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=function(e){if(o 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"}}o(t)}},a=function(e){i instanceof Function&&i(e)},s={timeout:null,maxContentLength:null},!n){e.next=8;break}return e.next=6,(0,r.get)(t,s).then(a).catch(l||null);case 6:e.next=9;break;case 8:(0,r.get)(t,s).then(a).catch(l||null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}n(6028),t.Z=function(e,t,n,r){return s.apply(this,arguments)}},8420:function(e,t,n){n.d(t,{A_:function(){return r.Z},GH:function(){return i.Z},v$:function(){return o.Z},uf:function(){return s.Z},$4:function(){return a.Z},m5:function(){return l.Z}});var r=n(1712),i=(n(9752),n(84)),o=(n(9009),n(1438)),s=n(4135),a=n(3140),l=(n(1752),n(7514),n(1569),n(6203));n(7188)},9752:function(e,t,n){n(6394),n(5334),n(7588),n(4559),n(6028)},2701:function(e,t,n){n.d(t,{s:function(){return s}});var r=n(5466),i=n(3074),o=n.n(i);function s(e){return r.createElement("div",{className:(void 0===e.className||null===e.className?"":e.className+" ")+"media-list-header",style:e.style},r.createElement("h2",null,e.title),void 0===e.viewAllLink||null===e.viewAllLink?null:r.createElement("h3",null,r.createElement("a",{href:e.viewAllLink,title:e.viewAllText||e.viewAllLink},e.viewAllText||e.viewAllLink)))}s.propTypes={style:o().object,className:o().string,title:o().string.isRequired,viewAllLink:o().string,viewAllText:o().string},s.defaultProps={viewAllText:"VIEW ALL"}},3085:function(e,t,n){n.d(t,{G:function(){return a}});var r=n(5466),i=n(3074),o=n.n(i),s=n(2701);function a(e){return r.createElement("div",{className:(void 0===e.className||null===e.className?"":e.className+" ")+"media-list-row",style:e.style},void 0===e.title||null===e.title?null:r.createElement(s.s,{title:e.title,viewAllLink:e.viewAllLink,viewAllText:e.viewAllText}),e.children||null)}a.propTypes={style:o().object,className:o().string,title:o().string,viewAllLink:o().string,viewAllText:o().string}},9174:function(e,t,n){n.d(t,{_:function(){return a}});var r=n(5466),i=n(3074),o=n.n(i),s=n(3085);function a(e){return r.createElement("div",{className:(void 0===e.className||null===e.className?"":e.className+" ")+"media-list-wrapper",style:e.style},r.createElement(s.G,{title:e.title,viewAllLink:e.viewAllLink,viewAllText:e.viewAllText},e.children||null))}a.propTypes={style:o().object,className:o().string}}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.m=e,n.x=function(){},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.j=464,function(){var e={464:0},t=[[4e3,431]],r=function(){},i=function(i,o){for(var s,a,l=o[0],c=o[1],u=o[2],p=o[3],f=0,d=[];f<l.length;f++)a=l[f],n.o(e,a)&&e[a]&&d.push(e[a][0]),e[a]=0;for(s in c)n.o(c,s)&&(n.m[s]=c[s]);for(u&&u(n),i&&i(o);d.length;)d.shift()();return p&&t.push.apply(t,p),r()},o=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function s(){for(var r,i=0;i<t.length;i++){for(var o=t[i],s=!0,a=1;a<o.length;a++){var l=o[a];0!==e[l]&&(s=!1)}s&&(t.splice(i--,1),r=n(n.s=o[0]))}return 0===t.length&&(n.x(),n.x=function(){}),r}o.forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var a=n.x;n.x=function(){return n.x=a||function(){},(r=s)()}}(),n.x()}(); |