import{ar as qr,as as bn,r as u,j as s,J as ae,O as ns,g as le,H as Jr,M as tt,t as ss,C as Qr,ag as Zr,ae as Le,G as zt}from"./vendor-hcxuPA-n.js";import{H as Gn,r as we,J as zs,K as Yn,O as yn,L as ea,Q as Zt,R as ta,U as Rt,B as De,V as na,u as Vs,W as sa,X as Vt,Y as $t,Z as $s,_ as Hs,$ as ra,a0 as Xs,a1 as Cs,a2 as aa,a3 as Ws,I as Fe,a as ce,a4 as en,a5 as tn,a6 as be,a7 as qn,a8 as _,a9 as ia,aa as Ut,ab as zn,ac as Gs,ad as oa,ae as la,af as Ys,ag as ca,ah as da,ai as Gt,aj as jt,m as rs,ak as qs,al as ua,am as fa,an as Js,ao as ga,ap as ha,aq as Ss,ar as ma,as as ba,at as pa,au as Qs,c as xa,av as va,aw as Ns,ax as Ds,ay as ya,az as wa,aA as ja,aB as Ca,aC as Sa,aD as Na,aE as Da,aF as Ea}from"./index-DIeQO-sY.js";var wn={exports:{}};wn.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,c=9007199254740991,l="[object Arguments]",f="[object Array]",b="[object AsyncFunction]",g="[object Boolean]",h="[object Date]",v="[object Error]",y="[object Function]",N="[object GeneratorFunction]",j="[object Map]",w="[object Number]",E="[object Null]",S="[object Object]",D="[object Promise]",T="[object Proxy]",L="[object RegExp]",R="[object Set]",A="[object String]",I="[object Symbol]",U="[object Undefined]",z="[object WeakMap]",B="[object ArrayBuffer]",Y="[object DataView]",de="[object Float32Array]",pe="[object Float64Array]",Ge="[object Int8Array]",Ye="[object Int16Array]",ee="[object Int32Array]",qe="[object Uint8Array]",je="[object Uint8ClampedArray]",Ke="[object Uint16Array]",Je="[object Uint32Array]",q=/[\\^$.*+?()[\]{}|]/g,Ce=/^\[object .+?Constructor\]$/,Ee=/^(?:0|[1-9]\d*)$/,M={};M[de]=M[pe]=M[Ge]=M[Ye]=M[ee]=M[qe]=M[je]=M[Ke]=M[Je]=!0,M[l]=M[f]=M[B]=M[g]=M[Y]=M[h]=M[v]=M[y]=M[j]=M[w]=M[S]=M[L]=M[R]=M[A]=M[z]=!1;var J=typeof bn=="object"&&bn&&bn.Object===Object&&bn,$=typeof self=="object"&&self&&self.Object===Object&&self,H=J||$||Function("return this")(),xe=t&&!t.nodeType&&t,P=xe&&!0&&e&&!e.nodeType&&e,te=P&&P.exports===xe,ie=te&&J.process,Te=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),m=Te&&Te.isTypedArray;function Pe(a,d){for(var x=-1,C=a==null?0:a.length,V=0,k=[];++x-1}function ln(a,d){var x=this.__data__,C=un(x,a);return C<0?(++this.size,x.push([a,d])):x[C][1]=d,this}Ze.prototype.clear=on,Ze.prototype.delete=In,Ze.prototype.get=Ln,Ze.prototype.has=Mn,Ze.prototype.set=ln;function dt(a){var d=-1,x=a==null?0:a.length;for(this.clear();++dhe))return!1;var X=k.get(a);if(X&&k.get(d))return X==d;var Be=-1,et=!0,ye=x&o?new Tt:void 0;for(k.set(a,d),k.set(d,a);++Be-1&&a%1==0&&a-1&&a%1==0&&a<=c}function ys(a){var d=typeof a;return a!=null&&(d=="object"||d=="function")}function Kt(a){return a!=null&&typeof a=="object"}var ws=m?F(m):Lr;function Wr(a){return Hr(a)?Ar(a):Mr(a)}function Gr(){return[]}function Yr(){return!1}e.exports=Xr})(wn,wn.exports);var Ta=wn.exports;const Aa=qr(Ta);function G(e){const[t,n]=u.useState(void 0);u.useEffect(()=>{n(void 0)},[e]);const r=u.useMemo(()=>!Aa(t,e)&&t!==void 0,[t,e]),i=u.useCallback(l=>{l instanceof Function?n(f=>l(f!==void 0?f:e)):n(l)},[e,n]),o=t===void 0?e:t,c=u.useCallback(()=>n(void 0),[n]);return[o,i,c,r]}function ka(e,t,n,r,i,o,c,l,f,b,g,h,v,y,N,j,w,E,S,D,T,L){const[R,A,I,U]=G(i),[z,B,Y,de]=G(o),[pe,Ge,Ye,ee]=G(c),[qe,je,Ke,Je]=G(l),[q,Ce,Ee,M]=G(e),J=Gn(Kn=>Kn.setPreviewTheme),$=u.useCallback(()=>J(e),[J,e]),[H,xe,P,te]=G(t),[ie,Te,m,Pe]=G(n),[Ue,gt,p,F]=G(r),[K,st,rt,Se]=G(f),[Ct,Pt,Ot,Ae]=G(b),[ze,at,Ne,ke]=G(g),[pt,_t,St,Qe]=G(E),[xt,Nt,Dt,Ve]=G(h),[Et,Bt,ne,se]=G(v),[Q,Re,ue,re]=G(y),[fe,it,Z,Oe]=G(S),[Ie,_e,ot,$e]=G(N),[ge,ct,vt,an]=G(j),[kn,Rn,Ze,on]=G(w),[In,Ln,Mn,ln]=G(D),[dt,Pn,On,cn]=G(T),[_n,Bn,Tt,dn]=G(L);function Fn(){Ee(),$(),P(),m(),I(),Y(),Ye(),Ke(),p(),rt(),Ot(),Ne(),St(),Dt(),ne(),ue(),Z(),ot(),vt(),Ze(),Mn(),On(),Tt()}return{reset:Fn,changed:M||te||Pe||F||de||U||ee||Je||Se||Ae||ke||Qe||Ve||se||re||Oe||$e||an||on||ln||cn||dn,theme:{state:q,set:Ce,changed:M},appLanguage:{state:H,set:xe,changed:te},subtitleStyling:{state:ie,set:Te,changed:Pe},deviceName:{state:Ue,set:gt,changed:F},proxyUrls:{state:R,set:A,changed:U},backendUrl:{state:z,set:B,changed:de},febboxKey:{state:pe,set:Ge,changed:ee},realDebridKey:{state:qe,set:je,changed:Je},profile:{state:K,set:st,changed:Se},enableThumbnails:{state:Ct,set:Pt,changed:Ae},enableAutoplay:{state:ze,set:at,changed:ke},enableSkipCredits:{state:pt,set:_t,changed:Qe},enableDiscover:{state:xt,set:Nt,changed:Ve},enableFeatured:{state:Et,set:Bt,changed:se},enableDetailsModal:{state:Q,set:Re,changed:re},enableImageLogos:{state:fe,set:it,changed:Oe},sourceOrder:{state:Ie,set:_e,changed:$e},enableSourceOrder:{state:ge,set:ct,changed:an},proxyTmdb:{state:kn,set:Rn,changed:on},enableCarouselView:{state:In,set:Ln,changed:ln},forceCompactEpisodeView:{state:dt,set:Pn,changed:cn},enableLowPerformanceMode:{state:_n,set:Bn,changed:dn}}}function Ra(e){return s.jsx("p",{className:"text-type-text",children:e.children})}const Ia=()=>{document.querySelectorAll(".logout-button").forEach(t=>{t.click()})};function La(e){const{t}=ae(),n=Zt(),r=we(c=>{var l;return(l=c.account)==null?void 0:l.token}),[i,o]=ns(async()=>{var c;if(!r)throw new Error("No token present");if(!n)throw new Error("No backend set");await ta(n,r,e.id),(c=e.onRemove)==null||c.call(e)},[n,r,e.id]);return s.jsxs(Rt,{className:"flex justify-between items-center",paddingClass:"px-6 py-4",children:[s.jsxs("div",{className:"font-medium",children:[s.jsx(Ra,{children:t("settings.account.devices.deviceNameLabel")}),s.jsx("p",{className:"text-white",children:e.name})]}),e.isCurrent?null:s.jsx(De,{theme:"danger",className:"logout-button",loading:i.loading,onClick:o,children:t("settings.account.devices.removeDevice")})]})}function Ma(e){const{t}=ae(),n=we(c=>{var l;return(l=c.account)==null?void 0:l.seed}),r=e.sessions,i=we(c=>{var l;return(l=c.account)==null?void 0:l.sessionId}),o=u.useMemo(()=>{if(!n)return[];let c=r.map(l=>{const f=zs(l.device,Yn(n));return{current:l.id===i,id:l.id,name:f}});return c=c.sort((l,f)=>l.current?-1:f.current?1:l.name.localeCompare(f.name)),c},[n,r,i]);return n?s.jsxs("div",{children:[s.jsx(yn,{border:!0,className:"mt-0 mb-9",children:t("settings.account.devices.title")}),e.error?s.jsx("p",{children:t("settings.account.devices.failed")}):e.loading?s.jsx(ea,{}):s.jsx("div",{className:"space-y-5",children:o.map(c=>s.jsx(La,{name:c.name,id:c.id,isCurrent:c.current,onRemove:e.onChange},c.id))})]}):null}function Pa(){const{t:e}=ae(),t=Zt(),n=we(l=>l.account),{logout:r}=na(),i=Vs("account-delete"),[o,c]=ns(async()=>{!n||!t||(await sa(t,n),await r(),i.hide())},[r,n,t,i.hide]);return n?s.jsxs("div",{children:[s.jsx(yn,{border:!0,children:e("settings.account.actions.title")}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs(Vt,{paddingClass:"px-6 py-8",className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex-grow",children:[s.jsx($t,{children:e("settings.account.actions.migration.title")}),s.jsx("p",{className:"text-type-text mt-3",children:e("settings.account.actions.migration.text")})]}),s.jsx("div",{className:"mt-6 flex justify-center",children:s.jsx(De,{theme:"purple",onClick:()=>{window.location.href="/migration"},children:e("settings.account.actions.migration.button")})})]}),s.jsxs(Vt,{paddingClass:"px-6 py-8",className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex-grow",children:[s.jsx($t,{children:e("settings.account.actions.logoutAllDevices.title")}),s.jsx("p",{className:"text-type-text mt-3",children:e("settings.account.actions.logoutAllDevices.text")})]}),s.jsx("div",{className:"mt-6 flex justify-center",children:s.jsx(De,{theme:"danger",onClick:Ia,children:e("settings.account.actions.logoutAllDevices.button")})})]}),s.jsxs(Vt,{paddingClass:"px-6 py-8",className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex-grow",children:[s.jsx($t,{children:e("settings.account.actions.delete.title")}),s.jsx("p",{className:"text-type-text mt-3",children:e("settings.account.actions.delete.text")})]}),s.jsx("div",{className:"mt-6 flex justify-center",children:s.jsx(De,{theme:"danger",loading:o.loading,onClick:i.show,children:e("settings.account.actions.delete.button")})})]})]}),s.jsx($s,{id:i.id,children:s.jsxs(Hs,{children:[s.jsx(yn,{className:"!mt-0",children:e("settings.account.actions.delete.confirmTitle")}),s.jsx(ra,{children:e("settings.account.actions.delete.confirmDescription")}),s.jsxs("div",{className:"flex gap-4 mt-4 justify-between",children:[s.jsx(De,{theme:"secondary",onClick:i.hide,children:e("onboarding.defaultConfirm.cancel")}),s.jsx(De,{theme:"danger",loading:o.loading,onClick:c,children:e("settings.account.actions.delete.confirmButton")})]})]})})]}):null}function Oa(e){const{t}=ae();return s.jsx($s,{id:e.id,children:s.jsxs(Hs,{children:[s.jsxs("div",{className:"flex justify-between items-center mb-9",children:[s.jsx(yn,{className:"!mt-0 !mb-0",children:t("settings.account.profile.title")}),s.jsx(Xs,{profile:{colorA:e.colorA,colorB:e.colorB,icon:e.userIcon},iconClass:"text-2xl",sizeClass:"w-12 h-12"})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(Cs,{label:t("settings.account.profile.firstColor"),value:e.colorA,onInput:e.setColorA}),s.jsx(Cs,{label:t("settings.account.profile.secondColor"),value:e.colorB,onInput:e.setColorB}),s.jsx(aa,{label:t("settings.account.profile.userIcon"),value:e.userIcon,onInput:e.setUserIcon})]}),s.jsx("div",{className:"flex justify-center mt-8",children:s.jsx(De,{theme:"purple",className:"!px-20",onClick:e.close,children:t("settings.account.profile.finish")})})]})})}function _a(e){const{t}=ae(),{logout:n}=Ws(),r=Vs("profile-edit");return s.jsxs(Rt,{paddingClass:"px-8 py-10",className:"!mt-8",children:[s.jsx(Oa,{id:r.id,close:r.hide,colorA:e.colorA,setColorA:e.setColorA,colorB:e.colorB,setColorB:e.setColorB,userIcon:e.userIcon,setUserIcon:e.setUserIcon}),s.jsxs("div",{className:"grid lg:grid-cols-[auto,1fr] gap-8",children:[s.jsx("div",{children:s.jsx(Xs,{profile:{colorA:e.colorA,colorB:e.colorB,icon:e.userIcon},iconClass:"text-5xl",sizeClass:"w-32 h-32",bottom:s.jsxs("button",{type:"button",className:"tabbable text-xs flex gap-2 items-center bg-editBadge-bg text-editBadge-text hover:bg-editBadge-bgHover py-1 px-3 rounded-full cursor-pointer",onClick:r.show,children:[s.jsx(Fe,{icon:ce.EDIT}),t("settings.account.accountDetails.editProfile")]})})}),s.jsx("div",{children:s.jsxs("div",{className:"space-y-8 max-w-xs",children:[s.jsx(en,{label:t("settings.account.accountDetails.deviceNameLabel")??void 0,placeholder:t("settings.account.accountDetails.deviceNamePlaceholder")??void 0,value:e.deviceName,onChange:i=>e.setDeviceName(i)}),s.jsx("div",{className:"flex space-x-3",children:s.jsx(De,{className:"logout-button",theme:"danger",onClick:n,children:t("settings.account.accountDetails.logoutButton")})})]})})]})]})}const Ba=[{id:"default",selector:"theme-default",key:"settings.appearance.themes.default"},{id:"classic",selector:"theme-classic",key:"settings.appearance.themes.classic"},{id:"blue",selector:"theme-blue",key:"settings.appearance.themes.blue"},{id:"teal",selector:"theme-teal",key:"settings.appearance.themes.teal"},{id:"red",selector:"theme-red",key:"settings.appearance.themes.red"},{id:"gray",selector:"theme-gray",key:"settings.appearance.themes.gray"},{id:"green",selector:"theme-green",key:"settings.appearance.themes.green"},{id:"forest",selector:"theme-forest",key:"settings.appearance.themes.forest"},{id:"mocha",selector:"theme-mocha",key:"settings.appearance.themes.mocha"},{id:"pink",selector:"theme-pink",key:"settings.appearance.themes.pink"},{id:"noir",selector:"theme-noir",key:"settings.appearance.themes.noir"},{id:"ember",selector:"theme-ember",key:"settings.appearance.themes.ember"},{id:"acid",selector:"theme-acid",key:"settings.appearance.themes.acid"},{id:"spark",selector:"theme-spark",key:"settings.appearance.themes.spark"},{id:"grape",selector:"theme-grape",key:"settings.appearance.themes.grape"},{id:"spiderman",selector:"theme-spiderman",key:"settings.appearance.themes.spiderman"},{id:"wolverine",selector:"theme-wolverine",key:"settings.appearance.themes.wolverine"},{id:"hulk",selector:"theme-hulk",key:"settings.appearance.themes.hulk"},{id:"popsicle",selector:"theme-popsicle",key:"settings.appearance.themes.popsicle"}],Fa=function(t){const{t:n}=ae();return s.jsxs("div",{className:le(t.selector,"cursor-pointer group tabbable"),onClick:t.onClick,children:[s.jsxs("div",{tabIndex:0,onKeyUp:r=>r.key==="Enter"&&r.currentTarget.click(),className:le("tabbable scroll-mt-32 w-full h-32 relative rounded-lg border bg-gradient-to-br from-themePreview-primary/20 to-themePreview-secondary/10 bg-clip-content transition-colors duration-150",t.active?"border-themePreview-primary":"border-transparent group-hover:border-white/20"),children:[s.jsxs("div",{className:"absolute top-2 left-2",children:[s.jsx("div",{className:"h-5 w-5 bg-themePreview-primary rounded-full"}),s.jsx("div",{className:"h-5 w-5 bg-themePreview-secondary rounded-full -mt-2"})]}),s.jsx(Fe,{icon:ce.CHECKMARK,className:le("absolute top-3 right-3 text-xs text-white transition-opacity duration-150",t.active?"opacity-100":"opacity-0")}),s.jsx("div",{className:"absolute bottom-0 left-1/2 transform -translate-x-1/2 w-3/5 h-4/5 rounded-t-lg -mb-px bg-background-main overflow-hidden",children:s.jsxs("div",{className:"relative w-full h-full",children:[s.jsx("div",{className:"bg-themePreview-primary/50 w-[130%] h-10 absolute left-1/2 -top-5 blur-xl transform -translate-x-1/2 rounded-[100%]"}),s.jsxs("div",{className:"p-2 flex justify-between items-center",children:[s.jsxs("div",{className:"flex space-x-1",children:[s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-4 h-2 rounded-full"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-2 h-2 rounded-full"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-2 h-2 rounded-full"})]}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-2 h-2 rounded-full"})]}),s.jsxs("div",{className:"mt-1 flex items-center flex-col gap-1",children:[s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-20 w-8 h-0.5 rounded-full"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-20 w-6 h-0.5 rounded-full"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-16 h-2 mt-1 rounded-full"})]}),s.jsxs("div",{className:"mt-5 px-3",children:[s.jsxs("div",{className:"flex gap-1 items-center",children:[s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-20 w-2 h-2 rounded-full"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-20 w-8 h-0.5 rounded-full"})]}),s.jsxs("div",{className:"flex w-full gap-1 mt-1",children:[s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-full h-20 rounded"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-full h-20 rounded"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-full h-20 rounded"}),s.jsx("div",{className:"bg-themePreview-ghost bg-opacity-10 w-full h-20 rounded"})]})]})]})})]}),s.jsxs("div",{className:"mt-2 flex justify-between items-center",children:[s.jsx("span",{className:"font-medium text-white",children:t.name}),s.jsx("span",{className:le("inline-block px-3 py-1 leading-tight text-sm transition-opacity duration-150 rounded-full bg-pill-activeBackground text-white/85",t.inUse?"opacity-100":"opacity-0 pointer-events-none"),children:n("settings.appearance.activeTheme")})]})]})},Ka=Fa,Ua=function(t){const{t:n}=ae(),r=u.useRef(null),i=u.useRef(null),[o,c]=u.useState(!0),[l,f]=u.useState(!1),{enableLowPerformanceMode:b,setEnableDiscover:g,setEnableFeatured:h,setEnableDetailsModal:v,setEnableImageLogos:y,setForceCompactEpisodeView:N}=t;u.useEffect(()=>{b&&(g(!1),h(!1),v(!1),y(!1),N(!0))},[b,g,h,v,y,N]);const j=()=>{const w=r.current;w&&(c(w.scrollTop<=0),f(Math.abs(w.scrollHeight-w.scrollTop-w.clientHeight)<2))};return u.useEffect(()=>{const w=r.current;if(w)return w.addEventListener("scroll",j),j(),()=>w.removeEventListener("scroll",j)},[]),u.useEffect(()=>{if(i.current&&r.current){const w=i.current,E=r.current,S=w.getBoundingClientRect(),D=E.getBoundingClientRect();E.scrollTop=S.top+E.scrollTop-D.top-(D.height-S.height)/2,j()}},[t.active]),s.jsxs("div",{className:"space-y-12",children:[s.jsx(tn,{border:!0,children:n("settings.appearance.title")}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.discover")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.discoverDescription")}),s.jsxs("div",{onClick:()=>{if(!t.enableLowPerformanceMode){const w=!t.enableDiscover;t.setEnableDiscover(w),w||t.setEnableFeatured(!1)}},className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",t.enableLowPerformanceMode?"cursor-not-allowed opacity-50 pointer-events-none":"cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.enableDiscover}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.discoverLabel")})]})]}),t.enableDiscover&&!t.enableLowPerformanceMode&&s.jsxs("div",{className:"pt-4 pl-4 border-l-8 border-dropdown-background",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.featured")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.featuredDescription")}),s.jsxs("div",{onClick:()=>t.setEnableFeatured(!t.enableFeatured),className:"bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",children:[s.jsx(be,{enabled:t.enableFeatured}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.featuredLabel")})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.modal")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.modalDescription")}),s.jsxs("div",{onClick:()=>!t.enableLowPerformanceMode&&t.setEnableDetailsModal(!t.enableDetailsModal),className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",t.enableLowPerformanceMode?"cursor-not-allowed opacity-50 pointer-events-none":"cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.enableDetailsModal}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.modalLabel")})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.logos")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.logosDescription")}),s.jsxs("p",{className:"max-w-[25rem] font-medium pt-2 items-center flex gap-4",children:[s.jsx(Fe,{icon:ce.CIRCLE_EXCLAMATION,className:""}),n("settings.appearance.options.logosNotice")]}),s.jsxs("div",{onClick:()=>!t.enableLowPerformanceMode&&t.setEnableImageLogos(!t.enableImageLogos),className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",t.enableLowPerformanceMode?"cursor-not-allowed opacity-50 pointer-events-none":"cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.enableImageLogos}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.logosLabel")})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.carouselView")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.carouselViewDescription")}),s.jsxs("div",{onClick:()=>t.setEnableCarouselView(!t.enableCarouselView),className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg","cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.enableCarouselView}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.carouselViewLabel")})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.appearance.options.forceCompactEpisodeView")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.appearance.options.forceCompactEpisodeViewDescription")}),s.jsxs("div",{onClick:()=>!t.enableLowPerformanceMode&&t.setForceCompactEpisodeView(!t.forceCompactEpisodeView),className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",t.enableLowPerformanceMode?"cursor-not-allowed opacity-50 pointer-events-none":"cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.forceCompactEpisodeView}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.appearance.options.forceCompactEpisodeViewLabel")})]})]})]}),s.jsx("div",{className:"space-y-8",children:s.jsx("div",{ref:r,className:le("grid grid-cols-2 gap-4 max-w-[600px] max-h-[36rem] md:max-h-[64rem] overflow-y-auto","vertical-carousel-container",{"hide-top-gradient":o,"hide-bottom-gradient":l}),children:Ba.map(w=>s.jsx("div",{ref:t.active===w.id?i:null,children:s.jsx(Ka,{selector:w.selector,active:t.active===w.id,inUse:t.inUse===w.id,name:n(w.key),onClick:()=>t.setTheme(w.id)})},w.id))})})]})]})},za=Ua;function Es(e){const{t}=ae();return s.jsxs("div",{className:le({"pointer-events-none overflow-hidden w-full rounded":!0,"aspect-video relative":!e.fullscreen,"fixed inset-0 z-[60]":e.fullscreen}),children:[e.fullscreen&&e.show?s.jsx(Jr,{children:s.jsx("html",{"data-no-scroll":!0})}):null,s.jsx(Ys,{animation:"fade",show:e.show,children:s.jsxs("div",{className:"absolute inset-0 pointer-events-auto",style:{backgroundImage:"radial-gradient(102.95% 87.07% at 100% 100%, #EEAA45 0%, rgba(165, 186, 151, 0.56) 54.69%, rgba(74, 207, 254, 0.00) 100%), linear-gradient(180deg, #48D3FF 0%, #3B27B2 100%)"},children:[s.jsx("button",{type:"button",className:"tabbable bg-black absolute right-3 top-3 text-white bg-opacity-25 duration-100 transition-[background-color,transform] active:scale-110 hover:bg-opacity-50 p-2 rounded-md cursor-pointer",onClick:e.onToggle,children:s.jsx(Fe,{icon:e.fullscreen?ce.X:ce.EXPAND})}),s.jsx("div",{className:"text-white pointer-events-none absolute flex w-full flex-col items-center transition-[bottom] p-4",style:{bottom:`${e.styling.verticalPosition*4}px`},children:s.jsx("div",{className:e.fullscreen?"":"transform origin-bottom text-[0.5rem]",children:s.jsx(ca,{text:t("settings.subtitles.previewQuote")??void 0,styling:e.styling,overrideCasing:!1})})})]})})]})}function Va(e){const{t}=ae(),[n,r]=u.useState(!1),i=qn(),o=_(),c=ia(g=>g.setCaptionAsTrack),l=o.enableNativeSubtitles;u.useEffect(()=>{i.updateStyling(e.styling)},[e.styling,i,i.updateStyling]),u.useEffect(()=>{c(l)},[l,c]);const f=g=>{e.setStyling(g),i.updateStyling(g)},b=()=>{i.resetStyling(),e.setStyling({color:"#ffffff",backgroundOpacity:.5,size:1,backgroundBlur:.5,bold:!1,verticalPosition:3,fontStyle:"default"})};return s.jsxs("div",{children:[s.jsx(tn,{border:!0,children:t("settings.subtitles.title")}),s.jsxs("div",{className:"grid md:grid-cols-[1fr,356px] gap-8",children:[s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx(Ut.FieldTitle,{children:t("player.menus.subtitles.useNativeSubtitles")}),s.jsx("div",{className:"flex justify-center items-center",children:s.jsx(be,{enabled:l,onClick:()=>o.setEnableNativeSubtitles(!l)})})]}),s.jsx("span",{className:"text-xs text-type-secondary",children:t("player.menus.subtitles.useNativeSubtitlesDescription")}),!l&&s.jsxs(s.Fragment,{children:[s.jsx(zn,{label:t("settings.subtitles.backgroundLabel"),max:100,min:0,onChange:g=>f({...e.styling,backgroundOpacity:g/100}),value:e.styling.backgroundOpacity*100,textTransformer:g=>`${g}%`}),s.jsx(zn,{label:t("settings.subtitles.backgroundBlurLabel"),max:100,min:0,onChange:g=>f({...e.styling,backgroundBlur:g/100}),value:e.styling.backgroundBlur*100,textTransformer:g=>`${g}%`}),s.jsx(zn,{label:t("settings.subtitles.textSizeLabel"),max:200,min:1,textTransformer:g=>`${g}%`,onChange:g=>f({...e.styling,size:g/100}),value:e.styling.size*100}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx(Ut.FieldTitle,{children:t("settings.subtitles.textStyle.title")}),s.jsx("div",{className:"w-30",children:s.jsx(Gs,{options:[{id:"default",name:t("settings.subtitles.textStyle.default")},{id:"raised",name:t("settings.subtitles.textStyle.raised")},{id:"depressed",name:t("settings.subtitles.textStyle.depressed")},{id:"uniform",name:t("settings.subtitles.textStyle.uniform")},{id:"dropShadow",name:t("settings.subtitles.textStyle.dropShadow")}],selectedItem:{id:e.styling.fontStyle,name:t(`settings.subtitles.textStyle.${e.styling.fontStyle}`)||e.styling.fontStyle},setSelectedItem:g=>f({...e.styling,fontStyle:g.id})})})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx(Ut.FieldTitle,{children:t("settings.subtitles.textBoldLabel")}),s.jsx("div",{className:"flex justify-center items-center",children:s.jsx(be,{enabled:e.styling.bold,onClick:()=>f({...e.styling,bold:!e.styling.bold})})})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx(Ut.FieldTitle,{children:t("settings.subtitles.colorLabel")}),s.jsxs("div",{className:"flex justify-center items-center space-x-2",children:[oa.map(g=>s.jsx(la,{onClick:()=>f({...e.styling,color:g}),color:g,active:e.styling.color===g},g)),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"color",value:e.styling.color,onChange:g=>{const h=g.target.value;f({...e.styling,color:h}),i.updateStyling({...e.styling,color:h})},className:"absolute opacity-0 cursor-pointer w-8 h-8"}),s.jsx("div",{style:{color:e.styling.color},children:s.jsx(Fe,{icon:ce.BRUSH,className:"text-2xl"})})]})]})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx(Ut.FieldTitle,{children:t("settings.subtitles.verticalPositionLabel")}),s.jsxs("div",{className:"flex justify-center items-center space-x-2",children:[s.jsx("button",{type:"button",className:le("px-3 py-1 rounded transition-colors duration-100",e.styling.verticalPosition===3?"bg-video-context-buttonFocus":"bg-video-context-buttonFocus bg-opacity-0 hover:bg-opacity-50"),onClick:()=>f({...e.styling,verticalPosition:3}),children:t("settings.subtitles.default")}),s.jsx("button",{type:"button",className:le("px-3 py-1 rounded transition-colors duration-100",e.styling.verticalPosition===1?"bg-video-context-buttonFocus":"bg-video-context-buttonFocus bg-opacity-0 hover:bg-opacity-50"),onClick:()=>f({...e.styling,verticalPosition:1}),children:t("settings.subtitles.low")})]})]}),s.jsx(De,{className:"w-full md:w-auto",theme:"secondary",onClick:b,children:t("settings.reset")})]})]}),!l&&s.jsxs(s.Fragment,{children:[s.jsx(Es,{show:!0,styling:e.styling,onToggle:()=>r(g=>!g)}),s.jsx(Es,{show:n,fullscreen:!0,styling:e.styling,onToggle:()=>r(g=>!g)})]})]})]})}function $a({proxyUrls:e,setProxyUrls:t,proxyTmdb:n,setProxyTmdb:r}){const{t:i}=ae(),o=u.useCallback(()=>{t(b=>[...b??[],""])},[t]),c=u.useCallback((b,g)=>{t(h=>[...(h??[]).map((v,y)=>y!==b?v:g)])},[t]),l=u.useCallback(b=>{t(g=>[...(g??[]).filter((h,v)=>v!==b)])},[t]),f=u.useCallback(()=>{const b=e===null?[]:null;t(b),b===null&&r(!1)},[e,t,r]);return s.jsxs(Rt,{children:[s.jsxs("div",{className:"flex justify-between items-center gap-4",children:[s.jsxs("div",{className:"my-3",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:i("settings.connections.workers.label")}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:s.jsx(tt,{i18nKey:"settings.connections.workers.description",children:s.jsx(Gt,{to:"https://docs.pstream.mov/proxy/deploy",children:i("settings.connections.workers.documentation")})})})]}),s.jsx("div",{children:s.jsx(be,{onClick:f,enabled:e!==null})})]}),e!==null?s.jsxs(s.Fragment,{children:[s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsx("p",{className:"text-white font-bold mb-3",children:i("settings.connections.workers.urlLabel")}),s.jsxs("div",{className:"my-6 space-y-2 max-w-md",children:[((e==null?void 0:e.length)??0)===0?s.jsx("p",{children:i("settings.connections.workers.emptyState")}):null,(e??[]).map((b,g)=>s.jsxs("div",{className:"grid grid-cols-[1fr,auto] items-center gap-2",children:[s.jsx(en,{value:b,onChange:h=>c(g,h),placeholder:i("settings.connections.workers.urlPlaceholder")??void 0}),s.jsx("button",{type:"button",onClick:()=>l(g),className:"h-full scale-90 hover:scale-100 rounded-full aspect-square bg-authentication-inputBg hover:bg-authentication-inputBgHover flex justify-center items-center transition-transform duration-200 hover:text-white cursor-pointer",children:s.jsx(Fe,{className:"text-xl",icon:ce.X})})]},g))]}),s.jsx(De,{theme:"purple",onClick:o,children:i("settings.connections.workers.addButton")}),s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsxs("div",{className:"flex justify-between items-center gap-4",children:[s.jsxs("div",{className:"my-3",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:i("settings.connections.workers.proxyTMDB.title")}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:i("settings.connections.workers.proxyTMDB.description")})]}),s.jsx("div",{children:s.jsx(be,{enabled:n,onClick:()=>r(!n)})})]})]}):null]})}function Ha({backendUrl:e,setBackendUrl:t}){const{t:n}=ae(),r=we();return s.jsxs(Rt,{children:[s.jsxs("div",{className:"flex justify-between items-center gap-4",children:[s.jsxs("div",{className:"my-3",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.connections.server.label")}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:s.jsx(tt,{i18nKey:"settings.connections.server.description",children:s.jsx(Gt,{to:"https://docs.pstream.mov/backend/deploy",children:n("settings.connections.server.documentation")})})}),r.account&&s.jsxs("div",{children:[s.jsx("br",{}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:s.jsx(tt,{i18nKey:"settings.connections.server.migration.description",children:s.jsx(Gt,{to:"/migration",children:n("settings.connections.server.migration.link")})})})]})]}),s.jsx("div",{children:s.jsx(be,{onClick:()=>t(i=>i===null?"":null),enabled:e!==null})})]}),e!==null?s.jsxs(s.Fragment,{children:[s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.connections.server.urlLabel")}),s.jsx(en,{onChange:t,value:e??"",placeholder:"https://"})]}):null]})}async function Xa(e){return e?await fa(e):"unset"}function Wa({febboxKey:e,setFebboxKey:t}){const{t:n}=ae(),[r,i]=u.useState(!1),o=we(),c=_();u.useEffect(()=>{o.account&&e===null&&c.febboxKey&&t(c.febboxKey)},[o.account,e,c.febboxKey,t]);const[l,f]=u.useState("unset"),b={error:"error",success:"success",unset:"noresult",api_down:"error",invalid_token:"error"};if(u.useEffect(()=>{(async()=>{const h=await Xa(e);f(h)})()},[e]),rs().ALLOW_FEBBOX_KEY)return s.jsxs(Rt,{children:[s.jsxs("div",{className:"flex justify-between items-center gap-4",children:[s.jsxs("div",{className:"my-3",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("fedapi.onboarding.title")}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:s.jsx(tt,{i18nKey:"fedapi.onboarding.description"})})]}),s.jsx("div",{children:s.jsx(be,{onClick:()=>t(g=>g===null?"":null),enabled:e!==null})})]}),e!==null?s.jsxs(s.Fragment,{children:[s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsxs("div",{className:"my-3",children:[s.jsxs("p",{className:"max-w-[30rem] font-medium",children:[n("fedapi.setup.title"),s.jsx("br",{}),s.jsxs("div",{onClick:()=>i(!r),className:"flex items-center justify-between p-1 px-2 my-2 w-fit border border-type-secondary rounded-lg cursor-pointer text-type-secondary hover:text-white transition-colors duration-200",children:[s.jsx("span",{className:"text-sm",children:n(r?"fedapi.setup.hideVideo":"fedapi.setup.showVideo")}),r?s.jsx(Fe,{icon:ce.CHEVRON_UP,className:"pl-1"}):s.jsx(Fe,{icon:ce.CHEVRON_DOWN,className:"pl-1"})]}),r&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative pt-[56.25%] mt-2",children:s.jsx("iframe",{src:"https://player.vimeo.com/video/1059834885?h=c3ab398d42&badge=0&autopause=0&player_id=0&app_id=58479",allow:"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media",className:"absolute top-0 left-0 w-full h-full border border-type-secondary rounded-lg bg-black",title:"P-Stream FED API Setup Tutorial"})}),s.jsx("br",{})]}),s.jsx(tt,{i18nKey:"fedapi.setup.step.1",children:s.jsx(Gt,{url:"https://febbox.com"})}),s.jsx("br",{}),s.jsx(tt,{i18nKey:"fedapi.setup.step.2"}),s.jsx("br",{}),s.jsx(tt,{i18nKey:"fedapi.setup.step.3"}),s.jsx("br",{}),s.jsx(tt,{i18nKey:"fedapi.setup.step.4"}),s.jsx("br",{}),s.jsx(tt,{i18nKey:"fedapi.setup.step.5"})]}),s.jsx("p",{className:"text-type-danger mt-2",children:s.jsx(tt,{i18nKey:"fedapi.setup.step.warning"})})]}),s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.connections.febbox.tokenLabel","Token")}),s.jsxs("div",{className:"flex items-center w-full",children:[s.jsx(qs,{type:b[l],className:"mx-2 mr-4"}),s.jsx(en,{onChange:g=>{t(g)},value:e??"",placeholder:"eyABCdE...",passwordToggleable:!0,className:"flex-grow"})]}),l==="error"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("fedapi.status.failure")}),l==="api_down"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("fedapi.status.api_down")}),l==="invalid_token"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("fedapi.status.invalid_token")})]}):null]})}async function Ga(e){return e?await ua(e):"unset"}function Ya({realDebridKey:e,setRealDebridKey:t}){const{t:n}=ae(),r=we(),i=_();u.useEffect(()=>{r.account&&e===null&&i.realDebridKey&&t(i.realDebridKey)},[r.account,e,i.realDebridKey,t]);const[o,c]=u.useState("unset"),l={error:"error",success:"success",unset:"noresult",api_down:"error",invalid_token:"error"};return u.useEffect(()=>{(async()=>{const b=await Ga(e);c(b)})()},[e]),rs().ALLOW_REAL_DEBRID_KEY?s.jsxs(Rt,{children:[s.jsxs("div",{className:"flex justify-between items-center gap-4",children:[s.jsxs("div",{className:"my-3",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("realdebrid.title")}),s.jsx("p",{className:"max-w-[30rem] font-medium",children:n("realdebrid.description")}),s.jsx(Gt,{children:s.jsx("a",{href:"https://real-debrid.com/",target:"_blank",rel:"noreferrer",children:"real-debrid.com"})})]}),s.jsx("div",{className:"flex items-center gap-3",children:s.jsx(be,{onClick:()=>t(f=>f===null?"":null),enabled:e!==null})})]}),e!==null?s.jsxs(s.Fragment,{children:[s.jsx(jt,{marginClass:"my-6 px-8 box-content -mx-8"}),s.jsx("p",{className:"text-white font-bold mb-3",children:n("realdebrid.tokenLabel")}),s.jsxs("div",{className:"flex items-center w-full",children:[s.jsx(qs,{type:l[o],className:"mx-2 mr-4"}),s.jsx(en,{onChange:f=>{t(f)},value:e??"",placeholder:"ABC123...",passwordToggleable:!0,className:"flex-grow"})]}),o==="error"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("realdebrid.status.failure")}),o==="api_down"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("realdebrid.status.api_down")}),o==="invalid_token"&&s.jsx("p",{className:"text-type-danger mt-4",children:n("realdebrid.status.invalid_token")})]}):null]}):null}function qa(e){const{t}=ae();return s.jsxs("div",{children:[s.jsx(tn,{border:!0,children:t("settings.connections.title")}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(da,{})," ",s.jsx($a,{proxyUrls:e.proxyUrls,setProxyUrls:e.setProxyUrls,proxyTmdb:e.proxyTmdb,setProxyTmdb:e.setProxyTmdb}),s.jsx(Ha,{backendUrl:e.backendUrl,setBackendUrl:e.setBackendUrl}),s.jsx(Ya,{realDebridKey:e.realDebridKey,setRealDebridKey:e.setRealDebridKey}),s.jsx(Wa,{febboxKey:e.febboxKey,setFebboxKey:e.setFebboxKey})]})]})}function Ja(){const e=ss(),{t}=ae();return s.jsx("div",{children:s.jsxs(Vt,{paddingClass:"px-6 py-12",className:"grid grid-cols-2 gap-12 mt-5",children:[s.jsxs("div",{children:[s.jsx($t,{children:t("settings.account.register.title")}),s.jsx("p",{className:"text-type-text",children:t("settings.account.register.text")})]}),s.jsx("div",{className:"flex justify-end items-center",children:s.jsx(De,{theme:"purple",onClick:()=>e("/register"),children:t("settings.account.register.cta")})})]})})}function Ts(e){return s.jsxs("section",{className:e.className??"",children:[s.jsx("p",{className:"text-sm font-bold uppercase text-settings-sidebar-type-secondary mb-2",children:e.title}),e.children]})}function Qa(e){return s.jsxs("button",{type:"button",onClick:e.onClick,className:le("tabbable w-full px-3 py-2 flex items-center space-x-3 cursor-pointer rounded my-2",e.active?"bg-settings-sidebar-activeLink text-settings-sidebar-type-activated":null),children:[s.jsx(Fe,{className:le("text-2xl text-settings-sidebar-type-icon",e.active?"text-settings-sidebar-type-iconActivated":null),icon:e.icon}),s.jsx("span",{children:e.children})]})}const Za=16;function ei(e){const{t}=ae(),n=e.url?e.url.startsWith("https://"):!1;return s.jsxs("div",{className:"flex items-center gap-1 -mx-1 ml-3 px-1 rounded bg-largeCard-background font-bold",children:[s.jsx(Fe,{icon:n?ce.LOCK:ce.UNLOCK}),t(n?"settings.sidebar.info.secure":"settings.sidebar.info.insecure")]})}function ti(){var g;const{t:e}=ae(),{isMobile:t}=Js(),{account:n}=we(),r=location.hostname,[i,o]=u.useState(""),c=[{textKey:"settings.account.title",id:"settings-account",icon:ce.USER},{textKey:"settings.preferences.title",id:"settings-preferences",icon:ce.SETTINGS},{textKey:"settings.appearance.title",id:"settings-appearance",icon:ce.BRUSH},{textKey:"settings.subtitles.title",id:"settings-captions",icon:ce.CAPTIONS},{textKey:"settings.connections.title",id:"settings-connection",icon:ce.LINK}],l=Zt(),f=Qr(async()=>{if(l)return ga(l)},[l]);u.useEffect(()=>{function h(){var j;const y=(window.innerHeight||document.documentElement.clientHeight)/4,N=c.map(w=>{const E=document.getElementById(w.id);if(!E)return{distance:1/0,link:w.id};const S=E.getBoundingClientRect(),D=Math.abs(y-S.top),T=Math.abs(y-S.bottom);return{distance:Math.min(T,D),link:w.id}}).sort((w,E)=>w.distance-E.distance);window.innerHeight+window.scrollY>=document.body.offsetHeight?o(c[c.length-1].id):o(((j=N[0])==null?void 0:j.link)??"")}return document.addEventListener("scroll",h),h(),()=>{document.removeEventListener("scroll",h)}});const b=u.useCallback(h=>{const v=document.getElementById(h);if(!v)return null;const y=v.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:y-120,behavior:"smooth"})},[]);return s.jsx("div",{className:"text-settings-sidebar-type-inactive sidebar-boundary",children:s.jsxs(Zr,{topOffset:-6*Za,stickyClassName:"pt-[6rem]",disabled:t,hideOnBoundaryHit:!1,boundaryElement:".sidebar-boundary",children:[s.jsxs("div",{className:"hidden lg:block",children:[s.jsx(Ts,{title:e("global.pages.settings"),children:c.map(h=>s.jsx(Qa,{icon:h.icon,active:h.id===i,onClick:()=>b(h.id),children:e(h.textKey)},h.id))}),s.jsx(jt,{})]}),s.jsx(Ts,{className:"text-sm",title:e("settings.sidebar.info.title"),children:s.jsxs("div",{className:"px-3 py-3.5 rounded-lg bg-largeCard-background bg-opacity-50 grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"col-span-2 space-y-1",children:[s.jsx("p",{className:"text-type-dimmed font-medium",children:e("settings.sidebar.info.hostname")}),s.jsx("p",{className:"text-white",children:r})]}),s.jsxs("div",{className:"col-span-2 space-y-1",children:[s.jsxs("div",{className:"text-type-dimmed font-medium flex items-center",children:[s.jsx("p",{children:e("settings.sidebar.info.backendUrl")}),s.jsx(ei,{url:l})]}),s.jsx("p",{className:"text-white",children:(l==null?void 0:l.replace(/https?:\/\//,""))??"—"})]}),s.jsxs("div",{className:"col-span-2 space-y-1",children:[s.jsx("p",{className:"text-type-dimmed font-medium",children:e("settings.sidebar.info.userId")}),s.jsx("p",{className:"text-white",children:(n==null?void 0:n.userId)??e("settings.sidebar.info.notLoggedIn")})]}),s.jsxs("div",{className:"col-span-1 space-y-1",children:[s.jsx("p",{className:"text-type-dimmed font-medium",children:e("settings.sidebar.info.appVersion")}),s.jsx("p",{className:"text-type-dimmed px-2 py-1 rounded bg-settings-sidebar-badge inline-block",children:rs().APP_VERSION})]}),s.jsxs("div",{className:"col-span-1 space-y-1",children:[s.jsx("p",{className:"text-type-dimmed font-medium",children:e("settings.sidebar.info.backendVersion")}),s.jsxs("p",{className:"text-type-dimmed px-2 py-1 rounded bg-settings-sidebar-badge inline-flex items-center gap-1",children:[f.error?s.jsx(Fe,{icon:ce.WARNING,className:"text-type-danger text-base"}):null,f.loading?s.jsx("span",{className:"block h-4 w-12 bg-type-dimmed/20 rounded"}):((g=f==null?void 0:f.value)==null?void 0:g.version)||e("settings.sidebar.info.unknownVersion")]})]})]})})]})})}function ni(){const{t:e}=ae(),t=ss();return s.jsx("div",{children:s.jsxs(Vt,{paddingClass:"px-6 py-12",className:"grid grid-cols-2 gap-12 mt-5",children:[s.jsxs("div",{children:[s.jsx($t,{children:e("settings.account.admin.title")}),s.jsx("p",{className:"text-type-text",children:e("settings.account.admin.text")})]}),s.jsx("div",{className:"flex justify-end items-center",children:s.jsx(De,{theme:"purple",onClick:()=>t("/admin"),children:e("settings.account.admin.button")})})]})})}function si(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(i=>i(r))},t)}const Dn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function It(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function as(e){return"nodeType"in e}function Me(e){var t,n;return e?It(e)?e:as(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function is(e){const{Document:t}=Me(e);return e instanceof t}function nn(e){return It(e)?!1:e instanceof Me(e).HTMLElement}function Zs(e){return e instanceof Me(e).SVGElement}function Lt(e){return e?It(e)?e.document:as(e)?is(e)?e:nn(e)||Zs(e)?e.ownerDocument:document:document:document}const lt=Dn?u.useLayoutEffect:u.useEffect;function os(e){const t=u.useRef(e);return lt(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Yt(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return lt(()=>{n.current!==e&&(n.current=e)},t),n}function sn(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function jn(e){const t=os(e),n=u.useRef(null),r=u.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function Jn(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let Vn={};function rn(e,t){return u.useMemo(()=>{if(t)return t;const n=Vn[e]==null?0:Vn[e]+1;return Vn[e]=n,e+"-"+n},[e,t])}function er(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const l=Object.entries(c);for(const[f,b]of l){const g=o[f];g!=null&&(o[f]=g+e*b)}return o},{...t})}}const kt=er(1),qt=er(-1);function ai(e){return"clientX"in e&&"clientY"in e}function ls(e){if(!e)return!1;const{KeyboardEvent:t}=Me(e.target);return t&&e instanceof t}function ii(e){if(!e)return!1;const{TouchEvent:t}=Me(e.target);return t&&e instanceof t}function Qn(e){if(ii(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ai(e)?{x:e.clientX,y:e.clientY}:null}const Jt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Jt.Translate.toString(e),Jt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),As="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function oi(e){return e.matches(As)?e:e.querySelector(As)}const li={display:"none"};function ci(e){let{id:t,value:n}=e;return Le.createElement("div",{id:t,style:li},n)}function di(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Le.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function ui(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const tr=u.createContext(null);function fi(e){const t=u.useContext(tr);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function gi(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:i,event:o}=r;e.forEach(c=>{var l;return(l=c[i])==null?void 0:l.call(c,o)})},[e]),t]}const hi={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},mi={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function bi(e){let{announcements:t=mi,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=hi}=e;const{announce:o,announcement:c}=ui(),l=rn("DndLiveRegion"),[f,b]=u.useState(!1);if(u.useEffect(()=>{b(!0)},[]),fi(u.useMemo(()=>({onDragStart(h){let{active:v}=h;o(t.onDragStart({active:v}))},onDragMove(h){let{active:v,over:y}=h;t.onDragMove&&o(t.onDragMove({active:v,over:y}))},onDragOver(h){let{active:v,over:y}=h;o(t.onDragOver({active:v,over:y}))},onDragEnd(h){let{active:v,over:y}=h;o(t.onDragEnd({active:v,over:y}))},onDragCancel(h){let{active:v,over:y}=h;o(t.onDragCancel({active:v,over:y}))}}),[o,t])),!f)return null;const g=Le.createElement(Le.Fragment,null,Le.createElement(ci,{id:r,value:i.draggable}),Le.createElement(di,{id:l,announcement:c}));return n?zt.createPortal(g,n):g}var oe;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(oe||(oe={}));function Cn(){}function $n(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function pi(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const nt=Object.freeze({x:0,y:0});function nr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xi(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ks(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function rr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Rs(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const vi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=Rs(t,t.left,t.top),o=[];for(const c of r){const{id:l}=c,f=n.get(l);if(f){const b=nr(Rs(f),i);o.push({id:l,data:{droppableContainer:c,value:b}})}}return o.sort(sr)},yi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=ks(t),o=[];for(const c of r){const{id:l}=c,f=n.get(l);if(f){const b=ks(f),g=i.reduce((v,y,N)=>v+nr(b[N],y),0),h=Number((g/4).toFixed(4));o.push({id:l,data:{droppableContainer:c,value:h}})}}return o.sort(sr)};function wi(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),c=i-r,l=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:c}=o,l=n.get(c);if(l){const f=wi(l,t);f>0&&i.push({id:c,data:{droppableContainer:o,value:f}})}}return i.sort(xi)};function Ci(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ar(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:nt}function Si(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Ni=Si(1);function Di(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Ei(e,t,n){const r=Di(t);if(!r)return e;const{scaleX:i,scaleY:o,x:c,y:l}=r,f=e.left-c-(1-i)*parseFloat(n),b=e.top-l-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),g=i?e.width/i:e.width,h=o?e.height/o:e.height;return{width:g,height:h,top:b,right:f+g,bottom:b+h,left:f}}const Ti={ignoreTransform:!1};function Mt(e,t){t===void 0&&(t=Ti);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:b,transformOrigin:g}=Me(e).getComputedStyle(e);b&&(n=Ei(n,b,g))}const{top:r,left:i,width:o,height:c,bottom:l,right:f}=n;return{top:r,left:i,width:o,height:c,bottom:l,right:f}}function Is(e){return Mt(e,{ignoreTransform:!0})}function Ai(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ki(e,t){return t===void 0&&(t=Me(e).getComputedStyle(e)),t.position==="fixed"}function Ri(e,t){t===void 0&&(t=Me(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function En(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(is(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!nn(i)||Zs(i)||n.includes(i))return n;const o=Me(e).getComputedStyle(i);return i!==e&&Ri(i,o)&&n.push(i),ki(i,o)?n:r(i.parentNode)}return e?r(e):n}function ir(e){const[t]=En(e,1);return t??null}function Hn(e){return!Dn||!e?null:It(e)?e:as(e)?is(e)||e===Lt(e).scrollingElement?window:nn(e)?e:null:null}function or(e){return It(e)?e.scrollX:e.scrollLeft}function lr(e){return It(e)?e.scrollY:e.scrollTop}function Zn(e){return{x:or(e),y:lr(e)}}var me;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(me||(me={}));function cr(e){return!Dn||!e?!1:e===document.scrollingElement}function dr(e){const t={x:0,y:0},n=cr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const Ii={x:.2,y:.2};function Li(e,t,n,r,i){let{top:o,left:c,right:l,bottom:f}=n;r===void 0&&(r=10),i===void 0&&(i=Ii);const{isTop:b,isBottom:g,isLeft:h,isRight:v}=dr(e),y={x:0,y:0},N={x:0,y:0},j={height:t.height*i.y,width:t.width*i.x};return!b&&o<=t.top+j.height?(y.y=me.Backward,N.y=r*Math.abs((t.top+j.height-o)/j.height)):!g&&f>=t.bottom-j.height&&(y.y=me.Forward,N.y=r*Math.abs((t.bottom-j.height-f)/j.height)),!v&&l>=t.right-j.width?(y.x=me.Forward,N.x=r*Math.abs((t.right-j.width-l)/j.width)):!h&&c<=t.left+j.width&&(y.x=me.Backward,N.x=r*Math.abs((t.left+j.width-c)/j.width)),{direction:y,speed:N}}function Mi(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:c}=window;return{top:0,left:0,right:o,bottom:c,width:o,height:c}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function ur(e){return e.reduce((t,n)=>kt(t,Zn(n)),nt)}function Pi(e){return e.reduce((t,n)=>t+or(n),0)}function Oi(e){return e.reduce((t,n)=>t+lr(n),0)}function _i(e,t){if(t===void 0&&(t=Mt),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);ir(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Bi=[["x",["left","right"],Pi],["y",["top","bottom"],Oi]];class cs{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=En(n),i=ur(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,c,l]of Bi)for(const f of c)Object.defineProperty(this,f,{get:()=>{const b=l(r),g=i[o]-b;return this.rect[f]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ht{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Fi(e){const{EventTarget:t}=Me(e);return e instanceof t?e:Lt(e)}function Xn(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var We;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(We||(We={}));function Ls(e){e.preventDefault()}function Ki(e){e.stopPropagation()}var O;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(O||(O={}));const fr={start:[O.Space,O.Enter],cancel:[O.Esc],end:[O.Space,O.Enter,O.Tab]},Ui=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case O.Right:return{...n,x:n.x+25};case O.Left:return{...n,x:n.x-25};case O.Down:return{...n,y:n.y+25};case O.Up:return{...n,y:n.y-25}}};class ds{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ht(Lt(n)),this.windowListeners=new Ht(Me(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(We.Resize,this.handleCancel),this.windowListeners.add(We.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(We.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&_i(r),n(nt)}handleKeyDown(t){if(ls(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=fr,coordinateGetter:c=Ui,scrollBehavior:l="smooth"}=i,{code:f}=t;if(o.end.includes(f)){this.handleEnd(t);return}if(o.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:b}=r.current,g=b?{x:b.left,y:b.top}:nt;this.referenceCoordinates||(this.referenceCoordinates=g);const h=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const v=qt(h,g),y={x:0,y:0},{scrollableAncestors:N}=r.current;for(const j of N){const w=t.code,{isTop:E,isRight:S,isLeft:D,isBottom:T,maxScroll:L,minScroll:R}=dr(j),A=Mi(j),I={x:Math.min(w===O.Right?A.right-A.width/2:A.right,Math.max(w===O.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(w===O.Down?A.bottom-A.height/2:A.bottom,Math.max(w===O.Down?A.top:A.top+A.height/2,h.y))},U=w===O.Right&&!S||w===O.Left&&!D,z=w===O.Down&&!T||w===O.Up&&!E;if(U&&I.x!==h.x){const B=j.scrollLeft+v.x,Y=w===O.Right&&B<=L.x||w===O.Left&&B>=R.x;if(Y&&!v.y){j.scrollTo({left:B,behavior:l});return}Y?y.x=j.scrollLeft-B:y.x=w===O.Right?j.scrollLeft-L.x:j.scrollLeft-R.x,y.x&&j.scrollBy({left:-y.x,behavior:l});break}else if(z&&I.y!==h.y){const B=j.scrollTop+v.y,Y=w===O.Down&&B<=L.y||w===O.Up&&B>=R.y;if(Y&&!v.x){j.scrollTo({top:B,behavior:l});return}Y?y.y=j.scrollTop-B:y.y=w===O.Down?j.scrollTop-L.y:j.scrollTop-R.y,y.y&&j.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,kt(qt(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ds.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=fr,onActivation:i}=t,{active:o}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=o.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Ms(e){return!!(e&&"distance"in e)}function Ps(e){return!!(e&&"delay"in e)}class us{constructor(t,n,r){var i;r===void 0&&(r=Fi(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:c}=o;this.props=t,this.events=n,this.document=Lt(c),this.documentListeners=new Ht(this.document),this.listeners=new Ht(r),this.windowListeners=new Ht(Me(c)),this.initialCoordinates=(i=Qn(o))!=null?i:nt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(We.Resize,this.handleCancel),this.windowListeners.add(We.DragStart,Ls),this.windowListeners.add(We.VisibilityChange,this.handleCancel),this.windowListeners.add(We.ContextMenu,Ls),this.documentListeners.add(We.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ps(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ms(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(We.Click,Ki,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(We.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:c,options:{activationConstraint:l}}=o;if(!i)return;const f=(n=Qn(t))!=null?n:nt,b=qt(i,f);if(!r&&l){if(Ms(l)){if(l.tolerance!=null&&Xn(b,l.tolerance))return this.handleCancel();if(Xn(b,l.distance))return this.handleStart()}if(Ps(l)&&Xn(b,l.tolerance))return this.handleCancel();this.handlePending(l,b);return}t.cancelable&&t.preventDefault(),c(f)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===O.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const zi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class gr extends us{constructor(t){const{event:n}=t,r=Lt(n.target);super(t,zi,r)}}gr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Vi={move:{name:"mousemove"},end:{name:"mouseup"}};var es;(function(e){e[e.RightClick=2]="RightClick"})(es||(es={}));class hr extends us{constructor(t){super(t,Vi,Lt(t.event.target))}}hr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===es.RightClick?!1:(r==null||r({event:n}),!0)}}];const Wn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class mr extends us{constructor(t){super(t,Wn)}static setup(){return window.addEventListener(Wn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Wn.move.name,t)};function t(){}}}mr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Xt;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xt||(Xt={}));var Sn;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Sn||(Sn={}));function $i(e){let{acceleration:t,activator:n=Xt.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:c=5,order:l=Sn.TreeOrder,pointerCoordinates:f,scrollableAncestors:b,scrollableAncestorRects:g,delta:h,threshold:v}=e;const y=Xi({delta:h,disabled:!o}),[N,j]=ri(),w=u.useRef({x:0,y:0}),E=u.useRef({x:0,y:0}),S=u.useMemo(()=>{switch(n){case Xt.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Xt.DraggableRect:return i}},[n,i,f]),D=u.useRef(null),T=u.useCallback(()=>{const R=D.current;if(!R)return;const A=w.current.x*E.current.x,I=w.current.y*E.current.y;R.scrollBy(A,I)},[]),L=u.useMemo(()=>l===Sn.TreeOrder?[...b].reverse():b,[l,b]);u.useEffect(()=>{if(!o||!b.length||!S){j();return}for(const R of L){if((r==null?void 0:r(R))===!1)continue;const A=b.indexOf(R),I=g[A];if(!I)continue;const{direction:U,speed:z}=Li(R,I,S,t,v);for(const B of["x","y"])y[B][U[B]]||(z[B]=0,U[B]=0);if(z.x>0||z.y>0){j(),D.current=R,N(T,c),w.current=z,E.current=U;return}}w.current={x:0,y:0},E.current={x:0,y:0},j()},[t,T,r,j,o,c,JSON.stringify(S),JSON.stringify(y),N,b,L,g,JSON.stringify(v)])}const Hi={x:{[me.Backward]:!1,[me.Forward]:!1},y:{[me.Backward]:!1,[me.Forward]:!1}};function Xi(e){let{delta:t,disabled:n}=e;const r=Jn(t);return sn(i=>{if(n||!r||!i)return Hi;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[me.Backward]:i.x[me.Backward]||o.x===-1,[me.Forward]:i.x[me.Forward]||o.x===1},y:{[me.Backward]:i.y[me.Backward]||o.y===-1,[me.Forward]:i.y[me.Forward]||o.y===1}}},[n,t,r])}function Wi(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return sn(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Gi(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...o]},[]),[e,t])}var Qt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qt||(Qt={}));var ts;(function(e){e.Optimized="optimized"})(ts||(ts={}));const Os=new Map;function Yi(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,c]=u.useState(null),{frequency:l,measure:f,strategy:b}=i,g=u.useRef(e),h=w(),v=Yt(h),y=u.useCallback(function(E){E===void 0&&(E=[]),!v.current&&c(S=>S===null?E:S.concat(E.filter(D=>!S.includes(D))))},[v]),N=u.useRef(null),j=sn(E=>{if(h&&!n)return Os;if(!E||E===Os||g.current!==e||o!=null){const S=new Map;for(let D of e){if(!D)continue;if(o&&o.length>0&&!o.includes(D.id)&&D.rect.current){S.set(D.id,D.rect.current);continue}const T=D.node.current,L=T?new cs(f(T),T):null;D.rect.current=L,L&&S.set(D.id,L)}return S}return E},[e,o,n,h,f]);return u.useEffect(()=>{g.current=e},[e]),u.useEffect(()=>{h||y()},[n,h]),u.useEffect(()=>{o&&o.length>0&&c(null)},[JSON.stringify(o)]),u.useEffect(()=>{h||typeof l!="number"||N.current!==null||(N.current=setTimeout(()=>{y(),N.current=null},l))},[l,h,y,...r]),{droppableRects:j,measureDroppableContainers:y,measuringScheduled:o!=null};function w(){switch(b){case Qt.Always:return!1;case Qt.BeforeDragging:return n;default:return!n}}}function br(e,t){return sn(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qi(e,t){return br(e,t)}function Ji(e){let{callback:t,disabled:n}=e;const r=os(t),i=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return u.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Tn(e){let{callback:t,disabled:n}=e;const r=os(t),i=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return u.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Qi(e){return new cs(Mt(e),e)}function _s(e,t,n){t===void 0&&(t=Qi);const[r,i]=u.useState(null);function o(){i(f=>{if(!e)return null;if(e.isConnected===!1){var b;return(b=f??n)!=null?b:null}const g=t(e);return JSON.stringify(f)===JSON.stringify(g)?f:g})}const c=Ji({callback(f){if(e)for(const b of f){const{type:g,target:h}=b;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){o();break}}}}),l=Tn({callback:o});return lt(()=>{o(),e?(l==null||l.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),c==null||c.disconnect())},[e]),r}function Zi(e){const t=br(e);return ar(e,t)}const Bs=[];function eo(e){const t=u.useRef(e),n=sn(r=>e?r&&r!==Bs&&e&&t.current&&e.parentNode===t.current.parentNode?r:En(e):Bs,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function to(e){const[t,n]=u.useState(null),r=u.useRef(e),i=u.useCallback(o=>{const c=Hn(o.target);c&&n(l=>l?(l.set(c,Zn(c)),new Map(l)):null)},[]);return u.useEffect(()=>{const o=r.current;if(e!==o){c(o);const l=e.map(f=>{const b=Hn(f);return b?(b.addEventListener("scroll",i,{passive:!0}),[b,Zn(b)]):null}).filter(f=>f!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(o)};function c(l){l.forEach(f=>{const b=Hn(f);b==null||b.removeEventListener("scroll",i)})}},[i,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,c)=>kt(o,c),nt):ur(e):nt,[e,t])}function Fs(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==nt;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?qt(e,n.current):nt}function no(e){u.useEffect(()=>{if(!Dn)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function so(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=c=>{o(c,t)},n},{}),[e,t])}function pr(e){return u.useMemo(()=>e?Ai(e):null,[e])}const Ks=[];function ro(e,t){t===void 0&&(t=Mt);const[n]=e,r=pr(n?Me(n):null),[i,o]=u.useState(Ks);function c(){o(()=>e.length?e.map(f=>cr(f)?r:new cs(t(f),f)):Ks)}const l=Tn({callback:c});return lt(()=>{l==null||l.disconnect(),c(),e.forEach(f=>l==null?void 0:l.observe(f))},[e]),i}function ao(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nn(t)?t:e}function io(e){let{measure:t}=e;const[n,r]=u.useState(null),i=u.useCallback(b=>{for(const{target:g}of b)if(nn(g)){r(h=>{const v=t(g);return h?{...h,width:v.width,height:v.height}:v});break}},[t]),o=Tn({callback:i}),c=u.useCallback(b=>{const g=ao(b);o==null||o.disconnect(),g&&(o==null||o.observe(g)),r(g?t(g):null)},[t,o]),[l,f]=jn(c);return u.useMemo(()=>({nodeRef:l,rect:n,setRef:f}),[n,l,f])}const oo=[{sensor:gr,options:{}},{sensor:ds,options:{}}],lo={current:{}},vn={draggable:{measure:Is},droppable:{measure:Is,strategy:Qt.WhileDragging,frequency:ts.Optimized},dragOverlay:{measure:Mt}};class Wt extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const co={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Wt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Cn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vn,measureDroppableContainers:Cn,windowRect:null,measuringScheduled:!1},uo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Cn,draggableNodes:new Map,over:null,measureDroppableContainers:Cn},An=u.createContext(uo),xr=u.createContext(co);function fo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Wt}}}function go(e,t){switch(t.type){case oe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case oe.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case oe.DragEnd:case oe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case oe.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Wt(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case oe.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const c=new Wt(e.droppable.containers);return c.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:c}}}case oe.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Wt(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ho(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=u.useContext(An),o=Jn(r),c=Jn(n==null?void 0:n.id);return u.useEffect(()=>{if(!t&&!r&&o&&c!=null){if(!ls(o)||document.activeElement===o.target)return;const l=i.get(c);if(!l)return;const{activatorNode:f,node:b}=l;if(!f.current&&!b.current)return;requestAnimationFrame(()=>{for(const g of[f.current,b.current]){if(!g)continue;const h=oi(g);if(h){h.focus();break}}})}},[r,t,i,c,o]),null}function mo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function bo(e){return u.useMemo(()=>({draggable:{...vn.draggable,...e==null?void 0:e.draggable},droppable:{...vn.droppable,...e==null?void 0:e.droppable},dragOverlay:{...vn.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function po(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=u.useRef(!1),{x:c,y:l}=typeof i=="boolean"?{x:i,y:i}:i;lt(()=>{if(!c&&!l||!t){o.current=!1;return}if(o.current||!r)return;const b=t==null?void 0:t.node.current;if(!b||b.isConnected===!1)return;const g=n(b),h=ar(g,r);if(c||(h.x=0),l||(h.y=0),o.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const v=ir(b);v&&v.scrollBy({top:h.y,left:h.x})}},[t,c,l,r,n])}const vr=u.createContext({...nt,scaleX:1,scaleY:1});var bt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(bt||(bt={}));const xo=u.memo(function(t){var n,r,i,o;let{id:c,accessibility:l,autoScroll:f=!0,children:b,sensors:g=oo,collisionDetection:h=ji,measuring:v,modifiers:y,...N}=t;const j=u.useReducer(go,void 0,fo),[w,E]=j,[S,D]=gi(),[T,L]=u.useState(bt.Uninitialized),R=T===bt.Initialized,{draggable:{active:A,nodes:I,translate:U},droppable:{containers:z}}=w,B=A!=null?I.get(A):null,Y=u.useRef({initial:null,translated:null}),de=u.useMemo(()=>{var ne;return A!=null?{id:A,data:(ne=B==null?void 0:B.data)!=null?ne:lo,rect:Y}:null},[A,B]),pe=u.useRef(null),[Ge,Ye]=u.useState(null),[ee,qe]=u.useState(null),je=Yt(N,Object.values(N)),Ke=rn("DndDescribedBy",c),Je=u.useMemo(()=>z.getEnabled(),[z]),q=bo(v),{droppableRects:Ce,measureDroppableContainers:Ee,measuringScheduled:M}=Yi(Je,{dragging:R,dependencies:[U.x,U.y],config:q.droppable}),J=Wi(I,A),$=u.useMemo(()=>ee?Qn(ee):null,[ee]),H=Bt(),xe=qi(J,q.draggable.measure);po({activeNode:A!=null?I.get(A):null,config:H.layoutShiftCompensation,initialRect:xe,measure:q.draggable.measure});const P=_s(J,q.draggable.measure,xe),te=_s(J?J.parentElement:null),ie=u.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Ce,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=z.getNodeFor((n=ie.current.over)==null?void 0:n.id),m=io({measure:q.dragOverlay.measure}),Pe=(r=m.nodeRef.current)!=null?r:J,Ue=R?(i=m.rect)!=null?i:P:null,gt=!!(m.nodeRef.current&&m.rect),p=Zi(gt?null:P),F=pr(Pe?Me(Pe):null),K=eo(R?Te??J:null),st=ro(K),rt=mo(y,{transform:{x:U.x-p.x,y:U.y-p.y,scaleX:1,scaleY:1},activatorEvent:ee,active:de,activeNodeRect:P,containerNodeRect:te,draggingNodeRect:Ue,over:ie.current.over,overlayNodeRect:m.rect,scrollableAncestors:K,scrollableAncestorRects:st,windowRect:F}),Se=$?kt($,U):null,Ct=to(K),Pt=Fs(Ct),Ot=Fs(Ct,[P]),Ae=kt(rt,Pt),ze=Ue?Ni(Ue,rt):null,at=de&&ze?h({active:de,collisionRect:ze,droppableRects:Ce,droppableContainers:Je,pointerCoordinates:Se}):null,Ne=rr(at,"id"),[ke,pt]=u.useState(null),_t=gt?rt:kt(rt,Ot),St=Ci(_t,(o=ke==null?void 0:ke.rect)!=null?o:null,P),Qe=u.useRef(null),xt=u.useCallback((ne,se)=>{let{sensor:Q,options:Re}=se;if(pe.current==null)return;const ue=I.get(pe.current);if(!ue)return;const re=ne.nativeEvent,fe=new Q({active:pe.current,activeNode:ue,event:re,options:Re,context:ie,onAbort(Z){if(!I.get(Z))return;const{onDragAbort:Ie}=je.current,_e={id:Z};Ie==null||Ie(_e),S({type:"onDragAbort",event:_e})},onPending(Z,Oe,Ie,_e){if(!I.get(Z))return;const{onDragPending:$e}=je.current,ge={id:Z,constraint:Oe,initialCoordinates:Ie,offset:_e};$e==null||$e(ge),S({type:"onDragPending",event:ge})},onStart(Z){const Oe=pe.current;if(Oe==null)return;const Ie=I.get(Oe);if(!Ie)return;const{onDragStart:_e}=je.current,ot={activatorEvent:re,active:{id:Oe,data:Ie.data,rect:Y}};zt.unstable_batchedUpdates(()=>{_e==null||_e(ot),L(bt.Initializing),E({type:oe.DragStart,initialCoordinates:Z,active:Oe}),S({type:"onDragStart",event:ot}),Ye(Qe.current),qe(re)})},onMove(Z){E({type:oe.DragMove,coordinates:Z})},onEnd:it(oe.DragEnd),onCancel:it(oe.DragCancel)});Qe.current=fe;function it(Z){return async function(){const{active:Ie,collisions:_e,over:ot,scrollAdjustedTranslate:$e}=ie.current;let ge=null;if(Ie&&$e){const{cancelDrop:ct}=je.current;ge={activatorEvent:re,active:Ie,collisions:_e,delta:$e,over:ot},Z===oe.DragEnd&&typeof ct=="function"&&await Promise.resolve(ct(ge))&&(Z=oe.DragCancel)}pe.current=null,zt.unstable_batchedUpdates(()=>{E({type:Z}),L(bt.Uninitialized),pt(null),Ye(null),qe(null),Qe.current=null;const ct=Z===oe.DragEnd?"onDragEnd":"onDragCancel";if(ge){const vt=je.current[ct];vt==null||vt(ge),S({type:ct,event:ge})}})}}},[I]),Nt=u.useCallback((ne,se)=>(Q,Re)=>{const ue=Q.nativeEvent,re=I.get(Re);if(pe.current!==null||!re||ue.dndKit||ue.defaultPrevented)return;const fe={active:re};ne(Q,se.options,fe)===!0&&(ue.dndKit={capturedBy:se.sensor},pe.current=Re,xt(Q,se))},[I,xt]),Dt=Gi(g,Nt);no(g),lt(()=>{P&&T===bt.Initializing&&L(bt.Initialized)},[P,T]),u.useEffect(()=>{const{onDragMove:ne}=je.current,{active:se,activatorEvent:Q,collisions:Re,over:ue}=ie.current;if(!se||!Q)return;const re={active:se,activatorEvent:Q,collisions:Re,delta:{x:Ae.x,y:Ae.y},over:ue};zt.unstable_batchedUpdates(()=>{ne==null||ne(re),S({type:"onDragMove",event:re})})},[Ae.x,Ae.y]),u.useEffect(()=>{const{active:ne,activatorEvent:se,collisions:Q,droppableContainers:Re,scrollAdjustedTranslate:ue}=ie.current;if(!ne||pe.current==null||!se||!ue)return;const{onDragOver:re}=je.current,fe=Re.get(Ne),it=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,Z={active:ne,activatorEvent:se,collisions:Q,delta:{x:ue.x,y:ue.y},over:it};zt.unstable_batchedUpdates(()=>{pt(it),re==null||re(Z),S({type:"onDragOver",event:Z})})},[Ne]),lt(()=>{ie.current={activatorEvent:ee,active:de,activeNode:J,collisionRect:ze,collisions:at,droppableRects:Ce,draggableNodes:I,draggingNode:Pe,draggingNodeRect:Ue,droppableContainers:z,over:ke,scrollableAncestors:K,scrollAdjustedTranslate:Ae},Y.current={initial:Ue,translated:ze}},[de,J,at,ze,I,Pe,Ue,Ce,z,ke,K,Ae]),$i({...H,delta:U,draggingRect:ze,pointerCoordinates:Se,scrollableAncestors:K,scrollableAncestorRects:st});const Ve=u.useMemo(()=>({active:de,activeNode:J,activeNodeRect:P,activatorEvent:ee,collisions:at,containerNodeRect:te,dragOverlay:m,draggableNodes:I,droppableContainers:z,droppableRects:Ce,over:ke,measureDroppableContainers:Ee,scrollableAncestors:K,scrollableAncestorRects:st,measuringConfiguration:q,measuringScheduled:M,windowRect:F}),[de,J,P,ee,at,te,m,I,z,Ce,ke,Ee,K,st,q,M,F]),Et=u.useMemo(()=>({activatorEvent:ee,activators:Dt,active:de,activeNodeRect:P,ariaDescribedById:{draggable:Ke},dispatch:E,draggableNodes:I,over:ke,measureDroppableContainers:Ee}),[ee,Dt,de,P,E,Ke,I,ke,Ee]);return Le.createElement(tr.Provider,{value:D},Le.createElement(An.Provider,{value:Et},Le.createElement(xr.Provider,{value:Ve},Le.createElement(vr.Provider,{value:St},b)),Le.createElement(ho,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Le.createElement(bi,{...l,hiddenTextDescribedById:Ke}));function Bt(){const ne=(Ge==null?void 0:Ge.autoScrollEnabled)===!1,se=typeof f=="object"?f.enabled===!1:f===!1,Q=R&&!ne&&!se;return typeof f=="object"?{...f,enabled:Q}:{enabled:Q}}}),vo=u.createContext(null),Us="button",yo="Draggable";function wo(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=rn(yo),{activators:c,activatorEvent:l,active:f,activeNodeRect:b,ariaDescribedById:g,draggableNodes:h,over:v}=u.useContext(An),{role:y=Us,roleDescription:N="draggable",tabIndex:j=0}=i??{},w=(f==null?void 0:f.id)===t,E=u.useContext(w?vr:vo),[S,D]=jn(),[T,L]=jn(),R=so(c,t),A=Yt(n);lt(()=>(h.set(t,{id:t,key:o,node:S,activatorNode:T,data:A}),()=>{const U=h.get(t);U&&U.key===o&&h.delete(t)}),[h,t]);const I=u.useMemo(()=>({role:y,tabIndex:j,"aria-disabled":r,"aria-pressed":w&&y===Us?!0:void 0,"aria-roledescription":N,"aria-describedby":g.draggable}),[r,y,j,w,N,g.draggable]);return{active:f,activatorEvent:l,activeNodeRect:b,attributes:I,isDragging:w,listeners:r?void 0:R,node:S,over:v,setNodeRef:D,setActivatorNodeRef:L,transform:E}}function jo(){return u.useContext(xr)}const Co="Droppable",So={timeout:25};function No(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=rn(Co),{active:c,dispatch:l,over:f,measureDroppableContainers:b}=u.useContext(An),g=u.useRef({disabled:n}),h=u.useRef(!1),v=u.useRef(null),y=u.useRef(null),{disabled:N,updateMeasurementsFor:j,timeout:w}={...So,...i},E=Yt(j??r),S=u.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{b(Array.isArray(E.current)?E.current:[E.current]),y.current=null},w)},[w]),D=Tn({callback:S,disabled:N||!c}),T=u.useCallback((I,U)=>{D&&(U&&(D.unobserve(U),h.current=!1),I&&D.observe(I))},[D]),[L,R]=jn(T),A=Yt(t);return u.useEffect(()=>{!D||!L.current||(D.disconnect(),h.current=!1,D.observe(L.current))},[L,D]),u.useEffect(()=>(l({type:oe.RegisterDroppable,element:{id:r,key:o,disabled:n,node:L,rect:v,data:A}}),()=>l({type:oe.UnregisterDroppable,key:o,id:r})),[r]),u.useEffect(()=>{n!==g.current.disabled&&(l({type:oe.SetDroppableDisabled,id:r,key:o,disabled:n}),g.current.disabled=n)},[r,o,n,l]),{active:c,rect:v,isOver:(f==null?void 0:f.id)===r,node:L,over:f,setNodeRef:R}}function Do(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const Eo=e=>{let{containerNodeRect:t,draggingNodeRect:n,transform:r}=e;return!n||!t?r:Do(r,n,t)},To=e=>{let{transform:t}=e;return{...t,x:0}};function fs(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ao(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function pn(e){return e!==null&&e>=0}function ko(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=fs(t,r,n),c=t[i],l=o[i];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},xn={scaleX:1,scaleY:1},Io=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:c}=e;const l=(t=o[n])!=null?t:r;if(!l)return null;if(i===n){const b=o[c];return b?{x:0,y:nn&&i<=c?{x:0,y:-l.height-f,...xn}:i=c?{x:0,y:l.height+f,...xn}:{x:0,y:0,...xn}};function Lo(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?nr.map(R=>typeof R=="object"&&"id"in R?R.id:R),[r]),N=c!=null,j=c?y.indexOf(c.id):-1,w=b?y.indexOf(b.id):-1,E=u.useRef(y),S=!ko(y,E.current),D=w!==-1&&j===-1||S,T=Ro(o);lt(()=>{S&&N&&g(y)},[S,y,N,g]),u.useEffect(()=>{E.current=y},[y]);const L=u.useMemo(()=>({activeIndex:j,containerId:h,disabled:T,disableTransforms:D,items:y,overIndex:w,useDragOverlay:v,sortedRects:Ao(y,f),strategy:i}),[j,h,T.draggable,T.droppable,D,y,w,f,v,i]);return Le.createElement(jr.Provider,{value:L},t)}const Po=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return fs(n,r,i).indexOf(t)},Oo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:c,previousItems:l,previousContainerId:f,transition:b}=e;return!b||!r||l!==o&&i===c?!1:n?!0:c!==i&&t===f},_o={duration:200,easing:"ease"},Cr="transform",Bo=Jt.Transition.toString({property:Cr,duration:0,easing:"linear"}),Fo={roleDescription:"sortable"};function Ko(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,c]=u.useState(null),l=u.useRef(n);return lt(()=>{if(!t&&n!==l.current&&r.current){const f=i.current;if(f){const b=Mt(r.current,{ignoreTransform:!0}),g={x:f.left-b.left,y:f.top-b.top,scaleX:f.width/b.width,scaleY:f.height/b.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,i]),u.useEffect(()=>{o&&c(null)},[o]),o}function Uo(e){let{animateLayoutChanges:t=Oo,attributes:n,disabled:r,data:i,getNewIndex:o=Po,id:c,strategy:l,resizeObserverConfig:f,transition:b=_o}=e;const{items:g,containerId:h,activeIndex:v,disabled:y,disableTransforms:N,sortedRects:j,overIndex:w,useDragOverlay:E,strategy:S}=u.useContext(jr),D=zo(r,y),T=g.indexOf(c),L=u.useMemo(()=>({sortable:{containerId:h,index:T,items:g},...i}),[h,i,T,g]),R=u.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:I,isOver:U,setNodeRef:z}=No({id:c,data:L,disabled:D.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...f}}),{active:B,activatorEvent:Y,activeNodeRect:de,attributes:pe,setNodeRef:Ge,listeners:Ye,isDragging:ee,over:qe,setActivatorNodeRef:je,transform:Ke}=wo({id:c,data:L,attributes:{...Fo,...n},disabled:D.draggable}),Je=si(z,Ge),q=!!B,Ce=q&&!N&&pn(v)&&pn(w),Ee=!E&&ee,M=Ee&&Ce?Ke:null,$=Ce?M??(l??S)({rects:j,activeNodeRect:de,activeIndex:v,overIndex:w,index:T}):null,H=pn(v)&&pn(w)?o({id:c,items:g,activeIndex:v,overIndex:w}):T,xe=B==null?void 0:B.id,P=u.useRef({activeId:xe,items:g,newIndex:H,containerId:h}),te=g!==P.current.items,ie=t({active:B,containerId:h,isDragging:ee,isSorting:q,id:c,index:T,items:g,newIndex:P.current.newIndex,previousItems:P.current.items,previousContainerId:P.current.containerId,transition:b,wasDragging:P.current.activeId!=null}),Te=Ko({disabled:!ie,index:T,node:I,rect:A});return u.useEffect(()=>{q&&P.current.newIndex!==H&&(P.current.newIndex=H),h!==P.current.containerId&&(P.current.containerId=h),g!==P.current.items&&(P.current.items=g)},[q,H,h,g]),u.useEffect(()=>{if(xe===P.current.activeId)return;if(xe&&!P.current.activeId){P.current.activeId=xe;return}const Pe=setTimeout(()=>{P.current.activeId=xe},50);return()=>clearTimeout(Pe)},[xe]),{active:B,activeIndex:v,attributes:pe,data:L,rect:A,index:T,newIndex:H,items:g,isOver:U,isSorting:q,isDragging:ee,listeners:Ye,node:I,overIndex:w,over:qe,setNodeRef:Je,setActivatorNodeRef:je,setDroppableNodeRef:z,setDraggableNodeRef:Ge,transform:Te??$,transition:m()};function m(){if(Te||te&&P.current.newIndex===T)return Bo;if(!(Ee&&!ls(Y)||!b)&&(q||ie))return Jt.Transition.toString({...b,property:Cr})}}function zo(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function Nn(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Vo=[O.Down,O.Right,O.Up,O.Left],$o=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:c,scrollableAncestors:l}}=t;if(Vo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const f=[];o.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const v=i.get(h.id);if(v)switch(e.code){case O.Down:r.topv.top&&f.push(h);break;case O.Left:r.left>v.left&&f.push(h);break;case O.Right:r.left1&&(g=b[1].id),g!=null){const h=o.get(n.id),v=o.get(g),y=v?i.get(v.id):null,N=v==null?void 0:v.node.current;if(N&&y&&h&&v){const w=En(N).some((R,A)=>l[A]!==R),E=Sr(h,v),S=Ho(h,v),D=w||!E?{x:0,y:0}:{x:S?r.width-y.width:0,y:S?r.height-y.height:0},T={x:y.left,y:y.top};return D.x&&D.y?T:qt(T,D)}}}};function Sr(e,t){return!Nn(e)||!Nn(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ho(e,t){return!Nn(e)||!Nn(t)||!Sr(e,t)?!1:e.data.current.sortable.index{const{active:i,over:o}=r;if(o&&i.id!==o.id){const c=e.items,l=c.findIndex(g=>g.id===i.id),f=c.findIndex(g=>g.id===o.id),b=fs(c,l,f);e.setItems(b)}};return s.jsx(xo,{sensors:t,collisionDetection:vi,onDragEnd:n,modifiers:[To,Eo],children:s.jsx(Mo,{items:e.items,strategy:Io,children:s.jsx("div",{className:"flex flex-col gap-2",children:e.items.map(r=>s.jsx(Xo,{item:r},r.id))})})})}const Go=function(t){const{t:n}=ae(),r=ha(Ss.map(h=>h.code)),i=ma(),o=Ss.sort((h,v)=>r.indexOf(h.code)-r.indexOf(v.code)).map(h=>({id:h.code,name:`${h.name}${h.nativeName?` — ${h.nativeName}`:""}`,leftIcon:s.jsx(ba,{langCode:h.code})})),c=o.find(h=>{var v;return h.id===((v=pa(t.language))==null?void 0:v.code)}),l=Qs().listSources(),f=u.useMemo(()=>{const h=xa().listSources();return t.sourceOrder.map(v=>{var y;return{id:v,name:((y=l.find(N=>N.id===v))==null?void 0:y.name)||v,disabled:!h.find(N=>N.id===v)}})},[t.sourceOrder,l]),b=ss(),g=()=>{const h=!t.enableLowPerformanceMode;t.setEnableLowPerformanceMode(h),h&&(t.setEnableThumbnails(!1),t.setEnableAutoplay(!1))};return s.jsxs("div",{className:"space-y-12",children:[s.jsx(tn,{border:!0,children:n("settings.preferences.title")}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.preferences.language")}),s.jsx("p",{className:"max-w-[20rem] font-medium",children:n("settings.preferences.languageDescription")}),s.jsx(Gs,{className:"w-full",options:o,selectedItem:c||o[0],setSelectedItem:h=>t.setLanguage(h.id)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.preferences.thumbnail")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.preferences.thumbnailDescription")}),s.jsxs("div",{onClick:()=>{t.enableLowPerformanceMode||t.setEnableThumbnails(!t.enableThumbnails)},className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",t.enableLowPerformanceMode?"cursor-not-allowed opacity-50 pointer-events-none":"cursor-pointer opacity-100 pointer-events-auto"),children:[s.jsx(be,{enabled:t.enableThumbnails}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.preferences.thumbnailLabel")})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.preferences.autoplay")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.preferences.autoplayDescription")}),s.jsxs("div",{onClick:()=>i&&!t.enableLowPerformanceMode?t.setEnableAutoplay(!t.enableAutoplay):null,className:le("bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",i&&!t.enableLowPerformanceMode?"cursor-pointer opacity-100 pointer-events-auto":"cursor-not-allowed opacity-50 pointer-events-none"),children:[s.jsx(be,{enabled:t.enableAutoplay&&i}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.preferences.autoplayLabel")})]}),t.enableAutoplay&&i&&!t.enableLowPerformanceMode&&s.jsxs("div",{className:"pt-4 pl-4 border-l-8 border-dropdown-background",children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.preferences.skipCredits")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.preferences.skipCreditsDescription")}),s.jsxs("div",{onClick:()=>t.setEnableSkipCredits(!t.enableSkipCredits),className:"bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",children:[s.jsx(be,{enabled:t.enableSkipCredits}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.preferences.skipCreditsLabel")})]})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-bold mb-3",children:n("settings.preferences.lowPerformanceMode")}),s.jsx("p",{className:"max-w-[25rem] font-medium",children:n("settings.preferences.lowPerformanceModeDescription")}),s.jsxs("div",{onClick:g,className:"bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",children:[s.jsx(be,{enabled:t.enableLowPerformanceMode}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.preferences.lowPerformanceModeLabel")})]})]})]}),s.jsx("div",{id:"source-order",className:"space-y-8",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-white font-bold",children:n("settings.preferences.sourceOrder")}),s.jsxs("div",{className:"max-w-[25rem] font-medium",children:[s.jsx(tt,{i18nKey:"settings.preferences.sourceOrderDescription",components:{bold:s.jsx("span",{className:"text-type-link font-bold cursor-pointer",onClick:()=>b("/onboarding/extension")})}}),s.jsxs("div",{onClick:()=>t.setenableSourceOrder(!t.enableSourceOrder),className:"bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg",children:[s.jsx(be,{enabled:t.enableSourceOrder}),s.jsx("p",{className:"flex-1 text-white font-bold",children:n("settings.preferences.sourceOrderEnableLabel")})]})]}),t.enableSourceOrder&&s.jsxs("div",{className:"w-full flex flex-col gap-4",children:[s.jsx(Wo,{items:f,setItems:h=>t.setSourceOrder(h.map(v=>v.id))}),s.jsx(De,{className:"max-w-[25rem]",theme:"secondary",onClick:()=>t.setSourceOrder(l.map(h=>h.id)),children:n("settings.reset")})]})]})})]})]})},Yo=Go;function qo(e){const{isMobile:t}=Js();return s.jsx(Ea,{ultraWide:!0,classNames:"overflow-visible",children:s.jsxs("div",{className:le("grid gap-12",t?"grid-cols-1":"lg:grid-cols-[280px,1fr]"),children:[s.jsx(ti,{}),s.jsx("div",{children:e.children})]})})}function Jo(e){const t=Zt(),{account:n}=e,[r,i]=ns(()=>t?va(t,n):Promise.resolve([]),[n,t]);return u.useEffect(()=>{i()},[i]),s.jsxs(s.Fragment,{children:[s.jsx(_a,{deviceName:e.deviceName,setDeviceName:e.setDeviceName,colorA:e.colorA,setColorA:e.setColorA,colorB:e.colorB,setColorB:e.setColorB,userIcon:e.userIcon,setUserIcon:e.setUserIcon}),s.jsx(Ma,{error:!!r.error,loading:r.loading,sessions:r.value??[],onChange:i}),s.jsx(Pa,{})]})}function el(){u.useEffect(()=>{const p=window.location.hash;if(p){const F=document.querySelector(p);F&&F.scrollIntoView({behavior:"smooth"})}},[]);const{t:e}=ae(),t=Ns(p=>p.theme),n=Ns(p=>p.setTheme),r=Gn(p=>p.previewTheme),i=Gn(p=>p.setPreviewTheme),o=Ds(p=>p.language),c=Ds(p=>p.setLanguage),l=qn(p=>p.styling),f=qn(p=>p.updateStyling),b=we(p=>p.proxySet),g=we(p=>p.setProxySet),h=we(p=>p.backendUrl),v=we(p=>p.setBackendUrl),y=_(p=>p.febboxKey),N=_(p=>p.setFebboxKey),j=_(p=>p.realDebridKey),w=_(p=>p.setRealDebridKey),E=_(p=>p.enableThumbnails),S=_(p=>p.setEnableThumbnails),D=_(p=>p.enableAutoplay),T=_(p=>p.setEnableAutoplay),L=_(p=>p.enableSkipCredits),R=_(p=>p.setEnableSkipCredits),A=_(p=>p.sourceOrder),I=_(p=>p.setSourceOrder),U=_(p=>p.enableDiscover),z=_(p=>p.setEnableDiscover),B=_(p=>p.enableFeatured),Y=_(p=>p.setEnableFeatured),de=_(p=>p.enableDetailsModal),pe=_(p=>p.setEnableDetailsModal),Ge=_(p=>p.enableImageLogos),Ye=_(p=>p.setEnableImageLogos),ee=_(p=>p.enableSourceOrder),qe=_(p=>p.setEnableSourceOrder),je=_(p=>p.proxyTmdb),Ke=_(p=>p.setProxyTmdb),Je=_(p=>p.enableCarouselView),q=_(p=>p.setEnableCarouselView),Ce=_(p=>p.forceCompactEpisodeView),Ee=_(p=>p.setForceCompactEpisodeView),M=_(p=>p.enableLowPerformanceMode),J=_(p=>p.setEnableLowPerformanceMode),$=we(p=>p.account),H=we(p=>p.setAccountProfile),xe=we(p=>p.updateDeviceName),P=u.useMemo(()=>$?zs($.deviceName,Yn($.seed)):"",[$]),te=Zt(),{logout:ie}=Ws(),Te=we();u.useEffect(()=>{(async()=>{if($&&te){const F=await Da(te,$);F.febboxKey&&N(F.febboxKey),F.realDebridKey&&w(F.realDebridKey)}})()},[$,te,N,w]);const m=ka(t,o,l,P,b,h,y,j,$?$.profile:void 0,E,D,U,B,de,A,ee,je,L,Ge,Je,Ce,M),Pe=u.useMemo(()=>{const p=Qs().listSources(),F=p.map(Se=>Se.id),K=m.sourceOrder.state,st=K.filter(Se=>F.includes(Se)),rt=p.filter(Se=>!K.includes(Se.id)).map(Se=>Se.id);return[...st,...rt]},[m.sourceOrder.state]);u.useEffect(()=>{i(t??"default")},[i,t]),u.useEffect(()=>()=>{i(null)},[i]);const Ue=u.useCallback(p=>{m.theme.set(p==="default"?null:p),i(p)},[m.theme,i]),gt=u.useCallback(async()=>{var p,F;if($&&te){if((m.appLanguage.changed||m.theme.changed||m.proxyUrls.changed||m.febboxKey.changed||m.realDebridKey.changed||m.enableThumbnails.changed||m.enableAutoplay.changed||m.enableSkipCredits.changed||m.enableDiscover.changed||m.enableFeatured.changed||m.enableDetailsModal.changed||m.enableImageLogos.changed||m.sourceOrder.changed||m.enableSourceOrder.changed||m.proxyTmdb.changed||m.enableCarouselView.changed||m.forceCompactEpisodeView.changed||m.enableLowPerformanceMode.changed)&&await ya(te,$,{applicationLanguage:m.appLanguage.state,applicationTheme:m.theme.state,proxyUrls:((p=m.proxyUrls.state)==null?void 0:p.filter(K=>K!==""))??null,febboxKey:m.febboxKey.state,realDebridKey:m.realDebridKey.state,enableThumbnails:m.enableThumbnails.state,enableAutoplay:m.enableAutoplay.state,enableSkipCredits:m.enableSkipCredits.state,enableDiscover:m.enableDiscover.state,enableFeatured:m.enableFeatured.state,enableDetailsModal:m.enableDetailsModal.state,enableImageLogos:m.enableImageLogos.state,sourceOrder:m.sourceOrder.state,enableSourceOrder:m.enableSourceOrder.state,proxyTmdb:m.proxyTmdb.state,enableCarouselView:m.enableCarouselView.state,forceCompactEpisodeView:m.forceCompactEpisodeView.state,enableLowPerformanceMode:m.enableLowPerformanceMode.state}),m.deviceName.changed){const K=await wa(m.deviceName.state,Yn($.seed));await ja(te,$,{deviceName:K}),xe(K)}m.profile.changed&&await Ca(te,$,{profile:m.profile.state})}if(S(m.enableThumbnails.state),T(m.enableAutoplay.state),R(m.enableSkipCredits.state),z(m.enableDiscover.state),Y(m.enableFeatured.state),pe(m.enableDetailsModal.state),Ye(m.enableImageLogos.state),I(m.sourceOrder.state),c(m.appLanguage.state),n(m.theme.state),f(m.subtitleStyling.state),g(((F=m.proxyUrls.state)==null?void 0:F.filter(K=>K!==""))??null),qe(m.enableSourceOrder.state),N(m.febboxKey.state),w(m.realDebridKey.state),Ke(m.proxyTmdb.state),q(m.enableCarouselView.state),Ee(m.forceCompactEpisodeView.state),J(m.enableLowPerformanceMode.state),m.profile.state&&H(m.profile.state),m.backendUrl.changed){await ie();let K=m.backendUrl.state;K&&!K.startsWith("http://")&&!K.startsWith("https://")&&(K=`https://${K}`),v(K)}},[$,te,S,N,w,m,T,R,z,Y,pe,Ye,I,c,n,f,g,xe,H,ie,v,qe,Ke,q,Ee,J]);return s.jsxs(Sa,{children:[s.jsx(Na,{subpage:!0,k:"global.pages.settings"}),s.jsxs(qo,{children:[s.jsxs("div",{id:"settings-account",children:[s.jsx(tn,{border:!0,className:"!mb-0",children:e("settings.account.title")}),Te.account&&m.profile.state?s.jsx(Jo,{account:Te.account,deviceName:m.deviceName.state,setDeviceName:m.deviceName.set,colorA:m.profile.state.colorA,setColorA:p=>{m.profile.set(F=>F?{...F,colorA:p}:void 0)},colorB:m.profile.state.colorB,setColorB:p=>m.profile.set(F=>F?{...F,colorB:p}:void 0),userIcon:m.profile.state.icon,setUserIcon:p=>m.profile.set(F=>F?{...F,icon:p}:void 0)}):s.jsx(Ja,{})]}),s.jsx("div",{className:"mt-10",children:s.jsx(ni,{})}),s.jsx("div",{id:"settings-preferences",className:"mt-28",children:s.jsx(Yo,{language:m.appLanguage.state,setLanguage:m.appLanguage.set,enableThumbnails:m.enableThumbnails.state,setEnableThumbnails:m.enableThumbnails.set,enableAutoplay:m.enableAutoplay.state,setEnableAutoplay:m.enableAutoplay.set,enableSkipCredits:m.enableSkipCredits.state,setEnableSkipCredits:m.enableSkipCredits.set,sourceOrder:Pe,setSourceOrder:m.sourceOrder.set,enableSourceOrder:m.enableSourceOrder.state,setenableSourceOrder:m.enableSourceOrder.set,enableLowPerformanceMode:m.enableLowPerformanceMode.state,setEnableLowPerformanceMode:m.enableLowPerformanceMode.set})}),s.jsx("div",{id:"settings-appearance",className:"mt-28",children:s.jsx(za,{active:r??"default",inUse:t??"default",setTheme:Ue,enableDiscover:m.enableDiscover.state,setEnableDiscover:m.enableDiscover.set,enableFeatured:m.enableFeatured.state,setEnableFeatured:m.enableFeatured.set,enableDetailsModal:m.enableDetailsModal.state,setEnableDetailsModal:m.enableDetailsModal.set,enableImageLogos:m.enableImageLogos.state,setEnableImageLogos:m.enableImageLogos.set,enableCarouselView:m.enableCarouselView.state,setEnableCarouselView:m.enableCarouselView.set,forceCompactEpisodeView:m.forceCompactEpisodeView.state,setForceCompactEpisodeView:m.forceCompactEpisodeView.set,enableLowPerformanceMode:m.enableLowPerformanceMode.state})}),s.jsx("div",{id:"settings-captions",className:"mt-28",children:s.jsx(Va,{styling:m.subtitleStyling.state,setStyling:m.subtitleStyling.set})}),s.jsx("div",{id:"settings-connection",className:"mt-28",children:s.jsx(qa,{backendUrl:m.backendUrl.state,setBackendUrl:m.backendUrl.set,proxyUrls:m.proxyUrls.state,setProxyUrls:m.proxyUrls.set,febboxKey:m.febboxKey.state,setFebboxKey:m.febboxKey.set,realDebridKey:m.realDebridKey.state,setRealDebridKey:m.realDebridKey.set,proxyTmdb:m.proxyTmdb.state,setProxyTmdb:m.proxyTmdb.set})})]}),s.jsxs(Ys,{animation:"fade",show:m.changed,className:"bg-settings-saveBar-background border-t border-settings-card-border/50 py-4 transition-opacity w-full fixed bottom-0 flex justify-between flex-col md:flex-row px-8 items-start md:items-center gap-3 z-[999]",children:[s.jsx("p",{className:"text-type-danger",children:e("settings.unsaved")}),s.jsxs("div",{className:"space-x-3 w-full md:w-auto flex",children:[s.jsx(De,{className:"w-full md:w-auto",theme:"secondary",onClick:m.reset,children:e("settings.reset")}),s.jsx(De,{className:"w-full md:w-auto",theme:"purple",onClick:gt,children:e("settings.save")})]})]})]})}export{Jo as AccountSettings,el as SettingsPage,el as default}; //# sourceMappingURL=Settings-DB-rGASE.js.map