next-box 2.0.1 → 2.0.2

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.
@@ -13,6 +13,11 @@ export declare enum ExtensionType {
13
13
  File = "file",
14
14
  WorkDir = "work_dir"
15
15
  }
16
+ export declare enum ExtensionFileMode {
17
+ Read = "read",
18
+ Write = "write",
19
+ ReadAndWrite = "read_and_write"
20
+ }
16
21
  export interface StaticFile {
17
22
  file_path: string;
18
23
  }
@@ -0,0 +1,30 @@
1
+ import { ExtensionFileMode, ExtensionType, Lang } from './base';
2
+ export interface AppConfig {
3
+ version: string;
4
+ uniq_key: string;
5
+ icon: string;
6
+ name: Lang;
7
+ description: Lang;
8
+ type: ExtensionType;
9
+ file?: {
10
+ mode: ExtensionFileMode;
11
+ ext: string[];
12
+ index: string;
13
+ };
14
+ app?: {
15
+ menu: {
16
+ index: string;
17
+ icon: string;
18
+ label: {
19
+ [key: string]: string;
20
+ };
21
+ };
22
+ };
23
+ work_dir?: {
24
+ index: string;
25
+ };
26
+ change_log?: {
27
+ version: string;
28
+ comment: Lang;
29
+ }[];
30
+ }
package/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PolymaticaApi=t():e.PolymaticaApi=t()}(globalThis,(()=>(()=>{"use strict";var e={181:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(481),t),o(n(861),t)},481:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.StaticApi=void 0;var i=n(892),a=n(307),s=n(392),p="static/files",c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.upload=function(e,t,n){void 0===n&&(n="");var r=new FormData;return r.set("file",e),(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,n,t),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:r}).then((function(e){return e.json()}))},t.prototype.get=function(e){return(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,e),{method:"GET"})},t.prototype.delete=function(e){return(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,e),{method:"DELETE"}).catch((function(e){return e}))},t}(i.Api);t.StaticApi=c},861:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageApi=void 0;var a=n(307),s=n(892),p=n(566),c=n(392),u=n(299),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.info=function(e){return(0,c.sendRequest)(this.makeApiPath("/element")+this.makeSearchParams({path:e}),{headers:this.makeHeaders(),method:"GET",cache:"no-cache"}).then(this.responseJSON)},t.prototype.create=function(e,t,n){return(0,c.sendRequest)(this.makeApiPath("/element"),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:JSON.stringify({name:e,path:this.relativePath(t),type:n,divide_id:this.state.api.query.divide_id||null})}).then(this.responseJSON)},t.prototype.delete=function(e,t){return(0,c.sendRequest)(this.makeApiPath("/element")+this.makeSearchParams({path:e,hard:t}),{method:"DELETE",headers:this.makeHeaders()})},t.prototype.download=function(e){return(0,c.sendRequest)(this.makeApiPath("/files")+this.makeSearchParams({path:this.relativePath(e,this.state.storage.path),t:Date.now()}),{headers:this.makeHeaders(),method:"GET",cache:"no-cache"})},t.prototype.replace=function(e,t){return(0,c.sendRequest)(this.makeApiPath("/files")+this.makeSearchParams({path:this.relativePath(t,this.state.storage.path)}),{cache:"no-cache",method:"PUT",body:e,headers:this.makeHeaders()}).then(this.responseJSON)},t.prototype.upload=function(e,t){var n=new FormData;return n.set("path",this.relativePath(e)),n.set("file",t),(0,c.sendRequest)(this.makeApiPath("/files"),{method:"POST",body:n,headers:this.makeHeaders()}).then(this.responseJSON)},t.prototype.uploadNet=function(e,t,n){return void 0===n&&(n=!1),(0,c.sendRequest)(this.makeApiPath("/files/net"),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:JSON.stringify({url:t,overwrite:n,path:this.relativePath(e)})}).then(this.responseJSON)},t.prototype.createMeta=function(e,t){return this.create(e||this.metaName,t||"","file")},t.prototype.readMeta=function(e){return this.download(e||this.metaName)},t.prototype.saveMeta=function(e,t){return this.replace(e,t||this.metaName)},t.prototype.relativePath=function(e,t){return!e&&t?t||"":(0,a.pathJoin)(this.state.storage.info.dir||"",e||"")},t.prototype.makeApiPath=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="storage";return"fca"===this.state.storage.root&&(n="disk/".concat(this.state.storage.rootID)),decodeURI(a.pathJoin.apply(void 0,i([this.state.api.prefix,n],e,!1)))},Object.defineProperty(t.prototype,"metaName",{get:function(){return"."+(0,u.translite)((0,p.getLang)(this.state.extenstion.name))},enumerable:!1,configurable:!0}),t}(s.Api);t.StorageApi=l},892:function(e,t){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;var r=function(){function e(e){this.state=e}return e.prototype.makeSearchParams=function(e){return e=n(n({},this.state.api.query),e),"?"+new URLSearchParams(e)},e.prototype.makeHeaders=function(e){return n(n({},e),this.state.api.headers)},e.prototype.responseJSON=function(e){return 200===e.status?e.json():Promise.resolve({error:"Parse error"})},e}();t.Api=r},970:function(e,t){var n=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter=void 0;var r=function(){function e(){this._handlers=new Map,this._globalHandlers=new Set}return e.prototype.listen=function(e){this._globalHandlers.add(e)},e.prototype.on=function(e,t){var n;this._handlers.has(e)||this._handlers.set(e,new Set),null===(n=this._handlers.get(e))||void 0===n||n.add(t)},e.prototype.off=function(e,t){var n;null===(n=this._handlers.get(e))||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];null===(t=this._handlers.get(e))||void 0===t||t.forEach((function(e){e&&e.apply(void 0,r)})),this._globalHandlers.forEach((function(t){t.apply(void 0,n([e],r,!1))}))},e}();t.EventEmitter=r},534:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(892),t),o(n(970),t)},755:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultState=void 0;var r=n(796);t.DefaultState=function(){return{extenstion:{id:0,name:{},type:r.ExtensionType.File},api:{host:"",prefix:"",headers:{},query:{}},debug:!0,view:r.ViewState.view,brouserURL:"",storage:{root:"me",rootID:0,path:"",info:{base:"",dir:"",ext:"",name:"",root:""}}}}},223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dirname=void 0;var r=n(307);t.dirname=function(e){if(0===(e=(0,r.pathJoin)("/",e)).length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)}},572:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fileInfo=void 0;var r=n(307);t.fileInfo=function(e){var t={root:"",dir:"",base:"",ext:"",name:""};if(0===(e=(0,r.pathJoin)("/",e)).length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var a=-1,s=0,p=-1,c=!0,u=e.length-1,l=0;u>=n;--u)if(47!==(o=e.charCodeAt(u)))-1===p&&(c=!1,p=u+1),46===o?-1===a?a=u:1!==l&&(l=1):-1!==a&&(l=-1);else if(!c){s=u+1;break}return-1===a||-1===p||0===l||1===l&&a===p-1&&a===s+1?-1!==p&&(t.base=t.name=0===s&&i?e.slice(1,p):e.slice(s,p)):(0===s&&i?(t.name=e.slice(1,a),t.base=e.slice(1,p)):(t.name=e.slice(s,a),t.base=e.slice(s,p)),t.ext=e.slice(a,p)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir="/"),t}},566:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getLang=void 0,t.getLang=function(e,t){if(void 0===t&&(t="ru"),e[t])return e[t];var n=Object.keys(e).pop();return n&&e[n]?e[n]:""}},462:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(223),t),o(n(572),t),o(n(566),t),o(n(719),t),o(n(307),t),o(n(392),t),o(n(299),t)},719:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parentURL=void 0,t.parentURL=function(){return new URL(window.location!=window.parent.location?document.referrer:document.location.href)}},307:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pathJoin=void 0,t.pathJoin=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],r=0,o=e.length;r<o;r++)n=n.concat(e[r].split("/"));var i=[];for(r=0,o=n.length;r<o;r++){var a=n[r];a&&"."!==a&&(".."===a?i.pop():i.push(a))}return""===n[0]&&i.unshift(""),i.join("/")||(i.length?"/":".")}},392:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=void 0;var r=n(831),o=n(512),i=n(719);t.sendRequest=function(e,t){var n=(0,i.parentURL)().origin,a=new URL(e,n);return fetch(a,t).then((function(e){return parent!==window&&([401].includes(e.status)&&(parent.location.href="/auth"),(400===e.status||e.status>401)&&r.Transport.send(o.TransportEvent.ExtRequestError,e)),e}))}},299:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.translite=void 0;var n={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"i",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"cz",ш:"sh",щ:"scz",ы:"y",ь:"",э:"e",ю:"u",я:"ja"," ":"-"};t.translite=function(e){return(e=(e=(e=(e=(e=e.toLocaleLowerCase()).trim()).replace(/ -/gi,"-")).replace(/- /gi,"-")).replace(/\s{2,}/gi," ")).split("").map((function(e){return/[a-z0-9]/i.test(e)?e:n[e]||""})).join("")}},495:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.NextBox=void 0;var a=n(970),s=n(755),p=n(831),c=n(512),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.init=function(e){var t=this,n=function(e){return t.state=e};if(!p.Transport.engineType){var r=(0,s.DefaultState)();n(r),e&&e(r)}p.Transport.on(c.TransportEvent.AppReady,(function(t){n(t),e&&e(t)})),p.Transport.on(c.TransportEvent.AppChangeState,n),p.Transport.send(c.TransportEvent.ExtInit)},t.prototype.changeContent=function(e){p.Transport.send(c.TransportEvent.ExtChangeContent,e)},t.prototype.navigate=function(e,t){p.Transport.send(c.TransportEvent.ExtNavigateTo,{path:e,queryParams:t})},t.prototype.close=function(){p.Transport.send(c.TransportEvent.ExtClose)},t.prototype.openModalFilesSelect=function(e){p.Transport.send(c.TransportEvent.ExtOpenModalFilesSelect,e)},t.prototype.on=function(t,n){var r;return(null===(r=this.state)||void 0===r?void 0:r.debug)&&console.log("on",t,n),e.prototype.on.call(this,t,n)},t.prototype.off=function(t,n){var r;return(null===(r=this.state)||void 0===r?void 0:r.debug)&&console.log("off",t,n),e.prototype.off.call(this,t,n)},t.prototype.emit=function(t){for(var n,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return(null===(n=this.state)||void 0===n?void 0:n.debug)&&console.log("emit",t,r),e.prototype.emit.apply(this,i([t],r,!1))},t}(a.EventEmitter);t.NextBox=u},176:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(595),t),o(n(831),t)},595:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},521:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TransportPostMessage=void 0;var n=function(){function e(){}return e.prototype.send=function(e,t){if(parent!==window){var n=new URL(window.location!=window.parent.location?document.referrer:document.location.href);parent.postMessage({event:e,payload:t},n.origin)}},e.prototype.subscribe=function(e){window.addEventListener("message",(function(t){var n=t.data.event,r=t.data.payload;e(n,r)}))},e}();t.TransportPostMessage=n},831:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.Transport=void 0;var i=n(970),a=n(521),s=function(e){function t(){var t=e.call(this)||this;t.engineType="",t.debug=!1;var n=new URLSearchParams(window.location.search);return t.engineType=n.get("engine")||"",t.engine=new a.TransportPostMessage,t}return o(t,e),t.prototype.send=function(e,t){this.engine.send(e,t)},t.prototype.subscribe=function(){var e=this;this.engine.subscribe((function(t,n){t&&(e.debug&&console.log("frame.message",t,n),e.emit(t,n))}))},t}(i.EventEmitter);window._nb_transport instanceof s||(window._nb_transport=new s),t.Transport=window._nb_transport},85:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionType=void 0,(n=t.ExtensionType||(t.ExtensionType={})).App="app",n.File="file",n.WorkDir="work_dir"},796:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(85),t),o(n(492),t),o(n(517),t),o(n(512),t)},492:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ViewState=void 0,(n=t.ViewState||(t.ViewState={})).view="view",n.edit="edit"},517:(e,t)=>{var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.StorageElementContentType=t.StorageElementType=void 0,(r=t.StorageElementType||(t.StorageElementType={})).Dir="dir",r.File="file",r.WorkDir="work_dir",(n=t.StorageElementContentType||(t.StorageElementContentType={})).Any="any",n.Dir="dir",n.Code="code",n.Image="image",n.Audio="audio",n.Video="video",n.Text="text",n.Doc="doc",n.Xls="xls",n.Ppt="ppt"},512:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportEvent=void 0,(n=t.TransportEvent||(t.TransportEvent={})).ExtInit="ext-init",n.ExtChangeContent="ext-change-content",n.ExtOpenModalFilesSelect="ext-open-modal-files-select",n.ExtShowConfirm="ext-show-confirm",n.ExtNavigateTo="ext-navigate-to",n.ExtRequestError="ext-request-error",n.ExtClose="ext-close",n.AppReady="app-ready",n.AppChangeState="app-change-state",n.AppSaveAndClose="app-save-and-close",n.AppFilesSelected="app-files-selected",n.AppConfirmAccept="app-confirm-accept",n.AppConfirmReject="app-confirm-reject"},607:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(495),t),o(n(796),t),o(n(176),t),o(n(462),t),o(n(534),t),o(n(181),t)}},t={};return function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607)})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PolymaticaApi=t():e.PolymaticaApi=t()}(globalThis,(()=>(()=>{"use strict";var e={181:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(481),t),o(n(861),t)},481:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.StaticApi=void 0;var i=n(892),a=n(307),s=n(392),p="static/files",c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.upload=function(e,t,n){void 0===n&&(n="");var r=new FormData;return r.set("file",e),(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,n,t),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:r}).then((function(e){return e.json()}))},t.prototype.get=function(e){return(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,e),{method:"GET"})},t.prototype.delete=function(e){return(0,s.sendRequest)((0,a.pathJoin)(this.state.api.prefix,p,e),{method:"DELETE"}).catch((function(e){return e}))},t}(i.Api);t.StaticApi=c},861:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageApi=void 0;var a=n(307),s=n(892),p=n(566),c=n(392),u=n(299),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.info=function(e){return(0,c.sendRequest)(this.makeApiPath("/element")+this.makeSearchParams({path:e}),{headers:this.makeHeaders(),method:"GET",cache:"no-cache"}).then(this.responseJSON)},t.prototype.create=function(e,t,n){return(0,c.sendRequest)(this.makeApiPath("/element"),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:JSON.stringify({name:e,path:this.relativePath(t),type:n,divide_id:this.state.api.query.divide_id||null})}).then(this.responseJSON)},t.prototype.delete=function(e,t){return(0,c.sendRequest)(this.makeApiPath("/element")+this.makeSearchParams({path:e,hard:t}),{method:"DELETE",headers:this.makeHeaders()})},t.prototype.download=function(e){return(0,c.sendRequest)(this.makeApiPath("/files")+this.makeSearchParams({path:this.relativePath(e,this.state.storage.path),t:Date.now()}),{headers:this.makeHeaders(),method:"GET",cache:"no-cache"})},t.prototype.replace=function(e,t){return(0,c.sendRequest)(this.makeApiPath("/files")+this.makeSearchParams({path:this.relativePath(t,this.state.storage.path)}),{cache:"no-cache",method:"PUT",body:e,headers:this.makeHeaders()}).then(this.responseJSON)},t.prototype.upload=function(e,t){var n=new FormData;return n.set("path",this.relativePath(e)),n.set("file",t),(0,c.sendRequest)(this.makeApiPath("/files"),{method:"POST",body:n,headers:this.makeHeaders()}).then(this.responseJSON)},t.prototype.uploadNet=function(e,t,n){return void 0===n&&(n=!1),(0,c.sendRequest)(this.makeApiPath("/files/net"),{method:"POST",headers:this.makeHeaders({"Content-Type":"application/json"}),body:JSON.stringify({url:t,overwrite:n,path:this.relativePath(e)})}).then(this.responseJSON)},t.prototype.createMeta=function(e,t){return this.create(e||this.metaName,t||"","file")},t.prototype.readMeta=function(e){return this.download(e||this.metaName)},t.prototype.saveMeta=function(e,t){return this.replace(e,t||this.metaName)},t.prototype.relativePath=function(e,t){return!e&&t?t||"":(0,a.pathJoin)(this.state.storage.info.dir||"",e||"")},t.prototype.makeApiPath=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="storage";return"fca"===this.state.storage.root&&(n="disk/".concat(this.state.storage.rootID)),decodeURI(a.pathJoin.apply(void 0,i([this.state.api.prefix,n],e,!1)))},Object.defineProperty(t.prototype,"metaName",{get:function(){return"."+(0,u.translite)((0,p.getLang)(this.state.extenstion.name))},enumerable:!1,configurable:!0}),t}(s.Api);t.StorageApi=l},892:function(e,t){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;var r=function(){function e(e){this.state=e}return e.prototype.makeSearchParams=function(e){return e=n(n({},this.state.api.query),e),"?"+new URLSearchParams(e)},e.prototype.makeHeaders=function(e){return n(n({},e),this.state.api.headers)},e.prototype.responseJSON=function(e){return 200===e.status?e.json():Promise.resolve({error:"Parse error"})},e}();t.Api=r},970:function(e,t){var n=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.EventEmitter=void 0;var r=function(){function e(){this._handlers=new Map,this._globalHandlers=new Set}return e.prototype.listen=function(e){this._globalHandlers.add(e)},e.prototype.on=function(e,t){var n;this._handlers.has(e)||this._handlers.set(e,new Set),null===(n=this._handlers.get(e))||void 0===n||n.add(t)},e.prototype.off=function(e,t){var n;null===(n=this._handlers.get(e))||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];null===(t=this._handlers.get(e))||void 0===t||t.forEach((function(e){e&&e.apply(void 0,r)})),this._globalHandlers.forEach((function(t){t.apply(void 0,n([e],r,!1))}))},e}();t.EventEmitter=r},534:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(892),t),o(n(970),t)},755:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultState=void 0;var r=n(796);t.DefaultState=function(){return{extenstion:{id:0,name:{},type:r.ExtensionType.File},api:{host:"",prefix:"",headers:{},query:{}},debug:!0,view:r.ViewState.view,brouserURL:"",storage:{root:"me",rootID:0,path:"",info:{base:"",dir:"",ext:"",name:"",root:""}}}}},223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dirname=void 0;var r=n(307);t.dirname=function(e){if(0===(e=(0,r.pathJoin)("/",e)).length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)}},572:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fileInfo=void 0;var r=n(307);t.fileInfo=function(e){var t={root:"",dir:"",base:"",ext:"",name:""};if(0===(e=(0,r.pathJoin)("/",e)).length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var a=-1,s=0,p=-1,c=!0,u=e.length-1,l=0;u>=n;--u)if(47!==(o=e.charCodeAt(u)))-1===p&&(c=!1,p=u+1),46===o?-1===a?a=u:1!==l&&(l=1):-1!==a&&(l=-1);else if(!c){s=u+1;break}return-1===a||-1===p||0===l||1===l&&a===p-1&&a===s+1?-1!==p&&(t.base=t.name=0===s&&i?e.slice(1,p):e.slice(s,p)):(0===s&&i?(t.name=e.slice(1,a),t.base=e.slice(1,p)):(t.name=e.slice(s,a),t.base=e.slice(s,p)),t.ext=e.slice(a,p)),s>0?t.dir=e.slice(0,s-1):i&&(t.dir="/"),t}},566:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getLang=void 0,t.getLang=function(e,t){if(void 0===t&&(t="ru"),e[t])return e[t];var n=Object.keys(e).pop();return n&&e[n]?e[n]:""}},462:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(223),t),o(n(572),t),o(n(566),t),o(n(719),t),o(n(307),t),o(n(392),t),o(n(299),t)},719:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.parentURL=void 0,t.parentURL=function(){return new URL(window.location!=window.parent.location?document.referrer:document.location.href)}},307:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.pathJoin=void 0,t.pathJoin=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],r=0,o=e.length;r<o;r++)n=n.concat(e[r].split("/"));var i=[];for(r=0,o=n.length;r<o;r++){var a=n[r];a&&"."!==a&&(".."===a?i.pop():i.push(a))}return""===n[0]&&i.unshift(""),i.join("/")||(i.length?"/":".")}},392:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sendRequest=void 0;var r=n(831),o=n(512),i=n(719);t.sendRequest=function(e,t){var n=(0,i.parentURL)().origin,a=new URL(e,n);return fetch(a,t).then((function(e){return parent!==window&&([401].includes(e.status)&&(parent.location.href="/auth"),(400===e.status||e.status>401)&&r.Transport.send(o.TransportEvent.ExtRequestError,e)),e}))}},299:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.translite=void 0;var n={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"i",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"cz",ш:"sh",щ:"scz",ы:"y",ь:"",э:"e",ю:"u",я:"ja"," ":"-"};t.translite=function(e){return(e=(e=(e=(e=(e=e.toLocaleLowerCase()).trim()).replace(/ -/gi,"-")).replace(/- /gi,"-")).replace(/\s{2,}/gi," ")).split("").map((function(e){return/[a-z0-9]/i.test(e)?e:n[e]||""})).join("")}},495:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.NextBox=void 0;var a=n(970),s=n(755),p=n(831),c=n(512),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.init=function(e){var t=this,n=function(e){return t.state=e};if(!p.Transport.engineType){var r=(0,s.DefaultState)();n(r),e&&e(r)}p.Transport.on(c.TransportEvent.AppReady,(function(t){n(t),e&&e(t)})),p.Transport.on(c.TransportEvent.AppChangeState,n),p.Transport.send(c.TransportEvent.ExtInit)},t.prototype.changeContent=function(e){p.Transport.send(c.TransportEvent.ExtChangeContent,e)},t.prototype.navigate=function(e,t){p.Transport.send(c.TransportEvent.ExtNavigateTo,{path:e,queryParams:t})},t.prototype.close=function(){p.Transport.send(c.TransportEvent.ExtClose)},t.prototype.openModalFilesSelect=function(e){p.Transport.send(c.TransportEvent.ExtOpenModalFilesSelect,e)},t.prototype.on=function(t,n){var r;return(null===(r=this.state)||void 0===r?void 0:r.debug)&&console.log("on",t,n),e.prototype.on.call(this,t,n)},t.prototype.off=function(t,n){var r;return(null===(r=this.state)||void 0===r?void 0:r.debug)&&console.log("off",t,n),e.prototype.off.call(this,t,n)},t.prototype.emit=function(t){for(var n,r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return(null===(n=this.state)||void 0===n?void 0:n.debug)&&console.log("emit",t,r),e.prototype.emit.apply(this,i([t],r,!1))},t}(a.EventEmitter);t.NextBox=u},176:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(595),t),o(n(831),t)},595:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},521:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TransportPostMessage=void 0;var n=function(){function e(){}return e.prototype.send=function(e,t){if(parent!==window){var n=new URL(window.location!=window.parent.location?document.referrer:document.location.href);parent.postMessage({event:e,payload:t},n.origin)}},e.prototype.subscribe=function(e){window.addEventListener("message",(function(t){var n=t.data.event,r=t.data.payload;e(n,r)}))},e}();t.TransportPostMessage=n},831:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.Transport=void 0;var i=n(970),a=n(521),s=function(e){function t(){var t=e.call(this)||this;t.engineType="",t.debug=!1;var n=new URLSearchParams(window.location.search);return t.engineType=n.get("engine")||"",t.engine=new a.TransportPostMessage,t}return o(t,e),t.prototype.send=function(e,t){this.engine.send(e,t)},t.prototype.subscribe=function(){var e=this;this.engine.subscribe((function(t,n){t&&(e.debug&&console.log("frame.message",t,n),e.emit(t,n))}))},t}(i.EventEmitter);window._nb_transport instanceof s||(window._nb_transport=new s),t.Transport=window._nb_transport},85:(e,t)=>{var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ExtensionFileMode=t.ExtensionType=void 0,(r=t.ExtensionType||(t.ExtensionType={})).App="app",r.File="file",r.WorkDir="work_dir",(n=t.ExtensionFileMode||(t.ExtensionFileMode={})).Read="read",n.Write="write",n.ReadAndWrite="read_and_write"},796:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(85),t),o(n(492),t),o(n(517),t),o(n(512),t)},492:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ViewState=void 0,(n=t.ViewState||(t.ViewState={})).view="view",n.edit="edit"},517:(e,t)=>{var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.StorageElementContentType=t.StorageElementType=void 0,(r=t.StorageElementType||(t.StorageElementType={})).Dir="dir",r.File="file",r.WorkDir="work_dir",(n=t.StorageElementContentType||(t.StorageElementContentType={})).Any="any",n.Dir="dir",n.Code="code",n.Image="image",n.Audio="audio",n.Video="video",n.Text="text",n.Doc="doc",n.Xls="xls",n.Ppt="ppt"},512:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TransportEvent=void 0,(n=t.TransportEvent||(t.TransportEvent={})).ExtInit="ext-init",n.ExtChangeContent="ext-change-content",n.ExtOpenModalFilesSelect="ext-open-modal-files-select",n.ExtShowConfirm="ext-show-confirm",n.ExtNavigateTo="ext-navigate-to",n.ExtRequestError="ext-request-error",n.ExtClose="ext-close",n.AppReady="app-ready",n.AppChangeState="app-change-state",n.AppSaveAndClose="app-save-and-close",n.AppFilesSelected="app-files-selected",n.AppConfirmAccept="app-confirm-accept",n.AppConfirmReject="app-confirm-reject"},607:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(495),t),o(n(796),t),o(n(176),t),o(n(462),t),o(n(534),t),o(n(181),t)}},t={};return function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607)})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-box",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",