nb-js-client 1.0.52 → 1.0.53

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.
@@ -1,14 +1,20 @@
1
1
  import { Client } from '../classes';
2
- import { RequestBaseParams, ResponseList } from '../types';
3
- import { Space, SpaceAccess, SpaceAdmin } from '../types/space';
2
+ import { PermissionType, RequestBaseParams, ResponseList } from '../types';
3
+ import { Space, SpaceAccess, SpaceAccessProvide, SpaceAdmin } from '../types/space';
4
4
  export declare class SpaceApiService {
5
5
  private client;
6
6
  constructor(client: Client);
7
+ space(id: number): Promise<Space>;
7
8
  list(params: RequestSpaceListParams): Promise<ResponseList<Space>>;
8
9
  create(params: RequestSpaceCreateParams): Promise<Space>;
9
10
  update(id: number, params: RequestSpaceUpdateParams): Promise<Space>;
10
11
  delete(id: number): Promise<void>;
11
12
  adminsList(id: number, params: RequestSpaceAdminsListParams): Promise<ResponseList<SpaceAdmin>>;
13
+ accessList(params: RequestSpaceAccessListParams): Promise<SpaceAcсessResponseList>;
14
+ provideAccess(params: RequestProvideSpaceAccessParams): Promise<SpaceAccessProvide>;
15
+ deleteAllAccess(params: RequestSpaceAccessParams): Promise<void>;
16
+ updateAccess(id: number, params: RequestUpdateSpaceAccessParams): Promise<SpaceAccessProvide>;
17
+ deleteAccess(id: number, space_id: number): Promise<void>;
12
18
  }
