Viewing File: /home/markqprx/iniasli.pro/public/build/assets/dashboard-routes-63fde3df.js
import{A as x,aZ as Sn,bj as da,$ as He,bk as er,j as e,c as w,U as Se,bl as Qo,V as fe,a as A,bh as Zo,I as P,ay as tt,bm as Jo,bn as sr,m as h,bo as Ft,bp as Xo,bq as nt,br as at,bs as ua,bt as ma,R as Q,bu as In,a3 as Ms,a8 as Vt,aQ as tr,aR as nr,S as es,bv as ei,bw as si,bx as Ot,by as xs,bz as ln,bA as cn,bB as Zs,bC as rt,bD as ar,az as ve,bE as rs,bF as Rs,bG as hs,bH as ti,bI as ni,bJ as ai,bK as ri,bL as oi,bM as ii,bN as li,u as me,aM as rr,bO as or,bP as ir,K as xt,M as $t,T as i,bQ as ci,Q as Es,f as U,l as X,B as N,D as K,i as G,x as V,bR as Fs,bS as Ln,am as di,ae as ze,b1 as Dn,d as O,bT as lr,bU as Pn,bV as ui,a5 as cr,a9 as Oe,bW as mi,X as je,bX as Ht,e as $,bY as xi,a4 as hi,aA as zn,a1 as I,bZ as fi,b_ as dr,a0 as Ne,L as ge,b$ as pi,w as se,Y as os,W as Ie,k as E,r as Bt,c0 as gi,c1 as An,c2 as ji,c3 as bi,al as ht,c4 as Ts,c5 as vi,h as Z,g as ne,F as xe,N as Ut,aX as ur,b0 as Be,p as Ue,aC as yi,aj as Fn,b as Y,q,t as J,s as ke,y as ps,ap as qt,aq as ft,aa as Vs,aF as mr,c6 as xr,a7 as xa,c7 as ki,_ as pt,bb as wi,ba as Ni,c8 as qe,o as ye,c9 as Le,ca as ie,cb as gt,H as Wt,cc as hr,aG as is,aH as ls,cd as Ci,ce as $e,n as _s,cf as Si,v as Je,C as Ii,cg as Li,O as Di,bi as Pi,ch as fr,aN as zi,ci as Ai,aI as ns,aw as Os,aJ as Xe,cj as ha,ck as Fi,cl as Kt,E as pr,ak as gs,G as jt,cm as gr,aD as _n,cn as jr,co as br,cp as bt,an as Mn,cq as _i,cr as js,cs as Gt,ao as Re,ar as ss,ct as vr,au as Mi,ax as Ri,cu as Ei,av as Yt,ac as Ti,ad as Vi,cv as Rn,cw as yr,cx as Oi,cy as $i,cz as Hi,cA as Bi,cB as Ui,cC as qi,cD as kr,cE as Wi,cF as Ki,cG as Gi,cH as Yi,cI as Qi,cJ as Zi,b6 as wr,b4 as Ji,b5 as Xi,b8 as el,b9 as sl,b7 as tl,ai as nl}from"./main-96065a7f.js";import{E as Ke,M as Nr,B as ot,a as as}from"./Edit-b651a781.js";const Qt=x.createContext(null);function al(s=!1){x.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 rl({children:s,leftSidenavStatus:t,onLeftSidenavChange:n,rightSidenavStatus:a,initialRightSidenavStatus:r,onRightSidenavChange:o,name:l,leftSidenavCanBeCompact:c,height:d="h-screen",className:m,gridClassName:u="dashboard-grid",blockBodyOverflow:p=!0,...f}){al(!p);const g=Sn("(max-width: 1024px)"),v=x.useMemo(()=>l?da(`${l}.sidenav.compact`):!1,[l])?"compact":"open",[y,b]=He(t,g?"closed":v,n),k=x.useMemo(()=>{if(g)return"closed";if(r!=null)return r;const C=da(`${l}.sidenav.right.position`,"open");return C??(r||"closed")},[g,l,r]),[S,L]=He(a,k,o),D=x.useCallback(C=>{L(C),er(`${l}.sidenav.right.position`,C)},[L,l]),F=g&&(y==="open"||S==="open");return e.jsx(Qt.Provider,{value:{leftSidenavStatus:y,setLeftSidenavStatus:b,rightSidenavStatus:S,setRightSidenavStatus:D,leftSidenavCanBeCompact:c,name:l,isMobileMode:g},children:e.jsxs("div",{...f,className:w("relative isolate",u,m,d),children:[s,e.jsx(Se,{children:F&&e.jsx(Qo,{position:"fixed",onClick:()=>{b("closed"),D("closed")}},"dashboard-underlay")})]})})}function ol({children:s,isScrollable:t=!0}){return x.cloneElement(s,{className:w(s.props.className,t&&"overflow-y-auto stable-scrollbar","dashboard-grid-content")})}function il({className:s,position:t,children:n,size:a="md",mode:r,overlayPosition:o="fixed",display:l="flex",overflow:c="overflow-hidden",forceClosed:d=!1}){const{isMobileMode:m,leftSidenavStatus:u,setLeftSidenavStatus:p,rightSidenavStatus:f,setRightSidenavStatus:g}=x.useContext(Qt),j=t==="left"?u:f,v=m||r==="overlay",y={open:{display:l,width:null},compact:{display:l,width:null},closed:{width:0,transitionEnd:{display:"none"}}},b=ll(j==="compact"?"compact":a);return e.jsx(fe.div,{variants:y,initial:!1,animate:d?"closed":j,transition:{type:"tween",duration:.15},onClick:k=>{const S=k.target;m&&(S.closest("button")||S.closest("a"))&&(p("closed"),g("closed"))},className:w(s,t==="left"?"dashboard-grid-sidenav-left":"dashboard-grid-sidenav-right","will-change-[width]",c,b,v&&`${o} bottom-0 top-0 z-20 shadow-2xl`,v&&t==="left"&&"left-0",v&&t==="right"&&"right-0"),children:x.cloneElement(n,{className:w(n.props.className,"w-full h-full",j==="compact"&&"compact-scrollbar"),isCompactMode:j==="compact"})})}function ll(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 cl=A(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 dl({children:s,className:t,hideToggleButton:n,...a}){const{isMobileMode:r,leftSidenavStatus:o,setLeftSidenavStatus:l,name:c,leftSidenavCanBeCompact:d}=x.useContext(Qt),m=d&&!r,u=!n&&(r||d),p=()=>{l(o==="open"?"closed":"open")},f=()=>{const g=o==="compact"?"open":"compact";er(`${c}.sidenav.compact`,g==="compact"),l(g)};return e.jsx(Zo,{className:w("dashboard-grid-navbar",t),border:"border-b",size:"sm",toggleButton:u?e.jsx(P,{size:"md",onClick:()=>{m?f():p()},children:e.jsx(cl,{})}):void 0,...a,children:s})}var H=(s=>(s.Select="select",s.DateRangePicker="dateRangePicker",s.SelectModel="selectModel",s.Input="input",s.BooleanToggle="booleanToggle",s.ChipField="chipField",s.Custom="custom",s))(H||{}),re=(s=>(s.eq="=",s.ne="!=",s.gt=">",s.gte=">=",s.lt="<",s.lte="<=",s.has="has",s.hasAll="hasAll",s.doesntHave="doesntHave",s.between="between",s))(re||{});const _t=["=","!=",">",">=","<","<="];function Cr(s){return s.set({hour:0,minute:0,second:0,millisecond:0})}function Fe(s){return s.set({hour:24-1,minute:60-1,second:60-1,millisecond:1e3-1})}function ul(){var n,a,r;const s=(n=tt())==null?void 0:n.settings.dates.default_timezone,t=((r=(a=tt())==null?void 0:a.user)==null?void 0:r.timezone)||s||"auto";return!t||t==="auto"?Jo():t}const ue=Cr(sr(ul()));var Ja,Xa;const dn=((Xa=(Ja=tt())==null?void 0:Ja.i18n)==null?void 0:Xa.language)||"en",Zt=[{key:0,label:h("Today"),getRangeValue:()=>({preset:0,start:ue,end:Fe(ue)})},{key:1,label:h("Yesterday"),getRangeValue:()=>({preset:1,start:ue.subtract({days:1}),end:Fe(ue).subtract({days:1})})},{key:2,label:h("This week"),getRangeValue:()=>({preset:2,start:Ft(ue,dn),end:Xo(Fe(ue),dn)})},{key:3,label:h("Last week"),getRangeValue:()=>{const s=Ft(ue,dn).subtract({days:7});return{preset:3,start:s,end:s.add({days:6})}}},{key:4,label:h("Last 7 days"),getRangeValue:()=>({preset:4,start:ue.subtract({days:7}),end:Fe(ue)})},{key:6,label:h("Last 30 days"),getRangeValue:()=>({preset:6,start:ue.subtract({days:30}),end:Fe(ue)})},{key:7,label:h("Last 3 months"),getRangeValue:()=>({preset:7,start:ue.subtract({months:3}),end:Fe(ue)})},{key:8,label:h("Last 12 months"),getRangeValue:()=>({preset:8,start:ue.subtract({months:12}),end:Fe(ue)})},{key:9,label:h("This month"),getRangeValue:()=>({preset:9,start:nt(ue),end:at(Fe(ue))})},{key:10,label:h("This year"),getRangeValue:()=>({preset:10,start:ua(ue),end:ma(Fe(ue))})},{key:11,label:h("Last year"),getRangeValue:()=>({preset:11,start:ua(ue).subtract({years:1}),end:ma(Fe(ue)).subtract({years:1})})}],En=A(e.jsx("path",{d:"M7 11h2v2H7v-2zm14-5v14c0 1.1-.9 2-2 2H5c-1.11 0-2-.9-2-2l.01-14c0-1.1.88-2 1.99-2h1V2h2v2h8V2h2v2h1c1.1 0 2 .9 2 2zM5 8h14V6H5v2zm14 12V10H5v10h14zm-4-7h2v-2h-2v2zm-4 0h2v-2h-2v2z"}),"DateRangeOutlined"),Sr=Q.forwardRef((s,t)=>{const{children:n,inputProps:a,wrapperProps:r,className:o,autoFocus:l,style:c,onClick:d}=s;return e.jsx("div",{...r,onClick:d,children:e.jsx("div",{...a,role:"group",className:w(o,"flex items-center focus-within:ring focus-within:ring-primary/focus focus-within:border-primary/60"),ref:t,style:c,children:e.jsx(In,{autoFocus:l,children:n})})})}),Tn=Q.forwardRef(({inputRef:s,wrapperProps:t,children:n,onBlur:a,...r},o)=>{const l=Ms(r),c=Vt(o),{fieldProps:d,inputProps:m}=tr({...r,focusRef:c,labelElementType:"span"});return l.wrapper=w(l.wrapper,r.disabled&&"pointer-events-none"),e.jsx(nr,{wrapperProps:es(t,{onBlur:u=>{c.current.contains(u.relatedTarget)||a==null||a(u)},onClick:()=>{const u=ei(c);u==null||u.focusFirst()}}),fieldClassNames:l,ref:c,...d,children:e.jsx(Sr,{inputProps:m,className:w(l.input,"gap-10"),ref:s,children:n})})});function ml(s){return s instanceof si?"day":"minute"}function gn(s,t,n){return t!=null&&s.compare(t)<0||n!=null&&s.compare(n)>0}function Ir(s,t){const n=Ot(),[a,r]=x.useState(!1),o=t.closeDialogOnSelection??!0,l=t.granularity||ml(s),c=t.min?xs(t.min,n):void 0,d=t.max?xs(t.max,n):void 0;return{timezone:n,granularity:l,min:c,max:d,calendarIsOpen:a,setCalendarIsOpen:r,closeDialogOnSelection:o}}function $s(){const s=Ot();return x.useMemo(()=>sr(s),[s])}function jn(s){var Ae,Ye;const t=$s(),[n,a]=x.useState({start:(!s.value||!s.value.start)&&!((Ae=s.defaultValue)!=null&&Ae.start),end:(!s.value||!s.value.end)&&!((Ye=s.defaultValue)!=null&&Ye.end)}),r=s.onChange,[o,l]=He(s.value?mn(s.value,t):void 0,s.value?void 0:mn(s.defaultValue,t),_=>{a({start:!1,end:!1}),r==null||r(_)}),{min:c,max:d,granularity:m,timezone:u,calendarIsOpen:p,setCalendarIsOpen:f,closeDialogOnSelection:g}=Ir(o.start,s),j=x.useCallback(()=>{a({start:!0,end:!0}),l(mn(null,t)),r==null||r(null),f(!1)},[t,l,r,f]),[v,y]=x.useState(null),[b,k]=x.useState(!1),[S,L]=x.useState(o),[D,F]=x.useState(()=>fa(o,d)),C=x.useCallback(_=>{let B=_.start,ae=_.end;c&&(B=ln(B,c));const we=d?cn(d,ae):ae;B=cn(B,we);const us=c?ln(c,B):B;return ae=ln(ae,us),d&&(ae=cn(ae,d)),{start:xs(B,u),end:xs(ae,u)}},[c,d,u]),T=x.useCallback(_=>{const B={...C(_),preset:_.preset};l(B),L(B),F(fa(B,d)),a({start:!1,end:!1})},[l,C,d]),M=x.useCallback(_=>!n.start&&Zs(_,S.start)||!n.end&&Zs(_,S.end),[S,n]),ee=x.useCallback(_=>(b||!n.start&&!n.end)&&_.compare(S.start)>=0&&_.compare(S.end)<=0,[S,n,b]),R=x.useCallback(_=>Zs(_,S.start),[S]),W=x.useCallback(_=>Zs(_,S.end),[S]),he=x.useCallback((_,B)=>({onPointerEnter:()=>{b&&B&&L(un({start:v,end:_,timezone:u}))},onClick:()=>{if(!b)k(!0),y(_),L(un({start:_,end:_,timezone:u}));else{const ae=un({start:v,end:_,timezone:u});ae.start=Cr(ae.start),ae.end=Fe(ae.end),k(!1),y(null),T==null||T(ae),g&&(f==null||f(!1))}}}),[v,b,T,f,g,u]);return{selectedValue:o,setSelectedValue:T,calendarIsOpen:p,setCalendarIsOpen:f,dayIsActive:M,dayIsHighlighted:ee,dayIsRangeStart:R,dayIsRangeEnd:W,getCellProps:he,calendarDates:D,setIsPlaceholder:a,isPlaceholder:n,clear:j,setCalendarDates:F,min:c,max:d,granularity:m,timezone:u,closeDialogOnSelection:g}}function fa(s,t){let n=rt(nt(s.start)),a=rt(at(s.end));return ar(n,a)&&(a=at(a.add({months:1}))),t&&a.compare(t)>0&&(a=n,n=nt(n.subtract({months:1}))),[n,a]}function un(s){const t=xs(s.start,s.timezone),n=xs(s.end,s.timezone);return t.compare(n)>0?{start:n,end:t}:{start:t,end:n}}function mn(s,t){return s!=null&&s.start&&(s!=null&&s.end)?s:!(s!=null&&s.start)&&(s!=null&&s.end)?(s.start=s.end.subtract({months:1}),s):!(s!=null&&s.end)&&(s!=null&&s.start)?(s.end=s.start.add({months:1}),s):{start:t,end:t.add({months:1})}}const Lr=A(e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4v3z"}),"ArrowRightAltOutlined");function xl(s,t,n,a){switch(t){case"era":case"year":case"month":case"day":return s.cycle(t,n,{round:t==="year"})}if("hour"in s)switch(t){case"dayPeriod":{const r=s.hour,o=r>=12;return s.set({hour:o?r-12:r+12})}case"hour":case"minute":case"second":return s.cycle(t,n,{round:t!=="hour",hourCycle:a.hour12?12:24})}return s}function hl(s,t,n,a){switch(t){case"day":case"month":case"year":return s.set({[t]:n})}if("hour"in s)switch(t){case"dayPeriod":{const r=s.hour,o=r>=12;return n>=12===o?s:s.set({hour:o?r-12:r+12})}case"hour":if(a.hour12){const o=s.hour>=12;!o&&n===12&&(n=0),o&&n<12&&(n+=12)}case"minute":case"second":return s.set({[t]:n})}return s}const pa={year:5,month:2,day:7,hour:2,minute:15,second:15,dayPeriod:1};function fl({segment:s,domProps:t,value:n,onChange:a,isPlaceholder:r,state:{timezone:o,calendarIsOpen:l,setCalendarIsOpen:c}}){const d=ve(),m=x.useRef(""),{localeCode:u}=rs(),p=Rs(),f=hs({timeZone:o}),g=x.useMemo(()=>new ti(u,{maximumFractionDigits:0}),[u]),j=C=>{a(hl(n,s.type,C,f.resolvedOptions()))},v=C=>{a(xl(n,s.type,C,f.resolvedOptions()))},y=()=>{if(g.isValidPartialNumber(s.text)){const C=s.text.slice(0,-1),T=g.parse(C);if(C.length===0||T===0){const M=ni(o);s.type in M&&j(M[s.type])}else j(T);m.current=C}else s.type==="dayPeriod"&&v(-1)},b=C=>{var T;if(!(C.ctrlKey||C.metaKey||C.shiftKey||C.altKey)){switch(C.key){case"ArrowLeft":C.preventDefault(),C.stopPropagation(),p==null||p.focusPrevious();break;case"ArrowRight":C.preventDefault(),C.stopPropagation(),p==null||p.focusNext();break;case"Enter":(T=C.target.closest("form"))==null||T.requestSubmit(),c(!l);break;case"Tab":break;case"Backspace":case"Delete":{C.preventDefault(),C.stopPropagation(),y();break}case"ArrowUp":C.preventDefault(),m.current="",v(1);break;case"ArrowDown":C.preventDefault(),m.current="",v(-1);break;case"PageUp":C.preventDefault(),m.current="",v(pa[s.type]||1);break;case"PageDown":C.preventDefault(),m.current="",v(-(pa[s.type]||1));break;case"Home":C.preventDefault(),m.current="",j(s.maxValue);break;case"End":C.preventDefault(),m.current="",j(s.minValue);break}D(C.key)}},k=hs({hour:"numeric",hour12:!0}),S=x.useMemo(()=>{const C=new Date;return C.setHours(0),k.formatToParts(C).find(T=>T.type==="dayPeriod").value},[k]),L=x.useMemo(()=>{const C=new Date;return C.setHours(12),k.formatToParts(C).find(T=>T.type==="dayPeriod").value},[k]),D=C=>{const T=m.current+C;switch(s.type){case"dayPeriod":if(S.toLowerCase().startsWith(C))j(0);else if(L.toLowerCase().startsWith(C))j(12);else break;p==null||p.focusNext();break;case"day":case"hour":case"minute":case"second":case"month":case"year":{if(!g.isValidPartialNumber(T))return;let M=g.parse(T),ee=M,R=s.minValue===0;if(s.type==="hour"&&f.resolvedOptions().hour12){switch(f.resolvedOptions().hourCycle){case"h11":M>11&&(ee=g.parse(C));break;case"h12":R=!1,M>12&&(ee=g.parse(C));break}s.value>=12&&M>1&&(M+=12)}else M>s.maxValue&&(ee=g.parse(C));if(Number.isNaN(M))return;const W=ee!==0||R;W&&j(ee),+`${M}0`>s.maxValue||T.length>=String(s.maxValue).length?(m.current="",W&&(p==null||p.focusNext())):m.current=T;break}}},F=d?{}:{"aria-label":s.type,"aria-valuetext":r?void 0:`${s.value}`,"aria-valuemin":s.minValue,"aria-valuemax":s.maxValue,"aria-valuenow":r?void 0:s.value,tabIndex:0,onKeyDown:b};return e.jsx("div",{...es(t,{...F,onFocus:C=>{m.current="",C.target.scrollIntoView({block:"nearest"})},onClick:C=>{C.preventDefault(),C.stopPropagation()}}),className:"box-content cursor-default select-none whitespace-nowrap rounded p-2 text-center tabular-nums caret-transparent outline-none focus:bg-primary focus:text-on-primary",children:s.text.padStart(s.minLength,"0")})}function pl({segment:s,domProps:t}){const n=Rs();return e.jsx("div",{...t,onPointerDown:a=>{a.pointerType==="mouse"&&(a.preventDefault(),n!=null&&n.focusNext({from:a.target})||n==null||n.focusPrevious({from:a.target}))},"aria-hidden":!0,className:"min-w-4 cursor-default select-none",children:s.text})}function gl(s,t,n){switch(t){case"year":return{value:s.year,placeholder:"yyyy",minValue:1,maxValue:s.calendar.getYearsInEra(s)};case"month":return{value:s.month,placeholder:"mm",minValue:ri(s),maxValue:s.calendar.getMonthsInYear(s)};case"day":return{value:s.day,minValue:ai(s),maxValue:s.calendar.getDaysInMonth(s),placeholder:"dd"}}if("hour"in s)switch(t){case"dayPeriod":return{value:s.hour>=12?12:0,minValue:0,maxValue:12,placeholder:"--"};case"hour":if(n.hour12){const a=s.hour>=12;return{value:s.hour,minValue:a?12:0,maxValue:a?23:11,placeholder:"--"}}return{value:s.hour,minValue:0,maxValue:23,placeholder:"--"};case"minute":return{value:s.minute,minValue:0,maxValue:59,placeholder:"--"}}return{}}function it({segmentProps:s,state:t,value:n,onChange:a,isPlaceholder:r}){const{granularity:o}=t,l=x.useMemo(()=>{const u={year:"numeric",month:"numeric",day:"numeric"};return o==="minute"&&(u.hour="numeric",u.minute="numeric"),u},[o]),c=hs(l),d=x.useMemo(()=>n.toDate(),[n]),m=x.useMemo(()=>c.formatToParts(d).map(u=>{const p=gl(n,u.type,c.resolvedOptions()),f=r&&u.type!=="literal"?p.placeholder:u.value;return{type:u.type,text:u.value===", "?" ":f,...p,minLength:u.type!=="literal"?String(p.maxValue).length:1}}),[d,c,r,n]);return e.jsx("div",{className:"flex items-center",children:m.map((u,p)=>u.type==="literal"?e.jsx(pl,{domProps:s,segment:u},p):e.jsx(fl,{isPlaceholder:r,domProps:s,state:t,value:n,onChange:a,segment:u},p))})}const vt=A(e.jsx("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeftOutlined"),Hs=A(e.jsx("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"KeyboardArrowRightOutlined");function jl({date:s,currentMonth:t,state:{dayIsActive:n,dayIsHighlighted:a,dayIsRangeStart:r,dayIsRangeEnd:o,getCellProps:l,timezone:c,min:d,max:m}}){const{localeCode:u}=rs(),p=oi(s,u),f=n(s),g=a(s),j=r(s),v=o(s),y=ii(s,c),b=ar(s,t),k=gn(s,d,m);return e.jsxs("div",{role:"button","aria-disabled":k,className:w("w-40 h-40 text-sm relative isolate flex-shrink-0",k&&"text-disabled pointer-events-none",!b&&"invisible pointer-events-none"),...l(s,b),children:[e.jsx("span",{className:w("absolute inset-0 flex items-center justify-center rounded-full w-full h-full select-none z-10 cursor-pointer",!f&&!y&&"hover:bg-hover",f&&"bg-primary text-on-primary font-semibold",y&&!f&&"bg-chip"),children:s.day}),g&&b&&e.jsx("span",{className:w("absolute w-full h-full inset-0 bg-primary/focus",(j||p===0||s.day===1)&&"rounded-l-full",(v||p===6||s.day===t.calendar.getDaysInMonth(t))&&"rounded-r-full")})]})}function bl({startDate:s,state:t,isFirst:n,isLast:a}){const{localeCode:r}=rs(),o=li(s,r),l=Ft(s,r);return e.jsxs("div",{className:"w-280 flex-shrink-0",children:[e.jsx(vl,{isFirst:n,isLast:a,state:t,currentMonth:s}),e.jsxs("div",{className:"block",role:"grid",children:[e.jsx(yl,{state:t,startDate:s}),[...new Array(o).keys()].map(c=>e.jsx(fe.div,{className:"flex mb-6",children:[...new Array(7).keys()].map(d=>e.jsx(jl,{date:l.add({weeks:c,days:d}),currentMonth:s,state:t},d))},c))]})]})}function vl({currentMonth:s,isFirst:t,isLast:n,state:{calendarDates:a,setCalendarDates:r,timezone:o,min:l,max:c}}){const d=f=>{const g=a.length;let j;f==="forward"?j=a.map(v=>at(v.add({months:g}))):j=a.map(v=>at(v.subtract({months:g}))),r(j)},m=hs({month:"long",year:"numeric",era:s.calendar.identifier!=="gregory"?"long":void 0,calendar:s.calendar.identifier}),u=gn(s.subtract({days:1}),l,c),p=gn(nt(s.add({months:1})),l,c);return e.jsxs("div",{className:"flex items-center justify-between gap-10",children:[e.jsx(P,{size:"md",className:w("text-muted",!t&&"invisible"),disabled:!t||u,"aria-hidden":!t,onClick:()=>{d("backward")},children:e.jsx(vt,{})}),e.jsx("div",{className:"text-sm font-semibold select-none",children:m.format(s.toDate(o))}),e.jsx(P,{size:"md",className:w("text-muted",!n&&"invisible"),disabled:!n||p,"aria-hidden":!n,onClick:()=>{d("forward")},children:e.jsx(Hs,{})})]})}function yl({state:{timezone:s},startDate:t}){const{localeCode:n}=rs(),a=hs({weekday:"short"}),r=Ft(t,n);return e.jsx("div",{className:"flex",children:[...new Array(7).keys()].map(o=>{const c=r.add({days:o}).toDate(s),d=a.format(c);return e.jsx("div",{className:"w-40 h-40 text-sm font-semibold relative flex-shrink-0",children:e.jsx("div",{className:"absolute flex items-center justify-center w-full h-full select-none",children:d})},o)})})}function Dr({state:s,visibleMonths:t=1}){return ve()&&(t=1),e.jsx(x.Fragment,{children:[...new Array(t).keys()].map(a=>{const r=rt(nt(s.calendarDates[a])),o=a===0,l=a===t-1;return e.jsx(bl,{state:s,startDate:r,isFirst:o,isLast:l},a)})})}const Vn=x.memo(({start:s,end:t,options:n,preset:a})=>{const{dates:r}=me(),o=Ot(),l=hs(n||rr[a||(r==null?void 0:r.format)]);if(!s||!t)return null;let c;try{c=l.formatRange(ga(s,o),ga(t,o))}catch{c=""}return e.jsx(x.Fragment,{children:c})},or);function ga(s,t){return typeof s=="string"?ir(s,t).toDate():"toDate"in s?s.toDate(t):s}function kl({onPresetSelected:s,selectedValue:t}){return e.jsx(xt,{children:Zt.map(n=>e.jsx($t,{borderRadius:"rounded-none",capitalizeFirst:!0,isSelected:(t==null?void 0:t.preset)===n.key,onSelected:()=>{const a=n.getRangeValue();s(a)},children:e.jsx(i,{...n.label})},n.key))})}function Pr(s){return Sn("(max-width: 1024px)",s)}const yt=Q.forwardRef((s,t)=>{const{children:n,size:a="sm",description:r,className:o,invalid:l,autoFocus:c,errorMessage:d,...m}=s,u=Vt(t);ci({autoFocus:c},u);const p=wl(a),f=Ms(s),g=x.useId();return e.jsxs("div",{className:w(o,"isolate"),children:[e.jsxs("label",{className:"flex items-center select-none",children:[e.jsx("input",{...m,type:"checkbox",role:"switch","aria-invalid":l||void 0,"aria-describedby":r?g:void 0,ref:u,"aria-checked":m.checked,className:w(p,!l&&"checked:bg-primary dark:checked:bg-primary-dark checked:border-primary dark:checked:border-primary-dark",l&&"checked:bg-danger checked:border-danger","outline-none cursor-pointer bg-chip border-chip border checked:bg-primary checked:border-primary p-0 overflow-hidden relative rounded-3xl appearance-none transition-colors flex-shrink-0 flex items-center outline-none","before:z-10 before:border before:rounded-3xl before:block before:bg-white before:transition-transform before:translate-x-2","checked:before:border-white","focus-visible:ring",s.disabled&&"opacity-80 cursor-not-allowed")}),n&&e.jsx("span",{className:w(f.size.font,"ml-12",l&&"text-danger",s.disabled&&"text-disabled"),children:n})]}),r&&!d&&e.jsx("div",{id:g,className:f.description,children:r}),d&&e.jsx("div",{id:g,className:f.error,children:d})]})});function fs(s){const{field:{onChange:t,onBlur:n,value:a=!1,ref:r},fieldState:{invalid:o,error:l}}=Es({name:s.name}),c={onChange:d=>{d.target.value&&d.target.value!=="on"?t(d.target.checked?d.target.value:!1):t(d)},onBlur:n,checked:!!a,invalid:o,errorMessage:l==null?void 0:l.message,name:s.name};return e.jsx(yt,{ref:r,...es(s,c)})}function wl(s){switch(s){case"xl":return"w-68 h-36 before:w-28 before:h-28 checked:before:translate-x-36";case"lg":return"w-56 h-30 before:w-22 before:h-22 checked:before:translate-x-30";case"md":return"w-46 h-24 before:w-18 before:h-18 checked:before:translate-x-24";case"xs":return"w-30 h-16 before:w-12 before:h-12 checked:before:translate-x-16";default:return"w-38 h-20 before:w-14 before:h-14 checked:before:translate-x-20"}}const zr=[{key:0,label:h("Preceding period"),getRangeValue:s=>{const t=s.start,r=(s.end.toDate().getTime()-t.toDate().getTime())/(1e3*60);return{preset:0,start:t.subtract({minutes:r}),end:t}}},{key:1,label:h("Same period last year"),getRangeValue:s=>({start:s.start.subtract({years:1}),end:s.end.subtract({years:1}),preset:1})},{key:2,label:h("Custom"),getRangeValue:s=>({start:s.start.subtract({weeks:1}),end:s.end.subtract({weeks:1}),preset:2})}];function Nl({originalRangeValue:s,onPresetSelected:t,selectedValue:n}){return e.jsx(xt,{children:zr.map(a=>e.jsx($t,{borderRadius:"rounded-none",capitalizeFirst:!0,isSelected:(n==null?void 0:n.preset)===a.key,onSelected:()=>{const r=a.getRangeValue(s);t(r)},children:e.jsx(i,{...a.label})},a.key))})}function Ar({state:s,compareState:t,showInlineDatePickerField:n=!1,compareVisibleDefault:a=!1}){const r=Pr(),{close:o}=U(),l=x.useRef(s),c=s.isPlaceholder.start||s.isPlaceholder.end,[d,m]=x.useState(a),u=e.jsxs(X,{dividerTop:!0,startAction:!c&&!r?e.jsx("div",{className:"text-xs",children:e.jsx(Vn,{start:s.selectedValue.start.toDate(),end:s.selectedValue.end.toDate(),options:{dateStyle:"medium"}})}):void 0,children:[e.jsx(N,{variant:"text",size:"xs",onClick:()=>{s.setSelectedValue(l.current.selectedValue),s.setIsPlaceholder(l.current.isPlaceholder),o()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",size:"xs",onClick:()=>{const p=s.selectedValue;t&&d&&(p.compareStart=t.selectedValue.start,p.compareEnd=t.selectedValue.end),o(p)},children:e.jsx(i,{message:"Select"})})]});return e.jsxs(K,{size:"auto",children:[e.jsxs(G,{className:"flex",padding:"p-0",children:[!r&&e.jsxs("div",{className:"min-w-192 py-14",children:[e.jsx(kl,{selectedValue:s.selectedValue,onPresetSelected:p=>{s.setSelectedValue(p),s.closeDialogOnSelection&&o(p)}}),!!t&&e.jsxs(x.Fragment,{children:[e.jsx(yt,{className:"mx-20 mb-10 mt-14",checked:d,onChange:p=>m(p.target.checked),children:e.jsx(i,{message:"Compare"})}),d&&e.jsx(Nl,{originalRangeValue:s.selectedValue,selectedValue:t.selectedValue,onPresetSelected:p=>{t.setSelectedValue(p)}})]})]}),e.jsx(Se,{initial:!1,children:e.jsx(Cl,{state:s,compareState:t,showInlineDatePickerField:n,compareVisible:d})})]}),!s.closeDialogOnSelection&&u]})}function Cl({state:s,compareState:t,showInlineDatePickerField:n,compareVisible:a}){return e.jsxs(fe.div,{initial:{width:0,overflow:"hidden"},animate:{width:"auto"},exit:{width:0,overflow:"hidden"},transition:{type:"tween",duration:.125},className:"border-l px-20 pb-20 pt-10",children:[n&&e.jsxs("div",{children:[e.jsx(ja,{state:s}),!!t&&a&&e.jsx(ja,{state:t,label:e.jsx(i,{message:"Compare"})})]}),e.jsx("div",{className:"flex items-start gap-36",children:e.jsx(Dr,{state:s,visibleMonths:2})})]})}function ja({state:s,label:t}){const{selectedValue:n,setSelectedValue:a}=s;return e.jsxs(Tn,{className:"mb-20 mt-10",label:t,children:[e.jsx(it,{state:s,value:n.start,onChange:r=>{a({...n,start:r})}}),e.jsx(Lr,{className:"block flex-shrink-0 text-muted",size:"md"}),e.jsx(it,{state:s,value:n.end,onChange:r=>{a({...n,end:r})}})]})}function Sl(s){var f,g;const{granularity:t,closeDialogOnSelection:n,...a}=s,r=jn(s),o=x.useRef(null),c=ve()&&t!=="day",d=e.jsx(V,{offset:8,placement:"bottom-start",isOpen:r.calendarIsOpen,onOpenChange:r.setCalendarIsOpen,type:"popover",triggerRef:o,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:e.jsx(Ar,{state:r})}),m={onClick:j=>{j.stopPropagation(),j.preventDefault(),Il(j)?r.setCalendarIsOpen(!1):r.setCalendarIsOpen(!0)}},u=r.selectedValue,p=r.setSelectedValue;return e.jsxs(x.Fragment,{children:[e.jsxs(Tn,{ref:o,wrapperProps:m,endAdornment:c?void 0:e.jsx(En,{}),...a,children:[e.jsx(it,{isPlaceholder:(f=r.isPlaceholder)==null?void 0:f.start,state:r,segmentProps:m,value:u.start,onChange:j=>{p({start:j,end:u.end})}}),e.jsx(Lr,{className:"block flex-shrink-0 text-muted",size:"md"}),e.jsx(it,{isPlaceholder:(g=r.isPlaceholder)==null?void 0:g.end,state:r,segmentProps:m,value:u.end,onChange:j=>{p({start:u.start,end:j})}})]}),d]})}function Il(s){return["hour","minute","dayPeriod"].includes(s.currentTarget.ariaLabel||"")}function Ll(s){const{field:{onChange:t,onBlur:n,value:a,ref:r},fieldState:{invalid:o,error:l}}=Es({name:s.name}),c={onChange:d=>{t(d?Fr(d):null)},onBlur:n,value:Dl(a),invalid:o,errorMessage:l==null?void 0:l.message,inputRef:r};return e.jsx(Sl,{...es(c,s)})}function Dl(s){const{start:t,end:n,preset:a}=s||{},r={preset:a};try{t&&(r.start=typeof t=="string"?Fs(t):t),n&&(r.end=typeof n=="string"?Fs(n):n)}catch{}return r}function Fr({start:s,end:t,preset:n}={}){const a={preset:n};return s&&(a.start=s.toAbsoluteString()),t&&(a.end=t.toAbsoluteString()),a}function Mt(s){var t;return{...s,defaultOperator:re.between,control:{type:H.DateRangePicker,defaultValue:((t=s.control)==null?void 0:t.defaultValue)||Fr(Zt[3].getRangeValue())}}}function bs(s){return Mt({key:"created_at",label:h("Date created"),...s})}function vs(s){return Mt({key:"updated_at",label:h("Last updated"),...s})}const zt="filters";function Pl(s){if(!s)return[];let t=[];try{t=JSON.parse(atob(decodeURIComponent(s))),t.map(n=>(n.valueKey!=null&&(n.value=n.valueKey),n))}catch{}return t}function zl(s,t){return!s||(s=t?s.filter(n=>n.value!=="").map(n=>Al(n,t)):s,s=s.filter(n=>!n.isInactive),!s.length)?"":encodeURIComponent(btoa(JSON.stringify(s)))}function Al(s,t){var a;const n=t.find(r=>r.key===s.key);if((n==null?void 0:n.control.type)==="select"){const r=(n.control.options||[]).find(o=>o.key===s.value);if(r)return{...s,value:r.value,valueKey:r.key}}return(a=n==null?void 0:n.extraFilters)!=null&&a.length&&(s.extraFilters=n.extraFilters),s}function Jt(s,t){const[n]=Ln(),a=di(),r=n.get(zt),o=x.useMemo(()=>{if(!s)return[];const u=Pl(r);return(t||[]).forEach(p=>{if(!u.find(f=>f.key===p)){const f=s.find(g=>g.key===p);u.push({key:p,value:f.control.defaultValue,operator:f.defaultOperator,isInactive:!0})}}),u.sort((p,f)=>s.findIndex(g=>g.key===p.key)-s.findIndex(g=>g.key===f.key)),u},[r,t,s]),l=x.useCallback(u=>{const p=[...o];return u.forEach(f=>{const g=typeof f=="object"?f.key:f,j=p.findIndex(v=>v.key===g);j>-1&&p.splice(j,1)}),p},[o]),c=x.useCallback(u=>{const p=zl(u,s);p?n.set(zt,p):n.delete(zt),a({search:`?${n}`},{replace:!0})},[s,a,n]),d=x.useCallback(u=>{const f=[...l(u),...u];c(f)},[l,c]),m=x.useCallback(u=>c(l([u])),[l,c]);return{add:d,remove:m,replaceAll:c,decodedFilters:o,encodedFilters:r}}const te=(s,t)=>{const n=s.split("/");return t&&n.push(t),n};function _r(s,t,n,a){return ze({queryKey:te(s,t),queryFn:({signal:r})=>Fl(s,t,a,r),placeholderData:Dn,...n})}async function Fl(s,t,n,a){t.query&&await new Promise(o=>setTimeout(o,300));const r=await O.get(s,{params:t,signal:t.query?a:void 0}).then(o=>o.data);return n==null||n(r),r}const Xt=Q.createContext(null);function Mr(){return x.useContext(Xt)}function Rt(s){return lr()?s.metaKey:s.ctrlKey}function _l(s){const{cellCount:t,rowCount:n}=s;return{onKeyDown:r=>{switch(r.key){case"ArrowLeft":Te(r,{cell:{op:"decrement"}},s);break;case"ArrowRight":Te(r,{cell:{op:"increment"}},s);break;case"ArrowUp":Te(r,{row:{op:"decrement"}},s);break;case"ArrowDown":Te(r,{row:{op:"increment"}},s);break;case"PageUp":Te(r,{row:{op:"decrement",count:5}},s);break;case"PageDown":Te(r,{row:{op:"increment",count:5}},s);break;case"Tab":Ml(r);break;case"Home":Rt(r)?Te(r,{row:{op:"decrement",count:n},cell:{op:"decrement",count:t}},s):Te(r,{cell:{op:"decrement",count:t}},s);break;case"End":Rt(r)?Te(r,{row:{op:"increment",count:n},cell:{op:"increment",count:t}},s):Te(r,{cell:{op:"increment",count:t}},s);break}}}}function Te(s,t,{cellCount:n,rowCount:a}){var j,v,y,b,k,S,L;if(((j=document.activeElement)==null?void 0:j.tagName)==="input")return;s.preventDefault();const r=s.currentTarget,o=s.target.closest("[aria-colindex]");if(!o||!r)return;const l=o.closest("[aria-rowindex]");if(!l)return;let c=parseInt(l.getAttribute("aria-rowindex")),d=parseInt(o.getAttribute("aria-colindex"));if(Number.isNaN(c)||Number.isNaN(d))return;const m=((v=t.row)==null?void 0:v.count)??1;((y=t.row)==null?void 0:y.op)==="increment"?c=Math.min(a,c+m):((b=t.row)==null?void 0:b.op)==="decrement"&&(c=Math.max(1,c-m));const u=((k=t.cell)==null?void 0:k.count)??1;((S=t.cell)==null?void 0:S.op)==="increment"?d=Math.min(n,d+u):((L=t.cell)==null?void 0:L.op)==="decrement"&&(d=Math.max(1,d-u));const p=r.querySelector(`[aria-rowindex="${c}"] [aria-colindex="${d}"]`);if(!p)return;const g=Pn(p).nextNode()||p;o.setAttribute("tabindex","-1"),g.setAttribute("tabindex","0"),g.focus()}function Ml(s){const t=s.currentTarget;if(s.shiftKey)t.focus();else{const n=Pn(t,{tabbable:!0});let a,r;do r=n.lastChild(),r&&(a=r);while(r);a&&!a.contains(document.activeElement)&&ui(a)}}const Ge=x.createContext(null);function Rr({index:s,isHeader:t}){const{columns:n,cellHeight:a="h-46",headerCellHeight:r="h-46"}=x.useContext(Ge),o=n[s],l=o==null?void 0:o.padding;let c="justify-start";return(o==null?void 0:o.align)==="center"?c="justify-center":(o==null?void 0:o.align)==="end"&&(c="justify-end"),w("flex items-center overflow-hidden whitespace-nowrap overflow-ellipsis outline-none focus-visible:outline focus-visible:outline-offset-2",t?r:a,(o==null?void 0:o.width)??"flex-1",o==null?void 0:o.maxWidth,o==null?void 0:o.minWidth,c,l,o==null?void 0:o.className)}function Rl({rowIndex:s,rowIsHovered:t,index:n,item:a,id:r}){const{columns:o}=x.useContext(Ge),l=o[n],c=x.useMemo(()=>({index:s,isHovered:t,isPlaceholder:a.isPlaceholder}),[s,t,a.isPlaceholder]),d=Rr({index:n,isHeader:!1});return e.jsx("div",{tabIndex:-1,role:"gridcell","aria-colindex":n+1,id:r,className:d,children:e.jsx("div",{className:"overflow-x-hidden overflow-ellipsis min-w-0 w-full",children:l.body(a,c)})})}function El({onMoveStart:s,onMove:t,onMoveEnd:n,minimumMovement:a=0,preventDefault:r,stopPropagation:o=!0,onPress:l,onLongPress:c,...d}){const u=x.useRef({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:p,removeGlobalListener:f}=cr(),g=b=>{!u.el||(s==null?void 0:s(b,u.el))===!1||(u.originalTouchAction=u.el.style.touchAction,u.el.style.touchAction="none",u.originalUserSelect=document.documentElement.style.userSelect,document.documentElement.style.userSelect="none",u.started=!0)},j=b=>{var k;if(b.button===0&&u.id==null){if(u.started=!1,((k=d.onPointerDown)==null?void 0:k.call(d,b))===!1)return;o&&b.stopPropagation(),r&&b.preventDefault(),u.id=b.pointerId,u.el=b.currentTarget,u.lastPosition={x:b.clientX,y:b.clientY},c&&(u.longPressTimer=setTimeout(()=>{c(b,u.el),u.longPressTriggered=!0},400)),(s||t)&&p(window,"pointermove",v,!1),p(window,"pointerup",y,!1),p(window,"pointercancel",y,!1)}},v=b=>{if(b.pointerId===u.id){const k=b.clientX-u.lastPosition.x,S=b.clientY-u.lastPosition.y;(Math.abs(k)>=a||Math.abs(S)>=a)&&!u.started&&g(b),u.started&&(t==null||t(b,k,S),u.lastPosition={x:b.clientX,y:b.clientY})}},y=b=>{var k;if(b.pointerId===u.id){u.longPressTimer&&clearTimeout(u.longPressTimer);const S=u.longPressTriggered;u.longPressTriggered=!1,u.started&&(n==null||n(b)),u.el&&(b.type!=="pointercancel"&&((k=d.onPointerUp)==null||k.call(d,b,u.el),b.target&&u.el.contains(b.target)&&(S?c==null||c(b,u.el):l==null||l(b,u.el))),document.documentElement.style.userSelect=u.originalUserSelect||"",u.el.style.touchAction=u.originalTouchAction||""),u.id=void 0,u.started=!1,f(window,"pointermove",v,!1),f(window,"pointerup",y,!1),f(window,"pointercancel",y,!1)}};return{domProps:{onPointerDown:Oe(j)}}}function Tl(s){return s.shiftKey||Rt(s)}function Vl({index:s,isSelected:t,isHeader:n}){const a=mi(),r=ve(),{hideBorder:o,enableSelection:l,collapseOnMobile:c,onAction:d}=x.useContext(Ge);return w("flex gap-x-16 break-inside-avoid outline-none border border-transparent",d&&"cursor-pointer",r&&c&&o?"mb-8 pl-8 pr-0 rounded":"px-16",!o&&"border-b-divider",!o&&s===0&&"border-t-divider",t&&!a&&"bg-primary/selected hover:bg-primary/focus focus-visible:bg-primary/focus",t&&a&&"bg-selected hover:bg-focus focus-visible:bg-focus",!t&&!n&&(l||d)&&"focus-visible:bg-focus hover:bg-hover")}const Ol=["button","a","input","select","textarea"];function $l({item:s,index:t,renderAs:n,className:a,style:r}){const{selectedRows:o,columns:l,toggleRow:c,selectRow:d,onAction:m,selectRowOnContextMenu:u,enableSelection:p,selectionStyle:f,hideHeaderRow:g}=x.useContext(Ge),j=x.useRef(!1),v=o.includes(s.id),[y,b]=x.useState(!1),k=R=>R.target.closest(Ol.join(",")),S=R=>{f==="highlight"&&m&&!j.current&&!k(R)&&(R.preventDefault(),R.stopPropagation(),m(s,t))},L=!!o.length,D=R=>{k(R)||(f==="checkbox"?p&&(L||!m)?c(s):m&&m(s,t):f==="highlight"&&(j.current?p&&L?c(s):m==null||m(s,t):p&&d(s,Tl(R))))},{domProps:F}=El({onPointerDown:R=>{j.current=R.pointerType==="touch"},onPress:D,onLongPress:p?()=>{j.current&&c(s)}:void 0}),C=R=>{p&&R.key===" "?(R.preventDefault(),R.stopPropagation(),f==="checkbox"?c(s):d(s)):R.key==="Enter"&&!o.length&&m&&(R.preventDefault(),R.stopPropagation(),m(s,t))},T=R=>{u&&p&&(o.includes(s.id)||d(s)),j.current&&(R.preventDefault(),R.stopPropagation())},M=Vl({index:t,isSelected:v}),ee=n||"div";return e.jsx(ee,{role:"row","aria-rowindex":t+1+(g?0:1),"aria-selected":v,tabIndex:-1,className:w(a,M),item:ee==="div"?void 0:s,onDoubleClick:Oe(S),onKeyDown:Oe(C),onContextMenu:Oe(T),onPointerEnter:Oe(()=>b(!0)),onPointerLeave:Oe(()=>b(!1)),style:r,...F,children:l.map((R,W)=>e.jsx(Rl,{rowIndex:t,rowIsHovered:y,index:W,item:s},`${s.id}-${R.key}`))})}const Hl={key:"checkbox",header:()=>e.jsx(Ul,{}),align:"center",width:"w-24 flex-shrink-0",body:(s,t)=>t.isPlaceholder?e.jsx(je,{size:"w-24 h-24",variant:"rect"}):e.jsx(Bl,{item:s})};function Bl({item:s}){const{selectedRows:t,toggleRow:n}=x.useContext(Ge);return e.jsx(Ht,{checked:t.includes(s.id),onChange:()=>n(s)})}function Ul(){const{trans:s}=$(),{data:t,selectedRows:n,onSelectionChange:a}=x.useContext(Ge),r=!!t.length&&t.length===n.length,o=!r&&!!n.length;return e.jsx(Ht,{"aria-label":s({message:"Select all"}),isIndeterminate:o,checked:r,onChange:()=>{a(r?[]:t.map(l=>l.id))}})}const Js=A(e.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardOutlined");function ql({index:s}){const{columns:t,sortDescriptor:n,onSortChange:a,enableSorting:r}=x.useContext(Ge),o=t[s],l=Rr({index:s,isHeader:!0}),[c,d]=x.useState(!1),m=o.sortingKey||o.key,u=o.allowsSorting&&r,{orderBy:p,orderDir:f}=n||{},g=u&&p===m;let j;g&&f==="asc"?j="ascending":g&&f==="desc"?j="descending":u&&(j="none");const v=()=>{if(!u)return;let k;g&&f==="desc"?k={orderDir:"asc",orderBy:m}:g&&f==="asc"?k={orderBy:void 0,orderDir:void 0}:k={orderDir:"desc",orderBy:m},a==null||a(k)},y=g||c,b={visible:{opacity:1,y:0},hidden:{opacity:0,y:"-25%"}};return e.jsxs("div",{role:"columnheader",tabIndex:-1,"aria-colindex":s+1,"aria-sort":j,className:w(l,"text-muted font-medium text-xs",u&&"cursor-pointer"),onMouseEnter:()=>{d(!0)},onMouseLeave:()=>{d(!1)},onKeyDown:k=>{(k.key===" "||k.key==="Enter")&&(k.preventDefault(),v())},onClick:v,children:[o.hideHeader?e.jsx("div",{className:"sr-only",children:o.header()}):o.header(),e.jsx(Se,{children:u&&e.jsx(fe.span,{variants:b,animate:y?"visible":"hidden",initial:!1,transition:{type:"tween"},className:"inline-block ml-6 -mt-2","data-testid":"table-sort-button","aria-hidden":!y,children:e.jsx(Js,{size:"xs",className:w("text-muted",f==="asc"&&p===m&&"rotate-180 transition-transform")})},"sort-icon")})]})}function Wl(){const{columns:s}=x.useContext(Ge);return e.jsx("div",{role:"row","aria-rowindex":1,tabIndex:-1,className:"flex gap-x-16 px-16",children:s.map((t,n)=>e.jsx(ql,{index:n},t.key))})}function Kl({className:s,columns:t,collapseOnMobile:n=!0,hideHeaderRow:a=!1,hideBorder:r=!1,data:o,selectedRows:l,defaultSelectedRows:c,onSelectionChange:d,sortDescriptor:m,onSortChange:u,enableSorting:p=!0,onDelete:f,enableSelection:g=!0,selectionStyle:j="checkbox",ariaLabelledBy:v,selectRowOnContextMenu:y,onAction:b,renderRowAs:k,tableBody:S,meta:L,tableRef:D,closeOnInteractOutside:F=!1,cellHeight:C,headerCellHeight:T,...M}){const ee=ve(),R=!!ee&&n;R&&(a=!0,r=!0);const[W,he]=He(l,c||[],d),[Ae,Ye]=He(m,void 0,u),_=x.useCallback(oe=>{const De=[...W];if(!De.includes(oe.id))De.push(oe.id);else{const Ls=De.indexOf(oe.id);De.splice(Ls,1)}he(De)},[W,he]),B=x.useCallback((oe,De)=>{let Ls=[];oe&&(Ls=De?[...W==null?void 0:W.filter(Ys=>Ys!==oe.id),oe.id]:[oe.id]),he(Ls)},[W,he]),ae=x.useMemo(()=>{const oe=t.filter(Ls=>{const Ys=Ls.visibleInMode||"regular";if(Ys==="all"||Ys==="compact"&&R||Ys==="regular"&&!R)return!0});return g&&j!=="highlight"&&!ee&&oe.unshift(Hl),oe},[ee,t,g,j,R]),we={isCollapsedMode:R,cellHeight:C,headerCellHeight:T,hideBorder:r,hideHeaderRow:a,selectedRows:W,onSelectionChange:he,enableSorting:p,enableSelection:g,selectionStyle:j,data:o,columns:ae,sortDescriptor:Ae,onSortChange:Ye,toggleRow:_,selectRow:B,onAction:b,selectRowOnContextMenu:y,meta:L,collapseOnMobile:n},us=_l({cellCount:g?ae.length+1:ae.length,rowCount:o.length+1}),la={renderRowAs:k};S?S=x.cloneElement(S,la):S=e.jsx(Gl,{...la});const ca=Vt(D);return xi({ref:ca,onInteractOutside:oe=>{F&&g&&(W!=null&&W.length)&&!oe.target.closest('[role="dialog"]')&&he([])}}),e.jsx(Ge.Provider,{value:we,children:e.jsxs("div",{...es(M,us,{onKeyDown:oe=>{oe.key==="Escape"?(oe.preventDefault(),oe.stopPropagation(),W!=null&&W.length&&he([])):oe.key==="Delete"?(oe.preventDefault(),oe.stopPropagation(),W!=null&&W.length&&(f==null||f(o.filter(De=>W==null?void 0:W.includes(De.id))))):Rt(oe)&&oe.key==="a"&&(oe.preventDefault(),oe.stopPropagation(),g&&he(o.map(De=>De.id)))}}),role:"grid",tabIndex:0,"aria-rowcount":o.length+1,"aria-colcount":ae.length+1,ref:ca,"aria-multiselectable":g?!0:void 0,"aria-labelledby":v,className:w(s,"isolate select-none text-sm outline-none focus-visible:ring-2"),children:[!a&&e.jsx(Wl,{}),S]})})}function Gl({renderRowAs:s}){const{data:t}=x.useContext(Ge);return e.jsx(x.Fragment,{children:t.map((n,a)=>e.jsx($l,{item:n,index:a,renderAs:s},n.id))})}const Yl=15,Ql=[{key:10},{key:15},{key:20},{key:50},{key:100}];function Zl({query:s,onPerPageChange:t,onPageChange:n,className:a}){var d;const r=ve(),o=hi(),l=(d=s.data)==null?void 0:d.pagination;if(!l)return null;const c=t?e.jsx(zn,{minWidth:"min-w-auto",selectionMode:"single",disabled:s.isLoading,labelPosition:"side",size:"xs",label:e.jsx(i,{message:"Items per page"}),selectedValue:l.per_page||Yl,onSelectionChange:m=>t(m),children:Ql.map(m=>e.jsx(I,{value:m.key,children:m.key},m.key))}):null;return e.jsxs("div",{className:w("flex h-54 select-none items-center justify-end gap-20 px-20",a),children:[!r&&c,l.from&&l.to&&"total"in l&&e.jsx("div",{className:"text-sm",children:e.jsx(i,{message:":from - :to of :total",values:{from:l.from,to:l.to,total:o.format(l.total)}})}),e.jsxs("div",{className:"text-muted",children:[e.jsx(P,{disabled:s.isFetching||l.current_page<2,onClick:()=>{n==null||n((l==null?void 0:l.current_page)-1)},children:e.jsx(vt,{})}),e.jsx(P,{disabled:s.isFetching||!fi(l),onClick:()=>{n==null||n((l==null?void 0:l.current_page)+1)},children:e.jsx(Hs,{})})]})]})}const Jl=A(e.jsx("path",{d:"M7 6h10l-5.01 6.3L7 6zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61z"}),"FilterAltOutlined"),ba={variants:{open:{height:"auto",visibility:"visible",transitionEnd:{overflow:"auto"}},closed:{height:0,overflow:"hidden",transitionEnd:{visibility:"hidden"}}},transition:{type:"tween",duration:.2}},Er=Q.forwardRef(({variant:s="default",mode:t="single",children:n,className:a,isLazy:r,...o},l)=>{const[c,d]=He(o.expandedValues,o.defaultExpandedValues||[],o.onExpandedChange),m=Q.Children.count(n);return e.jsx("div",{className:w(s==="outline"&&"space-y-10",a),ref:l,role:"presentation",children:e.jsx(Se,{children:e.jsx(In,{children:Q.Children.map(n,(u,p)=>x.isValidElement(u)?x.cloneElement(u,{key:u.key||p,value:u.props.value||p,isFirst:p===0,isLast:p===m-1,mode:t,variant:s,expandedValues:c,setExpandedValues:d,isLazy:r}):null)})})})});function Ds({children:s,label:t,disabled:n,bodyClassName:a,labelClassName:r,buttonPadding:o="py-10 pl-14 pr-10",startIcon:l,description:c,endAppend:d,chevronPosition:m="right",isFirst:u,isLast:p,...f}){const{expandedValues:g,setExpandedValues:j,variant:v,value:y,mode:b,isLazy:k}=f,S=x.useRef(null),L=!n&&g.includes(y),D=x.useRef(!1);L&&(D.current=!0);const F=Rs(),C=x.useId(),T=`${C}-button`,M=`${C}-panel`,ee=he=>{switch(he.key){case"ArrowDown":F==null||F.focusNext();break;case"ArrowUp":F==null||F.focusPrevious();break;case"Home":F==null||F.focusFirst();break;case"End":F==null||F.focusLast();break}},R=()=>{const he=g.indexOf(y);if(he>-1){const Ae=[...g];Ae.splice(he,1),j(Ae)}else j(b==="single"?[y]:[...g,y])},W=e.jsx("div",{className:w(v==="minimal"&&""),children:e.jsx(dr,{"aria-hidden":"true",size:"md",className:w(n?"text-disabled":"text-muted",L&&"rotate-180 transition-transform")})});return e.jsxs("div",{className:w(v==="default"&&"border-b",v==="outline"&&"rounded-panel border",n&&"text-disabled"),children:[e.jsxs("h3",{className:w("flex w-full items-center justify-between text-sm",n&&"pointer-events-none",u&&v==="default"&&"border-t",L&&v!=="minimal"?"border-b":"border-b border-b-transparent",v==="outline"?L?"rounded-panel-t":"rounded-panel":void 0),children:[e.jsxs("button",{disabled:n,"aria-expanded":L,id:T,"aria-controls":M,type:"button",ref:S,onKeyDown:ee,onClick:()=>{n||R()},className:w("flex flex-auto items-center gap-10 text-left outline-none hover:bg-hover focus-visible:bg-primary/focus",o),children:[m==="left"&&W,l&&x.cloneElement(l,{size:"md",className:w(l.props.className,n?"text-disabled":"text-muted")}),e.jsxs("div",{className:"flex-auto overflow-hidden overflow-ellipsis",children:[e.jsx("div",{className:r,"data-testid":"accordion-label",children:t}),c&&e.jsx("div",{className:"text-xs text-muted",children:c})]}),m==="right"&&W]}),d&&e.jsx("div",{className:"flex-shrink-0 px-4 text-sm text-muted",children:d})]}),e.jsx(fe.div,{"aria-labelledby":C,role:"region",variants:ba.variants,transition:ba.transition,initial:!1,animate:L?"open":"closed",children:e.jsx("div",{className:w("p-16",a),children:!k||D?s:null})})]})}function Tr({filter:s}){const{trans:t}=$();return e.jsx(Ne,{size:"sm",name:`${s.key}.value`,selectionMode:"single",showSearchField:s.control.showSearchField,placeholder:s.control.placeholder?t(s.control.placeholder):void 0,searchPlaceholder:s.control.searchPlaceholder?t(s.control.searchPlaceholder):void 0,children:s.control.options.map(n=>e.jsx(I,{value:n.key,children:e.jsx(i,{...n.label})},n.key))})}function Vr({filter:s}){return e.jsx(Ll,{min:s.control.min,max:s.control.max,size:"sm",name:`${s.key}.value`,granularity:"day",closeDialogOnSelection:!0})}const kt=x.forwardRef(({className:s,circle:t,size:n="md",src:a,link:r,label:o,fallback:l="generic",lazy:c=!0,...d},m)=>{let u=a?e.jsx("img",{ref:m,src:a,alt:o,loading:c?"lazy":void 0,className:"block h-full w-full object-cover"}):e.jsx("div",{className:"h-full w-full bg-alt dark:bg-chip",children:e.jsx(pi,{viewBox:"0 0 48 48",className:"h-full w-full text-muted"})});o&&(u=e.jsx(se,{label:o,children:u}));const p={...d,className:w(s,"relative block overflow-hidden select-none flex-shrink-0",Xl(n),t?"rounded-full":"rounded")};return r?e.jsx(ge,{...p,to:r,children:u}):e.jsx("div",{...p,children:u})});function Xl(s){switch(s){case"xs":return"w-18 h-18";case"sm":return"w-24 h-24";case"md":return"w-32 h-32";case"lg":return"w-40 h-40";case"xl":return"w-60 h-60";default:return s}}function ec(s,t,n){return ze({queryKey:[s,t],queryFn:()=>sc(s,t),placeholderData:Dn,...n})}async function sc(s,t){return O.get(s,{params:t}).then(n=>n.data)}function Or(s,t,n){return ze({queryKey:[s,t],queryFn:()=>tc(s,t),...n})}async function tc(s,t){return O.get(s,{params:t}).then(n=>n.data)}function nc({label:s,className:t,background:n,value:a,defaultValue:r="",placeholder:o=h("Select item..."),searchPlaceholder:l=h("Find an item..."),onChange:c,description:d,errorMessage:m,invalid:u,autoFocus:p,queryParams:f,endpoint:g,disabled:j,required:v}){var T;const y=x.useRef(null),[b,k]=x.useState(""),[S,L]=He(a,r,c),D=ec(g,{query:b,...f}),{trans:F}=$(),C=Ms({size:"md"});return S?e.jsxs("div",{className:t,children:[e.jsx("div",{className:C.label,children:s}),e.jsx("div",{className:w("rounded-input border p-8",n,u&&"border-danger"),children:e.jsx(Se,{initial:!1,mode:"wait",children:e.jsx(ac,{disabled:j,endpoint:g,modelId:S,queryParams:f,onEditClick:()=>{L(""),k(""),requestAnimationFrame(()=>{var M,ee;(M=y.current)==null||M.focus(),(ee=y.current)==null||ee.click()})}})})}),d&&!m&&e.jsx("div",{className:C.description,children:d}),m&&e.jsx("div",{className:C.error,children:m})]}):e.jsx(zn,{className:t,showSearchField:!0,invalid:u,errorMessage:m,description:d,color:"white",isAsync:!0,background:n,placeholder:F(o),searchPlaceholder:F(l),label:s,isLoading:D.isFetching,items:(T=D.data)==null?void 0:T.results,inputValue:b,onInputValueChange:k,selectionMode:"single",selectedValue:S,onSelectionChange:L,ref:y,autoFocus:p,disabled:j,required:v,children:M=>e.jsx(I,{value:M.id,description:M.description,startIcon:e.jsx(kt,{src:M.image}),children:M.name},M.id)})}function ac({modelId:s,onEditClick:t,endpoint:n,disabled:a,queryParams:r}){const{data:o,isLoading:l}=Or(`${n}/${s}`,r);return l||!(o!=null&&o.model)?e.jsx(rc,{},"skeleton"):e.jsxs(fe.div,{className:w("flex items-center gap-10",a&&"pointer-events-none cursor-not-allowed text-disabled"),...Ie,children:[o.model.image&&e.jsx(kt,{src:o.model.image}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm leading-4",children:o.model.name}),e.jsx("div",{className:"text-xs text-muted",children:o.model.description})]}),e.jsx(se,{label:e.jsx(i,{message:"Change item"}),children:e.jsx(P,{className:"ml-auto text-muted",size:"sm",onClick:t,disabled:a,children:e.jsx(Ke,{})})})]},"preview")}function rc(){return e.jsxs(fe.div,{className:"flex items-center gap-10",...Ie,children:[e.jsx(je,{variant:"rect",size:"w-32 h-32"}),e.jsxs("div",{className:"max-h-[36px] flex-auto",children:[e.jsx(je,{className:"text-xs"}),e.jsx(je,{className:"max-h-8 text-xs"})]}),e.jsx(je,{variant:"icon",size:"w-24 h-24"})]})}function oc({name:s,...t}){const{clearErrors:n}=os(),{field:{onChange:a,value:r=""},fieldState:{invalid:o,error:l}}=Es({name:s});return e.jsx(nc,{value:r,onChange:c=>{a(c),n(s)},invalid:o,errorMessage:l==null?void 0:l.message,...t})}function $r({filter:s}){return e.jsx(oc,{name:`${s.key}.value`,endpoint:`normalized-models/${s.control.model}`})}const Hr={"=":h("is"),"!=":h("is not"),">":h("is greater than"),">=":h("is greater than or equal to"),"<":h("is less than"),"<=":h("is less than or equal to"),has:h("Include"),doesntHave:h("Do not include"),between:h("Is between"),hasAll:h("Include all")};function Br({filter:s}){var n;const t=s.control;return e.jsxs(x.Fragment,{children:[e.jsx(Ne,{selectionMode:"single",name:`${s.key}.operator`,className:"mb-14",size:"sm",required:!0,children:(n=s.operators)==null?void 0:n.map(a=>e.jsx(I,{value:a,children:e.jsx(i,{...Hr[a]})},a))}),e.jsx(E,{size:"sm",name:`${s.key}.value`,type:s.control.inputType,min:"minValue"in t?t.minValue:void 0,max:"maxValue"in t?t.maxValue:void 0,minLength:"minLength"in t?t.minLength:void 0,maxLength:"maxLength"in t?t.maxLength:void 0,required:!0})]})}function ic({filter:s}){return null}function lc({className:s,children:t,size:n,color:a,radius:r,selectable:o,wrap:l=!0}){return e.jsx("div",{className:w("flex items-center gap-8",l&&"flex-wrap",s),children:x.Children.map(t,c=>{if(x.isValidElement(c))return x.cloneElement(c,{size:n,color:a,selectable:o,radius:r})})})}function bn(s){return{id:s,name:`${s}`,description:`${s}`}}function cc(s,t){const n=x.useRef(null),a=Vt(t),{displayWith:r=we=>we.name,validateWith:o,children:l,suggestions:c,isLoading:d,inputValue:m,onInputValueChange:u,onItemSelected:p,placeholder:f,onOpenChange:g,chipSize:j="sm",openMenuOnFocus:v=!0,showEmptyMessage:y,value:b,defaultValue:k,onChange:S,valueKey:L,isAsync:D,allowCustomValue:F=!0,showDropdownArrow:C,onChipClick:T,...M}=s,ee=Ms({...s,flexibleHeight:!0}),[R,W]=mc(s),[he,Ae]=x.useState(!1),Ye=e.jsx(ht,{isIndeterminate:!0,size:"sm","aria-label":"loading..."}),_=C?e.jsx(Ts,{}):null,{fieldProps:B,inputProps:ae}=tr({...M,focusRef:a,endAdornment:d&&he?Ye:_});return e.jsx(nr,{fieldClassNames:ee,...B,children:e.jsxs(Sr,{ref:n,className:w("flex flex-wrap items-center",ee.input),onClick:()=>{var we;(we=a.current)==null||we.focus()},children:[e.jsx(dc,{displayChipUsing:r,onChipClick:T,items:R,setItems:W,chipSize:j}),e.jsx(uc,{showEmptyMessage:y,inputProps:ae,inputValue:m,onInputValueChange:u,fieldRef:n,inputRef:a,chips:R,setChips:W,validateWith:o,isLoading:d,suggestions:c,placeholder:f,openMenuOnFocus:v,listboxIsOpen:he,setListboxIsOpen:Ae,allowCustomValue:F,children:l})]})})}function dc({items:s,setItems:t,displayChipUsing:n,chipSize:a,onChipClick:r}){const o=Rs(),l=x.useCallback(c=>{const d=s.findIndex(u=>u.id===c),m=[...s];return d>-1&&(m.splice(d,1),t(m)),m},[s,t]);return e.jsx(lc,{className:"my-8 max-w-full flex-shrink-0 flex-wrap",size:a,selectable:!0,children:s.map(c=>e.jsx(Bt,{errorMessage:c.errorMessage,adornment:c.image?e.jsx(kt,{circle:!0,src:c.image}):null,onClick:()=>r==null?void 0:r(c),onRemove:()=>{l(c.id).length?o==null||o.focusPrevious({tabbable:!0}):o==null||o.focusLast()},children:n(c)},c.id))})}function uc(s){const{inputRef:t,fieldRef:n,validateWith:a,setChips:r,chips:o,suggestions:l,inputProps:c,placeholder:d,openMenuOnFocus:m,listboxIsOpen:u,setListboxIsOpen:p,allowCustomValue:f,isLoading:g}=s,j="outline-none text-sm mx-8 my-4 h-30 flex-auto",v=Rs(),y=x.useCallback(_=>{_=(_||[]).filter(B=>{const ae=!B||!B.id||!B.name;return!(o.findIndex(us=>us.id===(B==null?void 0:B.id))>-1)&&!ae}),_.length&&(a&&(_=_.map(B=>a(B))),r([...o,..._]))},[o,r,a]),b=gi({...s,clearInputOnItemSelection:!0,isOpen:u,onOpenChange:p,items:l,selectionMode:"none",role:"listbox",virtualFocus:!0,onItemSelected:_=>{W(_)}}),{state:{activeIndex:k,setActiveIndex:S,isOpen:L,setIsOpen:D,inputValue:F,setInputValue:C},refs:T,listboxId:M,collection:ee,onInputChange:R}=b,W=_=>{const B=ee.size&&k!=null?[...ee.values()][k]:null;B!=null&&B.item?y([B.item]):f&&y([bn(B?B.value:_)]),C(""),S(null),D(!1)};An(()=>{n.current&&T.reference.current!==n.current&&b.reference(n.current)},[n,b,T]);const{handleTriggerKeyDown:he,handleListboxKeyboardNavigation:Ae}=vi(b),Ye=Oe(()=>{m&&!L&&D(!0)});return e.jsx(ji,{listbox:b,mobileOverlay:bi,isLoading:g,onPointerDown:_=>{_.preventDefault()},children:e.jsx("input",{type:"text",className:w(j,"bg-transparent"),placeholder:d,...es(c,{ref:t,value:F,onChange:R,onPaste:_=>{const ae=_.clipboardData.getData("text").match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);if(ae){_.preventDefault();const we=window.getSelection();we!=null&&we.rangeCount&&(we.deleteFromDocument(),y(ae.map(us=>bn(us))))}},"aria-autocomplete":"list","aria-controls":L?M:void 0,autoComplete:"off",autoCorrect:"off",spellCheck:"false",onKeyDown:_=>{const B=_.target;if(_.key==="Enter"){_.preventDefault(),W(B.value);return}if(_.key==="Escape"&&L&&(D(!1),C("")),_.key==="ArrowUp"&&L&&(k===0||k==null)){S(null);return}if(k!=null&&(_.key==="ArrowLeft"||_.key==="ArrowRight")){_.preventDefault();return}if((_.key==="ArrowLeft"||_.key==="Backspace"||_.key==="Delete")&&B.selectionStart===0&&k==null&&o.length){v==null||v.focusPrevious({tabbable:!0});return}he(_)||Ae(_)},onFocus:Ye,onClick:Ye})})})}function mc({onChange:s,value:t,defaultValue:n,valueKey:a}){const r=x.useMemo(()=>va(t),[t]),o=x.useMemo(()=>va(n),[n]),l=x.useCallback(c=>{const d=a?c.map(m=>m[a]):c;s==null||s(d)},[s,a]);return He(r||void 0,o||[],l)}function va(s){if(s!=null)return s.map(t=>typeof t!="object"?bn(t):t)}const Ur=Q.forwardRef(cc);function en({children:s,...t}){const{field:{onChange:n,onBlur:a,value:r=[],ref:o},fieldState:{invalid:l,error:c}}=Es({name:t.name}),d={onChange:n,onBlur:a,value:r,invalid:l,errorMessage:c==null?void 0:c.message};return e.jsx(Ur,{ref:o,...es(d,t),children:s})}function qr({filter:s}){const{trans:t}=$();return e.jsx(en,{size:"sm",name:`${s.key}.value`,valueKey:"id",allowCustomValue:!1,showDropdownArrow:!0,placeholder:s.control.placeholder?t(s.control.placeholder):void 0,displayWith:n=>{var a;return(a=s.control.options.find(r=>r.key===n.id))==null?void 0:a.label.message},suggestions:s.control.options.map(n=>({id:n.key,name:n.label.message})),children:n=>e.jsx(I,{value:n.id,children:e.jsx(i,{message:n.name})},n.id)})}function xc({filters:s}){const{decodedFilters:t}=Jt(s),{formId:n}=U(),[a,r]=x.useState(()=>t.map(c=>c.key)),o=e.jsx(N,{size:"xs",variant:"outline",className:"mr-auto",onClick:()=>{r([])},children:e.jsx(i,{message:"Clear"})}),l=e.jsx(N,{size:"xs",variant:"flat",color:"primary",className:"ml-auto",type:"submit",form:n,children:e.jsx(i,{message:"Apply"})});return e.jsxs(K,{className:"min-w-[300px]",maxWidth:"max-w-400",size:"auto",children:[e.jsx(Z,{padding:"px-14 py-10",leftAdornment:o,rightAdornment:l,children:e.jsx(i,{message:"Filter"})}),e.jsx(G,{padding:"p-0",children:e.jsx(hc,{filters:s,expandedFilters:a,setExpandedFilters:r})})]})}function hc({filters:s,expandedFilters:t,setExpandedFilters:n}){const{decodedFilters:a,replaceAll:r}=Jt(s),o={};s.forEach(m=>{const u=a.find(p=>p.key===m.key);o[m.key]=(u==null?void 0:u.value)!==void 0?u:{value:m.control.defaultValue,operator:m.defaultOperator}});const l=ne({defaultValues:o}),{formId:c,close:d}=U();return e.jsx(xe,{form:l,id:c,onSubmit:m=>{const u=Object.entries(m).filter(([p,f])=>t.includes(p)&&f!==void 0).map(([p,f])=>({key:p,...f}));r(u),d()},children:e.jsx(Er,{mode:"multiple",expandedValues:t,onExpandedChange:n,children:s.map(m=>e.jsxs(Ds,{startIcon:e.jsx(Ht,{checked:t.includes(m.key)}),value:m.key,label:e.jsx(i,{...m.label}),bodyClassName:"max-h-288 overflow-y-auto compact-scrollbar",children:[m.description&&e.jsx("div",{className:w("text-xs text-muted",m.control.type!==H.BooleanToggle&&"mb-14"),children:e.jsx(i,{...m.description})}),e.jsx(fc,{filter:m})]},m.key))})})}function fc({filter:s}){switch(s.control.type){case H.Select:return e.jsx(Tr,{filter:s});case H.ChipField:return e.jsx(qr,{filter:s});case H.DateRangePicker:return e.jsx(Vr,{filter:s});case H.SelectModel:return e.jsx($r,{filter:s});case H.Input:return e.jsx(Br,{filter:s});case H.BooleanToggle:return e.jsx(ic,{filter:s});case"custom":const t=s.control.panel;return e.jsx(t,{filter:s});default:return null}}function pc({filters:s,icon:t=e.jsx(Jl,{}),color:n="primary",variant:a="outline",size:r="sm",disabled:o,className:l}){const c=ve(),d=e.jsx(N,{variant:a,color:n,startIcon:t,disabled:o,size:r,className:l,children:e.jsx(i,{message:"Filter"})}),m=e.jsx(P,{color:n,size:"sm",variant:a,disabled:o,className:l,children:t});return e.jsxs(V,{type:"popover",children:[c?m:d,e.jsx(xc,{filters:s})]})}function gc({actions:s,filters:t,filtersLoading:n,searchPlaceholder:a=h("Type to search..."),searchValue:r="",onSearchChange:o}){const{trans:l}=$();return e.jsxs(Wr,{children:[e.jsx(Ut,{inputTestId:"datatable-search",className:"flex-auto max-w-440 mr-auto",inputWrapperClassName:"mr-24 md:mr-0",placeholder:l(a),startAdornment:e.jsx(ur,{}),value:r,onChange:c=>{o(c.target.value)}}),t&&e.jsx(pc,{filters:t,disabled:n}),s]})}function Wr({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})}const Kr=x.forwardRef((s,t)=>{const{isInactive:n,filter:a,...r}=s;return n?e.jsx(jc,{filter:a,...r,ref:t}):e.jsx(bc,{filter:a,...r,ref:t})}),jc=x.forwardRef(({filter:s,...t},n)=>e.jsx(N,{variant:"outline",size:"xs",color:"paper",radius:"rounded-md",border:"border",ref:n,endIcon:e.jsx(Ts,{}),...t,children:e.jsx(i,{...s.label})})),bc=x.forwardRef(({filter:s,children:t,...n},a)=>{const r=s.control.type===H.BooleanToggle;return e.jsxs(N,{variant:"outline",size:"xs",color:"primary",radius:"rounded-r-md",border:"border-y border-r",endIcon:!r&&e.jsx(Ts,{}),ref:a,...n,children:[e.jsx("span",{className:w(!r&&"border-r border-r-primary-light mr-8 pr-8"),children:e.jsx(i,{...s.label})}),t]})});function wt(s){const{onValueChange:t,isInactive:n,filter:a,label:r}=s;return e.jsxs(V,{offset:10,type:"popover",onClose:o=>{o!==void 0&&t(o)},children:[e.jsx(Kr,{isInactive:n,filter:a,children:r}),e.jsx(vc,{...s})]})}function vc({filter:s,panel:t,value:n,operator:a}){const r=ne({defaultValues:{[s.key]:{value:n,operator:a}}}),{close:o,formId:l}=U();return e.jsxs(K,{size:"xs",children:[e.jsx(Z,{children:e.jsx(i,{...s.label})}),e.jsx(G,{padding:"px-14 pt-14 pb-4 max-h-288",children:e.jsxs(xe,{form:r,id:l,onSubmit:c=>{o(c[s.key])},children:[s.description&&e.jsx("div",{className:"text-muted text-xs mb-14",children:e.jsx(i,{...s.description})}),t]})}),e.jsx(X,{children:e.jsx(N,{form:l,type:"submit",variant:"flat",color:"primary",size:"xs",children:e.jsx(i,{message:"Apply"})})})]})}function yc(s){switch(s.filter.control.type){case H.DateRangePicker:return e.jsx(kc,{...s});case H.BooleanToggle:return e.jsx(wc,{...s});case H.Select:return e.jsx(Nc,{...s});case H.ChipField:return e.jsx(Cc,{...s});case H.Input:return e.jsx(Ic,{...s});case H.SelectModel:return e.jsx(Lc,{...s});case H.Custom:const t=s.filter.control.listItem;return e.jsx(t,{...s});default:return null}}function kc(s){const{value:t,filter:n}=s;let a;return t.preset!==void 0?a=e.jsx(i,{...Zt[t.preset].label}):a=e.jsx(Vn,{start:new Date(t.start),end:new Date(t.end),options:{dateStyle:"medium"}}),e.jsx(wt,{...s,label:a,panel:e.jsx(Vr,{filter:n})})}function wc({filter:s,isInactive:t,onValueChange:n}){return e.jsx(Kr,{onClick:()=>{n({value:s.control.defaultValue})},filter:s,isInactive:t})}function Nc(s){const{filter:t,value:n}=s,a=t.control.options.find(r=>r.key===n);return e.jsx(wt,{...s,label:a?e.jsx(i,{...a.label}):null,panel:e.jsx(Tr,{filter:t})})}function Cc(s){return e.jsx(wt,{...s,label:e.jsx(Sc,{...s}),panel:e.jsx(qr,{filter:s.filter})})}function Sc(s){const{trans:t}=$(),{filter:n,value:a}=s,r=a.map(d=>n.control.options.find(m=>m.key===d)),o=3,l=a.length-o,c=e.jsx(x.Fragment,{children:r.filter(Boolean).slice(0,o).map((d,m)=>{let u="";return m!==0&&(u+=", "),u+=t(d.label),u})});return l>0?e.jsx(i,{message:":names + :count more",values:{names:c,count:l}}):c}function Ic(s){const{filter:t,value:n,operator:a}=s,r=a?e.jsx(i,{...Hr[a]}):null,o=t.control.inputType==="number"?e.jsx(Be,{value:n}):n;return e.jsx(wt,{...s,label:e.jsxs(x.Fragment,{children:[r," ",o]}),panel:e.jsx(Br,{filter:t})})}function Lc(s){const{value:t,filter:n}=s,{isLoading:a,data:r}=Or(`normalized-models/${n.control.model}/${t}`,void 0,{enabled:!!t}),o=e.jsxs(x.Fragment,{children:[e.jsx(je,{variant:"avatar",size:"w-18 h-18 mr-6"}),e.jsx(je,{variant:"rect",size:"w-50"})]}),l=e.jsxs(x.Fragment,{children:[e.jsx(kt,{size:"xs",src:r==null?void 0:r.model.image,className:"mr-6"}),r==null?void 0:r.model.name]}),c=a||!r?o:l;return e.jsx(wt,{...s,label:c,panel:e.jsx($r,{filter:n})})}function Dc({filters:s,pinnedFilters:t,className:n}){const{decodedFilters:a,remove:r,replaceAll:o}=Jt(s,t);return a.length?e.jsx("div",{className:w("flex items-center gap-6 overflow-x-auto",n),children:a.map((l,c)=>{const d=s.find(u=>u.key===l.key);if(!d)return null;const m=u=>{const p=[...a];p.splice(c,1,{key:d.key,value:u.value,isInactive:!1,operator:u.operator||d.defaultOperator}),o(p)};return e.jsxs("div",{children:[!l.isInactive&&e.jsx(P,{variant:"outline",color:"primary",size:"xs",radius:"rounded-l-md",onClick:()=>{r(l.key)},children:e.jsx(Ue,{})}),e.jsx(yc,{filter:d,isInactive:l.isInactive,value:l.valueKey!=null?l.valueKey:l.value,operator:l.operator,onValueChange:m})]},l.key)})}):null}function Pc({actions:s,selectedItemsCount:t}){return e.jsxs(Wr,{"data-testid":"datatable-selected-header",children:[e.jsx("div",{className:"mr-auto",children:e.jsx(i,{message:"[one 1 item|other :count items] selected",values:{count:t}})}),s]})}function zc(){return e.jsxs(fe.div,{className:"flex items-center gap-6 h-30",...Ie,children:[e.jsx(je,{variant:"rect",size:"h-full w-144",radius:"rounded-md"}),e.jsx(je,{variant:"rect",size:"h-full w-112",radius:"rounded-md"}),e.jsx(je,{variant:"rect",size:"h-full w-172",radius:"rounded-md"})]},"filter-list-skeleton")}function Gr({filters:s,filtersLoading:t,columns:n,searchPlaceholder:a,queryParams:r,endpoint:o,actions:l,selectedActions:c,emptyStateMessage:d,tableDomProps:m,onRowAction:u,enableSelection:p=!0,selectionStyle:f="checkbox",children:g,cellHeight:j,collapseTableOnMobile:v=!0}){var ee;const y=ve(),{trans:b}=$(),{encodedFilters:k}=Jt(s),[S,L]=x.useState({perPage:15}),[D,F]=x.useState([]),C=_r(o,{...S,...r,[zt]:k},void 0,()=>F([])),T=!!(S.query||S.filters||k),M=(ee=C.data)==null?void 0:ee.pagination;return e.jsxs(Xt.Provider,{value:{selectedRows:D,setSelectedRows:F,endpoint:o,params:S,setParams:L,query:C},children:[g,e.jsx(Se,{initial:!1,mode:"wait",children:D.length?e.jsx(Pc,{selectedItemsCount:D.length,actions:c},"selected"):e.jsx(gc,{searchPlaceholder:a,searchValue:S.query,onSearchChange:R=>L({...S,query:R}),actions:l,filters:s,filtersLoading:t},"default")}),s&&e.jsx("div",{className:"mb-14",children:e.jsx(Se,{initial:!1,mode:"wait",children:t&&k?e.jsx(zc,{}):e.jsx(fe.div,{...Ie,children:e.jsx(Dc,{filters:s})},"filter-list")})}),e.jsxs("div",{className:w("relative rounded-panel",(!y||!v)&&"border"),children:[C.isFetching&&e.jsx(yi,{isIndeterminate:!0,className:"absolute left-0 top-0 z-10 w-full","aria-label":b({message:"Loading"}),size:"xs"}),e.jsx("div",{className:"relative overflow-x-auto md:overflow-hidden",children:e.jsx(Kl,{...m,columns:n,data:(M==null?void 0:M.data)||[],sortDescriptor:S,onSortChange:R=>{L({...S,...R})},selectedRows:D,enableSelection:p,selectionStyle:f,onSelectionChange:F,onAction:u,collapseOnMobile:v,cellHeight:j})}),(C.isFetched||C.isPlaceholderData)&&!(M!=null&&M.data.length)?e.jsx("div",{className:"pt-50",children:x.cloneElement(d,{isFiltering:T})}):void 0,e.jsx(Zl,{query:C,onPageChange:R=>L({...S,page:R}),onPerPageChange:R=>L({...S,perPage:R})})]})]})}function ys({title:s,headerContent:t,headerItemsAlign:n="items-end",className:a,...r}){const o=x.useId();return e.jsxs("div",{className:w("p-12 md:p-24",a),children:[s&&e.jsxs("div",{className:w("mb-16",t&&`flex ${n} gap-4`),children:[e.jsx(Fn,{children:s}),e.jsx("h1",{className:"text-3xl font-light first:capitalize",id:o,children:s}),t]}),e.jsx(Gr,{...r,tableDomProps:{"aria-labelledby":s?o:void 0}})]})}function Ac(){const{endpoint:s,selectedRows:t,setSelectedRows:n}=Mr();return Y({mutationFn:()=>Fc(s,t),onSuccess:async()=>{await q.invalidateQueries({queryKey:te(s)}),J(h("Deleted [one 1 record|other :count records]",{values:{count:t.length}})),n([])},onError:a=>ke(a,h("Could not delete records"))})}function Fc(s,t){return O.delete(`${s}/${t.join(",")}`).then(n=>n.data)}function ks(){return e.jsxs(V,{type:"modal",children:[e.jsx(N,{variant:"flat",color:"danger",className:"ml-auto",children:e.jsx(i,{message:"Delete"})}),e.jsx(_c,{})]})}function _c(){const s=Ac(),{selectedRows:t}=Mr(),{close:n}=U();return e.jsx(ps,{isLoading:s.isPending,title:e.jsx(i,{message:"Delete [one 1 item|other :count items]?",values:{count:t.length}}),body:e.jsx(i,{message:"This will permanently remove the items and cannot be undone."}),confirm:e.jsx(i,{message:"Delete"}),isDanger:!0,onConfirm:()=>{s.mutate(void 0,{onSuccess:()=>n()})}})}function cs({isFiltering:s,title:t,filteringTitle:n,image:a,size:r,className:o}){const l=ve();return r||(r=l?"sm":"md"),e.jsx(qt,{className:o,size:r,image:e.jsx(ft,{src:a}),title:s&&n?n:t,description:s&&n?e.jsx(i,{message:"Try another search query or different filters"}):void 0})}const lt=A(e.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined"),ds=Q.forwardRef(({children:s,to:t,elementType:n,onClick:a},r)=>ve()?e.jsx(P,{ref:r,variant:"flat",color:"primary",className:"flex-shrink-0",size:"sm",to:t,elementType:n,onClick:a,children:e.jsx(lt,{})}):e.jsx(N,{ref:r,startIcon:e.jsx(lt,{}),variant:"flat",color:"primary",size:"sm",to:t,elementType:n,onClick:a,children:s})),Mc=A(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 On(s){return Y({mutationFn:t=>Rc(s,t),onError:t=>ke(t)})}function Rc(s,t){return O.post(s,t).then(n=>n.data)}function $n(s,t){const n=document.createElement("a");n.href=s,t&&(n.download=t),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Hn(){const{close:s}=U();return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Csv export"})}),e.jsx(G,{children:e.jsx(i,{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(X,{children:e.jsx(N,{variant:"flat",color:"primary",onClick:s,children:e.jsx(i,{message:"Got it"})})})]})}function Ec({endpoint:s,payload:t}){const[n,a]=x.useState(!1),r=On(s);return e.jsxs(x.Fragment,{children:[e.jsx(P,{variant:"outline",color:"primary",size:"sm",className:"flex-shrink-0",disabled:r.isPending,onClick:()=>{r.mutate(t,{onSuccess:o=>{o.downloadPath?$n(o.downloadPath):a(!0)}})},children:e.jsx(Mc,{})}),e.jsx(V,{type:"modal",isOpen:n,onOpenChange:a,children:e.jsx(Hn,{})})]})}function ws({image:s,label:t,description:n,labelClassName:a,avatarSize:r="md"}){return e.jsxs("div",{className:"flex items-center gap-12",children:[s&&e.jsx(kt,{size:r,className:"flex-shrink-0",src:s}),e.jsxs("div",{className:"min-w-0 overflow-hidden",children:[e.jsx("div",{className:w(a,"overflow-hidden overflow-ellipsis"),children:t}),n&&e.jsx("div",{className:"overflow-hidden overflow-ellipsis text-xs text-muted",children:n})]})]})}function Tc(s){const t=$s(),[n,a]=x.useState(!s.value&&!s.defaultValue),r=s.onChange,[o,l]=He(s.value||t,s.defaultValue||t,L=>{a(!1),r==null||r(L)}),{min:c,max:d,granularity:m,timezone:u,calendarIsOpen:p,setCalendarIsOpen:f,closeDialogOnSelection:g}=Ir(o,s),j=x.useCallback(()=>{a(!0),l(t),r==null||r(null),f(!1)},[t,l,r,f]),[v,y]=x.useState(()=>[rt(o)]),b=x.useCallback(L=>{c&&L.compare(c)<0?L=c:d&&L.compare(d)>0&&(L=d);const D=o?o.set(L):xs(L,u);l(D),y([rt(D)]),a(!1)},[l,c,d,o,u]),k=x.useCallback(L=>!n&&Zs(o,L),[o,n]),S=x.useCallback(L=>({onClick:()=>{b==null||b(L),g&&(f==null||f(!1))}}),[b,f,g]);return{selectedValue:o,setSelectedValue:l,calendarIsOpen:p,setCalendarIsOpen:f,dayIsActive:k,dayIsHighlighted:()=>!1,dayIsRangeStart:()=>!1,dayIsRangeEnd:()=>!1,getCellProps:S,calendarDates:v,setCalendarDates:y,isPlaceholder:n,clear:j,setIsPlaceholder:a,min:c,max:d,granularity:m,timezone:u,closeDialogOnSelection:g}}function Vc({showCalendarFooter:s,...t}){const n=Tc(t),a=x.useRef(null),r=$s(),o=s&&e.jsx(X,{padding:"px-14 pb-14",startAction:e.jsx(N,{disabled:n.isPlaceholder,variant:"text",color:"primary",onClick:()=>{n.clear()},children:e.jsx(i,{message:"Clear"})}),children:e.jsx(N,{variant:"text",color:"primary",onClick:()=>{n.setSelectedValue(r),n.setCalendarIsOpen(!1)},children:e.jsx(i,{message:"Today"})})}),l=e.jsx(V,{offset:8,placement:"bottom-start",isOpen:n.calendarIsOpen,onOpenChange:n.setCalendarIsOpen,type:"popover",triggerRef:a,returnFocusToTrigger:!1,moveFocusToDialog:!1,children:e.jsxs(K,{size:"auto",children:[e.jsx(G,{className:"flex items-start gap-40",padding:s?"px-24 pt-20 pb-10":null,children:e.jsx(Dr,{state:n,visibleMonths:1})}),o]})}),c={onClick:d=>{d.stopPropagation(),d.preventDefault(),Oc(d)?n.setCalendarIsOpen(!1):n.setCalendarIsOpen(!0)}};return e.jsxs(x.Fragment,{children:[e.jsx(Tn,{ref:a,wrapperProps:c,endAdornment:e.jsx(En,{className:w(t.disabled&&"text-disabled")}),...t,children:e.jsx(it,{segmentProps:c,state:n,value:n.selectedValue,onChange:n.setSelectedValue,isPlaceholder:n.isPlaceholder})}),l]})}function ct(s){const{min:t,max:n}=s,{trans:a}=$(),{format:r}=hs(),{field:{onChange:o,onBlur:l,value:c=null,ref:d},fieldState:{invalid:m,error:u}}=Es({name:s.name,rules:{validate:g=>{if(!g)return;const j=Fs(g);if(t&&j.compare(t)<0)return a({message:"Enter a date after :date",values:{date:r(g)}});if(n&&j.compare(n)>0)return a({message:"Enter a date before :date",values:{date:r(g)}})}}}),p=c?Fs(c):null,f={onChange:g=>{o(g&&g.toAbsoluteString())},onBlur:l,value:p,invalid:m,errorMessage:u==null?void 0:u.message,inputRef:d};return e.jsx(Vc,{...es(f,s)})}function Oc(s){return["hour","minute","dayPeriod"].includes(s.currentTarget.ariaLabel||"")}function $c(s,t){return s.reduce((n,a,r)=>{const o=Math.floor(r/t);return n[o]||(n[o]=[]),n[o].push(a),n},[])}const Yr=A(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 Bs(){return(Bs=Object.assign||function(s){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s[a]=n[a])}return s}).apply(this,arguments)}function sn(s,t){if(s==null)return{};var n,a,r={},o=Object.keys(s);for(a=0;a<o.length;a++)t.indexOf(n=o[a])>=0||(r[n]=s[n]);return r}function dt(s){var t=x.useRef(s),n=x.useRef(function(a){t.current&&t.current(a)});return t.current=s,n.current}var ut=function(s,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),s>n?n:s<t?t:s},Xs=function(s){return"touches"in s},vn=function(s){return s&&s.ownerDocument.defaultView||self},ya=function(s,t,n){var a=s.getBoundingClientRect(),r=Xs(t)?function(o,l){for(var c=0;c<o.length;c++)if(o[c].identifier===l)return o[c];return o[0]}(t.touches,n):t;return{left:ut((r.pageX-(a.left+vn(s).pageXOffset))/a.width),top:ut((r.pageY-(a.top+vn(s).pageYOffset))/a.height)}},ka=function(s){!Xs(s)&&s.preventDefault()},Qr=Q.memo(function(s){var t=s.onMove,n=s.onKey,a=sn(s,["onMove","onKey"]),r=x.useRef(null),o=dt(t),l=dt(n),c=x.useRef(null),d=x.useRef(!1),m=x.useMemo(function(){var g=function(y){ka(y),(Xs(y)?y.touches.length>0:y.buttons>0)&&r.current?o(ya(r.current,y,c.current)):v(!1)},j=function(){return v(!1)};function v(y){var b=d.current,k=vn(r.current),S=y?k.addEventListener:k.removeEventListener;S(b?"touchmove":"mousemove",g),S(b?"touchend":"mouseup",j)}return[function(y){var b=y.nativeEvent,k=r.current;if(k&&(ka(b),!function(L,D){return D&&!Xs(L)}(b,d.current)&&k)){if(Xs(b)){d.current=!0;var S=b.changedTouches||[];S.length&&(c.current=S[0].identifier)}k.focus(),o(ya(k,b,c.current)),v(!0)}},function(y){var b=y.which||y.keyCode;b<37||b>40||(y.preventDefault(),l({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},v]},[l,o]),u=m[0],p=m[1],f=m[2];return x.useEffect(function(){return f},[f]),Q.createElement("div",Bs({},a,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:p,tabIndex:0,role:"slider"}))}),Bn=function(s){return s.filter(Boolean).join(" ")},Zr=function(s){var t=s.color,n=s.left,a=s.top,r=a===void 0?.5:a,o=Bn(["react-colorful__pointer",s.className]);return Q.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},Q.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},be=function(s,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*s)/n},Hc=function(s){return Kc(yn(s))},yn=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?be(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?be(parseInt(s.substring(6,8),16)/255,2):1}},Bc=function(s){return Wc(qc(s))},Uc=function(s){var t=s.s,n=s.v,a=s.a,r=(200-t)*n/100;return{h:be(s.h),s:be(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:be(r/2),a:be(a,2)}},kn=function(s){var t=Uc(s);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},qc=function(s){var t=s.h,n=s.s,a=s.v,r=s.a;t=t/360*6,n/=100,a/=100;var o=Math.floor(t),l=a*(1-n),c=a*(1-(t-o)*n),d=a*(1-(1-t+o)*n),m=o%6;return{r:be(255*[a,c,l,l,d,a][m]),g:be(255*[d,a,a,c,l,l][m]),b:be(255*[l,l,d,a,a,c][m]),a:be(r,2)}},Dt=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Wc=function(s){var t=s.r,n=s.g,a=s.b,r=s.a,o=r<1?Dt(be(255*r)):"";return"#"+Dt(t)+Dt(n)+Dt(a)+o},Kc=function(s){var t=s.r,n=s.g,a=s.b,r=s.a,o=Math.max(t,n,a),l=o-Math.min(t,n,a),c=l?o===t?(n-a)/l:o===n?2+(a-t)/l:4+(t-n)/l:0;return{h:be(60*(c<0?c+6:c)),s:be(o?l/o*100:0),v:be(o/255*100),a:r}},Gc=Q.memo(function(s){var t=s.hue,n=s.onChange,a=Bn(["react-colorful__hue",s.className]);return Q.createElement("div",{className:a},Q.createElement(Qr,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:ut(t+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":be(t),"aria-valuemax":"360","aria-valuemin":"0"},Q.createElement(Zr,{className:"react-colorful__hue-pointer",left:t/360,color:kn({h:t,s:100,v:100,a:1})})))}),Yc=Q.memo(function(s){var t=s.hsva,n=s.onChange,a={backgroundColor:kn({h:t.h,s:100,v:100,a:1})};return Q.createElement("div",{className:"react-colorful__saturation",style:a},Q.createElement(Qr,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:ut(t.s+100*r.left,0,100),v:ut(t.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+be(t.s)+"%, Brightness "+be(t.v)+"%"},Q.createElement(Zr,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:kn(t)})))}),Jr=function(s,t){if(s===t)return!0;for(var n in s)if(s[n]!==t[n])return!1;return!0},Qc=function(s,t){return s.toLowerCase()===t.toLowerCase()||Jr(yn(s),yn(t))};function Zc(s,t,n){var a=dt(n),r=x.useState(function(){return s.toHsva(t)}),o=r[0],l=r[1],c=x.useRef({color:t,hsva:o});x.useEffect(function(){if(!s.equal(t,c.current.color)){var m=s.toHsva(t);c.current={hsva:m,color:t},l(m)}},[t,s]),x.useEffect(function(){var m;Jr(o,c.current.hsva)||s.equal(m=s.fromHsva(o),c.current.color)||(c.current={hsva:o,color:m},a(m))},[o,s,a]);var d=x.useCallback(function(m){l(function(u){return Object.assign({},u,m)})},[]);return[o,d]}var Jc=typeof window<"u"?x.useLayoutEffect:x.useEffect,Xc=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},wa=new Map,ed=function(s){Jc(function(){var t=s.current?s.current.ownerDocument:document;if(t!==void 0&&!wa.has(t)){var n=t.createElement("style");n.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}`,wa.set(t,n);var a=Xc();a&&n.setAttribute("nonce",a),t.head.appendChild(n)}},[])},sd=function(s){var t=s.className,n=s.colorModel,a=s.color,r=a===void 0?n.defaultColor:a,o=s.onChange,l=sn(s,["className","colorModel","color","onChange"]),c=x.useRef(null);ed(c);var d=Zc(n,r,o),m=d[0],u=d[1],p=Bn(["react-colorful",t]);return Q.createElement("div",Bs({},l,{ref:c,className:p}),Q.createElement(Yc,{hsva:m,onChange:u}),Q.createElement(Gc,{hue:m.h,onChange:u,className:"react-colorful__last-control"}))},td={defaultColor:"000",toHsva:Hc,fromHsva:function(s){return Bc({h:s.h,s:s.s,v:s.v,a:1})},equal:Qc},nd=function(s){return Q.createElement(sd,Bs({},s,{colorModel:td}))},ad=/^#?([0-9A-F]{3,8})$/i,rd=function(s){var t=s.color,n=t===void 0?"":t,a=s.onChange,r=s.onBlur,o=s.escape,l=s.validate,c=s.format,d=s.process,m=sn(s,["color","onChange","onBlur","escape","validate","format","process"]),u=x.useState(function(){return o(n)}),p=u[0],f=u[1],g=dt(a),j=dt(r),v=x.useCallback(function(b){var k=o(b.target.value);f(k),l(k)&&g(d?d(k):k)},[o,d,l,g]),y=x.useCallback(function(b){l(b.target.value)||f(o(n)),j(b)},[n,o,l,j]);return x.useEffect(function(){f(o(n))},[n,o]),Q.createElement("input",Bs({},m,{value:c?c(p):p,spellCheck:"false",onChange:v,onBlur:y}))},Na=function(s){return"#"+s},Xr=function(s){var t=s.prefixed,n=s.alpha,a=sn(s,["prefixed","alpha"]),r=x.useCallback(function(l){return l.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),o=x.useCallback(function(l){return function(c,d){var m=ad.exec(c),u=m?m[1].length:0;return u===3||u===6||!!d&&u===4||!!d&&u===8}(l,n)},[n]);return Q.createElement(rd,Bs({},a,{escape:r,format:t?Na:void 0,process:Na,validate:o}))};function od({onChange:s,value:t,colors:n}){const a=n.map(r=>{const o=t===r;return e.jsx(Vs,{onClick:()=>{s==null||s(r)},className:w("relative block flex-shrink-0 w-26 h-26 border rounded",o&&"shadow-md"),style:{backgroundColor:r},children:o&&e.jsx("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},r)});return e.jsx("div",{className:"flex flex-wrap gap-6",children:a})}const eo=[{color:"rgb(255, 255, 255)",name:h("White")},{color:"rgb(239,245,245)",name:h("Solitude")},{color:"rgb(245,213,174)",name:h("Wheat")},{color:"rgb(253,227,167)",name:h("Cape Honey")},{color:"rgb(242,222,186)",name:h("Milk punch")},{color:"rgb(97,118,75)",name:h("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:h("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:h("Cosmic Latte")},{color:"rgb(233,119,119)",name:h("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:h("Sundown")},{color:"rgb(30,139,195)",name:h("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:h("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:h("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:h("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:h("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:h("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:h("Comet"),foreground:"rgb(255, 255, 255)"}],id=eo.map(({color:s})=>s).slice(0,14);function ld({defaultValue:s,onChange:t,colorPresets:n,showInput:a}){const[r,o]=x.useState(s),l=n||id,c=Ms({size:"sm"});return e.jsxs("div",{children:[e.jsx(nd,{className:"!w-auto",color:r,onChange:d=>{t==null||t(d),o(d)}}),e.jsxs("div",{className:"py-20 px-12",children:[l&&e.jsx(od,{colors:l,onChange:d=>{if(d){const m=mr(d).toString("hex");t==null||t(m),o(m)}},value:r}),a&&e.jsx("div",{className:"pt-20",children:e.jsx(Xr,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:c.input,color:r,onChange:d=>{t==null||t(d),o(d)}})})]})]})}function Nt({defaultValue:s,onChange:t,hideFooter:n=!1,showInput:a=!0}){const{close:r}=U(),[o,l]=x.useState(s||"");return e.jsxs(K,{size:"2xs",children:[e.jsx(ld,{showInput:a,defaultValue:o,onChange:c=>{l(c),t==null||t(c)}}),!n&&e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{variant:"text",size:"xs",onClick:()=>{r()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",size:"xs",onClick:()=>{r(o)},children:e.jsx(i,{message:"Apply"})})]})]})}const cd=A(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"),dd=A(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"),Qe=new Map,_e=new Map,ud=new Map,Me={status:"inactive"};function xn({e:s,rect:t,deltaX:n,deltaY:a}){return{rect:t,x:s.clientX,y:s.clientY,deltaX:n??0,deltaY:a??0,nativeEvent:s}}let so=null;function Ca(s){so=s}function md(s){return{left:s.left,top:s.top,width:s.width,height:s.height}}function to(s){const t=new IntersectionObserver(n=>{n.forEach(a=>{const{width:r,height:o,left:l,top:c}=a.boundingClientRect,[d,m]=[...s].find(([,p])=>p.ref.current===a.target)||[];if(d==null||m==null)return;const u={width:r,height:o,left:l,top:c};s.set(d,{...m,rect:u})}),t.disconnect()});[...s.values()].forEach(n=>{n.ref.current&&t.observe(n.ref.current)})}function xd({id:s,disabled:t,ref:n,preview:a,hidePreview:r,...o}){const l=x.useRef(null),{addGlobalListener:c,removeAllGlobalListeners:d}=cr(),m=x.useRef({lastPosition:{x:0,y:0}}).current,u=x.useRef(o);u.current=o,x.useLayoutEffect(()=>(t?Qe.delete(s):Qe.set(s,{...Qe.get(s),id:s,ref:n,type:u.current.type,getData:u.current.getData}),()=>{Qe.delete(s)}),[s,t,u,n]);const p=y=>{ud.forEach(b=>{var k;b.type===((k=Qe.get(s))==null?void 0:k.type)&&y(b)})},f=y=>{var D,F;const b=Qe.get(s),k=n.current,S=!l.current||!m.clickedEl||l.current.contains(m.clickedEl);if(so||!k||!b||!S){y.preventDefault(),y.stopPropagation();return}to(_e),Ca("drag"),r&&hd(y),y.dataTransfer.effectAllowed="move",m.lastPosition={x:y.clientX,y:y.clientY},m.currentRect=md(k.getBoundingClientRect());const L=xn({rect:m.currentRect,e:y});a!=null&&a.current&&a.current(b,C=>{y.dataTransfer.setDragImage(C,0,0)}),Me.status="dragging",Me.dragTargetId=s,n.current&&(n.current.dataset.dragging="true"),(F=(D=u.current).onDragStart)==null||F.call(D,L,b),requestAnimationFrame(()=>{p(C=>{var T;return(T=C.onDragStart)==null?void 0:T.call(C,L,b)})}),c(window,"dragover",g,!0)},g=y=>{var F,C;if(y.preventDefault(),!m.currentRect)return;const b=y.clientX-m.lastPosition.x,k=y.clientY-m.lastPosition.y,S={...m.currentRect,left:m.currentRect.left+b,top:m.currentRect.top+k},L=xn({rect:S,e:y,deltaX:b,deltaY:k}),D=Qe.get(s);D&&((C=(F=u.current).onDragMove)==null||C.call(F,L,D),p(T=>{var M;return(M=T.onDragMove)==null?void 0:M.call(T,L,D)})),m.lastPosition={x:y.clientX,y:y.clientY},m.currentRect=S};return{draggableProps:{draggable:!t,onDragStart:f,onDragEnd:y=>{var S,L;if(d(),!m.currentRect)return;Ca(null),ms&&ms.remove();const b=xn({rect:m.currentRect,e:y}),k=Qe.get(s);k&&((L=(S=u.current).onDragEnd)==null||L.call(S,b,k),p(D=>{var F;return(F=D.onDragEnd)==null?void 0:F.call(D,b,k,Me.status)})),requestAnimationFrame(()=>{Me.dragTargetId=void 0,Me.status="inactive",n.current&&delete n.current.dataset.dragging})},onPointerDown:y=>{m.clickedEl=y.target}},dragHandleRef:l}}let ms;function hd(s){ms||(ms=new Image,document.body.append(ms),ms.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),s.dataTransfer.setDragImage(ms,0,0)}async function*fd(s){const t=[];for(const n of s.items)if(n.kind==="file"){const a=n.webkitGetAsEntry();a&&t.push(a)}for(const n of t)if(n.isFile){if(n.name===".DS_Store")continue;const a=await ao(n);yield new xr(a,n.fullPath)}else n.isDirectory&&(yield*no(n))}async function*no(s){const t=s.createReader();let n;do{n=await new Promise((a,r)=>{t.readEntries(a,r)});for(const a of n)if(a.isFile){if(a.name===".DS_Store")continue;const r=await ao(a);yield new xr(r,a.fullPath)}else a.isDirectory&&(yield*no(a))}while(n.length>0)}function ao(s){return new Promise((t,n)=>s.file(t,n))}async function pd(s){const t=[];for await(const n of s)t.push(n);return t}const gd=400;function jd({id:s,disabled:t,ref:n,...a}){const r=x.useRef({dragOverElements:new Set,dropActivateTimer:void 0}).current,o=x.useRef(a);o.current=a,x.useLayoutEffect(()=>(_e.set(s,{..._e.get(s),disabled:t,id:s,ref:n}),()=>{_e.delete(s)}),[s,o,t,n]);const l=f=>{var v;const g=o.current,j=g.allowDragEventsFromItself||n.current!==((v=f.ref)==null?void 0:v.current);return!!(f!=null&&f.type&&j&&g.types.includes(f.type)&&(!g.acceptsDrop||g.acceptsDrop(f)))},c=f=>{var j,v;const g=Qs(f);g&&((v=(j=o.current).onDragLeave)==null||v.call(j,g))};return{droppableProps:t?{}:{onDragOver:f=>{var j,v;f.preventDefault(),f.stopPropagation();const g=Qs(f);g&&l(g)&&((v=(j=o.current).onDragOver)==null||v.call(j,g,f))},onDragEnter:f=>{var j,v;if(f.stopPropagation(),r.dragOverElements.add(f.target),r.dragOverElements.size>1)return;const g=Qs(f);g&&l(g)&&((v=(j=o.current).onDragEnter)==null||v.call(j,g),clearTimeout(r.dropActivateTimer),typeof o.current.onDropActivate=="function"&&(r.dropActivateTimer=setTimeout(()=>{var y,b;g&&((b=(y=o.current).onDropActivate)==null||b.call(y,g))},gd)))},onDragLeave:f=>{f.stopPropagation(),r.dragOverElements.delete(f.target);for(const j of r.dragOverElements)f.currentTarget.contains(j)||r.dragOverElements.delete(j);if(r.dragOverElements.size>0)return;const g=Qs(f);g&&l(g)&&(c(f),clearTimeout(r.dropActivateTimer))},onDrop:async f=>{var j,v,y,b;f.preventDefault(),f.stopPropagation(),r.dragOverElements.clear(),c(f),clearTimeout(r.dropActivateTimer);const g=Qs(f);if(g)if((v=(j=o.current).onDragLeave)==null||v.call(j,g),!l(g))Me.status!=="inactive"&&(Me.status="dropFail");else{const k=(b=(y=o.current).onDrop)==null?void 0:b.call(y,g);Me.status!=="inactive"&&(Me.status=k===!1?"dropFail":"dropSuccess")}}}}}function Qs(s){if(Me.dragTargetId!=null)return Qe.get(Me.dragTargetId);if(s.dataTransfer.types.includes("Files"))return{type:"nativeFile",el:null,ref:null,getData:()=>pd(fd(s.dataTransfer))}}function bd(s,t,n){const a=xa(t,0,s.length-1),r=xa(n,0,s.length-1);if(a===r)return s;const o=s[a],l=r<a?-1:1;for(let c=a;c!==r;c+=l)s[c]=s[c+l];return s[r]=o,s}function ro(s,t,n){const a=s.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}let z=null;function vd({item:s,items:t,type:n,ref:a,onSortEnd:r,onSortStart:o,onDragEnd:l,preview:c,disabled:d,onDropPositionChange:m,previewVariant:u="liveSort"}){const p=x.useRef(null);x.useEffect(()=>{z&&z.sortables.length!==t.length&&(z.sortables=[...t],z.activeIndex=t.indexOf(s))},[t,s]);const{draggableProps:f,dragHandleRef:g}=xd({id:s,ref:a,type:n,preview:c,disabled:d,onDragStart:()=>{var v;p.current=null,z={sortables:[...t],activeSortable:s,activeIndex:t.indexOf(s),finalIndex:t.indexOf(s),dropPosition:null,scrollParent:a.current?ki(a.current):void 0,scrollListener:()=>{to(_e)}},u==="liveSort"&&kd(),o==null||o(),(v=z.scrollParent)==null||v.addEventListener("scroll",z.scrollListener)},onDragEnd:()=>{var v;z&&(u==="liveSort"&&wd(),z.dropPosition=null,m==null||m(z.dropPosition),z.activeIndex!==z.finalIndex&&(r==null||r(z.activeIndex,z.finalIndex)),(v=z.scrollParent)==null||v.removeEventListener("scroll",z.scrollListener),Sa(),l==null||l(),z=null)},getData:()=>{}}),{droppableProps:j}=jd({id:s,ref:a,types:[n],disabled:d,allowDragEventsFromItself:!0,onDragOver:(v,y)=>{var L;if(!z||u!=="line")return;const b=z.dropPosition;let k=null;const S=(L=_e.get(s))==null?void 0:L.rect;if(S){const D=S.top+S.height/2;y.clientY<=D?k="before":y.clientY>=D&&(k="after")}if(k!==b){const D=z.sortables.indexOf(s);if(z.dropPosition=k,m==null||m(z.dropPosition),Sa(),a.current)if(z.dropPosition==="after")hn(a.current,"bottom");else if(D===0)hn(a.current,"top");else{const T=z.sortables[D-1],M=_e.get(T);M!=null&&M.ref.current&&hn(M.ref.current,"bottom")}const F=t.indexOf(s);if(z.activeIndex===F){z.finalIndex=z.activeIndex;return}(D>z.activeIndex?"after":"before")==="after"?z.finalIndex=z.dropPosition==="before"?F-1:F:z.finalIndex=z.dropPosition==="after"?F+1:F}},onDragEnter:()=>{if(!z||u==="line")return;const v=z.sortables.indexOf(s),y=z.sortables.indexOf(z.activeSortable);bd(z.sortables,y,v);const b=z.sortables.map(k=>{var S;return(S=_e.get(k))==null?void 0:S.rect});z.sortables.forEach((k,S)=>{if(!z)return;const L=ro(b,v,z.activeIndex),D=b[S],F=L[S],C=_e.get(k);if(C!=null&&C.ref.current&&F&&D){const T=F.left-D.left,M=F.top-D.top;C.ref.current.style.transform=`translate3d(${T}px, ${M}px, 0)`}}),z.finalIndex=v},onDragLeave:()=>{!z||u!=="line"||(z.dropPosition=null,m==null||m(z.dropPosition))}});return{sortableProps:{...es(f,j)},dragHandleRef:g}}const yd="transform 0.2s cubic-bezier(0.2, 0, 0, 1)";function kd(){z&&z.sortables.forEach((s,t)=>{const n=_e.get(s);n!=null&&n.ref.current&&(n.ref.current.style.transition=yd,(z==null?void 0:z.activeIndex)===t&&(n.ref.current.style.opacity="0.4"))})}function wd(){z&&z.sortables.forEach(s=>{const t=_e.get(s);t!=null&&t.ref.current&&(t.ref.current.style.transform="",t.ref.current.style.transition="",t.ref.current.style.opacity="",t.ref.current.style.zIndex="")})}function Sa(){z!=null&&z.linePreviewEl&&(z.linePreviewEl.style.borderBottomColor="",z.linePreviewEl.style.borderTopColor="",z.linePreviewEl=void 0)}function hn(s,t){const n="rgb(var(--be-primary))";t==="top"?s.style.borderTopColor=n:s.style.borderBottomColor=n,z&&(z.linePreviewEl=s)}const Nd=Q.lazy(()=>pt(()=>import("./ace-editor-b8542a30.js"),["./ace-editor-b8542a30.js","./main-96065a7f.js","./main-54a4a887.css","./index-848fa251.js"],import.meta.url));function Cd({defaultValue:s,mode:t="html",title:n,onSave:a,isSaving:r,footerStartAction:o,beautify:l,editorRef:c}){const[d,m]=x.useState(s),[u,p]=x.useState(!0);return e.jsxs(K,{size:"fullscreen",className:"h-full w-full",children:[e.jsx(Z,{children:n}),e.jsx(G,{className:"relative flex-auto",padding:"p-0",children:e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"flex h-400 w-full items-center justify-center",children:e.jsx(ht,{"aria-label":"Loading editor...",isIndeterminate:!0,size:"md"})}),children:e.jsx(Nd,{beautify:l,mode:t,onChange:f=>m(f),defaultValue:d||"",onIsValidChange:p,editorRef:c})})}),e.jsx(Sd,{disabled:!u||r,value:d,onSave:a,startAction:o})]})}function Sd({disabled:s,value:t,onSave:n,startAction:a}){const{close:r}=U();return e.jsxs(X,{dividerTop:!0,startAction:a,children:[e.jsx(N,{onClick:()=>r(),children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{disabled:s,variant:"flat",color:"primary",onClick:()=>{n?n(t):r(t)},children:e.jsx(i,{message:"Save"})})]})}const Id=""+new URL("articles-8bfd9f17.svg",import.meta.url).href,Ns="user",Ia=s=>{const t=s.customPages.types.length>1?[{control:{type:H.Select,defaultValue:"default",options:s.customPages.types.map(n=>({value:n.type,label:n.label,key:n.type}))},key:"type",label:h("Type"),description:h("Type of the page"),defaultOperator:re.eq}]:[];return[{key:"user_id",label:h("User"),description:h("User page was created by"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}},...t,bs({description:h("Date page was created")}),vs({description:h("Date page was last updated")})]};function La(s){try{return mr(`rgb(${s.split(" ").join(",")})`).toString("hex")}catch{return s}}const Ld=A(e.jsx("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),Dd=A(e.jsx("path",{d:"M12 8c1.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"}),"MoreVertOutlined"),Ct=Q.createContext(null);function oo(s){const{size:t="md",children:n,className:a,isLazy:r,overflow:o="overflow-hidden"}=s,l=x.useRef([]),c=x.useId(),[d,m]=He(s.selectedTab,s.defaultSelectedTab||0,s.onTabChange),u=x.useMemo(()=>({selectedTab:d,setSelectedTab:m,tabsRef:l,size:t,isLazy:r,id:c}),[d,c,r,m,t]);return e.jsx(Ct.Provider,{value:u,children:e.jsx("div",{className:w(a,o,"max-w-full"),children:n})})}function Pd(){const{tabsRef:s,selectedTab:t}=x.useContext(Ct),[n,a]=x.useState({width:void 0,transform:void 0,className:void 0});return An(()=>{if(t!=null&&s.current){const r=s.current[t];if(!r)return;a(o=>({width:`${r.offsetWidth}px`,transform:`translateX(${r.offsetLeft}px)`,className:o.width===void 0?"":"transition-all"}))}},[a,t,s]),e.jsx("div",{className:w("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function io({children:s,center:t,expand:n,className:a}){const r=x.Children.toArray(s);return e.jsx(In,{children:e.jsxs("div",{className:w("flex relative max-w-full overflow-auto border-b max-sm:hidden-scrollbar md:compact-scrollbar",a),role:"tablist","aria-orientation":"horizontal",children:[r.map((o,l)=>x.isValidElement(o)?x.cloneElement(o,{index:l,className:w(o.props.className,n&&"flex-auto",t&&l===0&&"ml-auto",t&&l===r.length-1&&"mr-auto")}):null),e.jsx(Pd,{})]})})}function et({index:s,className:t,isDisabled:n,children:a,padding:r,elementType:o="button",to:l,relative:c,width:d="min-w-min"}){const{selectedTab:m,setSelectedTab:u,tabsRef:p,size:f="md",id:g}=x.useContext(Ct),j=s===m,v=Rs(),y=r||(f==="sm"?"px-12":"px-18"),b=w("tracking-wide overflow-hidden capitalize text-sm flex items-center justify-center outline-none transition-colors","focus-visible:ring focus-visible:ring-2 ring-inset rounded whitespace-nowrap cursor-pointer",d,zd({isDisabled:n,isSelected:j}),t,f==="md"&&`${y} h-48`,f==="sm"&&`${y} h-32`,n&&"pointer-events-none"),k=D=>{switch(D.key){case"ArrowLeft":v==null||v.focusPrevious();break;case"ArrowRight":v==null||v.focusNext();break;case"Home":v==null||v.focusFirst();break;case"End":v==null||v.focusLast();break}},S=j?0:-1,L=o;return e.jsx(L,{disabled:n,id:`${g}-${s}-tab`,"aria-controls":`${g}-${s}-tabpanel`,type:"button",role:"tab","aria-selected":j,tabIndex:n?void 0:S,onKeyDown:k,onClick:()=>{u(s)},to:l,relative:c,className:b,ref:D=>{p.current&&D&&(p.current[s]=D)},children:a})}function zd({isDisabled:s,isSelected:t}){return s?"text-disabled cursor-default":t?"text-primary":"text-muted hover:text-main"}function lo({children:s,className:t}){const{selectedTab:n,isLazy:a}=x.useContext(Ct),r=x.Children.toArray(s).filter(l=>!!l);let o;if(a){const l=r[n];o=x.isValidElement(l)?x.cloneElement(r[n],{index:n}):null}else o=r.map((l,c)=>{if(x.isValidElement(l)){const d=c===n;return x.cloneElement(l,{index:c,"aria-hidden":!d,className:d?l.props.className:w(l.props.className,"hidden")})}return null});return e.jsx("div",{className:t,children:o})}function st({className:s,children:t,index:n,...a}){const{id:r}=x.useContext(Ct),[o,l]=x.useState(0),c=x.useRef(null);return An(()=>{if(c!=null&&c.current){const d=()=>{const u=Pn(c.current,{tabbable:!0});l(u.nextNode()?void 0:0)};d();const m=new MutationObserver(d);return m.observe(c.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{m.disconnect()}}},[c]),e.jsx("div",{tabIndex:o,ref:c,id:`${r}-${n}-tabpanel`,"aria-labelledby":`${r}-${n}-tab`,className:w(s,"focus-visible:outline-primary-light"),role:"tabpanel",...a,children:t})}function Un({title:s,description:t,actions:n,color:a="primary",className:r}){return e.jsxs("div",{className:w(r,"p-10 rounded",a==="positive"&&"bg-positive/focus border-l-positive border-l-4",a==="warning"&&"bg-warning/focus border-l-warning border-l-4",a==="danger"&&"bg-danger/focus border-l-danger border-l-4",a==="primary"&&"bg-primary/focus border-l-primary border-l-4",a==="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}),n&&e.jsx("div",{className:"mt-14",children:n})]})}function Ad(){const[s,t]=x.useState(!1),n=x.useRef(),a=x.useCallback(r=>{var o;if(r){const l=new IntersectionObserver(([c])=>t(c.intersectionRatio<1),{threshold:[1]});n.current=l,l.observe(r)}else n.current&&((o=n.current)==null||o.disconnect())},[]);return{isSticky:s,sentinelRef:a}}var co={exports:{}};(function(s,t){(function(n,a,r){s.exports=r(),s.exports.default=r()})("slugify",wi,function(){var n=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E'","Ը":"Y'","Թ":"T'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C'","Կ":"K","Հ":"H","Ձ":"D'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P'","Ք":"Q'","Օ":"O''","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"'","’":"'","“":"\\"","”":"\\"","„":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}`),a=JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');function r(o,l){if(typeof o!="string")throw new Error("slugify: string argument expected");l=typeof l=="string"?{replacement:l}:l||{};var c=a[l.locale]||{},d=l.replacement===void 0?"-":l.replacement,m=l.trim===void 0?!0:l.trim,u=o.normalize().split("").reduce(function(p,f){var g=c[f];return g===void 0&&(g=n[f]),g===void 0&&(g=f),g===d&&(g=" "),p+g.replace(l.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return l.strict&&(u=u.replace(/[^A-Za-z0-9\s]/g,"")),m&&(u=u.trim()),u=u.replace(/\s+/g,d),l.lower&&(u=u.toLowerCase()),u}return r.extend=function(o){Object.assign(n,o)},r})})(co);var Fd=co.exports;const _d=Ni(Fd);function Md(s,t="-",n=!1){if(!s)return s;let a=_d(s,{lower:!0,replacement:t,strict:n,remove:/[*+~.()'"!:@?\|/\\]/g});return a||(a=s.replace(/\s+/g,"-").toLowerCase()),a}const uo=A(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");function Rd(s){return Y({mutationFn:t=>Ed(t),onSuccess:()=>{J(h("Created workspace")),q.invalidateQueries({queryKey:qe.fetchUserWorkspaces})},onError:t=>ye(t,s)})}function Ed(s){return O.post("workspace",s).then(t=>t.data)}function Td(){const s=ne(),{formId:t,close:n}=U(),a=Rd(s);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Create workspace"})}),e.jsx(G,{children:e.jsx(xe,{form:s,id:t,onSubmit:()=>{a.mutate(s.getValues(),{onSuccess:r=>{n(r.workspace.id)}})},children:e.jsx(E,{name:"name",autoFocus:!0,label:e.jsx(i,{message:"Workspace name"}),minLength:3,required:!0})})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:n,children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:t,disabled:a.isPending,children:e.jsx(i,{message:"Create"})})]})]})}function Vd(s){return O.get(`workspace/${s}`).then(t=>t.data)}function Od(s){return ze({queryKey:qe.workspaceWithMembers(s),queryFn:()=>Vd(s)})}const $d=A(e.jsx("path",{d:"M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5zM4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25H4.34zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12zm0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7zm7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44zM15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35z"}),"GroupOutlined");function Hd({workspaceId:s,...t}){return O.post(`workspace/${s}/invite`,t).then(n=>n.data)}function Bd(){return Y({mutationFn:s=>Hd(s),onSuccess:(s,t)=>{q.invalidateQueries({queryKey:qe.workspaceWithMembers(t.workspaceId)})},onError:s=>ke(s)})}function Ud({workspaceId:s,inviteId:t,...n}){return O.post(`workspace/${s}/${t}/resend`,n).then(a=>a.data)}function qd(){return Y({mutationFn:s=>Ud(s),onSuccess:()=>{J("Invite sent")},onError:s=>ke(s)})}const Wd=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function Kd(s){return!s||s.length>320?!1:Wd.test(s)}function Gd({workspaceId:s,member:t,...n}){const a=t.model_type,r=t.model_type==="invite"?t.id:t.member_id;return O.post(`workspace/${s}/${a}/${r}/change-role`,n).then(o=>o.data)}function Yd(){return Y({mutationFn:s=>Gd(s),onSuccess:(s,t)=>{J(h("Role changed")),q.invalidateQueries({queryKey:qe.workspaceWithMembers(t.workspaceId)})},onError:s=>ke(s)})}function Qd({workspaceId:s,memberId:t,memberType:n}){const a=n==="invite"?`workspace/invite/${t}`:`workspace/${s}/member/${t}`;return O.delete(a).then(r=>r.data)}function mo(){const{workspaceId:s,setWorkspaceId:t}=Le(),{user:n}=ie();return Y({mutationFn:a=>Qd(a),onSuccess:(a,r)=>{q.invalidateQueries({queryKey:qe.fetchUserWorkspaces}),q.invalidateQueries({queryKey:qe.workspaceWithMembers(r.workspaceId)}),r.memberId===(n==null?void 0:n.id)&&s===r.workspaceId&&t(gt.id)},onError:a=>ke(a)})}function xo({onConfirm:s,isLoading:t}){return e.jsx(ps,{isDanger:!0,title:e.jsx(i,{message:"Leave workspace"}),isLoading:t,onConfirm:s,body:e.jsxs("div",{children:[e.jsx(i,{message:"Are you sure you want to leave this workspace?"}),e.jsx("div",{className:"mt-8 font-semibold",children:e.jsx(i,{message:"All resources you've created in the workspace will be transferred to workspace owner."})})]}),confirm:e.jsx(i,{message:"Leave"})})}function Zd({workspace:s}){const{data:t,isLoading:n}=Od(s.id);return e.jsxs(K,{size:"lg",children:[e.jsx(Z,{children:e.jsx(i,{message:"Manage workspace members"})}),e.jsx(G,{children:n?e.jsx("div",{className:"flex items-center justify-center min-h-[238px]",children:e.jsx(ht,{isIndeterminate:!0,"aria-label":"Loading workspace..."})}):e.jsx(Jd,{workspace:t.workspace})})]})}function Jd({workspace:s}){const t=qn(s),n=[...s.members||[],...s.invites||[]];return e.jsxs("div",{children:[t.invite&&e.jsx(su,{workspace:s}),e.jsxs("div",{className:"flex items-center gap-10 mb-14 text-base",children:[e.jsx($d,{className:"icon-sm"}),e.jsx(i,{message:"Members of `:workspace`",values:{workspace:s.name}})]}),e.jsx(Se,{initial:!1,children:n.map(a=>e.jsx(Xd,{workspace:s,member:a},`${a.model_type}.${a.id}`))})]})}function Xd({workspace:s,member:t}){return e.jsxs(fe.div,{initial:{x:"-100%",opacity:0},animate:{x:0,opacity:1},exit:{x:"100%",opacity:0},transition:{type:"tween",duration:.125},className:"flex items-start text-sm gap-14 mb-20",children:[e.jsx("img",{className:"w-36 h-36 rounded flex-shrink-0",src:t.avatar,alt:""}),e.jsxs("div",{className:"md:flex flex-auto items-center justify-between gap-14 min-w-0",children:[e.jsxs("div",{className:"overflow-hidden mb-10 md:mb-0 md:mr-10",children:[e.jsxs("div",{className:"flex items-center justify-start gap-6",children:[e.jsx("div",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:t.display_name}),e.jsx(au,{workspace:s,member:t})]}),e.jsx("div",{className:"text-muted",children:t.email})]}),e.jsx(eu,{workspace:s,member:t})]})]},`${t.model_type}.${t.id}`)}function qn(s){var o;const{user:t}=ie(),n={update:!1,invite:!1,delete:!1},a=["update","invite","delete"],r=(o=s.members)==null?void 0:o.find(l=>l.id===(t==null?void 0:t.id));return r&&a.forEach(l=>{var c;n[l]=r.is_owner||!!((c=r.permissions)!=null&&c.find(d=>d.name===`workspace_members.${l}`))}),n}function eu({workspace:s,member:t}){const[n,a]=x.useState(t.role_id),r=Yd(),{user:o}=ie(),l=qn(s),c=t.model_type==="member"&&t.is_owner,d=t.model_type==="member"&&(o==null?void 0:o.id)===t.id,m=!l.update||c||d?e.jsx("div",{className:"text-muted ml-auto first:capitalize",children:e.jsx(i,{message:t.role_name})}):e.jsx(ho,{className:"ml-auto flex-shrink-0",size:"xs",value:n,isDisabled:r.isPending,onChange:u=>{a(u),r.mutate({roleId:u,workspaceId:s.id,member:t})}});return e.jsxs(e.Fragment,{children:[m,!c&&(d||l.delete)&&e.jsx(tu,{type:d?"leave":"remove",member:t,workspace:s})]})}function su({workspace:s}){const{trans:t}=$(),[n,a]=x.useState([]),r=n.every(u=>!u.invalid),o=u=>u.description||u.name,[l,c]=x.useState(),d=Bd(),{data:m}=Wt(["workspaceRoles"]);return x.useEffect(()=>{var u;!l&&((u=m==null?void 0:m.workspaceRoles)!=null&&u.length)&&c(m.workspaceRoles[0].id)},[m,l]),e.jsxs("div",{className:"mb-30",children:[e.jsx(Ur,{value:n,onChange:a,displayWith:o,validateWith:u=>{const p=!Kd(u.description);return{...u,invalid:p,errorMessage:p?t({message:"Not a valid email"}):void 0}},placeholder:t({message:"Enter email addresses"}),label:e.jsx(i,{message:"Invite people"})}),e.jsxs("div",{className:"flex items-center gap-14 justify-between mt-14",children:[e.jsx(ho,{onChange:c,value:l}),n.length&&l?e.jsx(N,{variant:"flat",color:"primary",size:"sm",disabled:d.isPending||!r,onClick:()=>{d.mutate({emails:n.map(u=>o(u)),roleId:l,workspaceId:s.id},{onSuccess:()=>{a([])}})},children:e.jsx(i,{message:"Invite"})}):null]})]})}function tu({member:s,workspace:t,type:n}){const a=mo(),{close:r}=U();return e.jsxs(V,{type:"modal",onClose:o=>{o&&(a.mutate({workspaceId:t.id,memberId:s.id,memberType:s.model_type}),n==="leave"&&(r(),J(h("Left workspace"))))},children:[e.jsx(P,{size:"md",className:"text-muted flex-shrink-0",disabled:a.isPending,children:n==="leave"?e.jsx(hr,{}):e.jsx(Ue,{})}),n==="leave"?e.jsx(xo,{}):e.jsx(nu,{member:s})]})}function nu({member:s}){return e.jsx(ps,{isDanger:!0,title:e.jsx(i,{message:"Remove member"}),body:e.jsxs("div",{children:[e.jsx(i,{message:"Are you sure you want to remove `:name`?",values:{name:s.display_name}}),e.jsx("div",{className:"font-semibold mt-8",children:e.jsx(i,{message:"All workspace resources created by `:name` will be transferred to workspace owner.",values:{name:s.display_name}})})]}),confirm:e.jsx(i,{message:"Remove"})})}function ho({value:s,onChange:t,size:n="xs",className:a,isDisabled:r}){var c;const{data:o}=Wt(["workspaceRoles"]),l=(c=o==null?void 0:o.workspaceRoles)==null?void 0:c.find(d=>d.id===s);return!s||!l||!(o!=null&&o.workspaceRoles)?null:e.jsxs(is,{selectionMode:"single",selectedValue:s,onSelectionChange:d=>{t(d)},children:[e.jsx(N,{className:a,size:n,variant:"flat",color:"chip",disabled:r,endIcon:e.jsx(dr,{}),children:e.jsx(i,{message:l.name})}),e.jsx(ls,{children:o.workspaceRoles.map(d=>e.jsx(I,{value:d.id,description:d.description,children:e.jsx(i,{message:d.name})},d.id))})]})}function au({member:s,workspace:t}){const{user:n}=ie(),a=qn(t);return(n==null?void 0:n.id)===s.id?e.jsxs("div",{className:"font-medium",children:["(",e.jsx(i,{message:"You"}),")"]}):s.model_type==="invite"?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{children:"·"}),e.jsx("div",{className:"font-medium",children:e.jsx(i,{message:"Invited"})}),a.invite?e.jsxs(e.Fragment,{children:[e.jsx("div",{children:"·"}),e.jsx(ru,{member:s,workspace:t})]}):null]}):null}function ru({member:s,workspace:t}){const n=qd();return e.jsxs(V,{type:"modal",onClose:a=>{a&&n.mutate({workspaceId:t.id,inviteId:s.id})},children:[e.jsx(N,{variant:"link",size:"sm",color:"primary",disabled:n.isPending,children:e.jsx(i,{message:"Resend invite"})}),e.jsx(ps,{title:e.jsx(i,{message:"Resend invite"}),body:e.jsx(i,{message:"Are you sure you want to send this invite again?"}),confirm:e.jsx(i,{message:"Send"})})]})}const ou=A(e.jsx("path",{d:"M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 8c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4zm-6 4c.22-.72 3.31-2 6-2 2.7 0 5.8 1.29 6 2H9zm-3-3v-3h3v-2H6V7H4v3H1v2h3v3z"}),"PersonAddOutlined");function iu({id:s,...t}){return O.put(`workspace/${s}`,t).then(n=>n.data)}function lu(s){const{close:t}=U();return Y({mutationFn:n=>iu(n),onSuccess:n=>{t(),J(h("Updated workspace")),q.invalidateQueries({queryKey:qe.fetchUserWorkspaces}),q.invalidateQueries({queryKey:qe.workspaceWithMembers(n.workspace.id)})},onError:n=>ye(n,s)})}function cu({workspace:s}){const t=ne({defaultValues:{id:s.id,name:s.name}}),{formId:n,close:a}=U(),r=lu(t);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Rename workspace"})}),e.jsx(G,{children:e.jsx(xe,{form:t,id:n,onSubmit:()=>{r.mutate(t.getValues())},children:e.jsx(E,{name:"name",autoFocus:!0,label:e.jsx(i,{message:"Name"}),minLength:3,required:!0})})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:a,children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:n,disabled:r.isPending,children:e.jsx(i,{message:"Rename"})})]})]})}function du({id:s}){return O.delete(`workspace/${s}`).then(t=>t.data)}function uu(){const{workspaceId:s,setWorkspaceId:t}=Le();return Y({mutationFn:n=>du(n),onSuccess:(n,a)=>{J(h("Deleted workspace")),q.invalidateQueries({queryKey:qe.fetchUserWorkspaces}),q.invalidateQueries({queryKey:qe.workspaceWithMembers(a.id)}),s===a.id&&t(gt.id)},onError:n=>ke(n)})}function fo({onChange:s,className:t,trigger:n}){const{data:a,isFetched:r,isFetching:o}=Ci(),{workspaceId:l,setWorkspaceId:c}=Le(),d=a==null?void 0:a.find(j=>j.id===l),[m,u]=x.useState(!1),{hasPermission:p}=ie();if(x.useEffect(()=>{r&&!o&&!d&&c(gt.id)},[d,a,c,r,o]),!d||!p("workspaces.create")&&(a==null?void 0:a.length)===1)return null;const f=e.jsxs(Vs,{className:w("flex items-center gap-10 rounded ring-inset hover:bg-hover focus-visible:ring-2",t),children:[e.jsxs("span",{className:"mr-auto block flex-auto overflow-hidden text-left",children:[e.jsx("span",{className:"block overflow-hidden overflow-ellipsis text-sm font-medium text-main",children:d.default?e.jsx(i,{message:d.name}):d.name}),e.jsx("span",{className:"block text-xs text-muted",children:d.default?e.jsx(i,{message:"Personal workspace"}):e.jsx(i,{message:":count members",values:{count:d.members_count}})})]}),e.jsx(uo,{className:"shrink-0 icon-md"})]}),g=n||f;return e.jsx(x.Fragment,{children:e.jsxs(V,{type:"popover",isOpen:m,onClose:()=>{u(!1)},children:[x.cloneElement(g,{onClick:()=>u(!m)}),e.jsx(K,{size:"min-w-320",children:e.jsxs(G,{padding:"p-10",children:[e.jsx("div",{className:"mb-16 border-b pb-10",children:a==null?void 0:a.map(j=>e.jsx(mu,{workspace:j,setSelectorIsOpen:u,onChange:s},j.id))}),e.jsx("div",{className:"mb-4 px-4 text-center",children:e.jsx(N,{onClick:async j=>{j.preventDefault(),j.stopPropagation(),u(!1);const v=await $e(Td);v&&(c(v),s==null||s(v))},variant:"outline",startIcon:e.jsx(lt,{}),color:"primary",className:"h-40 w-full",children:e.jsx(i,{message:"Create new workspace"})})})]})})]})})}function mu({workspace:s,onChange:t,setSelectorIsOpen:n}){const{workspaceId:a,setWorkspaceId:r}=Le(),o=a===s.id;return e.jsxs("div",{onClick:()=>{r(s.id),t==null||t(s.id),n(!1)},className:w("mb-4 flex cursor-pointer items-center gap-12 rounded-lg p-10 text-left",o&&"bg-primary/5",!o&&"hover:bg-hover"),children:[e.jsx(_s,{size:"sm",className:w("flex-shrink-0 text-primary",!o&&"invisible")}),e.jsxs("div",{className:"flex-auto",children:[e.jsx("div",{className:w("text-sm",o&&"font-semibold"),children:s.name}),e.jsx("div",{className:"text-sm text-muted",children:s.default?e.jsx(i,{message:"Personal workspace"}):e.jsx(i,{message:":count members",values:{count:s.members_count}})})]}),s.id!==0&&e.jsx(fu,{setSelectorIsOpen:n,workspace:s,onChange:t})]})}function xu({workspace:s,onChange:t}){const n=mo(),{user:a}=ie(),{close:r}=U();return e.jsx(xo,{isLoading:n.isPending,onConfirm:()=>{n.mutate({workspaceId:s.id,memberId:a.id,memberType:"member"},{onSuccess:()=>{r(),t==null||t(gt.id)}})}})}function hu({workspace:s,onChange:t}){const n=uu(),{close:a}=U();return e.jsx(ps,{isDanger:!0,title:e.jsx(i,{message:"Delete workspace"}),body:e.jsx(i,{message:"Are you sure you want to delete “:name“?",values:{name:s.name}}),confirm:e.jsx(i,{message:"Delete"}),isLoading:n.isPending,onConfirm:()=>{n.mutate({id:s.id},{onSuccess:()=>{a(),t==null||t(gt.id)}})}})}function fu({setSelectorIsOpen:s,workspace:t,onChange:n}){const{user:a}=ie();return e.jsxs(is,{onItemSelected:()=>s(!1),children:[e.jsx(N,{onClick:r=>{r.preventDefault(),r.stopPropagation()},color:"primary",size:"xs",variant:"outline",endIcon:e.jsx(Ts,{}),children:e.jsx(i,{message:"Manage"})}),e.jsxs(ls,{children:[e.jsx(I,{onClick:r=>{r.stopPropagation(),$e(Zd,{workspace:t})},value:"workspaceMembers",startIcon:e.jsx(ou,{}),children:e.jsx(i,{message:"Members"})}),t.owner_id===(a==null?void 0:a.id)&&e.jsx(I,{onClick:r=>{r.stopPropagation(),$e(cu,{workspace:t})},value:"updateWorkspace",startIcon:e.jsx(Ke,{}),children:e.jsx(i,{message:"Rename"})}),t.owner_id!==(a==null?void 0:a.id)&&e.jsx(I,{onClick:r=>{r.stopPropagation(),$e(xu,{workspace:t,onChange:n})},value:"leaveWorkspace",startIcon:e.jsx(hr,{}),children:e.jsx(i,{message:"Leave"})}),t.owner_id===(a==null?void 0:a.id)&&e.jsx(I,{onClick:r=>{r.stopPropagation(),$e(hu,{workspace:t,onChange:n})},value:"deleteWorkspace",startIcon:e.jsx(dd,{}),children:e.jsx(i,{message:"Delete"})})]})]})}const po="link/usage";function St(){return ze({queryKey:[po],queryFn:()=>pu()})}function pu(){return O.get(po).then(s=>s.data)}function gu(s){return e.jsx(Si,{...s,role:"meter progressbar"})}const ju=A(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"),go={links:h("Links"),biolinks:h("Biolinks"),link_clicks:h("Visitors"),link_overlays:h("Link overlays"),custom_pages:h("Custom link pages"),custom_domains:h("Custom domains"),link_groups:h("Link groups"),tracking_pixels:h("Tracking pixels")};function bu(){const{data:s}=St();if(!s)return null;const t=e.jsx(i,{message:"Unlimited"});return e.jsx("ul",{children:Object.entries(go).map(([n,a])=>{const r=s==null?void 0:s.usage[n];if(!r)return null;const o=e.jsx(i,{...a});return e.jsx("li",{className:"mt-8",children:r.total?e.jsx(i,{message:":used out of :total :name",values:{used:e.jsx(Be,{value:r.used}),total:r.total?e.jsx(Be,{value:r.total}):t,name:o}}):e.jsx(i,{message:":count :name created",values:{count:r.used,name:o}})},n)})})}function jo({className:s}){var o,l;const{user:t}=ie(),n=(o=t==null?void 0:t.subscriptions)==null?void 0:o[0],a=(l=n==null?void 0:n.product)==null?void 0:l.name,r=n!=null&&n.renews_at?e.jsx(Je,{date:n.renews_at}):null;return e.jsxs(V,{type:"popover",triggerOnHover:!0,children:[e.jsx(P,{size:"md",className:s,children:e.jsx(ju,{})}),e.jsx(K,{size:"auto",children:e.jsxs(G,{children:[e.jsxs("div",{className:"border-b pb-10 mb-10",children:[e.jsx("div",{className:"font-semibold",children:e.jsx(i,{message:"Current plan: :planName",values:{planName:a||e.jsx(i,{message:"Free"})}})}),e.jsx("div",{className:"text-muted text-xs",children:e.jsx(i,{message:"Next payment: :date",values:{date:r||e.jsx(i,{message:"Never"})}})})]}),e.jsx(bu,{})]})})]})}function vu(){const{isLoading:s,data:t}=St(),n=t==null?void 0:t.usage.links;if(!n)return e.jsx("div",{className:"h-[53px] pt-24 mt-24 border-t"});const a=e.jsx("span",{className:w("whitespace-nowrap",s&&"invisible"),children:n.total?e.jsx(i,{message:":used of :available links created",values:{used:e.jsx(Be,{value:n.used}),available:e.jsx(Be,{value:n.total})}}):e.jsx(i,{message:":count links created",values:{count:n.used}})});return e.jsxs("div",{className:"border-t items-start gap-8 flex pl-6 pt-24 mt-24",children:[e.jsx(jo,{className:"-mt-14"}),e.jsx(gu,{className:"flex-auto max-w-144",size:"xs",value:n.total&&n.used?n.used/n.total*100:0,label:a,showValueLabel:!1,labelPosition:"bottom"})]})}function bo(s){const{isSubscribed:t}=ie();return e.jsx(N,{elementType:ge,to:t?"/billing/change-plan":"/pricing",variant:"outline",color:"primary",size:"xs",...s,children:e.jsx(i,{message:"Upgrade"})})}function yu({className:s,isCompactMode:t}){const{billing:n}=me();return e.jsxs("div",{className:w("text-sm pt-26 text-muted font-medium bg-alt flex flex-col gap-20 border-r overflow-y-auto relative",s),children:[e.jsxs("div",{className:"flex-auto px-12",children:[e.jsx(Ii,{matchDescendants:a=>a==="/dashboard",menu:"dashboard-sidebar",orientation:"vertical",onlyShowIcons:t,gap:"gap-8",itemClassName:({isActive:a})=>w("block w-full rounded py-12 px-16 border-l-4",a?"bg-primary/hover border-l-primary":"border-l-transparent hover:bg-hover")}),!t&&e.jsx(vu,{}),n.enable&&!t&&e.jsx("div",{className:"mt-14 pl-60",children:e.jsx(bo,{})})]}),!t&&e.jsx(fo,{className:"w-full px-24 py-18 border-t flex-shrink-0 mt-auto"}),t&&e.jsx(jo,{className:"flex-shrink-0 mx-auto mb-10"})]})}function ku(){const{links:{dash_footer:s}}=me();return e.jsxs(rl,{name:"belink-dashboard",leftSidenavCanBeCompact:!0,children:[e.jsx(wu,{}),e.jsx(il,{position:"left",children:e.jsx(yu,{})}),e.jsx(ol,{children:e.jsxs("div",{className:"bg dark:bg-alt",children:[e.jsx(Li,{slot:"dashboard",className:"mb-20 mt-50"}),e.jsx(Di,{}),s&&e.jsx(Pi,{padding:"px-16 md:px-28 pt-24 pb-28 md:pb-24"})]})})]})}function wu(s){var o;const{billing:t}=me(),{leftSidenavStatus:n}=x.useContext(Qt),{selectedTheme:a}=fr(),r=((o=a.values)==null?void 0:o["--be-navbar-color"])==="bg"?"primary":"paper";return e.jsx(dl,{...s,size:"sm",menuPosition:"dashboard-navbar",rightChildren:n==="compact"&&t.enable&&e.jsx(bo,{variant:"flat",color:r}),children:n==="compact"&&e.jsx(fo,{trigger:e.jsx(N,{variant:"text",endIcon:e.jsx(Ts,{}),children:e.jsx(i,{message:"Workspaces"})})})})}const Nu={month:"short",day:"2-digit"};function Cu({value:s,onChange:t,disabled:n,compactOnMobile:a=!0,enableCompare:r=!1,granularity:o="minute"}){const l=ve();return e.jsxs(V,{type:"popover",onClose:c=>{c&&t(c)},children:[e.jsx(N,{variant:"outline",color:"chip",endIcon:e.jsx(En,{}),disabled:n,children:e.jsx(Vn,{start:s.start,end:s.end,options:l&&a?Nu:rr.short})}),e.jsx(Su,{value:s,enableCompare:r,granularity:o})]})}function Su({value:s,enableCompare:t,granularity:n}){const a=ve(),r=jn({granularity:n,defaultValue:{start:s.start,end:s.end,preset:s.preset},closeDialogOnSelection:!1}),o=!!s.compareStart&&!!s.compareEnd,l=jn({granularity:n,defaultValue:o?{start:s.compareStart,end:s.compareEnd,preset:s.comparePreset}:zr[0].getRangeValue(r.selectedValue)});return e.jsx(Ar,{state:r,compareState:t?l:void 0,compareVisibleDefault:o,showInlineDatePickerField:!a})}function Wn(s){const{title:t,description:n,children:a,className:r,contentIsFlex:o=!0,contentClassName:l,contentRef:c,minHeight:d="min-h-440"}=s;return e.jsxs("div",{className:w("rounded-panel flex h-full flex-auto flex-col border bg",d,r),children:[e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between p-14 text-xs",children:[e.jsx("div",{className:"text-sm font-semibold",children:t}),n&&e.jsx("div",{className:"text-muted",children:n})]}),e.jsx("div",{ref:c,className:w("relative p-14",o&&"flex flex-auto items-center justify-center",l),children:a})]})}function Et(){return e.jsxs("div",{className:"flex items-center gap-10 text-sm absolute mx-auto",children:[e.jsx(ht,{isIndeterminate:!0,size:"sm"}),e.jsx(i,{message:"Chart loading"})]})}const Iu=x.lazy(()=>pt(()=>import("./lazy-chart-ae0f1bcd.js"),["./lazy-chart-ae0f1bcd.js","./main-96065a7f.js","./main-54a4a887.css"],import.meta.url));function Kn(s){const{title:t,description:n,className:a,contentRef:r,isLoading:o}=s;return e.jsx(Wn,{title:t,description:n,className:a,contentRef:r,children:e.jsxs(x.Suspense,{fallback:e.jsx(Et,{}),children:[e.jsx(Iu,{...s}),o&&e.jsx(Et,{})]})})}function Gn(s,{localeCode:t="en",shareFirstDatasetLabels:n=!0}){if(!s)return{datasets:[]};const a=[];return{...s,datasets:s.datasets.map((r,o)=>{const l=r.data.map((c,d)=>{let m;return o===0||!n?(m=Lu(c,s.granularity,t),a[d]=m):m=a[d],{...m,value:c.value}});return{...r,data:l}})}}function Lu(s,t,n){return s.label?{label:s.label}:s.date?Du(s,t,n):{label:""}}function Du({date:s,endDate:t},n="day",a){const r=Fs(s).toDate(),o=t?Fs(t).toDate():null;switch(n){case"minute":return{label:Pe(a,{second:"2-digit"}).format(r),tooltipTitle:Pe(a,{day:"2-digit",hour:"numeric",minute:"numeric",second:"2-digit"}).format(r)};case"hour":return{label:Pe(a,{hour:"numeric",minute:"numeric"}).format(r),tooltipTitle:Pe(a,{month:"short",day:"2-digit",hour:"numeric",minute:"numeric"}).format(r)};case"day":return{label:Pe(a,{day:"2-digit",weekday:"short"}).format(r),tooltipTitle:Pe(a,{day:"2-digit",weekday:"short",month:"short"}).format(r)};case"week":return{label:Pe(a,{month:"short",day:"2-digit"}).format(r),tooltipTitle:Pe(a,{day:"2-digit",month:"long",year:"numeric"}).formatRange(r,o)};case"month":return{label:Pe(a,{month:"short",year:"numeric"}).format(r),tooltipTitle:Pe(a,{month:"long",year:"numeric"}).format(r)};case"year":return{label:Pe(a,{year:"numeric"}).format(r),tooltipTitle:Pe(a,{year:"numeric"}).format(r)}}}const Pe=zi((s,t)=>new Ai(s,t),{equals:(s,t)=>or(s,t),callTimeout:void 0}),Da=tt().themes.all[0].values["--be-primary"],Ze=[[`rgb(${Da.replaceAll(" ",",")})`,`rgba(${Da.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)"]],Pu={parsing:{xAxisKey:"label",yAxisKey:"value"},datasets:{line:{fill:"origin",tension:.1,pointBorderWidth:4,pointHitRadius:10}},plugins:{tooltip:{intersect:!1,mode:"index"}}};function zu({data:s,className:t,...n}){const{localeCode:a}=rs(),r=x.useMemo(()=>{const o=Gn(s,{localeCode:a});return o.datasets=o.datasets.map((l,c)=>({...l,backgroundColor:Ze[c][1],borderColor:Ze[c][0],pointBackgroundColor:Ze[c][0]})),o},[s,a]);return e.jsx(Kn,{...n,className:w(t,"min-w-500"),data:r,type:"line",options:Pu})}const Au={parsing:{key:"value"},plugins:{tooltip:{intersect:!0}}};function Pa({data:s,className:t,...n}){const{localeCode:a}=rs(),r=x.useMemo(()=>{var l;const o=Gn(s,{localeCode:a});return o.labels=(l=o.datasets[0])==null?void 0:l.data.map(c=>c.label),o.datasets=o.datasets.map((c,d)=>({...c,backgroundColor:Ze.map(m=>m[1]),borderColor:Ze.map(m=>m[0]),borderWidth:2})),o},[s,a]);return e.jsx(Kn,{type:"polarArea",data:r,options:Au,className:w(t,"min-w-500"),...n})}function Fu({data:s,isLoading:t,...n}){const a=(s==null?void 0:s.datasets[0].data)||[];return e.jsxs(Wn,{...n,className:"w-1/2 min-w-500 md:min-w-0",title:e.jsx(i,{message:"Referrers"}),contentIsFlex:t,contentClassName:"max-h-[370px] overflow-y-auto",children:[t&&e.jsx(Et,{}),a.map((r,o)=>e.jsxs("div",{className:"mb-20 flex items-center justify-between gap-24 text-sm",children:[r.label?e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(ns,{url:r.label}),e.jsx("a",{className:w(Os,"overflow-hidden overflow-ellipsis whitespace-nowrap lowercase"),href:r.label,target:"_blank",rel:"noreferrer",children:Xe(r.label)})]}):e.jsx(i,{message:"Direct, Email, SMS"}),e.jsx(Bt,{radius:"rounded",size:"xs",color:"primary",className:"font-semibold",children:r.value})]},r.label||o))]})}const za="https://www.gstatic.com/charts/loader.js";function _u({placeholderRef:s,data:t,country:n,onCountrySelected:a}){const{trans:r}=$(),{analytics:o}=me(),l=o==null?void 0:o.gchart_api_key,{selectedTheme:c}=fr(),d=x.useRef(),m=!!a&&!n,u=x.useCallback(()=>{var y,b;if(typeof google>"u")return;const f=t.map(k=>[k.label,k.value]);f.unshift([r(n?h("City"):h("Country")),r(h("Clicks"))]);const g=`${La(c.values["--be-paper"])}`,v={colorAxis:{colors:[`${La(c.values["--be-primary"])}`]},backgroundColor:g,region:n?n.toUpperCase():void 0,resolution:n?"provinces":"countries",displayMode:n?"markers":"regions",enableRegionInteractivity:m};!d.current&&s.current&&((y=google==null?void 0:google.visualization)!=null&&y.GeoChart)&&(d.current=new google.visualization.GeoChart(s.current)),(b=d.current)==null||b.draw(google.visualization.arrayToDataTable(f),v)},[c,t,s,r,n,m]),p=x.useCallback(async()=>{ha.isLoadingOrLoaded(za)||(await ha.loadAsset(za,{type:"js",id:"google-charts-js"}),await google.charts.load("current",{packages:["geochart"],mapsApiKey:l}),u())},[l,u]);return x.useEffect(()=>(d.current&&a&&google.visualization.events.addListener(d.current,"regionClick",f=>a==null?void 0:a(f.region)),()=>{d.current&&google.visualization.events.removeAllListeners(d.current)}),[a,d.current]),x.useEffect(()=>{p()},[p]),x.useEffect(()=>{u()},[c,u,t]),{drawGoogleChart:u}}const vo=A(e.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBackOutlined"),Mu=A(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 Cs({title:s,body:t,dialogSize:n="sm",className:a}){return e.jsxs(V,{type:"popover",triggerOnHover:!0,children:[e.jsx(P,{className:w("text-muted opacity-70",a),size:"xs",children:e.jsx(Mu,{viewBox:"0 0 16 16"})}),e.jsxs(K,{size:n,children:[s&&e.jsx(Z,{padding:"px-18 pt-12",size:"md",hideDismissButton:!0,children:s}),e.jsx(G,{children:t})]})]})}const Ru=x.memo(({code:s})=>{const{localeCode:t}=rs(),n=new Intl.DisplayNames([t],{type:"region"});let a;try{a=n.of(s.toUpperCase())}catch{}return e.jsx(x.Fragment,{children:a})});function Eu({data:s,isLoading:t,onCountrySelected:n,country:a,...r}){const o=x.useRef(null),l=!!n,c=s==null?void 0:s.datasets[0].data,d=x.useMemo(()=>c||[],[c]);return _u({placeholderRef:o,data:d,country:a,onCountrySelected:n}),e.jsxs(Wn,{...r,className:"min-w-500",title:e.jsxs("div",{className:"flex items-center",children:[e.jsx(i,{message:"Top Locations"}),a?e.jsxs("span",{className:"pl-4",children:["(",e.jsx(Ru,{code:a}),")"]}):null,l&&e.jsx(Tu,{})]}),contentIsFlex:t,children:[t&&e.jsx(Et,{}),e.jsxs("div",{className:"flex gap-24",children:[e.jsx("div",{ref:o,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:d.map(m=>e.jsxs("div",{className:w("flex items-center gap-4 mb-4",l&&"cursor-pointer hover:underline"),role:l?"button":void 0,onClick:()=>{n==null||n(m.code)},children:[e.jsx("div",{className:"max-w-110 whitespace-nowrap overflow-hidden overflow-ellipsis",children:m.label}),e.jsxs("div",{children:["(",m.percentage,")%"]})]},m.label))}),a&&e.jsx(N,{variant:"outline",size:"xs",className:"mt-14",startIcon:e.jsx(vo,{}),onClick:()=>{n==null||n(void 0)},children:e.jsx(i,{message:"Back to countries"})})]})]})]})}function Tu(){return e.jsx(Cs,{title:e.jsx(i,{message:"Zooming in"}),body:e.jsx(i,{message:"Click on a country inside the map or country list to zoom in and see city data for that country."})})}function Vu({data:s,direction:t="vertical",individualBarColors:n=!1,className:a,...r}){const{localeCode:o}=rs(),l=x.useMemo(()=>{const m=Gn(s,{localeCode:o});return m.datasets=m.datasets.map((u,p)=>({...u,backgroundColor:n?Ze.map(f=>f[1]):Ze[p][1],borderColor:n?Ze.map(f=>f[0]):Ze[p][0],borderWidth:2})),m},[s,o,n]),c=t==="horizontal",d=x.useMemo(()=>({indexAxis:c?"y":"x",parsing:{xAxisKey:c?"value":"label",yAxisKey:c?"label":"value"}}),[c]);return e.jsx(Kn,{type:"bar",className:w(a,"min-w-500"),data:l,options:d,...r})}const Aa="reports/clicks";function Ou(s,t){return ze({queryKey:[Aa,s],queryFn:()=>$u(Aa,s),placeholderData:Dn,enabled:t.isEnabled})}function $u(s,t){var a;const n={model:t.model,metrics:(a=t.metrics)==null?void 0:a.join(","),country:t.country};return n.startDate=t.dateRange.start.toAbsoluteString(),n.endDate=t.dateRange.end.toAbsoluteString(),n.timezone=t.dateRange.start.timeZone,O.get(s,{params:n}).then(r=>r.data)}function Hu({dateRange:s,model:t}){const a="flex flex-col lg:flex-row lg:items-center overflow-x-auto gap-12 md:gap-24 mb-12 md:mb-24";return e.jsxs(x.Fragment,{children:[e.jsxs("div",{className:a,children:[e.jsx(Ps,{metric:"clicks",model:t,dateRange:s,children:({data:r})=>e.jsx(zu,{className:"flex-auto",title:e.jsx(i,{message:"Click count"}),hideLegend:!0,description:e.jsx(i,{message:":count total clicks",values:{count:e.jsx(Be,{value:(r==null?void 0:r.report.clicks.total)||0})}})})}),e.jsx(Ps,{metric:"devices",model:t,dateRange:s,children:e.jsx(Pa,{title:e.jsx(i,{message:"Top devices"}),className:"max-w-500"})})]}),e.jsxs("div",{className:a,children:[e.jsx(Ps,{metric:"referrers",model:t,dateRange:s,children:e.jsx(Fu,{})}),e.jsx(Bu,{dateRange:s,model:t})]}),e.jsxs("div",{className:a,children:[e.jsx(Ps,{metric:"browsers",model:t,dateRange:s,children:e.jsx(Vu,{className:"max-w-500",direction:"horizontal",individualBarColors:!0,hideLegend:!0,title:e.jsx(i,{message:"Top browsers"})})}),e.jsx(Ps,{metric:"platforms",model:t,dateRange:s,children:e.jsx(Pa,{className:"max-w-500",title:e.jsx(i,{message:"Top platforms"})})})]})]})}function Bu({model:s,dateRange:t}){const[n,a]=Ln(),r=n.get("country")||void 0,o=x.useCallback(l=>{a(c=>(l?c.set("country",l):c.delete("country"),c))},[a]);return e.jsx(Ps,{metric:r?"cities":"countries",model:s,dateRange:t,country:r,children:e.jsx(Eu,{onCountrySelected:o,country:r,className:"flex-auto w-1/2 lg:max-w-[740px]"})})}function Ps({children:s,metric:t,model:n,dateRange:a}){var p,f;const[r,o]=x.useState(!1),[l]=Ln(),c=Ou({metrics:[t],model:n,dateRange:a,country:l.get("country")},{isEnabled:r}),d=typeof s=="function"?s(c):s,m=x.useRef(),u=x.useCallback(g=>{var j;if(g){const v=new IntersectionObserver(([y])=>{var b;y.isIntersecting&&(o(!0),(b=m.current)==null||b.disconnect(),m.current=void 0)},{threshold:.1});m.current=v,v.observe(g)}else m.current&&((j=m.current)==null||j.disconnect())},[]);return x.cloneElement(d,{data:(f=(p=c.data)==null?void 0:p.report)==null?void 0:f[t],isLoading:c.isLoading,contentRef:u})}function tn({model:s,title:t,actions:n}){const[a,r]=x.useState(()=>Zt[2].getRangeValue());return e.jsxs("div",{className:"min-h-full gap-12 md:gap-24 p-12 md:p-24",children:[e.jsx(Fn,{children:e.jsx(i,{message:"Clicks report"})}),e.jsxs("div",{className:"md:flex items-center justify-between gap-24 mb-24",children:[t,e.jsxs("div",{className:"flex-shrink-0 flex items-center md:justify-end mt-10 md:mt-0 gap-12",children:[n,e.jsx("div",{className:"text-sm font-semibold",children:e.jsx(Cu,{value:a,onChange:r,compactOnMobile:!1})})]})]}),e.jsx(Hu,{dateRange:a,model:s})]})}function Uu(){const{workspaceId:s}=Le(),{user:t}=ie(),n=s&&s>0?`workspace=${s}`:`user=${t==null?void 0:t.id}`;return e.jsx(tn,{model:n,title:e.jsx("h1",{className:"text-3xl font-light",children:e.jsx(i,{message:"Clicks report"})})})}const wn=[{key:"type",label:h("Type"),description:h("Type of the link"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Direct"),value:"direct"},{key:"02",label:h("Overlay"),value:"overlay"},{key:"03",label:h("Frame"),value:"frame"},{key:"04",label:h("Custom page"),value:"link_page"}]}},{key:"active",label:h("Status"),description:h("Whether link is disabled or not"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Enabled"),value:!0},{key:"02",label:h("Disabled"),value:!1}]}},{key:"password",label:h("Password"),description:h("Whether link is password protected"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Has a password"),value:{value:null,operator:re.ne}},{key:"02",label:h("Does not have a password"),value:{value:null,operator:re.eq}}]}},{key:"clicks_count",label:h("Click count"),description:h("Total number of clicks for link"),defaultOperator:re.gte,operators:_t,control:{type:H.Input,inputType:"number",defaultValue:1}},Mt({key:"clicked_at",label:h("Clicked at"),description:h("Date link was last clicked")}),Mt({key:"expires_at",label:h("Expires at"),description:h("Date link will expire")}),bs({description:h("Date link was created")}),vs({description:h("Date link was last updated")}),{key:"user_id",label:h("User"),description:h("User link was created by"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}],yo=["countries","domains","pages","overlays","pixels","groups"];function Ss(){const{user:s}=ie();return Wt(yo,{userId:s==null?void 0:s.id,pageType:"link_page"})}function nn(){var s;Fi(yo,{userId:(s=tt().user)==null?void 0:s.id,pageType:"link_page"})}function qu(){var o,l,c;const{branding:{site_name:s}}=me(),{data:t}=Ss(),{watch:n,setValue:a}=os(),r=n("type");return e.jsxs("div",{className:"flex items-center gap-12",children:[e.jsxs(Ne,{className:"mb-24 flex-auto",name:"type",label:e.jsx(i,{message:"Type"}),selectionMode:"single",onSelectionChange:()=>{a("type_id",null)},children:[e.jsx(I,{value:"direct",description:e.jsx(i,{message:"Redirect user to url instantly"}),children:e.jsx(i,{message:"Direct"})}),e.jsx(I,{value:"frame",description:e.jsx(i,{message:" Show url inside iframe with :siteName navigation bar.",values:{siteName:s}}),children:e.jsx(i,{message:"Frame"})}),e.jsx(I,{value:"splash",description:e.jsx(i,{message:"Show splash page with optional ads and redirect user to url after a delay."}),children:e.jsx(i,{message:"Splash"})}),(o=t==null?void 0:t.pages)!=null&&o.length?e.jsx(I,{value:"page",description:e.jsx(i,{message:`Show specified link page with :siteName navigation bar and button to open
long url.`,values:{siteName:s}}),children:e.jsx(i,{message:"Link page"})}):null,t!=null&&t.overlays.length?e.jsx(I,{value:"overlay",description:e.jsx(i,{message:"Redirect user instantly and show specified overlay over the link."}),children:e.jsx(i,{message:"Overlay"})}):null]}),r==="page"&&e.jsx(Ne,{label:e.jsx(i,{message:"Link page"}),name:"type_id",selectionMode:"single",className:"mb-24 flex-auto",required:!0,children:(l=t==null?void 0:t.pages)==null?void 0:l.map(d=>e.jsx(I,{value:d.id,children:d.title},d.id))}),r==="overlay"&&e.jsx(Ne,{label:e.jsx(i,{message:"Link overlay"}),name:"type_id",selectionMode:"single",className:"mb-24 flex-auto",required:!0,children:(c=t==null?void 0:t.overlays)==null?void 0:c.map(d=>e.jsx(I,{value:d.id,children:d.name},d.id))})]})}const Wu=""+new URL("upgrade-1a8523e3.svg",import.meta.url).href;function ko({message:s,messageSuffix:t}){const{close:n}=U();return e.jsxs(K,{size:"sm",children:[e.jsx(Z,{children:e.jsx(i,{message:"Join the PROs"})}),e.jsxs(G,{children:[e.jsx("div",{className:"text-center mb-20",children:e.jsx(ft,{src:Wu,className:"h-100 mx-auto"})}),e.jsxs("div",{children:[s," ",t]})]}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",size:"xs",onClick:()=>{n()},children:e.jsx(i,{message:"Maybe later"})}),e.jsx(N,{variant:"flat",size:"xs",color:"primary",elementType:ge,to:"/pricing",target:"_blank",onClick:()=>{n()},children:e.jsx(i,{message:"Find out more"})})]})]})}function wo({message:s,messageSuffix:t}){return e.jsx(ko,{message:s,messageSuffix:t===void 0?e.jsx(i,{message:"Upgrade to unlock this feature and many more."}):t})}function an({message:s,className:t}){const{billing:n}=me();return n.enable?e.jsxs(V,{type:"popover",children:[e.jsx(N,{variant:"flat",color:"primary",size:"2xs",startIcon:e.jsx(Kt,{}),className:t,children:e.jsx(i,{message:"Upgrade"})}),e.jsx(wo,{message:s})]}):e.jsx(Ku,{})}function Ku(){return e.jsx(se,{label:e.jsx(i,{message:"You don't have permissions to access this feature."}),children:e.jsx(Kt,{size:"sm",className:"text-muted"})})}function It({title:s,description:t,children:n,upgradeMessage:a}){return e.jsxs("div",{className:"border-t pt-24",children:[e.jsxs("div",{className:w("font-semibold",a&&"flex items-center gap-10 mb-8"),children:[e.jsx("div",{className:"text-sm",children:s}),a&&e.jsx(an,{message:a})]}),e.jsx("div",{className:"text-muted text-sm",children:t}),n]})}function Is(s){const{data:t}=St(),{hasPermission:n}=ie();return{disabled:!(t!=null&&t.usage.links[s])&&!n("admin")}}function Gu({linkName:s}){const{disabled:t}=Is("password");return e.jsxs(x.Fragment,{children:[e.jsx(E,{type:"password",name:"password",label:e.jsx(i,{message:"Password"}),autoComplete:"new-password",className:"mb-24",labelSuffix:t&&e.jsx(an,{message:e.jsx(i,{message:"Your current plan doesn't include link password protection."})}),disabled:t}),e.jsx(Yu,{linkName:s}),e.jsx(Qu,{linkName:s})]})}function Yu({linkName:s}){const t=$s(),{disabled:n}=Is("expiration");return e.jsx(It,{title:e.jsx(i,{message:"Schedule"}),description:e.jsx(i,{message:"Specify a date when :name should become active and when it should expire. Both activation and expiration dates are optional.",values:{name:s}}),upgradeMessage:n&&e.jsx(i,{message:"Your current plan doesn't include :name scheduling.",values:{name:s}}),children:e.jsxs("div",{className:"block md:flex items-center gap-24 mt-24",children:[e.jsx(ct,{showCalendarFooter:!0,label:e.jsx(i,{message:"Activation date"}),min:t,name:"activates_at",className:"mb-24 flex-auto",disabled:n}),e.jsx(ct,{showCalendarFooter:!0,label:e.jsx(i,{message:"Expiration date"}),min:t,name:"expires_at",className:"mb-24 flex-auto",disabled:n})]})})}function Qu({linkName:s}){const{trans:t}=$(),{disabled:n}=Is("expiration");return e.jsx(It,{title:e.jsx(i,{message:"Expiration clicks"}),description:e.jsx(i,{message:`After :name is visited specified amount of times, it will no longer be accessible.
Optionally, after click amount is reached :name can redirect to specified url instead.`,values:{name:s}}),upgradeMessage:n&&e.jsx(i,{message:"Your current plan doesn't include expiration clicks."}),children:e.jsxs("div",{className:"block md:flex items-center gap-24 mt-24",children:[e.jsx(E,{type:"number",label:e.jsx(i,{message:"Max clicks"}),name:"exp_clicks_rule.key",className:"mb-24 flex-auto",disabled:n}),e.jsx(E,{type:"url",label:e.jsx(i,{message:"Redirect URL"}),placeholder:t(h("Optional")),name:"exp_clicks_rule.value",className:"mb-24 flex-auto",disabled:n})]})})}const Zu=A(e.jsx("path",{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3 5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3 5 6.99h3V14h2V6.99h3L9 3z"}),"SwapVertOutlined");function Ju(){return e.jsxs("div",{children:[e.jsx(Xu,{}),e.jsx(em,{}),e.jsx(sm,{})]})}function Xu(){const{trans:s}=$(),{data:t}=Ss();return e.jsx(Yn,{defaultKey:"us",name:"geo_rules",title:e.jsx(i,{message:"Location targeting"}),description:e.jsx(i,{message:"Redirect users to different url based on their location."}),buttonLabel:e.jsx(i,{message:"Add location"}),children:e.jsx(Ne,{required:!0,showSearchField:!0,searchPlaceholder:s(h("Search countries")),selectionMode:"single",items:t==null?void 0:t.countries,name:"temp",label:e.jsx(i,{message:"Country"}),className:"mt-24 flex-auto",children:n=>e.jsx(I,{value:n.code,children:n.name},n.code)})})}function em(){return e.jsx(Yn,{name:"device_rules",title:e.jsx(i,{message:"Device targeting"}),description:e.jsx(i,{message:"Redirect users to different url based on their device."}),buttonLabel:e.jsx(i,{message:"Add device"}),defaultKey:"desktop",children:e.jsxs(Ne,{required:!0,selectionMode:"single",name:"temp",label:e.jsx(i,{message:"Device"}),className:"mt-24 flex-auto",children:[e.jsx(I,{value:"desktop",children:e.jsx(i,{message:"Desktop"})}),e.jsx(I,{value:"table",children:e.jsx(i,{message:"Tablet"})}),e.jsx(I,{value:"mobile",children:e.jsx(i,{message:"Mobile"})})]})})}function sm(){return e.jsx(Yn,{name:"platform_rules",title:e.jsx(i,{message:"Platform targeting"}),description:e.jsx(i,{message:"Redirect users to different url based on their platform."}),defaultKey:"windows",buttonLabel:e.jsx(i,{message:"Add platform"}),children:e.jsxs(Ne,{name:"temp",required:!0,selectionMode:"single",label:e.jsx(i,{message:"Platform"}),className:"mt-24 flex-auto",children:[e.jsx(I,{value:"windows",children:e.jsx(i,{message:"Windows"})}),e.jsx(I,{value:"osx",children:e.jsx(i,{message:"MacOs"})}),e.jsx(I,{value:"ios",children:e.jsx(i,{message:"iOS"})}),e.jsx(I,{value:"android",children:e.jsx(i,{message:"Android"})}),e.jsx(I,{value:"linux",children:e.jsx(i,{message:"Linux"})})]})})}function Yn({name:s,title:t,description:n,buttonLabel:a,defaultKey:r,children:o}){const{fields:l,append:c,remove:d}=pr({name:s}),{disabled:m}=Is("retargeting");return e.jsxs(It,{title:t,description:n,upgradeMessage:m&&e.jsx(i,{message:"Your current plan doesn't include link retargeting."}),children:[l.map((u,p)=>e.jsxs("div",{className:"block items-end gap-14 md:flex",children:[x.cloneElement(o,{name:`${s}.${p}.key`,disabled:m}),e.jsx(E,{required:!0,type:"url",name:`${s}.${p}.value`,label:e.jsx(i,{message:"URL"}),className:"mt-24 flex-auto",disabled:m}),e.jsx(tm,{onClick:()=>d(p)})]},u.id)),e.jsx(N,{className:"my-8",variant:"text",color:"primary",startIcon:e.jsx(lt,{}),onClick:()=>{c({key:r,value:""})},disabled:m,children:a})]})}function tm({onClick:s}){return e.jsxs(x.Fragment,{children:[e.jsx("div",{className:"mt-12 md:hidden",children:e.jsx(N,{variant:"outline",color:"danger",size:"xs",onClick:s,children:e.jsx(i,{message:"Remove"})})}),e.jsx(P,{color:"danger",onClick:s,className:"max-md:hidden",children:e.jsx(Ue,{})})]})}const nm=A(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-.61.08-1.21.21-1.78L8.99 15v1c0 1.1.9 2 2 2v1.93C7.06 19.43 4 16.07 4 12zm13.89 5.4c-.26-.81-1-1.4-1.9-1.4h-1v-3c0-.55-.45-1-1-1h-6v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41C17.92 5.77 20 8.65 20 12c0 2.08-.81 3.98-2.11 5.4z"}),"PublicOutlined");function am({hideTitle:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"block md:flex gap-24 mb-24",children:[e.jsx(gs,{children:e.jsx(jt,{name:"image",diskPrefix:"links",variant:"avatar",previewSize:"w-90 h-90",previewRadius:"rounded",placeholderIcon:e.jsx("div",{className:"w-full h-full bg-alt rounded"}),showRemoveButton:!0})}),e.jsxs("div",{className:"flex-auto my-24 md:my-0",children:[!s&&e.jsx(E,{name:"name",label:e.jsx(i,{message:"Title"}),className:"mb-24"}),e.jsx(E,{inputElementType:"textarea",name:"description",rows:2,label:e.jsx(i,{message:"description"})})]})]}),e.jsx(en,{name:"tags",label:e.jsx(i,{message:"Tags"}),valueKey:"name"})]})}const rm=A(e.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3h7zM7 9H4V5h3v4zm10 6h3v4h-3v-4zm0-10h3v4h-3V5z"}),"AccountTreeOutlined");function om(){const{trans:s}=$(),{disabled:t}=Is("utm");return e.jsxs(It,{title:e.jsx(i,{message:"UTM tags"}),description:e.jsx(i,{message:"Add UTMs to track web traffic in analytics tools."}),upgradeMessage:t&&e.jsx(i,{message:"Your current plan doesn't include UTM functionality."}),children:[e.jsxs("div",{className:"block md:flex gap-24 items-center mt-24",children:[e.jsx(E,{name:"utm.source",label:e.jsx(i,{message:"Source"}),placeholder:s(h("e.g: adwords, google, facebook")),className:"mb-24 flex-auto",disabled:t}),e.jsx(E,{name:"utm.medium",label:e.jsx(i,{message:"Medium"}),placeholder:s(h("e.g: banner, email, social post")),className:"mb-24 flex-auto",disabled:t})]}),e.jsxs("div",{className:"block md:flex gap-24 items-center",children:[e.jsx(E,{name:"utm.campaign",label:e.jsx(i,{message:"Campaign"}),placeholder:s(h("e.g: holiday special, birthday promo")),className:"mb-24 flex-auto",disabled:t}),e.jsx(E,{name:"utm.term",label:e.jsx(i,{message:"Term"}),placeholder:s(h("Use to identify ppc keywords")),className:"mb-24 flex-auto",disabled:t})]}),e.jsx(E,{name:"utm.content",label:e.jsx(i,{message:"Content"}),placeholder:s(h("Use to differentiate ads or words on a page")),className:"mb-24",disabled:t}),e.jsx(im,{})]})}function im(){const{fields:s,append:t,remove:n}=pr({name:"utm_custom"}),{disabled:a}=Is("utm");return e.jsxs(It,{title:e.jsx(i,{message:"Custom parameters"}),description:e.jsx(i,{message:"Add query parameters to track web traffic in analytics tools."}),upgradeMessage:a&&e.jsx(i,{message:"Your current plan doesn't include query parameters functionality."}),children:[s.map((r,o)=>e.jsxs("div",{className:"block md:flex items-end gap-14",children:[e.jsx(E,{required:!0,name:`utm_custom.${o}.key`,label:e.jsx(i,{message:"Key"}),className:"flex-auto mt-24",disabled:a}),e.jsx(E,{required:!0,name:`utm_custom.${o}.value`,label:e.jsx(i,{message:"Value"}),className:"flex-auto mt-24",disabled:a}),e.jsx(lm,{onClick:()=>n(o)})]},r.id)),e.jsx(N,{className:"mb-24 mt-12",variant:"text",color:"primary",startIcon:e.jsx(lt,{}),onClick:()=>{t({key:"",value:""})},disabled:a,children:e.jsx(i,{message:"Add parameter"})})]})}function lm({onClick:s}){return ve()?e.jsx("div",{className:"mt-12",children:e.jsx(N,{variant:"outline",color:"danger",size:"xs",onClick:s,children:e.jsx(i,{message:"Remove"})})}):e.jsx(P,{color:"danger",onClick:s,children:e.jsx(Ue,{})})}function Qn(s){const{custom_domains:t,base_url:n}=me();return x.useMemo(()=>{var r;const a=t==null?void 0:t.default_host;if(a){const o=(r=s==null?void 0:s.find(l=>l.host===a))==null?void 0:r.host;if(o)return o}return n.replace(/\/$/,"").replace(/(^\w+:|^)\/\//,"")},[t,n,s])}function Zn({...s}){var o;const{data:t}=Ss(),n=Qn(t==null?void 0:t.domains),{custom_domains:a}=me(),r=(t==null?void 0:t.domains)||[];return!(a!=null&&a.allow_select)||!r.length?null:e.jsxs(Ne,{selectionMode:"single",label:e.jsx(i,{message:"Domain"}),...s,children:[a.allow_all_option&&e.jsx(I,{value:null,children:e.jsx(i,{message:"All my domains (including default)"})},"all"),e.jsx(I,{value:0,startIcon:e.jsx(ns,{url:n}),children:Xe(n)},"default"),(o=t==null?void 0:t.domains)==null?void 0:o.map(l=>l.host===n?null:e.jsx(I,{value:l.id,startIcon:e.jsx(ns,{url:l.host}),children:Xe(l.host)},l.id))]})}function Jn({defaultExpanded:s,multipleLinks:t,hiddenFields:n=[],linkName:a=e.jsx(i,{message:"link"})}){const{links:{retargeting:r}}=me(),[o,l]=x.useState(s||[]);return e.jsxs(Er,{className:"-ml-14 -mr-14",mode:"multiple",variant:"minimal",expandedValues:o,onExpandedChange:c=>{l(c)},children:[e.jsx(Ds,{value:"options",label:e.jsx(i,{message:"Settings"}),startIcon:e.jsx(gr,{}),children:e.jsx(cm,{multipleLinks:t,hiddenFields:n,linkName:a})}),e.jsx(Ds,{value:"restrictions",label:e.jsx(i,{message:"Restrictions"}),startIcon:e.jsx(Kt,{}),children:e.jsx(Gu,{linkName:a})}),r&&e.jsx(Ds,{value:"retargeting",label:e.jsx(i,{message:"Retargeting"}),startIcon:e.jsx(Zu,{}),children:e.jsx(Ju,{})}),!n.includes("seo")&&e.jsx(Ds,{label:e.jsx(i,{message:"SEO"}),startIcon:e.jsx(nm,{}),value:"seo",children:e.jsx(am,{hideTitle:n==null?void 0:n.includes("title")})}),e.jsx(Ds,{value:"utm",label:e.jsx(i,{message:"UTM"}),startIcon:e.jsx(rm,{}),children:e.jsx(om,{})})]})}function cm({multipleLinks:s,hiddenFields:t,linkName:n}){const{links:{enable_type:a,pixels:r}}=me(),o=s?2:1,l=t.includes("groups"),c=t.includes("type"),d=t.includes("enabled");return e.jsxs(x.Fragment,{children:[a&&!c&&e.jsx(qu,{}),e.jsx(Zn,{name:"domain_id",className:"mb-24",description:e.jsx(i,{message:"Select which domain should [one :name|other :names] be accessible with.",values:{name:n,count:o}})}),!l&&e.jsx(dm,{multipleLinks:s}),r&&e.jsx(um,{multipleLinks:s,linkName:n}),!d&&e.jsx(fs,{name:"active",description:e.jsx(i,{message:"When [one :name is|other :names are] disabled, 404 page will be shown when short URL is visited.",values:{name:n,count:o}}),children:e.jsx(i,{message:"Enabled"})})]})}function dm({multipleLinks:s}){const{data:t}=Ss();return e.jsx(en,{suggestions:t==null?void 0:t.groups,openMenuOnFocus:!0,allowCustomValue:!1,showDropdownArrow:!0,className:"mb-24",name:"groups",label:e.jsx(i,{message:"Groups"}),description:e.jsx(i,{message:"Which groups should [one link|other these links] belong to.",values:{count:s?2:1}}),children:n=>e.jsx(I,{value:n.id,children:n.name})})}function um({multipleLinks:s,linkName:t}){const{data:n}=Ss();return e.jsx(en,{suggestions:n==null?void 0:n.pixels,openMenuOnFocus:!0,className:"mb-24",name:"pixels",label:e.jsx(i,{message:"Pixels"}),description:e.jsx(i,{message:"Which tracking pixels should be used for [one this :name|other these :names].",values:{count:s?2:1,name:t}}),children:a=>e.jsx(I,{value:a.id,children:a.name})})}function No({host:s,value:t="",placeholder:n,onChange:a,className:r,inputRef:o,onInputBlur:l,showLinkIcon:c=!0,pattern:d,minLength:m,maxLength:u,hideButton:p,...f}){const{base_url:g}=me(),j=f.prefix?`/${f.prefix}`:"",v=f.suffix?`/${f.suffix}`:"",[y,b]=x.useState(!1),[k,S]=x.useState(t);s=s||g,x.useEffect(()=>{S(t)},[t]);const L=()=>{y?(b(!1),k&&(a==null||a(k))):b(!0)};let D="";return k?D=k:n&&(D=Md(n)),e.jsxs("div",{className:w("flex items-center",r),children:[c&&e.jsx(_n,{className:"icon-md text-muted"}),e.jsxs("div",{className:"text-primary ml-6 mr-14",children:[s,j,!y&&D&&e.jsxs(x.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("span",{className:"font-medium",children:D})]}),y?null:v]}),y&&e.jsx(Ut,{pattern:d,minLength:m,maxLength:u,onKeyDown:F=>{F.key==="Enter"&&L()},ref:o,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:k,onBlur:l,onChange:F=>{S(F.target.value)}}),!p&&e.jsx(N,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{L()},children:y?e.jsx(i,{message:"Save"}):e.jsx(i,{message:"Edit"})})]})}function rn({form:s,name:t}){var f,g;const{links:{alias_min:n,alias_max:a}}=me(),{data:r}=Ss(),o=Qn(r==null?void 0:r.domains),{disabled:l}=Is("alias"),{watch:c,setValue:d,formState:m}=s,u=c("alias")||c("hash"),p=((f=m.errors.alias)==null?void 0:f.message)||((g=m.errors.hash)==null?void 0:g.message);return e.jsxs("div",{className:"mb-24",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(No,{host:o,pattern:"[A-Za-z0-9\\-]+",minLength:n,maxLength:a,value:u,onChange:j=>{d(t,j,{shouldDirty:!0})},hideButton:l}),l&&e.jsx(an,{message:e.jsx(i,{message:"Your current plan does not include alias editing."})})]}),p&&e.jsx("div",{className:"text-xs text-danger mt-6",children:p})]})}function Co({form:s,onSubmit:t,formId:n,showButtonLabelField:a,hiddenFields:r}){const{clearErrors:o}=s,{trans:l}=$(),{links:{min_len:c,max_len:d}}=me(),m=r==null?void 0:r.includes("alias");return e.jsxs(xe,{form:s,onSubmit:u=>{jr(u.long_url)?t(u):s.setError("long_url",{message:l(h("This url is invalid."))})},onBeforeSubmit:()=>{o("alias")},id:n,children:[a&&e.jsx(E,{name:"name",label:e.jsx(i,{message:"Button label"}),className:"mb-24 flex-auto",placeholder:l(h("e.g. My Webpage")),autoFocus:!0}),e.jsx(E,{label:e.jsx(i,{message:"Destination URL"}),name:"long_url",placeholder:"https://example.com",autoComplete:"off",spellCheck:"false",required:!0,className:w(m?"mb-24":"mb-12"),autoFocus:!a,minLength:c,maxLength:d}),!m&&e.jsx(rn,{form:s,name:"alias"}),e.jsx(Jn,{hiddenFields:r})]})}const So="********";function Io(s){const t=s.rules||[],n={},a=[];if(s.utm){const r=new URLSearchParams(s.utm);for(const[o,l]of r.entries())mm.includes(o)?n[o]=l:a.push({key:o,value:l})}return{hash:s.hash,active:s.active,activates_at:s.activates_at,expires_at:s.expires_at,name:s.name,description:s.description,image:s.image,geo_rules:t.filter(r=>r.type==="geo"),device_rules:t.filter(r=>r.type==="device"),platform_rules:t.filter(r=>r.type==="platform"),exp_clicks_rule:t.find(r=>r.type==="exp_clicks"),password:s.has_password?So:"",utm:n,utm_custom:a,domain_id:s.domain_id,pixels:s.pixels,tags:s.tags}}const mm=["source","medium","campaign","term","content"];function Xn(s){var n;s.password===So&&delete s.password;let t={...s,utm:null,groups:null,pixels:null,tags:null};return t=xm(t,s),t.pixels=s.pixels?s.pixels.map(a=>a.id):[],t.tags=(n=s.tags)==null?void 0:n.map(a=>typeof a=="string"?a:a.name),t}function xm(s,t){var a;if(!t.utm&&!t.utm_custom)return s;const n=br(t.utm||{});return(a=t.utm_custom)==null||a.forEach(({key:r,value:o})=>{n[r]=o}),s.utm=new URLSearchParams(n).toString(),s}function ea(s){var n;const t=Xn(s);return t.groups=(n=s.groups)==null?void 0:n.map(a=>a.id),t}function hm(s,{endpoint:t,invalidateQueries:n=!0}={}){const{trans:a}=$();return Y({mutationFn:r=>fm(r,t),onSuccess:()=>{J.positive(a(h("Link created"))),n&&(q.invalidateQueries({queryKey:te("link")}),q.invalidateQueries({queryKey:te("link-group")}),q.invalidateQueries({queryKey:te("biolink")}))},onError:r=>ye(r,s)})}function fm(s,t){return O.post(t||"link",ea(s)).then(n=>n.data)}function sa({group:s,position:t,showButtonLabelField:n,hiddenFields:a,endpoint:r,onSuccess:o,invalidateQueries:l}){const{close:c,formId:d}=U(),{links:{default_type:m},custom_domains:u}=me(),{verify:p,isVerifying:f}=bt("link_creation"),g=ne({defaultValues:{hash:Mn(5),active:!0,type:m||"direct",geo_rules:[],device_rules:[],platform_rules:[],groups:s?[s]:[],position:t,utm:{},utm_custom:[],domain_id:u!=null&&u.allow_all_option?void 0:0}}),j=hm(g,{endpoint:r,invalidateQueries:l});return e.jsxs(K,{size:"lg",children:[e.jsx(Z,{children:e.jsx(i,{message:"Create link"})}),e.jsx(G,{children:e.jsx(Co,{hiddenFields:a,showButtonLabelField:n,formId:d,form:g,onSubmit:async v=>{await p()&&j.mutate(v,{onSuccess:b=>{o==null||o(b),c()}})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{c()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:d,disabled:j.isPending||f,children:e.jsx(i,{message:"Create"})})]})]})}function pm(s,t,{endpoint:n,invalidateQueries:a=!0}={}){const{trans:r}=$();return Y({mutationFn:o=>gm(t,o,n),onSuccess:async()=>{a&&await Promise.allSettled([q.invalidateQueries({queryKey:te("link")}),q.invalidateQueries({queryKey:te("link-group")}),q.invalidateQueries({queryKey:te("biolink")})]),J.positive(r(h("Link updated")))},onError:o=>ye(o,s)})}function gm(s,t,n){return O.put(n||`link/${s}`,ea(t)).then(a=>a.data)}function Lo({link:s,showButtonLabelField:t,hiddenFields:n,invalidateQueries:a,onSuccess:r,endpoint:o}){const{close:l,formId:c}=U(),{verify:d,isVerifying:m}=bt("link_creation"),u=x.useMemo(()=>jm(s),[s]),p=ne({defaultValues:u}),f=pm(p,s.id,{endpoint:o,invalidateQueries:a});return e.jsxs(K,{size:"lg",children:[e.jsx(Z,{children:e.jsx(i,{message:"Update link"})}),e.jsx(G,{children:e.jsx(Co,{hiddenFields:n,showButtonLabelField:t,formId:c,form:p,onSubmit:async g=>{await d()&&f.mutate(g,{onSuccess:v=>{r==null||r(v),l()}})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{l()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:c,disabled:f.isPending||m,children:e.jsx(i,{message:"Update"})})]})]})}function jm(s){return{...Io(s),long_url:s.long_url,alias:s.alias,type:s.type,type_id:s.type_id,groups:s.groups}}function Do({link:s,className:t}){return s.image?e.jsx("img",{className:t,alt:"",src:s.image}):e.jsx(ns,{className:t,url:s.long_url})}function bm({resourceName:s}){const{trans:t}=$();return e.jsx(ko,{message:e.jsx(i,{message:"You've reached the maximum number of :resource allowed for your current plan.",values:{resource:t(s)}}),messageSuffix:e.jsx(i,{message:"Upgrade to increase this limit and unlock other features."})})}const de=x.forwardRef(({children:s,resource:t,action:n,...a},r)=>{const{user:o}=ie(),[l,c]=x.useState(!1),{data:d}=St(),m=x.useMemo(()=>{const f=typeof t=="string"?t:t.model_type;return`${vm(f)}s`},[t]),u=d==null?void 0:d.usage[m][n],p=d==null?void 0:d.usage[m].createMsgType;return u||typeof t=="object"&&t.user_id===(o==null?void 0:o.id)?x.cloneElement(s,{...a,ref:r}):!u&&p!=="overQuota"?null:e.jsxs("div",{onPointerDown:Oe(f=>{f.preventDefault(),f.stopPropagation()}),onClickCapture:Oe(f=>{f.preventDefault(),f.stopPropagation(),c(!0)}),onKeyDownCapture:Oe(f=>{const g=f;g.preventDefault(),g.stopPropagation(),(g.key==="Enter"||g.key===" ")&&c(!0)}),children:[s,e.jsx(V,{type:"modal",isOpen:l,onOpenChange:c,children:e.jsx(bm,{resourceName:go[m]})})]})});function vm(s){return s.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}const mt=A(e.jsx("path",{d:"M5 9.2h3V19H5V9.2zM10.6 5h2.8v14h-2.8V5zm5.6 8H19v6h-2.8v-6z"}),"BarChartOutlined"),Nn=[{key:"summary",header:()=>e.jsx(i,{message:"Summary"}),width:"flex-3 min-w-200",visibleInMode:"all",body:s=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-6 whitespace-nowrap",children:[e.jsx(Do,{link:s,className:"w-16 h-16"}),e.jsx("a",{className:"block font-semibold hover:underline overflow-ellipsis overflow-hidden w-min",href:s.long_url,target:"_blank",rel:"noreferrer","data-testid":"long-url",children:Xe(s.long_url)})]}),e.jsx(_i,{link:s,variant:"text",className:"block text-muted hover:underline w-min","data-testid":"short-url"})]})},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"clicks",sortingKey:"clicks_count",allowsSorting:!0,header:()=>e.jsx(i,{message:"Clicks"}),body:s=>s.clicks_count?e.jsx(Be,{value:s.clicks_count}):""},{key:"type",sortingKey:"type",allowsSorting:!0,header:()=>e.jsx(i,{message:"Type"}),body:s=>e.jsx(Bt,{size:"xs",radius:"rounded",className:"capitalize",children:e.jsx(i,{message:s.type})})},{key:"password",allowsSorting:!0,header:()=>e.jsx(i,{message:"Password"}),body:s=>s.has_password?e.jsx(_s,{className:"icon-md text-positive"}):e.jsx(Ue,{className:"icon-md text-danger"})},{key:"expires_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Expires at"}),body:s=>s.expires_at?e.jsx(Je,{date:s.expires_at}):""},{key:"clicked_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last clicked"}),body:s=>s.clicked_at?e.jsx(Je,{date:s.clicked_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-128 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(se,{label:e.jsx(i,{message:"Link statistics"}),children:e.jsx(ge,{to:`${s.id}`,children:e.jsx(P,{size:"md",children:e.jsx(mt,{})})})}),e.jsx(js,{link:s}),e.jsx(de,{resource:s,action:"update",children:e.jsxs(V,{type:"modal",children:[e.jsx(se,{label:e.jsx(i,{message:"Edit link"}),children:e.jsx(P,{size:"md",children:e.jsx(Ke,{})})}),e.jsx(Lo,{link:s})]})})]})}],Po=A(e.jsx("path",{d:"M8 11h8v2H8v-2zm12.1 1H22c0-2.76-2.24-5-5-5h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1zM3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM19 12h-2v3h-3v2h3v3h2v-3h3v-2h-3v-3z"}),"AddLinkOutlined"),zo=A(e.jsx("path",{d:"M 7 2 C 5.895 2 5 2.895 5 4 L 5 9 L 4 9 C 2.895 9 2 9.895 2 11 L 2 16 C 2 17.105 2.895 18 4 18 L 5 18 L 5 20 C 5 21.105 5.895 22 7 22 L 15.171875 22 L 13.171875 20 L 7 20 L 7 18 L 17 18 L 17 16 C 17 14.895 17.895 14 19 14 L 21 14 L 21 7 L 16 2 L 7 2 z M 7 4 L 15 4 L 15 8 L 19 8 L 19 9 L 7 9 L 7 4 z M 6 11 C 7.105 11 8 11.895 8 13 L 7 13 C 7 12.449 6.551 12 6 12 C 5.449 12 5 12.449 5 13 L 5 14 C 5 14.551 5.449 15 6 15 C 6.551 15 7 14.551 7 14 L 8 14 C 8 15.105 7.105 16 6 16 C 4.895 16 4 15.105 4 14 L 4 13 C 4 11.895 4.895 11 6 11 z M 10.644531 11 C 12.067531 11.041 12.154297 12.282906 12.154297 12.503906 L 11.1875 12.503906 C 11.1875 12.400906 11.204906 11.806641 10.628906 11.806641 C 10.453906 11.806641 10.059844 11.884188 10.089844 12.367188 C 10.118844 12.810188 10.703547 13.019406 10.810547 13.066406 C 11.034547 13.148406 12.141391 13.642391 12.150391 14.650391 C 12.152391 14.864391 12.097062 15.985 10.664062 16 C 9.1050625 16.017 9 14.675438 9 14.398438 L 9.9746094 14.398438 C 9.9746094 14.545438 9.9870625 15.256172 10.664062 15.201172 C 11.071063 15.167172 11.159828 14.87425 11.173828 14.65625 C 11.196828 14.28925 10.846563 14.068625 10.476562 13.890625 C 9.9565625 13.640625 9.1341406 13.333375 9.1191406 12.359375 C 9.1061406 11.482375 9.7505312 10.975 10.644531 11 z M 13 11 L 14.052734 11 L 14.992188 14.646484 L 15.9375 11 L 17 11 L 15.646484 16 L 14.345703 16 L 13 11 z M 19 16 L 19 20 L 16 20 L 20 24 L 24 20 L 21 20 L 21 16 L 19 16 z"}));function ym(s){const{trans:t}=$();return Y({mutationFn:n=>km(n),onSuccess:n=>{J.positive(t(h("[one 1 link|other :count links] shortened",{values:{count:n.links.length}}))),q.invalidateQueries({queryKey:te("link")}),q.invalidateQueries({queryKey:te("link-group")})},onError:n=>ye(n,s)})}function km(s){return O.post("link/batch/shorten",wm(s)).then(t=>t.data)}function wm(s){const t=ea(s),n=s.long_urls.split(/\n/g);return{...t,long_urls:n}}function Ao({group:s}){const{trans:t}=$(),{close:n,formId:a}=U(),r=ne({defaultValues:{active:!0,type:"direct",geo_rules:[],device_rules:[],platform_rules:[],groups:s?[s]:void 0,utm:{},utm_custom:[]}}),o=ym(r);return e.jsxs(K,{size:"lg",children:[e.jsx(Z,{children:e.jsx(i,{message:"Shorten links"})}),e.jsx(G,{children:e.jsxs(xe,{id:a,form:r,onSubmit:l=>{l.long_urls.split(/\r?\n/).some(d=>!jr(d))?r.setError("long_urls",{message:t(h("Some of the urls are not valid."))}):o.mutate(l,{onSuccess:()=>n()})},children:[e.jsx(E,{label:e.jsx(i,{message:"Multiple URLs (one per line)"}),inputElementType:"textarea",rows:10,name:"long_urls",autoComplete:"off",spellCheck:"false",required:!0,className:"mb-24",autoFocus:!0}),e.jsx(Jn,{multipleLinks:!0})]})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{n()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:a,disabled:o.isPending,children:e.jsx(i,{message:"Shorten"})})]})]})}function Nm({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Nn.filter(d=>d.key!=="user_id"):Nn;return{filters:s?wn.filter(d=>d.key!=="user_id"):wn,columns:l}},[s]),o=s?t==null?void 0:t.id:"";return x.useEffect(()=>{nn()},[]),e.jsx(ys,{endpoint:"link",queryParams:{userId:o,workspaceId:n,with:"user"},title:e.jsx(i,{message:"Links"}),filters:a,columns:r,actions:e.jsx(Cm,{}),selectedActions:e.jsx(de,{resource:"link",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Gt,title:e.jsx(i,{message:"No links have been created yet"}),filteringTitle:e.jsx(i,{message:"No matching links"})})})}function Cm(){const s=On("link/csv/export");return e.jsxs(x.Fragment,{children:[e.jsxs(is,{children:[e.jsx(P,{variant:"outline",color:"primary",size:"sm",className:"flex-shrink-0",children:e.jsx(Nr,{})}),e.jsxs(ls,{children:[e.jsx(I,{value:"addMultiple",startIcon:e.jsx(Po,{}),onSelected:()=>{$e(Ao)},children:e.jsx(i,{message:"Shorten multiple links"})}),e.jsx(I,{value:"export",startIcon:e.jsx(zo,{}),onSelected:()=>{s.mutate({},{onSuccess:t=>{t.downloadPath?$n(t.downloadPath):$e(Hn)}})},children:e.jsx(i,{message:"Export links"})})]})]}),e.jsx(de,{resource:"link",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"Shorten link"})}),e.jsx(sa,{})]})})]})}const Sm=A(e.jsx("path",{d:"M3 11c0 2.45 1.76 4.47 4.08 4.91l-1.49-1.49L7 13l4 4.01L7 21l-1.41-1.41 1.58-1.58v-.06C3.7 17.54 1 14.58 1 11c0-3.87 3.13-7 7-7h3v2H8c-2.76 0-5 2.24-5 5zm19 0V4h-9v7h9zm-2-2h-5V6h5v3zm-7 4h9v7h-9z"}),"MoveDownOutlined");function Im(s){const{trans:t}=$();return Y({mutationFn:n=>Lm(s.id,n),onSuccess:()=>{J.positive(t(h("Moved links to “:group“",{values:{group:s.name}}))),q.invalidateQueries({queryKey:te("link-group")})},onError:n=>ke(n)})}function Lm(s,t){return O.post(`link-group/${s}/attach`,t).then(n=>n.data)}function Dm({group:s}){const{close:t}=U(),[n,a]=x.useState([]),[r,o]=x.useState({groupId:`!${s.id}`,query:"",perPage:8}),{data:l,isLoading:c}=_r("link",r),d=l==null?void 0:l.pagination,m=Im(s),u=e.jsxs("div",{className:"text-muted",children:[e.jsx(P,{disabled:c||!(d!=null&&d.prev_page),onClick:()=>{o({...r,page:d==null?void 0:d.prev_page})},children:e.jsx(vt,{})}),e.jsx(P,{disabled:c||!(d!=null&&d.next_page),onClick:()=>{o({...r,page:d==null?void 0:d.next_page})},children:e.jsx(Hs,{})})]}),p=e.jsx(qt,{image:e.jsx(ft,{src:Gt}),title:e.jsx(i,{message:"No links found"})}),f=e.jsx("div",{className:"min-h-[464px]",children:e.jsx(xt,{children:e.jsx(Se,{mode:"wait",children:c?e.jsx(Am,{}):e.jsx(Pm,{links:d==null?void 0:d.data,selectedIds:n,setSelectedIds:a})})})});return e.jsxs(K,{size:"lg",children:[e.jsx(Z,{children:e.jsx(i,{message:"Move links to “:group“",values:{group:s.name}})}),e.jsxs(G,{children:[e.jsx(Ut,{className:"mb-14",label:e.jsx(i,{message:"Search for links..."}),value:r.query,onChange:g=>{o({...r,query:g.target.value})}}),!c&&!(d!=null&&d.data.length)?p:f]}),e.jsxs(X,{startAction:u,children:[e.jsx(N,{variant:"text",onClick:t,children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",onClick:()=>{m.mutate({linkIds:n},{onSuccess:t})},disabled:m.isPending,children:e.jsx(i,{message:"Move"})})]})]})}function Pm({links:s,selectedIds:t,setSelectedIds:n}){return e.jsx(fe.div,{...Ie,children:e.jsx(xt,{children:(s||[]).map(a=>{const r=t.includes(a.id);return e.jsx($t,{isSelected:r,onSelected:()=>{n(r?t.filter(o=>o!==a.id):[...t,a.id])},startIcon:e.jsx(Ht,{checked:r}),description:Xe(a.short_url),children:e.jsxs("div",{className:"flex items-center gap-8",children:[e.jsx(Do,{className:"w-14 h-14",link:a}),e.jsx("div",{children:Xe(a.long_url)})]})},a.id)})})},"links-list")}const zm=8;function Am(){return e.jsx(fe.div,{...Ie,children:e.jsx(xt,{children:Array.from({length:zm}).map((s,t)=>e.jsx($t,{isDisabled:!0,children:e.jsx(je,{variant:"text",className:"min-h-40"})},t))})},"links-skeleton")}function Fm(){const{groupId:s}=Re();return e.jsx("div",{className:"p-12 md:p-24",children:e.jsx(Gr,{endpoint:`link-group/${s}/links`,filters:wn,columns:Nn,actions:e.jsx(Mm,{groupId:s?+s:void 0}),selectedActions:e.jsx(de,{resource:"link",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Gt,title:e.jsx(i,{message:"There are no links in this group yet"}),filteringTitle:e.jsx(i,{message:"No matching links"})}),children:e.jsx(_m,{})})})}function _m(){var r;const s=ss(),{query:t}=x.useContext(Xt),n=(r=t.data)==null?void 0:r.linkGroup;if(!n)return e.jsx(ot,{size:"xl",className:"mb-16"});const a=e.jsx(i,{message:"“:group“ links",values:{group:n.name}});return e.jsxs(x.Fragment,{children:[e.jsx(Fn,{children:a}),e.jsxs(ot,{size:"xl",className:"mb-16",children:[e.jsx(as,{onSelected:()=>{s("/dashboard/link-groups")},children:e.jsx(i,{message:"Link groups"})}),e.jsx(as,{className:"first-letter:capitalize",children:a})]})]})}function Mm({groupId:s}){var r;const t=On("link/csv/export"),{query:n}=x.useContext(Xt),a=(r=n.data)==null?void 0:r.linkGroup;return e.jsxs(x.Fragment,{children:[e.jsxs(is,{children:[e.jsx(P,{variant:"outline",color:"primary",size:"sm",className:"flex-shrink-0",children:e.jsx(Nr,{})}),e.jsxs(ls,{children:[e.jsx(I,{value:"moveLinks",startIcon:e.jsx(Sm,{}),onSelected:()=>{$e(Dm,{group:a})},children:e.jsx(i,{message:"Move links to this group"})}),e.jsx(I,{value:"addMultiple",startIcon:e.jsx(Po,{}),onSelected:()=>{$e(Ao,{group:a})},children:e.jsx(i,{message:"Add multiple links"})}),e.jsx(I,{value:"export",startIcon:e.jsx(zo,{}),onSelected:()=>{t.mutate({groupId:s},{onSuccess:o=>{o.downloadPath?$n(o.downloadPath):$e(Hn)}})},children:e.jsx(i,{message:"Export links"})})]})]}),e.jsx(de,{resource:"link",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"Add link"})}),e.jsx(sa,{group:a})]})})]})}const Rm=A(e.jsx("path",{d:"M11 7h6v2h-6zm0 4h6v2h-6zm0 4h6v2h-6zM7 7h2v2H7zm0 4h2v2H7zm0 4h2v2H7zM20.1 3H3.9c-.5 0-.9.4-.9.9v16.2c0 .4.4.9.9.9h16.2c.4 0 .9-.5.9-.9V3.9c0-.5-.5-.9-.9-.9zM19 19H5V5h14v14z"}),"ListAltOutlined");function Fo({onSubmit:s,form:t,formId:n}){const{clearErrors:a}=t;return e.jsxs(xe,{form:t,id:n,onBeforeSubmit:()=>{a("hash")},onSubmit:s,children:[e.jsxs("div",{className:"mb-24",children:[e.jsx(E,{name:"name",label:e.jsx(i,{message:"Name"}),minLength:3,className:"mb-8",autoFocus:!0}),e.jsx(rn,{form:t,name:"hash"})]}),e.jsx(Zn,{name:"domain_id",className:"mb-24"}),e.jsx(E,{name:"description",className:"mb-24",label:e.jsx(i,{message:"Description"}),inputElementType:"textarea",rows:2}),e.jsx(fs,{name:"active",description:e.jsx(i,{message:"Whether this link group is viewable publicly."}),className:"mb-24",children:e.jsx(i,{message:"Active"})}),e.jsx(fs,{name:"rotator",description:e.jsx(i,{message:"When checked, url above will redirect to random link from the group, instead of showing all links belonging to group."}),children:e.jsx(i,{message:"Rotator"})})]})}function Em(s,t){const{trans:n}=$();return Y({mutationFn:a=>Tm(t,a),onSuccess:()=>{J.positive(n(h("Link group updated"))),q.invalidateQueries({queryKey:te("link-group")})},onError:a=>ye(a,s)})}function Tm(s,t){return O.put(`link-group/${s}`,t).then(n=>n.data)}function Vm({group:s}){const{verify:t,isVerifying:n}=bt("link_creation"),{formId:a,close:r}=U(),o=ne({defaultValues:{name:s.name,hash:s.hash,description:s.description,active:s.active,rotator:s.rotator}}),l=Em(o,s.id);return e.jsxs(K,{size:"md",children:[e.jsx(Z,{children:e.jsx(i,{message:"Update link group"})}),e.jsx(G,{children:e.jsx(Fo,{formId:a,form:o,onSubmit:async c=>{await t()&&l.mutate(c,{onSuccess:()=>r()})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{r()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:a,disabled:l.isPending||n,children:e.jsx(i,{message:"Update"})})]})]})}const Fa=[{key:"name",allowsSorting:!0,header:()=>e.jsx(i,{message:"Name"}),width:"flex-3 min-w-200",visibleInMode:"all",body:s=>e.jsx("a",{href:s.short_url,target:"_blank",rel:"noreferrer",className:Os,children:s.name})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(i,{message:"Owner"}),body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"links_count",allowsSorting:!0,header:()=>e.jsx(i,{message:"Links"}),body:s=>s.links_count?e.jsx(Be,{value:s.links_count}):"-"},{key:"active",allowsSorting:!0,header:()=>e.jsx(i,{message:"Active"}),body:s=>s.active?e.jsx(_s,{className:"icon-md text-positive"}):e.jsx(Ue,{className:"icon-md text-danger"})},{key:"rotator",allowsSorting:!0,header:()=>e.jsx(i,{message:"Rotator"}),body:s=>s.rotator?e.jsx(_s,{className:"icon-md text-positive"}):e.jsx(Ue,{className:"icon-md text-danger"})},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(Je,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-160 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(se,{label:e.jsx(i,{message:"Clicks report"}),children:e.jsx(ge,{to:`${s.id}`,children:e.jsx(P,{size:"md",children:e.jsx(mt,{})})})}),e.jsx(se,{label:e.jsx(i,{message:"Manage links"}),children:e.jsx(ge,{to:`${s.id}/links`,children:e.jsx(P,{size:"md",children:e.jsx(Rm,{})})})}),e.jsx(js,{link:s}),e.jsx(de,{resource:s,action:"update",children:e.jsxs(V,{type:"modal",children:[e.jsx(se,{label:e.jsx(i,{message:"Edit link"}),children:e.jsx(P,{size:"md",children:e.jsx(Ke,{})})}),e.jsx(Vm,{group:s})]})})]})}],_a=[{key:"rotator",label:h("Type"),defaultOperator:re.eq,description:h("Type of the group"),control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Default"),value:!1},{key:"02",label:h("Rotator"),value:!0}]}},{key:"active",label:h("Status"),description:h("Whether group is disabled or not"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Enabled"),value:!0},{key:"02",label:h("Disabled"),value:!1}]}},{key:"links_count",label:h("Link count"),description:h("Number of links in the group"),defaultOperator:re.gte,operators:_t,control:{type:H.Input,inputType:"number",defaultValue:1}},bs({description:h("Date group was created")}),vs({description:h("Date group was last updated")}),{key:"user_id",label:h("User"),description:h("User group was created by"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}];function Om(s){const{trans:t}=$();return Y({mutationFn:n=>$m(n),onSuccess:()=>{J.positive(t(h("Link group created"))),q.invalidateQueries({queryKey:te("link-group")})},onError:n=>ye(n,s)})}function $m(s){return O.post("link-group",s).then(t=>t.data)}function Hm(){const{formId:s,close:t}=U(),{custom_domains:n}=me(),{verify:a,isVerifying:r}=bt("link_creation"),o=ne({defaultValues:{active:!0,hash:Mn(6),rotator:!1,domain_id:n!=null&&n.allow_all_option?void 0:0}}),l=Om(o);return e.jsxs(K,{size:"md",children:[e.jsx(Z,{children:e.jsx(i,{message:"Create link group"})}),e.jsx(G,{children:e.jsx(Fo,{formId:s,form:o,onSubmit:async c=>{await a()&&l.mutate(c,{onSuccess:()=>t()})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{t()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:s,disabled:l.isPending||r,children:e.jsx(i,{message:"Create"})})]})]})}function Bm({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Fa.filter(d=>d.key!=="user_id"):Fa;return{filters:s?_a.filter(d=>d.key!=="user_id"):_a,columns:l}},[s]);x.useEffect(()=>{nn()},[]);const o=s?t==null?void 0:t.id:"";return e.jsx(ys,{endpoint:"link-group",queryParams:{userId:o,withCount:"links",with:"user,domain",workspaceId:n},title:e.jsx(i,{message:"Link groups"}),headerContent:e.jsx(Um,{}),filters:a,columns:r,actions:e.jsx(qm,{}),selectedActions:e.jsx(de,{resource:"linkGroup",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Gt,title:e.jsx(i,{message:"No groups have been created yet"}),filteringTitle:e.jsx(i,{message:"No matching groups"})})})}function Um(){return e.jsx(Cs,{dialogSize:"auto",title:e.jsx(i,{message:"Group links together to:"}),body:e.jsxs("ul",{className:"list-inside list-disc whitespace-nowrap",children:[e.jsx("li",{children:e.jsx(i,{message:"Simplify multiple link management."})}),e.jsx("li",{children:e.jsx(i,{message:"View aggregated clicks report for the whole group."})}),e.jsx("li",{children:e.jsx(i,{message:"Redirect to a random link from within the group."})}),e.jsx("li",{children:e.jsx(i,{message:"Share all links in the group with one link."})})]})})}function qm(){return e.jsxs(x.Fragment,{children:[e.jsx(Ec,{endpoint:"link-group/csv/export"}),e.jsx(de,{resource:"linkGroup",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"New group"})}),e.jsx(Hm,{})]})})]})}function Wm(s){return ze({queryKey:["link-group",s],queryFn:()=>Km(s),initialData:Gm(s)})}function Km(s){return O.get(`link-group/${s}`).then(t=>t.data)}function Gm(s){var n,a;const t=(a=(n=q.getQueryData(te("link-group")))==null?void 0:n.pagination)==null?void 0:a.data.find(r=>r.id===+s);return t?{linkGroup:t}:void 0}function Ym(){var r;const s=ss(),{groupId:t}=Re(),n=Wm(t),a=(r=n.data)==null?void 0:r.linkGroup;return e.jsx(tn,{model:`link-group=${t}`,title:e.jsxs(ot,{size:"xl",className:w(n.isLoading&&"invisible"),children:[e.jsx(as,{onSelected:()=>{s("..",{relative:"path"})},children:e.jsx(i,{message:"Link groups"})}),e.jsx(as,{className:"first-letter:capitalize",children:e.jsx(i,{message:"“:name“ clicks",values:{name:a==null?void 0:a.name}})})]}),actions:a&&e.jsx(js,{className:"flex-shrink-0 text-muted",link:a})})}function Qm(s){return ze({queryKey:["link",s],queryFn:()=>Zm(s),initialData:Jm(s)})}function Zm(s){return O.get(`link/${s}`).then(t=>t.data)}function Jm(s){var n,a;const t=(a=(n=q.getQueryData(te("link")))==null?void 0:n.pagination)==null?void 0:a.data.find(r=>r.id===+s);return t?{link:t}:void 0}function Ma(){var r;const s=ss(),{linkId:t}=Re(),n=Qm(t),a=(r=n.data)==null?void 0:r.link;return e.jsx(tn,{model:`link=${t}`,title:e.jsxs(ot,{size:"xl",className:w(n.isLoading&&"invisible"),children:[e.jsx(as,{onSelected:()=>{s("..",{relative:"path"})},children:e.jsx(i,{message:"Links"})}),e.jsx(as,{className:"first-letter:capitalize",children:e.jsx(i,{message:"“:name“ clicks",values:{name:a==null?void 0:a.name}})})]}),actions:a&&e.jsx(js,{className:"flex-shrink-0 text-muted",link:a})})}const Xm=""+new URL("world-ea41c34b.svg",import.meta.url).href;function ex(s){return e.jsx(cs,{...s,image:Xm,title:e.jsx(i,{message:"No domains have been connected yet"}),filteringTitle:e.jsx(i,{message:"No matching domains"})})}function sx({value:s}){return s?e.jsx(_s,{className:"icon-md text-positive"}):e.jsx(Ue,{className:"icon-md text-danger"})}function tx(){const{trans:s}=$();return Y({mutationFn:t=>nx(t),onSuccess:(t,n)=>{J.positive(s(h("“:domain” removed",{values:{domain:n.domain.host}}))),q.invalidateQueries({queryKey:te("custom-domain")})},onError:t=>ke(t)})}function nx({domain:s}){return O.delete(`custom-domain/${s.id}`).then(t=>t.data)}function _o({domain:s}){const t=tx();return e.jsxs(V,{type:"modal",onClose:n=>{n&&t.mutate({domain:s})},children:[e.jsx(N,{variant:"outline",color:"danger",size:"xs",disabled:t.isPending,children:e.jsx(i,{message:"Remove"})}),e.jsx(ps,{title:e.jsx(i,{message:"Remove domain?"}),body:e.jsx(i,{message:"Are you sure you want to remove “:domain“?",values:{domain:s.host}}),confirm:e.jsx(i,{message:"Remove"}),isDanger:!0})]})}const ax=[{key:"host",allowsSorting:!0,header:()=>e.jsx(i,{message:"Domain"}),width:"flex-3 min-w-200",visibleInMode:"all",body:s=>e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-6 whitespace-nowrap",children:[e.jsx(ns,{url:s.host}),e.jsx("a",{className:"block font-semibold hover:underline overflow-ellipsis overflow-hidden w-min",href:s.host,target:"_blank",rel:"noreferrer","data-testid":"host-name",children:s.host})]})})},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"global",allowsSorting:!0,header:()=>e.jsx(i,{message:"Global"}),body:s=>e.jsx(sx,{value:s.global})},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(Je,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,width:"w-80 flex-shrink-0",visibleInMode:"all",align:"end",body:s=>e.jsx(_o,{domain:s})}],Ra=[{key:"global",label:h("Global"),description:h("Whether domain is marked as global"),defaultOperator:re.eq,control:{type:H.BooleanToggle,defaultValue:!0}},bs({description:h("Date domain was created")}),vs({description:h("Date domain was last updated")}),{key:"user_id",label:h("Owner"),description:h("User domain belongs to"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}];function Mo(s){return(s.replace("www.","").match(/\./g)||[]).length>1}function ta({message:s=e.jsx(i,{message:"Checking DNS configuration..."})}){return e.jsxs("div",{className:"flex items-center gap-18 text-base p-12 rounded bg-primary/10 text-primary",children:[e.jsx(ht,{isIndeterminate:!0,size:"sm"}),e.jsx("div",{children:s})]})}function rx({stepper:{state:{isLoading:s,host:t,serverIp:n}}}){const{base_url:a}=me();return s?e.jsx(ta,{}):Mo(t)?e.jsx(Ea,{title:e.jsx(i,{message:"Add this CNAME record to your domain by visiting your DNS provider or registrar."}),record:"CNAME",target:a}):e.jsx(Ea,{title:e.jsx(i,{message:"Add this A record to your domain by visiting your DNS provider or registrar."}),record:"A",target:n})}function Ea({title:s,record:t,target:n}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-muted mb-10",children:s}),e.jsxs("div",{className:"flex items-center gap-12 text-base p-12 rounded bg-primary/10 text-primary font-semibold",children:[e.jsx("div",{children:t}),n]})]})}function ox({stepper:s}){return e.jsxs(x.Fragment,{children:[e.jsx(E,{autoFocus:!0,name:"host",required:!0,maxLength:100,label:e.jsx(i,{message:"Host"}),placeholder:"https://example.com",description:e.jsx(i,{message:"Enter the exact domain name you want your items to be accessible with. It can be a subdomain (example.yourdomain.com) or root domain (yourdomain.com)."})}),s.showGlobalField&&e.jsx(fs,{className:"mt-24 border-t pt-24",name:"global",description:e.jsx(i,{message:"Whether all users should be able to select this domain."}),children:e.jsx(i,{message:"Global"})})]})}var pe=(s=>(s[s.Host=1]="Host",s[s.Info=2]="Info",s[s.ValidationFailed=3]="ValidationFailed",s[s.Finalize=4]="Finalize",s))(pe||{});function Ro(){return Y({mutationFn:s=>ix(s)})}function ix(s){return O.post("secure/custom-domain/validate/2BrM45vvfS/api",s).then(t=>t.data)}function lx({stepper:{goToNextStep:s,state:{host:t,serverIp:n,isLoading:a,validationFailReason:r}}}){Ro();const{base_url:o}=me(),{hasPermission:l}=ie(),c=Mo(t),d=c?"CNAME":"A",m=c?o:n;if(a)return e.jsx(ta,{});const u=r==="serverNotConfigured"&&l("admin")?e.jsx(Ta,{children:e.jsx(i,{message:"DNS records for the domain are setup, however it seems that your server is not configured to handle requests from “:host“",values:{host:m}})}):e.jsx(Ta,{children:e.jsx(i,{message:"The domain is missing :record record pointing to :location or the changes haven't propagated yet.",values:{record:d,location:m}})});return e.jsxs(x.Fragment,{children:[u,e.jsx("div",{className:"whitespace-nowrap text-xs text-muted mt-10",children:e.jsx(i,{message:"You can wait and try again later, or <b>refresh</b>",values:{b:p=>e.jsx("button",{disabled:a,type:"button",className:"text-primary underline",onClick:()=>{s()},children:p})}})})]})}function Ta({children:s}){return e.jsxs("div",{className:"flex items-center gap-12 text-base p-12 rounded bg-warning/15 text-warning font-medium",children:[e.jsx(vr,{size:"lg"}),s]})}function cx(s){return Y({mutationFn:t=>dx(t),onError:t=>ye(t,s)})}function dx(s){return O.post("secure/custom-domain/authorize/store",s).then(t=>t.data)}function ux(){const{trans:s}=$(),t=Mi();return Y({mutationFn:n=>mx(n),onSuccess:n=>{J.positive(s(h("“:domain” connected",{values:{domain:n.domain.host}}))),t.invalidateQueries({queryKey:te("custom-domain")})},onError:n=>ke(n)})}function mx(s){return O.post("custom-domain",s).then(t=>t.data)}function xx({showGlobalField:s}){const{close:t}=U(),n=ne(),a=cx(n),r=Ro(),o=ux(),[l,c]=x.useState({isLoading:!1,currentStep:pe.Host,host:"",serverIp:""}),d=()=>{c({...l,isLoading:!0})},m=()=>new Promise(j=>{r.mutate({host:l.host},{onSuccess:()=>{j({status:"success",newState:{validationFailReason:void 0}})},onError:v=>{var y;j({status:"error",newState:{validationFailReason:(y=v.response)==null?void 0:y.data.failReason}})}})}),u=()=>new Promise(j=>{a.mutate(n.getValues(),{onSuccess:v=>{j({status:"success",newState:{host:n.getValues().host,serverIp:v.serverIp}})},onError:()=>{j({status:"error"})}})}),p=l.currentStep!==pe.Host;return{form:n,state:l,goToNextStep:async()=>{if(l.currentStep===pe.Host){d();const j=await u();c({...l,...j.newState,isLoading:!1,currentStep:j.status==="success"?pe.Info:pe.Host})}else if(l.currentStep===pe.Info||l.currentStep===pe.ValidationFailed){d();const j=await m(),v=j.status==="success"?pe.Finalize:pe.ValidationFailed;c({...l,...j.newState,isLoading:!1,currentStep:v}),v===pe.Finalize&&o.mutate(n.getValues(),{onSettled:()=>{t()}})}},hasPreviousStep:p,goToPreviousStep:()=>{!p||l.isLoading||(l.currentStep===pe.Info?c({...l,currentStep:pe.Host}):l.currentStep===pe.ValidationFailed&&c({...l,currentStep:pe.Info}))},showGlobalField:s}}function hx(){return e.jsxs("div",{children:[e.jsx(ta,{message:e.jsx(i,{message:"Connecting domain..."})}),e.jsx("div",{className:"text-muted mt-10 text-xs",children:e.jsx(i,{message:"Don't close this window until domain is connected."})})]})}function fx({showGlobalField:s}){const{close:t,formId:n}=U(),a=xx({showGlobalField:s}),r=px(a.state.currentStep);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Connect domain"})}),e.jsx(G,{children:e.jsx(xe,{form:a.form,id:n,onSubmit:()=>{a.goToNextStep()},children:e.jsx(r,{stepper:a})})}),e.jsxs(X,{startAction:e.jsx(N,{variant:"text",onClick:()=>{t()},children:e.jsx(i,{message:"Cancel"})}),children:[a.hasPreviousStep&&e.jsx(N,{startIcon:e.jsx(vt,{}),color:"primary",variant:"text",onClick:()=>{a.goToPreviousStep()},disabled:a.state.isLoading,children:e.jsx(i,{message:"Previous"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:n,endIcon:e.jsx(Hs,{}),disabled:a.state.isLoading,children:e.jsx(i,{message:"Next"})})]})]})}function px(s){switch(s){case pe.Host:return ox;case pe.Info:return rx;case pe.ValidationFailed:return lx;case pe.Finalize:return hx}}const Va=ax.map(s=>s.key==="actions"?{...s,body:t=>e.jsx(de,{resource:t,action:"delete",children:e.jsx(_o,{domain:t})})}:s);function gx({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Va.filter(d=>d.key!=="user_id"):Va;return{filters:s?Ra.filter(d=>d.key!=="user_id"):Ra,columns:l}},[s]),o=s?t==null?void 0:t.id:"";return e.jsx(ys,{enableSelection:!1,endpoint:"custom-domain",queryParams:{userId:o,workspaceId:n,with:"user"},title:e.jsx(i,{message:"Branded domains"}),headerContent:e.jsx(bx,{}),filters:a,columns:r,actions:e.jsx(jx,{}),emptyStateMessage:e.jsx(ex,{})})}function jx(){const{hasPermission:s}=ie();return e.jsx(de,{resource:"customDomain",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"Connect domain"})}),e.jsx(fx,{showGlobalField:s("admin")})]})})}function bx(){return e.jsx(Cs,{body:e.jsx(i,{message:"Create trusted links with your own branded domains. Once connected, you can set the domain as default or only use it for specific links."})})}const Tt=[{name:"facebook",type:"number",docsUrl:"https://www.facebook.com/business/help/952192354843755?id=1205376682832142"},{name:"twitter",type:"number",docsUrl:"https://business.twitter.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites.html"},{name:"google-tag-manager",type:"text",pattern:"GTM-[a-zA-Z0-9]+",docsUrl:"https://tagmanager.google.com"},{name:"google-analytics",type:"text",docsUrl:"https://analytics.google.com"},{name:"adwords",type:"number",docsUrl:"https://ads.google.com"},{name:"bing",type:"number",docsUrl:"https://about.ads.microsoft.com/en-us/solutions/tools/universal-event-tracking"},{name:"pinterest",type:"number",docsUrl:"https://help.pinterest.com/en/business/article/track-conversions-with-pinterest-tag"},{name:"linkedin",type:"text",docsUrl:"https://www.linkedin.com/help/lms/answer/a418880/add-the-linkedin-insight-tag-to-your-website"},{name:"quora",type:"text",pattern:"[a-z0-9]+",docsUrl:"https://quoraadsupport.zendesk.com/hc/en-us/articles/115010303387-About-the-Quora-Pixel"},{name:"adroll",type:"text",docsUrl:"https://help.adroll.com/hc/en-us/articles/211846018-What-is-the-AdRoll-Pixel"},{name:"nexus-segment",type:"text",docsUrl:"https://segment.com/catalog/integrations/appnexus"},{name:"custom",type:"text"}],vx=A(e.jsx("path",{d:"M11 18h2v-2h-2v2zm1-16C6.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 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"}),"HelpOutlineOutlined");function Eo({formId:s,form:t,onSubmit:n}){const{watch:a}=t,r=a("type"),o=Tt.find(l=>l.name===r);return e.jsxs(xe,{id:s,form:t,onSubmit:n,children:[e.jsx(E,{autoFocus:!0,required:!0,name:"name",label:e.jsx(i,{message:"Name"}),className:"mb-24"}),e.jsx(Ne,{name:"type",selectionMode:"single",className:"mb-24",label:e.jsx(i,{message:"Type"}),description:o!=null&&o.docsUrl?e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(vx,{size:"sm"}),e.jsx("a",{"data-testid":"pixel-docs-link",href:o.docsUrl,target:"_blank",rel:"noreferrer",className:"underline",children:e.jsx(i,{message:"More information"})})]}):null,children:Tt.map(l=>e.jsx(I,{capitalizeFirst:!0,value:l.name,startIcon:l.docsUrl?e.jsx(ns,{url:l.docsUrl}):e.jsx(Ld,{size:"xs"}),children:l.name},l.name))}),r!=="custom"&&e.jsx(E,{required:!0,pattern:o==null?void 0:o.pattern,type:(o==null?void 0:o.type)==="number"?"number":"text",name:"pixel_id",label:e.jsx(i,{message:"Pixel ID"})}),r==="custom"&&e.jsx(yx,{})]})}function yx(){return e.jsxs(x.Fragment,{children:[e.jsx(E,{name:"head_code",label:e.jsx(i,{message:"Custom code for page head"}),className:"mb-24",inputElementType:"textarea",rows:5}),e.jsx(E,{name:"body_code",label:e.jsx(i,{message:"Custom code for page body"}),inputElementType:"textarea",rows:5})]})}function kx(s,t){const{trans:n}=$();return Y({mutationFn:a=>wx(s,a),onSuccess:()=>{J.positive(n(h("Pixel updated"))),q.invalidateQueries({queryKey:te("tp")})},onError:a=>ye(a,t)})}function wx(s,t){return O.put(`tp/${s}`,t).then(n=>n.data)}function Nx({pixel:s}){const t=ne({defaultValues:{name:s.name,type:s.type,pixel_id:s.pixel_id,head_code:s.head_code,body_code:s.body_code}}),{formId:n,close:a}=U(),r=kx(s.id,t);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Update “:name“",values:{name:s.name}})}),e.jsx(G,{children:e.jsx(Eo,{formId:n,form:t,onSubmit:o=>{r.mutate(o,{onSuccess:()=>{a()}})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{a()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:n,disabled:r.isPending,children:e.jsx(i,{message:"Update"})})]})]})}const Oa=[{key:"name",allowsSorting:!0,width:"flex-3 min-w-200",visibleInMode:"all",header:()=>e.jsx(i,{message:"Name"}),body:s=>s.name},{key:"type",allowsSorting:!0,header:()=>e.jsx(i,{message:"Type"}),body:s=>{var n;const t=(n=Tt.find(a=>a.name===s.type))==null?void 0:n.docsUrl;return e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-10",children:[t?e.jsx(ns,{url:t}):null,t?e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:Os,children:s.type}):s.type]})})}},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"pixel_id",header:()=>e.jsx(i,{message:"Pixel ID"}),body:s=>s.pixel_id},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(Je,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(de,{resource:s,action:"update",children:e.jsxs(V,{type:"modal",children:[e.jsx(P,{className:"text-muted",children:e.jsx(Ke,{})}),e.jsx(Nx,{pixel:s})]})})}],Cx=""+new URL("location-tracking-0df79a5f.svg",import.meta.url).href,$a=[{key:"type",label:h("Type"),description:h("Type of the pixel"),defaultOperator:re.eq,control:{type:H.Select,options:Tt.map((s,t)=>({key:s.name,value:s.name,label:h(s.name)}))}},bs({description:h("Date pixel was created")}),vs({description:h("Date pixel was last updated")}),{key:"user_id",label:h("Owner"),description:h("User pixel belongs to"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}];function Sx(s){const{trans:t}=$();return Y({mutationFn:n=>Ix(n),onSuccess:()=>{J.positive(t(h("Pixel created"))),q.invalidateQueries({queryKey:te("tp")})},onError:n=>ye(n,s)})}function Ix(s){return O.post("tp",s).then(t=>t.data)}function Lx(){const s=ne({defaultValues:{type:"facebook"}}),{formId:t,close:n}=U(),a=Sx(s);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Create pixel"})}),e.jsx(G,{children:e.jsx(Eo,{formId:t,form:s,onSubmit:r=>{a.mutate(r,{onSuccess:()=>{n()}})}})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{n()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:t,disabled:a.isPending,children:e.jsx(i,{message:"Create"})})]})]})}function Dx({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Oa.filter(d=>d.key!=="user_id"):Oa;return{filters:s?$a.filter(d=>d.key!=="user_id"):$a,columns:l}},[s]),o=s?t==null?void 0:t.id:"";return e.jsx(ys,{endpoint:"tp",queryParams:{userId:o,with:"user",workspaceId:n},title:e.jsx(i,{message:"Tracking pixels"}),filters:a,columns:r,headerContent:e.jsx(zx,{}),actions:e.jsx(Px,{}),selectedActions:e.jsx(de,{resource:"trackingPixel",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Cx,title:e.jsx(i,{message:"No tracking pixels have been added yet"}),filteringTitle:e.jsx(i,{message:"No matching tracking pixels"})})})}function Px(){return e.jsx(de,{resource:"trackingPixel",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"Add pixel"})}),e.jsx(Lx,{})]})})}function zx(){return e.jsx(Cs,{body:e.jsx(i,{message:"Add third party tracking integration to your links using pixels or custom code snippet."})})}function Ax(s,t){const{trans:n}=$();return Y({mutationFn:a=>Fx(s,a),onSuccess:()=>{J.positive(n(h("Page options updated"))),q.invalidateQueries({queryKey:te("link-page")})},onError:a=>ye(a,t)})}function Fx(s,t){return O.put(`link-page/${s}`,{meta:t}).then(n=>n.data)}function _x({page:s}){return e.jsxs(V,{type:"modal",children:[e.jsx(se,{label:e.jsx(i,{message:"Page options"}),children:e.jsx(P,{className:"text-muted",children:e.jsx(gr,{})})}),e.jsx(Mx,{page:s})]})}function Mx({page:s}){var d,m;const{data:t}=St(),{hasPermission:n}=ie(),a=(t==null?void 0:t.usage.custom_pages.options)||n("admin"),{formId:r,close:o}=U(),l=ne({defaultValues:{hideFooter:!!((d=s.meta)!=null&&d.hideFooter),hideNavbar:!!((m=s.meta)!=null&&m.hideNavbar)}}),c=Ax(s.id,l);return e.jsxs(K,{size:"sm",children:[e.jsx(Z,{children:e.jsx(i,{message:"Link page options"})}),e.jsxs(G,{children:[!a&&e.jsx(an,{className:"mb-24",message:e.jsx(i,{message:"Your current plan does not include link page option editing."})}),e.jsxs(xe,{id:r,form:l,onSubmit:u=>{c.mutate(u,{onSuccess:o})},children:[e.jsx(fs,{className:"mb-24",name:"hideNavbar",disabled:!a,description:e.jsx(i,{message:"Whether navbar should be hidden on this link page."}),children:e.jsx(i,{message:"Hide navbar"})}),e.jsx(fs,{name:"hideFooter",disabled:!a,description:e.jsx(i,{message:"Whether footer should be hidden on this link page."}),children:e.jsx(i,{message:"Hide footer"})})]})]}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>o(),children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:r,disabled:c.isPending||!a,children:e.jsx(i,{message:"Save"})})]})]})}const Ha=[{key:"title",allowsSorting:!0,width:"flex-2 min-w-200",visibleInMode:"all",header:()=>e.jsx(i,{message:"Title"}),body:s=>e.jsx(ge,{target:"_blank",to:`/pages/${s.slug}`,className:Os,children:s.title})},{key:"user_id",allowsSorting:!0,width:"flex-2 min-w-140",header:()=>e.jsx(i,{message:"Owner"}),body:s=>s.user&&e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email})},{key:"updated_at",allowsSorting:!0,width:"w-100",header:()=>e.jsx(i,{message:"Last updated"}),body:s=>e.jsx(Je,{date:s.updated_at})},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-84 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs(x.Fragment,{children:[e.jsx(_x,{page:s}),e.jsx(de,{resource:s,action:"update",children:e.jsx(se,{label:e.jsx(i,{message:"Edit page"}),children:e.jsx(P,{size:"md",className:"text-muted",elementType:ge,to:`${s.id}/edit`,children:e.jsx(Ke,{})})})})]})}];function Rx({forCurrentUser:s}){const t=x.useContext(Ri),{user:n}=ie(),{workspaceId:a}=Le(),{filters:r,columns:o}=x.useMemo(()=>{const c=s?Ha.filter(m=>m.key!=="user_id"):Ha;return{filters:s?Ia(t).filter(m=>m.key!=="user_id"):Ia(t),columns:c}},[s,t]),l=s?n==null?void 0:n.id:"";return e.jsx(ys,{endpoint:"link-page",title:e.jsx(i,{message:"Link pages"}),filters:r,columns:o,headerContent:e.jsx(Tx,{}),queryParams:{userId:l,with:"user",workspaceId:a},actions:e.jsx(Ex,{}),selectedActions:e.jsx(de,{resource:"customPage",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Id,title:e.jsx(i,{message:"No link pages have been created yet"}),filteringTitle:e.jsx(i,{message:"No matching link pages"})})})}function Ex(){return e.jsx(de,{resource:"customPage",action:"create",children:e.jsx(ds,{elementType:ge,to:"new",children:e.jsx(i,{message:"New page"})})})}function Tx(){return e.jsx(Cs,{body:e.jsx(i,{message:"Show a transitional page with fully custom markup. Users who visit the short url will briefly see the page before being redirected to destination url."})})}const Vx=""+new URL("preferences-popup-824a74c6.svg",import.meta.url).href,Ba=[{key:"name",allowsSorting:!0,width:"flex-1 min-w-200",visibleInMode:"all",header:()=>e.jsx(i,{message:"Name"}),body:s=>s.name},{key:"message",allowsSorting:!0,header:()=>e.jsx(i,{message:"Message"}),body:s=>s.message},{key:"btn_text",allowsSorting:!0,header:()=>e.jsx(i,{message:"Button text"}),body:s=>s.btn_text},{key:"color",header:()=>e.jsx(i,{message:"Color"}),body:s=>e.jsx(Yr,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:s.colors["bg-color"]}})},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(Je,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-42 flex-shrink-0",body:s=>e.jsx(de,{resource:s,action:"update",children:e.jsx(P,{className:"text-muted",elementType:ge,to:`${s.id}/edit`,children:e.jsx(Ke,{})})})}],To=[{key:"default",label:h("Default")},{key:"full-width",label:h("Full width")},{key:"rounded",label:h("Rounded")},{key:"pill",label:h("Pill")}],Vo=[{key:"top-left",label:h("Top left")},{key:"top-right",label:h("Top right")},{key:"bottom-left",label:h("Bottom left")},{key:"bottom-right",label:h("Bottom right")}],Ox=[{key:"bg-color",label:h("Background color")},{key:"text-color",label:h("Text color")},{key:"btn-bg-color",label:h("Button background")},{key:"btn-text-color",label:h("Button text")},{key:"label-bg-color",label:h("Label background")},{key:"label-color",label:h("Label text")}],Ua=[{key:"theme",label:h("Theme"),description:h("Theme for the overlay"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"default",options:To.map(s=>({key:s.key,value:s.key,label:s.label}))}},{key:"position",label:h("Position"),description:h("Position for the overlay"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"bottom-left",options:Vo.map(s=>({key:s.key,value:s.key,label:s.label}))}},bs({description:h("Date overlay was created")}),vs({description:h("Date overlay was last updated")}),{key:"user_id",label:h("Owner"),description:h("User overlay belongs to"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}];function $x({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Ba.filter(d=>d.key!=="user_id"):Ba;return{filters:s?Ua.filter(d=>d.key!=="user_id"):Ua,columns:l}},[s]),o=s?t==null?void 0:t.id:"";return e.jsx(ys,{endpoint:"link-overlay",queryParams:{userId:o,with:"user",workspaceId:n},title:e.jsx(i,{message:"Call-to-action overlays"}),headerContent:e.jsx(Hx,{}),filters:a,columns:r,actions:e.jsx(Bx,{}),selectedActions:e.jsx(de,{resource:"linkOverlay",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:Vx,title:e.jsx(i,{message:"No overlays have been added yet"}),filteringTitle:e.jsx(i,{message:"No matching overlays"})})})}function Hx(){return e.jsx(Cs,{body:e.jsx(i,{message:"Display fully customizable, non-intrusive overlay with a message and call-to-action button over destination website."})})}function Bx(){return e.jsx(de,{resource:"linkOverlay",action:"create",children:e.jsx(ds,{to:"new",elementType:ge,children:e.jsx(i,{message:"Add overlay"})})})}function Ux(s){const{trans:t}=$();return Y({mutationFn:n=>qx(n),onSuccess:()=>{J.positive(t(h("Overlay created"))),q.invalidateQueries({queryKey:te("link-overlay")})},onError:n=>ye(n,s)})}function qx(s){return O.post("link-overlay",s).then(t=>t.data)}function Wx(){return e.jsxs("div",{className:"bg-card h-full overflow-hidden",children:[e.jsxs("div",{className:"navbar flex items-center bg-alt h-40 w-full",children:[e.jsx("div",{className:"os-button w-20 h-20 rounded-full ml-14",style:{background:"#d7665d"}}),e.jsx("div",{className:"os-button w-20 h-20 rounded-full ml-14",style:{background:"#deab54"}}),e.jsx("div",{className:"os-button w-20 h-20 rounded-full ml-14",style:{background:"#6fb54c"}})]}),e.jsxs("div",{className:"page-body p-24",children:[e.jsxs("div",{className:"top-row flex items-center h-60 bg-alt p-10 mb-24",children:[e.jsx("div",{className:"circle w-40 h-40 rounded-full mr-auto bg-disabled-bg"}),e.jsx("div",{className:"line w-1/6 h-20 rounded bg-disabled-bg ml-14"}),e.jsx("div",{className:"line w-1/6 h-20 rounded bg-disabled-bg ml-14"}),e.jsx("div",{className:"line w-1/6 h-20 rounded bg-disabled-bg ml-14"})]}),e.jsxs("div",{className:"middle-row flex items-center justify-center flex-col h-[260px] bg-alt my-24",children:[e.jsx("div",{className:"line rounded h-36 mb-20 w-3/5 bg-disabled-bg"}),e.jsx("div",{className:"line rounded h-14 mb-4 w-1/2 bg-disabled-bg/5"}),e.jsx("div",{className:"line rounded h-14 mb-4 w-1/2 bg-disabled-bg/5"}),e.jsx("div",{className:"line rounded h-14 mb-4 w-1/2 bg-disabled-bg/5"})]}),e.jsxs("div",{className:"flex-container flex",children:[e.jsxs("div",{className:"left w-1/3",children:[e.jsx("div",{className:"rect h-144 bg-disabled-bg/5 mb-6"}),e.jsx("div",{className:"line fat-line h-36 mb-10 rounded bg-disabled-bg/5"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"separator h-1 bg-divider my-24"}),e.jsx("div",{className:"rect h-144 bg-disabled-bg/5 mb-10"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"rect h-144 bg-disabled-bg/5 mb-6"})]}),e.jsxs("div",{className:"right w-2/3 pl-24",children:[e.jsx("div",{className:"rect h-288 mb-32 bg-disabled-bg/5"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"line fat-line h-36 mb-10 rounded bg-disabled-bg/5"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"separator h-1 bg-divider my-24"}),e.jsx("div",{className:"line mb-10 h-20 rounded bg-disabled-bg"}),e.jsx("div",{className:"rect h-288 mb-32 bg-disabled-bg/5"})]})]})]})]})}function Oo({form:s,isLoading:t,onSubmit:n}){return e.jsxs(xe,{form:s,onSubmit:n,className:"flex h-full",children:[e.jsx("div",{className:"flex-shrink-0 w-full md:w-288 px-16 md:border-r md:shadow-lg h-full overflow-y-auto",children:e.jsxs(oo,{children:[e.jsxs(io,{expand:!0,children:[e.jsx(et,{children:e.jsx(i,{message:"General"})}),e.jsx(et,{children:e.jsx(i,{message:"Style"})})]}),e.jsxs(lo,{className:"my-24",children:[e.jsxs(st,{children:[e.jsx(Qx,{}),e.jsx(qa,{disabled:t})]}),e.jsxs(st,{children:[e.jsx(Yx,{}),e.jsx(qa,{disabled:t,className:"mt-14"})]})]})]})}),e.jsxs("div",{className:"flex-auto relative hidden md:block",children:[e.jsx(Wx,{}),e.jsx(Zx,{})]})]})}function qa(s){return e.jsx(N,{type:"submit",variant:"flat",color:"primary",...s,children:e.jsx(i,{message:"Save"})})}function Kx(){return e.jsx(jt,{className:"mb-20",name:"colors.bg-image",label:e.jsx(i,{message:"Background image"}),diskPrefix:"overlays",showRemoveButton:!0})}function Gx({name:s,children:t}){const{watch:n,setValue:a}=os(),r=n(`colors.${s}`);return e.jsxs(V,{currentValue:r,type:"popover",placement:"right",offset:10,onClose:o=>{a(`colors.${s}`,o)},children:[e.jsxs(Vs,{className:"flex items-center gap-10 w-full rounded border text-sm h-54 px-14 mb-10 bg relative hover:bg-hover",children:[e.jsx(Yr,{viewBox:"0 0 48 48",className:"icon-lg",style:{fill:r}}),e.jsx("div",{children:t}),e.jsx(Hs,{className:"icon-sm text-muted ml-auto"})]}),e.jsx(Nt,{defaultValue:r,onChange:o=>{a(`colors.${s}`,o)}})]})}function Yx(){return e.jsxs(x.Fragment,{children:[e.jsx(gs,{children:e.jsx(Kx,{})}),Ox.map(({key:s,label:t})=>e.jsx(Gx,{name:s,children:e.jsx(i,{...t})},s))]})}function Qx(){return e.jsxs(x.Fragment,{children:[e.jsx(E,{name:"name",label:e.jsx(i,{message:"Name"}),className:"mb-24",required:!0}),e.jsx(Ne,{name:"position",selectionMode:"single",label:e.jsx(i,{message:"Position"}),className:"mb-24",children:Vo.map(s=>e.jsx(I,{value:s.key,children:e.jsx(i,{...s.label})},s.key))}),e.jsx(Ne,{name:"theme",selectionMode:"single",label:e.jsx(i,{message:"Theme"}),className:"mb-24",children:To.map(s=>e.jsx(I,{value:s.key,children:e.jsx(i,{...s.label})},s.key))}),e.jsx(E,{name:"message",label:e.jsx(i,{message:"Message"}),inputElementType:"textarea",maxLength:200,rows:2,className:"mb-24"}),e.jsx(E,{name:"label",label:e.jsx(i,{message:"Label"}),maxLength:8,className:"mb-24"}),e.jsx(E,{type:"url",name:"btn_link",label:e.jsx(i,{message:"Button link"}),className:"mb-24"}),e.jsx(E,{name:"btn_text",label:e.jsx(i,{message:"Button text"}),maxLength:30,className:"mb-24"})]})}function Zx(){const{watch:s}=os(),t=s();return e.jsx(Ei,{overlay:t})}function Jx(){const{trans:s}=$(),t=ss(),n=ne({defaultValues:{position:"bottom-left",theme:"default",label:s(h("Label")),message:s(h("Your message here")),btn_text:s(h("Button text")),btn_link:"https://google.com",colors:{"bg-color":"rgb(61, 75, 101)","text-color":"rgb(255, 255, 255)","label-bg-color":"rgb(255, 255, 255)","label-color":"rgb(0, 0, 0)"}}}),a=Ux(n);return e.jsx(Oo,{form:n,isLoading:a.isPending,onSubmit:r=>{a.mutate(r,{onSuccess:()=>t("..",{relative:"path"})})}})}const na=s=>`link-overlay/${s}`;function Xx(s){return ze({queryKey:[na(s)],queryFn:()=>eh(s)})}function eh(s){return O.get(na(s)).then(t=>t.data)}function sh(s,t){const{trans:n}=$();return Y({mutationFn:a=>th(s,a),onSuccess:()=>{J.positive(n(h("Overlay updated"))),q.invalidateQueries({queryKey:te("link-overlay")}),q.invalidateQueries({queryKey:[na(s)]})},onError:a=>ye(a,t)})}function th(s,t){return O.put(`link-overlay/${s}`,t).then(n=>n.data)}function nh(){const{overlayId:s}=Re(),{data:t,isLoading:n,isError:a}=Xx(s);if(t)return e.jsx(ah,{overlay:t.linkOverlay});if(n)return e.jsx(Yt,{});if(a)return null}function ah({overlay:s}){const t=ss(),n=ne({defaultValues:{name:s.name,position:s.position,theme:s.theme,label:s.label,message:s.message,btn_text:s.btn_text,btn_link:s.btn_link,colors:s.colors}}),a=sh(s.id,n);return e.jsx(Oo,{form:n,isLoading:a.isPending,onSubmit:r=>{a.mutate(r,{onSuccess:()=>t("../..",{relative:"path"})})}})}const rh=""+new URL("marketing-2040a197.svg",import.meta.url).href,Wa=[{key:"name",allowsSorting:!0,header:()=>e.jsx(i,{message:"Name"}),width:"flex-3 min-w-200",visibleInMode:"all",body:s=>e.jsx("a",{className:Os,href:s.short_url,target:"_blank",rel:"noreferrer",children:s.name})},{key:"clicks_count",allowsSorting:!0,header:()=>e.jsx(i,{message:"Clicks"}),body:s=>s.clicks_count?e.jsx(Be,{value:s.clicks_count}):"-"},{key:"domain_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Domain"}),body:s=>e.jsx(oh,{model:s})},{key:"user_id",allowsSorting:!0,header:()=>e.jsx(i,{message:"Owner"}),width:"flex-2 min-w-140",body:s=>s.user?e.jsx(ws,{image:s.user.avatar,label:s.user.display_name,description:s.user.email}):""},{key:"links_count",allowsSorting:!0,header:()=>e.jsx(i,{message:"Links"}),body:s=>s.links_count?e.jsx(Be,{value:s.links_count}):"-"},{key:"active",allowsSorting:!0,header:()=>e.jsx(i,{message:"Active"}),body:s=>s.active?e.jsx(_s,{className:"icon-md text-positive"}):e.jsx(Ue,{className:"icon-md text-danger"})},{key:"updated_at",allowsSorting:!0,header:()=>e.jsx(i,{message:"Last updated"}),body:s=>s.updated_at?e.jsx(Je,{date:s.updated_at}):""},{key:"actions",header:()=>e.jsx(i,{message:"Actions"}),hideHeader:!0,align:"end",width:"w-128 flex-shrink-0",visibleInMode:"all",body:s=>e.jsxs("div",{className:"text-muted",children:[e.jsx(se,{label:e.jsx(i,{message:"Clicks report"}),children:e.jsx(ge,{to:`${s.id}`,children:e.jsx(P,{size:"md",children:e.jsx(mt,{})})})}),e.jsx(js,{link:s}),e.jsx(de,{resource:s,action:"update",children:e.jsx(ge,{to:`${s.id}/edit/content`,children:e.jsx(P,{size:"md",children:e.jsx(Ke,{})})})})]})}];function oh({model:s}){const{data:t}=Ss(),n=Qn(t==null?void 0:t.domains);return s.domain_id===0&&n?e.jsx(x.Fragment,{children:n}):s.domain_id&&s.domain?e.jsx(x.Fragment,{children:Xe(s.domain.host)}):e.jsx(i,{message:"All domains"})}const Ka=[{key:"active",label:h("Status"),description:h("Whether biolink is disabled or not"),defaultOperator:re.eq,control:{type:H.Select,defaultValue:"01",options:[{key:"01",label:h("Enabled"),value:!0},{key:"02",label:h("Disabled"),value:!1}]}},{key:"clicks_count",label:h("Clicks count"),description:h("Number of times this biolink was visited"),defaultOperator:re.gte,operators:_t,control:{type:H.Input,inputType:"number",defaultValue:1}},{key:"links_count",label:h("Link count"),description:h("Number of links in the biolink"),defaultOperator:re.gte,operators:_t,control:{type:H.Input,inputType:"number",defaultValue:1}},bs({description:h("Date biolink was created")}),vs({description:h("Date biolink was last updated")}),{key:"user_id",label:h("Owner"),description:h("User biolink was created by"),defaultOperator:re.eq,control:{type:H.SelectModel,model:Ns}}];function ih(s){const{trans:t}=$();return Y({mutationFn:n=>lh(n),onSuccess:()=>{J.positive(t(h("Biolink created"))),q.invalidateQueries({queryKey:te("biolink")})},onError:n=>ye(n,s)})}function lh(s){return O.post("biolink",Xn(s)).then(t=>t.data)}function ch(){const s=ss(),{formId:t,close:n}=U(),{custom_domains:a}=me(),{verify:r,isVerifying:o}=bt("link_creation"),l=ne({defaultValues:{active:!0,hash:Mn(6),domain_id:a!=null&&a.allow_all_option?void 0:0}}),c=ih(l),d=async m=>{await r()&&c.mutate(m,{onSuccess:p=>{n(),s(`${p.biolink.id}/edit`)}})};return e.jsxs(K,{size:"md",children:[e.jsx(Z,{children:e.jsx(i,{message:"Create biolink"})}),e.jsx(G,{children:e.jsxs(xe,{form:l,id:t,onBeforeSubmit:()=>{l.clearErrors("hash")},onSubmit:d,children:[e.jsxs("div",{className:"mb-24",children:[e.jsx(E,{name:"name",label:e.jsx(i,{message:"Name"}),minLength:3,className:"mb-8",autoFocus:!0}),e.jsx(rn,{form:l,name:"hash"})]}),e.jsx(Zn,{name:"domain_id",className:"mb-24"}),e.jsx(E,{name:"description",className:"mb-24",label:e.jsx(i,{message:"Description"}),inputElementType:"textarea",rows:2}),e.jsx(fs,{name:"active",description:e.jsx(i,{message:"Whether this biolink is viewable publicly."}),className:"mb-24",children:e.jsx(i,{message:"Active"})})]})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{n()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:t,disabled:c.isPending||o,children:e.jsx(i,{message:"Create"})})]})]})}function dh({forCurrentUser:s}){const{user:t}=ie(),{workspaceId:n}=Le(),{filters:a,columns:r}=x.useMemo(()=>{const l=s?Wa.filter(d=>d.key!=="user_id"):Wa;return{filters:s?Ka.filter(d=>d.key!=="user_id"):Ka,columns:l}},[s]);x.useEffect(()=>{nn()},[]);const o=s?t==null?void 0:t.id:"";return e.jsx(ys,{endpoint:"biolink",queryParams:{userId:o,withCount:"links",with:"user,domain",workspaceId:n},title:e.jsx(i,{message:"Biolinks"}),headerContent:e.jsx(uh,{}),filters:a,columns:r,actions:e.jsx(mh,{}),selectedActions:e.jsx(de,{resource:"biolink",action:"delete",children:e.jsx(ks,{})}),emptyStateMessage:e.jsx(cs,{image:rh,title:e.jsx(i,{message:"No biolinks have been created yet"}),filteringTitle:e.jsx(i,{message:"No matching biolinks"})})})}function uh(){return e.jsx(Cs,{title:e.jsx(i,{message:"Link in bio"}),body:e.jsx(i,{message:"Offer multiple choices to your followers when they click on your Biolink. Share all your Social Media profiles, videos, songs, articles and other important links with just one url."})})}function mh(){return e.jsx(de,{resource:"biolink",action:"create",children:e.jsxs(V,{type:"modal",children:[e.jsx(ds,{children:e.jsx(i,{message:"New biolink"})}),e.jsx(ch,{})]})})}const aa=(s,t)=>te(`biolink/${s}`,t);function xh(){const{biolinkId:s}=Re();return ze({queryKey:aa(s),queryFn:()=>$o(s),initialData:hh(s)})}async function $o(s,t,n){const a=await O.get(`biolink/${s}`,{params:t}).then(r=>r.data);return n==null||n(a),a}function hh(s){var n,a;const t=(a=(n=q.getQueryData(te("biolink")))==null?void 0:n.pagination)==null?void 0:a.data.find(r=>r.id===+s);return t?{biolink:t}:void 0}function fh(){var r;const s=ss(),{biolinkId:t}=Re(),n=xh(),a=(r=n.data)==null?void 0:r.biolink;return e.jsx(tn,{model:`biolink=${t}`,title:e.jsxs(ot,{size:"xl",className:w(n.isLoading&&"invisible"),children:[e.jsx(as,{onSelected:()=>{s("..",{relative:"path"})},children:e.jsx(i,{message:"Biolinks"})}),e.jsx(as,{className:"first-letter:capitalize",children:e.jsx(i,{message:"“:name“ clicks",values:{name:a==null?void 0:a.name}})})]}),actions:a&&e.jsx(js,{className:"flex-shrink-0 text-muted",link:a})})}const ph=A(e.jsx("path",{d:"m16.66 4.52 2.83 2.83-2.83 2.83-2.83-2.83 2.83-2.83M9 5v4H5V5h4m10 10v4h-4v-4h4M9 15v4H5v-4h4m7.66-13.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65zM11 3H3v8h8V3zm10 10h-8v8h8v-8zm-10 0H3v8h8v-8z"}),"WidgetsOutlined"),gh=A(e.jsx("path",{d:"M15 2c-2.71 0-5.05 1.54-6.22 3.78-1.28.67-2.34 1.72-3 3C3.54 9.95 2 12.29 2 15c0 3.87 3.13 7 7 7 2.71 0 5.05-1.54 6.22-3.78 1.28-.67 2.34-1.72 3-3C20.46 14.05 22 11.71 22 9c0-3.87-3.13-7-7-7zM9 20c-2.76 0-5-2.24-5-5 0-1.12.37-2.16 1-3 0 3.87 3.13 7 7 7-.84.63-1.88 1-3 1zm3-3c-2.76 0-5-2.24-5-5 0-1.12.37-2.16 1-3 0 3.86 3.13 6.99 7 7-.84.63-1.88 1-3 1zm4.7-3.3c-.53.19-1.1.3-1.7.3-2.76 0-5-2.24-5-5 0-.6.11-1.17.3-1.7.53-.19 1.1-.3 1.7-.3 2.76 0 5 2.24 5 5 0 .6-.11 1.17-.3 1.7zM19 12c0-3.86-3.13-6.99-7-7 .84-.63 1.87-1 3-1 2.76 0 5 2.24 5 5 0 1.12-.37 2.16-1 3z"}),"AnimationOutlined"),jh=A(e.jsx("path",{d:"m15 5-1.41 1.41L15 7.83 17.17 10H8c-2.76 0-5 2.24-5 5v4h2v-4c0-1.65 1.35-3 3-3h9.17L15 14.17l-1.41 1.41L15 17l6-6-6-6z"}),"ShortcutOutlined"),bh=A([e.jsx("path",{d:"M10 8v6l4.7 2.9.8-1.2-4-2.4V8z"},"0"),e.jsx("path",{d:"M17.92 12c.05.33.08.66.08 1 0 3.9-3.1 7-7 7s-7-3.1-7-7 3.1-7 7-7c.7 0 1.37.1 2 .29V4.23c-.64-.15-1.31-.23-2-.23-5 0-9 4-9 9s4 9 9 9 9-4 9-9c0-.34-.02-.67-.06-1h-2.02z"},"1"),e.jsx("path",{d:"M20 5V2h-2v3h-3v2h3v3h2V7h3V5z"},"2")],"MoreTimeOutlined"),We=Ti()(Vi((s,t)=>({appearance:null,appearanceIsDirty:!1,setAppearanceIsDirty:n=>{s(a=>{a.appearanceIsDirty=n})},biolink:null,setBiolink:n=>{s(a=>{var r;a.biolink=n,a.appearanceIsDirty||(a.appearance=((r=n.appearance)==null?void 0:r.config)||null)})},updateAppearance(n){s(a=>{a.appearanceIsDirty=!0,a.appearance={...a.appearance,...n}})}})));function Ce(){return We.getState()}const Cn={loadContent:!0};function Us(){const s=qs(),t=We(a=>a.biolink),n=ze({queryKey:aa(s,Cn),queryFn:()=>$o(s,Cn,a=>{Ce().setBiolink(a.biolink)})});return{isLoading:n.isLoading,biolink:t,status:n.status,biolinkId:s}}function qs(){const{biolinkId:s}=Re();return+s}function Lt(s){Ce().setBiolink(s),q.setQueryData(aa(s.id,Cn),{biolink:s})}function Ws(){const s=qs();return Y({mutationFn:({item:t,values:n})=>vh(s,t,n),onSuccess:t=>{Lt(t.biolink)},onError:t=>ke(t,h("Could not update content item"))})}function vh(s,t,n){const a={...n,item_id:t.id,item_model_type:t.model_type};return O.put(`biolink/${s}/content-item`,a).then(r=>r.data)}function yh({link:s}){const t=$s(),n=Ot(),{close:a,formId:r}=U(),o=ne({defaultValues:{activates_at:s.activates_at,expires_at:s.expires_at}}),l=Ws(),c=o.watch("activates_at"),d=x.useMemo(()=>c?ir(c,n):t,[c,t,n]);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Schedule"})}),e.jsxs(G,{children:[e.jsxs(xe,{id:r,form:o,onSubmit:async m=>{l.mutate({item:s,values:m},{onSuccess:()=>{J.positive(h("Schedule updated")),a()}})},children:[e.jsx(ct,{name:"activates_at",min:t,className:"mb-24",label:e.jsx(i,{message:"Start date"}),showCalendarFooter:!0}),e.jsx(ct,{name:"expires_at",min:d,className:"mb-24",label:e.jsx(i,{message:"End date"}),showCalendarFooter:!0})]}),e.jsx(kh,{})]}),e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{variant:"text",onClick:()=>{a()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:r,disabled:l.isPending||!o.formState.isDirty,children:e.jsx(i,{message:"Save"})})]})]})}function kh(){const s={b:t=>e.jsx("span",{className:"font-bold",children:t})};return e.jsx(Un,{description:e.jsxs(x.Fragment,{children:[e.jsx("div",{children:e.jsx(i,{message:"Leave <b>start date</b> blank to display this link immediately.",values:s})}),e.jsx("div",{children:e.jsx(i,{message:"Leave <b>end date</b> blank to display this link forever.",values:s})})]})})}function wh({link:s}){const t=$s(),{close:n,formId:a}=U(),r=ne({defaultValues:{leap_until:s.leap_until}}),o=r.formState.isDirty,l=Ws();return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Redirect link"})}),e.jsxs(G,{children:[e.jsx(xe,{id:a,form:r,onSubmit:async c=>{l.mutate({item:s,values:c},{onSuccess:()=>{J.positive(h("Redirect link updated")),n()}})},children:e.jsx(ct,{required:!0,name:"leap_until",min:t,className:"mb-24",label:e.jsx(i,{message:"Redirect until"}),showCalendarFooter:!0})}),e.jsx(Nh,{})]}),e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{variant:"text",onClick:()=>{n()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:a,disabled:!o||l.isPending,children:e.jsx(i,{message:"Save"})})]})]})}function Nh(){return e.jsx(Un,{description:e.jsx(i,{message:"Send all visitors straight to this link, instead of your Biolink, until the specified date. After that date, Biolink will resume to showing normally."})})}function Ch({link:s}){const{close:t,formId:n}=U(),a=ne({defaultValues:{image:s.image}}),r=Ws(),o=a.formState.isDirty;return e.jsxs(K,{size:"sm",children:[e.jsx(Z,{children:e.jsx(i,{message:"Link thumbnail"})}),e.jsx(G,{children:e.jsx(xe,{id:n,form:a,onSubmit:async l=>{r.mutate({item:s,values:l},{onSuccess:()=>{J.positive(h("Thumbnail updated")),t()}})},children:e.jsx(gs,{children:e.jsx(jt,{showRemoveButton:!0,name:"image",diskPrefix:"links"})})})}),e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{variant:"text",onClick:()=>{t()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:n,disabled:r.isPending||!o,children:e.jsx(i,{message:"Save"})})]})]})}const Sh=["none","bounce","flash","pulse","rubberBand","shakeX","shakeY","headShake","swing","tada","wobble","jello","heartBeat"];function Ih({link:s}){const{close:t,formId:n}=U(),a=ne({defaultValues:{animation:s.animation}}),r=a.formState.isDirty,o=Ws();return x.useEffect(()=>{pt(()=>Promise.resolve({}),["./animate.min-a0f1ac67.css"],import.meta.url)},[]),e.jsxs(K,{size:"md",children:[e.jsx(Z,{children:e.jsx(i,{message:"Link animation"})}),e.jsx(G,{children:e.jsxs(xe,{id:n,form:a,onSubmit:async l=>{o.mutate({item:s,values:l},{onSuccess:()=>{J.positive(h("Animation updated")),t()}})},children:[e.jsx(Un,{className:"mb-24",description:e.jsx(i,{message:"Add animation to draw attention to this link. :br Selected animation will repeat five times by default.",values:{br:e.jsx("br",{})}})}),e.jsx("div",{className:"grid gap-14 grid-cols-[repeat(auto-fill,minmax(95px,1fr))]",children:Sh.map((l,c)=>e.jsx(Lh,{animationName:l},c))})]})}),e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{variant:"text",onClick:()=>{t()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:n,disabled:o.isPending||!r,children:e.jsx(i,{message:"Save"})})]})]})}function Lh({animationName:s}){const[t,n]=x.useState(!1),{watch:a,setValue:r}=os(),o=s==="none"?null:s,l=a("animation");return e.jsx("button",{type:"button",onClick:()=>{r("animation",o,{shouldDirty:!0})},onPointerEnter:()=>{n(!0)},onPointerLeave:()=>{n(!1)},className:w("border border-2 px-10 h-64 uppercase font-medium rounded flex items-center justify-center animate__animated",t&&`animate__${s}`,l===o&&"border-primary"),children:s})}function Dh(){const s=qs();return Y({mutationFn:t=>Ph(s,t),onSuccess:t=>{Lt(t.biolink)},onError:t=>ke(t)})}function Ph(s,t){return O.post(`biolink/${s}/content-item/detach`,t).then(n=>n.data)}function zh({item:s}){const t=Dh();return e.jsxs(V,{type:"modal",children:[e.jsx(P,{className:"text-muted flex-shrink-0",disabled:t.isPending,children:e.jsx(Ue,{})}),e.jsx(ps,{isDanger:!0,onConfirm:()=>{t.mutate({item:s})},title:e.jsx(i,{message:"Remove item"}),body:e.jsx(i,{message:"Are you sure you want to remove this item from the biolink?"}),confirm:e.jsx(i,{message:"Remove"})})]})}function Ho(){const s=qs();return Y({mutationFn:t=>Ah(s,t)})}function Ah(s,{oldIndex:t,newIndex:n,widgetToPin:a}){const r=Ce().biolink,o=ro(r.content,t,n);a&&(o[n]={...o[n],pinned:"top"}),Ce().setBiolink({...r,content:o});const l=o.map(c=>({id:c.id,model_type:c.model_type}));return O.post(`biolink/${s}/change-order`,{order:l,widgetToPin:a})}function ra({item:s,biolink:t,title:n,updateDialog:a,children:r,actionRow:o}){const l=Ho(),c=x.useRef(null),d=!s||s.pinned!=null,{sortableProps:m,dragHandleRef:u}=vd({item:s||"noop",items:(t==null?void 0:t.content)||[],type:"biolinkEditorSortable",ref:c,onSortEnd:(p,f)=>{l.mutate({oldIndex:p,newIndex:f})},disabled:d});return e.jsxs("div",{className:"mb-20 flex h-172 items-stretch rounded-panel border bg-paper shadow",ref:c,...m,children:[e.jsx("button",{type:"button",className:w("flex-shrink-0 border-r px-10 text-muted",!d&&"hover:text-primary"),disabled:d,ref:u,children:e.jsx(cd,{})}),e.jsxs("div",{className:"min-w-0 flex-auto p-24",children:[e.jsxs("div",{className:"flex items-center",children:[n&&e.jsx("div",{className:"mb-4 mr-auto flex-auto overflow-hidden overflow-ellipsis whitespace-nowrap font-medium",children:n}),a&&e.jsxs(V,{type:"modal",children:[e.jsx(N,{className:"ml-20 flex-shrink-0",variant:"text",color:"primary",startIcon:e.jsx(Ke,{}),children:e.jsx(i,{message:"Edit"})}),a]}),t&&s&&e.jsx(zh,{item:s})]}),e.jsx("div",{className:"mb-20",children:r}),o]})]})}const Bo=["groups","seo","enabled","alias"];function Fh({item:s,biolink:t}){const a=`biolink/${qs()}/link/${s.id}`;return e.jsx(ra,{item:s,biolink:t,title:s.name,actionRow:e.jsx(_h,{link:s,biolink:t}),updateDialog:e.jsx(Lo,{endpoint:a,link:s,showButtonLabelField:!0,hiddenFields:Bo,onSuccess:r=>{Lt(r.biolink)}}),children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(ns,{url:s.long_url}),e.jsx("a",{href:s.short_url,target:"_blank",className:"hover:underline whitespace-nowrap overflow-hidden overflow-ellipsis text-muted text-sm",rel:"noreferrer",children:Xe(s.long_url)})]})})}function _h({link:s,biolink:t}){const n=Ws();return e.jsxs("div",{className:"flex md:gap-24 md:justify-between h-42 items-center",children:[e.jsxs("div",{className:"flex items-center text-muted",children:[e.jsx(yt,{checked:s.active,disabled:s.active_locked||n.isPending,onChange:()=>{n.mutate({item:s,values:{active:!s.active}})}}),e.jsxs(V,{type:"popover",children:[e.jsx(se,{label:e.jsx(i,{message:"Change thumbnail"}),children:e.jsx(P,{className:"ml-10",color:s.image?"primary":null,children:e.jsx(Rn,{})})}),e.jsx(Ch,{link:s})]}),e.jsxs(V,{type:"popover",children:[e.jsx(se,{label:e.jsx(i,{message:"Animation"}),children:e.jsx(P,{color:s.animation?"primary":null,children:e.jsx(gh,{})})}),e.jsx(Ih,{link:s})]}),e.jsxs(V,{type:"popover",children:[e.jsx(se,{label:e.jsx(i,{message:"Redirect"}),children:e.jsx(P,{color:s.leap_until?"primary":null,children:e.jsx(jh,{})})}),e.jsx(wh,{link:s})]}),e.jsxs(V,{type:"popover",children:[e.jsx(se,{label:e.jsx(i,{message:"Schedule"}),children:e.jsx(P,{color:s.expires_at||s.activates_at?"primary":null,children:e.jsx(bh,{})})}),e.jsx(yh,{link:s})]})]}),e.jsx(Mh,{link:s})]})}function Mh({link:s}){const t=ve();if(Sn("(max-width: 380px)"))return null;const a=`../../../../links/${s.id}`,r=t?e.jsx(P,{className:"text-muted flex-shrink-0",elementType:ge,to:a,relative:"path",children:e.jsx(mt,{})}):e.jsx(N,{variant:"text",className:"text-muted",startIcon:e.jsx(mt,{}),elementType:ge,to:a,relative:"path",children:e.jsx(i,{message:":count clicks",values:{count:s.clicks_count}})});return e.jsx(se,{label:e.jsx(i,{message:":count lifetime clicks",values:{count:s.clicks_count}}),children:r})}function Rh(s,t){const{trans:n}=$();return Y({mutationFn:a=>Eh(t,a),onSuccess:()=>{J.positive(n(h("Biolink updated"))),q.invalidateQueries({queryKey:te("biolink")})},onError:a=>ye(a,s)})}function Eh(s,t){return O.put(`biolink/${s}`,Xn(t)).then(n=>n.data)}const Th=["type","groups","title"];function Vh(){const{biolink:s}=Us();return s?e.jsx(Oh,{biolink:s}):e.jsx("div",{className:"py-24",children:e.jsx(Yt,{})})}function Oh({biolink:s}){const t=ne({defaultValues:Io(s)}),n=Rh(t,s.id);return e.jsxs(xe,{form:t,onBeforeSubmit:()=>{t.clearErrors("hash")},onSubmit:a=>{n.mutate(a)},children:[e.jsx("div",{className:"mb-24",children:e.jsx(N,{type:"submit",variant:"flat",color:"primary",disabled:n.isPending||!t.formState.isDirty,children:e.jsx(i,{message:"Update"})})}),e.jsxs("div",{className:"mb-24",children:[e.jsx(E,{name:"name",label:e.jsx(i,{message:"Name"}),minLength:3,className:"mb-8",autoFocus:!0}),e.jsx(rn,{form:t,name:"hash"})]}),e.jsx(Jn,{hiddenFields:Th,linkName:e.jsx(i,{message:"biolink"})})]})}function $h(s,t){const{trans:n}=$();return Y({mutationFn:a=>Hh(s,a),onSuccess:(a,r)=>{J.positive(n(r.widgetId?h("Widget added"):h("Widget updated"))),Lt(a.biolink)},onError:a=>ye(a,t)})}function Hh(s,{widgetId:t,...n}){return(t?O.put(`biolink/${s}/widget/${t}`,n):O.post(`biolink/${s}/widget`,n)).then(r=>r.data)}function ts({biolink:s,widget:t,type:n,defaultValues:a,children:r,onSubmit:o}){const l=on[n],c=x.useMemo(()=>{const f=(t==null?void 0:t.config)||a;return Array.isArray(f)&&f.length===0||!f?void 0:f},[t==null?void 0:t.config,a]),d=ne({defaultValues:c}),{formId:m,close:u}=U(),p=$h(s.id,d);return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{...l.name})}),e.jsx(G,{children:e.jsx(xe,{form:d,id:m,onSubmit:async f=>{const g=o?await o(f,d):f;g!==void 0&&p.mutate({widgetId:t==null?void 0:t.id,config:g,type:n,position:!t&&n===Ee.Socials?s.content.length+1:void 0},{onSuccess:()=>u()})},children:r})}),e.jsxs(X,{children:[e.jsx(N,{variant:"text",onClick:()=>{u()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:m,disabled:p.isPending||!d.formState.isDirty,children:t?e.jsx(i,{message:"Update"}):e.jsx(i,{message:"Add"})})]})]})}function Bh({biolink:s,widget:t}){const{trans:n}=$();return e.jsxs(ts,{biolink:s,type:Ee.Image,widget:t,children:[e.jsx(gs,{children:e.jsx(jt,{name:"url",diskPrefix:"widgets",required:!0})}),e.jsxs(Ne,{className:"my-24",name:"type",label:e.jsx(i,{message:"Style"}),selectionMode:"single",children:[e.jsx(I,{value:"default",children:e.jsx(i,{message:"Default"})}),e.jsx(I,{value:"avatar",children:e.jsx(i,{message:"Avatar"})})]}),e.jsx(E,{placeholder:n(h("Optional")),name:"destinationUrl",type:"url",label:e.jsx(i,{message:"Destination url"}),description:e.jsx(i,{message:"Redirect user to this url when clicking the image."})})]})}const Uh=""+new URL("image-d8dc8345.png",import.meta.url).href,qh=""+new URL("text-e5f73930.png",import.meta.url).href,Wh=""+new URL("socials-7d34b331.png",import.meta.url).href,Kh=""+new URL("youtube-8639db0d.png",import.meta.url).href,Gh=""+new URL("soundcloud-a6ae8fd9.png",import.meta.url).href,Yh=""+new URL("vimeo-f698adf6.jpeg",import.meta.url).href,Qh=""+new URL("spotify-45316d66.png",import.meta.url).href,Zh=""+new URL("twitch-7d18ac0c.svg",import.meta.url).href,Jh=""+new URL("tiktok-956e4d3e.png",import.meta.url).href;function Xh({biolink:s,widget:t}){const{trans:n}=$();return e.jsx(ts,{biolink:s,type:Ee.Youtube,widget:t,onSubmit:(a,r)=>{if(!yr(a.url).id)r.setError("url",{message:n(h("Invalid youtube url"))});else return Promise.resolve(a)},children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://www.youtube.com/watch?v=YE7VzlLtp-4",name:"url",type:"url",label:e.jsx(i,{message:"Youtube video url"}),description:e.jsx(i,{message:"Embed this youtube video within biolink."})})})}function ef({biolink:s,widget:t}){return e.jsxs(ts,{biolink:s,type:Ee.Text,widget:t,children:[e.jsx(E,{className:"mb-24",required:!0,autoFocus:!0,name:"title",label:e.jsx(i,{message:"Title"})}),e.jsx(E,{name:"description",inputElementType:"textarea",rows:2,label:e.jsx(i,{message:"Description"})})]})}function sf({biolink:s,widget:t}){return e.jsx(ts,{biolink:s,type:Ee.Socials,widget:t,onSubmit:n=>Promise.resolve(br(n)),children:Object.entries(Oi).map(([n,a],r)=>{const o=a.icon;return e.jsx(E,{autoFocus:r===0,className:"mb-24",name:n,placeholder:a.placeholder,label:e.jsx(i,{...a.name}),pattern:a.pattern,type:a.inputType,autoComplete:"off",startAdornment:o&&e.jsx(o,{})},n)})})}function tf({biolink:s,widget:t}){return e.jsx(ts,{biolink:s,type:Ee.Twitch,widget:t,children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://www.twitch.tv/kasparovchess",name:"url",type:"url",pattern:"https://(www.)?twitch.tv/.*",label:e.jsx(i,{message:"Twitch channel or clip url"}),description:e.jsx(i,{message:"Embed this twitch channel or clip within biolink."})})})}function nf({biolink:s,widget:t}){const{trans:n}=$();return e.jsx(ts,{biolink:s,type:Ee.Soundcloud,widget:t,onSubmit:async(a,r)=>{var u;const o=encodeURIComponent(a.url),c=(await fetch(`https://soundcloud.com/oembed?format=json&url=${o}`).then(p=>p.json())).html,d=document.createElement("div");d.innerHTML=c;const m=(u=d.querySelector("iframe"))==null?void 0:u.src;if(m)return{...a,embedUrl:m};r.setError("url",{message:n(h("Invalid soundcloud url"))})},children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://soundcloud.com/artist/track",name:"url",type:"url",label:e.jsx(i,{message:"Soundcloud track url"}),description:e.jsx(i,{message:"Embed this soundcloud track within biolink."})})})}function af({biolink:s,widget:t}){const{trans:n}=$();return e.jsx(ts,{biolink:s,type:Ee.Vimeo,widget:t,onSubmit:(a,r)=>{if(!yr(a.url).id)r.setError("url",{message:n(h("Invalid vimeo url"))});else return Promise.resolve(a)},children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://vimeo.com/1084537",name:"url",type:"url",label:e.jsx(i,{message:"Vimeo video url"}),description:e.jsx(i,{message:"Embed this vimeo video within biolink."})})})}function rf({biolink:s,widget:t}){const{trans:n}=$();return e.jsx(ts,{biolink:s,type:Ee.Spotify,widget:t,onSubmit:(a,r)=>{const o=$i(a.url);if(!("id"in o))r.setError("url",{message:n(h("Invalid spotify url"))});else return Promise.resolve({...a,type:o.type})},children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://open.spotify.com/track/2sqfLwGKXDw1nGjFhH3GGX?si=f329040f45804ec5",name:"url",type:"url",label:e.jsx(i,{message:"Spotify share url"}),description:e.jsx(i,{message:"Any share url from spotify can be used, including artist, album, track, playlist etc."})})})}function of({biolink:s,widget:t}){const{trans:n}=$();return e.jsx(ts,{biolink:s,type:Ee.Tiktok,widget:t,onSubmit:(a,r)=>{if(!a.url.includes("tiktok.com/"))r.setError("url",{message:n(h("Invalid tiktok url"))});else return Promise.resolve(a)},children:e.jsx(E,{required:!0,autoFocus:!0,placeholder:"https://www.tiktok.com/@bts_official_bighit/video/6964945720885464322",name:"url",type:"url",label:e.jsx(i,{message:"Tiktok url"}),description:e.jsx(i,{message:"Embed this tiktok video within biolink."})})})}var Ee=(s=>(s.Image="image",s.Text="text",s.Socials="socials",s.Youtube="youtube",s.Soundcloud="soundcloud",s.Vimeo="video",s.Spotify="spotify",s.Twitch="twitch",s.Tiktok="tiktok",s))(Ee||{});const on={image:{name:h("Image"),image:Uh,description:h("Upload an image and optionally add a link it will redirect to when clicked."),dialog:Bh},text:{name:h("Text"),image:qh,description:h("Add title and optional description. Can be used as a header for the whole biolink or a group of multiple widgets."),dialog:ef},socials:{name:h("Social Links"),image:Wh,description:h("Add your socials links to display them as icon buttons."),dialog:sf},youtube:{name:h("Youtube Video"),image:Kh,description:h("Paste a YouTube video URL to show it as a video embed in your profile."),dialog:Xh},soundcloud:{name:h("Soundcloud Audio"),image:Gh,description:h("Paste a SoundCloud URL to show it as a playable song in your profile."),dialog:nf},video:{name:h("Vimeo Video"),image:Yh,description:h("Paste a vimeo URL to show it as a video embed in your profile."),dialog:af},spotify:{name:h("Spotify Embed"),image:Qh,description:h("Paste a spotify song, album, artist, playlist, podcast or episode url to show it as an embed in your profile."),dialog:rf},twitch:{name:h("Twitch Embed"),image:Zh,description:h("Paste twitch profile or clip url to show it as an embed in your profile."),dialog:tf},tiktok:{name:h("TikTok Embed"),image:Jh,description:h("Paste TikTok video url to show it as an embed in your profile."),dialog:of}};function lf(){const{close:s}=U();return e.jsxs(K,{size:"xl",children:[e.jsx(Z,{titleTextSize:"text-md",padding:"px-24 pt-14 pb-4",children:e.jsx(i,{message:"Add widget"})}),e.jsx(G,{padding:"p-24",children:e.jsx("div",{className:"grid gap-14 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:Object.entries(on).map(([t,n])=>e.jsxs("div",{className:"bg-paper border rounded p-14 shadow cursor-pointer hover:bg-primary/hover",role:"button",tabIndex:0,onClick:()=>{s(t)},children:[e.jsx("img",{src:n.image,alt:"",className:"block w-54 h-54 mb-20 mr-auto"}),e.jsx("div",{className:"text-primary text-lg font-semibold whitespace-nowrap overflow-hidden overflow-ellipsis",children:e.jsx(i,{...n.name})}),e.jsx("div",{className:"text-muted",children:e.jsx(i,{...n.description})})]},t))})})]})}function cf({activeWidget:s,biolink:t,onOpenChange:n}){const a=s?on[s].dialog:null;return e.jsx(V,{type:"modal",isOpen:s!=null,onOpenChange:n,children:a&&e.jsx(a,{biolink:t})})}const At=A(e.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}),"ArrowUpwardOutlined");function df({item:s,biolink:t}){const n=on[s.type],a=Hi[s.type],r=n.dialog;return e.jsx(ra,{biolink:t,item:s,title:e.jsx(i,{...n.name}),updateDialog:e.jsx(r,{widget:s,biolink:t}),actionRow:e.jsx(uf,{widget:s}),children:e.jsx(a,{widget:s,variant:"editor"})})}function uf({widget:s}){const t=Ws(),n=Ho(),a=()=>{const r=Ce().biolink;if(!r)return;const o=r.content.filter(l=>l.pinned==="top").length;if(s.pinned)t.mutate({item:s,values:{pinned:null}});else{const l=r.content.findIndex(c=>c.model_type===s.model_type&&c.id===s.id);n.mutate({oldIndex:l,newIndex:o,widgetToPin:s.id})}};return e.jsxs("div",{className:"flex items-center gap-24 justify-between text-muted h-42",children:[e.jsx(yt,{checked:s.active,disabled:t.isPending,onChange:()=>{t.mutate({item:s,values:{active:!s.active}})}}),e.jsx(N,{variant:"outline",size:"2xs",radius:"rounded-full",color:s.pinned==="top"?"primary":void 0,startIcon:s.pinned==="top"?e.jsx(Js,{}):e.jsx(At,{}),disabled:n.isPending,onClick:a||t.isPending,children:s.pinned==="top"?e.jsx(i,{message:"Unpin from top"}):e.jsx(i,{message:"Pin to top"})})]})}function mf(){const{biolink:s}=Us(),t=We(a=>a.appearance);return Pr()?null:e.jsxs("div",{className:"flex-shrink-0 sticky top-24 h-max",children:[e.jsx(Bt,{size:"sm",color:"positive",radius:"rounded",className:"w-max m-auto mb-24",children:e.jsx(i,{message:"Live preview"})}),e.jsx(xf,{children:s?e.jsx(Bi,{biolink:s,appearance:t}):null}),e.jsx("div",{className:"text-sm text-muted text-center mt-14",children:e.jsx(i,{message:"Scheduled and disabled content is not shown"})})]})}function xf({children:s}){return e.jsx("div",{className:"w-350 h-[724px] rounded-[64px] shadow-lg border border-[#444546] border-[12px] overflow-hidden",children:e.jsx("div",{className:"overflow-y-auto h-full compact-scrollbar",children:s})})}const oa=A(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"),Uo=A(e.jsx("path",{d:"M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z"}),"GradientOutlined"),Ks=x.forwardRef(({isActive:s,children:t,className:n,style:a,label:r,...o},l)=>e.jsxs("button",{type:"button",...o,ref:l,children:[e.jsx("span",{className:w("flex aspect-square items-center justify-center overflow-hidden rounded-panel border border-[#c3cbdc] outline-none focus-visible:ring",s&&"ring-2 ring-primary ring-offset-2",n),style:a,children:t}),e.jsx("span",{className:"mt-10 block overflow-hidden overflow-ellipsis text-xs",children:r})]})),zs={type:"color",id:"c-custom",label:h("Custom color")},hf=eo.map((s,t)=>({...zs,id:`c${t}`,backgroundColor:s.color,label:s.name,color:s.foreground}));function ff({value:s,onChange:t,className:n}){return e.jsxs("div",{className:n,children:[e.jsx(pf,{value:s,onChange:t}),hf.map(a=>e.jsx(Ks,{label:e.jsx(i,{...a.label}),isActive:(s==null?void 0:s.id)===a.id,style:{backgroundColor:a.backgroundColor},onClick:()=>{t==null||t({...zs,...a})}},a.id))]})}function pf({value:s,onChange:t}){const n=(s==null?void 0:s.id)===zs.id;return e.jsxs(V,{currentValue:s,type:"popover",onClose:a=>{t==null||t(typeof a=="string"?{...zs,backgroundColor:a}:a)},children:[e.jsx(Ks,{label:e.jsx(i,{...zs.label}),className:"border-dashed border-2",style:{backgroundColor:n?s==null?void 0:s.backgroundColor:void 0},children:e.jsx("span",{className:"inline-block text-white bg-black/20 rounded p-10",children:e.jsx(oa,{size:"lg"})})}),e.jsx(Nt,{defaultValue:s==null?void 0:s.backgroundColor,onChange:a=>{t==null||t({...zs,backgroundColor:a})}})]})}const le={type:"gradient",id:"g-custom",label:h("Custom gradient")},ia=[{...le,...le,id:"g1",backgroundImage:"linear-gradient(45deg, #ff9a9e, #fad0c4)",label:h("Worm flame")},{...le,id:"g2",backgroundImage:"linear-gradient(0deg, #a18cd1, #fbc2eb)",label:h("Night fade")},{...le,id:"g3",backgroundImage:"linear-gradient(120deg, #a1c4fd, #c2e9fb)",label:h("Winter nova")},{...le,id:"g4",backgroundImage:"linear-gradient(0deg, #cfd9df, #e2ebf0)",label:h("Heavy rain")},{...le,id:"g5",backgroundImage:"linear-gradient(120deg, #fdfbfb, #ebedee)",label:h("Cloudy knoxville")},{...le,id:"g6",backgroundImage:"linear-gradient(0deg, #a8edea, #fed6e3)",label:h("Rare wind")},{...le,id:"g7",backgroundImage:"linear-gradient(135deg, #f5f7fa, #c3cfe2)",label:h("Saint petersburg")},{...le,id:"g8",backgroundImage:"linear-gradient(135deg, #fdfcfb, #e2d1c3)",label:h("Everlasting sky")},{...le,id:"g9",backgroundImage:"linear-gradient(0deg, #c1dfc4, #deecdd)",label:h("Soft grass")},{...le,id:"g10",backgroundImage:"linear-gradient(90deg, #E9E4F0, #D3CCE3)",label:h("Delicate")},{...le,id:"g11",backgroundImage:"linear-gradient(90deg, #fffcdc, #d9a7c7)",label:h("Broken hearts")},{...le,id:"g12",backgroundImage:"linear-gradient(90deg, #56ab2f, #a8e063)",label:h("Lush"),color:"rgb(255, 255, 255)"},{...le,id:"g13",backgroundImage:"linear-gradient(90deg, #606c88, #3f4c6b)",label:h("Ash"),color:"rgb(255, 255, 255)"},{...le,id:"g14",backgroundImage:"linear-gradient(90deg, #ece9e6, #ffffff)",label:h("Clouds")},{...le,id:"g15",backgroundImage:"linear-gradient(90deg, #f09819, #edde5d)",label:h("Mango pulp")},{...le,id:"g16",backgroundImage:"linear-gradient(90deg, #b79891, #94716b)",label:h("Cooper"),color:"rgb(255, 255, 255)"},{...le,id:"g17",backgroundImage:"linear-gradient(60deg, #29323c, #485563)",label:h("Vicious stance"),color:"rgb(255, 255, 255)"}],gf=A(e.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"}),"ArrowForwardOutlined");function jf({value:s,onChange:t,className:n}){return e.jsxs("div",{className:n,children:[e.jsx(bf,{value:s,onChange:t}),ia.map(a=>e.jsx(Ks,{label:a.label&&e.jsx(i,{...a.label}),isActive:(s==null?void 0:s.id)===a.id,style:{backgroundImage:a.backgroundImage},onClick:()=>{t==null||t({...le,...a})}},a.backgroundImage))]})}function bf({value:s,onChange:t}){const n=(s==null?void 0:s.id)===le.id;return e.jsxs(V,{type:"popover",currentValue:s,onOpenChange:a=>{a&&!s&&(t==null||t(ia[0]))},onClose:a=>{t==null||t(a)},children:[e.jsx(Ks,{label:e.jsx(i,{...le.label}),className:"border-2 border-dashed",style:{backgroundImage:n?s==null?void 0:s.backgroundImage:void 0},children:e.jsx("span",{className:"inline-block rounded bg-black/20 p-10 text-white",children:e.jsx(Uo,{size:"lg"})})}),e.jsx(vf,{defaultValue:s,onChange:a=>{t==null||t(a)}})]})}function vf({defaultValue:s=ia[0],onChange:t}){const{close:n}=U(),[a,r]=x.useState(()=>{var d;const c=((d=s==null?void 0:s.backgroundImage)==null?void 0:d.match(/\(([0-9]+deg),.?(.+?),.?(.+?)\)/))||[];return{angle:c[1]||"45deg",colorOne:c[2]||"#ff9a9e",colorTwo:c[3]||"#fad0c4"}}),o=c=>({...le,backgroundImage:`linear-gradient(${c.angle}, ${c.colorOne}, ${c.colorTwo})`}),l=x.useCallback(c=>{const d={...a,...c};r(d),t(o(d))},[a,t]);return e.jsxs(K,{size:"sm",children:[e.jsx(Z,{children:e.jsx(i,{message:"Custom gradient"})}),e.jsxs(G,{children:[e.jsx("div",{className:"mb-6",children:e.jsx(i,{message:"Colors"})}),e.jsxs("div",{className:"mb-20 flex h-40 items-stretch",children:[e.jsx(Ga,{className:"rounded-input",value:a.colorOne,onChange:c=>l({colorOne:c})}),e.jsx("div",{className:"flex-auto border-y border-[#c3cbdc]",style:{backgroundImage:o(a).backgroundImage}}),e.jsx(Ga,{className:"rounded-r-input",value:a.colorTwo,onChange:c=>l({colorTwo:c})})]}),e.jsx("div",{className:"mb-6",children:e.jsx(i,{message:"Direction"})}),e.jsx(yf,{value:a.angle,onChange:c=>l({angle:c})})]}),e.jsxs(X,{dividerTop:!0,children:[e.jsx(N,{onClick:()=>n(),children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",onClick:()=>{n(o(a))},children:e.jsx(i,{message:"Apply"})})]})]})}function Ga({className:s,value:t,onChange:n}){return e.jsxs(V,{type:"popover",children:[e.jsx(se,{label:e.jsx(i,{message:"Click to change color"}),children:e.jsx("button",{type:"button",className:w("w-40 flex-shrink-0 border border-[#c3cbdc]",s),style:{backgroundColor:t}})}),e.jsx(Nt,{defaultValue:t,onChange:n,hideFooter:!0})]})}function yf({value:s,onChange:t}){const n="text-primary border-primary";return e.jsxs("div",{className:"flex flex-wrap items-center gap-8 text-muted",children:[e.jsx(P,{variant:"outline",className:s==="0deg"?n:void 0,onClick:()=>t("0deg"),children:e.jsx(At,{})}),e.jsx(P,{variant:"outline",className:s==="180deg"?n:void 0,onClick:()=>t("180deg"),children:e.jsx(Js,{})}),e.jsx(P,{variant:"outline",className:s==="90deg"?n:void 0,onClick:()=>t("90deg"),children:e.jsx(gf,{})}),e.jsx(P,{variant:"outline",className:s==="135deg"?n:void 0,onClick:()=>t("135deg"),children:e.jsx(Js,{className:"-rotate-45"})}),e.jsx(P,{variant:"outline",className:s==="225deg"?n:void 0,onClick:()=>t("225deg"),children:e.jsx(Js,{className:"rotate-45"})}),e.jsx(P,{variant:"outline",className:s==="45deg"?n:void 0,onClick:()=>t("45deg"),children:e.jsx(At,{className:"rotate-45"})}),e.jsx(P,{variant:"outline",className:s==="325deg"?n:void 0,onClick:()=>t("325deg"),children:e.jsx(At,{className:"-rotate-45"})})]})}const kf=""+new URL("Angled-Focus-176ea4bb.svg",import.meta.url).href,wf=""+new URL("Circular-Focus-ca4d12f0.svg",import.meta.url).href,Nf=""+new URL("Farseeing-Eyeball-aa4a0249.svg",import.meta.url).href,Cf=""+new URL("Canyon-Funnel-b2e2eaf0.svg",import.meta.url).href,Sf=""+new URL("Looney-Loops-6f56821b.svg",import.meta.url).href,If=""+new URL("Hurricane-Aperture-35c89ecf.svg",import.meta.url).href,Lf=""+new URL("Icy-Explosion-988bfd47.svg",import.meta.url).href,Df=""+new URL("Protruding-Squares-b00abf9b.svg",import.meta.url).href,Pf=""+new URL("Alternating-Triangles-d5e42a92.svg",import.meta.url).href,zf=""+new URL("Monstera-Patch-69fc9117.svg",import.meta.url).href,Af=""+new URL("Confetti-Doodles-d1c20c3c.svg",import.meta.url).href,Ff=""+new URL("Threads-Ahead-28db1646.svg",import.meta.url).href,_f=""+new URL("Launch-Day-f2926785.svg",import.meta.url).href,Mf=""+new URL("Sprinkle-d1a9b59f.svg",import.meta.url).href,Rf=""+new URL("Circuit-Board-b3635293.svg",import.meta.url).href,Ef=""+new URL("nuclear-focalpoint-166680aa.svg",import.meta.url).href,Tf=""+new URL("Snow-424582cb.svg",import.meta.url).href,ce={type:"image",id:"i-custom",label:h("Custom image")},Vf=[{...ce,id:"img0",backgroundColor:"#ee5522",backgroundImage:`url(${Df})`,backgroundRepeat:"repeat",label:h("Protruding squares"),color:"#fff"},{...ce,id:"img1",backgroundColor:"#00bbff",backgroundImage:`url(${_f})`,label:h("Launch day"),backgroundSize:"contain",backgroundPosition:"bottom",backgroundRepeat:"no-repeat",color:"#fff"},{...ce,id:"img2",backgroundColor:"#fff",backgroundImage:`url(${Pf})`,label:h("Alternating triangles"),color:"#000"},{...ce,id:"img3",backgroundColor:"#002200",backgroundImage:`url(${zf})`,label:h("Monstera patch"),color:"#fff"},{...ce,id:"img4",backgroundColor:"#aa3333",backgroundImage:`url(${Af})`,label:h("Confetti doodles"),color:"#fff",backgroundRepeat:"repeat",backgroundPosition:"center center",backgroundSize:"contain"},{...ce,id:"img5",backgroundColor:"#070014",backgroundImage:`url(${If})`,label:h("Hurricane aperture"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center center",color:"#fff"},{...ce,id:"img6",backgroundColor:"#11ddaa",backgroundImage:`url(${Sf})`,label:h("Looney loops"),backgroundPosition:"center center",backgroundSize:"cover",color:"#000"},{...ce,id:"img7",backgroundColor:"#ccffff",backgroundImage:`url(${Lf})`,label:h("Icy explosion"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center center",color:"#000"},{...ce,id:"img8",backgroundColor:"#442233",backgroundImage:`url(${Ef})`,label:h("Nuclear point"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center center",color:"#fff"},{...ce,id:"img9",backgroundColor:"#ffdd55",backgroundImage:`url(${kf})`,label:h("Angled focus"),backgroundPosition:"center center",backgroundSize:"cover",color:"#fff"},{...ce,id:"img10",backgroundColor:"#220044",backgroundImage:`url(${wf})`,label:h("Circular focus"),backgroundPosition:"center center",backgroundSize:"cover",color:"#fff"},{...ce,id:"img11",backgroundColor:"#000000",backgroundImage:`url(${Nf})`,label:h("Farseeing eyeball"),backgroundPosition:"center center",backgroundSize:"cover",color:"#fff"},{...ce,id:"img12",backgroundColor:"#ff0000",backgroundImage:`url(${Cf})`,label:h("Canyon funnel"),backgroundPosition:"center center",backgroundSize:"cover",color:"#fff"},{...ce,id:"img13",backgroundColor:"#ffdd99",backgroundImage:`url(${Ff})`,label:h("Threads ahead"),color:"#000",backgroundRepeat:"no-repeat"},{...ce,id:"img14",backgroundImage:`url(${Mf})`,label:h("Sprinkle"),backgroundRepeat:"repeat",backgroundPosition:"center center"},{...ce,id:"img15",backgroundImage:`url(${Rf})`,label:h("Circuit board"),backgroundRepeat:"repeat",backgroundPosition:"center center"},{...ce,id:"img16",backgroundImage:`url(${Tf})`,label:h("Snow"),backgroundRepeat:"repeat",backgroundPosition:"center center"}],Of=A(e.jsx("path",{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}),"UploadOutlined"),$f={cover:{label:h("Stretch to fit"),bgConfig:{backgroundRepeat:"no-repeat",backgroundSize:"cover"}},contain:{label:h("Fit image"),bgConfig:{backgroundRepeat:"no-repeat",backgroundSize:"contain",backgroundPosition:"center top"}},repeat:{label:h("Repeat image"),bgConfig:{backgroundRepeat:"repeat",backgroundSize:void 0,backgroundPosition:"left top"}}};function Hf({value:s,onChange:t}){const n=Bf(s);return e.jsx("div",{className:"border-t mt-20 pt-14",children:e.jsx(Ui,{size:"sm",disabled:!s,children:Object.entries($f).map(([a,r])=>e.jsx(qi,{name:"background-position",value:a,checked:a===n,onChange:o=>{s&&(t==null||t({...s,...r.bgConfig}))},children:e.jsx(i,{...r.label})},a))})})}function Bf(s){return(s==null?void 0:s.backgroundSize)==="cover"?"cover":(s==null?void 0:s.backgroundSize)==="contain"?"contain":"repeat"}function Uf({value:s,onChange:t,className:n}){return e.jsxs("div",{children:[e.jsxs("div",{className:n,children:[e.jsx(qf,{value:s,onChange:t}),Vf.map(a=>e.jsx(Ks,{onClick:()=>t==null?void 0:t({...ce,...a}),isActive:(s==null?void 0:s.id)===a.id,style:{...kr(a),backgroundAttachment:"initial"},label:e.jsx(i,{...a.label})},a.id))]}),e.jsx(Hf,{value:s,onChange:t})]})}function qf({value:s,onChange:t}){return s=(s==null?void 0:s.id)===ce.id?s:void 0,e.jsxs(V,{type:"popover",onClose:n=>{t==null||t(n?{...ce,backgroundImage:`url(${n})`}:null)},children:[e.jsx(Ks,{label:e.jsx(i,{...ce.label}),isActive:(s==null?void 0:s.id)===ce.id,className:"border-dashed border-2",style:kr(s),children:e.jsx("span",{className:"inline-block text-white bg-black/20 rounded p-10",children:e.jsx(Of,{size:"lg"})})}),e.jsx(Wf,{value:s})]})}function Wf({value:s}){var o;const t=(o=s==null?void 0:s.backgroundImage)==null?void 0:o.replace("url(","").replace(")",""),n=ne({defaultValues:{imageUrl:t}}),{close:a,formId:r}=U();return e.jsxs(K,{size:"sm",children:[e.jsx(Z,{children:e.jsx(i,{message:"Upload image"})}),e.jsx(G,{children:e.jsx(xe,{id:r,form:n,onSubmit:l=>{a(l.imageUrl)},children:e.jsx(gs,{children:e.jsx(jt,{autoFocus:!0,name:"imageUrl",diskPrefix:"biolinks",showRemoveButton:!0})})})}),e.jsxs(X,{children:[e.jsx(N,{onClick:()=>{a()},children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",form:r,children:e.jsx(i,{message:"Select"})})]})]})}const Gs={h2:"text-xl font-semibold mb-20",h3:"my-12 font-semibold"},Kf={color:ff,gradient:jf,image:Uf};function Gf({className:s}){const t=We(o=>{var l;return(l=o.appearance)==null?void 0:l.bgConfig}),[n,a]=x.useState(()=>(t==null?void 0:t.type)==="color"?"color":(t==null?void 0:t.type)==="gradient"?"gradient":"color"),r=Kf[n];return e.jsxs("div",{className:s,children:[e.jsx("h2",{className:Gs.h2,children:e.jsx(i,{message:"Background"})}),e.jsx(Yf,{activeTab:n,onTabChange:a}),e.jsx(r,{value:n===(t==null?void 0:t.type)?t:void 0,onChange:o=>{Ce().updateAppearance({bgConfig:o})},className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] items-start gap-14"})]})}function Yf({activeTab:s,onTabChange:t}){return e.jsxs("div",{className:"my-20 flex items-center gap-20 border-b pb-20",children:[e.jsx(fn,{isActive:s==="color",icon:e.jsx(oa,{}),title:e.jsx(i,{message:"Flat color"}),onClick:()=>{t("color")}}),e.jsx(fn,{isActive:s==="gradient",icon:e.jsx(Uo,{}),title:e.jsx(i,{message:"Gradient"}),onClick:()=>{t("gradient")}}),e.jsx(fn,{isActive:s==="image",icon:e.jsx(Rn,{}),title:e.jsx(i,{message:"Image"}),onClick:()=>{t("image")}})]})}function fn({isActive:s,icon:t,title:n,onClick:a}){return e.jsxs("div",{role:"button",className:"block",onClick:a,children:[e.jsx("div",{className:w("mx-auto mb-8 flex h-50 w-50 items-center justify-center rounded-panel border text-muted",s&&"border-primary ring"),children:t}),e.jsx("div",{className:"text-center text-sm text-primary",children:n})]})}const Qf={flat:h("Fill"),outline:h("Outline")},Zf={"rounded-none":h("Square"),rounded:h("Rounded"),"rounded-full":h("Pill")};function Jf({className:s}){const t=We(a=>{var r;return(r=a.appearance)==null?void 0:r.btnConfig}),n=x.useCallback(a=>{Ce().updateAppearance({btnConfig:{...t,...a}})},[t]);return e.jsxs("div",{className:s,children:[e.jsx("h2",{className:Gs.h2,children:e.jsx(i,{message:"Buttons"})}),e.jsx(Xf,{value:t,onChange:n}),e.jsx(sp,{value:t,onChange:n})]})}function Xf({value:s,onChange:t}){const n=(s==null?void 0:s.variant)??"flat",a=(s==null?void 0:s.radius)??"rounded";return e.jsx("div",{children:Object.entries(Qf).map(([r,o])=>e.jsxs("div",{children:[e.jsx("h3",{className:Gs.h3,children:e.jsx(i,{...o})}),e.jsx("div",{className:"grid grid-cols-2 gap-24 md:grid-cols-3",children:Object.entries(Zf).map(([l,c])=>e.jsx("div",{className:w("rounded",r===n&&a===l&&"ring ring-primary-light ring-offset-4"),children:e.jsx(N,{variant:r,color:"primary",radius:l,className:"w-full",onClick:()=>{t({variant:r,radius:l})},children:e.jsx(i,{...c})})},l))})]},r))})}const ep={"shadow-none":h("No shadow"),"rgb(0 0 0 / 20%) 0.2rem 0.2rem 0.4rem 0px":h("Light shadow"),"rgb(0 0 0 / 75%) 0.3rem 0.4rem 0px":h("Hard shadow")};function sp({value:s,onChange:t}){const n=(s==null?void 0:s.shadow)??"shadow-none";return e.jsxs("div",{children:[e.jsx("h3",{className:"my-12 font-semibold",children:e.jsx(i,{message:"Shadow"})}),e.jsx("div",{className:"flex gap-24",children:Object.entries(ep).map(([a,r])=>e.jsx("div",{style:{boxShadow:a},className:"h-40 w-70 overflow-hidden rounded-button",children:e.jsx(Vs,{display:"block",radius:"rounded-button",className:w("h-full w-full border",n===a&&"border-primary"),onClick:()=>{t({shadow:a==="shadow-none"?void 0:a})},children:e.jsx("span",{className:"sr-only",children:e.jsx(i,{...r})})})},a))})]})}const tp=""+new URL("font-a5a81d1a.svg",import.meta.url).href;function np({state:{filters:s,setFilters:t}}){const{trans:n}=$();return e.jsxs("div",{className:"mb-24 items-center gap-24 @xs:flex",children:[e.jsx(Ut,{className:"mb-12 flex-auto @xs:mb-0",value:s.query,onChange:a=>{t({...s,query:a.target.value})},startAdornment:e.jsx(ur,{}),placeholder:n(h("Search fonts"))}),e.jsxs(zn,{className:"flex-auto",selectionMode:"single",selectedValue:s.category,onSelectionChange:a=>{t({...s,category:a})},children:[e.jsx(I,{value:"",children:e.jsx(i,{message:"All categories"})}),e.jsx(I,{value:"serif",children:e.jsx(i,{message:"Serif"})}),e.jsx(I,{value:"sans-serif",children:e.jsx(i,{message:"Sans serif"})}),e.jsx(I,{value:"display",children:e.jsx(i,{message:"Display"})}),e.jsx(I,{value:"handwriting",children:e.jsx(i,{message:"Handwriting"})}),e.jsx(I,{value:"monospace",children:e.jsx(i,{message:"Monospace"})})]})]})}function ap(s){const t=Wi({usage:"search",...s});return{startsWith(n,a){return a.length===0?!0:(n=n.normalize("NFC"),a=a.normalize("NFC"),t.compare(n.slice(0,a.length),a)===0)},endsWith(n,a){return a.length===0?!0:(n=n.normalize("NFC"),a=a.normalize("NFC"),t.compare(n.slice(-a.length),a)===0)},contains(n,a){if(a.length===0)return!0;n=n.normalize("NFC"),a=a.normalize("NFC");let r=0;const o=a.length;for(;r+o<=n.length;r++){const l=n.slice(r,r+o);if(t.compare(a,l)===0)return!0}return!1}}}const qo=[{label:h("System"),family:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',category:"sans-serif"},{family:"Impact, Charcoal, sans-serif",category:"sans-serif"},{family:"Arial, Helvetica Neue, Helvetica, sans-serif",category:"serif"},{family:'"Comic Sans MS", cursive, sans-serif',category:"Handwriting"},{family:"Century Gothic, sans-serif",category:"sans-serif"},{family:'"Courier New", Courier, monospace',category:"monospace"},{family:'"Lucida Sans Unicode", "Lucida Grande", sans-serif',category:"sans-serif"},{family:'"Times New Roman", Times, serif',category:"serif"},{family:'"Lucida Console", Monaco, monospace',category:"monospace"},{family:'"Andele Mono", monospace, sans-serif',category:"sans-serif"},{family:"Verdana, Geneva, sans-serif",category:"sans-serif"},{family:'"Helvetica Neue", Helvetica, Arial, sans-serif',category:"sans-serif"}];function rp({value:s,onChange:t}){const{data:n,isLoading:a}=Wt(["googleFonts"]),[r,o]=x.useState(0),[l,c]=x.useState({query:"",category:(s==null?void 0:s.category)??""}),{contains:d}=ap({sensitivity:"base"}),m=x.useCallback(j=>{c(j),o(0)},[]),u=x.useMemo(()=>qo.concat((n==null?void 0:n.googleFonts)??[]),[n==null?void 0:n.googleFonts]),p=x.useMemo(()=>u.filter(j=>{var v;return d(j.family,l.query)&&(!l.category||((v=j.category)==null?void 0:v.toLowerCase())===l.category.toLowerCase())}),[u,l,d]),f=x.useMemo(()=>$c(p,20),[p]),g=f[r];return x.useEffect(()=>{const j="font-selector";g!=null&&g.length&&Ki(g,{id:j})},[g,r]),{fonts:g||[],currentPage:r,filteredFonts:p||[],setCurrentPage:o,isLoading:a,filters:l,setFilters:m,value:s,onChange:t,pages:f}}function op({state:{currentPage:s=0,setCurrentPage:t,filteredFonts:n,pages:a}}){const r=(n==null?void 0:n.length)||0;return e.jsxs("div",{className:"flex items-center justify-end gap-24 text-sm mt-30 pt-14 border-t",children:[r>0&&e.jsx("div",{children:e.jsx(i,{message:":from - :to of :total",values:{from:s*20+1,to:Math.min((s+1)*20,r),total:r}})}),e.jsxs("div",{className:"text-muted",children:[e.jsx(P,{disabled:s<1,onClick:()=>{t(Math.max(0,s-1))},children:e.jsx(vt,{})}),e.jsx(P,{disabled:s>=a.length-1,onClick:()=>{t(s+1)},children:e.jsx(Hs,{})})]})]})}function ip(s){const t=rp(s);return e.jsxs("div",{className:s.className,children:[e.jsx(np,{state:t}),e.jsx(Se,{initial:!1,mode:"wait",children:e.jsx(lp,{state:t})}),e.jsx(op,{state:t})]})}function lp({state:s}){const{isLoading:t,fonts:n}=s,a="grid gap-24 grid-cols-[repeat(auto-fill,minmax(90px,1fr))] items-start";return t?e.jsx(dp,{className:a}):n!=null&&n.length?e.jsx(fe.div,{...Ie,className:a,children:n==null?void 0:n.map(r=>e.jsx(cp,{font:r,state:s},r.family))},"font-list"):e.jsx(qt,{className:"mt-60",size:"sm",image:e.jsx(ft,{src:tp}),title:e.jsx(i,{message:"No matching fonts"}),description:e.jsx(i,{message:"Try another search query or different category"})})}function cp({font:s,state:{value:t,onChange:n}}){const a=(t==null?void 0:t.family)===s.family,r=s.family.split(",")[0].replace(/"/g,"");return e.jsxs(Vs,{display:"block",onClick:()=>{n(s)},children:[e.jsx("span",{className:w("flex aspect-square items-center justify-center rounded-panel border text-4xl transition-bg-color hover:bg-hover md:text-5xl",a&&"ring-2 ring-primary ring-offset-2"),children:e.jsx("span",{style:{fontFamily:s.family},children:"Aa"})}),e.jsx("span",{className:w("mt-6 block overflow-hidden overflow-ellipsis whitespace-nowrap text-sm",a&&"text-primary"),children:s.label?e.jsx(i,{...s.label}):r})]},s.family)}function dp({className:s}){const t=Array.from(Array(20).keys());return e.jsx(fe.div,{...Ie,className:s,children:t.map(n=>e.jsxs("div",{children:[e.jsx("div",{className:"aspect-square",children:e.jsx(je,{display:"block",variant:"rect"})}),e.jsx(je,{className:"mt-6 text-sm"})]},n))},"font-list-skeleton")}function up(){const s=qs();return Y({mutationFn:()=>{const t=Ce().appearance;return mp(s,{config:t})},onSuccess:()=>{Ce().setAppearanceIsDirty(!1),J.positive(h("Appearance saved"))},onError:t=>ke(t,h("Could not save appearance"))})}function mp(s,t){return O.post(`biolink/${s}/appearance`,t).then(n=>n.data)}function pn({value:s,onChange:t,label:n}){const a=Ms({size:"md",startAppend:e.jsx(x.Fragment,{})}),r=x.useId();return e.jsxs("div",{children:[e.jsx("label",{className:a.label,htmlFor:r,children:n}),e.jsxs("div",{className:"flex",children:[e.jsxs(V,{type:"popover",children:[e.jsx(Vs,{className:"h-42 w-42 flex-shrink-0 rounded-input border bg-black",style:{backgroundColor:s}}),e.jsx(Nt,{showInput:!1,defaultValue:s,onChange:t})]}),e.jsx(Xr,{id:r,autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,prefixed:!0,className:a.input,color:s,onChange:t})]})]})}function xp(){const s=up(),t=We(n=>n.appearanceIsDirty);return e.jsxs(x.Fragment,{children:[e.jsxs("header",{className:"mb-40",children:[e.jsx("h1",{className:"mb-4 text-2xl",children:e.jsx(i,{message:"Custom appearance"})}),e.jsx("div",{className:"mb-20 text-sm",children:e.jsx(i,{message:"Fully customize your Biolink. Change background color or select gradients and images. Choose button style, text color, typeface and more."})}),e.jsx(N,{variant:"flat",color:"primary",type:"submit",onClick:()=>s.mutate(),disabled:!t||s.isPending,children:e.jsx(i,{message:"Save changes"})})]}),e.jsx(Gf,{}),e.jsx(hp,{}),e.jsx(Jf,{className:"my-60"}),e.jsx(fp,{}),e.jsx(pp,{})]})}function hp(){const s=We(n=>{var a;return(a=n.appearance)==null?void 0:a.btnConfig}),t=We(n=>{var a;return(a=n.appearance)==null?void 0:a.bgConfig});return e.jsxs("div",{className:"my-60",children:[e.jsx("h2",{className:Gs.h2,children:e.jsx(i,{message:"Colors"})}),e.jsxs("div",{className:"grid-cols-3 items-center gap-24 md:grid",children:[e.jsx(pn,{label:e.jsx(i,{message:"Text color"}),value:(t==null?void 0:t.color)||"#000",onChange:n=>{Ce().updateAppearance({bgConfig:{...t,color:n}})}}),e.jsx(pn,{label:e.jsx(i,{message:"Button color"}),value:(s==null?void 0:s.color)||"#000",onChange:n=>{Ce().updateAppearance({btnConfig:{...s,color:n}})}}),e.jsx(pn,{label:e.jsx(i,{message:"Button text color"}),value:(s==null?void 0:s.textColor)||"#000",onChange:n=>{Ce().updateAppearance({btnConfig:{...s,textColor:n}})}})]})]})}function fp(){const s=We(t=>{var n;return(n=t.appearance)==null?void 0:n.fontConfig})||qo[0];return e.jsxs("div",{children:[e.jsx("h2",{className:Gs.h2,children:e.jsx(i,{message:"Font"})}),e.jsx(ip,{value:s,onChange:t=>{Ce().updateAppearance({fontConfig:{...s,...t}})}})]})}function pp(){const{branding:s,biolink:t}=me(),{isSubscribed:n}=ie(),{billing:a}=me(),r=We(o=>{var l;return(l=o.appearance)==null?void 0:l.hideBranding})||!1;return e.jsxs("div",{className:"my-60",children:[e.jsx("h2",{className:Gs.h2,children:e.jsx(i,{message:"Branding"})}),a.enable&&e.jsx("div",{className:"mb-14",children:e.jsxs(V,{type:"popover",children:[e.jsx(N,{variant:"flat",color:"primary",size:"2xs",startIcon:e.jsx(Kt,{}),children:e.jsx(i,{message:"Upgrade"})}),e.jsx(wo,{message:e.jsx(i,{message:"Upgrade to remove :site logo.",values:{site:s.site_name}}),messageSuffix:null})]})}),t.show_branding&&e.jsx(yt,{disabled:!n,checked:r,onChange:o=>{Ce().updateAppearance({hideBranding:o.target.checked})},children:e.jsx(i,{message:"Hide :site logo",values:{site:s.site_name}})})]})}const Ya={content:0,appearance:1,settings:2};function gp(){return e.jsxs("div",{children:[e.jsx(jp,{}),e.jsxs("div",{className:"flex gap-60 p-24 container mx-auto",children:[e.jsx(bp,{}),e.jsx(mf,{})]})]})}function jp(){const{biolink:s}=Us();return e.jsxs("header",{className:"border-b px-10 py-4 flex items-center gap-10 min-h-46",children:[e.jsx(_n,{className:"text-muted"}),e.jsxs(Se,{children:[s&&e.jsx(fe.a,{className:Os,href:s==null?void 0:s.short_url,target:"_blank",rel:"noreferrer",...Ie,children:Xe(s.short_url)},"link"),s&&x.createElement(fe.div,{...Ie,key:"share-button",className:"ml-auto"},e.jsx(js,{variant:"text",link:s}))]})]})}function bp(){const{biolinkId:s}=Re(),{tabName:t="content"}=Re(),n=Ya[t]??Ya.content;return Us(),x.useEffect(()=>{nn()},[s]),e.jsx("div",{className:"flex-auto min-w-0",children:e.jsxs(oo,{overflow:"overflow-visible",selectedTab:n,isLazy:!0,children:[e.jsxs(io,{className:"sticky top-0 bg dark:bg-alt z-10",children:[e.jsx(et,{padding:"w-140",elementType:ge,to:"../content",relative:"path",children:e.jsx(i,{message:"Content"})}),e.jsx(et,{padding:"w-140",elementType:ge,to:"../appearance",relative:"path",children:e.jsx(i,{message:"Appearance"})}),e.jsx(et,{padding:"w-140",elementType:ge,to:"../settings",relative:"path",children:e.jsx(i,{message:"Settings"})})]}),e.jsxs(lo,{className:"py-20",children:[e.jsx(st,{children:e.jsx(vp,{})}),e.jsx(st,{children:e.jsx(xp,{})}),e.jsx(st,{children:e.jsx(Vh,{})})]})]})})}function vp(){const{isLoading:s,status:t,biolink:n}=Us(),[a,r]=x.useState(null);let o;return t==="success"&&!(n!=null&&n.content.length)?o=x.createElement(fe.div,{...Ie,key:"no-results"},e.jsx(qt,{className:"mt-60",image:e.jsx(ft,{src:Gi}),title:e.jsx(i,{message:"This biolink does not have any content yet"})})):s?o=e.jsx(wp,{}):o=e.jsx(yp,{biolink:n}),e.jsxs(x.Fragment,{children:[n&&e.jsx(cf,{biolink:n,activeWidget:a,onOpenChange:l=>{l||r(null)}}),e.jsxs("div",{className:"mb-20",children:[e.jsx(kp,{}),e.jsxs(V,{type:"modal",onClose:l=>{l&&r(l)},children:[e.jsx(N,{color:"primary",variant:"outline",startIcon:e.jsx(ph,{}),children:e.jsx(i,{message:"Add widget"})}),e.jsx(lf,{})]})]}),e.jsx(Se,{initial:!1,mode:"wait",children:o})]})}function yp({biolink:s}){return e.jsx(fe.div,{...Ie,children:s==null?void 0:s.content.map(t=>{const n=t.model_type==="biolinkWidget"?df:Fh;return e.jsx(n,{item:t,biolink:s},`${t.model_type}-${t.id}`)})},"content")}function kp(){const{biolink:s,biolinkId:t}=Us(),n=`biolink/${t}/link`,a=s==null?void 0:s.content.filter(r=>r.pinned).length;return e.jsxs(V,{type:"modal",children:[e.jsx(N,{color:"primary",variant:"flat",className:"mr-14 min-w-144",children:e.jsx(i,{message:"Add a link"})}),e.jsx(sa,{endpoint:n,position:a,group:s,hiddenFields:Bo,showButtonLabelField:!0,invalidateQueries:!1,onSuccess:r=>{Lt(r.biolink)}})]})}function wp(){return e.jsx(fe.div,{...Ie,children:[...Array(4).keys()].map((s,t)=>e.jsx(Np,{},t))},"loading-skeleton")}function Np(){return e.jsxs(ra,{title:e.jsx(je,{className:"mb-14 text-sm max-w-192"}),actionRow:e.jsx(je,{className:"text-xs max-w-288"}),children:[e.jsx(je,{className:"text-xs max-w-400"}),e.jsx(je,{className:"text-xs max-w-400"})]})}function Wo(){const[s,t]=x.useState(!1),{trans:n}=$(),r=os().watch("title"),o=n({message:"Title"});return s?e.jsx(E,{placeholder:o,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",!r&&"text-muted"),children:[r||o,e.jsx(Ke,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}const Cp=A(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"),Sp=A(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 Ip({editor:s}){return e.jsxs("span",{children:[e.jsx(P,{size:"md",disabled:!s.can().undo(),onClick:()=>{s.commands.focus(),s.commands.undo()},children:e.jsx(Cp,{})}),e.jsx(P,{size:"md",disabled:!s.can().redo(),onClick:()=>{s.commands.focus(),s.commands.redo()},children:e.jsx(Sp,{})})]})}const Ko=A(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 Lp({editor:s}){return e.jsxs(V,{type:"modal",onClose:t=>{t!=null&&(s==null||s.commands.setContent(t))},children:[e.jsx(N,{variant:"text",startIcon:e.jsx(Ko,{}),children:e.jsx(i,{message:"Source"})}),e.jsx(Cd,{title:e.jsx(i,{message:"Source code"}),defaultValue:s.getHTML()})]})}function As(){return e.jsx("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}const Dp=A(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"),Pp=A(e.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),zp=A(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 Ap({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(se,{label:e.jsx(i,{message:"Bold"}),children:e.jsx(P,{size:t,color:s.isActive("bold")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBold()},children:e.jsx(Dp,{})})}),e.jsx(se,{label:e.jsx(i,{message:"Italic"}),children:e.jsx(P,{size:t,color:s.isActive("italic")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleItalic()},children:e.jsx(Pp,{})})}),e.jsx(se,{label:e.jsx(i,{message:"Underline"}),children:e.jsx(P,{size:t,color:s.isActive("underline")?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleUnderline()},children:e.jsx(zp,{})})})]})}const Fp=A(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"),_p=A(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 Mp({editor:s,size:t}){const n=s.isActive("bulletList"),a=s.isActive("orderedList");return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(se,{label:e.jsx(i,{message:"Bulleted list"}),children:e.jsx(P,{size:t,color:n?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleBulletList()},children:e.jsx(Fp,{})})}),e.jsx(se,{label:e.jsx(i,{message:"Numbered list"}),children:e.jsx(P,{size:t,color:a?"primary":null,onClick:()=>{s.commands.focus(),s.commands.toggleOrderedList()},children:e.jsx(_p,{})})})]})}function Rp(s,{text:t,target:n,href:a}){s.state.selection.empty&&t?s.commands.insertContent(`<a href="${a}" target="${n}">${t}</a>`):s.state.selection.empty||(a?s.chain().focus().extendMarkRange("link").setLink({href:a,target:n}).run():s.chain().focus().extendMarkRange("link").unsetLink().run())}function Ep({editor:s,size:t}){return e.jsxs(V,{type:"modal",children:[e.jsx(se,{label:e.jsx(i,{message:"Insert link"}),children:e.jsx(P,{size:t,className:w("flex-shrink-0"),children:e.jsx(_n,{})})}),e.jsx(Tp,{editor:s})]})}function Tp({editor:s}){const t=s.getAttributes("link").href,n=s.state.doc.textBetween(s.state.selection.from,s.state.selection.to,""),a=ne({defaultValues:{href:t,text:n,target:"_blank"}}),{formId:r,close:o}=U();return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Insert link"})}),e.jsx(G,{children:e.jsxs(xe,{form:a,id:r,onSubmit:l=>{Rp(s,l),o()},children:[e.jsx(E,{name:"href",label:e.jsx(i,{message:"URL"}),autoFocus:!0,type:"url",className:"mb-20"}),e.jsx(E,{name:"text",label:e.jsx(i,{message:"Text to display"}),className:"mb-20"}),e.jsxs(Ne,{selectionMode:"single",name:"target",label:e.jsx(i,{message:"Open link in..."}),children:[e.jsx(I,{value:"_self",children:e.jsx(i,{message:"Current window"})}),e.jsx(I,{value:"_blank",children:e.jsx(i,{message:"New window"})})]})]})}),e.jsxs(X,{children:[e.jsx(N,{onClick:o,variant:"text",children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{type:"submit",form:r,variant:"flat",color:"primary",children:e.jsx(i,{message:"Save"})})]})]})}const Vp=2097152;function Op({editor:s,size:t,diskPrefix:n="page_media"}){const{selectAndUploadFile:a}=Yi(),r=()=>{a({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[Qi.image],maxFileSize:Vp},metadata:{diskPrefix:n,disk:Zi.public},onSuccess:o=>{s.commands.focus(),s.commands.setImage({src:o.url})}})};return e.jsx(se,{label:e.jsx(i,{message:"Insert image"}),children:e.jsx(P,{size:t,onClick:r,className:w("flex-shrink-0"),children:e.jsx(Rn,{})})})}const $p=A(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 Hp({editor:s,size:t}){return e.jsx(se,{label:e.jsx(i,{message:"Clear formatting"}),children:e.jsx(P,{className:w("flex-shrink-0"),size:t,onClick:()=>{s.chain().focus().clearNodes().unsetAllMarks().run()},children:e.jsx($p,{})})})}const Bp=A(e.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),Up=A([e.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),e.jsx("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHighOutlined"),qp=A(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"),Wp=A([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 Kp({editor:s,size:t}){const[n,a]=x.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(is,{onItemSelected:r=>{r==="hr"?(s.commands.focus(),s.commands.setHorizontalRule()):r==="embed"?a("embed"):(s.commands.focus(),s.commands.addInfo({type:r}))},children:[e.jsx(P,{variant:"text",size:t,className:w("flex-shrink-0"),children:e.jsx(Dd,{})}),e.jsxs(ls,{children:[e.jsx(I,{value:"hr",startIcon:e.jsx(Bp,{}),children:e.jsx(i,{message:"Horizontal rule"})}),e.jsx(I,{value:"embed",startIcon:e.jsx(Wp,{}),children:e.jsx(i,{message:"Embed"})}),e.jsx(I,{value:"important",startIcon:e.jsx(Up,{}),children:e.jsx(i,{message:"Important"})}),e.jsx(I,{value:"warning",startIcon:e.jsx(vr,{}),children:e.jsx(i,{message:"Warning"})}),e.jsx(I,{value:"success",startIcon:e.jsx(qp,{}),children:e.jsx(i,{message:"Note"})})]})]}),e.jsx(V,{type:"modal",isOpen:!!n,onClose:()=>{a(!1)},children:e.jsx(Gp,{editor:s})})]})}function Gp({editor:s}){const t=s.getAttributes("embed").src,n=ne({defaultValues:{src:t}}),{formId:a,close:r}=U();return e.jsxs(K,{children:[e.jsx(Z,{children:e.jsx(i,{message:"Insert link"})}),e.jsx(G,{children:e.jsx(xe,{form:n,id:a,onSubmit:o=>{s.commands.setEmbed(o),r()},children:e.jsx(E,{name:"src",label:e.jsx(i,{message:"Embed URL"}),autoFocus:!0,type:"url",required:!0})})}),e.jsxs(X,{children:[e.jsx(N,{onClick:r,variant:"text",children:e.jsx(i,{message:"Cancel"})}),e.jsx(N,{type:"submit",form:a,disabled:!n.formState.isValid,variant:"flat",color:"primary",children:e.jsx(i,{message:"Add"})})]})]})}function Ve({children:s,modifier:t,separator:n="+"}){const a=lr()?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:[a,n]}),s]})}function Yp({editor:s,size:t}){return e.jsxs(is,{floatingMinWidth:"w-256",onItemSelected:n=>{s.commands.focus(),typeof n=="string"&&n.startsWith("h")?s.commands.toggleHeading({level:parseInt(n.replace("h",""))}):n==="code"?s.commands.toggleCode():n==="strike"?s.commands.toggleStrike():n==="super"?s.commands.toggleSuperscript():n==="sub"?s.commands.toggleSubscript():n==="blockquote"?s.commands.toggleBlockquote():n==="paragraph"&&s.commands.setParagraph()},children:[e.jsx(N,{className:w("flex-shrink-0"),variant:"text",size:t,endIcon:e.jsx(Ts,{}),children:e.jsx(i,{message:"Format"})}),e.jsxs(ls,{children:[e.jsx(I,{value:"h1",endSection:e.jsx(Ve,{modifier:!0,children:"Alt+1"}),children:e.jsx(i,{message:"Heading :number",values:{number:1}})}),e.jsx(I,{value:"h2",endSection:e.jsx(Ve,{modifier:!0,children:"Alt+2"}),children:e.jsx(i,{message:"Heading :number",values:{number:2}})}),e.jsx(I,{value:"h3",endSection:e.jsx(Ve,{modifier:!0,children:"Alt+3"}),children:e.jsx(i,{message:"Heading :number",values:{number:3}})}),e.jsx(I,{value:"h4",endSection:e.jsx(Ve,{modifier:!0,children:"Alt+4"}),children:e.jsx(i,{message:"Heading :number",values:{number:4}})}),e.jsx(I,{value:"code",endSection:e.jsx(Ve,{modifier:!0,children:"E"}),children:e.jsx(i,{message:"Code"})}),e.jsx(I,{value:"strike",endSection:e.jsx(Ve,{modifier:!0,children:"Shift+X"}),children:e.jsx(i,{message:"Strikethrough"})}),e.jsx(I,{value:"super",endSection:e.jsx(Ve,{modifier:!0,separator:" ",children:"."}),children:e.jsx(i,{message:"Superscript"})}),e.jsx(I,{value:"sub",endSection:e.jsx(Ve,{modifier:!0,separator:" ",children:","}),children:e.jsx(i,{message:"Subscript"})}),e.jsx(I,{value:"blockquote",endSection:e.jsx(Ve,{modifier:!0,children:"Shift+B"}),children:e.jsx(i,{message:"Blockquote"})}),e.jsx(I,{value:"paragraph",endSection:e.jsx(Ve,{modifier:!0,children:"Alt+0"}),children:e.jsx(i,{message:"Paragraph"})})]})]})}const Qp=A(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");function Zp({editor:s,size:t}){const[n,a]=x.useState(!1),r=s.getAttributes("textStyle").color,o=s.getAttributes("textStyle").backgroundColor;return e.jsxs(x.Fragment,{children:[e.jsxs("span",{className:w("flex-shrink-0 whitespace-nowrap"),children:[e.jsx(P,{size:t,color:r?"primary":null,onClick:()=>{a("text")},children:e.jsx(Qp,{})}),e.jsx(P,{size:t,color:o?"primary":null,onClick:()=>{a("bg")},children:e.jsx(oa,{})})]}),e.jsx(V,{currentValue:n==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!n,onClose:l=>{l&&(n==="text"?s.commands.setColor(l):s.commands.setBackgroundColor(l)),a(!1)},children:e.jsx(Nt,{defaultValue:n==="text"?"#000000":"#FFFFFF"})})]})}const Jp=A(e.jsx("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),Xp=A(e.jsx("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined"),eg=A(e.jsx("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),sg=A(e.jsx("path",{d:"M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"}),"FormatAlignJustifyOutlined"),Pt={left:{icon:Jp,label:h("Align left")},center:{icon:Xp,label:h("Align center")},right:{icon:eg,label:h("Align right")},justify:{icon:sg,label:h("Justify")}};function tg({editor:s,size:t}){const n=Object.keys(Pt).find(r=>s.isActive({textAlign:r}))||"left",a=n?Pt[n].icon:Pt.left.icon;return e.jsxs(is,{floatingWidth:"auto",selectionMode:"single",selectedValue:n,onSelectionChange:r=>{s.commands.focus(),s.commands.setTextAlign(r)},children:[e.jsx(P,{size:t,color:n?"primary":null,className:w("flex-shrink-0"),children:e.jsx(a,{})}),e.jsx(ls,{children:Object.entries(Pt).map(([r,o])=>{const l=o.icon;return e.jsx(I,{value:r,startIcon:e.jsx(l,{size:"md"}),capitalizeFirst:!0,children:e.jsx(i,{message:o.label.message})},r)})})]})}const ng=A(e.jsx("path",{d:"M11 17h10v-2H11v2zm-8-5 4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentDecreaseOutlined"),ag=A(e.jsx("path",{d:"M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"}),"FormatIndentIncreaseOutlined");function rg({editor:s,size:t}){return e.jsxs("span",{className:w("flex-shrink-0","whitespace-nowrap"),children:[e.jsx(se,{label:e.jsx(i,{message:"Decrease indent"}),children:e.jsx(P,{size:t,onClick:()=>{s.commands.focus(),s.commands.outdent()},children:e.jsx(ng,{})})}),e.jsx(se,{label:e.jsx(i,{message:"Increase indent"}),children:e.jsx(P,{size:t,onClick:()=>{s.commands.focus(),s.commands.indent()},children:e.jsx(ag,{})})})]})}function og({editor:s,size:t}){const n=s.getAttributes("codeBlock").language||"";return e.jsxs(is,{selectionMode:"single",selectedValue:n,onSelectionChange:a=>{s.commands.toggleCodeBlock({language:a})},children:[e.jsx(se,{label:e.jsx(i,{message:"Codeblock"}),children:e.jsx(P,{className:w("flex-shrink-0"),size:t,color:n?"primary":null,children:e.jsx(Ko,{})})}),e.jsxs(ls,{children:[e.jsx(I,{value:"html",children:"HTML"}),e.jsx(I,{value:"javascript",children:"JavaScript"}),e.jsx(I,{value:"css",children:"CSS"}),e.jsx(I,{value:"php",children:"PHP"}),e.jsx(I,{value:"shell",children:"Shell"}),e.jsx(I,{value:"bash",children:"Bash"}),e.jsx(I,{value:"ruby",children:"Ruby"}),e.jsx(I,{value:"python",children:"Python"}),e.jsx(I,{value:"java",children:"Java"}),e.jsx(I,{value:"c++",children:"C++"})]})]})}const ig=A(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"),Qa="flex items-center px-4 h-42 text-muted border-b overflow-hidden";function lg({editor:s,size:t="md",justify:n="justify-center",hideInsertButton:a=!1}){const r=ve(),[o,l]=x.useState(!1);return e.jsxs("div",{className:w(o?"h-84":"h-42"),children:[e.jsxs("div",{className:w(Qa,n,"relative z-20"),children:[e.jsx(Yp,{editor:s,size:t}),e.jsx(As,{}),e.jsx(Ap,{editor:s,size:t}),e.jsx(As,{}),e.jsx(tg,{editor:s,size:t}),e.jsx(rg,{editor:s,size:t}),e.jsx(As,{}),r?e.jsx(P,{className:"flex-shrink-0",color:o?"primary":null,size:t,onClick:()=>{l(!o)},children:o?e.jsx(ig,{}):e.jsx(uo,{})}):e.jsx(Za,{editor:s,size:t,hideInsertButton:a})]}),e.jsx(Se,{children:o&&e.jsx(fe.div,{className:w(Qa,n,"absolute flex h-full w-full"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:e.jsx(Za,{editor:s,size:t})})})]})}function Za({editor:s,size:t="md",hideInsertButton:n}){return e.jsxs(x.Fragment,{children:[e.jsx(Mp,{editor:s,size:t}),e.jsx(As,{}),e.jsx(Ep,{editor:s,size:t}),e.jsx(Op,{editor:s,size:t}),!n&&e.jsx(Kp,{editor:s,size:t}),e.jsx(As,{}),e.jsx(Zp,{editor:s,size:t}),e.jsx(As,{}),e.jsx(og,{editor:s,size:t}),e.jsx(Hp,{editor:s,size:t})]})}function Go({editor:s,allowSlugEditing:t=!0,onSave:n,saveButton:a,isLoading:r=!1,backLink:o,slugPrefix:l="pages"}){const{isSticky:c,sentinelRef:d}=Ad(),m=ve();return e.jsxs(x.Fragment,{children:[e.jsx("div",{ref:d}),e.jsxs("div",{className:w("sticky top-0 z-10 mb-20 bg-paper",c&&"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:[!m&&e.jsxs(x.Fragment,{children:[e.jsx(N,{variant:"text",size:"sm",elementType:ge,to:o,relative:"path",startIcon:e.jsx(vo,{}),children:e.jsx(i,{message:"Back"})}),e.jsx("div",{className:"mr-auto",children:t&&e.jsx(dg,{name:"slug",showLinkIcon:!1,prefix:l})})]}),s&&e.jsx(Ip,{editor:s}),!m&&e.jsx(Lp,{editor:s}),n&&e.jsx(cg,{onSave:()=>{n(s.getHTML())},isLoading:r}),a]}),e.jsx(lg,{editor:s,size:"sm"})]})]})}function cg({onSave:s,isLoading:t}){const a=os().watch("title");return e.jsx(N,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:t||!a,onClick:()=>s(),children:e.jsx(i,{message:"Save"})})}function dg({name:s,...t}){const{field:{onChange:n,onBlur:a,value:r="",ref:o}}=Es({name:s}),l=x.useRef(!1),{watch:c,setValue:d}=os();return x.useEffect(()=>{const m=c((u,{name:p})=>{p==="title"&&!l.current&&d("slug",u.title)});return()=>m.unsubscribe()},[c,d]),e.jsx(No,{className:w(!r&&"invisible"),onChange:m=>{l.current=!0,n(m)},onInputBlur:a,value:r,inputRef:o,...t})}function ug(){return Y({mutationFn:s=>mg(s),onError:s=>ke(s),onSuccess:async()=>{await q.invalidateQueries({queryKey:["link-page"]}),J(h("Page created"))}})}function mg(s){return O.post("link-page",s).then(t=>t.data)}const xg=Q.lazy(()=>pt(()=>import("./article-body-editor-67762fab.js"),["./article-body-editor-67762fab.js","./main-96065a7f.js","./main-54a4a887.css","./highlight-material-palenight-6c006c26.js","./highlight-material-palenight-c0ff5600.css"],import.meta.url));function hg(){const s=ss(),t=ug(),n=ne(),a=r=>{t.mutate({...n.getValues(),body:r},{onSuccess:()=>s("../",{relative:"path"})})};return e.jsx(x.Suspense,{fallback:e.jsx(Yt,{}),children:e.jsx(xg,{children:(r,o)=>e.jsx(gs,{children:e.jsxs(wr,{...n,children:[e.jsx(Go,{editor:o,isLoading:t.isPending,onSave:a,backLink:"../",allowSlugEditing:!1}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(Wo,{}),r]})})]})})})})}function fg(s){const t=Re();return s||(s=t.pageId),ze({queryKey:["link-page",`${s}`],queryFn:()=>pg(s)})}function pg(s){return O.get(`link-page/${s}`).then(t=>t.data)}function gg(){const{pageId:s}=Re();return Y({mutationFn:t=>jg(s,t),onError:t=>ke(t),onSuccess:async()=>{await q.invalidateQueries({queryKey:te("link-page")}),J(h("Page updated"))}})}function jg(s,t){return O.put(`link-page/${s}`,t).then(n=>n.data)}const bg=Q.lazy(()=>pt(()=>import("./article-body-editor-67762fab.js"),["./article-body-editor-67762fab.js","./main-96065a7f.js","./main-54a4a887.css","./highlight-material-palenight-6c006c26.js","./highlight-material-palenight-c0ff5600.css"],import.meta.url));function vg(){const s=fg();return s.data?e.jsxs(x.Fragment,{children:[e.jsx(Ji,{query:s}),e.jsx(yg,{page:s.data.page})]}):e.jsx("div",{className:"relative w-full h-full",children:e.jsx(Xi,{query:s})})}function yg({page:s}){const t=ss(),n=gg(),a=ne({defaultValues:{title:s.title,slug:s.slug,body:s.body}}),r=o=>{n.mutate({...a.getValues(),body:o},{onSuccess:()=>t("../..",{relative:"path"})})};return e.jsx(x.Suspense,{fallback:e.jsx(Yt,{}),children:e.jsx(bg,{initialContent:s.body,children:(o,l)=>e.jsx(gs,{children:e.jsxs(wr,{...a,children:[e.jsx(Go,{editor:l,backLink:"../..",isLoading:n.isPending,onSave:r,allowSlugEditing:!1}),e.jsx("div",{className:"mx-20",children:e.jsxs("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[e.jsx(Wo,{}),o]})})]})})})})}const Yo=({forCurrentUser:s=!1})=>[{path:"links",element:e.jsx(Nm,{forCurrentUser:s})},{path:"links/:linkId",element:e.jsx(Ma,{})},{path:"biolinks",element:e.jsx(dh,{forCurrentUser:s})},{path:"biolinks/:biolinkId",element:e.jsx(fh,{})},{path:"biolinks/:biolinkId/edit",element:e.jsx(nl,{to:"content",replace:!0})},{path:"biolinks/:biolinkId/edit/:tabName",element:e.jsx(gp,{})},{path:"link-groups",element:e.jsx(Bm,{forCurrentUser:s})},{path:"link-groups/:groupId",element:e.jsx(Ym,{})},{path:"link-groups/:groupId/links",element:e.jsx(Fm,{})},{path:"link-groups/:groupId/links/:linkId",element:e.jsx(Ma,{})},{path:"custom-domains",element:e.jsx(gx,{forCurrentUser:s})},{path:"pixels",element:e.jsx(Dx,{forCurrentUser:s})},{path:"link-overlays",element:e.jsx($x,{forCurrentUser:s})},{path:"link-overlays/new",element:e.jsx(Jx,{})},{path:"link-overlays/:overlayId/edit",element:e.jsx(nh,{})}];function kg(){const{workspaceId:s}=Le(),t=[{path:"/",element:e.jsx(el,{children:e.jsx(ku,{})}),children:[{index:!0,element:e.jsx(Uu,{})},{path:"link-pages",element:e.jsx(Rx,{forCurrentUser:!s})},{path:"link-pages/new",element:e.jsx(hg,{})},{path:"link-pages/:pageId/edit",element:e.jsx(vg,{})},...Yo({forCurrentUser:!s})]},{path:"*",element:e.jsx(sl,{})}];return tl(t)}const Cg=Object.freeze(Object.defineProperty({__proto__:null,SharedDashboardRoutes:Yo,default:kg},Symbol.toStringTag,{value:"Module"}));export{Mc as $,Er as A,Id as B,lc as C,rl as D,La as E,re as F,oo as G,io as H,et as I,lo as J,Hs as K,st as L,Dd as M,ws as N,Ur as O,$s as P,Un as Q,Ad as R,yt as S,Ld as T,te as U,ec as V,kt as W,Gr as X,Mr as Y,Md as Z,$n as _,dl as a,Cg as a$,Ns as a0,Mt as a1,oc as a2,zu as a3,Pa as a4,Vu as a5,Eu as a6,Zt as a7,Cu as a8,Hu as a9,Pp as aA,Fp as aB,_p as aC,zp as aD,Uo as aE,$d as aF,vx as aG,Bp as aH,ju as aI,Rm as aJ,cl as aK,bh as aL,Sm as aM,qp as aN,ou as aO,Up as aP,nm as aQ,Sp as aR,jh as aS,Wp as aT,Zu as aU,Cp as aV,ig as aW,uo as aX,Of as aY,ph as aZ,ap as a_,Yo as aa,Go as ab,Wo as ac,ip as ad,rm as ae,Po as af,gh as ag,vo as ah,Js as ai,gf as aj,Lr as ak,At as al,mt as am,Ko as an,En as ao,Jl as ap,Xp as aq,sg as ar,Jp as as,eg as at,Dp as au,$p as av,oa as aw,Qp as ax,ng as ay,ag as az,il as b,ol as c,H as d,bs as e,ct as f,fs as g,ys as h,ks as i,cs as j,Ec as k,ds as l,$c as m,Ds as n,lt as o,en as p,El as q,Yr as r,Nt as s,vt as t,vs as u,dd as v,vd as w,cd as x,Cd as y,Ia as z};
//# sourceMappingURL=dashboard-routes-63fde3df.js.map
Back to Directory
File Manager