diff --git a/plugins/odfviewer/ODFViewerPlugin.js b/plugins/odfviewer/ODFViewerPlugin.js index 36013780..8fe7c350 100644 --- a/plugins/odfviewer/ODFViewerPlugin.js +++ b/plugins/odfviewer/ODFViewerPlugin.js @@ -1,43 +1,67 @@ /** - * @license * Copyright (C) 2012 KO GmbH * * @licstart - * The JavaScript code in this page is free software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * (GNU AGPL) as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. The code is distributed - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. + * This file is part of WebODF. * - * As additional permission under GNU AGPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. + * WebODF is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License (GNU AGPL) + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. * - * As a special exception to the AGPL, any HTML file which merely makes function - * calls to this code, and for that purpose includes it by reference shall be - * deemed a separate work for copyright law purposes. In addition, the copyright - * holders of this code give you permission to combine this code with free - * software libraries that are released under the GNU LGPL. You may copy and - * distribute such a system following the terms of the GNU AGPL for this code - * and the LGPL for the libraries. If you modify this code, you may extend this - * exception to your version of the code, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your - * version. + * WebODF is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * This license applies to this entire compilation. + * You should have received a copy of the GNU Affero General Public License + * along with WebODF. If not, see . * @licend + * * @source: http://www.webodf.org/ - * @source: http://gitorious.org/webodf/webodf/ + * @source: https://github.com/kogmbh/WebODF/ */ -/*global runtime, document, odf, console*/ +/*global runtime, document, odf, gui, console, webodf*/ function ODFViewerPlugin() { "use strict"; + function init(callback) { +/* + var lib = document.createElement('script'), + pluginCSS; + + lib.async = false; + lib.src = './webodf.js'; + lib.type = 'text/javascript'; + lib.onload = function () { +*/ + runtime.loadClass('gui.HyperlinkClickHandler'); + runtime.loadClass('odf.OdfCanvas'); + runtime.loadClass('ops.Session'); + runtime.loadClass('gui.CaretManager'); + runtime.loadClass("gui.HyperlinkTooltipView"); + runtime.loadClass('gui.SessionController'); + runtime.loadClass('gui.SvgSelectionView'); + runtime.loadClass('gui.SelectionViewManager'); + runtime.loadClass('gui.ShadowCursor'); + runtime.loadClass('gui.SessionView'); + + callback(); +/* + }; + + document.getElementsByTagName('head')[0].appendChild(lib); + + pluginCSS = document.createElement('link'); + pluginCSS.setAttribute("rel", "stylesheet"); + pluginCSS.setAttribute("type", "text/css"); + pluginCSS.setAttribute("href", "./ODFViewerPlugin.css"); + document.head.appendChild(pluginCSS); +*/ + } + // that should probably be provided by webodf function nsResolver(prefix) { var ns = { @@ -50,6 +74,8 @@ function ODFViewerPlugin() { } var self = this, + pluginName = "WebODF", + pluginURL = "http://webodf.org", odfCanvas = null, odfElement = null, initialized = false, @@ -59,18 +85,61 @@ function ODFViewerPlugin() { currentPage = null; this.initialize = function (viewerElement, documentUrl) { - odfElement = document.getElementById('canvas'); - odfCanvas = new odf.OdfCanvas(odfElement); - odfCanvas.load(documentUrl); + // If the URL has a fragment (#...), try to load the file it represents + init(function () { + var session, + sessionController, + sessionView, + odtDocument, + shadowCursor, + selectionViewManager, + caretManager, + localMemberId = 'localuser', + hyperlinkTooltipView, + eventManager; - odfCanvas.addListener('statereadychange', function () { - root = odfCanvas.odfContainer().rootElement; - initialized = true; - documentType = odfCanvas.odfContainer().getDocumentType(root); - if (documentType === 'text' && odfCanvas.enableAnnotations) { - odfCanvas.enableAnnotations(true); - } - self.onLoad(); + odfElement = document.getElementById('canvas'); + odfCanvas = new odf.OdfCanvas(odfElement); + odfCanvas.load(documentUrl); + + odfCanvas.addListener('statereadychange', function () { + root = odfCanvas.odfContainer().rootElement; + initialized = true; + documentType = odfCanvas.odfContainer().getDocumentType(root); + + if (documentType === 'text') { + odfCanvas.enableAnnotations(true, false); + + session = new ops.Session(odfCanvas); + odtDocument = session.getOdtDocument(); + shadowCursor = new gui.ShadowCursor(odtDocument); + sessionController = new gui.SessionController(session, localMemberId, shadowCursor, {}); + eventManager = sessionController.getEventManager(); + caretManager = new gui.CaretManager(sessionController, odfCanvas.getViewport()); + selectionViewManager = new gui.SelectionViewManager(gui.SvgSelectionView); + sessionView = new gui.SessionView({ + caretAvatarsInitiallyVisible: false + }, localMemberId, session, sessionController.getSessionConstraints(), caretManager, selectionViewManager); + selectionViewManager.registerCursor(shadowCursor); + hyperlinkTooltipView = new gui.HyperlinkTooltipView(odfCanvas, + sessionController.getHyperlinkClickHandler().getModifier); + eventManager.subscribe("mousemove", hyperlinkTooltipView.showTooltip); + eventManager.subscribe("mouseout", hyperlinkTooltipView.hideTooltip); + + var op = new ops.OpAddMember(); + op.init({ + memberid: localMemberId, + setProperties: { + fillName: runtime.tr("Unknown Author"), + color: "blue" + } + }); + session.enqueue([op]); + sessionController.insertLocalCursor(); + } + + self.onLoad(); + }); }); }; @@ -128,9 +197,28 @@ function ODFViewerPlugin() { } return pages; }; - + this.showPage = function (n) { odfCanvas.showPage(n); }; - + + this.getPluginName = function () { + return pluginName; + }; + + this.getPluginVersion = function () { + var version; + + if (String(typeof webodf) !== "undefined") { + version = webodf.Version; + } else { + version = "Unknown"; + } + + return version; + }; + + this.getPluginURL = function () { + return pluginURL; + }; } diff --git a/plugins/odfviewer/README b/plugins/odfviewer/README index 525b8e08..96472d16 100644 --- a/plugins/odfviewer/README +++ b/plugins/odfviewer/README @@ -6,11 +6,5 @@ by Tobias Hintze. See http://webodf.org for more information. INSTALLATION ------------ -Make the the folder 'files' in this directory writeable for the webserver. -It is used to temporarily store attachment files. Also make sure in the -webserver configuraton that this directory is not browsable. For Apache -webservers the included .htaccess file should already do the job. - Add 'odfviewer' to the list of plugins in the config/main.inc.php file of your Roundcube installation. - diff --git a/plugins/odfviewer/composer.json b/plugins/odfviewer/composer.json index f50f9f71..bcc7f25a 100644 --- a/plugins/odfviewer/composer.json +++ b/plugins/odfviewer/composer.json @@ -4,7 +4,7 @@ "description": "Open Document Viewer plugin", "homepage": "http://git.kolab.org/roundcubemail-plugins-kolab/", "license": "AGPLv3", - "version": "3.2.3", + "version": "3.3.0", "authors": [ { "name": "Thomas Bruederli", diff --git a/plugins/odfviewer/files/.htaccess b/plugins/odfviewer/files/.htaccess deleted file mode 100644 index b011d220..00000000 --- a/plugins/odfviewer/files/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ - -SetOutputFilter NONE - - -Options -Indexes diff --git a/plugins/odfviewer/odf.html b/plugins/odfviewer/odf.html index a84e630b..19fb5934 100644 --- a/plugins/odfviewer/odf.html +++ b/plugins/odfviewer/odf.html @@ -1,11 +1,13 @@ + - + + Roundcube WebODF Viewer - - - - + + + + - -
-
-
-
- - - -
-
-
-
-
- - - - +
+
+
+
+ + +
-
-
-
- +
+
+
+
+ - - - -
-
+ + + +
+
+
+
+ +
+ +
+ + + +
+
+
+
+
+
+
+
+
+
+
+ ✖ +
+
+
-
-
-
-
-
-
-
-
- ✖ -
-
diff --git a/plugins/odfviewer/odfviewer.php b/plugins/odfviewer/odfviewer.php index 77285a0e..5fcde31c 100644 --- a/plugins/odfviewer/odfviewer.php +++ b/plugins/odfviewer/odfviewer.php @@ -26,132 +26,84 @@ */ class odfviewer extends rcube_plugin { - public $task = 'mail|calendar|tasks|logout'; - - private $tempdir = 'plugins/odfviewer/files/'; - private $tempbase = 'plugins/odfviewer/files/'; - - private $odf_mimetypes = array( - 'application/vnd.oasis.opendocument.chart', - 'application/vnd.oasis.opendocument.chart-template', - 'application/vnd.oasis.opendocument.formula', - 'application/vnd.oasis.opendocument.formula-template', - 'application/vnd.oasis.opendocument.graphics', - 'application/vnd.oasis.opendocument.graphics-template', - 'application/vnd.oasis.opendocument.presentation', - 'application/vnd.oasis.opendocument.presentation-template', - 'application/vnd.oasis.opendocument.text', - 'application/vnd.oasis.opendocument.text-master', - 'application/vnd.oasis.opendocument.text-template', - 'application/vnd.oasis.opendocument.spreadsheet', - 'application/vnd.oasis.opendocument.spreadsheet-template', - ); + public $task = 'mail|calendar|tasks'; - function init() - { - $this->tempdir = $this->home . '/files/'; - $this->tempbase = $this->urlbase . 'files/'; + private $odf_mimetypes = array( + 'application/vnd.oasis.opendocument.chart', + 'application/vnd.oasis.opendocument.chart-template', + 'application/vnd.oasis.opendocument.formula', + 'application/vnd.oasis.opendocument.formula-template', + 'application/vnd.oasis.opendocument.graphics', + 'application/vnd.oasis.opendocument.graphics-template', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.oasis.opendocument.presentation-template', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.text-master', + 'application/vnd.oasis.opendocument.text-template', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template', + ); - // webODF only supports IE9 or higher - $ua = new rcube_browser; - if ($ua->ie && $ua->ver < 9) - return; - // extend list of mimetypes that should open in preview - $rcmail = rcube::get_instance(); - if ($rcmail->action == 'preview' || $rcmail->action == 'show' || $rcmail->task == 'calendar' || $rcmail->task == 'tasks') { - $mimetypes = (array)$rcmail->config->get('client_mimetypes'); - $rcmail->config->set('client_mimetypes', array_merge($mimetypes, $this->odf_mimetypes)); - } + function init() + { + // webODF only supports IE9 or higher + $ua = new rcube_browser; + if ($ua->ie && $ua->ver < 9) { + return; + } - $this->add_hook('message_part_get', array($this, 'get_part')); - $this->add_hook('session_destroy', array($this, 'session_cleanup')); - } - - /** - * Handler for message attachment download - */ - function get_part($args) - { - if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) { - if (empty($_GET['_load'])) { + // extend list of mimetypes that should open in preview $rcmail = rcube::get_instance(); - $exts = rcube_mime::get_mime_extensions($args['mimetype']); - $suffix = $exts ? '.'.$exts[0] : '.odt'; - $fn = md5(session_id() . $_SERVER['REQUEST_URI']) . $suffix; - - // FIXME: copy file to disk because only apache can send the file correctly - $tempfn = $this->tempdir . $fn; - if (!file_exists($tempfn)) { - if ($args['body']) { - file_put_contents($tempfn, $args['body']); - } - else { - $fp = fopen($tempfn, 'w'); - $imap = rcube::get_instance()->get_storage(); - $imap->get_message_part($args['uid'], $args['id'], $args['part'], false, $fp); - fclose($fp); - } - - // remember tempfiles in session to clean up on logout - $_SESSION['odfviewer']['tempfiles'][] = $fn; + if ($rcmail->action == 'preview' || $rcmail->action == 'show' || $rcmail->task == 'calendar' || $rcmail->task == 'tasks') { + $mimetypes = (array)$rcmail->config->get('client_mimetypes'); + $rcmail->config->set('client_mimetypes', array_merge($mimetypes, $this->odf_mimetypes)); } - - // send webODF viewer page - $html = file_get_contents($this->home . '/odf.html'); - header("Content-Type: text/html; charset=" . RCMAIL_CHARSET); - echo strtr($html, array( - '%%DOCROOT%%' => $rcmail->output->asset_url($this->urlbase), - '%%DOCURL%%' => $rcmail->output->asset_url($this->tempbase . $fn), # $_SERVER['REQUEST_URI'].'&_load=1', - )); - $args['abort'] = true; - } -/* - else { - if ($_SERVER['REQUEST_METHOD'] == 'HEAD') { - header("Content-Length: " . max(10, $args['part']->size)); # content-length has to be present - $args['body'] = ' '; # send empty body - return $args; + + $this->add_hook('message_part_get', array($this, 'get_part')); + } + + /** + * Handler for message attachment download + */ + function get_part($args) + { + if (!$args['download'] && $args['mimetype'] && in_array($args['mimetype'], $this->odf_mimetypes)) { + $rcmail = rcube::get_instance(); + $params = array( + 'documentUrl' => $_SERVER['REQUEST_URI'] . '&_download=1', + 'filename' => $args['part']->filename ?: 'file.odt', + 'type' => $args['mimetype'], + ); + + // send webODF viewer page + $html = file_get_contents($this->home . '/odf.html'); + header("Content-Type: text/html; charset=" . RCMAIL_CHARSET); + echo strtr($html, array( + '%%PARAMS%%' => rcube_output::json_serialize($params), + '%%viewer.css%%' => $this->asset_path('viewer.css'), + '%%viewer.js%%' => $this->asset_path('viewer.js'), + '%%ODFViewerPlugin.js%%' => $this->asset_path('ODFViewerPlugin.js'), + '%%webodf.js%%' => $this->asset_path('webodf.js'), + )); + + $args['abort'] = true; } - } -*/ + + return $args; } - return $args; - } + private function asset_path($path) + { + $rcmail = rcube::get_instance(); + $assets_dir = $rcmail->config->get('assets_dir'); - /** - * Remove temp files opened during this session - */ - function session_cleanup() - { - foreach ((array)$_SESSION['odfviewer']['tempfiles'] as $fn) { - @unlink($this->tempdir . $fn); + $mtime = filemtime($this->home . '/' . $path); + if (!$mtime && $assets_dir) { + $mtime = filemtime($assets_dir . '/plugins/odfviewer/' . $path); + } + + $path = $this->urlbase . $path . ($mtime ? '?s=' . $mtime : ''); + + return $rcmail->output->asset_url($path); } - - // also trigger general garbage collection because not everybody logs out properly - $this->gc_cleanup(); - } - - /** - * Garbage collector function for temp files. - * Remove temp files older than two days - */ - function gc_cleanup() - { - $tmp = unslashify($this->tempdir); - $expire = mktime() - 172800; // expire in 48 hours - - if ($dir = opendir($tmp)) { - while (($fname = readdir($dir)) !== false) { - if ($fname[0] == '.') - continue; - - if (filemtime($tmp.'/'.$fname) < $expire) - @unlink($tmp.'/'.$fname); - } - - closedir($dir); - } - } } - diff --git a/plugins/odfviewer/viewer.css b/plugins/odfviewer/viewer.css index b2a58229..7a302a44 100644 --- a/plugins/odfviewer/viewer.css +++ b/plugins/odfviewer/viewer.css @@ -28,7 +28,7 @@ select { -webkit-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); -moz-box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); box-shadow: 0px 1px 3px rgba(50, 50, 50, 0.75); - + background-image: url(images/texture.png), linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99)); background-image: url(images/texture.png), -webkit-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99)); background-image: url(images/texture.png), -moz-linear-gradient(rgba(69, 69, 69, .95), rgba(82, 82, 82, .99)); diff --git a/plugins/odfviewer/viewer.js b/plugins/odfviewer/viewer.js index b5f97cf4..50cba589 100644 --- a/plugins/odfviewer/viewer.js +++ b/plugins/odfviewer/viewer.js @@ -1,41 +1,50 @@ /** - * @license - * Copyright (C) 2013 KO GmbH + * Copyright (C) 2012-2015 KO GmbH * * @licstart - * The JavaScript code in this page is free software: you can redistribute it - * and/or modify it under the terms of the GNU Affero General Public License - * (GNU AGPL) as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. The code is distributed - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. + * This file is part of WebODF. * - * As additional permission under GNU AGPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. + * WebODF is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License (GNU AGPL) + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. * - * As a special exception to the AGPL, any HTML file which merely makes function - * calls to this code, and for that purpose includes it by reference shall be - * deemed a separate work for copyright law purposes. In addition, the copyright - * holders of this code give you permission to combine this code with free - * software libraries that are released under the GNU LGPL. You may copy and - * distribute such a system following the terms of the GNU AGPL for this code - * and the LGPL for the libraries. If you modify this code, you may extend this - * exception to your version of the code, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your - * version. + * WebODF is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * This license applies to this entire compilation. + * You should have received a copy of the GNU Affero General Public License + * along with WebODF. If not, see . * @licend + * * @source: http://www.webodf.org/ - * @source: http://gitorious.org/webodf/webodf/ + * @source: https://github.com/kogmbh/WebODF/ + */ + +/* + * This file is a derivative from a part of Mozilla's PDF.js project. The + * original license header follows. + */ + +/* Copyright 2012 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /*global document, window*/ -function Viewer(viewerPlugin, docurl) { +function Viewer(viewerPlugin, parameters) { "use strict"; var self = this, @@ -45,25 +54,88 @@ function Viewer(viewerPlugin, docurl) { kDefaultScaleDelta = 1.1, kDefaultScale = 'auto', presentationMode = false, + isFullScreen = false, initialized = false, isSlideshow = false, url, - viewerElement, + viewerElement = document.getElementById('viewer'), canvasContainer = document.getElementById('canvasContainer'), overlayNavigator = document.getElementById('overlayNavigator'), + titlebar = document.getElementById('titlebar'), + toolbar = document.getElementById('toolbarContainer'), pageSwitcher = document.getElementById('toolbarLeft'), zoomWidget = document.getElementById('toolbarMiddleContainer'), scaleSelector = document.getElementById('scaleSelect'), - filename, + dialogOverlay = document.getElementById('dialogOverlay'), + toolbarRight = document.getElementById('toolbarRight'), + aboutDialog, pages = [], currentPage, scaleChangeTimer, - touchTimer; + touchTimer, + toolbarTouchTimer, + /**@const*/ + UI_FADE_DURATION = 5000; - function isFullScreen() { - // Note that the browser fullscreen (triggered by short keys) might - // be considered different from content fullscreen when expecting a boolean - return document.isFullScreen || document.mozFullScreen || document.webkitIsFullScreen; + function isBlankedOut() { + return (blanked.style.display === 'block'); + } + + function initializeAboutInformation() { + var aboutDialogCentererTable, aboutDialogCentererCell, aboutButton, pluginName, pluginVersion, pluginURL; + + if (viewerPlugin) { + pluginName = viewerPlugin.getPluginName(); + pluginVersion = viewerPlugin.getPluginVersion(); + pluginURL = viewerPlugin.getPluginURL(); + } + + // Create dialog + aboutDialogCentererTable = document.createElement('div'); + aboutDialogCentererTable.id = "aboutDialogCentererTable"; + aboutDialogCentererCell = document.createElement('div'); + aboutDialogCentererCell.id = "aboutDialogCentererCell"; + aboutDialog = document.createElement('div'); + aboutDialog.id = "aboutDialog"; + aboutDialog.innerHTML = + "

ViewerJS

" + + "

Open Source document viewer for webpages, built with HTML and JavaScript.

" + + "

Learn more and get your own copy on the ViewerJS website.

" + + (viewerPlugin ? ("

Using the " + pluginName + " " + + "(" + pluginVersion + ") " + + "plugin to show you this document.

") + : "") + + "

Supported by
\"NLnet

" + + "

Made by
\"KO

" + + ""; + dialogOverlay.appendChild(aboutDialogCentererTable); + aboutDialogCentererTable.appendChild(aboutDialogCentererCell); + aboutDialogCentererCell.appendChild(aboutDialog); + + // Create button to open dialog that says "ViewerJS" + aboutButton = document.createElement('button'); + aboutButton.id = "about"; + aboutButton.className = "toolbarButton textButton about"; + aboutButton.title = "About"; + aboutButton.innerHTML = "ViewerJS" + toolbarRight.appendChild(aboutButton); + + // Attach events to the above + aboutButton.addEventListener('click', function () { + showAboutDialog(); + }); + document.getElementById('aboutDialogCloseButton').addEventListener('click', function () { + hideAboutDialog(); + }); + + } + + function showAboutDialog() { + dialogOverlay.style.display = "block"; + } + + function hideAboutDialog() { + dialogOverlay.style.display = "none"; } function selectScaleOption(value) { @@ -171,18 +243,38 @@ function Viewer(viewerPlugin, docurl) { delayedRefresh(300); } - - this.initialize = function (url) { - viewerElement = document.getElementById('viewer'); - filename = url.replace(/^.*[\\\/]/, ''); - document.title = filename; - document.getElementById('documentName').innerHTML = document.title; + function readZoomParameter(zoom) { + var validZoomStrings = ["auto", "page-actual", "page-width"], + number; + + if (validZoomStrings.indexOf(zoom) !== -1) { + return zoom; + } + number = parseFloat(zoom); + if (number && kMinScale <= number && number <= kMaxScale) { + return zoom; + } + return kDefaultScale; + } + + this.initialize = function () { + var initialScale, + element; + + initialScale = readZoomParameter(parameters.zoom); + + url = parameters.documentUrl; + document.title = parameters.filename; + var documentName = document.getElementById('documentName'); + documentName.innerHTML = ""; + documentName.appendChild(documentName.ownerDocument.createTextNode(parameters.filename)); viewerPlugin.onLoad = function () { +// document.getElementById('pluginVersion').innerHTML = viewerPlugin.getPluginVersion(); isSlideshow = viewerPlugin.isSlideshow(); if (isSlideshow) { - // No padding for slideshows - canvasContainer.style.padding = 0; + // Slideshow pages should be centered + canvasContainer.classList.add("slideshow"); // Show page nav controls only for presentations pageSwitcher.style.visibility = 'visible'; } else { @@ -201,7 +293,7 @@ function Viewer(viewerPlugin, docurl) { self.showPage(1); // Set default scale - parseScale(kDefaultScale); + parseScale(initialScale); canvasContainer.onscroll = onScroll; delayedRefresh(); @@ -260,21 +352,31 @@ function Viewer(viewerPlugin, docurl) { */ this.toggleFullScreen = function () { var elem = viewerElement; - if (!isFullScreen()) { - if (elem.requestFullScreen) { - elem.requestFullScreen(); + if (!isFullScreen) { + if (elem.requestFullscreen) { + elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); + } else if (elem.webkitRequestFullscreen) { + elem.webkitRequestFullscreen(); } else if (elem.webkitRequestFullScreen) { - elem.webkitRequestFullScreen(); + elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); + } else if (elem.msRequestFullscreen) { + elem.msRequestFullscreen(); } } else { - if (document.cancelFullScreen) { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); } } }; @@ -284,14 +386,12 @@ function Viewer(viewerPlugin, docurl) { * Presentation mode involves fullscreen + hidden UI controls */ this.togglePresentationMode = function () { - var titlebar = document.getElementById('titlebar'), - toolbar = document.getElementById('toolbarContainer'), - overlayCloseButton = document.getElementById('overlayCloseButton'); + var overlayCloseButton = document.getElementById('overlayCloseButton'); if (!presentationMode) { titlebar.style.display = toolbar.style.display = 'none'; overlayCloseButton.style.display = 'block'; - canvasContainer.className = 'presentationMode'; + canvasContainer.classList.add('presentationMode'); isSlideshow = true; canvasContainer.onmousedown = function (event) { event.preventDefault(); @@ -309,9 +409,12 @@ function Viewer(viewerPlugin, docurl) { }; parseScale('page-fit'); } else { + if (isBlankedOut()) { + leaveBlankOut(); + } titlebar.style.display = toolbar.style.display = 'block'; overlayCloseButton.style.display = 'none'; - canvasContainer.className = ''; + canvasContainer.classList.remove('presentationMode'); canvasContainer.onmouseup = function () {}; canvasContainer.oncontextmenu = function () {}; canvasContainer.onmousedown = function () {}; @@ -362,123 +465,213 @@ function Viewer(viewerPlugin, docurl) { }; function cancelPresentationMode() { - if (presentationMode && !isFullScreen()) { + if (presentationMode && !isFullScreen) { self.togglePresentationMode(); } } + function handleFullScreenChange() { + isFullScreen = !isFullScreen; + cancelPresentationMode(); + } + function showOverlayNavigator() { if (isSlideshow) { - overlayNavigator.className = 'touched'; + overlayNavigator.className = 'viewer-touched'; window.clearTimeout(touchTimer); touchTimer = window.setTimeout(function () { overlayNavigator.className = ''; - }, 2000); + }, UI_FADE_DURATION); } } - function init(docurl) { + /** + * @param {!boolean} timed Fade after a while + */ + function showToolbars() { + titlebar.classList.add('viewer-touched'); + toolbar.classList.add('viewer-touched'); + window.clearTimeout(toolbarTouchTimer); + toolbarTouchTimer = window.setTimeout(function () { + hideToolbars(); + }, UI_FADE_DURATION); + } - self.initialize(docurl); + function hideToolbars() { + titlebar.classList.remove('viewer-touched'); + toolbar.classList.remove('viewer-touched'); + } - if (!(document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen)) { - document.getElementById('fullscreen').style.visibility = 'hidden'; + function toggleToolbars() { + if (titlebar.classList.contains('viewer-touched')) { + hideToolbars(); + } else { + showToolbars(); } + } - document.getElementById('overlayCloseButton').addEventListener('click', self.toggleFullScreen); - document.getElementById('fullscreen').addEventListener('click', self.toggleFullScreen); - document.getElementById('presentation').addEventListener('click', function () { - if (!isFullScreen()) { - self.toggleFullScreen(); + function blankOut(value) { + blanked.style.display = 'block'; + blanked.style.backgroundColor = value; + hideToolbars(); + } + + function leaveBlankOut() { + blanked.style.display = 'none'; + toggleToolbars(); + } + + function init() { + +// initializeAboutInformation(); + if (viewerPlugin) { + + self.initialize(); + + if (!(document.exitFullscreen || document.cancelFullScreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.webkitCancelFullScreen || document.msExitFullscreen)) { + document.getElementById('fullscreen').style.visibility = 'hidden'; + document.getElementById('presentation').style.visibility = 'hidden'; } - self.togglePresentationMode(); - }); - document.addEventListener('fullscreenchange', cancelPresentationMode); - document.addEventListener('webkitfullscreenchange', cancelPresentationMode); - document.addEventListener('mozfullscreenchange', cancelPresentationMode); + document.getElementById('overlayCloseButton').addEventListener('click', self.toggleFullScreen); + document.getElementById('fullscreen').addEventListener('click', self.toggleFullScreen); + document.getElementById('presentation').addEventListener('click', function () { + if (!isFullScreen) { + self.toggleFullScreen(); + } + self.togglePresentationMode(); + }); - document.getElementById('download').addEventListener('click', function () { - self.download(); - }); + document.addEventListener('fullscreenchange', handleFullScreenChange); + document.addEventListener('webkitfullscreenchange', handleFullScreenChange); + document.addEventListener('mozfullscreenchange', handleFullScreenChange); + document.addEventListener('MSFullscreenChange', handleFullScreenChange); - document.getElementById('zoomOut').addEventListener('click', function () { - self.zoomOut(); - }); + document.getElementById('download').addEventListener('click', function () { + self.download(); + }); - document.getElementById('zoomIn').addEventListener('click', function () { - self.zoomIn(); - }); + document.getElementById('zoomOut').addEventListener('click', function () { + self.zoomOut(); + }); - document.getElementById('previous').addEventListener('click', function () { - self.showPreviousPage(); - }); + document.getElementById('zoomIn').addEventListener('click', function () { + self.zoomIn(); + }); - document.getElementById('next').addEventListener('click', function () { - self.showNextPage(); - }); - - document.getElementById('previousPage').addEventListener('click', function () { - self.showPreviousPage(); - }); - - document.getElementById('nextPage').addEventListener('click', function () { - self.showNextPage(); - }); - - document.getElementById('pageNumber').addEventListener('change', function () { - self.showPage(this.value); - }); - - document.getElementById('scaleSelect').addEventListener('change', function () { - parseScale(this.value); - }); - - canvasContainer.addEventListener('click', showOverlayNavigator); - overlayNavigator.addEventListener('click', showOverlayNavigator); - - window.addEventListener('scalechange', function (evt) { - var customScaleOption = document.getElementById('customScaleOption'), - predefinedValueFound = selectScaleOption(String(evt.scale)); - - customScaleOption.selected = false; - - if (!predefinedValueFound) { - customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%'; - customScaleOption.selected = true; - } - }, true); - - window.addEventListener('resize', function (evt) { - if (initialized && - (document.getElementById('pageWidthOption').selected || - document.getElementById('pageAutoOption').selected)) { - parseScale(document.getElementById('scaleSelect').value); - } - showOverlayNavigator(); - }); - - window.addEventListener('keydown', function (evt) { - var key = evt.keyCode, - shiftKey = evt.shiftKey; - - switch (key) { - case 33: // pageUp - case 38: // up - case 37: // left + document.getElementById('previous').addEventListener('click', function () { self.showPreviousPage(); - break; - case 34: // pageDown - case 40: // down - case 39: // right + }); + + document.getElementById('next').addEventListener('click', function () { self.showNextPage(); - break; - case 32: // space - shiftKey ? self.showPreviousPage() : self.showNextPage(); - break; - } - }); + }); + + document.getElementById('previousPage').addEventListener('click', function () { + self.showPreviousPage(); + }); + + document.getElementById('nextPage').addEventListener('click', function () { + self.showNextPage(); + }); + + document.getElementById('pageNumber').addEventListener('change', function () { + self.showPage(this.value); + }); + + document.getElementById('scaleSelect').addEventListener('change', function () { + parseScale(this.value); + }); + + canvasContainer.addEventListener('click', showOverlayNavigator); + overlayNavigator.addEventListener('click', showOverlayNavigator); + canvasContainer.addEventListener('click', toggleToolbars); + titlebar.addEventListener('click', showToolbars); + toolbar.addEventListener('click', showToolbars); + + window.addEventListener('scalechange', function (evt) { + var customScaleOption = document.getElementById('customScaleOption'), + predefinedValueFound = selectScaleOption(String(evt.scale)); + + customScaleOption.selected = false; + + if (!predefinedValueFound) { + customScaleOption.textContent = Math.round(evt.scale * 10000) / 100 + '%'; + customScaleOption.selected = true; + } + }, true); + + window.addEventListener('resize', function (evt) { + if (initialized && + (document.getElementById('pageWidthOption').selected || + document.getElementById('pageAutoOption').selected)) { + parseScale(document.getElementById('scaleSelect').value); + } + showOverlayNavigator(); + }); + + window.addEventListener('keydown', function (evt) { + var key = evt.keyCode, + shiftKey = evt.shiftKey; + + // blanked-out mode? + if (isBlankedOut()) { + switch (key) { + case 16: // Shift + case 17: // Ctrl + case 18: // Alt + case 91: // LeftMeta + case 93: // RightMeta + case 224: // MetaInMozilla + case 225: // AltGr + // ignore modifier keys alone + break; + default: + leaveBlankOut(); + break; + } + } else { + switch (key) { + case 8: // backspace + case 33: // pageUp + case 37: // left arrow + case 38: // up arrow + case 80: // key 'p' + self.showPreviousPage(); + break; + case 13: // enter + case 34: // pageDown + case 39: // right arrow + case 40: // down arrow + case 78: // key 'n' + self.showNextPage(); + break; + case 32: // space + shiftKey ? self.showPreviousPage() : self.showNextPage(); + break; + case 66: // key 'b' blanks screen (to black) or returns to the document + case 190: // and so does the key '.' (dot) + if (presentationMode) { + blankOut('#000'); + } + break; + case 87: // key 'w' blanks page (to white) or returns to the document + case 188: // and so does the key ',' (comma) + if (presentationMode) { + blankOut('#FFF'); + } + break; + case 36: // key 'Home' goes to first page + self.showPage(0); + break; + case 35: // key 'End' goes to last page + self.showPage(pages.length); + break; + } + } + }); + } } - init(docurl); + init(); } diff --git a/plugins/odfviewer/webodf.js b/plugins/odfviewer/webodf.js index 29dda8aa..c8164268 100644 --- a/plugins/odfviewer/webodf.js +++ b/plugins/odfviewer/webodf.js @@ -1,25 +1,30 @@ -// Input 0 /* + This is a generated file. DO NOT EDIT. - Copyright (C) 2012 KO GmbH + Copyright (C) 2010-2014 KO GmbH @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. + The code in this file is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License (GNU AGPL) + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + The code in this file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with WebODF. If not, see . As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL + may distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU AGPL normally + required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source. As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be + calls to this code, and for that purpose includes it in unmodified form by reference or in-line shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and @@ -31,1686 +36,616 @@ This license applies to this entire compilation. @licend + @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ + @source: https://github.com/kogmbh/WebODF/ */ -var core={},gui={},xmldom={},odf={},ops={}; -// Input 1 -function Runtime(){}Runtime.ByteArray=function(e){};Runtime.prototype.getVariable=function(e){};Runtime.prototype.toJson=function(e){};Runtime.prototype.fromJson=function(e){};Runtime.ByteArray.prototype.slice=function(e,k){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(e){};Runtime.prototype.byteArrayFromString=function(e,k){};Runtime.prototype.byteArrayToString=function(e,k){};Runtime.prototype.concatByteArrays=function(e,k){}; -Runtime.prototype.read=function(e,k,l,p){};Runtime.prototype.readFile=function(e,k,l){};Runtime.prototype.readFileSync=function(e,k){};Runtime.prototype.loadXML=function(e,k){};Runtime.prototype.writeFile=function(e,k,l){};Runtime.prototype.isFile=function(e,k){};Runtime.prototype.getFileSize=function(e,k){};Runtime.prototype.deleteFile=function(e,k){};Runtime.prototype.log=function(e,k){};Runtime.prototype.setTimeout=function(e,k){};Runtime.prototype.libraryPaths=function(){}; -Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(e){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(e,k,l){};var IS_COMPILED_CODE=!0; -Runtime.byteArrayToString=function(e,k){function l(h){var b="",f,d=h.length;for(f=0;fa?b+=String.fromCharCode(a):(f+=1,n=h[f],194<=a&&224>a?b+=String.fromCharCode((a&31)<<6|n&63):(f+=1,q=h[f],224<=a&&240>a?b+=String.fromCharCode((a&15)<<12|(n&63)<<6|q&63):(f+=1,g=h[f],240<=a&&245>a&&(a=(a&7)<<18|(n&63)<<12|(q&63)<<6|g&63,a-=65536,b+=String.fromCharCode((a>>10)+55296,(a&1023)+56320))))); -return b}var r;"utf8"===k?r=p(e):("binary"!==k&&this.log("Unsupported encoding: "+k),r=l(e));return r};Runtime.getVariable=function(e){try{return eval(e)}catch(k){}};Runtime.toJson=function(e){return JSON.stringify(e)};Runtime.fromJson=function(e){return JSON.parse(e)};Runtime.getFunctionName=function(e){return void 0===e.name?(e=/function\s+(\w+)/.exec(e))&&e[1]:e.name}; -function BrowserRuntime(e){function k(h,b){var f,d,a;void 0!==b?a=h:b=h;e?(d=e.ownerDocument,a&&(f=d.createElement("span"),f.className=a,f.appendChild(d.createTextNode(a)),e.appendChild(f),e.appendChild(d.createTextNode(" "))),f=d.createElement("span"),0n?(d[q]=n,q+=1):2048>n?(d[q]=192|n>>>6,d[q+1]=128|n&63,q+=2):(d[q]=224|n>>>12&15,d[q+1]=128|n>>>6&63,d[q+2]=128|n&63,q+=3)}else for("binary"!==b&&l.log("unknown encoding: "+b),f=h.length,d=new l.ByteArray(f),a=0;ad.status||0===d.status?f(null):f("Status "+String(d.status)+": "+d.responseText||d.statusText):f("File "+h+" is empty."))}; -b=b.buffer&&!d.sendAsBinary?b.buffer:l.byteArrayToString(b,"binary");try{d.sendAsBinary?d.sendAsBinary(b):d.send(b)}catch(a){l.log("HUH? "+a+" "+b),f(a.message)}};this.deleteFile=function(h,b){delete p[h];var f=new XMLHttpRequest;f.open("DELETE",h,!0);f.onreadystatechange=function(){4===f.readyState&&(200>f.status&&300<=f.status?b(f.responseText):b(null))};f.send(null)};this.loadXML=function(h,b){var f=new XMLHttpRequest;f.open("GET",h,!0);f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange= -function(){4===f.readyState&&(0!==f.status||f.responseText?200===f.status||0===f.status?b(null,f.responseXML):b(f.responseText):b("File "+h+" is empty."))};try{f.send(null)}catch(d){b(d.message)}};this.isFile=function(h,b){l.getFileSize(h,function(f){b(-1!==f)})};this.getFileSize=function(h,b){var f=new XMLHttpRequest;f.open("HEAD",h,!0);f.onreadystatechange=function(){if(4===f.readyState){var d=f.getResponseHeader("Content-Length");d?b(parseInt(d,10)):b(-1)}};f.send(null)};this.log=k;this.assert= -function(h,b,f){if(!h)throw k("alert","ASSERTION FAILED:\n"+b),f&&f(),b;};this.setTimeout=function(h,b){setTimeout(function(){h()},b)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(h){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(h){return(new DOMParser).parseFromString(h,"text/xml")};this.exit=function(h){k("Calling exit with code "+String(h)+", but exit() is not implemented.")}; -this.getWindow=function(){return window};this.getNetwork=function(){var h=this.getVariable("now");return void 0===h?{networkStatus:"unavailable"}:h}} -function NodeJSRuntime(){function e(b,d,a){b=p.resolve(r,b);"binary"!==d?l.readFile(b,d,a):l.readFile(b,null,a)}var k=this,l=require("fs"),p=require("path"),r="",h,b;this.ByteArray=function(b){return new Buffer(b)};this.byteArrayFromArray=function(b){var d=new Buffer(b.length),a,n=b.length;for(a=0;a").implementation} -function RhinoRuntime(){function e(b,f){var d;void 0!==f?d=b:f=b;"alert"===d&&print("\n!!!!! ALERT !!!!!");print(f);"alert"===d&&print("!!!!! ALERT !!!!!")}var k=this,l=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),p,r,h="";l.setValidating(!1);l.setNamespaceAware(!0);l.setExpandEntityReferences(!1);l.setSchema(null);r=Packages.org.xml.sax.EntityResolver({resolveEntity:function(b,f){var d=new Packages.java.io.FileReader(f);return new Packages.org.xml.sax.InputSource(d)}});p=l.newDocumentBuilder(); -p.setEntityResolver(r);this.ByteArray=function(b){return[b]};this.byteArrayFromArray=function(b){return b};this.byteArrayFromString=function(b,f){var d=[],a,n=b.length;for(a=0;a>>18],b+=u[c>>>12&63],b+=u[c>>>6&63],b+=u[c&63];m===g+1?(c=a[m]<<4,b+=u[c>>>6],b+=u[c&63],b+="=="):m===g&&(c=a[m]<<10|a[m+1]<<2,b+=u[c>>>12],b+=u[c>>>6&63],b+=u[c&63],b+="=");return b}function l(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,"");var b=[],c=a.length%4,m,g=a.length,q;for(m=0;m>16,q>>8&255,q&255);b.length-=[0,0,2,1][c];return b}function p(a){var b=[],c,m=a.length,g;for(c=0;cg?b.push(g):2048>g?b.push(192|g>>>6,128|g&63):b.push(224|g>>>12&15,128|g>>>6&63,128|g&63);return b}function r(a){var b=[],c,m=a.length,g,q,s;for(c=0;cg?b.push(g):(c+=1,q=a[c],224>g?b.push((g&31)<<6|q&63):(c+=1,s=a[c],b.push((g&15)<<12|(q&63)<<6|s&63)));return b}function h(a){return k(e(a))} -function b(a){return String.fromCharCode.apply(String,l(a))}function f(a){return r(e(a))}function d(a){a=r(a);for(var c="",b=0;bb?m+=String.fromCharCode(b):(s+=1,g=a.charCodeAt(s)&255,224>b?m+=String.fromCharCode((b&31)<<6|g&63):(s+=1,q=a.charCodeAt(s)&255,m+=String.fromCharCode((b&15)<<12|(g&63)<<6|q&63)));return m}function n(b,c){function m(){var d= -s+g;d>b.length&&(d=b.length);q+=a(b,s,d);s=d;d=s===b.length;c(q,d)&&!d&&runtime.setTimeout(m,0)}var g=1E5,q="",s=0;b.lengthb;b+=1)a.push(65+b);for(b=0;26>b;b+=1)a.push(97+b);for(b= -0;10>b;b+=1)a.push(48+b);a.push(43);a.push(47);return a})();var t=function(a){var b={},c,m;c=0;for(m=a.length;c>>8):(oa(b&255),oa(b>>>8))},qa=function(){v=(v<<5^c[y+3-1]&255)&8191;w=s[32768+v];s[y&32767]=w;s[32768+v]=y},ba=function(a,b){A>16-b?(m|=a<>16-A,A+=b-16):(m|=a<a;a++)c[a]=c[a+32768];J-=32768;y-=32768;x-=32768;for(a=0;8192>a;a++)b=s[32768+a],s[32768+a]=32768<=b?b-32768:0;for(a=0;32768>a;a++)b=s[a],s[a]=32768<=b?b-32768:0;m+=32768}C||(a=Aa(c,y+D,m),0>=a?C=!0:D+=a)},Ba=function(a){var b=G,m=y,g,q=O,d=32506=F&&(b>>=2);do if(g=a,c[g+q]===e&&c[g+q-1]===n&&c[g]===c[m]&&c[++g]===c[m+1]){m+= -2;g++;do++m;while(c[m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&c[++m]===c[++g]&&mq){J=a;q=g;if(258<=g)break;n=c[m+q-1];e=c[m+q]}}while((a=s[a&32767])>d&&0!==--b);return q},ka=function(a,b){t[aa++]=b;0===a?K[b].fc++:(a--,K[z[b]+256+1].fc++,H[(256>a?ca[a]:ca[256+(a>>7)])&255].fc++,u[la++]=a,ga|=ia);ia<<=1;0===(aa&7)&&(da[sa++]=ga,ga=0,ia=1);if(2g;g++)c+= -H[g].fc*(5+ja[g]);c>>=3;if(la>=1,c<<=1;while(0<--b);return c>>1},Da=function(a,b){var c=[];c.length=16;var m=0,g;for(g=1;15>=g;g++)m=m+S[g-1]<<1,c[g]=m;for(m=0;m<=b;m++)g=a[m].dl,0!==g&&(a[m].fc=Ca(c[g]++,g))},xa=function(a){var b=a.dyn_tree,c=a.static_tree,m=a.elems, -g,q=-1,s=m;R=0;N=573;for(g=0;gR;)g=T[++R]=2>q?++q:0,b[g].fc=1,V[g]=0,ea--,null!==c&&(ha-=c[g].dl);a.max_code=q;for(g=R>>1;1<=g;g--)wa(b,g);do g=T[1],T[1]=T[R--],wa(b,1),c=T[1],T[--N]=g,T[--N]=c,b[s].fc=b[g].fc+b[c].fc,V[s]=V[g]>V[c]+1?V[g]:V[c]+1,b[g].dl=b[c].dl=s,T[1]=s++,wa(b,1);while(2<=R);T[--N]=T[1];s=a.dyn_tree;g=a.extra_bits;var m=a.extra_base,c=a.max_code,d=a.max_length,t=a.static_tree,n,e,f,u,h=0;for(e=0;15>=e;e++)S[e]=0;s[T[N]].dl= -0;for(a=N+1;573>a;a++)n=T[a],e=s[s[n].dl].dl+1,e>d&&(e=d,h++),s[n].dl=e,n>c||(S[e]++,f=0,n>=m&&(f=g[n-m]),u=s[n].fc,ea+=u*(e+f),null!==t&&(ha+=u*(t[n].dl+f)));if(0!==h){do{for(e=d-1;0===S[e];)e--;S[e]--;S[e+1]+=2;S[d]--;h-=2}while(0c||(s[g].dl!==e&&(ea+=(e-s[g].dl)*s[g].fc,s[g].fc=e),n--)}Da(b,q)},Ea=function(a,b){var c,m=-1,g,q=a[0].dl,s=0,d=7,n=4;0===q&&(d=138,n=3);a[b+1].dl=65535;for(c=0;c<=b;c++)g=q,q=a[c+1].dl,++s=s?W[17].fc++:W[18].fc++,s=0,m=g,0===q?(d=138,n=3):g===q?(d=6,n=3):(d=7,n=4))},Fa=function(){8c?ca[c]:ca[256+(c>>7)])&255,fa(d,b),n=ja[d],0!==n&&(c-=Y[d],ba(c,n))),s>>=1;while(m=s?(fa(17,W),ba(s-3,3)):(fa(18,W),ba(s-11,7));s=0;m=g;0===q?(d=138,n=3):g===q?(d=6,n=3):(d=7,n=4)}},Ia=function(){var a;for(a=0;286>a;a++)K[a].fc=0;for(a=0;30>a;a++)H[a].fc=0;for(a=0;19>a;a++)W[a].fc=0;K[256].fc=1;ga=aa=la=sa=ea=ha=0;ia=1},ra=function(a){var b,m,g,q;q=y-x;da[sa]=ga;xa(L);xa(I);Ea(K,L.max_code);Ea(H,I.max_code);xa(M);for(g=18;3<=g&&0=== -W[ya[g]].dl;g--);ea+=3*(g+1)+14;b=ea+3+7>>3;m=ha+3+7>>3;m<=b&&(b=m);if(q+4<=b&&0<=x)for(ba(0+a,3),Fa(),pa(q),pa(~q),g=0;gb.len&&(d=b.len);for(t=0;tn-q&&(d=n-q);for(t=0;tu;u++)for($[u]=h,f=0;f<1<u;u++)for(Y[u]=h,f=0;f<1<>=7;30>u;u++)for(Y[u]=h<<7,f=0;f<1<=f;f++)S[f]=0;for(f=0;143>=f;)U[f++].dl=8,S[8]++;for(;255>=f;)U[f++].dl=9,S[9]++;for(;279>=f;)U[f++].dl=7,S[7]++;for(;287>=f;)U[f++].dl=8,S[8]++;Da(U,287);for(f=0;30>f;f++)Z[f].dl=5,Z[f].fc=Ca(f,5);Ia()}for(f=0;8192>f;f++)s[32768+f]=0;X=na[Q].max_lazy;F=na[Q].good_length;G=na[Q].max_chain;x=y=0;D=Aa(c,0, -65536);if(0>=D)C=!0,D=0;else{for(C=!1;262>D&&!C;)va();for(f=v=0;2>f;f++)v=(v<<5^c[f]&255)&8191}b=null;q=n=0;3>=Q?(O=2,E=0):(E=2,B=0);g=!1}d=!0;if(0===D)return g=!0,0}if((f=Ja(a,t,e))===e)return e;if(g)return f;if(3>=Q)for(;0!==D&&null===b;){qa();0!==w&&32506>=y-w&&(E=Ba(w),E>D&&(E=D));if(3<=E)if(u=ka(y-J,E-3),D-=E,E<=X){E--;do y++,qa();while(0!==--E);y++}else y+=E,E=0,v=c[y]&255,v=(v<<5^c[y+1]&255)&8191;else u=ka(0,c[y]&255),D--,y++;u&&(ra(0),x=y);for(;262>D&&!C;)va()}else for(;0!==D&&null===b;){qa(); -O=E;P=J;E=2;0!==w&&(O=y-w)&&(E=Ba(w),E>D&&(E=D),3===E&&4096D&&!C;)va()}0===D&&(0!==B&&ka(0,c[y-1]&255),ra(1),g=!0);return f+Ja(a,f+t,e-f)};this.deflate=function(m,g){var q,n;ma=m;ta=0;"undefined"===String(typeof g)&&(g=6);(q=g)?1>q?q=1:9q;q++)K[q]=new e;H=[];H.length=61;for(q=0;61>q;q++)H[q]=new e;U=[];U.length=288;for(q=0;288>q;q++)U[q]=new e;Z=[];Z.length=30;for(q=0;30>q;q++)Z[q]=new e;W=[];W.length=39;for(q=0;39>q;q++)W[q]=new e;L=new k;I=new k;M=new k;S=[];S.length=16;T=[];T.length=573;V=[];V.length=573;z=[];z.length=256;ca=[];ca.length=512;$=[];$.length=29;Y=[];Y.length=30;da=[];da.length=1024}for(var l=Array(1024),p=[];0<(q=La(l,0,l.length));){var G= -[];G.length=q;for(n=0;n>8&255])};this.appendUInt32LE=function(e){k.appendArray([e&255,e>>8&255,e>>16&255,e>>24&255])};this.appendString=function(k){l=runtime.concatByteArrays(l, -runtime.byteArrayFromString(k,e))};this.getLength=function(){return l.length};this.getByteArray=function(){return l}}; -// Input 6 -core.RawInflate=function(){var e,k,l=null,p,r,h,b,f,d,a,n,q,g,c,u,t,s,m=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],A=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],v=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[16,17,18, -0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=function(){this.list=this.next=null},E=function(){this.n=this.b=this.e=0;this.t=null},O=function(a,b,c,m,g,q){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var s=Array(this.BMAX+1),d,n,t,e,f,u,h,k=Array(this.BMAX+1),l,p,r,G=new E,A=Array(this.BMAX);e=Array(this.N_MAX);var v,x=Array(this.BMAX+1),C,w,X;X=this.root=null;for(f=0;ff&&(q=f);for(C=1<(C-=s[u])){this.status=2;this.m=q;return}if(0>(C-=s[f]))this.status=2,this.m=q;else{s[f]+=C;x[1]=u=0;l=s;p=1;for(r=2;0<--f;)x[r++]=u+=l[p++];l=a;f=p=0;do 0!=(u=l[p++])&&(e[x[u]++]=f);while(++fv+k[1+e];){v+=k[1+e];e++;w=(w=t-v)>q?q:w;if((n=1<<(u=h-v))>a+1)for(n-=a+1,r=h;++ud&&v>v-k[e],A[e-1][u].e=G.e,A[e-1][u].b=G.b,A[e-1][u].n=G.n,A[e-1][u].t=G.t)}G.b=h-v;p>=b?G.e=99:l[p]l[p]?16:15,G.n=l[p++]): -(G.e=g[l[p]-c],G.n=m[l[p++]-c]);n=1<>v;u>=1)f^=u;for(f^=u;(f&(1<>=a;b-=a},D=function(b,m,s){var d,t,h;if(0==s)return 0;for(h=0;;){y(c);t=q.list[J(c)];for(d=t.e;16 -d;d++)k[P[d]]=0;c=7;d=new O(k,19,19,null,null,c);if(0!=d.status)return-1;q=d.root;c=d.m;t=e+h;for(s=n=0;sd)k[s++]=n=d;else if(16==d){y(2);d=3+J(2);C(2);if(s+d>t)return-1;for(;0t)return-1;for(;0I;I++)L[I]=8;for(;256>I;I++)L[I]=9;for(;280>I;I++)L[I]=7;for(;288>I;I++)L[I]=8;r=7;I=new O(L,288,257,A,x,r);if(0!=I.status){alert("HufBuild error: "+I.status);B=-1;break b}l=I.root;r=I.m;for(I=0;30>I;I++)L[I]=5;G=5;I=new O(L,30,0,v,w,G);if(1 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -core.LoopWatchDog=function(e,k){var l=Date.now(),p=0;this.check=function(){var r;if(e&&(r=Date.now(),r-l>e))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; -// Input 8 -core.Cursor=function(e,k){function l(b){b.parentNode&&(a.push({prev:b.previousSibling,next:b.nextSibling}),b.parentNode.removeChild(b))}function p(a,b){a.nodeType===Node.TEXT_NODE&&(0===a.length?a.parentNode.removeChild(a):b.nodeType===Node.TEXT_NODE&&(b.insertData(0,a.data),a.parentNode.removeChild(a)))}function r(){a.forEach(function(a){a.prev&&a.prev.nextSibling&&p(a.prev,a.prev.nextSibling);a.next&&a.next.previousSibling&&p(a.next.previousSibling,a.next)});a.length=0}function h(b,c,q){if(c.nodeType=== -Node.TEXT_NODE){runtime.assert(Boolean(c),"putCursorIntoTextNode: invalid container");var d=c.parentNode;runtime.assert(Boolean(d),"putCursorIntoTextNode: container without parent");runtime.assert(0<=q&&q<=c.length,"putCursorIntoTextNode: offset is out of bounds");0===q?d.insertBefore(b,c):(q!==c.length&&c.splitText(q),d.insertBefore(b,c.nextSibling))}else if(c.nodeType===Node.ELEMENT_NODE){runtime.assert(Boolean(c),"putCursorIntoContainer: invalid container");for(d=c.firstChild;null!==d&&0 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -core.EventNotifier=function(e){var k={};this.emit=function(e,p){var r,h;runtime.assert(k.hasOwnProperty(e),'unknown event fired "'+e+'"');h=k[e];for(r=0;r1/g?"-0":String(g),e(a+" should be "+b+". Was "+n+".")):e(a+" should be "+b+" (of type "+typeof b+"). Was "+g+" (of type "+typeof g+").")}var b=0,f;f=function(b,a){var n=Object.keys(b),q=Object.keys(a);n.sort();q.sort();return k(n,q)&&Object.keys(b).every(function(g){var c= -b[g],q=a[g];return r(c,q)?!0:(e(c+" should be "+q+" for key "+g),!1)})};this.areNodesEqual=p;this.shouldBeNull=function(b,a){h(b,a,"null")};this.shouldBeNonNull=function(b,a){var n,q;try{q=eval(a)}catch(g){n=g}n?e(a+" should be non-null. Threw exception "+n):null!==q?runtime.log("pass",a+" is non-null."):e(a+" should be non-null. Was "+q)};this.shouldBe=h;this.countFailedTests=function(){return b}}; -core.UnitTester=function(){function e(e,k){return""+e+""}var k=0,l={};this.runTests=function(p,r,h){function b(c){if(0===c.length)l[f]=n,k+=d.countFailedTests(),r();else{g=c[0];var m=Runtime.getFunctionName(g);runtime.log("Running "+m);u=d.countFailedTests();a.setUp();g(function(){a.tearDown();n[m]=u===d.countFailedTests();b(c.slice(1))})}}var f=Runtime.getFunctionName(p),d=new core.UnitTestRunner,a=new p(d),n={},q,g,c,u,t="BrowserRuntime"=== -runtime.type();if(l.hasOwnProperty(f))runtime.log("Test "+f+" has already run.");else{t?runtime.log("Running "+e(f,'runSuite("'+f+'");')+": "+a.description()+""):runtime.log("Running "+f+": "+a.description);c=a.tests();for(q=0;qRunning "+e(p,'runTest("'+f+'","'+p+'")')+""):runtime.log("Running "+p),u=d.countFailedTests(),a.setUp(),g(),a.tearDown(),n[p]=u===d.countFailedTests()); -b(a.asyncTests())}};this.countFailedTests=function(){return k};this.results=function(){return l}}; -// Input 11 -core.PositionIterator=function(e,k,l,p){function r(){this.acceptNode=function(a){return a.nodeType===Node.TEXT_NODE&&0===a.length?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function h(a){this.acceptNode=function(b){return b.nodeType===Node.TEXT_NODE&&0===b.length?NodeFilter.FILTER_REJECT:a.acceptNode(b)}}function b(){var b=d.currentNode.nodeType;a=b===Node.TEXT_NODE?d.currentNode.length-1:b===Node.ELEMENT_NODE?1:0}var f=this,d,a,n;this.nextPosition=function(){if(d.currentNode===e)return!1; -0===a&&d.currentNode.nodeType===Node.ELEMENT_NODE?null===d.firstChild()&&(a=1):d.currentNode.nodeType===Node.TEXT_NODE&&a+1 "+b.length),runtime.assert(0<=g,"Error in setPosition: "+g+" < 0"),g===b.length&&(a=void 0,d.nextSibling()?a=0:d.parentNode()&&(a=1),runtime.assert(void 0!==a,"Error in setPosition: position not valid.")),!0;c=n(b);g>>8^s;return c^-1}function p(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function r(a){var b=a.getFullYear();return 1980>b?0:b-1980<< -25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function h(a,b){var c,m,g,d,q,n,f,e=this;this.load=function(b){if(void 0!==e.data)b(null,e.data);else{var c=q+34+m+g+256;c+f>u&&(c=u-f);runtime.read(a,f,c,function(c,m){if(c||null===m)b(c,m);else a:{var g=m,f=new core.ByteArray(g),t=f.readUInt32LE(),u;if(67324752!==t)b("File entry signature is wrong."+t.toString()+" "+g.length.toString(),null);else{f.pos+=22;t=f.readUInt16LE();u=f.readUInt16LE();f.pos+=t+u; -if(d){g=g.slice(f.pos,f.pos+q);if(q!==g.length){b("The amount of compressed bytes read was "+g.length.toString()+" instead of "+q.toString()+" for "+e.filename+" in "+a+".",null);break a}g=s(g,n)}else g=g.slice(f.pos,f.pos+n);n!==g.length?b("The amount of bytes read was "+g.length.toString()+" instead of "+n.toString()+" for "+e.filename+" in "+a+".",null):(e.data=g,b(null,g))}}})}};this.set=function(a,b,c,m){e.filename=a;e.data=b;e.compressed=c;e.date=m};this.error=null;b&&(c=b.readUInt32LE(),33639248!== -c?this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,d=b.readUInt16LE(),this.date=p(b.readUInt32LE()),b.readUInt32LE(),q=b.readUInt32LE(),n=b.readUInt32LE(),m=b.readUInt16LE(),g=b.readUInt16LE(),c=b.readUInt16LE(),b.pos+=8,f=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+m),"utf8"),b.pos+=m+g+c))}function b(a,b){if(22!==a.length)b("Central directory length should be 22.", -m);else{var g=new core.ByteArray(a),s;s=g.readUInt32LE();101010256!==s?b("Central directory signature is wrong: "+s.toString(),m):(s=g.readUInt16LE(),0!==s?b("Zip files with non-zero disk numbers are not supported.",m):(s=g.readUInt16LE(),0!==s?b("Zip files with non-zero disk numbers are not supported.",m):(s=g.readUInt16LE(),t=g.readUInt16LE(),s!==t?b("Number of entries is inconsistent.",m):(s=g.readUInt32LE(),g=g.readUInt16LE(),g=u-22-s,runtime.read(e,g,u-g,function(a,g){if(a||null===g)b(a,m);else a:{var s= -new core.ByteArray(g),d,f;c=[];for(d=0;du?k("File '"+e+"' cannot be read.",m):runtime.read(e,u-22,22,function(a,c){a||null===k||null===c?k(a,m):b(c,k)})})}; -// Input 15 -core.CSSUnits=function(){var e={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(k,l,p){return k*e[p]/e[l]};this.convertMeasure=function(e,l){var p,r;e&&l?(p=parseFloat(e),r=e.replace(p.toString(),""),p=this.convert(p,r,l)):p="";return p.toString()};this.getUnits=function(e){return e.substr(e.length-2,e.length)}}; -// Input 16 -xmldom.LSSerializerFilter=function(){}; -// Input 17 -"function"!==typeof Object.create&&(Object.create=function(e){var k=function(){};k.prototype=e;return new k}); -xmldom.LSSerializer=function(){function e(e){var h=e||{},b=function(a){var b={},g;for(g in a)a.hasOwnProperty(g)&&(b[a[g]]=g);return b}(e),f=[h],d=[b],a=0;this.push=function(){a+=1;h=f[a]=Object.create(h);b=d[a]=Object.create(b)};this.pop=function(){f[a]=void 0;d[a]=void 0;a-=1;h=f[a];b=d[a]};this.getLocalNamespaceDefinitions=function(){return b};this.getQName=function(a){var d=a.namespaceURI,g=0,c;if(!d)return a.localName;if(c=b[d])return c+":"+a.localName;do{c||!a.prefix?(c="ns"+g,g+=1):c=a.prefix; -if(h[c]===d)break;if(!h[c]){h[c]=d;b[d]=c;break}c=null}while(null===c);return c+":"+a.localName}}function k(e){return e.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function l(e,h){var b="",f=p.filter?p.filter.acceptNode(h):NodeFilter.FILTER_ACCEPT,d;if(f===NodeFilter.FILTER_ACCEPT&&h.nodeType===Node.ELEMENT_NODE){e.push();d=e.getQName(h);var a,n=h.attributes,q,g,c,u="",t;a="<"+d;q=n.length;for(g=0;g")}if(f===NodeFilter.FILTER_ACCEPT||f===NodeFilter.FILTER_SKIP){for(f=h.firstChild;f;)b+=l(e,f),f=f.nextSibling;h.nodeValue&&(b+=k(h.nodeValue))}d&&(b+="",e.pop());return b}var p=this;this.filter=null;this.writeToString=function(k,h){if(!k)return"";var b=new e(h);return l(b,k)}}; -// Input 18 -xmldom.RelaxNGParser=function(){function e(a,b){this.message=function(){b&&(a+=1===b.nodeType?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");return a}}function k(a){if(2>=a.e.length)return a;var b={name:a.name,e:a.e.slice(0,2)};return k({name:a.name,e:[b].concat(a.e.slice(2))})}function l(a){a=a.split(":",2);var b="",d;1===a.length?a=["",a[0]]:b=a[0];for(d in f)f[d]===b&&(a[0]=d);return a}function p(a,b){for(var d=0,g,c,f=a.name;a.e&&d=m.length)return c;0===g&&(g=0);for(var s=m.item(g);s.namespaceURI===a;){g+=1;if(g>=m.length)return c;s=m.item(g)}return s=f(b,c.attDeriv(b,m.item(g)),m,g+1)}function d(b,a,c){c.e[0].a?(b.push(c.e[0].text),a.push(c.e[0].a.ns)):d(b,a,c.e[0]);c.e[1].a?(b.push(c.e[1].text),a.push(c.e[1].a.ns)): -d(b,a,c.e[1])}var a="http://www.w3.org/2000/xmlns/",n,q,g,c,u,t,s,m,A,x,v={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return v}},w={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return v},startTagOpenDeriv:function(){return v},attDeriv:function(b,a){return v},startTagCloseDeriv:function(){return w},endTagDeriv:function(){return v}}, -P={type:"text",nullable:!0,hash:"text",textDeriv:function(){return P},startTagOpenDeriv:function(){return v},attDeriv:function(){return v},startTagCloseDeriv:function(){return P},endTagDeriv:function(){return v}},B,E,O;n=p("choice",function(b,a){if(b===v)return a;if(a===v||b===a)return b},function(b,a){var c={},m;r(c,{p1:b,p2:a});a=b=void 0;for(m in c)c.hasOwnProperty(m)&&(void 0===b?b=c[m]:a=void 0===a?c[m]:n(a,c[m]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, -textDeriv:function(c,m){return n(a.textDeriv(c,m),b.textDeriv(c,m))},startTagOpenDeriv:l(function(c){return n(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,m){return n(a.attDeriv(c,m),b.attDeriv(c,m))},startTagCloseDeriv:e(function(){return n(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:e(function(){return n(a.endTagDeriv(),b.endTagDeriv())})}}(b,a)});q=function(a,b,c){return function(){var m={},g=0;return function(s,d){var e=b&&b(s,d),f,t;if(void 0!==e)return e; -e=s.hash||s.toString();f=d.hash||d.toString();eNode.ELEMENT_NODE;){if(a!==Node.COMMENT_NODE&&(a!==Node.TEXT_NODE||!/^\s+$/.test(f.currentNode.nodeValue)))return[new e("Not allowed node of type "+ -a+".")];a=(d=f.nextSibling())?d.nodeType:0}if(!d)return[new e("Missing element "+b.names)];if(b.names&&-1===b.names.indexOf(h[d.namespaceURI]+":"+d.localName))return[new e("Found "+d.nodeName+" instead of "+b.names+".",d)];if(f.firstChild()){for(n=k(b.e[1],f,d);f.nextSibling();)if(a=f.currentNode.nodeType,!(f.currentNode&&f.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(f.currentNode.nodeValue)||a===Node.COMMENT_NODE))return[new e("Spurious content.",f.currentNode)];if(f.parentNode()!==d)return[new e("Implementation error.")]}else n= -k(b.e[1],f,d);f.nextSibling();return n}var p,r,h;r=function(b,f,d,a){var n=b.name,q=null;if("text"===n)a:{for(var g=(b=f.currentNode)?b.nodeType:0;b!==d&&3!==g;){if(1===g){q=[new e("Element not allowed here.",b)];break a}g=(b=f.nextSibling())?b.nodeType:0}f.nextSibling();q=null}else if("data"===n)q=null;else if("value"===n)a!==b.text&&(q=[new e("Wrong value, should be '"+b.text+"', not '"+a+"'",d)]);else if("list"===n)q=null;else if("attribute"===n)a:{if(2!==b.e.length)throw"Attribute with wrong # of elements: "+ -b.e.length;n=b.localnames.length;for(q=0;q=s&&c.push(k(a.substring(b,d)))):"["===a[d]&&(0>=s&&(b=d+1),s+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};a=function(a,g,c){var d,e,s,m;for(d=0;d - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -odf.Namespaces=function(){function e(e){return k[e]||null}var k={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0", -xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},l;e.lookupNamespaceURI=e;l=function(){};l.forEachPrefix=function(e){for(var l in k)k.hasOwnProperty(l)&&e(l,k[l])};l.resolvePrefix=e;l.namespaceMap=k;l.drawns="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";l.fons="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0";l.officens="urn:oasis:names:tc:opendocument:xmlns:office:1.0";l.presentationns="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0";l.stylens= -"urn:oasis:names:tc:opendocument:xmlns:style:1.0";l.svgns="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";l.tablens="urn:oasis:names:tc:opendocument:xmlns:table:1.0";l.textns="urn:oasis:names:tc:opendocument:xmlns:text:1.0";l.xlinkns="http://www.w3.org/1999/xlink";l.xmlns="http://www.w3.org/XML/1998/namespace";return l}(); -// Input 25 -runtime.loadClass("xmldom.XPath"); -odf.StyleInfo=function(){function e(a,b){for(var c=g[a.localName],m=c&&c[a.namespaceURI],d=m?m.length:0,f,c=0;c - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -odf.OdfUtils=function(){function e(a){var b=a&&a.localName;return("p"===b||"h"===b)&&a.namespaceURI===u}function k(a){return/^[ \t\r\n]+$/.test(a)}function l(a){var b=a&&a.localName;return("span"===b||"p"===b||"h"===b)&&a.namespaceURI===u}function p(a){var b=a&&a.localName,c,d=!1;b&&(c=a.namespaceURI,c===u?d="s"===b||"tab"===b||"line-break"===b:c===t&&(d="frame"===b&&"as-char"===a.getAttributeNS(u,"anchor-type")));return d}function r(a){for(;null!==a.firstChild&&l(a);)a=a.firstChild;return a}function h(a){for(;null!== -a.lastChild&&l(a);)a=a.lastChild;return a}function b(a){for(;!e(a)&&null===a.previousSibling;)a=a.parentNode;return e(a)?null:h(a.previousSibling)}function f(a){for(;!e(a)&&null===a.nextSibling;)a=a.parentNode;return e(a)?null:r(a.nextSibling)}function d(a){for(var c=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=b(a);else return!k(a.data.substr(a.length-1,1));else if(p(a)){c=!0;break}else a=b(a);return c}function a(a){var c=!1;for(a=a&&h(a);a;){if(a.nodeType===Node.TEXT_NODE&&0=b.value||"%"===b.unit)?null:b;return b||c(a)};this.parseFoLineHeight=function(a){var b;b=(b=g(a))&&(0>b.value||"%"=== -b.unit)?null:b;return b||c(a)};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument,d=c.createRange(),g=[],e;e=c.createTreeWalker(a.commonAncestorContainer.nodeType===Node.TEXT_NODE?a.commonAncestorContainer.parentNode:a.commonAncestorContainer,NodeFilter.SHOW_ALL,function(c){d.selectNodeContents(c);if(!1===b&&c.nodeType===Node.TEXT_NODE){if(0>=a.compareBoundaryPoints(a.START_TO_START,d)&&0<=a.compareBoundaryPoints(a.END_TO_END,d))return NodeFilter.FILTER_ACCEPT}else if(-1===a.compareBoundaryPoints(a.END_TO_START, -d)&&1===a.compareBoundaryPoints(a.START_TO_END,d))return c.nodeType===Node.TEXT_NODE?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT},!1);e.currentNode=a.startContainer.previousSibling||a.startContainer.parentNode;for(c=e.nextNode();c;)g.push(c),c=e.nextNode();d.detach();return g}}; -// Input 27 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils"); -odf.TextStyleApplicator=function(e,k){function l(a){function b(a,c){return"object"===typeof a&&"object"===typeof c?Object.keys(a).every(function(d){return b(a[d],c[d])}):a===c}this.isStyleApplied=function(d){d=e.getAppliedStylesForElement(d);return b(a,d)}}function p(a){var b={};this.applyStyleToContainer=function(d){var f;f=d.getAttributeNS(n,"style-name");var m=d.ownerDocument;f=f||"";if(!b.hasOwnProperty(f)){var h=f,l=f,p;l?(p=e.getStyleElement(l,"text"),p.parentNode===k?m=p.cloneNode(!0):(m=m.createElementNS(q, -"style:style"),m.setAttributeNS(q,"style:parent-style-name",l),m.setAttributeNS(q,"style:family","text"),m.setAttributeNS(g,"scope","document-content"))):(m=m.createElementNS(q,"style:style"),m.setAttributeNS(q,"style:family","text"),m.setAttributeNS(g,"scope","document-content"));e.updateStyle(m,a,!0);k.appendChild(m);b[h]=m}f=b[f].getAttributeNS(q,"name");d.setAttributeNS(n,"text:style-name",f)}}function r(a,b){var d=b.ownerDocument.createRange(),g=b.nodeType===Node.TEXT_NODE?b.length:b.childNodes.length; -d.setStart(a.startContainer,a.startOffset);d.setEnd(a.endContainer,a.endOffset);g=0===d.comparePoint(b,0)&&0===d.comparePoint(b,g);d.detach();return g}function h(a){var b;0!==a.endOffset&&(a.endContainer.nodeType===Node.TEXT_NODE&&a.endOffset!==a.endContainer.length)&&(d.push(a.endContainer.splitText(a.endOffset)),d.push(a.endContainer));0!==a.startOffset&&(a.startContainer.nodeType===Node.TEXT_NODE&&a.startOffset!==a.startContainer.length)&&(b=a.startContainer.splitText(a.startOffset),d.push(a.startContainer), -d.push(b),a.setStart(b,0))}function b(a,b){if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a.parentNode.removeChild(a);else if(b.nodeType===Node.TEXT_NODE)return b.insertData(0,a.data),a.parentNode.removeChild(a),b;return a}function f(a){a.nextSibling&&(a=b(a,a.nextSibling));a.previousSibling&&b(a.previousSibling,a)}var d,a=new odf.OdfUtils,n=odf.Namespaces.textns,q=odf.Namespaces.stylens,g="urn:webodf:names:scope";this.applyStyle=function(b,g){var e,s,m,q,k;e={};var v;runtime.assert(Boolean(g["style:text-properties"]), -"applyStyle without any text properties");e["style:text-properties"]=g["style:text-properties"];q=new p(e);k=new l(e);d=[];h(b);e=a.getTextNodes(b,!1);v={startContainer:b.startContainer,startOffset:b.startOffset,endContainer:b.endContainer,endOffset:b.endOffset};e.forEach(function(b){s=k.isStyleApplied(b);if(!1===s){var c=b.ownerDocument,d=b.parentNode,g,e=b,f=new core.LoopWatchDog(1E3);a.isParagraph(d)?(c=c.createElementNS(n,"text:span"),d.insertBefore(c,b),g=!1):(b.previousSibling&&!r(v,b.previousSibling)? -(c=d.cloneNode(!1),d.parentNode.insertBefore(c,d.nextSibling)):c=d,g=!0);for(;e&&(e===b||r(v,e));)f.check(),d=e.nextSibling,e.parentNode!==c&&c.appendChild(e),e=d;if(e&&g)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);e;)f.check(),d=e.nextSibling,b.appendChild(e),e=d;m=c;q.applyStyleToContainer(m)}});d.forEach(f);d=null}}; -// Input 28 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfUtils");runtime.loadClass("xmldom.XPath");runtime.loadClass("core.CSSUnits"); -odf.Style2CSS=function(){function e(a){var b={},c,d;if(!a)return b;for(a=a.firstChild;a;){if(d=a.namespaceURI!==u||"style"!==a.localName&&"default-style"!==a.localName?a.namespaceURI===s&&"list-style"===a.localName?"list":a.namespaceURI!==u||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(u,"family"))(c=a.getAttributeNS&&a.getAttributeNS(u,"name"))||(c=""),d=b[d]=b[d]||{},d[c]=a;a=a.nextSibling}return b}function k(a,b){if(!b||!a)return null;if(a[b])return a[b]; -var c,d;for(c in a)if(a.hasOwnProperty(c)&&(d=k(a[c].derivedStyles,b)))return d;return null}function l(a,b,c){var d=b[a],g,e;d&&(g=d.getAttributeNS(u,"parent-style-name"),e=null,g&&(e=k(c,g),!e&&b[g]&&(l(g,b,c),e=b[g],b[g]=null)),e?(e.derivedStyles||(e.derivedStyles={}),e.derivedStyles[a]=d):c[a]=d)}function p(a,b){for(var c in a)a.hasOwnProperty(c)&&(l(c,a,b),a[c]=null)}function r(a,b){var c=x[a],d;if(null===c)return null;d=b?"["+c+'|style-name="'+b+'"]':"["+c+"|style-name]";"presentation"===c&& -(c="draw",d=b?'[presentation|style-name="'+b+'"]':"[presentation|style-name]");return c+"|"+v[a].join(d+","+c+"|")+d}function h(a,b,c){var d=[],g,e;d.push(r(a,b));for(g in c.derivedStyles)if(c.derivedStyles.hasOwnProperty(g))for(e in b=h(a,g,c.derivedStyles[g]),b)b.hasOwnProperty(e)&&d.push(b[e]);return d}function b(a,b,c){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===b&&a.localName===c)return b=a;a=a.nextSibling}return null}function f(a,b){var c="",d,g;for(d in b)b.hasOwnProperty(d)&& -(d=b[d],g=a.getAttributeNS(d[0],d[1]),d[2]&&g&&(c+=d[2]+":"+g+";"));return c}function d(a){return(a=b(a,u,"text-properties"))?Q.parseFoFontSize(a.getAttributeNS(c,"font-size")):null}function a(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d});return(a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null}function n(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var g=c.getAttributeNS(s,"level"), -e;c=Q.getFirstNonWhitespaceChild(c);c=Q.getFirstNonWhitespaceChild(c);var m;c&&(e=c.attributes,m=e["fo:text-indent"]?e["fo:text-indent"].value:void 0,e=e["fo:margin-left"]?e["fo:margin-left"].value:void 0);m||(m="-0.6cm");c="-"===m.charAt(0)?m.substring(1):"-"+m;for(g=g&&parseInt(g,10);1 text|list-item > text|list",g-=1;g=b+" > text|list-item > *:not(text|list):first-child";void 0!==e&&(e=g+"{margin-left:"+e+";}",a.insertRule(e,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+ -d+";";d+="counter-increment:list;";d+="margin-left:"+m+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(f){throw f;}}function q(e,k,t,l){if("list"===k)for(var p=l.firstChild,r,v;p;){if(p.namespaceURI===s)if(r=p,"list-level-style-number"===p.localName){var N=r;v=N.getAttributeNS(u,"num-format");var x=N.getAttributeNS(u,"num-suffix"),z={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},N=N.getAttributeNS(u,"num-prefix")||"",N=z.hasOwnProperty(v)? -N+(" counter(list, "+z[v]+")"):v?N+("'"+v+"';"):N+" ''";x&&(N+=" '"+x+"'");v="content: "+N+";";n(e,t,r,v)}else"list-level-style-image"===p.localName?(v="content: none;",n(e,t,r,v)):"list-level-style-bullet"===p.localName&&(v="content: '"+r.getAttributeNS(s,"bullet-char")+"';",n(e,t,r,v));p=p.nextSibling}else if("page"===k)if(x=r=t="",p=l.getElementsByTagNameNS(u,"page-layout-properties")[0],r=p.parentNode.parentNode.parentNode.masterStyles,x="",t+=f(p,D),v=p.getElementsByTagNameNS(u,"background-image"), -0r?l.push(r):(c+=1,b=d[c],194<=r&&224>r?l.push((r&31)<<6|b&63):(c+=1,e=d[c],224<=r&&240>r?l.push((r&15)<<12|(b&63)<<6|e&63):(c+=1,n=d[c],240<=r&&245>r&&(r=(r&7)<<18|(b&63)<<12|(e&63)<<6|n&63,r-=65536,l.push((r>>10)+55296,(r&1023)+56320))))),1E3<=l.length&&(a+=String.fromCharCode.apply(null, +l),l.length=0);return a+String.fromCharCode.apply(null,l)}var c;"utf8"===k?c=d(f):("binary"!==k&&this.log("Unsupported encoding: "+k),c=a(f));return c};Runtime.getVariable=function(f){try{return eval(f)}catch(k){}};Runtime.toJson=function(f){return JSON.stringify(f)};Runtime.fromJson=function(f){return JSON.parse(f)};Runtime.getFunctionName=function(f){return void 0===f.name?(f=/function\s+(\w+)/.exec(f))&&f[1]:f.name}; +Runtime.assert=function(f,k){if(!f)throw this.log("alert","ASSERTION FAILED:\n"+k),Error(k);}; +function BrowserRuntime(f){function k(d){var a=d.length,b,e,n=0;for(b=0;be&&(n+=1,b+=1);return n}function a(d,a,b){var e=d.length,n,g;a=new Uint8Array(new ArrayBuffer(a));b?(a[0]=239,a[1]=187,a[2]=191,g=3):g=0;for(b=0;bn?(a[g]=n,g+=1):2048>n?(a[g]=192|n>>>6,a[g+1]=128|n&63,g+=2):55040>=n||57344<=n?(a[g]=224|n>>>12&15,a[g+1]=128|n>>>6&63,a[g+2]=128|n&63,g+=3):(b+=1,n=(n-55296<<10|d.charCodeAt(b)-56320)+65536, +a[g]=240|n>>>18&7,a[g+1]=128|n>>>12&63,a[g+2]=128|n>>>6&63,a[g+3]=128|n&63,g+=4);return a}function d(a){var d=a.length,b=new Uint8Array(new ArrayBuffer(d)),e;for(e=0;ee.status||0===e.status?b(null):b("Status "+String(e.status)+": "+e.responseText||e.statusText):b("File "+d+" is empty."))};n=a.buffer&&!e.sendAsBinary?a.buffer:m.byteArrayToString(a,"binary");try{e.sendAsBinary?e.sendAsBinary(n):e.send(n)}catch(g){m.log("HUH? "+g+" "+a),b(g.message)}};this.deleteFile=function(d,a){var b=new XMLHttpRequest;b.open("DELETE",d,!0);b.onreadystatechange=function(){4=== +b.readyState&&(200>b.status&&300<=b.status?a(b.responseText):a(null))};b.send(null)};this.loadXML=function(d,a){var b=new XMLHttpRequest;b.open("GET",d,!0);b.overrideMimeType&&b.overrideMimeType("text/xml");b.onreadystatechange=function(){4===b.readyState&&(0!==b.status||b.responseText?200===b.status||0===b.status?a(null,b.responseXML):a(b.responseText,null):a("File "+d+" is empty.",null))};try{b.send(null)}catch(e){a(e.message,null)}};this.log=c;this.enableAlerts=!0;this.assert=Runtime.assert;this.setTimeout= +function(d,a){return setTimeout(function(){d()},a)};this.clearTimeout=function(d){clearTimeout(d)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.currentDirectory=function(){return""};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(d){return(new DOMParser).parseFromString(d,"text/xml")};this.exit=function(d){c("Calling exit with code "+String(d)+", but exit() is not implemented.")}; +this.getWindow=function(){return window};this.requestAnimationFrame=function(d){var a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,b=0;if(a)a.bind(window),b=a(d);else return setTimeout(d,15);return b};this.cancelAnimationFrame=function(d){var a=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;a?(a.bind(window),a(d)):clearTimeout(d)}} +function NodeJSRuntime(){function f(d){var a=d.length,c,b=new Uint8Array(new ArrayBuffer(a));for(c=0;c").implementation} +function RhinoRuntime(){var f=this,k={},a=k.javax.xml.parsers.DocumentBuilderFactory.newInstance(),d,c,h="";a.setValidating(!1);a.setNamespaceAware(!0);a.setExpandEntityReferences(!1);a.setSchema(null);c=k.org.xml.sax.EntityResolver({resolveEntity:function(a,d){var c=new k.java.io.FileReader(d);return new k.org.xml.sax.InputSource(c)}});d=a.newDocumentBuilder();d.setEntityResolver(c);this.byteArrayFromString=function(a,d){var c,h=a.length,r=new Uint8Array(new ArrayBuffer(h));for(c=0;c>>18],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>12&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b& +63];e===a+1?(b=g[e]<<4,n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b&63],n+="=="):e===a&&(b=g[e]<<10|g[e+1]<<2,n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>12],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b>>>6&63],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[b&63],n+="=");return n}function a(b){b=b.replace(/[^A-Za-z0-9+\/]+/g, +"");var n=b.length,e=new Uint8Array(new ArrayBuffer(3*n)),a=b.length%4,d=0,c,J;for(c=0;c>16,e[d+1]=J>>8&255,e[d+2]=J&255,d+=3;n=3*n-[0,0,2,1][a];return e.subarray(0,n)}function d(b){var g,n,e=b.length,a=0,d=new Uint8Array(new ArrayBuffer(3*e));for(g=0;gn?d[a++]=n:(2048>n?d[a++]=192|n>>>6:(d[a++]=224|n>>>12&15,d[a++]=128|n>>>6&63),d[a++]=128|n&63);return d.subarray(0, +a)}function c(b){var g,n,e,a,d=b.length,c=new Uint8Array(new ArrayBuffer(d)),h=0;for(g=0;gn?c[h++]=n:(g+=1,e=b[g],224>n?c[h++]=(n&31)<<6|e&63:(g+=1,a=b[g],c[h++]=(n&15)<<12|(e&63)<<6|a&63));return c.subarray(0,h)}function h(b){return k(f(b))}function q(b){return String.fromCharCode.apply(String,a(b))}function p(b){return c(f(b))}function m(b){b=c(b);for(var g="",n=0;ng?c+=String.fromCharCode(g):(d+=1,e=b.charCodeAt(d)&255,224>g?c+=String.fromCharCode((g&31)<<6|e&63):(d+=1,a=b.charCodeAt(d)&255,c+=String.fromCharCode((g&15)<<12|(e&63)<<6|a&63)));return c}function r(b,g){function n(){var d=a+1E5;d>b.length&&(d=b.length);e+=l(b,a,d);a=d;d=a===b.length;g(e,d)&&!d&&runtime.setTimeout(n,0)}var e="",a=0;1E5>b.length?g(l(b,0,b.length),!0):("string"!==typeof b&&(b=b.slice()),n())}function b(b){return d(f(b))}function e(b){return String.fromCharCode.apply(String, +d(b))}function n(b){return String.fromCharCode.apply(String,d(f(b)))}var g=function(b){var g={},n,e;n=0;for(e=b.length;nc-d&&(c=Math.max(2*c,d+a),a=new Uint8Array(new ArrayBuffer(c)),a.set(h),h=a)}var a=this,d=0,c=1024,h=new Uint8Array(new ArrayBuffer(c));this.appendByteArrayWriter=function(d){a.appendByteArray(d.getByteArray())};this.appendByteArray=function(a){var c=a.length;k(c);h.set(a,d);d+=c};this.appendArray=function(a){var c=a.length;k(c);h.set(a,d);d+=c};this.appendUInt16LE=function(d){a.appendArray([d&255,d>>8&255])};this.appendUInt32LE=function(d){a.appendArray([d& +255,d>>8&255,d>>16&255,d>>24&255])};this.appendString=function(d){a.appendByteArray(runtime.byteArrayFromString(d,f))};this.getLength=function(){return d};this.getByteArray=function(){var a=new Uint8Array(new ArrayBuffer(d));a.set(h.subarray(0,d));return a}};core.CSSUnits=function(){var f=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(a,d,c){return a*k[c]/k[d]};this.convertMeasure=function(a,d){var c,h;a&&d&&(c=parseFloat(a),h=a.replace(c.toString(),""),c=f.convert(c,h,d));return c};this.getUnits=function(a){return a.substr(a.length-2,a.length)}};(function(){function f(){var d,c,h,f,p,k,l,r,b;void 0===a&&(c=(d=runtime.getWindow())&&d.document,k=c.documentElement,l=c.body,a={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},c&&(f=c.createElement("div"),f.style.position="absolute",f.style.left="-99999px",f.style.transform="scale(2)",f.style["-webkit-transform"]="scale(2)",p=c.createElement("div"),f.appendChild(p),l.appendChild(f),d=c.createRange(),d.selectNode(p),a.rangeBCRIgnoresElementBCR=0===d.getClientRects().length, +p.appendChild(c.createTextNode("Rect transform test")),c=p.getBoundingClientRect(),h=d.getBoundingClientRect(),a.unscaledRangeClientRects=2=b.compareBoundaryPoints(Range.START_TO_START,g)&&0<=b.compareBoundaryPoints(Range.END_TO_END,g)}function h(b,g){return 0>=b.compareBoundaryPoints(Range.END_TO_START,g)&&0<=b.compareBoundaryPoints(Range.START_TO_END,g)}function q(b,g){var e=null;b.nodeType===Node.TEXT_NODE&&(0===b.length?(b.parentNode.removeChild(b),g.nodeType===Node.TEXT_NODE&&(e=g)):(g.nodeType===Node.TEXT_NODE&&(b.appendData(g.data),g.parentNode.removeChild(g)),e=b));return e} +function p(b){for(var g=b.parentNode;b.firstChild;)g.insertBefore(b.firstChild,b);g.removeChild(b);return g}function m(b,g){for(var e=b.parentNode,a=b.firstChild,d;a;)d=a.nextSibling,m(a,g),a=d;e&&g(b)&&p(b);return e}function l(b,g){return b===g||Boolean(b.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function r(b,g){return f().unscaledRangeClientRects?b:b/g}function b(n,g,e){Object.keys(g).forEach(function(a){var d=a.split(":"),c=d[1],h=e(d[0]),d=g[a],f=typeof d;"object"===f?Object.keys(d).length&& +(a=h?n.getElementsByTagNameNS(h,c)[0]||n.ownerDocument.createElementNS(h,a):n.getElementsByTagName(c)[0]||n.ownerDocument.createElement(a),n.appendChild(a),b(a,d,e)):h&&(runtime.assert("number"===f||"string"===f,"attempting to map unsupported type '"+f+"' (key: "+a+")"),n.setAttributeNS(h,a,String(d)))})}var e=null;this.splitBoundaries=function(b){var g,e=[],c,h,f;if(b.startContainer.nodeType===Node.TEXT_NODE||b.endContainer.nodeType===Node.TEXT_NODE){c=b.endContainer;h=b.endContainer.nodeType!== +Node.TEXT_NODE?b.endOffset===b.endContainer.childNodes.length:!1;f=b.endOffset;g=b.endContainer;if(ff))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.NodeFilterChain=function(f){var k=NodeFilter.FILTER_REJECT,a=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(d){var c;for(c=0;c "+g.length),runtime.assert(0<=e,"Error in setPosition: "+e+" < 0"),e===g.length&&(r.nextSibling()?b=0:r.parentNode()?b=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):ea.windowBits&&(a.windowBits=-a.windowBits,0===a.windowBits&&(a.windowBits=-15));!(0<=a.windowBits&&16>a.windowBits)||g&&g.windowBits||(a.windowBits+=32);15a.windowBits&&0===(a.windowBits&15)&&(a.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks= +[];this.strm=new b;this.strm.avail_out=0;g=f.inflateInit2(this.strm,a.windowBits);if(g!==l.Z_OK)throw Error(r[g]);this.header=new e;f.inflateGetHeader(this.strm,this.header)};n.prototype.push=function(b,e){var a=this.strm,d=this.options.chunkSize,n,c,h,r,B;if(this.ended)return!1;c=e===~~e?e:!0===e?l.Z_FINISH:l.Z_NO_FLUSH;a.input="string"===typeof b?m.binstring2buf(b):b;a.next_in=0;a.avail_in=a.input.length;do{0===a.avail_out&&(a.output=new p.Buf8(d),a.next_out=0,a.avail_out=d);n=f.inflate(a,l.Z_NO_FLUSH); +if(n!==l.Z_STREAM_END&&n!==l.Z_OK)return this.onEnd(n),this.ended=!0,!1;if(a.next_out&&(0===a.avail_out||n===l.Z_STREAM_END||0===a.avail_in&&c===l.Z_FINISH))if("string"===this.options.to)h=m.utf8border(a.output,a.next_out),r=a.next_out-h,B=m.buf2string(a.output,h),a.next_out=r,a.avail_out=d-r,r&&p.arraySet(a.output,a.output,h,r,0),this.onData(B);else this.onData(p.shrinkBuf(a.output,a.next_out))}while((0a&&(b.subarray&&m||!b.subarray&&p))return String.fromCharCode.apply(null,f.shrinkBuf(b,a));for(var g="",d=0;da;a++)b[a]=252<=a?6:248<= +a?5:240<=a?4:224<=a?3:192<=a?2:1;b[254]=b[254]=1;c.string2buf=function(b){var a,g,d,c,h,r=b.length,p=0;for(c=0;cg?1:2048>g?2:65536>g?3:4;a=new f.Buf8(p);for(c=h=0;hg?a[h++]=g:(2048>g?a[h++]=192|g>>>6:(65536>g?a[h++]=224|g>>>12:(a[h++]= +240|g>>>18,a[h++]=128|g>>>12&63),a[h++]=128|g>>>6&63),a[h++]=128|g&63);return a};c.buf2binstring=function(b){return h(b,b.length)};c.binstring2buf=function(b){for(var a=new f.Buf8(b.length),g=0,d=a.length;gf)q[c++]=f;else if(r=b[f],4f?q[c++]=f:(f-=65536,q[c++]= +55296|f>>10&1023,q[c++]=56320|f&1023)}return h(q,c)};c.utf8border=function(a,d){var g;d=d||a.length;d>a.length&&(d=a.length);for(g=d-1;0<=g&&128===(a[g]&192);)g--;return 0>g||0===g?d:g+b[a[g]]>d?g:d}},{"./common":2}],4:[function(a,d,c){d.exports=function(a,d,c,f){var l=a&65535|0;a=a>>>16&65535|0;for(var r=0;0!==c;){r=2E3c;c++){a=c;for(var h=0;8>h;h++)a=a&1?3988292384^a>>>1:a>>>1;d[c]=a}return d}();d.exports=function(a,d,c,f){c=f+c;for(a^= +-1;f>>8^h[(a^d[f])&255];return a^-1}},{}],7:[function(a,d,c){d.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(a,d,c){d.exports=function(a,d){var c,f,l,r,b,e,n,g,u,t,y,v,s,x,w,B,I,C,F,J,N,K,H,z;c=a.state;f=a.next_in;H=a.input;l=f+(a.avail_in-5);r=a.next_out;z=a.output;b=r-(d-a.avail_out);e=r+(a.avail_out-257);n=c.dmax;g=c.wsize;u=c.whave;t=c.wnext;y=c.window;v=c.hold;s=c.bits; +x=c.lencode;w=c.distcode;B=(1<s&&(v+=H[f++]<>>24;v>>>=F;s-=F;F=C>>>16&255;if(0===F)z[r++]=C&65535;else if(F&16){J=C&65535;if(F&=15)s>>=F,s-=F;15>s&&(v+=H[f++]<>>24;v>>>=F;s-=F;F=C>>>16&255;if(F&16){C&=65535;F&=15;sn){a.msg="invalid distance too far back"; +c.mode=30;break a}v>>>=F;s-=F;F=r-b;if(C>F){F=C-F;if(F>u&&c.sane){a.msg="invalid distance too far back";c.mode=30;break a}N=0;K=y;if(0===t){if(N+=g-F,F>3;f-=J;s-=J<<3;a.next_in=f;a.next_out=r;a.avail_in=f>>24&255)+(b>>>8&65280)+((b&65280)<<8)+((b&255)<<24)}function q(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new b.Buf16(320);this.work= +new b.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function p(a){var g;if(!a||!a.state)return y;g=a.state;a.total_in=a.total_out=g.total=0;a.msg="";g.wrap&&(a.adler=g.wrap&1);g.mode=v;g.last=0;g.havedict=0;g.dmax=32768;g.head=null;g.hold=0;g.bits=0;g.lencode=g.lendyn=new b.Buf32(s);g.distcode=g.distdyn=new b.Buf32(x);g.sane=1;g.back=-1;return t}function m(b){var a;if(!b||!b.state)return y;a=b.state;a.wsize=0;a.whave=0;a.wnext=0;return p(b)}function l(b,a){var g,e;if(!b|| +!b.state)return y;e=b.state;0>a?(g=0,a=-a):(g=(a>>4)+1,48>a&&(a&=15));if(a&&(8>a||15s;){if(0===l)break a;l--;m+=r[H++]<>>8&255;c.check=n(c.check,X,2,0);s=m=0;c.mode=2;break}c.flags=0;c.head&&(c.head.done=!1);if(!(c.wrap&1)||(((m&255)<<8)+(m>>8))%31){a.msg="incorrect header check";c.mode=30;break}if(8!==(m&15)){a.msg="unknown compression method";c.mode=30;break}m>>>=4;s-=4;Q=(m&15)+8;if(0===c.wbits)c.wbits=Q;else if(Q>c.wbits){a.msg="invalid window size";c.mode=30;break}c.dmax=1<s;){if(0===l)break a;l--;m+=r[H++]<>8&1);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=3;case 3:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<>>8&255,X[2]=m>>>16&255,X[3]=m>>>24&255,c.check=n(c.check,X,4,0));s=m=0;c.mode=4;case 4:for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>8);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=5;case 5:if(c.flags&1024){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>>8&255,c.check=n(c.check,X,2,0));s=m=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(c.flags&1024&&(D=c.length,D>l&&(D=l),D&&(c.head&&(Q=c.head.extra_len-c.length,c.head.extra||(c.head.extra=Array(c.head.extra_len)),b.arraySet(c.head.extra, +r,H,D,Q)),c.flags&512&&(c.check=n(c.check,r,D,H)),l-=D,H+=D,c.length-=D),c.length))break a;c.length=0;c.mode=7;case 7:if(c.flags&2048){if(0===l)break a;D=0;do Q=r[H+D++],c.head&&Q&&65536>c.length&&(c.head.name+=String.fromCharCode(Q));while(Q&&Dc.length&&(c.head.comment+=String.fromCharCode(Q));while(Q&&D< +l);c.flags&512&&(c.check=n(c.check,r,D,H));l-=D;H+=D;if(Q)break a}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(c.flags&512){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>9&1,c.head.done=!0);a.adler=c.check=0;c.mode=12;break;case 10:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<>>=s&7;s-=s&7;c.mode=27;break}for(;3>s;){if(0===l)break a;l--;m+=r[H++]<>>=1;s-=1;switch(m&3){case 0:c.mode=14;break;case 1:D=c;if(w){Q=void 0;B=new b.Buf32(512);I=new b.Buf32(32);for(Q=0;144>Q;)D.lens[Q++]=8;for(;256>Q;)D.lens[Q++]=9;for(;280>Q;)D.lens[Q++]=7;for(;288>Q;)D.lens[Q++]=8;u(1,D.lens,0,288,B,0,D.work,{bits:9});for(Q=0;32>Q;)D.lens[Q++]=5;u(2,D.lens, +0,32,I,0,D.work,{bits:5});w=!1}D.lencode=B;D.lenbits=9;D.distcode=I;D.distbits=5;c.mode=20;if(6===d){m>>>=2;s-=2;break a}break;case 2:c.mode=17;break;case 3:a.msg="invalid block type",c.mode=30}m>>>=2;s-=2;break;case 14:m>>>=s&7;for(s-=s&7;32>s;){if(0===l)break a;l--;m+=r[H++]<>>16^65535)){a.msg="invalid stored block lengths";c.mode=30;break}c.length=m&65535;s=m=0;c.mode=15;if(6===d)break a;case 15:c.mode=16;case 16:if(D=c.length){D>l&&(D=l);D>p&&(D=p);if(0===D)break a;b.arraySet(K, +r,H,D,q);l-=D;H+=D;p-=D;q+=D;c.length-=D;break}c.mode=12;break;case 17:for(;14>s;){if(0===l)break a;l--;m+=r[H++]<>>=5;s-=5;c.ndist=(m&31)+1;m>>>=5;s-=5;c.ncode=(m&15)+4;m>>>=4;s-=4;if(286s;){if(0===l)break a;l--;m+=r[H++]<>>=3;s-=3}for(;19>c.have;)c.lens[R[c.have++]]=0;c.lencode=c.lendyn;c.lenbits=7; +D={bits:c.lenbits};E=u(0,c.lens,0,19,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid code lengths set";c.mode=30;break}c.have=0;c.mode=19;case 19:for(;c.have>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<ba)m>>>=A,s-=A,c.lens[c.have++]=ba;else{if(16===ba){for(D=A+2;s>>=A;s-=A;if(0===c.have){a.msg="invalid bit length repeat";c.mode=30;break}Q= +c.lens[c.have-1];D=3+(m&3);m>>>=2;s-=2}else if(17===ba){for(D=A+3;s>>=A;s-=A;Q=0;D=3+(m&7);m>>>=3;s-=3}else{for(D=A+7;s>>=A;s-=A;Q=0;D=11+(m&127);m>>>=7;s-=7}if(c.have+D>c.nlen+c.ndist){a.msg="invalid bit length repeat";c.mode=30;break}for(;D--;)c.lens[c.have++]=Q}}if(30===c.mode)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block";c.mode=30;break}c.lenbits=9;D={bits:c.lenbits};E=u(1,c.lens, +0,c.nlen,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid literal/lengths set";c.mode=30;break}c.distbits=6;c.distcode=c.distdyn;D={bits:c.distbits};E=u(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,D);c.distbits=D.bits;if(E){a.msg="invalid distances set";c.mode=30;break}c.mode=20;if(6===d)break a;case 20:c.mode=21;case 21:if(6<=l&&258<=p){a.next_out=q;a.avail_out=p;a.next_in=H;a.avail_in=l;c.hold=m;c.bits=s;g(a,P);q=a.next_out;K=a.output;p=a.avail_out;H=a.next_in;r=a.input;l=a.avail_in; +m=c.hold;s=c.bits;12===c.mode&&(c.back=-1);break}for(c.back=0;;){D=c.lencode[m&(1<>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;c.length=ba;if(0===V){c.mode=26;break}if(V&32){c.back=-1;c.mode=12;break}if(V&64){a.msg="invalid literal/length code"; +c.mode=30;break}c.extra=V&15;c.mode=22;case 22:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}c.was=c.length;c.mode=23;case 23:for(;;){D=c.distcode[m&(1<>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;if(V&64){a.msg="invalid distance code";c.mode=30;break}c.offset=ba;c.extra=V&15;c.mode=24;case 24:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back";c.mode=30;break}c.mode=25;case 25:if(0===p)break a;D=P-p;if(c.offset>D){D=c.offset-D;if(D>c.whave&&c.sane){a.msg="invalid distance too far back";c.mode=30;break}D> +c.wnext?(D-=c.wnext,Q=c.wsize-D):Q=c.wnext-D;D>c.length&&(D=c.length);$=c.window}else $=K,Q=q-c.offset,D=c.length;D>p&&(D=p);p-=D;c.length-=D;do K[q++]=$[Q++];while(--D);0===c.length&&(c.mode=21);break;case 26:if(0===p)break a;K[q++]=c.length;p--;c.mode=21;break;case 27:if(c.wrap){for(;32>s;){if(0===l)break a;l--;m|=r[H++]<s;){if(0===l)break a;l--;m+=r[H++]<c.mode&&(27>c.mode||4!==d))r=a.output,H=a.next_out,q=P-a.avail_out,p=a.state,null===p.window&&(p.wsize=1<=p.wsize?(b.arraySet(p.window,r,H-p.wsize,p.wsize,0),p.wnext=0,p.whave=p.wsize):(l=p.wsize-p.wnext,l>q&&(l=q),b.arraySet(p.window,r,H-q,l,p.wnext),(q-=l)?(b.arraySet(p.window,r,H-q,q,0),p.wnext=q,p.whave=p.wsize):(p.wnext+=l,p.wnext===p.wsize&&(p.wnext=0),p.whave=s;s++)U[s]=0;for(x=0;xB&&(I=B);if(0===B)return g[u++]=20971520,g[u++]=20971520,y.bits=1,0;for(w=1;w=s;s++)if(J<<=1,J-=U[s],0>J)return-1;if(0s;s++)C[s+1]=C[s]+U[s];for(x=0;xG?(Q=aa[P+t[x]],$=Z[T+t[x]]):(Q=96,$=0);J=1<>F)+H]=D<<24|Q<<16|$|0;while(0!==H);for(J=1<>=1;0!==J?(K&=J-1,K+=J):K=0;x++;if(0===--U[s]){if(s===B)break;s=b[c+t[x]]}if(s>I&&(K&d)!==z){0===F&&(F=I);v+=w;C=s-F;for(J=1<=J)break;C++;J<<=1}N+=1<";return runtime.parseXML(d)}; +core.UnitTest.createOdtDocument=function(f,k){return core.UnitTest.createXmlDocument("office:document",f,k)}; +core.UnitTestLogger=function(){var f=[],k=0,a=0,d="",c="";this.startTest=function(h,q){f=[];k=0;d=h;c=q;a=Date.now()};this.endTest=function(){var h=Date.now();return{description:c,suite:[d,c],success:0===k,log:f,time:h-a}};this.debug=function(a){f.push({category:"debug",message:a})};this.fail=function(a){k+=1;f.push({category:"fail",message:a})};this.pass=function(a){f.push({category:"pass",message:a})}}; +core.UnitTestRunner=function(f,k){function a(b){l+=1;e?k.debug(b):k.fail(b)}function d(b,c){var e;try{if(b.length!==c.length)return a("array of length "+b.length+" should be "+c.length+" long"),!1;for(e=0;e1/b)return"-0";if("object"===typeof b)try{return JSON.stringify(b)}catch(a){}return String(b)}function m(b,c,e,d){"string"===typeof c&&"string"===typeof e||k.debug("WARN: shouldBe() expects string arguments");var f,h;try{h=eval(c)}catch(m){f=m}b=eval(e);f?a(c+" should be "+b+". Threw exception "+f):q(h,b,d)?k.pass(c+" is "+e):String(typeof h)===String(typeof b)? +a(c+" should be "+p(b)+". Was "+p(h)+"."):a(c+" should be "+b+" (of type "+typeof b+"). Was "+h+" (of type "+typeof h+").")}var l=0,r,b,e=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){r=l;e=!0};this.endExpectFail=function(){var b=r===l;e=!1;l=r;b&&(l+=1,k.fail("Expected at least one failed test, but none registered."))};b=function(b,c){var e=Object.keys(b),f=Object.keys(c);e.sort();f.sort();return d(e,f)&&Object.keys(b).every(function(e){var d=b[e],f=c[e];return q(d, +f)?!0:(a(d+" should be "+f+" for key "+e),!1)})};this.areNodesEqual=h;this.shouldBeNull=function(b,a){m(b,a,"null")};this.shouldBeNonNull=function(b,c){var e,d;try{d=eval(c)}catch(f){e=f}e?a(c+" should be non-null. Threw exception "+e):null!==d?k.pass(c+" is non-null."):a(c+" should be non-null. Was "+d)};this.shouldBe=m;this.testFailed=a;this.countFailedTests=function(){return l};this.name=function(b){var a,c,e=[],d=b.length;e.length=d;for(a=0;a"+a+""}function k(c){a.reporter&&a.reporter(c)}var a=this,d=0,c=new core.UnitTestLogger,h={},q="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(a){var c,d;q?runtime.log("Running "+f(a.description,'runTest("'+a.suite[0]+'","'+a.description+'")')+""):runtime.log("Running "+a.description);if(!a.success)for(c=0;cRunning "+f(b,'runSuite("'+b+'");')+": "+n.description()+""):runtime.log("Running "+b+": "+n.description);y=n.tests();for(u=0;u>>8^d;return c^-1}function c(b){return new Date((b>>25&127)+1980,(b>>21&15)-1,b>>16&31,b>>11&15, +b>>5&63,(b&31)<<1)}function h(b){var a=b.getFullYear();return 1980>a?0:a-1980<<25|b.getMonth()+1<<21|b.getDate()<<16|b.getHours()<<11|b.getMinutes()<<5|b.getSeconds()>>1}function q(b,e){var g,d,n,f,h,m,l,r=this;this.load=function(c){if(null!==r.data)c(null,r.data);else{var e=h+34+d+n+256;e+l>t&&(e=t-l);a(l,e,function(a,e){if(a||null===e)c(a,e);else a:{var g=e,d=new core.ByteArray(g),n=d.readUInt32LE(),l;if(67324752!==n)c("File entry signature is wrong."+n.toString()+" "+g.length.toString(),null); +else{d.pos+=22;n=d.readUInt16LE();l=d.readUInt16LE();d.pos+=n+l;if(f){g=g.subarray(d.pos,d.pos+h);if(h!==g.length){c("The amount of compressed bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+r.filename+" in "+b+".",null);break a}g=v(g,m)}else g=g.subarray(d.pos,d.pos+m);m!==g.length?c("The amount of bytes read was "+g.length.toString()+" instead of "+m.toString()+" for "+r.filename+" in "+b+".",null):(r.data=g,c(null,g))}}})}};this.set=function(b,a,c,e){r.filename=b;r.data= +a;r.compressed=c;r.date=e};this.error=null;e&&(g=e.readUInt32LE(),33639248!==g?this.error="Central directory entry has wrong signature at position "+(e.pos-4).toString()+' for file "'+b+'": '+e.data.length.toString():(e.pos+=6,f=e.readUInt16LE(),this.date=c(e.readUInt32LE()),e.readUInt32LE(),h=e.readUInt32LE(),m=e.readUInt32LE(),d=e.readUInt16LE(),n=e.readUInt16LE(),g=e.readUInt16LE(),e.pos+=8,l=e.readUInt32LE(),this.filename=runtime.byteArrayToString(e.data.subarray(e.pos,e.pos+d),"utf8"),this.data= +null,e.pos+=d+n+g))}function p(b,c){if(22!==b.length)c("Central directory length should be 22.",s);else{var e=new core.ByteArray(b),d;d=e.readUInt32LE();101010256!==d?c("Central directory signature is wrong: "+d.toString(),s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),y=e.readUInt16LE(),d!==y?c("Number of entries is inconsistent.",s):(d=e.readUInt32LE(), +e=e.readUInt16LE(),e=t-22-d,a(e,t-e,function(b,a){if(b||null===a)c(b,s);else a:{var e=new core.ByteArray(a),d,n;g=[];for(d=0;db.value||"%"===b.unit)?null:b}function F(b){return(b=I(b))&&"%"!==b.unit?null:b}function J(b){switch(b.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(b.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(b.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(b.localName){case "cursor":case "editinfo":return!1}}return!0} +function N(b,a){for(;0=a.value||"%"===a.unit)?null:a;return a||F(b)};this.parseFoLineHeight= +function(b){return C(b)||F(b)};this.isTextContentContainingNode=J;this.getTextNodes=function(b,a){var c;c=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT;b.nodeType===Node.TEXT_NODE?Boolean(h(b)&&(!p(b.textContent)||B(b,0)))&&(a=NodeFilter.FILTER_ACCEPT):J(b)&&(a=NodeFilter.FILTER_SKIP);return a},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);a||N(b,c);return c};this.getTextElements=K;this.getParagraphElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT; +if(c(b))a=NodeFilter.FILTER_ACCEPT;else if(J(b)||m(b))a=NodeFilter.FILTER_SKIP;return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,c);return a};this.getImageElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_SKIP;f(b)&&(a=NodeFilter.FILTER_ACCEPT);return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,f);return a};this.getHyperlinkElements=function(b){var a=[],e=b.cloneRange();b.collapsed&&b.endContainer.nodeType===Node.ELEMENT_NODE&&(b=z(b.endContainer,b.endOffset), +b.nodeType===Node.TEXT_NODE&&e.setEnd(b,1));K(e,!0,!1).forEach(function(b){for(b=b.parentNode;!c(b);){if(d(b)&&-1===a.indexOf(b)){a.push(b);break}b=b.parentNode}});e.detach();return a};this.getNormalizedFontFamilyName=function(b){/^(["'])(?:.|[\n\r])*?\1$/.test(b)||(b=b.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(b)&&(b="'"+b.replace(/[ \t\r\n\f]+/g," ")+"'"));return b}};odf.OdfUtils=new odf.OdfUtilsImpl;gui.OdfTextBodyNodeFilter=function(){var f=odf.OdfUtils,k=Node.TEXT_NODE,a=NodeFilter.FILTER_REJECT,d=NodeFilter.FILTER_ACCEPT,c=odf.Namespaces.textns;this.acceptNode=function(h){if(h.nodeType===k){if(!f.isGroupingElement(h.parentNode))return a}else if(h.namespaceURI===c&&"tracked-changes"===h.localName)return a;return d}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){}; +function createXPathSingleton(){function f(a,b,c){return-1!==a&&(a=f&&c.push(k(a.substring(b,d)))):"["===a[d]&&(0>=f&&(b=d+1),f+=1),d+=1;return d};m=function(a,b,e){var f,g,h,m;for(f=0;f/g,">").replace(/'/g,"'").replace(/"/g,""")}function a(c,f){var q="",p=d.filter?d.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,m;if(p===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){c.push();m=c.getQName(f);var l,r=f.attributes,b,e,n,g="",u;l="<"+m;b=r.length;for(e=0;e")}if(p===NodeFilter.FILTER_ACCEPT||p===NodeFilter.FILTER_SKIP){for(p=f.firstChild;p;)q+=a(c,p),p=p.nextSibling;f.nodeValue&&(q+=k(f.nodeValue))}m&&(q+="",c.pop());return q}var d=this;this.filter=null;this.writeToString=function(c,d){if(!c)return"";var q=new f(d);return a(q,c)}};(function(){function f(a){var b,c=p.length;for(b=0;bc)break;g=g.nextSibling}a.insertBefore(b,g)}}}var c=new odf.StyleInfo,h=core.DomUtils,q=odf.Namespaces.stylens,p="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "), +m=Date.now()+"_webodf_",l=new core.Base64;odf.ODFElement=function(){};odf.ODFDocumentElement=function(){};odf.ODFDocumentElement.prototype=new odf.ODFElement;odf.ODFDocumentElement.prototype.constructor=odf.ODFDocumentElement;odf.ODFDocumentElement.prototype.fontFaceDecls=null;odf.ODFDocumentElement.prototype.manifest=null;odf.ODFDocumentElement.prototype.settings=null;odf.ODFDocumentElement.namespaceURI="urn:oasis:names:tc:opendocument:xmlns:office:1.0";odf.ODFDocumentElement.localName="document"; +odf.AnnotationElement=function(){};odf.OdfPart=function(a,b,c,d){var g=this;this.size=0;this.type=null;this.name=a;this.container=c;this.url=null;this.mimetype=b;this.onstatereadychange=this.document=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.data="";this.load=function(){null!==d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(b,a){b&&runtime.log(b);g.url=a;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))}};odf.OdfPart.prototype.load=function(){}; +odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+l.toBase64(this.data):null};odf.OdfContainer=function b(e,f){function g(b){for(var a=b.firstChild,c;a;)c=a.nextSibling,a.nodeType===Node.ELEMENT_NODE?g(a):a.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&b.removeChild(a),a=c}function p(b){var a={},c,e,d=b.ownerDocument.createNodeIterator(b,NodeFilter.SHOW_ELEMENT,null,!1);for(b=d.nextNode();b;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&("annotation"=== +b.localName?(c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(a.hasOwnProperty(c)?runtime.log("Warning: annotation name used more than once with : '"+c+"'"):a[c]=b):"annotation-end"===b.localName&&((c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?a.hasOwnProperty(c)?(e=a[c],e.annotationEndElement?runtime.log("Warning: annotation name used more than once with : '"+c+"'"):e.annotationEndElement= +b):runtime.log("Warning: annotation end without an annotation start, name: '"+c+"'"):runtime.log("Warning: annotation end without a name found"))),b=d.nextNode()}function t(b,a){for(var c=b&&b.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS("urn:webodf:names:scope","scope",a),c=c.nextSibling}function y(b,a){for(var c=E.rootElement.meta,c=c&&c.firstChild;c&&(c.namespaceURI!==b||c.localName!==a);)c=c.nextSibling;for(c=c&&c.firstChild;c&&c.nodeType!==Node.TEXT_NODE;)c=c.nextSibling;return c? +c.data:null}function v(b){var a={},c;for(b=b.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&b.namespaceURI===q&&"font-face"===b.localName&&(c=b.getAttributeNS(q,"name"),a[c]=b),b=b.nextSibling;return a}function s(b,a){var c=null,e,d,g;if(b)for(c=b.cloneNode(!0),e=c.firstElementChild;e;)d=e.nextElementSibling,(g=e.getAttributeNS("urn:webodf:names:scope","scope"))&&g!==a&&c.removeChild(e),e=d;return c}function x(b,a){var e,d,g,f=null,n={};if(b)for(a.forEach(function(b){c.collectUsedFontFaces(n,b)}), +f=b.cloneNode(!0),e=f.firstElementChild;e;)d=e.nextElementSibling,g=e.getAttributeNS(q,"name"),n[g]||f.removeChild(e),e=d;return f}function w(b){var a=E.rootElement.ownerDocument,c;if(b){g(b.documentElement);try{c=a.importNode(b.documentElement,!0)}catch(e){}}return c}function B(b){E.state=b;if(E.onchange)E.onchange(E);if(E.onstatereadychange)E.onstatereadychange(E)}function I(b){da=null;E.rootElement=b;b.fontFaceDecls=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"); +b.styles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");b.automaticStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");b.masterStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");b.body=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");b.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");b.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"settings");b.scripts=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");p(b)}function C(a){var e=w(a),g=E.rootElement,f;e&&"document-styles"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI?(g.fontFaceDecls=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),d(g,g.fontFaceDecls),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0", +"styles"),d(g,g.styles),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),t(g.automaticStyles,"document-styles"),d(g,g.automaticStyles),e=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=e||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),d(g,g.masterStyles), +c.prefixStyleNames(g.automaticStyles,m,g.masterStyles)):B(b.INVALID)}function F(a){a=w(a);var e,g,f,n;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){e=E.rootElement;f=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(e.fontFaceDecls&&f){n=e.fontFaceDecls;var m,l,p,k,H={};g=v(n);k=v(f);for(f=f.firstElementChild;f;){m=f.nextElementSibling;if(f.namespaceURI===q&&"font-face"===f.localName)if(l=f.getAttributeNS(q, +"name"),g.hasOwnProperty(l)){if(!f.isEqualNode(g[l])){p=l;for(var K=g,s=k,u=0,z=void 0,z=p=p.replace(/\d+$/,"");K.hasOwnProperty(z)||s.hasOwnProperty(z);)u+=1,z=p+u;p=z;f.setAttributeNS(q,"style:name",p);n.appendChild(f);g[p]=f;delete k[l];H[l]=p}}else n.appendChild(f),g[l]=f,delete k[l];f=m}n=H}else f&&(e.fontFaceDecls=f,d(e,f));g=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");t(g,"document-content");n&&c.changeFontFaceNames(g,n);if(e.automaticStyles&&g)for(n= +g.firstChild;n;)e.automaticStyles.appendChild(n),n=g.firstChild;else g&&(e.automaticStyles=g,d(e,g));a=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw" tag is mising.";e.body=a;d(e,e.body)}else B(b.INVALID)}function J(b){b=w(b);var a;b&&"document-meta"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"), +d(a,a.meta))}function N(b){b=w(b);var a;b&&"document-settings"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),d(a,a.settings))}function K(b){b=w(b);var a;if(b&&"manifest"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===b.namespaceURI)for(a=E.rootElement,a.manifest=b,b=a.manifest.firstElementChild;b;)"file-entry"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"=== +b.namespaceURI&&(R[b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),b=b.nextElementSibling}function H(b,a,c){b=h.getElementsByTagName(b,a);var e;for(e=0;e'}function U(){var b=new xmldom.LSSerializer,a=G("document-meta");b.filter=new odf.OdfNodeFilter;a+=b.writeToString(E.rootElement.meta,odf.Namespaces.namespaceMap);return a+""}function aa(b,a){var c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",b);c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", +"manifest:media-type",a);return c}function P(){var b=runtime.parseXML(''),a=b.documentElement,c=new xmldom.LSSerializer,e;for(e in R)R.hasOwnProperty(e)&&a.appendChild(aa(e,R[e]));c.filter=new odf.OdfNodeFilter;return'\n'+c.writeToString(b,odf.Namespaces.namespaceMap)}function D(){var b,a,e,d=odf.Namespaces.namespaceMap, +g=new xmldom.LSSerializer,f=G("document-styles");a=s(E.rootElement.automaticStyles,"document-styles");e=E.rootElement.masterStyles.cloneNode(!0);b=x(E.rootElement.fontFaceDecls,[e,E.rootElement.styles,a]);c.removePrefixFromStyleNames(a,m,e);g.filter=new k(e,a);f+=g.writeToString(b,d);f+=g.writeToString(E.rootElement.styles,d);f+=g.writeToString(a,d);f+=g.writeToString(e,d);return f+""}function Q(){var b,c,e=odf.Namespaces.namespaceMap,d=new xmldom.LSSerializer,g=G("document-content"); +c=s(E.rootElement.automaticStyles,"document-content");b=x(E.rootElement.fontFaceDecls,[c]);d.filter=new a(E.rootElement.body,c);g+=d.writeToString(b,e);g+=d.writeToString(c,e);g+=d.writeToString(E.rootElement.body,e);return g+""}function $(a,c){runtime.loadXML(a,function(a,e){if(a)c(a);else if(e){z(e);Z(e.documentElement);var d=w(e);d&&"document"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(I(d),B(b.DONE)):B(b.INVALID)}else c("No DOM was loaded.")})} +function A(b,a){var c;c=E.rootElement;var e=c.meta;e||(c.meta=e=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),d(c,e));c=e;b&&h.mapKeyValObjOntoNode(c,b,odf.Namespaces.lookupNamespaceURI);a&&h.removeKeyElementsFromNode(c,a,odf.Namespaces.lookupNamespaceURI)}function V(a,c){function e(b,a){var c;a||(a=b);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);n[b]=c;n.appendChild(c)}var d=new core.Zip("",null),g="application/vnd.oasis.opendocument."+ +a+(!0===c?"-template":""),f=runtime.byteArrayFromString(g,"utf8"),n=E.rootElement,h=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);d.save("mimetype",f,!1,new Date);e("meta");e("settings");e("scripts");e("fontFaceDecls","font-face-decls");e("styles");e("automaticStyles","automatic-styles");e("masterStyles","master-styles");e("body");n.body.appendChild(h);R["/"]=g;R["settings.xml"]="text/xml";R["meta.xml"]="text/xml";R["styles.xml"]="text/xml";R["content.xml"]="text/xml"; +B(b.DONE);return d}function ba(){var b,a=new Date,c="";E.rootElement.settings&&E.rootElement.settings.firstElementChild&&(b=new xmldom.LSSerializer,c=G("document-settings"),b.filter=new odf.OdfNodeFilter,c+=b.writeToString(E.rootElement.settings,odf.Namespaces.namespaceMap),c+="");(b=c)?(b=runtime.byteArrayFromString(b,"utf8"),X.save("settings.xml",b,!0,a)):X.remove("settings.xml");c=runtime.getWindow();b="WebODF/"+webodf.Version;c&&(b=b+" "+c.navigator.userAgent);A({"meta:generator":b}, +null);b=runtime.byteArrayFromString(U(),"utf8");X.save("meta.xml",b,!0,a);b=runtime.byteArrayFromString(D(),"utf8");X.save("styles.xml",b,!0,a);b=runtime.byteArrayFromString(Q(),"utf8");X.save("content.xml",b,!0,a);b=runtime.byteArrayFromString(P(),"utf8");X.save("META-INF/manifest.xml",b,!0,a)}function Y(b,a){ba();X.writeAs(b,function(b){a(b)})}var E=this,X,R={},da,S="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=y;this.setRootElement=I;this.getContentElement=function(){var b; +da||(b=E.rootElement.body,da=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!da)throw"Could not find content element in .";return da};this.getDocumentType=function(){var b=E.getContentElement();return b&&b.localName};this.isTemplate=function(){return"-template"===R["/"].substr(-9)}; +this.setIsTemplate=function(b){var a=R["/"],c="-template"===a.substr(-9);b!==c&&(a=b?a+"-template":a.substr(0,a.length-9),R["/"]=a,b=runtime.byteArrayFromString(a,"utf8"),X.save("mimetype",b,!1,new Date))};this.getPart=function(b){return new odf.OdfPart(b,R[b],E,X)};this.getPartData=function(b,a){X.load(b,a)};this.setMetadata=A;this.incrementEditingCycles=function(){var b=y(odf.Namespaces.metans,"editing-cycles"),b=b?parseInt(b,10):0;isNaN(b)&&(b=0);A({"meta:editing-cycles":b+1},null);return b+1}; +this.createByteArray=function(b,a){ba();X.createByteArray(b,a)};this.saveAs=Y;this.save=function(b){Y(S,b)};this.getUrl=function(){return S};this.setBlob=function(b,a,c){c=l.convertBase64ToByteArray(c);X.save(b,c,!1,new Date);R.hasOwnProperty(b)&&runtime.log(b+" has been overwritten.");R[b]=a};this.removeBlob=function(b){var a=X.remove(b);runtime.assert(a,"file is not found: "+b);delete R[b]};this.state=b.LOADING;this.rootElement=function(b){var a=document.createElementNS(b.namespaceURI,b.localName), +c;b=new b.Type;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});e===odf.OdfContainer.DocumentType.TEXT?X=V("text"):e===odf.OdfContainer.DocumentType.TEXT_TEMPLATE?X=V("text",!0):e===odf.OdfContainer.DocumentType.PRESENTATION?X=V("presentation"):e===odf.OdfContainer.DocumentType.PRESENTATION_TEMPLATE?X=V("presentation",!0):e===odf.OdfContainer.DocumentType.SPREADSHEET?X=V("spreadsheet"): +e===odf.OdfContainer.DocumentType.SPREADSHEET_TEMPLATE?X=V("spreadsheet",!0):(S=e,X=new core.Zip(S,function(a,c){X=c;a?$(S,function(c){a&&(X.error=a+"\n"+c,B(b.INVALID))}):T([{path:"styles.xml",handler:C},{path:"content.xml",handler:F},{path:"meta.xml",handler:J},{path:"settings.xml",handler:N},{path:"META-INF/manifest.xml",handler:K}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer= +function(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,TEXT_TEMPLATE:2,PRESENTATION:3,PRESENTATION_TEMPLATE:4,SPREADSHEET:5,SPREADSHEET_TEMPLATE:6};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){}; +gui.AnnotationViewManager=function(f,k,a,d){function c(b){var a=b.annotationEndElement,c=l.createRange(),d=b.getAttributeNS(odf.Namespaces.officens,"name");a&&(c.setStart(b,b.childNodes.length),c.setEnd(a,0),b=r.getTextNodes(c,!1),b.forEach(function(b){var a;a:{for(a=b.parentNode;a.namespaceURI!==odf.Namespaces.officens||"body"!==a.localName;){if(a.namespaceURI===e&&"webodf-annotationHighlight"===a.className&&a.getAttribute("annotation")===d){a=!0;break a}a=a.parentNode}a=!1}a||(a=l.createElement("span"), +a.className="webodf-annotationHighlight",a.setAttribute("annotation",d),b.parentNode.replaceChild(a,b),a.appendChild(b))}));c.detach()}function h(c){var e=f.getSizer();c?(a.style.display="inline-block",e.style.paddingRight=b.getComputedStyle(a).width):(a.style.display="none",e.style.paddingRight=0);f.refreshSize()}function q(){m.sort(function(b,a){return 0!==(b.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function p(){var b;for(b=0;b=(l.getBoundingClientRect().top-q.bottom)/c?e.style.top=Math.abs(l.getBoundingClientRect().top-q.bottom)/c+20+"px":e.style.top="0px");h.style.left=d.getBoundingClientRect().width/ +c+"px";var d=h.style,l=h.getBoundingClientRect().left/c,p=h.getBoundingClientRect().top/c,q=e.getBoundingClientRect().left/c,k=e.getBoundingClientRect().top/c,r=0,I=0,r=q-l,r=r*r,I=k-p,I=I*I,l=Math.sqrt(r+I);d.width=l+"px";p=Math.asin((e.getBoundingClientRect().top-h.getBoundingClientRect().top)/(c*parseFloat(h.style.width)));h.style.transform="rotate("+p+"rad)";h.style.MozTransform="rotate("+p+"rad)";h.style.WebkitTransform="rotate("+p+"rad)";h.style.msTransform="rotate("+p+"rad)"}}var m=[],l=k.ownerDocument, +r=odf.OdfUtils,b=runtime.getWindow(),e="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(b),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=p;this.rehighlightAnnotations=function(){m.forEach(function(b){c(b)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==a.style.display&&0q||k.bottom>q)f.scrollTop=k.bottom-k.top<=q-c?f.scrollTop+(k.bottom-q):f.scrollTop+(k.top-c);k.lefth&&(f.scrollLeft=k.right-k.left<=h-d?f.scrollLeft+(k.right-h):f.scrollLeft-(d-k.left))}}};(function(){function f(a,h,q,p,m){var l,k=0,b;for(b in a)if(a.hasOwnProperty(b)){if(k===q){l=b;break}k+=1}l?h.getPartData(a[l].href,function(b,n){if(b)runtime.log(b);else if(n){var g="@font-face { font-family: "+(a[l].family||l)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+d.convertUTF8ArrayToBase64(n)+') format("truetype"); }';try{p.insertRule(g,p.cssRules.length)}catch(k){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(k)+"\nRule: "+g)}}else runtime.log("missing font data for "+ +a[l].href);f(a,h,q+1,p,m)}):m&&m()}var k=xmldom.XPath,a=odf.OdfUtils,d=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(c,d){for(var q=c.rootElement.fontFaceDecls;d.cssRules.length;)d.deleteRule(d.cssRules.length-1);if(q){var p={},m,l,r,b;if(q)for(q=k.getODFElementsWithXPath(q,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),m=0;m text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+s+" 0;",x+="}",f(a,x));for(;k.counterIdStack.length>=q;)k.counterIdStack.pop();k.counterIdStack.push(s);w=k.contentRules[q.toString()]||"";for(x=1;x<=q;x+=1)w=w.replace(x+"webodf-listLevel",k.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+r+'"] > text|list-item > :not(text|list):first-child:before'; +x+="{";x+=w;x+="counter-increment: "+s+";";x+="}";f(a,x)}for(d=d.firstElementChild;d;)c(e,d,p,k),d=d.nextElementSibling}else k.continuedCounterIdStack=[]}var d=0,b="",e={};this.createCounterRules=function(b,a,f){var h=a.getAttributeNS(q,"id"),m=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),m=e[f].slice(0));b=new k(b,m);h?h="Y"+h:(d+=1,h="X"+d);c(h,a,0,b);e[h+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var c;c="office|document{"+("counter-reset: "+b+ +";");c+="}";f(a,c)}}var d=odf.Namespaces.fons,c=odf.Namespaces.stylens,h=odf.Namespaces.textns,q=odf.Namespaces.xmlns,p={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function m(b){var a=n.parseLength(b);return a?e.convert(a.value,a.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function l(b){return b.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function k(b,a){var c;b&&(c=b.getAttributeNS(h,"style-name"));return c===a}function b(b, +e,d){e=e.getElementsByTagNameNS(h,"list");b=new a(b);var f,n,m,x,w,B,I={},C;for(C=0;C text|list-item > text|list",t-=1;t=u&&u.getAttributeNS(d,"text-align")||"left";switch(t){case "end":t="right";break;case "start":t="left"}"label-alignment"===N?(H=K&&K.getAttributeNS(d,"margin-left")||"0px",T=K&&K.getAttributeNS(d,"text-indent")||"0px",G=K&&K.getAttributeNS(h,"label-followed-by"),K=m(H)):(H=u&&u.getAttributeNS(h,"space-before")||"0px",z=u&&u.getAttributeNS(h,"min-label-width")||"0px", +Z=u&&u.getAttributeNS(h,"min-label-distance")||"0px",K=m(H)+m(z));u=q+" > text|list-item";u+="{";u+="margin-left: "+K+"px;";u+="}";f(n,u);u=q+" > text|list-item > text|list";u+="{";u+="margin-left: "+-K+"px;";u+="}";f(n,u);u=q+" > text|list-item > :not(text|list):first-child:before";u+="{";u+="text-align: "+t+";";u+="display: inline-block;";"label-alignment"===N?(u+="margin-left: "+T+";","listtab"===G&&(u+="padding-right: 0.2cm;")):(u+="min-width: "+z+";",u+="margin-left: "+(0===parseFloat(z)?"": +"-")+z+";",u+="padding-right: "+Z+";");u+="}";f(n,u)}e=e.nextElementSibling}});b(a,n,l)}}})();odf.LazyStyleProperties=function(f,k){var a={};this.value=function(d){var c;a.hasOwnProperty(d)?c=a[d]:(c=k[d](),void 0===c&&f&&(c=f.value(d)),a[d]=c);return c};this.reset=function(d){f=d;a={}}}; +odf.StyleParseUtils=function(){function f(a){var d,c;a=(a=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/.exec(a))?{value:parseFloat(a[1]),unit:a[3]}:null;c=a&&a.unit;"px"===c?d=a.value:"cm"===c?d=96*(a.value/2.54):"mm"===c?d=96*(a.value/25.4):"in"===c?d=96*a.value:"pt"===c?d=a.value/0.75:"pc"===c&&(d=16*a.value);return d}var k=odf.Namespaces.stylens;this.parseLength=f;this.parsePositiveLengthOrPercent=function(a,d,c){var h;a&&(h=parseFloat(a.substr(0, +a.indexOf("%"))),isNaN(h)&&(h=void 0));var k;void 0!==h?(c&&(k=c.value(d)),h=void 0===k?void 0:h*(k/100)):h=f(a);return h};this.getPropertiesElement=function(a,d,c){for(d=c?c.nextElementSibling:d.firstElementChild;null!==d&&(d.localName!==a||d.namespaceURI!==k);)d=d.nextElementSibling;return d};this.parseAttributeList=function(a){a&&(a=a.replace(/^\s*(.*?)\s*$/g,"$1"));return a&&0n.value&&(f="0.75pt"+g);g=f}else if(z.hasOwnProperty(d[1])){var f= +b,h=d[0],n=d[1],m=T.parseLength(g),l=void 0,p=void 0,q=void 0,K=void 0,q=void 0;if(m&&"%"===m.unit){l=m.value/100;p=k(f.parentNode);for(K="0";p;){if(q=u.getDirectChild(p,r,"paragraph-properties"))if(q=T.parseLength(q.getAttributeNS(h,n))){if("%"!==q.unit){K=q.value*l+q.unit;break}l*=q.value/100}p=k(p)}g=K}}d[2]&&(c+=d[2]+":"+g+";")}return c}function d(b,a,c,e){return a+a+c+c+e+e}function c(b,a){var e=[b],d=a.derivedStyles;Object.keys(d).forEach(function(b){b=c(b,d[b]);e=e.concat(b)});return e}function h(b, +a,e,d){function f(a,c){var e=[],d;a.forEach(function(b){h.forEach(function(a){e.push("draw|page[webodfhelper|page-style-name='"+a+"'] draw|frame[presentation|class='"+b+"']")})});0c)break;g=g.nextSibling}a.insertBefore(b,g)}}}function r(a){this.OdfContainer=a}function h(a,b,c,d){var g=this;this.size=0;this.type=null;this.name=a;this.container=c;this.onchange=this.onreadystatechange=this.document=this.mimetype=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){null!== -d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(a,b){a&&runtime.log(a);g.url=b;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))};this.abort=function(){}}function b(a){this.length=0;this.item=function(a){}}var f=new odf.StyleInfo,d="urn:oasis:names:tc:opendocument:xmlns:office:1.0",a="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",n="urn:webodf:names:scope",q="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),g=(new Date).getTime()+ -"_webodf_",c=new core.Base64;r.prototype=new function(){};r.prototype.constructor=r;r.namespaceURI=d;r.localName="document";h.prototype.load=function(){};h.prototype.getUrl=function(){return this.data?"data:;base64,"+c.toBase64(this.data):null};odf.OdfContainer=function t(c,m){function q(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?q(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function k(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&& -c.setAttributeNS(n,"scope",b),c=c.nextSibling}function v(a,b){var c=null,d,g,e;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)g=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(e=d.getAttributeNS(n,"scope"))&&e!==b&&c.removeChild(d),d=g;return c}function w(a){var b=M.rootElement.ownerDocument,c;if(a){q(a.documentElement);try{c=b.importNode(a.documentElement,!0)}catch(d){}}return c}function P(a){M.state=a;if(M.onchange)M.onchange(M);if(M.onstatereadychange)M.onstatereadychange(M)}function B(a){R=null; -M.rootElement=a;a.fontFaceDecls=e(a,d,"font-face-decls");a.styles=e(a,d,"styles");a.automaticStyles=e(a,d,"automatic-styles");a.masterStyles=e(a,d,"master-styles");a.body=e(a,d,"body");a.meta=e(a,d,"meta")}function E(a){a=w(a);var b=M.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===d?(b.fontFaceDecls=e(a,d,"font-face-decls"),p(b,b.fontFaceDecls),b.styles=e(a,d,"styles"),p(b,b.styles),b.automaticStyles=e(a,d,"automatic-styles"),k(b.automaticStyles,"document-styles"),p(b,b.automaticStyles), -b.masterStyles=e(a,d,"master-styles"),p(b,b.masterStyles),f.prefixStyleNames(b.automaticStyles,g,b.masterStyles)):P(t.INVALID)}function O(a){a=w(a);var b,c,g;if(a&&"document-content"===a.localName&&a.namespaceURI===d){b=M.rootElement;c=e(a,d,"font-face-decls");if(b.fontFaceDecls&&c)for(g=c.firstChild;g;)b.fontFaceDecls.appendChild(g),g=c.firstChild;else c&&(b.fontFaceDecls=c,p(b,c));c=e(a,d,"automatic-styles");k(c,"document-content");if(b.automaticStyles&&c)for(g=c.firstChild;g;)b.automaticStyles.appendChild(g), -g=c.firstChild;else c&&(b.automaticStyles=c,p(b,c));b.body=e(a,d,"body");p(b,b.body)}else P(t.INVALID)}function y(a){a=w(a);var b;a&&("document-meta"===a.localName&&a.namespaceURI===d)&&(b=M.rootElement,b.meta=e(a,d,"meta"),p(b,b.meta))}function J(a){a=w(a);var b;a&&("document-settings"===a.localName&&a.namespaceURI===d)&&(b=M.rootElement,b.settings=e(a,d,"settings"),p(b,b.settings))}function C(b){b=w(b);var c;if(b&&"manifest"===b.localName&&b.namespaceURI===a)for(c=M.rootElement,c.manifest=b,b=c.manifest.firstChild;b;)b.nodeType=== -Node.ELEMENT_NODE&&("file-entry"===b.localName&&b.namespaceURI===a)&&(T[b.getAttributeNS(a,"full-path")]=b.getAttributeNS(a,"media-type")),b=b.nextSibling}function D(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],S.loadAsDOM(c,function(b,c){d(c);M.state!==t.INVALID&&D(a)})):P(t.DONE)}function G(a){var b="";odf.Namespaces.forEachPrefix(function(a,c){b+=" xmlns:"+a+'="'+c+'"'});return''}function X(){var a=new xmldom.LSSerializer, -b=G("document-meta");a.filter=new l;b+=a.writeToString(M.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function Q(b,c){var d=document.createElementNS(a,"manifest:file-entry");d.setAttributeNS(a,"manifest:full-path",b);d.setAttributeNS(a,"manifest:media-type",c);return d}function F(){var b=runtime.parseXML(''),c=e(b,a,"manifest"),d=new xmldom.LSSerializer,g;for(g in T)T.hasOwnProperty(g)&&c.appendChild(Q(g, -T[g]));d.filter=new l;return'\n'+d.writeToString(b,odf.Namespaces.namespaceMap)}function K(){var a=new xmldom.LSSerializer,b=G("document-settings");a.filter=new l;b+=a.writeToString(M.rootElement.settings,odf.Namespaces.namespaceMap);return b+""}function H(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(M.rootElement.automaticStyles,"document-styles"),d=M.rootElement.masterStyles&&M.rootElement.masterStyles.cloneNode(!0), -e=G("document-styles");f.removePrefixFromStyleNames(c,g,d);b.filter=new l(d,c);e+=b.writeToString(M.rootElement.fontFaceDecls,a);e+=b.writeToString(M.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+""}function U(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=v(M.rootElement.automaticStyles,"document-content"),d=G("document-content");b.filter=new l(M.rootElement.body,c);d+=b.writeToString(c,a);d+=b.writeToString(M.rootElement.body, -a);return d+""}function Z(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var g=w(c);g&&"document"===g.localName&&g.namespaceURI===d?(B(g),P(t.DONE)):P(t.INVALID)}})}function W(){function a(b,c){var e;c||(c=b);e=document.createElementNS(d,c);g[b]=e;g.appendChild(e)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),g=M.rootElement,e=document.createElementNS(d,"text");b.save("mimetype",c,!1,new Date);a("meta");a("settings"); -a("scripts");a("fontFaceDecls","font-face-decls");a("styles");a("automaticStyles","automatic-styles");a("masterStyles","master-styles");a("body");g.body.appendChild(e);P(t.DONE);return b}function L(){var a,b=new Date;a=runtime.byteArrayFromString(K(),"utf8");S.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(X(),"utf8");S.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(H(),"utf8");S.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(U(),"utf8");S.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(F(), -"utf8");S.save("META-INF/manifest.xml",a,!0,b)}function I(a,b){L();S.writeAs(a,function(a){b(a)})}var M=this,S,T={},R;this.onstatereadychange=m;this.parts=this.rootElement=this.state=this.onchange=null;this.setRootElement=B;this.getContentElement=function(){var a;R||(a=M.rootElement.body,R=a.getElementsByTagNameNS(d,"text")[0]||a.getElementsByTagNameNS(d,"presentation")[0]||a.getElementsByTagNameNS(d,"spreadsheet")[0]);return R};this.getDocumentType=function(){var a=M.getContentElement();return a&& -a.localName};this.getPart=function(a){return new h(a,T[a],M,S)};this.getPartData=function(a,b){S.load(a,b)};this.createByteArray=function(a,b){L();S.createByteArray(a,b)};this.saveAs=I;this.save=function(a){I(c,a)};this.getUrl=function(){return c};this.state=t.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),c;a=new a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}(r);this.parts=new b(this);S=c?new core.Zip(c,function(a,b){S=b;a?Z(c,function(b){a&& -(S.error=a+"\n"+b,P(t.INVALID))}):D([["styles.xml",E],["content.xml",O],["meta.xml",y],["settings.xml",J],["META-INF/manifest.xml",C]])}):W()};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)};return odf.OdfContainer}(); -// Input 30 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.OdfContainer"); -odf.FontLoader=function(){function e(k,h,b,f,d){var a,n=0,q;for(q in k)if(k.hasOwnProperty(q)){if(n===b){a=q;break}n+=1}if(!a)return d();h.getPartData(k[a].href,function(g,c){if(g)runtime.log(g);else{var n="@font-face { font-family: '"+(k[a].family||a)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+p.convertUTF8ArrayToBase64(c)+') format("truetype"); }';try{f.insertRule(n,f.cssRules.length)}catch(q){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(q)+"\nRule: "+n)}}e(k, -h,b+1,f,d)})}function k(k,h,b){e(k,h,0,b,function(){})}var l=new xmldom.XPath,p=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(e,h){for(var b=e.rootElement.fontFaceDecls;h.cssRules.length;)h.deleteRule(h.cssRules.length-1);if(b){var f={},d,a,n,q;if(b)for(b=l.getODFElementsWithXPath(b,"style:font-face[svg:font-face-src]",odf.Namespaces.resolvePrefix),d=0;d - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.Namespaces");runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.OdfUtils");runtime.loadClass("odf.TextStyleApplicator"); -odf.Formatting=function(){function e(a,b){Object.keys(b).forEach(function(c){try{a[c]=b[c].constructor===Object?e(a[c],b[c]):b[c]}catch(d){a[c]=b[c]}});return a}function k(b,d,e){var f;e=e||[a.rootElement.automaticStyles,a.rootElement.styles];for(f=e.shift();f;){for(f=f.firstChild;f;){if(f.nodeType===Node.ELEMENT_NODE&&(f.namespaceURI===g&&"style"===f.localName&&f.getAttributeNS(g,"family")===d&&f.getAttributeNS(g,"name")===b||"list-style"===d&&f.namespaceURI===c&&"list-style"===f.localName&&f.getAttributeNS(g, -"name")===b))return f;f=f.nextSibling}f=e.shift()}return null}function l(a){for(var b={},c=a.firstChild;c;){if(c.nodeType===Node.ELEMENT_NODE&&c.namespaceURI===g)for(b[c.nodeName]={},a=0;a - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.OdfContainer");runtime.loadClass("odf.Formatting");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.FontLoader");runtime.loadClass("odf.Style2CSS");runtime.loadClass("odf.OdfUtils"); -odf.OdfCanvas=function(){function e(){function a(d){c=!0;runtime.setTimeout(function(){try{d()}catch(g){runtime.log(g)}c=!1;0 text|list-item > *:first-child:before {";if(B=F.getAttributeNS(v,"style-name")){F=p[B];K=y.getFirstNonWhitespaceChild(F);F=void 0;if("list-level-style-number"===K.localName){F=K.getAttributeNS(m,"num-format");B=K.getAttributeNS(m,"num-suffix");var L="",L={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"}, -$=void 0,$=K.getAttributeNS(m,"num-prefix")||"",$=L.hasOwnProperty(F)?$+(" counter(list, "+L[F]+")"):F?$+("'"+F+"';"):$+" ''";B&&($+=" '"+B+"'");F=L="content: "+$+";"}else"list-level-style-image"===K.localName?F="content: none;":"list-level-style-bullet"===K.localName&&(F="content: '"+K.getAttributeNS(v,"bullet-char")+"';");K=F}if(Q){for(F=k[Q];F;)Q=F,F=k[Q];z+="counter-increment:"+Q+";";K?(K=K.replace("list",Q),z+=K):z+="content:counter("+Q+");"}else Q="",K?(K=K.replace("list",w),z+=K):z+="content: counter("+ -w+");",z+="counter-increment:"+w+";",e.insertRule("text|list#"+w+" {counter-reset:"+w+"}",e.cssRules.length);z+="}";k[w]=Q;z&&e.insertRule(z,e.cssRules.length)}q.insertBefore(J,q.firstChild);A();if(!c&&(e=[U],N.hasOwnProperty("statereadychange")))for(q=N.statereadychange,K=0;K - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.Operation=function(){};ops.Operation.prototype.init=function(e){};ops.Operation.prototype.execute=function(e){};ops.Operation.prototype.spec=function(){}; -// Input 35 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpAddCursor=function(){var e,k;this.init=function(l){e=l.memberid;k=l.timestamp};this.execute=function(k){var p=k.getCursor(e);if(p)return!1;p=new ops.OdtCursor(e,k);k.addCursor(p);k.emit(ops.OdtDocument.signalCursorAdded,p);return!0};this.spec=function(){return{optype:"AddCursor",memberid:e,timestamp:k}}}; -// Input 36 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("odf.OdfUtils"); -ops.OpApplyStyle=function(){function e(b){var a=0<=h?r+h:r,e=b.getIteratorAtPosition(0<=h?r:r+h),a=h?b.getIteratorAtPosition(a):e;b=b.getDOM().createRange();b.setStart(e.container(),e.unfilteredDomOffset());b.setEnd(a.container(),a.unfilteredDomOffset());return b}function k(b){var a=b.commonAncestorContainer,e;e=Array.prototype.slice.call(a.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","p"));for(e=e.concat(Array.prototype.slice.call(a.getElementsByTagNameNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","h")));a&& -!f.isParagraph(a);)a=a.parentNode;a&&e.push(a);return e.filter(function(a){var g=a.nodeType===Node.TEXT_NODE?a.length:a.childNodes.length;return 0>=b.comparePoint(a,0)&&0<=b.comparePoint(a,g)})}var l,p,r,h,b,f=new odf.OdfUtils;this.init=function(d){l=d.memberid;p=d.timestamp;r=d.position;h=d.length;b=d.info};this.execute=function(d){var a=e(d),f=k(a);d.getFormatting().applyStyle(a,b);a.detach();d.getOdfCanvas().refreshCSS();f.forEach(function(a){d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a, -memberId:l,timeStamp:p})});return!0};this.spec=function(){return{optype:"ApplyStyle",memberid:l,timestamp:p,position:r,length:h,info:b}}}; -// Input 37 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpRemoveCursor=function(){var e,k;this.init=function(l){e=l.memberid;k=l.timestamp};this.execute=function(k){return k.removeCursor(e)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:e,timestamp:k}}}; -// Input 38 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpMoveCursor=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=r.length||0};this.execute=function(k){var h=k.getCursor(e),b=k.getCursorPosition(e),f=k.getPositionFilter(),d=l-b;if(!h)return!1;b=h.getStepCounter();d=0d?-b.countBackwardSteps(-d,f):0;h.move(d);p&&(f=0p?-b.countBackwardSteps(-p,f):0,h.move(f,!0));k.emit(ops.OdtDocument.signalCursorMoved,h);return!0};this.spec=function(){return{optype:"MoveCursor", -memberid:e,timestamp:k,position:l,length:p}}}; -// Input 39 -ops.OpInsertTable=function(){function e(b,d){var g;if(1===a.length)g=a[0];else if(3===a.length)switch(b){case 0:g=a[0];break;case p-1:g=a[2];break;default:g=a[1]}else g=a[b];if(1===g.length)return g[0];if(3===g.length)switch(d){case 0:return g[0];case r-1:return g[2];default:return g[1]}return g[d]}var k,l,p,r,h,b,f,d,a;this.init=function(e){k=e.memberid;l=e.timestamp;h=e.position;p=e.initialRows;r=e.initialColumns;b=e.tableName;f=e.tableStyleName;d=e.tableColumnStyleName;a=e.tableCellStyleMatrix}; -this.execute=function(a){var q=a.getPositionInTextNode(h),g=a.getRootNode();if(q){var c=a.getDOM(),u=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),t=c.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column"),s,m,A,x;f&&u.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",f);b&&u.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",b);t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0", -"table:number-columns-repeated",r);d&&t.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",d);u.appendChild(t);for(A=0;A - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpInsertText=function(){function e(e,b){var f=b.parentNode,d=b.nextSibling,a=[];e.getCursors().forEach(function(d){var e=d.getSelectedRange();!e||e.startContainer!==b&&e.endContainer!==b||a.push({cursor:d,startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset})});f.removeChild(b);f.insertBefore(b,d);a.forEach(function(a){var b=a.cursor.getSelectedRange();b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer,a.endOffset)})}var k, -l,p,r;this.init=function(e){k=e.memberid;l=e.timestamp;p=e.position;r=e.text};this.execute=function(h){var b,f=r.split(" "),d,a,n,q,g=h.getRootNode().ownerDocument,c;if(b=h.getPositionInTextNode(p,k)){a=b.textNode;n=a.parentNode;q=a.nextSibling;d=b.offset;b=h.getParagraphElement(a);d!==a.length&&(q=a.splitText(d));0 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpRemoveText=function(){function e(a){var b,d,c,e,f;b=a.getCursors();e=a.getPositionFilter();for(f in b)b.hasOwnProperty(f)&&(d=b[f].getStepCounter(),d.isPositionWalkable(e)||(c=-d.countBackwardSteps(1,e),0===c&&(c=d.countForwardSteps(1,e)),b[f].move(c),f===p&&a.emit(ops.OdtDocument.signalCursorMoved,b[f])))}function k(a){if(!d.isParagraph(a)&&(d.isGroupingElement(a)||d.isCharacterElement(a))&&0===a.textContent.length){for(a=a.firstChild;a;){if(d.isCharacterElement(a))return!1;a=a.nextSibling}return!0}return!1} -function l(b,e,g){var c,f;c=g?e.lastChild:e.firstChild;for(g&&(f=b.getElementsByTagNameNS(a,"editinfo")[0]||b.firstChild);c;){e.removeChild(c);if("editinfo"!==c.localName)if(k(c))for(;c.firstChild;)b.insertBefore(c.firstChild,f);else b.insertBefore(c,f);c=g?e.lastChild:e.firstChild}b=e.parentNode;b.removeChild(e);d.isListItem(b)&&0===b.childNodes.length&&b.parentNode.removeChild(b)}var p,r,h,b,f,d,a="urn:webodf:names:editinfo";this.init=function(a){runtime.assert(0<=a.length,"OpRemoveText only supports positive lengths"); -p=a.memberid;r=a.timestamp;h=parseInt(a.position,10);b=parseInt(a.length,10);f=a.text;d=new odf.OdfUtils};this.execute=function(a){var d=[],g,c,f,t=null,s=null,m;c=h;var A=b;a.upgradeWhitespacesAtPosition(c);g=a.getPositionInTextNode(c);var d=g.textNode,x=g.offset,v=d.parentNode;g=a.getParagraphElement(v);f=A;""===d.data?(v.removeChild(d),c=a.getTextNeighborhood(c,A)):0!==x?(v=f - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpSplitParagraph=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=new odf.OdfUtils};this.execute=function(r){var h,b,f,d,a,n;h=r.getPositionInTextNode(l,e);if(!h)return!1;b=r.getParagraphElement(h.textNode);if(!b)return!1;f=p.isListItem(b.parentNode)?b.parentNode:b;0===h.offset?(n=h.textNode.previousSibling,a=null):(n=h.textNode,a=h.offset>=h.textNode.length?null:h.textNode.splitText(h.offset));for(h=h.textNode;h!==f;)if(h=h.parentNode,d=h.cloneNode(!1),n){for(a&& -d.appendChild(a);n.nextSibling;)d.appendChild(n.nextSibling);h.parentNode.insertBefore(d,h.nextSibling);n=h;a=d}else h.parentNode.insertBefore(d,h),n=d,a=h;p.isListItem(a)&&(a=a.childNodes[0]);r.getOdfCanvas().refreshSize();r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,memberId:e,timeStamp:k});r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:e,timeStamp:k});return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:e,timestamp:k,position:l}}}; -// Input 43 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpSetParagraphStyle=function(){var e,k,l,p;this.init=function(r){e=r.memberid;k=r.timestamp;l=r.position;p=r.styleName};this.execute=function(r){var h;if(h=r.getPositionInTextNode(l))if(h=r.getParagraphElement(h.textNode))return""!==p?h.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",p):h.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),r.getOdfCanvas().refreshSize(),r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:h, -timeStamp:k,memberId:e}),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:e,timestamp:k,position:l,styleName:p}}}; -// Input 44 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpUpdateParagraphStyle=function(){function e(a,b,d){var e,c,f;for(e=0;e - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpCloneParagraphStyle=function(){var e,k,l,p,r;this.init=function(h){e=h.memberid;k=h.timestamp;l=h.styleName;p=h.newStyleName;r=h.newStyleDisplayName};this.execute=function(e){var b=e.getParagraphStyleElement(l),f;if(!b)return!1;f=b.cloneNode(!0);f.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:name",p);r?f.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","style:display-name",r):f.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:style:1.0","display-name"); -b.parentNode.appendChild(f);e.getOdfCanvas().refreshCSS();e.emit(ops.OdtDocument.signalStyleCreated,p);return!0};this.spec=function(){return{optype:"CloneParagraphStyle",memberid:e,timestamp:k,styleName:l,newStyleName:p,newStyleDisplayName:r}}}; -// Input 46 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OpDeleteParagraphStyle=function(){var e,k,l;this.init=function(p){e=p.memberid;k=p.timestamp;l=p.styleName};this.execute=function(e){var k=e.getParagraphStyleElement(l);if(!k)return!1;k.parentNode.removeChild(k);e.getOdfCanvas().refreshCSS();e.emit(ops.OdtDocument.signalStyleDeleted,l);return!0};this.spec=function(){return{optype:"DeleteParagraphStyle",memberid:e,timestamp:k,styleName:l}}}; -// Input 47 -/* - - Copyright (C) 2012-2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpApplyStyle");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertTable");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("ops.OpUpdateParagraphStyle");runtime.loadClass("ops.OpCloneParagraphStyle");runtime.loadClass("ops.OpDeleteParagraphStyle"); -ops.OperationFactory=function(){this.create=function(e){var k=null;"AddCursor"===e.optype?k=new ops.OpAddCursor:"ApplyStyle"===e.optype?k=new ops.OpApplyStyle:"InsertTable"===e.optype?k=new ops.OpInsertTable:"InsertText"===e.optype?k=new ops.OpInsertText:"RemoveText"===e.optype?k=new ops.OpRemoveText:"SplitParagraph"===e.optype?k=new ops.OpSplitParagraph:"SetParagraphStyle"===e.optype?k=new ops.OpSetParagraphStyle:"UpdateParagraphStyle"===e.optype?k=new ops.OpUpdateParagraphStyle:"CloneParagraphStyle"=== -e.optype?k=new ops.OpCloneParagraphStyle:"DeleteParagraphStyle"===e.optype?k=new ops.OpDeleteParagraphStyle:"MoveCursor"===e.optype?k=new ops.OpMoveCursor:"RemoveCursor"===e.optype&&(k=new ops.OpRemoveCursor);k&&k.init(e);return k}}; -// Input 48 -runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.OdfUtils"); -gui.SelectionMover=function(e,k){function l(){c.setUnfilteredPosition(e.getNode(),0);return c}function p(a,b,c){var d;c.setStart(a,b);d=c.getClientRects()[0];if(!d)if(d={},a.childNodes[b-1]){c.setStart(a,b-1);c.setEnd(a,b);b=c.getClientRects()[0];if(!b){for(c=b=0;a&&a.nodeType===Node.ELEMENT_NODE;)b+=a.offsetLeft-a.scrollLeft,c+=a.offsetTop-a.scrollTop,a=a.parentNode;b={top:c,left:b}}d.top=b.top;d.left=b.right;d.bottom=b.bottom}else a.nodeType===Node.TEXT_NODE?(a.previousSibling&&(d=a.previousSibling.getClientRects()[0]), -d||(c.setStart(a,0),c.setEnd(a,b),d=c.getClientRects()[0])):d=a.getClientRects()[0];return{top:d.top,left:d.left,bottom:d.bottom}}function r(a,b,c){var d=a,g=l(),f,h=k.ownerDocument.createRange(),n=e.getSelectedRange()?e.getSelectedRange().cloneRange():k.ownerDocument.createRange(),q;for(f=p(e.getNode(),0,h);0a?-1:1;for(a=Math.abs(a);0h?n.previousPosition():n.nextPosition());)if(U.check(),1===f.acceptPosition(n)&&(r+=1,q=n.container(),G=p(q,n.unfilteredDomOffset(),H),G.top!==Q)){if(G.top!==K&& -K!==Q)break;K=G.top;G=Math.abs(F-G.left);if(null===t||Ga?(f=c.previousPosition,n=-1):(f=c.nextPosition,n=1);for(h=p(c.container(),c.unfilteredDomOffset(),r);f.call(c);)if(b.acceptPosition(c)===NodeFilter.FILTER_ACCEPT){if(g.getParagraphElement(c.getCurrentNode())!== -d)break;q=p(c.container(),c.unfilteredDomOffset(),r);if(q.bottom!==h.bottom&&(h=q.top>=h.top&&q.bottomh.bottom,!h))break;e+=n;h=q}r.detach();return e}function n(a,b){for(var c=0,d;a.parentNode!==b;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(d=b.firstChild;d!==a;)c+=1,d=d.nextSibling;return c}function q(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=l(),e=d.container(),g=d.unfilteredDomOffset(), -f=0,h=new core.LoopWatchDog(1E3);d.setUnfilteredPosition(a,b);a=d.container();runtime.assert(Boolean(a),"SelectionMover.countStepsToPosition: positionIterator.container() returned null");b=d.unfilteredDomOffset();d.setUnfilteredPosition(e,g);var e=a,g=b,k=d.container(),p=d.unfilteredDomOffset();if(e===k)e=p-g;else{var q=e.compareDocumentPosition(k);2===q?q=-1:4===q?q=1:10===q?(g=n(e,k),q=ge)for(;d.nextPosition()&&(h.check(),1===c.acceptPosition(d)&&(f+=1),d.container()!== -a||d.unfilteredDomOffset()!==b););else if(0=e&&(f=-p.movePointBackward(-e,b));l.handleUpdate();return f};this.handleUpdate=function(){};this.getStepCounter=function(){return p.getStepCounter()};this.getMemberId=function(){return e};this.getNode=function(){return r.getNode()};this.getAnchorNode=function(){return r.getAnchorNode()};this.getSelectedRange=function(){return r.getSelectedRange()}; -this.getOdtDocument=function(){return k};r=new core.Cursor(k.getDOM(),e);p=new gui.SelectionMover(r,k.getRootNode())}; -// Input 50 -/* - - Copyright (C) 2012 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.EditInfo=function(e,k){function l(){var e=[],b;for(b in r)r.hasOwnProperty(b)&&e.push({memberid:b,time:r[b].time});e.sort(function(b,d){return b.time-d.time});return e}var p,r={};this.getNode=function(){return p};this.getOdtDocument=function(){return k};this.getEdits=function(){return r};this.getSortedEdits=function(){return l()};this.addEdit=function(e,b){var f,d=e.split("___")[0];if(!r[e])for(f in r)if(r.hasOwnProperty(f)&&f.split("___")[0]===d){delete r[f];break}r[e]={time:b}};this.clearEdits= -function(){r={}};p=k.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");e.insertBefore(p,e.firstChild)}; -// Input 51 -gui.Avatar=function(e,k){var l=this,p,r,h;this.setColor=function(b){r.style.borderColor=b};this.setImageUrl=function(b){l.isVisible()?r.src=b:h=b};this.isVisible=function(){return"block"===p.style.display};this.show=function(){h&&(r.src=h,h=void 0);p.style.display="block"};this.hide=function(){p.style.display="none"};this.markAsFocussed=function(b){p.className=b?"active":""};(function(){var b=e.ownerDocument,f=b.documentElement.namespaceURI;p=b.createElementNS(f,"div");r=b.createElementNS(f,"img"); -r.width=64;r.height=64;p.appendChild(r);p.style.width="64px";p.style.height="70px";p.style.position="absolute";p.style.top="-80px";p.style.left="-34px";p.style.display=k?"block":"none";e.appendChild(p)})()}; -// Input 52 -runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); -gui.Caret=function(e,k){function l(){f&&b.parentNode&&!d&&(d=!0,r.style.borderColor="transparent"===r.style.borderColor?a:"transparent",runtime.setTimeout(function(){d=!1;l()},500))}function p(a){var b;if("string"===typeof a){if(""===a)return 0;b=/^(\d+)(\.\d+)?px$/.exec(a);runtime.assert(null!==b,"size ["+a+"] does not have unit px.");return parseFloat(b[1])}return a}var r,h,b,f=!1,d=!1,a="";this.setFocus=function(){f=!0;h.markAsFocussed(!0);l()};this.removeFocus=function(){f=!1;h.markAsFocussed(!1); -r.style.borderColor=a};this.setAvatarImageUrl=function(a){h.setImageUrl(a)};this.setColor=function(b){a!==b&&(a=b,"transparent"!==r.style.borderColor&&(r.style.borderColor=a),h.setColor(a))};this.getCursor=function(){return e};this.getFocusElement=function(){return r};this.toggleHandleVisibility=function(){h.isVisible()?h.hide():h.show()};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.ensureVisible=function(){var a,b,d,c,f,h,k,m=e.getOdtDocument().getOdfCanvas().getElement().parentNode; -f=k=r;d=runtime.getWindow();runtime.assert(null!==d,"Expected to be run in an environment which has a global window, like a browser.");do{f=f.parentElement;if(!f)break;h=d.getComputedStyle(f,null)}while("block"!==h.display);h=f;f=c=0;if(h&&m){b=!1;do{d=h.offsetParent;for(a=h.parentNode;a!==d;){if(a===m){a=h;var l=m,x=0;b=0;var v=void 0,w=runtime.getWindow();for(runtime.assert(null!==w,"Expected to be run in an environment which has a global window, like a browser.");a&&a!==l;)v=w.getComputedStyle(a, -null),x+=p(v.marginLeft)+p(v.borderLeftWidth)+p(v.paddingLeft),b+=p(v.marginTop)+p(v.borderTopWidth)+p(v.paddingTop),a=a.parentElement;a=x;c+=a;f+=b;b=!0;break}a=a.parentNode}if(b)break;c+=p(h.offsetLeft);f+=p(h.offsetTop);h=d}while(h&&h!==m);d=c;c=f}else c=d=0;d+=k.offsetLeft;c+=k.offsetTop;f=d-5;h=c-5;d=d+k.scrollWidth-1+5;k=c+k.scrollHeight-1+5;hm.scrollTop+m.clientHeight-1&&(m.scrollTop=k-m.clientHeight+1);fm.scrollLeft+m.clientWidth- -1&&(m.scrollLeft=d-m.clientWidth+1)};(function(){var a=e.getOdtDocument().getDOM();r=a.createElementNS(a.documentElement.namespaceURI,"span");b=e.getNode();b.appendChild(r);h=new gui.Avatar(b,k)})()}; -// Input 53 -runtime.loadClass("core.EventNotifier"); -gui.ClickHandler=function(){function e(){l=0;p=null}var k,l=0,p=null,r=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(e,b){r.subscribe(e,b)};this.handleMouseUp=function(h){var b=runtime.getWindow();p&&p.x===h.screenX&&p.y===h.screenY?(l+=1,1===l?r.emit(gui.ClickHandler.signalSingleClick,void 0):2===l?r.emit(gui.ClickHandler.signalDoubleClick,void 0):3===l&&(b.clearTimeout(k),r.emit(gui.ClickHandler.signalTripleClick, -void 0),e())):(r.emit(gui.ClickHandler.signalSingleClick,void 0),l=1,p={x:h.screenX,y:h.screenY},b.clearTimeout(k),k=b.setTimeout(e,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); -// Input 54 -gui.Clipboard=function(){this.setDataFromRange=function(e,k){var l=!0,p,r=e.clipboardData,h=runtime.getWindow(),b,f;!r&&h&&(r=h.clipboardData);r?(h=new XMLSerializer,b=runtime.getDOMImplementation().createDocument("","",null),p=b.importNode(k.cloneContents(),!0),f=b.createElement("span"),f.appendChild(p),b.appendChild(f),p=r.setData("text/plain",k.toString()),l=l&&p,p=r.setData("text/html",h.serializeToString(b)),l=l&&p,e.preventDefault()):l=!1;return l}};(function(){return gui.Clipboard})(); -// Input 55 -runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpRemoveCursor");runtime.loadClass("ops.OpMoveCursor");runtime.loadClass("ops.OpInsertText");runtime.loadClass("ops.OpRemoveText");runtime.loadClass("ops.OpSplitParagraph");runtime.loadClass("ops.OpSetParagraphStyle");runtime.loadClass("gui.ClickHandler");runtime.loadClass("gui.Clipboard"); -gui.SessionController=function(){gui.SessionController=function(e,k){function l(a,b,c,d){var e="on"+b,g=!1;a.attachEvent&&(g=a.attachEvent(e,c));!g&&a.addEventListener&&(a.addEventListener(b,c,!1),g=!0);g&&!d||!a.hasOwnProperty(e)||(a[e]=c)}function p(a,b,c){var d="on"+b;a.detachEvent&&a.detachEvent(d,c);a.removeEventListener&&a.removeEventListener(b,c,!1);a[d]===c&&(a[d]=null)}function r(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function h(a){r(a)}function b(a,b){var c=e.getOdtDocument(), -d=gui.SelectionMover.createPositionIterator(c.getRootNode()),g=c.getOdfCanvas().getElement(),f;if(f=a){for(;f!==g&&!("urn:webodf:names:cursor"===f.namespaceURI&&"cursor"===f.localName||"urn:webodf:names:editinfo"===f.namespaceURI&&"editinfo"===f.localName);)if(f=f.parentNode,!f)return;f!==g&&a!==f&&(a=f.parentNode,b=Array.prototype.indexOf.call(a.childNodes,f));d.setUnfilteredPosition(a,b);return c.getDistanceFromCursor(k,d.container(),d.unfilteredDomOffset())}}function f(a){var b=new ops.OpMoveCursor, -c=e.getOdtDocument().getCursorPosition(k);b.init({memberid:k,position:c+a});return b}function d(a){var b=new ops.OpMoveCursor,c=e.getOdtDocument().getCursorSelection(k);b.init({memberid:k,position:c.position,length:c.length+a});return b}function a(a){var b=e.getOdtDocument(),c=b.getParagraphElement(b.getCursor(k).getNode()),d=null;runtime.assert(Boolean(c),"SessionController: Cursor outside paragraph");b=b.getCursor(k).getStepCounter().countLinesSteps(a,b.getPositionFilter());0!==b&&(a=e.getOdtDocument().getCursorSelection(k), -d=new ops.OpMoveCursor,d.init({memberid:k,position:a.position,length:a.length+b}));return d}function n(a){var b=e.getOdtDocument(),c=b.getParagraphElement(b.getCursor(k).getNode()),d=null;runtime.assert(Boolean(c),"SessionController: Cursor outside paragraph");a=b.getCursor(k).getStepCounter().countLinesSteps(a,b.getPositionFilter());0!==a&&(b=b.getCursorPosition(k),d=new ops.OpMoveCursor,d.init({memberid:k,position:b+a}));return d}function q(a){var b=e.getOdtDocument(),c=b.getCursorPosition(k),d= -null;a=b.getCursor(k).getStepCounter().countStepsToLineBoundary(a,b.getPositionFilter());0!==a&&(d=new ops.OpMoveCursor,d.init({memberid:k,position:c+a}));return d}function g(){var a=e.getOdtDocument(),b=gui.SelectionMover.createPositionIterator(a.getRootNode()),c=null;b.moveToEnd();b=a.getDistanceFromCursor(k,b.container(),b.unfilteredDomOffset());0!==b&&(a=a.getCursorSelection(k),c=new ops.OpMoveCursor,c.init({memberid:k,position:a.position,length:a.length+b}));return c}function c(){var a=e.getOdtDocument(), -b,c=null;b=a.getDistanceFromCursor(k,a.getRootNode(),0);0!==b&&(a=a.getCursorSelection(k),c=new ops.OpMoveCursor,c.init({memberid:k,position:a.position,length:a.length+b}));return c}function u(a){0>a.length&&(a.position+=a.length,a.length=-a.length);return a}function t(a){var b=new ops.OpRemoveText;b.init({memberid:k,position:a.position,length:a.length});return b}function s(){var a=e.getOdtDocument().getCursor(k),b=runtime.getWindow().getSelection();b.removeAllRanges();b.addRange(a.getSelectedRange().cloneRange())} -function m(b){var m=b.keyCode,h=null,l=!1;if(37===m)h=b.shiftKey?d(-1):f(-1),l=!0;else if(39===m)h=b.shiftKey?d(1):f(1),l=!0;else if(38===m){if(y&&b.altKey&&b.shiftKey||b.ctrlKey&&b.shiftKey){var l=e.getOdtDocument(),p=l.getParagraphElement(l.getCursor(k).getNode()),v,h=null;if(p){m=l.getDistanceFromCursor(k,p,0);v=gui.SelectionMover.createPositionIterator(l.getRootNode());for(v.setUnfilteredPosition(p,0);0===m&&v.previousPosition();)p=v.getCurrentNode(),O.isParagraph(p)&&(m=l.getDistanceFromCursor(k, -p,0));0!==m&&(l=l.getCursorSelection(k),h=new ops.OpMoveCursor,h.init({memberid:k,position:l.position,length:l.length+m}))}}else h=b.metaKey&&b.shiftKey?c():b.shiftKey?a(-1):n(-1);l=!0}else if(40===m){if(y&&b.altKey&&b.shiftKey||b.ctrlKey&&b.shiftKey){h=e.getOdtDocument();v=h.getParagraphElement(h.getCursor(k).getNode());m=null;if(v){l=gui.SelectionMover.createPositionIterator(h.getRootNode());l.moveToEndOfNode(v);for(v=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset());0===v&&l.nextPosition();)p= -l.getCurrentNode(),O.isParagraph(p)&&(l.moveToEndOfNode(p),v=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset()));0!==v&&(h=h.getCursorSelection(k),m=new ops.OpMoveCursor,m.init({memberid:k,position:h.position,length:h.length+v}))}h=m}else h=b.metaKey&&b.shiftKey?g():b.shiftKey?a(1):n(1);l=!0}else 36===m?(!y&&b.ctrlKey&&b.shiftKey?h=c():y&&b.metaKey||b.ctrlKey?(l=e.getOdtDocument(),h=null,m=l.getDistanceFromCursor(k,l.getRootNode(),0),0!==m&&(l=l.getCursorPosition(k),h=new ops.OpMoveCursor, -h.init({memberid:k,position:l+m,length:0}))):h=q(-1),l=!0):35===m?(!y&&b.ctrlKey&&b.shiftKey?h=g():y&&b.metaKey||b.ctrlKey?(h=e.getOdtDocument(),l=gui.SelectionMover.createPositionIterator(h.getRootNode()),m=null,l.moveToEnd(),l=h.getDistanceFromCursor(k,l.container(),l.unfilteredDomOffset()),0!==l&&(h=h.getCursorPosition(k),m=new ops.OpMoveCursor,m.init({memberid:k,position:h+l,length:0})),h=m):h=q(1),l=!0):8===m?(m=e.getOdtDocument(),h=u(m.getCursorSelection(k)),l=null,0===h.length?0 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.TrivialUserModel=function(){var e={bob:{memberid:"bob",fullname:"Bob Pigeon",color:"red",imageurl:"avatar-pigeon.png"},alice:{memberid:"alice",fullname:"Alice Bee",color:"green",imageurl:"avatar-flower.png"},you:{memberid:"you",fullname:"I, Robot",color:"blue",imageurl:"avatar-joe.png"}};this.getUserDetailsAndUpdates=function(k,l){var p=k.split("___")[0];l(k,e[p]||null)};this.unsubscribeUserDetailsUpdates=function(e,l){}}; -// Input 58 -ops.NowjsUserModel=function(){var e={},k={},l=runtime.getNetwork();this.getUserDetailsAndUpdates=function(p,r){var h=p.split("___")[0],b=e[h],f=k[h]=k[h]||[],d;runtime.assert(void 0!==r,"missing callback");for(d=0;d - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(e){};ops.OperationRouter.prototype.setPlaybackFunction=function(e){};ops.OperationRouter.prototype.push=function(e){}; -// Input 60 -/* - - Copyright (C) 2012 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -ops.TrivialOperationRouter=function(){var e,k;this.setOperationFactory=function(l){e=l};this.setPlaybackFunction=function(e){k=e};this.push=function(l){l=l.spec();l.timestamp=(new Date).getTime();l=e.create(l);k(l)}}; -// Input 61 -ops.NowjsOperationRouter=function(e,k){function l(a){var e;e=p.create(a);runtime.log(" op in: "+runtime.toJson(a));if(null!==e)if(a=Number(a.server_seq),runtime.assert(!isNaN(a),"server seq is not a number"),a===b+1)for(r(e),b=a,d=0,e=b+1;f.hasOwnProperty(e);e+=1)r(f[e]),delete f[e],runtime.log("op with server seq "+a+" taken from hold (reordered)");else runtime.assert(a!==b+1,"received incorrect order from server"),runtime.assert(!f.hasOwnProperty(a),"reorder_queue has incoming op"),runtime.log("op with server seq "+ -a+" put on hold"),f[a]=e;else runtime.log("ignoring invalid incoming opspec: "+a)}var p,r,h=runtime.getNetwork(),b=-1,f={},d=0,a=1E3;this.setOperationFactory=function(a){p=a};this.setPlaybackFunction=function(a){r=a};h.ping=function(a){null!==k&&a(k)};h.receiveOp=function(a,b){a===e&&l(b)};this.push=function(f){f=f.spec();runtime.assert(null!==k,"Router sequence N/A without memberid");a+=1;f.client_nonce="C:"+k+":"+a;f.parent_op=b+"+"+d;d+=1;runtime.log("op out: "+runtime.toJson(f));h.deliverOp(e, -f)};this.requestReplay=function(a){h.requestReplay(e,function(a){runtime.log("replaying: "+runtime.toJson(a));l(a)},function(b){runtime.log("replay done ("+b+" ops).");a&&a()})};(function(){h.memberid=k;h.joinSession(e,function(a){runtime.assert(a,"Trying to join a session which does not exists or where we are already in")})})()}; -// Input 62 -gui.EditInfoHandle=function(e){var k=[],l,p=e.ownerDocument,r=p.documentElement.namespaceURI;this.setEdits=function(e){k=e;var b,f,d,a;l.innerHTML="";for(e=0;ep?(l(1,0),f=l(0.5,1E4-p),d=l(0.2,2E4-p)):1E4<=p&&2E4>p?(l(0.5,0),d=l(0.2,2E4-p)):l(0.2,0)};this.getEdits=function(){return e.getEdits()};this.clearEdits=function(){e.clearEdits(); -h.setEdits([]);b.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&b.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return e};this.show=function(){b.style.display="block"};this.hide=function(){p.hideHandle();b.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};(function(){var a=e.getOdtDocument().getDOM();b=a.createElementNS(a.documentElement.namespaceURI,"div");b.setAttribute("class","editInfoMarker"); -b.onmouseover=function(){p.showHandle()};b.onmouseout=function(){p.hideHandle()};r=e.getNode();r.appendChild(b);h=new gui.EditInfoHandle(r);k||p.hide()})()}; -// Input 64 -/* - - Copyright (C) 2012 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoMarker"); -gui.SessionView=function(){return function(e,k,l){function p(a,b,c){c=c.split("___")[0];return a+"."+b+'[editinfo|memberid^="'+c+'"]'}function r(a,b,c){function d(b,c,e){e=p(b,c,a)+e;a:{var g=q.firstChild;for(b=p(b,c,a);g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=e:q.appendChild(document.createTextNode(e))}d("div","editInfoMarker","{ background-color: "+c+"; }");d("span","editInfoColor","{ background-color: "+c+"; }");d("span","editInfoAuthor", -':before { content: "'+b+'"; }')}function h(a){var b,c;for(c in g)g.hasOwnProperty(c)&&(b=g[c],a?b.show():b.hide())}function b(a){var b,c;for(c in n)n.hasOwnProperty(c)&&(b=n[c],a?b.showHandle():b.hideHandle())}function f(a,b){var c=n[a];void 0===b?runtime.log('UserModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),c&&(c.setAvatarImageUrl(b.imageurl),c.setColor(b.color)),r(a,b.fullname,b.color))}function d(a){var b= -l.createCaret(a,u);a=a.getMemberId();var c=k.getUserModel();n[a]=b;f(a,null);c.getUserDetailsAndUpdates(a,f);runtime.log("+++ View here +++ eagerly created an Caret for '"+a+"'! +++")}function a(a){var b=!1,c;delete n[a];for(c in g)if(g.hasOwnProperty(c)&&g[c].getEditInfo().getEdits().hasOwnProperty(a)){b=!0;break}b||k.getUserModel().unsubscribeUserDetailsUpdates(a,f)}var n={},q,g={},c=void 0!==e.editInfoMarkersInitiallyVisible?e.editInfoMarkersInitiallyVisible:!0,u=void 0!==e.caretAvatarsInitiallyVisible? -e.caretAvatarsInitiallyVisible:!0;this.showEditInfoMarkers=function(){c||(c=!0,h(c))};this.hideEditInfoMarkers=function(){c&&(c=!1,h(c))};this.showCaretAvatars=function(){u||(u=!0,b(u))};this.hideCaretAvatars=function(){u&&(u=!1,b(u))};this.getSession=function(){return k};this.getCaret=function(a){return n[a]};(function(){var b=k.getOdtDocument(),e=document.getElementsByTagName("head")[0];b.subscribe(ops.OdtDocument.signalCursorAdded,d);b.subscribe(ops.OdtDocument.signalCursorRemoved,a);b.subscribe(ops.OdtDocument.signalParagraphChanged, -function(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",h=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];h?(f=h.getAttributeNS("urn:webodf:names:editinfo","id"),e=g[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,k.getOdtDocument()),e=new gui.EditInfoMarker(e,c),h=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],h.setAttributeNS("urn:webodf:names:editinfo","id",f),g[f]=e);e.addEdit(d,new Date(a))});q=document.createElementNS(e.namespaceURI, -"style");q.type="text/css";q.media="screen, print, handheld, projection";q.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));e.appendChild(q)})()}}(); -// Input 65 -/* - - Copyright (C) 2012 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.Caret");gui.CaretFactory=function(e){this.createCaret=function(k,l){var p=k.getMemberId(),r=e.getSession().getOdtDocument(),h=r.getOdfCanvas().getElement(),b=new gui.Caret(k,l);p===e.getInputMemberId()&&(runtime.log("Starting to track input on new cursor of "+p),r.subscribe(ops.OdtDocument.signalParagraphChanged,function(e){e.memberId===p&&b.ensureVisible()}),k.handleUpdate=b.ensureVisible,h.setAttribute("tabindex",0),h.onfocus=b.setFocus,h.onblur=b.removeFocus,h.focus());return b}}; -// Input 66 -runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.Namespaces"); -gui.PresenterUI=function(){var e=new xmldom.XPath;return function(k){var l=this;l.setInitialSlideMode=function(){l.startSlideMode("single")};l.keyDownHandler=function(e){if(!e.target.isContentEditable&&"input"!==e.target.nodeName)switch(e.keyCode){case 84:l.toggleToolbar();break;case 37:case 8:l.prevSlide();break;case 39:case 32:l.nextSlide();break;case 36:l.firstSlide();break;case 35:l.lastSlide()}};l.root=function(){return l.odf_canvas.odfContainer().rootElement};l.firstSlide=function(){l.slideChange(function(e, -l){return 0})};l.lastSlide=function(){l.slideChange(function(e,l){return l-1})};l.nextSlide=function(){l.slideChange(function(e,l){return e+1e?-1:e-1})};l.slideChange=function(e){var k=l.getPages(l.odf_canvas.odfContainer().rootElement),h=-1,b=0;k.forEach(function(e){e=e[1];e.hasAttribute("slide_current")&&(h=b,e.removeAttribute("slide_current"));b+=1});e=e(h,k.length);-1===e&&(e=h);k[e][1].setAttribute("slide_current","1"); -document.getElementById("pagelist").selectedIndex=e;"cont"===l.slide_mode&&window.scrollBy(0,k[e][1].getBoundingClientRect().top-30)};l.selectSlide=function(e){l.slideChange(function(l,h){return e>=h||0>e?-1:e})};l.scrollIntoContView=function(e){var k=l.getPages(l.odf_canvas.odfContainer().rootElement);0!==k.length&&window.scrollBy(0,k[e][1].getBoundingClientRect().top-30)};l.getPages=function(e){e=e.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var l=[],h;for(h=0;h=a.rangeCount||!t)||(a=a.getRangeAt(0),t.setPoint(a.startContainer,a.startOffset))}function h(){var a=e.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();t&&t.node()&&(b=t.node(),c=b.ownerDocument.createRange(), -c.setStart(b,t.position()),c.collapse(!0),a.addRange(c))}function b(a){var b=a.charCode||a.keyCode;if(t=null,t&&37===b)r(),t.stepBackward(),h();else if(16<=b&&20>=b||33<=b&&40>=b)return;p(a)}function f(a){}function d(a){e.ownerDocument.defaultView.getSelection().getRangeAt(0);p(a)}function a(b){for(var c=b.firstChild;c&&c!==b;)c.nodeType===Node.ELEMENT_NODE&&a(c),c=c.nextSibling||c.parentNode;var d,e,g,c=b.attributes;d="";for(g=c.length-1;0<=g;g-=1)e=c.item(g),d=d+" "+e.nodeName+'="'+e.nodeValue+ -'"';b.setAttribute("customns_name",b.nodeName);b.setAttribute("customns_atts",d);c=b.firstChild;for(e=/^\s*$/;c&&c!==b;)d=c,c=c.nextSibling||c.parentNode,d.nodeType===Node.TEXT_NODE&&e.test(d.nodeValue)&&d.parentNode.removeChild(d)}function n(a,b){for(var c=a.firstChild,d,e,g;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(n(c,b),d=c.attributes,g=d.length-1;0<=g;g-=1)e=d.item(g),"http://www.w3.org/2000/xmlns/"!==e.namespaceURI||b[e.nodeValue]||(b[e.nodeValue]=e.localName);c=c.nextSibling||c.parentNode}} -function q(){var a=e.ownerDocument.createElement("style"),b;b={};n(e,b);var c={},d,f,h=0;for(d in b)if(b.hasOwnProperty(d)&&d){f=b[d];if(!f||c.hasOwnProperty(f)||"xmlns"===f){do f="ns"+h,h+=1;while(c.hasOwnProperty(f));b[d]=f}c[f]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+g;a.appendChild(e.ownerDocument.createTextNode(b));k=k.parentNode.replaceChild(a,k)}var g,c,u,t=null;e.id||(e.id="xml"+String(Math.random()).substring(2));c="#"+e.id+" ";g=c+"*,"+c+":visited, "+c+":link {display:block; margin: 0px; margin-left: 10px; font-size: medium; color: black; background: white; font-variant: normal; font-weight: normal; font-style: normal; font-family: sans-serif; text-decoration: none; white-space: pre-wrap; height: auto; width: auto}\n"+ -c+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+c+":after {color: blue; content: '';}\n"+c+"{overflow: auto;}\n";(function(a){l(a,"click",d);l(a,"keydown",b);l(a,"keypress",f);l(a,"drop",p);l(a,"dragend",p);l(a,"beforepaste",p);l(a,"paste",p)})(e);this.updateCSS=q;this.setXML=function(b){b=b.documentElement||b;u=b=e.ownerDocument.importNode(b,!0);for(a(b);e.lastChild;)e.removeChild(e.lastChild);e.appendChild(b);q();t=new core.PositionIterator(b)}; -this.getXML=function(){return u}}; -// Input 68 -/* - - Copyright (C) 2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(e,k){};gui.UndoManager.prototype.unsubscribe=function(e,k){};gui.UndoManager.prototype.setOdtDocument=function(e){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(e){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; -gui.UndoManager.prototype.moveForward=function(e){};gui.UndoManager.prototype.moveBackward=function(e){};gui.UndoManager.prototype.onOperationExecuted=function(e){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";(function(){return gui.UndoManager})(); -// Input 69 -/* - - Copyright (C) 2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -gui.UndoStateRules=function(){function e(e){switch(e.spec().optype){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.isEditOperation=e;this.isPartOfOperationSet=function(k,l){if(e(k)){if(0===l.length)return!0;var p;if(p=e(l[l.length-1]))a:{p=l.filter(e);var r=k.spec().optype,h;b:switch(r){case "RemoveText":case "InsertText":h=!0;break b;default:h=!1}if(h&&r===p[0].spec().optype){if(1===p.length){p=!0;break a}r=p[p.length-2].spec().position;p=p[p.length-1].spec().position; -h=k.spec().position;if(p===h-(p-r)){p=!0;break a}}p=!1}return p}return!0}}; -// Input 70 -/* - - Copyright (C) 2013 KO GmbH - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("gui.UndoManager");runtime.loadClass("gui.UndoStateRules"); -gui.TrivialUndoManager=function(){function e(){n.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:l.hasUndoStates(),redoAvailable:l.hasRedoStates()})}function k(){f!==r&&f!==d[d.length-1]&&d.push(f)}var l=this,p,r,h,b,f=[],d=[],a=[],n=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged]),q=new gui.UndoStateRules;this.subscribe=function(a,b){n.subscribe(a,b)};this.unsubscribe=function(a,b){n.unsubscribe(a,b)};this.hasUndoStates=function(){return 0 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("core.EventNotifier");runtime.loadClass("odf.OdfUtils"); -ops.OdtDocument=function(e){function k(){var a=e.odfContainer().getContentElement(),b=a&&a.localName;runtime.assert("text"===b,"Unsupported content element type '"+b+"'for OdtDocument");return a}function l(a){var b=gui.SelectionMover.createPositionIterator(k());for(a+=1;0=e;e+=1)c=b.container(),d=b.unfilteredDomOffset(),c.nodeType===Node.TEXT_NODE&&(" "===c.data[d]&&a.isSignificantWhitespace(c,d))&&h(c,d),b.nextPosition()};this.getParagraphStyleElement=r;this.getParagraphElement=p;this.getParagraphStyleAttributes= -function(a){return(a=r(a))?e.getFormatting().getInheritedStyleAttributes(a):null};this.getPositionInTextNode=function(a,b){var e=gui.SelectionMover.createPositionIterator(k()),f=null,h,m=0,l=null;runtime.assert(0<=a,"position must be >= 0");1===d.acceptPosition(e)?(h=e.container(),h.nodeType===Node.TEXT_NODE&&(f=h,m=0)):a+=1;for(;0 - - @licstart - The JavaScript code in this page is free software: you can redistribute it - and/or modify it under the terms of the GNU Affero General Public License - (GNU AGPL) as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. The code is distributed - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. - - As additional permission under GNU AGPL version 3 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU GPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - As a special exception to the AGPL, any HTML file which merely makes function - calls to this code, and for that purpose includes it by reference shall be - deemed a separate work for copyright law purposes. In addition, the copyright - holders of this code give you permission to combine this code with free - software libraries that are released under the GNU LGPL. You may copy and - distribute such a system following the terms of the GNU AGPL for this code - and the LGPL for the libraries. If you modify this code, you may extend this - exception to your version of the code, but you are not obligated to do so. - If you do not wish to do so, delete this exception statement from your - version. - - This license applies to this entire compilation. - @licend - @source: http://www.webodf.org/ - @source: http://gitorious.org/webodf/webodf/ -*/ -runtime.loadClass("ops.TrivialUserModel");runtime.loadClass("ops.TrivialOperationRouter");runtime.loadClass("ops.OperationFactory");runtime.loadClass("ops.OdtDocument"); -ops.Session=function(e){var k=new ops.OdtDocument(e),l=new ops.TrivialUserModel,p=null;this.setUserModel=function(e){l=e};this.setOperationRouter=function(e){p=e;e.setPlaybackFunction(function(e){e.execute(k);k.emit(ops.OdtDocument.signalOperationExecuted,e)});e.setOperationFactory(new ops.OperationFactory)};this.getUserModel=function(){return l};this.getOdtDocument=function(){return k};this.enqueue=function(e){p.push(e)};this.setOperationRouter(new ops.TrivialOperationRouter)}; -// Input 73 -var webodf_css="@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);\n@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);\n@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);\n@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);\n@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);\n@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);\n@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);\n@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);\n@namespace runtimens url(urn:webodf); /* namespace for runtime only */\n@namespace cursor url(urn:webodf:names:cursor);\n@namespace editinfo url(urn:webodf:names:editinfo);\n\noffice|document > *, office|document-content > * {\n display: none;\n}\noffice|body, office|document {\n display: inline-block;\n position: relative;\n}\n\ntext|p, text|h {\n display: block;\n padding: 0;\n margin: 0;\n line-height: normal;\n position: relative;\n min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[runtimens|containsparagraphanchor] {\n position: relative;\n}\ntext|s {\n white-space: pre;\n}\ntext|tab {\n display: inline;\n white-space: pre;\n}\ntext|line-break {\n content: \" \";\n display: block;\n}\ntext|tracked-changes {\n /*Consumers that do not support change tracking, should ignore changes.*/\n display: none;\n}\noffice|binary-data {\n display: none;\n}\noffice|text {\n display: block;\n text-align: left;\n overflow: visible;\n word-wrap: break-word;\n}\n\noffice|text::selection {\n /** Let's not draw selection highlight that overflows into the office|text\n * node when selecting content across several paragraphs\n */\n background: transparent;\n}\n\noffice|spreadsheet {\n display: block;\n border-collapse: collapse;\n empty-cells: show;\n font-family: sans-serif;\n font-size: 10pt;\n text-align: left;\n page-break-inside: avoid;\n overflow: hidden;\n}\noffice|presentation {\n display: inline-block;\n text-align: left;\n}\n#shadowContent {\n display: inline-block;\n text-align: left;\n}\ndraw|page {\n display: block;\n position: relative;\n overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\n display: none;\n}\n@media print {\n draw|page {\n border: 1pt solid black;\n page-break-inside: avoid;\n }\n presentation|notes {\n /*TODO*/\n }\n}\noffice|spreadsheet text|p {\n border: 0px;\n padding: 1px;\n margin: 0px;\n}\noffice|spreadsheet table|table {\n margin: 3px;\n}\noffice|spreadsheet table|table:after {\n /* show sheet name the end of the sheet */\n /*content: attr(table|name);*/ /* gives parsing error in opera */\n}\noffice|spreadsheet table|table-row {\n counter-increment: row;\n}\noffice|spreadsheet table|table-row:before {\n width: 3em;\n background: #cccccc;\n border: 1px solid black;\n text-align: center;\n content: counter(row);\n display: table-cell;\n}\noffice|spreadsheet table|table-cell {\n border: 1px solid #cccccc;\n}\ntable|table {\n display: table;\n}\ndraw|frame table|table {\n width: 100%;\n height: 100%;\n background: white;\n}\ntable|table-header-rows {\n display: table-header-group;\n}\ntable|table-row {\n display: table-row;\n}\ntable|table-column {\n display: table-column;\n}\ntable|table-cell {\n width: 0.889in;\n display: table-cell;\n word-break: break-all; /* prevent long words from extending out the table cell */\n}\ndraw|frame {\n display: block;\n}\ndraw|image {\n display: block;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n -moz-background-size: 100% 100%;\n}\n/* only show the first image in frame */\ndraw|frame > draw|image:nth-of-type(n+2) {\n display: none;\n}\ntext|list:before {\n display: none;\n content:\"\";\n}\ntext|list {\n counter-reset: list;\n}\ntext|list-item {\n display: block;\n}\ntext|number {\n display:none;\n}\n\ntext|a {\n color: blue;\n text-decoration: underline;\n cursor: pointer;\n}\ntext|note-citation {\n vertical-align: super;\n font-size: smaller;\n}\ntext|note-body {\n display: none;\n}\ntext|note:hover text|note-citation {\n background: #dddddd;\n}\ntext|note:hover text|note-body {\n display: block;\n left:1em;\n max-width: 80%;\n position: absolute;\n background: #ffffaa;\n}\nsvg|title, svg|desc {\n display: none;\n}\nvideo {\n width: 100%;\n height: 100%\n}\n\n/* below set up the cursor */\ncursor|cursor {\n display: inline;\n width: 0px;\n height: 1em;\n /* making the position relative enables the avatar to use\n the cursor as reference for its absolute position */\n position: relative;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n height: 1em;\n border-left: 2px solid black;\n outline: none;\n}\n\ncursor|cursor > div {\n padding: 3px;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n border: none !important;\n border-radius: 5px;\n opacity: 0.3;\n}\n\ncursor|cursor > div > img {\n border-radius: 5px;\n}\n\ncursor|cursor > div.active {\n opacity: 0.8;\n}\n\ncursor|cursor > div:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n"; +list:["list-item"]},s=[[m,"color","color"],[m,"background-color","background-color"],[m,"font-weight","font-weight"],[m,"font-style","font-style"]],x=[[r,"repeat","background-repeat"]],w=[[m,"background-color","background-color"],[m,"text-align","text-align"],[m,"text-indent","text-indent"],[m,"padding","padding"],[m,"padding-left","padding-left"],[m,"padding-right","padding-right"],[m,"padding-top","padding-top"],[m,"padding-bottom","padding-bottom"],[m,"border-left","border-left"],[m,"border-right", +"border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"margin","margin"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"],[m,"border","border"]],B=[[m,"background-color","background-color"],[m,"min-height","min-height"],[p,"stroke","border"],[b,"stroke-color","border-color"],[b,"stroke-width","border-width"],[m,"border","border"],[m,"border-left","border-left"],[m,"border-right","border-right"], +[m,"border-top","border-top"],[m,"border-bottom","border-bottom"]],I=[[m,"background-color","background-color"],[m,"border-left","border-left"],[m,"border-right","border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"border","border"]],C=[[r,"column-width","width"]],F=[[r,"row-height","height"],[m,"keep-together",null]],J=[[r,"width","width"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"]], +N=[[m,"background-color","background-color"],[m,"padding","padding"],[m,"padding-left","padding-left"],[m,"padding-right","padding-right"],[m,"padding-top","padding-top"],[m,"padding-bottom","padding-bottom"],[m,"border","border"],[m,"border-left","border-left"],[m,"border-right","border-right"],[m,"border-top","border-top"],[m,"border-bottom","border-bottom"],[m,"margin","margin"],[m,"margin-left","margin-left"],[m,"margin-right","margin-right"],[m,"margin-top","margin-top"],[m,"margin-bottom","margin-bottom"]], +K=[[m,"page-width","width"],[m,"page-height","height"]],H={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},z={margin:!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"margin-bottom":!0},Z={},T=odf.OdfUtils,G,U,aa,P=xmldom.XPath,D=new core.CSSUnits;this.style2css=function(b,a,c,e,d){function g(b,a){f="@namespace "+b+" url("+a+");";try{c.insertRule(f,c.cssRules.length)}catch(e){}}var f,h,n;for(U=a;c.cssRules.length;)c.deleteRule(c.cssRules.length- +1);odf.Namespaces.forEachPrefix(g);g("webodfhelper","urn:webodf:names:helper");Z=e;G=b;aa=runtime.getWindow().getComputedStyle(document.body,null).getPropertyValue("font-size")||"12pt";for(n in y)if(y.hasOwnProperty(n))for(h in b=d[n],b)b.hasOwnProperty(h)&&q(c,n,h,b[h])}};(function(){function f(k,a){var d=this;this.getDistance=function(a){var f=d.x-a.x;a=d.y-a.y;return Math.sqrt(f*f+a*a)};this.getCenter=function(a){return new f((d.x+a.x)/2,(d.y+a.y)/2)};d.x=k;d.y=a}gui.ZoomHelper=function(){function k(b,a,c,d){b=d?"translate3d("+b+"px, "+a+"px, 0) scale3d("+c+", "+c+", 1)":"translate("+b+"px, "+a+"px) scale("+c+")";e.style.WebkitTransform=b;e.style.MozTransform=b;e.style.msTransform=b;e.style.OTransform=b;e.style.transform=b}function a(b){b?k(-n.x,-n.y,t,!0):(k(0, +0,t,!0),k(0,0,t,!1))}function d(b){if(s&&C){var a=s.style.overflow,c=s.classList.contains("webodf-customScrollbars");b&&c||!b&&!c||(b?(s.classList.add("webodf-customScrollbars"),s.style.overflow="hidden",runtime.requestAnimationFrame(function(){s.style.overflow=a})):s.classList.remove("webodf-customScrollbars"))}}function c(){k(-n.x,-n.y,t,!0);s.scrollLeft=0;s.scrollTop=0;F=x.style.overflow;x.style.overflow="visible";d(!1)}function h(){k(0,0,t,!0);s.scrollLeft=n.x;s.scrollTop=n.y;x.style.overflow= +F||"";d(!0)}function q(b){return new f(b.pageX-e.offsetLeft,b.pageY-e.offsetTop)}function p(b){g&&(n.x-=b.x-g.x,n.y-=b.y-g.y,n=new f(Math.min(Math.max(n.x,e.offsetLeft),(e.offsetLeft+e.offsetWidth)*t-s.clientWidth),Math.min(Math.max(n.y,e.offsetTop),(e.offsetTop+e.offsetHeight)*t-s.clientHeight)));g=b}function m(b){var a=b.touches.length,e=0v&&(b=v);for(c=Math.floor(b/a)*a;!e&&0<=c;)e=g[c],c-=a;for(e=e||y;e.nextBookmark&&e.nextBookmark.steps<= +b;)d.check(),e=e.nextBookmark;runtime.assert(-1===b||e.steps<=b,"Bookmark @"+q(e)+" at step "+e.steps+" exceeds requested step of "+b);return e}function b(b){b.previousBookmark&&(b.previousBookmark.nextBookmark=b.nextBookmark);b.nextBookmark&&(b.nextBookmark.previousBookmark=b.previousBookmark)}function e(b){for(var a,c=null;!c&&b&&b!==k;)(a=m(b))&&(c=u[a])&&c.node!==b&&(runtime.log("Cloned node detected. Creating new bookmark"),c=null,b.removeAttributeNS(n,"nodeId")),b=b.parentNode;return c}var n= +"urn:webodf:names:steps",g={},u={},t=core.DomUtils,y,v,s=Node.DOCUMENT_POSITION_FOLLOWING,x=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(e,d){var f,h=Math.ceil(e/a)*a,n,p,q;if(void 0!==v&&vn.steps)g[h]=p;w()};this.setToClosestStep=function(b,a){var c;w();c=r(b);c.setIteratorPosition(a); +return c.steps};this.setToClosestDomPoint=function(b,a,c){var d,f;w();if(b===k&&0===a)d=y;else if(b===k&&a===k.childNodes.length)for(f in d=y,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>d.steps&&(d=b));else if(d=e(b.childNodes.item(a)||b),!d)for(c.setUnfilteredPosition(b,a);!d&&c.previousNode();)d=e(c.getCurrentNode());d=d||y;void 0!==v&&d.steps>v&&(d=r(v));d.setIteratorPosition(c);return d.steps};this.damageCacheAfterStep=function(b){0>b&&(b=-1);void 0===v?v=b:bb)throw new RangeError("Requested steps is negative ("+ +b+")");q();for(d=l.setToClosestStep(b,e);db.comparePoints(m,0,d,g),d=m,g=g?0:m.childNodes.length);e.setUnfilteredPosition(d,g);p(e,f)||e.setUnfilteredPosition(d,g);f=e.container();g=e.unfilteredDomOffset(); +d=l.setToClosestDomPoint(f,g,e);if(0>b.comparePoints(e.container(),e.unfilteredDomOffset(),f,g))return 0=l.textNode.length?null:l.textNode.splitText(l.offset));for(e=l.textNode;e!==b;){e=e.parentNode;n=e.cloneNode(!1);g&&n.appendChild(g);if(u)for(;u&&u.nextSibling;)n.appendChild(u.nextSibling);else for(;e.firstChild;)n.appendChild(e.firstChild);e.parentNode.insertBefore(n,e.nextSibling);u=e;g=n}q.isListItem(g)&&(g=g.childNodes.item(0));h?g.setAttributeNS(p,"text:style-name",h):g.removeAttributeNS(p,"style-name");0===l.textNode.length&& +l.textNode.parentNode.removeChild(l.textNode);a.emit(ops.OdtDocument.signalStepsInserted,{position:d});t&&c&&(a.moveCursor(f,d+1,0),a.emit(ops.Document.signalCursorMoved,t));a.fixCursorPositions();a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:f,timeStamp:k});a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});a.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph", +memberid:f,timestamp:k,position:d,sourceParagraphPosition:a,paragraphStyleName:h,moveCursor:c}}};ops.OpUpdateMember=function(){function f(a){var c="//dc:creator[@editinfo:memberid='"+k+"']";a=xmldom.XPath.getODFElementsWithXPath(a.getRootNode(),c,function(a){return"editinfo"===a?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(a)});for(c=0;c=h.width&&(h=null),f.detach();else if(k.isCharacterElement(c.container)||k.isCharacterFrame(c.container))h=d.getBoundingClientRect(c.container); +return h}var k=odf.OdfUtils,a=new odf.StepUtils,d=core.DomUtils,c=core.StepDirection.NEXT,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,q=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=f;this.moveToFilteredStep=function(a,d,k){function r(b,a){a.process(v,g,u)&&(b=!0,!t&&a.token&&(t=a.token));return b}var b=d===c,e,n,g,u,t,y=a.snapshot();e=!1;var v;do e=f(a),v={token:a.snapshot(),container:a.container,offset:a.offset,direction:d,visualDirection:d===c?h:q},n=a.nextStep()?f(a):null,a.restore(v.token), +b?(g=e,u=n):(g=n,u=e),e=k.reduce(r,!1);while(!e&&a.advanceStep(d));e||k.forEach(function(b){!t&&b.token&&(t=b.token)});a.restore(t||y);return Boolean(t)}};gui.Caret=function(f,k,a,d){function c(){r.style.opacity="0"===r.style.opacity?"1":"0";x.trigger()}function h(){g.selectNodeContents(n);return g.getBoundingClientRect()}function q(){Object.keys(C).forEach(function(b){F[b]=C[b]})}function p(){if(!1===C.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!d&&!f.getSelectedRange().collapsed)C.visibility="hidden",r.style.visibility="hidden",x.cancel();else if(C.visibility="visible",r.style.visibility="visible",!1===C.isFocused)r.style.opacity= +"1",x.cancel();else{if(w||F.visibility!==C.visibility)r.style.opacity="1",x.cancel();x.trigger()}if(I||B){var a;a=f.getNode();var c,g,n=t.getBoundingClientRect(u.getSizer()),m=!1,p=0;a.removeAttributeNS("urn:webodf:names:cursor","caret-sizer-active");if(0a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});l.style.height=a.height+"px";l.style.top=a.top+"px";l.style.left=a.right- +a.width+"px";l.style.width=a.width?a.width+"px":"";e&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?e.style.font=a.font:(e.style.fontStyle=a.fontStyle,e.style.fontVariant=a.fontVariant,e.style.fontWeight=a.fontWeight,e.style.fontSize=a.fontSize,e.style.lineHeight=a.lineHeight,e.style.fontFamily=a.fontFamily))}C.isShown&&B&&k.scrollIntoView(r.getBoundingClientRect());F.isFocused!==C.isFocused&&b.markAsFocussed(C.isFocused);q();I=B=w=!1}function m(b){l.parentNode.removeChild(l);n.parentNode.removeChild(n); +b()}var l,r,b,e,n,g,u=f.getDocument().getCanvas(),t=core.DomUtils,y=new gui.GuiStepUtils,v,s,x,w=!1,B=!1,I=!1,C={isFocused:!1,isShown:!0,visibility:"hidden"},F={isFocused:!C.isFocused,isShown:!C.isShown,visibility:"hidden"};this.handleUpdate=function(){I=!0;s.trigger()};this.refreshCursorBlinking=function(){w=!0;s.trigger()};this.setFocus=function(){C.isFocused=!0;s.trigger()};this.removeFocus=function(){C.isFocused=!1;s.trigger()};this.show=function(){C.isShown=!0;s.trigger()};this.hide=function(){C.isShown= +!1;s.trigger()};this.setAvatarImageUrl=function(a){b.setImageUrl(a)};this.setColor=function(a){r.style.borderColor=a;b.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return r};this.toggleHandleVisibility=function(){b.isVisible()?b.hide():b.show()};this.showHandle=function(){b.show()};this.hideHandle=function(){b.hide()};this.setOverlayElement=function(b){e=b;l.appendChild(b);I=!0;s.trigger()};this.ensureVisible=function(){B=!0;s.trigger()};this.getBoundingClientRect= +function(){return t.getBoundingClientRect(l)};this.destroy=function(a){core.Async.destroyAll([s.destroy,x.destroy,b.destroy,m],a)};(function(){var e=f.getDocument(),d=[e.createRootFilter(f.getMemberId()),e.getPositionFilter()],h=e.getDOMDocument();g=h.createRange();n=h.createElement("span");n.className="webodf-caretSizer";n.textContent="|";f.getNode().appendChild(n);l=h.createElement("div");l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());l.className="webodf-caretOverlay"; +r=h.createElement("div");r.className="caret";l.appendChild(r);b=new gui.Avatar(l,a);u.getSizer().appendChild(l);v=e.createStepIterator(f.getNode(),0,d,e.getRootNode());s=core.Task.createRedrawTask(p);x=core.Task.createTimeoutTask(c,500);s.triggerImmediate()})()};odf.TextSerializer=function(){function f(d){var c="",h=k.filter?k.filter.acceptNode(d):NodeFilter.FILTER_ACCEPT,q=d.nodeType,p;if((h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)&&a.isTextContentContainingNode(d))for(p=d.firstChild;p;)c+=f(p),p=p.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(q===Node.ELEMENT_NODE&&a.isParagraph(d)?c+="\n":q===Node.TEXT_NODE&&d.textContent&&(c+=d.textContent));return c}var k=this,a=odf.OdfUtils;this.filter=null;this.writeToString=function(a){if(!a)return""; +a=f(a);"\n"===a[a.length-1]&&(a=a.substr(0,a.length-1));return a}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,a){var d;d=a.startContainer.ownerDocument.createElement("span");d.appendChild(a.cloneContents());d=f.writeToString(d);try{k.setData("text/plain",d)}catch(c){k.setData("Text",d)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,a){var d,c=k.clipboardData;d=runtime.getWindow();!c&&d&&(c=d.clipboardData);c?(d=!0,f.exportRangeToDataTransfer(c,a),k.preventDefault()):d=!1;return d}};gui.SessionContext=function(f,k){var a=f.getOdtDocument(),d=odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var c=a.getCursor(k),f;if(!c)return!1;f=c&&c.getNode();c=a.getMember(k).getProperties().fullName;return(f=d.getParentAnnotation(f,a.getRootNode()))&&d.getAnnotationCreator(f)===c?!0:!1}};gui.StyleSummary=function(f){function k(a,d){var k=a+"|"+d,m;c.hasOwnProperty(k)||(m=[],f.forEach(function(c){c=(c=c.styleProperties[a])&&c[d];-1===m.indexOf(c)&&m.push(c)}),c[k]=m);return c[k]}function a(a,c,d){return function(){var f=k(a,c);return d.length>=f.length&&f.every(function(a){return-1!==d.indexOf(a)})}}function d(a,c){var d=k(a,c);return 1===d.length?d[0]:void 0}var c={};this.getPropertyValues=k;this.getCommonValue=d;this.isBold=a("style:text-properties","fo:font-weight",["bold"]);this.isItalic= +a("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=a("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=a("style:text-properties","style:text-line-through-style",["solid"]);this.fontSize=function(){var a=d("style:text-properties","fo:font-size");return a&&parseFloat(a)};this.fontName=function(){return d("style:text-properties","style:font-name")};this.isAlignedLeft=a("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter= +a("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=a("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=a("style:paragraph-properties","fo:text-align",["justify"]);this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName};this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight, +isAlignedJustified:this.isAlignedJustified}};gui.DirectFormattingController=function(f,k,a,d,c,h,q){function p(){return V.value().styleSummary}function m(){return V.value().enabledFeatures}function l(b){var a;b.collapsed?(a=b.startContainer,a.hasChildNodes()&&b.startOffsetb.clientWidth||b.scrollHeight>b.clientHeight)&&a.push(new r(b)),b=b.parentNode;a.push(new l(s));return a}function v(){var b; +g()||(b=y(C),t(),C.focus(),b.forEach(function(b){b.restore()}))}var s=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},B={},I={},C,F=f.getCanvas().getElement(),J=this,N={};this.addFilter=function(a,c){b(a,!0).filters.push(c)};this.removeFilter=function(a,c){var e=b(a,!0),d=e.filters.indexOf(c);-1!==d&&e.filters.splice(d,1)};this.subscribe=e;this.unsubscribe=n;this.hasFocus=g;this.focus=v;this.getEventTrap=function(){return C}; +this.setEditing=function(b){var a=g();a&&C.blur();b?C.removeAttribute("readOnly"):C.setAttribute("readOnly","true");a&&v()};this.destroy=function(b){n("touchstart",m);Object.keys(N).forEach(function(b){d(parseInt(b,10))});N.length=0;Object.keys(B).forEach(function(b){B[b].destroy()});B={};n("mousedown",u);n("mouseup",t);n("contextmenu",t);Object.keys(I).forEach(function(b){I[b].destroy()});I={};C.parentNode.removeChild(C);b()};(function(){var b=f.getOdfCanvas().getSizer(),c=b.ownerDocument;runtime.assert(Boolean(s), +"EventManager requires a window object to operate correctly");C=c.createElement("textarea");C.id="eventTrap";C.setAttribute("tabindex","-1");C.setAttribute("readOnly","true");C.setAttribute("rows","1");b.appendChild(C);e("mousedown",u);e("mouseup",t);e("contextmenu",t);B.longpress=new a("longpress",["touchstart","touchmove","touchend"],h);B.drag=new a("drag",["touchstart","touchmove","touchend"],q);B.dragstop=new a("dragstop",["drag","touchend"],p);e("touchstart",m)})()};gui.IOSSafariSupport=function(f){function k(){a.innerHeight!==a.outerHeight&&(d.style.display="none",runtime.requestAnimationFrame(function(){d.style.display="block"}))}var a=runtime.getWindow(),d=f.getEventTrap();this.destroy=function(a){f.unsubscribe("focus",k);d.removeAttribute("autocapitalize");d.style.WebkitTransform="";a()};f.subscribe("focus",k);d.setAttribute("autocapitalize","off");d.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,a,d){function c(){var c=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(c=a.isLocalCursorWithinOwnAnnotation());c!==l&&(l=c,m.emit(gui.HyperlinkController.enabledChanged,l))}function h(a){a.getMemberId()===d&&c()}var q=odf.OdfUtils,p=f.getOdtDocument(),m=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),l=!1;this.isEnabled=function(){return l};this.subscribe=function(a,b){m.subscribe(a,b)};this.unsubscribe=function(a,b){m.unsubscribe(a, +b)};this.addHyperlink=function(a,b){if(l){var c=p.getCursorSelection(d),h=new ops.OpApplyHyperlink,g=[];if(0===c.length||b)b=b||a,h=new ops.OpInsertText,h.init({memberid:d,position:c.position,text:b}),c.length=b.length,g.push(h);h=new ops.OpApplyHyperlink;h.init({memberid:d,position:c.position,length:c.length,hyperlink:a});g.push(h);f.enqueue(g)}};this.removeHyperlinks=function(){if(l){var a=p.createPositionIterator(p.getRootNode()),b=p.getCursor(d).getSelectedRange(),c=q.getHyperlinkElements(b), +h=b.collapsed&&1===c.length,g=p.getDOMDocument().createRange(),k=[],m,y;0!==c.length&&(c.forEach(function(b){g.selectNodeContents(b);m=p.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});y=new ops.OpRemoveHyperlink;y.init({memberid:d,position:m.position,length:m.length});k.push(y)}),h||(h=c[0],-1===b.comparePoint(h,0)&&(g.setStart(h,0),g.setEnd(b.startContainer,b.startOffset),m=p.convertDomToCursorRange({anchorNode:g.startContainer, +anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0h.width&&(q=h.width/k.width);k.height>h.height&&(s=h.height/k.height);h=Math.min(q,s);k={width:k.width*h,height:k.height* +h}}h=k.width+"px";k=k.height+"px";var x=l.getOdfCanvas().odfContainer().rootElement.styles,q=a.toLowerCase(),s=p.hasOwnProperty(q)?p[q]:null,w,q=[];runtime.assert(null!==s,"Image type is not supported: "+a);s="Pictures/"+c.generateImageName()+s;w=new ops.OpSetBlob;w.init({memberid:d,filename:s,mimetype:a,content:e});q.push(w);b.getStyleElement("Graphics","graphic",[x])||(a=new ops.OpAddStyle,a.init({memberid:d,styleName:"Graphics",styleFamily:"graphic",isAutomaticStyle:!1,setProperties:{"style:graphic-properties":{"text:anchor-type":"paragraph", +"svg:x":"0cm","svg:y":"0cm","style:wrap":"dynamic","style:number-wrapped-paragraphs":"no-limit","style:wrap-contour":"false","style:vertical-pos":"top","style:vertical-rel":"paragraph","style:horizontal-pos":"center","style:horizontal-rel":"paragraph"}}}),q.push(a));a=c.generateStyleName();e=new ops.OpAddStyle;e.init({memberid:d,styleName:a,styleFamily:"graphic",isAutomaticStyle:!0,setProperties:{"style:parent-style-name":"Graphics","style:graphic-properties":{"style:vertical-pos":"top","style:vertical-rel":"baseline", +"style:horizontal-pos":"center","style:horizontal-rel":"paragraph","fo:background-color":"transparent","style:background-transparency":"100%","style:shadow":"none","style:mirror":"none","fo:clip":"rect(0cm, 0cm, 0cm, 0cm)","draw:luminance":"0%","draw:contrast":"0%","draw:red":"0%","draw:green":"0%","draw:blue":"0%","draw:gamma":"100%","draw:color-inversion":"false","draw:image-opacity":"100%","draw:color-mode":"standard"}}});q.push(e);w=new ops.OpInsertImage;w.init({memberid:d,position:l.getCursorPosition(d), +filename:s,frameWidth:h,frameHeight:k,frameStyleName:a,frameName:c.generateFrameName()});q.push(w);f.enqueue(q)}};this.destroy=function(b){l.unsubscribe(ops.Document.signalCursorMoved,q);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);b()};l.subscribe(ops.Document.signalCursorMoved,q);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var a=f.getSizer(),h=c.createElement("div");h.id="imageSelector";h.style.borderWidth="1px";a.appendChild(h);d.forEach(function(a){var d=c.createElement("div");d.className=a;h.appendChild(d)});return h}var a=odf.Namespaces.svgns,d="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),c=f.getElement().ownerDocument,h=!1;this.select=function(d){var p,m,l=c.getElementById("imageSelector");l||(l=k());h=!0;p=l.parentNode; +m=d.getBoundingClientRect();var r=p.getBoundingClientRect(),b=f.getZoomLevel();p=(m.left-r.left)/b-1;m=(m.top-r.top)/b-1;l.style.display="block";l.style.left=p+"px";l.style.top=m+"px";l.style.width=d.getAttributeNS(a,"width");l.style.height=d.getAttributeNS(a,"height")};this.clearSelection=function(){var a;h&&(a=c.getElementById("imageSelector"))&&(a.style.display="none");h=!1};this.isSelectorElement=function(a){var d=c.getElementById("imageSelector");return d?a===d||a.parentNode===d:!1}};(function(){function f(f){function a(a){q=a.which&&String.fromCharCode(a.which)===h;h=void 0;return!1===q}function d(){q=!1}function c(a){h=a.data;q=!1}var h,q=!1;this.destroy=function(h){f.unsubscribe("textInput",d);f.unsubscribe("compositionend",c);f.removeFilter("keypress",a);h()};f.subscribe("textInput",d);f.subscribe("compositionend",c);f.addFilter("keypress",a)}gui.InputMethodEditor=function(k,a){function d(a){e&&(a?e.getNode().setAttributeNS(b,"composing","true"):(e.getNode().removeAttributeNS(b, +"composing"),u.textContent=""))}function c(){y&&(y=!1,d(!1),s.emit(gui.InputMethodEditor.signalCompositionEnd,{data:v}),v="")}function h(){C||(C=!0,c(),e&&e.getSelectedRange().collapsed?n.value="":n.value=w.writeToString(e.getSelectedRange().cloneContents()),n.setSelectionRange(0,n.value.length),C=!1)}function q(){a.hasFocus()&&t.trigger()}function p(){x=void 0;t.cancel();d(!0);y||s.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function m(b){b=x=b.data;y=!0;v+=b;t.trigger()}function l(b){b.data!== +x&&(b=b.data,y=!0,v+=b,t.trigger());x=void 0}function r(){u.textContent=n.value}var b="urn:webodf:names:cursor",e=null,n=a.getEventTrap(),g=n.ownerDocument,u,t,y=!1,v="",s=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),x,w,B=[],I,C=!1;this.subscribe=s.subscribe;this.unsubscribe=s.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(e=b,e.getNode().appendChild(u),b.subscribe(ops.OdtCursor.signalCursorUpdated,q),a.subscribe("input", +r),a.subscribe("compositionupdate",r))};this.removeCursor=function(b){e&&b===k&&(e.getNode().removeChild(u),e.unsubscribe(ops.OdtCursor.signalCursorUpdated,q),a.unsubscribe("input",r),a.unsubscribe("compositionupdate",r),e=null)};this.destroy=function(b){a.unsubscribe("compositionstart",p);a.unsubscribe("compositionend",m);a.unsubscribe("textInput",l);a.unsubscribe("keypress",c);a.unsubscribe("focus",h);core.Async.destroyAll(I,b)};(function(){w=new odf.TextSerializer;w.filter=new odf.OdfNodeFilter; +a.subscribe("compositionstart",p);a.subscribe("compositionend",m);a.subscribe("textInput",l);a.subscribe("keypress",c);a.subscribe("focus",h);B.push(new f(a));I=B.map(function(b){return b.destroy});u=g.createElement("span");u.setAttribute("id","composer");t=core.Task.createTimeoutTask(h,1);I.push(t.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function a(a){h.emit(gui.MetadataController.signalMetadataChanged,a)}function d(a){var c=-1===q.indexOf(a);c||runtime.log("Setting "+a+" is restricted.");return c}var c=f.getOdtDocument(),h=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),q=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(a,c){var h={},q="",b;a&&Object.keys(a).filter(d).forEach(function(b){h[b]=a[b]}); +c&&(q=c.filter(d).join(","));if(0c:!1}function a(a){null!==a&&!1===k(a)&&(c=Math.abs(a-f))}var d=this,c,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(c,f,m){var l,r;c.visualDirection===h?(l=f&&f.right,r=m&&m.left):(l=f&&f.left,r=m&&m.right);if(k(l)||k(r))return!0;if(f||m)a(l),a(r),d.token=c.token;return!1}};gui.LineBoundaryScanner=function(){var f=this,k=null;this.token=void 0;this.process=function(a,d,c){var h;if(h=c)if(k){var q=k;h=Math.min(q.bottom-q.top,c.bottom-c.top);var p=Math.max(q.top,c.top),q=Math.min(q.bottom,c.bottom)-p;h=0.4>=(0a?b.previousSibling:b.nextSibling,c(h)===NodeFilter.FILTER_ACCEPT&&(e=h),b=b.parentNode;return e}function d(b,a){var e;return null===b?n.NO_NEIGHBOUR:q.isCharacterElement(b)?n.SPACE_CHAR:b.nodeType===c||q.isTextSpan(b)||q.isHyperlink(b)?(e=b.textContent.charAt(a()),m.test(e)?n.SPACE_CHAR:p.test(e)?n.PUNCTUATION_CHAR:n.WORD_CHAR):n.OTHER}var c=Node.TEXT_NODE,h=Node.ELEMENT_NODE, +q=odf.OdfUtils,p=/[!-#%-*,-\/:-;?-@\[-\]_{}\u00a1\u00ab\u00b7\u00bb\u00bf;\u00b7\u055a-\u055f\u0589-\u058a\u05be\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964-\u0965\u0970\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u104a-\u104f\u10fb\u1361-\u1368\u166d-\u166e\u169b-\u169c\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944-\u1945\u19de-\u19df\u1a1e-\u1a1f\u1b5a-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u206e\u207d-\u207e\u208d-\u208e\u3008-\u3009\u2768-\u2775\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2cf9-\u2cfc\u2cfe-\u2cff\u2e00-\u2e7e\u3000-\u303f\u30a0\u30fb\ua60d-\ua60f\ua673\ua67e\ua874-\ua877\ua8ce-\ua8cf\ua92e-\ua92f\ua95f\uaa5c-\uaa5f\ufd3e-\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]|\ud800[\udd00-\udd01\udf9f\udfd0]|\ud802[\udd1f\udd3f\ude50-\ude58]|\ud809[\udc00-\udc7e]/, +m=/\s/,l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT,b=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,e=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,n={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(c){var f=c.container(),m=c.leftNode(),q=c.rightNode(),p=c.unfilteredDomOffset,s=function(){return c.unfilteredDomOffset()-1};f.nodeType===h&&(null===q&&(q=a(f,1,c.getNodeFilter())),null===m&&(m= +a(f,-1,c.getNodeFilter())));f!==q&&(p=function(){return 0});f!==m&&null!==m&&(s=function(){return m.textContent.length-1});f=d(m,s);q=d(q,p);return f===n.WORD_CHAR&&q===n.WORD_CHAR||f===n.PUNCTUATION_CHAR&&q===n.PUNCTUATION_CHAR||k===b&&f!==n.NO_NEIGHBOUR&&q===n.SPACE_CHAR||k===e&&f===n.SPACE_CHAR&&q!==n.NO_NEIGHBOUR?r:l}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function a(b){var a=b.spec();if(b.isEdit||a.memberid===k)I=void 0,C.cancel()}function d(){var b=t.getCursor(k).getNode();return t.createStepIterator(b,0,[s,w],t.getRootElement(b))}function c(b,a,c){c=new odf.WordBoundaryFilter(t,c);var e=t.getRootElement(b)||t.getRootNode(),d=t.createRootFilter(e);return t.createStepIterator(b,a,[s,d,c],e)}function h(b,a){return a?{anchorNode:b.startContainer,anchorOffset:b.startOffset,focusNode:b.endContainer,focusOffset:b.endOffset}: +{anchorNode:b.endContainer,anchorOffset:b.endOffset,focusNode:b.startContainer,focusOffset:b.startOffset}}function q(b,a,c){var e=new ops.OpMoveCursor;e.init({memberid:k,position:b,length:a||0,selectionType:c});return e}function p(b,a,c){var e;e=t.getCursor(k);e=h(e.getSelectedRange(),e.hasForwardSelection());e.focusNode=b;e.focusOffset=a;c||(e.anchorNode=e.focusNode,e.anchorOffset=e.focusOffset);b=t.convertDomToCursorRange(e);f.enqueue([q(b.position,b.length)])}function m(b){var a;a=c(b.startContainer, +b.startOffset,F);a.roundToPreviousStep()&&b.setStart(a.container(),a.offset());a=c(b.endContainer,b.endOffset,J);a.roundToNextStep()&&b.setEnd(a.container(),a.offset())}function l(b){var a=v.getParagraphElements(b),c=a[0],a=a[a.length-1];c&&b.setStart(c,0);a&&(v.isParagraph(b.endContainer)&&0===b.endOffset?b.setEndBefore(a):b.setEnd(a,a.childNodes.length))}function r(b,a,c,e){var d,f;e?(d=c.startContainer,f=c.startOffset):(d=c.endContainer,f=c.endOffset);y.containsNode(b,d)||(f=0>y.comparePoints(b, +0,d,f)?0:b.childNodes.length,d=b);b=t.createStepIterator(d,f,a,v.getParagraphElement(d)||b);b.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");e?c.setStart(b.container(),b.offset()):c.setEnd(b.container(),b.offset())}function b(b,a){var c=d();c.advanceStep(b)&&p(c.container(),c.offset(),a)}function e(b,a){var c,e=I,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===e&&B&&(e=B());isNaN(e)||(c=d(),x.moveToFilteredStep(c,b,f)&&c.advanceStep(b)&&(f=[new gui.ClosestXOffsetScanner(e), +new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,b,f)&&(p(c.container(),c.offset(),a),I=e,C.restart())))}function n(b,a){var c=d(),e=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,b,e)&&p(c.container(),c.offset(),a)}function g(b,a){var e=t.getCursor(k),e=h(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,F);e.advanceStep(b)&&p(e.container(),e.offset(),a)}function u(b,a,c){var e=!1,d=t.getCursor(k), +d=h(d.getSelectedRange(),d.hasForwardSelection()),e=t.getRootElement(d.focusNode);runtime.assert(Boolean(e),"SelectionController: Cursor outside root");d=t.createStepIterator(d.focusNode,d.focusOffset,[s,w],e);d.roundToClosestStep();d.advanceStep(b)&&(c=c(d.container()))&&(b===N?(d.setPosition(c,0),e=d.roundToNextStep()):(d.setPosition(c,c.childNodes.length),e=d.roundToPreviousStep()),e&&p(d.container(),d.offset(),a))}var t=f.getOdtDocument(),y=core.DomUtils,v=odf.OdfUtils,s=t.getPositionFilter(), +x=new gui.GuiStepUtils,w=t.createRootFilter(k),B=null,I,C,F=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,J=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,N=core.StepDirection.PREVIOUS,K=core.StepDirection.NEXT;this.selectionToRange=function(b){var a=0<=y.comparePoints(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),c=b.focusNode.ownerDocument.createRange();a?(c.setStart(b.anchorNode,b.anchorOffset),c.setEnd(b.focusNode,b.focusOffset)):(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode, +b.anchorOffset));return{range:c,hasForwardSelection:a}};this.rangeToSelection=h;this.selectImage=function(b){var a=t.getRootElement(b),c=t.createRootFilter(a),a=t.createStepIterator(b,0,[c,t.getPositionFilter()],a),e;a.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");c=a.container();e=a.offset();a.setPosition(b,b.childNodes.length);a.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");b=t.convertDomToCursorRange({anchorNode:c,anchorOffset:e,focusNode:a.container(), +focusOffset:a.offset()});b=q(b.position,b.length,ops.OdtCursor.RegionSelection);f.enqueue([b])};this.expandToWordBoundaries=m;this.expandToParagraphBoundaries=l;this.selectRange=function(b,a,c){var e=t.getOdfCanvas().getElement(),d,g=[s];d=y.containsNode(e,b.startContainer);e=y.containsNode(e,b.endContainer);if(d||e)if(d&&e&&(2===c?m(b):3<=c&&l(b)),(c=a?t.getRootElement(b.startContainer):t.getRootElement(b.endContainer))||(c=t.getRootNode()),g.push(t.createRootFilter(c)),r(c,g,b,!0),r(c,g,b,!1),b= +h(b,a),a=t.convertDomToCursorRange(b),b=t.getCursorSelection(k),a.position!==b.position||a.length!==b.length)b=q(a.position,a.length,ops.OdtCursor.RangeSelection),f.enqueue([b])};this.moveCursorToLeft=function(){b(N,!1);return!0};this.moveCursorToRight=function(){b(K,!1);return!0};this.extendSelectionToLeft=function(){b(N,!0);return!0};this.extendSelectionToRight=function(){b(K,!0);return!0};this.setCaretXPositionLocator=function(b){B=b};this.moveCursorUp=function(){e(N,!1);return!0};this.moveCursorDown= +function(){e(K,!1);return!0};this.extendSelectionUp=function(){e(N,!0);return!0};this.extendSelectionDown=function(){e(K,!0);return!0};this.moveCursorBeforeWord=function(){g(N,!1);return!0};this.moveCursorPastWord=function(){g(K,!1);return!0};this.extendSelectionBeforeWord=function(){g(N,!0);return!0};this.extendSelectionPastWord=function(){g(K,!0);return!0};this.moveCursorToLineStart=function(){n(N,!1);return!0};this.moveCursorToLineEnd=function(){n(K,!1);return!0};this.extendSelectionToLineStart= +function(){n(N,!0);return!0};this.extendSelectionToLineEnd=function(){n(K,!0);return!0};this.extendSelectionToParagraphStart=function(){u(N,!0,v.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){u(K,!0,v.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){u(N,!1,v.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){u(K,!1,v.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){u(N,!1,t.getRootElement);return!0}; +this.moveCursorToDocumentEnd=function(){u(K,!1,t.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){u(N,!0,t.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){u(K,!0,t.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var b=t.getCursor(k),b=t.getRootElement(b.getNode()),a,c,e;runtime.assert(Boolean(b),"SelectionController: Cursor outside root");e=t.createStepIterator(b,0,[s,w],b);e.roundToClosestStep();a=e.container();c=e.offset(); +e.setPosition(b,b.childNodes.length);e.roundToClosestStep();b=t.convertDomToCursorRange({anchorNode:a,anchorOffset:c,focusNode:e.container(),focusOffset:e.offset()});f.enqueue([q(b.position,b.length)]);return!0};this.destroy=function(b){t.unsubscribe(ops.OdtDocument.signalOperationStart,a);core.Async.destroyAll([C.destroy],b)};(function(){C=core.Task.createTimeoutTask(function(){I=void 0},2E3);t.subscribe(ops.OdtDocument.signalOperationStart,a)})()};gui.TextController=function(f,k,a,d,c,h){function q(){u=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?a.isLocalCursorWithinOwnAnnotation():!0}function p(b){b.getMemberId()===d&&q()}function m(b,a,c){var d=[e.getPositionFilter()];c&&d.push(e.createRootFilter(b.startContainer));c=e.createStepIterator(b.startContainer,b.startOffset,d,a);c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");a=e.convertDomPointToCursorStep(c.container(),c.offset()); +b.collapsed?b=a:(c.setPosition(b.endContainer,b.endOffset),c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),b=e.convertDomPointToCursorStep(c.container(),c.offset()));return{position:a,length:b-a}}function l(b){var a,c,e,f=n.getParagraphElements(b),h=b.cloneRange(),k=[];a=f[0];1b.length&&(b.position+=b.length,b.length=-b.length);return b}function b(b){if(!u)return!1;var a,c=e.getCursor(d).getSelectedRange().cloneRange(), +g=r(e.getCursorSelection(d)),h;if(0===g.length){g=void 0;a=e.getCursor(d).getNode();h=e.getRootElement(a);var k=[e.getPositionFilter(),e.createRootFilter(h)];h=e.createStepIterator(a,0,k,h);h.roundToClosestStep()&&(b?h.nextStep():h.previousStep())&&(g=r(e.convertDomToCursorRange({anchorNode:a,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),b?(c.setStart(a,0),c.setEnd(h.container(),h.offset())):(c.setStart(h.container(),h.offset()),c.setEnd(a,0)))}g&&f.enqueue(l(c));return void 0!== +g}var e=f.getOdtDocument(),n=odf.OdfUtils,g=core.DomUtils,u=!1,t=odf.Namespaces.textns,y=core.StepDirection.NEXT;this.isEnabled=function(){return u};this.enqueueParagraphSplittingOps=function(){if(!u)return!1;var b=e.getCursor(d),a=b.getSelectedRange(),c=r(e.getCursorSelection(d)),g=[],b=n.getParagraphElement(b.getNode()),k=b.getAttributeNS(t,"style-name")||"";0e.left&&(e=x(d)))a.focusNode=e.container,a.focusOffset=e.offset,c&&(a.anchorNode=a.focusNode,a.anchorOffset=a.focusOffset)}else D.isImage(a.focusNode.firstChild)&&1===a.focusOffset&&D.isCharacterFrame(a.focusNode)&&(e=x(a.focusNode))&&(a.anchorNode=a.focusNode=e.container,a.anchorOffset=a.focusOffset=e.offset);a.anchorNode&&a.focusNode&&(a=W.selectionToRange(a),W.selectRange(a.range,a.hasForwardSelection,0===b.button?b.detail:0));M.focus()}function B(b){var a;if(a=q(b.clientX,b.clientY))b= +a.container,a=a.offset,b={anchorNode:b,anchorOffset:a,focusNode:b,focusOffset:a},b=W.selectionToRange(b),W.selectRange(b.range,b.hasForwardSelection,2),M.focus()}function I(b){var a=h(b),c,e,f;la.processRequests();Y&&(D.isImage(a)&&D.isCharacterFrame(a.parentNode)&&T.getSelection().isCollapsed?(W.selectImage(a.parentNode),M.focus()):ka.isSelectorElement(a)?M.focus():X?(a=d.getSelectedRange(),e=a.collapsed,D.isImage(a.endContainer)&&0===a.endOffset&&D.isCharacterFrame(a.endContainer.parentNode)&&(f= +a.endContainer.parentNode,f=x(f))&&(a.setEnd(f.container,f.offset),e&&a.collapse(!1)),W.selectRange(a,d.hasForwardSelection(),0===b.button?b.detail:0),M.focus()):ta?w(b):(c=P.cloneEvent(b),da=runtime.setTimeout(function(){w(c)},0)),na=0,X=Y=!1)}function C(b){var c=G.getCursor(a).getSelectedRange();c.collapsed||Q.exportRangeToDataTransfer(b.dataTransfer,c)}function F(){Y&&M.focus();na=0;X=Y=!1}function J(b){I(b)}function N(b){var a=h(b),c=null;"annotationRemoveButton"===a.className?(runtime.assert(ea, +"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),c=a.parentNode.getElementsByTagNameNS(odf.Namespaces.officens,"annotation").item(0),ha.removeAnnotation(c),M.focus()):"webodf-draggable"!==a.getAttribute("class")&&I(b)}function K(b){(b=b.data)&&(-1===b.indexOf("\n")?fa.insertText(b):ga.paste(b))}function H(b){return function(){b();return!0}}function z(b){return function(c){return G.getCursor(a).getSelectionType()===ops.OdtCursor.RangeSelection? +b(c):!0}}function Z(b){M.unsubscribe("keydown",A.handleEvent);M.unsubscribe("keypress",V.handleEvent);M.unsubscribe("keyup",ba.handleEvent);M.unsubscribe("copy",l);M.unsubscribe("mousedown",s);M.unsubscribe("mousemove",la.trigger);M.unsubscribe("mouseup",N);M.unsubscribe("contextmenu",J);M.unsubscribe("dragstart",C);M.unsubscribe("dragend",F);M.unsubscribe("click",oa.handleClick);M.unsubscribe("longpress",B);M.unsubscribe("drag",t);M.unsubscribe("dragstop",y);G.unsubscribe(ops.OdtDocument.signalOperationEnd, +ma.trigger);G.unsubscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.unsubscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.unsubscribe(ops.OdtDocument.signalOperationEnd,e);b()}var T=runtime.getWindow(),G=k.getOdtDocument(),U=new gui.SessionConstraints,aa=new gui.SessionContext(k,a),P=core.DomUtils,D=odf.OdfUtils,Q=new gui.MimeDataExporter,$=new gui.Clipboard(Q),A=new gui.KeyboardHandler,V=new gui.KeyboardHandler,ba=new gui.KeyboardHandler,Y=!1,E=new odf.ObjectNameGenerator(G.getOdfCanvas().odfContainer(), +a),X=!1,R=null,da,S=null,M=new gui.EventManager(G),ea=c.annotationsEnabled,ha=new gui.AnnotationController(k,U,a),ca=new gui.DirectFormattingController(k,U,aa,a,E,c.directTextStylingEnabled,c.directParagraphStylingEnabled),fa=new gui.TextController(k,U,aa,a,ca.createCursorStyleOp,ca.createParagraphStyleOps),pa=new gui.ImageController(k,U,aa,a,E),ka=new gui.ImageSelector(G.getOdfCanvas()),ia=G.createPositionIterator(G.getRootNode()),la,ma,ga=new gui.PasteController(k,U,aa,a),ja=new gui.InputMethodEditor(a, +M),na=0,oa=new gui.HyperlinkClickHandler(G.getOdfCanvas().getElement,A,ba),sa=new gui.HyperlinkController(k,U,aa,a),W=new gui.SelectionController(k,a),ua=new gui.MetadataController(k,a),L=gui.KeyboardHandler.Modifier,O=gui.KeyboardHandler.KeyCode,qa=-1!==T.navigator.appVersion.toLowerCase().indexOf("mac"),ta=-1!==["iPad","iPod","iPhone"].indexOf(T.navigator.platform),ra;runtime.assert(null!==T,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo= +u;this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(a),"Inserting local cursor a second time.");var b=new ops.OpAddCursor;b.init({memberid:a});k.enqueue([b]);M.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(a),"Removing local cursor without inserting before.");var b=new ops.OpRemoveCursor;b.init({memberid:a});k.enqueue([b])};this.startEditing=function(){ja.subscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection); +ja.subscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.subscribe("beforecut",m);M.subscribe("cut",p);M.subscribe("beforepaste",b);M.subscribe("paste",r);S&&S.initialize();M.setEditing(!0);oa.setModifier(qa?L.Meta:L.Ctrl);A.bind(O.Backspace,L.None,H(fa.removeTextByBackspaceKey),!0);A.bind(O.Delete,L.None,fa.removeTextByDeleteKey);A.bind(O.Tab,L.None,z(function(){fa.insertText("\t");return!0}));qa?(A.bind(O.Clear,L.None,fa.removeCurrentSelection),A.bind(O.B,L.Meta,z(ca.toggleBold)),A.bind(O.I, +L.Meta,z(ca.toggleItalic)),A.bind(O.U,L.Meta,z(ca.toggleUnderline)),A.bind(O.L,L.MetaShift,z(ca.alignParagraphLeft)),A.bind(O.E,L.MetaShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.MetaShift,z(ca.alignParagraphRight)),A.bind(O.J,L.MetaShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.MetaShift,ha.addAnnotation),A.bind(O.Z,L.Meta,g),A.bind(O.Z,L.MetaShift,u)):(A.bind(O.B,L.Ctrl,z(ca.toggleBold)),A.bind(O.I,L.Ctrl,z(ca.toggleItalic)),A.bind(O.U,L.Ctrl,z(ca.toggleUnderline)),A.bind(O.L,L.CtrlShift, +z(ca.alignParagraphLeft)),A.bind(O.E,L.CtrlShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.CtrlShift,z(ca.alignParagraphRight)),A.bind(O.J,L.CtrlShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.CtrlAlt,ha.addAnnotation),A.bind(O.Z,L.Ctrl,g),A.bind(O.Z,L.CtrlShift,u));V.setDefault(z(function(b){var a;a=null===b.which||void 0===b.which?String.fromCharCode(b.keyCode):0!==b.which&&0!==b.charCode?String.fromCharCode(b.which):null;return!a||b.altKey||b.ctrlKey||b.metaKey?!1:(fa.insertText(a),!0)})); +V.bind(O.Enter,L.None,z(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ja.unsubscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);ja.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.unsubscribe("cut",p);M.unsubscribe("beforecut",m);M.unsubscribe("paste",r);M.unsubscribe("beforepaste",b);M.setEditing(!1);oa.setModifier(L.None);A.bind(O.Backspace,L.None,function(){return!0},!0);A.unbind(O.Delete,L.None);A.unbind(O.Tab,L.None);qa?(A.unbind(O.Clear, +L.None),A.unbind(O.B,L.Meta),A.unbind(O.I,L.Meta),A.unbind(O.U,L.Meta),A.unbind(O.L,L.MetaShift),A.unbind(O.E,L.MetaShift),A.unbind(O.R,L.MetaShift),A.unbind(O.J,L.MetaShift),ea&&A.unbind(O.C,L.MetaShift),A.unbind(O.Z,L.Meta),A.unbind(O.Z,L.MetaShift)):(A.unbind(O.B,L.Ctrl),A.unbind(O.I,L.Ctrl),A.unbind(O.U,L.Ctrl),A.unbind(O.L,L.CtrlShift),A.unbind(O.E,L.CtrlShift),A.unbind(O.R,L.CtrlShift),A.unbind(O.J,L.CtrlShift),ea&&A.unbind(O.C,L.CtrlAlt),A.unbind(O.Z,L.Ctrl),A.unbind(O.Z,L.CtrlShift));V.setDefault(null); +V.unbind(O.Enter,L.None)};this.getInputMemberId=function(){return a};this.getSession=function(){return k};this.getSessionConstraints=function(){return U};this.setUndoManager=function(b){S&&S.unsubscribe(gui.UndoManager.signalUndoStackChanged,n);if(S=b)S.setDocument(G),S.setPlaybackFunction(k.enqueue),S.subscribe(gui.UndoManager.signalUndoStackChanged,n)};this.getUndoManager=function(){return S};this.getMetadataController=function(){return ua};this.getAnnotationController=function(){return ha};this.getDirectFormattingController= +function(){return ca};this.getHyperlinkClickHandler=function(){return oa};this.getHyperlinkController=function(){return sa};this.getImageController=function(){return pa};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return M};this.getKeyboardHandlers=function(){return{keydown:A,keypress:V}};this.destroy=function(b){var a=[la.destroy,ma.destroy,ca.destroy,ja.destroy,M.destroy,oa.destroy,sa.destroy,ua.destroy,W.destroy, +fa.destroy,Z];ra&&a.unshift(ra.destroy);runtime.clearTimeout(da);core.Async.destroyAll(a,b)};la=core.Task.createRedrawTask(v);ma=core.Task.createRedrawTask(function(){var b=G.getCursor(a);if(b&&b.getSelectionType()===ops.OdtCursor.RegionSelection&&(b=D.getImageElements(b.getSelectedRange())[0])){ka.select(b.parentNode);return}ka.clearSelection()});A.bind(O.Left,L.None,z(W.moveCursorToLeft));A.bind(O.Right,L.None,z(W.moveCursorToRight));A.bind(O.Up,L.None,z(W.moveCursorUp));A.bind(O.Down,L.None,z(W.moveCursorDown)); +A.bind(O.Left,L.Shift,z(W.extendSelectionToLeft));A.bind(O.Right,L.Shift,z(W.extendSelectionToRight));A.bind(O.Up,L.Shift,z(W.extendSelectionUp));A.bind(O.Down,L.Shift,z(W.extendSelectionDown));A.bind(O.Home,L.None,z(W.moveCursorToLineStart));A.bind(O.End,L.None,z(W.moveCursorToLineEnd));A.bind(O.Home,L.Ctrl,z(W.moveCursorToDocumentStart));A.bind(O.End,L.Ctrl,z(W.moveCursorToDocumentEnd));A.bind(O.Home,L.Shift,z(W.extendSelectionToLineStart));A.bind(O.End,L.Shift,z(W.extendSelectionToLineEnd));A.bind(O.Up, +L.CtrlShift,z(W.extendSelectionToParagraphStart));A.bind(O.Down,L.CtrlShift,z(W.extendSelectionToParagraphEnd));A.bind(O.Home,L.CtrlShift,z(W.extendSelectionToDocumentStart));A.bind(O.End,L.CtrlShift,z(W.extendSelectionToDocumentEnd));qa?(A.bind(O.Left,L.Alt,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Alt,z(W.moveCursorPastWord)),A.bind(O.Left,L.Meta,z(W.moveCursorToLineStart)),A.bind(O.Right,L.Meta,z(W.moveCursorToLineEnd)),A.bind(O.Home,L.Meta,z(W.moveCursorToDocumentStart)),A.bind(O.End,L.Meta, +z(W.moveCursorToDocumentEnd)),A.bind(O.Left,L.AltShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.AltShift,z(W.extendSelectionPastWord)),A.bind(O.Left,L.MetaShift,z(W.extendSelectionToLineStart)),A.bind(O.Right,L.MetaShift,z(W.extendSelectionToLineEnd)),A.bind(O.Up,L.AltShift,z(W.extendSelectionToParagraphStart)),A.bind(O.Down,L.AltShift,z(W.extendSelectionToParagraphEnd)),A.bind(O.Up,L.MetaShift,z(W.extendSelectionToDocumentStart)),A.bind(O.Down,L.MetaShift,z(W.extendSelectionToDocumentEnd)), +A.bind(O.A,L.Meta,z(W.extendSelectionToEntireDocument))):(A.bind(O.Left,L.Ctrl,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Ctrl,z(W.moveCursorPastWord)),A.bind(O.Left,L.CtrlShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.CtrlShift,z(W.extendSelectionPastWord)),A.bind(O.A,L.Ctrl,z(W.extendSelectionToEntireDocument)));ta&&(ra=new gui.IOSSafariSupport(M));M.subscribe("keydown",A.handleEvent);M.subscribe("keypress",V.handleEvent);M.subscribe("keyup",ba.handleEvent);M.subscribe("copy",l);M.subscribe("mousedown", +s);M.subscribe("mousemove",la.trigger);M.subscribe("mouseup",N);M.subscribe("contextmenu",J);M.subscribe("dragstart",C);M.subscribe("dragend",F);M.subscribe("click",oa.handleClick);M.subscribe("longpress",B);M.subscribe("drag",t);M.subscribe("dragstop",y);G.subscribe(ops.OdtDocument.signalOperationEnd,ma.trigger);G.subscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.subscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.subscribe(ops.OdtDocument.signalOperationEnd,e)}})();gui.CaretManager=function(f,k){function a(a){return h.hasOwnProperty(a)?h[a]:null}function d(){return Object.keys(h).map(function(a){return h[a]})}function c(a){var c=h[a];c&&(delete h[a],a===f.getInputMemberId()?(p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.ensureVisible),p.unsubscribe(ops.Document.signalCursorMoved,c.refreshCursorBlinking),m.unsubscribe("compositionupdate",c.handleUpdate),m.unsubscribe("compositionend",c.handleUpdate),m.unsubscribe("focus",c.setFocus),m.unsubscribe("blur", +c.removeFocus),q.removeEventListener("focus",c.show,!1),q.removeEventListener("blur",c.hide,!1)):p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.handleUpdate),c.destroy(function(){}))}var h={},q=runtime.getWindow(),p=f.getSession().getOdtDocument(),m=f.getEventManager();this.registerCursor=function(a,c,b){var e=a.getMemberId();a=new gui.Caret(a,k,c,b);h[e]=a;e===f.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+e),p.subscribe(ops.OdtDocument.signalProcessingBatchEnd, +a.ensureVisible),p.subscribe(ops.Document.signalCursorMoved,a.refreshCursorBlinking),m.subscribe("compositionupdate",a.handleUpdate),m.subscribe("compositionend",a.handleUpdate),m.subscribe("focus",a.setFocus),m.subscribe("blur",a.removeFocus),q.addEventListener("focus",a.show,!1),q.addEventListener("blur",a.hide,!1),a.setOverlayElement(m.getEventTrap())):p.subscribe(ops.OdtDocument.signalProcessingBatchEnd,a.handleUpdate);return a};this.getCaret=a;this.getCarets=d;this.destroy=function(a){var k= +d().map(function(b){return b.destroy});f.getSelectionController().setCaretXPositionLocator(null);p.unsubscribe(ops.Document.signalCursorRemoved,c);h={};core.Async.destroyAll(k,a)};f.getSelectionController().setCaretXPositionLocator(function(){var c=a(f.getInputMemberId()),d;c&&(d=c.getBoundingClientRect());return d?d.right:void 0});p.subscribe(ops.Document.signalCursorRemoved,c)};gui.EditInfoHandle=function(f){var k=[],a,d=f.ownerDocument,c=d.documentElement.namespaceURI;this.setEdits=function(f){k=f;var q,p,m,l;a.innerHTML="";for(f=0;fe?(p=a(1,0),m=a(0.5,1E4-e),l=a(0.2,2E4-e)):1E4<=e&&2E4>e?(p=a(0.5,0),l=a(0.2,2E4-e)):p=a(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits= +function(){f.clearEdits();h.setEdits([]);q.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&q.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){q.style.display="block"};this.hide=function(){d.hideHandle();q.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(a){runtime.clearTimeout(p);runtime.clearTimeout(m);runtime.clearTimeout(l);c.removeChild(q); +h.destroy(function(b){b?a(b):f.destroy(a)})};(function(){var a=f.getOdtDocument().getDOMDocument();q=a.createElementNS(a.documentElement.namespaceURI,"div");q.setAttribute("class","editInfoMarker");q.onmouseover=function(){d.showHandle()};q.onmouseout=function(){d.hideHandle()};c=f.getNode();c.appendChild(q);h=new gui.EditInfoHandle(c);k||d.hide()})()};gui.HyperlinkTooltipView=function(f,k){var a=core.DomUtils,d=odf.OdfUtils,c=runtime.getWindow(),h,q,p;runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(m){var l=m.target||m.srcElement,r=f.getSizer(),b=f.getZoomLevel(),e;a:{for(;l;){if(d.isHyperlink(l))break a;if(d.isParagraph(l)||d.isInlineRoot(l))break;l=l.parentNode}l=null}if(l){a.containsNode(r,p)||r.appendChild(p);e=q;var n;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:n= +runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:n=runtime.tr("\u2318-click to follow link");break;default:n=""}e.textContent=n;h.textContent=d.getHyperlinkTarget(l);p.style.display="block";e=c.innerWidth-p.offsetWidth-15;l=m.clientX>e?e:m.clientX+15;e=c.innerHeight-p.offsetHeight-10;m=m.clientY>e?e:m.clientY+10;r=r.getBoundingClientRect();l=(l-r.left)/b;m=(m-r.top)/b;p.style.left=l+"px";p.style.top=m+"px"}};this.hideTooltip=function(){p.style.display="none"};this.destroy= +function(a){p.parentNode&&p.parentNode.removeChild(p);a()};(function(){var a=f.getElement().ownerDocument;h=a.createElement("span");q=a.createElement("span");h.className="webodf-hyperlinkTooltipLink";q.className="webodf-hyperlinkTooltipText";p=a.createElement("div");p.className="webodf-hyperlinkTooltip";p.appendChild(h);p.appendChild(q);f.getElement().appendChild(p)})()};gui.OdfFieldView=function(f){function k(){var a=odf.OdfSchema.getFields().map(function(a){return a.replace(":","|")}),d=a.join(",\n")+"\n{ background-color: #D0D0D0; }\n",a=a.map(function(a){return a+":empty::after"}).join(",\n")+"\n{ content:' '; white-space: pre; }\n";return d+"\n"+a}var a,d=f.getElement().ownerDocument;this.showFieldHighlight=function(){a.appendChild(d.createTextNode(k()))};this.hideFieldHighlight=function(){for(var c=a.sheet,d=c.cssRules;d.length;)c.deleteRule(d.length-1)};this.destroy= +function(c){a.parentNode&&a.parentNode.removeChild(a);c()};a=function(){var a=d.getElementsByTagName("head").item(0),f=d.createElement("style"),k="";f.type="text/css";f.media="screen, print, handheld, projection";odf.Namespaces.forEachPrefix(function(a,c){k+="@namespace "+a+" url("+c+");\n"});f.appendChild(d.createTextNode(k));a.appendChild(f);return f}()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),a=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(d,c){k=d;a=!1!==c};this.hasForwardSelection=function(){return a};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(a).map(function(d){return a[d]})}var a={};this.getSelectionView=function(d){return a.hasOwnProperty(d)?a[d]:null};this.getSelectionViews=k;this.removeSelectionView=function(d){a.hasOwnProperty(d)&&(a[d].destroy(function(){}),delete a[d])};this.hideSelectionView=function(d){a.hasOwnProperty(d)&&a[d].hide()};this.showSelectionView=function(d){a.hasOwnProperty(d)&&a[d].show()};this.rerenderSelectionViews=function(){Object.keys(a).forEach(function(d){a[d].rerender()})}; +this.registerCursor=function(d,c){var h=d.getMemberId(),k=new f(d);c?k.show():k.hide();return a[h]=k};this.destroy=function(a){function c(k,p){p?a(p):k .webodf-draggable"), +b=gui.ShadowCursor.ShadowCursorMemberId,e(".webodf-selectionOverlay","{ fill: "+c+"; stroke: "+c+";}",""),e(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function l(b){var a,c;for(c in w)w.hasOwnProperty(c)&&(a=w[c],b?a.show():a.hide())}function r(b){c.getCarets().forEach(function(a){b?a.showHandle():a.hideHandle()})}function b(b){var a=b.getMemberId();b=b.getProperties();m(a,b.fullName,b.color)}function e(b){var e=b.getMemberId(),d=a.getOdtDocument().getMember(e).getProperties(); +c.registerCursor(b,J,N);h.registerCursor(b,!0);if(b=c.getCaret(e))b.setAvatarImageUrl(d.imageUrl),b.setColor(d.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+e+"'! +++")}function n(b){b=b.getMemberId();var a=h.getSelectionView(k),e=h.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),d=c.getCaret(k);b===k?(e.hide(),a&&a.show(),d&&d.show()):b===gui.ShadowCursor.ShadowCursorMemberId&&(e.show(),a&&a.hide(),d&&d.hide())}function g(b){h.removeSelectionView(b)}function u(b){var c= +b.paragraphElement,e=b.memberId;b=b.timeStamp;var d,f="",g=c.getElementsByTagNameNS(x,"editinfo").item(0);g?(f=g.getAttributeNS(x,"id"),d=w[f]):(f=Math.random().toString(),d=new ops.EditInfo(c,a.getOdtDocument()),d=new gui.EditInfoMarker(d,F),g=c.getElementsByTagNameNS(x,"editinfo").item(0),g.setAttributeNS(x,"id",f),w[f]=d);d.addEdit(e,new Date(b));C.trigger()}function t(){var b;""!==s.innerHTML&&(s.innerHTML="");!0===d.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(b=a.getOdtDocument().getMember(k))&& +(b=b.getProperties().fullName,s.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+b+"']) .annotationRemoveButton { display: none; }")))}function y(a){var c=Object.keys(w).map(function(b){return w[b]});B.unsubscribe(ops.Document.signalMemberAdded,b);B.unsubscribe(ops.Document.signalMemberUpdated,b);B.unsubscribe(ops.Document.signalCursorAdded,e);B.unsubscribe(ops.Document.signalCursorRemoved,g);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,u);B.unsubscribe(ops.Document.signalCursorMoved, +n);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalTableAdded,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);d.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,t);B.unsubscribe(ops.Document.signalMemberAdded,t);B.unsubscribe(ops.Document.signalMemberUpdated,t);v.parentNode.removeChild(v);s.parentNode.removeChild(s);(function Z(b,e){e?a(e):bb.length;a&&f(b);return a}function a(b,a){function c(f){b[f]===a&&d.push(f)}var d=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return d}function d(b,a){function c(d){b[d]===a&&delete b[d]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function c(b){var a={};Object.keys(b).forEach(function(d){a[d]="object"===typeof b[d]?c(b[d]):b[d]});return a}function h(b, +a,c,d){var f,h=!1,k=!1,m,l=[];d&&d.attributes&&(l=d.attributes.split(","));b&&(c||0=a.position+a.length)){f=d?b:a;h=d?a:b;if(b.position!==a.position||b.length!==a.length)r=c(f),x=c(h);a=m(h.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)k=[],b=[],l=f.position+f.length,p=h.position+h.length,h.positionl?a.minorChanged&&(r=x,r.position=l,r.length=p-l,b.push(r),h.length=l-h.position):l>p&&a.majorChanged&&(r.position=p,r.length=l-p,k.push(r),f.length=p-f.position),f.setProperties&&q(f.setProperties)&&k.push(f),h.setProperties&&q(h.setProperties)&&b.push(h),d?(l=k,k=b):l=b}return{opSpecsA:l,opSpecsB:k}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&& +(b.length+=a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,d=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);d>=a.sourceStartPosition&&(d-=1);b.position=c;b.length=d-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=b.position?b.position-=a.length:a.positiona.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length; +return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){b.position>=a.sourceStartPosition?b.position-=1:(b.positionb.position&&(a.position+=b.text.length);return{opSpecsA:[b], +opSpecsB:[a]}},SplitParagraph:function(b,a){b.position=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&& +(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.positionb.sourceStartPosition)a.position-= +1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:d}},SplitParagraph:function(b,a){var c,d=[b],f=[a];a.position=b.destinationStartPosition&&a.position=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:d,opSpecsB:f}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MoveCursor:{MoveCursor:l,RemoveCursor:function(b, +a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=k(b),d=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.positiond.position?a.position+=1:a.position===d.sourceParagraphPosition&&(d.paragraphStyleName=a.styleName,h=c(a),h.position=d.position+1,f.push(h));return{opSpecsA:f,opSpecsB:g}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SplitParagraph:{SplitParagraph:function(a,c,d){var f,h;a.position