File "admin-routes-9d21ca72.js"

Full Path: /home/filmgtex/hdfilmcehennemi.website/public/build/admin-routes-9d21ca72.js
File size: 412.21 KB
MIME-type: text/plain
Charset: utf-8

import{u as xe,j as e,c as w,C as Ul,T as n,r as m,a as Yn,g as fn,$ as Xs,s as Xn,A as es,U as Bl,m as ls,b as E,N as ql,I as C,O as As,d,R as U,e as Fe,f as Hl,S as os,h,i as A,k as qe,l as Mt,o as Ps,P as It,n as ts,p as T,q as _,t as M,v as q,w as S,D as P,B as b,x as Z,y as ce,z as He,E as va,F as K,G as te,H as X,J as ne,K as J,L as bn,M as Zl,Q as Wl,V as Ql,W as cs,X as Ct,Y as ds,Z as V,_ as ee,a0 as g,a1 as F,a2 as Tt,a3 as Ee,a4 as ca,a5 as ae,a6 as oe,a7 as er,a8 as gs,a9 as le,aa as ya,ab as Ca,ac as ve,ad as I,ae as ie,af as Gl,ag as sr,ah as tr,ai as Kl,aj as us,ak as et,al as wa,am as D,an as ar,ao as Pe,ap as Jl,aq as Yl,ar as Xl,as as Ie,at as fs,au as eo,av as so,aw as Is,ax as ye,ay as ms,az as xs,aA as Sa,aB as B,aC as Q,aD as nr,aE as Ft,aF as Na,aG as Ce,aH as it,aI as Ze,aJ as Et,aK as bs,aL as vs,aM as to,aN as ao,aO as La,aP as rr,aQ as Gs,aR as ir,aS as lr,aT as or,aU as no,aV as ro,aW as io,aX as ka,aY as lo,aZ as oo,a_ as co,a$ as uo,b0 as mo,b1 as xo,b2 as _a,b3 as hs,b4 as ho,b5 as cr,b6 as dr,b7 as go,b8 as ur,b9 as po,ba as Ma,bb as jo,bc as vn,bd as yn,be as we,bf as fo,bg as bo,bh as vo,bi as mr,bj as Ia,bk as yo,bl as Co,bm as wo,bn as Pt,bo as So,bp as No,bq as Lo,br as zt,bs as ko,bt as Cn,bu as re,bv as _o,bw as Mo,bx as Io}from"./main-a8767cd0.js";import{F as O,a as H,d as To,D as Ta,K as Fa,h as Fo,b as Dt,A as xr,u as At,c as Ea,B as Eo,e as Po,f as $t,T as lt,g as Y,i as ue,j as ot,k as zo,l as Do,m as hr,n as Ao,C as $o,o as $,N as ys,p as Ro,q as Vo,r as Cs,s as Ae,S as da,t as Oo,v as $s,w as Uo,x as Rt,y as wn,z as gr,M as pr,E as Bo,G as jr,H as Pa,I as fr,J as za,L as ws,O as Ss,P as Me,Q as Ve,R as br,U as vr,V as Da,W as qo,X as yr,Y as Ho,Z as Zo,_ as st,$ as Vt,a0 as zs,a1 as Cr,a2 as Wo,a3 as Ts,a4 as Qo,a5 as Go,a6 as Ko,a7 as Jo,a8 as Yo,a9 as Xo,aa as Ot,ab as ec,ac as sc,ad as tc,ae as Aa,af as ac,ag as wr,ah as nc,ai as rc,aj as Ks,ak as ic,al as Ds,am as ct,an as Sr,ao as Re,ap as lc,aq as oc,ar as cc,as as Nr,at as dc,au as uc,av as Rs,aw as Ye,ax as mc,ay as xc,az as Lr,aA as $a,aB as kr,aC as hc,aD as gc,aE as Ra,aF as _r,aG as pc,aH as jc,aI as Ut,aJ as Mr,aK as fc,aL as Va,aM as Oa,aN as bc,aO as Ir,aP as vc,aQ as Tr,aR as Fr,aS as Er,aT as yc,aU as Cc,aV as Pr,aW as Ua,aX as zr,aY as wc,aZ as Sc,a_ as Nc,a$ as Lc,b0 as kc,b1 as _c,b2 as Dr,b3 as Mc,b4 as Ic,b5 as Ar,b6 as Tc,b7 as $r,b8 as Fc,b9 as Ec,ba as Pc}from"./user-profile-link-bc31d40d.js";import{E as de,B as Rr,a as wt,C as zc,O as Vr}from"./OpenInNew-a6691840.js";import{u as Or,a as Dc}from"./use-resume-subscription-0d036444.js";function Ac({className:s,isCompactMode:t}){const{version:a}=xe();return e.jsxs("div",{className:w(s,"text-sm pt-26 px-12 pb-16 text-muted font-medium bg-alt flex flex-col gap-20 border-r overflow-y-auto relative"),children:[e.jsx(Ul,{matchDescendants:r=>r==="/admin",menu:"admin-sidebar",orientation:"vertical",onlyShowIcons:t,itemClassName:({isActive:r})=>w("block w-full rounded py-12 px-16 border-l-4",r?"bg-primary/hover border-l-primary":"border-l-transparent hover:bg-hover"),gap:"gap-8"}),!t&&e.jsx("div",{className:"mt-auto gap-14 px-16 text-xs",children:e.jsx(n,{message:"Version: :number",values:{number:a}})})]})}const Ba=m.createContext(null);function $c(s=!1){m.useEffect(()=>(s?document.documentElement.classList.remove("no-page-overflow"):document.documentElement.classList.add("no-page-overflow"),()=>{document.documentElement.classList.remove("no-page-overflow")}),[s])}function Rc({children:s,leftSidenavStatus:t,onLeftSidenavChange:a,rightSidenavStatus:r,initialRightSidenavStatus:i,onRightSidenavChange:l,name:o,leftSidenavCanBeCompact:c,height:u="h-screen",className:x,gridClassName:p="dashboard-grid",blockBodyOverflow:j=!0,...v}){$c(!j);const f=Yn("(max-width: 1024px)"),y=m.useMemo(()=>o?fn(`${o}.sidenav.compact`):!1,[o])?"compact":"open",[L,N]=Xs(t,f?"closed":y,a),z=m.useMemo(()=>{if(f)return"closed";if(i!=null)return i;const je=fn(`${o}.sidenav.right.position`,"open");return je??(i||"closed")},[f,o,i]),[R,G]=Xs(r,z,l),se=m.useCallback(je=>{G(je),Xn(`${o}.sidenav.right.position`,je)},[G,o]),he=f&&(L==="open"||R==="open");return e.jsx(Ba.Provider,{value:{leftSidenavStatus:L,setLeftSidenavStatus:N,rightSidenavStatus:R,setRightSidenavStatus:se,leftSidenavCanBeCompact:c,name:o,isMobileMode:f},children:e.jsxs("div",{...v,className:w("relative isolate",p,x,u),children:[s,e.jsx(es,{children:he&&e.jsx(Bl,{position:"fixed",onClick:()=>{N("closed"),se("closed")}},"dashboard-underlay")})]})})}function Vc({children:s,isScrollable:t=!0}){return m.cloneElement(s,{className:w(s.props.className,t&&"overflow-y-auto stable-scrollbar","dashboard-grid-content")})}function Oc({className:s,position:t,children:a,size:r="md",mode:i,overlayPosition:l="fixed",display:o="flex",overflow:c="overflow-hidden",forceClosed:u=!1}){const{isMobileMode:x,leftSidenavStatus:p,setLeftSidenavStatus:j,rightSidenavStatus:v,setRightSidenavStatus:f}=m.useContext(Ba),k=t==="left"?p:v,y=x||i==="overlay",L={open:{display:o,width:null},compact:{display:o,width:null},closed:{width:0,transitionEnd:{display:"none"}}},N=Uc(k==="compact"?"compact":r);return e.jsx(ls.div,{variants:L,initial:!1,animate:u?"closed":k,transition:{type:"tween",duration:.15},onClick:z=>{const R=z.target;x&&(R.closest("button")||R.closest("a"))&&(j("closed"),f("closed"))},className:w(s,t==="left"?"dashboard-grid-sidenav-left":"dashboard-grid-sidenav-right","will-change-[width]",c,N,y&&`${l} bottom-0 top-0 z-20 shadow-2xl`,y&&t==="left"&&"left-0",y&&t==="right"&&"right-0"),children:m.cloneElement(a,{className:w(a.props.className,"w-full h-full",k==="compact"&&"compact-scrollbar"),isCompactMode:k==="compact"})})}function Uc(s){switch(s){case"compact":return"w-80";case"sm":return"w-224";case"md":return"w-240";case"lg":return"w-288";default:return s||""}}const Bc=E(e.jsx("path",{d:"M3 18h13v-2H3v2zm0-5h10v-2H3v2zm0-7v2h13V6H3zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5L21 15.59z"}),"MenuOpenOutlined");function qc({children:s,className:t,hideToggleButton:a,...r}){const{isMobileMode:i,leftSidenavStatus:l,setLeftSidenavStatus:o,name:c,leftSidenavCanBeCompact:u}=m.useContext(Ba),x=u&&!i,p=!a&&(i||u),j=()=>{o(l==="open"?"closed":"open")},v=()=>{const f=l==="compact"?"open":"compact";Xn(`${c}.sidenav.compact`,f==="compact"),o(f)};return e.jsx(ql,{className:w("dashboard-grid-navbar",t),border:"border-b",size:"sm",color:"primary",darkModeColor:"bg-alt",toggleButton:p?e.jsx(C,{size:"md",onClick:()=>{x?v():j()},children:e.jsx(Bc,{})}):void 0,...r,children:s})}function Hc(){return e.jsxs(Rc,{name:"admin",leftSidenavCanBeCompact:!0,children:[e.jsx(qc,{size:"sm",color:"primary",menuPosition:"admin-navbar"}),e.jsx(Oc,{position:"left",size:"sm",children:e.jsx(Ac,{})}),e.jsx(Vc,{children:e.jsx("div",{className:"bg dark:bg-alt",children:e.jsx(As,{})})})]})}function tt(s){var t;return{...s,defaultOperator:O.between,control:{type:H.DateRangePicker,defaultValue:((t=s.control)==null?void 0:t.defaultValue)||To(Ta[3].getRangeValue())}}}function Se(s){return tt({key:"created_at",label:d("Date created"),...s})}function Ne(s){return tt({key:"updated_at",label:d("Last updated"),...s})}const Zc=[{key:"email_verified_at",label:d("Email"),description:d("Email verification status"),defaultOperator:O.ne,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("is confirmed"),value:{value:null,operator:O.ne}},{key:"02",label:d("is not confirmed"),value:{value:null,operator:O.eq}}]}},Se({description:d("Date user registered or was created")}),Ne({description:d("Date user was last updated")}),{key:"subscriptions",label:d("Subscription"),description:d("Whether user is subscribed or not"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("is subscribed"),value:{value:"*",operator:O.has}},{key:"02",label:d("is not subscribed"),value:{value:"*",operator:O.doesntHave}}]}}],Ur=U.createContext(null);function qa(){return m.useContext(Ur)}const Wc=15,Qc=[{key:10},{key:15},{key:20},{key:50},{key:100}];function Ha({query:s,onPerPageChange:t,onPageChange:a,className:r}){var u;const i=Fe(),l=Hl(),o=(u=s.data)==null?void 0:u.pagination;if(!o)return null;const c=e.jsx(os,{minWidth:"min-w-auto",selectionMode:"single",disabled:s.isLoading,labelPosition:"side",size:"xs",label:e.jsx(n,{message:"Items per page"}),selectedValue:o.per_page||Wc,onSelectionChange:x=>{t==null||t(x)},children:Qc.map(x=>e.jsx(h,{value:x.key,children:x.key},x.key))});return e.jsxs("div",{className:w("flex items-center justify-end gap-20 px-20 h-54 select-none",r),children:[!i&&c,o.from&&o.to&&"total"in o&&e.jsx("div",{className:"text-sm",children:e.jsx(n,{message:":from - :to of :total",values:{from:o.from,to:o.to,total:l.format(o.total)}})}),e.jsxs("div",{className:"text-muted",children:[e.jsx(C,{disabled:s.isFetching||o.current_page<2,onClick:()=>{a==null||a((o==null?void 0:o.current_page)-1)},children:e.jsx(Fa,{})}),e.jsx(C,{disabled:s.isFetching||!Fo(o),onClick:()=>{a==null||a((o==null?void 0:o.current_page)+1)},children:e.jsx(Dt,{})})]})]})}function Za({actions:s,filters:t,filtersLoading:a,searchPlaceholder:r=d("Type to search..."),searchValue:i="",onSearchChange:l}){const{trans:o}=A();return e.jsxs(Br,{children:[e.jsx(qe,{inputTestId:"datatable-search",className:"flex-auto max-w-440 mr-auto",inputWrapperClassName:"mr-24 md:mr-0",placeholder:o(r),startAdornment:e.jsx(Mt,{}),value:i,onChange:c=>{l(c.target.value)}}),t&&e.jsx(xr,{filters:t,disabled:a}),s]})}function Br({children:s,...t}){return e.jsx("div",{className:"mb-24 flex items-center gap-8 md:gap-12 text-muted relative h-42",...t,children:s})}function Wa({actions:s,selectedItemsCount:t}){return e.jsxs(Br,{"data-testid":"datatable-selected-header",children:[e.jsx("div",{className:"mr-auto",children:e.jsx(n,{message:"[one 1 item|other :count items] selected",values:{count:t}})}),s]})}function qr({filters:s,filtersLoading:t,columns:a,searchPlaceholder:r,queryParams:i,endpoint:l,actions:o,selectedActions:c,emptyStateMessage:u,tableDomProps:x,onRowAction:p,enableSelection:j=!0,selectionStyle:v="checkbox",children:f,cellHeight:k,collapseTableOnMobile:y=!0}){var _s;const L=Fe(),{trans:N}=A(),{encodedFilters:z}=At(s),[R,G]=m.useState({perPage:15}),[se,he]=m.useState([]),je=Ea(l,{...R,...i,[Eo]:z},{onSuccess:()=>{he([])}}),Zs=!!(R.query||R.filters||z),Ge=(_s=je.data)==null?void 0:_s.pagination;return e.jsxs(Ur.Provider,{value:{selectedRows:se,setSelectedRows:he,endpoint:l,params:R,setParams:G,query:je},children:[f,e.jsx(es,{initial:!1,mode:"wait",children:se.length?e.jsx(Wa,{selectedItemsCount:se.length,actions:c},"selected"):e.jsx(Za,{searchPlaceholder:r,searchValue:R.query,onSearchChange:Ke=>G({...R,query:Ke}),actions:o,filters:s,filtersLoading:t},"default")}),s&&e.jsx("div",{className:"mb-14",children:e.jsx(es,{initial:!1,mode:"wait",children:t&&z?e.jsx(Po,{}):e.jsx(ls.div,{...Ps,children:e.jsx($t,{filters:s})},"filter-list")})}),e.jsxs("div",{className:w("relative rounded",(!L||!y)&&"border"),children:[je.isFetching&&e.jsx(It,{isIndeterminate:!0,className:"absolute top-0 left-0 w-full z-10","aria-label":N({message:"Loading"}),size:"xs"}),e.jsx("div",{className:"relative overflow-x-auto md:overflow-hidden",children:e.jsx(lt,{...x,columns:a,data:(Ge==null?void 0:Ge.data)||[],sortDescriptor:R,onSortChange:Ke=>{G({...R,...Ke})},selectedRows:se,enableSelection:j,selectionStyle:v,onSelectionChange:he,onAction:p,collapseOnMobile:y,cellHeight:k})}),(je.isFetched||je.isPreviousData)&&!(Ge!=null&&Ge.data.length)?e.jsx("div",{className:"pt-50",children:m.cloneElement(u,{isFiltering:Zs})}):void 0,e.jsx(Ha,{query:je,onPageChange:Ke=>G({...R,page:Ke}),onPerPageChange:Ke=>G({...R,perPage:Ke})})]})]})}function fe({title:s,headerContent:t,headerItemsAlign:a="items-end",...r}){const i=m.useId();return e.jsxs("div",{className:"p-12 md:p-24",children:[s&&e.jsxs("div",{className:w("mb-16",t&&`flex ${a} gap-4`),children:[e.jsx(ts,{children:s}),e.jsx("h1",{className:"text-3xl font-light first:capitalize",id:i,children:s}),t]}),e.jsx(qr,{...r,tableDomProps:{"aria-labelledby":s?i:void 0}})]})}function Gc(){const{endpoint:s,selectedRows:t,setSelectedRows:a}=qa();return T(()=>Kc(s,t),{onSuccess:async()=>{await _.invalidateQueries(Y(s)),M(d("Deleted [one 1 record|other :count records]",{values:{count:t.length}})),a([])},onError:r=>q(r,d("Could not delete records"))})}function Kc(s,t){return S.delete(`${s}/${t.join(",")}`).then(a=>a.data)}function Le(){return e.jsxs(P,{type:"modal",children:[e.jsx(b,{variant:"flat",color:"danger",className:"ml-auto",children:e.jsx(n,{message:"Delete"})}),e.jsx(Jc,{})]})}function Jc(){const s=Gc(),{selectedRows:t}=qa(),{close:a}=Z();return e.jsx(ce,{isLoading:s.isLoading,title:e.jsx(n,{message:"Delete [one 1 item|other :count items]?",values:{count:t.length}}),body:e.jsx(n,{message:"This will permanently remove the items and cannot be undone."}),confirm:e.jsx(n,{message:"Delete"}),isDanger:!0,onConfirm:()=>{s.mutate(void 0,{onSuccess:()=>a()})}})}function me({isFiltering:s,title:t,filteringTitle:a,image:r,className:i}){const l=Fe();return e.jsx(He,{className:i,size:l?"sm":"md",image:e.jsx(va,{src:r}),title:s&&a?a:t,description:s&&a?e.jsx(n,{message:"Try another search query or different filters"}):void 0})}const at=""+new URL("team-de984127.svg",import.meta.url).href,ke=U.forwardRef(({children:s,to:t,elementType:a,onClick:r},i)=>Fe()?e.jsx(C,{ref:i,variant:"flat",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",to:t,elementType:a,onClick:r,children:e.jsx(ue,{})}):e.jsx(b,{ref:i,startIcon:e.jsx(ue,{}),variant:"flat",color:"primary",size:"sm",to:t,elementType:a,onClick:r,children:s})),ua=E(e.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined");function Yc(s){return T(t=>Xc(s,t),{onError:t=>q(t)})}function Xc(s,t){return S.post(s,t).then(a=>a.data)}function St(s,t){const a=document.createElement("a");a.href=s,t&&(a.download=t),document.body.appendChild(a),a.click(),document.body.removeChild(a)}function ed(){const{close:s}=Z();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Csv export"})}),e.jsx(X,{children:e.jsx(n,{message:`Your request is being processed. We'll email you when the report is ready to download. In
            certain cases, it might take a little longer, depending on the number of items beings
            exported and the volume of activity.`})}),e.jsx(ne,{children:e.jsx(b,{variant:"flat",color:"primary",onClick:s,children:e.jsx(n,{message:"Got it"})})})]})}function Hr({endpoint:s,payload:t}){const[a,r]=m.useState(!1),i=Yc(s);return e.jsxs(m.Fragment,{children:[e.jsx(C,{variant:"outline",color:"primary",radius:"rounded",size:"sm",className:"flex-shrink-0",disabled:i.isLoading,onClick:()=>{i.mutate(t,{onSuccess:l=>{l.downloadPath?St(l.downloadPath):r(!0)}})},children:e.jsx(ua,{})}),e.jsx(P,{type:"modal",isOpen:a,onOpenChange:r,children:e.jsx(ed,{})})]})}function sd(s,t){return T(a=>td(t,a),{onSuccess:()=>{M(d("User suspended")),_.invalidateQueries(["users"])},onError:a=>J(a,s)})}function td(s,t){return S.post(`users/${s}/ban`,t).then(a=>a.data)}function ad(s){const t=ot(),[a,r]=m.useState(!s.value&&!s.defaultValue),i=s.onChange,[l,o]=Xs(s.value||t,s.defaultValue||t,i),{min:c,max:u,granularity:x,timezone:p,calendarIsOpen:j,setCalendarIsOpen:v,closeDialogOnSelection:f}=zo(l,s),k=m.useCallback(()=>{r(!0),o(t),i==null||i(null),v(!1)},[t,o,i,v]),[y,L]=m.useState(()=>[bn(l)]),N=m.useCallback(G=>{c&&G.compare(c)<0?G=c:u&&G.compare(u)>0&&(G=u);const se=l?l.set(G):Zl(G,p);o(se),L([bn(se)]),r(!1)},[o,c,u,l,p]),z=m.useCallback(G=>!a&&Wl(l,G),[l,a]),R=m.useCallback(G=>({onClick:()=>{N==null||N(G),f&&(v==null||v(!1))}}),[N,v,f]);return{selectedValue:l,setSelectedValue:o,calendarIsOpen:j,setCalendarIsOpen:v,dayIsActive:z,dayIsHighlighted:()=>!1,dayIsRangeStart:()=>!1,dayIsRangeEnd:()=>!1,getCellProps:R,calendarDates:y,setCalendarDates:L,isPlaceholder:a,clear:k,setIsPlaceholder:r,min:c,max:u,granularity:x,timezone:p,closeDialogOnSelection:f}}function nd({showCalendarFooter:s,...t}){const a=ad(t),r=m.useRef(null),i=ot(),l=s&&e.jsx(ne,{padding:"px-14 pb-14",startAction:e.jsx(b,{disabled:a.isPlaceholder,variant:"text",color:"primary",onClick:()=>{a.clear()},children:e.jsx(n,{message:"Clear"})}),children:e.jsx(b,{variant:"text",color:"primary",onClick:()=>{a.setSelectedValue(i),a.setCalendarIsOpen(!1)},children:e.jsx(n,{message:"Today"})})}),o=e.jsx(P,{offset:8,placement:"bottom-start",isOpen:a.calendarIsOpen,onOpenChange:a.setCalendarIsOpen,type:"popover",triggerRef:r,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:e.jsxs(K,{size:"auto",children:[e.jsx(X,{className:"flex items-start gap-40",padding:s?"px-24 pt-20 pb-10":null,children:e.jsx($o,{state:a,visibleMonths:1})}),l]})}),c={onClick:u=>{u.stopPropagation(),u.preventDefault(),rd(u)?a.setCalendarIsOpen(!1):a.setCalendarIsOpen(!0)}};return e.jsxs(m.Fragment,{children:[e.jsx(Do,{ref:r,wrapperProps:c,endAdornment:e.jsx(hr,{className:w(t.disabled&&"text-disabled")}),...t,children:e.jsx(Ao,{segmentProps:c,state:a,value:a.selectedValue,onChange:a.setSelectedValue,isPlaceholder:a.isPlaceholder})}),o]})}function js(s){const{min:t,max:a}=s,{trans:r}=A(),{format:i}=Ql(),{field:{onChange:l,onBlur:o,value:c=null,ref:u},fieldState:{invalid:x,error:p}}=cs({name:s.name,rules:{validate:f=>{if(!f)return;const k=Ct(f);if(t&&k.compare(t)<0)return r({message:"Enter a date after :date",values:{date:i(f)}});if(a&&k.compare(a)>0)return r({message:"Enter a date before :date",values:{date:i(f)}})}}}),j=c?Ct(c):null,v={onChange:f=>{l(f&&f.toAbsoluteString())},onBlur:o,value:j,invalid:x,errorMessage:p==null?void 0:p.message,inputRef:u};return e.jsx(nd,{...ds(v,s)})}function rd(s){return["hour","minute","dayPeriod"].includes(s.currentTarget.ariaLabel||"")}function id({user:s}){const{trans:t}=A(),{close:a,formId:r}=Z(),i=V({defaultValues:{permanent:!0}}),l=i.watch("permanent"),o=sd(i,s.id);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Suspend “:name“",values:{name:s.display_name}})}),e.jsx(X,{children:e.jsxs(ee,{id:r,form:i,onSubmit:c=>o.mutate(c,{onSuccess:()=>a()}),children:[e.jsx(js,{name:"ban_until",label:e.jsx(n,{message:"Suspend until"}),disabled:l}),e.jsx($,{name:"permanent",className:"mt-12",children:e.jsx(n,{message:"Permanent"})}),e.jsx(g,{className:"mt-24",name:"comment",inputElementType:"textarea",maxLength:250,label:e.jsx(n,{message:"Reason"}),placeholder:t(d("Optional"))})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:r,variant:"flat",color:"primary",type:"submit",disabled:o.isLoading,children:e.jsx(n,{message:"Suspend"})})]})]})}const Zr=E(e.jsx("path",{d:"m20 17.17-3.37-3.38c.64.22 1.23.48 1.77.76.97.51 1.58 1.52 1.6 2.62zm1.19 4.02-1.41 1.41-2.61-2.6H4v-2.78c0-1.12.61-2.15 1.61-2.66 1.29-.66 2.87-1.22 4.67-1.45L1.39 4.22 2.8 2.81l18.39 18.38zM15.17 18l-3-3H12c-2.37 0-4.29.73-5.48 1.34-.32.16-.52.5-.52.88V18h9.17zM12 6c1.1 0 2 .9 2 2 0 .86-.54 1.59-1.3 1.87l1.48 1.48C15.28 10.64 16 9.4 16 8c0-2.21-1.79-4-4-4-1.4 0-2.64.72-3.35 1.82l1.48 1.48C10.41 6.54 11.14 6 12 6z"}),"PersonOffOutlined");function ld(s){return T(()=>od(s),{onSuccess:()=>{M(d("User unsuspended")),_.invalidateQueries(["users"])},onError:t=>q(t)})}function od(s){return S.delete(`users/${s}/unban`).then(t=>t.data)}const Sn=[{key:"name",allowsSorting:!0,sortingKey:"email",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(ys,{image:s.avatar,label:s.display_name,description:s.email})},{key:"subscribed",header:()=>e.jsx(n,{message:"Subscribed"}),width:"w-96",body:s=>{var t;return(t=s.subscriptions)!=null&&t.length?e.jsx(Tt,{className:"icon-md text-positive"}):e.jsx(Ee,{className:"icon-md text-danger"})}},{key:"roles",header:()=>e.jsx(n,{message:"Roles"}),body:s=>e.jsx(Ro,{radius:"rounded",size:"xs",children:s.roles.map(t=>e.jsx(ca,{selectable:!0,children:e.jsx(F,{className:w("capitalize"),target:"_blank",to:`/admin/roles/${t.id}/edit`,children:e.jsx(n,{message:t.name})})},t.id))})},{key:"firstName",allowsSorting:!0,header:()=>e.jsx(n,{message:"First name"}),body:s=>s.first_name},{key:"lastName",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last name"}),body:s=>s.last_name},{key:"createdAt",allowsSorting:!0,width:"w-96",header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx("time",{children:e.jsx(ae,{date:s.created_at})})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),width:"w-84 flex-shrink-0",hideHeader:!0,align:"end",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(F,{to:`${s.id}/edit`,children:e.jsx(oe,{label:e.jsx(n,{message:"Edit user"}),children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})}),s.banned_at?e.jsx(ud,{user:s}):e.jsxs(P,{type:"modal",children:[e.jsx(oe,{label:e.jsx(n,{message:"Suspend user"}),children:e.jsx(C,{size:"md",children:e.jsx(Zr,{})})}),e.jsx(id,{user:s})]})]})}];function cd(){const{billing:s}=xe(),t=s.enable?Sn:Sn.filter(a=>a.key!=="subscribed");return e.jsx(m.Fragment,{children:e.jsx(fe,{endpoint:"users",title:e.jsx(n,{message:"Users"}),filters:Zc,columns:t,actions:e.jsx(dd,{}),queryParams:{with:"subscriptions,bans"},selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:at,title:e.jsx(n,{message:"No users have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})})}function dd(){return e.jsxs(m.Fragment,{children:[e.jsx(Hr,{endpoint:"users/csv/export"}),e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new user"})})]})}function ud({user:s}){const t=ld(s.id);return e.jsxs(P,{type:"modal",onClose:a=>{a&&t.mutate()},children:[e.jsx(oe,{label:e.jsx(n,{message:"Remove suspension"}),children:e.jsx(C,{size:"md",color:"danger",children:e.jsx(Zr,{})})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Suspend “:name“",values:{name:s.display_name}}),body:e.jsx(n,{message:"Are you sure you want to remove suspension from this user?"}),confirm:e.jsx(n,{message:"Unsuspend"})})]})}function md(s,t){return s.reduce((a,r,i)=>{const l=Math.floor(i/t);return a[l]||(a[l]=[]),a[l].push(r),a},[])}const xd={preview:{defaultRoute:"/",navigationRoutes:[]},sections:{general:{label:d("General"),position:1,buildBreadcrumb:()=>[{label:d("General"),location:"general"}]},themes:{label:d("Themes"),position:2,buildBreadcrumb:(s,t)=>{var l;const a=s.split("/").filter(o=>!!o),[,,,r]=a,i=[{label:d("Themes"),location:"themes"}];return r!=null&&i.push({label:(l=t.appearance.themes.all[+r])==null?void 0:l.name,location:`themes/${r}`}),i}},menus:{label:d("Menus"),position:3,buildBreadcrumb:(s,t)=>{const a=s.split("/").filter(o=>!!o),[,,...r]=a,i=[{label:d("Menus"),location:"menus"}],l=md(r,2);return l.forEach(([o,c],u)=>{var x,p;if(o==="menus"&&c!=null)i.push({label:(x=t.settings.menus[+c])==null?void 0:x.name,location:`menus/${c}`});else if(o==="items"&&c!=null){const[,j]=l[u-1];i.push({label:(p=t.settings.menus[+j].items[+c])==null?void 0:p.label,location:`menus/${j}/${c}`})}}),i},config:{availableRoutes:["/login","/register","/contact","/billing/pricing","/account-settings","/admin","/admin/appearance","/admin/settings","/admin/plans","/admin/subscriptions","/admin/users","/admin/roles","/admin/pages","/admin/tags","/admin/files","/admin/localizations","/admin/ads","/admin/settings/authentication","/admin/settings/branding","/admin/settings/cache","/admin/settings/providers","/api-docs"],positions:["admin-navbar","admin-sidebar","custom-page-navbar","auth-page-footer","auth-dropdown","account-settings-page","billing-page","checkout-page-navbar","checkout-page-footer","pricing-table-page","contact-us-page","notifications-page","footer","footer-secondary"]}},"custom-code":{label:d("Custom Code"),position:4,buildBreadcrumb:()=>[{label:d("Custom code"),location:"custom-code"}]},"seo-settings":{label:d("SEO Settings"),position:5,buildBreadcrumb:()=>[{label:d("SEO"),location:"seo"}]}}},$e=m.forwardRef(({startIcon:s,children:t,className:a,...r},i)=>e.jsxs(er,{ref:i,className:w("flex items-center gap-10 w-full rounded border text-sm h-54 px-14 mb-10 bg relative hover:bg-hover",a),variant:null,...r,children:[s,e.jsx("div",{children:t}),e.jsx(Dt,{className:"icon-sm text-muted ml-auto"})]})),Wr=E(e.jsx("path",{stroke:"#E0E0E0",d:"M24,44c-7.168,0-13-5.816-13-12.971C11,24,24,4,24,4s13,20,13,27.029C37,38.184,31.168,44,24,44z"}));function Vs(){return(Vs=Object.assign||function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s}).apply(this,arguments)}function Bt(s,t){if(s==null)return{};var a,r,i={},l=Object.keys(s);for(r=0;r<l.length;r++)t.indexOf(a=l[r])>=0||(i[a]=s[a]);return i}function nt(s){var t=m.useRef(s),a=m.useRef(function(r){t.current&&t.current(r)});return t.current=s,a.current}var rt=function(s,t,a){return t===void 0&&(t=0),a===void 0&&(a=1),s>a?a:s<t?t:s},Js=function(s){return"touches"in s},ma=function(s){return s&&s.ownerDocument.defaultView||self},Nn=function(s,t,a){var r=s.getBoundingClientRect(),i=Js(t)?function(l,o){for(var c=0;c<l.length;c++)if(l[c].identifier===o)return l[c];return l[0]}(t.touches,a):t;return{left:rt((i.pageX-(r.left+ma(s).pageXOffset))/r.width),top:rt((i.pageY-(r.top+ma(s).pageYOffset))/r.height)}},Ln=function(s){!Js(s)&&s.preventDefault()},Qr=U.memo(function(s){var t=s.onMove,a=s.onKey,r=Bt(s,["onMove","onKey"]),i=m.useRef(null),l=nt(t),o=nt(a),c=m.useRef(null),u=m.useRef(!1),x=m.useMemo(function(){var f=function(L){Ln(L),(Js(L)?L.touches.length>0:L.buttons>0)&&i.current?l(Nn(i.current,L,c.current)):y(!1)},k=function(){return y(!1)};function y(L){var N=u.current,z=ma(i.current),R=L?z.addEventListener:z.removeEventListener;R(N?"touchmove":"mousemove",f),R(N?"touchend":"mouseup",k)}return[function(L){var N=L.nativeEvent,z=i.current;if(z&&(Ln(N),!function(G,se){return se&&!Js(G)}(N,u.current)&&z)){if(Js(N)){u.current=!0;var R=N.changedTouches||[];R.length&&(c.current=R[0].identifier)}z.focus(),l(Nn(z,N,c.current)),y(!0)}},function(L){var N=L.which||L.keyCode;N<37||N>40||(L.preventDefault(),o({left:N===39?.05:N===37?-.05:0,top:N===40?.05:N===38?-.05:0}))},y]},[o,l]),p=x[0],j=x[1],v=x[2];return m.useEffect(function(){return v},[v]),U.createElement("div",Vs({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:j,tabIndex:0,role:"slider"}))}),Qa=function(s){return s.filter(Boolean).join(" ")},Gr=function(s){var t=s.color,a=s.left,r=s.top,i=r===void 0?.5:r,l=Qa(["react-colorful__pointer",s.className]);return U.createElement("div",{className:l,style:{top:100*i+"%",left:100*a+"%"}},U.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},ge=function(s,t,a){return t===void 0&&(t=0),a===void 0&&(a=Math.pow(10,t)),Math.round(a*s)/a},hd=function(s){return bd(xa(s))},xa=function(s){return s[0]==="#"&&(s=s.substring(1)),s.length<6?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?ge(parseInt(s[3]+s[3],16)/255,2):1}:{r:parseInt(s.substring(0,2),16),g:parseInt(s.substring(2,4),16),b:parseInt(s.substring(4,6),16),a:s.length===8?ge(parseInt(s.substring(6,8),16)/255,2):1}},gd=function(s){return fd(jd(s))},pd=function(s){var t=s.s,a=s.v,r=s.a,i=(200-t)*a/100;return{h:ge(s.h),s:ge(i>0&&i<200?t*a/100/(i<=100?i:200-i)*100:0),l:ge(i/2),a:ge(r,2)}},ha=function(s){var t=pd(s);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},jd=function(s){var t=s.h,a=s.s,r=s.v,i=s.a;t=t/360*6,a/=100,r/=100;var l=Math.floor(t),o=r*(1-a),c=r*(1-(t-l)*a),u=r*(1-(1-t+l)*a),x=l%6;return{r:ge(255*[r,c,o,o,u,r][x]),g:ge(255*[u,r,r,c,o,o][x]),b:ge(255*[o,o,u,r,r,c][x]),a:ge(i,2)}},ft=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},fd=function(s){var t=s.r,a=s.g,r=s.b,i=s.a,l=i<1?ft(ge(255*i)):"";return"#"+ft(t)+ft(a)+ft(r)+l},bd=function(s){var t=s.r,a=s.g,r=s.b,i=s.a,l=Math.max(t,a,r),o=l-Math.min(t,a,r),c=o?l===t?(a-r)/o:l===a?2+(r-t)/o:4+(t-a)/o:0;return{h:ge(60*(c<0?c+6:c)),s:ge(l?o/l*100:0),v:ge(l/255*100),a:i}},vd=U.memo(function(s){var t=s.hue,a=s.onChange,r=Qa(["react-colorful__hue",s.className]);return U.createElement("div",{className:r},U.createElement(Qr,{onMove:function(i){a({h:360*i.left})},onKey:function(i){a({h:rt(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":ge(t),"aria-valuemax":"360","aria-valuemin":"0"},U.createElement(Gr,{className:"react-colorful__hue-pointer",left:t/360,color:ha({h:t,s:100,v:100,a:1})})))}),yd=U.memo(function(s){var t=s.hsva,a=s.onChange,r={backgroundColor:ha({h:t.h,s:100,v:100,a:1})};return U.createElement("div",{className:"react-colorful__saturation",style:r},U.createElement(Qr,{onMove:function(i){a({s:100*i.left,v:100-100*i.top})},onKey:function(i){a({s:rt(t.s+100*i.left,0,100),v:rt(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ge(t.s)+"%, Brightness "+ge(t.v)+"%"},U.createElement(Gr,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:ha(t)})))}),Kr=function(s,t){if(s===t)return!0;for(var a in s)if(s[a]!==t[a])return!1;return!0},Cd=function(s,t){return s.toLowerCase()===t.toLowerCase()||Kr(xa(s),xa(t))};function wd(s,t,a){var r=nt(a),i=m.useState(function(){return s.toHsva(t)}),l=i[0],o=i[1],c=m.useRef({color:t,hsva:l});m.useEffect(function(){if(!s.equal(t,c.current.color)){var x=s.toHsva(t);c.current={hsva:x,color:t},o(x)}},[t,s]),m.useEffect(function(){var x;Kr(l,c.current.hsva)||s.equal(x=s.fromHsva(l),c.current.color)||(c.current={hsva:l,color:x},r(x))},[l,s,r]);var u=m.useCallback(function(x){o(function(p){return Object.assign({},p,x)})},[]);return[l,u]}var Sd=typeof window<"u"?m.useLayoutEffect:m.useEffect,Nd=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},kn=new Map,Ld=function(s){Sd(function(){var t=s.current?s.current.ownerDocument:document;if(t!==void 0&&!kn.has(t)){var a=t.createElement("style");a.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,kn.set(t,a);var r=Nd();r&&a.setAttribute("nonce",r),t.head.appendChild(a)}},[])},kd=function(s){var t=s.className,a=s.colorModel,r=s.color,i=r===void 0?a.defaultColor:r,l=s.onChange,o=Bt(s,["className","colorModel","color","onChange"]),c=m.useRef(null);Ld(c);var u=wd(a,i,l),x=u[0],p=u[1],j=Qa(["react-colorful",t]);return U.createElement("div",Vs({},o,{ref:c,className:j}),U.createElement(yd,{hsva:x,onChange:p}),U.createElement(vd,{hue:x.h,onChange:p,className:"react-colorful__last-control"}))},_d={defaultColor:"000",toHsva:hd,fromHsva:function(s){return gd({h:s.h,s:s.s,v:s.v,a:1})},equal:Cd},Md=function(s){return U.createElement(kd,Vs({},s,{colorModel:_d}))},Id=/^#?([0-9A-F]{3,8})$/i,Td=function(s){var t=s.color,a=t===void 0?"":t,r=s.onChange,i=s.onBlur,l=s.escape,o=s.validate,c=s.format,u=s.process,x=Bt(s,["color","onChange","onBlur","escape","validate","format","process"]),p=m.useState(function(){return l(a)}),j=p[0],v=p[1],f=nt(r),k=nt(i),y=m.useCallback(function(N){var z=l(N.target.value);v(z),o(z)&&f(u?u(z):z)},[l,u,o,f]),L=m.useCallback(function(N){o(N.target.value)||v(l(a)),k(N)},[a,l,o,k]);return m.useEffect(function(){v(l(a))},[a,l]),U.createElement("input",Vs({},x,{value:c?c(j):j,spellCheck:"false",onChange:y,onBlur:L}))},_n=function(s){return"#"+s},Fd=function(s){var t=s.prefixed,a=s.alpha,r=Bt(s,["prefixed","alpha"]),i=m.useCallback(function(o){return o.replace(/([^0-9A-F]+)/gi,"").substring(0,a?8:6)},[a]),l=m.useCallback(function(o){return function(c,u){var x=Id.exec(c),p=x?x[1].length:0;return p===3||p===6||!!u&&p===4||!!u&&p===8}(o,a)},[a]);return U.createElement(Td,Vs({},r,{escape:i,format:t?_n:void 0,process:_n,validate:l}))};class Ed{getStringForLocale(t,a){let r=this.strings[a];r||(r=Pd(a,this.strings,this.defaultLocale),this.strings[a]=r);let i=r[t];if(!i)throw new Error(`Could not find intl message ${t} in ${a} locale`);return i}constructor(t,a="en-US"){this.strings={...t},this.defaultLocale=a}}function Pd(s,t,a="en-US"){if(t[s])return t[s];let r=zd(s);if(t[r])return t[r];for(let i in t)if(i.startsWith(r+"-"))return t[i];return t[a]}function zd(s){return Intl.Locale?new Intl.Locale(s).language:s.split("-")[0]}function Dd(s){return s&&s.__esModule?s.default:s}var Jr={},Yr={};Yr={alpha:"ألفا",blue:"أزرق",brightness:"السطوع",green:"أخضر",hue:"درجة اللون",lightness:"الإضاءة",red:"أحمر",saturation:"التشبع"};var Xr={};Xr={alpha:"Алфа",blue:"Синьо",brightness:"Яркост",green:"Зелено",hue:"Оттенък",lightness:"Лекота",red:"Червено",saturation:"Наситеност"};var ei={};ei={alpha:"Alfa",blue:"Modrá",brightness:"Jas",green:"Zelená",hue:"Odstín",lightness:"Světlost",red:"Červená",saturation:"Sytost"};var si={};si={alpha:"Alfa",blue:"Blå",brightness:"Lysstyrke",green:"Grøn",hue:"Tone",lightness:"Lyshed",red:"Rød",saturation:"Farvemætning"};var ti={};ti={alpha:"Alpha",blue:"Blau",brightness:"Helligkeit",green:"Grün",hue:"Farbton",lightness:"Leuchtkraft",red:"Rot",saturation:"Sättigung"};var ai={};ai={alpha:"Άλφα",blue:"Μπλε",brightness:"Φωτεινότητα",green:"Πράσινο",hue:"Τόνος",lightness:"Φωτεινότητα",red:"Κόκκινο",saturation:"Κορεσμός"};var ni={};ni={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha"};var ri={};ri={alpha:"Alpha",blue:"Azul",brightness:"Brillo",green:"Verde",hue:"Tono",lightness:"Luminosidad",red:"Rojo",saturation:"Saturación"};var ii={};ii={alpha:"Alfa",blue:"Sinine",brightness:"Heledus",green:"Roheline",hue:"Värv",lightness:"Valgus",red:"Punane",saturation:"Küllastus"};var li={};li={alpha:"Alpha",blue:"Sininen",brightness:"Kirkkaus",green:"Vihreä",hue:"Sävy",lightness:"Valomäärä",red:"Punainen",saturation:"Värikylläisyys"};var oi={};oi={alpha:"Alpha",blue:"Bleu",brightness:"Luminosité",green:"Vert",hue:"Teinte",lightness:"Luminosité",red:"Rouge",saturation:"Saturation"};var ci={};ci={alpha:"אלפא",blue:"כחול",brightness:"בהירות",green:"ירוק",hue:"גוון",lightness:"כמות אור",red:"אדום",saturation:"רוויה"};var di={};di={alpha:"Alfa",blue:"Plava",brightness:"Svjetlina",green:"Zelena",hue:"Nijansa",lightness:"Osvijetljenost",red:"Crvena",saturation:"Zasićenost"};var ui={};ui={alpha:"Alfa",blue:"Kék",brightness:"Fényesség",green:"Zöld",hue:"Színárnyalat",lightness:"Világosság",red:"Piros",saturation:"Telítettség"};var mi={};mi={alpha:"Alfa",blue:"Blu",brightness:"Luminosità",green:"Verde",hue:"Tonalità",lightness:"Luminosità",red:"Rosso",saturation:"Saturazione"};var xi={};xi={alpha:"アルファ",blue:"青",brightness:"明るさ",green:"緑",hue:"色相",lightness:"明度",red:"赤",saturation:"彩度"};var hi={};hi={alpha:"알파",blue:"파랑",brightness:"명도",green:"초록",hue:"색조",lightness:"밝기",red:"빨강",saturation:"채도"};var gi={};gi={alpha:"Alfa",blue:"Mėlyna",brightness:"Ryškumas",green:"Žalia",hue:"Atspalvis",lightness:"Šviesumas",red:"Raudona",saturation:"Įsotinimas"};var pi={};pi={alpha:"Alfa",blue:"Zila",brightness:"Spilgtums",green:"Zaļa",hue:"Nokrāsa",lightness:"Gaišums",red:"Sarkana",saturation:"Piesātinājums"};var ji={};ji={alpha:"Alfa",blue:"Blå",brightness:"Lysstyrke",green:"Grønn",hue:"Fargetone",lightness:"Lyshet",red:"Rød",saturation:"Metning"};var fi={};fi={alpha:"Alfa",blue:"Blauw",brightness:"Helderheid",green:"Groen",hue:"Kleurtoon",lightness:"Lichtsterkte",red:"Rood",saturation:"Verzadiging"};var bi={};bi={alpha:"Alfa",blue:"Niebieski",brightness:"Jasność",green:"Zielony",hue:"Odcień",lightness:"Jaskrawość",red:"Czerwony",saturation:"Nasycenie"};var vi={};vi={alpha:"Alfa",blue:"Azul",brightness:"Brilho",green:"Verde",hue:"Matiz",lightness:"Luminosidade",red:"Vermelho",saturation:"Saturação"};var yi={};yi={alpha:"Alfa",blue:"Azul",brightness:"Luminosidade",green:"Verde",hue:"Tonalidade",lightness:"Claridade",red:"Vermelho",saturation:"Saturação"};var Ci={};Ci={alpha:"Alfa",blue:"Albastru",brightness:"Luminozitate",green:"Verde",hue:"Nuanță",lightness:"Luminozitate",red:"Roșu",saturation:"Saturație"};var wi={};wi={alpha:"Альфа",blue:"Синий",brightness:"Яркость",green:"Зеленый",hue:"Оттенок",lightness:"Освещенность",red:"Красный",saturation:"Насыщенность"};var Si={};Si={alpha:"Alfa",blue:"Modrá",brightness:"Jas",green:"Zelená",hue:"Odtieň",lightness:"Svetlosť",red:"Červená",saturation:"Sýtosť"};var Ni={};Ni={alpha:"Alfa",blue:"Modra",brightness:"Svetlost",green:"Zelena",hue:"Barva",lightness:"Lahkost",red:"Rdeča",saturation:"Nasičenost"};var Li={};Li={alpha:"Alfa",blue:"Plava",brightness:"Osvetljenost",green:"Zelena",hue:"Nijansa",lightness:"Osvetljenje",red:"Crvena",saturation:"Zasićenje"};var ki={};ki={alpha:"Alfa",blue:"Blått",brightness:"Ljusstyrka",green:"Grönt",hue:"Nyans",lightness:"Ljushet",red:"Rött",saturation:"Mättnad"};var _i={};_i={alpha:"Alfa",blue:"Mavi",brightness:"Parlaklık",green:"Yeşil",hue:"Ton",lightness:"Canlılık",red:"Kırmızı",saturation:"Doygunluk"};var Mi={};Mi={alpha:"Альфа",blue:"Синій",brightness:"Яскравість",green:"Зелений",hue:"Тон",lightness:"Освітленість",red:"Червоний",saturation:"Насиченість"};var Ii={};Ii={alpha:"Alpha",blue:"蓝色",brightness:"亮度",green:"绿色",hue:"色相",lightness:"明亮度",red:"红色",saturation:"饱和度"};var Ti={};Ti={alpha:"Alpha",blue:"藍色",brightness:"亮度",green:"綠色",hue:"色相",lightness:"明亮",red:"紅色",saturation:"飽和度"};Jr={"ar-AE":Yr,"bg-BG":Xr,"cs-CZ":ei,"da-DK":si,"de-DE":ti,"el-GR":ai,"en-US":ni,"es-ES":ri,"et-EE":ii,"fi-FI":li,"fr-FR":oi,"he-IL":ci,"hr-HR":di,"hu-HU":ui,"it-IT":mi,"ja-JP":xi,"ko-KR":hi,"lt-LT":gi,"lv-LV":pi,"nb-NO":ji,"nl-NL":fi,"pl-PL":bi,"pt-BR":vi,"pt-PT":yi,"ro-RO":Ci,"ru-RU":wi,"sk-SK":Si,"sl-SI":Ni,"sr-SP":Li,"sv-SE":ki,"tr-TR":_i,"uk-UA":Mi,"zh-CN":Ii,"zh-TW":Ti};const Ad=new Ed(Dd(Jr));function Ns(s){let t=ns.parse(s)||rs.parse(s)||is.parse(s);if(t)return t;throw new Error("Invalid color value: "+s)}class Ga{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(t){if(t in this)return this[t];throw new Error("Unsupported color channel: "+t)}withChannelValue(t,a){if(t in this){let r=this.clone();return r[t]=a,r}throw new Error("Unsupported color channel: "+t)}getChannelName(t,a){return Ad.getStringForLocale(t,a)}getColorSpaceAxes(t){let{xChannel:a,yChannel:r}=t,i=a||this.getColorChannels().find(c=>c!==r),l=r||this.getColorChannels().find(c=>c!==i),o=this.getColorChannels().find(c=>c!==i&&c!==l);return{xChannel:i,yChannel:l,zChannel:o}}}class ns extends Ga{static parse(t){let a=[];if(/^#[\da-f]+$/i.test(t)&&[4,5,7,9].includes(t.length)){const l=(t.length<6?t.replace(/[^#]/gi,"$&$&"):t).slice(1).split("");for(;l.length>0;)a.push(parseInt(l.splice(0,2).join(""),16));a[3]=a[3]!==void 0?a[3]/255:void 0}const r=t.match(/^rgba?\((.*)\)$/);r!=null&&r[1]&&(a=r[1].split(",").map(l=>Number(l.trim())),a=a.map((l,o)=>gs(l,0,o<3?255:1)));var i;return a.length<3?void 0:new ns(a[0],a[1],a[2],(i=a[3])!==null&&i!==void 0?i:1)}toString(t){switch(t){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(this.alpha*255).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hex":case"hexa":case"rgb":case"rgba":return this;case"hsb":case"hsba":return this.toHSB();case"hsl":case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+t)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const t=this.red/255,a=this.green/255,r=this.blue/255,i=Math.min(t,a,r),l=Math.max(t,a,r),o=l-i,c=l===0?0:o/l;let u=0;if(o!==0){switch(l){case t:u=(a-r)/o+(a<r?6:0);break;case a:u=(r-t)/o+2;break;case r:u=(t-a)/o+4;break}u/=6}return new rs(le(u*360,2),le(c*100,2),le(l*100,2),this.alpha)}toHSL(){const t=this.red/255,a=this.green/255,r=this.blue/255,i=Math.min(t,a,r),l=Math.max(t,a,r),o=(l+i)/2,c=l-i;let u,x;if(c===0)u=x=0;else{switch(x=c/(o<.5?l+i:2-l-i),l){case t:u=(a-r)/c+(a<r?6:0);break;case a:u=(r-t)/c+2;break;case r:u=(t-a)/c+4;break}u/=6}return new is(le(u*360,2),le(x*100,2),le(o*100,2),this.alpha)}clone(){return new ns(this.red,this.green,this.blue,this.alpha)}getChannelRange(t){switch(t){case"red":case"green":case"blue":return{minValue:0,maxValue:255,step:1,pageSize:17};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"red":case"green":case"blue":r={style:"decimal"};break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new ya(a,r).format(i)}getColorSpace(){return"rgb"}getColorChannels(){return ns.colorChannels}constructor(t,a,r,i){super(),this.red=t,this.green=a,this.blue=r,this.alpha=i}}ns.colorChannels=["red","green","blue"];const $d=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class rs extends Ga{static parse(t){let a;if(a=t.match($d)){var r;const[i,l,o,c]=((r=a[1])!==null&&r!==void 0?r:a[2]).split(",").map(u=>Number(u.trim().replace("%","")));return new rs(Fi(i,360),gs(l,0,100),gs(o,0,100),gs(c??1,0,1))}}toString(t){switch(t){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${le(this.saturation,2)}%, ${le(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${le(this.saturation,2)}%, ${le(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsb":case"hsba":return this;case"hsl":case"hsla":return this.toHSL();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+t)}}toHSL(){let t=this.saturation/100,a=this.brightness/100,r=a*(1-t/2);return t=r===0||r===1?0:(a-r)/Math.min(r,1-r),new is(le(this.hue,2),le(t*100,2),le(r*100,2),this.alpha)}toRGB(){let t=this.hue,a=this.saturation/100,r=this.brightness/100,i=(l,o=(l+t/60)%6)=>r-a*r*Math.max(Math.min(o,4-o,1),0);return new ns(Math.round(i(5)*255),Math.round(i(3)*255),Math.round(i(1)*255),this.alpha)}clone(){return new rs(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"hue":r={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"brightness":r={style:"percent"},i/=100;break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new ya(a,r).format(i)}getColorSpace(){return"hsb"}getColorChannels(){return rs.colorChannels}constructor(t,a,r,i){super(),this.hue=t,this.saturation=a,this.brightness=r,this.alpha=i}}rs.colorChannels=["hue","saturation","brightness"];const Rd=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;function Fi(s,t){return(s%t+t)%t}class is extends Ga{static parse(t){let a;if(a=t.match(Rd)){var r;const[i,l,o,c]=((r=a[1])!==null&&r!==void 0?r:a[2]).split(",").map(u=>Number(u.trim().replace("%","")));return new is(Fi(i,360),gs(l,0,100),gs(o,0,100),gs(c??1,0,1))}}toString(t){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${le(this.saturation,2)}%, ${le(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${le(this.saturation,2)}%, ${le(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){case"hsl":case"hsla":return this;case"hsb":case"hsba":return this.toHSB();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+t)}}toHSB(){let t=this.saturation/100,a=this.lightness/100,r=a+t*Math.min(a,1-a);return t=r===0?0:2*(1-a/r),new rs(le(this.hue,2),le(t*100,2),le(r*100,2),this.alpha)}toRGB(){let t=this.hue,a=this.saturation/100,r=this.lightness/100,i=a*Math.min(r,1-r),l=(o,c=(o+t/30)%12)=>r-i*Math.max(Math.min(c-3,9-c,1),-1);return new ns(Math.round(l(0)*255),Math.round(l(8)*255),Math.round(l(4)*255),this.alpha)}clone(){return new is(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+t)}}formatChannelValue(t,a){let r,i=this.getChannelValue(t);switch(t){case"hue":r={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"lightness":r={style:"percent"},i/=100;break;case"alpha":r={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new ya(a,r).format(i)}getColorSpace(){return"hsl"}getColorChannels(){return is.colorChannels}constructor(t,a,r,i){super(),this.hue=t,this.saturation=a,this.lightness=r,this.alpha=i}}is.colorChannels=["hue","saturation","lightness"];Ns("#ffffff");Ns("hsl(0, 100%, 50%)");const Vd=Ns("#000000"),Od=Ns("#FFFFFF");Vd.toHexInt();Od.toHexInt();function Ud({onChange:s,value:t,colors:a}){const r=a.map(i=>{const l=t===i;return e.jsx(er,{onClick:()=>{s==null||s(i)},className:w("relative block flex-shrink-0 w-26 h-26 border rounded",l&&"shadow-md"),style:{backgroundColor:i},children:l&&e.jsx("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},i)});return e.jsx("div",{className:"flex flex-wrap gap-6",children:r})}const Bd=[{color:"rgb(255, 255, 255)",name:d("White")},{color:"rgb(239,245,245)",name:d("Solitude")},{color:"rgb(245,213,174)",name:d("Wheat")},{color:"rgb(253,227,167)",name:d("Cape Honey")},{color:"rgb(242,222,186)",name:d("Milk punch")},{color:"rgb(97,118,75)",name:d("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:d("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:d("Cosmic Latte")},{color:"rgb(233,119,119)",name:d("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:d("Sundown")},{color:"rgb(30,139,195)",name:d("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:d("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:d("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:d("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:d("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:d("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:d("Comet"),foreground:"rgb(255, 255, 255)"}],qd=Bd.map(({color:s})=>s).slice(0,14);function Hd({defaultValue:s,onChange:t,colorPresets:a,showInput:r}){const[i,l]=m.useState(s),o=a||qd,c=Ca({size:"sm"});return e.jsxs("div",{children:[e.jsx(Md,{className:"!w-auto",color:i,onChange:u=>{t==null||t(u),l(u)}}),e.jsxs("div",{className:"py-20 px-12",children:[o&&e.jsx(Ud,{colors:o,onChange:u=>{if(u){const x=Ns(u).toString("hex");t==null||t(x),l(x)}},value:i}),r&&e.jsx("div",{className:"pt-20",children:e.jsx(Fd,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:c.input,color:i,onChange:u=>{t==null||t(u),l(u)}})})]})]})}function Ka({defaultValue:s,onChange:t,hideFooter:a=!1,showInput:r=!0}){const{close:i}=Z(),[l,o]=m.useState(s||"");return e.jsxs(K,{size:"2xs",children:[e.jsx(Hd,{showInput:r,defaultValue:l,onChange:c=>{o(c),t==null||t(c)}}),!a&&e.jsxs(ne,{dividerTop:!0,children:[e.jsx(b,{variant:"text",size:"xs",onClick:()=>{i()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",size:"xs",onClick:()=>{i(l)},children:e.jsx(n,{message:"Apply"})})]})]})}function Zd(){return e.jsxs(m.Fragment,{children:[e.jsx(Wd,{}),e.jsxs("div",{className:"my-24 border-y py-24",children:[e.jsx($e,{to:"action-buttons",elementType:F,className:"mb-20",children:e.jsx(n,{message:"Action buttons"})}),e.jsx($e,{to:"primary-features",elementType:F,children:e.jsx(n,{message:"Primary features"})}),e.jsx($e,{to:"secondary-features",elementType:F,children:e.jsx(n,{message:"Secondary features"})})]}),e.jsx(Qd,{}),e.jsx(Gd,{})]})}function Wd(){const s=Ls(t=>{var a,r,i;return(i=(r=(a=t.defaults)==null?void 0:a.settings.homepage)==null?void 0:r.appearance)==null?void 0:i.headerImage});return e.jsxs(m.Fragment,{children:[e.jsx(g,{label:e.jsx(n,{message:"Header title"}),className:"mb-20",name:"settings.homepage.appearance.headerTitle",onFocus:()=>{W().preview.setHighlight('[data-testid="headerTitle"]')}}),e.jsx(g,{label:e.jsx(n,{message:"Header subtitle"}),className:"mb-30",inputElementType:"textarea",rows:4,name:"settings.homepage.appearance.headerSubtitle",onFocus:()=>{W().preview.setHighlight('[data-testid="headerSubtitle"]')}}),e.jsx(ve,{name:"settings.homepage.appearance.headerImage",className:"mb-30",label:e.jsx(n,{message:"Header image"}),defaultValue:s,diskPrefix:"homepage"}),e.jsx($,{className:"mb-24",name:"settings.homepage.appearance.blurHeaderImage",children:e.jsx(n,{message:"Blur header image"})}),e.jsx(Vo,{name:"settings.homepage.appearance.headerImageOpacity",label:e.jsx(n,{message:"Header image opacity"}),minValue:0,step:.1,maxValue:1,formatOptions:{style:"percent"}}),e.jsx("div",{className:"mb-20 text-xs text-muted",children:e.jsx(n,{message:"In order for overlay colors to appear, header image opacity will need to be less then 100%"})}),e.jsx(Mn,{formKey:"settings.homepage.appearance.headerOverlayColor1",label:e.jsx(n,{message:"Header overlay color 1"})}),e.jsx(Mn,{formKey:"settings.homepage.appearance.headerOverlayColor2",label:e.jsx(n,{message:"Header overlay color 2"})})]})}function Qd(){const s=Ls(t=>{var a,r,i;return(i=(r=(a=t.defaults)==null?void 0:a.settings.homepage)==null?void 0:r.appearance)==null?void 0:i.footerImage});return e.jsxs(m.Fragment,{children:[e.jsx($,{className:"mb-24",name:"settings.homepage.trending",children:e.jsx(n,{message:"Show trending titles"})}),e.jsx(g,{label:e.jsx(n,{message:"Footer title"}),className:"mb-20",name:"settings.homepage.appearance.footerTitle",onFocus:()=>{W().preview.setHighlight('[data-testid="footerTitle"]')}}),e.jsx(g,{label:e.jsx(n,{message:"Footer subtitle"}),className:"mb-20",name:"settings.homepage.appearance.footerSubtitle",onFocus:()=>{W().preview.setHighlight('[data-testid="footerSubtitle"]')}}),e.jsx(ve,{name:"settings.homepage.appearance.footerImage",className:"mb-30",label:e.jsx(n,{message:"Footer background image"}),defaultValue:s,diskPrefix:"homepage"})]})}function Gd(){return e.jsxs("div",{className:"mt-24 border-t pt-24",children:[e.jsx(g,{label:e.jsx(n,{message:"Pricing title"}),className:"mb-20",name:"settings.homepage.appearance.pricingTitle",onFocus:()=>{W().preview.setHighlight('[data-testid="pricingTitle"]')}}),e.jsx(g,{label:e.jsx(n,{message:"Pricing subtitle"}),className:"mb-20",name:"settings.homepage.appearance.pricingSubtitle",onFocus:()=>{W().preview.setHighlight('[data-testid="pricingSubtitle"]')}}),e.jsx($,{className:"mb-24",name:"settings.homepage.pricing",children:e.jsx(n,{message:"Show pricing table"})})]})}function Mn({label:s,formKey:t}){const a=t,{watch:r,setValue:i}=I(),l=r(a),o=c=>{i(t,c,{shouldDirty:!0})};return e.jsxs(P,{currentValue:l,type:"popover",onClose:c=>{o(c)},children:[e.jsx($e,{className:"capitalize",startIcon:e.jsx(Wr,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:l}}),children:s}),e.jsx(Ka,{defaultValue:l,onChange:c=>{o(c)}})]})}function Ei(s){return s&&s.charAt(0).toUpperCase()+s.slice(1)}const Kd=U.forwardRef(({valueListKey:s="permissions",...t},a)=>{const{data:r}=ie([s]),i=(r==null?void 0:r.permissions)||(r==null?void 0:r.workspacePermissions),[l,o]=Xs(t.value,[],t.onChange),[c,u]=m.useState(!1);if(!i)return null;const x=Pi(i,l,c),p=j=>{const v=[...l],f=v.findIndex(k=>k.id===j.id);f>-1&&v.splice(f,1,j),o(v)};return e.jsxs(m.Fragment,{children:[e.jsx(Cs,{variant:"outline",ref:a,children:x.map(({groupName:j,items:v,anyChecked:f})=>e.jsx(Ae,{label:e.jsx(n,{message:Ya(j)}),startIcon:f?e.jsx(Gl,{size:"sm"}):void 0,children:e.jsx(sr,{children:v.map(k=>{const y=l.findIndex(N=>N.id===k.id),L=y>-1;return e.jsxs("div",{children:[e.jsx(tr,{onSelected:()=>{if(L){const N=[...l];N.splice(y,1),o(N)}else o([...l,k])},endSection:e.jsx(da,{tabIndex:-1,checked:L,onChange:()=>{}}),description:e.jsx(n,{message:k.description}),children:e.jsx(n,{message:k.display_name||k.name})}),L&&e.jsx(Jd,{permission:k,onChange:p})]},k.id)})})},j))}),e.jsx(da,{className:"mt-30",checked:c,onChange:j=>{u(j.target.checked)},children:e.jsx(n,{message:"Show advanced permissions"})})]})});function Jd({permission:s,onChange:t}){var r;if(!((r=s==null?void 0:s.restrictions)!=null&&r.length))return null;const a=(i,l)=>{const o=Kl(s,c=>{const u=c.restrictions.find(x=>x.name===i);u&&(u.value=l)});t==null||t(o)};return e.jsx("div",{className:"px-40 py-20",children:s.restrictions.map((i,l)=>{const o=l===s.restrictions.length-1,c=e.jsx(n,{message:Ya(i.name)}),u=i.description?e.jsx(n,{message:i.description}):void 0;return i.type==="bool"?e.jsx(da,{description:u,className:w(!o&&"mb-30"),checked:!!i.value,onChange:x=>{a(i.name,x.target.checked)},children:c},i.name):e.jsx(qe,{size:"sm",label:c,description:u,type:"number",className:w(!o&&"mb-30"),value:i.value||"",onChange:x=>{a(i.name,x.target.value===""?void 0:parseInt(x.target.value))}},i.name)})})}function Ja(s){const{field:{onChange:t,value:a=[],ref:r}}=cs({name:s.name}),i={onChange:t,value:a};return e.jsx(Kd,{ref:r,...ds(i,s)})}const Ya=s=>Ei(s.replace("_"," "));function Pi(s,t,a){const r=[];return s.forEach(i=>{const l=t.findIndex(c=>c.id===i.id);if(!a&&i.advanced)return;let o=r.find(c=>c.groupName===i.group);if(o||(o={groupName:i.group,anyChecked:!1,items:[]},r.push(o)),l>-1){const c={...i,restrictions:Yd(i.restrictions,t[l].restrictions)};o.anyChecked=!0,o.items.push(c)}else o.items.push(i)}),r}function Yd(s,t){return s==null?void 0:s.map(a=>{const r=t.find(i=>i.name===a.name);return r?{...a,value:r.value}:a})}function zi(){const s=Xa.sections.menus.config;return s?s.availableRoutes.map(t=>({id:t,label:t,action:t,type:"route",target:"_self"})):[]}const Xt={grid:"flex flex-wrap gap-24",button:"flex flex-col items-center rounded hover:bg-hover h-90 aspect-square"},Xd=[...Array(60).keys()],eu=U.lazy(()=>us(()=>import("./icon-list-30cfb6a0.js"),["./icon-list-30cfb6a0.js","./main-a8767cd0.js","./main-f9578bdd.css","./user-profile-link-bc31d40d.js","./OpenInNew-a6691840.js","./BookmarkBorder-2abfb8d0.js","./CalendarToday-5a6bc8f6.js","./TaskAlt-a220d1ec.js","./use-resume-subscription-0d036444.js"],import.meta.url));function su({onIconSelected:s}){const{trans:t}=A(),[a,r]=U.useState("");return e.jsxs("div",{className:"py-4",children:[e.jsx(qe,{className:"mb-20",value:a,onChange:i=>{r(i.target.value)},placeholder:t({message:"Search icons..."})}),e.jsx(es,{mode:"wait",children:e.jsx(m.Suspense,{fallback:e.jsx(ls.div,{...Ps,className:Xt.grid,children:Xd.map((i,l)=>e.jsx("div",{className:Xt.button,children:e.jsx(et,{variant:"rect"})},l))}),children:e.jsx(ls.div,{...Ps,className:Xt.grid,children:e.jsx(eu,{searchQuery:a,onIconSelected:s})})})})]})}function tu(){return e.jsxs(K,{size:"w-850",className:"min-h-dialog",children:[e.jsx(te,{children:e.jsx(n,{message:"Select icon"})}),e.jsx(X,{children:e.jsx(au,{})})]})}function au(){const{close:s}=Z();return e.jsx(su,{onIconSelected:t=>{s(t)}})}function Fs({formPathPrefix:s,hideRoleAndPermissionFields:t}){const{trans:a}=A(),r=i=>s?`${s}.${i}`:i;return e.jsxs(m.Fragment,{children:[e.jsx(g,{className:"mb-20",name:r("label"),label:e.jsx(n,{message:"Label"}),placeholder:a(d("No label...")),startAppend:e.jsx(nu,{prefixName:r})}),e.jsx(ru,{prefixName:r}),!t&&e.jsxs(m.Fragment,{children:[e.jsx(iu,{prefixName:r}),e.jsx(lu,{prefixName:r})]}),e.jsx(ou,{prefixName:r})]})}function nu({prefixName:s,...t}){const{watch:a,setValue:r}=I(),i=s("icon"),l=a(i),o=l&&wa(l);return e.jsxs(P,{type:"modal",onClose:c=>{(c||c===null)&&r(i,c,{shouldDirty:!0})},children:[e.jsx(C,{className:"text-muted icon-sm",variant:"outline",size:"md",...t,children:o?e.jsx(o,{}):e.jsx(de,{})}),e.jsx(tu,{})]})}function ru({prefixName:s}){const t=I(),a=t.watch(s("type")),r=Oo(a),{data:i}=ie(["menuItemCategories"]),l=(i==null?void 0:i.menuItemCategories)||[],o=l.find(x=>x.type===a),{trans:c}=A(),u=zi();return m.useEffect(()=>{r&&r!==a&&t.setValue(s("action"),"")},[a,r,t,s]),e.jsxs(m.Fragment,{children:[e.jsxs(D,{className:"mb-20",name:s("type"),selectionMode:"single",label:e.jsx(n,{message:"Type"}),children:[e.jsx(h,{value:"link",children:e.jsx(n,{message:"Custom link"})}),e.jsx(h,{value:"route",children:e.jsx(n,{message:"Site page"})}),l.map(x=>e.jsx(h,{value:x.type,children:x.name},x.type))]}),a==="link"&&e.jsx(g,{className:"mb-20",required:!0,type:"url",name:s("action"),placeholder:c({message:"Enter a url..."}),label:e.jsx(n,{message:"Url"})}),a==="route"&&e.jsx(D,{className:"mb-20",required:!0,items:u,name:s("action"),label:e.jsx(n,{message:"Page"}),searchPlaceholder:c(d("Search pages")),showSearchField:!0,selectionMode:"single",children:x=>e.jsx(h,{value:x.id,children:x.label},x.id)}),o&&e.jsx(D,{className:"mb-20",required:!0,items:o.items,name:s("action"),showSearchField:!0,searchPlaceholder:c(d("Search...")),selectionMode:"single",label:e.jsx(n,{message:o.name}),children:x=>e.jsx(h,{value:x.action,children:e.jsx(n,{message:x.label})})})]})}function iu({prefixName:s}){const{data:t}=ie(["roles","permissions"]),a=(t==null?void 0:t.roles)||[],{trans:r}=A();return e.jsx($s,{className:"mb-20",placeholder:r({message:"Add role..."}),label:e.jsx(n,{message:"Only show if user has role"}),name:s("roles"),chipSize:"sm",suggestions:a,valueKey:"id",displayWith:i=>{var l;return(l=a.find(o=>o.id===i.id))==null?void 0:l.name},children:i=>e.jsx(h,{value:i.id,capitalizeFirst:!0,children:e.jsx(n,{message:i.name})},i.id)})}function lu({prefixName:s}){const{data:t}=ie(["roles","permissions"]),{trans:a}=A(),r=m.useMemo(()=>Pi((t==null?void 0:t.permissions)||[],[],!1),[t==null?void 0:t.permissions]);return e.jsx($s,{label:e.jsx(n,{message:"Only show if user has permissions"}),placeholder:a({message:"Add permission..."}),chipSize:"sm",suggestions:r,name:s("permissions"),valueKey:"name",children:({groupName:i,items:l})=>e.jsx(ar,{label:Ya(i),children:l.map(o=>e.jsx(h,{value:o.name,description:e.jsx(n,{message:o.description}),children:e.jsx(n,{message:o.display_name||o.name})},o.name))},i)})}function ou({prefixName:s}){return I().watch(s("type"))!=="link"?null:e.jsxs(D,{className:"mt-20",selectionMode:"single",name:s("target"),label:e.jsx(n,{message:"Open link in"}),children:[e.jsx(h,{value:"_self",children:e.jsx(n,{message:"Same window"})}),e.jsx(h,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})}function cu(){const[s,t]=m.useState(["cta1"]);return e.jsxs(Cs,{variant:"outline",expandedValues:s,onExpandedChange:a=>{t(a),a.length&&W().preview.setHighlight(`[data-testid="${a[0]}"]`)},children:[e.jsx(Ae,{value:"cta1",label:e.jsx(n,{message:"Header button 1"}),children:e.jsx(Fs,{formPathPrefix:"settings.homepage.appearance.actions.cta1"})}),e.jsx(Ae,{value:"ct2",label:e.jsx(n,{message:"Header button 2"}),children:e.jsx(Fs,{formPathPrefix:"settings.homepage.appearance.actions.cta2"})}),e.jsx(Ae,{value:"cta3",label:e.jsx(n,{message:"Footer button"}),children:e.jsx(Fs,{formPathPrefix:"settings.homepage.appearance.actions.cta3"})})]})}function du(){const{fields:s,remove:t,append:a}=Pe({name:"settings.homepage.appearance.primaryFeatures"}),[r,i]=m.useState([0]);return e.jsxs("div",{children:[e.jsx(Cs,{variant:"outline",expandedValues:r,onExpandedChange:l=>{i(l),l.length&&W().preview.setHighlight(`[data-testid="primary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(Ae,{value:o,label:e.jsx(n,{message:`Primary feature ${o+1}`}),children:[e.jsx(uu,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",onClick:()=>{t(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),onClick:()=>{a({}),i([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function uu({index:s}){const t=Ls(a=>{var r,i,l,o,c;return(c=(o=(l=(i=(r=a.defaults)==null?void 0:r.settings.homepage)==null?void 0:i.appearance)==null?void 0:l.primaryFeatures)==null?void 0:o[s])==null?void 0:c.image});return e.jsxs(e.Fragment,{children:[e.jsx(ve,{name:`settings.homepage.appearance.primaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:t,diskPrefix:"homepage"}),e.jsx(g,{name:`settings.homepage.appearance.primaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{W().preview.setHighlight(`[data-testid="primary-title-${s}"]`)}}),e.jsx(g,{name:`settings.homepage.appearance.primaryFeatures.${s}.subtitle`,label:e.jsx(n,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{W().preview.setHighlight(`[data-testid="primary-subtitle-${s}"]`)}})]})}function mu(){const{fields:s,remove:t,append:a}=Pe({name:"settings.homepage.appearance.secondaryFeatures"}),[r,i]=m.useState([0]);return e.jsxs("div",{children:[e.jsx(Cs,{variant:"outline",expandedValues:r,onExpandedChange:l=>{i(l),l.length&&W().preview.setHighlight(`[data-testid="secondary-root-${l[0]}"]`)},children:s.map((l,o)=>e.jsxs(Ae,{value:o,label:e.jsx(n,{message:`Secondary feature ${o+1}`}),children:[e.jsx(xu,{index:o}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",onClick:()=>{t(o)},children:e.jsx(n,{message:"Remove"})})})]},l.id))}),e.jsx("div",{className:"mt-20 text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),onClick:()=>{a({}),i([s.length])},children:e.jsx(n,{message:"Add feature"})})})]})}function xu({index:s}){return e.jsxs(e.Fragment,{children:[e.jsx(ve,{name:`settings.homepage.appearance.secondaryFeatures.${s}.image`,className:"mb-30",label:e.jsx(n,{message:"Image"}),defaultValue:hu(s),diskPrefix:"homepage"}),e.jsx(g,{name:`settings.homepage.appearance.secondaryFeatures.${s}.title`,label:e.jsx(n,{message:"Title"}),className:"mb-20",onFocus:()=>{W().preview.setHighlight(`[data-testid="secondary-title-${s}"]`)}}),e.jsx(g,{name:`settings.homepage.appearance.secondaryFeatures.${s}.subtitle`,label:e.jsx(n,{message:"Subtitle"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{W().preview.setHighlight(`[data-testid="secondary-subtitle-${s}"]`)}}),e.jsx(g,{name:`settings.homepage.appearance.secondaryFeatures.${s}.description`,label:e.jsx(n,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4,onFocus:()=>{W().preview.setHighlight(`[data-testid="secondary-description-${s}"]`)}})]})}function hu(s){var t,a,r;return(r=(a=(t=W().defaults)==null?void 0:t.settings.homepage)==null?void 0:a.appearance.secondaryFeatures[s])==null?void 0:r.image}const Di={preview:{defaultRoute:"dashboard",navigationRoutes:["dashboard"]},sections:{"landing-page":{label:d("Landing Page"),position:1,previewRoute:"/",routes:[{path:"landing-page",element:e.jsx(Zd,{})},{path:"landing-page/action-buttons",element:e.jsx(cu,{})},{path:"landing-page/primary-features",element:e.jsx(du,{})},{path:"landing-page/secondary-features",element:e.jsx(mu,{})}],buildBreadcrumb:s=>{const a=s.split("/").filter(i=>!!i).pop(),r=[{label:d("Landing page"),location:"landing-page"}];return a==="action-buttons"&&r.push({label:d("Action buttons"),location:"landing-page/action-buttons"}),a==="primary-features"&&r.push({label:d("Primary features"),location:"landing-page/primary-features"}),a==="secondary-features"&&r.push({label:d("Secondary features"),location:"landing-page/secondary-features"}),r}},menus:{config:{positions:["sidebar-primary","sidebar-secondary","mobile-bottom","landing-page-navbar","landing-page-footer"],availableRoutes:["/lists","/watchlist","/admin/channels","/admin/comments"]}},"seo-settings":{config:{pages:[{key:"title-page",label:d("Title page")},{key:"season-page",label:d("Season page")},{key:"episode-page",label:d("Episode page")},{key:"watch-page",label:d("Watch page")},{key:"person-page",label:d("Person page")},{key:"landing-page",label:d("Landing page")},{key:"news-article-page",label:d("News article page")}]}}}},Xa=Jl.all([xd,Di]),Ls=Yl()(Uo(Xl((s,t)=>({defaults:null,iframeWindow:null,config:Xa,setDefaults:a=>{s(r=>{r.defaults={...a}})},setIframeWindow:a=>{s(()=>({iframeWindow:a}))},preview:{navigate:a=>{var o;const r=(o=t().config)==null?void 0:o.sections[a],i=(r==null?void 0:r.previewRoute)||"/",l=t().iframeWindow;i&&Ws(l,{type:"navigate",to:i})},setValues:a=>{const r=t().iframeWindow;Ws(r,{type:"setValues",values:a})},setThemeColor:(a,r)=>{const i=t().iframeWindow;Ws(i,{type:"setThemeColor",name:a,value:r})},setActiveTheme:a=>{const r=t().iframeWindow;Ws(r,{type:"setActiveTheme",themeId:a})},setCustomCode:(a,r)=>{const i=t().iframeWindow;Ws(i,{type:"setCustomCode",mode:a,value:r})},setHighlight:a=>{s(()=>{var l;let r=null;const i=(l=t().iframeWindow)==null?void 0:l.document;i&&a&&(r=i.querySelector(a)),r&&requestAnimationFrame(()=>{r&&r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})})})}}}))));function Ws(s,t){s&&s.postMessage({source:"be-appearance-editor",...t},"*")}function W(){return Ls.getState()}function gu(){return T(s=>pu(s),{onSuccess:async()=>{await _.invalidateQueries(["admin/appearance/values"]),M(d("Changes saved"))},onError:s=>q(s)})}function pu(s){return S.post("admin/appearance",{changes:s}).then(t=>t.data)}function ju(){return Ie(["admin/appearance/values"],()=>fu(),{staleTime:1/0})}function fu(){return S.get("admin/appearance/values").then(s=>s.data)}function bu(){const{pathname:s}=fs(),{getValues:t}=I(),[a,r]=m.useState(null);return m.useEffect(()=>{var l;const[,,i]=s.split("/").filter(o=>!!o);if(i){const o=(l=W().config)==null?void 0:l.sections[i];if(o){r([{label:d("Appearance"),location:""},...o.buildBreadcrumb(s,t())]);return}}r(null)},[s,t]),!a||a.length<2?null:e.jsxs("div",{className:"flex items-center border-b h-60 flex-shrink-0",children:[e.jsx(C,{iconSize:"md",radius:"rounded-none",className:"text-muted h-full w-50 flex-shrink-0",elementType:F,to:`/admin/appearance/${a[a.length-2].location}`,children:e.jsx(Fa,{})}),e.jsxs("div",{className:"border-l p-10 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Customizing"})}),e.jsx("div",{className:"flex items-center gap-4 text-sm mt-2",children:a.map((i,l)=>{const o=a.length-1===l,c=l===0,u=e.jsx(eo,{value:i.label});return c?null:e.jsxs(m.Fragment,{children:[e.jsx("div",{className:w("whitespace-nowrap overflow-hidden overflow-ellipsis min-w-0",o&&"text-primary",o?"flex-shrink-0":"flex-auto"),children:u}),!o&&e.jsx(Dt,{className:"icon-sm text-muted flex-shrink-0"})]},l)})})]})]})}function vu(){const{isAppearanceEditorActive:s}=so(),{data:t}=ju(),{base_url:a}=xe(),r=m.useRef(null),{pathname:i}=fs();return m.useEffect(()=>{t!=null&&t.defaults&&!W().defaults&&W().setDefaults(t.defaults)},[t]),m.useEffect(()=>{r.current&&W().setIframeWindow(r.current.contentWindow)},[]),m.useEffect(()=>{const l=i.split("/")[3];W().preview.navigate(l)},[i]),s?e.jsx(Is,{to:"/admin"}):e.jsxs("div",{className:"h-screen items-center md:flex",children:[e.jsx(ts,{children:e.jsx(n,{message:"Appearance"})}),e.jsx(yu,{values:t==null?void 0:t.values}),e.jsx("div",{className:"relative h-full flex-auto",children:e.jsx("iframe",{ref:r,className:"h-full w-full max-md:hidden",src:`${a}?appearanceEditor=true`})})]})}function yu({values:s}){const t=e.jsx("div",{className:"flex h-full flex-auto items-center justify-center",children:e.jsx(ms,{isIndeterminate:!0,"aria-label":"Loading editor"})});return e.jsx(m.Fragment,{children:e.jsx("div",{className:"relative z-10 h-full w-full border-r bg shadow-lg md:w-320",children:s?e.jsx(Cu,{defaultValues:s}):t})})}function Cu({defaultValues:s}){const t=V({defaultValues:s}),{watch:a,reset:r}=t,i=gu();return m.useEffect(()=>{const l=a(o=>{W().preview.setValues(o)});return()=>l.unsubscribe()},[a]),e.jsxs(ee,{className:"flex h-full flex-col",form:t,onSubmit:l=>{i.mutate(l,{onSuccess:()=>r(l)})},children:[e.jsx(wu,{isLoading:i.isLoading}),e.jsx(bu,{}),e.jsx("div",{className:"flex-auto overflow-y-auto px-14 py-20",children:e.jsx(ye,{children:e.jsx(As,{})})})]})}function wu({isLoading:s}){const{formState:{dirtyFields:t}}=I(),a=Object.keys(t).length;return e.jsxs("div",{className:"flex h-50 flex-shrink-0 items-center border-b pr-10",children:[e.jsx(C,{border:"border-r",className:"text-muted",elementType:F,to:"..",children:e.jsx(Ee,{})}),e.jsx("div",{className:"pl-10",children:e.jsx(n,{message:"Appearance editor"})}),e.jsx(b,{variant:"flat",color:"primary",className:"ml-auto block",disabled:!a||s,type:"submit",children:a?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Saved"})})]})}function Su(){const s=xs(),{trans:t}=A(),{fields:a,append:r}=Pe({name:"settings.menus",keyName:"key"});return e.jsxs(m.Fragment,{children:[e.jsx("div",{children:a.map((i,l)=>e.jsx($e,{to:`${l}`,elementType:F,children:i.name},i.key))}),e.jsx("div",{className:"text-right",children:e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),size:"xs",onClick:()=>{const i=Sa(10);r({name:t(d("New menu :number",{values:{number:a.length+1}})),id:i,positions:[],items:[]}),s(`${a.length}`)},children:e.jsx(n,{message:"Create menu"})})})]})}function Ai({title:s=e.jsx(n,{message:"Add menu item"})}){const{data:t}=ie(["menuItemCategories"]),a=(t==null?void 0:t.menuItemCategories)||[],r=zi();return e.jsxs(K,{size:"sm",children:[e.jsx(te,{children:s}),e.jsx(X,{children:e.jsxs(Cs,{variant:"outline",children:[e.jsx(Ae,{label:e.jsx(n,{message:"Link"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(Nu,{})}),e.jsx(Ae,{label:e.jsx(n,{message:"Route"}),bodyClassName:"max-h-240 overflow-y-auto",children:e.jsx(In,{items:r})}),a.map(i=>e.jsx(Ae,{label:e.jsx(n,{message:i.name}),children:e.jsx(In,{items:i.items})},i.name))]})})]})}function Nu(){const s=V({defaultValues:{id:Sa(6),type:"link",target:"_blank"}}),{close:t}=Z();return e.jsxs(ee,{form:s,onSubmit:a=>{t(a)},children:[e.jsx(g,{required:!0,name:"label",label:e.jsx(n,{message:"Label"}),className:"mb-20"}),e.jsx(g,{required:!0,type:"url",name:"action",placeholder:"https://",label:e.jsx(n,{message:"Url"}),className:"mb-20"}),e.jsx("div",{className:"text-right",children:e.jsx(b,{type:"submit",variant:"flat",color:"primary",size:"xs",children:e.jsx(n,{message:"Add to menu"})})})]})}function In({items:s}){const{close:t}=Z();return e.jsx(sr,{children:s.map(a=>e.jsx(tr,{startIcon:e.jsx(ue,{size:"sm"}),onSelected:()=>{if(a.label){const r=a.label.split("/").pop();a.label=r?Ei(r):a.label,a.id=Sa(6)}t(a)},children:a.label},a.id))})}const Lu=E(e.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"DragIndicatorOutlined"),We=E(e.jsx("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),ku=""+new URL("dropdown-menu-c9b3bd6a.svg",import.meta.url).href;function _u(){const{menuIndex:s}=B(),t=xs(),{getValues:a}=I(),r=`settings.menus.${s}`,i=a(r);return m.useEffect(()=>{i?W().preview.setHighlight(`[data-menu-id="${i.id}"]`):t("/admin/appearance/menus")},[t,i]),i?e.jsx(Mu,{formPath:r}):null}function Mu({formPath:s}){const{site:{has_mobile_app:t}}=xe(),a=Ls(l=>{var o;return(o=l.config)==null?void 0:o.sections.menus.config}),r=m.useMemo(()=>{const l=[...a==null?void 0:a.positions];return t&&l.push("mobile-app-about"),l.map(o=>({key:o,name:o.replaceAll("-"," ")}))},[a,t]),i=Pe({name:`${s}.items`,keyName:"key"});return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"mb-30 pb-30 border-b",children:[e.jsx(g,{name:`${s}.name`,label:e.jsx(n,{message:"Menu name"}),className:"mb-20",autoFocus:!0}),e.jsx($s,{chipSize:"sm",name:`${s}.positions`,valueKey:"id",label:e.jsx(n,{message:"Menu positions"}),description:e.jsx(n,{message:"Where should this menu appear on the site"}),children:r.map(l=>e.jsx(h,{value:l.key,capitalizeFirst:!0,children:l.name},l.key))})]}),e.jsx(Iu,{fieldArray:i}),e.jsx("div",{className:"text-right",children:e.jsx(Tu,{})})]})}function Iu({fieldArray:{append:s,fields:t,move:a}}){const r=xs();return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-16 justify-between flex-shrink-0",children:[e.jsx(n,{message:"Menu items"}),e.jsxs(P,{type:"popover",placement:"right",offset:20,onClose:i=>{i&&(s({...i}),r(`items/${t.length}`))},children:[e.jsx(b,{variant:"outline",color:"primary",size:"xs",startIcon:e.jsx(ue,{}),children:e.jsx(n,{message:"Add"})}),e.jsx(Ai,{})]})]}),e.jsxs("div",{className:"mt-20 flex-shrink-0",children:[t.map((i,l)=>e.jsx(Fu,{item:i,items:t,index:l,onSortEnd:(o,c)=>{a(o,c)}},i.key)),t.length?null:e.jsx(He,{size:"xs",className:"my-40",image:e.jsx(va,{src:ku}),title:e.jsx(n,{message:"No menu items yet"}),description:e.jsx(n,{message:"Click “add“ button to start adding links, pages, routes and other items to this menu. "})})]})]})}function Tu(){const s=xs(),{menuIndex:t}=B(),{fields:a,remove:r}=Pe({name:"settings.menus",keyName:"key"});if(!t)return null;const i=a[+t];return e.jsxs(P,{type:"modal",onClose:l=>{if(l){const o=a.findIndex(c=>c.id===i.id);r(o),s("/admin/appearance/menus")}},children:[e.jsx(b,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(We,{}),children:e.jsx(n,{message:"Delete menu"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete menu"}),body:e.jsx(n,{message:"Are you sure you want to delete “:name“?",values:{name:i.name}}),confirm:e.jsx(n,{message:"Delete"})})]})}function Fu({item:s,items:t,index:a,onSortEnd:r}){const i=m.useRef(null),{sortableProps:l,dragHandleRef:o}=Rt({item:s,items:t,type:"menuEditorSortable",ref:i,onSortEnd:r,previewVariant:"liveSort"}),c=s.icon&&wa(s.icon),u=e.jsxs("div",{className:"text-muted flex items-center gap-4 text-xs",children:[c&&e.jsx(c,{size:"sm"}),"(",e.jsx(n,{message:"No label..."}),")"]});return e.jsx(m.Fragment,{children:e.jsx($e,{elementType:F,to:`items/${a}`,ref:i,...l,children:e.jsxs("div",{className:"flex items-center gap-10",children:[e.jsx(C,{ref:o,size:"sm",children:e.jsx(Lu,{className:"text-muted hover:cursor-move"})}),e.jsx("div",{children:s.label||u})]})})})}function Eu(){const{menuIndex:s,menuItemIndex:t}=B(),a=Q(),{getValues:r}=I(),i=`settings.menus.${s}.items.${t}`,l=r(i);return m.useEffect(()=>{l&&W().preview.setHighlight(`[data-menu-item-id="${l.id}"]`)},[a,l]),!l||t==null?null:e.jsx(Pu,{formPath:i})}function Pu({formPath:s}){return e.jsxs(m.Fragment,{children:[e.jsx(Fs,{formPathPrefix:s}),e.jsx("div",{className:"text-right mt-40",children:e.jsx(zu,{})})]})}function zu(){const s=Q(),{menuIndex:t,menuItemIndex:a}=B(),{fields:r,remove:i}=Pe({name:`settings.menus.${+t}.items`});if(!a)return null;const l=r[+a];return e.jsxs(P,{type:"modal",onClose:o=>{o&&a&&(i(+a),s(`/admin/appearance/menus/${t}`))},children:[e.jsx(b,{variant:"outline",color:"danger",size:"xs",startIcon:e.jsx(We,{}),children:e.jsx(n,{message:"Delete this item"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete menu item"}),body:e.jsx(n,{message:"Are you sure you want to delete “:name“?",values:{name:l.label}}),confirm:e.jsx(n,{message:"Delete"})})]})}function Du(){return e.jsxs(m.Fragment,{children:[e.jsx(Qs,{label:e.jsx(n,{message:"Favicon"}),description:e.jsx(n,{message:"This will generate different size favicons. Image should be at least 512x512 in size."}),type:"favicon"}),e.jsx(Qs,{label:e.jsx(n,{message:"Light logo"}),description:e.jsx(n,{message:"Will be used on dark backgrounds."}),type:"logo_light"}),e.jsx(Qs,{label:e.jsx(n,{message:"Dark logo"}),description:e.jsx(n,{message:"Will be used on light backgrounds. Will default to light logo if left empty."}),type:"logo_dark"}),e.jsx(Qs,{label:e.jsx(n,{message:"Mobile light logo"}),description:e.jsx(n,{message:"Will be used on light backgrounds on mobile. Will default to desktop logo if left empty."}),type:"logo_light_mobile"}),e.jsx(Qs,{label:e.jsx(n,{message:"Mobile dark logo"}),description:e.jsx(n,{message:"Will be used on dark backgrounds on mobile. Will default to desktop if left empty."}),type:"logo_dark_mobile"}),e.jsx(Au,{}),e.jsx($u,{})]})}function Qs({label:s,description:t,type:a}){const r=Ls(i=>{var l;return(l=i.defaults)==null?void 0:l.settings.branding[a]});return e.jsx(ve,{name:`settings.branding.${a}`,className:"border-b pb-30 mb-30",label:s,description:t,diskPrefix:"branding_media",defaultValue:r,onChange:()=>{W().preview.setHighlight('[data-logo="navbar"]')}})}function Au(){return e.jsx(g,{name:"appearance.env.app_name",required:!0,className:"mt-20",label:e.jsx(n,{message:"Site name"})})}function $u(){return e.jsx(g,{name:"settings.branding.site_description",className:"mt-20",inputElementType:"textarea",rows:4,label:e.jsx(n,{message:"Site description"})})}function Ru(s=1,t=1e4){const a=new Uint32Array(1);window.crypto.getRandomValues(a);const r=a[0]/(4294967295+1);return s=Math.ceil(s),t=Math.floor(t),Math.floor(r*(t-s+1))+s}function Vu(){const{trans:s}=A(),t=xs(),{data:{themes:a}}=nr(),{fields:r,append:i}=Pe({name:"appearance.themes.all",keyName:"key"});return m.useEffect(()=>{a.selectedThemeId&&W().preview.setActiveTheme(a.selectedThemeId)},[a.selectedThemeId]),e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-20",children:e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),onClick:()=>{var o;const l=(o=W().defaults)==null?void 0:o.appearance.themes.light;i({id:Ru(),name:s(d("New theme")),colors:l}),t(`${r.length+1}`)},children:e.jsx(n,{message:"New theme"})})}),r.map((l,o)=>e.jsx($e,{to:`${o}`,elementType:Ft,children:l.name},l.key))]})}const Ou=U.lazy(()=>us(()=>import("./ace-editor-b44074c3.js"),["./ace-editor-b44074c3.js","./main-a8767cd0.js","./main-f9578bdd.css","./index-f3ff7ee6.js"],import.meta.url));function en({defaultValue:s,mode:t="html",title:a,onSave:r,isSaving:i,footerStartAction:l,beautify:o,editorRef:c}){const[u,x]=m.useState(s),[p,j]=m.useState(!0);return e.jsxs(K,{size:"fullscreen",className:"h-full w-full",children:[e.jsx(te,{children:a}),e.jsx(X,{className:"relative flex-auto",padding:"p-0",children:e.jsx(m.Suspense,{fallback:e.jsx("div",{className:"flex h-400 w-full items-center justify-center",children:e.jsx(ms,{"aria-label":"Loading editor...",isIndeterminate:!0,size:"md"})}),children:e.jsx(Ou,{beautify:o,mode:t,onChange:v=>x(v),defaultValue:u||"",onIsValidChange:j,editorRef:c})})}),e.jsx(Uu,{disabled:!p||i,value:u,onSave:r,startAction:l})]})}function Uu({disabled:s,value:t,onSave:a,startAction:r}){const{close:i}=Z();return e.jsxs(ne,{dividerTop:!0,startAction:r,children:[e.jsx(b,{onClick:()=>i(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{disabled:s,variant:"flat",color:"primary",onClick:()=>{a?a(t):i(t)},children:e.jsx(n,{message:"Save"})})]})}function $i(s){return Ie(["admin","seo-tags",s],()=>Bu(s))}function Bu(s){return S.get(`admin/appearance/seo-tags/${s}`).then(t=>t.data)}function qu(s){const t=Na();return T(a=>Hu(s,a.tags),{onSuccess:async()=>{await t.invalidateQueries(["admin","seo-tags",s]),M(d("Updated SEO tags"))},onError:a=>q(a)})}function Hu(s,t){return S.put(`admin/appearance/seo-tags/${s}`,{tags:t}).then(a=>a.data)}var Jn;const Ri=((Jn=Xa.sections["seo-settings"].config)==null?void 0:Jn.pages)||[],Vi=Ri.map(s=>s.key);function Zu(){const{isLoading:s}=$i(Vi);return s?e.jsx(Ce,{}):e.jsx(m.Fragment,{children:Ri.map(t=>e.jsx(Wu,{label:t.label,name:t.key},t.key))})}function Wu({label:s,name:t}){const{data:a,isLoading:r}=$i(Vi);return e.jsxs(P,{type:"modal",children:[e.jsx($e,{disabled:r,children:e.jsx(n,{...s})}),a?e.jsx(Qu,{name:t,value:a[t]}):null]})}function Qu({name:s,value:t}){const{close:a}=Z(),r=qu(s),i=m.useRef(null),l=e.jsx(b,{variant:"outline",color:"primary",onClick:()=>{i.current&&i.current.editor.setValue(t.original)},children:e.jsx(n,{message:"Reset to original"})});return e.jsx(en,{mode:"php_laravel_blade",title:e.jsx(n,{message:"Edit SEO meta tags"}),footerStartAction:l,editorRef:i,defaultValue:t.custom||t.original,isSaving:r.isLoading,beautify:!1,onSave:o=>{o!=null&&r.mutate({tags:o},{onSuccess:()=>a()})}})}function Gu(){return e.jsxs(m.Fragment,{children:[e.jsx(Tn,{mode:"css"}),e.jsx(Tn,{mode:"html"})]})}function Tn({mode:s}){const{getValues:t}=I(),{setValue:a}=I(),r=s==="html"?e.jsx(n,{message:"Custom HTML & JavaScript"}):e.jsx(n,{message:"Custom CSS"});return e.jsxs(P,{type:"modal",onClose:i=>{i!=null&&(a(`appearance.custom_code.${s}`,i,{shouldDirty:!0}),W().preview.setCustomCode(s,i))},children:[e.jsx($e,{children:r}),e.jsx(en,{title:r,defaultValue:t(`appearance.custom_code.${s}`)||"",mode:s})]})}const Ku=""+new URL("articles-8bfd9f17.svg",import.meta.url).href,ks="user",Ju=s=>{const t=s.customPages.types.length>1?[{control:{type:H.Select,defaultValue:"default",options:s.customPages.types.map(a=>({value:a.type,label:a.label,key:a.type}))},key:"type",label:d("Type"),description:d("Type of the page"),defaultOperator:O.eq}]:[];return[{key:"user_id",label:d("User"),description:d("User page was created by"),defaultOperator:O.eq,control:{type:H.SelectModel,model:ks}},...t,Se({description:d("Date page was created")}),Ne({description:d("Date page was last updated")})]},Yu=[{key:"slug",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Slug"}),body:s=>e.jsx(F,{target:"_blank",to:`/pages/${s.slug}`,className:it,children:s.slug})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(n,{message:"Owner"}),body:s=>s.user&&e.jsx(ys,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"type",maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx(n,{message:s.type})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/edit`,children:e.jsx(de,{})})}];function Xu(){const s=m.useContext(Ze),t=m.useMemo(()=>Ju(s),[s]);return e.jsx(fe,{endpoint:"custom-pages",title:e.jsx(n,{message:"Custom pages"}),filters:t,columns:Yu,queryParams:{with:"user"},actions:e.jsx(em,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:Ku,title:e.jsx(n,{message:"No pages have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching pages"})})})}function em(){return e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"New page"})})}const sm=[{label:d("Local search"),to:"search"},{label:d("Content"),to:"content"},{label:d("Videos"),to:"videos"}],Oi=[{label:d("General"),to:"general"},...sm,{label:d("Subscriptions"),to:"subscriptions"},{label:d("Localization"),to:"localization"},{label:d("Authentication"),to:"authentication"},{label:d("Uploading"),to:"uploading"},{label:d("Mail"),to:"mail"},{label:d("Cache"),to:"cache"},{label:d("Analytics"),to:"analytics"},{label:d("Logging"),to:"logging"},{label:d("Queue"),to:"queue"},{label:d("Recaptcha"),to:"recaptcha"},{label:d("GDPR"),to:"gdpr"},{label:d("Menus"),to:"/admin/appearance/menus"},{label:d("Seo"),to:"/admin/appearance/seo-settings"},{label:d("Themes"),to:"/admin/appearance/themes"}];function tm({className:s}){const t=Fe();return e.jsxs("div",{className:w(s,"md:flex gap-30 min-h-full items-start p-24 container mx-auto"),children:[e.jsx(ts,{children:e.jsx(n,{message:"Settings"})}),t?e.jsx(am,{}):e.jsx(nm,{}),e.jsx("div",{className:"md:px-30 flex-auto relative max-w-500",children:e.jsx(As,{})})]})}function am(){const{pathname:s}=fs(),t=xs(),a=s.split("/").pop();return e.jsx(os,{minWidth:"min-w-none",className:"w-full bg-paper mb-24",selectionMode:"single",selectedValue:a,onSelectionChange:r=>{t(r)},children:Oi.map(r=>e.jsx(h,{value:r.to,children:e.jsx(n,{...r.label})},r.to))})}function nm(){return e.jsx("div",{className:"w-240 sticky top-24 flex-shrink-0",children:Oi.map(s=>e.jsx(Ft,{to:s.to,className:({isActive:t})=>w("block p-14 whitespace-nowrap mb-8 rounded border-l-4 text-sm transition-bg-color",t?"bg-primary/selected border-l-primary font-medium":"border-l-transparent hover:bg-hover"),children:e.jsx(n,{...s.label})},s.to))})}function dt(){return Ie(["fetchAdminSettings"],()=>rm(),{staleTime:1/0})}function rm(){return S.get("settings").then(s=>s.data)}function im(){return S.post("sitemap/generate").then(s=>s.data)}function lm(){return T(()=>im(),{onSuccess:()=>{M(d("Sitemap generated"))},onError:s=>q(s)})}const ea=s=>s instanceof Date,om=s=>Object.keys(s).length===0,ga=s=>s!=null&&typeof s=="object",Fn=(s,...t)=>Object.prototype.hasOwnProperty.call(s,...t),sa=s=>ga(s)&&om(s),cm=()=>Object.create(null),pa=(s,t)=>{if(s===t)return{};if(!ga(s)||!ga(t))return t;const a=Object.keys(s).reduce((r,i)=>(Fn(t,i)||(r[i]=void 0),r),cm());return ea(s)||ea(t)?s.valueOf()==t.valueOf()?{}:t:Object.keys(t).reduce((r,i)=>{if(!Fn(s,i))return r[i]=t[i],r;const l=pa(s[i],t[i]);return sa(l)&&!ea(l)&&(sa(s[i])||!sa(t[i]))||(r[i]=l),r},a)};function Ui(s){const{data:t}=dt();return T(a=>{var l,o,c,u,x,p;(o=(l=a.client)==null?void 0:l.cookie_notice)!=null&&o.button&&(a.client.cookie_notice.button=JSON.stringify(a.client.cookie_notice.button)),(u=(c=a.client)==null?void 0:c.registration)!=null&&u.policies&&(a.client.registration.policies=JSON.stringify(a.client.registration.policies)),(p=(x=a.client)==null?void 0:x.artistPage)!=null&&p.tabs&&(a.client.artistPage.tabs=JSON.stringify(a.client.artistPage.tabs));const r=a.client?pa(t.client,a.client):null,i=a.server?pa(t.server,a.server):null;return dm({client:r,server:i,files:a.files})},{onSuccess:()=>{M(d("Settings updated"),{position:"bottom-right"}),_.invalidateQueries(["fetchAdminSettings"])},onError:a=>J(a,s)})}function dm({client:s,server:t,files:a}){const r=new FormData;return s&&r.set("client",JSON.stringify(wn.dot(s))),t&&r.set("server",JSON.stringify(wn.dot(t))),Object.entries(a||{}).forEach(([i,l])=>{r.set(i,l)}),S.post("settings",r,{headers:{"Content-Type":"multipart/form-data"}}).then(i=>i.data)}function be({title:s,description:t,children:a}){const{data:r}=dt();return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-40",children:[e.jsx("h2",{className:"text-xl mb-4",children:s}),e.jsx("div",{className:"text-sm text-muted",children:t})]}),r?e.jsx(um,{defaultValues:r,children:a}):e.jsx(ms,{isIndeterminate:!0,"aria-label":"Loading settings..."})]})}function um({children:s,defaultValues:t}){const a=V({defaultValues:t}),r=Ui(a);return e.jsxs(m.Fragment,{children:[e.jsxs(ee,{form:a,onBeforeSubmit:()=>{const i=a.formState.errors,l=Object.keys(i).filter(o=>o.endsWith("_group"));a.clearErrors(l)},onSubmit:i=>{r.mutate(i)},children:[s,e.jsx("div",{className:"mt-40",children:e.jsx(b,{type:"submit",variant:"flat",color:"primary",disabled:r.isLoading,children:e.jsx(n,{message:"Update"})})})]}),r.isLoading&&e.jsx(It,{size:"xs",className:"absolute -bottom-14 left-30 w-full",isIndeterminate:!0,"aria-label":"Saving settings..."})]})}function Ue(){return e.jsx("div",{className:"h-1 bg-divider my-30"})}const sn=E(e.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z"}),"LinkOutlined");function Os({link:s,className:t}){const{site:a}=xe();return a.hide_docs_button?null:e.jsxs("div",{className:w("flex items-center gap-8",t),children:[e.jsx(sn,{size:"sm"}),e.jsx(Et,{href:s,children:e.jsx(n,{message:"Learn more"})})]})}function mm(){return e.jsxs(be,{title:e.jsx(n,{message:"General"}),description:e.jsx(n,{message:"Configure site url, homepage, theme and other general settings."}),children:[e.jsx(xm,{}),e.jsx(Ue,{}),e.jsx(hm,{}),e.jsx(Ue,{}),e.jsx(gm,{}),e.jsx(Ue,{}),e.jsx(pm,{})]})}function xm(){const{data:s}=dt();if(!s)return null;let t=null;const a=s.server,r=a.newAppUrl&&a.newAppUrl!==a.app_url;return r&&(t=e.jsx("div",{className:"text-sm text-danger mt-20",children:e.jsx(n,{values:{baseUrl:a.app_url,currentUrl:a.newAppUrl,b:i=>e.jsx("b",{children:i})},message:"Base site url is set as <b>:baseUrl</b> in configuration, but current url is <b>:currentUrl</b>. It is recommended to set the primary url you want to use in configuration file and then redirect all other url versions to this primary version via cpanel or .htaccess file."})})),e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:!!r,name:"server.app_url",label:e.jsx(n,{message:"Primary site url"}),description:e.jsx(Os,{link:"https://support.vebto.com/help-center/articles/35/primary-site-url"})}),t]})}function hm(){var i,l;const{watch:s}=I(),{homepage:t}=m.useContext(Ze),{data:a}=ie(["menuItemCategories"]),r=s("client.homepage.type");return e.jsxs("div",{children:[e.jsxs(D,{name:"client.homepage.type",selectionMode:"single",label:e.jsx(n,{message:"Site home page"}),description:e.jsx(n,{message:"Which page should be used as site homepage."}),children:[t.options.map(o=>e.jsx(h,{value:o.value,children:e.jsx(n,{...o.label})},o.value)),(i=a==null?void 0:a.menuItemCategories)==null?void 0:i.map(o=>e.jsx(h,{value:o.type,children:o.name},o.type))]}),(l=a==null?void 0:a.menuItemCategories)==null?void 0:l.map(o=>r===o.type?e.jsx(D,{className:"mt-24",name:"client.homepage.value",selectionMode:"single",label:e.jsx(n,{message:"Homepage :name",values:{name:o.name}}),children:o.items.map(c=>e.jsx(h,{value:c.model_id,children:c.label},c.label))},o.name):null)]})}function gm(){const{data:{themes:s}}=nr();return e.jsxs(m.Fragment,{children:[e.jsxs(D,{className:"mb-20",name:"client.themes.default_id",selectionMode:"single",label:e.jsx(n,{message:"Default site theme"}),description:e.jsx(n,{message:"Which theme to use for users that have not chosen a theme manually."}),children:[e.jsx(h,{value:0,children:e.jsx(n,{message:"System"})}),s.all.map(t=>e.jsx(h,{value:t.id,children:t.name},t.id))]}),e.jsx($,{name:"client.themes.user_change",description:e.jsx(n,{message:"Allow users to manually change site theme."}),children:e.jsx(n,{message:"Allow theme change"})})]})}function pm(){const s=lm(),{base_url:t}=xe(),a=`${t}/storage/sitemaps/sitemap-index.xml`,r=e.jsx(Et,{href:a,children:a});return e.jsxs(e.Fragment,{children:[e.jsx(b,{variant:"outline",size:"xs",color:"primary",disabled:s.isLoading,onClick:()=>{s.mutate()},children:e.jsx(n,{message:"Generate sitemap"})}),e.jsx("div",{className:"text-sm text-muted mt-14",children:e.jsx(n,{message:"Once generated, sitemap url will be: :url",values:{url:r}})})]})}function jm(s){return Ns(s).toString("rgb").replace("rgb(","").replace(")","").replace(/, ?/g," ")}function ja(s){try{return Ns(`rgb(${s.split(" ").join(",")})`).toString("hex")}catch{return s}}function fm(){const{getValues:s,setValue:t}=I(),{themeIndex:a}=B(),r=s(`appearance.themes.all.${+a}`);return e.jsxs(P,{type:"modal",onClose:i=>{i&&s("appearance.themes.all").forEach((l,o)=>{if(l.id===i.id){t(`appearance.themes.all.${o}`,i,{shouldDirty:!0});return}if(i.default_light){t(`appearance.themes.all.${o}`,{...l,default_light:!1},{shouldDirty:!0});return}if(i.default_dark){t(`appearance.themes.all.${o}`,{...l,default_dark:!1},{shouldDirty:!0});return}})},children:[e.jsx(b,{size:"xs",variant:"outline",color:"primary",startIcon:e.jsx(gr,{}),children:e.jsx(n,{message:"Settings"})}),e.jsx(bm,{theme:r})]})}function bm({theme:s}){const t=V({defaultValues:s}),{close:a,formId:r}=Z();return m.useEffect(()=>{const i=t.watch((l,{name:o})=>{o==="default_light"&&l.default_light&&t.setValue("default_dark",!1),o==="default_dark"&&l.default_dark&&t.setValue("default_light",!1)});return()=>i.unsubscribe()},[t]),e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Update settings"})}),e.jsx(X,{children:e.jsxs(ee,{form:t,id:r,onSubmit:i=>{a(i)},children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",autoFocus:!0}),e.jsx($,{name:"is_dark",className:"mb-20 pb-20 border-b",description:e.jsx(n,{message:"Whether this theme has light text on dark background."}),children:e.jsx(n,{message:"Dark theme"})}),e.jsx($,{name:"default_light",className:"mb-30",description:e.jsx(n,{message:"When light mode is selected, this theme will be used."}),children:e.jsx(n,{message:"Default for light mode"})}),e.jsx($,{name:"default_dark",description:e.jsx(n,{message:"When dark mode is selected, this theme will be used."}),children:e.jsx(n,{message:"Default for dark mode"})})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{a()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:r,disabled:!t.formState.isDirty,children:e.jsx(n,{message:"Save"})})]})]})}const Bi=E(e.jsx("path",{d:"M6 13c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91zm14 0c0-4.42-3.58-8-8-8-.06 0-.12.01-.18.01l1.09-1.09L11.5 2.5 8 6l3.5 3.5 1.41-1.41-1.08-1.08c.06 0 .12-.01.17-.01 3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93z"}),"RestartAltOutlined");function vm(){const s=Q(),{themeIndex:t}=B(),[a,r]=m.useState(!1),{setValue:i,getValues:l}=I(),{fields:o,remove:c}=Pe({name:"appearance.themes.all"}),u=()=>{if(o.length<=1){M.danger(d("At least one theme is required"));return}t&&(s("/admin/appearance/themes"),c(+t),i("appearance.themes.selectedThemeId",null))};return e.jsxs(m.Fragment,{children:[e.jsxs(bs,{onItemSelected:x=>{if(x==="delete")r(!0);else if(x==="reset"){const p=`appearance.themes.all.${+t}`,j=l(`${p}.is_dark`)?W().defaults.appearance.themes.dark:W().defaults.appearance.themes.light;Object.entries(j).forEach(([v,f])=>{W().preview.setThemeColor(v,f)}),i(`${p}.colors`,j,{shouldDirty:!0})}},children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(pr,{})}),e.jsxs(vs,{children:[e.jsx(h,{value:"reset",startIcon:e.jsx(Bi,{}),children:e.jsx(n,{message:"Reset colors"})}),e.jsx(h,{value:"delete",startIcon:e.jsx(We,{}),children:e.jsx(n,{message:"Delete"})})]})]}),e.jsx(P,{type:"modal",isOpen:a,onClose:x=>{x&&u(),r(!1)},children:e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete theme"}),body:e.jsx(n,{message:"Are you sure you want to delete this theme?"}),confirm:e.jsx(n,{message:"Delete"})})})]})}function ym(){const s=xs(),{themeIndex:t}=B(),{getValues:a}=I(),r=a(`appearance.themes.all.${+t}`);return m.useEffect(()=>{r||s("/admin/appearance/themes")},[s,r]),m.useEffect(()=>{r!=null&&r.id&&W().preview.setActiveTheme(r.id)},[r==null?void 0:r.id]),r?e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"mb-20 flex items-center gap-10 justify-between",children:[e.jsx(fm,{}),e.jsx(vm,{})]}),e.jsx("div",{children:Object.entries(r.colors).filter(([i])=>!i.endsWith("opacity")).map(([i,l])=>e.jsx(Cm,{colorName:i,initialThemeValue:l,theme:r},i))})]}):null}function Cm({theme:s,colorName:t,initialThemeValue:a}){const{setValue:r}=I(),{themeIndex:i}=B(),[l,o]=m.useState(a),c=x=>{o(x),W().preview.setThemeColor(t,x)};m.useEffect(()=>{o(a)},[a]);const u=ja(a);return e.jsxs(P,{currentValue:u,type:"popover",placement:"right",offset:10,onClose:x=>{x&&x!==u?(r(`appearance.themes.all.${+i}.colors.${t}`,l,{shouldDirty:!0}),r("appearance.themes.selectedThemeId",s.id)):c(a)},children:[e.jsx($e,{className:"capitalize",startIcon:e.jsx(Wr,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:`rgb(${l})`}}),children:t.replace("--be-","").replace("-"," ")}),e.jsx(Ka,{defaultValue:u,onChange:x=>{c(jm(x))}})]})}function Nt({children:s,...t}){const{field:{onChange:a,onBlur:r,value:i=[],ref:l},fieldState:{invalid:o,error:c}}=cs({name:t.name}),u=m.useMemo(()=>{const p=i;return typeof p=="string"?JSON.parse(p):p},[i]),x={onChange:p=>{const j=JSON.stringify(p.map(v=>v.name));a(j)},onBlur:r,value:u,invalid:o,errorMessage:c==null?void 0:c.message};return e.jsx(Bo,{ref:l,...ds(x,t)})}function wm(){const{trans:s}=A();return e.jsxs(be,{title:e.jsx(n,{message:"Video and streaming"}),description:e.jsx(n,{message:"Control how videos are played and displayed on the site."}),children:[e.jsx(Nm,{}),e.jsx(Sm,{}),e.jsx($,{className:"mb-24",name:"client.streaming.prefer_full",description:e.jsx(n,{message:'When user clicks on "play" buttons across the site play full movie or episode instead of trailers and clips.'}),children:e.jsx(n,{message:"Prefer full videos"})}),e.jsx($,{className:"mb-24",name:"client.streaming.show_video_selector",description:e.jsx(n,{message:"Show alternative videos on the watch page."}),children:e.jsx(n,{message:"Alternative videos"})}),e.jsx($,{className:"mb-24",name:"client.streaming.show_header_play",description:e.jsx(n,{message:"Whether play button should be shown on main title header."}),children:e.jsx(n,{message:"Header play button"})}),e.jsx(Nt,{className:"mb-24",label:e.jsx(n,{message:"Possible video qualities"}),name:"client.streaming.qualities",placeholder:s({message:"Add another..."})})]})}function Sm(){return e.jsxs(D,{className:"mb-24",name:"client.streaming.default_sort",label:e.jsx(n,{message:"Video sorting"}),selectionMode:"single",description:e.jsx(n,{message:"When multiple videos are shown on the page, how should they be sorted by default."}),children:[e.jsx(h,{value:"order:asc",children:e.jsx(n,{message:"Manual (order assigned manually in admin area)"})}),e.jsx(h,{value:"created_at:desc",children:e.jsx(n,{message:"Date added"})}),e.jsx(h,{value:"name:asc",children:e.jsx(n,{message:"Name (a-z)"})}),e.jsx(h,{value:"Language:asc",children:e.jsx(n,{message:"Language (a-z)"})}),e.jsx(h,{value:"reports:asc",children:e.jsx(n,{message:"Reports (videos with less reports first)"})}),e.jsx(h,{value:"score:desc",children:e.jsx(n,{message:"Score (most liked videos first)"})})]})}function Nm(){const{watch:s}=I();return s("client.titles.video_panel_mode")==="hide"?null:e.jsxs(D,{className:"mb-24",name:"client.streaming.video_panel_content",label:e.jsx(n,{message:"Shown videos"}),selectionMode:"single",description:e.jsx(n,{message:"What type of videos should be shown in title and episode pages (if there is more then one video attached)."}),children:[e.jsx(h,{value:"all",children:e.jsx(n,{message:"All videos"})}),e.jsx(h,{value:"full",children:e.jsx(n,{message:"Full movies and episodes"})}),e.jsx(h,{value:"short",children:e.jsx(n,{message:"Short videos (everything except full movies & episodes)"})}),e.jsx(h,{value:"trailer",children:e.jsx(n,{message:"Trailers"})}),e.jsx(h,{value:"clip",children:e.jsx(n,{message:"Clips"})})]})}function qt({children:s,className:t}){const{selectedTab:a,isLazy:r}=m.useContext(jr),i=m.Children.toArray(s).filter(o=>!!o);let l;if(r){const o=i[a];l=m.isValidElement(o)?m.cloneElement(i[a],{index:a}):null}else l=i.map((o,c)=>{if(m.isValidElement(o)){const u=c===a;return m.cloneElement(o,{index:c,"aria-hidden":!u,className:u?o.props.className:w(o.props.className,"hidden")})}return null});return e.jsx("div",{className:t,children:l})}function Xe({className:s,children:t,index:a,...r}){const{id:i}=m.useContext(jr),[l,o]=m.useState(0),c=m.useRef(null);return to(()=>{if(c!=null&&c.current){const u=()=>{const p=ao(c.current,{tabbable:!0});o(p.nextNode()?void 0:0)};u();const x=new MutationObserver(u);return x.observe(c.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{x.disconnect()}}},[c]),e.jsx("div",{tabIndex:l,ref:c,id:`${i}-${a}-tabpanel`,"aria-labelledby":`${i}-${a}-tab`,className:w(s,"focus-visible:outline-primary-light"),role:"tabpanel",...r,children:t})}function Lm(){const{watch:s}=I();return e.jsxs(m.Fragment,{children:[e.jsx(km,{}),e.jsx($,{className:"mb-24",name:"client.titles.enable_reviews",description:e.jsx(n,{message:"Enable or disable all review functionality across the site."}),children:e.jsx(n,{message:"Enable reviews"})}),e.jsx($,{className:"mb-24",name:"client.titles.enable_comments",description:e.jsx(n,{message:"Enable or disable all comment functionality across the site."}),children:e.jsx(n,{message:"Enable comments"})}),s("client.titles.enable_comments")&&e.jsx($,{name:"client.comments.per_video",description:e.jsx(n,{message:"When enabled, individual videos will have their own separate comment section (if there are multiple videos), otherwise comments will be shared by all videos for the same title."}),children:e.jsx(n,{message:"Per video comments"})})]})}function km(){return e.jsxs(D,{className:"mb-24",name:"server.rating_column",label:e.jsx(n,{message:"Rating used for sorting"}),selectionMode:"single",description:e.jsx(n,{message:`When ordering titles by rating, should local user rating or TheMovieDB rating average be
            used.`}),children:[e.jsx(h,{value:"tmdb_vote_average",children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local_vote_average",children:e.jsx(n,{message:"Local (Ratings and reviews from site users)"})})]})}function pe({children:s,name:t,separatorBottom:a=!0,separatorTop:r=!0}){const{formState:{errors:i}}=I(),l=m.useRef(null),o=i[t];return m.useEffect(()=>{var c;o&&((c=l.current)==null||c.scrollIntoView({behavior:"smooth"}))},[o]),e.jsxs("div",{className:w(a&&"border-b mb-20 pb-20",r&&"border-t mt-20 pt-20",o&&"border-y-error"),ref:l,children:[s(!!o),o&&e.jsx("div",{className:"text-danger text-sm mt-20",dangerouslySetInnerHTML:{__html:o.message}})]})}function _m(){const{watch:s}=I();return e.jsxs(m.Fragment,{children:[e.jsx(Mm,{}),e.jsx($,{className:"mb-24",name:"client.content.title_provider",value:"tmdb",description:e.jsx(n,{message:"This will automatically import, and periodically update, all metadata available on TheMovieDB about the title when user visits that title's page."}),children:e.jsx(n,{message:"Title automation"})}),e.jsx($,{className:"mb-24",name:"client.content.force_season_update",value:"tmdb",description:e.jsx(n,{message:"When this is enabled, season episodes will be automatically updated, even if title automation is disabled."}),children:e.jsx(n,{message:"Always update seasons"})}),e.jsx(Ue,{}),e.jsx($,{className:"mb-24",name:"client.content.people_provider",value:"tmdb",description:e.jsx(n,{message:"This will automatically import, and periodically update, all metadata available on TheMovieDB about a person, when user visits that person's page."}),children:e.jsx(n,{message:"People automation"})}),s("client.content.people_provider")==="tmdb"&&e.jsx($,{className:"mb-24",name:"client.content.automate_filmography",description:e.jsx(n,{message:"Whether full filmograpy for a person should be imported from TheMovieDB when auto updating the person metadata."}),children:e.jsx(n,{message:"Full filmography"})}),e.jsx(Im,{})]})}function Mm(){return e.jsxs(D,{className:"mb-24",name:"client.content.search_provider",selectionMode:"single",label:e.jsx(n,{message:"Search method"}),description:e.jsx(n,{message:"Which method should be used for user facing search on the site."}),children:[e.jsx(h,{value:"tmdb",description:e.jsx(n,{message:"Search on the site will directly connect to, and search TheMovieDB. Any movie, series and artist available on TheMovieDB will be discoverable via search, without needing to import or create it first."}),children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local",description:e.jsx(n,{message:"Will only search content that was created or imported from admin area. This can be further configured from 'Local search' settings page."}),children:e.jsx(n,{message:"Local"})}),e.jsx(h,{value:"all",description:e.jsx(n,{message:"Will combine search results from both 'Local' and 'TheMovieDB' methods. If there are identical matches, local results will be preferred."}),children:e.jsx(n,{message:"Local and TheMovieDB"})})]})}function Im(){const{data:s}=ie(["tmdbLanguages"]),{watch:t}=I();return[t("client.content.people_provider"),t("client.content.title_provider"),t("client.content.search_provider")].some(r=>`${r}`.toLowerCase().includes("tmdb"))?e.jsx(pe,{name:"tmdb_group",separatorBottom:!1,children:r=>e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:r,name:"server.tmdb_api_key",label:e.jsx(n,{message:"TheMovieDB API Key"}),className:"mb-24",required:!0}),e.jsx(D,{className:"mb-24",selectionMode:"single",showSearchField:!0,invalid:r,name:"client.tmdb.language",label:e.jsx(n,{message:"TheMovieDB language"}),description:e.jsx(n,{message:"In what language should content be fetched from TMDb. If translation is not available data will default to english."}),children:s==null?void 0:s.tmdbLanguages.map(({code:i,name:l})=>e.jsx(h,{value:i,children:l},i))}),e.jsx($,{name:"client.tmdb.includeAdult",children:e.jsx(n,{message:"Import adult content"})})]})}):null}const Tm=[{name:"episodes",title:{message:"Episode grid"}},{name:"seasons",title:{message:"Season grid"}},{name:"videos",title:{message:"Video grid"}},{name:"images",title:{message:"Image grid"}},{name:"reviews",title:{message:"Reviews"}},{name:"cast",title:{message:"Cast grid"}},{name:"related",title:{message:"Related titles"}}];function Fm(){const{getValues:s,setValue:t}=I(),a=()=>{const l=s("client.title_page.sections");return l?JSON.parse(l):[]},[r,i]=m.useState(()=>{const l=a(),o=c=>l.includes(c)?l.indexOf(c):l.length;return[...Tm].sort((c,u)=>o(c.name)-o(u.name))});return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-14 text-sm",children:[e.jsx(n,{message:"Title page sections"}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Select which sections should appear on title page and in which order."})})]}),r.map((l,o)=>e.jsx(Em,{items:r,isFirst:o===0,section:l,title:e.jsx(n,{...l.title}),onToggle:(c,u)=>{const x=a(),p=u?[...x,c.name]:x.filter(j=>j!==c.name);t("client.title_page.sections",JSON.stringify(p))},onSortEnd:(c,u)=>{const x=fr(r,c,u);i(x);const p=a(),j=x.filter(v=>p.includes(v.name)).map(v=>v.name);t("client.title_page.sections",JSON.stringify(j))}},l.name))]})}function Em({isFirst:s,title:t,items:a,section:r,onSortEnd:i,onToggle:l}){const o=m.useRef(null),c=m.useRef(null),{watch:u}=I(),x=u("client.title_page.sections"),j=(x?JSON.parse(x):[]).includes(r.name),{sortableProps:v,dragHandleRef:f}=Rt({ref:o,item:r,items:a,type:"titlePageSections",preview:c,previewVariant:"line",onSortEnd:i});return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:w("flex w-full items-center gap-8 border-b py-6",s&&"border-t border-t-transparent"),ref:o,...v,children:[e.jsx(C,{ref:f,children:e.jsx(za,{})}),e.jsx("div",{className:"flex-auto",children:e.jsx("div",{className:"text-sm",children:t})}),e.jsx(La,{checked:j,onChange:k=>{l(r,k.target.checked)}})]}),e.jsx(Pm,{title:t,ref:c})]})}const Pm=U.forwardRef(({title:s},t)=>e.jsx(Pa,{ref:t,children:()=>e.jsx("div",{className:"rounded bg-chip p-8 text-sm shadow",children:s})}));function zm(){return e.jsx(be,{title:e.jsx(n,{message:"Content"}),description:e.jsx(n,{message:"Control how content is displayed across the site."}),children:e.jsxs(ws,{children:[e.jsxs(Ss,{children:[e.jsx(Me,{width:"min-w-132",children:e.jsx(n,{message:"General"})}),e.jsx(Me,{width:"min-w-132",children:e.jsx(n,{message:"Automation"})}),e.jsx(Me,{width:"min-w-132",children:e.jsx(n,{message:"Title page"})})]}),e.jsxs(qt,{className:"pt-24",children:[e.jsx(Xe,{children:e.jsx(Lm,{})}),e.jsx(Xe,{children:e.jsx(_m,{})}),e.jsx(Xe,{children:e.jsx(Fm,{})})]})]})})}function Be({title:s,description:t,actions:a,color:r="primary",className:i}){return e.jsxs("div",{className:w(i,"p-10 rounded",r==="positive"&&"bg-positive/focus border-l-positive border-l-4",r==="warning"&&"bg-warning/focus border-l-warning border-l-4",r==="danger"&&"bg-danger/focus border-l-danger border-l-4",r==="primary"&&"bg-primary/focus border-l-primary border-l-4",r==="neutral"&&"bg-paper border"),children:[s&&e.jsx("div",{className:"text-sm mb-4 font-medium",children:s}),t&&e.jsx("div",{className:"text-sm",children:t}),a&&e.jsx("div",{className:"mt-14",children:a})]})}function Dm(){return Ie(["search-models"],()=>Am())}function Am(){return S.get("admin/search/models").then(s=>s.data)}function $m(){const{trans:s}=A();return T(t=>Rm(t),{onSuccess:()=>{M(s(d("Imported search models")))},onError:t=>q(t)})}function Rm(s){return S.post("admin/search/import",s).then(t=>t.data)}function Vm(){return e.jsxs(be,{title:e.jsx(n,{message:"Search"}),description:e.jsx(n,{message:"Configure search method used on the site as well as related 3rd party integrations."}),children:[e.jsx(Om,{}),e.jsx(Zm,{})]})}function Om(){const{watch:s}=I(),t=s("server.scout_driver");return e.jsx(pe,{name:"search_group",separatorBottom:!1,children:a=>e.jsxs(m.Fragment,{children:[e.jsxs(D,{invalid:a,name:"server.scout_driver",selectionMode:"single",label:e.jsx(n,{message:"Search method"}),description:e.jsx(n,{message:"Which method should be used for search related functionality across the site."}),children:[e.jsx(h,{value:"mysql",children:"Mysql"}),e.jsx(h,{value:"meilisearch",children:"Meilisearch"}),e.jsx(h,{value:"tntsearch",children:"TNTSearch"}),e.jsx(h,{value:"Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine",children:"Elasticsearch"}),e.jsx(h,{value:"algolia",children:"Algolia"})]}),t==="mysql"&&e.jsx(Um,{}),t==="meilisearch"&&e.jsx(Bm,{}),t==="algolia"&&e.jsx(Hm,{}),t==="Matchish\\ScoutElasticSearch\\Engines\\ElasticSearchEngine"&&e.jsx(qm,{})]})})}function Um(){const{clearErrors:s}=I();return e.jsxs(D,{className:"mt-24",name:"server.scout_mysql_mode",selectionMode:"single",label:e.jsx(n,{message:"MySQL mode"}),onSelectionChange:()=>{s()},children:[e.jsx(h,{value:"basic",children:e.jsx(n,{message:"Basic"})}),e.jsx(h,{value:"extended",children:e.jsx(n,{message:"Extended"})}),e.jsx(h,{value:"fulltext",children:e.jsx(n,{message:"Fulltext"})})]})}function Bm(){return e.jsx(Be,{className:"mt-24",color:"warning",title:e.jsx(n,{message:"Important!"}),description:e.jsx(n,{message:"<a>Meilisearch</a> needs to be installed and running for this method to work.",values:{a:s=>e.jsx("a",{href:"https://www.meilisearch.com",target:"_blank",rel:"noreferrer",children:s})}})})}function qm(){return e.jsx(Be,{className:"mt-24",color:"warning",title:e.jsx(n,{message:"Important!"}),description:e.jsx(n,{message:"<a>Elasticsearch</a> needs to be installed and running for this method to work.",values:{a:s=>e.jsx("a",{href:"https://www.elastic.co",target:"_blank",rel:"noreferrer",children:s})}})})}function Hm(){return e.jsxs(m.Fragment,{children:[e.jsx(g,{className:"mt-24",name:"server.algolia_app_id",label:e.jsx(n,{message:"Algolia app ID"}),required:!0}),e.jsx(g,{className:"mt-24",name:"server.algolia_secret",label:e.jsx(n,{message:"Algolia app secret"}),required:!0})]})}function Zm(){const{getValues:s}=I(),{data:t}=Dm(),a=$m(),[r,i]=m.useState("*");return e.jsx(Be,{className:"mt-34",color:"neutral",title:e.jsx(n,{message:"Import records"}),description:e.jsxs("span",{children:[e.jsx(n,{message:"Whenever a new search method is enabled, records that already exist in database need to be imported into the index. All records created after search method is enabled will be imported automatically."}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(n,{message:"Depending on number of records in database, importing could take some time. Don't close this window while it is in progress."})]}),actions:e.jsxs("div",{className:"pt-14 mt-10 border-t",children:[e.jsxs(os,{selectionMode:"single",label:e.jsx(n,{message:"What to import?"}),selectedValue:r,onSelectionChange:l=>{i(l)},children:[e.jsx(h,{value:"*",children:e.jsx(n,{message:"Everything"})}),t==null?void 0:t.models.map(l=>e.jsx(h,{value:l.model,children:e.jsx(n,{message:l.name})},l.model))]}),e.jsx(b,{variant:"flat",color:"primary",className:"mt-24 mb-8",disabled:a.isLoading,onClick:()=>{a.mutate({model:r,driver:s("server.scout_driver")})},children:e.jsx(n,{message:"Import now"})})]})})}const Wm=[{path:"search",element:e.jsx(Vm,{})},{path:"videos",element:e.jsx(wm,{})},{path:"content",element:e.jsx(zm,{})}];function Qm(){const{trans:s}=A();return e.jsx(be,{title:e.jsx(n,{message:"Subscriptions"}),description:e.jsx(n,{message:"Configure gateway integration, accepted cards, invoices and other related settings."}),children:e.jsxs(ws,{children:[e.jsxs(Ss,{children:[e.jsx(Me,{children:e.jsx(n,{message:"General"})}),e.jsx(Me,{children:e.jsx(n,{message:"Invoices"})})]}),e.jsxs(qt,{className:"pt-30",children:[e.jsxs(Xe,{children:[e.jsx($,{name:"client.billing.enable",description:e.jsx(n,{message:"Enable or disable all subscription related functionality across the site."}),children:e.jsx(n,{message:"Enable subscriptions"})}),e.jsx(Ue,{}),e.jsx(Gm,{}),e.jsx(Km,{}),e.jsx(Ue,{}),e.jsx(Nt,{label:e.jsx(n,{message:"Accepted cards"}),name:"client.billing.accepted_cards",placeholder:s({message:"Add new card..."})})]}),e.jsxs(Xe,{children:[e.jsx(g,{inputElementType:"textarea",rows:5,label:e.jsx(n,{message:"Invoice address"}),name:"client.billing.invoice.address",className:"mb-30"}),e.jsx(g,{inputElementType:"textarea",rows:5,label:e.jsx(n,{message:"Invoice notes"}),description:e.jsx(n,{message:"Default notes to show under `notes` section of user invoice. Optional."}),name:"client.billing.invoice.notes"})]})]})]})})}function Gm(){const{watch:s}=I(),t=s("client.billing.paypal.enable");return e.jsxs("div",{className:"mb-30",children:[e.jsx($,{name:"client.billing.paypal.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable PayPal payment gateway integration."}),e.jsx(Os,{className:"mt-6",link:"https://support.vebto.com/help-center/articles/147/configuring-paypal"})]}),children:e.jsx(n,{message:"PayPal gateway"})}),t?e.jsx(pe,{name:"paypal_group",children:a=>e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"server.paypal_client_id",label:e.jsx(n,{message:"PayPal Client ID"}),required:!0,invalid:a,className:"mb-20"}),e.jsx(g,{name:"server.paypal_secret",label:e.jsx(n,{message:"PayPal Secret"}),required:!0,invalid:a,className:"mb-20"}),e.jsx(g,{name:"server.paypal_webhook_id",label:e.jsx(n,{message:"PayPal Webhook ID"}),required:!0,invalid:a,className:"mb-20"}),e.jsx($,{name:"client.billing.paypal_test_mode",invalid:a,description:e.jsx("div",{children:e.jsx(n,{message:"Allows testing PayPal payments with sandbox accounts."})}),children:e.jsx(n,{message:"PayPal test mode"})})]})}):null]})}function Km(){const{watch:s}=I(),t=s("client.billing.stripe.enable");return e.jsxs(m.Fragment,{children:[e.jsx($,{name:"client.billing.stripe.enable",description:e.jsxs("div",{children:[e.jsx(n,{message:"Enable Stripe payment gateway integration."}),e.jsx(Os,{className:"mt-6",link:"https://support.vebto.com/help-center/articles/148/configuring-stripe"})]}),children:e.jsx(n,{message:"Stripe gateway"})}),t?e.jsx(pe,{name:"stripe_group",separatorBottom:!1,children:a=>e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"server.stripe_key",label:e.jsx(n,{message:"Stripe publishable key"}),required:!0,className:"mb-20",invalid:a}),e.jsx(g,{name:"server.stripe_secret",label:e.jsx(n,{message:"Stripe secret key"}),required:!0,className:"mb-20",invalid:a}),e.jsx(g,{name:"server.stripe_webhook_secret",label:e.jsx(n,{message:"Stripe webhook signing secret"}),className:"mb-20",invalid:a})]})}):null]})}function Jm(){const{data:s}=ie(["timezones","localizations"]),t=ot(),{trans:a}=A();return e.jsxs(be,{title:e.jsx(n,{message:"Localization"}),description:e.jsx(n,{message:"Configure global date, time and language settings."}),children:[e.jsxs(D,{className:"mb-30",required:!0,name:"client.dates.default_timezone",showSearchField:!0,selectionMode:"single",label:e.jsx(n,{message:"Default timezone"}),searchPlaceholder:a(d("Search timezones")),description:e.jsx(n,{message:"Which timezone should be selected by default for new users and guests."}),children:[e.jsx(h,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries((s==null?void 0:s.timezones)||{}).map(([r,i])=>e.jsx(ar,{label:r,children:i.map(l=>e.jsx(h,{value:l.value,children:l.text},l.value))},r))]}),e.jsxs(D,{name:"client.locale.default",className:"mb-30",selectionMode:"single",label:e.jsx(n,{message:"Default language"}),description:e.jsx(n,{message:"Which localization should be selected by default for new users and guests."}),children:[e.jsx(h,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),((s==null?void 0:s.localizations)||[]).map(r=>e.jsx(h,{value:r.language,capitalizeFirst:!0,children:r.name},r.language))]}),e.jsxs(rr,{required:!0,className:"mb-30",size:"sm",name:"client.dates.format",orientation:"vertical",label:e.jsx(n,{message:"Date verbosity"}),description:e.jsx(n,{message:"Default verbosity for all dates displayed across the site. Month/day order and separators will be adjusted automatically, based on user's locale."}),children:[e.jsx(Gs,{value:"auto",children:e.jsx(n,{message:"Auto"})},"auto"),Object.entries(ir).map(([r,i])=>e.jsx(Gs,{value:r,children:e.jsx(ae,{date:t,options:i})},r))]}),e.jsx($,{name:"client.i18n.enable",description:e.jsx(n,{message:"If disabled, site will always be shown in default language and user will not be able to change their locale."}),children:e.jsx(n,{message:"Enable translations"})})]})}function Ym(){return e.jsxs(be,{title:e.jsx(n,{message:"Authentication"}),description:e.jsx(n,{message:"Configure registration, social login and related 3rd party integrations."}),children:[e.jsx(Xm,{}),e.jsx($,{className:"mb-24",name:"client.registration.disable",description:e.jsx(n,{message:"All registration related functionality (including social login) will be disabled."}),children:e.jsx(n,{message:"Disable registration"})}),e.jsx($,{className:"mb-24",name:"client.single_device_login",description:e.jsx(n,{message:"Only allow one device to be logged into user account at the same time."}),children:e.jsx(n,{message:"Single device login"})}),e.jsx($,{name:"client.social.compact_buttons",description:e.jsx(n,{message:"Use compact design for social login buttons."}),children:e.jsx(n,{message:"Compact buttons"})}),e.jsx(ex,{}),e.jsx(sx,{}),e.jsx(tx,{}),e.jsx(ax,{}),e.jsx(Ue,{}),e.jsx(g,{inputElementType:"textarea",rows:3,className:"mt-24",name:"client.auth.domain_blacklist",label:e.jsx(n,{message:"Domain blacklist"}),description:e.jsx(n,{message:"Comma separated list of domains. Users will not be able to register or login using any email adress from specified domains."})})]})}function Xm(){const{watch:s}=I(),t=s("server.mail_setup");return e.jsx($,{className:"mb-30",name:"client.require_email_confirmation",description:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Require newly registered users to validate their email address before being able to login."}),!t&&e.jsx("p",{className:"mt-10 text-danger",children:e.jsx(n,{message:"Outgoing mail method needs to be setup before enabling this setting. <a>Fix now</a>",values:{a:a=>e.jsx(F,{className:"font-bold block underline",to:"/admin/settings/mail#outgoing-emails",children:a})}})})]}),children:e.jsx(n,{message:"Require email confirmation"})})}function ex(){const{watch:s}=I(),{envato:t}=xe(),a=s("client.social.envato.enable");return t!=null&&t.enable?e.jsx(pe,{separatorBottom:!1,name:"envato_group",children:r=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:r,name:"client.social.envato.enable",description:e.jsx(n,{message:"Enable logging into the site via envato."}),children:e.jsx(n,{message:"Envato login"})}),a&&e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:r,className:"mt-30",name:"server.envato_id",label:e.jsx(n,{message:"Envato ID"}),required:!0}),e.jsx(g,{invalid:r,className:"mt-30",name:"server.envato_secret",label:e.jsx(n,{message:"Envato secret"}),required:!0}),e.jsx(g,{invalid:r,className:"mt-30",name:"server.envato_personal_token",label:e.jsx(n,{message:"Envato personal token"}),required:!0})]})]})}):null}function sx(){const{watch:s}=I(),t=s("client.social.google.enable");return e.jsx(pe,{name:"google_group",children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.google.enable",description:e.jsx(n,{message:"Enable logging into the site via google."}),children:e.jsx(n,{message:"Google login"})}),t&&e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:a,className:"mt-30",name:"server.google_id",label:e.jsx(n,{message:"Google client ID"}),required:!0}),e.jsx(g,{className:"mt-30",name:"server.google_secret",label:e.jsx(n,{message:"Google client secret"}),required:!0})]})]})})}function tx(){const{watch:s}=I(),t=s("client.social.facebook.enable");return e.jsx(pe,{name:"facebook_group",separatorTop:!1,children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.facebook.enable",description:e.jsx(n,{message:"Enable logging into the site via facebook."}),children:e.jsx(n,{message:"Facebook login"})}),t&&e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:a,className:"mt-30",name:"server.facebook_id",label:e.jsx(n,{message:"Facebook app ID"}),required:!0}),e.jsx(g,{invalid:a,className:"mt-30",name:"server.facebook_secret",label:e.jsx(n,{message:"Facebook app secret"}),required:!0})]})]})})}function ax(){const{watch:s}=I(),t=s("client.social.twitter.enable");return e.jsx(pe,{name:"twitter_group",separatorTop:!1,separatorBottom:!1,children:a=>e.jsxs(e.Fragment,{children:[e.jsx($,{invalid:a,name:"client.social.twitter.enable",description:e.jsx(n,{message:"Enable logging into the site via twitter."}),children:e.jsx(n,{message:"Twitter login"})}),t&&e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:a,className:"mt-30",name:"server.twitter_id",label:e.jsx(n,{message:"Twitter ID"}),required:!0}),e.jsx(g,{invalid:a,className:"mt-30",name:"server.twitter_secret",label:e.jsx(n,{message:"Twitter secret"}),required:!0})]})]})})}function nx(){return S.get("uploads/server-max-file-size").then(s=>s.data)}function rx(){return Ie(["MaxServerUploadSize"],()=>nx())}const ix=["B","KB","MB","GB","TB","PB"];function En(s,t){if(s==null)return 0;switch(t){case"KB":return s*1024;case"MB":return s*1024**2;case"GB":return s*1024**3;case"TB":return s*1024**4;case"PB":return s*1024**5;default:return s}}const lx=0x630000000000,Ys=U.forwardRef(({name:s,...t},a)=>{const{field:{onChange:r,onBlur:i,value:l="",ref:o},fieldState:{invalid:c,error:u}}=cs({name:s}),[x,p]=m.useState(""),[j,v]=m.useState("MB");m.useEffect(()=>{if(l==null||l===""){p("");return}const{amount:y,unit:L}=ox({bytes:Math.min(l,lx)});v(L||"MB"),p(Number.isNaN(y)?"":y)},[l,j]);const f={onChange:y=>{const L=parseInt(y.target.value);if(Number.isNaN(L))r(L);else{const N=En(parseInt(y.target.value),j);r(N)}},onBlur:i,value:x,invalid:c,errorMessage:u==null?void 0:u.message,inputRef:o},k=e.jsx(os,{minWidth:"min-w-80",selectionMode:"single",selectedValue:j,disabled:!l,onSelectionChange:y=>{const L=En(x||0,y);r(L)},children:ix.slice(0,5).map(y=>e.jsx(h,{value:y,children:y==="B"?"Bytes":y},y))});return e.jsx(qe,{...ds(f,t),type:"number",ref:a,endAppend:k})}),ox=lr(({bytes:s})=>{const t=or(s);if(!t)return{amount:"",unit:"MB"};let a=parseInt(t.split(" ")[0]);return a=Math.round(a),{amount:a,unit:t.split(" ")[1]}});function cx(){const{trans:s}=A();return T(()=>dx(),{onSuccess:()=>{M(s(d("CORS file updated"))),_.invalidateQueries(["Query Key"])},onError:t=>q(t)})}function dx(){return S.post("s3/cors/upload").then(s=>s.data)}function ux(){return T(s=>mx(s),{onError:s=>q(s)})}function mx(s){return S.post("settings/uploading/dropbox-refresh-token",s).then(t=>t.data)}function xx({isInvalid:s}){const{watch:t,setValue:a}=I(),r=t("server.storage_dropbox_app_key"),i=t("server.storage_dropbox_app_secret");return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-20",name:"server.storage_dropbox_app_key",label:e.jsx(n,{message:"Dropbox application key"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-20",name:"server.storage_dropbox_app_secret",label:e.jsx(n,{message:"Dropbox application secret"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-20",name:"server.storage_dropbox_refresh_token",label:e.jsx(n,{message:"Dropbox refresh token"}),required:!0}),e.jsxs(P,{type:"modal",onClose:l=>{l&&a("server.storage_dropbox_refresh_token",l)},children:[e.jsx(b,{variant:"outline",color:"primary",size:"xs",disabled:!r||!i,children:e.jsx(n,{message:"Get dropbox refresh token"})}),e.jsx(hx,{appKey:r,appSecret:i})]})]})}function hx({appKey:s,appSecret:t}){const a=V(),{formId:r,close:i}=Z(),l=ux();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Connected dropbox account"})}),e.jsx(X,{children:e.jsxs(ee,{id:r,form:a,onSubmit:o=>{l.mutate({app_key:s,app_secret:t,access_code:o.accessCode},{onSuccess:c=>{i(c.refreshToken)}})},children:[e.jsxs("div",{className:"mb-20 pb-20 border-b",children:[e.jsx("div",{className:"text-muted text-sm mb-10",children:e.jsx(n,{message:"Click the 'get access code' button to get dropbox access code, then paste it into the field below."})}),e.jsx(b,{variant:"outline",color:"primary",size:"xs",elementType:"a",target:"_blank",href:`https://www.dropbox.com/oauth2/authorize?client_id=${s}&token_access_type=offline&response_type=code`,children:e.jsx(n,{message:"Get access code"})})]}),e.jsx(g,{name:"accessCode",label:e.jsx(n,{message:"Dropbox access code"}),required:!0})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{i()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",form:r,type:"submit",disabled:!s||!t||l.isLoading,children:e.jsx(n,{message:"Connect"})})]})]})}function gx(){const{trans:s}=A();return e.jsxs(be,{title:e.jsx(n,{message:"Uploading"}),description:e.jsx(n,{message:"Configure size and type of files that users are able to upload. This will affect all uploads across the site."}),children:[e.jsx(jx,{}),e.jsx(fx,{}),e.jsx(bx,{}),e.jsx(pe,{name:"static_delivery_group",children:t=>e.jsxs(rr,{invalid:t,size:"sm",name:"server.static_file_delivery",orientation:"vertical",label:e.jsx(n,{message:"File delivery optimization"}),description:e.jsx(n,{message:"Both X-Sendfile and X-Accel need to be enabled on the server first. When enabled, it will reduce server memory and CPU usage when previewing or downloading files, especially for large files."}),children:[e.jsx(Gs,{value:"",children:e.jsx(n,{message:"None"})}),e.jsx(Gs,{value:"xsendfile",children:e.jsx(n,{message:"X-Sendfile (Apache)"})}),e.jsx(Gs,{value:"xaccel",children:e.jsx(n,{message:"X-Accel (Nginx)"})})]})}),e.jsx(Ys,{className:"mb-30",name:"client.uploads.chunk_size",min:1,label:e.jsx(n,{message:"Chunk size"}),placeholder:"Infinity",description:e.jsx(n,{message:"Size (in bytes) for each file chunk. It should only be changed if there is a maximum upload size on your server or proxy (for example cloudflare). If chunk size is larger then limit on the server, uploads will fail."})}),e.jsx(px,{}),e.jsx(Ue,{}),e.jsx(Ys,{min:1,name:"client.uploads.max_size",className:"mb-30",label:e.jsx(n,{message:"Maximum file size"}),description:e.jsx(n,{message:"Maximum size (in bytes) for a single file user can upload."})}),e.jsx(Ys,{min:1,name:"client.uploads.available_space",className:"mb-30",label:e.jsx(n,{message:"Available space"}),description:e.jsx(n,{message:"Disk space (in bytes) each user uploads are allowed to take up. This can be overridden per user."})}),e.jsx(Nt,{name:"client.uploads.allowed_extensions",className:"mb-30",label:e.jsx(n,{message:"Allowed extensions"}),placeholder:s(d("Add extension...")),description:e.jsx(n,{message:"List of allowed file types (jpg, mp3, pdf etc.). Leave empty to allow all file types."})}),e.jsx(Nt,{name:"client.uploads.blocked_extensions",label:e.jsx(n,{message:"Blocked extensions"}),placeholder:s(d("Add extension...")),description:e.jsx(n,{message:"Prevent uploading of these file types, even if they are allowed above."})})]})}function px(){const{data:s}=rx();return e.jsx(Be,{color:"warning",description:e.jsx(n,{message:"Maximum upload size on your server currently is set to <b>:size</b>",values:{size:s==null?void 0:s.maxSize,b:t=>e.jsx("b",{children:t})}})})}function jx(){const{watch:s,clearErrors:t}=I();return s("server.uploads_disk_driver")?e.jsxs(D,{className:"mb-30",selectionMode:"single",name:"server.uploads_disk_driver",label:e.jsx(n,{message:"User Uploads Storage Method"}),description:e.jsx(n,{message:"Where should user private file uploads be stored."}),onSelectionChange:()=>{t()},children:[e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(h,{value:"ftp",children:"FTP"}),e.jsx(h,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(h,{value:"backblaze_s3",children:"Backblaze"}),e.jsx(h,{value:"s3",children:"Amazon S3 (Or compatible service)"}),e.jsx(h,{value:"dropbox",children:"Dropbox"}),e.jsx(h,{value:"rackspace",children:"Rackspace"})]}):null}function fx(){const{watch:s,clearErrors:t}=I();return s("server.public_disk_driver")?e.jsxs(D,{label:e.jsx(n,{message:"Public Uploads Storage Method"}),selectionMode:"single",name:"server.public_disk_driver",description:e.jsx(n,{message:"Where should user public uploads (like avatars) be stored."}),onSelectionChange:()=>{t()},children:[e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local Disk (Default)"})}),e.jsx(h,{value:"s3",children:"Amazon S3"}),e.jsx(h,{value:"ftp",children:"FTP"}),e.jsx(h,{value:"digitalocean_s3",children:"DigitalOcean Spaces"}),e.jsx(h,{value:"backblaze_s3",children:"Backblaze"})]}):null}function bx(){const{watch:s}=I(),t=[s("server.uploads_disk_driver"),s("server.public_disk_driver")];return t[0]==="local"&&t[1]==="local"?null:e.jsx(pe,{separatorBottom:!1,name:"storage_group",children:a=>{if(t.includes("s3"))return e.jsx(vx,{isInvalid:a});if(t.includes("ftp"))return e.jsx(wx,{isInvalid:a});if(t.includes("dropbox"))return e.jsx(xx,{isInvalid:a});if(t.includes("digitalocean_s3"))return e.jsx(yx,{isInvalid:a});if(t.includes("backblaze_s3"))return e.jsx(Cx,{isInvalid:a})}})}function vx({isInvalid:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_s3_key",label:e.jsx(n,{message:"Amazon S3 key"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_s3_secret",label:e.jsx(n,{message:"Amazon S3 secret"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_s3_region",label:e.jsx(n,{message:"Amazon S3 region"}),pattern:"[a-z1-9\\-]+",placeholder:"us-east-1"}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_s3_bucket",label:e.jsx(n,{message:"Amazon S3 bucket"}),required:!0}),e.jsx(g,{invalid:s,name:"server.storage_s3_endpoint",label:e.jsx(n,{message:"Amazon S3 endpoint"}),description:e.jsx(n,{message:"Only change endpoint if you are using another S3 compatible storage service."})}),e.jsx(tn,{invalid:s})]})}function yx({isInvalid:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_key",label:e.jsx(n,{message:"DigitalOcean key"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_secret",label:e.jsx(n,{message:"DigitalOcean secret"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_region",label:e.jsx(n,{message:"DigitalOcean region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-east-1",required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_digitalocean_bucket",label:e.jsx(n,{message:"DigitalOcean bucket"}),required:!0}),e.jsx(tn,{invalid:s})]})}function Cx({isInvalid:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_backblaze_key",label:e.jsx(n,{message:"Backblaze KeyID"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_backblaze_secret",label:e.jsx(n,{message:"Backblaze applicationKey"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_backblaze_region",label:e.jsx(n,{message:"Backblaze Region"}),pattern:"[a-z0-9\\-]+",placeholder:"us-west-002",required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_backblaze_bucket",label:e.jsx(n,{message:"Backblaze bucket name"}),required:!0}),e.jsx(tn,{invalid:s})]})}function tn({invalid:s}){var i,l;const t=cx(),{data:a}=dt(),r=((i=a==null?void 0:a.server.uploads_disk_driver)==null?void 0:i.endsWith("s3"))||((l=a==null?void 0:a.server.public_disk_driver)==null?void 0:l.endsWith("s3"));return e.jsxs(m.Fragment,{children:[e.jsx($,{className:"mt-30",invalid:s,name:"client.uploads.s3_direct_upload",description:e.jsxs("div",{children:[e.jsx("p",{children:e.jsx(n,{message:"Upload files directly from the browser to s3 without going through the server. It will save on server bandwidth and should result in faster upload times. This should be enabled, unless storage provider does not support multipart uploads."})}),e.jsx("p",{className:"mt-10",children:e.jsx(n,{message:"If s3 provider is not configured to allow uploads from browser, this can be done automatically via CORS button below, when valid credentials are saved."})})]}),children:e.jsx(n,{message:"Direct upload"})}),e.jsx(b,{variant:"flat",color:"primary",size:"xs",className:"mt-20",onClick:()=>{t.mutate()},disabled:!r||t.isLoading,children:e.jsx(n,{message:"Configure CORS"})})]})}function wx({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_ftp_host",label:e.jsx(n,{message:"FTP hostname"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_ftp_username",label:e.jsx(n,{message:"FTP username"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_ftp_password",label:e.jsx(n,{message:"FTP password"}),type:"password",required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_ftp_root",label:e.jsx(n,{message:"FTP directory"}),placeholder:"/"}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.storage_ftp_port",label:e.jsx(n,{message:"FTP port"}),type:"number",min:0,placeholder:"21"}),e.jsx($,{invalid:s,name:"server.storage_ftp_passive",className:"mb-30",children:e.jsx(n,{message:"Passive"})}),e.jsx($,{invalid:s,name:"server.storage_ftp_ssl",children:e.jsx(n,{message:"SSL"})})]})}function Sx({isInvalid:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.mailgun_domain",label:e.jsx(n,{message:"Mailgun domain"}),description:e.jsx(n,{message:"Usually the domain of your site (site.com)"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.mailgun_secret",label:e.jsx(n,{message:"Mailgun API key"}),description:e.jsx(n,{message:"Should start with `key-`"}),required:!0}),e.jsx(g,{invalid:s,name:"server.mailgun_endpoint",label:e.jsx(n,{message:"Mailgun endpoint"}),description:e.jsx(n,{message:"Can be left empty, if your mailgun account is in the US region."}),placeholder:"api.eu.mailgun.net"})]})}function Nx({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.mail_host",label:e.jsx(n,{message:"SMTP host"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.mail_username",label:e.jsx(n,{message:"SMTP username"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",type:"password",name:"server.mail_password",label:e.jsx(n,{message:"SMTP password"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",type:"number",name:"server.mail_port",label:e.jsx(n,{message:"SMTP port"})}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.mail_encryption",label:e.jsx(n,{message:"SMTP encryption"})})]})}function Lx({isInvalid:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.ses_key",label:e.jsx(n,{message:"SES key"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.ses_secret",label:e.jsx(n,{message:"SES secret"}),required:!0}),e.jsx(g,{invalid:s,name:"server.ses_region",label:e.jsx(n,{message:"SES region"}),placeholder:"us-east-1",required:!0})]})}function kx({isInvalid:s}){return e.jsx(g,{invalid:s,name:"server.postmark_token",label:e.jsx(n,{message:"Postmark token"}),required:!0})}const Pn=E([e.jsx("path",{fill:"#4caf50",d:"M45,16.2l-5,2.75l-5,4.75L35,40h7c1.657,0,3-1.343,3-3V16.2z"},"0"),e.jsx("path",{fill:"#1e88e5",d:"M3,16.2l3.614,1.71L13,23.7V40H6c-1.657,0-3-1.343-3-3V16.2z"},"1"),e.jsx("polygon",{fill:"#e53935",points:"35,11.2 24,19.45 13,11.2 12,17 13,23.7 24,31.95 35,23.7 36,17"},"2"),e.jsx("path",{fill:"#c62828",d:"M3,12.298V16.2l10,7.5V11.2L9.876,8.859C9.132,8.301,8.228,8,7.298,8h0C4.924,8,3,9.924,3,12.298z"},"3"),e.jsx("path",{fill:"#fbc02d",d:"M45,12.298V16.2l-10,7.5V11.2l3.124-2.341C38.868,8.301,39.772,8,40.702,8h0 C43.076,8,45,9.924,45,12.298z"},"4")],"Gmail","0 0 48 48");function _x(){const{watch:s,setValue:t}=I(),{connectSocial:a}=no(),r=s("server.connectedGmailAccount"),i=s("client.mail.handler")==="gmailApi",l=async()=>{const u=await a("secure/settings/mail/gmail/connect");if((u==null?void 0:u.status)==="SUCCESS"){const x=u.callbackData.profile.email;t("server.connectedGmailAccount",x),M(d("Connected gmail account: :email",{values:{email:x}}))}},o=e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(Pn,{}),onClick:()=>{l()},children:e.jsx(n,{message:"Connect gmail account"})}),c=e.jsxs("div",{className:"px-14 py-6 rounded bg-alt border flex items-center gap-14 text-sm",children:[e.jsx(Pn,{size:"lg"}),r,e.jsx(b,{variant:"text",color:"primary",className:"ml-auto",onClick:()=>{l()},children:e.jsx(n,{message:"Reconnect"})})]});return e.jsxs(m.Fragment,{children:[i&&e.jsx(g,{name:"client.gmail.incoming.topicName",minLength:10,required:!0,label:e.jsx(n,{message:"Gmail topic name"}),description:e.jsx(n,{message:"Google cloud Pub/Sub topic name."}),className:"mb-30"}),e.jsx("div",{className:"text-sm mb-12",children:e.jsx(n,{message:"Gmail account"})}),r?c:o]})}function Mx(){const{watch:s,clearErrors:t}=I(),a=[s("server.mail_driver"),s("client.mail.handler")],r=[];return a.includes("mailgun")&&r.push(Sx),a.includes("smtp")&&r.push(Nx),a.includes("ses")&&r.push(Lx),a.includes("postmark")&&r.push(kx),a.includes("gmailApi")&&r.push(_x),e.jsx(pe,{separatorTop:!1,separatorBottom:!1,name:"mail_group",children:i=>e.jsxs(m.Fragment,{children:[e.jsxs(D,{onSelectionChange:()=>{t()},invalid:i,selectionMode:"single",name:"server.mail_driver",label:e.jsx(n,{message:"Outgoing mail method"}),description:e.jsxs("div",{children:[e.jsx(n,{message:"Which method should be used for sending outgoing application emails (like registration confirmation)"}),e.jsx(Os,{className:"mt-8",link:"https://support.vebto.com/help-center/articles/42/44/155/incoming-emails"})]}),children:[e.jsx(h,{value:"mailgun",children:"Mailgun"}),e.jsx(h,{value:"gmailApi",children:"Gmail Api"}),e.jsx(h,{value:"smtp",children:"SMTP"}),e.jsx(h,{value:"postmark",children:"Postmark"}),e.jsx(h,{value:"ses",children:"Ses (Amazon Simple Email Service)"}),e.jsx(h,{value:"sendmail",children:"SendMail"}),e.jsx(h,{value:"log",children:"Log (Email will be saved to error log)"})]}),r.length?e.jsx("div",{className:"mt-30",children:r.map((l,o)=>e.jsx(l,{isInvalid:i},o))}):null]})})}function Ix(){const{clearErrors:s}=I(),{settings:t}=m.useContext(Ze);return t!=null&&t.showIncomingMailMethod?e.jsxs(D,{onSelectionChange:()=>{s()},className:"my-30",selectionMode:"single",name:"client.mail_handler",label:e.jsx(n,{message:"Incoming mail method"}),description:e.jsxs("div",{children:[e.jsx(n,{message:"Which method should be used to handle incoming application emails."}),e.jsx(Os,{className:"mt-8",link:"https://support.vebto.com/help-center/articles/76/configuring-email-provider"})]}),children:[e.jsx(h,{value:"mailgun",children:"Mailgun"}),e.jsx(h,{value:"gmailApi",children:"Gmail Api"}),e.jsx(h,{value:"null",children:"Rest API (Send emails via http API)"}),e.jsx(h,{value:"pipe",children:"Pipe (Pipe emails directly)"})]}):null}function Tx(){return e.jsxs(be,{title:e.jsx(n,{message:"Mail settings"}),description:e.jsx(n,{message:"Change incoming and outgoing email handlers, email credentials and other related settings."}),children:[e.jsx(g,{id:"outgoing-emails",className:"mb-30",type:"email",name:"server.mail_from_address",label:e.jsx(n,{message:"From address"}),description:e.jsx(n,{message:"All outgoing application emails will be sent from this email address."}),required:!0}),e.jsx(Fx,{}),e.jsx(g,{className:"mb-30",name:"server.mail_from_name",label:e.jsx(n,{message:"From name"}),description:e.jsx(n,{message:"All outgoing application emails will be sent using this name."}),required:!0}),e.jsx(Be,{color:"warning",description:e.jsx(n,{message:"Your selected mail method must be authorized to send emails using this address and name."})}),e.jsx(Ue,{}),e.jsx(Ix,{}),e.jsx(Mx,{})]})}function Fx(){const{base_url:s}=xe(),t=`${s}/contact`,a=e.jsx(Et,{href:t,children:t});return e.jsx(g,{className:"mb-30",type:"email",name:"client.mail.contact_page_address",label:e.jsx(n,{message:"Contact page address"}),description:e.jsx(n,{values:{contactPageUrl:a},message:"Where emails from :contactPageUrl page should be sent to."})})}function Ex(){return S.post("cache/flush").then(s=>s.data)}function Px(){return T(()=>Ex(),{onSuccess:()=>{M(d("Cache cleared"))},onError:s=>q(s)})}function zx(){const s=Px();return e.jsxs(be,{title:e.jsx(n,{message:"Cache settings"}),description:e.jsx(n,{message:"Select cache provider and manually clear cache."}),children:[e.jsx(Dx,{}),e.jsx(b,{type:"button",variant:"outline",size:"xs",color:"primary",disabled:s.isLoading,onClick:()=>{s.mutate()},children:e.jsx(n,{message:"Clear cache"})}),e.jsx(Be,{color:"warning",className:"mt-30",description:e.jsx(n,{message:'"File" is the best option for most cases and should not be changed, unless you are familiar with another cache method and have it set up on the server already.'})})]})}function Dx(){const{watch:s,clearErrors:t}=I(),a=s("server.cache_driver");let r=null;return a==="memcached"&&(r=Ax),e.jsx(pe,{separatorTop:!1,name:"cache_group",children:i=>e.jsxs(e.Fragment,{children:[e.jsxs(D,{invalid:i,onSelectionChange:()=>{t()},selectionMode:"single",name:"server.cache_driver",label:e.jsx(n,{message:"Cache method"}),description:e.jsx(n,{message:"Which method should be used for storing and retrieving cached items."}),children:[e.jsx(h,{value:"file",children:e.jsx(n,{message:"File (Default)"})}),e.jsx(h,{value:"array",children:e.jsx(n,{message:"None"})}),e.jsx(h,{value:"apc",children:"APC"}),e.jsx(h,{value:"memcached",children:"Memcached"}),e.jsx(h,{value:"redis",children:"Redis"})]}),r&&e.jsx("div",{className:"mt-30",children:e.jsx(r,{isInvalid:i})})]})})}function Ax({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.memcached_host",label:e.jsx(n,{message:"Memcached host"}),required:!0}),e.jsx(g,{invalid:s,type:"number",name:"server.memcached_port",label:e.jsx(n,{message:"Memcached port"}),required:!0})]})}function $x(){return e.jsxs(be,{title:e.jsx(n,{message:"Error logging"}),description:e.jsx(n,{message:"Configure site error logging and related 3rd party integrations."}),children:[e.jsx(Rx,{}),e.jsx(Be,{className:"mt-30",color:"positive",description:e.jsx(n,{values:{a:s=>e.jsx(Et,{href:"https://sentry.io",children:s})},message:"<a>Sentry</a> integration provides real-time error tracking and helps identify and fix issues when site is in production."})})]})}function Rx(){const{clearErrors:s}=I();return e.jsx(pe,{separatorTop:!1,separatorBottom:!1,name:"logging_group",children:t=>e.jsx(g,{onChange:()=>{s()},invalid:t,name:"server.sentry_dsn",type:"url",minLength:30,label:e.jsx(n,{message:"Sentry DSN"})})})}function Vx(){return e.jsxs(be,{title:e.jsx(n,{message:"Queue"}),description:e.jsx(n,{message:"Select active queue method and enter related 3rd party API keys."}),children:[e.jsx(Be,{color:"positive",className:"mb-30",description:e.jsx(n,{message:"Queues allow to defer time consuming tasks, such as sending an email, until a later time. Deferring these tasks can speed up web requests to the application."})}),e.jsx(Be,{color:"warning",className:"mb-30",description:e.jsx(n,{message:"All methods except sync require additional setup, which should be performed before changing the queue method. Consult documentation for more information."})}),e.jsx(Ox,{})]})}function Ox(){const{watch:s,clearErrors:t}=I(),a=s("server.queue_driver");let r=null;return a==="sqs"&&(r=Ux),e.jsx(pe,{separatorTop:!1,separatorBottom:!1,name:"queue_group",children:i=>e.jsxs(e.Fragment,{children:[e.jsxs(D,{invalid:i,onSelectionChange:()=>{t()},selectionMode:"single",name:"server.queue_driver",label:e.jsx(n,{message:"Queue method"}),required:!0,children:[e.jsx(h,{value:"sync",children:e.jsx(n,{message:"Sync (Default)"})}),e.jsx(h,{value:"beanstalkd",children:"Beanstalkd"}),e.jsx(h,{value:"database",children:e.jsx(n,{message:"Database"})}),e.jsx(h,{value:"sqs",children:e.jsx(n,{message:"SQS (Amazon simple queue service)"})}),e.jsx(h,{value:"redis",children:"Redis"})]}),r&&e.jsx("div",{className:"mt-30",children:e.jsx(r,{isInvalid:i})})]})})}function Ux({isInvalid:s}){return e.jsxs(e.Fragment,{children:[e.jsx(g,{invalid:s,className:"mb-30",name:"server.sqs_queue_key",label:e.jsx(n,{message:"SQS queue key"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.sqs_queue_secret",label:e.jsx(n,{message:"SQS queue secret"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.sqs_queue_prefix",label:e.jsx(n,{message:"SQS queue prefix"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.sqs_queue_name",label:e.jsx(n,{message:"SQS queue name"}),required:!0}),e.jsx(g,{invalid:s,className:"mb-30",name:"server.sqs_queue_region",label:e.jsx(n,{message:"SQS queue region"}),required:!0})]})}function Bx(){const{settings:s}=m.useContext(Ze);return e.jsxs(be,{title:e.jsx(n,{message:"Recaptcha"}),description:e.jsx(n,{message:"Configure google recaptcha integration and credentials."}),children:[(s==null?void 0:s.showRecaptchaLinkSwitch)&&e.jsx($,{className:"mb-30",name:"client.recaptcha.enable.link_creation",description:e.jsx(n,{message:"Enable recaptcha integration when creating links from homepage or user dashboard."}),children:e.jsx(n,{message:"Link creation"})}),e.jsx($,{className:"mb-30",name:"client.recaptcha.enable.contact",description:e.jsx(n,{message:'Enable recaptcha integration for "contact us" page.'}),children:e.jsx(n,{message:"Contact page"})}),e.jsx($,{className:"mb-30",name:"client.recaptcha.enable.register",description:e.jsx(n,{message:"Enable recaptcha integration for registration page."}),children:e.jsx(n,{message:"Registration page"})}),e.jsx(qx,{})]})}function qx(){const{clearErrors:s}=I();return e.jsx(pe,{separatorTop:!1,separatorBottom:!1,name:"recaptcha_group",children:t=>e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"mb-30",onChange:()=>{s()},invalid:t,name:"client.recaptcha.site_key",label:e.jsx(n,{message:"Recaptcha v3 site key"})}),e.jsx(g,{onChange:()=>{s()},invalid:t,name:"client.recaptcha.secret_key",label:e.jsx(n,{message:"Recaptcha v3 secret key"})})]})})}const Hx=U.forwardRef((s,t)=>{const a=ro(t),{fieldProps:r,inputProps:i}=io({...s,focusRef:a}),l=Ca(s);return e.jsx(ka,{ref:t,fieldClassNames:l,...r,children:e.jsx("input",{type:"file",ref:a,...i,className:w(l.input,"py-8","file:bg-primary file:text-on-primary file:border-none file:rounded file:text-sm file:font-semibold file:px-10 file:h-24 file:mr-10")})})});function Zx({name:s,...t}){const{field:{onChange:a,onBlur:r,ref:i},fieldState:{invalid:l,error:o}}=cs({name:s}),[c,u]=U.useState(""),x={onChange:p=>{var j;a((j=p.target.files)==null?void 0:j[0]),u(p.target.value)},onBlur:r,value:c,invalid:l,errorMessage:o==null?void 0:o.message};return e.jsx(Hx,{ref:i,...ds(x,t)})}function Wx(){return e.jsx(be,{title:e.jsx(n,{message:"Analytics"}),description:e.jsx(n,{message:"Configure google analytics integration and credentials."}),children:e.jsx(Qx,{})})}function Qx(){const{clearErrors:s}=I();return e.jsx(pe,{separatorTop:!1,separatorBottom:!1,name:"analytics_group",children:t=>e.jsxs(m.Fragment,{children:[e.jsx(Zx,{className:"mb-30",onChange:()=>{s()},invalid:t,name:"files.certificate",accept:".json",label:e.jsx(n,{message:"Google service account key file (.json)"})}),e.jsx(g,{className:"mb-30",onChange:()=>{s()},invalid:t,name:"server.analytics_property_id",type:"number",label:e.jsx(n,{message:"Google analytics property ID"})}),e.jsx(g,{className:"mb-30",onChange:()=>{s()},invalid:t,name:"client.analytics.tracking_code",placeholder:"G-******",min:"1",max:"20",description:e.jsx(n,{message:"Google analytics measurement ID only, not the whole javascript snippet."}),label:e.jsx(n,{message:"Google tag manager measurement ID"})}),e.jsx(g,{name:"client.analytics.gchart_api_key",label:e.jsx(n,{message:"Google maps javascript API key"}),description:e.jsx(n,{message:"Only required in order to show world geochart on integrated analytics pages."})})]})})}function Gx(s){const t=Q();return T(a=>Kx(a),{onSuccess:(a,r)=>{M(d("User updated")),_.invalidateQueries(["users"]),t("/admin/users")},onError:a=>J(a,s)})}function Kx({id:s,...t}){return t.roles&&(t.roles=t.roles.map(a=>a.id)),S.put(`users/${s}`,t).then(a=>a.data)}function qi({onSubmit:s,form:t,title:a,isLoading:r,avatarManager:i,resendEmailButton:l,children:o}){const{require_email_confirmation:c}=xe(),{data:u}=ie(["roles","permissions"]);return e.jsxs(Ve,{onSubmit:s,form:t,title:a,isLoading:r,children:[e.jsxs("div",{className:"flex items-start gap-40 md:gap-80 mb-40",children:[i,e.jsxs("div",{className:"flex-auto",children:[o,e.jsx(g,{className:"mb-30",name:"first_name",label:e.jsx(n,{message:"First name"})}),e.jsx(g,{name:"last_name",label:e.jsx(n,{message:"Last name"})})]})]}),e.jsxs("div",{className:"border-t border-b mb-30 pb-30 pt-30",children:[e.jsx($,{className:w(l&&"mb-30"),disabled:!c,name:"email_verified_at",description:e.jsx(n,{message:"Whether email address has been confirmed. User will not be able to login until address is confirmed, unless confirmation is disabled from settings page."}),children:e.jsx(n,{message:"Email confirmed"})}),l]}),e.jsx(Ys,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:x=>e.jsx(F,{className:it,target:"_blank",to:"/admin/settings/uploading",children:x})},message:"Total storage space all user uploads are allowed to take up. If left empty, this value will be inherited from any roles or subscriptions user has, or from 'Available space' setting in <a>Uploading</a> settings page."})}),e.jsx($s,{className:"mb-30",name:"roles",label:e.jsx(n,{message:"Roles"}),suggestions:u==null?void 0:u.roles,children:x=>e.jsx(h,{value:x.id,children:x.name},x.id)}),e.jsxs("div",{className:"mt-30 pt-30 border-t",children:[e.jsx("div",{className:"text-sm mb-10",children:e.jsx(n,{message:"Permissions"})}),e.jsx(Ja,{name:"permissions"})]})]})}function Jx(){var u;const s=V(),{require_email_confirmation:t}=xe(),{userId:a}=B(),r=Gx(s),i=lo(),{data:l,isLoading:o}=oo(a,{with:["subscriptions","roles","permissions"]});if(m.useEffect(()=>{l!=null&&l.user&&!s.getValues().id&&s.reset({first_name:l.user.first_name,last_name:l.user.last_name,roles:l.user.roles,permissions:l.user.permissions,id:l.user.id,email_verified_at:!!l.user.email_verified_at,available_space:l.user.available_space,avatar:l.user.avatar})},[l==null?void 0:l.user,s]),o)return e.jsx(Ce,{});const c=e.jsx(b,{size:"xs",variant:"outline",color:"primary",disabled:!t||i.isLoading||((u=l==null?void 0:l.user)==null?void 0:u.email_verified_at)!=null,onClick:()=>{i.mutate({email:l.user.email})},children:e.jsx(n,{message:"Resend email"})});return e.jsx(qi,{onSubmit:x=>{r.mutate(x)},form:s,title:e.jsx(n,{values:{email:l==null?void 0:l.user.email},message:"Edit “:email“"}),isLoading:r.isLoading,avatarManager:e.jsx(Yx,{user:l.user,onChange:()=>{_.invalidateQueries(["users"])}}),resendEmailButton:c,children:e.jsx(g,{className:"mb-30",name:"password",type:"password",label:e.jsx(n,{message:"New password"})})})}function Yx({user:s,onChange:t}){const a=co({user:s}),r=uo({user:s});return e.jsx(ye,{children:e.jsx(ve,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:e.jsx(n,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0,onChange:i=>{i?a.mutate({url:i}):r.mutate(),t()}})})}function Xx(s){const t=Q();return T(a=>eh(a),{onSuccess:()=>{M(d("User created")),_.invalidateQueries(Y("users")),t("/admin/users")},onError:a=>J(a,s)})}function eh(s){return s.roles&&(s.roles=s.roles.map(t=>t.id)),S.post("users",s).then(t=>t.data)}function sh(){const s=V(),t=Xx(s),a=e.jsx(ye,{children:e.jsx(ve,{name:"avatar",diskPrefix:"avatars",variant:"avatar",stretchPreview:!0,label:e.jsx(n,{message:"Profile image"}),previewSize:"w-90 h-90",showRemoveButton:!0})});return e.jsxs(qi,{onSubmit:r=>{t.mutate(r)},form:s,title:e.jsx(n,{message:"Add new user"}),isLoading:t.isLoading,avatarManager:a,children:[e.jsx(g,{className:"mb-30",name:"email",type:"email",label:e.jsx(n,{message:"Email"})}),e.jsx(g,{className:"mb-30",name:"password",type:"password",label:e.jsx(n,{message:"Password"})})]})}const th=E(e.jsx("path",{d:"m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7 1.62-4.33L19.12 17h-3.24z"}),"TranslateOutlined"),Hi=s=>{const t=["getLocaleWithLines"];return s!=null&&t.push(s),t};function ah(s){return Ie(Hi(s),()=>nh(s),{staleTime:1/0})}function nh(s){return S.get(`localizations/${s}`).then(t=>t.data)}function rh({id:s,...t}){return S.put(`localizations/${s}`,t).then(a=>a.data)}function Zi(s){return T(t=>rh(t),{onSuccess:()=>{M(d("Localization updated")),_.invalidateQueries(Y("localizations")),_.invalidateQueries(Hi())},onError:t=>s?J(t,s):q(t)})}function ih({localization:s}){const{trans:t}=A(),{formId:a,close:r}=Z(),i=V({defaultValues:{id:s.id,name:s.name,language:s.language}}),{data:l}=ie(["languages"]),o=(l==null?void 0:l.languages)||[],c=Zi(i);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Update localization"})}),e.jsx(X,{children:e.jsxs(ee,{form:i,id:a,onSubmit:u=>{c.mutate(u,{onSuccess:r})},children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(D,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:t(d("Search languages")),children:o.map(u=>e.jsx(h,{value:u.code,children:u.name},u.code))})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:r,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:a,disabled:c.isLoading,children:e.jsx(n,{message:"Save"})})]})]})}function lh(s){return S.post("localizations",s).then(t=>t.data)}function oh(s){const t=Na();return T(a=>lh(a),{onSuccess:()=>{M(d("Localization created")),t.invalidateQueries(Y("localizations"))},onError:a=>J(a,s)})}function ch(){const{trans:s}=A(),{formId:t,close:a}=Z(),r=V({defaultValues:{language:"en"}}),{data:i}=ie(["languages"]),l=(i==null?void 0:i.languages)||[],o=oh(r);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Create localization"})}),e.jsx(X,{children:e.jsxs(ee,{form:r,id:t,onSubmit:c=>{o.mutate(c,{onSuccess:a})},children:[e.jsx(g,{autoFocus:!0,name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-30",required:!0}),e.jsx(D,{required:!0,name:"language",label:e.jsx(n,{message:"Language"}),selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),children:l.map(c=>e.jsx(h,{value:c.code,children:c.name},c.code))})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:a,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:t,disabled:o.isLoading,children:e.jsx(n,{message:"Save"})})]})]})}const dh=""+new URL("around-the-world-df9b11c5.svg",import.meta.url).href,uh=[{key:"name",allowsSorting:!0,sortingKey:"name",visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{key:"language",allowsSorting:!0,sortingKey:"language",header:()=>e.jsx(n,{message:"Language code"}),body:s=>s.language},{key:"updatedAt",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(F,{to:`${s.id}/translate`,children:e.jsx(oe,{label:e.jsx(n,{message:"Translate"}),children:e.jsx(C,{size:"md",children:e.jsx(th,{})})})}),e.jsxs(P,{type:"modal",children:[e.jsx(oe,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{children:e.jsx(de,{})})}),e.jsx(ih,{localization:s})]})]})}];function mh(){return e.jsx(fe,{endpoint:"localizations",title:e.jsx(n,{message:"Localizations"}),columns:uh,actions:e.jsx(xh,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:dh,title:e.jsx(n,{message:"No localizations have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching localizations"})})})}function xh(){return e.jsx(m.Fragment,{children:e.jsxs(P,{type:"modal",children:[e.jsx(ke,{children:e.jsx(n,{message:"Add new localization"})}),e.jsx(ch,{})]})})}function hh(){const{formId:s,close:t}=Z(),a=V();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add translation"})}),e.jsx(X,{children:e.jsxs(ee,{form:a,id:s,onSubmit:r=>{t(r)},children:[e.jsx(Be,{className:"mb-30",title:e.jsx(n,{message:"Add a new translation, if it does not exist already."}),description:e.jsx(n,{message:"This should only need to be done for things like custom menu items."})}),e.jsx(g,{inputElementType:"textarea",rows:2,autoFocus:!0,name:"key",label:e.jsx(n,{message:"Translation key"}),className:"mb-30",required:!0}),e.jsx(g,{inputElementType:"textarea",rows:2,name:"value",label:e.jsx(n,{message:"Translation value"}),required:!0})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:t,children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",form:s,children:e.jsx(n,{message:"Add"})})]})]})}/**
 * react-virtual
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Lt(){return Lt=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},Lt.apply(this,arguments)}/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function kt(){return kt=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},kt.apply(this,arguments)}/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Ms(s,t,a){var r,i=(r=a.initialDeps)!=null?r:[],l;return function(){var o;a.key&&a.debug!=null&&a.debug()&&(o=Date.now());var c=s(),u=c.length!==i.length||c.some(function(k,y){return i[y]!==k});if(!u)return l;i=c;var x;if(a.key&&a.debug!=null&&a.debug()&&(x=Date.now()),l=t.apply(void 0,c),a.key&&a.debug!=null&&a.debug()){var p=Math.round((Date.now()-o)*100)/100,j=Math.round((Date.now()-x)*100)/100,v=j/16,f=function(y,L){for(y=String(y);y.length<L;)y=" "+y;return y};console.info("%c⏱ "+f(j,5)+" /"+f(p,5)+" ms",`
            font-size: .6rem;
            font-weight: bold;
            color: hsl(`+Math.max(0,Math.min(120-120*v,120))+"deg 100% 31%);",a==null?void 0:a.key)}return a==null||a.onChange==null||a.onChange(l),l}}function ta(s,t){if(s===void 0)throw new Error("Unexpected undefined"+(t?": "+t:""));return s}var gh=function(t,a){return Math.abs(t-a)<1};/**
 * virtual-core
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var ph=function(t){return t},jh=function(t){for(var a=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1),i=[],l=a;l<=r;l++)i.push(l);return i},fh=function(t,a){var r=t.scrollElement;if(r){var i=function(c){var u=c.width,x=c.height;a({width:Math.round(u),height:Math.round(x)})};i(r.getBoundingClientRect());var l=new ResizeObserver(function(o){var c=o[0];if(c!=null&&c.borderBoxSize){var u=c.borderBoxSize[0];if(u){i({width:u.inlineSize,height:u.blockSize});return}}i(r.getBoundingClientRect())});return l.observe(r,{box:"border-box"}),function(){l.unobserve(r)}}},bh=function(t,a){var r=t.scrollElement;if(r){var i=function(){a(r[t.options.horizontal?"scrollLeft":"scrollTop"])};return i(),r.addEventListener("scroll",i,{passive:!0}),function(){r.removeEventListener("scroll",i)}}},vh=function(t,a,r){if(a!=null&&a.borderBoxSize){var i=a.borderBoxSize[0];if(i){var l=Math.round(i[r.options.horizontal?"inlineSize":"blockSize"]);return l}}return Math.round(t.getBoundingClientRect()[r.options.horizontal?"width":"height"])},yh=function(t,a,r){var i,l,o=a.adjustments,c=o===void 0?0:o,u=a.behavior,x=t+c;(i=r.scrollElement)==null||i.scrollTo==null||i.scrollTo((l={},l[r.options.horizontal?"left":"top"]=x,l.behavior=u,l))},Ch=function(t){var a=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var r=null,i=function(){return r||(typeof ResizeObserver<"u"?r=new ResizeObserver(function(o){o.forEach(function(c){a._measureElement(c.target,c)})}):null)};return{disconnect:function(){var o;return(o=i())==null?void 0:o.disconnect()},observe:function(o){var c;return(c=i())==null?void 0:c.observe(o,{box:"border-box"})},unobserve:function(o){var c;return(c=i())==null?void 0:c.unobserve(o)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(i){var l=i[0],o=i[1];typeof o>"u"&&delete r[l]}),a.options=kt({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ph,rangeExtractor:jh,onChange:function(){},measureElement:vh,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r)},this.notify=function(){a.options.onChange==null||a.options.onChange(a)},this.cleanup=function(){a.unsubs.filter(Boolean).forEach(function(r){return r()}),a.unsubs=[],a.scrollElement=null},this._didMount=function(){return a.measureElementCache.forEach(a.observer.observe),function(){a.observer.disconnect(),a.cleanup()}},this._willUpdate=function(){var r=a.options.getScrollElement();a.scrollElement!==r&&(a.cleanup(),a.scrollElement=r,a._scrollToOffset(a.scrollOffset,{adjustments:void 0,behavior:void 0}),a.unsubs.push(a.options.observeElementRect(a,function(i){var l=a.scrollRect;a.scrollRect=i,(a.options.horizontal?i.width!==l.width:i.height!==l.height)&&a.maybeNotify()})),a.unsubs.push(a.options.observeElementOffset(a,function(i){a.scrollAdjustments=0,a.scrollOffset!==i&&(a.isScrollingTimeoutId!==null&&(clearTimeout(a.isScrollingTimeoutId),a.isScrollingTimeoutId=null),a.isScrolling=!0,a.scrollDirection=a.scrollOffset<i?"forward":"backward",a.scrollOffset=i,a.maybeNotify(),a.isScrollingTimeoutId=setTimeout(function(){a.isScrollingTimeoutId=null,a.isScrolling=!1,a.scrollDirection=null,a.maybeNotify()},a.options.scrollingDelay))})))},this.getSize=function(){return a.scrollRect[a.options.horizontal?"width":"height"]},this.memoOptions=Ms(function(){return[a.options.count,a.options.paddingStart,a.options.scrollMargin,a.options.getItemKey]},function(r,i,l,o){return a.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:i,scrollMargin:l,getItemKey:o}},{key:!1}),this.getFurthestMeasurement=function(r,i){for(var l=new Map,o=new Map,c=i-1;c>=0;c--){var u=r[c];if(!l.has(u.lane)){var x=o.get(u.lane);if(x==null||u.end>x.end?o.set(u.lane,u):u.end<x.end&&l.set(u.lane,!0),l.size===a.options.lanes)break}}return o.size===a.options.lanes?Array.from(o.values()).sort(function(p,j){return p.end-j.end})[0]:void 0},this.getMeasurements=Ms(function(){return[a.memoOptions(),a.itemSizeCache]},function(r,i){var l=r.count,o=r.paddingStart,c=r.scrollMargin,u=r.getItemKey,x=a.pendingMeasuredCacheIndexes.length>0?Math.min.apply(Math,a.pendingMeasuredCacheIndexes):0;a.pendingMeasuredCacheIndexes=[];for(var p=a.measurementsCache.slice(0,x),j=x;j<l;j++){var v=u(j),f=a.options.lanes===1?p[j-1]:a.getFurthestMeasurement(p,j),k=f?f.end:o+c,y=i.get(v),L=typeof y=="number"?y:a.options.estimateSize(j),N=k+L,z=f?f.lane:j%a.options.lanes;p[j]={index:j,start:k,size:L,end:N,key:v,lane:z}}return a.measurementsCache=p,p},{key:!1,debug:function(){return a.options.debug}}),this.calculateRange=Ms(function(){return[a.getMeasurements(),a.getSize(),a.scrollOffset]},function(r,i,l){return a.range=wh({measurements:r,outerSize:i,scrollOffset:l})},{key:!1,debug:function(){return a.options.debug}}),this.maybeNotify=Ms(function(){var r=a.calculateRange();return[r.startIndex,r.endIndex,a.isScrolling]},function(){a.notify()},{key:!1,debug:function(){return a.options.debug},initialDeps:[this.range.startIndex,this.range.endIndex,this.isScrolling]}),this.getIndexes=Ms(function(){return[a.options.rangeExtractor,a.calculateRange(),a.options.overscan,a.options.count]},function(r,i,l,o){return r(kt({},i,{overscan:l,count:o}))},{key:!1,debug:function(){return a.options.debug}}),this.indexFromElement=function(r){var i=a.options.indexAttribute,l=r.getAttribute(i);return l?parseInt(l,10):(console.warn("Missing attribute name '"+i+"={index}' on measured element."),-1)},this._measureElement=function(r,i){var l,o=a.indexFromElement(r),c=a.measurementsCache[o];if(c){var u=a.measureElementCache.get(c.key);if(!r.isConnected){a.observer.unobserve(r),r===u&&a.measureElementCache.delete(c.key);return}u!==r&&(u&&a.observer.unobserve(u),a.observer.observe(r),a.measureElementCache.set(c.key,r));var x=a.options.measureElement(r,i,a),p=(l=a.itemSizeCache.get(c.key))!=null?l:c.size,j=x-p;j!==0&&(c.start<a.scrollOffset&&a._scrollToOffset(a.scrollOffset,{adjustments:a.scrollAdjustments+=j,behavior:void 0}),a.pendingMeasuredCacheIndexes.push(o),a.itemSizeCache=new Map(a.itemSizeCache.set(c.key,x)),a.notify())}},this.measureElement=function(r){r&&a._measureElement(r,void 0)},this.getVirtualItems=Ms(function(){return[a.getIndexes(),a.getMeasurements()]},function(r,i){for(var l=[],o=0,c=r.length;o<c;o++){var u=r[o],x=i[u];l.push(x)}return l},{key:!1,debug:function(){return a.options.debug}}),this.getVirtualItemForOffset=function(r){var i=a.getMeasurements();return ta(i[Wi(0,i.length-1,function(l){return ta(i[l]).start},r)])},this.getOffsetForAlignment=function(r,i){var l=a.getSize();i==="auto"&&(r<=a.scrollOffset?i="start":r>=a.scrollOffset+l?i="end":i="start"),i==="start"?r=r:i==="end"?r=r-l:i==="center"&&(r=r-l/2);var o=a.options.horizontal?"scrollWidth":"scrollHeight",c=a.scrollElement?"document"in a.scrollElement?a.scrollElement.document.documentElement[o]:a.scrollElement[o]:0,u=c-a.getSize();return Math.max(Math.min(u,r),0)},this.getOffsetForIndex=function(r,i){i===void 0&&(i="auto"),r=Math.max(0,Math.min(r,a.options.count-1));var l=ta(a.getMeasurements()[r]);if(i==="auto")if(l.end>=a.scrollOffset+a.getSize()-a.options.scrollPaddingEnd)i="end";else if(l.start<=a.scrollOffset+a.options.scrollPaddingStart)i="start";else return[a.scrollOffset,i];var o=i==="end"?l.end+a.options.scrollPaddingEnd:l.start-a.options.scrollPaddingStart;return[a.getOffsetForAlignment(o,i),i]},this.isDynamicMode=function(){return a.measureElementCache.size>0},this.cancelScrollToIndex=function(){a.scrollToIndexTimeoutId!==null&&(clearTimeout(a.scrollToIndexTimeoutId),a.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(r,i){var l=i===void 0?{}:i,o=l.align,c=o===void 0?"start":o,u=l.behavior;a.cancelScrollToIndex(),u==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),a._scrollToOffset(a.getOffsetForAlignment(r,c),{adjustments:void 0,behavior:u})},this.scrollToIndex=function(r,i){var l=i===void 0?{}:i,o=l.align,c=o===void 0?"auto":o,u=l.behavior;r=Math.max(0,Math.min(r,a.options.count-1)),a.cancelScrollToIndex(),u==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var x=a.getOffsetForIndex(r,c),p=x[0],j=x[1];a._scrollToOffset(p,{adjustments:void 0,behavior:u}),u!=="smooth"&&a.isDynamicMode()&&(a.scrollToIndexTimeoutId=setTimeout(function(){a.scrollToIndexTimeoutId=null;var v=a.measureElementCache.has(a.options.getItemKey(r));if(v){var f=a.getOffsetForIndex(r,j),k=f[0];gh(k,a.scrollOffset)||a.scrollToIndex(r,{align:j,behavior:u})}else a.scrollToIndex(r,{align:j,behavior:u})}))},this.scrollBy=function(r,i){var l=i===void 0?{}:i,o=l.behavior;a.cancelScrollToIndex(),o==="smooth"&&a.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),a._scrollToOffset(a.scrollOffset+r,{adjustments:void 0,behavior:o})},this.getTotalSize=function(){var r;return(((r=a.getMeasurements()[a.options.count-1])==null?void 0:r.end)||a.options.paddingStart)-a.options.scrollMargin+a.options.paddingEnd},this._scrollToOffset=function(r,i){var l=i.adjustments,o=i.behavior;a.options.scrollToFn(r,{behavior:o,adjustments:l},a)},this.measure=function(){a.itemSizeCache=new Map,a.notify()},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){a.itemSizeCache.set(r.key,r.size)}),this.maybeNotify()},Wi=function(t,a,r,i){for(;t<=a;){var l=(t+a)/2|0,o=r(l);if(o<i)t=l+1;else if(o>i)a=l-1;else return l}return t>0?t-1:0};function wh(s){for(var t=s.measurements,a=s.outerSize,r=s.scrollOffset,i=t.length-1,l=function(x){return t[x].start},o=Wi(0,i,l,r),c=o;c<i&&t[c].end<r+a;)c++;return{startIndex:o,endIndex:c}}/**
 * react-virtual
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var Sh=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Nh(s){var t=m.useReducer(function(){return{}},{})[1],a=Lt({},s,{onChange:function(o){t(),s.onChange==null||s.onChange(o)}}),r=m.useState(function(){return new Ch(a)}),i=r[0];return i.setOptions(a),m.useEffect(function(){return i._didMount()},[]),Sh(function(){return i._willUpdate()}),i}function Lh(s){return Nh(Lt({observeElementRect:fh,observeElementOffset:bh,scrollToFn:yh},s))}function kh(){const{localeId:s}=B(),{data:t,isLoading:a}=ah(s),r=t==null?void 0:t.localization;return a||!r?e.jsx(Ce,{}):e.jsx(_h,{localization:r})}function _h({localization:s}){const[t,a]=m.useState(s.lines||{}),r=Q(),i=Zi(),[l,o]=m.useState("");return e.jsxs("form",{className:"p-14 md:p-24 flex flex-col h-full",onSubmit:c=>{c.preventDefault(),i.mutate({id:s.id,lines:t},{onSuccess:()=>{r("/admin/localizations")}})},children:[e.jsx(Mh,{localization:s,setLines:a,lines:t,searchQuery:l,setSearchQuery:o,isLoading:i.isLoading}),e.jsx(Ih,{lines:t,setLines:a,searchQuery:l})]})}function Mh({localization:s,searchQuery:t,setSearchQuery:a,isLoading:r,lines:i,setLines:l}){const o=Q(),c=Fe(),{trans:u}=A();return e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs(Rr,{size:"lg",className:"mb-16",children:[e.jsx(wt,{onSelected:()=>{o("/admin/localizations")},children:e.jsx(n,{message:"Localizations"})}),e.jsx(wt,{children:e.jsx(n,{message:":locale translations",values:{locale:s.name}})})]}),e.jsxs("div",{className:"mb-24 flex items-center gap-32 md:gap-12",children:[e.jsx("div",{className:"max-w-440 flex-auto",children:e.jsx(qe,{value:t,onChange:x=>a(x.target.value),startAdornment:e.jsx(Mt,{}),placeholder:u({message:"Type to search..."})})}),e.jsxs(P,{type:"modal",onClose:x=>{if(x){const p={...i};p[x.key]=x.value,l(p)}},children:[!c&&e.jsx(b,{className:"ml-auto",variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),children:e.jsx(n,{message:"Add new"})}),e.jsx(hh,{})]}),e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r,children:c?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Save translations"})})]})]})}function Ih({searchQuery:s,lines:t,setLines:a}){const r=m.useMemo(()=>Object.entries(t).filter(([o,c])=>{const u=s==null?void 0:s.toLowerCase();return!u||(o==null?void 0:o.toLowerCase().includes(u))||(c==null?void 0:c.toLowerCase().includes(u))}),[t,s]),i=m.useRef(null),l=Lh({count:r.length,getScrollElement:()=>i.current,estimateSize:()=>123});return e.jsx("div",{className:"flex-auto overflow-y-auto",ref:i,children:e.jsx("div",{className:"relative w-full",style:{height:`${l.getTotalSize()}px`},children:l.getVirtualItems().map(o=>{const[c,u]=r[o.index];return e.jsx("div",{className:"w-full absolute top-0 left-0",style:{height:`${o.size}px`,transform:`translateY(${o.start}px)`},children:e.jsxs("div",{className:"rounded border mb-10 md:mr-10",children:[e.jsxs("div",{className:"flex items-center gap-24 justify-between px-10 py-2 border-b",children:[e.jsx("label",{className:"text-xs font-semibold flex-auto",htmlFor:c,children:c}),e.jsx(C,{size:"xs",className:"text-muted",onClick:()=>{const x={...t};delete x[c],a(x)},children:e.jsx(Ee,{})})]}),e.jsx("div",{children:e.jsx("textarea",{id:c,name:c,defaultValue:u,className:"w-full bg-inherit block rounded resize-none outline-none focus-visible:ring-2 p-10 text-sm",rows:2,onChange:x=>{const p={...t};p[c]=x.target.value,a(p)}})})]})},c)})})})}function Th(){var t;const s=dt();return e.jsxs("div",{className:"container mx-auto p-12 md:p-24",children:[e.jsx(ts,{children:e.jsx(n,{message:"Ads"})}),e.jsx("h1",{className:"mb-20 text-2xl font-light md:mb-40 md:text-3xl",children:e.jsx(n,{message:"Predefined Ad slots"})}),s.isLoading?e.jsx(ms,{isIndeterminate:!0}):e.jsx(Fh,{defaultValues:((t=s.data)==null?void 0:t.client.ads)||{}})]})}function Fh({defaultValues:s}){const{admin:{ads:t}}=m.useContext(Ze),a=V({defaultValues:{client:{ads:s}}}),r=Ui(a);return e.jsxs(ee,{form:a,onSubmit:i=>{r.mutate(i)},children:[t.map(i=>e.jsx(Eh,{adConfig:i},i.slot)),e.jsx($,{name:"client.ads.disable",className:"mb-30",description:e.jsx(n,{message:"Disable all add related functionality across the site."}),children:e.jsx(n,{message:"Disable ads"})}),e.jsx(b,{type:"submit",variant:"flat",color:"primary",disabled:r.isLoading,children:e.jsx(n,{message:"Save"})})]})}function Eh({adConfig:s}){return e.jsxs("div",{className:"flex items-center gap-24",children:[e.jsx(g,{className:"mb-30 flex-auto",name:`client.${s.slot}`,inputElementType:"textarea",rows:8,label:e.jsx(n,{...s.description})}),e.jsxs(P,{type:"modal",children:[e.jsx("button",{type:"button",className:"cursor-zoom-in overflow-hidden rounded outline-none transition hover:scale-105 focus-visible:ring max-md:hidden",children:e.jsx("img",{src:s.image,className:"h-[186px] w-auto border",alt:"Ad slot example"})}),e.jsx(br,{image:s.image})]})]})}function Ph(){const s=Ls(a=>{var r;return(r=a.config)==null?void 0:r.sections}),t=m.useMemo(()=>s?Object.entries(s||[]).map(([a,r])=>({...r,key:a})).sort((a,r)=>((a==null?void 0:a.position)||1)-((r==null?void 0:r.position)||1)):[],[s]);return e.jsx(m.Fragment,{children:t.map(a=>e.jsx($e,{to:a.key,elementType:Ft,children:e.jsx(n,{...a.label})},a.key))})}const zh=[{key:"type",label:d("Type"),description:d("Type of the role"),defaultOperator:O.ne,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Sitewide"),value:"sitewide"},{key:"02",label:d("Workspace"),value:"workspace"}]}},Se({description:d("Date role was created")}),Ne({description:d("Date role was last updated")})],Dh=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Role"}),body:s=>e.jsxs("div",{children:[e.jsx("div",{children:e.jsx(n,{message:s.name})}),e.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:s.description?e.jsx(n,{message:s.description}):void 0})]})},{key:"type",maxWidth:"max-w-100",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx(n,{message:s.type})},{key:"updated_at",maxWidth:"max-w-100",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(F,{to:`${s.id}/edit`,children:e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(de,{})})})}];function Ah(){return e.jsx(fe,{endpoint:"roles",title:e.jsx(n,{message:"Roles"}),columns:Dh,filters:zh,actions:e.jsx($h,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:at,title:e.jsx(n,{message:"No roles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching roles"})})})}function $h(){return e.jsxs(m.Fragment,{children:[e.jsx(Hr,{endpoint:"roles/csv/export"}),e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new role"})})]})}const Qi=s=>`roles/${s}`;function Rh(s){return S.get(Qi(s)).then(t=>t.data)}function Vh(){const{roleId:s}=B();return Ie([Qi(s)],()=>Rh(s))}const Gi=s=>`roles/${s}`;function Oh(){const{trans:s}=A(),t=Q();return T(a=>Uh(a),{onSuccess:a=>{M(s(d("Role updated"))),_.invalidateQueries([Gi(a.role.id)]),_.invalidateQueries(Y("roles")),t("/admin/roles")},onError:a=>q(a)})}function Uh({id:s,...t}){return S.put(Gi(s),t).then(a=>a.data)}function Ki({isInternal:s=!1}){const{trans:t}=A(),{workspaces:a}=xe(),{watch:r}=I(),i=r("type");return e.jsxs(e.Fragment,{children:[e.jsx(g,{label:e.jsx(n,{message:"Name"}),name:"name",className:"mb-20",required:!0}),e.jsx(g,{label:e.jsx(n,{message:"Description"}),name:"description",inputElementType:"textarea",placeholder:t(d("Role description...")),rows:4,className:"mb-20"}),a.integrated&&e.jsxs(D,{label:e.jsx(n,{message:"Type"}),name:"type",selectionMode:"single",className:"mb-20",description:e.jsx(n,{message:"Whether this role will be assigned to users globally on the site or only within workspaces."}),children:[e.jsx(h,{value:"sitewide",children:e.jsx(n,{message:"Sitewide"})}),e.jsx(h,{value:"workspace",children:e.jsx(n,{message:"Workspace"})})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsx($,{name:"default",className:"mb-20",description:e.jsx(n,{message:"Assign this role to new users automatically."}),children:e.jsx(n,{message:"Default"})}),i==="sitewide"&&e.jsx($,{name:"guests",description:e.jsx(n,{message:"Assign this role to guests (not logged in users)."}),children:e.jsx(n,{message:"Guests"})})]}),e.jsx("h2",{className:"mb-10 mt-30 text-lg",children:e.jsx(n,{message:"Permissions"})}),e.jsx(Ja,{name:"permissions",valueListKey:i==="sitewide"?"permissions":"workspacePermissions"})]})}function Bh({onUserSelected:s}){var x;const{close:t}=Z(),[a,r]=m.useState(""),{trans:i}=A(),l=vr(ks,{query:a,perPage:14}),o=((x=l.data)==null?void 0:x.results)||[],c=e.jsx(He,{className:"pt-20",size:"sm",title:e.jsx(n,{message:"No matching users"}),description:e.jsx(n,{message:"Try another search query"}),image:e.jsx(va,{src:at})}),u=p=>{t(),s(p)};return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Select a user"})}),e.jsxs(X,{children:[e.jsx(qe,{autoFocus:!0,className:"mb-20",startAdornment:e.jsx(Mt,{}),placeholder:i(d("Search for user by name or email")),value:a,onChange:p=>{r(p.target.value)}}),!l.isLoading&&!o.length&&c,e.jsx("div",{className:"grid grid-cols-2 gap-x-10",children:o.map(p=>e.jsx(qh,{user:p,onUserSelected:u},p.id))})]})]})}function qh({user:s,onUserSelected:t}){return e.jsxs("div",{className:"flex items-center gap-10 outline-none focus-visible:ring ring-offset-4 hover:bg-hover p-10 rounded",role:"button",tabIndex:0,onClick:()=>{t(s)},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t(s))},children:[e.jsx(Da,{src:s.image}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"text-ellipsis overflow-hidden",children:s.name}),e.jsx("div",{className:"text-muted text-ellipsis overflow-hidden",children:s.description})]})]},s.id)}function Hh(s){return T(({userIds:t})=>Zh({userIds:t,roleId:s.id}),{onSuccess:(t,a)=>{M(d("Removed [one 1 user|other :count users] from “{role}“",{values:{count:a.userIds.length,role:s.name}}))},onError:t=>q(t)})}function Zh({roleId:s,userIds:t}){return S.post(`roles/${s}/remove-users`,{userIds:t}).then(a=>a.data)}function Wh(s){return T(({userIds:t})=>Qh({userIds:t,roleId:s.id}),{onSuccess:(t,a)=>{M(d("Assigned [one 1 user|other :count users] to {role}",{values:{count:a.userIds.length,role:s.name}}))},onError:t=>q(t)})}function Qh({roleId:s,userIds:t}){return S.post(`roles/${s}/add-users`,{userIds:t}).then(a=>a.data)}const Ji={key:"name",allowsSorting:!0,sortingKey:"email",header:()=>e.jsx(n,{message:"User"}),body:s=>e.jsx(ys,{image:s.avatar,label:s.display_name,description:s.email}),width:"col-w-3"},Gh=[Ji,{key:"first_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"First name"}),body:s=>s.first_name},{key:"last_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Last name"}),body:s=>s.last_name},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Assigned at"}),body:s=>e.jsx(ae,{date:s.created_at})}],Kh=[Ji];function Jh({role:s}){const t=Fe();return s.guests||s.type==="workspace"?e.jsx("div",{className:"pt-30 pb-10",children:e.jsx(me,{image:at,title:e.jsx(n,{message:"Users can't be assigned to this role"})})}):e.jsx(qr,{endpoint:"users",columns:t?Kh:Gh,queryParams:{roleId:`${s.id}`},actions:e.jsx(Yh,{role:s}),selectedActions:e.jsx(Xh,{role:s}),emptyStateMessage:e.jsx(me,{image:at,title:e.jsx(n,{message:"No users have been assigned to this role yet"}),filteringTitle:e.jsx(n,{message:"No matching users"})})})}function Yh({role:s}){const t=Wh(s);return e.jsxs(P,{type:"modal",children:[e.jsx(b,{variant:"flat",color:"primary",disabled:t.isLoading,children:e.jsx(n,{message:"Assign user"})}),e.jsx(Bh,{onUserSelected:a=>{t.mutate({userIds:[a.id]},{onSuccess:()=>{_.invalidateQueries(Y("users",{roleId:`${s.id}`}))}})}})]})}function Xh({role:s}){const t=Hh(s),{selectedRows:a}=qa();return e.jsxs(P,{type:"modal",onClose:r=>{r&&t.mutate({userIds:a},{onSuccess:()=>{_.invalidateQueries(Y("users",{roleId:`${s.id}`}))}})},children:[e.jsx(b,{variant:"flat",color:"danger",disabled:t.isLoading,children:e.jsx(n,{message:"Remove users"})}),e.jsx(ce,{title:e.jsx(n,{message:"Remove [one 1 user|other :count users] from “:name“ role?",values:{count:a.length,name:s.name}}),body:e.jsx(n,{message:"This will permanently remove the users."}),confirm:e.jsx(n,{message:"Remove"}),isDanger:!0})]})}function eg(){const s=Vh();return s.status!=="success"?e.jsx(Ce,{}):e.jsx(sg,{role:s.data.role})}function sg({role:s}){const t=V({defaultValues:s}),a=Oh();return e.jsx(Ve,{form:t,onSubmit:r=>{a.mutate(r)},title:e.jsx(n,{message:"Edit “:name“ role",values:{name:s.name}}),isLoading:a.isLoading,children:e.jsxs(ws,{isLazy:!0,children:[e.jsxs(Ss,{children:[e.jsx(Me,{children:e.jsx(n,{message:"Settings"})}),e.jsx(Me,{children:e.jsx(n,{message:"Users"})})]}),e.jsxs(qt,{className:"pt-20",children:[e.jsx(Xe,{children:e.jsx(Ki,{isInternal:s.internal})}),e.jsx(Xe,{children:e.jsx(Jh,{role:s})})]})]})})}const tg="roles";function ag(s){const{trans:t}=A();return T(a=>ng(a),{onSuccess:()=>{M(t(d("Created new role"))),_.invalidateQueries(Y("roles"))},onError:a=>J(a,s)})}function ng({id:s,...t}){return S.post(tg,t).then(a=>a.data)}function rg(){const s=V({defaultValues:{type:"sitewide"}}),t=ag(s),a=Q();return e.jsx(Ve,{form:s,onSubmit:r=>{t.mutate(r,{onSuccess:i=>{a(`/admin/roles/${i.role.id}/edit`)}})},title:e.jsx(n,{message:"Add new role"}),isLoading:t.isLoading,children:e.jsx(Ki,{})})}const ig=s=>[{key:"type",label:d("Type"),description:d("Type of the tag"),defaultOperator:O.ne,control:{type:H.Select,defaultValue:s[0].name,options:s.map(t=>({key:t.name,label:d(t.name),value:t.name}))}},Se({description:d("Date tag was created")}),Ne({description:d("Date tag was last updated")})],an=""+new URL("software-engineer-ba026106.svg",import.meta.url).href;function Yi({form:s,onSubmit:t,formId:a}){const{tags:{types:r}}=m.useContext(Ze),i=s.watch("type"),l=!!r.find(o=>o.name===i&&o.system);return e.jsxs(ee,{id:a,form:s,onSubmit:t,children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique tag identifier."}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(g,{name:"display_name",label:e.jsx(n,{message:"Display name"}),description:e.jsx(n,{message:"User friendly tag name."}),className:"mb-20"}),e.jsx(D,{name:"type",selectionMode:"single",disabled:l,children:r.filter(o=>!o.system).map(o=>e.jsx(h,{value:o.name,children:e.jsx(n,{message:o.name})},o.name))})]})}function lg(s){const{trans:t}=A();return T(a=>og(a),{onSuccess:()=>{M(t(d("Tag created"))),_.invalidateQueries(Y("tags"))},onError:a=>J(a,s)})}function og(s){return S.post("tags",s).then(t=>t.data)}function cg(){const{close:s,formId:t}=Z(),{tags:{types:a}}=m.useContext(Ze),r=V({defaultValues:{type:a[0].name}}),i=lg(r);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx(X,{children:e.jsx(Yi,{formId:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{s()}})}})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}function dg(s){const{trans:t}=A();return T(a=>ug(a),{onSuccess:()=>{M(t(d("Tag updated"))),_.invalidateQueries(Y("tags"))},onError:a=>J(a,s)})}function ug({id:s,...t}){return S.put(`tags/${s}`,t).then(a=>a.data)}function mg({tag:s}){const{close:t,formId:a}=Z(),r=V({defaultValues:{id:s.id,name:s.name,display_name:s.display_name,type:s.type}}),i=dg(r);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Update “:name“ tag",values:{name:s.name}})}),e.jsx(X,{children:e.jsx(Yi,{formId:a,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{t()}})}})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{t()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const xg=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{key:"type",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>s.type},{key:"display_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Display name"}),body:s=>s.display_name},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(de,{})}),e.jsx(mg,{tag:s})]})}];function hg(){const{tags:s}=m.useContext(Ze),t=m.useMemo(()=>ig(s.types),[s.types]);return e.jsx(fe,{endpoint:"tags",title:e.jsx(n,{message:"Tags"}),columns:xg,filters:t,actions:e.jsx(gg,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:an,title:e.jsx(n,{message:"No tags have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching tags"})})})}function gg(){return e.jsx(e.Fragment,{children:e.jsxs(P,{type:"modal",children:[e.jsx(ke,{children:e.jsx(n,{message:"Add new tag"})}),e.jsx(cg,{})]})})}const Xi=m.memo(({bytes:s})=>e.jsx(m.Fragment,{children:or(s)})),pg=E(e.jsx("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}),"VisibilityOutlined"),jg=""+new URL("upload-cabfc914.svg",import.meta.url).href,fg=U.createContext(null);function as(s,t){const{base_url:a}=xe(),r=m.useContext(fg);return m.useMemo(()=>{if(!s)return{};let i;s.url&&(i=mo(s.url)?s.url:`${a}/${s.url}`);const l={previewUrl:i,downloadUrl:`${a}/api/v1/file-entries/download/${(t==null?void 0:t.downloadHashes)||s.hash}`};return r&&(l.previewUrl&&(l.previewUrl=zn(l.previewUrl,{...r,thumbnail:t!=null&&t.thumbnail?"true":""},a)),l.downloadUrl=zn(l.downloadUrl,r,a)),l},[a,s,t==null?void 0:t.downloadHashes,t==null?void 0:t.thumbnail,r])}function zn(s,t,a){const r=new URL(s,a);return Object.entries(t).forEach(([i,l])=>{r.searchParams.append(i,l)}),r.toString()}const nn=U.createContext(null);function ss({message:s,className:t,allowDownload:a}){const{entries:r,activeIndex:i}=m.useContext(nn),l=r[i],o=s||e.jsx(n,{message:"No file preview available"}),{downloadUrl:c}=as(l);return e.jsxs("div",{className:w(t,"shadow bg-paper max-w-400 w-[calc(100%-40px)] text-center p-40 rounded"),children:[e.jsx("div",{className:"text-lg",children:o}),a&&e.jsx("div",{className:"block mt-20 text-center",children:e.jsx(b,{variant:"flat",color:"primary",onClick:()=>{c&&St(c)},children:e.jsx(n,{message:"Download"})})})]})}function bg(s){const{entry:t,className:a}=s,{trans:r}=A(),{previewUrl:i}=as(t);return i?e.jsx("img",{className:w(a,"shadow"),src:i,alt:r({message:"Preview for :name",values:{name:t.name}})}):e.jsx(ss,{...s})}const vg=5242880;function yg(s){const{entry:t,className:a}=s,{trans:r}=A(),[i,l]=m.useState(!1),[o,c]=m.useState(!0),[u,x]=m.useState(!1),[p,j]=m.useState(null),{previewUrl:v}=as(t);return m.useEffect(()=>{t&&(v?t.file_size>=vg?(l(!0),c(!1)):Cg(v).then(f=>{j(f.data)}).catch(()=>{x(!0)}).finally(()=>{c(!1)}):x(!0))},[t,v]),o?e.jsx(ms,{isIndeterminate:!0,"aria-label":r({message:"Loading file contents"})}):i?e.jsx(ss,{...s,message:e.jsx(n,{message:"This file is too large to preview."})}):u?e.jsx(ss,{...s,message:e.jsx(n,{message:"There was an issue previewing this file"})}):e.jsx("pre",{className:w("rounded bg-paper p-20 text-sm whitespace-pre-wrap break-words h-full overflow-y-auto w-full",a),children:e.jsx("div",{className:"container mx-auto",children:`${p}`})})}function Cg(s){return S.get(s,{responseType:"text",withCredentials:!1,headers:{Accept:"text/plain"}})}function wg(s){const{entry:t,className:a}=s,{previewUrl:r}=as(t),i=m.useRef(null),[l,o]=m.useState(!1);return m.useEffect(()=>{var c;o(!((c=i.current)!=null&&c.canPlayType(t.mime)))},[t]),l||!r?e.jsx(ss,{...s}):e.jsx("video",{className:a,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",playsInline:!0,autoPlay:!0,children:e.jsx("source",{src:r,type:t.mime,onError:()=>{o(!0)}})})}function Sg(s){const{entry:t,className:a}=s,{previewUrl:r}=as(t),i=m.useRef(null),[l,o]=m.useState(!1);return m.useEffect(()=>{var c;o(!((c=i.current)!=null&&c.canPlayType(t.mime)))},[t]),l||!r?e.jsx(ss,{...s}):e.jsx("audio",{className:a,ref:i,controls:!0,controlsList:"nodownload noremoteplayback",autoPlay:!0,children:e.jsx("source",{src:r,type:t.mime,onError:()=>{o(!0)}})})}function Ng(s){const{entry:t,className:a}=s,{trans:r}=A(),{previewUrl:i}=as(t);return i?e.jsx("iframe",{title:r({message:"Preview for :name",values:{name:t.name}}),className:w(a,"w-full h-full"),src:`${i}#toolbar=0`}):e.jsx(ss,{...s})}function aa(s){const{entry:t,className:a}=s,{trans:r}=A(),i=m.useRef(null),[l,o]=m.useState(!1),c=m.useRef(),[u,x]=m.useState(!1),{previewUrl:p}=as(t);return m.useEffect(()=>{p?t.file_size&&t.file_size>25e6?o(!0):i.current&&(i.current.onload=()=>{clearTimeout(c.current),x(!1)},Lg(p,t).then(j=>{i.current&&(i.current.src=j)}),c.current=setTimeout(()=>{o(!0)},5e3)):o(!0)},[t,p]),l?e.jsx(ss,{...s}):e.jsxs("div",{className:w(a,"w-full h-full"),children:[u&&e.jsx(ms,{}),e.jsx("iframe",{ref:i,title:r({message:"Preview for :name",values:{name:t.name}}),className:w("w-full h-full",u&&"hidden")})]})}async function Lg(s,t){const a=new URL(s);if(!a.searchParams.has("shareable_link")){const{data:r}=await S.post(`file-entries/${t.id}/add-preview-token`);a.searchParams.append("preview_token",r.preview_token)}return kg(a)}function kg(s){return`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(s.toString())}`}const Dn={text:yg,video:wg,audio:Sg,image:bg,pdf:Ng,spreadsheet:aa,powerPoint:aa,word:aa,"text/rtf":ss};function _g(s){const t=s==null?void 0:s.mime,a=s==null?void 0:s.type;return Dn[t]||Dn[a]||ss}const Mg=E(e.jsx("g",{children:e.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.066406 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.605469 15.835938 12.734375 15.679688 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.738281 21.835938 6.613281 22 6.5 Z M 21 22 C 20.449219 22 20 22.449219 20 23 C 20 23.550781 20.449219 24 21 24 L 37 24 C 37.550781 24 38 23.550781 38 23 C 38 22.449219 37.550781 22 37 22 Z M 41 22 C 40.449219 22 40 22.449219 40 23 C 40 23.550781 40.449219 24 41 24 L 45 24 C 45.550781 24 46 23.550781 46 23 C 46 22.449219 45.550781 22 45 22 Z M 21 26 C 20.449219 26 20 26.449219 20 27 C 20 27.550781 20.449219 28 21 28 L 41 28 C 41.550781 28 42 27.550781 42 27 C 42 26.449219 41.550781 26 41 26 Z M 21 32 C 20.449219 32 20 32.449219 20 33 C 20 33.550781 20.449219 34 21 34 L 43 34 C 43.550781 34 44 33.550781 44 33 C 44 32.449219 43.550781 32 43 32 Z M 21 36 C 20.449219 36 20 36.449219 20 37 C 20 37.550781 20.449219 38 21 38 L 33 38 C 33.550781 38 34 37.550781 34 37 C 34 36.449219 33.550781 36 33 36 Z M 15 50 C 14.449219 50 14 50.449219 14 51 L 14 53 C 14 53.550781 14.449219 54 15 54 C 15.550781 54 16 53.550781 16 53 L 16 51 C 16 50.449219 15.550781 50 15 50 Z M 20 50 C 19.449219 50 19 50.449219 19 51 L 19 53 C 19 53.550781 19.449219 54 20 54 C 20.550781 54 21 53.550781 21 53 L 21 51 C 21 50.449219 20.550781 50 20 50 Z M 25 50 C 24.449219 50 24 50.449219 24 51 L 24 53 C 24 53.550781 24.449219 54 25 54 C 25.550781 54 26 53.550781 26 53 L 26 51 C 26 50.449219 25.550781 50 25 50 Z M 30 50 C 29.449219 50 29 50.449219 29 51 L 29 53 C 29 53.550781 29.449219 54 30 54 C 30.550781 54 31 53.550781 31 53 L 31 51 C 31 50.449219 30.550781 50 30 50 Z M 35 50 C 34.449219 50 34 50.449219 34 51 L 34 53 C 34 53.550781 34.449219 54 35 54 C 35.550781 54 36 53.550781 36 53 L 36 51 C 36 50.449219 35.550781 50 35 50 Z M 40 50 C 39.449219 50 39 50.449219 39 51 L 39 53 C 39 53.550781 39.449219 54 40 54 C 40.550781 54 41 53.550781 41 53 L 41 51 C 41 50.449219 40.550781 50 40 50 Z M 45 50 C 44.449219 50 44 50.449219 44 51 L 44 53 C 44 53.550781 44.449219 54 45 54 C 45.550781 54 46 53.550781 46 53 L 46 51 C 46 50.449219 45.550781 50 45 50 Z M 50 50 C 49.449219 50 49 50.449219 49 51 L 49 53 C 49 53.550781 49.449219 54 50 54 C 50.550781 54 51 53.550781 51 53 L 51 51 C 51 50.449219 50.550781 50 50 50 Z "})})),Ig=E(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 42.78125 18.023438 L 24.78125 22.023438 C 24.328125 22.125 24 22.53125 24 23 L 24 37 C 20.691406 37 18 39.242188 18 42 C 18 44.757813 20.691406 47 24 47 C 27.308594 47 30 44.757813 30 42 L 30 29.910156 L 38 28.136719 L 38 33 C 34.691406 33 32 35.242188 32 38 C 32 40.757813 34.691406 43 38 43 C 41.308594 43 44 40.757813 44 38 L 44 19 C 44 18.695313 43.863281 18.410156 43.625 18.21875 C 43.390625 18.03125 43.082031 17.960938 42.78125 18.023438 Z M 42 20.246094 L 42 38 C 42 39.652344 40.207031 41 38 41 C 35.792969 41 34 39.652344 34 38 C 34 36.347656 35.792969 35 38 35 C 38.28125 35 38.5625 35.023438 38.839844 35.066406 C 39.128906 35.117188 39.421875 35.03125 39.648438 34.84375 C 39.871094 34.652344 40 34.375 40 34.078125 L 40 26.890625 C 40 26.585938 39.863281 26.300781 39.625 26.109375 C 39.390625 25.921875 39.078125 25.847656 38.78125 25.910156 L 28.78125 28.136719 C 28.328125 28.238281 28 28.644531 28 29.109375 L 28 42 C 28 43.652344 26.207031 45 24 45 C 21.792969 45 20 43.652344 20 42 C 20 40.347656 21.792969 39 24 39 C 24.28125 39 24.5625 39.023438 24.839844 39.066406 C 25.128906 39.117188 25.425781 39.03125 25.648438 38.84375 C 25.871094 38.652344 26 38.375 26 38.078125 L 26 23.800781 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),Tg=E(e.jsx("g",{children:e.jsx("path",{d:"M 23.65625 4 C 22.320313 4 21.0625 4.519531 20.121094 5.464844 L 11.464844 14.121094 C 10.519531 15.066406 10 16.320313 10 17.65625 L 10 57 C 10 58.652344 11.347656 60 13 60 L 53 60 C 54.652344 60 56 58.652344 56 57 L 56 7 C 56 5.347656 54.652344 4 53 4 Z M 24 6 L 53 6 C 53.550781 6 54 6.449219 54 7 L 54 57 C 54 57.550781 53.550781 58 53 58 L 13 58 C 12.449219 58 12 57.550781 12 57 L 12 18 L 21 18 C 22.652344 18 24 16.652344 24 15 Z M 22 6.5 L 22 15 C 22 15.550781 21.550781 16 21 16 L 12.5 16 C 12.613281 15.835938 12.738281 15.675781 12.878906 15.535156 L 21.535156 6.878906 C 21.679688 6.734375 21.835938 6.609375 22 6.5 Z M 28.023438 21.816406 C 27.671875 21.808594 27.316406 21.890625 26.996094 22.0625 C 26.355469 22.417969 25.964844 23.085938 25.964844 23.816406 L 25.964844 42.183594 C 25.964844 42.910156 26.355469 43.582031 26.996094 43.933594 C 27.296875 44.097656 27.632813 44.183594 27.964844 44.183594 C 28.335938 44.183594 28.707031 44.078125 29.03125 43.871094 L 43.53125 34.6875 C 44.113281 34.320313 44.464844 33.6875 44.464844 33 C 44.464844 32.308594 44.113281 31.679688 43.53125 31.3125 L 29.03125 22.125 C 28.722656 21.933594 28.375 21.828125 28.023438 21.816406 Z M 27.964844 23.816406 L 42.464844 33 L 27.964844 42.1875 Z M 15 52 C 14.449219 52 14 52.449219 14 53 L 14 55 C 14 55.550781 14.449219 56 15 56 C 15.550781 56 16 55.550781 16 55 L 16 53 C 16 52.449219 15.550781 52 15 52 Z M 20 52 C 19.449219 52 19 52.449219 19 53 L 19 55 C 19 55.550781 19.449219 56 20 56 C 20.550781 56 21 55.550781 21 55 L 21 53 C 21 52.449219 20.550781 52 20 52 Z M 25 52 C 24.449219 52 24 52.449219 24 53 L 24 55 C 24 55.550781 24.449219 56 25 56 C 25.550781 56 26 55.550781 26 55 L 26 53 C 26 52.449219 25.550781 52 25 52 Z M 30 52 C 29.449219 52 29 52.449219 29 53 L 29 55 C 29 55.550781 29.449219 56 30 56 C 30.550781 56 31 55.550781 31 55 L 31 53 C 31 52.449219 30.550781 52 30 52 Z M 35 52 C 34.449219 52 34 52.449219 34 53 L 34 55 C 34 55.550781 34.449219 56 35 56 C 35.550781 56 36 55.550781 36 55 L 36 53 C 36 52.449219 35.550781 52 35 52 Z M 40 52 C 39.449219 52 39 52.449219 39 53 L 39 55 C 39 55.550781 39.449219 56 40 56 C 40.550781 56 41 55.550781 41 55 L 41 53 C 41 52.449219 40.550781 52 40 52 Z M 45 52 C 44.449219 52 44 52.449219 44 53 L 44 55 C 44 55.550781 44.449219 56 45 56 C 45.550781 56 46 55.550781 46 55 L 46 53 C 46 52.449219 45.550781 52 45 52 Z M 50 52 C 49.449219 52 49 52.449219 49 53 L 49 55 C 49 55.550781 49.449219 56 50 56 C 50.550781 56 51 55.550781 51 55 L 51 53 C 51 52.449219 50.550781 52 50 52 Z "})})),Fg=E(e.jsx("g",{children:e.jsx("path",{d:"M 17.660156 4 C 16.320313 4 15.058594 4.519531 14.121094 5.460938 L 5.460938 14.121094 C 4.519531 15.070313 4 16.320313 4 17.660156 L 4 57 C 4 58.648438 5.351563 60 7 60 L 47 60 C 48.648438 60 50 58.648438 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.351563 48.648438 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.613281 15.835938 6.738281 15.679688 6.882813 15.539063 L 15.539063 6.882813 C 15.679688 6.738281 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 24 28 C 23.449219 28 23 28.445313 23 29 C 23 29.554688 23.449219 30 24 30 L 26 30 L 26 39 C 26 39.554688 26.449219 40 27 40 C 27.550781 40 28 39.554688 28 39 L 28 30 L 30 30 C 30.550781 30 31 29.554688 31 29 C 31 28.445313 30.550781 28 30 28 Z M 44 28 C 43.449219 28 43 28.445313 43 29 C 43 29.554688 43.449219 30 44 30 L 46 30 L 46 39 C 46 39.554688 46.449219 40 47 40 C 47.550781 40 48 39.554688 48 39 L 48 30 L 50 30 C 50.550781 30 51 29.554688 51 29 C 51 28.445313 50.550781 28 50 28 Z M 33.859375 28.011719 C 33.730469 28.027344 33.601563 28.070313 33.484375 28.140625 C 33.011719 28.425781 32.859375 29.039063 33.140625 29.515625 L 35.832031 34 L 33.140625 38.484375 C 32.859375 38.957031 33.011719 39.574219 33.484375 39.859375 C 33.644531 39.953125 33.824219 40 34 40 C 34.339844 40 34.671875 39.828125 34.859375 39.515625 L 37 35.941406 L 39.140625 39.515625 C 39.328125 39.828125 39.660156 40 40 40 C 40.175781 40 40.355469 39.953125 40.515625 39.859375 C 40.988281 39.574219 41.140625 38.957031 40.859375 38.484375 L 38.167969 34 L 40.859375 29.515625 C 41.140625 29.042969 40.988281 28.425781 40.515625 28.140625 C 40.042969 27.859375 39.425781 28.011719 39.140625 28.484375 L 37 32.058594 L 34.859375 28.484375 C 34.644531 28.128906 34.246094 27.957031 33.859375 28.011719 Z M 9 52 C 8.449219 52 8 52.445313 8 53 L 8 55 C 8 55.554688 8.449219 56 9 56 C 9.550781 56 10 55.554688 10 55 L 10 53 C 10 52.445313 9.550781 52 9 52 Z M 14 52 C 13.449219 52 13 52.445313 13 53 L 13 55 C 13 55.554688 13.449219 56 14 56 C 14.550781 56 15 55.554688 15 55 L 15 53 C 15 52.445313 14.550781 52 14 52 Z M 19 52 C 18.449219 52 18 52.445313 18 53 L 18 55 C 18 55.554688 18.449219 56 19 56 C 19.550781 56 20 55.554688 20 55 L 20 53 C 20 52.445313 19.550781 52 19 52 Z M 24 52 C 23.449219 52 23 52.445313 23 53 L 23 55 C 23 55.554688 23.449219 56 24 56 C 24.550781 56 25 55.554688 25 55 L 25 53 C 25 52.445313 24.550781 52 24 52 Z M 29 52 C 28.449219 52 28 52.445313 28 53 L 28 55 C 28 55.554688 28.449219 56 29 56 C 29.550781 56 30 55.554688 30 55 L 30 53 C 30 52.445313 29.550781 52 29 52 Z M 34 52 C 33.449219 52 33 52.445313 33 53 L 33 55 C 33 55.554688 33.449219 56 34 56 C 34.550781 56 35 55.554688 35 55 L 35 53 C 35 52.445313 34.550781 52 34 52 Z M 39 52 C 38.449219 52 38 52.445313 38 53 L 38 55 C 38 55.554688 38.449219 56 39 56 C 39.550781 56 40 55.554688 40 55 L 40 53 C 40 52.445313 39.550781 52 39 52 Z M 44 52 C 43.449219 52 43 52.445313 43 53 L 43 55 C 43 55.554688 43.449219 56 44 56 C 44.550781 56 45 55.554688 45 55 L 45 53 C 45 52.445313 44.550781 52 44 52 Z "})})),Eg=E(e.jsx("g",{children:e.jsx("path",{d:"M 17.65625 4 C 16.320313 4 15.066406 4.519531 14.121094 5.464844 L 5.464844 14.121094 C 4.519531 15.066406 4 16.320313 4 17.65625 L 4 57 C 4 58.652344 5.347656 60 7 60 L 47 60 C 48.652344 60 50 58.652344 50 57 L 50 46 L 58 46 C 59.101563 46 60 45.101563 60 44 L 60 24 C 60 22.898438 59.101563 22 58 22 L 50 22 L 50 7 C 50 5.347656 48.652344 4 47 4 Z M 18 6 L 47 6 C 47.550781 6 48 6.449219 48 7 L 48 22 L 16 22 C 14.898438 22 14 22.898438 14 24 L 14 44 C 14 45.101563 14.898438 46 16 46 L 48 46 L 48 57 C 48 57.550781 47.550781 58 47 58 L 7 58 C 6.449219 58 6 57.550781 6 57 L 6 18 L 15 18 C 16.652344 18 18 16.652344 18 15 Z M 16 6.5 L 16 15 C 16 15.550781 15.550781 16 15 16 L 6.5 16 C 6.609375 15.835938 6.734375 15.679688 6.878906 15.535156 L 15.535156 6.878906 C 15.679688 6.734375 15.835938 6.609375 16 6.5 Z M 16 24 L 58 24 L 58 44 L 16 44 Z M 25 28 C 24.445313 28 24 28.449219 24 29 L 24 39 C 24 39.550781 24.445313 40 25 40 C 25.554688 40 26 39.550781 26 39 L 26 36 L 29 36 C 30.652344 36 32 34.652344 32 33 L 32 31 C 32 29.347656 30.652344 28 29 28 Z M 35 28 C 34.445313 28 34 28.449219 34 29 L 34 39 C 34 39.550781 34.445313 40 35 40 L 38 40 C 40.207031 40 42 38.207031 42 36 L 42 32 C 42 29.792969 40.207031 28 38 28 Z M 45 28 C 44.445313 28 44 28.449219 44 29 L 44 39 C 44 39.550781 44.445313 40 45 40 C 45.554688 40 46 39.550781 46 39 L 46 36 L 49 36 C 49.554688 36 50 35.550781 50 35 C 50 34.449219 49.554688 34 49 34 L 46 34 L 46 30 L 50 30 C 50.554688 30 51 29.550781 51 29 C 51 28.449219 50.554688 28 50 28 Z M 26 30 L 29 30 C 29.550781 30 30 30.449219 30 31 L 30 33 C 30 33.550781 29.550781 34 29 34 L 26 34 Z M 36 30 L 38 30 C 39.101563 30 40 30.898438 40 32 L 40 36 C 40 37.101563 39.101563 38 38 38 L 36 38 Z M 9 52 C 8.445313 52 8 52.449219 8 53 L 8 55 C 8 55.550781 8.445313 56 9 56 C 9.554688 56 10 55.550781 10 55 L 10 53 C 10 52.449219 9.554688 52 9 52 Z M 14 52 C 13.445313 52 13 52.449219 13 53 L 13 55 C 13 55.550781 13.445313 56 14 56 C 14.554688 56 15 55.550781 15 55 L 15 53 C 15 52.449219 14.554688 52 14 52 Z M 19 52 C 18.445313 52 18 52.449219 18 53 L 18 55 C 18 55.550781 18.445313 56 19 56 C 19.554688 56 20 55.550781 20 55 L 20 53 C 20 52.449219 19.554688 52 19 52 Z M 24 52 C 23.445313 52 23 52.449219 23 53 L 23 55 C 23 55.550781 23.445313 56 24 56 C 24.554688 56 25 55.550781 25 55 L 25 53 C 25 52.449219 24.554688 52 24 52 Z M 29 52 C 28.445313 52 28 52.449219 28 53 L 28 55 C 28 55.550781 28.445313 56 29 56 C 29.554688 56 30 55.550781 30 55 L 30 53 C 30 52.449219 29.554688 52 29 52 Z M 34 52 C 33.445313 52 33 52.449219 33 53 L 33 55 C 33 55.550781 33.445313 56 34 56 C 34.554688 56 35 55.550781 35 55 L 35 53 C 35 52.449219 34.554688 52 34 52 Z M 39 52 C 38.445313 52 38 52.449219 38 53 L 38 55 C 38 55.550781 38.445313 56 39 56 C 39.554688 56 40 55.550781 40 55 L 40 53 C 40 52.449219 39.554688 52 39 52 Z M 44 52 C 43.445313 52 43 52.449219 43 53 L 43 55 C 43 55.550781 43.445313 56 44 56 C 44.554688 56 45 55.550781 45 55 L 45 53 C 45 52.449219 44.554688 52 44 52 Z "})})),Pg=E(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 36 6 L 36 27.59375 C 35.144531 27.222656 34.210938 27 33.226563 27 L 32.773438 27 C 31.789063 27 30.859375 27.222656 30 27.59375 L 30 9 C 30 8.449219 29.554688 8 29 8 C 28.449219 8 28 8.449219 28 9 L 28 28.902344 C 27.015625 29.824219 26.277344 31.023438 25.953125 32.425781 L 24.875 37.097656 C 24.597656 38.292969 24.878906 39.53125 25.640625 40.488281 C 26.40625 41.449219 27.546875 42 28.769531 42 L 37.230469 42 C 38.457031 42 39.59375 41.449219 40.359375 40.488281 C 41.121094 39.53125 41.402344 38.292969 41.125 37.097656 L 40.046875 32.425781 C 39.726563 31.023438 38.984375 29.824219 38 28.902344 L 38 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.609375 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.609375 20 6.5 Z M 32 8 C 31.449219 8 31 8.445313 31 9 C 31 9.554688 31.449219 10 32 10 L 34 10 C 34.550781 10 35 9.554688 35 9 C 35 8.445313 34.550781 8 34 8 Z M 32 13 C 31.449219 13 31 13.445313 31 14 C 31 14.554688 31.449219 15 32 15 L 34 15 C 34.550781 15 35 14.554688 35 14 C 35 13.445313 34.550781 13 34 13 Z M 32 18 C 31.449219 18 31 18.445313 31 19 C 31 19.554688 31.449219 20 32 20 L 34 20 C 34.550781 20 35 19.554688 35 19 C 35 18.445313 34.550781 18 34 18 Z M 32 23 C 31.449219 23 31 23.445313 31 24 C 31 24.554688 31.449219 25 32 25 L 34 25 C 34.550781 25 35 24.554688 35 24 C 35 23.445313 34.550781 23 34 23 Z M 32.773438 29 L 33.226563 29 C 35.570313 29 37.574219 30.59375 38.097656 32.875 L 39.175781 37.550781 C 39.316406 38.148438 39.175781 38.765625 38.796875 39.246094 C 38.414063 39.722656 37.839844 40 37.230469 40 L 28.769531 40 C 28.160156 40 27.589844 39.722656 27.207031 39.246094 C 26.824219 38.765625 26.683594 38.148438 26.824219 37.550781 L 27.902344 32.875 C 28.429688 30.59375 30.429688 29 32.773438 29 Z M 31 34 C 30.449219 34 30 34.445313 30 35 C 30 35.554688 30.449219 36 31 36 L 35 36 C 35.550781 36 36 35.554688 36 35 C 36 34.445313 35.550781 34 35 34 Z M 13 52 C 12.449219 52 12 52.445313 12 53 C 12 53.554688 12.449219 54 13 54 L 17 54 C 17.550781 54 18 53.554688 18 53 C 18 52.445313 17.550781 52 17 52 Z M 21 52 C 20.449219 52 20 52.445313 20 53 C 20 53.554688 20.449219 54 21 54 L 49 54 C 49.550781 54 50 53.554688 50 53 C 50 52.445313 49.550781 52 49 52 Z "})})),zg=E(e.jsx("g",{children:e.jsx("path",{d:"M 5 10 C 3.300781 10 2 11.300781 2 13 L 2 52 C 2 54.199219 3.800781 56 6 56 L 60 56 C 62.199219 56 64 54.199219 64 52 L 64 23 C 64 21.300781 62.699219 20 61 20 L 58 20 L 58 19 C 58 17.300781 56.699219 16 55 16 L 29.699219 16 C 28.898438 16 28.199219 15.699219 27.597656 15.097656 L 23.902344 11.402344 C 23 10.5 21.699219 10 20.402344 10 Z M 5 12 L 20.402344 12 C 21.199219 12 21.898438 12.300781 22.5 12.902344 L 26.199219 16.597656 C 27.097656 17.5 28.398438 18 29.699219 18 L 55 18 C 55.601563 18 56 18.398438 56 19 L 56 52 C 56 52.601563 56.199219 53.300781 56.597656 54 L 6 54 C 4.898438 54 4 53.101563 4 52 L 4 46 L 45 46 C 45.601563 46 46 45.601563 46 45 C 46 44.398438 45.601563 44 45 44 L 4 44 L 4 13 C 4 12.398438 4.398438 12 5 12 Z M 58 22 L 61 22 C 61.601563 22 62 22.398438 62 23 L 62 52 C 62 53.101563 61.101563 54 60 54 C 58.800781 54 58 52.601563 58 52 Z M 11 24 C 10.398438 24 10 24.398438 10 25 C 10 25.601563 10.398438 26 11 26 L 21 26 C 21.601563 26 22 25.601563 22 25 C 22 24.398438 21.601563 24 21 24 Z M 25 24 C 24.398438 24 24 24.398438 24 25 C 24 25.601563 24.398438 26 25 26 L 31 26 C 31.601563 26 32 25.601563 32 25 C 32 24.398438 31.601563 24 31 24 Z M 11 28 C 10.398438 28 10 28.398438 10 29 C 10 29.601563 10.398438 30 11 30 L 15 30 C 15.601563 30 16 29.601563 16 29 C 16 28.398438 15.601563 28 15 28 Z M 19 28 C 18.398438 28 18 28.398438 18 29 C 18 29.601563 18.398438 30 19 30 L 26 30 C 26.601563 30 27 29.601563 27 29 C 27 28.398438 26.601563 28 26 28 Z M 49 44 C 48.398438 44 48 44.398438 48 45 C 48 45.601563 48.398438 46 49 46 L 53 46 C 53.601563 46 54 45.601563 54 45 C 54 44.398438 53.601563 44 53 44 Z M 7 48 C 6.398438 48 6 48.398438 6 49 L 6 51 C 6 51.601563 6.398438 52 7 52 C 7.601563 52 8 51.601563 8 51 L 8 49 C 8 48.398438 7.601563 48 7 48 Z M 12 48 C 11.398438 48 11 48.398438 11 49 L 11 51 C 11 51.601563 11.398438 52 12 52 C 12.601563 52 13 51.601563 13 51 L 13 49 C 13 48.398438 12.601563 48 12 48 Z M 17 48 C 16.398438 48 16 48.398438 16 49 L 16 51 C 16 51.601563 16.398438 52 17 52 C 17.601563 52 18 51.601563 18 51 L 18 49 C 18 48.398438 17.601563 48 17 48 Z M 22 48 C 21.398438 48 21 48.398438 21 49 L 21 51 C 21 51.601563 21.398438 52 22 52 C 22.601563 52 23 51.601563 23 51 L 23 49 C 23 48.398438 22.601563 48 22 48 Z M 27 48 C 26.398438 48 26 48.398438 26 49 L 26 51 C 26 51.601563 26.398438 52 27 52 C 27.601563 52 28 51.601563 28 51 L 28 49 C 28 48.398438 27.601563 48 27 48 Z M 32 48 C 31.398438 48 31 48.398438 31 49 L 31 51 C 31 51.601563 31.398438 52 32 52 C 32.601563 52 33 51.601563 33 51 L 33 49 C 33 48.398438 32.601563 48 32 48 Z M 37 48 C 36.398438 48 36 48.398438 36 49 L 36 51 C 36 51.601563 36.398438 52 37 52 C 37.601563 52 38 51.601563 38 51 L 38 49 C 38 48.398438 37.601563 48 37 48 Z M 42 48 C 41.398438 48 41 48.398438 41 49 L 41 51 C 41 51.601563 41.398438 52 42 52 C 42.601563 52 43 51.601563 43 51 L 43 49 C 43 48.398438 42.601563 48 42 48 Z M 47 48 C 46.398438 48 46 48.398438 46 49 L 46 51 C 46 51.601563 46.398438 52 47 52 C 47.601563 52 48 51.601563 48 51 L 48 49 C 48 48.398438 47.601563 48 47 48 Z M 52 48 C 51.398438 48 51 48.398438 51 49 L 51 51 C 51 51.601563 51.398438 52 52 52 C 52.601563 52 53 51.601563 53 51 L 53 49 C 53 48.398438 52.601563 48 52 48 Z "})})),Dg=E(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.066406 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.605469 15.835938 10.734375 15.679688 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.738281 19.835938 6.613281 20 6.5 Z M 20 24 C 17.792969 24 16 25.792969 16 28 C 16 30.207031 17.792969 32 20 32 C 22.207031 32 24 30.207031 24 28 C 24 25.792969 22.207031 24 20 24 Z M 20 25.75 C 21.242188 25.75 22.25 26.757813 22.25 28 C 22.25 29.242188 21.242188 30.25 20 30.25 C 18.757813 30.25 17.75 29.242188 17.75 28 C 17.75 26.757813 18.757813 25.75 20 25.75 Z M 37 30.414063 C 36.488281 30.414063 35.976563 30.609375 35.585938 31 L 29 37.585938 L 26.414063 35 C 25.632813 34.21875 24.363281 34.21875 23.585938 35 L 14.585938 44 L 13.042969 44 C 12.417969 44 12 44.398438 12 45 C 12 45.601563 12.523438 46 13.042969 46 L 48.980469 46 C 49.5 46 50.023438 45.601563 50.023438 45 C 50.023438 44.398438 49.5 44 48.980469 44 L 25.414063 44 L 37 32.414063 L 45.292969 40.707031 C 45.683594 41.097656 46.316406 41.097656 46.707031 40.707031 C 47.097656 40.316406 47.097656 39.683594 46.707031 39.292969 L 38.414063 31 C 38.023438 30.609375 37.511719 30.414063 37 30.414063 Z M 25 36.414063 L 27.585938 39 L 22.585938 44 L 17.414063 44 Z M 13 52 C 12.449219 52 12 52.449219 12 53 L 12 55 C 12 55.550781 12.449219 56 13 56 C 13.550781 56 14 55.550781 14 55 L 14 53 C 14 52.449219 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.449219 17 53 L 17 55 C 17 55.550781 17.449219 56 18 56 C 18.550781 56 19 55.550781 19 55 L 19 53 C 19 52.449219 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.449219 22 53 L 22 55 C 22 55.550781 22.449219 56 23 56 C 23.550781 56 24 55.550781 24 55 L 24 53 C 24 52.449219 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.449219 27 53 L 27 55 C 27 55.550781 27.449219 56 28 56 C 28.550781 56 29 55.550781 29 55 L 29 53 C 29 52.449219 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.449219 32 53 L 32 55 C 32 55.550781 32.449219 56 33 56 C 33.550781 56 34 55.550781 34 55 L 34 53 C 34 52.449219 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.449219 37 53 L 37 55 C 37 55.550781 37.449219 56 38 56 C 38.550781 56 39 55.550781 39 55 L 39 53 C 39 52.449219 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.449219 42 53 L 42 55 C 42 55.550781 42.449219 56 43 56 C 43.550781 56 44 55.550781 44 55 L 44 53 C 44 52.449219 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.449219 47 53 L 47 55 C 47 55.550781 47.449219 56 48 56 C 48.550781 56 49 55.550781 49 55 L 49 53 C 49 52.449219 48.550781 52 48 52 Z "})})),Ag=E(e.jsx("g",{children:e.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.667969 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 45.949219 L 52.949219 45.949219 C 53.5 45.949219 53.949219 45.554688 53.949219 45 C 53.949219 44.445313 53.5 44 52.949219 44 L 50 44 L 50 41 C 50 40.445313 49.550781 40 49 40 L 46 40 L 46 37 C 46 36.445313 45.550781 36 45 36 L 41 36 C 40.449219 36 40 36.445313 40 37 L 40 39 L 38 39 L 38 32.46875 C 39.46875 33.449219 41.203125 34 43 34 C 47.960938 34 52 29.964844 52 25 C 52 20.035156 47.960938 16 43 16 C 41.1875 16 39.464844 16.535156 38 17.519531 Z M 42 18.078125 L 42 24.832031 C 42 25.027344 42.070313 25.203125 42.171875 25.359375 C 42.21875 25.492188 42.289063 25.617188 42.394531 25.726563 L 47.234375 30.5625 C 46.054688 31.460938 44.589844 32 43 32 C 41.113281 32 39.316406 31.230469 38 29.886719 L 38 20.105469 C 39.089844 18.992188 40.484375 18.292969 42 18.078125 Z M 44 18.078125 C 47.386719 18.566406 50 21.480469 50 25 C 50 26.546875 49.488281 27.976563 48.636719 29.136719 L 44 24.5 Z M 15 20 C 14.449219 20 14 20.445313 14 21 L 14 41 C 14 41.554688 14.449219 42 15 42 C 15.550781 42 16 41.554688 16 41 L 16 34 L 21 34 C 23.757813 34 26 31.757813 26 29 L 26 25 C 26 22.242188 23.757813 20 21 20 Z M 16 22 L 21 22 C 22.652344 22 24 23.347656 24 25 L 24 29 C 24 30.652344 22.652344 32 21 32 L 16 32 Z M 42 38 L 44 38 L 44 44 L 42 44 Z M 38 41 L 40 41 L 40 44 L 38 44 Z M 46 42 L 48 42 L 48 44 L 46 44 Z "})})),$g=E(e.jsx("g",{children:e.jsx("path",{d:"M 21.65625 4 C 20.320313 4 19.0625 4.519531 18.121094 5.464844 L 9.464844 14.121094 C 8.519531 15.066406 8 16.320313 8 17.65625 L 8 57 C 8 58.652344 9.347656 60 11 60 L 51 60 C 52.652344 60 54 58.652344 54 57 L 54 7 C 54 5.347656 52.652344 4 51 4 Z M 22 6 L 51 6 C 51.550781 6 52 6.449219 52 7 L 52 57 C 52 57.550781 51.550781 58 51 58 L 11 58 C 10.449219 58 10 57.550781 10 57 L 10 18 L 19 18 C 20.652344 18 22 16.652344 22 15 Z M 20 6.5 L 20 15 C 20 15.550781 19.550781 16 19 16 L 10.5 16 C 10.613281 15.832031 10.738281 15.675781 10.878906 15.535156 L 19.535156 6.878906 C 19.679688 6.734375 19.835938 6.609375 20 6.5 Z M 21.140625 23.011719 C 21.015625 22.992188 20.878906 22.996094 20.746094 23.03125 C 20.210938 23.175781 19.894531 23.722656 20.03125 24.253906 L 25.03125 43.253906 C 25.148438 43.691406 25.539063 43.996094 25.984375 44 L 26 44 C 26.441406 44 26.832031 43.710938 26.957031 43.28125 L 31 29.546875 L 35.042969 43.28125 C 35.167969 43.707031 35.558594 44 36 44 L 36.015625 44 C 36.460938 43.992188 36.851563 43.6875 36.96875 43.253906 L 41.96875 24.253906 C 42.105469 23.722656 41.789063 23.175781 41.253906 23.03125 C 40.71875 22.890625 40.171875 23.210938 40.03125 23.746094 L 35.945313 39.273438 L 31.957031 25.71875 C 31.832031 25.292969 31.445313 25 31 25 C 30.554688 25 30.167969 25.292969 30.042969 25.71875 L 26.054688 39.277344 L 21.96875 23.746094 C 21.863281 23.347656 21.527344 23.066406 21.140625 23.011719 Z M 13 52 C 12.449219 52 12 52.445313 12 53 L 12 55 C 12 55.554688 12.449219 56 13 56 C 13.550781 56 14 55.554688 14 55 L 14 53 C 14 52.445313 13.550781 52 13 52 Z M 18 52 C 17.449219 52 17 52.445313 17 53 L 17 55 C 17 55.554688 17.449219 56 18 56 C 18.550781 56 19 55.554688 19 55 L 19 53 C 19 52.445313 18.550781 52 18 52 Z M 23 52 C 22.449219 52 22 52.445313 22 53 L 22 55 C 22 55.554688 22.449219 56 23 56 C 23.550781 56 24 55.554688 24 55 L 24 53 C 24 52.445313 23.550781 52 23 52 Z M 28 52 C 27.449219 52 27 52.445313 27 53 L 27 55 C 27 55.554688 27.449219 56 28 56 C 28.550781 56 29 55.554688 29 55 L 29 53 C 29 52.445313 28.550781 52 28 52 Z M 33 52 C 32.449219 52 32 52.445313 32 53 L 32 55 C 32 55.554688 32.449219 56 33 56 C 33.550781 56 34 55.554688 34 55 L 34 53 C 34 52.445313 33.550781 52 33 52 Z M 38 52 C 37.449219 52 37 52.445313 37 53 L 37 55 C 37 55.554688 37.449219 56 38 56 C 38.550781 56 39 55.554688 39 55 L 39 53 C 39 52.445313 38.550781 52 38 52 Z M 43 52 C 42.449219 52 42 52.445313 42 53 L 42 55 C 42 55.554688 42.449219 56 43 56 C 43.550781 56 44 55.554688 44 55 L 44 53 C 44 52.445313 43.550781 52 43 52 Z M 48 52 C 47.449219 52 47 52.445313 47 53 L 47 55 C 47 55.554688 47.449219 56 48 56 C 48.550781 56 49 55.554688 49 55 L 49 53 C 49 52.445313 48.550781 52 48 52 Z "})})),Rg=E(e.jsx("g",{children:e.jsx("path",{d:"M 35.136719 2.386719 C 34.917969 2.378906 34.699219 2.390625 34.480469 2.429688 L 5.304688 7.578125 C 3.390625 7.917969 2 9.574219 2 11.515625 L 2 50.484375 C 2 52.429688 3.390625 54.085938 5.304688 54.421875 L 34.480469 59.570313 C 34.652344 59.601563 34.828125 59.613281 35 59.613281 C 35.703125 59.613281 36.382813 59.371094 36.925781 58.914063 C 37.609375 58.34375 38 57.503906 38 56.613281 L 38 52 L 57 52 C 58.652344 52 60 50.652344 60 49 L 60 13 C 60 11.347656 58.652344 10 57 10 L 38 10 L 38 5.382813 C 38 4.496094 37.609375 3.65625 36.925781 3.085938 C 36.417969 2.65625 35.789063 2.414063 35.136719 2.386719 Z M 35.105469 4.390625 C 35.359375 4.414063 35.542969 4.535156 35.640625 4.617188 C 35.777344 4.730469 36 4.980469 36 5.382813 L 36 56.613281 C 36 57.019531 35.777344 57.269531 35.640625 57.382813 C 35.507813 57.496094 35.226563 57.671875 34.828125 57.601563 L 5.652344 52.453125 C 4.695313 52.285156 4 51.457031 4 50.484375 L 4 11.515625 C 4 10.542969 4.695313 9.714844 5.652344 9.546875 L 34.824219 4.398438 C 34.925781 4.382813 35.019531 4.378906 35.105469 4.390625 Z M 38 12 L 57 12 C 57.550781 12 58 12.449219 58 13 L 58 49 C 58 49.550781 57.550781 50 57 50 L 38 50 L 38 44 L 41 44 C 41.550781 44 42 43.554688 42 43 C 42 42.445313 41.550781 42 41 42 L 38 42 L 38 38 L 41 38 C 41.550781 38 42 37.554688 42 37 C 42 36.445313 41.550781 36 41 36 L 38 36 L 38 32 L 41 32 C 41.550781 32 42 31.554688 42 31 C 42 30.445313 41.550781 30 41 30 L 38 30 L 38 26 L 41 26 C 41.550781 26 42 25.554688 42 25 C 42 24.445313 41.550781 24 41 24 L 38 24 L 38 20 L 41 20 C 41.550781 20 42 19.554688 42 19 C 42 18.445313 41.550781 18 41 18 L 38 18 Z M 45 18 C 44.449219 18 44 18.445313 44 19 C 44 19.554688 44.449219 20 45 20 L 51 20 C 51.550781 20 52 19.554688 52 19 C 52 18.445313 51.550781 18 51 18 Z M 12.824219 20.015625 C 12.695313 20.039063 12.570313 20.085938 12.453125 20.160156 C 11.992188 20.460938 11.859375 21.082031 12.160156 21.546875 L 18.308594 31 L 12.160156 40.453125 C 11.859375 40.917969 11.992188 41.539063 12.453125 41.839844 C 12.625 41.949219 12.8125 42 13 42 C 13.324219 42 13.648438 41.839844 13.839844 41.546875 L 19.5 32.835938 L 25.160156 41.546875 C 25.351563 41.839844 25.675781 42 26 42 C 26.1875 42 26.375 41.949219 26.546875 41.839844 C 27.007813 41.539063 27.140625 40.917969 26.839844 40.453125 L 20.691406 31 L 26.839844 21.546875 C 27.140625 21.082031 27.007813 20.460938 26.546875 20.160156 C 26.082031 19.859375 25.460938 19.992188 25.160156 20.453125 L 19.5 29.164063 L 13.839844 20.453125 C 13.613281 20.105469 13.207031 19.945313 12.824219 20.015625 Z M 45 24 C 44.449219 24 44 24.445313 44 25 C 44 25.554688 44.449219 26 45 26 L 51 26 C 51.550781 26 52 25.554688 52 25 C 52 24.445313 51.550781 24 51 24 Z M 45 30 C 44.449219 30 44 30.445313 44 31 C 44 31.554688 44.449219 32 45 32 L 51 32 C 51.550781 32 52 31.554688 52 31 C 52 30.445313 51.550781 30 51 30 Z M 45 36 C 44.449219 36 44 36.445313 44 37 C 44 37.554688 44.449219 38 45 38 L 51 38 C 51.550781 38 52 37.554688 52 37 C 52 36.445313 51.550781 36 51 36 Z M 45 42 C 44.449219 42 44 42.445313 44 43 C 44 43.554688 44.449219 44 45 44 L 51 44 C 51.550781 44 52 43.554688 52 43 C 52 42.445313 51.550781 42 51 42 Z "})})),Vg=E(e.jsx("g",{children:e.jsx("path",{d:"M 3 8 C 1.347656 8 0 9.347656 0 11 L 0 52 C 0 54.207031 1.792969 56 4 56 L 58 56 C 60.207031 56 62 54.207031 62 52 L 62 21 C 62 19.347656 60.652344 18 59 18 L 56 18 L 56 17 C 56 15.347656 54.652344 14 53 14 L 27.707031 14 C 26.910156 14 26.164063 13.691406 25.597656 13.132813 L 21.875 9.445313 C 20.929688 8.515625 19.679688 8 18.355469 8 Z M 3 10 L 18.355469 10 C 19.152344 10 19.898438 10.308594 20.464844 10.867188 L 24.1875 14.554688 C 25.132813 15.484375 26.382813 16 27.707031 16 L 53 16 C 53.550781 16 54 16.449219 54 17 L 54 52 C 54 52.617188 54.222656 53.339844 54.632813 54 L 4 54 C 2.898438 54 2 53.101563 2 52 L 2 46 L 43 46 C 43.550781 46 44 45.550781 44 45 C 44 44.449219 43.550781 44 43 44 L 2 44 L 2 11 C 2 10.449219 2.449219 10 3 10 Z M 56 20 L 59 20 C 59.550781 20 60 20.449219 60 21 L 60 52 C 60 53.101563 59.101563 54 58 54 C 56.753906 54 56 52.609375 56 52 Z M 27 22 C 24.242188 22 22 24.242188 22 27 L 22 29 C 22 29.992188 22.300781 30.914063 22.800781 31.691406 C 20.058594 32.886719 17.882813 35.527344 17.28125 38.765625 C 17.179688 39.3125 17.539063 39.832031 18.082031 39.933594 C 18.625 40.035156 19.148438 39.675781 19.25 39.132813 C 19.785156 36.242188 21.863281 33.949219 24.371094 33.234375 C 25.136719 33.710938 26.03125 34 27 34 C 27.96875 34 28.863281 33.710938 29.628906 33.234375 C 32.136719 33.949219 34.214844 36.246094 34.75 39.136719 C 34.839844 39.617188 35.261719 39.953125 35.734375 39.953125 C 35.796875 39.953125 35.855469 39.949219 35.917969 39.9375 C 36.460938 39.835938 36.820313 39.3125 36.71875 38.769531 C 36.117188 35.53125 33.941406 32.886719 31.199219 31.691406 C 31.699219 30.914063 32 29.992188 32 29 L 32 27 C 32 24.242188 29.757813 22 27 22 Z M 27 24 C 28.652344 24 30 25.347656 30 27 L 30 29 C 30 30.652344 28.652344 32 27 32 C 25.347656 32 24 30.652344 24 29 L 24 27 C 24 25.347656 25.347656 24 27 24 Z M 47 44 C 46.449219 44 46 44.449219 46 45 C 46 45.550781 46.449219 46 47 46 L 51 46 C 51.550781 46 52 45.550781 52 45 C 52 44.449219 51.550781 44 51 44 Z M 5 48 C 4.449219 48 4 48.449219 4 49 L 4 51 C 4 51.550781 4.449219 52 5 52 C 5.550781 52 6 51.550781 6 51 L 6 49 C 6 48.449219 5.550781 48 5 48 Z M 10 48 C 9.449219 48 9 48.449219 9 49 L 9 51 C 9 51.550781 9.449219 52 10 52 C 10.550781 52 11 51.550781 11 51 L 11 49 C 11 48.449219 10.550781 48 10 48 Z M 15 48 C 14.449219 48 14 48.449219 14 49 L 14 51 C 14 51.550781 14.449219 52 15 52 C 15.550781 52 16 51.550781 16 51 L 16 49 C 16 48.449219 15.550781 48 15 48 Z M 20 48 C 19.449219 48 19 48.449219 19 49 L 19 51 C 19 51.550781 19.449219 52 20 52 C 20.550781 52 21 51.550781 21 51 L 21 49 C 21 48.449219 20.550781 48 20 48 Z M 25 48 C 24.449219 48 24 48.449219 24 49 L 24 51 C 24 51.550781 24.449219 52 25 52 C 25.550781 52 26 51.550781 26 51 L 26 49 C 26 48.449219 25.550781 48 25 48 Z M 30 48 C 29.449219 48 29 48.449219 29 49 L 29 51 C 29 51.550781 29.449219 52 30 52 C 30.550781 52 31 51.550781 31 51 L 31 49 C 31 48.449219 30.550781 48 30 48 Z M 35 48 C 34.449219 48 34 48.449219 34 49 L 34 51 C 34 51.550781 34.449219 52 35 52 C 35.550781 52 36 51.550781 36 51 L 36 49 C 36 48.449219 35.550781 48 35 48 Z M 40 48 C 39.449219 48 39 48.449219 39 49 L 39 51 C 39 51.550781 39.449219 52 40 52 C 40.550781 52 41 51.550781 41 51 L 41 49 C 41 48.449219 40.550781 48 40 48 Z M 45 48 C 44.449219 48 44 48.449219 44 49 L 44 51 C 44 51.550781 44.449219 52 45 52 C 45.550781 52 46 51.550781 46 51 L 46 49 C 46 48.449219 45.550781 48 45 48 Z M 50 48 C 49.449219 48 49 48.449219 49 49 L 49 51 C 49 51.550781 49.449219 52 50 52 C 50.550781 52 51 51.550781 51 51 L 51 49 C 51 48.449219 50.550781 48 50 48 Z "})}));function el({type:s,mime:t,className:a,size:r}){!s&&t&&(s=t.split("/")[0]);const i=An[s]||An.default;return e.jsx(i,{size:r,className:w(a,`${s}-file-color`),viewBox:"0 0 64 64"})}const An={default:Mg,audio:Ig,video:Tg,text:Fg,pdf:Eg,archive:Pg,folder:zg,sharedFolder:Vg,image:Dg,powerPoint:Ag,word:$g,spreadsheet:Rg},Og=2*1024*1024;function Ug({file:s,className:t,iconClassName:a,showImage:r=!0}){const{trans:i}=A(),{previewUrl:l}=as(s,{thumbnail:!0});if(s.file_size&&s.file_size>Og&&!s.thumbnail&&(r=!1),r&&s.type==="image"&&l){const o=i({message:":fileName thumbnail",values:{fileName:s.name}});return e.jsx("img",{className:w(t,"object-cover"),src:l,alt:o,draggable:!1})}return e.jsx(el,{className:a,type:s.type})}function Bg({entries:s,onClose:t,showHeader:a=!0,className:r,headerActionsLeft:i,allowDownload:l=!0,...o}){const c=Yn("(max-width: 1024px)"),[u,x]=Xs(o.activeIndex,o.defaultActiveIndex||0,o.onActiveIndexChange),p=s[u],j=m.useMemo(()=>({entries:s,activeIndex:u}),[s,u]),v=_g(p);if(!p)return t==null||t(),null;const f=s.length-1>u,k=()=>{x(u+1)},y=u>0,L=()=>{x(u-1)};return e.jsxs(nn.Provider,{value:j,children:[a&&e.jsx(qg,{actionsLeft:i,isMobile:c,onClose:t,onNext:f?k:void 0,onPrevious:y?L:void 0,allowDownload:l}),e.jsxs("div",{className:w("overflow-hidden relative flex-auto",r),children:[c&&e.jsx(C,{size:"lg",className:"text-muted absolute left-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!y,onClick:L,children:e.jsx(Fa,{})}),e.jsx(es,{initial:!1,children:e.jsx(ls.div,{className:"absolute inset-0 flex items-center justify-center",...Ps,children:e.jsx(v,{className:"max-h-[calc(100%-30px)]",entry:p,allowDownload:l})},p.id)}),c&&e.jsx(C,{size:"lg",className:"text-muted absolute right-0 top-1/2 transform -translate-y-1/2 z-10",disabled:!f,onClick:k,children:e.jsx(Dt,{})})]})]})}function qg({onNext:s,onPrevious:t,onClose:a,isMobile:r,actionsLeft:i,allowDownload:l}){const{entries:o,activeIndex:c}=m.useContext(nn),u=o[c],{downloadUrl:x}=as(u),v=r?e.jsx(C,{onClick:()=>{x&&St(x)},children:e.jsx(ua,{})}):e.jsx(b,{startIcon:e.jsx(ua,{}),variant:"text",onClick:()=>{x&&St(x)},children:e.jsx(n,{message:"Download"})});return e.jsxs("div",{className:"flex items-center justify-between gap-20 bg-paper border-b flex-shrink-0 text-sm min-h-50 px-10 text-muted",children:[e.jsxs("div",{className:"flex items-center gap-4 w-1/3 justify-start",children:[i,l?v:void 0]}),e.jsxs("div",{className:"flex items-center gap-10 w-1/3 justify-center flex-nowrap text-main",children:[e.jsx(Ug,{file:u,iconClassName:"w-16 h-16",showImage:!1}),e.jsx("div",{className:"whitespace-nowrap overflow-hidden overflow-ellipsis",children:u.name})]}),e.jsxs("div",{className:"w-1/3 flex items-center gap-10 justify-end whitespace-nowrap",children:[!r&&e.jsxs(m.Fragment,{children:[e.jsx(C,{disabled:!t,onClick:t,children:e.jsx(qo,{})}),e.jsx("div",{children:c+1}),e.jsx("div",{children:"/"}),e.jsx("div",{children:o.length}),e.jsx(C,{disabled:!s,onClick:s,children:e.jsx(zc,{})}),e.jsx("div",{className:"bg-divider w-1 h-24 mx-20"})]}),e.jsx(C,{radius:"rounded-none",onClick:a,children:e.jsx(Ee,{})})]})]})}function Hg(s){return e.jsx(K,{size:"fullscreenTakeover",background:"bg-alt",className:"flex flex-col",children:e.jsx(Zg,{...s})})}function Zg(s){const{close:t}=Z();return e.jsx(Bg,{onClose:t,...s})}const Wg={key:"type",label:d("Type"),description:d("Type of the file"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"05",options:[{key:"02",label:d("Text"),value:"text"},{key:"03",label:d("Audio"),value:"audio"},{key:"04",label:d("Video"),value:"video"},{key:"05",label:d("Image"),value:"image"},{key:"06",label:d("PDF"),value:"pdf"},{key:"07",label:d("Spreadsheet"),value:"spreadsheet"},{key:"08",label:d("Word Document"),value:"word"},{key:"09",label:d("Photoshop"),value:"photoshop"},{key:"10",label:d("Archive"),value:"archive"},{key:"11",label:d("Folder"),value:"folder"}]}},Qg=[Wg,{key:"public",label:d("Visibility"),description:d("Whether file is publicly accessible"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Private"),value:!1},{key:"02",label:d("Public"),value:!0}]}},Se({description:d("Date file was uploaded")}),Ne({description:d("Date file was last changed")}),{key:"owner_id",label:d("Uploader"),description:d("User that this file was uploaded by"),defaultOperator:O.eq,control:{type:H.SelectModel,model:ks}}],Gg=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"overflow-x-hidden overflow-ellipsis",children:s.name}),e.jsx("div",{className:"text-muted text-xs overflow-x-hidden overflow-ellipsis",children:s.file_name})]})},{key:"owner_id",allowsSorting:!0,width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Uploader"}),body:s=>{var a;const t=(a=s.users)==null?void 0:a[0];return t?e.jsx(ys,{image:t.avatar,label:t.display_name,description:t.email}):null}},{key:"type",width:"w-100 flex-shrink-0",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(el,{type:s.type,className:"w-24 h-24 overflow-hidden"}),e.jsx("div",{className:"capitalize",children:s.type})]})},{key:"public",allowsSorting:!0,width:"w-60 flex-shrink-0",header:()=>e.jsx(n,{message:"Public"}),body:s=>s.public?e.jsx(Tt,{className:"icon-md text-positive"}):e.jsx(Ee,{className:"icon-md text-danger"})},{key:"file_size",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"File size"}),body:s=>e.jsx(Xi,{bytes:s.file_size})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(pg,{})}),e.jsx(Hg,{entries:[s]})]})}];function Kg(){return e.jsx(fe,{endpoint:"file-entries",title:e.jsx(n,{message:"Uploaded files and folders"}),columns:Gg,filters:Qg,selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:jg,title:e.jsx(n,{message:"Nothing has been uploaded yet"}),filteringTitle:e.jsx(n,{message:"No matching files or folders"})})})}const Jg=[{key:"ends_at",label:d("Status"),description:d("Whether subscription is active or cancelled"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"active",options:[{key:"active",label:d("Active"),value:{value:null,operator:O.eq}},{key:"cancelled",label:d("Cancelled"),value:{value:null,operator:O.ne}}]}},{control:{type:H.Select,defaultValue:"stripe",options:[{key:"stripe",label:d("Stripe"),value:"stripe"},{key:"paypal",label:d("PayPal"),value:"paypal"},{key:"none",label:d("None"),value:"none"}]},key:"gateway_name",label:d("Gateway"),description:d("With which payment provider was subscription created"),defaultOperator:O.eq},tt({key:"renews_at",label:d("Renew date"),description:d("Date subscription will renew")}),Se({description:d("Date subscription was created")}),Ne({description:d("Date subscription was last updated")})],Yg=""+new URL("subscriptions-7eacea42.svg",import.meta.url).href;function Xg(s){const{trans:t}=A();return T(a=>e5(a),{onSuccess:()=>{M(t(d("Subscription updated"))),_.invalidateQueries(Y("billing/subscriptions"))},onError:a=>J(a,s)})}function e5({id:s,...t}){return S.put(`billing/subscriptions/${s}`,t).then(a=>a.data)}function sl({form:s,onSubmit:t,formId:a}){var o,c;const r=xo(),i=s.watch("product_id"),l=(o=r.data)==null?void 0:o.products.find(u=>u.id===i);return e.jsxs(ee,{id:a,form:s,onSubmit:t,children:[e.jsx(yr,{name:"user_id",className:"mb-20",modelType:ks,label:e.jsx(n,{message:"User"})}),e.jsx(D,{name:"product_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Plan"}),children:(c=r.data)==null?void 0:c.products.filter(u=>!u.free).map(u=>e.jsx(h,{value:u.id,children:e.jsx(n,{message:u.name})},u.id))}),!(l!=null&&l.free)&&e.jsx(D,{name:"price_id",selectionMode:"single",className:"mb-20",label:e.jsx(n,{message:"Price"}),children:l==null?void 0:l.prices.map(u=>e.jsx(h,{value:u.id,children:e.jsx(_a,{price:u})},u.id))}),e.jsx(g,{inputElementType:"textarea",rows:3,name:"description",label:e.jsx(n,{message:"Description"}),className:"mb-20"}),e.jsx(js,{className:"mb-20",name:"renews_at",granularity:"day",label:e.jsx(n,{message:"Renews at"}),description:e.jsx(n,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})}),e.jsx(js,{className:"mb-20",name:"ends_at",granularity:"day",label:e.jsx(n,{message:"Ends at"}),description:e.jsx(n,{message:"This will only change local records. User will continue to be billed on their original cycle on the payment gateway."})})]})}function s5({subscription:s}){const{close:t,formId:a}=Z(),r=V({defaultValues:{id:s.id,product_id:s.product_id,price_id:s.price_id,description:s.description,renews_at:s.renews_at,ends_at:s.ends_at,user_id:s.user_id}}),i=Xg(r);return e.jsxs(K,{size:"md",children:[e.jsx(te,{children:e.jsx(n,{message:"Update subscription"})}),e.jsx(X,{children:e.jsx(sl,{formId:a,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{t()}})}})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{t()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,disabled:i.isLoading,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const tl="billing/subscriptions";function t5(s){const{trans:t}=A();return T(a=>a5(a),{onSuccess:()=>{M(t(d("Subscription created"))),_.invalidateQueries(Y(tl))},onError:a=>J(a,s)})}function a5(s){return S.post(tl,s).then(t=>t.data)}function n5(){const{close:s,formId:t}=Z(),a=V({}),r=t5(a);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx(X,{children:e.jsx(sl,{formId:t,form:a,onSubmit:i=>{r.mutate(i,{onSuccess:()=>{s()}})}})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{s()},children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,disabled:r.isLoading,variant:"flat",color:"primary",type:"submit",children:e.jsx(n,{message:"Save"})})]})]})}const r5=E(e.jsx("path",{d:"M6 19h4V5H6v14zm8-14v14h4V5h-4z"}),"PauseOutlined"),i5=E(e.jsx("path",{d:"M10 8.64 15.27 12 10 15.36V8.64M8 5v14l11-7L8 5z"}),"PlayArrowOutlined"),Ht="billing/subscriptions",l5=[{key:"usr_id",allowsSorting:!0,width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Customer"}),body:s=>e.jsx(ys,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"status",width:"w-100 flex-shrink-0",header:()=>e.jsx(n,{message:"Status"}),body:s=>s.valid?e.jsx(ca,{size:"xs",color:"positive",radius:"rounded",className:"w-max",children:e.jsx(n,{message:"Active"})}):e.jsx(ca,{size:"xs",radius:"rounded",className:"w-max",children:e.jsx(n,{message:"Cancelled"})})},{key:"product_id",allowsSorting:!0,header:()=>e.jsx(n,{message:"Plan"}),body:s=>{var t;return(t=s.product)==null?void 0:t.name}},{key:"gateway",allowsSorting:!0,header:()=>e.jsx(n,{message:"Gateway"}),body:s=>e.jsx("span",{className:"capitalize",children:s.gateway_name})},{key:"renews_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Renews at"}),body:s=>e.jsx(ae,{date:s.renews_at})},{key:"ends_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Ends at"}),body:s=>e.jsx(ae,{date:s.ends_at})},{key:"created_at",allowsSorting:!0,header:()=>e.jsx(n,{message:"Created at"}),body:s=>e.jsx(ae,{date:s.created_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",visibleInMode:"all",width:"w-128 flex-shrink-0",body:s=>e.jsx(d5,{subscription:s})}];function o5(){return e.jsx(fe,{endpoint:Ht,title:e.jsx(n,{message:"Subscriptions"}),columns:l5,filters:Jg,actions:e.jsx(c5,{}),enableSelection:!1,selectedActions:e.jsx(Le,{}),queryParams:{with:"product"},emptyStateMessage:e.jsx(me,{image:Yg,title:e.jsx(n,{message:"No subscriptions have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching subscriptions"})})})}function c5(){return e.jsx(e.Fragment,{children:e.jsxs(P,{type:"modal",children:[e.jsx(ke,{children:e.jsx(n,{message:"Add new subscription"})}),e.jsx(n5,{})]})})}function d5({subscription:s}){return e.jsxs(m.Fragment,{children:[e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(de,{})}),e.jsx(s5,{subscription:s})]}),s.cancelled?e.jsx(m5,{subscription:s}):e.jsx(u5,{subscription:s}),e.jsx(x5,{subscription:s})]})}function u5({subscription:s}){const t=Or(),a=()=>{t.mutate({subscriptionId:s.id},{onSuccess:()=>{_.invalidateQueries(Y(Ht))}})};return e.jsxs(P,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(oe,{label:e.jsx(n,{message:"Cancel subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isLoading,children:e.jsx(r5,{})})}),e.jsx(ce,{title:e.jsx(n,{message:"Cancel subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to cancel this subscription?"}),e.jsx("div",{className:"font-semibold text-sm mt-10",children:e.jsx(n,{message:"This will put user on grace period until their next scheduled renewal date. Subscription can be renewed until that date by user or from admin area."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}function m5({subscription:s}){const t=Dc(),a=()=>{t.mutate({subscriptionId:s.id},{onSuccess:()=>{_.invalidateQueries(Y(Ht))}})};return e.jsxs(P,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(oe,{label:e.jsx(n,{message:"Renew subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",onClick:a,disabled:t.isLoading,children:e.jsx(i5,{})})}),e.jsx(ce,{title:e.jsx(n,{message:"Resume subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to resume this subscription?"}),e.jsx("div",{className:"font-semibold text-sm mt-10",children:e.jsx(n,{message:"This will put user on their original plan and billing cycle."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}function x5({subscription:s}){const t=Or(),a=()=>{t.mutate({subscriptionId:s.id,delete:!0},{onSuccess:()=>{_.invalidateQueries(Y(Ht))}})};return e.jsxs(P,{type:"modal",onClose:r=>{r&&a()},children:[e.jsx(oe,{label:e.jsx(n,{message:"Delete subscription"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isLoading,children:e.jsx(Ee,{})})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete subscription"}),body:e.jsxs("div",{children:[e.jsx(n,{message:"Are you sure you want to delete this subscription?"}),e.jsx("div",{className:"font-semibold text-sm mt-10",children:e.jsx(n,{message:"This will permanently delete the subscription and immediately cancel it on billing gateway. Subscription will not be renewable anymore."})})]}),confirm:e.jsx(n,{message:"Confirm"})})]})}const h5=E(e.jsx("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"SyncOutlined");function g5(){const{trans:s}=A();return T(()=>p5(),{onSuccess:()=>{M(s(d("Plans synced")))},onError:t=>q(t,d("Could not sync plans"))})}function p5(){return S.post("billing/products/sync").then(s=>s.data)}const j5=s=>`billing/products/${s}`;function f5(){const{trans:s}=A();return T(t=>b5(t),{onSuccess:()=>{M(s(d("Plan deleted"))),_.invalidateQueries(Y("billing/products"))},onError:t=>q(t)})}function b5({productId:s}){return S.delete(j5(s)).then(t=>t.data)}const v5=[{key:"subscriptions",label:d("Subscriptions"),description:d("Whether plan has any active subscriptions"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Has active subscriptions"),value:{value:"*",operator:O.has}},{key:"02",label:d("Does not have active subscriptions"),value:{value:"*",operator:O.doesntHave}}]}},Se({description:d("Date plan was created")}),Ne({description:d("Date plan was last updated")})],y5=[{key:"name",allowsSorting:!0,visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>{const t=s.prices[0];return e.jsx(ys,{label:s.name,description:s.free?e.jsx(n,{message:"Free"}):e.jsx(_a,{price:t})})}},{key:"created_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Created"}),body:s=>e.jsx(ae,{date:s.created_at})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),visibleInMode:"all",hideHeader:!0,align:"end",maxWidth:"max-w-84",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`/admin/plans/${s.id}/edit`,children:e.jsx(de,{})}),e.jsx(w5,{product:s})]})}];function C5(){const s=Q();return e.jsx(fe,{endpoint:"billing/products",title:e.jsx(n,{message:"Subscription plans"}),columns:y5,actions:e.jsx(S5,{}),enableSelection:!1,filters:v5,onRowAction:t=>{s(`/admin/plans/${t.id}/edit`)},emptyStateMessage:e.jsx(me,{image:an,title:e.jsx(n,{message:"No plans have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching plans"})})})}function w5({product:s}){const t=f5();return e.jsxs(P,{type:"modal",onClose:a=>{a&&t.mutate({productId:s.id})},children:[e.jsx(oe,{label:e.jsx(n,{message:"Delete plan"}),children:e.jsx(C,{size:"md",className:"text-muted",disabled:t.isLoading,children:e.jsx(We,{})})}),e.jsx(ce,{title:e.jsx(n,{message:"Delete plan"}),body:e.jsx(n,{message:"Are you sure you want to delete this plan?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function S5(){const s=g5();return e.jsxs(m.Fragment,{children:[e.jsx(oe,{label:e.jsx(n,{message:"Sync plans with Stripe & PayPal"}),children:e.jsx(C,{color:"primary",variant:"outline",radius:"rounded",size:"sm",disabled:s.isLoading,onClick:()=>{s.mutate()},children:e.jsx(h5,{})})}),e.jsx(ke,{elementType:F,to:"/admin/plans/new",children:e.jsx(n,{message:"Add new plan"})})]})}const al=s=>`billing/products/${s}`;function N5(){const{productId:s}=B();return Ie([al(s)],()=>L5(s))}function L5(s){return S.get(al(s)).then(t=>t.data)}const fa=[{key:"day1",label:d("Daily"),interval:"day",interval_count:1},{key:"week1",label:d("Weekly"),interval:"week",interval_count:1},{key:"month1",label:d("Monthly"),interval:"month",interval_count:1},{key:"month3",label:d("Every 3 months"),interval:"month",interval_count:3},{key:"month6",label:d("Every 6 months"),interval:"month",interval_count:6},{key:"year1",label:d("Yearly"),interval:"year",interval_count:1},{key:"custom",label:d("Custom"),interval:null,interval_count:null}];function k5({index:s,onRemovePrice:t}){const{trans:a}=A(),r=ie(["currencies"]),i=m.useMemo(()=>{var f;return(f=r.data)!=null&&f.currencies?Object.values(r.data.currencies):[]},[r.data]),{watch:l,getValues:o}=I(),c=!l("id"),u=l(`prices.${s}.id`)==null,x=l(`prices.${s}.subscriptions_count`)||0,[p,j]=m.useState(()=>{const f=o(`prices.${s}.interval`),k=o(`prices.${s}.interval_count`),y=fa.find(L=>L.key===`${f}${k}`);return y?y.key:"custom"}),v=c||u||!x;return e.jsxs(m.Fragment,{children:[!v&&e.jsx("p",{className:"text-muted text-sm max-w-500 mb-20",children:e.jsx(n,{message:"This price can't modified or deleted, because it has [one 1 subscriber|other :count subscribers]. You can instead add a new price.",values:{count:x}})}),e.jsx(g,{required:!0,disabled:!v,label:e.jsx(n,{message:"Amount"}),type:"number",min:.1,step:.01,name:`prices.${s}.amount`,className:"mb-20"}),e.jsx(D,{required:!0,disabled:!v,label:e.jsx(n,{message:"Currency"}),name:`prices.${s}.currency`,items:i,showSearchField:!0,searchPlaceholder:a(d("Search currencies")),selectionMode:"single",className:"mb-20",children:f=>e.jsx(h,{value:f.code,children:`${f.code}: ${f.name}`},f.code)}),e.jsx(_5,{disabled:!v,index:s,value:p,onValueChange:j}),p==="custom"&&e.jsx(M5,{disabled:!v,index:s}),e.jsx("div",{className:"text-right",children:e.jsx(b,{size:"xs",variant:"outline",color:"danger",disabled:!v,onClick:()=>{t()},children:e.jsx(n,{message:"Delete price"})})})]})}function _5({index:s,value:t,onValueChange:a,disabled:r}){const{setValue:i}=I();return e.jsx(os,{label:e.jsx(n,{message:"Billing period"}),disabled:r,className:"mb-20",selectionMode:"single",selectedValue:t,onSelectionChange:l=>{if(a(l),l!=="custom"){const o=fa.find(c=>c.key===l);o&&(i(`prices.${s}.interval`,o.interval),i(`prices.${s}.interval_count`,o.interval_count))}},children:fa.map(l=>e.jsx(h,{value:l.key,children:e.jsx(n,{...l.label})},l.key))})}function M5({index:s,disabled:t}){const{watch:a}=I(),r=a(`prices.${s}.interval`);let i;return r==="day"?i=365:r==="week"?i=52:i=12,e.jsxs("div",{className:"flex border rounded w-min",children:[e.jsx("div",{className:"px-18 flex items-center text-sm",children:e.jsx(n,{message:"Every"})}),e.jsx(g,{inputShadow:"shadow-none",inputBorder:"border-none",className:"border-l border-r w-80",name:`prices.${s}.interval_count`,type:"number",min:1,max:i,disabled:t,required:!0}),e.jsxs(D,{inputShadow:"shadow-none",inputBorder:"border-none",name:`prices.${s}.interval`,selectionMode:"single",disabled:t,children:[e.jsx(h,{value:"day",children:e.jsx(n,{message:"Days"})}),e.jsx(h,{value:"week",children:e.jsx(n,{message:"Weeks"})}),e.jsx(h,{value:"month",children:e.jsx(n,{message:"Months"})})]})]})}function nl(){return e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(g,{name:"description",label:e.jsx(n,{message:"Description"}),className:"mb-20",inputElementType:"textarea",rows:4}),e.jsxs(D,{name:"position",selectionMode:"single",label:e.jsx(n,{message:"Position in pricing table"}),className:"mb-20",children:[e.jsx(h,{value:0,children:e.jsx(n,{message:"First"})}),e.jsx(h,{value:1,children:e.jsx(n,{message:"Second"})}),e.jsx(h,{value:2,children:e.jsx(n,{message:"Third"})}),e.jsx(h,{value:3,children:e.jsx(n,{message:"Fourth"})}),e.jsx(h,{value:4,children:e.jsx(n,{message:"Fifth"})})]}),e.jsx(Ys,{className:"mb-30",name:"available_space",label:e.jsx(n,{message:"Allowed storage space"}),description:e.jsx(n,{values:{a:s=>e.jsx(F,{className:it,target:"_blank",to:"/admin/settings/uploading",children:s})},message:"Total storage space all user uploads are allowed to take up."})}),e.jsx($,{name:"recommended",className:"mb-20",description:e.jsx(n,{message:"Plan will be displayed more prominently on pricing page."}),children:e.jsx(n,{message:"Recommend"})}),e.jsx($,{name:"hidden",className:"mb-20",description:e.jsx(n,{message:"Plan will not be shown on pricing or upgrade pages."}),children:e.jsx(n,{message:"Hidden"})}),e.jsx($,{name:"free",className:"mb-20",description:e.jsx(n,{message:"Will be assigned to all users, if they are not subscribed already."}),children:e.jsx(n,{message:"Free"})}),e.jsx(ba,{children:e.jsx(n,{message:"Feature list"})}),e.jsx(I5,{}),e.jsx(T5,{}),e.jsx(ba,{children:e.jsx(n,{message:"Permissions"})}),e.jsx(Ja,{name:"permissions"})]})}function ba({children:s}){return e.jsx("h2",{className:"mt-40 mb-20 text-base font-semibold",children:s})}function I5(){const{fields:s,append:t,remove:a}=Pe({name:"feature_list"});return e.jsxs("div",{children:[s.map((r,i)=>e.jsxs("div",{className:"flex gap-10 mb-10",children:[e.jsx(g,{name:`feature_list.${i}.value`,size:"sm",className:"flex-auto"}),e.jsx(C,{size:"sm",color:"primary",className:"flex-shrink-0",onClick:()=>{a(i)},children:e.jsx(Ee,{})})]},r.id)),e.jsx(b,{variant:"text",color:"primary",startIcon:e.jsx(ue,{}),size:"xs",onClick:()=>{t({value:""})},children:e.jsx(n,{message:"Add another line"})})]})}function T5(){var l;const{watch:s,formState:{errors:t}}=I(),{fields:a,append:r,remove:i}=Pe({name:"prices",keyName:"key"});return s("free")?null:e.jsxs(m.Fragment,{children:[e.jsx(ba,{children:e.jsx(n,{message:"Pricing"})}),((l=t.prices)==null?void 0:l.message)&&e.jsx("div",{className:"text-sm text-danger mb-20",children:t.prices.message}),e.jsx(Cs,{variant:"outline",className:"mb-10",children:a.map((o,c)=>e.jsx(Ae,{label:e.jsx(_a,{price:o}),children:e.jsx(k5,{index:c,onRemovePrice:()=>{i(c)}})},o.key))}),e.jsx(b,{variant:"text",color:"primary",startIcon:e.jsx(ue,{}),size:"xs",onClick:()=>{r({currency:"USD",amount:1,interval_count:1,interval:"month"})},children:e.jsx(n,{message:"Add another price"})})]})}const rl=s=>`billing/products/${s}`;function F5(s){const{trans:t}=A(),a=Q();return T(r=>E5(r),{onSuccess:r=>{M(t(d("Plan updated"))),_.invalidateQueries([rl(r.product.id)]),_.invalidateQueries(Y("billing/products")),a("/admin/plans")},onError:r=>J(r,s)})}function E5({id:s,...t}){const a={...t,feature_list:t.feature_list.map(r=>r.value)};return S.put(rl(s),a).then(r=>r.data)}function P5(){const s=N5();return s.status!=="success"?e.jsx(Ce,{}):e.jsx(z5,{product:s.data.product})}function z5({product:s}){const t=V({defaultValues:{...s,feature_list:s.feature_list.map(r=>({value:r}))}}),a=F5(t);return e.jsx(Ve,{form:t,onSubmit:r=>{a.mutate(r)},title:e.jsx(n,{message:"Edit “:name“ plan",values:{name:s.name}}),isLoading:a.isLoading,children:e.jsx(nl,{})})}const il="billing/products";function D5(s){const{trans:t}=A(),a=Q();return T(r=>A5(r),{onSuccess:()=>{M(t(d("Plan created"))),_.invalidateQueries([il]),_.invalidateQueries(Y("billing/products")),a("/admin/plans")},onError:r=>J(r,s)})}function A5(s){const t={...s,feature_list:s.feature_list.map(a=>a.value)};return S.post(il,t).then(a=>a.data)}function $5(){const s=V({defaultValues:{free:!1,recommended:!1}}),t=D5(s);return e.jsx(Ve,{form:s,onSubmit:a=>{t.mutate(a)},title:e.jsx(n,{message:"Create new plan"}),isLoading:t.isLoading,children:e.jsx(nl,{})})}function R5(){return e.jsxs(be,{title:e.jsx(n,{message:"GDPR"}),description:e.jsx(n,{message:"Configure settings related to EU General Data Protection Regulation."}),children:[e.jsx(V5,{}),e.jsx(Ue,{}),e.jsx(O5,{})]})}function V5(){const{watch:s}=I(),t=s("client.cookie_notice.enable");return e.jsxs("div",{children:[e.jsx($,{name:"client.cookie_notice.enable",className:"mb-20",description:e.jsx(n,{message:"Whether cookie notice should be shown automatically to users from EU until it is accepted."}),children:e.jsx(n,{message:"Enable cookie notice"})}),t&&e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"border-b pb-6 mb-20",children:[e.jsx("div",{className:"text-sm font-medium border-b pb-10 mb-20",children:e.jsx(n,{message:"Information button"})}),e.jsx(Fs,{hideRoleAndPermissionFields:!0,formPathPrefix:"client.cookie_notice.button"})]}),e.jsxs(D,{name:"client.cookie_notice.position",selectionMode:"single",label:e.jsx(n,{message:"Cookie notice position"}),className:"mb-20",children:[e.jsx(h,{value:"top",children:e.jsx(n,{message:"Top"})}),e.jsx(h,{value:"bottom",children:e.jsx(n,{message:"Bottom"})})]})]})]})}function O5(){const{fields:s,append:t,remove:a}=Pe({name:"client.registration.policies"});return e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-6 text-sm",children:e.jsx(n,{message:"Registration policies"})}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(n,{message:"Create policies that will be shown on registration page. User will be required to accept them by toggling a checkbox."})}),e.jsx(Cs,{className:"mt-16",variant:"outline",children:s.map((r,i)=>e.jsx(Ae,{label:r.label,chevronPosition:"left",endAppend:e.jsx(C,{radius:"rounded",variant:"text",color:"danger",size:"sm",onClick:()=>{a(i)},children:e.jsx(Ee,{})}),children:e.jsx(Fs,{hideRoleAndPermissionFields:!0,formPathPrefix:`client.register_policies.${i}`})},r.id))}),e.jsxs(P,{type:"modal",onClose:r=>{r&&t(r)},children:[e.jsx(b,{className:"mt-12",variant:"link",color:"primary",startIcon:e.jsx(ue,{}),size:"xs",children:e.jsx(n,{message:"Add another policy"})}),e.jsx(Ai,{title:e.jsx(n,{message:"Add policy"})})]})]})}const Zt=E(e.jsx("path",{d:"M9 8a1 1 0 0 0-1-1H5.5a1 1 0 1 0 0 2H7v4a1 1 0 0 0 2 0zM4 0h8a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4zm4 5.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"}),"InfoDialogTrigger");function Wt({title:s,body:t,dialogSize:a="sm",className:r}){return e.jsxs(P,{type:"popover",triggerOnHover:!0,children:[e.jsx(C,{className:w("text-muted opacity-70",r),size:"xs",children:e.jsx(Zt,{viewBox:"0 0 16 16"})}),e.jsxs(K,{size:a,children:[s&&e.jsx(te,{padding:"px-18 pt-12",size:"md",hideDismissButton:!0,children:s}),e.jsx(X,{children:t})]})]})}const U5=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.config.restriction&&s.config.restrictionModelId==="urlParam"?s.name:e.jsx("a",{className:"hover:underline focus-visible:underline outline-none",href:`channel/${s.slug}`,target:"_blank",rel:"noreferrer",children:s.name})},{key:"content_type",allowsSorting:!1,header:()=>e.jsx(n,{message:"Content type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.contentModel?e.jsx(n,{message:s.config.contentModel}):void 0})},{key:"layout",allowsSorting:!1,header:()=>e.jsx(n,{message:"Layout"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.layout?e.jsx(n,{message:s.config.layout}):void 0})},{key:"auto_update",allowsSorting:!1,header:()=>e.jsx(n,{message:"Auto update"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.autoUpdateMethod})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ae,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})}];function B5(){const{trans:s}=A();return T(()=>q5(),{onSuccess:async()=>{await _.invalidateQueries(Y("channel")),M(s(d("Channels reset to default")))},onError:t=>q(t)})}function q5(){return S.post("channel/reset-to-default").then(s=>s.data)}function H5(){return e.jsx(fe,{endpoint:"channel",title:e.jsx(n,{message:"Channels"}),headerContent:e.jsx(Z5,{}),queryParams:{type:"channel"},columns:U5,actions:e.jsx(W5,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:Ho,title:e.jsx(n,{message:"No channels have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching channels"})})})}function Z5(){return e.jsx(Wt,{title:e.jsx(n,{message:"Channels"}),body:e.jsx(n,{message:"Channels are used to display either all content of specific type or manually cured content. They can be shown as separate page or nested."})})}function W5(){return e.jsxs(m.Fragment,{children:[e.jsxs(P,{type:"modal",children:[e.jsx(oe,{label:e.jsx(n,{message:"Reset channels"}),children:e.jsx(C,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:e.jsx(Bi,{})})}),e.jsx(Q5,{})]}),e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new channel"})})]})}function Q5(){const{close:s}=Z(),t=B5();return e.jsx(ce,{isLoading:t.isLoading,onConfirm:()=>{t.mutate(void 0,{onSuccess:()=>s()})},isDanger:!0,title:e.jsx(n,{message:"Reset channels"}),body:e.jsx(n,{message:"Are you sure you want to reset channels to default ones? This will delete any manually created channels and any configuration changes made to them."}),confirm:e.jsx(n,{message:"Reset"})})}const G5=s=>`channel/${s}`;function K5(s){const{trans:t}=A(),a=Q();return T(r=>J5(r),{onSuccess:async()=>{await _.invalidateQueries(Y("channel")),M(t(d("Channel updated"))),a("/admin/channels")},onError:r=>J(r,s)})}function J5({id:s,...t}){return S.put(G5(s),t).then(a=>a.data)}function Y5({children:s}){const t=Zo(void 0,"editChannelPage");return t.data?e.jsx(X5,{channel:t.data.channel,children:s}):e.jsx(hs,{query:t})}function X5({channel:s,children:t}){const a=V({defaultValues:{...s}}),r=K5(a);return e.jsx(Ve,{form:a,onSubmit:i=>{r.mutate(i)},title:e.jsx(n,{message:"Edit “:name“ channel",values:{name:s.name}}),isLoading:r.isLoading,children:t})}function ep({children:s}){return e.jsxs(ws,{isLazy:!0,children:[e.jsxs(Ss,{children:[e.jsx(Me,{children:e.jsx(n,{message:"Details"})}),e.jsx(Me,{children:e.jsx(n,{message:"SEO"})})]}),e.jsxs(qt,{className:"pt-20",children:[e.jsx(Xe,{children:s}),e.jsx(Xe,{children:e.jsx(sp,{})})]})]})}function sp(){return e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"config.seoTitle",label:e.jsx(n,{message:"SEO title"}),className:"mb-24"}),e.jsx(g,{name:"config.seoDescription",label:e.jsx(n,{message:"SEO description"}),inputElementType:"textarea",rows:6})]})}function ll({host:s,value:t="",placeholder:a,onChange:r,className:i,inputRef:l,onInputBlur:o,showLinkIcon:c=!0,pattern:u,minLength:x,maxLength:p,hideButton:j,...v}){const{base_url:f}=xe(),k=v.prefix?`/${v.prefix}`:"",y=v.suffix?`/${v.suffix}`:"",[L,N]=m.useState(!1),[z,R]=m.useState(t);s=s||f,m.useEffect(()=>{R(t)},[t]);const G=()=>{L?(N(!1),z&&(r==null||r(z))):N(!0)};let se="";return z?se=z:a&&(se=ho(a)),e.jsxs("div",{className:w("flex items-center",i),children:[c&&e.jsx(sn,{className:"icon-md text-muted"}),e.jsxs("div",{className:"text-primary ml-6 mr-14",children:[s,k,!L&&se&&e.jsxs(m.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium",children:se})]}),L?null:y]}),L&&e.jsx(qe,{pattern:u,minLength:x,maxLength:p,onKeyDown:he=>{he.key==="Enter"&&G()},ref:l,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:z,onBlur:o,onChange:he=>{R(he.target.value)}}),!j&&e.jsx(b,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{G()},children:L?e.jsx(n,{message:"Save"}):e.jsx(n,{message:"Edit"})})]})}function tp(){return e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-10",required:!0,autoFocus:!0}),e.jsx(ap,{})]})}function ap(){const{watch:s,setValue:t}=I(),a=s("slug"),r=s("name"),i=s("config.lockSlug"),l=s("config.restriction"),o=s("config.restrictionModelId"),{trans:c}=A();return e.jsx(ll,{hideButton:i,placeholder:r,suffix:l&&o==="urlParam"?c(d(":restriction_name",{values:{restriction:l}})):void 0,className:"text-sm",pattern:"[A-Za-z0-9_-]+",minLength:3,maxLength:20,value:a,onChange:u=>{t("slug",u)}})}function np({config:s}){const{setValue:t}=I(),[a,r]=Object.entries(s.models)[0];return e.jsxs(D,{className:"my-24",selectionMode:"single",name:"config.contentType",label:e.jsx(n,{message:"Content"}),onSelectionChange:i=>{var l;t("config.contentModel",a),t("config.restrictionModelId",void 0),t("config.autoUpdateMethod",i==="autoUpdate"?(l=r.autoUpdateMethods)==null?void 0:l[0]:""),t("config.contentOrder",r.sortMethods[0]),t("config.restriction","")},children:[e.jsx(h,{value:"listAll",children:e.jsx(n,{message:"List all content of specified type"})}),e.jsx(h,{value:"manual",children:e.jsx(n,{message:"Manage content manually"})}),e.jsx(h,{value:"autoUpdate",children:e.jsx(n,{message:"Automatically update content with specified method"})})]})}function rp({children:s,config:t}){var l;const{watch:a,setValue:r}=I(),i=t.models[a("config.contentModel")];return a("config.contentType")!=="autoUpdate"||!((l=i.autoUpdateMethods)!=null&&l.length)?null:e.jsxs("div",{className:"md:flex items-end my-24 gap-14",children:[e.jsx(D,{required:!0,className:"flex-auto",selectionMode:"single",name:"config.autoUpdateMethod",onSelectionChange:o=>{t.autoUpdateMethods[o].localOnly?r("config.autoUpdateProvider","local"):t.autoUpdateMethods[o].tmdbOnly&&r("config.autoUpdateProvider","tmdb")},label:e.jsxs(m.Fragment,{children:[e.jsx(n,{message:"Auto update method"}),e.jsx(Wt,{body:e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"mb-20",children:e.jsx(n,{message:"This option will automatically update channel content every 24 hours using the specified method."})}),e.jsx(Os,{link:"https://support.vebto.com/help-center/articles/28/31/170/channels"})]})})]}),children:i.autoUpdateMethods.map(o=>e.jsx(h,{value:o,children:e.jsx(n,{...t.autoUpdateMethods[o].label})},o))}),s]})}function ip({config:s}){return e.jsxs("div",{className:"md:flex items-end my-24 gap-14",children:[e.jsx($n,{config:s,name:"config.layout",label:e.jsx(n,{message:"Layout"})}),e.jsx($n,{config:s,name:"config.nestedLayout",label:e.jsx(n,{message:"Layout when nested"})})]})}function $n({config:s,name:t,label:a}){var o;const{watch:r}=I(),i=r("config.contentModel"),l=s.models[i];return(o=l.layoutMethods)!=null&&o.length?e.jsx(D,{className:"flex-auto w-full",selectionMode:"single",name:t,label:a,children:l.layoutMethods.map(c=>{const u=s.layoutMethods[c].label;return e.jsx(h,{value:c,children:e.jsx(n,{...u})},c)})}):null}const ps="keyword",lp=[zs,Cr,Wo],ol={[st]:d("Genre"),[ps]:d("Keyword"),[Vt]:d("Production country")};function op(){const{setValue:s}=I(),{watch:t}=I();return lp.includes(t("config.contentModel"))?e.jsxs("div",{className:"my-24 items-end gap-14 md:flex",children:[e.jsxs(D,{className:"w-full flex-auto",name:"config.restriction",selectionMode:"single",label:e.jsx(n,{message:"Filter titles by"}),labelSuffix:e.jsx(dp,{}),onSelectionChange:()=>{s("config.restrictionModelId","urlParam")},children:[e.jsx(h,{value:null,children:e.jsx(n,{message:"Don't filter titles"})}),Object.entries(ol).map(([a,r])=>e.jsx(h,{value:a,children:e.jsx(n,{...r})},a))]}),e.jsx(cp,{})]}):null}function cp(){var p,j;const{trans:s}=A(),[t,a]=m.useState(""),{watch:r}=I(),{data:i}=ie(["genres","productionCountries"],{type:r("config.autoUpdateProvider")}),l=r("config.restriction"),o=r("config.restrictionModelId"),c=ie(["keywords"],{searchQuery:t,selectedValue:o,type:r("config.autoUpdateProvider")});if(!l)return null;const u={[st]:i==null?void 0:i.genres,[ps]:(p=c.data)==null?void 0:p.keywords,[Vt]:i==null?void 0:i.productionCountries},x=ol[l];return e.jsxs(D,{className:"w-full flex-auto",name:"config.restrictionModelId",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search...")),isAsync:l===ps,isLoading:l===ps&&c.isLoading,inputValue:t,onInputValueChange:a,label:e.jsx(n,{message:":restriction name",values:{restriction:s(x)}}),children:[e.jsx(h,{value:"urlParam",children:e.jsx(n,{message:"Dynamic (from url)"})}),(j=u[l])==null?void 0:j.map(v=>e.jsx(h,{value:v.value,children:e.jsx(n,{message:v.name})},v.value))]})}function dp(){return e.jsx(Wt,{title:e.jsx(n,{message:"Content filtering"}),body:e.jsx(n,{message:"Allows specifying additional condition channel content should be filtered on. If 'Dynamic (from url)' is selected, filter from url will be used. For example, a single channel configured to filter by dynamic genre would show action titles at 'site.com/genre/action', comedies at 'site.com/genre/comedy' and so on, for any genre."})})}function cl(){return e.jsxs(m.Fragment,{children:[e.jsxs(ep,{children:[e.jsx(tp,{}),e.jsx(g,{name:"description",label:e.jsx(n,{message:"Description"}),inputElementType:"textarea",rows:2,className:"my-24"}),e.jsx(np,{config:Ts}),e.jsx(mp,{}),e.jsx(Qo,{config:Ts,className:"my-24"}),e.jsx(op,{}),e.jsx(Go,{config:Ts}),e.jsx(ip,{config:Ts}),e.jsx($,{className:"mb-24",name:"config.hideTitle",description:e.jsx(n,{message:"Whether title should be shown when displaying this channel on the site."}),children:e.jsx(n,{message:"Hide title"})})]}),e.jsx(Ko,{searchField:e.jsx(up,{})})]})}function up(s){return e.jsx(Jo,{...s,imgRenderer:t=>e.jsx(Yo,{item:t})})}function mp(){const{tmdb_is_setup:s}=xe(),{watch:t}=I(),a=Ts.autoUpdateMethods[t("config.autoUpdateMethod")];return e.jsx(rp,{config:Ts,children:!(a!=null&&a.localOnly)&&!(a!=null&&a.tmdbOnly)&&s&&e.jsxs(D,{selectionMode:"single",className:"mt-24 flex-auto md:mt-0",name:"config.autoUpdateProvider",label:e.jsx(n,{message:"Fetch content from"}),required:!0,children:[e.jsx(h,{value:"tmdb",children:e.jsx(n,{message:"TheMovieDB"})}),e.jsx(h,{value:"local",children:e.jsx(n,{message:"Local database"})})]})})}function xp(){return e.jsx(Y5,{children:e.jsx(cl,{})})}const dl="channel";function hp(s){const{trans:t}=A(),a=Q(),r=Na();return T(i=>gp(i),{onSuccess:async i=>{await r.invalidateQueries(Y(dl)),M(t(d("Channel created"))),a(`/admin/channels/${i.channel.id}/edit`,{replace:!0})},onError:i=>J(i,s)})}function gp(s){return S.post(dl,s).then(t=>t.data)}function pp({defaultValues:s,children:t}){const a=V({defaultValues:{content:Xo.pagination,config:{contentType:"listAll",contentOrder:"created_at:desc",nestedLayout:"carousel",...s}}}),r=hp(a);return e.jsx(Ve,{form:a,onSubmit:i=>{r.mutate(i)},title:e.jsx(n,{message:"Add new channel"}),isLoading:r.isLoading,children:t})}function jp(){return e.jsx(pp,{defaultValues:{contentModel:Cr,autoUpdateProvider:"local",layout:"grid",nestedLayout:"carousel"},children:e.jsx(cl,{})})}const fp=[Se({description:d("Date article was created")}),Ne({description:d("Date article was last updated")})],bp=""+new URL("online-articles-1ec8936a.svg",import.meta.url).href;function vp(){return T(s=>yp(s),{onError:s=>q(s),onSuccess:async()=>{await _.invalidateQueries(Y("news")),M(d("Article deleted"))}})}function yp(s){return S.delete(`news/${s.articleId}`).then(t=>t.data)}const Cp=[{key:"name",width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(n,{message:"Title"}),body:s=>e.jsx(wp,{article:s})},{key:"updatedAt",allowsSorting:!0,width:"w-96",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx("time",{children:e.jsx(ae,{date:s.updated_at})})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),width:"w-84 flex-shrink-0",hideHeader:!0,align:"end",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(F,{to:`${s.id}/edit`,children:e.jsx(oe,{label:e.jsx(n,{message:"Edit article"}),children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})}),e.jsxs(P,{type:"modal",children:[e.jsx(oe,{label:e.jsx(n,{message:"Delete article"}),children:e.jsx(C,{children:e.jsx(We,{})})}),e.jsx(Sp,{article:s})]})]})}];function wp({article:s}){const{isCollapsedMode:t}=m.useContext(Ot);return e.jsxs("div",{className:"flex gap-14",children:[e.jsx(ec,{article:s,size:"w-52 h-52",lazy:!1}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:w(t?"whitespace-normal":"font-medium whitespace-nowrap overflow-hidden overflow-ellipsis"),children:e.jsx(sc,{article:s,target:"_blank"})}),!t&&e.jsx("p",{className:"text-muted mt-4 text-xs max-w-680 whitespace-normal",children:s.body})]})]})}function Sp({article:s}){const t=vp(),{close:a}=Z();return e.jsx(ce,{isDanger:!0,isLoading:t.isLoading,title:e.jsx(n,{message:"Delete article"}),body:e.jsx(n,{message:"Are you sure you want to delete this article?"}),confirm:e.jsx(n,{message:"Delete"}),onConfirm:()=>{t.mutate({articleId:s.id},{onSuccess:()=>a()})}})}const rn=E(e.jsx("path",{d:"M5 4h14v2H5zm0 10h4v6h6v-6h4l-7-7-7 7zm8-2v6h-2v-6H9.83L12 9.83 14.17 12H13z"}),"PublishOutlined");function Np(){return T(()=>Lp(),{onSuccess:async()=>{await _.invalidateQueries(["news"]),M(d("Imported news articles"))},onError:s=>q(s)})}function Lp(){return S.post("news/import-from-remote-provider").then(s=>s.data)}function kp(){return e.jsx(fe,{endpoint:"news",title:e.jsx(n,{message:"News articles"}),filters:fp,columns:Cp,queryParams:{stripHtml:"true",truncateBody:200},actions:e.jsx(_p,{}),selectedActions:e.jsx(Le,{}),enableSelection:!1,cellHeight:"h-80",emptyStateMessage:e.jsx(me,{image:bp,title:e.jsx(n,{message:"No articles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching articles"})})})}function _p(){const s=Np();return e.jsxs(m.Fragment,{children:[e.jsx(oe,{label:e.jsx(n,{message:"Import news articles"}),children:e.jsx(C,{variant:"outline",color:"primary",radius:"rounded",size:"sm",onClick:()=>s.mutate(),disabled:s.isLoading,children:e.jsx(rn,{})})}),e.jsx(ke,{elementType:F,to:"add",children:e.jsx(n,{message:"Add news article"})})]})}function ul({commentIds:s,variant:t="outline",size:a="xs"}){const r=tc();return e.jsxs(P,{type:"modal",onClose:i=>{i&&r.mutate({commentIds:s},{onSuccess:()=>{_.invalidateQueries(["comment"])}})},children:[e.jsx(b,{variant:t,size:a,color:"danger",className:"mr-10",disabled:r.isLoading,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete [one comment|other :count comments]",values:{count:s.length}}),body:s.length>1?e.jsx(n,{message:"Are you sure you want to delete selected comments?"}):e.jsx(n,{message:"Are you sure you want to delete this comment?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function Mp(){return T(s=>Ip(s),{onSuccess:()=>{M(d("Comment updated")),_.invalidateQueries(["comment"])},onError:s=>q(s)})}function Ip({commentId:s,content:t}){return S.put(`comment/${s}`,{content:t}).then(a=>a.data)}function Tp(){return T(s=>Fp(s),{onSuccess:(s,t)=>{M(d("Restored [one 1 comment|other :count comments]",{values:{count:t.commentIds.length}}))},onError:s=>q(s)})}function Fp({commentIds:s}){return S.post("comment/restore",{commentIds:s}).then(t=>t.data)}function Ep({commentIds:s,variant:t="outline",size:a="xs"}){const r=Tp();return e.jsx(b,{variant:t,size:a,className:"mr-10",disabled:r.isLoading,color:"primary",onClick:()=>{r.mutate({commentIds:s},{onSuccess:()=>{_.invalidateQueries(["comment"])}})},children:e.jsx(n,{message:"Restore"})})}function Pp({comment:s,isSelected:t,onToggle:a}){const[r,i]=m.useState(!1);return e.jsxs("div",{className:w("p-14 border-b",s.deleted&&"bg-danger/6"),children:[s.commentable&&e.jsx(zp,{isSelected:t,onToggle:a,commentable:s.commentable}),e.jsxs("div",{className:"flex items-start gap-10 pt-14 md:pl-20",children:[e.jsx(Aa,{className:"flex-shrink-0",user:s.user,size:"md"}),e.jsxs("div",{className:"flex-auto",children:[e.jsx(Dp,{comment:s}),r?e.jsx(Ap,{comment:s,onClose:l=>{i(!1),l&&_.invalidateQueries(["comment"])}}):e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"text-sm my-14",children:s.content}),e.jsxs("div",{children:[s.deleted?e.jsx(Ep,{commentIds:[s.id]}):e.jsx(ul,{commentIds:[s.id]}),e.jsx(b,{variant:"outline",size:"xs",onClick:()=>{i(!0)},children:e.jsx(n,{message:"Edit"})})]})]})]})]})]})}function zp({isSelected:s,onToggle:t,commentable:a}){return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-14",children:e.jsx(La,{checked:s,onChange:()=>t()})}),a.image&&e.jsx("img",{className:"w-20 h-20 rounded overflow-hidden object-cover mr-6",src:a.image,alt:""}),e.jsx("div",{className:"text-sm mr-4",children:a.name}),e.jsxs("div",{className:"text-muted text-xs",children:["(",a.model_type,")"]})]})}function Dp({comment:s}){return e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx("div",{children:s.user&&e.jsx(Rn,{user:s.user,show:"display_name"})}),e.jsx("div",{children:"•"}),e.jsx("time",{children:e.jsx(cr,{date:s.created_at})}),s.user&&e.jsx("div",{className:"ml-auto hidden md:block",children:e.jsx(Rn,{user:s.user,show:"email"})})]})}function Ap({comment:s,onClose:t}){const[a,r]=m.useState(s.content),i=Mp();return e.jsxs("form",{onSubmit:l=>{l.preventDefault(),i.mutate({commentId:s.id,content:a},{onSuccess:()=>t(!0)})},children:[e.jsx(qe,{autoFocus:!0,inputElementType:"textarea",className:"my-14",rows:2,value:a,onChange:l=>r(l.target.value)}),e.jsx(b,{size:"xs",variant:"outline",color:"primary",type:"submit",className:"mr-6",disabled:i.isLoading,children:e.jsx(n,{message:"Save edit"})}),e.jsx(b,{size:"xs",variant:"outline",className:"mr-6",onClick:l=>t(!1),disabled:i.isLoading,children:e.jsx(n,{message:"Cancel"})})]})}function Rn({user:s,show:t}){const{auth:a}=m.useContext(Ze);return a.getUserProfileLink?e.jsx(F,{to:a.getUserProfileLink(s),className:it,target:"_blank",children:s[t]}):e.jsx("div",{className:"text-muted",children:s[t]})}const $p=""+new URL("public-discussion-7f74dab5.svg",import.meta.url).href,Rp=[{key:"deleted",label:d("Status"),description:d("Whether comment is active or deleted"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:d("Active"),value:!1},{key:"02",label:d("Deleted"),value:!0}]}},{key:"user_id",label:d("User"),description:d("User comment was created by"),defaultOperator:O.eq,control:{type:H.SelectModel,model:ks}},Se({description:d("Date comment was created")}),Ne({description:d("Date comment was last updated")})];function ml({hideTitle:s,commentable:t}){var v;const a=m.useMemo(()=>Rp.filter(f=>f.key!=="commentable_id"||!t),[t]),{encodedFilters:r}=At(a),[i,l]=m.useState({perPage:15}),[o,c]=m.useState([]),u=Ea("comment",{...i,with:"commentable",filters:r,commentable_type:t==null?void 0:t.model_type,commentable_id:t==null?void 0:t.id},{onSuccess:()=>{c([])}}),x=m.useCallback(f=>{const k=[...o];if(!k.includes(f))k.push(f);else{const y=k.indexOf(f);k.splice(y,1)}c(k)},[o,c]),p=!!(i.query||i.filters||r),j=(v=u.data)==null?void 0:v.pagination;return e.jsxs("div",{className:w(!s&&"p-12 md:p-24"),children:[e.jsxs("div",{className:w("mb-16"),children:[e.jsx(ts,{children:e.jsx(n,{message:"Comments"})}),!s&&e.jsx("h1",{className:"text-3xl font-light",children:e.jsx(n,{message:"Comments"})})]}),e.jsxs("div",{children:[e.jsx(es,{initial:!1,mode:"wait",children:o.length?e.jsx(Wa,{selectedItemsCount:o.length,actions:e.jsx(ul,{size:"sm",variant:"flat",commentIds:o})},"selected"):e.jsx(Za,{filters:a,searchValue:i.query,onSearchChange:f=>l({...i,query:f})},"default")}),e.jsx($t,{className:"mb-14",filters:a}),u.isLoading?e.jsx(Ce,{className:"min-h-200"}):e.jsx("div",{className:"border-x border-t rounded",children:j==null?void 0:j.data.map(f=>e.jsx(Pp,{comment:f,isSelected:o.includes(f.id),onToggle:()=>x(f.id)},f.id))}),(u.isFetched||u.isPreviousData)&&!(j!=null&&j.data.length)?e.jsx(me,{className:"pt-50",isFiltering:p,image:$p,title:e.jsx(n,{message:"No comments have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching comments"})}):void 0,e.jsx(Ha,{className:"mt-10",query:u,onPageChange:f=>l({...i,page:f}),onPerPageChange:f=>l({...i,perPage:f})})]})]})}const Vp=""+new URL("reviews-b904b01e.svg",import.meta.url).href;function xl({reviewIds:s,variant:t="outline",size:a="xs"}){const r=ac();return e.jsxs(P,{type:"modal",onClose:i=>{i&&r.mutate({reviewIds:s})},children:[e.jsx(b,{variant:t,size:a,color:"danger",className:"mr-10",disabled:r.isLoading,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete [one review|other :count reviews]",values:{count:s.length}}),body:s.length>1?e.jsx(n,{message:"Are you sure you want to delete selected reviews?"}):e.jsx(n,{message:"Are you sure you want to delete this review?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function Op(s,t){return T(a=>Up(s,a),{onSuccess:()=>{_.invalidateQueries(["reviews"]),M(d("Review updated"))},onError:a=>t?J(a,t):q(a)})}function Up(s,t){return S.put(`reviews/${s.id}`,{score:t.score,title:t.title,body:t.body}).then(a=>a.data)}function Bp({review:s,isSelected:t,onToggle:a}){const[r,i]=m.useState(!1),l=s.helpful_count||1,o=s.helpful_count+s.not_helpful_count||1;return e.jsxs("div",{className:"border-b p-14",children:[s.reviewable&&e.jsx(qp,{isSelected:t,onToggle:a,reviewable:s.reviewable}),e.jsxs("div",{className:"flex items-start gap-10 pt-14 md:pl-20",children:[e.jsx(Aa,{className:"flex-shrink-0",user:s.user,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-auto overflow-hidden",children:[e.jsx(Hp,{review:s}),r?e.jsx(Zp,{review:s,onClose:c=>{i(!1),c&&_.invalidateQueries(["comment"])}}):e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"my-14",children:[e.jsx(wr,{className:"mb-8",score:s.score}),s.title&&e.jsx("div",{className:"mb-8 text-base font-medium",children:s.title}),e.jsx("div",{className:"whitespace-break-spaces text-sm",children:s.body}),e.jsx("div",{className:"mt-8 text-xs text-muted",children:e.jsxs(nc,{children:[e.jsx(n,{message:":helpfulCount out of :total people found this helpful",values:{helpfulCount:l,total:o}}),s.reports_count?e.jsx(n,{message:":count reports",values:{count:s.reports_count||0}}):null]})})]}),e.jsxs("div",{children:[e.jsx(xl,{reviewIds:[s.id]}),e.jsx(b,{variant:"outline",size:"xs",onClick:()=>i(!0),children:e.jsx(n,{message:"Edit"})})]})]})]})]})]})}function qp({isSelected:s,onToggle:t,reviewable:a}){return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"mr-14",children:e.jsx(La,{checked:s,onChange:()=>t()})}),a.image&&e.jsx("img",{className:"mr-6 h-20 w-20 overflow-hidden rounded object-cover",src:a.image,alt:""}),e.jsx("div",{className:"mr-4 text-sm",children:a.name}),e.jsxs("div",{className:"text-xs text-muted",children:["(",a.model_type,")"]})]})}function Hp({review:s}){return e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx("div",{children:s.user&&e.jsx(Vn,{user:s.user,show:"display_name"})}),e.jsx("div",{children:"•"}),e.jsx("time",{children:e.jsx(cr,{date:s.created_at})}),s.user&&e.jsx("div",{className:"ml-auto hidden md:block",children:e.jsx(Vn,{user:s.user,show:"email"})})]})}function Zp({review:s,onClose:t}){m.useState(s.body);const a=Op(s),r=V({defaultValues:{score:s.score,title:s.title,body:s.body}});return e.jsxs(ee,{className:"mt-24",form:r,onSubmit:i=>{a.mutate(i,{onSuccess:()=>t(!0)})},children:[e.jsx(rc,{className:"-ml-8 mb-12",count:10,value:r.watch("score"),onValueChange:i=>{r.setValue("score",i)}}),e.jsx(g,{name:"title",className:"mb-24",label:e.jsx(n,{message:"Title"}),labelSuffix:e.jsx(n,{message:"10 character minimum"}),autoFocus:!0,minLength:10,required:!0}),e.jsx(g,{className:"mb-24",name:"body",label:e.jsx(n,{message:"Review"}),labelSuffix:e.jsx(n,{message:"100 character minimum"}),inputElementType:"textarea",rows:5,minLength:100,required:!0}),e.jsx(b,{size:"xs",variant:"outline",color:"primary",type:"submit",className:"mr-6",disabled:a.isLoading,children:e.jsx(n,{message:"Save"})}),e.jsx(b,{size:"xs",variant:"outline",className:"mr-6",onClick:i=>t(!1),disabled:a.isLoading,children:e.jsx(n,{message:"Cancel"})})]})}function Vn({user:s,show:t}){const{auth:a}=m.useContext(Ze);return a.getUserProfileLink?e.jsx(F,{to:a.getUserProfileLink(s),className:it,target:"_blank",children:s[t]}):e.jsx("div",{className:"text-muted",children:s[t]})}const Wp=[{key:"user_id",label:d("User"),description:d("User review was created by"),defaultOperator:O.eq,control:{type:H.SelectModel,model:ks}},{key:"reviewable_id",label:d("Title"),description:d("Movie or series review was created for"),defaultOperator:O.eq,extraFilters:[{key:"reviewable_type",operator:O.eq,value:"App\\Title"}],control:{type:H.SelectModel,model:zs}},{key:"score",label:d("Score"),description:d("Review score"),defaultOperator:O.gte,operators:Ks,control:{type:H.Input,inputType:"number",minValue:1,maxValue:10,defaultValue:7}},{key:"helpful_count",label:d("Helpful count"),description:d("How many users found this review helpful"),defaultOperator:O.gte,operators:Ks,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:10}},{key:"not_helpful_count",label:d("Not helpful count"),description:d("How many users found this review not helpful"),defaultOperator:O.gte,operators:Ks,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:10}},Se({description:d("Date review was created")}),Ne({description:d("Date review was last updated")})];function hl({hideTitle:s,reviewable:t}){var L;const a=m.useMemo(()=>Wp.filter(N=>N.key!=="reviewable_id"||!t),[t]),{encodedFilters:r}=At(a),[i,l]=m.useState({perPage:15}),[o,c]=m.useState([]),[u,x]=m.useState("created_at:desc"),[p,j]=u.split(":"),v=Ea("reviews",{...i,orderBy:p,orderDir:j,with:"reviewable,user",filters:r,reviewable_type:t==null?void 0:t.model_type,reviewable_id:t==null?void 0:t.id},{onSuccess:()=>c([])}),f=m.useCallback(N=>{const z=[...o];if(!z.includes(N))z.push(N);else{const R=z.indexOf(N);z.splice(R,1)}c(z)},[o,c]),k=!!(i.query||i.filters||r),y=(L=v.data)==null?void 0:L.pagination;return e.jsxs("div",{className:w(!s&&"p-12 md:p-24"),children:[e.jsxs("div",{className:w("mb-16"),children:[e.jsx(ts,{children:e.jsx(n,{message:"Reviews"})}),!s&&e.jsx("h1",{className:"text-3xl font-light",children:e.jsx(n,{message:"Reviews"})})]}),e.jsxs("div",{children:[e.jsx(es,{initial:!1,mode:"wait",children:o.length?e.jsx(Wa,{selectedItemsCount:o.length,actions:e.jsx(xl,{size:"sm",variant:"flat",reviewIds:o})},"selected"):e.jsx(Za,{filters:a,searchValue:i.query,onSearchChange:N=>l({...i,query:N}),actions:e.jsx(ic,{value:u,onValueChange:N=>x(N),color:"primary",showReportsItem:!0})},"default")}),e.jsx($t,{className:"mb-14",filters:a}),v.isLoading?e.jsx(Ce,{className:"min-h-200"}):e.jsx("div",{className:"border-x border-t rounded",children:y==null?void 0:y.data.map(N=>e.jsx(Bp,{review:N,isSelected:o.includes(N.id),onToggle:()=>f(N.id)},N.id))}),(v.isFetched||v.isPreviousData)&&!(y!=null&&y.data.length)?e.jsx(me,{className:"pt-50",isFiltering:k,image:Vp,title:e.jsx(n,{message:"No reviews have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching reviews"})}):void 0,e.jsx(Ha,{className:"mt-10",query:v,onPageChange:N=>l({...i,page:N}),onPerPageChange:N=>l({...i,perPage:N})})]})]})}const Qp=""+new URL("video-files-a4728f55.svg",import.meta.url).href;function Gp({value:s}){return s?e.jsx(Tt,{className:"icon-md text-positive"}):e.jsx(Ee,{className:"icon-md text-danger"})}const gl=E(e.jsx("path",{d:"M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z"}),"BarChartOutlined"),Kp=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Video"}),body:s=>{var t;return e.jsxs("div",{className:"flex items-center gap-12",children:[s.title?e.jsx(Ds,{title:s.title,srcSize:"sm",size:"w-32",aspect:"aspect-square"}):null,e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsxs(F,{to:ct(s),target:"_blank",className:"hover:underline",children:[(t=s.title)==null?void 0:t.name,s.season_num|s.episode_num?e.jsxs("span",{children:[" ","(",e.jsx(Sr,{seasonNum:s.season_num,episodeNum:s.episode_num}),")"]}):null]})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.name})]})]})}},{key:"type",allowsSorting:!0,header:()=>e.jsx(n,{message:"Type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.type})},{key:"category",allowsSorting:!0,header:()=>e.jsx(n,{message:"Category"}),body:s=>e.jsx("span",{className:"capitalize",children:s.category})},{key:"approved",allowsSorting:!0,header:()=>e.jsx(n,{message:"Approved"}),body:s=>e.jsx(Gp,{value:s.approved}),width:"w-80 flex-shrink-0"},{key:"plays_count",allowsSorting:!0,header:()=>e.jsx(n,{message:"Plays"}),body:s=>s.plays_count?e.jsx(Re,{value:s.plays_count}):null,width:"w-80 flex-shrink-0"},{key:"reports_count",allowsSorting:!0,header:()=>e.jsx(n,{message:"Reports"}),body:s=>s.reports_count?e.jsx(Re,{value:s.reports_count}):null,width:"w-80 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ae,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/insights`,children:e.jsx(gl,{})}),e.jsx(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})]})}];function Jp(s){const{value:t,filter:a}=s,{isLoading:r,data:i}=lc(zs,t),l=e.jsxs(m.Fragment,{children:[e.jsx(et,{variant:"avatar",size:"w-18 h-18 mr-6"}),e.jsx(et,{variant:"rect",size:"w-50"})]}),o=e.jsxs(m.Fragment,{children:[e.jsx(Da,{size:"xs",src:i==null?void 0:i.model.image,className:"mr-6"}),i==null?void 0:i.model.name]}),c=r||!i?l:o,u=a.control.panel;return e.jsx(oc,{...s,label:c,panel:e.jsx(u,{filter:a})})}function Yp(s){return Ie(["titles","autocomplete",s],()=>Xp(s),{keepPreviousData:!0})}function Xp(s){return S.get("titles/autocomplete",{params:s}).then(t=>t.data)}function pl({name:s,seasonName:t,episodeName:a,disableTitleField:r,className:i}){var L,N;const{trans:l}=A(),o=I(),c=o.watch(s),[u,x]=m.useState(""),p=t?o.watch(t):void 0,j=Yp({searchQuery:u,selectedTitleId:c,seasonNumber:p}),v=j.isLoading||j.isPreviousData,f=(L=j.data)==null?void 0:L.titles.find(z=>z.id===c),k=(f==null?void 0:f.seasons_count)||0,y=(f==null?void 0:f.episodes_count)||0;return e.jsxs("div",{className:i,children:[e.jsx(D,{selectionMode:"single",name:s,label:e.jsx(n,{message:"Title"}),placeholder:l(d("Select a title")),showSearchField:!0,searchPlaceholder:l(d("Search titles")),inputValue:u,onInputValueChange:x,isAsync:!0,isLoading:v,required:!0,disabled:r,children:(N=j.data)==null?void 0:N.titles.map(z=>e.jsx(h,{value:z.id,description:z.description,startIcon:e.jsx(Da,{src:z.image}),children:z.name},z.id))}),k>0&&t&&e.jsxs(D,{className:"mt-12",name:t,placeholder:l(d("Select a season (optional)")),selectionMode:"single",label:e.jsx(n,{message:"Season"}),children:[e.jsx(h,{value:"",onSelected:()=>o.resetField(t),children:e.jsx(n,{message:"None"})},"none"),[...new Array(k).keys()].map(z=>{const R=z+1;return e.jsx(h,{value:R,children:e.jsx(n,{message:"Season :number",values:{number:R}})},R)})]}),y>0&&a&&e.jsxs(D,{className:"mt-12",name:a,placeholder:l(d("Select an episode (optional)")),selectionMode:"single",label:e.jsx(n,{message:"Episode"}),children:[e.jsx(h,{value:"",onSelected:()=>o.resetField(a),children:e.jsx(n,{message:"None"})},"none"),[...new Array(y).keys()].map(z=>{const R=z+1;return e.jsx(h,{value:R,children:e.jsx(n,{message:"Episode :number",values:{number:R}})},R)})]})]})}function e1({filter:s}){return e.jsx(pl,{name:`${s.key}.value`,seasonName:`${s.key}.season`,episodeName:`${s.key}.episode`})}const jl=[{key:"user_id",label:d("User"),description:d("User video was created by"),defaultOperator:O.eq,control:{type:H.SelectModel,model:ks}},{key:"title_id",label:d("Title"),description:d("Movie or series video was created for"),defaultOperator:O.eq,control:{type:H.Custom,panel:e1,listItem:Jp}},{key:"approved",label:d("Status"),description:d("Whether video is approved or not"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:!1,options:[{label:d("Approved"),key:"approved",value:!0},{label:d("Not approved"),key:"not_approved",value:!1}]}},{key:"origin",label:d("Origin"),description:d("Whether video origin is local or external"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"local",options:[{label:d("Local"),key:"local",value:"local"},{label:d("External"),key:"external",value:{operator:O.ne,value:"local"}}]}},{key:"type",label:d("Type"),description:d("Type of the video"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"embed",options:[{label:d("Embed"),key:"embed",value:"embed"},{label:d("Direct Video"),key:"video",value:"video"},{label:d("Stream"),key:"stream",value:"stream"},{label:d("Remote Link"),key:"remote",value:"remote"}]}},{key:"quality",label:d("Quality"),description:d("Quality of video"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"hd",options:[{label:d("HD"),key:"hd",value:"hd"},{label:d("SD"),key:"sd",value:"sd"},{label:d("Stream"),key:"stream",value:"stream"},{label:d("Remote Link"),key:"remote",value:"remote"}]}},{key:"category",label:d("Category"),description:d("Video category"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"trailer",options:[{label:d("Trailer"),key:"trailer",value:"trailer"},{label:d("Full Movie or episode"),key:"full",value:"full"},{label:d("Clip"),key:"clip",value:"clip"},{label:d("Teaser"),key:"teaser",value:"teaser"},{label:d("Featurette"),key:"featurette",value:"featurette"},{label:d("Behind the scenes"),key:"behind_the_scenes",value:"behind the scenes"}]}},Se({description:d("Date video was created")}),Ne({description:d("Date video was last updated")})];function s1(){return e.jsx(fe,{endpoint:"videos",queryParams:{withCount:"plays,reports",with:"episode"},title:e.jsx(n,{message:"Videos"}),columns:Kp,filters:jl,actions:e.jsx(t1,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:Qp,title:e.jsx(n,{message:"No videos have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching videos"})})})}function t1(){return e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add video"})})}function a1(s){return T(t=>n1(t),{onSuccess:async()=>{await _.invalidateQueries(["video"])},onError:t=>s?J(t,s):q(t)})}function n1(s){return S.post("videos",s).then(t=>t.data)}function r1(s,t={enabled:!0}){const a=l1(s);return Ie(["file-entries",`${a}`],()=>i1(a),{enabled:!!a&&t.enabled})}function i1(s){return S.get(`file-entries/${s}/model`).then(t=>t.data)}function l1(s){if(!s)return;const t=parseInt(s);return isNaN(t)?`${s}`.split("/").pop():t}function o1({className:s,label:t,description:a,value:r,onChange:i,diskPrefix:l,disk:o=Ma.uploads,showRemoveButton:c,invalid:u,errorMessage:x,required:p,autoFocus:j,disabled:v,allowedFileTypes:f,maxFileSize:k}){const{uploadFile:y,entry:L,uploadStatus:N,deleteEntry:z,isDeletingEntry:R,percentage:G}=dr(),se=m.useRef(null);go({autoFocus:j},se);const{data:he}=r1(r,{enabled:!L&&!!r}),je=m.useId(),Zs=t?`${je}-label`:void 0,Ge=a?`${je}-description`:void 0,_s=r||(L==null?void 0:L.url),Ke=L||(he==null?void 0:he.fileEntry),gn={showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:f,maxFileSize:k},metadata:{diskPrefix:l,disk:o},onSuccess:De=>i==null?void 0:i(De.url),onError:De=>{De&&M.danger(De)}},jt=Ca({description:a,descriptionPosition:"top",invalid:u,disabled:v||N==="inProgress"}),Vl=c?e.jsx(b,{variant:"link",color:"danger",size:"xs",disabled:R||!_s||v,onClick:()=>{z({onSuccess:()=>i==null?void 0:i("")})},children:e.jsx(n,{message:"Remove file"})}):null,Ol=m.useCallback(()=>{var De;(De=se.current)==null||De.click()},[]);return e.jsxs("div",{className:w("text-sm",s),children:[t&&e.jsxs("div",{className:"flex items-center justify-between gap-24",children:[e.jsx("div",{id:Zs,className:jt.label,children:t}),Vl]}),a&&e.jsx("div",{className:jt.description,children:a}),e.jsx("div",{"aria-labelledby":Zs,"aria-describedby":Ge,children:e.jsxs(ka,{fieldClassNames:jt,errorMessage:x,invalid:u,children:[e.jsx(c1,{inputFieldClassNames:jt,currentValue:_s,currentEntry:Ke,handleUpload:Ol,children:e.jsx("input",{ref:se,"aria-labelledby":Zs,"aria-describedby":Ge,required:_s?!1:p,accept:f==null?void 0:f.join(","),type:"file",disabled:N==="inProgress",className:"sr-only",onChange:De=>{var pn;if((pn=De.target.files)!=null&&pn.length){const jn=ur(new po(De.target.files[0]),gn.restrictions);jn&&se.current?(se.current.value="",M.danger(jn)):y(De.target.files[0],gn)}}})}),N==="inProgress"&&e.jsx(It,{className:"absolute left-0 right-0 top-0",size:"xs",value:G})]})})]})}function c1({children:s,inputFieldClassNames:t,currentValue:a,currentEntry:r,handleUpload:i}){const l=m.useRef(null);return a?e.jsx(ka,{wrapperProps:{onClick:()=>{var o,c;(o=l.current)==null||o.focus(),(c=l.current)==null||c.click()}},fieldClassNames:t,children:e.jsxs(cc,{className:w(t.input,"gap-10"),children:[e.jsx("button",{ref:l,type:"button",className:"flex-shrink-0 rounded bg-primary px-10 py-2 text-sm font-semibold text-on-primary outline-none",onClick:()=>i(),children:e.jsx(n,{message:"Replace file"})}),e.jsx(es,{initial:!1,mode:"wait",children:e.jsx("div",{className:"min-w-0 overflow-hidden overflow-ellipsis whitespace-nowrap",children:r?e.jsx(ls.div,{...Ps,children:r.name},"file-entry-name"):e.jsx(ls.div,{...Ps,children:e.jsx(et,{className:"min-w-144"})},"skeleton")})}),s]})}):m.cloneElement(s,{className:w(t.input,"py-8","file:bg-primary file:text-on-primary file:border-none file:rounded file:text-sm file:font-semibold file:px-10 file:h-24 file:mr-10")})}function fl(s){const{field:{onChange:t,value:a=null},fieldState:{error:r}}=cs({name:s.name}),i={onChange:t,value:a,invalid:r!=null,errorMessage:r?e.jsx(n,{message:"Please select a file."}):null};return e.jsx(o1,{...ds(i,s)})}function bl({caption:s}){const{close:t,formId:a}=Z(),r=V({defaultValues:{language:"en",...s}});return e.jsxs(K,{children:[e.jsx(te,{children:s?e.jsx(n,{message:"Update caption"}):e.jsx(n,{message:"Add caption"})}),e.jsx(X,{children:e.jsxs(ee,{id:a,form:r,onSubmit:i=>t(i),children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0,autoFocus:!0}),e.jsx(d1,{}),e.jsx(ye,{children:e.jsx(fl,{required:!s,name:"url",diskPrefix:"captions",allowedFileTypes:[".vtt"],maxFileSize:1024*1024,label:e.jsx(n,{message:"Caption file"}),onChange:()=>{r.clearErrors()}})})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>t(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,variant:"flat",color:"primary",type:"submit",children:s?e.jsx(n,{message:"Update"}):e.jsx(n,{message:"Add"})})]})]})}function d1(){var a;const{trans:s}=A(),{data:t}=ie(["languages"]);return e.jsx(D,{name:"language",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),label:e.jsx(n,{message:"Language"}),className:"mb-24",children:(a=t==null?void 0:t.languages)==null?void 0:a.map(r=>e.jsx(h,{value:r.code,capitalizeFirst:!0,children:e.jsx(n,{message:r.name})},r.code))})}const u1=E(e.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zM6 10h2v2H6zm0 4h8v2H6zm10 0h2v2h-2zm-6-4h8v2h-8z"}),"SubtitlesOutlined"),m1=E(e.jsx("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"}),"SettingsOutlined");function x1(){const{watch:s}=I(),{fields:t,append:a,remove:r,swap:i,update:l}=Pe({name:"captions",keyName:"key"}),o=s("type"),c=o==="video";return e.jsxs("div",{className:"mt-24",children:[e.jsxs("div",{className:"flex items-center gap-24 justify-between",children:[e.jsx("div",{className:"text-xl font-medium",children:e.jsx(n,{message:"Captions"})}),e.jsxs(P,{type:"modal",onClose:u=>{u&&a(u)},children:[e.jsx(b,{variant:"outline",startIcon:e.jsx(ue,{}),size:"xs",disabled:!c,children:e.jsx(n,{message:"Add caption"})}),e.jsx(bl,{})]})]}),e.jsxs("div",{className:"mt-24",children:[!c||!(t!=null&&t.length)?e.jsx(He,{size:"sm",image:e.jsx(u1,{}),imageHeight:"h-24",imageMargin:"mb-12",title:e.jsx(p1,{sourceType:o})}):null,c&&t.map((u,x)=>e.jsx(h1,{caption:u,captions:t,onSort:(p,j)=>i(p,j),onRemove:()=>r(x),onUpdate:p=>l(x,p)},u.key))]})]})}function h1({caption:s,captions:t,onSort:a,onRemove:r,onUpdate:i}){const l=m.useRef(null),o=m.useRef(null),c=Nr(),{sortableProps:u,dragHandleRef:x}=Rt({ref:l,disabled:c??!1,item:s,items:t,type:"captionItem",preview:o,previewVariant:"line",onSortEnd:(p,j)=>a(p,j)});return e.jsxs("div",{className:"flex items-center mb-6 border-b border-t border-transparent",ref:l,...u,children:[e.jsx(C,{ref:x,"aria-label":"Sort captions",children:e.jsx(za,{})}),e.jsx("div",{className:"capitalize ml-12",children:s.name}),e.jsx("div",{className:"ml-auto uppercase border rounded px-8 py-4 text-xs mr-12",children:s.language}),e.jsxs(P,{type:"modal",onClose:p=>{p&&i(p)},children:[e.jsx(oe,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{onClick:()=>r(),className:"text-muted",children:e.jsx(m1,{})})}),e.jsx(bl,{caption:s})]}),e.jsx(oe,{label:e.jsx(n,{message:"Remove"}),children:e.jsx(C,{onClick:()=>r(),className:"text-danger",children:e.jsx(Ee,{})})}),e.jsx(g1,{caption:s,ref:o})]})}const g1=U.forwardRef(({caption:s},t)=>e.jsx(Pa,{ref:t,children:()=>e.jsx("div",{className:"p-8 rounded shadow bg-background text-base",children:s.name})}));function p1({sourceType:s}){switch(s){case"video":return e.jsx(n,{message:"No captions have been added to this video yet."});case"stream":return e.jsx(n,{message:"Captions (if available) are embedded within the stream itself."});default:return e.jsx(n,{message:"This source type does not support captions."})}}function vl({form:s,video:t}){return e.jsxs("div",{className:"flex items-start gap-54",children:[e.jsxs("div",{className:"flex-auto",children:[e.jsx(f1,{video:t}),e.jsx(j1,{form:s}),e.jsx(x1,{})]}),e.jsx("div",{className:"w-440 flex-shrink-0",children:e.jsx(b1,{})})]})}function j1({form:s}){const t=s.formState.dirtyFields;return!t.src&&!t.thumbnail?null:e.jsxs("div",{className:"mt-12 flex items-center gap-6 text-sm text-muted",children:[e.jsx(Zt,{size:"xs",className:"text-muted",viewBox:"0 0 16 16"}),e.jsx(n,{message:"Save your changes to reload video preview."})]})}function f1({video:s}){return!s||!s.src?e.jsx(dc,{animate:!1}):e.jsx(uc,{video:s,mediaItemId:`${s.id}-${s.updated_at}`})}function b1(){return e.jsxs(ye,{children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0}),e.jsx(pl,{name:"title_id",seasonName:"season_num",episodeName:"episode_num",className:"mb-24"}),e.jsx(ve,{name:"thumbnail",label:e.jsx(n,{message:"Thumbnail"}),diskPrefix:"video-thumbnails",className:"mb-24"}),e.jsx(v1,{}),e.jsx(y1,{}),e.jsx(w1,{}),e.jsx(S1,{}),e.jsx(N1,{})]})}function v1(){const{setValue:s}=I();return e.jsxs(D,{name:"type",selectionMode:"single",label:e.jsx(n,{message:"Source type"}),className:"mb-24",onSelectionChange:()=>s("src",""),children:[e.jsx(h,{value:"embed",description:e.jsx(n,{message:"Embed video hosted on another site. Youtube, vimeo etc."}),children:e.jsx(n,{message:"Embed"})}),e.jsx(h,{value:"video",description:e.jsx(n,{message:"Upload a video file or enter a url to direct video (.mp4, .webm, .avi, .mov etc.) hosted online."}),children:e.jsx(n,{message:"Direct"})}),e.jsx(h,{value:"stream",description:e.jsx(n,{message:"Enter a url to HLS or DASH stream."}),children:e.jsx(n,{message:"Adaptive stream"})}),e.jsx(h,{value:"external",description:e.jsx(n,{message:"Enter any url. User will be redirected to this url after clicking the video."}),children:e.jsx(n,{message:"Basic url"})})]})}function y1(){const{watch:s}=I(),t=s("type")==="embed",a=s("type")==="external",r=s("type")==="video",{trans:i}=A();return r?e.jsx(C1,{}):e.jsx(g,{required:!0,name:"src",label:e.jsx(n,{message:"Source"}),className:"mb-24",type:a?"url":void 0,placeholder:t?i(d("Full embed code snippet or just src url")):void 0,inputElementType:t?"textarea":"input",rows:4})}function C1(){const s=I(),[t,a]=m.useState(()=>{const r=s.getValues("src");return r.includes("api/v1/file-entries")||r.includes("storage/title-videos")?"file":"url"});return e.jsxs("div",{className:"mb-24",children:[e.jsxs(jo,{size:"sm",className:"mb-8",name:"direct-type",children:[e.jsx(vn,{value:"url",checked:t==="url",onChange:r=>a(r.target.value),children:e.jsx(n,{message:"Url"})}),e.jsx(vn,{value:"file",checked:t==="file",onChange:r=>a(r.target.value),children:e.jsx(n,{message:"File"})})]}),t==="file"?e.jsx(fl,{required:!0,name:"src",disk:Ma.public,diskPrefix:"title-videos",label:e.jsx(n,{message:"Source"})}):e.jsx(g,{name:"src",label:e.jsx(n,{message:"source"}),inputElementType:"textarea",rows:2,required:!0,type:"url"})]})}function w1(){const{streaming:s}=xe(),t=JSON.parse((s==null?void 0:s.qualities)||"[]");return e.jsx(D,{name:"quality",selectionMode:"single",label:e.jsx(n,{message:"Quality"}),className:"mb-24",children:t.map(a=>e.jsx(h,{value:a.toLowerCase(),capitalizeFirst:!0,children:e.jsx(n,{message:a})},a))})}function S1(){var a,r;const{trans:s}=A(),t=ie(["languages"]);return e.jsx(D,{name:"language",selectionMode:"single",showSearchField:!0,searchPlaceholder:s(d("Search languages")),label:e.jsx(n,{message:"Language"}),className:"mb-24",children:(r=(a=t.data)==null?void 0:a.languages)==null?void 0:r.map(i=>e.jsx(h,{value:i.code,capitalizeFirst:!0,children:e.jsx(n,{message:i.name})},i.code))})}function N1(){return e.jsxs(D,{name:"category",selectionMode:"single",label:e.jsx(n,{message:"Content type"}),className:"mb-24",children:[e.jsx(h,{value:"trailer",children:e.jsx(n,{message:"Trailer"})}),e.jsx(h,{value:"clip",children:e.jsx(n,{message:"Clip"})}),e.jsx(h,{value:"featurette",children:e.jsx(n,{message:"Featurette"})}),e.jsx(h,{value:"teaser",children:e.jsx(n,{message:"Teaser"})}),e.jsx(h,{value:"full",children:e.jsx(n,{message:"Full Movie or Episode"})})]})}function bt({children:s}){const{titleId:t,season:a,episode:r}=B(),i=Q(),l=V({defaultValues:{quality:"regular",language:"en",category:"trailer",type:"embed",title_id:t?Number(t):void 0,season_num:a?Number(a):void 0,episode_num:r?Number(r):void 0}}),o=a1(l);return e.jsxs(Ve,{onSubmit:c=>{o.mutate(c,{onSuccess:u=>{M(d("Video created")),t?i("../",{relative:"path"}):i(`../${u.video.id}/edit`,{relative:"path"})}})},backButton:t?e.jsx(C,{className:"text-muted",elementType:F,to:"../",relative:"path",children:e.jsx(Rs,{})}):void 0,form:l,title:e.jsx(n,{message:"New video"}),isLoading:o.isLoading,disableSaveWhenNotDirty:!0,children:[s,e.jsx(vl,{form:l})]})}function L1(s){const{videoId:t}=B();return T(a=>k1(t,a),{onSuccess:async()=>{await _.invalidateQueries(["video"])},onError:a=>J(a,s)})}function k1(s,t){return S.put(`videos/${s}`,t).then(a=>a.data)}function yl(){const{videoId:s}=B();return Ie(["video",`${s}`],()=>_1(s))}function _1(s){return S.get(`videos/${s}`).then(t=>t.data)}function vt(){var c;const{titleId:s}=B(),t=Q(),a=V(),r=yl(),i=(c=r.data)==null?void 0:c.video,l=L1(a),o=i&&ct(i);return m.useEffect(()=>{var u;i&&!a.getValues().name&&a.reset({name:i.name,title_id:i.title_id,season_num:i.season_num,episode_num:i.episode_num,thumbnail:i.thumbnail,type:i.type,src:i.src,quality:i.quality,language:i.language,category:i.category,captions:((u=i.captions)==null?void 0:u.map(x=>({id:x.id,name:x.name,url:x.url,language:x.language})))||[]})},[i,a]),e.jsx(Ve,{onSubmit:u=>{l.mutate(u,{onSuccess:()=>{a.reset(u),M(d("Video updated")),s&&t("../../",{relative:"path"})}})},backButton:s?e.jsx(C,{className:"text-muted",elementType:F,to:"../../",relative:"path",children:e.jsx(Rs,{})}):void 0,form:a,title:i?e.jsx(n,{values:{name:i.name},message:"Edit “:name“"}):e.jsx(n,{message:"Edit video"}),actions:o?e.jsx(C,{size:"sm",elementType:F,to:o,target:"_blank",children:e.jsx(Vr,{})}):null,isLoading:r.isLoading||l.isLoading,disableSaveWhenNotDirty:!0,children:r.isLoading?e.jsx(Ce,{}):e.jsx(vl,{form:a,video:i})})}const M1=""+new URL("movie-night-f53006ef.svg",import.meta.url).href,I1=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Title"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Ds,{title:s,srcSize:"sm",size:"w-32",aspect:"aspect-square"}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(Ye,{title:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.is_series?e.jsx(n,{message:"Series"}):e.jsx(n,{message:"Movie"})})]})]})},{key:"release_date",allowsSorting:!0,header:()=>e.jsx(n,{message:"Release date"}),body:s=>e.jsx(ae,{date:s.release_date})},{key:"rating",allowsSorting:!0,header:()=>e.jsx(n,{message:"Rating"}),body:s=>e.jsx(wr,{score:s.rating}),width:"w-124 flex-shrink-0"},{key:"views",allowsSorting:!0,header:()=>e.jsx(n,{message:"Page views"}),body:s=>e.jsx(Re,{value:s.views}),width:"w-124 flex-shrink-0"},{key:"popularity",allowsSorting:!0,header:()=>e.jsx(n,{message:"Popularity"}),body:s=>s.popularity?e.jsx(Re,{value:s.popularity}):null,width:"w-124 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,width:"w-124 flex-shrink-0",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ae,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-84 flex-shrink-0",body:s=>e.jsxs(m.Fragment,{children:[e.jsx(C,{size:"md",className:"text-muted",elementType:F,to:`${s.id}/insights`,children:e.jsx(gl,{})}),e.jsx(F,{to:`${s.id}/edit/primary-facts`,className:"text-muted",children:e.jsx(oe,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})})]})}],T1=[{key:"is_series",label:d("Type"),description:d("Whether title is a movie or a TV series"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"02",options:[{key:"01",label:d("Both"),value:!1},{key:"02",label:d("Movie"),value:!1},{key:"03",label:d("TV series"),value:!0}]}},{key:"views",label:d("Page views"),description:d("Number of unique page views"),defaultOperator:O.lte,operators:Ks,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:100}},{key:"poster",label:d("No poster"),description:d("Whether title has a poster"),defaultOperator:O.eq,control:{type:H.BooleanToggle,defaultValue:null}},Se({description:d("Date title was created")}),Ne({description:d("Date title was last updated")})];function F1(){const{trans:s}=A();return T(t=>E1(t),{onSuccess:async()=>{await _.invalidateQueries(Y("titles")),M(s(d("Item imported")))},onError:t=>q(t)})}function E1(s){return S.post("media/import",s).then(t=>t.data)}function Cl({modelType:s}){const t=V({defaultValues:{media_type:s===zs?"movie":"person"}}),{formId:a,close:r}=Z(),i=F1();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Import from TheMovieDB"})}),e.jsx(X,{children:e.jsxs(ee,{id:a,form:t,onSubmit:l=>{i.mutate(l,{onSuccess:o=>{r(o.mediaItem)}})},children:[s===zs&&e.jsxs(D,{name:"media_type",label:e.jsx(n,{message:"Type"}),className:"mb-24",selectionMode:"single",children:[e.jsx(h,{value:"movie",children:e.jsx(n,{message:"Movie"})}),e.jsx(h,{value:"series",children:e.jsx(n,{message:"Series"})})]}),e.jsx(g,{autoFocus:!0,required:!0,name:"tmdb_id",min:1,type:"number",label:e.jsx(n,{message:"TheMovieDB ID"})})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,variant:"flat",color:"primary",type:"submit",disabled:i.isLoading,children:e.jsx(n,{message:"Import"})})]})]})}function P1(){const{trans:s}=A(),t=m.useRef([]),[a,r]=m.useState(!1),i=m.useRef(new AbortController),l=m.useCallback(()=>{i.current.abort("canceled")},[]);return{mutate:m.useCallback(async(c,u)=>{var L,N,z;let x=!1,p=!1,j=c.pages_to_import||1;const v=c.start_from_page||1;j+v>500&&(j=500-v);const f=()=>{r(!1),t.current=[],i.current=new AbortController,x=!0};let k=v;r(!0),i.current.signal.addEventListener("abort",()=>f());let y=0;for(;y<=j&&!x;){y===0&&((L=u.onProgress)==null||L.call(u,{totalItems:j*20,currentItem:0,progress:0,titleList:[]})),y++,k++;try{const R=await S.post("tmdb/import",z1({...c,current_page:k}),{signal:i.current.signal}).then(he=>he.data);R.total_pages<j&&(j=R.total_pages),t.current.length>1e3&&(t.current=t.current.slice(0,1e3)),t.current.unshift(...R.titles.map(he=>he.name));const G=j*20,se=(y-1)*20;(N=u.onProgress)==null||N.call(u,{totalItems:G,currentItem:se,progress:Math.round(se/G*100),titleList:t.current})}catch(R){f(),p=!0,R.message!=="canceled"&&q(R)}}p||(await _.invalidateQueries(Y("titles")),M(s(d("Titles imported"))),r(!1),(z=u.onSuccess)==null||z.call(u))},[s]),cancel:l,isLoading:a}}function z1(s){const t={type:s.type,pages_to_import:s.pages_to_import,start_from_page:s.start_from_page,current_page:s.current_page};return s.country&&(t.country=s.country),s.language&&(t.language=s.language),s.min_rating&&(t.min_rating=s.min_rating),s.max_rating&&(t.max_rating=s.max_rating),s.genres&&(t.genres=s.genres.map(a=>a.id).join(",")),s.keywords&&(t.keywords=s.keywords.map(a=>a.id).join(",")),s.release_date&&(t.start_date=s.release_date.start,t.end_date=s.release_date.start),t}function D1(){const s=V({defaultValues:{type:"movie",start_from_page:1,pages_to_import:10}}),{formId:t,close:a}=Z(),r=P1(),[i,l]=m.useState("form"),[o,c]=m.useState();return e.jsxs(K,{size:"lg",children:[e.jsx(te,{children:e.jsx(n,{message:"Import from TheMovieDB"})}),e.jsx(X,{children:e.jsx(ee,{id:t,form:s,onSubmit:u=>{r.mutate(u,{onSuccess:()=>{},onProgress:x=>{l("progress"),c(x)}})},children:o?e.jsx($1,{data:o}):e.jsx(A1,{})})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>{o?(r.cancel(),c(void 0),l("form")):a()},children:r.isLoading||i==="form"?e.jsx(n,{message:"Cancel"}):e.jsx(n,{message:"Back"})}),e.jsx(b,{form:t,variant:"flat",color:"primary",type:"submit",disabled:r.isLoading||i==="progress",children:e.jsx(n,{message:"Import"})})]})]})}function A1(){return e.jsxs(m.Fragment,{children:[e.jsxs("p",{className:"mb-24 flex items-center gap-8 text-muted",children:[e.jsx(Zt,{size:"xs",viewBox:"0 0 16 16"}),e.jsx(n,{message:"All filters below are optional and can be left empty."})]}),e.jsxs(D,{name:"type",label:e.jsx(n,{message:"Type"}),className:"mb-24",selectionMode:"single",children:[e.jsx(h,{value:"movie",children:e.jsx(n,{message:"Movie"})}),e.jsx(h,{value:"series",children:e.jsx(n,{message:"Series"})})]}),e.jsx(R1,{}),e.jsx(V1,{}),e.jsx(O1,{}),e.jsx(U1,{}),e.jsx(B1,{}),e.jsx(q1,{}),e.jsx(mc,{name:"release_date",granularity:"day",label:e.jsx(n,{message:"Release date"}),description:e.jsx(n,{message:"Only import titles released between specified dates."})})]})}function $1({data:s}){return e.jsxs("div",{children:[e.jsx(It,{value:s.progress,label:e.jsx(n,{message:"Imported :number titles of :total",values:{number:s.currentItem,total:s.totalItems}})}),e.jsxs("div",{className:"compact-scrollbar mt-24 h-400 overflow-auto text-xs",children:[s.titleList.map((t,a)=>e.jsx("div",{children:t},a)),s.titleList.length?null:e.jsx(m.Fragment,{children:[...new Array(20).keys()].map(t=>e.jsx(et,{className:"mb-2 max-w-200"},t))})]})]})}function R1(){return e.jsxs("div",{className:"mb-24",children:[e.jsxs("div",{className:"flex items-center gap-24",children:[e.jsx(g,{className:"flex-1",name:"start_from_page",label:e.jsx(n,{message:"Starting page"}),type:"number",min:1,max:500}),e.jsx(g,{className:"flex-1",name:"pages_to_import",label:e.jsx(n,{message:"How many pages to import"}),type:"number",min:1,max:500})]}),e.jsx("p",{className:"pt-10 text-xs text-muted",children:e.jsx(n,{message:"20 titles per page are imported.  "})})]})}function V1(){const{data:s}=Qt(),t=s==null?void 0:s.genres.map(a=>({id:a.value,name:a.name}));return e.jsx($s,{className:"mb-24",name:"genres",label:e.jsx(n,{message:"Genres"}),suggestions:t,allowCustomValue:!1,description:e.jsx(n,{message:"Only import titles belonging to specified genres."}),children:a=>e.jsx(h,{value:a.id,children:e.jsx(n,{message:a.name})})})}function O1(){const{data:s}=Qt(),t=s==null?void 0:s.keywords.map(a=>({id:a.value,name:a.name}));return e.jsx($s,{name:"keywords",className:"mb-24",label:e.jsx(n,{message:"Keywords"}),suggestions:t,allowCustomValue:!1,description:e.jsx(n,{message:"Only import titles that have specied keywords attached."}),children:a=>e.jsx(h,{value:a.id,children:e.jsx(n,{message:a.name})})})}function U1(){const{data:s}=Qt();return e.jsx(D,{name:"language",className:"mb-24",label:e.jsx(n,{message:"Language"}),items:s==null?void 0:s.languages,selectionMode:"single",description:e.jsx(n,{message:"Only import titles with specied primary spoken language."}),children:t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})})})}function B1(){const{data:s}=Qt();return e.jsx(D,{name:"country",className:"mb-24",label:e.jsx(n,{message:"Country"}),items:s==null?void 0:s.countries,selectionMode:"single",description:e.jsx(n,{message:"Only import titles with specied origin country."}),children:t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})})})}function q1(){return e.jsxs("div",{className:"mb-24 flex items-center gap-24",children:[e.jsx(g,{className:"flex-1",name:"min_rating",label:e.jsx(n,{message:"Minimum rating"}),type:"number",min:1,max:10}),e.jsx(g,{className:"flex-1",name:"max_rating",label:e.jsx(n,{message:"Maximum rating"}),type:"number",min:1,max:10})]})}function Qt(){return ie(["genres","keywords","languages","countries"],{type:"tmdb"})}function H1(){const{filters:s,filtersLoading:t}=xc(),a=m.useMemo(()=>[...s,...T1],[s]);return e.jsx(fe,{endpoint:"titles",title:e.jsx(n,{message:"Titles"}),columns:I1,filters:a,filtersLoading:t,actions:e.jsx(Z1,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:M1,title:e.jsx(n,{message:"No titles have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching titles"})})})}function Z1(){const{tmdb_is_setup:s}=xe();return e.jsxs(m.Fragment,{children:[s&&e.jsx(W1,{}),e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add title"})})]})}function W1(){const s=Q();return e.jsxs(bs,{children:[e.jsx(oe,{label:e.jsx(n,{message:"Import from TheMovieDB"}),children:e.jsx(C,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:e.jsx(rn,{})})}),e.jsxs(vs,{children:[e.jsx(h,{value:"single",onSelected:async()=>{const t=await yn(Cl,{modelType:zs});t&&s(`/admin/titles/${t.id}/edit/primary-facts`)},children:e.jsx(n,{message:"Import single title by ID"})}),e.jsx(h,{value:"multiple",onSelected:()=>{yn(D1)},children:e.jsx(n,{message:"Import multiple titles"})})]})]})}function Q1(){const s=Lr("editTitlePage");return s.data?e.jsx(As,{context:s.data.title}):e.jsx(Ce,{})}function G1(s){return T(()=>K1(s.id),{onSuccess:async()=>{await _.invalidateQueries($a(s.title_id,s.season_number)),M(d("Episode deleted"))},onError:t=>q(t)})}function K1(s){return S.delete(`episodes/${s}`).then(t=>t.data)}const J1=[{to:"primary-facts",label:d("Primary Facts")},{to:"seasons",label:d("Seasons"),hideIfMovie:!0},{to:"images",label:d("Images")},{to:"videos",label:d("Videos")},{to:"cast",label:d("Cast")},{to:"crew",label:d("Crew")},{to:"genres",label:d("Genres")},{to:"keywords",label:d("Keywords")},{to:"countries",label:d("Countries")},{to:"reviews",label:d("Reviews")},{to:"comments",label:d("Comments")}];function wl(){const s=we(),t=!(s!=null&&s.is_series);return J1.filter(a=>!t||!a.hideIfMovie)}function ze({children:s,actions:t}){const a=Fe(),{isSticky:r,sentinelRef:i}=kr(),l=we(),{season:o,episode:c}=B(),u=l?hc(l,{season:o,episode:c}):null,x=m.useRef(null),p=l?e.jsx(n,{values:{name:l.name},message:"Edit “:name“"}):e.jsx(n,{message:"New title"});return gc(x),e.jsxs(m.Fragment,{children:[e.jsx(ts,{children:e.jsx(n,{message:"Edit title"})}),e.jsx("div",{ref:i}),e.jsx("div",{ref:x,className:w("sticky top-0 my-12 md:my-24 z-10 transition-shadow",r&&"bg-paper shadow"),children:e.jsxs("div",{className:w("flex items-center md:items-start gap-24 py-14 container mx-auto px-24"),children:[e.jsx("h1",{className:"text-xl md:text-3xl whitespace-nowrap overflow-hidden overflow-ellipsis md:mr-64",children:p}),e.jsx("div",{className:"mr-auto"}),u?e.jsx(C,{size:"sm",elementType:F,to:u,target:"_blank",children:e.jsx(Vr,{})}):null,t]})}),e.jsxs("div",{className:"container md:flex gap-30 items-stretch mx-auto px-24 pb-24",children:[a?e.jsx(Y1,{}):e.jsx(X1,{}),e.jsx("div",{className:"md:pl-30 flex-auto relative",children:s})]})]})}function Y1(){const{titleId:s}=B(),{pathname:t}=fs(),a=xs(),r=s?t.split("/").pop():"primary-facts",i=wl();return e.jsx(os,{disabled:!s,minWidth:"min-w-none",className:"w-full bg-paper mb-24",selectionMode:"single",selectedValue:r,onSelectionChange:l=>{s&&a(Sl(s,l))},children:i.map(l=>e.jsx(h,{value:l.to,children:e.jsx(n,{...l.label})},l.to))})}function X1(){const{titleId:s}=B(),t=wl();return e.jsxs("div",{className:"w-240 sticky top-24 flex-shrink-0",children:[t.map(a=>{const r=s?Sl(s,a.to):"";return e.jsx(Ft,{to:r,"aria-disabled":!s,className:({isActive:i})=>w("block p-14 whitespace-nowrap mb-8 rounded border-l-4 text-sm transition-bg-color",!r&&"pointer-events-none text-muted",i&&r||a.to==="primary-facts"&&!r?"bg-primary/selected border-l-primary font-medium":"border-l-transparent hover:bg-hover"),children:e.jsx(n,{...a.label})},a.to)}),s?null:e.jsxs("div",{className:"flex items-center gap-8 text-muted text-xs mt-24",children:[e.jsx(Zt,{viewBox:"0 0 16 16",size:"xs"}),e.jsx(n,{message:"Create title to enable menu items."})]})]})}const Sl=(s,t)=>`/admin/titles/${s}/edit/${t}`,na=[{uri:"episodes",label:d("Episodes")},{uri:"cast",label:d("Regular cast")},{uri:"crew",label:d("Regular crew")}];function ln({children:s}){const{season:t}=B(),{pathname:a}=fs(),r=a.split("/").pop(),i=t?na.findIndex(l=>l.uri===r):0;return e.jsxs(ze,{children:[e.jsxs("div",{className:"flex items-center gap-12 mb-4",children:[e.jsx(C,{elementType:F,to:"../../",relative:"path",className:"text-muted",children:e.jsx(Rs,{})}),e.jsx("h2",{className:"text-base",children:e.jsx(n,{message:"Season :number",values:{number:t}})})]}),e.jsxs(ws,{selectedTab:i,children:[e.jsx(Ss,{children:na.map(l=>e.jsx(Me,{isDisabled:!t&&l.uri!==na[0].uri,width:"min-w-132",elementType:F,to:`../${l.uri}`,relative:"path",replace:!0,children:e.jsx(n,{...l.label})},l.uri))}),e.jsx("div",{className:"pt-24 min-h-512",children:s})]})]})}function ut({query:s}){return s.isLoading?e.jsx("div",{className:"h-full min-h-120 flex items-center justify-center",children:e.jsx(ms,{isIndeterminate:!0,"aria-label":"Loading page..."})}):e.jsx(fo,{})}function e4(){return e.jsxs(ln,{children:[e.jsx("div",{className:"mb-16",children:e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),size:"xs",elementType:F,to:"new",children:e.jsx(n,{message:"Add episode"})})}),e.jsx(s4,{})]})}function s4(){var t;const s=Ra("editSeasonPage");return s.data?(t=s.data.episodes)!=null&&t.data.length?e.jsx(a4,{data:s.data}):e.jsx(t4,{}):e.jsx(ut,{query:s})}function t4(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(_r,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No episodes have been added yet"})})}function a4({data:s}){const t=pc(s.episodes);return e.jsxs(m.Fragment,{children:[t.items.map(a=>e.jsx(jc,{episode:a,title:s.title,className:"mb-24",children:e.jsxs("div",{className:"mt-12 flex items-center gap-12",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(de,{}),elementType:F,to:`${a.episode_number}/primary-facts`,children:e.jsx(n,{message:"Edit"})}),e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:"xs",radius:"rounded",variant:"outline",children:e.jsx(We,{})}),e.jsx(n4,{episode:a})]})]})},a.id)),e.jsx(Ut,{query:t})]})}function n4({episode:s}){const t=G1(s),{close:a}=Z();return e.jsx(ce,{isLoading:t.isLoading,isDanger:!0,title:e.jsx(n,{message:"Delete episode"}),body:e.jsx(n,{message:"Are you sure you want to delete this episode?"}),confirm:e.jsx(n,{message:"Delete"}),onConfirm:()=>{t.mutate(void 0,{onSuccess:()=>a()})}})}function r4(s,t){return T(()=>i4(t),{onSuccess:async()=>{await _.invalidateQueries(Mr(s.id)),M(d("Season deleted"))},onError:a=>q(a)})}function i4(s){return S.delete(`seasons/${s}`).then(t=>t.data)}function l4(s){return T(()=>o4(s),{onSuccess:async t=>{await _.invalidateQueries(Mr(t.season.title_id)),M(d("Season :number created",{values:{number:t.season.number}}))},onError:t=>q(t)})}function o4(s){return S.post(`titles/${s}/seasons`).then(t=>t.data)}function c4(){const s=we(),t=l4(s.id),a=fc(s.id,void 0,{perPage:15});let r;return a.data?r=a.items.length?e.jsxs(m.Fragment,{children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),disabled:t.isLoading,onClick:()=>t.mutate(),children:e.jsx(n,{message:"Add season"})}),e.jsx("div",{className:"mt-24 grid grid-cols-2 gap-24 md:grid-cols-5",children:a.items.map(i=>e.jsxs("div",{children:[e.jsx(Va,{title:s,season:i,srcSize:"md",className:"aspect-poster flex-shrink-0"}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("div",{className:"flex items-center justify-between gap-14",children:[e.jsx(Oa,{title:s,seasonNumber:i.number}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(ae,{date:i.release_date,options:{year:"numeric"}})})]}),e.jsx("div",{className:"mt-2 text-sm",children:e.jsx(n,{message:":count episodes",values:{count:i.episodes_count}})}),e.jsxs("div",{className:"mt-14 flex items-center justify-between gap-14",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(de,{}),elementType:F,to:`${i.number}/episodes`,children:e.jsx(n,{message:"Edit"})}),e.jsx(u4,{title:s,season:i})]})]})]},i.id))}),e.jsx(Ut,{query:a})]}):e.jsx(d4,{}):r=e.jsx(ut,{query:a}),e.jsx(ze,{children:r})}function d4(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(_r,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No seasons have been added yet"})})}function u4({title:s,season:t}){const a=r4(s,t.id);return e.jsxs(P,{type:"modal",onClose:r=>{r&&a.mutate()},children:[e.jsx(C,{size:"xs",radius:"rounded",variant:"outline",children:e.jsx(We,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete season"}),body:e.jsx(n,{message:"Are you sure you want to delete this season?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function m4(s){return T(t=>x4(t),{onSuccess:async()=>{await _.invalidateQueries(["titles"])},onError:t=>s?J(t,s):q(t)})}function x4(s){return S.post("titles",s).then(t=>t.data)}function h4(s){const{titleId:t}=B();return T(a=>g4(t,a),{onSuccess:async()=>{await _.invalidateQueries(["titles"])},onError:a=>J(a,s)})}function g4(s,t){return S.put(`titles/${s}`,t).then(a=>a.data)}function Nl({children:s,...t}){const{field:{onChange:a,onBlur:r,value:i="",ref:l},fieldState:{invalid:o,error:c}}=cs({name:t.name}),u={onSelectionChange:a,onBlur:r,selectedValue:i,defaultInputValue:i,invalid:o,errorMessage:c==null?void 0:c.message};return e.jsx(bo,{ref:l,...ds(u,t),children:s})}function ra(){const s=we();return e.jsx(ye,{children:s?e.jsx(j4,{title:s}):e.jsx(p4,{})})}function p4(){const s=ot(),t=Q(),a=V({defaultValues:{release_date:s.toAbsoluteString(),certification:"pg",language:"en"}}),r=m4(a),i=Object.keys(a.formState.dirtyFields).length>0;return e.jsx(ee,{form:a,onSubmit:l=>{r.mutate(l,{onSuccess:o=>{M(d("Title created")),t(`../${o.title.id}/edit`,{relative:"path",replace:!0})}})},children:e.jsx(ze,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r.isLoading||!i,children:e.jsx(n,{message:"Create"})}),children:e.jsx(Ll,{})})})}function j4({title:s}){const t=Q(),a=V({defaultValues:{name:s.name,is_series:s.is_series,original_title:s.original_title,poster:s.poster,backdrop:s.backdrop,release_date:s.release_date,tagline:s.tagline,description:s.description,runtime:s.runtime,certification:s.certification,budget:s.budget,revenue:s.revenue,language:s.language,popularity:s.popularity}}),r=h4(a);return e.jsx(ee,{form:a,onSubmit:i=>{r.mutate(i,{onSuccess:()=>{M(d("Title updated")),t("..",{relative:"path",replace:!0})}})},children:e.jsx(ze,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:r.isLoading||!a.formState.isDirty,children:e.jsx(n,{message:"Save"})}),children:e.jsx(Ll,{})})})}function Ll(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"gap-24 md:flex",children:[e.jsx(ve,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"title-posters",label:e.jsx(n,{message:"Poster"}),showRemoveButton:!0}),e.jsxs("div",{className:"flex-auto max-md:mt-24",children:[e.jsx(ve,{name:"backdrop",variant:"square",diskPrefix:"title-backdrops",label:e.jsx(n,{message:"Backdrop"}),stretchPreview:!0,previewSize:"min-h-124",className:"mb-24"}),e.jsx(g,{name:"name",label:e.jsx(n,{message:"Title"}),className:"mb-24",required:!0}),e.jsx(g,{name:"original_title",label:e.jsx(n,{message:"Original title"}),className:"mb-24"}),e.jsx($,{name:"is_series",className:"mb-24",children:e.jsx(n,{message:"Series"})})]})]}),e.jsx(js,{name:"release_date",label:e.jsx(n,{message:"Release date"}),className:"mb-24",granularity:"day"}),e.jsx(g,{name:"tagline",label:e.jsx(n,{message:"Tagline"}),className:"mb-24"}),e.jsx(g,{name:"description",label:e.jsx(n,{message:"Overview"}),inputElementType:"textarea",rows:4,className:"mb-24"}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(g,{name:"runtime",label:e.jsx(n,{message:"Runtime"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(f4,{})]}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(g,{name:"budget",label:e.jsx(n,{message:"Budget (US dollars)"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(g,{name:"revenue",label:e.jsx(n,{message:"Revenue (US dollars)"}),type:"number",min:1,className:"flex-1 max-md:mb-24"})]}),e.jsxs("div",{className:"mb-24 items-center gap-24 md:flex",children:[e.jsx(g,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1,className:"flex-1 max-md:mb-24"}),e.jsx(b4,{})]})]})}function f4(){const{data:s}=ie(["titleFilterAgeRatings"]);return e.jsx(Nl,{name:"certification",selectionMode:"single",label:e.jsx(n,{message:"Certification"}),className:"flex-1",allowCustomValue:!0,children:s==null?void 0:s.titleFilterAgeRatings.map(({name:t,value:a})=>e.jsx(h,{value:a,children:e.jsx(n,{message:t})},a))})}function b4(){const{data:s}=ie(["tmdbLanguages"]);return e.jsx(D,{name:"language",selectionMode:"single",label:e.jsx(n,{message:"Language"}),showSearchField:!0,searchPlaceholder:"Search languages",className:"flex-1",children:s==null?void 0:s.tmdbLanguages.map(t=>e.jsx(h,{value:t.code,children:e.jsx(n,{message:t.name})},t.code))})}function v4(){const s=we();return e.jsx(ze,{children:e.jsx(hl,{hideTitle:!0,reviewable:s})})}const y4=E(e.jsx("path",{d:"m15 3 2.3 2.3-2.89 2.87 1.42 1.42L18.7 6.7 21 9V3h-6zM3 9l2.3-2.3 2.87 2.89 1.42-1.42L6.7 5.3 9 3H3v6zm6 12-2.3-2.3 2.89-2.87-1.42-1.42L5.3 17.3 3 15v6h6zm12-6-2.3 2.3-2.87-2.89-1.42 1.42 2.89 2.87L15 21h6v-6z"}),"ZoomOutMapOutlined");function C4(s){const{titleId:t}=B();return T(()=>w4(s),{onSuccess:async()=>{await _.invalidateQueries(["titles",`${t}`]),M(d("Image deleted"))},onError:a=>q(a)})}function w4(s){return S.delete(`images/${s}`).then(t=>t.data)}function S4(){const{titleId:s}=B();return T(t=>N4(t),{onSuccess:async()=>{await _.invalidateQueries(["titles",`${s}`]),M(d("Image uploaded"))},onError:t=>q(t)})}function N4(s){const t=new FormData;return t.append("titleId",s.titleId.toString()),t.append("file",s.file),S.post("images",t).then(a=>a.data)}function L4(){const s=we();return e.jsxs(ze,{children:[e.jsx(ye,{children:e.jsx(M4,{})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-24 mt-24",children:s.images.map((t,a)=>e.jsxs("div",{children:[e.jsx(bc,{src:t.url,srcSize:"md",className:"rounded"}),e.jsxs("div",{className:"flex items-center justify-between gap-14 mt-6",children:[e.jsx(I4,{imageId:t.id}),e.jsxs(P,{type:"modal",children:[e.jsx(C,{variant:"outline",radius:"rounded",size:"xs",children:e.jsx(y4,{})}),e.jsx(br,{images:s.images.map(r=>r.url),defaultActiveIndex:a})]})]})]},t.id))}),!s.images.length&&e.jsx(k4,{})]})}function k4(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Ir,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No images have been added yet"})})}const _4=5e6;function M4(){const{titleId:s}=B(),t=S4(),a=async()=>{const r=await vo({types:[mr.image]}),i=ur(r[0],{maxFileSize:_4});if(i){M.danger(i);return}t.mutate({file:r[0].native,titleId:s})};return e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),disabled:t.isLoading,onClick:()=>a(),children:e.jsx(n,{message:"Upload image"})})}function I4({imageId:s}){const t=C4(s);return e.jsx(b,{variant:"outline",size:"xs",disabled:t.isLoading,onClick:()=>t.mutate(),children:e.jsx(n,{message:"Delete"})})}const ia=[{value:"created_at:desc",label:d("Newest")},{value:"created_at:asc",label:d("Oldest")},{value:"upvotes:desc",label:d("Most upvotes")},{value:"reports_count:desc",label:d("Most reported")},{value:"season_num:desc",label:d("Seasons")},{value:"order:asc",label:d("Curated")}];function T4({value:s,onValueChange:t,color:a}){let r=ia.find(i=>i.value===s);return r||(r=ia[0]),e.jsxs(bs,{selectedValue:s,onSelectionChange:i=>t(i),selectionMode:"single",children:[e.jsx(b,{variant:"outline",startIcon:e.jsx(vc,{}),color:a,children:e.jsx(n,{...r.label})}),e.jsx(vs,{children:ia.map(i=>e.jsx(h,{value:i.value,children:e.jsx(n,{...i.label})},i.value))})]})}function F4(){return T(s=>E4(s),{onSuccess:async()=>{await _.invalidateQueries(["video"])},onError:s=>q(s)})}function E4({videoIds:s}){return S.delete(`videos/${s.join(",")}`).then(t=>t.data)}function P4({title:s}){const t=Q(),{trans:a}=A(),r=B(),i=r.season?Number(r.season):"",l=r.episode?Number(r.episode):"",o=(c,u)=>{let x=`/admin/titles/${s.id}/edit/videos`;c&&(x+=`/seasons/${c}`),u&&(x+=`/episodes/${u}`),t(x)};return s.seasons_count?e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsxs(os,{className:"flex-1",selectedValue:i,onSelectionChange:c=>{o(c)},placeholder:a(d("Season")),selectionMode:"single",size:"sm",children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"All seasons"})},"none"),[...new Array(s.seasons_count).keys()].map(c=>{const u=c+1;return e.jsx(h,{value:u,children:e.jsx(n,{message:"Season :number",values:{number:u}})},u)})]}),i&&e.jsx(z4,{value:l,onChange:c=>{o(i,c)}})]}):null}function z4({value:s,onChange:t}){const{trans:a}=A(),{data:r}=Ra("season");return e.jsxs(os,{placeholder:a(d("Episode")),selectionMode:"single",className:"flex-1",size:"sm",selectedValue:s,onSelectionChange:t,children:[e.jsx(h,{value:"",children:e.jsx(n,{message:"All episodes"})},"none"),[...new Array(r==null?void 0:r.season.episodes_count).keys()].map(i=>{const l=i+1;return e.jsx(h,{value:l,children:e.jsx(n,{message:"Episode :number",values:{number:l}})},l)})]})}function la(){const s=m.useMemo(()=>jl.filter(c=>c.key!=="title_id"),[]),{encodedFilters:t}=At(s),{season:a,episode:r}=B(),i=we(),l=Tr({queryKey:["video","edit-title-page"],endpoint:"videos",defaultOrderBy:"created_at",defaultOrderDir:"desc",queryParams:{perPage:20,filters:t,title_id:i.id,season:a??null,episode:r??null}});let o;return l.data?o=l.items.length?e.jsxs(m.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 gap-24 md:grid-cols-2 lg:grid-cols-3",children:l.items.map(c=>e.jsx(A4,{video:c},c.id))}),e.jsx(Ut,{query:l})]}):e.jsx(D4,{isFiltering:t!=null}):o=e.jsx(ut,{query:l}),e.jsxs(ze,{children:[e.jsxs("div",{className:"mb-24 flex flex-wrap items-center gap-12",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),elementType:F,to:"new",className:"mr-auto",children:e.jsx(n,{message:"Add video"})}),e.jsx(P4,{title:i}),e.jsx(T4,{value:`${l.sortDescriptor.orderBy}:${l.sortDescriptor.orderDir}`,onValueChange:c=>{const[u,x]=c.split(":");l.setSortDescriptor({orderBy:u,orderDir:x})}}),e.jsx(xr,{icon:e.jsx(gr,{}),color:null,variant:"outline",filters:s})]}),e.jsx($t,{className:"mb-24",filters:s}),o]})}function D4({isFiltering:s}){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Fr,{size:"xl"})}),imageHeight:"h-auto",title:s?e.jsx(n,{message:"No matching videos"}):e.jsx(n,{message:"No videos have been added yet"})})}function A4({video:s}){const t=ct(s);return e.jsxs("div",{className:"",children:[e.jsxs(F,{to:t,className:"relative isolate block",target:"_blank",children:[e.jsx(Er,{video:s,title:s.title,srcSize:"lg"}),e.jsx(yc,{}),e.jsxs("span",{className:"absolute bottom-0 left-0 z-30 flex items-center gap-x-6 p-10 text-white",children:[e.jsx(Cc,{}),e.jsx("span",{className:"capitalize",children:s.category})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 mt-12 flex items-center gap-24",children:[e.jsx(F,{to:t,className:"block font-semibold hover:underline",children:s.name}),s.reports_count?e.jsx("div",{className:"ml-auto flex-shrink-0 whitespace-nowrap text-sm text-muted",children:e.jsx(n,{message:":count reports",values:{count:s.reports_count}})}):null]}),e.jsxs("div",{className:"flex items-center justify-between gap-14 text-sm text-muted",children:[(s.season_num!=null||s.episode_num!=null)&&e.jsx(Sr,{seasonNum:s.season_num,episodeNum:s.episode_num}),e.jsx(ae,{date:s.created_at})]}),e.jsxs("div",{className:"mt-14 flex items-center gap-24",children:[e.jsx(b,{variant:"outline",size:"xs",startIcon:e.jsx(de,{}),elementType:F,to:`edit/${s.id}`,children:e.jsx(n,{message:"Edit"})}),e.jsx($4,{video:s})]})]})]})}function $4({video:s}){const t=F4();return e.jsxs(P,{type:"modal",onClose:a=>{a&&t.mutate({videoIds:[s.id]})},children:[e.jsx(b,{className:"ml-auto",variant:"outline",size:"xs",startIcon:e.jsx(We,{}),disabled:t.isLoading,children:e.jsx(n,{message:"Delete"})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete video"}),body:e.jsx(n,{message:"Are you sure you want to delete this video?"}),confirm:e.jsx(n,{message:"Delete"})})]})}function R4(s,t,a,r){return T(i=>V4(s,t,a,i),{onSuccess:async({episode:i})=>{await _.invalidateQueries($a(i.title_id,i.season_number))},onError:i=>J(i,r)})}function V4(s,t,a,r){return S.put(`titles/${s}/seasons/${t}/episodes/${a}`,r).then(i=>i.data)}const On=[{uri:"primary-facts",label:d("Primary facts")},{uri:"cast",label:d("Cast")},{uri:"crew",label:d("Crew")}];function mt({children:s,actions:t}){const{episode:a,season:r}=B(),i=Q(),{pathname:l}=fs(),o=l.split("/").pop(),c=a?On.findIndex(u=>u.uri===o):0;return e.jsxs(ze,{actions:t,children:[e.jsxs(Rr,{className:"mb-24",children:[e.jsx(wt,{onSelected:()=>i("../..",{relative:"path"}),children:e.jsx(n,{message:"Season :number",values:{number:r}})}),e.jsx(wt,{children:a?e.jsx(n,{message:"Episode :number",values:{number:a}}):e.jsx(n,{message:"New episode"})})]}),e.jsx(ye,{children:e.jsxs(ws,{selectedTab:c,children:[e.jsx(Ss,{children:On.map(u=>e.jsx(Me,{isDisabled:!a&&u.uri!=="primary-facts",width:"min-w-132",elementType:F,to:`../${u.uri}`,relative:"path",replace:!0,children:e.jsx(n,{...u.label})},u.uri))}),e.jsx("div",{className:"pt-24",children:s})]})})]})}function O4(s,t,a){return T(r=>U4(t,a,r),{onSuccess:async()=>{await _.invalidateQueries($a(t,a))},onError:r=>s?J(r,s):q(r)})}function U4(s,t,a){return S.post(`titles/${s}/seasons/${t}/episodes`,a).then(r=>r.data)}function Un(){const{episode:s}=B();return s?e.jsx(q4,{}):e.jsx(B4,{})}function B4(){const s=we(),{season:t}=B(),a=Q(),r=ot(),i=V({defaultValues:{release_date:r.toAbsoluteString()}}),l=O4(i,s.id,t),o=Object.keys(i.formState.dirtyFields).length>0;return e.jsx(ee,{form:i,onSubmit:c=>{l.mutate(c,{onSuccess:u=>{M(d("Episode created")),a(`../${u.episode.episode_number}`,{relative:"path"})}})},children:e.jsx(mt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:l.isLoading||!o,children:e.jsx(n,{message:"Save"})}),children:e.jsx(kl,{})})})}function q4(){const s=Pr("episode");return s.data?e.jsx(H4,{episode:s.data.episode}):e.jsx(mt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:!0,children:e.jsx(n,{message:"Save"})}),children:e.jsx(ut,{query:s})})}function H4({episode:s}){const t=we(),a=Q(),r=V({defaultValues:{name:s.name,description:s.description,release_date:s.release_date,runtime:s.runtime,popularity:s.popularity,poster:s.poster}}),i=R4(t.id,s.season_number,s.episode_number,r);return e.jsx(ee,{form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>{M(d("Episode updated")),a("../../../",{relative:"path"})}})},children:e.jsx(mt,{actions:e.jsx(b,{variant:"flat",color:"primary",type:"submit",disabled:i.isLoading||!r.formState.isDirty,children:e.jsx(n,{message:"Save"})}),children:e.jsx(kl,{})})})}function kl(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"gap-24 md:flex",children:[e.jsx(ve,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"episode-posters",label:e.jsx(n,{message:"Poster"}),stretchPreview:!0}),e.jsxs("div",{className:"mb-24 flex-auto max-md:mt-24",children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Title"}),className:"mb-24",required:!0}),e.jsx(js,{name:"release_date",label:e.jsx(n,{message:"Release date"}),className:"mb-24",granularity:"day"}),e.jsx(g,{name:"runtime",label:e.jsx(n,{message:"Runtime"}),type:"number",min:1,className:"mb-24"}),e.jsx(g,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1})]})]}),e.jsx(g,{name:"description",label:e.jsx(n,{message:"Overview"}),inputElementType:"textarea",rows:6,className:"mb-24"})]})}const Us=(s,t,a,r)=>{const i=["titles",`${s}`,"credits"];return t&&i.push("season",`${t}`),a&&i.push("episode",`${a}`),r&&i.push(r),i};function Bs(s={}){const{titleId:t,season:a,episode:r}=B();return Tr({endpoint:`titles/${t}/credits`,queryKey:Us(t,a,r,s),queryParams:{...s,perPage:30,season:a||"",episode:r||""}})}function Z4(){const{titleId:s}=B();return T(t=>W4(t),{onSuccess:async()=>{await _.invalidateQueries(Us(s)),M(d("Credit added"))},onError:t=>q(t)})}function W4(s){return S.post("titles/credits/reorder",s).then(t=>t.data)}function Q4(s,t){const{titleId:a,season:r,episode:i}=B();return T(l=>G4(a,r,i,t,l),{onSuccess:async()=>{await _.invalidateQueries(Us(a)),M(d("Credit updated"))},onError:l=>J(l,s)})}function G4(s,t,a,r,i){return i={...i,season:t,episode:a},S.put(`titles/${s}/credits/${r}`,i).then(l=>l.data)}function K4(s){const{titleId:t,season:a,episode:r}=B();return T(i=>J4(t,a,r,i),{onSuccess:async()=>{await _.invalidateQueries(Us(t)),M(d("Credit added"))},onError:i=>J(i,s)})}function J4(s,t,a,r){return r={...r,season:t,episode:a},S.post(`titles/${s}/credits`,r).then(i=>i.data)}function Y4({isCrew:s}){const{formId:t,close:a}=Z(),r=V({defaultValues:{department:s?void 0:"actors",job:s?void 0:"actor"}}),i=K4(r);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Create credit"})}),e.jsx(X,{children:e.jsxs(ee,{id:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>a()})},children:[e.jsx(yr,{modelType:"person",name:"person_id",label:e.jsx(n,{message:"Person"}),className:"mb-24",autoFocus:!0}),e.jsx(_l,{isCrew:s})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:i.isLoading,children:e.jsx(n,{message:"Create"})})]})]})}function _l({isCrew:s}){return e.jsxs(m.Fragment,{children:[e.jsx(g,{name:"character",label:e.jsx(n,{message:"Character"}),required:!s,className:w("mb-24",s&&"hidden")}),e.jsx(X4,{isCrew:s})]})}function X4({isCrew:s}){const{data:t}=ie(["tmdbDepartments"]),{watch:a}=I(),r=a("department"),{jobs:i,departments:l}=m.useMemo(()=>{const o=(t==null?void 0:t.tmdbDepartments.map(x=>({department:x.department.toLowerCase(),jobs:x.jobs})))||[],c=o.find(x=>x.department===r);return{jobs:(c==null?void 0:c.jobs.map(x=>({job:x.toLowerCase()})))||[],departments:o}},[t,r]);return e.jsxs(m.Fragment,{children:[e.jsx(D,{name:"department",label:e.jsx(n,{message:"Department"}),required:!0,disabled:!s,items:l,className:"mb-24",selectionMode:"single",showSearchField:!0,children:o=>e.jsx(h,{value:o.department,children:e.jsx(n,{message:o.department})})}),e.jsx(D,{name:"job",label:e.jsx(n,{message:"Job"}),required:!0,disabled:!s,items:i,selectionMode:"single",showSearchField:!0,children:o=>e.jsx(h,{value:o.job,children:e.jsx(n,{message:o.job})},o.job)})]})}function ej({credit:s}){const{formId:t,close:a}=Z(),r=s.pivot.department!=="actors",i=V({defaultValues:{character:s.pivot.character,department:s.pivot.department,job:s.pivot.job}}),l=Q4(i,s.pivot.id);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Edit credit"})}),e.jsx(X,{children:e.jsxs(ee,{id:t,form:i,onSubmit:o=>{l.mutate(o,{onSuccess:()=>a()})},children:[e.jsx(qe,{value:s.name,label:e.jsx(n,{message:"Person"}),required:!0,readOnly:!0,disabled:!0,className:"mb-24"}),e.jsx(_l,{isCrew:r})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:l.isLoading,children:e.jsx(n,{message:"Save"})})]})]})}function sj(s){const{titleId:t,season:a,episode:r}=B();return T(()=>tj(t,a,r,s),{onSuccess:async()=>{await _.invalidateQueries(Us(t)),M(d("Credit deleted"))},onError:i=>q(i)})}function tj(s,t,a,r){return S.delete(`titles/${s}/credits/${r}`,{params:{season:t,episode:a}}).then(i=>i.data)}const Ml=()=>({key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsxs(P,{type:"modal",children:[e.jsx(C,{children:e.jsx(de,{})}),e.jsx(ej,{credit:s})]}),e.jsx(aj,{creditId:s.pivot.id})]})});function aj({creditId:s}){const t=sj(s);return e.jsxs(P,{type:"modal",onClose:a=>{a&&t.mutate()},children:[e.jsx(C,{children:e.jsx(We,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete credit"}),body:e.jsx(n,{message:"Are you sure you want to delete this credit?"}),confirm:e.jsx(n,{message:"Delete"})})]})}const Il=E([e.jsx("path",{d:"M21 5h2v14h-2zm-4 0h2v14h-2zm-3 0H2c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm-1 12H3V7h10v10z"},"0"),e.jsx("circle",{cx:"8",cy:"9.94",r:"1.95"},"1"),e.jsx("path",{d:"M11.89 15.35c0-1.3-2.59-1.95-3.89-1.95s-3.89.65-3.89 1.95V16h7.78v-.65z"},"2")],"RecentActorsOutlined");function Tl({query:s}){return s.data&&!s.items.length?e.jsx(nj,{}):s.data?e.jsx(Ut,{query:s}):e.jsx(ut,{query:s})}function nj(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Il,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No credits have been added yet"})})}const rj=[{key:"dragHandle",width:"w-42 flex-shrink-0",header:()=>e.jsx(n,{message:"Drag handle"}),hideHeader:!0,body:()=>e.jsx(za,{className:"cursor-pointer text-muted hover:text"})},{key:"name",header:()=>e.jsx(n,{message:"Person"}),visibleInMode:"all",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Ua,{rounded:!0,person:s,size:"w-44"}),e.jsx("div",{className:"overflow-hidden min-w-0",children:s.name})]})},{key:"character",header:()=>e.jsx(n,{message:"Character"}),body:s=>s.pivot.character},Ml()];function on({query:s}){return e.jsxs(m.Fragment,{children:[e.jsx(lt,{enableSelection:!1,columns:rj,data:s.items,renderRowAs:ij,cellHeight:"h-54"}),e.jsx(Tl,{query:s})]})}function ij({item:s,children:t,className:a,...r}){const i=Nr(),l=m.useContext(Ot),o=m.useRef(null),c=m.useRef(null),u=l.data,x=Z4(),{sortableProps:p}=Rt({ref:o,disabled:i??!1,item:s,items:u,type:"cast-editor-item",preview:c,previewVariant:"line",onSortEnd:(j,v)=>{const f=u.map(y=>y.pivot.id),k=fr(f,j,v);x.mutate({ids:k})}});return e.jsxs("div",{className:a,ref:o,...ds(p,r),children:[t,!s.isPlaceholder&&e.jsx(lj,{item:s,ref:c})]})}const lj=U.forwardRef(({item:s},t)=>e.jsx(Pa,{ref:t,children:()=>e.jsx("div",{className:"p-8 rounded shadow bg-chip text-sm",children:s.name})}));function qs({query:s,isCrew:t}){const{trans:a}=A();return e.jsxs("div",{className:"flex items-center gap-24 justify-between mb-14",children:[e.jsxs(P,{type:"modal",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),children:e.jsx(n,{message:"Add credit"})}),e.jsx(Y4,{isCrew:t})]}),e.jsx(qe,{size:"sm",value:s.searchQuery,onChange:r=>s.setSearchQuery(r.target.value),placeholder:a(d("Search")),startAdornment:e.jsx(Mt,{})})]})}function oj(){const s=Bs({department:"actors"});return e.jsxs(mt,{children:[e.jsx(qs,{query:s,isCrew:!1}),e.jsx(on,{query:s})]})}function cj(){const s=Bs({department:"actors"});return e.jsxs(ze,{children:[e.jsx(qs,{query:s,isCrew:!1}),e.jsx(on,{query:s})]})}const dj=[{key:"name",header:()=>e.jsx(n,{message:"Person"}),visibleInMode:"all",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Ua,{rounded:!0,person:s,size:"w-44"}),e.jsx("div",{className:"overflow-hidden min-w-0",children:s.name})]})},{key:"department",header:()=>e.jsx(n,{message:"Department"}),body:s=>s.pivot.department},{key:"job",header:()=>e.jsx(n,{message:"Job"}),body:s=>s.pivot.job},Ml()];function cn({query:s}){return e.jsxs(m.Fragment,{children:[e.jsx(lt,{enableSelection:!1,columns:dj,data:s.items,cellHeight:"h-54",tableBody:e.jsx(uj,{})}),e.jsx(Tl,{query:s})]})}function uj({renderRowAs:s}){const{data:t}=m.useContext(Ot);return e.jsx(m.Fragment,{children:t.map((a,r)=>e.jsx(zr,{item:a,index:r,renderAs:s},a.pivot.id))})}function mj(){const s=Bs({crewOnly:"true"});return e.jsxs(ze,{children:[e.jsx(qs,{query:s,isCrew:!0}),e.jsx(cn,{query:s})]})}function xj(){const s=Bs({department:"actors"});return e.jsxs(ln,{children:[e.jsx(qs,{query:s,isCrew:!1}),e.jsx(on,{query:s})]})}function hj(){const s=Bs({crewOnly:"true"});return e.jsxs(ln,{children:[e.jsx(qs,{query:s,isCrew:!0}),e.jsx(cn,{query:s})]})}function gj(){const s=Bs({crewOnly:"true"});return e.jsxs(mt,{children:[e.jsx(qs,{query:s,isCrew:!0}),e.jsx(cn,{query:s})]})}function pj(s){const{titleId:t}=B();return T(()=>jj(t,s),{onSuccess:async()=>{await _.invalidateQueries(["titles",`${t}`]),M(d("Tag detached"))},onError:a=>q(a)})}function jj(s,t){return S.delete(`titles/${s}/tags/${t.model_type}/${t.id}`).then(a=>a.data)}function fj(s,t){const{titleId:a}=B();return T(r=>bj(a,t,r),{onSuccess:async()=>{await _.invalidateQueries(["titles",`${a}`]),M(d("Tag attached"))},onError:r=>J(r,s)})}function bj(s,t,a){return S.post(`titles/${s}/tags/${t}`,a).then(r=>r.data)}function vj({type:s}){const{formId:t,close:a}=Z(),r=V(),i=fj(r,s);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add :name",values:{name:s.replace("_"," ")}})}),e.jsx(X,{children:e.jsx(ee,{id:t,form:r,onSubmit:l=>{i.mutate(l,{onSuccess:()=>a()})},children:e.jsx(yj,{type:s})})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>a(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:t,type:"submit",variant:"flat",color:"primary",disabled:i.isLoading,children:e.jsx(n,{message:"Add"})})]})]})}function yj({type:s}){const[t,a]=m.useState(""),{isFetching:r,data:i}=vr(s,{query:t});return e.jsx(Nl,{isAsync:!0,name:"tag_name",isLoading:r,inputValue:t,onInputValueChange:a,items:i==null?void 0:i.results,allowCustomValue:!0,autoFocus:!0,children:l=>e.jsx(h,{value:l.name,textLabel:l.name,children:e.jsx(n,{message:l.description||l.name})},l.id)})}const Cj=[{key:"name",header:()=>e.jsx(n,{message:"ID"}),visibleInMode:"all",body:s=>e.jsx("span",{children:s.name})},{key:"display_name",header:()=>e.jsx(n,{message:"Display name"}),body:s=>e.jsx("span",{children:s.display_name})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(P,{type:"modal",children:[e.jsx(C,{className:"text-muted",children:e.jsx(Ee,{})}),e.jsx(Sj,{tag:s})]})}];function oa({type:s}){const t=wj({type:s});return e.jsxs(ze,{children:[e.jsx("div",{className:"mb-14",children:e.jsxs(P,{type:"modal",children:[e.jsx(b,{variant:"outline",color:"primary",startIcon:e.jsx(ue,{}),children:e.jsx(n,{message:"Add :name",values:{name:s.replace("_"," ")}})}),e.jsx(vj,{type:s})]})}),e.jsx(lt,{enableSelection:!1,columns:Cj,data:t})]})}function wj({type:s}){const t=we();switch(s){case st:return t.genres;case ps:return t.keywords;case Vt:return t.production_countries}}function Sj({tag:s}){const{close:t}=Z(),a=pj(s),r=s.model_type.replace("_"," ");return e.jsx(ce,{isLoading:a.isLoading,isDanger:!0,title:e.jsx(n,{message:"Detach :name",values:{name:r}}),body:e.jsx(n,{message:"Are you sure you want to detach this :name?",values:{name:r}}),confirm:e.jsx(n,{message:"Detach"}),onConfirm:()=>{a.mutate(void 0,{onSuccess:()=>t()})}})}function Nj(){const s=we();return e.jsx(ze,{children:e.jsx(ml,{hideTitle:!0,commentable:s})})}const Lj=""+new URL("awards-411fec7f.svg",import.meta.url).href,kj=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Person"}),body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Ua,{person:s,srcSize:"sm",size:"w-32",rounded:!0}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(wc,{person:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:e.jsx(Sc,{person:s,linkTarget:"_blank",linkColor:"inherit"})})]})]})},{key:"birth_date",allowsSorting:!0,header:()=>e.jsx(n,{message:"Birth date"}),body:s=>e.jsx(ae,{date:s.birth_date})},{key:"views",allowsSorting:!0,header:()=>e.jsx(n,{message:"Page views"}),body:s=>s.views?e.jsx(Re,{value:s.views}):null,width:"w-124 flex-shrink-0"},{key:"popularity",allowsSorting:!0,header:()=>e.jsx(n,{message:"Popularity"}),body:s=>s.popularity?e.jsx(Re,{value:s.popularity}):null,width:"w-124 flex-shrink-0"},{key:"updated_at",allowsSorting:!0,width:"w-124 flex-shrink-0",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ae,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(F,{to:`${s.id}/edit/primary-facts`,className:"text-muted",children:e.jsx(oe,{label:e.jsx(n,{message:"Edit"}),children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})})}],_j=[{key:"known_for",label:d("Known for"),description:d("What role is person known for"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"acting",options:[{label:d("Acting"),key:"acting",value:"acting"},{label:d("Directing"),key:"directing",value:"directing"},{label:d("Production"),key:"production",value:"production"},{label:d("Writing"),key:"writing",value:"writing"},{label:d("Crew"),key:"crew",value:"crew"},{label:d("Art"),key:"art",value:"art"},{label:d("Costume & Make-Up"),key:"Costume & Make-Up",value:"Costume & Make-Up"},{label:d("Camera"),key:"camera",value:"camera"},{label:d("Editing"),key:"editing",value:"editing"},{label:d("Visual Effects"),key:"visual effects",value:"visual effects"},{label:d("Sound"),key:"sound",value:"sound"},{label:d("Lighting"),key:"lighting",value:"lighting"},{label:d("Creator"),key:"creator",value:"creator"}]}},{key:"gender",label:d("Gender"),defaultOperator:O.eq,control:{type:H.Select,defaultValue:"male",options:[{label:d("Male"),key:"male",value:"male"},{label:d("Female"),key:"female",value:"female"}]}},{key:"poster",label:d("No poster"),description:d("Whether person has a poster"),defaultOperator:O.eq,control:{type:H.BooleanToggle,defaultValue:null}},{key:"views",label:d("Page views"),description:d("Number of unique page views"),defaultOperator:O.lte,operators:Ks,control:{type:H.Input,inputType:"number",minValue:1,defaultValue:100}},tt({key:"birth_date",label:d("Birth date"),description:d("Date person was born")}),tt({key:"death_date",label:d("Death date"),description:d("Date person died")}),Se({description:d("Date person was created")}),Ne({description:d("Date person was last updated")})];function Mj(){return e.jsx(fe,{endpoint:"people",title:e.jsx(n,{message:"People"}),columns:kj,filters:_j,actions:e.jsx(Ij,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:Lj,title:e.jsx(n,{message:"No people have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching people"})})})}function Ij(){const{tmdb_is_setup:s}=xe(),t=Q();return e.jsxs(m.Fragment,{children:[s&&e.jsxs(P,{type:"modal",onClose:a=>{a&&t(`/admin/people/${a.id}/edit/primary-facts`)},children:[e.jsx(oe,{label:e.jsx(n,{message:"Import using TheMovieDB ID"}),children:e.jsx(C,{variant:"outline",color:"primary",radius:"rounded",className:"flex-shrink-0",size:"sm",children:e.jsx(rn,{})})}),e.jsx(Cl,{modelType:Nc})]}),e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add person"})})]})}function Tj(s){return T(t=>Fj(t),{onSuccess:async()=>{await _.invalidateQueries(["people"]),M(d("Person created"))},onError:t=>J(t,s)})}function Fj(s){return S.post("people",s).then(t=>t.data)}function Fl(){return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:"mb-24 gap-24 md:flex",children:[e.jsx(ve,{variant:"square",previewSize:"w-204 aspect-poster",name:"poster",diskPrefix:"person-posters",label:e.jsx(n,{message:"Poster"}),showRemoveButton:!0}),e.jsxs("div",{className:"flex-auto max-md:mt-24",children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),className:"mb-24",required:!0}),e.jsx(Ej,{}),e.jsx(js,{name:"birth_date",label:e.jsx(n,{message:"Birth date"}),className:"mb-24",granularity:"day"}),e.jsx(js,{name:"death_date",label:e.jsx(n,{message:"Death date"}),granularity:"day"})]})]}),e.jsx(g,{name:"description",label:e.jsx(n,{message:"Biography"}),inputElementType:"textarea",rows:4,className:"mb-24"}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsx(g,{name:"birth_place",label:e.jsx(n,{message:"Birth place"}),className:"flex-1 max-md:mb-24"})}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsxs(D,{name:"gender",label:e.jsx(n,{message:"Gender"}),className:"flex-1 max-md:mb-24",selectionMode:"single",children:[e.jsx(h,{value:"male",children:e.jsx(n,{message:"Male"})}),e.jsx(h,{value:"female",children:e.jsx(n,{message:"Female"})})]})}),e.jsx("div",{className:"mb-24 items-center gap-24 md:flex",children:e.jsx(g,{name:"popularity",label:e.jsx(n,{message:"Popularity"}),type:"number",min:1,className:"flex-1 max-md:mb-24"})})]})}function Ej(){const{data:s}=ie(["tmdbDepartments"]),t=m.useMemo(()=>s==null?void 0:s.tmdbDepartments.map(a=>a.department==="Actors"?{department:"Acting"}:{department:a.department}),[s]);return e.jsx(D,{name:"known_for",label:e.jsx(n,{message:"Known for"}),required:!0,items:t,className:"mb-24",selectionMode:"single",showSearchField:!0,children:a=>e.jsx(h,{value:a.department,children:e.jsx(n,{message:a.department})})})}function Pj(){const s=Q(),t=V({defaultValues:{gender:"female",known_for:"Acting",popularity:3}}),a=Tj(t);return e.jsx(Ve,{onSubmit:r=>a.mutate(r,{onSuccess:i=>{s(`../${i.person.id}/edit`,{relative:"path",replace:!0})}}),form:t,title:e.jsx(n,{message:"New person"}),isLoading:a.isLoading,disableSaveWhenNotDirty:!0,children:e.jsx(ye,{children:e.jsx(Fl,{})})})}function zj(s){const{personId:t}=B();return T(a=>Dj(a,t),{onSuccess:async()=>{await _.invalidateQueries(["people",`${t}`]),M(d("Person updated"))},onError:a=>J(a,s)})}function Dj(s,t){return S.put(`people/${t}`,s).then(a=>a.data)}function Aj(){const s=Lc("editPersonPage");return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ia,{query:s}),e.jsx($j,{data:s.data})]}):e.jsx("div",{className:"relative h-full w-full",children:e.jsx(hs,{query:s,loaderClassName:"absolute inset-0 m-auto"})})}function $j({data:s}){const{person:t}=s,a=Q(),r=V({defaultValues:{name:t.name,known_for:t.known_for,poster:t.poster,birth_date:t.birth_date,death_date:t.death_date,birth_place:t.birth_place,description:t.description,gender:t.gender,popularity:t.popularity}}),i=zj(r),{pathname:l}=fs(),c=l.split("/").pop()==="credits"?1:0;return e.jsx(Ve,{onSubmit:u=>i.mutate(u,{onSuccess:()=>{a("../../../",{relative:"path",replace:!0})}}),form:r,title:e.jsx(n,{values:{name:t.name},message:"Edit “:name“"}),isLoading:i.isLoading,disableSaveWhenNotDirty:!0,children:e.jsxs(ws,{selectedTab:c,children:[e.jsxs(Ss,{children:[e.jsx(Me,{elementType:F,to:"../primary-facts",relative:"path",replace:!0,children:e.jsx(n,{message:"Primary facts"})}),e.jsx(Me,{elementType:F,to:"../credits",relative:"path",replace:!0,children:e.jsx(n,{message:"Credits"})})]}),e.jsx("div",{className:"min-h-512 pt-24",children:e.jsx(ye,{children:e.jsx(As,{context:s})})})]})})}function Rj(s){const{personId:t}=B();return T(()=>Vj(s.id,void 0,void 0,s.pivot.id),{onSuccess:async()=>{await _.invalidateQueries(Us(s.id)),await _.invalidateQueries(["people",`${t}`]),M(d("Credit deleted"))},onError:a=>q(a)})}function Vj(s,t,a,r){return S.delete(`titles/${s}/credits/${r}`,{params:{season:t,episode:a}}).then(i=>i.data)}const Oj=[{key:"name",header:()=>e.jsx(n,{message:"Credit"}),visibleInMode:"all",width:"flex-3",body:s=>e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsx(Ds,{title:s,srcSize:"sm",size:"w-32"}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("div",{className:"overflow-hidden overflow-ellipsis",children:e.jsx(Ye,{title:s,target:"_blank"})}),e.jsx("div",{className:"text-muted text-xs overflow-hidden overflow-ellipsis",children:s.is_series?e.jsx(n,{message:"Series"}):e.jsx(n,{message:"Movie"})})]})]})},{key:"year",header:()=>e.jsx(n,{message:"Year"}),body:s=>s.year},{key:"character",header:()=>e.jsx(n,{message:"Character"}),body:s=>s.pivot.character?s.pivot.character:"-"},{key:"department",header:()=>e.jsx(n,{message:"Department"}),body:s=>e.jsx("span",{className:"capitalize",children:s.pivot.department})},{key:"job",header:()=>e.jsx(n,{message:"Job"}),body:s=>e.jsx("span",{className:"capitalize",children:s.pivot.job})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsx("div",{className:"text-muted",children:e.jsx(Hj,{credit:s})})}];function Uj(){const s=we(),t=m.useMemo(()=>Object.values(s.credits).flat().filter(a=>a.pivot!=null),[s.credits]);return e.jsxs(m.Fragment,{children:[e.jsx(lt,{enableSelection:!1,columns:Oj,data:t,cellHeight:"h-54",tableBody:e.jsx(Bj,{})}),!t.length&&e.jsx(qj,{})]})}function Bj({renderRowAs:s}){const{data:t}=m.useContext(Ot);return e.jsx(m.Fragment,{children:t.map((a,r)=>e.jsx(zr,{item:a,index:r,renderAs:s},a.pivot.id))})}function qj(){return e.jsx(He,{className:"mt-40",imageMargin:"mb-8",image:e.jsx("div",{className:"text-muted",children:e.jsx(Il,{size:"xl"})}),imageHeight:"h-auto",title:e.jsx(n,{message:"No credits have been added yet"})})}function Hj({credit:s}){const t=Rj(s);return e.jsxs(P,{type:"modal",children:[e.jsx(C,{children:e.jsx(We,{})}),e.jsx(ce,{isDanger:!0,title:e.jsx(n,{message:"Delete credit"}),body:e.jsx(n,{message:"Are you sure you want to delete this credit?"}),confirm:e.jsx(n,{message:"Delete"}),isLoading:t.isLoading,onConfirm:()=>t.mutate()})]})}function Gt(){const[s,t]=m.useState(!1),{trans:a}=A(),i=I().watch("title"),l=a({message:"Title"});return s?e.jsx(g,{placeholder:l,autoFocus:!0,className:"mb-30",onBlur:()=>{t(!1)},name:"title",required:!0}):e.jsxs("h1",{tabIndex:0,onClick:()=>{t(!0)},onFocus:()=>{t(!0)},className:w("hover:bg-primary/focus rounded cursor-pointer",!i&&"text-muted"),children:[i||l,e.jsx(de,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}const Zj=E(e.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"UndoOutlined"),Wj=E(e.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"}),"RedoOutlined");function Qj({editor:s}){return e.jsxs("span",{children:[e.jsx(C,{size:"md",radius:"rounded",disabled:!s.can().undo(),onClick:()=>{s.commands.focus(),s.commands.undo()},children:e.jsx(Zj,{})}),e.jsx(C,{size:"md",radius:"rounded",disabled:!s.can().redo(),onClick:()=>{s.commands.focus(),s.commands.redo()},children:e.jsx(Wj,{})})]})}const El=E(e.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"CodeOutlined");function Gj({editor:s}){return e.jsxs(P,{type:"modal",onClose:t=>{t!=null&&(s==null||s.commands.setContent(t))},children:[e.jsx(b,{variant:"text",startIcon:e.jsx(El,{}),children:e.jsx(n,{message:"Source"})}),e.jsx(en,{title:e.jsx(n,{message:"Source code"}),defaultValue:s.getHTML()})]})}function Es(){return e.jsx("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}const Kj=E(e.jsx("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"}),"FormatBoldOutlined"),Jj=E(e.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),Yj=E(e.jsx("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"}),"FormatUnderlinedOutlined");function Xj({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(C,{size:t,radius:"rounded",color:s.isActive("bold")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBold()},children:e.jsx(Kj,{})}),e.jsx(C,{size:t,radius:"rounded",color:s.isActive("italic")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleItalic()},children:e.jsx(Jj,{})}),e.jsx(C,{size:t,radius:"rounded",color:s.isActive("underline")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleUnderline()},children:e.jsx(Yj,{})})]})}const e2=E(e.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"}),"FormatListBulletedOutlined"),s2=E(e.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"}),"FormatListNumberedOutlined");function t2({editor:s,size:t}){const a=s.isActive("bulletList"),r=s.isActive("orderedList");return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(C,{size:t,radius:"rounded",color:a?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBulletList()},children:e.jsx(e2,{})}),e.jsx(C,{size:t,radius:"rounded",color:r?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleOrderedList()},children:e.jsx(s2,{})})]})}function a2({editor:s,size:t}){return e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:t,radius:"rounded",className:w("flex-shrink-0"),children:e.jsx(sn,{})}),e.jsx(n2,{editor:s})]})}function n2({editor:s}){const t=s.getAttributes("link").href,a=s.state.doc.textBetween(s.state.selection.from,s.state.selection.to,""),r=V({defaultValues:{href:t,text:a}}),{formId:i,close:l}=Z();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Insert link"})}),e.jsx(X,{children:e.jsxs(ee,{form:r,id:i,onSubmit:o=>{s.state.selection.empty&&o.text?s.commands.insertContent(`<a href="${o.href}" target="${o.target}">${o.text}</a>`):s.state.selection.empty||(o.href?s.chain().focus().extendMarkRange("link").setLink({href:o.href,target:o.target}).run():s.chain().focus().extendMarkRange("link").unsetLink().run()),l()},children:[e.jsx(g,{name:"href",label:e.jsx(n,{message:"URL"}),autoFocus:!0,type:"url",className:"mb-20"}),e.jsx(g,{name:"text",label:e.jsx(n,{message:"Text to display"}),className:"mb-20"}),e.jsxs(D,{selectionMode:"single",name:"target",label:e.jsx(n,{message:"Open link in..."}),children:[e.jsx(h,{value:"_self",children:e.jsx(n,{message:"Current window"})}),e.jsx(h,{value:"_blank",children:e.jsx(n,{message:"New window"})})]})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:l,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{type:"submit",form:i,variant:"flat",color:"primary",children:e.jsx(n,{message:"Save"})})]})]})}const r2=2097152;function i2({editor:s,size:t}){const{selectAndUploadFile:a}=dr(),r=()=>{a({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[mr.image],maxFileSize:r2},metadata:{diskPrefix:"page_media",disk:Ma.public},onSuccess:i=>{s.commands.focus(),s.commands.setImage({src:i.url})}})};return e.jsx(C,{size:t,radius:"rounded",onClick:r,className:w("flex-shrink-0"),children:e.jsx(Ir,{})})}const l2=E(e.jsx("path",{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"}),"FormatClearOutlined");function o2({editor:s,size:t}){return e.jsx(C,{className:w("flex-shrink-0"),size:t,radius:"rounded",onClick:()=>{s.chain().focus().clearNodes().unsetAllMarks().run()},children:e.jsx(l2,{})})}const c2=E(e.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),d2=E([e.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),e.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHighOutlined"),u2=E(e.jsx("path",{d:"M16 4H4c-1.1 0-2 .9-2 2v12.01c0 1.1.9 1.99 2 1.99h16c1.1 0 2-.9 2-2v-8l-6-6zM4 18.01V6h11v5h5v7.01H4z"}),"NoteOutlined"),m2=E([e.jsx("path",{d:"M9.5 7.5v9l7-4.5z"},"0"),e.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14.01H4V5.99h16v12.02z"},"1")],"SmartDisplayOutlined");function x2({editor:s,size:t}){const[a,r]=m.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(bs,{onItemSelected:i=>{i==="hr"?(s.commands.focus(),s.commands.setHorizontalRule()):i==="embed"?r("embed"):(s.commands.focus(),s.commands.addInfo({type:i}))},children:[e.jsx(C,{variant:"text",size:t,radius:"rounded",className:w("flex-shrink-0"),children:e.jsx(pr,{})}),e.jsxs(vs,{children:[e.jsx(h,{value:"hr",startIcon:e.jsx(c2,{}),children:e.jsx(n,{message:"Horizontal rule"})}),e.jsx(h,{value:"embed",startIcon:e.jsx(m2,{}),children:e.jsx(n,{message:"Embed"})}),e.jsx(h,{value:"important",startIcon:e.jsx(d2,{}),children:e.jsx(n,{message:"Important"})}),e.jsx(h,{value:"warning",startIcon:e.jsx(yo,{}),children:e.jsx(n,{message:"Warning"})}),e.jsx(h,{value:"success",startIcon:e.jsx(u2,{}),children:e.jsx(n,{message:"Note"})})]})]}),e.jsx(P,{type:"modal",isOpen:!!a,onClose:()=>{r(!1)},children:e.jsx(h2,{editor:s})})]})}function h2({editor:s}){const t=s.getAttributes("embed").src,a=V({defaultValues:{src:t}}),{formId:r,close:i}=Z();return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Insert link"})}),e.jsx(X,{children:e.jsx(ee,{form:a,id:r,onSubmit:l=>{s.commands.setEmbed(l),i()},children:e.jsx(g,{name:"src",label:e.jsx(n,{message:"Embed URL"}),autoFocus:!0,type:"url",required:!0})})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:i,variant:"text",children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{type:"submit",form:r,disabled:!a.formState.isValid,variant:"flat",color:"primary",children:e.jsx(n,{message:"Add"})})]})]})}function Oe({children:s,modifier:t,separator:a="+"}){const r=Co()?e.jsx("span",{className:"text-base align-middle",children:"⌘"}):"Ctrl";return e.jsxs("kbd",{className:"text-xs text-muted",children:[t&&e.jsxs(e.Fragment,{children:[r,a]}),s]})}function g2({editor:s,size:t}){return e.jsxs(bs,{floatingMinWidth:"w-256",onItemSelected:a=>{s.commands.focus(),typeof a=="string"&&a.startsWith("h")?s.commands.toggleHeading({level:parseInt(a.replace("h",""))}):a==="code"?s.commands.toggleCode():a==="strike"?s.commands.toggleStrike():a==="super"?s.commands.toggleSuperscript():a==="sub"?s.commands.toggleSubscript():a==="blockquote"?s.commands.toggleBlockquote():a==="paragraph"&&s.commands.setParagraph()},children:[e.jsx(b,{className:w("flex-shrink-0"),variant:"text",size:t,endIcon:e.jsx(wo,{}),children:e.jsx(n,{message:"Format"})}),e.jsxs(vs,{children:[e.jsx(h,{value:"h1",endSection:e.jsx(Oe,{modifier:!0,children:"Alt+1"}),children:e.jsx(n,{message:"Heading :number",values:{number:1}})}),e.jsx(h,{value:"h2",endSection:e.jsx(Oe,{modifier:!0,children:"Alt+2"}),children:e.jsx(n,{message:"Heading :number",values:{number:2}})}),e.jsx(h,{value:"h3",endSection:e.jsx(Oe,{modifier:!0,children:"Alt+3"}),children:e.jsx(n,{message:"Heading :number",values:{number:3}})}),e.jsx(h,{value:"h4",endSection:e.jsx(Oe,{modifier:!0,children:"Alt+4"}),children:e.jsx(n,{message:"Heading :number",values:{number:4}})}),e.jsx(h,{value:"code",endSection:e.jsx(Oe,{modifier:!0,children:"E"}),children:e.jsx(n,{message:"Code"})}),e.jsx(h,{value:"strike",endSection:e.jsx(Oe,{modifier:!0,children:"Shift+X"}),children:e.jsx(n,{message:"Strikethrough"})}),e.jsx(h,{value:"super",endSection:e.jsx(Oe,{modifier:!0,separator:" ",children:"."}),children:e.jsx(n,{message:"Superscript"})}),e.jsx(h,{value:"sub",endSection:e.jsx(Oe,{modifier:!0,separator:" ",children:","}),children:e.jsx(n,{message:"Subscript"})}),e.jsx(h,{value:"blockquote",endSection:e.jsx(Oe,{modifier:!0,children:"Shift+B"}),children:e.jsx(n,{message:"Blockquote"})}),e.jsx(h,{value:"paragraph",endSection:e.jsx(Oe,{modifier:!0,children:"Alt+0"}),children:e.jsx(n,{message:"Paragraph"})})]})]})}const p2=E(e.jsx("path",{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"}),"FormatColorTextOutlined"),j2=E(e.jsx("path",{d:"M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10 10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5zM2 20h20v4H2v-4z"}),"FormatColorFillOutlined");function f2({editor:s,size:t}){const[a,r]=m.useState(!1),i=s.getAttributes("textStyle").color,l=s.getAttributes("textStyle").backgroundColor;return e.jsxs(m.Fragment,{children:[e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(C,{size:t,radius:"rounded",color:i?"primary":null,onClick:()=>{r("text")},children:e.jsx(p2,{})}),e.jsx(C,{size:t,radius:"rounded",color:l?"primary":null,onClick:()=>{r("bg")},children:e.jsx(j2,{})})]}),e.jsx(P,{currentValue:a==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!a,onClose:o=>{o&&(a==="text"?s.commands.setColor(o):s.commands.setBackgroundColor(o)),r(!1)},children:e.jsx(Ka,{defaultValue:a==="text"?"#000000":"#FFFFFF"})})]})}const b2=E(e.jsx("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),v2=E(e.jsx("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined"),y2=E(e.jsx("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),C2=E(e.jsx("path",{d:"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"}),"FormatAlignJustifyOutlined"),yt={left:{icon:b2,label:d("Align left")},center:{icon:v2,label:d("Align center")},right:{icon:y2,label:d("Align right")},justify:{icon:C2,label:d("Justify")}};function w2({editor:s,size:t}){const a=Object.keys(yt).find(i=>s.isActive({textAlign:i}))||"left",r=a?yt[a].icon:yt.left.icon;return e.jsxs(bs,{floatingWidth:"auto",selectionMode:"single",selectedValue:a,onSelectionChange:i=>{s.commands.focus(),s.commands.setTextAlign(i)},children:[e.jsx(C,{size:t,color:a?"primary":null,radius:"rounded",className:w("flex-shrink-0"),children:e.jsx(r,{})}),e.jsx(vs,{children:Object.entries(yt).map(([i,l])=>{const o=l.icon;return e.jsx(h,{value:i,startIcon:e.jsx(o,{size:"md"}),capitalizeFirst:!0,children:e.jsx(n,{message:l.label.message})},i)})})]})}const S2=E(e.jsx("path",{d:"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentDecreaseOutlined"),N2=E(e.jsx("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentIncreaseOutlined");function L2({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(C,{size:t,radius:"rounded",onClick:()=>{s.commands.focus(),s.commands.outdent()},children:e.jsx(S2,{})}),e.jsx(C,{size:t,radius:"rounded",onClick:()=>{s.commands.focus(),s.commands.indent()},children:e.jsx(N2,{})})]})}function k2({editor:s,size:t}){const a=s.getAttributes("codeBlock").language||"";return e.jsxs(bs,{selectionMode:"single",selectedValue:a,onSelectionChange:r=>{s.commands.toggleCodeBlock({language:r})},children:[e.jsx(C,{className:w("flex-shrink-0"),size:t,color:a?"primary":null,radius:"rounded",children:e.jsx(El,{})}),e.jsxs(vs,{children:[e.jsx(h,{value:"html",children:"HTML"}),e.jsx(h,{value:"javascript",children:"JavaScript"}),e.jsx(h,{value:"css",children:"CSS"}),e.jsx(h,{value:"php",children:"PHP"}),e.jsx(h,{value:"shell",children:"Shell"}),e.jsx(h,{value:"bash",children:"Bash"}),e.jsx(h,{value:"ruby",children:"Ruby"}),e.jsx(h,{value:"python",children:"Python"}),e.jsx(h,{value:"java",children:"Java"}),e.jsx(h,{value:"c++",children:"C++"})]})]})}const _2=E(e.jsx("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"}),"UnfoldMoreOutlined"),M2=E(e.jsx("path",{d:"M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10l4.59-4.59z"}),"UnfoldLessOutlined"),Bn="flex items-center justify-center px-4 h-42 text-muted border-b overflow-hidden";function I2({editor:s,size:t="md"}){const a=Fe(),[r,i]=m.useState(!1);return e.jsxs("div",{className:w(r?"h-84":"h-42"),children:[e.jsxs("div",{className:w(Bn,"relative z-20"),children:[e.jsx(g2,{editor:s,size:t}),e.jsx(Es,{}),e.jsx(Xj,{editor:s,size:t}),e.jsx(Es,{}),e.jsx(w2,{editor:s,size:t}),e.jsx(L2,{editor:s,size:t}),e.jsx(Es,{}),a?e.jsx(C,{className:"flex-shrink-0",color:r?"primary":null,size:t,radius:"rounded",onClick:()=>{i(!r)},children:r?e.jsx(M2,{}):e.jsx(_2,{})}):e.jsx(qn,{editor:s,size:t})]}),e.jsx(es,{children:r&&e.jsx(ls.div,{className:w(Bn,"absolute w-full h-full flex"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:e.jsx(qn,{editor:s,size:t})})})]})}function qn({editor:s,size:t="md"}){return e.jsxs(m.Fragment,{children:[e.jsx(t2,{editor:s,size:t}),e.jsx(Es,{}),e.jsx(a2,{editor:s,size:t}),e.jsx(i2,{editor:s,size:t}),e.jsx(x2,{editor:s,size:t}),e.jsx(Es,{}),e.jsx(f2,{editor:s,size:t}),e.jsx(Es,{}),e.jsx(k2,{editor:s,size:t}),e.jsx(o2,{editor:s,size:t})]})}function Kt({editor:s,allowSlugEditing:t=!0,onSave:a,saveButton:r,isLoading:i=!1,backLink:l}){const{isSticky:o,sentinelRef:c}=kr(),u=Fe();return e.jsxs(m.Fragment,{children:[e.jsx("div",{ref:c}),e.jsxs("div",{className:w("sticky top-0 z-10 mb-20 bg-paper",o&&"shadow"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-20 border-b px-20 py-10 text-muted sm:justify-start",children:[!u&&e.jsxs(m.Fragment,{children:[e.jsx(b,{variant:"text",size:"sm",elementType:F,to:l,relative:"path",startIcon:e.jsx(Rs,{}),children:e.jsx(n,{message:"Back"})}),e.jsx("div",{className:"mr-auto",children:t&&e.jsx(F2,{name:"slug",showLinkIcon:!1,prefix:"pages"})})]}),s&&e.jsx(Qj,{editor:s}),!u&&e.jsx(Gj,{editor:s}),a&&e.jsx(T2,{onSave:()=>{a(s.getHTML())},isLoading:i}),r]}),e.jsx(I2,{editor:s,size:"sm"})]})]})}function T2({onSave:s,isLoading:t}){const r=I().watch("title");return e.jsx(b,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:t||!r,onClick:()=>s(),children:e.jsx(n,{message:"Save"})})}function F2({name:s,...t}){const{field:{onChange:a,onBlur:r,value:i="",ref:l}}=cs({name:s}),o=m.useRef(!1),{watch:c,setValue:u}=I();return m.useEffect(()=>{const x=c((p,{name:j})=>{j==="title"&&!o.current&&u("slug",p.title)});return()=>x.unsubscribe()},[c,u]),e.jsx(ll,{className:w(!i&&"invisible"),onChange:x=>{o.current=!0,a(x)},onInputBlur:r,value:i,inputRef:l,...t})}function E2(){const{articleId:s}=B();return T(t=>P2(s,t),{onError:t=>q(t),onSuccess:async()=>{await _.invalidateQueries(["news"]),M(d("Article updated"))}})}function P2(s,t){return S.put(`news/${s}`,t).then(a=>a.data)}const z2=U.lazy(()=>us(()=>import("./article-body-editor-76382932.js"),["./article-body-editor-76382932.js","./main-a8767cd0.js","./main-f9578bdd.css","./linkify.es-03432d4a.js","./format-759fee02.js","./article-body-editor-b603c7db.css"],import.meta.url));function D2(){const s=kc("newsArticlePage");return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ia,{query:s}),e.jsx(A2,{article:s.data.article})]}):e.jsx("div",{className:"relative h-full w-full",children:e.jsx(hs,{query:s})})}function A2({article:s}){const t=Q(),a=E2(),r=V({defaultValues:{title:s.title,slug:s.slug,body:s.body,image:s.image}}),i=l=>{a.mutate({...r.getValues(),body:l},{onSuccess:()=>t("../..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(Ce,{}),children:e.jsx(z2,{initialContent:s.body,children:(l,o)=>e.jsx(ye,{children:e.jsxs(Pt,{...r,children:[e.jsx(Kt,{editor:o,backLink:"../..",isLoading:a.isLoading,onSave:i}),e.jsxs("div",{className:"mx-20",children:[e.jsx(ve,{className:"mx-auto mb-32 max-w-[655px]",showEditButtonOnHover:!0,variant:"square",name:"image",diskPrefix:"news_images"}),e.jsxs("div",{className:"prose mx-auto flex-auto dark:prose-invert",children:[e.jsx(Gt,{}),l]})]})]})})})})}function $2(){return T(s=>R2(s),{onError:s=>q(s),onSuccess:async()=>{await _.invalidateQueries(["news"]),M(d("Article created"))}})}function R2(s){return S.post("news",s).then(t=>t.data)}const V2=U.lazy(()=>us(()=>import("./article-body-editor-76382932.js"),["./article-body-editor-76382932.js","./main-a8767cd0.js","./main-f9578bdd.css","./linkify.es-03432d4a.js","./format-759fee02.js","./article-body-editor-b603c7db.css"],import.meta.url));function O2(){const s=Q(),t=$2(),a=V({}),r=i=>{t.mutate({...a.getValues(),body:i},{onSuccess:()=>s("..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(Ce,{}),children:e.jsx(V2,{children:(i,l)=>e.jsx(ye,{children:e.jsxs(Pt,{...a,children:[e.jsx(Kt,{editor:l,backLink:"..",isLoading:t.isLoading,onSave:r}),e.jsxs("div",{className:"mx-20",children:[e.jsx(ve,{className:"mx-auto mb-32 max-w-[655px]",showEditButtonOnHover:!0,variant:"square",name:"image",diskPrefix:"news_images"}),e.jsxs("div",{className:"prose mx-auto flex-auto dark:prose-invert",children:[e.jsx(Gt,{}),i]})]})]})})})})}function U2(s,t){return T(a=>B2(a,t),{onSuccess:async()=>{await _.invalidateQueries(Y("title-tags"))},onError:a=>J(a,s)})}function B2(s,t){return S.post(`title-tags/${t}`,s).then(a=>a.data)}function q2({type:s}){const t=s.replace("_"," "),{formId:a,close:r}=Z(),i=V(),l=U2(i,s);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add :name",values:{name:t}})}),e.jsx(X,{children:e.jsxs(ee,{id:a,form:i,onSubmit:async o=>{await l.mutate(o,{onSuccess:()=>{M(d(":name created",{values:{name:t}})),r()}})},children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique :name identifier.",values:{name:t}}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(g,{name:"display_name",label:e.jsx(n,{message:"Display name"}),description:e.jsx(n,{message:"User friendly :name name.",values:{name:t}}),className:"mb-20"})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,type:"submit",variant:"flat",color:"primary",disabled:l.isLoading,children:e.jsx(n,{message:"Create"})})]})]})}function H2(s,t){return T(a=>Z2(a,t),{onSuccess:async()=>{await _.invalidateQueries(Y("title-tags"))},onError:a=>J(a,s)})}function Z2(s,t){return S.put(`title-tags/${t.model_type}/${t.id}`,s).then(a=>a.data)}function W2({tag:s}){const t=s.model_type.replace("_"," "),{formId:a,close:r}=Z(),i=V({defaultValues:{name:s.name,display_name:s.display_name}}),l=H2(i,s);return e.jsxs(K,{children:[e.jsx(te,{children:e.jsx(n,{message:"Add :name",values:{name:t}})}),e.jsx(X,{children:e.jsxs(ee,{id:a,form:i,onSubmit:async o=>{l.mutate(o,{onSuccess:()=>{M(d(":name updated",{values:{name:t}})),r()}})},children:[e.jsx(g,{name:"name",label:e.jsx(n,{message:"Name"}),description:e.jsx(n,{message:"Unique :name identifier.",values:{name:t}}),className:"mb-20",required:!0,autoFocus:!0}),e.jsx(g,{name:"display_name",label:e.jsx(n,{message:"Display name"}),description:e.jsx(n,{message:"User friendly :name name.",values:{name:t}}),className:"mb-20"})]})}),e.jsxs(ne,{children:[e.jsx(b,{onClick:()=>r(),children:e.jsx(n,{message:"Cancel"})}),e.jsx(b,{form:a,type:"submit",variant:"flat",color:"primary",disabled:l.isLoading,children:e.jsx(n,{message:"Save"})})]})]})}const Q2=[Se({description:d("Date item was created")}),Ne({description:d("Date item was last updated")})],G2=[{key:"name",allowsSorting:!0,visibleInMode:"all",width:"flex-3 min-w-200",header:()=>e.jsx(n,{message:"Name"}),body:s=>s.name},{key:"display_name",allowsSorting:!0,header:()=>e.jsx(n,{message:"Display name"}),body:s=>s.display_name},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>e.jsx(ae,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(P,{type:"modal",children:[e.jsx(C,{size:"md",className:"text-muted",children:e.jsx(de,{})}),e.jsx(W2,{tag:s})]})}];function Hn({type:s}){const t=`${s.replace("_"," ")}s`;return e.jsx(fe,{endpoint:`title-tags/${s}`,title:e.jsx(n,{message:t}),columns:G2,filters:Q2,actions:e.jsx(K2,{type:s}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:an,title:e.jsx(n,{message:"No :name have been created yet",values:{name:t}}),filteringTitle:e.jsx(n,{message:"No matching :name",values:{name:t}})})})}function K2({type:s}){return e.jsx(m.Fragment,{children:e.jsxs(P,{type:"modal",children:[e.jsx(ke,{children:e.jsx(n,{message:"Add new :name",values:{name:s.replace("_"," ")}})}),e.jsx(q2,{type:s})]})})}const J2=[{key:"name",allowsSorting:!0,width:"flex-3",visibleInMode:"all",header:()=>e.jsx(n,{message:"Name"}),body:s=>e.jsx("a",{className:"hover:underline focus-visible:underline outline-none",href:`channel/${s.slug}`,target:"_blank",rel:"noreferrer",children:s.name})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(n,{message:"Owner"}),body:s=>s.user&&e.jsx(ys,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"items_count",width:"w-96",header:()=>e.jsx(n,{message:"Items"}),body:s=>s.items_count&&e.jsx(Re,{value:s.items_count})},{key:"public",header:()=>e.jsx(n,{message:"Public"}),width:"w-96",body:s=>s.public?e.jsx(Tt,{className:"text-positive"}):e.jsx(Ee,{className:"text-danger"})},{key:"content_type",allowsSorting:!1,header:()=>e.jsx(n,{message:"Content type"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.contentModel?e.jsx(n,{message:s.config.contentModel}):void 0})},{key:"layout",allowsSorting:!1,header:()=>e.jsx(n,{message:"Layout"}),body:s=>e.jsx("span",{className:"capitalize",children:s.config.layout?e.jsx(n,{message:s.config.layout}):void 0})},{key:"updated_at",allowsSorting:!0,maxWidth:"max-w-100",header:()=>e.jsx(n,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(ae,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(n,{message:"Actions"}),hideHeader:!0,visibleInMode:"all",align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(F,{to:`${s.id}/edit`,className:"text-muted",children:e.jsx(C,{size:"md",children:e.jsx(de,{})})})}];function Y2(){return e.jsx(fe,{endpoint:"channel",queryParams:{hideInternal:"true",with:"user",type:"list",loadItemsCount:"true"},title:e.jsx(n,{message:"User lists"}),columns:J2,actions:e.jsx(X2,{}),selectedActions:e.jsx(Le,{}),emptyStateMessage:e.jsx(me,{image:_c,title:e.jsx(n,{message:"No lists have been created yet"}),filteringTitle:e.jsx(n,{message:"No matching lists"})})})}function X2(){return e.jsx(ke,{elementType:F,to:"new",children:e.jsx(n,{message:"Add new list"})})}const ef={month:"short",day:"2-digit"};function Pl({value:s,onChange:t,compactOnMobile:a=!0}){const r=Fe();return e.jsxs(P,{type:"popover",onClose:i=>{i&&t(i)},children:[e.jsx(b,{variant:"outline",color:"chip",endIcon:e.jsx(hr,{}),children:e.jsx(Dr,{start:s.start,end:s.end,options:r&&a?ef:ir.short})}),e.jsx(sf,{value:s})]})}function sf({value:s}){const t=Fe(),a=Mc({defaultValue:s,closeDialogOnSelection:!1});return e.jsx(Ic,{state:a,showInlineDatePickerField:!t})}function tf({children:s,color:t,variant:a,radius:r,size:i,className:l,value:o,onChange:c,multiple:u,disabled:x}){const p=f=>o===void 0?!1:u?o.includes(f):f===o,j=f=>{const k=[...o],y=o.indexOf(f);return y>-1?k.splice(y,1):k.push(f),k},v=U.Children.map(s,(f,k)=>{if(U.isValidElement(f)){const y=p(f.props.value),L=y?"primary":t;return U.cloneElement(f,{color:y?"primary":t,variant:a,size:i,radius:null,disabled:f.props.disabled||x,...f.props,onClick:N=>{f.props.onClick&&f.props.onClick(N),c&&(u?c==null||c(j(f.props.value)):c==null||c(f.props.value))},className:w(f.props.className,y?"z-20":"z-10",af(k,s,r,L))})}});return e.jsx("div",{className:w(r,"inline-flex isolate",l),children:v})}function af(s,t,a,r){return s===0?w(a,"rounded-tr-none rounded-br-none",!r&&"border-r-transparent disabled:border-r-transparent"):s===t.length-1?w(a,"rounded-tl-none rounded-bl-none -ml-1"):w("rounded-none -ml-1",!r&&"border-r-transparent disabled:border-r-transparent")}const nf=E(e.jsx("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6h-6z"}),"TrendingUpOutlined"),rf=E(e.jsx("path",{d:"m16 18 2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6h-6z"}),"TrendingDownOutlined");function dn(s){const{title:t,description:a,children:r,className:i,contentIsFlex:l=!0,contentClassName:o,contentRef:c,minHeight:u="min-h-440"}=s;return e.jsxs("div",{className:w("bg border rounded h-full flex flex-col flex-auto",u,i),children:[e.jsxs("div",{className:"text-xs p-14 flex-shrink-0 flex justify-between items-center",children:[e.jsx("div",{className:"font-semibold text-sm",children:t}),a&&e.jsx("div",{className:"text-muted",children:a})]}),e.jsx("div",{ref:c,className:w("p-14 relative",l&&"flex-auto flex items-center justify-center",o),children:r})]})}function _t(){return e.jsxs("div",{className:"flex items-center gap-10 text-sm absolute mx-auto",children:[e.jsx(ms,{isIndeterminate:!0,size:"sm"}),e.jsx(n,{message:"Chart loading"})]})}const lf=m.lazy(()=>us(()=>import("./lazy-chart-8809085d.js"),["./lazy-chart-8809085d.js","./main-a8767cd0.js","./main-f9578bdd.css"],import.meta.url));function un(s){const{title:t,description:a,className:r,contentRef:i,isLoading:l}=s;return e.jsx(dn,{title:t,description:a,className:r,contentRef:i,children:e.jsxs(m.Suspense,{fallback:e.jsx(_t,{}),children:[e.jsx(lf,{...s}),l&&e.jsx(_t,{})]})})}function mn(s,{localeCode:t="en",shareFirstDatasetLabels:a=!0}){if(!s)return{datasets:[]};const r=[];return{...s,datasets:s.datasets.map((i,l)=>{const o=i.data.map((c,u)=>{let x;return l===0||!a?(x=of(c,s.granularity,t),r[u]=x):x=r[u],{...x,value:c.value}});return{...i,data:o}})}}function of(s,t,a){return s.label!=null?{label:s.label}:s.date?cf(s,t,a):{label:""}}function cf({date:s,endDate:t,value:a},r="day",i){const l=Ct(s).toDate(),o=t?Ct(t).toDate():null;switch(r){case"minute":return{label:Te(i,{second:"2-digit"}).format(l),tooltipTitle:Te(i,{day:"2-digit",hour:"numeric",minute:"numeric",second:"2-digit"}).format(l)};case"hour":return{label:Te(i,{hour:"numeric",minute:"numeric"}).format(l),tooltipTitle:Te(i,{month:"short",day:"2-digit",hour:"numeric",minute:"numeric"}).format(l)};case"day":return{label:Te(i,{day:"2-digit",weekday:"short"}).format(l),tooltipTitle:Te(i,{day:"2-digit",weekday:"short",month:"short"}).format(l)};case"week":return{label:Te(i,{month:"short",day:"2-digit"}).format(l),tooltipTitle:Te(i,{day:"2-digit",month:"long",year:"numeric"}).formatRange(l,o)};case"month":return{label:Te(i,{month:"short",year:"numeric"}).format(l),tooltipTitle:Te(i,{month:"long",year:"numeric"}).format(l)};case"year":return{label:Te(i,{year:"numeric"}).format(l),tooltipTitle:Te(i,{year:"numeric"}).format(l)}}}const Te=lr((s,t)=>new So(s,t),{equals:(s,t)=>No(s,t),callTimeout:void 0}),Zn=Lo().themes.all[0].colors["--be-primary"],Je=[[`rgb(${Zn.replaceAll(" ",",")})`,`rgba(${Zn.replaceAll(" ",",")},0.2)`],["rgb(255,112,67)","rgb(255,112,67,0.2)"],["rgb(255,167,38)","rgb(255,167,38,0.2)"],["rgb(141,110,99)","rgb(141,110,99,0.2)"],["rgb(102,187,106)","rgba(102,187,106,0.2)"],["rgb(92,107,192)","rgb(92,107,192,0.2)"]],df={parsing:{xAxisKey:"label",yAxisKey:"value"},datasets:{line:{fill:"origin",tension:.1,pointBorderWidth:4,pointHitRadius:10}},plugins:{tooltip:{intersect:!1,mode:"index"}}};function zl({data:s,className:t,...a}){const{localeCode:r}=zt(),i=m.useMemo(()=>{const l=mn(s,{localeCode:r});return l.datasets=l.datasets.map((o,c)=>({...o,backgroundColor:Je[c][1],borderColor:Je[c][0],pointBackgroundColor:Je[c][0]})),l},[s,r]);return e.jsx(un,{...a,className:w(t,"min-w-500"),data:i,type:"line",options:df})}const uf={parsing:{key:"value"},plugins:{tooltip:{intersect:!0}}};function xn({data:s,className:t,...a}){const{localeCode:r}=zt(),i=m.useMemo(()=>{var o;const l=mn(s,{localeCode:r});return l.labels=(o=l.datasets[0])==null?void 0:o.data.map(c=>c.label),l.datasets=l.datasets.map((c,u)=>({...c,backgroundColor:Je.map(x=>x[1]),borderColor:Je.map(x=>x[0]),borderWidth:2})),l},[s,r]);return e.jsx(un,{type:"polarArea",data:i,options:uf,className:w(t,"min-w-500"),...a})}function mf({data:s,direction:t="vertical",individualBarColors:a=!1,className:r,...i}){const{localeCode:l}=zt(),o=m.useMemo(()=>{const x=mn(s,{localeCode:l});return x.datasets=x.datasets.map((p,j)=>({...p,backgroundColor:a?Je.map(v=>v[1]):Je[j][1],borderColor:a?Je.map(v=>v[0]):Je[j][0],borderWidth:2})),x},[s,l,a]),c=t==="horizontal",u=m.useMemo(()=>({indexAxis:c?"y":"x",parsing:{xAxisKey:c?"value":"label",yAxisKey:c?"label":"value"}}),[c]);return e.jsx(un,{type:"bar",className:w(r,"min-w-500"),data:o,options:u,...i})}const Wn="https://www.gstatic.com/charts/loader.js";function xf({placeholderRef:s,data:t,country:a,onCountrySelected:r}){const{trans:i}=A(),{analytics:l}=xe(),o=l==null?void 0:l.gchart_api_key,{selectedTheme:c}=ko(),u=m.useRef(),x=!!r&&!a,p=m.useCallback(()=>{var L,N;if(typeof google>"u")return;const v=t.map(z=>[z.label,z.value]);v.unshift([i(a?d("City"):d("Country")),i(d("Clicks"))]);const f=`${ja(c.colors["--be-paper"])}`,y={colorAxis:{colors:[`${ja(c.colors["--be-primary"])}`]},backgroundColor:f,region:a?a.toUpperCase():void 0,resolution:a?"provinces":"countries",displayMode:a?"markers":"regions",enableRegionInteractivity:x};!u.current&&s.current&&((L=google==null?void 0:google.visualization)!=null&&L.GeoChart)&&(u.current=new google.visualization.GeoChart(s.current)),(N=u.current)==null||N.draw(google.visualization.arrayToDataTable(v),y)},[c,t,s,i,a,x]),j=m.useCallback(async()=>{Cn.isLoadingOrLoaded(Wn)||(await Cn.loadAsset(Wn,{type:"js"}),await google.charts.load("current",{packages:["geochart"],mapsApiKey:o}),p())},[o,p]);return m.useEffect(()=>(u.current&&r&&google.visualization.events.addListener(u.current,"regionClick",v=>r==null?void 0:r(v.region)),()=>{u.current&&google.visualization.events.removeAllListeners(u.current)}),[r,u.current]),m.useEffect(()=>{j()},[j]),m.useEffect(()=>{p()},[c,p,t]),{drawGoogleChart:p}}const hf=m.memo(({code:s})=>{const{localeCode:t}=zt(),a=new Intl.DisplayNames([t],{type:"region"});let r;try{r=a.of(s.toUpperCase())}catch{}return e.jsx(m.Fragment,{children:r})});function Dl({data:s,isLoading:t,onCountrySelected:a,country:r,...i}){const l=m.useRef(null),o=!!a,c=s==null?void 0:s.datasets[0].data,u=m.useMemo(()=>c||[],[c]);return xf({placeholderRef:l,data:u,country:r,onCountrySelected:a}),e.jsxs(dn,{...i,className:"min-w-500",title:e.jsxs("div",{className:"flex items-center",children:[e.jsx(n,{message:"Top Locations"}),r?e.jsxs("span",{className:"pl-4",children:["(",e.jsx(hf,{code:r}),")"]}):null,o&&e.jsx(gf,{})]}),contentIsFlex:t,children:[t&&e.jsx(_t,{}),e.jsxs("div",{className:"flex gap-24",children:[e.jsx("div",{ref:l,className:"flex-auto w-[480px] min-h-[340px]"}),e.jsxs("div",{className:"w-[170px]",children:[e.jsx("div",{className:"text-sm max-h-[340px] w-full flex-initial overflow-y-auto",children:u.map(x=>e.jsxs("div",{className:w("flex items-center gap-4 mb-4",o&&"cursor-pointer hover:underline"),role:o?"button":void 0,onClick:()=>{a==null||a(x.code)},children:[e.jsx("div",{className:"max-w-110 whitespace-nowrap overflow-hidden overflow-ellipsis",children:x.label}),e.jsxs("div",{children:["(",x.percentage,")%"]})]},x.label))}),r&&e.jsx(b,{variant:"outline",size:"xs",className:"mt-14",startIcon:e.jsx(Rs,{}),onClick:()=>{a==null||a(void 0)},children:e.jsx(n,{message:"Back to countries"})})]})]})]})}function gf(){return e.jsx(Wt,{title:e.jsx(n,{message:"Zooming in"}),body:e.jsx(n,{message:"Click on a country inside the map or country list to zoom in and see city data for that country."})})}const Al="gap-12 md:gap-24 mb-12 md:mb-24",Qn=`flex flex-col md:flex-row md:items-center overflow-x-auto ${Al}`;function pf({report:s,isLoading:t}){const a=s==null?void 0:s.pageViews.total;return e.jsxs(m.Fragment,{children:[e.jsxs("div",{className:Qn,children:[e.jsx(zl,{isLoading:t,className:"flex-auto",data:s==null?void 0:s.pageViews,title:e.jsx(n,{message:"Pageviews"}),description:a?e.jsx(n,{message:":count total views",values:{count:e.jsx(Re,{value:a})}}):null}),e.jsx(xn,{isLoading:t,data:s==null?void 0:s.devices,title:e.jsx(n,{message:"Top devices"})})]}),e.jsxs("div",{className:Qn,children:[e.jsx(mf,{isLoading:t,data:s==null?void 0:s.browsers,className:"flex-auto md:w-1/3",direction:"horizontal",individualBarColors:!0,hideLegend:!0,title:e.jsx(n,{message:"Top browsers"})}),e.jsx(Dl,{isLoading:t,className:"flex-auto",data:s==null?void 0:s.locations,title:e.jsx(n,{message:"Top locations"})})]})]})}const jf=E(e.jsx("path",{d:"m22 12-4-4v3H3v2h15v3l4-4z"}),"TrendingFlatOutlined");function ff({report:s,dateRange:t}){return Dr,t.start,t.end,e.jsx("div",{className:`flex items-center flex-shrink-0 overflow-x-auto h-[97px] ${Al}`,children:s==null?void 0:s.map(a=>e.jsx(bf,{datum:a},a.name))})}function bf({datum:s,label:t}){const a=wa(s.icon);return e.jsxs("div",{className:"flex items-center flex-auto rounded border p-20 gap-18 h-full whitespace-nowrap",children:[e.jsx("div",{className:"bg-primary-light/20 rounded-lg p-10 flex-shrink-0",children:e.jsx(a,{size:"lg",className:"text-primary"})}),e.jsxs("div",{className:"flex-auto",children:[e.jsxs("div",{className:"flex items-center gap-20 justify-between",children:[e.jsx("div",{className:"text-main text-lg font-bold",children:s.type==="fileSize"?e.jsx(Xi,{bytes:s.currentValue}):e.jsx(Re,{value:s.currentValue})}),t&&e.jsx("div",{className:"text-xs text-muted ml-auto",children:t})]}),e.jsxs("div",{className:"flex items-center gap-20 justify-between",children:[e.jsx("h2",{className:"text-muted text-sm",children:s.name}),s.percentageChange!=null&&e.jsx("div",{className:"flex items-center gap-10",children:e.jsx(vf,{percentage:s.percentageChange})})]})]})]},s.name)}function vf({percentage:s}){let t;return s>0?t=e.jsx(nf,{size:"md",className:"text-positive"}):s===0?t=e.jsx(jf,{className:"text-muted"}):t=e.jsx(rf,{className:"text-danger"}),e.jsxs(m.Fragment,{children:[t,e.jsxs("div",{className:"text-sm font-semibold text-muted",children:[s,"%"]})]})}const $l="admin/reports";function Rl(s={}){return Ie([$l,s],()=>yf(s),{keepPreviousData:!0})}function yf({types:s,dateRange:t}){const a={};return s&&(a.types=s.join(",")),t&&(a.startDate=t.start.toAbsoluteString(),a.endDate=t.end.toAbsoluteString(),a.timezone=t.start.timeZone),S.get($l,{params:a}).then(r=>r.data)}function Cf(){const[s,t]=m.useState(()=>Ta[2].getRangeValue()),r=B()["*"]||"plays",i=r==="visitors"?e.jsx(n,{message:"Visitors report"}):e.jsx(n,{message:"Plays report"});return e.jsxs("div",{className:"min-h-full p-12 md:p-24 overflow-x-hidden",children:[e.jsxs("div",{className:"md:flex items-center justify-between gap-24 mb-24",children:[e.jsx(ts,{children:i}),e.jsx("h1",{className:"mb-24 md:mb-0 text-3xl font-light",children:i}),e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between gap-10 md:gap-24",children:[e.jsxs(tf,{variant:"outline",radius:"rounded",value:r,children:[e.jsx(b,{value:"plays",elementType:F,to:"plays",children:e.jsx(n,{message:"Plays"})}),e.jsx(b,{value:"visitors",elementType:F,to:"visitors",children:e.jsx(n,{message:"Visitors"})})]}),e.jsx(Pl,{value:s,onChange:t})]})]}),e.jsx(wf,{dateRange:s}),e.jsx(As,{context:{dateRange:s,setDateRange:t}})]})}function wf({dateRange:s}){const{data:t}=Rl({types:["header"],dateRange:s});return e.jsx(ff,{report:t==null?void 0:t.headerReport,dateRange:s})}function _e({children:s}){return e.jsx("div",{className:"flex flex-col lg:flex-row lg:items-center overflow-x-auto gap-12 md:gap-24 mb-12 md:mb-24",children:s})}const Gn="reports/insights";function Sf(s,t){return Ie([Gn,s],()=>Nf(Gn,s),{keepPreviousData:!0,enabled:t.isEnabled,staleTime:1/0})}function Nf(s,t){var r;const a={model:t.model,metrics:(r=t.metrics)==null?void 0:r.join(",")};return a.startDate=t.dateRange.start.toAbsoluteString(),a.endDate=t.dateRange.end.toAbsoluteString(),a.timezone=t.dateRange.start.timeZone,S.get(s,{params:a}).then(i=>i.data)}const hn=U.createContext(null);function Lf(){return m.useContext(hn)}function Qe({children:s,metric:t}){var p,j;const[a,r]=m.useState(!1),{dateRange:i,model:l}=Lf(),o=Sf({metrics:[t],model:l,dateRange:i},{isEnabled:a}),c=typeof s=="function"?s(o):s,u=m.useRef(),x=m.useCallback(v=>{var f;if(v){const k=new IntersectionObserver(([y])=>{var L;y.isIntersecting&&(r(!0),(L=u.current)==null||L.disconnect(),u.current=void 0)},{threshold:.1});u.current=k,k.observe(v)}else u.current&&((f=u.current)==null||f.disconnect())},[]);return m.cloneElement(c,{data:(j=(p=o.data)==null?void 0:p.report)==null?void 0:j[t],isLoading:o.isLoading,contentRef:x})}function xt(){return e.jsx(Qe,{metric:"plays",children:({data:s})=>e.jsx(zl,{className:"flex-auto",title:e.jsx(n,{message:"Plays"}),hideLegend:!0,description:e.jsx(n,{message:":count total plays",values:{count:e.jsx(Re,{value:(s==null?void 0:s.report.plays.total)||0})}})})})}function ht(){return e.jsx(Qe,{metric:"devices",children:e.jsx(xn,{title:e.jsx(n,{message:"Top devices"})})})}const kf=E(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"InfoOutlined");function Hs({data:s,isLoading:t,...a}){const r=(s==null?void 0:s.datasets[0].data)||[];return e.jsxs(dn,{...a,className:"w-1/2 min-w-500 md:min-w-0",contentIsFlex:t,contentClassName:"max-h-[370px] overflow-y-auto compact-scrollbar",children:[t&&e.jsx(_t,{}),r.map(i=>e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-24 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(_f,{model:i.model,size:"w-42 h-42",className:"flex-shrink-0 rounded"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm",children:e.jsx(Mf,{model:i.model})}),e.jsx("div",{className:"text-xs text-muted",children:e.jsx(If,{model:i.model})})]})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-4",children:[e.jsx(Fr,{className:"text-muted",size:"sm"}),e.jsx(n,{message:":count plays",values:{count:e.jsx(Re,{value:i.value})}})]})]},i.model.id)),!t&&!r.length?e.jsxs("div",{className:"flex items-center gap-8 text-muted",children:[e.jsx(kf,{size:"sm"}),e.jsx(n,{message:"No plays in selected timeframe."})]}):null]})}function _f({model:s,size:t,className:a}){const r=`/admin/${s.model_type}s/${s.id}`;switch(s.model_type){case"title":return e.jsx(Ds,{title:s,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.id}/insights`});case"season":return e.jsx(Va,{season:s,title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.title_id}/insights/seasons/${s.number}`});case"episode":return e.jsx(Ar,{episode:s,title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/titles/${s.title_id}/insights/seasons/${s.season_number}/episodes/${s.episode_number}`});case"video":return s.thumbnail?e.jsx(F,{to:r,className:w(t,a),children:e.jsx("img",{src:s.thumbnail,className:"h-full w-full",alt:""})}):e.jsx(Ds,{title:s.title,size:t,srcSize:"sm",className:a,link:`/admin/videos/${s.id}/insights`});case"user":return e.jsx(Aa,{user:s,size:t,className:a})}}function Mf({model:s}){switch(s.model_type){case"title":return e.jsx(Ye,{title:s,target:"_blank"});case"season":return e.jsx(Oa,{title:s.title,seasonNumber:s.number,target:"_blank"});case"episode":return e.jsx($r,{title:s.title,episode:s,seasonNumber:s.season_number,target:"_blank"});case"video":return e.jsx(F,{to:ct(s),className:"hover:underline",target:"_blank",children:s.name});case"user":return s.id?e.jsx(Tc,{user:s,target:"_blank"}):e.jsx(m.Fragment,{children:s.display_name})}}function If({model:s}){switch(s.model_type){case"title":return e.jsx("span",{children:s.year});case"season":return e.jsx(Ye,{title:s.title,target:"_blank"});case"episode":return e.jsx(Ye,{title:s.title,target:"_blank"});case"user":return null;case"video":return e.jsx(Ye,{title:s.title,target:"_blank"})}}function Tf(){return e.jsx(Qe,{metric:"series",children:e.jsx(Hs,{title:e.jsx(n,{message:"Most played series"})})})}function Ff(){return e.jsx(Qe,{metric:"movies",children:e.jsx(Hs,{title:e.jsx(n,{message:"Most played movies"})})})}function Ef(){return e.jsx(Qe,{metric:"videos",children:e.jsx(Hs,{title:e.jsx(n,{message:"Most played videos"})})})}function Pf(){return e.jsx(Qe,{metric:"users",children:e.jsx(Hs,{title:e.jsx(n,{message:"Top users"})})})}function gt(){return e.jsx(Qe,{metric:"locations",children:e.jsx(Dl,{className:"flex-auto w-1/2 lg:max-w-[740px]"})})}function pt(){return e.jsx(Qe,{metric:"platforms",children:e.jsx(xn,{className:"max-w-500",title:e.jsx(n,{message:"Top platforms"})})})}function Kn(){const{dateRange:s}=we(),t="video_play=0";return e.jsxs(hn.Provider,{value:{dateRange:s,model:t},children:[e.jsxs(_e,{children:[e.jsx(xt,{}),e.jsx(ht,{})]}),e.jsxs(_e,{children:[e.jsx(Tf,{}),e.jsx(Ff,{})]}),e.jsxs(_e,{children:[e.jsx(Ef,{}),e.jsx(Pf,{})]}),e.jsxs(_e,{children:[e.jsx(gt,{}),e.jsx(pt,{})]})]})}function zf(){const{dateRange:s}=we(),{data:t,isLoading:a,isPreviousData:r}=Rl({types:["visitors"],dateRange:s});return e.jsx(pf,{isLoading:a||r,report:t==null?void 0:t.visitorsReport})}function Jt({children:s,reportModel:t,title:a,name:r,backLink:i}){const[l,o]=m.useState(()=>Ta[2].getRangeValue());return e.jsxs(m.Fragment,{children:[e.jsx(ts,{children:e.jsx(n,{message:":name insights",values:{name:r}})}),e.jsx("div",{className:"h-full flex flex-col",children:e.jsx("div",{className:"flex-auto bg-cover relative",children:e.jsx("div",{className:"min-h-full p-12 md:p-24 overflow-x-hidden max-w-[1600px] mx-auto flex flex-col",children:e.jsxs("div",{className:"flex-auto",children:[e.jsxs("div",{className:"md:flex items-center gap-12 h-48 mt-14 mb-38",children:[e.jsx(C,{elementType:F,to:i||"../../",relative:"path",className:"text-muted",children:e.jsx(Rs,{})}),a,e.jsx("div",{className:"ml-auto flex-shrink-0 flex items-center justify-between gap-10 md:gap-24",children:e.jsx(Pl,{value:l,onChange:o})})]}),e.jsx(hn.Provider,{value:{dateRange:l,model:t},children:s})]})})})})]})}function Yt({image:s,name:t,description:a}){return e.jsxs("div",{className:"flex items-center gap-10",children:[m.cloneElement(s,{size:"w-48 h-48",className:"rounded"}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-base whitespace-nowrap overflow-hidden overflow-ellipsis",children:["“",t,"“ ",e.jsx(n,{message:"insights"})]}),a&&e.jsx("div",{className:"text-muted text-sm",children:a})]})]})}function Df(){return e.jsx(Qe,{metric:"seasons",children:e.jsx(Hs,{title:e.jsx(n,{message:"Most played seasons"})})})}function Af(){return e.jsx(Qe,{metric:"episodes",children:e.jsx(Hs,{title:e.jsx(n,{message:"Most played episodes"})})})}function $f(){const{titleId:s}=B(),t=Lr("title");return t.data?e.jsxs(Jt,{reportModel:`title=${s}`,name:t.data.title.name,title:e.jsx(Yt,{image:e.jsx(Ds,{title:t.data.title,srcSize:"sm"}),name:e.jsx(Ye,{title:t.data.title}),description:e.jsx("span",{children:t.data.title.year})}),children:[e.jsxs(_e,{children:[e.jsx(xt,{}),e.jsx(ht,{})]}),e.jsxs(_e,{children:[e.jsx(Df,{}),e.jsx(Af,{})]}),e.jsxs(_e,{children:[e.jsx(gt,{}),e.jsx(pt,{})]})]}):e.jsx(hs,{query:t,loaderClassName:"absolute inset-0 m-auto"})}function Rf(){const s=Pr("episode");return s.data?e.jsxs(Jt,{reportModel:`episode=${s.data.episode.id}`,name:s.data.episode.name,backLink:"../../../../",title:e.jsx(Yt,{image:e.jsx(Ar,{episode:s.data.episode,title:s.data.title,srcSize:"sm"}),name:e.jsx($r,{episode:s.data.episode,title:s.data.title,seasonNumber:s.data.episode.season_number}),description:e.jsx(Fc,{episode:s.data.episode,title:s.data.title})}),children:[e.jsxs(_e,{children:[e.jsx(xt,{}),e.jsx(ht,{})]}),e.jsxs(_e,{children:[e.jsx(gt,{}),e.jsx(pt,{})]})]}):e.jsx(hs,{query:s,loaderClassName:"absolute inset-0 m-auto"})}function Vf(){const s=Ra("season");return s.data?e.jsxs(Jt,{reportModel:`season=${s.data.season.id}`,name:`Season ${s.data.season.number}`,title:e.jsx(Yt,{image:e.jsx(Va,{season:s.data.season,title:s.data.title,srcSize:"sm"}),name:e.jsx(Oa,{seasonNumber:s.data.season.number,title:s.data.title}),description:e.jsx(Ye,{title:s.data.title})}),children:[e.jsxs(_e,{children:[e.jsx(xt,{}),e.jsx(ht,{})]}),e.jsxs(_e,{children:[e.jsx(gt,{}),e.jsx(pt,{})]})]}):e.jsx(hs,{query:s,loaderClassName:"absolute inset-0 m-auto"})}function Of(){var a;const s=yl(),t=(a=s.data)==null?void 0:a.video;return t?e.jsxs(Jt,{reportModel:`video=${t.id}`,name:t.name,title:e.jsx(Yt,{image:e.jsx(Er,{video:t,srcSize:"sm"}),name:e.jsx(F,{to:ct(t),className:"hover:underline",target:"_blank",children:t.name}),description:e.jsx(Ye,{title:t.title})}),children:[e.jsxs(_e,{children:[e.jsx(xt,{}),e.jsx(ht,{})]}),e.jsxs(_e,{children:[e.jsx(gt,{}),e.jsx(pt,{})]})]}):e.jsx(hs,{query:s,loaderClassName:"absolute inset-0 m-auto"})}const Uf=[{path:"/",element:e.jsx(Cf,{}),children:[{index:!0,element:e.jsx(Kn,{})},{path:"plays",element:e.jsx(Kn,{})},{path:"visitors",element:e.jsx(zf,{})}]},{path:"channels",element:e.jsx(H5,{})},{path:"channels/new",element:e.jsx(jp,{})},{path:"channels/:slugOrId/edit",element:e.jsx(xp,{})},{path:"lists",element:e.jsx(Y2,{})},{path:"lists/new",element:e.jsx(Ec,{})},{path:"lists/:slugOrId/edit",element:e.jsx(Pc,{})},{path:"people",element:e.jsx(Mj,{})},{path:"people/new",element:e.jsx(Pj,{})},{path:"people/:personId/edit",element:e.jsx(Aj,{}),children:[{index:!0,element:e.jsx(Is,{to:"primary-facts",replace:!0})},{path:"primary-facts",element:e.jsx(Fl,{})},{path:"credits",element:e.jsx(Uj,{})}]},{path:"titles",element:e.jsx(H1,{})},{path:"titles/new",element:e.jsx(ra,{})},{path:"videos/:videoId/insights",element:e.jsx(Of,{})},{path:"titles/:titleId/insights",element:e.jsx($f,{})},{path:"titles/:titleId/insights/seasons/:season",element:e.jsx(Vf,{})},{path:"titles/:titleId/insights/seasons/:season/episodes/:episode",element:e.jsx(Rf,{})},{path:"titles/:titleId/edit",element:e.jsx(Is,{to:"primary-facts",replace:!0})},{path:"titles/:titleId/edit",element:e.jsx(Q1,{}),children:[{index:!0,element:e.jsx(ra,{})},{path:"primary-facts",element:e.jsx(ra,{})},{path:"reviews",element:e.jsx(v4,{})},{path:"comments",element:e.jsx(Nj,{})},{path:"images",element:e.jsx(L4,{})},{path:"genres",element:e.jsx(oa,{type:st})},{path:"keywords",element:e.jsx(oa,{type:ps})},{path:"countries",element:e.jsx(oa,{type:Vt})},{path:"cast",element:e.jsx(cj,{})},{path:"crew",element:e.jsx(mj,{})},{path:"videos",element:e.jsx(la,{})},{path:"videos/seasons/:season",element:e.jsx(la,{})},{path:"videos/seasons/:season/episodes/:episode",element:e.jsx(la,{})},{path:"seasons",element:e.jsx(c4,{})},{path:"seasons/:season",children:[{index:!0,element:e.jsx(Is,{to:"episodes",replace:!0})},{path:"Episodes",element:e.jsx(e4,{})},{path:"cast",element:e.jsx(xj,{})},{path:"crew",element:e.jsx(hj,{})}]},{path:"seasons/:season/episodes/new",element:e.jsx(Un,{})},{path:"seasons/:season/episodes/:episode",children:[{index:!0,element:e.jsx(Is,{to:"primary-facts",replace:!0})},{path:"primary-facts",element:e.jsx(Un,{})},{path:"cast",element:e.jsx(oj,{})},{path:"crew",element:e.jsx(gj,{})}]}]},{path:"titles/:titleId/edit/videos/new",element:e.jsx(bt,{})},{path:"titles/:titleId/edit/videos/edit/:videoId",element:e.jsx(vt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/new",element:e.jsx(bt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/edit/:videoId",element:e.jsx(vt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/episodes/:episode/new",element:e.jsx(bt,{})},{path:"titles/:titleId/edit/videos/seasons/:season/episodes/:episode/edit/:videoId",element:e.jsx(vt,{})},{path:"news",element:e.jsx(kp,{})},{path:"news/add",element:e.jsx(re,{permission:"news.update",children:e.jsx(O2,{})})},{path:"news/:articleId/edit",element:e.jsx(re,{permission:"news.update",children:e.jsx(D2,{})})},{path:"comments",element:e.jsx(ml,{})},{path:"reviews",element:e.jsx(hl,{})},{path:"videos",element:e.jsx(s1,{})},{path:"videos/new",element:e.jsx(bt,{})},{path:"videos/:videoId/edit",element:e.jsx(vt,{})},{path:"keywords",element:e.jsx(Hn,{type:ps})},{path:"genres",element:e.jsx(Hn,{type:st})}];function Bf(s){const{pageId:t}=B(),a=`${s||"custom-pages"}/${t}`;return T(r=>qf(r,a),{onError:r=>q(r),onSuccess:async()=>{await _.invalidateQueries(["custom-pages"]),await _.invalidateQueries(Y(a)),M(d("Page updated"))}})}function qf(s,t){return S.put(`${t}`,s).then(a=>a.data)}const Hf=U.lazy(()=>us(()=>import("./article-body-editor-76382932.js"),["./article-body-editor-76382932.js","./main-a8767cd0.js","./main-f9578bdd.css","./linkify.es-03432d4a.js","./format-759fee02.js","./article-body-editor-b603c7db.css"],import.meta.url));function Zf(){const s=_o();return s.data?e.jsxs(m.Fragment,{children:[e.jsx(Ia,{query:s}),e.jsx(Wf,{page:s.data.page})]}):e.jsx("div",{className:"relative w-full h-full",children:e.jsx(hs,{query:s})})}function Wf({page:s}){const t=Q(),a=Bf(),r=V({defaultValues:{title:s.title,slug:s.slug,body:s.body}}),i=l=>{a.mutate({...r.getValues(),body:l},{onSuccess:()=>t("../..",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(Ce,{}),children:e.jsx(Hf,{initialContent:s.body,children:(l,o)=>e.jsx(ye,{children:e.jsxs(Pt,{...r,children:[e.jsx(Kt,{editor:o,backLink:"../..",isLoading:a.isLoading,onSave:i}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(Gt,{}),l]})})]})})})})}function Qf(s){const t=s||"custom-pages";return T(a=>Gf(a,t),{onError:a=>q(a),onSuccess:async()=>{await _.invalidateQueries(["custom-pages"]),await _.invalidateQueries(Y(t)),M(d("Page created"))}})}function Gf(s,t){return S.post(`${t}`,s).then(a=>a.data)}const Kf=U.lazy(()=>us(()=>import("./article-body-editor-76382932.js"),["./article-body-editor-76382932.js","./main-a8767cd0.js","./main-f9578bdd.css","./linkify.es-03432d4a.js","./format-759fee02.js","./article-body-editor-b603c7db.css"],import.meta.url));function Jf(){const s=Q(),t=Qf(),a=V(),r=i=>{t.mutate({...a.getValues(),body:i},{onSuccess:()=>s("../",{relative:"path"})})};return e.jsx(m.Suspense,{fallback:e.jsx(Ce,{}),children:e.jsx(Kf,{children:(i,l)=>e.jsx(ye,{children:e.jsxs(Pt,{...a,children:[e.jsx(Kt,{editor:l,isLoading:t.isLoading,onSave:r,backLink:"../"}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(Gt,{}),i]})})]})})})})}const Yf=U.lazy(()=>us(()=>import("./admin-report-page-77fc00c6.js"),["./admin-report-page-77fc00c6.js","./main-a8767cd0.js","./main-f9578bdd.css","./user-profile-link-bc31d40d.js","./OpenInNew-a6691840.js","./use-resume-subscription-0d036444.js"],import.meta.url)),Xf=[{path:"appearance",element:e.jsx(re,{permission:"appearance.update",children:e.jsx(vu,{})}),children:[{index:!0,element:e.jsx(Ph,{})},{path:"general",element:e.jsx(Du,{})},{path:"seo-settings",element:e.jsx(Zu,{})},{path:"custom-code",element:e.jsx(Gu,{})},{path:"themes",element:e.jsx(Vu,{})},{path:"themes/:themeIndex",element:e.jsx(ym,{})},{path:"menus",element:e.jsx(Su,{})},{path:"menus/:menuIndex",element:e.jsx(_u,{})},{path:"menus/:menuIndex/items/:menuItemIndex",element:e.jsx(Eu,{})},...Object.values(Di.sections).flatMap(s=>s.routes||[])]},{path:"/",element:e.jsx(Hc,{}),children:[...Uf,{path:"/",element:e.jsx(U.Suspense,{fallback:e.jsx(Ce,{screen:!0}),children:e.jsx(Yf,{})})},{path:"users",element:e.jsx(re,{permission:"users.update",children:e.jsx(cd,{})})},{path:"users/new",element:e.jsx(re,{permission:"users.update",children:e.jsx(sh,{})})},{path:"users/:userId/edit",element:e.jsx(re,{permission:"users.update",children:e.jsx(Jx,{})})},{path:"roles",element:e.jsx(re,{permission:"roles.update",children:e.jsx(Ah,{})})},{path:"roles/new",element:e.jsx(re,{permission:"roles.update",children:e.jsx(rg,{})})},{path:"roles/:roleId/edit",element:e.jsx(re,{permission:"roles.update",children:e.jsx(eg,{})})},{path:"subscriptions",element:e.jsx(re,{permission:"subscriptions.update",children:e.jsx(o5,{})})},{path:"plans",element:e.jsx(re,{permission:"plans.update",children:e.jsx(C5,{})})},{path:"plans/new",element:e.jsx(re,{permission:"plans.update",children:e.jsx($5,{})})},{path:"plans/:productId/edit",element:e.jsx(re,{permission:"plans.update",children:e.jsx(P5,{})})},{path:"custom-pages",element:e.jsx(re,{permission:"custom_pages.update",children:e.jsx(Xu,{})})},{path:"custom-pages/new",element:e.jsx(re,{permission:"custom_pages.update",children:e.jsx(Jf,{})})},{path:"custom-pages/:pageId/edit",element:e.jsx(re,{permission:"custom_pages.update",children:e.jsx(Zf,{})})},{path:"tags",element:e.jsx(re,{permission:"tags.update",children:e.jsx(hg,{})})},{path:"localizations",element:e.jsx(re,{permission:"localizations.update",children:e.jsx(mh,{})})},{path:"localizations/:localeId/translate",element:e.jsx(kh,{})},{path:"files",element:e.jsx(re,{permission:"files.update",children:e.jsx(Kg,{})})},{path:"ads",element:e.jsx(re,{permission:"settings.update",children:e.jsx(Th,{})})},{path:"settings",element:e.jsx(re,{permission:"settings.update",children:e.jsx(tm,{})}),children:[{index:!0,element:e.jsx(Is,{to:"general",replace:!0})},{path:"general",element:e.jsx(mm,{})},{path:"subscriptions",element:e.jsx(Qm,{})},{path:"localization",element:e.jsx(Jm,{})},{path:"authentication",element:e.jsx(Ym,{})},{path:"uploading",element:e.jsx(gx,{})},{path:"mail",element:e.jsx(Tx,{})},{path:"cache",element:e.jsx(zx,{})},{path:"analytics",element:e.jsx(Wx,{})},{path:"logging",element:e.jsx($x,{})},{path:"queue",element:e.jsx(Vx,{})},{path:"recaptcha",element:e.jsx(Bx,{})},{path:"gdpr",element:e.jsx(R5,{})},...Wm]}]},{path:"*",element:e.jsx(Io,{})}];function e3(){return Mo(Xf)}const r3=Object.freeze(Object.defineProperty({__proto__:null,default:e3},Symbol.toStringTag,{value:"Module"}));export{ff as A,gl as B,El as C,We as D,rf as E,ua as F,jf as G,c2 as H,kf as I,nf as J,M2 as K,sn as L,Bc as M,u2 as N,_2 as O,r5 as P,pg as Q,Pl as R,m1 as S,th as T,Zj as U,pf as V,Xt as W,r3 as X,y4 as Z,Lu as a,v2 as b,C2 as c,b2 as d,y2 as e,Kj as f,l2 as g,j2 as h,p2 as i,S2 as j,N2 as k,Jj as l,e2 as m,s2 as n,Yj as o,Zr as p,i5 as q,d2 as r,rn as s,Il as t,Rl as u,Wj as v,Bi as w,m2 as x,u1 as y,h5 as z};
//# sourceMappingURL=admin-routes-9d21ca72.js.map