@wellesley/uploads 1.0.344 → 1.0.346

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 +1 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as U_,handleBasicResponse as Ur,usePostApiV1UploadsMutation as B_,useDeleteApiV1UploadsByIdMutation as F_,usePostApiV1UploadsByIdMetaMutation as N_}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.459";import{useSelector as Ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as $r}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as Aa,createSelector as $t,createSlice as W_}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import Q,{useRef as vo,useState as ze,useEffect as cn,forwardRef as $_,PureComponent as H_,createRef as oa,useLayoutEffect as Y_}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as K_,cn as Wn,Dialog as G_,DialogContent as z_,Button as fo}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.421";const q_=U_.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e)}}}}),{usePostApiV1UploadsByIdMetaMutation:ww,usePostApiV1UploadsListMutation:vw,usePutApiV1UploadsByIdTagsMutation:mw,usePostApiV1UploadsBatchMutation:xw}=q_;var an=(t=>(t.done="done",t.inprogress="inprogress",t))(an||{}),Nt=(t=>(t.image="image",t.video="video",t.audio="audio",t))(Nt||{}),Ia=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t))(Ia||{});const mo=t=>{const e=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return e?e[1]:void 0},X_=async({url:t,...e})=>{const n=await fetch(t,e);if(!n.ok)throw new Error(n.statusText);if("PUT"===e.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},k_=t=>t.replace(/\.[^.]*$/,""),Ra=()=>"object"!=typeof window,V_=()=>!Ra()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),$n="8.48.0",pt=globalThis;function xo(t,e,n){const r=pt,i=r.__SENTRY__=r.__SENTRY__||{},o=i[$n]=i[$n]||{};return o[t]||(o[t]=e())}const Ea=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Z_="Sentry Logger ",sa=["debug","info","warn","error","log","assert","trace"],ua={};function J_(t){if(!("console"in pt))return t();const e=pt.console,n={},r=Object.keys(ua);r.forEach((t=>{const r=ua[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}function Q_(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Ea?sa.forEach((n=>{e[n]=(...e)=>{t&&J_((()=>{pt.console[n](`${Z_}[${n}]:`,...e)}))}})):sa.forEach((t=>{e[t]=()=>{}})),e}const Wr=xo("logger",Q_);function yo(){return So(pt),pt}function So(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||$n,e[$n]=e[$n]||{}}const j_=Object.prototype.toString;function e0(t,e){return j_.call(t)===`[object ${e}]`}function t0(t){return e0(t,"Object")}function n0(t){return!(!t||!t.then||"function"!=typeof t.then)}function r0(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Ea&&Wr.log(`Failed to add non-enumerable property "${e}" to object`,t)}}const ba=1e3;function La(){return Date.now()/ba}function i0(){const{performance:t}=pt;if(!t||!t.now)return La;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/ba}const o0=i0();function ln(){const t=pt,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function s0(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||o0(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:ln()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function aa(){return ln()}function ca(){return ln().substring(16)}function Da(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&e&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=Da(r[t],e[t],n-1));return r}(()=>{const{performance:t}=pt;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,a=t.timing&&t.timing.navigationStart,u="number"==typeof a?Math.abs(a+n-r):e;(o||u<e)&&(i<=u&&t.timeOrigin)})();const wo="_sentrySpan";function la(t,e){e?r0(t,wo,e):delete t[wo]}function fa(t){return t[wo]}const u0=100;class Co{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:aa(),spanId:ca()}}clone(){const t=new Co;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,la(t,fa(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&s0(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof Hn?[e.getScopeData(),e.getRequestSession()]:t0(e)?[t,t.requestSession]:[],{tags:i,extra:o,user:a,contexts:u,level:s,fingerprint:c=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...u},a&&Object.keys(a).length&&(this._user=a),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,la(this,void 0),this._attachments=[],this.setPropagationContext({traceId:aa()}),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:u0;if(n<=0)return this;const r={timestamp:La(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:fa(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Da(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:ca(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:ln();if(!this._client)return Wr.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:ln();if(!this._client)return Wr.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:ln();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Wr.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Hn=Co;function a0(){return xo("defaultCurrentScope",(()=>new Hn))}function c0(){return xo("defaultIsolationScope",(()=>new Hn))}class l0{constructor(t,e){let n,r;n=t||new Hn,r=e||new Hn,this._stack=[{scope:n}],this._isolationScope=r}withScope(t){const e=this._pushScope();let n;try{n=t(e)}catch(t){throw this._popScope(),t}return n0(n)?n.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function fn(){const t=So(yo());return t.stack=t.stack||new l0(a0(),c0())}function f0(t){return fn().withScope(t)}function h0(t,e){const n=fn();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function ha(t){return fn().withScope((()=>t(fn().getIsolationScope())))}function d0(){return{withIsolationScope:ha,withScope:f0,withSetScope:h0,withSetIsolationScope:(t,e)=>ha(e),getCurrentScope:()=>fn().getScope(),getIsolationScope:()=>fn().getIsolationScope()}}function Oa(t){const e=So(t);return e.acs?e.acs:d0()}function Ma(){return Oa(yo()).getCurrentScope()}function p0(){return Oa(yo()).getIsolationScope()}function g0(t,e){return Ma().captureException(t,void 0)}function _0(t,e){const n={captureContext:e};return Ma().captureMessage(t,void 0,n)}function w0(t,e){p0().setExtra(t,e)}var Br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const v0=(...t)=>{let e="";for(const n of t){if(n instanceof Error){const t=n;return w0("exceptionMessage",e),void g0(t)}if("object"!=typeof n)e+=n;else try{e+=" "+JSON.stringify(n)}catch{e+=" "+n}}_0(e)},da=["debug","info","warn","error"],m0=(t,e)=>{const n=da.indexOf(t);return da.indexOf(e)>=n},Fr=(t,e,n,...r)=>{m0(e,t)&&console.log(`[${t}] ${n}`,...r)},x0=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),y0=(t=(Ra()?"info":x0()||"warn"))=>{let e=t;return{debug:(t,...n)=>Fr("debug",e,t,...n),info:(t,...n)=>Fr("info",e,t,...n),warn:(t,...n)=>Fr("warn",e,t,...n),error:(t,...n)=>(v0(t,...n),Fr("error",e,t,...n)),setLevel:t=>{e=t},getLevel:()=>e}},Ao=y0(),Ta=({src:t,name:e=""})=>new Promise(((n,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:a,src:u}=i,s=k_(e);(!t||!o||!a||!u)&&r(),n({src:u,name:s,width:a,height:o,duration:Math.floor(t)})},a=()=>{Ao.warn("Failed to load video"),n(null)};return V_()&&i.load(),i.addEventListener("error",a),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",a),i.removeEventListener("loadeddata",o)}})),Io=t=>new Promise(((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{e({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{Ao.warn("Failed to load image"),n(null),URL.revokeObjectURL(i)},r.src=i})),pa=t=>{if(!t)return;const e="number"==typeof t?t:parseInt(t,10);if(isNaN(e))throw new Error("Can not get number from income argument");const n=e/1048576;return`${Math.floor(n)} MB`},S0=async({media:t,docPolicy:e,imgPolicy:n,videoPolicy:r,audioPolicy:i})=>{if(!n||!r)return"Media policy is not defined";const o={IMAGE:n.extensions,VIDEO:r.extensions,AUDIO:i.extensions,DOCUMENT:e.extensions},a=mo(t.file.name)||"",u=Object.keys(o).find((t=>{var e;return null==(e=o[t])?void 0:e.includes(a)}));if(!u)return`Extension ${a} is not supported`;const s="VIDEO"===u;if("IMAGE"===u){const e=await Io(t.file),r=t.file.size>n.maxSize,i=e&&Math.max(e.width,e.height)>n.maxResolution,o=e&&e.width*e.height>n.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${pa(n.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o: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 ${n.maxMatrix} pixels`}}if(s){const e=await Ta({src:t.objectUrl}),n=e&&e.duration>r.maxDuration,i=e&&Math.max(e.width,e.height)>r.maxResolution,o=t.file.size>r.maxSize,a=e&&e.width*e.height>r.maxMatrix;switch(!0){case n:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${pa(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case a: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 ${r.maxMatrix} pixels`}}},C0=t=>{if("object"!=typeof t||null===t)return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||null===Object.getPrototypeOf(t)},A0=t=>C0(t)&&"type"in t&&"string"==typeof t.type,Y=t=>{const e=e=>({type:t,payload:e});return e.toString=()=>`${t}`,e.type=t,e.match=e=>A0(e)&&e.type===t,e};Y("remoteReady"),Y("reselectUser"),Y("requestLogin"),Y("requestLogout"),Y("setConfirmLeavePage"),Y("requestChangePath"),Y("wsSubscribe"),Y("wsUnSubscribe"),Y("hostStoreConnect"),Y("remoteLogin"),Y("remoteLogout"),Y("wsOnMessage"),Y("setRouterPath"),Y("setDeviceType"),Y("setUserError"),Y("setUserIsError"),Y("setUserPending"),Y("setUserSuccess"),Y("setUserData"),Y("updateAccountData"),Y("updateUser"),Y("addNotification"),Y("markNotification"),Y("setNotificationsError"),Y("setNotificationsList"),Y("setNotificationsPending"),Y("setNotificationsTotalCount"),Y("setNotificationsUnreadCount"),Y("resetNotificationsState"),Y("undoNotification"),Y("setInstanceInfo"),Y("setInstanceInfoPending"),Y("setInstanceInfoError");const I0=Y("setPlatformSettings");Y("setProfileSettings"),Y("setGroupData"),Y("setGroupLoading"),Y("showGroupBasicInfo"),Aa("requestMicroFrontendFetch"),Aa("sendMicroFrontendFetchResponse");const R0={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"},Pa={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"},E0={data:null,isPending:!1},{posts:ho,uploadsPolicyDoc:ga,uploadsPolicyAudio:po,uploadsPolicyImage:Nr,uploadsPolicyVideo:Bn,registration:b0,captcha:L0}=Pa,{captcha:D0,language:O0,translation:M0,openai:T0}=R0,hn=t=>t.data,P0=$t(hn,(t=>{var e,n,r;return{max_characters:(null==(e=null==t?void 0:t[ho])?void 0:e.max_characters)||0,max_media_attachments:(null==(n=null==t?void 0:t[ho])?void 0:n.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[ho])?void 0:r.max_pins)||0}})),Ua=$t(hn,(t=>{var e,n,r;return{...null==t?void 0:t[Nr],maxSize:(null==(e=null==t?void 0:t[Nr])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[Nr])?void 0:n.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[Nr])?void 0:r.maxResolution)||0}})),Ba=$t(hn,(t=>{var e,n,r,i;return{...null==t?void 0:t[Bn],maxSize:(null==(e=null==t?void 0:t[Bn])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[Bn])?void 0:n.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Bn])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Bn])?void 0:i.maxResolution)||0}})),Fa=$t(hn,(t=>{var e,n;return{...null==t?void 0:t[po],maxSize:null==(e=null==t?void 0:t[po])?void 0:e.maxSize,keepOriginal:(null==(n=null==t?void 0:t[po])?void 0:n.keepOriginal)||0}})),Na=$t(hn,(t=>{var e;return{...null==t?void 0:t[ga],maxSize:(null==(e=null==t?void 0:t[ga])?void 0:e.maxSize)||0}})),Wa=$t([Ua,Ba,Fa,Na],((t,e,n,r)=>({IMAGE:null==t?void 0:t.extensions,VIDEO:null==e?void 0:e.extensions,AUDIO:null==n?void 0:n.extensions,DOCUMENT:null==r?void 0:r.extensions}))),U0=$t(Wa,(t=>Object.keys(t).reduce(((e,n)=>[...e,...t[n]||[]]),[]))),Wt=W_({name:"platformSettings",initialState:E0,reducers:{setError:(t,e)=>{t.error=e.payload},setPending:(t,e)=>{t.isPending=e.payload}},extraReducers:t=>{t.addCase(I0,((t,{payload:e})=>{t.data={...t.data,...e}}))},selectors:{selectSettings:hn,selectPostConfig:P0,selectDocPolicy:Na,selectImagePolicy:Ua,selectVideoPolicy:Ba,selectAudioPolicy:Fa,selectSupportedExtensions:Wa,selectFullExtensionsList:U0,selectRegistration:t=>{var e;return null==(e=t.data)?void 0:e[b0]},selectLanguageDetection:t=>{var e;return null==(e=t.data)?void 0:e[O0]},selectLanguageTranslation:t=>{var e;return null==(e=t.data)?void 0:e[M0]},selectOpenai:t=>{var e;return null==(e=t.data)?void 0:e[T0]},selectCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[L0]},selectAdminCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[D0]},selectPlatformTranslation:t=>{var e;return null==(e=t.data)?void 0:e[Pa.translation]}}}),$a=()=>{const[t]=B_(),e=new AbortController,n=e.signal,r=Ft(Wt.selectors.selectImagePolicy),i=Ft(Wt.selectors.selectVideoPolicy),o=Ft(Wt.selectors.selectDocPolicy),a=Ft(Wt.selectors.selectAudioPolicy);return[async({media:e,tag:u,onError:s,onUpload:c})=>{var l;const f=mo(e.file.name),h=await S0({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:a,media:e});if(h)return $r.error(h),void(null==s||s());try{const r=await t({createUpload:{extension:f,tags:[u],meta:{name:e.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(l=r.data)?void 0:l.uri;return await X_({url:i,method:"PUT",body:e.file,signal:n}),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),$r(`Could not upload file. ${t}`)}},()=>e.abort("Upload canceled")]};var _a,Nn={exports:{}},B0=Nn.exports;
1
+ import{api as U_,handleBasicResponse as Ur,usePostApiV1UploadsMutation as B_,useDeleteApiV1UploadsByIdMutation as F_,usePostApiV1UploadsByIdMetaMutation as N_}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.461";import{useSelector as Ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as $r}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as Aa,createSelector as $t,createSlice as W_}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import Q,{useRef as vo,useState as ze,useEffect as cn,forwardRef as $_,PureComponent as H_,createRef as oa,useLayoutEffect as Y_}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as K_,cn as Wn,Dialog as G_,DialogContent as z_,Button as fo}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.423";const q_=U_.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:e}){await Ur(e)}}}}),{usePostApiV1UploadsByIdMetaMutation:ww,usePostApiV1UploadsListMutation:vw,usePutApiV1UploadsByIdTagsMutation:mw,usePostApiV1UploadsBatchMutation:xw}=q_;var an=(t=>(t.done="done",t.inprogress="inprogress",t))(an||{}),Nt=(t=>(t.image="image",t.video="video",t.audio="audio",t))(Nt||{}),Ia=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t))(Ia||{});const mo=t=>{const e=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return e?e[1]:void 0},X_=async({url:t,...e})=>{const n=await fetch(t,e);if(!n.ok)throw new Error(n.statusText);if("PUT"===e.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},k_=t=>t.replace(/\.[^.]*$/,""),Ra=()=>"object"!=typeof window,V_=()=>!Ra()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),$n="8.48.0",pt=globalThis;function xo(t,e,n){const r=pt,i=r.__SENTRY__=r.__SENTRY__||{},o=i[$n]=i[$n]||{};return o[t]||(o[t]=e())}const Ea=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Z_="Sentry Logger ",sa=["debug","info","warn","error","log","assert","trace"],ua={};function J_(t){if(!("console"in pt))return t();const e=pt.console,n={},r=Object.keys(ua);r.forEach((t=>{const r=ua[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}function Q_(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Ea?sa.forEach((n=>{e[n]=(...e)=>{t&&J_((()=>{pt.console[n](`${Z_}[${n}]:`,...e)}))}})):sa.forEach((t=>{e[t]=()=>{}})),e}const Wr=xo("logger",Q_);function yo(){return So(pt),pt}function So(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||$n,e[$n]=e[$n]||{}}const j_=Object.prototype.toString;function e0(t,e){return j_.call(t)===`[object ${e}]`}function t0(t){return e0(t,"Object")}function n0(t){return!(!t||!t.then||"function"!=typeof t.then)}function r0(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Ea&&Wr.log(`Failed to add non-enumerable property "${e}" to object`,t)}}const ba=1e3;function La(){return Date.now()/ba}function i0(){const{performance:t}=pt;if(!t||!t.now)return La;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/ba}const o0=i0();function ln(){const t=pt,e=t.crypto||t.msCrypto;let n=()=>16*Math.random();try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const t=new Uint8Array(1);return e.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function s0(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||o0(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:ln()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function aa(){return ln()}function ca(){return ln().substring(16)}function Da(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&e&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=Da(r[t],e[t],n-1));return r}(()=>{const{performance:t}=pt;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,a=t.timing&&t.timing.navigationStart,u="number"==typeof a?Math.abs(a+n-r):e;(o||u<e)&&(i<=u&&t.timeOrigin)})();const wo="_sentrySpan";function la(t,e){e?r0(t,wo,e):delete t[wo]}function fa(t){return t[wo]}const u0=100;class Co{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:aa(),spanId:ca()}}clone(){const t=new Co;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,la(t,fa(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&s0(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,[n,r]=e instanceof Hn?[e.getScopeData(),e.getRequestSession()]:t0(e)?[t,t.requestSession]:[],{tags:i,extra:o,user:a,contexts:u,level:s,fingerprint:c=[],propagationContext:l}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...u},a&&Object.keys(a).length&&(this._user=a),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,la(this,void 0),this._attachments=[],this.setPropagationContext({traceId:aa()}),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:u0;if(n<=0)return this;const r={timestamp:La(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:fa(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Da(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:ca(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:ln();if(!this._client)return Wr.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n&&n.event_id?n.event_id:ln();if(!this._client)return Wr.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:ln();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Wr.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Hn=Co;function a0(){return xo("defaultCurrentScope",(()=>new Hn))}function c0(){return xo("defaultIsolationScope",(()=>new Hn))}class l0{constructor(t,e){let n,r;n=t||new Hn,r=e||new Hn,this._stack=[{scope:n}],this._isolationScope=r}withScope(t){const e=this._pushScope();let n;try{n=t(e)}catch(t){throw this._popScope(),t}return n0(n)?n.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function fn(){const t=So(yo());return t.stack=t.stack||new l0(a0(),c0())}function f0(t){return fn().withScope(t)}function h0(t,e){const n=fn();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function ha(t){return fn().withScope((()=>t(fn().getIsolationScope())))}function d0(){return{withIsolationScope:ha,withScope:f0,withSetScope:h0,withSetIsolationScope:(t,e)=>ha(e),getCurrentScope:()=>fn().getScope(),getIsolationScope:()=>fn().getIsolationScope()}}function Oa(t){const e=So(t);return e.acs?e.acs:d0()}function Ma(){return Oa(yo()).getCurrentScope()}function p0(){return Oa(yo()).getIsolationScope()}function g0(t,e){return Ma().captureException(t,void 0)}function _0(t,e){const n={captureContext:e};return Ma().captureMessage(t,void 0,n)}function w0(t,e){p0().setExtra(t,e)}var Br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const v0=(...t)=>{let e="";for(const n of t){if(n instanceof Error){const t=n;return w0("exceptionMessage",e),void g0(t)}if("object"!=typeof n)e+=n;else try{e+=" "+JSON.stringify(n)}catch{e+=" "+n}}_0(e)},da=["debug","info","warn","error"],m0=(t,e)=>{const n=da.indexOf(t);return da.indexOf(e)>=n},Fr=(t,e,n,...r)=>{m0(e,t)&&console.log(`[${t}] ${n}`,...r)},x0=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),y0=(t=(Ra()?"info":x0()||"warn"))=>{let e=t;return{debug:(t,...n)=>Fr("debug",e,t,...n),info:(t,...n)=>Fr("info",e,t,...n),warn:(t,...n)=>Fr("warn",e,t,...n),error:(t,...n)=>(v0(t,...n),Fr("error",e,t,...n)),setLevel:t=>{e=t},getLevel:()=>e}},Ao=y0(),Ta=({src:t,name:e=""})=>new Promise(((n,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:a,src:u}=i,s=k_(e);(!t||!o||!a||!u)&&r(),n({src:u,name:s,width:a,height:o,duration:Math.floor(t)})},a=()=>{Ao.warn("Failed to load video"),n(null)};return V_()&&i.load(),i.addEventListener("error",a),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",a),i.removeEventListener("loadeddata",o)}})),Io=t=>new Promise(((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{e({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{Ao.warn("Failed to load image"),n(null),URL.revokeObjectURL(i)},r.src=i})),pa=t=>{if(!t)return;const e="number"==typeof t?t:parseInt(t,10);if(isNaN(e))throw new Error("Can not get number from income argument");const n=e/1048576;return`${Math.floor(n)} MB`},S0=async({media:t,docPolicy:e,imgPolicy:n,videoPolicy:r,audioPolicy:i})=>{if(!n||!r)return"Media policy is not defined";const o={IMAGE:n.extensions,VIDEO:r.extensions,AUDIO:i.extensions,DOCUMENT:e.extensions},a=mo(t.file.name)||"",u=Object.keys(o).find((t=>{var e;return null==(e=o[t])?void 0:e.includes(a)}));if(!u)return`Extension ${a} is not supported`;const s="VIDEO"===u;if("IMAGE"===u){const e=await Io(t.file),r=t.file.size>n.maxSize,i=e&&Math.max(e.width,e.height)>n.maxResolution,o=e&&e.width*e.height>n.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${pa(n.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o: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 ${n.maxMatrix} pixels`}}if(s){const e=await Ta({src:t.objectUrl}),n=e&&e.duration>r.maxDuration,i=e&&Math.max(e.width,e.height)>r.maxResolution,o=t.file.size>r.maxSize,a=e&&e.width*e.height>r.maxMatrix;switch(!0){case n:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${pa(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case a: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 ${r.maxMatrix} pixels`}}},C0=t=>{if("object"!=typeof t||null===t)return!1;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||null===Object.getPrototypeOf(t)},A0=t=>C0(t)&&"type"in t&&"string"==typeof t.type,Y=t=>{const e=e=>({type:t,payload:e});return e.toString=()=>`${t}`,e.type=t,e.match=e=>A0(e)&&e.type===t,e};Y("remoteReady"),Y("reselectUser"),Y("requestLogin"),Y("requestLogout"),Y("setConfirmLeavePage"),Y("requestChangePath"),Y("wsSubscribe"),Y("wsUnSubscribe"),Y("hostStoreConnect"),Y("remoteLogin"),Y("remoteLogout"),Y("wsOnMessage"),Y("setRouterPath"),Y("setDeviceType"),Y("setUserError"),Y("setUserIsError"),Y("setUserPending"),Y("setUserSuccess"),Y("setUserData"),Y("updateAccountData"),Y("updateUser"),Y("addNotification"),Y("markNotification"),Y("setNotificationsError"),Y("setNotificationsList"),Y("setNotificationsPending"),Y("setNotificationsTotalCount"),Y("setNotificationsUnreadCount"),Y("resetNotificationsState"),Y("undoNotification"),Y("setInstanceInfo"),Y("setInstanceInfoPending"),Y("setInstanceInfoError");const I0=Y("setPlatformSettings");Y("setProfileSettings"),Y("setGroupData"),Y("setGroupLoading"),Y("showGroupBasicInfo"),Aa("requestMicroFrontendFetch"),Aa("sendMicroFrontendFetchResponse");const R0={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"},Pa={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"},E0={data:null,isPending:!1},{posts:ho,uploadsPolicyDoc:ga,uploadsPolicyAudio:po,uploadsPolicyImage:Nr,uploadsPolicyVideo:Bn,registration:b0,captcha:L0}=Pa,{captcha:D0,language:O0,translation:M0,openai:T0}=R0,hn=t=>t.data,P0=$t(hn,(t=>{var e,n,r;return{max_characters:(null==(e=null==t?void 0:t[ho])?void 0:e.max_characters)||0,max_media_attachments:(null==(n=null==t?void 0:t[ho])?void 0:n.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[ho])?void 0:r.max_pins)||0}})),Ua=$t(hn,(t=>{var e,n,r;return{...null==t?void 0:t[Nr],maxSize:(null==(e=null==t?void 0:t[Nr])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[Nr])?void 0:n.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[Nr])?void 0:r.maxResolution)||0}})),Ba=$t(hn,(t=>{var e,n,r,i;return{...null==t?void 0:t[Bn],maxSize:(null==(e=null==t?void 0:t[Bn])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[Bn])?void 0:n.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Bn])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Bn])?void 0:i.maxResolution)||0}})),Fa=$t(hn,(t=>{var e,n;return{...null==t?void 0:t[po],maxSize:null==(e=null==t?void 0:t[po])?void 0:e.maxSize,keepOriginal:(null==(n=null==t?void 0:t[po])?void 0:n.keepOriginal)||0}})),Na=$t(hn,(t=>{var e;return{...null==t?void 0:t[ga],maxSize:(null==(e=null==t?void 0:t[ga])?void 0:e.maxSize)||0}})),Wa=$t([Ua,Ba,Fa,Na],((t,e,n,r)=>({IMAGE:null==t?void 0:t.extensions,VIDEO:null==e?void 0:e.extensions,AUDIO:null==n?void 0:n.extensions,DOCUMENT:null==r?void 0:r.extensions}))),U0=$t(Wa,(t=>Object.keys(t).reduce(((e,n)=>[...e,...t[n]||[]]),[]))),Wt=W_({name:"platformSettings",initialState:E0,reducers:{setError:(t,e)=>{t.error=e.payload},setPending:(t,e)=>{t.isPending=e.payload}},extraReducers:t=>{t.addCase(I0,((t,{payload:e})=>{t.data={...t.data,...e}}))},selectors:{selectSettings:hn,selectPostConfig:P0,selectDocPolicy:Na,selectImagePolicy:Ua,selectVideoPolicy:Ba,selectAudioPolicy:Fa,selectSupportedExtensions:Wa,selectFullExtensionsList:U0,selectRegistration:t=>{var e;return null==(e=t.data)?void 0:e[b0]},selectLanguageDetection:t=>{var e;return null==(e=t.data)?void 0:e[O0]},selectLanguageTranslation:t=>{var e;return null==(e=t.data)?void 0:e[M0]},selectOpenai:t=>{var e;return null==(e=t.data)?void 0:e[T0]},selectCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[L0]},selectAdminCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[D0]},selectPlatformTranslation:t=>{var e;return null==(e=t.data)?void 0:e[Pa.translation]}}}),$a=()=>{const[t]=B_(),e=new AbortController,n=e.signal,r=Ft(Wt.selectors.selectImagePolicy),i=Ft(Wt.selectors.selectVideoPolicy),o=Ft(Wt.selectors.selectDocPolicy),a=Ft(Wt.selectors.selectAudioPolicy);return[async({media:e,tag:u,onError:s,onUpload:c})=>{var l;const f=mo(e.file.name),h=await S0({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:a,media:e});if(h)return $r.error(h),void(null==s||s());try{const r=await t({createUpload:{extension:f,tags:[u],meta:{name:e.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(l=r.data)?void 0:l.uri;return await X_({url:i,method:"PUT",body:e.file,signal:n}),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),$r(`Could not upload file. ${t}`)}},()=>e.abort("Upload canceled")]};var _a,Nn={exports:{}},B0=Nn.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wellesley/uploads",
3
3
  "license": "UNLICENSED",
4
4
  "main": "index.mjs",
5
- "version": "1.0.344",
5
+ "version": "1.0.346",
6
6
  "module": "index.ts",
7
7
  "files": [
8
8
  "*",