/*

 This is a generated file. DO NOT EDIT.

 Copyright (C) 2010-2014 KO GmbH <copyright@kogmbh.com>

 @licstart
 The code in this file is free software: you can redistribute it and/or modify it
 under the terms of the GNU Affero General Public License (GNU AGPL)
 as published by the Free Software Foundation, either version 3 of
 the License, or (at your option) any later version.

 The code in this file is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public License
 along with WebODF.  If not, see <http://www.gnu.org/licenses/>.

 As additional permission under GNU AGPL version 3 section 7, you
 may distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU AGPL normally
 required by section 4, provided you include this license notice and a URL
 through which recipients can access the Corresponding Source.

 As a special exception to the AGPL, any HTML file which merely makes function
 calls to this code, and for that purpose includes it in unmodified form by reference or in-line shall be
 deemed a separate work for copyright law purposes. In addition, the copyright
 holders of this code give you permission to combine this code with free
 software libraries that are released under the GNU LGPL. You may copy and
 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: https://github.com/kogmbh/WebODF/
*/
var webodf_version="0.5.1";function Runtime(){}Runtime.prototype.getVariable=function(f){};Runtime.prototype.toJson=function(f){};Runtime.prototype.fromJson=function(f){};Runtime.prototype.byteArrayFromString=function(f,k){};Runtime.prototype.byteArrayToString=function(f,k){};Runtime.prototype.read=function(f,k,c,b){};Runtime.prototype.readFile=function(f,k,c){};Runtime.prototype.readFileSync=function(f,k){};Runtime.prototype.loadXML=function(f,k){};Runtime.prototype.writeFile=function(f,k,c){};
Runtime.prototype.isFile=function(f,k){};Runtime.prototype.getFileSize=function(f,k){};Runtime.prototype.deleteFile=function(f,k){};Runtime.prototype.log=function(f,k){};Runtime.prototype.setTimeout=function(f,k){};Runtime.prototype.clearTimeout=function(f){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(f){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};
Runtime.prototype.parseXML=function(f){};Runtime.prototype.exit=function(f){};Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(f){};Runtime.prototype.cancelAnimationFrame=function(f){};Runtime.prototype.assert=function(f,k,c){};var IS_COMPILED_CODE=!0;
Runtime.byteArrayToString=function(f,k){function c(b){var c="",n,e=b.length;for(n=0;n<e;n+=1)c+=String.fromCharCode(b[n]&255);return c}function b(b){var c="",n,e=b.length,l=[],r,d,a,m;for(n=0;n<e;n+=1)r=b[n],128>r?l.push(r):(n+=1,d=b[n],194<=r&&224>r?l.push((r&31)<<6|d&63):(n+=1,a=b[n],224<=r&&240>r?l.push((r&15)<<12|(d&63)<<6|a&63):(n+=1,m=b[n],240<=r&&245>r&&(r=(r&7)<<18|(d&63)<<12|(a&63)<<6|m&63,r-=65536,l.push((r>>10)+55296,(r&1023)+56320))))),1E3<=l.length&&(c+=String.fromCharCode.apply(null,
l),l.length=0);return c+String.fromCharCode.apply(null,l)}var e;"utf8"===k?e=b(f):("binary"!==k&&this.log("Unsupported encoding: "+k),e=c(f));return e};Runtime.getVariable=function(f){try{return eval(f)}catch(k){}};Runtime.toJson=function(f){return JSON.stringify(f)};Runtime.fromJson=function(f){return JSON.parse(f)};Runtime.getFunctionName=function(f){return void 0===f.name?(f=/function\s+(\w+)/.exec(f))&&f[1]:f.name};
function BrowserRuntime(f){function k(b){var d=b.length,a,m,g=0;for(a=0;a<d;a+=1)m=b.charCodeAt(a),g+=1+(128<m)+(2048<m),55040<m&&57344>m&&(g+=1,a+=1);return g}function c(b,d,a){var m=b.length,g,c;d=new Uint8Array(new ArrayBuffer(d));a?(d[0]=239,d[1]=187,d[2]=191,c=3):c=0;for(a=0;a<m;a+=1)g=b.charCodeAt(a),128>g?(d[c]=g,c+=1):2048>g?(d[c]=192|g>>>6,d[c+1]=128|g&63,c+=2):55040>=g||57344<=g?(d[c]=224|g>>>12&15,d[c+1]=128|g>>>6&63,d[c+2]=128|g&63,c+=3):(a+=1,g=(g-55296<<10|b.charCodeAt(a)-56320)+65536,
d[c]=240|g>>>18&7,d[c+1]=128|g>>>12&63,d[c+2]=128|g>>>6&63,d[c+3]=128|g&63,c+=4);return d}function b(b){var d=b.length,a=new Uint8Array(new ArrayBuffer(d)),m;for(m=0;m<d;m+=1)a[m]=b.charCodeAt(m)&255;return a}function e(b,d){var a,m,g;void 0!==d?g=b:d=b;f?(m=f.ownerDocument,g&&(a=m.createElement("span"),a.className=g,a.appendChild(m.createTextNode(g)),f.appendChild(a),f.appendChild(m.createTextNode(" "))),a=m.createElement("span"),0<d.length&&"<"===d[0]?a.innerHTML=d:a.appendChild(m.createTextNode(d)),
f.appendChild(a),f.appendChild(m.createElement("br"))):console&&console.log(d);"alert"===g&&alert(d)}function p(r,d,a){if(0!==a.status||a.responseText)if(200===a.status||0===a.status){if(a.response&&"string"!==typeof a.response)"binary"===d?(a=a.response,a=new Uint8Array(a)):a=String(a.response);else if("binary"===d)if(null!==a.responseBody&&"undefined"!==String(typeof VBArray)){a=(new VBArray(a.responseBody)).toArray();var m=a.length,g=new Uint8Array(new ArrayBuffer(m));for(d=0;d<m;d+=1)g[d]=a[d];
a=g}else{(d=a.getResponseHeader("Content-Length"))&&(d=parseInt(d,10));if(d&&d!==a.responseText.length)a:{var m=a.responseText,g=!1,x=k(m);if("number"===typeof d){if(d!==x&&d!==x+3){m=void 0;break a}g=x+3===d;x=d}m=c(m,x,g)}void 0===m&&(m=b(a.responseText));a=m}else a=a.responseText;l[r]=a;r={err:null,data:a}}else r={err:a.responseText||a.statusText,data:null};else r={err:"File "+r+" is empty.",data:null};return r}function h(b,d,a){var m=new XMLHttpRequest;m.open("GET",b,a);m.overrideMimeType&&("binary"!==
d?m.overrideMimeType("text/plain; charset="+d):m.overrideMimeType("text/plain; charset=x-user-defined"));return m}function n(b,d,a){function m(){var m;4===g.readyState&&(m=p(b,d,g),a(m.err,m.data))}if(l.hasOwnProperty(b))a(null,l[b]);else{var g=h(b,d,!0);g.onreadystatechange=m;try{g.send(null)}catch(c){a(c.message,null)}}}var s=this,l={};this.byteArrayFromString=function(r,d){var a;"utf8"===d?a=c(r,k(r),!1):("binary"!==d&&s.log("unknown encoding: "+d),a=b(r));return a};this.byteArrayToString=Runtime.byteArrayToString;
this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=n;this.read=function(b,d,a,m){n(b,"binary",function(g,b){var c=null;if(b){if("string"===typeof b)throw"This should not happen.";c=b.subarray(d,d+a)}m(g,c)})};this.readFileSync=function(b,d){var a=h(b,d,!1),m;try{a.send(null);m=p(b,d,a);if(m.err)throw m.err;if(null===m.data)throw"No data read from "+b+".";}catch(g){throw g;}return m.data};this.writeFile=function(b,d,a){l[b]=d;var m=new XMLHttpRequest,
g;m.open("PUT",b,!0);m.onreadystatechange=function(){4===m.readyState&&(0!==m.status||m.responseText?200<=m.status&&300>m.status||0===m.status?a(null):a("Status "+String(m.status)+": "+m.responseText||m.statusText):a("File "+b+" is empty."))};g=d.buffer&&!m.sendAsBinary?d.buffer:s.byteArrayToString(d,"binary");try{m.sendAsBinary?m.sendAsBinary(g):m.send(g)}catch(c){s.log("HUH? "+c+" "+d),a(c.message)}};this.deleteFile=function(b,d){delete l[b];var a=new XMLHttpRequest;a.open("DELETE",b,!0);a.onreadystatechange=
function(){4===a.readyState&&(200>a.status&&300<=a.status?d(a.responseText):d(null))};a.send(null)};this.loadXML=function(b,d){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?d(null,a.responseXML):d(a.responseText,null):d("File "+b+" is empty.",null))};try{a.send(null)}catch(m){d(m.message,null)}};this.isFile=function(b,d){s.getFileSize(b,function(a){d(-1!==
a)})};this.getFileSize=function(b,d){if(l.hasOwnProperty(b)&&"string"!==typeof l[b])d(l[b].length);else{var a=new XMLHttpRequest;a.open("HEAD",b,!0);a.onreadystatechange=function(){if(4===a.readyState){var m=a.getResponseHeader("Content-Length");m?d(parseInt(m,10)):n(b,"binary",function(a,m){a?d(-1):d(m.length)})}};a.send(null)}};this.log=e;this.assert=function(b,d,a){if(!b)throw e("alert","ASSERTION FAILED:\n"+d),a&&a(),d;};this.setTimeout=function(b,d){return setTimeout(function(){b()},d)};this.clearTimeout=
function(b){clearTimeout(b)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.currentDirectory=function(){return""};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.parseXML=function(b){return(new DOMParser).parseFromString(b,"text/xml")};this.exit=function(b){e("Calling exit with code "+String(b)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.requestAnimationFrame=
function(b){var d=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,a=0;if(d)d.bind(window),a=d(b);else return setTimeout(b,15);return a};this.cancelAnimationFrame=function(b){var d=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;d?(d.bind(window),d(b)):clearTimeout(b)}}
function NodeJSRuntime(){function f(b){var c=b.length,n,d=new Uint8Array(new ArrayBuffer(c));for(n=0;n<c;n+=1)d[n]=b[n];return d}function k(c,n,h){function d(a,m){if(a)return h(a,null);if(!m)return h("No data for "+c+".",null);if("string"===typeof m)return h(a,m);h(a,f(m))}c=e.resolve(p,c);"binary"!==n?b.readFile(c,n,d):b.readFile(c,null,d)}var c=this,b=require("fs"),e=require("path"),p="",h,n;this.byteArrayFromString=function(b,c){var n=new Buffer(b,c),d,a=n.length,m=new Uint8Array(new ArrayBuffer(a));
for(d=0;d<a;d+=1)m[d]=n[d];return m};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=k;this.loadXML=function(b,n){k(b,"utf-8",function(e,d){if(e)return n(e,null);if(!d)return n("No data for "+b+".",null);n(null,c.parseXML(d))})};this.writeFile=function(c,n,h){n=new Buffer(n);c=e.resolve(p,c);b.writeFile(c,n,"binary",function(d){h(d||null)})};this.deleteFile=function(c,n){c=e.resolve(p,c);
b.unlink(c,n)};this.read=function(c,n,h,d){c=e.resolve(p,c);b.open(c,"r+",666,function(a,m){if(a)d(a,null);else{var g=new Buffer(h);b.read(m,g,0,h,n,function(a){b.close(m);d(a,f(g))})}})};this.readFileSync=function(c,n){var e;e=b.readFileSync(c,"binary"===n?null:n);if(null===e)throw"File "+c+" could not be read.";"binary"===n&&(e=f(e));return e};this.isFile=function(c,n){c=e.resolve(p,c);b.stat(c,function(b,d){n(!b&&d.isFile())})};this.getFileSize=function(c,n){c=e.resolve(p,c);b.stat(c,function(b,
d){b?n(-1):n(d.size)})};this.log=function(b,c){var n;void 0!==c?n=b:c=b;"alert"===n&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(c+"\n");"alert"===n&&process.stderr.write("!!!!! ALERT !!!!!\n")};this.assert=function(b,c,n){b||(process.stderr.write("ASSERTION FAILED: "+c),n&&n())};this.setTimeout=function(b,c){return setTimeout(function(){b()},c)};this.clearTimeout=function(b){clearTimeout(b)};this.libraryPaths=function(){return[__dirname]};this.setCurrentDirectory=function(b){p=
b};this.currentDirectory=function(){return p};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return n};this.parseXML=function(b){return h.parseFromString(b,"text/xml")};this.exit=process.exit;this.getWindow=function(){return null};this.requestAnimationFrame=function(b){return setTimeout(b,15)};this.cancelAnimationFrame=function(b){clearTimeout(b)};h=new (require("xmldom").DOMParser);n=c.parseXML("<a/>").implementation}
function RhinoRuntime(){function f(b,c){var e;void 0!==c?e=b:c=b;"alert"===e&&print("\n!!!!! ALERT !!!!!");print(c);"alert"===e&&print("!!!!! ALERT !!!!!")}var k=this,c={},b=c.javax.xml.parsers.DocumentBuilderFactory.newInstance(),e,p,h="";b.setValidating(!1);b.setNamespaceAware(!0);b.setExpandEntityReferences(!1);b.setSchema(null);p=c.org.xml.sax.EntityResolver({resolveEntity:function(b,e){var h=new c.java.io.FileReader(e);return new c.org.xml.sax.InputSource(h)}});e=b.newDocumentBuilder();e.setEntityResolver(p);
this.byteArrayFromString=function(b,c){var e,h=b.length,d=new Uint8Array(new ArrayBuffer(h));for(e=0;e<h;e+=1)d[e]=b.charCodeAt(e)&255;return d};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.loadXML=function(b,h){var p=new c.java.io.File(b),f=null;try{f=e.parse(p)}catch(d){return print(d),h(d,null)}h(null,f)};this.readFile=function(b,e,p){h&&(b=h+"/"+b);var f=new c.java.io.File(b),d="binary"===e?
"latin1":e;f.isFile()?((b=readFile(b,d))&&"binary"===e&&(b=k.byteArrayFromString(b,"binary")),p(null,b)):p(b+" is not a file.",null)};this.writeFile=function(b,e,p){h&&(b=h+"/"+b);b=new c.java.io.FileOutputStream(b);var f,d=e.length;for(f=0;f<d;f+=1)b.write(e[f]);b.close();p(null)};this.deleteFile=function(b,e){h&&(b=h+"/"+b);var p=new c.java.io.File(b),f=b+Math.random(),f=new c.java.io.File(f);p.rename(f)?(f.deleteOnExit(),e(null)):e("Could not delete "+b)};this.read=function(b,e,p,f){h&&(b=h+"/"+
b);var d;d=b;var a="binary";(new c.java.io.File(d)).isFile()?("binary"===a&&(a="latin1"),d=readFile(d,a)):d=null;d?f(null,this.byteArrayFromString(d.substring(e,e+p),"binary")):f("Cannot read "+b,null)};this.readFileSync=function(b,c){if(!c)return"";var e=readFile(b,c);if(null===e)throw"File could not be read.";return e};this.isFile=function(b,e){h&&(b=h+"/"+b);var p=new c.java.io.File(b);e(p.isFile())};this.getFileSize=function(b,e){h&&(b=h+"/"+b);var p=new c.java.io.File(b);e(p.length())};this.log=
f;this.assert=function(b,c,e){b||(f("alert","ASSERTION FAILED: "+c),e&&e())};this.setTimeout=function(b){b();return 0};this.clearTimeout=function(){};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(b){h=b};this.currentDirectory=function(){return h};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return e.getDOMImplementation()};this.parseXML=function(b){b=new c.java.io.StringReader(b);b=new c.org.xml.sax.InputSource(b);return e.parse(b)};
this.exit=quit;this.getWindow=function(){return null};this.requestAnimationFrame=function(b){b();return 0};this.cancelAnimationFrame=function(){}}Runtime.create=function(){return"undefined"!==String(typeof window)?new BrowserRuntime(window.document.getElementById("logoutput")):"undefined"!==String(typeof require)?new NodeJSRuntime:new RhinoRuntime};var runtime=Runtime.create(),core={},gui={},xmldom={},odf={},ops={},webodf={};
(function(){webodf.Version="undefined"!==String(typeof webodf_version)?webodf_version:"From Source"})();
(function(){function f(b,c,e){var h=b+"/manifest.json",d,a;runtime.log("Loading manifest: "+h);try{d=runtime.readFileSync(h,"utf-8")}catch(m){if(e)runtime.log("No loadable manifest found.");else throw console.log(String(m)),m;return}e=JSON.parse(d);for(a in e)e.hasOwnProperty(a)&&(c[a]={dir:b,deps:e[a]})}function k(b,c,e){function h(g){if(!m[g]&&!e(g)){if(a[g])throw"Circular dependency detected for "+g+".";a[g]=!0;if(!c[g])throw"Missing dependency information for class "+g+".";var b=c[g],n=b.deps,
p,f=n.length;for(p=0;p<f;p+=1)h(n[p]);a[g]=!1;m[g]=!0;d.push(b.dir+"/"+g.replace(".","/")+".js")}}var d=[],a={},m={};b.forEach(h);return d}function c(b,c){return c=c+("\n//# sourceURL="+b)+("\n//@ sourceURL="+b)}function b(b){var e,h;for(e=0;e<b.length;e+=1)h=runtime.readFileSync(b[e],"utf-8"),h=c(b[e],h),eval(h)}function e(b){b=b.split(".");var c,e=h,p=b.length;for(c=0;c<p;c+=1){if(!e.hasOwnProperty(b[c]))return!1;e=e[b[c]]}return!0}var p,h={core:core,gui:gui,xmldom:xmldom,odf:odf,ops:ops};runtime.loadClasses=
function(c,h){if(IS_COMPILED_CODE||0===c.length)return h&&h();var l;if(!(l=p)){l=[];var r=runtime.libraryPaths(),d;runtime.currentDirectory()&&-1===r.indexOf(runtime.currentDirectory())&&f(runtime.currentDirectory(),l,!0);for(d=0;d<r.length;d+=1)f(r[d],l)}p=l;c=k(c,p,e);if(0===c.length)return h&&h();if("BrowserRuntime"===runtime.type()&&h){l=c;r=document.currentScript||document.documentElement.lastChild;d=document.createDocumentFragment();var a,m;for(m=0;m<l.length;m+=1)a=document.createElement("script"),
a.type="text/javascript",a.charset="utf-8",a.async=!1,a.setAttribute("src",l[m]),d.appendChild(a);h&&(a.onload=h);r.parentNode.insertBefore(d,r)}else b(c),h&&h()};runtime.loadClass=function(b,c){runtime.loadClasses([b],c)}})();(function(){var f=function(f){return f};runtime.getTranslator=function(){return f};runtime.setTranslator=function(k){f=k};runtime.tr=function(k){var c=f(k);return c&&"string"===String(typeof c)?c:k}})();
(function(f){function k(c){if(c.length){var b=c[0];runtime.readFile(b,"utf8",function(e,p){function h(){var b;(b=eval(k))&&runtime.exit(b)}var f="",f=b.lastIndexOf("/"),k=p,f=-1!==f?b.substring(0,f):".";runtime.setCurrentDirectory(f);e?(runtime.log(e),runtime.exit(1)):null===k?(runtime.log("No code found for "+b),runtime.exit(1)):h.apply(null,c)})}}f=f?Array.prototype.slice.call(f):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(f):k(f.slice(1))})("undefined"!==
String(typeof arguments)&&arguments);(function(){core.Async=function(){return{forEach:function(f,k,c){function b(b){h!==p&&(b?(h=p,c(b)):(h+=1,h===p&&c(null)))}var e,p=f.length,h=0;for(e=0;e<p;e+=1)k(f[e],b)},destroyAll:function(f,k){function c(b,e){if(e)k(e);else if(b<f.length)f[b](function(e){c(b+1,e)});else k()}c(0,void 0)}}}()})();function makeBase64(){function f(a){var g,m=a.length,d=new Uint8Array(new ArrayBuffer(m));for(g=0;g<m;g+=1)d[g]=a.charCodeAt(g)&255;return d}function k(a){var g,m="",d,b=a.length-2;for(d=0;d<b;d+=3)g=a[d]<<16|a[d+1]<<8|a[d+2],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>18],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&
63];d===b+1?(g=a[d]<<4,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=="):d===b&&(g=a[d]<<10|a[d+1]<<2,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>12],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[g&63],m+="=");return m}function c(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,
"");var m=a.length,d=new Uint8Array(new ArrayBuffer(3*m)),b=a.length%4,c=0,e,q;for(e=0;e<m;e+=4)q=(g[a.charAt(e)]||0)<<18|(g[a.charAt(e+1)]||0)<<12|(g[a.charAt(e+2)]||0)<<6|(g[a.charAt(e+3)]||0),d[c]=q>>16,d[c+1]=q>>8&255,d[c+2]=q&255,c+=3;m=3*m-[0,0,2,1][b];return d.subarray(0,m)}function b(a){var m,g,d=a.length,b=0,c=new Uint8Array(new ArrayBuffer(3*d));for(m=0;m<d;m+=1)g=a[m],128>g?c[b++]=g:(2048>g?c[b++]=192|g>>>6:(c[b++]=224|g>>>12&15,c[b++]=128|g>>>6&63),c[b++]=128|g&63);return c.subarray(0,
b)}function e(a){var g,m,d,b,c=a.length,q=new Uint8Array(new ArrayBuffer(c)),e=0;for(g=0;g<c;g+=1)m=a[g],128>m?q[e++]=m:(g+=1,d=a[g],224>m?q[e++]=(m&31)<<6|d&63:(g+=1,b=a[g],q[e++]=(m&15)<<12|(d&63)<<6|b&63));return q.subarray(0,e)}function p(a){return k(f(a))}function h(a){return String.fromCharCode.apply(String,c(a))}function n(a){return e(f(a))}function s(a){a=e(a);for(var g="",m=0;m<a.length;)g+=String.fromCharCode.apply(String,a.subarray(m,m+45E3)),m+=45E3;return g}function l(a,g,m){var d,b,
c,q="";for(c=g;c<m;c+=1)g=a.charCodeAt(c)&255,128>g?q+=String.fromCharCode(g):(c+=1,d=a.charCodeAt(c)&255,224>g?q+=String.fromCharCode((g&31)<<6|d&63):(c+=1,b=a.charCodeAt(c)&255,q+=String.fromCharCode((g&15)<<12|(d&63)<<6|b&63)));return q}function r(a,g){function m(){var c=b+1E5;c>a.length&&(c=a.length);d+=l(a,b,c);b=c;c=b===a.length;g(d,c)&&!c&&runtime.setTimeout(m,0)}var d="",b=0;1E5>a.length?g(l(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),m())}function d(a){return b(f(a))}function a(a){return String.fromCharCode.apply(String,
b(a))}function m(a){return String.fromCharCode.apply(String,b(f(a)))}var g=function(a){var g={},m,d;m=0;for(d=a.length;m<d;m+=1)g[a.charAt(m)]=m;return g}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),x,v,z=runtime.getWindow(),y,t;z&&z.btoa?(y=z.btoa,x=function(a){return y(m(a))}):(y=p,x=function(a){return k(d(a))});z&&z.atob?(t=z.atob,v=function(a){a=t(a);return l(a,0,a.length)}):(t=h,v=function(a){return s(c(a))});core.Base64=function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=
k;this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=c;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=b;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=e;this.convertUTF8StringToBase64=p;this.convertBase64ToUTF8String=h;this.convertUTF8StringToUTF16Array=n;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=s;this.convertUTF8StringToUTF16String=r;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=d;this.convertUTF16ArrayToUTF8String=
a;this.convertUTF16StringToUTF8String=m;this.convertUTF16StringToBase64=x;this.convertBase64ToUTF16String=v;this.fromBase64=h;this.toBase64=p;this.atob=t;this.btoa=y;this.utob=m;this.btou=r;this.encode=x;this.encodeURI=function(a){return x(a).replace(/[+\/]/g,function(a){return"+"===a?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return v(a.replace(/[\-_]/g,function(a){return"-"===a?"+":"/"}))};return this};return core.Base64}core.Base64=makeBase64();core.ByteArray=function(f){this.pos=0;this.data=f;this.readUInt32LE=function(){this.pos+=4;var f=this.data,c=this.pos;return f[--c]<<24|f[--c]<<16|f[--c]<<8|f[--c]};this.readUInt16LE=function(){this.pos+=2;var f=this.data,c=this.pos;return f[--c]<<8|f[--c]}};core.ByteArrayWriter=function(f){function k(c){c>e-b&&(e=Math.max(2*e,b+c),c=new Uint8Array(new ArrayBuffer(e)),c.set(p),p=c)}var c=this,b=0,e=1024,p=new Uint8Array(new ArrayBuffer(e));this.appendByteArrayWriter=function(b){c.appendByteArray(b.getByteArray())};this.appendByteArray=function(c){var e=c.length;k(e);p.set(c,b);b+=e};this.appendArray=function(c){var e=c.length;k(e);p.set(c,b);b+=e};this.appendUInt16LE=function(b){c.appendArray([b&255,b>>8&255])};this.appendUInt32LE=function(b){c.appendArray([b&
255,b>>8&255,b>>16&255,b>>24&255])};this.appendString=function(b){c.appendByteArray(runtime.byteArrayFromString(b,f))};this.getLength=function(){return b};this.getByteArray=function(){var c=new Uint8Array(new ArrayBuffer(b));c.set(p.subarray(0,b));return c}};core.CSSUnits=function(){var f=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(c,b,e){return c*k[e]/k[b]};this.convertMeasure=function(c,b){var e,p;c&&b&&(e=parseFloat(c),p=c.replace(e.toString(),""),e=f.convert(e,p,b));return e};this.getUnits=function(c){return c.substr(c.length-2,c.length)}};(function(){function f(){var b,e,p,h,f,k,l,r,d;void 0===c&&(e=(b=runtime.getWindow())&&b.document,k=e.documentElement,l=e.body,c={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},e&&(h=e.createElement("div"),h.style.position="absolute",h.style.left="-99999px",h.style.transform="scale(2)",h.style["-webkit-transform"]="scale(2)",f=e.createElement("div"),h.appendChild(f),l.appendChild(h),b=e.createRange(),b.selectNode(f),c.rangeBCRIgnoresElementBCR=0===b.getClientRects().length,
f.appendChild(e.createTextNode("Rect transform test")),e=f.getBoundingClientRect(),p=b.getBoundingClientRect(),c.unscaledRangeClientRects=2<Math.abs(e.height-p.height),h.style.transform="",h.style["-webkit-transform"]="",e=k.style.overflow,p=l.style.overflow,r=l.style.height,d=l.scrollTop,k.style.overflow="visible",l.style.overflow="visible",l.style.height="200%",l.scrollTop=l.scrollHeight,c.elementBCRIgnoresBodyScroll=b.getBoundingClientRect().top!==f.getBoundingClientRect().top,l.scrollTop=d,l.style.height=
r,l.style.overflow=p,k.style.overflow=e,b.detach(),l.removeChild(h),b=Object.keys(c).map(function(a){return a+":"+String(c[a])}).join(", "),runtime.log("Detected browser quirks - "+b)));return c}function k(b,c,f){for(b=b?b.firstElementChild:null;b;){if(b.localName===f&&b.namespaceURI===c)return b;b=b.nextElementSibling}return null}var c;core.DomUtils=function(){function b(a,g){for(var d=0,b;a.parentNode!==g;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(b=g.firstChild;b!==
a;)d+=1,b=b.nextSibling;return d}function c(a,g){return 0>=a.compareBoundaryPoints(Range.START_TO_START,g)&&0<=a.compareBoundaryPoints(Range.END_TO_END,g)}function p(a,g){return 0>=a.compareBoundaryPoints(Range.END_TO_START,g)&&0<=a.compareBoundaryPoints(Range.START_TO_END,g)}function h(a,g){var d=null;a.nodeType===Node.TEXT_NODE&&(0===a.length?(a.parentNode.removeChild(a),g.nodeType===Node.TEXT_NODE&&(d=g)):(g.nodeType===Node.TEXT_NODE&&(a.appendData(g.data),g.parentNode.removeChild(g)),d=a));return d}
function n(a){for(var g=a.parentNode;a.firstChild;)g.insertBefore(a.firstChild,a);g.removeChild(a);return g}function s(a,g){for(var d=a.parentNode,b=a.firstChild,c;b;)c=b.nextSibling,s(b,g),b=c;d&&g(a)&&n(a);return d}function l(a,g){return a===g||Boolean(a.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function r(a,g){return f().unscaledRangeClientRects?a:a/g}function d(a,g,b){Object.keys(g).forEach(function(c){var e=c.split(":"),h=e[1],f=b(e[0]),e=g[c],p=typeof e;"object"===p?Object.keys(e).length&&
(c=f?a.getElementsByTagNameNS(f,h)[0]||a.ownerDocument.createElementNS(f,c):a.getElementsByTagName(h)[0]||a.ownerDocument.createElement(c),a.appendChild(c),d(c,e,b)):f&&(runtime.assert("number"===p||"string"===p,"attempting to map unsupported type '"+p+"' (key: "+c+")"),a.setAttributeNS(f,c,String(e)))})}var a=null;this.splitBoundaries=function(a){var g,d=[],c,e,h;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType===Node.TEXT_NODE){c=a.endContainer;e=a.endContainer.nodeType!==
Node.TEXT_NODE?a.endOffset===a.endContainer.childNodes.length:!1;h=a.endOffset;g=a.endContainer;if(h<g.childNodes.length)for(g=g.childNodes.item(h),h=0;g.firstChild;)g=g.firstChild;else for(;g.lastChild;)g=g.lastChild,h=g.nodeType===Node.TEXT_NODE?g.textContent.length:g.childNodes.length;g===c&&(c=null);a.setEnd(g,h);h=a.endContainer;0!==a.endOffset&&h.nodeType===Node.TEXT_NODE&&(g=h,a.endOffset!==g.length&&(d.push(g.splitText(a.endOffset)),d.push(g)));h=a.startContainer;0!==a.startOffset&&h.nodeType===
Node.TEXT_NODE&&(g=h,a.startOffset!==g.length&&(h=g.splitText(a.startOffset),d.push(g),d.push(h),a.setStart(h,0)));if(null!==c){for(h=a.endContainer;h.parentNode&&h.parentNode!==c;)h=h.parentNode;e=e?c.childNodes.length:b(h,c);a.setEnd(c,e)}}return d};this.containsRange=c;this.rangesIntersect=p;this.rangeIntersection=function(a,g){var d;p(a,g)&&(d=a.cloneRange(),-1===a.compareBoundaryPoints(Range.START_TO_START,g)&&d.setStart(g.startContainer,g.startOffset),1===a.compareBoundaryPoints(Range.END_TO_END,
g)&&d.setEnd(g.endContainer,g.endOffset));return d};this.getNodesInRange=function(a,g,d){var b=[],c=a.commonAncestorContainer,c=c.nodeType===Node.TEXT_NODE?c.parentNode:c;d=a.startContainer.ownerDocument.createTreeWalker(c,d,g,!1);var e,h;a.endContainer.childNodes[a.endOffset-1]?(e=a.endContainer.childNodes[a.endOffset-1],h=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(e=a.endContainer,h=Node.DOCUMENT_POSITION_PRECEDING);a.startContainer.childNodes[a.startOffset]?(a=a.startContainer.childNodes[a.startOffset],
d.currentNode=a):a.startOffset===(a.startContainer.nodeType===Node.TEXT_NODE?a.startContainer.length:a.startContainer.childNodes.length)?(a=a.startContainer,d.currentNode=a,d.lastChild(),a=d.nextNode()):(a=a.startContainer,d.currentNode=a);if(a){a=d.currentNode;if(a!==c)for(a=a.parentNode;a&&a!==c;)g(a)===NodeFilter.FILTER_REJECT&&(d.currentNode=a),a=a.parentNode;a=d.currentNode;switch(g(a)){case NodeFilter.FILTER_REJECT:for(a=d.nextSibling();!a&&d.parentNode();)a=d.nextSibling();break;case NodeFilter.FILTER_SKIP:a=
d.nextNode()}for(;a;){g=e.compareDocumentPosition(a);if(0!==g&&0===(g&h))break;b.push(a);a=d.nextNode()}}return b};this.normalizeTextNodes=function(a){a&&a.nextSibling&&(a=h(a,a.nextSibling));a&&a.previousSibling&&h(a.previousSibling,a)};this.rangeContainsNode=function(a,g){var d=g.ownerDocument.createRange(),b=g.ownerDocument.createRange(),h;d.setStart(a.startContainer,a.startOffset);d.setEnd(a.endContainer,a.endOffset);b.selectNodeContents(g);h=c(d,b);d.detach();b.detach();return h};this.mergeIntoParent=
n;this.removeUnwantedNodes=s;this.getElementsByTagNameNS=function(a,g,d){var b=[];a=a.getElementsByTagNameNS(g,d);b.length=d=a.length;for(g=0;g<d;g+=1)b[g]=a.item(g);return b};this.getElementsByTagName=function(a,g){var d=[],b,c,e;b=a.getElementsByTagName(g);d.length=e=b.length;for(c=0;c<e;c+=1)d[c]=b.item(c);return d};this.containsNode=function(a,d){return a===d||a.contains(d)};this.comparePoints=function(a,d,c,e){if(a===c)return e-d;var h=a.compareDocumentPosition(c);2===h?h=-1:4===h?h=1:10===h?
(d=b(a,c),h=d<e?1:-1):(e=b(c,a),h=e<d?-1:1);return h};this.adaptRangeDifferenceToZoomLevel=r;this.translateRect=function(a,d,b){return{top:r(a.top-d.top,b),left:r(a.left-d.left,b),bottom:r(a.bottom-d.top,b),right:r(a.right-d.left,b),width:r(a.width,b),height:r(a.height,b)}};this.getBoundingClientRect=function(d){var g=d.ownerDocument,b=f(),c=g.body;if((!1===b.unscaledRangeClientRects||b.rangeBCRIgnoresElementBCR)&&d.nodeType===Node.ELEMENT_NODE)return d=d.getBoundingClientRect(),b.elementBCRIgnoresBodyScroll?
{left:d.left+c.scrollLeft,right:d.right+c.scrollLeft,top:d.top+c.scrollTop,bottom:d.bottom+c.scrollTop,width:d.width,height:d.height}:d;var e;a?e=a:a=e=g.createRange();b=e;b.selectNode(d);return b.getBoundingClientRect()};this.mapKeyValObjOntoNode=function(a,d,b){Object.keys(d).forEach(function(c){var e=c.split(":"),h=e[1],e=b(e[0]),f=d[c];e?(h=a.getElementsByTagNameNS(e,h)[0],h||(h=a.ownerDocument.createElementNS(e,c),a.appendChild(h)),h.textContent=f):runtime.log("Key ignored: "+c)})};this.removeKeyElementsFromNode=
function(a,d,b){d.forEach(function(d){var g=d.split(":"),c=g[1];(g=b(g[0]))?(c=a.getElementsByTagNameNS(g,c)[0])?c.parentNode.removeChild(c):runtime.log("Element for "+d+" not found."):runtime.log("Property Name ignored: "+d)})};this.getKeyValRepresentationOfNode=function(a,d){for(var b={},c=a.firstElementChild,e;c;){if(e=d(c.namespaceURI))b[e+":"+c.localName]=c.textContent;c=c.nextElementSibling}return b};this.mapObjOntoNode=d;this.cloneEvent=function(a){var d=Object.create(null);Object.keys(a).forEach(function(b){d[b]=
a[b]});d.prototype=a.constructor.prototype;return d};this.getDirectChild=k;(function(a){var d,b;b=runtime.getWindow();null!==b&&(d=b.navigator.appVersion.toLowerCase(),b=-1===d.indexOf("chrome")&&(-1!==d.indexOf("applewebkit")||-1!==d.indexOf("safari")),d=d.indexOf("msie"),b||d)&&(a.containsNode=l)})(this)}})();core.Cursor=function(f,k){function c(d){d.parentNode&&(n.push(d.previousSibling),n.push(d.nextSibling),d.parentNode.removeChild(d))}function b(d,a,b){if(a.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(a),"putCursorIntoTextNode: invalid container");var g=a.parentNode;runtime.assert(Boolean(g),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=a.length,"putCursorIntoTextNode: offset is out of bounds");0===b?g.insertBefore(d,a):(b!==a.length&&a.splitText(b),g.insertBefore(d,
a.nextSibling))}else a.nodeType===Node.ELEMENT_NODE&&a.insertBefore(d,a.childNodes.item(b));n.push(d.previousSibling);n.push(d.nextSibling)}var e=f.createElementNS("urn:webodf:names:cursor","cursor"),p=f.createElementNS("urn:webodf:names:cursor","anchor"),h,n=[],s=f.createRange(),l,r=new core.DomUtils;this.getNode=function(){return e};this.getAnchorNode=function(){return p.parentNode?p:e};this.getSelectedRange=function(){l?(s.setStartBefore(e),s.collapse(!0)):(s.setStartAfter(h?p:e),s.setEndBefore(h?
e:p));return s};this.setSelectedRange=function(d,a){s&&s!==d&&s.detach();s=d;h=!1!==a;(l=d.collapsed)?(c(p),c(e),b(e,d.startContainer,d.startOffset)):(c(p),c(e),b(h?e:p,d.endContainer,d.endOffset),b(h?p:e,d.startContainer,d.startOffset));n.forEach(r.normalizeTextNodes);n.length=0};this.hasForwardSelection=function(){return h};this.remove=function(){c(e);n.forEach(r.normalizeTextNodes);n.length=0};e.setAttributeNS("urn:webodf:names:cursor","memberId",k);p.setAttributeNS("urn:webodf:names:cursor","memberId",
k)};core.Destroyable=function(){};core.Destroyable.prototype.destroy=function(f){};core.EventNotifier=function(f){function k(b){runtime.assert(!c.hasOwnProperty(b),'Duplicated event ids: "'+b+'" registered more than once.');c[b]=[]}var c={};this.emit=function(b,e){var f,h;runtime.assert(c.hasOwnProperty(b),'unknown event fired "'+b+'"');h=c[b];for(f=0;f<h.length;f+=1)h[f](e)};this.subscribe=function(b,e){runtime.assert(c.hasOwnProperty(b),'tried to subscribe to unknown event "'+b+'"');c[b].push(e)};this.unsubscribe=function(b,e){var f;runtime.assert(c.hasOwnProperty(b),'tried to unsubscribe from unknown event "'+
b+'"');f=c[b].indexOf(e);runtime.assert(-1!==f,'tried to unsubscribe unknown callback from event "'+b+'"');-1!==f&&c[b].splice(f,1)};this.register=k;f&&f.forEach(k)};core.LazyProperty=function(f){var k,c=!1;this.value=function(){c||(k=f(),c=!0);return k};this.reset=function(){c=!1}};core.LoopWatchDog=function(f,k){var c=Date.now(),b=0;this.check=function(){var e;if(f&&(e=Date.now(),e-c>f))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(b+=1,b>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.PositionIterator=function(f,k,c,b){function e(){this.acceptNode=function(a){return!a||a.nodeType===m&&0===a.length?v:x}}function p(a){this.acceptNode=function(d){return!d||d.nodeType===m&&0===d.length?v:a.acceptNode(d)}}function h(){var a=r.currentNode,b=a.nodeType;d=b===m?a.length-1:b===g?1:0}function n(){if(null===r.previousSibling()){if(!r.parentNode()||r.currentNode===f)return r.firstChild(),!1;d=0}else h();return!0}function s(){var g=r.currentNode,b;b=a(g);if(g!==f)for(g=g.parentNode;g&&
g!==f;)a(g)===v&&(r.currentNode=g,b=v),g=g.parentNode;b===v?(d=1,g=l.nextPosition()):g=b===x?!0:l.nextPosition();g&&runtime.assert(a(r.currentNode)===x,"moveToAcceptedNode did not result in walker being on an accepted node");return g}var l=this,r,d,a,m=Node.TEXT_NODE,g=Node.ELEMENT_NODE,x=NodeFilter.FILTER_ACCEPT,v=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var a=r.currentNode,b=a.nodeType;if(a===f)return!1;if(0===d&&b===g)null===r.firstChild()&&(d=1);else if(b===m&&d+1<a.length)d+=1;else if(null!==
r.nextSibling())d=0;else if(r.parentNode())d=1;else return!1;return!0};this.previousPosition=function(){var a=!0,g=r.currentNode;0===d?a=n():g.nodeType===m?d-=1:null!==r.lastChild()?h():g===f?a=!1:d=0;return a};this.previousNode=n;this.container=function(){var a=r.currentNode,g=a.nodeType;0===d&&g!==m&&(a=a.parentNode);return a};this.rightNode=function(){var b=r.currentNode,c=b.nodeType;if(c===m&&d===b.length)for(b=b.nextSibling;b&&a(b)!==x;)b=b.nextSibling;else c===g&&1===d&&(b=null);return b};this.leftNode=
function(){var b=r.currentNode;if(0===d)for(b=b.previousSibling;b&&a(b)!==x;)b=b.previousSibling;else if(b.nodeType===g)for(b=b.lastChild;b&&a(b)!==x;)b=b.previousSibling;return b};this.getCurrentNode=function(){return r.currentNode};this.unfilteredDomOffset=function(){if(r.currentNode.nodeType===m)return d;for(var a=0,g=r.currentNode,g=1===d?g.lastChild:g.previousSibling;g;)a+=1,g=g.previousSibling;return a};this.getPreviousSibling=function(){var a=r.currentNode,d=r.previousSibling();r.currentNode=
a;return d};this.getNextSibling=function(){var a=r.currentNode,d=r.nextSibling();r.currentNode=a;return d};this.setPositionBeforeElement=function(a){runtime.assert(Boolean(a),"setPositionBeforeElement called without element");r.currentNode=a;d=0;return s()};this.setUnfilteredPosition=function(a,g){runtime.assert(Boolean(a),"PositionIterator.setUnfilteredPosition called without container");r.currentNode=a;if(a.nodeType===m)return d=g,runtime.assert(g<=a.length,"Error in setPosition: "+g+" > "+a.length),
runtime.assert(0<=g,"Error in setPosition: "+g+" < 0"),g===a.length&&(r.nextSibling()?d=0:r.parentNode()?d=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid.")),!0;g<a.childNodes.length?(r.currentNode=a.childNodes.item(g),d=0):d=1;return s()};this.moveToEnd=function(){r.currentNode=f;d=1};this.moveToEndOfNode=function(a){a.nodeType===m?l.setUnfilteredPosition(a,a.length):(r.currentNode=a,d=1)};this.isBeforeNode=function(){return 0===d};this.getNodeFilter=function(){return a};
a=(c?new p(c):new e).acceptNode;a.acceptNode=a;k=k||NodeFilter.SHOW_ALL;runtime.assert(f.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes");r=f.ownerDocument.createTreeWalker(f,k,a,b);d=0;null===r.firstChild()&&(d=1)};core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(f){};core.PositionFilterChain=function(){var f=[],k=core.PositionFilter.FilterResult.FILTER_ACCEPT,c=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(b){var e;for(e=0;e<f.length;e+=1)if(f[e].acceptPosition(b)===c)return c;return k};this.addFilter=function(b){f.push(b)}};(function(){core.RawInflate=function(){var f;(function(k){f=k()})(function(){return function c(b,e,f){function h(n,l){if(!e[n]){if(!b[n])throw Error("Cannot find module '"+n+"'");var r=e[n]={exports:{}};b[n][0].call(r.exports,function(d){var a=b[n][1][d];return h(a?a:d)},r,r.exports,c,b,e,f)}return e[n].exports}for(var n=0;n<f.length;n++)h(f[n]);return h}({1:[function(c,b,e){function f(a,d){var b=new m(d);b.push(a,!0);if(b.err)throw b.msg;return b.result}var h=c("./zlib/inflate.js"),n=c("./utils/common"),
s=c("./utils/strings"),l=c("./zlib/constants"),r=c("./zlib/messages"),d=c("./zlib/zstream"),a=c("./zlib/gzheader"),m=function(g){var b=this.options=n.assign({chunkSize:16384,windowBits:0,to:""},g||{});b.raw&&0<=b.windowBits&&16>b.windowBits&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15));!(0<=b.windowBits&&16>b.windowBits)||g&&g.windowBits||(b.windowBits+=32);15<b.windowBits&&48>b.windowBits&&0===(b.windowBits&15)&&(b.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=
[];this.strm=new d;this.strm.avail_out=0;g=h.inflateInit2(this.strm,b.windowBits);if(g!==l.Z_OK)throw Error(r[g]);this.header=new a;h.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,d){var b=this.strm,c=this.options.chunkSize,m,e,f,p,r;if(this.ended)return!1;e=d===~~d?d:!0===d?l.Z_FINISH:l.Z_NO_FLUSH;b.input="string"===typeof a?s.binstring2buf(a):a;b.next_in=0;b.avail_in=b.input.length;do{0===b.avail_out&&(b.output=new n.Buf8(c),b.next_out=0,b.avail_out=c);m=h.inflate(b,l.Z_NO_FLUSH);
if(m!==l.Z_STREAM_END&&m!==l.Z_OK)return this.onEnd(m),this.ended=!0,!1;if(b.next_out&&(0===b.avail_out||m===l.Z_STREAM_END||0===b.avail_in&&e===l.Z_FINISH))if("string"===this.options.to)f=s.utf8border(b.output,b.next_out),p=b.next_out-f,r=s.buf2string(b.output,f),b.next_out=p,b.avail_out=c-p,p&&n.arraySet(b.output,b.output,f,p,0),this.onData(r);else this.onData(n.shrinkBuf(b.output,b.next_out))}while((0<b.avail_in||0===b.avail_out)&&m!==l.Z_STREAM_END);m===l.Z_STREAM_END&&(e=l.Z_FINISH);return e===
l.Z_FINISH?(m=h.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===l.Z_OK):!0};m.prototype.onData=function(a){this.chunks.push(a)};m.prototype.onEnd=function(a){a===l.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):n.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};e.Inflate=m;e.inflate=f;e.inflateRaw=function(a,d){d=d||{};d.raw=!0;return f(a,d)};e.ungzip=f},{"./utils/common":2,"./utils/strings":3,"./zlib/constants":5,"./zlib/gzheader":7,"./zlib/inflate.js":9,
"./zlib/messages":11,"./zlib/zstream":12}],2:[function(c,b,e){c="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;e.assign=function(b){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var e=c.shift();if(e){if("object"!==typeof e)throw new TypeError(e+"must be non-object");for(var h in e)e.hasOwnProperty(h)&&(b[h]=e[h])}}return b};e.shrinkBuf=function(b,c){if(b.length===c)return b;if(b.subarray)return b.subarray(0,c);b.length=c;return b};
var f={arraySet:function(b,c,e,h,d){if(c.subarray&&b.subarray)b.set(c.subarray(e,e+h),d);else for(var a=0;a<h;a++)b[d+a]=c[e+a]},flattenChunks:function(b){var c,e,h,d,a;c=h=0;for(e=b.length;c<e;c++)h+=b[c].length;a=new Uint8Array(h);c=h=0;for(e=b.length;c<e;c++)d=b[c],a.set(d,h),h+=d.length;return a}},h={arraySet:function(b,c,e,h,d){for(var a=0;a<h;a++)b[d+a]=c[e+a]},flattenChunks:function(b){return[].concat.apply([],b)}};e.setTyped=function(b){b?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,
e.assign(e,f)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,h))};e.setTyped(c)},{}],3:[function(c,b,e){function f(a,d){if(65537>d&&(a.subarray&&s||!a.subarray&&n))return String.fromCharCode.apply(null,h.shrinkBuf(a,d));for(var b="",c=0;c<d;c++)b+=String.fromCharCode(a[c]);return b}var h=c("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(l){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){s=!1}var d=new h.Buf8(256);for(c=0;256>c;c++)d[c]=252<=c?6:248<=
c?5:240<=c?4:224<=c?3:192<=c?2:1;d[254]=d[254]=1;e.string2buf=function(a){var d,b,c,e,f,p=a.length,n=0;for(e=0;e<p;e++)b=a.charCodeAt(e),55296===(b&64512)&&e+1<p&&(c=a.charCodeAt(e+1),56320===(c&64512)&&(b=65536+(b-55296<<10)+(c-56320),e++)),n+=128>b?1:2048>b?2:65536>b?3:4;d=new h.Buf8(n);for(e=f=0;f<n;e++)b=a.charCodeAt(e),55296===(b&64512)&&e+1<p&&(c=a.charCodeAt(e+1),56320===(c&64512)&&(b=65536+(b-55296<<10)+(c-56320),e++)),128>b?d[f++]=b:(2048>b?d[f++]=192|b>>>6:(65536>b?d[f++]=224|b>>>12:(d[f++]=
240|b>>>18,d[f++]=128|b>>>12&63),d[f++]=128|b>>>6&63),d[f++]=128|b&63);return d};e.buf2binstring=function(a){return f(a,a.length)};e.binstring2buf=function(a){for(var d=new h.Buf8(a.length),b=0,c=d.length;b<c;b++)d[b]=a.charCodeAt(b);return d};e.buf2string=function(a,b){var g,c,e,h,n=b||a.length,r=Array(2*n);for(g=c=0;g<n;)if(e=a[g++],128>e)r[c++]=e;else if(h=d[e],4<h)r[c++]=65533,g+=h-1;else{for(e&=2===h?31:3===h?15:7;1<h&&g<n;)e=e<<6|a[g++]&63,h--;1<h?r[c++]=65533:65536>e?r[c++]=e:(e-=65536,r[c++]=
55296|e>>10&1023,r[c++]=56320|e&1023)}return f(r,c)};e.utf8border=function(a,b){var g;b=b||a.length;b>a.length&&(b=a.length);for(g=b-1;0<=g&&128===(a[g]&192);)g--;return 0>g||0===g?b:g+d[a[g]]>b?g:b}},{"./common":2}],4:[function(c,b,e){b.exports=function(b,c,e,f){var l=b&65535|0;b=b>>>16&65535|0;for(var r=0;0!==e;){r=2E3<e?2E3:e;e-=r;do l=l+c[f++]|0,b=b+l|0;while(--r);l%=65521;b%=65521}return l|b<<16|0}},{}],5:[function(c,b,e){b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,
Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],6:[function(c,b,e){var f=function(){for(var b,c=[],e=0;256>e;e++){b=e;for(var f=0;8>f;f++)b=b&1?3988292384^b>>>1:b>>>1;c[e]=b}return c}();b.exports=function(b,c,e,l){e=l+e;for(b^=
-1;l<e;l++)b=b>>>8^f[(b^c[l])&255];return b^-1}},{}],7:[function(c,b,e){b.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(c,b,e){b.exports=function(b,c){var e,f,l,r,d,a,m,g,x,v,z,y,t,u,w,B,I,D,F,q,Q,N,U,C;e=b.state;f=b.next_in;U=b.input;l=f+(b.avail_in-5);r=b.next_out;C=b.output;d=r-(c-b.avail_out);a=r+(b.avail_out-257);m=e.dmax;g=e.wsize;x=e.whave;v=e.wnext;z=e.window;y=e.hold;t=e.bits;
u=e.lencode;w=e.distcode;B=(1<<e.lenbits)-1;I=(1<<e.distbits)-1;a:do b:for(15>t&&(y+=U[f++]<<t,t+=8,y+=U[f++]<<t,t+=8),D=u[y&B];;){F=D>>>24;y>>>=F;t-=F;F=D>>>16&255;if(0===F)C[r++]=D&65535;else if(F&16){q=D&65535;if(F&=15)t<F&&(y+=U[f++]<<t,t+=8),q+=y&(1<<F)-1,y>>>=F,t-=F;15>t&&(y+=U[f++]<<t,t+=8,y+=U[f++]<<t,t+=8);D=w[y&I];c:for(;;){F=D>>>24;y>>>=F;t-=F;F=D>>>16&255;if(F&16){D&=65535;F&=15;t<F&&(y+=U[f++]<<t,t+=8,t<F&&(y+=U[f++]<<t,t+=8));D+=y&(1<<F)-1;if(D>m){b.msg="invalid distance too far back";
e.mode=30;break a}y>>>=F;t-=F;F=r-d;if(D>F){F=D-F;if(F>x&&e.sane){b.msg="invalid distance too far back";e.mode=30;break a}Q=0;N=z;if(0===v){if(Q+=g-F,F<q){q-=F;do C[r++]=z[Q++];while(--F);Q=r-D;N=C}}else if(v<F){if(Q+=g+v-F,F-=v,F<q){q-=F;do C[r++]=z[Q++];while(--F);Q=0;if(v<q){F=v;q-=F;do C[r++]=z[Q++];while(--F);Q=r-D;N=C}}}else if(Q+=v-F,F<q){q-=F;do C[r++]=z[Q++];while(--F);Q=r-D;N=C}for(;2<q;)C[r++]=N[Q++],C[r++]=N[Q++],C[r++]=N[Q++],q-=3;q&&(C[r++]=N[Q++],1<q&&(C[r++]=N[Q++]))}else{Q=r-D;do C[r++]=
C[Q++],C[r++]=C[Q++],C[r++]=C[Q++],q-=3;while(2<q);q&&(C[r++]=C[Q++],1<q&&(C[r++]=C[Q++]))}}else if(0===(F&64)){D=w[(D&65535)+(y&(1<<F)-1)];continue c}else{b.msg="invalid distance code";e.mode=30;break a}break}}else if(0===(F&64)){D=u[(D&65535)+(y&(1<<F)-1)];continue b}else{F&32?e.mode=12:(b.msg="invalid literal/length code",e.mode=30);break a}break}while(f<l&&r<a);q=t>>3;f-=q;t-=q<<3;b.next_in=f;b.next_out=r;b.avail_in=f<l?5+(l-f):5-(f-l);b.avail_out=r<a?257+(a-r):257-(r-a);e.hold=y&(1<<t)-1;e.bits=
t}},{}],9:[function(c,b,e){function f(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function h(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new d.Buf16(320);this.work=
new d.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function n(a){var b;if(!a||!a.state)return z;b=a.state;a.total_in=a.total_out=b.total=0;a.msg="";b.wrap&&(a.adler=b.wrap&1);b.mode=y;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=b.lendyn=new d.Buf32(t);b.distcode=b.distdyn=new d.Buf32(u);b.sane=1;b.back=-1;return v}function s(a){var b;if(!a||!a.state)return z;b=a.state;b.wsize=0;b.whave=0;b.wnext=0;return n(a)}function l(a,b){var d,g;if(!a||
!a.state)return z;g=a.state;0>b?(d=0,b=-b):(d=(b>>4)+1,48>b&&(b&=15));if(b&&(8>b||15<b))return z;null!==g.window&&g.wbits!==b&&(g.window=null);g.wrap=d;g.wbits=b;return s(a)}function r(a,b){var d;if(!a)return z;d=new h;a.state=d;d.window=null;d=l(a,b);d!==v&&(a.state=null);return d}var d=c("../utils/common"),a=c("./adler32"),m=c("./crc32"),g=c("./inffast"),x=c("./inftrees"),v=0,z=-2,y=1,t=852,u=592,w=!0,B,I;e.inflateReset=s;e.inflateReset2=l;e.inflateResetKeep=n;e.inflateInit=function(a){return r(a,
15)};e.inflateInit2=r;e.inflate=function(b,c){var q,e,h,r,n,l,s,t,u,aa,W,E,G,O;E=0;var A,P,J,X,M,T=new d.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!b||!b.state||!b.output||!b.input&&0!==b.avail_in)return z;q=b.state;12===q.mode&&(q.mode=13);n=b.next_out;h=b.output;s=b.avail_out;r=b.next_in;e=b.input;l=b.avail_in;t=q.hold;u=q.bits;aa=l;W=s;M=v;a:for(;;)switch(q.mode){case y:if(0===q.wrap){q.mode=13;break}for(;16>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(q.wrap&2&&35615===t){q.check=
0;T[0]=t&255;T[1]=t>>>8&255;q.check=m(q.check,T,2,0);u=t=0;q.mode=2;break}q.flags=0;q.head&&(q.head.done=!1);if(!(q.wrap&1)||(((t&255)<<8)+(t>>8))%31){b.msg="incorrect header check";q.mode=30;break}if(8!==(t&15)){b.msg="unknown compression method";q.mode=30;break}t>>>=4;u-=4;G=(t&15)+8;if(0===q.wbits)q.wbits=G;else if(G>q.wbits){b.msg="invalid window size";q.mode=30;break}q.dmax=1<<G;b.adler=q.check=1;q.mode=t&512?10:12;u=t=0;break;case 2:for(;16>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.flags=
t;if(8!==(q.flags&255)){b.msg="unknown compression method";q.mode=30;break}if(q.flags&57344){b.msg="unknown header flags set";q.mode=30;break}q.head&&(q.head.text=t>>8&1);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,q.check=m(q.check,T,2,0));u=t=0;q.mode=3;case 3:for(;32>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.head&&(q.head.time=t);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,T[2]=t>>>16&255,T[3]=t>>>24&255,q.check=m(q.check,T,4,0));u=t=0;q.mode=4;case 4:for(;16>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=
8}q.head&&(q.head.xflags=t&255,q.head.os=t>>8);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,q.check=m(q.check,T,2,0));u=t=0;q.mode=5;case 5:if(q.flags&1024){for(;16>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.length=t;q.head&&(q.head.extra_len=t);q.flags&512&&(T[0]=t&255,T[1]=t>>>8&255,q.check=m(q.check,T,2,0));u=t=0}else q.head&&(q.head.extra=null);q.mode=6;case 6:if(q.flags&1024&&(E=q.length,E>l&&(E=l),E&&(q.head&&(G=q.head.extra_len-q.length,q.head.extra||(q.head.extra=Array(q.head.extra_len)),d.arraySet(q.head.extra,
e,r,E,G)),q.flags&512&&(q.check=m(q.check,e,E,r)),l-=E,r+=E,q.length-=E),q.length))break a;q.length=0;q.mode=7;case 7:if(q.flags&2048){if(0===l)break a;E=0;do G=e[r+E++],q.head&&G&&65536>q.length&&(q.head.name+=String.fromCharCode(G));while(G&&E<l);q.flags&512&&(q.check=m(q.check,e,E,r));l-=E;r+=E;if(G)break a}else q.head&&(q.head.name=null);q.length=0;q.mode=8;case 8:if(q.flags&4096){if(0===l)break a;E=0;do G=e[r+E++],q.head&&G&&65536>q.length&&(q.head.comment+=String.fromCharCode(G));while(G&&E<
l);q.flags&512&&(q.check=m(q.check,e,E,r));l-=E;r+=E;if(G)break a}else q.head&&(q.head.comment=null);q.mode=9;case 9:if(q.flags&512){for(;16>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(t!==(q.check&65535)){b.msg="header crc mismatch";q.mode=30;break}u=t=0}q.head&&(q.head.hcrc=q.flags>>9&1,q.head.done=!0);b.adler=q.check=0;q.mode=12;break;case 10:for(;32>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}b.adler=q.check=f(t);u=t=0;q.mode=11;case 11:if(0===q.havedict)return b.next_out=n,b.avail_out=s,b.next_in=
r,b.avail_in=l,q.hold=t,q.bits=u,2;b.adler=q.check=1;q.mode=12;case 12:if(5===c||6===c)break a;case 13:if(q.last){t>>>=u&7;u-=u&7;q.mode=27;break}for(;3>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.last=t&1;t>>>=1;u-=1;switch(t&3){case 0:q.mode=14;break;case 1:E=q;if(w){G=void 0;B=new d.Buf32(512);I=new d.Buf32(32);for(G=0;144>G;)E.lens[G++]=8;for(;256>G;)E.lens[G++]=9;for(;280>G;)E.lens[G++]=7;for(;288>G;)E.lens[G++]=8;x(1,E.lens,0,288,B,0,E.work,{bits:9});for(G=0;32>G;)E.lens[G++]=5;x(2,E.lens,
0,32,I,0,E.work,{bits:5});w=!1}E.lencode=B;E.lenbits=9;E.distcode=I;E.distbits=5;q.mode=20;if(6===c){t>>>=2;u-=2;break a}break;case 2:q.mode=17;break;case 3:b.msg="invalid block type",q.mode=30}t>>>=2;u-=2;break;case 14:t>>>=u&7;for(u-=u&7;32>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if((t&65535)!==(t>>>16^65535)){b.msg="invalid stored block lengths";q.mode=30;break}q.length=t&65535;u=t=0;q.mode=15;if(6===c)break a;case 15:q.mode=16;case 16:if(E=q.length){E>l&&(E=l);E>s&&(E=s);if(0===E)break a;d.arraySet(h,
e,r,E,n);l-=E;r+=E;s-=E;n+=E;q.length-=E;break}q.mode=12;break;case 17:for(;14>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.nlen=(t&31)+257;t>>>=5;u-=5;q.ndist=(t&31)+1;t>>>=5;u-=5;q.ncode=(t&15)+4;t>>>=4;u-=4;if(286<q.nlen||30<q.ndist){b.msg="too many length or distance symbols";q.mode=30;break}q.have=0;q.mode=18;case 18:for(;q.have<q.ncode;){for(;3>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.lens[Z[q.have++]]=t&7;t>>>=3;u-=3}for(;19>q.have;)q.lens[Z[q.have++]]=0;q.lencode=q.lendyn;q.lenbits=7;
E={bits:q.lenbits};M=x(0,q.lens,0,19,q.lencode,0,q.work,E);q.lenbits=E.bits;if(M){b.msg="invalid code lengths set";q.mode=30;break}q.have=0;q.mode=19;case 19:for(;q.have<q.nlen+q.ndist;){for(;;){E=q.lencode[t&(1<<q.lenbits)-1];A=E>>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(16>J)t>>>=A,u-=A,q.lens[q.have++]=J;else{if(16===J){for(E=A+2;u<E;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}t>>>=A;u-=A;if(0===q.have){b.msg="invalid bit length repeat";q.mode=30;break}G=
q.lens[q.have-1];E=3+(t&3);t>>>=2;u-=2}else if(17===J){for(E=A+3;u<E;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}t>>>=A;u-=A;G=0;E=3+(t&7);t>>>=3;u-=3}else{for(E=A+7;u<E;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}t>>>=A;u-=A;G=0;E=11+(t&127);t>>>=7;u-=7}if(q.have+E>q.nlen+q.ndist){b.msg="invalid bit length repeat";q.mode=30;break}for(;E--;)q.lens[q.have++]=G}}if(30===q.mode)break;if(0===q.lens[256]){b.msg="invalid code -- missing end-of-block";q.mode=30;break}q.lenbits=9;E={bits:q.lenbits};M=x(1,q.lens,
0,q.nlen,q.lencode,0,q.work,E);q.lenbits=E.bits;if(M){b.msg="invalid literal/lengths set";q.mode=30;break}q.distbits=6;q.distcode=q.distdyn;E={bits:q.distbits};M=x(2,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,E);q.distbits=E.bits;if(M){b.msg="invalid distances set";q.mode=30;break}q.mode=20;if(6===c)break a;case 20:q.mode=21;case 21:if(6<=l&&258<=s){b.next_out=n;b.avail_out=s;b.next_in=r;b.avail_in=l;q.hold=t;q.bits=u;g(b,W);n=b.next_out;h=b.output;s=b.avail_out;r=b.next_in;e=b.input;l=b.avail_in;
t=q.hold;u=q.bits;12===q.mode&&(q.back=-1);break}for(q.back=0;;){E=q.lencode[t&(1<<q.lenbits)-1];A=E>>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(P&&0===(P&240)){G=A;O=P;for(X=J;;){E=q.lencode[X+((t&(1<<G+O)-1)>>G)];A=E>>>24;P=E>>>16&255;J=E&65535;if(G+A<=u)break;if(0===l)break a;l--;t+=e[r++]<<u;u+=8}t>>>=G;u-=G;q.back+=G}t>>>=A;u-=A;q.back+=A;q.length=J;if(0===P){q.mode=26;break}if(P&32){q.back=-1;q.mode=12;break}if(P&64){b.msg="invalid literal/length code";
q.mode=30;break}q.extra=P&15;q.mode=22;case 22:if(q.extra){for(E=q.extra;u<E;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.length+=t&(1<<q.extra)-1;t>>>=q.extra;u-=q.extra;q.back+=q.extra}q.was=q.length;q.mode=23;case 23:for(;;){E=q.distcode[t&(1<<q.distbits)-1];A=E>>>24;P=E>>>16&255;J=E&65535;if(A<=u)break;if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(0===(P&240)){G=A;O=P;for(X=J;;){E=q.distcode[X+((t&(1<<G+O)-1)>>G)];A=E>>>24;P=E>>>16&255;J=E&65535;if(G+A<=u)break;if(0===l)break a;l--;t+=e[r++]<<u;u+=
8}t>>>=G;u-=G;q.back+=G}t>>>=A;u-=A;q.back+=A;if(P&64){b.msg="invalid distance code";q.mode=30;break}q.offset=J;q.extra=P&15;q.mode=24;case 24:if(q.extra){for(E=q.extra;u<E;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}q.offset+=t&(1<<q.extra)-1;t>>>=q.extra;u-=q.extra;q.back+=q.extra}if(q.offset>q.dmax){b.msg="invalid distance too far back";q.mode=30;break}q.mode=25;case 25:if(0===s)break a;E=W-s;if(q.offset>E){E=q.offset-E;if(E>q.whave&&q.sane){b.msg="invalid distance too far back";q.mode=30;break}E>
q.wnext?(E-=q.wnext,G=q.wsize-E):G=q.wnext-E;E>q.length&&(E=q.length);O=q.window}else O=h,G=n-q.offset,E=q.length;E>s&&(E=s);s-=E;q.length-=E;do h[n++]=O[G++];while(--E);0===q.length&&(q.mode=21);break;case 26:if(0===s)break a;h[n++]=q.length;s--;q.mode=21;break;case 27:if(q.wrap){for(;32>u;){if(0===l)break a;l--;t|=e[r++]<<u;u+=8}W-=s;b.total_out+=W;q.total+=W;W&&(b.adler=q.check=q.flags?m(q.check,h,W,n-W):a(q.check,h,W,n-W));W=s;if((q.flags?t:f(t))!==q.check){b.msg="incorrect data check";q.mode=
30;break}u=t=0}q.mode=28;case 28:if(q.wrap&&q.flags){for(;32>u;){if(0===l)break a;l--;t+=e[r++]<<u;u+=8}if(t!==(q.total&4294967295)){b.msg="incorrect length check";q.mode=30;break}u=t=0}q.mode=29;case 29:M=1;break a;case 30:M=-3;break a;case 31:return-4;default:return z}b.next_out=n;b.avail_out=s;b.next_in=r;b.avail_in=l;q.hold=t;q.bits=u;if(q.wsize||W!==b.avail_out&&30>q.mode&&(27>q.mode||4!==c))e=b.output,r=b.next_out,n=W-b.avail_out,s=b.state,null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=
0,s.window=new d.Buf8(s.wsize)),n>=s.wsize?(d.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(l=s.wsize-s.wnext,l>n&&(l=n),d.arraySet(s.window,e,r-n,l,s.wnext),(n-=l)?(d.arraySet(s.window,e,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=l,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=l)));aa-=b.avail_in;W-=b.avail_out;b.total_in+=aa;b.total_out+=W;q.total+=W;q.wrap&&W&&(b.adler=q.check=q.flags?m(q.check,h,W,b.next_out-W):a(q.check,h,W,b.next_out-W));b.data_type=q.bits+
(q.last?64:0)+(12===q.mode?128:0)+(20===q.mode||15===q.mode?256:0);(0===aa&&0===W||4===c)&&M===v&&(M=-5);return M};e.inflateEnd=function(a){if(!a||!a.state)return z;var b=a.state;b.window&&(b.window=null);a.state=null;return v};e.inflateGetHeader=function(a,b){var d;if(!a||!a.state)return z;d=a.state;if(0===(d.wrap&2))return z;d.head=b;b.done=!1;return v};e.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":2,"./adler32":4,"./crc32":6,"./inffast":8,"./inftrees":10}],10:[function(c,
b,e){var f=c("../utils/common"),h=[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],n=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],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,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(b,d,a,c,g,e,v,z){for(var y=z.bits,t=0,u=
0,w=0,B=0,I=0,D=0,F=0,q=0,Q=0,N=0,U,C,$=null,S=0,H,Y=new f.Buf16(16),D=new f.Buf16(16),aa=null,W=0,E,G,O,t=0;15>=t;t++)Y[t]=0;for(u=0;u<c;u++)Y[d[a+u]]++;I=y;for(B=15;1<=B&&0===Y[B];B--);I>B&&(I=B);if(0===B)return g[e++]=20971520,g[e++]=20971520,z.bits=1,0;for(w=1;w<B&&0===Y[w];w++);I<w&&(I=w);for(t=q=1;15>=t;t++)if(q<<=1,q-=Y[t],0>q)return-1;if(0<q&&(0===b||1!==B))return-1;D[1]=0;for(t=1;15>t;t++)D[t+1]=D[t]+Y[t];for(u=0;u<c;u++)0!==d[a+u]&&(v[D[d[a+u]]++]=u);switch(b){case 0:$=aa=v;H=19;break;case 1:$=
h;S-=257;aa=n;W-=257;H=256;break;default:$=s,aa=l,H=-1}u=N=0;t=w;y=e;D=I;F=0;C=-1;Q=1<<I;c=Q-1;if(1===b&&852<Q||2===b&&592<Q)return 1;for(var A=0;;){A++;E=t-F;v[u]<H?(G=0,O=v[u]):v[u]>H?(G=aa[W+v[u]],O=$[S+v[u]]):(G=96,O=0);q=1<<t-F;w=U=1<<D;do U-=q,g[y+(N>>F)+U]=E<<24|G<<16|O|0;while(0!==U);for(q=1<<t-1;N&q;)q>>=1;0!==q?(N&=q-1,N+=q):N=0;u++;if(0===--Y[t]){if(t===B)break;t=d[a+v[u]]}if(t>I&&(N&c)!==C){0===F&&(F=I);y+=w;D=t-F;for(q=1<<D;D+F<B;){q-=Y[D+F];if(0>=q)break;D++;q<<=1}Q+=1<<D;if(1===b&&
852<Q||2===b&&592<Q)return 1;C=N&c;g[C]=I<<24|D<<16|y-e|0}}0!==N&&(g[y+N]=t-F<<24|4194304);z.bits=I;return 0}},{"../utils/common":2}],11:[function(c,b,e){b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],12:[function(c,b,e){b.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out=
0;this.msg="";this.state=null;this.data_type=2;this.adler=0}},{}]},{},[1])(1)});return{inflate:function(k,c){return f.inflateRaw(k)}}}()})();core.ScheduledTask=function(f,k,c){function b(){h&&(c(p),h=!1)}function e(){b();f.apply(void 0,n);n=null}var p,h=!1,n=[],s=!1;this.trigger=function(){runtime.assert(!1===s,"Can't trigger destroyed ScheduledTask instance");n=Array.prototype.slice.call(arguments);h||(h=!0,p=k(e))};this.triggerImmediate=function(){runtime.assert(!1===s,"Can't trigger destroyed ScheduledTask instance");n=Array.prototype.slice.call(arguments);e()};this.processRequests=function(){h&&e()};this.cancel=b;this.destroy=function(c){b();
s=!0;c()}};core.StepDirection={PREVIOUS:1,NEXT:2};core.StepIterator=function(f,k){function c(){r=null;a=d=void 0}function b(){void 0===a&&(a=f.acceptPosition(k)===l);return a}function e(a,b){c();return k.setUnfilteredPosition(a,b)}function p(){r||(r=k.container());return r}function h(){void 0===d&&(d=k.unfilteredDomOffset());return d}function n(){for(c();k.nextPosition();)if(c(),b())return!0;return!1}function s(){for(c();k.previousPosition();)if(c(),b())return!0;return!1}var l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r,d,a;this.isStep=b;this.setPosition=
e;this.container=p;this.offset=h;this.nextStep=n;this.previousStep=s;this.advanceStep=function(a){return a===core.StepDirection.NEXT?n():s()};this.roundToClosestStep=function(){var a,d,c=b();c||(a=p(),d=h(),c=s(),c||(e(a,d),c=n()));return c};this.roundToPreviousStep=function(){var a=b();a||(a=s());return a};this.roundToNextStep=function(){var a=b();a||(a=n());return a};this.leftNode=function(){return k.leftNode()}};(function(){var f;core.Task={};core.Task.SUPPRESS_MANUAL_PROCESSING=!1;core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||f.performRedraw()};core.Task.createRedrawTask=function(k){return new core.ScheduledTask(k,f.requestRedrawTask,f.cancelRedrawTask)};core.Task.createTimeoutTask=function(f,c){return new core.ScheduledTask(f,function(b){return runtime.setTimeout(b,c)},runtime.clearTimeout)};f=new function(){var f={};this.requestRedrawTask=function(c){var b=runtime.requestAnimationFrame(function(){c();
delete f[b]});f[b]=c;return b};this.performRedraw=function(){Object.keys(f).forEach(function(c){f[c]();runtime.cancelAnimationFrame(parseInt(c,10))});f={}};this.cancelRedrawTask=function(c){runtime.cancelAnimationFrame(c);delete f[c]}}})();core.UnitTest=function(){};core.UnitTest.prototype.setUp=function(){};core.UnitTest.prototype.tearDown=function(){};core.UnitTest.prototype.description=function(){};core.UnitTest.prototype.tests=function(){};core.UnitTest.prototype.asyncTests=function(){};
core.UnitTest.provideTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!k,'Unclean test environment, found a div with id "testarea".');k=f.createElement("div");k.setAttribute("id","testarea");f.body.appendChild(k);return k};
core.UnitTest.cleanupTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!!k&&k.parentNode===f.body,'Test environment broken, found no div with id "testarea" below body.');f.body.removeChild(k)};core.UnitTest.createXmlDocument=function(f,k,c){var b="<?xml version='1.0' encoding='UTF-8'?>",b=b+("<"+f);Object.keys(c).forEach(function(e){b+=" xmlns:"+e+'="'+c[e]+'"'});b+=">";b+=k;b+="</"+f+">";return runtime.parseXML(b)};
core.UnitTest.createOdtDocument=function(f,k){return core.UnitTest.createXmlDocument("office:document",f,k)};
core.UnitTestLogger=function(){var f=[],k=0,c=0,b="",e="";this.startTest=function(p,h){f=[];k=0;b=p;e=h;c=Date.now()};this.endTest=function(){var p=Date.now();return{description:e,suite:[b,e],success:0===k,log:f,time:p-c}};this.debug=function(b){f.push({category:"debug",message:b})};this.fail=function(b){k+=1;f.push({category:"fail",message:b})};this.pass=function(b){f.push({category:"pass",message:b})}};
core.UnitTestRunner=function(f,k){function c(a){s+=1;d?k.debug(a):k.fail(a)}function b(a,b){var d;try{if(a.length!==b.length)return c("array of length "+a.length+" should be "+b.length+" long"),!1;for(d=0;d<a.length;d+=1)if(a[d]!==b[d])return c(a[d]+" should be "+b[d]+" at array index "+d),!1}catch(e){return!1}return!0}function e(a,b,d){var f=a.attributes,h=f.length,r,l,p;for(r=0;r<h;r+=1)if(l=f.item(r),"xmlns"!==l.prefix&&"urn:webodf:names:steps"!==l.namespaceURI){p=b.getAttributeNS(l.namespaceURI,
l.localName);if(!b.hasAttributeNS(l.namespaceURI,l.localName))return c("Attribute "+l.localName+" with value "+l.value+" was not present"),!1;if(p!==l.value)return c("Attribute "+l.localName+" was "+p+" should be "+l.value),!1}return d?!0:e(b,a,!0)}function p(a,b){var d,f;d=a.nodeType;f=b.nodeType;if(d!==f)return c("Nodetype '"+d+"' should be '"+f+"'"),!1;if(d===Node.TEXT_NODE){if(a.data===b.data)return!0;c("Textnode data '"+a.data+"' should be '"+b.data+"'");return!1}runtime.assert(d===Node.ELEMENT_NODE,
"Only textnodes and elements supported.");if(a.namespaceURI!==b.namespaceURI)return c("namespace '"+a.namespaceURI+"' should be '"+b.namespaceURI+"'"),!1;if(a.localName!==b.localName)return c("localName '"+a.localName+"' should be '"+b.localName+"'"),!1;if(!e(a,b,!1))return!1;d=a.firstChild;for(f=b.firstChild;d;){if(!f)return c("Nodetype '"+d.nodeType+"' is unexpected here."),!1;if(!p(d,f))return!1;d=d.nextSibling;f=f.nextSibling}return f?(c("Nodetype '"+f.nodeType+"' is missing here."),!1):!0}function h(a,
d,g){if(0===d)return a===d&&1/a===1/d;if(a===d)return!0;if(null===a||null===d)return!1;if("number"===typeof d&&isNaN(d))return"number"===typeof a&&isNaN(a);if("number"===typeof d&&"number"===typeof a){if(a===d)return!0;void 0===g&&(g=1E-4);runtime.assert("number"===typeof g,"Absolute tolerance not given as number.");runtime.assert(0<=g,"Absolute tolerance should be given as positive number, was "+g);a=Math.abs(a-d);return a<=g}return Object.prototype.toString.call(d)===Object.prototype.toString.call([])?
b(a,d):"object"===typeof d&&"object"===typeof a?d.constructor===Element||d.constructor===Node?p(a,d):r(a,d):!1}function n(a,b,d,e){"string"===typeof b&&"string"===typeof d||k.debug("WARN: shouldBe() expects string arguments");var f,l;try{l=eval(b)}catch(r){f=r}a=eval(d);f?c(b+" should be "+a+". Threw exception "+f):h(l,a,e)?k.pass(b+" is "+d):String(typeof l)===String(typeof a)?(d=0===l&&0>1/l?"-0":String(l),c(b+" should be "+a+". Was "+d+".")):c(b+" should be "+a+" (of type "+typeof a+"). Was "+
l+" (of type "+typeof l+").")}var s=0,l,r,d=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){l=s;d=!0};this.endExpectFail=function(){var a=l===s;d=!1;s=l;a&&(s+=1,k.fail("Expected at least one failed test, but none registered."))};r=function(a,d){var g=Object.keys(a),e=Object.keys(d);g.sort();e.sort();return b(g,e)&&Object.keys(a).every(function(b){var g=a[b],e=d[b];return h(g,e)?!0:(c(g+" should be "+e+" for key "+b),!1)})};this.areNodesEqual=p;this.shouldBeNull=function(a,
b){n(a,b,"null")};this.shouldBeNonNull=function(a,b){var d,e;try{e=eval(b)}catch(f){d=f}d?c(b+" should be non-null. Threw exception "+d):null!==e?k.pass(b+" is non-null."):c(b+" should be non-null. Was "+e)};this.shouldBe=n;this.testFailed=c;this.countFailedTests=function(){return s};this.name=function(a){var b,d,c=[],e=a.length;c.length=e;for(b=0;b<e;b+=1){d=Runtime.getFunctionName(a[b])||"";if(""===d)throw"Found a function without a name.";c[b]={f:a[b],name:d}}return c}};
core.UnitTester=function(){function f(b,c){return"<span style='color:blue;cursor:pointer' onclick='"+c+"'>"+b+"</span>"}function k(b){c.reporter&&c.reporter(b)}var c=this,b=0,e=new core.UnitTestLogger,p={},h="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(b){var c,e;h?runtime.log("<span>Running "+f(b.description,'runTest("'+b.suite[0]+'","'+b.description+'")')+"</span>"):runtime.log("Running "+b.description);if(!b.success)for(c=0;c<b.log.length;c+=1)e=b.log[c],runtime.log(e.category,
e.message)};this.runTests=function(n,s,l){function r(c){function f(){n&&a.endExpectFail();k(e.endTest());m.tearDown();g[h]=t===a.countFailedTests();r(c.slice(1))}var h,n;if(0===c.length)p[d]=g,b+=a.countFailedTests(),s();else if(v=c[0].f,h=c[0].name,n=!0===c[0].expectFail,t=a.countFailedTests(),l.length&&-1===l.indexOf(h))r(c.slice(1));else{m.setUp();e.startTest(d,h);n&&a.beginExpectFail();try{v(f)}catch(x){a.testFailed("Unexpected exception encountered: "+x.toString()+"\n"+x.stack),f()}}}var d=Runtime.getFunctionName(n)||
"",a=new core.UnitTestRunner(c.resourcePrefix,e),m=new n(a),g={},x,v,z,y,t;if(p.hasOwnProperty(d))runtime.log("Test "+d+" has already run.");else{h?runtime.log("<span>Running "+f(d,'runSuite("'+d+'");')+": "+m.description()+"</span>"):runtime.log("Running "+d+": "+m.description);z=m.tests();for(x=0;x<z.length;x+=1)if(v=z[x].f,n=z[x].name,y=!0===z[x].expectFail,!l.length||-1!==l.indexOf(n)){t=a.countFailedTests();m.setUp();e.startTest(d,n);y&&a.beginExpectFail();try{v()}catch(u){a.testFailed("Unexpected exception encountered: "+
u.toString()+"\n"+u.stack)}y&&a.endExpectFail();k(e.endTest());m.tearDown();g[n]=t===a.countFailedTests()}r(m.asyncTests())}};this.failedTestsCount=function(){return b};this.results=function(){return p}};core.Utils=function(){function f(k,c){if(c&&Array.isArray(c)){k=k||[];if(!Array.isArray(k))throw"Destination is not an array.";k=k.concat(c.map(function(b){return f(null,b)}))}else if(c&&"object"===typeof c){k=k||{};if("object"!==typeof k)throw"Destination is not an object.";Object.keys(c).forEach(function(b){k[b]=f(k[b],c[b])})}else k=c;return k}this.hashString=function(f){var c=0,b,e;b=0;for(e=f.length;b<e;b+=1)c=(c<<5)-c+f.charCodeAt(b),c|=0;return c};this.mergeObjects=function(k,c){Object.keys(c).forEach(function(b){k[b]=
f(k[b],c[b])});return k}};core.Zip=function(f,k){function c(a){var b=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,
853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,
4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,
225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,
2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,
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,e=0,e=0;d=-1;for(g=0;g<c;g+=1)e=(d^a[g])&255,e=b[e],d=d>>>8^e;return d^-1}function b(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 e(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 p(a,d){var c,e,m,f,h,q,l,r=this;this.load=function(b){if(null!==r.data)b(null,r.data);else{var d=h+34+e+m+256;d+l>g&&(d=g-l);runtime.read(a,l,d,function(d,g){if(d||null===g)b(d,g);else a:{var c=g,e=new core.ByteArray(c),m=e.readUInt32LE(),l;if(67324752!==m)b("File entry signature is wrong."+m.toString()+" "+c.length.toString(),null);else{e.pos+=22;m=e.readUInt16LE();l=e.readUInt16LE();e.pos+=m+l;if(f){c=
c.subarray(e.pos,e.pos+h);if(h!==c.length){b("The amount of compressed bytes read was "+c.length.toString()+" instead of "+h.toString()+" for "+r.filename+" in "+a+".",null);break a}c=v(c,q)}else c=c.subarray(e.pos,e.pos+q);q!==c.length?b("The amount of bytes read was "+c.length.toString()+" instead of "+q.toString()+" for "+r.filename+" in "+a+".",null):(r.data=c,b(null,c))}}})}};this.set=function(a,b,d,g){r.filename=a;r.data=b;r.compressed=d;r.date=g};this.error=null;d&&(c=d.readUInt32LE(),33639248!==
c?this.error="Central directory entry has wrong signature at position "+(d.pos-4).toString()+' for file "'+a+'": '+d.data.length.toString():(d.pos+=6,f=d.readUInt16LE(),this.date=b(d.readUInt32LE()),d.readUInt32LE(),h=d.readUInt32LE(),q=d.readUInt32LE(),e=d.readUInt16LE(),m=d.readUInt16LE(),c=d.readUInt16LE(),d.pos+=8,l=d.readUInt32LE(),this.filename=runtime.byteArrayToString(d.data.subarray(d.pos,d.pos+e),"utf8"),this.data=null,d.pos+=e+m+c))}function h(a,b){if(22!==a.length)b("Central directory length should be 22.",
z);else{var d=new core.ByteArray(a),c;c=d.readUInt32LE();101010256!==c?b("Central directory signature is wrong: "+c.toString(),z):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",z):(c=d.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",z):(c=d.readUInt16LE(),x=d.readUInt16LE(),c!==x?b("Number of entries is inconsistent.",z):(c=d.readUInt32LE(),d=d.readUInt16LE(),d=g-22-c,runtime.read(f,d,g-d,function(a,d){if(a||null===d)b(a,z);else a:{var c=
new core.ByteArray(d),g,e;m=[];for(g=0;g<x;g+=1){e=new p(f,c);if(e.error){b(e.error,z);break a}m[m.length]=e}b(null,z)}})))))}}function n(a,b){var d=null,g,c;for(c=0;c<m.length;c+=1)if(g=m[c],g.filename===a){d=g;break}d?d.data?b(null,d.data):d.load(b):b(a+" not found.",null)}function s(a){var b=new core.ByteArrayWriter("utf8"),d=0;b.appendArray([80,75,3,4,20,0,0,0,0,0]);a.data&&(d=a.data.length);b.appendUInt32LE(e(a.date));b.appendUInt32LE(a.data?c(a.data):0);b.appendUInt32LE(d);b.appendUInt32LE(d);
b.appendUInt16LE(a.filename.length);b.appendUInt16LE(0);b.appendString(a.filename);a.data&&b.appendByteArray(a.data);return b}function l(a,b){var d=new core.ByteArrayWriter("utf8"),g=0;d.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);a.data&&(g=a.data.length);d.appendUInt32LE(e(a.date));d.appendUInt32LE(a.data?c(a.data):0);d.appendUInt32LE(g);d.appendUInt32LE(g);d.appendUInt16LE(a.filename.length);d.appendArray([0,0,0,0,0,0,0,0,0,0,0,0]);d.appendUInt32LE(b);d.appendString(a.filename);return d}function r(a,
b){if(a===m.length)b(null);else{var d=m[a];null!==d.data?r(a+1,b):d.load(function(d){d?b(d):r(a+1,b)})}}function d(a,b){r(0,function(d){if(d)b(d);else{var g,c,e=new core.ByteArrayWriter("utf8"),f=[0];for(g=0;g<m.length;g+=1)e.appendByteArrayWriter(s(m[g])),f.push(e.getLength());d=e.getLength();for(g=0;g<m.length;g+=1)c=m[g],e.appendByteArrayWriter(l(c,f[g]));g=e.getLength()-d;e.appendArray([80,75,5,6,0,0,0,0]);e.appendUInt16LE(m.length);e.appendUInt16LE(m.length);e.appendUInt32LE(g);e.appendUInt32LE(d);
e.appendArray([0,0]);a(e.getByteArray())}})}function a(a,b){d(function(d){runtime.writeFile(a,d,b)},b)}var m,g,x,v=core.RawInflate.inflate,z=this,y=new core.Base64;this.load=n;this.save=function(a,b,d,g){var c,e;for(c=0;c<m.length;c+=1)if(e=m[c],e.filename===a){e.set(a,b,d,g);return}e=new p(f);e.set(a,b,d,g);m.push(e)};this.remove=function(a){var b,d;for(b=0;b<m.length;b+=1)if(d=m[b],d.filename===a)return m.splice(b,1),!0;return!1};this.write=function(b){a(f,b)};this.writeAs=a;this.createByteArray=
d;this.loadContentXmlAsFragments=function(a,b){z.loadAsString(a,function(a,d){if(a)return b.rootElementReady(a);b.rootElementReady(null,d,!0)})};this.loadAsString=function(a,b){n(a,function(a,d){if(a||null===d)return b(a,null);var g=runtime.byteArrayToString(d,"utf8");b(null,g)})};this.loadAsDOM=function(a,b){z.loadAsString(a,function(a,d){if(a||null===d)b(a,null);else{var g=(new DOMParser).parseFromString(d,"text/xml");b(null,g)}})};this.loadAsDataURL=function(a,b,d){n(a,function(a,g){if(a||!g)return d(a,
null);var c=0,e;b||(b=80===g[1]&&78===g[2]&&71===g[3]?"image/png":255===g[0]&&216===g[1]&&255===g[2]?"image/jpeg":71===g[0]&&73===g[1]&&70===g[2]?"image/gif":"");for(e="data:"+b+";base64,";c<g.length;)e+=y.convertUTF8ArrayToBase64(g.subarray(c,Math.min(c+45E3,g.length))),c+=45E3;d(null,e)})};this.getEntries=function(){return m.slice()};g=-1;null===k?m=[]:runtime.getFileSize(f,function(a){g=a;0>g?k("File '"+f+"' cannot be read.",z):runtime.read(f,g-22,22,function(a,b){a||null===k||null===b?k(a,z):
h(b,k)})})};gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}};gui.SessionConstraints=function(){function f(b){k.hasOwnProperty(b)||(k[b]=!1,c.register(b))}var k={},c=new core.EventNotifier;this.registerConstraint=f;this.subscribe=function(b,e){f(b);c.subscribe(b,e)};this.unsubscribe=function(b,e){c.unsubscribe(b,e)};this.setState=function(b,e){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==e&&(k[b]=e,c.emit(b,e))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};odf.Namespaces={namespaceMap:{db:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dc:"http://purl.org/dc/elements/1.1/",dr3d:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chart:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",form:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",meta:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",number:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",
office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},dbns:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",
dcns:"http://purl.org/dc/elements/1.1/",dr3dns:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",drawns:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chartns:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fons:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",formns:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",metans:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",numberns:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",officens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
presentationns:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",stylens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svgns:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",tablens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",textns:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"};
(function(){var f=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,c;for(c in f)f.hasOwnProperty(c)&&(k[f[c]]=c)})();odf.Namespaces.forEachPrefix=function(f){var k=odf.Namespaces.namespaceMap,c;for(c in k)k.hasOwnProperty(c)&&f(c,k[c])};odf.Namespaces.lookupNamespaceURI=function(f){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(f)&&(k=odf.Namespaces.namespaceMap[f]);return k};odf.Namespaces.lookupPrefix=function(f){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(f)?k[f]:null};
odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI;xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};
function createXPathSingleton(){function f(b,d,a){return-1!==b&&(b<d||-1===d)&&(b<a||-1===a)}function k(b){for(var d=[],a=0,c=b.length,g;a<c;){var e=b,h=c,p=d,n="",k=[],s=e.indexOf("[",a),w=e.indexOf("/",a),B=e.indexOf("=",a);f(w,s,B)?(n=e.substring(a,w),a=w+1):f(s,w,B)?(n=e.substring(a,s),a=l(e,s,k)):f(B,w,s)?(n=e.substring(a,B),a=B):(n=e.substring(a,h),a=h);p.push({location:n,predicates:k});if(a<c&&"="===b[a]){g=b.substring(a+1,c);if(2<g.length&&("'"===g[0]||'"'===g[0]))g=g.slice(1,g.length-1);
else try{g=parseInt(g,10)}catch(I){}a=c}}return{steps:d,value:g}}function c(){var b=null,d=!1;this.setNode=function(a){b=a};this.reset=function(){d=!1};this.next=function(){var a=d?null:b;d=!0;return a}}function b(b,d,a){this.reset=function(){b.reset()};this.next=function(){for(var c=b.next();c;){c.nodeType===Node.ELEMENT_NODE&&(c=c.getAttributeNodeNS(d,a));if(c)break;c=b.next()}return c}}function e(b,d){var a=b.next(),c=null;this.reset=function(){b.reset();a=b.next();c=null};this.next=function(){for(;a;){if(c)if(d&&
c.firstChild)c=c.firstChild;else{for(;!c.nextSibling&&c!==a;)c=c.parentNode;c===a?a=b.next():c=c.nextSibling}else{do(c=a.firstChild)||(a=b.next());while(a&&!c)}if(c&&c.nodeType===Node.ELEMENT_NODE)return c}return null}}function p(b,d){this.reset=function(){b.reset()};this.next=function(){for(var a=b.next();a&&!d(a);)a=b.next();return a}}function h(b,d,a){d=d.split(":",2);var c=a(d[0]),g=d[1];return new p(b,function(a){return a.localName===g&&a.namespaceURI===c})}function n(b,d,a){var e=new c,g=s(e,
d,a),f=d.value;return void 0===f?new p(b,function(a){e.setNode(a);g.reset();return null!==g.next()}):new p(b,function(a){e.setNode(a);g.reset();return(a=g.next())?a.nodeValue===f:!1})}var s,l;l=function(b,d,a){for(var c=d,g=b.length,e=0;c<g;)"]"===b[c]?(e-=1,0>=e&&a.push(k(b.substring(d,c)))):"["===b[c]&&(0>=e&&(d=c+1),e+=1),c+=1;return c};s=function(c,d,a){var m,g,f,l;for(m=0;m<d.steps.length;m+=1){f=d.steps[m];g=f.location;if(""===g)c=new e(c,!1);else if("@"===g[0]){g=g.substr(1).split(":",2);l=
a(g[0]);if(!l)throw"No namespace associated with the prefix "+g[0];c=new b(c,l,g[1])}else"."!==g&&(c=new e(c,!1),-1!==g.indexOf(":")&&(c=h(c,g,a)));for(g=0;g<f.predicates.length;g+=1)l=f.predicates[g],c=n(c,l,a)}return c};return{getODFElementsWithXPath:function(b,d,a){var e=b.ownerDocument,g=[],f=null;if(e&&"function"===typeof e.evaluate)for(a=e.evaluate(d,b,a,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null),f=a.iterateNext();null!==f;)f.nodeType===Node.ELEMENT_NODE&&g.push(f),f=a.iterateNext();else{g=
new c;g.setNode(b);b=k(d);g=s(g,b,a);b=[];for(a=g.next();a;)b.push(a),a=g.next();g=b}return g}}}xmldom.XPath=createXPathSingleton();odf.StyleInfo=function(){function f(a,b){var d,c,g,e,m,h=0;if(d=D[a.localName])if(g=d[a.namespaceURI])h=g.length;for(d=0;d<h;d+=1)c=g[d],e=c.ns,m=c.localname,(c=a.getAttributeNS(e,m))&&a.setAttributeNS(e,B[e]+m,b+c);for(g=a.firstElementChild;g;)f(g,b),g=g.nextElementSibling}function k(a,b){var d,c,g,e,m,f=0;if(d=D[a.localName])if(g=d[a.namespaceURI])f=g.length;for(d=0;d<f;d+=1)if(c=g[d],e=c.ns,m=c.localname,c=a.getAttributeNS(e,m))c=c.replace(b,""),a.setAttributeNS(e,B[e]+m,c);for(g=a.firstElementChild;g;)k(g,
b),g=g.nextElementSibling}function c(a,b){var d,c,g,e,m,f=0;if(d=D[a.localName])if(g=d[a.namespaceURI])f=g.length;for(d=0;d<f;d+=1)if(e=g[d],c=e.ns,m=e.localname,c=a.getAttributeNS(c,m))b=b||{},e=e.keyname,b.hasOwnProperty(e)?b[e][c]=1:(m={},m[c]=1,b[e]=m);return b}function b(a,d){var g,e;c(a,d);for(g=a.firstChild;g;)g.nodeType===Node.ELEMENT_NODE&&(e=g,b(e,d)),g=g.nextSibling}function e(a,b,d){this.key=a;this.name=b;this.family=d;this.requires={}}function p(a,b,d){var c=a+'"'+b,g=d[c];g||(g=d[c]=
new e(c,a,b));return g}function h(a,b,d){var c,g,e,m,f,l=0;c=a.getAttributeNS(t,"name");m=a.getAttributeNS(t,"family");c&&m&&(b=p(c,m,d));if(b){if(c=D[a.localName])if(e=c[a.namespaceURI])l=e.length;for(c=0;c<l;c+=1)if(m=e[c],g=m.ns,f=m.localname,g=a.getAttributeNS(g,f))m=m.keyname,m=p(g,m,d),b.requires[m.key]=m}for(a=a.firstElementChild;a;)h(a,b,d),a=a.nextElementSibling;return d}function n(a,b){var d=b[a.family];d||(d=b[a.family]={});d[a.name]=1;Object.keys(a.requires).forEach(function(d){n(a.requires[d],
b)})}function s(a,b){var d=h(a,null,{});Object.keys(d).forEach(function(a){a=d[a];var c=b[a.family];c&&c.hasOwnProperty(a.name)&&n(a,b)})}function l(a,b){function d(b){(b=e.getAttributeNS(t,b))&&(a[b]=!0)}var c=["font-name","font-name-asian","font-name-complex"],g,e;for(g=b&&b.firstElementChild;g;)e=g,c.forEach(d),l(a,e),g=g.nextElementSibling}function r(a,b){function d(a){var c=e.getAttributeNS(t,a);c&&b.hasOwnProperty(c)&&e.setAttributeNS(t,"style:"+a,b[c])}var c=["font-name","font-name-asian",
"font-name-complex"],g,e;for(g=a&&a.firstElementChild;g;)e=g,c.forEach(d),r(e,b),g=g.nextElementSibling}var d=odf.Namespaces.chartns,a=odf.Namespaces.dbns,m=odf.Namespaces.dr3dns,g=odf.Namespaces.drawns,x=odf.Namespaces.formns,v=odf.Namespaces.numberns,z=odf.Namespaces.officens,y=odf.Namespaces.presentationns,t=odf.Namespaces.stylens,u=odf.Namespaces.tablens,w=odf.Namespaces.textns,B={"urn:oasis:names:tc:opendocument:xmlns:chart:1.0":"chart:","urn:oasis:names:tc:opendocument:xmlns:database:1.0":"db:",
"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0":"dr3d:","urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":"draw:","urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":"fo:","urn:oasis:names:tc:opendocument:xmlns:form:1.0":"form:","urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":"number:","urn:oasis:names:tc:opendocument:xmlns:office:1.0":"office:","urn:oasis:names:tc:opendocument:xmlns:presentation:1.0":"presentation:","urn:oasis:names:tc:opendocument:xmlns:style:1.0":"style:","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0":"svg:",
"urn:oasis:names:tc:opendocument:xmlns:table:1.0":"table:","urn:oasis:names:tc:opendocument:xmlns:text:1.0":"chart:","http://www.w3.org/XML/1998/namespace":"xml:"},I={text:[{ens:t,en:"tab-stop",ans:t,a:"leader-text-style"},{ens:t,en:"drop-cap",ans:t,a:"style-name"},{ens:w,en:"notes-configuration",ans:w,a:"citation-body-style-name"},{ens:w,en:"notes-configuration",ans:w,a:"citation-style-name"},{ens:w,en:"a",ans:w,a:"style-name"},{ens:w,en:"alphabetical-index",ans:w,a:"style-name"},{ens:w,en:"linenumbering-configuration",
ans:w,a:"style-name"},{ens:w,en:"list-level-style-number",ans:w,a:"style-name"},{ens:w,en:"ruby-text",ans:w,a:"style-name"},{ens:w,en:"span",ans:w,a:"style-name"},{ens:w,en:"a",ans:w,a:"visited-style-name"},{ens:t,en:"text-properties",ans:t,a:"text-line-through-text-style"},{ens:w,en:"alphabetical-index-source",ans:w,a:"main-entry-style-name"},{ens:w,en:"index-entry-bibliography",ans:w,a:"style-name"},{ens:w,en:"index-entry-chapter",ans:w,a:"style-name"},{ens:w,en:"index-entry-link-end",ans:w,a:"style-name"},
{ens:w,en:"index-entry-link-start",ans:w,a:"style-name"},{ens:w,en:"index-entry-page-number",ans:w,a:"style-name"},{ens:w,en:"index-entry-span",ans:w,a:"style-name"},{ens:w,en:"index-entry-tab-stop",ans:w,a:"style-name"},{ens:w,en:"index-entry-text",ans:w,a:"style-name"},{ens:w,en:"index-title-template",ans:w,a:"style-name"},{ens:w,en:"list-level-style-bullet",ans:w,a:"style-name"},{ens:w,en:"outline-level-style",ans:w,a:"style-name"}],paragraph:[{ens:g,en:"caption",ans:g,a:"text-style-name"},{ens:g,
en:"circle",ans:g,a:"text-style-name"},{ens:g,en:"connector",ans:g,a:"text-style-name"},{ens:g,en:"control",ans:g,a:"text-style-name"},{ens:g,en:"custom-shape",ans:g,a:"text-style-name"},{ens:g,en:"ellipse",ans:g,a:"text-style-name"},{ens:g,en:"frame",ans:g,a:"text-style-name"},{ens:g,en:"line",ans:g,a:"text-style-name"},{ens:g,en:"measure",ans:g,a:"text-style-name"},{ens:g,en:"path",ans:g,a:"text-style-name"},{ens:g,en:"polygon",ans:g,a:"text-style-name"},{ens:g,en:"polyline",ans:g,a:"text-style-name"},
{ens:g,en:"rect",ans:g,a:"text-style-name"},{ens:g,en:"regular-polygon",ans:g,a:"text-style-name"},{ens:z,en:"annotation",ans:g,a:"text-style-name"},{ens:x,en:"column",ans:x,a:"text-style-name"},{ens:t,en:"style",ans:t,a:"next-style-name"},{ens:u,en:"body",ans:u,a:"paragraph-style-name"},{ens:u,en:"even-columns",ans:u,a:"paragraph-style-name"},{ens:u,en:"even-rows",ans:u,a:"paragraph-style-name"},{ens:u,en:"first-column",ans:u,a:"paragraph-style-name"},{ens:u,en:"first-row",ans:u,a:"paragraph-style-name"},
{ens:u,en:"last-column",ans:u,a:"paragraph-style-name"},{ens:u,en:"last-row",ans:u,a:"paragraph-style-name"},{ens:u,en:"odd-columns",ans:u,a:"paragraph-style-name"},{ens:u,en:"odd-rows",ans:u,a:"paragraph-style-name"},{ens:w,en:"notes-configuration",ans:w,a:"default-style-name"},{ens:w,en:"alphabetical-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"bibliography-entry-template",ans:w,a:"style-name"},{ens:w,en:"h",ans:w,a:"style-name"},{ens:w,en:"illustration-index-entry-template",ans:w,a:"style-name"},
{ens:w,en:"index-source-style",ans:w,a:"style-name"},{ens:w,en:"object-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"p",ans:w,a:"style-name"},{ens:w,en:"table-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"table-of-content-entry-template",ans:w,a:"style-name"},{ens:w,en:"table-index-entry-template",ans:w,a:"style-name"},{ens:w,en:"user-index-entry-template",ans:w,a:"style-name"},{ens:t,en:"page-layout-properties",ans:t,a:"register-truth-ref-style-name"}],chart:[{ens:d,en:"axis",ans:d,
a:"style-name"},{ens:d,en:"chart",ans:d,a:"style-name"},{ens:d,en:"data-label",ans:d,a:"style-name"},{ens:d,en:"data-point",ans:d,a:"style-name"},{ens:d,en:"equation",ans:d,a:"style-name"},{ens:d,en:"error-indicator",ans:d,a:"style-name"},{ens:d,en:"floor",ans:d,a:"style-name"},{ens:d,en:"footer",ans:d,a:"style-name"},{ens:d,en:"grid",ans:d,a:"style-name"},{ens:d,en:"legend",ans:d,a:"style-name"},{ens:d,en:"mean-value",ans:d,a:"style-name"},{ens:d,en:"plot-area",ans:d,a:"style-name"},{ens:d,en:"regression-curve",
ans:d,a:"style-name"},{ens:d,en:"series",ans:d,a:"style-name"},{ens:d,en:"stock-gain-marker",ans:d,a:"style-name"},{ens:d,en:"stock-loss-marker",ans:d,a:"style-name"},{ens:d,en:"stock-range-line",ans:d,a:"style-name"},{ens:d,en:"subtitle",ans:d,a:"style-name"},{ens:d,en:"title",ans:d,a:"style-name"},{ens:d,en:"wall",ans:d,a:"style-name"}],section:[{ens:w,en:"alphabetical-index",ans:w,a:"style-name"},{ens:w,en:"bibliography",ans:w,a:"style-name"},{ens:w,en:"illustration-index",ans:w,a:"style-name"},
{ens:w,en:"index-title",ans:w,a:"style-name"},{ens:w,en:"object-index",ans:w,a:"style-name"},{ens:w,en:"section",ans:w,a:"style-name"},{ens:w,en:"table-of-content",ans:w,a:"style-name"},{ens:w,en:"table-index",ans:w,a:"style-name"},{ens:w,en:"user-index",ans:w,a:"style-name"}],ruby:[{ens:w,en:"ruby",ans:w,a:"style-name"}],table:[{ens:a,en:"query",ans:a,a:"style-name"},{ens:a,en:"table-representation",ans:a,a:"style-name"},{ens:u,en:"background",ans:u,a:"style-name"},{ens:u,en:"table",ans:u,a:"style-name"}],
"table-column":[{ens:a,en:"column",ans:a,a:"style-name"},{ens:u,en:"table-column",ans:u,a:"style-name"}],"table-row":[{ens:a,en:"query",ans:a,a:"default-row-style-name"},{ens:a,en:"table-representation",ans:a,a:"default-row-style-name"},{ens:u,en:"table-row",ans:u,a:"style-name"}],"table-cell":[{ens:a,en:"column",ans:a,a:"default-cell-style-name"},{ens:u,en:"table-column",ans:u,a:"default-cell-style-name"},{ens:u,en:"table-row",ans:u,a:"default-cell-style-name"},{ens:u,en:"body",ans:u,a:"style-name"},
{ens:u,en:"covered-table-cell",ans:u,a:"style-name"},{ens:u,en:"even-columns",ans:u,a:"style-name"},{ens:u,en:"covered-table-cell",ans:u,a:"style-name"},{ens:u,en:"even-columns",ans:u,a:"style-name"},{ens:u,en:"even-rows",ans:u,a:"style-name"},{ens:u,en:"first-column",ans:u,a:"style-name"},{ens:u,en:"first-row",ans:u,a:"style-name"},{ens:u,en:"last-column",ans:u,a:"style-name"},{ens:u,en:"last-row",ans:u,a:"style-name"},{ens:u,en:"odd-columns",ans:u,a:"style-name"},{ens:u,en:"odd-rows",ans:u,a:"style-name"},
{ens:u,en:"table-cell",ans:u,a:"style-name"}],graphic:[{ens:m,en:"cube",ans:g,a:"style-name"},{ens:m,en:"extrude",ans:g,a:"style-name"},{ens:m,en:"rotate",ans:g,a:"style-name"},{ens:m,en:"scene",ans:g,a:"style-name"},{ens:m,en:"sphere",ans:g,a:"style-name"},{ens:g,en:"caption",ans:g,a:"style-name"},{ens:g,en:"circle",ans:g,a:"style-name"},{ens:g,en:"connector",ans:g,a:"style-name"},{ens:g,en:"control",ans:g,a:"style-name"},{ens:g,en:"custom-shape",ans:g,a:"style-name"},{ens:g,en:"ellipse",ans:g,a:"style-name"},
{ens:g,en:"frame",ans:g,a:"style-name"},{ens:g,en:"g",ans:g,a:"style-name"},{ens:g,en:"line",ans:g,a:"style-name"},{ens:g,en:"measure",ans:g,a:"style-name"},{ens:g,en:"page-thumbnail",ans:g,a:"style-name"},{ens:g,en:"path",ans:g,a:"style-name"},{ens:g,en:"polygon",ans:g,a:"style-name"},{ens:g,en:"polyline",ans:g,a:"style-name"},{ens:g,en:"rect",ans:g,a:"style-name"},{ens:g,en:"regular-polygon",ans:g,a:"style-name"},{ens:z,en:"annotation",ans:g,a:"style-name"}],presentation:[{ens:m,en:"cube",ans:y,
a:"style-name"},{ens:m,en:"extrude",ans:y,a:"style-name"},{ens:m,en:"rotate",ans:y,a:"style-name"},{ens:m,en:"scene",ans:y,a:"style-name"},{ens:m,en:"sphere",ans:y,a:"style-name"},{ens:g,en:"caption",ans:y,a:"style-name"},{ens:g,en:"circle",ans:y,a:"style-name"},{ens:g,en:"connector",ans:y,a:"style-name"},{ens:g,en:"control",ans:y,a:"style-name"},{ens:g,en:"custom-shape",ans:y,a:"style-name"},{ens:g,en:"ellipse",ans:y,a:"style-name"},{ens:g,en:"frame",ans:y,a:"style-name"},{ens:g,en:"g",ans:y,a:"style-name"},
{ens:g,en:"line",ans:y,a:"style-name"},{ens:g,en:"measure",ans:y,a:"style-name"},{ens:g,en:"page-thumbnail",ans:y,a:"style-name"},{ens:g,en:"path",ans:y,a:"style-name"},{ens:g,en:"polygon",ans:y,a:"style-name"},{ens:g,en:"polyline",ans:y,a:"style-name"},{ens:g,en:"rect",ans:y,a:"style-name"},{ens:g,en:"regular-polygon",ans:y,a:"style-name"},{ens:z,en:"annotation",ans:y,a:"style-name"}],"drawing-page":[{ens:g,en:"page",ans:g,a:"style-name"},{ens:y,en:"notes",ans:g,a:"style-name"},{ens:t,en:"handout-master",
ans:g,a:"style-name"},{ens:t,en:"master-page",ans:g,a:"style-name"}],"list-style":[{ens:w,en:"list",ans:w,a:"style-name"},{ens:w,en:"numbered-paragraph",ans:w,a:"style-name"},{ens:w,en:"list-item",ans:w,a:"style-override"},{ens:t,en:"style",ans:t,a:"list-style-name"}],data:[{ens:t,en:"style",ans:t,a:"data-style-name"},{ens:t,en:"style",ans:t,a:"percentage-data-style-name"},{ens:y,en:"date-time-decl",ans:t,a:"data-style-name"},{ens:w,en:"creation-date",ans:t,a:"data-style-name"},{ens:w,en:"creation-time",
ans:t,a:"data-style-name"},{ens:w,en:"database-display",ans:t,a:"data-style-name"},{ens:w,en:"date",ans:t,a:"data-style-name"},{ens:w,en:"editing-duration",ans:t,a:"data-style-name"},{ens:w,en:"expression",ans:t,a:"data-style-name"},{ens:w,en:"meta-field",ans:t,a:"data-style-name"},{ens:w,en:"modification-date",ans:t,a:"data-style-name"},{ens:w,en:"modification-time",ans:t,a:"data-style-name"},{ens:w,en:"print-date",ans:t,a:"data-style-name"},{ens:w,en:"print-time",ans:t,a:"data-style-name"},{ens:w,
en:"table-formula",ans:t,a:"data-style-name"},{ens:w,en:"time",ans:t,a:"data-style-name"},{ens:w,en:"user-defined",ans:t,a:"data-style-name"},{ens:w,en:"user-field-get",ans:t,a:"data-style-name"},{ens:w,en:"user-field-input",ans:t,a:"data-style-name"},{ens:w,en:"variable-get",ans:t,a:"data-style-name"},{ens:w,en:"variable-input",ans:t,a:"data-style-name"},{ens:w,en:"variable-set",ans:t,a:"data-style-name"}],"page-layout":[{ens:y,en:"notes",ans:t,a:"page-layout-name"},{ens:t,en:"handout-master",ans:t,
a:"page-layout-name"},{ens:t,en:"master-page",ans:t,a:"page-layout-name"}]},D,F=xmldom.XPath;this.collectUsedFontFaces=l;this.changeFontFaceNames=r;this.UsedStyleList=function(a,d){var c={};this.uses=function(a){var b=a.localName,d=a.getAttributeNS(g,"name")||a.getAttributeNS(t,"name");a="style"===b?a.getAttributeNS(t,"family"):a.namespaceURI===v?"data":b;return(a=c[a])?0<a[d]:!1};b(a,c);d&&s(d,c)};this.getStyleName=function(a,b){var d,c,g=D[b.localName];if(g&&(g=g[b.namespaceURI]))for(c=0;c<g.length;c+=
1)if(g[c].keyname===a&&(g=g[c],b.hasAttributeNS(g.ns,g.localname))){d=b.getAttributeNS(g.ns,g.localname);break}return d};this.hasDerivedStyles=function(a,b,d){var c=d.getAttributeNS(t,"name");d=d.getAttributeNS(t,"family");return F.getODFElementsWithXPath(a,"//style:*[@style:parent-style-name='"+c+"'][@style:family='"+d+"']",b).length?!0:!1};this.prefixStyleNames=function(a,b,d){var c;if(a){for(c=a.firstChild;c;){if(c.nodeType===Node.ELEMENT_NODE){var e=c,m=b,h=e.getAttributeNS(g,"name"),l=void 0;
h?l=g:(h=e.getAttributeNS(t,"name"))&&(l=t);l&&e.setAttributeNS(l,B[l]+"name",m+h)}c=c.nextSibling}f(a,b);d&&f(d,b)}};this.removePrefixFromStyleNames=function(a,b,d){var c=RegExp("^"+b);if(a){for(b=a.firstChild;b;){if(b.nodeType===Node.ELEMENT_NODE){var e=b,m=c,f=e.getAttributeNS(g,"name"),h=void 0;f?h=g:(f=e.getAttributeNS(t,"name"))&&(h=t);h&&(f=f.replace(m,""),e.setAttributeNS(h,B[h]+"name",f))}b=b.nextSibling}k(a,c);d&&k(d,c)}};this.determineStylesForNode=c;D=function(){var a,b,d,c,g,e={},m,f,
h,l;for(d in I)if(I.hasOwnProperty(d))for(c=I[d],b=c.length,a=0;a<b;a+=1)g=c[a],h=g.en,l=g.ens,e.hasOwnProperty(h)?m=e[h]:e[h]=m={},m.hasOwnProperty(l)?f=m[l]:m[l]=f=[],f.push({ns:g.ans,localname:g.a,keyname:d});return e}()};"function"!==typeof Object.create&&(Object.create=function(f){var k=function(){};k.prototype=f;return new k});
xmldom.LSSerializer=function(){function f(b){var c=b||{},f=function(b){var d={},a;for(a in b)b.hasOwnProperty(a)&&(d[b[a]]=a);return d}(b),n=[c],k=[f],l=0;this.push=function(){l+=1;c=n[l]=Object.create(c);f=k[l]=Object.create(f)};this.pop=function(){n.pop();k.pop();l-=1;c=n[l];f=k[l]};this.getLocalNamespaceDefinitions=function(){return f};this.getQName=function(b){var d=b.namespaceURI,a=0,e;if(!d)return b.localName;if(e=f[d])return e+":"+b.localName;do{e||!b.prefix?(e="ns"+a,a+=1):e=b.prefix;if(c[e]===
d)break;if(!c[e]){c[e]=d;f[d]=e;break}e=null}while(null===e);return e+":"+b.localName}}function k(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")}function c(e,f){var h="",n=b.filter?b.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,s;if(n===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){e.push();s=e.getQName(f);var l,r=f.attributes,d,a,m,g="",x;l="<"+s;d=r.length;for(a=0;a<d;a+=1)m=r.item(a),"http://www.w3.org/2000/xmlns/"!==
m.namespaceURI&&(x=b.filter?b.filter.acceptNode(m):NodeFilter.FILTER_ACCEPT,x===NodeFilter.FILTER_ACCEPT&&(x=e.getQName(m),m="string"===typeof m.value?k(m.value):m.value,g+=" "+(x+'="'+m+'"')));d=e.getLocalNamespaceDefinitions();for(a in d)d.hasOwnProperty(a)&&((r=d[a])?"xmlns"!==r&&(l+=" xmlns:"+d[a]+'="'+a+'"'):l+=' xmlns="'+a+'"');h+=l+(g+">")}if(n===NodeFilter.FILTER_ACCEPT||n===NodeFilter.FILTER_SKIP){for(n=f.firstChild;n;)h+=c(e,n),n=n.nextSibling;f.nodeValue&&(h+=k(f.nodeValue))}s&&(h+="</"+
s+">",e.pop());return h}var b=this;this.filter=null;this.writeToString=function(b,p){if(!b)return"";var h=new f(p);return c(h,b)}};(function(){function f(b){var d,a=n.length;for(d=0;d<a;d+=1)if("urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&b.localName===n[d])return d;return-1}function k(b,d){var a=new e.UsedStyleList(b,d),c=new odf.OdfNodeFilter;this.acceptNode=function(b){var e=c.acceptNode(b);e===NodeFilter.FILTER_ACCEPT&&b.parentNode===d&&b.nodeType===Node.ELEMENT_NODE&&(e=a.uses(b)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);return e}}function c(b,d){var a=new k(b,d);this.acceptNode=function(b){var d=
a.acceptNode(b);d!==NodeFilter.FILTER_ACCEPT||!b.parentNode||b.parentNode.namespaceURI!==odf.Namespaces.textns||"s"!==b.parentNode.localName&&"tab"!==b.parentNode.localName||(d=NodeFilter.FILTER_REJECT);return d}}function b(b,d){if(d){var a=f(d),c,g=b.firstChild;if(-1!==a){for(;g;){c=f(g);if(-1!==c&&c>a)break;g=g.nextSibling}b.insertBefore(d,g)}}}var e=new odf.StyleInfo,p=new core.DomUtils,h=odf.Namespaces.stylens,n="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),
s=Date.now()+"_webodf_",l=new core.Base64;odf.ODFElement=function(){};odf.ODFDocumentElement=function(){};odf.ODFDocumentElement.prototype=new odf.ODFElement;odf.ODFDocumentElement.prototype.constructor=odf.ODFDocumentElement;odf.ODFDocumentElement.prototype.fontFaceDecls=null;odf.ODFDocumentElement.prototype.manifest=null;odf.ODFDocumentElement.prototype.settings=null;odf.ODFDocumentElement.namespaceURI="urn:oasis:names:tc:opendocument:xmlns:office:1.0";odf.ODFDocumentElement.localName="document";
odf.AnnotationElement=function(){};odf.OdfPart=function(b,d,a,c){var g=this;this.size=0;this.type=null;this.name=b;this.container=a;this.url=null;this.mimetype=d;this.onstatereadychange=this.document=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.data="";this.load=function(){null!==c&&(this.mimetype=d,c.loadAsDataURL(b,d,function(a,b){a&&runtime.log(a);g.url=b;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))}};odf.OdfPart.prototype.load=function(){};
odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+l.toBase64(this.data):null};odf.OdfContainer=function d(a,f){function g(a){for(var b=a.firstChild,d;b;)d=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?g(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=d}function n(a){var b={},d,c,g=a.ownerDocument.createNodeIterator(a,NodeFilter.SHOW_ELEMENT,null,!1);for(a=g.nextNode();a;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&("annotation"===
a.localName?(d=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(b.hasOwnProperty(d)?runtime.log("Warning: annotation name used more than once with <office:annotation/>: '"+d+"'"):b[d]=a):"annotation-end"===a.localName&&((d=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?b.hasOwnProperty(d)?(c=b[d],c.annotationEndElement?runtime.log("Warning: annotation name used more than once with <office:annotation-end/>: '"+d+"'"):c.annotationEndElement=
a):runtime.log("Warning: annotation end without an annotation start, name: '"+d+"'"):runtime.log("Warning: annotation end without a name found"))),a=g.nextNode()}function v(a,b){for(var d=a&&a.firstChild;d;)d.nodeType===Node.ELEMENT_NODE&&d.setAttributeNS("urn:webodf:names:scope","scope",b),d=d.nextSibling}function z(a,b){for(var d=M.rootElement.meta,d=d&&d.firstChild;d&&(d.namespaceURI!==a||d.localName!==b);)d=d.nextSibling;for(d=d&&d.firstChild;d&&d.nodeType!==Node.TEXT_NODE;)d=d.nextSibling;return d?
d.data:null}function y(a){var b={},d;for(a=a.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&a.namespaceURI===h&&"font-face"===a.localName&&(d=a.getAttributeNS(h,"name"),b[d]=a),a=a.nextSibling;return b}function t(a,b){var d=null,c,g,e;if(a)for(d=a.cloneNode(!0),c=d.firstElementChild;c;)g=c.nextElementSibling,(e=c.getAttributeNS("urn:webodf:names:scope","scope"))&&e!==b&&d.removeChild(c),c=g;return d}function u(a,b){var d,c,g,q=null,f={};if(a)for(b.forEach(function(a){e.collectUsedFontFaces(f,a)}),
q=a.cloneNode(!0),d=q.firstElementChild;d;)c=d.nextElementSibling,g=d.getAttributeNS(h,"name"),f[g]||q.removeChild(d),d=c;return q}function w(a){var b=M.rootElement.ownerDocument,d;if(a){g(a.documentElement);try{d=b.importNode(a.documentElement,!0)}catch(c){}}return d}function B(a){M.state=a;if(M.onchange)M.onchange(M);if(M.onstatereadychange)M.onstatereadychange(M)}function I(a){ia=null;M.rootElement=a;a.fontFaceDecls=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");
a.styles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");a.automaticStyles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");a.masterStyles=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");a.body=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");a.meta=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");a.settings=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"settings");a.scripts=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");n(a)}function D(a){var c=w(a),g=M.rootElement,q;c&&"document-styles"===c.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===c.namespaceURI?(g.fontFaceDecls=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),b(g,g.fontFaceDecls),q=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=q||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"styles"),b(g,g.styles),q=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=q||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),v(g.automaticStyles,"document-styles"),b(g,g.automaticStyles),c=p.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=c||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),b(g,g.masterStyles),
e.prefixStyleNames(g.automaticStyles,s,g.masterStyles)):B(d.INVALID)}function F(a){a=w(a);var c,g,q,f;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){c=M.rootElement;q=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(c.fontFaceDecls&&q){f=c.fontFaceDecls;var m,l,n,k,s={};g=y(f);k=y(q);for(q=q.firstElementChild;q;){m=q.nextElementSibling;if(q.namespaceURI===h&&"font-face"===q.localName)if(l=q.getAttributeNS(h,
"name"),g.hasOwnProperty(l)){if(!q.isEqualNode(g[l])){n=l;for(var D=g,N=k,t=0,x=void 0,x=n=n.replace(/\d+$/,"");D.hasOwnProperty(x)||N.hasOwnProperty(x);)t+=1,x=n+t;n=x;q.setAttributeNS(h,"style:name",n);f.appendChild(q);g[n]=q;delete k[l];s[l]=n}}else f.appendChild(q),g[l]=q,delete k[l];q=m}f=s}else q&&(c.fontFaceDecls=q,b(c,q));g=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");v(g,"document-content");f&&e.changeFontFaceNames(g,f);if(c.automaticStyles&&g)for(f=
g.firstChild;f;)c.automaticStyles.appendChild(f),f=g.firstChild;else g&&(c.automaticStyles=g,b(c,g));a=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw"<office:body/> tag is mising.";c.body=a;b(c,c.body)}else B(d.INVALID)}function q(a){a=w(a);var d;a&&"document-meta"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=M.rootElement,d.meta=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),
b(d,d.meta))}function Q(a){a=w(a);var d;a&&"document-settings"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=M.rootElement,d.settings=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),b(d,d.settings))}function N(a){a=w(a);var b;if(a&&"manifest"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===a.namespaceURI)for(b=M.rootElement,b.manifest=a,a=b.manifest.firstElementChild;a;)"file-entry"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===
a.namespaceURI&&(Z[a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),a=a.nextElementSibling}function U(a,b,d){a=p.getElementsByTagName(a,b);var c;for(c=0;c<a.length;c+=1)b=a[c],d.hasOwnProperty(b.namespaceURI)||b.parentNode.removeChild(b)}function C(a){U(a,"script",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:office:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:table:1.0":!0,
"urn:oasis:names:tc:opendocument:xmlns:text:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0":!0});U(a,"style",{"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0":!0,"urn:oasis:names:tc:opendocument:xmlns:style:1.0":!0})}function $(a){var b=a.firstElementChild,d=[],c,g,e,q=a.attributes,f=q.length;for(c=0;c<f;c+=1)e=q.item(c),g=e.localName.substr(0,2).toLowerCase(),null===e.namespaceURI&&"on"===g&&d.push(e);f=d.length;for(c=
0;c<f;c+=1)a.removeAttributeNode(d[c]);for(;b;)$(b),b=b.nextElementSibling}function S(a){var b=a.shift();b?T.loadAsDOM(b.path,function(c,g){g&&(C(g),$(g.documentElement));b.handler(g);M.state===d.INVALID?c?runtime.log("ERROR: Unable to load "+b.path+" - "+c):runtime.log("ERROR: Unable to load "+b.path):(c&&runtime.log("DEBUG: Unable to load "+b.path+" - "+c),S(a))}):(n(M.rootElement),B(d.DONE))}function H(a){var b="";odf.Namespaces.forEachPrefix(function(a,d){b+=" xmlns:"+a+'="'+d+'"'});return'<?xml version="1.0" encoding="UTF-8"?><office:'+
a+" "+b+' office:version="1.2">'}function Y(){var a=new xmldom.LSSerializer,b=H("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(M.rootElement.meta,odf.Namespaces.namespaceMap);return b+"</office:document-meta>"}function aa(a,b){var d=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");d.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",a);d.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
"manifest:media-type",b);return d}function W(){var a=runtime.parseXML('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"></manifest:manifest>'),b=a.documentElement,d=new xmldom.LSSerializer,c;for(c in Z)Z.hasOwnProperty(c)&&b.appendChild(aa(c,Z[c]));d.filter=new odf.OdfNodeFilter;return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+d.writeToString(a,odf.Namespaces.namespaceMap)}function E(){var a,b,d,c=odf.Namespaces.namespaceMap,
g=new xmldom.LSSerializer,q=H("document-styles");b=t(M.rootElement.automaticStyles,"document-styles");d=M.rootElement.masterStyles.cloneNode(!0);a=u(M.rootElement.fontFaceDecls,[d,M.rootElement.styles,b]);e.removePrefixFromStyleNames(b,s,d);g.filter=new k(d,b);q+=g.writeToString(a,c);q+=g.writeToString(M.rootElement.styles,c);q+=g.writeToString(b,c);q+=g.writeToString(d,c);return q+"</office:document-styles>"}function G(){var a,b,d=odf.Namespaces.namespaceMap,g=new xmldom.LSSerializer,e=H("document-content");
b=t(M.rootElement.automaticStyles,"document-content");a=u(M.rootElement.fontFaceDecls,[b]);g.filter=new c(M.rootElement.body,b);e+=g.writeToString(a,d);e+=g.writeToString(b,d);e+=g.writeToString(M.rootElement.body,d);return e+"</office:document-content>"}function O(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else if(c){C(c);$(c.documentElement);var g=w(c);g&&"document"===g.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===g.namespaceURI?(I(g),B(d.DONE)):B(d.INVALID)}else b("No DOM was loaded.")})}
function A(a,d){var c;c=M.rootElement;var g=c.meta;g||(c.meta=g=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),b(c,g));c=g;a&&p.mapKeyValObjOntoNode(c,a,odf.Namespaces.lookupNamespaceURI);d&&p.removeKeyElementsFromNode(c,d,odf.Namespaces.lookupNamespaceURI)}function P(a){function b(a,d){var c;d||(d=a);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",d);e[a]=c;e.appendChild(c)}var c=new core.Zip("",null),g=runtime.byteArrayFromString("application/vnd.oasis.opendocument."+
a,"utf8"),e=M.rootElement,q=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);c.save("mimetype",g,!1,new Date);b("meta");b("settings");b("scripts");b("fontFaceDecls","font-face-decls");b("styles");b("automaticStyles","automatic-styles");b("masterStyles","master-styles");b("body");e.body.appendChild(q);Z["/"]="application/vnd.oasis.opendocument."+a;Z["settings.xml"]="text/xml";Z["meta.xml"]="text/xml";Z["styles.xml"]="text/xml";Z["content.xml"]="text/xml";B(d.DONE);return c}
function J(){var a,b=new Date,d="";M.rootElement.settings&&M.rootElement.settings.firstElementChild&&(a=new xmldom.LSSerializer,d=H("document-settings"),a.filter=new odf.OdfNodeFilter,d+=a.writeToString(M.rootElement.settings,odf.Namespaces.namespaceMap),d+="</office:document-settings>");(a=d)?(a=runtime.byteArrayFromString(a,"utf8"),T.save("settings.xml",a,!0,b)):T.remove("settings.xml");d=runtime.getWindow();a="WebODF/"+webodf.Version;d&&(a=a+" "+d.navigator.userAgent);A({"meta:generator":a},null);
a=runtime.byteArrayFromString(Y(),"utf8");T.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(E(),"utf8");T.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(G(),"utf8");T.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(W(),"utf8");T.save("META-INF/manifest.xml",a,!0,b)}function X(a,b){J();T.writeAs(a,function(a){b(a)})}var M=this,T,Z={},ia,ba="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=z;this.setRootElement=I;this.getContentElement=function(){var a;
ia||(a=M.rootElement.body,ia=p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||p.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!ia)throw"Could not find content element in <office:body/>.";return ia};this.getDocumentType=function(){var a=M.getContentElement();return a&&a.localName};this.getPart=function(a){return new odf.OdfPart(a,Z[a],M,T)};this.getPartData=
function(a,b){T.load(a,b)};this.setMetadata=A;this.incrementEditingCycles=function(){var a=z(odf.Namespaces.metans,"editing-cycles"),a=a?parseInt(a,10):0;isNaN(a)&&(a=0);A({"meta:editing-cycles":a+1},null);return a+1};this.createByteArray=function(a,b){J();T.createByteArray(a,b)};this.saveAs=X;this.save=function(a){X(ba,a)};this.getUrl=function(){return ba};this.setBlob=function(a,b,d){d=l.convertBase64ToByteArray(d);T.save(a,d,!1,new Date);Z.hasOwnProperty(a)&&runtime.log(a+" has been overwritten.");
Z[a]=b};this.removeBlob=function(a){var b=T.remove(a);runtime.assert(b,"file is not found: "+a);delete Z[a]};this.state=d.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),d;a=new a.Type;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});a===odf.OdfContainer.DocumentType.TEXT?T=P("text"):a===odf.OdfContainer.DocumentType.PRESENTATION?
T=P("presentation"):a===odf.OdfContainer.DocumentType.SPREADSHEET?T=P("spreadsheet"):(ba=a,T=new core.Zip(ba,function(a,b){T=b;a?O(ba,function(b){a&&(T.error=a+"\n"+b,B(d.INVALID))}):S([{path:"styles.xml",handler:D},{path:"content.xml",handler:F},{path:"meta.xml",handler:q},{path:"settings.xml",handler:Q},{path:"META-INF/manifest.xml",handler:N}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=
5;odf.OdfContainer.getContainer=function(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,PRESENTATION:2,SPREADSHEET:3};odf.OdfUtils=function(){function f(a){return"image"===(a&&a.localName)&&a.namespaceURI===$}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===$&&"as-char"===a.getAttributeNS(C,"anchor-type")}function c(a){var b;(b="annotation"===(a&&a.localName)&&a.namespaceURI===odf.Namespaces.officens)||(b="div"===(a&&a.localName)&&"annotationWrapper"===a.className);return b}function b(a){return"a"===(a&&a.localName)&&a.namespaceURI===C}function e(a){var b=a&&
a.localName;return("p"===b||"h"===b)&&a.namespaceURI===C}function p(a,b){for(a&&void 0!==b&&!e(a)&&a.childNodes.item(b)&&(a=a.childNodes.item(b));a&&!e(a);)a=a.parentNode;return a}function h(a,b){for(;a&&a!==b;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function n(a){return/^[ \t\r\n]+$/.test(a)}function s(a){if(null===a||a.nodeType!==Node.ELEMENT_NODE)return!1;var b=a.localName;return/^(span|p|h|a|meta)$/.test(b)&&a.namespaceURI===
C||"span"===b&&"webodf-annotationHighlight"===a.className}function l(a){var b=a&&a.localName,d=!1;b&&(a=a.namespaceURI,a===C&&(d="s"===b||"tab"===b||"line-break"===b));return d}function r(a){return l(a)||k(a)||c(a)}function d(a){var b=a&&a.localName,d=!1;b&&(a=a.namespaceURI,a===C&&(d="s"===b));return d}function a(a){return-1!==Y.indexOf(a.namespaceURI)}function m(b){if(l(b))return!1;if(s(b.parentNode)&&b.nodeType===Node.TEXT_NODE)return 0===b.textContent.length;for(b=b.firstChild;b;){if(a(b)||!m(b))return!1;
b=b.nextSibling}return!0}function g(a){for(;null!==a.firstChild&&s(a);)a=a.firstChild;return a}function x(a){for(;null!==a.lastChild&&s(a);)a=a.lastChild;return a}function v(a){for(;!e(a)&&null===a.previousSibling;)a=a.parentNode;return e(a)?null:x(a.previousSibling)}function z(a){for(;!e(a)&&null===a.nextSibling;)a=a.parentNode;return e(a)?null:g(a.nextSibling)}function y(a){for(var b=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=v(a);else return!n(a.data.substr(a.length-1,1));else r(a)?
(b=!1===d(a),a=null):a=v(a);return b}function t(a){var b=!1,d;for(a=a&&g(a);a;){d=a.nodeType===Node.TEXT_NODE?a.length:0;if(0<d&&!n(a.data)){b=!0;break}if(r(a)){b=!0;break}a=z(a)}return b}function u(a,b){return n(a.data.substr(b))?!t(z(a)):!1}function w(a,b){var d=a.data,c;if(!n(d[b])||r(a.parentNode))return!1;0<b?n(d[b-1])||(c=!0):y(v(a))&&(c=!0);return!0===c?u(a,b)?!1:!0:!1}function B(a){return(a=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px)|(%))/.exec(a))?
{value:parseFloat(a[1]),unit:a[3]}:null}function I(a){return(a=B(a))&&(0>a.value||"%"===a.unit)?null:a}function D(a){return(a=B(a))&&"%"!==a.unit?null:a}function F(a){switch(a.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(a.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(a.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(a.localName){case "cursor":case "editinfo":return!1}}return!0}
function q(a,b){for(;0<b.length&&!H.rangeContainsNode(a,b[0]);)b.shift();for(;0<b.length&&!H.rangeContainsNode(a,b[b.length-1]);)b.pop()}function Q(a,b,d){var g;g=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;if(l(a.parentNode)||c(a))b=NodeFilter.FILTER_REJECT;else if(a.nodeType===Node.TEXT_NODE){if(d||Boolean(p(a)&&(!n(a.textContent)||w(a,0))))b=NodeFilter.FILTER_ACCEPT}else if(r(a))b=NodeFilter.FILTER_ACCEPT;else if(F(a)||s(a))b=NodeFilter.FILTER_SKIP;return b},NodeFilter.SHOW_ELEMENT|
NodeFilter.SHOW_TEXT);b||q(a,g);return g}function N(a,b,d){for(;a;){if(d(a)){b[0]!==a&&b.unshift(a);break}if(c(a))break;a=a.parentNode}}function U(a,b){var d=a;if(b<d.childNodes.length-1)d=d.childNodes[b+1];else{for(;!d.nextSibling;)d=d.parentNode;d=d.nextSibling}for(;d.firstChild;)d=d.firstChild;return d}var C=odf.Namespaces.textns,$=odf.Namespaces.drawns,S=odf.Namespaces.xlinkns,H=new core.DomUtils,Y=[odf.Namespaces.dbns,odf.Namespaces.dcns,odf.Namespaces.dr3dns,odf.Namespaces.drawns,odf.Namespaces.chartns,
odf.Namespaces.formns,odf.Namespaces.numberns,odf.Namespaces.officens,odf.Namespaces.presentationns,odf.Namespaces.stylens,odf.Namespaces.svgns,odf.Namespaces.tablens,odf.Namespaces.textns];this.isImage=f;this.isCharacterFrame=k;this.isInlineRoot=c;this.isTextSpan=function(a){return"span"===(a&&a.localName)&&a.namespaceURI===C};this.isHyperlink=b;this.getHyperlinkTarget=function(a){return a.getAttributeNS(S,"href")||""};this.isParagraph=e;this.getParagraphElement=p;this.isWithinTrackedChanges=function(a,
b){for(;a&&a!==b;){if(a.namespaceURI===C&&"tracked-changes"===a.localName)return!0;a=a.parentNode}return!1};this.getParentAnnotation=h;this.isWithinAnnotation=function(a,b){return Boolean(h(a,b))};this.getAnnotationCreator=function(a){return a.getElementsByTagNameNS(odf.Namespaces.dcns,"creator")[0].textContent};this.isListItem=function(a){return"list-item"===(a&&a.localName)&&a.namespaceURI===C};this.isLineBreak=function(a){return"line-break"===(a&&a.localName)&&a.namespaceURI===C};this.isODFWhitespace=
n;this.isGroupingElement=s;this.isCharacterElement=l;this.isAnchoredAsCharacterElement=r;this.isSpaceElement=d;this.isODFNode=a;this.hasNoODFContent=m;this.firstChild=g;this.lastChild=x;this.previousNode=v;this.nextNode=z;this.scanLeftForNonSpace=y;this.lookLeftForCharacter=function(a){var b,d=b=0;a.nodeType===Node.TEXT_NODE&&(d=a.length);0<d?(b=a.data,b=n(b.substr(d-1,1))?1===d?y(v(a))?2:0:n(b.substr(d-2,1))?0:2:1):r(a)&&(b=1);return b};this.lookRightForCharacter=function(a){var b=!1,d=0;a&&a.nodeType===
Node.TEXT_NODE&&(d=a.length);0<d?b=!n(a.data.substr(0,1)):r(a)&&(b=!0);return b};this.scanLeftForAnyCharacter=function(a){var b=!1,d;for(a=a&&x(a);a;){d=a.nodeType===Node.TEXT_NODE?a.length:0;if(0<d&&!n(a.data)){b=!0;break}if(r(a)){b=!0;break}a=v(a)}return b};this.scanRightForAnyCharacter=t;this.isTrailingWhitespace=u;this.isSignificantWhitespace=w;this.isDowngradableSpaceElement=function(a){return d(a)?y(v(a))&&t(z(a)):!1};this.parseLength=B;this.parseNonNegativeLength=I;this.parseFoFontSize=function(a){var b;
b=(b=B(a))&&(0>=b.value||"%"===b.unit)?null:b;return b||D(a)};this.parseFoLineHeight=function(a){return I(a)||D(a)};this.isTextContentContainingNode=F;this.getTextNodes=function(a,b){var d;d=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;a.nodeType===Node.TEXT_NODE?Boolean(p(a)&&(!n(a.textContent)||w(a,0)))&&(b=NodeFilter.FILTER_ACCEPT):F(a)&&(b=NodeFilter.FILTER_SKIP);return b},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);b||q(a,d);return d};this.getTextElements=Q;this.getParagraphElements=
function(a){var b;b=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;if(e(a))b=NodeFilter.FILTER_ACCEPT;else if(F(a)||s(a))b=NodeFilter.FILTER_SKIP;return b},NodeFilter.SHOW_ELEMENT);N(a.startContainer,b,e);return b};this.getImageElements=function(a){var b;b=H.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_SKIP;f(a)&&(b=NodeFilter.FILTER_ACCEPT);return b},NodeFilter.SHOW_ELEMENT);N(a.startContainer,b,f);return b};this.getHyperlinkElements=function(a){var d=[],c=a.cloneRange();
a.collapsed&&a.endContainer.nodeType===Node.ELEMENT_NODE&&(a=U(a.endContainer,a.endOffset),a.nodeType===Node.TEXT_NODE&&c.setEnd(a,1));Q(c,!0,!1).forEach(function(a){for(a=a.parentNode;!e(a);){if(b(a)&&-1===d.indexOf(a)){d.push(a);break}a=a.parentNode}});c.detach();return d};this.getNormalizedFontFamilyName=function(a){/^(["'])(?:.|[\n\r])*?\1$/.test(a)||(a=a.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(a)&&(a="'"+a.replace(/[ \t\r\n\f]+/g," ")+"'"));return a}};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){};
gui.AnnotationViewManager=function(f,k,c,b){function e(b){var d=b.annotationEndElement,c=l.createRange(),e=b.getAttributeNS(odf.Namespaces.officens,"name");d&&(c.setStart(b,b.childNodes.length),c.setEnd(d,0),b=r.getTextNodes(c,!1),b.forEach(function(b){var d;a:{for(d=b.parentNode;d.namespaceURI!==odf.Namespaces.officens||"body"!==d.localName;){if(d.namespaceURI===a&&"webodf-annotationHighlight"===d.className&&d.getAttribute("annotation")===e){d=!0;break a}d=d.parentNode}d=!1}d||(d=l.createElement("span"),
d.className="webodf-annotationHighlight",d.setAttribute("annotation",e),b.parentNode.replaceChild(d,b),d.appendChild(b))}));c.detach()}function p(a){var b=f.getSizer();a?(c.style.display="inline-block",b.style.paddingRight=d.getComputedStyle(c).width):(c.style.display="none",b.style.paddingRight=0);f.refreshSize()}function h(){s.sort(function(a,b){return 0!==(a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function n(){var a;for(a=0;a<s.length;a+=1){var b=s[a],d=b.parentNode,
e=d.nextElementSibling,h=e.nextElementSibling,l=d.parentNode,n=0,n=s[s.indexOf(b)-1],p=void 0,b=f.getZoomLevel();d.style.left=(c.getBoundingClientRect().left-l.getBoundingClientRect().left)/b+"px";d.style.width=c.getBoundingClientRect().width/b+"px";e.style.width=parseFloat(d.style.left)-30+"px";n&&(p=n.parentNode.getBoundingClientRect(),20>=(l.getBoundingClientRect().top-p.bottom)/b?d.style.top=Math.abs(l.getBoundingClientRect().top-p.bottom)/b+20+"px":d.style.top="0px");h.style.left=e.getBoundingClientRect().width/
b+"px";var e=h.style,l=h.getBoundingClientRect().left/b,n=h.getBoundingClientRect().top/b,p=d.getBoundingClientRect().left/b,k=d.getBoundingClientRect().top/b,r=0,I=0,r=p-l,r=r*r,I=k-n,I=I*I,l=Math.sqrt(r+I);e.width=l+"px";n=Math.asin((d.getBoundingClientRect().top-h.getBoundingClientRect().top)/(b*parseFloat(h.style.width)));h.style.transform="rotate("+n+"rad)";h.style.MozTransform="rotate("+n+"rad)";h.style.WebkitTransform="rotate("+n+"rad)";h.style.msTransform="rotate("+n+"rad)"}}var s=[],l=k.ownerDocument,
r=new odf.OdfUtils,d=runtime.getWindow(),a="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(d),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=n;this.rehighlightAnnotations=function(){s.forEach(function(a){e(a)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==c.style.display&&0<s.length?(s[s.length-1].parentNode.getBoundingClientRect().bottom-c.getBoundingClientRect().top)/f.getZoomLevel()+"px":null};this.addAnnotation=
function(a){p(!0);s.push(a);h();var d=l.createElement("div"),c=l.createElement("div"),f=l.createElement("div"),k=l.createElement("div"),y;d.className="annotationWrapper";d.setAttribute("creator",r.getAnnotationCreator(a));a.parentNode.insertBefore(d,a);c.className="annotationNote";c.appendChild(a);b&&(y=l.createElement("div"),y.className="annotationRemoveButton",c.appendChild(y));f.className="annotationConnector horizontal";k.className="annotationConnector angular";d.appendChild(c);d.appendChild(f);
d.appendChild(k);a.annotationEndElement&&e(a);n()};this.forgetAnnotations=function(){for(;s.length;){var a=s[0],b=s.indexOf(a),d=a.parentNode.parentNode;"div"===d.localName&&(d.parentNode.insertBefore(a,d),d.parentNode.removeChild(d));for(var a=a.getAttributeNS(odf.Namespaces.officens,"name"),a=l.querySelectorAll('span.webodf-annotationHighlight[annotation="'+a+'"]'),c=d=void 0,d=0;d<a.length;d+=1){for(c=a.item(d);c.firstChild;)c.parentNode.insertBefore(c.firstChild,c);c.parentNode.removeChild(c)}-1!==
b&&s.splice(b,1);0===s.length&&p(!1)}}};(function(){function f(c,p,h,n,k){var l,r=0,d;for(d in c)if(c.hasOwnProperty(d)){if(r===h){l=d;break}r+=1}l?p.getPartData(c[l].href,function(a,d){if(a)runtime.log(a);else if(d){var g="@font-face { font-family: "+(c[l].family||l)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+b.convertUTF8ArrayToBase64(d)+') format("truetype"); }';try{n.insertRule(g,n.cssRules.length)}catch(r){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(r)+"\nRule: "+g)}}else runtime.log("missing font data for "+
c[l].href);f(c,p,h+1,n,k)}):k&&k()}var k=xmldom.XPath,c=new odf.OdfUtils,b=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(b,p){for(var h=b.rootElement.fontFaceDecls;p.cssRules.length;)p.deleteRule(p.cssRules.length-1);if(h){var n={},s,l,r,d;if(h)for(h=k.getODFElementsWithXPath(h,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),s=0;s<h.length;s+=1)l=h[s],r=l.getAttributeNS(odf.Namespaces.stylens,"name"),d=c.getNormalizedFontFamilyName(l.getAttributeNS(odf.Namespaces.svgns,
"font-family")),l=k.getODFElementsWithXPath(l,"svg:font-face-src/svg:font-face-uri",odf.Namespaces.lookupNamespaceURI),0<l.length&&(l=l[0].getAttributeNS(odf.Namespaces.xlinkns,"href"),n[r]={href:l,family:d});f(n,b,0,p)}}}})();odf.Formatting=function(){function f(a){return(a=B[a])?u.mergeObjects({},a):{}}function k(){for(var a=d.rootElement.fontFaceDecls,b={},c,e,a=a&&a.firstElementChild;a;){if(c=a.getAttributeNS(g,"name"))if((e=a.getAttributeNS(m,"font-family"))||0<a.getElementsByTagNameNS(m,"font-face-uri").length)b[c]=e;a=a.nextElementSibling}return b}function c(a){for(var b=d.rootElement.styles.firstElementChild;b;){if(b.namespaceURI===g&&"default-style"===b.localName&&b.getAttributeNS(g,"family")===a)return b;b=b.nextElementSibling}return null}
function b(a,b,c){var e,f,m;c=c||[d.rootElement.automaticStyles,d.rootElement.styles];for(m=0;m<c.length;m+=1)for(e=c[m],e=e.firstElementChild;e;){f=e.getAttributeNS(g,"name");if(e.namespaceURI===g&&"style"===e.localName&&e.getAttributeNS(g,"family")===b&&f===a||"list-style"===b&&e.namespaceURI===x&&"list-style"===e.localName&&f===a||"data"===b&&e.namespaceURI===v&&f===a)return e;e=e.nextElementSibling}return null}function e(a){for(var b,d,c,e,f={},m=a.firstElementChild;m;){if(m.namespaceURI===g)for(c=
f[m.nodeName]={},d=m.attributes,b=0;b<d.length;b+=1)e=d.item(b),c[e.name]=e.value;m=m.nextElementSibling}d=a.attributes;for(b=0;b<d.length;b+=1)e=d.item(b),f[e.name]=e.value;return f}function p(a,m){for(var h=d.rootElement.styles,q,l={},n=a.getAttributeNS(g,"family"),p=a;p;)q=e(p),l=u.mergeObjects(q,l),p=(q=p.getAttributeNS(g,"parent-style-name"))?b(q,n,[h]):null;if(p=c(n))q=e(p),l=u.mergeObjects(q,l);!1!==m&&(q=f(n),l=u.mergeObjects(q,l));return l}function h(b,d){function c(a){Object.keys(a).forEach(function(b){Object.keys(a[b]).forEach(function(a){m+=
"|"+b+":"+a+"|"})})}for(var g=b.nodeType===Node.TEXT_NODE?b.parentNode:b,e,f=[],m="",h=!1;g;)!h&&y.isGroupingElement(g)&&(h=!0),(e=a.determineStylesForNode(g))&&f.push(e),g=g.parentNode;h&&(f.forEach(c),d&&(d[m]=f));return h?f:void 0}function n(a){var c={orderedStyles:[],styleProperties:{}};a.forEach(function(a){Object.keys(a).forEach(function(e){var f=Object.keys(a[e])[0],m={name:f,family:e,displayName:void 0,isCommonStyle:!1},h;(h=b(f,e))?(e=p(h),c.styleProperties=u.mergeObjects(e,c.styleProperties),
m.displayName=h.getAttributeNS(g,"display-name")||void 0,m.isCommonStyle=h.parentNode===d.rootElement.styles):runtime.log("No style element found for '"+f+"' of family '"+e+"'");c.orderedStyles.push(m)})});return c}function s(a,b){var d={},c=[];b||(b={});a.forEach(function(a){h(a,d)});Object.keys(d).forEach(function(a){b[a]||(b[a]=n(d[a]));c.push(b[a])});return c}function l(a){for(var b=d.rootElement.masterStyles.firstElementChild;b&&(b.namespaceURI!==g||"master-page"!==b.localName||b.getAttributeNS(g,
"name")!==a);)b=b.nextElementSibling;return b}function r(a,b){var d;a&&(d=w.convertMeasure(a,"px"));void 0===d&&b&&(d=w.convertMeasure(b,"px"));return d}var d,a=new odf.StyleInfo,m=odf.Namespaces.svgns,g=odf.Namespaces.stylens,x=odf.Namespaces.textns,v=odf.Namespaces.numberns,z=odf.Namespaces.fons,y=new odf.OdfUtils,t=new core.DomUtils,u=new core.Utils,w=new core.CSSUnits,B={paragraph:{"style:paragraph-properties":{"fo:text-align":"left"}}};this.getSystemDefaultStyleAttributes=f;this.setOdfContainer=
function(a){d=a};this.getFontMap=k;this.getAvailableParagraphStyles=function(){for(var a=d.rootElement.styles,b,c,e=[],a=a&&a.firstElementChild;a;)"style"===a.localName&&a.namespaceURI===g&&(b=a.getAttributeNS(g,"family"),"paragraph"===b&&(b=a.getAttributeNS(g,"name"),c=a.getAttributeNS(g,"display-name")||b,b&&c&&e.push({name:b,displayName:c}))),a=a.nextElementSibling;return e};this.isStyleUsed=function(b){var c,g=d.rootElement;c=a.hasDerivedStyles(g,odf.Namespaces.lookupNamespaceURI,b);b=(new a.UsedStyleList(g.styles)).uses(b)||
(new a.UsedStyleList(g.automaticStyles)).uses(b)||(new a.UsedStyleList(g.body)).uses(b);return c||b};this.getDefaultStyleElement=c;this.getStyleElement=b;this.getStyleAttributes=e;this.getInheritedStyleAttributes=p;this.getFirstCommonParentStyleNameOrSelf=function(a){var c=d.rootElement.styles,e;if(e=b(a,"paragraph",[d.rootElement.automaticStyles]))if(a=e.getAttributeNS(g,"parent-style-name"),!a)return null;return(e=b(a,"paragraph",[c]))?a:null};this.hasParagraphStyle=function(a){return Boolean(b(a,
"paragraph"))};this.getAppliedStyles=s;this.getAppliedStylesForElement=function(a,b){return s([a],b)[0]};this.updateStyle=function(a,b){var c,e;t.mapObjOntoNode(a,b,odf.Namespaces.lookupNamespaceURI);(c=b["style:text-properties"]&&b["style:text-properties"]["style:font-name"])&&!k().hasOwnProperty(c)&&(e=a.ownerDocument.createElementNS(g,"style:font-face"),e.setAttributeNS(g,"style:name",c),e.setAttributeNS(m,"svg:font-family",c),d.rootElement.fontFaceDecls.appendChild(e))};this.createDerivedStyleObject=
function(a,c,g){var f=b(a,c);runtime.assert(Boolean(f),"No style element found for '"+a+"' of family '"+c+"'");a=f.parentNode===d.rootElement.styles?{"style:parent-style-name":a}:e(f);a["style:family"]=c;u.mergeObjects(a,g);return a};this.getDefaultTabStopDistance=function(){for(var a=c("paragraph"),a=a&&a.firstElementChild,b;a;)a.namespaceURI===g&&"paragraph-properties"===a.localName&&(b=a.getAttributeNS(g,"tab-stop-distance")),a=a.nextElementSibling;b||(b="1.25cm");return y.parseNonNegativeLength(b)};
this.getMasterPageElement=l;this.getContentSize=function(a,c){var e,f,m,h,n,p,k,s,x,v;a:{f=b(a,c);runtime.assert("paragraph"===c||"table"===c,"styleFamily must be either paragraph or table");if(f){if(f=f.getAttributeNS(g,"master-page-name"))(e=l(f))||runtime.log("WARN: No master page definition found for "+f);e||(e=l("Standard"));e||(e=d.rootElement.masterStyles.getElementsByTagNameNS(g,"master-page")[0])||runtime.log("WARN: Document has no master pages defined");if(e)for(f=e.getAttributeNS(g,"page-layout-name"),
m=t.getElementsByTagNameNS(d.rootElement.automaticStyles,g,"page-layout"),h=0;h<m.length;h+=1)if(e=m[h],e.getAttributeNS(g,"name")===f)break a}e=null}e||(e=t.getDirectChild(d.rootElement.styles,g,"default-page-layout"));(e=t.getDirectChild(e,g,"page-layout-properties"))?("landscape"===e.getAttributeNS(g,"print-orientation")?(f="29.7cm",m="21.001cm"):(f="21.001cm",m="29.7cm"),f=r(e.getAttributeNS(z,"page-width"),f),m=r(e.getAttributeNS(z,"page-height"),m),h=r(e.getAttributeNS(z,"margin")),void 0===
h?(h=r(e.getAttributeNS(z,"margin-left"),"2cm"),n=r(e.getAttributeNS(z,"margin-right"),"2cm"),p=r(e.getAttributeNS(z,"margin-top"),"2cm"),k=r(e.getAttributeNS(z,"margin-bottom"),"2cm")):h=n=p=k=h,s=r(e.getAttributeNS(z,"padding")),void 0===s?(s=r(e.getAttributeNS(z,"padding-left"),"0cm"),x=r(e.getAttributeNS(z,"padding-right"),"0cm"),v=r(e.getAttributeNS(z,"padding-top"),"0cm"),e=r(e.getAttributeNS(z,"padding-bottom"),"0cm")):s=x=v=e=s):(f=r("21.001cm"),m=r("29.7cm"),h=n=p=k=h=r("2cm"),s=x=v=e=s=
r("0cm"));return{width:f-h-n-s-x,height:m-p-k-v-e}}};(function(){var f=odf.Namespaces.stylens,k=odf.Namespaces.textns,c={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"};odf.StyleTreeNode=function(b){this.derivedStyles={};this.element=b};odf.StyleTree=function(b,e){function p(b){var d,a,c,g={};if(!b)return g;for(b=b.firstElementChild;b;){if(a=b.namespaceURI!==f||"style"!==b.localName&&
"default-style"!==b.localName?b.namespaceURI===k&&"list-style"===b.localName?"list":b.namespaceURI!==f||"page-layout"!==b.localName&&"default-page-layout"!==b.localName?void 0:"page":b.getAttributeNS(f,"family"))(d=b.getAttributeNS(f,"name"))||(d=""),g.hasOwnProperty(a)?c=g[a]:g[a]=c={},c[d]=b;b=b.nextElementSibling}return g}function h(b,d){if(b.hasOwnProperty(d))return b[d];var a=null,c=Object.keys(b),g;for(g=0;g<c.length&&!(a=h(b[c[g]].derivedStyles,d));g+=1);return a}function n(b,d,a){var c,g,
e;if(!d.hasOwnProperty(b))return null;c=new odf.StyleTreeNode(d[b]);g=c.element.getAttributeNS(f,"parent-style-name");e=null;g&&(e=h(a,g)||n(g,d,a));e?e.derivedStyles[b]=c:a[b]=c;delete d[b];return c}function s(b,d){b&&Object.keys(b).forEach(function(a){n(a,b,d)})}var l={};this.getStyleTree=function(){return l};(function(){var f,d,a;d=p(b);a=p(e);Object.keys(c).forEach(function(b){f=l[b]={};s(d[b],f);s(a[b],f)})})()}})();(function(){function f(b,c){try{b.insertRule(c,b.cssRules.length)}catch(e){runtime.log("cannot load rule: "+c+" - "+e)}}function k(b,c){this.listCounterCount=0;this.contentRules=b;this.counterIdStack=[];this.continuedCounterIdStack=c}function c(b){function c(a,g,e,h){var n=g.namespaceURI===p&&"list"===g.localName,k=g.namespaceURI===p&&"list-item"===g.localName;if(n||k){if(n){var n=e+=1,r,u,w;h.listCounterCount+=1;k=a+"-level"+n+"-"+h.listCounterCount;g.setAttributeNS("urn:webodf:names:helper","counter-id",
k);r=h.continuedCounterIdStack.shift();r||(r=k,d+=k+" 1 ",u='text|list[webodfhelper|counter-id="'+k+'"] > text|list-item:first-child > :not(text|list):first-child:before',u+="{",u+="counter-increment: "+r+" 0;",u+="}",f(b,u));for(;h.counterIdStack.length>=n;)h.counterIdStack.pop();h.counterIdStack.push(r);w=h.contentRules[n.toString()]||"";for(u=1;u<=n;u+=1)w=w.replace(u+"webodf-listLevel",h.counterIdStack[u-1]);u='text|list[webodfhelper|counter-id="'+k+'"] > text|list-item > :not(text|list):first-child:before';
u+="{";u+=w;u+="counter-increment: "+r+";";u+="}";f(b,u)}for(g=g.firstElementChild;g;)c(a,g,e,h),g=g.nextElementSibling}else h.continuedCounterIdStack=[]}var e=0,d="",a={};this.createCounterRules=function(b,d,f){var n=d.getAttributeNS(h,"id"),p=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),p=a[f].slice(0));b=new k(b,p);n?n="Y"+n:(e+=1,n="X"+e);c(n,d,0,b);a[n+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var a;a="office|document{"+("counter-reset: "+d+
";");a+="}";f(b,a)}}var b=odf.Namespaces.fons,e=odf.Namespaces.stylens,p=odf.Namespaces.textns,h=odf.Namespaces.xmlns,n={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function k(b){var d=m.parseLength(b);return d?a.convert(d.value,d.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function l(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function r(a,b){var d;a&&(d=a.getAttributeNS(p,"style-name"));return d===b}function d(a,
b,d){b=b.getElementsByTagNameNS(p,"list");a=new c(a);var f,m,k,s,w,B,I={},D;for(D=0;D<b.length;D+=1)if(f=b.item(D),B=f.getAttributeNS(p,"style-name")){k=f.getAttributeNS(p,"continue-numbering");s=f.getAttributeNS(p,"continue-list");(w=f.getAttributeNS(h,"id"))&&(I[w]=f);w=d[B].element.firstElementChild;for(var F=void 0,q={};w;){var F=(F=w.getAttributeNS(p,"level"))&&parseInt(F,10),Q=q,N=w,U="",C=void 0,$=void 0,S=C=void 0;if("list-level-style-number"===N.localName){var H=N,U=H.getAttributeNS(e,"num-format"),
C=H.getAttributeNS(e,"num-suffix")||"",$=H.getAttributeNS(e,"num-prefix")||"",Y="",aa=H.getAttributeNS(p,"level"),H=H.getAttributeNS(p,"display-levels");$&&(Y+='"'+l($)+'"\n');if(n.hasOwnProperty(U))for(aa=aa?parseInt(aa,10):1,H=H?parseInt(H,10):1;0<H;)Y+=" counter("+(aa-H+1)+"webodf-listLevel,"+n[U]+")",1<H&&(Y+='"."'),H-=1;else Y=U?Y+(' "'+U+'"'):Y+' ""';U="content:"+Y+' "'+l(C)+'"'}else"list-level-style-image"===N.localName?U="content: none":"list-level-style-bullet"===N.localName&&(U=N.getAttributeNS(p,
"bullet-char"),U='content: "'+l(U)+'"');if(C=N.getElementsByTagNameNS(e,"list-level-properties")[0])$=C.getAttributeNS(p,"list-level-position-and-space-mode"),"label-alignment"===$&&((C=C.getElementsByTagNameNS(e,"list-level-label-alignment")[0])&&(S=C.getAttributeNS(p,"label-followed-by")),"space"===S&&(U+=' "\\a0"'));Q[F]="\n"+U+";\n";w=w.nextElementSibling}w=q;k&&!s&&r(m,B)?a.createCounterRules(w,f,m):s&&r(I[s],B)?a.createCounterRules(w,f,I[s]):a.createCounterRules(w,f);m=f}a.initialiseCreatedCounters()}
var a=new core.CSSUnits,m=new odf.OdfUtils;this.applyListStyles=function(a,c,h){var m,l;(m=c.list)&&Object.keys(m).forEach(function(d){l=m[d];for(var c=l.element.firstElementChild;c;){if(c.namespaceURI===p){for(var h=a,n=c,r='text|list[text|style-name="'+d+'"]',D=n.getAttributeNS(p,"level"),x=void 0,q=void 0,v=q=void 0,N=void 0,U=void 0,C=x=void 0,$=void 0,S=void 0,H=void 0,N=void 0,v=(q=n.getElementsByTagNameNS(e,"list-level-properties")[0])&&q.getAttributeNS(p,"list-level-position-and-space-mode"),
N=q&&q.getElementsByTagNameNS(e,"list-level-label-alignment")[0],x=D=D&&parseInt(D,10);1<x;)r+=" > text|list-item > text|list",x-=1;x=q&&q.getAttributeNS(b,"text-align")||"left";switch(x){case "end":x="right";break;case "start":x="left"}"label-alignment"===v?(U=N&&N.getAttributeNS(b,"margin-left")||"0px",S=N&&N.getAttributeNS(b,"text-indent")||"0px",H=N&&N.getAttributeNS(p,"label-followed-by"),N=k(U)):(U=q&&q.getAttributeNS(p,"space-before")||"0px",C=q&&q.getAttributeNS(p,"min-label-width")||"0px",
$=q&&q.getAttributeNS(p,"min-label-distance")||"0px",N=k(U)+k(C));q=r+" > text|list-item";q+="{";q+="margin-left: "+N+"px;";q+="}";f(h,q);q=r+" > text|list-item > text|list";q+="{";q+="margin-left: "+-N+"px;";q+="}";f(h,q);q=r+" > text|list-item > :not(text|list):first-child:before";q+="{";q+="text-align: "+x+";";q+="display: inline-block;";"label-alignment"===v?(q+="margin-left: "+S+";","listtab"===H&&(q+="padding-right: 0.2cm;")):(q+="min-width: "+C+";",q+="margin-left: "+(0===parseFloat(C)?"":
"-")+C+";",q+="padding-right: "+$+";");q+="}";f(h,q)}c=c.nextElementSibling}});d(a,h,m)}}})();odf.Style2CSS=function(){function f(a,b,d){var c=[];d=d.derivedStyles;var e;var q=g[a],h;void 0===q?b=null:(h=b?"["+q+'|style-name="'+b+'"]':"","presentation"===q&&(q="draw",h=b?'[presentation|style-name="'+b+'"]':""),b=q+"|"+x[a].join(h+","+q+"|")+h);null!==b&&c.push(b);for(e in d)d.hasOwnProperty(e)&&(b=f(a,e,d[e]),c=c.concat(b));return c}function k(a,b){var d="",c,g,e;for(c=0;c<b.length;c+=1)if(g=b[c],e=a.getAttributeNS(g[0],g[1])){e=e.trim();if(q.hasOwnProperty(g[1])){var f=e.indexOf(" "),h=void 0,
m=void 0;-1!==f?(h=e.substring(0,f),m=e.substring(f)):(h=e,m="");(h=N.parseLength(h))&&"pt"===h.unit&&0.75>h.value&&(e="0.75pt"+m)}g[2]&&(d+=g[2]+":"+e+";")}return d}function c(a){return(a=m.getDirectChild(a,s,"text-properties"))?N.parseFoFontSize(a.getAttributeNS(h,"font-size")):null}function b(a,b,d,c){return b+b+d+d+c+c}function e(g,q,l,x){if("page"===q){var G=x.element;l="";var O,A;A=O="";var P=m.getDirectChild(G,s,"page-layout-properties"),J;if(P)if(J=G.getAttributeNS(s,"name"),l+=k(P,D),(O=
m.getDirectChild(P,s,"background-image"))&&(A=O.getAttributeNS(d,"href"))&&(l=l+("background-image: url('odfkit:"+A+"');")+k(O,z)),"presentation"===U)for(G=(G=m.getDirectChild(G.parentNode.parentNode,n,"master-styles"))&&G.firstElementChild;G;)G.namespaceURI===s&&"master-page"===G.localName&&G.getAttributeNS(s,"page-layout-name")===J&&(A=G.getAttributeNS(s,"name"),O="draw|page[draw|master-page-name="+A+"] {"+l+"}",A="office|body, draw|page[draw|master-page-name="+A+"] {"+k(P,F)+" }",g.insertRule(O,
g.cssRules.length),g.insertRule(A,g.cssRules.length)),G=G.nextElementSibling;else"text"===U&&(O="office|text {"+l+"}",A="office|body {width: "+P.getAttributeNS(h,"page-width")+";}",g.insertRule(O,g.cssRules.length),g.insertRule(A,g.cssRules.length))}else{l=f(q,l,x).join(",");P="";if(J=m.getDirectChild(x.element,s,"text-properties")){A=J;var X,M,G=X="";O=1;J=""+k(A,v);M=A.getAttributeNS(s,"text-underline-style");"solid"===M&&(X+=" underline");M=A.getAttributeNS(s,"text-line-through-style");"solid"===
M&&(X+=" line-through");X.length&&(J+="text-decoration:"+X+";");if(X=A.getAttributeNS(s,"font-name")||A.getAttributeNS(h,"font-family"))M=Q[X],J+="font-family: "+(M||X)+";";M=A.parentNode;if(A=c(M)){for(;M;){if(A=c(M)){if("%"!==A.unit){G="font-size: "+A.value*O+A.unit+";";break}O*=A.value/100}A=M;X=M="";M=null;"default-style"===A.localName?M=null:(M=A.getAttributeNS(s,"parent-style-name"),X=A.getAttributeNS(s,"family"),M=S.getODFElementsWithXPath(C,M?"//style:*[@style:name='"+M+"'][@style:family='"+
X+"']":"//style:default-style[@style:family='"+X+"']",odf.Namespaces.lookupNamespaceURI)[0])}G||(G="font-size: "+parseFloat($)*O+H.getUnits($)+";");J+=G}P+=J}if(J=m.getDirectChild(x.element,s,"paragraph-properties"))G=J,J=""+k(G,y),(O=m.getDirectChild(G,s,"background-image"))&&(A=O.getAttributeNS(d,"href"))&&(J=J+("background-image: url('odfkit:"+A+"');")+k(O,z)),(G=G.getAttributeNS(h,"line-height"))&&"normal"!==G&&(G=N.parseFoLineHeight(G),J="%"!==G.unit?J+("line-height: "+G.value+G.unit+";"):J+
("line-height: "+G.value/100+";")),P+=J;if(J=m.getDirectChild(x.element,s,"graphic-properties"))A=J,J=""+k(A,t),G=A.getAttributeNS(p,"opacity"),O=A.getAttributeNS(p,"fill"),A=A.getAttributeNS(p,"fill-color"),"solid"===O||"hatch"===O?A&&"none"!==A?(G=isNaN(parseFloat(G))?1:parseFloat(G)/100,O=A.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,b),(A=(O=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(O))?{r:parseInt(O[1],16),g:parseInt(O[2],16),b:parseInt(O[3],16)}:null)&&(J+="background-color: rgba("+A.r+
","+A.g+","+A.b+","+G+");")):J+="background: none;":"none"===O&&(J+="background: none;"),P+=J;if(J=m.getDirectChild(x.element,s,"drawing-page-properties"))G=""+k(J,t),"true"===J.getAttributeNS(a,"background-visible")&&(G+="background: none;"),P+=G;if(J=m.getDirectChild(x.element,s,"table-cell-properties"))J=""+k(J,u),P+=J;if(J=m.getDirectChild(x.element,s,"table-row-properties"))J=""+k(J,B),P+=J;if(J=m.getDirectChild(x.element,s,"table-column-properties"))J=""+k(J,w),P+=J;if(J=m.getDirectChild(x.element,
s,"table-properties"))G=J,J=""+k(G,I),G=G.getAttributeNS(r,"border-model"),"collapsing"===G?J+="border-collapse:collapse;":"separating"===G&&(J+="border-collapse:separate;"),P+=J;0!==P.length&&g.insertRule(l+"{"+P+"}",g.cssRules.length)}for(var T in x.derivedStyles)x.derivedStyles.hasOwnProperty(T)&&e(g,q,T,x.derivedStyles[T])}var p=odf.Namespaces.drawns,h=odf.Namespaces.fons,n=odf.Namespaces.officens,s=odf.Namespaces.stylens,l=odf.Namespaces.svgns,r=odf.Namespaces.tablens,d=odf.Namespaces.xlinkns,
a=odf.Namespaces.presentationns,m=new core.DomUtils,g={graphic:"draw","drawing-page":"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text",page:"office"},x={graphic:"circle connected control custom-shape ellipse frame g line measure page page-thumbnail path polygon polyline rect regular-polygon".split(" "),paragraph:"alphabetical-index-entry-template h illustration-index-entry-template index-source-style object-index-entry-template p table-index-entry-template table-of-content-entry-template user-index-entry-template".split(" "),
presentation:"caption circle connector control custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),"drawing-page":"caption circle connector control page custom-shape ellipse frame g line measure page-thumbnail path polygon polyline rect regular-polygon".split(" "),ruby:["ruby","ruby-text"],section:"alphabetical-index bibliography illustration-index index-title object-index section table-of-content table-index user-index".split(" "),table:["background",
"table"],"table-cell":"body covered-table-cell even-columns even-rows first-column first-row last-column last-row odd-columns odd-rows table-cell".split(" "),"table-column":["table-column"],"table-row":["table-row"],text:"a index-entry-chapter index-entry-link-end index-entry-link-start index-entry-page-number index-entry-span index-entry-tab-stop index-entry-text index-title-template linenumbering-configuration list-level-style-number list-level-style-bullet outline-level-style span".split(" "),
list:["list-item"]},v=[[h,"color","color"],[h,"background-color","background-color"],[h,"font-weight","font-weight"],[h,"font-style","font-style"]],z=[[s,"repeat","background-repeat"]],y=[[h,"background-color","background-color"],[h,"text-align","text-align"],[h,"text-indent","text-indent"],[h,"padding","padding"],[h,"padding-left","padding-left"],[h,"padding-right","padding-right"],[h,"padding-top","padding-top"],[h,"padding-bottom","padding-bottom"],[h,"border-left","border-left"],[h,"border-right",
"border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"margin","margin"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"],[h,"border","border"]],t=[[h,"background-color","background-color"],[h,"min-height","min-height"],[p,"stroke","border"],[l,"stroke-color","border-color"],[l,"stroke-width","border-width"],[h,"border","border"],[h,"border-left","border-left"],[h,"border-right","border-right"],
[h,"border-top","border-top"],[h,"border-bottom","border-bottom"]],u=[[h,"background-color","background-color"],[h,"border-left","border-left"],[h,"border-right","border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"border","border"]],w=[[s,"column-width","width"]],B=[[s,"row-height","height"],[h,"keep-together",null]],I=[[s,"width","width"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"]],
D=[[h,"background-color","background-color"],[h,"padding","padding"],[h,"padding-left","padding-left"],[h,"padding-right","padding-right"],[h,"padding-top","padding-top"],[h,"padding-bottom","padding-bottom"],[h,"border","border"],[h,"border-left","border-left"],[h,"border-right","border-right"],[h,"border-top","border-top"],[h,"border-bottom","border-bottom"],[h,"margin","margin"],[h,"margin-left","margin-left"],[h,"margin-right","margin-right"],[h,"margin-top","margin-top"],[h,"margin-bottom","margin-bottom"]],
F=[[h,"page-width","width"],[h,"page-height","height"]],q={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},Q={},N=new odf.OdfUtils,U,C,$,S=xmldom.XPath,H=new core.CSSUnits;this.style2css=function(a,b,d,c,f){var q,h,m;for(C=b;d.cssRules.length;)d.deleteRule(d.cssRules.length-1);odf.Namespaces.forEachPrefix(function(a,b){q="@namespace "+a+" url("+b+");";try{d.insertRule(q,d.cssRules.length)}catch(c){}});Q=c;U=a;$=runtime.getWindow().getComputedStyle(document.body,
null).getPropertyValue("font-size")||"12pt";for(m in g)if(g.hasOwnProperty(m))for(h in a=f[m],a)a.hasOwnProperty(h)&&e(d,m,h,a[h])}};(function(){function f(k,c){var b=this;this.getDistance=function(c){var f=b.x-c.x;c=b.y-c.y;return Math.sqrt(f*f+c*c)};this.getCenter=function(c){return new f((b.x+c.x)/2,(b.y+c.y)/2)};b.x=k;b.y=c}gui.ZoomHelper=function(){function k(b,d,c,g){b=g?"translate3d("+b+"px, "+d+"px, 0) scale3d("+c+", "+c+", 1)":"translate("+b+"px, "+d+"px) scale("+c+")";a.style.WebkitTransform=b;a.style.MozTransform=b;a.style.msTransform=b;a.style.OTransform=b;a.style.transform=b}function c(a){a?k(-m.x,-m.y,v,!0):(k(0,
0,v,!0),k(0,0,v,!1))}function b(a){if(t&&D){var b=t.style.overflow,d=t.classList.contains("webodf-customScrollbars");a&&d||!a&&!d||(a?(t.classList.add("webodf-customScrollbars"),t.style.overflow="hidden",runtime.requestAnimationFrame(function(){t.style.overflow=b})):t.classList.remove("webodf-customScrollbars"))}}function e(){k(-m.x,-m.y,v,!0);t.scrollLeft=0;t.scrollTop=0;F=u.style.overflow;u.style.overflow="visible";b(!1)}function p(){k(0,0,v,!0);t.scrollLeft=m.x;t.scrollTop=m.y;u.style.overflow=
F||"";b(!0)}function h(b){return new f(b.pageX-a.offsetLeft,b.pageY-a.offsetTop)}function n(b){g&&(m.x-=b.x-g.x,m.y-=b.y-g.y,m=new f(Math.min(Math.max(m.x,a.offsetLeft),(a.offsetLeft+a.offsetWidth)*v-t.clientWidth),Math.min(Math.max(m.y,a.offsetTop),(a.offsetTop+a.offsetHeight)*v-t.clientHeight)));g=b}function s(a){var b=a.touches.length,d=0<b?h(a.touches[0]):null;a=1<b?h(a.touches[1]):null;d&&a?(x=d.getDistance(a),z=v,g=d.getCenter(a),e(),I=B.PINCH):d&&(g=d,I=B.SCROLL)}function l(b){var d=b.touches.length,
g=0<d?h(b.touches[0]):null,d=1<d?h(b.touches[1]):null;if(g&&d)if(b.preventDefault(),I===B.SCROLL)I=B.PINCH,e(),x=g.getDistance(d);else{b=g.getCenter(d);g=g.getDistance(d)/x;n(b);var d=v,f=Math.min(y,a.offsetParent.clientWidth/a.offsetWidth);v=z*g;v=Math.min(Math.max(v,f),y);g=v/d;m.x+=(g-1)*(b.x+m.x);m.y+=(g-1)*(b.y+m.y);c(!0)}else g&&(I===B.PINCH?(I=B.SCROLL,p()):n(g))}function r(){I===B.PINCH&&(w.emit(gui.ZoomHelper.signalZoomChanged,v),p(),c(!1));I=B.NONE}function d(){t&&(t.removeEventListener("touchstart",
s,!1),t.removeEventListener("touchmove",l,!1),t.removeEventListener("touchend",r,!1))}var a,m,g,x,v,z,y=4,t,u,w=new core.EventNotifier([gui.ZoomHelper.signalZoomChanged]),B={NONE:0,SCROLL:1,PINCH:2},I=B.NONE,D=runtime.getWindow().hasOwnProperty("ontouchstart"),F="";this.subscribe=function(a,b){w.subscribe(a,b)};this.unsubscribe=function(a,b){w.unsubscribe(a,b)};this.getZoomLevel=function(){return v};this.setZoomLevel=function(b){a&&(v=b,c(!1),w.emit(gui.ZoomHelper.signalZoomChanged,v))};this.destroy=
function(a){d();b(!1);a()};this.setZoomableElement=function(g){d();a=g;t=a.offsetParent;u=a.parentNode;c(!1);t&&(t.addEventListener("touchstart",s,!1),t.addEventListener("touchmove",l,!1),t.addEventListener("touchend",r,!1));b(!0)};z=v=1;m=new f(0,0)};gui.ZoomHelper.signalZoomChanged="zoomChanged"})();ops.Canvas=function(){};ops.Canvas.prototype.getZoomLevel=function(){};ops.Canvas.prototype.getElement=function(){};ops.Canvas.prototype.getSizer=function(){};ops.Canvas.prototype.getZoomHelper=function(){};(function(){function f(){function a(c){d=!0;runtime.setTimeout(function(){try{c()}catch(g){runtime.log(String(g)+"\n"+g.stack)}d=!1;0<b.length&&a(b.pop())},10)}var b=[],d=!1;this.clearQueue=function(){b.length=0};this.addToQueue=function(c){if(0===b.length&&!d)return a(c);b.push(c)}}function k(a){function b(){for(;0<d.cssRules.length;)d.deleteRule(0);d.insertRule("#shadowContent draw|page {display:none;}",0);d.insertRule("office|presentation draw|page {display:none;}",1);d.insertRule("#shadowContent draw|page:nth-of-type("+
c+") {display:block;}",2);d.insertRule("office|presentation draw|page:nth-of-type("+c+") {display:block;}",3)}var d=a.sheet,c=1;this.showFirstPage=function(){c=1;b()};this.showNextPage=function(){c+=1;b()};this.showPreviousPage=function(){1<c&&(c-=1,b())};this.showPage=function(a){0<a&&(c=a,b())};this.css=a;this.destroy=function(b){a.parentNode.removeChild(a);b()}}function c(a){for(;a.firstChild;)a.removeChild(a.firstChild)}function b(a){a=a.sheet;for(var b=a.cssRules;b.length;)a.deleteRule(b.length-
1)}function e(a,b,d){var c=new odf.Style2CSS,g=new odf.ListStyleToCss;d=d.sheet;var e=(new odf.StyleTree(a.rootElement.styles,a.rootElement.automaticStyles)).getStyleTree();c.style2css(a.getDocumentType(),a.rootElement,d,b.getFontMap(),e);g.applyListStyles(d,e,a.rootElement.body)}function p(a,b){(new odf.FontLoader).loadFonts(a,b.sheet)}function h(a,b,d){var c=null;a=a.rootElement.body.getElementsByTagNameNS(q,d+"-decl");d=b.getAttributeNS(q,"use-"+d+"-name");var g;if(d&&0<a.length)for(b=0;b<a.length;b+=
1)if(g=a[b],g.getAttributeNS(q,"name")===d){c=g.textContent;break}return c}function n(a,b,d,g){var e=a.ownerDocument;b=a.getElementsByTagNameNS(b,d);for(a=0;a<b.length;a+=1)c(b[a]),g&&(d=b[a],d.appendChild(e.createTextNode(g)))}function s(a,b,d){b.setAttributeNS("urn:webodf:names:helper","styleid",a);var c,g=b.getAttributeNS(D,"anchor-type"),e=b.getAttributeNS(B,"x"),f=b.getAttributeNS(B,"y"),h=b.getAttributeNS(B,"width"),m=b.getAttributeNS(B,"height"),q=b.getAttributeNS(t,"min-height"),l=b.getAttributeNS(t,
"min-width");if("as-char"===g)c="display: inline-block;";else if(g||e||f)c="position: absolute;";else if(h||m||q||l)c="display: block;";e&&(c+="left: "+e+";");f&&(c+="top: "+f+";");h&&(c+="width: "+h+";");m&&(c+="height: "+m+";");q&&(c+="min-height: "+q+";");l&&(c+="min-width: "+l+";");c&&(c="draw|"+b.localName+'[webodfhelper|styleid="'+a+'"] {'+c+"}",d.insertRule(c,d.cssRules.length))}function l(a){for(a=a.firstChild;a;){if(a.namespaceURI===u&&"binary-data"===a.localName)return"data:image/png;base64,"+
a.textContent.replace(/[\r\n\s]/g,"");a=a.nextSibling}return""}function r(a,b,d,c){function g(b){b&&(b='draw|image[webodfhelper|styleid="'+a+'"] {'+("background-image: url("+b+");")+"}",c.insertRule(b,c.cssRules.length))}function e(a){g(a.url)}d.setAttributeNS("urn:webodf:names:helper","styleid",a);var f=d.getAttributeNS(F,"href"),h;if(f)try{h=b.getPart(f),h.onchange=e,h.load()}catch(m){runtime.log("slight problem: "+String(m))}else f=l(d),g(f)}function d(a){var b=a.ownerDocument;N.getElementsByTagNameNS(a,
D,"line-break").forEach(function(a){a.hasChildNodes()||a.appendChild(b.createElement("br"))})}function a(a){var b=a.ownerDocument;N.getElementsByTagNameNS(a,D,"s").forEach(function(a){for(var d,c;a.firstChild;)a.removeChild(a.firstChild);a.appendChild(b.createTextNode(" "));c=parseInt(a.getAttributeNS(D,"c"),10);if(1<c)for(a.removeAttributeNS(D,"c"),d=1;d<c;d+=1)a.parentNode.insertBefore(a.cloneNode(!0),a)})}function m(a){N.getElementsByTagNameNS(a,D,"tab").forEach(function(a){a.textContent="\t"})}
function g(a,b){function d(a,c){var f=h.documentElement.namespaceURI;"video/"===c.substr(0,6)?(g=h.createElementNS(f,"video"),g.setAttribute("controls","controls"),e=h.createElementNS(f,"source"),a&&e.setAttribute("src",a),e.setAttribute("type",c),g.appendChild(e),b.parentNode.appendChild(g)):b.innerHtml="Unrecognised Plugin"}function c(a){d(a.url,a.mimetype)}var g,e,f,h=b.ownerDocument,m;if(f=b.getAttributeNS(F,"href"))try{m=a.getPart(f),m.onchange=c,m.load()}catch(q){runtime.log("slight problem: "+
String(q))}else runtime.log("using MP4 data fallback"),f=l(b),d(f,"video/mp4")}function x(a){var b=a.getElementsByTagName("head")[0],d,c;d=a.styleSheets.length;for(c=b.firstElementChild;c&&("style"!==c.localName||!c.hasAttribute("webodfcss"));)c=c.nextElementSibling;if(c)return d=parseInt(c.getAttribute("webodfcss"),10),c.setAttribute("webodfcss",d+1),c;"string"===String(typeof webodf_css)?d=webodf_css:(c="webodf.css",runtime.currentDirectory&&(c=runtime.currentDirectory(),0<c.length&&"/"!==c.substr(-1)&&
(c+="/"),c+="../webodf.css"),d=runtime.readFileSync(c,"utf-8"));c=a.createElementNS(b.namespaceURI,"style");c.setAttribute("media","screen, print, handheld, projection");c.setAttribute("type","text/css");c.setAttribute("webodfcss","1");c.appendChild(a.createTextNode(d));b.appendChild(c);return c}function v(a){var b=parseInt(a.getAttribute("webodfcss"),10);1===b?a.parentNode.removeChild(a):a.setAttribute("count",b-1)}function z(a){var b=a.getElementsByTagName("head")[0],d=a.createElementNS(b.namespaceURI,
"style"),c="";d.setAttribute("type","text/css");d.setAttribute("media","screen, print, handheld, projection");odf.Namespaces.forEachPrefix(function(a,b){c+="@namespace "+a+" url("+b+");\n"});c+="@namespace webodfhelper url(urn:webodf:names:helper);\n";d.appendChild(a.createTextNode(c));b.appendChild(d);return d}var y=odf.Namespaces.drawns,t=odf.Namespaces.fons,u=odf.Namespaces.officens,w=odf.Namespaces.stylens,B=odf.Namespaces.svgns,I=odf.Namespaces.tablens,D=odf.Namespaces.textns,F=odf.Namespaces.xlinkns,
q=odf.Namespaces.presentationns,Q=xmldom.XPath,N=new core.DomUtils;odf.OdfCanvas=function(l){function t(a,b,d){function c(a,b,d,g){ja.addToQueue(function(){r(a,b,d,g)})}var g,e;g=b.getElementsByTagNameNS(y,"image");for(b=0;b<g.length;b+=1)e=g.item(b),c("image"+String(b),a,e,d)}function F(a,b){function d(a,b){ja.addToQueue(function(){g(a,b)})}var c,e,f;e=b.getElementsByTagNameNS(y,"plugin");for(c=0;c<e.length;c+=1)f=e.item(c),d(a,f)}function B(){var a;a=J.firstChild;var b=da.getZoomLevel();a&&(J.style.WebkitTransformOrigin=
"0% 0%",J.style.MozTransformOrigin="0% 0%",J.style.msTransformOrigin="0% 0%",J.style.OTransformOrigin="0% 0%",J.style.transformOrigin="0% 0%",Z&&((a=Z.getMinimumHeightForAnnotationPane())?J.style.minHeight=a:J.style.removeProperty("min-height")),l.style.width=Math.round(b*J.offsetWidth)+"px",l.style.height=Math.round(b*J.offsetHeight)+"px",l.style.display="inline-block")}function H(b,g){var e=ga.sheet;c(l);J=G.createElementNS(l.namespaceURI,"div");J.style.display="inline-block";J.style.background=
"white";J.style.setProperty("float","left","important");J.appendChild(g);l.appendChild(J);X=G.createElementNS(l.namespaceURI,"div");X.id="annotationsPane";fa=G.createElementNS(l.namespaceURI,"div");fa.id="shadowContent";fa.style.position="absolute";fa.style.top=0;fa.style.left=0;b.getContentElement().appendChild(fa);var f=g.body,p,k=[],r;for(p=f.firstElementChild;p&&p!==f;)if(p.namespaceURI===y&&(k[k.length]=p),p.firstElementChild)p=p.firstElementChild;else{for(;p&&p!==f&&!p.nextElementSibling;)p=
p.parentNode;p&&p.nextElementSibling&&(p=p.nextElementSibling)}for(r=0;r<k.length;r+=1)p=k[r],s("frame"+String(r),p,e);k=Q.getODFElementsWithXPath(f,".//*[*[@text:anchor-type='paragraph']]",odf.Namespaces.lookupNamespaceURI);for(p=0;p<k.length;p+=1)f=k[p],f.setAttributeNS&&f.setAttributeNS("urn:webodf:names:helper","containsparagraphanchor",!0);f=A;p=fa;var x,N,v,z;z=0;var B,H;r=b.rootElement.ownerDocument;if((k=g.body.firstElementChild)&&k.namespaceURI===u&&("presentation"===k.localName||"drawing"===
k.localName))for(k=k.firstElementChild;k;){if(x=(x=k.getAttributeNS(y,"master-page-name"))?f.getMasterPageElement(x):null){N=k.getAttributeNS("urn:webodf:names:helper","styleid");v=r.createElementNS(y,"draw:page");H=x.firstElementChild;for(B=0;H;)"true"!==H.getAttributeNS(q,"placeholder")&&(z=H.cloneNode(!0),v.appendChild(z),s(N+"_"+B,z,e)),H=H.nextElementSibling,B+=1;H=B=z=void 0;var E=v.getElementsByTagNameNS(y,"frame");for(z=0;z<E.length;z+=1)B=E[z],(H=B.getAttributeNS(q,"class"))&&!/^(date-time|footer|header|page-number)$/.test(H)&&
B.parentNode.removeChild(B);p.appendChild(v);z=String(p.getElementsByTagNameNS(y,"page").length);n(v,D,"page-number",z);n(v,q,"header",h(b,k,"header"));n(v,q,"footer",h(b,k,"footer"));s(N,v,e);v.setAttributeNS(y,"draw:master-page-name",x.getAttributeNS(w,"name"))}k=k.nextElementSibling}f=l.namespaceURI;k=g.body.getElementsByTagNameNS(I,"table-cell");for(p=0;p<k.length;p+=1)r=k.item(p),r.hasAttributeNS(I,"number-columns-spanned")&&r.setAttributeNS(f,"colspan",r.getAttributeNS(I,"number-columns-spanned")),
r.hasAttributeNS(I,"number-rows-spanned")&&r.setAttributeNS(f,"rowspan",r.getAttributeNS(I,"number-rows-spanned"));d(g.body);a(g.body);m(g.body);t(b,g.body,e);F(b,g.body);J.insertBefore(fa,J.firstChild);da.setZoomableElement(J)}function Y(a){M?(X.parentNode||J.appendChild(X),Z&&Z.forgetAnnotations(),Z=new gui.AnnotationViewManager(E,a.body,X,T),N.getElementsByTagNameNS(a.body,u,"annotation").forEach(Z.addAnnotation),Z.rerenderAnnotations(),B()):X.parentNode&&(J.removeChild(X),Z.forgetAnnotations(),
B())}function aa(a){function d(){b(ba);b(R);b(ga);c(l);l.style.display="inline-block";var g=O.rootElement;l.ownerDocument.importNode(g,!0);A.setOdfContainer(O);p(O,ba);e(O,A,R);H(O,g);Y(g);a||ja.addToQueue(function(){var a=[O];if(ca.hasOwnProperty("statereadychange")){var b=ca.statereadychange,d;for(d=0;d<b.length;d+=1)b[d].apply(null,a)}})}O.state===odf.OdfContainer.DONE?d():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),ea=runtime.setTimeout(function ma(){O.state===odf.OdfContainer.DONE?
d():(runtime.log("will be back later..."),ea=runtime.setTimeout(ma,500))},100))}function W(a){ja.clearQueue();l.innerHTML=runtime.tr("Loading")+" "+a+"...";l.removeAttribute("style");O=new odf.OdfContainer(a,function(a){O=a;aa(!1)})}runtime.assert(null!==l&&void 0!==l,"odf.OdfCanvas constructor needs DOM element");runtime.assert(null!==l.ownerDocument&&void 0!==l.ownerDocument,"odf.OdfCanvas constructor needs DOM");var E=this,G=l.ownerDocument,O,A=new odf.Formatting,P,J=null,X=null,M=!1,T=!1,Z=null,
ia,ba,R,ga,fa,ca={},ea,na,la=!1,ha=!1,ja=new f,da=new gui.ZoomHelper;this.refreshCSS=function(){la=!0;na.trigger()};this.refreshSize=function(){na.trigger()};this.odfContainer=function(){return O};this.setOdfContainer=function(a,b){O=a;aa(!0===b)};this.load=this.load=W;this.save=function(a){O.save(a)};this.addListener=function(a,b){switch(a){case "click":var d=l,c=a;d.addEventListener?d.addEventListener(c,b,!1):d.attachEvent?d.attachEvent("on"+c,b):d["on"+c]=b;break;default:d=ca.hasOwnProperty(a)?
ca[a]:ca[a]=[],b&&-1===d.indexOf(b)&&d.push(b)}};this.getFormatting=function(){return A};this.getAnnotationViewManager=function(){return Z};this.refreshAnnotations=function(){Y(O.rootElement)};this.rerenderAnnotations=function(){Z&&(ha=!0,na.trigger())};this.getSizer=function(){return J};this.enableAnnotations=function(a,b){a!==M&&(M=a,T=b,O&&Y(O.rootElement))};this.addAnnotation=function(a){Z&&(Z.addAnnotation(a),B())};this.forgetAnnotations=function(){Z&&(Z.forgetAnnotations(),B())};this.getZoomHelper=
function(){return da};this.setZoomLevel=function(a){da.setZoomLevel(a)};this.getZoomLevel=function(){return da.getZoomLevel()};this.fitToContainingElement=function(a,b){var d=da.getZoomLevel(),c=l.offsetHeight/d,d=a/(l.offsetWidth/d);b/c<d&&(d=b/c);da.setZoomLevel(d)};this.fitToWidth=function(a){var b=l.offsetWidth/da.getZoomLevel();da.setZoomLevel(a/b)};this.fitSmart=function(a,b){var d,c;c=da.getZoomLevel();d=l.offsetWidth/c;c=l.offsetHeight/c;d=a/d;void 0!==b&&b/c<d&&(d=b/c);da.setZoomLevel(Math.min(1,
d))};this.fitToHeight=function(a){var b=l.offsetHeight/da.getZoomLevel();da.setZoomLevel(a/b)};this.showFirstPage=function(){P.showFirstPage()};this.showNextPage=function(){P.showNextPage()};this.showPreviousPage=function(){P.showPreviousPage()};this.showPage=function(a){P.showPage(a);B()};this.getElement=function(){return l};this.addCssForFrameWithImage=function(a){var b=a.getAttributeNS(y,"name"),d=a.firstElementChild;s(b,a,ga.sheet);d&&r(b+"img",O,d,ga.sheet)};this.destroy=function(a){var b=G.getElementsByTagName("head")[0],
d=[P.destroy,na.destroy];runtime.clearTimeout(ea);X&&X.parentNode&&X.parentNode.removeChild(X);da.destroy(function(){J&&(l.removeChild(J),J=null)});v(ia);b.removeChild(ba);b.removeChild(R);b.removeChild(ga);core.Async.destroyAll(d,a)};ia=x(G);P=new k(z(G));ba=z(G);R=z(G);ga=z(G);na=core.Task.createRedrawTask(function(){la&&(e(O,A,R),la=!1);ha&&(Z&&Z.rerenderAnnotations(),ha=!1);B()});da.subscribe(gui.ZoomHelper.signalZoomChanged,B)}})();odf.StepUtils=function(){this.getContentBounds=function(f){var k=f.container(),c,b;runtime.assert(f.isStep(),"Step iterator must be on a step");k.nodeType===Node.TEXT_NODE&&0<f.offset()?c=f.offset():(k=f.leftNode())&&k.nodeType===Node.TEXT_NODE&&(c=k.length);k&&(k.nodeType===Node.TEXT_NODE?(runtime.assert(0<c,"Empty text node found"),b={container:k,startOffset:c-1,endOffset:c}):b={container:k,startOffset:0,endOffset:k.childNodes.length});return b}};ops.MemberProperties=function(){};
ops.Member=function(f,k){var c=new ops.MemberProperties;this.getMemberId=function(){return f};this.getProperties=function(){return c};this.setProperties=function(b){Object.keys(b).forEach(function(e){c[e]=b[e]})};this.removeProperties=function(b){Object.keys(b).forEach(function(b){"fullName"!==b&&"color"!==b&&"imageUrl"!==b&&c.hasOwnProperty(b)&&delete c[b]})};runtime.assert(Boolean(f),"No memberId was supplied!");k.fullName||(k.fullName=runtime.tr("Unknown Author"));k.color||(k.color="black");k.imageUrl||
(k.imageUrl="avatar-joe.png");c=k};gui.SelectionMover=function(f,k){function c(){r.setUnfilteredPosition(f.getNode(),0);return r}function b(a,b){var d,c=null;a&&0<a.length&&(d=b?a.item(a.length-1):a.item(0));d&&(c={top:d.top,left:b?d.right:d.left,bottom:d.bottom});return c}function e(a,d,c,f){var h=a.nodeType;c.setStart(a,d);c.collapse(!f);f=b(c.getClientRects(),!0===f);!f&&0<d&&(c.setStart(a,d-1),c.setEnd(a,d),f=b(c.getClientRects(),!0));f||(h===Node.ELEMENT_NODE&&0<d&&a.childNodes.length>=d?f=e(a,d-1,c,!0):a.nodeType===Node.TEXT_NODE&&
0<d?f=e(a,d-1,c,!0):a.previousSibling?f=e(a.previousSibling,a.previousSibling.nodeType===Node.TEXT_NODE?a.previousSibling.textContent.length:a.previousSibling.childNodes.length,c,!0):a.parentNode&&a.parentNode!==k?f=e(a.parentNode,0,c,!1):(c.selectNode(k),f=b(c.getClientRects(),!1)));runtime.assert(Boolean(f),"No visible rectangle found");return f}function p(a,b,g){for(var e=c(),f=new core.LoopWatchDog(1E4),h=0,l=0;0<a&&e.nextPosition();)f.check(),g.acceptPosition(e)===d&&(h+=1,b.acceptPosition(e)===
d&&(l+=h,h=0,a-=1));return l}function h(a,b,g){for(var e=c(),f=new core.LoopWatchDog(1E4),h=0,l=0;0<a&&e.previousPosition();)f.check(),g.acceptPosition(e)===d&&(h+=1,b.acceptPosition(e)===d&&(l+=h,h=0,a-=1));return l}function n(a,b){var g=c(),f=0,h=0,l=0>a?-1:1;for(a=Math.abs(a);0<a;){for(var p=b,n=l,r=g,s=r.container(),B=0,I=null,D=void 0,F=10,q=void 0,Q=0,N=void 0,U=void 0,C=void 0,q=void 0,$=k.ownerDocument.createRange(),S=new core.LoopWatchDog(1E4),q=e(s,r.unfilteredDomOffset(),$),N=q.top,U=q.left,
C=N;!0===(0>n?r.previousPosition():r.nextPosition());)if(S.check(),p.acceptPosition(r)===d&&(B+=1,s=r.container(),q=e(s,r.unfilteredDomOffset(),$),q.top!==N)){if(q.top!==C&&C!==N)break;C=q.top;q=Math.abs(U-q.left);if(null===I||q<F)I=s,D=r.unfilteredDomOffset(),F=q,Q=B}null!==I?(r.setUnfilteredPosition(I,D),B=Q):B=0;$.detach();f+=B;if(0===f)break;h+=f;a-=1}return h*l}function s(a,b){var g,f,h,p,n=c(),r=l.getParagraphElement(n.getCurrentNode()),s=0,w=k.ownerDocument.createRange();0>a?(g=n.previousPosition,
f=-1):(g=n.nextPosition,f=1);for(h=e(n.container(),n.unfilteredDomOffset(),w);g.call(n);)if(b.acceptPosition(n)===d){if(l.getParagraphElement(n.getCurrentNode())!==r)break;p=e(n.container(),n.unfilteredDomOffset(),w);if(p.bottom!==h.bottom&&(h=p.top>=h.top&&p.bottom<h.bottom||p.top<=h.top&&p.bottom>h.bottom,!h))break;s+=f;h=p}w.detach();return s}var l=new odf.OdfUtils,r,d=core.PositionFilter.FilterResult.FILTER_ACCEPT;this.getStepCounter=function(){return{convertForwardStepsBetweenFilters:p,convertBackwardStepsBetweenFilters:h,
countLinesSteps:n,countStepsToLineBoundary:s}};(function(){r=gui.SelectionMover.createPositionIterator(k);var a=k.ownerDocument.createRange();a.setStart(r.container(),r.unfilteredDomOffset());a.collapse(!0);f.setSelectedRange(a)})()};
gui.SelectionMover.createPositionIterator=function(f){var k=new function(){this.acceptNode=function(c){return c&&"urn:webodf:names:cursor"!==c.namespaceURI&&"urn:webodf:names:editinfo"!==c.namespaceURI?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}};return new core.PositionIterator(f,5,k,!1)};ops.Document=function(){};ops.Document.prototype.getMemberIds=function(){};ops.Document.prototype.removeCursor=function(f){};ops.Document.prototype.getDocumentElement=function(){};ops.Document.prototype.getRootNode=function(){};ops.Document.prototype.getDOMDocument=function(){};ops.Document.prototype.cloneDocumentElement=function(){};ops.Document.prototype.setDocumentElement=function(f){};ops.Document.prototype.subscribe=function(f,k){};ops.Document.prototype.unsubscribe=function(f,k){};
ops.Document.prototype.getCanvas=function(){};ops.Document.prototype.createRootFilter=function(f){};ops.Document.signalCursorAdded="cursor/added";ops.Document.signalCursorRemoved="cursor/removed";ops.Document.signalCursorMoved="cursor/moved";ops.Document.signalMemberAdded="member/added";ops.Document.signalMemberUpdated="member/updated";ops.Document.signalMemberRemoved="member/removed";ops.OdtCursor=function(f,k){var c=this,b={},e,p,h,n=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){h.remove()};this.subscribe=function(b,c){n.subscribe(b,c)};this.unsubscribe=function(b,c){n.unsubscribe(b,c)};this.getStepCounter=function(){return p.getStepCounter()};this.getMemberId=function(){return f};this.getNode=function(){return h.getNode()};this.getAnchorNode=function(){return h.getAnchorNode()};this.getSelectedRange=function(){return h.getSelectedRange()};
this.setSelectedRange=function(b,e){h.setSelectedRange(b,e);n.emit(ops.OdtCursor.signalCursorUpdated,c)};this.hasForwardSelection=function(){return h.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return e};this.setSelectionType=function(c){b.hasOwnProperty(c)?e=c:runtime.log("Invalid selection type: "+c)};this.resetSelectionType=function(){c.setSelectionType(ops.OdtCursor.RangeSelection)};h=new core.Cursor(k.getDOMDocument(),f);p=new gui.SelectionMover(h,
k.getRootNode());b[ops.OdtCursor.RangeSelection]=!0;b[ops.OdtCursor.RegionSelection]=!0;c.resetSelectionType()};ops.OdtCursor.RangeSelection="Range";ops.OdtCursor.RegionSelection="Region";ops.OdtCursor.signalCursorUpdated="cursorUpdated";(function(){var f=0;ops.StepsCache=function(k,c,b){function e(a,d){var c=this;this.nodeId=a;this.steps=-1;this.node=d;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setPositionBeforeElement(d);b(c.steps,a)}}function p(a,d,c){var g=this;this.nodeId=a;this.steps=d;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setUnfilteredPosition(c,0);b(g.steps,a)}}function h(a,b){var d="["+a.nodeId;b&&(d+=" => "+b.nodeId);return d+
"]"}function n(){for(var a=z,b,d,c,e=new core.LoopWatchDog(0,1E5),f={};a;){e.check();(b=a.previousBookmark)?runtime.assert(b.nextBookmark===a,"Broken bookmark link to previous @"+h(b,a)):(runtime.assert(a===z,"Broken bookmark link @"+h(a)),runtime.assert(void 0===y||z===z||z.steps<=y,"Base point is damaged @"+h(a)));(d=a.nextBookmark)&&runtime.assert(d.previousBookmark===a,"Broken bookmark link to next @"+h(a,d));if(void 0===y||a===z||a.steps<=y)runtime.assert(v.containsNode(k,a.node),"Disconnected node is being reported as undamaged @"+
h(a)),b&&(c=a.node.compareDocumentPosition(b.node),runtime.assert(0===c||0!==(c&u),"Bookmark order with previous does not reflect DOM order @"+h(b,a))),d&&v.containsNode(k,d.node)&&(c=a.node.compareDocumentPosition(d.node),runtime.assert(0===c||0!==(c&t),"Bookmark order with next does not reflect DOM order @"+h(a,d)));a=a.nextBookmark}Object.keys(g).forEach(function(a){var b=g[a];(void 0===y||a<=y)&&runtime.assert(b.steps<=a,"Bookmark step of "+b.steps+" exceeds cached step lookup for "+a+" @"+h(b));
runtime.assert(!1===f.hasOwnProperty(b.nodeId),"Bookmark "+h(b)+" appears twice in cached step lookup at steps "+f[b.nodeId]+" and "+a);f[b.nodeId]=a})}function s(a){var b="";a.nodeType===Node.ELEMENT_NODE&&(b=a.getAttributeNS(m,"nodeId")||"");return b}function l(a){var b=f.toString();a.setAttributeNS(m,"nodeId",b);f+=1;return b}function r(a){var b,d,e=new core.LoopWatchDog(0,1E4);void 0!==y&&a>y&&(a=y);for(b=Math.floor(a/c)*c;!d&&0<=b;)d=g[b],b-=c;for(d=d||z;d.nextBookmark&&d.nextBookmark.steps<=
a;)e.check(),d=d.nextBookmark;runtime.assert(-1===a||d.steps<=a,"Bookmark @"+h(d)+" at step "+d.steps+" exceeds requested step of "+a);return d}function d(a){a.previousBookmark&&(a.previousBookmark.nextBookmark=a.nextBookmark);a.nextBookmark&&(a.nextBookmark.previousBookmark=a.previousBookmark)}function a(a){for(var b,d=null;!d&&a&&a!==k;)(b=s(a))&&(d=x[b])&&d.node!==a&&(runtime.log("Cloned node detected. Creating new bookmark"),d=null,a.removeAttributeNS(m,"nodeId")),a=a.parentNode;return d}var m=
"urn:webodf:names:steps",g={},x={},v=new core.DomUtils,z,y,t=Node.DOCUMENT_POSITION_FOLLOWING,u=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(a,b){var f,h=Math.ceil(a/c)*c,q,m,n;if(void 0!==y&&y<a){q=r(y);for(m=q.nextBookmark;m&&m.steps<=a;)f=m.nextBookmark,n=Math.ceil(m.steps/c)*c,g[n]===m&&delete g[n],v.containsNode(k,m.node)?m.steps=a+1:(d(m),delete x[m.nodeId]),m=f;y=a}else q=r(a);m=s(b)||l(b);f=x[m];f?f.node!==b&&(runtime.log("Cloned node detected. Creating new bookmark"),m=
l(b),f=x[m]=new e(m,b)):f=x[m]=new e(m,b);m=f;m.steps!==a&&(f=Math.ceil(m.steps/c)*c,f!==h&&g[f]===m&&delete g[f],m.steps=a);if(q!==m&&q.nextBookmark!==m){if(q.steps===m.steps)for(;0!==(m.node.compareDocumentPosition(q.node)&t)&&q!==z;)q=q.previousBookmark;q!==m&&q.nextBookmark!==m&&(d(m),f=q.nextBookmark,m.nextBookmark=q.nextBookmark,m.previousBookmark=q,q.nextBookmark=m,f&&(f.previousBookmark=m))}q=g[h];if(!q||m.steps>q.steps)g[h]=m;w()};this.setToClosestStep=function(a,b){var d;w();d=r(a);d.setIteratorPosition(b);
return d.steps};this.setToClosestDomPoint=function(b,d,c){var e,f;w();if(b===k&&0===d)e=z;else if(b===k&&d===k.childNodes.length)for(f in e=z,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>e.steps&&(e=b));else if(e=a(b.childNodes.item(d)||b),!e)for(c.setUnfilteredPosition(b,d);!e&&c.previousNode();)e=a(c.getCurrentNode());e=e||z;void 0!==y&&e.steps>y&&(e=r(y));e.setIteratorPosition(c);return e.steps};this.damageCacheAfterStep=function(a){0>a&&(a=-1);void 0===y?y=a:a<y&&(y=a);w()};(function(){var a=s(k)||
l(k);z=new p(a,0,k);w=ops.StepsCache.ENABLE_CACHE_VERIFICATION?n:function(){}})()};ops.StepsCache.ENABLE_CACHE_VERIFICATION=!1;ops.StepsCache.Bookmark=function(){};ops.StepsCache.Bookmark.prototype.setIteratorPosition=function(f){}})();(function(){ops.OdtStepsTranslator=function(f,k,c,b){function e(a,b,d){var c=b.getCurrentNode();b.isBeforeNode()&&r.isParagraph(c)&&(d||(a+=1),l.updateBookmark(a,c))}function p(a,b){do{if(c.acceptPosition(b)===m){e(a,b,!0);break}e(a-1,b,!1)}while(b.nextPosition())}function h(){var d=f();d!==s&&(s&&runtime.log("Undo detected. Resetting steps cache"),s=d,l=new ops.StepsCache(s,b,p),a=k(s))}function n(a,b){if(!b||c.acceptPosition(a)===m)return!0;for(;a.previousPosition();)if(c.acceptPosition(a)===m){if(b(0,
a.container(),a.unfilteredDomOffset()))return!0;break}for(;a.nextPosition();)if(c.acceptPosition(a)===m){if(b(1,a.container(),a.unfilteredDomOffset()))return!0;break}return!1}var s,l,r=new odf.OdfUtils,d=new core.DomUtils,a,m=core.PositionFilter.FilterResult.FILTER_ACCEPT;this.convertStepsToDomPoint=function(b){var d,f;if(isNaN(b))throw new TypeError("Requested steps is not numeric ("+b+")");if(0>b)throw new RangeError("Requested steps is negative ("+b+")");h();for(d=l.setToClosestStep(b,a);d<b&&
a.nextPosition();)(f=c.acceptPosition(a)===m)&&(d+=1),e(d,a,f);if(d!==b)throw new RangeError("Requested steps ("+b+") exceeds available steps ("+d+")");return{node:a.container(),offset:a.unfilteredDomOffset()}};this.convertDomPointToSteps=function(b,f,p){var k;h();d.containsNode(s,b)||(f=0>d.comparePoints(s,0,b,f),b=s,f=f?0:s.childNodes.length);a.setUnfilteredPosition(b,f);n(a,p)||a.setUnfilteredPosition(b,f);p=a.container();f=a.unfilteredDomOffset();b=l.setToClosestDomPoint(p,f,a);if(0>d.comparePoints(a.container(),
a.unfilteredDomOffset(),p,f))return 0<b?b-1:b;for(;(a.container()!==p||a.unfilteredDomOffset()!==f)&&a.nextPosition();)(k=c.acceptPosition(a)===m)&&(b+=1),e(b,a,k);return b+0};this.prime=function(){var b,d;h();for(b=l.setToClosestStep(0,a);a.nextPosition();)(d=c.acceptPosition(a)===m)&&(b+=1),e(b,a,d)};this.handleStepsInserted=function(a){h();l.damageCacheAfterStep(a.position)};this.handleStepsRemoved=function(a){h();l.damageCacheAfterStep(a.position-1)};h()};ops.OdtStepsTranslator.PREVIOUS_STEP=
0;ops.OdtStepsTranslator.NEXT_STEP=1})();ops.Operation=function(){};ops.Operation.prototype.init=function(f){};ops.Operation.prototype.execute=function(f){};ops.Operation.prototype.spec=function(){};ops.TextPositionFilter=function(f){function k(b,e,f){var k,d;if(e){if(c.isInlineRoot(e)&&c.isGroupingElement(f))return h;k=c.lookLeftForCharacter(e);if(1===k||2===k&&(c.scanRightForAnyCharacter(f)||c.scanRightForAnyCharacter(c.nextNode(b))))return p}else if(c.isInlineRoot(b.previousSibling)&&c.isGroupingElement(b))return p;k=null===e&&c.isParagraph(b);d=c.lookRightForCharacter(f);if(k)return d?p:c.scanRightForAnyCharacter(f)?h:p;if(!d)return h;e=e||c.previousNode(b);return c.scanLeftForAnyCharacter(e)?
h:p}var c=new odf.OdfUtils,b=Node.ELEMENT_NODE,e=Node.TEXT_NODE,p=core.PositionFilter.FilterResult.FILTER_ACCEPT,h=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(n){var s=n.container(),l=s.nodeType,r,d,a;if(l!==b&&l!==e)return h;if(l===e){if(!c.isGroupingElement(s.parentNode)||c.isWithinTrackedChanges(s.parentNode,f()))return h;l=n.unfilteredDomOffset();r=s.data;runtime.assert(l!==r.length,"Unexpected offset.");if(0<l){n=r[l-1];if(!c.isODFWhitespace(n))return p;if(1<l)if(n=
r[l-2],!c.isODFWhitespace(n))d=p;else{if(!c.isODFWhitespace(r.substr(0,l)))return h}else a=c.previousNode(s),c.scanLeftForNonSpace(a)&&(d=p);if(d===p)return c.isTrailingWhitespace(s,l)?h:p;d=r[l];return c.isODFWhitespace(d)?h:c.scanLeftForAnyCharacter(c.previousNode(s))?h:p}a=n.leftNode();d=s;s=s.parentNode;d=k(s,a,d)}else!c.isGroupingElement(s)||c.isWithinTrackedChanges(s,f())?d=h:(a=n.leftNode(),d=n.rightNode(),d=k(s,a,d));return d}};ops.OdtDocument=function(f){function k(){var a=f.odfContainer().getContentElement(),b=a&&a.localName;runtime.assert("text"===b,"Unsupported content element type '"+b+"' for OdtDocument");return a}function c(){return a.getDocumentElement().ownerDocument}function b(a){for(;a&&!(a.namespaceURI===odf.Namespaces.officens&&"text"===a.localName||a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName);)a=a.parentNode;return a}function e(a){this.acceptPosition=function(d){d=d.container();var c;
c="string"===typeof a?v[a].getNode():a;return b(d)===b(c)?t:u}}function p(a,b,d,c){c=gui.SelectionMover.createPositionIterator(c);var e;1===d.length?e=d[0]:(e=new core.PositionFilterChain,d.forEach(e.addFilter));d=new core.StepIterator(e,c);d.setPosition(a,b);return d}function h(a){var b=gui.SelectionMover.createPositionIterator(k());a=B.convertStepsToDomPoint(a);b.setUnfilteredPosition(a.node,a.offset);return b}function n(a){return g.getParagraphElement(a)}function s(a,b){return f.getFormatting().getStyleElement(a,
b)}function l(a){return s(a,"paragraph")}function r(a){var b,d=[],c,e=2;runtime.assert(a.isStep(),"positionIterator is not at a step");do{if(b=m.getContentBounds(a))if(b=b.container,g.isDowngradableSpaceElement(b)){for(c=b.lastChild;b.firstChild;)d.push(b.firstChild),b.parentNode.insertBefore(b.firstChild,b);b.parentNode.removeChild(b);a.setPosition(c,c.nodeType===Node.TEXT_NODE?c.length:c.childNodes.length);a.roundToPreviousStep()}e-=1}while(0<e&&a.nextStep());d.forEach(x.normalizeTextNodes)}function d(a,
b,d){a=a.childNodes.item(b)||a;return(a=n(a))&&x.containsNode(d,a)?a:d}var a=this,m,g,x,v={},z={},y=new core.EventNotifier([ops.Document.signalMemberAdded,ops.Document.signalMemberUpdated,ops.Document.signalMemberRemoved,ops.Document.signalCursorAdded,ops.Document.signalCursorRemoved,ops.Document.signalCursorMoved,ops.OdtDocument.signalParagraphChanged,ops.OdtDocument.signalParagraphStyleModified,ops.OdtDocument.signalCommonStyleCreated,ops.OdtDocument.signalCommonStyleDeleted,ops.OdtDocument.signalTableAdded,
ops.OdtDocument.signalOperationStart,ops.OdtDocument.signalOperationEnd,ops.OdtDocument.signalProcessingBatchStart,ops.OdtDocument.signalProcessingBatchEnd,ops.OdtDocument.signalUndoStackChanged,ops.OdtDocument.signalStepsInserted,ops.OdtDocument.signalStepsRemoved,ops.OdtDocument.signalMetadataUpdated]),t=core.PositionFilter.FilterResult.FILTER_ACCEPT,u=core.PositionFilter.FilterResult.FILTER_REJECT,w,B,I;this.getDocumentElement=function(){return f.odfContainer().rootElement};this.getDOMDocument=
function(){return this.getDocumentElement().ownerDocument};this.cloneDocumentElement=function(){var b=a.getDocumentElement(),d=f.getAnnotationViewManager();d&&d.forgetAnnotations();b=b.cloneNode(!0);f.refreshAnnotations();return b};this.setDocumentElement=function(a){var b=f.odfContainer();b.setRootElement(a);f.setOdfContainer(b,!0);f.refreshCSS()};this.getDOMDocument=c;this.getRootElement=b;this.createStepIterator=p;this.getIteratorAtPosition=h;this.convertCursorStepToDomPoint=function(a){return B.convertStepsToDomPoint(a)};
this.convertDomPointToCursorStep=function(a,b,d){return B.convertDomPointToSteps(a,b,d)};this.convertDomToCursorRange=function(a){var b;b=B.convertDomPointToSteps(a.anchorNode,a.anchorOffset);a=a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset?b:B.convertDomPointToSteps(a.focusNode,a.focusOffset);return{position:b,length:a-b}};this.convertCursorToDomRange=function(a,b){var d=c().createRange(),e,g;e=B.convertStepsToDomPoint(a);b?(g=B.convertStepsToDomPoint(a+b),0<b?(d.setStart(e.node,e.offset),
d.setEnd(g.node,g.offset)):(d.setStart(g.node,g.offset),d.setEnd(e.node,e.offset))):d.setStart(e.node,e.offset);return d};this.getStyleElement=s;this.upgradeWhitespacesAtPosition=function(a){var b=h(a),b=new core.StepIterator(w,b),d,c=2;runtime.assert(b.isStep(),"positionIterator is not at a step (requested step: "+a+")");do{if(d=m.getContentBounds(b))if(a=d.container,d=d.startOffset,a.nodeType===Node.TEXT_NODE&&g.isSignificantWhitespace(a,d)){runtime.assert(" "===a.data[d],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");
var e=a.ownerDocument.createElementNS(odf.Namespaces.textns,"text:s"),f=a.parentNode,l=a;e.appendChild(a.ownerDocument.createTextNode(" "));1===a.length?f.replaceChild(e,a):(a.deleteData(d,1),0<d&&(d<a.length&&a.splitText(d),l=a.nextSibling),f.insertBefore(e,l));a=e;b.setPosition(a,a.childNodes.length);b.roundToPreviousStep()}c-=1}while(0<c&&b.nextStep())};this.downgradeWhitespaces=r;this.downgradeWhitespacesAtPosition=function(a){a=h(a);a=new core.StepIterator(w,a);r(a)};this.getParagraphStyleElement=
l;this.getParagraphElement=n;this.getParagraphStyleAttributes=function(a){return(a=l(a))?f.getFormatting().getInheritedStyleAttributes(a,!1):null};this.getTextNodeAtStep=function(b,d){var e=h(b),g=e.container(),f,m=0,l=null;g.nodeType===Node.TEXT_NODE?(f=g,m=e.unfilteredDomOffset(),0<f.length&&(0<m&&(f=f.splitText(m)),f.parentNode.insertBefore(c().createTextNode(""),f),f=f.previousSibling,m=0)):(f=c().createTextNode(""),m=0,g.insertBefore(f,e.rightNode()));if(d){if(v[d]&&a.getCursorPosition(d)===
b){for(l=v[d].getNode();l.nextSibling&&"cursor"===l.nextSibling.localName;)l.parentNode.insertBefore(l.nextSibling,l);0<f.length&&f.nextSibling!==l&&(f=c().createTextNode(""),m=0);l.parentNode.insertBefore(f,l)}}else for(;f.nextSibling&&"cursor"===f.nextSibling.localName;)f.parentNode.insertBefore(f.nextSibling,f);for(;f.previousSibling&&f.previousSibling.nodeType===Node.TEXT_NODE;)e=f.previousSibling,e.appendData(f.data),m=e.length,f=e,f.parentNode.removeChild(f.nextSibling);for(;f.nextSibling&&
f.nextSibling.nodeType===Node.TEXT_NODE;)e=f.nextSibling,f.appendData(e.data),f.parentNode.removeChild(e);return{textNode:f,offset:m}};this.fixCursorPositions=function(){Object.keys(v).forEach(function(c){var e=v[c],g=b(e.getNode()),f=a.createRootFilter(g),h,m,l,n=!1;l=e.getSelectedRange();h=d(l.startContainer,l.startOffset,g);m=p(l.startContainer,l.startOffset,[w,f],h);l.collapsed?g=m:(h=d(l.endContainer,l.endOffset,g),g=p(l.endContainer,l.endOffset,[w,f],h));m.isStep()&&g.isStep()?m.container()!==
g.container()||m.offset()!==g.offset()||l.collapsed&&e.getAnchorNode()===e.getNode()||(n=!0,l.setStart(m.container(),m.offset()),l.collapse(!0)):(n=!0,runtime.assert(m.roundToClosestStep(),"No walkable step found for cursor owned by "+c),l.setStart(m.container(),m.offset()),runtime.assert(g.roundToClosestStep(),"No walkable step found for cursor owned by "+c),l.setEnd(g.container(),g.offset()));n&&(e.setSelectedRange(l,e.hasForwardSelection()),a.emit(ops.Document.signalCursorMoved,e))})};this.getCursorPosition=
function(a){return(a=v[a])?B.convertDomPointToSteps(a.getNode(),0):0};this.getCursorSelection=function(a){a=v[a];var b=0,d=0;a&&(b=B.convertDomPointToSteps(a.getNode(),0),d=B.convertDomPointToSteps(a.getAnchorNode(),0));return{position:d,length:b-d}};this.getPositionFilter=function(){return w};this.getOdfCanvas=function(){return f};this.getCanvas=function(){return f};this.getRootNode=k;this.addMember=function(a){runtime.assert(void 0===z[a.getMemberId()],"This member already exists");z[a.getMemberId()]=
a};this.getMember=function(a){return z.hasOwnProperty(a)?z[a]:null};this.removeMember=function(a){delete z[a]};this.getCursor=function(a){return v[a]};this.getMemberIds=function(){var a=[],b;for(b in v)v.hasOwnProperty(b)&&a.push(v[b].getMemberId());return a};this.addCursor=function(b){runtime.assert(Boolean(b),"OdtDocument::addCursor without cursor");var d=b.getMemberId(),c=a.convertCursorToDomRange(0,0);runtime.assert("string"===typeof d,"OdtDocument::addCursor has cursor without memberid");runtime.assert(!v[d],
"OdtDocument::addCursor is adding a duplicate cursor with memberid "+d);b.setSelectedRange(c,!0);v[d]=b};this.removeCursor=function(b){var d=v[b];return d?(d.removeFromDocument(),delete v[b],a.emit(ops.Document.signalCursorRemoved,b),!0):!1};this.moveCursor=function(b,d,c,e){b=v[b];d=a.convertCursorToDomRange(d,c);b&&(b.setSelectedRange(d,0<=c),b.setSelectionType(e||ops.OdtCursor.RangeSelection))};this.getFormatting=function(){return f.getFormatting()};this.emit=function(a,b){y.emit(a,b)};this.subscribe=
function(a,b){y.subscribe(a,b)};this.unsubscribe=function(a,b){y.unsubscribe(a,b)};this.createRootFilter=function(a){return new e(a)};this.close=function(a){a()};this.destroy=function(a){a()};w=new ops.TextPositionFilter(k);g=new odf.OdfUtils;x=new core.DomUtils;m=new odf.StepUtils;B=new ops.OdtStepsTranslator(k,gui.SelectionMover.createPositionIterator,w,500);y.subscribe(ops.OdtDocument.signalStepsInserted,B.handleStepsInserted);y.subscribe(ops.OdtDocument.signalStepsRemoved,B.handleStepsRemoved);
y.subscribe(ops.OdtDocument.signalOperationEnd,function(b){var d=b.spec(),c=d.memberid,e=(new Date(d.timestamp)).toISOString(),g=f.odfContainer(),h={setProperties:{},removedProperties:[]};b.isEdit&&("UpdateMetadata"===d.optype&&(h.setProperties=JSON.parse(JSON.stringify(d.setProperties)),d.removedProperties&&(h.removedProperties=d.removedProperties.attributes.split(","))),d=a.getMember(c).getProperties().fullName,g.setMetadata({"dc:creator":d,"dc:date":e},null),h.setProperties["dc:creator"]=d,h.setProperties["dc:date"]=
e,I||(h.setProperties["meta:editing-cycles"]=g.incrementEditingCycles(),g.setMetadata(null,["meta:editing-duration","meta:document-statistic"])),I=b,a.emit(ops.OdtDocument.signalMetadataUpdated,h))});y.subscribe(ops.OdtDocument.signalProcessingBatchEnd,core.Task.processTasks)};ops.OdtDocument.signalParagraphChanged="paragraph/changed";ops.OdtDocument.signalTableAdded="table/added";ops.OdtDocument.signalCommonStyleCreated="style/created";ops.OdtDocument.signalCommonStyleDeleted="style/deleted";
ops.OdtDocument.signalParagraphStyleModified="paragraphstyle/modified";ops.OdtDocument.signalOperationStart="operation/start";ops.OdtDocument.signalOperationEnd="operation/end";ops.OdtDocument.signalProcessingBatchStart="router/batchstart";ops.OdtDocument.signalProcessingBatchEnd="router/batchend";ops.OdtDocument.signalUndoStackChanged="undo/changed";ops.OdtDocument.signalStepsInserted="steps/inserted";ops.OdtDocument.signalStepsRemoved="steps/removed";ops.OdtDocument.signalMetadataUpdated="metadata/updated";ops.OpAddAnnotation=function(){function f(b,c,e){var f=b.getTextNodeAtStep(e,k);f&&(b=f.textNode,e=b.parentNode,f.offset!==b.length&&b.splitText(f.offset),e.insertBefore(c,b.nextSibling),0===b.length&&e.removeChild(b))}var k,c,b,e,p,h;this.init=function(f){k=f.memberid;c=parseInt(f.timestamp,10);b=parseInt(f.position,10);e=parseInt(f.length,10)||0;p=f.name};this.isEdit=!0;this.group=void 0;this.execute=function(n){var s=n.getCursor(k),l,r;r=new core.DomUtils;h=n.getDOMDocument();var d=new Date(c),
a,m,g,x;a=h.createElementNS(odf.Namespaces.officens,"office:annotation");a.setAttributeNS(odf.Namespaces.officens,"office:name",p);l=h.createElementNS(odf.Namespaces.dcns,"dc:creator");l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k);l.textContent=n.getMember(k).getProperties().fullName;m=h.createElementNS(odf.Namespaces.dcns,"dc:date");m.appendChild(h.createTextNode(d.toISOString()));d=h.createElementNS(odf.Namespaces.textns,"text:list");g=h.createElementNS(odf.Namespaces.textns,
"text:list-item");x=h.createElementNS(odf.Namespaces.textns,"text:p");g.appendChild(x);d.appendChild(g);a.appendChild(l);a.appendChild(m);a.appendChild(d);e&&(l=h.createElementNS(odf.Namespaces.officens,"office:annotation-end"),l.setAttributeNS(odf.Namespaces.officens,"office:name",p),a.annotationEndElement=l,f(n,l,b+e));f(n,a,b);n.emit(ops.OdtDocument.signalStepsInserted,{position:b});s&&(l=h.createRange(),r=r.getElementsByTagNameNS(a,odf.Namespaces.textns,"p")[0],l.selectNodeContents(r),s.setSelectedRange(l,
!1),s.setSelectionType(ops.OdtCursor.RangeSelection),n.emit(ops.Document.signalCursorMoved,s));n.getOdfCanvas().addAnnotation(a);n.fixCursorPositions();return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:k,timestamp:c,position:b,length:e,name:p}}};ops.OpAddCursor=function(){var f,k;this.init=function(c){f=c.memberid;k=c.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(c){var b=c.getCursor(f);if(b)return!1;b=new ops.OdtCursor(f,c);c.addCursor(b);c.emit(ops.Document.signalCursorAdded,b);return!0};this.spec=function(){return{optype:"AddCursor",memberid:f,timestamp:k}}};ops.OpAddMember=function(){var f,k,c;this.init=function(b){f=b.memberid;k=parseInt(b.timestamp,10);c=b.setProperties};this.isEdit=!1;this.group=void 0;this.execute=function(b){var e;if(b.getMember(f))return!1;e=new ops.Member(f,c);b.addMember(e);b.emit(ops.Document.signalMemberAdded,e);return!0};this.spec=function(){return{optype:"AddMember",memberid:f,timestamp:k,setProperties:c}}};ops.OpAddStyle=function(){var f,k,c,b,e,p,h=odf.Namespaces.stylens;this.init=function(h){f=h.memberid;k=h.timestamp;c=h.styleName;b=h.styleFamily;e="true"===h.isAutomaticStyle||!0===h.isAutomaticStyle;p=h.setProperties};this.isEdit=!0;this.group=void 0;this.execute=function(f){var k=f.getOdfCanvas().odfContainer(),l=f.getFormatting(),r=f.getDOMDocument().createElementNS(h,"style:style");if(!r)return!1;p&&l.updateStyle(r,p);r.setAttributeNS(h,"style:family",b);r.setAttributeNS(h,"style:name",c);e?
k.rootElement.automaticStyles.appendChild(r):k.rootElement.styles.appendChild(r);f.getOdfCanvas().refreshCSS();e||f.emit(ops.OdtDocument.signalCommonStyleCreated,{name:c,family:b});return!0};this.spec=function(){return{optype:"AddStyle",memberid:f,timestamp:k,styleName:c,styleFamily:b,isAutomaticStyle:e,setProperties:p}}};odf.ObjectNameGenerator=function(f,k){function c(a,b){var d={};this.generateName=function(){var c=b(),e=0,f;do f=a+e,e+=1;while(d[f]||c[f]);d[f]=!0;return f}}function b(){var a={};[f.rootElement.automaticStyles,f.rootElement.styles].forEach(function(b){for(b=b.firstElementChild;b;)b.namespaceURI===e&&"style"===b.localName&&(a[b.getAttributeNS(e,"name")]=!0),b=b.nextElementSibling});return a}var e=odf.Namespaces.stylens,p=odf.Namespaces.drawns,h=odf.Namespaces.xlinkns,n=new core.DomUtils,s=(new core.Utils).hashString(k),
l=null,r=null,d=null,a={},m={};this.generateStyleName=function(){null===l&&(l=new c("auto"+s+"_",function(){return b()}));return l.generateName()};this.generateFrameName=function(){null===r&&(n.getElementsByTagNameNS(f.rootElement.body,p,"frame").forEach(function(b){a[b.getAttributeNS(p,"name")]=!0}),r=new c("fr"+s+"_",function(){return a}));return r.generateName()};this.generateImageName=function(){null===d&&(n.getElementsByTagNameNS(f.rootElement.body,p,"image").forEach(function(a){a=a.getAttributeNS(h,
"href");a=a.substring(9,a.lastIndexOf("."));m[a]=!0}),d=new c("img"+s+"_",function(){return m}));return d.generateName()}};odf.TextStyleApplicator=function(f,k,c){function b(b){function c(a,b){return"object"===typeof a&&"object"===typeof b?Object.keys(a).every(function(d){return c(a[d],b[d])}):a===b}var d={};this.isStyleApplied=function(a){a=k.getAppliedStylesForElement(a,d).styleProperties;return c(b,a)}}function e(b){var e={};this.applyStyleToContainer=function(d){var a;a=d.getAttributeNS(n,"style-name");var h=d.ownerDocument;a=a||"";if(!e.hasOwnProperty(a)){var g=a,p;p=a?k.createDerivedStyleObject(a,"text",b):b;h=
h.createElementNS(s,"style:style");k.updateStyle(h,p);h.setAttributeNS(s,"style:name",f.generateStyleName());h.setAttributeNS(s,"style:family","text");h.setAttributeNS("urn:webodf:names:scope","scope","document-content");c.appendChild(h);e[g]=h}a=e[a].getAttributeNS(s,"name");d.setAttributeNS(n,"text:style-name",a)}}function p(b,c){var d=b.ownerDocument,a=b.parentNode,e,g,f,p=new core.LoopWatchDog(1E4);g=[];g.push(b);for(f=b.nextSibling;f&&h.rangeContainsNode(c,f);)p.check(),g.push(f),f=f.nextSibling;
"span"!==a.localName||a.namespaceURI!==n?(e=d.createElementNS(n,"text:span"),a.insertBefore(e,b),d=!1):(b.previousSibling&&!h.rangeContainsNode(c,a.firstChild)?(e=a.cloneNode(!1),a.parentNode.insertBefore(e,a.nextSibling)):e=a,d=!0);g.forEach(function(a){a.parentNode!==e&&e.appendChild(a)});if(f&&d)for(g=e.cloneNode(!1),e.parentNode.insertBefore(g,e.nextSibling);f;)p.check(),d=f.nextSibling,g.appendChild(f),f=d;return e}var h=new core.DomUtils,n=odf.Namespaces.textns,s=odf.Namespaces.stylens;this.applyStyle=
function(c,f,d){var a={},h,g,k,n;runtime.assert(d&&d.hasOwnProperty("style:text-properties"),"applyStyle without any text properties");a["style:text-properties"]=d["style:text-properties"];k=new e(a);n=new b(a);c.forEach(function(a){h=n.isStyleApplied(a);!1===h&&(g=p(a,f),k.applyStyleToContainer(g))})}};ops.OpApplyDirectStyling=function(){function f(b,c,e){var d=b.getOdfCanvas().odfContainer(),a=n.splitBoundaries(c),f=h.getTextNodes(c,!1);(new odf.TextStyleApplicator(new odf.ObjectNameGenerator(d,k),b.getFormatting(),d.rootElement.automaticStyles)).applyStyle(f,c,e);a.forEach(n.normalizeTextNodes)}var k,c,b,e,p,h=new odf.OdfUtils,n=new core.DomUtils;this.init=function(f){k=f.memberid;c=f.timestamp;b=parseInt(f.position,10);e=parseInt(f.length,10);p=f.setProperties};this.isEdit=!0;this.group=void 0;
this.execute=function(n){var l=n.convertCursorToDomRange(b,e),r=h.getParagraphElements(l);f(n,l,p);l.detach();n.getOdfCanvas().refreshCSS();n.fixCursorPositions();r.forEach(function(b){n.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:b,memberId:k,timeStamp:c})});n.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"ApplyDirectStyling",memberid:k,timestamp:c,position:b,length:e,setProperties:p}}};ops.OpApplyHyperlink=function(){function f(b){for(;b;){if(n.isHyperlink(b))return!0;b=b.parentNode}return!1}var k,c,b,e,p,h=new core.DomUtils,n=new odf.OdfUtils;this.init=function(f){k=f.memberid;c=f.timestamp;b=f.position;e=f.length;p=f.hyperlink};this.isEdit=!0;this.group=void 0;this.execute=function(s){var l=s.getDOMDocument(),r=s.convertCursorToDomRange(b,e),d=h.splitBoundaries(r),a=[],m=n.getTextNodes(r,!1);if(0===m.length)return!1;m.forEach(function(b){var d=n.getParagraphElement(b);runtime.assert(!1===
f(b),"The given range should not contain any link.");var c=p,e=l.createElementNS(odf.Namespaces.textns,"text:a");e.setAttributeNS(odf.Namespaces.xlinkns,"xlink:type","simple");e.setAttributeNS(odf.Namespaces.xlinkns,"xlink:href",c);b.parentNode.insertBefore(e,b);e.appendChild(b);-1===a.indexOf(d)&&a.push(d)});d.forEach(h.normalizeTextNodes);r.detach();s.fixCursorPositions();s.getOdfCanvas().refreshSize();s.getOdfCanvas().rerenderAnnotations();a.forEach(function(a){s.emit(ops.OdtDocument.signalParagraphChanged,
{paragraphElement:a,memberId:k,timeStamp:c})});return!0};this.spec=function(){return{optype:"ApplyHyperlink",memberid:k,timestamp:c,position:b,length:e,hyperlink:p}}};ops.OpInsertImage=function(){var f,k,c,b,e,p,h,n,s=odf.Namespaces.drawns,l=odf.Namespaces.svgns,r=odf.Namespaces.textns,d=odf.Namespaces.xlinkns;this.init=function(a){f=a.memberid;k=a.timestamp;c=a.position;b=a.filename;e=a.frameWidth;p=a.frameHeight;h=a.frameStyleName;n=a.frameName};this.isEdit=!0;this.group=void 0;this.execute=function(a){var m=a.getOdfCanvas(),g=a.getTextNodeAtStep(c,f),x,v;if(!g)return!1;x=g.textNode;v=a.getParagraphElement(x);var g=g.offset!==x.length?x.splitText(g.offset):x.nextSibling,
z=a.getDOMDocument(),y=z.createElementNS(s,"draw:image"),z=z.createElementNS(s,"draw:frame");y.setAttributeNS(d,"xlink:href",b);y.setAttributeNS(d,"xlink:type","simple");y.setAttributeNS(d,"xlink:show","embed");y.setAttributeNS(d,"xlink:actuate","onLoad");z.setAttributeNS(s,"draw:style-name",h);z.setAttributeNS(s,"draw:name",n);z.setAttributeNS(r,"text:anchor-type","as-char");z.setAttributeNS(l,"svg:width",e);z.setAttributeNS(l,"svg:height",p);z.appendChild(y);x.parentNode.insertBefore(z,g);a.emit(ops.OdtDocument.signalStepsInserted,
{position:c});0===x.length&&x.parentNode.removeChild(x);m.addCssForFrameWithImage(z);m.refreshCSS();a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:v,memberId:f,timeStamp:k});m.rerenderAnnotations();return!0};this.spec=function(){return{optype:"InsertImage",memberid:f,timestamp:k,filename:b,position:c,frameWidth:e,frameHeight:p,frameStyleName:h,frameName:n}}};ops.OpInsertTable=function(){function f(c,d){var a;if(1===l.length)a=l[0];else if(3===l.length)switch(c){case 0:a=l[0];break;case b-1:a=l[2];break;default:a=l[1]}else a=l[c];if(1===a.length)return a[0];if(3===a.length)switch(d){case 0:return a[0];case e-1:return a[2];default:return a[1]}return a[d]}var k,c,b,e,p,h,n,s,l;this.init=function(f){k=f.memberid;c=f.timestamp;p=f.position;b=f.initialRows;e=f.initialColumns;h=f.tableName;n=f.tableStyleName;s=f.tableColumnStyleName;l=f.tableCellStyleMatrix};
this.isEdit=!0;this.group=void 0;this.execute=function(l){var d=l.getTextNodeAtStep(p),a=l.getRootNode();if(d){var m=l.getDOMDocument(),g=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),x=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column"),v,z,y,t;n&&g.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",n);h&&g.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",h);x.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0",
"table:number-columns-repeated",e);s&&x.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",s);g.appendChild(x);for(y=0;y<b;y+=1){x=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-row");for(t=0;t<e;t+=1)v=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-cell"),(z=f(y,t))&&v.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",z),z=m.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0",
"text:p"),v.appendChild(z),x.appendChild(v);g.appendChild(x)}d=l.getParagraphElement(d.textNode);a.insertBefore(g,d.nextSibling);l.emit(ops.OdtDocument.signalStepsInserted,{position:p});l.getOdfCanvas().refreshSize();l.emit(ops.OdtDocument.signalTableAdded,{tableElement:g,memberId:k,timeStamp:c});l.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertTable",memberid:k,timestamp:c,position:p,initialRows:b,initialColumns:e,tableName:h,tableStyleName:n,tableColumnStyleName:s,
tableCellStyleMatrix:l}}};ops.OpInsertText=function(){var f,k,c,b,e,p=new odf.OdfUtils;this.init=function(h){f=h.memberid;k=h.timestamp;c=h.position;e=h.text;b="true"===h.moveCursor||!0===h.moveCursor};this.isEdit=!0;this.group=void 0;this.execute=function(h){var n,s,l,r=null,d=h.getDOMDocument(),a,m=0,g,x=h.getCursor(f),v;h.upgradeWhitespacesAtPosition(c);if(n=h.getTextNodeAtStep(c)){s=n.textNode;r=s.nextSibling;l=s.parentNode;a=h.getParagraphElement(s);for(v=0;v<e.length;v+=1)if("\t"===e[v]||"\t"!==e[v]&&p.isODFWhitespace(e[v])&&
(0===v||v===e.length-1||"\t"!==e[v-1]&&p.isODFWhitespace(e[v-1])))0===m?(n.offset!==s.length&&(r=s.splitText(n.offset)),0<v&&s.appendData(e.substring(0,v))):m<v&&(m=e.substring(m,v),l.insertBefore(d.createTextNode(m),r)),m=v+1,"\t"===e[v]?(g=d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:tab"),g.appendChild(d.createTextNode("\t"))):(" "!==e[v]&&runtime.log("WARN: InsertText operation contains non-tab, non-space whitespace character (character code "+e.charCodeAt(v)+")"),
g=d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s"),g.appendChild(d.createTextNode(" "))),l.insertBefore(g,r);0===m?s.insertData(n.offset,e):m<e.length&&(n=e.substring(m),l.insertBefore(d.createTextNode(n),r));l=s.parentNode;r=s.nextSibling;l.removeChild(s);l.insertBefore(s,r);0===s.length&&s.parentNode.removeChild(s);h.emit(ops.OdtDocument.signalStepsInserted,{position:c});x&&b&&(h.moveCursor(f,c+e.length,0),h.emit(ops.Document.signalCursorMoved,x));h.downgradeWhitespacesAtPosition(c);
h.downgradeWhitespacesAtPosition(c+e.length);h.getOdfCanvas().refreshSize();h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:f,timeStamp:k});h.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertText",memberid:f,timestamp:k,position:c,text:e,moveCursor:b}}};odf.CollapsingRules=function(f){function k(c){return b.isODFNode(c)||"br"===c.localName&&b.isLineBreak(c.parentNode)||c.nodeType===Node.TEXT_NODE&&b.isODFNode(c.parentNode)}function c(p){var h;p.nodeType===Node.TEXT_NODE?(h=p.parentNode,h.removeChild(p)):h=e.removeUnwantedNodes(p,k);return h&&!b.isParagraph(h)&&h!==f&&b.hasNoODFContent(h)?c(h):h}var b=new odf.OdfUtils,e=new core.DomUtils;this.mergeChildrenIntoParent=c};ops.OpMergeParagraph=function(){function f(a){a.collapsed||(r.splitBoundaries(a),a=l.getTextElements(a,!1,!0),a.forEach(function(a){runtime.assert(a.nodeType===Node.TEXT_NODE,"Expected node type 3 (Node.TEXT_NODE), found node type "+a.nodeType);0<a.length?(runtime.assert(l.isODFWhitespace(a.data),"Non-whitespace node found between paragraph boundary and first or last step"),runtime.assert(!1===l.isSignificantWhitespace(a,0),"Significant whitespace node found between paragraph boundary and first or last step")):
runtime.log("WARN: Empty text node found during merge operation");a.parentNode.removeChild(a)}))}function k(a,b){var d=b.ownerDocument.createRange();a.setPosition(b,0);a.roundToNextStep();d.setStart(b,0);d.setEnd(a.container(),a.offset());f(d);a.setPosition(b,b.childNodes.length);a.roundToPreviousStep();d.setStart(a.container(),a.offset());d.setEnd(b,b.childNodes.length);f(d)}function c(a,b){var d=a.convertCursorStepToDomPoint(b),d=l.getParagraphElement(d.node,d.offset);runtime.assert(Boolean(d),
"Paragraph not found at step "+b);return d}var b,e,p,h,n,s,l=new odf.OdfUtils,r=new core.DomUtils,d=odf.Namespaces.textns;this.init=function(a){b=a.memberid;e=a.timestamp;p=a.moveCursor;h=a.paragraphStyleName;n=parseInt(a.sourceStartPosition,10);s=parseInt(a.destinationStartPosition,10)};this.isEdit=!0;this.group=void 0;this.execute=function(a){var f,g,x=a.getCursor(b);f=a.getRootNode();var v=new odf.CollapsingRules(f),z=a.createStepIterator(f,0,[a.getPositionFilter()],f),y;runtime.assert(s<n,"Destination paragraph ("+
s+") must be before source paragraph ("+n+")");g=c(a,s);f=c(a,n);z.setPosition(f,0);z.previousStep();runtime.assert(r.containsNode(g,z.container()),"Destination paragraph must be adjacent to the source paragraph");k(z,g);y=g.childNodes.length;k(z,f);var t;for(t=f.firstChild;t;)"editinfo"===t.localName||l.isGroupingElement(t)&&l.hasNoODFContent(t)?f.removeChild(t):g.appendChild(t),t=f.firstChild;v.mergeChildrenIntoParent(f);a.emit(ops.OdtDocument.signalStepsRemoved,{position:n-1});z.setPosition(g,
y);z.roundToClosestStep();z.previousStep()||z.roundToNextStep();a.downgradeWhitespaces(z);h?g.setAttributeNS(d,"text:style-name",h):g.removeAttributeNS(d,"style-name");x&&p&&(a.moveCursor(b,n-1,0),a.emit(ops.Document.signalCursorMoved,x));a.fixCursorPositions();a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:b,timeStamp:e});a.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"MergeParagraph",memberid:b,timestamp:e,
moveCursor:p,paragraphStyleName:h,sourceStartPosition:n,destinationStartPosition:s}}};ops.OpMoveCursor=function(){var f,k,c,b,e;this.init=function(p){f=p.memberid;k=p.timestamp;c=p.position;b=p.length||0;e=p.selectionType||ops.OdtCursor.RangeSelection};this.isEdit=!1;this.group=void 0;this.execute=function(p){var h=p.getCursor(f),n;if(!h)return!1;n=p.convertCursorToDomRange(c,b);h.setSelectedRange(n,0<=b);h.setSelectionType(e);p.emit(ops.Document.signalCursorMoved,h);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:f,timestamp:k,position:c,length:b,selectionType:e}}};ops.OpRemoveAnnotation=function(){var f,k,c,b,e;this.init=function(p){f=p.memberid;k=p.timestamp;c=parseInt(p.position,10);b=parseInt(p.length,10);e=new core.DomUtils};this.isEdit=!0;this.group=void 0;this.execute=function(b){function f(b){k.parentNode.insertBefore(b,k)}for(var n=b.getIteratorAtPosition(c).container(),k;n.namespaceURI!==odf.Namespaces.officens||"annotation"!==n.localName;)n=n.parentNode;if(null===n)return!1;k=n;n=k.annotationEndElement;b.getOdfCanvas().forgetAnnotations();e.getElementsByTagNameNS(k,
"urn:webodf:names:cursor","cursor").forEach(f);e.getElementsByTagNameNS(k,"urn:webodf:names:cursor","anchor").forEach(f);k.parentNode.removeChild(k);n&&n.parentNode.removeChild(n);b.emit(ops.OdtDocument.signalStepsRemoved,{position:0<c?c-1:c});b.fixCursorPositions();b.getOdfCanvas().refreshAnnotations();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:f,timestamp:k,position:c,length:b}}};ops.OpRemoveBlob=function(){var f,k,c;this.init=function(b){f=b.memberid;k=b.timestamp;c=b.filename};this.isEdit=!0;this.group=void 0;this.execute=function(b){b.getOdfCanvas().odfContainer().removeBlob(c);return!0};this.spec=function(){return{optype:"RemoveBlob",memberid:f,timestamp:k,filename:c}}};ops.OpRemoveCursor=function(){var f,k;this.init=function(c){f=c.memberid;k=c.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(c){return c.removeCursor(f)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:f,timestamp:k}}};ops.OpRemoveHyperlink=function(){var f,k,c,b,e=new core.DomUtils,p=new odf.OdfUtils;this.init=function(e){f=e.memberid;k=e.timestamp;c=e.position;b=e.length};this.isEdit=!0;this.group=void 0;this.execute=function(h){var n=h.convertCursorToDomRange(c,b),s=p.getHyperlinkElements(n);runtime.assert(1===s.length,"The given range should only contain a single link.");s=e.mergeIntoParent(s[0]);n.detach();h.fixCursorPositions();h.getOdfCanvas().refreshSize();h.getOdfCanvas().rerenderAnnotations();h.emit(ops.OdtDocument.signalParagraphChanged,
{paragraphElement:p.getParagraphElement(s),memberId:f,timeStamp:k});return!0};this.spec=function(){return{optype:"RemoveHyperlink",memberid:f,timestamp:k,position:c,length:b}}};ops.OpRemoveMember=function(){var f,k;this.init=function(c){f=c.memberid;k=parseInt(c.timestamp,10)};this.isEdit=!1;this.group=void 0;this.execute=function(c){if(!c.getMember(f))return!1;c.removeMember(f);c.emit(ops.Document.signalMemberRemoved,f);return!0};this.spec=function(){return{optype:"RemoveMember",memberid:f,timestamp:k}}};ops.OpRemoveStyle=function(){var f,k,c,b;this.init=function(e){f=e.memberid;k=e.timestamp;c=e.styleName;b=e.styleFamily};this.isEdit=!0;this.group=void 0;this.execute=function(e){var f=e.getStyleElement(c,b);if(!f)return!1;f.parentNode.removeChild(f);e.getOdfCanvas().refreshCSS();e.emit(ops.OdtDocument.signalCommonStyleDeleted,{name:c,family:b});return!0};this.spec=function(){return{optype:"RemoveStyle",memberid:f,timestamp:k,styleName:c,styleFamily:b}}};ops.OpRemoveText=function(){var f,k,c,b,e,p;this.init=function(h){runtime.assert(0<=h.length,"OpRemoveText only supports positive lengths");f=h.memberid;k=h.timestamp;c=parseInt(h.position,10);b=parseInt(h.length,10);e=new odf.OdfUtils;p=new core.DomUtils};this.isEdit=!0;this.group=void 0;this.execute=function(h){var n,s,l,r=h.getCursor(f),d=new odf.CollapsingRules(h.getRootNode());h.upgradeWhitespacesAtPosition(c);h.upgradeWhitespacesAtPosition(c+b);n=h.convertCursorToDomRange(c,b);p.splitBoundaries(n);
s=e.getTextElements(n,!1,!0);l=e.getParagraphElement(n.startContainer,n.startOffset);runtime.assert(void 0!==l,"Attempting to remove text outside a paragraph element");n.detach();s.forEach(function(a){a.parentNode?(runtime.assert(p.containsNode(l,a),"RemoveText only supports removing elements within the same paragraph"),d.mergeChildrenIntoParent(a)):runtime.log("WARN: text element has already been removed from it's container")});h.emit(ops.OdtDocument.signalStepsRemoved,{position:c});h.downgradeWhitespacesAtPosition(c);
h.fixCursorPositions();h.getOdfCanvas().refreshSize();h.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:l,memberId:f,timeStamp:k});r&&(r.resetSelectionType(),h.emit(ops.Document.signalCursorMoved,r));h.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"RemoveText",memberid:f,timestamp:k,position:c,length:b}}};ops.OpSetBlob=function(){var f,k,c,b,e;this.init=function(p){f=p.memberid;k=p.timestamp;c=p.filename;b=p.mimetype;e=p.content};this.isEdit=!0;this.group=void 0;this.execute=function(f){f.getOdfCanvas().odfContainer().setBlob(c,b,e);return!0};this.spec=function(){return{optype:"SetBlob",memberid:f,timestamp:k,filename:c,mimetype:b,content:e}}};ops.OpSetParagraphStyle=function(){function f(b,c,e){var f=[b.getPositionFilter()],l=e.container();e=e.unfilteredDomOffset();return!1===b.createStepIterator(l,e,f,c).previousStep()}var k,c,b,e;this.init=function(f){k=f.memberid;c=f.timestamp;b=f.position;e=f.styleName};this.isEdit=!0;this.group=void 0;this.execute=function(p){var h,n;h=p.getIteratorAtPosition(b);return(n=p.getParagraphElement(h.container()))?(runtime.assert(f(p,n,h),"SetParagraphStyle position should be the first position in the paragraph"),
e?n.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",e):n.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),p.getOdfCanvas().refreshSize(),p.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:n,timeStamp:c,memberId:k}),p.getOdfCanvas().rerenderAnnotations(),!0):!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:k,timestamp:c,position:b,styleName:e}}};ops.OpSplitParagraph=function(){var f,k,c,b,e,p,h,n=odf.Namespaces.textns;this.init=function(n){f=n.memberid;k=n.timestamp;b=n.position;c=n.sourceParagraphPosition;p=n.paragraphStyleName;e="true"===n.moveCursor||!0===n.moveCursor;h=new odf.OdfUtils};this.isEdit=!0;this.group=void 0;this.execute=function(c){var l,r,d,a,m,g,x,v=c.getCursor(f);c.upgradeWhitespacesAtPosition(b);l=c.getTextNodeAtStep(b);if(!l)return!1;r=c.getParagraphElement(l.textNode);if(!r)return!1;d=h.isListItem(r.parentNode)?r.parentNode:
r;0===l.offset?(x=l.textNode.previousSibling,g=null):(x=l.textNode,g=l.offset>=l.textNode.length?null:l.textNode.splitText(l.offset));for(a=l.textNode;a!==d;){a=a.parentNode;m=a.cloneNode(!1);g&&m.appendChild(g);if(x)for(;x&&x.nextSibling;)m.appendChild(x.nextSibling);else for(;a.firstChild;)m.appendChild(a.firstChild);a.parentNode.insertBefore(m,a.nextSibling);x=a;g=m}h.isListItem(g)&&(g=g.childNodes.item(0));p?g.setAttributeNS(n,"text:style-name",p):g.removeAttributeNS(n,"style-name");0===l.textNode.length&&
l.textNode.parentNode.removeChild(l.textNode);c.emit(ops.OdtDocument.signalStepsInserted,{position:b});v&&e&&(c.moveCursor(f,b+1,0),c.emit(ops.Document.signalCursorMoved,v));c.fixCursorPositions();c.getOdfCanvas().refreshSize();c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:f,timeStamp:k});c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});c.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",
memberid:f,timestamp:k,position:b,sourceParagraphPosition:c,paragraphStyleName:p,moveCursor:e}}};ops.OpUpdateMember=function(){function f(c){var e="//dc:creator[@editinfo:memberid='"+k+"']";c=xmldom.XPath.getODFElementsWithXPath(c.getRootNode(),e,function(b){return"editinfo"===b?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(b)});for(e=0;e<c.length;e+=1)c[e].textContent=b.fullName}var k,c,b,e;this.init=function(f){k=f.memberid;c=parseInt(f.timestamp,10);b=f.setProperties;e=f.removedProperties};this.isEdit=!1;this.group=void 0;this.execute=function(c){var h=c.getMember(k);if(!h)return!1;
e&&h.removeProperties(e);b&&(h.setProperties(b),b.fullName&&f(c));c.emit(ops.Document.signalMemberUpdated,h);return!0};this.spec=function(){return{optype:"UpdateMember",memberid:k,timestamp:c,setProperties:b,removedProperties:e}}};ops.OpUpdateMetadata=function(){var f,k,c,b;this.init=function(e){f=e.memberid;k=parseInt(e.timestamp,10);c=e.setProperties;b=e.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(e){e=e.getOdfCanvas().odfContainer();var f=null;b&&(f=b.attributes.split(","));e.setMetadata(c,f);return!0};this.spec=function(){return{optype:"UpdateMetadata",memberid:f,timestamp:k,setProperties:c,removedProperties:b}}};ops.OpUpdateParagraphStyle=function(){function f(b,c){var e,f,d=c?c.split(","):[];for(e=0;e<d.length;e+=1)f=d[e].split(":"),b.removeAttributeNS(odf.Namespaces.lookupNamespaceURI(f[0]),f[1])}var k,c,b,e,p,h=odf.Namespaces.stylens;this.init=function(f){k=f.memberid;c=f.timestamp;b=f.styleName;e=f.setProperties;p=f.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(c){var k=c.getFormatting(),l,r,d;return(l=""!==b?c.getParagraphStyleElement(b):k.getDefaultStyleElement("paragraph"))?
(r=l.getElementsByTagNameNS(h,"paragraph-properties").item(0),d=l.getElementsByTagNameNS(h,"text-properties").item(0),e&&k.updateStyle(l,e),p&&(k=p["style:paragraph-properties"],r&&k&&(f(r,k.attributes),0===r.attributes.length&&l.removeChild(r)),k=p["style:text-properties"],d&&k&&(f(d,k.attributes),0===d.attributes.length&&l.removeChild(d)),f(l,p.attributes)),c.getOdfCanvas().refreshCSS(),c.emit(ops.OdtDocument.signalParagraphStyleModified,b),c.getOdfCanvas().rerenderAnnotations(),!0):!1};this.spec=
function(){return{optype:"UpdateParagraphStyle",memberid:k,timestamp:c,styleName:b,setProperties:e,removedProperties:p}}};ops.OperationFactory=function(){function f(c){return function(b){return new c}}var k;this.register=function(c,b){k[c]=b};this.create=function(c){var b=null,e=k[c.optype];e&&(b=e(c),b.init(c));return b};k={AddMember:f(ops.OpAddMember),UpdateMember:f(ops.OpUpdateMember),RemoveMember:f(ops.OpRemoveMember),AddCursor:f(ops.OpAddCursor),ApplyDirectStyling:f(ops.OpApplyDirectStyling),SetBlob:f(ops.OpSetBlob),RemoveBlob:f(ops.OpRemoveBlob),InsertImage:f(ops.OpInsertImage),InsertTable:f(ops.OpInsertTable),
InsertText:f(ops.OpInsertText),RemoveText:f(ops.OpRemoveText),MergeParagraph:f(ops.OpMergeParagraph),SplitParagraph:f(ops.OpSplitParagraph),SetParagraphStyle:f(ops.OpSetParagraphStyle),UpdateParagraphStyle:f(ops.OpUpdateParagraphStyle),AddStyle:f(ops.OpAddStyle),RemoveStyle:f(ops.OpRemoveStyle),MoveCursor:f(ops.OpMoveCursor),RemoveCursor:f(ops.OpRemoveCursor),AddAnnotation:f(ops.OpAddAnnotation),RemoveAnnotation:f(ops.OpRemoveAnnotation),UpdateMetadata:f(ops.OpUpdateMetadata),ApplyHyperlink:f(ops.OpApplyHyperlink),
RemoveHyperlink:f(ops.OpRemoveHyperlink)}};ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(f){};ops.OperationRouter.prototype.setPlaybackFunction=function(f){};ops.OperationRouter.prototype.push=function(f){};ops.OperationRouter.prototype.close=function(f){};ops.OperationRouter.prototype.subscribe=function(f,k){};ops.OperationRouter.prototype.unsubscribe=function(f,k){};ops.OperationRouter.prototype.hasLocalUnsyncedOps=function(){};ops.OperationRouter.prototype.hasSessionHostConnection=function(){};
ops.OperationRouter.signalProcessingBatchStart="router/batchstart";ops.OperationRouter.signalProcessingBatchEnd="router/batchend";ops.TrivialOperationRouter=function(){var f=new core.EventNotifier([ops.OperationRouter.signalProcessingBatchStart,ops.OperationRouter.signalProcessingBatchEnd]),k,c,b=0;this.setOperationFactory=function(b){k=b};this.setPlaybackFunction=function(b){c=b};this.push=function(e){b+=1;f.emit(ops.OperationRouter.signalProcessingBatchStart,{});e.forEach(function(e){e=e.spec();e.timestamp=Date.now();e=k.create(e);e.group="g"+b;c(e)});f.emit(ops.OperationRouter.signalProcessingBatchEnd,{})};this.close=function(b){b()};
this.subscribe=function(b,c){f.subscribe(b,c)};this.unsubscribe=function(b,c){f.unsubscribe(b,c)};this.hasLocalUnsyncedOps=function(){return!1};this.hasSessionHostConnection=function(){return!0}};ops.Session=function(f){function k(b){e.emit(ops.OdtDocument.signalProcessingBatchStart,b)}function c(b){e.emit(ops.OdtDocument.signalProcessingBatchEnd,b)}var b=new ops.OperationFactory,e=new ops.OdtDocument(f),p=null;this.setOperationFactory=function(c){b=c;p&&p.setOperationFactory(b)};this.setOperationRouter=function(f){p&&(p.unsubscribe(ops.OperationRouter.signalProcessingBatchStart,k),p.unsubscribe(ops.OperationRouter.signalProcessingBatchEnd,c));p=f;p.subscribe(ops.OperationRouter.signalProcessingBatchStart,
k);p.subscribe(ops.OperationRouter.signalProcessingBatchEnd,c);f.setPlaybackFunction(function(b){e.emit(ops.OdtDocument.signalOperationStart,b);return b.execute(e)?(e.emit(ops.OdtDocument.signalOperationEnd,b),!0):!1});f.setOperationFactory(b)};this.getOperationFactory=function(){return b};this.getOdtDocument=function(){return e};this.enqueue=function(b){p.push(b)};this.close=function(b){p.close(function(c){c?b(c):e.close(b)})};this.destroy=function(b){e.destroy(b)};this.setOperationRouter(new ops.TrivialOperationRouter)};gui.AnnotationController=function(f,k,c){function b(){var b=n.getCursor(c),b=b&&b.getNode(),a=!1;b&&(a=!r.isWithinAnnotation(b,n.getRootNode()));a!==s&&(s=a,l.emit(gui.AnnotationController.annotatableChanged,s))}function e(d){d.getMemberId()===c&&b()}function p(d){d===c&&b()}function h(d){d.getMemberId()===c&&b()}var n=f.getOdtDocument(),s=!1,l=new core.EventNotifier([gui.AnnotationController.annotatableChanged]),r=new odf.OdfUtils;this.isAnnotatable=function(){return s};this.addAnnotation=function(){var b=
new ops.OpAddAnnotation,a=n.getCursorSelection(c),e=a.length,a=a.position;s&&(a=0<=e?a:a+e,e=Math.abs(e),b.init({memberid:c,position:a,length:e,name:c+Date.now()}),f.enqueue([b]))};this.removeAnnotation=function(b){var a,e;a=n.getMember(c).getProperties().fullName;if(!0!==k.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)||a===r.getAnnotationCreator(b))a=n.convertDomPointToCursorStep(b,0)+1,e=n.convertDomPointToCursorStep(b,b.childNodes.length),b=new ops.OpRemoveAnnotation,b.init({memberid:c,
position:a,length:e-a}),e=new ops.OpMoveCursor,e.init({memberid:c,position:0<a?a-1:a,length:0}),f.enqueue([b,e])};this.subscribe=function(b,a){l.subscribe(b,a)};this.unsubscribe=function(b,a){l.unsubscribe(b,a)};this.destroy=function(b){n.unsubscribe(ops.Document.signalCursorAdded,e);n.unsubscribe(ops.Document.signalCursorRemoved,p);n.unsubscribe(ops.Document.signalCursorMoved,h);b()};k.registerConstraint(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN);n.subscribe(ops.Document.signalCursorAdded,
e);n.subscribe(ops.Document.signalCursorRemoved,p);n.subscribe(ops.Document.signalCursorMoved,h);b()};gui.AnnotationController.annotatableChanged="annotatable/changed";gui.Avatar=function(f,k){var c=this,b,e,p;this.setColor=function(b){e.style.borderColor=b};this.setImageUrl=function(b){c.isVisible()?e.src=b:p=b};this.isVisible=function(){return"block"===b.style.display};this.show=function(){p&&(e.src=p,p=void 0);b.style.display="block"};this.hide=function(){b.style.display="none"};this.markAsFocussed=function(c){c?b.classList.add("active"):b.classList.remove("active")};this.destroy=function(c){f.removeChild(b);c()};(function(){var c=f.ownerDocument,n=c.documentElement.namespaceURI;
b=c.createElementNS(n,"div");e=c.createElementNS(n,"img");e.width=64;e.height=64;b.appendChild(e);b.style.width="64px";b.style.height="70px";b.style.position="absolute";b.style.top="-80px";b.style.left="-34px";b.style.display=k?"block":"none";b.className="handle";f.appendChild(b)})()};gui.GuiStepUtils=function(){var f=new odf.OdfUtils,k=new odf.StepUtils,c=new core.DomUtils;this.getContentRect=function(b){b=k.getContentBounds(b);var e,p=null;if(b)if(b.container.nodeType===Node.TEXT_NODE)e=b.container.ownerDocument.createRange(),e.setStart(b.container,b.startOffset),e.setEnd(b.container,b.endOffset),(p=0<e.getClientRects().length?e.getBoundingClientRect():null)&&" "===b.container.data.substring(b.startOffset,b.endOffset)&&1>=p.width&&(p=null),e.detach();else if(f.isCharacterElement(b.container)||
f.isCharacterFrame(b.container))p=c.getBoundingClientRect(b.container);return p}};gui.Caret=function(f,k,c){function b(){l.style.opacity="0"===l.style.opacity?"1":"0";t.trigger()}function e(){m.selectNodeContents(a);return m.getBoundingClientRect()}function p(){Object.keys(I).forEach(function(a){D[a]=I[a]})}function h(){var a,b,h,m;if(!1===I.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!c&&!f.getSelectedRange().collapsed)I.visibility="hidden",l.style.visibility="hidden",t.cancel();else{I.visibility="visible";l.style.visibility="visible";if(!1===I.isFocused)l.style.opacity=
"1",t.cancel();else{if(u||D.visibility!==I.visibility)l.style.opacity="1",t.cancel();t.trigger()}if(B||w||D.visibility!==I.visibility){a=f.getNode();var k;h=x.getBoundingClientRect(g.getSizer());m=!1;if(0<a.getClientRects().length)k=e(),m=!0;else if(z.setPosition(a,0),k=v.getContentRect(z),!k&&z.nextStep()&&(b=v.getContentRect(z))&&(k=b,m=!0),k||(a.setAttributeNS("urn:webodf:names:cursor","caret-sizer-active","true"),k=e(),m=!0),!k)for(runtime.log("WARN: No suitable client rectangle found for visual caret for "+
f.getMemberId());a;){if(0<a.getClientRects().length){k=x.getBoundingClientRect(a);m=!0;break}a=a.parentNode}k=x.translateRect(k,h,g.getZoomLevel());a={top:k.top,height:k.height,right:m?k.left:k.right};8>a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});s.style.height=a.height+"px";s.style.top=a.top+"px";s.style.left=a.right+"px";d&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?d.style.font=a.font:(d.style.fontStyle=a.fontStyle,d.style.fontVariant=a.fontVariant,d.style.fontWeight=
a.fontWeight,d.style.fontSize=a.fontSize,d.style.lineHeight=a.lineHeight,d.style.fontFamily=a.fontFamily))}if(w){k=f.getDocument().getCanvas().getElement().parentNode;var n;h=k.offsetWidth-k.clientWidth+5;m=k.offsetHeight-k.clientHeight+5;n=l.getBoundingClientRect();a=n.left-h;b=n.top-m;h=n.right+h;m=n.bottom+m;n=k.getBoundingClientRect();b<n.top?k.scrollTop-=n.top-b:m>n.bottom&&(k.scrollTop+=m-n.bottom);a<n.left?k.scrollLeft-=n.left-a:h>n.right&&(k.scrollLeft+=h-n.right)}}D.isFocused!==I.isFocused&&
r.markAsFocussed(I.isFocused);p();B=w=u=!1}function n(b){s.parentNode.removeChild(s);a.parentNode.removeChild(a);b()}var s,l,r,d,a,m,g=f.getDocument().getCanvas(),x=new core.DomUtils,v=new gui.GuiStepUtils,z,y,t,u=!1,w=!1,B=!1,I={isFocused:!1,isShown:!0,visibility:"hidden"},D={isFocused:!I.isFocused,isShown:!I.isShown,visibility:"hidden"};this.handleUpdate=function(){B=!0;"hidden"!==I.visibility&&(I.visibility="hidden",l.style.visibility="hidden",f.getNode().removeAttributeNS("urn:webodf:names:cursor",
"caret-sizer-active"));y.trigger()};this.refreshCursorBlinking=function(){u=!0;y.trigger()};this.setFocus=function(){I.isFocused=!0;y.trigger()};this.removeFocus=function(){I.isFocused=!1;y.trigger()};this.show=function(){I.isShown=!0;y.trigger()};this.hide=function(){I.isShown=!1;y.trigger()};this.setAvatarImageUrl=function(a){r.setImageUrl(a)};this.setColor=function(a){l.style.borderColor=a;r.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return l};this.toggleHandleVisibility=
function(){r.isVisible()?r.hide():r.show()};this.showHandle=function(){r.show()};this.hideHandle=function(){r.hide()};this.setOverlayElement=function(a){d=a;s.appendChild(a);B=!0;y.trigger()};this.ensureVisible=function(){w=!0;y.trigger()};this.destroy=function(a){core.Async.destroyAll([y.destroy,t.destroy,r.destroy,n],a)};(function(){var d=f.getDocument(),c=[d.createRootFilter(f.getMemberId()),d.getPositionFilter()],e=d.getDOMDocument();m=e.createRange();a=e.createElement("span");a.className="webodf-caretSizer";
a.textContent="|";f.getNode().appendChild(a);s=e.createElement("div");s.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());s.className="webodf-caretOverlay";l=e.createElement("div");l.className="caret";s.appendChild(l);r=new gui.Avatar(s,k);g.getSizer().appendChild(s);z=d.createStepIterator(f.getNode(),0,c,d.getRootNode());y=core.Task.createRedrawTask(h);t=core.Task.createTimeoutTask(b,500);y.triggerImmediate()})()};odf.TextSerializer=function(){function f(b){var e="",p=k.filter?k.filter.acceptNode(b):NodeFilter.FILTER_ACCEPT,h=b.nodeType,n;if((p===NodeFilter.FILTER_ACCEPT||p===NodeFilter.FILTER_SKIP)&&c.isTextContentContainingNode(b))for(n=b.firstChild;n;)e+=f(n),n=n.nextSibling;p===NodeFilter.FILTER_ACCEPT&&(h===Node.ELEMENT_NODE&&c.isParagraph(b)?e+="\n":h===Node.TEXT_NODE&&b.textContent&&(e+=b.textContent));return e}var k=this,c=new odf.OdfUtils;this.filter=null;this.writeToString=function(b){if(!b)return"";
b=f(b);"\n"===b[b.length-1]&&(b=b.substr(0,b.length-1));return b}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,c){var b;b=c.startContainer.ownerDocument.createElement("span");b.appendChild(c.cloneContents());b=f.writeToString(b);try{k.setData("text/plain",b)}catch(e){k.setData("Text",b)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,c){var b,e=k.clipboardData;b=runtime.getWindow();!e&&b&&(e=b.clipboardData);e?(b=!0,f.exportRangeToDataTransfer(e,c),k.preventDefault()):b=!1;return b}};gui.SessionContext=function(f,k){var c=f.getOdtDocument(),b=new odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var e=c.getCursor(k),f;if(!e)return!1;f=e&&e.getNode();e=c.getMember(k).getProperties().fullName;return(f=b.getParentAnnotation(f,c.getRootNode()))&&b.getAnnotationCreator(f)===e?!0:!1}};gui.StyleSummary=function(f){function k(b,c){var k=b+"|"+c,s;e.hasOwnProperty(k)||(s=[],f.forEach(function(e){e=(e=e.styleProperties[b])&&e[c];-1===s.indexOf(e)&&s.push(e)}),e[k]=s);return e[k]}function c(b,c,e){return function(){var f=k(b,c);return e.length>=f.length&&f.every(function(b){return-1!==e.indexOf(b)})}}function b(b,c){var e=k(b,c);return 1===e.length?e[0]:void 0}var e={};this.getPropertyValues=k;this.getCommonValue=b;this.isBold=c("style:text-properties","fo:font-weight",["bold"]);this.isItalic=
c("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=c("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=c("style:text-properties","style:text-line-through-style",["solid"]);this.fontSize=function(){var c=b("style:text-properties","fo:font-size");return c&&parseFloat(c)};this.fontName=function(){return b("style:text-properties","style:font-name")};this.isAlignedLeft=c("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter=
c("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=c("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=c("style:paragraph-properties","fo:text-align",["justify"]);this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName};this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight,
isAlignedJustified:this.isAlignedJustified}};gui.DirectFormattingController=function(f,k,c,b,e,p,h){function n(){return P.value().styleSummary}function s(a){var b;a.collapsed?(b=a.startContainer,b.hasChildNodes()&&a.startOffset<b.childNodes.length&&(b=b.childNodes.item(a.startOffset)),a=[b]):a=aa.getTextElements(a,!0,!1);return a}function l(){var a=H.getCursor(b),a=a&&a.getSelectedRange(),d=[],d=[],c=!0;a&&(d=s(a),0===d.length&&(d=[a.startContainer,a.endContainer],c=!1),d=H.getFormatting().getAppliedStyles(d));void 0!==d[0]&&O&&(d[0]=Y.mergeObjects(d[0],
O));return{containsText:c,appliedStyles:d,styleSummary:new gui.StyleSummary(d)}}function r(a,b){var d={};Object.keys(a).forEach(function(c){var e=a[c](),g=b[c]();e!==g&&(d[c]=g)});return d}function d(){var a,b,d=n();a=r(A.text,d.text);b=r(A.paragraph,d.paragraph);A=d;0<Object.keys(a).length&&W.emit(gui.DirectFormattingController.textStylingChanged,a);0<Object.keys(b).length&&W.emit(gui.DirectFormattingController.paragraphStylingChanged,b)}function a(){var a={directTextStyling:!0,directParagraphStyling:!0};
!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(a.directTextStyling=a.directParagraphStyling=c.isLocalCursorWithinOwnAnnotation());a.directTextStyling&&(a.directTextStyling=P.value().containsText);if(a.directTextStyling!==J.directTextStyling||a.directParagraphStyling!==J.directParagraphStyling)J=a,W.emit(gui.DirectFormattingController.enabledChanged,J)}function m(d){("string"===typeof d?d:d.getMemberId())===b&&(P.reset(),a())}function g(){P.reset()}function x(a){var d=H.getCursor(b);a=a.paragraphElement;
d&&H.getParagraphElement(d.getNode())===a&&P.reset()}function v(a,b){b(!a());return!0}function z(a){if(J.directTextStyling){var d=H.getCursorSelection(b),c={"style:text-properties":a};0!==d.length?(a=new ops.OpApplyDirectStyling,a.init({memberid:b,position:d.position,length:d.length,setProperties:c}),f.enqueue([a])):(O=Y.mergeObjects(O||{},c),P.reset())}}function y(a,b){var d={};d[a]=b;z(d)}function t(a){a=a.spec();O&&a.memberid===b&&"SplitParagraph"!==a.optype&&(O=null,P.reset())}function u(a){y("fo:font-weight",
a?"bold":"normal")}function w(a){y("fo:font-style",a?"italic":"normal")}function B(a){y("style:text-underline-style",a?"solid":"none")}function I(a){y("style:text-line-through-style",a?"solid":"none")}function D(a){return a===ops.OdtStepsTranslator.NEXT_STEP}function F(a){if(J.directParagraphStyling){var d=H.getCursor(b).getSelectedRange(),d=aa.getParagraphElements(d),c=H.getFormatting(),g=[],h={},m;d.forEach(function(d){var f=H.convertDomPointToCursorStep(d,0,D),l=d.getAttributeNS(odf.Namespaces.textns,
"style-name"),q;d=l?h.hasOwnProperty(l)?h[l]:void 0:m;d||(d=e.generateStyleName(),l?(h[l]=d,q=c.createDerivedStyleObject(l,"paragraph",{})):(m=d,q={}),q=a(q),l=new ops.OpAddStyle,l.init({memberid:b,styleName:d.toString(),styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:q}),g.push(l));l=new ops.OpSetParagraphStyle;l.init({memberid:b,styleName:d.toString(),position:f});g.push(l)});f.enqueue(g)}}function q(a){F(function(b){return Y.mergeObjects(b,a)})}function Q(a){q({"style:paragraph-properties":{"fo:text-align":a}})}
function N(a,b){var d=H.getFormatting().getDefaultTabStopDistance(),c=b["style:paragraph-properties"],e;c&&(c=c["fo:margin-left"],e=aa.parseLength(c));return Y.mergeObjects(b,{"style:paragraph-properties":{"fo:margin-left":e&&e.unit===d.unit?e.value+a*d.value+e.unit:a*d.value+d.unit}})}function U(a,b){var d=s(a),c=H.getFormatting().getAppliedStyles(d)[0].styleProperties,e=H.getFormatting().getAppliedStylesForElement(b).styleProperties;if(!c||"text"!==c["style:family"]||!c["style:text-properties"])return!1;
if(!e||!e["style:text-properties"])return!0;c=c["style:text-properties"];e=e["style:text-properties"];return!Object.keys(c).every(function(a){return c[a]===e[a]})}function C(){}function $(){return!1}var S=this,H=f.getOdtDocument(),Y=new core.Utils,aa=new odf.OdfUtils,W=new core.EventNotifier([gui.DirectFormattingController.enabledChanged,gui.DirectFormattingController.textStylingChanged,gui.DirectFormattingController.paragraphStylingChanged]),E=odf.Namespaces.textns,G=core.PositionFilter.FilterResult.FILTER_ACCEPT,
O,A,P,J={directTextStyling:!1,directParagraphStyling:!1};this.enabledFeatures=function(){return J};this.formatTextSelection=z;this.createCursorStyleOp=function(a,d,c){var e=null;(c=c?P.value().appliedStyles[0]:O)&&c["style:text-properties"]&&(e=new ops.OpApplyDirectStyling,e.init({memberid:b,position:a,length:d,setProperties:{"style:text-properties":c["style:text-properties"]}}),O=null,P.reset());return e};this.setBold=u;this.setItalic=w;this.setHasUnderline=B;this.setHasStrikethrough=I;this.setFontSize=
function(a){y("fo:font-size",a+"pt")};this.setFontName=function(a){y("style:font-name",a)};this.getAppliedStyles=function(){return P.value().appliedStyles};this.toggleBold=v.bind(S,function(){return n().isBold()},u);this.toggleItalic=v.bind(S,function(){return n().isItalic()},w);this.toggleUnderline=v.bind(S,function(){return n().hasUnderline()},B);this.toggleStrikethrough=v.bind(S,function(){return n().hasStrikeThrough()},I);this.isBold=function(){return n().isBold()};this.isItalic=function(){return n().isItalic()};
this.hasUnderline=function(){return n().hasUnderline()};this.hasStrikeThrough=function(){return n().hasStrikeThrough()};this.fontSize=function(){return n().fontSize()};this.fontName=function(){return n().fontName()};this.isAlignedLeft=function(){return n().isAlignedLeft()};this.isAlignedCenter=function(){return n().isAlignedCenter()};this.isAlignedRight=function(){return n().isAlignedRight()};this.isAlignedJustified=function(){return n().isAlignedJustified()};this.alignParagraphLeft=function(){Q("left");
return!0};this.alignParagraphCenter=function(){Q("center");return!0};this.alignParagraphRight=function(){Q("right");return!0};this.alignParagraphJustified=function(){Q("justify");return!0};this.indent=function(){F(N.bind(null,1));return!0};this.outdent=function(){F(N.bind(null,-1));return!0};this.createParagraphStyleOps=function(a){if(!J.directParagraphStyling)return[];var d=H.getCursor(b),c=d.getSelectedRange(),g=[],f,h;d.hasForwardSelection()?(f=d.getAnchorNode(),h=d.getNode()):(f=d.getNode(),h=
d.getAnchorNode());d=H.getParagraphElement(h);runtime.assert(Boolean(d),"DirectFormattingController: Cursor outside paragraph");var m;a:{m=d;var l=gui.SelectionMover.createPositionIterator(m),q=new core.PositionFilterChain;q.addFilter(H.getPositionFilter());q.addFilter(H.createRootFilter(b));for(l.setUnfilteredPosition(c.endContainer,c.endOffset);l.nextPosition();)if(q.acceptPosition(l)===G){m=H.getParagraphElement(l.getCurrentNode())!==m;break a}m=!0}if(!m)return g;h!==f&&(d=H.getParagraphElement(f));
if(!O&&!U(c,d))return g;c=P.value().appliedStyles[0];if(!c)return g;if(f=d.getAttributeNS(E,"style-name"))c={"style:text-properties":c["style:text-properties"]},c=H.getFormatting().createDerivedStyleObject(f,"paragraph",c);d=e.generateStyleName();f=new ops.OpAddStyle;f.init({memberid:b,styleName:d,styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:c});g.push(f);f=new ops.OpSetParagraphStyle;f.init({memberid:b,styleName:d,position:a});g.push(f);return g};this.subscribe=function(a,b){W.subscribe(a,
b)};this.unsubscribe=function(a,b){W.unsubscribe(a,b)};this.destroy=function(b){H.unsubscribe(ops.Document.signalCursorAdded,m);H.unsubscribe(ops.Document.signalCursorRemoved,m);H.unsubscribe(ops.Document.signalCursorMoved,m);H.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,g);H.unsubscribe(ops.OdtDocument.signalParagraphChanged,x);H.unsubscribe(ops.OdtDocument.signalOperationEnd,t);H.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,d);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,
a);b()};(function(){H.subscribe(ops.Document.signalCursorAdded,m);H.subscribe(ops.Document.signalCursorRemoved,m);H.subscribe(ops.Document.signalCursorMoved,m);H.subscribe(ops.OdtDocument.signalParagraphStyleModified,g);H.subscribe(ops.OdtDocument.signalParagraphChanged,x);H.subscribe(ops.OdtDocument.signalOperationEnd,t);H.subscribe(ops.OdtDocument.signalProcessingBatchEnd,d);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,a);P=new core.LazyProperty(l);A=n();a();p||(S.formatTextSelection=C,S.setBold=
C,S.setItalic=C,S.setHasUnderline=C,S.setHasStrikethrough=C,S.setFontSize=C,S.setFontName=C,S.toggleBold=$,S.toggleItalic=$,S.toggleUnderline=$,S.toggleStrikethrough=$);h||(S.alignParagraphCenter=C,S.alignParagraphJustified=C,S.alignParagraphLeft=C,S.alignParagraphRight=C,S.createParagraphStyleOps=function(){return[]},S.indent=C,S.outdent=C)})()};gui.DirectFormattingController.enabledChanged="enabled/changed";gui.DirectFormattingController.textStylingChanged="textStyling/changed";
gui.DirectFormattingController.paragraphStylingChanged="paragraphStyling/changed";gui.KeyboardHandler=function(){function f(b,c){c||(c=k.None);switch(b){case gui.KeyboardHandler.KeyCode.LeftMeta:case gui.KeyboardHandler.KeyCode.RightMeta:case gui.KeyboardHandler.KeyCode.MetaInMozilla:c|=k.Meta;break;case gui.KeyboardHandler.KeyCode.Ctrl:c|=k.Ctrl;break;case gui.KeyboardHandler.KeyCode.Alt:c|=k.Alt;break;case gui.KeyboardHandler.KeyCode.Shift:c|=k.Shift}return b+":"+c}var k=gui.KeyboardHandler.Modifier,c=null,b={};this.setDefault=function(b){c=b};this.bind=function(c,k,h,n){c=f(c,
k);runtime.assert(n||!1===b.hasOwnProperty(c),"tried to overwrite the callback handler of key combo: "+c);b[c]=h};this.unbind=function(c,k){var h=f(c,k);delete b[h]};this.reset=function(){c=null;b={}};this.handleEvent=function(e){var p=e.keyCode,h=k.None;e.metaKey&&(h|=k.Meta);e.ctrlKey&&(h|=k.Ctrl);e.altKey&&(h|=k.Alt);e.shiftKey&&(h|=k.Shift);p=f(p,h);p=b[p];h=!1;p?h=p():null!==c&&(h=c(e));h&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}};
gui.KeyboardHandler.Modifier={None:0,Meta:1,Ctrl:2,Alt:4,CtrlAlt:6,Shift:8,MetaShift:9,CtrlShift:10,AltShift:12};gui.KeyboardHandler.KeyCode={Backspace:8,Tab:9,Clear:12,Enter:13,Shift:16,Ctrl:17,Alt:18,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Delete:46,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LeftMeta:91,RightMeta:93,MetaInMozilla:224};gui.HyperlinkClickHandler=function(f,k,c){function b(){var a=f();runtime.assert(Boolean(a.classList),"Document container has no classList element");a.classList.remove("webodf-inactiveLinks")}function e(){var a=f();runtime.assert(Boolean(a.classList),"Document container has no classList element");a.classList.add("webodf-inactiveLinks")}function p(){d.removeEventListener("focus",e,!1);m.forEach(function(a){k.unbind(a.keyCode,a.modifier);c.unbind(a.keyCode,a.modifier)});m.length=0}function h(a){p();
if(a!==n.None){d.addEventListener("focus",e,!1);switch(a){case n.Ctrl:m.push({keyCode:s.Ctrl,modifier:n.None});break;case n.Meta:m.push({keyCode:s.LeftMeta,modifier:n.None}),m.push({keyCode:s.RightMeta,modifier:n.None}),m.push({keyCode:s.MetaInMozilla,modifier:n.None})}m.forEach(function(a){k.bind(a.keyCode,a.modifier,b);c.bind(a.keyCode,a.modifier,e)})}}var n=gui.KeyboardHandler.Modifier,s=gui.KeyboardHandler.KeyCode,l=xmldom.XPath,r=new odf.OdfUtils,d=runtime.getWindow(),a=n.None,m=[];runtime.assert(null!==
d,"Expected to be run in an environment which has a global window, like a browser.");this.handleClick=function(b){var c=b.target||b.srcElement,e,h;b.ctrlKey?e=n.Ctrl:b.metaKey&&(e=n.Meta);if(a===n.None||a===e){a:{for(;null!==c;){if(r.isHyperlink(c))break a;if(r.isParagraph(c))break;c=c.parentNode}c=null}c&&(c=r.getHyperlinkTarget(c),""!==c&&("#"===c[0]?(c=c.substring(1),e=f(),h=l.getODFElementsWithXPath(e,"//text:bookmark-start[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI),0===h.length&&
(h=l.getODFElementsWithXPath(e,"//text:bookmark[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI)),0<h.length&&h[0].scrollIntoView(!0)):d.open(c),b.preventDefault?b.preventDefault():b.returnValue=!1))}};this.setModifier=function(d){a!==d&&(runtime.assert(d===n.None||d===n.Ctrl||d===n.Meta,"Unsupported KeyboardHandler.Modifier value: "+d),a=d,a!==n.None?e():b(),h(a))};this.getModifier=function(){return a};this.destroy=function(a){e();p();a()}};gui.EventManager=function(f){function k(a){function b(a,d,c){var e,g=!1;e="on"+d;a.attachEvent&&(a.attachEvent(e,c),g=!0);!g&&a.addEventListener&&(a.addEventListener(d,c,!1),g=!0);g&&!u[d]||!a.hasOwnProperty(e)||(a[e]=c)}function d(a,b,c){var e="on"+b;a.detachEvent&&a.detachEvent(e,c);a.removeEventListener&&a.removeEventListener(b,c,!1);a[e]===c&&(a[e]=null)}function c(b){if(-1===g.indexOf(b)){g.push(b);if(e.filters.every(function(a){return a(b)}))try{f.emit(a,b)}catch(d){runtime.log("Error occurred while processing "+
a+":\n"+d.message+"\n"+d.stack)}runtime.setTimeout(function(){g.splice(g.indexOf(b),1)},0)}}var e=this,g=[],f=new core.EventNotifier([a]);this.filters=[];this.subscribe=function(b){f.subscribe(a,b)};this.unsubscribe=function(b){f.unsubscribe(a,b)};this.destroy=function(){d(t,a,c);d(D,a,c);d(F,a,c)};w[a]&&b(t,a,c);b(D,a,c);b(F,a,c)}function c(a,b,d){function c(b){d(b,e,function(b){b.type=a;g.emit(a,b)})}var e={},g=new core.EventNotifier([a]);this.subscribe=function(b){g.subscribe(a,b)};this.unsubscribe=
function(b){g.unsubscribe(a,b)};this.destroy=function(){b.forEach(function(a){q.unsubscribe(a,c)})};(function(){b.forEach(function(a){q.subscribe(a,c)})})()}function b(a){runtime.clearTimeout(a);delete Q[a]}function e(a,d){var c=runtime.setTimeout(function(){a();b(c)},d);Q[c]=!0;return c}function p(a,d,c){var g=a.touches.length,f=a.touches[0],h=d.timer;"touchmove"===a.type||"touchend"===a.type?h&&b(h):"touchstart"===a.type&&(1!==g?runtime.clearTimeout(h):h=e(function(){c({clientX:f.clientX,clientY:f.clientY,
pageX:f.pageX,pageY:f.pageY,target:a.target||a.srcElement||null,detail:1})},400));d.timer=h}function h(a,b,d){var c=a.touches[0],e=a.target||a.srcElement||null,g=b.target;1!==a.touches.length||"touchend"===a.type?g=null:"touchstart"===a.type&&"webodf-draggable"===e.getAttribute("class")?g=e:"touchmove"===a.type&&g&&(a.preventDefault(),a.stopPropagation(),d({clientX:c.clientX,clientY:c.clientY,pageX:c.pageX,pageY:c.pageY,target:g,detail:1}));b.target=g}function n(a,b,d){var c=a.target||a.srcElement||
null,e=b.dragging;"drag"===a.type?e=!0:"touchend"===a.type&&e&&(e=!1,a=a.changedTouches[0],d({clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY,target:c,detail:1}));b.dragging=e}function s(){F.classList.add("webodf-touchEnabled");q.unsubscribe("touchstart",s)}function l(a){var b=a.scrollX,d=a.scrollY;this.restore=function(){a.scrollX===b&&a.scrollY===d||a.scrollTo(b,d)}}function r(a){var b=a.scrollTop,d=a.scrollLeft;this.restore=function(){if(a.scrollTop!==b||a.scrollLeft!==d)a.scrollTop=
b,a.scrollLeft=d}}function d(a,b){var d=I[a]||B[a]||null;!d&&b&&(d=I[a]=new k(a));return d}function a(a,b){d(a,!0).subscribe(b)}function m(a,b){var c=d(a,!1);c&&c.unsubscribe(b)}function g(){return f.getDOMDocument().activeElement===D}function x(){g()&&D.blur();D.setAttribute("disabled","true")}function v(){D.removeAttribute("disabled")}function z(a){for(var b=[];a;)(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight)&&b.push(new r(a)),a=a.parentNode;b.push(new l(t));return b}function y(){var a;
g()||(a=z(D),v(),D.focus(),a.forEach(function(a){a.restore()}))}var t=runtime.getWindow(),u={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},B={},I={},D,F=f.getCanvas().getElement(),q=this,Q={};this.addFilter=function(a,b){d(a,!0).filters.push(b)};this.removeFilter=function(a,b){var c=d(a,!0),e=c.filters.indexOf(b);-1!==e&&c.filters.splice(e,1)};this.subscribe=a;this.unsubscribe=m;this.hasFocus=g;this.focus=y;this.getEventTrap=function(){return D};
this.setEditing=function(a){var b=g();b&&D.blur();a?D.removeAttribute("readOnly"):D.setAttribute("readOnly","true");b&&y()};this.destroy=function(a){m("touchstart",s);Object.keys(Q).forEach(function(a){b(parseInt(a,10))});Q.length=0;Object.keys(B).forEach(function(a){B[a].destroy()});B={};m("mousedown",x);m("mouseup",v);m("contextmenu",v);Object.keys(I).forEach(function(a){I[a].destroy()});I={};D.parentNode.removeChild(D);a()};(function(){var b=f.getOdfCanvas().getSizer(),d=b.ownerDocument;runtime.assert(Boolean(t),
"EventManager requires a window object to operate correctly");D=d.createElement("input");D.id="eventTrap";D.setAttribute("tabindex","-1");D.setAttribute("readOnly","true");b.appendChild(D);a("mousedown",x);a("mouseup",v);a("contextmenu",v);B.longpress=new c("longpress",["touchstart","touchmove","touchend"],p);B.drag=new c("drag",["touchstart","touchmove","touchend"],h);B.dragstop=new c("dragstop",["drag","touchend"],n);a("touchstart",s)})()};gui.IOSSafariSupport=function(f){function k(){c.innerHeight!==c.outerHeight&&(b.style.display="none",runtime.requestAnimationFrame(function(){b.style.display="block"}))}var c=runtime.getWindow(),b=f.getEventTrap();this.destroy=function(c){f.unsubscribe("focus",k);b.removeAttribute("autocapitalize");b.style.WebkitTransform="";c()};f.subscribe("focus",k);b.setAttribute("autocapitalize","off");b.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,c,b){function e(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=c.isLocalCursorWithinOwnAnnotation());b!==l&&(l=b,s.emit(gui.HyperlinkController.enabledChanged,l))}function p(c){c.getMemberId()===b&&e()}var h=new odf.OdfUtils,n=f.getOdtDocument(),s=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),l=!1;this.isEnabled=function(){return l};this.subscribe=function(b,d){s.subscribe(b,d)};this.unsubscribe=function(b,d){s.unsubscribe(b,
d)};this.addHyperlink=function(c,d){if(l){var a=n.getCursorSelection(b),e=new ops.OpApplyHyperlink,g=[];if(0===a.length||d)d=d||c,e=new ops.OpInsertText,e.init({memberid:b,position:a.position,text:d}),a.length=d.length,g.push(e);e=new ops.OpApplyHyperlink;e.init({memberid:b,position:a.position,length:a.length,hyperlink:c});g.push(e);f.enqueue(g)}};this.removeHyperlinks=function(){if(l){var c=gui.SelectionMover.createPositionIterator(n.getRootNode()),d=n.getCursor(b).getSelectedRange(),a=h.getHyperlinkElements(d),
e=d.collapsed&&1===a.length,g=n.getDOMDocument().createRange(),k=[],p,s;0!==a.length&&(a.forEach(function(a){g.selectNodeContents(a);p=n.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});s=new ops.OpRemoveHyperlink;s.init({memberid:b,position:p.position,length:p.length});k.push(s)}),e||(e=a[0],-1===d.comparePoint(e,0)&&(g.setStart(e,0),g.setEnd(d.startContainer,d.startOffset),p=n.convertDomToCursorRange({anchorNode:g.startContainer,
anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0<p.length&&(s=new ops.OpApplyHyperlink,s.init({memberid:b,position:p.position,length:p.length,hyperlink:h.getHyperlinkTarget(e)}),k.push(s))),a=a[a.length-1],c.moveToEndOfNode(a),c=c.unfilteredDomOffset(),1===d.comparePoint(a,c)&&(g.setStart(d.endContainer,d.endOffset),g.setEnd(a,c),p=n.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0<p.length&&
(s=new ops.OpApplyHyperlink,s.init({memberid:b,position:p.position,length:p.length,hyperlink:h.getHyperlinkTarget(a)}),k.push(s)))),f.enqueue(k),g.detach())}};this.destroy=function(b){n.unsubscribe(ops.Document.signalCursorMoved,p);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,e);b()};n.subscribe(ops.Document.signalCursorMoved,p);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,e);e()};gui.HyperlinkController.enabledChanged="enabled/changed";gui.ImageController=function(f,k,c,b,e){function p(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=c.isLocalCursorWithinOwnAnnotation());b!==a&&(a=b,d.emit(gui.ImageController.enabledChanged,a))}function h(a){a.getMemberId()===b&&p()}var n={"image/gif":".gif","image/jpeg":".jpg","image/png":".png"},s=odf.Namespaces.textns,l=f.getOdtDocument(),r=l.getFormatting(),d=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),a=!1;this.isEnabled=function(){return a};this.subscribe=
function(a,b){d.subscribe(a,b)};this.unsubscribe=function(a,b){d.unsubscribe(a,b)};this.insertImage=function(d,c,h,k){if(a){runtime.assert(0<h&&0<k,"Both width and height of the image should be greater than 0px.");k={width:h,height:k};if(h=l.getParagraphElement(l.getCursor(b).getNode()).getAttributeNS(s,"style-name")){h=r.getContentSize(h,"paragraph");var p=1,y=1;k.width>h.width&&(p=h.width/k.width);k.height>h.height&&(y=h.height/k.height);h=Math.min(p,y);k={width:k.width*h,height:k.height*h}}h=k.width+
"px";k=k.height+"px";var t=l.getOdfCanvas().odfContainer().rootElement.styles,p=d.toLowerCase(),y=n.hasOwnProperty(p)?n[p]:null,u,p=[];runtime.assert(null!==y,"Image type is not supported: "+d);y="Pictures/"+e.generateImageName()+y;u=new ops.OpSetBlob;u.init({memberid:b,filename:y,mimetype:d,content:c});p.push(u);r.getStyleElement("Graphics","graphic",[t])||(d=new ops.OpAddStyle,d.init({memberid:b,styleName:"Graphics",styleFamily:"graphic",isAutomaticStyle:!1,setProperties:{"style:graphic-properties":{"text:anchor-type":"paragraph",
"svg:x":"0cm","svg:y":"0cm","style:wrap":"dynamic","style:number-wrapped-paragraphs":"no-limit","style:wrap-contour":"false","style:vertical-pos":"top","style:vertical-rel":"paragraph","style:horizontal-pos":"center","style:horizontal-rel":"paragraph"}}}),p.push(d));d=e.generateStyleName();c=new ops.OpAddStyle;c.init({memberid:b,styleName:d,styleFamily:"graphic",isAutomaticStyle:!0,setProperties:{"style:parent-style-name":"Graphics","style:graphic-properties":{"style:vertical-pos":"top","style:vertical-rel":"baseline",
"style:horizontal-pos":"center","style:horizontal-rel":"paragraph","fo:background-color":"transparent","style:background-transparency":"100%","style:shadow":"none","style:mirror":"none","fo:clip":"rect(0cm, 0cm, 0cm, 0cm)","draw:luminance":"0%","draw:contrast":"0%","draw:red":"0%","draw:green":"0%","draw:blue":"0%","draw:gamma":"100%","draw:color-inversion":"false","draw:image-opacity":"100%","draw:color-mode":"standard"}}});p.push(c);u=new ops.OpInsertImage;u.init({memberid:b,position:l.getCursorPosition(b),
filename:y,frameWidth:h,frameHeight:k,frameStyleName:d,frameName:e.generateFrameName()});p.push(u);f.enqueue(p)}};this.destroy=function(a){l.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);a()};l.subscribe(ops.Document.signalCursorMoved,h);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);p()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var c=f.getSizer(),k=e.createElement("div");k.id="imageSelector";k.style.borderWidth="1px";c.appendChild(k);b.forEach(function(b){var c=e.createElement("div");c.className=b;k.appendChild(c)});return k}var c=odf.Namespaces.svgns,b="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),e=f.getElement().ownerDocument,p=!1;this.select=function(b){var n,s,l=e.getElementById("imageSelector");l||(l=k());p=!0;n=l.parentNode;
s=b.getBoundingClientRect();var r=n.getBoundingClientRect(),d=f.getZoomLevel();n=(s.left-r.left)/d-1;s=(s.top-r.top)/d-1;l.style.display="block";l.style.left=n+"px";l.style.top=s+"px";l.style.width=b.getAttributeNS(c,"width");l.style.height=b.getAttributeNS(c,"height")};this.clearSelection=function(){var b;p&&(b=e.getElementById("imageSelector"))&&(b.style.display="none");p=!1};this.isSelectorElement=function(b){var c=e.getElementById("imageSelector");return c?b===c||b.parentNode===c:!1}};(function(){function f(f){function c(b){h=b.which&&String.fromCharCode(b.which)===p;p=void 0;return!1===h}function b(){h=!1}function e(b){p=b.data;h=!1}var p,h=!1;this.destroy=function(h){f.unsubscribe("textInput",b);f.unsubscribe("compositionend",e);f.removeFilter("keypress",c);h()};f.subscribe("textInput",b);f.subscribe("compositionend",e);f.addFilter("keypress",c)}gui.InputMethodEditor=function(k,c){function b(b){a&&(b?a.getNode().setAttributeNS(d,"composing","true"):(a.getNode().removeAttributeNS(d,
"composing"),x.textContent=""))}function e(){y&&(y=!1,b(!1),u.emit(gui.InputMethodEditor.signalCompositionEnd,{data:t}),t="")}function p(){e();a&&a.getSelectedRange().collapsed?m.value="":m.value=v;m.setSelectionRange(0,m.value.length)}function h(){c.hasFocus()&&z.trigger()}function n(){w=void 0;z.cancel();b(!0);y||u.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function s(a){a=w=a.data;y=!0;t+=a;z.trigger()}function l(a){a.data!==w&&(a=a.data,y=!0,t+=a,z.trigger());w=void 0}function r(){x.textContent=
m.value}var d="urn:webodf:names:cursor",a=null,m=c.getEventTrap(),g=m.ownerDocument,x,v="b",z,y=!1,t="",u=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),w,B=[],I;this.subscribe=u.subscribe;this.unsubscribe=u.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(a=b,a.getNode().appendChild(x),b.subscribe(ops.OdtCursor.signalCursorUpdated,h),c.subscribe("input",r),c.subscribe("compositionupdate",r))};this.removeCursor=function(b){a&&
b===k&&(a.getNode().removeChild(x),a.unsubscribe(ops.OdtCursor.signalCursorUpdated,h),c.unsubscribe("input",r),c.unsubscribe("compositionupdate",r),a=null)};this.destroy=function(a){c.unsubscribe("compositionstart",n);c.unsubscribe("compositionend",s);c.unsubscribe("textInput",l);c.unsubscribe("keypress",e);c.unsubscribe("focus",p);core.Async.destroyAll(I,a)};(function(){c.subscribe("compositionstart",n);c.subscribe("compositionend",s);c.subscribe("textInput",l);c.subscribe("keypress",e);c.subscribe("focus",
p);B.push(new f(c));I=B.map(function(a){return a.destroy});x=g.createElement("span");x.setAttribute("id","composer");z=core.Task.createTimeoutTask(p,1);I.push(z.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function c(b){p.emit(gui.MetadataController.signalMetadataChanged,b)}function b(b){var c=-1===h.indexOf(b);c||runtime.log("Setting "+b+" is restricted.");return c}var e=f.getOdtDocument(),p=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),h=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(c,e){var h={},p="",d;c&&Object.keys(c).filter(b).forEach(function(a){h[a]=c[a]});
e&&(p=e.filter(b).join(","));if(0<p.length||0<Object.keys(h).length)d=new ops.OpUpdateMetadata,d.init({memberid:k,setProperties:h,removedProperties:0<p.length?{attributes:p}:null}),f.enqueue([d])};this.getMetadata=function(b){var c;runtime.assert("string"===typeof b,"Property must be a string");c=b.split(":");runtime.assert(2===c.length,"Property must be a namespace-prefixed string");b=odf.Namespaces.lookupNamespaceURI(c[0]);runtime.assert(Boolean(b),"Prefix must be for an ODF namespace.");return e.getOdfCanvas().odfContainer().getMetadata(b,
c[1])};this.subscribe=function(b,c){p.subscribe(b,c)};this.unsubscribe=function(b,c){p.unsubscribe(b,c)};this.destroy=function(b){e.unsubscribe(ops.OdtDocument.signalMetadataUpdated,c);b()};e.subscribe(ops.OdtDocument.signalMetadataUpdated,c)};gui.MetadataController.signalMetadataChanged="metadata/changed";gui.PasteController=function(f,k,c,b){function e(){s=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?c.isLocalCursorWithinOwnAnnotation():!0}function p(c){c.getMemberId()===b&&e()}function h(b){return b===ops.OdtStepsTranslator.NEXT_STEP}var n=f.getOdtDocument(),s=!1,l=odf.Namespaces.textns;this.isEnabled=function(){return s};this.paste=function(c){if(s){var d=n.getCursorPosition(b),a=n.getCursor(b).getNode(),a=n.getParagraphElement(a),e=a.getAttributeNS(l,"style-name")||"",g=d,k=[],p=n.convertDomPointToCursorStep(a,
0,h);c.replace(/\r/g,"").split("\n").forEach(function(a){var d=new ops.OpInsertText,c=new ops.OpSplitParagraph;d.init({memberid:b,position:g,text:a,moveCursor:!0});k.push(d);g+=a.length;c.init({memberid:b,position:g,paragraphStyleName:e,sourceParagraphPosition:p,moveCursor:!0});k.push(c);p=g+=1});k.pop();f.enqueue(k)}};this.destroy=function(b){n.unsubscribe(ops.Document.signalCursorMoved,p);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,e);b()};n.subscribe(ops.Document.signalCursorMoved,p);
k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,e);e()};odf.WordBoundaryFilter=function(f,k){function c(a,b,d){for(var c=null,e=f.getRootNode(),h;a!==e&&null!==a&&null===c;)h=0>b?a.previousSibling:a.nextSibling,d(h)===NodeFilter.FILTER_ACCEPT&&(c=h),a=a.parentNode;return c}function b(a,b){var d;return null===a?m.NO_NEIGHBOUR:h.isCharacterElement(a)?m.SPACE_CHAR:a.nodeType===e||h.isTextSpan(a)||h.isHyperlink(a)?(d=a.textContent.charAt(b()),s.test(d)?m.SPACE_CHAR:n.test(d)?m.PUNCTUATION_CHAR:m.WORD_CHAR):m.OTHER}var e=Node.TEXT_NODE,p=Node.ELEMENT_NODE,
h=new odf.OdfUtils,n=/[!-#%-*,-\/:-;?-@\[-\]_{}\u00a1\u00ab\u00b7\u00bb\u00bf;\u00b7\u055a-\u055f\u0589-\u058a\u05be\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964-\u0965\u0970\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u104a-\u104f\u10fb\u1361-\u1368\u166d-\u166e\u169b-\u169c\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944-\u1945\u19de-\u19df\u1a1e-\u1a1f\u1b5a-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u206e\u207d-\u207e\u208d-\u208e\u3008-\u3009\u2768-\u2775\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2cf9-\u2cfc\u2cfe-\u2cff\u2e00-\u2e7e\u3000-\u303f\u30a0\u30fb\ua60d-\ua60f\ua673\ua67e\ua874-\ua877\ua8ce-\ua8cf\ua92e-\ua92f\ua95f\uaa5c-\uaa5f\ufd3e-\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]|\ud800[\udd00-\udd01\udf9f\udfd0]|\ud802[\udd1f\udd3f\ude50-\ude58]|\ud809[\udc00-\udc7e]/,
s=/\s/,l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT,d=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,a=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,m={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(e){var f=e.container(),h=e.leftNode(),n=e.rightNode(),s=e.unfilteredDomOffset,t=function(){return e.unfilteredDomOffset()-1};f.nodeType===p&&(null===n&&(n=c(f,1,e.getNodeFilter())),null===h&&(h=
c(f,-1,e.getNodeFilter())));f!==n&&(s=function(){return 0});f!==h&&null!==h&&(t=function(){return h.textContent.length-1});f=b(h,t);n=b(n,s);return f===m.WORD_CHAR&&n===m.WORD_CHAR||f===m.PUNCTUATION_CHAR&&n===m.PUNCTUATION_CHAR||k===d&&f!==m.NO_NEIGHBOUR&&n===m.SPACE_CHAR||k===a&&f===m.SPACE_CHAR&&n!==m.NO_NEIGHBOUR?r:l}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function c(a,b,d){d=new odf.WordBoundaryFilter(v,d);var c=v.getRootElement(a)||v.getRootNode(),e=v.createRootFilter(c);return v.createStepIterator(a,b,[t,e,d],c)}function b(a,b){return b?{anchorNode:a.startContainer,anchorOffset:a.startOffset,focusNode:a.endContainer,focusOffset:a.endOffset}:{anchorNode:a.endContainer,anchorOffset:a.endOffset,focusNode:a.startContainer,focusOffset:a.startOffset}}function e(a,b,d){var c=new ops.OpMoveCursor;c.init({memberid:k,
position:a,length:b||0,selectionType:d});return c}function p(a,d,c){var g;g=v.getCursor(k);g=b(g.getSelectedRange(),g.hasForwardSelection());g.focusNode=a;g.focusOffset=d;c||(g.anchorNode=g.focusNode,g.anchorOffset=g.focusOffset);a=v.convertDomToCursorRange(g);f.enqueue([e(a.position,a.length)])}function h(a){var b;b=c(a.startContainer,a.startOffset,B);b.roundToPreviousStep()&&a.setStart(b.container(),b.offset());b=c(a.endContainer,a.endOffset,I);b.roundToNextStep()&&a.setEnd(b.container(),b.offset())}
function n(a){var b=y.getParagraphElements(a),d=b[0],b=b[b.length-1];d&&a.setStart(d,0);b&&(y.isParagraph(a.endContainer)&&0===a.endOffset?a.setEndBefore(b):a.setEnd(b,b.childNodes.length))}function s(a,b,d,c){var e,f;c?(e=d.startContainer,f=d.startOffset):(e=d.endContainer,f=d.endOffset);z.containsNode(a,e)||(f=0>z.comparePoints(a,0,e,f)?0:a.childNodes.length,e=a);a=v.createStepIterator(e,f,b,y.getParagraphElement(e)||a);a.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");
c?d.setStart(a.container(),a.offset()):d.setEnd(a.container(),a.offset())}function l(a){var b=v.getCursorSelection(k),d=v.getCursor(k).getStepCounter();0!==a&&(a=0<a?d.convertForwardStepsBetweenFilters(a,u,t):-d.convertBackwardStepsBetweenFilters(-a,u,t),a=b.length+a,f.enqueue([e(b.position,a)]))}function r(a){var b=v.getCursorPosition(k),d=v.getCursor(k).getStepCounter();0!==a&&(a=0<a?d.convertForwardStepsBetweenFilters(a,u,t):-d.convertBackwardStepsBetweenFilters(-a,u,t),f.enqueue([e(b+a,0)]))}
function d(a,b){var d;d=v.getCursor(k).getNode();d=v.createStepIterator(d,0,[t,w],v.getRootElement(d));d.advanceStep(a)&&p(d.container(),d.offset(),b)}function a(a,b){var d=v.getParagraphElement(v.getCursor(k).getNode()),c=a===F?1:-1;runtime.assert(Boolean(d),"SelectionController: Cursor outside paragraph");d=v.getCursor(k).getStepCounter().countLinesSteps(c,u);b?l(d):r(d)}function m(a,b){var d=a===core.StepDirection.NEXT?1:-1,d=v.getCursor(k).getStepCounter().countStepsToLineBoundary(d,u);b?l(d):
r(d)}function g(a,d){var e=v.getCursor(k),e=b(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,B);e.advanceStep(a)&&p(e.container(),e.offset(),d)}function x(a,d,c){var e=!1,f=v.getCursor(k),f=b(f.getSelectedRange(),f.hasForwardSelection()),e=v.getRootElement(f.focusNode);runtime.assert(Boolean(e),"SelectionController: Cursor outside root");f=v.createStepIterator(f.focusNode,f.focusOffset,[t,w],e);f.roundToClosestStep();f.advanceStep(a)&&(c=c(f.container()))&&(a===D?(f.setPosition(c,
0),e=f.roundToNextStep()):(f.setPosition(c,c.childNodes.length),e=f.roundToPreviousStep()),e&&p(f.container(),f.offset(),d))}var v=f.getOdtDocument(),z=new core.DomUtils,y=new odf.OdfUtils,t=v.getPositionFilter(),u=new core.PositionFilterChain,w=v.createRootFilter(k),B=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,I=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,D=core.StepDirection.PREVIOUS,F=core.StepDirection.NEXT;this.selectionToRange=function(a){var b=0<=z.comparePoints(a.anchorNode,a.anchorOffset,
a.focusNode,a.focusOffset),d=a.focusNode.ownerDocument.createRange();b?(d.setStart(a.anchorNode,a.anchorOffset),d.setEnd(a.focusNode,a.focusOffset)):(d.setStart(a.focusNode,a.focusOffset),d.setEnd(a.anchorNode,a.anchorOffset));return{range:d,hasForwardSelection:b}};this.rangeToSelection=b;this.selectImage=function(a){var b=v.getRootElement(a),d=v.createRootFilter(b),b=v.createStepIterator(a,0,[d,v.getPositionFilter()],b),c;b.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");
d=b.container();c=b.offset();b.setPosition(a,a.childNodes.length);b.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");a=v.convertDomToCursorRange({anchorNode:d,anchorOffset:c,focusNode:b.container(),focusOffset:b.offset()});a=e(a.position,a.length,ops.OdtCursor.RegionSelection);f.enqueue([a])};this.expandToWordBoundaries=h;this.expandToParagraphBoundaries=n;this.selectRange=function(a,d,c){var g=v.getOdfCanvas().getElement(),m,l=[t];m=z.containsNode(g,a.startContainer);g=z.containsNode(g,
a.endContainer);if(m||g)if(m&&g&&(2===c?h(a):3<=c&&n(a)),(c=d?v.getRootElement(a.startContainer):v.getRootElement(a.endContainer))||(c=v.getRootNode()),l.push(v.createRootFilter(c)),s(c,l,a,!0),s(c,l,a,!1),a=b(a,d),d=v.convertDomToCursorRange(a),a=v.getCursorSelection(k),d.position!==a.position||d.length!==a.length)a=e(d.position,d.length,ops.OdtCursor.RangeSelection),f.enqueue([a])};this.moveCursorToLeft=function(){d(D,!1);return!0};this.moveCursorToRight=function(){d(F,!1);return!0};this.extendSelectionToLeft=
function(){d(D,!0);return!0};this.extendSelectionToRight=function(){d(F,!0);return!0};this.moveCursorUp=function(){a(D,!1);return!0};this.moveCursorDown=function(){a(F,!1);return!0};this.extendSelectionUp=function(){a(D,!0);return!0};this.extendSelectionDown=function(){a(F,!0);return!0};this.moveCursorBeforeWord=function(){g(D,!1);return!0};this.moveCursorPastWord=function(){g(F,!1);return!0};this.extendSelectionBeforeWord=function(){g(D,!0);return!0};this.extendSelectionPastWord=function(){g(F,!0);
return!0};this.moveCursorToLineStart=function(){m(D,!1);return!0};this.moveCursorToLineEnd=function(){m(F,!1);return!0};this.extendSelectionToLineStart=function(){m(D,!0);return!0};this.extendSelectionToLineEnd=function(){m(F,!0);return!0};this.extendSelectionToParagraphStart=function(){x(D,!0,v.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){x(F,!0,v.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){x(D,!1,v.getParagraphElement);return!0};this.moveCursorToParagraphEnd=
function(){x(F,!1,v.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){x(D,!1,v.getRootElement);return!0};this.moveCursorToDocumentEnd=function(){x(F,!1,v.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){x(D,!0,v.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){x(F,!0,v.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var a=v.getCursor(k),a=v.getRootElement(a.getNode()),b,d,c;runtime.assert(Boolean(a),"SelectionController: Cursor outside root");
c=v.createStepIterator(a,0,[t,w],a);c.roundToClosestStep();b=c.container();d=c.offset();c.setPosition(a,a.childNodes.length);c.roundToClosestStep();a=v.convertDomToCursorRange({anchorNode:b,anchorOffset:d,focusNode:c.container(),focusOffset:c.offset()});f.enqueue([e(a.position,a.length)]);return!0};u.addFilter(t);u.addFilter(v.createRootFilter(k))};gui.TextController=function(f,k,c,b,e,p){function h(){v=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?c.isLocalCursorWithinOwnAnnotation():!0}function n(a){a.getMemberId()===b&&h()}function s(a){return a===ops.OdtStepsTranslator.NEXT_STEP}function l(a,b,d){var c=[m.getPositionFilter()];d&&c.push(m.createRootFilter(a.startContainer));d=m.createStepIterator(a.startContainer,a.startOffset,c,b);d.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");
b=m.convertDomPointToCursorStep(d.container(),d.offset());a.collapsed?a=b:(d.setPosition(a.endContainer,a.endOffset),d.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),a=m.convertDomPointToCursorStep(d.container(),d.offset()));return{position:b,length:a-b}}function r(a){var d,c,e,f=g.getParagraphElements(a),h=a.cloneRange(),m=[];d=f[0];1<f.length&&(g.hasNoODFContent(d)&&(d=f[f.length-1]),c=d.getAttributeNS(odf.Namespaces.textns,"style-name")||"");
f.forEach(function(d,f){var g,k;h.setStart(d,0);h.collapse(!0);g=l(h,d,!1).position;0<f&&(k=new ops.OpMergeParagraph,k.init({memberid:b,paragraphStyleName:c,destinationStartPosition:e,sourceStartPosition:g,moveCursor:1===f}),m.unshift(k));e=g;h.selectNodeContents(d);if(g=x.rangeIntersection(h,a))g=l(g,d,!0),0<g.length&&(k=new ops.OpRemoveText,k.init({memberid:b,position:g.position,length:g.length}),m.unshift(k))});return m}function d(a){0>a.length&&(a.position+=a.length,a.length=-a.length);return a}
function a(a){if(!v)return!1;var c,e=m.getCursor(b).getSelectedRange().cloneRange(),g=d(m.getCursorSelection(b)),h;if(0===g.length){g=void 0;c=m.getCursor(b).getNode();h=m.getRootElement(c);var l=[m.getPositionFilter(),m.createRootFilter(h)];h=m.createStepIterator(c,0,l,h);h.roundToClosestStep()&&(a?h.nextStep():h.previousStep())&&(g=d(m.convertDomToCursorRange({anchorNode:c,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),a?(e.setStart(c,0),e.setEnd(h.container(),h.offset())):(e.setStart(h.container(),
h.offset()),e.setEnd(c,0)))}g&&f.enqueue(r(e));return void 0!==g}var m=f.getOdtDocument(),g=new odf.OdfUtils,x=new core.DomUtils,v=!1,z=odf.Namespaces.textns;this.isEnabled=function(){return v};this.enqueueParagraphSplittingOps=function(){if(!v)return!1;var a=m.getCursor(b),c=a.getSelectedRange(),e=d(m.getCursorSelection(b)),g=[],a=m.getParagraphElement(a.getNode()),h=a.getAttributeNS(z,"style-name")||"";0<e.length&&(g=g.concat(r(c)));c=new ops.OpSplitParagraph;c.init({memberid:b,position:e.position,
paragraphStyleName:h,sourceParagraphPosition:m.convertDomPointToCursorStep(a,0,s),moveCursor:!0});g.push(c);p&&(e=p(e.position+1),g=g.concat(e));f.enqueue(g);return!0};this.removeTextByBackspaceKey=function(){return a(!1)};this.removeTextByDeleteKey=function(){return a(!0)};this.removeCurrentSelection=function(){if(!v)return!1;var a=m.getCursor(b).getSelectedRange();f.enqueue(r(a));return!0};this.insertText=function(a){if(v){var c=m.getCursor(b).getSelectedRange(),g=d(m.getCursorSelection(b)),h=[],
l=!1;0<g.length&&(h=h.concat(r(c)),l=!0);c=new ops.OpInsertText;c.init({memberid:b,position:g.position,text:a,moveCursor:!0});h.push(c);e&&(a=e(g.position,a.length,l))&&h.push(a);f.enqueue(h)}};this.destroy=function(a){m.unsubscribe(ops.Document.signalCursorMoved,n);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);a()};m.subscribe(ops.Document.signalCursorMoved,n);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(f,k){};gui.UndoManager.prototype.unsubscribe=function(f,k){};gui.UndoManager.prototype.setDocument=function(f){};gui.UndoManager.prototype.setInitialState=function(){};gui.UndoManager.prototype.initialize=function(){};gui.UndoManager.prototype.purgeInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(f){};gui.UndoManager.prototype.hasUndoStates=function(){};
gui.UndoManager.prototype.hasRedoStates=function(){};gui.UndoManager.prototype.moveForward=function(f){};gui.UndoManager.prototype.moveBackward=function(f){};gui.UndoManager.prototype.onOperationExecuted=function(f){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";gui.SessionControllerOptions=function(){this.annotationsEnabled=this.directParagraphStylingEnabled=this.directTextStylingEnabled=!1};
(function(){var f=core.PositionFilter.FilterResult.FILTER_ACCEPT;gui.SessionController=function(k,c,b,e){function p(a){return a.target||a.srcElement||null}function h(a,b){var d=H.getDOMDocument(),c=null;d.caretRangeFromPoint?(d=d.caretRangeFromPoint(a,b),c={container:d.startContainer,offset:d.startOffset}):d.caretPositionFromPoint&&(d=d.caretPositionFromPoint(a,b))&&d.offsetNode&&(c={container:d.offsetNode,offset:d.offset});return c}function n(a){var b=H.getCursor(c).getSelectedRange();b.collapsed?
a.preventDefault():O.setDataFromRange(a,b)?ea.removeCurrentSelection():runtime.log("Cut operation failed")}function s(){return!1!==H.getCursor(c).getSelectedRange().collapsed}function l(a){var b=H.getCursor(c).getSelectedRange();b.collapsed?a.preventDefault():O.setDataFromRange(a,b)||runtime.log("Copy operation failed")}function r(a){var b;S.clipboardData&&S.clipboardData.getData?b=S.clipboardData.getData("Text"):a.clipboardData&&a.clipboardData.getData&&(b=a.clipboardData.getData("text/plain"));
b&&(ea.removeCurrentSelection(),ra.paste(b));a.preventDefault?a.preventDefault():a.returnValue=!1}function d(){return!1}function a(a){if(ba)ba.onOperationExecuted(a)}function m(a){H.emit(ops.OdtDocument.signalUndoStackChanged,a)}function g(){var a;return ba?(a=R.hasFocus(),ba.moveBackward(1),a&&R.focus(),!0):!1}function x(){var a;return ba?(a=R.hasFocus(),ba.moveForward(1),a&&R.focus(),!0):!1}function v(a){var d=H.getCursor(c).getSelectedRange(),e=p(a).getAttribute("end");d&&e&&(a=h(a.clientX,a.clientY))&&
(ha.setUnfilteredPosition(a.container,a.offset),Z.acceptPosition(ha)===f&&(d=d.cloneRange(),"left"===e?d.setStart(ha.container(),ha.unfilteredDomOffset()):d.setEnd(ha.container(),ha.unfilteredDomOffset()),b.setSelectedRange(d,"right"===e),H.emit(ops.Document.signalCursorMoved,b)))}function z(){V.selectRange(b.getSelectedRange(),b.hasForwardSelection(),1)}function y(){var a=S.getSelection(),d=0<a.rangeCount&&V.selectionToRange(a);X&&d&&(T=!0,la.clearSelection(),ha.setUnfilteredPosition(a.focusNode,
a.focusOffset),Z.acceptPosition(ha)===f&&(2===oa?V.expandToWordBoundaries(d.range):3<=oa&&V.expandToParagraphBoundaries(d.range),b.setSelectedRange(d.range,d.hasForwardSelection),H.emit(ops.Document.signalCursorMoved,b)))}function t(a){var b=p(a),d=H.getCursor(c);if(X=null!==b&&W.containsNode(H.getOdfCanvas().getElement(),b))T=!1,b=H.getRootElement(b)||H.getRootNode(),Z=H.createRootFilter(b),oa=0===a.button?a.detail:0,d&&a.shiftKey?S.getSelection().collapse(d.getAnchorNode(),0):(a=S.getSelection(),
b=d.getSelectedRange(),a.extend?d.hasForwardSelection()?(a.collapse(b.startContainer,b.startOffset),a.extend(b.endContainer,b.endOffset)):(a.collapse(b.endContainer,b.endOffset),a.extend(b.startContainer,b.startOffset)):(a.removeAllRanges(),a.addRange(b.cloneRange()))),1<oa&&y()}function u(a){var b=H.getRootElement(a),d=H.createRootFilter(b),b=H.createStepIterator(a,0,[d,H.getPositionFilter()],b);b.setPosition(a,a.childNodes.length);return b.roundToNextStep()?{container:b.container(),offset:b.offset()}:
null}function w(a){var b;b=(b=S.getSelection())?{anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}:null;var d=S.getSelection().isCollapsed,c,e;b.anchorNode||b.focusNode||!(c=h(a.clientX,a.clientY))||(b.anchorNode=c.container,b.anchorOffset=c.offset,b.focusNode=b.anchorNode,b.focusOffset=b.anchorOffset);if(E.isImage(b.focusNode)&&0===b.focusOffset&&E.isCharacterFrame(b.focusNode.parentNode)){if(e=b.focusNode.parentNode,c=e.getBoundingClientRect(),
a.clientX>c.left&&(c=u(e)))b.focusNode=c.container,b.focusOffset=c.offset,d&&(b.anchorNode=b.focusNode,b.anchorOffset=b.focusOffset)}else E.isImage(b.focusNode.firstChild)&&1===b.focusOffset&&E.isCharacterFrame(b.focusNode)&&(c=u(b.focusNode))&&(b.anchorNode=b.focusNode=c.container,b.anchorOffset=b.focusOffset=c.offset);b.anchorNode&&b.focusNode&&(b=V.selectionToRange(b),V.selectRange(b.range,b.hasForwardSelection,0===a.button?a.detail:0));R.focus()}function B(a){var b;if(b=h(a.clientX,a.clientY))a=
b.container,b=b.offset,a={anchorNode:a,anchorOffset:b,focusNode:a,focusOffset:b},a=V.selectionToRange(a),V.selectRange(a.range,a.hasForwardSelection,2),R.focus()}function I(a){var d=p(a),c,e,f;ja.processRequests();X&&(E.isImage(d)&&E.isCharacterFrame(d.parentNode)&&S.getSelection().isCollapsed?(V.selectImage(d.parentNode),R.focus()):la.isSelectorElement(d)?R.focus():T?(d=b.getSelectedRange(),e=d.collapsed,E.isImage(d.endContainer)&&0===d.endOffset&&E.isCharacterFrame(d.endContainer.parentNode)&&(f=
d.endContainer.parentNode,f=u(f))&&(d.setEnd(f.container,f.offset),e&&d.collapse(!1)),V.selectRange(d,b.hasForwardSelection(),0===a.button?a.detail:0),R.focus()):ua?w(a):(c=W.cloneEvent(a),ia=runtime.setTimeout(function(){w(c)},0)),oa=0,T=X=!1)}function D(a){var b=H.getCursor(c).getSelectedRange();b.collapsed||G.exportRangeToDataTransfer(a.dataTransfer,b)}function F(){X&&R.focus();oa=0;T=X=!1}function q(a){I(a)}function Q(a){var b=p(a),d=null;"annotationRemoveButton"===b.className?(runtime.assert(ga,
"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),d=W.getElementsByTagNameNS(b.parentNode,odf.Namespaces.officens,"annotation")[0],fa.removeAnnotation(d),R.focus()):"webodf-draggable"!==b.getAttribute("class")&&I(a)}function N(a){(a=a.data)&&(-1===a.indexOf("\n")?ea.insertText(a):ra.paste(a))}function U(a){return function(){a();return!0}}function C(a){return function(b){return H.getCursor(c).getSelectionType()===ops.OdtCursor.RangeSelection?a(b):
!0}}function $(b){R.unsubscribe("keydown",A.handleEvent);R.unsubscribe("keypress",P.handleEvent);R.unsubscribe("keyup",J.handleEvent);R.unsubscribe("copy",l);R.unsubscribe("mousedown",t);R.unsubscribe("mousemove",ja.trigger);R.unsubscribe("mouseup",Q);R.unsubscribe("contextmenu",q);R.unsubscribe("dragstart",D);R.unsubscribe("dragend",F);R.unsubscribe("click",ma.handleClick);R.unsubscribe("longpress",B);R.unsubscribe("drag",v);R.unsubscribe("dragstop",z);H.unsubscribe(ops.OdtDocument.signalOperationEnd,
da.trigger);H.unsubscribe(ops.Document.signalCursorAdded,ka.registerCursor);H.unsubscribe(ops.Document.signalCursorRemoved,ka.removeCursor);H.unsubscribe(ops.OdtDocument.signalOperationEnd,a);b()}var S=runtime.getWindow(),H=k.getOdtDocument(),Y=new gui.SessionConstraints,aa=new gui.SessionContext(k,c),W=new core.DomUtils,E=new odf.OdfUtils,G=new gui.MimeDataExporter,O=new gui.Clipboard(G),A=new gui.KeyboardHandler,P=new gui.KeyboardHandler,J=new gui.KeyboardHandler,X=!1,M=new odf.ObjectNameGenerator(H.getOdfCanvas().odfContainer(),
c),T=!1,Z=null,ia,ba=null,R=new gui.EventManager(H),ga=e.annotationsEnabled,fa=new gui.AnnotationController(k,Y,c),ca=new gui.DirectFormattingController(k,Y,aa,c,M,e.directTextStylingEnabled,e.directParagraphStylingEnabled),ea=new gui.TextController(k,Y,aa,c,ca.createCursorStyleOp,ca.createParagraphStyleOps),na=new gui.ImageController(k,Y,aa,c,M),la=new gui.ImageSelector(H.getOdfCanvas()),ha=gui.SelectionMover.createPositionIterator(H.getRootNode()),ja,da,ra=new gui.PasteController(k,Y,aa,c),ka=new gui.InputMethodEditor(c,
R),oa=0,ma=new gui.HyperlinkClickHandler(H.getOdfCanvas().getElement,A,J),ta=new gui.HyperlinkController(k,Y,aa,c),V=new gui.SelectionController(k,c),sa=new gui.MetadataController(k,c),K=gui.KeyboardHandler.Modifier,L=gui.KeyboardHandler.KeyCode,pa=-1!==S.navigator.appVersion.toLowerCase().indexOf("mac"),ua=-1!==["iPad","iPod","iPhone"].indexOf(S.navigator.platform),qa;runtime.assert(null!==S,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo=
x;this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(c),"Inserting local cursor a second time.");var a=new ops.OpAddCursor;a.init({memberid:c});k.enqueue([a]);R.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(c),"Removing local cursor without inserting before.");var a=new ops.OpRemoveCursor;a.init({memberid:c});k.enqueue([a])};this.startEditing=function(){ka.subscribe(gui.InputMethodEditor.signalCompositionStart,ea.removeCurrentSelection);
ka.subscribe(gui.InputMethodEditor.signalCompositionEnd,N);R.subscribe("beforecut",s);R.subscribe("cut",n);R.subscribe("beforepaste",d);R.subscribe("paste",r);ba&&ba.initialize();R.setEditing(!0);ma.setModifier(pa?K.Meta:K.Ctrl);A.bind(L.Backspace,K.None,U(ea.removeTextByBackspaceKey),!0);A.bind(L.Delete,K.None,ea.removeTextByDeleteKey);A.bind(L.Tab,K.None,C(function(){ea.insertText("\t");return!0}));pa?(A.bind(L.Clear,K.None,ea.removeCurrentSelection),A.bind(L.B,K.Meta,C(ca.toggleBold)),A.bind(L.I,
K.Meta,C(ca.toggleItalic)),A.bind(L.U,K.Meta,C(ca.toggleUnderline)),A.bind(L.L,K.MetaShift,C(ca.alignParagraphLeft)),A.bind(L.E,K.MetaShift,C(ca.alignParagraphCenter)),A.bind(L.R,K.MetaShift,C(ca.alignParagraphRight)),A.bind(L.J,K.MetaShift,C(ca.alignParagraphJustified)),ga&&A.bind(L.C,K.MetaShift,fa.addAnnotation),A.bind(L.Z,K.Meta,g),A.bind(L.Z,K.MetaShift,x)):(A.bind(L.B,K.Ctrl,C(ca.toggleBold)),A.bind(L.I,K.Ctrl,C(ca.toggleItalic)),A.bind(L.U,K.Ctrl,C(ca.toggleUnderline)),A.bind(L.L,K.CtrlShift,
C(ca.alignParagraphLeft)),A.bind(L.E,K.CtrlShift,C(ca.alignParagraphCenter)),A.bind(L.R,K.CtrlShift,C(ca.alignParagraphRight)),A.bind(L.J,K.CtrlShift,C(ca.alignParagraphJustified)),ga&&A.bind(L.C,K.CtrlAlt,fa.addAnnotation),A.bind(L.Z,K.Ctrl,g),A.bind(L.Z,K.CtrlShift,x));P.setDefault(C(function(a){var b;b=null===a.which||void 0===a.which?String.fromCharCode(a.keyCode):0!==a.which&&0!==a.charCode?String.fromCharCode(a.which):null;return!b||a.altKey||a.ctrlKey||a.metaKey?!1:(ea.insertText(b),!0)}));
P.bind(L.Enter,K.None,C(ea.enqueueParagraphSplittingOps))};this.endEditing=function(){ka.unsubscribe(gui.InputMethodEditor.signalCompositionStart,ea.removeCurrentSelection);ka.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,N);R.unsubscribe("cut",n);R.unsubscribe("beforecut",s);R.unsubscribe("paste",r);R.unsubscribe("beforepaste",d);R.setEditing(!1);ma.setModifier(K.None);A.bind(L.Backspace,K.None,function(){return!0},!0);A.unbind(L.Delete,K.None);A.unbind(L.Tab,K.None);pa?(A.unbind(L.Clear,
K.None),A.unbind(L.B,K.Meta),A.unbind(L.I,K.Meta),A.unbind(L.U,K.Meta),A.unbind(L.L,K.MetaShift),A.unbind(L.E,K.MetaShift),A.unbind(L.R,K.MetaShift),A.unbind(L.J,K.MetaShift),ga&&A.unbind(L.C,K.MetaShift),A.unbind(L.Z,K.Meta),A.unbind(L.Z,K.MetaShift)):(A.unbind(L.B,K.Ctrl),A.unbind(L.I,K.Ctrl),A.unbind(L.U,K.Ctrl),A.unbind(L.L,K.CtrlShift),A.unbind(L.E,K.CtrlShift),A.unbind(L.R,K.CtrlShift),A.unbind(L.J,K.CtrlShift),ga&&A.unbind(L.C,K.CtrlAlt),A.unbind(L.Z,K.Ctrl),A.unbind(L.Z,K.CtrlShift));P.setDefault(null);
P.unbind(L.Enter,K.None)};this.getInputMemberId=function(){return c};this.getSession=function(){return k};this.getSessionConstraints=function(){return Y};this.setUndoManager=function(a){ba&&ba.unsubscribe(gui.UndoManager.signalUndoStackChanged,m);if(ba=a)ba.setDocument(H),ba.setPlaybackFunction(k.enqueue),ba.subscribe(gui.UndoManager.signalUndoStackChanged,m)};this.getUndoManager=function(){return ba};this.getMetadataController=function(){return sa};this.getAnnotationController=function(){return fa};
this.getDirectFormattingController=function(){return ca};this.getHyperlinkClickHandler=function(){return ma};this.getHyperlinkController=function(){return ta};this.getImageController=function(){return na};this.getSelectionController=function(){return V};this.getTextController=function(){return ea};this.getEventManager=function(){return R};this.getKeyboardHandlers=function(){return{keydown:A,keypress:P}};this.destroy=function(a){var b=[ja.destroy,da.destroy,ca.destroy,ka.destroy,R.destroy,ma.destroy,
ta.destroy,sa.destroy,ea.destroy,$];qa&&b.unshift(qa.destroy);runtime.clearTimeout(ia);core.Async.destroyAll(b,a)};ja=core.Task.createRedrawTask(y);da=core.Task.createRedrawTask(function(){var a=H.getCursor(c);if(a&&a.getSelectionType()===ops.OdtCursor.RegionSelection&&(a=E.getImageElements(a.getSelectedRange())[0])){la.select(a.parentNode);return}la.clearSelection()});A.bind(L.Left,K.None,C(V.moveCursorToLeft));A.bind(L.Right,K.None,C(V.moveCursorToRight));A.bind(L.Up,K.None,C(V.moveCursorUp));A.bind(L.Down,
K.None,C(V.moveCursorDown));A.bind(L.Left,K.Shift,C(V.extendSelectionToLeft));A.bind(L.Right,K.Shift,C(V.extendSelectionToRight));A.bind(L.Up,K.Shift,C(V.extendSelectionUp));A.bind(L.Down,K.Shift,C(V.extendSelectionDown));A.bind(L.Home,K.None,C(V.moveCursorToLineStart));A.bind(L.End,K.None,C(V.moveCursorToLineEnd));A.bind(L.Home,K.Ctrl,C(V.moveCursorToDocumentStart));A.bind(L.End,K.Ctrl,C(V.moveCursorToDocumentEnd));A.bind(L.Home,K.Shift,C(V.extendSelectionToLineStart));A.bind(L.End,K.Shift,C(V.extendSelectionToLineEnd));
A.bind(L.Up,K.CtrlShift,C(V.extendSelectionToParagraphStart));A.bind(L.Down,K.CtrlShift,C(V.extendSelectionToParagraphEnd));A.bind(L.Home,K.CtrlShift,C(V.extendSelectionToDocumentStart));A.bind(L.End,K.CtrlShift,C(V.extendSelectionToDocumentEnd));pa?(A.bind(L.Left,K.Alt,C(V.moveCursorBeforeWord)),A.bind(L.Right,K.Alt,C(V.moveCursorPastWord)),A.bind(L.Left,K.Meta,C(V.moveCursorToLineStart)),A.bind(L.Right,K.Meta,C(V.moveCursorToLineEnd)),A.bind(L.Home,K.Meta,C(V.moveCursorToDocumentStart)),A.bind(L.End,
K.Meta,C(V.moveCursorToDocumentEnd)),A.bind(L.Left,K.AltShift,C(V.extendSelectionBeforeWord)),A.bind(L.Right,K.AltShift,C(V.extendSelectionPastWord)),A.bind(L.Left,K.MetaShift,C(V.extendSelectionToLineStart)),A.bind(L.Right,K.MetaShift,C(V.extendSelectionToLineEnd)),A.bind(L.Up,K.AltShift,C(V.extendSelectionToParagraphStart)),A.bind(L.Down,K.AltShift,C(V.extendSelectionToParagraphEnd)),A.bind(L.Up,K.MetaShift,C(V.extendSelectionToDocumentStart)),A.bind(L.Down,K.MetaShift,C(V.extendSelectionToDocumentEnd)),
A.bind(L.A,K.Meta,C(V.extendSelectionToEntireDocument))):(A.bind(L.Left,K.Ctrl,C(V.moveCursorBeforeWord)),A.bind(L.Right,K.Ctrl,C(V.moveCursorPastWord)),A.bind(L.Left,K.CtrlShift,C(V.extendSelectionBeforeWord)),A.bind(L.Right,K.CtrlShift,C(V.extendSelectionPastWord)),A.bind(L.A,K.Ctrl,C(V.extendSelectionToEntireDocument)));ua&&(qa=new gui.IOSSafariSupport(R));R.subscribe("keydown",A.handleEvent);R.subscribe("keypress",P.handleEvent);R.subscribe("keyup",J.handleEvent);R.subscribe("copy",l);R.subscribe("mousedown",
t);R.subscribe("mousemove",ja.trigger);R.subscribe("mouseup",Q);R.subscribe("contextmenu",q);R.subscribe("dragstart",D);R.subscribe("dragend",F);R.subscribe("click",ma.handleClick);R.subscribe("longpress",B);R.subscribe("drag",v);R.subscribe("dragstop",z);H.subscribe(ops.OdtDocument.signalOperationEnd,da.trigger);H.subscribe(ops.Document.signalCursorAdded,ka.registerCursor);H.subscribe(ops.Document.signalCursorRemoved,ka.removeCursor);H.subscribe(ops.OdtDocument.signalOperationEnd,a)}})();gui.CaretManager=function(f){function k(b){return a.hasOwnProperty(b)?a[b]:null}function c(){return Object.keys(a).map(function(b){return a[b]})}function b(b){var d=a[b];d&&(delete a[b],b===f.getInputMemberId()&&f.getEventManager().unsubscribe("compositionupdate",d.handleUpdate),d.destroy(function(){}))}function e(a){a=a.getMemberId();a===f.getInputMemberId()&&(a=k(a))&&a.refreshCursorBlinking()}function p(){var a=k(f.getInputMemberId());x=!1;a&&a.ensureVisible()}function h(){var a=k(f.getInputMemberId());
a&&(a.handleUpdate(),x||(x=!0,g=runtime.setTimeout(p,50)))}function n(a){a.memberId===f.getInputMemberId()&&h()}function s(){var a=k(f.getInputMemberId());a&&a.setFocus()}function l(){var a=k(f.getInputMemberId());a&&a.removeFocus()}function r(){var a=k(f.getInputMemberId());a&&a.show()}function d(){var a=k(f.getInputMemberId());a&&a.hide()}var a={},m=runtime.getWindow(),g,x=!1;this.registerCursor=function(b,d,c){var e=b.getMemberId();d=new gui.Caret(b,d,c);c=f.getEventManager();a[e]=d;e===f.getInputMemberId()?
(runtime.log("Starting to track input on new cursor of "+e),b.subscribe(ops.OdtCursor.signalCursorUpdated,h),c.subscribe("compositionupdate",d.handleUpdate),d.setOverlayElement(c.getEventTrap())):b.subscribe(ops.OdtCursor.signalCursorUpdated,d.handleUpdate);return d};this.getCaret=k;this.getCarets=c;this.destroy=function(h){var k=f.getSession().getOdtDocument(),p=f.getEventManager(),t=c().map(function(a){return a.destroy});runtime.clearTimeout(g);k.unsubscribe(ops.OdtDocument.signalParagraphChanged,
n);k.unsubscribe(ops.Document.signalCursorMoved,e);k.unsubscribe(ops.Document.signalCursorRemoved,b);p.unsubscribe("focus",s);p.unsubscribe("blur",l);m.removeEventListener("focus",r,!1);m.removeEventListener("blur",d,!1);a={};core.Async.destroyAll(t,h)};(function(){var a=f.getSession().getOdtDocument(),c=f.getEventManager();a.subscribe(ops.OdtDocument.signalParagraphChanged,n);a.subscribe(ops.Document.signalCursorMoved,e);a.subscribe(ops.Document.signalCursorRemoved,b);c.subscribe("focus",s);c.subscribe("blur",
l);m.addEventListener("focus",r,!1);m.addEventListener("blur",d,!1)})()};gui.EditInfoHandle=function(f){var k=[],c,b=f.ownerDocument,e=b.documentElement.namespaceURI;this.setEdits=function(f){k=f;var h,n,s,l;c.innerHTML="";for(f=0;f<k.length;f+=1)h=b.createElementNS(e,"div"),h.className="editInfo",n=b.createElementNS(e,"span"),n.className="editInfoColor",n.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid),s=b.createElementNS(e,"span"),s.className="editInfoAuthor",s.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid),
l=b.createElementNS(e,"span"),l.className="editInfoTime",l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[f].memberid),l.innerHTML=k[f].time,h.appendChild(n),h.appendChild(s),h.appendChild(l),c.appendChild(h)};this.show=function(){c.style.display="block"};this.hide=function(){c.style.display="none"};this.destroy=function(b){f.removeChild(c);b()};c=b.createElementNS(e,"div");c.setAttribute("class","editInfoHandle");c.style.display="none";f.appendChild(c)};ops.EditInfo=function(f,k){function c(){var b=[],c;for(c in e)e.hasOwnProperty(c)&&b.push({memberid:c,time:e[c].time});b.sort(function(b,c){return b.time-c.time});return b}var b,e={};this.getNode=function(){return b};this.getOdtDocument=function(){return k};this.getEdits=function(){return e};this.getSortedEdits=function(){return c()};this.addEdit=function(b,c){e[b]={time:c}};this.clearEdits=function(){e={}};this.destroy=function(c){f.parentNode&&f.removeChild(b);c()};b=k.getDOMDocument().createElementNS("urn:webodf:names:editinfo",
"editinfo");f.insertBefore(b,f.firstChild)};gui.EditInfoMarker=function(f,k){function c(b,d){return runtime.setTimeout(function(){h.style.opacity=b},d)}var b=this,e,p,h,n,s,l;this.addEdit=function(b,d){var a=Date.now()-d;f.addEdit(b,d);p.setEdits(f.getSortedEdits());h.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",b);runtime.clearTimeout(s);runtime.clearTimeout(l);1E4>a?(n=c(1,0),s=c(0.5,1E4-a),l=c(0.2,2E4-a)):1E4<=a&&2E4>a?(n=c(0.5,0),l=c(0.2,2E4-a)):n=c(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits=
function(){f.clearEdits();p.setEdits([]);h.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&h.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){h.style.display="block"};this.hide=function(){b.hideHandle();h.style.display="none"};this.showHandle=function(){p.show()};this.hideHandle=function(){p.hide()};this.destroy=function(b){runtime.clearTimeout(n);runtime.clearTimeout(s);runtime.clearTimeout(l);e.removeChild(h);
p.destroy(function(d){d?b(d):f.destroy(b)})};(function(){var c=f.getOdtDocument().getDOMDocument();h=c.createElementNS(c.documentElement.namespaceURI,"div");h.setAttribute("class","editInfoMarker");h.onmouseover=function(){b.showHandle()};h.onmouseout=function(){b.hideHandle()};e=f.getNode();e.appendChild(h);p=new gui.EditInfoHandle(e);k||b.hide()})()};gui.HyperlinkTooltipView=function(f,k){var c=new core.DomUtils,b=new odf.OdfUtils,e=runtime.getWindow(),p,h,n;runtime.assert(null!==e,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(s){var l=s.target||s.srcElement,r=f.getSizer(),d=f.getZoomLevel(),a;a:{for(;l;){if(b.isHyperlink(l))break a;if(b.isParagraph(l)||b.isInlineRoot(l))break;l=l.parentNode}l=null}if(l){c.containsNode(r,n)||r.appendChild(n);a=h;var m;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:m=
runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:m=runtime.tr("\u2318-click to follow link");break;default:m=""}a.textContent=m;p.textContent=b.getHyperlinkTarget(l);n.style.display="block";a=e.innerWidth-n.offsetWidth-15;l=s.clientX>a?a:s.clientX+15;a=e.innerHeight-n.offsetHeight-10;s=s.clientY>a?a:s.clientY+10;r=r.getBoundingClientRect();l=(l-r.left)/d;s=(s-r.top)/d;n.style.left=l+"px";n.style.top=s+"px"}};this.hideTooltip=function(){n.style.display="none"};this.destroy=
function(b){n.parentNode&&n.parentNode.removeChild(n);b()};(function(){var b=f.getElement().ownerDocument;p=b.createElement("span");h=b.createElement("span");p.className="webodf-hyperlinkTooltipLink";h.className="webodf-hyperlinkTooltipText";n=b.createElement("div");n.className="webodf-hyperlinkTooltip";n.appendChild(p);n.appendChild(h);f.getElement().appendChild(n)})()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),c=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(b,e){k=b;c=!1!==e};this.hasForwardSelection=function(){return c};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(c).map(function(b){return c[b]})}var c={};this.getSelectionView=function(b){return c.hasOwnProperty(b)?c[b]:null};this.getSelectionViews=k;this.removeSelectionView=function(b){c.hasOwnProperty(b)&&(c[b].destroy(function(){}),delete c[b])};this.hideSelectionView=function(b){c.hasOwnProperty(b)&&c[b].hide()};this.showSelectionView=function(b){c.hasOwnProperty(b)&&c[b].show()};this.rerenderSelectionViews=function(){Object.keys(c).forEach(function(b){c[b].rerender()})};
this.registerCursor=function(b,e){var k=b.getMemberId(),h=new f(b);e?h.show():h.hide();return c[k]=h};this.destroy=function(b){function c(h,k){k?b(k):h<f.length?f[h].destroy(function(b){c(h+1,b)}):b()}var f=k();c(0,void 0)}};gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0};
(function(){gui.SessionView=function(f,k,c,b,e,p){function h(){var a=document.getElementsByTagName("head").item(0),b=document.createElement("style");b.type="text/css";b.media="screen, print, handheld, projection";a.appendChild(b);return b}function n(a,b,d){function c(b,d,e){d=b+'[editinfo|memberid="'+a+'"]'+e+d;a:{var f=z.firstChild;for(b=b+'[editinfo|memberid="'+a+'"]'+e+"{";f;){if(f.nodeType===Node.TEXT_NODE&&0===f.data.indexOf(b)){b=f;break a}f=f.nextSibling}b=null}b?b.data=d:z.appendChild(document.createTextNode(d))}
c("div.editInfoMarker","{ background-color: "+d+"; }","");c("span.editInfoColor","{ background-color: "+d+"; }","");c("span.editInfoAuthor",'{ content: "'+b+'"; }',":before");c("dc|creator","{ background-color: "+d+"; }","");c(".webodf-selectionOverlay","{ fill: "+d+"; stroke: "+d+";}","");a!==gui.ShadowCursor.ShadowCursorMemberId&&a!==k||c(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable")}function s(a){var b,d;for(d in u)u.hasOwnProperty(d)&&(b=u[d],a?
b.show():b.hide())}function l(a){e.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function r(a){var b=a.getMemberId();a=a.getProperties();n(b,a.fullName,a.color);k===b&&n("","",a.color)}function d(a){var b=a.getMemberId(),d=c.getOdtDocument().getMember(b).getProperties();e.registerCursor(a,F,q);p.registerCursor(a,!0);if(a=e.getCaret(b))a.setAvatarImageUrl(d.imageUrl),a.setColor(d.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+b+"'! +++")}function a(a){a=a.getMemberId();
var b=p.getSelectionView(k),d=p.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),c=e.getCaret(k);a===k?(d.hide(),b&&b.show(),c&&c.show()):a===gui.ShadowCursor.ShadowCursorMemberId&&(d.show(),b&&b.hide(),c&&c.hide())}function m(a){p.removeSelectionView(a)}function g(a){var b=a.paragraphElement,d=a.memberId;a=a.timeStamp;var e,f="",g=b.getElementsByTagNameNS(t,"editinfo").item(0);g?(f=g.getAttributeNS(t,"id"),e=u[f]):(f=Math.random().toString(),e=new ops.EditInfo(b,c.getOdtDocument()),e=new gui.EditInfoMarker(e,
D),g=b.getElementsByTagNameNS(t,"editinfo").item(0),g.setAttributeNS(t,"id",f),u[f]=e);e.addEdit(d,new Date(a));I.trigger()}function x(){var a;""!==y.innerHTML&&(y.innerHTML="");!0===b.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(a=c.getOdtDocument().getMember(k))&&(a=a.getProperties().fullName,y.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+a+"']) .annotationRemoveButton { display: none; }")))}function v(c){var e=Object.keys(u).map(function(a){return u[a]});
w.unsubscribe(ops.Document.signalMemberAdded,r);w.unsubscribe(ops.Document.signalMemberUpdated,r);w.unsubscribe(ops.Document.signalCursorAdded,d);w.unsubscribe(ops.Document.signalCursorRemoved,m);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,g);w.unsubscribe(ops.Document.signalCursorMoved,a);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,p.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalTableAdded,p.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,
p.rerenderSelectionViews);b.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,x);w.unsubscribe(ops.Document.signalMemberAdded,x);w.unsubscribe(ops.Document.signalMemberUpdated,x);z.parentNode.removeChild(z);y.parentNode.removeChild(y);(function C(a,b){b?c(b):a<e.length?e[a].destroy(function(b){C(a+1,b)}):c()})(0,void 0)}var z,y,t="urn:webodf:names:editinfo",u={},w,B,I,D=void 0!==f.editInfoMarkersInitiallyVisible?Boolean(f.editInfoMarkersInitiallyVisible):!0,F=void 0!==f.caretAvatarsInitiallyVisible?
Boolean(f.caretAvatarsInitiallyVisible):!0,q=void 0!==f.caretBlinksOnRangeSelect?Boolean(f.caretBlinksOnRangeSelect):!0;this.showEditInfoMarkers=function(){D||(D=!0,s(D))};this.hideEditInfoMarkers=function(){D&&(D=!1,s(D))};this.showCaretAvatars=function(){F||(F=!0,l(F))};this.hideCaretAvatars=function(){F&&(F=!1,l(F))};this.getSession=function(){return c};this.getCaret=function(a){return e.getCaret(a)};this.destroy=function(a){core.Async.destroyAll([I.destroy,v],a)};w=c.getOdtDocument();B=w.getOdfCanvas();
w.subscribe(ops.Document.signalMemberAdded,r);w.subscribe(ops.Document.signalMemberUpdated,r);w.subscribe(ops.Document.signalCursorAdded,d);w.subscribe(ops.Document.signalCursorRemoved,m);w.subscribe(ops.OdtDocument.signalParagraphChanged,g);w.subscribe(ops.Document.signalCursorMoved,a);w.subscribe(ops.OdtDocument.signalParagraphChanged,p.rerenderSelectionViews);w.subscribe(ops.OdtDocument.signalTableAdded,p.rerenderSelectionViews);w.subscribe(ops.OdtDocument.signalParagraphStyleModified,p.rerenderSelectionViews);
b.subscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,x);w.subscribe(ops.Document.signalMemberAdded,x);w.subscribe(ops.Document.signalMemberUpdated,x);z=h();z.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));z.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));y=h();x();I=core.Task.createRedrawTask(function(){var a=B.getAnnotationViewManager();a&&(a.rehighlightAnnotations(),w.fixCursorPositions())})}})();gui.SvgSelectionView=function(f){function k(){var b=a.getRootNode();m!==b&&(m=b,g=a.getCanvas().getSizer(),g.appendChild(v),v.setAttribute("class","webodf-selectionOverlay"),y.setAttribute("class","webodf-draggable"),t.setAttribute("class","webodf-draggable"),y.setAttribute("end","left"),t.setAttribute("end","right"),y.setAttribute("r",8),t.setAttribute("r",8),v.appendChild(z),v.appendChild(y),v.appendChild(t))}function c(a){a=a.getBoundingClientRect();return Boolean(a&&0!==a.height)}function b(a){var b=
u.getTextElements(a,!0,!1),d=a.cloneRange(),e=a.cloneRange();a=a.cloneRange();if(!b.length)return null;var f;a:{f=0;var g=b[f],h=d.startContainer===g?d.startOffset:0,m=h;d.setStart(g,h);for(d.setEnd(g,m);!c(d);){if(g.nodeType===Node.ELEMENT_NODE&&m<g.childNodes.length)m=g.childNodes.length;else if(g.nodeType===Node.TEXT_NODE&&m<g.length)m+=1;else if(b[f])g=b[f],f+=1,h=m=0;else{f=!1;break a}d.setStart(g,h);d.setEnd(g,m)}f=!0}if(!f)return null;a:{f=b.length-1;g=b[f];m=h=e.endContainer===g?e.endOffset:
g.nodeType===Node.TEXT_NODE?g.length:g.childNodes.length;e.setStart(g,h);for(e.setEnd(g,m);!c(e);){if(g.nodeType===Node.ELEMENT_NODE&&0<h)h=0;else if(g.nodeType===Node.TEXT_NODE&&0<h)h-=1;else if(b[f])g=b[f],f-=1,h=m=g.length||g.childNodes.length;else{b=!1;break a}e.setStart(g,h);e.setEnd(g,m)}b=!0}if(!b)return null;a.setStart(d.startContainer,d.startOffset);a.setEnd(e.endContainer,e.endOffset);return{firstRange:d,lastRange:e,fillerRange:a}}function e(a,b){var d={};d.top=Math.min(a.top,b.top);d.left=
Math.min(a.left,b.left);d.right=Math.max(a.right,b.right);d.bottom=Math.max(a.bottom,b.bottom);d.width=d.right-d.left;d.height=d.bottom-d.top;return d}function p(a,b){b&&0<b.width&&0<b.height&&(a=a?e(a,b):b);return a}function h(b){function d(a){D.setUnfilteredPosition(a,0);return v.acceptNode(a)===F&&t.acceptPosition(D)===F?F:q}function c(a){var b=null;d(a)===F&&(b=w.getBoundingClientRect(a));return b}var e=b.commonAncestorContainer,f=b.startContainer,g=b.endContainer,h=b.startOffset,m=b.endOffset,
l,k,n=null,r,s=x.createRange(),t,v=new odf.OdfNodeFilter,y;if(f===e||g===e)return s=b.cloneRange(),n=s.getBoundingClientRect(),s.detach(),n;for(b=f;b.parentNode!==e;)b=b.parentNode;for(k=g;k.parentNode!==e;)k=k.parentNode;t=a.createRootFilter(f);for(e=b.nextSibling;e&&e!==k;)r=c(e),n=p(n,r),e=e.nextSibling;if(u.isParagraph(b))n=p(n,w.getBoundingClientRect(b));else if(b.nodeType===Node.TEXT_NODE)e=b,s.setStart(e,h),s.setEnd(e,e===k?m:e.length),r=s.getBoundingClientRect(),n=p(n,r);else for(y=x.createTreeWalker(b,
NodeFilter.SHOW_TEXT,d,!1),e=y.currentNode=f;e&&e!==g;)s.setStart(e,h),s.setEnd(e,e.length),r=s.getBoundingClientRect(),n=p(n,r),l=e,h=0,e=y.nextNode();l||(l=f);if(u.isParagraph(k))n=p(n,w.getBoundingClientRect(k));else if(k.nodeType===Node.TEXT_NODE)e=k,s.setStart(e,e===b?h:0),s.setEnd(e,m),r=s.getBoundingClientRect(),n=p(n,r);else for(y=x.createTreeWalker(k,NodeFilter.SHOW_TEXT,d,!1),e=y.currentNode=g;e&&e!==l;)if(s.setStart(e,0),s.setEnd(e,m),r=s.getBoundingClientRect(),n=p(n,r),e=y.previousNode())m=
e.length;return n}function n(a,b){var d=a.getBoundingClientRect(),c={width:0};c.top=d.top;c.bottom=d.bottom;c.height=d.height;c.left=c.right=b?d.right:d.left;return c}function s(){var a=f.getSelectedRange(),d;if(d=I&&f.getSelectionType()===ops.OdtCursor.RangeSelection&&!a.collapsed){k();var c=w.getBoundingClientRect(g),m=B.getZoomLevel(),a=b(a),l,p,q,r,s,u;if(a){d=a.firstRange;l=a.lastRange;p=a.fillerRange;q=w.translateRect(n(d,!1),c,m);s=w.translateRect(n(l,!0),c,m);r=(r=h(p))?w.translateRect(r,
c,m):e(q,s);u=r.left;r=q.left+Math.max(0,r.width-(q.left-r.left));c=Math.min(q.top,s.top);m=s.top+s.height;u=[{x:q.left,y:c+q.height},{x:q.left,y:c},{x:r,y:c},{x:r,y:m-s.height},{x:s.right,y:m-s.height},{x:s.right,y:m},{x:u,y:m},{x:u,y:c+q.height},{x:q.left,y:c+q.height}];r="";var x;for(x=0;x<u.length;x+=1)r+=u[x].x+","+u[x].y+" ";z.setAttribute("points",r);y.setAttribute("cx",q.left);y.setAttribute("cy",c+q.height/2);t.setAttribute("cx",s.right);t.setAttribute("cy",m-s.height/2);d.detach();l.detach();
p.detach()}d=Boolean(a)}v.style.display=d?"block":"none"}function l(a){I&&a===f&&Q.trigger()}function r(a){a=8/a;y.setAttribute("r",a);t.setAttribute("r",a)}function d(a){g.removeChild(v);g.classList.remove("webodf-virtualSelections");f.getDocument().unsubscribe(ops.Document.signalCursorMoved,l);B.unsubscribe(gui.ZoomHelper.signalZoomChanged,r);a()}var a=f.getDocument(),m,g,x=a.getDOMDocument(),v=x.createElementNS("http://www.w3.org/2000/svg","svg"),z=x.createElementNS("http://www.w3.org/2000/svg",
"polygon"),y=x.createElementNS("http://www.w3.org/2000/svg","circle"),t=x.createElementNS("http://www.w3.org/2000/svg","circle"),u=new odf.OdfUtils,w=new core.DomUtils,B=a.getCanvas().getZoomHelper(),I=!0,D=gui.SelectionMover.createPositionIterator(a.getRootNode()),F=NodeFilter.FILTER_ACCEPT,q=NodeFilter.FILTER_REJECT,Q;this.rerender=function(){I&&Q.trigger()};this.show=function(){I=!0;Q.trigger()};this.hide=function(){I=!1;Q.trigger()};this.destroy=function(a){core.Async.destroyAll([Q.destroy,d],
a)};(function(){var a=f.getMemberId();Q=core.Task.createRedrawTask(s);k();v.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",a);g.classList.add("webodf-virtualSelections");f.getDocument().subscribe(ops.Document.signalCursorMoved,l);B.subscribe(gui.ZoomHelper.signalZoomChanged,r);r(B.getZoomLevel())})()};gui.UndoStateRules=function(){function f(b,c){var f=b.length;this.previous=function(){for(f-=1;0<=f;f-=1)if(c(b[f]))return b[f];return null}}function k(b){b=b.spec();var c;b.hasOwnProperty("position")&&(c=b.position);return c}function c(b){return b.isEdit}function b(b,c,f){if(!f)return f=k(b)-k(c),0===f||1===Math.abs(f);b=k(b);c=k(c);f=k(f);return b-c===c-f}this.isEditOperation=c;this.isPartOfOperationSet=function(e,k){var h=void 0!==e.group,n;if(!e.isEdit||0===k.length)return!0;n=k[k.length-1];if(h&&
e.group===n.group)return!0;a:switch(e.spec().optype){case "RemoveText":case "InsertText":n=!0;break a;default:n=!1}if(n&&k.some(c)){if(h){var s;h=e.spec().optype;n=new f(k,c);var l=n.previous(),r=null,d,a;runtime.assert(Boolean(l),"No edit operations found in state");a=l.group;runtime.assert(void 0!==a,"Operation has no group");for(d=1;l&&l.group===a;){if(h===l.spec().optype){s=l;break}l=n.previous()}if(s){for(l=n.previous();l;){if(l.group!==a){if(2===d)break;a=l.group;d+=1}if(h===l.spec().optype){r=
l;break}l=n.previous()}s=b(e,s,r)}else s=!1;return s}s=e.spec().optype;h=new f(k,c);n=h.previous();runtime.assert(Boolean(n),"No edit operations found in state");s=s===n.spec().optype?b(e,n,h.previous()):!1;return s}return!1}};gui.TrivialUndoManager=function(f){function k(a){0<a.length&&(u=!0,m(a),u=!1)}function c(){y.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:s.hasUndoStates(),redoAvailable:s.hasRedoStates()})}function b(){x!==a&&x!==v[v.length-1]&&v.push(x)}function e(a){var b=a.previousSibling||a.nextSibling;a.parentNode.removeChild(a);r.normalizeTextNodes(b)}function p(a){return Object.keys(a).map(function(b){return a[b]})}function h(a){function b(a){var g=a.spec();if(e[g.memberid])switch(g.optype){case "AddCursor":d[g.memberid]||
(d[g.memberid]=a,delete e[g.memberid],f-=1);break;case "MoveCursor":c[g.memberid]||(c[g.memberid]=a)}}var d={},c={},e={},f,h=a.pop();g.getMemberIds().forEach(function(a){e[a]=!0});for(f=Object.keys(e).length;h&&0<f;)h.reverse(),h.forEach(b),h=a.pop();return p(d).concat(p(c))}function n(){var f=d=g.cloneDocumentElement();r.getElementsByTagNameNS(f,l,"cursor").forEach(e);r.getElementsByTagNameNS(f,l,"anchor").forEach(e);b();x=a=h([a].concat(v));v.length=0;z.length=0;c()}var s=this,l="urn:webodf:names:cursor",
r=new core.DomUtils,d,a=[],m,g,x=[],v=[],z=[],y=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged,gui.UndoManager.signalUndoStateCreated,gui.UndoManager.signalUndoStateModified,gui.TrivialUndoManager.signalDocumentRootReplaced]),t=f||new gui.UndoStateRules,u=!1;this.subscribe=function(a,b){y.subscribe(a,b)};this.unsubscribe=function(a,b){y.unsubscribe(a,b)};this.hasUndoStates=function(){return 0<v.length};this.hasRedoStates=function(){return 0<z.length};this.setDocument=function(a){g=
a};this.purgeInitialState=function(){v.length=0;z.length=0;a.length=0;x.length=0;d=null;c()};this.setInitialState=n;this.initialize=function(){d||n()};this.setPlaybackFunction=function(a){m=a};this.onOperationExecuted=function(d){u||(t.isEditOperation(d)&&(x===a||0<z.length)||!t.isPartOfOperationSet(d,x)?(z.length=0,b(),x=[d],v.push(x),y.emit(gui.UndoManager.signalUndoStateCreated,{operations:x}),c()):(x.push(d),y.emit(gui.UndoManager.signalUndoStateModified,{operations:x})))};this.moveForward=function(a){for(var b=
0,d;a&&z.length;)d=z.pop(),v.push(d),k(d),a-=1,b+=1;b&&(x=v[v.length-1],c());return b};this.moveBackward=function(b){for(var e=0;b&&v.length;)z.push(v.pop()),b-=1,e+=1;e&&(g.getMemberIds().forEach(function(a){g.removeCursor(a)}),g.setDocumentElement(d.cloneNode(!0)),y.emit(gui.TrivialUndoManager.signalDocumentRootReplaced,{}),k(a),v.forEach(k),x=v[v.length-1]||a,c());return e}};gui.TrivialUndoManager.signalDocumentRootReplaced="documentRootReplaced";odf.LazyStyleProperties=function(f,k){var c={};this.value=function(b){var e;c.hasOwnProperty(b)?e=c[b]:(e=k[b](),void 0===e&&f&&(e=f.value(b)),c[b]=e);return e};this.reset=function(b){f=b;c={}}};
odf.StyleParseUtils=function(){function f(c){var b,e;c=(c=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/.exec(c))?{value:parseFloat(c[1]),unit:c[3]}:null;e=c&&c.unit;"px"===e?b=c.value:"cm"===e?b=96*(c.value/2.54):"mm"===e?b=96*(c.value/25.4):"in"===e?b=96*c.value:"pt"===e?b=c.value/0.75:"pc"===e&&(b=16*c.value);return b}var k=odf.Namespaces.stylens;this.parseLength=f;this.parsePositiveLengthOrPercent=function(c,b,e){var k;c&&(k=parseFloat(c.substr(0,
c.indexOf("%"))),isNaN(k)&&(k=void 0));var h;void 0!==k?(e&&(h=e.value(b)),k=void 0===h?void 0:k*(h/100)):k=f(c);return k};this.getPropertiesElement=function(c,b,e){for(b=e?e.nextElementSibling:b.firstElementChild;null!==b&&(b.localName!==c||b.namespaceURI!==k);)b=b.nextElementSibling;return b}};odf.GraphicProperties=function(f,k,c){var b=this,e=odf.Namespaces.stylens,p=odf.Namespaces.svgns;this.verticalPos=function(){return b.data.value("verticalPos")};this.verticalRel=function(){return b.data.value("verticalRel")};this.horizontalPos=function(){return b.data.value("horizontalPos")};this.horizontalRel=function(){return b.data.value("horizontalRel")};this.strokeWidth=function(){return b.data.value("strokeWidth")};b.data=new odf.LazyStyleProperties(void 0===c?void 0:c.data,{verticalPos:function(){var b=
f.getAttributeNS(e,"vertical-pos");return""===b?void 0:b},verticalRel:function(){var b=f.getAttributeNS(e,"vertical-rel");return""===b?void 0:b},horizontalPos:function(){var b=f.getAttributeNS(e,"horizontal-pos");return""===b?void 0:b},horizontalRel:function(){var b=f.getAttributeNS(e,"horizontal-rel");return""===b?void 0:b},strokeWidth:function(){var b=f.getAttributeNS(p,"stroke-width");return k.parseLength(b)}})};
odf.ComputedGraphicProperties=function(){var f;this.setGraphicProperties=function(k){f=k};this.verticalPos=function(){return f&&f.verticalPos()||"from-top"};this.verticalRel=function(){return f&&f.verticalRel()||"page"};this.horizontalPos=function(){return f&&f.horizontalPos()||"from-left"};this.horizontalRel=function(){return f&&f.horizontalRel()||"page"}};odf.PageLayoutProperties=function(f,k,c){var b=this,e=odf.Namespaces.fons;this.pageHeight=function(){return b.data.value("pageHeight")||1123};this.pageWidth=function(){return b.data.value("pageWidth")||794};b.data=new odf.LazyStyleProperties(void 0===c?void 0:c.data,{pageHeight:function(){var b;f&&(b=f.getAttributeNS(e,"page-height"),b=k.parseLength(b));return b},pageWidth:function(){var b;f&&(b=f.getAttributeNS(e,"page-width"),b=k.parseLength(b));return b}})};
odf.PageLayout=function(f,k,c){var b=null;f&&(b=k.getPropertiesElement("page-layout-properties",f));this.pageLayout=new odf.PageLayoutProperties(b,k,c&&c.pageLayout)};odf.PageLayoutCache=function(){};odf.PageLayoutCache.prototype.getPageLayout=function(f){};odf.PageLayoutCache.prototype.getDefaultPageLayout=function(){};odf.ParagraphProperties=function(f,k,c){var b=this,e=odf.Namespaces.fons;this.marginTop=function(){return b.data.value("marginTop")};b.data=new odf.LazyStyleProperties(void 0===c?void 0:c.data,{marginTop:function(){var b=f.getAttributeNS(e,"margin-top");return k.parsePositiveLengthOrPercent(b,"marginTop",c&&c.data)}})};
odf.ComputedParagraphProperties=function(){var f={},k=[];this.setStyleChain=function(c){k=c;f={}};this.marginTop=function(){var c,b;if(f.hasOwnProperty("marginTop"))c=f.marginTop;else{for(b=0;void 0===c&&b<k.length;b+=1)c=k[b].marginTop();f.marginTop=c}return c||0}};odf.TextProperties=function(f,k,c){var b=this,e=odf.Namespaces.fons;this.fontSize=function(){return b.data.value("fontSize")};b.data=new odf.LazyStyleProperties(void 0===c?void 0:c.data,{fontSize:function(){var b=f.getAttributeNS(e,"font-size");return k.parsePositiveLengthOrPercent(b,"fontSize",c&&c.data)}})};
odf.ComputedTextProperties=function(){var f={},k=[];this.setStyleChain=function(c){k=c;f={}};this.fontSize=function(){var c,b;if(f.hasOwnProperty("fontSize"))c=f.fontSize;else{for(b=0;void 0===c&&b<k.length;b+=1)c=k[b].fontSize();f.fontSize=c}return c||12}};odf.MasterPage=function(f,k){var c;f?(c=f.getAttributeNS(odf.Namespaces.stylens,"page-layout-name"),this.pageLayout=k.getPageLayout(c)):this.pageLayout=k.getDefaultPageLayout()};odf.MasterPageCache=function(){};odf.MasterPageCache.prototype.getMasterPage=function(f){};
odf.StylePileEntry=function(f,k,c,b){this.masterPage=function(){var b=f.getAttributeNS(odf.Namespaces.stylens,"master-page-name"),k=null;b&&(k=c.getMasterPage(b));return k};(function(c){var p=f.getAttributeNS(odf.Namespaces.stylens,"family"),h=null;if("graphic"===p||"chart"===p)c.graphic=void 0===b?void 0:b.graphic,h=k.getPropertiesElement("graphic-properties",f,h),null!==h&&(c.graphic=new odf.GraphicProperties(h,k,c.graphic));if("paragraph"===p||"table-cell"===p||"graphic"===p||"presentation"===
p||"chart"===p)c.paragraph=void 0===b?void 0:b.paragraph,h=k.getPropertiesElement("paragraph-properties",f,h),null!==h&&(c.paragraph=new odf.ParagraphProperties(h,k,c.paragraph));if("text"===p||"paragraph"===p||"table-cell"===p||"graphic"===p||"presentation"===p||"chart"===p)c.text=void 0===b?void 0:b.text,h=k.getPropertiesElement("text-properties",f,h),null!==h&&(c.text=new odf.TextProperties(h,k,c.text))})(this)};
odf.StylePile=function(f,k){function c(c,d){var a,e;c.hasAttributeNS(b,"parent-style-name")&&(e=c.getAttributeNS(b,"parent-style-name"),-1===d.indexOf(e)&&(a=l(e,d)));return new odf.StylePileEntry(c,f,k,a)}var b=odf.Namespaces.stylens,e={},p={},h,n={},s={},l;l=function(b,d){var a=n[b],f;!a&&(f=e[b])&&(d.push(b),a=c(f,d),n[b]=a);return a};this.getStyle=function(b){var d=s[b]||n[b],a,f=[];d||(a=p[b],a||(a=e[b])&&f.push(b),a&&(d=c(a,f)));return d};this.addCommonStyle=function(c){var d;c.hasAttributeNS(b,
"name")&&(d=c.getAttributeNS(b,"name"),e.hasOwnProperty(d)||(e[d]=c))};this.addAutomaticStyle=function(c){var d;c.hasAttributeNS(b,"name")&&(d=c.getAttributeNS(b,"name"),p.hasOwnProperty(d)||(p[d]=c))};this.setDefaultStyle=function(b){void 0===h&&(h=c(b,[]))};this.getDefaultStyle=function(){return h}};odf.ComputedGraphicStyle=function(){this.text=new odf.ComputedTextProperties;this.paragraph=new odf.ComputedParagraphProperties;this.graphic=new odf.ComputedGraphicProperties};
odf.ComputedParagraphStyle=function(){this.text=new odf.ComputedTextProperties;this.paragraph=new odf.ComputedParagraphProperties};odf.ComputedTextStyle=function(){this.text=new odf.ComputedTextProperties};
odf.StyleCache=function(f){function k(a,b,d,c){b=d.getAttributeNS(b,"class-names");var e;if(b)for(b=b.split(" "),e=0;e<b.length;e+=1)if(d=b[e])c.push(a),c.push(d)}function c(a,b){var d=v.getStyleName("paragraph",a);void 0!==d&&(b.push("paragraph"),b.push(d));a.namespaceURI!==g||"h"!==a.localName&&"p"!==a.localName||k("paragraph",g,a,b);return b}function b(a,b,d){var c=[],e,f,g,h;for(e=0;e<a.length;e+=2)g=a[e],h=a[e+1],g=n[g],h=g.getStyle(h),void 0!==h&&(h=h[b],void 0!==h&&h!==f&&(c.push(h),f=h));
g=n[d];if(h=g.getDefaultStyle())h=h[b],void 0!==h&&h!==f&&c.push(h);return c}function e(a,b){var d=v.getStyleName("text",a),h=a.parentNode;void 0!==d&&(b.push("text"),b.push(d));"span"===a.localName&&a.namespaceURI===g&&k("text",g,a,b);if(!h||h===f)return b;h.namespaceURI!==g||"p"!==h.localName&&"h"!==h.localName?e(h,b):c(h,b);return b}function p(a){a=a.getAttributeNS(x,"family");return n[a]}var h=this,n,s,l,r,d,a,m,g=odf.Namespaces.textns,x=odf.Namespaces.stylens,v=new odf.StyleInfo,z=new odf.StyleParseUtils,
y,t,u,w,B,I;this.getComputedGraphicStyle=function(a){var d=[];a=v.getStyleName("graphic",a);void 0!==a&&(d.push("graphic"),d.push(a));a=d.join("/");var c=r[a];runtime.assert(0===d.length%2,"Invalid style chain.");void 0===c&&(c=new odf.ComputedGraphicStyle,c.graphic.setGraphicProperties(b(d,"graphic","graphic")[0]),c.text.setStyleChain(b(d,"text","graphic")),c.paragraph.setStyleChain(b(d,"paragraph","graphic")),r[a]=c);return c};this.getComputedParagraphStyle=function(a){a=c(a,[]);var d=a.join("/"),
e=l[d];runtime.assert(0===a.length%2,"Invalid style chain.");void 0===e&&(e=new odf.ComputedParagraphStyle,e.text.setStyleChain(b(a,"text","paragraph")),e.paragraph.setStyleChain(b(a,"paragraph","paragraph")),l[d]=e);return e};this.getComputedTextStyle=function(a){a=e(a,[]);var d=a.join("/"),c=s[d];runtime.assert(0===a.length%2,"Invalid style chain.");void 0===c&&(c=new odf.ComputedTextStyle,c.text.setStyleChain(b(a,"text","text")),s[d]=c);return c};this.getPageLayout=function(a){var b=I[a];b||((b=
B[a])?(b=new odf.PageLayout(b,z,w),I[a]=b):b=w);return b};this.getDefaultPageLayout=function(){return w};this.getMasterPage=function(a){var b=t[a];void 0===b&&((b=y[a])?(b=new odf.MasterPage(b,h),t[a]=b):b=null);return b};this.getDefaultMasterPage=function(){return u};this.update=function(){var b,c,e=null,g=null;s={};l={};r={};y={};t={};I={};B={};d=new odf.StylePile(z,h);a=new odf.StylePile(z,h);m=new odf.StylePile(z,h);n={text:d,paragraph:a,graphic:m};for(b=f.styles.firstElementChild;b;)b.namespaceURI===
x&&((c=p(b))?"style"===b.localName?c.addCommonStyle(b):"default-style"===b.localName&&c.setDefaultStyle(b):"default-page-layout"===b.localName&&(e=b)),b=b.nextElementSibling;w=new odf.PageLayout(e,z);for(b=f.automaticStyles.firstElementChild;b;)b.namespaceURI===x&&((c=p(b))&&"style"===b.localName?c.addAutomaticStyle(b):"page-layout"===b.localName&&(B[b.getAttributeNS(x,"name")]=b)),b=b.nextElementSibling;for(b=f.masterStyles.firstElementChild;b;)b.namespaceURI===x&&"master-page"===b.localName&&(g=
g||b,c=b,e=c.getAttributeNS(x,"name"),0<e.length&&!y.hasOwnProperty(e)&&(y[e]=c)),b=b.nextElementSibling;u=new odf.MasterPage(g,h)}};ops.OperationTransformMatrix=function(){function f(b){b.position+=b.length;b.length*=-1}function k(b){var a=0>b.length;a&&f(b);return a}function c(b,a){function c(f){b[f]===a&&e.push(f)}var e=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return e}function b(b,a){function c(e){b[e]===a&&delete b[e]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function e(b){var a={};Object.keys(b).forEach(function(c){a[c]="object"===typeof b[c]?e(b[c]):b[c]});return a}function p(b,
a,c,e){var f,h=!1,k=!1,l,n=[];e&&e.attributes&&(n=e.attributes.split(","));b&&(c||0<n.length)&&Object.keys(b).forEach(function(a){var e=b[a],f;"object"!==typeof e&&(c&&(f=c[a]),void 0!==f?(delete b[a],k=!0,f===e&&(delete c[a],h=!0)):-1!==n.indexOf(a)&&(delete b[a],k=!0))});if(a&&a.attributes&&(c||0<n.length)){l=a.attributes.split(",");for(e=0;e<l.length;e+=1)if(f=l[e],c&&void 0!==c[f]||n&&-1!==n.indexOf(f))l.splice(e,1),e-=1,k=!0;0<l.length?a.attributes=l.join(","):delete a.attributes}return{majorChanged:h,
minorChanged:k}}function h(b){for(var a in b)if(b.hasOwnProperty(a))return!0;return!1}function n(b){for(var a in b)if(b.hasOwnProperty(a)&&("attributes"!==a||0<b.attributes.length))return!0;return!1}function s(b,a,c,e,f){var k=b?b[f]:null,l=a?a[f]:null,r=c?c[f]:null,s=e?e[f]:null,u;u=p(k,l,r,s);k&&!h(k)&&delete b[f];l&&!n(l)&&delete a[f];r&&!h(r)&&delete c[f];s&&!n(s)&&delete e[f];return u}function l(b,a){return{opSpecsA:[b],opSpecsB:[a]}}var r;r={AddCursor:{AddCursor:l,AddMember:l,AddStyle:l,ApplyDirectStyling:l,
InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},AddMember:{AddStyle:l,InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMetadata:l,UpdateParagraphStyle:l},AddStyle:{AddStyle:l,ApplyDirectStyling:l,InsertText:l,MergeParagraph:l,MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:function(d,
a){var e,f=[d],h=[a];d.styleFamily===a.styleFamily&&(e=c(d.setProperties,a.styleName),0<e.length&&(e={optype:"UpdateParagraphStyle",memberid:a.memberid,timestamp:a.timestamp,styleName:d.styleName,removedProperties:{attributes:e.join(",")}},h.unshift(e)),b(d.setProperties,a.styleName));return{opSpecsA:f,opSpecsB:h}},RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},ApplyDirectStyling:{ApplyDirectStyling:function(b,a,c){var f,k,l,n,p,r,u,w;n=[b];
l=[a];if(!(b.position+b.length<=a.position||b.position>=a.position+a.length)){f=c?b:a;k=c?a:b;if(b.position!==a.position||b.length!==a.length)r=e(f),u=e(k);a=s(k.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)l=[],b=[],n=f.position+f.length,p=k.position+k.length,k.position<f.position?a.minorChanged&&(w=e(u),w.length=f.position-k.position,b.push(w),k.position=f.position,k.length=p-k.position):f.position<k.position&&a.majorChanged&&(w=e(r),w.length=
k.position-f.position,l.push(w),f.position=k.position,f.length=n-f.position),p>n?a.minorChanged&&(r=u,r.position=n,r.length=p-n,b.push(r),k.length=n-k.position):n>p&&a.majorChanged&&(r.position=p,r.length=n-p,l.push(r),f.length=p-f.position),f.setProperties&&h(f.setProperties)&&l.push(f),k.setProperties&&h(k.setProperties)&&b.push(k),c?(n=l,l=b):n=b}return{opSpecsA:n,opSpecsB:l}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&&(b.length+=
a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,e=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);e>=a.sourceStartPosition&&(e-=1);b.position=c;b.length=e-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:l,RemoveCursor:l,RemoveStyle:l,RemoveText:function(b,a){var c=b.position+b.length,e=a.position+a.length,f=[b],h=[a];e<=b.position?b.position-=a.length:a.position<c&&(b.position<a.position?b.length=e<c?b.length-a.length:a.position-b.position:(b.position=
a.position,e<c?b.length=c-e:f=[]));return{opSpecsA:f,opSpecsB:h}},SetParagraphStyle:l,SplitParagraph:function(b,a){a.position<b.position?b.position+=1:a.position<b.position+b.length&&(b.length+=1);return{opSpecsA:[b],opSpecsB:[a]}},UpdateMetadata:l,UpdateParagraphStyle:l},InsertText:{InsertText:function(b,a,c){b.position<a.position?a.position+=b.text.length:b.position>a.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length;return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,
a){b.position>=a.sourceStartPosition?b.position-=1:(b.position<a.sourceStartPosition&&(a.sourceStartPosition+=b.text.length),b.position<a.destinationStartPosition&&(a.destinationStartPosition+=b.text.length));return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:function(b,a){var c=k(a);b.position<a.position?a.position+=b.text.length:b.position<a.position+a.length&&(a.length+=b.text.length);c&&f(a);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c;
c=a.position+a.length;var e=[b],f=[a];c<=b.position?b.position-=a.length:b.position<=a.position?a.position+=b.text.length:(a.length=b.position-a.position,c={optype:"RemoveText",memberid:a.memberid,timestamp:a.timestamp,position:b.position+b.text.length,length:c-b.position},f.unshift(c),b.position=a.position);return{opSpecsA:e,opSpecsB:f}},SetParagraphStyle:function(b,a){a.position>b.position&&(a.position+=b.text.length);return{opSpecsA:[b],opSpecsB:[a]}},SplitParagraph:function(b,a){b.position<a.sourceParagraphPosition&&
(a.sourceParagraphPosition+=b.text.length);b.position<=a.position?a.position+=b.text.length:b.position+=1;return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MergeParagraph:{MergeParagraph:function(b,a,c){var e=[b],f=[a],h;b.destinationStartPosition===a.destinationStartPosition?(e=[],f=[],b.moveCursor&&(h={optype:"MoveCursor",memberid:b.memberid,timestamp:b.timestamp,position:b.sourceStartPosition-1},e.push(h)),a.moveCursor&&(h={optype:"MoveCursor",memberid:a.memberid,
timestamp:a.timestamp,position:a.sourceStartPosition-1},f.push(h)),b=c?b:a,b={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,position:b.destinationStartPosition,styleName:b.paragraphStyleName},c?e.push(b):f.push(b)):b.destinationStartPosition<a.destinationStartPosition?(a.destinationStartPosition-=1,a.sourceStartPosition-=1):(b.destinationStartPosition-=1,b.sourceStartPosition-=1);return{opSpecsA:e,opSpecsB:f}},MoveCursor:function(b,a){var c=a.position,e=a.position+a.length,
f=Math.min(c,e),c=Math.max(c,e);f>=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&&(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.position<b.destinationStartPosition&&(b.destinationStartPosition-=a.length),a.position<b.sourceStartPosition&&(b.sourceStartPosition-=a.length));return{opSpecsA:[b],opSpecsB:[a]}},
SetParagraphStyle:function(b,a){var c=[b],e=[a];if(a.position>b.sourceStartPosition)a.position-=1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:e}},SplitParagraph:function(b,a){var c,e=[b],f=[a];a.position<b.destinationStartPosition?(b.destinationStartPosition+=1,b.sourceStartPosition+=1):a.position>=b.destinationStartPosition&&a.position<b.sourceStartPosition?(a.paragraphStyleName=
b.paragraphStyleName,c={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,position:b.destinationStartPosition,styleName:b.paragraphStyleName},e.push(c),a.position===b.sourceStartPosition-1&&b.moveCursor&&(c={optype:"MoveCursor",memberid:b.memberid,timestamp:b.timestamp,position:a.position,length:0},e.push(c)),b.destinationStartPosition=a.position+1,b.sourceStartPosition+=1):a.position>=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:e,opSpecsB:f}},
UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MoveCursor:{MoveCursor:l,RemoveCursor:function(b,a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=k(b),e=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.position<e&&(b.position<a.position?b.length=h<e?b.length-a.length:a.position-b.position:(b.position=a.position,b.length=h<e?e-h:0));c&&f(b);return{opSpecsA:[b],opSpecsB:[a]}},SetParagraphStyle:l,
SplitParagraph:function(b,a){var c=k(b);a.position<b.position?b.position+=1:a.position<b.position+b.length&&(b.length+=1);c&&f(b);return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveCursor:{RemoveCursor:function(b,a){var c=b.memberid===a.memberid;return{opSpecsA:c?[]:[b],opSpecsB:c?[]:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:l,SetParagraphStyle:l,SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveMember:{RemoveStyle:l,RemoveText:l,
SetParagraphStyle:l,SplitParagraph:l,UpdateMetadata:l,UpdateParagraphStyle:l},RemoveStyle:{RemoveStyle:function(b,a){var c=b.styleName===a.styleName&&b.styleFamily===a.styleFamily;return{opSpecsA:c?[]:[b],opSpecsB:c?[]:[a]}},RemoveText:l,SetParagraphStyle:function(b,a){var c,e=[b],f=[a];"paragraph"===b.styleFamily&&b.styleName===a.styleName&&(c={optype:"SetParagraphStyle",memberid:b.memberid,timestamp:b.timestamp,position:a.position,styleName:""},e.unshift(c),a.styleName="");return{opSpecsA:e,opSpecsB:f}},
SplitParagraph:l,UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:function(d,a){var e,f=[d],h=[a];"paragraph"===d.styleFamily&&(e=c(a.setProperties,d.styleName),0<e.length&&(e={optype:"UpdateParagraphStyle",memberid:d.memberid,timestamp:d.timestamp,styleName:a.styleName,removedProperties:{attributes:e.join(",")}},f.unshift(e)),d.styleName===a.styleName?h=[]:b(a.setProperties,d.styleName));return{opSpecsA:f,opSpecsB:h}}},RemoveText:{RemoveText:function(b,a){var c=b.position+b.length,e=a.position+
a.length,f=[b],h=[a];e<=b.position?b.position-=a.length:c<=a.position?a.position-=b.length:a.position<c&&(b.position<a.position?(b.length=e<c?b.length-a.length:a.position-b.position,c<e?(a.position=b.position,a.length=e-c):h=[]):(c<e?a.length-=b.length:a.position<b.position?a.length=b.position-a.position:h=[],e<c?(b.position=a.position,b.length=c-e):f=[]));return{opSpecsA:f,opSpecsB:h}},SetParagraphStyle:function(b,a){b.position<a.position&&(a.position-=b.length);return{opSpecsA:[b],opSpecsB:[a]}},
SplitParagraph:function(b,a){var c=b.position+b.length,e=[b],f=[a];a.position<=b.position?b.position+=1:a.position<c&&(b.length=a.position-b.position,c={optype:"RemoveText",memberid:b.memberid,timestamp:b.timestamp,position:a.position+1,length:c-a.position},e.unshift(c));b.position+b.length<=a.position?a.position-=b.length:b.position<a.position&&(a.position=b.position);b.position+b.length<a.sourceParagraphPosition&&(a.sourceParagraphPosition-=b.length);return{opSpecsA:e,opSpecsB:f}},UpdateMember:l,
UpdateMetadata:l,UpdateParagraphStyle:l},SetParagraphStyle:{SetParagraphStyle:function(b,a,c){b.position===a.position&&(c?a.styleName=b.styleName:b.styleName=a.styleName);return{opSpecsA:[b],opSpecsB:[a]}},SplitParagraph:function(b,a){var c=[b],f=[a],h;b.position>a.position?b.position+=1:b.position===a.sourceParagraphPosition&&(a.paragraphStyleName=b.styleName,h=e(b),h.position=a.position+1,c.push(h));return{opSpecsA:c,opSpecsB:f}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SplitParagraph:{SplitParagraph:function(b,
a,c){var e,f;b.position<a.position?e=!0:a.position<b.position?f=!0:b.position===a.position&&(c?e=!0:f=!0);e?(a.position+=1,a.sourceParagraphPosition=b.position<a.sourceParagraphPosition?a.sourceParagraphPosition+1:b.position+1):f&&(b.position+=1,b.sourceParagraphPosition=a.position<a.sourceParagraphPosition?b.sourceParagraphPosition+1:a.position+1);return{opSpecsA:[b],opSpecsB:[a]}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},UpdateMember:{UpdateMetadata:l,UpdateParagraphStyle:l},UpdateMetadata:{UpdateMetadata:function(b,
a,c){var e,f=[b],k=[a];e=c?b:a;b=c?a:b;p(b.setProperties||null,b.removedProperties||null,e.setProperties||null,e.removedProperties||null);e.setProperties&&h(e.setProperties)||e.removedProperties&&n(e.removedProperties)||(c?f=[]:k=[]);b.setProperties&&h(b.setProperties)||b.removedProperties&&n(b.removedProperties)||(c?k=[]:f=[]);return{opSpecsA:f,opSpecsB:k}},UpdateParagraphStyle:l},UpdateParagraphStyle:{UpdateParagraphStyle:function(b,a,c){var e,f=[b],k=[a];b.styleName===a.styleName&&(e=c?b:a,b=c?
a:b,s(b.setProperties,b.removedProperties,e.setProperties,e.removedProperties,"style:paragraph-properties"),s(b.setProperties,b.removedProperties,e.setProperties,e.removedProperties,"style:text-properties"),p(b.setProperties||null,b.removedProperties||null,e.setProperties||null,e.removedProperties||null),e.setProperties&&h(e.setProperties)||e.removedProperties&&n(e.removedProperties)||(c?f=[]:k=[]),b.setProperties&&h(b.setProperties)||b.removedProperties&&n(b.removedProperties)||(c?k=[]:f=[]));return{opSpecsA:f,
opSpecsB:k}}}};this.passUnchanged=l;this.extendTransformations=function(b){Object.keys(b).forEach(function(a){var c=b[a],e,f=r.hasOwnProperty(a);runtime.log((f?"Extending":"Adding")+" map for optypeA: "+a);f||(r[a]={});e=r[a];Object.keys(c).forEach(function(b){var d=e.hasOwnProperty(b);runtime.assert(a<=b,"Wrong order:"+a+", "+b);runtime.log("  "+(d?"Overwriting":"Adding")+" entry for optypeB: "+b);e[b]=c[b]})})};this.transformOpspecVsOpspec=function(b,a){var c=b.optype<=a.optype,e;runtime.log("Crosstransforming:");
runtime.log(runtime.toJson(b));runtime.log(runtime.toJson(a));c||(e=b,b=a,a=e);(e=(e=r[b.optype])&&e[a.optype])?(e=e(b,a,!c),c||null===e||(e={opSpecsA:e.opSpecsB,opSpecsB:e.opSpecsA})):e=null;runtime.log("result:");e?(runtime.log(runtime.toJson(e.opSpecsA)),runtime.log(runtime.toJson(e.opSpecsB))):runtime.log("null");return e}};ops.OperationTransformer=function(){function f(c,b){for(var e,p,h=[],n=[];0<c.length&&b;){e=c.shift();e=k.transformOpspecVsOpspec(e,b);if(!e)return null;h=h.concat(e.opSpecsA);if(0===e.opSpecsB.length){h=h.concat(c);b=null;break}for(;1<e.opSpecsB.length;){p=f(c,e.opSpecsB.shift());if(!p)return null;n=n.concat(p.opSpecsB);c=p.opSpecsA}b=e.opSpecsB.pop()}b&&n.push(b);return{opSpecsA:h,opSpecsB:n}}var k=new ops.OperationTransformMatrix;this.getOperationTransformMatrix=function(){return k};this.transform=
function(c,b){for(var e,k=[];0<b.length;){e=f(c,b.shift());if(!e)return null;c=e.opSpecsA;k=k.concat(e.opSpecsB)}return{opSpecsA:c,opSpecsB:k}}};var webodf_css="/**\n * Copyright (C) 2010-2014 KO GmbH <copyright@kogmbh.com>\n *\n * @licstart\n * This file is part of WebODF.\n *\n * WebODF is free software: you can redistribute it and/or modify it\n * under the terms of the GNU Affero General Public License (GNU AGPL)\n * as published by the Free Software Foundation, either version 3 of\n * the License, or (at your option) any later version.\n *\n * WebODF is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with WebODF.  If not, see <http://www.gnu.org/licenses/>.\n * @licend\n *\n * @source: http://www.webodf.org/\n * @source: https://github.com/kogmbh/WebODF/\n */\n\n@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);\n@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);\n@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);\n@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);\n@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);\n@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);\n@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);\n@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);\n@namespace webodfhelper url(urn:webodf:names:helper);\n@namespace cursor url(urn:webodf:names:cursor);\n@namespace editinfo url(urn:webodf:names:editinfo);\n@namespace annotation url(urn:webodf:names:annotation);\n@namespace dc url(http://purl.org/dc/elements/1.1/);\n@namespace svgns url(http://www.w3.org/2000/svg);\n\noffice|document > *, office|document-content > * {\n  display: none;\n}\noffice|body, office|document {\n  display: inline-block;\n  position: relative;\n}\n\ntext|p, text|h {\n  display: block;\n  padding: 0;\n  margin: 0;\n  line-height: normal;\n  position: relative;\n  min-height: 1.3em; /* prevent empty paragraphs and headings from collapsing if they are empty */\n}\n*[webodfhelper|containsparagraphanchor] {\n  position: relative;\n}\ntext|s {\n    white-space: pre;\n}\ntext|tab {\n  display: inline;\n  white-space: pre;\n}\ntext|tracked-changes {\n  /*Consumers that do not support change tracking, should ignore changes.*/\n  display: none;\n}\noffice|binary-data {\n  display: none;\n}\noffice|text {\n  display: block;\n  text-align: left;\n  overflow: visible;\n  word-wrap: break-word;\n}\n\noffice|text::selection {\n  /** Let's not draw selection highlight that overflows into the office|text\n   * node when selecting content across several paragraphs\n   */\n  background: transparent;\n}\n\n.webodf-virtualSelections *::selection {\n  background: transparent;\n}\n.webodf-virtualSelections *::-moz-selection {\n  background: transparent;\n}\n\noffice|text * draw|text-box {\n/** only for text documents */\n    display: block;\n    border: 1px solid #d3d3d3;\n}\noffice|text draw|frame {\n  /** make sure frames are above the main text. */\n  z-index: 1;\n}\noffice|spreadsheet {\n  display: block;\n  border-collapse: collapse;\n  empty-cells: show;\n  font-family: sans-serif;\n  font-size: 10pt;\n  text-align: left;\n  page-break-inside: avoid;\n  overflow: hidden;\n}\noffice|presentation {\n  display: inline-block;\n  text-align: left;\n}\n#shadowContent {\n  display: inline-block;\n  text-align: left;\n}\ndraw|page {\n  display: block;\n  position: relative;\n  overflow: hidden;\n}\npresentation|notes, presentation|footer-decl, presentation|date-time-decl {\n    display: none;\n}\n@media print {\n  draw|page {\n    border: 1pt solid black;\n    page-break-inside: avoid;\n  }\n  presentation|notes {\n    /*TODO*/\n  }\n}\noffice|spreadsheet text|p {\n  border: 0px;\n  padding: 1px;\n  margin: 0px;\n}\noffice|spreadsheet table|table {\n  margin: 3px;\n}\noffice|spreadsheet table|table:after {\n  /* show sheet name the end of the sheet */\n  /*content: attr(table|name);*/ /* gives parsing error in opera */\n}\noffice|spreadsheet table|table-row {\n  counter-increment: row;\n}\noffice|spreadsheet table|table-row:before {\n  width: 3em;\n  background: #cccccc;\n  border: 1px solid black;\n  text-align: center;\n  content: counter(row);\n  display: table-cell;\n}\noffice|spreadsheet table|table-cell {\n  border: 1px solid #cccccc;\n}\ntable|table {\n  display: table;\n}\ndraw|frame table|table {\n  width: 100%;\n  height: 100%;\n  background: white;\n}\ntable|table-header-rows {\n  display: table-header-group;\n}\ntable|table-row {\n  display: table-row;\n}\ntable|table-column {\n  display: table-column;\n}\ntable|table-cell {\n  width: 0.889in;\n  display: table-cell;\n  word-break: break-all; /* prevent long words from extending out the table cell */\n}\ndraw|frame {\n  display: block;\n}\ndraw|image {\n  display: block;\n  width: 100%;\n  height: 100%;\n  top: 0px;\n  left: 0px;\n  background-repeat: no-repeat;\n  background-size: 100% 100%;\n  -moz-background-size: 100% 100%;\n}\n/* only show the first image in frame */\ndraw|frame > draw|image:nth-of-type(n+2) {\n  display: none;\n}\ntext|list:before {\n    display: none;\n    content:\"\";\n}\ntext|list {\n    display: block;\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}\n.webodf-inactiveLinks text|a {\n    cursor: text;\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}\ntext|bibliography-source {\n  display: none;\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|anchor {\n    display: none;\n}\n\ncursor|cursor {\n    display: none;\n}\n\n.webodf-caretOverlay {\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    margin-left: -1px;\n    z-index: 10;\n    pointer-events: none;\n}\n\n.webodf-caretOverlay .caret {\n    position: absolute;\n    border-left: 2px solid black;\n    top: 0;\n    bottom: 0;\n}\n\n.webodf-caretOverlay .handle {\n    margin-top: 5px;\n    padding-top: 3px;\n    margin-left: auto;\n    margin-right: auto;\n    width: 64px !important;\n    height: 68px !important;\n    border-radius: 5px;\n    opacity: 0.3;\n    text-align: center;\n    background-color: black !important;\n    box-shadow: 0px 0px 5px rgb(90, 90, 90);\n    border: 1px solid black;\n\n    top: -85px !important;\n    left: -32px !important;\n}\n\n.webodf-caretOverlay .handle > img {\n    box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;\n    background-color: rgb(200, 200, 200);\n    border-radius: 5px;\n    border: 2px solid;\n    height: 60px !important;\n    width: 60px !important;\n    display: block;\n    margin: auto;\n}\n\n.webodf-caretOverlay .handle.active {\n    opacity: 0.8;\n}\n\n.webodf-caretOverlay .handle: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.webodf-caretSizer {\n    display: inline-block; /* inline-block is necessary so the width can be set to 0 */\n    width: 0; /* the caret sizer shouldn't take up any horizontal space */\n    visibility: hidden; /* \"hidden\" means the client rects are still calculated, but the node content is not shown */\n}\n\n/** Input Method Editor input pane & behaviours */\n/* not within a cursor */\n#eventTrap {\n    height: auto;\n    display: block;\n    position: absolute;\n    bottom: 0;\n    right: 0;\n    width: 1px;\n    outline: none;\n    opacity: 0;\n    color: rgba(255, 255, 255, 0); /* hide the blinking caret by setting the colour to fully transparent */\n    overflow: hidden; /* The overflow visibility is used to hide and show characters being entered */\n    pointer-events: none;\n}\n\n/* within a cursor */\ncursor|cursor > #composer {\n    text-decoration: underline;\n}\n\ncursor|cursor[cursor|caret-sizer-active=\"true\"],\ncursor|cursor[cursor|composing=\"true\"] {\n    display: inline;\n}\n\neditinfo|editinfo {\n    /* Empty or invisible display:inline elements respond very badly to mouse selection.\n       Inline blocks are much more reliably selectable in Chrome & friends */\n    display: inline-block;\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    top: 0;\n}\n.annotationNote > office|annotation {\n    display: block;\n    text-align: left;\n}\n\n.annotationConnector {\n    position: absolute;\n    display: inline;\n    top: 0;\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    color: black;\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\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.webodf-annotationHighlight {\n    background-color: yellow;\n    position: relative;\n}\n\n.webodf-selectionOverlay {\n    position: absolute;\n    pointer-events: none;\n    top: 0;\n    left: 0;\n    top: 0;\n    left: 0;\n    width: 100%;\n    height: 100%;\n    z-index: 15;\n}\n.webodf-selectionOverlay > polygon {\n    fill-opacity: 0.3;\n    stroke-opacity: 0.8;\n    stroke-width: 1;\n    fill-rule: evenodd;\n}\n\n.webodf-selectionOverlay > .webodf-draggable {\n    fill-opacity: 0.8;\n    stroke-opacity: 0;\n    stroke-width: 8;\n    pointer-events: all;\n    display: none;\n\n    -moz-transform-origin: center center;\n    -webkit-transform-origin: center center;\n    -ms-transform-origin: center center;\n    transform-origin: center center;\n}\n\n#imageSelector {\n    display: none;\n    position: absolute;\n    border-style: solid;\n    border-color: black;\n}\n\n#imageSelector > div {\n    width: 5px;\n    height: 5px;\n    display: block;\n    position: absolute;\n    border: 1px solid black;\n    background-color: #ffffff;\n}\n\n#imageSelector > .topLeft {\n    top: -4px;\n    left: -4px;\n}\n\n#imageSelector > .topRight {\n    top: -4px;\n    right: -4px;\n}\n\n#imageSelector > .bottomRight {\n    right: -4px;\n    bottom: -4px;\n}\n\n#imageSelector > .bottomLeft {\n    bottom: -4px;\n    left: -4px;\n}\n\n#imageSelector > .topMiddle {\n    top: -4px;\n    left: 50%;\n    margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .rightMiddle {\n    top: 50%;\n    right: -4px;\n    margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\n#imageSelector > .bottomMiddle {\n    bottom: -4px;\n    left: 50%;\n    margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .leftMiddle {\n    top: 50%;\n    left: -4px;\n    margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar\n{\n    width: 8px;\n    height: 8px;\n    background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-track\n{\n    background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-thumb\n{\n    background-color: #444;\n    border-radius: 4px;\n}\n\n.webodf-hyperlinkTooltip {\n    display: none;\n    color: white;\n    background-color: black;\n    border-radius: 5px;\n    box-shadow: 2px 2px 5px gray;\n    padding: 3px;\n    position: absolute;\n    max-width: 210px;\n    text-align: left;\n    word-break: break-all;\n    z-index: 16;\n}\n\n.webodf-hyperlinkTooltipText {\n    display: block;\n    font-weight: bold;\n}\n";
