import{g as R,R as _,r as f,d as N,j as c,k as w}from"./index-QffunPN4.js";import{b as U,_ as j,l as q,c as M,m as G,n as z,o as K,p as W,q as V,r as J,s as Q,a as D,t as X,i as Z,u as I,d as ee}from"./_baseIteratee-t0bg1uQx.js";import{B as te}from"./ButtonGroup-Sgv1sFfi.js";import{u as d}from"./episodes-g-yXQvRx.js";import{_ as re,l as ne,e as oe}from"./index-r5uRY6ZX.js";import{_ as ie}from"./keyBy-SHZtSVm7.js";import{Episode as se}from"./Episode-2dgRwXzW.js";import"./Accordion-G6zojiZU.js";import"./Alert-6Z-4eMej.js";import"./Card-kIRC-1LD.js";import"./utils-y9eqLsCl.js";import"./toInteger-wUubBcTR.js";import"./moment-WSJ9un1t.js";import"./main-X2893rog.js";import"./Resources-b0laCoFs.js";import"./resources-NGuvLSqM.js";import"./FaMicrophone-nMx7fBZA.js";var ae=U;function le(n,t){var r=[];return ae(n,function(e,o,i){t(e,o,i)&&r.push(e)}),r}var ce=le,ue=q,pe=ce,he=j,fe=M;function de(n,t){var r=fe(n)?ue:pe;return r(n,he(t))}var me=de;const ge=R(me);/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var x=function(n,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,e){r.__proto__=e}||function(r,e){for(var o in e)e.hasOwnProperty(o)&&(r[o]=e[o])},x(n,t)};function ve(n,t){x(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var v=function(){return v=Object.assign||function(t){for(var r,e=1,o=arguments.length;e<o;e++){r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},v.apply(this,arguments)};function ye(n,t,r,e){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function u(){a(),i=!0}typeof t!="boolean"&&(e=r,r=t,t=void 0);function p(){var b=this,y=Date.now()-s,h=arguments;if(i)return;function g(){s=Date.now(),r.apply(b,h)}function S(){o=void 0}e&&!o&&g(),a(),e===void 0&&y>n?g():t!==!0&&(o=setTimeout(e?S:g,e===void 0?n-y:n))}return p.cancel=u,p}var m={Pixel:"Pixel",Percent:"Percent"},C={unit:m.Percent,value:.8};function F(n){return typeof n=="number"?{unit:m.Percent,value:n*100}:typeof n=="string"?n.match(/^(\d*(\.\d+)?)px$/)?{unit:m.Pixel,value:parseFloat(n)}:n.match(/^(\d*(\.\d+)?)%$/)?{unit:m.Percent,value:parseFloat(n)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),C):(console.warn("scrollThreshold should be string or number"),C)}var _e=function(n){ve(t,n);function t(r){var e=n.call(this,r)||this;return e.lastScrollTop=0,e.actionTriggered=!1,e.startY=0,e.currentY=0,e.dragging=!1,e.maxPullDownDistance=0,e.getScrollableTarget=function(){return e.props.scrollableTarget instanceof HTMLElement?e.props.scrollableTarget:typeof e.props.scrollableTarget=="string"?document.getElementById(e.props.scrollableTarget):(e.props.scrollableTarget===null&&console.warn(`You are trying to pass scrollableTarget but it is null. This might
        happen because the element may not have been added to DOM yet.
        See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.
      `),null)},e.onStart=function(o){e.lastScrollTop||(e.dragging=!0,o instanceof MouseEvent?e.startY=o.pageY:o instanceof TouchEvent&&(e.startY=o.touches[0].pageY),e.currentY=e.startY,e._infScroll&&(e._infScroll.style.willChange="transform",e._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},e.onMove=function(o){e.dragging&&(o instanceof MouseEvent?e.currentY=o.pageY:o instanceof TouchEvent&&(e.currentY=o.touches[0].pageY),!(e.currentY<e.startY)&&(e.currentY-e.startY>=Number(e.props.pullDownToRefreshThreshold)&&e.setState({pullToRefreshThresholdBreached:!0}),!(e.currentY-e.startY>e.maxPullDownDistance*1.5)&&e._infScroll&&(e._infScroll.style.overflow="visible",e._infScroll.style.transform="translate3d(0px, "+(e.currentY-e.startY)+"px, 0px)")))},e.onEnd=function(){e.startY=0,e.currentY=0,e.dragging=!1,e.state.pullToRefreshThresholdBreached&&(e.props.refreshFunction&&e.props.refreshFunction(),e.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){e._infScroll&&(e._infScroll.style.overflow="auto",e._infScroll.style.transform="none",e._infScroll.style.willChange="unset")})},e.onScrollListener=function(o){typeof e.props.onScroll=="function"&&setTimeout(function(){return e.props.onScroll&&e.props.onScroll(o)},0);var i=e.props.height||e._scrollableNode?o.target:document.documentElement.scrollTop?document.documentElement:document.body;if(!e.actionTriggered){var s=e.props.inverse?e.isElementAtTop(i,e.props.scrollThreshold):e.isElementAtBottom(i,e.props.scrollThreshold);s&&e.props.hasMore&&(e.actionTriggered=!0,e.setState({showLoader:!0}),e.props.next&&e.props.next()),e.lastScrollTop=i.scrollTop}},e.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:r.dataLength},e.throttledOnScrollListener=ye(150,e.onScrollListener).bind(e),e.onStart=e.onStart.bind(e),e.onMove=e.onMove.bind(e),e.onEnd=e.onEnd.bind(e),e}return t.prototype.componentDidMount=function(){if(typeof this.props.dataLength>"u")throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),typeof this.props.initialScrollY=="number"&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!="function"))throw new Error(`Mandatory prop "refreshFunction" missing.
          Pull Down To Refresh functionality will not work
          as expected. Check README.md for usage'`)},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},t.prototype.componentDidUpdate=function(r){this.props.dataLength!==r.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(r,e){var o=r.dataLength!==e.prevDataLength;return o?v(v({},e),{prevDataLength:r.dataLength}):null},t.prototype.isElementAtTop=function(r,e){e===void 0&&(e=.8);var o=r===document.body||r===document.documentElement?window.screen.availHeight:r.clientHeight,i=F(e);return i.unit===m.Pixel?r.scrollTop<=i.value+o-r.scrollHeight+1:r.scrollTop<=i.value/100+o-r.scrollHeight+1},t.prototype.isElementAtBottom=function(r,e){e===void 0&&(e=.8);var o=r===document.body||r===document.documentElement?window.screen.availHeight:r.clientHeight,i=F(e);return i.unit===m.Pixel?r.scrollTop+o>=r.scrollHeight-i.value:r.scrollTop+o>=i.value/100*r.scrollHeight},t.prototype.render=function(){var r=this,e=v({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),o=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),i=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return _.createElement("div",{style:i,className:"infinite-scroll-component__outerdiv"},_.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(s){return r._infScroll=s},style:e},this.props.pullDownToRefresh&&_.createElement("div",{style:{position:"relative"},ref:function(s){return r._pullDown=s}},_.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!o&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(f.Component);const we=_e;var Y=G,be=z,Se=M,$=Y?Y.isConcatSpreadable:void 0;function Ee(n){return Se(n)||be(n)||!!($&&n&&n[$])}var Te=Ee,Le=K,xe=Te;function k(n,t,r,e,o){var i=-1,s=n.length;for(r||(r=xe),o||(o=[]);++i<s;){var a=n[i];t>0&&r(a)?t>1?k(a,t-1,r,e,o):Le(o,a):e||(o[o.length]=a)}return o}var Me=k;function De(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}var Ce=De,O=W;function Fe(n,t){if(n!==t){var r=n!==void 0,e=n===null,o=n===n,i=O(n),s=t!==void 0,a=t===null,u=t===t,p=O(t);if(!a&&!p&&!i&&n>t||i&&s&&u&&!a&&!p||e&&s&&u||!r&&u||!o)return 1;if(!e&&!i&&!p&&n<t||p&&r&&o&&!e&&!i||a&&r&&o||!s&&o||!u)return-1}return 0}var Ye=Fe,$e=Ye;function Oe(n,t,r){for(var e=-1,o=n.criteria,i=t.criteria,s=o.length,a=r.length;++e<s;){var u=$e(o[e],i[e]);if(u){if(e>=a)return u;var p=r[e];return u*(p=="desc"?-1:1)}}return n.index-t.index}var Pe=Oe,L=V,Be=J,Ae=j,Re=re,je=Ce,ke=Q,He=Pe,Ne=D,Ue=M;function qe(n,t,r){t.length?t=L(t,function(i){return Ue(i)?function(s){return Be(s,i.length===1?i[0]:i)}:i}):t=[Ne];var e=-1;t=L(t,ke(Ae));var o=Re(n,function(i,s,a){var u=L(t,function(p){return p(i)});return{criteria:u,index:++e,value:i}});return je(o,function(i,s){return He(i,s,r)})}var Ge=qe;function ze(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}var Ke=ze,We=Ke,P=Math.max;function Ve(n,t,r){return t=P(t===void 0?n.length-1:t,0),function(){for(var e=arguments,o=-1,i=P(e.length-t,0),s=Array(i);++o<i;)s[o]=e[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=e[o];return a[t]=r(s),We(n,this,a)}}var Je=Ve;function Qe(n){return function(){return n}}var Xe=Qe,Ze=Xe,B=ie,Ie=D,et=B?function(n,t){return B(n,"toString",{configurable:!0,enumerable:!1,value:Ze(t),writable:!0})}:Ie,tt=et,rt=800,nt=16,ot=Date.now;function it(n){var t=0,r=0;return function(){var e=ot(),o=nt-(e-r);if(r=e,o>0){if(++t>=rt)return arguments[0]}else t=0;return n.apply(void 0,arguments)}}var st=it,at=tt,lt=st,ct=lt(at),ut=ct,pt=D,ht=Je,ft=ut;function dt(n,t){return ft(ht(n,t,pt),n+"")}var mt=dt,gt=X,vt=Z,yt=I,_t=ee;function wt(n,t,r){if(!_t(r))return!1;var e=typeof t;return(e=="number"?vt(r)&&yt(t,r.length):e=="string"&&t in r)?gt(r[t],n):!1}var bt=wt,St=Me,Et=Ge,Tt=mt,A=bt,Lt=Tt(function(n,t){if(n==null)return[];var r=t.length;return r>1&&A(n,t[0],t[1])?t=[]:r>2&&A(t[0],t[1],t[2])&&(t=[t[0]]),Et(n,St(t,1),[])}),xt=Lt;const Mt=R(xt);function zt(){const n=N(),t=f.useMemo(()=>Mt(n==="llh"?ne:oe,T=>T.created),[n]),[r,e]=f.useState(0),o=d(l=>l.mla),i=d(l=>l.mlg),s=d(l=>l.newFirst),a=f.useCallback(d(l=>l.toggleNewFirst),[]),u=f.useCallback(d(l=>l.setMla),[]),p=f.useCallback(d(l=>l.setMlg),[]);f.useLayoutEffect(()=>{window.scrollTo(0,0)},[]);function b(){e(r+1)}const y=3;let h=s?t:t.slice().reverse();h=ge(h,l=>o&&i?!0:o?l.mla:i?l.mlg:!1);const g=h.length;h=h.slice(0,(r+1)*y);const S=h.length<g;function E(l=!1){return{size:"sm",variant:l?"dark":"outline-dark"}}function H(){return c.jsxs("div",{className:"mb-3 episodes-btn-container",children:[c.jsx(w,{variant:"light",disabled:!0,className:"text-dark",children:"Filters"}),c.jsx(w,{...E(),className:"mx-2",onClick:a,children:s?c.jsx(c.Fragment,{children:"New→Old"}):c.jsx(c.Fragment,{children:"Old→New"})}),n==="mlg"&&c.jsxs(te,{className:"me-2",children:[c.jsx(w,{...E(i),onClick:p,children:"MLG"}),c.jsx(w,{...E(o),onClick:u,children:"MLA"})]})]})}return c.jsxs("div",{children:[H(),c.jsx(we,{dataLength:h.length,next:b,hasMore:S,loader:c.jsx("h4",{children:"Loading..."}),endMessage:c.jsx(c.Fragment,{}),children:h.map((l,T)=>c.jsx(se,{e:l,teaser:!0,i:T},l.id))})]})}export{zt as default};