13
19
  export interface RequestSpaceListParams extends RequestBaseParams {
14
20
  search?: string;
@@ -21,3 +27,24 @@ export interface RequestSpaceCreateParams {
21
27
  }
22
28
  export type RequestSpaceUpdateParams = Omit<RequestSpaceCreateParams, 'space_accesses'>;
23
29
  export type RequestSpaceAdminsListParams = Pick<RequestBaseParams, 'limit' | 'offset'>;
30
+ export interface RequestSpaceAccessParams {
31
+ space_id: number;
32
+ access_mode?: PermissionType;
33
+ file_container_id?: string;
34
+ is_to_user_group?: boolean;
35
+ }
36
+ export type RequestSpaceAccessListParams = RequestSpaceAccessParams & RequestSpaceAdminsListParams;
37
+ export type SpaceAcсessResponseList = ResponseList<SpaceAccessProvide> & {
38
+ total_r: number;
39
+ total_rw: number;
40
+ total_rwd: number;
41
+ total_admin: number;
42
+ };
43
+ export interface RequestProvideSpaceAccessParams {
44
+ access_mode: PermissionType;
45
+ file_container_id?: string;
46
+ space_id: number;
47
+ to_user_group_id?: number;
48
+ to_user_id?: number;
49
+ }
50
+ export type RequestUpdateSpaceAccessParams = Pick<RequestProvideSpaceAccessParams, 'access_mode' | 'space_id'>;
@@ -1 +1 @@
1
- "use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`,r=`${e}/tfa`;class i{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}loginTfa(e){return this.client.rest.post(r,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var n;exports.AccessRights=void 0,(n=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",n.LicenseManage="license_edit",n.UsersRead="users_read",n.UsersCreate="users_create",n.UsersActivate="users_activate",n.GroupsRead="groups_read",n.GroupsCreate="groups_create",n.RolesRead="roles_read",n.RolesCreate="roles_create",n.Share="share",n.Divide="divide",n.ExtensionsRead="extensions_read",n.ExtensionsManage="extensions_write",n.RestrictionShareRead="restriction_share_read",n.RestrictionShareWrite="restriction_share_write",n.RestrictionDivideRead="restriction_divide_read",n.RestrictionDivideWrite="restriction_divide_write",n.LimitationsRead="limitations_read",n.LimitationsEdit="limitations_edit",n.ReadUserLogs="read_user_logs",n.ConnectionsRead="connections_read",n.ConnectionsDividing="connections_dividing",n.ConnectionsYandexDisk="connections_yandex_disk",n.ConnectionsSsh="connections_ssh",n.ConnectionsMail="connections_mail",n.ConnectionsS3="connections_s3",n.ConnectionsDiscord="connections_discord",n.ConnectionsWebdav="connections_webdav",n.ConnectionsNextcloud="connections_nextcloud",n.ConnectionsNextbox="connections_nextbox",n.ConnectionsHttpProxy="connections_http_proxy",n.SystemInfoServiceList="system_info_service_list",n.SettingsRead="settings_read",n.SettingsWrite="settings_write",n.DemoAdmin="demo_admin";const o=[exports.AccessRights.ConnectionsYandexDisk,exports.AccessRights.ConnectionsSsh,exports.AccessRights.ConnectionsMail,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsDiscord,exports.AccessRights.ConnectionsWebdav,exports.AccessRights.ConnectionsNextcloud,exports.AccessRights.ConnectionsNextbox,exports.AccessRights.ConnectionsHttpProxy];var c,a,l,p,d,u,h,g,_,x,v,$,m,S,y,f,w,k,A,T,b,C,R,E,D,U,P,O,L,N,I,q,z,j,M,B;exports.OrderDirection=void 0,(c=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",c.ASC="asc",c.DESC="desc",exports.EngineType=void 0,(a=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",a.PostMessage="postmessage",a.Empty="",exports.ColorTypes=void 0,(l=exports.ColorTypes||(exports.ColorTypes={})).Yellow="yellow",l.Success="success",l.Critical="critical",l.Warning="warning",l.Brand="brand",l.Purple="purple",l.Primary="primary",l.Gray="gray",exports.ConnectionGroup=void 0,(p=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",p.Webhooks="webhooks_connections_group",p.Unknown="unknown_connections_group",p.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(d=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",d.YandexDisk="yandex_disk",d.Mail="mail",d.Discord="discord",d.Webdav="webdav_connection",d.Nextcloud="nextcloud_connection",d.NextBox="nextbox_connection",d.HttpProxy="http_proxy_connection",d.S3="s3_connection",exports.ExtensionType=void 0,(u=exports.ExtensionType||(exports.ExtensionType={})).App="app",u.File="file",u.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(h=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",h.ReadAndWrite="read_and_write",h.Write="write",exports.DivideScope=void 0,(g=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",g.Connection="/connections",exports.PermissionType=void 0,(_=exports.PermissionType||(exports.PermissionType={})).Close="",_.Read="r",_.Write="rw",_.Full="full",_.Admin="admin",exports.RestrictionStatus=void 0,(x=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",x.APPROVED="approved",x.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(v=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",v.FALSE="false",exports.DivideMode=void 0,($=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",$.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(m=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",m.Share="share",exports.Tariff=void 0,(S=exports.Tariff||(exports.Tariff={})).Free="free",S.Business="business",S.Enterprise="enterprise",exports.LicenseError=void 0,(y=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",y.Blocked="License blocked",y.Expired="License has been expired",y.NotValid="License not valid",y.NotFound="license file not found",exports.LimitationType=void 0,(f=exports.LimitationType||(exports.LimitationType={})).BySize="size",f.ByExt="extension",f.ByQuota="quota_size",exports.LimitationSubType=void 0,(w=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",w.White="extension_white",w.Black="extension_black",exports.NotificationEntityType=void 0,(k=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",k.File="file",k.User="user",k.Other="other",k.WorkDir="work_dir",k.License="license",k.Extension="extension",k.Connection="connection",exports.NotificationAction=void 0,(A=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",A.SecurityCheckPositive="action_security_check_positive",A.CommentVersionMention="action_version_comment_mention",A.OpenSharing="open_sharing",A.ChangeSharing="change_sharing",A.CancelSharing="cancel_sharing",A.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",A.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",A.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",A.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",A.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",A.CancelDivideDir="cancel_divide_dir",A.CancelDivideFile="cancel_divide_file",A.CancelDivideWorkDir="cancel_divide_work_dir",A.CancelDivideConnection="cancel_divide_connection",A.DeleteExtension="delete_extension",A.NewVersionExtension="new_version_extension",A.TransferData="transfer_data",A.AllowInternalAccessUser="allow_internal_access_to_user",A.BlockInternalAccessUser="block_internal_access_to_user",A.WaitInternalAccessUser="wait_internal_access_to_user",A.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",A.AllowInternalAccessGroup="allow_internal_access_to_group",A.BlockInternalAccessGroup="block_internal_access_to_group",A.WaitInternalAccessGroup="wait_internal_access_to_group",A.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",A.AllowSharing="allow_sharing",A.BlockSharing="block_sharing",A.WaitSharing="wait_sharing",A.WaitSharingCreate="wait_sharing_create",A.StatusCreateZipProcess="status_create_zip_process",A.StatusCreateZipSuccess="status_create_zip_success",A.StatusCreateZipError="status_create_zip_error",A.DownloadZipSuccess="download_zip_success",A.DownloadZipError="download_zip_error",A.StatusUnzipProcess="status_unzip_process",A.StatusUnzipSuccess="status_unzip_success",A.StatusUnzipError="status_unzip_error",A.StatusUnzipSuccessWithLimits="status_unzip_success_with_limits",A.AnonymZipDirAddFileToOwner="anonym_zip_dir_add_file_to_owner",A.GuestZipDirAddFileToOwner="guest_zip_dir_add_file_to_owner",A.DropDocumentOnlyoffice="drop_document_onlyoffice",A.CopyError="copy_error",A.CopySuccess="copy_success",A.StatusCopyProcess="status_copy_process",A.Other="other",exports.NotificationRowAction=void 0,(T=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",T.Unread="unread",T.Delete="delete",exports.NotificationStyle=void 0,(b=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",b.Success="success",b.Info="info",b.Warning="warning",b.Error="error",exports.ResponseType=void 0,(C=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",C.Blob="blob",C.Json="json",C.Text="text",exports.RequestMethod=void 0,(R=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",R.POST="POST",R.PUT="PUT",R.PATCH="PATCH",R.DELETE="DELETE",R.HEAD="HEAD",exports.RequestObserve=void 0,(E=exports.RequestObserve||(exports.RequestObserve={})).Body="body",E.Response="response",exports.RestrictionSharing=void 0,(D=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",D.SOFT="soft",D.HARD="hard",exports.UserAuthType=void 0,(U=exports.UserAuthType||(exports.UserAuthType={})).Native="native",U.Ldap="ldap",U.Vk="vk",exports.UserStatus=void 0,(P=exports.UserStatus||(exports.UserStatus={})).Registering="registering",P.Activated="activated",P.BlockedByAdmin="blocked_by_admin",P.BlockedByLicense="blocked_by_license",P.BlockedByInactive="blocked_by_inactive",P.BlockedByInactiveChangePassword="blocked_by_inactive_change_password",exports.UserType=void 0,(O=exports.UserType||(exports.UserType={})).User="user",O.Guest="guest",O.Emperor="emperor",O.Anonymous="anonymous",exports.UserParamsLabel=void 0,(L=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",L.Lang="lang",L.Sort="sort",L.ViewApps="viewApps",L.WithoutContentWorkDir="withoutContentWorkDir",L.DashboardGrid="dashboardGrid",exports.UserAppType=void 0,(exports.UserAppType||(exports.UserAppType={})).Webdav="webdav",exports.SettingControlType=void 0,(N=exports.SettingControlType||(exports.SettingControlType={})).Text="text",N.String="string",N.Number="number",N.CheckBox="checkbox",N.Select="select",N.RadioList="radio_list",N.ConnectionChoose="connection_choose",N.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(I=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",I.File="file",I.WorkDir="work_dir",I.App="app",exports.StorageElementContentType=void 0,(q=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",q.Dir="dir",q.Code="code",q.Image="image",q.Audio="audio",q.Video="video",q.Text="text",q.Doc="doc",q.Xls="xls",q.Ppt="ppt",exports.StorageRoot=void 0,(z=exports.StorageRoot||(exports.StorageRoot={})).my="my",z.fca="fca",z.divide="divide",z.share="share",z.favorite="favorite",z.trash="trash",exports.StorageElementHistoryAction=void 0,(j=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",j.Update="update",j.Move="move",exports.StorageElementCheckStatus=void 0,(M=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[M.CheckNull=0]="CheckNull",M[M.CheckInProgress=1]="CheckInProgress",M[M.CheckPositive=2]="CheckPositive",M[M.CheckNegative=3]="CheckNegative",exports.SpacePermission=void 0,(B=exports.SpacePermission||(exports.SpacePermission={})).Read="r",B.Write="rw",B.Full="rwd",B.SpaceManage="space_manage";const F="/connections",W=`${F}/dashboard`;class H{constructor(e){this.client=e}list(e){return this.client.rest.get(F,e)}get(e){return this.client.rest.get(`${F}/${e}`)}update(e,t){return this.client.rest.put(`${F}/${e}`,t)}delete(e){return this.client.rest.delete(`${F}/${e}`)}create(e){const t={[exports.ConnectionType.SSH]:"/disk/ssh",[exports.ConnectionType.Webdav]:"/disk/webdav",[exports.ConnectionType.Nextcloud]:"/disk/nextcloud",[exports.ConnectionType.NextBox]:"/disk/nextbox",[exports.ConnectionType.Discord]:"/webhooks/discord",[exports.ConnectionType.Mail]:"/webhooks/mail",[exports.ConnectionType.HttpProxy]:"/http_proxy",[exports.ConnectionType.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||F,e)}dashboard(e){return this.client.rest.get(W,e)}}class G{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const V="/divide",Z=`${V}/restrictions`,J=`${V}/tag_group`;class K{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${V}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}${V}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:r,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${V}/${t}`,{access_mode:s})}divideCreate(e,t,s,r,i){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:r});return this.client.rest.post(`${e}${V}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}${V}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}divideTagGroupList(e){return this.client.rest.get(`${exports.DivideScope.Storage}${J}`,e)}getRestriction(e){return this.client.rest.get(`${Z}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${Z}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${Z}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}class Q extends Error{}function Y(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function X(e,t){if("string"!=typeof e)throw new Q("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,r=e.split(".")[s];if("string"!=typeof r)throw new Q(`Invalid token specified: missing part #${s+1}`);let i;try{i=Y(r)}catch(e){throw new Q(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new Q(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}Q.prototype.name="InvalidTokenError";const ee=async(e,t)=>{let s=t;for(const t of e)try{s=await t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=await t.rejected(e)}return s};function te(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const se=e=>{const t=new URLSearchParams;return Object.keys(e).forEach((s=>{Array.isArray(e[s])?e[s].forEach((e=>{t.append(s,e)})):t.append(s,e[s])})),t};function re(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function ie(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ne="update black token";class oe{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}async refreshToken(e,t){const{access_token:s,refresh_token:r}=e;return s&&r?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const n=new XMLHttpRequest,o=`${t}${ce}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:r})),n.onload=()=>{if(n.status>=200&&n.status<300)try{const t=JSON.parse(n.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};te("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){i(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}async waitForTokenUpdate(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}}const ce="/api/v1",ae="/api/v2";class le{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(exports.RequestMethod.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(exports.RequestMethod.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(exports.RequestMethod.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(exports.RequestMethod.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(exports.RequestMethod.DELETE,e,Object.assign({params:t},s))}head(e,t,s){return this.request(exports.RequestMethod.HEAD,e,Object.assign({params:t},s))}upload(e,t,s){const r=new AbortController,i=r.signal;return{promise:this.request(exports.RequestMethod.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>r.abort()}}request(e,t,s){return new Promise(((r,i)=>{var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);(null==s?void 0:s.signal)&&(c.signal=s.signal);(async()=>{var s,n,a,l;if(o||(c=null!==(s=await ee(this.client.requestInterceptors,c))&&void 0!==s?s:c),this.state.authToken)for(const[e,s]of this.state.authToken.entries()){const r=X(s.access_token);if(r&&r.is_remember&&this.tokenUpdate.isTokenExpire(r.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=await this.tokenUpdate.refreshToken(s,this.baseHost);t&&(this.state.authToken.set(e,t),c=null!==(n=await ee(this.client.requestInterceptors,c))&&void 0!==n?n:c)}}const p=new XMLHttpRequest;c.params&&Object.keys(c.params).length&&(t+="?"+se(c.params));const d=null!==(a=c.host)&&void 0!==a?a:this.state.clientParams.host,u=`${d}${null!==(l=c.version)&&void 0!==l?l:this.state.clientParams.version}${t}`;if(p.open(e,u,!0),c.headers){const e=re(c.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&p.setRequestHeader(t,s)}c.responseType&&(p.responseType=c.responseType),c.signal&&c.signal.addEventListener("abort",(()=>{p.abort(),i(new Error("Request aborted"))})),!p.upload||e!==exports.RequestMethod.POST&&e!==exports.RequestMethod.PUT&&e!==exports.RequestMethod.PATCH||(p.upload.onprogress=e=>{e.lengthComputable&&c.onUploadProgress&&c.onUploadProgress(e)}),p.onload=async()=>{if(c.signal&&c.signal.aborted)return;let e;switch(c.responseType){case exports.ResponseType.Text:e=p.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=p.response;break;default:try{e=JSON.parse(p.responseText)}catch(t){e=p.responseText}}const t=new Headers;p.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));const s={status:p.status,statusText:p.statusText,headers:t,url:p.responseURL};if(p.status>=200&&p.status<300)return await ee(this.client.responseInterceptors,s),void(c.observe===exports.RequestObserve.Response?r(Object.assign(Object.assign({},s),{body:e})):r(e));if(this.state.authToken&&(null==e?void 0:e.code)===ne){const e=await this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}const n=Object.assign(Object.assign({},s),{error:e});await ee(this.client.responseInterceptors,n),i(n)},p.onerror=()=>{i({status:p.status,statusText:p.statusText,url:p.responseURL,error:"Network error"})},p.send(ie(c.body))})().catch(i)}))}}const pe="/static/extensions",de="/extensions/defaults",ue=`${pe}/names/users`,he=`${pe}/names/system`,ge=`${pe}/tags`;class _e{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${pe}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${pe}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${pe}/${e}/settings`)}get(e){return this.client.rest.get(`${pe}/${e}`)}getByKey(e){return this.client.rest.get(`${pe}/${e}`)}getDefault(e=[]){return this.client.rest.get(de,{ext_code:e})}setDefault(e,t){return this.client.rest.post(de,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${pe}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${pe}/${e}`,{version:t})}list(e){return this.client.rest.get(pe,e)}listTags(e){return this.client.rest.get(ge,e)}delete(e,t){return this.client.rest.delete(`${pe}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(pe,s,{version:ae,onUploadProgress:t=>{e(t)}});return{promise:r,abort:i}}install(e,t){return this.client.rest.post(`${pe}/site`,{uniq_key:e,version:t},{version:ae})}getSystemNameExts(e){return this.client.rest.get(he,e)}getUserNameExts(e){return this.client.rest.get(ue,e)}createUserNameExt(e){return this.client.rest.post(`${ue}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${ue}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${ue}`)}}const xe="/anons_ext/extensions";class ve{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(xe,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${xe}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${xe}/${e.uniqKey}/readme`,{lang:e.lang},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const $e="/disk",me=`${$e}/check`;class Se{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${$e}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${$e}/${e}`,t)}create(e,t){return this.client.rest.post(`${$e}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${$e}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${$e}/${e}/files?path=${t}`)}upload(e,t,s,r=""){const i=new FormData;i.set("path",r),i.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${$e}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${$e}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${$e}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(me,e)}}const ye="/settings";class fe{constructor(e){this.client=e}settings(){return this.client.rest.get(ye)}changeSettings(e){return this.client.rest.post(ye,e)}queryInit(){return this.client.rest.get("/query/init")}}var we;exports.QueryInitViewType=void 0,(we=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",we.Simple="Simple";const ke="/groups";class Ae{constructor(e){this.client=e}list(e){return this.client.rest.get(ke,e)}get(e){return this.client.rest.get(`${ke}/${e}`)}listUsers(e,t){return this.client.rest.get(`${ke}/${e}/users`,t)}default(){return this.client.rest.get(`${ke}/default`)}create(e){return this.client.rest.post(ke,e)}update(e,t){return this.client.rest.put(`${ke}/${e}`,t)}delete(e){return this.client.rest.delete(`${ke}/${e}`)}}const Te="/license",be=`${Te}/manual-check`,Ce=`${Te}/hardware/hash`;class Re{constructor(e){this.client=e}info(){return this.client.rest.get(Te)}create(e){return this.client.rest.post(Te,e)}check(){return this.client.rest.post(be)}delete(){return this.client.rest.delete(Te)}getHash(){return this.client.rest.get(Ce)}}const Ee="/links";class De{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Ee,e)}updateShortLink(e){return this.client.rest.put(Ee,e)}}const Ue="/limitations";class Pe{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Ue,e)}listUsers(e,t){return this.client.rest.get(`${Ue}/${e}/users`,t)}create(e){return this.client.rest.post(Ue,e)}get(e){return this.client.rest.get(`${Ue}/${e}`)}update(e,t){return this.client.rest.put(`${Ue}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ue}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Ue}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Ue}/${e}/user/${t}`)}}const Oe="/logs/users",Le=`${Oe}/actions`;class Ne{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${Oe}`,e)}getLogsActions(e){return this.client.rest.get(`${Le}`,e)}}const Ie="/notifications",qe=`${Ie}/all`,ze=`${Ie}/subscription`,je=`${Ie}/permission`;class Me{constructor(e){this.client=e}list(e){return this.client.rest.get(Ie,e)}toggleStatus(e,t){return this.client.rest.put(Ie,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(qe,{to_status:e})}delete(e){return this.client.rest.delete(Ie,{id:e})}deleteAll(){return this.client.rest.delete(qe)}getPermission(){return this.client.rest.get(je)}setPermission(e){return this.client.rest.post(je,{enabled:e})}getSubscription(){return this.client.rest.get(ze)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(ze,t)}}const Be="/roles",Fe=`${Be}/default`,We="/permissions";class He{constructor(e){this.client=e}list(e){return this.client.rest.get(Be,e)}get(e){return this.client.rest.get(`${Be}/${e}`)}getDefault(){return this.client.rest.get(`${Fe}`)}create(e){return this.client.rest.post(Be,e)}update(e,t){return this.client.rest.put(`${Be}/${e}`,t)}delete(e){return this.client.rest.delete(`${Be}/${e}`)}permissionList(){return this.client.rest.get(We)}addPermission(e,t){return this.client.rest.put(`${Be}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Be}/${e}/${We}`,{ids:t})}}const Ge="/share",Ve=`${Ge}/restrictions`,Ze=`${Ge}/login`;class Je{constructor(e){this.client=e}info(e){return this.client.rest.get(`${Ge}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Ge}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Ve}/${e}`)}restrictions(e){return this.client.rest.get(Ve,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ve}/${e}`,t)}login(e){return this.client.rest.post(`${Ze}`,e)}}const Ke="/storage/element/version/comment",Qe=`${Ke}/all`;class Ye{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Ke}`,e)}create(e){return this.client.rest.post(`${Ke}`,e)}update(e){return this.client.rest.put(`${Ke}`,e)}delete(e){return this.client.rest.delete(`${Ke}`,e)}deleteAll(e){return this.client.rest.delete(`${Qe}`,e)}}const Xe="/storage",et=`${Xe}/element`,tt=`${et}/divide`,st=`${tt}/resource`,rt=`${et}/move`,it=`${et}/copy`,nt=`${et}/content_type_size`,ot="/disk";class ct{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Xe,e)}info(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,e.file_version_id||delete e.file_version_id,e.zip_entry_path||delete e.zip_entry_path,this.client.rest.get(et,e)}fileInfo(e,t){return this.client.rest.get(`${et}/${e}`,t?{file_version_id:t}:{})}combineInfo({root:e,rootId:t,path:s,file_version_id:r,zip_entry_path:i}){return e===exports.StorageRoot.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:r,zip_entry_path:i})}size(e){return this.client.rest.post(`${et}/size`,e)}move(e,t,s){const{from_divide_id:r,to_divide_id:i}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===exports.StorageRoot.fca&&s===exports.StorageRoot.fca?this.client.rest.post(`${ot}/${r}/files/move${ot}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${ot}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${ot}/${r}/files/to/box`,n)):this.client.rest.post(rt,e)}copy(e,t,s){const{from_divide_id:r,to_divide_id:i}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===exports.StorageRoot.fca&&t===exports.StorageRoot.fca?this.client.rest.post(`${ot}/${r}/files/copy${ot}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${ot}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${ot}/${r}/files/to/box`,n)):this.client.rest.post(it,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${et}/copy`,r)}create(e){return this.client.rest.post(et,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(et,s)}favorite(e){return this.client.rest.put(`${et}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${et}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(et,e)}createWorkDir(e){return this.client.rest.post(et,e)}sizeWithSection(e){return this.client.rest.get(nt,e)}getDivideResources(e){return this.client.rest.get(st,e)}getQuota(e){return this.client.rest.get(`${et}/user_size`,e)}hide(e){return this.client.rest.post(`${tt}/hide`,e)}unhide(e){return this.client.rest.post(`${tt}/unhide`,e)}}const at="/storage/files",lt=`${at}/net`,pt=`${at}/unzip`,dt=`${at}/zip`,ut=`${dt}/download`,ht=`${at}/process`,gt=`${at}/code`;class _t{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(at,t)}replace(e,t){const s=new URLSearchParams;return Object.keys(e).forEach((t=>{e[t]&&s.append(t,e[t])})),this.client.rest.put(`${at}?${s.toString()}`,t)}upload(e,t,s,r){const i=new FormData;i.set("path",s),r&&i.set("divide_id",r.toString()),i.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(at,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(lt,e)}createZipToDownload(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(ut,e)}createZip(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(dt,e)}cancelProcess(e){return this.client.rest.delete(ht,e)}unZip(e){return this.client.rest.post(pt,e)}checkZip(e){return this.client.rest.head(gt,e)}}class xt{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const vt="/storage/element/share";class $t{constructor(e){this.client=e}info(e){return this.client.rest.get(vt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(vt,s)}change(e){return this.client.rest.put(`${vt}/${e.token}`,e)}delete(e){return this.client.rest.delete(vt,{path:e})}refresh(e){return this.client.rest.put(`${vt}/${e}/refresh`)}}const mt="/storage/trash/element",St=`${mt}/all`;class yt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(mt,e)}clearAll(){return this.client.rest.delete(St)}restore(e){return this.client.rest.patch(mt,{del_groups:e})}restoreAll(){return this.client.rest.patch(St)}}const ft="/users",wt=`${ft}/me`,kt=`${wt}/avatars`,At=`${wt}/sessions`,Tt=`${wt}/tokens`,bt=`${wt}/params`,Ct=`${wt}/app-passwords`,Rt=`${wt}/change-password`,Et=`${ft}/initial`,Dt=`${wt}/phone`,Ut=`${Dt}/confirm`;class Pt{constructor(e){this.client=e}initial(e){return this.client.rest.post(Et,e)}list(e){return this.client.rest.get(ft,e)}get(e){return this.client.rest.get(ft+`/${e}`)}create(e){return this.client.rest.post(ft,e)}update(e,t){return this.client.rest.put(ft+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${ft}/${e}`,t)}restore(e){return this.client.rest.post(`${ft}/${e}/restore`)}me(){return this.client.rest.get(wt)}updateMe(e){return this.client.rest.put(wt,e)}createToken(e){return this.client.rest.post(Tt,e)}listToken(e){return this.client.rest.get(Tt,e)}deleteToken(e){return this.client.rest.delete(`${Tt}/${e}`)}changeMyPassword(e){return this.client.rest.put(Rt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${ft}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(kt,s)}meDeleteAvatar(){return this.client.rest.delete(kt)}meListSession(e){return this.client.rest.get(At,e)}meDeleteSession(e){let t=At;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${ft}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(bt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${bt}/${e}`,t)}meListParams(){return this.client.rest.get(bt)}phone(e){return this.client.rest.post(Dt,e)}phoneConfirm(e){return this.client.rest.post(`${Ut}/${e}`)}appPasswordsList(e){return this.client.rest.get(Ct,e)}createAppPasswords(e){return this.client.rest.post(Ct,e)}deleteAppPasswords(e){return this.client.rest.delete(`${Ct}/${e}`)}}const Ot="/users/appeals",Lt=`${Ot}/category`,Nt=`${Ot}/subcategory`,It=`${Ot}/file`;class qt{constructor(e){this.client=e}category(){return this.client.rest.get(Lt)}subcategory(e){return this.client.rest.get(Nt,{category_code:e})}uploadFile(e){const t=new FormData;return t.append("file",e),this.client.rest.post(It,t)}deleteFile(e){return this.client.rest.delete(`${It}/${e}`)}createAppeal(e){return this.client.rest.post(Ot,e)}}const zt="/storage/element",jt=`${zt}/history`,Mt=`${zt}/version`,Bt=`${Mt}/lock`,Ft=`${Mt}/unlock`,Wt=`${Mt}/current`,Ht=`${Mt}/size`;class Gt{constructor(e){this.client=e}history(e){return this.client.rest.get(jt,e)}versions(e){return this.client.rest.get(Mt,e)}create(e){return this.client.rest.post(Mt,e)}edit(e){return this.client.rest.put(Mt,e)}delete(e){return this.client.rest.delete(Mt,e)}size(e){return this.client.rest.get(Ht,e)}makeCurrent(e){return this.client.rest.post(Wt,e)}lock(e){return this.client.rest.post(Bt,e)}unlock(e){return this.client.rest.post(Ft,e)}}const Vt="/version",Zt=`${Vt}/changelog`;class Jt{constructor(e){this.client=e}getVersions(e){return this.client.rest.get(Vt,e)}getChangelog(e){return this.client.rest.get(Zt,{version_number:e})}}const Kt="/tag",Qt=`${Kt}/list`;class Yt{constructor(e){this.client=e}list(e){return this.client.rest.get(Qt,e)}get(e){return this.client.rest.get(`${Kt}/${e}`)}assign(e,t){return this.client.rest.post(`${Kt}/${e}/assign`,{items:t})}unassign(e,t){return this.client.rest.post(`${Kt}/${e}/unassign`,{items:t})}create(e){return this.client.rest.post(Kt,e)}update(e,t){return this.client.rest.put(`${Kt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Kt}/${e}`)}}const Xt="/spaces";class es{constructor(e){this.client=e}list(e){return this.client.rest.get(Xt,e)}create(e){return this.client.rest.post(Xt,e)}update(e,t){return this.client.rest.put(`${Xt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Xt}/${e}`)}adminsList(e,t){return this.client.rest.get(`${Xt}/${e}`,t)}}exports.AuthApiService=i,exports.BASE_URL_V1=ce,exports.BASE_URL_V2=ae,exports.CONNECTIONS_PERMISSION=o,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new H(this),this.DiscoveryApiService=new G(this),this.DivideApiService=new K(this),this.ExtensionsApiService=new _e(this),this.ExtensionsExternalApiService=new ve(this),this.FcaApiService=new Se(this),this.GatewayApiService=new fe(this),this.GroupApiService=new Ae(this),this.LicenseApiService=new Re(this),this.LinksApiService=new De(this),this.LimitationsApiService=new Pe(this),this.LogstashApiService=new Ne(this),this.NotificationApiService=new Me(this),this.RoleApiService=new He(this),this.ShareApiService=new Je(this),this.StorageCommentApiService=new Ye(this),this.StorageElementApiService=new ct(this,this.FcaApiService),this.StorageFilesApiService=new _t(this),this.TagsApiService=new Yt(this),this.StorageInstanceApiService=new xt(this),this.StorageShareApiService=new $t(this),this.StorageTrashApiService=new yt(this),this.UserApiService=new Pt(this),this.UsersAppealsApiService=new qt(this),this.VersionApiService=new Gt(this),this.PlatformVersionApiService=new Jt(this),this.SpaceApiService=new es(this),this.tokenUpdate=new oe,this.rest=new le(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(e,t)=>{this.requestInterceptors.push({fulfilled:e,rejected:t})}},this.response={use:(e,t)=>{this.responseInterceptors.push({fulfilled:e,rejected:t})}},this.state={clientParams:{host:null==e?void 0:e.host,version:(null==e?void 0:e.version)||ce},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=H,exports.DiscoveryApiService=G,exports.DivideApiService=K,exports.ExtensionsApiService=_e,exports.ExtensionsExternalApiService=ve,exports.FcaApiService=Se,exports.GatewayApiService=fe,exports.GroupApiService=Ae,exports.LicenseApiService=Re,exports.LimitationsApiService=Pe,exports.LinksApiService=De,exports.LogstashApiService=Ne,exports.NEED_TOKEN_UPDATE_ERROR=ne,exports.NotificationApiService=Me,exports.PlatformVersionApiService=Jt,exports.Rest=le,exports.RoleApiService=He,exports.ShareApiService=Je,exports.SpaceApiService=es,exports.StorageCommentApiService=Ye,exports.StorageElementApiService=ct,exports.StorageFilesApiService=_t,exports.StorageInstanceApiService=xt,exports.StorageShareApiService=$t,exports.StorageTrashApiService=yt,exports.TagsApiService=Yt,exports.TokenUpdate=oe,exports.UserApiService=Pt,exports.UsersAppealsApiService=qt,exports.VersionApiService=Gt,exports.applyInterceptors=ee,exports.getCookieValue=te,exports.makeUrlParams=se,exports.normalizeHeaders=re,exports.prepareRequestBody=ie;
1
+ "use strict";const e="/login",t=`${e}/ldap`,s=`${e}/update`,r=`${e}/tfa`;class i{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}loginTfa(e){return this.client.rest.post(r,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var n;exports.AccessRights=void 0,(n=exports.AccessRights||(exports.AccessRights={})).LicenseRead="license_read",n.LicenseManage="license_edit",n.UsersRead="users_read",n.UsersCreate="users_create",n.UsersActivate="users_activate",n.GroupsRead="groups_read",n.GroupsCreate="groups_create",n.RolesRead="roles_read",n.RolesCreate="roles_create",n.Share="share",n.Divide="divide",n.ExtensionsRead="extensions_read",n.ExtensionsManage="extensions_write",n.RestrictionShareRead="restriction_share_read",n.RestrictionShareWrite="restriction_share_write",n.RestrictionDivideRead="restriction_divide_read",n.RestrictionDivideWrite="restriction_divide_write",n.LimitationsRead="limitations_read",n.LimitationsEdit="limitations_edit",n.ReadUserLogs="read_user_logs",n.ConnectionsRead="connections_read",n.ConnectionsDividing="connections_dividing",n.ConnectionsYandexDisk="connections_yandex_disk",n.ConnectionsSsh="connections_ssh",n.ConnectionsMail="connections_mail",n.ConnectionsS3="connections_s3",n.ConnectionsDiscord="connections_discord",n.ConnectionsWebdav="connections_webdav",n.ConnectionsNextcloud="connections_nextcloud",n.ConnectionsNextbox="connections_nextbox",n.ConnectionsHttpProxy="connections_http_proxy",n.SystemInfoServiceList="system_info_service_list",n.SettingsRead="settings_read",n.SettingsWrite="settings_write",n.DemoAdmin="demo_admin";const o=[exports.AccessRights.ConnectionsYandexDisk,exports.AccessRights.ConnectionsSsh,exports.AccessRights.ConnectionsMail,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsS3,exports.AccessRights.ConnectionsDiscord,exports.AccessRights.ConnectionsWebdav,exports.AccessRights.ConnectionsNextcloud,exports.AccessRights.ConnectionsNextbox,exports.AccessRights.ConnectionsHttpProxy];var c,a,l,p,d,u,h,g,_,x,v,$,S,m,y,f,A,k,w,T,b,C,R,E,D,U,P,O,L,N,I,q,z,j,M;exports.OrderDirection=void 0,(c=exports.OrderDirection||(exports.OrderDirection={})).DEFAULT="",c.ASC="asc",c.DESC="desc",exports.EngineType=void 0,(a=exports.EngineType||(exports.EngineType={})).WebSocket="websocket",a.PostMessage="postmessage",a.Empty="",exports.ColorTypes=void 0,(l=exports.ColorTypes||(exports.ColorTypes={})).Yellow="yellow",l.Success="success",l.Critical="critical",l.Warning="warning",l.Brand="brand",l.Purple="purple",l.Primary="primary",l.Gray="gray",exports.ConnectionGroup=void 0,(p=exports.ConnectionGroup||(exports.ConnectionGroup={})).Storages="storages_connections_group",p.Webhooks="webhooks_connections_group",p.Unknown="unknown_connections_group",p.Proxy="proxy_connections_group",exports.ConnectionType=void 0,(d=exports.ConnectionType||(exports.ConnectionType={})).SSH="ssh_connection",d.YandexDisk="yandex_disk",d.Mail="mail",d.Discord="discord",d.Webdav="webdav_connection",d.Nextcloud="nextcloud_connection",d.NextBox="nextbox_connection",d.HttpProxy="http_proxy_connection",d.S3="s3_connection",exports.ExtensionType=void 0,(u=exports.ExtensionType||(exports.ExtensionType={})).App="app",u.File="file",u.WorkDir="work_dir",exports.ExtensionFileMode=void 0,(h=exports.ExtensionFileMode||(exports.ExtensionFileMode={})).Read="read",h.ReadAndWrite="read_and_write",h.Write="write",exports.DivideScope=void 0,(g=exports.DivideScope||(exports.DivideScope={})).Storage="/storage/element",g.Connection="/connections",exports.PermissionType=void 0,(_=exports.PermissionType||(exports.PermissionType={})).Close="",_.Read="r",_.Write="rw",_.Full="rwd",_.SpaceManage="space_manage",exports.RestrictionStatus=void 0,(x=exports.RestrictionStatus||(exports.RestrictionStatus={})).WAITING="waiting",x.APPROVED="approved",x.REJECTED="rejected",exports.RestrictionBooleanStatus=void 0,(v=exports.RestrictionBooleanStatus||(exports.RestrictionBooleanStatus={})).TRUE="true",v.FALSE="false",exports.DivideMode=void 0,($=exports.DivideMode||(exports.DivideMode={})).User="to_user_id",$.Group="to_user_group_id",exports.RestrictionModeKey=void 0,(S=exports.RestrictionModeKey||(exports.RestrictionModeKey={})).Divide="divide",S.Share="share",exports.Tariff=void 0,(m=exports.Tariff||(exports.Tariff={})).Free="free",m.Business="business",m.Enterprise="enterprise",exports.LicenseError=void 0,(y=exports.LicenseError||(exports.LicenseError={})).NotActivated="License not activated",y.Blocked="License blocked",y.Expired="License has been expired",y.NotValid="License not valid",y.NotFound="license file not found",exports.LimitationType=void 0,(f=exports.LimitationType||(exports.LimitationType={})).BySize="size",f.ByExt="extension",f.ByQuota="quota_size",exports.LimitationSubType=void 0,(A=exports.LimitationSubType||(exports.LimitationSubType={})).Size="size",A.White="extension_white",A.Black="extension_black",exports.NotificationEntityType=void 0,(k=exports.NotificationEntityType||(exports.NotificationEntityType={})).Dir="dir",k.File="file",k.User="user",k.Other="other",k.WorkDir="work_dir",k.License="license",k.Extension="extension",k.Connection="connection",exports.NotificationAction=void 0,(w=exports.NotificationAction||(exports.NotificationAction={})).SecurityCheckNegative="action_security_check_negative",w.SecurityCheckPositive="action_security_check_positive",w.CommentVersionMention="action_version_comment_mention",w.OpenSharing="open_sharing",w.ChangeSharing="change_sharing",w.CancelSharing="cancel_sharing",w.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",w.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",w.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",w.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",w.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",w.CancelDivideDir="cancel_divide_dir",w.CancelDivideFile="cancel_divide_file",w.CancelDivideWorkDir="cancel_divide_work_dir",w.CancelDivideConnection="cancel_divide_connection",w.DeleteExtension="delete_extension",w.NewVersionExtension="new_version_extension",w.TransferData="transfer_data",w.AllowInternalAccessUser="allow_internal_access_to_user",w.BlockInternalAccessUser="block_internal_access_to_user",w.WaitInternalAccessUser="wait_internal_access_to_user",w.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",w.AllowInternalAccessGroup="allow_internal_access_to_group",w.BlockInternalAccessGroup="block_internal_access_to_group",w.WaitInternalAccessGroup="wait_internal_access_to_group",w.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",w.AllowSharing="allow_sharing",w.BlockSharing="block_sharing",w.WaitSharing="wait_sharing",w.WaitSharingCreate="wait_sharing_create",w.StatusCreateZipProcess="status_create_zip_process",w.StatusCreateZipSuccess="status_create_zip_success",w.StatusCreateZipError="status_create_zip_error",w.DownloadZipSuccess="download_zip_success",w.DownloadZipError="download_zip_error",w.StatusUnzipProcess="status_unzip_process",w.StatusUnzipSuccess="status_unzip_success",w.StatusUnzipError="status_unzip_error",w.StatusUnzipSuccessWithLimits="status_unzip_success_with_limits",w.AnonymZipDirAddFileToOwner="anonym_zip_dir_add_file_to_owner",w.GuestZipDirAddFileToOwner="guest_zip_dir_add_file_to_owner",w.DropDocumentOnlyoffice="drop_document_onlyoffice",w.CopyError="copy_error",w.CopySuccess="copy_success",w.StatusCopyProcess="status_copy_process",w.Other="other",exports.NotificationRowAction=void 0,(T=exports.NotificationRowAction||(exports.NotificationRowAction={})).Read="read",T.Unread="unread",T.Delete="delete",exports.NotificationStyle=void 0,(b=exports.NotificationStyle||(exports.NotificationStyle={})).Plain="plain",b.Success="success",b.Info="info",b.Warning="warning",b.Error="error",exports.ResponseType=void 0,(C=exports.ResponseType||(exports.ResponseType={})).ArrayBuffer="arraybuffer",C.Blob="blob",C.Json="json",C.Text="text",exports.RequestMethod=void 0,(R=exports.RequestMethod||(exports.RequestMethod={})).GET="GET",R.POST="POST",R.PUT="PUT",R.PATCH="PATCH",R.DELETE="DELETE",R.HEAD="HEAD",exports.RequestObserve=void 0,(E=exports.RequestObserve||(exports.RequestObserve={})).Body="body",E.Response="response",exports.RestrictionSharing=void 0,(D=exports.RestrictionSharing||(exports.RestrictionSharing={})).NONE="none",D.SOFT="soft",D.HARD="hard",exports.UserAuthType=void 0,(U=exports.UserAuthType||(exports.UserAuthType={})).Native="native",U.Ldap="ldap",U.Vk="vk",exports.UserStatus=void 0,(P=exports.UserStatus||(exports.UserStatus={})).Registering="registering",P.Activated="activated",P.BlockedByAdmin="blocked_by_admin",P.BlockedByLicense="blocked_by_license",P.BlockedByInactive="blocked_by_inactive",P.BlockedByInactiveChangePassword="blocked_by_inactive_change_password",exports.UserType=void 0,(O=exports.UserType||(exports.UserType={})).User="user",O.Guest="guest",O.Emperor="emperor",O.Anonymous="anonymous",exports.UserParamsLabel=void 0,(L=exports.UserParamsLabel||(exports.UserParamsLabel={})).Theme="theme",L.Lang="lang",L.Sort="sort",L.ViewApps="viewApps",L.WithoutContentWorkDir="withoutContentWorkDir",L.DashboardGrid="dashboardGrid",exports.UserAppType=void 0,(exports.UserAppType||(exports.UserAppType={})).Webdav="webdav",exports.SettingControlType=void 0,(N=exports.SettingControlType||(exports.SettingControlType={})).Text="text",N.String="string",N.Number="number",N.CheckBox="checkbox",N.Select="select",N.RadioList="radio_list",N.ConnectionChoose="connection_choose",N.MultiConnectionChoose="multi_connection_choose",exports.StorageElementType=void 0,(I=exports.StorageElementType||(exports.StorageElementType={})).Dir="dir",I.File="file",I.WorkDir="work_dir",I.App="app",exports.StorageElementContentType=void 0,(q=exports.StorageElementContentType||(exports.StorageElementContentType={})).Any="any",q.Dir="dir",q.Code="code",q.Image="image",q.Audio="audio",q.Video="video",q.Text="text",q.Doc="doc",q.Xls="xls",q.Ppt="ppt",exports.StorageRoot=void 0,(z=exports.StorageRoot||(exports.StorageRoot={})).my="my",z.fca="fca",z.divide="divide",z.share="share",z.favorite="favorite",z.trash="trash",exports.StorageElementHistoryAction=void 0,(j=exports.StorageElementHistoryAction||(exports.StorageElementHistoryAction={})).Create="create",j.Update="update",j.Move="move",exports.StorageElementCheckStatus=void 0,(M=exports.StorageElementCheckStatus||(exports.StorageElementCheckStatus={}))[M.CheckNull=0]="CheckNull",M[M.CheckInProgress=1]="CheckInProgress",M[M.CheckPositive=2]="CheckPositive",M[M.CheckNegative=3]="CheckNegative";const B="/connections",F=`${B}/dashboard`;class W{constructor(e){this.client=e}list(e){return this.client.rest.get(B,e)}get(e){return this.client.rest.get(`${B}/${e}`)}update(e,t){return this.client.rest.put(`${B}/${e}`,t)}delete(e){return this.client.rest.delete(`${B}/${e}`)}create(e){const t={[exports.ConnectionType.SSH]:"/disk/ssh",[exports.ConnectionType.Webdav]:"/disk/webdav",[exports.ConnectionType.Nextcloud]:"/disk/nextcloud",[exports.ConnectionType.NextBox]:"/disk/nextbox",[exports.ConnectionType.Discord]:"/webhooks/discord",[exports.ConnectionType.Mail]:"/webhooks/mail",[exports.ConnectionType.HttpProxy]:"/http_proxy",[exports.ConnectionType.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||B,e)}dashboard(e){return this.client.rest.get(F,e)}}class H{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const G="/divide",V=`${G}/restrictions`,Z=`${G}/tag_group`;class J{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${G}/${t}`)}divideDeleteAll(e,t,s,r){return this.client.rest.delete(`${e}${G}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:r,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${G}/${t}`,{access_mode:s})}divideCreate(e,t,s,r,i){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[i]:s,access_mode:r});return this.client.rest.post(`${e}${G}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}${G}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}divideTagGroupList(e){return this.client.rest.get(`${exports.DivideScope.Storage}${Z}`,e)}getRestriction(e){return this.client.rest.get(`${V}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${V}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${V}/${e}`,t)}makeParam(e,t){const s={};return e===exports.DivideScope.Connection?s.connection_id=t:s.path=t,s}}class K extends Error{}function Q(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function Y(e,t){if("string"!=typeof e)throw new K("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,r=e.split(".")[s];if("string"!=typeof r)throw new K(`Invalid token specified: missing part #${s+1}`);let i;try{i=Q(r)}catch(e){throw new K(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(i)}catch(e){throw new K(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}K.prototype.name="InvalidTokenError";const X=async(e,t)=>{let s=t;for(const t of e)try{s=await t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=await t.rejected(e)}return s};function ee(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const te=e=>{const t=new URLSearchParams;return Object.keys(e).forEach((s=>{Array.isArray(e[s])?e[s].forEach((e=>{t.append(s,e)})):t.append(s,e[s])})),t};function se(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function re(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ie="update black token";class ne{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}async refreshToken(e,t){const{access_token:s,refresh_token:r}=e;return s&&r?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,i)=>{const n=new XMLHttpRequest,o=`${t}${oe}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:r})),n.onload=()=>{if(n.status>=200&&n.status<300)try{const t=JSON.parse(n.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};ee("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){i(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{i(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}async waitForTokenUpdate(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}}const oe="/api/v1",ce="/api/v2";class ae{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(exports.RequestMethod.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(exports.RequestMethod.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(exports.RequestMethod.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(exports.RequestMethod.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(exports.RequestMethod.DELETE,e,Object.assign({params:t},s))}head(e,t,s){return this.request(exports.RequestMethod.HEAD,e,Object.assign({params:t},s))}upload(e,t,s){const r=new AbortController,i=r.signal;return{promise:this.request(exports.RequestMethod.POST,e,Object.assign({body:t,signal:i},s)),abort:()=>r.abort()}}request(e,t,s){return new Promise(((r,i)=>{var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);(null==s?void 0:s.signal)&&(c.signal=s.signal);(async()=>{var s,n,a,l;if(o||(c=null!==(s=await X(this.client.requestInterceptors,c))&&void 0!==s?s:c),this.state.authToken)for(const[e,s]of this.state.authToken.entries()){const r=Y(s.access_token);if(r&&r.is_remember&&this.tokenUpdate.isTokenExpire(r.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=await this.tokenUpdate.refreshToken(s,this.baseHost);t&&(this.state.authToken.set(e,t),c=null!==(n=await X(this.client.requestInterceptors,c))&&void 0!==n?n:c)}}const p=new XMLHttpRequest;c.params&&Object.keys(c.params).length&&(t+="?"+te(c.params));const d=null!==(a=c.host)&&void 0!==a?a:this.state.clientParams.host,u=`${d}${null!==(l=c.version)&&void 0!==l?l:this.state.clientParams.version}${t}`;if(p.open(e,u,!0),c.headers){const e=se(c.headers);for(const[t,s]of Object.entries(e))(d===this.baseHost||"content-type"!==t.toLowerCase())&&p.setRequestHeader(t,s)}c.responseType&&(p.responseType=c.responseType),c.signal&&c.signal.addEventListener("abort",(()=>{p.abort(),i(new Error("Request aborted"))})),!p.upload||e!==exports.RequestMethod.POST&&e!==exports.RequestMethod.PUT&&e!==exports.RequestMethod.PATCH||(p.upload.onprogress=e=>{e.lengthComputable&&c.onUploadProgress&&c.onUploadProgress(e)}),p.onload=async()=>{if(c.signal&&c.signal.aborted)return;let e;switch(c.responseType){case exports.ResponseType.Text:e=p.responseText;break;case exports.ResponseType.Blob:case exports.ResponseType.ArrayBuffer:e=p.response;break;default:try{e=JSON.parse(p.responseText)}catch(t){e=p.responseText}}const t=new Headers;p.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,r]=e.split(": ");s&&r&&t.append(s,r)}));const s={status:p.status,statusText:p.statusText,headers:t,url:p.responseURL};if(p.status>=200&&p.status<300)return await X(this.client.responseInterceptors,s),void(c.observe===exports.RequestObserve.Response?r(Object.assign(Object.assign({},s),{body:e})):r(e));if(this.state.authToken&&(null==e?void 0:e.code)===ie){const e=await this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}const n=Object.assign(Object.assign({},s),{error:e});await X(this.client.responseInterceptors,n),i(n)},p.onerror=()=>{i({status:p.status,statusText:p.statusText,url:p.responseURL,error:"Network error"})},p.send(re(c.body))})().catch(i)}))}}const le="/static/extensions",pe="/extensions/defaults",de=`${le}/names/users`,ue=`${le}/names/system`,he=`${le}/tags`;class ge{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${le}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${le}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${le}/${e}/settings`)}get(e){return this.client.rest.get(`${le}/${e}`)}getByKey(e){return this.client.rest.get(`${le}/${e}`)}getDefault(e=[]){return this.client.rest.get(pe,{ext_code:e})}setDefault(e,t){return this.client.rest.post(pe,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${le}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${le}/${e}`,{version:t})}list(e){return this.client.rest.get(le,e)}listTags(e){return this.client.rest.get(he,e)}delete(e,t){return this.client.rest.delete(`${le}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:r,abort:i}=this.client.rest.upload(le,s,{version:ce,onUploadProgress:t=>{e(t)}});return{promise:r,abort:i}}install(e,t){return this.client.rest.post(`${le}/site`,{uniq_key:e,version:t},{version:ce})}getSystemNameExts(e){return this.client.rest.get(ue,e)}getUserNameExts(e){return this.client.rest.get(de,e)}createUserNameExt(e){return this.client.rest.post(`${de}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${de}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${de}`)}}const _e="/anons_ext/extensions";class xe{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(_e,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${_e}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${_e}/${e.uniqKey}/readme`,{lang:e.lang},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const ve="/disk",$e=`${ve}/check`;class Se{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${ve}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${ve}/${e}`,t)}create(e,t){return this.client.rest.post(`${ve}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${ve}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${ve}/${e}/files?path=${t}`)}upload(e,t,s,r=""){const i=new FormData;i.set("path",r),i.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${ve}/${t}/files`,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${ve}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${ve}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post($e,e)}}const me="/settings";class ye{constructor(e){this.client=e}settings(){return this.client.rest.get(me)}changeSettings(e){return this.client.rest.post(me,e)}queryInit(){return this.client.rest.get("/query/init")}}var fe;exports.QueryInitViewType=void 0,(fe=exports.QueryInitViewType||(exports.QueryInitViewType={})).Standard="Standard",fe.Simple="Simple";const Ae="/groups";class ke{constructor(e){this.client=e}list(e){return this.client.rest.get(Ae,e)}get(e){return this.client.rest.get(`${Ae}/${e}`)}listUsers(e,t){return this.client.rest.get(`${Ae}/${e}/users`,t)}default(){return this.client.rest.get(`${Ae}/default`)}create(e){return this.client.rest.post(Ae,e)}update(e,t){return this.client.rest.put(`${Ae}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ae}/${e}`)}}const we="/license",Te=`${we}/manual-check`,be=`${we}/hardware/hash`;class Ce{constructor(e){this.client=e}info(){return this.client.rest.get(we)}create(e){return this.client.rest.post(we,e)}check(){return this.client.rest.post(Te)}delete(){return this.client.rest.delete(we)}getHash(){return this.client.rest.get(be)}}const Re="/links";class Ee{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Re,e)}updateShortLink(e){return this.client.rest.put(Re,e)}}const De="/limitations";class Ue{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(De,e)}listUsers(e,t){return this.client.rest.get(`${De}/${e}/users`,t)}create(e){return this.client.rest.post(De,e)}get(e){return this.client.rest.get(`${De}/${e}`)}update(e,t){return this.client.rest.put(`${De}/${e}`,t)}delete(e){return this.client.rest.delete(`${De}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${De}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${De}/${e}/user/${t}`)}}const Pe="/logs/users",Oe=`${Pe}/actions`;class Le{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${Pe}`,e)}getLogsActions(e){return this.client.rest.get(`${Oe}`,e)}}const Ne="/notifications",Ie=`${Ne}/all`,qe=`${Ne}/subscription`,ze=`${Ne}/permission`;class je{constructor(e){this.client=e}list(e){return this.client.rest.get(Ne,e)}toggleStatus(e,t){return this.client.rest.put(Ne,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ie,{to_status:e})}delete(e){return this.client.rest.delete(Ne,{id:e})}deleteAll(){return this.client.rest.delete(Ie)}getPermission(){return this.client.rest.get(ze)}setPermission(e){return this.client.rest.post(ze,{enabled:e})}getSubscription(){return this.client.rest.get(qe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(qe,t)}}const Me="/roles",Be=`${Me}/default`,Fe="/permissions";class We{constructor(e){this.client=e}list(e){return this.client.rest.get(Me,e)}get(e){return this.client.rest.get(`${Me}/${e}`)}getDefault(){return this.client.rest.get(`${Be}`)}create(e){return this.client.rest.post(Me,e)}update(e,t){return this.client.rest.put(`${Me}/${e}`,t)}delete(e){return this.client.rest.delete(`${Me}/${e}`)}permissionList(){return this.client.rest.get(Fe)}addPermission(e,t){return this.client.rest.put(`${Me}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${Me}/${e}/${Fe}`,{ids:t})}}const He="/share",Ge=`${He}/restrictions`,Ve=`${He}/login`;class Ze{constructor(e){this.client=e}info(e){return this.client.rest.get(`${He}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${He}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Ge}/${e}`)}restrictions(e){return this.client.rest.get(Ge,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ge}/${e}`,t)}login(e){return this.client.rest.post(`${Ve}`,e)}}const Je="/storage/element/version/comment",Ke=`${Je}/all`;class Qe{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Je}`,e)}create(e){return this.client.rest.post(`${Je}`,e)}update(e){return this.client.rest.put(`${Je}`,e)}delete(e){return this.client.rest.delete(`${Je}`,e)}deleteAll(e){return this.client.rest.delete(`${Ke}`,e)}}const Ye="/storage",Xe=`${Ye}/element`,et=`${Xe}/divide`,tt=`${et}/resource`,st=`${Xe}/move`,rt=`${Xe}/copy`,it=`${Xe}/content_type_size`,nt="/disk";class ot{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(Ye,e)}info(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,e.file_version_id||delete e.file_version_id,e.zip_entry_path||delete e.zip_entry_path,this.client.rest.get(Xe,e)}fileInfo(e,t){return this.client.rest.get(`${Xe}/${e}`,t?{file_version_id:t}:{})}combineInfo({root:e,rootId:t,path:s,file_version_id:r,zip_entry_path:i}){return e===exports.StorageRoot.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:r,zip_entry_path:i})}size(e){return this.client.rest.post(`${Xe}/size`,e)}move(e,t,s){const{from_divide_id:r,to_divide_id:i}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===exports.StorageRoot.fca&&s===exports.StorageRoot.fca?this.client.rest.post(`${nt}/${r}/files/move${nt}/${i}`,n):t===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.put(`${nt}/${i}/files/from/box`,n)):s===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.put(`${nt}/${r}/files/to/box`,n)):this.client.rest.post(st,e)}copy(e,t,s){const{from_divide_id:r,to_divide_id:i}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===exports.StorageRoot.fca&&t===exports.StorageRoot.fca?this.client.rest.post(`${nt}/${r}/files/copy${nt}/${i}`,n):s===exports.StorageRoot.fca?(r&&(n.from_divide_id=r),this.client.rest.post(`${nt}/${i}/files/from/box`,n)):t===exports.StorageRoot.fca?(i&&(n.to_divide_id=i),this.client.rest.post(`${nt}/${r}/files/to/box`,n)):this.client.rest.post(rt,e)}pasteFromShared(e,t,s){const r={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${Xe}/copy`,r)}create(e){return this.client.rest.post(Xe,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(Xe,s)}favorite(e){return this.client.rest.put(`${Xe}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${Xe}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(Xe,e)}createWorkDir(e){return this.client.rest.post(Xe,e)}sizeWithSection(e){return this.client.rest.get(it,e)}getDivideResources(e){return this.client.rest.get(tt,e)}getQuota(e){return this.client.rest.get(`${Xe}/user_size`,e)}hide(e){return this.client.rest.post(`${et}/hide`,e)}unhide(e){return this.client.rest.post(`${et}/unhide`,e)}}const ct="/storage/files",at=`${ct}/net`,lt=`${ct}/unzip`,pt=`${ct}/zip`,dt=`${pt}/download`,ut=`${ct}/process`,ht=`${ct}/code`;class gt{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(ct,t)}replace(e,t){const s=new URLSearchParams;return Object.keys(e).forEach((t=>{e[t]&&s.append(t,e[t])})),this.client.rest.put(`${ct}?${s.toString()}`,t)}upload(e,t,s,r){const i=new FormData;i.set("path",s),r&&i.set("divide_id",r.toString()),i.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(ct,i,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(at,e)}createZipToDownload(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(dt,e)}createZip(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(pt,e)}cancelProcess(e){return this.client.rest.delete(ut,e)}unZip(e){return this.client.rest.post(lt,e)}checkZip(e){return this.client.rest.head(ht,e)}}class _t{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const xt="/storage/element/share";class vt{constructor(e){this.client=e}info(e){return this.client.rest.get(xt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(xt,s)}change(e){return this.client.rest.put(`${xt}/${e.token}`,e)}delete(e){return this.client.rest.delete(xt,{path:e})}refresh(e){return this.client.rest.put(`${xt}/${e}/refresh`)}}const $t="/storage/trash/element",St=`${$t}/all`;class mt{constructor(e){this.client=e}clear(e){return this.client.rest.delete($t,e)}clearAll(){return this.client.rest.delete(St)}restore(e){return this.client.rest.patch($t,{del_groups:e})}restoreAll(){return this.client.rest.patch(St)}}const yt="/users",ft=`${yt}/me`,At=`${ft}/avatars`,kt=`${ft}/sessions`,wt=`${ft}/tokens`,Tt=`${ft}/params`,bt=`${ft}/app-passwords`,Ct=`${ft}/change-password`,Rt=`${yt}/initial`,Et=`${ft}/phone`,Dt=`${Et}/confirm`;class Ut{constructor(e){this.client=e}initial(e){return this.client.rest.post(Rt,e)}list(e){return this.client.rest.get(yt,e)}get(e){return this.client.rest.get(yt+`/${e}`)}create(e){return this.client.rest.post(yt,e)}update(e,t){return this.client.rest.put(yt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${yt}/${e}`,t)}restore(e){return this.client.rest.post(`${yt}/${e}/restore`)}me(){return this.client.rest.get(ft)}updateMe(e){return this.client.rest.put(ft,e)}createToken(e){return this.client.rest.post(wt,e)}listToken(e){return this.client.rest.get(wt,e)}deleteToken(e){return this.client.rest.delete(`${wt}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ct,e)}changeUsersPassword(e,t){return this.client.rest.put(`${yt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(At,s)}meDeleteAvatar(){return this.client.rest.delete(At)}meListSession(e){return this.client.rest.get(kt,e)}meDeleteSession(e){let t=kt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${yt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(Tt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${Tt}/${e}`,t)}meListParams(){return this.client.rest.get(Tt)}phone(e){return this.client.rest.post(Et,e)}phoneConfirm(e){return this.client.rest.post(`${Dt}/${e}`)}appPasswordsList(e){return this.client.rest.get(bt,e)}createAppPasswords(e){return this.client.rest.post(bt,e)}deleteAppPasswords(e){return this.client.rest.delete(`${bt}/${e}`)}}const Pt="/users/appeals",Ot=`${Pt}/category`,Lt=`${Pt}/subcategory`,Nt=`${Pt}/file`;class It{constructor(e){this.client=e}category(){return this.client.rest.get(Ot)}subcategory(e){return this.client.rest.get(Lt,{category_code:e})}uploadFile(e){const t=new FormData;return t.append("file",e),this.client.rest.post(Nt,t)}deleteFile(e){return this.client.rest.delete(`${Nt}/${e}`)}createAppeal(e){return this.client.rest.post(Pt,e)}}const qt="/storage/element",zt=`${qt}/history`,jt=`${qt}/version`,Mt=`${jt}/lock`,Bt=`${jt}/unlock`,Ft=`${jt}/current`,Wt=`${jt}/size`;class Ht{constructor(e){this.client=e}history(e){return this.client.rest.get(zt,e)}versions(e){return this.client.rest.get(jt,e)}create(e){return this.client.rest.post(jt,e)}edit(e){return this.client.rest.put(jt,e)}delete(e){return this.client.rest.delete(jt,e)}size(e){return this.client.rest.get(Wt,e)}makeCurrent(e){return this.client.rest.post(Ft,e)}lock(e){return this.client.rest.post(Mt,e)}unlock(e){return this.client.rest.post(Bt,e)}}const Gt="/version",Vt=`${Gt}/changelog`;class Zt{constructor(e){this.client=e}getVersions(e){return this.client.rest.get(Gt,e)}getChangelog(e){return this.client.rest.get(Vt,{version_number:e})}}const Jt="/tag",Kt=`${Jt}/list`;class Qt{constructor(e){this.client=e}list(e){return this.client.rest.get(Kt,e)}get(e){return this.client.rest.get(`${Jt}/${e}`)}assign(e,t){return this.client.rest.post(`${Jt}/${e}/assign`,{items:t})}unassign(e,t){return this.client.rest.post(`${Jt}/${e}/unassign`,{items:t})}create(e){return this.client.rest.post(Jt,e)}update(e,t){return this.client.rest.put(`${Jt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Jt}/${e}`)}}const Yt="/spaces",Xt=`${Yt}/access`;class es{constructor(e){this.client=e}space(e){return this.client.rest.get(`${Yt}/${e}`)}list(e){return this.client.rest.get(Yt,e)}create(e){return this.client.rest.post(Yt,e)}update(e,t){return this.client.rest.put(`${Yt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Yt}/${e}`)}adminsList(e,t){return this.client.rest.get(`${Yt}/${e}`,t)}accessList(e){return this.client.rest.get(Xt,e)}provideAccess(e){return this.client.rest.post(Xt,e)}deleteAllAccess(e){return this.client.rest.delete(Xt,e)}updateAccess(e,t){return this.client.rest.put(`${Xt}/${e}`,t)}deleteAccess(e,t){return this.client.rest.delete(`${Xt}/${e}`,{space_id:t})}}exports.AuthApiService=i,exports.BASE_URL_V1=oe,exports.BASE_URL_V2=ce,exports.CONNECTIONS_PERMISSION=o,exports.Client=class{constructor(e){this.AuthApiService=new i(this),this.ConnectionsApiService=new W(this),this.DiscoveryApiService=new H(this),this.DivideApiService=new J(this),this.ExtensionsApiService=new ge(this),this.ExtensionsExternalApiService=new xe(this),this.FcaApiService=new Se(this),this.GatewayApiService=new ye(this),this.GroupApiService=new ke(this),this.LicenseApiService=new Ce(this),this.LinksApiService=new Ee(this),this.LimitationsApiService=new Ue(this),this.LogstashApiService=new Le(this),this.NotificationApiService=new je(this),this.RoleApiService=new We(this),this.ShareApiService=new Ze(this),this.StorageCommentApiService=new Qe(this),this.StorageElementApiService=new ot(this,this.FcaApiService),this.StorageFilesApiService=new gt(this),this.TagsApiService=new Qt(this),this.StorageInstanceApiService=new _t(this),this.StorageShareApiService=new vt(this),this.StorageTrashApiService=new mt(this),this.UserApiService=new Ut(this),this.UsersAppealsApiService=new It(this),this.VersionApiService=new Ht(this),this.PlatformVersionApiService=new Zt(this),this.SpaceApiService=new es(this),this.tokenUpdate=new ne,this.rest=new ae(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(e,t)=>{this.requestInterceptors.push({fulfilled:e,rejected:t})}},this.response={use:(e,t)=>{this.responseInterceptors.push({fulfilled:e,rejected:t})}},this.state={clientParams:{host:null==e?void 0:e.host,version:(null==e?void 0:e.version)||oe},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}},exports.ConnectionsApiService=W,exports.DiscoveryApiService=H,exports.DivideApiService=J,exports.ExtensionsApiService=ge,exports.ExtensionsExternalApiService=xe,exports.FcaApiService=Se,exports.GatewayApiService=ye,exports.GroupApiService=ke,exports.LicenseApiService=Ce,exports.LimitationsApiService=Ue,exports.LinksApiService=Ee,exports.LogstashApiService=Le,exports.NEED_TOKEN_UPDATE_ERROR=ie,exports.NotificationApiService=je,exports.PlatformVersionApiService=Zt,exports.Rest=ae,exports.RoleApiService=We,exports.ShareApiService=Ze,exports.SpaceApiService=es,exports.StorageCommentApiService=Qe,exports.StorageElementApiService=ot,exports.StorageFilesApiService=gt,exports.StorageInstanceApiService=_t,exports.StorageShareApiService=vt,exports.StorageTrashApiService=mt,exports.TagsApiService=Qt,exports.TokenUpdate=ne,exports.UserApiService=Ut,exports.UsersAppealsApiService=It,exports.VersionApiService=Ht,exports.applyInterceptors=X,exports.getCookieValue=ee,exports.makeUrlParams=te,exports.normalizeHeaders=se,exports.prepareRequestBody=re;
@@ -1 +1 @@
1
- const e="/login",t=`${e}/ldap`,s=`${e}/update`,i=`${e}/tfa`;class r{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}loginTfa(e){return this.client.rest.post(i,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var n;!function(e){e.LicenseRead="license_read",e.LicenseManage="license_edit",e.UsersRead="users_read",e.UsersCreate="users_create",e.UsersActivate="users_activate",e.GroupsRead="groups_read",e.GroupsCreate="groups_create",e.RolesRead="roles_read",e.RolesCreate="roles_create",e.Share="share",e.Divide="divide",e.ExtensionsRead="extensions_read",e.ExtensionsManage="extensions_write",e.RestrictionShareRead="restriction_share_read",e.RestrictionShareWrite="restriction_share_write",e.RestrictionDivideRead="restriction_divide_read",e.RestrictionDivideWrite="restriction_divide_write",e.LimitationsRead="limitations_read",e.LimitationsEdit="limitations_edit",e.ReadUserLogs="read_user_logs",e.ConnectionsRead="connections_read",e.ConnectionsDividing="connections_dividing",e.ConnectionsYandexDisk="connections_yandex_disk",e.ConnectionsSsh="connections_ssh",e.ConnectionsMail="connections_mail",e.ConnectionsS3="connections_s3",e.ConnectionsDiscord="connections_discord",e.ConnectionsWebdav="connections_webdav",e.ConnectionsNextcloud="connections_nextcloud",e.ConnectionsNextbox="connections_nextbox",e.ConnectionsHttpProxy="connections_http_proxy",e.SystemInfoServiceList="system_info_service_list",e.SettingsRead="settings_read",e.SettingsWrite="settings_write",e.DemoAdmin="demo_admin"}(n||(n={}));const o=[n.ConnectionsYandexDisk,n.ConnectionsSsh,n.ConnectionsMail,n.ConnectionsS3,n.ConnectionsS3,n.ConnectionsDiscord,n.ConnectionsWebdav,n.ConnectionsNextcloud,n.ConnectionsNextbox,n.ConnectionsHttpProxy];var c,a,l,u,h,d,p,g,_,$,f,m,v,w,k,S,b,y,A,x,C,D,T,U,P,E,O,R,I,L,j,z,N,W,F,B,H;!function(e){e.DEFAULT="",e.ASC="asc",e.DESC="desc"}(c||(c={})),function(e){e.WebSocket="websocket",e.PostMessage="postmessage",e.Empty=""}(a||(a={})),function(e){e.Yellow="yellow",e.Success="success",e.Critical="critical",e.Warning="warning",e.Brand="brand",e.Purple="purple",e.Primary="primary",e.Gray="gray"}(l||(l={})),function(e){e.Storages="storages_connections_group",e.Webhooks="webhooks_connections_group",e.Unknown="unknown_connections_group",e.Proxy="proxy_connections_group"}(u||(u={})),function(e){e.SSH="ssh_connection",e.YandexDisk="yandex_disk",e.Mail="mail",e.Discord="discord",e.Webdav="webdav_connection",e.Nextcloud="nextcloud_connection",e.NextBox="nextbox_connection",e.HttpProxy="http_proxy_connection",e.S3="s3_connection"}(h||(h={})),function(e){e.App="app",e.File="file",e.WorkDir="work_dir"}(d||(d={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(p||(p={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(g||(g={})),function(e){e.Close="",e.Read="r",e.Write="rw",e.Full="full",e.Admin="admin"}(_||(_={})),function(e){e.WAITING="waiting",e.APPROVED="approved",e.REJECTED="rejected"}($||($={})),function(e){e.TRUE="true",e.FALSE="false"}(f||(f={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}(m||(m={})),function(e){e.Divide="divide",e.Share="share"}(v||(v={})),function(e){e.Free="free",e.Business="business",e.Enterprise="enterprise"}(w||(w={})),function(e){e.NotActivated="License not activated",e.Blocked="License blocked",e.Expired="License has been expired",e.NotValid="License not valid",e.NotFound="license file not found"}(k||(k={})),function(e){e.BySize="size",e.ByExt="extension",e.ByQuota="quota_size"}(S||(S={})),function(e){e.Size="size",e.White="extension_white",e.Black="extension_black"}(b||(b={})),function(e){e.Dir="dir",e.File="file",e.User="user",e.Other="other",e.WorkDir="work_dir",e.License="license",e.Extension="extension",e.Connection="connection"}(y||(y={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",e.CommentVersionMention="action_version_comment_mention",e.OpenSharing="open_sharing",e.ChangeSharing="change_sharing",e.CancelSharing="cancel_sharing",e.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",e.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",e.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",e.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",e.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",e.CancelDivideDir="cancel_divide_dir",e.CancelDivideFile="cancel_divide_file",e.CancelDivideWorkDir="cancel_divide_work_dir",e.CancelDivideConnection="cancel_divide_connection",e.DeleteExtension="delete_extension",e.NewVersionExtension="new_version_extension",e.TransferData="transfer_data",e.AllowInternalAccessUser="allow_internal_access_to_user",e.BlockInternalAccessUser="block_internal_access_to_user",e.WaitInternalAccessUser="wait_internal_access_to_user",e.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",e.AllowInternalAccessGroup="allow_internal_access_to_group",e.BlockInternalAccessGroup="block_internal_access_to_group",e.WaitInternalAccessGroup="wait_internal_access_to_group",e.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",e.AllowSharing="allow_sharing",e.BlockSharing="block_sharing",e.WaitSharing="wait_sharing",e.WaitSharingCreate="wait_sharing_create",e.StatusCreateZipProcess="status_create_zip_process",e.StatusCreateZipSuccess="status_create_zip_success",e.StatusCreateZipError="status_create_zip_error",e.DownloadZipSuccess="download_zip_success",e.DownloadZipError="download_zip_error",e.StatusUnzipProcess="status_unzip_process",e.StatusUnzipSuccess="status_unzip_success",e.StatusUnzipError="status_unzip_error",e.StatusUnzipSuccessWithLimits="status_unzip_success_with_limits",e.AnonymZipDirAddFileToOwner="anonym_zip_dir_add_file_to_owner",e.GuestZipDirAddFileToOwner="guest_zip_dir_add_file_to_owner",e.DropDocumentOnlyoffice="drop_document_onlyoffice",e.CopyError="copy_error",e.CopySuccess="copy_success",e.StatusCopyProcess="status_copy_process",e.Other="other"}(A||(A={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(x||(x={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(C||(C={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(D||(D={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e.HEAD="HEAD"}(T||(T={})),function(e){e.Body="body",e.Response="response"}(U||(U={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(P||(P={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(E||(E={})),function(e){e.Registering="registering",e.Activated="activated",e.BlockedByAdmin="blocked_by_admin",e.BlockedByLicense="blocked_by_license",e.BlockedByInactive="blocked_by_inactive",e.BlockedByInactiveChangePassword="blocked_by_inactive_change_password"}(O||(O={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(R||(R={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort",e.ViewApps="viewApps",e.WithoutContentWorkDir="withoutContentWorkDir",e.DashboardGrid="dashboardGrid"}(I||(I={})),function(e){e.Webdav="webdav"}(L||(L={})),function(e){e.Text="text",e.String="string",e.Number="number",e.CheckBox="checkbox",e.Select="select",e.RadioList="radio_list",e.ConnectionChoose="connection_choose",e.MultiConnectionChoose="multi_connection_choose"}(j||(j={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir",e.App="app"}(z||(z={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(N||(N={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(W||(W={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(F||(F={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(B||(B={})),function(e){e.Read="r",e.Write="rw",e.Full="rwd",e.SpaceManage="space_manage"}(H||(H={}));const q="/connections",G=`${q}/dashboard`;class M{constructor(e){this.client=e}list(e){return this.client.rest.get(q,e)}get(e){return this.client.rest.get(`${q}/${e}`)}update(e,t){return this.client.rest.put(`${q}/${e}`,t)}delete(e){return this.client.rest.delete(`${q}/${e}`)}create(e){const t={[h.SSH]:"/disk/ssh",[h.Webdav]:"/disk/webdav",[h.Nextcloud]:"/disk/nextcloud",[h.NextBox]:"/disk/nextbox",[h.Discord]:"/webhooks/discord",[h.Mail]:"/webhooks/mail",[h.HttpProxy]:"/http_proxy",[h.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||q,e)}dashboard(e){return this.client.rest.get(G,e)}}class V{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const Z="/divide",J=`${Z}/restrictions`,Y=`${Z}/tag_group`;class X{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${Z}/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}${Z}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:i,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${Z}/${t}`,{access_mode:s})}divideCreate(e,t,s,i,r){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[r]:s,access_mode:i});return this.client.rest.post(`${e}${Z}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}${Z}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}divideTagGroupList(e){return this.client.rest.get(`${g.Storage}${Y}`,e)}getRestriction(e){return this.client.rest.get(`${J}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${J}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${J}/${e}`,t)}makeParam(e,t){const s={};return e===g.Connection?s.connection_id=t:s.path=t,s}}class K extends Error{}function Q(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function ee(e,t){if("string"!=typeof e)throw new K("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,i=e.split(".")[s];if("string"!=typeof i)throw new K(`Invalid token specified: missing part #${s+1}`);let r;try{r=Q(i)}catch(e){throw new K(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new K(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}K.prototype.name="InvalidTokenError";const te=async(e,t)=>{let s=t;for(const t of e)try{s=await t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=await t.rejected(e)}return s};function se(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const ie=e=>{const t=new URLSearchParams;return Object.keys(e).forEach((s=>{Array.isArray(e[s])?e[s].forEach((e=>{t.append(s,e)})):t.append(s,e[s])})),t};function re(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function ne(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const oe="update black token";class ce{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}async refreshToken(e,t){const{access_token:s,refresh_token:i}=e;return s&&i?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,r)=>{const n=new XMLHttpRequest,o=`${t}${ae}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:i})),n.onload=()=>{if(n.status>=200&&n.status<300)try{const t=JSON.parse(n.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};se("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){r(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{r(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}async waitForTokenUpdate(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}}const ae="/api/v1",le="/api/v2";class ue{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(T.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(T.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(T.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(T.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(T.DELETE,e,Object.assign({params:t},s))}head(e,t,s){return this.request(T.HEAD,e,Object.assign({params:t},s))}upload(e,t,s){const i=new AbortController,r=i.signal;return{promise:this.request(T.POST,e,Object.assign({body:t,signal:r},s)),abort:()=>i.abort()}}request(e,t,s){return new Promise(((i,r)=>{var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);(null==s?void 0:s.signal)&&(c.signal=s.signal);(async()=>{var s,n,a,l;if(o||(c=null!==(s=await te(this.client.requestInterceptors,c))&&void 0!==s?s:c),this.state.authToken)for(const[e,s]of this.state.authToken.entries()){const i=ee(s.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=await this.tokenUpdate.refreshToken(s,this.baseHost);t&&(this.state.authToken.set(e,t),c=null!==(n=await te(this.client.requestInterceptors,c))&&void 0!==n?n:c)}}const u=new XMLHttpRequest;c.params&&Object.keys(c.params).length&&(t+="?"+ie(c.params));const h=null!==(a=c.host)&&void 0!==a?a:this.state.clientParams.host,d=`${h}${null!==(l=c.version)&&void 0!==l?l:this.state.clientParams.version}${t}`;if(u.open(e,d,!0),c.headers){const e=re(c.headers);for(const[t,s]of Object.entries(e))(h===this.baseHost||"content-type"!==t.toLowerCase())&&u.setRequestHeader(t,s)}c.responseType&&(u.responseType=c.responseType),c.signal&&c.signal.addEventListener("abort",(()=>{u.abort(),r(new Error("Request aborted"))})),!u.upload||e!==T.POST&&e!==T.PUT&&e!==T.PATCH||(u.upload.onprogress=e=>{e.lengthComputable&&c.onUploadProgress&&c.onUploadProgress(e)}),u.onload=async()=>{if(c.signal&&c.signal.aborted)return;let e;switch(c.responseType){case D.Text:e=u.responseText;break;case D.Blob:case D.ArrayBuffer:e=u.response;break;default:try{e=JSON.parse(u.responseText)}catch(t){e=u.responseText}}const t=new Headers;u.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,i]=e.split(": ");s&&i&&t.append(s,i)}));const s={status:u.status,statusText:u.statusText,headers:t,url:u.responseURL};if(u.status>=200&&u.status<300)return await te(this.client.responseInterceptors,s),void(c.observe===U.Response?i(Object.assign(Object.assign({},s),{body:e})):i(e));if(this.state.authToken&&(null==e?void 0:e.code)===oe){const e=await this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}const n=Object.assign(Object.assign({},s),{error:e});await te(this.client.responseInterceptors,n),r(n)},u.onerror=()=>{r({status:u.status,statusText:u.statusText,url:u.responseURL,error:"Network error"})},u.send(ne(c.body))})().catch(r)}))}}class he{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new M(this),this.DiscoveryApiService=new V(this),this.DivideApiService=new X(this),this.ExtensionsApiService=new fe(this),this.ExtensionsExternalApiService=new ve(this),this.FcaApiService=new Se(this),this.GatewayApiService=new ye(this),this.GroupApiService=new Ce(this),this.LicenseApiService=new Pe(this),this.LinksApiService=new Oe(this),this.LimitationsApiService=new Ie(this),this.LogstashApiService=new ze(this),this.NotificationApiService=new He(this),this.RoleApiService=new Ve(this),this.ShareApiService=new Xe(this),this.StorageCommentApiService=new et(this),this.StorageElementApiService=new lt(this,this.FcaApiService),this.StorageFilesApiService=new ft(this),this.TagsApiService=new es(this),this.StorageInstanceApiService=new mt(this),this.StorageShareApiService=new wt(this),this.StorageTrashApiService=new bt(this),this.UserApiService=new It(this),this.UsersAppealsApiService=new Wt(this),this.VersionApiService=new Zt(this),this.PlatformVersionApiService=new Xt(this),this.SpaceApiService=new ss(this),this.tokenUpdate=new ce,this.rest=new ue(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(e,t)=>{this.requestInterceptors.push({fulfilled:e,rejected:t})}},this.response={use:(e,t)=>{this.responseInterceptors.push({fulfilled:e,rejected:t})}},this.state={clientParams:{host:null==e?void 0:e.host,version:(null==e?void 0:e.version)||ae},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const de="/static/extensions",pe="/extensions/defaults",ge=`${de}/names/users`,_e=`${de}/names/system`,$e=`${de}/tags`;class fe{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${de}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${de}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${de}/${e}/settings`)}get(e){return this.client.rest.get(`${de}/${e}`)}getByKey(e){return this.client.rest.get(`${de}/${e}`)}getDefault(e=[]){return this.client.rest.get(pe,{ext_code:e})}setDefault(e,t){return this.client.rest.post(pe,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${de}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${de}/${e}`,{version:t})}list(e){return this.client.rest.get(de,e)}listTags(e){return this.client.rest.get($e,e)}delete(e,t){return this.client.rest.delete(`${de}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:i,abort:r}=this.client.rest.upload(de,s,{version:le,onUploadProgress:t=>{e(t)}});return{promise:i,abort:r}}install(e,t){return this.client.rest.post(`${de}/site`,{uniq_key:e,version:t},{version:le})}getSystemNameExts(e){return this.client.rest.get(_e,e)}getUserNameExts(e){return this.client.rest.get(ge,e)}createUserNameExt(e){return this.client.rest.post(`${ge}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${ge}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${ge}`)}}const me="/anons_ext/extensions";class ve{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(me,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${me}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${me}/${e.uniqKey}/readme`,{lang:e.lang},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const we="/disk",ke=`${we}/check`;class Se{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${we}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${we}/${e}`,t)}create(e,t){return this.client.rest.post(`${we}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${we}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${we}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const r=new FormData;r.set("path",i),r.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${we}/${t}/files`,r,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${we}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${we}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ke,e)}}const be="/settings";class ye{constructor(e){this.client=e}settings(){return this.client.rest.get(be)}changeSettings(e){return this.client.rest.post(be,e)}queryInit(){return this.client.rest.get("/query/init")}}var Ae;!function(e){e.Standard="Standard",e.Simple="Simple"}(Ae||(Ae={}));const xe="/groups";class Ce{constructor(e){this.client=e}list(e){return this.client.rest.get(xe,e)}get(e){return this.client.rest.get(`${xe}/${e}`)}listUsers(e,t){return this.client.rest.get(`${xe}/${e}/users`,t)}default(){return this.client.rest.get(`${xe}/default`)}create(e){return this.client.rest.post(xe,e)}update(e,t){return this.client.rest.put(`${xe}/${e}`,t)}delete(e){return this.client.rest.delete(`${xe}/${e}`)}}const De="/license",Te=`${De}/manual-check`,Ue=`${De}/hardware/hash`;class Pe{constructor(e){this.client=e}info(){return this.client.rest.get(De)}create(e){return this.client.rest.post(De,e)}check(){return this.client.rest.post(Te)}delete(){return this.client.rest.delete(De)}getHash(){return this.client.rest.get(Ue)}}const Ee="/links";class Oe{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Ee,e)}updateShortLink(e){return this.client.rest.put(Ee,e)}}const Re="/limitations";class Ie{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Re,e)}listUsers(e,t){return this.client.rest.get(`${Re}/${e}/users`,t)}create(e){return this.client.rest.post(Re,e)}get(e){return this.client.rest.get(`${Re}/${e}`)}update(e,t){return this.client.rest.put(`${Re}/${e}`,t)}delete(e){return this.client.rest.delete(`${Re}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Re}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Re}/${e}/user/${t}`)}}const Le="/logs/users",je=`${Le}/actions`;class ze{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${Le}`,e)}getLogsActions(e){return this.client.rest.get(`${je}`,e)}}const Ne="/notifications",We=`${Ne}/all`,Fe=`${Ne}/subscription`,Be=`${Ne}/permission`;class He{constructor(e){this.client=e}list(e){return this.client.rest.get(Ne,e)}toggleStatus(e,t){return this.client.rest.put(Ne,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(We,{to_status:e})}delete(e){return this.client.rest.delete(Ne,{id:e})}deleteAll(){return this.client.rest.delete(We)}getPermission(){return this.client.rest.get(Be)}setPermission(e){return this.client.rest.post(Be,{enabled:e})}getSubscription(){return this.client.rest.get(Fe)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(Fe,t)}}const qe="/roles",Ge=`${qe}/default`,Me="/permissions";class Ve{constructor(e){this.client=e}list(e){return this.client.rest.get(qe,e)}get(e){return this.client.rest.get(`${qe}/${e}`)}getDefault(){return this.client.rest.get(`${Ge}`)}create(e){return this.client.rest.post(qe,e)}update(e,t){return this.client.rest.put(`${qe}/${e}`,t)}delete(e){return this.client.rest.delete(`${qe}/${e}`)}permissionList(){return this.client.rest.get(Me)}addPermission(e,t){return this.client.rest.put(`${qe}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${qe}/${e}/${Me}`,{ids:t})}}const Ze="/share",Je=`${Ze}/restrictions`,Ye=`${Ze}/login`;class Xe{constructor(e){this.client=e}info(e){return this.client.rest.get(`${Ze}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Ze}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Je}/${e}`)}restrictions(e){return this.client.rest.get(Je,e)}restrictionsChange(e,t){return this.client.rest.put(`${Je}/${e}`,t)}login(e){return this.client.rest.post(`${Ye}`,e)}}const Ke="/storage/element/version/comment",Qe=`${Ke}/all`;class et{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Ke}`,e)}create(e){return this.client.rest.post(`${Ke}`,e)}update(e){return this.client.rest.put(`${Ke}`,e)}delete(e){return this.client.rest.delete(`${Ke}`,e)}deleteAll(e){return this.client.rest.delete(`${Qe}`,e)}}const tt="/storage",st=`${tt}/element`,it=`${st}/divide`,rt=`${it}/resource`,nt=`${st}/move`,ot=`${st}/copy`,ct=`${st}/content_type_size`,at="/disk";class lt{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(tt,e)}info(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,e.file_version_id||delete e.file_version_id,e.zip_entry_path||delete e.zip_entry_path,this.client.rest.get(st,e)}fileInfo(e,t){return this.client.rest.get(`${st}/${e}`,t?{file_version_id:t}:{})}combineInfo({root:e,rootId:t,path:s,file_version_id:i,zip_entry_path:r}){return e===W.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:i,zip_entry_path:r})}size(e){return this.client.rest.post(`${st}/size`,e)}move(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===W.fca&&s===W.fca?this.client.rest.post(`${at}/${i}/files/move${at}/${r}`,n):t===W.fca?(i&&(n.from_divide_id=i),this.client.rest.put(`${at}/${r}/files/from/box`,n)):s===W.fca?(r&&(n.to_divide_id=r),this.client.rest.put(`${at}/${i}/files/to/box`,n)):this.client.rest.post(nt,e)}copy(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===W.fca&&t===W.fca?this.client.rest.post(`${at}/${i}/files/copy${at}/${r}`,n):s===W.fca?(i&&(n.from_divide_id=i),this.client.rest.post(`${at}/${r}/files/from/box`,n)):t===W.fca?(r&&(n.to_divide_id=r),this.client.rest.post(`${at}/${i}/files/to/box`,n)):this.client.rest.post(ot,e)}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${st}/copy`,i)}create(e){return this.client.rest.post(st,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(st,s)}favorite(e){return this.client.rest.put(`${st}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${st}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(st,e)}createWorkDir(e){return this.client.rest.post(st,e)}sizeWithSection(e){return this.client.rest.get(ct,e)}getDivideResources(e){return this.client.rest.get(rt,e)}getQuota(e){return this.client.rest.get(`${st}/user_size`,e)}hide(e){return this.client.rest.post(`${it}/hide`,e)}unhide(e){return this.client.rest.post(`${it}/unhide`,e)}}const ut="/storage/files",ht=`${ut}/net`,dt=`${ut}/unzip`,pt=`${ut}/zip`,gt=`${pt}/download`,_t=`${ut}/process`,$t=`${ut}/code`;class ft{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(ut,t)}replace(e,t){const s=new URLSearchParams;return Object.keys(e).forEach((t=>{e[t]&&s.append(t,e[t])})),this.client.rest.put(`${ut}?${s.toString()}`,t)}upload(e,t,s,i){const r=new FormData;r.set("path",s),i&&r.set("divide_id",i.toString()),r.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(ut,r,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(ht,e)}createZipToDownload(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(gt,e)}createZip(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(pt,e)}cancelProcess(e){return this.client.rest.delete(_t,e)}unZip(e){return this.client.rest.post(dt,e)}checkZip(e){return this.client.rest.head($t,e)}}class mt{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const vt="/storage/element/share";class wt{constructor(e){this.client=e}info(e){return this.client.rest.get(vt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(vt,s)}change(e){return this.client.rest.put(`${vt}/${e.token}`,e)}delete(e){return this.client.rest.delete(vt,{path:e})}refresh(e){return this.client.rest.put(`${vt}/${e}/refresh`)}}const kt="/storage/trash/element",St=`${kt}/all`;class bt{constructor(e){this.client=e}clear(e){return this.client.rest.delete(kt,e)}clearAll(){return this.client.rest.delete(St)}restore(e){return this.client.rest.patch(kt,{del_groups:e})}restoreAll(){return this.client.rest.patch(St)}}const yt="/users",At=`${yt}/me`,xt=`${At}/avatars`,Ct=`${At}/sessions`,Dt=`${At}/tokens`,Tt=`${At}/params`,Ut=`${At}/app-passwords`,Pt=`${At}/change-password`,Et=`${yt}/initial`,Ot=`${At}/phone`,Rt=`${Ot}/confirm`;class It{constructor(e){this.client=e}initial(e){return this.client.rest.post(Et,e)}list(e){return this.client.rest.get(yt,e)}get(e){return this.client.rest.get(yt+`/${e}`)}create(e){return this.client.rest.post(yt,e)}update(e,t){return this.client.rest.put(yt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${yt}/${e}`,t)}restore(e){return this.client.rest.post(`${yt}/${e}/restore`)}me(){return this.client.rest.get(At)}updateMe(e){return this.client.rest.put(At,e)}createToken(e){return this.client.rest.post(Dt,e)}listToken(e){return this.client.rest.get(Dt,e)}deleteToken(e){return this.client.rest.delete(`${Dt}/${e}`)}changeMyPassword(e){return this.client.rest.put(Pt,e)}changeUsersPassword(e,t){return this.client.rest.put(`${yt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(xt,s)}meDeleteAvatar(){return this.client.rest.delete(xt)}meListSession(e){return this.client.rest.get(Ct,e)}meDeleteSession(e){let t=Ct;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${yt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(Tt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${Tt}/${e}`,t)}meListParams(){return this.client.rest.get(Tt)}phone(e){return this.client.rest.post(Ot,e)}phoneConfirm(e){return this.client.rest.post(`${Rt}/${e}`)}appPasswordsList(e){return this.client.rest.get(Ut,e)}createAppPasswords(e){return this.client.rest.post(Ut,e)}deleteAppPasswords(e){return this.client.rest.delete(`${Ut}/${e}`)}}const Lt="/users/appeals",jt=`${Lt}/category`,zt=`${Lt}/subcategory`,Nt=`${Lt}/file`;class Wt{constructor(e){this.client=e}category(){return this.client.rest.get(jt)}subcategory(e){return this.client.rest.get(zt,{category_code:e})}uploadFile(e){const t=new FormData;return t.append("file",e),this.client.rest.post(Nt,t)}deleteFile(e){return this.client.rest.delete(`${Nt}/${e}`)}createAppeal(e){return this.client.rest.post(Lt,e)}}const Ft="/storage/element",Bt=`${Ft}/history`,Ht=`${Ft}/version`,qt=`${Ht}/lock`,Gt=`${Ht}/unlock`,Mt=`${Ht}/current`,Vt=`${Ht}/size`;class Zt{constructor(e){this.client=e}history(e){return this.client.rest.get(Bt,e)}versions(e){return this.client.rest.get(Ht,e)}create(e){return this.client.rest.post(Ht,e)}edit(e){return this.client.rest.put(Ht,e)}delete(e){return this.client.rest.delete(Ht,e)}size(e){return this.client.rest.get(Vt,e)}makeCurrent(e){return this.client.rest.post(Mt,e)}lock(e){return this.client.rest.post(qt,e)}unlock(e){return this.client.rest.post(Gt,e)}}const Jt="/version",Yt=`${Jt}/changelog`;class Xt{constructor(e){this.client=e}getVersions(e){return this.client.rest.get(Jt,e)}getChangelog(e){return this.client.rest.get(Yt,{version_number:e})}}const Kt="/tag",Qt=`${Kt}/list`;class es{constructor(e){this.client=e}list(e){return this.client.rest.get(Qt,e)}get(e){return this.client.rest.get(`${Kt}/${e}`)}assign(e,t){return this.client.rest.post(`${Kt}/${e}/assign`,{items:t})}unassign(e,t){return this.client.rest.post(`${Kt}/${e}/unassign`,{items:t})}create(e){return this.client.rest.post(Kt,e)}update(e,t){return this.client.rest.put(`${Kt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Kt}/${e}`)}}const ts="/spaces";class ss{constructor(e){this.client=e}list(e){return this.client.rest.get(ts,e)}create(e){return this.client.rest.post(ts,e)}update(e,t){return this.client.rest.put(`${ts}/${e}`,t)}delete(e){return this.client.rest.delete(`${ts}/${e}`)}adminsList(e,t){return this.client.rest.get(`${ts}/${e}`,t)}}export{n as AccessRights,r as AuthApiService,ae as BASE_URL_V1,le as BASE_URL_V2,o as CONNECTIONS_PERMISSION,he as Client,l as ColorTypes,u as ConnectionGroup,h as ConnectionType,M as ConnectionsApiService,V as DiscoveryApiService,X as DivideApiService,m as DivideMode,g as DivideScope,a as EngineType,p as ExtensionFileMode,d as ExtensionType,fe as ExtensionsApiService,ve as ExtensionsExternalApiService,Se as FcaApiService,ye as GatewayApiService,Ce as GroupApiService,Pe as LicenseApiService,k as LicenseError,b as LimitationSubType,S as LimitationType,Ie as LimitationsApiService,Oe as LinksApiService,ze as LogstashApiService,oe as NEED_TOKEN_UPDATE_ERROR,A as NotificationAction,He as NotificationApiService,y as NotificationEntityType,x as NotificationRowAction,C as NotificationStyle,c as OrderDirection,_ as PermissionType,Xt as PlatformVersionApiService,Ae as QueryInitViewType,T as RequestMethod,U as RequestObserve,D as ResponseType,ue as Rest,f as RestrictionBooleanStatus,v as RestrictionModeKey,P as RestrictionSharing,$ as RestrictionStatus,Ve as RoleApiService,j as SettingControlType,Xe as ShareApiService,ss as SpaceApiService,H as SpacePermission,et as StorageCommentApiService,lt as StorageElementApiService,B as StorageElementCheckStatus,N as StorageElementContentType,F as StorageElementHistoryAction,z as StorageElementType,ft as StorageFilesApiService,mt as StorageInstanceApiService,W as StorageRoot,wt as StorageShareApiService,bt as StorageTrashApiService,es as TagsApiService,w as Tariff,ce as TokenUpdate,It as UserApiService,L as UserAppType,E as UserAuthType,I as UserParamsLabel,O as UserStatus,R as UserType,Wt as UsersAppealsApiService,Zt as VersionApiService,te as applyInterceptors,se as getCookieValue,ie as makeUrlParams,re as normalizeHeaders,ne as prepareRequestBody};
1
+ const e="/login",t=`${e}/ldap`,s=`${e}/update`,i=`${e}/tfa`;class r{constructor(e){this.client=e}info(){return this.client.rest.get(e)}login(t){return this.client.rest.post(e,t)}ldapLogin(e){return this.client.rest.post(t,e)}loginTfa(e){return this.client.rest.post(i,e)}updateToken(e){const t=e.path?`${e.path}/${s}`:s;return e.path&&delete e.path,this.client.rest.post(t,e)}logout(){return this.client.rest.post("/logout")}}var n;!function(e){e.LicenseRead="license_read",e.LicenseManage="license_edit",e.UsersRead="users_read",e.UsersCreate="users_create",e.UsersActivate="users_activate",e.GroupsRead="groups_read",e.GroupsCreate="groups_create",e.RolesRead="roles_read",e.RolesCreate="roles_create",e.Share="share",e.Divide="divide",e.ExtensionsRead="extensions_read",e.ExtensionsManage="extensions_write",e.RestrictionShareRead="restriction_share_read",e.RestrictionShareWrite="restriction_share_write",e.RestrictionDivideRead="restriction_divide_read",e.RestrictionDivideWrite="restriction_divide_write",e.LimitationsRead="limitations_read",e.LimitationsEdit="limitations_edit",e.ReadUserLogs="read_user_logs",e.ConnectionsRead="connections_read",e.ConnectionsDividing="connections_dividing",e.ConnectionsYandexDisk="connections_yandex_disk",e.ConnectionsSsh="connections_ssh",e.ConnectionsMail="connections_mail",e.ConnectionsS3="connections_s3",e.ConnectionsDiscord="connections_discord",e.ConnectionsWebdav="connections_webdav",e.ConnectionsNextcloud="connections_nextcloud",e.ConnectionsNextbox="connections_nextbox",e.ConnectionsHttpProxy="connections_http_proxy",e.SystemInfoServiceList="system_info_service_list",e.SettingsRead="settings_read",e.SettingsWrite="settings_write",e.DemoAdmin="demo_admin"}(n||(n={}));const o=[n.ConnectionsYandexDisk,n.ConnectionsSsh,n.ConnectionsMail,n.ConnectionsS3,n.ConnectionsS3,n.ConnectionsDiscord,n.ConnectionsWebdav,n.ConnectionsNextcloud,n.ConnectionsNextbox,n.ConnectionsHttpProxy];var c,a,l,u,h,d,p,g,_,$,f,v,m,k,w,S,b,y,A,x,C,D,T,U,P,E,O,R,L,I,j,z,N,W,B,F;!function(e){e.DEFAULT="",e.ASC="asc",e.DESC="desc"}(c||(c={})),function(e){e.WebSocket="websocket",e.PostMessage="postmessage",e.Empty=""}(a||(a={})),function(e){e.Yellow="yellow",e.Success="success",e.Critical="critical",e.Warning="warning",e.Brand="brand",e.Purple="purple",e.Primary="primary",e.Gray="gray"}(l||(l={})),function(e){e.Storages="storages_connections_group",e.Webhooks="webhooks_connections_group",e.Unknown="unknown_connections_group",e.Proxy="proxy_connections_group"}(u||(u={})),function(e){e.SSH="ssh_connection",e.YandexDisk="yandex_disk",e.Mail="mail",e.Discord="discord",e.Webdav="webdav_connection",e.Nextcloud="nextcloud_connection",e.NextBox="nextbox_connection",e.HttpProxy="http_proxy_connection",e.S3="s3_connection"}(h||(h={})),function(e){e.App="app",e.File="file",e.WorkDir="work_dir"}(d||(d={})),function(e){e.Read="read",e.ReadAndWrite="read_and_write",e.Write="write"}(p||(p={})),function(e){e.Storage="/storage/element",e.Connection="/connections"}(g||(g={})),function(e){e.Close="",e.Read="r",e.Write="rw",e.Full="rwd",e.SpaceManage="space_manage"}(_||(_={})),function(e){e.WAITING="waiting",e.APPROVED="approved",e.REJECTED="rejected"}($||($={})),function(e){e.TRUE="true",e.FALSE="false"}(f||(f={})),function(e){e.User="to_user_id",e.Group="to_user_group_id"}(v||(v={})),function(e){e.Divide="divide",e.Share="share"}(m||(m={})),function(e){e.Free="free",e.Business="business",e.Enterprise="enterprise"}(k||(k={})),function(e){e.NotActivated="License not activated",e.Blocked="License blocked",e.Expired="License has been expired",e.NotValid="License not valid",e.NotFound="license file not found"}(w||(w={})),function(e){e.BySize="size",e.ByExt="extension",e.ByQuota="quota_size"}(S||(S={})),function(e){e.Size="size",e.White="extension_white",e.Black="extension_black"}(b||(b={})),function(e){e.Dir="dir",e.File="file",e.User="user",e.Other="other",e.WorkDir="work_dir",e.License="license",e.Extension="extension",e.Connection="connection"}(y||(y={})),function(e){e.SecurityCheckNegative="action_security_check_negative",e.SecurityCheckPositive="action_security_check_positive",e.CommentVersionMention="action_version_comment_mention",e.OpenSharing="open_sharing",e.ChangeSharing="change_sharing",e.CancelSharing="cancel_sharing",e.DivideDirAddFileToOwner="divide_dir_add_file_to_owner",e.DivideDirAddDirToOwner="divide_dir_add_dir_to_owner",e.DivideDirAddWorkDirToOwner="divide_dir_add_work_dir_to_owner",e.DivideConnectionAddFileToOwner="divide_connection_add_file_to_owner",e.DivideConnectionAddDirToOwner="divide_connection_add_dir_to_owner",e.CancelDivideDir="cancel_divide_dir",e.CancelDivideFile="cancel_divide_file",e.CancelDivideWorkDir="cancel_divide_work_dir",e.CancelDivideConnection="cancel_divide_connection",e.DeleteExtension="delete_extension",e.NewVersionExtension="new_version_extension",e.TransferData="transfer_data",e.AllowInternalAccessUser="allow_internal_access_to_user",e.BlockInternalAccessUser="block_internal_access_to_user",e.WaitInternalAccessUser="wait_internal_access_to_user",e.WaitInternalAccessUserCreate="wait_internal_access_to_user_create",e.AllowInternalAccessGroup="allow_internal_access_to_group",e.BlockInternalAccessGroup="block_internal_access_to_group",e.WaitInternalAccessGroup="wait_internal_access_to_group",e.WaitInternalAccessGroupCreate="wait_internal_access_to_group_create",e.AllowSharing="allow_sharing",e.BlockSharing="block_sharing",e.WaitSharing="wait_sharing",e.WaitSharingCreate="wait_sharing_create",e.StatusCreateZipProcess="status_create_zip_process",e.StatusCreateZipSuccess="status_create_zip_success",e.StatusCreateZipError="status_create_zip_error",e.DownloadZipSuccess="download_zip_success",e.DownloadZipError="download_zip_error",e.StatusUnzipProcess="status_unzip_process",e.StatusUnzipSuccess="status_unzip_success",e.StatusUnzipError="status_unzip_error",e.StatusUnzipSuccessWithLimits="status_unzip_success_with_limits",e.AnonymZipDirAddFileToOwner="anonym_zip_dir_add_file_to_owner",e.GuestZipDirAddFileToOwner="guest_zip_dir_add_file_to_owner",e.DropDocumentOnlyoffice="drop_document_onlyoffice",e.CopyError="copy_error",e.CopySuccess="copy_success",e.StatusCopyProcess="status_copy_process",e.Other="other"}(A||(A={})),function(e){e.Read="read",e.Unread="unread",e.Delete="delete"}(x||(x={})),function(e){e.Plain="plain",e.Success="success",e.Info="info",e.Warning="warning",e.Error="error"}(C||(C={})),function(e){e.ArrayBuffer="arraybuffer",e.Blob="blob",e.Json="json",e.Text="text"}(D||(D={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e.HEAD="HEAD"}(T||(T={})),function(e){e.Body="body",e.Response="response"}(U||(U={})),function(e){e.NONE="none",e.SOFT="soft",e.HARD="hard"}(P||(P={})),function(e){e.Native="native",e.Ldap="ldap",e.Vk="vk"}(E||(E={})),function(e){e.Registering="registering",e.Activated="activated",e.BlockedByAdmin="blocked_by_admin",e.BlockedByLicense="blocked_by_license",e.BlockedByInactive="blocked_by_inactive",e.BlockedByInactiveChangePassword="blocked_by_inactive_change_password"}(O||(O={})),function(e){e.User="user",e.Guest="guest",e.Emperor="emperor",e.Anonymous="anonymous"}(R||(R={})),function(e){e.Theme="theme",e.Lang="lang",e.Sort="sort",e.ViewApps="viewApps",e.WithoutContentWorkDir="withoutContentWorkDir",e.DashboardGrid="dashboardGrid"}(L||(L={})),function(e){e.Webdav="webdav"}(I||(I={})),function(e){e.Text="text",e.String="string",e.Number="number",e.CheckBox="checkbox",e.Select="select",e.RadioList="radio_list",e.ConnectionChoose="connection_choose",e.MultiConnectionChoose="multi_connection_choose"}(j||(j={})),function(e){e.Dir="dir",e.File="file",e.WorkDir="work_dir",e.App="app"}(z||(z={})),function(e){e.Any="any",e.Dir="dir",e.Code="code",e.Image="image",e.Audio="audio",e.Video="video",e.Text="text",e.Doc="doc",e.Xls="xls",e.Ppt="ppt"}(N||(N={})),function(e){e.my="my",e.fca="fca",e.divide="divide",e.share="share",e.favorite="favorite",e.trash="trash"}(W||(W={})),function(e){e.Create="create",e.Update="update",e.Move="move"}(B||(B={})),function(e){e[e.CheckNull=0]="CheckNull",e[e.CheckInProgress=1]="CheckInProgress",e[e.CheckPositive=2]="CheckPositive",e[e.CheckNegative=3]="CheckNegative"}(F||(F={}));const H="/connections",q=`${H}/dashboard`;class G{constructor(e){this.client=e}list(e){return this.client.rest.get(H,e)}get(e){return this.client.rest.get(`${H}/${e}`)}update(e,t){return this.client.rest.put(`${H}/${e}`,t)}delete(e){return this.client.rest.delete(`${H}/${e}`)}create(e){const t={[h.SSH]:"/disk/ssh",[h.Webdav]:"/disk/webdav",[h.Nextcloud]:"/disk/nextcloud",[h.NextBox]:"/disk/nextbox",[h.Discord]:"/webhooks/discord",[h.Mail]:"/webhooks/mail",[h.HttpProxy]:"/http_proxy",[h.S3]:"/disk/s3"};return this.client.rest.post(t[e.type]||H,e)}dashboard(e){return this.client.rest.get(q,e)}}class M{constructor(e){this.client=e}discovery(e){return this.client.rest.get("/discovery",e)}}const V="/divide",Z=`${V}/restrictions`,J=`${V}/tag_group`;class Y{constructor(e){this.client=e}divideDelete(e,t){return this.client.rest.delete(`${e}${V}/${t}`)}divideDeleteAll(e,t,s,i){return this.client.rest.delete(`${e}${V}`,Object.assign(Object.assign({},this.makeParam(e,t)),{is_to_user_group:i,access_mode:s}))}divideChange(e,t,s){return this.client.rest.put(`${e}${V}/${t}`,{access_mode:s})}divideCreate(e,t,s,i,r){const n=Object.assign(Object.assign({},this.makeParam(e,t)),{[r]:s,access_mode:i});return this.client.rest.post(`${e}${V}`,n)}divideUsers(e,t,s){return this.client.rest.get(`${e}${V}/users`,Object.assign(Object.assign({},this.makeParam(e,t)),s))}divideTagGroupList(e){return this.client.rest.get(`${g.Storage}${J}`,e)}getRestriction(e){return this.client.rest.get(`${Z}/${e}`)}restrictionSize(e,t){return this.client.rest.get(`/${t}/restrictions/${e}/size`)}restrictions(e){return this.client.rest.get(`${Z}`,e)}restrictionsChange(e,t){return this.client.rest.put(`${Z}/${e}`,t)}makeParam(e,t){const s={};return e===g.Connection?s.connection_id=t:s.path=t,s}}class X extends Error{}function K(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,((e,t)=>{let s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return atob(t)}}function Q(e,t){if("string"!=typeof e)throw new X("Invalid token specified: must be a string");t||(t={});const s=!0===t.header?0:1,i=e.split(".")[s];if("string"!=typeof i)throw new X(`Invalid token specified: missing part #${s+1}`);let r;try{r=K(i)}catch(e){throw new X(`Invalid token specified: invalid base64 for part #${s+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new X(`Invalid token specified: invalid json for part #${s+1} (${e.message})`)}}X.prototype.name="InvalidTokenError";const ee=async(e,t)=>{let s=t;for(const t of e)try{s=await t.fulfilled(s)}catch(e){if(!t.rejected)throw e;s=await t.rejected(e)}return s};function te(e){var t;return null!==(t=Object.fromEntries(document.cookie.split(";").map((e=>e.split("="))).map((([e,t])=>[e.trim(),decodeURIComponent(t||"")])))[e])&&void 0!==t?t:null}const se=e=>{const t=new URLSearchParams;return Object.keys(e).forEach((s=>{Array.isArray(e[s])?e[s].forEach((e=>{t.append(s,e)})):t.append(s,e[s])})),t};function ie(e){return e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e}function re(e){return e?e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||e instanceof Document||ArrayBuffer.isView(e)?e:"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null:null}const ne="update black token";class oe{constructor(){this.isUpdating=!1,this.tokenUpdateResolve=null}isTokenExpire(e){if(!e)return!1;return 1e3*e<=(new Date).getTime()+3e3}async refreshToken(e,t){const{access_token:s,refresh_token:i}=e;return s&&i?this.isUpdating?this.waitForTokenUpdate():(this.isUpdating=!0,new Promise(((e,r)=>{const n=new XMLHttpRequest,o=`${t}${ce}/login/update`;n.open("POST",o,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify({access_token:s,refresh_token:i})),n.onload=()=>{if(n.status>=200&&n.status<300)try{const t=JSON.parse(n.responseText);if(t&&t.access_token&&t.refresh_token){const s={access_token:t.access_token,refresh_token:t.refresh_token};te("access_token")===s.access_token&&localStorage.setItem("refresh-token",s.refresh_token),this.tokenUpdateResolve&&(this.tokenUpdateResolve(s),this.tokenUpdateResolve=null),e(s)}else e(null)}catch(e){r(new Error("Failed to parse response JSON."))}else e(null)},n.onerror=()=>{r(new Error("Network error occurred"))},n.onloadend=()=>{this.isUpdating=!1}}))):null}async waitForTokenUpdate(){return new Promise((e=>{const t=setInterval((()=>{this.isUpdating||(clearInterval(t),e())}),100)}))}}const ce="/api/v1",ae="/api/v2";class le{constructor(e,t){this.client=e,this.tokenUpdate=t,this.baseHost=""}get state(){return this.client.state}get(e,t,s){return this.request(T.GET,e,Object.assign({params:t,cache:"no-cache"},s))}post(e,t,s){return this.request(T.POST,e,Object.assign({body:t},s))}put(e,t,s){return this.request(T.PUT,e,Object.assign({body:t,cache:"no-cache"},s))}patch(e,t,s){return this.request(T.PATCH,e,Object.assign({body:t},s))}delete(e,t,s){return this.request(T.DELETE,e,Object.assign({params:t},s))}head(e,t,s){return this.request(T.HEAD,e,Object.assign({params:t},s))}upload(e,t,s){const i=new AbortController,r=i.signal;return{promise:this.request(T.POST,e,Object.assign({body:t,signal:r},s)),abort:()=>i.abort()}}request(e,t,s){return new Promise(((i,r)=>{var n;const o=null!==(n=this.state.skipInterceptors)&&void 0!==n&&n;this.state.skipInterceptors=!1;let c=Object.assign({method:e},s);(null==s?void 0:s.signal)&&(c.signal=s.signal);(async()=>{var s,n,a,l;if(o||(c=null!==(s=await ee(this.client.requestInterceptors,c))&&void 0!==s?s:c),this.state.authToken)for(const[e,s]of this.state.authToken.entries()){const i=Q(s.access_token);if(i&&i.is_remember&&this.tokenUpdate.isTokenExpire(i.exp)&&!t.includes("/login")&&!t.includes("/assets")){const t=await this.tokenUpdate.refreshToken(s,this.baseHost);t&&(this.state.authToken.set(e,t),c=null!==(n=await ee(this.client.requestInterceptors,c))&&void 0!==n?n:c)}}const u=new XMLHttpRequest;c.params&&Object.keys(c.params).length&&(t+="?"+se(c.params));const h=null!==(a=c.host)&&void 0!==a?a:this.state.clientParams.host,d=`${h}${null!==(l=c.version)&&void 0!==l?l:this.state.clientParams.version}${t}`;if(u.open(e,d,!0),c.headers){const e=ie(c.headers);for(const[t,s]of Object.entries(e))(h===this.baseHost||"content-type"!==t.toLowerCase())&&u.setRequestHeader(t,s)}c.responseType&&(u.responseType=c.responseType),c.signal&&c.signal.addEventListener("abort",(()=>{u.abort(),r(new Error("Request aborted"))})),!u.upload||e!==T.POST&&e!==T.PUT&&e!==T.PATCH||(u.upload.onprogress=e=>{e.lengthComputable&&c.onUploadProgress&&c.onUploadProgress(e)}),u.onload=async()=>{if(c.signal&&c.signal.aborted)return;let e;switch(c.responseType){case D.Text:e=u.responseText;break;case D.Blob:case D.ArrayBuffer:e=u.response;break;default:try{e=JSON.parse(u.responseText)}catch(t){e=u.responseText}}const t=new Headers;u.getAllResponseHeaders().split("\r\n").forEach((e=>{const[s,i]=e.split(": ");s&&i&&t.append(s,i)}));const s={status:u.status,statusText:u.statusText,headers:t,url:u.responseURL};if(u.status>=200&&u.status<300)return await ee(this.client.responseInterceptors,s),void(c.observe===U.Response?i(Object.assign(Object.assign({},s),{body:e})):i(e));if(this.state.authToken&&(null==e?void 0:e.code)===ne){const e=await this.tokenUpdate.refreshToken(this.state.authToken.get(0),this.baseHost);e&&this.state.authToken.set(0,e)}const n=Object.assign(Object.assign({},s),{error:e});await ee(this.client.responseInterceptors,n),r(n)},u.onerror=()=>{r({status:u.status,statusText:u.statusText,url:u.responseURL,error:"Network error"})},u.send(re(c.body))})().catch(r)}))}}class ue{constructor(e){this.AuthApiService=new r(this),this.ConnectionsApiService=new G(this),this.DiscoveryApiService=new M(this),this.DivideApiService=new Y(this),this.ExtensionsApiService=new $e(this),this.ExtensionsExternalApiService=new ve(this),this.FcaApiService=new we(this),this.GatewayApiService=new be(this),this.GroupApiService=new xe(this),this.LicenseApiService=new Ue(this),this.LinksApiService=new Ee(this),this.LimitationsApiService=new Re(this),this.LogstashApiService=new je(this),this.NotificationApiService=new Fe(this),this.RoleApiService=new Me(this),this.ShareApiService=new Ye(this),this.StorageCommentApiService=new Qe(this),this.StorageElementApiService=new at(this,this.FcaApiService),this.StorageFilesApiService=new $t(this),this.TagsApiService=new Qt(this),this.StorageInstanceApiService=new ft(this),this.StorageShareApiService=new mt(this),this.StorageTrashApiService=new St(this),this.UserApiService=new Rt(this),this.UsersAppealsApiService=new Nt(this),this.VersionApiService=new Vt(this),this.PlatformVersionApiService=new Yt(this),this.SpaceApiService=new ss(this),this.tokenUpdate=new oe,this.rest=new le(this,this.tokenUpdate),this.requestInterceptors=[],this.responseInterceptors=[],this.request={use:(e,t)=>{this.requestInterceptors.push({fulfilled:e,rejected:t})}},this.response={use:(e,t)=>{this.responseInterceptors.push({fulfilled:e,rejected:t})}},this.state={clientParams:{host:null==e?void 0:e.host,version:(null==e?void 0:e.version)||ce},requestParams:{path:"",headers:{},query:{},body:null,cache:"no-cache"},authToken:null,skipInterceptors:!1},this.rest.baseHost=this.state.clientParams.host||""}}const he="/static/extensions",de="/extensions/defaults",pe=`${he}/names/users`,ge=`${he}/names/system`,_e=`${he}/tags`;class $e{constructor(e){this.client=e}getSetting(e){return this.client.rest.get(`${he}/${e}/settings`)}setSetting(e,t){return this.client.rest.post(`${he}/${e}/settings`,t)}deleteSetting(e){return this.client.rest.delete(`${he}/${e}/settings`)}get(e){return this.client.rest.get(`${he}/${e}`)}getByKey(e){return this.client.rest.get(`${he}/${e}`)}getDefault(e=[]){return this.client.rest.get(de,{ext_code:e})}setDefault(e,t){return this.client.rest.post(de,{ext_code:e,ext_uniq_key:t})}checkUpdates(){return this.client.rest.post(`${he}/check_updates`)}updateVersion(e,t){return this.client.rest.put(`${he}/${e}`,{version:t})}list(e){return this.client.rest.get(he,e)}listTags(e){return this.client.rest.get(_e,e)}delete(e,t){return this.client.rest.delete(`${he}/${e}`)}upload(e,t){const s=new FormData;s.set("file",t);const{promise:i,abort:r}=this.client.rest.upload(he,s,{version:ae,onUploadProgress:t=>{e(t)}});return{promise:i,abort:r}}install(e,t){return this.client.rest.post(`${he}/site`,{uniq_key:e,version:t},{version:ae})}getSystemNameExts(e){return this.client.rest.get(ge,e)}getUserNameExts(e){return this.client.rest.get(pe,e)}createUserNameExt(e){return this.client.rest.post(`${pe}`,{name:e})}deleteUserNameExt(e){return this.client.rest.delete(`${pe}/${e}`)}deleteAllUserNameExts(){return this.client.rest.delete(`${pe}`)}}const fe="/anons_ext/extensions";class ve{constructor(e){this.client=e}listExtensionsSite(e){return this.client.rest.get(fe,e,{host:"https://next-box.ru"})}extensionDetailSite(e){return this.client.rest.get(`${fe}/${e}`,{},{host:"https://next-box.ru"})}extensionMarkdown(e,t){return this.client.rest.get(`${fe}/${e.uniqKey}/readme`,{lang:e.lang},Object.assign(Object.assign({},t),{host:"https://next-box.ru"}))}}const me="/disk",ke=`${me}/check`;class we{constructor(e){this.client=e}info(e,t){return this.client.rest.get(`${me}/${e}/element`,{path:t})}list(e,t){return this.client.rest.get(`${me}/${e}`,t)}create(e,t){return this.client.rest.post(`${me}/${e}/element`,t)}replace(e,t,s){return this.client.rest.put(`${me}/${e}/files?path=${t}`,s)}read(e,t){return this.client.rest.get(`${me}/${e}/files?path=${t}`)}upload(e,t,s,i=""){const r=new FormData;r.set("path",i),r.set("file",s);const{promise:n,abort:o}=this.client.rest.upload(`${me}/${t}/files`,r,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e,t){return this.client.rest.post(`${me}/${e}/files/net`,t)}delete(e,t){return this.client.rest.delete(`${me}/${e}/trash/element`,{path:t})}check(e){return this.client.rest.post(ke,e)}}const Se="/settings";class be{constructor(e){this.client=e}settings(){return this.client.rest.get(Se)}changeSettings(e){return this.client.rest.post(Se,e)}queryInit(){return this.client.rest.get("/query/init")}}var ye;!function(e){e.Standard="Standard",e.Simple="Simple"}(ye||(ye={}));const Ae="/groups";class xe{constructor(e){this.client=e}list(e){return this.client.rest.get(Ae,e)}get(e){return this.client.rest.get(`${Ae}/${e}`)}listUsers(e,t){return this.client.rest.get(`${Ae}/${e}/users`,t)}default(){return this.client.rest.get(`${Ae}/default`)}create(e){return this.client.rest.post(Ae,e)}update(e,t){return this.client.rest.put(`${Ae}/${e}`,t)}delete(e){return this.client.rest.delete(`${Ae}/${e}`)}}const Ce="/license",De=`${Ce}/manual-check`,Te=`${Ce}/hardware/hash`;class Ue{constructor(e){this.client=e}info(){return this.client.rest.get(Ce)}create(e){return this.client.rest.post(Ce,e)}check(){return this.client.rest.post(De)}delete(){return this.client.rest.delete(Ce)}getHash(){return this.client.rest.get(Te)}}const Pe="/links";class Ee{constructor(e){this.client=e}createShortLink(e){return this.client.rest.post(Pe,e)}updateShortLink(e){return this.client.rest.put(Pe,e)}}const Oe="/limitations";class Re{constructor(e){this.client=e}me(){return this.client.rest.get("/limitations/user/me")}list(e){return this.client.rest.get(Oe,e)}listUsers(e,t){return this.client.rest.get(`${Oe}/${e}/users`,t)}create(e){return this.client.rest.post(Oe,e)}get(e){return this.client.rest.get(`${Oe}/${e}`)}update(e,t){return this.client.rest.put(`${Oe}/${e}`,t)}delete(e){return this.client.rest.delete(`${Oe}/${e}`)}getLimitationsByUser(e){return this.client.rest.get(`/limitations/user/${e}`)}addUserToLimitation(e,t){return this.client.rest.patch(`${Oe}/${e}/user`,{id:t})}deleteUserFromLimitation(e,t){return this.client.rest.delete(`${Oe}/${e}/user/${t}`)}}const Le="/logs/users",Ie=`${Le}/actions`;class je{constructor(e){this.client=e}getUsersLogs(e){return this.client.rest.get(`${Le}`,e)}getLogsActions(e){return this.client.rest.get(`${Ie}`,e)}}const ze="/notifications",Ne=`${ze}/all`,We=`${ze}/subscription`,Be=`${ze}/permission`;class Fe{constructor(e){this.client=e}list(e){return this.client.rest.get(ze,e)}toggleStatus(e,t){return this.client.rest.put(ze,{ids:e,to_status:t})}toggleAllStatus(e){return this.client.rest.put(Ne,{to_status:e})}delete(e){return this.client.rest.delete(ze,{id:e})}deleteAll(){return this.client.rest.delete(Ne)}getPermission(){return this.client.rest.get(Be)}setPermission(e){return this.client.rest.post(Be,{enabled:e})}getSubscription(){return this.client.rest.get(We)}setSubscription(e){const t={action_groups:Object.assign({},e)};return this.client.rest.post(We,t)}}const He="/roles",qe=`${He}/default`,Ge="/permissions";class Me{constructor(e){this.client=e}list(e){return this.client.rest.get(He,e)}get(e){return this.client.rest.get(`${He}/${e}`)}getDefault(){return this.client.rest.get(`${qe}`)}create(e){return this.client.rest.post(He,e)}update(e,t){return this.client.rest.put(`${He}/${e}`,t)}delete(e){return this.client.rest.delete(`${He}/${e}`)}permissionList(){return this.client.rest.get(Ge)}addPermission(e,t){return this.client.rest.put(`${He}/${e}/permissions`,{ids:t})}deletePermission(e,t){return this.client.rest.delete(`${He}/${e}/${Ge}`,{ids:t})}}const Ve="/share",Ze=`${Ve}/restrictions`,Je=`${Ve}/login`;class Ye{constructor(e){this.client=e}info(e){return this.client.rest.get(`${Ve}?share_token=${e}`)}checkPassword(e,t){const s=encodeURIComponent(e);return this.client.rest.get(`${Ve}/password?share_token=${t}&share_pass=${s}`)}getRestriction(e){return this.client.rest.get(`${Ze}/${e}`)}restrictions(e){return this.client.rest.get(Ze,e)}restrictionsChange(e,t){return this.client.rest.put(`${Ze}/${e}`,t)}login(e){return this.client.rest.post(`${Je}`,e)}}const Xe="/storage/element/version/comment",Ke=`${Xe}/all`;class Qe{constructor(e){this.client=e}list(e){return this.client.rest.get(`${Xe}`,e)}create(e){return this.client.rest.post(`${Xe}`,e)}update(e){return this.client.rest.put(`${Xe}`,e)}delete(e){return this.client.rest.delete(`${Xe}`,e)}deleteAll(e){return this.client.rest.delete(`${Ke}`,e)}}const et="/storage",tt=`${et}/element`,st=`${tt}/divide`,it=`${st}/resource`,rt=`${tt}/move`,nt=`${tt}/copy`,ot=`${tt}/content_type_size`,ct="/disk";class at{constructor(e,t){this.client=e,this.fcaApiService=t}list(e){return this.client.rest.get(et,e)}info(e){var t;return parseInt((null===(t=e.divide_id)||void 0===t?void 0:t.toString())||"")||delete e.divide_id,e.file_version_id||delete e.file_version_id,e.zip_entry_path||delete e.zip_entry_path,this.client.rest.get(tt,e)}fileInfo(e,t){return this.client.rest.get(`${tt}/${e}`,t?{file_version_id:t}:{})}combineInfo({root:e,rootId:t,path:s,file_version_id:i,zip_entry_path:r}){return e===W.fca&&t?this.fcaApiService.info(t,s):this.info({path:s,divide_id:t,file_version_id:i,zip_entry_path:r})}size(e){return this.client.rest.post(`${tt}/size`,e)}move(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return t===W.fca&&s===W.fca?this.client.rest.post(`${ct}/${i}/files/move${ct}/${r}`,n):t===W.fca?(i&&(n.from_divide_id=i),this.client.rest.put(`${ct}/${r}/files/from/box`,n)):s===W.fca?(r&&(n.to_divide_id=r),this.client.rest.put(`${ct}/${i}/files/to/box`,n)):this.client.rest.post(rt,e)}copy(e,t,s){const{from_divide_id:i,to_divide_id:r}=e;let n=Object.assign(Object.assign({},e),{from_divide_id:null,to_divide_id:null});return s===W.fca&&t===W.fca?this.client.rest.post(`${ct}/${i}/files/copy${ct}/${r}`,n):s===W.fca?(i&&(n.from_divide_id=i),this.client.rest.post(`${ct}/${r}/files/from/box`,n)):t===W.fca?(r&&(n.to_divide_id=r),this.client.rest.post(`${ct}/${i}/files/to/box`,n)):this.client.rest.post(nt,e)}pasteFromShared(e,t,s){const i={from_sharing_token:e,from_sharing_password:s,paths:t};return this.client.rest.post(`${tt}/copy`,i)}create(e){return this.client.rest.post(tt,e)}delete(e,t){const s={path:e};return t&&(s.divide_id=t),this.client.rest.delete(tt,s)}favorite(e){return this.client.rest.put(`${tt}?path=${encodeURIComponent(e)}`,{is_favorite:!0})}removeFavorite(e){return this.client.rest.put(`${tt}?path=${encodeURIComponent(e)}`,{is_favorite:!1})}createItem(e){return this.client.rest.post(tt,e)}createWorkDir(e){return this.client.rest.post(tt,e)}sizeWithSection(e){return this.client.rest.get(ot,e)}getDivideResources(e){return this.client.rest.get(it,e)}getQuota(e){return this.client.rest.get(`${tt}/user_size`,e)}hide(e){return this.client.rest.post(`${st}/hide`,e)}unhide(e){return this.client.rest.post(`${st}/unhide`,e)}}const lt="/storage/files",ut=`${lt}/net`,ht=`${lt}/unzip`,dt=`${lt}/zip`,pt=`${dt}/download`,gt=`${lt}/process`,_t=`${lt}/code`;class $t{constructor(e){this.client=e}read(e,t){return t.path=e,this.client.rest.get(lt,t)}replace(e,t){const s=new URLSearchParams;return Object.keys(e).forEach((t=>{e[t]&&s.append(t,e[t])})),this.client.rest.put(`${lt}?${s.toString()}`,t)}upload(e,t,s,i){const r=new FormData;r.set("path",s),i&&r.set("divide_id",i.toString()),r.set("file",t);const{promise:n,abort:o}=this.client.rest.upload(lt,r,{onUploadProgress:t=>{e(t)}});return{promise:n,abort:o}}uploadNet(e){return this.client.rest.post(ut,e)}createZipToDownload(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(pt,e)}createZip(e){var t;const s=-(new Date).getTimezoneOffset()/60;return null!==(t=e.time_zone)&&void 0!==t||(e.time_zone=s),this.client.rest.post(dt,e)}cancelProcess(e){return this.client.rest.delete(gt,e)}unZip(e){return this.client.rest.post(ht,e)}checkZip(e){return this.client.rest.head(_t,e)}}class ft{constructor(e){this.client=e}instance(){return this.client.rest.get("/storage/instance")}}const vt="/storage/element/share";class mt{constructor(e){this.client=e}info(e){return this.client.rest.get(vt,{path:e})}create(e,t){const s={path:e,permissions_type:t};return this.client.rest.post(vt,s)}change(e){return this.client.rest.put(`${vt}/${e.token}`,e)}delete(e){return this.client.rest.delete(vt,{path:e})}refresh(e){return this.client.rest.put(`${vt}/${e}/refresh`)}}const kt="/storage/trash/element",wt=`${kt}/all`;class St{constructor(e){this.client=e}clear(e){return this.client.rest.delete(kt,e)}clearAll(){return this.client.rest.delete(wt)}restore(e){return this.client.rest.patch(kt,{del_groups:e})}restoreAll(){return this.client.rest.patch(wt)}}const bt="/users",yt=`${bt}/me`,At=`${yt}/avatars`,xt=`${yt}/sessions`,Ct=`${yt}/tokens`,Dt=`${yt}/params`,Tt=`${yt}/app-passwords`,Ut=`${yt}/change-password`,Pt=`${bt}/initial`,Et=`${yt}/phone`,Ot=`${Et}/confirm`;class Rt{constructor(e){this.client=e}initial(e){return this.client.rest.post(Pt,e)}list(e){return this.client.rest.get(bt,e)}get(e){return this.client.rest.get(bt+`/${e}`)}create(e){return this.client.rest.post(bt,e)}update(e,t){return this.client.rest.put(bt+`/${e}`,t)}delete(e,t){return this.client.rest.delete(`${bt}/${e}`,t)}restore(e){return this.client.rest.post(`${bt}/${e}/restore`)}me(){return this.client.rest.get(yt)}updateMe(e){return this.client.rest.put(yt,e)}createToken(e){return this.client.rest.post(Ct,e)}listToken(e){return this.client.rest.get(Ct,e)}deleteToken(e){return this.client.rest.delete(`${Ct}/${e}`)}changeMyPassword(e){return this.client.rest.put(Ut,e)}changeUsersPassword(e,t){return this.client.rest.put(`${bt}/${e}/change-password`,t)}meUploadAvatar(e,t){const s=new FormData;return s.append("file",e,t),this.client.rest.post(At,s)}meDeleteAvatar(){return this.client.rest.delete(At)}meListSession(e){return this.client.rest.get(xt,e)}meDeleteSession(e){let t=xt;return e&&(t+=`/${e}`),this.client.rest.delete(t)}setRole(e,t=null){return this.client.rest.put(`${bt}/${e}/roles`,{role_id:t})}meParams(e){return this.client.rest.get(Dt,{name:e})}meSetParams(e,t){return this.client.rest.post(`${Dt}/${e}`,t)}meListParams(){return this.client.rest.get(Dt)}phone(e){return this.client.rest.post(Et,e)}phoneConfirm(e){return this.client.rest.post(`${Ot}/${e}`)}appPasswordsList(e){return this.client.rest.get(Tt,e)}createAppPasswords(e){return this.client.rest.post(Tt,e)}deleteAppPasswords(e){return this.client.rest.delete(`${Tt}/${e}`)}}const Lt="/users/appeals",It=`${Lt}/category`,jt=`${Lt}/subcategory`,zt=`${Lt}/file`;class Nt{constructor(e){this.client=e}category(){return this.client.rest.get(It)}subcategory(e){return this.client.rest.get(jt,{category_code:e})}uploadFile(e){const t=new FormData;return t.append("file",e),this.client.rest.post(zt,t)}deleteFile(e){return this.client.rest.delete(`${zt}/${e}`)}createAppeal(e){return this.client.rest.post(Lt,e)}}const Wt="/storage/element",Bt=`${Wt}/history`,Ft=`${Wt}/version`,Ht=`${Ft}/lock`,qt=`${Ft}/unlock`,Gt=`${Ft}/current`,Mt=`${Ft}/size`;class Vt{constructor(e){this.client=e}history(e){return this.client.rest.get(Bt,e)}versions(e){return this.client.rest.get(Ft,e)}create(e){return this.client.rest.post(Ft,e)}edit(e){return this.client.rest.put(Ft,e)}delete(e){return this.client.rest.delete(Ft,e)}size(e){return this.client.rest.get(Mt,e)}makeCurrent(e){return this.client.rest.post(Gt,e)}lock(e){return this.client.rest.post(Ht,e)}unlock(e){return this.client.rest.post(qt,e)}}const Zt="/version",Jt=`${Zt}/changelog`;class Yt{constructor(e){this.client=e}getVersions(e){return this.client.rest.get(Zt,e)}getChangelog(e){return this.client.rest.get(Jt,{version_number:e})}}const Xt="/tag",Kt=`${Xt}/list`;class Qt{constructor(e){this.client=e}list(e){return this.client.rest.get(Kt,e)}get(e){return this.client.rest.get(`${Xt}/${e}`)}assign(e,t){return this.client.rest.post(`${Xt}/${e}/assign`,{items:t})}unassign(e,t){return this.client.rest.post(`${Xt}/${e}/unassign`,{items:t})}create(e){return this.client.rest.post(Xt,e)}update(e,t){return this.client.rest.put(`${Xt}/${e}`,t)}delete(e){return this.client.rest.delete(`${Xt}/${e}`)}}const es="/spaces",ts=`${es}/access`;class ss{constructor(e){this.client=e}space(e){return this.client.rest.get(`${es}/${e}`)}list(e){return this.client.rest.get(es,e)}create(e){return this.client.rest.post(es,e)}update(e,t){return this.client.rest.put(`${es}/${e}`,t)}delete(e){return this.client.rest.delete(`${es}/${e}`)}adminsList(e,t){return this.client.rest.get(`${es}/${e}`,t)}accessList(e){return this.client.rest.get(ts,e)}provideAccess(e){return this.client.rest.post(ts,e)}deleteAllAccess(e){return this.client.rest.delete(ts,e)}updateAccess(e,t){return this.client.rest.put(`${ts}/${e}`,t)}deleteAccess(e,t){return this.client.rest.delete(`${ts}/${e}`,{space_id:t})}}export{n as AccessRights,r as AuthApiService,ce as BASE_URL_V1,ae as BASE_URL_V2,o as CONNECTIONS_PERMISSION,ue as Client,l as ColorTypes,u as ConnectionGroup,h as ConnectionType,G as ConnectionsApiService,M as DiscoveryApiService,Y as DivideApiService,v as DivideMode,g as DivideScope,a as EngineType,p as ExtensionFileMode,d as ExtensionType,$e as ExtensionsApiService,ve as ExtensionsExternalApiService,we as FcaApiService,be as GatewayApiService,xe as GroupApiService,Ue as LicenseApiService,w as LicenseError,b as LimitationSubType,S as LimitationType,Re as LimitationsApiService,Ee as LinksApiService,je as LogstashApiService,ne as NEED_TOKEN_UPDATE_ERROR,A as NotificationAction,Fe as NotificationApiService,y as NotificationEntityType,x as NotificationRowAction,C as NotificationStyle,c as OrderDirection,_ as PermissionType,Yt as PlatformVersionApiService,ye as QueryInitViewType,T as RequestMethod,U as RequestObserve,D as ResponseType,le as Rest,f as RestrictionBooleanStatus,m as RestrictionModeKey,P as RestrictionSharing,$ as RestrictionStatus,Me as RoleApiService,j as SettingControlType,Ye as ShareApiService,ss as SpaceApiService,Qe as StorageCommentApiService,at as StorageElementApiService,F as StorageElementCheckStatus,N as StorageElementContentType,B as StorageElementHistoryAction,z as StorageElementType,$t as StorageFilesApiService,ft as StorageInstanceApiService,W as StorageRoot,mt as StorageShareApiService,St as StorageTrashApiService,Qt as TagsApiService,k as Tariff,oe as TokenUpdate,Rt as UserApiService,I as UserAppType,E as UserAuthType,L as UserParamsLabel,O as UserStatus,R as UserType,Nt as UsersAppealsApiService,Vt as VersionApiService,ee as applyInterceptors,te as getCookieValue,se as makeUrlParams,ie as normalizeHeaders,re as prepareRequestBody};
package/dist/index.d.ts CHANGED
@@ -307,8 +307,8 @@ declare enum PermissionType {
307
307
  Close = "",
308
308
  Read = "r",
309
309
  Write = "rw",
310
- Full = "full",
311
- Admin = "admin"
310
+ Full = "rwd",
311
+ SpaceManage = "space_manage"
312
312
  }
313
313
  declare enum RestrictionStatus {
314
314
  WAITING = "waiting",
@@ -1177,14 +1177,8 @@ interface Space {
1177
1177
  update_date: string;
1178
1178
  updated_by: number;
1179
1179
  }
1180
- declare enum SpacePermission {
1181
- Read = "r",
1182
- Write = "rw",
1183
- Full = "rwd",
1184
- SpaceManage = "space_manage"
1185
- }
1186
1180
  interface SpaceAccess {
1187
- access_mode: SpacePermission;
1181
+ access_mode: PermissionType;
1188
1182
  to_user_group_id?: number;
1189
1183
  to_user_id?: number;
1190
1184
  }
@@ -1196,6 +1190,15 @@ interface SpaceAdmin {
1196
1190
  login?: string;
1197
1191
  middle_name?: string;
1198
1192
  }
1193
+ interface SpaceAccessProvide {
1194
+ access_mode: PermissionType;
1195
+ create_date: string;
1196
+ id: number;
1197
+ space_id: number;
1198
+ to_user_group_id?: number;
1199
+ to_user_id?: number;
1200
+ update_date: string;
1201
+ }
1199
1202
 
1200
1203
  declare const BASE_URL_V1 = "/api/v1";
1201
1204
  declare const BASE_URL_V2 = "/api/v2";
@@ -1849,11 +1852,17 @@ interface TagCreateParams {
1849
1852
  declare class SpaceApiService {
1850
1853
  private client;
1851
1854
  constructor(client: Client);
1855
+ space(id: number): Promise<Space>;
1852
1856
  list(params: RequestSpaceListParams): Promise<ResponseList<Space>>;
1853
1857
  create(params: RequestSpaceCreateParams): Promise<Space>;
1854
1858
  update(id: number, params: RequestSpaceUpdateParams): Promise<Space>;
1855
1859
  delete(id: number): Promise<void>;
1856
1860
  adminsList(id: number, params: RequestSpaceAdminsListParams): Promise<ResponseList<SpaceAdmin>>;
1861
+ accessList(params: RequestSpaceAccessListParams): Promise<SpaceAcсessResponseList>;
1862
+ provideAccess(params: RequestProvideSpaceAccessParams): Promise<SpaceAccessProvide>;
1863
+ deleteAllAccess(params: RequestSpaceAccessParams): Promise<void>;
1864
+ updateAccess(id: number, params: RequestUpdateSpaceAccessParams): Promise<SpaceAccessProvide>;
1865
+ deleteAccess(id: number, space_id: number): Promise<void>;
1857
1866
  }
1858
1867
  interface RequestSpaceListParams extends RequestBaseParams {
1859
1868
  search?: string;
@@ -1866,6 +1875,27 @@ interface RequestSpaceCreateParams {
1866
1875
  }
1867
1876
  type RequestSpaceUpdateParams = Omit<RequestSpaceCreateParams, 'space_accesses'>;
1868
1877
  type RequestSpaceAdminsListParams = Pick<RequestBaseParams, 'limit' | 'offset'>;
1878
+ interface RequestSpaceAccessParams {
1879
+ space_id: number;
1880
+ access_mode?: PermissionType;
1881
+ file_container_id?: string;
1882
+ is_to_user_group?: boolean;
1883
+ }
1884
+ type RequestSpaceAccessListParams = RequestSpaceAccessParams & RequestSpaceAdminsListParams;
1885
+ type SpaceAcсessResponseList = ResponseList<SpaceAccessProvide> & {
1886
+ total_r: number;
1887
+ total_rw: number;
1888
+ total_rwd: number;
1889
+ total_admin: number;
1890
+ };
1891
+ interface RequestProvideSpaceAccessParams {
1892
+ access_mode: PermissionType;
1893
+ file_container_id?: string;
1894
+ space_id: number;
1895
+ to_user_group_id?: number;
1896
+ to_user_id?: number;
1897
+ }
1898
+ type RequestUpdateSpaceAccessParams = Pick<RequestProvideSpaceAccessParams, 'access_mode' | 'space_id'>;
1869
1899
 
1870
1900
  declare const applyInterceptors: <T>(interceptors: {
1871
1901
  fulfilled: (arg: T) => T | Promise<T>;
@@ -1880,5 +1910,5 @@ declare function normalizeHeaders(headers: Headers | [string, string][] | Record
1880
1910
 
1881
1911
  declare function prepareRequestBody(body: unknown): XMLHttpRequestBodyInit | Document | null;
1882
1912
 
1883
- export { AccessRights, AuthApiService, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, Client, ColorTypes, ConnectionGroup, ConnectionType, ConnectionsApiService, DiscoveryApiService, DivideApiService, DivideMode, DivideScope, EngineType, ExtensionFileMode, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LicenseError, LimitationSubType, LimitationType, LimitationsApiService, LinksApiService, LogstashApiService, NEED_TOKEN_UPDATE_ERROR, NotificationAction, NotificationApiService, NotificationEntityType, NotificationRowAction, NotificationStyle, OrderDirection, PermissionType, PlatformVersionApiService, QueryInitViewType, RequestMethod, RequestObserve, ResponseType, Rest, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, SettingControlType, ShareApiService, SpaceApiService, SpacePermission, StorageCommentApiService, StorageElementApiService, StorageElementCheckStatus, StorageElementContentType, StorageElementHistoryAction, StorageElementType, StorageFilesApiService, StorageInstanceApiService, StorageRoot, StorageShareApiService, StorageTrashApiService, TagsApiService, Tariff, TokenUpdate, UserApiService, UserAppType, UserAuthType, UserParamsLabel, UserStatus, UserType, UsersAppealsApiService, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders, prepareRequestBody };
1884
- export type { AccessToken, Appeal, AssignTagItemParam, AuthToken, AuthTokenUpdate, AuthType, Category, ChangeLicenseParams, Comment, CommentParams, Connection, ConnectionCreateParams, CopyResponse, CreateCommentParams, CreateLimitationsParams, CreateStorageElementParams, CreateUserGroupParams, CreateUserParams, CreateUserRoleParams, CreateZipRequestParams, CutLinkRequest, DeleteAllCommentParams, DeleteCommentParams, Discovery, DivideResourceParams, DivideResourceType, DivideResponseList, Extension, ExtensionDefault, ExtensionExternal, ExtensionExternalInList, ExtensionExternalListParams, ExtensionExternalReadmeParams, ExtensionListParams, ExtensionMetaPayload, ExtensionTag, ExtensionTagListParams, FileLocking, HistoryListRequestParams, HistoryNote, HistoryRequestParams, HttpEvent, HttpResponse, Lang, License, Limitation, LockScreen, NameExtensionListParams, NbAppState, NbClientParams, NbRequestParams, NotificationActionGroup, NotificationPayload, OnUploadProgress, PayloadArchive, PayloadFile, Permission, PermissionItem, PlatformVersions, ProgressEvent, QueryInitResponse, Quota, RequestAuthSettingsParams, RequestAuthTfaParams, RequestAuthTokenParams, RequestBaseParams, RequestConfig, RequestConnectionParams, RequestLimitationsListParams, RequestLogsActionsParams, RequestNotificationListParams, RequestShareLoginParams, RequestSpaceAdminsListParams, RequestSpaceCreateParams, RequestSpaceListParams, RequestSpaceUpdateParams, RequestStorageListParams, RequestTagGroupsParams, RequestTagParams, RequestUserDivideParams, RequestUserGroupListParams, RequestUserListParams, RequestUserRoleListParams, RequestUsersLogParams, RequestVersionsSizeParams, ResourceAccess, ResponseItem, ResponseList, ResponseListNotification, Restriction, Setting, SettingField, SettingFieldView, SettingLang, SettingValue, SettingValueField, SettingVariant, SettingViewConnectionChoose, SettingViewSelect, ShareInfo, ShareModel, SizeBySection, Space, SpaceAccess, SpaceAdmin, StorageDivideElement, StorageElement, StorageElementFileInfo, StorageElementHistory, StorageElementPaste, StorageElementPasteParams, StorageElementTree, StorageElementVersion, StorageElementVersionLock, StorageInstance, StorageItemSizeParams, StorageItemSizePathParams, StorageRouteData, StorageSharingElement, StorageTrashElement, StorageTrashItem, Tag, TagCreateParams, TagGroup, TagIconExtension, UnZipRequestParams, UnionRestriction, UpdateCommentParams, UploadNetRequestParams, User, UserAppPasswordInfo, UserAppPasswords, UserDivide, UserGroup, UserInfo, UserLabel, UserNamesExtension, UserNotification, UserParams, UserPhone, UserRole, UserSession, UserToken, UsersLog, Version, VersionLockRequestParams };
1913
+ export { AccessRights, AuthApiService, BASE_URL_V1, BASE_URL_V2, CONNECTIONS_PERMISSION, Client, ColorTypes, ConnectionGroup, ConnectionType, ConnectionsApiService, DiscoveryApiService, DivideApiService, DivideMode, DivideScope, EngineType, ExtensionFileMode, ExtensionType, ExtensionsApiService, ExtensionsExternalApiService, FcaApiService, GatewayApiService, GroupApiService, LicenseApiService, LicenseError, LimitationSubType, LimitationType, LimitationsApiService, LinksApiService, LogstashApiService, NEED_TOKEN_UPDATE_ERROR, NotificationAction, NotificationApiService, NotificationEntityType, NotificationRowAction, NotificationStyle, OrderDirection, PermissionType, PlatformVersionApiService, QueryInitViewType, RequestMethod, RequestObserve, ResponseType, Rest, RestrictionBooleanStatus, RestrictionModeKey, RestrictionSharing, RestrictionStatus, RoleApiService, SettingControlType, ShareApiService, SpaceApiService, StorageCommentApiService, StorageElementApiService, StorageElementCheckStatus, StorageElementContentType, StorageElementHistoryAction, StorageElementType, StorageFilesApiService, StorageInstanceApiService, StorageRoot, StorageShareApiService, StorageTrashApiService, TagsApiService, Tariff, TokenUpdate, UserApiService, UserAppType, UserAuthType, UserParamsLabel, UserStatus, UserType, UsersAppealsApiService, VersionApiService, applyInterceptors, getCookieValue, makeUrlParams, normalizeHeaders, prepareRequestBody };
1914
+ export type { AccessToken, Appeal, AssignTagItemParam, AuthToken, AuthTokenUpdate, AuthType, Category, ChangeLicenseParams, Comment, CommentParams, Connection, ConnectionCreateParams, CopyResponse, CreateCommentParams, CreateLimitationsParams, CreateStorageElementParams, CreateUserGroupParams, CreateUserParams, CreateUserRoleParams, CreateZipRequestParams, CutLinkRequest, DeleteAllCommentParams, DeleteCommentParams, Discovery, DivideResourceParams, DivideResourceType, DivideResponseList, Extension, ExtensionDefault, ExtensionExternal, ExtensionExternalInList, ExtensionExternalListParams, ExtensionExternalReadmeParams, ExtensionListParams, ExtensionMetaPayload, ExtensionTag, ExtensionTagListParams, FileLocking, HistoryListRequestParams, HistoryNote, HistoryRequestParams, HttpEvent, HttpResponse, Lang, License, Limitation, LockScreen, NameExtensionListParams, NbAppState, NbClientParams, NbRequestParams, NotificationActionGroup, NotificationPayload, OnUploadProgress, PayloadArchive, PayloadFile, Permission, PermissionItem, PlatformVersions, ProgressEvent, QueryInitResponse, Quota, RequestAuthSettingsParams, RequestAuthTfaParams, RequestAuthTokenParams, RequestBaseParams, RequestConfig, RequestConnectionParams, RequestLimitationsListParams, RequestLogsActionsParams, RequestNotificationListParams, RequestProvideSpaceAccessParams, RequestShareLoginParams, RequestSpaceAccessListParams, RequestSpaceAccessParams, RequestSpaceAdminsListParams, RequestSpaceCreateParams, RequestSpaceListParams, RequestSpaceUpdateParams, RequestStorageListParams, RequestTagGroupsParams, RequestTagParams, RequestUpdateSpaceAccessParams, RequestUserDivideParams, RequestUserGroupListParams, RequestUserListParams, RequestUserRoleListParams, RequestUsersLogParams, RequestVersionsSizeParams, ResourceAccess, ResponseItem, ResponseList, ResponseListNotification, Restriction, Setting, SettingField, SettingFieldView, SettingLang, SettingValue, SettingValueField, SettingVariant, SettingViewConnectionChoose, SettingViewSelect, ShareInfo, ShareModel, SizeBySection, Space, SpaceAccess, SpaceAccessProvide, SpaceAcсessResponseList, SpaceAdmin, StorageDivideElement, StorageElement, StorageElementFileInfo, StorageElementHistory, StorageElementPaste, StorageElementPasteParams, StorageElementTree, StorageElementVersion, StorageElementVersionLock, StorageInstance, StorageItemSizeParams, StorageItemSizePathParams, StorageRouteData, StorageSharingElement, StorageTrashElement, StorageTrashItem, Tag, TagCreateParams, TagGroup, TagIconExtension, UnZipRequestParams, UnionRestriction, UpdateCommentParams, UploadNetRequestParams, User, UserAppPasswordInfo, UserAppPasswords, UserDivide, UserGroup, UserInfo, UserLabel, UserNamesExtension, UserNotification, UserParams, UserPhone, UserRole, UserSession, UserToken, UsersLog, Version, VersionLockRequestParams };
@@ -10,8 +10,8 @@ export declare enum PermissionType {
10
10
  Close = "",
11
11
  Read = "r",
12
12
  Write = "rw",
13
- Full = "full",
14
- Admin = "admin"
13
+ Full = "rwd",
14
+ SpaceManage = "space_manage"
15
15
  }
16
16
  export declare enum RestrictionStatus {
17
17
  WAITING = "waiting",
@@ -1,3 +1,4 @@
1
+ import { PermissionType } from './divide';
1
2
  export interface Space {
2
3
  can_manage?: boolean;
3
4
  create_date: string;
@@ -9,14 +10,8 @@ export interface Space {
9
10
  update_date: string;
10
11
  updated_by: number;
11
12
  }
12
- export declare enum SpacePermission {
13
- Read = "r",
14
- Write = "rw",
15
- Full = "rwd",
16
- SpaceManage = "space_manage"
17
- }
18
13
  export interface SpaceAccess {
19
- access_mode: SpacePermission;
14
+ access_mode: PermissionType;
20
15
  to_user_group_id?: number;
21
16
  to_user_id?: number;
22
17
  }
@@ -28,3 +23,12 @@ export interface SpaceAdmin {
28
23
  login?: string;
29
24
  middle_name?: string;
30
25
  }
26
+ export interface SpaceAccessProvide {
27
+ access_mode: PermissionType;
28
+ create_date: string;
29
+ id: number;
30
+ space_id: number;
31
+ to_user_group_id?: number;
32
+ to_user_id?: number;
33
+ update_date: string;
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nb-js-client",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "main": "dist/bundle.cjs.js",
5
5
  "module": "dist/bundle.esm.js",
6
6
  "files": [