Merge branch 'pad_to_document' into soon

pull/1/head
David Benqué 3 years ago
commit 54cc6da763

@ -7,12 +7,16 @@ define([
'/customize/pages.js',
'/api/config',
'/common/common-ui-elements.js',
], function ($, h, Msg, AppConfig, LocalStore, Pages, Config, UIElements) {
'/common/common-constants.js',
], function ($, h, Msg, AppConfig, LocalStore, Pages, Config, UIElements, Constants) {
var accounts = Pages.accounts;
return function () {
Msg.features_f_apps_note = AppConfig.availablePadTypes.map(function (app) {
if (AppConfig.registeredOnlyTypes.indexOf(app) !== -1) { return; }
if (AppConfig.premiumTypes && AppConfig.premiumTypes.includes(app)) { return; }
if (Constants.earlyAccessApps && Constants.earlyAccessApps.includes(app) &&
AppConfig.enableEarlyAccess) { return; }
return Msg.type[app];
}).filter(function (x) { return x; }).join(', ');
var premiumButton = h('a', {

@ -5,12 +5,14 @@ define([
'/common/common-feedback.js',
'/common/common-interface.js',
'/common/common-hash.js',
'/common/common-constants.js',
'/common/common-util.js',
'/lib/textFit.min.js',
'/customize/messages.js',
'/customize/application_config.js',
'/common/outer/local-store.js',
'/customize/pages.js'
], function ($, Config, h, Feedback, UI, Hash, TextFit, Msg, AppConfig, LocalStore, Pages) {
], function ($, Config, h, Feedback, UI, Hash, Constants, Util, TextFit, Msg, AppConfig, LocalStore, Pages) {
var urlArgs = Config.requireConf.urlArgs;
var isAvailableType = function (x) {
@ -18,6 +20,17 @@ define([
return AppConfig.availablePadTypes.indexOf(x) !== -1;
};
// XXX PREMIUM
var checkEarlyAccess = function (x) {
// Check if this is an early access app and if they are allowed.
// Check if this is a premium app and if you're premium
// Returns false if the app should be hidden
var earlyTypes = Constants.earlyAccessApps;
var ea = Util.checkRestrictedApp(x, AppConfig, earlyTypes,
LocalStore.getPremium(), LocalStore.isLoggedIn());
return ea > 0;
};
var checkRegisteredType = function (x) {
// Return true if we're registered or if the app is not registeredOnly
if (LocalStore.isLoggedIn()) { return true; }
@ -27,20 +40,24 @@ define([
return function () {
var icons = [
[ 'sheet', Msg.type.sheet],
[ 'doc', Msg.type.doc],
[ 'presentation', Msg.type.presentation],
[ 'pad', Msg.type.pad],
[ 'code', Msg.type.code],
[ 'slide', Msg.type.slide],
[ 'sheet', Msg.type.sheet],
[ 'form', Msg.type.form],
[ 'kanban', Msg.type.kanban],
[ 'whiteboard', Msg.type.whiteboard],
[ 'slide', Msg.type.slide],
[ 'drive', Msg.type.drive]
].filter(function (x) {
return isAvailableType(x[0]);
})
.map(function (x) {
var s = 'div.bs-callout.cp-callout-' + x[0];
var cls = '';
var isEnabled = checkRegisteredType(x[0]);
var isEAEnabled = checkEarlyAccess(x[0]);
//if (i > 2) { s += '.cp-more.cp-hidden'; }
var icon = AppConfig.applicationsIcon[x[0]];
var font = icon.indexOf('cptools') === 0 ? 'cptools' : 'fa';
@ -52,11 +69,14 @@ define([
window.location.href = url;
}
};
if (!isEAEnabled) {
cls += '.cp-app-hidden';
}
if (!isEnabled) {
s += '.cp-app-disabled';
cls += '.cp-app-disabled';
attr.title = Msg.mustLogin;
}
return h('a', [
return h('a.cp-index-appitem' + cls, [
attr,
h(s, [
h('i.' + font + '.' + icon, {'aria-hidden': 'true'}),

@ -55,10 +55,20 @@
color: @cp_context-fg;
}
.fa, .cptools {
&:first-child {
margin-right: 10px;
}
&.cptools:not(:first-child) {
vertical-align: middle;
}
color: @cp_context-icon;
width: 16px;
}
// XXX PREMIUM
&.cp-app-disabled {
cursor: not-allowed !important;
opacity: 0.5;
}
}
}
.cp-app-drive-context-noAction {

@ -80,6 +80,16 @@
display: none;
}
}
// XXX PREMIUM
&.cp-app-hidden {
display: none !important;
}
&.cp-app-disabled {
cursor: not-allowed !important;
.fa, .cptools { cursor: not-allowed !important; }
opacity: 0.5;
}
}
}
@ -286,7 +296,9 @@
display: none;
}
input {
width: ~"calc(100% - 30px)";
//width: ~"calc(100% - 30px)";
flex: 1;
min-width: 0;
padding: 0 10px;
border: 0;
height: auto;
@ -298,8 +310,9 @@
.leftside-menu-category_main();
width: ~"calc(100% + 5px)";
margin: 0;
margin-bottom: -6px;
display: inline-block;
//margin-bottom: -6px;
display: flex;
align-items: center;
cursor: pointer;
margin-left: -5px;
padding-left: 5px;
@ -309,6 +322,12 @@
width: 25px;
margin-right: 0px;
}
.cp-app-drive-element {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}

@ -120,6 +120,15 @@
background-color: @cp_dropdown-bg-active;
color: @cp_dropdown-fg;
}
// XXX PREMIUM
&.cp-app-hidden {
display: none;
}
&.cp-app-disabled {
cursor: not-allowed !important;
opacity: 0.5;
}
}
&> span {
box-sizing: border-box;

@ -117,9 +117,6 @@
margin-right: 5px;
}
}
.cptools {
vertical-align: middle;
}
color: @cp_buttons-fg;
border: 1px solid @cp_buttons-fg;

@ -38,5 +38,15 @@
display: none;
}
}
// XXX PREMIUM
&.cp-app-hidden {
display: none !important;
}
&.cp-app-disabled {
cursor: not-allowed !important;
.fa, .cptools { cursor: not-allowed !important; }
opacity: 0.5;
}
}
}

@ -118,15 +118,23 @@
padding: 10px 10px 0px 10px;
//height: @icons-size - @icons-text-size;
}
&.cp-app-disabled {
cursor: not-allowed !important;
opacity: 0.5;
}
.pad-button-text {
color: @cryptpad_text_col;
padding: 5px;
}
}
.cp-index-appitem {
// XXX PREMIUM
&.cp-app-hidden {
display: none;
}
&.cp-app-disabled {
div {
cursor: not-allowed !important;
}
opacity: 0.5;
}
}
h4 {
margin: 0;
}

@ -513,7 +513,8 @@ define([
options: types, // Entries displayed in the menu
isSelect: true,
initialValue: '.ics',
common: common
common: common,
buttonCls: 'btn',
};
var $select = UIElements.createDropdown(dropdownConfig);
UI.prompt(Messages.exportPrompt,

@ -11,8 +11,8 @@ define(function() {
* redirected to the drive.
* You should never remove the drive from this list.
*/
AppConfig.availablePadTypes = ['drive', 'teams', 'pad', 'sheet', 'code', 'slide', 'poll', 'kanban', 'whiteboard',
/*'doc', 'presentation',*/ 'file', /*'todo',*/ 'contacts', 'form', 'convert'];
AppConfig.availablePadTypes = ['drive', 'teams', 'sheet', 'doc', 'presentation', 'pad', 'code', 'slide', 'poll', 'kanban', 'whiteboard',
'file', 'contacts', 'form', 'convert'];
/* The registered only types are apps restricted to registered users.
* You should never remove apps from this list unless you know what you're doing. The apps
* listed here by default can't work without a user account.
@ -22,6 +22,13 @@ define(function() {
*/
AppConfig.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support'];
/* New application may be introduced in an "early access" state which can contain
* bugs and can cause loss of user content. You can enable these applications on your
* CryptPad instance to test them and report bugs to the developers or keep them
* disable until they are officialy considered safe.
*/
AppConfig.enableEarlyAccess = false;
// to prevent apps that aren't officially supported from showing up
// in the document creation modal
AppConfig.hiddenTypes = ['drive', 'teams', 'contacts', 'todo', 'file', 'accounts', 'calendar', 'poll', 'convert',

@ -11,11 +11,13 @@ define(['/customize/application_config.js'], function (AppConfig) {
storageKey: 'filesData',
tokenKey: 'loginToken',
prefersDriveRedirectKey: 'prefersDriveRedirect',
isPremiumKey: 'isPremiumUser',
displayPadCreationScreen: 'displayPadCreationScreen',
deprecatedKey: 'deprecated',
MAX_TEAMS_SLOTS: AppConfig.maxTeamsSlots || 5,
MAX_TEAMS_OWNED: AppConfig.maxOwnedTeams || 5,
// Apps
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications', 'calendar']
criticalApps: ['profile', 'settings', 'debug', 'admin', 'support', 'notifications', 'calendar'],
earlyAccessApps: ['doc', 'presentation']
};
});

@ -2087,6 +2087,7 @@ define([
};
UIElements.createNewPadModal = function (common) {
// if in drive, show new pad modal instead
if ($(".cp-app-drive-element-row.cp-app-drive-new-ghost").length !== 0) {
@ -2113,6 +2114,7 @@ define([
AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; }
return true;
});
types.forEach(function (p) {
var $element = $('<li>', {
'class': 'cp-icons-element',
@ -2125,6 +2127,13 @@ define([
$modal.hide();
common.openURL('/' + p + '/');
});
// XXX PREMIUM
var premium = common.checkRestrictedApp(p);
if (premium < 0) {
$element.addClass('cp-app-hidden cp-app-disabled');
} else if (premium === 0) {
$element.addClass('cp-app-disabled');
}
});
var selected = -1;
@ -2268,6 +2277,7 @@ define([
var type = metadataMgr.getMetadataLazy().type || privateData.app;
var fromFileData = privateData.fromFileData;
var fromContent = privateData.fromContent;
var $body = $('body');
var $creationContainer = $('<div>', { 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);
}

@ -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)) {

@ -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 = '<i class="'+cls+'"></i>' + 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': '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': faOpenInCode,
}, Messages.fc_openInCode)),
'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 = $('<span>', {
'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($('<span>', {'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')) {

@ -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) {

@ -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);

File diff suppressed because it is too large Load Diff

@ -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,

@ -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
};
});

@ -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.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<b.name)return-1;
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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){};

@ -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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};
CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);
this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls=
{};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));
else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};
CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-
1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=
function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=
0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,
false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=
function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();
this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=
function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();
this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=
CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=
function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=
UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,
Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,
SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};
CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);
else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);
if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};
CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);
if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=
function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=
0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===
oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);
oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();
this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=
oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&
oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=
oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();
var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<
nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,
null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=
function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();
for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position&&(_Pos.Position>Pos||_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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position){if(_Pos.Position>Pos+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<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(SplitRun===_Pos.Class&&_Pos.Position&&_Pos.Position>=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;PosIndex<PosCount;++PosIndex){var NewDocPos=[];NewDocPos.push({Class:NewRun,Position:this.m_aDocumentPositionsSplit[PosIndex].NewRunPos});this.m_aDocumentPositions.push(NewDocPos);this.m_aDocumentPositionsMap.push({StartPos:this.m_aDocumentPositionsSplit[PosIndex].DocPos,EndPos:NewDocPos})}};CDocumentPositionsManager.prototype.Update_DocumentPosition=
function(DocPos){var NewDocPos=DocPos;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsMap.length;PosIndex<PosCount;++PosIndex)if(this.m_aDocumentPositionsMap[PosIndex].StartPos===NewDocPos)NewDocPos=this.m_aDocumentPositionsMap[PosIndex].EndPos;if(NewDocPos!==DocPos&&NewDocPos.length===1&&NewDocPos[0].Class instanceof AscCommonWord.ParaRun){var Run=NewDocPos[0].Class;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);
DocPos.push({Class:Run,Position:NewDocPos[0].Position})}}else if(DocPos.length>0&&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<Count;++Pos)if(this.m_aDocumentPositions[Pos]===DocPos){this.m_aDocumentPositions.splice(Pos,1);return}};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].FOREIGN_CURSOR_LABEL_HIDETIME=FOREIGN_CURSOR_LABEL_HIDETIME;window["AscCommon"].CCollaborativeChanges=CCollaborativeChanges;window["AscCommon"].CCollaborativeEditingBase=CCollaborativeEditingBase;window["AscCommon"].CDocumentPositionsManager=CDocumentPositionsManager})(window);"use strict";(function(window,
undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=
1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){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.Resize=function(_width,_height,api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;
else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=
this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=
this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;
this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>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<lCount;i++)this.Controls[i].Resize(_width,_height,api)}return}var _x=
0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=
this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*
_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<
_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>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<lCount;i++)this.Controls[i].Resize(_r-_x,_b-_y,api)};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 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){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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&
16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===
UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=
function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=
function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+
sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);
this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=
Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=
function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===
this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};
CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=
function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<
Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=
Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=
function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,
UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=
function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=
function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,
Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};
CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};
CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);
if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);
if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=
function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=
function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>
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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();
if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];
var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;
else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=
0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,
{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);
arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};
CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=
this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position&&(_Pos.Position>Pos||_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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];for(var ClassPos=
0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(Class===_Pos.Class&&undefined!==_Pos.Position){if(_Pos.Position>Pos+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<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
for(var ClassPos=0,ClassLen=DocPos.length;ClassPos<ClassLen;++ClassPos){var _Pos=DocPos[ClassPos];if(SplitRun===_Pos.Class&&_Pos.Position&&_Pos.Position>=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;PosIndex<PosCount;++PosIndex){var NewDocPos=[];NewDocPos.push({Class:NewRun,Position:this.m_aDocumentPositionsSplit[PosIndex].NewRunPos});
this.m_aDocumentPositions.push(NewDocPos);this.m_aDocumentPositionsMap.push({StartPos:this.m_aDocumentPositionsSplit[PosIndex].DocPos,EndPos:NewDocPos})}};CDocumentPositionsManager.prototype.Update_DocumentPosition=function(DocPos){var NewDocPos=DocPos;for(var PosIndex=0,PosCount=this.m_aDocumentPositionsMap.length;PosIndex<PosCount;++PosIndex)if(this.m_aDocumentPositionsMap[PosIndex].StartPos===NewDocPos)NewDocPos=this.m_aDocumentPositionsMap[PosIndex].EndPos;if(NewDocPos!==DocPos&&NewDocPos.length===
1&&NewDocPos[0].Class instanceof AscCommonWord.ParaRun){var Run=NewDocPos[0].Class;var Para=Run.GetParagraph();if(AscCommonWord.CanUpdatePosition(Para,Run)){DocPos.length=0;Run.GetDocumentPositionFromObject(DocPos);DocPos.push({Class:Run,Position:NewDocPos[0].Position})}}else if(DocPos.length>0&&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<Count;++Pos)if(this.m_aDocumentPositions[Pos]===DocPos){this.m_aDocumentPositions.splice(Pos,1);return}};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].FOREIGN_CURSOR_LABEL_HIDETIME=FOREIGN_CURSOR_LABEL_HIDETIME;window["AscCommon"].CCollaborativeChanges=
CCollaborativeChanges;window["AscCommon"].CCollaborativeEditingBase=CCollaborativeEditingBase;window["AscCommon"].CDocumentPositionsManager=CDocumentPositionsManager})(window);"use strict";(function(window,undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;
this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){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.Resize=function(_width,_height,
api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=
this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;
else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;
else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>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<lCount;i++)this.Controls[i].Resize(_width,_height,api)}return}var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=
this.Bounds.R*_width/1E3}else if(g_anchor_right==hor_anchor){if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3;if(-1!=this.Bounds.AbsW)_x=_r-this.Bounds.AbsW;else if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3}else if((g_anchor_left|g_anchor_right)==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else{_x=this.Bounds.L;_r=this.Bounds.R}if(g_anchor_top==
ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(-1!=this.Bounds.AbsH)_b=_y+this.Bounds.AbsH;else if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else if(g_anchor_bottom==ver_anchor){if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3;if(-1!=this.Bounds.AbsH)_y=_b-this.Bounds.AbsH;else if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3}else if((g_anchor_top|g_anchor_bottom)==
ver_anchor){if(this.Bounds.isAbsT)_y=this.Bounds.T;else _y=this.Bounds.T*_height/1E3;if(this.Bounds.isAbsB)_b=_height-this.Bounds.B;else _b=this.Bounds.B*_height/1E3}else{_y=this.Bounds.T;_b=this.Bounds.B}if(_r<_x)_r=_x;if(_b<_y)_b=_y;this.AbsolutePosition.L=_x;this.AbsolutePosition.T=_y;this.AbsolutePosition.R=_r;this.AbsolutePosition.B=_b;this.HtmlElement.style.left=(_x*g_dKoef_mm_to_pix+.5>>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<lCount;i++)this.Controls[i].Resize(_r-_x,_b-_y,api)};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 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,

@ -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){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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&
16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===
UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=
function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=
function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+
sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);
this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=
Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=
function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===
this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};
CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=
function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<
Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=
Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=
function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,
UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=
function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=
function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,
Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};
CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};
CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);
if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);
if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=
function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=
function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>
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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();
if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];
var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;
else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=
0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,
{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);
arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};
CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=
this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
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){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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};
CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=
0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=
aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);
return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=
function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=
0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=
false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=
sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);
Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=
function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};
CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=
function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses=
{};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=
this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};
CCollaborativeEditingBase.prototype.Add_ForeignCursor=function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};
CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,
Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=
function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate=
{}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();
if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);
if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=
function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=
Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=
this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,
nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides=
{};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=
oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||
oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||
oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,
oReverseChange,{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});
aSendingChanges.push(oChange.m_pData);arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateRulersState()};CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=
this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
@ -1529,39 +1529,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.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<b.name)return-1;
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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<this.WordControl.m_oDrawingDocument.SlidesCount)this.WordControl.GoToPage(slideNum)}}return}this.sendEvent("asc_onHyperlinkClick",
Url)};asc_docs_api.prototype.asc_GoToInternalHyperlink=function(url){for(var i=0;i<this.SelectedObjectsStack.length;++i)if(this.SelectedObjectsStack[i].Type===c_oAscTypeSelectElement.Hyperlink){var oHyperProp=this.SelectedObjectsStack[i].Value;if(typeof oHyperProp.Value==="string"&&oHyperProp.Value.indexOf("ppaction://hlink")===0)this.sync_HyperlinkClickCallback(oHyperProp.Value);return}};asc_docs_api.prototype.UpdateInterfaceState=function(){if(this.WordControl.m_oLogicDocument!=null){this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
this.WordControl.CheckLayouts(true)}};asc_docs_api.prototype.OnMouseUp=function(x,y){var _e=AscCommon.CreateMouseUpEventObject(x,y);AscCommon.Window_OnMouseUp(_e)};asc_docs_api.prototype.asyncImageEndLoaded2=null;asc_docs_api.prototype.ChangeTheme=function(indexTheme,bSelectedSlides){if(true===AscCommon.CollaborativeEditing.Get_GlobalLock())return;if(!this.isViewMode&&this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Theme)===false){AscCommon.CollaborativeEditing.Set_GlobalLock(true);
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_ChangeTheme);this.bSelectedSlidesTheme=bSelectedSlides===true;this.ThemeLoader.StartLoadTheme(indexTheme)}};asc_docs_api.prototype.StartLoadTheme=function(){};asc_docs_api.prototype.EndLoadTheme=function(theme_load_info){AscCommon.CollaborativeEditing.Set_GlobalLock(false);var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();this.WordControl.m_oLogicDocument.changeTheme(theme_load_info,_array.length<=
1&&!this.bSelectedSlidesTheme?null:_array);this.WordControl.ThemeGenerateThumbnails(theme_load_info.Master);this.WordControl.CheckLayouts();this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadTheme)};asc_docs_api.prototype.ChangeLayout=function(layout_index){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,layout_index)};asc_docs_api.prototype.ResetSlide=
function(){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,undefined)};asc_docs_api.prototype.put_ShapesAlign=function(type,alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.shapes_alignLeft(alignType);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.shapes_alignRight(alignType);
this.WordControl.CheckLayouts(true)}};asc_docs_api.prototype.OnMouseUp=function(x,y){var _e=AscCommon.CreateMouseUpEventObject(x,y);AscCommon.Window_OnMouseUp(_e)};asc_docs_api.prototype.asyncImageEndLoaded2=null;asc_docs_api.prototype.ChangeTheme=function(indexTheme,bSelectedSlides,isRemote){if(window.parent&&window.parent.APP&&!isRemote&&!bSelectedSlides)window.parent.APP.changeTheme(indexTheme);if(true===AscCommon.CollaborativeEditing.Get_GlobalLock())return;if(!this.isViewMode&&this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Theme)===
false){AscCommon.CollaborativeEditing.Set_GlobalLock(true);this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Presentation_ChangeTheme);this.bSelectedSlidesTheme=bSelectedSlides===true;this.ThemeLoader.StartLoadTheme(indexTheme)}};asc_docs_api.prototype.StartLoadTheme=function(){};asc_docs_api.prototype.EndLoadTheme=function(theme_load_info){AscCommon.CollaborativeEditing.Set_GlobalLock(false);var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();this.WordControl.m_oLogicDocument.changeTheme(theme_load_info,
_array.length<=1&&!this.bSelectedSlidesTheme?null:_array);this.WordControl.ThemeGenerateThumbnails(theme_load_info.Master);this.WordControl.CheckLayouts();this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadTheme)};asc_docs_api.prototype.ChangeLayout=function(layout_index){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,layout_index)};
asc_docs_api.prototype.ResetSlide=function(){var _array=this.WordControl.m_oLogicDocument.GetSelectedSlides();var _master=this.WordControl.MasterLayouts;this.WordControl.m_oLogicDocument.changeLayout(_array,this.WordControl.MasterLayouts,undefined)};asc_docs_api.prototype.put_ShapesAlign=function(type,alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.shapes_alignLeft(alignType);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.shapes_alignRight(alignType);
break}case c_oAscAlignShapeType.ALIGN_TOP:{this.shapes_alignTop(alignType);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.shapes_alignBottom(alignType);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.shapes_alignCenter(alignType);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.shapes_alignMiddle(alignType);break}default:break}};asc_docs_api.prototype.DistributeHorizontally=function(alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;this.WordControl.m_oLogicDocument.distributeHor(alignType)};
asc_docs_api.prototype.DistributeVertically=function(alignType){if(!AscFormat.isRealNumber(alignType))alignType=Asc.c_oAscObjectsAlignType.Slide;this.WordControl.m_oLogicDocument.distributeVer(alignType)};asc_docs_api.prototype.shapes_alignLeft=function(alignType){this.WordControl.m_oLogicDocument.alignLeft(alignType)};asc_docs_api.prototype.shapes_alignRight=function(alignType){this.WordControl.m_oLogicDocument.alignRight(alignType)};asc_docs_api.prototype.shapes_alignTop=function(alignType){this.WordControl.m_oLogicDocument.alignTop(alignType)};
asc_docs_api.prototype.shapes_alignBottom=function(alignType){this.WordControl.m_oLogicDocument.alignBottom(alignType)};asc_docs_api.prototype.shapes_alignCenter=function(alignType){this.WordControl.m_oLogicDocument.alignCenter(alignType)};asc_docs_api.prototype.shapes_alignMiddle=function(alignType){this.WordControl.m_oLogicDocument.alignMiddle(alignType)};asc_docs_api.prototype.shapes_bringToFront=function(){this.WordControl.m_oLogicDocument.bringToFront()};asc_docs_api.prototype.shapes_bringForward=
@ -2005,22 +2005,24 @@ function(slideNum){this.sendEvent("asc_onDemonstrationSlideChanged",slideNum)};a
true);else this.WordControl.DemonstrationManager.Start(div_id,slidestart_num,true);if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}};asc_docs_api.prototype.EndDemonstration=function(isNoUseFullScreen){if(this.windowReporter)this.windowReporter.close();this.WordControl.DemonstrationManager.End(isNoUseFullScreen)};asc_docs_api.prototype.DemonstrationReporterStart=function(startObject){this.reporterStartObject=
startObject;this.reporterStartObject["translate"]=AscCommon.translateManager.mapTranslate;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["startReporter"](window.location.href);this.reporterWindow={};return}var dualScreenLeft=window.screenLeft!=undefined?window.screenLeft:screen.left;var dualScreenTop=window.screenTop!=undefined?window.screenTop:screen.top;var width=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;
var height=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;var w=800;var h=600;var left=width/2-w/2+dualScreenLeft;var top=height/2-h/2+dualScreenTop;var _windowPos="width="+w+",height="+h+",left="+left+",top="+top;var _url="index.reporter.html";if(this.locale)_url+="?lang="+this.locale;this.reporterWindow=window.open(_url,"_blank","resizable=yes,status=0,toolbar=0,location=0,menubar=0,directories=0,scrollbars=0,"+_windowPos);
if(!this.reporterWindow)return;this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,
false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;
this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=
null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();
break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);
break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=
data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=
this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);
return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}if(undefined==_obj["main_command"])return;if(undefined!==_obj["keyCode"])_this.WordControl.DemonstrationManager.onKeyDownCode(_obj["keyCode"]);else if(undefined!==_obj["mouseUp"])_this.WordControl.DemonstrationManager.onMouseUp({},true,true);else if(undefined!==
_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=
_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();
var _elem=document.getElementById("dem_id_play_span");if(_elem&&_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=
this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=
message};asc_docs_api.prototype.DemonstrationNextSlide=function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);
if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);
var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
if(!this.reporterWindow)return;var w=this.reporterWindow;require(["/common/outer/worker-channel.js","/common/common-util.js"],function(Channel,Util){var msgEv=Util.mkEvent();window.addEventListener("message",function(msg){if(msg.source!==w)return;msgEv.fire(msg)});var postMsg=function(data){w.postMessage(data,"*")};Channel.create(msgEv,postMsg,function(chan){var send=function(obj){chan.event("CMD",obj)};chan.on("CMD",function(obj){if(obj.type!=="auth")return;send({type:"authChanges",changes:[]});
send({type:"auth",result:1,sessionId:"06348ca8f861a0af3548ae38360aa617",participants:[],locks:[],changes:[],changesIndex:0,indexUser:0,buildVersion:"5.2.6",buildNumber:2,licenseType:3});send({type:"documentOpen",data:{"type":"open","status":"ok","data":{"Editor.bin":editor.reporterStartObject.url}}})})})});this.reporterWindowCounter=0;if(!AscCommon.AscBrowser.isSafariMacOs)this.reporterWindow.onbeforeunload=function(){window.editor.EndDemonstration()};this.reporterWindow.onunload=function(){window.editor.reporterWindowCounter++;
if(1<window.editor.reporterWindowCounter)window.editor.EndDemonstration()};if(this.reporterWindow.attachEvent)this.reporterWindow.attachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.addEventListener("message",this.DemonstrationReporterMessages,false)};asc_docs_api.prototype.DemonstrationReporterEnd=function(){if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["endReporter"]();this.reporterWindow=null;return}try{this.reporterWindowCounter=0;if(!this.reporterWindow)return;
if(this.reporterWindow.attachEvent)this.reporterWindow.detachEvent("onmessage",this.DemonstrationReporterMessages);else this.reporterWindow.removeEventListener("message",this.DemonstrationReporterMessages,false);this.reporterWindow.close();this.reporterWindow=null;this.reporterStartObject=null}catch(err){this.reporterWindow=null;this.reporterStartObject=null}};asc_docs_api.prototype.DemonstrationReporterMessages=function(e){var _this=window.editor;if(e.data=="i:am:ready"){var bin=editor.asc_nativeGetFile();
var blob=new Blob([bin],{type:"plain/text"});var url=URL.createObjectURL(blob);_this.reporterStartObject.url=url;var _msg_={type:"file:open",data:_this.reporterStartObject};if(AscCommon.EncryptionWorker.isPasswordCryptoPresent){_msg_.data["cryptoCurrentPassword"]=this.currentPassword;_msg_.data["cryptoCurrentDocumentHash"]=this.currentDocumentHash;_msg_.data["cryptoCurrentDocumentInfo"]=this.currentDocumentInfo}this.reporterStartObject=null;_this.sendToReporter(JSON.stringify(_msg_));return}try{var _obj=
JSON.parse(e.data);if(undefined==_obj["reporter_command"])return;switch(_obj["reporter_command"]){case "end":{_this.EndDemonstration();break}case "next":{_this.WordControl.DemonstrationManager.NextSlide();break}case "prev":{_this.WordControl.DemonstrationManager.PrevSlide();break}case "go_to_slide":{_this.WordControl.DemonstrationManager.GoToSlide(_obj["slide"]);break}case "start_show":{_this.WordControl.DemonstrationManager.EndWaitReporter();break}case "pointer_move":{_this.WordControl.DemonstrationManager.PointerMove(_obj["x"],
_obj["y"],_obj["w"],_obj["h"]);break}case "pointer_remove":{_this.WordControl.DemonstrationManager.PointerRemove();break}case "pause":{_this.WordControl.DemonstrationManager.Pause();_this.sendEvent("asc_onDemonstrationStatus","pause");break}case "play":{_this.WordControl.DemonstrationManager.Play();_this.sendEvent("asc_onDemonstrationStatus","play");break}case "resize":{_this.WordControl.DemonstrationManager.Resize(true);break}default:break}}catch(err){}};asc_docs_api.prototype.preloadReporter=function(data){if(data["translate"])this.translateManager=
AscCommon.translateManager.init(data["translate"]);this.reporterTranslates=[data["translations"]["reset"],data["translations"]["slideOf"],data["translations"]["endSlideshow"],data["translations"]["finalMessage"]];if(data["cryptoCurrentPassword"]){this.currentPassword=data["cryptoCurrentPassword"];this.currentDocumentHash=data["cryptoCurrentDocumentHash"];this.currentDocumentInfo=data["cryptoCurrentDocumentInfo"];if(this.pluginsManager)this.pluginsManager.checkCryptoReporter();else this.isCheckCryptoReporter=
true}this.asc_registerCallback("asc_onHyperlinkClick",function(url){if(url)window.open(url)});if(!this.WordControl)return;this.WordControl.reporterTranslates=this.reporterTranslates;this.WordControl.DemonstrationManager.EndShowMessage=this.reporterTranslates[3];var _button1=document.getElementById("dem_id_reset");var _button2=document.getElementById("dem_id_end");if(_button1)_button1.innerHTML=this.reporterTranslates[0];if(_button2){_button2.innerHTML=this.reporterTranslates[2];this.WordControl.OnResizeReporter()}};
asc_docs_api.prototype.sendToReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendToReporter"](value);return}if(this.reporterWindow)this.reporterWindow.postMessage(value,"*")};asc_docs_api.prototype.sendFromReporter=function(value){if(this.disableReporterEvents)return;if(window["AscDesktopEditor"]){window["AscDesktopEditor"]["sendFromReporter"](value);return}window.postMessage(value,"*")};asc_docs_api.prototype.DemonstrationToReporterMessages=
function(e){var _this=window.editor;try{var _obj=JSON.parse(e.data);if(window["AscDesktopEditor"]&&_obj["type"]=="file:open"){window.postMessage(e.data,"*");return}if(undefined==_obj["main_command"])return;if(undefined!==_obj["keyCode"])_this.WordControl.DemonstrationManager.onKeyDownCode(_obj["keyCode"]);else if(undefined!==_obj["mouseUp"])_this.WordControl.DemonstrationManager.onMouseUp({},true,true);else if(undefined!==_obj["mouseWhell"])_this.WordControl.DemonstrationManager.onMouseWheelDelta(_obj["mouseWhell"]);
else if(undefined!==_obj["resize"])_this.WordControl.DemonstrationManager.Resize(true);else if(true===_obj["next"])_this.WordControl.DemonstrationManager.NextSlide(true);else if(true===_obj["prev"])_this.WordControl.DemonstrationManager.PrevSlide(true);else if(undefined!==_obj["go_to_slide"])_this.WordControl.DemonstrationManager.GoToSlide(_obj["go_to_slide"],true);else if(true===_obj["play"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Play(true);
var _elem=document.getElementById("dem_id_play_span");if(_elem&&!_isNowPlaying){_elem.classList.remove("btn-play");_elem.classList.add("btn-pause");_this.WordControl.reporterTimerLastStart=(new Date).getTime();_this.WordControl.reporterTimer=setInterval(_this.WordControl.reporterTimerFunc,1E3)}}else if(true===_obj["pause"]){var _isNowPlaying=_this.WordControl.DemonstrationManager.IsPlayMode;_this.WordControl.DemonstrationManager.Pause();var _elem=document.getElementById("dem_id_play_span");if(_elem&&
_isNowPlaying){_elem.classList.remove("btn-pause");_elem.classList.add("btn-play");if(-1!=_this.WordControl.reporterTimer){clearInterval(_this.WordControl.reporterTimer);_this.WordControl.reporterTimer=-1}_this.WordControl.reporterTimerAdd=_this.WordControl.reporterTimerFunc(true)}}}catch(err){}};asc_docs_api.prototype.DemonstrationPlay=function(){if(undefined!==this.EndShowMessage){this.WordControl.DemonstrationManager.EndShowMessage=this.EndShowMessage;this.EndShowMessage=undefined}this.WordControl.DemonstrationManager.Play(true);
if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "play" : true }')};asc_docs_api.prototype.DemonstrationPause=function(){this.WordControl.DemonstrationManager.Pause();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "pause" : true }')};asc_docs_api.prototype.DemonstrationEndShowMessage=function(message){if(!this.WordControl)this.EndShowMessage=message;else this.WordControl.DemonstrationManager.EndShowMessage=message};asc_docs_api.prototype.DemonstrationNextSlide=
function(){this.WordControl.DemonstrationManager.NextSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "next" : true }')};asc_docs_api.prototype.DemonstrationPrevSlide=function(){this.WordControl.DemonstrationManager.PrevSlide();if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "prev" : true }')};asc_docs_api.prototype.DemonstrationGoToSlide=function(slideNum){this.WordControl.DemonstrationManager.GoToSlide(slideNum);if(this.isReporterMode)this.sendFromReporter('{ "reporter_command" : "go_to_slide", "slide" : '+
slideNum+" }");if(this.reporterWindow)this.sendToReporter('{ "main_command" : true, "go_to_slide" : '+slideNum+" }")};asc_docs_api.prototype.SetDemonstrationModeOnly=function(){this.isOnlyDemonstration=true};asc_docs_api.prototype.ApplySlideTiming=function(oTiming){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming)===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTiming);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;
var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;if(_cur<0||_cur>=_count)return;var aSelectedSlides=this.WordControl.m_oLogicDocument.GetSelectedSlides();for(var i=0;i<aSelectedSlides.length;++i){var _curSlide=this.WordControl.m_oLogicDocument.Slides[aSelectedSlides[i]];_curSlide.applyTiming(oTiming)}if(oTiming)if(AscFormat.isRealBool(oTiming.get_ShowLoop())&&oTiming.get_ShowLoop()!==this.WordControl.m_oLogicDocument.isLoopShowMode())this.WordControl.m_oLogicDocument.setShowLoop(oTiming.get_ShowLoop())}this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState()};
asc_docs_api.prototype.SlideTimingApplyToAll=function(){if(this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_SlideTiming,{All:true})===false){History.Create_NewPoint(AscDFH.historydescription_Presentation_ApplyTimingToAll);var _count=this.WordControl.m_oDrawingDocument.SlidesCount;var _cur=this.WordControl.m_oDrawingDocument.SlideCurrent;var _slides=this.WordControl.m_oLogicDocument.Slides;if(_cur<0||_cur>=_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();

@ -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){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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&
16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===
UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=
function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=
function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+
sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);
this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=
Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=
function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===
this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};
CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=
function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<
Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=
Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=
function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses={};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();
editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,
UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};CCollaborativeEditingBase.prototype.Add_ForeignCursor=
function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=
function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,
Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};
CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate={}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};
CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);
if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);
if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=
function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=
function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>
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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();
if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides={};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];
var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=
oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;
else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=
0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,
{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});aSendingChanges.push(oChange.m_pData);
arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateRulersState()};
CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=
this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
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){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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>16;dwCurr<<=8}}else{var p=AscFonts.b64_decode;while(index<srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(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<nBits/8;i++){dstPx[nWritten++]=(dwCurr&16711680)>>>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;Index<Len;Index++)if(this.m_aUsers[Index]===UserId)return Index;return-1};CCollaborativeEditingBase.prototype.Remove_User=function(UserId){var Pos=this.Find_User(UserId);if(-1!=Pos)this.m_aUsers.splice(Pos,1)};CCollaborativeEditingBase.prototype.Add_Changes=function(Changes){this.m_aChanges.push(Changes)};CCollaborativeEditingBase.prototype.Add_Unlock=function(LockClass){this.m_aNeedUnlock.push(LockClass)};
CCollaborativeEditingBase.prototype.Add_Unlock2=function(Lock){this.m_aNeedUnlock2.push(Lock);editor._onUpdateDocumentCanSave()};CCollaborativeEditingBase.prototype.Have_OtherChanges=function(){return 0<this.m_aChanges.length};CCollaborativeEditingBase.prototype.Apply_Changes=function(){var OtherChanges=this.m_aChanges.length>0;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;i<aImages.length;++i)rData["data"].push(aImages[i]);var aImagesToLoad=[].concat(AscCommon.CollaborativeEditing.m_aNewImages);this.CheckWaitingImages(aImagesToLoad);AscCommon.CollaborativeEditing.m_aNewImages.length=
0;if(false===oApi.isSaveFonts_Images)oApi.isSaveFonts_Images=true;AscCommon.CollaborativeEditing.SendImagesCallback(aImagesToLoad)};CCollaborativeEditingBase.prototype.SendImagesCallback=function(aImages){var oApi=editor||Asc["editor"];oApi.pre_Save(aImages)};CCollaborativeEditingBase.prototype.CollectImagesFromChanges=function(){var oApi=editor||Asc["editor"];var aImages=[],sImagePath,i,sImageFromChanges,oThemeUrls={};var aNewImages=this.m_aNewImages;var oMap={};for(i=0;i<aNewImages.length;++i){sImageFromChanges=
aNewImages[i];if(oMap[sImageFromChanges])continue;oMap[sImageFromChanges]=1;if(sImageFromChanges.indexOf("theme")===0&&oApi.ThemeLoader)oThemeUrls[sImageFromChanges]=oApi.ThemeLoader.ThemesUrlAbs+sImageFromChanges;else if(0===sImageFromChanges.indexOf("http:")||0===sImageFromChanges.indexOf("data:")||0===sImageFromChanges.indexOf("https:")||0===sImageFromChanges.indexOf("file:")||0===sImageFromChanges.indexOf("ftp:"));else{sImagePath=AscCommon.g_oDocumentUrls.mediaPrefix+sImageFromChanges;if(!AscCommon.g_oDocumentUrls.getUrl(sImagePath))aImages.push(sImagePath)}}AscCommon.g_oDocumentUrls.addUrls(oThemeUrls);
return aImages};CCollaborativeEditingBase.prototype.OnStart_Load_Objects=function(){this.Set_GlobalLock(true);this.Set_GlobalLockSelection(true);var aImages=this.CollectImagesFromChanges();if(aImages.length>0)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<Count;Index++){var Item=this.m_aLinkData[Index];Item.Class.Load_LinkData(Item.LinkData)}this.Clear_LinkData()};CCollaborativeEditingBase.prototype.Check_MergeData=function(){};CCollaborativeEditingBase.prototype.Get_GlobalLock=function(){return 0===this.m_bGlobalLock?false:true};CCollaborativeEditingBase.prototype.Set_GlobalLock=
function(isLock){if(isLock)this.m_bGlobalLock++;else this.m_bGlobalLock=Math.max(0,this.m_bGlobalLock-1)};CCollaborativeEditingBase.prototype.Set_GlobalLockSelection=function(isLock){if(isLock)this.m_bGlobalLockSelection++;else this.m_bGlobalLockSelection=Math.max(0,this.m_bGlobalLockSelection-1)};CCollaborativeEditingBase.prototype.Get_GlobalLockSelection=function(){return 0===this.m_bGlobalLockSelection?false:true};CCollaborativeEditingBase.prototype.OnStart_CheckLock=function(){this.m_aCheckLocks.length=
0;this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.Add_CheckLock=function(oItem){this.m_aCheckLocks.push(oItem);this.m_aCheckLocksInstance.push(oItem)};CCollaborativeEditingBase.prototype.OnEnd_CheckLock=function(){};CCollaborativeEditingBase.prototype.OnCallback_AskLock=function(result){};CCollaborativeEditingBase.prototype.OnStartCheckLockInstance=function(){this.m_aCheckLocksInstance.length=0};CCollaborativeEditingBase.prototype.OnEndCheckLockInstance=function(){var isLocked=
false;for(var nIndex=0,nCount=this.m_aCheckLocksInstance.length;nIndex<nCount;++nIndex)if(true===this.m_aCheckLocksInstance[nIndex]){isLocked=true;break}if(isLocked){var nCount=this.m_aCheckLocksInstance.length;this.m_aCheckLocks.splice(this.m_aCheckLocks.length-nCount,nCount)}this.m_aCheckLocksInstance.length=0;return isLocked};CCollaborativeEditingBase.prototype.Reset_NeedLock=function(){this.m_aNeedLock={}};CCollaborativeEditingBase.prototype.Add_NeedLock=function(Id,sUser){this.m_aNeedLock[Id]=
sUser};CCollaborativeEditingBase.prototype.Remove_NeedLock=function(Id){delete this.m_aNeedLock[Id]};CCollaborativeEditingBase.prototype.Lock_NeedLock=function(){for(var Id in this.m_aNeedLock){var Class=AscCommon.g_oTableId.Get_ById(Id);if(null!=Class){var Lock=Class.Lock;Lock.Set_Type(AscCommon.locktype_Other,false);if(Class.getObjectType&&Class.getObjectType()===AscDFH.historyitem_type_Slide)editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide&&editor.WordControl.m_oLogicDocument.DrawingDocument.UnLockSlide(Class.num);
Lock.Set_UserId(this.m_aNeedLock[Id])}}this.Reset_NeedLock()};CCollaborativeEditingBase.prototype.Clear_NewObjects=function(){this.m_aNewObjects.length=0};CCollaborativeEditingBase.prototype.Add_NewObject=function(Class){this.m_aNewObjects.push(Class);Class.FromBinary=true};CCollaborativeEditingBase.prototype.Clear_EndActions=function(){this.m_aEndActions.length=0};CCollaborativeEditingBase.prototype.Add_EndActions=function(Class,Data){this.m_aEndActions.push({Class:Class,Data:Data})};CCollaborativeEditingBase.prototype.OnEnd_ReadForeignChanges=
function(){var Count=this.m_aNewObjects.length;for(var Index=0;Index<Count;Index++){var Class=this.m_aNewObjects[Index];Class.FromBinary=false}Count=this.m_aEndActions.length;for(var Index=0;Index<Count;Index++){var Item=this.m_aEndActions[Index];Item.Class.Process_EndLoad(Item.Data)}this.Clear_EndActions();this.Clear_NewObjects()};CCollaborativeEditingBase.prototype.Clear_NewImages=function(){this.m_aNewImages.length=0};CCollaborativeEditingBase.prototype.Add_NewImage=function(Url){this.m_aNewImages.push(Url)};
CCollaborativeEditingBase.prototype.Add_NewDC=function(Class){var Id=Class.Get_Id();this.m_aDC[Id]=Class};CCollaborativeEditingBase.prototype.Clear_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Clear_ContentChanges();this.m_aDC={}};CCollaborativeEditingBase.prototype.Refresh_DCChanges=function(){for(var Id in this.m_aDC)this.m_aDC[Id].Refresh_ContentChanges();this.Clear_DCChanges()};CCollaborativeEditingBase.prototype.AddPosExtChanges=function(Item,ChangeObject){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=
function(){};CCollaborativeEditingBase.prototype.RewritePosExtChanges=function(changesArr,scale,Binary_Writer){};CCollaborativeEditingBase.prototype.RefreshPosExtChanges=function(){};CCollaborativeEditingBase.prototype.Add_ChangedClass=function(Class){var Id=Class.Get_Id();this.m_aChangedClasses[Id]=Class};CCollaborativeEditingBase.prototype.Clear_CollaborativeMarks=function(bRepaint){for(var Id in this.m_aChangedClasses)this.m_aChangedClasses[Id].Clear_CollaborativeMarks();this.m_aChangedClasses=
{};if(true===bRepaint){editor.WordControl.m_oLogicDocument.DrawingDocument.ClearCachePages();editor.WordControl.m_oLogicDocument.DrawingDocument.FirePaint()}};CCollaborativeEditingBase.prototype.Add_ForeignCursorToUpdate=function(UserId,CursorInfo,UserShortId){this.m_aCursorsToUpdate[UserId]=CursorInfo;this.m_aCursorsToUpdateShortId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Refresh_ForeignCursors=function(){if(!this.m_oLogicDocument)return;for(var UserId in this.m_aCursorsToUpdate){var CursorInfo=
this.m_aCursorsToUpdate[UserId];this.m_oLogicDocument.Update_ForeignCursor(CursorInfo,UserId,false,this.m_aCursorsToUpdateShortId[UserId]);if(this.Add_ForeignCursorToShow)this.Add_ForeignCursorToShow(UserId)}this.m_aCursorsToUpdate={};this.m_aCursorsToUpdateShortId={}};CCollaborativeEditingBase.prototype.Clear_DocumentPositions=function(){this.m_aDocumentPositions.Clear_DocumentPositions()};CCollaborativeEditingBase.prototype.Add_DocumentPosition=function(DocumentPos){this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos)};
CCollaborativeEditingBase.prototype.Add_ForeignCursor=function(UserId,DocumentPos,UserShortId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);this.m_aForeignCursors[UserId]=DocumentPos;this.m_aForeignCursorsPos.Add_DocumentPosition(DocumentPos);this.m_aForeignCursorsId[UserId]=UserShortId};CCollaborativeEditingBase.prototype.Remove_ForeignCursor=function(UserId){this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);delete this.m_aForeignCursors[UserId]};
CCollaborativeEditingBase.prototype.Remove_AllForeignCursors=function(){};CCollaborativeEditingBase.prototype.RemoveMyCursorFromOthers=function(){};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnAdd=function(Class,Pos){this.m_aDocumentPositions.Update_DocumentPositionsOnAdd(Class,Pos);this.m_aForeignCursorsPos.Update_DocumentPositionsOnAdd(Class,Pos)};CCollaborativeEditingBase.prototype.Update_DocumentPositionsOnRemove=function(Class,Pos,Count){this.m_aDocumentPositions.Update_DocumentPositionsOnRemove(Class,
Pos,Count);this.m_aForeignCursorsPos.Update_DocumentPositionsOnRemove(Class,Pos,Count)};CCollaborativeEditingBase.prototype.OnStart_SplitRun=function(SplitRun,SplitPos){this.m_aDocumentPositions.OnStart_SplitRun(SplitRun,SplitPos);this.m_aForeignCursorsPos.OnStart_SplitRun(SplitRun,SplitPos)};CCollaborativeEditingBase.prototype.OnEnd_SplitRun=function(NewRun){this.m_aDocumentPositions.OnEnd_SplitRun(NewRun);this.m_aForeignCursorsPos.OnEnd_SplitRun(NewRun)};CCollaborativeEditingBase.prototype.Update_DocumentPosition=
function(DocPos){this.m_aDocumentPositions.Update_DocumentPosition(DocPos)};CCollaborativeEditingBase.prototype.Update_ForeignCursorsPositions=function(){};CCollaborativeEditingBase.prototype.InitMemory=function(){if(!this.m_oMemory)this.m_oMemory=new AscCommon.CMemory};CCollaborativeEditingBase.prototype.private_SaveDocumentState=function(){var LogicDocument=editor.WordControl.m_oLogicDocument;var DocState;if(true!==this.Is_Fast()){DocState=LogicDocument.Get_SelectionState2();this.m_aCursorsToUpdate=
{}}else DocState=LogicDocument.Save_DocumentStateBeforeLoadChanges();return DocState};CCollaborativeEditingBase.prototype.private_RestoreDocumentState=function(DocState){var LogicDocument=editor.WordControl.m_oLogicDocument;if(true!==this.Is_Fast())LogicDocument.Set_SelectionState2(DocState);else{LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);this.Refresh_ForeignCursors()}};CCollaborativeEditingBase.prototype.WatchDocumentPositionsByState=function(DocState){this.Clear_DocumentPositions();
if(DocState.Pos)this.Add_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Add_DocumentPosition(DocState.StartPos);if(DocState.EndPos)this.Add_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Add_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Add_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Add_DocumentPosition(DocState.FootnotesStart.EndPos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Add_DocumentPosition(DocState.FootnotesEnd.Pos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Add_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Add_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.UpdateDocumentPositionsByState=function(DocState){if(DocState.Pos)this.Update_DocumentPosition(DocState.Pos);if(DocState.StartPos)this.Update_DocumentPosition(DocState.StartPos);
if(DocState.EndPos)this.Update_DocumentPosition(DocState.EndPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.Pos)this.Update_DocumentPosition(DocState.FootnotesStart.Pos);if(DocState.FootnotesStart&&DocState.FootnotesStart.StartPos)this.Update_DocumentPosition(DocState.FootnotesStart.StartPos);if(DocState.FootnotesStart&&DocState.FootnotesStart.EndPos)this.Update_DocumentPosition(DocState.FootnotesStart.EndPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.Pos)this.Update_DocumentPosition(DocState.FootnotesEnd.Pos);
if(DocState.FootnotesEnd&&DocState.FootnotesEnd.StartPos)this.Update_DocumentPosition(DocState.FootnotesEnd.StartPos);if(DocState.FootnotesEnd&&DocState.FootnotesEnd.EndPos)this.Update_DocumentPosition(DocState.FootnotesEnd.EndPos)};CCollaborativeEditingBase.prototype.private_ClearChanges=function(){this.m_aChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange){return true};CCollaborativeEditingBase.prototype.private_ClearChanges=
function(){this.m_aChanges=[];this.m_oOwnChanges=[]};CCollaborativeEditingBase.prototype.private_CollectOwnChanges=function(){var StartPoint=null===AscCommon.History.SavedIndex?0:AscCommon.History.SavedIndex+1;var LastPoint=-1;if(this.m_nUseType<=0)LastPoint=AscCommon.History.Points.length-1;else LastPoint=AscCommon.History.Index;for(var PointIndex=StartPoint;PointIndex<=LastPoint;PointIndex++){var Point=AscCommon.History.Points[PointIndex];for(var Index=0;Index<Point.Items.length;Index++){var Item=
Point.Items[Index];this.m_oOwnChanges.push(Item.Data)}}};CCollaborativeEditingBase.prototype.private_AddOverallChange=function(oChange,isSave){for(var nIndex=0,nCount=this.m_oOwnChanges.length;nIndex<nCount;++nIndex)if(oChange&&oChange.Merge&&false===oChange.Merge(this.m_oOwnChanges[nIndex]))return false;if(false!==isSave)this.m_aAllChanges.push(oChange);return true};CCollaborativeEditingBase.prototype.private_OnSendOwnChanges=function(arrChanges,nDeleteIndex){if(null!==nDeleteIndex)this.m_aAllChanges.length=
this.m_nAllChangesSavedIndex+nDeleteIndex;else this.m_nAllChangesSavedIndex=this.m_aAllChanges.length;if(arrChanges.length>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<nCount;++nIndex){var oReverseChange=arrChanges[nIndex].CreateReverseChange();if(oReverseChange){arrReverseChanges.push(oReverseChange);oReverseChange.SetReverted(true)}}var oLogicDocument=this.m_oLogicDocument;oLogicDocument.DrawingDocument.EndTrackTable(null,true);oLogicDocument.TurnOffCheckChartSelection();var DocState=this.private_SaveDocumentState();var mapDrawings={};for(var nIndex=0,
nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oClass=arrReverseChanges[nIndex].GetClass();if(oClass&&oClass.parent&&oClass.parent instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.parent.Get_Id()]=oClass.parent;arrReverseChanges[nIndex].Load();this.m_aAllChanges.push(arrReverseChanges[nIndex])}var mapDocumentContents={};var mapParagraphs={};var mapRuns={};var mapTables={};var mapGrObjects={};var mapSlides={};var mapLayouts={};var bChangedLayout=false;var bAddSlides=false;var mapAddedSlides=
{};for(var nIndex=0,nCount=arrReverseChanges.length;nIndex<nCount;++nIndex){var oChange=arrReverseChanges[nIndex];var oClass=oChange.GetClass();if(oClass instanceof AscCommonWord.CDocument||oClass instanceof AscCommonWord.CDocumentContent)mapDocumentContents[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.Paragraph)mapParagraphs[oClass.Get_Id()]=oClass;else if(oClass.IsParagraphContentElement&&true===oClass.IsParagraphContentElement()&&true===oChange.IsContentChange()&&oClass.GetParagraph()){mapParagraphs[oClass.GetParagraph().Get_Id()]=
oClass.GetParagraph();if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass}else if(oClass instanceof AscCommonWord.ParaDrawing)mapDrawings[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.ParaRun)mapRuns[oClass.Get_Id()]=oClass;else if(oClass instanceof AscCommonWord.CTable)mapTables[oClass.Get_Id()]=oClass;else if(oClass instanceof AscFormat.CShape||oClass instanceof AscFormat.CImageShape||oClass instanceof AscFormat.CChartSpace||oClass instanceof AscFormat.CGroupShape||
oClass instanceof AscFormat.CGraphicFrame)mapGrObjects[oClass.Get_Id()]=oClass;else if(typeof AscCommonSlide!=="undefined")if(AscCommonSlide.Slide&&oClass instanceof AscCommonSlide.Slide)mapSlides[oClass.Get_Id()]=oClass;else if(AscCommonSlide.SlideLayout&&oClass instanceof AscCommonSlide.SlideLayout){mapLayouts[oClass.Get_Id()]=oClass;bChangedLayout=true}else if(AscCommonSlide.CPresentation&&oClass instanceof AscCommonSlide.CPresentation)if(oChange.Type===AscDFH.historyitem_Presentation_RemoveSlide||
oChange.Type===AscDFH.historyitem_Presentation_AddSlide){bAddSlides=true;for(var i=0;i<oChange.Items.length;++i)mapAddedSlides[oChange.Items[i].Get_Id()]=oChange.Items[i]}}var oHistory=AscCommon.History;oHistory.CreateNewPointForCollectChanges();if(bAddSlides)for(var i=oLogicDocument.Slides.length-1;i>-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<nCount;++nIndex){var oReverseChange=arrReverseChanges[nIndex];var oChangeClass=oReverseChange.GetClass();var nBinaryPos=oBinaryWriter.GetCurPosition();oBinaryWriter.WriteString2(oChangeClass.Get_Id());oBinaryWriter.WriteLong(oReverseChange.Type);oReverseChange.WriteToBinary(oBinaryWriter);var nBinaryLen=oBinaryWriter.GetCurPosition()-nBinaryPos;var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,
oReverseChange,{Pos:nBinaryPos,Len:nBinaryLen});aSendingChanges.push(oChange.m_pData)}var oHistoryPoint=oHistory.Points[oHistory.Points.length-1];for(var nIndex=0,nCount=oHistoryPoint.Items.length;nIndex<nCount;++nIndex){var oReverseChange=oHistoryPoint.Items[nIndex].Data;var oChangeClass=oReverseChange.GetClass();var oChange=new AscCommon.CCollaborativeChanges;oChange.Set_FromUndoRedo(oChangeClass,oReverseChange,{Pos:oHistoryPoint.Items[nIndex].Binary.Pos,Len:oHistoryPoint.Items[nIndex].Binary.Len});
aSendingChanges.push(oChange.m_pData);arrReverseChanges.push(oHistoryPoint.Items[nIndex].Data)}oHistory.Remove_LastPoint();this.Clear_DCChanges();editor.CoAuthoringApi.saveChanges(aSendingChanges,null,null,false,this.getCollaborativeEditing());this.private_RestoreDocumentState(DocState);oLogicDocument.TurnOnCheckChartSelection();this.private_RecalculateDocument(AscCommon.History.Get_RecalcData(null,arrReverseChanges));oLogicDocument.Document_UpdateSelectionState();oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateRulersState()};CCollaborativeEditingBase.prototype.CanUndo=function(){return this.m_aOwnChangesIndexes.length<=0?false:true};CCollaborativeEditingBase.prototype.private_CommutateContentChanges=function(oChange,nStartPosition){var arrActions=oChange.ConvertToSimpleActions();var arrCommutateActions=[];for(var nActionIndex=arrActions.length-1;nActionIndex>=0;--nActionIndex){var oAction=arrActions[nActionIndex];var oResult=oAction;for(var nIndex=nStartPosition,nOverallCount=
this.m_aAllChanges.length;nIndex<nOverallCount;++nIndex){var oTempChange=this.m_aAllChanges[nIndex];if(!oTempChange)continue;if(oChange.IsRelated(oTempChange)&&true!==oTempChange.IsReverted()){var arrOtherActions=oTempChange.ConvertToSimpleActions();for(var nIndex2=0,nOtherActionsCount2=arrOtherActions.length;nIndex2<nOtherActionsCount2;++nIndex2){var oOtherAction=arrOtherActions[nIndex2];if(false===this.private_Commutate(oAction,oOtherAction)){arrOtherActions.splice(nIndex2,1);oResult=null;break}}oTempChange.ConvertFromSimpleActions(arrOtherActions)}if(!oResult)break}if(null!==
oResult)arrCommutateActions.push(oResult)}if(arrCommutateActions.length>0)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;PosIndex<PosCount;++PosIndex){var DocPos=this.m_aDocumentPositions[PosIndex];
@ -1534,39 +1534,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.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<b.name)return-1;
return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",
this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;
pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=
transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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<b.name)return-1;return 0});result=result.concat(aCustomSchemes);if(nIndex===-1)for(i=0;i<result.length;++i)if(result[i]===asc_color_scheme){nIndex=i;break}}return{schemes:result,index:nIndex}};baseEditorsApi.prototype.getColorSchemeByIdx=function(nIdx){var scheme=AscCommon.getColorSchemeByIdx(nIdx);if(!scheme){var oSchemes=this.getColorSchemes(this.getCurrentTheme());
var oAscScheme=oSchemes.schemes[nIdx];scheme=oAscScheme&&oAscScheme.scheme}return scheme};baseEditorsApi.prototype.sendColorThemes=function(theme){this.sendEvent("asc_onSendThemeColorSchemes",this.getColorSchemes(theme).schemes)};baseEditorsApi.prototype.showVideoControl=function(sMediaName,extX,extY,transform){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["MediaStart"])return;switch(this.editorId){case c_oEditorId.Word:{break}case c_oEditorId.Presentation:{var manager=this.WordControl.DemonstrationManager;
if(!manager.Mode){var pos=this.WordControl.m_oDrawingDocument.ConvertCoordsToCursorWR(0,0,this.WordControl.m_oLogicDocument.CurPage,null,true);pos.X+=this.WordControl.X;pos.Y+=this.WordControl.Y;if(!transform)window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100);else window["AscDesktopEditor"]["MediaStart"](sMediaName,pos.X,pos.Y,extX,extY,this.WordControl.m_nZoomValue/100,transform.sx,transform.shy,transform.shx,transform.sy,transform.tx,transform.ty)}else{var transition=
this.WordControl.DemonstrationManager.Transition;if(manager.SlideNum>=0&&manager.SlideNum<manager.SlidesCount&&(!transition||!transition.IsPlaying())){var _w=transition.Rect.w;var _h=transition.Rect.h;var _w_mm=manager.HtmlPage.m_oLogicDocument.Width;var _h_mm=manager.HtmlPage.m_oLogicDocument.Height;var _x=transition.Rect.x;if(this.isReporterMode)_x+=this.WordControl.m_oMainParent.AbsolutePosition.L*AscCommon.g_dKoef_mm_to_pix>>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){};

File diff suppressed because one or more lines are too long

@ -90,6 +90,15 @@ define([
localStorage.setItem(Constants.redirectToDriveKey, Boolean(bool));
};
LocalStore.getPremium = function () {
try {
return JSON.parse(localStorage[Constants.isPremiumKey]);
} catch (err) { return; }
};
LocalStore.setPremium = function (bool) {
localStorage.setItem(Constants.isPremiumKey, Boolean(bool));
};
LocalStore.login = function (hash, name, cb) {
if (!hash) { throw new Error('expected a user hash'); }
if (!name) { throw new Error('expected a user name'); }

@ -0,0 +1,266 @@
define([
'/api/config',
'/bower_components/nthen/index.js',
'/common/common-util.js',
], function (ApiConfig, nThen, Util) {
var X2T = {};
var CURRENT_VERSION = X2T.CURRENT_VERSION = 'v4';
var debug = function (str) {
if (localStorage.CryptPad_dev !== "1") { return; }
console.debug(str);
};
X2T.start = function () {
var x2tReady = Util.mkEvent(true);
var fetchFonts = function (x2t, obj, cb) {
if (!obj.fonts) { return void cb(); }
var path = ApiConfig.httpSafeOrigin + '/common/onlyoffice/'+CURRENT_VERSION+'/fonts/';
var ver = '?' + ApiConfig.requireConf.urlArgs;
var fonts = obj.fonts;
var files = obj.fonts_files;
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 + ver, waitFor(function (err, buffer) {
if (buffer) {
x2t.FS.writeFile('/working/fonts/' + name, buffer);
}
}));
});
});
}).nThen(function () {
cb();
});
};
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');
x2t.FS.mkdir('/working/themes');
x2tInitialized = true;
x2tReady.fire();
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);
});
};
});
};
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; }
// Docs
if (ext === 'docx') { return 65; }
if (ext === 'doc') { return 66; }
if (ext === 'odt') { return 67; }
if (ext === 'txt') { return 69; }
if (ext === 'html') { return 70; }
// Slides
if (ext === 'pptx') { return 129; }
if (ext === 'ppt') { return 130; }
if (ext === 'odp') { return 131; }
return;
};
var getFromId = function (ext) {
var id = getFormatId(ext);
if (!id) { return ''; }
return '<m_nFormatFrom>'+id+'</m_nFormatFrom>';
};
var getToId = function (ext) {
var id = getFormatId(ext);
if (!id) { return ''; }
return '<m_nFormatTo>'+id+'</m_nFormatTo>';
};
var x2tConvertDataInternal = function(x2t, obj) {
var data = obj.data;
var fileName = obj.fileName;
var outputFormat = obj.outputFormat;
var images = obj.images;
debug("Converting Data for " + fileName + " to " + outputFormat);
// PDF
var pdfData = '';
if (outputFormat === "pdf" && typeof(data) === "object" && data.bin && data.buffer) {
// Add conversion rules
pdfData = "<m_bIsNoBase64>false</m_bIsNoBase64>" +
"<m_sFontDir>/working/fonts/</m_sFontDir>";
// 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(images || {}).forEach(function (_mediaFileName) {
if (/\.bin$/.test(_mediaFileName)) { return; }
var mediasSources = obj.mediasSources || {};
var mediasData = obj.mediasData || {};
var mediaData = mediasData[_mediaFileName];
var mediaFileName;
if (mediaData) { // Theme image
var path = _mediaFileName.split('/');
mediaFileName = path.pop();
var theme = path[path.indexOf('themes') + 1];
try {
x2t.FS.mkdir('/working/themes/'+theme);
x2t.FS.mkdir('/working/themes/'+theme+'/media');
} catch (e) {
console.warn(e);
}
x2t.FS.writeFile('/working/themes/'+theme+'/media/' + mediaFileName, new Uint8Array(mediaData.content));
debug("Writing media data " + mediaFileName + " at /working/themes/"+theme+"/media/");
return;
}
// mediaData is undefined, check mediasSources
mediaFileName = _mediaFileName.substring(6);
var mediaSource = mediasSources[mediaFileName];
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 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<TaskQueueDataConvert xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
+ "<m_sFileFrom>/working/" + fileName + "</m_sFileFrom>"
+ "<m_sThemeDir>/working/themes</m_sThemeDir>"
+ "<m_sFileTo>/working/" + fileName + "." + outputFormat + "</m_sFileTo>"
+ pdfData
+ getFromId(inputFormat)
+ getToId(outputFormat)
+ "<m_bIsNoBase64>false</m_bIsNoBase64>"
+ "</TaskQueueDataConvert>";
// 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");
return "";
}
return result;
};
var convert = function (obj, cb) {
console.error(obj);
getX2T(function (x2t) {
// Fonts
fetchFonts(x2t, obj, function () {
var o = obj.outputFormat;
if (o !== 'pdf') {
// Add intermediary conversion to Microsoft Office format if needed
// (bin to pdf is allowed)
[
// Import from Open Document
{source: '.ods', format: 'xlsx'},
{source: '.odt', format: 'docx'},
{source: '.odp', format: 'pptx'},
// Export to non Microsoft Office
{source: '.bin', type: 'sheet', format: 'xlsx'},
{source: '.bin', type: 'doc', format: 'docx'},
{source: '.bin', type: 'presentation', format: 'pptx'},
].forEach(function (_step) {
if (obj.fileName.endsWith(_step.source) && obj.outputFormat !== _step.format &&
(!_step.type || _step.type === obj.type)) {
obj.outputFormat = _step.format;
obj.data = x2tConvertDataInternal(x2t, obj);
obj.fileName += '.'+_step.format;
}
});
obj.outputFormat = o;
}
var data = x2tConvertDataInternal(x2t, obj);
// Convert to bin -- Import
// We need to extract the images
var images;
if (o === 'bin') {
images = [];
var files = x2t.FS.readdir("/working/media/");
files.forEach(function (file) {
if (file !== "." && file !== "..") {
var fileData = x2t.FS.readFile("/working/media/" + file, {
encoding : "binary"
});
images.push({
name: file,
data: fileData
});
}
});
}
cb({
data: data,
images: images
});
});
});
};
return {
convert: convert
};
};
return X2T;
});

