@wellesley/notifications 1.0.589 → 1.0.591

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +2 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as Ks,usePostApiV1BlockByUserIdMutation as k1,useDeleteApiV1BlockByUserIdMutation as T1,usePostApiV1UsersFollowByUsernameAcceptMutation as N1,usePostApiV1UsersFollowByUsernameRejectMutation as R1,useGetApiV1UsersFolloweesQuery as O1,useGetApiV1UsersByUserIdFollowingQuery as L1,useGetApiV1SearchQuery as P1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.690";import M1,{forwardRef as u_,createElement as O0,useState as ln,useRef as pi,useEffect as $r,useCallback as x0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as zt}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.34";import{createAction as c_,createSelector as G0,createSlice as Da}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{ToastContainer as U1,toast as j1}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{authSlice as to}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.746";import{useSelector as ft,useDispatch as $d}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as F1,DialogContent as B1,cn as Fe,Form as l_,FormField as f_,FormItem as D1,FormLabel as W1,FormControl as $1,Input as d_,Command as z1,CommandList as V1,CommandItem as Z1,FormMessage as q1,Button as rs,ButtonLoader as L0,TooltipWrapper as P0,Avatar as H1,AvatarImage as G1,Skeleton as h_,DropdownMenu as p_,DropdownMenuTrigger as g_,DropdownMenuContent as m_,DropdownMenuItem as v_,useIsMobile as Q1,Tabs as K1,TabsControls as Y1,TabsContent as dv,HoverCard as J1,HoverCardTrigger as X1,HoverCardContent as ey}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.652";import{get as M0,set as w0,appendErrors as ty,useForm as Q0,FormProvider as ny}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as ry,ExternalLinks as iy,AppsLink as qc}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.618";import{usePostApiV1UsersFollowByUsernameMutation as sy,usePostApiV1UsersFollowByUsernameUndoMutation as oy,canFollowBack as ay,isFollowPending as uy,canUnfollow as hv,useIsOwnProfile as K0,useRelationship as cy,useCurrentUser as __,useGetUserByUserName as ly,useGetUserById as fy,usePostApiV1MuteByUserIdMutation as dy,useDeleteApiV1MuteByUserIdMutation as hy,isMuted as py,usePutApiV1NotesMutation as gy,useDeleteApiV1NotesByUserIdMutation as my,userSlice as Y0,useGetApiV1UsersRemoteByUserNameFullFollowersQuery as vy,useGetApiV1UsersFollowersQuery as _y,useGetApiV1UsersByUserIdFollowersQuery as yy,UserAvatar as y_,usePostApiV1UsersFollowByUsernameRejectMutation as xy,canUnsubscribeFromMe as wy}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.705";import{getErrorMsg as Gs}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.541";import{getStore as by,rootReducer as x_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.689";import{selectSmallestPreview as pv}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.575";import{useProfileSettings as Ay,platformSettingsSlice as Sy}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.647";import{wsSlice as Cy}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.672";var gv,ns=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Wc={exports:{}},Ey=Wc.exports;
1
+ import{api as Ks,usePostApiV1BlockByUserIdMutation as k1,useDeleteApiV1BlockByUserIdMutation as T1,usePostApiV1UsersFollowByUsernameAcceptMutation as N1,usePostApiV1UsersFollowByUsernameRejectMutation as R1,useGetApiV1UsersFolloweesQuery as O1,useGetApiV1UsersByUserIdFollowingQuery as L1,useGetApiV1SearchQuery as P1}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.692";import M1,{forwardRef as u_,createElement as O0,useState as ln,useRef as pi,useEffect as $r,useCallback as x0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as zt}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.36";import{createAction as c_,createSelector as G0,createSlice as Da}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{ToastContainer as U1,toast as j1}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{authSlice as to}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.748";import{useSelector as ft,useDispatch as $d}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as F1,DialogContent as B1,cn as Fe,Form as l_,FormField as f_,FormItem as D1,FormLabel as W1,FormControl as $1,Input as d_,Command as z1,CommandList as V1,CommandItem as Z1,FormMessage as q1,Button as rs,ButtonLoader as L0,TooltipWrapper as P0,Avatar as H1,AvatarImage as G1,Skeleton as h_,DropdownMenu as p_,DropdownMenuTrigger as g_,DropdownMenuContent as m_,DropdownMenuItem as v_,useIsMobile as Q1,Tabs as K1,TabsControls as Y1,TabsContent as dv,HoverCard as J1,HoverCardTrigger as X1,HoverCardContent as ey}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.654";import{get as M0,set as w0,appendErrors as ty,useForm as Q0,FormProvider as ny}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as ry,ExternalLinks as iy,AppsLink as qc}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.620";import{usePostApiV1UsersFollowByUsernameMutation as sy,usePostApiV1UsersFollowByUsernameUndoMutation as oy,canFollowBack as ay,isFollowPending as uy,canUnfollow as hv,useIsOwnProfile as K0,useRelationship as cy,useCurrentUser as __,useGetUserByUserName as ly,useGetUserById as fy,usePostApiV1MuteByUserIdMutation as dy,useDeleteApiV1MuteByUserIdMutation as hy,isMuted as py,usePutApiV1NotesMutation as gy,useDeleteApiV1NotesByUserIdMutation as my,userSlice as Y0,useGetApiV1UsersRemoteByUserNameFullFollowersQuery as vy,useGetApiV1UsersFollowersQuery as _y,useGetApiV1UsersByUserIdFollowersQuery as yy,UserAvatar as y_,usePostApiV1UsersFollowByUsernameRejectMutation as xy,canUnsubscribeFromMe as wy}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.707";import{getErrorMsg as Gs}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.543";import{getStore as by,rootReducer as x_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.691";import{selectSmallestPreview as pv}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.577";import{useProfileSettings as Ay,platformSettingsSlice as Sy}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.649";import{wsSlice as Cy}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.674";var gv,ns=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Wc={exports:{}},Ey=Wc.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -39,7 +39,7 @@ import{api as Ks,usePostApiV1BlockByUserIdMutation as k1,useDeleteApiV1BlockByUs
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */_e("remoteReady");const px=_e("askLogin");_e("reselectUser"),_e("requestLogout"),_e("setConfirmLeavePage"),_e("requestChangePath");const gx=_e("wsSubscribe"),mx=_e("wsUnSubscribe");_e("hostStoreConnect"),_e("remoteLogin"),_e("remoteLogout"),_e("wsOnMessage"),_e("setRouterPath"),_e("setDeviceType");const S_=_e("setUserError"),C_=_e("setUserIsError"),U0=_e("setUserPending"),j0=_e("setUserSuccess"),E_=_e("setUserData"),vx=_e("updateAccountData"),_x=_e("updateUser"),I_=_e("addNotification"),k_=_e("markNotification"),T_=_e("setNotificationsError"),N_=_e("setNotificationsList"),F0=_e("setNotificationsPending"),R_=_e("setNotificationsTotalCount"),B0=_e("setNotificationsUnreadCount"),O_=_e("resetNotificationsState"),L_=_e("undoNotification");_e("setInstanceInfo"),_e("setInstanceInfoPending"),_e("setInstanceInfoError"),_e("setPlatformSettings"),_e("setProfileSettings"),_e("setGroupData"),_e("setGroupLoading"),c_("requestMicroFrontendFetch"),c_("sendMicroFrontendFetchResponse");const yx=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(F0(!0));try{const e=await Ve(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(N_({userId:s,list:e.data}))}catch(e){t(T_(e))}finally{t(F0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n),t(k_(e))}catch(e){zt.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await Ve(n),t(B0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await Ve(n),i=!e.status;r&&t(i?R_(r.data):B0(r.data))}catch(e){zt.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:xx,usePostApiV1NotificationsByIdMarkMutation:wx,usePostApiV1NotificationsMarkAllMutation:GA,useGetApiV1NotificationsCountQuery:bx}=yx,Sv={data:{userId:"",list:[]},count:{},isPending:!1},Ax=e=>e,Sx=e=>e.error,Cx=e=>e.isPending,Ex=e=>{var t;return null==(t=e.count)?void 0:t.total},Ix=e=>{var t;return null==(t=e.count)?void 0:t.unread},kx=e=>e.data.userId,J0=G0(Ax,(e=>e.data.list)),Tx=G0(J0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Nx=G0(J0,(e=>null==e?void 0:e.at(-1))),Pd=Da({name:"notifications",initialState:Sv,reducers:{updateNotification:(e,t)=>{var n;if(!e.data.list)return;const r=t.payload;e.data.list=null==(n=e.data.list)?void 0:n.map((e=>e.id===r.id?{...e,...r}:e))},readAll:e=>{var t;e.data.list&&(e.data.list=null==(t=e.data.list)?void 0:t.map((e=>({...e,status:"READ"}))))}},extraReducers:e=>{e.addCase(F0,((e,t)=>{e.isPending=t.payload})).addCase(T_,((e,t)=>{e.error=t.payload})).addCase(N_,((e,t)=>{const n=t.payload.userId,r=t.payload.list;e.data={userId:n,list:[...e.data.list||[],...r.filter((t=>{var n;return!(null!=(n=e.data.list)&&n.some((e=>e.id===t.id)))}))]}})).addCase(I_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(k_,((e,t)=>{e.data.list&&(e.data.list=e.data.list.map((e=>e.id===t.payload.id?{...e,status:t.payload.status}:e)))})).addCase(R_,((e,t)=>{e.count.total=t.payload})).addCase(B0,((e,t)=>{e.count.unread=t.payload})).addCase(O_,(()=>Sv)).addCase(L_,((e,t)=>{var n,r,i;const s=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===s)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(i=e.data.list)?void 0:i.filter((e=>e.id!==s)))||[]}))},selectors:{selectError:Sx,selectIsPending:Cx,selectTotalCount:Ex,selectUnreadCount:Ix,selectNotifications:J0,selectUnreadNotifications:Tx,selectLastNotification:Nx,selectNotificationsOwner:kx}}),QA=()=>I.jsx(U1,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),KA=(e,t)=>j1(e,{...t,containerId:"custom"});var Cv=function(e,t,n){if(e&&"reportValidity"in e){var r=M0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},P_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Cv(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Cv(t,n,e)}))};for(var r in t.fields)n(r)},Rx=function(e,t){t.shouldUseNativeValidation&&P_(e,t);var n={};for(var r in e){var i=M0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Ox(t.names||Object.keys(e),r)){var a=Object.assign({},M0(n,r));w0(a,"root",s),w0(n,r,a)}else w0(n,r,s)}return n},Ox=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},Lx=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var o=r.unionErrors[0].errors[0];n[a]={message:o.message,type:o.code}}else n[a]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var u=n[a].types,l=u&&u[r.code];n[a]=ty(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},M_=function(e,t,n){return void 0===n&&(n={}),function(r,i,s){try{return Promise.resolve(function(i,a){try{var o=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return s.shouldUseNativeValidation&&P_({},s),{errors:{},values:n.raw?r:e}}))}catch(e){return a(e)}return o&&o.then?o.then(void 0,a):o}(0,(function(e){if(null!=e.errors)return{values:{},errors:Rx(Lx(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const Px=e=>{try{return e.startsWith("https")||e.startsWith("http")?new URL(e).origin:new URL(`https://${e}`).origin}catch{throw new Error("Error getting domain from entered URL")}},Mx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Ux=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),jx=async({url:e,...t})=>{const n=await fetch(e,t);if(!n.ok)throw new Error(n.statusText);if("PUT"===t.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},Fx=({user:e})=>async({url:t})=>{const n=Px(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await jx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Mx(r),s=Ux({template:i,user:e});if(!s)throw new Error("Error getting follow link");window.open(s,"_self")}catch{window.open(`${n}/authorize_interaction?uri=${e.uri}`,"_self")}},Bx=(e,t)=>{const n=e.at(0),r=(null==n?void 0:n.toUpperCase())===n&&"@"!==n,i=e.toLowerCase(),s=(null==t?void 0:t.toLowerCase())||"";if(!s)return e;const a=i.startsWith(s),o=i.replace(s,`<mark>${a?Ys.capitalize(s):t}</mark>`);return r&&a?o:Ys.capitalize(o)},Ev=e=>{e.preventDefault()},Dx=e=>e?{onOpenAutoFocus:Ev,onCloseAutoFocus:Ev}:{},ll=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>I.jsx(F1,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:I.jsx(B1,{className:Fe(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...Dx(s),childrenClassName:Fe("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})});var Ae,D0;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ae||(Ae={})),(D0||(D0={})).mergeShapes=(e,t)=>({...e,...t});const Q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ts=e=>{switch(typeof e){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:null===e?Q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Q.promise:typeof Map<"u"&&e instanceof Map?Q.map:typeof Set<"u"&&e instanceof Set?Q.set:typeof Date<"u"&&e instanceof Date?Q.date:Q.object;default:return Q.unknown}},D=Ae.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wx=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ln extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Ln))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ln.create=e=>new Ln(e);const Ua=(e,t)=>{let n;switch(e.code){case D.invalid_type:n=e.received===Q.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case D.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case D.invalid_union:n="Invalid input";break;case D.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case D.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case D.invalid_arguments:n="Invalid function arguments";break;case D.invalid_return_type:n="Invalid function return type";break;case D.invalid_date:n="Invalid date";break;case D.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case D.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case D.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case D.custom:n="Invalid input";break;case D.invalid_intersection_types:n="Intersection results could not be merged";break;case D.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case D.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ae.assertNever(e)}return{message:n}};let U_=Ua;function $x(e){U_=e}function Md(){return U_}const Ud=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},zx=[];function G(e,t){const n=Md(),r=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ua?void 0:Ua].filter((e=>!!e))});e.common.issues.push(r)}class Kt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return oe;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return Kt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return oe;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(typeof i.value<"u"||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}const oe=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),fn=e=>({status:"valid",value:e}),W0=e=>"aborted"===e.status,$0=e=>"dirty"===e.status,Qc=e=>"valid"===e.status,Kc=e=>typeof Promise<"u"&&e instanceof Promise;function jd(e,t,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function j_(e,t,n,r,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var J,$c,zc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(J||(J={}));class zr{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Iv=(e,t)=>{if(Qc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ln(e.common.issues);return this._error=t,this._error}}};function pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:typeof i.data>"u"?{message:null!==(s=o??r)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=o??n)&&void 0!==a?a:i.defaultError}},description:i}}class ve{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ts(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Kt,ctx:{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Kc(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Iv(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Kc(r)?r:Promise.resolve(r));return Iv(n,i)}refine(e,t){const n=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),s=()=>r.addIssue({code:D.custom,...n(t)});return typeof Promise<"u"&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Ar({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Wr.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wr.create(this,this._def)}promise(){return Fa.create(this,this._def)}or(e){return el.create([this,e],this._def)}and(e){return tl.create(this,e,this._def)}transform(e){return new Ar({...pe(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ol({...pe(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new X0({typeName:ne.ZodBranded,type:this,...pe(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new al({...pe(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return fl.create(this,e)}readonly(){return ul.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Vx=/^c[^\s-]{8,}$/i,Zx=/^[0-9a-z]+$/,qx=/^[0-9A-HJKMNP-TV-Z]{26}$/,Hx=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Gx=/^[a-z0-9_-]{21}$/i,Qx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let k0;const Jx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xx=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F_="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tw=new RegExp(`^${F_}$`);function B_(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function nw(e){return new RegExp(`^${B_(e)}$`)}function D_(e){let t=`${F_}T${B_(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function rw(e,t){return!(("v4"!==t&&t||!Jx.test(e))&&("v6"!==t&&t||!Xx.test(e)))}class xr extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.string,received:t.parsedType}),oe}const t=new Kt;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,s=e.data.length<r.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?G(n,{code:D.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&G(n,{code:D.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)Kx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"email",code:D.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)k0||(k0=new RegExp(Yx,"u")),k0.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"emoji",code:D.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)Hx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"uuid",code:D.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)Gx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"nanoid",code:D.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Vx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid",code:D.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Zx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid2",code:D.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)qx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ulid",code:D.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),G(n,{validation:"url",code:D.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"regex",code:D.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?D_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?tw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?nw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?Qx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:D.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?rw(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ip",code:D.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?ew.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"base64",code:D.invalid_string,message:r.message}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:D.invalid_string,...J.errToObj(n)})}_addCheck(e){return new xr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...J.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,...J.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...J.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new xr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function iw(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}xr.create=e=>{var t;return new xr({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class is extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Q.number){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.number,received:t.parsedType}),oe}let t;const n=new Kt;for(const r of this._def.checks)"int"===r.kind?Ae.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:D.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==iw(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_finite,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Ae.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}is.create=e=>new is({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class ss extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Q.bigint){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.bigint,received:t.parsedType}),oe}let t;const n=new Kt;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new ss({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new ss({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ss.create=e=>{var t;return new ss({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class Yc extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.boolean,received:t.parsedType}),oe}return fn(e.data)}}Yc.create=e=>new Yc({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class Xs extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.date,received:t.parsedType}),oe}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:D.invalid_date}),oe}const t=new Kt;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Xs.create=e=>new Xs({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...pe(e)});class Fd extends ve{_parse(e){if(this._getType(e)!==Q.symbol){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.symbol,received:t.parsedType}),oe}return fn(e.data)}}Fd.create=e=>new Fd({typeName:ne.ZodSymbol,...pe(e)});class Jc extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.undefined,received:t.parsedType}),oe}return fn(e.data)}}Jc.create=e=>new Jc({typeName:ne.ZodUndefined,...pe(e)});class Xc extends ve{_parse(e){if(this._getType(e)!==Q.null){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.null,received:t.parsedType}),oe}return fn(e.data)}}Xc.create=e=>new Xc({typeName:ne.ZodNull,...pe(e)});class ja extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return fn(e.data)}}ja.create=e=>new ja({typeName:ne.ZodAny,...pe(e)});class Js extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fn(e.data)}}Js.create=e=>new Js({typeName:ne.ZodUnknown,...pe(e)});class gi extends ve{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.never,received:t.parsedType}),oe}}gi.create=e=>new gi({typeName:ne.ZodNever,...pe(e)});class Bd extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.void,received:t.parsedType}),oe}return fn(e.data)}}Bd.create=e=>new Bd({typeName:ne.ZodVoid,...pe(e)});class wr extends ve{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Q.array)return G(t,{code:D.invalid_type,expected:Q.array,received:t.parsedType}),oe;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(G(t,{code:e?D.too_big:D.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(G(t,{code:D.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(G(t,{code:D.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new zr(t,e,t.path,n))))).then((e=>Kt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new zr(t,e,t.path,n))));return Kt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new wr({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new wr({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new wr({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}}function Oa(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Wr.create(Oa(r))}return new st({...e._def,shape:()=>t})}return e instanceof wr?new wr({...e._def,type:Oa(e.element)}):e instanceof Wr?Wr.create(Oa(e.unwrap())):e instanceof as?as.create(Oa(e.unwrap())):e instanceof Vr?Vr.create(e.items.map((e=>Oa(e)))):e}wr.create=(e,t)=>new wr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...pe(t)});class st extends ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ae.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Q.object){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.object,received:t.parsedType}),oe}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof gi&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||s.push(e);const a=[];for(const e of i){const t=r[e],i=n.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new zr(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof gi){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(G(n,{code:D.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new zr(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>Kt.mergeObjectSync(t,e))):Kt.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new st({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,s,a;const o=null!==(s=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=J.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(e){return new st({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new st({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new st({...this._def,catchall:e})}pick(e){const t={};return Ae.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}deepPartial(){return Oa(this)}partial(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new st({...this._def,shape:()=>t})}required(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Wr;)e=e._def.innerType;t[n]=e}})),new st({...this._def,shape:()=>t})}keyof(){return W_(Ae.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)});class el extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Ln(e.ctx.common.issues)));return G(t,{code:D.invalid_union,unionErrors:n}),oe}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"===s.status&&!e&&(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Ln(e)));return G(t,{code:D.invalid_union,unionErrors:i}),oe}}get options(){return this._def.options}}el.create=(e,t)=>new el({options:e,typeName:ne.ZodUnion,...pe(t)});const di=e=>e instanceof rl?di(e.schema):e instanceof Ar?di(e.innerType()):e instanceof il?[e.value]:e instanceof os?e.options:e instanceof sl?Ae.objectValues(e.enum):e instanceof ol?di(e._def.innerType):e instanceof Jc?[void 0]:e instanceof Xc?[null]:e instanceof Wr?[void 0,...di(e.unwrap())]:e instanceof as?[null,...di(e.unwrap())]:e instanceof X0||e instanceof ul?di(e.unwrap()):e instanceof al?di(e._def.innerType):[];class zd extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.object)return G(t,{code:D.invalid_type,expected:Q.object,received:t.parsedType}),oe;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=di(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new zd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...pe(n)})}}function z0(e,t){const n=ts(e),r=ts(t);if(e===t)return{valid:!0,data:e};if(n===Q.object&&r===Q.object){const n=Ae.objectKeys(t),r=Ae.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=z0(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Q.array&&r===Q.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=z0(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Q.date&&r===Q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class tl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(W0(e)||W0(r))return oe;const i=z0(e.value,r.value);return i.valid?(($0(e)||$0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:D.invalid_intersection_types}),oe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}tl.create=(e,t,n)=>new tl({left:e,right:t,typeName:ne.ZodIntersection,...pe(n)});class Vr extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return G(n,{code:D.invalid_type,expected:Q.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return G(n,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new zr(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Kt.mergeArray(t,e))):Kt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Vr({...this._def,rest:e})}}Vr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vr({items:e,typeName:ne.ZodTuple,rest:null,...pe(t)})};class nl extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return G(n,{code:D.invalid_type,expected:Q.object,received:n.parsedType}),oe;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new zr(n,e,n.path,e)),value:s._parse(new zr(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Kt.mergeObjectAsync(t,r):Kt.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new nl(t instanceof ve?{keyType:e,valueType:t,typeName:ne.ZodRecord,...pe(n)}:{keyType:xr.create(),valueType:e,typeName:ne.ZodRecord,...pe(t)})}}class Dd extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return G(n,{code:D.invalid_type,expected:Q.map,received:n.parsedType}),oe;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new zr(n,e,n.path,[s,"key"])),value:i._parse(new zr(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Dd.create=(e,t,n)=>new Dd({valueType:t,keyType:e,typeName:ne.ZodMap,...pe(n)});class eo extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return G(n,{code:D.invalid_type,expected:Q.set,received:n.parsedType}),oe;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(G(n,{code:D.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(G(n,{code:D.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return oe;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>i._parse(new zr(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new eo({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new eo({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eo.create=(e,t)=>new eo({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...pe(t)});class Pa extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.function)return G(t,{code:D.invalid_type,expected:Q.function,received:t.parsedType}),oe;function n(e,n){return Ud({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Md(),Ua].filter((e=>!!e)),issueData:{code:D.invalid_arguments,argumentsError:n}})}function r(e,n){return Ud({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Md(),Ua].filter((e=>!!e)),issueData:{code:D.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Fa){const e=this;return fn((async function(...t){const a=new Ln([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw a.addIssue(n(t,e)),a})),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw a.addIssue(r(u,e)),a}))}))}{const e=this;return fn((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Ln([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Ln([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pa({...this._def,args:Vr.create(e).rest(Js.create())})}returns(e){return new Pa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Pa({args:e||Vr.create([]).rest(Js.create()),returns:t||Js.create(),typeName:ne.ZodFunction,...pe(n)})}}class rl extends ve{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rl.create=(e,t)=>new rl({getter:e,typeName:ne.ZodLazy,...pe(t)});class il extends ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:D.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function W_(e,t){return new os({values:e,typeName:ne.ZodEnum,...pe(t)})}il.create=(e,t)=>new il({value:e,typeName:ne.ZodLiteral,...pe(t)});class os extends ve{constructor(){super(...arguments),$c.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:Ae.joinValues(n),received:t.parsedType,code:D.invalid_type}),oe}if(jd(this,$c)||j_(this,$c,new Set(this._def.values)),!jd(this,$c).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:D.invalid_enum_value,options:n}),oe}return fn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return os.create(e,{...this._def,...t})}exclude(e,t=this._def){return os.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}$c=new WeakMap,os.create=W_;class sl extends ve{constructor(){super(...arguments),zc.set(this,void 0)}_parse(e){const t=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){const e=Ae.objectValues(t);return G(n,{expected:Ae.joinValues(e),received:n.parsedType,code:D.invalid_type}),oe}if(jd(this,zc)||j_(this,zc,new Set(Ae.getValidEnumValues(this._def.values))),!jd(this,zc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:D.invalid_enum_value,options:e}),oe}return fn(e.data)}get enum(){return this._def.values}}zc=new WeakMap,sl.create=(e,t)=>new sl({values:e,typeName:ne.ZodNativeEnum,...pe(t)});class Fa extends ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.promise&&!1===t.common.async)return G(t,{code:D.invalid_type,expected:Q.promise,received:t.parsedType}),oe;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return fn(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Fa.create=(e,t)=>new Fa({type:e,typeName:ne.ZodPromise,...pe(t)});class Ar extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return oe;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?La(r.value):r}));{if("aborted"===t.value)return oe;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?La(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?oe:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?oe:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Qc(e))return e;const s=r.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Qc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}Ar.create=(e,t,n)=>new Ar({schema:e,typeName:ne.ZodEffects,effect:t,...pe(n)}),Ar.createWithPreprocess=(e,t,n)=>new Ar({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...pe(n)});class Wr extends ve{_parse(e){return this._getType(e)===Q.undefined?fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Wr.create=(e,t)=>new Wr({innerType:e,typeName:ne.ZodOptional,...pe(t)});class as extends ve{_parse(e){return this._getType(e)===Q.null?fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:ne.ZodNullable,...pe(t)});class ol extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ol.create=(e,t)=>new ol({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pe(t)});class al extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Kc(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ln(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Ln(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}al.create=(e,t)=>new al({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pe(t)});class Wd extends ve{_parse(e){if(this._getType(e)!==Q.nan){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.nan,received:t.parsedType}),oe}return{status:"valid",value:e.data}}}Wd.create=e=>new Wd({typeName:ne.ZodNaN,...pe(e)});const sw=Symbol("zod_brand");class X0 extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class fl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),La(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new fl({in:e,out:t,typeName:ne.ZodPipeline})}}class ul extends ve{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Qc(e)&&(e.value=Object.freeze(e.value)),e);return Kc(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function $_(e,t={},n){return e?ja.create().superRefine(((r,i)=>{var s,a;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===a||a,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):ja.create()}ul.create=(e,t)=>new ul({innerType:e,typeName:ne.ZodReadonly,...pe(t)});const ow={object:st.lazycreate};var ne;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ne||(ne={}));const aw=(e,t={message:`Input not instance of ${e.name}`})=>$_((t=>t instanceof e),t),z_=xr.create,V_=is.create,uw=Wd.create,cw=ss.create,Z_=Yc.create,lw=Xs.create,fw=Fd.create,dw=Jc.create,hw=Xc.create,pw=ja.create,gw=Js.create,mw=gi.create,vw=Bd.create,_w=wr.create,yw=st.create,xw=st.strictCreate,ww=el.create,bw=zd.create,Aw=tl.create,Sw=Vr.create,Cw=nl.create,Ew=Dd.create,Iw=eo.create,kw=Pa.create,Tw=rl.create,Nw=il.create,Rw=os.create,Ow=sl.create,Lw=Fa.create,kv=Ar.create,Pw=Wr.create,Mw=as.create,Uw=Ar.createWithPreprocess,jw=fl.create,Fw=()=>z_().optional(),Bw=()=>V_().optional(),Dw=()=>Z_().optional(),Ww={string:e=>xr.create({...e,coerce:!0}),number:e=>is.create({...e,coerce:!0}),boolean:e=>Yc.create({...e,coerce:!0}),bigint:e=>ss.create({...e,coerce:!0}),date:e=>Xs.create({...e,coerce:!0})},$w=oe;var ot=Object.freeze({__proto__:null,defaultErrorMap:Ua,setErrorMap:$x,getErrorMap:Md,makeIssue:Ud,EMPTY_PATH:zx,addIssueToContext:G,ParseStatus:Kt,INVALID:oe,DIRTY:La,OK:fn,isAborted:W0,isDirty:$0,isValid:Qc,isAsync:Kc,get util(){return Ae},get objectUtil(){return D0},ZodParsedType:Q,getParsedType:ts,ZodType:ve,datetimeRegex:D_,ZodString:xr,ZodNumber:is,ZodBigInt:ss,ZodBoolean:Yc,ZodDate:Xs,ZodSymbol:Fd,ZodUndefined:Jc,ZodNull:Xc,ZodAny:ja,ZodUnknown:Js,ZodNever:gi,ZodVoid:Bd,ZodArray:wr,ZodObject:st,ZodUnion:el,ZodDiscriminatedUnion:zd,ZodIntersection:tl,ZodTuple:Vr,ZodRecord:nl,ZodMap:Dd,ZodSet:eo,ZodFunction:Pa,ZodLazy:rl,ZodLiteral:il,ZodEnum:os,ZodNativeEnum:sl,ZodPromise:Fa,ZodEffects:Ar,ZodTransformer:Ar,ZodOptional:Wr,ZodNullable:as,ZodDefault:ol,ZodCatch:al,ZodNaN:Wd,BRAND:sw,ZodBranded:X0,ZodPipeline:fl,ZodReadonly:ul,custom:$_,Schema:ve,ZodSchema:ve,late:ow,get ZodFirstPartyTypeKind(){return ne},coerce:Ww,any:pw,array:_w,bigint:cw,boolean:Z_,date:lw,discriminatedUnion:bw,effect:kv,enum:Rw,function:kw,instanceof:aw,intersection:Aw,lazy:Tw,literal:Nw,map:Ew,nan:uw,nativeEnum:Ow,never:mw,null:hw,nullable:Mw,number:V_,object:yw,oboolean:Dw,onumber:Bw,optional:Pw,ostring:Fw,pipeline:jw,preprocess:Uw,promise:Lw,record:Cw,set:Iw,strictObject:xw,string:z_,symbol:fw,transformer:kv,tuple:Sw,undefined:dw,union:ww,unknown:gw,void:vw,NEVER:$w,ZodIssueCode:D,quotelessJson:Wx,ZodError:Ln});const zw=ot.object({url:ot.string().min(1,"Field is required")}),Vw=({open:e,user:t,onCloseModal:n})=>{const r=Fx({user:t}),i=ry(),[s,a]=ln(!0),o=Q0({shouldFocusError:!1,mode:"onSubmit",resolver:M_(zw),defaultValues:{url:""}}),[u,{data:l}]=Ks.endpoints.getApiV1InstanceDomains.useLazyQuery(),c=e=>{!s&&a(!0),o.setValue("url",e),(e=>{s&&u({limit:20,domain:e,software:"mastodon"})})(e)},d=s&&!!o.getValues("url");return I.jsxs(ll,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[I.jsx(l_,{...o,children:I.jsxs("form",{className:"flex flex-col gap-3 md:mb-4 md:flex-row md:items-end",autoFocus:!1,onSubmit:(...e)=>{o.handleSubmit(r)(...e)},children:[I.jsx(f_,{control:o.control,name:"url",render:({field:e})=>I.jsxs(D1,{className:"mt-0 flex-1",children:[I.jsx(W1,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),I.jsxs("div",{className:"relative",children:[I.jsx($1,{children:I.jsx(d_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),I.jsx(z1,{"data-testid":"command",children:I.jsx(V1,{"data-testid":"list",className:"bg-background absolute z-50 mt-1 w-full rounded-md shadow-md empty:hidden",children:d&&(null==l?void 0:l.map((e=>I.jsx(Z1,{className:"w-full max-w-[unset] [&>div]:overflow-hidden [&>div]:text-ellipsis",onSelect:e=>{a(!1),o.setValue("url",e)},children:I.jsx("div",{dangerouslySetInnerHTML:{__html:Bx(e,o.getValues("url"))}})},e))))})})]}),I.jsx(q1,{className:"md:absolute"})]})}),I.jsx(rs,{type:"submit",variant:"primary",children:"Take me home"})]})}),I.jsxs("div",{children:[I.jsx("span",{className:"text-base text-slate-500",children:"Do not have an account yet?"}),I.jsx(rs,{"data-testid":"join",variant:"tertiary",className:"text-blue_100 ml-1 text-base",onClick:()=>{null==n||n(),i("/signin",{props:{redirectUrl:window.location.href}})},children:"Join Wellsley"})]})]})},br=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,q_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=ln(!1),a=ft(to.selectors.selectIsAuthenticated),[o]=sy(),[u]=oy(),l=null==e?void 0:e.domain,c={user:e,username:br(e),...l&&{domain:l}};return{follow:async()=>{a?await o(c):s(!0),null==t||t()},unfollow:async()=>{await u({mutual:r,...c}),null==n||n()},renderGuestFollowModal:()=>i?I.jsx(Vw,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},Zw=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=pi(null),[s,a]=ln(t),o=pi(null),u=pi(null),l=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),u.current&&clearTimeout(u.current)},c=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout((()=>{a(!1)}),r),o.current&&clearTimeout(o.current)};return $r((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),$r((()=>{const e=i.current;if(e)return e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),()=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",c)}}),[i.current,...n]),[i,s,a]},qw=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>I.jsxs(ll,{open:e,onCloseModal:s,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...o,children:[I.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-slate-700","data-testid":a,children:t}),n&&I.jsx("div",{className:"text-center text-base text-slate-500",children:n}),I.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[I.jsx(L0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&I.jsx(L0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),Hw=e=>!(null==e||!e.blocked),H_=(e=!1)=>{const[t,n]=ln(e);return[t,x0((()=>n(!0)),[]),x0((()=>n(!1)),[]),x0((()=>n((e=>!e))),[]),n]},ev=({user:e,relationship:t})=>{const[n,{isLoading:r}]=k1(),[i]=T1(),[s,a,o]=H_(),u=Hw(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),zt.success(`${e.username} is unblocked`)}catch(e){zt.error(`${Gs(e)}`)}},()=>I.jsx(qw,{open:s,title:`Do you want to block ${e.username}?`,onClose:o,"data-testid":"block-dialog",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:o},rightButton:{title:"Block",variant:"red_primary",isLoading:r,onClick:()=>{(async()=>{try{await n({userId:e.id}).unwrap(),zt.success(`${e.username} is blocked`),o()}catch(e){zt.error(`${Gs(e)}`)}})()}},children:"Blocked users will not be able to follow you or see your content, and you will not see any content from them. They will also be aware that they have been blocked."}),s]},G_=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=ev({user:t,relationship:s}),f=ay(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=uy(s),v=hv(s),[m,g]=Zw(),y=h&&!g||v;if(!a)return I.jsx(rs,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Fe("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!hv&&"bg-slate-700",o),variant:c?"secondary_danger":y?"secondary":"primary",disabled:i,children:c?"Unblock":h?g?"Cancel follow request":"Follow Pending":v?p:f})},Tv={data:null,isError:!1,isPending:!1,isSuccess:!1},Hc=Da({name:"user",initialState:Tv,reducers:{reset:e=>{Object.assign(e,Tv)}},extraReducers:e=>{e.addCase(E_,((e,{payload:t})=>{e.data=t})).addCase(vx,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(j0,((e,{payload:t})=>{e.isSuccess=t})).addCase(U0,((e,{payload:t})=>{e.isPending=t})).addCase(C_,((e,{payload:t})=>{e.isError=t})).addCase(S_,((e,{payload:t})=>{e.error=t})).addCase(_x,((e,{payload:t})=>{var n;null!=(n=e.data)&&n.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var n;return null==(n=e.data)?void 0:n.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var n;return t===(null==(n=e.data)?void 0:n.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),Gc="8.48.0",mi=globalThis;function tv(e,t,n){const r=mi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Gc]=i[Gc]||{};return s[e]||(s[e]=t())}const Q_=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Gw="Sentry Logger ",Nv=["debug","info","warn","error","log","assert","trace"],Rv={};function Qw(e){if(!("console"in mi))return e();const t=mi.console,n={},r=Object.keys(Rv);r.forEach((e=>{const r=Rv[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function Kw(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Q_?Nv.forEach((n=>{t[n]=(...t)=>{e&&Qw((()=>{mi.console[n](`${Gw}[${n}]:`,...t)}))}})):Nv.forEach((e=>{t[e]=()=>{}})),t}const Od=tv("logger",Kw);function nv(){return rv(mi),mi}function rv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Gc,t[Gc]=t[Gc]||{}}const Yw=Object.prototype.toString;function Jw(e,t){return Yw.call(e)===`[object ${t}]`}function Xw(e){return Jw(e,"Object")}function e2(e){return!(!e||!e.then||"function"!=typeof e.then)}function t2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Q_&&Od.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const K_=1e3;function Y_(){return Date.now()/K_}function n2(){const{performance:e}=mi;if(!e||!e.now)return Y_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/K_}const r2=n2();function Ma(){const e=mi,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function i2(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||r2(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Ma()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Ov(){return Ma()}function Lv(){return Ma().substring(16)}function J_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=J_(r[e],t[e],n-1));return r}(()=>{const{performance:e}=mi;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,s=i<t,a=e.timing&&e.timing.navigationStart,o="number"==typeof a?Math.abs(a+n-r):t;(s||o<t)&&(i<=o&&e.timeOrigin)})();const V0="_sentrySpan";function Pv(e,t){t?t2(e,V0,t):delete e[V0]}function Mv(e){return e[V0]}const s2=100;class iv{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ov(),spanId:Lv()}}clone(){const e=new iv;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Pv(e,Mv(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&i2(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[n,r]=t instanceof cl?[t.getScopeData(),t.getRequestSession()]:Xw(t)?[e,e.requestSession]:[],{tags:i,extra:s,user:a,contexts:o,level:u,fingerprint:l=[],propagationContext:c}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...o},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),l.length&&(this._fingerprint=l),c&&(this._propagationContext=c),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Pv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ov()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:s2;if(n<=0)return this;const r={timestamp:Y_(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Mv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=J_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Lv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ma();if(!this._client)return Od.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:Ma();if(!this._client)return Od.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Ma();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Od.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const cl=iv;function o2(){return tv("defaultCurrentScope",(()=>new cl))}function a2(){return tv("defaultIsolationScope",(()=>new cl))}class u2{constructor(e,t){let n,r;n=e||new cl,r=t||new cl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return e2(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Ba(){const e=rv(nv());return e.stack=e.stack||new u2(o2(),a2())}function c2(e){return Ba().withScope(e)}function l2(e,t){const n=Ba();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function Uv(e){return Ba().withScope((()=>e(Ba().getIsolationScope())))}function f2(){return{withIsolationScope:Uv,withScope:c2,withSetScope:l2,withSetIsolationScope:(e,t)=>Uv(t),getCurrentScope:()=>Ba().getScope(),getIsolationScope:()=>Ba().getIsolationScope()}}function X_(e){const t=rv(e);return t.acs?t.acs:f2()}function e1(){return X_(nv()).getCurrentScope()}function d2(){return X_(nv()).getIsolationScope()}function h2(e,t){return e1().captureException(e,void 0)}function p2(e,t){const n={captureContext:t};return e1().captureMessage(e,void 0,n)}function g2(e,t){d2().setExtra(e,t)}const m2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return g2("exceptionMessage",t),void h2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}p2(t)},v2=()=>"object"!=typeof window,_2="wlsy",t1=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},y2=()=>{const e=new Set,t=t1();if(!t)return[];for(let n=0;n<(null==t?void 0:t.length);n+=1){const r=null==t?void 0:t.key(n);"string"==typeof r&&e.add(r)}return Array.from(e)},sv=e=>{const t=`${_2}${e?`:${e}`:""}`,n=e=>`${t}:${e}`,r=()=>y2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=t1(),a=e=>{try{return null==s?void 0:s.getItem(n(e))}catch{return null}},o=(e,t)=>{try{null==s||s.setItem(n(e),String(t))}catch{return}};return{getItem:a,setItem:o,removeItem:e=>{try{null==s||s.removeItem(n(e))}catch{return}},clear:()=>{try{r().forEach((e=>null==s?void 0:s.removeItem(e)))}catch{return}},keys:()=>r().map(i),has:e=>null!==a(e),getJSON:e=>{const t=a(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{o(e,JSON.stringify(t))}catch{return}}}},jv=["debug","info","warn","error"],x2=(e,t)=>{const n=jv.indexOf(e);return jv.indexOf(t)>=n},Ed=(e,t,n,...r)=>{x2(t,e)&&console.log(`[${e}] ${n}`,...r)},w2=()=>sv().getItem("logger_lvl"),b2=(e=(v2()?"info":w2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Ed("debug",t,e,...n),info:(e,...n)=>Ed("info",t,e,...n),warn:(e,...n)=>Ed("warn",t,e,...n),error:(e,...n)=>(m2(e,...n),Ed("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Vd=b2(),A2=e=>{try{const{type:t,payload:n}=e,r={type:t};return void 0!==n&&(r.payload=JSON.parse(JSON.stringify(n))),r}catch(t){return Vd.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},S2=e=>{const t=window.parent??window;if(t)try{const n=A2(e);t.postMessage(n,"*")}catch(e){Vd.error("Failed to process or send message:",e)}},ov="auth_token",av=sv("user"),n1=()=>av.getItem(ov)||void 0,C2=e=>av.setItem(ov,e),E2=()=>av.removeItem(ov),I2=()=>!!n1(),k2={getToken:n1,setToken:C2,removeToken:E2,hasToken:I2},Fv={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!k2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},r1=Da({name:"auth",initialState:Fv,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Fv,isPending:!1}),setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload}},selectors:{selectAskLoginOpen:e=>e.isAskLoginOpen,selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectIsAuthenticated:e=>e.isAuthenticated}}),T2=()=>{window.parent===window?by().dispatch(r1.actions.setAskLoginOpen(!0)):S2(px())},dl=e=>{const t=ft(Hc.selectors.selectCurrentUser),n=ft(to.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():T2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?I.jsx(P0,{theme:"dark",tooltipText:`${br(t)} is suspended`,size:"default",triggerClassname:n,children:I.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):I.jsx(I.Fragment,{children:e})}},i1=({user:e,size:t="m",disabled:n,className:r,relationship:i,isRelationshipPending:s,onFollow:a,onUnfollow:o,followButtonText:u,unfollowButtonText:l})=>{const{follow:c,unfollow:d,renderGuestFollowModal:f}=q_({user:e,onFollow:a,onUnfollow:o}),p=K0(e.id),{isDisabled:h,ActionTooltipWrapper:v}=dl();return p||s?null:I.jsxs("div",{"data-testid":"followControl",children:[f(),I.jsx(v,{triggerClassname:Fe("l"===t&&"w-full"),children:I.jsx(G_,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},Bv=({author:e,notification:t,isPopup:n})=>{var r,i;const s=$d(),[a]=N1(),[o]=R1(),{relationship:u,isLoading:l}=cy({userId:null==e?void 0:e.id}),c=!(!e||"FOLLOW"!==t.type),d=!(!e||"FOLLOW_REQUEST"!==t.type),f=e?br(e):"",p=t.followResponse||(null==(i=null==(r=t.meta)?void 0:r.actionsTaken)?void 0:i[0].text);return I.jsxs(I.Fragment,{children:[c&&e&&I.jsx(i1,{size:"s",user:e,relationship:u,isRelationshipPending:l}),p?I.jsx("div",{className:Fe("text-s min-h-xl inline-flex min-w-[120px] items-center font-medium text-slate-500",!n&&"justify-end"),children:"Declined"===p?"REJECTED":p.toUpperCase()}):d?I.jsxs("div",{className:"flex items-center gap-2","data-testid":"followControls",children:[I.jsx(rs,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{e&&(o({username:f,user:e}),s(Pd.actions.updateNotification({...t,followResponse:"Declined"})))},children:"Reject"}),I.jsx(rs,{size:"s",variant:"primary",className:Fe("min-w-[100px]",n&&"order-first"),onClick:()=>{e&&(a({username:f,user:e}),s(Pd.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},N2=e=>{const{user:t,isLoading:n}=__(),{data:r,isLoading:i,error:s}=ly(e),a="userId"in e,{data:o,isLoading:u}=fy({userId:a?e.userId:"",htmlContent:e.htmlContent??!1,canFetch:!!a&&(e.canFetch??!0)});return[a&&o||r,"username"in e&&`@${null==t?void 0:t.username}`===e.username||a&&(null==t?void 0:t.id)===e.userId,n||i||a&&u,!!s]},s1={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},R2=({selected:e,onSelect:t})=>Object.keys(s1).map((n=>I.jsxs("span",{className:Fe("p-xxs gap-xxxs flex cursor-pointer rounded-full border border-slate-400 bg-transparent text-sm",{"border-slate-100 bg-slate-100":e===n}),onClick:()=>t(n),children:[e===n&&I.jsx(zy,{size:16}),"forever"===n?"Until I unmute":`For ${n}`]},n))),o1=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=dy(),[a,{isLoading:o}]=hy(),[u,l]=ln("forever"),c=e?br(e):"",[d,f,p]=H_(),h=py(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),zt.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?I.jsxs(ll,{open:d,onCloseModal:p,title:`Do you want to mute ${e.username}?`,className:"p-none","data-testid":"mute-dialog",children:[I.jsx("span",{className:"text-sm text-slate-500",children:"Muted users can still follow you and see your content, but you will not see any content from them. They will not know that they have been muted."}),I.jsx("div",{className:"gap-xxxs mt-m flex",children:I.jsx(R2,{selected:u,onSelect:l})}),I.jsx(L0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=s1[u];i({userId:e.id,...t&&{duration:t}}),zt.success(`${c} is muted`),p(),null==n||n()})()},isLoading:s,className:"mt-m ml-auto block","data-testid":"submitAction",children:"Mute"})]}):null,isMuteDialogOpened:d}};function a1(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a1(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function O2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a1(e))&&(r&&(r+=" "),r+=t);return r}const Dv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,Z0=O2,L2=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return Z0(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map((e=>{const t=null==n?void 0:n[e],r=null==s?void 0:s[e];if(null===t)return null;const a=Dv(t)||Dv(r);return i[e][a]})),o=n&&Object.entries(n).reduce(((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e}),{}),u=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce(((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every((e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...s,...o}[t]):{...s,...o}[t]===n}))?[...e,n,r]:e}),[]);return Z0(e,a,u,null==n?void 0:n.class,null==n?void 0:n.className)},P2=L2("rounded-full",{variants:{size:{20:"size-5 text-[10px]",24:"size-6 text-[10px]",32:"size-8 text-sm",40:"size-10 text-base",48:"size-[48px] text-base",96:"size-[96px] text-[32px]"}},defaultVariants:{size:40}}),u1=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return I.jsxs(H1,{className:Fe(P2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&I.jsx(G1,{src:t,alt:"user-avatar"}),I.jsx("span",{className:"flex size-full items-center justify-center bg-slate-700 text-white",children:null==(i=null==e?void 0:e[0])?void 0:i.toUpperCase()})]})},M2={data:null,isPending:!1,isSuccess:!1},Sn=Da({name:"userNoHTML",initialState:M2,reducers:{setUser:(e,t)=>{e.data=t.payload},setPending:(e,t)=>{e.isPending=t.payload},setSuccess:(e,{payload:t})=>{e.isSuccess=t},setError:(e,{payload:t})=>{e.error=t}},selectors:{selectUser:e=>e.data,selectPending:e=>e.isPending,selectError:e=>e.error,selectSuccess:e=>e.isSuccess}}),c1="getApiV1UsersRelationships",U2=Ys.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,c1).find((e=>e.targets.includes(t))))),ci=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=U2(e,t);return i?n(Ks.util.updateQueryData(c1,i,(e=>{e[t]={...e[t],...r}}))):null},l1=3,f1=64,Wv=5,$v=2,j2=30,F2=50,d1=30,Zd={short:"Too short",long:"Too long"},uv=new RegExp("\\p{Extended_Pictographic}","u"),B2=({showInlineError:e=!0})=>ot.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Zd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),D2=ot.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=uv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),W2=ot.string().max(1024,Zd.long).optional(),h1=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>ot.string().trim().min(e,t).max(n,Zd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);h1({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),h1({minLength:2,minErrorMessage:Zd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),ot.string().trim().min(1,"").regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/,"Invalid characters");const $2="Required: A-Z, a-z, 0-9, special character, min 3, max 64";ot.string().trim().superRefine(((e,t)=>{uv.test(e)&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis are not allowed"}),/[A-Z]/.test(e)&&/[a-z]/.test(e)&&/[0-9]/.test(e)&&/[^A-Za-z0-9]/.test(e)&&e.length>=3&&e.length<=64||t.addIssue({code:ot.ZodIssueCode.custom,message:$2})})),ot.string().trim().min(5,"Must be at least 5 characters long").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/i,"Email format is not valid").refine((e=>!uv.test(e)),"Emojis are not allowed"),ot.object({bio:W2,username:B2({showInlineError:!0}),displayName:D2}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()});const zv=e=>{var t;const n=e,r=409===(null==n?void 0:n.status);return{message:"UserNameIsReserved"===(null==(t=null==n?void 0:n.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:r}},z2=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){zt.error(`${Gs(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(U0(!0));try{const e=await Ve(n);e&&t(E_(e.data)),t(j0(!0))}catch(e){t(j0(!1)),t(C_(!0)),t(S_(e))}finally{t(U0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,zt.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&zt.error(`${Gs(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Sn.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Sn.actions.setUser(e.data)),t(Sn.actions.setSuccess(!0)),t(Sn.actions.setPending(!1)))}catch(e){r&&(t(Sn.actions.setSuccess(!1)),t(Sn.actions.setError(e)),t(Sn.actions.setPending(!1))),zt.error(`${Gs(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,zt.success("User created successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&zt.error(`${Gs(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Sn.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Sn.actions.setUser(e.data)),t(Sn.actions.setSuccess(!0)),t(Sn.actions.setPending(!1)))}catch(e){r&&(t(Sn.actions.setSuccess(!1)),t(Sn.actions.setError(e)),t(Sn.actions.setPending(!1))),zt.error(`${Gs(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await Ve(t,`Accepted follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await Ve(t,`Rejected follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n}){await Ve(t,`Follow request sent to ${e.username}`)&&n(Ks.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await Ve(t,`You unfollowed ${e.username}`,(()=>null==i?void 0:i.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const{userId:i,text:s}=e.noteUpdate,a=ci({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await Ve(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await Ve(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`${e.username} has been removed from followers`)}}}}).injectEndpoints({endpoints:e=>({getInteractionUrl:e.query({query:e=>({url:e,headers:{Accept:"application/activity+json"}}),transformResponse:e=>"string"==typeof e?JSON.parse(e):e})})}),{useGetInteractionUrlQuery:YA,usePostApiV1UsersMutation:JA,useDeleteApiV1AccountsDeleteMutation:XA,useGetApiV1AccountsProfileQuery:eS,usePutApiV1UsersByUserIdMutation:tS,useGetApiV1UsersQuery:nS,useDeleteApiV1UsersMutation:rS,usePostApiV1MuteByUserIdMutation:iS,useDeleteApiV1MuteByUserIdMutation:sS,useGetApiV1MuteQuery:oS,usePostApiV1AdminUserChangeStateMutation:aS,useGetApiV1UsersRelationshipsQuery:V2,usePutApiV1NotesMutation:uS,useDeleteApiV1NotesByUserIdMutation:cS,useLazyGetApiV1UsersRelationshipsQuery:Z2,useLazyGetApiV1GeoQuery:lS,useGetApiV1UsersFollowersQuery:fS,useGetApiV1UsersByUserIdQuery:dS,useLazyGetApiV1GroupsAccountQuery:hS,useLazyGetApiV1UsersRenameHistoryQuery:pS,useGetApiV1UsersByUserIdFollowersQuery:gS,usePostApiV1UsersFollowByUsernameMutation:mS,usePostApiV1UsersFollowByUsernameUndoMutation:vS,usePostApiV1UsersFollowByUsernameRejectMutation:_S,usePostApiV1UsersFollowByUsernameAcceptMutation:yS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:xS}=z2,q2=()=>{const e=ft(Hc.selectors.selectCurrentUser),t=ft(r1.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Hc.selectors.selectPending),isLogged:t,error:ft(Hc.selectors.selectError)}},p1=({onChange:e})=>{const{user:t}=q2(),n=null==t?void 0:t.id,r=pi(n);$r((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Vv=["following","followed","blocked","muted","note","blocked_by"],Zv=({userId:e,currentUserId:t})=>{const n="string"==typeof e,r=n?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],i=e===t;return{isSingleUser:n,canFetch:!(!r.length||i||!t),safeTargets:r}},g1=({userId:e,skip:t})=>{const n=ft(Hc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Zv({userId:e,currentUserId:r}),{data:o,isLoading:u}=V2({targets:a,filter:Vv},{skip:!i||t}),[l]=Z2(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Zv({userId:e,currentUserId:r});t&&l({targets:n,filter:Vv})};return p1({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},H2=e=>e.replace(/(&lt;)/g,"<").replace(/&gt;/g,">"),qv=(e,t)=>null!=t&&t.length?t.reduce(((e,t)=>e=e.replaceAll(new RegExp(`:${t.shortcode}:`,"g"),`<img class="custom-emoji" src="${t.staticUrl}" alt='emoji ${t.shortcode}'/>`)),e):e,G2={list:[]},Q2=Da({name:"emojis",initialState:G2,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(x_);var qd=(e=>(e.header="header",e.avatar="avatar",e))(qd||{});const cv=({user:e,type:t})=>{var n,r,i,s;if(!e)return"";try{return("avatar"===t?null==(r=null==(n=e.avatar)?void 0:n.files[0])?void 0:r.uri:null==(s=null==(i=e.header)?void 0:i.files[0])?void 0:s.uri)||""}catch{return""}},K2="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%209V0L0%2012H9C10.6569%2012%2012%2010.6569%2012%209Z'%20fill='white'/%3e%3cpath%20d='M0%203V12L12%200H3C1.34315%200%200%201.34315%200%203Z'%20fill='%23CBD5E1'/%3e%3c/svg%3e",Y2="Enter",q0=52,J2=e=>{const[t,n]=ln((null==e?void 0:e.length)||0),r=pi(null),i=pi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===Y2&&(e.preventDefault(),null==(t=r.current)||t.blur(),null==(n=i.current)||n.blur())},handleTextareaChange:e=>{const t=e.target,r=t.value.length;n(r);const i=X2(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},X2=e=>{if(e instanceof HTMLTextAreaElement){const t=document.createElement("canvas").getContext("2d"),n=window.getComputedStyle(e);if(t){t.font=n.font||"16px sans-serif";const r=parseInt(n.paddingLeft||"0")||0,i=parseInt(n.paddingRight||"0")||0,s=e.clientWidth-r-i;return t.measureText(e.value).width>s}return e.scrollHeight>52}{const t=e.value.includes("\n"),n=e.scrollWidth>e.clientWidth;return t||n}},Hv=52,Vc=200,eb=10,tb=ot.object({note:ot.string().max(Vc)}),nb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=gy(),[s]=my(),a=ft(to.selectors.selectIsAuthenticated),o=ft(Y0.selectors.selectCurrentUser),u=(null==o?void 0:o.id)===e,l=e=>{const t=e.target.value;c(t)},c=async(t="")=>{t?await i({noteUpdate:{userId:e,text:t}}):await s({userId:e})},d=Q0({resolver:M_(tb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=J2(t);if(!u&&a)return I.jsx(l_,{...d,children:I.jsxs("form",{className:Fe("my-5",n),onKeyDown:g,children:[h>=190&&I.jsxs("div",{className:"mb-xxs text-right text-sm text-slate-400",children:[Vc-h," characters left"]}),I.jsx(f_,{control:d.control,name:"note",render:e=>I.jsxs("div",{className:"rounded-m relative flex items-center bg-slate-100 text-slate-700",children:[r?I.jsx("textarea",{...e,ref:p,maxLength:Vc,onBlur:l,onChange:m,defaultValue:t,placeholder:"Leave a note (visible only to you)",className:"scrollbar-hide p-s w-full resize-none border-0 bg-transparent text-base leading-5 outline-none [-ms-overflow-style:none] [scrollbar-width:none] focus:border-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-[1] [&::-webkit-scrollbar]:hidden",style:{height:"52px"}}):I.jsx("input",{...e,ref:f,maxLength:Vc,onBlur:l,onChange:e=>{v(e.target.value.length)},defaultValue:t,placeholder:"Leave a note visible only to you",className:"p-s w-full border-0 bg-transparent focus-visible:outline-none disabled:opacity-[1]",style:{height:"52px"}}),I.jsx("img",{src:K2,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Gv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?I.jsx(b_,{size:16}):I.jsx(A_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return I.jsxs("div",{className:Fe(i,"flex items-center gap-1 rounded-sm bg-white px-2 py-1 text-sm font-semibold outline",t&&"p-1",n),children:[r,!t&&Ys.capitalize(e)]})},rb=({children:e})=>I.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),m1=({user:e,status:t,skip:n=!1})=>{const r=ft(Y0.selectors.selectCurrentUser),i=ft(to.selectors.selectIsAuthenticated),s=!n&&i,a=null!=e&&e.domain?`@${e.username}@${e.domain}`:void 0,o=(null==e?void 0:e.id)||(null==r?void 0:r.id),u=!(t||!o||!s),l=!(!t||!i||u||!s||a),{data:c,isLoading:d}=vy({userNameFull:a},{skip:!a}),{data:f,isLoading:p}=_y({status:t},{skip:u||!l}),{data:h,isLoading:v}=yy({userId:o},{skip:l||!u});return[(u?[...h||[],...c||[]]:null)||f,p||v||d]},es={followers:"followers",following:"following"},ib=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{const[s,a]=m1({user:e}),[o,u]=ln({open:!1,tab:es.followers}),{guardedAction:l,ActionTooltipWrapper:c}=dl(),d=(null==s?void 0:s.length)||0,f=1===d?"follower":"followers",p=(null==s?void 0:s.slice(0,3))||[];return a?I.jsx(h_,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==d||t?I.jsxs("div",{"data-testid":"user-followers",children:[o.open&&(null==r?void 0:r({user:e,tab:o.tab,isOpen:!0,onClose:()=>u((e=>({...e,open:!1}))),...i})),I.jsx(c,{children:I.jsxs("div",{onClick:l((()=>{u({tab:es.followers,open:!0})})),className:Fe("mb-4 flex cursor-pointer items-center text-base font-medium text-slate-900",n),children:[p.length>0&&I.jsx("ul",{className:"mr-2 flex items-center",children:p.map(((e,t)=>I.jsx("li",{className:Fe("relative",t>0&&"-ml-2"),children:I.jsx("div",{className:"rounded-full bg-white p-0.5",children:I.jsx(y_,{size:24,name:e.displayName,imgUrl:cv({user:e,type:qd.avatar})})})},e.id)))}),d," ",f]})})]}):null},sb=({status:e,userId:t,skip:n=!1})=>{const r=ft(to.selectors.selectIsAuthenticated),i=!!e&&r,{data:s,isLoading:a}=O1({status:e},{skip:!i||n}),{data:o,isLoading:u}=L1({userId:t},{skip:i||!t||!r||n});return{data:s||o,isLoading:a||u}},ob=({userUrl:e})=>I.jsxs("div",{className:"flex w-full items-center justify-between",children:[I.jsxs("div",{className:"gap-xs flex items-center",children:[I.jsx("div",{className:"flex size-10 items-center justify-center rounded-full border border-slate-200",children:I.jsx(ux,{size:20})}),I.jsxs("div",{className:"text-sm",children:[I.jsx("p",{className:"mb-xxxs font-semibold text-slate-900",children:"Some followers may not be visible"}),I.jsx("span",{className:"text-slate-400",children:"You can see more on the original server"})]})]}),I.jsx(iy,{baseUrl:e,children:I.jsx("a",{href:e,children:I.jsxs(rs,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",I.jsx(ix,{})]})})})]}),Qv=({count:e=15,className:t,itemClassName:n})=>I.jsx("div",{"data-testid":"list-loader",className:Fe("gap-m ml-auto mr-auto flex max-w-[560px] flex-col",t),children:Array.from(Array(e).keys()).map(((e,t)=>I.jsx(h_,{className:Fe("rounded-m h-[50px] w-full",n)},t)))});var Kv,Zc={exports:{}},ab=Zc.exports;
42
+ */_e("remoteReady");const px=_e("askLogin");_e("reselectUser"),_e("requestLogout"),_e("setConfirmLeavePage"),_e("requestChangePath");const gx=_e("wsSubscribe"),mx=_e("wsUnSubscribe");_e("hostStoreConnect"),_e("remoteLogin"),_e("remoteLogout"),_e("wsOnMessage"),_e("setRouterPath"),_e("setDeviceType");const S_=_e("setUserError"),C_=_e("setUserIsError"),U0=_e("setUserPending"),j0=_e("setUserSuccess"),E_=_e("setUserData"),vx=_e("updateAccountData"),_x=_e("updateUser"),I_=_e("addNotification"),k_=_e("markNotification"),T_=_e("setNotificationsError"),N_=_e("setNotificationsList"),F0=_e("setNotificationsPending"),R_=_e("setNotificationsTotalCount"),B0=_e("setNotificationsUnreadCount"),O_=_e("resetNotificationsState"),L_=_e("undoNotification");_e("setInstanceInfo"),_e("setInstanceInfoPending"),_e("setInstanceInfoError"),_e("setPlatformSettings"),_e("setProfileSettings"),_e("setGroupData"),_e("setGroupLoading"),c_("requestMicroFrontendFetch"),c_("sendMicroFrontendFetchResponse");const yx=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(F0(!0));try{const e=await Ve(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(N_({userId:s,list:e.data}))}catch(e){t(T_(e))}finally{t(F0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n),t(k_(e))}catch(e){zt.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await Ve(n),t(B0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await Ve(n),i=!e.status;r&&t(i?R_(r.data):B0(r.data))}catch(e){zt.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:xx,usePostApiV1NotificationsByIdMarkMutation:wx,usePostApiV1NotificationsMarkAllMutation:GA,useGetApiV1NotificationsCountQuery:bx}=yx,Sv={data:{userId:"",list:[]},count:{},isPending:!1},Ax=e=>e,Sx=e=>e.error,Cx=e=>e.isPending,Ex=e=>{var t;return null==(t=e.count)?void 0:t.total},Ix=e=>{var t;return null==(t=e.count)?void 0:t.unread},kx=e=>e.data.userId,J0=G0(Ax,(e=>e.data.list)),Tx=G0(J0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Nx=G0(J0,(e=>null==e?void 0:e.at(-1))),Pd=Da({name:"notifications",initialState:Sv,reducers:{updateNotification:(e,t)=>{var n;if(!e.data.list)return;const r=t.payload;e.data.list=null==(n=e.data.list)?void 0:n.map((e=>e.id===r.id?{...e,...r}:e))},readAll:e=>{var t;e.data.list&&(e.data.list=null==(t=e.data.list)?void 0:t.map((e=>({...e,status:"READ"}))))}},extraReducers:e=>{e.addCase(F0,((e,t)=>{e.isPending=t.payload})).addCase(T_,((e,t)=>{e.error=t.payload})).addCase(N_,((e,t)=>{const n=t.payload.userId,r=t.payload.list;e.data={userId:n,list:[...e.data.list||[],...r.filter((t=>{var n;return!(null!=(n=e.data.list)&&n.some((e=>e.id===t.id)))}))]}})).addCase(I_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(k_,((e,t)=>{e.data.list&&(e.data.list=e.data.list.map((e=>e.id===t.payload.id?{...e,status:t.payload.status}:e)))})).addCase(R_,((e,t)=>{e.count.total=t.payload})).addCase(B0,((e,t)=>{e.count.unread=t.payload})).addCase(O_,(()=>Sv)).addCase(L_,((e,t)=>{var n,r,i;const s=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===s)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(i=e.data.list)?void 0:i.filter((e=>e.id!==s)))||[]}))},selectors:{selectError:Sx,selectIsPending:Cx,selectTotalCount:Ex,selectUnreadCount:Ix,selectNotifications:J0,selectUnreadNotifications:Tx,selectLastNotification:Nx,selectNotificationsOwner:kx}}),QA=()=>I.jsx(U1,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),KA=(e,t)=>j1(e,{...t,containerId:"custom"});var Cv=function(e,t,n){if(e&&"reportValidity"in e){var r=M0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},P_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Cv(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Cv(t,n,e)}))};for(var r in t.fields)n(r)},Rx=function(e,t){t.shouldUseNativeValidation&&P_(e,t);var n={};for(var r in e){var i=M0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Ox(t.names||Object.keys(e),r)){var a=Object.assign({},M0(n,r));w0(a,"root",s),w0(n,r,a)}else w0(n,r,s)}return n},Ox=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},Lx=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var o=r.unionErrors[0].errors[0];n[a]={message:o.message,type:o.code}}else n[a]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var u=n[a].types,l=u&&u[r.code];n[a]=ty(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},M_=function(e,t,n){return void 0===n&&(n={}),function(r,i,s){try{return Promise.resolve(function(i,a){try{var o=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return s.shouldUseNativeValidation&&P_({},s),{errors:{},values:n.raw?r:e}}))}catch(e){return a(e)}return o&&o.then?o.then(void 0,a):o}(0,(function(e){if(null!=e.errors)return{values:{},errors:Rx(Lx(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const Px=e=>{try{return e.startsWith("https")||e.startsWith("http")?new URL(e).origin:new URL(`https://${e}`).origin}catch{throw new Error("Error getting domain from entered URL")}},Mx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Ux=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),jx=async({url:e,...t})=>{const n=await fetch(e,t);if(!n.ok)throw new Error(n.statusText);if("PUT"===t.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},Fx=({user:e})=>async({url:t})=>{const n=Px(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await jx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Mx(r),s=Ux({template:i,user:e});if(!s)throw new Error("Error getting follow link");window.open(s,"_self")}catch{window.open(`${n}/authorize_interaction?uri=${e.uri}`,"_self")}},Bx=(e,t)=>{const n=e.at(0),r=(null==n?void 0:n.toUpperCase())===n&&"@"!==n,i=e.toLowerCase(),s=(null==t?void 0:t.toLowerCase())||"";if(!s)return e;const a=i.startsWith(s),o=i.replace(s,`<mark>${a?Ys.capitalize(s):t}</mark>`);return r&&a?o:Ys.capitalize(o)},Ev=e=>{e.preventDefault()},Dx=e=>e?{onOpenAutoFocus:Ev,onCloseAutoFocus:Ev}:{},ll=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>e?I.jsx(F1,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:I.jsx(B1,{className:Fe(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...Dx(s),childrenClassName:Fe("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})}):null;var Ae,D0;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ae||(Ae={})),(D0||(D0={})).mergeShapes=(e,t)=>({...e,...t});const Q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ts=e=>{switch(typeof e){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:null===e?Q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Q.promise:typeof Map<"u"&&e instanceof Map?Q.map:typeof Set<"u"&&e instanceof Set?Q.set:typeof Date<"u"&&e instanceof Date?Q.date:Q.object;default:return Q.unknown}},D=Ae.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Wx=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ln extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Ln))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ln.create=e=>new Ln(e);const Ua=(e,t)=>{let n;switch(e.code){case D.invalid_type:n=e.received===Q.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case D.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case D.invalid_union:n="Invalid input";break;case D.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case D.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case D.invalid_arguments:n="Invalid function arguments";break;case D.invalid_return_type:n="Invalid function return type";break;case D.invalid_date:n="Invalid date";break;case D.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case D.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case D.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case D.custom:n="Invalid input";break;case D.invalid_intersection_types:n="Intersection results could not be merged";break;case D.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case D.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ae.assertNever(e)}return{message:n}};let U_=Ua;function $x(e){U_=e}function Md(){return U_}const Ud=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},zx=[];function G(e,t){const n=Md(),r=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ua?void 0:Ua].filter((e=>!!e))});e.common.issues.push(r)}class Kt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return oe;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return Kt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return oe;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(typeof i.value<"u"||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}const oe=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),fn=e=>({status:"valid",value:e}),W0=e=>"aborted"===e.status,$0=e=>"dirty"===e.status,Qc=e=>"valid"===e.status,Kc=e=>typeof Promise<"u"&&e instanceof Promise;function jd(e,t,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function j_(e,t,n,r,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var J,$c,zc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(J||(J={}));class zr{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Iv=(e,t)=>{if(Qc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ln(e.common.issues);return this._error=t,this._error}}};function pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:typeof i.data>"u"?{message:null!==(s=o??r)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=o??n)&&void 0!==a?a:i.defaultError}},description:i}}class ve{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ts(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Kt,ctx:{common:e.parent.common,data:e.data,parsedType:ts(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Kc(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Iv(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ts(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Kc(r)?r:Promise.resolve(r));return Iv(n,i)}refine(e,t){const n=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),s=()=>r.addIssue({code:D.custom,...n(t)});return typeof Promise<"u"&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Ar({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Wr.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wr.create(this,this._def)}promise(){return Fa.create(this,this._def)}or(e){return el.create([this,e],this._def)}and(e){return tl.create(this,e,this._def)}transform(e){return new Ar({...pe(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ol({...pe(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new X0({typeName:ne.ZodBranded,type:this,...pe(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new al({...pe(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return fl.create(this,e)}readonly(){return ul.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Vx=/^c[^\s-]{8,}$/i,Zx=/^[0-9a-z]+$/,qx=/^[0-9A-HJKMNP-TV-Z]{26}$/,Hx=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Gx=/^[a-z0-9_-]{21}$/i,Qx=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Kx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let k0;const Jx=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xx=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F_="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tw=new RegExp(`^${F_}$`);function B_(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function nw(e){return new RegExp(`^${B_(e)}$`)}function D_(e){let t=`${F_}T${B_(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function rw(e,t){return!(("v4"!==t&&t||!Jx.test(e))&&("v6"!==t&&t||!Xx.test(e)))}class xr extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.string,received:t.parsedType}),oe}const t=new Kt;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,s=e.data.length<r.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?G(n,{code:D.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&G(n,{code:D.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)Kx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"email",code:D.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)k0||(k0=new RegExp(Yx,"u")),k0.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"emoji",code:D.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)Hx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"uuid",code:D.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)Gx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"nanoid",code:D.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Vx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid",code:D.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Zx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid2",code:D.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)qx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ulid",code:D.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),G(n,{validation:"url",code:D.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"regex",code:D.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?D_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?tw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?nw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:D.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?Qx.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:D.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?rw(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ip",code:D.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?ew.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"base64",code:D.invalid_string,message:r.message}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:D.invalid_string,...J.errToObj(n)})}_addCheck(e){return new xr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...J.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,...J.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...J.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new xr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function iw(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}xr.create=e=>{var t;return new xr({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class is extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Q.number){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.number,received:t.parsedType}),oe}let t;const n=new Kt;for(const r of this._def.checks)"int"===r.kind?Ae.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:D.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==iw(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_finite,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Ae.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}is.create=e=>new is({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class ss extends ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Q.bigint){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.bigint,received:t.parsedType}),oe}let t;const n=new Kt;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:D.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new ss({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new ss({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ss.create=e=>{var t;return new ss({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class Yc extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.boolean,received:t.parsedType}),oe}return fn(e.data)}}Yc.create=e=>new Yc({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class Xs extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.date,received:t.parsedType}),oe}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:D.invalid_date}),oe}const t=new Kt;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:D.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Xs.create=e=>new Xs({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...pe(e)});class Fd extends ve{_parse(e){if(this._getType(e)!==Q.symbol){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.symbol,received:t.parsedType}),oe}return fn(e.data)}}Fd.create=e=>new Fd({typeName:ne.ZodSymbol,...pe(e)});class Jc extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.undefined,received:t.parsedType}),oe}return fn(e.data)}}Jc.create=e=>new Jc({typeName:ne.ZodUndefined,...pe(e)});class Xc extends ve{_parse(e){if(this._getType(e)!==Q.null){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.null,received:t.parsedType}),oe}return fn(e.data)}}Xc.create=e=>new Xc({typeName:ne.ZodNull,...pe(e)});class ja extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return fn(e.data)}}ja.create=e=>new ja({typeName:ne.ZodAny,...pe(e)});class Js extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fn(e.data)}}Js.create=e=>new Js({typeName:ne.ZodUnknown,...pe(e)});class gi extends ve{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.never,received:t.parsedType}),oe}}gi.create=e=>new gi({typeName:ne.ZodNever,...pe(e)});class Bd extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.void,received:t.parsedType}),oe}return fn(e.data)}}Bd.create=e=>new Bd({typeName:ne.ZodVoid,...pe(e)});class wr extends ve{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Q.array)return G(t,{code:D.invalid_type,expected:Q.array,received:t.parsedType}),oe;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(G(t,{code:e?D.too_big:D.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(G(t,{code:D.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(G(t,{code:D.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new zr(t,e,t.path,n))))).then((e=>Kt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new zr(t,e,t.path,n))));return Kt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new wr({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new wr({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new wr({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}}function Oa(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Wr.create(Oa(r))}return new st({...e._def,shape:()=>t})}return e instanceof wr?new wr({...e._def,type:Oa(e.element)}):e instanceof Wr?Wr.create(Oa(e.unwrap())):e instanceof as?as.create(Oa(e.unwrap())):e instanceof Vr?Vr.create(e.items.map((e=>Oa(e)))):e}wr.create=(e,t)=>new wr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...pe(t)});class st extends ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ae.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Q.object){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.object,received:t.parsedType}),oe}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof gi&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||s.push(e);const a=[];for(const e of i){const t=r[e],i=n.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new zr(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof gi){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(G(n,{code:D.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new zr(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>Kt.mergeObjectSync(t,e))):Kt.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new st({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,s,a;const o=null!==(s=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=J.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(e){return new st({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new st({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new st({...this._def,catchall:e})}pick(e){const t={};return Ae.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}deepPartial(){return Oa(this)}partial(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new st({...this._def,shape:()=>t})}required(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Wr;)e=e._def.innerType;t[n]=e}})),new st({...this._def,shape:()=>t})}keyof(){return W_(Ae.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:gi.create(),typeName:ne.ZodObject,...pe(t)});class el extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Ln(e.ctx.common.issues)));return G(t,{code:D.invalid_union,unionErrors:n}),oe}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"===s.status&&!e&&(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Ln(e)));return G(t,{code:D.invalid_union,unionErrors:i}),oe}}get options(){return this._def.options}}el.create=(e,t)=>new el({options:e,typeName:ne.ZodUnion,...pe(t)});const di=e=>e instanceof rl?di(e.schema):e instanceof Ar?di(e.innerType()):e instanceof il?[e.value]:e instanceof os?e.options:e instanceof sl?Ae.objectValues(e.enum):e instanceof ol?di(e._def.innerType):e instanceof Jc?[void 0]:e instanceof Xc?[null]:e instanceof Wr?[void 0,...di(e.unwrap())]:e instanceof as?[null,...di(e.unwrap())]:e instanceof X0||e instanceof ul?di(e.unwrap()):e instanceof al?di(e._def.innerType):[];class zd extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.object)return G(t,{code:D.invalid_type,expected:Q.object,received:t.parsedType}),oe;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=di(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new zd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...pe(n)})}}function z0(e,t){const n=ts(e),r=ts(t);if(e===t)return{valid:!0,data:e};if(n===Q.object&&r===Q.object){const n=Ae.objectKeys(t),r=Ae.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=z0(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Q.array&&r===Q.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=z0(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Q.date&&r===Q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class tl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(W0(e)||W0(r))return oe;const i=z0(e.value,r.value);return i.valid?(($0(e)||$0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:D.invalid_intersection_types}),oe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}tl.create=(e,t,n)=>new tl({left:e,right:t,typeName:ne.ZodIntersection,...pe(n)});class Vr extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return G(n,{code:D.invalid_type,expected:Q.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return G(n,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new zr(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Kt.mergeArray(t,e))):Kt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Vr({...this._def,rest:e})}}Vr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vr({items:e,typeName:ne.ZodTuple,rest:null,...pe(t)})};class nl extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return G(n,{code:D.invalid_type,expected:Q.object,received:n.parsedType}),oe;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new zr(n,e,n.path,e)),value:s._parse(new zr(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Kt.mergeObjectAsync(t,r):Kt.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new nl(t instanceof ve?{keyType:e,valueType:t,typeName:ne.ZodRecord,...pe(n)}:{keyType:xr.create(),valueType:e,typeName:ne.ZodRecord,...pe(t)})}}class Dd extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return G(n,{code:D.invalid_type,expected:Q.map,received:n.parsedType}),oe;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new zr(n,e,n.path,[s,"key"])),value:i._parse(new zr(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Dd.create=(e,t,n)=>new Dd({valueType:t,keyType:e,typeName:ne.ZodMap,...pe(n)});class eo extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return G(n,{code:D.invalid_type,expected:Q.set,received:n.parsedType}),oe;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(G(n,{code:D.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(G(n,{code:D.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return oe;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>i._parse(new zr(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new eo({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new eo({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eo.create=(e,t)=>new eo({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...pe(t)});class Pa extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.function)return G(t,{code:D.invalid_type,expected:Q.function,received:t.parsedType}),oe;function n(e,n){return Ud({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Md(),Ua].filter((e=>!!e)),issueData:{code:D.invalid_arguments,argumentsError:n}})}function r(e,n){return Ud({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Md(),Ua].filter((e=>!!e)),issueData:{code:D.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Fa){const e=this;return fn((async function(...t){const a=new Ln([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw a.addIssue(n(t,e)),a})),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw a.addIssue(r(u,e)),a}))}))}{const e=this;return fn((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Ln([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Ln([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pa({...this._def,args:Vr.create(e).rest(Js.create())})}returns(e){return new Pa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Pa({args:e||Vr.create([]).rest(Js.create()),returns:t||Js.create(),typeName:ne.ZodFunction,...pe(n)})}}class rl extends ve{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rl.create=(e,t)=>new rl({getter:e,typeName:ne.ZodLazy,...pe(t)});class il extends ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:D.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function W_(e,t){return new os({values:e,typeName:ne.ZodEnum,...pe(t)})}il.create=(e,t)=>new il({value:e,typeName:ne.ZodLiteral,...pe(t)});class os extends ve{constructor(){super(...arguments),$c.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:Ae.joinValues(n),received:t.parsedType,code:D.invalid_type}),oe}if(jd(this,$c)||j_(this,$c,new Set(this._def.values)),!jd(this,$c).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:D.invalid_enum_value,options:n}),oe}return fn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return os.create(e,{...this._def,...t})}exclude(e,t=this._def){return os.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}$c=new WeakMap,os.create=W_;class sl extends ve{constructor(){super(...arguments),zc.set(this,void 0)}_parse(e){const t=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){const e=Ae.objectValues(t);return G(n,{expected:Ae.joinValues(e),received:n.parsedType,code:D.invalid_type}),oe}if(jd(this,zc)||j_(this,zc,new Set(Ae.getValidEnumValues(this._def.values))),!jd(this,zc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:D.invalid_enum_value,options:e}),oe}return fn(e.data)}get enum(){return this._def.values}}zc=new WeakMap,sl.create=(e,t)=>new sl({values:e,typeName:ne.ZodNativeEnum,...pe(t)});class Fa extends ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.promise&&!1===t.common.async)return G(t,{code:D.invalid_type,expected:Q.promise,received:t.parsedType}),oe;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return fn(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Fa.create=(e,t)=>new Fa({type:e,typeName:ne.ZodPromise,...pe(t)});class Ar extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return oe;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?La(r.value):r}));{if("aborted"===t.value)return oe;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?La(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?oe:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?oe:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Qc(e))return e;const s=r.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Qc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}Ar.create=(e,t,n)=>new Ar({schema:e,typeName:ne.ZodEffects,effect:t,...pe(n)}),Ar.createWithPreprocess=(e,t,n)=>new Ar({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...pe(n)});class Wr extends ve{_parse(e){return this._getType(e)===Q.undefined?fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Wr.create=(e,t)=>new Wr({innerType:e,typeName:ne.ZodOptional,...pe(t)});class as extends ve{_parse(e){return this._getType(e)===Q.null?fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:ne.ZodNullable,...pe(t)});class ol extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ol.create=(e,t)=>new ol({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pe(t)});class al extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Kc(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ln(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Ln(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}al.create=(e,t)=>new al({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pe(t)});class Wd extends ve{_parse(e){if(this._getType(e)!==Q.nan){const t=this._getOrReturnCtx(e);return G(t,{code:D.invalid_type,expected:Q.nan,received:t.parsedType}),oe}return{status:"valid",value:e.data}}}Wd.create=e=>new Wd({typeName:ne.ZodNaN,...pe(e)});const sw=Symbol("zod_brand");class X0 extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class fl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),La(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new fl({in:e,out:t,typeName:ne.ZodPipeline})}}class ul extends ve{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Qc(e)&&(e.value=Object.freeze(e.value)),e);return Kc(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function $_(e,t={},n){return e?ja.create().superRefine(((r,i)=>{var s,a;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===a||a,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):ja.create()}ul.create=(e,t)=>new ul({innerType:e,typeName:ne.ZodReadonly,...pe(t)});const ow={object:st.lazycreate};var ne;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(ne||(ne={}));const aw=(e,t={message:`Input not instance of ${e.name}`})=>$_((t=>t instanceof e),t),z_=xr.create,V_=is.create,uw=Wd.create,cw=ss.create,Z_=Yc.create,lw=Xs.create,fw=Fd.create,dw=Jc.create,hw=Xc.create,pw=ja.create,gw=Js.create,mw=gi.create,vw=Bd.create,_w=wr.create,yw=st.create,xw=st.strictCreate,ww=el.create,bw=zd.create,Aw=tl.create,Sw=Vr.create,Cw=nl.create,Ew=Dd.create,Iw=eo.create,kw=Pa.create,Tw=rl.create,Nw=il.create,Rw=os.create,Ow=sl.create,Lw=Fa.create,kv=Ar.create,Pw=Wr.create,Mw=as.create,Uw=Ar.createWithPreprocess,jw=fl.create,Fw=()=>z_().optional(),Bw=()=>V_().optional(),Dw=()=>Z_().optional(),Ww={string:e=>xr.create({...e,coerce:!0}),number:e=>is.create({...e,coerce:!0}),boolean:e=>Yc.create({...e,coerce:!0}),bigint:e=>ss.create({...e,coerce:!0}),date:e=>Xs.create({...e,coerce:!0})},$w=oe;var ot=Object.freeze({__proto__:null,defaultErrorMap:Ua,setErrorMap:$x,getErrorMap:Md,makeIssue:Ud,EMPTY_PATH:zx,addIssueToContext:G,ParseStatus:Kt,INVALID:oe,DIRTY:La,OK:fn,isAborted:W0,isDirty:$0,isValid:Qc,isAsync:Kc,get util(){return Ae},get objectUtil(){return D0},ZodParsedType:Q,getParsedType:ts,ZodType:ve,datetimeRegex:D_,ZodString:xr,ZodNumber:is,ZodBigInt:ss,ZodBoolean:Yc,ZodDate:Xs,ZodSymbol:Fd,ZodUndefined:Jc,ZodNull:Xc,ZodAny:ja,ZodUnknown:Js,ZodNever:gi,ZodVoid:Bd,ZodArray:wr,ZodObject:st,ZodUnion:el,ZodDiscriminatedUnion:zd,ZodIntersection:tl,ZodTuple:Vr,ZodRecord:nl,ZodMap:Dd,ZodSet:eo,ZodFunction:Pa,ZodLazy:rl,ZodLiteral:il,ZodEnum:os,ZodNativeEnum:sl,ZodPromise:Fa,ZodEffects:Ar,ZodTransformer:Ar,ZodOptional:Wr,ZodNullable:as,ZodDefault:ol,ZodCatch:al,ZodNaN:Wd,BRAND:sw,ZodBranded:X0,ZodPipeline:fl,ZodReadonly:ul,custom:$_,Schema:ve,ZodSchema:ve,late:ow,get ZodFirstPartyTypeKind(){return ne},coerce:Ww,any:pw,array:_w,bigint:cw,boolean:Z_,date:lw,discriminatedUnion:bw,effect:kv,enum:Rw,function:kw,instanceof:aw,intersection:Aw,lazy:Tw,literal:Nw,map:Ew,nan:uw,nativeEnum:Ow,never:mw,null:hw,nullable:Mw,number:V_,object:yw,oboolean:Dw,onumber:Bw,optional:Pw,ostring:Fw,pipeline:jw,preprocess:Uw,promise:Lw,record:Cw,set:Iw,strictObject:xw,string:z_,symbol:fw,transformer:kv,tuple:Sw,undefined:dw,union:ww,unknown:gw,void:vw,NEVER:$w,ZodIssueCode:D,quotelessJson:Wx,ZodError:Ln});const zw=ot.object({url:ot.string().min(1,"Field is required")}),Vw=({open:e,user:t,onCloseModal:n})=>{const r=Fx({user:t}),i=ry(),[s,a]=ln(!0),o=Q0({shouldFocusError:!1,mode:"onSubmit",resolver:M_(zw),defaultValues:{url:""}}),[u,{data:l}]=Ks.endpoints.getApiV1InstanceDomains.useLazyQuery(),c=e=>{!s&&a(!0),o.setValue("url",e),(e=>{s&&u({limit:20,domain:e,software:"mastodon"})})(e)},d=s&&!!o.getValues("url");return I.jsxs(ll,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[I.jsx(l_,{...o,children:I.jsxs("form",{className:"flex flex-col gap-3 md:mb-4 md:flex-row md:items-end",autoFocus:!1,onSubmit:(...e)=>{o.handleSubmit(r)(...e)},children:[I.jsx(f_,{control:o.control,name:"url",render:({field:e})=>I.jsxs(D1,{className:"mt-0 flex-1",children:[I.jsx(W1,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),I.jsxs("div",{className:"relative",children:[I.jsx($1,{children:I.jsx(d_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),I.jsx(z1,{"data-testid":"command",children:I.jsx(V1,{"data-testid":"list",className:"bg-background absolute z-50 mt-1 w-full rounded-md shadow-md empty:hidden",children:d&&(null==l?void 0:l.map((e=>I.jsx(Z1,{className:"w-full max-w-[unset] [&>div]:overflow-hidden [&>div]:text-ellipsis",onSelect:e=>{a(!1),o.setValue("url",e)},children:I.jsx("div",{dangerouslySetInnerHTML:{__html:Bx(e,o.getValues("url"))}})},e))))})})]}),I.jsx(q1,{className:"md:absolute"})]})}),I.jsx(rs,{type:"submit",variant:"primary",children:"Take me home"})]})}),I.jsxs("div",{children:[I.jsx("span",{className:"text-base text-slate-500",children:"Do not have an account yet?"}),I.jsx(rs,{"data-testid":"join",variant:"tertiary",className:"text-blue_100 ml-1 text-base",onClick:()=>{null==n||n(),i("/signin",{props:{redirectUrl:window.location.href}})},children:"Join Wellsley"})]})]})},br=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,q_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=ln(!1),a=ft(to.selectors.selectIsAuthenticated),[o]=sy(),[u]=oy(),l=null==e?void 0:e.domain,c={user:e,username:br(e),...l&&{domain:l}};return{follow:async()=>{a?await o(c):s(!0),null==t||t()},unfollow:async()=>{await u({mutual:r,...c}),null==n||n()},renderGuestFollowModal:()=>i?I.jsx(Vw,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},Zw=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=pi(null),[s,a]=ln(t),o=pi(null),u=pi(null),l=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),u.current&&clearTimeout(u.current)},c=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout((()=>{a(!1)}),r),o.current&&clearTimeout(o.current)};return $r((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),$r((()=>{const e=i.current;if(e)return e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),()=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",c)}}),[i.current,...n]),[i,s,a]},qw=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>I.jsxs(ll,{open:e,onCloseModal:s,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...o,children:[I.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-slate-700","data-testid":a,children:t}),n&&I.jsx("div",{className:"text-center text-base text-slate-500",children:n}),I.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[I.jsx(L0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&I.jsx(L0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),Hw=e=>!(null==e||!e.blocked),H_=(e=!1)=>{const[t,n]=ln(e);return[t,x0((()=>n(!0)),[]),x0((()=>n(!1)),[]),x0((()=>n((e=>!e))),[]),n]},ev=({user:e,relationship:t})=>{const[n,{isLoading:r}]=k1(),[i]=T1(),[s,a,o]=H_(),u=Hw(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),zt.success(`${e.username} is unblocked`)}catch(e){zt.error(`${Gs(e)}`)}},()=>I.jsx(qw,{open:s,title:`Do you want to block ${e.username}?`,onClose:o,"data-testid":"block-dialog",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:o},rightButton:{title:"Block",variant:"red_primary",isLoading:r,onClick:()=>{(async()=>{try{await n({userId:e.id}).unwrap(),zt.success(`${e.username} is blocked`),o()}catch(e){zt.error(`${Gs(e)}`)}})()}},children:"Blocked users will not be able to follow you or see your content, and you will not see any content from them. They will also be aware that they have been blocked."}),s]},G_=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=ev({user:t,relationship:s}),f=ay(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=uy(s),v=hv(s),[m,g]=Zw(),y=h&&!g||v;if(!a)return I.jsx(rs,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Fe("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!hv&&"bg-slate-700",o),variant:c?"secondary_danger":y?"secondary":"primary",disabled:i,children:c?"Unblock":h?g?"Cancel follow request":"Follow Pending":v?p:f})},Tv={data:null,isError:!1,isPending:!1,isSuccess:!1},Hc=Da({name:"user",initialState:Tv,reducers:{reset:e=>{Object.assign(e,Tv)}},extraReducers:e=>{e.addCase(E_,((e,{payload:t})=>{e.data=t})).addCase(vx,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(j0,((e,{payload:t})=>{e.isSuccess=t})).addCase(U0,((e,{payload:t})=>{e.isPending=t})).addCase(C_,((e,{payload:t})=>{e.isError=t})).addCase(S_,((e,{payload:t})=>{e.error=t})).addCase(_x,((e,{payload:t})=>{var n;null!=(n=e.data)&&n.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var n;return null==(n=e.data)?void 0:n.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var n;return t===(null==(n=e.data)?void 0:n.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),Gc="8.48.0",mi=globalThis;function tv(e,t,n){const r=mi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Gc]=i[Gc]||{};return s[e]||(s[e]=t())}const Q_=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Gw="Sentry Logger ",Nv=["debug","info","warn","error","log","assert","trace"],Rv={};function Qw(e){if(!("console"in mi))return e();const t=mi.console,n={},r=Object.keys(Rv);r.forEach((e=>{const r=Rv[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function Kw(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Q_?Nv.forEach((n=>{t[n]=(...t)=>{e&&Qw((()=>{mi.console[n](`${Gw}[${n}]:`,...t)}))}})):Nv.forEach((e=>{t[e]=()=>{}})),t}const Od=tv("logger",Kw);function nv(){return rv(mi),mi}function rv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Gc,t[Gc]=t[Gc]||{}}const Yw=Object.prototype.toString;function Jw(e,t){return Yw.call(e)===`[object ${t}]`}function Xw(e){return Jw(e,"Object")}function e2(e){return!(!e||!e.then||"function"!=typeof e.then)}function t2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Q_&&Od.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const K_=1e3;function Y_(){return Date.now()/K_}function n2(){const{performance:e}=mi;if(!e||!e.now)return Y_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/K_}const r2=n2();function Ma(){const e=mi,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function i2(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||r2(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Ma()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Ov(){return Ma()}function Lv(){return Ma().substring(16)}function J_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=J_(r[e],t[e],n-1));return r}(()=>{const{performance:e}=mi;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,s=i<t,a=e.timing&&e.timing.navigationStart,o="number"==typeof a?Math.abs(a+n-r):t;(s||o<t)&&(i<=o&&e.timeOrigin)})();const V0="_sentrySpan";function Pv(e,t){t?t2(e,V0,t):delete e[V0]}function Mv(e){return e[V0]}const s2=100;class iv{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Ov(),spanId:Lv()}}clone(){const e=new iv;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,Pv(e,Mv(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&i2(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[n,r]=t instanceof cl?[t.getScopeData(),t.getRequestSession()]:Xw(t)?[e,e.requestSession]:[],{tags:i,extra:s,user:a,contexts:o,level:u,fingerprint:l=[],propagationContext:c}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...o},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),l.length&&(this._fingerprint=l),c&&(this._propagationContext=c),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,Pv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Ov()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:s2;if(n<=0)return this;const r={timestamp:Y_(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Mv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=J_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Lv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ma();if(!this._client)return Od.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:Ma();if(!this._client)return Od.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Ma();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Od.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const cl=iv;function o2(){return tv("defaultCurrentScope",(()=>new cl))}function a2(){return tv("defaultIsolationScope",(()=>new cl))}class u2{constructor(e,t){let n,r;n=e||new cl,r=t||new cl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return e2(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Ba(){const e=rv(nv());return e.stack=e.stack||new u2(o2(),a2())}function c2(e){return Ba().withScope(e)}function l2(e,t){const n=Ba();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function Uv(e){return Ba().withScope((()=>e(Ba().getIsolationScope())))}function f2(){return{withIsolationScope:Uv,withScope:c2,withSetScope:l2,withSetIsolationScope:(e,t)=>Uv(t),getCurrentScope:()=>Ba().getScope(),getIsolationScope:()=>Ba().getIsolationScope()}}function X_(e){const t=rv(e);return t.acs?t.acs:f2()}function e1(){return X_(nv()).getCurrentScope()}function d2(){return X_(nv()).getIsolationScope()}function h2(e,t){return e1().captureException(e,void 0)}function p2(e,t){const n={captureContext:t};return e1().captureMessage(e,void 0,n)}function g2(e,t){d2().setExtra(e,t)}const m2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return g2("exceptionMessage",t),void h2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}p2(t)},v2=()=>"object"!=typeof window,_2="wlsy",t1=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},y2=()=>{const e=new Set,t=t1();if(!t)return[];for(let n=0;n<(null==t?void 0:t.length);n+=1){const r=null==t?void 0:t.key(n);"string"==typeof r&&e.add(r)}return Array.from(e)},sv=e=>{const t=`${_2}${e?`:${e}`:""}`,n=e=>`${t}:${e}`,r=()=>y2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=t1(),a=e=>{try{return null==s?void 0:s.getItem(n(e))}catch{return null}},o=(e,t)=>{try{null==s||s.setItem(n(e),String(t))}catch{return}};return{getItem:a,setItem:o,removeItem:e=>{try{null==s||s.removeItem(n(e))}catch{return}},clear:()=>{try{r().forEach((e=>null==s?void 0:s.removeItem(e)))}catch{return}},keys:()=>r().map(i),has:e=>null!==a(e),getJSON:e=>{const t=a(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{o(e,JSON.stringify(t))}catch{return}}}},jv=["debug","info","warn","error"],x2=(e,t)=>{const n=jv.indexOf(e);return jv.indexOf(t)>=n},Ed=(e,t,n,...r)=>{x2(t,e)&&console.log(`[${e}] ${n}`,...r)},w2=()=>sv().getItem("logger_lvl"),b2=(e=(v2()?"info":w2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Ed("debug",t,e,...n),info:(e,...n)=>Ed("info",t,e,...n),warn:(e,...n)=>Ed("warn",t,e,...n),error:(e,...n)=>(m2(e,...n),Ed("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Vd=b2(),A2=e=>{try{const{type:t,payload:n}=e,r={type:t};return void 0!==n&&(r.payload=JSON.parse(JSON.stringify(n))),r}catch(t){return Vd.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},S2=e=>{const t=window.parent??window;if(t)try{const n=A2(e);t.postMessage(n,"*")}catch(e){Vd.error("Failed to process or send message:",e)}},ov="auth_token",av=sv("user"),n1=()=>av.getItem(ov)||void 0,C2=e=>av.setItem(ov,e),E2=()=>av.removeItem(ov),I2=()=>!!n1(),k2={getToken:n1,setToken:C2,removeToken:E2,hasToken:I2},Fv={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!k2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},r1=Da({name:"auth",initialState:Fv,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Fv,isPending:!1}),setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload}},selectors:{selectAskLoginOpen:e=>e.isAskLoginOpen,selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectIsAuthenticated:e=>e.isAuthenticated}}),T2=()=>{window.parent===window?by().dispatch(r1.actions.setAskLoginOpen(!0)):S2(px())},dl=e=>{const t=ft(Hc.selectors.selectCurrentUser),n=ft(to.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():T2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?I.jsx(P0,{theme:"dark",tooltipText:`${br(t)} is suspended`,size:"default",triggerClassname:n,children:I.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):I.jsx(I.Fragment,{children:e})}},i1=({user:e,size:t="m",disabled:n,className:r,relationship:i,isRelationshipPending:s,onFollow:a,onUnfollow:o,followButtonText:u,unfollowButtonText:l})=>{const{follow:c,unfollow:d,renderGuestFollowModal:f}=q_({user:e,onFollow:a,onUnfollow:o}),p=K0(e.id),{isDisabled:h,ActionTooltipWrapper:v}=dl();return p||s?null:I.jsxs("div",{"data-testid":"followControl",children:[f(),I.jsx(v,{triggerClassname:Fe("l"===t&&"w-full"),children:I.jsx(G_,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},Bv=({author:e,notification:t,isPopup:n})=>{var r,i;const s=$d(),[a]=N1(),[o]=R1(),{relationship:u,isLoading:l}=cy({userId:null==e?void 0:e.id}),c=!(!e||"FOLLOW"!==t.type),d=!(!e||"FOLLOW_REQUEST"!==t.type),f=e?br(e):"",p=t.followResponse||(null==(i=null==(r=t.meta)?void 0:r.actionsTaken)?void 0:i[0].text);return I.jsxs(I.Fragment,{children:[c&&e&&I.jsx(i1,{size:"s",user:e,relationship:u,isRelationshipPending:l}),p?I.jsx("div",{className:Fe("text-s min-h-xl inline-flex min-w-[120px] items-center font-medium text-slate-500",!n&&"justify-end"),children:"Declined"===p?"REJECTED":p.toUpperCase()}):d?I.jsxs("div",{className:"flex items-center gap-2","data-testid":"followControls",children:[I.jsx(rs,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{e&&(o({username:f,user:e}),s(Pd.actions.updateNotification({...t,followResponse:"Declined"})))},children:"Reject"}),I.jsx(rs,{size:"s",variant:"primary",className:Fe("min-w-[100px]",n&&"order-first"),onClick:()=>{e&&(a({username:f,user:e}),s(Pd.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},N2=e=>{const{user:t,isLoading:n}=__(),{data:r,isLoading:i,error:s}=ly(e),a="userId"in e,{data:o,isLoading:u}=fy({userId:a?e.userId:"",htmlContent:e.htmlContent??!1,canFetch:!!a&&(e.canFetch??!0)});return[a&&o||r,"username"in e&&`@${null==t?void 0:t.username}`===e.username||a&&(null==t?void 0:t.id)===e.userId,n||i||a&&u,!!s]},s1={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},R2=({selected:e,onSelect:t})=>Object.keys(s1).map((n=>I.jsxs("span",{className:Fe("p-xxs gap-xxxs flex cursor-pointer rounded-full border border-slate-400 bg-transparent text-sm",{"border-slate-100 bg-slate-100":e===n}),onClick:()=>t(n),children:[e===n&&I.jsx(zy,{size:16}),"forever"===n?"Until I unmute":`For ${n}`]},n))),o1=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=dy(),[a,{isLoading:o}]=hy(),[u,l]=ln("forever"),c=e?br(e):"",[d,f,p]=H_(),h=py(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),zt.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?I.jsxs(ll,{open:d,onCloseModal:p,title:`Do you want to mute ${e.username}?`,className:"p-none","data-testid":"mute-dialog",children:[I.jsx("span",{className:"text-sm text-slate-500",children:"Muted users can still follow you and see your content, but you will not see any content from them. They will not know that they have been muted."}),I.jsx("div",{className:"gap-xxxs mt-m flex",children:I.jsx(R2,{selected:u,onSelect:l})}),I.jsx(L0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=s1[u];i({userId:e.id,...t&&{duration:t}}),zt.success(`${c} is muted`),p(),null==n||n()})()},isLoading:s,className:"mt-m ml-auto block","data-testid":"submitAction",children:"Mute"})]}):null,isMuteDialogOpened:d}};function a1(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a1(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function O2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a1(e))&&(r&&(r+=" "),r+=t);return r}const Dv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,Z0=O2,L2=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return Z0(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map((e=>{const t=null==n?void 0:n[e],r=null==s?void 0:s[e];if(null===t)return null;const a=Dv(t)||Dv(r);return i[e][a]})),o=n&&Object.entries(n).reduce(((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e}),{}),u=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce(((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every((e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...s,...o}[t]):{...s,...o}[t]===n}))?[...e,n,r]:e}),[]);return Z0(e,a,u,null==n?void 0:n.class,null==n?void 0:n.className)},P2=L2("rounded-full",{variants:{size:{20:"size-5 text-[10px]",24:"size-6 text-[10px]",32:"size-8 text-sm",40:"size-10 text-base",48:"size-[48px] text-base",96:"size-[96px] text-[32px]"}},defaultVariants:{size:40}}),u1=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return I.jsxs(H1,{className:Fe(P2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&I.jsx(G1,{src:t,alt:"user-avatar"}),I.jsx("span",{className:"flex size-full items-center justify-center bg-slate-700 text-white",children:null==(i=null==e?void 0:e[0])?void 0:i.toUpperCase()})]})},M2={data:null,isPending:!1,isSuccess:!1},Sn=Da({name:"userNoHTML",initialState:M2,reducers:{setUser:(e,t)=>{e.data=t.payload},setPending:(e,t)=>{e.isPending=t.payload},setSuccess:(e,{payload:t})=>{e.isSuccess=t},setError:(e,{payload:t})=>{e.error=t}},selectors:{selectUser:e=>e.data,selectPending:e=>e.isPending,selectError:e=>e.error,selectSuccess:e=>e.isSuccess}}),c1="getApiV1UsersRelationships",U2=Ys.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,c1).find((e=>e.targets.includes(t))))),ci=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=U2(e,t);return i?n(Ks.util.updateQueryData(c1,i,(e=>{e[t]={...e[t],...r}}))):null},l1=3,f1=64,Wv=5,$v=2,j2=30,F2=50,d1=30,Zd={short:"Too short",long:"Too long"},uv=new RegExp("\\p{Extended_Pictographic}","u"),B2=({showInlineError:e=!0})=>ot.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Zd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),D2=ot.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=uv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),W2=ot.string().max(1024,Zd.long).optional(),h1=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>ot.string().trim().min(e,t).max(n,Zd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);h1({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),h1({minLength:2,minErrorMessage:Zd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),ot.string().trim().min(1,"").regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/,"Invalid characters");const $2="Required: A-Z, a-z, 0-9, special character, min 3, max 64";ot.string().trim().superRefine(((e,t)=>{uv.test(e)&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis are not allowed"}),/[A-Z]/.test(e)&&/[a-z]/.test(e)&&/[0-9]/.test(e)&&/[^A-Za-z0-9]/.test(e)&&e.length>=3&&e.length<=64||t.addIssue({code:ot.ZodIssueCode.custom,message:$2})})),ot.string().trim().min(5,"Must be at least 5 characters long").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/i,"Email format is not valid").refine((e=>!uv.test(e)),"Emojis are not allowed"),ot.object({bio:W2,username:B2({showInlineError:!0}),displayName:D2}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()});const zv=e=>{var t;const n=e,r=409===(null==n?void 0:n.status);return{message:"UserNameIsReserved"===(null==(t=null==n?void 0:n.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:r}},z2=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){zt.error(`${Gs(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(U0(!0));try{const e=await Ve(n);e&&t(E_(e.data)),t(j0(!0))}catch(e){t(j0(!1)),t(C_(!0)),t(S_(e))}finally{t(U0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,zt.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&zt.error(`${Gs(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Sn.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Sn.actions.setUser(e.data)),t(Sn.actions.setSuccess(!0)),t(Sn.actions.setPending(!1)))}catch(e){r&&(t(Sn.actions.setSuccess(!1)),t(Sn.actions.setError(e)),t(Sn.actions.setPending(!1))),zt.error(`${Gs(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,zt.success("User created successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&zt.error(`${Gs(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Sn.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Sn.actions.setUser(e.data)),t(Sn.actions.setSuccess(!0)),t(Sn.actions.setPending(!1)))}catch(e){r&&(t(Sn.actions.setSuccess(!1)),t(Sn.actions.setError(e)),t(Sn.actions.setPending(!1))),zt.error(`${Gs(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await Ve(t,`Accepted follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await Ve(t,`Rejected follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n}){await Ve(t,`Follow request sent to ${e.username}`)&&n(Ks.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=ci({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await Ve(t,`You unfollowed ${e.username}`,(()=>null==i?void 0:i.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const{userId:i,text:s}=e.noteUpdate,a=ci({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await Ve(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=ci({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await Ve(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`${e.username} has been removed from followers`)}}}}).injectEndpoints({endpoints:e=>({getInteractionUrl:e.query({query:e=>({url:e,headers:{Accept:"application/activity+json"}}),transformResponse:e=>"string"==typeof e?JSON.parse(e):e})})}),{useGetInteractionUrlQuery:YA,usePostApiV1UsersMutation:JA,useDeleteApiV1AccountsDeleteMutation:XA,useGetApiV1AccountsProfileQuery:eS,usePutApiV1UsersByUserIdMutation:tS,useGetApiV1UsersQuery:nS,useDeleteApiV1UsersMutation:rS,usePostApiV1MuteByUserIdMutation:iS,useDeleteApiV1MuteByUserIdMutation:sS,useGetApiV1MuteQuery:oS,usePostApiV1AdminUserChangeStateMutation:aS,useGetApiV1UsersRelationshipsQuery:V2,usePutApiV1NotesMutation:uS,useDeleteApiV1NotesByUserIdMutation:cS,useLazyGetApiV1UsersRelationshipsQuery:Z2,useLazyGetApiV1GeoQuery:lS,useGetApiV1UsersFollowersQuery:fS,useGetApiV1UsersByUserIdQuery:dS,useLazyGetApiV1GroupsAccountQuery:hS,useLazyGetApiV1UsersRenameHistoryQuery:pS,useGetApiV1UsersByUserIdFollowersQuery:gS,usePostApiV1UsersFollowByUsernameMutation:mS,usePostApiV1UsersFollowByUsernameUndoMutation:vS,usePostApiV1UsersFollowByUsernameRejectMutation:_S,usePostApiV1UsersFollowByUsernameAcceptMutation:yS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:xS}=z2,q2=()=>{const e=ft(Hc.selectors.selectCurrentUser),t=ft(r1.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Hc.selectors.selectPending),isLogged:t,error:ft(Hc.selectors.selectError)}},p1=({onChange:e})=>{const{user:t}=q2(),n=null==t?void 0:t.id,r=pi(n);$r((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Vv=["following","followed","blocked","muted","note","blocked_by"],Zv=({userId:e,currentUserId:t})=>{const n="string"==typeof e,r=n?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],i=e===t;return{isSingleUser:n,canFetch:!(!r.length||i||!t),safeTargets:r}},g1=({userId:e,skip:t})=>{const n=ft(Hc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Zv({userId:e,currentUserId:r}),{data:o,isLoading:u}=V2({targets:a,filter:Vv},{skip:!i||t}),[l]=Z2(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Zv({userId:e,currentUserId:r});t&&l({targets:n,filter:Vv})};return p1({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},H2=e=>e.replace(/(&lt;)/g,"<").replace(/&gt;/g,">"),qv=(e,t)=>null!=t&&t.length?t.reduce(((e,t)=>e=e.replaceAll(new RegExp(`:${t.shortcode}:`,"g"),`<img class="custom-emoji" src="${t.staticUrl}" alt='emoji ${t.shortcode}'/>`)),e):e,G2={list:[]},Q2=Da({name:"emojis",initialState:G2,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(x_);var qd=(e=>(e.header="header",e.avatar="avatar",e))(qd||{});const cv=({user:e,type:t})=>{var n,r,i,s;if(!e)return"";try{return("avatar"===t?null==(r=null==(n=e.avatar)?void 0:n.files[0])?void 0:r.uri:null==(s=null==(i=e.header)?void 0:i.files[0])?void 0:s.uri)||""}catch{return""}},K2="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%209V0L0%2012H9C10.6569%2012%2012%2010.6569%2012%209Z'%20fill='white'/%3e%3cpath%20d='M0%203V12L12%200H3C1.34315%200%200%201.34315%200%203Z'%20fill='%23CBD5E1'/%3e%3c/svg%3e",Y2="Enter",q0=52,J2=e=>{const[t,n]=ln((null==e?void 0:e.length)||0),r=pi(null),i=pi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===Y2&&(e.preventDefault(),null==(t=r.current)||t.blur(),null==(n=i.current)||n.blur())},handleTextareaChange:e=>{const t=e.target,r=t.value.length;n(r);const i=X2(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},X2=e=>{if(e instanceof HTMLTextAreaElement){const t=document.createElement("canvas").getContext("2d"),n=window.getComputedStyle(e);if(t){t.font=n.font||"16px sans-serif";const r=parseInt(n.paddingLeft||"0")||0,i=parseInt(n.paddingRight||"0")||0,s=e.clientWidth-r-i;return t.measureText(e.value).width>s}return e.scrollHeight>52}{const t=e.value.includes("\n"),n=e.scrollWidth>e.clientWidth;return t||n}},Hv=52,Vc=200,eb=10,tb=ot.object({note:ot.string().max(Vc)}),nb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=gy(),[s]=my(),a=ft(to.selectors.selectIsAuthenticated),o=ft(Y0.selectors.selectCurrentUser),u=(null==o?void 0:o.id)===e,l=e=>{const t=e.target.value;c(t)},c=async(t="")=>{t?await i({noteUpdate:{userId:e,text:t}}):await s({userId:e})},d=Q0({resolver:M_(tb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=J2(t);if(!u&&a)return I.jsx(l_,{...d,children:I.jsxs("form",{className:Fe("my-5",n),onKeyDown:g,children:[h>=190&&I.jsxs("div",{className:"mb-xxs text-right text-sm text-slate-400",children:[Vc-h," characters left"]}),I.jsx(f_,{control:d.control,name:"note",render:e=>I.jsxs("div",{className:"rounded-m relative flex items-center bg-slate-100 text-slate-700",children:[r?I.jsx("textarea",{...e,ref:p,maxLength:Vc,onBlur:l,onChange:m,defaultValue:t,placeholder:"Leave a note (visible only to you)",className:"scrollbar-hide p-s w-full resize-none border-0 bg-transparent text-base leading-5 outline-none [-ms-overflow-style:none] [scrollbar-width:none] focus:border-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-[1] [&::-webkit-scrollbar]:hidden",style:{height:"52px"}}):I.jsx("input",{...e,ref:f,maxLength:Vc,onBlur:l,onChange:e=>{v(e.target.value.length)},defaultValue:t,placeholder:"Leave a note visible only to you",className:"p-s w-full border-0 bg-transparent focus-visible:outline-none disabled:opacity-[1]",style:{height:"52px"}}),I.jsx("img",{src:K2,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Gv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?I.jsx(b_,{size:16}):I.jsx(A_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return I.jsxs("div",{className:Fe(i,"flex items-center gap-1 rounded-sm bg-white px-2 py-1 text-sm font-semibold outline",t&&"p-1",n),children:[r,!t&&Ys.capitalize(e)]})},rb=({children:e})=>I.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),m1=({user:e,status:t,skip:n=!1})=>{const r=ft(Y0.selectors.selectCurrentUser),i=ft(to.selectors.selectIsAuthenticated),s=!n&&i,a=null!=e&&e.domain?`@${e.username}@${e.domain}`:void 0,o=(null==e?void 0:e.id)||(null==r?void 0:r.id),u=!(t||!o||!s),l=!(!t||!i||u||!s||a),{data:c,isLoading:d}=vy({userNameFull:a},{skip:!a}),{data:f,isLoading:p}=_y({status:t},{skip:u||!l}),{data:h,isLoading:v}=yy({userId:o},{skip:l||!u});return[(u?[...h||[],...c||[]]:null)||f,p||v||d]},es={followers:"followers",following:"following"},ib=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{const[s,a]=m1({user:e}),[o,u]=ln({open:!1,tab:es.followers}),{guardedAction:l,ActionTooltipWrapper:c}=dl(),d=(null==s?void 0:s.length)||0,f=1===d?"follower":"followers",p=(null==s?void 0:s.slice(0,3))||[];return a?I.jsx(h_,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==d||t?I.jsxs("div",{"data-testid":"user-followers",children:[o.open&&(null==r?void 0:r({user:e,tab:o.tab,isOpen:!0,onClose:()=>u((e=>({...e,open:!1}))),...i})),I.jsx(c,{children:I.jsxs("div",{onClick:l((()=>{u({tab:es.followers,open:!0})})),className:Fe("mb-4 flex cursor-pointer items-center text-base font-medium text-slate-900",n),children:[p.length>0&&I.jsx("ul",{className:"mr-2 flex items-center",children:p.map(((e,t)=>I.jsx("li",{className:Fe("relative",t>0&&"-ml-2"),children:I.jsx("div",{className:"rounded-full bg-white p-0.5",children:I.jsx(y_,{size:24,name:e.displayName,imgUrl:cv({user:e,type:qd.avatar})})})},e.id)))}),d," ",f]})})]}):null},sb=({status:e,userId:t,skip:n=!1})=>{const r=ft(to.selectors.selectIsAuthenticated),i=!!e&&r,{data:s,isLoading:a}=O1({status:e},{skip:!i||n}),{data:o,isLoading:u}=L1({userId:t},{skip:i||!t||!r||n});return{data:s||o,isLoading:a||u}},ob=({userUrl:e})=>I.jsxs("div",{className:"flex w-full items-center justify-between",children:[I.jsxs("div",{className:"gap-xs flex items-center",children:[I.jsx("div",{className:"flex size-10 items-center justify-center rounded-full border border-slate-200",children:I.jsx(ux,{size:20})}),I.jsxs("div",{className:"text-sm",children:[I.jsx("p",{className:"mb-xxxs font-semibold text-slate-900",children:"Some followers may not be visible"}),I.jsx("span",{className:"text-slate-400",children:"You can see more on the original server"})]})]}),I.jsx(iy,{baseUrl:e,children:I.jsx("a",{href:e,children:I.jsxs(rs,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",I.jsx(ix,{})]})})})]}),Qv=({count:e=15,className:t,itemClassName:n})=>I.jsx("div",{"data-testid":"list-loader",className:Fe("gap-m ml-auto mr-auto flex max-w-[560px] flex-col",t),children:Array.from(Array(e).keys()).map(((e,t)=>I.jsx(h_,{className:Fe("rounded-m h-[50px] w-full",n)},t)))});var Kv,Zc={exports:{}},ab=Zc.exports;
43
43
  /**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "!*.map"
9
9
  ],
10
10
  "module": "index.ts",
11
- "version": "1.0.589",
11
+ "version": "1.0.591",
12
12
  "devDependencies": {
13
13
  "eslint-config": "^1.0.0",
14
14
  "prettier-config": "^1.0.0",