diff --git a/css/editor.css b/css/editor.css index 0fb5f2fd..c852c2be 100644 --- a/css/editor.css +++ b/css/editor.css @@ -1,5 +1,3 @@ -@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0); - html, body, #mainContainer { width: 100%; height: 100%; @@ -25,12 +23,6 @@ html, body, #mainContainer { z-index: 4; } -#menubar { - border: none; - overflow: hidden; - background-color: #E6E6E7; -} - #toolbar { overflow: hidden; } @@ -169,28 +161,6 @@ div.memberListLabel[fullname]:before { opacity: 0.9; } -#chat { - padding: 0px; - text-align: center; - position: relative; -} - -#chat > #inputArea { - padding-top: 3px; - padding-bottom: 3px; - width: 100%; - background-color: #eee; - position: absolute; - bottom: 0px; -} - -#inputArea > #widget_chatInput { - width: 95%; - border-radius: 10px; - padding: 3px; - box-shadow: inset 0 0 1px #888; -} - .dijitDialog { border: none !important; box-shadow: 0 1px 50px rgba(0, 0, 0, 0.25) !important; diff --git a/js/documents.js b/js/documents.js index 351ef962..e4891715 100644 --- a/js/documents.js +++ b/js/documents.js @@ -79,7 +79,7 @@ var documentsMain = { documentsMain.webodfEditorInstance = new Editor({}, documentsMain.webodfServerInstance, serverFactory); // load the document and get called back when it's live - documentsMain.webodfEditorInstance.loadSession(response.es_id, memberId, function() { + documentsMain.webodfEditorInstance.openSession(response.es_id, memberId, function() { documentsMain.webodfEditorInstance.startEditing(); }); }); @@ -150,21 +150,23 @@ var documentsMain = { //close editor documentsMain.webodfEditorInstance.endEditing(); - documentsMain.webodfEditorInstance.closeDocument(function() { + documentsMain.webodfEditorInstance.close(function() { // successfull shutdown - all is good. // TODO: proper session leaving call to server, either by webodfServerInstance or custom // documentsMain.webodfServerInstance.leaveSession(sessionId, memberId, function() { + documentsMain.webodfEditorInstance.destroy(function() { // Fade out odf-toolbar $('#odf-toolbar').fadeOut('slow'); // Fade out editor $('#mainContainer').fadeOut('slow', function() { $('#mainContainer').remove(); - $('#odf-canvas').remove(); + $('#odf-toolbar').remove(); $('.actions,#file_access_panel').fadeIn('slow'); $('.documentslist, #emptyfolder').fadeIn('slow'); $(document.body).removeClass('claro'); }); + }); // }); }); }, diff --git a/js/editor/Editor.js b/js/editor/Editor.js index 22f2c637..6c2802ed 100644 --- a/js/editor/Editor.js +++ b/js/editor/Editor.js @@ -1,4 +1,5 @@ /** + * @license * Copyright (C) 2013 KO GmbH * * @licstart @@ -31,6 +32,7 @@ * @source: http://www.webodf.org/ * @source: http://gitorious.org/webodf/webodf/ */ + /*global runtime, define, document, odf, ops, window, gui, alert, saveAs, Blob */ define("webodf/editor/Editor", [ @@ -66,6 +68,7 @@ define("webodf/editor/Editor", [ // Private session, editorSession, + mainContainer, memberListView, toolbarTools, loadOdtFile = args.loadCallback, @@ -112,7 +115,7 @@ define("webodf/editor/Editor", [ /** - * create the editor, load the starting document, + * open the document, * call editorReadyCallback once everything is done. * * @param {!string} docUrl @@ -120,7 +123,7 @@ define("webodf/editor/Editor", [ * @param {!function()} editorReadyCallback * @return {undefined} */ - this.loadDocument = function (docUrl, memberId, editorReadyCallback) { + this.openDocument = function (docUrl, memberId, editorReadyCallback) { initDocLoading(docUrl, memberId, editorReadyCallback); }; @@ -151,8 +154,8 @@ define("webodf/editor/Editor", [ }; /** - * create the editor, load the starting document of an - * editing-session, request a replay of previous operations, call + * open the initial document of an editing-session, + * request a replay of previous operations, call * editorReadyCallback once everything is done. * * @param {!string} sessionId @@ -160,7 +163,7 @@ define("webodf/editor/Editor", [ * @param {!function()} editorReadyCallback * @return {undefined} */ - this.loadSession = function (sessionId, memberId, editorReadyCallback) { + this.openSession = function (sessionId, memberId, editorReadyCallback) { initDocLoading(server.getGenesisUrl(sessionId), memberId, function () { var opRouter, memberModel; // overwrite router and member model @@ -185,26 +188,27 @@ define("webodf/editor/Editor", [ * @param {!function(!Object=)} callback, passing an error object in case of error * @return {undefined} */ - this.closeDocument = function (callback) { + this.close = function (callback) { runtime.assert(session, "session should exist here."); - if (memberListView) { - memberListView.setEditorSession(undefined); - } // TODO: there is a better pattern for this instead of unrolling - session.getOperationRouter().close(function(err) { + editorSession.close(function(err) { if (err) { callback(err); } else { - session.getMemberModel().close(function(err) { + session.close(function(err) { if (err) { callback(err); } else { - editorSession.close(function(err) { + // now also destroy session, will not be reused for new document + if (memberListView) { + memberListView.setEditorSession(undefined); + } + editorSession.destroy(function(err) { if (err) { callback(err); } else { editorSession = undefined; - session.close(function(err) { + session.destroy(function(err) { if (err) { callback(err); } else { @@ -245,10 +249,45 @@ define("webodf/editor/Editor", [ editorSession.sessionController.endEditing(); }; + /** + * @param {!function(!Object=)} callback, passing an error object in case of error + * @return {undefined} + */ + this.destroy = function (callback) { + var destroyMemberListView = memberListView ? memberListView.destroy : function(cb) { cb(); }; + + // TODO: decide if some forced close should be done here instead of enforcing proper API usage + runtime.assert(!session, "session should not exist here."); + + // TODO: investigate what else needs to be done + mainContainer.destroyRecursive(true); + + destroyMemberListView(function(err) { + if (err) { + callback(err); + } else { + toolbarTools.destroy(function(err) { + if (err) { + callback(err); + } else { + odfCanvas.destroy(function(err) { + if (err) { + callback(err); + } else { + document.translator = null; + document.translateContent = null; + callback(); + } + }); + } + }); + } + }); + }; + // init function init() { - var mainContainer, - editorPane, memberListPane, + var editorPane, memberListPane, inviteButton, canvasElement = document.getElementById("canvas"), memberListElement = document.getElementById('memberList'), @@ -317,11 +356,10 @@ define("webodf/editor/Editor", [ if (window.inviteButtonProxy) { inviteButton = document.getElementById('inviteButton'); - if (inviteButton) { - inviteButton.innerText = translator("inviteMembers"); - inviteButton.style.display = "block"; - inviteButton.onclick = window.inviteButtonProxy.clicked; - } + runtime.assert(inviteButton, 'missing "inviteButton" div in HTML'); + inviteButton.innerText = translator("inviteMembers"); + inviteButton.style.display = "block"; + inviteButton.onclick = window.inviteButtonProxy.clicked; } toolbarTools = new ToolBarTools({ diff --git a/js/editor/EditorSession.js b/js/editor/EditorSession.js index 0f2e1526..cc261936 100644 --- a/js/editor/EditorSession.js +++ b/js/editor/EditorSession.js @@ -32,7 +32,9 @@ * @source: http://www.webodf.org/ * @source: http://gitorious.org/webodf/webodf/ */ + /*global define, runtime, core, gui, ops, document */ + define("webodf/editor/EditorSession", [ "dojo/text!resources/fonts/fonts.css" ], function (fontsCSS) { // fontsCSS is retrieved as a string, using dojo's text retrieval AMD plugin @@ -65,8 +67,10 @@ define("webodf/editor/EditorSession", [ currentParagraphNode = null, currentNamedStyleName = null, currentStyleName = null, + caretManager, odtDocument = session.getOdtDocument(), textns = "urn:oasis:names:tc:opendocument:xmlns:text:1.0", + fontStyles = document.createElement('style'), formatting = odtDocument.getFormatting(), styleHelper = new gui.StyleHelper(formatting), eventNotifier = new core.EventNotifier([ @@ -81,7 +85,8 @@ define("webodf/editor/EditorSession", [ this.sessionController = new gui.SessionController(session, localMemberId); - this.sessionView = new gui.SessionView(config.viewOptions, session, new gui.CaretManager(self.sessionController)); + caretManager = new gui.CaretManager(self.sessionController); + this.sessionView = new gui.SessionView(config.viewOptions, session, caretManager); this.availableFonts = []; /* @@ -194,36 +199,34 @@ define("webodf/editor/EditorSession", [ checkParagraphStyleName(); } - // Custom signals, that make sense in the Editor context. We do not want to expose webodf's ops signals to random bits of the editor UI. - odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, function (cursor) { + function onCursorAdded(cursor) { self.emit(EditorSession.signalMemberAdded, cursor.getMemberId()); trackCursor(cursor); - }); + } - odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, function (memberId) { + function onCursorRemoved(memberId) { self.emit(EditorSession.signalMemberRemoved, memberId); - }); + } - odtDocument.subscribe(ops.OdtDocument.signalCursorMoved, function (cursor) { + function onCursorMoved(cursor) { // Emit 'cursorMoved' only when *I* am moving the cursor, not the other users if (cursor.getMemberId() === localMemberId) { self.emit(EditorSession.signalCursorMoved, cursor); + trackCursor(cursor); } - }); + } - odtDocument.subscribe(ops.OdtDocument.signalStyleCreated, function (newStyleName) { + function onStyleCreated(newStyleName) { self.emit(EditorSession.signalStyleCreated, newStyleName); - }); + } - odtDocument.subscribe(ops.OdtDocument.signalStyleDeleted, function (styleName) { + function onStyleDeleted(styleName) { self.emit(EditorSession.signalStyleDeleted, styleName); - }); + } - odtDocument.subscribe(ops.OdtDocument.signalParagraphStyleModified, function (styleName) { + function onParagraphStyleModified(styleName) { self.emit(EditorSession.signalParagraphStyleModified, styleName); - }); - - odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, trackCurrentParagraph); + } /** * Call all subscribers for the given event with the specified argument @@ -527,24 +530,64 @@ define("webodf/editor/EditorSession", [ undoManager.moveForward(1); }; - this.subscribe(EditorSession.signalCursorMoved, trackCursor); + /** + * @param {!function(!Object=)} callback, passing an error object in case of error + * @return {undefined} + */ + this.close = function (callback) { + callback(); + /* + self.sessionView.close(function(err) { + if (err) { + callback(err); + } else { + caretManager.close(function(err) { + if (err) { + callback(err); + } else { + self.sessionController.close(callback); + } + }); + } + }); + */ + }; /** * @param {!function(!Object=)} callback, passing an error object in case of error * @return {undefined} */ - this.close = function(callback) { - self.sessionController.close(function(err) { + this.destroy = function(callback) { + var head = document.getElementsByTagName('head')[0]; + + head.removeChild(fontStyles); + + odtDocument.unsubscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded); + odtDocument.unsubscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved); + odtDocument.unsubscribe(ops.OdtDocument.signalCursorMoved, onCursorMoved); + odtDocument.unsubscribe(ops.OdtDocument.signalStyleCreated, onStyleCreated); + odtDocument.unsubscribe(ops.OdtDocument.signalStyleDeleted, onStyleDeleted); + odtDocument.unsubscribe(ops.OdtDocument.signalParagraphStyleModified, onParagraphStyleModified); + odtDocument.unsubscribe(ops.OdtDocument.signalParagraphChanged, trackCurrentParagraph); + odtDocument.unsubscribe(ops.OdtDocument.signalUndoStackChanged, undoStackModified); + + self.sessionView.destroy(function(err) { if (err) { callback(err); } else { - delete self.sessionController; - self.sessionView.close(function(err) { + delete self.sessionView; + caretManager.destroy(function(err) { if (err) { callback(err); } else { - delete self.sessionView; - callback(); + self.sessionController.destroy(function(err) { + if (err) { + callback(err); + } else { + delete self.sessionController; + callback(); + } + }); } }); } @@ -552,12 +595,22 @@ define("webodf/editor/EditorSession", [ }; function init() { - var head = document.getElementsByTagName('head')[0], - fontStyles = document.createElement('style'); + var head = document.getElementsByTagName('head')[0]; + + // TODO: fonts.css should be rather done by odfCanvas, or? fontStyles.type = 'text/css'; fontStyles.media = 'screen, print, handheld, projection'; fontStyles.appendChild(document.createTextNode(fontsCSS)); head.appendChild(fontStyles); + + // Custom signals, that make sense in the Editor context. We do not want to expose webodf's ops signals to random bits of the editor UI. + odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded); + odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved); + odtDocument.subscribe(ops.OdtDocument.signalCursorMoved, onCursorMoved); + odtDocument.subscribe(ops.OdtDocument.signalStyleCreated, onStyleCreated); + odtDocument.subscribe(ops.OdtDocument.signalStyleDeleted, onStyleDeleted); + odtDocument.subscribe(ops.OdtDocument.signalParagraphStyleModified, onParagraphStyleModified); + odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, trackCurrentParagraph); odtDocument.subscribe(ops.OdtDocument.signalUndoStackChanged, undoStackModified); } diff --git a/js/editor/MemberListView.js b/js/editor/MemberListView.js index fb0d84bf..a7f768e6 100644 --- a/js/editor/MemberListView.js +++ b/js/editor/MemberListView.js @@ -152,17 +152,17 @@ define("webodf/editor/MemberListView", function removeMember(memberId) { editorSession.unsubscribeMemberDetailsUpdates(memberId, updateAvatarButton); removeAvatarButton(memberId); - }; + } - /** - * @param {!EditorSession} session - * @return {undefined} - */ - this.setEditorSession = function(session) { - var node = memberListDiv.firstChild, nextNode; + function disconnectFromEditorSession() { + var node, nextNode; if (editorSession) { + // unsubscribe from editorSession + editorSession.unsubscribe(EditorSession.signalMemberAdded, addMember); + editorSession.unsubscribe(EditorSession.signalMemberRemoved, removeMember); // remove all current avatars + node = memberListDiv.firstChild; while (node) { nextNode = node.nextSibling; if (node.memberId) { @@ -171,15 +171,30 @@ define("webodf/editor/MemberListView", memberListDiv.removeChild(node); node = nextNode; } - // unsubscribe from old editorSession - editorSession.unsubscribe(EditorSession.signalMemberAdded, addMember); - editorSession.unsubscribe(EditorSession.signalMemberRemoved, removeMember); } + } + + /** + * @param {!EditorSession} session + * @return {undefined} + */ + this.setEditorSession = function(session) { + disconnectFromEditorSession(); + editorSession = session; if (editorSession) { editorSession.subscribe(EditorSession.signalMemberAdded, addMember); editorSession.subscribe(EditorSession.signalMemberRemoved, removeMember); } }; + + /** + * @param {!function(!Object=)} callback, passing an error object in case of error + * @return {undefined} + */ + this.destroy = function (callback) { + disconnectFromEditorSession(); + callback(); + }; }; }); diff --git a/js/editor/server/ServerFactory.js b/js/editor/server/ServerFactory.js index c21d134e..c4fafcac 100644 --- a/js/editor/server/ServerFactory.js +++ b/js/editor/server/ServerFactory.js @@ -49,9 +49,10 @@ ServerFactory.prototype.createServer = function () {"use strict"; }; * @param {!string} sessionId * @param {!string} memberId * @param {!ops.Server} server + * @param {!odf.OdfContainer} odfContainer TODO: needed for pullbox writing to server at end, find better solution * @return {!ops.OperationRouter} */ -ServerFactory.prototype.createOperationRouter = function (sessionId, memberId, server) {"use strict"; }; +ServerFactory.prototype.createOperationRouter = function (sessionId, memberId, server, odfContainer) {"use strict"; }; /** * @param {!string} sessionId diff --git a/js/editor/widgets.js b/js/editor/widgets.js index 1dd95da6..2f5a7785 100644 --- a/js/editor/widgets.js +++ b/js/editor/widgets.js @@ -81,6 +81,16 @@ define("webodf/editor/widgets", [ } }; + /** + * @param {!function(!Object=)} callback, passing an error object in case of error + * @return {undefined} + */ + this.destroy = function (callback) { + // TODO: investigate what else needs to be done + toolbar.destroyRecursive(true); + callback(); + }; + // init ready(function () { toolbar = new Toolbar({}, "toolbar"); diff --git a/js/webodf-debug.js b/js/webodf-debug.js index 48d46837..926884a6 100644 --- a/js/webodf-debug.js +++ b/js/webodf-debug.js @@ -8479,7 +8479,11 @@ odf.OdfCanvas = function() { updateCSS() } }; - this.css = css + this.css = css; + this.destroy = function(callback) { + css.parentNode.removeChild(css); + callback() + } } function listenEvent(eventTarget, eventType, eventHandler) { if(eventTarget.addEventListener) { @@ -8493,6 +8497,20 @@ odf.OdfCanvas = function() { } } } + function removeEvent(eventTarget, eventType, eventHandler) { + var onVariant = "on" + eventType; + if(eventTarget.removeEventListener) { + eventTarget.removeEventListener(eventType, eventHandler, false) + }else { + if(eventTarget.detachEvent) { + eventTarget.detachEvent(onVariant, eventHandler) + }else { + if(eventTarget[onVariant] === eventHandler) { + eventTarget[onVariant] = null + } + } + } + } function SelectionWatcher(element) { var selection = [], listeners = []; function isAncestorOf(ancestor, descendant) { @@ -8568,12 +8586,17 @@ odf.OdfCanvas = function() { } listeners.push(handler) }; + this.destroy = function(callback) { + removeEvent(element, "mouseup", checkSelection); + removeEvent(element, "keyup", checkSelection); + removeEvent(element, "keydown", checkSelection); + callback() + }; listenEvent(element, "mouseup", checkSelection); listenEvent(element, "keyup", checkSelection); listenEvent(element, "keydown", checkSelection) } - var drawns = odf.Namespaces.drawns, fons = odf.Namespaces.fons, officens = odf.Namespaces.officens, stylens = odf.Namespaces.stylens, svgns = odf.Namespaces.svgns, tablens = odf.Namespaces.tablens, textns = odf.Namespaces.textns, xlinkns = odf.Namespaces.xlinkns, xmlns = odf.Namespaces.xmlns, presentationns = odf.Namespaces.presentationns, window = runtime.getWindow(), xpath = new xmldom.XPath, utils = new odf.OdfUtils, domUtils = new core.DomUtils, shadowContent, sizer, annotationsPane, allowAnnotations = - false, annotationManager; + var drawns = odf.Namespaces.drawns, fons = odf.Namespaces.fons, officens = odf.Namespaces.officens, stylens = odf.Namespaces.stylens, svgns = odf.Namespaces.svgns, tablens = odf.Namespaces.tablens, textns = odf.Namespaces.textns, xlinkns = odf.Namespaces.xlinkns, xmlns = odf.Namespaces.xmlns, presentationns = odf.Namespaces.presentationns, window = runtime.getWindow(), xpath = new xmldom.XPath, utils = new odf.OdfUtils, domUtils = new core.DomUtils, shadowContent; function clear(element) { while(element.firstChild) { element.removeChild(element.firstChild) @@ -8725,17 +8748,6 @@ odf.OdfCanvas = function() { modifyTableCell(node) } } - function modifyAnnotations(odffragment) { - var annotationNodes = domUtils.getElementsByTagNameNS(odffragment, officens, "annotation"), annotationEnds = domUtils.getElementsByTagNameNS(odffragment, officens, "annotation-end"), currentAnnotationName, i; - function matchAnnotationEnd(element) { - return currentAnnotationName === element.getAttributeNS(officens, "name") - } - for(i = 0;i < annotationNodes.length;i += 1) { - currentAnnotationName = annotationNodes[i].getAttributeNS(officens, "name"); - annotationManager.addAnnotation({node:annotationNodes[i], end:annotationEnds.filter(matchAnnotationEnd)[0] || null}) - } - annotationManager.rerenderAnnotations() - } function modifyLinks(odffragment) { var i, links, node; function modifyLink(node) { @@ -8984,12 +8996,7 @@ odf.OdfCanvas = function() { odf.OdfCanvas = function OdfCanvas(element) { runtime.assert(element !== null && element !== undefined, "odf.OdfCanvas constructor needs DOM element"); runtime.assert(element.ownerDocument !== null && element.ownerDocument !== undefined, "odf.OdfCanvas constructor needs DOM"); - var self = this, doc = (element.ownerDocument), odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), pageSwitcher, fontcss, stylesxmlcss, positioncss, editable = false, zoomLevel = 1, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue; - addWebODFStyleSheet(doc); - pageSwitcher = new PageSwitcher(addStyleSheet(doc)); - fontcss = addStyleSheet(doc); - stylesxmlcss = addStyleSheet(doc); - positioncss = addStyleSheet(doc); + var self = this, doc = (element.ownerDocument), odfcontainer, formatting = new odf.Formatting, selectionWatcher = new SelectionWatcher(element), pageSwitcher, sizer, annotationsPane, allowAnnotations = false, annotationManager, webodfcss, fontcss, stylesxmlcss, positioncss, editable = false, zoomLevel = 1, eventHandlers = {}, editparagraph, loadingQueue = new LoadingQueue; function loadImages(container, odffragment, stylesheet) { var i, images, node; function loadImage(name, container, node, stylesheet) { @@ -9084,6 +9091,17 @@ odf.OdfCanvas = function() { sizer.insertBefore(shadowContent, sizer.firstChild); fixContainerSize() } + function modifyAnnotations(odffragment) { + var annotationNodes = domUtils.getElementsByTagNameNS(odffragment, officens, "annotation"), annotationEnds = domUtils.getElementsByTagNameNS(odffragment, officens, "annotation-end"), currentAnnotationName, i; + function matchAnnotationEnd(element) { + return currentAnnotationName === element.getAttributeNS(officens, "name") + } + for(i = 0;i < annotationNodes.length;i += 1) { + currentAnnotationName = annotationNodes[i].getAttributeNS(officens, "name"); + annotationManager.addAnnotation({node:annotationNodes[i], end:annotationEnds.filter(matchAnnotationEnd)[0] || null}) + } + annotationManager.rerenderAnnotations() + } function handleAnnotations(odfnode) { if(allowAnnotations) { if(!annotationsPane.parentNode) { @@ -9328,7 +9346,33 @@ odf.OdfCanvas = function() { }; this.getElement = function() { return element + }; + this.destroy = function(callback) { + var head = doc.getElementsByTagName("head")[0]; + if(annotationsPane.parentNode) { + annotationsPane.parentNode.removeChild(annotationsPane) + } + element.removeChild(sizer); + head.removeChild(webodfcss); + head.removeChild(fontcss); + head.removeChild(stylesxmlcss); + head.removeChild(positioncss); + selectionWatcher.destroy(function(err) { + if(err) { + callback(err) + }else { + pageSwitcher.destroy(callback) + } + }) + }; + function init() { + webodfcss = addWebODFStyleSheet(doc); + pageSwitcher = new PageSwitcher(addStyleSheet(doc)); + fontcss = addStyleSheet(doc); + stylesxmlcss = addStyleSheet(doc); + positioncss = addStyleSheet(doc) } + init() }; return odf.OdfCanvas }(); @@ -11916,6 +11960,10 @@ ops.EditInfo = function EditInfo(container, odtDocument) { this.clearEdits = function() { editHistory = {} }; + this.destroy = function(callback) { + container.removeChild(editInfoNode); + callback() + }; function init() { var editInfons = "urn:webodf:names:editinfo", dom = odtDocument.getDOM(); editInfoNode = dom.createElementNS(editInfons, "editinfo"); @@ -11951,6 +11999,10 @@ gui.Avatar = function Avatar(parentElement, avatarInitiallyVisible) { this.markAsFocussed = function(isFocussed) { handle.className = isFocussed ? "active" : "" }; + this.destroy = function(callback) { + parentElement.removeChild(handle); + callback() + }; function init() { var document = (parentElement.ownerDocument), htmlns = document.documentElement.namespaceURI; handle = document.createElementNS(htmlns, "div"); @@ -12056,6 +12108,16 @@ gui.Caret = function Caret(cursor, avatarInitiallyVisible, blinkOnRangeSelect) { } } }; + this.destroy = function(callback) { + avatar.destroy(function(err) { + if(err) { + callback(err) + }else { + cursorNode.removeChild(span); + callback() + } + }) + }; function init() { var dom = cursor.getOdtDocument().getDOM(), htmlns = dom.documentElement.namespaceURI; span = dom.createElementNS(htmlns, "span"); @@ -12925,7 +12987,7 @@ gui.SessionController = function() { this.getUndoManager = function() { return undoManager }; - this.close = function(callback) { + this.destroy = function(callback) { callback() }; function init() { @@ -13230,6 +13292,10 @@ gui.EditInfoHandle = function EditInfoHandle(parentElement) { this.hide = function() { handle.style.display = "none" }; + this.destroy = function(callback) { + parentElement.removeChild(handle); + callback() + }; function init() { handle = document.createElementNS(htmlns, "div"); handle.setAttribute("class", "editInfoHandle"); @@ -13238,6 +13304,40 @@ gui.EditInfoHandle = function EditInfoHandle(parentElement) { } init() }; +/* + + 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.EditInfo"); runtime.loadClass("gui.EditInfoHandle"); gui.EditInfoMarker = function EditInfoMarker(editInfo, initialVisibility) { @@ -13303,6 +13403,16 @@ gui.EditInfoMarker = function EditInfoMarker(editInfo, initialVisibility) { this.hideHandle = function() { handle.hide() }; + this.destroy = function(callback) { + editInfoNode.removeChild(marker); + handle.destroy(function(err) { + if(err) { + callback(err) + }else { + editInfo.destroy(callback) + } + }) + }; function init() { var dom = editInfo.getOdtDocument().getDOM(), htmlns = dom.documentElement.namespaceURI; marker = dom.createElementNS(htmlns, "div"); @@ -13504,16 +13614,39 @@ gui.SessionView = function() { session.getMemberModel().unsubscribeMemberDetailsUpdates(memberid, renderMemberData) } } - this.close = function(callback) { - callback() + function onParagraphChanged(info) { + highlightEdit(info.paragraphElement, info.memberId, info.timeStamp) + } + this.destroy = function(callback) { + var odtDocument = session.getOdtDocument(), memberModel = session.getMemberModel(), editInfoArray = Object.keys(editInfoMap).map(function(keyname) { + return editInfoMap[keyname] + }); + odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded); + odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved); + odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, onParagraphChanged); + caretManager.getCarets().forEach(function(caret) { + memberModel.unsubscribeMemberDetailsUpdates(caret.getCursor().getMemberId(), renderMemberData) + }); + avatarInfoStyles.parentNode.removeChild(avatarInfoStyles); + (function destroyEditInfo(i, err) { + if(err) { + callback(err) + }else { + if(i < editInfoArray.length) { + editInfoArray[i].destroy(function(err) { + destroyEditInfo(i + 1, err) + }) + }else { + callback() + } + } + })(0, undefined) }; function init() { var odtDocument = session.getOdtDocument(), head = document.getElementsByTagName("head")[0]; odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded); odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved); - odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, function(info) { - highlightEdit(info.paragraphElement, info.memberId, info.timeStamp) - }); + odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, onParagraphChanged); avatarInfoStyles = document.createElementNS(head.namespaceURI, "style"); avatarInfoStyles.type = "text/css"; avatarInfoStyles.media = "screen, print, handheld, projection"; @@ -13565,6 +13698,11 @@ gui.CaretManager = function CaretManager(sessionController) { function getCaret(memberId) { return carets.hasOwnProperty(memberId) ? carets[memberId] : null } + function getCarets() { + return Object.keys(carets).map(function(memberid) { + return carets[memberid] + }) + } function getCanvasElement() { return sessionController.getSession().getOdtDocument().getOdfCanvas().getElement() } @@ -13616,13 +13754,30 @@ gui.CaretManager = function CaretManager(sessionController) { return caret }; this.getCaret = getCaret; - this.getCarets = function() { - return Object.keys(carets).map(function(memberid) { - return carets[memberid] - }) + this.getCarets = getCarets; + this.destroy = function(callback) { + var odtDocument = sessionController.getSession().getOdtDocument(), canvasElement = getCanvasElement(), caretArray = getCarets(); + odtDocument.unsubscribe(ops.OdtDocument.signalParagraphChanged, ensureLocalCaretVisible); + odtDocument.unsubscribe(ops.OdtDocument.signalCursorMoved, refreshLocalCaretBlinking); + odtDocument.unsubscribe(ops.OdtDocument.signalCursorRemoved, removeCaret); + canvasElement.onfocus = null; + canvasElement.onblur = null; + (function destroyCaret(i, err) { + if(err) { + callback(err) + }else { + if(i < caretArray.length) { + caretArray[i].destroy(function(err) { + destroyCaret(i + 1, err) + }) + }else { + callback() + } + } + })(0, undefined) }; function init() { - var session = sessionController.getSession(), odtDocument = session.getOdtDocument(), canvasElement = getCanvasElement(); + var odtDocument = sessionController.getSession().getOdtDocument(), canvasElement = getCanvasElement(); odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, ensureLocalCaretVisible); odtDocument.subscribe(ops.OdtDocument.signalCursorMoved, refreshLocalCaretBlinking); odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, removeCaret); @@ -14763,6 +14918,9 @@ ops.OdtDocument = function OdtDocument(odfCanvas) { this.close = function(callback) { callback() }; + this.destroy = function(callback) { + callback() + }; function init() { filter = new TextPositionFilter; odfUtils = new odf.OdfUtils @@ -14839,9 +14997,6 @@ ops.Session = function Session(odfCanvas) { }); opRouter.setOperationFactory(operationFactory) }; - this.getOperationRouter = function() { - return operationRouter - }; this.getMemberModel = function() { return memberModel }; @@ -14855,14 +15010,23 @@ ops.Session = function Session(odfCanvas) { operationRouter.push(operation) }; this.close = function(callback) { - odtDocument.close(function(err) { + operationRouter.close(function(err) { if(err) { callback(err) }else { - callback() + memberModel.close(function(err) { + if(err) { + callback(err) + }else { + odtDocument.close(callback) + } + }) } }) }; + this.destroy = function(callback) { + odtDocument.destroy(callback) + }; function init() { self.setOperationRouter(new ops.TrivialOperationRouter) } diff --git a/js/webodf.js b/js/webodf.js index 8ad6c571..95e116f2 100644 --- a/js/webodf.js +++ b/js/webodf.js @@ -36,79 +36,79 @@ */ var core={},gui={},xmldom={},odf={},ops={}; // Input 1 -function Runtime(){}Runtime.ByteArray=function(n){};Runtime.prototype.getVariable=function(n){};Runtime.prototype.toJson=function(n){};Runtime.prototype.fromJson=function(n){};Runtime.ByteArray.prototype.slice=function(n,m){};Runtime.ByteArray.prototype.length=0;Runtime.prototype.byteArrayFromArray=function(n){};Runtime.prototype.byteArrayFromString=function(n,m){};Runtime.prototype.byteArrayToString=function(n,m){};Runtime.prototype.concatByteArrays=function(n,m){}; -Runtime.prototype.read=function(n,m,l,d){};Runtime.prototype.readFile=function(n,m,l){};Runtime.prototype.readFileSync=function(n,m){};Runtime.prototype.loadXML=function(n,m){};Runtime.prototype.writeFile=function(n,m,l){};Runtime.prototype.isFile=function(n,m){};Runtime.prototype.getFileSize=function(n,m){};Runtime.prototype.deleteFile=function(n,m){};Runtime.prototype.log=function(n,m){};Runtime.prototype.setTimeout=function(n,m){};Runtime.prototype.clearTimeout=function(n){}; -Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(n){};Runtime.prototype.getWindow=function(){};Runtime.prototype.assert=function(n,m,l){};var IS_COMPILED_CODE=!0; -Runtime.byteArrayToString=function(n,m){function l(b){var a="",h,f=b.length;for(h=0;hc?a+=String.fromCharCode(c):(h+=1,d=b[h],194<=c&&224>c?a+=String.fromCharCode((c&31)<<6|d&63):(h+=1,k=b[h],224<=c&&240>c?a+=String.fromCharCode((c&15)<<12|(d&63)<<6|k&63):(h+=1,q=b[h],240<=c&&245>c&&(c=(c&7)<<18|(d&63)<<12|(k&63)<<6|q&63,c-=65536,a+=String.fromCharCode((c>>10)+55296,(c&1023)+56320))))); -return a}var b;"utf8"===m?b=d(n):("binary"!==m&&this.log("Unsupported encoding: "+m),b=l(n));return b};Runtime.getVariable=function(n){try{return eval(n)}catch(m){}};Runtime.toJson=function(n){return JSON.stringify(n)};Runtime.fromJson=function(n){return JSON.parse(n)};Runtime.getFunctionName=function(n){return void 0===n.name?(n=/function\s+(\w+)/.exec(n))&&n[1]:n.name}; -function BrowserRuntime(n){function m(a,h){var f,c,b;void 0!==h?b=a:h=a;n?(c=n.ownerDocument,b&&(f=c.createElement("span"),f.className=b,f.appendChild(c.createTextNode(b)),n.appendChild(f),n.appendChild(c.createTextNode(" "))),f=c.createElement("span"),0k?(c[q]=k,q+=1):2048>k?(c[q]=192|k>>>6,c[q+1]=128|k&63,q+=2):(c[q]=224|k>>>12&15,c[q+1]=128|k>>>6&63,c[q+2]=128|k&63,q+=3)}else for("binary"!== -h&&d.log("unknown encoding: "+h),f=a.length,c=new d.ByteArray(f),b=0;bc.status||0===c.status?f(null):f("Status "+String(c.status)+": "+c.responseText|| -c.statusText):f("File "+a+" is empty."))};h=h.buffer&&!c.sendAsBinary?h.buffer:d.byteArrayToString(h,"binary");try{c.sendAsBinary?c.sendAsBinary(h):c.send(h)}catch(e){d.log("HUH? "+e+" "+h),f(e.message)}};this.deleteFile=function(a,h){delete b[a];var f=new XMLHttpRequest;f.open("DELETE",a,!0);f.onreadystatechange=function(){4===f.readyState&&(200>f.status&&300<=f.status?h(f.responseText):h(null))};f.send(null)};this.loadXML=function(a,h){var f=new XMLHttpRequest;f.open("GET",a,!0);f.overrideMimeType&& -f.overrideMimeType("text/xml");f.onreadystatechange=function(){4===f.readyState&&(0!==f.status||f.responseText?200===f.status||0===f.status?h(null,f.responseXML):h(f.responseText):h("File "+a+" is empty."))};try{f.send(null)}catch(c){h(c.message)}};this.isFile=function(a,h){d.getFileSize(a,function(a){h(-1!==a)})};this.getFileSize=function(a,h){var f=new XMLHttpRequest;f.open("HEAD",a,!0);f.onreadystatechange=function(){if(4===f.readyState){var c=f.getResponseHeader("Content-Length");c?h(parseInt(c, -10)):l(a,"binary",function(c,a){c?h(-1):h(a.length)})}};f.send(null)};this.log=m;this.assert=function(a,h,f){if(!a)throw m("alert","ASSERTION FAILED:\n"+h),f&&f(),h;};this.setTimeout=function(a,h){return setTimeout(function(){a()},h)};this.clearTimeout=function(a){clearTimeout(a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(a){return(new DOMParser).parseFromString(a, -"text/xml")};this.exit=function(a){m("Calling exit with code "+String(a)+", but exit() is not implemented.")};this.getWindow=function(){return window}} -function NodeJSRuntime(){function n(a,f,c){a=d.resolve(b,a);"binary"!==f?l.readFile(a,f,c):l.readFile(a,null,c)}var m=this,l=require("fs"),d=require("path"),b="",e,a;this.ByteArray=function(a){return new Buffer(a)};this.byteArrayFromArray=function(a){var f=new Buffer(a.length),c,b=a.length;for(c=0;c").implementation} -function RhinoRuntime(){function n(a,b){var f;void 0!==b?f=a:b=a;"alert"===f&&print("\n!!!!! ALERT !!!!!");print(b);"alert"===f&&print("!!!!! ALERT !!!!!")}var m=this,l=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),d,b,e="";l.setValidating(!1);l.setNamespaceAware(!0);l.setExpandEntityReferences(!1);l.setSchema(null);b=Packages.org.xml.sax.EntityResolver({resolveEntity:function(a,b){var f=new Packages.java.io.FileReader(b);return new Packages.org.xml.sax.InputSource(f)}});d=l.newDocumentBuilder(); -d.setEntityResolver(b);this.ByteArray=function(a){return[a]};this.byteArrayFromArray=function(a){return a};this.byteArrayFromString=function(a,b){var f=[],c,d=a.length;for(c=0;cd?b+=String.fromCharCode(d):(f+=1,c=a[f],194<=d&&224>d?b+=String.fromCharCode((d&31)<<6|c&63):(f+=1,l=a[f],224<=d&&240>d?b+=String.fromCharCode((d&15)<<12|(c&63)<<6|l&63):(f+=1,p=a[f],240<=d&&245>d&&(d=(d&7)<<18|(c&63)<<12|(l&63)<<6|p&63,d-=65536,b+=String.fromCharCode((d>>10)+55296,(d&1023)+56320))))); +return b}var a;"utf8"===n?a=c(m):("binary"!==n&&this.log("Unsupported encoding: "+n),a=k(m));return a};Runtime.getVariable=function(m){try{return eval(m)}catch(n){}};Runtime.toJson=function(m){return JSON.stringify(m)};Runtime.fromJson=function(m){return JSON.parse(m)};Runtime.getFunctionName=function(m){return void 0===m.name?(m=/function\s+(\w+)/.exec(m))&&m[1]:m.name}; +function BrowserRuntime(m){function n(b,f){var e,d,a;void 0!==f?a=b:f=b;m?(d=m.ownerDocument,a&&(e=d.createElement("span"),e.className=a,e.appendChild(d.createTextNode(a)),m.appendChild(e),m.appendChild(d.createTextNode(" "))),e=d.createElement("span"),0l?(d[p]=l,p+=1):2048>l?(d[p]=192|l>>>6,d[p+1]=128|l&63,p+=2):(d[p]=224|l>>>12&15,d[p+1]=128|l>>>6&63,d[p+2]=128|l&63,p+=3)}else for("binary"!== +f&&c.log("unknown encoding: "+f),e=b.length,d=new c.ByteArray(e),a=0;ad.status||0===d.status?e(null):e("Status "+String(d.status)+": "+d.responseText|| +d.statusText):e("File "+b+" is empty."))};f=f.buffer&&!d.sendAsBinary?f.buffer:c.byteArrayToString(f,"binary");try{d.sendAsBinary?d.sendAsBinary(f):d.send(f)}catch(h){c.log("HUH? "+h+" "+f),e(h.message)}};this.deleteFile=function(b,f){delete a[b];var e=new XMLHttpRequest;e.open("DELETE",b,!0);e.onreadystatechange=function(){4===e.readyState&&(200>e.status&&300<=e.status?f(e.responseText):f(null))};e.send(null)};this.loadXML=function(b,f){var a=new XMLHttpRequest;a.open("GET",b,!0);a.overrideMimeType&& +a.overrideMimeType("text/xml");a.onreadystatechange=function(){4===a.readyState&&(0!==a.status||a.responseText?200===a.status||0===a.status?f(null,a.responseXML):f(a.responseText):f("File "+b+" is empty."))};try{a.send(null)}catch(d){f(d.message)}};this.isFile=function(b,a){c.getFileSize(b,function(b){a(-1!==b)})};this.getFileSize=function(b,a){var e=new XMLHttpRequest;e.open("HEAD",b,!0);e.onreadystatechange=function(){if(4===e.readyState){var d=e.getResponseHeader("Content-Length");d?a(parseInt(d, +10)):k(b,"binary",function(d,b){d?a(-1):a(b.length)})}};e.send(null)};this.log=n;this.assert=function(b,a,e){if(!b)throw n("alert","ASSERTION FAILED:\n"+a),e&&e(),a;};this.setTimeout=function(b,a){return setTimeout(function(){b()},a)};this.clearTimeout=function(a){clearTimeout(a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(a){return(new DOMParser).parseFromString(a, +"text/xml")};this.exit=function(a){n("Calling exit with code "+String(a)+", but exit() is not implemented.")};this.getWindow=function(){return window}} +function NodeJSRuntime(){function m(b,e,d){b=c.resolve(a,b);"binary"!==e?k.readFile(b,e,d):k.readFile(b,null,d)}var n=this,k=require("fs"),c=require("path"),a="",h,b;this.ByteArray=function(a){return new Buffer(a)};this.byteArrayFromArray=function(a){var b=new Buffer(a.length),d,c=a.length;for(d=0;d").implementation} +function RhinoRuntime(){function m(b,a){var e;void 0!==a?e=b:a=b;"alert"===e&&print("\n!!!!! ALERT !!!!!");print(a);"alert"===e&&print("!!!!! ALERT !!!!!")}var n=this,k=Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance(),c,a,h="";k.setValidating(!1);k.setNamespaceAware(!0);k.setExpandEntityReferences(!1);k.setSchema(null);a=Packages.org.xml.sax.EntityResolver({resolveEntity:function(b,a){var e=new Packages.java.io.FileReader(a);return new Packages.org.xml.sax.InputSource(e)}});c=k.newDocumentBuilder(); +c.setEntityResolver(a);this.ByteArray=function(b){return[b]};this.byteArrayFromArray=function(b){return b};this.byteArrayFromString=function(b,a){var e=[],d,c=b.length;for(d=0;d>>18],b+=p[a>>>12&63],b+=p[a>>>6&63],b+=p[a&63];g===k+1?(a=c[g]<<4,b+=p[a>>>6],b+=p[a&63],b+="=="):g===k&&(a=c[g]<<10|c[g+1]<<2,b+=p[a>>>12],b+=p[a>>>6&63],b+=p[a&63],b+="=");return b}function l(c){c=c.replace(/[^A-Za-z0-9+\/]+/g,"");var a=[],b=c.length%4,g,k=c.length,f;for(g=0;g>16,f>>8&255,f&255);a.length-=[0,0,2,1][b];return a}function d(c){var a=[],b,g=c.length,k;for(b=0;bk?a.push(k):2048>k?a.push(192|k>>>6,128|k&63):a.push(224|k>>>12&15,128|k>>>6&63,128|k&63);return a}function b(c){var a=[],b,g=c.length,k,f,p;for(b=0;bk?a.push(k):(b+=1,f=c[b],224>k?a.push((k&31)<<6|f&63):(b+=1,p=c[b],a.push((k&15)<<12|(f&63)<<6|p&63)));return a}function e(c){return m(n(c))} -function a(c){return String.fromCharCode.apply(String,l(c))}function h(c){return b(n(c))}function f(c){c=b(c);for(var a="",g=0;ga?g+=String.fromCharCode(a):(p+=1,k=c.charCodeAt(p)&255,224>a?g+=String.fromCharCode((a&31)<<6|k&63):(p+=1,f=c.charCodeAt(p)&255,g+=String.fromCharCode((a&15)<<12|(k&63)<<6|f&63)));return g}function t(a,b){function g(){var d= -p+k;d>a.length&&(d=a.length);f+=c(a,p,d);p=d;d=p===a.length;b(f,d)&&!d&&runtime.setTimeout(g,0)}var k=1E5,f="",p=0;a.length>>18],b+=q[d>>>12&63],b+=q[d>>>6&63],b+=q[d&63];g===l+1?(d=a[g]<<4,b+=q[d>>>6],b+=q[d&63],b+="=="):g===l&&(d=a[g]<<10|a[g+1]<<2,b+=q[d>>>12],b+=q[d>>>6&63],b+=q[d&63],b+="=");return b}function k(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,"");var d=[],b=a.length%4,g,l=a.length,f;for(g=0;g>16,f>>8&255,f&255);d.length-=[0,0,2,1][b];return d}function c(a){var d=[],b,g=a.length,l;for(b=0;bl?d.push(l):2048>l?d.push(192|l>>>6,128|l&63):d.push(224|l>>>12&15,128|l>>>6&63,128|l&63);return d}function a(a){var d=[],b,g=a.length,l,f,e;for(b=0;bl?d.push(l):(b+=1,f=a[b],224>l?d.push((l&31)<<6|f&63):(b+=1,e=a[b],d.push((l&15)<<12|(f&63)<<6|e&63)));return d}function h(a){return n(m(a))} +function b(a){return String.fromCharCode.apply(String,k(a))}function f(d){return a(m(d))}function e(d){d=a(d);for(var b="",g=0;gd?g+=String.fromCharCode(d):(e+=1,l=a.charCodeAt(e)&255,224>d?g+=String.fromCharCode((d&31)<<6|l&63):(e+=1,f=a.charCodeAt(e)&255,g+=String.fromCharCode((d&15)<<12|(l&63)<<6|f&63)));return g}function t(a,b){function g(){var c= +e+l;c>a.length&&(c=a.length);f+=d(a,e,c);e=c;c=e===a.length;b(f,c)&&!c&&runtime.setTimeout(g,0)}var l=1E5,f="",e=0;a.length>>8):(ta(a&255),ta(a>>>8))},na=function(){s=(s<<5^g[z+3-1]&255)&8191;v=w[32768+s];w[z&32767]=v;w[32768+s]=z},ga=function(c,a){A>16-a?(u|=c<>16-A,A+=a-16):(u|=c<c;c++)g[c]=g[c+32768];P-=32768;z-=32768;y-=32768;for(c=0;8192>c;c++)a=w[32768+c],w[32768+c]=32768<=a?a-32768:0;for(c=0;32768>c;c++)a=w[c],w[c]=32768<=a?a-32768:0;b+=32768}C||(c=qa(g,z+K,b),0>=c?C=!0:K+=c)},Ca=function(c){var a=M,b=z,k,f=O,p=32506=aa&&(a>>=2);do if(k=c,g[k+f]===h&&g[k+f-1]===q&&g[k]===g[b]&&g[++k]===g[b+1]){b+= -2;k++;do++b;while(g[b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&g[++b]===g[++k]&&bf){P=c;f=k;if(258<=k)break;q=g[b+f-1];h=g[b+f]}c=w[c&32767]}while(c>p&&0!==--a);return f},xa=function(c,a){r[V++]=a;0===c?ba[a].fc++:(c--,ba[oa[a]+256+1].fc++,ea[(256>c?L[c]:L[256+(c>>7)])&255].fc++,p[T++]=c,Z|=ka);ka<<=1;0===(V&7)&&(pa[ha++]=Z,Z=0,ka=1);if(2k;k++)b+=ea[k].fc* -(5+sa[k]);b>>=3;if(T>=1,b<<=1;while(0<--a);return b>>1},Ea=function(c,a){var b=[];b.length=16;var g=0,k;for(k=1;15>=k;k++)g=g+S[k-1]<<1,b[k]=g;for(g=0;g<=a;g++)k=c[g].dl,0!==k&&(c[g].fc=Da(b[k]++,k))},Ba=function(c){var a=c.dyn_tree,b=c.static_tree,g=c.elems,k,f=-1, -p=g;$=0;Y=573;for(k=0;k$;)k=R[++$]=2>f?++f:0,a[k].fc=1,fa[k]=0,la--,null!==b&&(X-=b[k].dl);c.max_code=f;for(k=$>>1;1<=k;k--)Aa(a,k);do k=R[1],R[1]=R[$--],Aa(a,1),b=R[1],R[--Y]=k,R[--Y]=b,a[p].fc=a[k].fc+a[b].fc,fa[p]=fa[k]>fa[b]+1?fa[k]:fa[b]+1,a[k].dl=a[b].dl=p,R[1]=p++,Aa(a,1);while(2<=$);R[--Y]=R[1];p=c.dyn_tree;k=c.extra_bits;var g=c.extra_base,b=c.max_code,d=c.max_length,q=c.static_tree,h,e,r,s,l=0;for(e=0;15>=e;e++)S[e]=0;p[R[Y]].dl=0; -for(c=Y+1;573>c;c++)h=R[c],e=p[p[h].dl].dl+1,e>d&&(e=d,l++),p[h].dl=e,h>b||(S[e]++,r=0,h>=g&&(r=k[h-g]),s=p[h].fc,la+=s*(e+r),null!==q&&(X+=s*(q[h].dl+r)));if(0!==l){do{for(e=d-1;0===S[e];)e--;S[e]--;S[e+1]+=2;S[d]--;l-=2}while(0b||(p[k].dl!==e&&(la+=(e-p[k].dl)*p[k].fc,p[k].fc=e),h--)}Ea(a,f)},Fa=function(c,a){var b,g=-1,k,f=c[0].dl,p=0,d=7,h=4;0===f&&(d=138,h=3);c[a+1].dl=65535;for(b=0;b<=a;b++)k=f,f=c[b+1].dl,++p=p?U[17].fc++:U[18].fc++,p=0,g=k,0===f?(d=138,h=3):k===f?(d=6,h=3):(d=7,h=4))},Ga=function(){8b?L[b]:L[256+(b>>7)])&255,H(h,a),e=sa[h],0!==e&&(b-=ia[h],ga(b,e))),d>>=1;while(k=p?(H(17,U),ga(p-3,3)):(H(18,U),ga(p-11,7));p=0;k=g;0===f?(d=138,h=3):g===f?(d=6,h=3):(d=7,h=4)}},Ja=function(){var c;for(c=0;286>c;c++)ba[c].fc=0;for(c=0;30>c;c++)ea[c].fc=0;for(c=0;19>c;c++)U[c].fc=0;ba[256].fc=1;Z=V=T=ha=la=X=0;ka=1},ya=function(c){var a,b,k,f;f=z-y;pa[ha]=Z;Ba(N);Ba(D);Fa(ba,N.max_code);Fa(ea,D.max_code);Ba(I);for(k=18;3<=k&&0===U[J[k]].dl;k--); -la+=3*(k+1)+14;a=la+3+7>>3;b=X+3+7>>3;b<=a&&(a=b);if(f+4<=a&&0<=y)for(ga(0+c,3),Ga(),ja(f),ja(~f),k=0;ka.len&&(d=a.len);for(h=0;ht-k&&(d=t-k);for(h=0;he;e++)for(G[e]= -h,d=0;d<1<e;e++)for(ia[e]=h,d=0;d<1<>=7;30>e;e++)for(ia[e]=h<<7,d=0;d<1<=d;d++)S[d]=0;for(d=0;143>=d;)Q[d++].dl=8,S[8]++;for(;255>=d;)Q[d++].dl=9,S[9]++;for(;279>=d;)Q[d++].dl=7,S[7]++;for(;287>=d;)Q[d++].dl=8,S[8]++;Ea(Q,287);for(d=0;30>d;d++)W[d].dl=5,W[d].fc=Da(d,5);Ja()}for(d=0;8192>d;d++)w[32768+d]=0;ca=ra[da].max_lazy;aa=ra[da].good_length;M=ra[da].max_chain;y=z=0;K=qa(g,0,65536);if(0>= -K)C=!0,K=0;else{for(C=!1;262>K&&!C;)za();for(d=s=0;2>d;d++)s=(s<<5^g[d]&255)&8191}a=null;k=t=0;3>=da?(O=2,E=0):(E=2,F=0);q=!1}f=!0;if(0===K)return q=!0,0}d=Ka(c,b,p);if(d===p)return p;if(q)return d;if(3>=da)for(;0!==K&&null===a;){na();0!==v&&32506>=z-v&&(E=Ca(v),E>K&&(E=K));if(3<=E)if(e=xa(z-P,E-3),K-=E,E<=ca){E--;do z++,na();while(0!==--E);z++}else z+=E,E=0,s=g[z]&255,s=(s<<5^g[z+1]&255)&8191;else e=xa(0,g[z]&255),K--,z++;e&&(ya(0),y=z);for(;262>K&&!C;)za()}else for(;0!==K&&null===a;){na();O=E;x= -P;E=2;0!==v&&(O=z-v)&&(E=Ca(v),E>K&&(E=K),3===E&&4096K&&!C;)za()}0===K&&(0!==F&&xa(0,g[z-1]&255),ya(1),q=!0);return d+Ka(c,d+b,p-d)};this.deflate=function(k,d){var q,s;B=k;ma=0;"undefined"===String(typeof d)&&(d=6);(q=d)?1>q?q=1:9q;q++)ba[q]=new n;ea=[];ea.length=61;for(q=0;61>q;q++)ea[q]=new n;Q=[];Q.length=288;for(q=0;288>q;q++)Q[q]=new n;W=[];W.length=30;for(q=0;30>q;q++)W[q]=new n;U=[];U.length=39;for(q=0;39>q;q++)U[q]=new n;N=new m;D=new m;I=new m;S=[];S.length=16;R=[];R.length=573;fa=[];fa.length=573;oa=[];oa.length=256;L=[];L.length=512;G=[];G.length=29;ia=[];ia.length=30;pa=[];pa.length=1024}var l=Array(1024),u=[],v=[];for(q=La(l, -0,l.length);0>>8):(va(b&255),va(b>>>8))},pa=function(){r=(r<<5^g[z+3-1]&255)&8191;v=w[32768+r];w[z&32767]=v;w[32768+r]=z},ga=function(a,b){A>16-b?(u|=a<>16-A,A+=b-16):(u|=a<a;a++)g[a]=g[a+32768];R-=32768;z-=32768;x-=32768;for(a=0;8192>a;a++)b=w[32768+a],w[32768+a]=32768<=b?b-32768:0;for(a=0;32768>a;a++)b=w[a],w[a]=32768<=b?b-32768:0;d+=32768}E||(a=Z(g,z+K,d),0>=a?E=!0:K+=a)},qa=function(a){var b=X,d=z,l,e=P,f=32506=ra&&(b>>=2);do if(l=a,g[l+e]===p&&g[l+e-1]===q&&g[l]===g[d]&&g[++l]===g[d+1]){d+=2;l++;do++d;while(g[d]=== +g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&g[++d]===g[++l]&&de){R=a;e=l;if(258<=l)break;q=g[d+e-1];p=g[d+e]}a=w[a&32767]}while(a>f&&0!==--b);return e},za=function(a,d){s[T++]=d;0===a?aa[d].fc++:(a--,aa[ca[d]+256+1].fc++,ea[(256>a?ha[a]:ha[256+(a>>7)])&255].fc++,q[ja++]=a,U|=ma);ma<<=1;0===(T&7)&&(ia[la++]=U,U=0,ma=1);if(2l;l++)b+=ea[l].fc*(5+ta[l]);b>>=3;if(ja< +parseInt(T/2,10)&&b>=1,b<<=1;while(0<--d);return b>>1},Ea=function(a,d){var b=[];b.length=16;var g=0,l;for(l=1;15>=l;l++)g=g+I[l-1]<<1,b[l]=g;for(g=0;g<=d;g++)l=a[g].dl,0!==l&&(a[g].fc=Da(b[l]++,l))},Ca=function(a){var d=a.dyn_tree,b=a.static_tree,g=a.elems,l,e=-1,f=g;ba=0;fa=573;for(l= +0;lba;)l=Q[++ba]=2>e?++e:0,d[l].fc=1,N[l]=0,W--,null!==b&&($-=b[l].dl);a.max_code=e;for(l=ba>>1;1<=l;l--)Ba(d,l);do l=Q[1],Q[1]=Q[ba--],Ba(d,1),b=Q[1],Q[--fa]=l,Q[--fa]=b,d[f].fc=d[l].fc+d[b].fc,N[f]=N[l]>N[b]+1?N[l]:N[b]+1,d[l].dl=d[b].dl=f,Q[1]=f++,Ba(d,1);while(2<=ba);Q[--fa]=Q[1];f=a.dyn_tree;l=a.extra_bits;var g=a.extra_base,b=a.max_code,c=a.max_length,q=a.static_tree,p,h,r,k,u=0;for(h=0;15>=h;h++)I[h]=0;f[Q[fa]].dl=0;for(a=fa+1;573>a;a++)p= +Q[a],h=f[f[p].dl].dl+1,h>c&&(h=c,u++),f[p].dl=h,p>b||(I[h]++,r=0,p>=g&&(r=l[p-g]),k=f[p].fc,W+=k*(h+r),null!==q&&($+=k*(q[p].dl+r)));if(0!==u){do{for(h=c-1;0===I[h];)h--;I[h]--;I[h+1]+=2;I[c]--;u-=2}while(0b||(f[l].dl!==h&&(W+=(h-f[l].dl)*f[l].fc,f[l].fc=h),p--)}Ea(d,e)},Fa=function(a,d){var b,g=-1,l,e=a[0].dl,f=0,c=7,h=4;0===e&&(c=138,h=3);a[d+1].dl=65535;for(b=0;b<=d;b++)l=e,e=a[b+1].dl,++f=f?S[17].fc++:S[18].fc++,f=0,g=l,0===e?(c=138,h=3):l===e?(c=6,h=3):(c=7,h=4))},Ga=function(){8b?ha[b]:ha[256+(b>>7)])&255,Y(c,d),h=ta[c],0!==h&&(b-=ka[c],ga(b,h))),f>>=1;while(g=e?(Y(17,S),ga(e-3,3)):(Y(18,S),ga(e-11,7));e=0;g=l;0===f?(c=138,h=3):l===f?(c=6,h=3):(c=7,h=4)}},Ja=function(){var a;for(a=0;286>a;a++)aa[a].fc=0;for(a=0;30>a;a++)ea[a].fc=0;for(a=0;19>a;a++)S[a].fc=0;aa[256].fc=1;U=T=ja=la=W=$=0;ma=1},Aa=function(a){var b,d,l,e;e=z-x;ia[la]=U;Ca(M);Ca(H);Fa(aa,M.max_code);Fa(ea,H.max_code);Ca(F);for(l=18;3<=l&&0===S[J[l]].dl;l--);W+=3*(l+1)+14;b=W+3+7>> +3;d=$+3+7>>3;d<=b&&(b=d);if(e+4<=b&&0<=x)for(ga(0+a,3),Ga(),na(e),na(~e),l=0;lb.len&&(c=b.len);for(p=0;pt-l&&(c=t-l);for(p=0;pq;q++)for(C[q]=h,c=0;c<1<q;q++)for(ka[q]=h,c=0;c<1<>=7;30>q;q++)for(ka[q]=h<<7,c=0;c<1<=c;c++)I[c]=0;for(c=0;143>=c;)O[c++].dl=8,I[8]++;for(;255>=c;)O[c++].dl=9,I[9]++;for(;279>=c;)O[c++].dl=7,I[7]++;for(;287>=c;)O[c++].dl=8,I[8]++;Ea(O,287);for(c=0;30>c;c++)V[c].dl=5,V[c].fc=Da(c,5);Ja()}for(c=0;8192>c;c++)w[32768+c]=0;oa=ua[L].max_lazy;ra=ua[L].good_length;X=ua[L].max_chain;x=z=0;K=Z(g,0,65536);if(0>=K)E=!0,K=0;else{for(E=!1;262>K&& +!E;)wa();for(c=r=0;2>c;c++)r=(r<<5^g[c]&255)&8191}b=null;l=t=0;3>=L?(P=2,y=0):(y=2,G=0);p=!1}e=!0;if(0===K)return p=!0,0}c=Ka(a,d,f);if(c===f)return f;if(p)return c;if(3>=L)for(;0!==K&&null===b;){pa();0!==v&&32506>=z-v&&(y=qa(v),y>K&&(y=K));if(3<=y)if(q=za(z-R,y-3),K-=y,y<=oa){y--;do z++,pa();while(0!==--y);z++}else z+=y,y=0,r=g[z]&255,r=(r<<5^g[z+1]&255)&8191;else q=za(0,g[z]&255),K--,z++;q&&(Aa(0),x=z);for(;262>K&&!E;)wa()}else for(;0!==K&&null===b;){pa();P=y;D=R;y=2;0!==v&&(P=z-v)&& +(y=qa(v),y>K&&(y=K),3===y&&4096K&&!E;)wa()}0===K&&(0!==G&&za(0,g[z-1]&255),Aa(1),p=!0);return c+Ka(a,c+d,f-c)};this.deflate=function(l,c){var p,r;B=l;sa=0;"undefined"===String(typeof c)&&(c=6);(p=c)?1>p?p=1:9p;p++)aa[p]=new m;ea=[];ea.length=61;for(p=0;61>p;p++)ea[p]=new m;O=[];O.length=288;for(p=0;288>p;p++)O[p]=new m;V=[];V.length=30;for(p=0;30>p;p++)V[p]=new m;S=[];S.length=39;for(p=0;39>p;p++)S[p]=new m;M=new n;H=new n;F=new n;I=[];I.length=16;Q=[];Q.length=573;N=[];N.length=573;ca=[];ca.length=256;ha=[];ha.length=512;C=[];C.length=29;ka=[];ka.length=30;ia=[];ia.length=1024}var k=Array(1024),u=[],v=[];for(p=La(k,0,k.length);0>8&255])};this.appendUInt32LE=function(d){m.appendArray([d&255,d>>8&255,d>>16&255,d>>24&255])};this.appendString=function(d){l=runtime.concatByteArrays(l, -runtime.byteArrayFromString(d,n))};this.getLength=function(){return l.length};this.getByteArray=function(){return l}}; +core.ByteArrayWriter=function(m){var n=this,k=new runtime.ByteArray(0);this.appendByteArrayWriter=function(c){k=runtime.concatByteArrays(k,c.getByteArray())};this.appendByteArray=function(c){k=runtime.concatByteArrays(k,c)};this.appendArray=function(c){k=runtime.concatByteArrays(k,runtime.byteArrayFromArray(c))};this.appendUInt16LE=function(c){n.appendArray([c&255,c>>8&255])};this.appendUInt32LE=function(c){n.appendArray([c&255,c>>8&255,c>>16&255,c>>24&255])};this.appendString=function(c){k=runtime.concatByteArrays(k, +runtime.byteArrayFromString(c,m))};this.getLength=function(){return k.length};this.getByteArray=function(){return k}}; // Input 6 -core.RawInflate=function(){var n,m,l=null,d,b,e,a,h,f,c,t,k,q,g,p,r,w,u=[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],y=[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],s=[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],v=[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],x=[16,17,18, -0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=function(){this.list=this.next=null},E=function(){this.n=this.b=this.e=0;this.t=null},O=function(c,a,b,k,g,f){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var d=Array(this.BMAX+1),p,h,q,e,r,s,l,u=Array(this.BMAX+1),n,m,v,w=new E,y=Array(this.BMAX);e=Array(this.N_MAX);var t,A=Array(this.BMAX+1),z,x,C;C=this.root=null;for(r=0;rr&&(f=r);for(z=1<(z-=d[s])){this.status=2;this.m=f;return}if(0>(z-=d[r]))this.status=2,this.m=f;else{d[r]+=z;A[1]=s=0;n=d;m=1;for(v=2;0<--r;)A[v++]=s+=n[m++];n=c;r=m=0;do 0!=(s=n[m++])&&(e[A[s]++]=r);while(++rt+u[1+e];){t+=u[1+e];e++;x=(x=q-t)>f?f:x;if((h=1<<(s=l-t))>c+1)for(h-=c+1,v=l;++sp&&t>t-u[e],y[e-1][s].e=w.e,y[e-1][s].b=w.b,y[e-1][s].n=w.n,y[e-1][s].t=w.t)}w.b=l-t;m>=a?w.e=99:n[m]n[m]?16:15,w.n=n[m++]): -(w.e=g[n[m]-b],w.n=k[n[m++]-b]);h=1<>t;s>=1)r^=s;for(r^=s;(r&(1<>=c;a-=c},K=function(a,b,f){var d,e,r;if(0==f)return 0;for(r=0;;){z(g);e=k.list[P(g)];for(d=e.e;16 -f;f++)n[x[f]]=0;g=7;f=new O(n,19,19,null,null,g);if(0!=f.status)return-1;k=f.root;g=f.m;h=l+u;for(d=e=0;df)n[d++]=e=f;else if(16==f){z(2);f=3+P(2);C(2);if(d+f>h)return-1;for(;0h)return-1;for(;0D;D++)N[D]=8;for(;256>D;D++)N[D]=9;for(;280>D;D++)N[D]=7;for(;288>D;D++)N[D]=8;b=7;D=new O(N,288,257,A,y,b);if(0!=D.status){alert("HufBuild error: "+D.status);Q=-1;break b}l=D.root;b=D.m;for(D=0;30>D;D++)N[D]=5;M=5;D=new O(N,30,0,s,v,M);if(1r&&(c=r);for(X=1<(X-=f[k])){this.status=2;this.m=c;return}if(0>(X-=f[r]))this.status=2,this.m=c;else{f[r]+=X;A[1]=k=0;m=f;n=1;for(v=2;0<--r;)A[v++]=k+=m[n++];m=a;r=n=0;do 0!=(k=m[n++])&&(q[A[k]++]=r);while(++rx+s[1+q];){x+=s[1+q];q++;z=(z=h-x)>c?c:z;if((p=1<<(k=u-x))>a+1)for(p-=a+1,v=u;++ke&&x>x-s[q],t[q-1][k].e=w.e,t[q-1][k].b=w.b,t[q-1][k].n=w.n,t[q-1][k].t=w.t)}w.b=u-x;n>=b?w.e=99:m[n]m[n]?16:15,w.n=m[n++]): +(w.e=g[m[n]-d],w.n=l[m[n++]-d]);p=1<>x;k>=1)r^=k;for(r^=k;(r&(1<>=a;b-=a},K=function(a,b,c){var e,h,r;if(0==c)return 0;for(r=0;;){z(g);h=l.list[R(g)];for(e=h.e;16 +e;e++)m[D[e]]=0;g=7;e=new P(m,19,19,null,null,g);if(0!=e.status)return-1;l=e.root;g=e.m;h=u+s;for(c=f=0;ce)m[c++]=f=e;else if(16==e){z(2);e=3+R(2);E(2);if(c+e>h)return-1;for(;0h)return-1;for(;0H;H++)M[H]=8;for(;256>H;H++)M[H]=9;for(;280>H;H++)M[H]=7;for(;288>H;H++)M[H]=8;a=7;H=new P(M,288,257,A,x,a);if(0!=H.status){alert("HufBuild error: "+H.status);O=-1;break b}k=H.root;a=H.m;for(H=0;30>H;H++)M[H]=5;X=5;H=new P(M,30,0,r,v,X);if(1n))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0m))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; +core.LoopWatchDog=function(m,n){var k=Date.now(),c=0;this.check=function(){var a;if(m&&(a=Date.now(),a-k>m))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0n))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}}; // Input 8 -core.Utils=function(){this.hashString=function(n){var m=0,l,d;l=0;for(d=n.length;l=l.compareBoundaryPoints(l.START_TO_START,d)&&0<=l.compareBoundaryPoints(l.END_TO_END,d)};this.rangesIntersect=function(l,d){return 0>=l.compareBoundaryPoints(l.END_TO_START,d)&&0<=l.compareBoundaryPoints(l.START_TO_END,d)};this.getNodesInRange=function(l,d){var b=[],e,a=l.startContainer.ownerDocument.createTreeWalker(l.commonAncestorContainer,NodeFilter.SHOW_ALL,d,!1);for(e=a.currentNode=l.startContainer;e;){if(d(e)=== -NodeFilter.FILTER_ACCEPT)b.push(e);else if(d(e)===NodeFilter.FILTER_REJECT)break;e=e.parentNode}b.reverse();for(e=a.nextNode();e;)b.push(e),e=a.nextNode();return b};this.normalizeTextNodes=function(l){l&&l.nextSibling&&(l=n(l,l.nextSibling));l&&l.previousSibling&&n(l.previousSibling,l)};this.rangeContainsNode=function(l,d){var b=d.ownerDocument.createRange(),e=d.nodeType===Node.TEXT_NODE?d.length:d.childNodes.length;b.setStart(l.startContainer,l.startOffset);b.setEnd(l.endContainer,l.endOffset);e= -0===b.comparePoint(d,0)&&0===b.comparePoint(d,e);b.detach();return e};this.mergeIntoParent=function(l){for(var d=l.parentNode;l.firstChild;)d.insertBefore(l.firstChild,l);d.removeChild(l);return d};this.getElementsByTagNameNS=function(l,d,b){return Array.prototype.slice.call(l.getElementsByTagNameNS(d,b))};this.rangeIntersectsNode=function(l,d){var b=d.nodeType===Node.TEXT_NODE?d.length:d.childNodes.length;return 0>=l.comparePoint(d,0)&&0<=l.comparePoint(d,b)};this.containsNode=function(l,d){return l=== -d||l.contains(d)};(function(l){var d=runtime.getWindow();null!==d&&(d=d.navigator.appVersion.toLowerCase(),d=-1===d.indexOf("chrome")&&(-1!==d.indexOf("applewebkit")||-1!==d.indexOf("safari")))&&(l.containsNode=m)})(this)}; +core.DomUtils=function(){function m(k,c){if(k.nodeType===Node.TEXT_NODE)if(0===k.length)k.parentNode.removeChild(k);else if(c.nodeType===Node.TEXT_NODE)return c.insertData(0,k.data),k.parentNode.removeChild(k),c;return k}function n(k,c){return k===c||Boolean(k.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_CONTAINED_BY)}this.splitBoundaries=function(k){var c=[],a;if(k.startContainer.nodeType===Node.TEXT_NODE||k.endContainer.nodeType===Node.TEXT_NODE){a=k.endContainer;var h=k.endOffset;if(h=k.compareBoundaryPoints(k.START_TO_START,c)&&0<=k.compareBoundaryPoints(k.END_TO_END,c)};this.rangesIntersect=function(k,c){return 0>=k.compareBoundaryPoints(k.END_TO_START,c)&&0<=k.compareBoundaryPoints(k.START_TO_END,c)};this.getNodesInRange=function(k,c){var a=[],h,b=k.startContainer.ownerDocument.createTreeWalker(k.commonAncestorContainer,NodeFilter.SHOW_ALL,c,!1);for(h=b.currentNode=k.startContainer;h;){if(c(h)=== +NodeFilter.FILTER_ACCEPT)a.push(h);else if(c(h)===NodeFilter.FILTER_REJECT)break;h=h.parentNode}a.reverse();for(h=b.nextNode();h;)a.push(h),h=b.nextNode();return a};this.normalizeTextNodes=function(k){k&&k.nextSibling&&(k=m(k,k.nextSibling));k&&k.previousSibling&&m(k.previousSibling,k)};this.rangeContainsNode=function(k,c){var a=c.ownerDocument.createRange(),h=c.nodeType===Node.TEXT_NODE?c.length:c.childNodes.length;a.setStart(k.startContainer,k.startOffset);a.setEnd(k.endContainer,k.endOffset);h= +0===a.comparePoint(c,0)&&0===a.comparePoint(c,h);a.detach();return h};this.mergeIntoParent=function(k){for(var c=k.parentNode;k.firstChild;)c.insertBefore(k.firstChild,k);c.removeChild(k);return c};this.getElementsByTagNameNS=function(k,c,a){return Array.prototype.slice.call(k.getElementsByTagNameNS(c,a))};this.rangeIntersectsNode=function(k,c){var a=c.nodeType===Node.TEXT_NODE?c.length:c.childNodes.length;return 0>=k.comparePoint(c,0)&&0<=k.comparePoint(c,a)};this.containsNode=function(k,c){return k=== +c||k.contains(c)};(function(k){var c=runtime.getWindow();null!==c&&(c=c.navigator.appVersion.toLowerCase(),c=-1===c.indexOf("chrome")&&(-1!==c.indexOf("applewebkit")||-1!==c.indexOf("safari")))&&(k.containsNode=n)})(this)}; // Input 10 runtime.loadClass("core.DomUtils"); -core.Cursor=function(n,m){function l(c){c.parentNode&&(h.push(c.previousSibling),h.push(c.nextSibling),c.parentNode.removeChild(c))}function d(c,a,b){if(a.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(a),"putCursorIntoTextNode: invalid container");var d=a.parentNode;runtime.assert(Boolean(d),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=a.length,"putCursorIntoTextNode: offset is out of bounds");0===b?d.insertBefore(c,a):(b!==a.length&&a.splitText(b),d.insertBefore(c, -a.nextSibling))}else if(a.nodeType===Node.ELEMENT_NODE){runtime.assert(Boolean(a),"putCursorIntoContainer: invalid container");for(d=a.firstChild;null!==d&&01/e?"-0":String(e),n(c+" should be "+a+". Was "+d+".")):n(c+" should be "+a+" (of type "+typeof a+"). Was "+e+" (of type "+typeof e+").")}var a=0,h;h=function(a,c){var d=Object.keys(a),k=Object.keys(c);d.sort();k.sort();return m(d,k)&&Object.keys(a).every(function(k){var g= -a[k],d=c[k];return b(g,d)?!0:(n(g+" should be "+d+" for key "+k),!1)})};this.areNodesEqual=d;this.shouldBeNull=function(a,c){e(a,c,"null")};this.shouldBeNonNull=function(a,c){var b,k;try{k=eval(c)}catch(d){b=d}b?n(c+" should be non-null. Threw exception "+b):null!==k?runtime.log("pass",c+" is non-null."):n(c+" should be non-null. Was "+k)};this.shouldBe=e;this.countFailedTests=function(){return a}}; -core.UnitTester=function(){function n(d,b){return""+d+""}var m=0,l={};this.runTests=function(d,b,e){function a(k){if(0===k.length)l[h]=t,m+=f.countFailedTests(),b();else{q=k[0];var d=Runtime.getFunctionName(q);runtime.log("Running "+d);p=f.countFailedTests();c.setUp();q(function(){c.tearDown();t[d]=p===f.countFailedTests();a(k.slice(1))})}}var h=Runtime.getFunctionName(d),f=new core.UnitTestRunner,c=new d(f),t={},k,q,g,p,r="BrowserRuntime"=== -runtime.type();if(l.hasOwnProperty(h))runtime.log("Test "+h+" has already run.");else{r?runtime.log("Running "+n(h,'runSuite("'+h+'");')+": "+c.description()+""):runtime.log("Running "+h+": "+c.description);g=c.tests();for(k=0;kRunning "+n(d,'runTest("'+h+'","'+d+'")')+""):runtime.log("Running "+d),p=f.countFailedTests(),c.setUp(),q(),c.tearDown(),t[d]=p===f.countFailedTests()); -a(c.asyncTests())}};this.countFailedTests=function(){return m};this.results=function(){return l}}; +core.UnitTest.provideTestAreaDiv=function(){var m=runtime.getWindow().document,n=m.getElementById("testarea");runtime.assert(!n,'Unclean test environment, found a div with id "testarea".');n=m.createElement("div");n.setAttribute("id","testarea");m.body.appendChild(n);return n}; +core.UnitTest.cleanupTestAreaDiv=function(){var m=runtime.getWindow().document,n=m.getElementById("testarea");runtime.assert(!!n&&n.parentNode===m.body,'Test environment broken, found no div with id "testarea" below body.');m.body.removeChild(n)}; +core.UnitTestRunner=function(){function m(a){b+=1;runtime.log("fail",a)}function n(a,b){var c;try{if(a.length!==b.length)return m("array of length "+a.length+" should be "+b.length+" long"),!1;for(c=0;c1/f?"-0":String(f),m(d+" should be "+b+". Was "+c+".")):m(d+" should be "+b+" (of type "+typeof b+"). Was "+f+" (of type "+typeof f+").")}var b=0,f;f=function(b,d){var c=Object.keys(b),l=Object.keys(d);c.sort();l.sort();return n(c,l)&&Object.keys(b).every(function(l){var g= +b[l],c=d[l];return a(g,c)?!0:(m(g+" should be "+c+" for key "+l),!1)})};this.areNodesEqual=c;this.shouldBeNull=function(a,b){h(a,b,"null")};this.shouldBeNonNull=function(a,b){var c,l;try{l=eval(b)}catch(f){c=f}c?m(b+" should be non-null. Threw exception "+c):null!==l?runtime.log("pass",b+" is non-null."):m(b+" should be non-null. Was "+l)};this.shouldBe=h;this.countFailedTests=function(){return b}}; +core.UnitTester=function(){function m(c,a){return""+c+""}var n=0,k={};this.runTests=function(c,a,h){function b(l){if(0===l.length)k[f]=t,n+=e.countFailedTests(),a();else{p=l[0];var g=Runtime.getFunctionName(p);runtime.log("Running "+g);q=e.countFailedTests();d.setUp();p(function(){d.tearDown();t[g]=q===e.countFailedTests();b(l.slice(1))})}}var f=Runtime.getFunctionName(c),e=new core.UnitTestRunner,d=new c(e),t={},l,p,g,q,s="BrowserRuntime"=== +runtime.type();if(k.hasOwnProperty(f))runtime.log("Test "+f+" has already run.");else{s?runtime.log("Running "+m(f,'runSuite("'+f+'");')+": "+d.description()+""):runtime.log("Running "+f+": "+d.description);g=d.tests();for(l=0;lRunning "+m(c,'runTest("'+f+'","'+c+'")')+""):runtime.log("Running "+c),q=e.countFailedTests(),d.setUp(),p(),d.tearDown(),t[c]=q===e.countFailedTests()); +b(d.asyncTests())}};this.countFailedTests=function(){return n};this.results=function(){return k}}; // Input 13 -core.PositionIterator=function(n,m,l,d){function b(){this.acceptNode=function(c){return c.nodeType===Node.TEXT_NODE&&0===c.length?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}function e(c){this.acceptNode=function(a){return a.nodeType===Node.TEXT_NODE&&0===a.length?NodeFilter.FILTER_REJECT:c.acceptNode(a)}}function a(){var a=f.currentNode.nodeType;c=a===Node.TEXT_NODE?f.currentNode.length-1:a===Node.ELEMENT_NODE?1:0}var h=this,f,c,t;this.nextPosition=function(){if(f.currentNode===n)return!1; -if(0===c&&f.currentNode.nodeType===Node.ELEMENT_NODE)null===f.firstChild()&&(c=1);else if(f.currentNode.nodeType===Node.TEXT_NODE&&c+1 "+a.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"), -b===a.length&&(c=void 0,f.nextSibling()?c=0:f.parentNode()&&(c=1),runtime.assert(void 0!==c,"Error in setPosition: position not valid.")),!0;d=t(a);b "+a.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"), +b===a.length&&(d=void 0,e.nextSibling()?d=0:e.parentNode()&&(d=1),runtime.assert(void 0!==d,"Error in setPosition: position not valid.")),!0;g=t(a);b>>8^k;return b^-1}function d(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 b(a){var c=a.getFullYear();return 1980>c?0:c-1980<< -25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function e(a,c){var b,g,k,f,e,h,r,q=this;this.load=function(c){if(void 0!==q.data)c(null,q.data);else{var b=e+34+g+k+256;b+r>p&&(b=p-r);runtime.read(a,r,b,function(b,d){if(b||null===d)c(b,d);else a:{var g=d,k=new core.ByteArray(g),p=k.readUInt32LE(),r;if(67324752!==p)c("File entry signature is wrong."+p.toString()+" "+g.length.toString(),null);else{k.pos+=22;p=k.readUInt16LE();r=k.readUInt16LE();k.pos+=p+r; -if(f){g=g.slice(k.pos,k.pos+e);if(e!==g.length){c("The amount of compressed bytes read was "+g.length.toString()+" instead of "+e.toString()+" for "+q.filename+" in "+a+".",null);break a}g=w(g,h)}else g=g.slice(k.pos,k.pos+h);h!==g.length?c("The amount of bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+q.filename+" in "+a+".",null):(q.data=g,c(null,g))}}})}};this.set=function(a,c,b,d){q.filename=a;q.data=c;q.compressed=b;q.date=d};this.error=null;c&&(b=c.readUInt32LE(),33639248!== -b?this.error="Central directory entry has wrong signature at position "+(c.pos-4).toString()+' for file "'+a+'": '+c.data.length.toString():(c.pos+=6,f=c.readUInt16LE(),this.date=d(c.readUInt32LE()),c.readUInt32LE(),e=c.readUInt32LE(),h=c.readUInt32LE(),g=c.readUInt16LE(),k=c.readUInt16LE(),b=c.readUInt16LE(),c.pos+=8,r=c.readUInt32LE(),this.filename=runtime.byteArrayToString(c.data.slice(c.pos,c.pos+g),"utf8"),c.pos+=g+k+b))}function a(a,c){if(22!==a.length)c("Central directory length should be 22.", -u);else{var b=new core.ByteArray(a),d;d=b.readUInt32LE();101010256!==d?c("Central directory signature is wrong: "+d.toString(),u):(d=b.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",u):(d=b.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",u):(d=b.readUInt16LE(),r=b.readUInt16LE(),d!==r?c("Number of entries is inconsistent.",u):(d=b.readUInt32LE(),b=b.readUInt16LE(),b=p-22-d,runtime.read(n,b,p-b,function(a,b){if(a||null===b)c(a,u);else a:{var d= -new core.ByteArray(b),k,f;g=[];for(k=0;kp?m("File '"+n+"' cannot be read.",u):runtime.read(n,p-22,22,function(c,b){c||null===m||null===b?m(c,u):a(b,m)})})}; +2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],d,g,c=a.length,l=0,l=0;d=-1;for(g=0;g>>8^l;return d^-1}function c(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 a(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 d,g,l,f,e,h,k,p=this;this.load=function(b){if(void 0!==p.data)b(null,p.data);else{var d=e+34+g+l+256;d+k>q&&(d=q-k);runtime.read(a,k,d,function(d,g){if(d||null===g)b(d,g);else a:{var c=g,l=new core.ByteArray(c),q=l.readUInt32LE(),k;if(67324752!==q)b("File entry signature is wrong."+q.toString()+" "+c.length.toString(),null);else{l.pos+=22;q=l.readUInt16LE();k=l.readUInt16LE();l.pos+=q+k; +if(f){c=c.slice(l.pos,l.pos+e);if(e!==c.length){b("The amount of compressed bytes read was "+c.length.toString()+" instead of "+e.toString()+" for "+p.filename+" in "+a+".",null);break a}c=w(c,h)}else c=c.slice(l.pos,l.pos+h);h!==c.length?b("The amount of bytes read was "+c.length.toString()+" instead of "+h.toString()+" for "+p.filename+" in "+a+".",null):(p.data=c,b(null,c))}}})}};this.set=function(a,b,d,g){p.filename=a;p.data=b;p.compressed=d;p.date=g};this.error=null;b&&(d=b.readUInt32LE(),33639248!== +d?this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,f=b.readUInt16LE(),this.date=c(b.readUInt32LE()),b.readUInt32LE(),e=b.readUInt32LE(),h=b.readUInt32LE(),g=b.readUInt16LE(),l=b.readUInt16LE(),d=b.readUInt16LE(),b.pos+=8,k=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+g),"utf8"),b.pos+=g+l+d))}function b(a,b){if(22!==a.length)b("Central directory length should be 22.", +u);else{var d=new core.ByteArray(a),c;c=d.readUInt32LE();101010256!==c?b("Central directory signature is wrong: "+c.toString(),u):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",u):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",u):(c=d.readUInt16LE(),s=d.readUInt16LE(),c!==s?b("Number of entries is inconsistent.",u):(c=d.readUInt32LE(),d=d.readUInt16LE(),d=q-22-c,runtime.read(m,d,q-d,function(a,d){if(a||null===d)b(a,u);else a:{var c= +new core.ByteArray(d),l,f;g=[];for(l=0;lq?n("File '"+m+"' cannot be read.",u):runtime.read(m,q-22,22,function(a,d){a||null===n||null===d?n(a,u):b(d,n)})})}; // Input 18 -core.CSSUnits=function(){var n={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(m,l,d){return m*n[d]/n[l]};this.convertMeasure=function(n,l){var d,b;n&&l?(d=parseFloat(n),b=n.replace(d.toString(),""),d=this.convert(d,b,l)):d="";return d.toString()};this.getUnits=function(n){return n.substr(n.length-2,n.length)}}; +core.CSSUnits=function(){var m={"in":1,cm:2.54,mm:25.4,pt:72,pc:12};this.convert=function(n,k,c){return n*m[c]/m[k]};this.convertMeasure=function(m,k){var c,a;m&&k?(c=parseFloat(m),a=m.replace(c.toString(),""),c=this.convert(c,a,k)):c="";return c.toString()};this.getUnits=function(m){return m.substr(m.length-2,m.length)}}; // Input 19 xmldom.LSSerializerFilter=function(){}; // Input 20 -"function"!==typeof Object.create&&(Object.create=function(n){var m=function(){};m.prototype=n;return new m}); -xmldom.LSSerializer=function(){function n(b){var d=b||{},a=function(a){var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[a[b]]=b);return c}(b),h=[d],f=[a],c=0;this.push=function(){c+=1;d=h[c]=Object.create(d);a=f[c]=Object.create(a)};this.pop=function(){h[c]=void 0;f[c]=void 0;c-=1;d=h[c];a=f[c]};this.getLocalNamespaceDefinitions=function(){return a};this.getQName=function(c){var b=c.namespaceURI,f=0,g;if(!b)return c.localName;if(g=a[b])return g+":"+c.localName;do{g||!c.prefix?(g="ns"+f,f+=1):g=c.prefix; -if(d[g]===b)break;if(!d[g]){d[g]=b;a[b]=g;break}g=null}while(null===g);return g+":"+c.localName}}function m(b){return b.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function l(b,e){var a="",h=d.filter?d.filter.acceptNode(e):NodeFilter.FILTER_ACCEPT,f;if(h===NodeFilter.FILTER_ACCEPT&&e.nodeType===Node.ELEMENT_NODE){b.push();f=b.getQName(e);var c,n=e.attributes,k,q,g,p="",r;c="<"+f;k=n.length;for(q=0;q")}if(h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP){for(h=e.firstChild;h;)a+=l(b,h),h=h.nextSibling;e.nodeValue&&(a+=m(e.nodeValue))}f&&(a+="",b.pop());return a}var d=this;this.filter=null;this.writeToString=function(b,d){if(!b)return"";var a=new n(d);return l(a,b)}}; +"function"!==typeof Object.create&&(Object.create=function(m){var n=function(){};n.prototype=m;return new n}); +xmldom.LSSerializer=function(){function m(a){var c=a||{},b=function(a){var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[a[d]]=d);return b}(a),f=[c],e=[b],d=0;this.push=function(){d+=1;c=f[d]=Object.create(c);b=e[d]=Object.create(b)};this.pop=function(){f[d]=void 0;e[d]=void 0;d-=1;c=f[d];b=e[d]};this.getLocalNamespaceDefinitions=function(){return b};this.getQName=function(a){var d=a.namespaceURI,f=0,g;if(!d)return a.localName;if(g=b[d])return g+":"+a.localName;do{g||!a.prefix?(g="ns"+f,f+=1):g=a.prefix; +if(c[g]===d)break;if(!c[g]){c[g]=d;b[d]=g;break}g=null}while(null===g);return g+":"+a.localName}}function n(a){return a.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}function k(a,h){var b="",f=c.filter?c.filter.acceptNode(h):NodeFilter.FILTER_ACCEPT,e;if(f===NodeFilter.FILTER_ACCEPT&&h.nodeType===Node.ELEMENT_NODE){a.push();e=a.getQName(h);var d,m=h.attributes,l,p,g,q="",s;d="<"+e;l=m.length;for(p=0;p")}if(f===NodeFilter.FILTER_ACCEPT||f===NodeFilter.FILTER_SKIP){for(f=h.firstChild;f;)b+=k(a,f),f=f.nextSibling;h.nodeValue&&(b+=n(h.nodeValue))}e&&(b+="",a.pop());return b}var c=this;this.filter=null;this.writeToString=function(a,c){if(!a)return"";var b=new m(c);return k(b,a)}}; // Input 21 -xmldom.RelaxNGParser=function(){function n(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 m(a){if(2>=a.e.length)return a;var b={name:a.name,e:a.e.slice(0,2)};return m({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 h)h[d]===b&&(a[0]=d);return a}function d(a,b){for(var k=0,f,g,e=a.name;a.e&&k=a.e.length)return a;var b={name:a.name,e:a.e.slice(0,2)};return n({name:a.name,e:[b].concat(a.e.slice(2))})}function k(a){a=a.split(":",2);var b="",c;1===a.length?a=["",a[0]]:b=a[0];for(c in f)f[c]===b&&(a[0]=c);return a}function c(a,b){for(var l=0,f,g,e=a.name;a.e&&l=d.length)return b;0===g&&(g=0);for(var f=d.item(g);f.namespaceURI===c;){g+=1;if(g>=d.length)return b;f=d.item(g)}return f=h(a,b.attDeriv(a,d.item(g)),d,g+1)}function f(a,b,c){c.e[0].a?(a.push(c.e[0].text),b.push(c.e[0].a.ns)):f(a,b,c.e[0]);c.e[1].a?(a.push(c.e[1].text),b.push(c.e[1].a.ns)): -f(a,b,c.e[1])}var c="http://www.w3.org/2000/xmlns/",t,k,q,g,p,r,w,u,A,y,s={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return s},endTagDeriv:function(){return s}},v={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return s}}, -x={type:"text",nullable:!0,hash:"text",textDeriv:function(){return x},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return x},endTagDeriv:function(){return s}},F,E,O;t=d("choice",function(a,b){if(a===s)return b;if(b===s||a===b)return a},function(a,c){var d={},g;b(d,{p1:a,p2:c});c=a=void 0;for(g in d)d.hasOwnProperty(g)&&(void 0===a?a=d[g]:c=void 0===c?d[g]:t(c,d[g]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, -textDeriv:function(c,d){return t(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:l(function(c){return t(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return t(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:n(function(){return t(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:n(function(){return t(a.endTagDeriv(),b.endTagDeriv())})}}(a,c)});k=function(a,b,c){return function(){var d={},g=0;return function(f,k){var e=b&&b(f,k),h,p;if(void 0!==e)return e; -e=f.hash||f.toString();h=k.hash||k.toString();e=c.length)return b;0===g&&(g=0);for(var l=c.item(g);l.namespaceURI===d;){g+=1;if(g>=c.length)return b;l=c.item(g)}return l=f(a,b.attDeriv(a,c.item(g)),c,g+1)}function e(a,b,d){d.e[0].a?(a.push(d.e[0].text),b.push(d.e[0].a.ns)):e(a,b,d.e[0]);d.e[1].a?(a.push(d.e[1].text),b.push(d.e[1].a.ns)): +e(a,b,d.e[1])}var d="http://www.w3.org/2000/xmlns/",t,l,p,g,q,s,w,u,A,x,r={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return r},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return r},endTagDeriv:function(){return r}},v={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return r},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return v},endTagDeriv:function(){return r}}, +D={type:"text",nullable:!0,hash:"text",textDeriv:function(){return D},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return D},endTagDeriv:function(){return r}},G,y,P;t=c("choice",function(a,b){if(a===r)return b;if(b===r||a===b)return a},function(b,d){var c={},g;a(c,{p1:b,p2:d});d=b=void 0;for(g in c)c.hasOwnProperty(g)&&(void 0===b?b=c[g]:d=void 0===d?c[g]:t(d,c[g]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, +textDeriv:function(d,c){return t(a.textDeriv(d,c),b.textDeriv(d,c))},startTagOpenDeriv:k(function(d){return t(a.startTagOpenDeriv(d),b.startTagOpenDeriv(d))}),attDeriv:function(d,c){return t(a.attDeriv(d,c),b.attDeriv(d,c))},startTagCloseDeriv:m(function(){return t(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:m(function(){return t(a.endTagDeriv(),b.endTagDeriv())})}}(b,d)});l=function(a,b,d){return function(){var c={},g=0;return function(f,l){var e=b&&b(f,l),h,q;if(void 0!==e)return e; +e=f.hash||f.toString();h=l.hash||l.toString();eNode.ELEMENT_NODE;){if(c!==Node.COMMENT_NODE&&(c!==Node.TEXT_NODE||!/^\s+$/.test(b.currentNode.nodeValue)))return[new n("Not allowed node of type "+ -c+".")];c=(d=b.nextSibling())?d.nodeType:0}if(!d)return[new n("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(e[d.namespaceURI]+":"+d.localName))return[new n("Found "+d.nodeName+" instead of "+a.names+".",d)];if(b.firstChild()){for(l=m(a.e[1],b,d);b.nextSibling();)if(c=b.currentNode.nodeType,!(b.currentNode&&b.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(b.currentNode.nodeValue)||c===Node.COMMENT_NODE))return[new n("Spurious content.",b.currentNode)];if(b.parentNode()!==d)return[new n("Implementation error.")]}else l= -m(a.e[1],b,d);b.nextSibling();return l}var d,b,e;b=function(a,d,f,c){var e=a.name,k=null;if("text"===e)a:{for(var q=(a=d.currentNode)?a.nodeType:0;a!==f&&3!==q;){if(1===q){k=[new n("Element not allowed here.",a)];break a}q=(a=d.nextSibling())?a.nodeType:0}d.nextSibling();k=null}else if("data"===e)k=null;else if("value"===e)c!==a.text&&(k=[new n("Wrong value, should be '"+a.text+"', not '"+c+"'",f)]);else if("list"===e)k=null;else if("attribute"===e)a:{if(2!==a.e.length)throw"Attribute with wrong # of elements: "+ -a.e.length;e=a.localnames.length;for(k=0;kNode.ELEMENT_NODE;){if(d!==Node.COMMENT_NODE&&(d!==Node.TEXT_NODE||!/^\s+$/.test(c.currentNode.nodeValue)))return[new m("Not allowed node of type "+ +d+".")];d=(e=c.nextSibling())?e.nodeType:0}if(!e)return[new m("Missing element "+a.names)];if(a.names&&-1===a.names.indexOf(h[e.namespaceURI]+":"+e.localName))return[new m("Found "+e.nodeName+" instead of "+a.names+".",e)];if(c.firstChild()){for(k=n(a.e[1],c,e);c.nextSibling();)if(d=c.currentNode.nodeType,!(c.currentNode&&c.currentNode.nodeType===Node.TEXT_NODE&&/^\s+$/.test(c.currentNode.nodeValue)||d===Node.COMMENT_NODE))return[new m("Spurious content.",c.currentNode)];if(c.parentNode()!==e)return[new m("Implementation error.")]}else k= +n(a.e[1],c,e);c.nextSibling();return k}var c,a,h;a=function(b,c,e,d){var h=b.name,l=null;if("text"===h)a:{for(var p=(b=c.currentNode)?b.nodeType:0;b!==e&&3!==p;){if(1===p){l=[new m("Element not allowed here.",b)];break a}p=(b=c.nextSibling())?b.nodeType:0}c.nextSibling();l=null}else if("data"===h)l=null;else if("value"===h)d!==b.text&&(l=[new m("Wrong value, should be '"+b.text+"', not '"+d+"'",e)]);else if("list"===h)l=null;else if("attribute"===h)a:{if(2!==b.e.length)throw"Attribute with wrong # of elements: "+ +b.e.length;h=b.localnames.length;for(l=0;l=e&&c.push(m(a.substring(b,d)))):"["===a[d]&&(0>=e&&(b=d+1),e+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};c=function(c,f,e){var p,r,l,n;for(p=0;p=e&&c.push(n(a.substring(b,d)))):"["===a[d]&&(0>=e&&(b=d+1),e+=1),d+=1;return d};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};d=function(d,e,g){var h,k,m,u;for(h=0;h=(m.getBoundingClientRect().top-y.bottom)/u?c.style.top=Math.abs(m.getBoundingClientRect().top-y.bottom)/u+20+"px":c.style.top="0px");e.style.left=d.getBoundingClientRect().width/u+"px";var d=e.style,m=e.getBoundingClientRect().left/u,A=e.getBoundingClientRect().top/u,y=c.getBoundingClientRect().left/u,s=c.getBoundingClientRect().top/u,v=0,x= -0,v=y-m,v=v*v,x=s-A,x=x*x,m=Math.sqrt(v+x);d.width=m+"px";u=Math.asin((c.getBoundingClientRect().top-e.getBoundingClientRect().top)/(u*parseFloat(e.style.width)));e.style.transform="rotate("+u+"rad)";e.style.MozTransform="rotate("+u+"rad)";e.style.WebkitTransform="rotate("+u+"rad)";e.style.msTransform="rotate("+u+"rad)";b&&(u=t.getComputedStyle(b,":before").content)&&"none"!==u&&(u=u.substring(1,u.length-1),b.firstChild?b.firstChild.nodeValue=u:b.appendChild(f.createTextNode(u)))}}var h=[],f=m.ownerDocument, -c=new odf.OdfUtils,t=runtime.getWindow();runtime.assert(Boolean(t),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=a;this.addAnnotation=function(c){b(!0);h.push({node:c.node,end:c.end});e();var l=f.createElement("div"),g=f.createElement("div"),p=f.createElement("div"),r=f.createElement("div"),n=f.createElement("div"),u=c.node;l.className="annotationWrapper";u.parentNode.insertBefore(l,u);g.className="annotationNote";g.appendChild(u);n.className= -"annotationRemoveButton";g.appendChild(n);p.className="annotationConnector horizontal";r.className="annotationConnector angular";l.appendChild(g);l.appendChild(p);l.appendChild(r);c.end&&d(c);a()};this.forgetAnnotations=function(){for(;h.length;){var a=h[0],c=h.indexOf(a),d=a.node,e=d.parentNode.parentNode;"div"===e.localName&&(e.parentNode.insertBefore(d,e),e.parentNode.removeChild(e));a=a.node.getAttributeNS(odf.Namespaces.officens,"name");a=f.querySelectorAll('span.annotationHighlight[annotation="'+ -a+'"]');e=d=void 0;for(d=0;d=(n.getBoundingClientRect().top-x.bottom)/u?c.style.top=Math.abs(n.getBoundingClientRect().top-x.bottom)/u+20+"px":c.style.top="0px");h.style.left=d.getBoundingClientRect().width/u+"px";var d=h.style,n=h.getBoundingClientRect().left/u,A=h.getBoundingClientRect().top/u,x=c.getBoundingClientRect().left/u,r=c.getBoundingClientRect().top/u,v=0,D= +0,v=x-n,v=v*v,D=r-A,D=D*D,n=Math.sqrt(v+D);d.width=n+"px";u=Math.asin((c.getBoundingClientRect().top-h.getBoundingClientRect().top)/(u*parseFloat(h.style.width)));h.style.transform="rotate("+u+"rad)";h.style.MozTransform="rotate("+u+"rad)";h.style.WebkitTransform="rotate("+u+"rad)";h.style.msTransform="rotate("+u+"rad)";b&&(u=t.getComputedStyle(b,":before").content)&&"none"!==u&&(u=u.substring(1,u.length-1),b.firstChild?b.firstChild.nodeValue=u:b.appendChild(e.createTextNode(u)))}}var f=[],e=n.ownerDocument, +d=new odf.OdfUtils,t=runtime.getWindow();runtime.assert(Boolean(t),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=b;this.addAnnotation=function(d){a(!0);f.push({node:d.node,end:d.end});h();var k=e.createElement("div"),g=e.createElement("div"),m=e.createElement("div"),n=e.createElement("div"),w=e.createElement("div"),u=d.node;k.className="annotationWrapper";u.parentNode.insertBefore(k,u);g.className="annotationNote";g.appendChild(u);w.className= +"annotationRemoveButton";g.appendChild(w);m.className="annotationConnector horizontal";n.className="annotationConnector angular";k.appendChild(g);k.appendChild(m);k.appendChild(n);d.end&&c(d);b()};this.forgetAnnotations=function(){for(;f.length;){var b=f[0],c=f.indexOf(b),d=b.node,h=d.parentNode.parentNode;"div"===h.localName&&(h.parentNode.insertBefore(d,h),h.parentNode.removeChild(h));b=b.node.getAttributeNS(odf.Namespaces.officens,"name");b=e.querySelectorAll('span.annotationHighlight[annotation="'+ +b+'"]');h=d=void 0;for(d=0;d=b.value||"%"===b.unit)?null:b;return b||p(a)};this.parseFoLineHeight=function(a){var b;b=(b=g(a))&&(0>b.value|| -"%"===b.unit)?null:b;return b||p(a)};this.getImpactedParagraphs=function(a){var b=a.commonAncestorContainer,c=[];for(b.nodeType===Node.ELEMENT_NODE&&(c=y.getElementsByTagNameNS(b,w,"p").concat(y.getElementsByTagNameNS(b,w,"h")));b&&!n(b);)b=b.parentNode;b&&c.push(b);return c.filter(function(b){return y.rangeIntersectsNode(a,b)})};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument.createRange(),d;d=y.getNodesInRange(a,function(d){c.selectNodeContents(d);if(d.nodeType===Node.TEXT_NODE){if(b&& -y.rangesIntersect(a,c)||y.containsRange(a,c))return Boolean(m(d)&&(!l(d.textContent)||q(d,0)))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}else if(y.rangesIntersect(a,c)&&r(d))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});c.detach();return d};this.getTextElements=function(a,c){var e=a.startContainer.ownerDocument.createRange(),f;f=y.getNodesInRange(a,function(f){var g=f.nodeType;e.selectNodeContents(f);if(g===Node.TEXT_NODE){if(y.containsRange(a,e)&&(c||Boolean(m(f)&&(!l(f.textContent)|| -q(f,0)))))return NodeFilter.FILTER_ACCEPT}else if(b(f)){if(y.containsRange(a,e))return NodeFilter.FILTER_ACCEPT}else if(r(f)||d(f))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});e.detach();return f};this.getParagraphElements=function(a){var b=a.startContainer.ownerDocument.createRange(),c;c=y.getNodesInRange(a,function(c){b.selectNodeContents(c);if(n(c)){if(y.rangesIntersect(a,b))return NodeFilter.FILTER_ACCEPT}else if(r(c)||d(c))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT}); -b.detach();return c}}; +odf.OdfUtils=function(){function m(a){var b=a&&a.localName;return("p"===b||"h"===b)&&a.namespaceURI===w}function n(a){for(;a&&!m(a);)a=a.parentNode;return a}function k(a){return/^[ \t\r\n]+$/.test(a)}function c(a){var b=a&&a.localName;return/^(span|p|h|a|meta)$/.test(b)&&a.namespaceURI===w||"span"===b&&"annotationHighlight"===a.className?!0:!1}function a(a){var b=a&&a.localName,c,d=!1;b&&(c=a.namespaceURI,c===w?d="s"===b||"tab"===b||"line-break"===b:c===u&&(d="frame"===b&&"as-char"===a.getAttributeNS(w, +"anchor-type")));return d}function h(a){for(;null!==a.firstChild&&c(a);)a=a.firstChild;return a}function b(a){for(;null!==a.lastChild&&c(a);)a=a.lastChild;return a}function f(a){for(;!m(a)&&null===a.previousSibling;)a=a.parentNode;return m(a)?null:b(a.previousSibling)}function e(a){for(;!m(a)&&null===a.nextSibling;)a=a.parentNode;return m(a)?null:h(a.nextSibling)}function d(b){for(var c=!1;b;)if(b.nodeType===Node.TEXT_NODE)if(0===b.length)b=f(b);else return!k(b.data.substr(b.length-1,1));else a(b)? +(c=!0,b=null):b=f(b);return c}function t(b){var c=!1;for(b=b&&h(b);b;){if(b.nodeType===Node.TEXT_NODE&&0=b.value||"%"===b.unit)?null:b;return b||q(a)};this.parseFoLineHeight=function(a){var b;b=(b=g(a))&&(0>b.value|| +"%"===b.unit)?null:b;return b||q(a)};this.getImpactedParagraphs=function(a){var b=a.commonAncestorContainer,c=[];for(b.nodeType===Node.ELEMENT_NODE&&(c=x.getElementsByTagNameNS(b,w,"p").concat(x.getElementsByTagNameNS(b,w,"h")));b&&!m(b);)b=b.parentNode;b&&c.push(b);return c.filter(function(b){return x.rangeIntersectsNode(a,b)})};this.getTextNodes=function(a,b){var c=a.startContainer.ownerDocument.createRange(),d;d=x.getNodesInRange(a,function(d){c.selectNodeContents(d);if(d.nodeType===Node.TEXT_NODE){if(b&& +x.rangesIntersect(a,c)||x.containsRange(a,c))return Boolean(n(d)&&(!k(d.textContent)||p(d,0)))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}else if(x.rangesIntersect(a,c)&&s(d))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});c.detach();return d};this.getTextElements=function(b,d){var g=b.startContainer.ownerDocument.createRange(),e;e=x.getNodesInRange(b,function(e){var h=e.nodeType;g.selectNodeContents(e);if(h===Node.TEXT_NODE){if(x.containsRange(b,g)&&(d||Boolean(n(e)&&(!k(e.textContent)|| +p(e,0)))))return NodeFilter.FILTER_ACCEPT}else if(a(e)){if(x.containsRange(b,g))return NodeFilter.FILTER_ACCEPT}else if(s(e)||c(e))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT});g.detach();return e};this.getParagraphElements=function(a){var b=a.startContainer.ownerDocument.createRange(),d;d=x.getNodesInRange(a,function(d){b.selectNodeContents(d);if(m(d)){if(x.rangesIntersect(a,b))return NodeFilter.FILTER_ACCEPT}else if(s(d)||c(d))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_REJECT}); +b.detach();return d}}; // Input 30 /* @@ -566,7 +566,7 @@ b.detach();return c}}; @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.OdfUtils"); -odf.TextSerializer=function(){function n(d){var b="",e=m.filter?m.filter.acceptNode(d):NodeFilter.FILTER_ACCEPT,a=d.nodeType,h;if(e===NodeFilter.FILTER_ACCEPT||e===NodeFilter.FILTER_SKIP)for(h=d.firstChild;h;)b+=n(h),h=h.nextSibling;e===NodeFilter.FILTER_ACCEPT&&(a===Node.ELEMENT_NODE&&l.isParagraph(d)?b+="\n":a===Node.TEXT_NODE&&d.textContent&&(b+=d.textContent));return b}var m=this,l=new odf.OdfUtils;this.filter=null;this.writeToString=function(d){return d?n(d):""}}; +odf.TextSerializer=function(){function m(c){var a="",h=n.filter?n.filter.acceptNode(c):NodeFilter.FILTER_ACCEPT,b=c.nodeType,f;if(h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)for(f=c.firstChild;f;)a+=m(f),f=f.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(b===Node.ELEMENT_NODE&&k.isParagraph(c)?a+="\n":b===Node.TEXT_NODE&&c.textContent&&(a+=c.textContent));return a}var n=this,k=new odf.OdfUtils;this.filter=null;this.writeToString=function(c){return c?m(c):""}}; // Input 31 /* @@ -603,10 +603,10 @@ odf.TextSerializer=function(){function n(d){var b="",e=m.filter?m.filter.acceptN @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.Namespaces"); -odf.TextStyleApplicator=function(n,m,l){function d(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=m.getAppliedStylesForElement(d);return b(a,d)}}function b(b){var d={};this.applyStyleToContainer=function(e){var q;q=e.getAttributeNS(a,"style-name");var g=e.ownerDocument;q=q||"";if(!d.hasOwnProperty(q)){var p=q,r=q,w;r?(w=m.getStyleElement(r,"text"),w.parentNode===l?g=w.cloneNode(!0):(g= -g.createElementNS(h,"style:style"),g.setAttributeNS(h,"style:parent-style-name",r),g.setAttributeNS(h,"style:family","text"),g.setAttributeNS(f,"scope","document-content"))):(g=g.createElementNS(h,"style:style"),g.setAttributeNS(h,"style:family","text"),g.setAttributeNS(f,"scope","document-content"));m.updateStyle(g,b,n);l.appendChild(g);d[p]=g}q=d[q].getAttributeNS(h,"name");e.setAttributeNS(a,"text:style-name",q)}}var e=new core.DomUtils,a=odf.Namespaces.textns,h=odf.Namespaces.stylens,f="urn:webodf:names:scope"; -this.applyStyle=function(c,f,k){var h={},g,l,n,m;runtime.assert(k&&k["style:text-properties"],"applyStyle without any text properties");h["style:text-properties"]=k["style:text-properties"];n=new b(h);m=new d(h);c.forEach(function(b){g=m.isStyleApplied(b);if(!1===g){var c=b.ownerDocument,d=b.parentNode,k,h=b,q=new core.LoopWatchDog(1E3);"span"===d.localName&&d.namespaceURI===a?(b.previousSibling&&!e.rangeContainsNode(f,b.previousSibling)?(c=d.cloneNode(!1),d.parentNode.insertBefore(c,d.nextSibling)): -c=d,k=!0):(c=c.createElementNS(a,"text:span"),d.insertBefore(c,b),k=!1);for(;h&&(h===b||e.rangeContainsNode(f,h));)q.check(),d=h.nextSibling,h.parentNode!==c&&c.appendChild(h),h=d;if(h&&k)for(b=c.cloneNode(!1),c.parentNode.insertBefore(b,c.nextSibling);h;)q.check(),d=h.nextSibling,b.appendChild(h),h=d;l=c;n.applyStyleToContainer(l)}})}}; +odf.TextStyleApplicator=function(m,n,k){function c(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(c){c=n.getAppliedStylesForElement(c);return b(a,c)}}function a(a){var c={};this.applyStyleToContainer=function(h){var p;p=h.getAttributeNS(b,"style-name");var g=h.ownerDocument;p=p||"";if(!c.hasOwnProperty(p)){var q=p,s=p,w;s?(w=n.getStyleElement(s,"text"),w.parentNode===k?g=w.cloneNode(!0):(g= +g.createElementNS(f,"style:style"),g.setAttributeNS(f,"style:parent-style-name",s),g.setAttributeNS(f,"style:family","text"),g.setAttributeNS(e,"scope","document-content"))):(g=g.createElementNS(f,"style:style"),g.setAttributeNS(f,"style:family","text"),g.setAttributeNS(e,"scope","document-content"));n.updateStyle(g,a,m);k.appendChild(g);c[q]=g}p=c[p].getAttributeNS(f,"name");h.setAttributeNS(b,"text:style-name",p)}}var h=new core.DomUtils,b=odf.Namespaces.textns,f=odf.Namespaces.stylens,e="urn:webodf:names:scope"; +this.applyStyle=function(d,e,f){var k={},g,m,n,w;runtime.assert(f&&f["style:text-properties"],"applyStyle without any text properties");k["style:text-properties"]=f["style:text-properties"];n=new a(k);w=new c(k);d.forEach(function(a){g=w.isStyleApplied(a);if(!1===g){var c=a.ownerDocument,d=a.parentNode,f,l=a,k=new core.LoopWatchDog(1E3);"span"===d.localName&&d.namespaceURI===b?(a.previousSibling&&!h.rangeContainsNode(e,a.previousSibling)?(c=d.cloneNode(!1),d.parentNode.insertBefore(c,d.nextSibling)): +c=d,f=!0):(c=c.createElementNS(b,"text:span"),d.insertBefore(c,a),f=!1);for(;l&&(l===a||h.rangeContainsNode(e,l));)k.check(),d=l.nextSibling,l.parentNode!==c&&c.appendChild(l),l=d;if(l&&f)for(a=c.cloneNode(!1),c.parentNode.insertBefore(a,c.nextSibling);l;)k.check(),d=l.nextSibling,a.appendChild(l),l=d;m=c;n.applyStyleToContainer(m)}})}}; // Input 32 /* @@ -643,48 +643,48 @@ c=d,k=!0):(c=c.createElementNS(a,"text:span"),d.insertBefore(c,b),k=!1);for(;h&& @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 n(a){var b={},c,d;if(!a)return b;for(a=a.firstChild;a;){if(d=a.namespaceURI!==p||"style"!==a.localName&&"default-style"!==a.localName?a.namespaceURI===u&&"list-style"===a.localName?"list":a.namespaceURI!==p||"page-layout"!==a.localName&&"default-page-layout"!==a.localName?void 0:"page":a.getAttributeNS(p,"family"))(c=a.getAttributeNS&&a.getAttributeNS(p,"name"))||(c=""),d=b[d]=b[d]||{},d[c]=a;a=a.nextSibling}return b}function m(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=m(a[c].derivedStyles,b)))return d;return null}function l(a,b,c){var d=b[a],e,f;d&&(e=d.getAttributeNS(p,"parent-style-name"),f=null,e&&(f=m(c,e),!f&&b[e]&&(l(e,b,c),f=b[e],b[e]=null)),f?(f.derivedStyles||(f.derivedStyles={}),f.derivedStyles[a]=d):c[a]=d)}function d(a,b){for(var c in a)a.hasOwnProperty(c)&&(l(c,a,b),a[c]=null)}function b(a,b){var c=s[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 e(a,c,d){var f=[],g,k;f.push(b(a,c));for(g in d.derivedStyles)if(d.derivedStyles.hasOwnProperty(g))for(k in c=e(a,g,d.derivedStyles[g]),c)c.hasOwnProperty(k)&&f.push(c[k]);return f}function a(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 h(a,b){var c="",d,e;for(d in b)if(b.hasOwnProperty(d)&& -(d=b[d],e=a.getAttributeNS(d[0],d[1]))){e=e.trim();if(da.hasOwnProperty(d[1])){var f=e.indexOf(" "),g=void 0,k=void 0;-1!==f?(g=e.substring(0,f),k=e.substring(f)):(g=e,k="");(g=ba.parseLength(g))&&("pt"===g.unit&&0.75>g.value)&&(e="0.75pt"+k)}d[2]&&(c+=d[2]+":"+e+";")}return c}function f(b){return(b=a(b,p,"text-properties"))?ba.parseFoFontSize(b.getAttributeNS(g,"font-size")):null}function c(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 t(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var e=c.getAttributeNS(u,"level"),f;c=ba.getFirstNonWhitespaceChild(c);c=ba.getFirstNonWhitespaceChild(c);var g;c&&(f=c.attributes,g=f["fo:text-indent"]?f["fo:text-indent"].value:void 0,f=f["fo:margin-left"]?f["fo:margin-left"].value:void 0);g||(g="-0.6cm");c="-"===g.charAt(0)?g.substring(1):"-"+g;for(e=e&&parseInt(e,10);1 text|list-item > text|list",e-=1;e=b+" > text|list-item > *:not(text|list):first-child"; -void 0!==f&&(f=e+"{margin-left:"+f+";}",a.insertRule(f,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+d+";";d+="counter-increment:list;";d+="margin-left:"+g+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(k){throw k;}}function k(b,d,l,n){if("list"===d)for(var r=n.firstChild,m,s;r;){if(r.namespaceURI===u)if(m=r,"list-level-style-number"===r.localName){var v=m;s=v.getAttributeNS(p,"num-format");var L=v.getAttributeNS(p, -"num-suffix"),G={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},v=v.getAttributeNS(p,"num-prefix")||"",v=G.hasOwnProperty(s)?v+(" counter(list, "+G[s]+")"):s?v+("'"+s+"';"):v+" ''";L&&(v+=" '"+L+"'");s="content: "+v+";";t(b,l,m,s)}else"list-level-style-image"===r.localName?(s="content: none;",t(b,l,m,s)):"list-level-style-bullet"===r.localName&&(s="content: '"+m.getAttributeNS(u,"bullet-char")+"';",t(b,l,m,s));r=r.nextSibling}else if("page"===d)if(L=m=l="",r=n.getElementsByTagNameNS(p, -"page-layout-properties")[0],m=r.parentNode.parentNode.parentNode.masterStyles,L="",l+=h(r,M),s=r.getElementsByTagNameNS(p,"background-image"),0f.value)&&(e="0.75pt"+h)}d[2]&&(c+=d[2]+":"+e+";")}return c}function e(a){return(a=b(a,q,"text-properties"))?aa.parseFoFontSize(a.getAttributeNS(g,"font-size")):null}function d(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 t(a,b,c,d){b='text|list[text|style-name="'+b+'"]';var e=c.getAttributeNS(u,"level"),g;c=aa.getFirstNonWhitespaceChild(c);c=aa.getFirstNonWhitespaceChild(c);var f;c&&(g=c.attributes,f=g["fo:text-indent"]?g["fo:text-indent"].value:void 0,g=g["fo:margin-left"]?g["fo:margin-left"].value:void 0);f||(f="-0.6cm");c="-"===f.charAt(0)?f.substring(1):"-"+f;for(e=e&&parseInt(e,10);1 text|list-item > text|list",e-=1;e=b+" > text|list-item > *:not(text|list):first-child"; +void 0!==g&&(g=e+"{margin-left:"+g+";}",a.insertRule(g,a.cssRules.length));d=b+" > text|list-item > *:not(text|list):first-child:before{"+d+";";d+="counter-increment:list;";d+="margin-left:"+f+";";d+="width:"+c+";";d+="display:inline-block}";try{a.insertRule(d,a.cssRules.length)}catch(h){throw h;}}function l(a,c,k,m){if("list"===c)for(var n=m.firstChild,s,r;n;){if(n.namespaceURI===u)if(s=n,"list-level-style-number"===n.localName){var v=s;r=v.getAttributeNS(q,"num-format");var L=v.getAttributeNS(q, +"num-suffix"),C={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},v=v.getAttributeNS(q,"num-prefix")||"",v=C.hasOwnProperty(r)?v+(" counter(list, "+C[r]+")"):r?v+("'"+r+"';"):v+" ''";L&&(v+=" '"+L+"'");r="content: "+v+";";t(a,k,s,r)}else"list-level-style-image"===n.localName?(r="content: none;",t(a,k,s,r)):"list-level-style-bullet"===n.localName&&(r="content: '"+s.getAttributeNS(u,"bullet-char")+"';",t(a,k,s,r));n=n.nextSibling}else if("page"===c)if(L=s=k="",n=m.getElementsByTagNameNS(q, +"page-layout-properties")[0],s=n.parentNode.parentNode.parentNode.masterStyles,L="",k+=f(n,X),r=n.getElementsByTagNameNS(q,"background-image"),0c)break;e=e.nextSibling}a.insertBefore(b,e)}}}function e(a){this.OdfContainer=a}function a(a, -b,c,d){var e=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);e.url=b;if(e.onchange)e.onchange(e);if(e.onstatereadychange)e.onstatereadychange(e)}))}}var h=new odf.StyleInfo,f="urn:oasis:names:tc:opendocument:xmlns:office:1.0",c="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", -t="urn:webodf:names:scope",k="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),q=(new Date).getTime()+"_webodf_",g=new core.Base64;e.prototype=new function(){};e.prototype.constructor=e;e.namespaceURI=f;e.localName="document";a.prototype.load=function(){};a.prototype.getUrl=function(){return this.data?"data:;base64,"+g.toBase64(this.data):null};odf.OdfContainer=function r(g,k){function m(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE? -m(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function y(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS(t,"scope",b),c=c.nextSibling}function s(a,b){var c=null,d,e,f;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)e=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(f=d.getAttributeNS(t,"scope"))&&f!==b&&c.removeChild(d),d=e;return c}function v(a){var b=I.rootElement.ownerDocument,c;if(a){m(a.documentElement);try{c=b.importNode(a.documentElement, -!0)}catch(d){}}return c}function x(a){I.state=a;if(I.onchange)I.onchange(I);if(I.onstatereadychange)I.onstatereadychange(I)}function F(a){$=null;I.rootElement=a;a.fontFaceDecls=n(a,f,"font-face-decls");a.styles=n(a,f,"styles");a.automaticStyles=n(a,f,"automatic-styles");a.masterStyles=n(a,f,"master-styles");a.body=n(a,f,"body");a.meta=n(a,f,"meta")}function E(a){a=v(a);var c=I.rootElement;a&&"document-styles"===a.localName&&a.namespaceURI===f?(c.fontFaceDecls=n(a,f,"font-face-decls"),b(c,c.fontFaceDecls), -c.styles=n(a,f,"styles"),b(c,c.styles),c.automaticStyles=n(a,f,"automatic-styles"),y(c.automaticStyles,"document-styles"),b(c,c.automaticStyles),c.masterStyles=n(a,f,"master-styles"),b(c,c.masterStyles),h.prefixStyleNames(c.automaticStyles,q,c.masterStyles)):x(r.INVALID)}function O(a){a=v(a);var c,d,e;if(a&&"document-content"===a.localName&&a.namespaceURI===f){c=I.rootElement;d=n(a,f,"font-face-decls");if(c.fontFaceDecls&&d)for(e=d.firstChild;e;)c.fontFaceDecls.appendChild(e),e=d.firstChild;else d&& -(c.fontFaceDecls=d,b(c,d));d=n(a,f,"automatic-styles");y(d,"document-content");if(c.automaticStyles&&d)for(e=d.firstChild;e;)c.automaticStyles.appendChild(e),e=d.firstChild;else d&&(c.automaticStyles=d,b(c,d));c.body=n(a,f,"body");b(c,c.body)}else x(r.INVALID)}function z(a){a=v(a);var c;a&&("document-meta"===a.localName&&a.namespaceURI===f)&&(c=I.rootElement,c.meta=n(a,f,"meta"),b(c,c.meta))}function P(a){a=v(a);var c;a&&("document-settings"===a.localName&&a.namespaceURI===f)&&(c=I.rootElement,c.settings= -n(a,f,"settings"),b(c,c.settings))}function C(a){a=v(a);var b;if(a&&"manifest"===a.localName&&a.namespaceURI===c)for(b=I.rootElement,b.manifest=a,a=b.manifest.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===c)&&(R[a.getAttributeNS(c,"full-path")]=a.getAttributeNS(c,"media-type")),a=a.nextSibling}function K(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],S.loadAsDOM(c,function(b,c){d(c);b||I.state===r.INVALID||K(a)})):x(r.DONE)}function M(a){var b="";odf.Namespaces.forEachPrefix(function(a, -c){b+=" xmlns:"+a+'="'+c+'"'});return''}function ca(){var a=new xmldom.LSSerializer,b=M("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(I.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function da(a,b){var d=document.createElementNS(c,"manifest:file-entry");d.setAttributeNS(c,"manifest:full-path",a);d.setAttributeNS(c,"manifest:media-type",b);return d}function aa(){var a= -runtime.parseXML(''),b=n(a,c,"manifest"),d=new xmldom.LSSerializer,e;for(e in R)R.hasOwnProperty(e)&&b.appendChild(da(e,R[e]));d.filter=new odf.OdfNodeFilter;return'\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function ba(){var a=new xmldom.LSSerializer,b=M("document-settings");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(I.rootElement.settings,odf.Namespaces.namespaceMap); -return b+""}function ea(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=s(I.rootElement.automaticStyles,"document-styles"),d=I.rootElement.masterStyles&&I.rootElement.masterStyles.cloneNode(!0),e=M("document-styles");h.removePrefixFromStyleNames(c,q,d);b.filter=new l(d,c);e+=b.writeToString(I.rootElement.fontFaceDecls,a);e+=b.writeToString(I.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+""}function Q(){var a= -odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=s(I.rootElement.automaticStyles,"document-content"),e=M("document-content");b.filter=new d(I.rootElement.body,c);e+=b.writeToString(c,a);e+=b.writeToString(I.rootElement.body,a);return e+""}function W(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var d=v(c);d&&"document"===d.localName&&d.namespaceURI===f?(F(d),x(r.DONE)):x(r.INVALID)}})}function U(){function a(b,c){var e;c||(c=b);e=document.createElementNS(f,c); -d[b]=e;d.appendChild(e)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),d=I.rootElement,e=document.createElementNS(f,"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");d.body.appendChild(e);x(r.DONE);return b}function N(){var a,b=new Date;a=runtime.byteArrayFromString(ba(),"utf8"); -S.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(ca(),"utf8");S.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(ea(),"utf8");S.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(Q(),"utf8");S.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(aa(),"utf8");S.save("META-INF/manifest.xml",a,!0,b)}function D(a,b){N();S.writeAs(a,function(a){b(a)})}var I=this,S,R={},$;this.onstatereadychange=k;this.rootElement=this.state=this.onchange=null;this.setRootElement=F;this.getContentElement= -function(){var a;$||(a=I.rootElement.body,$=a.getElementsByTagNameNS(f,"text")[0]||a.getElementsByTagNameNS(f,"presentation")[0]||a.getElementsByTagNameNS(f,"spreadsheet")[0]);return $};this.getDocumentType=function(){var a=I.getContentElement();return a&&a.localName};this.getPart=function(b){return new a(b,R[b],I,S)};this.getPartData=function(a,b){S.load(a,b)};this.createByteArray=function(a,b){N();S.createByteArray(a,b)};this.saveAs=D;this.save=function(a){D(g,a)};this.getUrl=function(){return g}; -this.state=r.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}(e);S=g?new core.Zip(g,function(a,b){S=b;a?W(g,function(b){a&&(S.error=a+"\n"+b,x(r.INVALID))}):K([["styles.xml",E],["content.xml",O],["meta.xml",z],["settings.xml",P],["META-INF/manifest.xml",C]])}):U()};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING= +odf.OdfContainer=function(){function m(a,b,c){for(a=a?a.firstChild:null;a;){if(a.localName===c&&a.namespaceURI===b)return a;a=a.nextSibling}return null}function n(a){var b,c=l.length;for(b=0;bc)break;e=e.nextSibling}a.insertBefore(b,e)}}}function h(a){this.OdfContainer=a}function b(a, +b,c,d){var e=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);e.url=b;if(e.onchange)e.onchange(e);if(e.onstatereadychange)e.onstatereadychange(e)}))}}var f=new odf.StyleInfo,e="urn:oasis:names:tc:opendocument:xmlns:office:1.0",d="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", +t="urn:webodf:names:scope",l="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),p=(new Date).getTime()+"_webodf_",g=new core.Base64;h.prototype=new function(){};h.prototype.constructor=h;h.namespaceURI=e;h.localName="document";b.prototype.load=function(){};b.prototype.getUrl=function(){return this.data?"data:;base64,"+g.toBase64(this.data):null};odf.OdfContainer=function s(g,l){function n(a){for(var b=a.firstChild,c;b;)c=b.nextSibling,b.nodeType===Node.ELEMENT_NODE? +n(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=c}function x(a,b){for(var c=a&&a.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS(t,"scope",b),c=c.nextSibling}function r(a,b){var c=null,d,e,g;if(a)for(c=a.cloneNode(!0),d=c.firstChild;d;)e=d.nextSibling,d.nodeType===Node.ELEMENT_NODE&&(g=d.getAttributeNS(t,"scope"))&&g!==b&&c.removeChild(d),d=e;return c}function v(a){var b=F.rootElement.ownerDocument,c;if(a){n(a.documentElement);try{c=b.importNode(a.documentElement, +!0)}catch(d){}}return c}function D(a){F.state=a;if(F.onchange)F.onchange(F);if(F.onstatereadychange)F.onstatereadychange(F)}function G(a){ba=null;F.rootElement=a;a.fontFaceDecls=m(a,e,"font-face-decls");a.styles=m(a,e,"styles");a.automaticStyles=m(a,e,"automatic-styles");a.masterStyles=m(a,e,"master-styles");a.body=m(a,e,"body");a.meta=m(a,e,"meta")}function y(b){b=v(b);var c=F.rootElement;b&&"document-styles"===b.localName&&b.namespaceURI===e?(c.fontFaceDecls=m(b,e,"font-face-decls"),a(c,c.fontFaceDecls), +c.styles=m(b,e,"styles"),a(c,c.styles),c.automaticStyles=m(b,e,"automatic-styles"),x(c.automaticStyles,"document-styles"),a(c,c.automaticStyles),c.masterStyles=m(b,e,"master-styles"),a(c,c.masterStyles),f.prefixStyleNames(c.automaticStyles,p,c.masterStyles)):D(s.INVALID)}function P(b){b=v(b);var c,d,g;if(b&&"document-content"===b.localName&&b.namespaceURI===e){c=F.rootElement;d=m(b,e,"font-face-decls");if(c.fontFaceDecls&&d)for(g=d.firstChild;g;)c.fontFaceDecls.appendChild(g),g=d.firstChild;else d&& +(c.fontFaceDecls=d,a(c,d));d=m(b,e,"automatic-styles");x(d,"document-content");if(c.automaticStyles&&d)for(g=d.firstChild;g;)c.automaticStyles.appendChild(g),g=d.firstChild;else d&&(c.automaticStyles=d,a(c,d));c.body=m(b,e,"body");a(c,c.body)}else D(s.INVALID)}function z(b){b=v(b);var c;b&&("document-meta"===b.localName&&b.namespaceURI===e)&&(c=F.rootElement,c.meta=m(b,e,"meta"),a(c,c.meta))}function R(b){b=v(b);var c;b&&("document-settings"===b.localName&&b.namespaceURI===e)&&(c=F.rootElement,c.settings= +m(b,e,"settings"),a(c,c.settings))}function E(a){a=v(a);var b;if(a&&"manifest"===a.localName&&a.namespaceURI===d)for(b=F.rootElement,b.manifest=a,a=b.manifest.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&("file-entry"===a.localName&&a.namespaceURI===d)&&(Q[a.getAttributeNS(d,"full-path")]=a.getAttributeNS(d,"media-type")),a=a.nextSibling}function K(a){var b=a.shift(),c,d;b?(c=b[0],d=b[1],I.loadAsDOM(c,function(b,c){d(c);b||F.state===s.INVALID||K(a)})):D(s.DONE)}function X(a){var b="";odf.Namespaces.forEachPrefix(function(a, +c){b+=" xmlns:"+a+'="'+c+'"'});return''}function oa(){var a=new xmldom.LSSerializer,b=X("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(F.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function L(a,b){var c=document.createElementNS(d,"manifest:file-entry");c.setAttributeNS(d,"manifest:full-path",a);c.setAttributeNS(d,"manifest:media-type",b);return c}function ra(){var a= +runtime.parseXML(''),b=m(a,d,"manifest"),c=new xmldom.LSSerializer,e;for(e in Q)Q.hasOwnProperty(e)&&b.appendChild(L(e,Q[e]));c.filter=new odf.OdfNodeFilter;return'\n'+c.writeToString(a,odf.Namespaces.namespaceMap)}function aa(){var a=new xmldom.LSSerializer,b=X("document-settings");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(F.rootElement.settings,odf.Namespaces.namespaceMap); +return b+""}function ea(){var a=odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,c=r(F.rootElement.automaticStyles,"document-styles"),d=F.rootElement.masterStyles&&F.rootElement.masterStyles.cloneNode(!0),e=X("document-styles");f.removePrefixFromStyleNames(c,p,d);b.filter=new k(d,c);e+=b.writeToString(F.rootElement.fontFaceDecls,a);e+=b.writeToString(F.rootElement.styles,a);e+=b.writeToString(c,a);e+=b.writeToString(d,a);return e+""}function O(){var a= +odf.Namespaces.namespaceMap,b=new xmldom.LSSerializer,d=r(F.rootElement.automaticStyles,"document-content"),e=X("document-content");b.filter=new c(F.rootElement.body,d);e+=b.writeToString(d,a);e+=b.writeToString(F.rootElement.body,a);return e+""}function V(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var d=v(c);d&&"document"===d.localName&&d.namespaceURI===e?(G(d),D(s.DONE)):D(s.INVALID)}})}function S(){function a(b,c){var g;c||(c=b);g=document.createElementNS(e,c); +d[b]=g;d.appendChild(g)}var b=new core.Zip("",null),c=runtime.byteArrayFromString("application/vnd.oasis.opendocument.text","utf8"),d=F.rootElement,g=document.createElementNS(e,"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");d.body.appendChild(g);D(s.DONE);return b}function M(){var a,b=new Date;a=runtime.byteArrayFromString(aa(),"utf8"); +I.save("settings.xml",a,!0,b);a=runtime.byteArrayFromString(oa(),"utf8");I.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(ea(),"utf8");I.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(O(),"utf8");I.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(ra(),"utf8");I.save("META-INF/manifest.xml",a,!0,b)}function H(a,b){M();I.writeAs(a,function(a){b(a)})}var F=this,I,Q={},ba;this.onstatereadychange=l;this.rootElement=this.state=this.onchange=null;this.setRootElement=G;this.getContentElement= +function(){var a;ba||(a=F.rootElement.body,ba=a.getElementsByTagNameNS(e,"text")[0]||a.getElementsByTagNameNS(e,"presentation")[0]||a.getElementsByTagNameNS(e,"spreadsheet")[0]);return ba};this.getDocumentType=function(){var a=F.getContentElement();return a&&a.localName};this.getPart=function(a){return new b(a,Q[a],F,I)};this.getPartData=function(a,b){I.load(a,b)};this.createByteArray=function(a,b){M();I.createByteArray(a,b)};this.saveAs=H;this.save=function(a){H(g,a)};this.getUrl=function(){return g}; +this.state=s.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}(h);I=g?new core.Zip(g,function(a,b){I=b;a?V(g,function(b){a&&(I.error=a+"\n"+b,D(s.INVALID))}):K([["styles.xml",y],["content.xml",P],["meta.xml",z],["settings.xml",R],["META-INF/manifest.xml",E]])}):S()};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 34 /* @@ -722,9 +722,9 @@ this.state=r.LOADING;this.rootElement=function(a){var b=document.createElementNS @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.Base64");runtime.loadClass("xmldom.XPath");runtime.loadClass("odf.OdfContainer"); -odf.FontLoader=function(){function n(d,b,e,a,h){var f,c=0,m;for(m in d)if(d.hasOwnProperty(m)){if(c===e){f=m;break}c+=1}f?b.getPartData(d[f].href,function(c,m){if(c)runtime.log(c);else{var g="@font-face { font-family: '"+(d[f].family||f)+"'; src: url(data:application/x-font-ttf;charset=binary;base64,"+l.convertUTF8ArrayToBase64(m)+') format("truetype"); }';try{a.insertRule(g,a.cssRules.length)}catch(p){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(p)+"\nRule: "+g)}}n(d,b,e+1,a,h)}): -h&&h()}var m=new xmldom.XPath,l=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(d,b){for(var e=d.rootElement.fontFaceDecls;b.cssRules.length;)b.deleteRule(b.cssRules.length-1);if(e){var a={},h,f,c,l;if(e)for(e=m.getODFElementsWithXPath(e,"style:font-face[svg:font-face-src]",odf.Namespaces.resolvePrefix),h=0;h text|list-item > *:first-child:before {";if(X=x.getAttributeNS(v,"style-name")){x=n[X];H=P.getFirstNonWhitespaceChild(x);x=void 0;if(H)if("list-level-style-number"===H.localName){x=H.getAttributeNS(A,"num-format");X=H.getAttributeNS(A,"num-suffix");var va="",va={1:"decimal",a:"lower-latin",A:"upper-latin", -i:"lower-roman",I:"upper-roman"},qa=void 0,qa=H.getAttributeNS(A,"num-prefix")||"",qa=va.hasOwnProperty(x)?qa+(" counter(list, "+va[x]+")"):x?qa+("'"+x+"';"):qa+" ''";X&&(qa+=" '"+X+"'");x=va="content: "+qa+";"}else"list-level-style-image"===H.localName?x="content: none;":"list-level-style-bullet"===H.localName&&(x="content: '"+H.getAttributeNS(v,"bullet-char")+"';");H=x}if(C){for(x=m[C];x;)C=x,x=m[C];D+="counter-increment:"+C+";";H?(H=H.replace("list",C),D+=H):D+="content:counter("+C+");"}else C= -"",H?(H=H.replace("list",q),D+=H):D+="content: counter("+q+");",D+="counter-increment:"+q+";",h.insertRule("text|list#"+q+" {counter-reset:"+q+"}",h.cssRules.length);D+="}";m[q]=C;D&&h.insertRule(D,h.cssRules.length)}M.insertBefore(K,M.firstChild);y();E(g);if(!d&&(g=[Y],ha.hasOwnProperty("statereadychange")))for(h=ha.statereadychange,H=0;H text|list-item > *:first-child:before {";if(C=y.getAttributeNS(v,"style-name")){y= +q[C];Z=R.getFirstNonWhitespaceChild(y);y=void 0;if(Z)if("list-level-style-number"===Z.localName){y=Z.getAttributeNS(A,"num-format");C=Z.getAttributeNS(A,"num-suffix");var wa="",wa={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},qa=void 0,qa=Z.getAttributeNS(A,"num-prefix")||"",qa=wa.hasOwnProperty(y)?qa+(" counter(list, "+wa[y]+")"):y?qa+("'"+y+"';"):qa+" ''";C&&(qa+=" '"+C+"'");y=wa="content: "+qa+";"}else"list-level-style-image"===Z.localName?y="content: none;":"list-level-style-bullet"=== +Z.localName&&(y="content: '"+Z.getAttributeNS(v,"bullet-char")+"';");Z=y}if(E){for(y=n[E];y;)E=y,y=n[E];da+="counter-increment:"+E+";";Z?(Z=Z.replace("list",E),da+=Z):da+="content:counter("+E+");"}else E="",Z?(Z=Z.replace("list",u),da+=Z):da+="content: counter("+u+");",da+="counter-increment:"+u+";",k.insertRule("text|list#"+u+" {counter-reset:"+u+"}",k.cssRules.length);da+="}";n[u]=E;da&&k.insertRule(da,k.cssRules.length)}N.insertBefore(K,N.firstChild);x();D(g);if(!a&&(g=[I],ma.hasOwnProperty("statereadychange")))for(k= +ma.statereadychange,Z=0;Zc?-h.countBackwardSteps(-c, -f):0;a.move(c);b&&(f=0b?-h.countBackwardSteps(-b,f):0,a.move(f,!0));e.emit(ops.OdtDocument.signalCursorMoved,a);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:m,timestamp:l,position:d,length:b}}}; +ops.OpMoveCursor=function(){var m=this,n,k,c,a;this.init=function(h){n=h.memberid;k=h.timestamp;c=parseInt(h.position,10);a=void 0!==h.length?parseInt(h.length,10):0};this.merge=function(h){return"MoveCursor"===h.optype&&h.memberid===n?(c=h.position,a=h.length,k=h.timestamp,!0):!1};this.transform=function(h,b){var f=h.spec(),e=c+a,d,k=[m];switch(f.optype){case "RemoveText":d=f.position+f.length;d<=c?c-=f.length:f.positiond?-f.countBackwardSteps(-d, +e):0;b.move(d);a&&(e=0a?-f.countBackwardSteps(-a,e):0,b.move(e,!0));h.emit(ops.OdtDocument.signalCursorMoved,b);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:n,timestamp:k,position:c,length:a}}}; // Input 45 /* @@ -1132,11 +1132,11 @@ f):0;a.move(c);b&&(f=0b?-h.countBackwardSteps(-b,f @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpInsertTable=function(){function n(a,c){var d;if(1===t.length)d=t[0];else if(3===t.length)switch(a){case 0:d=t[0];break;case b-1:d=t[2];break;default:d=t[1]}else d=t[a];if(1===d.length)return d[0];if(3===d.length)switch(c){case 0:return d[0];case e-1:return d[2];default:return d[1]}return d[c]}var m=this,l,d,b,e,a,h,f,c,t;this.init=function(k){l=k.memberid;d=k.timestamp;a=parseInt(k.position,10);b=parseInt(k.initialRows,10);e=parseInt(k.initialColumns,10);h=k.tableName;f=k.tableStyleName;c=k.tableColumnStyleName; -t=k.tableCellStyleMatrix};this.transform=function(b,c){var d=b.spec(),e=[m];switch(d.optype){case "InsertTable":e=null;break;case "AddAnnotation":d.position=a.textNode.length?null:a.textNode.splitText(a.offset));for(a=a.textNode;a!==f;)if(a=a.parentNode,c=a.cloneNode(!1),k){for(n&&c.appendChild(n);k.nextSibling;)c.appendChild(k.nextSibling); -a.parentNode.insertBefore(c,a.nextSibling);k=a;n=c}else a.parentNode.insertBefore(c,a),k=c,n=a;b.isListItem(n)&&(n=n.childNodes[0]);e.fixCursorPositions(m);e.getOdfCanvas().refreshSize();e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:h,memberId:m,timeStamp:l});e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:n,memberId:m,timeStamp:l});e.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:m,timestamp:l,position:d}}}; +ops.OpSplitParagraph=function(){var m=this,n,k,c,a=new odf.OdfUtils;this.init=function(a){n=a.memberid;k=a.timestamp;c=parseInt(a.position,10)};this.transform=function(a,b){var f=a.spec(),e=[m];switch(f.optype){case "SplitParagraph":f.position=b.textNode.length?null:b.textNode.splitText(b.offset));for(b=b.textNode;b!==e;)if(b=b.parentNode,d=b.cloneNode(!1),l){for(m&&d.appendChild(m);l.nextSibling;)d.appendChild(l.nextSibling); +b.parentNode.insertBefore(d,b.nextSibling);l=b;m=d}else b.parentNode.insertBefore(d,b),l=d,m=b;a.isListItem(m)&&(m=m.childNodes[0]);h.fixCursorPositions(n);h.getOdfCanvas().refreshSize();h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:f,memberId:n,timeStamp:k});h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:m,memberId:n,timeStamp:k});h.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",memberid:n,timestamp:k,position:c}}}; // Input 49 /* @@ -1292,8 +1292,8 @@ a.parentNode.insertBefore(c,a.nextSibling);k=a;n=c}else a.parentNode.insertBefor @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpSetParagraphStyle=function(){var n=this,m,l,d,b;this.init=function(e){m=e.memberid;l=e.timestamp;d=e.position;b=e.styleName};this.transform=function(d,a){var h=d.spec(),f=[n];switch(h.optype){case "RemoveParagraphStyle":h.styleName===b&&(b="")}return f};this.execute=function(e){var a;if(a=e.getPositionInTextNode(d))if(a=e.getParagraphElement(a.textNode))return""!==b?a.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",b):a.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", -"style-name"),e.getOdfCanvas().refreshSize(),e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,timeStamp:l,memberId:m}),e.getOdfCanvas().rerenderAnnotations(),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:m,timestamp:l,position:d,styleName:b}}}; +ops.OpSetParagraphStyle=function(){var m=this,n,k,c,a;this.init=function(h){n=h.memberid;k=h.timestamp;c=h.position;a=h.styleName};this.transform=function(c,b){var f=c.spec(),e=[m];switch(f.optype){case "RemoveParagraphStyle":f.styleName===a&&(a="")}return e};this.execute=function(h){var b;if(b=h.getPositionInTextNode(c))if(b=h.getParagraphElement(b.textNode))return""!==a?b.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",a):b.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0", +"style-name"),h.getOdfCanvas().refreshSize(),h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,timeStamp:k,memberId:n}),h.getOdfCanvas().rerenderAnnotations(),!0;return!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:n,timestamp:k,position:c,styleName:a}}}; // Input 50 /* @@ -1329,13 +1329,13 @@ ops.OpSetParagraphStyle=function(){var n=this,m,l,d,b;this.init=function(e){m=e. @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.OpUpdateParagraphStyle=function(){function n(a,b){var c,d,e=b?b.split(","):[];for(c=0;ck?-g.countBackwardSteps(-k,c):0,m.move(c),h.emit(ops.OdtDocument.signalCursorMoved,m));h.getOdfCanvas().addAnnotation(f);return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:l,timestamp:d,position:b, -length:e,name:a}}}; +ops.OpAddAnnotation=function(){function m(a,b,c){if(c=a.getPositionInTextNode(c,k))a=c.textNode,c.offset!==a.length&&a.splitText(c.offset),a.parentNode.insertBefore(b,a.nextSibling)}var n=this,k,c,a,h,b;this.init=function(f){k=f.memberid;c=parseInt(f.timestamp,10);a=parseInt(f.position,10);h=parseInt(f.length,10)||0;b=f.name};this.transform=function(b,c){var d=b.spec(),k=a+h,l=[n];switch(d.optype){case "AddAnnotation":d.positionl?-g.countBackwardSteps(-l,d):0,n.move(d),f.emit(ops.OdtDocument.signalCursorMoved,n));f.getOdfCanvas().addAnnotation(e);return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:k,timestamp:c,position:a, +length:h,name:b}}}; // Input 54 /* @@ -1489,9 +1489,9 @@ length:e,name:a}}}; @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.Namespaces");runtime.loadClass("core.DomUtils"); -ops.OpRemoveAnnotation=function(){var n,m,l,d,b;this.init=function(e){n=e.memberid;m=e.timestamp;l=parseInt(e.position,10);d=parseInt(e.length,10);b=new core.DomUtils};this.transform=function(b,a){return null};this.execute=function(d){for(var a=d.getIteratorAtPosition(l).container(),h,f=null,c=null;a.namespaceURI!==odf.Namespaces.officens||"annotation"!==a.localName;)a=a.parentNode;if(null===a)return!1;f=a;(h=f.getAttributeNS(odf.Namespaces.officens,"name"))&&(c=b.getElementsByTagNameNS(d.getRootNode(), -odf.Namespaces.officens,"annotation-end").filter(function(a){return h===a.getAttributeNS(odf.Namespaces.officens,"name")})[0]||null);d.getOdfCanvas().forgetAnnotations();for(a=b.getElementsByTagNameNS(f,odf.Namespaces.webodfns+":names:cursor","cursor");a.length;)f.parentNode.insertBefore(a.pop(),f);f.parentNode.removeChild(f);c&&c.parentNode.removeChild(c);d.fixCursorPositions();d.getOdfCanvas().refreshAnnotations();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:n,timestamp:m, -position:l,length:d}}}; +ops.OpRemoveAnnotation=function(){var m,n,k,c,a;this.init=function(h){m=h.memberid;n=h.timestamp;k=parseInt(h.position,10);c=parseInt(h.length,10);a=new core.DomUtils};this.transform=function(a,b){return null};this.execute=function(c){for(var b=c.getIteratorAtPosition(k).container(),f,e=null,d=null;b.namespaceURI!==odf.Namespaces.officens||"annotation"!==b.localName;)b=b.parentNode;if(null===b)return!1;e=b;(f=e.getAttributeNS(odf.Namespaces.officens,"name"))&&(d=a.getElementsByTagNameNS(c.getRootNode(), +odf.Namespaces.officens,"annotation-end").filter(function(a){return f===a.getAttributeNS(odf.Namespaces.officens,"name")})[0]||null);c.getOdfCanvas().forgetAnnotations();for(b=a.getElementsByTagNameNS(e,odf.Namespaces.webodfns+":names:cursor","cursor");b.length;)e.parentNode.insertBefore(b.pop(),e);e.parentNode.removeChild(e);d&&d.parentNode.removeChild(d);c.fixCursorPositions();c.getOdfCanvas().refreshAnnotations();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:m,timestamp:n, +position:k,length:c}}}; // Input 55 /* @@ -1529,21 +1529,21 @@ position:l,length:d}}}; */ runtime.loadClass("ops.OpAddCursor");runtime.loadClass("ops.OpApplyDirectStyling");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.OpAddParagraphStyle");runtime.loadClass("ops.OpRemoveParagraphStyle"); runtime.loadClass("ops.OpAddAnnotation");runtime.loadClass("ops.OpRemoveAnnotation"); -ops.OperationFactory=function(){function n(l){return function(){return new l}}var m;this.register=function(l,d){m[l]=d};this.create=function(l){var d=null,b=m[l.optype];b&&(d=b(l),d.init(l));return d};m={AddCursor:n(ops.OpAddCursor),ApplyDirectStyling:n(ops.OpApplyDirectStyling),InsertTable:n(ops.OpInsertTable),InsertText:n(ops.OpInsertText),RemoveText:n(ops.OpRemoveText),SplitParagraph:n(ops.OpSplitParagraph),SetParagraphStyle:n(ops.OpSetParagraphStyle),UpdateParagraphStyle:n(ops.OpUpdateParagraphStyle), -AddParagraphStyle:n(ops.OpAddParagraphStyle),RemoveParagraphStyle:n(ops.OpRemoveParagraphStyle),MoveCursor:n(ops.OpMoveCursor),RemoveCursor:n(ops.OpRemoveCursor),AddAnnotation:n(ops.OpAddAnnotation),RemoveAnnotation:n(ops.OpRemoveAnnotation)}}; +ops.OperationFactory=function(){function m(k){return function(){return new k}}var n;this.register=function(k,c){n[k]=c};this.create=function(k){var c=null,a=n[k.optype];a&&(c=a(k),c.init(k));return c};n={AddCursor:m(ops.OpAddCursor),ApplyDirectStyling:m(ops.OpApplyDirectStyling),InsertTable:m(ops.OpInsertTable),InsertText:m(ops.OpInsertText),RemoveText:m(ops.OpRemoveText),SplitParagraph:m(ops.OpSplitParagraph),SetParagraphStyle:m(ops.OpSetParagraphStyle),UpdateParagraphStyle:m(ops.OpUpdateParagraphStyle), +AddParagraphStyle:m(ops.OpAddParagraphStyle),RemoveParagraphStyle:m(ops.OpRemoveParagraphStyle),MoveCursor:m(ops.OpMoveCursor),RemoveCursor:m(ops.OpRemoveCursor),AddAnnotation:m(ops.OpAddAnnotation),RemoveAnnotation:m(ops.OpRemoveAnnotation)}}; // Input 56 runtime.loadClass("core.Cursor");runtime.loadClass("core.PositionIterator");runtime.loadClass("core.PositionFilter");runtime.loadClass("core.LoopWatchDog");runtime.loadClass("odf.OdfUtils"); -gui.SelectionMover=function(n,m){function l(){u.setUnfilteredPosition(n.getNode(),0);return u}function d(a,b){var c,d=null;a&&(c=b?a[a.length-1]:a[0]);c&&(d={top:c.top,left:b?c.right:c.left,bottom:c.bottom});return d}function b(a,c,e,f){var g=a.nodeType;e.setStart(a,c);e.collapse(!f);f=d(e.getClientRects(),!0===f);!f&&0a?-1:1;for(a=Math.abs(a);0k?n.previousPosition():n.nextPosition());)if(I.check(),h.acceptPosition(n)===s&&(r+=1,p=n.container(),w=b(p,n.unfilteredDomOffset(),D),w.top!==W)){if(w.top!==N&&N!==W)break;N=w.top;w=Math.abs(U-w.left);if(null===q||wa?(d=h.previousPosition,e=-1):(d=h.nextPosition,e=1);for(f=b(h.container(),h.unfilteredDomOffset(),p);d.call(h);)if(c.acceptPosition(h)===s){if(w.getParagraphElement(h.getCurrentNode())!==k)break;g=b(h.container(),h.unfilteredDomOffset(),p);if(g.bottom!==f.bottom&&(f=g.top>=f.top&&g.bottomf.bottom,!f))break;n+=e;f=g}p.detach();return n}function p(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 r(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=l(),e=d.container(),f=d.unfilteredDomOffset(),g=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,f);var e=a,f=b,k=d.container(), -m=d.unfilteredDomOffset();if(e===k)e=m-f;else{var n=e.compareDocumentPosition(k);2===n?n=-1:4===n?n=1:10===n?(f=p(e,k),n=fe)for(;d.nextPosition()&&(h.check(),c.acceptPosition(d)===s&&(g+=1),d.container()!==a||d.unfilteredDomOffset()!==b););else if(0b?-1:1;for(b=Math.abs(b);0l?m.previousPosition():m.nextPosition());)if(F.check(),h.acceptPosition(m)===r&&(s+=1,q=m.container(),w=a(q,m.unfilteredDomOffset(),H),w.top!==V)){if(w.top!==M&&M!==V)break;M=w.top;w=Math.abs(S-w.left);if(null===p||wb?(d=h.previousPosition,e=-1):(d=h.nextPosition,e=1);for(g=a(h.container(),h.unfilteredDomOffset(),q);d.call(h);)if(c.acceptPosition(h)===r){if(w.getParagraphElement(h.getCurrentNode())!==l)break;f=a(h.container(),h.unfilteredDomOffset(),q);if(f.bottom!==g.bottom&&(g=f.top>=g.top&&f.bottomg.bottom,!g))break;m+=e;g=f}q.detach();return m}function q(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 s(a,b,c){runtime.assert(null!==a,"SelectionMover.countStepsToPosition called with element===null");var d=k(),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,l=d.container(), +m=d.unfilteredDomOffset();if(e===l)e=m-g;else{var n=e.compareDocumentPosition(l);2===n?n=-1:4===n?n=1:10===n?(g=q(e,l),n=ge)for(;d.nextPosition()&&(h.check(),c.acceptPosition(d)===r&&(f+=1),d.container()!==a||d.unfilteredDomOffset()!==b););else if(0=b&&(h=-d.movePointBackward(-b,a));l.handleUpdate();return h};this.handleUpdate=function(){};this.getStepCounter=function(){return d.getStepCounter()};this.getMemberId=function(){return n};this.getNode=function(){return b.getNode()};this.getAnchorNode=function(){return b.getAnchorNode()};this.getSelectedRange=function(){return b.getSelectedRange()}; -this.getOdtDocument=function(){return m};b=new core.Cursor(m.getDOM(),n);d=new gui.SelectionMover(b,m.getRootNode())}; +ops.OdtCursor=function(m,n){var k=this,c,a;this.removeFromOdtDocument=function(){a.remove()};this.move=function(a,b){var f=0;0=a&&(f=-c.movePointBackward(-a,b));k.handleUpdate();return f};this.handleUpdate=function(){};this.getStepCounter=function(){return c.getStepCounter()};this.getMemberId=function(){return m};this.getNode=function(){return a.getNode()};this.getAnchorNode=function(){return a.getAnchorNode()};this.getSelectedRange=function(){return a.getSelectedRange()}; +this.getOdtDocument=function(){return n};a=new core.Cursor(n.getDOM(),m);c=new gui.SelectionMover(a,n.getRootNode())}; // Input 59 /* @@ -1621,19 +1621,20 @@ this.getOdtDocument=function(){return m};b=new core.Cursor(m.getDOM(),n);d=new g @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -ops.EditInfo=function(n,m){function l(){var d=[],a;for(a in b)b.hasOwnProperty(a)&&d.push({memberid:a,time:b[a].time});d.sort(function(a,b){return a.time-b.time});return d}var d,b={};this.getNode=function(){return d};this.getOdtDocument=function(){return m};this.getEdits=function(){return b};this.getSortedEdits=function(){return l()};this.addEdit=function(d,a){b[d]={time:a}};this.clearEdits=function(){b={}};d=m.getDOM().createElementNS("urn:webodf:names:editinfo","editinfo");n.insertBefore(d,n.firstChild)}; +ops.EditInfo=function(m,n){function k(){var c=[],b;for(b in a)a.hasOwnProperty(b)&&c.push({memberid:b,time:a[b].time});c.sort(function(a,b){return a.time-b.time});return c}var c,a={};this.getNode=function(){return c};this.getOdtDocument=function(){return n};this.getEdits=function(){return a};this.getSortedEdits=function(){return k()};this.addEdit=function(c,b){a[c]={time:b}};this.clearEdits=function(){a={}};this.destroy=function(a){m.removeChild(c);a()};c=n.getDOM().createElementNS("urn:webodf:names:editinfo", +"editinfo");m.insertBefore(c,m.firstChild)}; // Input 60 -gui.Avatar=function(n,m){var l=this,d,b,e;this.setColor=function(a){b.style.borderColor=a};this.setImageUrl=function(a){l.isVisible()?b.src=a:e=a};this.isVisible=function(){return"block"===d.style.display};this.show=function(){e&&(b.src=e,e=void 0);d.style.display="block"};this.hide=function(){d.style.display="none"};this.markAsFocussed=function(a){d.className=a?"active":""};(function(){var a=n.ownerDocument,e=a.documentElement.namespaceURI;d=a.createElementNS(e,"div");b=a.createElementNS(e,"img"); -b.width=64;b.height=64;d.appendChild(b);d.style.width="64px";d.style.height="70px";d.style.position="absolute";d.style.top="-80px";d.style.left="-34px";d.style.display=m?"block":"none";n.appendChild(d)})()}; +gui.Avatar=function(m,n){var k=this,c,a,h;this.setColor=function(b){a.style.borderColor=b};this.setImageUrl=function(b){k.isVisible()?a.src=b:h=b};this.isVisible=function(){return"block"===c.style.display};this.show=function(){h&&(a.src=h,h=void 0);c.style.display="block"};this.hide=function(){c.style.display="none"};this.markAsFocussed=function(a){c.className=a?"active":""};this.destroy=function(a){m.removeChild(c);a()};(function(){var b=m.ownerDocument,f=b.documentElement.namespaceURI;c=b.createElementNS(f, +"div");a=b.createElementNS(f,"img");a.width=64;a.height=64;c.appendChild(a);c.style.width="64px";c.style.height="70px";c.style.position="absolute";c.style.top="-80px";c.style.left="-34px";c.style.display=n?"block":"none";m.appendChild(c)})()}; // Input 61 runtime.loadClass("gui.Avatar");runtime.loadClass("ops.OdtCursor"); -gui.Caret=function(n,m,l){function d(e){h&&a.parentNode&&(!f||e)&&(e&&void 0!==c&&runtime.clearTimeout(c),f=!0,b.style.opacity=e||"0"===b.style.opacity?"1":"0",c=runtime.setTimeout(function(){f=!1;d(!1)},500))}var b,e,a,h=!1,f=!1,c;this.refreshCursorBlinking=function(){l||n.getSelectedRange().collapsed?(h=!0,d(!0)):(h=!1,b.style.opacity="0")};this.setFocus=function(){h=!0;e.markAsFocussed(!0);d(!0)};this.removeFocus=function(){h=!1;e.markAsFocussed(!1);b.style.opacity="0"};this.setAvatarImageUrl= -function(a){e.setImageUrl(a)};this.setColor=function(a){b.style.borderColor=a;e.setColor(a)};this.getCursor=function(){return n};this.getFocusElement=function(){return b};this.toggleHandleVisibility=function(){e.isVisible()?e.hide():e.show()};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};this.ensureVisible=function(){var a,c,d,e,f=n.getOdtDocument().getOdfCanvas().getElement().parentNode,h;d=f.offsetWidth-f.clientWidth+5;e=f.offsetHeight-f.clientHeight+5;h=b.getBoundingClientRect(); -a=h.left-d;c=h.top-e;d=h.right+d;e=h.bottom+e;h=f.getBoundingClientRect();ch.bottom&&(f.scrollTop+=e-h.bottom);ah.right&&(f.scrollLeft+=d-h.right)};(function(){var c=n.getOdtDocument().getDOM();b=c.createElementNS(c.documentElement.namespaceURI,"span");a=n.getNode();a.appendChild(b);e=new gui.Avatar(a,m)})()}; +gui.Caret=function(m,n,k){function c(h){f&&b.parentNode&&(!e||h)&&(h&&void 0!==d&&runtime.clearTimeout(d),e=!0,a.style.opacity=h||"0"===a.style.opacity?"1":"0",d=runtime.setTimeout(function(){e=!1;c(!1)},500))}var a,h,b,f=!1,e=!1,d;this.refreshCursorBlinking=function(){k||m.getSelectedRange().collapsed?(f=!0,c(!0)):(f=!1,a.style.opacity="0")};this.setFocus=function(){f=!0;h.markAsFocussed(!0);c(!0)};this.removeFocus=function(){f=!1;h.markAsFocussed(!1);a.style.opacity="0"};this.setAvatarImageUrl= +function(a){h.setImageUrl(a)};this.setColor=function(b){a.style.borderColor=b;h.setColor(b)};this.getCursor=function(){return m};this.getFocusElement=function(){return a};this.toggleHandleVisibility=function(){h.isVisible()?h.hide():h.show()};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.ensureVisible=function(){var b,c,d,e,f=m.getOdtDocument().getOdfCanvas().getElement().parentNode,h;d=f.offsetWidth-f.clientWidth+5;e=f.offsetHeight-f.clientHeight+5;h=a.getBoundingClientRect(); +b=h.left-d;c=h.top-e;d=h.right+d;e=h.bottom+e;h=f.getBoundingClientRect();ch.bottom&&(f.scrollTop+=e-h.bottom);bh.right&&(f.scrollLeft+=d-h.right)};this.destroy=function(c){h.destroy(function(d){d?c(d):(b.removeChild(a),c())})};(function(){var c=m.getOdtDocument().getDOM();a=c.createElementNS(c.documentElement.namespaceURI,"span");b=m.getNode();b.appendChild(a);h=new gui.Avatar(b,n)})()}; // Input 62 runtime.loadClass("core.EventNotifier"); -gui.ClickHandler=function(){function n(){l=0;d=null}var m,l=0,d=null,b=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(d,a){b.subscribe(d,a)};this.handleMouseUp=function(e){var a=runtime.getWindow();d&&d.x===e.screenX&&d.y===e.screenY?(l+=1,1===l?b.emit(gui.ClickHandler.signalSingleClick,e):2===l?b.emit(gui.ClickHandler.signalDoubleClick,void 0):3===l&&(a.clearTimeout(m),b.emit(gui.ClickHandler.signalTripleClick, -void 0),n())):(b.emit(gui.ClickHandler.signalSingleClick,e),l=1,d={x:e.screenX,y:e.screenY},a.clearTimeout(m),m=a.setTimeout(n,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); +gui.ClickHandler=function(){function m(){k=0;c=null}var n,k=0,c=null,a=new core.EventNotifier([gui.ClickHandler.signalSingleClick,gui.ClickHandler.signalDoubleClick,gui.ClickHandler.signalTripleClick]);this.subscribe=function(c,b){a.subscribe(c,b)};this.handleMouseUp=function(h){var b=runtime.getWindow();c&&c.x===h.screenX&&c.y===h.screenY?(k+=1,1===k?a.emit(gui.ClickHandler.signalSingleClick,h):2===k?a.emit(gui.ClickHandler.signalDoubleClick,void 0):3===k&&(b.clearTimeout(n),a.emit(gui.ClickHandler.signalTripleClick, +void 0),m())):(a.emit(gui.ClickHandler.signalSingleClick,h),k=1,c={x:h.screenX,y:h.screenY},b.clearTimeout(n),n=b.setTimeout(m,400))}};gui.ClickHandler.signalSingleClick="click";gui.ClickHandler.signalDoubleClick="doubleClick";gui.ClickHandler.signalTripleClick="tripleClick";(function(){return gui.ClickHandler})(); // Input 63 /* @@ -1669,8 +1670,8 @@ void 0),n())):(b.emit(gui.ClickHandler.signalSingleClick,e),l=1,d={x:e.screenX,y @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.KeyboardHandler=function(){function n(b,d){d||(d=m.None);return b+":"+d}var m=gui.KeyboardHandler.Modifier,l=null,d={};this.setDefault=function(b){l=b};this.bind=function(b,e,a){b=n(b,e);runtime.assert(!1===d.hasOwnProperty(b),"tried to overwrite the callback handler of key combo: "+b);d[b]=a};this.unbind=function(b,e){var a=n(b,e);delete d[a]};this.reset=function(){l=null;d={}};this.handleEvent=function(b){var e=b.keyCode,a=m.None;b.metaKey&&(a|=m.Meta);b.ctrlKey&&(a|=m.Ctrl);b.altKey&&(a|=m.Alt); -b.shiftKey&&(a|=m.Shift);e=n(e,a);e=d[e];a=!1;e?a=e():null!==l&&(a=l(b));a&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,I:73,U:85,Z:90};(function(){return gui.KeyboardHandler})(); +gui.KeyboardHandler=function(){function m(a,c){c||(c=n.None);return a+":"+c}var n=gui.KeyboardHandler.Modifier,k=null,c={};this.setDefault=function(a){k=a};this.bind=function(a,h,b){a=m(a,h);runtime.assert(!1===c.hasOwnProperty(a),"tried to overwrite the callback handler of key combo: "+a);c[a]=b};this.unbind=function(a,h){var b=m(a,h);delete c[b]};this.reset=function(){k=null;c={}};this.handleEvent=function(a){var h=a.keyCode,b=n.None;a.metaKey&&(b|=n.Meta);a.ctrlKey&&(b|=n.Ctrl);a.altKey&&(b|=n.Alt); +a.shiftKey&&(b|=n.Shift);h=m(h,b);h=c[h];b=!1;h?b=h():null!==k&&(b=k(a));b&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}};gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,I:73,U:85,Z:90};(function(){return gui.KeyboardHandler})(); // Input 64 /* @@ -1707,37 +1708,37 @@ b.shiftKey&&(a|=m.Shift);e=n(e,a);e=d[e];a=!1;e?a=e():null!==l&&(a=l(b));a&&(b.p @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("odf.Namespaces");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.OdfNodeFilter");runtime.loadClass("odf.TextSerializer"); -gui.Clipboard=function(){var n,m,l;this.setDataFromRange=function(d,b){var e=!0,a,h=d.clipboardData;a=runtime.getWindow();var f=b.startContainer.ownerDocument;!h&&a&&(h=a.clipboardData);h?(f=f.createElement("span"),f.appendChild(b.cloneContents()),a=h.setData("text/plain",m.writeToString(f)),e=e&&a,a=h.setData("text/html",n.writeToString(f,odf.Namespaces.namespaceMap)),e=e&&a,d.preventDefault()):e=!1;return e};n=new xmldom.LSSerializer;m=new odf.TextSerializer;l=new odf.OdfNodeFilter;n.filter=l;m.filter= -l}; +gui.Clipboard=function(){var m,n,k;this.setDataFromRange=function(c,a){var h=!0,b,f=c.clipboardData;b=runtime.getWindow();var e=a.startContainer.ownerDocument;!f&&b&&(f=b.clipboardData);f?(e=e.createElement("span"),e.appendChild(a.cloneContents()),b=f.setData("text/plain",n.writeToString(e)),h=h&&b,b=f.setData("text/html",m.writeToString(e,odf.Namespaces.namespaceMap)),h=h&&b,c.preventDefault()):h=!1;return h};m=new xmldom.LSSerializer;n=new odf.TextSerializer;k=new odf.OdfNodeFilter;m.filter=k;n.filter= +k}; // Input 65 runtime.loadClass("core.DomUtils");runtime.loadClass("odf.OdfUtils");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("ops.OpRemoveAnnotation");runtime.loadClass("gui.ClickHandler");runtime.loadClass("gui.Clipboard");runtime.loadClass("gui.KeyboardHandler"); runtime.loadClass("gui.StyleHelper"); -gui.SessionController=function(){gui.SessionController=function(n,m){function l(a,b,c,d){var e="on"+b,f=!1;a.attachEvent&&(f=a.attachEvent(e,c));!f&&a.addEventListener&&(a.addEventListener(b,c,!1),f=!0);f&&!d||!a.hasOwnProperty(e)||(a[e]=c)}function d(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 b(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function e(a,b){var c=new ops.OpMoveCursor;c.init({memberid:m, -position:a,length:b||0});return c}function a(a,b){var c=gui.SelectionMover.createPositionIterator(B.getRootNode()),d=B.getOdfCanvas().getElement(),e;e=a;if(!e)return null;for(;e!==d&&!("urn:webodf:names:cursor"===e.namespaceURI&&"cursor"===e.localName||"urn:webodf:names:editinfo"===e.namespaceURI&&"editinfo"===e.localName);)if(e=e.parentNode,!e)return null;e!==d&&a!==e&&(a=e.parentNode,b=Array.prototype.indexOf.call(a.childNodes,e));c.setUnfilteredPosition(a,b);return B.getDistanceFromCursor(m,c.container(), -c.unfilteredDomOffset())}function h(a){var b=B.getOdfCanvas().getElement(),c=B.getRootNode(),d=0;b.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING||(a=gui.SelectionMover.createPositionIterator(c),a.moveToEnd(),c=a.container(),d=a.unfilteredDomOffset());return{node:c,offset:d}}function f(b){ga&&runtime.setTimeout(function(){var c;a:{var d=B.getOdfCanvas().getElement(),f=X.getSelection(),g,k,l,p;if(null===f.anchorNode&&null===f.focusNode){c=b.clientX;g=b.clientY;k=B.getDOM();k.caretRangeFromPoint? -(c=k.caretRangeFromPoint(c,g),g={container:c.startContainer,offset:c.startOffset}):k.caretPositionFromPoint?(c=k.caretPositionFromPoint(c,g),g={container:c.offsetNode,offset:c.offset}):g=null;if(!g){c=null;break a}c=g.container;g=g.offset;k=c;f=g}else c=f.anchorNode,g=f.anchorOffset,k=f.focusNode,f=f.focusOffset;runtime.assert(null!==c&&null!==k,"anchorNode is null or focusNode is null");l=ma.containsNode(d,c);p=ma.containsNode(d,k);l||p?(l||(l=h(c),c=l.node,g=l.offset),p||(l=h(k),k=l.node,f=l.offset), -d.focus(),c={anchorNode:c,anchorOffset:g,focusNode:k,focusOffset:f}):c=null}null!==c&&(d=a(c.anchorNode,c.anchorOffset),g=c.focusNode===c.anchorNode&&c.focusOffset===c.anchorOffset?d:a(c.focusNode,c.focusOffset),null!==g&&0!==g||null!==d&&0!==d)&&(c=B.getCursorPosition(m),d=e(c+d,g-d),n.enqueue(d))},0)}function c(a){f(a)}function t(){var a=B.getOdfCanvas().getElement(),b=/[A-Za-z0-9]/,c=0,d=0,f,g;if(ma.containsNode(a,X.getSelection().focusNode)){a=gui.SelectionMover.createPositionIterator(B.getRootNode()); -f=B.getCursor(m).getNode();for(a.setUnfilteredPosition(f,0);a.previousPosition();)if(g=a.getCurrentNode(),g.nodeType===Node.TEXT_NODE){g=g.data[a.unfilteredDomOffset()];if(!b.test(g))break;c-=1}else if(g.namespaceURI!==odf.Namespaces.textns||"span"!==g.localName)break;a.setUnfilteredPosition(f,0);do if(g=a.getCurrentNode(),g.nodeType===Node.TEXT_NODE){g=g.data[a.unfilteredDomOffset()];if(!b.test(g))break;d+=1}else if(g.namespaceURI!==odf.Namespaces.textns||"span"!==g.localName)break;while(a.nextPosition()); -if(0!==c||0!==d)b=B.getCursorPosition(m),c=e(b+c,Math.abs(c)+Math.abs(d)),n.enqueue(c)}}function k(){var a=B.getOdfCanvas().getElement(),b,c;ma.containsNode(a,X.getSelection().focusNode)&&(c=B.getParagraphElement(B.getCursor(m).getNode()),a=B.getDistanceFromCursor(m,c,0),b=gui.SelectionMover.createPositionIterator(B.getRootNode()),b.moveToEndOfNode(c),c=B.getDistanceFromCursor(m,c,b.unfilteredDomOffset()),0!==a||0!==c)&&(b=B.getCursorPosition(m),a=e(b+a,Math.abs(a)+Math.abs(c)),n.enqueue(a))}function q(a){var b= -B.getCursorSelection(m),c=B.getCursor(m).getStepCounter();0!==a&&(a=0a.length&&(a.position+=a.length,a.length=-a.length); -return a}function W(a){var b=new ops.OpRemoveText;b.init({memberid:m,position:a.position,length:a.length});return b}function U(){var a=Q(B.getCursorSelection(m)),b=null;0===a.length?0a.length&&(a.position+=a.length,a.length=-a.length); +return a}function V(a){var b=new ops.OpRemoveText;b.init({memberid:n,position:a.position,length:a.length});return b}function S(){var a=O(B.getCursorSelection(n)),b=null;0===a.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/ +*/ runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoHandle"); -gui.EditInfoMarker=function(n,m){function l(b,d){return runtime.getWindow().setTimeout(function(){a.style.opacity=b},d)}var d=this,b,e,a,h,f;this.addEdit=function(b,d){var k=Date.now()-d;n.addEdit(b,d);e.setEdits(n.getSortedEdits());a.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",b);if(h){var m=h;runtime.getWindow().clearTimeout(m)}f&&(m=f,runtime.getWindow().clearTimeout(m));1E4>k?(l(1,0),h=l(0.5,1E4-k),f=l(0.2,2E4-k)):1E4<=k&&2E4>k?(l(0.5,0),f=l(0.2,2E4-k)):l(0.2,0)};this.getEdits= -function(){return n.getEdits()};this.clearEdits=function(){n.clearEdits();e.setEdits([]);a.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&a.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return n};this.show=function(){a.style.display="block"};this.hide=function(){d.hideHandle();a.style.display="none"};this.showHandle=function(){e.show()};this.hideHandle=function(){e.hide()};(function(){var c=n.getOdtDocument().getDOM();a=c.createElementNS(c.documentElement.namespaceURI, -"div");a.setAttribute("class","editInfoMarker");a.onmouseover=function(){d.showHandle()};a.onmouseout=function(){d.hideHandle()};b=n.getNode();b.appendChild(a);e=new gui.EditInfoHandle(b);m||d.hide()})()}; +gui.EditInfoMarker=function(m,n){function k(a,c){return runtime.getWindow().setTimeout(function(){b.style.opacity=a},c)}var c=this,a,h,b,f,e;this.addEdit=function(a,c){var l=Date.now()-c;m.addEdit(a,c);h.setEdits(m.getSortedEdits());b.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",a);if(f){var n=f;runtime.getWindow().clearTimeout(n)}e&&(n=e,runtime.getWindow().clearTimeout(n));1E4>l?(k(1,0),f=k(0.5,1E4-l),e=k(0.2,2E4-l)):1E4<=l&&2E4>l?(k(0.5,0),e=k(0.2,2E4-l)):k(0.2,0)};this.getEdits= +function(){return m.getEdits()};this.clearEdits=function(){m.clearEdits();h.setEdits([]);b.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&b.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return m};this.show=function(){b.style.display="block"};this.hide=function(){c.hideHandle();b.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(c){a.removeChild(b);h.destroy(function(a){a? +c(a):m.destroy(c)})};(function(){var d=m.getOdtDocument().getDOM();b=d.createElementNS(d.documentElement.namespaceURI,"div");b.setAttribute("class","editInfoMarker");b.onmouseover=function(){c.showHandle()};b.onmouseout=function(){c.hideHandle()};a=m.getNode();a.appendChild(b);h=new gui.EditInfoHandle(a);n||c.hide()})()}; // Input 72 /* @@ -1926,12 +1961,13 @@ function(){return n.getEdits()};this.clearEdits=function(){n.clearEdits();e.setE @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("gui.Caret");runtime.loadClass("ops.TrivialMemberModel");runtime.loadClass("ops.EditInfo");runtime.loadClass("gui.EditInfoMarker");gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0}; -gui.SessionView=function(){return function(n,m,l){function d(a,b,d){function e(b,d,f){d=b+'[editinfo|memberid^="'+a+'"]'+f+d;a:{var g=c.firstChild;for(b=b+'[editinfo|memberid^="'+a+'"]'+f;g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=d:c.appendChild(document.createTextNode(d))}e("div.editInfoMarker","{ background-color: "+d+"; }","");e("span.editInfoColor","{ background-color: "+d+"; }","");e("span.editInfoAuthor",'{ content: "'+b+'"; }',":before"); -e("dc|creator",'{ content: "'+b+'"; display: none;}',":before");e("dc|creator","{ background-color: "+d+"; }","")}function b(a){var b,c;for(c in t)t.hasOwnProperty(c)&&(b=t[c],a?b.show():b.hide())}function e(a){l.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function a(a,b){var c=l.getCaret(a);void 0===b?runtime.log('MemberModel 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)),d(a,b.fullname,b.color))}function h(b){var c=b.getMemberId(),d=m.getMemberModel();l.registerCursor(b,q,g);a(c,null);d.getMemberDetailsAndUpdates(c,a);runtime.log("+++ View here +++ eagerly created an Caret for '"+c+"'! +++")}function f(b){var c=!1,d;for(d in t)if(t.hasOwnProperty(d)&&t[d].getEditInfo().getEdits().hasOwnProperty(b)){c=!0;break}c||m.getMemberModel().unsubscribeMemberDetailsUpdates(b,a)}var c,t={},k=void 0!==n.editInfoMarkersInitiallyVisible?Boolean(n.editInfoMarkersInitiallyVisible): -!0,q=void 0!==n.caretAvatarsInitiallyVisible?Boolean(n.caretAvatarsInitiallyVisible):!0,g=void 0!==n.caretBlinksOnRangeSelect?Boolean(n.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){k||(k=!0,b(k))};this.hideEditInfoMarkers=function(){k&&(k=!1,b(k))};this.showCaretAvatars=function(){q||(q=!0,e(q))};this.hideCaretAvatars=function(){q&&(q=!1,e(q))};this.getSession=function(){return m};this.getCaret=function(a){return l.getCaret(a)};this.close=function(a){a()};(function(){var a=m.getOdtDocument(), -b=document.getElementsByTagName("head")[0];a.subscribe(ops.OdtDocument.signalCursorAdded,h);a.subscribe(ops.OdtDocument.signalCursorRemoved,f);a.subscribe(ops.OdtDocument.signalParagraphChanged,function(a){var b=a.paragraphElement,c=a.memberId;a=a.timeStamp;var d,e="",f=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0];f?(e=f.getAttributeNS("urn:webodf:names:editinfo","id"),d=t[e]):(e=Math.random().toString(),d=new ops.EditInfo(b,m.getOdtDocument()),d=new gui.EditInfoMarker(d,k), -f=b.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo")[0],f.setAttributeNS("urn:webodf:names:editinfo","id",e),t[e]=d);d.addEdit(c,new Date(a))});c=document.createElementNS(b.namespaceURI,"style");c.type="text/css";c.media="screen, print, handheld, projection";c.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));c.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));b.appendChild(c)})()}}(); +gui.SessionView=function(){return function(m,n,k){function c(a,b,c){function d(b,c,e){c=b+'[editinfo|memberid^="'+a+'"]'+e+c;a:{var g=t.firstChild;for(b=b+'[editinfo|memberid^="'+a+'"]'+e;g;){if(g.nodeType===Node.TEXT_NODE&&0===g.data.indexOf(b)){b=g;break a}g=g.nextSibling}b=null}b?b.data=c:t.appendChild(document.createTextNode(c))}d("div.editInfoMarker","{ background-color: "+c+"; }","");d("span.editInfoColor","{ background-color: "+c+"; }","");d("span.editInfoAuthor",'{ content: "'+b+'"; }',":before"); +d("dc|creator",'{ content: "'+b+'"; display: none;}',":before");d("dc|creator","{ background-color: "+c+"; }","")}function a(a){var b,c;for(c in p)p.hasOwnProperty(c)&&(b=p[c],a?b.show():b.hide())}function h(a){k.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function b(a,b){var d=k.getCaret(a);void 0===b?runtime.log('MemberModel sent undefined data for member "'+a+'".'):(null===b&&(b={memberid:a,fullname:"Unknown Identity",color:"black",imageurl:"avatar-joe.png"}),d&&(d.setAvatarImageUrl(b.imageurl), +d.setColor(b.color)),c(a,b.fullname,b.color))}function f(a){var c=a.getMemberId(),d=n.getMemberModel();k.registerCursor(a,q,s);b(c,null);d.getMemberDetailsAndUpdates(c,b);runtime.log("+++ View here +++ eagerly created an Caret for '"+c+"'! +++")}function e(a){var c=!1,d;for(d in p)if(p.hasOwnProperty(d)&&p[d].getEditInfo().getEdits().hasOwnProperty(a)){c=!0;break}c||n.getMemberModel().unsubscribeMemberDetailsUpdates(a,b)}function d(a){var b=a.paragraphElement,c=a.memberId;a=a.timeStamp;var d,e="", +f=b.getElementsByTagNameNS(l,"editinfo")[0];f?(e=f.getAttributeNS(l,"id"),d=p[e]):(e=Math.random().toString(),d=new ops.EditInfo(b,n.getOdtDocument()),d=new gui.EditInfoMarker(d,g),f=b.getElementsByTagNameNS(l,"editinfo")[0],f.setAttributeNS(l,"id",e),p[e]=d);d.addEdit(c,new Date(a))}var t,l="urn:webodf:names:editinfo",p={},g=void 0!==m.editInfoMarkersInitiallyVisible?Boolean(m.editInfoMarkersInitiallyVisible):!0,q=void 0!==m.caretAvatarsInitiallyVisible?Boolean(m.caretAvatarsInitiallyVisible):!0, +s=void 0!==m.caretBlinksOnRangeSelect?Boolean(m.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){g||(g=!0,a(g))};this.hideEditInfoMarkers=function(){g&&(g=!1,a(g))};this.showCaretAvatars=function(){q||(q=!0,h(q))};this.hideCaretAvatars=function(){q&&(q=!1,h(q))};this.getSession=function(){return n};this.getCaret=function(a){return k.getCaret(a)};this.destroy=function(a){var c=n.getOdtDocument(),g=n.getMemberModel(),h=Object.keys(p).map(function(a){return p[a]});c.subscribe(ops.OdtDocument.signalCursorAdded, +f);c.subscribe(ops.OdtDocument.signalCursorRemoved,e);c.subscribe(ops.OdtDocument.signalParagraphChanged,d);k.getCarets().forEach(function(a){g.unsubscribeMemberDetailsUpdates(a.getCursor().getMemberId(),b)});t.parentNode.removeChild(t);(function v(b,c){c?a(c):bb?-1:b-1})};d.slideChange=function(b){var e=d.getPages(d.odf_canvas.odfContainer().rootElement),a=-1,h=0;e.forEach(function(b){b=b[1];b.hasAttribute("slide_current")&&(a=h,b.removeAttribute("slide_current"));h+=1});b=b(a,e.length);-1===b&&(b=a);e[b][1].setAttribute("slide_current", -"1");document.getElementById("pagelist").selectedIndex=b;"cont"===d.slide_mode&&m.scrollBy(0,e[b][1].getBoundingClientRect().top-30)};d.selectSlide=function(b){d.slideChange(function(d,a){return b>=a||0>b?-1:b})};d.scrollIntoContView=function(b){var e=d.getPages(d.odf_canvas.odfContainer().rootElement);0!==e.length&&m.scrollBy(0,e[b][1].getBoundingClientRect().top-30)};d.getPages=function(b){b=b.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var d=[],a;for(a=0;aa?-1:a-1})};c.slideChange=function(a){var h=c.getPages(c.odf_canvas.odfContainer().rootElement),b=-1,f=0;h.forEach(function(a){a=a[1];a.hasAttribute("slide_current")&&(b=f,a.removeAttribute("slide_current"));f+=1});a=a(b,h.length);-1===a&&(a=b);h[a][1].setAttribute("slide_current", +"1");document.getElementById("pagelist").selectedIndex=a;"cont"===c.slide_mode&&n.scrollBy(0,h[a][1].getBoundingClientRect().top-30)};c.selectSlide=function(a){c.slideChange(function(c,b){return a>=b||0>a?-1:a})};c.scrollIntoContView=function(a){var h=c.getPages(c.odf_canvas.odfContainer().rootElement);0!==h.length&&n.scrollBy(0,h[a][1].getBoundingClientRect().top-30)};c.getPages=function(a){a=a.getElementsByTagNameNS(odf.Namespaces.drawns,"page");var c=[],b;for(b=0;b=a.rangeCount||!p)||(a=a.getRangeAt(0),p.setPoint(a.startContainer,a.startOffset))}function e(){var a=n.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();p&&p.node()&&(b=p.node(),c=b.ownerDocument.createRange(), -c.setStart(b,p.position()),c.collapse(!0),a.addRange(c))}function a(a){var c=a.charCode||a.keyCode;if(p=null,p&&37===c)b(),p.stepBackward(),e();else if(16<=c&&20>=c||33<=c&&40>=c)return;d(a)}function h(a){d(a)}function f(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===Node.ELEMENT_NODE&&f(b),b=b.nextSibling||b.parentNode;var c,d,e,b=a.attributes;c="";for(e=b.length-1;0<=e;e-=1)d=b.item(e),c=c+" "+d.nodeName+'="'+d.nodeValue+'"';a.setAttribute("customns_name",a.nodeName);a.setAttribute("customns_atts", -c);b=a.firstChild;for(d=/^\s*$/;b&&b!==a;)c=b,b=b.nextSibling||b.parentNode,c.nodeType===Node.TEXT_NODE&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function c(a,b){for(var d=a.firstChild,e,f,g;d&&d!==a;){if(d.nodeType===Node.ELEMENT_NODE)for(c(d,b),e=d.attributes,g=e.length-1;0<=g;g-=1)f=e.item(g),"http://www.w3.org/2000/xmlns/"!==f.namespaceURI||b[f.nodeValue]||(b[f.nodeValue]=f.localName);d=d.nextSibling||d.parentNode}}function t(){var a=n.ownerDocument.createElement("style"),b;b={};c(n,b); -var d={},e,f,g=0;for(e in b)if(b.hasOwnProperty(e)&&e){f=b[e];if(!f||d.hasOwnProperty(f)||"xmlns"===f){do f="ns"+g,g+=1;while(d.hasOwnProperty(f));b[e]=f}d[f]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+k;a.appendChild(n.ownerDocument.createTextNode(b));m=m.parentNode.replaceChild(a,m)}var k,q,g,p=null;n.id||(n.id="xml"+String(Math.random()).substring(2));q="#"+n.id+" ";k=q+"*,"+q+":visited, "+q+":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"+ -q+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+q+":after {color: blue; content: '';}\n"+q+"{overflow: auto;}\n";(function(b){l(b,"click",h);l(b,"keydown",a);l(b,"drop",d);l(b,"dragend",d);l(b,"beforepaste",d);l(b,"paste",d)})(n);this.updateCSS=t;this.setXML=function(a){a=a.documentElement||a;g=a=n.ownerDocument.importNode(a,!0);for(f(a);n.lastChild;)n.removeChild(n.lastChild);n.appendChild(a);t();p=new core.PositionIterator(a)};this.getXML= +gui.XMLEdit=function(m,n){function k(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function c(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function a(){var a=m.ownerDocument.defaultView.getSelection();!a||(0>=a.rangeCount||!q)||(a=a.getRangeAt(0),q.setPoint(a.startContainer,a.startOffset))}function h(){var a=m.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();q&&q.node()&&(b=q.node(),c=b.ownerDocument.createRange(), +c.setStart(b,q.position()),c.collapse(!0),a.addRange(c))}function b(b){var d=b.charCode||b.keyCode;if(q=null,q&&37===d)a(),q.stepBackward(),h();else if(16<=d&&20>=d||33<=d&&40>=d)return;c(b)}function f(a){c(a)}function e(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===Node.ELEMENT_NODE&&e(b),b=b.nextSibling||b.parentNode;var c,d,g,b=a.attributes;c="";for(g=b.length-1;0<=g;g-=1)d=b.item(g),c=c+" "+d.nodeName+'="'+d.nodeValue+'"';a.setAttribute("customns_name",a.nodeName);a.setAttribute("customns_atts", +c);b=a.firstChild;for(d=/^\s*$/;b&&b!==a;)c=b,b=b.nextSibling||b.parentNode,c.nodeType===Node.TEXT_NODE&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function d(a,b){for(var c=a.firstChild,e,g,f;c&&c!==a;){if(c.nodeType===Node.ELEMENT_NODE)for(d(c,b),e=c.attributes,f=e.length-1;0<=f;f-=1)g=e.item(f),"http://www.w3.org/2000/xmlns/"!==g.namespaceURI||b[g.nodeValue]||(b[g.nodeValue]=g.localName);c=c.nextSibling||c.parentNode}}function t(){var a=m.ownerDocument.createElement("style"),b;b={};d(m,b); +var c={},e,g,f=0;for(e in b)if(b.hasOwnProperty(e)&&e){g=b[e];if(!g||c.hasOwnProperty(g)||"xmlns"===g){do g="ns"+f,f+=1;while(c.hasOwnProperty(g));b[e]=g}c[g]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+l;a.appendChild(m.ownerDocument.createTextNode(b));n=n.parentNode.replaceChild(a,n)}var l,p,g,q=null;m.id||(m.id="xml"+String(Math.random()).substring(2));p="#"+m.id+" ";l=p+"*,"+p+":visited, "+p+":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"+ +p+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+p+":after {color: blue; content: '';}\n"+p+"{overflow: auto;}\n";(function(a){k(a,"click",f);k(a,"keydown",b);k(a,"drop",c);k(a,"dragend",c);k(a,"beforepaste",c);k(a,"paste",c)})(m);this.updateCSS=t;this.setXML=function(a){a=a.documentElement||a;g=a=m.ownerDocument.importNode(a,!0);for(e(a);m.lastChild;)m.removeChild(m.lastChild);m.appendChild(a);t();q=new core.PositionIterator(a)};this.getXML= function(){return g}}; // Input 76 /* @@ -2023,8 +2059,8 @@ function(){return g}}; @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(n,m){};gui.UndoManager.prototype.unsubscribe=function(n,m){};gui.UndoManager.prototype.setOdtDocument=function(n){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(n){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; -gui.UndoManager.prototype.moveForward=function(n){};gui.UndoManager.prototype.moveBackward=function(n){};gui.UndoManager.prototype.onOperationExecuted=function(n){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";(function(){return gui.UndoManager})(); +gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(m,n){};gui.UndoManager.prototype.unsubscribe=function(m,n){};gui.UndoManager.prototype.setOdtDocument=function(m){};gui.UndoManager.prototype.saveInitialState=function(){};gui.UndoManager.prototype.resetInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(m){};gui.UndoManager.prototype.hasUndoStates=function(){};gui.UndoManager.prototype.hasRedoStates=function(){}; +gui.UndoManager.prototype.moveForward=function(m){};gui.UndoManager.prototype.moveBackward=function(m){};gui.UndoManager.prototype.onOperationExecuted=function(m){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";(function(){return gui.UndoManager})(); // Input 77 /* @@ -2060,8 +2096,8 @@ gui.UndoManager.prototype.moveForward=function(n){};gui.UndoManager.prototype.mo @source: http://www.webodf.org/ @source: http://gitorious.org/webodf/webodf/ */ -gui.UndoStateRules=function(){function n(l){return l.spec().optype}function m(l){switch(n(l)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=n;this.isEditOperation=m;this.isPartOfOperationSet=function(l,d){if(m(l)){if(0===d.length)return!0;var b;if(b=m(d[d.length-1]))a:{b=d.filter(m);var e=n(l),a;b:switch(e){case "RemoveText":case "InsertText":a=!0;break b;default:a=!1}if(a&&e===n(b[0])){if(1===b.length){b=!0;break a}e=b[b.length-2].spec().position; -b=b[b.length-1].spec().position;a=l.spec().position;if(b===a-(b-e)){b=!0;break a}}b=!1}return b}return!0}}; +gui.UndoStateRules=function(){function m(k){return k.spec().optype}function n(k){switch(m(k)){case "MoveCursor":case "AddCursor":case "RemoveCursor":return!1;default:return!0}}this.getOpType=m;this.isEditOperation=n;this.isPartOfOperationSet=function(k,c){if(n(k)){if(0===c.length)return!0;var a;if(a=n(c[c.length-1]))a:{a=c.filter(n);var h=m(k),b;b:switch(h){case "RemoveText":case "InsertText":b=!0;break b;default:b=!1}if(b&&h===m(a[0])){if(1===a.length){a=!0;break a}h=a[a.length-2].spec().position; +a=a[a.length-1].spec().position;b=k.spec().position;if(a===b-(a-h)){a=!0;break a}}a=!1}return a}return!0}}; // Input 78 /* @@ -2098,12 +2134,12 @@ b=b[b.length-1].spec().position;a=l.spec().position;if(b===a-(b-e)){b=!0;break a @source: http://gitorious.org/webodf/webodf/ */ runtime.loadClass("core.DomUtils");runtime.loadClass("gui.UndoManager");runtime.loadClass("gui.UndoStateRules"); -gui.TrivialUndoManager=function(n){function m(){r.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:a.hasUndoStates(),redoAvailable:a.hasRedoStates()})}function l(){q!==c&&q!==g[g.length-1]&&g.push(q)}function d(a){var b=a.previousSibling||a.nextSibling;a.parentNode.removeChild(a);h.normalizeTextNodes(b)}function b(a){return Object.keys(a).map(function(b){return a[b]})}function e(a){function c(a){var b=a.spec();if(f[b.memberid])switch(b.optype){case "AddCursor":d[b.memberid]||(d[b.memberid]= -a,delete f[b.memberid],g-=1);break;case "MoveCursor":e[b.memberid]||(e[b.memberid]=a)}}var d={},e={},f={},g,h=a.pop();k.getCursors().forEach(function(a){f[a.getMemberId()]=!0});for(g=Object.keys(f).length;h&&0=e;e+=1){b=a.container();c=a.unfilteredDomOffset();if(b.nodeType===Node.TEXT_NODE&&" "===b.data[c]&&h.isSignificantWhitespace(b, -c)){runtime.assert(" "===b.data[c],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var f=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s");f.appendChild(b.ownerDocument.createTextNode(" "));b.deleteData(c,1);0= 0");1===q.acceptPosition(d)?(h=d.container(),h.nodeType===Node.TEXT_NODE&&(e=h,k=0)):b+=1;for(;0=e;e+=1){b=a.container();d=a.unfilteredDomOffset();if(b.nodeType===Node.TEXT_NODE&&" "===b.data[d]&&f.isSignificantWhitespace(b, +d)){runtime.assert(" "===b.data[d],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var h=b.ownerDocument.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s");h.appendChild(b.ownerDocument.createTextNode(" "));b.deleteData(d,1);0= 0");1===p.acceptPosition(d)?(h=d.container(),h.nodeType===Node.TEXT_NODE&&(f=h,l=0)):a+=1;for(;0 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 z-index: 1;\n}\ncursor|cursor > span {\n display: inline;\n position: absolute;\n top: 5%; /* push down the caret; 0px can do the job, 5% looks better, 10% is a bit over */\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\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationRemoveButton:before {\n content: '\u00d7';\n color: white;\n padding: 5px;\n line-height: 1em;\n}\n\n.annotationRemoveButton {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: black;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n position: absolute;\n top: -10px;\n left: -10px;\n z-index: 3;\n text-align: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n font-size: 15px;\n}\n.annotationRemoveButton:hover {\n cursor: pointer;\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n}\n.annotationNote > office|annotation {\n display: block;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n z-index: 2;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\ndc|*::selection {\n background: transparent;\n}\ndc|*::-moz-selection {\n background: transparent;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: none;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n";