(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5175],{32957:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/library",function(){return i(11226)}])},85528:function(e,t,i){"use strict";i.d(t,{NX:function(){return r},Nk:function(){return l},b:function(){return s},oE:function(){return o}});var n=i(30779);let a=172800,o=async(e,t)=>{if(a=t?0:172800,null==e)return JSON.parse(localStorage.getItem("RiveStreamWatchlist"))||void 0;{let t=localStorage.getItem("RiveStreamFBWatchlist"),i=null==(t=JSON.parse(t)||[])?void 0:t.find(t=>(null==t?void 0:t.userId)===e);return Date.now()-(null==i?void 0:i.timestamp)<1e3*a?i:(t=null==t?void 0:t.filter(t=>(null==t?void 0:t.userId)!==e),(0,n.WC)({userID:e}).then(async i=>(localStorage.setItem("RiveStreamFBWatchlist",JSON.stringify([...t,{...i,timestamp:Date.now(),userId:e}])),await i)).catch(e=>(console.error("Error fetching from Firebase:",e),JSON.parse(localStorage.getItem("RiveStreamWatchlist"))||void 0)))}},l=async e=>{let{userId:t=null,type:i,id:a}=e;if(null!==t){let e=localStorage.getItem("RiveStreamFBWatchlist");return(e=JSON.parse(e)||[]).forEach(e=>{var n;(null==e?void 0:e.userId)!==t||(null===(n=e[i])||void 0===n?void 0:n.includes(a))||(e[i]=[a,...e[i]||[]])}),localStorage.setItem("RiveStreamFBWatchlist",JSON.stringify(e)),(0,n.KO)({userID:t,type:i,id:a}).catch(async e=>{console.error("Error adding to Firebase:",e);var n,l,r=await o(t)||{movie:[],tv:[],manga:[]};(null===(n=r[i])||void 0===n?void 0:n.includes(a))||(r[i]=r[i].reverse(),null===(l=r[i])||void 0===l||l.push(a),r[i]=r[i].reverse(),localStorage.setItem("RiveStreamWatchlist",JSON.stringify(r)))})}var l,r,s=await o(t)||{movie:[],tv:[],manga:[]};(null===(l=s[i])||void 0===l?void 0:l.includes(a))||(s[i]=s[i].reverse(),null===(r=s[i])||void 0===r||r.push(a),s[i]=s[i].reverse(),localStorage.setItem("RiveStreamWatchlist",JSON.stringify(s)))},r=async e=>{let{userId:t=null,type:i,id:a}=e;if(null!==t){let e=localStorage.getItem("RiveStreamFBWatchlist");return(e=JSON.parse(e)||[]).forEach(e=>{var n;(null==e?void 0:e.userId)===t&&(null===(n=e[i])||void 0===n?void 0:n.includes(a))&&(e[i]=e[i].filter(e=>e!==a))}),localStorage.setItem("RiveStreamFBWatchlist",JSON.stringify(e)),(0,n.P0)({userID:t,type:i,id:a}).catch(async e=>{console.error("Error removing from Firebase:",e);var n,l=await o(t)||{movie:[],tv:[],manga:[]};(null===(n=l[i])||void 0===n?void 0:n.includes(a))&&(l[i]=l[i].filter(e=>e!==a),localStorage.setItem("RiveStreamWatchlist",JSON.stringify(l)))})}var l,r=await o(t)||{movie:[],tv:[],manga:[]};(null===(l=r[i])||void 0===l?void 0:l.includes(a))&&(r[i]=r[i].filter(e=>e!==a),localStorage.setItem("RiveStreamWatchlist",JSON.stringify(r)))},s=async e=>{var t;let{userId:i=null,type:n,id:a}=e;return null!==(t=(await o(i)||{movie:[],tv:[],manga:[]})[n])&&void 0!==t&&!!t.includes(a)}},38531:function(e,t,i){"use strict";i.d(t,{LD:function(){return o},MM:function(){return a},aI:function(){return l}});let n=(e,t,i)=>{var n,a,o,l;return console.log({values:e,type:t,id:i}),null!==(n=e[t])&&void 0!==n&&!!n.includes(i)||("movie"===t?null===(a=e[t])||void 0===a?void 0:a.includes(i):"tv"===t?null===(o=e[t])||void 0===o?void 0:o.some(e=>(null==e?void 0:e.id)===i):"manga"===t&&(null===(l=e[t])||void 0===l?void 0:l.some(e=>{let t;try{t=JSON.parse(i)}catch(e){t=i}return(null==e?void 0:e.id)===t})))},a=()=>JSON.parse(localStorage.getItem("RiveStreamContinueWatching")),o=e=>{let{type:t,id:i,season:r,episode:s,chapter:c}=e;var d=a()||{movie:[],tv:[],manga:[]};null!==t&&(n(d,t,i)?(l({type:t,id:i}),o({type:t,id:i,season:r,episode:s,chapter:c})):("tv"===t?d[t]=[{id:i,season:r,episode:s},...d[t]||[]]:"manga"===t?d[t]=[{id:i,chapter:c},...d[t]||[]]:d[t]=[i,...d[t]||[]],localStorage.setItem("RiveStreamContinueWatching",JSON.stringify(d))))},l=e=>{let{type:t,id:i}=e;var o,l=a()||{movie:[],tv:[],manga:[]};n(l,t,i)&&((null===(o=l[t])||void 0===o?void 0:o.includes(i))||"movie"===t?l[t]=l[t].filter(e=>e!==i):"tv"===t?l[t]=l[t].filter(e=>(null==e?void 0:e.id)!==i):"manga"===t&&(l[t]=l[t].filter(e=>{let t;try{t=JSON.parse(i)}catch(e){t=i}return(null==e?void 0:e.id)!==t})),localStorage.setItem("RiveStreamContinueWatching",JSON.stringify(l)))}},48136:function(e,t,i){"use strict";var n=i(85893),a=i(67294),o=i(88764),l=i.n(o),r=i(41664),s=i.n(r),c=i(13114),d=i(34221),u=i(72679);i(88922),t.Z=e=>{var t,i;let{data:o,media_type:r,link:v,type:m}=e,[h,p]=(0,a.useState)(!0),[g,f]=(0,a.useState)(!1);return(0,n.jsxs)(s(),{href:v||"".concat("collection"===r?"/collections/".concat(null==o?void 0:o.id):"manga"===m?"/read?type=".concat(m,"&id=").concat(null==o?void 0:o.id):"/detail?type=".concat(r,"&id=").concat(null==o?void 0:o.id)),className:l().MovieCardSmall,"aria-label":(null==o?void 0:o.name)||"poster","data-tooltip-id":"tooltip","data-tooltip-html":"".concat((null==o?void 0:null===(t=o.title)||void 0===t?void 0:t.length)>30||(null==o?void 0:null===(i=o.name)||void 0===i?void 0:i.length)>30?(null==o?void 0:o.title)||(null==o?void 0:o.name):""),children:[(0,n.jsx)(c.M,{mode:"sync",children:(0,n.jsx)(d.E.div,{whileHover:{y:"-0.5rem"},whileTap:{y:"0.2rem"},transition:{type:"spring",stiffness:400,damping:10},children:(0,n.jsx)("div",{className:"".concat(l().img," ").concat((null==o?void 0:o.poster_path)!==null&&(null==o?void 0:o.poster_path)!==void 0?"skeleton":null),children:(0,n.jsx)("div",{children:(0,n.jsx)(u.LazyLoadImage,{src:"".concat(g?"/images/fallback_person.jpg":(null==o?void 0:o.poster_path)!==null&&(null==o?void 0:o.poster_path)!==void 0?("manga"!==m?"https://image.tmdb.org/t/p/original".replace("/original","/w185"):"")+(null==o?void 0:o.poster_path):h?"/images/logo.svg":"/images/fallback_person.jpg"),height:"100%",width:"100%",useIntersectionObserver:!0,effect:"opacity",className:"".concat(l().img," ").concat(h?"skeleton":null),onLoad:()=>{setTimeout(()=>{p(!1)},700)},loading:"lazy",onError:e=>{console.log(e),f(!0),p(!1)},alt:(null==o?void 0:o.id)||"sm"},null==o?void 0:o.id)})})})}),(0,n.jsx)("p",{children:(null==o?void 0:o.title)||(null==o?void 0:o.name)})]},null==o?void 0:o.id)}},11226:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return E}});var n=i(85893),a=i(67294),o=i(2873),l=i(98387),r=i.n(l),s=i(48136),c=i(50549),d=i(85528),u=i(38531),v=i(20473),m=i(27385),h=i(44599),p=i(74865),g=i.n(p),f=i(85437),y=i(9008),w=i.n(y),b=i(41664),_=i.n(b),S=i(67992),x=i(86737),j=i(34221),N=i(86250);let k=e=>{if("object"!=typeof e||null===e)return!1;let t=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e||"number"==typeof e);return(!e.movie||t(e.movie))&&(!e.tv||t(e.tv))&&(!e.manga||t(e.manga))},C=e=>{let t,i,n;return"object"==typeof e&&null!==e&&(!e.movie||Array.isArray(t=e.movie)&&t.every(e=>"string"==typeof e))&&(!e.tv||Array.isArray(i=e.tv)&&i.every(e=>"object"==typeof e&&"id"in e&&"season"in e&&"episode"in e))&&(!e.manga||Array.isArray(n=e.manga)&&n.every(e=>"object"==typeof e&&"id"in e&&"chapter"in e))};var I=i(64712);let L=[1,2,3,4,5,6,7,8,9,10];var E=()=>{var e,t,i;let[l,p]=(0,a.useState)("watchlist"),[y,b]=(0,a.useState)("movie"),[E,O]=(0,a.useState)([]),[W,R]=(0,a.useState)([]),[P,D]=(0,a.useState)(!0),[M,A]=(0,a.useState)(!0),[J,B]=(0,a.useState)(),[F,T]=(0,a.useState)(!1),[U,Z]=(0,a.useState)("false"),[$,z]=(0,a.useState)(!1),[H,X]=(0,a.useState)(""),[V,q]=(0,a.useState)(""),[G,K]=(0,a.useState)("");(0,a.useEffect)(()=>{(0,m.Aj)(h.I8,async e=>{e&&B(e.uid),T(!0)});let e=(0,f.G)();Z(null==e?void 0:e.removeCW)},[]),(0,a.useEffect)(()=>{P?g().start():g().done(!1)},[P]),(0,a.useEffect)(()=>{D(!0),R([]);let e=new AbortController,t=e.signal;return(async()=>{let e=[];try{for(let p of E){if(t.aborted)return;let g=await (0,o.Z)({requestID:"manga"===y?"".concat(y,"Info"):"".concat(y,"Data"),id:(null==p?void 0:p.id)||p});if("manga"===y){var i,n,a,l,r,s,c,d,u,v,m,h;g={...null==g?void 0:g.data,poster_path:"https://proxy.corsflix.net/cors-anywhere/?destination=".concat(encodeURIComponent("https://uploads.mangadex.org/covers/".concat(null==g?void 0:null===(i=g.data)||void 0===i?void 0:i.id,"/").concat(null==g?void 0:null===(r=g.data)||void 0===r?void 0:null===(l=r.relationships)||void 0===l?void 0:null===(a=l.find(e=>(null==e?void 0:e.type)=="cover_art"))||void 0===a?void 0:null===(n=a.attributes)||void 0===n?void 0:n.fileName,".256.jpg"))),title:null==g?void 0:null===(h=g.data)||void 0===h?void 0:null===(m=h.attributes)||void 0===m?void 0:null===(v=m.title)||void 0===v?void 0:v[null===(u=Object)||void 0===u?void 0:null===(s=u.keys(null==g?void 0:null===(d=g.data)||void 0===d?void 0:null===(c=d.attributes)||void 0===c?void 0:c.title))||void 0===s?void 0:s[0]]}}if(t.aborted)return;void 0!==g&&await e.push(g),console.log({data:g}),void 0!==g&&""!==g&&(R(e=>[...e,g]),D(!1))}0===E.length&&F&&D(!1)}catch(e){t.aborted||(console.error("Error fetching data:",e),D(!1))}})(),()=>{e.abort()}},[E]),(0,a.useEffect)(()=>{let e=async()=>{if(R([]),"watchlist"===l){if(console.log({bypassCache:$}),null!=J)(0,d.oE)(J,$).then(e=>{"movie"===y?O(null==e?void 0:e.movie):"manga"!==y?O(null==e?void 0:e.tv):O(null==e?void 0:e.manga),z(!1)});else{let e=await (0,d.oE)(null);"movie"===y?O(null==e?void 0:e.movie):"manga"!==y?O(null==e?void 0:e.tv):O(null==e?void 0:e.manga)}}else if("continueWatching"===l){let e=await (0,u.MM)();"movie"===y?O(null==e?void 0:e.movie):"manga"!==y?O(null==e?void 0:e.tv):O(null==e?void 0:e.manga)}};F&&e()},[l,y,M,J,F]);let Y=async e=>{var t;let{type:i,id:n}=e;null!=J?null===(t=(0,d.NX)({userId:J,type:i,id:n}))||void 0===t||t.then(e=>setTimeout(()=>{A(!M)},500)):((0,d.NX)({userId:null,type:i,id:n}),A(!M))},Q=async e=>{let{type:t,id:i}=e;(0,u.aI)({type:t,id:JSON.stringify(i)}),A(!M)};function ee(e,t){let i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),a=document.createElement("a");a.href=n,a.download="".concat(t,".json"),document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}let et={export:{msg:"Download your watchlist or continue watching as JSON file",watchlist:async()=>{ee(await (0,d.oE)(J,$),"rive-watchlist".concat(J?"-".concat(J):""))},continueWatching:async()=>{ee(await (0,u.MM)(),"rive-continue-watching".concat(J?"-".concat(J):""))}},import:{msg:"Upload your watchlist or continue watching as JSON file.
The json structure should follow this structure:
Watchlist
\n
\n Continue Watching\n
\n {\n "movie":["278",],\n "tv":[{\n "id": "1399",\n "season": "1",\n "episode": "1"\n },],\n "manga":[{\n "id": "3b5c0def-79ae-44e8-9d71-9aa2e83f9a9f",\n "chapter": "bf4b3413-a6c9-4b55-bd59-7cc4e464de6f"\n },],\n}
'),watchlist:async()=>{let e=await ei();if(!e){I.Am.error("Watchlist data empty!");return}if(!k(e)){I.Am.error("Invalid watchlist data format!");return}let t=Object.keys(e),i=t.reduce((t,i)=>t+e[i].length,0),n=0;for(let a of(D(!0),t))for(let t of e[a])await (0,d.Nk)({userId:J,type:a,id:t}),q(Math.round(++n/i*100));D(!1),q(""),I.Am.success("All bookmarks have been set.")},continueWatching:async()=>{let e=await ei();if(!e){I.Am.error("Continue watching data empty!");return}if(!C(e)){I.Am.error("Invalid continue watching data format!");return}let t=Object.keys(e),i=t.reduce((t,i)=>t+e[i].length,0),n=0;for(let a of(D(!0),t))for(let t of e[a])"string"==typeof t?await (0,u.LD)({type:a,id:t}):await (0,u.LD)({type:a,...t}),K(Math.round(++n/i*100));D(!1),K(""),I.Am.success("All continue watching items have been set.")}}};async function ei(){try{let[e]=await window.showOpenFilePicker({types:[{description:"JSON Files",accept:{"application/json":[".json"]}}],multiple:!1}),t=await e.getFile(),i=await t.text(),n=JSON.parse(i);return console.log("Extracted JSON Data:",n),n}catch(e){return console.error("Error reading JSON file:",e),null}}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w(),{children:(0,n.jsx)("title",{children:"Rive | Library "})}),(0,n.jsxs)("div",{className:r().MoviePage,children:[""!==H&&(0,n.jsx)("div",{className:r().settingsPopover,onClick:()=>X(""),children:(0,n.jsxs)(j.E.div,{initial:{scale:0},animate:{scale:1},exit:{scale:0},className:r().settingsPopoverCard,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,n.jsx)("h3",{children:(0,n.jsxs)("span",{className:r().highlight,children:[H.charAt(0).toUpperCase()+H.slice(1)," Library Data"]})}),(0,n.jsx)("p",{dangerouslySetInnerHTML:{__html:null===(e=et[H])||void 0===e?void 0:e.msg}}),(0,n.jsxs)("div",{className:r().settingsPopoverBtns,children:[(0,n.jsx)("h5",{onClick:()=>X(""),children:"cancel"}),(0,n.jsxs)("h5",{onClick:null===(t=et[H])||void 0===t?void 0:t.watchlist,className:r().popoverConfirmBtn,children:["Watchlist","import"===H&&V&&(0,n.jsxs)("span",{children:["(",V,"%)"]})]}),(0,n.jsxs)("h5",{onClick:null===(i=et[H])||void 0===i?void 0:i.continueWatching,className:r().popoverConfirmBtn,children:["Continue W..","import"===H&&G&&(0,n.jsxs)("span",{children:["(",G,"%)"]})]})]})]})}),(0,n.jsx)("h1",{children:"Library"}),(0,n.jsxs)("div",{className:r().category,children:[(0,n.jsx)("p",{className:"".concat("watchlist"===l?r().active:r().inactive),onClick:()=>p("watchlist"),children:"Watchlist"}),(0,n.jsx)("p",{className:"".concat("continueWatching"===l?r().active:r().inactive),onClick:()=>p("continueWatching"),children:"Continue Watching"})]}),(0,n.jsxs)("div",{className:r().category,children:[(0,n.jsx)("p",{className:"".concat("movie"===y?r().active:r().inactive),onClick:()=>b("movie"),children:"Movie"}),(0,n.jsx)("p",{className:"".concat("tv"===y?r().active:r().inactive),onClick:()=>b("tv"),children:"TV Shows"}),(0,n.jsx)("p",{className:"".concat("manga"===y?r().active:r().inactive),onClick:()=>b("manga"),children:"Manga"})]}),(0,n.jsxs)("div",{className:r().featureList,children:[(0,n.jsxs)("div",{className:r().btn,onClick:()=>X("import"),children:[(0,n.jsx)(x.Fb$,{})," Import"]}),(0,n.jsxs)("div",{className:r().btn,onClick:()=>X("export"),children:[(0,n.jsx)(x.KF,{})," Export"]}),(0,n.jsxs)("div",{className:r().btn,onClick:()=>{z(!0),A(e=>!e)},"data-tooltip-id":"tooltip","data-tooltip-content":"Bypass local cache. Sync data with the cloud (logged-in users).",children:[(0,n.jsx)(N.chk,{})," Sync"]})]}),(0,n.jsx)("div",{className:r().movieList,children:(null==W?void 0:W.length)!==0&&(null==E?void 0:E.length)!==0&&void 0!==E?null==W?void 0:W.map(e=>{let t=null==E?void 0:E.find(t=>(null==t?void 0:t.id)==(null==e?void 0:e.id)||t==(null==e?void 0:e.id)),i=(0,S.T_)({type:y,id:(null==t?void 0:t.id)||t,season:null==t?void 0:t.season,episode:null==t?void 0:t.episode});return"watchlist"===l||"true"===U?(0,n.jsxs)("div",{className:r().watchlistItems,children:["watchlist"!=l&&("movie"===y||(null==t?void 0:t.id)!==void 0)?(0,n.jsx)(s.Z,{data:e,type:y,media_type:y,link:"movie"==y?"/watch?type=".concat(y,"&id=").concat(null==e?void 0:e.id):"manga"===y?"/read?type=".concat(y,"&id=").concat(null==e?void 0:e.id):"/watch?type=".concat(y,"&id=").concat(null==e?void 0:e.id,"&season=").concat(null==t?void 0:t.season,"&episode=").concat(null==t?void 0:t.episode)}):(0,n.jsx)(s.Z,{data:e,type:y,media_type:y}),"watchlist"!=l&&(null==t?void 0:t.id)!==void 0?(0,n.jsx)("p",{className:r().bookmarkTvData,children:"manga"===y?"CH:".concat((null==i?void 0:i.watchTime)||0):"S".concat(null==t?void 0:t.season,"E").concat(null==t?void 0:t.episode)}):null,"watchlist"!=l&&"manga"!==y&&(0,n.jsx)(_(),{href:"/detail?type=".concat(y,"&id=").concat(null==e?void 0:e.id),className:r().bookmarkDetailBtn,children:"Detail"}),"watchlist"!=l&&(null==i?void 0:i.watchPercentage)!==void 0&&(null==i?void 0:i.watchPercentage)!==0&&(0,n.jsx)("div",{className:"".concat(r().watchProgress),style:{width:"".concat(null==i?void 0:i.watchPercentage,"%")}}),(0,n.jsx)(v.tp7,{className:r().bookmarkIcon,"data-tooltip-id":"tooltip","data-tooltip-content":"Remove from ".concat("watchlist"===l?"Watchlist":"Continue Watching"),onClick:()=>{"watchlist"===l?Y({type:y,id:null==e?void 0:e.id}):Q({type:y,id:null==e?void 0:e.id})}})]}):(0,n.jsxs)("div",{className:r().watchlistItems,children:["watchlist"!=l&&("movie"===y||(null==t?void 0:t.id)!==void 0)?(0,n.jsx)(s.Z,{data:e,type:y,media_type:y,link:"movie"==y?"/watch?type=".concat(y,"&id=").concat(null==e?void 0:e.id):"manga"===y?"/read?type=".concat(y,"&id=").concat(null==e?void 0:e.id):"/watch?type=".concat(y,"&id=").concat(null==e?void 0:e.id,"&season=").concat(null==t?void 0:t.season,"&episode=").concat(null==t?void 0:t.episode)}):(0,n.jsx)(s.Z,{data:e,type:y,media_type:y}),"watchlist"!=l&&(null==i?void 0:i.watchPercentage)!==void 0&&(null==i?void 0:i.watchPercentage)!==0&&(0,n.jsx)("div",{className:"".concat(r().watchProgress),style:{width:"".concat(null==i?void 0:i.watchPercentage,"%")}}),"watchlist"!=l&&(null==t?void 0:t.id)!==void 0?(0,n.jsx)("p",{className:r().bookmarkTvData,children:"manga"===y?"CH:".concat((null==i?void 0:i.watchTime)||0):"S".concat(null==t?void 0:t.season,"E").concat(null==t?void 0:t.episode)}):null,"watchlist"!=l&&"manga"!==y&&(0,n.jsx)(_(),{href:"/detail?type=".concat(y,"&id=").concat(null==e?void 0:e.id),className:r().bookmarkDetailBtn,children:"Detail"})]})}):((null==E?void 0:E.length)===0||void 0===E)&&F&&!P?(0,n.jsx)("p",{children:"List Is Empty"}):L.map(e=>(0,n.jsx)(c.Z,{className:r().loading}))})]})]})}},88764:function(e){e.exports={MovieCardSmall:"style_MovieCardSmall__3alU4",img:"style_img__o9kL4"}},98387:function(e){e.exports={MoviePage:"Library_MoviePage__0s01o",category:"Library_category__xiu7W",featureList:"Library_featureList__8lVA5",btn:"Library_btn__iW2bV",movieList:"Library_movieList__IXaPD",watchlistItems:"Library_watchlistItems__tRFhH",bookmarkDetailBtn:"Library_bookmarkDetailBtn__SSlGR",bookmarkTvData:"Library_bookmarkTvData___1iSg",loading:"Library_loading__wq4pI",pagination:"Library_pagination__YtnHZ",page_item:"Library_page_item__r_ZTO",inactive:"Library_inactive__waMhc",active:"Library_active__0URRn",paginateActive:"Library_paginateActive__ojYnK",disabled:"Library_disabled__yIGeQ",watchProgress:"Library_watchProgress__DRUzg",settingsPopover:"Library_settingsPopover__8Xybw",settingsPopoverCard:"Library_settingsPopoverCard__zT5CA",codeWrapper:"Library_codeWrapper__2HzFt",settingsPopoverBtns:"Library_settingsPopoverBtns__qk0ow",popoverConfirmBtn:"Library_popoverConfirmBtn__Ae7b_"}},88922:function(){},13114:function(e,t,i){"use strict";i.d(t,{M:function(){return f}});var n=i(85893),a=i(67294),o=i(25364),l=i(96681),r=i(240),s=i(16014);class c extends a.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function d({children:e,isPresent:t}){let i=(0,a.useId)(),o=(0,a.useRef)(null),l=(0,a.useRef)({width:0,height:0,top:0,left:0}),{nonce:r}=(0,a.useContext)(s._);return(0,a.useInsertionEffect)(()=>{let{width:e,height:n,top:a,left:s}=l.current;if(t||!o.current||!e||!n)return;o.current.dataset.motionPopId=i;let c=document.createElement("style");return r&&(c.nonce=r),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` [data-motion-pop-id="${i}"] { position: absolute !important; width: ${e}px !important; height: ${n}px !important; top: ${a}px !important; left: ${s}px !important; } `),()=>{document.head.removeChild(c)}},[t]),(0,n.jsx)(c,{isPresent:t,childRef:o,sizeRef:l,children:a.cloneElement(e,{ref:o})})}let u=({children:e,initial:t,isPresent:i,onExitComplete:o,custom:s,presenceAffectsLayout:c,mode:u})=>{let m=(0,l.h)(v),h=(0,a.useId)(),p=(0,a.useCallback)(e=>{for(let t of(m.set(e,!0),m.values()))if(!t)return;o&&o()},[m,o]),g=(0,a.useMemo)(()=>({id:h,initial:t,isPresent:i,custom:s,onExitComplete:p,register:e=>(m.set(e,!1),()=>m.delete(e))}),c?[Math.random(),p]:[i,p]);return(0,a.useMemo)(()=>{m.forEach((e,t)=>m.set(t,!1))},[i]),a.useEffect(()=>{i||m.size||!o||o()},[i]),"popLayout"===u&&(e=(0,n.jsx)(d,{isPresent:i,children:e})),(0,n.jsx)(r.O.Provider,{value:g,children:e})};function v(){return new Map}var m=i(15947);let h=e=>e.key||"";function p(e){let t=[];return a.Children.forEach(e,e=>{(0,a.isValidElement)(e)&&t.push(e)}),t}var g=i(58868);let f=({children:e,custom:t,initial:i=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:c="sync",propagate:d=!1})=>{let[v,f]=(0,m.oO)(d),y=(0,a.useMemo)(()=>p(e),[e]),w=d&&!v?[]:y.map(h),b=(0,a.useRef)(!0),_=(0,a.useRef)(y),S=(0,l.h)(()=>new Map),[x,j]=(0,a.useState)(y),[N,k]=(0,a.useState)(y);(0,g.L)(()=>{b.current=!1,_.current=y;for(let e=0;e{let a=h(e),o=(!d||!!v)&&(y===N||w.includes(a));return(0,n.jsx)(u,{isPresent:o,initial:(!b.current||!!i)&&void 0,custom:o?void 0:t,presenceAffectsLayout:s,mode:c,onExitComplete:o?void 0:()=>{if(!S.has(a))return;S.set(a,!0);let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(null==I||I(),k(_.current),d&&(null==f||f()),r&&r())},children:e},a)})})}},50549:function(e,t,i){"use strict";i.d(t,{Z:function(){return o}});var n=i(67294);let a=n.createContext({});function o({count:e=1,wrapper:t,className:i,containerClassName:o,containerTestId:l,circle:r=!1,style:s,...c}){var d,u,v;let m=n.useContext(a),h={...c};for(let[e,t]of Object.entries(c))void 0===t&&delete h[e];let p={...m,...h,circle:r},g={...s,...function({baseColor:e,highlightColor:t,width:i,height:n,borderRadius:a,circle:o,direction:l,duration:r,enableAnimation:s=!0,customHighlightBackground:c}){let d={};return"rtl"===l&&(d["--animation-direction"]="reverse"),"number"==typeof r&&(d["--animation-duration"]=`${r}s`),s||(d["--pseudo-element-display"]="none"),("string"==typeof i||"number"==typeof i)&&(d.width=i),("string"==typeof n||"number"==typeof n)&&(d.height=n),("string"==typeof a||"number"==typeof a)&&(d.borderRadius=a),o&&(d.borderRadius="50%"),void 0!==e&&(d["--base-color"]=e),void 0!==t&&(d["--highlight-color"]=t),"string"==typeof c&&(d["--custom-highlight-background"]=c),d}(p)},f="react-loading-skeleton";i&&(f+=` ${i}`);let y=null!==(d=p.inline)&&void 0!==d&&d,w=[],b=Math.ceil(e);for(let t=0;te&&t===b-1){let t=null!==(u=i.width)&&void 0!==u?u:"100%",n=e%1,a="number"==typeof t?t*n:`calc(${t} * ${n})`;i={...i,width:a}}let a=n.createElement("span",{className:f,style:i,key:t},"‌");y?w.push(a):w.push(n.createElement(n.Fragment,{key:t},a,n.createElement("br",null)))}return n.createElement("span",{className:o,"data-testid":l,"aria-live":"polite","aria-busy":null===(v=p.enableAnimation)||void 0===v||v},t?w.map((e,i)=>n.createElement(t,{key:i},e)):w)}}},function(e){e.O(0,[4738,6660,3219,2888,9774,179],function(){return e(e.s=32957)}),_N_E=e.O()}]);