@ -548,6 +548,8 @@ define([
var secret = Hash.getSecrets('drive', parsed.hash, folderData.password);
SF.upgrade(secret.channel, secret);
Env.folders[folderId].userObject.setReadOnly(false, secret.keys.secondaryKey);
waitFor.abort();
return void cb(folderId);
}
if (err) {
waitFor.abort();

@ -660,6 +660,11 @@ define([
var updateDecryptProgress = function (progressValue) {
var text = Math.round(progressValue * 100) + '%';
text += progressValue === 1 ? '' : ' (' + Messages.download_step2 + '...)';
if (progressValue === 2) {
Messages.download_step3 = "Converting..."; // XXX
text = Messages.download_step3;
progressValue = 1;
}
$pv.text(text);
$pb.css({
width: (progressValue * 100) + '%'

@ -72,6 +72,7 @@ define([
var SFrameChannel;
var sframeChan;
var SecureIframe;
var OOIframe;
var Messaging;
var Notifier;
var Utils = {
@ -98,6 +99,7 @@ define([
'/common/cryptget.js',
'/common/outer/worker-channel.js',
'/secureiframe/main.js',
'/common/onlyoffice/ooiframe.js',
'/common/common-messaging.js',
'/common/common-notifier.js',
'/common/common-hash.js',
@ -112,7 +114,7 @@ define([
'/common/test.js',
'/common/userObject.js',
], waitFor(function (_CpNfOuter, _Cryptpad, _Crypto, _Cryptget, _SFrameChannel,
_SecureIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify,
_SecureIframe, _OOIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify,
_Constants, _Feedback, _LocalStore, _Cache, _AppConfig, _Test, _UserObject) {
CpNfOuter = _CpNfOuter;
Cryptpad = _Cryptpad;
@ -120,6 +122,7 @@ define([
Cryptget = _Cryptget;
SFrameChannel = _SFrameChannel;
SecureIframe = _SecureIframe;
OOIframe = _OOIframe;
Messaging = _Messaging;
Notifier = _Notifier;
Utils.Hash = _Hash;
@ -297,6 +300,13 @@ define([
}));
};
if (sessionStorage.CP_formExportSheet && parsed.type === 'sheet') {
try {
Cryptpad.fromContent = JSON.parse(sessionStorage.CP_formExportSheet);
} catch (e) { console.error(e); }
delete sessionStorage.CP_formExportSheet;
}
// New pad options
var options = parsed.getOptions();
if (options.newPadOpts) {
@ -571,6 +581,8 @@ define([
var edPublic, curvePublic, notifications, isTemplate;
var settings = {};
var isSafe = ['debug', 'profile', 'drive', 'teams', 'calendar', 'file'].indexOf(currentPad.app) !== -1;
var isOO = ['sheet', 'doc', 'presentation'].indexOf(parsed.type) !== -1;
var ooDownloadData = {};
var isDeleted = isNewFile && currentPad.hash.length > 0;
if (isDeleted) {
@ -631,11 +643,13 @@ define([
channel: secret.channel,
enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default
devMode: localStorage.CryptPad_dev === "1",
fromFileData: Cryptpad.fromFileData ? {
fromFileData: Cryptpad.fromFileData ? (isOO ? Cryptpad.fromFileData : {
title: Cryptpad.fromFileData.title
} : undefined,
}) : undefined,
fromContent: Cryptpad.fromContent,
burnAfterReading: burnAfterReading,
storeInTeam: Cryptpad.initialTeam || (Cryptpad.initialPath ? -1 : undefined)
storeInTeam: Cryptpad.initialTeam || (Cryptpad.initialPath ? -1 : undefined),
supportsWasm: Utils.Util.supportsWasm()
};
if (window.CryptPad_newSharedFolder) {
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;
@ -650,6 +664,17 @@ define([
additionalPriv.registeredOnly = true;
}
// XXX PREMIUM
var priv = metaObj.priv;
var p = Utils.Util.checkRestrictedApp(parsed.type, AppConfig,
Utils.Constants.earlyAccessApps, priv.plan, additionalPriv.loggedIn);
if (p === 0 || p === -1) {
additionalPriv.premiumOnly = true;
}
if (p === -2) {
additionalPriv.earlyAccessBlocked = true;
}
if (isSafe) {
additionalPriv.hashes = hashes;
additionalPriv.password = password;
@ -661,6 +686,10 @@ define([
cfg.addData(metaObj.priv, Cryptpad, metaObj.user, Utils);
}
if (metaObj && metaObj.priv && typeof(metaObj.priv.plan) === "string") {
Utils.LocalStore.setPremium(metaObj.priv.plan);
}
sframeChan.event('EV_METADATA_UPDATE', metaObj);
});
};
@ -1032,6 +1061,51 @@ define([
}
}, cb);
});
sframeChan.on('Q_GET_HISTORY_RANGE', function (data, cb) {
var nSecret = secret;
if (cfg.isDrive) {
// Shared folder or user hash or fs hash
var hash = Utils.LocalStore.getUserHash() || Utils.LocalStore.getFSHash();
if (data.sharedFolder) { hash = data.sharedFolder.hash; }
if (hash) {
var password = (data.sharedFolder && data.sharedFolder.password) || undefined;
nSecret = Utils.Hash.getSecrets('drive', hash, password);
}
}
if (data.href) {
var _parsed = Utils.Hash.parsePadUrl(data.href);
nSecret = Utils.Hash.getSecrets(_parsed.type, _parsed.hash, data.password);
}
if (data.isDownload && ooDownloadData[data.isDownload]) {
var ooData = ooDownloadData[data.isDownload];
delete ooDownloadData[data.isDownload];
nSecret = Utils.Hash.getSecrets('sheet', ooData.hash, ooData.password);
}
var channel = nSecret.channel;
var validate = nSecret.keys.validateKey;
var crypto = Crypto.createEncryptor(nSecret.keys);
Cryptpad.getHistoryRange({
channel: data.channel || channel,
validateKey: validate,
toHash: data.toHash,
lastKnownHash: data.lastKnownHash
}, function (data) {
cb({
isFull: data.isFull,
messages: data.messages.map(function (obj) {
// The 3rd parameter "true" means we're going to skip signature validation.
// We don't need it since the message is already validated serverside by hk
return {
msg: crypto.decrypt(obj.msg, true, true),
serverHash: obj.serverHash,
author: obj.author,
time: obj.time
};
}),
lastKnownHash: data.lastKnownHash
});
});
});
};
addCommonRpc(sframeChan, isSafe);
@ -1273,46 +1347,6 @@ define([
});
});
});
sframeChan.on('Q_GET_HISTORY_RANGE', function (data, cb) {
var nSecret = secret;
if (cfg.isDrive) {
// Shared folder or user hash or fs hash
var hash = Utils.LocalStore.getUserHash() || Utils.LocalStore.getFSHash();
if (data.sharedFolder) { hash = data.sharedFolder.hash; }
if (hash) {
var password = (data.sharedFolder && data.sharedFolder.password) || undefined;
nSecret = Utils.Hash.getSecrets('drive', hash, password);
}
}
if (data.href) {
var _parsed = Utils.Hash.parsePadUrl(data.href);
nSecret = Utils.Hash.getSecrets(_parsed.type, _parsed.hash, data.password);
}
var channel = nSecret.channel;
var validate = nSecret.keys.validateKey;
var crypto = Crypto.createEncryptor(nSecret.keys);
Cryptpad.getHistoryRange({
channel: data.channel || channel,
validateKey: validate,
toHash: data.toHash,
lastKnownHash: data.lastKnownHash
}, function (data) {
cb({
isFull: data.isFull,
messages: data.messages.map(function (obj) {
// The 3rd parameter "true" means we're going to skip signature validation.
// We don't need it since the message is already validated serverside by hk
return {
msg: crypto.decrypt(obj.msg, true, true),
serverHash: obj.serverHash,
author: obj.author,
time: obj.time
};
}),
lastKnownHash: data.lastKnownHash
});
});
});
// Store
sframeChan.on('Q_DRIVE_GETDELETED', function (data, cb) {
@ -1462,6 +1496,38 @@ define([
initSecureModal('share', data || {});
});
// OO iframe
var OOIframeObject = {};
var initOOIframe = function (cfg, cb) {
if (!OOIframeObject.$iframe) {
var config = {};
config.addCommonRpc = addCommonRpc;
config.modules = {
Cryptpad: Cryptpad,
SFrameChannel: SFrameChannel,
Utils: Utils
};
OOIframeObject.$iframe = $('<iframe>', {id: 'sbox-oo-iframe'}).appendTo($('body')).hide();
OOIframeObject.modal = OOIframe.create(config);
}
OOIframeObject.modal.refresh(cfg, function (data) {
cb(data);
});
};
sframeChan.on('Q_OOIFRAME_OPEN', function (data, cb) {
if (!data) { return void cb(); }
// Extract unsafe data (href and password) before sending it to onlyoffice
var padData = data.padData;
delete data.padData;
var uid = Utils.Util.uid();
ooDownloadData[uid] = padData;
data.downloadId = uid;
initOOIframe(data || {}, cb);
});
sframeChan.on('Q_TEMPLATE_USE', function (data, cb) {
Cryptpad.useTemplate(data, Cryptget, cb);
});
@ -1991,7 +2057,7 @@ define([
return;
}
// if we open a new code from a file
if (Cryptpad.fromFileData) {
if (Cryptpad.fromFileData && !isOO) {
Cryptpad.useFile(Cryptget, function (err) {
if (err) {
// TODO: better messages in case of expired, deleted, etc.?

@ -25,6 +25,7 @@ define([
'/common/common-interface.js',
'/common/common-feedback.js',
'/common/common-language.js',
'/common/common-constants.js',
'/bower_components/localforage/dist/localforage.min.js',
'/common/hyperscript.js',
], function (
@ -53,6 +54,7 @@ define([
UI,
Feedback,
Language,
Constants,
localForage,
h
) {
@ -729,6 +731,12 @@ define([
ApiConfig.adminKeys.indexOf(privateData.edPublic) !== -1;
};
funcs.checkRestrictedApp = function (app) {
var ea = Constants.earlyAccessApps;
var priv = ctx.metadataMgr.getPrivateData();
return Util.checkRestrictedApp(app, AppConfig, ea, priv.plan, priv.loggedIn);
};
funcs.mailbox = {};
Object.freeze(funcs);
@ -907,6 +915,25 @@ define([
}, {forefront: true});
return;
}
// XXX PREMIUM
Messages.premiumOnly = "Creating new documents in this application is currently limited to subscribers on {0}. This is an early-access experimental application for testing purposes, and should not yet be trusted with important data. It will soon become available to everyone on {0}."; // XXX
var blocked = privateData.premiumOnly && privateData.isNewFile;
if (blocked) {
var domain = ApiConfig.httpUnsafeOrigin || 'CryptPad';
if (/^http/.test(domain)) { domain = domain.replace(/^https?\:\/\//, ''); }
UI.errorLoadingScreen(Messages._getKey('premiumOnly', [domain]), null, function () {
funcs.gotoURL('/drive/');
}, {forefront: true});
return;
}
if (privateData.earlyAccessBlocked) {
Messages.earlyAccessBlocked = "This application is not ready yet, come back later."; // XXX
UI.errorLoadingScreen(Messages.earlyAccessBlocked, null, function () {
funcs.gotoURL('/drive/');
}, {forefront: true});
return;
}
} catch (e) {
console.error("Can't check permissions for the app");
}

@ -16,23 +16,16 @@
"teams": "Teams",
"form": "Form"
},
"button_newpad": "New Rich Text pad",
"button_newcode": "New Code pad",
"button_newpoll": "New Poll",
"button_newslide": "New Presentation",
"button_newwhiteboard": "New Whiteboard",
"button_newkanban": "New Kanban",
"button_newsheet": "New Sheet",
"common_connectionLost": "<b>Server Connection Lost</b><br>You're now in read-only mode until the connection is back.",
"typeError": "This pad is not compatible with the selected application",
"onLogout": "You are logged out, {0}click here{1} to log in<br>or press <em>Escape</em> to access your pad in read-only mode.",
"padNotPinned": "This pad will expire after 3 months of inactivity, {0}login{1} or {2}register{3} to preserve it.",
"padNotPinnedVariable": "This pad will expire after {4} days of inactivity, {0}login{1} or {2}register{3} to preserve it.",
"typeError": "This document is not compatible with the selected application",
"onLogout": "You are logged out, {0}click here{1} to log in<br>or press <em>Escape</em> to access your document in read-only mode.",
"padNotPinned": "This document will expire after 3 months of inactivity, {0}login{1} or {2}register{3} to preserve it.",
"padNotPinnedVariable": "This document will expire after {4} days of inactivity, {0}login{1} or {2}register{3} to preserve it.",
"anonymousStoreDisabled": "The administrator of this CryptPad instance has disabled storage for guests. Log in to access your own CryptDrive.",
"expiredError": "This pad has reached its expiration time and is no longer available.",
"expiredError": "This document has reached its expiration time and is no longer available.",
"deletedError": "This document has been deleted and is no longer available.",
"inactiveError": "This pad has been deleted due to inactivity. Press Esc to create a new pad.",
"chainpadError": "A critical error occurred when updating your content. This page is in read-only mode to make sure you won't lose your work.<br>Hit <em>Esc</em> to continue to view this pad, or reload to try editing again.",
"inactiveError": "This document has been deleted due to inactivity. Press Esc to create a new document.",
"chainpadError": "A critical error occurred when updating your content. This page is in read-only mode to make sure you won't lose your work.<br>Hit <em>Esc</em> to continue to view this document, or reload to try editing again.",
"invalidHashError": "The document you've requested has an invalid URL.",
"errorCopy": " You can still use the current version in read-only mode by pressing <em>Esc</em>.",
"errorRedirectToHome": "Press <em>Esc</em> to be redirected to your CryptDrive.",
@ -70,14 +63,14 @@
"formattedGB": "{0} GB",
"formattedKB": "{0} KB",
"pinLimitReached": "You've reached your storage limit",
"pinLimitReachedAlert": "You've reached your storage limit. New pads won't be stored in your CryptDrive.<br>You can either remove pads from your CryptDrive or <a>subscribe to a premium offer</a> to increase your limit.",
"pinLimitReachedAlert": "You've reached your storage limit. New documents won't be stored in your CryptDrive.<br>You can either remove documents from your CryptDrive or <a>subscribe to a premium offer</a> to increase your limit.",
"pinLimitReachedAlertNoAccounts": "You've reached your storage limit",
"pinLimitNotPinned": "You've reached your storage limit.<br>This pad is not stored in your CryptDrive.",
"pinLimitDrive": "You've reached your storage limit.<br>You can't create new pads.",
"pinLimitNotPinned": "You've reached your storage limit.<br>This document is not stored in your CryptDrive.",
"pinLimitDrive": "You've reached your storage limit.<br>You can't create new documents.",
"importButton": "Import",
"importButtonTitle": "Import a pad from a local file",
"importButtonTitle": "Import a document from a local file",
"exportButton": "Export",
"exportButtonTitle": "Export this pad to a local file",
"exportButtonTitle": "Export this document to a local file",
"exportPrompt": "What would you like to name your file?",
"changeNamePrompt": "Change your name (leave empty to be anonymous): ",
"user_rename": "Change display name",
@ -86,15 +79,15 @@
"clickToEdit": "Click to edit",
"saveTitle": "Save the title (enter)",
"forgetButton": "Delete",
"forgetPrompt": "Clicking OK will move this pad to your trash. Are you sure?",
"movedToTrash": "That pad has been moved to the trash.<br><a>Access my Drive</a>",
"forgetPrompt": "Clicking OK will move this document to your trash. Are you sure?",
"movedToTrash": "That document has been moved to the trash.<br><a>Access my Drive</a>",
"shareButton": "Share",
"shareSuccess": "Copied link to clipboard",
"userListButton": "User list",
"chatButton": "Chat",
"userAccountButton": "User menu",
"newButton": "New",
"newButtonTitle": "Create a new pad",
"newButtonTitle": "Create a new document",
"uploadButton": "Upload files",
"uploadFolderButton": "Upload folder",
"uploadButtonTitle": "Upload a new file to your CryptDrive",
@ -112,14 +105,14 @@
"backgroundButtonTitle": "Change the background color in the presentation",
"colorButtonTitle": "Change the text color in presentation mode",
"propertiesButton": "Properties",
"propertiesButtonTitle": "Get pad properties",
"propertiesButtonTitle": "Get document properties",
"printText": "Print",
"printButton": "Print (enter)",
"printButtonTitle2": "Print your document or export it as a PDF file",
"printOptions": "Layout options",
"printSlideNumber": "Display the slide number",
"printDate": "Display the date",
"printTitle": "Display the pad title",
"printTitle": "Display the document title",
"printCSS": "Custom style rules (CSS):",
"printTransition": "Enable transition animations",
"printBackground": "Use a background image",
@ -132,10 +125,10 @@
"filePicker_description": "Choose a file from your CryptDrive to embed it or upload a new one",
"filePicker_filter": "Filter files by name",
"tags_title": "Tags (for you only)",
"tags_add": "Update the tags for selected pads",
"tags_add": "Update the tags for selected documents",
"tags_notShared": "Your tags are not shared with other users",
"tags_duplicate": "Duplicate tag: {0}",
"tags_noentry": "You can't tag a deleted pad!",
"tags_noentry": "You cannot tag a deleted document",
"slideOptionsText": "Options",
"slideOptionsTitle": "Customize your slides",
"slide_invalidLess": "Invalid custom style",
@ -145,7 +138,7 @@
"themeButtonTitle": "Select the color theme to use for the code and slide editors",
"editShare": "Editing link",
"viewShare": "Read-only link",
"viewEmbedTag": "To embed this pad, include this iframe in your page wherever you want. You can style it using CSS or HTML attributes.",
"viewEmbedTag": "To embed this document, include this iframe in your page wherever you want. You can style it using CSS or HTML attributes.",
"fileEmbedScript": "To embed this file, include this script once in your page to load the Media Tag:",
"fileEmbedTag": "Then place this Media Tag wherever in your page you would like to embed:",
"notifyJoined": "{0} has joined the collaborative session",
@ -232,7 +225,7 @@
"contacts_remove": "Remove this contact",
"contacts_confirmRemove": "Are you sure you want to remove <em>{0}</em> from your contacts?",
"contacts_typeHere": "Type a message here...",
"contacts_warning": "Everything you type here is persistent and available to all the existing and future users of this pad. Be careful with sensitive information!",
"contacts_warning": "Everything you type here is persistent and available to all the existing and future users of this document. Be careful with sensitive information!",
"contacts_padTitle": "Chat",
"contacts_info1": "These are your contacts. From here, you can:",
"contacts_info2": "Click your contact's icon to chat with them",
@ -245,12 +238,12 @@
"contacts_rooms": "Rooms",
"contacts_leaveRoom": "Leave this room",
"contacts_online": "Another user from this room is online",
"fm_rootName": "Documents",
"fm_rootName": "Drive",
"fm_trashName": "Trash",
"fm_filesDataName": "All files",
"fm_templateName": "Templates",
"fm_searchName": "Search",
"fm_recentPadsName": "Recent pads",
"fm_recentPadsName": "Recent",
"fm_ownedPadsName": "Owned",
"fm_tagsName": "Tags",
"fm_sharedFolderName": "Shared folder",
@ -258,7 +251,7 @@
"fm_newButton": "New",
"fm_newButtonTitle": "Create a new document or folder, import a file in the current folder.",
"fm_newFolder": "New folder",
"fm_newFile": "New pad",
"fm_newFile": "New document",
"fm_morePads": "More",
"fm_folder": "Folder",
"fm_sharedFolder": "Shared folder",
@ -276,31 +269,31 @@
"fm_emptyTrashDialog": "Are you sure you want to empty the trash?",
"fm_removeSeveralPermanentlyDialog": "Are you sure you want to remove these {0} items from your drive? They will remain in the drives of other users who have stored them.",
"fm_removePermanentlyDialog": "Are you sure you want to remove this item from your drive? It will remain in the drives of other users who have stored it.",
"fm_deleteOwnedPad": "Are you sure you want to permanently remove this pad from the server?",
"fm_deleteOwnedPads": "Are you sure you want to permanently remove these pads from the server?",
"fm_deleteOwnedPad": "Are you sure you want to permanently destroy this document?",
"fm_deleteOwnedPads": "Are you sure you want to permanently destroy these documents?",
"fm_restoreDialog": "Are you sure you want to restore {0} to its previous location?",
"fm_unknownFolderError": "The selected or last visited directory no longer exist. Opening the parent folder...",
"fm_contextMenuError": "Unable to open the context menu for that element. If the problem persist, try to reload the page.",
"fm_selectError": "Unable to select the targeted element. If the problem persists, try to reload the page.",
"fm_categoryError": "Unable to open the selected category, displaying root.",
"fm_info_root": "Create as many nested folders here as you want to sort your files.",
"fm_info_template": "Contains all the pads stored as templates and that you can re-use when you create a new pad.",
"fm_info_recent": "These pads have recently been opened or modified by you or people you collaborate with.",
"fm_info_template": "These documents are stored as templates. They can be re-used when creating new documents.",
"fm_info_recent": "These documents have recently been opened or modified by you or people you collaborate with.",
"fm_info_trash": "Empty your trash to free space in your CryptDrive.",
"fm_info_anonymous": "You are not logged in so your documents will expire after {0} days. Clearing your browser's history may make them disappear.<br><a href=\"/register/\">Sign up</a> (no personal information required) or <a href=\"/login/\">Log in</a> to store them in your drive indefinitely. <a href=\"#docs\">Read more about registered accounts</a>.",
"fm_info_sharedFolder": "This is a shared folder. You're not logged in so you can only access it in read-only mode.<br><a href=\"/register/\">Sign up</a> or <a href=\"/login/\">Log in</a> to be able to import it to your CryptDrive and to modify it.",
"fm_info_owned": "You are the owner of the pads displayed here. This means you can remove them permanently from the server whenever you want. If you do so, other users won't be able to access them anymore.",
"fm_info_owned": "You are the owner of the documents displayed here. This means you can remove them permanently from the server whenever you want. If you do so, other users won't be able to access them anymore.",
"fm_error_cantPin": "Internal server error. Please reload the page and try again.",
"fm_viewListButton": "List view",
"fm_viewGridButton": "Grid view",
"fm_renamedPad": "You've set a custom name for this pad. Its shared title is:<br><b>{0}</b>",
"fm_renamedPad": "You have set a custom name for this document. Its shared title is:<br><b>{0}</b>",
"fm_canBeShared": "This folder can be shared",
"fm_prop_tagsList": "Tags",
"fm_burnThisDriveButton": "Erase all information stored by CryptPad in your browser",
"fm_burnThisDrive": "Are you sure you want to remove everything stored by CryptPad in your browser?<br>This will remove your CryptDrive and its history from your browser, but your pads will still exist (encrypted) on our server.",
"fm_padIsOwned": "You are the owner of this pad",
"fm_padIsOwnedOther": "This pad is owned by another user",
"fm_deletedPads": "These pads no longer exist on the server, they've been removed from your CryptDrive: {0}",
"fm_burnThisDrive": "Are you sure you want to remove everything stored by CryptPad in your browser?<br>This will remove your CryptDrive and its history from your browser, but your documents will still exist (encrypted) on our server.",
"fm_padIsOwned": "You are the owner of this document",
"fm_padIsOwnedOther": "This document is owned by another user",
"fm_deletedPads": "These documents no longer exist on the server, they've been removed from your CryptDrive: {0}",
"fm_tags_name": "Tag name",
"fm_tags_used": "Number of uses",
"fm_restoreDrive": "Resetting your drive to an earlier state. For best results, avoid making changes to your drive until this process is complete.",
@ -363,15 +356,15 @@
"settings_title": "Settings",
"settings_save": "Save",
"settings_backupCategory": "Backup",
"settings_backupHint": "Backup or restore all your CryptDrive's content. It won't contain the content of your pads, just the keys to access them.",
"settings_backupHint": "Backup or restore all your CryptDrive's content. It won't contain the content of your documents, just the keys to access them.",
"settings_backup": "Backup",
"settings_restore": "Restore",
"settings_backupHint2": "Download all the documents in your drive. Documents will be downloaded in formats readable by other applications when such a format is available. When such a format is not available, documents will be downloaded in a format readable by CryptPad.",
"settings_backup2": "Download my CryptDrive",
"settings_backup2Confirm": "This will download all the pads and files from your CryptDrive. If you want to continue, pick a name and press OK",
"settings_backup2Confirm": "This will download all the documents and files from your CryptDrive. If you want to continue, pick a name and press OK",
"settings_exportTitle": "Export your CryptDrive",
"settings_exportDescription": "Please wait while we're downloading and decrypting your documents. This may take a few minutes. Closing the tab will interrupt the process.",
"settings_exportFailed": "If a pad requires more than 1 minute to be downloaded, it won't be included in the export. A link to any pad that has not been exported will be displayed.",
"settings_exportFailed": "If a document requires more than 1 minute to be downloaded, it won't be included in the export. A link to any document that has not been exported will be displayed.",
"settings_exportWarning": "Note: this tool is still in a beta version and it might have scalability issues. For better performance, it is recommended to leave this tab focused.",
"settings_exportCancel": "Are you sure you want to cancel the export? You will have to start again from the beginning next time.",
"settings_export_reading": "Reading your CryptDrive...",
@ -386,7 +379,7 @@
"settings_resetNewTitle": "Clean CryptDrive",
"settings_resetButton": "Remove",
"settings_reset": "Remove all the files and folders from your CryptDrive",
"settings_resetPrompt": "This action will remove all the pads from your drive.<br>Are you sure you want to continue?<br>Type “<em>I love CryptPad</em>” to confirm.",
"settings_resetPrompt": "This action will remove all the documents from your drive.<br>Are you sure you want to continue?<br>Type “<em>I love CryptPad</em>” to confirm.",
"settings_resetDone": "Your drive is now empty!",
"settings_resetError": "Incorrect verification text. Your CryptDrive has not been changed.",
"settings_resetTipsAction": "Reset",
@ -395,25 +388,25 @@
"settings_resetTipsDone": "All the tips are now visible again.",
"settings_thumbnails": "Thumbnails",
"settings_disableThumbnailsAction": "Disable thumbnails creation in your CryptDrive",
"settings_disableThumbnailsDescription": "Thumbnails are automatically created and stored in your browser when you visit a new pad. You can disable this feature here.",
"settings_disableThumbnailsDescription": "Thumbnails are automatically created and stored in your browser when you visit a new document. You can disable this feature here.",
"settings_resetThumbnailsAction": "Clean",
"settings_resetThumbnailsDescription": "Clean all the pads thumbnails stored in your browser.",
"settings_resetThumbnailsDescription": "Clean all the documents thumbnails stored in your browser.",
"settings_resetThumbnailsDone": "All the thumbnails have been erased.",
"settings_importTitle": "Import this browser's recent pads in your CryptDrive",
"settings_importTitle": "Import this browser's recent documents to your CryptDrive",
"settings_import": "Import",
"settings_importConfirm": "Are you sure you want to import recent pads from this browser to your user account's CryptDrive?",
"settings_importConfirm": "Are you sure you want to import recent documents from this browser to your user account's CryptDrive?",
"settings_importDone": "Import completed",
"settings_autostoreTitle": "Pad storage in CryptDrive",
"settings_autostoreHint": "<b>Automatic</b> All the pads you visit are stored in your CryptDrive.<br><b>Manual (always ask)</b> If you have not stored a pad yet, you will be asked if you want to store them in your CryptDrive.<br><b>Manual (never ask)</b> Pads are not stored automatically in your CryptDrive. The option to store them will be hidden.",
"settings_autostoreHint": "<b>Automatic</b> All the documents you visit are stored in your CryptDrive.<br><b>Manual (always ask)</b> If you have not stored a document yet, you will be asked if you want to store them in your CryptDrive.<br><b>Manual (never ask)</b> Documents are not stored automatically in your CryptDrive. The option to store them will be hidden.",
"settings_autostoreYes": "Automatic",
"settings_autostoreNo": "Manual (never ask)",
"settings_autostoreMaybe": "Manual (always ask)",
"settings_userFeedbackTitle": "Feedback",
"settings_userFeedbackHint1": "CryptPad provides some very basic feedback to the server, to let us know how to improve your experience. ",
"settings_userFeedbackHint2": "Your pad's content will never be shared with the server.",
"settings_userFeedbackHint2": "The content of your documents will never be shared with the server.",
"settings_userFeedback": "Enable user feedback",
"settings_deleteTitle": "Account deletion",
"settings_deleteHint": "Account deletion is permanent. Your CryptDrive and your list of pads will be deleted from the server. The rest of your pads will be deleted in 90 days if nobody else has stored them in their CryptDrive.",
"settings_deleteHint": "Account deletion is permanent. Your CryptDrive and your list of documents will be deleted from the server. The rest of your documents will be deleted in 90 days if nobody else has stored them in their CryptDrive.",
"settings_deleteButton": "Delete your account",
"settings_deleteModal": "Share the following information with your CryptPad administrator in order to have your data removed from their server.",
"settings_deleted": "Your user account is now deleted. Press OK to go to the home page.",
@ -423,8 +416,8 @@
"settings_logoutEverywhereTitle": "Close remote sessions",
"settings_logoutEverywhere": "Force log out of all other web sessions",
"settings_logoutEverywhereConfirm": "Are you sure? You will need to log in with all your devices.",
"settings_driveDuplicateTitle": "Duplicated owned pads",
"settings_driveDuplicateHint": "When you move your owned pads to a shared folder, a copy is kept in your CryptDrive to ensure that you retain your control over it. You can hide duplicated files. Only the shared version will be visible, unless deleted, in which case the original will be displayed in its previous location.",
"settings_driveDuplicateTitle": "Duplicated owned documents",
"settings_driveDuplicateHint": "When you move your owned documents to a shared folder, a copy is kept in your CryptDrive to ensure that you retain your control over it. You can hide duplicated files. Only the shared version will be visible, unless deleted, in which case the original will be displayed in its previous location.",
"settings_driveDuplicateLabel": "Hide duplicates",
"settings_codeIndentation": "Code editor indentation (spaces)",
"settings_codeUseTabs": "Indent using tabs (instead of spaces)",
@ -433,8 +426,8 @@
"settings_padWidthHint": "Switch between page mode (default) that limits the width of the text editor, and using the full width of the screen.",
"settings_padWidthLabel": "Reduce the editor's width",
"settings_padSpellcheckTitle": "Spellcheck",
"settings_padSpellcheckHint": "This option allows you to enable spellcheck in rich text pads. Spelling errors will be underlined in red and you'll have to hold your Ctrl or Meta key while right-clicking to see the correct options.",
"settings_padSpellcheckLabel": "Enable spell check in rich text pads",
"settings_padSpellcheckHint": "This option allows you to enable spellcheck in rich text documents. Spelling errors will be underlined in red and you'll have to hold your Ctrl or Meta key while right-clicking to see the correct options.",
"settings_padSpellcheckLabel": "Enable spell check in rich text documents",
"settings_padOpenLinkTitle": "Open links on first click",
"settings_padOpenLinkHint": "With this option you can open embedded links on click without the preview popup",
"settings_padOpenLinkLabel": "Enable direct link opening",
@ -490,7 +483,7 @@
"todo_markAsCompleteTitle": "Mark this task as complete",
"todo_markAsIncompleteTitle": "Mark this task as incomplete",
"todo_removeTaskTitle": "Remove this task from your todo list",
"pad_base64": "This pad contains images stored in an inefficient way. These images will significantly increase the size of the pad in your CryptDrive, and make it slower to load. You can migrate these files to a new format which will be stored separately in your CryptDrive. Do you want to migrate these images now?",
"pad_base64": "This document contains images stored in an inefficient way. These images will significantly increase the size of the document in your CryptDrive, and make it slower to load. You can migrate these files to a new format which will be stored separately in your CryptDrive. Do you want to migrate these images now?",
"mdToolbar_button": "Show or hide the Markdown toolbar",
"mdToolbar_defaultText": "Your text here",
"mdToolbar_help": "Help",
@ -529,14 +522,14 @@
"features_f_file0": "Open documents",
"features_f_file0_note": "View and download documents shared by other users",
"features_f_cryptdrive0": "Limited access to CryptDrive",
"features_f_cryptdrive0_note": "Ability to store visited pads in your browser to be able to open them later",
"features_f_cryptdrive0_note": "Ability to store visited documents in your browser to be able to open them later",
"features_f_storage0": "Limited storage time",
"features_f_storage0_note": "Documents are deleted after {0} days of inactivity",
"features_f_anon": "All guest user features",
"features_f_anon_note": "With additional functionality",
"features_f_cryptdrive1": "Complete CryptDrive functionality",
"features_f_cryptdrive1_note": "Folders, shared folders, templates, tags",
"features_f_devices": "Your pads on all your devices",
"features_f_devices": "Your documents on all your devices",
"features_f_devices_note": "Access your CryptDrive everywhere with your user account",
"features_f_social": "Social features",
"features_f_social_note": "Add contacts for secure collaboration, create a profile, fine-grained access controls",
@ -558,7 +551,7 @@
"tos_title": "CryptPad Terms of Service",
"tos_legal": "Please don't be malicious, abusive, or do anything illegal.",
"tos_availability": "We hope you find this service useful, but availability or performance cannot be guaranteed. Please export your data regularly.",
"tos_e2ee": "CryptPad contents can be read or modified by anyone who can guess or otherwise obtain the pad's fragment identifier. We recommend that you use end-to-end-encrypted (e2ee) messaging technology to share links, and assume no liability in the event that such a link is leaked.",
"tos_e2ee": "CryptPad contents can be read or modified by anyone who can guess or otherwise obtain the document's fragment identifier. We recommend that you use end-to-end-encrypted (e2ee) messaging technology to share links, and assume no liability in the event that such a link is leaked.",
"tos_logs": "Metadata provided by your browser to the server may be logged for the purpose of maintaining the service.",
"tos_3rdparties": "We do not provide individualized data to third parties unless required to by law.",
"four04_pageNotFound": "We couldn't find the page you were looking for.",
@ -570,10 +563,10 @@
"feedback_about": "If you're reading this, you were probably curious why CryptPad is requesting web pages when you perform certain actions.",
"feedback_privacy": "We care about your privacy, and at the same time we want CryptPad to be very easy to use. We use this file to figure out which UI features matter to our users, by requesting it along with a parameter specifying which action was taken.",
"feedback_optout": "If you would like to opt out, visit <a>your user settings page</a>, where you'll find a checkbox to enable or disable user feedback.",
"creation_404": "This pad no longer exists. Use the following form to create a new pad.",
"creation_owned": "Owned pad",
"creation_404": "This document no longer exists. Use the following form to create a new document.",
"creation_owned": "Owned document",
"creation_owned1": "An <b>owned</b> item can be destroyed whenever the owner wants. Destroying an owned item makes it unavailable from other users' CryptDrives.",
"creation_expire": "Expiring pad",
"creation_expire": "Expiring document",
"creation_expireFalse": "Unlimited",
"creation_expireHours": "Hour(s)",
"creation_expireDays": "Day(s)",
@ -586,18 +579,18 @@
"creation_noOwner": "No owner",
"creation_expiration": "Expiration date",
"creation_passwordValue": "Password",
"creation_newPadModalDescription": "Click on a document type to create it. You can also press <b>Tab</b> to select the type and press <b>Enter</b> to confirm.",
"creation_newPadModalDescription": "Click on an app to create a new document. You can also press <b>Tab</b> to select the app and press <b>Enter</b> to confirm.",
"password_info": "The document you are trying to open no longer exists or is protected with a new password. Enter the correct password to access the content.",
"password_error": "Document not found<br>This error can be caused by two factors: either the password is invalid, or the document has been destroyed.",
"password_placeholder": "Type the password here...",
"password_submit": "Submit",
"properties_addPassword": "Add a password",
"properties_changePassword": "Change the password",
"properties_confirmNew": "Are you sure? Adding a password will change this pad's URL and remove its history. Users without the password will lose access to this pad",
"properties_confirmChange": "Are you sure? Changing the password will remove its history. Users without the new password will lose access to this pad",
"properties_confirmNew": "Are you sure? Adding a password will change this document's URL and remove its history. Users without the password will lose access to this document",
"properties_confirmChange": "Are you sure? Changing the password will remove its history. Users without the new password will lose access to this document",
"properties_passwordSame": "New passwords must differ from the current one.",
"properties_passwordError": "An error occured while trying to change the password. Please try again.",
"properties_passwordWarning": "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.<br>Press OK to reload and update your access rights.",
"properties_passwordWarning": "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the document manually.<br>Press OK to reload and update your access rights.",
"properties_passwordSuccess": "The password was successfully changed.<br>Press OK to reload and update your access rights.",
"properties_changePasswordButton": "Submit",
"share_linkCategory": "Link",
@ -611,8 +604,8 @@
"share_contactCategory": "Contacts",
"share_embedCategory": "Embed",
"share_mediatagCopy": "Copy mediatag to clipboard",
"sharedFolders_forget": "This pad is only stored in a shared folder, you can't move it to the trash. You can use your CryptDrive if you want to delete it.",
"sharedFolders_duplicate": "Some of the pads you were trying to move were already shared in the destination folder.",
"sharedFolders_forget": "This document is only stored in a shared folder, you can't move it to the trash. You can use your CryptDrive if you want to delete it.",
"sharedFolders_duplicate": "Some of the documents you were trying to move were already shared in the destination folder.",
"sharedFolders_create": "Create a shared folder",
"sharedFolders_create_name": "Folder name",
"sharedFolders_create_owned": "Owned folder",
@ -625,13 +618,13 @@
"autostore_sf": "folder",
"autostore_pad": "pad",
"autostore_notstored": "This {0} is not in your CryptDrive. Do you want to store it now?",
"autostore_settings": "You can enable automatic pad storage in your <a>Settings</a> page!",
"autostore_settings": "You can enable automatic document storage in your <a>Settings</a> page.",
"autostore_store": "Store",
"autostore_hide": "Don't store",
"autostore_error": "Unexpected error: we were unable to store this pad, please try again.",
"autostore_saved": "The pad was successfully stored in your CryptDrive!",
"autostore_error": "Unexpected error: we were unable to store this document, please try again.",
"autostore_saved": "The document was successfully stored in your CryptDrive!",
"autostore_forceSave": "Store the file in your CryptDrive",
"autostore_notAvailable": "You must store this pad in your CryptDrive before being able to use this feature.",
"autostore_notAvailable": "You must store this document in your CryptDrive before being able to use this feature.",
"crowdfunding_button": "Support CryptPad",
"crowdfunding_button2": "Help CryptPad",
"crowdfunding_popup_text": "<h3>We need your help!</h3>To ensure that CryptPad is actively developed, consider supporting the project via the OpenCollective page, where you can see our <b>Roadmap</b> and <b>Funding goals</b>.",
@ -645,7 +638,7 @@
"adminPage": "Administration",
"admin_activeSessionsTitle": "Active connections",
"admin_activeSessionsHint": "Number of active websocket connections (and unique IP addresses connected)",
"admin_activePadsTitle": "Active pads",
"admin_activePadsTitle": "Active documents",
"admin_activePadsHint": "Number of unique documents currently being viewed or edited",
"admin_registeredTitle": "Registered users",
"admin_registeredHint": "Number of users registered on your instance",
@ -678,7 +671,7 @@
"drive_active1Day": "Last 24 hours",
"drive_active7Days": "Last 7 days",
"drive_active28Days": "Last 4 weeks",
"drive_activeOld": "Less recent pads",
"drive_activeOld": "Less recent",
"friendRequest_later": "Decide later",
"friendRequest_accept": "Accept (Enter)",
"friendRequest_decline": "Decline",
@ -694,7 +687,7 @@
"profile_friendRequestSent": "Contact request pending...",
"isContact": "{0} is one of your contacts",
"isNotContact": "{0} is <b>not</b> one of your contacts",
"notification_padShared": "{0} has shared a pad with you: <b>{1}</b>",
"notification_padShared": "{0} has shared a document with you: <b>{1}</b>",
"notification_fileShared": "{0} has shared a file with you: <b>{1}</b>",
"notification_folderShared": "{0} has shared a folder with you: <b>{1}</b>",
"share_filterFriend": "Search by name",
@ -740,11 +733,11 @@
"notifications_dismissAll": "Dismiss all",
"support_notification": "An administrator has responded to your support ticket",
"requestEdit_button": "Request edit rights",
"requestEdit_confirm": "{1} has asked for the ability to edit the pad <b>{0}</b>. Would you like to grant them access?",
"requestEdit_viewPad": "Open the pad in a new tab",
"requestEdit_confirm": "{1} has asked for the ability to edit the document <b>{0}</b>. Would you like to grant them access?",
"requestEdit_viewPad": "Open the document in a new tab",
"later": "Decide later",
"requestEdit_request": "{1} wants to edit the pad <b>{0}</b>",
"requestEdit_accepted": "{1} granted you edit rights for the pad <b>{0}</b>",
"requestEdit_request": "{1} wants to edit the document <b>{0}</b>",
"requestEdit_accepted": "{1} granted you edit rights for the document <b>{0}</b>",
"requestEdit_sent": "Request sent",
"properties_unknownUser": "{0} unknown user(s)",
"pricing": "Pricing",
@ -758,7 +751,7 @@
"owner_removeConfirm": "Are you sure you want to remove ownership for the selected users? They will be notified of this action.",
"owner_removeMeConfirm": "You are about to give up your ownership rights. You will not be able to undo this action. Are you sure?",
"owner_addConfirm": "Co-owners will be able to change the content and remove you as an owner. Are you sure?",
"owner_add": "{0} wants you to be an owner of the pad <b>{1}</b>. Do you accept?",
"owner_add": "{0} wants you to be an owner of the document <b>{1}</b>. Do you accept?",
"owner_request": "{0} wants you to be an owner of <b>{1}</b>",
"owner_request_accepted": "{0} has accepted your offer to be an owner of <b>{1}</b>",
"owner_request_declined": "{0} has declined your offer to be an owner of <b>{1}</b>",
@ -768,7 +761,7 @@
"team_pickFriends": "Choose which contacts to invite to this team",
"team_inviteModalButton": "Invite",
"team_pcsSelectLabel": "Store in",
"team_pcsSelectHelp": "Creating an owned pad in your team's drive will give ownership to the team.",
"team_pcsSelectHelp": "Creating an owned document in your team's drive will give ownership to the team.",
"team_invitedToTeam": "{0} has invited you to join their team: <b>{1}</b>",
"team_kickedFromTeam": "{0} has kicked you from the team: <b>{1}</b>",
"team_acceptInvitation": "{0} has accepted your offer to join the team: <b>{1}</b>",
@ -820,20 +813,20 @@
"team_viewers": "Viewers",
"drive_sfPassword": "Your shared folder {0} is no longer available. It has either been deleted by its owner or it is now protected with a new password. You can remove this folder from your CryptDrive, or recover access using the new password.",
"drive_sfPasswordError": "Wrong password",
"password_error_seed": "Pad not found!<br>This error can be caused by two factors: either a password was added/changed, or the pad has been deleted from the server.",
"password_error_seed": "Pad not found!<br>This error can be caused by two factors: either a password was added/changed, or the document has been deleted from the server.",
"properties_confirmChangeFile": "Are you sure? Users without the new password will lose access to this file.",
"properties_confirmNewFile": "Are you sure? Adding a password will change this file's URL. Users without the password will lose access to this file.",
"properties_passwordWarningFile": "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the file manually.",
"properties_passwordSuccessFile": "The password was successfully changed.",
"driveOfflineError": "Your connection to CryptPad has been lost. Changes to this pad will not be saved in your CryptDrive. Please close all CryptPad tabs and try again in a new window. ",
"driveOfflineError": "Your connection to CryptPad has been lost. Changes to this document will not be saved in your CryptDrive. Please close all CryptPad tabs and try again in a new window. ",
"teams_table": "Roles",
"teams_table_generic": "Roles and permissions",
"teams_table_generic_view": "View: access folders and pads (read-only).",
"teams_table_generic_edit": "Edit: create, modify, and delete folders and pads.",
"teams_table_generic_view": "View: access folders and documents (read-only).",
"teams_table_generic_edit": "Edit: create, modify, and delete folders and documents.",
"teams_table_generic_admin": "Manage Members: invite and revoke members, change member roles up to Admin.",
"teams_table_generic_own": "Manage Team: change team name and avatar, add or remove Owners, change team subscription, delete team.",
"teams_table_specific": "Exceptions",
"teams_table_specificHint": "These are older shared folders where viewers still have permission to edit existing pads. Pads created or copied into these folders will have standard permissions.",
"teams_table_specificHint": "These are old shared folders where viewers still have permission to edit existing documents. Documents created or copied into these folders will have standard permissions.",
"teams_table_admins": "Manage members",
"teams_table_owners": "Manage team",
"teams_table_role": "Role",
@ -841,7 +834,7 @@
"share_linkWarning": "This link contains the keys to your document. Recipients will gain non-revokable access to your content.",
"share_linkPasswordAlert": "This item is password protected. When you send the link the recipient will have to enter the password.",
"share_contactPasswordAlert": "This item is password protected. Because you are sharing it with a CryptPad contact, the recipient will not have to enter the password.",
"share_embedPasswordAlert": "This item is password protected. When you embed this pad, viewers will be asked for the password.",
"share_embedPasswordAlert": "This item is password protected. When you embed this document, viewers will be asked for the password.",
"passwordFaqLink": "Read more about passwords",
"share_noContactsLoggedIn": "You are not connected with anyone on CryptPad yet. Share the link to your profile for people to send you contact requests.",
"share_copyProfileLink": "Copy profile link",
@ -874,11 +867,11 @@
"team_inviteInvalidLinkError": "This invitation link is not valid.",
"team_inviteLinkError": "There was an error while creating the link.",
"burnAfterReading_linkBurnAfterReading": "View once and self-destruct",
"burnAfterReading_warningLink": "You have set this pad to self-destruct. Once a recipient visits this link, they will be able to see the pad once before it is permanently deleted.",
"burnAfterReading_warningLink": "You have set this document to self-destruct. Once a recipient visits this link, they will be able to see the document once before it is permanently deleted.",
"burnAfterReading_generateLink": "Click on the button below to generate a link.",
"burnAfterReading_warningAccess": "This document will self-destruct. When you click the button below you will see the content once before it is permanently deleted. When you close this window you will not be able to access it again. If you are not ready to proceed you can close this window and come back later.",
"burnAfterReading_proceed": "view and delete",
"burnAfterReading_warningDeleted": "This pad has been permanently deleted, once you close this window you will not be able to access it again.",
"burnAfterReading_warningDeleted": "This document has been permanently deleted, once you close this window you will not be able to access it again.",
"oo_invalidFormat": "This file cannot be imported",
"oo_importInProgress": "Import in Progress",
"oo_exportInProgress": "Export in progress",
@ -892,7 +885,7 @@
"safeLinks_error": "This link was copied from the browser's address bar and does not provide access to the document. Please use the <i></i> <b>Share</b> menu to share directly with contacts or copy the link. <a> Read more about the Safe Links feature</a>.",
"dontShowAgain": "Don't show again",
"profile_login": "You need to log in to add this user to your contacts",
"settings_safeLinksHint": "CryptPad includes the keys to decrypt your pads in their links. Anyone with access to your browsing history can potentially read your data. This includes intrusive browser extensions and browsers that sync your history across devices. Enabling \"safe links\" prevents the keys from entering your browsing history or being displayed in your address bar whenever possible. We strongly recommend that you enable this feature and use the {0} Share menu.",
"settings_safeLinksHint": "CryptPad includes the keys to decrypt your documents in their links. Anyone with access to your browsing history can potentially read your data. This includes intrusive browser extensions and browsers that sync your history across devices. Enabling \"safe links\" prevents the keys from entering your browsing history or being displayed in your address bar whenever possible. We strongly recommend that you enable this feature and use the {0} Share menu to generate shareable links.",
"areYouSure": "Are you sure?",
"historyTrim_historySize": "History: {0}",
"historyTrim_contentsSize": "Contents: {0}",
@ -904,7 +897,7 @@
"trimHistory_currentSize": "Current history size: <b>{0}</b>",
"trimHistory_noHistory": "No history can be deleted",
"settings_trimHistoryTitle": "Delete History",
"settings_trimHistoryHint": "Save storage space by deleting the history of your drive and notifications. This will not affect the history of your pads. You can delete the history of pads in their properties dialog.",
"settings_trimHistoryHint": "Save storage space by deleting the history of your drive and notifications. This will not affect the history of your documents. You can delete the history of documents in their properties dialog.",
"makeACopy": "Make a copy",
"copy_title": "{0} (copy)",
"access_main": "Access",
@ -917,8 +910,8 @@
"allow_enabled": "enabled",
"allow_disabled": "disabled",
"allow_label": "Access list: {0}",
"access_muteRequests": "Mute access requests for this pad",
"owner_text": "The owner(s) of a pad are the only users authorized to: add/remove owners, restrict access to the pad with an access list, or delete the pad.",
"access_muteRequests": "Mute access requests for this document",
"owner_text": "The owner(s) of a document are the only users authorized to: add/remove owners, restrict access to the document with an access list, or delete the document.",
"logoutEverywhere": "Log out everywhere",
"allow_text": "Using an access list means that only selected users and owners will be able to access this document.",
"teams": "Teams",
@ -940,7 +933,7 @@
"canvas_select": "Select",
"cba_writtenBy": "Written by: {0}",
"cba_properties": "Author colors (experimental)",
"cba_hint": "This setting will be remembered when you create your next pad.",
"cba_hint": "This setting will be remembered when you create your next document.",
"cba_enable": "Enable",
"cba_disable": "Clear and Disable",
"cba_show": "Show author colors",
@ -948,7 +941,7 @@
"oo_login": "Please log in or register to improve the performance of spreadsheets.",
"cba_title": "Author colors",
"comments_notification": "Replies to your comment \"{0}\" in <b>{1}</b>",
"unknownPad": "Unknown pad",
"unknownPad": "Unknown document",
"mentions_notification": "{0} has mentioned you in <b>{1}</b>",
"comments_deleted": "Comment deleted by its author",
"comments_edited": "Edited",
@ -983,7 +976,7 @@
"support_cat_all": "All",
"support_attachments": "Attachments",
"support_addAttachment": "Add attachment",
"notification_padSharedTeam": "{0} has shared a pad with the team {2}: <b>{1}</b>",
"notification_padSharedTeam": "{0} has shared a document with the team {2}: <b>{1}</b>",
"notification_fileSharedTeam": "{0} has shared a file with the team {2}: <b>{1}</b>",
"notification_folderSharedTeam": "{0} has shared a folder with the team {2}: <b>{1}</b>",
"oo_refresh": "Refresh",

@ -13,4 +13,11 @@
flex-flow: column;
background-color: @cp_app-bg;
iframe[name="frameEditor"] {
display: none;
}
input[type="file"] {
padding: 5px !important;
margin-bottom: 5px;
}
}

@ -9,7 +9,7 @@ define([
'/customize/messages.js',
'/common/common-interface.js',
'/common/common-util.js',
'/common/outer/worker-channel.js',
'/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
@ -24,171 +24,268 @@ define([
h,
Messages,
UI,
Util
Util,
Channel
)
{
var APP = {};
var APP = window.APP = {};
var common;
var sFrameChan;
var debug = console.debug;
var getFileType = function (type) {
var file = {};
switch(type) {
case 'doc':
file.type = 'docx';
file.title = 'document.docx';
file.doc = 'text';
break;
case 'sheet':
file.type = 'xlsx';
file.title = 'spreadsheet.xlsx';
file.doc = 'spreadsheet';
break;
case 'slide':
file.type = 'pptx';
file.title = 'presentation.pptx';
file.doc = 'presentation';
break;
}
return file;
};
APP.getImageURL = function(name, callback) {
if (name && /^data:image/.test(name)) { return void callback(''); }
var x2tReady = Util.mkEvent(true);
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;
x2tReady.fire();
//fetchFonts(x2t);
debug("x2t mount done");
if (!Array.isArray(APP.images)) { return void callback(''); }
APP.images.some(function (obj) {
if (obj.name !== name) { return; }
var blob = new Blob([obj.data], {type: "application/bin;charset=utf-8"});
var blobUrl = URL.createObjectURL(blob);
callback(blobUrl);
return true;
});
};
var getX2t = function (cb) {
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);
var ooChannel = {};
var makeChannel = function () {
var msgEv = Util.mkEvent();
var iframe = $('#cp-sidebarlayout-rightside > iframe')[0].contentWindow;
window.addEventListener('message', function (msg) {
if (msg.source !== iframe) { return; }
msgEv.fire(msg);
});
}
var postMsg = function (data) { iframe.postMessage(data, '*'); };
Channel.create(msgEv, postMsg, function (chan) {
var send = ooChannel.send = function (obj) { chan.event('CMD', obj); };
x2t.onRuntimeInitialized = function() {
debug("x2t in runtime initialized");
// Init x2t js module
x2tInit(x2t);
x2tReady.reg(function () {
cb(x2t);
chan.on('CMD', function (obj) {
if (obj.type !== "auth") { return; }
send({
type: "authChanges",
changes: []
});
send({
type: "auth",
result: 1,
sessionId: 'cryptpad',
participants:[],
locks: [],
changes: [],
changesIndex: 0,
indexUser: 0,
buildVersion: "5.2.6",
buildNumber: 2,
licenseType: 3,
});
send({
type: "documentOpen",
data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
});
});
});
};
var loadOO = function (blob, type, name, cb) {
var s = h('script', {
type:'text/javascript',
src: '/common/onlyoffice/v4/web-apps/apps/api/documents/api.js'
});
var file = getFileType(type);
APP.$rightside.append(s);
var url = URL.createObjectURL(blob);
var getWindow = function () {
return window.frames && window.frames[0];
};
var getEditor = function () {
var w = getWindow();
if (!w) { return; }
return w.editor || w.editorCell;
};
var getContent = function () {
try {
return getEditor().asc_nativeGetFile();
} catch (e) {
console.error(e);
return;
}
};
/*
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; }
// Docs
if (ext === 'docx') { return 65; }
if (ext === 'doc') { return 66; }
if (ext === 'odt') { return 67; }
if (ext === 'txt') { return 69; }
if (ext === 'html') { return 70; }
var ooconfig = {
"document": {
"fileType": file.type,
"key": "fresh",
"title": file.title,
"url": url,
"permissions": { "print": true, }
},
"documentType": file.doc,
"editorConfig": {
"user": {
"id": "0",
"firstname": Messages.anonymous,
"name": Messages.anonymous,
},
"mode": "view",
"lang": "en"
},
"events": {
"onDocumentReady": function () {
console.error('READY');
var e = getEditor();
// Slides
if (ext === 'pptx') { return 129; }
if (ext === 'ppt') { return 130; }
if (ext === 'odp') { return 131; }
var x2tConvertData = function (data, name, typeTarget, cb) {
var fonts = e && e.FontLoader.fontInfos;
var files = e && e.FontLoader.fontFiles.map(function (f) {
return { 'Id': f.Id, };
});
var sframeChan = common.getSframeChannel();
sframeChan.query('Q_OO_CONVERT', {
data: data,
fileName: name,
outputFormat: typeTarget,
images: (e && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {},
fonts: fonts,
fonts_files: files,
}, cb, {
raw: true
});
};
APP.printPdf = function (obj) {
var bin = getContent();
x2tConvertData({
buffer: obj.data,
bin: bin
}, 'output.bin', 'pdf', function (err, obj) {
if (!obj || !obj.data) { return; }
var blob = new Blob([obj.data], {type: "application/pdf"});
cb(blob);
});
};
setTimeout(function () {
if (file.type === "xlsx") {
var d = e.asc_nativePrint(undefined, undefined, 0x101).ImData;
APP.printPdf({
data: d.data
});
return;
}
return void e.asc_Print({});
});
}
}
};
var getFromId = function (ext) {
var id = getFormatId(ext);
if (!id) { return ''; }
return '<m_nFormatFrom>'+id+'</m_nFormatFrom>';
};
var getToId = function (ext) {
var id = getFormatId(ext);
if (!id) { return ''; }
return '<m_nFormatTo>'+id+'</m_nFormatTo>';
APP.docEditor = new window.DocsAPI.DocEditor("cp-oo-placeholder", ooconfig);
makeChannel();
};
var x2tConvertDataInternal = function(x2t, data, fileName, outputFormat) {
debug("Converting Data for " + fileName + " to " + outputFormat);
var inputFormat = fileName.split('.').pop();
var convertData = function (data, name, typeTarget, cb) {
var sframeChan = common.getSframeChannel();
sframeChan.query('Q_OO_CONVERT', {
data: data,
fileName: name,
outputFormat: typeTarget,
}, cb, {
raw: true
});
x2t.FS.writeFile('/working/' + fileName, data);
var params = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<TaskQueueDataConvert xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
+ "<m_sFileFrom>/working/" + fileName + "</m_sFileFrom>"
+ "<m_sFileTo>/working/" + fileName + "." + outputFormat + "</m_sFileTo>"
+ getFromId(inputFormat)
+ getToId(outputFormat)
+ "<m_bIsNoBase64>false</m_bIsNoBase64>"
+ "</TaskQueueDataConvert>";
// 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) {
console.error(e, x2t.FS);
debug("Failed reading converted file");
UI.warn(Messages.error);
return "";
}
return result;
};
var x2tConverter = function (typeSrc, typeTarget) {
var x2tConverter = function (typeSrc, typeTarget, type) {
return function (data, name, cb) {
getX2t(function (x2t) {
if (typeSrc === 'ods') {
data = x2tConvertDataInternal(x2t, data, name, 'xlsx');
name += '.xlsx';
if (typeTarget === 'pdf') {
// Converting to PDF? we need to load OO from a bin
var next = function () {
var blob = new Blob([data], {type: "application/bin;charset=utf-8"});
loadOO(blob, type, name, function (blob) {
cb(blob);
});
};
if (typeSrc === 'bin') { return next(); }
convertData(data, name, 'bin', function (err, obj) {
if (err || !obj || !obj.data) {
UI.warn(Messages.error);
return void cb();
}
if (typeSrc === 'odt') {
data = x2tConvertDataInternal(x2t, data, name, 'docx');
name += '.docx';
name += '.bin';
data = obj.data;
APP.images = obj.images;
next();
});
return;
}
if (typeSrc === 'odp') {
data = x2tConvertDataInternal(x2t, data, name, 'pptx');
name += '.pptx';
convertData(data, name, typeTarget, function (err, obj) {
if (err || !obj || !obj.data) {
UI.warn(Messages.error);
return void cb();
}
cb(x2tConvertDataInternal(x2t, data, name, typeTarget));
cb(obj.data, obj.images);
});
};
};
var CONVERTERS = {
xlsx: {
//pdf: x2tConverter('xlsx', 'pdf'),
ods: x2tConverter('xlsx', 'ods'),
bin: x2tConverter('xlsx', 'bin'),
pdf: x2tConverter('xlsx', 'pdf', 'sheet'),
ods: x2tConverter('xlsx', 'ods', 'sheet'),
bin: x2tConverter('xlsx', 'bin', 'sheet'),
},
ods: {
//pdf: x2tConverter('ods', 'pdf'),
xlsx: x2tConverter('ods', 'xlsx'),
bin: x2tConverter('ods', 'bin'),
pdf: x2tConverter('ods', 'pdf', 'sheet'),
xlsx: x2tConverter('ods', 'xlsx', 'sheet'),
bin: x2tConverter('ods', 'bin', 'sheet'),
},
odt: {
docx: x2tConverter('odt', 'docx'),
txt: x2tConverter('odt', 'txt'),
bin: x2tConverter('odt', 'bin'),
docx: x2tConverter('odt', 'docx', 'doc'),
txt: x2tConverter('odt', 'txt', 'doc'),
bin: x2tConverter('odt', 'bin', 'doc'),
pdf: x2tConverter('odt', 'pdf', 'doc'),
},
docx: {
odt: x2tConverter('docx', 'odt'),
txt: x2tConverter('docx', 'txt'),
bin: x2tConverter('docx', 'bin'),
odt: x2tConverter('docx', 'odt', 'doc'),
txt: x2tConverter('docx', 'txt', 'doc'),
bin: x2tConverter('docx', 'bin', 'doc'),
pdf: x2tConverter('docx', 'pdf', 'doc'),
},
txt: {
odt: x2tConverter('txt', 'odt'),
docx: x2tConverter('txt', 'docx'),
bin: x2tConverter('txt', 'bin'),
odt: x2tConverter('txt', 'odt', 'doc'),
docx: x2tConverter('txt', 'docx', 'doc'),
bin: x2tConverter('txt', 'bin', 'doc'),
pdf: x2tConverter('txt', 'pdf', 'doc'),
},
odp: {
pptx: x2tConverter('odp', 'pptx'),
bin: x2tConverter('odp', 'bin'),
pptx: x2tConverter('odp', 'pptx', 'slide'),
bin: x2tConverter('odp', 'bin', 'slide'),
pdf: x2tConverter('odp', 'pdf', 'slide'),
},
pptx: {
odp: x2tConverter('pptx', 'odp'),
bin: x2tConverter('pptx', 'bin'),
odp: x2tConverter('pptx', 'odp', 'slide'),
bin: x2tConverter('pptx', 'bin', 'slide'),
pdf: x2tConverter('pptx', 'pdf', 'slide'),
},
};
@ -216,6 +313,7 @@ define([
APP.$toolbar = $('#cp-toolbar');
APP.$leftside = $('<div>', {id: 'cp-sidebarlayout-leftside'}).appendTo(APP.$container);
APP.$rightside = $('<div>', {id: 'cp-sidebarlayout-rightside'}).appendTo(APP.$container);
$(h('div#cp-oo-placeholder')).appendTo(APP.$rightside);
sFrameChan = common.getSframeChannel();
sFrameChan.onReady(waitFor());
}).nThen(function (/*waitFor*/) {
@ -227,8 +325,10 @@ define([
type: 'file'
});
APP.$rightside.append([hint, picker]);
Messages.convert_unsupported = "UNSUPPORTED FILE TYPE :("; // XXX
$(picker).on('change', function () {
APP.$rightside.find('button, div.notice').remove();
var file = picker.files[0];
var name = file && file.name;
var reader = new FileReader();
@ -247,8 +347,38 @@ define([
}).appendTo(APP.$rightside);
});
} else {
var notice = h('div.notice', Messages.convert_unsupported);
APP.$rightside.append(notice);
}
};
if (ext === 'bin') {
var reader2 = new FileReader();
reader2.onload = function (e) {
var str = e.target.result;
var type = str.slice(0,4);
var c = CONVERTERS['bin'] = {};
if (type === "XLSY") {
c.ods = x2tConverter('bin', 'ods', 'sheet');
c.xlsx = x2tConverter('bin', 'xlsx', 'sheet');
c.pdf = x2tConverter('bin', 'pdf', 'sheet');
} else if (type === "PPTY") {
c.odp = x2tConverter('bin', 'odp', 'slide');
c.pptx = x2tConverter('bin', 'pptx', 'slide');
c.pdf = x2tConverter('bin', 'pdf', 'slide');
} else if (type === "DOCY") {
c.odt = x2tConverter('bin', 'odt', 'doc');
c.docx = x2tConverter('bin', 'docx', 'doc');
c.pdf = x2tConverter('bin', 'pdf', 'doc');
} else {
return void console.error('Unsupported');
}
reader.readAsArrayBuffer(file, 'application/octet-stream');
};
return void reader2.readAsText(file);
}
reader.readAsArrayBuffer(file, 'application/octet-stream');
});

@ -17,11 +17,26 @@ define([
category = window.location.hash.slice(1);
window.location.hash = '';
}
var addRpc = function (sframeChan) {
// 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);
});
});
};
var addData = function (obj) {
if (category) { obj.category = category; }
};
SFCommonO.start({
noRealtime: true,
addRpc: addRpc,
addData: addData
});
});

@ -0,0 +1,26 @@
define([], function () {
var module = {
ext: '.docx', // default
exts: ['.docx']
};
module.main = function (userDoc, cb, ext, sframeChan, padData) {
sframeChan.query('Q_OOIFRAME_OPEN', {
json: userDoc,
type: 'doc',
padData: padData
}, function (err, u8) {
if (!u8) { return void cb(''); }
var ext;
if (typeof(u8) === "string") { ext = '.bin'; } // x2t not supported
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob, ext);
}, {
timeout: 600000,
raw: true
});
};
return module;
});

@ -13,9 +13,10 @@ define([
value += '"' + vv + '"';
return value;
};
Export.results = function (content, answers, TYPES, order) {
Export.results = function (content, answers, TYPES, order, isArray) {
if (!content || !content.form) { return; }
var csv = "";
var array = [];
var form = content.form;
var questions = [Messages.form_poll_time, Messages.share_formView];
@ -35,6 +36,7 @@ define([
if (i) { csv += ','; }
csv += escapeCSV(v);
});
array.push(questions);
Object.keys(answers || {}).forEach(function (key) {
var obj = answers[key];
@ -42,21 +44,26 @@ define([
var time = new Date(obj.time).toISOString();
var msg = obj.msg || {};
var user = msg._userdata || {};
csv += escapeCSV(time);
csv += ',' + escapeCSV(user.name || Messages.anonymous);
var line = [];
line.push(time);
line.push(user.name || Messages.anonymous);
order.forEach(function (key) {
var type = form[key].type;
if (!TYPES[type]) { return; } // Ignore static types
if (TYPES[type].exportCSV) {
var res = TYPES[type].exportCSV(msg[key], form[key]).map(function (str) {
return escapeCSV(str);
}).join(',');
csv += ',' + res;
var res = TYPES[type].exportCSV(msg[key], form[key]);
Array.prototype.push.apply(line, res);
return;
}
csv += ',' + escapeCSV(String(msg[key] || ''));
line.push(String(msg[key] || ''));
});
line.forEach(function (v, i) {
if (i) { csv += ','; }
csv += escapeCSV(v);
});
array.push(line);
});
if (isArray) { return array; }
return csv;
};

@ -2637,6 +2637,24 @@ define([
}), title);
});
// Export in "sheet"
Messages.form_exportSheet = "Export to spreadsheet"; // XXX
var export2Button = h('button.btn.btn-primary', [
h('i.cptools.cptools-sheet'),
Messages.form_exportSheet
]);
$(export2Button).appendTo($controls);
$(export2Button).click(function () {
var arr = Exporter.results(content, answers, TYPES, getFullOrder(content), true);
if (!arr) { return void UI.warn(Messages.error); }
var sframeChan = framework._.sfCommon.getSframeChannel();
var title = framework._.title.title || framework._.title.defaultTitle;
sframeChan.event('EV_EXPORT_SHEET', {
title: title,
content: arr
});
});
var summary = true;
var form = content.form;

@ -51,7 +51,14 @@ define([
Cryptpad.setPadAttribute('answersChannel', data.channel, function () {});
});
});
});
sframeChan.on('EV_EXPORT_SHEET', function (data) {
if (!data || !Array.isArray(data.content)) { return; }
sessionStorage.CP_formExportSheet = JSON.stringify(data);
var href = Utils.Hash.hashToHref('', 'sheet');
var a = window.open(href);
if (!a) { sframeChan.event('EV_POPUP_BLOCKED'); }
delete sessionStorage.CP_formExportSheet;
});
var getAnonymousKeys = function (formSeed, channel) {
var array = Nacl.util.decodeBase64(formSeed + channel);

@ -3,8 +3,8 @@ This file is intended to be used as a log of what third-party source we have ven
* [turndown v7.1.1](https://github.com/mixmark-io/turndown/releases/tag/v7.1.1) built from unmodified source as per its build scripts.
* [less.min.js v3.11.1](https://github.com/less/less.js/releases/tag/v3.11.1) with a minor modification to produce slightly more compact CSS
* [textFit.min.js v2.4.0 ](https://github.com/STRML/textFit/releases/tag/v2.4.0) to ensure that app names fit inside their icon containers on the home page
* [highlightjs](https://github.com/highlightjs/highlight.js/) for syntax highlighting in our code editor
* [our fork of tippy.js](https://github.com/xwiki-labs/tippyjs) for adding tooltips.
* [highlightjs v10.2.0](https://github.com/highlightjs/highlight.js/) for syntax highlighting in our code editor
* [our fork of tippy.js v1.2.0](https://github.com/xwiki-labs/tippyjs) for adding tooltips.
* [jscolor v2.0.5](https://jscolor.com/) for providing a consistent color picker across all browsers
* [jquery.ui 1.12.1](https://jqueryui.com/) for its 'autocomplete' extension which is used for our tag picker
* [pdfjs](https://mozilla.github.io/pdf.js/) with some minor modifications to prevent CSP errors

@ -0,0 +1,26 @@
define([], function () {
var module = {
ext: '.pptx', // default
exts: ['.pptx']
};
module.main = function (userDoc, cb, ext, sframeChan, padData) {
sframeChan.query('Q_OOIFRAME_OPEN', {
json: userDoc,
type: 'presentation',
padData: padData
}, function (err, u8) {
if (!u8) { return void cb(''); }
var ext;
if (typeof(u8) === "string") { ext = '.bin'; } // x2t not supported
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob, ext);
}, {
timeout: 600000,
raw: true
});
};
return module;
});

@ -1016,7 +1016,7 @@ define([
Feedback.send('FULL_DRIVE_EXPORT_COMPLETE');
saveAs(blob, filename);
}, errors);
}, ui.update, common.getCache());
}, ui.update, common.getCache(), common.getSframeChannel());
ui.onCancel(function() {
ui.close();
bu.stop();

@ -0,0 +1,26 @@
define([], function () {
var module = {
ext: '.xlsx', // default
exts: ['.xlsx']
};
module.main = function (userDoc, cb, ext, sframeChan, padData) {
sframeChan.query('Q_OOIFRAME_OPEN', {
json: userDoc,
type: 'sheet',
padData: padData
}, function (err, u8) {
if (!u8) { return void cb(''); }
var ext;
if (typeof(u8) === "string") { ext = '.bin'; } // x2t not supported
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob, ext);
}, {
timeout: 600000,
raw: true
});
};
return module;
});

@ -1137,7 +1137,7 @@ define([
Feedback.send('FULL_TEAMDRIVE_EXPORT_COMPLETE');
saveAs(blob, filename);
}, errors);
}, ui.update, common.getCache);
}, ui.update, common.getCache, common.getSframeChannel());
ui.onCancel(function() {
ui.close();
bu.stop();

Loading…
Cancel
Save