@wellesley/user 1.0.775 → 1.0.777

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 +3 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as Ma,usePostApiV1UploadsMutation as M5,useGetApiV1SearchQuery as O5,useGetApiV1TagsSearchQuery as D5,useGetApiV1InstanceTimezonesQuery as U5,useGetApiV1AddressesSuggestQuery as q5,usePutApiV1UsersByUserIdMutation as W5}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.760";import*as Rd from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import $n,{forwardRef as Lc,createElement as pf,useRef as wt,useState as yt,useEffect as Ze,useCallback as Qt,useLayoutEffect as Sz,useMemo as _r,createContext as Hg,memo as F5,useReducer as V5,useContext as Nd,isValidElement as B5,cloneElement as G5}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as rn}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.104";import{getErrorMsg as Po}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.609";import{createAction as Cz,createSlice as Dd,createSelector as vf}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as bw,set as s1,appendErrors as X5,useForm as Tz,useFieldArray as cg,FormProvider as H5}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Xw,rootReducer as Hw}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.759";import{useDispatch as Io,useSelector as mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as jz,wsSlice as Zw}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.742";import{getAcceptList as Pz,useImageSelection as Rz,UploadMediaModal as Lz,UploadTag as tb,selectUploadFile as Z5}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.645";import{cn as ct,DropdownMenu as lm,DropdownMenuTrigger as um,DropdownMenuContent as fm,DropdownMenuItem as By,Button as gn,Avatar as K5,AvatarImage as Y5,TooltipWrapper as Kw,Dialog as J5,DialogContent as Q5,Switch as Ez,Tooltip as rb,TooltipTrigger as nb,TooltipContent as ab,Textarea as $5,getTextareaClassName as e7,FormLabel as Zg,useFormField as Nz,FormField as t7,FormItem as r7,FormControl as Ly,Input as i1,FormMessage as n7,Form as Yw,ButtonLoader as hf,Popover as a7,PopoverTrigger as s7,PopoverContent as i7,Calendar as o1,Checkbox as o7}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.722";import{useLogout as Iz,authToken as c7,authSlice as l7}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.816";import{useAppsNavigate as Jw,getRoute as Gy,getEntryAppRoute as u7,AppsLink as Xy}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.686";import{EmojiPicker as f7,EmojiStyle as d7}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.609";var Ki=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ud(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sb,hg={exports:{}},p7=hg.exports;
1
+ import{api as Ma,usePostApiV1UploadsMutation as M5,useGetApiV1SearchQuery as O5,useGetApiV1TagsSearchQuery as D5,useGetApiV1InstanceTimezonesQuery as U5,useGetApiV1AddressesSuggestQuery as q5,usePutApiV1UsersByUserIdMutation as W5}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.762";import*as Rd from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import $n,{forwardRef as Lc,createElement as pf,useRef as wt,useState as yt,useEffect as Ze,useCallback as Qt,useLayoutEffect as Sz,useMemo as _r,createContext as Hg,memo as F5,useReducer as V5,useContext as Nd,isValidElement as B5,cloneElement as G5}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as rn}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.106";import{getErrorMsg as Po}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.611";import{createAction as Cz,createSlice as Dd,createSelector as vf}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as bw,set as s1,appendErrors as X5,useForm as Tz,useFieldArray as cg,FormProvider as H5}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Xw,rootReducer as Hw}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.761";import{useDispatch as Io,useSelector as mt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as jz,wsSlice as Zw}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.744";import{getAcceptList as Pz,useImageSelection as Rz,UploadMediaModal as Lz,UploadTag as tb,selectUploadFile as Z5}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.647";import{cn as ct,DropdownMenu as lm,DropdownMenuTrigger as um,DropdownMenuContent as fm,DropdownMenuItem as By,Button as gn,Avatar as K5,AvatarImage as Y5,TooltipWrapper as Kw,Dialog as J5,DialogContent as Q5,Switch as Ez,Tooltip as rb,TooltipTrigger as nb,TooltipContent as ab,Textarea as $5,getTextareaClassName as e7,FormLabel as Zg,useFormField as Nz,FormField as t7,FormItem as r7,FormControl as Ly,Input as i1,FormMessage as n7,Form as Yw,ButtonLoader as hf,Popover as a7,PopoverTrigger as s7,PopoverContent as i7,Calendar as o1,Checkbox as o7}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.724";import{useLogout as Iz,authToken as c7,authSlice as l7}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.818";import{useAppsNavigate as Jw,getRoute as Gy,getEntryAppRoute as u7,AppsLink as Xy}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.688";import{EmojiPicker as f7,EmojiStyle as d7}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.611";var Ki=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ud(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sb,hg={exports:{}},p7=hg.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -39,7 +39,7 @@ import{api as Ma,usePostApiV1UploadsMutation as M5,useGetApiV1SearchQuery as O5,
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
- */Tt("remoteReady");const Z7=Tt("askLogin"),K7=Tt("reselectUser");Tt("requestLogout");const Y7=Tt("setConfirmLeavePage");Tt("requestChangePath");const Uz=Tt("wsSubscribe"),qz=Tt("wsUnSubscribe");Tt("hostStoreConnect"),Tt("remoteLogin"),Tt("remoteLogout"),Tt("wsOnMessage"),Tt("setRouterPath"),Tt("setDeviceType"),Tt("setDeviceWidth");const Wz=Tt("setUserError"),Fz=Tt("setUserIsError"),xw=Tt("setUserPending"),Aw=Tt("setUserSuccess"),Vz=Tt("setUserData"),Bz=Tt("updateAccountData"),J7=Tt("updateUser");Tt("addNotification"),Tt("markNotification"),Tt("setNotificationsError"),Tt("setNotificationsList"),Tt("setNotificationsPending"),Tt("setNotificationsTotalCount"),Tt("setNotificationsUnreadCount"),Tt("resetNotificationsState"),Tt("undoNotification"),Tt("setInstanceInfo"),Tt("setInstanceInfoPending"),Tt("setInstanceInfoError");const Q7=Tt("setPlatformSettings");Tt("setProfileSettings");const zw=Tt("setGroupData"),Sw=Tt("setGroupLoading");Cz("requestMicroFrontendFetch"),Cz("sendMicroFrontendFetchResponse");const $7={data:null,isPending:!1,isSuccess:!1},pa=Dd({name:"userNoHTML",initialState:$7,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}}),Gz="getApiV1UsersRelationships",e9=Ld.memoize(((e,t)=>Ma.util.selectCachedArgsForQuery(e,Gz).find((e=>e.targets.includes(t))))),Ll=({state:e,userId:t,dispatch:r,relationsProps:n})=>{const a=e9(e,t);return a?r(Ma.util.updateQueryData(Gz,a,(e=>{e[t]={...e[t],...n}}))):null};var db=function(e,t,r){if(e&&"reportValidity"in e){var n=bw(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Xz=function(e,t){var r=function(r){var n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?db(n.ref,r,e):n.refs&&n.refs.forEach((function(t){return db(t,r,e)}))};for(var n in t.fields)r(n)},t9=function(e,t){t.shouldUseNativeValidation&&Xz(e,t);var r={};for(var n in e){var a=bw(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(r9(t.names||Object.keys(e),n)){var o=Object.assign({},bw(r,n));s1(o,"root",i),s1(r,n,o)}else s1(r,n,i)}return r},r9=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},n9=function(e,t){for(var r={};e.length;){var n=e[0],a=n.code,i=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:a};if("unionErrors"in n&&n.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[n.code];r[o]=X5(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r},Cw=function(e,t,r){return void 0===r&&(r={}),function(n,a,i){try{return Promise.resolve(function(a,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then((function(e){return i.shouldUseNativeValidation&&Xz({},i),{errors:{},values:r.raw?n:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:t9(n9(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const $w=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:n="onChange",showRequiredErrors:a=!0})=>Tz({mode:r,reValidateMode:n,resolver:a?Cw(e):async(t,r,n)=>{const a=await Cw(e)(t,r,n);if(!a.errors||0===Object.keys(a.errors).length)return a;const i={};return Object.keys(a.errors).forEach((e=>{const r=a.errors[e],n=t[e],o="password"===e,s=null==n||""===n,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:a.values,errors:i}},defaultValues:t});var Vt,Tw;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},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}(Vt||(Vt={})),(Tw||(Tw={})).mergeShapes=(e,t)=>({...e,...t});const Be=Vt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ff=e=>{switch(typeof e){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return isNaN(e)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(e)?Be.array:null===e?Be.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Be.promise:typeof Map<"u"&&e instanceof Map?Be.map:typeof Set<"u"&&e instanceof Set?Be.set:typeof Date<"u"&&e instanceof Date?Be.date:Be.object;default:return Be.unknown}},Te=Vt.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"]),a9=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class di 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},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof di))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}di.create=e=>new di(e);const ih=(e,t)=>{let r;switch(e.code){case Te.invalid_type:r=e.received===Be.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Vt.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Vt.joinValues(e.keys,", ")}`;break;case Te.invalid_union:r="Invalid input";break;case Te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Vt.joinValues(e.options)}`;break;case Te.invalid_enum_value:r=`Invalid enum value. Expected ${Vt.joinValues(e.options)}, received '${e.received}'`;break;case Te.invalid_arguments:r="Invalid function arguments";break;case Te.invalid_return_type:r="Invalid function return type";break;case Te.invalid_date:r="Invalid date";break;case Te.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Vt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Te.too_small:r="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 Te.too_big:r="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 Te.custom:r="Invalid input";break;case Te.invalid_intersection_types:r="Intersection results could not be merged";break;case Te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Te.not_finite:r="Number must be finite";break;default:r=t.defaultError,Vt.assertNever(e)}return{message:r}};let Hz=ih;function s9(e){Hz=e}function Hy(){return Hz}const Zy=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...a,path:i,message:s}},i9=[];function De(e,t){const r=Hy(),n=Zy({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ih?void 0:ih].filter((e=>!!e))});e.common.issues.push(n)}class Qa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return ht;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Qa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status||"aborted"===a.status)return ht;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(typeof a.value<"u"||n.alwaysSet)&&(r[t.value]=a.value)}return{status:e.value,value:r}}}const ht=Object.freeze({status:"aborted"}),eh=e=>({status:"dirty",value:e}),hs=e=>({status:"valid",value:e}),jw=e=>"aborted"===e.status,Pw=e=>"dirty"===e.status,Sg=e=>"valid"===e.status,Cg=e=>typeof Promise<"u"&&e instanceof Promise;function Ky(e,t,r,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Zz(e,t,r,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var tt,gg,yg;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(tt||(tt={}));class jc{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 pb=(e,t)=>{if(Sg(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 di(e.common.issues);return this._error=t,this._error}}};function At(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??a.defaultError}:typeof a.data>"u"?{message:null!==(i=s??n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:a.defaultError}},description:a}}class zt{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 ff(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ff(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qa,ctx:{common:e.parent.common,data:e.data,parsedType:ff(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Cg(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ff(e)},a=this._parseSync({data:e,path:n.path,parent:n});return pb(n,a)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:ff(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Cg(n)?n:Promise.resolve(n));return pb(r,a)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),i=()=>n.addIssue({code:Te.custom,...r(t)});return typeof Promise<"u"&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Eo({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Tc.create(this,this._def)}nullable(){return _f.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lo.create(this,this._def)}promise(){return ch.create(this,this._def)}or(e){return Rg.create([this,e],this._def)}and(e){return Lg.create(this,e,this._def)}transform(e){return new Eo({...At(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Og({...At(this._def),innerType:this,defaultValue:t,typeName:ft.ZodDefault})}brand(){return new ek({typeName:ft.ZodBranded,type:this,...At(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Dg({...At(this._def),innerType:this,catchValue:t,typeName:ft.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Kg.create(this,e)}readonly(){return Ug.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const o9=/^c[^\s-]{8,}$/i,c9=/^[0-9a-z]+$/,l9=/^[0-9A-HJKMNP-TV-Z]{26}$/,u9=/^[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,f9=/^[a-z0-9_-]{21}$/i,d9=/^[-+]?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)?)??$/,p9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,h9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let h1;const g9=/^(?:(?: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])$/,y9=/^(([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})))$/,m9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kz="((\\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])))",_9=new RegExp(`^${Kz}$`);function Yz(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 v9(e){return new RegExp(`^${Yz(e)}$`)}function Jz(e){let t=`${Kz}T${Yz(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function w9(e,t){return!(("v4"!==t&&t||!g9.test(e))&&("v6"!==t&&t||!y9.test(e)))}class Ro extends zt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.string){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.string,received:t.parsedType}),ht}const t=new Qa;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const a=e.data.length>n.value,i=e.data.length<n.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)p9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"email",code:Te.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)h1||(h1=new RegExp(h9,"u")),h1.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"emoji",code:Te.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)u9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"uuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)f9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"nanoid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)o9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)c9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid2",code:Te.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)l9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ulid",code:Te.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),De(r,{validation:"url",code:Te.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"regex",code:Te.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?Jz(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?_9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?v9(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?d9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"duration",code:Te.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?w9(e.data,n.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ip",code:Te.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?m9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64",code:Te.invalid_string,message:n.message}),t.dirty()):Vt.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Te.invalid_string,...tt.errToObj(r)})}_addCheck(e){return new Ro({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tt.errToObj(e)})}datetime(e){var t,r;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!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tt.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,...tt.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tt.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tt.errToObj(t)})}nonempty(e){return this.min(1,tt.errToObj(e))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...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 k9(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}Ro.create=e=>{var t;return new Ro({checks:[],typeName:ft.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...At(e)})};class gf extends zt{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)!==Be.number){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.number,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"int"===n.kind?Vt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==k9(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_finite,message:n.message}),r.dirty()):Vt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tt.toString(t))}setLimit(e,t,r,n){return new gf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tt.toString(n)}]})}_addCheck(e){return new gf({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.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&&Vt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}gf.create=e=>new gf({checks:[],typeName:ft.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...At(e)});class yf extends zt{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)!==Be.bigint){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.bigint,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Vt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tt.toString(t))}setLimit(e,t,r,n){return new yf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tt.toString(n)}]})}_addCheck(e){return new yf({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tt.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}}yf.create=e=>{var t;return new yf({checks:[],typeName:ft.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...At(e)})};class Tg extends zt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Be.boolean){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.boolean,received:t.parsedType}),ht}return hs(e.data)}}Tg.create=e=>new Tg({typeName:ft.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...At(e)});class Id extends zt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.date){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.date,received:t.parsedType}),ht}if(isNaN(e.data.getTime())){return De(this._getOrReturnCtx(e),{code:Te.invalid_date}),ht}const t=new Qa;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Vt.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Id({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tt.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}}Id.create=e=>new Id({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ft.ZodDate,...At(e)});class Yy extends zt{_parse(e){if(this._getType(e)!==Be.symbol){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.symbol,received:t.parsedType}),ht}return hs(e.data)}}Yy.create=e=>new Yy({typeName:ft.ZodSymbol,...At(e)});class jg extends zt{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.undefined,received:t.parsedType}),ht}return hs(e.data)}}jg.create=e=>new jg({typeName:ft.ZodUndefined,...At(e)});class Pg extends zt{_parse(e){if(this._getType(e)!==Be.null){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.null,received:t.parsedType}),ht}return hs(e.data)}}Pg.create=e=>new Pg({typeName:ft.ZodNull,...At(e)});class oh extends zt{constructor(){super(...arguments),this._any=!0}_parse(e){return hs(e.data)}}oh.create=e=>new oh({typeName:ft.ZodAny,...At(e)});class Ed extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return hs(e.data)}}Ed.create=e=>new Ed({typeName:ft.ZodUnknown,...At(e)});class Il extends zt{_parse(e){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.never,received:t.parsedType}),ht}}Il.create=e=>new Il({typeName:ft.ZodNever,...At(e)});class Jy extends zt{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.void,received:t.parsedType}),ht}return hs(e.data)}}Jy.create=e=>new Jy({typeName:ft.ZodVoid,...At(e)});class Lo extends zt{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==Be.array)return De(t,{code:Te.invalid_type,expected:Be.array,received:t.parsedType}),ht;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(De(t,{code:e?Te.too_big:Te.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(De(t,{code:Te.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(De(t,{code:Te.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new jc(t,e,t.path,r))))).then((e=>Qa.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new jc(t,e,t.path,r))));return Qa.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new Lo({...this._def,minLength:{value:e,message:tt.toString(t)}})}max(e,t){return new Lo({...this._def,maxLength:{value:e,message:tt.toString(t)}})}length(e,t){return new Lo({...this._def,exactLength:{value:e,message:tt.toString(t)}})}nonempty(e){return this.min(1,e)}}function $p(e){if(e instanceof Gr){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Tc.create($p(n))}return new Gr({...e._def,shape:()=>t})}return e instanceof Lo?new Lo({...e._def,type:$p(e.element)}):e instanceof Tc?Tc.create($p(e.unwrap())):e instanceof _f?_f.create($p(e.unwrap())):e instanceof Pc?Pc.create(e.items.map((e=>$p(e)))):e}Lo.create=(e,t)=>new Lo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...At(t)});class Gr extends zt{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=Vt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Be.object){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.object,received:t.parsedType}),ht}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Il&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=n[e],a=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new jc(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Il){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(De(r,{code:Te.unrecognized_keys,keys:i}),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 i){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new jc(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Qa.mergeObjectSync(t,e))):Qa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return tt.errToObj,new Gr({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,i,o;const s=null!==(i=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=tt.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Gr({...this._def,unknownKeys:"strip"})}passthrough(){return new Gr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Gr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Gr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ft.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Gr({...this._def,catchall:e})}pick(e){const t={};return Vt.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Gr({...this._def,shape:()=>t})}omit(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Gr({...this._def,shape:()=>t})}deepPartial(){return $p(this)}partial(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Gr({...this._def,shape:()=>t})}required(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Tc;)e=e._def.innerType;t[r]=e}})),new Gr({...this._def,shape:()=>t})}keyof(){return Qz(Vt.objectKeys(this.shape))}}Gr.create=(e,t)=>new Gr({shape:()=>e,unknownKeys:"strip",catchall:Il.create(),typeName:ft.ZodObject,...At(t)}),Gr.strictCreate=(e,t)=>new Gr({shape:()=>e,unknownKeys:"strict",catchall:Il.create(),typeName:ft.ZodObject,...At(t)}),Gr.lazycreate=(e,t)=>new Gr({shape:e,unknownKeys:"strip",catchall:Il.create(),typeName:ft.ZodObject,...At(t)});class Rg extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new di(e.ctx.common.issues)));return De(t,{code:Te.invalid_union,unionErrors:r}),ht}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new di(e)));return De(t,{code:Te.invalid_union,unionErrors:a}),ht}}get options(){return this._def.options}}Rg.create=(e,t)=>new Rg({options:e,typeName:ft.ZodUnion,...At(t)});const El=e=>e instanceof Ng?El(e.schema):e instanceof Eo?El(e.innerType()):e instanceof Ig?[e.value]:e instanceof mf?e.options:e instanceof Mg?Vt.objectValues(e.enum):e instanceof Og?El(e._def.innerType):e instanceof jg?[void 0]:e instanceof Pg?[null]:e instanceof Tc?[void 0,...El(e.unwrap())]:e instanceof _f?[null,...El(e.unwrap())]:e instanceof ek||e instanceof Ug?El(e.unwrap()):e instanceof Dg?El(e._def.innerType):[];class dm extends zt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.object)return De(t,{code:Te.invalid_type,expected:Be.object,received:t.parsedType}),ht;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(De(t,{code:Te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=El(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new dm({typeName:ft.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...At(r)})}}function Rw(e,t){const r=ff(e),n=ff(t);if(e===t)return{valid:!0,data:e};if(r===Be.object&&n===Be.object){const r=Vt.objectKeys(t),n=Vt.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Rw(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===Be.array&&n===Be.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const a=Rw(e[n],t[n]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}return r===Be.date&&n===Be.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Lg extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(jw(e)||jw(n))return ht;const a=Rw(e.value,n.value);return a.valid?((Pw(e)||Pw(n))&&t.dirty(),{status:t.value,value:a.data}):(De(r,{code:Te.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Lg.create=(e,t,r)=>new Lg({left:e,right:t,typeName:ft.ZodIntersection,...At(r)});class Pc extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.array)return De(r,{code:Te.invalid_type,expected:Be.array,received:r.parsedType}),ht;if(r.data.length<this._def.items.length)return De(r,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&r.data.length>this._def.items.length&&(De(r,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new jc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Qa.mergeArray(t,e))):Qa.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Pc({...this._def,rest:e})}}Pc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pc({items:e,typeName:ft.ZodTuple,rest:null,...At(t)})};class Eg extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.object)return De(r,{code:Te.invalid_type,expected:Be.object,received:r.parsedType}),ht;const n=[],a=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new jc(r,e,r.path,e)),value:i._parse(new jc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Qa.mergeObjectAsync(t,n):Qa.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Eg(t instanceof zt?{keyType:e,valueType:t,typeName:ft.ZodRecord,...At(r)}:{keyType:Ro.create(),valueType:e,typeName:ft.ZodRecord,...At(t)})}}class Qy extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.map)return De(r,{code:Te.invalid_type,expected:Be.map,received:r.parsedType}),ht;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new jc(r,e,r.path,[i,"key"])),value:a._parse(new jc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}Qy.create=(e,t,r)=>new Qy({valueType:t,keyType:e,typeName:ft.ZodMap,...At(r)});class Md extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.set)return De(r,{code:Te.invalid_type,expected:Be.set,received:r.parsedType}),ht;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(De(r,{code:Te.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(De(r,{code:Te.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return ht;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>a._parse(new jc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new Md({...this._def,minSize:{value:e,message:tt.toString(t)}})}max(e,t){return new Md({...this._def,maxSize:{value:e,message:tt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Md.create=(e,t)=>new Md({valueType:e,minSize:null,maxSize:null,typeName:ft.ZodSet,...At(t)});class nh extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.function)return De(t,{code:Te.invalid_type,expected:Be.function,received:t.parsedType}),ht;function r(e,r){return Zy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hy(),ih].filter((e=>!!e)),issueData:{code:Te.invalid_arguments,argumentsError:r}})}function n(e,r){return Zy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hy(),ih].filter((e=>!!e)),issueData:{code:Te.invalid_return_type,returnTypeError:r}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ch){const e=this;return hs((async function(...t){const o=new di([]),s=await e._def.args.parseAsync(t,a).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return hs((function(...t){const o=e._def.args.safeParse(t,a);if(!o.success)throw new di([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,a);if(!c.success)throw new di([n(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new nh({...this._def,args:Pc.create(e).rest(Ed.create())})}returns(e){return new nh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new nh({args:e||Pc.create([]).rest(Ed.create()),returns:t||Ed.create(),typeName:ft.ZodFunction,...At(r)})}}class Ng extends zt{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})}}Ng.create=(e,t)=>new Ng({getter:e,typeName:ft.ZodLazy,...At(t)});class Ig extends zt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return De(t,{received:t.data,code:Te.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Qz(e,t){return new mf({values:e,typeName:ft.ZodEnum,...At(t)})}Ig.create=(e,t)=>new Ig({value:e,typeName:ft.ZodLiteral,...At(t)});class mf extends zt{constructor(){super(...arguments),gg.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{expected:Vt.joinValues(r),received:t.parsedType,code:Te.invalid_type}),ht}if(Ky(this,gg)||Zz(this,gg,new Set(this._def.values)),!Ky(this,gg).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{received:t.data,code:Te.invalid_enum_value,options:r}),ht}return hs(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 mf.create(e,{...this._def,...t})}exclude(e,t=this._def){return mf.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}gg=new WeakMap,mf.create=Qz;class Mg extends zt{constructor(){super(...arguments),yg.set(this,void 0)}_parse(e){const t=Vt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Be.string&&r.parsedType!==Be.number){const e=Vt.objectValues(t);return De(r,{expected:Vt.joinValues(e),received:r.parsedType,code:Te.invalid_type}),ht}if(Ky(this,yg)||Zz(this,yg,new Set(Vt.getValidEnumValues(this._def.values))),!Ky(this,yg).has(e.data)){const e=Vt.objectValues(t);return De(r,{received:r.data,code:Te.invalid_enum_value,options:e}),ht}return hs(e.data)}get enum(){return this._def.values}}yg=new WeakMap,Mg.create=(e,t)=>new Mg({values:e,typeName:ft.ZodNativeEnum,...At(t)});class ch extends zt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.promise&&!1===t.common.async)return De(t,{code:Te.invalid_type,expected:Be.promise,received:t.parsedType}),ht;const r=t.parsedType===Be.promise?t.data:Promise.resolve(t.data);return hs(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ch.create=(e,t)=>new ch({type:e,typeName:ft.ZodPromise,...At(t)});class Eo extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{De(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ht;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?eh(n.value):n}));{if("aborted"===t.value)return ht;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?eh(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(r.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===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?ht:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ht:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Sg(e))return e;const i=n.transform(e.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>Sg(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Vt.assertNever(n)}}Eo.create=(e,t,r)=>new Eo({schema:e,typeName:ft.ZodEffects,effect:t,...At(r)}),Eo.createWithPreprocess=(e,t,r)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:ft.ZodEffects,...At(r)});class Tc extends zt{_parse(e){return this._getType(e)===Be.undefined?hs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tc.create=(e,t)=>new Tc({innerType:e,typeName:ft.ZodOptional,...At(t)});class _f extends zt{_parse(e){return this._getType(e)===Be.null?hs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_f.create=(e,t)=>new _f({innerType:e,typeName:ft.ZodNullable,...At(t)});class Og extends zt{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Og.create=(e,t)=>new Og({innerType:e,typeName:ft.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...At(t)});class Dg extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cg(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new di(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new di(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Dg.create=(e,t)=>new Dg({innerType:e,typeName:ft.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...At(t)});class $y extends zt{_parse(e){if(this._getType(e)!==Be.nan){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.nan,received:t.parsedType}),ht}return{status:"valid",value:e.data}}}$y.create=e=>new $y({typeName:ft.ZodNaN,...At(e)});const b9=Symbol("zod_brand");class ek extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Kg extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),eh(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Kg({in:e,out:t,typeName:ft.ZodPipeline})}}class Ug extends zt{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Sg(e)&&(e.value=Object.freeze(e.value)),e);return Cg(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function $z(e,t={},r){return e?oh.create().superRefine(((n,a)=>{var i,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...c,fatal:s})}})):oh.create()}Ug.create=(e,t)=>new Ug({innerType:e,typeName:ft.ZodReadonly,...At(t)});const x9={object:Gr.lazycreate};var ft;!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"}(ft||(ft={}));const A9=(e,t={message:`Input not instance of ${e.name}`})=>$z((t=>t instanceof e),t),e8=Ro.create,t8=gf.create,z9=$y.create,S9=yf.create,r8=Tg.create,C9=Id.create,T9=Yy.create,j9=jg.create,P9=Pg.create,R9=oh.create,L9=Ed.create,E9=Il.create,N9=Jy.create,I9=Lo.create,M9=Gr.create,O9=Gr.strictCreate,D9=Rg.create,U9=dm.create,q9=Lg.create,W9=Pc.create,F9=Eg.create,V9=Qy.create,B9=Md.create,G9=nh.create,X9=Ng.create,H9=Ig.create,Z9=mf.create,K9=Mg.create,Y9=ch.create,hb=Eo.create,J9=Tc.create,Q9=_f.create,$9=Eo.createWithPreprocess,eS=Kg.create,tS=()=>e8().optional(),rS=()=>t8().optional(),nS=()=>r8().optional(),aS={string:e=>Ro.create({...e,coerce:!0}),number:e=>gf.create({...e,coerce:!0}),boolean:e=>Tg.create({...e,coerce:!0}),bigint:e=>yf.create({...e,coerce:!0}),date:e=>Id.create({...e,coerce:!0})},sS=ht;var Ve=Object.freeze({__proto__:null,defaultErrorMap:ih,setErrorMap:s9,getErrorMap:Hy,makeIssue:Zy,EMPTY_PATH:i9,addIssueToContext:De,ParseStatus:Qa,INVALID:ht,DIRTY:eh,OK:hs,isAborted:jw,isDirty:Pw,isValid:Sg,isAsync:Cg,get util(){return Vt},get objectUtil(){return Tw},ZodParsedType:Be,getParsedType:ff,ZodType:zt,datetimeRegex:Jz,ZodString:Ro,ZodNumber:gf,ZodBigInt:yf,ZodBoolean:Tg,ZodDate:Id,ZodSymbol:Yy,ZodUndefined:jg,ZodNull:Pg,ZodAny:oh,ZodUnknown:Ed,ZodNever:Il,ZodVoid:Jy,ZodArray:Lo,ZodObject:Gr,ZodUnion:Rg,ZodDiscriminatedUnion:dm,ZodIntersection:Lg,ZodTuple:Pc,ZodRecord:Eg,ZodMap:Qy,ZodSet:Md,ZodFunction:nh,ZodLazy:Ng,ZodLiteral:Ig,ZodEnum:mf,ZodNativeEnum:Mg,ZodPromise:ch,ZodEffects:Eo,ZodTransformer:Eo,ZodOptional:Tc,ZodNullable:_f,ZodDefault:Og,ZodCatch:Dg,ZodNaN:$y,BRAND:b9,ZodBranded:ek,ZodPipeline:Kg,ZodReadonly:Ug,custom:$z,Schema:zt,ZodSchema:zt,late:x9,get ZodFirstPartyTypeKind(){return ft},coerce:aS,any:R9,array:I9,bigint:S9,boolean:r8,date:C9,discriminatedUnion:U9,effect:hb,enum:Z9,function:G9,instanceof:A9,intersection:q9,lazy:X9,literal:H9,map:V9,nan:z9,nativeEnum:K9,never:E9,null:P9,nullable:Q9,number:t8,object:M9,oboolean:nS,onumber:rS,optional:J9,ostring:tS,pipeline:eS,preprocess:$9,promise:Y9,record:F9,set:B9,strictObject:O9,string:e8,symbol:T9,transformer:hb,tuple:W9,undefined:j9,union:D9,unknown:L9,void:N9,NEVER:sS,ZodIssueCode:Te,quotelessJson:a9,ZodError:di}),iS={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"66e59c980261a710",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.775",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3640",APP_NAME:"@wellesley/user"};const n8=e=>iS.DOMAIN_ENV===e,oS=n8("prod"),a8=oS?8:3,s8=64,gb=5,Lw=2,i8=30,tk=50,o8=1024,c8=30,Cc={link:56,userName:30,pronouns:80,displayName:50,description:o8,fieldLabel:20,fieldContent:80,location:56,timezone:56},df={short:"Too short",long:"Too long"},cS=(e,t=100)=>{let r;return function(...n){clearTimeout(r),r=setTimeout((()=>e.apply(this,n)),t)}},lS=(e,t)=>{const r=cS(((t,r,n)=>{e(...n).then(t).catch(r)}),t);return(...e)=>new Promise(((t,n)=>{r(t,n,e)}))},rk=new RegExp("\\p{Extended_Pictographic}","u"),l8=({showInlineError:e=!0})=>Ve.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,df.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),uS=lS((async e=>{try{const{exists:t}=await Xw().dispatch(Ma.endpoints.getApiV1UsersCheck.initiate({username:e})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),u8=Ve.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=rk.test(e),n=/[a-zA-Z0-9]/.test(e);r&&!n&&t.addIssue({code:Ve.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),fS=Ve.string().max(1024,df.long).optional(),f8=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:n})=>Ve.string().trim().min(e,t).max(r,df.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,n);f8({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),f8({minLength:2,minErrorMessage:df.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),Ve.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 dS=`Required: A-Z, a-z, 0-9, special character, min ${a8}, max 64`;Ve.string().trim().superRefine(((e,t)=>{rk.test(e)&&t.addIssue({code:Ve.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>=a8&&e.length<=64||t.addIssue({code:Ve.ZodIssueCode.custom,message:dS})})),Ve.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=>!rk.test(e)),"Emojis are not allowed");const pS=({form:e,originalUsername:t})=>{const r=wt(t??"").current,n=e=>e.getValues("userName"),[a,i]=yt(!1),[o,s]=yt(n(e));return{isUserNameChecked:a,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=n(e).trim();if(t===o||t===r)return;const{exists:a,message:c}=await uS(t);a&&e.setError("userName",{message:c}),s(t),i(!0)}}},hS=Ve.object({bio:fS,username:l8({showInlineError:!0}),displayName:u8}),gS=Ve.object({show:Ve.boolean(),dateOnly:Ve.boolean(),date:Ve.date().optional().nullable()}),yS=(e=!0)=>{const t=l8({showInlineError:e});return Ve.object({avatarId:Ve.string().nullable(),headerId:Ve.string().nullable(),channel:Ve.boolean().optional(),actorType:Ve.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:u8,Pronouns:Ve.string().max(Cc.pronouns,df.long).optional(),summary:Ve.string().max(Cc.description,df.long).optional(),customFields:Ve.array(Ve.object({label:Ve.string().max(Cc.fieldLabel,df.long).optional(),content:Ve.string().max(Cc.fieldContent,df.long).optional()})),location:Ve.object({geo:Ve.object({latitude:Ve.number().optional(),longitude:Ve.number().optional(),accuracy:Ve.number().optional().nullable()}).optional().nullable(),show:Ve.boolean().optional(),name:Ve.string().optional(),autoUpdate:Ve.boolean().optional()}),timezone:Ve.object({show:Ve.boolean(),ianaTimezone:Ve.string().optional(),autoUpdate:Ve.boolean()}),birthday:gS,canSubmit:Ve.boolean(),botProfile:Ve.object({role:Ve.string().optional(),triggers:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),personality_traits:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),tone:Ve.string().optional(),style:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),behaviors:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),prompt:Ve.string().optional()}).optional()})};Ve.object({show:Ve.boolean(),dateOnly:Ve.boolean(),date:Ve.date().optional().nullable()});const qg=e=>{var t;const r=e,n=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:n}},d8=Ma.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await Oe(r)&&await t(Ma.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){rn.error(`${Po(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(xw(!0));try{const e=await Oe(r);e&&t(Vz(e.data)),t(Aw(!0))}catch(e){t(Aw(!1)),t(Fz(!0)),t(Wz(e))}finally{t(xw(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,rn.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=qg(t);!r&&rn.error(`${Po(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(pa.actions.setPending(!0));const e=await Oe(r);n&&e&&(t(pa.actions.setUser(e.data)),t(pa.actions.setSuccess(!0)),t(pa.actions.setPending(!1)))}catch(e){n&&(t(pa.actions.setSuccess(!1)),t(pa.actions.setError(e)),t(pa.actions.setPending(!1))),rn.error(`${Po(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,rn.success("User created successfully")}catch(e){const t=e.error,{isError:r}=qg(t);!r&&rn.error(`${Po(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(pa.actions.setPending(!0));const e=await Oe(r);n&&e&&(t(pa.actions.setUser(e.data)),t(pa.actions.setSuccess(!0)),t(pa.actions.setPending(!1)))}catch(e){n&&(t(pa.actions.setSuccess(!1)),t(pa.actions.setError(e)),t(pa.actions.setPending(!1))),rn.error(`${Po(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"ACCEPTED"}});await Oe(t,`Accepted follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"REJECTED"}});await Oe(t,`Rejected follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await Oe(t,`Follow request sent to ${e.username}`)&&r(Ma.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{following:null}});await Oe(t,`You unfollowed ${e.username}`,(()=>null==a?void 0:a.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!0}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!0}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!1}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const{userId:a,text:i}=e.noteUpdate,o=Ll({userId:a,dispatch:n,state:r(),relationsProps:{note:i}});await Oe(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{note:""}});await Oe(t,"Note has been removed",(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(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:Mde,usePostApiV1UsersMutation:mS,useDeleteApiV1AccountsDeleteMutation:_S,useGetApiV1AccountsProfileQuery:Ode,usePutApiV1UsersByUserIdMutation:nk,useGetApiV1UsersQuery:vS,useDeleteApiV1UsersMutation:p8,usePostApiV1MuteByUserIdMutation:Dde,useDeleteApiV1MuteByUserIdMutation:Ude,useGetApiV1MuteQuery:qde,usePostApiV1AdminUserChangeStateMutation:Wde,useGetApiV1UsersRelationshipsQuery:wS,usePutApiV1NotesMutation:Fde,useDeleteApiV1NotesByUserIdMutation:Vde,useLazyGetApiV1UsersRelationshipsQuery:kS,useLazyGetApiV1GeoQuery:bS,useLazyGetApiV1GroupsOwnedQuery:xS,useGetApiV1UsersFollowersQuery:Bde,useGetApiV1UsersByUserIdQuery:AS,useLazyGetApiV1UsersRenameHistoryQuery:Gde,useGetApiV1UsersByUserIdFollowersQuery:Xde,usePostApiV1UsersFollowByUsernameMutation:Hde,usePostApiV1UsersFollowByUsernameUndoMutation:Zde,usePostApiV1UsersFollowByUsernameRejectMutation:Kde,usePostApiV1UsersFollowByUsernameAcceptMutation:Yde,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:Jde}=d8,h8=()=>{const[e]=nk();return({userId:t,htmlContent:r,data:n})=>{e({userId:t,userUpdate:n,...r&&{htmlContent:r}})}},yb={data:null,isError:!1,isPending:!1,isSuccess:!1},Ur=Dd({name:"user",initialState:yb,reducers:{reset:e=>{Object.assign(e,yb)}},extraReducers:e=>{e.addCase(Vz,((e,{payload:t})=>{e.data=t})).addCase(Bz,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(Aw,((e,{payload:t})=>{e.isSuccess=t})).addCase(xw,((e,{payload:t})=>{e.isPending=t})).addCase(Fz,((e,{payload:t})=>{e.isError=t})).addCase(Wz,((e,{payload:t})=>{e.error=t})).addCase(J7,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.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 r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),zS=e=>e.filter((e=>e.id&&e.username&&e.displayName)),Qde=()=>{const e=Io(),t=mt(Ur.selectors.selectAccount),r=jz("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),n=mt((e=>Zw.selectors.selectLastUpdateFor(e,r)));Ze((()=>{if(null!=t&&t.id)return e(Uz({id:r,topics:[r]})),()=>{e(qz(r))}}),[null==t?void 0:t.id]),Ze((()=>{null!=n&&n.data&&e(Bz({...n.data,users:zS(n.data.users)}))}),[null==n?void 0:n.data])},uh=()=>{const e=mt(Ur.selectors.selectSelectedUserId),t=Io();return{changeUser:Qt((r=>{e!==r&&t(K7({userId:r}))}),[e,t]),selectedUserId:e}},SS=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,CS=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const n=SS(e),{data:a,error:i,isLoading:o}=vS({username:n,full:!0,htmlContent:r},{skip:!n||!t});return{data:a,error:i,isLoading:o}},TS=e=>{const t=mt(pa.selectors.selectUser),{isLoading:r}=CS({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},Yg=()=>"object"!=typeof window,g8=()=>_8()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),y8=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},m8=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),jS=(e,t)=>{const r=Yg()?"":document.cookie,n=`; ${t||r}`.split(`; ${e}=`);if(2===n.length)return(n.pop()||"").replace("=","").split(";").shift()},PS=(e,t)=>{Yg()||(document.cookie=m8({[e]:"",path:"/",domain:t||g8(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},RS=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],_8=()=>RS.includes(location.hostname),LS=(e,t="",r=10,n)=>{Yg()||(document.cookie=m8({[e]:t,path:"/",domain:n||g8(),expires:y8(r),...!_8()&&{SameSite:"None",Secure:!0}}))},pm={set:LS,remove:PS,get:jS,getExpireDate:y8},ak="auth_token",v8=()=>pm.get(ak)||void 0,ES=e=>pm.set(ak,e),NS=()=>pm.remove(ak),IS=()=>!!v8(),MS={getToken:v8,setToken:ES,removeToken:NS,hasToken:IS},mb={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!MS.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},sk=Dd({name:"auth",initialState:mb,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...mb,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}}),$de=()=>{const e=mt(sk.selectors.selectIsAuthenticated),t=mt(Ur.selectors.selectPending);return{user:mt(Ur.selectors.selectCurrentUser),isLogged:e,isLoading:t}},OS=()=>{const e=mt(Ur.selectors.selectCurrentUser),t=mt(sk.selectors.selectIsAuthenticated);return{user:e,isLoading:mt(Ur.selectors.selectPending),isLogged:t,error:mt(Ur.selectors.selectError)}},epe=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:n,error:a,isLoading:i,isFetching:o}=AS({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:n,error:a,isLoading:i,isFetching:o}},DS=({onChange:e})=>{const{user:t}=OS(),r=null==t?void 0:t.id,n=wt(r);Ze((()=>{n.current?r!==n.current&&(e(),n.current=r):n.current=r}),[r,n.current])},_b=["following","followed","blocked","muted","note","blocked_by"],vb=({userId:e,currentUserId:t})=>{const r="string"==typeof e,n=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],a=e===t;return{isSingleUser:r,canFetch:!(!n.length||a||!t),safeTargets:n}},US=({userId:e,skip:t})=>{const r=mt(Ur.selectors.selectCurrentUser),n=null==r?void 0:r.id,{canFetch:a,isSingleUser:i,safeTargets:o}=vb({userId:e,currentUserId:n}),{data:s,isLoading:c}=wS({targets:o,filter:_b},{skip:!a||t}),[l]=kS(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=vb({userId:e,currentUserId:n});t&&l({targets:r,filter:_b})};return DS({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},hm=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,w8=({id:e,user:t})=>{const r=Io(),n=jz("user#$username",{username:t?hm(t).slice(1):""}),a=`${e}-${null==t?void 0:t.username}`;return Ze((()=>{if(null!=t&&t.username)return r(Uz({id:a,topics:[n]})),()=>{r(qz(a))}}),[null==t?void 0:t.username]),{subscriptionName:n}},tpe=({user:e,onUpdate:t})=>{const{updateRelations:r}=US({}),{subscriptionName:n}=w8({id:"outside-user-update",user:e}),a=mt((e=>Zw.selectors.selectLastUpdateFor(e,n)));Ze((()=>{const e=null==a?void 0:a.data;e&&(r({userId:e.id}),t(e))}),[null==a?void 0:a.data])},rpe=({onUpdate:e})=>{const t=mt(Ur.selectors.selectCurrentUser),{subscriptionName:r}=w8({id:"current-user-update",user:t}),n=mt((e=>Zw.selectors.selectLastUpdateFor(e,r)));Ze((()=>{const t=null==n?void 0:n.data;t&&e(t)}),[null==n?void 0:n.data])},k8=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},qS=e=>e.replace(/\.[^.]*$/,""),WS=()=>!Yg()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),bg="8.48.0",Ml=globalThis;function ik(e,t,r){const n=Ml,a=n.__SENTRY__=n.__SENTRY__||{},i=a[bg]=a[bg]||{};return i[e]||(i[e]=t())}const b8=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,FS="Sentry Logger ",wb=["debug","info","warn","error","log","assert","trace"],kb={};function VS(e){if(!("console"in Ml))return e();const t=Ml.console,r={},n=Object.keys(kb);n.forEach((e=>{const n=kb[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}function BS(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return b8?wb.forEach((r=>{t[r]=(...t)=>{e&&VS((()=>{Ml.console[r](`${FS}[${r}]:`,...t)}))}})):wb.forEach((e=>{t[e]=()=>{}})),t}const Uy=ik("logger",BS);function ok(){return ck(Ml),Ml}function ck(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||bg,t[bg]=t[bg]||{}}const GS=Object.prototype.toString;function XS(e,t){return GS.call(e)===`[object ${t}]`}function HS(e){return XS(e,"Object")}function ZS(e){return!(!e||!e.then||"function"!=typeof e.then)}function KS(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{b8&&Uy.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const x8=1e3;function A8(){return Date.now()/x8}function YS(){const{performance:e}=Ml;if(!e||!e.now)return A8;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/x8}const JS=YS();function ah(){const e=Ml,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function QS(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||JS(),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:ah()),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 bb(){return ah()}function xb(){return ah().substring(16)}function z8(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const n={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=z8(n[e],t[e],r-1));return n}(()=>{const{performance:e}=Ml;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),a=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=a<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-n):t;(i||s<t)&&(a<=s&&e.timeOrigin)})();const Ew="_sentrySpan";function Ab(e,t){t?KS(e,Ew,t):delete e[Ew]}function zb(e){return e[Ew]}const $S=100;class lk{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:bb(),spanId:xb()}}clone(){const e=new lk;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,Ab(e,zb(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&&QS(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,[r,n]=t instanceof Wg?[t.getScopeData(),t.getRequestSession()]:HS(t)?[e,e.requestSession]:[],{tags:a,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...a},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),n&&(this._requestSession=n),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,Ab(this,void 0),this._attachments=[],this.setPropagationContext({traceId:bb()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:$S;if(r<=0)return this;const n={timestamp:A8(),...e},a=this._breadcrumbs;return a.push(n),this._breadcrumbs=a.length>r?a.slice(-r):a,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:zb(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=z8(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:xb(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:ah();if(!this._client)return Uy.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:ah();if(!this._client)return Uy.warn("No client configured on scope - will not capture message!"),n;const a=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:a,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ah();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(Uy.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const Wg=lk;function eC(){return ik("defaultCurrentScope",(()=>new Wg))}function tC(){return ik("defaultIsolationScope",(()=>new Wg))}class rC{constructor(e,t){let r,n;r=e||new Wg,n=t||new Wg,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return ZS(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}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 lh(){const e=ck(ok());return e.stack=e.stack||new rC(eC(),tC())}function nC(e){return lh().withScope(e)}function aC(e,t){const r=lh();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function Sb(e){return lh().withScope((()=>e(lh().getIsolationScope())))}function sC(){return{withIsolationScope:Sb,withScope:nC,withSetScope:aC,withSetIsolationScope:(e,t)=>Sb(t),getCurrentScope:()=>lh().getScope(),getIsolationScope:()=>lh().getIsolationScope()}}function S8(e){const t=ck(e);return t.acs?t.acs:sC()}function C8(){return S8(ok()).getCurrentScope()}function iC(){return S8(ok()).getIsolationScope()}function oC(e,t){return C8().captureException(e,void 0)}function cC(e,t){const r={captureContext:t};return C8().captureMessage(e,void 0,r)}function lC(e,t){iC().setExtra(e,t)}const uC=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return lC("exceptionMessage",t),void oC(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}cC(t)},fC="wlsy",T8=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},dC=()=>{const e=new Set,t=T8();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const n=null==t?void 0:t.key(r);"string"==typeof n&&e.add(n)}return Array.from(e)},j8=e=>{const t=`${fC}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,n=()=>dC().filter((e=>e.startsWith(`${t}:`))),a=e=>e.slice(t.length+1),i=T8(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{n().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>n().map(a),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},Cb=["debug","info","warn","error"],pC=(e,t)=>{const r=Cb.indexOf(e);return Cb.indexOf(t)>=r},Ey=(e,t,r,...n)=>{pC(t,e)&&console.log(`[${e}] ${r}`,...n)},hC=()=>j8().getItem("logger_lvl"),gC=(e=(Yg()?"info":hC()||"warn"))=>{let t=e;return{debug:(e,...r)=>Ey("debug",t,e,...r),info:(e,...r)=>Ey("info",t,e,...r),warn:(e,...r)=>Ey("warn",t,e,...r),error:(e,...r)=>(uC(e,...r),Ey("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},pi=gC(),yC=({src:e,name:t=""})=>new Promise(((r,n)=>{const a=document.createElement("video");a.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=a,c=qS(t);(!e||!i||!o||!s)&&n(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{pi.warn("Failed to load video"),r(null)};return WS()&&a.load(),a.addEventListener("error",o),a.addEventListener("loadeddata",i),()=>{a.removeEventListener("error",o),a.removeEventListener("loadeddata",i)}})),mC=e=>new Promise(((t,r)=>{const n=new Image,a=URL.createObjectURL(e);n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(a)},n.onerror=()=>{pi.warn("Failed to load image"),r(null),URL.revokeObjectURL(a)},n.src=a})),Tb=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},_C={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},qy={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},Nl=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],vC={data:null,isPending:!1},{posts:g1,uploadsPolicyDoc:jb,uploadsPolicyAudio:y1,uploadsPolicyImage:Ny,uploadsPolicyVideo:ug,registration:wC,captcha:kC,instanceAdmin:bC,branding:xC,translation:AC,access:zC}=qy,{captcha:SC,language:CC,translation:TC,openai:jC,link_service:PC}=_C,fh=e=>e.data,RC=vf(fh,(e=>{var t,r,n;return{max_characters:(null==(t=null==e?void 0:e[g1])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[g1])?void 0:r.max_media_attachments)||0,max_pins:(null==(n=null==e?void 0:e[g1])?void 0:n.max_pins)||0}})),uk=vf(fh,(e=>{var t,r,n;return{...null==e?void 0:e[Ny],maxSize:(null==(t=null==e?void 0:e[Ny])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Ny])?void 0:r.maxMatrix)||0,maxResolution:(null==(n=null==e?void 0:e[Ny])?void 0:n.maxResolution)||0}})),LC=vf(uk,(e=>Nl(e.extensions))),P8=vf(fh,(e=>{var t,r,n,a;return{...null==e?void 0:e[ug],maxSize:(null==(t=null==e?void 0:e[ug])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[ug])?void 0:r.maxMatrix)||0,maxDuration:(null==(n=null==e?void 0:e[ug])?void 0:n.maxDuration)||0,maxResolution:(null==(a=null==e?void 0:e[ug])?void 0:a.maxResolution)||0}})),R8=vf(fh,(e=>{var t,r;return{...null==e?void 0:e[y1],maxSize:null==(t=null==e?void 0:e[y1])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[y1])?void 0:r.keepOriginal)||0}})),L8=vf(fh,(e=>{var t;return{...null==e?void 0:e[jb],maxSize:(null==(t=null==e?void 0:e[jb])?void 0:t.maxSize)||0}})),E8=vf([uk,P8,R8,L8],((e,t,r,n)=>({IMAGE:Nl(null==e?void 0:e.extensions),VIDEO:Nl(null==t?void 0:t.extensions),AUDIO:Nl(null==r?void 0:r.extensions),DOCUMENT:Nl(null==n?void 0:n.extensions)}))),EC=vf(E8,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),mg=Dd({name:"platformSettings",initialState:vC,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(Q7,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:fh,selectPostConfig:RC,selectDocPolicy:L8,selectImagePolicy:uk,selectVideoPolicy:P8,selectAudioPolicy:R8,selectImageExtensions:LC,selectSupportedExtensions:E8,selectFullExtensionsList:EC,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[wC]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[CC]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[TC]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[jC]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[kC]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[SC]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[AC]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[zC]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[xC]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[PC]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[bC]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[qy.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[qy.domainBlocks]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[qy.contacts]}}}),NC=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:n,audioPolicy:a})=>{if(!r||!n)return"Media policy is not defined";const i={IMAGE:Nl(r.extensions),VIDEO:Nl(n.extensions),AUDIO:Nl(a.extensions),DOCUMENT:Nl(t.extensions)},o=k8(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await mC(e.file),n=e.file.size>r.maxSize,a=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case n:return`Image is too big. Max size is ${Tb(r.maxSize)}`;case a:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await yC({src:e.objectUrl}),r=t&&t.duration>n.maxDuration,a=t&&Math.max(t.width,t.height)>n.maxResolution,i=e.file.size>n.maxSize,o=t&&t.width*t.height>n.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${n.maxDuration} seconds`;case i:return`Video is too big. Max size is ${Tb(n.maxSize)}`;case a:return`Video resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${n.maxMatrix} pixels`}}},IC=()=>{const[e]=M5(),t=new AbortController,r=t.signal,n=mt(mg.selectors.selectImagePolicy),a=mt(mg.selectors.selectVideoPolicy),i=mt(mg.selectors.selectDocPolicy),o=mt(mg.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=k8(t.file.name),p=await NC({imgPolicy:n,docPolicy:i,videoPolicy:a,audioPolicy:o,media:t});if(p)return rn.error(p),void(null==c||c());try{const n=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in n)throw new Error(n.error);const a=null==(d=n.data)?void 0:d.uri;return await new Promise(((e,n)=>{const i=new XMLHttpRequest;i.open("PUT",a),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){pi.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>n(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():n(new Error(i.statusText))},i.send(t.file)})),null==l||l(),n.data.upload.uploadId}catch(e){null==c||c(e),rn.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Hi=(e=>(e.header="header",e.avatar="avatar",e))(Hi||{});const Fg=({user:e,type:t})=>{var r,n,a,i;if(!e)return"";try{return("avatar"===t?null==(n=null==(r=e.avatar)?void 0:r.files[0])?void 0:n.uri:null==(i=null==(a=e.header)?void 0:a.files[0])?void 0:i.uri)||""}catch{return""}};var Pb,_g={exports:{}},MC=_g.exports;
42
+ */Tt("remoteReady");const Z7=Tt("askLogin"),K7=Tt("reselectUser");Tt("requestLogout");const Y7=Tt("setConfirmLeavePage");Tt("requestChangePath");const Uz=Tt("wsSubscribe"),qz=Tt("wsUnSubscribe");Tt("hostStoreConnect"),Tt("remoteLogin"),Tt("remoteLogout"),Tt("wsOnMessage"),Tt("setRouterPath"),Tt("setDeviceType"),Tt("setDeviceWidth");const Wz=Tt("setUserError"),Fz=Tt("setUserIsError"),xw=Tt("setUserPending"),Aw=Tt("setUserSuccess"),Vz=Tt("setUserData"),Bz=Tt("updateAccountData"),J7=Tt("updateUser");Tt("addNotification"),Tt("markNotification"),Tt("setNotificationsError"),Tt("setNotificationsList"),Tt("setNotificationsPending"),Tt("setNotificationsTotalCount"),Tt("setNotificationsUnreadCount"),Tt("resetNotificationsState"),Tt("undoNotification"),Tt("setInstanceInfo"),Tt("setInstanceInfoPending"),Tt("setInstanceInfoError");const Q7=Tt("setPlatformSettings");Tt("setProfileSettings");const zw=Tt("setGroupData"),Sw=Tt("setGroupLoading");Cz("requestMicroFrontendFetch"),Cz("sendMicroFrontendFetchResponse");const $7={data:null,isPending:!1,isSuccess:!1},pa=Dd({name:"userNoHTML",initialState:$7,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}}),Gz="getApiV1UsersRelationships",e9=Ld.memoize(((e,t)=>Ma.util.selectCachedArgsForQuery(e,Gz).find((e=>e.targets.includes(t))))),Ll=({state:e,userId:t,dispatch:r,relationsProps:n})=>{const a=e9(e,t);return a?r(Ma.util.updateQueryData(Gz,a,(e=>{e[t]={...e[t],...n}}))):null};var db=function(e,t,r){if(e&&"reportValidity"in e){var n=bw(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Xz=function(e,t){var r=function(r){var n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?db(n.ref,r,e):n.refs&&n.refs.forEach((function(t){return db(t,r,e)}))};for(var n in t.fields)r(n)},t9=function(e,t){t.shouldUseNativeValidation&&Xz(e,t);var r={};for(var n in e){var a=bw(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(r9(t.names||Object.keys(e),n)){var o=Object.assign({},bw(r,n));s1(o,"root",i),s1(r,n,o)}else s1(r,n,i)}return r},r9=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},n9=function(e,t){for(var r={};e.length;){var n=e[0],a=n.code,i=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:a};if("unionErrors"in n&&n.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[n.code];r[o]=X5(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r},Cw=function(e,t,r){return void 0===r&&(r={}),function(n,a,i){try{return Promise.resolve(function(a,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then((function(e){return i.shouldUseNativeValidation&&Xz({},i),{errors:{},values:r.raw?n:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:t9(n9(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const $w=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:n="onChange",showRequiredErrors:a=!0})=>Tz({mode:r,reValidateMode:n,resolver:a?Cw(e):async(t,r,n)=>{const a=await Cw(e)(t,r,n);if(!a.errors||0===Object.keys(a.errors).length)return a;const i={};return Object.keys(a.errors).forEach((e=>{const r=a.errors[e],n=t[e],o="password"===e,s=null==n||""===n,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:a.values,errors:i}},defaultValues:t});var Vt,Tw;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},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}(Vt||(Vt={})),(Tw||(Tw={})).mergeShapes=(e,t)=>({...e,...t});const Be=Vt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ff=e=>{switch(typeof e){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return isNaN(e)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(e)?Be.array:null===e?Be.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Be.promise:typeof Map<"u"&&e instanceof Map?Be.map:typeof Set<"u"&&e instanceof Set?Be.set:typeof Date<"u"&&e instanceof Date?Be.date:Be.object;default:return Be.unknown}},Te=Vt.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"]),a9=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class di 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},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof di))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}di.create=e=>new di(e);const ih=(e,t)=>{let r;switch(e.code){case Te.invalid_type:r=e.received===Be.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Vt.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Vt.joinValues(e.keys,", ")}`;break;case Te.invalid_union:r="Invalid input";break;case Te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Vt.joinValues(e.options)}`;break;case Te.invalid_enum_value:r=`Invalid enum value. Expected ${Vt.joinValues(e.options)}, received '${e.received}'`;break;case Te.invalid_arguments:r="Invalid function arguments";break;case Te.invalid_return_type:r="Invalid function return type";break;case Te.invalid_date:r="Invalid date";break;case Te.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Vt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Te.too_small:r="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 Te.too_big:r="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 Te.custom:r="Invalid input";break;case Te.invalid_intersection_types:r="Intersection results could not be merged";break;case Te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Te.not_finite:r="Number must be finite";break;default:r=t.defaultError,Vt.assertNever(e)}return{message:r}};let Hz=ih;function s9(e){Hz=e}function Hy(){return Hz}const Zy=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...a,path:i,message:s}},i9=[];function De(e,t){const r=Hy(),n=Zy({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ih?void 0:ih].filter((e=>!!e))});e.common.issues.push(n)}class Qa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return ht;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Qa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status||"aborted"===a.status)return ht;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(typeof a.value<"u"||n.alwaysSet)&&(r[t.value]=a.value)}return{status:e.value,value:r}}}const ht=Object.freeze({status:"aborted"}),eh=e=>({status:"dirty",value:e}),hs=e=>({status:"valid",value:e}),jw=e=>"aborted"===e.status,Pw=e=>"dirty"===e.status,Sg=e=>"valid"===e.status,Cg=e=>typeof Promise<"u"&&e instanceof Promise;function Ky(e,t,r,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Zz(e,t,r,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var tt,gg,yg;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(tt||(tt={}));class jc{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 pb=(e,t)=>{if(Sg(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 di(e.common.issues);return this._error=t,this._error}}};function At(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??a.defaultError}:typeof a.data>"u"?{message:null!==(i=s??n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:a.defaultError}},description:a}}class zt{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 ff(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ff(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qa,ctx:{common:e.parent.common,data:e.data,parsedType:ff(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Cg(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ff(e)},a=this._parseSync({data:e,path:n.path,parent:n});return pb(n,a)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:ff(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Cg(n)?n:Promise.resolve(n));return pb(r,a)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),i=()=>n.addIssue({code:Te.custom,...r(t)});return typeof Promise<"u"&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Eo({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Tc.create(this,this._def)}nullable(){return _f.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lo.create(this,this._def)}promise(){return ch.create(this,this._def)}or(e){return Rg.create([this,e],this._def)}and(e){return Lg.create(this,e,this._def)}transform(e){return new Eo({...At(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Og({...At(this._def),innerType:this,defaultValue:t,typeName:ft.ZodDefault})}brand(){return new ek({typeName:ft.ZodBranded,type:this,...At(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Dg({...At(this._def),innerType:this,catchValue:t,typeName:ft.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Kg.create(this,e)}readonly(){return Ug.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const o9=/^c[^\s-]{8,}$/i,c9=/^[0-9a-z]+$/,l9=/^[0-9A-HJKMNP-TV-Z]{26}$/,u9=/^[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,f9=/^[a-z0-9_-]{21}$/i,d9=/^[-+]?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)?)??$/,p9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,h9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let h1;const g9=/^(?:(?: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])$/,y9=/^(([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})))$/,m9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kz="((\\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])))",_9=new RegExp(`^${Kz}$`);function Yz(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 v9(e){return new RegExp(`^${Yz(e)}$`)}function Jz(e){let t=`${Kz}T${Yz(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function w9(e,t){return!(("v4"!==t&&t||!g9.test(e))&&("v6"!==t&&t||!y9.test(e)))}class Ro extends zt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.string){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.string,received:t.parsedType}),ht}const t=new Qa;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const a=e.data.length>n.value,i=e.data.length<n.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)p9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"email",code:Te.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)h1||(h1=new RegExp(h9,"u")),h1.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"emoji",code:Te.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)u9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"uuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)f9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"nanoid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)o9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)c9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid2",code:Te.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)l9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ulid",code:Te.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),De(r,{validation:"url",code:Te.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"regex",code:Te.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?Jz(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?_9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?v9(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?d9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"duration",code:Te.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?w9(e.data,n.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ip",code:Te.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?m9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64",code:Te.invalid_string,message:n.message}),t.dirty()):Vt.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Te.invalid_string,...tt.errToObj(r)})}_addCheck(e){return new Ro({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tt.errToObj(e)})}datetime(e){var t,r;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!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tt.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,...tt.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tt.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tt.errToObj(t)})}nonempty(e){return this.min(1,tt.errToObj(e))}trim(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ro({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ro({...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 k9(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}Ro.create=e=>{var t;return new Ro({checks:[],typeName:ft.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...At(e)})};class gf extends zt{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)!==Be.number){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.number,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"int"===n.kind?Vt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==k9(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_finite,message:n.message}),r.dirty()):Vt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tt.toString(t))}setLimit(e,t,r,n){return new gf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tt.toString(n)}]})}_addCheck(e){return new gf({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.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&&Vt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}gf.create=e=>new gf({checks:[],typeName:ft.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...At(e)});class yf extends zt{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)!==Be.bigint){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.bigint,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Vt.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tt.toString(t))}setLimit(e,t,r,n){return new yf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tt.toString(n)}]})}_addCheck(e){return new yf({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tt.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}}yf.create=e=>{var t;return new yf({checks:[],typeName:ft.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...At(e)})};class Tg extends zt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Be.boolean){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.boolean,received:t.parsedType}),ht}return hs(e.data)}}Tg.create=e=>new Tg({typeName:ft.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...At(e)});class Id extends zt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.date){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.date,received:t.parsedType}),ht}if(isNaN(e.data.getTime())){return De(this._getOrReturnCtx(e),{code:Te.invalid_date}),ht}const t=new Qa;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Vt.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Id({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tt.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}}Id.create=e=>new Id({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ft.ZodDate,...At(e)});class Yy extends zt{_parse(e){if(this._getType(e)!==Be.symbol){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.symbol,received:t.parsedType}),ht}return hs(e.data)}}Yy.create=e=>new Yy({typeName:ft.ZodSymbol,...At(e)});class jg extends zt{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.undefined,received:t.parsedType}),ht}return hs(e.data)}}jg.create=e=>new jg({typeName:ft.ZodUndefined,...At(e)});class Pg extends zt{_parse(e){if(this._getType(e)!==Be.null){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.null,received:t.parsedType}),ht}return hs(e.data)}}Pg.create=e=>new Pg({typeName:ft.ZodNull,...At(e)});class oh extends zt{constructor(){super(...arguments),this._any=!0}_parse(e){return hs(e.data)}}oh.create=e=>new oh({typeName:ft.ZodAny,...At(e)});class Ed extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return hs(e.data)}}Ed.create=e=>new Ed({typeName:ft.ZodUnknown,...At(e)});class Il extends zt{_parse(e){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.never,received:t.parsedType}),ht}}Il.create=e=>new Il({typeName:ft.ZodNever,...At(e)});class Jy extends zt{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.void,received:t.parsedType}),ht}return hs(e.data)}}Jy.create=e=>new Jy({typeName:ft.ZodVoid,...At(e)});class Lo extends zt{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==Be.array)return De(t,{code:Te.invalid_type,expected:Be.array,received:t.parsedType}),ht;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(De(t,{code:e?Te.too_big:Te.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(De(t,{code:Te.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(De(t,{code:Te.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new jc(t,e,t.path,r))))).then((e=>Qa.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new jc(t,e,t.path,r))));return Qa.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new Lo({...this._def,minLength:{value:e,message:tt.toString(t)}})}max(e,t){return new Lo({...this._def,maxLength:{value:e,message:tt.toString(t)}})}length(e,t){return new Lo({...this._def,exactLength:{value:e,message:tt.toString(t)}})}nonempty(e){return this.min(1,e)}}function $p(e){if(e instanceof Gr){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Tc.create($p(n))}return new Gr({...e._def,shape:()=>t})}return e instanceof Lo?new Lo({...e._def,type:$p(e.element)}):e instanceof Tc?Tc.create($p(e.unwrap())):e instanceof _f?_f.create($p(e.unwrap())):e instanceof Pc?Pc.create(e.items.map((e=>$p(e)))):e}Lo.create=(e,t)=>new Lo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...At(t)});class Gr extends zt{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=Vt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Be.object){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.object,received:t.parsedType}),ht}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Il&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=n[e],a=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new jc(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Il){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(De(r,{code:Te.unrecognized_keys,keys:i}),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 i){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new jc(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Qa.mergeObjectSync(t,e))):Qa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return tt.errToObj,new Gr({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,i,o;const s=null!==(i=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=tt.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Gr({...this._def,unknownKeys:"strip"})}passthrough(){return new Gr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Gr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Gr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ft.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Gr({...this._def,catchall:e})}pick(e){const t={};return Vt.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Gr({...this._def,shape:()=>t})}omit(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Gr({...this._def,shape:()=>t})}deepPartial(){return $p(this)}partial(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Gr({...this._def,shape:()=>t})}required(e){const t={};return Vt.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Tc;)e=e._def.innerType;t[r]=e}})),new Gr({...this._def,shape:()=>t})}keyof(){return Qz(Vt.objectKeys(this.shape))}}Gr.create=(e,t)=>new Gr({shape:()=>e,unknownKeys:"strip",catchall:Il.create(),typeName:ft.ZodObject,...At(t)}),Gr.strictCreate=(e,t)=>new Gr({shape:()=>e,unknownKeys:"strict",catchall:Il.create(),typeName:ft.ZodObject,...At(t)}),Gr.lazycreate=(e,t)=>new Gr({shape:e,unknownKeys:"strip",catchall:Il.create(),typeName:ft.ZodObject,...At(t)});class Rg extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new di(e.ctx.common.issues)));return De(t,{code:Te.invalid_union,unionErrors:r}),ht}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new di(e)));return De(t,{code:Te.invalid_union,unionErrors:a}),ht}}get options(){return this._def.options}}Rg.create=(e,t)=>new Rg({options:e,typeName:ft.ZodUnion,...At(t)});const El=e=>e instanceof Ng?El(e.schema):e instanceof Eo?El(e.innerType()):e instanceof Ig?[e.value]:e instanceof mf?e.options:e instanceof Mg?Vt.objectValues(e.enum):e instanceof Og?El(e._def.innerType):e instanceof jg?[void 0]:e instanceof Pg?[null]:e instanceof Tc?[void 0,...El(e.unwrap())]:e instanceof _f?[null,...El(e.unwrap())]:e instanceof ek||e instanceof Ug?El(e.unwrap()):e instanceof Dg?El(e._def.innerType):[];class dm extends zt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.object)return De(t,{code:Te.invalid_type,expected:Be.object,received:t.parsedType}),ht;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(De(t,{code:Te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=El(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new dm({typeName:ft.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...At(r)})}}function Rw(e,t){const r=ff(e),n=ff(t);if(e===t)return{valid:!0,data:e};if(r===Be.object&&n===Be.object){const r=Vt.objectKeys(t),n=Vt.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Rw(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===Be.array&&n===Be.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const a=Rw(e[n],t[n]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}return r===Be.date&&n===Be.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Lg extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(jw(e)||jw(n))return ht;const a=Rw(e.value,n.value);return a.valid?((Pw(e)||Pw(n))&&t.dirty(),{status:t.value,value:a.data}):(De(r,{code:Te.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Lg.create=(e,t,r)=>new Lg({left:e,right:t,typeName:ft.ZodIntersection,...At(r)});class Pc extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.array)return De(r,{code:Te.invalid_type,expected:Be.array,received:r.parsedType}),ht;if(r.data.length<this._def.items.length)return De(r,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&r.data.length>this._def.items.length&&(De(r,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new jc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Qa.mergeArray(t,e))):Qa.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Pc({...this._def,rest:e})}}Pc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pc({items:e,typeName:ft.ZodTuple,rest:null,...At(t)})};class Eg extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.object)return De(r,{code:Te.invalid_type,expected:Be.object,received:r.parsedType}),ht;const n=[],a=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new jc(r,e,r.path,e)),value:i._parse(new jc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Qa.mergeObjectAsync(t,n):Qa.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Eg(t instanceof zt?{keyType:e,valueType:t,typeName:ft.ZodRecord,...At(r)}:{keyType:Ro.create(),valueType:e,typeName:ft.ZodRecord,...At(t)})}}class Qy extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.map)return De(r,{code:Te.invalid_type,expected:Be.map,received:r.parsedType}),ht;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new jc(r,e,r.path,[i,"key"])),value:a._parse(new jc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}Qy.create=(e,t,r)=>new Qy({valueType:t,keyType:e,typeName:ft.ZodMap,...At(r)});class Md extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Be.set)return De(r,{code:Te.invalid_type,expected:Be.set,received:r.parsedType}),ht;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(De(r,{code:Te.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(De(r,{code:Te.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return ht;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>a._parse(new jc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new Md({...this._def,minSize:{value:e,message:tt.toString(t)}})}max(e,t){return new Md({...this._def,maxSize:{value:e,message:tt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Md.create=(e,t)=>new Md({valueType:e,minSize:null,maxSize:null,typeName:ft.ZodSet,...At(t)});class nh extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.function)return De(t,{code:Te.invalid_type,expected:Be.function,received:t.parsedType}),ht;function r(e,r){return Zy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hy(),ih].filter((e=>!!e)),issueData:{code:Te.invalid_arguments,argumentsError:r}})}function n(e,r){return Zy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Hy(),ih].filter((e=>!!e)),issueData:{code:Te.invalid_return_type,returnTypeError:r}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof ch){const e=this;return hs((async function(...t){const o=new di([]),s=await e._def.args.parseAsync(t,a).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return hs((function(...t){const o=e._def.args.safeParse(t,a);if(!o.success)throw new di([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,a);if(!c.success)throw new di([n(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new nh({...this._def,args:Pc.create(e).rest(Ed.create())})}returns(e){return new nh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new nh({args:e||Pc.create([]).rest(Ed.create()),returns:t||Ed.create(),typeName:ft.ZodFunction,...At(r)})}}class Ng extends zt{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})}}Ng.create=(e,t)=>new Ng({getter:e,typeName:ft.ZodLazy,...At(t)});class Ig extends zt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return De(t,{received:t.data,code:Te.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Qz(e,t){return new mf({values:e,typeName:ft.ZodEnum,...At(t)})}Ig.create=(e,t)=>new Ig({value:e,typeName:ft.ZodLiteral,...At(t)});class mf extends zt{constructor(){super(...arguments),gg.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{expected:Vt.joinValues(r),received:t.parsedType,code:Te.invalid_type}),ht}if(Ky(this,gg)||Zz(this,gg,new Set(this._def.values)),!Ky(this,gg).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{received:t.data,code:Te.invalid_enum_value,options:r}),ht}return hs(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 mf.create(e,{...this._def,...t})}exclude(e,t=this._def){return mf.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}gg=new WeakMap,mf.create=Qz;class Mg extends zt{constructor(){super(...arguments),yg.set(this,void 0)}_parse(e){const t=Vt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Be.string&&r.parsedType!==Be.number){const e=Vt.objectValues(t);return De(r,{expected:Vt.joinValues(e),received:r.parsedType,code:Te.invalid_type}),ht}if(Ky(this,yg)||Zz(this,yg,new Set(Vt.getValidEnumValues(this._def.values))),!Ky(this,yg).has(e.data)){const e=Vt.objectValues(t);return De(r,{received:r.data,code:Te.invalid_enum_value,options:e}),ht}return hs(e.data)}get enum(){return this._def.values}}yg=new WeakMap,Mg.create=(e,t)=>new Mg({values:e,typeName:ft.ZodNativeEnum,...At(t)});class ch extends zt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.promise&&!1===t.common.async)return De(t,{code:Te.invalid_type,expected:Be.promise,received:t.parsedType}),ht;const r=t.parsedType===Be.promise?t.data:Promise.resolve(t.data);return hs(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ch.create=(e,t)=>new ch({type:e,typeName:ft.ZodPromise,...At(t)});class Eo extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{De(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ht;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?eh(n.value):n}));{if("aborted"===t.value)return ht;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?eh(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(r.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===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?ht:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ht:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Sg(e))return e;const i=n.transform(e.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>Sg(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Vt.assertNever(n)}}Eo.create=(e,t,r)=>new Eo({schema:e,typeName:ft.ZodEffects,effect:t,...At(r)}),Eo.createWithPreprocess=(e,t,r)=>new Eo({schema:t,effect:{type:"preprocess",transform:e},typeName:ft.ZodEffects,...At(r)});class Tc extends zt{_parse(e){return this._getType(e)===Be.undefined?hs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tc.create=(e,t)=>new Tc({innerType:e,typeName:ft.ZodOptional,...At(t)});class _f extends zt{_parse(e){return this._getType(e)===Be.null?hs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_f.create=(e,t)=>new _f({innerType:e,typeName:ft.ZodNullable,...At(t)});class Og extends zt{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Og.create=(e,t)=>new Og({innerType:e,typeName:ft.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...At(t)});class Dg extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cg(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new di(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new di(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Dg.create=(e,t)=>new Dg({innerType:e,typeName:ft.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...At(t)});class $y extends zt{_parse(e){if(this._getType(e)!==Be.nan){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Be.nan,received:t.parsedType}),ht}return{status:"valid",value:e.data}}}$y.create=e=>new $y({typeName:ft.ZodNaN,...At(e)});const b9=Symbol("zod_brand");class ek extends zt{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Kg extends zt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),eh(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Kg({in:e,out:t,typeName:ft.ZodPipeline})}}class Ug extends zt{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Sg(e)&&(e.value=Object.freeze(e.value)),e);return Cg(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function $z(e,t={},r){return e?oh.create().superRefine(((n,a)=>{var i,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...c,fatal:s})}})):oh.create()}Ug.create=(e,t)=>new Ug({innerType:e,typeName:ft.ZodReadonly,...At(t)});const x9={object:Gr.lazycreate};var ft;!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"}(ft||(ft={}));const A9=(e,t={message:`Input not instance of ${e.name}`})=>$z((t=>t instanceof e),t),e8=Ro.create,t8=gf.create,z9=$y.create,S9=yf.create,r8=Tg.create,C9=Id.create,T9=Yy.create,j9=jg.create,P9=Pg.create,R9=oh.create,L9=Ed.create,E9=Il.create,N9=Jy.create,I9=Lo.create,M9=Gr.create,O9=Gr.strictCreate,D9=Rg.create,U9=dm.create,q9=Lg.create,W9=Pc.create,F9=Eg.create,V9=Qy.create,B9=Md.create,G9=nh.create,X9=Ng.create,H9=Ig.create,Z9=mf.create,K9=Mg.create,Y9=ch.create,hb=Eo.create,J9=Tc.create,Q9=_f.create,$9=Eo.createWithPreprocess,eS=Kg.create,tS=()=>e8().optional(),rS=()=>t8().optional(),nS=()=>r8().optional(),aS={string:e=>Ro.create({...e,coerce:!0}),number:e=>gf.create({...e,coerce:!0}),boolean:e=>Tg.create({...e,coerce:!0}),bigint:e=>yf.create({...e,coerce:!0}),date:e=>Id.create({...e,coerce:!0})},sS=ht;var Ve=Object.freeze({__proto__:null,defaultErrorMap:ih,setErrorMap:s9,getErrorMap:Hy,makeIssue:Zy,EMPTY_PATH:i9,addIssueToContext:De,ParseStatus:Qa,INVALID:ht,DIRTY:eh,OK:hs,isAborted:jw,isDirty:Pw,isValid:Sg,isAsync:Cg,get util(){return Vt},get objectUtil(){return Tw},ZodParsedType:Be,getParsedType:ff,ZodType:zt,datetimeRegex:Jz,ZodString:Ro,ZodNumber:gf,ZodBigInt:yf,ZodBoolean:Tg,ZodDate:Id,ZodSymbol:Yy,ZodUndefined:jg,ZodNull:Pg,ZodAny:oh,ZodUnknown:Ed,ZodNever:Il,ZodVoid:Jy,ZodArray:Lo,ZodObject:Gr,ZodUnion:Rg,ZodDiscriminatedUnion:dm,ZodIntersection:Lg,ZodTuple:Pc,ZodRecord:Eg,ZodMap:Qy,ZodSet:Md,ZodFunction:nh,ZodLazy:Ng,ZodLiteral:Ig,ZodEnum:mf,ZodNativeEnum:Mg,ZodPromise:ch,ZodEffects:Eo,ZodTransformer:Eo,ZodOptional:Tc,ZodNullable:_f,ZodDefault:Og,ZodCatch:Dg,ZodNaN:$y,BRAND:b9,ZodBranded:ek,ZodPipeline:Kg,ZodReadonly:Ug,custom:$z,Schema:zt,ZodSchema:zt,late:x9,get ZodFirstPartyTypeKind(){return ft},coerce:aS,any:R9,array:I9,bigint:S9,boolean:r8,date:C9,discriminatedUnion:U9,effect:hb,enum:Z9,function:G9,instanceof:A9,intersection:q9,lazy:X9,literal:H9,map:V9,nan:z9,nativeEnum:K9,never:E9,null:P9,nullable:Q9,number:t8,object:M9,oboolean:nS,onumber:rS,optional:J9,ostring:tS,pipeline:eS,preprocess:$9,promise:Y9,record:F9,set:B9,strictObject:O9,string:e8,symbol:T9,transformer:hb,tuple:W9,undefined:j9,union:D9,unknown:L9,void:N9,NEVER:sS,ZodIssueCode:Te,quotelessJson:a9,ZodError:di}),iS={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"d0b129ca309bc3f4",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.777",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3644",APP_NAME:"@wellesley/user"};const n8=e=>iS.DOMAIN_ENV===e,oS=n8("prod"),a8=oS?8:3,s8=64,gb=5,Lw=2,i8=30,tk=50,o8=1024,c8=30,Cc={link:56,userName:30,pronouns:80,displayName:50,description:o8,fieldLabel:20,fieldContent:80,location:56,timezone:56},df={short:"Too short",long:"Too long"},cS=(e,t=100)=>{let r;return function(...n){clearTimeout(r),r=setTimeout((()=>e.apply(this,n)),t)}},lS=(e,t)=>{const r=cS(((t,r,n)=>{e(...n).then(t).catch(r)}),t);return(...e)=>new Promise(((t,n)=>{r(t,n,e)}))},rk=new RegExp("\\p{Extended_Pictographic}","u"),l8=({showInlineError:e=!0})=>Ve.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,df.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),uS=lS((async e=>{try{const{exists:t}=await Xw().dispatch(Ma.endpoints.getApiV1UsersCheck.initiate({username:e})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),u8=Ve.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=rk.test(e),n=/[a-zA-Z0-9]/.test(e);r&&!n&&t.addIssue({code:Ve.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),fS=Ve.string().max(1024,df.long).optional(),f8=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:n})=>Ve.string().trim().min(e,t).max(r,df.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,n);f8({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),f8({minLength:2,minErrorMessage:df.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),Ve.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 dS=`Required: A-Z, a-z, 0-9, special character, min ${a8}, max 64`;Ve.string().trim().superRefine(((e,t)=>{rk.test(e)&&t.addIssue({code:Ve.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>=a8&&e.length<=64||t.addIssue({code:Ve.ZodIssueCode.custom,message:dS})})),Ve.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=>!rk.test(e)),"Emojis are not allowed");const pS=({form:e,originalUsername:t})=>{const r=wt(t??"").current,n=e=>e.getValues("userName"),[a,i]=yt(!1),[o,s]=yt(n(e));return{isUserNameChecked:a,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=n(e).trim();if(t===o||t===r)return;const{exists:a,message:c}=await uS(t);a&&e.setError("userName",{message:c}),s(t),i(!0)}}},hS=Ve.object({bio:fS,username:l8({showInlineError:!0}),displayName:u8}),gS=Ve.object({show:Ve.boolean(),dateOnly:Ve.boolean(),date:Ve.date().optional().nullable()}),yS=(e=!0)=>{const t=l8({showInlineError:e});return Ve.object({avatarId:Ve.string().nullable(),headerId:Ve.string().nullable(),channel:Ve.boolean().optional(),actorType:Ve.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:u8,Pronouns:Ve.string().max(Cc.pronouns,df.long).optional(),summary:Ve.string().max(Cc.description,df.long).optional(),customFields:Ve.array(Ve.object({label:Ve.string().max(Cc.fieldLabel,df.long).optional(),content:Ve.string().max(Cc.fieldContent,df.long).optional()})),location:Ve.object({geo:Ve.object({latitude:Ve.number().optional(),longitude:Ve.number().optional(),accuracy:Ve.number().optional().nullable()}).optional().nullable(),show:Ve.boolean().optional(),name:Ve.string().optional(),autoUpdate:Ve.boolean().optional()}),timezone:Ve.object({show:Ve.boolean(),ianaTimezone:Ve.string().optional(),autoUpdate:Ve.boolean()}),birthday:gS,canSubmit:Ve.boolean(),botProfile:Ve.object({role:Ve.string().optional(),triggers:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),personality_traits:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),tone:Ve.string().optional(),style:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),behaviors:Ve.array(Ve.object({id:Ve.string(),label:Ve.string()})).optional(),prompt:Ve.string().optional()}).optional()})};Ve.object({show:Ve.boolean(),dateOnly:Ve.boolean(),date:Ve.date().optional().nullable()});const qg=e=>{var t;const r=e,n=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:n}},d8=Ma.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await Oe(r)&&await t(Ma.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){rn.error(`${Po(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(xw(!0));try{const e=await Oe(r);e&&t(Vz(e.data)),t(Aw(!0))}catch(e){t(Aw(!1)),t(Fz(!0)),t(Wz(e))}finally{t(xw(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,rn.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=qg(t);!r&&rn.error(`${Po(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(pa.actions.setPending(!0));const e=await Oe(r);n&&e&&(t(pa.actions.setUser(e.data)),t(pa.actions.setSuccess(!0)),t(pa.actions.setPending(!1)))}catch(e){n&&(t(pa.actions.setSuccess(!1)),t(pa.actions.setError(e)),t(pa.actions.setPending(!1))),rn.error(`${Po(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,rn.success("User created successfully")}catch(e){const t=e.error,{isError:r}=qg(t);!r&&rn.error(`${Po(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(pa.actions.setPending(!0));const e=await Oe(r);n&&e&&(t(pa.actions.setUser(e.data)),t(pa.actions.setSuccess(!0)),t(pa.actions.setPending(!1)))}catch(e){n&&(t(pa.actions.setSuccess(!1)),t(pa.actions.setError(e)),t(pa.actions.setPending(!1))),rn.error(`${Po(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"ACCEPTED"}});await Oe(t,`Accepted follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"REJECTED"}});await Oe(t,`Rejected follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await Oe(t,`Follow request sent to ${e.username}`)&&r(Ma.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Ll({dispatch:r,userId:e.user.id,state:n(),relationsProps:{following:null}});await Oe(t,`You unfollowed ${e.username}`,(()=>null==a?void 0:a.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!0}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!0}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!1}}});await Oe(t,void 0,(()=>null==a?void 0:a.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const{userId:a,text:i}=e.noteUpdate,o=Ll({userId:a,dispatch:n,state:r(),relationsProps:{note:i}});await Oe(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Ll({userId:e.userId,dispatch:n,state:r(),relationsProps:{note:""}});await Oe(t,"Note has been removed",(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(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:Mde,usePostApiV1UsersMutation:mS,useDeleteApiV1AccountsDeleteMutation:_S,useGetApiV1AccountsProfileQuery:Ode,usePutApiV1UsersByUserIdMutation:nk,useGetApiV1UsersQuery:vS,useDeleteApiV1UsersMutation:p8,usePostApiV1MuteByUserIdMutation:Dde,useDeleteApiV1MuteByUserIdMutation:Ude,useGetApiV1MuteQuery:qde,usePostApiV1AdminUserChangeStateMutation:Wde,useGetApiV1UsersRelationshipsQuery:wS,usePutApiV1NotesMutation:Fde,useDeleteApiV1NotesByUserIdMutation:Vde,useLazyGetApiV1UsersRelationshipsQuery:kS,useLazyGetApiV1GeoQuery:bS,useLazyGetApiV1GroupsOwnedQuery:xS,useGetApiV1UsersFollowersQuery:Bde,useGetApiV1UsersByUserIdQuery:AS,useLazyGetApiV1UsersRenameHistoryQuery:Gde,useGetApiV1UsersByUserIdFollowersQuery:Xde,usePostApiV1UsersFollowByUsernameMutation:Hde,usePostApiV1UsersFollowByUsernameUndoMutation:Zde,usePostApiV1UsersFollowByUsernameRejectMutation:Kde,usePostApiV1UsersFollowByUsernameAcceptMutation:Yde,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:Jde}=d8,h8=()=>{const[e]=nk();return({userId:t,htmlContent:r,data:n})=>{e({userId:t,userUpdate:n,...r&&{htmlContent:r}})}},yb={data:null,isError:!1,isPending:!1,isSuccess:!1},Ur=Dd({name:"user",initialState:yb,reducers:{reset:e=>{Object.assign(e,yb)}},extraReducers:e=>{e.addCase(Vz,((e,{payload:t})=>{e.data=t})).addCase(Bz,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(Aw,((e,{payload:t})=>{e.isSuccess=t})).addCase(xw,((e,{payload:t})=>{e.isPending=t})).addCase(Fz,((e,{payload:t})=>{e.isError=t})).addCase(Wz,((e,{payload:t})=>{e.error=t})).addCase(J7,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.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 r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),zS=e=>e.filter((e=>e.id&&e.username&&e.displayName)),Qde=()=>{const e=Io(),t=mt(Ur.selectors.selectAccount),r=jz("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),n=mt((e=>Zw.selectors.selectLastUpdateFor(e,r)));Ze((()=>{if(null!=t&&t.id)return e(Uz({id:r,topics:[r]})),()=>{e(qz(r))}}),[null==t?void 0:t.id]),Ze((()=>{null!=n&&n.data&&e(Bz({...n.data,users:zS(n.data.users)}))}),[null==n?void 0:n.data])},uh=()=>{const e=mt(Ur.selectors.selectSelectedUserId),t=Io();return{changeUser:Qt((r=>{e!==r&&t(K7({userId:r}))}),[e,t]),selectedUserId:e}},SS=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,CS=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const n=SS(e),{data:a,error:i,isLoading:o}=vS({username:n,full:!0,htmlContent:r},{skip:!n||!t});return{data:a,error:i,isLoading:o}},TS=e=>{const t=mt(pa.selectors.selectUser),{isLoading:r}=CS({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},Yg=()=>"object"!=typeof window,g8=()=>_8()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),y8=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},m8=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),jS=(e,t)=>{const r=Yg()?"":document.cookie,n=`; ${t||r}`.split(`; ${e}=`);if(2===n.length)return(n.pop()||"").replace("=","").split(";").shift()},PS=(e,t)=>{Yg()||(document.cookie=m8({[e]:"",path:"/",domain:t||g8(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},RS=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],_8=()=>RS.includes(location.hostname),LS=(e,t="",r=10,n)=>{Yg()||(document.cookie=m8({[e]:t,path:"/",domain:n||g8(),expires:y8(r),...!_8()&&{SameSite:"None",Secure:!0}}))},pm={set:LS,remove:PS,get:jS,getExpireDate:y8},ak="auth_token",v8=()=>pm.get(ak)||void 0,ES=e=>pm.set(ak,e),NS=()=>pm.remove(ak),IS=()=>!!v8(),MS={getToken:v8,setToken:ES,removeToken:NS,hasToken:IS},mb={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!MS.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},sk=Dd({name:"auth",initialState:mb,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...mb,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}}),$de=()=>{const e=mt(sk.selectors.selectIsAuthenticated),t=mt(Ur.selectors.selectPending);return{user:mt(Ur.selectors.selectCurrentUser),isLogged:e,isLoading:t}},OS=()=>{const e=mt(Ur.selectors.selectCurrentUser),t=mt(sk.selectors.selectIsAuthenticated);return{user:e,isLoading:mt(Ur.selectors.selectPending),isLogged:t,error:mt(Ur.selectors.selectError)}},epe=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:n,error:a,isLoading:i,isFetching:o}=AS({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:n,error:a,isLoading:i,isFetching:o}},DS=({onChange:e})=>{const{user:t}=OS(),r=null==t?void 0:t.id,n=wt(r);Ze((()=>{n.current?r!==n.current&&(e(),n.current=r):n.current=r}),[r,n.current])},_b=["following","followed","blocked","muted","note","blocked_by"],vb=({userId:e,currentUserId:t})=>{const r="string"==typeof e,n=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],a=e===t;return{isSingleUser:r,canFetch:!(!n.length||a||!t),safeTargets:n}},US=({userId:e,skip:t})=>{const r=mt(Ur.selectors.selectCurrentUser),n=null==r?void 0:r.id,{canFetch:a,isSingleUser:i,safeTargets:o}=vb({userId:e,currentUserId:n}),{data:s,isLoading:c}=wS({targets:o,filter:_b},{skip:!a||t}),[l]=kS(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=vb({userId:e,currentUserId:n});t&&l({targets:r,filter:_b})};return DS({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},hm=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,w8=({id:e,user:t})=>{const r=Io(),n=jz("user#$username",{username:t?hm(t).slice(1):""}),a=`${e}-${null==t?void 0:t.username}`;return Ze((()=>{if(null!=t&&t.username)return r(Uz({id:a,topics:[n]})),()=>{r(qz(a))}}),[null==t?void 0:t.username]),{subscriptionName:n}},tpe=({user:e,onUpdate:t})=>{const{updateRelations:r}=US({}),{subscriptionName:n}=w8({id:"outside-user-update",user:e}),a=mt((e=>Zw.selectors.selectLastUpdateFor(e,n)));Ze((()=>{const e=null==a?void 0:a.data;e&&(r({userId:e.id}),t(e))}),[null==a?void 0:a.data])},rpe=({onUpdate:e})=>{const t=mt(Ur.selectors.selectCurrentUser),{subscriptionName:r}=w8({id:"current-user-update",user:t}),n=mt((e=>Zw.selectors.selectLastUpdateFor(e,r)));Ze((()=>{const t=null==n?void 0:n.data;t&&e(t)}),[null==n?void 0:n.data])},k8=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},qS=e=>e.replace(/\.[^.]*$/,""),WS=()=>!Yg()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),bg="8.48.0",Ml=globalThis;function ik(e,t,r){const n=Ml,a=n.__SENTRY__=n.__SENTRY__||{},i=a[bg]=a[bg]||{};return i[e]||(i[e]=t())}const b8=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,FS="Sentry Logger ",wb=["debug","info","warn","error","log","assert","trace"],kb={};function VS(e){if(!("console"in Ml))return e();const t=Ml.console,r={},n=Object.keys(kb);n.forEach((e=>{const n=kb[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}function BS(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return b8?wb.forEach((r=>{t[r]=(...t)=>{e&&VS((()=>{Ml.console[r](`${FS}[${r}]:`,...t)}))}})):wb.forEach((e=>{t[e]=()=>{}})),t}const Uy=ik("logger",BS);function ok(){return ck(Ml),Ml}function ck(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||bg,t[bg]=t[bg]||{}}const GS=Object.prototype.toString;function XS(e,t){return GS.call(e)===`[object ${t}]`}function HS(e){return XS(e,"Object")}function ZS(e){return!(!e||!e.then||"function"!=typeof e.then)}function KS(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{b8&&Uy.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const x8=1e3;function A8(){return Date.now()/x8}function YS(){const{performance:e}=Ml;if(!e||!e.now)return A8;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/x8}const JS=YS();function ah(){const e=Ml,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function QS(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||JS(),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:ah()),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 bb(){return ah()}function xb(){return ah().substring(16)}function z8(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const n={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=z8(n[e],t[e],r-1));return n}(()=>{const{performance:e}=Ml;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),a=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=a<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-n):t;(i||s<t)&&(a<=s&&e.timeOrigin)})();const Ew="_sentrySpan";function Ab(e,t){t?KS(e,Ew,t):delete e[Ew]}function zb(e){return e[Ew]}const $S=100;class lk{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:bb(),spanId:xb()}}clone(){const e=new lk;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,Ab(e,zb(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&&QS(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,[r,n]=t instanceof Wg?[t.getScopeData(),t.getRequestSession()]:HS(t)?[e,e.requestSession]:[],{tags:a,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...a},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),n&&(this._requestSession=n),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,Ab(this,void 0),this._attachments=[],this.setPropagationContext({traceId:bb()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:$S;if(r<=0)return this;const n={timestamp:A8(),...e},a=this._breadcrumbs;return a.push(n),this._breadcrumbs=a.length>r?a.slice(-r):a,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:zb(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=z8(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:xb(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:ah();if(!this._client)return Uy.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:ah();if(!this._client)return Uy.warn("No client configured on scope - will not capture message!"),n;const a=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:a,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ah();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(Uy.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const Wg=lk;function eC(){return ik("defaultCurrentScope",(()=>new Wg))}function tC(){return ik("defaultIsolationScope",(()=>new Wg))}class rC{constructor(e,t){let r,n;r=e||new Wg,n=t||new Wg,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return ZS(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}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 lh(){const e=ck(ok());return e.stack=e.stack||new rC(eC(),tC())}function nC(e){return lh().withScope(e)}function aC(e,t){const r=lh();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function Sb(e){return lh().withScope((()=>e(lh().getIsolationScope())))}function sC(){return{withIsolationScope:Sb,withScope:nC,withSetScope:aC,withSetIsolationScope:(e,t)=>Sb(t),getCurrentScope:()=>lh().getScope(),getIsolationScope:()=>lh().getIsolationScope()}}function S8(e){const t=ck(e);return t.acs?t.acs:sC()}function C8(){return S8(ok()).getCurrentScope()}function iC(){return S8(ok()).getIsolationScope()}function oC(e,t){return C8().captureException(e,void 0)}function cC(e,t){const r={captureContext:t};return C8().captureMessage(e,void 0,r)}function lC(e,t){iC().setExtra(e,t)}const uC=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return lC("exceptionMessage",t),void oC(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}cC(t)},fC="wlsy",T8=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},dC=()=>{const e=new Set,t=T8();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const n=null==t?void 0:t.key(r);"string"==typeof n&&e.add(n)}return Array.from(e)},j8=e=>{const t=`${fC}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,n=()=>dC().filter((e=>e.startsWith(`${t}:`))),a=e=>e.slice(t.length+1),i=T8(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{n().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>n().map(a),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},Cb=["debug","info","warn","error"],pC=(e,t)=>{const r=Cb.indexOf(e);return Cb.indexOf(t)>=r},Ey=(e,t,r,...n)=>{pC(t,e)&&console.log(`[${e}] ${r}`,...n)},hC=()=>j8().getItem("logger_lvl"),gC=(e=(Yg()?"info":hC()||"warn"))=>{let t=e;return{debug:(e,...r)=>Ey("debug",t,e,...r),info:(e,...r)=>Ey("info",t,e,...r),warn:(e,...r)=>Ey("warn",t,e,...r),error:(e,...r)=>(uC(e,...r),Ey("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},pi=gC(),yC=({src:e,name:t=""})=>new Promise(((r,n)=>{const a=document.createElement("video");a.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=a,c=qS(t);(!e||!i||!o||!s)&&n(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{pi.warn("Failed to load video"),r(null)};return WS()&&a.load(),a.addEventListener("error",o),a.addEventListener("loadeddata",i),()=>{a.removeEventListener("error",o),a.removeEventListener("loadeddata",i)}})),mC=e=>new Promise(((t,r)=>{const n=new Image,a=URL.createObjectURL(e);n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(a)},n.onerror=()=>{pi.warn("Failed to load image"),r(null),URL.revokeObjectURL(a)},n.src=a})),Tb=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},_C={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},qy={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},Nl=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],vC={data:null,isPending:!1},{posts:g1,uploadsPolicyDoc:jb,uploadsPolicyAudio:y1,uploadsPolicyImage:Ny,uploadsPolicyVideo:ug,registration:wC,captcha:kC,instanceAdmin:bC,branding:xC,translation:AC,access:zC}=qy,{captcha:SC,language:CC,translation:TC,openai:jC,link_service:PC}=_C,fh=e=>e.data,RC=vf(fh,(e=>{var t,r,n;return{max_characters:(null==(t=null==e?void 0:e[g1])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[g1])?void 0:r.max_media_attachments)||0,max_pins:(null==(n=null==e?void 0:e[g1])?void 0:n.max_pins)||0}})),uk=vf(fh,(e=>{var t,r,n;return{...null==e?void 0:e[Ny],maxSize:(null==(t=null==e?void 0:e[Ny])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Ny])?void 0:r.maxMatrix)||0,maxResolution:(null==(n=null==e?void 0:e[Ny])?void 0:n.maxResolution)||0}})),LC=vf(uk,(e=>Nl(e.extensions))),P8=vf(fh,(e=>{var t,r,n,a;return{...null==e?void 0:e[ug],maxSize:(null==(t=null==e?void 0:e[ug])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[ug])?void 0:r.maxMatrix)||0,maxDuration:(null==(n=null==e?void 0:e[ug])?void 0:n.maxDuration)||0,maxResolution:(null==(a=null==e?void 0:e[ug])?void 0:a.maxResolution)||0}})),R8=vf(fh,(e=>{var t,r;return{...null==e?void 0:e[y1],maxSize:null==(t=null==e?void 0:e[y1])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[y1])?void 0:r.keepOriginal)||0}})),L8=vf(fh,(e=>{var t;return{...null==e?void 0:e[jb],maxSize:(null==(t=null==e?void 0:e[jb])?void 0:t.maxSize)||0}})),E8=vf([uk,P8,R8,L8],((e,t,r,n)=>({IMAGE:Nl(null==e?void 0:e.extensions),VIDEO:Nl(null==t?void 0:t.extensions),AUDIO:Nl(null==r?void 0:r.extensions),DOCUMENT:Nl(null==n?void 0:n.extensions)}))),EC=vf(E8,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),mg=Dd({name:"platformSettings",initialState:vC,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(Q7,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:fh,selectPostConfig:RC,selectDocPolicy:L8,selectImagePolicy:uk,selectVideoPolicy:P8,selectAudioPolicy:R8,selectImageExtensions:LC,selectSupportedExtensions:E8,selectFullExtensionsList:EC,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[wC]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[CC]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[TC]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[jC]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[kC]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[SC]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[AC]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[zC]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[xC]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[PC]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[bC]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[qy.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[qy.domainBlocks]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[qy.contacts]}}}),NC=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:n,audioPolicy:a})=>{if(!r||!n)return"Media policy is not defined";const i={IMAGE:Nl(r.extensions),VIDEO:Nl(n.extensions),AUDIO:Nl(a.extensions),DOCUMENT:Nl(t.extensions)},o=k8(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await mC(e.file),n=e.file.size>r.maxSize,a=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case n:return`Image is too big. Max size is ${Tb(r.maxSize)}`;case a:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await yC({src:e.objectUrl}),r=t&&t.duration>n.maxDuration,a=t&&Math.max(t.width,t.height)>n.maxResolution,i=e.file.size>n.maxSize,o=t&&t.width*t.height>n.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${n.maxDuration} seconds`;case i:return`Video is too big. Max size is ${Tb(n.maxSize)}`;case a:return`Video resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${n.maxMatrix} pixels`}}},IC=()=>{const[e]=M5(),t=new AbortController,r=t.signal,n=mt(mg.selectors.selectImagePolicy),a=mt(mg.selectors.selectVideoPolicy),i=mt(mg.selectors.selectDocPolicy),o=mt(mg.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=k8(t.file.name),p=await NC({imgPolicy:n,docPolicy:i,videoPolicy:a,audioPolicy:o,media:t});if(p)return rn.error(p),void(null==c||c());try{const n=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in n)throw new Error(n.error);const a=null==(d=n.data)?void 0:d.uri;return await new Promise(((e,n)=>{const i=new XMLHttpRequest;i.open("PUT",a),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){pi.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>n(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():n(new Error(i.statusText))},i.send(t.file)})),null==l||l(),n.data.upload.uploadId}catch(e){null==c||c(e),rn.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Hi=(e=>(e.header="header",e.avatar="avatar",e))(Hi||{});const Fg=({user:e,type:t})=>{var r,n,a,i;if(!e)return"";try{return("avatar"===t?null==(n=null==(r=e.avatar)?void 0:r.files[0])?void 0:n.uri:null==(i=null==(a=e.header)?void 0:a.files[0])?void 0:i.uri)||""}catch{return""}};var Pb,_g={exports:{}},MC=_g.exports;
43
43
  /**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
@@ -107,4 +107,4 @@ import{api as Ma,usePostApiV1UploadsMutation as M5,useGetApiV1SearchQuery as O5,
107
107
  *
108
108
  * This source code is licensed under the ISC license.
109
109
  * See the LICENSE file in the root directory of this source tree.
110
- */function Foe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _r((()=>e=>{t.forEach((t=>t(e)))}),t)}const Cm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ph(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Bk(e){return"nodeType"in e}function Us(e){var t,r;return e?ph(e)?e:Bk(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function Gk(e){const{Document:t}=Us(e);return e instanceof t}function ty(e){return!ph(e)&&e instanceof Us(e).HTMLElement}function K4(e){return e instanceof Us(e).SVGElement}function hh(e){return e?ph(e)?e.document:Bk(e)?Gk(e)?e:ty(e)||K4(e)?e.ownerDocument:document:document:document}const Rc=Cm?Sz:Ze;function Xk(e){const t=wt(e);return Rc((()=>{t.current=e})),Qt((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)}),[])}function Voe(){const e=wt(null);return[Qt(((t,r)=>{e.current=setInterval(t,r)}),[]),Qt((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}function Vg(e,t){void 0===t&&(t=[e]);const r=wt(e);return Rc((()=>{r.current!==e&&(r.current=e)}),t),r}function ry(e,t){const r=wt();return _r((()=>{const t=e(r.current);return r.current=t,t}),[...t])}function rm(e){const t=Xk(e),r=wt(null),n=Qt((e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e}),[]);return[r,n]}function qw(e){const t=wt();return Ze((()=>{t.current=e}),[e]),t.current}let pw={};function ny(e,t){return _r((()=>{if(t)return t;const r=null==pw[e]?0:pw[e]+1;return pw[e]=r,e+"-"+r}),[e,t])}function Y4(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce(((t,r)=>{const n=Object.entries(r);for(const[r,a]of n){const n=t[r];null!=n&&(t[r]=n+e*a)}return t}),{...t})}}const sh=Y4(1),Bg=Y4(-1);function Boe(e){return"clientX"in e&&"clientY"in e}function Hk(e){if(!e)return!1;const{KeyboardEvent:t}=Us(e.target);return t&&e instanceof t}function Goe(e){if(!e)return!1;const{TouchEvent:t}=Us(e.target);return t&&e instanceof t}function Ww(e){if(Goe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Boe(e)?{x:e.clientX,y:e.clientY}:null}const Gg=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Gg.Translate.toString(e),Gg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),X6="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Xoe(e){return e.matches(X6)?e:e.querySelector(X6)}const Hoe={display:"none"};function Zoe(e){let{id:t,value:r}=e;return $n.createElement("div",{id:t,style:Hoe},r)}function Koe(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;return $n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":n,"aria-atomic":!0},r)}function Yoe(){const[e,t]=yt("");return{announce:Qt((e=>{null!=e&&t(e)}),[]),announcement:e}}const J4=Hg(null);function Joe(e){const t=Nd(J4);Ze((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}function Qoe(){const[e]=yt((()=>new Set)),t=Qt((t=>(e.add(t),()=>e.delete(t))),[e]);return[Qt((t=>{let{type:r,event:n}=t;e.forEach((e=>{var t;return null==(t=e[r])?void 0:t.call(e,n)}))}),[e]),t]}const $oe={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ece={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tce(e){let{announcements:t=ece,container:r,hiddenTextDescribedById:n,screenReaderInstructions:a=$oe}=e;const{announce:i,announcement:o}=Yoe(),s=ny("DndLiveRegion"),[c,l]=yt(!1);if(Ze((()=>{l(!0)}),[]),Joe(_r((()=>({onDragStart(e){let{active:r}=e;i(t.onDragStart({active:r}))},onDragMove(e){let{active:r,over:n}=e;t.onDragMove&&i(t.onDragMove({active:r,over:n}))},onDragOver(e){let{active:r,over:n}=e;i(t.onDragOver({active:r,over:n}))},onDragEnd(e){let{active:r,over:n}=e;i(t.onDragEnd({active:r,over:n}))},onDragCancel(e){let{active:r,over:n}=e;i(t.onDragCancel({active:r,over:n}))}})),[i,t])),!c)return null;const u=$n.createElement($n.Fragment,null,$n.createElement(Zoe,{id:n,value:a.draggable}),$n.createElement(Koe,{id:s,announcement:o}));return r?th.createPortal(u,r):u}var Qn;function nm(){}function H6(e,t){return _r((()=>({sensor:e,options:t??{}})),[e,t])}function rce(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _r((()=>[...t].filter((e=>null!=e))),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(Qn||(Qn={}));const No=Object.freeze({x:0,y:0});function Q4(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $4(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function nce(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Z6(e){let{left:t,top:r,height:n,width:a}=e;return[{x:t,y:r},{x:t+a,y:r},{x:t,y:r+n},{x:t+a,y:r+n}]}function e5(e,t){if(!e||0===e.length)return null;const[r]=e;return r[t]}function K6(e,t,r){return void 0===t&&(t=e.left),void 0===r&&(r=e.top),{x:t+.5*e.width,y:r+.5*e.height}}const ace=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=K6(t,t.left,t.top),i=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=Q4(K6(n),a);i.push({id:t,data:{droppableContainer:e,value:r}})}}return i.sort($4)},sce=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=Z6(t),i=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=Z6(n),o=a.reduce(((e,t,n)=>e+Q4(r[n],t)),0),s=Number((o/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:s}})}}return i.sort($4)};function ice(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=a-n,s=i-r;if(n<a&&r<i){const r=t.width*t.height,n=e.width*e.height,a=o*s;return Number((a/(r+n-a)).toFixed(4))}return 0}const oce=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=[];for(const e of n){const{id:n}=e,i=r.get(n);if(i){const r=ice(i,t);r>0&&a.push({id:n,data:{droppableContainer:e,value:r}})}}return a.sort(nce)};function cce(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function t5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:No}function lce(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce(((t,r)=>({...t,top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x})),{...t})}}const uce=lce(1);function fce(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dce(e,t,r){const n=fce(t);if(!n)return e;const{scaleX:a,scaleY:i,x:o,y:s}=n,c=e.left-o-(1-a)*parseFloat(r),l=e.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=a?e.width/a:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}const pce={ignoreTransform:!1};function gh(e,t){void 0===t&&(t=pce);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:n}=Us(e).getComputedStyle(e);t&&(r=dce(r,t,n))}const{top:n,left:a,width:i,height:o,bottom:s,right:c}=r;return{top:n,left:a,width:i,height:o,bottom:s,right:c}}function Y6(e){return gh(e,{ignoreTransform:!0})}function hce(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function gce(e,t){return void 0===t&&(t=Us(e).getComputedStyle(e)),"fixed"===t.position}function yce(e,t){void 0===t&&(t=Us(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const n=t[e];return"string"==typeof n&&r.test(n)}))}function Tm(e,t){const r=[];return e?function n(a){if(null!=t&&r.length>=t||!a)return r;if(Gk(a)&&null!=a.scrollingElement&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!ty(a)||K4(a)||r.includes(a))return r;const i=Us(e).getComputedStyle(a);return a!==e&&yce(a,i)&&r.push(a),gce(a,i)?r:n(a.parentNode)}(e):r}function r5(e){const[t]=Tm(e,1);return t??null}function hw(e){return Cm&&e?ph(e)?e:Bk(e)?Gk(e)||e===hh(e).scrollingElement?window:ty(e)?e:null:null:null}function n5(e){return ph(e)?e.scrollX:e.scrollLeft}function a5(e){return ph(e)?e.scrollY:e.scrollTop}function Fw(e){return{x:n5(e),y:a5(e)}}var ha;function s5(e){return!(!Cm||!e)&&e===document.scrollingElement}function i5(e){const t={x:0,y:0},r=s5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(ha||(ha={}));const mce={x:.2,y:.2};function _ce(e,t,r,n,a){let{top:i,left:o,right:s,bottom:c}=r;void 0===n&&(n=10),void 0===a&&(a=mce);const{isTop:l,isBottom:u,isLeft:d,isRight:f}=i5(e),p={x:0,y:0},h={x:0,y:0},y=t.height*a.y,g=t.width*a.x;return!l&&i<=t.top+y?(p.y=ha.Backward,h.y=n*Math.abs((t.top+y-i)/y)):!u&&c>=t.bottom-y&&(p.y=ha.Forward,h.y=n*Math.abs((t.bottom-y-c)/y)),!f&&s>=t.right-g?(p.x=ha.Forward,h.x=n*Math.abs((t.right-g-s)/g)):!d&&o<=t.left+g&&(p.x=ha.Backward,h.x=n*Math.abs((t.left+g-o)/g)),{direction:p,speed:h}}function vce(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:r,right:n,bottom:a}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:a,width:e.clientWidth,height:e.clientHeight}}function o5(e){return e.reduce(((e,t)=>sh(e,Fw(t))),No)}function wce(e){return e.reduce(((e,t)=>e+n5(t)),0)}function kce(e){return e.reduce(((e,t)=>e+a5(t)),0)}function bce(e,t){if(void 0===t&&(t=gh),!e)return;const{top:r,left:n,bottom:a,right:i}=t(e);r5(e)&&(a<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const xce=[["x",["left","right"],wce],["y",["top","bottom"],kce]];class Zk{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Tm(t),n=o5(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,a]of xce)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=a(r),o=n[e]-t;return this.rect[i]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xg{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,r){var n;null==(n=this.target)||n.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function Ace(e){const{EventTarget:t}=Us(e);return e instanceof t?e:hh(e)}function gw(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}var Zi,Mt;function J6(e){e.preventDefault()}function zce(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Zi||(Zi={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Mt||(Mt={}));const c5={start:[Mt.Space,Mt.Enter],cancel:[Mt.Esc],end:[Mt.Space,Mt.Enter,Mt.Tab]},Sce=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Mt.Right:return{...r,x:r.x+25};case Mt.Left:return{...r,x:r.x-25};case Mt.Down:return{...r,y:r.y+25};case Mt.Up:return{...r,y:r.y-25}}};class Kk{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new xg(hh(t)),this.windowListeners=new xg(Us(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Zi.Resize,this.handleCancel),this.windowListeners.add(Zi.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Zi.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&bce(r),t(No)}handleKeyDown(e){if(Hk(e)){const{active:t,context:r,options:n}=this.props,{keyboardCodes:a=c5,coordinateGetter:i=Sce,scrollBehavior:o="smooth"}=n,{code:s}=e;if(a.end.includes(s))return void this.handleEnd(e);if(a.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:c}=r.current,l=c?{x:c.left,y:c.top}:No;this.referenceCoordinates||(this.referenceCoordinates=l);const u=i(e,{active:t,context:r.current,currentCoordinates:l});if(u){const t=Bg(u,l),n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,{isTop:i,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=i5(r),p=vce(r),h={x:Math.min(a===Mt.Right?p.right-p.width/2:p.right,Math.max(a===Mt.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(a===Mt.Down?p.bottom-p.height/2:p.bottom,Math.max(a===Mt.Down?p.top:p.top+p.height/2,u.y))},y=a===Mt.Right&&!s||a===Mt.Left&&!c,g=a===Mt.Down&&!l||a===Mt.Up&&!i;if(y&&h.x!==u.x){const e=r.scrollLeft+t.x,i=a===Mt.Right&&e<=d.x||a===Mt.Left&&e>=f.x;if(i&&!t.y)return void r.scrollTo({left:e,behavior:o});n.x=i?r.scrollLeft-e:a===Mt.Right?r.scrollLeft-d.x:r.scrollLeft-f.x,n.x&&r.scrollBy({left:-n.x,behavior:o});break}if(g&&h.y!==u.y){const e=r.scrollTop+t.y,i=a===Mt.Down&&e<=d.y||a===Mt.Up&&e>=f.y;if(i&&!t.x)return void r.scrollTo({top:e,behavior:o});n.y=i?r.scrollTop-e:a===Mt.Down?r.scrollTop-d.y:r.scrollTop-f.y,n.y&&r.scrollBy({top:-n.y,behavior:o});break}}this.handleMove(e,sh(Bg(u,this.referenceCoordinates),n))}}}handleMove(e,t){const{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Q6(e){return!(!e||!("distance"in e))}function $6(e){return!(!e||!("delay"in e))}Kk.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=c5,onActivation:a}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class Yk{constructor(e,t,r){var n;void 0===r&&(r=Ace(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:i}=a;this.props=e,this.events=t,this.document=hh(i),this.documentListeners=new xg(this.document),this.listeners=new xg(r),this.windowListeners=new xg(Us(i)),this.initialCoordinates=null!=(n=Ww(a))?n:No,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Zi.Resize,this.handleCancel),this.windowListeners.add(Zi.DragStart,J6),this.windowListeners.add(Zi.VisibilityChange,this.handleCancel),this.windowListeners.add(Zi.ContextMenu,J6),this.documentListeners.add(Zi.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($6(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Q6(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Zi.Click,zce,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Zi.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:r,initialCoordinates:n,props:a}=this,{onMove:i,options:{activationConstraint:o}}=a;if(!n)return;const s=null!=(t=Ww(e))?t:No,c=Bg(n,s);if(!r&&o){if(Q6(o)){if(null!=o.tolerance&&gw(c,o.tolerance))return this.handleCancel();if(gw(c,o.distance))return this.handleStart()}return $6(o)&&gw(c,o.tolerance)?this.handleCancel():void this.handlePending(o,c)}e.cancelable&&e.preventDefault(),i(s)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Mt.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Cce={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Jk extends Yk{constructor(e){const{event:t}=e,r=hh(t.target);super(e,Cce,r)}}Jk.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!(!r.isPrimary||0!==r.button)&&(null==n||n({event:r}),!0)}}];const Tce={move:{name:"mousemove"},end:{name:"mouseup"}};var Vw;!function(e){e[e.RightClick=2]="RightClick"}(Vw||(Vw={}));class jce extends Yk{constructor(e){super(e,Tce,hh(e.event.target))}}jce.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button!==Vw.RightClick&&(null==n||n({event:r}),!0)}}];const yw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Pce extends Yk{constructor(e){super(e,yw)}static setup(){return window.addEventListener(yw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(yw.move.name,e)};function e(){}}}var Ag,am;function Rce(e){let{acceleration:t,activator:r=Ag.Pointer,canScroll:n,draggingRect:a,enabled:i,interval:o=5,order:s=am.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e;const p=Ece({delta:d,disabled:!i}),[h,y]=Voe(),g=wt({x:0,y:0}),m=wt({x:0,y:0}),v=_r((()=>{switch(r){case Ag.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ag.DraggableRect:return a}}),[r,a,c]),_=wt(null),k=Qt((()=>{const e=_.current;if(!e)return;const t=g.current.x*m.current.x,r=g.current.y*m.current.y;e.scrollBy(t,r)}),[]),b=_r((()=>s===am.TreeOrder?[...l].reverse():l),[s,l]);Ze((()=>{if(i&&l.length&&v){for(const e of b){if(!1===(null==n?void 0:n(e)))continue;const r=l.indexOf(e),a=u[r];if(!a)continue;const{direction:i,speed:s}=_ce(e,a,v,t,f);for(const e of["x","y"])p[e][i[e]]||(s[e]=0,i[e]=0);if(s.x>0||s.y>0)return y(),_.current=e,h(k,o),g.current=s,void(m.current=i)}g.current={x:0,y:0},m.current={x:0,y:0},y()}else y()}),[t,k,n,y,i,o,JSON.stringify(v),JSON.stringify(p),h,l,b,u,JSON.stringify(f)])}Pce.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:a}=r;return!(a.length>1)&&(null==n||n({event:r}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(Ag||(Ag={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(am||(am={}));const Lce={x:{[ha.Backward]:!1,[ha.Forward]:!1},y:{[ha.Backward]:!1,[ha.Forward]:!1}};function Ece(e){let{delta:t,disabled:r}=e;const n=qw(t);return ry((e=>{if(r||!n||!e)return Lce;const a=Math.sign(t.x-n.x),i=Math.sign(t.y-n.y);return{x:{[ha.Backward]:e.x[ha.Backward]||-1===a,[ha.Forward]:e.x[ha.Forward]||1===a},y:{[ha.Backward]:e.y[ha.Backward]||-1===i,[ha.Forward]:e.y[ha.Forward]||1===i}}}),[r,t,n])}function Nce(e,t){const r=null!=t?e.get(t):void 0,n=r?r.node.current:null;return ry((e=>{var r;return null==t?null:null!=(r=n??e)?r:null}),[n,t])}function Ice(e,t){return _r((()=>e.reduce(((e,r)=>{const{sensor:n}=r;return[...e,...n.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,r)})))]}),[])),[e,t])}var Xg,Bw;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Xg||(Xg={})),(Bw||(Bw={})).Optimized="optimized";const ez=new Map;function Mce(e,t){let{dragging:r,dependencies:n,config:a}=t;const[i,o]=yt(null),{frequency:s,measure:c,strategy:l}=a,u=wt(e),d=function(){switch(l){case Xg.Always:return!1;case Xg.BeforeDragging:return r;default:return!r}}(),f=Vg(d),p=Qt((function(e){void 0===e&&(e=[]),!f.current&&o((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[f]),h=wt(null),y=ry((t=>{if(d&&!r)return ez;if(!t||t===ez||u.current!==e||null!=i){const t=new Map;for(let r of e){if(!r)continue;if(i&&i.length>0&&!i.includes(r.id)&&r.rect.current){t.set(r.id,r.rect.current);continue}const e=r.node.current,n=e?new Zk(c(e),e):null;r.rect.current=n,n&&t.set(r.id,n)}return t}return t}),[e,i,r,d,c]);return Ze((()=>{u.current=e}),[e]),Ze((()=>{d||p()}),[r,d]),Ze((()=>{i&&i.length>0&&o(null)}),[JSON.stringify(i)]),Ze((()=>{d||"number"!=typeof s||null!==h.current||(h.current=setTimeout((()=>{p(),h.current=null}),s))}),[s,d,p,...n]),{droppableRects:y,measureDroppableContainers:p,measuringScheduled:null!=i}}function l5(e,t){return ry((r=>e?r||("function"==typeof t?t(e):e):null),[t,e])}function Oce(e,t){return l5(e,t)}function Dce(e){let{callback:t,disabled:r}=e;const n=Xk(t),a=_r((()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:e}=window;return new e(n)}),[n,r]);return Ze((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function jm(e){let{callback:t,disabled:r}=e;const n=Xk(t),a=_r((()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:e}=window;return new e(n)}),[r]);return Ze((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function Uce(e){return new Zk(gh(e),e)}function tz(e,t,r){void 0===t&&(t=Uce);const[n,a]=yt(null);function i(){a((n=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=n??r)?a:null;const i=t(e);return JSON.stringify(n)===JSON.stringify(i)?n:i}))}const o=Dce({callback(t){if(e)for(const r of t){const{type:t,target:n}=r;if("childList"===t&&n instanceof HTMLElement&&n.contains(e)){i();break}}}}),s=jm({callback:i});return Rc((()=>{i(),e?(null==s||s.observe(e),null==o||o.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==o||o.disconnect())}),[e]),n}function qce(e){return t5(e,l5(e))}const rz=[];function Wce(e){const t=wt(e),r=ry((r=>e?r&&r!==rz&&e&&t.current&&e.parentNode===t.current.parentNode?r:Tm(e):rz),[e]);return Ze((()=>{t.current=e}),[e]),r}function Fce(e){const[t,r]=yt(null),n=wt(e),a=Qt((e=>{const t=hw(e.target);t&&r((e=>e?(e.set(t,Fw(t)),new Map(e)):null))}),[]);return Ze((()=>{const t=n.current;if(e!==t){i(t);const o=e.map((e=>{const t=hw(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Fw(t)]):null})).filter((e=>null!=e));r(o.length?new Map(o):null),n.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=hw(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),_r((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>sh(e,t)),No):o5(e):No),[e,t])}function nz(e,t){void 0===t&&(t=[]);const r=wt(null);return Ze((()=>{r.current=null}),t),Ze((()=>{const t=e!==No;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)}),[e]),r.current?Bg(e,r.current):No}function Vce(e){Ze((()=>{if(!Cm)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}function Bce(e,t){return _r((()=>e.reduce(((e,r)=>{let{eventName:n,handler:a}=r;return e[n]=e=>{a(e,t)},e}),{})),[e,t])}function u5(e){return _r((()=>e?hce(e):null),[e])}const az=[];function Gce(e,t){void 0===t&&(t=gh);const[r]=e,n=u5(r?Us(r):null),[a,i]=yt(az);function o(){i((()=>e.length?e.map((e=>s5(e)?n:new Zk(t(e),e))):az))}const s=jm({callback:o});return Rc((()=>{null==s||s.disconnect(),o(),e.forEach((e=>null==s?void 0:s.observe(e)))}),[e]),a}function Xce(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ty(t)?t:e}function Hce(e){let{measure:t}=e;const[r,n]=yt(null),a=jm({callback:Qt((e=>{for(const{target:r}of e)if(ty(r)){n((e=>{const n=t(r);return e?{...e,width:n.width,height:n.height}:n}));break}}),[t])}),i=Qt((e=>{const r=Xce(e);null==a||a.disconnect(),r&&(null==a||a.observe(r)),n(r?t(r):null)}),[t,a]),[o,s]=rm(i);return _r((()=>({nodeRef:o,rect:r,setRef:s})),[r,o,s])}const Zce=[{sensor:Jk,options:{}},{sensor:Kk,options:{}}],Kce={current:{}},Fy={draggable:{measure:Y6},droppable:{measure:Y6,strategy:Xg.WhileDragging,frequency:Bw.Optimized},dragOverlay:{measure:gh}};class zg extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}const Yce={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zg,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fy,measureDroppableContainers:nm,windowRect:null,measuringScheduled:!1},Jce={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nm,draggableNodes:new Map,over:null,measureDroppableContainers:nm},Pm=Hg(Jce),f5=Hg(Yce);function Qce(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zg}}}function $ce(e,t){switch(t.type){case Qn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Qn.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Qn.DragEnd:case Qn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qn.RegisterDroppable:{const{element:r}=t,{id:n}=r,a=new zg(e.droppable.containers);return a.set(n,r),{...e,droppable:{...e.droppable,containers:a}}}case Qn.SetDroppableDisabled:{const{id:r,key:n,disabled:a}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new zg(e.droppable.containers);return o.set(r,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case Qn.UnregisterDroppable:{const{id:r,key:n}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new zg(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function ele(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:a}=Nd(Pm),i=qw(n),o=qw(null==r?void 0:r.id);return Ze((()=>{if(!t&&!n&&i&&null!=o){if(!Hk(i)||document.activeElement===i.target)return;const e=a.get(o);if(!e)return;const{activatorNode:t,node:r}=e;if(!t.current&&!r.current)return;requestAnimationFrame((()=>{for(const e of[t.current,r.current]){if(!e)continue;const t=Xoe(e);if(t){t.focus();break}}}))}}),[n,t,a,o,i]),null}function tle(e,t){let{transform:r,...n}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...n})),r):r}function rle(e){return _r((()=>({draggable:{...Fy.draggable,...null==e?void 0:e.draggable},droppable:{...Fy.droppable,...null==e?void 0:e.droppable},dragOverlay:{...Fy.dragOverlay,...null==e?void 0:e.dragOverlay}})),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}function nle(e){let{activeNode:t,measure:r,initialRect:n,config:a=!0}=e;const i=wt(!1),{x:o,y:s}="boolean"==typeof a?{x:a,y:a}:a;Rc((()=>{if(!o&&!s||!t)return void(i.current=!1);if(i.current||!n)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=t5(r(e),n);if(o||(a.x=0),s||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=r5(e);t&&t.scrollBy({top:a.y,left:a.x})}}),[t,o,s,n,r])}const d5=Hg({...No,scaleX:1,scaleY:1});var uf;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(uf||(uf={}));const ale=F5((function(e){var t,r,n,a;let{id:i,accessibility:o,autoScroll:s=!0,children:c,sensors:l=Zce,collisionDetection:u=oce,measuring:d,modifiers:f,...p}=e;const h=V5($ce,void 0,Qce),[y,g]=h,[m,v]=Qoe(),[_,k]=yt(uf.Uninitialized),b=_===uf.Initialized,{draggable:{active:w,nodes:x,translate:z},droppable:{containers:A}}=y,S=null!=w?x.get(w):null,j=wt({initial:null,translated:null}),C=_r((()=>{var e;return null!=w?{id:w,data:null!=(e=null==S?void 0:S.data)?e:Kce,rect:j}:null}),[w,S]),T=wt(null),[P,N]=yt(null),[L,E]=yt(null),M=Vg(p,Object.values(p)),O=ny("DndDescribedBy",i),D=_r((()=>A.getEnabled()),[A]),U=rle(d),{droppableRects:I,measureDroppableContainers:R,measuringScheduled:V}=Mce(D,{dragging:b,dependencies:[z.x,z.y],config:U.droppable}),F=Nce(x,w),W=_r((()=>L?Ww(L):null),[L]),q=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof s?!1===s.enabled:!1===s,r=b&&!e&&!t;return"object"==typeof s?{...s,enabled:r}:{enabled:r}}(),Z=Oce(F,U.draggable.measure);nle({activeNode:null!=w?x.get(w):null,config:q.layoutShiftCompensation,initialRect:Z,measure:U.draggable.measure});const X=tz(F,U.draggable.measure,Z),B=tz(F?F.parentElement:null),G=wt({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),H=A.getNodeFor(null==(t=G.current.over)?void 0:t.id),K=Hce({measure:U.dragOverlay.measure}),Y=null!=(r=K.nodeRef.current)?r:F,J=b?null!=(n=K.rect)?n:X:null,Q=!(!K.nodeRef.current||!K.rect),$=qce(Q?null:X),ee=u5(Y?Us(Y):null),te=Wce(b?H??F:null),re=Gce(te),ne=tle(f,{transform:{x:z.x-$.x,y:z.y-$.y,scaleX:1,scaleY:1},activatorEvent:L,active:C,activeNodeRect:X,containerNodeRect:B,draggingNodeRect:J,over:G.current.over,overlayNodeRect:K.rect,scrollableAncestors:te,scrollableAncestorRects:re,windowRect:ee}),ae=W?sh(W,z):null,ie=Fce(te),oe=nz(ie),se=nz(ie,[X]),ce=sh(ne,oe),le=J?uce(J,ne):null,ue=C&&le?u({active:C,collisionRect:le,droppableRects:I,droppableContainers:D,pointerCoordinates:ae}):null,de=e5(ue,"id"),[fe,pe]=yt(null),he=cce(Q?ne:sh(ne,se),null!=(a=null==fe?void 0:fe.rect)?a:null,X),ye=wt(null),ge=Qt(((e,t)=>{let{sensor:r,options:n}=t;if(null==T.current)return;const a=x.get(T.current);if(!a)return;const i=e.nativeEvent,o=new r({active:T.current,activeNode:a,event:i,options:n,context:G,onAbort(e){if(!x.get(e))return;const{onDragAbort:t}=M.current,r={id:e};null==t||t(r),m({type:"onDragAbort",event:r})},onPending(e,t,r,n){if(!x.get(e))return;const{onDragPending:a}=M.current,i={id:e,constraint:t,initialCoordinates:r,offset:n};null==a||a(i),m({type:"onDragPending",event:i})},onStart(e){const t=T.current;if(null==t)return;const r=x.get(t);if(!r)return;const{onDragStart:n}=M.current,a={activatorEvent:i,active:{id:t,data:r.data,rect:j}};th.unstable_batchedUpdates((()=>{null==n||n(a),k(uf.Initializing),g({type:Qn.DragStart,initialCoordinates:e,active:t}),m({type:"onDragStart",event:a}),N(ye.current),E(i)}))},onMove(e){g({type:Qn.DragMove,coordinates:e})},onEnd:s(Qn.DragEnd),onCancel:s(Qn.DragCancel)});function s(e){return async function(){const{active:t,collisions:r,over:n,scrollAdjustedTranslate:a}=G.current;let o=null;if(t&&a){const{cancelDrop:s}=M.current;o={activatorEvent:i,active:t,collisions:r,delta:a,over:n},e===Qn.DragEnd&&"function"==typeof s&&await Promise.resolve(s(o))&&(e=Qn.DragCancel)}T.current=null,th.unstable_batchedUpdates((()=>{g({type:e}),k(uf.Uninitialized),pe(null),N(null),E(null),ye.current=null;const t=e===Qn.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=M.current[t];null==e||e(o),m({type:t,event:o})}}))}}ye.current=o}),[x]),me=Ice(l,Qt(((e,t)=>(r,n)=>{const a=r.nativeEvent,i=x.get(n);if(null!==T.current||!i||a.dndKit||a.defaultPrevented)return;const o={active:i};!0===e(r,t.options,o)&&(a.dndKit={capturedBy:t.sensor},T.current=n,ge(r,t))}),[x,ge]));Vce(l),Rc((()=>{X&&_===uf.Initializing&&k(uf.Initialized)}),[X,_]),Ze((()=>{const{onDragMove:e}=M.current,{active:t,activatorEvent:r,collisions:n,over:a}=G.current;if(!t||!r)return;const i={active:t,activatorEvent:r,collisions:n,delta:{x:ce.x,y:ce.y},over:a};th.unstable_batchedUpdates((()=>{null==e||e(i),m({type:"onDragMove",event:i})}))}),[ce.x,ce.y]),Ze((()=>{const{active:e,activatorEvent:t,collisions:r,droppableContainers:n,scrollAdjustedTranslate:a}=G.current;if(!e||null==T.current||!t||!a)return;const{onDragOver:i}=M.current,o=n.get(de),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:s};th.unstable_batchedUpdates((()=>{pe(s),null==i||i(c),m({type:"onDragOver",event:c})}))}),[de]),Rc((()=>{G.current={activatorEvent:L,active:C,activeNode:F,collisionRect:le,collisions:ue,droppableRects:I,draggableNodes:x,draggingNode:Y,draggingNodeRect:J,droppableContainers:A,over:fe,scrollableAncestors:te,scrollAdjustedTranslate:ce},j.current={initial:J,translated:le}}),[C,F,ue,le,x,Y,J,I,A,fe,te,ce]),Rce({...q,delta:z,draggingRect:le,pointerCoordinates:ae,scrollableAncestors:te,scrollableAncestorRects:re});const ve=_r((()=>({active:C,activeNode:F,activeNodeRect:X,activatorEvent:L,collisions:ue,containerNodeRect:B,dragOverlay:K,draggableNodes:x,droppableContainers:A,droppableRects:I,over:fe,measureDroppableContainers:R,scrollableAncestors:te,scrollableAncestorRects:re,measuringConfiguration:U,measuringScheduled:V,windowRect:ee})),[C,F,X,L,ue,B,K,x,A,I,fe,R,te,re,U,V,ee]),_e=_r((()=>({activatorEvent:L,activators:me,active:C,activeNodeRect:X,ariaDescribedById:{draggable:O},dispatch:g,draggableNodes:x,over:fe,measureDroppableContainers:R})),[L,me,C,X,g,O,x,fe,R]);return $n.createElement(J4.Provider,{value:v},$n.createElement(Pm.Provider,{value:_e},$n.createElement(f5.Provider,{value:ve},$n.createElement(d5.Provider,{value:he},c)),$n.createElement(ele,{disabled:!1===(null==o?void 0:o.restoreFocus)})),$n.createElement(tce,{...o,hiddenTextDescribedById:O}))})),sle=Hg(null),sz="button",ile="Draggable";function ole(e){let{id:t,data:r,disabled:n=!1,attributes:a}=e;const i=ny(ile),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=Nd(Pm),{role:p=sz,roleDescription:h="draggable",tabIndex:y=0}=a??{},g=(null==c?void 0:c.id)===t,m=Nd(g?d5:sle),[v,_]=rm(),[k,b]=rm(),w=Bce(o,t),x=Vg(r);Rc((()=>(d.set(t,{id:t,key:i,node:v,activatorNode:k,data:x}),()=>{const e=d.get(t);e&&e.key===i&&d.delete(t)})),[d,t]);return{active:c,activatorEvent:s,activeNodeRect:l,attributes:_r((()=>({role:p,tabIndex:y,"aria-disabled":n,"aria-pressed":!(!g||p!==sz)||void 0,"aria-roledescription":h,"aria-describedby":u.draggable})),[n,p,y,g,h,u.draggable]),isDragging:g,listeners:n?void 0:w,node:v,over:f,setNodeRef:_,setActivatorNodeRef:b,transform:m}}function cle(){return Nd(f5)}const lle="Droppable",ule={timeout:25};function fle(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:a}=e;const i=ny(lle),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=Nd(Pm),u=wt({disabled:r}),d=wt(!1),f=wt(null),p=wt(null),{disabled:h,updateMeasurementsFor:y,timeout:g}={...ule,...a},m=Vg(y??n),v=jm({callback:Qt((()=>{d.current?(null!=p.current&&clearTimeout(p.current),p.current=setTimeout((()=>{l(Array.isArray(m.current)?m.current:[m.current]),p.current=null}),g)):d.current=!0}),[g]),disabled:h||!o}),_=Qt(((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))}),[v]),[k,b]=rm(_),w=Vg(t);return Ze((()=>{!v||!k.current||(v.disconnect(),d.current=!1,v.observe(k.current))}),[k,v]),Ze((()=>(s({type:Qn.RegisterDroppable,element:{id:n,key:i,disabled:r,node:k,rect:f,data:w}}),()=>s({type:Qn.UnregisterDroppable,key:i,id:n}))),[n]),Ze((()=>{r!==u.current.disabled&&(s({type:Qn.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)}),[n,i,r,s]),{active:o,rect:f,isOver:(null==c?void 0:c.id)===n,node:k,over:c,setNodeRef:b}}function p5(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function dle(e,t){return e.reduce(((e,r,n)=>{const a=t.get(r);return a&&(e[n]=a),e}),Array(e.length))}function My(e){return null!==e&&e>=0}function ple(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function hle(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}const h5=e=>{let{rects:t,activeIndex:r,overIndex:n,index:a}=e;const i=p5(t,n,r),o=t[a],s=i[a];return s&&o?{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}:null},Oy={scaleX:1,scaleY:1},gle=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:a,rects:i,overIndex:o}=e;const s=null!=(t=i[r])?t:n;if(!s)return null;if(a===r){const e=i[o];return e?{x:0,y:r<o?e.top+e.height-(s.top+s.height):e.top-s.top,...Oy}:null}const c=yle(i,a,r);return a>r&&a<=o?{x:0,y:-s.height-c,...Oy}:a<r&&a>=o?{x:0,y:s.height+c,...Oy}:{x:0,y:0,...Oy}};function yle(e,t,r){const n=e[t],a=e[t-1],i=e[t+1];return n?r<t?a?n.top-(a.top+a.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):a?n.top-(a.top+a.height):0:0}const g5="Sortable",y5=$n.createContext({activeIndex:-1,containerId:g5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:h5,disabled:{draggable:!1,droppable:!1}});function mle(e){let{children:t,id:r,items:n,strategy:a=h5,disabled:i=!1}=e;const{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=cle(),d=ny(g5,r),f=null!==s.rect,p=_r((()=>n.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[n]),h=null!=o,y=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,m=wt(p),v=!ple(p,m.current),_=-1!==g&&-1===y||v,k=hle(i);Rc((()=>{v&&h&&u(p)}),[v,p,h,u]),Ze((()=>{m.current=p}),[p]);const b=_r((()=>({activeIndex:y,containerId:d,disabled:k,disableTransforms:_,items:p,overIndex:g,useDragOverlay:f,sortedRects:dle(p,c),strategy:a})),[y,d,k.draggable,k.droppable,_,p,g,c,f,a]);return $n.createElement(y5.Provider,{value:b},t)}const _le=e=>{let{id:t,items:r,activeIndex:n,overIndex:a}=e;return p5(r,n,a).indexOf(t)},vle=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:a,items:i,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!(!l||!n||s!==i&&a===o)&&(!!r||o!==a&&t===c)},wle={duration:200,easing:"ease"},m5="transform",kle=Gg.Transition.toString({property:m5,duration:0,easing:"linear"}),ble={roleDescription:"sortable"};function xle(e){let{disabled:t,index:r,node:n,rect:a}=e;const[i,o]=yt(null),s=wt(r);return Rc((()=>{if(!t&&r!==s.current&&n.current){const e=a.current;if(e){const t=gh(n.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&o(r)}}r!==s.current&&(s.current=r)}),[t,r,n,a]),Ze((()=>{i&&o(null)}),[i]),i}function Ale(e){let{animateLayoutChanges:t=vle,attributes:r,disabled:n,data:a,getNewIndex:i=_le,id:o,strategy:s,resizeObserverConfig:c,transition:l=wle}=e;const{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:y,overIndex:g,useDragOverlay:m,strategy:v}=Nd(y5),_=zle(n,p),k=u.indexOf(o),b=_r((()=>({sortable:{containerId:d,index:k,items:u},...a})),[d,a,k,u]),w=_r((()=>u.slice(u.indexOf(o))),[u,o]),{rect:x,node:z,isOver:A,setNodeRef:S}=fle({id:o,data:b,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...c}}),{active:j,activatorEvent:C,activeNodeRect:T,attributes:P,setNodeRef:N,listeners:L,isDragging:E,over:M,setActivatorNodeRef:O,transform:D}=ole({id:o,data:b,attributes:{...ble,...r},disabled:_.draggable}),U=Foe(S,N),I=!!j,R=I&&!h&&My(f)&&My(g),V=!m&&E,F=R?(V&&R?D:null)??(s??v)({rects:y,activeNodeRect:T,activeIndex:f,overIndex:g,index:k}):null,W=My(f)&&My(g)?i({id:o,items:u,activeIndex:f,overIndex:g}):k,q=null==j?void 0:j.id,Z=wt({activeId:q,items:u,newIndex:W,containerId:d}),X=u!==Z.current.items,B=t({active:j,containerId:d,isDragging:E,isSorting:I,id:o,index:k,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:l,wasDragging:null!=Z.current.activeId}),G=xle({disabled:!B,index:k,node:z,rect:x});return Ze((()=>{I&&Z.current.newIndex!==W&&(Z.current.newIndex=W),d!==Z.current.containerId&&(Z.current.containerId=d),u!==Z.current.items&&(Z.current.items=u)}),[I,W,d,u]),Ze((()=>{if(q===Z.current.activeId)return;if(null!=q&&null==Z.current.activeId)return void(Z.current.activeId=q);const e=setTimeout((()=>{Z.current.activeId=q}),50);return()=>clearTimeout(e)}),[q]),{active:j,activeIndex:f,attributes:P,data:b,rect:x,index:k,newIndex:W,items:u,isOver:A,isSorting:I,isDragging:E,listeners:L,node:z,overIndex:g,over:M,setNodeRef:U,setActivatorNodeRef:O,setDroppableNodeRef:S,setDraggableNodeRef:N,transform:G??F,transition:function(){if(G||X&&Z.current.newIndex===k)return kle;if((!V||Hk(C))&&l&&(I||B))return Gg.Transition.toString({...l,property:m5})}()}}function zle(e,t){var r,n;return"boolean"==typeof e?{draggable:e,droppable:!1}:{draggable:null!=(r=null==e?void 0:e.draggable)?r:t.draggable,droppable:null!=(n=null==e?void 0:e.droppable)?n:t.droppable}}function sm(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Sle=[Mt.Down,Mt.Right,Mt.Up,Mt.Left],Cle=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:a,droppableContainers:i,over:o,scrollableAncestors:s}}=t;if(Sle.includes(e.code)){if(e.preventDefault(),!r||!n)return;const t=[];i.getEnabled().forEach((r=>{if(!r||null!=r&&r.disabled)return;const i=a.get(r.id);if(i)switch(e.code){case Mt.Down:n.top<i.top&&t.push(r);break;case Mt.Up:n.top>i.top&&t.push(r);break;case Mt.Left:n.left>i.left&&t.push(r);break;case Mt.Right:n.left<i.left&&t.push(r)}}));const c=sce({active:r,collisionRect:n,droppableRects:a,droppableContainers:t,pointerCoordinates:null});let l=e5(c,"id");if(l===(null==o?void 0:o.id)&&c.length>1&&(l=c[1].id),null!=l){const e=i.get(r.id),t=i.get(l),o=t?a.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&o&&e&&t){const r=Tm(c).some(((e,t)=>s[t]!==e)),a=_5(e,t),i=Tle(e,t),l=r||!a?{x:0,y:0}:{x:i?n.width-o.width:0,y:i?n.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Bg(u,l)}}}};function _5(e,t){return!(!sm(e)||!sm(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Tle(e,t){return!!(sm(e)&&sm(t)&&_5(e,t))&&e.data.current.sortable.index<t.data.current.sortable.index}const jle=({id:e,title:t,description:r,onEditClick:n,onEditSubmit:a,onDelete:i,isReorder:o=!1})=>{const[s,c,l]=Sm(!1),{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:h,isDragging:y}=Ale({id:e||"",disabled:!o}),g=o?{transform:Gg.Translate.toString(p),transition:h}:void 0;return t||r?S.jsxs(S.Fragment,{children:[S.jsx(Z4,{open:s,defaultValues:{label:t,content:r},onSubmit:a,onCloseModal:l}),S.jsxs("div",{ref:o?f:void 0,style:g,className:ct("mb-s flex w-full items-center justify-between gap-m rounded-lg p-s outline outline-1 outline-gray-300",o&&"cursor-grab",y&&"relative z-10 cursor-grabbing border-2 border-blue_100 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.1)]"),...o?{...u,...d}:{},children:[S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx(H4,{title:t,description:r,isDragging:y,dragHandle:o?S.jsx("div",{className:"text-gray-400",children:S.jsx(Noe,{size:20})}):void 0})}),S.jsxs("div",{className:"flex items-center gap-xs",onPointerDown:e=>e.stopPropagation(),children:[S.jsx(gn,{variant:"secondary",size:"s",onClick:e=>{e.preventDefault(),a?c():null==n||n()},disabled:y,children:"Edit"}),i&&S.jsx(gn,{variant:"secondary_danger",size:"icon_s",onClick:i,className:"rounded-s",disabled:y,children:S.jsx(Moe,{size:16})})]})]})]}):null},Ple=({title:e,description:t})=>S.jsxs("div",{className:"mb-m",children:[S.jsx("p",{className:"mb-xxxs text-base font-semibold text-gray-900",children:e}),S.jsx("span",{className:"text-gray-500",children:t})]}),Rle=({form:e,customFields:t,onFieldRemove:r,title:n="Spotlights",description:a="Optional info or links to display on your profile",wrapperClassName:i="my-lg",showHeading:o=!0,children:s})=>{const c=rce(H6(Jk),H6(Kk,{coordinateGetter:Cle}));return S.jsxs("div",{className:i,children:[o&&S.jsx(Ple,{title:n,description:a}),S.jsxs("div",{"data-testid":"customFields",children:[S.jsx(ale,{sensors:c,collisionDetection:ace,onDragEnd:e=>{const{active:r,over:n}=e;if(n&&r.id!==n.id){const e=t.fields.findIndex((e=>e.id===r.id)),a=t.fields.findIndex((e=>e.id===n.id));-1!==e&&-1!==a&&t.move(e,a)}},children:S.jsx(mle,{items:t.fields.map((e=>e.id)),strategy:gle,children:t.fields.map(((n,a)=>{const i=`customFields.${a}.label`,o=`customFields.${a}.content`;return S.jsx(jle,{id:n.id,isReorder:!0,title:e.getValues(i),description:e.getValues(o),onEditSubmit:e=>{t.update(a,e)},onDelete:()=>{t.remove(a),null==r||r()}},n.id)}))})}),s]})]})},Lle=({onAdd:e})=>{const[t,r,n]=Sm(!1);return S.jsxs(S.Fragment,{children:[S.jsx(Z4,{open:t,onSubmit:t=>{e(t),n()},onCloseModal:n}),S.jsxs(gn,{type:"button",variant:"secondary",onClick:e=>{e.stopPropagation(),r()},className:"w-full text-base",children:[S.jsx(Ioe,{size:18,className:"ml-1 hidden md:block",strokeWidth:2}),"Add"]})]})},ay="geo",v5=j8("user"),Ele=()=>"geolocation"in navigator,Nle=({onSuccess:e,onError:t})=>Ele()?navigator.geolocation.getCurrentPosition(e,t):(rn.error("Geolocation is not supported in your browser"),null),w5=()=>{try{const e=v5.getItem(ay);return e?JSON.parse(e):null}catch{return rn.error("Can not get cached geo from localstorage"),null}},k5=e=>{if(!e)return pi.debug(`${ay}: can not get stored geo, userId is missing`),null;const t=w5();return null==t?void 0:t[e]},Ile=e=>!1,b5=(e,t)=>{var r;const n=w5();v5.setItem(ay,JSON.stringify({...n,[e]:{...null==n?void 0:n[e],...t,date:Ile()?null==(r=null==n?void 0:n[e])?void 0:r.date:new Date}}))},x5=(e,t)=>{if(!t)return pi.debug(`${ay}: can not save geo to store, userId is missing`);b5(t,{geo:e})},A5=(e,t)=>{if(!t)return pi.debug(`${ay}: can not save tz to store, userId is missing`);b5(t,{tz:e})},Mle=()=>{const[e]=d8.useLazyGetApiV1UsersRenameHistoryQuery();return async(t,r)=>{var n;if(t===r)return!0;const a=await e().unwrap();return((null==(n=null==a?void 0:a.history)?void 0:n.length)||0)<((null==a?void 0:a.maxRenames)||0)}},Ole=e=>{if(!e)return null;const t=e.getTime();if(Number.isNaN(t))return null;const r=new Date;if(e>r)return null;let n=r.getFullYear()-e.getFullYear();const a=r.getMonth()-e.getMonth();return(a<0||0===a&&r.getDate()<e.getDate())&&n--,n},mw=({tz:e,options:t,seekedValue:r})=>{const n=t.find((t=>t.value===e||t.key===e));return null==n?void 0:n[r]},Dy=e=>null!=e&&e.length?(e||[]).map(((e,t)=>({id:t.toString(),label:e}))):[{id:"1",label:""}],Dle=({user:e,tzList:t,avatarId:r,headerId:n,onSubmit:a,onDirtyChange:i,userNameError:o})=>{var s,c,l,u,d,f,p,h,y,g,m,v;const{Pronouns:_,userFields:k}=Gie({user:e}),b=null!=(s=e.birthday)&&s.date?new Date(e.birthday.date):null,w=(()=>{var t,r;try{const n=null==(r=null==(t=e.fields)?void 0:t.BotProfile)?void 0:r.value;if(!n)return null;const a=JSON.parse(n);return a&&"object"==typeof a&&null!==a?a:null}catch{return null}})();Ze((()=>{o&&z.setError("userName",{message:o})}),[o]);const x={Pronouns:_,avatarId:r,headerId:n,channel:e.channel||!1,actorType:e.actorType||"Person",summary:e.summary,userName:e.username,displayName:Ow(e.displayName),customFields:qie(k),location:{geo:null==(c=e.location)?void 0:c.geo,name:(null==(l=e.location)?void 0:l.name)||"",show:!(null==(u=e.location)||!u.show),autoUpdate:!(null==(d=e.location)||!d.autoUpdate)},timezone:{show:!(null==(f=e.timezone)||!f.show),ianaTimezone:mw({options:t,tz:(null==(p=e.timezone)?void 0:p.ianaTimezone)||"",seekedValue:"key"}),autoUpdate:!(null==(h=e.timezone)||!h.autoUpdate)},birthday:{show:"NONE"!==(null==(y=e.birthday)?void 0:y.show),dateOnly:"DATE"===(null==(g=e.birthday)?void 0:g.show),date:b},botProfile:{role:(null==w?void 0:w.role)||"",triggers:Dy(null==w?void 0:w.triggers),personality_traits:Dy(null==w?void 0:w.personality_traits),tone:(null==w?void 0:w.tone)||"",style:Dy(null==w?void 0:w.style),behaviors:Dy(null==w?void 0:w.behaviors),prompt:(null==w?void 0:w.prompt)||""},canSubmit:!0},z=$w({defaultValues:x,schema:yS()}),A=cg({control:z.control,name:"customFields"}),S=cg({control:z.control,name:"botProfile.triggers"}),j=cg({control:z.control,name:"botProfile.personality_traits"}),C=cg({control:z.control,name:"botProfile.style"}),T=cg({control:z.control,name:"botProfile.behaviors"});Ze((()=>{z.reset(x)}),[e.id]),Ze((()=>{null==i||i(z.formState.isDirty)}),[z.formState.isDirty]),Ze((()=>{var t;const r=null==(t=e.location)?void 0:t.name;r&&z.setValue("location.name",r)}),[null==(m=e.location)?void 0:m.name]),Ze((()=>{var r;const n=null==(r=e.timezone)?void 0:r.ianaTimezone;n&&z.setValue("timezone.ianaTimezone",mw({options:t,tz:n,seekedValue:"key"}))}),[null==(v=e.timezone)?void 0:v.ianaTimezone]);const P=()=>{var r,n,i,o,s;const{displayName:c,userName:l,summary:u="",Pronouns:d="",customFields:f,timezone:p,birthday:h,location:y,avatarId:g,headerId:m,channel:v,actorType:_,botProfile:k}=z.getValues(),b={...y,geo:y.autoUpdate&&y.geo?y.geo:null},w={username:l.trim(),displayName:Ow(c),summary:u,timezone:{...p,ianaTimezone:mw({options:t,tz:p.ianaTimezone||"",seekedValue:"value"})||""},avatarId:g,headerId:m,channel:v,actorType:_,birthday:{date:null==(r=h.date)?void 0:r.toISOString(),show:h.show?h.dateOnly?"DATE":"FULL":"NONE"},location:b,fields:{Pronouns:{value:d},...Oie(f),...k&&"Service"===_&&{BotProfile:{value:JSON.stringify({name:l,location:b.name,bio:u,age:Ole(h.date||null),role:null==k?void 0:k.role,triggers:null==(n=null==k?void 0:k.triggers)?void 0:n.map((e=>e.label)).filter(Boolean),personality_traits:null==(i=null==k?void 0:k.personality_traits)?void 0:i.map((e=>e.label)).filter(Boolean),tone:null==k?void 0:k.tone,style:null==(o=null==k?void 0:k.style)?void 0:o.map((e=>e.label)).filter(Boolean),behaviors:null==(s=null==k?void 0:k.behaviors)?void 0:s.map((e=>e.label)).filter(Boolean),prompt:null==k?void 0:k.prompt})}}}};y.autoUpdate&&y.geo&&x5(y.geo,e.id),p.autoUpdate&&p.ianaTimezone&&A5(p.ianaTimezone,e.id),a(w);const x=z.getValues();z.reset({...x,displayName:w.displayName})},N=Mle();return[z,async()=>{await N(z.getValues().userName,x.userName)?z.handleSubmit(P)():rn.error("You have reached the maximum number of username changes allowed")},({shouldDirty:e=!0,...t})=>{null!=t&&t.avatar&&z.setValue("avatarId",t.avatar.uploadId,{shouldDirty:e}),null!=t&&t.header&&z.setValue("headerId",t.header.uploadId,{shouldDirty:e})},A,S,j,C,T]};var iz,Vy={exports:{}},Ule=Vy.exports;function qle(){return iz||(iz=1,Vy.exports=function(e,t,r){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=r();return this.format(e)===t.format(e)}}),Vy.exports}var Wle=qle();const z5=Ud(Wle),Fle=e=>{const t=new Set;return null==e?void 0:e.filter((e=>!t.has(e.value)&&(t.add(e.value),!0)))},S5=()=>{const{data:e}=U5(),t=null==e?void 0:e.map((e=>{const t=e.utc.find((e=>!e.startsWith("Etc/")));if(t)return{key:e.text,value:t}})).filter(Boolean);return Fle(t)};Ol.extend(z5);const Vle=()=>{var e;const t=mt(pa.selectors.selectUser),r=null==t?void 0:t.id,n=k5(r),a=S5(),i=h8(),o=e=>{var t;const r=(new Date).getTimezoneOffset(),n=`UTC${r>0?"-":"+"}${Math.abs(Math.floor(r/60)).toString().padStart(2,"0")}:${Math.abs(r%60).toString().padStart(2,"0")}`,i=null==(t=null==a?void 0:a.find((e=>e.key.includes(n))))?void 0:t.value;return i||pi.warn(`Can not not find matched tz in list ${JSON.stringify(a)} for ${n}`),null==e||e(i),i},s=e=>{var n,a;if(!t||!e)return;const{username:o,displayName:s,summary:c,fields:l}=t,u=t;i({userId:t.id,data:{username:o,displayName:s,fields:l,summary:c,avatarId:(null==(n=t.avatar)?void 0:n.uploadId)||null,headerId:(null==(a=t.header)?void 0:a.uploadId)||null,channel:u.channel||!1,actorType:u.actorType||null,location:t.location||null,birthday:t.birthday||null,timezone:{...t.timezone,ianaTimezone:e}}}),A5(e,r)};return Ze((()=>{var e;const r=!(null!=n&&n.date&&Ol(n.date).isToday()),a=(null==(e=null==t?void 0:t.timezone)?void 0:e.autoUpdate)&&(r||!(null!=n&&n.tz));a&&pi.debug("Update tz:",{storedGeo:n},{isOutdated:r}),a&&o(s)}),[null==(e=null==t?void 0:t.timezone)?void 0:e.autoUpdate,null==n?void 0:n.date]),{options:a,getUserTz:o}};function Gw(e,t,r=window){const n=wt(t);Ze((()=>{n.current=t}),[t]),Ze((()=>{if(!r)return;const t=e=>n.current(e);return r.addEventListener(e,t),()=>{r.removeEventListener(e,t)}}),[e,r])}const Ble=(e,t)=>{const r=wt(t);Ze((()=>{r.current=t}),[t]);Gw(null!==document.ontouchstart?"mousedown":"touchstart",(({target:t})=>{!e.current||e.current.contains(t)||r.current(t)}),document.body)},Gle=44,Xle=60,Hle=300,C5=({form:e,icon:t,name:r,list:n,canInput:a=!0,displayName:i,maxChars:o,currentValue:s,renderChildren:c,onFieldChange:l,disabled:u,debounceMs:d=300,minLength:f=2,inputClassName:p,itemClassName:h,testId:y})=>{const[g,m]=yt(""),[v,_]=yt(!1);Ze((()=>{const e=setTimeout((()=>{const e=g.trim();e.length>=f&&l(e)}),d);return()=>clearTimeout(e)}),[g,d,f,l]);const k=(n&&n.length>0||!!c)&&v&&!u,b=wt(null);return Ble(b,(()=>_(!1))),S.jsxs("div",{ref:b,"data-testid":y,onMouseDown:()=>{u||_(!0)},children:[S.jsx(Wn,{control:e.control,icon:t,name:r,displayName:i,maxChars:o,onFieldChange:e=>m(String(e)),onFocus:()=>_(!0),className:"mb-s md:mb-xxs w-full",inputClassName:p,disabled:u,readOnly:u||!a}),k&&S.jsxs("ul",{className:"p-xxs absolute left-0 top-[calc(100%+8px)] z-[1] w-full overflow-scroll rounded-lg border border-gray-200 bg-white shadow-[0px_0px_12px_0px_rgba(0,0,0,0.08)]",style:{height:Math.min(((null==n?void 0:n.length)||1)*(1===((null==n?void 0:n.length)||0)?60:44),300)},children:[S.jsx(oz,{className:h,children:null==c?void 0:c((()=>_(!1)))}),null==n?void 0:n.map((t=>S.jsx(oz,{onClick:()=>{e.setValue(r,t.key,{shouldDirty:!0}),_(!1)},isChecked:s===t.key,className:h,children:t.label},t.key)))]})]})},oz=({isChecked:e,onClick:t,children:r,className:n})=>S.jsxs("li",{onClick:t,className:ct("p-xxs my-xxxs rounded-m flex cursor-pointer items-center justify-between text-base font-medium text-gray-900 first:mt-0 last:mb-0 empty:hidden hover:bg-gray-100",n),children:[r,e&&S.jsx(C7,{size:20})]}),cz=[{key:"public",label:"Public",icon:S.jsx(HC,{}),description:"Visible to everyone"},{key:"private",label:"Private",icon:S.jsx(YC,{}),description:"Only you can see"}],Qk=({isPublic:e,children:t,onChange:r})=>{const n=e?"public":"private",a=cz.find((e=>e.key===n));return S.jsx("div",{className:"right-xxs top-xl absolute",children:S.jsxs(lm,{children:[S.jsx(um,{asChild:!0,children:S.jsxs(gn,{variant:"secondary",size:"s",className:"gap-xxxs p-xxs flex [&>svg]:size-4",children:[null==a?void 0:a.icon,null==a?void 0:a.label,S.jsx(GC,{})]})}),S.jsxs(fm,{align:"end",alignOffset:-10,sideOffset:15,className:"w-[300px]",children:[cz.map((e=>S.jsxs(By,{className:"p-xxs [&_svg]:size-xxs flex cursor-pointer items-center justify-between",onClick:()=>r(e.key),children:[S.jsxs("div",{className:"gap-xxs flex items-start",children:[e.icon,S.jsxs("div",{children:[S.jsx("div",{className:"mb-xxxs font-medium text-gray-900",children:e.label}),S.jsx("div",{className:"font-normal text-gray-500",children:e.description})]})]}),e.key===n&&S.jsx(M8,{})]},e.key))),t&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"my-xxs -ml-xxs h-[1px] w-[calc(100%+16px)] bg-gray-200"}),S.jsx(By,{children:t})]})]})]})})},Zle=({form:e})=>{const{options:t,getUserTz:r}=Vle(),n=t=>{e.setValue("timezone.ianaTimezone",t,{shouldDirty:!0})},a=!!e.watch("timezone.ianaTimezone");return t?S.jsxs("div",{className:"relative my-5","data-testid":"tz",children:[S.jsx(C5,{form:e,name:"timezone.ianaTimezone",displayName:"Timezone",maxChars:Cc.timezone,onFieldChange:n,list:t.map((e=>({key:e.key,label:e.key}))),canInput:!1,icon:S.jsx(D8,{}),disabled:!!e.watch("timezone.autoUpdate"),inputClassName:"pr-[120px]",currentValue:e.watch("timezone.ianaTimezone"),itemClassName:"first:hover:bg-inherit"}),a&&S.jsx(Qk,{isPublic:e.watch("timezone.show"),onChange:t=>{e.setValue("timezone.show","public"===t,{shouldDirty:!0})}}),S.jsx(Wn,{isSwitch:!0,name:"timezone.autoUpdate",control:e.control,onFieldChange:()=>{const e=r();e&&n(e)},displayName:"Set timezone automatically",className:"mb-xs mt-xxs md:mb-0"})]}):null};function im(e){return(im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Od(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ys(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Ec(e){ys(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===im(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):(("string"==typeof e||"[object String]"===t)&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function Kle(e,t){ys(2,arguments);var r=Ec(e).getTime(),n=Od(t);return new Date(r+n)}var Yle={};function Rm(){return Yle}function Jle(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Qle(e){return ys(1,arguments),e instanceof Date||"object"===im(e)&&"[object Date]"===Object.prototype.toString.call(e)}function $le(e){if(ys(1,arguments),!Qle(e)&&"number"!=typeof e)return!1;var t=Ec(e);return!isNaN(Number(t))}function eue(e,t){return ys(2,arguments),Kle(e,-Od(t))}var tue=864e5;function rue(e){ys(1,arguments);var t=Ec(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=r-t.getTime();return Math.floor(n/tue)+1}function om(e){ys(1,arguments);var t=Ec(e),r=t.getUTCDay(),n=(r<1?7:0)+r-1;return t.setUTCDate(t.getUTCDate()-n),t.setUTCHours(0,0,0,0),t}function T5(e){ys(1,arguments);var t=Ec(e),r=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var a=om(n),i=new Date(0);i.setUTCFullYear(r,0,4),i.setUTCHours(0,0,0,0);var o=om(i);return t.getTime()>=a.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function nue(e){ys(1,arguments);var t=T5(e),r=new Date(0);return r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0),om(r)}var aue=6048e5;function sue(e){ys(1,arguments);var t=Ec(e),r=om(t).getTime()-nue(t).getTime();return Math.round(r/aue)+1}function cm(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Rm(),d=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==a?a:u.weekStartsOn)&&void 0!==n?n:null===(c=u.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==r?r:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ec(e),p=f.getUTCDay(),h=(p<d?7:0)+p-d;return f.setUTCDate(f.getUTCDate()-h),f.setUTCHours(0,0,0,0),f}function j5(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Ec(e),d=u.getUTCFullYear(),f=Rm(),p=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==a?a:f.firstWeekContainsDate)&&void 0!==n?n:null===(c=f.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==r?r:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,p),h.setUTCHours(0,0,0,0);var y=cm(h,t),g=new Date(0);g.setUTCFullYear(d,0,p),g.setUTCHours(0,0,0,0);var m=cm(g,t);return u.getTime()>=y.getTime()?d+1:u.getTime()>=m.getTime()?d:d-1}function iue(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Rm(),d=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==a?a:u.firstWeekContainsDate)&&void 0!==n?n:null===(c=u.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==r?r:1),f=j5(e,t),p=new Date(0);return p.setUTCFullYear(f,0,d),p.setUTCHours(0,0,0,0),cm(p,t)}var oue=6048e5;function cue(e,t){ys(1,arguments);var r=Ec(e),n=cm(r,t).getTime()-iue(r,t).getTime();return Math.round(n/oue)+1}function gr(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return r+n}var lf={y:function(e,t){var r=e.getUTCFullYear(),n=r>0?r:1-r;return gr("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):gr(r+1,2)},d:function(e,t){return gr(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return gr(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gr(e.getUTCHours(),t.length)},m:function(e,t){return gr(e.getUTCMinutes(),t.length)},s:function(e,t){return gr(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return gr(Math.floor(n*Math.pow(10,r-3)),t.length)}},Qp={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},lue={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return lf.y(e,t)},Y:function(e,t,r,n){var a=j5(e,n),i=a>0?a:1-a;return"YY"===t?gr(i%100,2):"Yo"===t?r.ordinalNumber(i,{unit:"year"}):gr(i,t.length)},R:function(e,t){return gr(T5(e),t.length)},u:function(e,t){return gr(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return gr(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return gr(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return lf.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return gr(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var a=cue(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):gr(a,t.length)},I:function(e,t,r){var n=sue(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):gr(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):lf.d(e,t)},D:function(e,t,r){var n=rue(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):gr(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var a=e.getUTCDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return gr(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var a=e.getUTCDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return gr(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return gr(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,a=e.getUTCHours();switch(n=12===a?Qp.noon:0===a?Qp.midnight:a/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,a=e.getUTCHours();switch(n=a>=17?Qp.evening:a>=12?Qp.afternoon:a>=4?Qp.morning:Qp.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return lf.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):lf.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):gr(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):gr(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):lf.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):lf.s(e,t)},S:function(e,t){return lf.S(e,t)},X:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return uz(a);case"XXXX":case"XX":return Pd(a);default:return Pd(a,":")}},x:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return uz(a);case"xxxx":case"xx":return Pd(a);default:return Pd(a,":")}},O:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+lz(a,":");default:return"GMT"+Pd(a,":")}},z:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+lz(a,":");default:return"GMT"+Pd(a,":")}},t:function(e,t,r,n){var a=n._originalDate||e;return gr(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,r,n){return gr((n._originalDate||e).getTime(),t.length)}};function lz(e,t){var r=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(0===i)return r+String(a);var o=t;return r+String(a)+o+gr(i,2)}function uz(e,t){return e%60==0?(e>0?"-":"+")+gr(Math.abs(e)/60,2):Pd(e,t)}function Pd(e,t){var r=t||"",n=e>0?"-":"+",a=Math.abs(e);return n+gr(Math.floor(a/60),2)+r+gr(a%60,2)}var fz=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},P5=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},uue=function(e,t){var r,n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return fz(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",fz(a,t)).replace("{{time}}",P5(i,t))},fue={p:P5,P:uue},due=["D","DD"],pue=["YY","YYYY"];function hue(e){return-1!==due.indexOf(e)}function gue(e){return-1!==pue.indexOf(e)}function dz(e,t,r){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var yue={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},mue=function(e,t,r){var n,a=yue[e];return n="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function _w(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var _ue={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vue={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},wue={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kue={date:_w({formats:_ue,defaultWidth:"full"}),time:_w({formats:vue,defaultWidth:"full"}),dateTime:_w({formats:wue,defaultWidth:"full"})},bue={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},xue=function(e,t,r,n){return bue[e]};function dg(e){return function(t,r){var n;if("formatting"===(null!=r&&r.context?String(r.context):"standalone")&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,i=null!=r&&r.width?String(r.width):a;n=e.formattingValues[i]||e.formattingValues[a]}else{var o=e.defaultWidth,s=null!=r&&r.width?String(r.width):e.defaultWidth;n=e.values[s]||e.values[o]}return n[e.argumentCallback?e.argumentCallback(t):t]}}var Aue={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Sue={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Cue={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Tue={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},jue={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Pue=function(e,t){var r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Rue={ordinalNumber:Pue,era:dg({values:Aue,defaultWidth:"wide"}),quarter:dg({values:zue,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:dg({values:Sue,defaultWidth:"wide"}),day:dg({values:Cue,defaultWidth:"wide"}),dayPeriod:dg({values:Tue,defaultWidth:"wide",formattingValues:jue,defaultFormattingWidth:"wide"})};function pg(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;var o,s=i[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(c)?Eue(c,(function(e){return e.test(s)})):Lue(c,(function(e){return e.test(s)}));return o=e.valueCallback?e.valueCallback(l):l,{value:o=r.valueCallback?r.valueCallback(o):o,rest:t.slice(s.length)}}}function Lue(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function Eue(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return r}function Nue(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(e.matchPattern);if(!n)return null;var a=n[0],i=t.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:o=r.valueCallback?r.valueCallback(o):o,rest:t.slice(a.length)}}}var Iue=/^(\d+)(th|st|nd|rd)?/i,Mue=/\d+/i,Oue={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Due={any:[/^b/i,/^(a|c)/i]},Uue={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},que={any:[/1/i,/2/i,/3/i,/4/i]},Wue={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Fue={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Vue={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Bue={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Gue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Xue={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Hue={ordinalNumber:Nue({matchPattern:Iue,parsePattern:Mue,valueCallback:function(e){return parseInt(e,10)}}),era:pg({matchPatterns:Oue,defaultMatchWidth:"wide",parsePatterns:Due,defaultParseWidth:"any"}),quarter:pg({matchPatterns:Uue,defaultMatchWidth:"wide",parsePatterns:que,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:pg({matchPatterns:Wue,defaultMatchWidth:"wide",parsePatterns:Fue,defaultParseWidth:"any"}),day:pg({matchPatterns:Vue,defaultMatchWidth:"wide",parsePatterns:Bue,defaultParseWidth:"any"}),dayPeriod:pg({matchPatterns:Gue,defaultMatchWidth:"any",parsePatterns:Xue,defaultParseWidth:"any"})},Zue={code:"en-US",formatDistance:mue,formatLong:kue,formatRelative:xue,localize:Rue,match:Hue,options:{weekStartsOn:0,firstWeekContainsDate:1}},Kue=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Yue=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jue=/^'([^]*?)'?$/,Que=/''/g,$ue=/[a-zA-Z]/;function jd(e,t,r){var n,a,i,o,s,c,l,u,d,f,p;ys(2,arguments);var h=String(t),y=Rm(),g=null!==(n=y.locale)&&void 0!==n?n:Zue,m=Od(null!==(a=null!==(i=null!==(o=void 0)&&void 0!==o?o:y.firstWeekContainsDate)&&void 0!==i?i:null===(s=y.locale)||void 0===s||null===(c=s.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==a?a:1);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=Od(null!==(l=null!==(u=null!==(d=void 0)&&void 0!==d?d:y.weekStartsOn)&&void 0!==u?u:null===(f=y.locale)||void 0===f||null===(p=f.options)||void 0===p?void 0:p.weekStartsOn)&&void 0!==l?l:0);if(!(v>=0&&v<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!g.localize)throw new RangeError("locale must contain localize property");if(!g.formatLong)throw new RangeError("locale must contain formatLong property");var _=Ec(e);if(!$le(_))throw new RangeError("Invalid time value");var k=eue(_,Jle(_)),b={firstWeekContainsDate:m,weekStartsOn:v,locale:g,_originalDate:_};return h.match(Yue).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,fue[t])(e,g.formatLong):e})).join("").match(Kue).map((function(r){if("''"===r)return"'";var n=r[0];if("'"===n)return efe(r);var a=lue[n];if(a)return gue(r)&&dz(r,t,String(e)),hue(r)&&dz(r,t,String(e)),a(k,r,g.localize,b);if(n.match($ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return r})).join("")}function efe(e){var t=e.match(Jue);return t?t[1].replace(Que,"'"):e}const tfe=(e,t,r)=>{if("single"===e)return t?jd(t,"PPP"):r;if("range"===e){const e=t;return null!=e&&e.from?e.to?`${jd(e.from,"MMM dd")} - ${jd(e.to,"MMM dd, yyyy")}`:jd(e.from,"PPP"):r}if("multiple"===e){const e=t;return e&&0!==e.length?1===e.length?jd(e[0],"PPP"):2===e.length?`${jd(e[0],"MMM dd")}, ${jd(e[1],"MMM dd")}`:`${e.length} dates selected`:r}return r},pz=(e,t)=>{if("single"===e)return t||new Date;if("range"===e)return(null==t?void 0:t.from)||new Date;if("multiple"===e){const e=t;return e&&e.length>0?e[0]:new Date}return new Date},rfe=(e,t)=>{if("single"===e)return!!t;if("range"===e)return!(null==t||!t.from);if("multiple"===e){return!!(t&&t.length>0)}return!1},nfe=(e,t)=>"range"===e&&2===t?"max-w-[670px]":"max-w-[330px]",afe=({mode:e,tempValue:t,handleCancel:r,handleApply:n})=>{const a=rfe(e,t);return S.jsxs("div",{className:ct("pb-xxxs py-xs px-s gap-xs flex","range"===e?"justify-end":"justify-between"),children:[S.jsx(gn,{variant:"secondary",className:ct({"flex-1":"range"!==e}),size:"m",onClick:r,children:"Cancel"}),S.jsx(gn,{variant:"primary",className:ct({"flex-1":"range"!==e}),size:"m",onClick:n,disabled:!a,children:"Apply"})]})},R5=Lc((({value:e,placeholder:t,className:r,icon:n,...a},i)=>{const o=tfe(e?Array.isArray(e)?"multiple":"object"==typeof e&&"from"in e?"range":"single":"single",e,t);return S.jsxs(gn,{ref:i,variant:"secondary",className:ct("rounded-m py-l w-[280px] justify-between border border-gray-200 bg-white text-left font-normal text-gray-900",r),...a,children:[S.jsxs("span",{className:"gap-xxs flex items-center",children:[n||S.jsx(x7,{size:16}),o]}),S.jsx(j7,{size:16,className:"ml-xxs"})]})}));R5.displayName="DatePickerTrigger";const sfe=(e,t)=>(r,n)=>{const a="months"===r?Ol(e).month(n).toDate():Ol(e).year(n).toDate();t(a)},ife=(e,t,r,n)=>()=>{("single"===e||"range"===e||"multiple"===e)&&(null==r||r(t)),null==n||n(!1)},ofe=(e,t,r)=>()=>{t(e),null==r||r(!1)},cfe=(e,t)=>r=>{"single"===e&&t(r)},lfe=(e,t)=>r=>{"range"===e&&t(r)},ufe=(e,t)=>r=>{"multiple"===e&&t(r)};var vw,hz,ww,gz,kw,yz;function ffe(){if(hz)return vw;hz=1;var e=gs();return vw=function(){return e.Date.now()}}function dfe(){if(gz)return ww;gz=1;var e=Dl(),t=ffe(),r=u4(),n=Math.max,a=Math.min;return ww=function(i,o,s){var c,l,u,d,f,p,h=0,y=!1,g=!1,m=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function v(e){var t=c,r=l;return c=l=void 0,h=e,d=i.apply(r,t)}function _(e){var t=e-p;return void 0===p||t>=o||t<0||g&&e-h>=u}function k(){var e=t();if(_(e))return b(e);f=setTimeout(k,function(e){var t=o-(e-p);return g?a(t,u-(e-h)):t}(e))}function b(e){return f=void 0,m&&c?v(e):(c=l=void 0,d)}function w(){var e=t(),r=_(e);if(c=arguments,l=this,p=e,r){if(void 0===f)return function(e){return h=e,f=setTimeout(k,o),y?v(e):d}(p);if(g)return clearTimeout(f),f=setTimeout(k,o),v(p)}return void 0===f&&(f=setTimeout(k,o)),d}return o=r(o)||0,e(s)&&(y=!!s.leading,u=(g="maxWait"in s)?n(r(s.maxWait)||0,o):u,m="trailing"in s?!!s.trailing:m),w.cancel=function(){void 0!==f&&clearTimeout(f),h=0,c=p=l=f=void 0},w.flush=function(){return void 0===f?d:b(t())},w},ww}function pfe(){if(yz)return kw;yz=1;var e=I4()("debounce",dfe());return e.placeholder=Qw(),kw=e}var hfe=pfe();const gfe=Ud(hfe),yfe=e=>{const t=gfe(150)(e);Gw("resize",t),Gw("orientationchange",t)},mfe=(e=1e3)=>{const[t,r]=yt((()=>!(typeof window>"u")&&window.innerWidth<e));return yfe((()=>{r(window.innerWidth<e)})),{isSmallScreen:t,isLargeScreen:!t}},_fe=({mode:e,icon:t,value:r,onSelect:n,trigger:a,placeholder:i=("range"===e?"Pick a date range":"multiple"===e?"Pick multiple dates":"Pick a date"),disabled:o,className:s,numberOfMonths:c=("range"===e?2:1),...l})=>{const[u,d]=yt(!1),[f,p]=yt(void 0),[h,y]=yt("calendar"),{isSmallScreen:g}=mfe(1e3),[m,v]=yt((()=>pz(e,r)));Ze((()=>{p(r),v(pz(e,r))}),[e,r]);const _="range"===e&&g?1:c,k=sfe(m,v),b=ife(e,f,n,d),w=ofe(r,p,d),x=cfe(e,p),z=lfe(e,p),A=ufe(e,p),j=a?B5(a)?G5(a,{value:r}):a:S.jsx(R5,{icon:t,value:r,placeholder:i,className:s}),C=nfe(e,_),T={...l,disabled:o,month:m,startMonth:new Date(1900,0),endMonth:new Date(2200,11),onMonthChange:v,numberOfMonths:_,footer:!0,dropdownMode:h,onDropdownModeChange:y,onMonthYearSelect:k,components:{Footer:()=>S.jsx(afe,{mode:e,tempValue:f,handleCancel:w,handleApply:b})}};return S.jsxs(a7,{open:u,onOpenChange:d,children:[S.jsx(s7,{asChild:!0,children:j}),S.jsx(i7,{className:ct(C,"p-none"),align:"center",children:"single"===e?S.jsx(o1,{...T,mode:"single",selected:f,onSelect:x,captionLayout:"dropdown"}):"range"===e?S.jsx(o1,{...T,mode:"range",selected:f,onSelect:z,captionLayout:"label"}):S.jsx(o1,{...T,mode:"multiple",selected:f,onSelect:A,captionLayout:"dropdown"})})]})},vfe=({form:e})=>{const t=!!e.watch("birthday.date");return S.jsxs("div",{className:"relative my-5 text-sm font-medium text-gray-700","data-testid":"bDay",children:[S.jsx("div",{className:"mb-xxs",children:S.jsx(W4,{displayName:"Birthday"})}),S.jsx(_fe,{mode:"single",icon:S.jsx(BC,{size:20}),className:"rounded-m outline-input ring-offset-background placeholder:text-muted-foreground focus-visible:outline-blue_120 min-h-xxxl flex w-full px-4 py-3.5 text-base text-gray-900 outline outline-1 transition-all duration-200 hover:bg-transparent hover:outline-2 hover:outline-gray-400 disabled:cursor-not-allowed disabled:text-gray-300 disabled:outline-gray-200",value:e.watch("birthday.date")||void 0,placeholder:"Select your birthday date",disabled:e=>{const t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return new Date(e.getFullYear(),e.getMonth(),e.getDate())>=r},onSelect:t=>e.setValue("birthday.date",t,{shouldDirty:!0})}),t&&S.jsx(Qk,{isPublic:e.watch("birthday.show"),onChange:t=>{e.setValue("birthday.show","public"===t,{shouldDirty:!0})},children:S.jsxs("label",{className:"relative flex w-full cursor-pointer items-center justify-between",onClick:e=>e.stopPropagation(),children:["Show only month and date",S.jsx(Ez,{checked:e.watch("birthday.dateOnly"),onCheckedChange:t=>{e.setValue("birthday.dateOnly",t,{shouldDirty:!0})}})]})})]})};Ol.extend(z5);const wfe=e=>{var t;const r=mt(pa.selectors.selectUser),n=null==r?void 0:r.id,a=k5(n),i=h8(),o=t=>{var a,o;if(!r)return;const{username:s,displayName:c,summary:l,fields:u}=r;i({userId:r.id,data:{username:s,displayName:c,fields:u,summary:l,timezone:r.timezone||null,birthday:r.birthday||null,avatarId:(null==(a=r.avatar)?void 0:a.uploadId)||null,headerId:(null==(o=r.header)?void 0:o.uploadId)||null,channel:r.channel||!1,actorType:r.actorType||null,location:{...r.location,geo:t}}}),null==e||e(!1),x5(t,n)},s=t=>{null==e||e(!0),Nle({onSuccess:e=>{t(e.coords)},onError:t=>{null==e||e(!1),rn.error(`Update location error: ${t.message}`)}})};return Ze((()=>{var e;const t=!(null!=a&&a.date&&Ol(a.date).isToday()),n=(null==(e=null==r?void 0:r.location)?void 0:e.autoUpdate)&&(t||!(null!=a&&a.geo));n&&pi.debug("Update geo:",{storedGeo:a},{isOutdated:t}),n&&s(o)}),[null==(t=null==r?void 0:r.location)?void 0:t.autoUpdate,null==a?void 0:a.date]),s},kfe=({form:e})=>{const[t,r]=yt(!1),[n]=bS(),a=async t=>{if(t.latitude&&t.longitude)try{const{data:r}=await n({latitude:t.latitude,longitude:t.longitude});e.setValue("location.name",(r??"").replace(/"/g,""))}catch(e){pi.error(`GEO convertion error: ${e}`)}e.setValue("location.geo",t),r(!1)},i=wfe(r);Ze((()=>{e.setValue("canSubmit",!t,{shouldDirty:!0})}),[t]);const[o,s]=yt(""),{data:c}=q5({text:o},{skip:o.trim().length<2}),l=c&&c.length>0?c.map((e=>e.formatted)):[],u=!!e.watch("location.name");return S.jsxs("div",{className:"my-m relative","data-testid":"location",children:[S.jsx(C5,{form:e,name:"location.name",displayName:"Location",maxChars:Cc.location,onFieldChange:s,list:l.map((e=>({key:e,label:e}))),icon:S.jsx($C,{}),disabled:!!e.watch("location.autoUpdate"),inputClassName:"pr-[120px]",currentValue:e.watch("location.name")}),u&&S.jsx(Qk,{isPublic:e.watch("location.show"),onChange:t=>{e.setValue("location.show","public"===t,{shouldDirty:!0})}}),S.jsx(Wn,{isSwitch:!0,name:"location.autoUpdate",control:e.control,onFieldChange:()=>{const t=e.getValues("location");(null==t?void 0:t.autoUpdate)&&i(a)},displayName:"Set location automatically",className:"mb-xs md:mb-0"})]})},Lm=({onClick:e,text:t="Add"})=>S.jsxs(gn,{type:"button",variant:"secondary",onClick:t=>{t.stopPropagation(),e()},className:"w-full text-base",children:[S.jsx(gm,{size:18,className:"ml-1 hidden md:block",strokeWidth:2}),t]}),Em=({onClick:e,className:t})=>S.jsxs("div",{className:ct("flex cursor-pointer items-center justify-center text-gray-200 hover:text-gray-300 md:size-10",t),onClick:e,children:[S.jsx(aT,{className:"hidden md:block"}),S.jsx("span",{className:"text-blue_100 text-sm font-semibold md:hidden",children:"Delete"})]}),mz=[{id:1,label:"conversation about democratic decline"},{id:2,label:"questions about historical precedents"},{id:3,label:"mentions of anocracy, authoritarianism, or regime transitions"}],bfe=5,xfe=({form:e,botTriggers:t})=>S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Triggers"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.triggers.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Trigger ${n+1}`,placeholder:(null==(a=mz[n])?void 0:a.label)||(null==(i=mz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`trigger${t.fields.length+1}`,label:""})})]}),_z=[{id:1,label:"calm"},{id:2,label:"measured"},{id:3,label:"scholarly"},{id:4,label:"fact-driven"}],Afe=5,zfe=({form:e,botPersonalityTraits:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Personality traits"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.personality_traits.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Personality trait ${n+1}`,placeholder:(null==(a=_z[n])?void 0:a.label)||(null==(i=_z[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`personality_trait${t.fields.length+1}`,label:""})})]})}),Sfe=({form:e})=>S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.tone",displayName:"Tone",placeholder:"Measured and formal, yet accessible. Avoids slang."})}),vz=[{id:1,label:"Uses historical analogies and political science terminology. Explains patterns of erosion and decay."},{id:2,label:"Employs witty humor and pop culture references. Makes complex topics accessible through relatable examples."},{id:3,label:"Adopts a philosophical and contemplative tone. Explores deeper meanings and existential questions."},{id:4,label:"Uses technical jargon and analytical frameworks. Breaks down concepts into systematic components."}],Cfe=5,Tfe=({form:e,botStyles:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Bot styles"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.style.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Bot style ${n+1}`,placeholder:(null==(a=vz[n])?void 0:a.label)||(null==(i=vz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`style${t.fields.length+1}`,label:""})})]})}),wz=[{id:1,label:"Reference historical examples like Weimar Republic, Chile, or post-Soviet states."},{id:2,label:"Frame modern events within a long historical timeline."},{id:3,label:"Avoid partisan statements; speak in systems language."},{id:4,label:"Prioritize education over debate."}],jfe=5,Pfe=({form:e,botBehaviors:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Bot behaviors"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.behaviors.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Bot behavior ${n+1}`,placeholder:(null==(a=wz[n])?void 0:a.label)||(null==(i=wz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`behavior${t.fields.length+1}`,label:""})})]})}),Rfe=({form:e,botTriggers:t,botPersonalityTraits:r,botStyles:n,botBehaviors:a})=>S.jsxs("div",{"data-testid":"bot-profile-form",children:[S.jsx("h1",{className:"text-base font-medium text-gray-700",children:"Bot Profile"}),S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.role",displayName:"Role"})}),S.jsx(xfe,{form:e,botTriggers:t}),S.jsx(zfe,{form:e,botPersonalityTraits:r}),S.jsx(Sfe,{form:e}),S.jsx(Tfe,{form:e,botStyles:n}),S.jsx(Pfe,{form:e,botBehaviors:a}),S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.prompt",displayName:"Prompt",maxChars:1e3})})]}),Lfe={data:{},ui:{showInfo:!1},localState:{description:"",rules:null,locations:null}},kz={data:null,loading:!1,ui:{showInfo:!0}},rh=Dd({name:"group",initialState:Lfe,reducers:{setDescription:(e,{payload:t})=>{e.localState.description=t},setRules:(e,{payload:t})=>{e.localState.rules=t},addRule:(e,{payload:t})=>{e.localState.rules=[...e.localState.rules||[],t]},updateRule:(e,{payload:t})=>{e.localState.rules=(e.localState.rules||[]).map((e=>e.id===t.id?t:e))},removeRule:(e,{payload:t})=>{e.localState.rules=(e.localState.rules||[]).filter((e=>e.id!==t))},reorderRules:(e,{payload:t})=>{e.localState.rules=t},setLocations:(e,{payload:t})=>{e.localState.locations=t},removeLocation:(e,{payload:t})=>{e.localState.locations=(e.localState.locations||[]).filter((e=>e!==t))},updateGroupBanner:(e,{payload:t})=>{var r;const n=e.data[t.groupName];null!=(r=null==n?void 0:n.data)&&r.banner&&(n.data.banner.uploadId=t.uploadId)},updateGroupAvatar:(e,{payload:t})=>{var r;const n=e.data[t.groupName];null!=(r=null==n?void 0:n.data)&&r.avatar&&(n.data.avatar.uploadId=t.uploadId)}},extraReducers:e=>{e.addCase(zw,((e,{payload:t})=>{const[r,n]=t;e.data[r]||(e.data[r]={...kz}),e.data[r].data=n})).addCase(Sw,((e,{payload:t})=>{const[r,n]=t;e.data[r]||(e.data[r]={...kz}),e.data[r].loading=n}))},selectors:{group:(e,t)=>{var r;return null==(r=e.data[t])?void 0:r.data},isLoading:(e,t)=>{var r;return null==(r=e.data[t])?void 0:r.loading},showBasicInfo:e=>e.ui.showInfo,selectDescription:e=>e.localState.description,selectRules:e=>e.localState.rules,selectLocations:e=>e.localState.locations}}).injectInto(Hw),Efe=["New York","San Francisco","Los Angeles","Chicago"],Nfe=Ma.enhanceEndpoints({endpoints:{postApiV1Groups:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1Groups:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsSearch:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupId:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdJoin:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r||void 0}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdJoin:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r||void 0}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsNameByGroupname:{providesTags:(e,t,{groupname:r})=>[{type:"Groups",id:(null==e?void 0:e.groupId)||r}],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(Sw([e.groupname,!0]));try{const n=await Oe(r);n&&(t(zw([e.groupname,n.data])),t(rh.actions.setDescription(n.data.summary)),t(rh.actions.setLocations(Efe)))}catch(e){rn.error(`Failed to fetch group name: ${Po(e)}`)}finally{t(Sw([e.groupname,!1]))}}},getApiV1GroupsByGroupId:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdPin:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdPin:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupId:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r,getState:n}){var a,i;const o=(null==(a=n().openapi)?void 0:a.queries)||{};let s;for(const t of Object.keys(o))if(t.startsWith("getApiV1GroupsNameByGroupname")){const r=o[t];if((null==(i=null==r?void 0:r.data)?void 0:i.groupId)===e.groupId){s=r.data.groupName;break}}if(!s)return;const c=t(Nfe.util.updateQueryData("getApiV1GroupsNameByGroupname",{groupname:s},(t=>{e.groupUpdate.fields&&(t.fields=e.groupUpdate.fields),e.groupUpdate.name&&(t.groupName=e.groupUpdate.name),e.groupUpdate.displayName&&(t.displayName=e.groupUpdate.displayName),e.groupUpdate.description&&(t.summary=e.groupUpdate.description)})));try{const e=await Oe(r);null!=e&&e.data&&t(zw([s,e.data]))}catch{c.undo()}}}}}),Ife=Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdMembers:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdMembers:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,`User ${e.groupMemberCreate.memberId} has been added to group`)}},deleteApiV1GroupsByGroupIdMembersAndMemberId:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"You have left the group")}}}}),{useGetApiV1GroupsByGroupIdMembersQuery:Mfe,usePostApiV1GroupsByGroupIdMembersMutation:ape,useDeleteApiV1GroupsByGroupIdMembersAndMemberIdMutation:spe}=Ife;Ma.injectEndpoints({endpoints:e=>({getGroupFullMembers:e.query({async queryFn({groupId:e}){if(!e)return{data:[]};try{const t=Xw(),r=await t.dispatch(Ma.endpoints.getApiV1GroupsByGroupIdMembers.initiate({groupId:e})).unwrap();return Array.isArray(r)&&0!==r.length?{data:(await Promise.allSettled(r.map((e=>t.dispatch(Ma.endpoints.getApiV1UsersByUserId.initiate({userId:e.memberId,full:!0,htmlContent:!0})).unwrap())))).flatMap((e=>"fulfilled"===e.status&&e.value?[e.value]:[]))}:{data:[]}}catch(e){return{error:{status:"CUSTOM_ERROR",error:`Failed to fetch group member users: ${e instanceof Error?e.message:String(e)}`}}}},providesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}]})}),overrideExisting:!1}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdRules:{providesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t);e&&r(rh.actions.setRules(e.data))}catch(e){rn.error(`Failed to fetch rules: ${Po(e)}`)}}},postApiV1GroupsByGroupIdRules:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t,"Rule created");e&&r(rh.actions.addRule(e.data))}catch(e){rn.error(`Failed to delete rule: ${Po(e)}`)}}},deleteApiV1GroupsByGroupIdRulesAndId:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{await Oe(t,"Rule deleted"),r(rh.actions.removeRule(e.id))}catch(e){rn.error(`Failed to delete rule: ${Po(e)}`)}}},putApiV1GroupsByGroupIdRulesAndRuleId:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t,"Rule updated");e&&r(rh.actions.updateRule(e.data))}catch(e){rn.error(`Failed to update rule: ${Po(e)}`)}}},postApiV1GroupsByGroupIdRulesReorder:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t}){try{await Oe(t,"Rules reordered")}catch(e){rn.error(`Failed to reorder rules: ${Po(e)}`)}}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdChannels:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdChannelsLookup:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdChannels:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdChannelsDefault:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdChannelsAndChannelIdDefault:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Channel subscription updated successfully")}},getApiV1GroupsByGroupIdChannelsMain:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdChannelsAndChannelIdMain:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Default channel changed successfully")}},putApiV1GroupsByGroupIdChannelsAndChannelId:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdChannelsAndChannelId:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Channel deleted successfully")}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdJoinRequests:{providesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdJoinRequestsAndGroupJoinRequestId:{invalidatesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdJoinRequestsAndGroupJoinRequestId:{invalidatesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdAiAgentsAssignments:{providesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdAiAgentsAssignments:{invalidatesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdAiAgentsAssignments:{invalidatesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1Rbac:{providesTags:["Rbac_Config"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1RbacScopesByScopeRoles:{providesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1RbacScopesByScopeRoles:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role created successfully")}},putApiV1RbacRolesByRoleId:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role updated successfully")}},deleteApiV1RbacScopesByScopeRolesAndRoleName:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role deleted successfully")}}}});const Ofe=({groupId:e,role:t})=>{const{data:r,isLoading:n,refetch:a}=Mfe({groupId:e,role:t},{skip:!e});return{members:r,isLoading:n,refetch:a}},Dfe="data:image/png;base64,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",Ufe="lastAppFor",qfe=(e="global")=>`${Ufe}:${e}`,bz=({username:e,groupname:t})=>{const r=qfe(t||e||"global");return pm.get(r)},Wfe=Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdChannels:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1Apps:{invalidatesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdApps:{providesTags:(e,t,r)=>[{type:"Group_Apps",id:r.groupId}],keepUnusedDataFor:300,async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1AppsUser:{providesTags:["User_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1AppsUserByAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdAppsAndAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1Apps:{providesTags:["User_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdAppsAndAppId:{invalidatesTags:["Group_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1AppsUserByAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1AppsByAppId:{invalidatesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1AppsInstalled:{providesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),{useLazyGetApiV1GroupsByGroupIdChannelsQuery:Ffe,usePutApiV1GroupsByGroupIdAppsAndAppIdMutation:ipe,useGetApiV1GroupsByGroupIdAppsQuery:ope,useLazyGetApiV1GroupsByGroupIdAppsQuery:Vfe,useDeleteApiV1AppsUserByAppIdMutation:cpe,usePutApiV1AppsUserByAppIdMutation:lpe,useGetApiV1AppsQuery:upe,useGetApiV1AppsUserQuery:fpe,useGetApiV1AppsInstalledQuery:dpe,usePostApiV1AppsMutation:ppe,useDeleteApiV1AppsByAppIdMutation:hpe,useLazyGetApiV1AppsUserQuery:Bfe,useLazyGetApiV1AppsQuery:Gfe}=Wfe,Xfe=({groupName:e,channel:t,type:r="profile",tab:n=""})=>Gy("settings"===r?"/g/:groupname/:channelname/settings/:tab?":"/g/:groupname/:channelname/:tab?",{groupname:e,channelname:`@${t.groupUserName}`,tab:n}),Hfe=()=>{const[e]=Ffe({}),t=Qt((async t=>{const r=await e({groupId:t},!0).unwrap();return null==r?void 0:r.find((e=>e.groupMain))}),[e]);return{getDefaultChannelLink:Qt((async({groupId:e,groupName:r,defaultChannel:n})=>{const a=n??await t(e);return a?Xfe({groupName:r,channel:{groupUserName:a.groupUserName}}):null}),[e,t])}},Zfe=({entryPoint:e})=>{const t=mt(Ur.selectors.selectCurrentUser),r=(null==t?void 0:t.username)||void 0;return Qt(((t,n)=>u7({id:t.id,routes:t.manifest.routes,username:r,groupname:n||void 0,entryPoint:e})),[e,r])},Kfe=()=>{const[e]=Bfe(),[t]=Gfe();return Qt((async()=>c7.hasToken()?e().unwrap():t().unwrap()),[e,t])},Yfe=({entryPoint:e})=>{const t=Zfe({entryPoint:e}),r=Kfe(),[n]=Vfe({}),a=Qt((async e=>e?await n({groupId:e},!0).unwrap():[]),[n]);return{getDefaultAppLink:Qt((async({defaultApp:n,groupName:i,groupId:o})=>{const s=n??("USER"===e?await r():await a(o))[0];return t(s,i)}),[t,r,e,a])}},Jfe=({entryPoint:e})=>{const t=Jw(),{getDefaultChannelLink:r}=Hfe(),{getDefaultAppLink:n}=Yfe({entryPoint:e}),a=Qt((async({username:e,groupId:t,defaultApp:a,groupName:i,defaultChannel:o})=>bz({username:e,groupname:i})||t&&await r({groupId:t,groupName:i,defaultChannel:o})||await n({groupId:t,groupName:i,defaultApp:a})),[bz,r,n]);return{openLastApp:Qt((async({queryParams:e,...r})=>{const n=await a(r);n&&t(n,{queryParams:e})}),[t,a]),getLastAppLink:a}},Qfe=({group:e})=>{const{getLastAppLink:t}=Jfe({entryPoint:"GROUP"}),[r,n]=yt(null);return Ze((()=>{const r=null==e?void 0:e.groupId,a=null==e?void 0:e.groupName;r&&a&&(async()=>{const e=await t({groupId:r,groupName:a});e&&n(e)})()}),[null==e?void 0:e.groupId,null==e?void 0:e.groupName,t]),r},xz={PRIVATE:{text:"Private",icon:S.jsx(U8,{})},PUBLIC:{text:"Public",icon:S.jsx(D8,{})}},$fe=420,ede=({group:e})=>{var t;const r=(null==(t=Z5({upload:e.banner,size:420}))?void 0:t.uri)||"",{members:n}=Ofe({groupId:e.groupId}),a=null==n?void 0:n.length,i=Qfe({group:e});return i?S.jsxs(Xy,{to:i,className:"mb-xs block overflow-hidden rounded-lg border border-gray-200 last:mb-0",children:[S.jsx("img",{src:r||Dfe,alt:e.displayName,className:"h-[130px] w-full object-cover"}),S.jsxs("div",{className:"pt-xs px-m pb-s",children:[S.jsx("div",{className:"mb-xs text-lg font-semibold text-gray-900",children:e.displayName}),S.jsxs("div",{className:"[&_svg]:mr-xxs [&_svg]:size-xxs flex items-center text-base font-medium text-gray-500",children:[xz[e.privacy].icon,xz[e.privacy].text,S.jsx("div",{className:"mx-xxxs",children:"·"}),a," ",1===a?"member":"members"]})]})]}):null},L5=({onCancel:e,onConfirm:t,className:r,isSubmitDisabled:n})=>S.jsxs("div",{className:ct("p-m gap-s flex justify-center bg-white",r),children:[S.jsx(gn,{variant:"secondary",className:"w-full",onClick:e,children:"Cancel"}),S.jsx(hf,{variant:"red_primary",className:"w-full",onClick:t,disabled:n,children:"Delete"})]}),tde=({open:e,onConfirm:t,onCancel:r,groups:n})=>{const a=n.length;return S.jsx(Jg,{open:e,onCloseModal:r,title:"Delete user profile",className:"max-h-[560px] max-w-[460px]",children:S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"mb-xs text-base text-gray-700",children:"This will delete the user and data. To reuse the username, change it first. The username stays reserved for 30 days."}),S.jsxs("div",{className:"mb-xs text-sm font-medium text-gray-500",children:["Group(s): ",a]}),S.jsx("div",{className:"no-scrollbar max-h-[396px] overflow-y-auto pb-[80px]",children:n.map((e=>S.jsx(ede,{group:e},e.groupId)))}),S.jsx(L5,{onCancel:r,onConfirm:t,className:"-left-m -right-m -bottom-m absolute border-t border-gray-200\n"})]})})},E5="DELETE",rde=Ve.object({value:Ve.string().refine((e=>e.trim()===E5),{message:"Value is not correct"})}),nde=({open:e,onClose:t,onConfirm:r})=>{const n=Tz({defaultValues:{value:""},resolver:Cw(rde)}),a=()=>{n.reset(),t()};return S.jsxs(Jg,{open:e,onCloseModal:a,title:"Delete user profile",className:"max-w-[460px]",children:[S.jsxs("p",{className:"mb-xxs text-sm font-medium text-gray-900",children:["Type ",S.jsx("i",{className:"font-normal",children:E5})," to delete user and all related data"]}),S.jsxs(H5,{...n,children:[S.jsx(Wn,{name:"value",control:n.control,className:"mb-m"}),S.jsx(L5,{onCancel:a,onConfirm:r,isSubmitDisabled:!n.formState.isValid,className:"!p-0"})]})]})},ade=({user:e})=>{const[t,r]=yt(!1),[n,a]=yt(!1),[i,o]=yt([]),[s,{isLoading:c}]=p8(),[l]=xS(),u=mt(Ur.selectors.selectUsers),d=null==u?void 0:u.find((t=>t.id!==e.id)),{changeUser:f}=uh();return d?S.jsxs(S.Fragment,{children:[S.jsx(tde,{open:t,onCancel:()=>r(!1),onConfirm:()=>{r(!1),a(!0)},groups:i}),S.jsx(nde,{open:n,onClose:()=>a(!1),onConfirm:()=>{s({id:e.id}),rn.success("Profile deleted successfully"),d&&f(d.id),a(!1)}}),S.jsxs("div",{className:"my-xl flex items-center justify-between text-base",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-red-dark mb-xxxs font-semibold",children:"Delete user profile"}),S.jsx("div",{className:"text-gray-500",children:"Permanently delete this profile and all content"})]}),S.jsxs(hf,{variant:"red_secondary",isLoading:c,onClick:()=>{(async()=>{const e=await l({}).unwrap();e.length>0?(o(e),r(!0)):a(!0)})()},children:[S.jsx(rT,{})," Delete profile"]})]})]}):null},sde=({title:e,description:t})=>S.jsxs("div",{className:"mb-m",children:[S.jsx("p",{className:"mb-xxxs text-base font-semibold text-gray-900",children:e}),S.jsx("span",{className:"text-gray-500",children:t})]}),ide=({user:e,tzList:t,saveOn:r="click",onDirtyChange:n,onSubmit:a,userNameError:i,isSubmitPending:o,renderBottomPanel:s})=>{var c,l,u,d,f;const p=wt({avatar:{preview:Fg({user:e,type:Hi.avatar}),uploadId:(null==(c=null==e?void 0:e.avatar)?void 0:c.uploadId)||null},header:{preview:Fg({user:e,type:Hi.header}),uploadId:(null==(l=null==e?void 0:e.header)?void 0:l.uploadId)||null}}),[h,y,g,m,v,_,k,b]=Dle({user:e,tzList:t,avatarId:null==(u=p.current.avatar)?void 0:u.uploadId,headerId:null==(d=p.current.header)?void 0:d.uploadId,userNameError:i,onSubmit:a,onDirtyChange:n}),{isUserNameChecked:w,handleUserNameChange:x,handleUserNameBlur:z}=pS({form:h,originalUsername:e.username}),A=h.formState.isDirty,j=h.formState.isValid,C=!h.getValues("canSubmit"),T=h.getValues("userName")!==e.username,P=A&&j&&!C&&(!T||w);Nie({canShowMessage:A&&!n8("dev")});const N="blur"===r,L=()=>{N&&y()},E=h.watch("channel"),M="Service"===h.watch("actorType")||!(null==(f=h.watch("botProfile"))||!f.role);return S.jsxs("div",{className:"flex min-h-[calc(100vh-100px)] flex-col justify-between",children:[S.jsxs("div",{children:[S.jsxs("label",{className:"mb-l flex items-center gap-2 text-base",children:[S.jsx("span",{className:"font-medium text-gray-700",children:"This is a bot"}),S.jsx(o7,{checked:M,onCheckedChange:e=>{h.setValue("actorType",e?"Service":"Person",{shouldDirty:!0}),e||h.setValue("botProfile",{role:"",triggers:[],personality_traits:[],tone:"",style:[],behaviors:[],prompt:""},{shouldDirty:!0})}})]}),S.jsx(fT,{user:e,onChange:e=>{p.current={...p.current,...e},g(p.current)},isChannel:E}),S.jsx(Yw,{...h,children:S.jsxs("form",{onBlur:N?y:void 0,className:"mt-xxs",children:[S.jsx("div",{className:ct("mb-s",{"mt-xl":E}),children:S.jsx(Wn,{icon:S.jsx(I8,{}),isRequired:!0,name:"userName",onFieldChange:x,onBlur:()=>{z()},displayName:E?"Channel Name":"User Name",maxChars:Cc.userName,className:"w-full"})}),S.jsxs("div",{className:ct("gap-s mb-s items-start justify-between md:flex [&>*]:basis-[calc(50%-8px)]",{"[&>*]:basis-full":E}),children:[S.jsx(Wn,{icon:E?S.jsx(ZC,{}):S.jsx(W8,{}),isRequired:!0,name:"displayName",displayName:"Display Name",maxChars:Cc.displayName,onAddEmoji:e=>h.setValue("displayName",e,{shouldDirty:!0})}),!E&&S.jsx("div",{className:"mt-s md:mt-0",children:S.jsx(Wn,{icon:S.jsx(eT,{}),name:"Pronouns",displayName:"Pronouns",maxChars:Cc.pronouns})})]}),S.jsx("div",{className:"mb-xl relative z-10 [&_input]:leading-5",children:S.jsx(Wn,{isTextArea:!0,name:"summary",displayName:"Bio",maxChars:Cc.description,className:"[&_textarea]:h-32",placeholder:"Write something about yourself...",onAddEmoji:e=>h.setValue("summary",e,{shouldDirty:!0})})}),S.jsx(sde,{title:"Additional information",description:"Control what additional info is shown on your profile"}),S.jsx(kfe,{form:h}),S.jsx(Zle,{form:h}),!E&&S.jsx(vfe,{form:h}),S.jsx("div",{className:"mb-s",children:S.jsx(Rle,{form:h,customFields:m,onFieldRemove:L,children:S.jsx(Lle,{onAdd:e=>{m.append({label:e.label,content:e.content}),L()}})})}),M&&S.jsx(Rfe,{form:h,botTriggers:v,botPersonalityTraits:_,botStyles:k,botBehaviors:b})]})}),S.jsx(ade,{user:e})]}),P&&S.jsx("div",{className:"-bottom-m md:-mx-m md:p-m sticky left-0 right-0 z-10 mx-[-16px] border-t border-gray-200 bg-white empty:hidden",children:s||N?null==s?void 0:s({isDisabled:!P,isPending:o,submitForm:()=>{y()}}):S.jsxs("div",{className:"gap-s flex items-center justify-center md:justify-normal",children:[S.jsx(Xy,{className:"flex min-h-10 w-full max-w-40 items-center justify-center text-sm font-semibold text-gray-700 md:hidden",to:"/settings/:tab?",props:{tab:""},children:"Cancel"}),S.jsx(hf,{"data-testid":"save",className:"w-full max-w-40 md:w-auto",disabled:!P,isLoading:o||C,onClick:()=>{y()},children:"Save"})]})})]})},N5=e=>{const t=S5();return t?S.jsx(ide,{...e,tzList:t}):null},ode={view:"default",transitView:null,isProfileFormDirty:!1},qn=Dd({name:"manageUsers",initialState:ode,reducers:{changeView:(e,{payload:t})=>{e.isProfileFormDirty?e.transitView=t:(e.view=t,e.transitView=null)},resetTransitView:e=>{e.transitView=null},changeProfileFormDirty:(e,{payload:t})=>{e.isProfileFormDirty=t}},selectors:{selectView:e=>e.view,selectTransitView:e=>e.transitView,selectIsProfileFormDirty:e=>e.isProfileFormDirty}}).injectInto(Hw),cde=({onCancel:e,onSuccess:t})=>{const{changeUser:r}=uh(),n=Io(),[a,i]=yt(""),{createUser:o,isLoading:s}=F4(),[c,{isLoading:l,isSuccess:u,data:d,reset:f}]=W5();Ze((()=>{u&&(t(),f(),null!=d&&d.id&&r(d.id))}),[u,t,f,r,null==d?void 0:d.id]);return S.jsx("div",{children:S.jsx("div",{children:S.jsx(N5,{user:{displayName:"",username:"",summary:"",fields:{}},userNameError:a,onDirtyChange:e=>{n(qn.actions.changeProfileFormDirty(e))},onSubmit:async e=>{try{const t=await o(e);t&&await c({userId:t.id,userUpdate:t})}catch(e){const{isError:t,message:r}=qg(e);t&&i(r)}},isSubmitPending:s||l,renderBottomPanel:({isDisabled:t,isPending:r,submitForm:n})=>S.jsxs("div",{className:"grid w-full grid-cols-2 gap-4 md:flex md:w-auto md:justify-end",children:[S.jsx(gn,{size:"m",variant:"tertiary",className:"px-6 text-base",onClick:e,children:"Cancel"}),S.jsx(hf,{"data-testid":"button-loader",disabled:t,isLoading:r,onClick:n,size:"m",variant:"primary",children:"Save Changes"})]})})})})},I5="updateUser",lde=({user:e})=>{const t=Io(),[r,n]=yt(""),[a,{isLoading:i}]=nk({fixedCacheKey:I5});return{onSubmit:async r=>{try{const n=await a({userId:e.id,userUpdate:r,htmlContent:!1}).unwrap();n&&t(pa.actions.setUser(n))}catch(e){const t=e,{isError:r,message:a}=qg(t);r&&n(a)}},isLoading:i,userNameError:r}},ude=e=>{const{onSubmit:t,isLoading:r,userNameError:n}=lde({user:e.user});return S.jsx(N5,{...e,onSubmit:t,isSubmitPending:r,userNameError:n})},$k=({open:e,title:t,children:r,leftButton:n,rightButton:a,onClose:i,titleTestId:o,...s})=>S.jsxs(Jg,{open:e,onCloseModal:i,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...s,children:[S.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-gray-700","data-testid":o,children:t}),r&&S.jsx("div",{className:"text-center text-base text-gray-500",children:r}),S.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[S.jsx(hf,{size:"m",variant:"secondary",className:"flex-1",...n,title:void 0,children:n.title}),a&&S.jsx(hf,{size:"m",className:"flex-1",...a,title:void 0,children:a.title})]})]}),fde=({open:e,userId:t,onCancel:r,onConfirm:n})=>{const{changeUser:a}=uh(),i=mt((e=>Ur.selectors.selectUserById(e,t))),o=mt(Ur.selectors.selectUsers),[s,{isLoading:c}]=p8();return i?S.jsx($k,{open:e,title:"Delete this user forever?",leftButton:{title:"Cancel",variant:"secondary",isLoading:!1,onClick:r},rightButton:{title:"Delete User",variant:"red_primary",isLoading:c,onClick:()=>{(async()=>{var e;const r=null==(e=null==o?void 0:o.find((e=>e.id!==t)))?void 0:e.id;r&&a(r),await s({id:t}),null==n||n()})()}},children:"This user and all the data, including messages and contacts, will be permanently deleted. Are you sure?"}):null},dde=e=>{try{const{type:t,payload:r}=e,n={type:t};return void 0!==r&&(n.payload=JSON.parse(JSON.stringify(r))),n}catch(t){return pi.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},pde=e=>{const t=window.parent??window;if(t)try{const r=dde(e);t.postMessage(r,"*")}catch(e){pi.error("Failed to process or send message:",e)}},hde=()=>{window.parent===window?Xw().dispatch(sk.actions.setAskLoginOpen(!0)):pde(Z7())},eb=e=>{const t=mt(Ur.selectors.selectCurrentUser),r=mt(l7.selectors.selectIsAuthenticated),n="SUSPENDED"===(null==t?void 0:t.state),a=n;return{isDisabled:a,guardedAction:(e=()=>{})=>()=>{r?r&&!n&&e():hde()},ActionTooltipWrapper:({children:e,triggerClassname:r})=>a?S.jsx(Kw,{theme:"dark",tooltipText:`${hm(t)} is suspended`,size:"default",triggerClassname:r,children:S.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):S.jsx(S.Fragment,{children:e})}},Az=({isDisabled:e,onSubmit:t,isLoading:r,onCancel:n})=>S.jsxs(S.Fragment,{children:[S.jsx(gn,{variant:"tertiary",className:"mr-3",onClick:n,children:"Cancel"}),S.jsx(hf,{"data-testid":"button-loader",disabled:e,isLoading:r,onClick:t,size:"m",variant:"primary",children:"Save Changes"})]}),gde=({user:e,onCancel:t,onSuccess:r,onRemoveUser:n})=>{const a=mt(Ur.selectors.selectUsers),i=((null==a?void 0:a.length)||0)>1,o=Io(),s=mt(qn.selectors.selectIsProfileFormDirty),[,{isSuccess:c,reset:l}]=nk({fixedCacheKey:I5});Ze((()=>{c&&(r(),l())}),[c,r,l]);const{isDisabled:u}=eb(),[d,f,p]=Sm();return S.jsx("div",{className:ct(u&&"pointer-events-none opacity-[.5]"),children:S.jsx(ude,{user:e,onDirtyChange:e=>o(qn.actions.changeProfileFormDirty(e)),renderBottomPanel:({isPending:r,submitForm:a})=>S.jsx("div",{className:"flex w-full items-center justify-between",children:i?S.jsxs("div",{className:"gap-xxs flex",children:[S.jsx(fde,{open:d,userId:e.id,onCancel:()=>{t(),p()},onConfirm:n}),S.jsx("div",{className:"flex items-center",children:S.jsx(Az,{isLoading:r,onCancel:t,isDisabled:!s,onSubmit:a})}),S.jsx(gn,{variant:"red_primary",onClick:f,children:"Delete User"})]}):S.jsx("div",{className:ct("grid w-full grid-cols-2 gap-4","md:flex md:w-auto",i?"md:justify-end":"md:ml-auto"),children:S.jsx(Az,{isLoading:r,onCancel:t,isDisabled:!s,onSubmit:a})})})})})},gpe=()=>{const e=Io(),t=mt(qn.selectors.selectView),[r,n]=TS("string"!=typeof t?null==t?void 0:t.username:void 0),a=Qt((()=>{e(qn.actions.changeView("default"))}),[]),i=Qt((()=>{e(qn.actions.changeProfileFormDirty(!1)),e(qn.actions.changeView("default"))}),[]),o=Qt((()=>{e(qn.actions.changeView("default"))}),[]);if(n)return S.jsx(KC,{className:"m-auto mt-12 h-24 w-24 animate-spin",size:"48"});switch(!0){case"create"===t:return S.jsx(cde,{onCancel:a,onSuccess:i});case!(null==t||!t.id):return S.jsx(gde,{onCancel:a,onSuccess:i,user:r||t,onRemoveUser:o});default:return S.jsxs("div",{className:"mt-5 text-center text-base text-gray-700",children:["Choose user on the right to edit an existing @user",S.jsx("br",{}),"or create a new @user"]})}},ype=()=>{const e=Io(),t=mt(qn.selectors.selectTransitView),r=()=>{e(qn.actions.resetTransitView())};return S.jsx($k,{open:!!t,onClose:r,title:"Draft is not gonna be saved",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:r},rightButton:{title:"Do Not Save",size:"m",isLoading:!1,variant:"primary",onClick:()=>{e(qn.actions.changeProfileFormDirty(!1)),t&&e(qn.actions.changeView(t))}},children:"If you leave, this draft will not be saved. Are you sure?"})},yde=()=>{const[e,{isLoading:t,isSuccess:r}]=_S(),{logout:n}=Iz(),[a,i]=yt(!1);return Ze((()=>{r&&n()}),[r,n]),S.jsxs(S.Fragment,{children:[S.jsx(gn,{variant:"red_primary",className:"w-max",onClick:()=>i(!0),children:"Delete this account"}),S.jsx($k,{open:a,onClose:()=>i(!1),title:"Delete this account forever?",leftButton:{title:"Cancel",variant:"secondary",isLoading:!1,onClick:()=>i(!1)},rightButton:{title:"Delete",variant:"red_primary",isLoading:t,onClick:()=>{e()}},children:"If you delete an account, all its users will also be deleted permanently. Are you sure?"})]})},zz="divide-x-0 hover:text-blue_100 cursor-pointer font-semibold flex gap-2",mpe=()=>{const e=mt(Ur.selectors.selectAccount),{isDisabled:t,ActionTooltipWrapper:r}=eb();return e?S.jsx("div",{className:"w-[560px] text-sm font-medium text-gray-700",children:S.jsxs("div",{className:"grid gap-5",children:[S.jsx("div",{className:"text-base font-normal text-gray-400",children:"You can change your data"}),S.jsx(Xy,{to:"/account/request-change-email",disabled:t,children:S.jsx(r,{children:S.jsxs("div",{className:ct(zz,t&&"opacity-50 hover:text-inherit"),children:[S.jsx(QC,{size:20}),S.jsx("span",{className:"text-base",children:"Change Email"})]})})}),S.jsx(Xy,{to:"/account/request-change-password",children:S.jsxs("div",{className:zz,children:[S.jsx(U8,{size:20}),S.jsx("span",{className:"text-base",children:"Change Password"})]})}),S.jsx("div",{className:"border-b border-dashed"}),S.jsx("div",{className:"text-base font-normal text-gray-400",children:"Your account will be deleted permanently"}),S.jsx(yde,{})]})}):null},_pe=()=>{const e=mt(Ur.selectors.selectAccount),t=mt(Ur.selectors.selectUsers);if(!e)return null;const{email:r,createdAt:n}=e;return S.jsxs("div",{className:"text-base font-medium text-gray-700",children:[S.jsx("div",{className:"truncate",children:r}),S.jsxs("div",{className:"mt-1 flex flex-row *:mr-1",children:[S.jsx("div",{className:"font-normal text-gray-400",children:"registered"}),S.jsx("div",{className:"text-gray-700",children:Ol(n).format("DD.MM.YYYY")})]}),S.jsx("div",{className:"my-5 border-b border-dashed"}),S.jsx("div",{children:null==t?void 0:t.map((e=>{var t,r;return S.jsx(ym,{username:e.username,imgUrl:(null==(r=null==(t=e.avatar)?void 0:t.files[0])?void 0:r.uri)||void 0,avatarClassName:"h-12 w-12 2xl:h-12 2xl:w-12",displayName:e.displayName,userTextClassname:"[&>div]:text-gray-600 max-w-[calc(100%-48px)]",className:"mb-3 max-w-full rounded-md border-gray-100 lg:border lg:bg-gray-50 lg:p-2"},e.username)}))})]})},mde=()=>{const e=Io(),t=mt(qn.selectors.selectView),r=mt(Ur.selectors.selectUsers),n=(null==t?void 0:t.id)||"";Ze((()=>{n&&((null==r?void 0:r.some((({id:e})=>e===n)))||(e(qn.actions.changeProfileFormDirty(!1)),e(qn.actions.changeView("default"))))}),[null==r?void 0:r.length,n])},_de=()=>{const{changeUser:e}=uh(),t=mt(qn.selectors.selectView),r=null==t?void 0:t.id;Ze((()=>{r&&e(r)}),[r])},vpe=()=>{const e=Io(),t=mt(qn.selectors.selectView),r=mt(Ur.selectors.selectUsers),n=!mt(qn.selectors.selectTransitView),{isDisabled:a,ActionTooltipWrapper:i}=eb(),o="create"===t||a,s=(null==t?void 0:t.id)||"";return _de(),mde(),S.jsxs("div",{children:[S.jsx("div",{className:"px-2.5 text-xs font-normal text-gray-700 max-lg:my-5 max-md:my-3 lg:hidden",children:"Choose user to edit an existing @user or create a new @user"}),S.jsx(i,{children:S.jsxs("div",{className:ct("flex cursor-pointer flex-row items-center px-2.5",o&&"cursor-default opacity-35"),onClick:()=>{o||e(qn.actions.changeView("create"))},children:[S.jsx("div",{className:"rounded-md bg-gray-100 p-[14px]",children:S.jsx(gm,{size:20,className:"h-5 w-5"})}),S.jsx("span",{className:"ml-2.5 text-base font-semibold text-gray-700",children:"Create New User"})]})}),S.jsx("div",{className:"mx-2.5 my-5 border-b border-dashed"}),S.jsx("div",{className:"flex flex-col gap-2",children:null==r?void 0:r.map((t=>{var r,a;return S.jsxs("div",{className:ct("hover:bg-accent flex items-center justify-between p-2",s!==t.id?"cursor-pointer":"bg-accent"),onClick:()=>(t=>{n&&e(qn.actions.changeView(t))})(t),children:[S.jsx(ym,{hasCheckIcon:s===t.id,username:t.username,imgUrl:(null==(a=null==(r=t.avatar)?void 0:r.files[0])?void 0:a.uri)||void 0,avatarClassName:"h-12 w-12 2xl:h-12 2xl:w-12",displayName:t.displayName,className:"p-1"}),S.jsx(O8,{size:24,className:"text-gray-700 md:hidden"})]},t.username)}))})]})},wpe=e=>{const t=mt(Ur.selectors.selectCurrentUser);return(null==t?void 0:t.id)===e},vde=e=>!(null!=e&&e.following)||"REJECTED"===(null==e?void 0:e.following),wde=e=>"ACCEPTED"===(null==e?void 0:e.following),kpe=e=>vde(e)&&"ACCEPTED"===(null==e?void 0:e.followed),bpe=e=>"PENDING"===(null==e?void 0:e.following),xpe=e=>wde(e),Ape=e=>!(null==e||!e.blocked),zpe=e=>!(null==e||!e.blockedBy),Spe=e=>{var t;return!(null==(t=null==e?void 0:e.muted)||!t.state)},Cpe=e=>"ACCEPTED"===(null==e?void 0:e.followed),kde=/^(?:\d{2}(?:\/\d{2})?(?:\/\d{4})?|\/\d{2}(?:\/\d{4})?|\/\/\d{4})$/,Tpe=e=>{try{if(!kde.test(e))return e;const t=e.split("/"),r=new Date(e),n=3===t.length,a=2===t.length,i=1===t.length;switch(!0){case n:return new Intl.DateTimeFormat(navigator.language,{year:"numeric",month:"short",day:"numeric"}).format(r);case a:return new Intl.DateTimeFormat(navigator.language,{month:"short",day:"numeric"}).format(r);case i:return new Intl.DateTimeFormat(navigator.language,{year:"numeric"}).format(r);default:return e}}catch{return console.error("formatBday error for date",e),e}};export{_pe as AccountInfoBlock,gpe as CreateEditUser,Eie as CreateUserModal,ude as EditProfile,fT as EditUserMedia,vpe as ManageUsersList,ype as ProtectFormDraftModal,hT as SwitchUserProfileContent,dk as UserAvatar,ym as UserCard,yT as UserMenu,npe as UserMenuDropdown,mpe as UserProfile,vde as canFollow,kpe as canFollowBack,wde as canUnfollow,Cpe as canUnsubscribeFromMe,Tpe as formatBday,Ape as isBlocked,zpe as isBlockedBy,bpe as isFollowPending,xpe as isFollowing,Spe as isMuted,qn as manageUsersSlice,Qde as useAccountWsUpdate,uh as useChangeUser,F4 as useCreateUser,OS as useCurrentUser,rpe as useCurrentUserUpdate,_S as useDeleteApiV1AccountsDeleteMutation,Ude as useDeleteApiV1MuteByUserIdMutation,Vde as useDeleteApiV1NotesByUserIdMutation,p8 as useDeleteApiV1UsersMutation,tpe as useExtraUserUpdate,Ode as useGetApiV1AccountsProfileQuery,qde as useGetApiV1MuteQuery,Xde as useGetApiV1UsersByUserIdFollowersQuery,AS as useGetApiV1UsersByUserIdQuery,Bde as useGetApiV1UsersFollowersQuery,vS as useGetApiV1UsersQuery,wS as useGetApiV1UsersRelationshipsQuery,Jde as useGetApiV1UsersRemoteByUserNameFullFollowersQuery,Mde as useGetInteractionUrlQuery,$de as useGetMyProfile,epe as useGetUserById,CS as useGetUserByUserName,TS as useGetUserNoHtml,wpe as useIsOwnProfile,bS as useLazyGetApiV1GeoQuery,xS as useLazyGetApiV1GroupsOwnedQuery,kS as useLazyGetApiV1UsersRelationshipsQuery,Gde as useLazyGetApiV1UsersRenameHistoryQuery,Wde as usePostApiV1AdminUserChangeStateMutation,Dde as usePostApiV1MuteByUserIdMutation,Yde as usePostApiV1UsersFollowByUsernameAcceptMutation,Hde as usePostApiV1UsersFollowByUsernameMutation,Kde as usePostApiV1UsersFollowByUsernameRejectMutation,Zde as usePostApiV1UsersFollowByUsernameUndoMutation,mS as usePostApiV1UsersMutation,Fde as usePutApiV1NotesMutation,nk as usePutApiV1UsersByUserIdMutation,US as useRelationship,h8 as useSafeUserUpdate,d8 as userApi,pa as userNoHTMLSlice,Ur as userSlice};
110
+ */function Foe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _r((()=>e=>{t.forEach((t=>t(e)))}),t)}const Cm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ph(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Bk(e){return"nodeType"in e}function Us(e){var t,r;return e?ph(e)?e:Bk(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function Gk(e){const{Document:t}=Us(e);return e instanceof t}function ty(e){return!ph(e)&&e instanceof Us(e).HTMLElement}function K4(e){return e instanceof Us(e).SVGElement}function hh(e){return e?ph(e)?e.document:Bk(e)?Gk(e)?e:ty(e)||K4(e)?e.ownerDocument:document:document:document}const Rc=Cm?Sz:Ze;function Xk(e){const t=wt(e);return Rc((()=>{t.current=e})),Qt((function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)}),[])}function Voe(){const e=wt(null);return[Qt(((t,r)=>{e.current=setInterval(t,r)}),[]),Qt((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}function Vg(e,t){void 0===t&&(t=[e]);const r=wt(e);return Rc((()=>{r.current!==e&&(r.current=e)}),t),r}function ry(e,t){const r=wt();return _r((()=>{const t=e(r.current);return r.current=t,t}),[...t])}function rm(e){const t=Xk(e),r=wt(null),n=Qt((e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e}),[]);return[r,n]}function qw(e){const t=wt();return Ze((()=>{t.current=e}),[e]),t.current}let pw={};function ny(e,t){return _r((()=>{if(t)return t;const r=null==pw[e]?0:pw[e]+1;return pw[e]=r,e+"-"+r}),[e,t])}function Y4(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce(((t,r)=>{const n=Object.entries(r);for(const[r,a]of n){const n=t[r];null!=n&&(t[r]=n+e*a)}return t}),{...t})}}const sh=Y4(1),Bg=Y4(-1);function Boe(e){return"clientX"in e&&"clientY"in e}function Hk(e){if(!e)return!1;const{KeyboardEvent:t}=Us(e.target);return t&&e instanceof t}function Goe(e){if(!e)return!1;const{TouchEvent:t}=Us(e.target);return t&&e instanceof t}function Ww(e){if(Goe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Boe(e)?{x:e.clientX,y:e.clientY}:null}const Gg=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Gg.Translate.toString(e),Gg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),X6="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Xoe(e){return e.matches(X6)?e:e.querySelector(X6)}const Hoe={display:"none"};function Zoe(e){let{id:t,value:r}=e;return $n.createElement("div",{id:t,style:Hoe},r)}function Koe(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;return $n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":n,"aria-atomic":!0},r)}function Yoe(){const[e,t]=yt("");return{announce:Qt((e=>{null!=e&&t(e)}),[]),announcement:e}}const J4=Hg(null);function Joe(e){const t=Nd(J4);Ze((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}function Qoe(){const[e]=yt((()=>new Set)),t=Qt((t=>(e.add(t),()=>e.delete(t))),[e]);return[Qt((t=>{let{type:r,event:n}=t;e.forEach((e=>{var t;return null==(t=e[r])?void 0:t.call(e,n)}))}),[e]),t]}const $oe={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ece={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tce(e){let{announcements:t=ece,container:r,hiddenTextDescribedById:n,screenReaderInstructions:a=$oe}=e;const{announce:i,announcement:o}=Yoe(),s=ny("DndLiveRegion"),[c,l]=yt(!1);if(Ze((()=>{l(!0)}),[]),Joe(_r((()=>({onDragStart(e){let{active:r}=e;i(t.onDragStart({active:r}))},onDragMove(e){let{active:r,over:n}=e;t.onDragMove&&i(t.onDragMove({active:r,over:n}))},onDragOver(e){let{active:r,over:n}=e;i(t.onDragOver({active:r,over:n}))},onDragEnd(e){let{active:r,over:n}=e;i(t.onDragEnd({active:r,over:n}))},onDragCancel(e){let{active:r,over:n}=e;i(t.onDragCancel({active:r,over:n}))}})),[i,t])),!c)return null;const u=$n.createElement($n.Fragment,null,$n.createElement(Zoe,{id:n,value:a.draggable}),$n.createElement(Koe,{id:s,announcement:o}));return r?th.createPortal(u,r):u}var Qn;function nm(){}function H6(e,t){return _r((()=>({sensor:e,options:t??{}})),[e,t])}function rce(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _r((()=>[...t].filter((e=>null!=e))),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(Qn||(Qn={}));const No=Object.freeze({x:0,y:0});function Q4(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $4(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function nce(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function Z6(e){let{left:t,top:r,height:n,width:a}=e;return[{x:t,y:r},{x:t+a,y:r},{x:t,y:r+n},{x:t+a,y:r+n}]}function e5(e,t){if(!e||0===e.length)return null;const[r]=e;return r[t]}function K6(e,t,r){return void 0===t&&(t=e.left),void 0===r&&(r=e.top),{x:t+.5*e.width,y:r+.5*e.height}}const ace=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=K6(t,t.left,t.top),i=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=Q4(K6(n),a);i.push({id:t,data:{droppableContainer:e,value:r}})}}return i.sort($4)},sce=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=Z6(t),i=[];for(const e of n){const{id:t}=e,n=r.get(t);if(n){const r=Z6(n),o=a.reduce(((e,t,n)=>e+Q4(r[n],t)),0),s=Number((o/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:s}})}}return i.sort($4)};function ice(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=a-n,s=i-r;if(n<a&&r<i){const r=t.width*t.height,n=e.width*e.height,a=o*s;return Number((a/(r+n-a)).toFixed(4))}return 0}const oce=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=[];for(const e of n){const{id:n}=e,i=r.get(n);if(i){const r=ice(i,t);r>0&&a.push({id:n,data:{droppableContainer:e,value:r}})}}return a.sort(nce)};function cce(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function t5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:No}function lce(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce(((t,r)=>({...t,top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x})),{...t})}}const uce=lce(1);function fce(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dce(e,t,r){const n=fce(t);if(!n)return e;const{scaleX:a,scaleY:i,x:o,y:s}=n,c=e.left-o-(1-a)*parseFloat(r),l=e.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),u=a?e.width/a:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}const pce={ignoreTransform:!1};function gh(e,t){void 0===t&&(t=pce);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:n}=Us(e).getComputedStyle(e);t&&(r=dce(r,t,n))}const{top:n,left:a,width:i,height:o,bottom:s,right:c}=r;return{top:n,left:a,width:i,height:o,bottom:s,right:c}}function Y6(e){return gh(e,{ignoreTransform:!0})}function hce(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function gce(e,t){return void 0===t&&(t=Us(e).getComputedStyle(e)),"fixed"===t.position}function yce(e,t){void 0===t&&(t=Us(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const n=t[e];return"string"==typeof n&&r.test(n)}))}function Tm(e,t){const r=[];return e?function n(a){if(null!=t&&r.length>=t||!a)return r;if(Gk(a)&&null!=a.scrollingElement&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!ty(a)||K4(a)||r.includes(a))return r;const i=Us(e).getComputedStyle(a);return a!==e&&yce(a,i)&&r.push(a),gce(a,i)?r:n(a.parentNode)}(e):r}function r5(e){const[t]=Tm(e,1);return t??null}function hw(e){return Cm&&e?ph(e)?e:Bk(e)?Gk(e)||e===hh(e).scrollingElement?window:ty(e)?e:null:null:null}function n5(e){return ph(e)?e.scrollX:e.scrollLeft}function a5(e){return ph(e)?e.scrollY:e.scrollTop}function Fw(e){return{x:n5(e),y:a5(e)}}var ha;function s5(e){return!(!Cm||!e)&&e===document.scrollingElement}function i5(e){const t={x:0,y:0},r=s5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(ha||(ha={}));const mce={x:.2,y:.2};function _ce(e,t,r,n,a){let{top:i,left:o,right:s,bottom:c}=r;void 0===n&&(n=10),void 0===a&&(a=mce);const{isTop:l,isBottom:u,isLeft:d,isRight:f}=i5(e),p={x:0,y:0},h={x:0,y:0},y=t.height*a.y,g=t.width*a.x;return!l&&i<=t.top+y?(p.y=ha.Backward,h.y=n*Math.abs((t.top+y-i)/y)):!u&&c>=t.bottom-y&&(p.y=ha.Forward,h.y=n*Math.abs((t.bottom-y-c)/y)),!f&&s>=t.right-g?(p.x=ha.Forward,h.x=n*Math.abs((t.right-g-s)/g)):!d&&o<=t.left+g&&(p.x=ha.Backward,h.x=n*Math.abs((t.left+g-o)/g)),{direction:p,speed:h}}function vce(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:r,right:n,bottom:a}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:a,width:e.clientWidth,height:e.clientHeight}}function o5(e){return e.reduce(((e,t)=>sh(e,Fw(t))),No)}function wce(e){return e.reduce(((e,t)=>e+n5(t)),0)}function kce(e){return e.reduce(((e,t)=>e+a5(t)),0)}function bce(e,t){if(void 0===t&&(t=gh),!e)return;const{top:r,left:n,bottom:a,right:i}=t(e);r5(e)&&(a<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const xce=[["x",["left","right"],wce],["y",["top","bottom"],kce]];class Zk{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Tm(t),n=o5(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,a]of xce)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=a(r),o=n[e]-t;return this.rect[i]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xg{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,r){var n;null==(n=this.target)||n.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function Ace(e){const{EventTarget:t}=Us(e);return e instanceof t?e:hh(e)}function gw(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}var Zi,Mt;function J6(e){e.preventDefault()}function zce(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Zi||(Zi={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Mt||(Mt={}));const c5={start:[Mt.Space,Mt.Enter],cancel:[Mt.Esc],end:[Mt.Space,Mt.Enter,Mt.Tab]},Sce=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Mt.Right:return{...r,x:r.x+25};case Mt.Left:return{...r,x:r.x-25};case Mt.Down:return{...r,y:r.y+25};case Mt.Up:return{...r,y:r.y-25}}};class Kk{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new xg(hh(t)),this.windowListeners=new xg(Us(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Zi.Resize,this.handleCancel),this.windowListeners.add(Zi.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Zi.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&bce(r),t(No)}handleKeyDown(e){if(Hk(e)){const{active:t,context:r,options:n}=this.props,{keyboardCodes:a=c5,coordinateGetter:i=Sce,scrollBehavior:o="smooth"}=n,{code:s}=e;if(a.end.includes(s))return void this.handleEnd(e);if(a.cancel.includes(s))return void this.handleCancel(e);const{collisionRect:c}=r.current,l=c?{x:c.left,y:c.top}:No;this.referenceCoordinates||(this.referenceCoordinates=l);const u=i(e,{active:t,context:r.current,currentCoordinates:l});if(u){const t=Bg(u,l),n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,{isTop:i,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=i5(r),p=vce(r),h={x:Math.min(a===Mt.Right?p.right-p.width/2:p.right,Math.max(a===Mt.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(a===Mt.Down?p.bottom-p.height/2:p.bottom,Math.max(a===Mt.Down?p.top:p.top+p.height/2,u.y))},y=a===Mt.Right&&!s||a===Mt.Left&&!c,g=a===Mt.Down&&!l||a===Mt.Up&&!i;if(y&&h.x!==u.x){const e=r.scrollLeft+t.x,i=a===Mt.Right&&e<=d.x||a===Mt.Left&&e>=f.x;if(i&&!t.y)return void r.scrollTo({left:e,behavior:o});n.x=i?r.scrollLeft-e:a===Mt.Right?r.scrollLeft-d.x:r.scrollLeft-f.x,n.x&&r.scrollBy({left:-n.x,behavior:o});break}if(g&&h.y!==u.y){const e=r.scrollTop+t.y,i=a===Mt.Down&&e<=d.y||a===Mt.Up&&e>=f.y;if(i&&!t.x)return void r.scrollTo({top:e,behavior:o});n.y=i?r.scrollTop-e:a===Mt.Down?r.scrollTop-d.y:r.scrollTop-f.y,n.y&&r.scrollBy({top:-n.y,behavior:o});break}}this.handleMove(e,sh(Bg(u,this.referenceCoordinates),n))}}}handleMove(e,t){const{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Q6(e){return!(!e||!("distance"in e))}function $6(e){return!(!e||!("delay"in e))}Kk.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=c5,onActivation:a}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class Yk{constructor(e,t,r){var n;void 0===r&&(r=Ace(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:i}=a;this.props=e,this.events=t,this.document=hh(i),this.documentListeners=new xg(this.document),this.listeners=new xg(r),this.windowListeners=new xg(Us(i)),this.initialCoordinates=null!=(n=Ww(a))?n:No,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Zi.Resize,this.handleCancel),this.windowListeners.add(Zi.DragStart,J6),this.windowListeners.add(Zi.VisibilityChange,this.handleCancel),this.windowListeners.add(Zi.ContextMenu,J6),this.documentListeners.add(Zi.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($6(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Q6(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Zi.Click,zce,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Zi.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:r,initialCoordinates:n,props:a}=this,{onMove:i,options:{activationConstraint:o}}=a;if(!n)return;const s=null!=(t=Ww(e))?t:No,c=Bg(n,s);if(!r&&o){if(Q6(o)){if(null!=o.tolerance&&gw(c,o.tolerance))return this.handleCancel();if(gw(c,o.distance))return this.handleStart()}return $6(o)&&gw(c,o.tolerance)?this.handleCancel():void this.handlePending(o,c)}e.cancelable&&e.preventDefault(),i(s)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Mt.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Cce={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Jk extends Yk{constructor(e){const{event:t}=e,r=hh(t.target);super(e,Cce,r)}}Jk.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!(!r.isPrimary||0!==r.button)&&(null==n||n({event:r}),!0)}}];const Tce={move:{name:"mousemove"},end:{name:"mouseup"}};var Vw;!function(e){e[e.RightClick=2]="RightClick"}(Vw||(Vw={}));class jce extends Yk{constructor(e){super(e,Tce,hh(e.event.target))}}jce.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button!==Vw.RightClick&&(null==n||n({event:r}),!0)}}];const yw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Pce extends Yk{constructor(e){super(e,yw)}static setup(){return window.addEventListener(yw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(yw.move.name,e)};function e(){}}}var Ag,am;function Rce(e){let{acceleration:t,activator:r=Ag.Pointer,canScroll:n,draggingRect:a,enabled:i,interval:o=5,order:s=am.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e;const p=Ece({delta:d,disabled:!i}),[h,y]=Voe(),g=wt({x:0,y:0}),m=wt({x:0,y:0}),v=_r((()=>{switch(r){case Ag.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ag.DraggableRect:return a}}),[r,a,c]),_=wt(null),k=Qt((()=>{const e=_.current;if(!e)return;const t=g.current.x*m.current.x,r=g.current.y*m.current.y;e.scrollBy(t,r)}),[]),b=_r((()=>s===am.TreeOrder?[...l].reverse():l),[s,l]);Ze((()=>{if(i&&l.length&&v){for(const e of b){if(!1===(null==n?void 0:n(e)))continue;const r=l.indexOf(e),a=u[r];if(!a)continue;const{direction:i,speed:s}=_ce(e,a,v,t,f);for(const e of["x","y"])p[e][i[e]]||(s[e]=0,i[e]=0);if(s.x>0||s.y>0)return y(),_.current=e,h(k,o),g.current=s,void(m.current=i)}g.current={x:0,y:0},m.current={x:0,y:0},y()}else y()}),[t,k,n,y,i,o,JSON.stringify(v),JSON.stringify(p),h,l,b,u,JSON.stringify(f)])}Pce.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:a}=r;return!(a.length>1)&&(null==n||n({event:r}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(Ag||(Ag={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(am||(am={}));const Lce={x:{[ha.Backward]:!1,[ha.Forward]:!1},y:{[ha.Backward]:!1,[ha.Forward]:!1}};function Ece(e){let{delta:t,disabled:r}=e;const n=qw(t);return ry((e=>{if(r||!n||!e)return Lce;const a=Math.sign(t.x-n.x),i=Math.sign(t.y-n.y);return{x:{[ha.Backward]:e.x[ha.Backward]||-1===a,[ha.Forward]:e.x[ha.Forward]||1===a},y:{[ha.Backward]:e.y[ha.Backward]||-1===i,[ha.Forward]:e.y[ha.Forward]||1===i}}}),[r,t,n])}function Nce(e,t){const r=null!=t?e.get(t):void 0,n=r?r.node.current:null;return ry((e=>{var r;return null==t?null:null!=(r=n??e)?r:null}),[n,t])}function Ice(e,t){return _r((()=>e.reduce(((e,r)=>{const{sensor:n}=r;return[...e,...n.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,r)})))]}),[])),[e,t])}var Xg,Bw;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Xg||(Xg={})),(Bw||(Bw={})).Optimized="optimized";const ez=new Map;function Mce(e,t){let{dragging:r,dependencies:n,config:a}=t;const[i,o]=yt(null),{frequency:s,measure:c,strategy:l}=a,u=wt(e),d=function(){switch(l){case Xg.Always:return!1;case Xg.BeforeDragging:return r;default:return!r}}(),f=Vg(d),p=Qt((function(e){void 0===e&&(e=[]),!f.current&&o((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[f]),h=wt(null),y=ry((t=>{if(d&&!r)return ez;if(!t||t===ez||u.current!==e||null!=i){const t=new Map;for(let r of e){if(!r)continue;if(i&&i.length>0&&!i.includes(r.id)&&r.rect.current){t.set(r.id,r.rect.current);continue}const e=r.node.current,n=e?new Zk(c(e),e):null;r.rect.current=n,n&&t.set(r.id,n)}return t}return t}),[e,i,r,d,c]);return Ze((()=>{u.current=e}),[e]),Ze((()=>{d||p()}),[r,d]),Ze((()=>{i&&i.length>0&&o(null)}),[JSON.stringify(i)]),Ze((()=>{d||"number"!=typeof s||null!==h.current||(h.current=setTimeout((()=>{p(),h.current=null}),s))}),[s,d,p,...n]),{droppableRects:y,measureDroppableContainers:p,measuringScheduled:null!=i}}function l5(e,t){return ry((r=>e?r||("function"==typeof t?t(e):e):null),[t,e])}function Oce(e,t){return l5(e,t)}function Dce(e){let{callback:t,disabled:r}=e;const n=Xk(t),a=_r((()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:e}=window;return new e(n)}),[n,r]);return Ze((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function jm(e){let{callback:t,disabled:r}=e;const n=Xk(t),a=_r((()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:e}=window;return new e(n)}),[r]);return Ze((()=>()=>null==a?void 0:a.disconnect()),[a]),a}function Uce(e){return new Zk(gh(e),e)}function tz(e,t,r){void 0===t&&(t=Uce);const[n,a]=yt(null);function i(){a((n=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=n??r)?a:null;const i=t(e);return JSON.stringify(n)===JSON.stringify(i)?n:i}))}const o=Dce({callback(t){if(e)for(const r of t){const{type:t,target:n}=r;if("childList"===t&&n instanceof HTMLElement&&n.contains(e)){i();break}}}}),s=jm({callback:i});return Rc((()=>{i(),e?(null==s||s.observe(e),null==o||o.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==o||o.disconnect())}),[e]),n}function qce(e){return t5(e,l5(e))}const rz=[];function Wce(e){const t=wt(e),r=ry((r=>e?r&&r!==rz&&e&&t.current&&e.parentNode===t.current.parentNode?r:Tm(e):rz),[e]);return Ze((()=>{t.current=e}),[e]),r}function Fce(e){const[t,r]=yt(null),n=wt(e),a=Qt((e=>{const t=hw(e.target);t&&r((e=>e?(e.set(t,Fw(t)),new Map(e)):null))}),[]);return Ze((()=>{const t=n.current;if(e!==t){i(t);const o=e.map((e=>{const t=hw(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Fw(t)]):null})).filter((e=>null!=e));r(o.length?new Map(o):null),n.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=hw(e);null==t||t.removeEventListener("scroll",a)}))}}),[a,e]),_r((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>sh(e,t)),No):o5(e):No),[e,t])}function nz(e,t){void 0===t&&(t=[]);const r=wt(null);return Ze((()=>{r.current=null}),t),Ze((()=>{const t=e!==No;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)}),[e]),r.current?Bg(e,r.current):No}function Vce(e){Ze((()=>{if(!Cm)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}function Bce(e,t){return _r((()=>e.reduce(((e,r)=>{let{eventName:n,handler:a}=r;return e[n]=e=>{a(e,t)},e}),{})),[e,t])}function u5(e){return _r((()=>e?hce(e):null),[e])}const az=[];function Gce(e,t){void 0===t&&(t=gh);const[r]=e,n=u5(r?Us(r):null),[a,i]=yt(az);function o(){i((()=>e.length?e.map((e=>s5(e)?n:new Zk(t(e),e))):az))}const s=jm({callback:o});return Rc((()=>{null==s||s.disconnect(),o(),e.forEach((e=>null==s?void 0:s.observe(e)))}),[e]),a}function Xce(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ty(t)?t:e}function Hce(e){let{measure:t}=e;const[r,n]=yt(null),a=jm({callback:Qt((e=>{for(const{target:r}of e)if(ty(r)){n((e=>{const n=t(r);return e?{...e,width:n.width,height:n.height}:n}));break}}),[t])}),i=Qt((e=>{const r=Xce(e);null==a||a.disconnect(),r&&(null==a||a.observe(r)),n(r?t(r):null)}),[t,a]),[o,s]=rm(i);return _r((()=>({nodeRef:o,rect:r,setRef:s})),[r,o,s])}const Zce=[{sensor:Jk,options:{}},{sensor:Kk,options:{}}],Kce={current:{}},Fy={draggable:{measure:Y6},droppable:{measure:Y6,strategy:Xg.WhileDragging,frequency:Bw.Optimized},dragOverlay:{measure:gh}};class zg extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}const Yce={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zg,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fy,measureDroppableContainers:nm,windowRect:null,measuringScheduled:!1},Jce={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nm,draggableNodes:new Map,over:null,measureDroppableContainers:nm},Pm=Hg(Jce),f5=Hg(Yce);function Qce(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zg}}}function $ce(e,t){switch(t.type){case Qn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Qn.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Qn.DragEnd:case Qn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qn.RegisterDroppable:{const{element:r}=t,{id:n}=r,a=new zg(e.droppable.containers);return a.set(n,r),{...e,droppable:{...e.droppable,containers:a}}}case Qn.SetDroppableDisabled:{const{id:r,key:n,disabled:a}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new zg(e.droppable.containers);return o.set(r,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case Qn.UnregisterDroppable:{const{id:r,key:n}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new zg(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function ele(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:a}=Nd(Pm),i=qw(n),o=qw(null==r?void 0:r.id);return Ze((()=>{if(!t&&!n&&i&&null!=o){if(!Hk(i)||document.activeElement===i.target)return;const e=a.get(o);if(!e)return;const{activatorNode:t,node:r}=e;if(!t.current&&!r.current)return;requestAnimationFrame((()=>{for(const e of[t.current,r.current]){if(!e)continue;const t=Xoe(e);if(t){t.focus();break}}}))}}),[n,t,a,o,i]),null}function tle(e,t){let{transform:r,...n}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...n})),r):r}function rle(e){return _r((()=>({draggable:{...Fy.draggable,...null==e?void 0:e.draggable},droppable:{...Fy.droppable,...null==e?void 0:e.droppable},dragOverlay:{...Fy.dragOverlay,...null==e?void 0:e.dragOverlay}})),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}function nle(e){let{activeNode:t,measure:r,initialRect:n,config:a=!0}=e;const i=wt(!1),{x:o,y:s}="boolean"==typeof a?{x:a,y:a}:a;Rc((()=>{if(!o&&!s||!t)return void(i.current=!1);if(i.current||!n)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=t5(r(e),n);if(o||(a.x=0),s||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=r5(e);t&&t.scrollBy({top:a.y,left:a.x})}}),[t,o,s,n,r])}const d5=Hg({...No,scaleX:1,scaleY:1});var uf;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(uf||(uf={}));const ale=F5((function(e){var t,r,n,a;let{id:i,accessibility:o,autoScroll:s=!0,children:c,sensors:l=Zce,collisionDetection:u=oce,measuring:d,modifiers:f,...p}=e;const h=V5($ce,void 0,Qce),[y,g]=h,[m,v]=Qoe(),[_,k]=yt(uf.Uninitialized),b=_===uf.Initialized,{draggable:{active:w,nodes:x,translate:z},droppable:{containers:A}}=y,S=null!=w?x.get(w):null,j=wt({initial:null,translated:null}),C=_r((()=>{var e;return null!=w?{id:w,data:null!=(e=null==S?void 0:S.data)?e:Kce,rect:j}:null}),[w,S]),T=wt(null),[P,N]=yt(null),[L,E]=yt(null),M=Vg(p,Object.values(p)),O=ny("DndDescribedBy",i),D=_r((()=>A.getEnabled()),[A]),U=rle(d),{droppableRects:I,measureDroppableContainers:R,measuringScheduled:V}=Mce(D,{dragging:b,dependencies:[z.x,z.y],config:U.droppable}),F=Nce(x,w),W=_r((()=>L?Ww(L):null),[L]),q=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof s?!1===s.enabled:!1===s,r=b&&!e&&!t;return"object"==typeof s?{...s,enabled:r}:{enabled:r}}(),Z=Oce(F,U.draggable.measure);nle({activeNode:null!=w?x.get(w):null,config:q.layoutShiftCompensation,initialRect:Z,measure:U.draggable.measure});const X=tz(F,U.draggable.measure,Z),B=tz(F?F.parentElement:null),G=wt({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:x,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),H=A.getNodeFor(null==(t=G.current.over)?void 0:t.id),K=Hce({measure:U.dragOverlay.measure}),Y=null!=(r=K.nodeRef.current)?r:F,J=b?null!=(n=K.rect)?n:X:null,Q=!(!K.nodeRef.current||!K.rect),$=qce(Q?null:X),ee=u5(Y?Us(Y):null),te=Wce(b?H??F:null),re=Gce(te),ne=tle(f,{transform:{x:z.x-$.x,y:z.y-$.y,scaleX:1,scaleY:1},activatorEvent:L,active:C,activeNodeRect:X,containerNodeRect:B,draggingNodeRect:J,over:G.current.over,overlayNodeRect:K.rect,scrollableAncestors:te,scrollableAncestorRects:re,windowRect:ee}),ae=W?sh(W,z):null,ie=Fce(te),oe=nz(ie),se=nz(ie,[X]),ce=sh(ne,oe),le=J?uce(J,ne):null,ue=C&&le?u({active:C,collisionRect:le,droppableRects:I,droppableContainers:D,pointerCoordinates:ae}):null,de=e5(ue,"id"),[fe,pe]=yt(null),he=cce(Q?ne:sh(ne,se),null!=(a=null==fe?void 0:fe.rect)?a:null,X),ye=wt(null),ge=Qt(((e,t)=>{let{sensor:r,options:n}=t;if(null==T.current)return;const a=x.get(T.current);if(!a)return;const i=e.nativeEvent,o=new r({active:T.current,activeNode:a,event:i,options:n,context:G,onAbort(e){if(!x.get(e))return;const{onDragAbort:t}=M.current,r={id:e};null==t||t(r),m({type:"onDragAbort",event:r})},onPending(e,t,r,n){if(!x.get(e))return;const{onDragPending:a}=M.current,i={id:e,constraint:t,initialCoordinates:r,offset:n};null==a||a(i),m({type:"onDragPending",event:i})},onStart(e){const t=T.current;if(null==t)return;const r=x.get(t);if(!r)return;const{onDragStart:n}=M.current,a={activatorEvent:i,active:{id:t,data:r.data,rect:j}};th.unstable_batchedUpdates((()=>{null==n||n(a),k(uf.Initializing),g({type:Qn.DragStart,initialCoordinates:e,active:t}),m({type:"onDragStart",event:a}),N(ye.current),E(i)}))},onMove(e){g({type:Qn.DragMove,coordinates:e})},onEnd:s(Qn.DragEnd),onCancel:s(Qn.DragCancel)});function s(e){return async function(){const{active:t,collisions:r,over:n,scrollAdjustedTranslate:a}=G.current;let o=null;if(t&&a){const{cancelDrop:s}=M.current;o={activatorEvent:i,active:t,collisions:r,delta:a,over:n},e===Qn.DragEnd&&"function"==typeof s&&await Promise.resolve(s(o))&&(e=Qn.DragCancel)}T.current=null,th.unstable_batchedUpdates((()=>{g({type:e}),k(uf.Uninitialized),pe(null),N(null),E(null),ye.current=null;const t=e===Qn.DragEnd?"onDragEnd":"onDragCancel";if(o){const e=M.current[t];null==e||e(o),m({type:t,event:o})}}))}}ye.current=o}),[x]),me=Ice(l,Qt(((e,t)=>(r,n)=>{const a=r.nativeEvent,i=x.get(n);if(null!==T.current||!i||a.dndKit||a.defaultPrevented)return;const o={active:i};!0===e(r,t.options,o)&&(a.dndKit={capturedBy:t.sensor},T.current=n,ge(r,t))}),[x,ge]));Vce(l),Rc((()=>{X&&_===uf.Initializing&&k(uf.Initialized)}),[X,_]),Ze((()=>{const{onDragMove:e}=M.current,{active:t,activatorEvent:r,collisions:n,over:a}=G.current;if(!t||!r)return;const i={active:t,activatorEvent:r,collisions:n,delta:{x:ce.x,y:ce.y},over:a};th.unstable_batchedUpdates((()=>{null==e||e(i),m({type:"onDragMove",event:i})}))}),[ce.x,ce.y]),Ze((()=>{const{active:e,activatorEvent:t,collisions:r,droppableContainers:n,scrollAdjustedTranslate:a}=G.current;if(!e||null==T.current||!t||!a)return;const{onDragOver:i}=M.current,o=n.get(de),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:r,delta:{x:a.x,y:a.y},over:s};th.unstable_batchedUpdates((()=>{pe(s),null==i||i(c),m({type:"onDragOver",event:c})}))}),[de]),Rc((()=>{G.current={activatorEvent:L,active:C,activeNode:F,collisionRect:le,collisions:ue,droppableRects:I,draggableNodes:x,draggingNode:Y,draggingNodeRect:J,droppableContainers:A,over:fe,scrollableAncestors:te,scrollAdjustedTranslate:ce},j.current={initial:J,translated:le}}),[C,F,ue,le,x,Y,J,I,A,fe,te,ce]),Rce({...q,delta:z,draggingRect:le,pointerCoordinates:ae,scrollableAncestors:te,scrollableAncestorRects:re});const ve=_r((()=>({active:C,activeNode:F,activeNodeRect:X,activatorEvent:L,collisions:ue,containerNodeRect:B,dragOverlay:K,draggableNodes:x,droppableContainers:A,droppableRects:I,over:fe,measureDroppableContainers:R,scrollableAncestors:te,scrollableAncestorRects:re,measuringConfiguration:U,measuringScheduled:V,windowRect:ee})),[C,F,X,L,ue,B,K,x,A,I,fe,R,te,re,U,V,ee]),_e=_r((()=>({activatorEvent:L,activators:me,active:C,activeNodeRect:X,ariaDescribedById:{draggable:O},dispatch:g,draggableNodes:x,over:fe,measureDroppableContainers:R})),[L,me,C,X,g,O,x,fe,R]);return $n.createElement(J4.Provider,{value:v},$n.createElement(Pm.Provider,{value:_e},$n.createElement(f5.Provider,{value:ve},$n.createElement(d5.Provider,{value:he},c)),$n.createElement(ele,{disabled:!1===(null==o?void 0:o.restoreFocus)})),$n.createElement(tce,{...o,hiddenTextDescribedById:O}))})),sle=Hg(null),sz="button",ile="Draggable";function ole(e){let{id:t,data:r,disabled:n=!1,attributes:a}=e;const i=ny(ile),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=Nd(Pm),{role:p=sz,roleDescription:h="draggable",tabIndex:y=0}=a??{},g=(null==c?void 0:c.id)===t,m=Nd(g?d5:sle),[v,_]=rm(),[k,b]=rm(),w=Bce(o,t),x=Vg(r);Rc((()=>(d.set(t,{id:t,key:i,node:v,activatorNode:k,data:x}),()=>{const e=d.get(t);e&&e.key===i&&d.delete(t)})),[d,t]);return{active:c,activatorEvent:s,activeNodeRect:l,attributes:_r((()=>({role:p,tabIndex:y,"aria-disabled":n,"aria-pressed":!(!g||p!==sz)||void 0,"aria-roledescription":h,"aria-describedby":u.draggable})),[n,p,y,g,h,u.draggable]),isDragging:g,listeners:n?void 0:w,node:v,over:f,setNodeRef:_,setActivatorNodeRef:b,transform:m}}function cle(){return Nd(f5)}const lle="Droppable",ule={timeout:25};function fle(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:a}=e;const i=ny(lle),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=Nd(Pm),u=wt({disabled:r}),d=wt(!1),f=wt(null),p=wt(null),{disabled:h,updateMeasurementsFor:y,timeout:g}={...ule,...a},m=Vg(y??n),v=jm({callback:Qt((()=>{d.current?(null!=p.current&&clearTimeout(p.current),p.current=setTimeout((()=>{l(Array.isArray(m.current)?m.current:[m.current]),p.current=null}),g)):d.current=!0}),[g]),disabled:h||!o}),_=Qt(((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))}),[v]),[k,b]=rm(_),w=Vg(t);return Ze((()=>{!v||!k.current||(v.disconnect(),d.current=!1,v.observe(k.current))}),[k,v]),Ze((()=>(s({type:Qn.RegisterDroppable,element:{id:n,key:i,disabled:r,node:k,rect:f,data:w}}),()=>s({type:Qn.UnregisterDroppable,key:i,id:n}))),[n]),Ze((()=>{r!==u.current.disabled&&(s({type:Qn.SetDroppableDisabled,id:n,key:i,disabled:r}),u.current.disabled=r)}),[n,i,r,s]),{active:o,rect:f,isOver:(null==c?void 0:c.id)===n,node:k,over:c,setNodeRef:b}}function p5(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function dle(e,t){return e.reduce(((e,r,n)=>{const a=t.get(r);return a&&(e[n]=a),e}),Array(e.length))}function My(e){return null!==e&&e>=0}function ple(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function hle(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}const h5=e=>{let{rects:t,activeIndex:r,overIndex:n,index:a}=e;const i=p5(t,n,r),o=t[a],s=i[a];return s&&o?{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}:null},Oy={scaleX:1,scaleY:1},gle=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:a,rects:i,overIndex:o}=e;const s=null!=(t=i[r])?t:n;if(!s)return null;if(a===r){const e=i[o];return e?{x:0,y:r<o?e.top+e.height-(s.top+s.height):e.top-s.top,...Oy}:null}const c=yle(i,a,r);return a>r&&a<=o?{x:0,y:-s.height-c,...Oy}:a<r&&a>=o?{x:0,y:s.height+c,...Oy}:{x:0,y:0,...Oy}};function yle(e,t,r){const n=e[t],a=e[t-1],i=e[t+1];return n?r<t?a?n.top-(a.top+a.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):a?n.top-(a.top+a.height):0:0}const g5="Sortable",y5=$n.createContext({activeIndex:-1,containerId:g5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:h5,disabled:{draggable:!1,droppable:!1}});function mle(e){let{children:t,id:r,items:n,strategy:a=h5,disabled:i=!1}=e;const{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=cle(),d=ny(g5,r),f=null!==s.rect,p=_r((()=>n.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[n]),h=null!=o,y=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,m=wt(p),v=!ple(p,m.current),_=-1!==g&&-1===y||v,k=hle(i);Rc((()=>{v&&h&&u(p)}),[v,p,h,u]),Ze((()=>{m.current=p}),[p]);const b=_r((()=>({activeIndex:y,containerId:d,disabled:k,disableTransforms:_,items:p,overIndex:g,useDragOverlay:f,sortedRects:dle(p,c),strategy:a})),[y,d,k.draggable,k.droppable,_,p,g,c,f,a]);return $n.createElement(y5.Provider,{value:b},t)}const _le=e=>{let{id:t,items:r,activeIndex:n,overIndex:a}=e;return p5(r,n,a).indexOf(t)},vle=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:a,items:i,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!(!l||!n||s!==i&&a===o)&&(!!r||o!==a&&t===c)},wle={duration:200,easing:"ease"},m5="transform",kle=Gg.Transition.toString({property:m5,duration:0,easing:"linear"}),ble={roleDescription:"sortable"};function xle(e){let{disabled:t,index:r,node:n,rect:a}=e;const[i,o]=yt(null),s=wt(r);return Rc((()=>{if(!t&&r!==s.current&&n.current){const e=a.current;if(e){const t=gh(n.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&o(r)}}r!==s.current&&(s.current=r)}),[t,r,n,a]),Ze((()=>{i&&o(null)}),[i]),i}function Ale(e){let{animateLayoutChanges:t=vle,attributes:r,disabled:n,data:a,getNewIndex:i=_le,id:o,strategy:s,resizeObserverConfig:c,transition:l=wle}=e;const{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:h,sortedRects:y,overIndex:g,useDragOverlay:m,strategy:v}=Nd(y5),_=zle(n,p),k=u.indexOf(o),b=_r((()=>({sortable:{containerId:d,index:k,items:u},...a})),[d,a,k,u]),w=_r((()=>u.slice(u.indexOf(o))),[u,o]),{rect:x,node:z,isOver:A,setNodeRef:S}=fle({id:o,data:b,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...c}}),{active:j,activatorEvent:C,activeNodeRect:T,attributes:P,setNodeRef:N,listeners:L,isDragging:E,over:M,setActivatorNodeRef:O,transform:D}=ole({id:o,data:b,attributes:{...ble,...r},disabled:_.draggable}),U=Foe(S,N),I=!!j,R=I&&!h&&My(f)&&My(g),V=!m&&E,F=R?(V&&R?D:null)??(s??v)({rects:y,activeNodeRect:T,activeIndex:f,overIndex:g,index:k}):null,W=My(f)&&My(g)?i({id:o,items:u,activeIndex:f,overIndex:g}):k,q=null==j?void 0:j.id,Z=wt({activeId:q,items:u,newIndex:W,containerId:d}),X=u!==Z.current.items,B=t({active:j,containerId:d,isDragging:E,isSorting:I,id:o,index:k,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:l,wasDragging:null!=Z.current.activeId}),G=xle({disabled:!B,index:k,node:z,rect:x});return Ze((()=>{I&&Z.current.newIndex!==W&&(Z.current.newIndex=W),d!==Z.current.containerId&&(Z.current.containerId=d),u!==Z.current.items&&(Z.current.items=u)}),[I,W,d,u]),Ze((()=>{if(q===Z.current.activeId)return;if(null!=q&&null==Z.current.activeId)return void(Z.current.activeId=q);const e=setTimeout((()=>{Z.current.activeId=q}),50);return()=>clearTimeout(e)}),[q]),{active:j,activeIndex:f,attributes:P,data:b,rect:x,index:k,newIndex:W,items:u,isOver:A,isSorting:I,isDragging:E,listeners:L,node:z,overIndex:g,over:M,setNodeRef:U,setActivatorNodeRef:O,setDroppableNodeRef:S,setDraggableNodeRef:N,transform:G??F,transition:function(){if(G||X&&Z.current.newIndex===k)return kle;if((!V||Hk(C))&&l&&(I||B))return Gg.Transition.toString({...l,property:m5})}()}}function zle(e,t){var r,n;return"boolean"==typeof e?{draggable:e,droppable:!1}:{draggable:null!=(r=null==e?void 0:e.draggable)?r:t.draggable,droppable:null!=(n=null==e?void 0:e.droppable)?n:t.droppable}}function sm(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Sle=[Mt.Down,Mt.Right,Mt.Up,Mt.Left],Cle=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:a,droppableContainers:i,over:o,scrollableAncestors:s}}=t;if(Sle.includes(e.code)){if(e.preventDefault(),!r||!n)return;const t=[];i.getEnabled().forEach((r=>{if(!r||null!=r&&r.disabled)return;const i=a.get(r.id);if(i)switch(e.code){case Mt.Down:n.top<i.top&&t.push(r);break;case Mt.Up:n.top>i.top&&t.push(r);break;case Mt.Left:n.left>i.left&&t.push(r);break;case Mt.Right:n.left<i.left&&t.push(r)}}));const c=sce({active:r,collisionRect:n,droppableRects:a,droppableContainers:t,pointerCoordinates:null});let l=e5(c,"id");if(l===(null==o?void 0:o.id)&&c.length>1&&(l=c[1].id),null!=l){const e=i.get(r.id),t=i.get(l),o=t?a.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&o&&e&&t){const r=Tm(c).some(((e,t)=>s[t]!==e)),a=_5(e,t),i=Tle(e,t),l=r||!a?{x:0,y:0}:{x:i?n.width-o.width:0,y:i?n.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Bg(u,l)}}}};function _5(e,t){return!(!sm(e)||!sm(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Tle(e,t){return!!(sm(e)&&sm(t)&&_5(e,t))&&e.data.current.sortable.index<t.data.current.sortable.index}const jle=({id:e,title:t,description:r,onEditClick:n,onEditSubmit:a,onDelete:i,isReorder:o=!1})=>{const[s,c,l]=Sm(!1),{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:h,isDragging:y}=Ale({id:e||"",disabled:!o}),g=o?{transform:Gg.Translate.toString(p),transition:h}:void 0;return t||r?S.jsxs(S.Fragment,{children:[S.jsx(Z4,{open:s,defaultValues:{label:t,content:r},onSubmit:a,onCloseModal:l}),S.jsxs("div",{ref:o?f:void 0,style:g,className:ct("mb-s flex w-full items-center justify-between gap-m rounded-lg p-s outline outline-1 outline-gray-300",o&&"cursor-grab",y&&"relative z-10 cursor-grabbing border-2 border-blue_100 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.1)]"),...o?{...u,...d}:{},children:[S.jsx("div",{className:"min-w-0 flex-1",children:S.jsx(H4,{title:t,description:r,isDragging:y,dragHandle:o?S.jsx("div",{className:"text-gray-400",children:S.jsx(Noe,{size:20})}):void 0})}),S.jsxs("div",{className:"flex items-center gap-xs",onPointerDown:e=>e.stopPropagation(),children:[S.jsx(gn,{variant:"secondary",size:"s",onClick:e=>{e.preventDefault(),a?c():null==n||n()},disabled:y,children:"Edit"}),i&&S.jsx(gn,{variant:"secondary_danger",size:"icon_s",onClick:i,className:"rounded-s",disabled:y,children:S.jsx(Moe,{size:16})})]})]})]}):null},Ple=({title:e,description:t})=>S.jsxs("div",{className:"mb-m",children:[S.jsx("p",{className:"mb-xxxs text-base font-semibold text-gray-900",children:e}),S.jsx("span",{className:"text-gray-500",children:t})]}),Rle=({form:e,customFields:t,onFieldRemove:r,title:n="Spotlights",description:a="Optional info or links to display on your profile",wrapperClassName:i="my-lg",showHeading:o=!0,children:s})=>{const c=rce(H6(Jk),H6(Kk,{coordinateGetter:Cle}));return S.jsxs("div",{className:i,children:[o&&S.jsx(Ple,{title:n,description:a}),S.jsxs("div",{"data-testid":"customFields",children:[S.jsx(ale,{sensors:c,collisionDetection:ace,onDragEnd:e=>{const{active:r,over:n}=e;if(n&&r.id!==n.id){const e=t.fields.findIndex((e=>e.id===r.id)),a=t.fields.findIndex((e=>e.id===n.id));-1!==e&&-1!==a&&t.move(e,a)}},children:S.jsx(mle,{items:t.fields.map((e=>e.id)),strategy:gle,children:t.fields.map(((n,a)=>{const i=`customFields.${a}.label`,o=`customFields.${a}.content`;return S.jsx(jle,{id:n.id,isReorder:!0,title:e.getValues(i),description:e.getValues(o),onEditSubmit:e=>{t.update(a,e)},onDelete:()=>{t.remove(a),null==r||r()}},n.id)}))})}),s]})]})},Lle=({onAdd:e})=>{const[t,r,n]=Sm(!1);return S.jsxs(S.Fragment,{children:[S.jsx(Z4,{open:t,onSubmit:t=>{e(t),n()},onCloseModal:n}),S.jsxs(gn,{type:"button",variant:"secondary",onClick:e=>{e.stopPropagation(),r()},className:"w-full text-base",children:[S.jsx(Ioe,{size:18,className:"ml-1 hidden md:block",strokeWidth:2}),"Add"]})]})},ay="geo",v5=j8("user"),Ele=()=>"geolocation"in navigator,Nle=({onSuccess:e,onError:t})=>Ele()?navigator.geolocation.getCurrentPosition(e,t):(rn.error("Geolocation is not supported in your browser"),null),w5=()=>{try{const e=v5.getItem(ay);return e?JSON.parse(e):null}catch{return rn.error("Can not get cached geo from localstorage"),null}},k5=e=>{if(!e)return pi.debug(`${ay}: can not get stored geo, userId is missing`),null;const t=w5();return null==t?void 0:t[e]},Ile=e=>!1,b5=(e,t)=>{var r;const n=w5();v5.setItem(ay,JSON.stringify({...n,[e]:{...null==n?void 0:n[e],...t,date:Ile()?null==(r=null==n?void 0:n[e])?void 0:r.date:new Date}}))},x5=(e,t)=>{if(!t)return pi.debug(`${ay}: can not save geo to store, userId is missing`);b5(t,{geo:e})},A5=(e,t)=>{if(!t)return pi.debug(`${ay}: can not save tz to store, userId is missing`);b5(t,{tz:e})},Mle=()=>{const[e]=d8.useLazyGetApiV1UsersRenameHistoryQuery();return async(t,r)=>{var n;if(t===r)return!0;const a=await e().unwrap();return((null==(n=null==a?void 0:a.history)?void 0:n.length)||0)<((null==a?void 0:a.maxRenames)||0)}},Ole=e=>{if(!e)return null;const t=e.getTime();if(Number.isNaN(t))return null;const r=new Date;if(e>r)return null;let n=r.getFullYear()-e.getFullYear();const a=r.getMonth()-e.getMonth();return(a<0||0===a&&r.getDate()<e.getDate())&&n--,n},mw=({tz:e,options:t,seekedValue:r})=>{const n=t.find((t=>t.value===e||t.key===e));return null==n?void 0:n[r]},Dy=e=>null!=e&&e.length?(e||[]).map(((e,t)=>({id:t.toString(),label:e}))):[{id:"1",label:""}],Dle=({user:e,tzList:t,avatarId:r,headerId:n,onSubmit:a,onDirtyChange:i,userNameError:o})=>{var s,c,l,u,d,f,p,h,y,g,m,v;const{Pronouns:_,userFields:k}=Gie({user:e}),b=null!=(s=e.birthday)&&s.date?new Date(e.birthday.date):null,w=(()=>{var t,r;try{const n=null==(r=null==(t=e.fields)?void 0:t.BotProfile)?void 0:r.value;if(!n)return null;const a=JSON.parse(n);return a&&"object"==typeof a&&null!==a?a:null}catch{return null}})();Ze((()=>{o&&z.setError("userName",{message:o})}),[o]);const x={Pronouns:_,avatarId:r,headerId:n,channel:e.channel||!1,actorType:e.actorType||"Person",summary:e.summary,userName:e.username,displayName:Ow(e.displayName),customFields:qie(k),location:{geo:null==(c=e.location)?void 0:c.geo,name:(null==(l=e.location)?void 0:l.name)||"",show:!(null==(u=e.location)||!u.show),autoUpdate:!(null==(d=e.location)||!d.autoUpdate)},timezone:{show:!(null==(f=e.timezone)||!f.show),ianaTimezone:mw({options:t,tz:(null==(p=e.timezone)?void 0:p.ianaTimezone)||"",seekedValue:"key"}),autoUpdate:!(null==(h=e.timezone)||!h.autoUpdate)},birthday:{show:"NONE"!==(null==(y=e.birthday)?void 0:y.show),dateOnly:"DATE"===(null==(g=e.birthday)?void 0:g.show),date:b},botProfile:{role:(null==w?void 0:w.role)||"",triggers:Dy(null==w?void 0:w.triggers),personality_traits:Dy(null==w?void 0:w.personality_traits),tone:(null==w?void 0:w.tone)||"",style:Dy(null==w?void 0:w.style),behaviors:Dy(null==w?void 0:w.behaviors),prompt:(null==w?void 0:w.prompt)||""},canSubmit:!0},z=$w({defaultValues:x,schema:yS()}),A=cg({control:z.control,name:"customFields"}),S=cg({control:z.control,name:"botProfile.triggers"}),j=cg({control:z.control,name:"botProfile.personality_traits"}),C=cg({control:z.control,name:"botProfile.style"}),T=cg({control:z.control,name:"botProfile.behaviors"});Ze((()=>{z.reset(x)}),[e.id]),Ze((()=>{null==i||i(z.formState.isDirty)}),[z.formState.isDirty]),Ze((()=>{var t;const r=null==(t=e.location)?void 0:t.name;r&&z.setValue("location.name",r)}),[null==(m=e.location)?void 0:m.name]),Ze((()=>{var r;const n=null==(r=e.timezone)?void 0:r.ianaTimezone;n&&z.setValue("timezone.ianaTimezone",mw({options:t,tz:n,seekedValue:"key"}))}),[null==(v=e.timezone)?void 0:v.ianaTimezone]);const P=()=>{var r,n,i,o,s;const{displayName:c,userName:l,summary:u="",Pronouns:d="",customFields:f,timezone:p,birthday:h,location:y,avatarId:g,headerId:m,channel:v,actorType:_,botProfile:k}=z.getValues(),b={...y,geo:y.autoUpdate&&y.geo?y.geo:null},w={username:l.trim(),displayName:Ow(c),summary:u,timezone:{...p,ianaTimezone:mw({options:t,tz:p.ianaTimezone||"",seekedValue:"value"})||""},avatarId:g,headerId:m,channel:v,actorType:_,birthday:{date:null==(r=h.date)?void 0:r.toISOString(),show:h.show?h.dateOnly?"DATE":"FULL":"NONE"},location:b,fields:{Pronouns:{value:d},...Oie(f),...k&&"Service"===_&&{BotProfile:{value:JSON.stringify({name:l,location:b.name,bio:u,age:Ole(h.date||null),role:null==k?void 0:k.role,triggers:null==(n=null==k?void 0:k.triggers)?void 0:n.map((e=>e.label)).filter(Boolean),personality_traits:null==(i=null==k?void 0:k.personality_traits)?void 0:i.map((e=>e.label)).filter(Boolean),tone:null==k?void 0:k.tone,style:null==(o=null==k?void 0:k.style)?void 0:o.map((e=>e.label)).filter(Boolean),behaviors:null==(s=null==k?void 0:k.behaviors)?void 0:s.map((e=>e.label)).filter(Boolean),prompt:null==k?void 0:k.prompt})}}}};y.autoUpdate&&y.geo&&x5(y.geo,e.id),p.autoUpdate&&p.ianaTimezone&&A5(p.ianaTimezone,e.id),a(w);const x=z.getValues();z.reset({...x,displayName:w.displayName})},N=Mle();return[z,async()=>{await N(z.getValues().userName,x.userName)?z.handleSubmit(P)():rn.error("You have reached the maximum number of username changes allowed")},({shouldDirty:e=!0,...t})=>{null!=t&&t.avatar&&z.setValue("avatarId",t.avatar.uploadId,{shouldDirty:e}),null!=t&&t.header&&z.setValue("headerId",t.header.uploadId,{shouldDirty:e})},A,S,j,C,T]};var iz,Vy={exports:{}},Ule=Vy.exports;function qle(){return iz||(iz=1,Vy.exports=function(e,t,r){t.prototype.isToday=function(){var e="YYYY-MM-DD",t=r();return this.format(e)===t.format(e)}}),Vy.exports}var Wle=qle();const z5=Ud(Wle),Fle=e=>{const t=new Set;return null==e?void 0:e.filter((e=>!t.has(e.value)&&(t.add(e.value),!0)))},S5=()=>{const{data:e}=U5(),t=null==e?void 0:e.map((e=>{const t=e.utc.find((e=>!e.startsWith("Etc/")));if(t)return{key:e.text,value:t}})).filter(Boolean);return Fle(t)};Ol.extend(z5);const Vle=()=>{var e;const t=mt(pa.selectors.selectUser),r=null==t?void 0:t.id,n=k5(r),a=S5(),i=h8(),o=e=>{var t;const r=(new Date).getTimezoneOffset(),n=`UTC${r>0?"-":"+"}${Math.abs(Math.floor(r/60)).toString().padStart(2,"0")}:${Math.abs(r%60).toString().padStart(2,"0")}`,i=null==(t=null==a?void 0:a.find((e=>e.key.includes(n))))?void 0:t.value;return i||pi.warn(`Can not not find matched tz in list ${JSON.stringify(a)} for ${n}`),null==e||e(i),i},s=e=>{var n,a;if(!t||!e)return;const{username:o,displayName:s,summary:c,fields:l}=t,u=t;i({userId:t.id,data:{username:o,displayName:s,fields:l,summary:c,avatarId:(null==(n=t.avatar)?void 0:n.uploadId)||null,headerId:(null==(a=t.header)?void 0:a.uploadId)||null,channel:u.channel||!1,actorType:u.actorType||null,location:t.location||null,birthday:t.birthday||null,timezone:{...t.timezone,ianaTimezone:e}}}),A5(e,r)};return Ze((()=>{var e;const r=!(null!=n&&n.date&&Ol(n.date).isToday()),a=(null==(e=null==t?void 0:t.timezone)?void 0:e.autoUpdate)&&(r||!(null!=n&&n.tz));a&&pi.debug("Update tz:",{storedGeo:n},{isOutdated:r}),a&&o(s)}),[null==(e=null==t?void 0:t.timezone)?void 0:e.autoUpdate,null==n?void 0:n.date]),{options:a,getUserTz:o}};function Gw(e,t,r=window){const n=wt(t);Ze((()=>{n.current=t}),[t]),Ze((()=>{if(!r)return;const t=e=>n.current(e);return r.addEventListener(e,t),()=>{r.removeEventListener(e,t)}}),[e,r])}const Ble=(e,t)=>{const r=wt(t);Ze((()=>{r.current=t}),[t]);Gw(null!==document.ontouchstart?"mousedown":"touchstart",(({target:t})=>{!e.current||e.current.contains(t)||r.current(t)}),document.body)},Gle=44,Xle=60,Hle=300,C5=({form:e,icon:t,name:r,list:n,canInput:a=!0,displayName:i,maxChars:o,currentValue:s,renderChildren:c,onFieldChange:l,disabled:u,debounceMs:d=300,minLength:f=2,inputClassName:p,itemClassName:h,testId:y})=>{const[g,m]=yt(""),[v,_]=yt(!1);Ze((()=>{const e=setTimeout((()=>{const e=g.trim();e.length>=f&&l(e)}),d);return()=>clearTimeout(e)}),[g,d,f,l]);const k=(n&&n.length>0||!!c)&&v&&!u,b=wt(null);return Ble(b,(()=>_(!1))),S.jsxs("div",{ref:b,"data-testid":y,onMouseDown:()=>{u||_(!0)},children:[S.jsx(Wn,{control:e.control,icon:t,name:r,displayName:i,maxChars:o,onFieldChange:e=>m(String(e)),onFocus:()=>_(!0),className:"mb-s md:mb-xxs w-full",inputClassName:p,disabled:u,readOnly:u||!a}),k&&S.jsxs("ul",{className:"p-xxs absolute left-0 top-[calc(100%+8px)] z-[1] w-full overflow-scroll rounded-lg border border-gray-200 bg-white shadow-[0px_0px_12px_0px_rgba(0,0,0,0.08)]",style:{height:Math.min(((null==n?void 0:n.length)||1)*(1===((null==n?void 0:n.length)||0)?60:44),300)},children:[S.jsx(oz,{className:h,children:null==c?void 0:c((()=>_(!1)))}),null==n?void 0:n.map((t=>S.jsx(oz,{onClick:()=>{e.setValue(r,t.key,{shouldDirty:!0}),_(!1)},isChecked:s===t.key,className:h,children:t.label},t.key)))]})]})},oz=({isChecked:e,onClick:t,children:r,className:n})=>S.jsxs("li",{onClick:t,className:ct("p-xxs my-xxxs rounded-m flex cursor-pointer items-center justify-between text-base font-medium text-gray-900 first:mt-0 last:mb-0 empty:hidden hover:bg-gray-100",n),children:[r,e&&S.jsx(C7,{size:20})]}),cz=[{key:"public",label:"Public",icon:S.jsx(HC,{}),description:"Visible to everyone"},{key:"private",label:"Private",icon:S.jsx(YC,{}),description:"Only you can see"}],Qk=({isPublic:e,children:t,onChange:r})=>{const n=e?"public":"private",a=cz.find((e=>e.key===n));return S.jsx("div",{className:"right-xxs top-xl absolute",children:S.jsxs(lm,{children:[S.jsx(um,{asChild:!0,children:S.jsxs(gn,{variant:"secondary",size:"s",className:"gap-xxxs p-xxs flex [&>svg]:size-4",children:[null==a?void 0:a.icon,null==a?void 0:a.label,S.jsx(GC,{})]})}),S.jsxs(fm,{align:"end",alignOffset:-10,sideOffset:15,className:"w-[300px]",children:[cz.map((e=>S.jsxs(By,{className:"p-xxs [&_svg]:size-xxs flex cursor-pointer items-center justify-between",onClick:()=>r(e.key),children:[S.jsxs("div",{className:"gap-xxs flex items-start",children:[e.icon,S.jsxs("div",{children:[S.jsx("div",{className:"mb-xxxs font-medium text-gray-900",children:e.label}),S.jsx("div",{className:"font-normal text-gray-500",children:e.description})]})]}),e.key===n&&S.jsx(M8,{})]},e.key))),t&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"my-xxs -ml-xxs h-[1px] w-[calc(100%+16px)] bg-gray-200"}),S.jsx(By,{children:t})]})]})]})})},Zle=({form:e})=>{const{options:t,getUserTz:r}=Vle(),n=t=>{e.setValue("timezone.ianaTimezone",t,{shouldDirty:!0})},a=!!e.watch("timezone.ianaTimezone");return t?S.jsxs("div",{className:"relative my-5","data-testid":"tz",children:[S.jsx(C5,{form:e,name:"timezone.ianaTimezone",displayName:"Timezone",maxChars:Cc.timezone,onFieldChange:n,list:t.map((e=>({key:e.key,label:e.key}))),canInput:!1,icon:S.jsx(D8,{}),disabled:!!e.watch("timezone.autoUpdate"),inputClassName:"pr-[120px]",currentValue:e.watch("timezone.ianaTimezone"),itemClassName:"first:hover:bg-inherit"}),a&&S.jsx(Qk,{isPublic:e.watch("timezone.show"),onChange:t=>{e.setValue("timezone.show","public"===t,{shouldDirty:!0})}}),S.jsx(Wn,{isSwitch:!0,name:"timezone.autoUpdate",control:e.control,onFieldChange:()=>{const e=r();e&&n(e)},displayName:"Set timezone automatically",className:"mb-xs mt-xxs md:mb-0"})]}):null};function im(e){return(im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Od(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function ys(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Ec(e){ys(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===im(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):(("string"==typeof e||"[object String]"===t)&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function Kle(e,t){ys(2,arguments);var r=Ec(e).getTime(),n=Od(t);return new Date(r+n)}var Yle={};function Rm(){return Yle}function Jle(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Qle(e){return ys(1,arguments),e instanceof Date||"object"===im(e)&&"[object Date]"===Object.prototype.toString.call(e)}function $le(e){if(ys(1,arguments),!Qle(e)&&"number"!=typeof e)return!1;var t=Ec(e);return!isNaN(Number(t))}function eue(e,t){return ys(2,arguments),Kle(e,-Od(t))}var tue=864e5;function rue(e){ys(1,arguments);var t=Ec(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=r-t.getTime();return Math.floor(n/tue)+1}function om(e){ys(1,arguments);var t=Ec(e),r=t.getUTCDay(),n=(r<1?7:0)+r-1;return t.setUTCDate(t.getUTCDate()-n),t.setUTCHours(0,0,0,0),t}function T5(e){ys(1,arguments);var t=Ec(e),r=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var a=om(n),i=new Date(0);i.setUTCFullYear(r,0,4),i.setUTCHours(0,0,0,0);var o=om(i);return t.getTime()>=a.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function nue(e){ys(1,arguments);var t=T5(e),r=new Date(0);return r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0),om(r)}var aue=6048e5;function sue(e){ys(1,arguments);var t=Ec(e),r=om(t).getTime()-nue(t).getTime();return Math.round(r/aue)+1}function cm(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Rm(),d=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==a?a:u.weekStartsOn)&&void 0!==n?n:null===(c=u.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.weekStartsOn)&&void 0!==r?r:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ec(e),p=f.getUTCDay(),h=(p<d?7:0)+p-d;return f.setUTCDate(f.getUTCDate()-h),f.setUTCHours(0,0,0,0),f}function j5(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Ec(e),d=u.getUTCFullYear(),f=Rm(),p=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==a?a:f.firstWeekContainsDate)&&void 0!==n?n:null===(c=f.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==r?r:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,p),h.setUTCHours(0,0,0,0);var y=cm(h,t),g=new Date(0);g.setUTCFullYear(d,0,p),g.setUTCHours(0,0,0,0);var m=cm(g,t);return u.getTime()>=y.getTime()?d+1:u.getTime()>=m.getTime()?d:d-1}function iue(e,t){var r,n,a,i,o,s,c,l;ys(1,arguments);var u=Rm(),d=Od(null!==(r=null!==(n=null!==(a=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==a?a:u.firstWeekContainsDate)&&void 0!==n?n:null===(c=u.locale)||void 0===c||null===(l=c.options)||void 0===l?void 0:l.firstWeekContainsDate)&&void 0!==r?r:1),f=j5(e,t),p=new Date(0);return p.setUTCFullYear(f,0,d),p.setUTCHours(0,0,0,0),cm(p,t)}var oue=6048e5;function cue(e,t){ys(1,arguments);var r=Ec(e),n=cm(r,t).getTime()-iue(r,t).getTime();return Math.round(n/oue)+1}function gr(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return r+n}var lf={y:function(e,t){var r=e.getUTCFullYear(),n=r>0?r:1-r;return gr("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):gr(r+1,2)},d:function(e,t){return gr(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return gr(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gr(e.getUTCHours(),t.length)},m:function(e,t){return gr(e.getUTCMinutes(),t.length)},s:function(e,t){return gr(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return gr(Math.floor(n*Math.pow(10,r-3)),t.length)}},Qp={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},lue={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return lf.y(e,t)},Y:function(e,t,r,n){var a=j5(e,n),i=a>0?a:1-a;return"YY"===t?gr(i%100,2):"Yo"===t?r.ordinalNumber(i,{unit:"year"}):gr(i,t.length)},R:function(e,t){return gr(T5(e),t.length)},u:function(e,t){return gr(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return gr(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return gr(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return lf.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return gr(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var a=cue(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):gr(a,t.length)},I:function(e,t,r){var n=sue(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):gr(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):lf.d(e,t)},D:function(e,t,r){var n=rue(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):gr(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var a=e.getUTCDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return gr(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var a=e.getUTCDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return gr(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return gr(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,a=e.getUTCHours();switch(n=12===a?Qp.noon:0===a?Qp.midnight:a/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,a=e.getUTCHours();switch(n=a>=17?Qp.evening:a>=12?Qp.afternoon:a>=4?Qp.morning:Qp.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return lf.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):lf.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):gr(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):gr(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):lf.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):lf.s(e,t)},S:function(e,t){return lf.S(e,t)},X:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return uz(a);case"XXXX":case"XX":return Pd(a);default:return Pd(a,":")}},x:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return uz(a);case"xxxx":case"xx":return Pd(a);default:return Pd(a,":")}},O:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+lz(a,":");default:return"GMT"+Pd(a,":")}},z:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+lz(a,":");default:return"GMT"+Pd(a,":")}},t:function(e,t,r,n){var a=n._originalDate||e;return gr(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,r,n){return gr((n._originalDate||e).getTime(),t.length)}};function lz(e,t){var r=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),i=n%60;if(0===i)return r+String(a);var o=t;return r+String(a)+o+gr(i,2)}function uz(e,t){return e%60==0?(e>0?"-":"+")+gr(Math.abs(e)/60,2):Pd(e,t)}function Pd(e,t){var r=t||"",n=e>0?"-":"+",a=Math.abs(e);return n+gr(Math.floor(a/60),2)+r+gr(a%60,2)}var fz=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},P5=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},uue=function(e,t){var r,n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return fz(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",fz(a,t)).replace("{{time}}",P5(i,t))},fue={p:P5,P:uue},due=["D","DD"],pue=["YY","YYYY"];function hue(e){return-1!==due.indexOf(e)}function gue(e){return-1!==pue.indexOf(e)}function dz(e,t,r){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var yue={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},mue=function(e,t,r){var n,a=yue[e];return n="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),null!=r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function _w(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var _ue={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},vue={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},wue={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},kue={date:_w({formats:_ue,defaultWidth:"full"}),time:_w({formats:vue,defaultWidth:"full"}),dateTime:_w({formats:wue,defaultWidth:"full"})},bue={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},xue=function(e,t,r,n){return bue[e]};function dg(e){return function(t,r){var n;if("formatting"===(null!=r&&r.context?String(r.context):"standalone")&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,i=null!=r&&r.width?String(r.width):a;n=e.formattingValues[i]||e.formattingValues[a]}else{var o=e.defaultWidth,s=null!=r&&r.width?String(r.width):e.defaultWidth;n=e.values[s]||e.values[o]}return n[e.argumentCallback?e.argumentCallback(t):t]}}var Aue={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Sue={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Cue={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Tue={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},jue={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Pue=function(e,t){var r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Rue={ordinalNumber:Pue,era:dg({values:Aue,defaultWidth:"wide"}),quarter:dg({values:zue,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:dg({values:Sue,defaultWidth:"wide"}),day:dg({values:Cue,defaultWidth:"wide"}),dayPeriod:dg({values:Tue,defaultWidth:"wide",formattingValues:jue,defaultFormattingWidth:"wide"})};function pg(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;var o,s=i[0],c=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(c)?Eue(c,(function(e){return e.test(s)})):Lue(c,(function(e){return e.test(s)}));return o=e.valueCallback?e.valueCallback(l):l,{value:o=r.valueCallback?r.valueCallback(o):o,rest:t.slice(s.length)}}}function Lue(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function Eue(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return r}function Nue(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(e.matchPattern);if(!n)return null;var a=n[0],i=t.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:o=r.valueCallback?r.valueCallback(o):o,rest:t.slice(a.length)}}}var Iue=/^(\d+)(th|st|nd|rd)?/i,Mue=/\d+/i,Oue={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Due={any:[/^b/i,/^(a|c)/i]},Uue={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},que={any:[/1/i,/2/i,/3/i,/4/i]},Wue={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Fue={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Vue={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Bue={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Gue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Xue={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Hue={ordinalNumber:Nue({matchPattern:Iue,parsePattern:Mue,valueCallback:function(e){return parseInt(e,10)}}),era:pg({matchPatterns:Oue,defaultMatchWidth:"wide",parsePatterns:Due,defaultParseWidth:"any"}),quarter:pg({matchPatterns:Uue,defaultMatchWidth:"wide",parsePatterns:que,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:pg({matchPatterns:Wue,defaultMatchWidth:"wide",parsePatterns:Fue,defaultParseWidth:"any"}),day:pg({matchPatterns:Vue,defaultMatchWidth:"wide",parsePatterns:Bue,defaultParseWidth:"any"}),dayPeriod:pg({matchPatterns:Gue,defaultMatchWidth:"any",parsePatterns:Xue,defaultParseWidth:"any"})},Zue={code:"en-US",formatDistance:mue,formatLong:kue,formatRelative:xue,localize:Rue,match:Hue,options:{weekStartsOn:0,firstWeekContainsDate:1}},Kue=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Yue=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jue=/^'([^]*?)'?$/,Que=/''/g,$ue=/[a-zA-Z]/;function jd(e,t,r){var n,a,i,o,s,c,l,u,d,f,p;ys(2,arguments);var h=String(t),y=Rm(),g=null!==(n=y.locale)&&void 0!==n?n:Zue,m=Od(null!==(a=null!==(i=null!==(o=void 0)&&void 0!==o?o:y.firstWeekContainsDate)&&void 0!==i?i:null===(s=y.locale)||void 0===s||null===(c=s.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==a?a:1);if(!(m>=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=Od(null!==(l=null!==(u=null!==(d=void 0)&&void 0!==d?d:y.weekStartsOn)&&void 0!==u?u:null===(f=y.locale)||void 0===f||null===(p=f.options)||void 0===p?void 0:p.weekStartsOn)&&void 0!==l?l:0);if(!(v>=0&&v<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!g.localize)throw new RangeError("locale must contain localize property");if(!g.formatLong)throw new RangeError("locale must contain formatLong property");var _=Ec(e);if(!$le(_))throw new RangeError("Invalid time value");var k=eue(_,Jle(_)),b={firstWeekContainsDate:m,weekStartsOn:v,locale:g,_originalDate:_};return h.match(Yue).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,fue[t])(e,g.formatLong):e})).join("").match(Kue).map((function(r){if("''"===r)return"'";var n=r[0];if("'"===n)return efe(r);var a=lue[n];if(a)return gue(r)&&dz(r,t,String(e)),hue(r)&&dz(r,t,String(e)),a(k,r,g.localize,b);if(n.match($ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return r})).join("")}function efe(e){var t=e.match(Jue);return t?t[1].replace(Que,"'"):e}const tfe=(e,t,r)=>{if("single"===e)return t?jd(t,"PPP"):r;if("range"===e){const e=t;return null!=e&&e.from?e.to?`${jd(e.from,"MMM dd")} - ${jd(e.to,"MMM dd, yyyy")}`:jd(e.from,"PPP"):r}if("multiple"===e){const e=t;return e&&0!==e.length?1===e.length?jd(e[0],"PPP"):2===e.length?`${jd(e[0],"MMM dd")}, ${jd(e[1],"MMM dd")}`:`${e.length} dates selected`:r}return r},pz=(e,t)=>{if("single"===e)return t||new Date;if("range"===e)return(null==t?void 0:t.from)||new Date;if("multiple"===e){const e=t;return e&&e.length>0?e[0]:new Date}return new Date},rfe=(e,t)=>{if("single"===e)return!!t;if("range"===e)return!(null==t||!t.from);if("multiple"===e){return!!(t&&t.length>0)}return!1},nfe=(e,t)=>"range"===e&&2===t?"max-w-[670px]":"max-w-[330px]",afe=({mode:e,tempValue:t,handleCancel:r,handleApply:n})=>{const a=rfe(e,t);return S.jsxs("div",{className:ct("pb-xxxs py-xs px-s gap-xs flex","range"===e?"justify-end":"justify-between"),children:[S.jsx(gn,{variant:"secondary",className:ct({"flex-1":"range"!==e}),size:"m",onClick:r,children:"Cancel"}),S.jsx(gn,{variant:"primary",className:ct({"flex-1":"range"!==e}),size:"m",onClick:n,disabled:!a,children:"Apply"})]})},R5=Lc((({value:e,placeholder:t,className:r,icon:n,...a},i)=>{const o=tfe(e?Array.isArray(e)?"multiple":"object"==typeof e&&"from"in e?"range":"single":"single",e,t);return S.jsxs(gn,{ref:i,variant:"secondary",className:ct("rounded-m py-l w-[280px] justify-between border border-gray-200 bg-white text-left font-normal text-gray-900",r),...a,children:[S.jsxs("span",{className:"gap-xxs flex items-center",children:[n||S.jsx(x7,{size:16}),o]}),S.jsx(j7,{size:16,className:"ml-xxs"})]})}));R5.displayName="DatePickerTrigger";const sfe=(e,t)=>(r,n)=>{const a="months"===r?Ol(e).month(n).toDate():Ol(e).year(n).toDate();t(a)},ife=(e,t,r,n)=>()=>{("single"===e||"range"===e||"multiple"===e)&&(null==r||r(t)),null==n||n(!1)},ofe=(e,t,r)=>()=>{t(e),null==r||r(!1)},cfe=(e,t)=>r=>{"single"===e&&t(r)},lfe=(e,t)=>r=>{"range"===e&&t(r)},ufe=(e,t)=>r=>{"multiple"===e&&t(r)};var vw,hz,ww,gz,kw,yz;function ffe(){if(hz)return vw;hz=1;var e=gs();return vw=function(){return e.Date.now()}}function dfe(){if(gz)return ww;gz=1;var e=Dl(),t=ffe(),r=u4(),n=Math.max,a=Math.min;return ww=function(i,o,s){var c,l,u,d,f,p,h=0,y=!1,g=!1,m=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function v(e){var t=c,r=l;return c=l=void 0,h=e,d=i.apply(r,t)}function _(e){var t=e-p;return void 0===p||t>=o||t<0||g&&e-h>=u}function k(){var e=t();if(_(e))return b(e);f=setTimeout(k,function(e){var t=o-(e-p);return g?a(t,u-(e-h)):t}(e))}function b(e){return f=void 0,m&&c?v(e):(c=l=void 0,d)}function w(){var e=t(),r=_(e);if(c=arguments,l=this,p=e,r){if(void 0===f)return function(e){return h=e,f=setTimeout(k,o),y?v(e):d}(p);if(g)return clearTimeout(f),f=setTimeout(k,o),v(p)}return void 0===f&&(f=setTimeout(k,o)),d}return o=r(o)||0,e(s)&&(y=!!s.leading,u=(g="maxWait"in s)?n(r(s.maxWait)||0,o):u,m="trailing"in s?!!s.trailing:m),w.cancel=function(){void 0!==f&&clearTimeout(f),h=0,c=p=l=f=void 0},w.flush=function(){return void 0===f?d:b(t())},w},ww}function pfe(){if(yz)return kw;yz=1;var e=I4()("debounce",dfe());return e.placeholder=Qw(),kw=e}var hfe=pfe();const gfe=Ud(hfe),yfe=e=>{const t=gfe(150)(e);Gw("resize",t),Gw("orientationchange",t)},mfe=(e=1e3)=>{const[t,r]=yt((()=>!(typeof window>"u")&&window.innerWidth<e));return yfe((()=>{r(window.innerWidth<e)})),{isSmallScreen:t,isLargeScreen:!t}},_fe=({mode:e,icon:t,value:r,onSelect:n,trigger:a,placeholder:i=("range"===e?"Pick a date range":"multiple"===e?"Pick multiple dates":"Pick a date"),disabled:o,className:s,numberOfMonths:c=("range"===e?2:1),...l})=>{const[u,d]=yt(!1),[f,p]=yt(void 0),[h,y]=yt("calendar"),{isSmallScreen:g}=mfe(1e3),[m,v]=yt((()=>pz(e,r)));Ze((()=>{p(r),v(pz(e,r))}),[e,r]);const _="range"===e&&g?1:c,k=sfe(m,v),b=ife(e,f,n,d),w=ofe(r,p,d),x=cfe(e,p),z=lfe(e,p),A=ufe(e,p),j=a?B5(a)?G5(a,{value:r}):a:S.jsx(R5,{icon:t,value:r,placeholder:i,className:s}),C=nfe(e,_),T={...l,disabled:o,month:m,startMonth:new Date(1900,0),endMonth:new Date(2200,11),onMonthChange:v,numberOfMonths:_,footer:!0,dropdownMode:h,onDropdownModeChange:y,onMonthYearSelect:k,components:{Footer:()=>S.jsx(afe,{mode:e,tempValue:f,handleCancel:w,handleApply:b})}};return S.jsxs(a7,{open:u,onOpenChange:d,children:[S.jsx(s7,{asChild:!0,children:j}),S.jsx(i7,{className:ct(C,"p-none"),align:"center",children:"single"===e?S.jsx(o1,{...T,mode:"single",selected:f,onSelect:x,captionLayout:"dropdown"}):"range"===e?S.jsx(o1,{...T,mode:"range",selected:f,onSelect:z,captionLayout:"label"}):S.jsx(o1,{...T,mode:"multiple",selected:f,onSelect:A,captionLayout:"dropdown"})})]})},vfe=({form:e})=>{const t=!!e.watch("birthday.date");return S.jsxs("div",{className:"relative my-5 text-sm font-medium text-gray-700","data-testid":"bDay",children:[S.jsx("div",{className:"mb-xxs",children:S.jsx(W4,{displayName:"Birthday"})}),S.jsx(_fe,{mode:"single",icon:S.jsx(BC,{size:20}),className:"rounded-m outline-input ring-offset-background placeholder:text-muted-foreground focus-visible:outline-blue_120 min-h-xxxl flex w-full px-4 py-3.5 text-base text-gray-900 outline outline-1 transition-all duration-200 hover:bg-transparent hover:outline-2 hover:outline-gray-400 disabled:cursor-not-allowed disabled:text-gray-300 disabled:outline-gray-200",value:e.watch("birthday.date")||void 0,placeholder:"Select your birthday date",disabled:e=>{const t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return new Date(e.getFullYear(),e.getMonth(),e.getDate())>=r},onSelect:t=>e.setValue("birthday.date",t,{shouldDirty:!0})}),t&&S.jsx(Qk,{isPublic:e.watch("birthday.show"),onChange:t=>{e.setValue("birthday.show","public"===t,{shouldDirty:!0})},children:S.jsxs("label",{className:"relative flex w-full cursor-pointer items-center justify-between",onClick:e=>e.stopPropagation(),children:["Show only month and date",S.jsx(Ez,{checked:e.watch("birthday.dateOnly"),onCheckedChange:t=>{e.setValue("birthday.dateOnly",t,{shouldDirty:!0})}})]})})]})};Ol.extend(z5);const wfe=e=>{var t;const r=mt(pa.selectors.selectUser),n=null==r?void 0:r.id,a=k5(n),i=h8(),o=t=>{var a,o;if(!r)return;const{username:s,displayName:c,summary:l,fields:u}=r;i({userId:r.id,data:{username:s,displayName:c,fields:u,summary:l,timezone:r.timezone||null,birthday:r.birthday||null,avatarId:(null==(a=r.avatar)?void 0:a.uploadId)||null,headerId:(null==(o=r.header)?void 0:o.uploadId)||null,channel:r.channel||!1,actorType:r.actorType||null,location:{...r.location,geo:t}}}),null==e||e(!1),x5(t,n)},s=t=>{null==e||e(!0),Nle({onSuccess:e=>{t(e.coords)},onError:t=>{null==e||e(!1),rn.error(`Update location error: ${t.message}`)}})};return Ze((()=>{var e;const t=!(null!=a&&a.date&&Ol(a.date).isToday()),n=(null==(e=null==r?void 0:r.location)?void 0:e.autoUpdate)&&(t||!(null!=a&&a.geo));n&&pi.debug("Update geo:",{storedGeo:a},{isOutdated:t}),n&&s(o)}),[null==(t=null==r?void 0:r.location)?void 0:t.autoUpdate,null==a?void 0:a.date]),s},kfe=({form:e})=>{const[t,r]=yt(!1),[n]=bS(),a=async t=>{if(t.latitude&&t.longitude)try{const{data:r}=await n({latitude:t.latitude,longitude:t.longitude});e.setValue("location.name",(r??"").replace(/"/g,""))}catch(e){pi.error(`GEO convertion error: ${e}`)}e.setValue("location.geo",t),r(!1)},i=wfe(r);Ze((()=>{e.setValue("canSubmit",!t,{shouldDirty:!0})}),[t]);const[o,s]=yt(""),{data:c}=q5({text:o},{skip:o.trim().length<2}),l=c&&c.length>0?c.map((e=>e.formatted)):[],u=!!e.watch("location.name");return S.jsxs("div",{className:"my-m relative","data-testid":"location",children:[S.jsx(C5,{form:e,name:"location.name",displayName:"Location",maxChars:Cc.location,onFieldChange:s,list:l.map((e=>({key:e,label:e}))),icon:S.jsx($C,{}),disabled:!!e.watch("location.autoUpdate"),inputClassName:"pr-[120px]",currentValue:e.watch("location.name")}),u&&S.jsx(Qk,{isPublic:e.watch("location.show"),onChange:t=>{e.setValue("location.show","public"===t,{shouldDirty:!0})}}),S.jsx(Wn,{isSwitch:!0,name:"location.autoUpdate",control:e.control,onFieldChange:()=>{const t=e.getValues("location");(null==t?void 0:t.autoUpdate)&&i(a)},displayName:"Set location automatically",className:"mb-xs md:mb-0"})]})},Lm=({onClick:e,text:t="Add"})=>S.jsxs(gn,{type:"button",variant:"secondary",onClick:t=>{t.stopPropagation(),e()},className:"w-full text-base",children:[S.jsx(gm,{size:18,className:"ml-1 hidden md:block",strokeWidth:2}),t]}),Em=({onClick:e,className:t})=>S.jsxs("div",{className:ct("flex cursor-pointer items-center justify-center text-gray-200 hover:text-gray-300 md:size-10",t),onClick:e,children:[S.jsx(aT,{className:"hidden md:block"}),S.jsx("span",{className:"text-blue_100 text-sm font-semibold md:hidden",children:"Delete"})]}),mz=[{id:1,label:"conversation about democratic decline"},{id:2,label:"questions about historical precedents"},{id:3,label:"mentions of anocracy, authoritarianism, or regime transitions"}],bfe=5,xfe=({form:e,botTriggers:t})=>S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Triggers"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.triggers.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Trigger ${n+1}`,placeholder:(null==(a=mz[n])?void 0:a.label)||(null==(i=mz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`trigger${t.fields.length+1}`,label:""})})]}),_z=[{id:1,label:"calm"},{id:2,label:"measured"},{id:3,label:"scholarly"},{id:4,label:"fact-driven"}],Afe=5,zfe=({form:e,botPersonalityTraits:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Personality traits"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.personality_traits.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Personality trait ${n+1}`,placeholder:(null==(a=_z[n])?void 0:a.label)||(null==(i=_z[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`personality_trait${t.fields.length+1}`,label:""})})]})}),Sfe=({form:e})=>S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.tone",displayName:"Tone",placeholder:"Measured and formal, yet accessible. Avoids slang."})}),vz=[{id:1,label:"Uses historical analogies and political science terminology. Explains patterns of erosion and decay."},{id:2,label:"Employs witty humor and pop culture references. Makes complex topics accessible through relatable examples."},{id:3,label:"Adopts a philosophical and contemplative tone. Explores deeper meanings and existential questions."},{id:4,label:"Uses technical jargon and analytical frameworks. Breaks down concepts into systematic components."}],Cfe=5,Tfe=({form:e,botStyles:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Bot styles"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.style.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Bot style ${n+1}`,placeholder:(null==(a=vz[n])?void 0:a.label)||(null==(i=vz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`style${t.fields.length+1}`,label:""})})]})}),wz=[{id:1,label:"Reference historical examples like Weimar Republic, Chile, or post-Soviet states."},{id:2,label:"Frame modern events within a long historical timeline."},{id:3,label:"Avoid partisan statements; speak in systems language."},{id:4,label:"Prioritize education over debate."}],jfe=5,Pfe=({form:e,botBehaviors:t})=>S.jsx("div",{className:"my-4 ",children:S.jsxs("div",{className:"my-4 ",children:[S.jsx(Zg,{className:"mb-l block text-base",children:"Bot behaviors"}),t.fields.map(((r,n)=>{var a,i;const o=`botProfile.behaviors.${n}.label`;return S.jsxs("div",{className:"mb-xs flex items-center justify-between gap-4 [&>:first-child]:flex-1",children:[S.jsx(Wn,{name:o,control:e.control,displayName:`Bot behavior ${n+1}`,placeholder:(null==(a=wz[n])?void 0:a.label)||(null==(i=wz[0])?void 0:i.label)},r.id),t.fields.length>1&&S.jsx(Em,{onClick:()=>t.remove(n)})]},r.id)})),t.fields.length<5&&S.jsx(Lm,{onClick:()=>t.append({id:`behavior${t.fields.length+1}`,label:""})})]})}),Rfe=({form:e,botTriggers:t,botPersonalityTraits:r,botStyles:n,botBehaviors:a})=>S.jsxs("div",{"data-testid":"bot-profile-form",children:[S.jsx("h1",{className:"text-base font-medium text-gray-700",children:"Bot Profile"}),S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.role",displayName:"Role"})}),S.jsx(xfe,{form:e,botTriggers:t}),S.jsx(zfe,{form:e,botPersonalityTraits:r}),S.jsx(Sfe,{form:e}),S.jsx(Tfe,{form:e,botStyles:n}),S.jsx(Pfe,{form:e,botBehaviors:a}),S.jsx("div",{className:"my-4 ",children:S.jsx(Wn,{control:e.control,name:"botProfile.prompt",displayName:"Prompt",maxChars:1e3})})]}),Lfe={data:{},ui:{showInfo:!1},localState:{description:"",rules:null,locations:null}},kz={data:null,loading:!1,ui:{showInfo:!0}},rh=Dd({name:"group",initialState:Lfe,reducers:{setDescription:(e,{payload:t})=>{e.localState.description=t},setRules:(e,{payload:t})=>{e.localState.rules=t},addRule:(e,{payload:t})=>{e.localState.rules=[...e.localState.rules||[],t]},updateRule:(e,{payload:t})=>{e.localState.rules=(e.localState.rules||[]).map((e=>e.id===t.id?t:e))},removeRule:(e,{payload:t})=>{e.localState.rules=(e.localState.rules||[]).filter((e=>e.id!==t))},reorderRules:(e,{payload:t})=>{e.localState.rules=t},setLocations:(e,{payload:t})=>{e.localState.locations=t},removeLocation:(e,{payload:t})=>{e.localState.locations=(e.localState.locations||[]).filter((e=>e!==t))},updateGroupBanner:(e,{payload:t})=>{var r;const n=e.data[t.groupName];null!=(r=null==n?void 0:n.data)&&r.banner&&(n.data.banner.uploadId=t.uploadId)},updateGroupAvatar:(e,{payload:t})=>{var r;const n=e.data[t.groupName];null!=(r=null==n?void 0:n.data)&&r.avatar&&(n.data.avatar.uploadId=t.uploadId)}},extraReducers:e=>{e.addCase(zw,((e,{payload:t})=>{const[r,n]=t;e.data[r]||(e.data[r]={...kz}),e.data[r].data=n})).addCase(Sw,((e,{payload:t})=>{const[r,n]=t;e.data[r]||(e.data[r]={...kz}),e.data[r].loading=n}))},selectors:{group:(e,t)=>{var r;return null==(r=e.data[t])?void 0:r.data},isLoading:(e,t)=>{var r;return null==(r=e.data[t])?void 0:r.loading},showBasicInfo:e=>e.ui.showInfo,selectDescription:e=>e.localState.description,selectRules:e=>e.localState.rules,selectLocations:e=>e.localState.locations}}).injectInto(Hw),Efe=["New York","San Francisco","Los Angeles","Chicago"],Nfe=Ma.enhanceEndpoints({endpoints:{postApiV1Groups:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1Groups:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsSearch:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupId:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdJoin:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r||void 0}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdJoin:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r||void 0}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsNameByGroupname:{providesTags:(e,t,{groupname:r})=>[{type:"Groups",id:(null==e?void 0:e.groupId)||r}],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(Sw([e.groupname,!0]));try{const n=await Oe(r);n&&(t(zw([e.groupname,n.data])),t(rh.actions.setDescription(n.data.summary)),t(rh.actions.setLocations(Efe)))}catch(e){rn.error(`Failed to fetch group name: ${Po(e)}`)}finally{t(Sw([e.groupname,!1]))}}},getApiV1GroupsByGroupId:{providesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdPin:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdPin:{invalidatesTags:["Groups"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupId:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r,getState:n}){var a,i;const o=(null==(a=n().openapi)?void 0:a.queries)||{};let s;for(const t of Object.keys(o))if(t.startsWith("getApiV1GroupsNameByGroupname")){const r=o[t];if((null==(i=null==r?void 0:r.data)?void 0:i.groupId)===e.groupId){s=r.data.groupName;break}}if(!s)return;const c=t(Nfe.util.updateQueryData("getApiV1GroupsNameByGroupname",{groupname:s},(t=>{e.groupUpdate.fields&&(t.fields=e.groupUpdate.fields),e.groupUpdate.name&&(t.groupName=e.groupUpdate.name),e.groupUpdate.displayName&&(t.displayName=e.groupUpdate.displayName),e.groupUpdate.description&&(t.summary=e.groupUpdate.description)})));try{const e=await Oe(r);null!=e&&e.data&&t(zw([s,e.data]))}catch{c.undo()}}}}}),Ife=Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdMembership:{providesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}]},deleteApiV1GroupsByGroupIdMembership:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdMembers:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdMembers:{async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,`User ${e.groupMemberCreate.memberId} has been added to group`)}},deleteApiV1GroupsByGroupIdMembersAndMemberId:{invalidatesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"You have left the group")}}}}),{useGetApiV1GroupsByGroupIdMembershipQuery:ape,useDeleteApiV1GroupsByGroupIdMembershipMutation:spe,useGetApiV1GroupsByGroupIdMembersQuery:Mfe,usePostApiV1GroupsByGroupIdMembersMutation:ipe,useDeleteApiV1GroupsByGroupIdMembersAndMemberIdMutation:ope}=Ife;Ma.injectEndpoints({endpoints:e=>({getGroupFullMembers:e.query({async queryFn({groupId:e}){if(!e)return{data:[]};try{const t=Xw(),r=await t.dispatch(Ma.endpoints.getApiV1GroupsByGroupIdMembers.initiate({groupId:e})).unwrap();return Array.isArray(r)&&0!==r.length?{data:(await Promise.allSettled(r.map((e=>t.dispatch(Ma.endpoints.getApiV1UsersByUserId.initiate({userId:e.memberId,full:!0,htmlContent:!0})).unwrap())))).flatMap((e=>"fulfilled"===e.status&&e.value?[e.value]:[]))}:{data:[]}}catch(e){return{error:{status:"CUSTOM_ERROR",error:`Failed to fetch group member users: ${e instanceof Error?e.message:String(e)}`}}}},providesTags:(e,t,{groupId:r})=>[{type:"GroupMembers",id:r}]})}),overrideExisting:!1}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdRules:{providesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t);e&&r(rh.actions.setRules(e.data))}catch(e){rn.error(`Failed to fetch rules: ${Po(e)}`)}}},postApiV1GroupsByGroupIdRules:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t,"Rule created");e&&r(rh.actions.addRule(e.data))}catch(e){rn.error(`Failed to delete rule: ${Po(e)}`)}}},deleteApiV1GroupsByGroupIdRulesAndId:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{await Oe(t,"Rule deleted"),r(rh.actions.removeRule(e.id))}catch(e){rn.error(`Failed to delete rule: ${Po(e)}`)}}},putApiV1GroupsByGroupIdRulesAndRuleId:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){try{const e=await Oe(t,"Rule updated");e&&r(rh.actions.updateRule(e.data))}catch(e){rn.error(`Failed to update rule: ${Po(e)}`)}}},postApiV1GroupsByGroupIdRulesReorder:{invalidatesTags:["GroupRules"],async onQueryStarted(e,{queryFulfilled:t}){try{await Oe(t,"Rules reordered")}catch(e){rn.error(`Failed to reorder rules: ${Po(e)}`)}}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdChannels:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdChannelsLookup:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdChannels:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdChannelsDefault:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdChannelsAndChannelIdDefault:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Channel subscription updated successfully")}},getApiV1GroupsByGroupIdChannelsMain:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdChannelsAndChannelIdMain:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Default channel changed successfully")}},putApiV1GroupsByGroupIdChannelsAndChannelId:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdChannelsAndChannelId:{invalidatesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Channel deleted successfully")}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdJoinRequests:{providesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdJoinRequestsAndGroupJoinRequestId:{invalidatesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdJoinRequestsAndGroupJoinRequestId:{invalidatesTags:["Group_Join_Requests"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdAiAgentsAssignments:{providesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdAiAgentsAssignments:{invalidatesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1GroupsByGroupIdAiAgentsAssignments:{invalidatesTags:["Group_Ai_Agents_Assignments"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),Ma.enhanceEndpoints({endpoints:{getApiV1Rbac:{providesTags:["Rbac_Config"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1RbacScopesByScopeRoles:{providesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1RbacScopesByScopeRoles:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role created successfully")}},putApiV1RbacRolesByRoleId:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role updated successfully")}},deleteApiV1RbacScopesByScopeRolesAndRoleName:{invalidatesTags:["Group_Roles"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t,"Role deleted successfully")}}}});const Ofe=({groupId:e,role:t})=>{const{data:r,isLoading:n,refetch:a}=Mfe({groupId:e,role:t},{skip:!e});return{members:r,isLoading:n,refetch:a}},Dfe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAABgCAYAAABVLBpzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAACnSSURBVHgB7X0Jl+M2kmaApJRHlavKbtvd7end3t3//2P2zZs3PfOm/abtdtmuM7Py0kUSExEAKBACQJCSUsoUPztLEokbgUAgEAiIf/x6K2HEiBEjDgSJHOgfH+cg8HuWCTgFFDBixIgRB0JVSfj7hwVcThTDPRUpsBBwGjPMiBEjjguzZQ0/f0amO82eF8OlynSw1WLkuyNGjHhsfLkv4f3tCi6Q6RKeFRtKqMyoahgxYsSj4tPNCq7nFZxNMjhVFKPAO2LEiBRI3AWr67UeVm2G4adI5yLvkeneLiqY5KfNeUaJd8SIEUGsVjVczSpmlnUtmdsalin1X5EJeHWWw+uLAiYRUe4DMd1lxeGFnYiBgLZ+VK4/hH7nvhZWHLKOsNNtJgj9DsDRAjhxzPeNsEJnIeNxfdhIz8T7+fe70ZxsxIgRLcxx4+vt1QoZjoRpLrr1lshFFlWNTDWDH15P4Ix0t5ZofHVbwtW8ZKY7YlQ1jBgxwgJJYz99WkCJ0u0UuYNM3fbCYGdFxqF/uVridwH/65szfnX7UMGnh5KfjVKegvjn7/djW4wYMQJWZFP7fgYvtKXBUMZgWPWilPAvKP2+/bIama6DUeIdMWIELMsafvwwR6ab8+8EU9ROELN9d1uyJAxbpueWx97ge4oY7XhHjDhx0KbZjx+R6eIGWZShDeDG+Y6sF4ST/87Z1rYzTc/4p2tIN2LECAYd2SVJt1MVcGghbZ/5b5t2z/ijqmHEiBPG57sSSLsQYrrGWisGX5hYvJQ03bChOCn52GFcizWA/uVMLX8s3KhqGDHiVIFc4f3dCi6KLMyhIE2YE4nPUt61Asl12FAcEeGwvriuLa+IcFER4J6d5Xfyd7nweIBixIgTxfVDCee05jUKR1sUdD9DBx36isNOesI+iCA9YTL93pde6ySF8wxU3NbhCiuNVp4ioKK16+nLy2oDuzmawx6u+bPVzqN3shEjThSf7ks+utvwRZcVBMVE6BZDQ+k4z6T+LjvykJBQlljenjTcPGUsvu+30wbSTsd55qYxbq6NGHGCIEuG0vG7sC8RbFv+7cYXEE6zTx2Ek6bvHUB62VLCG4w63hEjThDLVQ3kHMzVbz4F5tuV5hDm64u3T+Y7WjWMGHGCmKG4y9fsjAxgO3SZXNhhrDjj5tqIEScIOh6cGdda7oZV6oZZ6DMVfcJ3hbWZXFc8t74mXmwjEZzwbhwRCOvbtRt1vCNGnCakVNyA+YVtNhYzrWoir8Oa+PZvO6wAvyohlFcovJ22LxzXQW7qgIX08D0rHMexyu+mIdw6yXVeG3DLKNvltb8XPXwYjxgx4pkgZ1MrY1MVYHYeiMB3Xxoi8s4XHzrCd/3u865PGF95UsLGvo+qhhEjThB0aOJuUcHoM+wwGFUNI0acIM6nGVTeaxkgXQy0w3jCyT7pCSdOJMzG91R0xfe1Q6pom5q3/hwPUIwYcYIgg4bmqhuA9RU2oPeEPEzK3Xtyf7vh7MdSBL47YTLo2AvzlMu3f+UxJGjyaNJLYL5C/yMDwc27GEx+dluPdrwjRpwIqrKGT3d0BU/FV/qcTzK+wLJLF+tirRWWG2HtfSe/gCk21BvmibBMI2JCuMlHeMP6n4mmrOa9zc7X8ULw5bH5rj2VSKsc7ueo4x0x4jkD+cDtrITfb1asWjjDXbWzXF3pI7XYN1zLK7qyToq3Pmq7Zk8pZdpk+/70N5+Fppc+UqhIeB6ux14PUMhawqqUsMDPZWmOKMrm1s2MlxYCihxgisp+ck9XIGGMlhbPA9TPZVUjDaiLEKn/a6n6n/2f6GVfjl/ofi+6VHFK/d9j54FpCf8pzdXjxhxIqKvHcyHU9eMnRlMkyX68XcH7O3XXGd3+O5ECXEsoV1r1oS3HQRJT3AU2VBme9yll2WeZh6Yt3n+a7bRMxGjvlhXMVrVxLtQYatsMtdWRUj2h26Ppj07UvETlP939lI23kj4p0GR7t6xxx7xmZsjOr7SizJ1Qm4WlJgaiGOTP/OwSl8Evz/KN68KJocwXEq7nJTxgPkuMQPGJeRuGy2lJFbbWeZzjxP4SZ/avLnI4mzzfyZ3a4v3NEj7el1znox4+QcXpAZHCSRulLXQf6giEE+8/b894qbPvZhXckHmK0MbB2zYoprnC0UOM95vzXF0XPfLg4wT21Rwn2iukAXK+Qld48+YNbAGMTJpIkmLfnBec3tvrOUrOuDoiSXbAykhJ4Eo6/goT+f6rKZydPR/Dni8o3f7zyxJekH/d0V7pqCE+bMN4MebVQ8USDjnc2HqweUBjyywjv70s4PwsO86Z8kQxQ8n2I9IAGeQXe+p/klqNSuEOJV1WIwjL1mcgLdDqjP774dUUXr14utsdVI+/v5+zyi4fV4gHgVKfSVZrGcqU5rm2HrEFhcGM90EPONLLsgnIrvrbZqrWd2bAtXr2PQ6SYiJGBnxAVCg5/n5b8mSbZx6Gm2Ljkwodj6ISw52hKut+UWo1hIBtTSJJvbHCmf2vb87hxcXTmth/u16i8FOyhcKIx4VRkU1wABQFCR7+VZjZ61jSaqtSzomQ8c77MV5M5bebkr/mB+prFLDhJS6n3lzm64cjA3403OCE+wWZ31l+mEY3Hv6vbudIxBlvotnW7n1UEDaPpYFBapL/9+252pADOFq6qrGs//Fuxn2QbTEOR9mlP4wUS+pPvrperJlwDOa2jTkyMPHxKp3x0pLmV9wpPc8P31VUARKA/0xLxEzJPdbYG7EPYJu//bJS1ihH0M50dfj17QLpskaJI1dlMht5MAwU734l4f9+PYUXqNpqdueOiK5uUJf+06c5bz6PeFzgfMfWN5e48Wusc/qCrXlSGS8t7z7eV5zpMYE24P78ImfJh3nvCZoOPQbIQuCfVys2TTomkE7z9mEFD/MlTCeF0rFpfiQGmi5QrDky329wRfXH11NtoiaOYsPq7ecF3MyVamHX+vSjQ5c4bptGpYTvk7YnfIW85gVu9NJ1SfWWjZ/EeB/muGONnV1ExJwuy4p9gfJdEvPFQUISEJhNl1EY2BmY6V6rlU6qpc1jgujybr5CBryAaTFROjSjfhChk0WxZwqrCuAF7iX85euz9VnPA0q/P76f8STQrVro0wupNlEp6QD07/1dUEy/fo2nA954NdLCS2S6eQ5bM13O6cOnmYzZys5QH/HpQV2Kd6ygki0qYr4CJaCcZflj19EdE8j2trJ2X1mVoGmCmO7P13QF+HH7saKDEjfIeO9mSvJVul97460/IRiLmgskqb98g8y31gz9AKuqv/12z5s4thRvm4kCtE1GfSwktNcZEhyHCpRuuJR0fHEEQNBc1i1fKByAvyyhMG6a/AzHB6kWikIk6XJTIP7/f3+RdIzwW9SVZnnbUmC1op1rtbw85kFHoCKT2uFP5/gdpyVBO4zZYSWUYwbZ297MajYFJDT7U9p+lhjWm/MMbhaoP83g6PufkCOz/Xh9x5JqQYyXDxCIRv8/VPNbYlu9nAD8gGoHEjdF9oiTOjb8v/16z24cR0J+fJCJGE14l2fZTiRdA/HvP9+yJdi8quHVtIA3qC8FfZLs58Tl5bGA+QYW9rsz3DXMCjVIlA3SSLMWPqOu/h519tNMNB6TXFBz1VoCfjLA8k6QQf307go/J3z83Ei+zHa3IAPcV+YJaIJp0d8lbmxNcUNvOhHKpngf7URMFyXdy9DMJ5pgm6KtT/x1w9lhQ/CJlinxIFIe8ywEmZBX7L2v/jExXPrTEMgZ6TTlm8vJ2oXmjsCM1+TPR3bx84dXE/jtZgW52E7S6Wqv1Dh9wlH7XGZkbobMt8DNlixbb7idOPOltiFd7b4Ou9joMy598YaOcdCTxU+/f4aLi3OWgmkDLtN0IADC61QrjRDxNsebaWVAB3u0d6/LaQ6vz4r1Mecd0NrffntgHxZNmZyyJK+boSNu1+8+6drvYwyg6xMgzBShxzM3HYA4gVnfiRdeTvwqhhSajM4Nf9OM1wbN7vluaOcgICvjb/NaSTxkbJzlI/PFPv3penEUpoD7Bk0qNw9LuL6dwfRsotQOmgGDpXrgRglIO6BfpzIhqf/oEkkapK+QAX+L+okLOmE0oMl/fP+wMR9s5A2QpC/dFx4rn0OB+vH1xYQn112jaIsAqhkLEZpyQrI6OM9FIEzXlBab4kLYnM5QHQfXVQ7fwQqkUFWUhvmeKH69WcJ5yxQsVbRIhZuewTZyr/vdfe+nT5JU3nx1Dp9v7qEqK3Z+ahxPZ1pVKqQ1C7vJy8B3CD83qZlDJeSN76fPCz4RR74m/vhqimqJNFOb364WSrURolfZztfFY1H5sx5NyGynEzqgpZdQ7Zf6MySmu2E3l1PF+qE7KN3vboKhZheRMCIh/VB+MbTTo6rhBjTM8J8pDjxaKgghdRs+YVF+IOh4t6pyrA+HtDtE0os965tWLF1/uelI85//8Bp+eX8FF3AGNS//UfLVrhHVFbB7JARBLk7J5WnOLjH/68OMdcF/eR33C0G+cz/PlGex3ctZNvqmflqDhibvF2Sv20nTXePGP+aerbUrzVV3OK/gXiTu4OM+vXHWataEJ4SPD+XJudekLr4kr2bI+CpZQ4U0UPNZedLL1o3bSPO3Xwg+WkqHj2jl8a9v7+Hz7XIjFFma/Phh/kiHI0TPv9MC1TjveRa7Tysd2Tmk3YJmrWVNYj3OW0I7em3p+J4/6DjtU9bXbwOSev/09Vfwy4cryJEBkwOci/MJMsBc2/gqx+wlO+yv+WRSFtOfejRoxvG6V6lmvTcvacvhEjN5f1/C2y8l/J9vpvDVpZKA//b7DL46J6YrG38Uvjy9v8HKy4krfatlaKfTqquOL3VccNqgkfGscK0sW40AQa3Rxmu3zr46eeoXCmv3AXjycPuuuaAB+4f2BdgVQQ29kDrOnvXVP1S5B/z3jVyy1MvOsnVr2zc/xRorZUFq06ZP62O/s8N30ZL0PPd9j2mX7pd19MThcwbV/8UlbXBN4V++f8WbrVXjY1KBlv80yGgTjBZFD8sSFvhHvh+41VpcS7e4WMc3+wb+BaVmoFaPmd8k8RRTCW9RAs5Q+qXNuEljNabD23stwqEGT5cK4ecwKs8ApYl2eQnUDsR8yH6fNyaNek6qAyUlTlLLUl90INwjKm4ZADZX5rpcTW2tAI4KSITaQLijCdp7OFxkaRXD13bq4JC5AWWCE7JxqK/awR3Bu4P4j1/u1qmHuIzLWexnoiOejzN0cbMUbpcI3FqBP8gFqvfUkeKMTMzyvPHy0hoXzxDvUKqSINPaPsTVu/rKwEcbsbChmSYFifUgvkmnLsvaI9p5vtMJOHLdd3W/5KVmwztEXyIJZeRHrZ3+b4ftBo4qQwYvz3Pe2Ku5j+RGv7FZHj6bI/Olo9q5fVL0KNFuF2ao+JNUOmc4weamrvhcxmh4aPN64rUZrwc233yKoLK/lLhZkVUwhyn+ZXzCrdYERe+JcOhILBHcMR+NHoK3Vys+X34seAr0RGUkSe7d9ayRfIW1vj42CmnMnVIaVqyv4rJBahaif2JEfC/eOngwWWMXTZMU6cmzRpoUR3nwRrWT8ixGm5dq8XMYahT/2cF4nwNIRc4ehGXEnaFUR47pLP73LybKCH6Hkveh8PZ6xSeuRvSEVMvttx/v4GxaqCPoQjv9B9HrQs6dF62WzTKfVnE56yQFl3ftmlhfYK4VtbWOR2Zqlbl4tF4rMF+hnpkk/CGMiPK/QnVJWdfqoIougsy2n6R2NVHTxHKB/UgnDlWTHJbtnQTj7QPqaHK4Q5dtfoMMOLhsfiKgE4hP59D3cYEY25zcoV7fw3SqHe+IrPF8thOSSJzcjRRKt3GThQSZqhnJlRkJyCQOJSyJnYLTpiL9LopsODMiPSkKKu8+P/DPpp00B25y7KtKgoTwHeoqqXX0by4K9rFRy+MYC896c20ImLiRqEl/9eF2Bd+91E0kxZNkvriqgmUFO4dwltyNClXW3k1FcxPV2lm5Dg+Hlz5CoEFKJmnEaEnvy+b0qNzMhTGs97DfdLWuCpN5wlv6dTqWTJIoHUWe6qWLabMhTERaagQCMXDqy636AMtaoSj9/deX8NPvX+DibILSLu2F6dtBhHK61Gm8atXbpRFh5dU81L+boWkHFErKPcdNU2o7+n5MdFYECeWxltm72lCxwwBsXXaSJmhD5vqhhNfnfEn9wVwCboMXSHhztuOFwbCdK9LqlJgB2cbSJgWbR1vSFneRh45ckyZakCofCmpJ39pNbtlgbYG+m7oe0PL521cvUOXwBQdxQaId1qPCMueWtYAn0ZR8ROi7uuaeGO1XmCepEUgp0JrSdtU+Qvefm2bfttJhv/7qAr7cz1BVh6oLNuHM9ZhJ2KW1mGamdTkZgIfreuICNFfy0K8K++3VxQTOJnpj9THHbELbFQ256w6wf7fTkpCyuOrHR2W/3VDhL4v57UtP+kxWUrPDXr/DmfyyJE9evA2nZu8+3s6kU4ZHZtrnqDJZoTbpfADnpaYkxkr+B4h4K0snKMy/ol2vVvUsiU44kgx9JaYmLTtJSockMNrgzK1l9GCIjt9NMeO0TVJvWVVYXhLjcLdA0CqIlujZWte7o36lSYcuTaTTbdRl5oorlcXwTNxxsDFWdjD+qaxvXk7h/fWNUoOQhF5TXxo/ws7s25h2AuvQFZPVumnoUzmxTkddRKNODK4qpN2MTcXMxN6Xnlq8BYT33QYsPqV+boYp2uHDDZva6f0myWGE5MYTDRsQnWH7glwnXi0BvptU3Pzk7UzWWYv50hIGxyUsUD1BKgpa2rOnt0YQlLrT1eYH0R4Z0pNKg/wnkGRT7NF15TfIOO5XdedOcyMY0kYjilzEcCvtfYul3r5b1V2Mz2MhUHK+6jvZkE64bXS5YD9IoZFLXD4vS8MCq0aIy2TGtqZCbqdJp0FK89pr1EWSTwdz0HJXCI2Zrmcp79rhyFPbFNuqUuXXN0HzO2Fbz2tdsH5uV7V3tUX7s4lPZmI4COkyB1UUwW1r7NrTjECG85bY+1HH2wFetkjFEAruPTWrVjiTPqyUI3E6hso7yprGmLEKdWxZwd8BtIm3KNfLdjJYp0092nkVOzz08Ooyh+srdSuwj9iUxKEk2yXWyTBbepg9tl2QxYxJL1cu1Y3WkyzjCSo7gFN2yu9sOsGNthkzxJoHdKb621JnDG0pau9prqRcdjfZ87TUMYHK//LiHN5d3ShGW2mGW6u+Y0sM7aLTNN1e+1OsVWXUrHR3pNrHUZuUQjw+PRFGxpsAYqIzJJyXUKLkOIX7quZldy6Uedpk4MFrof/h6JrR0o0Pn+bKSfnX5zmrCnYhCf/l9QR+vl7yTQa26pP+Fu5JJIvZxrVqm+pTm4gdvhR8Z6djp20PGlJLrHCSoyXjOd0o/IgMmKRRYhZkflXXZGwv+bvMlBOVPLAUTYGyny24n58ywzXga88nOZS4bKEVS0UMdlVCfj7FiXOtPvFtwLq04qWJDthxvTSpJ3a1sqr5dgme0AHWhyceAUWooL7KG4TehwYZWM/dNGLwdYQvXmhfMMYcREc4t8wL7JpZPeXvvNUWGfi+dNx6gCdf/o4/ppo4Ps0qqO5LeIMM+NVFHu+UDpC95/9+M4Xfb0swd4IuVnWzfM5E2hFqCIQRHc+73nU9F5ZdKh3rVUdac1bZxJh9F7roqZHK9CrAWBOQox1JagZiItl6EvWOds87GuS0yvkadaKZULp0XxIh2k2tU+x7KL9txj/vhBTK38SqLFmd8ObNC/5UDonW+boYQisQSSdEk+qhoieyaX6g1SyWmT3COZXy0YZ5HutqgDgJFPYSKanA7nuroMIqnejgkn0Hd6xMG50UyMOU1wwS4YQPpWeQORS3UaaEdISnPKE4rK6gG3SRQV4vKvgWJaPLi6wfZ7HKRhLVBeq4HnC5Ndc2ZobhpkoUxwCh14czZMDUPiRh2ZoZ4eM0vt/gaUIJ4Ow58UYfMREw0poW2Wrt2Yx9+2bG3WQo4fY7YrrfItNt2l7Ex1/XmNzIxjMGhG+swu7HPx3UWJZL+OMfvoOXl2fsrOhYTQZZnQaKAd+hEEIrj1zvmIrmHw2Hr20z/sV//Xr/lMbcSaPWg/1PLybsY7hBZDSSJHU9q9hZToYjj6Rc4xdAdjHwFPHKF8ekOSR+z7yEZmITfbCgMVvbYb60HP33f/yuk1TXCNFR4gn+FXmhjhWzigZaHq/cTwNmuq+mO7088VhAE+DdrNRqq4xXBns7Pzx0SRAARaO+KTK14Q3Cuqdvx1UYD5M+IbA+Gf/59W4FXx7IyiL8HzHcdzcreHutjnLSwYaHhZJyhS2dxQhqCLHZae6T6er0eYBnylbzHutXNb52YWdiPJklPTwsmjyVrkBXVTPbpki6/r5P+iOd7nfPmOmS6or03jQR1e7yYdcYuiQIgHm2tpl+WNZKj89+XWDnS8KR8T4xUP+TGdoDEvjbL0t28C6N3ZpmRO9ul/DLF+Vom2wYb1HiXZWSl+WuPtT33f9eeN/1WpZ6ngN0rsqD7wwaIRtfzJeoW6yU4/tmwGw5aOiwx19/+I4nswVbWehbTjxhZeCPQNYvxHT3cJDw4CCV1T1uDM9X9cZFqil96D63PwWIIP2kbGgO4cW0h0MWR7QJB6zPl8rmfEcMWPx9VDU8aSxxMP/wMucNjbt5DZ+1RUTGx1yBpdxTu31CQZnnCdbhibX0ORB8HgBVDvezFfz26QaWKAVfov5S7dRrx+qR9Inp0kZakQEcq7pzCMwy/A7p7qkeq49CAqvo2DdGthtaIoyM14WrkDtyUHH5VuhM6XOViZvgDTRa9mXZCS9qJK0OlCrCTD5JAyZCA/SqwA3KOU5o76/vVR5nU72558+D9PLkGevFNHtWKgajavmCK6pHt/d+ZJACosi0DbI+BbfVRP7330bG+5zASz4cCPW+N7aeAHizBNthImpeEYjmpBRs3TbMgLOMTds+3cx5oy2zHYLrD7PZ94cXUz4o8ZxAk80N7TU8c6bbAHUNExJsivXVUUPdgyLjfZBRu6+oNR9AfEvcfS8hbQu9L9dwNUo72OJMyrOrbsO3Xe1Y8TzWoIFA+twmWF/p/VilfX9j9ELGEgsy3sLyCdBqylRaaYejb7Ta+HSzYCbM7iObl+o2i+9fnQeKvi867aLFPuH98XJcfn+Z+e/gPfpVo10+t6yhsjfPaz51tp7IjW/mfuNf/IiMV0K8rXzldFmOL7wbDyDMroew5BDrkx3l9OUdK5ObJ3Tk2/U8/G7tyKPWrpaEPkm23j339xKFoavBNwrXgRgNAvj78hDoHA8J3zNZa4fh6uSbaAZNHF39SKB06TgqqR+M43TC5VkBL/HPHMP2jYfY9N312y6DL10f7cbC+uCWO7NoLXbaq4tmfOWK9bNdVoA43W6LaJpVyfp+MpdjBgyiOVCVOv6Z8cKIg4JNb8hvAx1FJmNzT5ez565CndZSTHgdhpY9Nw8lWGpGRmwy64NdpbOLvLYti5CVvkXWLBfF4OXiRtpUMvz/lw83rHogVvvDN5dsQvZcQLQ6W1RsvncoDcNj0qMPPF5XC2S66tYOYsKgmW8qRnOyA8KYydwvSrjDZSoxXWXvKTx/uImGu2i3uKv+sFAmTWrHFaUPD9P1/NyinI8HseX7LkhR4CRHvjYqNpbn/3bkI4HTwgnxr9+/gkVZwevLyc7SPgYQtSqvdRUc0lDmkEyXwPfLFVNYLVbqGqVKmZvVPczNHk/i3XY9sMv1RN+0+oRPDEsMk4iYzL3oSGofBx109JOu2SbP+uTghjv80NT4pICNVS35xFlOkm+uJd9dtaFUq5CDXDMTW9/GwkNKHMETv2sPfoqgZuI760jtMFWSb55n4N7MEkJxVOLMvuNvk1af8B1hiekulmRsXqoLBqEfiEkX2mQs0wxj1Bf1Aa4sigmslkuQBQ2CXC8Thfl/Owg4DNMVsC58aiVE4LsDotm7h3Jkuhq8Z5DnKO2WuBIt6dI6pf/O1y4vYxN5kbKhtU3hujaX+qQBsDv9X2zDDiC+WeamA5E4GxDqgsHFQKbbKosYB8FQsJkXMt+yXvERNLJFYInFmsh8/ej2t/18m/HSS/DsiNOVVkr6rTDYIOoo8G5ln6cOUi8U5PR9NgPW2uZaks2hceTkZb74MOiPdxcNHJt8o+nLtDR6pRkJm/Ld9zs1TPu9YK9a5mCDcCOncFI3nMsBUtL0zWaxbW3oET6W1zZhh7ZPMJxgnW9VVc3v3NwgLMJJ93meikTBMylOV1p9xxJ9J292mXtVkGYs0jNe7femL3xCVIg03fAmHRmIJ6w8N9Jz4poMWg6NfLOoVW47LTcPYr71agV1VrC/ZjW2N5dO5lLR2RzVE89KZPJN7alhHwF8uAEbPXjKJ7UvZI94MuF5qs1PiOK73nVNBnYefesSmnRCA8nJm5aLFU6EZO3A+2Ayby7g5GQOQCfHBGPFkGWby4DmrIjdtrD53jx3fm5838jbDSP8aXjz9CQmAmGFJ6z9GYpnUKCaYb5aoLq3BkEnLCq6O1C2EmD14qpmh0tsVXMIBvRoOLK6kVUR+R1/kqd4Y6MmNhoiAyE5bCq68vKWk5aLZ7Ccz/gESsHSLh3tFeDhNScFnp/0ZadGiAti0NItBU5aRygo8gWl03MoF3MubTYV7PuajxeDoqM7FLhqvelKdRiv/nkk0CxJ95ll7fuqHwGufiA1jkh4tg/E8t5PGSjVHJeLJW62AV0yQjq4bH2ZT9+9AwB/DSDwzn2fiiB78xXCJ/ULT3jrOUlps8E0u8t+Et6vxwS61Xg5V0y4LGu2uc8ypcu4XagTfpklYrduoDBo+kZ/SalrbHi7hJs6rH0qRTEgjdTBM3RYx+KZd7RkW5pLtYbuePcunIBhNdqHOLqLvPdXhjxHXa9Y8nIxE7iRhMvFjG9bEmvfDondJpp/oCEAIbvjDKE/kfowJvUHvvNt0+xo6Ui53RGBLMum5+ewwpUTjfWKrrWvM3bf6r3eXWuywGZz2hiCr62G5r2LNiWJ1rf2FOq+ExtU3L722aQmnHzseMIzEtp1aeedQjrC+6t7tG3Gs/NXn6y+pJsfxDDpJrEo20ZIwmYPP33QpscEl4vL+YPakSapBDfezKm2MP20W6AJJ63nsjve5hjwhTeJpbb6Zh7rNELhNN1iG8zp1hJ6YgkKXbnGaKM9MvxxUuGL405ej02XdBvJolYXodLtyiuRNyVx617Ep8AYu0p9JwLvRCQOROOvG7crTvt9Kqn68kuJJ0P5W6cjpAgvX7skZze/lHihtHxEKiIx3Pfu91B9AOJlC+XbFTc0gLcB6XazXFk5kNDBl5oS8+10Z5ZKu13v+4gHqbUVA56p73Qiyz1OHaJZH03ZcWRSjvG0wfnujgFfmrFVcyi/rnDBONq8rFytICuItW7W3IQvQg0yZLbYiLfHKWdfSQ9NVyYEoDCZDiiaf9bYxTSXgthUG4rRl4WEnqWGSc1vW2ZrQ0m9Z6huWIFABkwHs2tydgy1OpNfZOpWY09np8qqTwVVc01GF2X4P7veD51i+tKLSAyXmk8sDmFKdr24yTbBT1rh2iPHDus1J9sb8zllCD0Bij21Ul+xd5t4Q/PaJfZYhryYgKFm47KIlo/Lec19eDZRjlGkR9z2CS276vGdCURd4YWSdlWdLHXJofu8F/ZY2Ehb0Krp4sVL6PJ4XzyptnzCYJ67z8YemvaQeMdANHstg3//wiy7yT8G/V1Mct2ngqM04fZYtsfoZgrLaoYhIuDRYI9iYKQt2LSMT6R2MN6tG9SnXOmrwNwmb7H5KPbe946EUNlXCdQVVsNeLpE5yUHO8D9B2N1xjKDy3S8rOJ+Q+kEtKZkchDi4cLhtm9EOPduc7rASQ6X1fWGf9JXikK5lxzuoEGKLZ9tiiOLR806mzuw9FEbmFfktXenbSvVmucoTwsr/UNK+jQyAMFG7z0N5SIgTovDkDYH8Q+9ExzM3v1BZYvHdOdF9FsMQxkD329FppAmfdMsUo8okOy7itJ7isTcB7OpQOYpPjtJJi+Zdj2I8CqM+VA8VjzkLidADpxBPWSY0VSKnImQDac6rG+nBMAyXidnxuwg3FtdAQpj5xH6LHnmHFgm+3eGuhZHsURbplKfrue+9712oXNG5mBgVrZiqEmq+CibjJZTQO9ppTgIfGcL7VW3+CnUjclepfYxWRsKm9KX7PBauq19CfRgTOtz4AOmTeepE31g1wJ5hCsLHZSvJzqdpuc331NthyEGJdlKS5VmLUQUxhENblLJLBm+EG3L3SExXaInBFXr6MLlofj1/7xJDGPkuyzu03fpIcKlxzHs+G1OXrN8D9vELzHSl2C3zdSX8VBo2dEiO2UmiVeoEySYazUTKt+gKSDngIxKfxZ53vYuF69PXYkA6ferX9c4XrmD9JuwYQl1tQcRImxAV9rI0PuXEZiE5f+zsFf2RGctS7ajSXfbTQjktcT0g9S1zM7M56aTE8c2KzTNdnyU7wFDqhFO+UX0n2DlB7h9k/7tYzFDqZdesLPkW+ipwe+fNR4ctRIhSynTGsaZZNRjpGCv91XL90hYK+DEKRhWqxcRIv3vHziVeXnph79LFf+aKcTWb2oFgk/AEKEsrzZwJpB8tFyVLv9NCmfCwtCzWkYbOmH3iBGdFq65Un50yXLeN7N+xd7FnKfkMfb6r9M27oekOzbNvGIDWzCxRsmDH2Cuy/s2Z+Vb4ks4uCeu4YmfVZHe2bnARiUFCz2KhtnuEYbYRMY/HaYiWXBoEz/MUDKXXlH6NjRM7vMGQ8vvy7Ymd6HiNbohmZLoPrJZWJ4eQIMsbiZLSn9OZcRShp4W6UtnkvPtNjJQRqzwO0ZHKVV0rtUj/UdGNmHgjOsKGnqXkE3s+pE590t9Futvm2bfd9CcdGZ3P5mvuNiFhIlcC7x432nw8jI/84iRAKgWvBBvrxxgticTnXRhKryllFgnh3fdDuycWL9LGivFGM5WbCTkJkpnU0viaFJYT6V1wdQ3OFtObYR4Tct9XKGrKoL2U22oGC2JTvLybq6M9WVdeOy3HkeA51mkHyDJFjXVdQYWDIKuAP0FmzbjwDg1rZbibpiUfuqX+BvFdr+eC/c1rwxEpU9GcpEpZ9rmzg1RMl6Xc2nIe7YkbW1n4VjJu1uZ5BsrXZYXS5oSECZHxjJ7JEFV3I32DQvDGxEJ745dOe8R4f0h4dN/54shImM4yQ/eK3FfuWH6+lZodrouBdM2RblvFyigT0nPL1Le+APE+svX9RIzq8lGkkUq5BqyJNGOu/kQ43z5QK08cj/P2rdMiUGZfHUJjMrX9rWw3ygaBMvQZ/wCR/pab72PpA3TTn4R4+0BKuZw06cfGkWFfZUKNLvSNCoS4sbWI0Zv+Lq1nm03eeq7FX9qIy7NKm/CswwiHkGMNJiCtQ/hW4FJZLGRat+Cv8tojmb8uYiMcgFvDNisQG/Hckrrpt2u4TtMNv273dUh7F17CZj3d8kortgRfD9pptfMGaLeDf8ja78VGXDe9cM+029btJ3Bip5XHbi8jw7C1AAkHAmmlVoJBiHnZZetiXKHJw+RNewzzeQXKfW6YSny02e6LdhgBm3XfpPGYCdqOx3+rfFbqwoQP0SZAfMy5pdtsg3aaPqSN/8I/GCDaUPRpvKo3LEjClhC9n9Mbkn5paUfLPPb4LtZN4lwRFU3R/0wPdqHMxErS53bWNaUF+4QLxdsm723yioTvrdS3nw95H8uvqxyp+Wq0xNpwfKlNJUnqlSjt0gopz2o2MTPhQzm7zE9GSu17TkIBu2/v1Cen1LmLA6SE74P+47/7ecr3XTzzvY/HHWTVQP3aLGfAEMjWnHcwiB3W2jaRbooF48AatoViurSJVvHJs/FW3yiee+N01I9cftLNbc24kMx9mRkyQxZrGcjwcDal1eFrbevFW8aWUGZimZsg7AshjJklfayWajU2nko/fvRnvELZ5rIA0HC2w/Y0FyNT3qJIKi1RBcF6X6E2NcgoXNiE6kr/oXQzVVfyTKWIfqToETEoJ9iZNiPgMxXMdGF94y4oE0RSR7BpZN1fbGHGTQxZ0zYdOFqi3i1XXsthJ5DHS+22suCpwm9OFqoVzdC1Msbm8+hdtbdFYru13O8A/jwF+BViwQjrx3xCB8m+1I/ZqTX5VM2VLOxbxrWyFuraE1VXJ7eQcg7gSR7PdxHr1mdQvb2hLInaNCOVoFUOyoaW/iXmKPU7sycSvOk2AZT+smRpI2zSOBTiuPv6qdPh/wBWZSzx2Mt33wAAAABJRU5ErkJggg==",Ufe="lastAppFor",qfe=(e="global")=>`${Ufe}:${e}`,bz=({username:e,groupname:t})=>{const r=qfe(t||e||"global");return pm.get(r)},Wfe=Ma.enhanceEndpoints({endpoints:{getApiV1GroupsByGroupIdChannels:{providesTags:["Group_Channels"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},postApiV1Apps:{invalidatesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1GroupsByGroupIdApps:{providesTags:(e,t,r)=>[{type:"Group_Apps",id:r.groupId}],keepUnusedDataFor:300,async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1AppsUser:{providesTags:["User_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1AppsUserByAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},putApiV1GroupsByGroupIdAppsAndAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1Apps:{providesTags:["User_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1GroupsByGroupIdAppsAndAppId:{invalidatesTags:["Group_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1AppsUserByAppId:{invalidatesTags:["User_Apps"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},deleteApiV1AppsByAppId:{invalidatesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}},getApiV1AppsInstalled:{providesTags:["Admin_Apps","Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Oe(t)}}}}),{useLazyGetApiV1GroupsByGroupIdChannelsQuery:Ffe,usePutApiV1GroupsByGroupIdAppsAndAppIdMutation:cpe,useGetApiV1GroupsByGroupIdAppsQuery:lpe,useLazyGetApiV1GroupsByGroupIdAppsQuery:Vfe,useDeleteApiV1AppsUserByAppIdMutation:upe,usePutApiV1AppsUserByAppIdMutation:fpe,useGetApiV1AppsQuery:dpe,useGetApiV1AppsUserQuery:ppe,useGetApiV1AppsInstalledQuery:hpe,usePostApiV1AppsMutation:gpe,useDeleteApiV1AppsByAppIdMutation:ype,useLazyGetApiV1AppsUserQuery:Bfe,useLazyGetApiV1AppsQuery:Gfe}=Wfe,Xfe=({groupName:e,channel:t,type:r="profile",tab:n=""})=>Gy("settings"===r?"/g/:groupname/:channelname/settings/:tab?":"/g/:groupname/:channelname/:tab?",{groupname:e,channelname:`@${t.groupUserName}`,tab:n}),Hfe=()=>{const[e]=Ffe({}),t=Qt((async t=>{const r=await e({groupId:t},!0).unwrap();return null==r?void 0:r.find((e=>e.groupMain))}),[e]);return{getDefaultChannelLink:Qt((async({groupId:e,groupName:r,defaultChannel:n})=>{const a=n??await t(e);return a?Xfe({groupName:r,channel:{groupUserName:a.groupUserName}}):null}),[e,t])}},Zfe=({entryPoint:e})=>{const t=mt(Ur.selectors.selectCurrentUser),r=(null==t?void 0:t.username)||void 0;return Qt(((t,n)=>u7({id:t.id,routes:t.manifest.routes,username:r,groupname:n||void 0,entryPoint:e})),[e,r])},Kfe=()=>{const[e]=Bfe(),[t]=Gfe();return Qt((async()=>c7.hasToken()?e().unwrap():t().unwrap()),[e,t])},Yfe=({entryPoint:e})=>{const t=Zfe({entryPoint:e}),r=Kfe(),[n]=Vfe({}),a=Qt((async e=>e?await n({groupId:e},!0).unwrap():[]),[n]);return{getDefaultAppLink:Qt((async({defaultApp:n,groupName:i,groupId:o})=>{const s=n??("USER"===e?await r():await a(o))[0];return t(s,i)}),[t,r,e,a])}},Jfe=({entryPoint:e})=>{const t=Jw(),{getDefaultChannelLink:r}=Hfe(),{getDefaultAppLink:n}=Yfe({entryPoint:e}),a=Qt((async({username:e,groupId:t,defaultApp:a,groupName:i,defaultChannel:o})=>bz({username:e,groupname:i})||t&&await r({groupId:t,groupName:i,defaultChannel:o})||await n({groupId:t,groupName:i,defaultApp:a})),[bz,r,n]);return{openLastApp:Qt((async({queryParams:e,...r})=>{const n=await a(r);n&&t(n,{queryParams:e})}),[t,a]),getLastAppLink:a}},Qfe=({group:e})=>{const{getLastAppLink:t}=Jfe({entryPoint:"GROUP"}),[r,n]=yt(null);return Ze((()=>{const r=null==e?void 0:e.groupId,a=null==e?void 0:e.groupName;r&&a&&(async()=>{const e=await t({groupId:r,groupName:a});e&&n(e)})()}),[null==e?void 0:e.groupId,null==e?void 0:e.groupName,t]),r},xz={PRIVATE:{text:"Private",icon:S.jsx(U8,{})},PUBLIC:{text:"Public",icon:S.jsx(D8,{})}},$fe=420,ede=({group:e})=>{var t;const r=(null==(t=Z5({upload:e.banner,size:420}))?void 0:t.uri)||"",{members:n}=Ofe({groupId:e.groupId}),a=null==n?void 0:n.length,i=Qfe({group:e});return i?S.jsxs(Xy,{to:i,className:"mb-xs block overflow-hidden rounded-lg border border-gray-200 last:mb-0",children:[S.jsx("img",{src:r||Dfe,alt:e.displayName,className:"h-[130px] w-full object-cover"}),S.jsxs("div",{className:"pt-xs px-m pb-s",children:[S.jsx("div",{className:"mb-xs text-lg font-semibold text-gray-900",children:e.displayName}),S.jsxs("div",{className:"[&_svg]:mr-xxs [&_svg]:size-xxs flex items-center text-base font-medium text-gray-500",children:[xz[e.privacy].icon,xz[e.privacy].text,S.jsx("div",{className:"mx-xxxs",children:"·"}),a," ",1===a?"member":"members"]})]})]}):null},L5=({onCancel:e,onConfirm:t,className:r,isSubmitDisabled:n})=>S.jsxs("div",{className:ct("p-m gap-s flex justify-center bg-white",r),children:[S.jsx(gn,{variant:"secondary",className:"w-full",onClick:e,children:"Cancel"}),S.jsx(hf,{variant:"red_primary",className:"w-full",onClick:t,disabled:n,children:"Delete"})]}),tde=({open:e,onConfirm:t,onCancel:r,groups:n})=>{const a=n.length;return S.jsx(Jg,{open:e,onCloseModal:r,title:"Delete user profile",className:"max-h-[560px] max-w-[460px]",children:S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"mb-xs text-base text-gray-700",children:"This will delete the user and data. To reuse the username, change it first. The username stays reserved for 30 days."}),S.jsxs("div",{className:"mb-xs text-sm font-medium text-gray-500",children:["Group(s): ",a]}),S.jsx("div",{className:"no-scrollbar max-h-[396px] overflow-y-auto pb-[80px]",children:n.map((e=>S.jsx(ede,{group:e},e.groupId)))}),S.jsx(L5,{onCancel:r,onConfirm:t,className:"-left-m -right-m -bottom-m absolute border-t border-gray-200\n"})]})})},E5="DELETE",rde=Ve.object({value:Ve.string().refine((e=>e.trim()===E5),{message:"Value is not correct"})}),nde=({open:e,onClose:t,onConfirm:r})=>{const n=Tz({defaultValues:{value:""},resolver:Cw(rde)}),a=()=>{n.reset(),t()};return S.jsxs(Jg,{open:e,onCloseModal:a,title:"Delete user profile",className:"max-w-[460px]",children:[S.jsxs("p",{className:"mb-xxs text-sm font-medium text-gray-900",children:["Type ",S.jsx("i",{className:"font-normal",children:E5})," to delete user and all related data"]}),S.jsxs(H5,{...n,children:[S.jsx(Wn,{name:"value",control:n.control,className:"mb-m"}),S.jsx(L5,{onCancel:a,onConfirm:r,isSubmitDisabled:!n.formState.isValid,className:"!p-0"})]})]})},ade=({user:e})=>{const[t,r]=yt(!1),[n,a]=yt(!1),[i,o]=yt([]),[s,{isLoading:c}]=p8(),[l]=xS(),u=mt(Ur.selectors.selectUsers),d=null==u?void 0:u.find((t=>t.id!==e.id)),{changeUser:f}=uh();return d?S.jsxs(S.Fragment,{children:[S.jsx(tde,{open:t,onCancel:()=>r(!1),onConfirm:()=>{r(!1),a(!0)},groups:i}),S.jsx(nde,{open:n,onClose:()=>a(!1),onConfirm:()=>{s({id:e.id}),rn.success("Profile deleted successfully"),d&&f(d.id),a(!1)}}),S.jsxs("div",{className:"my-xl flex items-center justify-between text-base",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-red-dark mb-xxxs font-semibold",children:"Delete user profile"}),S.jsx("div",{className:"text-gray-500",children:"Permanently delete this profile and all content"})]}),S.jsxs(hf,{variant:"red_secondary",isLoading:c,onClick:()=>{(async()=>{const e=await l({}).unwrap();e.length>0?(o(e),r(!0)):a(!0)})()},children:[S.jsx(rT,{})," Delete profile"]})]})]}):null},sde=({title:e,description:t})=>S.jsxs("div",{className:"mb-m",children:[S.jsx("p",{className:"mb-xxxs text-base font-semibold text-gray-900",children:e}),S.jsx("span",{className:"text-gray-500",children:t})]}),ide=({user:e,tzList:t,saveOn:r="click",onDirtyChange:n,onSubmit:a,userNameError:i,isSubmitPending:o,renderBottomPanel:s})=>{var c,l,u,d,f;const p=wt({avatar:{preview:Fg({user:e,type:Hi.avatar}),uploadId:(null==(c=null==e?void 0:e.avatar)?void 0:c.uploadId)||null},header:{preview:Fg({user:e,type:Hi.header}),uploadId:(null==(l=null==e?void 0:e.header)?void 0:l.uploadId)||null}}),[h,y,g,m,v,_,k,b]=Dle({user:e,tzList:t,avatarId:null==(u=p.current.avatar)?void 0:u.uploadId,headerId:null==(d=p.current.header)?void 0:d.uploadId,userNameError:i,onSubmit:a,onDirtyChange:n}),{isUserNameChecked:w,handleUserNameChange:x,handleUserNameBlur:z}=pS({form:h,originalUsername:e.username}),A=h.formState.isDirty,j=h.formState.isValid,C=!h.getValues("canSubmit"),T=h.getValues("userName")!==e.username,P=A&&j&&!C&&(!T||w);Nie({canShowMessage:A&&!n8("dev")});const N="blur"===r,L=()=>{N&&y()},E=h.watch("channel"),M="Service"===h.watch("actorType")||!(null==(f=h.watch("botProfile"))||!f.role);return S.jsxs("div",{className:"flex min-h-[calc(100vh-100px)] flex-col justify-between",children:[S.jsxs("div",{children:[S.jsxs("label",{className:"mb-l flex items-center gap-2 text-base",children:[S.jsx("span",{className:"font-medium text-gray-700",children:"This is a bot"}),S.jsx(o7,{checked:M,onCheckedChange:e=>{h.setValue("actorType",e?"Service":"Person",{shouldDirty:!0}),e||h.setValue("botProfile",{role:"",triggers:[],personality_traits:[],tone:"",style:[],behaviors:[],prompt:""},{shouldDirty:!0})}})]}),S.jsx(fT,{user:e,onChange:e=>{p.current={...p.current,...e},g(p.current)},isChannel:E}),S.jsx(Yw,{...h,children:S.jsxs("form",{onBlur:N?y:void 0,className:"mt-xxs",children:[S.jsx("div",{className:ct("mb-s",{"mt-xl":E}),children:S.jsx(Wn,{icon:S.jsx(I8,{}),isRequired:!0,name:"userName",onFieldChange:x,onBlur:()=>{z()},displayName:E?"Channel Name":"User Name",maxChars:Cc.userName,className:"w-full"})}),S.jsxs("div",{className:ct("gap-s mb-s items-start justify-between md:flex [&>*]:basis-[calc(50%-8px)]",{"[&>*]:basis-full":E}),children:[S.jsx(Wn,{icon:E?S.jsx(ZC,{}):S.jsx(W8,{}),isRequired:!0,name:"displayName",displayName:"Display Name",maxChars:Cc.displayName,onAddEmoji:e=>h.setValue("displayName",e,{shouldDirty:!0})}),!E&&S.jsx("div",{className:"mt-s md:mt-0",children:S.jsx(Wn,{icon:S.jsx(eT,{}),name:"Pronouns",displayName:"Pronouns",maxChars:Cc.pronouns})})]}),S.jsx("div",{className:"mb-xl relative z-10 [&_input]:leading-5",children:S.jsx(Wn,{isTextArea:!0,name:"summary",displayName:"Bio",maxChars:Cc.description,className:"[&_textarea]:h-32",placeholder:"Write something about yourself...",onAddEmoji:e=>h.setValue("summary",e,{shouldDirty:!0})})}),S.jsx(sde,{title:"Additional information",description:"Control what additional info is shown on your profile"}),S.jsx(kfe,{form:h}),S.jsx(Zle,{form:h}),!E&&S.jsx(vfe,{form:h}),S.jsx("div",{className:"mb-s",children:S.jsx(Rle,{form:h,customFields:m,onFieldRemove:L,children:S.jsx(Lle,{onAdd:e=>{m.append({label:e.label,content:e.content}),L()}})})}),M&&S.jsx(Rfe,{form:h,botTriggers:v,botPersonalityTraits:_,botStyles:k,botBehaviors:b})]})}),S.jsx(ade,{user:e})]}),P&&S.jsx("div",{className:"-bottom-m md:-mx-m md:p-m sticky left-0 right-0 z-10 mx-[-16px] border-t border-gray-200 bg-white empty:hidden",children:s||N?null==s?void 0:s({isDisabled:!P,isPending:o,submitForm:()=>{y()}}):S.jsxs("div",{className:"gap-s flex items-center justify-center md:justify-normal",children:[S.jsx(Xy,{className:"flex min-h-10 w-full max-w-40 items-center justify-center text-sm font-semibold text-gray-700 md:hidden",to:"/settings/:tab?",props:{tab:""},children:"Cancel"}),S.jsx(hf,{"data-testid":"save",className:"w-full max-w-40 md:w-auto",disabled:!P,isLoading:o||C,onClick:()=>{y()},children:"Save"})]})})]})},N5=e=>{const t=S5();return t?S.jsx(ide,{...e,tzList:t}):null},ode={view:"default",transitView:null,isProfileFormDirty:!1},qn=Dd({name:"manageUsers",initialState:ode,reducers:{changeView:(e,{payload:t})=>{e.isProfileFormDirty?e.transitView=t:(e.view=t,e.transitView=null)},resetTransitView:e=>{e.transitView=null},changeProfileFormDirty:(e,{payload:t})=>{e.isProfileFormDirty=t}},selectors:{selectView:e=>e.view,selectTransitView:e=>e.transitView,selectIsProfileFormDirty:e=>e.isProfileFormDirty}}).injectInto(Hw),cde=({onCancel:e,onSuccess:t})=>{const{changeUser:r}=uh(),n=Io(),[a,i]=yt(""),{createUser:o,isLoading:s}=F4(),[c,{isLoading:l,isSuccess:u,data:d,reset:f}]=W5();Ze((()=>{u&&(t(),f(),null!=d&&d.id&&r(d.id))}),[u,t,f,r,null==d?void 0:d.id]);return S.jsx("div",{children:S.jsx("div",{children:S.jsx(N5,{user:{displayName:"",username:"",summary:"",fields:{}},userNameError:a,onDirtyChange:e=>{n(qn.actions.changeProfileFormDirty(e))},onSubmit:async e=>{try{const t=await o(e);t&&await c({userId:t.id,userUpdate:t})}catch(e){const{isError:t,message:r}=qg(e);t&&i(r)}},isSubmitPending:s||l,renderBottomPanel:({isDisabled:t,isPending:r,submitForm:n})=>S.jsxs("div",{className:"grid w-full grid-cols-2 gap-4 md:flex md:w-auto md:justify-end",children:[S.jsx(gn,{size:"m",variant:"tertiary",className:"px-6 text-base",onClick:e,children:"Cancel"}),S.jsx(hf,{"data-testid":"button-loader",disabled:t,isLoading:r,onClick:n,size:"m",variant:"primary",children:"Save Changes"})]})})})})},I5="updateUser",lde=({user:e})=>{const t=Io(),[r,n]=yt(""),[a,{isLoading:i}]=nk({fixedCacheKey:I5});return{onSubmit:async r=>{try{const n=await a({userId:e.id,userUpdate:r,htmlContent:!1}).unwrap();n&&t(pa.actions.setUser(n))}catch(e){const t=e,{isError:r,message:a}=qg(t);r&&n(a)}},isLoading:i,userNameError:r}},ude=e=>{const{onSubmit:t,isLoading:r,userNameError:n}=lde({user:e.user});return S.jsx(N5,{...e,onSubmit:t,isSubmitPending:r,userNameError:n})},$k=({open:e,title:t,children:r,leftButton:n,rightButton:a,onClose:i,titleTestId:o,...s})=>S.jsxs(Jg,{open:e,onCloseModal:i,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...s,children:[S.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-gray-700","data-testid":o,children:t}),r&&S.jsx("div",{className:"text-center text-base text-gray-500",children:r}),S.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[S.jsx(hf,{size:"m",variant:"secondary",className:"flex-1",...n,title:void 0,children:n.title}),a&&S.jsx(hf,{size:"m",className:"flex-1",...a,title:void 0,children:a.title})]})]}),fde=({open:e,userId:t,onCancel:r,onConfirm:n})=>{const{changeUser:a}=uh(),i=mt((e=>Ur.selectors.selectUserById(e,t))),o=mt(Ur.selectors.selectUsers),[s,{isLoading:c}]=p8();return i?S.jsx($k,{open:e,title:"Delete this user forever?",leftButton:{title:"Cancel",variant:"secondary",isLoading:!1,onClick:r},rightButton:{title:"Delete User",variant:"red_primary",isLoading:c,onClick:()=>{(async()=>{var e;const r=null==(e=null==o?void 0:o.find((e=>e.id!==t)))?void 0:e.id;r&&a(r),await s({id:t}),null==n||n()})()}},children:"This user and all the data, including messages and contacts, will be permanently deleted. Are you sure?"}):null},dde=e=>{try{const{type:t,payload:r}=e,n={type:t};return void 0!==r&&(n.payload=JSON.parse(JSON.stringify(r))),n}catch(t){return pi.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},pde=e=>{const t=window.parent??window;if(t)try{const r=dde(e);t.postMessage(r,"*")}catch(e){pi.error("Failed to process or send message:",e)}},hde=()=>{window.parent===window?Xw().dispatch(sk.actions.setAskLoginOpen(!0)):pde(Z7())},eb=e=>{const t=mt(Ur.selectors.selectCurrentUser),r=mt(l7.selectors.selectIsAuthenticated),n="SUSPENDED"===(null==t?void 0:t.state),a=n;return{isDisabled:a,guardedAction:(e=()=>{})=>()=>{r?r&&!n&&e():hde()},ActionTooltipWrapper:({children:e,triggerClassname:r})=>a?S.jsx(Kw,{theme:"dark",tooltipText:`${hm(t)} is suspended`,size:"default",triggerClassname:r,children:S.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):S.jsx(S.Fragment,{children:e})}},Az=({isDisabled:e,onSubmit:t,isLoading:r,onCancel:n})=>S.jsxs(S.Fragment,{children:[S.jsx(gn,{variant:"tertiary",className:"mr-3",onClick:n,children:"Cancel"}),S.jsx(hf,{"data-testid":"button-loader",disabled:e,isLoading:r,onClick:t,size:"m",variant:"primary",children:"Save Changes"})]}),gde=({user:e,onCancel:t,onSuccess:r,onRemoveUser:n})=>{const a=mt(Ur.selectors.selectUsers),i=((null==a?void 0:a.length)||0)>1,o=Io(),s=mt(qn.selectors.selectIsProfileFormDirty),[,{isSuccess:c,reset:l}]=nk({fixedCacheKey:I5});Ze((()=>{c&&(r(),l())}),[c,r,l]);const{isDisabled:u}=eb(),[d,f,p]=Sm();return S.jsx("div",{className:ct(u&&"pointer-events-none opacity-[.5]"),children:S.jsx(ude,{user:e,onDirtyChange:e=>o(qn.actions.changeProfileFormDirty(e)),renderBottomPanel:({isPending:r,submitForm:a})=>S.jsx("div",{className:"flex w-full items-center justify-between",children:i?S.jsxs("div",{className:"gap-xxs flex",children:[S.jsx(fde,{open:d,userId:e.id,onCancel:()=>{t(),p()},onConfirm:n}),S.jsx("div",{className:"flex items-center",children:S.jsx(Az,{isLoading:r,onCancel:t,isDisabled:!s,onSubmit:a})}),S.jsx(gn,{variant:"red_primary",onClick:f,children:"Delete User"})]}):S.jsx("div",{className:ct("grid w-full grid-cols-2 gap-4","md:flex md:w-auto",i?"md:justify-end":"md:ml-auto"),children:S.jsx(Az,{isLoading:r,onCancel:t,isDisabled:!s,onSubmit:a})})})})})},mpe=()=>{const e=Io(),t=mt(qn.selectors.selectView),[r,n]=TS("string"!=typeof t?null==t?void 0:t.username:void 0),a=Qt((()=>{e(qn.actions.changeView("default"))}),[]),i=Qt((()=>{e(qn.actions.changeProfileFormDirty(!1)),e(qn.actions.changeView("default"))}),[]),o=Qt((()=>{e(qn.actions.changeView("default"))}),[]);if(n)return S.jsx(KC,{className:"m-auto mt-12 h-24 w-24 animate-spin",size:"48"});switch(!0){case"create"===t:return S.jsx(cde,{onCancel:a,onSuccess:i});case!(null==t||!t.id):return S.jsx(gde,{onCancel:a,onSuccess:i,user:r||t,onRemoveUser:o});default:return S.jsxs("div",{className:"mt-5 text-center text-base text-gray-700",children:["Choose user on the right to edit an existing @user",S.jsx("br",{}),"or create a new @user"]})}},_pe=()=>{const e=Io(),t=mt(qn.selectors.selectTransitView),r=()=>{e(qn.actions.resetTransitView())};return S.jsx($k,{open:!!t,onClose:r,title:"Draft is not gonna be saved",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:r},rightButton:{title:"Do Not Save",size:"m",isLoading:!1,variant:"primary",onClick:()=>{e(qn.actions.changeProfileFormDirty(!1)),t&&e(qn.actions.changeView(t))}},children:"If you leave, this draft will not be saved. Are you sure?"})},yde=()=>{const[e,{isLoading:t,isSuccess:r}]=_S(),{logout:n}=Iz(),[a,i]=yt(!1);return Ze((()=>{r&&n()}),[r,n]),S.jsxs(S.Fragment,{children:[S.jsx(gn,{variant:"red_primary",className:"w-max",onClick:()=>i(!0),children:"Delete this account"}),S.jsx($k,{open:a,onClose:()=>i(!1),title:"Delete this account forever?",leftButton:{title:"Cancel",variant:"secondary",isLoading:!1,onClick:()=>i(!1)},rightButton:{title:"Delete",variant:"red_primary",isLoading:t,onClick:()=>{e()}},children:"If you delete an account, all its users will also be deleted permanently. Are you sure?"})]})},zz="divide-x-0 hover:text-blue_100 cursor-pointer font-semibold flex gap-2",vpe=()=>{const e=mt(Ur.selectors.selectAccount),{isDisabled:t,ActionTooltipWrapper:r}=eb();return e?S.jsx("div",{className:"w-[560px] text-sm font-medium text-gray-700",children:S.jsxs("div",{className:"grid gap-5",children:[S.jsx("div",{className:"text-base font-normal text-gray-400",children:"You can change your data"}),S.jsx(Xy,{to:"/account/request-change-email",disabled:t,children:S.jsx(r,{children:S.jsxs("div",{className:ct(zz,t&&"opacity-50 hover:text-inherit"),children:[S.jsx(QC,{size:20}),S.jsx("span",{className:"text-base",children:"Change Email"})]})})}),S.jsx(Xy,{to:"/account/request-change-password",children:S.jsxs("div",{className:zz,children:[S.jsx(U8,{size:20}),S.jsx("span",{className:"text-base",children:"Change Password"})]})}),S.jsx("div",{className:"border-b border-dashed"}),S.jsx("div",{className:"text-base font-normal text-gray-400",children:"Your account will be deleted permanently"}),S.jsx(yde,{})]})}):null},wpe=()=>{const e=mt(Ur.selectors.selectAccount),t=mt(Ur.selectors.selectUsers);if(!e)return null;const{email:r,createdAt:n}=e;return S.jsxs("div",{className:"text-base font-medium text-gray-700",children:[S.jsx("div",{className:"truncate",children:r}),S.jsxs("div",{className:"mt-1 flex flex-row *:mr-1",children:[S.jsx("div",{className:"font-normal text-gray-400",children:"registered"}),S.jsx("div",{className:"text-gray-700",children:Ol(n).format("DD.MM.YYYY")})]}),S.jsx("div",{className:"my-5 border-b border-dashed"}),S.jsx("div",{children:null==t?void 0:t.map((e=>{var t,r;return S.jsx(ym,{username:e.username,imgUrl:(null==(r=null==(t=e.avatar)?void 0:t.files[0])?void 0:r.uri)||void 0,avatarClassName:"h-12 w-12 2xl:h-12 2xl:w-12",displayName:e.displayName,userTextClassname:"[&>div]:text-gray-600 max-w-[calc(100%-48px)]",className:"mb-3 max-w-full rounded-md border-gray-100 lg:border lg:bg-gray-50 lg:p-2"},e.username)}))})]})},mde=()=>{const e=Io(),t=mt(qn.selectors.selectView),r=mt(Ur.selectors.selectUsers),n=(null==t?void 0:t.id)||"";Ze((()=>{n&&((null==r?void 0:r.some((({id:e})=>e===n)))||(e(qn.actions.changeProfileFormDirty(!1)),e(qn.actions.changeView("default"))))}),[null==r?void 0:r.length,n])},_de=()=>{const{changeUser:e}=uh(),t=mt(qn.selectors.selectView),r=null==t?void 0:t.id;Ze((()=>{r&&e(r)}),[r])},kpe=()=>{const e=Io(),t=mt(qn.selectors.selectView),r=mt(Ur.selectors.selectUsers),n=!mt(qn.selectors.selectTransitView),{isDisabled:a,ActionTooltipWrapper:i}=eb(),o="create"===t||a,s=(null==t?void 0:t.id)||"";return _de(),mde(),S.jsxs("div",{children:[S.jsx("div",{className:"px-2.5 text-xs font-normal text-gray-700 max-lg:my-5 max-md:my-3 lg:hidden",children:"Choose user to edit an existing @user or create a new @user"}),S.jsx(i,{children:S.jsxs("div",{className:ct("flex cursor-pointer flex-row items-center px-2.5",o&&"cursor-default opacity-35"),onClick:()=>{o||e(qn.actions.changeView("create"))},children:[S.jsx("div",{className:"rounded-md bg-gray-100 p-[14px]",children:S.jsx(gm,{size:20,className:"h-5 w-5"})}),S.jsx("span",{className:"ml-2.5 text-base font-semibold text-gray-700",children:"Create New User"})]})}),S.jsx("div",{className:"mx-2.5 my-5 border-b border-dashed"}),S.jsx("div",{className:"flex flex-col gap-2",children:null==r?void 0:r.map((t=>{var r,a;return S.jsxs("div",{className:ct("hover:bg-accent flex items-center justify-between p-2",s!==t.id?"cursor-pointer":"bg-accent"),onClick:()=>(t=>{n&&e(qn.actions.changeView(t))})(t),children:[S.jsx(ym,{hasCheckIcon:s===t.id,username:t.username,imgUrl:(null==(a=null==(r=t.avatar)?void 0:r.files[0])?void 0:a.uri)||void 0,avatarClassName:"h-12 w-12 2xl:h-12 2xl:w-12",displayName:t.displayName,className:"p-1"}),S.jsx(O8,{size:24,className:"text-gray-700 md:hidden"})]},t.username)}))})]})},bpe=e=>{const t=mt(Ur.selectors.selectCurrentUser);return(null==t?void 0:t.id)===e},vde=e=>!(null!=e&&e.following)||"REJECTED"===(null==e?void 0:e.following),wde=e=>"ACCEPTED"===(null==e?void 0:e.following),xpe=e=>vde(e)&&"ACCEPTED"===(null==e?void 0:e.followed),Ape=e=>"PENDING"===(null==e?void 0:e.following),zpe=e=>wde(e),Spe=e=>!(null==e||!e.blocked),Cpe=e=>!(null==e||!e.blockedBy),Tpe=e=>{var t;return!(null==(t=null==e?void 0:e.muted)||!t.state)},jpe=e=>"ACCEPTED"===(null==e?void 0:e.followed),kde=/^(?:\d{2}(?:\/\d{2})?(?:\/\d{4})?|\/\d{2}(?:\/\d{4})?|\/\/\d{4})$/,Ppe=e=>{try{if(!kde.test(e))return e;const t=e.split("/"),r=new Date(e),n=3===t.length,a=2===t.length,i=1===t.length;switch(!0){case n:return new Intl.DateTimeFormat(navigator.language,{year:"numeric",month:"short",day:"numeric"}).format(r);case a:return new Intl.DateTimeFormat(navigator.language,{month:"short",day:"numeric"}).format(r);case i:return new Intl.DateTimeFormat(navigator.language,{year:"numeric"}).format(r);default:return e}}catch{return console.error("formatBday error for date",e),e}};export{wpe as AccountInfoBlock,mpe as CreateEditUser,Eie as CreateUserModal,ude as EditProfile,fT as EditUserMedia,kpe as ManageUsersList,_pe as ProtectFormDraftModal,hT as SwitchUserProfileContent,dk as UserAvatar,ym as UserCard,yT as UserMenu,npe as UserMenuDropdown,vpe as UserProfile,vde as canFollow,xpe as canFollowBack,wde as canUnfollow,jpe as canUnsubscribeFromMe,Ppe as formatBday,Spe as isBlocked,Cpe as isBlockedBy,Ape as isFollowPending,zpe as isFollowing,Tpe as isMuted,qn as manageUsersSlice,Qde as useAccountWsUpdate,uh as useChangeUser,F4 as useCreateUser,OS as useCurrentUser,rpe as useCurrentUserUpdate,_S as useDeleteApiV1AccountsDeleteMutation,Ude as useDeleteApiV1MuteByUserIdMutation,Vde as useDeleteApiV1NotesByUserIdMutation,p8 as useDeleteApiV1UsersMutation,tpe as useExtraUserUpdate,Ode as useGetApiV1AccountsProfileQuery,qde as useGetApiV1MuteQuery,Xde as useGetApiV1UsersByUserIdFollowersQuery,AS as useGetApiV1UsersByUserIdQuery,Bde as useGetApiV1UsersFollowersQuery,vS as useGetApiV1UsersQuery,wS as useGetApiV1UsersRelationshipsQuery,Jde as useGetApiV1UsersRemoteByUserNameFullFollowersQuery,Mde as useGetInteractionUrlQuery,$de as useGetMyProfile,epe as useGetUserById,CS as useGetUserByUserName,TS as useGetUserNoHtml,bpe as useIsOwnProfile,bS as useLazyGetApiV1GeoQuery,xS as useLazyGetApiV1GroupsOwnedQuery,kS as useLazyGetApiV1UsersRelationshipsQuery,Gde as useLazyGetApiV1UsersRenameHistoryQuery,Wde as usePostApiV1AdminUserChangeStateMutation,Dde as usePostApiV1MuteByUserIdMutation,Yde as usePostApiV1UsersFollowByUsernameAcceptMutation,Hde as usePostApiV1UsersFollowByUsernameMutation,Kde as usePostApiV1UsersFollowByUsernameRejectMutation,Zde as usePostApiV1UsersFollowByUsernameUndoMutation,mS as usePostApiV1UsersMutation,Fde as usePutApiV1NotesMutation,nk as usePutApiV1UsersByUserIdMutation,US as useRelationship,h8 as useSafeUserUpdate,d8 as userApi,pa as userNoHTMLSlice,Ur as userSlice};