@wellesley/uploads 1.0.264 → 1.0.266

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 h_,handleBasicResponse as Ir,usePostApiV1UploadsMutation as p_,useDeleteApiV1UploadsByIdMutation as d_,usePostApiV1UploadsByIdMetaMutation as g_}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.379";import{useSelector as Xe}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as eu}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as ta,createSelector as Ue,createSlice as __}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import v_,{useRef as w_,useState as m_,useEffect as x_,forwardRef as S_}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as y_}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.341";const A_=h_.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n)}}}}),{usePostApiV1UploadsByIdMetaMutation:B0,usePostApiV1UploadsListMutation:N0,usePutApiV1UploadsByIdTagsMutation:W0,usePostApiV1UploadsBatchMutation:$0}=A_;var Qe=(t=>(t.done="done",t.inprogress="inprogress",t))(Qe||{}),Pe=(t=>(t.image="image",t.video="video",t.audio="audio",t))(Pe||{}),ra=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t))(ra||{});const ru=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},I_=async({url:t,...n})=>{const e=await fetch(t,n);if(!e.ok)throw new Error(e.statusText);if("PUT"===n.method)return;const r=await e.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},E_=t=>t.replace(/\.[^.]*$/,""),ia=()=>"object"!=typeof window,R_=()=>!ia()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),bt="8.48.0",ce=globalThis;function iu(t,n,e){const r=ce,i=r.__SENTRY__=r.__SENTRY__||{},o=i[bt]=i[bt]||{};return o[t]||(o[t]=n())}const ua=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,L_="Sentry Logger ",zs=["debug","info","warn","error","log","assert","trace"],qs={};function b_(t){if(!("console"in ce))return t();const n=ce.console,e={},r=Object.keys(qs);r.forEach((t=>{const r=qs[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function T_(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ua?zs.forEach((e=>{n[e]=(...n)=>{t&&b_((()=>{ce.console[e](`${L_}[${e}]:`,...n)}))}})):zs.forEach((t=>{n[t]=()=>{}})),n}const br=iu("logger",T_);function uu(){return ou(ce),ce}function ou(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||bt,n[bt]=n[bt]||{}}const C_=Object.prototype.toString;function O_(t,n){return C_.call(t)===`[object ${n}]`}function P_(t){return O_(t,"Object")}function U_(t){return!(!t||!t.then||"function"!=typeof t.then)}function M_(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{ua&&br.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const oa=1e3;function sa(){return Date.now()/oa}function D_(){const{performance:t}=ce;if(!t||!t.now)return sa;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/oa}const F_=D_();function je(){const t=ce,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function B_(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||F_(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:je()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function Hs(){return je()}function Ks(){return je().substring(16)}function aa(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=aa(r[t],n[t],e-1));return r}(()=>{const{performance:t}=ce;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const tu="_sentrySpan";function Ys(t,n){n?M_(t,tu,n):delete t[tu]}function Zs(t){return t[tu]}const N_=100;class su{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:Hs(),spanId:Ks()}}clone(){const t=new su;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,Ys(t,Zs(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&&B_(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,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},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,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,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 n="function"==typeof t?t(this):t,[e,r]=n instanceof Tt?[n.getScopeData(),n.getRequestSession()]:P_(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),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,Ys(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Hs()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:N_;if(e<=0)return this;const r={timestamp:sa(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):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:Zs(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=aa(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:Ks(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:je();if(!this._client)return br.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:je();if(!this._client)return br.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:je();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(br.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Tt=su;function W_(){return iu("defaultCurrentScope",(()=>new Tt))}function $_(){return iu("defaultIsolationScope",(()=>new Tt))}class G_{constructor(t,n){let e,r;e=t||new Tt,r=n||new Tt,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return U_(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}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 nt(){const t=ou(uu());return t.stack=t.stack||new G_(W_(),$_())}function z_(t){return nt().withScope(t)}function q_(t,n){const e=nt();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Vs(t){return nt().withScope((()=>t(nt().getIsolationScope())))}function H_(){return{withIsolationScope:Vs,withScope:z_,withSetScope:q_,withSetIsolationScope:(t,n)=>Vs(n),getCurrentScope:()=>nt().getScope(),getIsolationScope:()=>nt().getIsolationScope()}}function fa(t){const n=ou(t);return n.acs?n.acs:H_()}function ca(){return fa(uu()).getCurrentScope()}function K_(){return fa(uu()).getIsolationScope()}function Y_(t,n){return ca().captureException(t,void 0)}function Z_(t,n){const e={captureContext:n};return ca().captureMessage(t,void 0,e)}function V_(t,n){K_().setExtra(t,n)}var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const J_=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return V_("exceptionMessage",n),void Y_(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}Z_(n)},Js=["debug","info","warn","error"],X_=(t,n)=>{const e=Js.indexOf(t);return Js.indexOf(n)>=e},Rr=(t,n,e,...r)=>{X_(n,t)&&console.log(`[${t}] ${e}`,...r)},Q_=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),k_=(t=(ia()?"info":Q_()||"warn"))=>{let n=t;return{debug:(t,...e)=>Rr("debug",n,t,...e),info:(t,...e)=>Rr("info",n,t,...e),warn:(t,...e)=>Rr("warn",n,t,...e),error:(t,...e)=>(J_(t,...e),Rr("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},la=k_(),ha=({src:t,name:n=""})=>new Promise(((e,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:u,src:a}=i,s=E_(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{la.warn("Failed to load video"),e(null)};return R_()&&i.load(),i.addEventListener("error",u),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",u),i.removeEventListener("loadeddata",o)}})),pa=t=>new Promise(((n,e)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{n({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{la.warn("Failed to load image"),e(null),URL.revokeObjectURL(i)},r.src=i})),Xs=t=>{if(!t)return;const n="number"==typeof t?t:parseInt(t,10);if(isNaN(n))throw new Error("Can not get number from income argument");const e=n/1048576;return`${Math.floor(e)} MB`},j_=async({media:t,docPolicy:n,imgPolicy:e,videoPolicy:r,audioPolicy:i})=>{if(!e||!r)return"Media policy is not defined";const o={IMAGE:e.extensions,VIDEO:r.extensions,AUDIO:i.extensions,DOCUMENT:n.extensions},u=ru(t.file.name)||"",a=Object.keys(o).find((t=>{var n;return null==(n=o[t])?void 0:n.includes(u)}));if(!a)return`Extension ${u} is not supported`;const s="VIDEO"===a;if("IMAGE"===a){const n=await pa(t.file),r=t.file.size>e.maxSize,i=n&&Math.max(n.width,n.height)>e.maxResolution,o=n&&n.width*n.height>e.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${Xs(e.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${e.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 ${e.maxMatrix} pixels`}}if(s){const n=await ha({src:t.objectUrl}),e=n&&n.duration>r.maxDuration,i=n&&Math.max(n.width,n.height)>r.maxResolution,o=t.file.size>r.maxSize,u=n&&n.width*n.height>r.maxMatrix;switch(!0){case e:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${Xs(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case u: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`}}},n0=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},e0=t=>n0(t)&&"type"in t&&"string"==typeof t.type,F=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>e0(n)&&n.type===t,n};F("remoteReady"),F("reselectUser"),F("requestLogin"),F("requestLogout"),F("setConfirmLeavePage"),F("requestChangePath"),F("wsSubscribe"),F("wsUnSubscribe"),F("hostStoreConnect"),F("remoteLogin"),F("remoteLogout"),F("wsOnMessage"),F("setRouterPath"),F("setDeviceType"),F("setUserError"),F("setUserIsError"),F("setUserPending"),F("setUserSuccess"),F("setUserData"),F("updateAccountData"),F("updateUser"),F("addNotification"),F("markNotification"),F("setNotificationsError"),F("setNotificationsList"),F("setNotificationsPending"),F("setNotificationsTotalCount"),F("setNotificationsUnreadCount"),F("resetNotificationsState"),F("undoNotification"),F("setInstanceInfo"),F("setInstanceInfoPending"),F("setInstanceInfoError");const t0=F("setPlatformSettings");F("setProfileSettings"),F("setGroupData"),F("setGroupLoading"),F("showGroupBasicInfo"),ta("requestMicroFrontendFetch"),ta("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"},i0={posts:"wellesley.posts",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"},u0={data:null,isPending:!1},{posts:ki,uploadsPolicyDoc:Qs,uploadsPolicyAudio:ji,uploadsPolicyImage:Lr,uploadsPolicyVideo:Et,registration:o0,captcha:s0}=i0,{captcha:a0,language:f0,translation:c0,openai:l0}=r0,et=t=>t.data,h0=Ue(et,(t=>{var n,e,r;return{max_characters:(null==(n=null==t?void 0:t[ki])?void 0:n.max_characters)||0,max_media_attachments:(null==(e=null==t?void 0:t[ki])?void 0:e.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[ki])?void 0:r.max_pins)||0}})),da=Ue(et,(t=>{var n,e,r;return{...null==t?void 0:t[Lr],maxSize:(null==(n=null==t?void 0:t[Lr])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Lr])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[Lr])?void 0:r.maxResolution)||0}})),ga=Ue(et,(t=>{var n,e,r,i;return{...null==t?void 0:t[Et],maxSize:(null==(n=null==t?void 0:t[Et])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Et])?void 0:e.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Et])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Et])?void 0:i.maxResolution)||0}})),_a=Ue(et,(t=>{var n,e;return{...null==t?void 0:t[ji],maxSize:null==(n=null==t?void 0:t[ji])?void 0:n.maxSize,keepOriginal:(null==(e=null==t?void 0:t[ji])?void 0:e.keepOriginal)||0}})),va=Ue(et,(t=>{var n;return{...null==t?void 0:t[Qs],maxSize:(null==(n=null==t?void 0:t[Qs])?void 0:n.maxSize)||0}})),wa=Ue([da,ga,_a,va],((t,n,e,r)=>({IMAGE:null==t?void 0:t.extensions,VIDEO:null==n?void 0:n.extensions,AUDIO:null==e?void 0:e.extensions,DOCUMENT:null==r?void 0:r.extensions}))),p0=Ue(wa,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),ke=__({name:"platformSettings",initialState:u0,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(t0,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:et,selectPostConfig:h0,selectDocPolicy:va,selectImagePolicy:da,selectVideoPolicy:ga,selectAudioPolicy:_a,selectSupportedExtensions:wa,selectFullExtensionsList:p0,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[o0]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[f0]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[c0]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[l0]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[s0]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[a0]}}}),d0=()=>{const[t]=p_(),n=new AbortController,e=n.signal,r=Xe(ke.selectors.selectImagePolicy),i=Xe(ke.selectors.selectVideoPolicy),o=Xe(ke.selectors.selectDocPolicy),u=Xe(ke.selectors.selectAudioPolicy);return[async({media:n,tag:a,onError:s,onUpload:c})=>{var l;const f=ru(n.file.name),h=await j_({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:u,media:n});if(h)return eu.error(h),void(null==s||s());try{const r=await t({createUpload:{extension:f,tags:[a],meta:{name:n.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(l=r.data)?void 0:l.uri;return await I_({url:i,method:"PUT",body:n.file,signal:e}),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),eu(`Could not upload file. ${t}`)}},()=>n.abort("Upload canceled")]};var ks,Lt={exports:{}},g0=Lt.exports;
1
+ import{api as h_,handleBasicResponse as Ir,usePostApiV1UploadsMutation as p_,useDeleteApiV1UploadsByIdMutation as d_,usePostApiV1UploadsByIdMetaMutation as g_}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.381";import{useSelector as Xe}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{toast as eu}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{createAction as ta,createSelector as Ue,createSlice as __}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import v_,{useRef as w_,useState as m_,useEffect as x_,forwardRef as S_}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useIsMobile as y_}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.343";const A_=h_.enhanceEndpoints({endpoints:{postApiV1UploadsByIdMeta:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n,"Updated")}},postApiV1UploadsList:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n)}},postApiV1UploadsBatch:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n,"Deleted")}},putApiV1UploadsByIdTags:{async onQueryStarted(t,{queryFulfilled:n}){await Ir(n)}}}}),{usePostApiV1UploadsByIdMetaMutation:B0,usePostApiV1UploadsListMutation:N0,usePutApiV1UploadsByIdTagsMutation:W0,usePostApiV1UploadsBatchMutation:$0}=A_;var Qe=(t=>(t.done="done",t.inprogress="inprogress",t))(Qe||{}),Pe=(t=>(t.image="image",t.video="video",t.audio="audio",t))(Pe||{}),ra=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t))(ra||{});const ru=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},I_=async({url:t,...n})=>{const e=await fetch(t,n);if(!e.ok)throw new Error(e.statusText);if("PUT"===n.method)return;const r=await e.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},E_=t=>t.replace(/\.[^.]*$/,""),ia=()=>"object"!=typeof window,R_=()=>!ia()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),bt="8.48.0",ce=globalThis;function iu(t,n,e){const r=ce,i=r.__SENTRY__=r.__SENTRY__||{},o=i[bt]=i[bt]||{};return o[t]||(o[t]=n())}const ua=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,L_="Sentry Logger ",zs=["debug","info","warn","error","log","assert","trace"],qs={};function b_(t){if(!("console"in ce))return t();const n=ce.console,e={},r=Object.keys(qs);r.forEach((t=>{const r=qs[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function T_(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return ua?zs.forEach((e=>{n[e]=(...n)=>{t&&b_((()=>{ce.console[e](`${L_}[${e}]:`,...n)}))}})):zs.forEach((t=>{n[t]=()=>{}})),n}const br=iu("logger",T_);function uu(){return ou(ce),ce}function ou(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||bt,n[bt]=n[bt]||{}}const C_=Object.prototype.toString;function O_(t,n){return C_.call(t)===`[object ${n}]`}function P_(t){return O_(t,"Object")}function U_(t){return!(!t||!t.then||"function"!=typeof t.then)}function M_(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{ua&&br.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const oa=1e3;function sa(){return Date.now()/oa}function D_(){const{performance:t}=ce;if(!t||!t.now)return sa;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/oa}const F_=D_();function je(){const t=ce,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function B_(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||F_(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:je()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function Hs(){return je()}function Ks(){return je().substring(16)}function aa(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=aa(r[t],n[t],e-1));return r}(()=>{const{performance:t}=ce;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const tu="_sentrySpan";function Ys(t,n){n?M_(t,tu,n):delete t[tu]}function Zs(t){return t[tu]}const N_=100;class su{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:Hs(),spanId:Ks()}}clone(){const t=new su;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,Ys(t,Zs(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&&B_(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,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},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,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,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 n="function"==typeof t?t(this):t,[e,r]=n instanceof Tt?[n.getScopeData(),n.getRequestSession()]:P_(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),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,Ys(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Hs()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:N_;if(e<=0)return this;const r={timestamp:sa(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):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:Zs(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=aa(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:Ks(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:je();if(!this._client)return br.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:je();if(!this._client)return br.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:je();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(br.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Tt=su;function W_(){return iu("defaultCurrentScope",(()=>new Tt))}function $_(){return iu("defaultIsolationScope",(()=>new Tt))}class G_{constructor(t,n){let e,r;e=t||new Tt,r=n||new Tt,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return U_(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}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 nt(){const t=ou(uu());return t.stack=t.stack||new G_(W_(),$_())}function z_(t){return nt().withScope(t)}function q_(t,n){const e=nt();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function Vs(t){return nt().withScope((()=>t(nt().getIsolationScope())))}function H_(){return{withIsolationScope:Vs,withScope:z_,withSetScope:q_,withSetIsolationScope:(t,n)=>Vs(n),getCurrentScope:()=>nt().getScope(),getIsolationScope:()=>nt().getIsolationScope()}}function fa(t){const n=ou(t);return n.acs?n.acs:H_()}function ca(){return fa(uu()).getCurrentScope()}function K_(){return fa(uu()).getIsolationScope()}function Y_(t,n){return ca().captureException(t,void 0)}function Z_(t,n){const e={captureContext:n};return ca().captureMessage(t,void 0,e)}function V_(t,n){K_().setExtra(t,n)}var Er=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const J_=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return V_("exceptionMessage",n),void Y_(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}Z_(n)},Js=["debug","info","warn","error"],X_=(t,n)=>{const e=Js.indexOf(t);return Js.indexOf(n)>=e},Rr=(t,n,e,...r)=>{X_(n,t)&&console.log(`[${t}] ${e}`,...r)},Q_=()=>null==window?void 0:window.localStorage.getItem("logger_lvl"),k_=(t=(ia()?"info":Q_()||"warn"))=>{let n=t;return{debug:(t,...e)=>Rr("debug",n,t,...e),info:(t,...e)=>Rr("info",n,t,...e),warn:(t,...e)=>Rr("warn",n,t,...e),error:(t,...e)=>(J_(t,...e),Rr("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},la=k_(),ha=({src:t,name:n=""})=>new Promise(((e,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:u,src:a}=i,s=E_(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{la.warn("Failed to load video"),e(null)};return R_()&&i.load(),i.addEventListener("error",u),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",u),i.removeEventListener("loadeddata",o)}})),pa=t=>new Promise(((n,e)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{n({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{la.warn("Failed to load image"),e(null),URL.revokeObjectURL(i)},r.src=i})),Xs=t=>{if(!t)return;const n="number"==typeof t?t:parseInt(t,10);if(isNaN(n))throw new Error("Can not get number from income argument");const e=n/1048576;return`${Math.floor(e)} MB`},j_=async({media:t,docPolicy:n,imgPolicy:e,videoPolicy:r,audioPolicy:i})=>{if(!e||!r)return"Media policy is not defined";const o={IMAGE:e.extensions,VIDEO:r.extensions,AUDIO:i.extensions,DOCUMENT:n.extensions},u=ru(t.file.name)||"",a=Object.keys(o).find((t=>{var n;return null==(n=o[t])?void 0:n.includes(u)}));if(!a)return`Extension ${u} is not supported`;const s="VIDEO"===a;if("IMAGE"===a){const n=await pa(t.file),r=t.file.size>e.maxSize,i=n&&Math.max(n.width,n.height)>e.maxResolution,o=n&&n.width*n.height>e.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${Xs(e.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${e.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 ${e.maxMatrix} pixels`}}if(s){const n=await ha({src:t.objectUrl}),e=n&&n.duration>r.maxDuration,i=n&&Math.max(n.width,n.height)>r.maxResolution,o=t.file.size>r.maxSize,u=n&&n.width*n.height>r.maxMatrix;switch(!0){case e:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${Xs(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case u: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`}}},n0=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},e0=t=>n0(t)&&"type"in t&&"string"==typeof t.type,F=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>e0(n)&&n.type===t,n};F("remoteReady"),F("reselectUser"),F("requestLogin"),F("requestLogout"),F("setConfirmLeavePage"),F("requestChangePath"),F("wsSubscribe"),F("wsUnSubscribe"),F("hostStoreConnect"),F("remoteLogin"),F("remoteLogout"),F("wsOnMessage"),F("setRouterPath"),F("setDeviceType"),F("setUserError"),F("setUserIsError"),F("setUserPending"),F("setUserSuccess"),F("setUserData"),F("updateAccountData"),F("updateUser"),F("addNotification"),F("markNotification"),F("setNotificationsError"),F("setNotificationsList"),F("setNotificationsPending"),F("setNotificationsTotalCount"),F("setNotificationsUnreadCount"),F("resetNotificationsState"),F("undoNotification"),F("setInstanceInfo"),F("setInstanceInfoPending"),F("setInstanceInfoError");const t0=F("setPlatformSettings");F("setProfileSettings"),F("setGroupData"),F("setGroupLoading"),F("showGroupBasicInfo"),ta("requestMicroFrontendFetch"),ta("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"},i0={posts:"wellesley.posts",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"},u0={data:null,isPending:!1},{posts:ki,uploadsPolicyDoc:Qs,uploadsPolicyAudio:ji,uploadsPolicyImage:Lr,uploadsPolicyVideo:Et,registration:o0,captcha:s0}=i0,{captcha:a0,language:f0,translation:c0,openai:l0}=r0,et=t=>t.data,h0=Ue(et,(t=>{var n,e,r;return{max_characters:(null==(n=null==t?void 0:t[ki])?void 0:n.max_characters)||0,max_media_attachments:(null==(e=null==t?void 0:t[ki])?void 0:e.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[ki])?void 0:r.max_pins)||0}})),da=Ue(et,(t=>{var n,e,r;return{...null==t?void 0:t[Lr],maxSize:(null==(n=null==t?void 0:t[Lr])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Lr])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[Lr])?void 0:r.maxResolution)||0}})),ga=Ue(et,(t=>{var n,e,r,i;return{...null==t?void 0:t[Et],maxSize:(null==(n=null==t?void 0:t[Et])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Et])?void 0:e.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Et])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Et])?void 0:i.maxResolution)||0}})),_a=Ue(et,(t=>{var n,e;return{...null==t?void 0:t[ji],maxSize:null==(n=null==t?void 0:t[ji])?void 0:n.maxSize,keepOriginal:(null==(e=null==t?void 0:t[ji])?void 0:e.keepOriginal)||0}})),va=Ue(et,(t=>{var n;return{...null==t?void 0:t[Qs],maxSize:(null==(n=null==t?void 0:t[Qs])?void 0:n.maxSize)||0}})),wa=Ue([da,ga,_a,va],((t,n,e,r)=>({IMAGE:null==t?void 0:t.extensions,VIDEO:null==n?void 0:n.extensions,AUDIO:null==e?void 0:e.extensions,DOCUMENT:null==r?void 0:r.extensions}))),p0=Ue(wa,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),ke=__({name:"platformSettings",initialState:u0,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(t0,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:et,selectPostConfig:h0,selectDocPolicy:va,selectImagePolicy:da,selectVideoPolicy:ga,selectAudioPolicy:_a,selectSupportedExtensions:wa,selectFullExtensionsList:p0,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[o0]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[f0]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[c0]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[l0]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[s0]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[a0]}}}),d0=()=>{const[t]=p_(),n=new AbortController,e=n.signal,r=Xe(ke.selectors.selectImagePolicy),i=Xe(ke.selectors.selectVideoPolicy),o=Xe(ke.selectors.selectDocPolicy),u=Xe(ke.selectors.selectAudioPolicy);return[async({media:n,tag:a,onError:s,onUpload:c})=>{var l;const f=ru(n.file.name),h=await j_({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:u,media:n});if(h)return eu.error(h),void(null==s||s());try{const r=await t({createUpload:{extension:f,tags:[a],meta:{name:n.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(l=r.data)?void 0:l.uri;return await I_({url:i,method:"PUT",body:n.file,signal:e}),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),eu(`Could not upload file. ${t}`)}},()=>n.abort("Upload canceled")]};var ks,Lt={exports:{}},g0=Lt.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.264",
5
+ "version": "1.0.266",
6
6
  "module": "index.ts",
7
7
  "files": [
8
8
  "*",