(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{556:function(e,t,r){"use strict";r.r(t);var a=r(5),c=r(17),n=r(15),i=r(11),o=r(33),s=r(238),p=r(6),b=r(7),l=r(9),u=r(8),y=r(10),O=r(0),h=r(3),j=r(87),f=r(13),g=r(55),d=r(36),v=r.n(d),m=r(1),P=r(45),w=function(e){function t(){return Object(p.a)(this,t),Object(l.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(y.a)(t,e),Object(b.a)(t,[{key:"getFilterActions",value:function(){var e=this.props,t=e.currentLibraryTypeKey,r=e.filterAll,a=e.getTypePath,c=e.libraryTypes,n=[{title:Object(m.__)("All"),href:r,isActive:!t}];return c&&Object.keys(c).forEach((function(e){n.push({title:c[e].label,href:a(e),isActive:t===e})})),n}},{key:"render",value:function(){var e=this.props,t=e.libraryTypes,r=e.currentLibraryTypeKey,a=e.renderSearch,c=e.searchDefault,n=Object(m.__)("Library"),i=Object(h.get)(t,r,{});return i.label&&(n+=" - ".concat(i.label)),Object(O.createElement)(P.a,{canAddItem:!1,filterActions:this.getFilterActions(),filterButton:Object(m.__)("Filter"),heading:n,renderSearch:a,searchButton:Object(m.__)("Search"),searchDefault:c,searchPlaceholder:Object(m.__)("Search Libraries")})}}]),t}(f.Component),S=r(43),_=function(e){var t=e.search;return Object(O.createElement)(S.a,{title:t?Object(m.sprintf)(Object(m.__)('No libraries found when searching for "%s"'),t.trim()):Object(m.__)("No libraries found.")})},T=r(296),E=r(81),D=r(54);function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}var A=function(e){return e.map((function(e){var t=e.id;return Object(O.createElement)(T.a,{key:"group-".concat(t),id:t})}))},L=function(e){function t(e){var r;return Object(p.a)(this,t),(r=Object(l.a)(this,Object(u.a)(t).call(this,e))).getQueryString=function(){return Object(h.isEmpty)(r.state.search)?"":"?".concat(Object(j.stringify)({s:r.state.search}))},r.renderSearch=function(e){r.setState({search:e},(function(){var e=r.getQueryString(),t=v.a.location.pathname.replace(/(page\/[0-9]*)/g,"page/1");Object(h.isEmpty)(e)?v.a.replace(t):v.a.replace(t+e)}))},r.getBasePath=function(){var e=r.props.libraryType,t="/libraries";return e&&(t="".concat(t,"/type/").concat(e)),t},r.initialSearch=Object(g.getQueryArg)(document.location.search,"s")||"",r.state={search:r.initialSearch},r}return Object(y.a)(t,e),Object(b.a)(t,[{key:"render",value:function(){var e=this.props,t=e.libraryType,r=e.libraryTypes,c=e.getTypePath,n=e.location,i=e.page,o=e.queryParams,s=e.receiveGroups,p=this.state.search,b=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){Object(a.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},o),l=this.getBasePath();i&&(b.page=i),p&&(b.search=p),t&&(b.library_type=t);var u=Object(O.createElement)(_,{search:p});return Object(O.createElement)("div",null,Object(O.createElement)(w,{currentLibraryTypeKey:t,filterAll:"/libraries",getTypePath:c,libraryTypes:r,location:n,renderSearch:this.renderSearch,searchDefault:this.initialSearch}),Object(O.createElement)(D.a,{addHash:this.getQueryString(),className:"groups grid grid-large-4",path:"/wp-json/dekode-intranet/v1/groups",query:b,render:A,loader:Object(O.createElement)(E.a,null),noPosts:u,paginationPath:l,dispatch:s}))}}]),t}(f.Component);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}t.default=Object(c.d)(i.withRouter,Object(n.b)((function(e,t){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(Object(r),!0).forEach((function(t){Object(a.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},function(e,t){var r=t.match.params,a=r.libraryType,c=r.page,n=void 0===c?1:c;return{libraryType:a,libraryTypes:Object(s.a)(e,"nb-library",!1).types,page:n}}(e,t),{queryParams:{group_type:"library",per_page:24},getTypePath:function(e){return"/libraries/type/".concat(e)}})}),(function(e){return Object(c.b)({receiveGroups:o.p},e)})))(L)}}]);