@wellesley/uploads 1.0.515 → 1.0.517

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 ev,handleBasicResponse as _r,usePostApiV1UploadsMutation as tv,useDeleteApiV1UploadsByIdMutation as nv,usePostApiV1UploadsByIdMetaMutation as rv,useGetApiV1UploadsByIdQuery as iv}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.630";import{useSelector as xt,useDispatch as sv}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as qn}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as Bu,createSelector as Zt,createSlice as Yu}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import oe,{useRef as it,useState as ye,useEffect as Ut,forwardRef as Ns,useCallback as _n,PureComponent as ov,createRef as vu,useLayoutEffect as av,createElement as Ms,useMemo as mu}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as uv,Dialog as cv,DialogContent as lv,cn as vn,ButtonLoader as wu,Button as Ts,TooltipWrapper as _u}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.592";import{rootReducer as fv}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.629";const hv=ev.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e)}}}}),{usePostApiV1UploadsByIdMetaMutation:Em,usePostApiV1UploadsListMutation:Om,usePutApiV1UploadsByIdTagsMutation:Rm,usePostApiV1UploadsBatchMutation:Dm}=hv;var Kn=(t=>(t.done="done",t.inprogress="inprogress",t))(Kn||{}),Ku=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(Ku||{});const Vr=t=>{const e=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return e?e[1]:void 0},dv=t=>t.replace(/\.[^.]*$/,""),ju=()=>"object"!=typeof window,pv=()=>!ju()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),jn="8.48.0",yt=globalThis;function Es(t,e,n){const r=yt,i=r.__SENTRY__=r.__SENTRY__||{},o=i[jn]=i[jn]||{};return o[t]||(o[t]=e())}const qu=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Av="Sentry Logger ",xu=["debug","info","warn","error","log","assert","trace"],yu={};function gv(t){if(!("console"in yt))return t();const e=yt.console,n={},r=Object.keys(yu);r.forEach((t=>{const r=yu[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}function vv(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return qu?xu.forEach((n=>{e[n]=(...e)=>{t&&gv((()=>{yt.console[n](`${Av}[${n}]:`,...e)}))}})):xu.forEach((t=>{e[t]=()=>{}})),e}const Gr=Es("logger",vv);function Os(){return Rs(yt),yt}function Rs(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||jn,e[jn]=e[jn]||{}}const mv=Object.prototype.toString;function wv(t,e){return mv.call(t)===`[object ${e}]`}function xv(t){return wv(t,"Object")}function yv(t){return!(!t||!t.then||"function"!=typeof t.then)}function Sv(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{qu&&Gr.log(`Failed to add non-enumerable property "${e}" to object`,t)}}const Gu=1e3;function Zu(){return Date.now()/Gu}function bv(){const{performance:t}=yt;if(!t||!t.now)return Zu;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/Gu}const Tv=bv();function gn(){const t=yt,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 Lv(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||Tv(),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:gn()),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 Su(){return gn()}function bu(){return gn().substring(16)}function Ju(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]=Ju(r[t],e[t],n-1));return r}(()=>{const{performance:t}=yt;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 Is="_sentrySpan";function Tu(t,e){e?Sv(t,Is,e):delete t[Is]}function Lu(t){return t[Is]}const Cv=100;class Ds{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:Su(),spanId:bu()}}clone(){const t=new Ds;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,Tu(t,Lu(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&&Lv(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 Gn?[e.getScopeData(),e.getRequestSession()]:xv(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,Tu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Su()}),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:Cv;if(n<=0)return this;const r={timestamp:Zu(),...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:Lu(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ju(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:bu(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:gn();if(!this._client)return Gr.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:gn();if(!this._client)return Gr.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:gn();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Gr.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 Gn=Ds;function Xv(){return Es("defaultCurrentScope",(()=>new Gn))}function Pv(){return Es("defaultIsolationScope",(()=>new Gn))}class Mv{constructor(t,e){let n,r;n=t||new Gn,r=e||new Gn,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 yv(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 mn(){const t=Rs(Os());return t.stack=t.stack||new Mv(Xv(),Pv())}function Iv(t){return mn().withScope(t)}function Nv(t,e){const n=mn();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function Cu(t){return mn().withScope((()=>t(mn().getIsolationScope())))}function Ev(){return{withIsolationScope:Cu,withScope:Iv,withSetScope:Nv,withSetIsolationScope:(t,e)=>Cu(e),getCurrentScope:()=>mn().getScope(),getIsolationScope:()=>mn().getIsolationScope()}}function Vu(t){const e=Rs(t);return e.acs?e.acs:Ev()}function Qu(){return Vu(Os()).getCurrentScope()}function Ov(){return Vu(Os()).getIsolationScope()}function Rv(t,e){return Qu().captureException(t,void 0)}function Dv(t,e){const n={captureContext:e};return Qu().captureMessage(t,void 0,n)}function Uv(t,e){Ov().setExtra(t,e)}var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const Wv=(...t)=>{let e="";for(const n of t){if(n instanceof Error){const t=n;return Uv("exceptionMessage",e),void Rv(t)}if("object"!=typeof n)e+=n;else try{e+=" "+JSON.stringify(n)}catch{e+=" "+n}}Dv(e)},zv="wlsy",$u=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},Fv=()=>{const t=new Set,e=$u();if(!e)return[];for(let n=0;n<(null==e?void 0:e.length);n+=1){const r=null==e?void 0:e.key(n);"string"==typeof r&&t.add(r)}return Array.from(t)},Hv=t=>{const e=`${zv}`,n=t=>`${e}:${t}`,r=()=>Fv().filter((t=>t.startsWith(`${e}:`))),i=t=>t.slice(e.length+1),o=$u(),a=t=>{try{return null==o?void 0:o.getItem(n(t))}catch{return null}},u=(t,e)=>{try{null==o||o.setItem(n(t),String(e))}catch{return}};return{getItem:a,setItem:u,removeItem:t=>{try{null==o||o.removeItem(n(t))}catch{return}},clear:()=>{try{r().forEach((t=>null==o?void 0:o.removeItem(t)))}catch{return}},keys:()=>r().map(i),has:t=>null!==a(t),getJSON:t=>{const e=a(t);if(null==e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(t,e)=>{try{u(t,JSON.stringify(e))}catch{return}}}},Xu=["debug","info","warn","error"],kv=(t,e)=>{const n=Xu.indexOf(t);return Xu.indexOf(e)>=n},jr=(t,e,n,...r)=>{kv(e,t)&&console.log(`[${t}] ${n}`,...r)},Bv=()=>Hv().getItem("logger_lvl"),Yv=(t=(ju()?"info":Bv()||"warn"))=>{let e=t;return{debug:(t,...n)=>jr("debug",e,t,...n),info:(t,...n)=>jr("info",e,t,...n),warn:(t,...n)=>jr("warn",e,t,...n),error:(t,...n)=>(Wv(t,...n),jr("error",e,t,...n)),setLevel:t=>{e=t},getLevel:()=>e}},Qr=Yv(),ec=({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=dv(e);(!t||!o||!a||!u)&&r(),n({src:u,name:s,width:a,height:o,duration:Math.floor(t)})},a=()=>{Qr.warn("Failed to load video"),n(null)};return pv()&&i.load(),i.addEventListener("error",a),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",a),i.removeEventListener("loadeddata",o)}})),Us=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=()=>{Qr.warn("Failed to load image"),n(null),URL.revokeObjectURL(i)},r.src=i})),Pu=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`},_v=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=Vr(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 Us(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 ${Pu(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 ec({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 ${Pu(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`}}},Kv=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)},jv=t=>Kv(t)&&"type"in t&&"string"==typeof t.type,G=t=>{const e=e=>({type:t,payload:e});return e.toString=()=>`${t}`,e.type=t,e.match=e=>jv(e)&&e.type===t,e};G("remoteReady"),G("askLogin"),G("reselectUser"),G("requestLogout"),G("setConfirmLeavePage"),G("requestChangePath"),G("wsSubscribe"),G("wsUnSubscribe"),G("hostStoreConnect"),G("remoteLogin"),G("remoteLogout"),G("wsOnMessage"),G("setRouterPath"),G("setDeviceType"),G("setUserError"),G("setUserIsError"),G("setUserPending"),G("setUserSuccess"),G("setUserData"),G("updateAccountData"),G("updateUser"),G("addNotification"),G("markNotification"),G("setNotificationsError"),G("setNotificationsList"),G("setNotificationsPending"),G("setNotificationsTotalCount"),G("setNotificationsUnreadCount"),G("resetNotificationsState"),G("undoNotification"),G("setInstanceInfo"),G("setInstanceInfoPending"),G("setInstanceInfoError");const qv=G("setPlatformSettings");G("setProfileSettings"),G("setGroupData"),G("setGroupLoading"),Bu("requestMicroFrontendFetch"),Bu("sendMicroFrontendFetchResponse");const Gv={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"},Zr={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"},Zv={data:null,isPending:!1},{posts:Ls,uploadsPolicyDoc:Mu,uploadsPolicyAudio:Cs,uploadsPolicyImage:qr,uploadsPolicyVideo:kn,registration:Jv,captcha:Vv,instanceAdmin:Qv,branding:$v,translation:e0,access:t0}=Zr,{captcha:n0,language:r0,translation:i0,openai:s0,link_service:o0}=Gv,wn=t=>t.data,a0=Zt(wn,(t=>{var e,n,r;return{max_characters:(null==(e=null==t?void 0:t[Ls])?void 0:e.max_characters)||0,max_media_attachments:(null==(n=null==t?void 0:t[Ls])?void 0:n.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[Ls])?void 0:r.max_pins)||0}})),tc=Zt(wn,(t=>{var e,n,r;return{...null==t?void 0:t[qr],maxSize:(null==(e=null==t?void 0:t[qr])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[qr])?void 0:n.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[qr])?void 0:r.maxResolution)||0}})),nc=Zt(wn,(t=>{var e,n,r,i;return{...null==t?void 0:t[kn],maxSize:(null==(e=null==t?void 0:t[kn])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[kn])?void 0:n.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[kn])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[kn])?void 0:i.maxResolution)||0}})),rc=Zt(wn,(t=>{var e,n;return{...null==t?void 0:t[Cs],maxSize:null==(e=null==t?void 0:t[Cs])?void 0:e.maxSize,keepOriginal:(null==(n=null==t?void 0:t[Cs])?void 0:n.keepOriginal)||0}})),ic=Zt(wn,(t=>{var e;return{...null==t?void 0:t[Mu],maxSize:(null==(e=null==t?void 0:t[Mu])?void 0:e.maxSize)||0}})),sc=Zt([tc,nc,rc,ic],((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=Zt(sc,(t=>Object.keys(t).reduce(((e,n)=>[...e,...t[n]||[]]),[]))),Dt=Yu({name:"platformSettings",initialState:Zv,reducers:{setError:(t,e)=>{t.error=e.payload},setPending:(t,e)=>{t.isPending=e.payload}},extraReducers:t=>{t.addCase(qv,((t,{payload:e})=>{t.data={...t.data,...e}}))},selectors:{selectSettings:wn,selectPostConfig:a0,selectDocPolicy:ic,selectImagePolicy:tc,selectVideoPolicy:nc,selectAudioPolicy:rc,selectSupportedExtensions:sc,selectFullExtensionsList:u0,selectRegistration:t=>{var e;return null==(e=t.data)?void 0:e[Jv]},selectLanguageDetection:t=>{var e;return null==(e=t.data)?void 0:e[r0]},selectLanguageTranslation:t=>{var e;return null==(e=t.data)?void 0:e[i0]},selectOpenai:t=>{var e;return null==(e=t.data)?void 0:e[s0]},selectCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[Vv]},selectAdminCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[n0]},selectPlatformTranslation:t=>{var e;return null==(e=t.data)?void 0:e[e0]},selectAccess:t=>{var e;return null==(e=t.data)?void 0:e[t0]},selectBranding:t=>{var e;return null==(e=t.data)?void 0:e[$v]},selectLinkService:t=>{var e;return null==(e=t.data)?void 0:e[o0]},selectInstanceAdmin:t=>{var e;return null==(e=t.data)?void 0:e[Qv]},selectLegal:t=>{var e;return null==(e=t.data)?void 0:e[Zr.legal]},selectDomainBlocks:t=>{var e;return null==(e=t.data)?void 0:e[Zr.domainBlocks]},selectContacts:t=>{var e;return null==(e=t.data)?void 0:e[Zr.contacts]}}}),oc=()=>{const[t]=tv(),e=new AbortController,n=e.signal,r=xt(Dt.selectors.selectImagePolicy),i=xt(Dt.selectors.selectVideoPolicy),o=xt(Dt.selectors.selectDocPolicy),a=xt(Dt.selectors.selectAudioPolicy);return[async({media:e,tag:u,onError:s,onUpload:c,onProgress:l})=>{var f;const h=Vr(e.file.name),p=await _v({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:a,media:e});if(p)return qn.error(p),void(null==s||s());try{const r=await t({createUpload:{extension:h,tags:[u],meta:{name:e.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(f=r.data)?void 0:f.uri;return await new Promise(((t,r)=>{const o=new XMLHttpRequest;o.open("PUT",i),n&&n.addEventListener("abort",(()=>{try{o.abort()}catch(t){Qr.warn("Cancel upload failed",t)}})),o.upload.onprogress=t=>{if(!t.lengthComputable)return;const e=Math.round(t.loaded/t.total*100);null==l||l(t.loaded,t.total,e)},o.onerror=()=>r(new Error("Upload failed")),o.onload=()=>{o.status>=200&&o.status<300?t():r(new Error(o.statusText))},o.send(e.file)})),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),qn(`Could not upload file. ${t}`)}},()=>e.abort("Upload canceled")]};var Iu,Yn={exports:{}},c0=Yn.exports;
1
+ import{api as ev,handleBasicResponse as _r,usePostApiV1UploadsMutation as tv,useDeleteApiV1UploadsByIdMutation as nv,usePostApiV1UploadsByIdMetaMutation as rv,useGetApiV1UploadsByIdQuery as iv}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.632";import{useSelector as xt,useDispatch as sv}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as qn}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as Bu,createSelector as Zt,createSlice as Yu}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import oe,{useRef as it,useState as ye,useEffect as Ut,forwardRef as Ns,useCallback as _n,PureComponent as ov,createRef as vu,useLayoutEffect as av,createElement as Ms,useMemo as mu}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as uv,Dialog as cv,DialogContent as lv,cn as vn,ButtonLoader as wu,Button as Ts,TooltipWrapper as _u}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.594";import{rootReducer as fv}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.631";const hv=ev.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:e}){await _r(e)}}}}),{usePostApiV1UploadsByIdMetaMutation:Em,usePostApiV1UploadsListMutation:Om,usePutApiV1UploadsByIdTagsMutation:Rm,usePostApiV1UploadsBatchMutation:Dm}=hv;var Kn=(t=>(t.done="done",t.inprogress="inprogress",t))(Kn||{}),Ku=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(Ku||{});const Vr=t=>{const e=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return e?e[1]:void 0},dv=t=>t.replace(/\.[^.]*$/,""),ju=()=>"object"!=typeof window,pv=()=>!ju()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),jn="8.48.0",yt=globalThis;function Es(t,e,n){const r=yt,i=r.__SENTRY__=r.__SENTRY__||{},o=i[jn]=i[jn]||{};return o[t]||(o[t]=e())}const qu=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Av="Sentry Logger ",xu=["debug","info","warn","error","log","assert","trace"],yu={};function gv(t){if(!("console"in yt))return t();const e=yt.console,n={},r=Object.keys(yu);r.forEach((t=>{const r=yu[t];n[t]=e[t],e[t]=r}));try{return t()}finally{r.forEach((t=>{e[t]=n[t]}))}}function vv(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return qu?xu.forEach((n=>{e[n]=(...e)=>{t&&gv((()=>{yt.console[n](`${Av}[${n}]:`,...e)}))}})):xu.forEach((t=>{e[t]=()=>{}})),e}const Gr=Es("logger",vv);function Os(){return Rs(yt),yt}function Rs(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||jn,e[jn]=e[jn]||{}}const mv=Object.prototype.toString;function wv(t,e){return mv.call(t)===`[object ${e}]`}function xv(t){return wv(t,"Object")}function yv(t){return!(!t||!t.then||"function"!=typeof t.then)}function Sv(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{qu&&Gr.log(`Failed to add non-enumerable property "${e}" to object`,t)}}const Gu=1e3;function Zu(){return Date.now()/Gu}function bv(){const{performance:t}=yt;if(!t||!t.now)return Zu;const e=Date.now()-t.now(),n=null==t.timeOrigin?e:t.timeOrigin;return()=>(n+t.now())/Gu}const Tv=bv();function gn(){const t=yt,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 Lv(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||Tv(),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:gn()),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 Su(){return gn()}function bu(){return gn().substring(16)}function Ju(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]=Ju(r[t],e[t],n-1));return r}(()=>{const{performance:t}=yt;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 Is="_sentrySpan";function Tu(t,e){e?Sv(t,Is,e):delete t[Is]}function Lu(t){return t[Is]}const Cv=100;class Ds{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:Su(),spanId:bu()}}clone(){const t=new Ds;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,Tu(t,Lu(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&&Lv(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 Gn?[e.getScopeData(),e.getRequestSession()]:xv(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,Tu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Su()}),this._notifyScopeListeners(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:Cv;if(n<=0)return this;const r={timestamp:Zu(),...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:Lu(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ju(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:bu(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,e){const n=e&&e.event_id?e.event_id:gn();if(!this._client)return Gr.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:gn();if(!this._client)return Gr.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:gn();return this._client?(this._client.captureEvent(t,{...e,event_id:n},this),n):(Gr.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 Gn=Ds;function Xv(){return Es("defaultCurrentScope",(()=>new Gn))}function Pv(){return Es("defaultIsolationScope",(()=>new Gn))}class Mv{constructor(t,e){let n,r;n=t||new Gn,r=e||new Gn,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 yv(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 mn(){const t=Rs(Os());return t.stack=t.stack||new Mv(Xv(),Pv())}function Iv(t){return mn().withScope(t)}function Nv(t,e){const n=mn();return n.withScope((()=>(n.getStackTop().scope=t,e(t))))}function Cu(t){return mn().withScope((()=>t(mn().getIsolationScope())))}function Ev(){return{withIsolationScope:Cu,withScope:Iv,withSetScope:Nv,withSetIsolationScope:(t,e)=>Cu(e),getCurrentScope:()=>mn().getScope(),getIsolationScope:()=>mn().getIsolationScope()}}function Vu(t){const e=Rs(t);return e.acs?e.acs:Ev()}function Qu(){return Vu(Os()).getCurrentScope()}function Ov(){return Vu(Os()).getIsolationScope()}function Rv(t,e){return Qu().captureException(t,void 0)}function Dv(t,e){const n={captureContext:e};return Qu().captureMessage(t,void 0,n)}function Uv(t,e){Ov().setExtra(t,e)}var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const Wv=(...t)=>{let e="";for(const n of t){if(n instanceof Error){const t=n;return Uv("exceptionMessage",e),void Rv(t)}if("object"!=typeof n)e+=n;else try{e+=" "+JSON.stringify(n)}catch{e+=" "+n}}Dv(e)},zv="wlsy",$u=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},Fv=()=>{const t=new Set,e=$u();if(!e)return[];for(let n=0;n<(null==e?void 0:e.length);n+=1){const r=null==e?void 0:e.key(n);"string"==typeof r&&t.add(r)}return Array.from(t)},Hv=t=>{const e=`${zv}`,n=t=>`${e}:${t}`,r=()=>Fv().filter((t=>t.startsWith(`${e}:`))),i=t=>t.slice(e.length+1),o=$u(),a=t=>{try{return null==o?void 0:o.getItem(n(t))}catch{return null}},u=(t,e)=>{try{null==o||o.setItem(n(t),String(e))}catch{return}};return{getItem:a,setItem:u,removeItem:t=>{try{null==o||o.removeItem(n(t))}catch{return}},clear:()=>{try{r().forEach((t=>null==o?void 0:o.removeItem(t)))}catch{return}},keys:()=>r().map(i),has:t=>null!==a(t),getJSON:t=>{const e=a(t);if(null==e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(t,e)=>{try{u(t,JSON.stringify(e))}catch{return}}}},Xu=["debug","info","warn","error"],kv=(t,e)=>{const n=Xu.indexOf(t);return Xu.indexOf(e)>=n},jr=(t,e,n,...r)=>{kv(e,t)&&console.log(`[${t}] ${n}`,...r)},Bv=()=>Hv().getItem("logger_lvl"),Yv=(t=(ju()?"info":Bv()||"warn"))=>{let e=t;return{debug:(t,...n)=>jr("debug",e,t,...n),info:(t,...n)=>jr("info",e,t,...n),warn:(t,...n)=>jr("warn",e,t,...n),error:(t,...n)=>(Wv(t,...n),jr("error",e,t,...n)),setLevel:t=>{e=t},getLevel:()=>e}},Qr=Yv(),ec=({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=dv(e);(!t||!o||!a||!u)&&r(),n({src:u,name:s,width:a,height:o,duration:Math.floor(t)})},a=()=>{Qr.warn("Failed to load video"),n(null)};return pv()&&i.load(),i.addEventListener("error",a),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",a),i.removeEventListener("loadeddata",o)}})),Us=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=()=>{Qr.warn("Failed to load image"),n(null),URL.revokeObjectURL(i)},r.src=i})),Pu=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`},_v=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=Vr(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 Us(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 ${Pu(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 ec({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 ${Pu(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`}}},Kv=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)},jv=t=>Kv(t)&&"type"in t&&"string"==typeof t.type,G=t=>{const e=e=>({type:t,payload:e});return e.toString=()=>`${t}`,e.type=t,e.match=e=>jv(e)&&e.type===t,e};G("remoteReady"),G("askLogin"),G("reselectUser"),G("requestLogout"),G("setConfirmLeavePage"),G("requestChangePath"),G("wsSubscribe"),G("wsUnSubscribe"),G("hostStoreConnect"),G("remoteLogin"),G("remoteLogout"),G("wsOnMessage"),G("setRouterPath"),G("setDeviceType"),G("setUserError"),G("setUserIsError"),G("setUserPending"),G("setUserSuccess"),G("setUserData"),G("updateAccountData"),G("updateUser"),G("addNotification"),G("markNotification"),G("setNotificationsError"),G("setNotificationsList"),G("setNotificationsPending"),G("setNotificationsTotalCount"),G("setNotificationsUnreadCount"),G("resetNotificationsState"),G("undoNotification"),G("setInstanceInfo"),G("setInstanceInfoPending"),G("setInstanceInfoError");const qv=G("setPlatformSettings");G("setProfileSettings"),G("setGroupData"),G("setGroupLoading"),Bu("requestMicroFrontendFetch"),Bu("sendMicroFrontendFetchResponse");const Gv={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"},Zr={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"},Zv={data:null,isPending:!1},{posts:Ls,uploadsPolicyDoc:Mu,uploadsPolicyAudio:Cs,uploadsPolicyImage:qr,uploadsPolicyVideo:kn,registration:Jv,captcha:Vv,instanceAdmin:Qv,branding:$v,translation:e0,access:t0}=Zr,{captcha:n0,language:r0,translation:i0,openai:s0,link_service:o0}=Gv,wn=t=>t.data,a0=Zt(wn,(t=>{var e,n,r;return{max_characters:(null==(e=null==t?void 0:t[Ls])?void 0:e.max_characters)||0,max_media_attachments:(null==(n=null==t?void 0:t[Ls])?void 0:n.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[Ls])?void 0:r.max_pins)||0}})),tc=Zt(wn,(t=>{var e,n,r;return{...null==t?void 0:t[qr],maxSize:(null==(e=null==t?void 0:t[qr])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[qr])?void 0:n.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[qr])?void 0:r.maxResolution)||0}})),nc=Zt(wn,(t=>{var e,n,r,i;return{...null==t?void 0:t[kn],maxSize:(null==(e=null==t?void 0:t[kn])?void 0:e.maxSize)||0,maxMatrix:(null==(n=null==t?void 0:t[kn])?void 0:n.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[kn])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[kn])?void 0:i.maxResolution)||0}})),rc=Zt(wn,(t=>{var e,n;return{...null==t?void 0:t[Cs],maxSize:null==(e=null==t?void 0:t[Cs])?void 0:e.maxSize,keepOriginal:(null==(n=null==t?void 0:t[Cs])?void 0:n.keepOriginal)||0}})),ic=Zt(wn,(t=>{var e;return{...null==t?void 0:t[Mu],maxSize:(null==(e=null==t?void 0:t[Mu])?void 0:e.maxSize)||0}})),sc=Zt([tc,nc,rc,ic],((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=Zt(sc,(t=>Object.keys(t).reduce(((e,n)=>[...e,...t[n]||[]]),[]))),Dt=Yu({name:"platformSettings",initialState:Zv,reducers:{setError:(t,e)=>{t.error=e.payload},setPending:(t,e)=>{t.isPending=e.payload}},extraReducers:t=>{t.addCase(qv,((t,{payload:e})=>{t.data={...t.data,...e}}))},selectors:{selectSettings:wn,selectPostConfig:a0,selectDocPolicy:ic,selectImagePolicy:tc,selectVideoPolicy:nc,selectAudioPolicy:rc,selectSupportedExtensions:sc,selectFullExtensionsList:u0,selectRegistration:t=>{var e;return null==(e=t.data)?void 0:e[Jv]},selectLanguageDetection:t=>{var e;return null==(e=t.data)?void 0:e[r0]},selectLanguageTranslation:t=>{var e;return null==(e=t.data)?void 0:e[i0]},selectOpenai:t=>{var e;return null==(e=t.data)?void 0:e[s0]},selectCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[Vv]},selectAdminCaptcha:t=>{var e;return null==(e=t.data)?void 0:e[n0]},selectPlatformTranslation:t=>{var e;return null==(e=t.data)?void 0:e[e0]},selectAccess:t=>{var e;return null==(e=t.data)?void 0:e[t0]},selectBranding:t=>{var e;return null==(e=t.data)?void 0:e[$v]},selectLinkService:t=>{var e;return null==(e=t.data)?void 0:e[o0]},selectInstanceAdmin:t=>{var e;return null==(e=t.data)?void 0:e[Qv]},selectLegal:t=>{var e;return null==(e=t.data)?void 0:e[Zr.legal]},selectDomainBlocks:t=>{var e;return null==(e=t.data)?void 0:e[Zr.domainBlocks]},selectContacts:t=>{var e;return null==(e=t.data)?void 0:e[Zr.contacts]}}}),oc=()=>{const[t]=tv(),e=new AbortController,n=e.signal,r=xt(Dt.selectors.selectImagePolicy),i=xt(Dt.selectors.selectVideoPolicy),o=xt(Dt.selectors.selectDocPolicy),a=xt(Dt.selectors.selectAudioPolicy);return[async({media:e,tag:u,onError:s,onUpload:c,onProgress:l})=>{var f;const h=Vr(e.file.name),p=await _v({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:a,media:e});if(p)return qn.error(p),void(null==s||s());try{const r=await t({createUpload:{extension:h,tags:[u],meta:{name:e.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(f=r.data)?void 0:f.uri;return await new Promise(((t,r)=>{const o=new XMLHttpRequest;o.open("PUT",i),n&&n.addEventListener("abort",(()=>{try{o.abort()}catch(t){Qr.warn("Cancel upload failed",t)}})),o.upload.onprogress=t=>{if(!t.lengthComputable)return;const e=Math.round(t.loaded/t.total*100);null==l||l(t.loaded,t.total,e)},o.onerror=()=>r(new Error("Upload failed")),o.onload=()=>{o.status>=200&&o.status<300?t():r(new Error(o.statusText))},o.send(e.file)})),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),qn(`Could not upload file. ${t}`)}},()=>e.abort("Upload canceled")]};var Iu,Yn={exports:{}},c0=Yn.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.515",
5
+ "version": "1.0.517",
6
6
  "module": "index.ts",
7
7
  "files": [
8
8
  "*",