', { id: 'cp-creation-container' }).appendTo($body);
@@ -2524,6 +2534,14 @@ define([
todo(res.data);
});
}
+ else if (fromContent) {
+ allData = [{
+ name: fromContent.title,
+ id: 0,
+ icon: h('span.cptools.cptools-poll'),
+ }];
+ redraw(0);
+ }
else {
redraw(0);
}
diff --git a/www/common/common-util.js b/www/common/common-util.js
index bec6cb125..efcb46227 100644
--- a/www/common/common-util.js
+++ b/www/common/common-util.js
@@ -575,6 +575,26 @@
return false;
};
+ // Tell if a file is spreadsheet from its metadata={title, fileType}
+ Util.isSpreadsheet = function (type, name) {
+ return (type &&
+ (type === 'application/vnd.oasis.opendocument.spreadsheet' ||
+ type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'))
+ || (name && (name.endsWith('.xlsx') || name.endsWith('.ods')));
+ };
+ Util.isOfficeDoc = function (type, name) {
+ return (type &&
+ (type === 'application/vnd.oasis.opendocument.text' ||
+ type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))
+ || (name && (name.endsWith('.docx') || name.endsWith('.odt')));
+ };
+ Util.isPresentation = function (type, name) {
+ return (type &&
+ (type === 'application/vnd.oasis.opendocument.presentation' ||
+ type === 'application/vnd.openxmlformats-officedocument.presentationml.presentation'))
+ || (name && (name.endsWith('.pptx') || name.endsWith('.odp')));
+ };
+
Util.isValidURL = function (str) {
var pattern = new RegExp('^(https?:\\/\\/)'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
@@ -618,6 +638,49 @@
getColor().toString(16);
};
+ Util.checkRestrictedApp = function (app, AppConfig, earlyTypes, plan, loggedIn) {
+ // If this is an early access app, make sure this instance allows them
+ if (Array.isArray(earlyTypes) && earlyTypes.includes(app) && !AppConfig.enableEarlyAccess) {
+ return -2;
+ }
+
+ var premiumTypes = AppConfig.premiumTypes;
+ // If this is not a premium app, don't disable it
+ if (!Array.isArray(premiumTypes) || !premiumTypes.includes(app)) { return 2; }
+ // This is a premium app
+ // if you're not logged in, disable it
+ if (!loggedIn) { return -1; }
+ // if you're logged in, enable it only if you're a premium user
+ return plan ? 1 : 0;
+
+ };
+
+ /* Chrome 92 dropped support for SharedArrayBuffer in cross-origin contexts
+ where window.crossOriginIsolated is false.
+
+ Their blog (https://blog.chromium.org/2021/02/restriction-on-sharedarraybuffers.html)
+ isn't clear about why they're doing this, but since it's related to site-isolation
+ it seems they're trying to do vague security things.
+
+ In any case, there seems to be a workaround where you can still create them
+ by using `new WebAssembly.Memory({shared: true, ...})` instead of `new SharedArrayBuffer`.
+
+ This seems unreliable, but it's better than not being able to export, since
+ we actively rely on postMessage between iframes and therefore can't afford
+ to opt for full isolation.
+ */
+ var supportsSharedArrayBuffers = function () {
+ try {
+ return Object.prototype.toString.call(new window.WebAssembly.Memory({shared: true, initial: 0, maximum: 0}).buffer) === '[object SharedArrayBuffer]';
+ } catch (err) {
+ console.error(err);
+ }
+ return false;
+ };
+ Util.supportsWasm = function () {
+ return !(typeof(Atomics) === "undefined" || !supportsSharedArrayBuffers() || typeof(WebAssembly) === 'undefined');
+ };
+
if (typeof(module) !== 'undefined' && module.exports) {
module.exports = Util;
} else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) {
diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js
index d2f76ef8d..f4afde7b0 100644
--- a/www/common/drive-ui.js
+++ b/www/common/drive-ui.js
@@ -89,7 +89,6 @@ define([
var faShared = 'fa-shhare-alt';
var faReadOnly = 'fa-eye';
var faPreview = 'fa-eye';
- var faOpenInCode = 'cptools-code';
var faRename = 'fa-pencil';
var faColor = 'cptools-palette';
var faTrash = 'fa-trash';
@@ -332,7 +331,26 @@ define([
};
- var createContextMenu = function () {
+ Messages.fc_openIn = "Open in {0}"; // XXX
+ // delete fc_openInCode // XXX
+ var createContextMenu = function (common) {
+ // XXX PREMIUM
+ // XXX "Edit in Document" and "New Document" (and presentation)
+ var premiumP = common.checkRestrictedApp('presentation');
+ var premiumD = common.checkRestrictedApp('doc');
+ var getOpenIn = function (app) {
+ var icon = AppConfig.applicationsIcon[app];
+ var cls = icon.indexOf('cptools') === 0 ? 'cptools '+icon : 'fa '+icon;
+ var html = '
' + Messages.type[app];
+ return Messages._getKey('fc_openIn', [html]);
+ };
+ var isAppEnabled = function (app) {
+ if (!Array.isArray(AppConfig.availablePadTypes)) { return true; }
+ var registered = common.isLoggedIn() || !(AppConfig.registeredOnlyTypes || []).includes(app);
+ var restricted = common.checkRestrictedApp(app) < 0;
+ if (restricted === 0) { return 0; }
+ return AppConfig.availablePadTypes.includes(app) && registered && !restricted;
+ };
var menu = h('div.cp-contextmenu.dropdown.cp-unselectable', [
h('ul.dropdown-menu', {
'role': 'menu',
@@ -352,10 +370,22 @@ define([
'tabindex': '-1',
'data-icon': faReadOnly,
}, h('span.cp-text', Messages.fc_open_ro))),
- h('li', h('a.cp-app-drive-context-openincode.dropdown-item', {
+ isAppEnabled('code') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openincode.dropdown-item', {
+ 'tabindex': '-1',
+ 'data-icon': 'fa-arrows',
+ }), getOpenIn('code'))) : undefined,
+ isAppEnabled('sheet') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openinsheet.dropdown-item', {
'tabindex': '-1',
- 'data-icon': faOpenInCode,
- }, Messages.fc_openInCode)),
+ 'data-icon': 'fa-arrows',
+ }), getOpenIn('sheet'))) : undefined,
+ isAppEnabled('doc') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openindoc.dropdown-item' + (premiumD === 0 ? '.cp-app-disabled' : ''), {
+ 'tabindex': '-1',
+ 'data-icon': 'fa-arrows',
+ }), getOpenIn('doc'))) : undefined,
+ isAppEnabled('presentation') ? h('li', UI.setHTML(h('a.cp-app-drive-context-openinpresentation.dropdown-item' + (premiumP === 0 ? '.cp-app-disabled' : ''), {
+ 'tabindex': '-1',
+ 'data-icon': 'fa-arrows',
+ }), getOpenIn('presentation'))) : undefined,
h('li', h('a.cp-app-drive-context-savelocal.dropdown-item', {
'tabindex': '-1',
'data-icon': 'fa-cloud-upload',
@@ -402,47 +432,57 @@ define([
'data-icon': faUploadFolder,
}, Messages.uploadFolderButton)),
$separator.clone()[0],
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ isAppEnabled('pad') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.pad,
'data-type': 'pad'
- }, Messages.button_newpad)),
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ }, Messages.button_newpad)) : undefined,
+ isAppEnabled('code') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.code,
'data-type': 'code'
- }, Messages.button_newcode)),
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ }, Messages.button_newcode)) : undefined,
+ isAppEnabled('sheet') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
- 'data-icon': AppConfig.applicationsIcon.slide,
- 'data-type': 'slide'
- }, Messages.button_newslide)),
+ 'data-icon': AppConfig.applicationsIcon.sheet,
+ 'data-type': 'sheet'
+ }, Messages.button_newsheet)) : undefined,
h('li.dropdown-submenu', [
h('a.cp-app-drive-context-newdocmenu.dropdown-item', {
'tabindex': '-1',
'data-icon': "fa-plus",
}, Messages.fm_morePads),
h("ul.dropdown-menu", [
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ isAppEnabled('doc') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable' + (premiumD === 0 ? '.cp-app-disabled' : ''), {
'tabindex': '-1',
- 'data-icon': AppConfig.applicationsIcon.sheet,
- 'data-type': 'sheet'
- }, Messages.button_newsheet)),
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ 'data-icon': AppConfig.applicationsIcon.doc,
+ 'data-type': 'doc'
+ }, Messages.button_newdoc)) : undefined,
+ isAppEnabled('presentation') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable' + (premiumP === 0 ? '.cp-app-disabled' : ''), {
+ 'tabindex': '-1',
+ 'data-icon': AppConfig.applicationsIcon.presentation,
+ 'data-type': 'presentation'
+ }, Messages.button_newpresentation)) : undefined,
+ isAppEnabled('whiteboard') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.whiteboard,
'data-type': 'whiteboard'
- }, Messages.button_newwhiteboard)),
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ }, Messages.button_newwhiteboard)) : undefined,
+ isAppEnabled('kanban') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.kanban,
'data-type': 'kanban'
- }, Messages.button_newkanban)),
- h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ }, Messages.button_newkanban)) : undefined,
+ isAppEnabled('form') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
+ 'tabindex': '-1',
+ 'data-icon': AppConfig.applicationsIcon.form,
+ 'data-type': 'form'
+ }, Messages.button_newform)) : undefined,
+ isAppEnabled('slide') ? h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
- 'data-icon': AppConfig.applicationsIcon.poll,
- 'data-type': 'poll'
- }, Messages.button_newpoll)),
+ 'data-icon': AppConfig.applicationsIcon.slide,
+ 'data-type': 'slide'
+ }, Messages.button_newslide)) : undefined,
h('li', h('a.cp-app-drive-context-newdoc.dropdown-item.cp-app-drive-context-editable', {
'tabindex': '-1',
'data-icon': AppConfig.applicationsIcon.link,
@@ -613,7 +653,7 @@ define([
var $content = APP.$content = $("#cp-app-drive-content");
var $appContainer = $(".cp-app-drive-container");
var $driveToolbar = APP.toolbar.$bottom;
- var $contextMenu = createContextMenu().appendTo($appContainer);
+ var $contextMenu = createContextMenu(common).appendTo($appContainer);
var $contentContextMenu = $("#cp-app-drive-context-content");
var $defaultContextMenu = $("#cp-app-drive-context-default");
@@ -625,7 +665,7 @@ define([
// DRIVE
var currentPath = APP.currentPath = LS.getLastOpenedFolder();
if (APP.newSharedFolder) {
- var newSFPaths = manager.findFile(APP.newSharedFolder);
+ var newSFPaths = manager.findFile(Number(APP.newSharedFolder));
if (newSFPaths.length) {
currentPath = newSFPaths[0];
}
@@ -654,6 +694,8 @@ define([
displayedCategories = [FILES_DATA];
currentPath = [FILES_DATA];
}
+ } else if (priv.isEmbed && APP.newSharedFolder) {
+ displayedCategories = [ROOT, TRASH];
}
APP.editable = !APP.readOnly;
@@ -1275,7 +1317,7 @@ define([
hide.push('preview');
}
if ($element.is('.cp-border-color-sheet')) {
- hide.push('download');
+ //hide.push('download'); // XXX if we don't want to enable this feature yet
}
if ($element.is('.cp-app-drive-static')) {
hide.push('access', 'hashtag', 'properties', 'download');
@@ -1293,6 +1335,18 @@ define([
if (!metadata || !Util.isPlainTextFile(metadata.fileType, metadata.title)) {
hide.push('openincode');
}
+ if (!metadata || !Util.isSpreadsheet(metadata.fileType, metadata.title)
+ || !priv.supportsWasm) {
+ hide.push('openinsheet');
+ }
+ if (!metadata || !Util.isOfficeDoc(metadata.fileType, metadata.title)
+ || !priv.supportsWasm) {
+ hide.push('openindoc');
+ }
+ if (!metadata || !Util.isPresentation(metadata.fileType, metadata.title)
+ || !priv.supportsWasm) {
+ hide.push('openinpresentation');
+ }
if (metadata.channel && metadata.channel.length < 48) {
hide.push('preview');
}
@@ -1309,6 +1363,9 @@ define([
containsFolder = true;
hide.push('openro');
hide.push('openincode');
+ hide.push('openinsheet');
+ hide.push('openindoc');
+ hide.push('openinpresentation');
hide.push('hashtag');
//hide.push('delete');
hide.push('makeacopy');
@@ -1324,6 +1381,9 @@ define([
hide.push('savelocal');
hide.push('openro');
hide.push('openincode');
+ hide.push('openinsheet');
+ hide.push('openindoc');
+ hide.push('openinpresentation');
hide.push('properties', 'access');
hide.push('hashtag');
hide.push('makeacopy');
@@ -1355,7 +1415,8 @@ define([
hide.push('download');
hide.push('share');
hide.push('savelocal');
- hide.push('openincode'); // can't because of race condition
+ //hide.push('openincode'); // can't because of race condition
+ //hide.push('openinsheet'); // can't because of race condition
hide.push('makeacopy');
hide.push('preview');
}
@@ -1367,6 +1428,9 @@ define([
if (!APP.loggedIn) {
hide.push('openparent');
hide.push('rename');
+ hide.push('openinsheet');
+ hide.push('openindoc');
+ hide.push('openinpresentation');
}
filter = function ($el, className) {
@@ -1380,11 +1444,12 @@ define([
break;
case 'tree':
show = ['open', 'openro', 'preview', 'openincode', 'expandall', 'collapseall',
- 'color', 'download', 'share', 'savelocal', 'rename', 'delete', 'makeacopy',
+ 'color', 'download', 'share', 'savelocal', 'rename', 'delete',
+ 'makeacopy', 'openinsheet', 'openindoc', 'openinpresentation',
'deleteowned', 'removesf', 'access', 'properties', 'hashtag'];
break;
case 'default':
- show = ['open', 'openro', 'preview', 'openincode', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
+ show = ['open', 'openro', 'preview', 'openincode', 'openinsheet', 'openindoc', 'openinpresentation', 'share', 'download', 'openparent', 'delete', 'deleteowned', 'properties', 'access', 'hashtag', 'makeacopy', 'savelocal', 'rename'];
break;
case 'trashtree': {
show = ['empty'];
@@ -2354,6 +2419,7 @@ define([
path.forEach(function (p, idx) {
if (isTrash && [2,3].indexOf(idx) !== -1) { return; }
if (skipNext) { skipNext = false; return; }
+ if (APP.newSharedFolder && priv.isEmbed && p === ROOT && !idx) { return; }
var name = p;
if (manager.isFile(el) && isInTrashRoot && idx === 1) {
@@ -2394,7 +2460,7 @@ define([
addDragAndDropHandlers($span, path.slice(0, idx), true, true);
if (idx === 0) { name = p === SHARED_FOLDER ? name : getPrettyName(p); }
- else {
+ else if (!(APP.newSharedFolder && priv.isEmbed && idx === 1)) {
var $span2 = $('
', {
'class': 'cp-app-drive-path-element cp-app-drive-path-separator'
}).text(' / ');
@@ -2885,6 +2951,15 @@ define([
'data-type': type,
'href': '#'
};
+
+ // XXX PREMIUM
+ var premium = common.checkRestrictedApp(type);
+ if (premium < 0) {
+ attributes.class += ' cp-app-hidden cp-app-disabled';
+ } else if (premium === 0) {
+ attributes.class += ' cp-app-disabled';
+ }
+
options.push({
tag: 'a',
attributes: attributes,
@@ -3211,6 +3286,14 @@ define([
$element.append($('', {'class': 'cp-app-drive-new-name'})
.text(Messages.type[type]));
$element.attr('data-type', type);
+
+ // XXX PREMIUM
+ var premium = common.checkRestrictedApp(type);
+ if (premium < 0) {
+ $element.addClass('cp-app-hidden cp-app-disabled');
+ } else if (premium === 0) {
+ $element.addClass('cp-app-disabled');
+ }
});
$container.find('.cp-app-drive-element-row').click(function () {
@@ -4062,17 +4145,28 @@ define([
var createTree = function ($container, path) {
var root = manager.find(path);
+ var isRoot = manager.comparePath([ROOT], path);
+ var rootName = ROOT_NAME;
+ if (APP.newSharedFolder && priv.isEmbed && isRoot) {
+ var newSFPaths = manager.findFile(Number(APP.newSharedFolder));
+ if (newSFPaths.length) {
+ path = newSFPaths[0];
+ path.push(ROOT);
+ root = manager.find(path);
+ rootName = manager.getSharedFolderData(APP.newSharedFolder).title;
+ }
+ }
+
// don't try to display what doesn't exist
if (!root) { return; }
// Display the root element in the tree
- var displayingRoot = manager.comparePath([ROOT], path);
- if (displayingRoot) {
- var isRootOpened = manager.comparePath([ROOT], currentPath);
+ if (isRoot) {
+ var isRootOpened = manager.comparePath(path.slice(), currentPath);
var $rootIcon = manager.isFolderEmpty(files[ROOT]) ?
(isRootOpened ? $folderOpenedEmptyIcon : $folderEmptyIcon) :
(isRootOpened ? $folderOpenedIcon : $folderIcon);
- var $rootElement = createTreeElement(ROOT_NAME, $rootIcon.clone(), [ROOT], false, true, true, isRootOpened);
+ var $rootElement = createTreeElement(rootName, $rootIcon.clone(), path.slice(), false, true, true, isRootOpened);
if (!manager.hasSubfolder(root)) {
$rootElement.find('.cp-app-drive-icon-expcol').css('visibility', 'hidden');
}
@@ -4349,6 +4443,21 @@ define([
});
};
+ var openInApp = function (paths, app) {
+ var p = paths[0];
+ var el = manager.find(p.path);
+ var path = currentPath;
+ if (path[0] !== ROOT) { path = [ROOT]; }
+ var _metadata = manager.getFileData(el);
+ var _simpleData = {
+ title: _metadata.filename || _metadata.title,
+ href: _metadata.href || _metadata.roHref,
+ fileType: _metadata.fileType,
+ password: _metadata.password,
+ channel: _metadata.channel,
+ };
+ openIn(app, path, APP.team, _simpleData);
+ };
$contextMenu.on("click", "a", function(e) {
e.stopPropagation();
@@ -4436,20 +4545,19 @@ define([
}
else if ($this.hasClass('cp-app-drive-context-openincode')) {
if (paths.length !== 1) { return; }
- var p = paths[0];
- el = manager.find(p.path);
- (function () {
- var path = currentPath;
- if (path[0] !== ROOT) { path = [ROOT]; }
- var _metadata = manager.getFileData(el);
- var _simpleData = {
- title: _metadata.filename || _metadata.title,
- href: _metadata.href || _metadata.roHref,
- password: _metadata.password,
- channel: _metadata.channel,
- };
- openIn('code', path, APP.team, _simpleData);
- })();
+ openInApp(paths, 'code');
+ }
+ else if ($this.hasClass('cp-app-drive-context-openinsheet')) {
+ if (paths.length !== 1) { return; }
+ openInApp(paths, 'sheet');
+ }
+ else if ($this.hasClass('cp-app-drive-context-openindoc')) {
+ if (paths.length !== 1) { return; }
+ openInApp(paths, 'doc');
+ }
+ else if ($this.hasClass('cp-app-drive-context-openinpresentation')) {
+ if (paths.length !== 1) { return; }
+ openInApp(paths, 'presentation');
}
else if ($this.hasClass('cp-app-drive-context-expandall') ||
$this.hasClass('cp-app-drive-context-collapseall')) {
diff --git a/www/common/make-backup.js b/www/common/make-backup.js
index 3f66c1310..a80663677 100644
--- a/www/common/make-backup.js
+++ b/www/common/make-backup.js
@@ -28,7 +28,7 @@ define([
return n;
};
- var transform = function (ctx, type, sjson, cb) {
+ var transform = function (ctx, type, sjson, cb, padData) {
var result = {
data: sjson,
ext: '.json',
@@ -41,11 +41,11 @@ define([
}
var path = '/' + type + '/export.js';
require([path], function (Exporter) {
- Exporter.main(json, function (data) {
- result.ext = Exporter.ext || '';
+ Exporter.main(json, function (data, _ext) {
+ result.ext = _ext || Exporter.ext || '';
result.data = data;
cb(result);
- });
+ }, null, ctx.sframeChan, padData);
}, function () {
cb(result);
});
@@ -117,12 +117,16 @@ define([
var opts = {
password: pData.password
};
+ var padData = {
+ hash: parsed.hash,
+ password: pData.password
+ };
var handler = ctx.sframeChan.on("EV_CRYPTGET_PROGRESS", function (data) {
if (data.hash !== parsed.hash) { return; }
updateProgress.progress(data.progress);
if (data.progress === 1) {
handler.stop();
- updateProgress.progress2(1);
+ updateProgress.progress2(2);
}
});
ctx.get({
@@ -136,14 +140,15 @@ define([
if (cancelled) { return; }
if (!res.data) { return; }
var dl = function () {
- saveAs(res.data, Util.fixFileName(name));
+ saveAs(res.data, Util.fixFileName(name)+(res.ext || ''));
};
+ updateProgress.progress2(1);
cb(null, {
metadata: res.metadata,
content: res.data,
download: dl
});
- });
+ }, padData);
});
return {
cancel: cancel
@@ -195,9 +200,16 @@ define([
});
};
+ var timeout = 60000;
+ // OO pads can only be converted one at a time so we have to give them a
+ // bigger timeout value in case there are 5 of them in the current queue
+ if (['sheet', 'doc', 'presentation'].indexOf(parsed.type) !== -1) {
+ timeout = 180000;
+ }
+
to = setTimeout(function () {
error('TIMEOUT');
- }, 60000);
+ }, timeout);
setTimeout(function () {
if (ctx.stop) { return; }
@@ -228,6 +240,9 @@ define([
zip.file(fileName, res.data, opts);
console.log('DONE ---- ' + fileName);
setTimeout(done, 500);
+ }, {
+ hash: parsed.hash,
+ password: fData.password
});
});
};
@@ -292,7 +307,7 @@ define([
};
// Main function. Create the empty zip and fill it starting from drive.root
- var create = function (data, getPad, fileHost, cb, progress, cache) {
+ var create = function (data, getPad, fileHost, cb, progress, cache, sframeChan) {
if (!data || !data.uo || !data.uo.drive) { return void cb('EEMPTY'); }
var sem = Saferphore.create(5);
var ctx = {
@@ -307,7 +322,8 @@ define([
updateProgress: progress,
max: 0,
done: 0,
- cache: cache
+ cache: cache,
+ sframeChan: sframeChan
};
var filesData = data.sharedFolderId && ctx.sf[data.sharedFolderId] ? ctx.sf[data.sharedFolderId].filesData : ctx.data.filesData;
progress('reading', -1); // Msg.settings_export_reading
@@ -358,7 +374,7 @@ define([
else if (state === "done") {
updateProgress.folderProgress(3);
}
- }, ctx.cache);
+ }, ctx.cache, ctx.sframeChan);
};
var createExportUI = function (origin) {
diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js
index b8ae4b77d..c0126023c 100644
--- a/www/common/onlyoffice/history.js
+++ b/www/common/onlyoffice/history.js
@@ -119,7 +119,7 @@ define([
// The first "cp" in history is the empty doc. It doesn't include the first patch
// of the history
- var initialCp = cpIndex === sortedCp.length;
+ var initialCp = cpIndex === sortedCp.length || !cp.hash;
var messages = (data.messages || []).slice(initialCp ? 0 : 1);
diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js
index 195991db9..0454b4bc5 100644
--- a/www/common/onlyoffice/inner.js
+++ b/www/common/onlyoffice/inner.js
@@ -20,6 +20,7 @@ define([
'/common/onlyoffice/oodoc_base.js',
'/common/onlyoffice/ooslide_base.js',
'/common/outer/worker-channel.js',
+ '/common/outer/x2t.js',
'/bower_components/file-saver/FileSaver.min.js',
@@ -47,7 +48,8 @@ define([
EmptyCell,
EmptyDoc,
EmptySlide,
- Channel)
+ Channel,
+ X2T)
{
var saveAs = window.saveAs;
var Nacl = window.nacl;
@@ -56,11 +58,13 @@ define([
urlArgs: Util.find(ApiConfig, ['requireConf', 'urlArgs'])
};
- var CHECKPOINT_INTERVAL = 100;
+ var CHECKPOINT_INTERVAL = 20; // XXX
+ var FORCE_CHECKPOINT_INTERVAL = 50; // XXX
var DISPLAY_RESTORE_BUTTON = false;
- var NEW_VERSION = 4;
+ var NEW_VERSION = 4; // version of the .bin, patches and ChainPad formats
var PENDING_TIMEOUT = 30000;
- var CURRENT_VERSION = 'v4';
+ var CURRENT_VERSION = X2T.CURRENT_VERSION;
+
//var READONLY_REFRESH_TO = 15000;
var debug = function (x, type) {
@@ -72,34 +76,6 @@ define([
return JSONSortify(obj);
};
- /* Chrome 92 dropped support for SharedArrayBuffer in cross-origin contexts
- where window.crossOriginIsolated is false.
-
- Their blog (https://blog.chromium.org/2021/02/restriction-on-sharedarraybuffers.html)
- isn't clear about why they're doing this, but since it's related to site-isolation
- it seems they're trying to do vague security things.
-
- In any case, there seems to be a workaround where you can still create them
- by using `new WebAssembly.Memory({shared: true, ...})` instead of `new SharedArrayBuffer`.
-
- This seems unreliable, but it's better than not being able to export, since
- we actively rely on postMessage between iframes and therefore can't afford
- to opt for full isolation.
- */
- var supportsSharedArrayBuffers = function () {
- try {
- return Object.prototype.toString.call(new window.WebAssembly.Memory({shared: true, initial: 0, maximum: 0}).buffer) === '[object SharedArrayBuffer]';
- } catch (err) {
- console.error(err);
- }
- return false;
- };
-
- var supportsXLSX = function () {
- return !(typeof(Atomics) === "undefined" || !supportsSharedArrayBuffers() /* || typeof (SharedArrayBuffer) === "undefined" */ || typeof(WebAssembly) === 'undefined');
- };
-
-
var toolbar;
var cursor;
@@ -136,6 +112,10 @@ define([
var startOO = function () {};
+ var supportsXLSX = function () {
+ return privateData.supportsWasm;
+ };
+
var getMediasSources = APP.getMediasSources = function() {
content.mediasSources = content.mediasSources || {};
return content.mediasSources;
@@ -145,9 +125,13 @@ define([
return metadataMgr.getNetfluxId() + '-' + privateData.clientId;
};
+ var getWindow = function () {
+ return window.frames && window.frames[0];
+ };
var getEditor = function () {
- if (!window.frames || !window.frames[0]) { return; }
- return window.frames[0].editor || window.frames[0].editorCell;
+ var w = getWindow();
+ if (!w) { return; }
+ return w.editor || w.editorCell;
};
var setEditable = function (state, force) {
@@ -252,6 +236,10 @@ define([
var getFileType = function () {
var type = common.getMetadataMgr().getPrivateData().ooType;
var title = common.getMetadataMgr().getMetadataLazy().title;
+ if (APP.downloadType) {
+ type = APP.downloadType;
+ title = "download";
+ }
var file = {};
switch(type) {
case 'doc':
@@ -478,6 +466,9 @@ define([
delete APP.refreshPopup;
clearTimeout(APP.refreshRoTo);
+ // Don't create the initial checkpoint indefinitely in a loop
+ delete APP.initCheckpoint;
+
if (!isLockedModal.modal) {
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
}
@@ -495,10 +486,10 @@ define([
startOO(blob, type, true);
};
- var saveToServer = function () {
+ var saveToServer = function (blob, title) {
if (APP.cantCheckpoint) { return; } // TOO_LARGE
var text = getContent();
- if (!text) {
+ if (!text && !blob) {
setEditable(false, true);
sframeChan.query('Q_CLEAR_CACHE_CHANNELS', [
'chainpad',
@@ -509,9 +500,9 @@ define([
});
return;
}
- var blob = new Blob([text], {type: 'plain/text'});
+ blob = blob || new Blob([text], {type: 'plain/text'});
var file = getFileType();
- blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
+ blob.name = title || (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
var data = {
hash: (APP.history || APP.template) ? ooChannel.historyLastHash : ooChannel.lastHash,
index: (APP.history || APP.template) ? ooChannel.currentIndex : ooChannel.cpIndex
@@ -539,8 +530,9 @@ define([
var locked = content.saveLock;
var lastCp = getLastCp();
- var needCp = force || ooChannel.cpIndex % CHECKPOINT_INTERVAL === 0 ||
- (ooChannel.cpIndex - (lastCp.index || 0)) > CHECKPOINT_INTERVAL;
+ var currentIdx = ooChannel.cpIndex;
+ var needCp = force || (currentIdx - (lastCp.index || 0)) > FORCE_CHECKPOINT_INTERVAL;
+
if (!needCp) { return; }
if (!locked || !isUserOnline(locked) || force) {
@@ -725,6 +717,7 @@ define([
var cp = hashes[cpId] || {};
var minor = Number(s[1]) + 1;
+ if (APP.isDownload) { minor = undefined; }
var toHash = cp.hash || 'NONE';
var fromHash = nextCpId ? hashes[nextCpId].hash : 'NONE';
@@ -733,6 +726,7 @@ define([
channel: content.channel,
lastKnownHash: fromHash,
toHash: toHash,
+ isDownload: APP.isDownload
}, function (err, data) {
if (err) { console.error(err); return void UI.errorLoadingScreen(Messages.error); }
if (!Array.isArray(data.messages)) {
@@ -742,7 +736,7 @@ define([
// The first "cp" in history is the empty doc. It doesn't include the first patch
// of the history
- var initialCp = major === 0;
+ var initialCp = major === 0 || !cp.hash;
var messages = (data.messages || []).slice(initialCp ? 0 : 1, minor);
messages.forEach(function (obj) {
@@ -784,6 +778,7 @@ define([
}
var file = getFileType();
var type = common.getMetadataMgr().getPrivateData().ooType;
+ if (APP.downloadType) { type = APP.downloadType; }
var blob = loadInitDocument(type, true);
ooChannel.queue = messages;
resetData(blob, file);
@@ -1077,17 +1072,31 @@ define([
return;
}
var type = common.getMetadataMgr().getPrivateData().ooType;
-
- content.locks = content.locks || {};
- // Send the lock to other users
+ var b = obj.block && obj.block[0];
var msg = {
time: now(),
user: myUniqueOOId,
- block: obj.block && obj.block[0],
+ block: b
};
+
+ var editor = getEditor();
+ if (type === "presentation" && (APP.themeChanged || APP.themeRemote) && b &&
+ b.guid === editor.GetPresentation().Presentation.themeLock.Id) {
+ APP.themeLocked = APP.themeChanged;
+ APP.themeChanged = undefined;
+ var fakeLocks = getLock();
+ fakeLocks[Util.uid()] = msg;
+ send({
+ type: "getLock",
+ locks: fakeLocks
+ });
+ return;
+ }
+
+ content.locks = content.locks || {};
+ // Send the lock to other users
var myId = getId();
content.locks[myId] = content.locks[myId] || {};
- var b = obj.block && obj.block[0];
if (type === "sheet" || typeof(b) !== "string") {
var uid = Util.uid();
content.locks[myId][uid] = msg;
@@ -1097,6 +1106,7 @@ define([
oldLocks = JSON.parse(JSON.stringify(content.locks));
// Remove old locks
deleteOfflineLocks();
+
// Prepare callback
if (cpNfInner) {
var waitLock = APP.waitLock = Util.mkEvent(true);
@@ -1138,7 +1148,7 @@ define([
APP.realtime.sync();
};
- var parseChanges = function (changes) {
+ var parseChanges = function (changes, isObj) {
try {
changes = JSON.parse(changes);
} catch (e) {
@@ -1147,7 +1157,7 @@ define([
return changes.map(function (change) {
return {
docid: "fresh",
- change: '"' + change + '"',
+ change: isObj ? change : '"' + change + '"',
time: now(),
user: myUniqueOOId,
useridoriginal: String(myOOId)
@@ -1186,11 +1196,16 @@ define([
return;
}
+ var changes = obj.changes;
+ if (obj.type === "cp_theme") {
+ changes = JSON.stringify([JSON.stringify(obj)]);
+ }
+
// Send the changes
content.locks = content.locks || {};
rtChannel.sendMsg({
type: "saveChanges",
- changes: parseChanges(obj.changes),
+ changes: parseChanges(changes, obj.type === "cp_theme"),
changesIndex: ooChannel.cpIndex || 0,
locks: getUserLock(getId(), true),
excelAdditionalInfo: obj.excelAdditionalInfo
@@ -1224,6 +1239,73 @@ define([
});
};
+ APP.testArr = [
+ ['a','b',1,'d'],
+ ['e',undefined,'g','h']
+ ];
+ var makePatch = APP.makePatch = function (arr) {
+ var w = getWindow();
+ if (!w) { return; }
+ // Define OO classes
+ var AscCommonExcel = w.AscCommonExcel;
+ var CellValueData = AscCommonExcel.UndoRedoData_CellValueData;
+ var CCellValue = AscCommonExcel.CCellValue;
+ //var History = w.AscCommon.History;
+ var AscCH = w.AscCH;
+ var Asc = w.Asc;
+ var UndoRedoData_CellSimpleData = AscCommonExcel.UndoRedoData_CellSimpleData;
+ var editor = getEditor();
+
+ var Id = editor.GetSheet(0).worksheet.Id;
+ //History.Create_NewPoint();
+ var patches = [];
+ arr.forEach(function (arr2, i) {
+ arr2.forEach(function (v, j) {
+ var obj = {};
+ if (typeof(v) === "string") { obj.text = v; obj.type = 1; }
+ else if (typeof(v) === "number") { obj.number = v; obj.type = 0; }
+ else { return; }
+ var newValue = new CellValueData(undefined, new CCellValue(obj));
+ var nCol = j;
+ var nRow = i;
+ var patch = new AscCommonExcel.UndoRedoItemSerializable(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, Id,
+ new Asc.Range(nCol, nRow, nCol, nRow),
+ new UndoRedoData_CellSimpleData(nRow, nCol, undefined, newValue), undefined);
+ patches.push(patch);
+ /*
+ History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_ChangeValue, Id,
+ new Asc.Range(nCol, nRow, nCol, nRow),
+ new UndoRedoData_CellSimpleData(nRow, nCol, undefined, newValue), undefined, true);
+ */
+ });
+ });
+ var oMemory = new w.AscCommon.CMemory();
+ var aRes = [];
+ patches.forEach(function (item) {
+ editor.GetSheet(0).worksheet.workbook._SerializeHistoryBase64(oMemory, item, aRes);
+ });
+
+ // Make the patch
+ var msg = {
+ type: "saveChanges",
+ changes: parseChanges(JSON.stringify(aRes)),
+ changesIndex: ooChannel.cpIndex || 0,
+ locks: getUserLock(getId(), true),
+ excelAdditionalInfo: null
+ };
+
+ // Send the patch
+ rtChannel.sendMsg(msg, null, function (err, hash) {
+ if (err) {
+ return void console.error(err);
+ }
+ // Apply it on our side
+ ooChannel.send(msg);
+ ooChannel.lastHash = hash;
+ ooChannel.cpIndex++;
+ });
+ };
+
var makeChannel = function () {
var msgEv = Util.mkEvent();
@@ -1244,6 +1326,11 @@ define([
if (APP.onStrictSaveChanges && !force) { return; }
// We only need to release locks for sheets
if (type !== "sheet" && obj.type === "releaseLock") { return; }
+ if (type === "presentation" && obj.type === "cp_theme") {
+ // XXX
+ console.error(obj);
+ return;
+ }
debug(obj, 'toOO');
chan.event('CMD', obj);
@@ -1306,6 +1393,24 @@ define([
APP.onStrictSaveChanges();
return;
}
+ var AscCommon = window.frames[0] && window.frames[0].AscCommon;
+ if (Util.find(AscCommon, ['CollaborativeEditing','m_bFast'])
+ && APP.themeLocked) {
+ obj = APP.themeLocked;
+ APP.themeLocked = undefined;
+ obj.type = "cp_theme";
+ console.error(obj);
+ }
+ if (APP.themeRemote) {
+ delete APP.themeRemote;
+ send({
+ type: "unSaveLock",
+ index: ooChannel.cpIndex,
+ time: +new Date()
+ });
+ return;
+ }
+
// We're sending our changes to netflux
handleChanges(obj, send);
// If we're alone, clean up the medias
@@ -1351,15 +1456,64 @@ define([
});
};
+ var x2tConvertData = function (data, fileName, format, cb) {
+ var sframeChan = common.getSframeChannel();
+ var e = getEditor();
+ var fonts = e && e.FontLoader.fontInfos;
+ var files = e && e.FontLoader.fontFiles.map(function (f) {
+ return { 'Id': f.Id, };
+ });
+ var type = common.getMetadataMgr().getPrivateData().ooType;
+ var images = (e && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {};
+ var theme = e && window.frames[0].AscCommon.g_image_loader.map_image_index;
+ if (theme) {
+ Object.keys(theme).forEach(function (url) {
+ if (!/^(\/|blob:|data:)/.test(url)) {
+ images[url] = url;
+ }
+ });
+ }
+ sframeChan.query('Q_OO_CONVERT', {
+ data: data,
+ type: type,
+ fileName: fileName,
+ outputFormat: format,
+ images: (e && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {},
+ fonts: fonts,
+ fonts_files: files,
+ mediasSources: getMediasSources(),
+ mediasData: mediasData
+ }, function (err, obj) {
+ if (err || !obj || !obj.data) {
+ UI.warn(Messages.error);
+ return void cb();
+ }
+ cb(obj.data, obj.images);
+ }, {
+ raw: true
+ });
+ };
+
+ // When download a sheet from the drive, we must wait for all the images
+ // to be downloaded and decrypted before converting to xlsx
+ var downloadImages = {};
+
+ var firstOO = true;
startOO = function (blob, file, force) {
if (APP.ooconfig && !force) { return void console.error('already started'); }
var url = URL.createObjectURL(blob);
var lock = !APP.history && (APP.migrate);
+ var fromContent = metadataMgr.getPrivateData().fromContent;
+ if (!firstOO) { fromContent = undefined; }
+ firstOO = false;
+
// Starting from version 3, we can use the view mode again
// defined but never used
//var mode = (content && content.version > 2 && lock) ? "view" : "edit";
+ var lang = (window.cryptpadLanguage || navigator.language || navigator.userLanguage || '').slice(0,2);
+
// Config
APP.ooconfig = {
"document": {
@@ -1386,7 +1540,7 @@ define([
"name": metadataMgr.getUserData().name || Messages.anonymous,
},
"mode": "edit",
- "lang": (window.cryptpadLanguage || navigator.language || navigator.userLanguage || '').slice(0,2)
+ "lang": lang
},
"events": {
"onAppReady": function(/*evt*/) {
@@ -1431,6 +1585,13 @@ define([
});
}
},
+ "onError": function () {
+ console.error(arguments);
+ if (APP.isDownload) {
+ var sframeChan = common.getSframeChannel();
+ sframeChan.event('EV_OOIFRAME_DONE', '');
+ }
+ },
"onDocumentReady": function () {
evOnSync.fire();
var onMigrateRdy = Util.mkEvent();
@@ -1508,7 +1669,38 @@ define([
ooChannel.lastHash = hash;
});
}
+
+ if (APP.startNew) {
+ var w = getWindow();
+ if (lang === "fr") { lang = 'fr-fr'; }
+ var l = w.Common.util.LanguageInfo.getLocalLanguageCode(lang);
+ getEditor().asc_setDefaultLanguage(l);
+ }
}
+ delete APP.startNew;
+
+ if (fromContent && !lock && Array.isArray(fromContent.content)) {
+ makePatch(fromContent.content);
+ }
+
+ if (APP.isDownload) {
+ var bin = getContent();
+ if (!supportsXLSX()) {
+ return void sframeChan.event('EV_OOIFRAME_DONE', bin, {raw: true});
+ }
+ nThen(function (waitFor) {
+ // wait for all the images to be loaded before converting
+ Object.keys(downloadImages).forEach(function (name) {
+ downloadImages[name].reg(waitFor());
+ });
+ }).nThen(function () {
+ x2tConvertData(bin, 'filename.bin', file.type, function (xlsData) {
+ sframeChan.event('EV_OOIFRAME_DONE', xlsData, {raw: true});
+ });
+ });
+ return;
+ }
+
if (isLockedModal.modal && force) {
isLockedModal.modal.closeModal();
@@ -1534,10 +1726,15 @@ define([
} catch (e) {}
}
- if (lock && !readOnly) {
+ if (lock && !readOnly) { // Lock = !history && migrate
onMigrateRdy.fire();
}
+ if (APP.initCheckpoint) {
+ getEditor().asc_setRestriction(true);
+ makeCheckpoint(true);
+ }
+
// Check if history can/should be trimmed
var cp = getLastCp();
if (cp && cp.file && cp.hash) {
@@ -1637,6 +1834,25 @@ define([
});
};
+ APP.remoteTheme = function () {
+ /*
+ APP.themeRemote = true;
+ */
+ };
+ APP.changeTheme = function (id) {
+ /*
+ // XXX disabled:
+Uncaught TypeError: Cannot read property 'calculatedType' of null
+ at CPresentation.changeTheme (sdk-all.js?ver=4.11.0-1633612942653-1633619288217:15927)
+ */
+
+ id = id;
+ /*
+ APP.themeChanged = {
+ id: id
+ };
+ */
+ };
APP.openURL = function (url) {
common.openUnsafeURL(url);
};
@@ -1649,13 +1865,28 @@ define([
var mediasSources = getMediasSources();
var data = mediasSources[name];
+ downloadImages[name] = Util.mkEvent(true);
if (typeof data === 'undefined') {
+ if (/^http/.test(name) && /slide\/themes\/theme/.test(name)) {
+ Util.fetch(name, function (err, u8) {
+ if (err) { return; }
+ mediasData[name] = {
+ blobUrl: name,
+ content: u8,
+ name: name
+ };
+ var b = new Blob([u8], {type: "image/jpeg"});
+ var blobUrl = URL.createObjectURL(b);
+ return void callback(blobUrl);
+ });
+ return;
+ }
debug("CryptPad - could not find matching media for " + name);
return void callback("");
}
- var blobUrl = (typeof mediasData[data.src] === 'undefined') ? "" : mediasData[data.src].src;
+ var blobUrl = (typeof mediasData[data.src] === 'undefined') ? "" : mediasData[data.src].blobUrl;
if (blobUrl) {
debug("CryptPad Image already loaded " + blobUrl);
return void callback(blobUrl);
@@ -1680,12 +1911,17 @@ define([
try {
var blobUrl = URL.createObjectURL(res.content);
// store media blobUrl and content for cache and export
- var mediaData = { blobUrl : blobUrl, content : "" };
+ var mediaData = {
+ blobUrl : blobUrl,
+ content : "",
+ name: name
+ };
mediasData[data.src] = mediaData;
var reader = new FileReader();
reader.onloadend = function () {
debug("MediaData set");
mediaData.content = reader.result;
+ downloadImages[name].fire();
};
reader.readAsArrayBuffer(res.content);
debug("Adding CryptPad Image " + data.name + ": " + blobUrl);
@@ -1707,239 +1943,55 @@ define([
makeChannel();
};
- var x2tReady = Util.mkEvent(true);
- var fetchFonts = function (x2t) {
- var path = '/common/onlyoffice/'+CURRENT_VERSION+'/fonts/';
- var e = getEditor();
- var fonts = e.FontLoader.fontInfos;
- var files = e.FontLoader.fontFiles;
- var suffixes = {
- indexR: '',
- indexB: '_Bold',
- indexBI: '_Bold_Italic',
- indexI: '_Italic',
- };
- nThen(function (waitFor) {
- fonts.forEach(function (font) {
- // Check if the font is already loaded
- if (!font.NeedStyles) { return; }
- // Pick the variants we need (regular, bold, italic)
- ['indexR', 'indexB', 'indexI', 'indexBI'].forEach(function (k) {
- if (typeof(font[k]) !== "number" || font[k] === -1) { return; } // No matching file
- var file = files[font[k]];
-
- var name = font.Name + suffixes[k] + '.ttf';
- Util.fetch(path + file.Id, waitFor(function (err, buffer) {
- if (buffer) {
- x2t.FS.writeFile('/working/fonts/' + name, buffer);
- }
- }));
- });
- });
- }).nThen(function () {
- x2tReady.fire();
- });
- };
-
- var x2tInitialized = false;
- var x2tInit = function(x2t) {
- debug("x2t mount");
- // x2t.FS.mount(x2t.MEMFS, {} , '/');
- x2t.FS.mkdir('/working');
- x2t.FS.mkdir('/working/media');
- x2t.FS.mkdir('/working/fonts');
- x2tInitialized = true;
- fetchFonts(x2t);
- debug("x2t mount done");
- };
- var getX2T = function (cb) {
- // Perform the x2t conversion
- require(['/common/onlyoffice/x2t/x2t.js'], function() { // FIXME why does this fail without an access-control-allow-origin header?
- var x2t = window.Module;
- x2t.run();
- if (x2tInitialized) {
- debug("x2t runtime already initialized");
- return void x2tReady.reg(function () {
- cb(x2t);
- });
- }
-
- x2t.onRuntimeInitialized = function() {
- debug("x2t in runtime initialized");
- // Init x2t js module
- x2tInit(x2t);
- x2tReady.reg(function () {
- cb(x2t);
- });
- };
- });
- };
-
-
- /*
- Converting Data
-
- This function converts a data in a specific format to the outputformat
- The filename extension needs to represent the input format
- Example: fileName=cryptpad.bin outputFormat=xlsx
- */
- var getFormatId = function (ext) {
- // Sheets
- if (ext === 'xlsx') { return 257; }
- if (ext === 'xls') { return 258; }
- if (ext === 'ods') { return 259; }
- if (ext === 'csv') { return 260; }
- if (ext === 'pdf') { return 513; }
- return;
- };
- var getFromId = function (ext) {
- var id = getFormatId(ext);
- if (!id) { return ''; }
- return ''+id+' ';
- };
- var getToId = function (ext) {
- var id = getFormatId(ext);
- if (!id) { return ''; }
- return ''+id+' ';
- };
- var x2tConvertDataInternal = function(x2t, data, fileName, outputFormat) {
- debug("Converting Data for " + fileName + " to " + outputFormat);
-
- // PDF
- var pdfData = '';
- if (outputFormat === "pdf" && typeof(data) === "object" && data.bin && data.buffer) {
- // Add conversion rules
- pdfData = "false " +
- "/working/fonts/ ";
- // writing file to mounted working disk (in memory)
- x2t.FS.writeFile('/working/' + fileName, data.bin);
- x2t.FS.writeFile('/working/pdf.bin', data.buffer);
- } else {
- // writing file to mounted working disk (in memory)
- x2t.FS.writeFile('/working/' + fileName, data);
- }
-
- // Adding images
- Object.keys(window.frames[0].AscCommon.g_oDocumentUrls.urls || {}).forEach(function (_mediaFileName) {
- var mediaFileName = _mediaFileName.substring(6);
- var mediasSources = getMediasSources();
- var mediaSource = mediasSources[mediaFileName];
- var mediaData = mediaSource ? mediasData[mediaSource.src] : undefined;
- if (mediaData) {
- debug("Writing media data " + mediaFileName);
- debug("Data");
- var fileData = mediaData.content;
- x2t.FS.writeFile('/working/media/' + mediaFileName, new Uint8Array(fileData));
- } else {
- debug("Could not find media content for " + mediaFileName);
- }
- });
-
-
- var inputFormat = fileName.split('.').pop();
-
- var params = ""
- + ""
- + "/working/" + fileName + " "
- + "/working/" + fileName + "." + outputFormat + " "
- + pdfData
- + getFromId(inputFormat)
- + getToId(outputFormat)
- + "false "
- + " ";
- // writing params file to mounted working disk (in memory)
- x2t.FS.writeFile('/working/params.xml', params);
- // running conversion
- x2t.ccall("runX2T", ["number"], ["string"], ["/working/params.xml"]);
- // reading output file from working disk (in memory)
- var result;
- try {
- result = x2t.FS.readFile('/working/' + fileName + "." + outputFormat);
- } catch (e) {
- debug("Failed reading converted file");
- UI.removeModals();
- UI.warn(Messages.error);
- return "";
- }
- return result;
- };
-
APP.printPdf = function (obj, cb) {
- getX2T(function (x2t) {
- //var e = getEditor();
- //var d = e.asc_nativePrint(undefined, undefined, 0x100 + opts.printType).ImData;
- var bin = getContent();
- var xlsData = x2tConvertDataInternal(x2t, {
- buffer: obj.data,
- bin: bin
- }, 'output.bin', 'pdf');
- if (xlsData) {
- var md = common.getMetadataMgr().getMetadataLazy();
- var type = common.getMetadataMgr().getPrivateData().ooType;
- var title = md.title || md.defaultTitle || type;
- var blob = new Blob([xlsData], {type: "application/pdf"});
- //var url = URL.createObjectURL(blob, { type: "application/pdf" });
- saveAs(blob, title+'.pdf');
- //window.open(url);
- cb({
- "type":"save",
- "status":"ok",
- //"data":url + "?disposition=inline&ooname=output.pdf"
- });
- /*
- ooChannel.send({
- "type":"documentOpen",
- "data": {
- "type":"save",
- "status":"ok",
- "data":url + "?disposition=inline&ooname=output.pdf"
- }
- });
- */
- }
+ var bin = getContent();
+ x2tConvertData({
+ buffer: obj.data,
+ bin: bin
+ }, 'output.bin', 'pdf', function (xlsData) {
+ if (!xlsData) { return; }
+ var md = common.getMetadataMgr().getMetadataLazy();
+ var type = common.getMetadataMgr().getPrivateData().ooType;
+ var title = md.title || md.defaultTitle || type;
+ var blob = new Blob([xlsData], {type: "application/pdf"});
+ UI.removeModals();
+ cb();
+ saveAs(blob, APP.exportPdfName || title+'.pdf');
+ delete APP.exportPdfName;
});
};
- var x2tSaveAndConvertDataInternal = function(x2t, data, filename, extension, finalFilename) {
+ var x2tSaveAndConvertData = function(data, filename, extension, finalFilename) {
var type = common.getMetadataMgr().getPrivateData().ooType;
- var xlsData;
+ var e = getEditor();
// PDF
if (type === "sheet" && extension === "pdf") {
- var e = getEditor();
var d = e.asc_nativePrint(undefined, undefined, 0x101).ImData;
- xlsData = x2tConvertDataInternal(x2t, {
+ x2tConvertData({
buffer: d.data,
bin: data
- }, filename, extension);
- if (xlsData) {
- var _blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
- UI.removeModals();
- saveAs(_blob, finalFilename);
- }
+ }, filename, extension, function (res) {
+ if (res) {
+ var _blob = new Blob([res], {type: "application/pdf;charset=utf-8"});
+ UI.removeModals();
+ saveAs(_blob, finalFilename);
+ }
+ });
return;
}
- if (type === "sheet" && extension !== 'xlsx') {
- xlsData = x2tConvertDataInternal(x2t, data, filename, 'xlsx');
- filename += '.xlsx';
- } else if (type === "presentation" && extension !== "pptx") {
- xlsData = x2tConvertDataInternal(x2t, data, filename, 'pptx');
- filename += '.pptx';
- } else if (type === "doc" && extension !== "docx") {
- xlsData = x2tConvertDataInternal(x2t, data, filename, 'docx');
- filename += '.docx';
- }
- xlsData = x2tConvertDataInternal(x2t, data, filename, extension);
- if (xlsData) {
- var blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
- UI.removeModals();
- saveAs(blob, finalFilename);
+ if (extension === "pdf") {
+ APP.exportPdfName = finalFilename;
+ return void e.asc_Print({});
}
- };
-
- var x2tSaveAndConvertData = function(data, filename, extension, finalName) {
- getX2T(function (x2t) {
- x2tSaveAndConvertDataInternal(x2t, data, filename, extension, finalName);
+ x2tConvertData(data, filename, extension, function (xlsData) {
+ if (xlsData) {
+ var blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
+ UI.removeModals();
+ saveAs(blob, finalFilename);
+ return;
+ }
+ UI.warn(Messages.error);
});
};
@@ -1952,9 +2004,9 @@ define([
var type = common.getMetadataMgr().getPrivateData().ooType;
var warning = '';
if (type==="presentation") {
- ext = ['.pptx', /*'.odp',*/ '.bin'];
+ ext = ['.pptx', '.odp', '.bin', '.pdf'];
} else if (type==="doc") {
- ext = ['.docx', /*'.odt',*/ '.bin'];
+ ext = ['.docx', '.odt', '.bin', '.pdf'];
}
if (!supportsXLSX()) {
@@ -2012,32 +2064,29 @@ define([
$select.find('button').addClass('btn');
};
- var x2tImportImagesInternal = function(x2t, images, i, callback) {
+ var x2tImportImagesInternal = function(images, i, callback) {
if (i >= images.length) {
callback();
} else {
debug("Import image " + i);
var handleFileData = {
- name: images[i],
+ name: images[i].name,
mediasSources: getMediasSources(),
callback: function() {
debug("next image");
- x2tImportImagesInternal(x2t, images, i+1, callback);
+ x2tImportImagesInternal(images, i+1, callback);
},
};
- var filePath = "/working/media/" + images[i];
- debug("Import filename " + filePath);
- var fileData = x2t.FS.readFile("/working/media/" + images[i], { encoding : "binary" });
- debug("Importing data");
+ var fileData = images[i].data;
debug("Buffer");
debug(fileData.buffer);
var blob = new Blob([fileData.buffer], {type: 'image/png'});
- blob.name = images[i];
+ blob.name = images[i].name;
APP.FMImages.handleFile(blob, handleFileData);
}
};
- var x2tImportImages = function (x2t, callback) {
+ var x2tImportImages = function (images, callback) {
if (!APP.FMImages) {
var fmConfigImages = {
noHandlers: true,
@@ -2063,14 +2112,8 @@ define([
// Import Images
debug("Import Images");
- var files = x2t.FS.readdir("/working/media/");
- var images = [];
- files.forEach(function (file) {
- if (file !== "." && file !== "..") {
- images.push(file);
- }
- });
- x2tImportImagesInternal(x2t, images, 0, function() {
+ debug(images);
+ x2tImportImagesInternal(images, 0, function() {
debug("Sync media sources elements");
debug(getMediasSources());
APP.onLocal();
@@ -2080,26 +2123,12 @@ define([
};
- var x2tConvertData = function (x2t, data, filename, extension, callback) {
- var convertedContent;
- // Convert from ODF format:
- // first convert to Office format then to the selected extension
- if (filename.endsWith(".ods")) {
- console.log(x2t, data, filename, extension);
- convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), filename, "xlsx");
- console.log(convertedContent);
- convertedContent = x2tConvertDataInternal(x2t, convertedContent, filename + ".xlsx", extension);
- } else if (filename.endsWith(".odt")) {
- convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), filename, "docx");
- convertedContent = x2tConvertDataInternal(x2t, convertedContent, filename + ".docx", extension);
- } else if (filename.endsWith(".odp")) {
- convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), filename, "pptx");
- convertedContent = x2tConvertDataInternal(x2t, convertedContent, filename + ".pptx", extension);
- } else {
- convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), filename, extension);
- }
- x2tImportImages(x2t, function() {
- callback(convertedContent);
+ var x2tImportData = function (data, filename, extension, callback) {
+ x2tConvertData(new Uint8Array(data), filename, extension, function (binData, images) {
+ if (!binData) { return void callback(); }
+ x2tImportImages(images, function() {
+ callback(binData);
+ });
});
};
@@ -2153,10 +2182,12 @@ define([
]);
UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
setTimeout(function () {
- getX2T(function (x2t) {
- x2tConvertData(x2t, new Uint8Array(content), filename.name, "bin", function(c) {
- importFile(c);
- });
+ x2tImportData(new Uint8Array(content), filename.name, "bin", function(c) {
+ if (!c) {
+ UI.removeModals();
+ return void UI.warn(Messages.error);
+ }
+ importFile(c);
});
}, 100);
};
@@ -2382,6 +2413,40 @@ define([
});
};
+ sframeChan.on('EV_OOIFRAME_REFRESH', function (data) {
+ // We want to get the "bin" content of a sheet from its json in order to download
+ // something useful from a non-onlyoffice app (download from drive or settings).
+ // We don't want to initialize a full pad in async-store because we only need a
+ // static version, so we can use "openVersionHash" which is based on GET_HISTORY_RANGE
+ APP.isDownload = data.downloadId;
+ APP.downloadType = data.type;
+ downloadImages = {};
+ var json = data && data.json;
+ if (!json || !json.content) {
+ return void sframeChan.event('EV_OOIFRAME_DONE', '');
+ }
+ content = json.content;
+ readOnly = true;
+ var version = (!content.version || content.version === 1) ? 'v1/' :
+ (content.version <= 3 ? 'v2b/' : CURRENT_VERSION+'/');
+ var s = h('script', {
+ type:'text/javascript',
+ src: '/common/onlyoffice/'+version+'web-apps/apps/api/documents/api.js'
+ });
+ $('#cp-app-oo-editor').append(s);
+
+ var hashes = content.hashes || {};
+ var idx = sortCpIndex(hashes);
+ var lastIndex = idx[idx.length - 1];
+
+ // We're going to open using "openVersionHash" to avoid reimplementing existing code.
+ // To do so, we're using a version corresponding to the latest checkpoint with a
+ // minor version of 0. "openVersionHash" knows that it needs to give us the latest
+ // version when "APP.isDownload" is true.
+ var sheetVersion = lastIndex + '.0';
+ openVersionHash(sheetVersion);
+ });
+
config.onInit = function (info) {
var privateData = metadataMgr.getPrivateData();
metadataMgr.setDegraded(false); // FIXME degraded moded unsupported (no cursor channel)
@@ -2414,6 +2479,26 @@ define([
makeCheckpoint(true);
});
$save.appendTo(toolbar.$bottomM);
+
+ var $dlMedias = common.createButton('', true, {
+ name: 'dlmedias',
+ icon: 'fa-download',
+ }, function () {
+ require(['/bower_components/jszip/dist/jszip.min.js'], function (JsZip) {
+ var zip = new JsZip();
+ Object.keys(mediasData || {}).forEach(function (url) {
+ var obj = mediasData[url];
+ var b = new Blob([obj.content]);
+ zip.file(obj.name, b, {binary: true});
+ });
+ setTimeout(function () {
+ zip.generateAsync({type: 'blob'}).then(function (content) {
+ saveAs(content, 'media.zip');
+ });
+ }, 100);
+ });
+ }).attr('title', "Download medias");
+ $dlMedias.appendTo(toolbar.$bottomM);
}
if (!privateData.ooVersionHash) {
@@ -2655,6 +2740,8 @@ define([
Title.updateTitle(Title.defaultTitle);
}
+ APP.startNew = isNew;
+
var version = CURRENT_VERSION + '/';
var msg;
// Old version detected: use the old OO and start the migration if we can
@@ -2695,6 +2782,7 @@ define([
readOnly = true;
}
}
+ // NOTE: don't forget to also update the version in 'EV_OOIFRAME_REFRESH'
// If the sheet is locked by an offline user, remove it
if (content && content.saveLock && !isUserOnline(content.saveLock)) {
@@ -2737,6 +2825,18 @@ define([
oldHashes = JSON.parse(JSON.stringify(content.hashes));
initializing = false;
+ // If we have more than CHECKPOINT_INTERVAL patches in the initial history
+ // and we're the only editor in the pad, make a checkpoint
+ var v = metadataMgr.getViewers();
+ var m = metadataMgr.getChannelMembers().filter(function (str) {
+ return str.length === 32;
+ }).length;
+ if ((m - v) === 1 && !readOnly) {
+ var needCp = ooChannel.queue.length > CHECKPOINT_INTERVAL;
+ APP.initCheckpoint = needCp;
+ }
+
+
common.openPadChat(APP.onLocal);
if (!readOnly) {
@@ -2782,9 +2882,102 @@ define([
return;
}
- loadDocument(newDoc, useNewDefault);
- setEditable(!readOnly);
- UI.removeLoadingScreen();
+ var next = function () {
+ loadDocument(newDoc, useNewDefault);
+ setEditable(!readOnly);
+ UI.removeLoadingScreen();
+ };
+
+ if (privateData.isNewFile && privateData.fromFileData) {
+ try {
+ (function () {
+ var data = privateData.fromFileData;
+
+ var type = data.fileType;
+ var title = data.title;
+ // Fix extension if the file was renamed
+ if (Util.isSpreadsheet(type) && !Util.isSpreadsheet(data.title)) {
+ if (type === 'application/vnd.oasis.opendocument.spreadsheet') {
+ data.title += '.ods';
+ }
+ if (type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
+ data.title += '.xlsx';
+ }
+ }
+ if (Util.isOfficeDoc(type) && !Util.isOfficeDoc(data.title)) {
+ if (type === 'application/vnd.oasis.opendocument.text') {
+ data.title += '.odt';
+ }
+ if (type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
+ data.title += '.docx';
+ }
+ }
+ if (Util.isPresentation(type) && !Util.isPresentation(data.title)) {
+ if (type === 'application/vnd.oasis.opendocument.presentation') {
+ data.title += '.odp';
+ }
+ if (type === 'application/vnd.openxmlformats-officedocument.presentationml.presentation') {
+ data.title += '.pptx';
+ }
+ }
+
+ var href = data.href;
+ var password = data.password;
+ var parsed = Hash.parsePadUrl(href);
+ var secret = Hash.getSecrets('file', parsed.hash, password);
+ var hexFileName = secret.channel;
+ var fileHost = privateData.fileHost || privateData.origin;
+ var src = fileHost + Hash.getBlobPathFromHex(hexFileName);
+ var key = secret.keys && secret.keys.cryptKey;
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', src, true);
+ xhr.responseType = 'arraybuffer';
+ xhr.onload = function () {
+ if (/^4/.test('' + this.status)) {
+ // fallback to empty sheet
+ console.error(this.status);
+ return void next();
+ }
+ var arrayBuffer = xhr.response;
+ if (arrayBuffer) {
+ var u8 = new Uint8Array(arrayBuffer);
+ FileCrypto.decrypt(u8, key, function (err, decrypted) {
+ if (err) {
+ // fallback to empty sheet
+ console.error(err);
+ return void next();
+ }
+ var blobXlsx = decrypted.content;
+ new Response(blobXlsx).arrayBuffer().then(function (buffer) {
+ var u8Xlsx = new Uint8Array(buffer);
+ x2tImportData(u8Xlsx, data.title, 'bin', function (bin) {
+ if (!bin) {
+ return void UI.errorLoadingScreen(Messages.error);
+ }
+ var blob = new Blob([bin], {type: 'text/plain'});
+ saveToServer(blob, data.title);
+ Title.updateTitle(title);
+ UI.removeLoadingScreen();
+ });
+ });
+ });
+ }
+ };
+ xhr.onerror = function (err) {
+ // fallback to empty sheet
+ console.error(err);
+ next();
+ };
+ xhr.send(null);
+ })();
+ } catch (e) {
+ console.error(e);
+ next();
+ }
+ return;
+ }
+
+ next();
});
};
diff --git a/www/common/onlyoffice/main.js b/www/common/onlyoffice/main.js
index b7626a589..8b79474ae 100644
--- a/www/common/onlyoffice/main.js
+++ b/www/common/onlyoffice/main.js
@@ -143,6 +143,22 @@ define([
}
sframeChan.event('EV_OO_EVENT', obj);
});
+
+ // X2T
+ var x2t;
+ var onConvert = function (obj, cb) {
+ x2t.convert(obj, cb);
+ };
+ sframeChan.on('Q_OO_CONVERT', function (obj, cb) {
+ if (x2t) { return void onConvert(obj, cb); }
+ require(['/common/outer/x2t.js'], function (X2T) {
+ x2t = X2T.start();
+ onConvert(obj, cb);
+ });
+ });
+
+
+
};
SFCommonO.start({
hash: hash,
diff --git a/www/common/onlyoffice/ooiframe.js b/www/common/onlyoffice/ooiframe.js
new file mode 100644
index 000000000..097d21e5e
--- /dev/null
+++ b/www/common/onlyoffice/ooiframe.js
@@ -0,0 +1,176 @@
+// Load #1, load as little as possible because we are in a race to get the loading screen up.
+define([
+ '/bower_components/nthen/index.js',
+ '/api/config',
+ 'jquery',
+ '/common/requireconfig.js',
+ '/customize/messages.js',
+], function (nThen, ApiConfig, $, RequireConfig, Messages) {
+ var requireConfig = RequireConfig();
+
+ var ready = false;
+ var currentCb;
+ var queue = [];
+
+ var create = function (config) {
+ // Loaded in load #2
+ var sframeChan;
+ var refresh = function (data, cb) {
+ if (currentCb) {
+ queue.push({data: data, cb: cb});
+ return;
+ }
+ if (!ready) {
+ ready = function () {
+ refresh(data, cb);
+ };
+ return;
+ }
+ currentCb = cb;
+ sframeChan.event('EV_OOIFRAME_REFRESH', data);
+ };
+ nThen(function (waitFor) {
+ $(waitFor());
+ }).nThen(function (waitFor) {
+ var lang = Messages._languageUsed;
+ var themeKey = 'CRYPTPAD_STORE|colortheme';
+ var req = {
+ cfg: requireConfig,
+ req: [ '/common/loading.js' ],
+ pfx: window.location.origin,
+ theme: localStorage[themeKey],
+ themeOS: localStorage[themeKey+'_default'],
+ lang: lang
+ };
+ window.rc = requireConfig;
+ window.apiconf = ApiConfig;
+ $('#sbox-oo-iframe').attr('src',
+ ApiConfig.httpSafeOrigin + '/sheet/inner.html?' + requireConfig.urlArgs +
+ '#' + encodeURIComponent(JSON.stringify(req)));
+
+ // This is a cheap trick to avoid loading sframe-channel in parallel with the
+ // loading screen setup.
+ var done = waitFor();
+ var onMsg = function (msg) {
+ var data = typeof(msg.data) === "object" ? msg.data : JSON.parse(msg.data);
+ if (data.q !== 'READY') { return; }
+ window.removeEventListener('message', onMsg);
+ var _done = done;
+ done = function () { };
+ _done();
+ };
+ window.addEventListener('message', onMsg);
+ }).nThen(function (/*waitFor*/) {
+ var Cryptpad = config.modules.Cryptpad;
+ var Utils = config.modules.Utils;
+
+ nThen(function (waitFor) {
+ // The inner iframe tries to get some data from us every ms (cache, store...).
+ // It will send a "READY" message and wait for our answer with the correct txid.
+ // First, we have to answer to this message, otherwise we're going to block
+ // sframe-boot.js. Then we can start the channel.
+ var msgEv = Utils.Util.mkEvent();
+ var iframe = $('#sbox-oo-iframe')[0].contentWindow;
+ var postMsg = function (data) {
+ iframe.postMessage(data, '*');
+ };
+ var w = waitFor();
+ var whenReady = function (msg) {
+ if (msg.source !== iframe) { return; }
+ var data = JSON.parse(msg.data);
+ if (!data.txid) { return; }
+ // Remove the listener once we've received the READY message
+ window.removeEventListener('message', whenReady);
+ // Answer with the requested data
+ postMsg(JSON.stringify({ txid: data.txid, language: Cryptpad.getLanguage(), localStore: window.localStore, cache: window.cpCache }));
+
+ // Then start the channel
+ window.addEventListener('message', function (msg) {
+ if (msg.source !== iframe) { return; }
+ msgEv.fire(msg);
+ });
+ config.modules.SFrameChannel.create(msgEv, postMsg, waitFor(function (sfc) {
+ sframeChan = sfc;
+ }));
+ w();
+ };
+ window.addEventListener('message', whenReady);
+ }).nThen(function () {
+ var updateMeta = function () {
+ //console.log('EV_METADATA_UPDATE');
+ var metaObj;
+ nThen(function (waitFor) {
+ Cryptpad.getMetadata(waitFor(function (err, n) {
+ if (err) {
+ waitFor.abort();
+ return void console.log(err);
+ }
+ metaObj = n;
+ }));
+ }).nThen(function (/*waitFor*/) {
+ metaObj.doc = {};
+ var additionalPriv = {
+ fileHost: ApiConfig.fileHost,
+ loggedIn: Utils.LocalStore.isLoggedIn(),
+ origin: window.location.origin,
+ pathname: window.location.pathname,
+ feedbackAllowed: Utils.Feedback.state,
+ secureIframe: true,
+ supportsWasm: Utils.Util.supportsWasm()
+ };
+ for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
+
+ sframeChan.event('EV_METADATA_UPDATE', metaObj);
+ });
+ };
+ Cryptpad.onMetadataChanged(updateMeta);
+ sframeChan.onReg('EV_METADATA_UPDATE', updateMeta);
+
+ config.addCommonRpc(sframeChan, true);
+
+ Cryptpad.padRpc.onMetadataEvent.reg(function (data) {
+ sframeChan.event('EV_RT_METADATA', data);
+ });
+
+ sframeChan.on('EV_OOIFRAME_DONE', function (data) {
+ if (queue.length) {
+ setTimeout(function () {
+ var first = queue.shift();
+ refresh(first.data, first.cb);
+ });
+ }
+ if (!currentCb) { return; }
+ currentCb(data);
+ currentCb = undefined;
+ });
+
+ // X2T
+ var x2t;
+ var onConvert = function (obj, cb) {
+ x2t.convert(obj, cb);
+ };
+ sframeChan.on('Q_OO_CONVERT', function (obj, cb) {
+ if (x2t) { return void onConvert(obj, cb); }
+ require(['/common/outer/x2t.js'], function (X2T) {
+ x2t = X2T.start();
+ onConvert(obj, cb);
+ });
+ });
+
+ sframeChan.onReady(function () {
+ if (ready === true) { return; }
+ if (typeof ready === "function") {
+ ready();
+ }
+ ready = true;
+ });
+ });
+ });
+ return {
+ refresh: refresh
+ };
+ };
+ return {
+ create: create
+ };
+});
diff --git a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js
index d54170dd3..8eb557699 100644
--- a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js
+++ b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js
@@ -268,13 +268,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"sessionTimeConnect":this._sessionTimeConnect,"sessionTimeIdle":opt_isIdle>=0?opt_isIdle:0,"documentFormatSave":this._documentFormatSave,"view":this._isViewer,"isCloseCoAuthoring":this.isCloseCoAuthoring,"openCmd":opt_openCmd,"lang":this.lang,
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
-Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
-return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
-false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
-break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
-break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
-null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
-window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
+Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor&&editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=
+function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=
+JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);
+break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);
+break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=
+c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=
+null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
@@ -1657,39 +1657,39 @@ function(){};baseEditorsApi.prototype._downloadAs=function(){};baseEditorsApi.pr
actionType===c_oAscAsyncAction.Print?DownloadType.Print:DownloadType.Download;else downloadType=DownloadType.None;var isNoBase64=typeof ArrayBuffer!=="undefined"&&!isCloudCrypto;var dataContainer={data:null,part:null,index:0,count:0};var oAdditionalData={};oAdditionalData["c"]="save";oAdditionalData["id"]=this.documentId;oAdditionalData["userid"]=this.documentUserId;oAdditionalData["tokenSession"]=this.CoAuthoringApi.get_jwt();oAdditionalData["outputformat"]=options.fileType;oAdditionalData["title"]=
AscCommon.changeFileExtention(this.documentTitle,AscCommon.getExtentionByFormat(options.fileType),Asc.c_nMaxDownloadTitleLen);oAdditionalData["nobase64"]=isNoBase64;if(DownloadType.Print===downloadType)oAdditionalData["inline"]=1;if(this._downloadAs(actionType,options,oAdditionalData,dataContainer))return;var t=this;this.fCurCallback=null;if(!options.callback)this.fCurCallback=function(input,status){var error=403===status?c_oAscError.ID.AccessDeny:c_oAscError.ID.Unknown;if(null!=input&&oAdditionalData["c"]===
input["type"])if("ok"===input["status"]){var url=input["data"];if(url){error=c_oAscError.ID.No;t.processSavedFile(url,downloadType)}}else error=AscCommon.mapAscServerErrorToAscError(parseInt(input["data"]),AscCommon.c_oAscAdvancedOptionsAction.Save);if(c_oAscError.ID.No!==error){t.endInsertDocumentUrls();t.sendEvent("asc_onError",options.errorDirect||error,c_oAscError.Level.NoCritical)}if(actionType)t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType)};if(window.parent.APP.printPdf&&
-(DownloadType.Print===downloadType||!downloadType)){window.parent.APP.printPdf(dataContainer,options.callback||this.fCurCallback);return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=
-function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};
-baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});
-return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=
-this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};
-baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);
-var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},
-this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
-AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
-var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
-sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
-function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
-else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeIdb.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
-extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
-plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
-baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
-function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
-c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
-baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
+(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
+function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
+elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
+t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
+c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
+else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
+function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
+data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
+oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
+function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
+function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
+value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
+if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
+newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
+this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
+false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
+0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
+this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
+this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
+baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
+function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
+baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
+baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
+aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
+_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
+true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
+baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
+baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
+this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
+this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
diff --git a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all.js b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all.js
index cdefc6082..bd569223c 100644
--- a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all.js
+++ b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all.js
@@ -8425,87 +8425,88 @@ oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Imag
this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";
var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_font_loader=new CGlobalFontLoader;window["AscCommon"].g_image_loader=new CGlobalImageLoader;window["AscCommon"].g_flow_anchor=g_flow_anchor;window["AscCommon"].g_flow_anchor2=g_flow_anchor2})(window,window.document);"use strict";(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=
-pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;
-var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=
-function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index<
-srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=
-nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=
-[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=
-0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();
-this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=
-0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();
-editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>
-0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};
-CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));
-this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=
-this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=
-oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=
-mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=
-mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,
-false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=
-mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=
-new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=
-function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,
-nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=
-function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndexPos||_Pos.Position===Pos&&!(Class instanceof AscCommonWord.ParaRun))){_Pos.Position++;
-break}}}};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndexPos+Count)_Pos.Position-=Count;else if(_Pos.Position>=Pos){_Pos.Position=Pos;_Pos.Deleted=true}break}}}};
-CDocumentPositionsManager.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositionsSplit=[];for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex=SplitPos)this.m_aDocumentPositionsSplit.push({DocPos:DocPos,NewRunPos:_Pos.Position-SplitPos})}}};
-CDocumentPositionsManager.prototype.OnEnd_SplitRun=function(NewRun){if(!NewRun)return;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsSplit.length;PosIndex0&&DocPos[DocPos.length-1].Class instanceof AscCommonWord.ParaRun){var Run=DocPos[DocPos.length-1].Class;var RunPos=DocPos[DocPos.length-1].Position;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:RunPos})}}};CDocumentPositionsManager.prototype.Remove_DocumentPosition=function(DocPos){for(var Pos=0,Count=
-this.m_aDocumentPositions.length;Pos>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";if(api!==undefined&&api.CheckRetinaElement&&api.CheckRetinaElement(this.HtmlElement)){var _W=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;var _H=(_b-_y)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.width=AscCommon.AscBrowser.convertToRetinaValue(_W,true);this.HtmlElement.height=
-AscCommon.AscBrowser.convertToRetinaValue(_H,true)}else{this.HtmlElement.width=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.height=(_b-_y)*g_dKoef_mm_to_pix+.5>>0}};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CControlContainer(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=
-null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Controls=[];this.AddControl=function(ctrl){ctrl.Parent=this;this.Controls[this.Controls.length]=ctrl};this.Resize=function(_width,_height,api){if(null==this.Parent){this.AbsolutePosition.L=0;this.AbsolutePosition.T=0;this.AbsolutePosition.R=_width;this.AbsolutePosition.B=_height;if(null!=this.HtmlElement){var lCount=this.Controls.length;for(var i=0;i>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";var lCount=this.Controls.length;for(var i=0;i>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CreateControlContainer(name){var ctrl=new CControlContainer;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}function CreateControl(name){var ctrl=new CControl;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}window["AscCommon"]=window["AscCommon"]||
-{};window["AscCommon"].g_anchor_left=g_anchor_left;window["AscCommon"].g_anchor_top=g_anchor_top;window["AscCommon"].g_anchor_right=g_anchor_right;window["AscCommon"].g_anchor_bottom=g_anchor_bottom;window["AscCommon"].CreateControlContainer=CreateControlContainer;window["AscCommon"].CreateControl=CreateControl})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var TRACK_CIRCLE_RADIUS=5;var TRACK_RECT_SIZE2=4;var TRACK_RECT_SIZE=8;var TRACK_RECT_SIZE_CT=6;var TRACK_DISTANCE_ROTATE=
-25;var TRACK_DISTANCE_ROTATE2=25;var TRACK_ADJUSTMENT_SIZE=10;var TRACK_WRAPPOINTS_SIZE=6;var IMAGE_ROTATE_TRACK_W=21;var bIsUseImageRotateTrack=true;if(bIsUseImageRotateTrack){window.g_track_rotate_marker=new Image;window.g_track_rotate_marker;window.g_track_rotate_marker.asc_complete=false;window.g_track_rotate_marker.onload=function(){window.g_track_rotate_marker.asc_complete=true};window.g_track_rotate_marker.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC";
+pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;if(this.m_pData&&this.m_pData.type==="cp_theme"){clearTimeout(window.CP_theme_to);var data=this.m_pData;window.CP_theme_to=setTimeout(function(){window.parent.APP.remoteTheme();
+window.editor.ChangeTheme(data.id,null,true)});return true}var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);
+return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;
+break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;
+return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId=
+{};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=
+[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=
+function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();
+this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];
+Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=
+function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};
+CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index
+0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=
+this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=
+0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=
+oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=
+oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>
+-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof
+AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=
+oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=
+[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;
+else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=
+[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndexPos||_Pos.Position===Pos&&!(Class instanceof AscCommonWord.ParaRun))){_Pos.Position++;break}}}};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndexPos+Count)_Pos.Position-=Count;else if(_Pos.Position>=Pos){_Pos.Position=Pos;_Pos.Deleted=true}break}}}};CDocumentPositionsManager.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositionsSplit=[];for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex=SplitPos)this.m_aDocumentPositionsSplit.push({DocPos:DocPos,NewRunPos:_Pos.Position-SplitPos})}}};CDocumentPositionsManager.prototype.OnEnd_SplitRun=function(NewRun){if(!NewRun)return;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsSplit.length;PosIndex0&&DocPos[DocPos.length-1].Class instanceof AscCommonWord.ParaRun){var Run=DocPos[DocPos.length-1].Class;var RunPos=DocPos[DocPos.length-1].Position;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,
+Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:RunPos})}}};CDocumentPositionsManager.prototype.Remove_DocumentPosition=function(DocPos){for(var Pos=0,Count=this.m_aDocumentPositions.length;Pos>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";if(api!==undefined&&api.CheckRetinaElement&&
+api.CheckRetinaElement(this.HtmlElement)){var _W=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;var _H=(_b-_y)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.width=AscCommon.AscBrowser.convertToRetinaValue(_W,true);this.HtmlElement.height=AscCommon.AscBrowser.convertToRetinaValue(_H,true)}else{this.HtmlElement.width=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.height=(_b-_y)*g_dKoef_mm_to_pix+.5>>0}};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=
+function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CControlContainer(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Controls=[];this.AddControl=function(ctrl){ctrl.Parent=this;this.Controls[this.Controls.length]=ctrl};this.Resize=function(_width,_height,api){if(null==this.Parent){this.AbsolutePosition.L=0;this.AbsolutePosition.T=
+0;this.AbsolutePosition.R=_width;this.AbsolutePosition.B=_height;if(null!=this.HtmlElement){var lCount=this.Controls.length;for(var i=0;i>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*
+g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";var lCount=this.Controls.length;for(var i=0;i>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CreateControlContainer(name){var ctrl=new CControlContainer;ctrl.Name=name;
+ctrl.HtmlElement=document.getElementById(name);return ctrl}function CreateControl(name){var ctrl=new CControl;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_anchor_left=g_anchor_left;window["AscCommon"].g_anchor_top=g_anchor_top;window["AscCommon"].g_anchor_right=g_anchor_right;window["AscCommon"].g_anchor_bottom=g_anchor_bottom;window["AscCommon"].CreateControlContainer=CreateControlContainer;window["AscCommon"].CreateControl=
+CreateControl})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var TRACK_CIRCLE_RADIUS=5;var TRACK_RECT_SIZE2=4;var TRACK_RECT_SIZE=8;var TRACK_RECT_SIZE_CT=6;var TRACK_DISTANCE_ROTATE=25;var TRACK_DISTANCE_ROTATE2=25;var TRACK_ADJUSTMENT_SIZE=10;var TRACK_WRAPPOINTS_SIZE=6;var IMAGE_ROTATE_TRACK_W=21;var bIsUseImageRotateTrack=true;if(bIsUseImageRotateTrack){window.g_track_rotate_marker=new Image;window.g_track_rotate_marker;window.g_track_rotate_marker.asc_complete=
+false;window.g_track_rotate_marker.onload=function(){window.g_track_rotate_marker.asc_complete=true};window.g_track_rotate_marker.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC";
window.g_track_rotate_marker2=new Image;window.g_track_rotate_marker2;window.g_track_rotate_marker2.asc_complete=false;window.g_track_rotate_marker2.onload=function(){window.g_track_rotate_marker2.asc_complete=true};window.g_track_rotate_marker2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAeFBMVEUAAAD///////////////////////////////////////////////////////////////////////////+Tk5Obm5v8/PzAwMD5+fmWlpbt7e3k5OSfn5/z8/PLy8vn5+fExMSsrKyqqqrf39+vr6+9vb2urq7c3NxSmuRpAAAAE3RSTlMA+u2XA+PTrId4WBwTN7EKtLY4iqQP6AAAAWhJREFUOMudVe2SgjAMLN+goN51CxTLp3r3/m943BAqIJTR/RU6O02yTRY2g5tEgW9blu0HUeKyLRxDj0/ghcdVWuxYfAHLiV95B5uvwD4saK7DN+DMSj1f+CYu58l9J27A6XnnJG9R3ZWU6l4Vk+y6D310baHRXvUxdRSP/aYZILJbmebFLRNAlo69x7PEeQdZ5Xz8qiS6fJr8aOnEquATFApdSsr/v1HINUo+Q6nwoDDspfH4JmoJ6shzWcINaNBSlLCI6uvLfyXmAlR2xIKBB/A1ZKiGIGA+8QCtphBawRt+hsBnNvE0M0OPZmwcijRnFvE0U6CuIcbrIUlJRnJL9L0YifTQCgU3p/aH4I7fnWaCIajwMMszCl5A7Aj+TWctGuMT6qG4QtbGodBj9oAyjpke3LSDYXCXq9A8V6GZrsLGcqXlcrneW9elAQgpxdwA3rcUdv4ymdQHtrdvpPvW/LHZ7/8+/gBTWGFPbAkGiAAAAABJRU5ErkJggg==";
TRACK_DISTANCE_ROTATE2=18}function COverlay(){this.m_oControl=null;this.m_oContext=null;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;this.m_bIsShow=false;this.m_bIsAlwaysUpdateOverlay=false;this.m_oHtmlPage=null;this.DashLineColor="#000000";this.ClearAll=false;this.IsRetina=false;this.IsCellEditor=false}COverlay.prototype={init:function(context,controlName,x,y,w_pix,h_pix,w_mm,h_mm){this.m_oContext=context;this.m_oControl=AscCommon.CreateControl(controlName);this.m_oHtmlPage=
new AscCommon.CHtmlPage;this.m_oHtmlPage.init(x,y,w_pix,h_pix,w_mm,h_mm)},Clear:function(){if(null==this.m_oContext){this.m_oContext=this.m_oControl.HtmlElement.getContext("2d");this.m_oContext.imageSmoothingEnabled=false;this.m_oContext.mozImageSmoothingEnabled=false;this.m_oContext.oImageSmoothingEnabled=false;this.m_oContext.webkitImageSmoothingEnabled=false}this.SetBaseTransform();this.m_oContext.beginPath();if(this.max_x!=-65535&&this.max_y!=-65535)if(this.ClearAll===true){this.m_oContext.clearRect(0,
diff --git a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js
index c2762ee40..738dacf5c 100644
--- a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js
+++ b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js
@@ -266,13 +266,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"sessionTimeConnect":this._sessionTimeConnect,"sessionTimeIdle":opt_isIdle>=0?opt_isIdle:0,"documentFormatSave":this._documentFormatSave,"view":this._isViewer,"isCloseCoAuthoring":this.isCloseCoAuthoring,"openCmd":opt_openCmd,"lang":this.lang,
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
-Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
-return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
-false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
-break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
-break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
-null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
-window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
+Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor&&editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=
+function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=
+JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);
+break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);
+break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=
+c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=
+null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
@@ -1356,62 +1356,62 @@ prot["Clock_Clockwise"]=c_oAscSlideTransitionParams.Clock_Clockwise;prot["Clock_
prot["EditSelectAll"]=c_oAscPresentationShortcutType.EditSelectAll;prot["EditUndo"]=c_oAscPresentationShortcutType.EditUndo;prot["EditRedo"]=c_oAscPresentationShortcutType.EditRedo;prot["Cut"]=c_oAscPresentationShortcutType.Cut;prot["Copy"]=c_oAscPresentationShortcutType.Copy;prot["Paste"]=c_oAscPresentationShortcutType.Paste;prot["Duplicate"]=c_oAscPresentationShortcutType.Duplicate;prot["Print"]=c_oAscPresentationShortcutType.Print;prot["Save"]=c_oAscPresentationShortcutType.Save;
prot["ShowContextMenu"]=c_oAscPresentationShortcutType.ShowContextMenu;window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].c_oSerFormat=c_oSerFormat;window["AscCommon"].CurFileVersion=c_oSerFormat.Version;"use strict";
(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=
-function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);
-return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;
-break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;
-return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId=
-{};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=
-[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=
-function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();
-this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];
-Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=
-function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};
-CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index
-0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=
-this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=
-0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=
-oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=
-oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>
--1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof
-AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=
-oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=
-[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=
+0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=
+0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=
+[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=
+function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};
+CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();
+editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;
+for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};
+CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=
+function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-
+1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=
+this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();
+if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());
+else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=
+mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof
+AscCommonWord.CDocument||oTable.Parent instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,
+1)}nContentLen=oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;
+var aSendingChanges=[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=
+this.m_aAllChanges.length;nIndex0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;
else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=
[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
-AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
-var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
-sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
-function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
-else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeIdb.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
-extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
-plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
-baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
-function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
-c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
-baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
+(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
+function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
+elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
+t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
+c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
+else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
+function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
+data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
+oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
+function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
+function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
+value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
+if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
+newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
+this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
+false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
+0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
+this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
+this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
+baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
+function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
+baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
+baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
+aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
+_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
+true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
+baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
+baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
+this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
+this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
@@ -1993,10 +1993,10 @@ true;var ret=editor.WordControl.onKeyDown(e);editor.WordControl.IsFocus=false;re
if(null!=this.WordControl.m_oLogicDocument)this.WordControl.m_oLogicDocument.viewMode=true}else{this.WordControl.checkNeedRules();this.WordControl.m_oDrawingDocument.ClearCachePages();this.WordControl.OnResize(true);if(null!=this.WordControl.m_oLogicDocument)this.WordControl.m_oLogicDocument.viewMode=false}};asc_docs_api.prototype.sync_HyperlinkClickCallback=function(Url){var indAction=Url.indexOf("ppaction://hlink");if(0==indAction){if(Url=="ppaction://hlinkshowjump?jump=firstslide")this.WordControl.GoToPage(0);
else if(Url=="ppaction://hlinkshowjump?jump=lastslide")this.WordControl.GoToPage(this.WordControl.m_oDrawingDocument.SlidesCount-1);else if(Url=="ppaction://hlinkshowjump?jump=nextslide")this.WordControl.onNextPage();else if(Url=="ppaction://hlinkshowjump?jump=previousslide")this.WordControl.onPrevPage();else{var mask="ppaction://hlinksldjumpslide";var indSlide=Url.indexOf(mask);if(0==indSlide){var slideNum=parseInt(Url.substring(mask.length));if(slideNum>=0&&slideNum=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i=_count)return;var _curSlide=_slides[_cur];_curSlide.timing.makeDuplicate(this.WordControl.m_oLogicDocument.DefaultSlideTiming);
var _default=this.WordControl.m_oLogicDocument.DefaultSlideTiming;for(var i=0;i<_count;i++){if(i==_cur)continue;_slides[i].applyTiming(_default)}}};asc_docs_api.prototype.SlideTransitionPlay=function(){var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var _timing=this.WordControl.m_oLogicDocument.Slides[_cur].timing;var _tr=this.WordControl.m_oDrawingDocument.TransitionSlide;_tr.Type=_timing.TransitionType;
_tr.Param=_timing.TransitionOption;_tr.Duration=_timing.TransitionDuration;_tr.Start(true)};asc_docs_api.prototype.asc_HideSlides=function(isHide){this.WordControl.m_oLogicDocument.hideSlides(isHide)};asc_docs_api.prototype.sync_EndAddShape=function(){editor.sendEvent("asc_onEndAddShape");if(this.WordControl.m_oDrawingDocument.m_sLockedCursorType=="crosshair")this.WordControl.m_oDrawingDocument.UnlockCursorType()};asc_docs_api.prototype.asc_getChartObject=function(type){this.isChartEditor=true;if(!AscFormat.isRealNumber(type)){this.asc_onOpenChartFrame();
diff --git a/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js
index e506201ae..e569b3a5e 100644
--- a/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js
+++ b/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js
@@ -266,13 +266,13 @@ editorType;this._isExcel=c_oEditorId.Spreadsheet===editorType;this._isPresentati
docid;this.sockjs_url=AscCommon.getBaseUrl()+"../../../../doc/"+docid+"/c"};DocsCoApi.prototype.auth=function(isViewer,opt_openCmd,opt_isIdle){this._isViewer=isViewer;if(this._locks){this.ownedLockBlocks=[];for(var block in this._locks)if(this._locks.hasOwnProperty(block)){var lock=this._locks[block];if(lock["state"]===2)this.ownedLockBlocks.push(lock["blockValue"])}this._locks={}}this._send({"type":"auth","docid":this._docid,"documentCallbackUrl":this._documentCallbackUrl,"token":this._token,"user":{"id":this._user.asc_getId(),
"username":this._user.asc_getUserName(),"firstname":this._user.asc_getFirstName(),"lastname":this._user.asc_getLastName(),"indexUser":this._indexUser},"editorType":this.editorType,"lastOtherSaveTime":this.lastOtherSaveTime,"block":this.ownedLockBlocks,"sessionId":this._id,"sessionTimeConnect":this._sessionTimeConnect,"sessionTimeIdle":opt_isIdle>=0?opt_isIdle:0,"documentFormatSave":this._documentFormatSave,"view":this._isViewer,"isCloseCoAuthoring":this.isCloseCoAuthoring,"openCmd":opt_openCmd,"lang":this.lang,
"mode":this.mode,"permissions":this.permissions,"encrypted":this.encrypted,"jwtOpen":this.jwtOpen,"jwtSession":this.jwtSession})};DocsCoApi.prototype._initSocksJs=function(){var t=this;var sockjs;sockjs=this.sockjs={};var send=function(data){setTimeout(function(){sockjs.onmessage({data:JSON.stringify(data)})})};var license={type:"license",license:{type:3,mode:0,rights:1,buildVersion:"5.2.6",buildNumber:2}};var channel;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,
-Util){var msgEv=Util.mkEvent();var p=window.parent;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);
-return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,
-false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);
-break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);
-break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=
-null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};
-window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
+Util){var msgEv=Util.mkEvent();var p=window.parent;if(editor&&editor.isReporterMode){p=window.opener;window.parent=p}else window.APP=p&&p.APP;window.addEventListener("message",function(msg){if(msg.source!==p)return;msgEv.fire(msg)});var postMsg=function(data){p.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){channel=chan;send(license);chan.on("CMD",function(obj){send(obj)})})});sockjs.onopen=function(){t._state=ConnectionState.WaitAuth;t.onFirstConnect()};sockjs.onopen();sockjs.close=
+function(){console.error("Close realtime")};sockjs.send=function(data){try{var obj=JSON.parse(data)}catch(e){console.error(e);return}if(channel)channel.event("CMD",obj)};sockjs.onmessage=function(e){t._onServerMessage(e.data)};return sockjs};DocsCoApi.prototype._onServerOpen=function(){if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);this.reconnectTimeout=null;this.attemptCount=0}this._state=ConnectionState.WaitAuth;this.onFirstConnect()};DocsCoApi.prototype._onServerMessage=function(data){var dataObject=
+JSON.parse(data);switch(dataObject["type"]){case "auth":this._onAuth(dataObject);break;case "message":this._onMessages(dataObject,false);break;case "cursor":this._onCursor(dataObject);break;case "meta":this._onMeta(dataObject);break;case "getLock":this._onGetLock(dataObject);break;case "releaseLock":this._onReleaseLock(dataObject);break;case "connectState":this._onConnectionStateChanged(dataObject);break;case "saveChanges":this._onSaveChanges(dataObject);break;case "authChanges":this._onAuthChanges(dataObject);
+break;case "saveLock":this._onSaveLock(dataObject);break;case "unSaveLock":this._onUnSaveLock(dataObject);break;case "savePartChanges":this._onSavePartChanges(dataObject);break;case "drop":this._onDrop(dataObject);break;case "waitAuth":break;case "error":this._onDrop(dataObject);break;case "documentOpen":this._documentOpen(dataObject);break;case "warning":this._onWarning(dataObject);break;case "license":this._onLicense(dataObject);break;case "session":this._onSession(dataObject);break;case "refreshToken":this._onRefreshToken(dataObject["messages"]);
+break;case "expiredToken":this._onExpiredToken(dataObject);break;case "forceSaveStart":this._onForceSaveStart(dataObject["messages"]);break;case "forceSave":this._onForceSave(dataObject["messages"]);break}};DocsCoApi.prototype._onServerClose=function(evt){if(ConnectionState.SaveChanges===this._state){this._isReSaveAfterAuth=true;if(null!==this.saveCallbackErrorTimeOutId){clearTimeout(this.saveCallbackErrorTimeOutId);this.saveCallbackErrorTimeOutId=null}}this._state=ConnectionState.Reconnect;var bIsDisconnectAtAll=
+c_oCloseCode.serverShutdown<=evt.code&&evt.code<=c_oCloseCode.drop||this.attemptCount>=this.maxAttemptCount;var code=null;if(bIsDisconnectAtAll){this._state=ConnectionState.ClosedAll;code=evt.code}if(this.onDisconnect)this.onDisconnect(evt.reason,code);if(!bIsDisconnectAtAll)this._tryReconnect()};DocsCoApi.prototype._reconnect=function(){delete this.sockjs;this._initSocksJs()};DocsCoApi.prototype._tryReconnect=function(){var t=this;if(this.reconnectTimeout){clearTimeout(this.reconnectTimeout);t.reconnectTimeout=
+null}++this.attemptCount;this.reconnectTimeout=setTimeout(function(){t._reconnect()},this.reconnectInterval)};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CDocsCoApi=CDocsCoApi})(window);"use strict";
(function(window){var CSpellCheckApi=function(){this._SpellCheckApi=new SpellCheckApi;this._onlineWork=false;this.onDisconnect=null;this.onSpellCheck=null};CSpellCheckApi.prototype.init=function(docid){if(this._SpellCheckApi&&this._SpellCheckApi.isRightURL()){var t=this;this._SpellCheckApi.onDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){t.callback_OnDisconnect(e,isDisconnectAtAll,isCloseCoAuthoring)};this._SpellCheckApi.onSpellCheck=function(e){t.callback_OnSpellCheck(e)};this._SpellCheckApi.onInit=
function(e){t.callback_OnInit(e)};this._SpellCheckApi.init(docid);this._onlineWork=true}};CSpellCheckApi.prototype.set_url=function(url){if(this._SpellCheckApi)this._SpellCheckApi.set_url(url)};CSpellCheckApi.prototype.get_state=function(){if(this._SpellCheckApi)return this._SpellCheckApi.get_state();return 0};CSpellCheckApi.prototype.disconnect=function(){if(this._SpellCheckApi&&this._onlineWork)this._SpellCheckApi.disconnect()};CSpellCheckApi.prototype.spellCheck=function(spellCheckData){if(this._SpellCheckApi&&
this._onlineWork)this._SpellCheckApi.spellCheck(spellCheckData)};CSpellCheckApi.prototype.checkDictionary=function(lang){if(this._SpellCheckApi&&this._onlineWork)return this._SpellCheckApi.checkDictionary(lang);return true};CSpellCheckApi.prototype.callback_OnSpellCheck=function(e){if(this.onSpellCheck)return this.onSpellCheck(e)};CSpellCheckApi.prototype.callback_OnInit=function(e){if(this.onInit)return this.onInit(e)};CSpellCheckApi.prototype.callback_OnDisconnect=function(e,isDisconnectAtAll,isCloseCoAuthoring){if(this.onDisconnect)return this.onDisconnect(e,
@@ -1364,62 +1364,62 @@ prot["RegisteredSign"]=prot.RegisteredSign;prot["RightPara"]=prot.RightPara;prot
prot["SoftHyphen"]=prot.SoftHyphen;prot["HorizontalEllipsis"]=prot.HorizontalEllipsis;prot["Subscript"]=prot.Subscript;prot["IncreaseFontSize"]=prot.IncreaseFontSize;prot["DecreaseFontSize"]=prot.DecreaseFontSize;prot=window["Asc"]["c_oAscDocumentRefenceToType"]=window["Asc"].c_oAscDocumentRefenceToType=c_oAscDocumentRefenceToType;prot["Text"]=prot.Text;prot["PageNum"]=prot.PageNum;prot["ParaNum"]=prot.ParaNum;prot["ParaNumNoContext"]=prot.ParaNumNoContext;prot["ParaNumFullContex"]=prot.ParaNumFullContex;
prot["AboveBelow"]=prot.AboveBelow;prot["OnlyLabelAndNumber"]=prot.OnlyLabelAndNumber;prot["OnlyCaptionText"]=prot.OnlyCaptionText;prot["NoteNumber"]=prot.NoteNumber;prot["NoteNumberFormatted"]=prot.NoteNumberFormatted;"use strict";
(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=
-function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);
-return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=function(szSrc){return this.GetStream(szSrc,0,szSrc.length)};CCollaborativeChanges.prototype.GetStream=function(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";while(true){index++;var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0)){index++;
-break}dst_len+=String.fromCharCode(_c)}var dstLen=parseInt(dst_len);var pointer=AscFonts.g_memory.Alloc(dstLen);var stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;
-return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId=
-{};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=
-[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=
-function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();
-this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];
-Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=
-function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};
-CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index
-0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=
-this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=
-0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=
-oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=
-oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>
--1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof AscCommonWord.CDocument||oTable.Parent instanceof
-AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,1)}nContentLen=
-oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;var aSendingChanges=
-[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex=srcLen)break;var nCh=AscFonts.DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=
+0;i>>16;dwCurr<<=8}}}return stream};CCollaborativeChanges.prototype.private_SaveData=function(Binary){var Writer=AscCommon.History.BinaryWriter;var Pos=Binary.Pos;var Len=Binary.Len;return Len+";"+Writer.GetBase64Memory2(Pos,Len)};function CCollaborativeEditingBase(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_bGlobalLock=0;this.m_bGlobalLockSelection=
+0;this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[];this.m_aDC={};this.m_aChangedClasses={};this.m_oMemory=null;this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={};this.m_bFast=false;this.m_oLogicDocument=null;this.m_aDocumentPositions=new CDocumentPositionsManager;this.m_aForeignCursorsPos=new CDocumentPositionsManager;this.m_aForeignCursors={};this.m_aForeignCursorsId={};this.m_nAllChangesSavedIndex=0;this.m_aAllChanges=[];this.m_aOwnChangesIndexes=
+[];this.m_oOwnChanges=[]}CCollaborativeEditingBase.prototype.Clear=function(){this.m_nUseType=1;this.m_aUsers=[];this.m_aChanges=[];this.m_aNeedUnlock=[];this.m_aNeedUnlock2=[];this.m_aNeedLock=[];this.m_aLinkData=[];this.m_aEndActions=[];this.m_aCheckLocks=[];this.m_aCheckLocksInstance=[];this.m_aNewObjects=[];this.m_aNewImages=[]};CCollaborativeEditingBase.prototype.Set_Fast=function(bFast){this.m_bFast=bFast;if(false===bFast){this.Remove_AllForeignCursors();this.RemoveMyCursorFromOthers()}};CCollaborativeEditingBase.prototype.Is_Fast=
+function(){return this.m_bFast};CCollaborativeEditingBase.prototype.Is_SingleUser=function(){return 1===this.m_nUseType};CCollaborativeEditingBase.prototype.getCollaborativeEditing=function(){return!this.Is_SingleUser()};CCollaborativeEditingBase.prototype.Start_CollaborationEditing=function(){this.m_nUseType=-1};CCollaborativeEditingBase.prototype.End_CollaborationEditing=function(){if(this.m_nUseType<=0)this.m_nUseType=0};CCollaborativeEditingBase.prototype.Add_User=function(UserId){if(-1===this.Find_User(UserId))this.m_aUsers.push(UserId)};
+CCollaborativeEditingBase.prototype.Find_User=function(UserId){var Len=this.m_aUsers.length;for(var Index=0;Index0;if(true===OtherChanges){AscFonts.IsCheckSymbols=true;editor.WordControl.m_oLogicDocument.StopRecalculate();editor.WordControl.m_oLogicDocument.EndPreview_MailMergeResult();
+editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.ApplyChanges);var DocState=this.private_SaveDocumentState();this.Clear_NewImages();this.Apply_OtherChanges();this.Lock_NeedLock();this.private_RestoreDocumentState(DocState);this.OnStart_Load_Objects();AscFonts.IsCheckSymbols=false}};CCollaborativeEditingBase.prototype.Apply_OtherChanges=function(){AscCommon.g_oIdCounter.Set_Load(true);if(this.m_aChanges.length>0)this.private_CollectOwnChanges();var _count=this.m_aChanges.length;
+for(var i=0;i<_count;i++){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["native"]["CheckNextChange"])if(!window["native"]["CheckNextChange"]())break;var Changes=this.m_aChanges[i];Changes.Apply_Data()}this.private_ClearChanges();this.Apply_LinkData();this.Check_MergeData();this.OnEnd_ReadForeignChanges();AscCommon.g_oIdCounter.Set_Load(false)};CCollaborativeEditingBase.prototype.getOwnLocksLength=function(){return this.m_aNeedUnlock2.length};CCollaborativeEditingBase.prototype.Send_Changes=function(){};
+CCollaborativeEditingBase.prototype.Release_Locks=function(){};CCollaborativeEditingBase.prototype.CheckWaitingImages=function(aImages){};CCollaborativeEditingBase.prototype.SendImagesUrlsFromChanges=function(aImages){var rData={},oApi=editor||Asc["editor"],i;if(!oApi)return;rData["c"]="pathurls";rData["data"]=[];for(i=0;i0)this.SendImagesUrlsFromChanges(aImages);else{this.SendImagesCallback([].concat(this.m_aNewImages));this.m_aNewImages.length=0}};CCollaborativeEditingBase.prototype.OnEnd_Load_Objects=function(){};CCollaborativeEditingBase.prototype.Clear_LinkData=function(){this.m_aLinkData.length=0};CCollaborativeEditingBase.prototype.Add_LinkData=
+function(Class,LinkData){this.m_aLinkData.push({Class:Class,LinkData:LinkData})};CCollaborativeEditingBase.prototype.Apply_LinkData=function(){var Count=this.m_aLinkData.length;for(var Index=0;Index0){this.m_aOwnChangesIndexes.push({Position:this.m_aAllChanges.length,Count:arrChanges.length});this.m_aAllChanges=this.m_aAllChanges.concat(arrChanges)}};CCollaborativeEditingBase.prototype.Undo=function(){if(true===this.Get_GlobalLock())return;if(this.m_aOwnChangesIndexes.length<=0)return false;var arrChanges=[];var oIndexes=this.m_aOwnChangesIndexes[this.m_aOwnChangesIndexes.length-
+1];var nPosition=oIndexes.Position;var nCount=oIndexes.Count;for(var nIndex=nCount-1;nIndex>=0;--nIndex){var oChange=this.m_aAllChanges[nPosition+nIndex];if(!oChange)continue;var oClass=oChange.GetClass();if(oChange.IsContentChange()){var _oChange=oChange.Copy();if(this.private_CommutateContentChanges(_oChange,nPosition+nCount))arrChanges.push(_oChange);oChange.SetReverted(true)}else{var _oChange=oChange;if(this.private_CommutatePropertyChanges(oClass,_oChange,nPosition+nCount))arrChanges.push(_oChange)}}this.m_aOwnChangesIndexes.length=
+this.m_aOwnChangesIndexes.length-1;var arrReverseChanges=[];for(var nIndex=0,nCount=arrChanges.length;nIndex-1;--i)if(mapAddedSlides[oLogicDocument.Slides[i].Get_Id()]&&!oLogicDocument.Slides[i].Layout)oLogicDocument.removeSlide(i);for(var sId in mapSlides)if(mapSlides.hasOwnProperty(sId))mapSlides[sId].correctContent();
+if(bChangedLayout)for(var i=oLogicDocument.Slides.length-1;i>-1;--i){var Layout=oLogicDocument.Slides[i].Layout;if(!Layout||mapLayouts[Layout.Get_Id()])if(!oLogicDocument.Slides[i].CheckLayout())oLogicDocument.removeSlide(i)}for(var sId in mapGrObjects){var oShape=mapGrObjects[sId];if(!oShape.checkCorrect()){oShape.setBDeleted(true);if(oShape.group)oShape.group.removeFromSpTree(oShape.Get_Id());else if(AscFormat.Slide&&oShape.parent instanceof AscFormat.Slide)oShape.parent.removeFromSpTreeById(oShape.Get_Id());
+else if(AscCommonWord.ParaDrawing&&oShape.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oShape.parent.Get_Id()]=oShape.parent}else if(oShape.resetGroups)oShape.resetGroups()}var oDrawing;for(var sId in mapDrawings)if(mapDrawings.hasOwnProperty(sId)){oDrawing=mapDrawings[sId];if(!oDrawing.CheckCorrect()){var oParentParagraph=oDrawing.Get_ParentParagraph();oDrawing.PreDelete();oDrawing.Remove_FromDocument(false);if(oParentParagraph)mapParagraphs[oParentParagraph.Get_Id()]=oParentParagraph}}for(var sId in mapRuns)if(mapRuns.hasOwnProperty(sId)){var oRun=
+mapRuns[sId];for(var nIndex=oRun.Content.length-1;nIndex>-1;--nIndex)if(oRun.Content[nIndex]instanceof AscCommonWord.ParaDrawing)if(!oRun.Content[nIndex].CheckCorrect()){oRun.Remove_FromContent(nIndex,1,false);if(oRun.Paragraph)mapParagraphs[oRun.Paragraph.Get_Id()]=oRun.Paragraph}}for(var sId in mapTables){var oTable=mapTables[sId];for(var nCurRow=oTable.Content.length-1;nCurRow>=0;--nCurRow){var oRow=oTable.Get_Row(nCurRow);if(oRow.Get_CellsCount()<=0)oTable.private_RemoveRow(nCurRow)}if(oTable.Parent instanceof
+AscCommonWord.CDocument||oTable.Parent instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oTable.Parent.Get_Id()]=oTable.Parent}for(var sId in mapDocumentContents){var oDocumentContent=mapDocumentContents[sId];var nContentLen=oDocumentContent.Content.length;for(var nIndex=nContentLen-1;nIndex>=0;--nIndex){var oElement=oDocumentContent.Content[nIndex];if((AscCommonWord.type_Paragraph===oElement.GetType()||AscCommonWord.type_Table===oElement.GetType())&&oElement.Content.length<=0)oDocumentContent.Remove_FromContent(nIndex,
+1)}nContentLen=oDocumentContent.Content.length;if(nContentLen<=0||AscCommonWord.type_Paragraph!==oDocumentContent.Content[nContentLen-1].GetType()){var oNewParagraph=new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(),oDocumentContent,0,0,0,0,0,false);oDocumentContent.Add_ToContent(nContentLen,oNewParagraph)}}for(var sId in mapParagraphs){var oParagraph=mapParagraphs[sId];oParagraph.CheckParaEnd();oParagraph.Correct_Content(null,null,true)}var oBinaryWriter=AscCommon.History.BinaryWriter;
+var aSendingChanges=[];for(var nIndex=0,nCount=arrReverseChanges.length;nIndex=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=
+this.m_aAllChanges.length;nIndex0)oChange.ConvertFromSimpleActions(arrCommutateActions);else return false;return true};CCollaborativeEditingBase.prototype.private_Commutate=function(oActionL,oActionR){if(oActionL.Add)if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;else oActionR.Pos--;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else if(oActionL.Pos===oActionR.Pos)return false;else oActionR.Pos--;else if(oActionR.Add)if(oActionL.Pos>=oActionR.Pos)oActionL.Pos++;
else oActionR.Pos++;else if(oActionL.Pos>oActionR.Pos)oActionL.Pos--;else oActionR.Pos++;return true};CCollaborativeEditingBase.prototype.private_CommutatePropertyChanges=function(oClass,oChange,nStartPosition){if(oChange.CheckCorrect&&!oChange.CheckCorrect())return false;return true};CCollaborativeEditingBase.prototype.private_RecalculateDocument=function(oRecalcData){};function CDocumentPositionsManager(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=
[]}CDocumentPositionsManager.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions=[];this.m_aDocumentPositionsSplit=[];this.m_aDocumentPositionsMap=[]};CDocumentPositionsManager.prototype.Add_DocumentPosition=function(Position){this.m_aDocumentPositions.push(Position)};CDocumentPositionsManager.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){for(var PosIndex=0,PosCount=this.m_aDocumentPositions.length;PosIndex0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&
-AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);
-var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,
-sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=
-function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);
-else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeIdb.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,
-extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,
-plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};
-baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=
-function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&
-c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};
-baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
+(DownloadType.Print===downloadType||!downloadType)){var _cb=options.callback||this.fCurCallback;window.parent.APP.printPdf(dataContainer,function(obj){if(!obj){t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,actionType);return}_cb(obj)});return}AscCommon.saveWithParts(function(fCallback1,oAdditionalData1,dataContainer1){AscCommon.sendCommand(t,fCallback1,oAdditionalData1,dataContainer1)},this.fCurCallback,options.callback,oAdditionalData,dataContainer)};baseEditorsApi.prototype.asc_getChartPreviews=
+function(chartType){return this.chartPreviewManager.getChartPreviews(chartType)};baseEditorsApi.prototype.asc_getTextArtPreviews=function(){return this.textArtPreviewManager.getWordArtStyles()};baseEditorsApi.prototype.asc_onOpenChartFrame=function(){if(this.isMobileVersion)return;this.isOpenedChartFrame=true};baseEditorsApi.prototype.asc_onCloseChartFrame=function(){this.isOpenedChartFrame=false};baseEditorsApi.prototype.asc_setInterfaceDrawImagePlaceShape=function(elementId){this.shapeElementId=
+elementId};baseEditorsApi.prototype.asc_getPropertyEditorShapes=function(){return[AscCommon.g_oAutoShapesGroups,AscCommon.g_oAutoShapesTypes]};baseEditorsApi.prototype.asc_getPropertyEditorTextArts=function(){return[AscCommon.g_oPresetTxWarpGroups,AscCommon.g_PresetTxWarpTypes]};baseEditorsApi.prototype._addImageUrl=function(){};baseEditorsApi.prototype.asc_addImageCallback=function(res){};baseEditorsApi.prototype.asc_addImage=function(obj){var t=this;window.parent.APP.AddImage(function(res){console.log("AddImageCallback");
+t.asc_addImageCallback(res);t._addImageUrl([res.url])},function(){t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical)});return;var t=this;if(this.WordControl)this.WordControl.m_bIsMouseLock=false;AscCommon.ShowImageFileDialog(this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,files){t._uploadCallback(error,files,obj)},function(error){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);t.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,
+c_oAscAsyncAction.UploadImage)})};baseEditorsApi.prototype._uploadCallback=function(error,files,obj){var t=this;if(c_oAscError.ID.No!==error)this.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);else{this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);AscCommon.UploadImageFiles(files,this.documentId,this.documentUserId,this.CoAuthoringApi.get_jwt(),function(error,urls){if(c_oAscError.ID.No!==error)t.sendEvent("asc_onError",error,c_oAscError.Level.NoCritical);
+else t._addImageUrl(urls,obj);t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage)})}};baseEditorsApi.prototype.asc_replaceLoadImageCallback=function(fCallback){};baseEditorsApi.prototype.asc_loadLocalImageAndAction=function(sLocalImage,fCallback){var _loadedUrl=this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage),1);if(_loadedUrl!=null)fCallback(_loadedUrl);else this.asc_replaceLoadImageCallback(fCallback)};baseEditorsApi.prototype.asc_checkImageUrlAndAction=
+function(sImageUrl,fCallback){var oThis=this;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);var fCallback2=function(){oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.UploadImage);fCallback.apply(oThis,arguments)};var sLocalImage=AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);if(sLocalImage){this.asc_loadLocalImageAndAction(sLocalImage,fCallback2);return}AscCommon.sendImgUrls(oThis,[sImageUrl],function(data){if(data[0]&&
+data[0].path!=null&&data[0].url!=="error")oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path),fCallback2)},this.editorId===c_oEditorId.Spreadsheet)};baseEditorsApi.prototype.asc_addOleObject=function(oPluginData){if(this.isViewMode)return;var oThis=this;var sImgSrc=oPluginData["imgSrc"];var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var fWidth=oPluginData["width"];var fHeight=oPluginData["height"];var sData=oPluginData["data"];var sGuid=
+oPluginData["guid"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&typeof sGuid==="string"&&sGuid.length>0&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix)&&AscFormat.isRealNumber(fWidth)&&AscFormat.isRealNumber(fHeight))this.asc_checkImageUrlAndAction(sImgSrc,function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,sGuid,fWidth,fHeight,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_editOleObject=
+function(oPluginData){if(this.isViewMode)return;var oThis=this;var bResize=oPluginData["resize"];var sImgSrc=oPluginData["imgSrc"];var oOleObject=AscCommon.g_oTableId.Get_ById(oPluginData["objectId"]);var nWidthPix=oPluginData["widthPix"];var nHeightPix=oPluginData["heightPix"];var sData=oPluginData["data"];if(typeof sImgSrc==="string"&&sImgSrc.length>0&&typeof sData==="string"&&oOleObject&&AscFormat.isRealNumber(nWidthPix)&&AscFormat.isRealNumber(nHeightPix))this.asc_checkImageUrlAndAction(sImgSrc,
+function(oImage){oThis.asc_editOleObjectAction(bResize,oOleObject,AscCommon.g_oDocumentUrls.getImageLocal(oImage.src),sData,nWidthPix,nHeightPix)})};baseEditorsApi.prototype.asc_addOleObjectAction=function(sLocalUrl,sData,sApplicationId,fWidth,fHeight){};baseEditorsApi.prototype.asc_editOleObjectAction=function(bResize,oOleObject,sImageUrl,sData,nPixWidth,nPixHeight){};baseEditorsApi.prototype.asc_selectSearchingResults=function(value){if(this.selectSearchingResults===value)return;this.selectSearchingResults=
+value;this._selectSearchingResults(value)};baseEditorsApi.prototype.asc_startEditCurrentOleObject=function(){};baseEditorsApi.prototype.asc_canEditCrop=function(){};baseEditorsApi.prototype.asc_startEditCrop=function(){};baseEditorsApi.prototype.asc_endEditCrop=function(){};baseEditorsApi.prototype.asc_cropFit=function(){};baseEditorsApi.prototype.asc_cropFill=function(){};baseEditorsApi.prototype.asc_RemoveAllComments=function(isMine,isCurrent){};baseEditorsApi.prototype.asc_showRevision=function(newObj){if(!newObj.docId)return;
+if(this.isCoAuthoringEnable)this.asc_coAuthoringDisconnect();var bUpdate=true;if(null===this.VersionHistory)this.VersionHistory=new window["Asc"].asc_CVersionHistory(newObj);else bUpdate=this.VersionHistory.update(newObj);if(bUpdate){this.asc_CloseFile();this.DocInfo.put_Id(this.VersionHistory.docId);this.DocInfo.put_Url(this.VersionHistory.url);this.documentUrlChanges=this.VersionHistory.urlChanges;this.asc_setDocInfo(this.DocInfo);this.asc_LoadDocument(this.VersionHistory)}else if(this.VersionHistory.currentChangeId<
+newObj.currentChangeId){AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();editor.VersionHistory.applyChanges(editor);AscCommon.CollaborativeEditing.Apply_Changes()}};baseEditorsApi.prototype.asc_undoAllChanges=function(){};baseEditorsApi.prototype.asc_getAdvancedOptions=function(){var cp={"codepage":AscCommon.c_oAscCodePageUtf8,"encodings":AscCommon.getEncodingParams()};return new AscCommon.asc_CAdvancedOptions(cp)};baseEditorsApi.prototype.asc_Print=function(options){if(window["AscDesktopEditor"]&&
+this._printDesktop(options))return;if(!options)options=new Asc.asc_CDownloadOptions;options.fileType=Asc.c_oAscFileType.PDF;this.downloadAs(c_oAscAsyncAction.Print,options)};baseEditorsApi.prototype.asc_Save=function(isAutoSave,isIdle){var t=this;var res=false;if(this.canSave&&this._saveCheck()){this.IsUserSave=!isAutoSave;if(this.asc_isDocumentCanSave()||AscCommon.History.Have_Changes()||this._haveOtherChanges()||this.canUnlockDocument||this.forceSaveUndoRequest){if(this._prepareSave(isIdle)){this.canSave=
+false;this.CoAuthoringApi.askSaveChanges(function(e){t._onSaveCallback(e)});res=true}}else if(this.isForceSaveOnUserSave&&this.IsUserSave)this.forceSave()}return res};baseEditorsApi.prototype.asc_isDocumentCanSave=function(){return this.isDocumentCanSave};baseEditorsApi.prototype.asc_getCanUndo=function(){return AscCommon.History.Can_Undo()};baseEditorsApi.prototype.asc_getCanRedo=function(){return AscCommon.History.Can_Redo()};baseEditorsApi.prototype.asc_isOffline=function(){return window.location.protocol.indexOf("file")==
+0?true:false};baseEditorsApi.prototype.asc_getUrlType=function(url){return AscCommon.getUrlType(url)};baseEditorsApi.prototype.openDocument=function(file){};baseEditorsApi.prototype.openDocumentFromZip=function(){};baseEditorsApi.prototype.onEndLoadDocInfo=function(){if(this.isLoadFullApi&&this.DocInfo){if(this.DocInfo.get_OfflineApp())this._openChartOrLocalDocument();this.onEndLoadFile(null)}};baseEditorsApi.prototype.onEndLoadFile=function(result){if(result)this.openResult=result;if(this.isLoadFullApi&&
+this.DocInfo&&this.openResult&&this.isLoadFonts){this.openDocument(this.openResult);this.openResult=null}};baseEditorsApi.prototype._onEndLoadSdk=function(){AscCommon.g_oTableId.init();var t=this;AscCommon.InitDragAndDrop(this.HtmlElement,function(error,files){t._uploadCallback(error,files)});AscFonts.g_fontApplication.Init();this.FontLoader=AscCommon.g_font_loader;this.ImageLoader=AscCommon.g_image_loader;this.FontLoader.put_Api(this);this.ImageLoader.put_Api(this);this.FontLoader.SetStandartFonts();
+this.chartPreviewManager=new AscCommon.ChartPreviewManager;this.textArtPreviewManager=new AscCommon.TextArtPreviewManager;AscFormat.initStyleManager();if(null!==this.tmpFocus)this.asc_enableKeyEvents(this.tmpFocus);this.pluginsManager=Asc.createPluginsManager(this);this.macros=new AscCommon.CDocumentMacros;this._loadSdkImages();if(AscFonts.FontPickerByCharacter&&this.documentTitle)AscFonts.FontPickerByCharacter.getFontsByString(this.documentTitle)};baseEditorsApi.prototype._loadSdkImages=function(){};
+baseEditorsApi.prototype.sendStandartTextures=function(){if(this.isSendStandartTextures)return;this.isSendStandartTextures=true;var _count=AscCommon.g_oUserTexturePresets.length;var arr=new Array(_count);var arrToDownload=[];for(var i=0;i<_count;++i){arr[i]=new AscCommon.asc_CTexture;arr[i].Id=i;arr[i].Image=AscCommon.g_oUserTexturePresets[i];arrToDownload.push(AscCommon.g_oUserTexturePresets[i])}if(this.editorId===c_oEditorId.Word)arrToDownload.push(AscCommon.g_sWordPlaceholderImage);this.ImageLoader.LoadImagesWithCallback(arrToDownload,
+function(){},0);this.sendEvent("asc_onInitStandartTextures",arr)};baseEditorsApi.prototype.sendMathToMenu=function(){if(this.MathMenuLoad)return;var _MathPainter=new AscFormat.CMathPainter(this);_MathPainter.Generate();this.MathMenuLoad=true};baseEditorsApi.prototype.sendMathTypesToMenu=function(_math){this.sendEvent("asc_onMathTypes",_math)};baseEditorsApi.prototype.asyncFontEndLoaded_MathDraw=function(Obj){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont);Obj.Generate2()};
+baseEditorsApi.prototype.getCurrentColorScheme=function(){var oTheme=this.getCurrentTheme();return oTheme&&oTheme.themeElements&&oTheme.themeElements.clrScheme};baseEditorsApi.prototype.asc_GetCurrentColorSchemeName=function(){var oClrScheme=this.getCurrentColorScheme();if(oClrScheme&&typeof oClrScheme.name==="string")return oClrScheme.name;return""};baseEditorsApi.prototype.asc_GetCurrentColorSchemeIndex=function(){var oTheme=this.getCurrentTheme();if(!oTheme)return-1;return this.getColorSchemes(oTheme).index};
+baseEditorsApi.prototype.getCurrentTheme=function(){return null};baseEditorsApi.prototype.getColorSchemes=function(theme){var result=AscCommon.g_oUserColorScheme.slice();var asc_color_scheme,_scheme,i;var aCustomSchemes=theme.getExtraAscColorSchemes();_scheme=theme.themeElements&&theme.themeElements.clrScheme;var nIndex=-1;if(_scheme){asc_color_scheme=AscCommon.getAscColorScheme(_scheme,theme);nIndex=AscCommon.getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex===-1)aCustomSchemes.push(asc_color_scheme);
+aCustomSchemes.sort(function(a,b){if(a.name===""||a.name===null)return-1;if(b.name===""||b.name===null)return 1;if(a.name>b.name)return 1;if(a.name=0&&manager.SlideNum>0;var _zoom=_w/(_w_mm*AscCommon.g_dKoef_mm_to_pix);if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,
+_x,transition.Rect.y,extX,extY,_zoom);else window["AscDesktopEditor"]["MediaStart"](sMediaName,_x,transition.Rect.y,extX,extY,_zoom,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}}break}case c_oEditorId.Spreadsheet:{break}}};baseEditorsApi.prototype.hideVideoControl=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaEnd"])return;window["AscDesktopEditor"]["MediaEnd"]()};baseEditorsApi.prototype._checkLicenseApiFunctions=function(){return this.licenseResult&&
+true===this.licenseResult["plugins"]};baseEditorsApi.prototype.asc_pluginsRegister=function(basePath,plugins){this.sendEvent("asc_LoadPluginsOrDocument");if(null!=this.pluginsManager){this.pluginsManager.register(basePath,plugins);if(this.pluginsManager.countEventDocContOrPluginsReady==2)this.pluginsManager.onPluginEvent("onDocumentContentReady")}};baseEditorsApi.prototype.asc_pluginRun=function(guid,variation,pluginData){if(null!=this.pluginsManager)this.pluginsManager.run(guid,variation,pluginData)};
+baseEditorsApi.prototype.asc_pluginStop=function(guid){if(null!=this.pluginsManager)this.pluginsManager.close(guid)};baseEditorsApi.prototype.asc_pluginResize=function(pluginData){if(null!=this.pluginsManager)this.pluginsManager.runResize(pluginData)};baseEditorsApi.prototype.asc_pluginButtonClick=function(id){if(null!=this.pluginsManager)this.pluginsManager.buttonClick(id)};baseEditorsApi.prototype.asc_pluginEnableMouseEvents=function(isEnable){if(!this.pluginsManager)return;this.pluginsManager.onEnableMouseEvents(isEnable)};
+baseEditorsApi.prototype.isEnabledDropTarget=function(){return true};baseEditorsApi.prototype.beginInlineDropTarget=function(e){};baseEditorsApi.prototype.endInlineDropTarget=function(e){};baseEditorsApi.prototype["asc_insertSymbol"]=function(familyName,code,pr){var arrCharCodes=[code];AscFonts.FontPickerByCharacter.checkTextLight(arrCharCodes,true);var fonts=[new AscFonts.CFont(AscFonts.g_fontApplication.GetFontInfoName(familyName),0,"",0,null)];AscFonts.FontPickerByCharacter.extendFonts(fonts);
+this.asyncMethodCallback=function(){switch(this.editorId){case c_oEditorId.Word:case c_oEditorId.Presentation:{if(pr&&c_oEditorId.Word===this.editorId)this.WordControl.m_oLogicDocument.AddSpecialSymbol(pr);else{var textPr=new AscCommonWord.CTextPr;textPr.SetFontFamily(familyName);this.WordControl.m_oLogicDocument.AddTextWithPr(new AscCommon.CUnicodeStringEmulator(arrCharCodes),textPr,true)}break}case c_oEditorId.Spreadsheet:{this.AddTextWithPr(familyName,arrCharCodes);break}}};if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){this.asyncMethodCallback();
+this.asyncMethodCallback=undefined;return}AscCommon.g_font_loader.LoadDocumentFonts2(fonts)};baseEditorsApi.prototype["asc_registerPlaceholderCallback"]=function(type,callback){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.registerCallback(type,callback)};baseEditorsApi.prototype["asc_uncheckPlaceholders"]=function(){if(this.WordControl&&this.WordControl.m_oDrawingDocument&&this.WordControl.m_oDrawingDocument.placeholders)this.WordControl.m_oDrawingDocument.placeholders.closeAllActive()};
baseEditorsApi.prototype.asc_nativeInitBuilder=function(){AscCommon.History.TurnOff();this.asc_setDocInfo(new Asc.asc_CDocInfo)};baseEditorsApi.prototype.asc_SetSilentMode=function(){};baseEditorsApi.prototype.asc_canPaste=function(){return false};baseEditorsApi.prototype.asc_Recalculate=function(){};baseEditorsApi.prototype["asc_nativeCheckPdfRenderer"]=function(_memory1,_memory2){if(true){_memory1.Copy=_memory1["Copy"];_memory1.ClearNoAttack=_memory1["ClearNoAttack"];_memory1.WriteByte=_memory1["WriteByte"];
_memory1.WriteBool=_memory1["WriteBool"];_memory1.WriteLong=_memory1["WriteLong"];_memory1.WriteDouble=_memory1["WriteDouble"];_memory1.WriteString=_memory1["WriteString"];_memory1.WriteString2=_memory1["WriteString2"];_memory2.Copy=_memory1["Copy"];_memory2.ClearNoAttack=_memory1["ClearNoAttack"];_memory2.WriteByte=_memory1["WriteByte"];_memory2.WriteBool=_memory1["WriteBool"];_memory2.WriteLong=_memory1["WriteLong"];_memory2.WriteDouble=_memory1["WriteDouble"];_memory2.WriteString=_memory1["WriteString"];
_memory2.WriteString2=_memory1["WriteString2"]}var _printer=new AscCommon.CDocumentRenderer;_printer.Memory=_memory1;_printer.VectorMemoryForPrint=_memory2;return _printer};baseEditorsApi.prototype.Begin_CompositeInput=function(){};baseEditorsApi.prototype.Add_CompositeText=function(nCharCode){};baseEditorsApi.prototype.Remove_CompositeText=function(nCount){};baseEditorsApi.prototype.Replace_CompositeText=function(arrCharCodes){};baseEditorsApi.prototype.Set_CursorPosInCompositeText=function(nPos){};
diff --git a/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js b/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js
index 4cb1f3ba0..8f3cebf17 100644
--- a/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js
+++ b/www/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/app.js
@@ -27,7 +27,7 @@ this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",s)}},onSuperscri
;t=e.asc_getIsTop10Sum(),this.setTitle(this.txtValueTitle+" ("+n[0]+")"),n.shift();var s=[];n&&n.forEach(function(t,e){t&&s.push({value:e,displayValue:t})}),this.cmbFields.setData(s),this.cmbFields.setValue(0!==i?i-1:0)}var o=this.properties.asc_getFilterObj();if(o.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var a=o.asc_getFilter(),l=a.asc_getTop(),r=a.asc_getPercent();this.cmbType.setValue(l||null===l),this.cmbItem.setValue(t?0:r||null===r),this.spnCount.setDefaultUnit(!r&&null!==r||t?"":"%"),this.spnCount.setValue(a.asc_getVal())}}},save:function(){if(this.api&&this.properties){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.Top10),t.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var e=t.asc_getFilter();if(e.asc_setTop(this.cmbType.getValue()),e.asc_setPercent(!0===this.cmbItem.getValue()),e.asc_setVal(this.spnCount.getNumberValue()),"value"==this.type){var i=this.properties.asc_getPivotObj();i.asc_setIsTop10Sum(0===this.cmbItem.getValue()),i.asc_setDataFieldIndexFilter("value"==this.type?this.cmbFields.getValue()+1:0)}this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},txtTitle:"Top 10 AutoFilter",textType:"Show",txtTop:"Top",txtBottom:"Bottom",txtItems:"Item",txtPercent:"Percent",txtValueTitle:"Top 10 Filter",txtSum:"Sum",txtBy:"by"},SSE.Views.Top10FilterDialog||{})),SSE.Views.PivotDigitalFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={};_.extend(i,{width:501,height:210,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:"label"==t.type?e.txtTitleLabel:e.txtTitleValue,items:[]},t),this.api=t.api,this.handler=t.handler,this.type=t.type||"value",this.template=t.template||['','
','",'
','
','
','
','
'+this.txtAnd+" ",'
',"
",'
',''+e.textUse1+" ",''+e.textUse2+" ","
","
","
",'
','"].join(""),i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6},{value:-2,displayValue:this.capCondition13},{value:-3,displayValue:this.capCondition14}],"label"==this.type&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-cond-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals),this.cmbCondition1.on("selected",_.bind(function(t,e){var i=-2==e.value||-3==e.value;this.inputValue2.setVisible(i),this.lblAnd.toggleClass("hidden",!i),this.inputValue.$el.width(i?100:225);var n=this;_.defer(function(){n.inputValue&&n.inputValue.focus()},10)},this)),this.cmbFields=new Common.UI.ComboBox({el:$("#id-field-digital-combo",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,takeFocusOnClose:!0}),this.cmbFields.setVisible("value"==this.type),this.cmbFields.on("selected",_.bind(function(t,e){var i=this;_.defer(function(){i.inputValue&&i.inputValue.focus()},10)},this)),this.inputValue=new Common.UI.InputField({el:$("#id-input-digital-value1"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.inputValue2=new Common.UI.InputField({el:$("#id-input-digital-value2"),allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.lblAnd=this.$window.find("#id-label-digital-and"),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},getFocusedComponents:function(){return[this.cmbFields,this.cmbCondition1,this.inputValue,this.inputValue2]},getDefaultFocusableComponent:function(){return this.inputValue},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexFilter(),i=t.asc_getDataFields();if(this.setTitle(this.options.title+" ("+i[0]+")"),"value"==this.type){i.shift();var n=[];i&&i.forEach(function(t,e){t&&n.push({value:e,displayValue:t})}),this.cmbFields.setData(n),this.cmbFields.setValue(0!==e?e-1:0)}var s=this.properties.asc_getFilterObj();if(s.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var o=s.asc_getFilter(),a=o.asc_getCustomFilters(),l=a[0].asc_getOperator();if(a.length>1){var r=o.asc_getAnd(),c=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,h=a[0].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isLessThan&&a[1].asc_getOperator()==Asc.c_oAscCustomAutoFilter.isGreaterThan;r&&c?l=-2:!r&&h&&(l=-3)}this.cmbCondition1.setValue(l||Asc.c_oAscCustomAutoFilter.equals),this.inputValue.setValue(null===a[0].asc_getVal()?"":a[0].asc_getVal()),this.inputValue.$el.width(-2==l||-3==l?100:225),this.lblAnd.toggleClass("hidden",!(-2==l||-3==l)),this.inputValue2.setVisible(-2==l||-3==l),this.inputValue2.setValue(a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.cmbCondition1&&this.cmbFields&&this.inputValue){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.CustomFilters),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var e=t.asc_getFilter(),i=this.cmbCondition1.getValue();if(-2==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),n[1].asc_setVal(this.inputValue2.getValue())}else if(-3==i){e.asc_setCustomFilters([new Asc.CustomFilter,new Asc.CustomFilter]),e.asc_setAnd(!1);var n=e.asc_getCustomFilters();n[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThan),n[0].asc_setVal(this.inputValue.getValue()),n[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isGreaterThan),n[1].asc_setVal(this.inputValue2.getValue())}else{e.asc_setCustomFilters([new Asc.CustomFilter]),e.asc_setAnd(!0);var n=e.asc_getCustomFilters();n[0].asc_setOperator(this.cmbCondition1.getValue()),n[0].asc_setVal(this.inputValue.getValue())}this.properties.asc_getPivotObj().asc_setDataFieldIndexFilter("value"==this.type?this.cmbFields.getValue()+1:0),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},capCondition1:"equals",capCondition10:"does not end with",capCondition11:"contains",capCondition12:"does not contain",capCondition2:"does not equal",capCondition3:"is greater than",capCondition4:"is greater than or equal to",capCondition5:"is less than",capCondition6:"is less than or equal to",capCondition7:"begins with",capCondition8:"does not begin with",capCondition9:"ends with",textShowLabel:"Show items for which the label:",textShowValue:"Show items for which:",textUse1:"Use ? to present any single character",textUse2:"Use * to present any series of character",txtTitleValue:"Value Filter",txtTitleLabel:"Label Filter",capCondition13:"between",capCondition14:"not between",txtAnd:"and"},SSE.Views.PivotDigitalFilterDialog||{})),SSE.Views.SortFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={};this.type=t.type,_.extend(i,{width:250,height:215,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[],buttons:["ok","cancel"]},t),this.template=t.template||['",'
'].join(""),this.api=t.api,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){Common.UI.Window.prototype.render.call(this),this.radioAsc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-asc"),labelText:this.textAsc,name:"asc-radio-sort",checked:!0}),this.radioAsc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!1),e&&this.cmbFieldsDesc.setDisabled(!0)},this)),this.radioDesc=new Common.UI.RadioBox({el:$("#id-sort-filter-radio-desc"),labelText:this.textDesc,name:"asc-radio-sort"}),this.radioDesc.on("change",_.bind(function(t,e){e&&this.cmbFieldsAsc.setDisabled(!0),e&&this.cmbFieldsDesc.setDisabled(!1)},this)),this.cmbFieldsAsc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-asc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1}),this.cmbFieldsDesc=new Common.UI.ComboBox({el:$("#id-sort-filter-fields-desc",this.$window),menuStyle:"min-width: 100%;max-height: 135px;",style:"width:100%;",cls:"input-group-nr",data:[],scrollAlwaysVisible:!0,editable:!1,disabled:!0}),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties){var t=this.properties.asc_getPivotObj(),e=t.asc_getDataFieldIndexSorting(),i=t.asc_getDataFields(),n=this.properties.asc_getSortState();this.setTitle(this.txtTitle+" ("+i[0]+")");var s=[];i&&i.forEach(function(t,e){t&&s.push({value:e,displayValue:t})}),this.cmbFieldsAsc.setData(s),this.cmbFieldsAsc.setValue(e>=0?e:0),this.cmbFieldsDesc.setData(s),this.cmbFieldsDesc.setValue(e>=0?e:0),this.radioDesc.setValue(n==Asc.c_oAscSortOptions.Descending,!0),this.cmbFieldsDesc.setDisabled(n!==Asc.c_oAscSortOptions.Descending)}},save:function(){if(this.api&&this.properties){var t=this.radioAsc.getValue()?this.cmbFieldsAsc:this.cmbFieldsDesc;this.properties.asc_getPivotObj().asc_setDataFieldIndexSorting(t.getValue()),this.properties.asc_setSortState(this.radioAsc.getValue()?Asc.c_oAscSortOptions.Ascending:Asc.c_oAscSortOptions.Descending),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},txtTitle:"Sort",textAsc:"Ascenging (A to Z) by",textDesc:"Descending (Z to A) by"},SSE.Views.SortFilterDialog||{})),SSE.Views.AutoFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e=this,i={},n=450,s=void 0;Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(n=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0],s=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]),_.extend(i,{width:n||450,height:s||265,contentWidth:n-50||400,header:!1,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,modal:!1,animate:!1,items:[],resizable:!0,minwidth:450,minheight:265},t),this.template=t.template||['"].join(""),this.api=t.api,this.handler=t.handler,this.throughIndexes=[],this.filteredIndexes=[],this.curSize=null,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this))},render:function(){var t=this;Common.UI.Window.prototype.render.call(this);var e=this.$window.find(".resize-border");this.$window.find(".resize-border.left, .resize-border.top").css({cursor:"default"}),e.css({background:"none",border:"none"}),e.removeClass("left"),e.removeClass("top"),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,enableToggle:!1,allowDepress:!1}),this.btnOk&&(this.btnOk.render($("#id-apply-filter",this.$window)),this.btnOk.on("click",_.bind(this.onApplyFilter,this))),this.miSortLow2High=new Common.UI.MenuItem({caption:this.txtSortLow2High,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortLow2High.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),this.miSortHigh2Low=new Common.UI.MenuItem({caption:this.txtSortHigh2Low,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortHigh2Low.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),this.miSortOptions=new Common.UI.MenuItem({caption:this.txtSortOption}),this.miSortOptions.on("click",_.bind(this.onSortOptions,this)),this.miSortCellColor=new Common.UI.MenuItem({caption:this.txtSortCellColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miSortFontColor=new Common.UI.MenuItem({caption:this.txtSortFontColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('
')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});for(var i=this.miNumFilter.menu.items,n=0;n ')}]})}),this.miFilterFontColor=new Common.UI.MenuItem({caption:this.txtFilterFontColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('