2015-06-11 01:33:26 +03:00

637 lines
346 KiB
JavaScript

/*
This is a generated file. DO NOT EDIT.
Copyright (C) 2010-2015 KO GmbH <copyright@kogmbh.com>
@licstart
This file is the compiled version of the WebODF library.
WebODF is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License (GNU AGPL)
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
WebODF is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with WebODF. If not, see <http://www.gnu.org/licenses/>.
@licend
@source: http://www.webodf.org/
@source: https://github.com/kogmbh/WebODF/
*/
var webodf_version="0.5.7-66-g25bf592";function Runtime(){}Runtime.prototype.getVariable=function(h){};Runtime.prototype.toJson=function(h){};Runtime.prototype.fromJson=function(h){};Runtime.prototype.byteArrayFromString=function(h,k){};Runtime.prototype.byteArrayToString=function(h,k){};Runtime.prototype.read=function(h,k,c,b){};Runtime.prototype.readFile=function(h,k,c){};Runtime.prototype.readFileSync=function(h,k){};Runtime.prototype.loadXML=function(h,k){};Runtime.prototype.writeFile=function(h,k,c){};
Runtime.prototype.deleteFile=function(h,k){};Runtime.prototype.log=function(h,k){};Runtime.prototype.setTimeout=function(h,k){};Runtime.prototype.clearTimeout=function(h){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(h){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(h){};Runtime.prototype.exit=function(h){};
Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(h){};Runtime.prototype.cancelAnimationFrame=function(h){};Runtime.prototype.assert=function(h,k){};var IS_COMPILED_CODE=!0;
Runtime.byteArrayToString=function(h,k){function c(b){var c="",m,q=b.length;for(m=0;m<q;m+=1)c+=String.fromCharCode(b[m]&255);return c}function b(b){var c="",m,q=b.length,f=[],e,a,d,r;for(m=3<=q&&239===b[0]&&187===b[1]&&191===b[2]?3:0;m<q;m+=1)e=b[m],128>e?f.push(e):(m+=1,a=b[m],194<=e&&224>e?f.push((e&31)<<6|a&63):(m+=1,d=b[m],224<=e&&240>e?f.push((e&15)<<12|(a&63)<<6|d&63):(m+=1,r=b[m],240<=e&&245>e&&(e=(e&7)<<18|(a&63)<<12|(d&63)<<6|r&63,e-=65536,f.push((e>>10)+55296,(e&1023)+56320))))),1E3<=f.length&&
(c+=String.fromCharCode.apply(null,f),f.length=0);return c+String.fromCharCode.apply(null,f)}var g;"utf8"===k?g=b(h):("binary"!==k&&this.log("Unsupported encoding: "+k),g=c(h));return g};Runtime.getVariable=function(h){try{return eval(h)}catch(k){}};Runtime.toJson=function(h){return JSON.stringify(h)};Runtime.fromJson=function(h){return JSON.parse(h)};Runtime.getFunctionName=function(h){return void 0===h.name?(h=/function\s+(\w+)/.exec(h))&&h[1]:h.name};
Runtime.assert=function(h,k){if(!h)throw this.log("alert","ASSERTION FAILED:\n"+k),Error(k);};
function BrowserRuntime(){function h(b){var f=b.length,e,a,d=0;for(e=0;e<f;e+=1)a=b.charCodeAt(e),d+=1+(128<a)+(2048<a),55040<a&&57344>a&&(d+=1,e+=1);return d}function k(b,f,e){var a=b.length,d,r;f=new Uint8Array(new ArrayBuffer(f));e?(f[0]=239,f[1]=187,f[2]=191,r=3):r=0;for(e=0;e<a;e+=1)d=b.charCodeAt(e),128>d?(f[r]=d,r+=1):2048>d?(f[r]=192|d>>>6,f[r+1]=128|d&63,r+=2):55040>=d||57344<=d?(f[r]=224|d>>>12&15,f[r+1]=128|d>>>6&63,f[r+2]=128|d&63,r+=3):(e+=1,d=(d-55296<<10|b.charCodeAt(e)-56320)+65536,
f[r]=240|d>>>18&7,f[r+1]=128|d>>>12&63,f[r+2]=128|d>>>6&63,f[r+3]=128|d&63,r+=4);return f}function c(b){var f=b.length,e=new Uint8Array(new ArrayBuffer(f)),a;for(a=0;a<f;a+=1)e[a]=b.charCodeAt(a)&255;return e}function b(b,f){var e;void 0!==f?e=b:f=b;console.log(f);m.enableAlerts&&"alert"===e&&alert(f)}function g(b,f,e){if(0!==e.status||e.responseText)if(200===e.status||0===e.status){if(e.response&&"string"!==typeof e.response)"binary"===f?(e=e.response,e=new Uint8Array(e)):e=String(e.response);else if("binary"===
f)if(null!==e.responseBody&&"undefined"!==String(typeof VBArray)){e=(new VBArray(e.responseBody)).toArray();var a=e.length;f=new Uint8Array(new ArrayBuffer(a));for(b=0;b<a;b+=1)f[b]=e[b];e=f}else{(b=e.getResponseHeader("Content-Length"))&&(b=parseInt(b,10));if(b&&b!==e.responseText.length)a:{a=e.responseText;f=!1;var d=h(a);if("number"===typeof b){if(b!==d&&b!==d+3){a=void 0;break a}f=d+3===b;d=b}a=k(a,d,f)}void 0===a&&(a=c(e.responseText));e=a}else e=e.responseText;e={err:null,data:e}}else e={err:e.responseText||
e.statusText,data:null};else e={err:"File "+b+" is empty.",data:null};return e}function n(b,f,e){var a=new XMLHttpRequest;a.open("GET",b,e);a.overrideMimeType&&("binary"!==f?a.overrideMimeType("text/plain; charset="+f):a.overrideMimeType("text/plain; charset=x-user-defined"));return a}function p(b,f,e){var a=n(b,f,!0);a.onreadystatechange=function(){var d;4===a.readyState&&(d=g(b,f,a),e(d.err,d.data))};try{a.send(null)}catch(d){e(d.message,null)}}var m=this;this.byteArrayFromString=function(b,f){var e;
"utf8"===f?e=k(b,h(b),!1):("binary"!==f&&m.log("unknown encoding: "+f),e=c(b));return e};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=p;this.read=function(b,f,e,a){p(b,"binary",function(d,r){var l=null;if(r){if("string"===typeof r)throw"This should not happen.";l=r.subarray(f,f+e)}a(d,l)})};this.readFileSync=function(b,f){var e=n(b,f,!1),a;try{e.send(null);a=g(b,f,e);if(a.err)throw a.err;
if(null===a.data)throw"No data read from "+b+".";}catch(d){throw d;}return a.data};this.writeFile=function(b,f,e){var a=new XMLHttpRequest,d;a.open("PUT",b,!0);a.onreadystatechange=function(){4===a.readyState&&(0!==a.status||a.responseText?200<=a.status&&300>a.status||0===a.status?e(null):e("Status "+String(a.status)+": "+a.responseText||a.statusText):e("File "+b+" is empty."))};d=f.buffer&&!a.sendAsBinary?f.buffer:m.byteArrayToString(f,"binary");try{a.sendAsBinary?a.sendAsBinary(d):a.send(d)}catch(r){m.log("HUH? "+
r+" "+f),e(r.message)}};this.deleteFile=function(b,f){var e=new XMLHttpRequest;e.open("DELETE",b,!0);e.onreadystatechange=function(){4===e.readyState&&(200>e.status&&300<=e.status?f(e.responseText):f(null))};e.send(null)};this.loadXML=function(b,f){var e=new XMLHttpRequest;e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){4===e.readyState&&(0!==e.status||e.responseText?200===e.status||0===e.status?f(null,e.responseXML):f(e.responseText,null):f("File "+
b+" is empty.",null))};try{e.send(null)}catch(a){f(a.message,null)}};this.log=b;this.enableAlerts=!0;this.assert=Runtime.assert;this.setTimeout=function(b,f){return setTimeout(function(){b()},f)};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(c){b("Calling exit with code "+String(c)+", but exit() is not implemented.")};this.getWindow=function(){return window};this.requestAnimationFrame=function(b){var f=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,e=0;if(f)f.bind(window),e=f(b);else return setTimeout(b,15);return e};this.cancelAnimationFrame=function(b){var f=window.cancelAnimationFrame||
window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;f?(f.bind(window),f(b)):clearTimeout(b)}}
function NodeJSRuntime(){function h(b){var f=b.length,e,a=new Uint8Array(new ArrayBuffer(f));for(e=0;e<f;e+=1)a[e]=b[e];return a}function k(c,f,e){function a(a,r){if(a)return e(a,null);if(!r)return e("No data for "+c+".",null);if("string"===typeof r)return e(a,r);e(a,h(r))}c=g.resolve(n,c);"binary"!==f?b.readFile(c,f,a):b.readFile(c,null,a)}var c=this,b=require("fs"),g=require("path"),n="",p,m;this.byteArrayFromString=function(b,f){var e=new Buffer(b,f),a,d=e.length,r=new Uint8Array(new ArrayBuffer(d));
for(a=0;a<d;a+=1)r[a]=e[a];return r};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=k;this.loadXML=function(b,f){k(b,"utf-8",function(e,a){if(e)return f(e,null);if(!a)return f("No data for "+b+".",null);f(null,c.parseXML(a))})};this.writeFile=function(c,f,e){f=new Buffer(f);c=g.resolve(n,c);b.writeFile(c,f,"binary",function(a){e(a||null)})};this.deleteFile=function(c,f){c=g.resolve(n,c);
b.unlink(c,f)};this.read=function(c,f,e,a){c=g.resolve(n,c);b.open(c,"r+",666,function(d,r){if(d)a(d,null);else{var l=new Buffer(e);b.read(r,l,0,e,f,function(d){b.close(r);a(d,h(l))})}})};this.readFileSync=function(c,f){var e;e=b.readFileSync(c,"binary"===f?null:f);if(null===e)throw"File "+c+" could not be read.";"binary"===f&&(e=h(e));return e};this.log=function(b,c){var e;void 0!==c?e=b:c=b;"alert"===e&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(c+"\n");"alert"===e&&process.stderr.write("!!!!! ALERT !!!!!\n")};
this.assert=Runtime.assert;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){n=b};this.currentDirectory=function(){return n};this.type=function(){return"NodeJSRuntime"};this.getDOMImplementation=function(){return m};this.parseXML=function(b){return p.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)};p=new (require("xmldom").DOMParser);m=c.parseXML("<a/>").implementation}
function RhinoRuntime(){var h=this,k={},c=k.javax.xml.parsers.DocumentBuilderFactory.newInstance(),b,g,n="";c.setValidating(!1);c.setNamespaceAware(!0);c.setExpandEntityReferences(!1);c.setSchema(null);g=k.org.xml.sax.EntityResolver({resolveEntity:function(b,c){var g=new k.java.io.FileReader(c);return new k.org.xml.sax.InputSource(g)}});b=c.newDocumentBuilder();b.setEntityResolver(g);this.byteArrayFromString=function(b,c){var g,f=b.length,e=new Uint8Array(new ArrayBuffer(f));for(g=0;g<f;g+=1)e[g]=
b.charCodeAt(g)&255;return e};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.loadXML=function(c,m){var g=new k.java.io.File(c),f=null;try{f=b.parse(g)}catch(e){return print(e),m(e,null)}m(null,f)};this.readFile=function(b,c,g){n&&(b=n+"/"+b);var f=new k.java.io.File(b),e="binary"===c?"latin1":c;f.isFile()?((b=readFile(b,e))&&"binary"===c&&(b=h.byteArrayFromString(b,"binary")),g(null,b)):g(b+" is not a file.",
null)};this.writeFile=function(b,c,g){n&&(b=n+"/"+b);b=new k.java.io.FileOutputStream(b);var f,e=c.length;for(f=0;f<e;f+=1)b.write(c[f]);b.close();g(null)};this.deleteFile=function(b,c){n&&(b=n+"/"+b);var g=new k.java.io.File(b),f=b+Math.random(),f=new k.java.io.File(f);g.rename(f)?(f.deleteOnExit(),c(null)):c("Could not delete "+b)};this.read=function(b,c,g,f){n&&(b=n+"/"+b);var e;e=b;var a="binary";(new k.java.io.File(e)).isFile()?("binary"===a&&(a="latin1"),e=readFile(e,a)):e=null;e?f(null,this.byteArrayFromString(e.substring(c,
c+g),"binary")):f("Cannot read "+b,null)};this.readFileSync=function(b,c){if(!c)return"";var g=readFile(b,c);if(null===g)throw"File could not be read.";return g};this.log=function(b,c){var g;void 0!==c?g=b:c=b;"alert"===g&&print("\n!!!!! ALERT !!!!!");print(c);"alert"===g&&print("!!!!! ALERT !!!!!")};this.assert=Runtime.assert;this.setTimeout=function(b){b();return 0};this.clearTimeout=function(){};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(b){n=b};this.currentDirectory=
function(){return n};this.type=function(){return"RhinoRuntime"};this.getDOMImplementation=function(){return b.getDOMImplementation()};this.parseXML=function(c){c=new k.java.io.StringReader(c);c=new k.org.xml.sax.InputSource(c);return b.parse(c)};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:"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 h(b,c,f){var e=b+"/manifest.json",a,d;runtime.log("Loading manifest: "+e);try{a=runtime.readFileSync(e,"utf-8")}catch(r){if(f)runtime.log("No loadable manifest found.");else throw console.log(String(r)),r;return}f=JSON.parse(a);for(d in f)f.hasOwnProperty(d)&&(c[d]={dir:b,deps:f[d]})}function k(b,c,f){function e(l){if(!r[l]&&!f(l)){if(d[l])throw"Circular dependency detected for "+l+".";d[l]=!0;if(!c[l])throw"Missing dependency information for class "+l+".";var b=c[l],g=b.deps,
m,n=g.length;for(m=0;m<n;m+=1)e(g[m]);d[l]=!1;r[l]=!0;a.push(b.dir+"/"+l.replace(".","/")+".js")}}var a=[],d={},r={};b.forEach(e);return a}function c(b,c){return c+("\n//# sourceURL="+b)}function b(b){var g,f;for(g=0;g<b.length;g+=1)f=runtime.readFileSync(b[g],"utf-8"),f=c(b[g],f),eval(f)}function g(b){b=b.split(".");var c,f=p,e=b.length;for(c=0;c<e;c+=1){if(!f.hasOwnProperty(b[c]))return!1;f=f[b[c]]}return!0}var n,p={core:core,gui:gui,xmldom:xmldom,odf:odf,ops:ops};runtime.loadClasses=function(c,
p){if(IS_COMPILED_CODE||0===c.length)return p&&p();var f;if(!(f=n)){f=[];var e=runtime.libraryPaths(),a;runtime.currentDirectory()&&-1===e.indexOf(runtime.currentDirectory())&&h(runtime.currentDirectory(),f,!0);for(a=0;a<e.length;a+=1)h(e[a],f)}n=f;c=k(c,n,g);if(0===c.length)return p&&p();if("BrowserRuntime"===runtime.type()&&p){f=c;e=document.currentScript||document.documentElement.lastChild;a=document.createDocumentFragment();var d,r;for(r=0;r<f.length;r+=1)d=document.createElement("script"),d.type=
"text/javascript",d.charset="utf-8",d.async=!1,d.setAttribute("src",f[r]),a.appendChild(d);p&&(d.onload=p);e.parentNode.insertBefore(a,e)}else b(c),p&&p()};runtime.loadClass=function(b,c){runtime.loadClasses([b],c)}})();(function(){var h=function(h){return h};runtime.getTranslator=function(){return h};runtime.setTranslator=function(k){h=k};runtime.tr=function(k){var c=h(k);return c&&"string"===String(typeof c)?c:k}})();
(function(h){function k(c){if(c.length){var b=c[0];runtime.readFile(b,"utf8",function(g,n){function p(){var b;(b=eval(h))&&runtime.exit(b)}var m="",m=b.lastIndexOf("/"),h=n,m=-1!==m?b.substring(0,m):".";runtime.setCurrentDirectory(m);g?(runtime.log(g),runtime.exit(1)):null===h?(runtime.log("No code found for "+b),runtime.exit(1)):p.apply(null,c)})}}h=h?Array.prototype.slice.call(h):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(h):k(h.slice(1))})("undefined"!==
String(typeof arguments)&&arguments);(function(){core.Async=function(){return{forEach:function(h,k,c){function b(b){p!==n&&(b?(p=n,c(b)):(p+=1,p===n&&c(null)))}var g,n=h.length,p=0;for(g=0;g<n;g+=1)k(h[g],b)},destroyAll:function(h,k){function c(b,g){if(g)k(g);else if(b<h.length)h[b](function(g){c(b+1,g)});else k()}c(0,void 0)}}}()})();function makeBase64(){function h(a){var d,l=a.length,r=new Uint8Array(new ArrayBuffer(l));for(d=0;d<l;d+=1)r[d]=a.charCodeAt(d)&255;return r}function k(a){var d,l="",r,b=a.length-2;for(r=0;r<b;r+=3)d=a[r]<<16|a[r+1]<<8|a[r+2],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>18],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>12&63],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6&63],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d&
63];r===b+1?(d=a[r]<<4,l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d&63],l+="=="):r===b&&(d=a[r]<<10|a[r+1]<<2,l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>12],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6&63],l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d&63],l+="=");return l}function c(a){a=a.replace(/[^A-Za-z0-9+\/]+/g,
"");var d=a.length,r=new Uint8Array(new ArrayBuffer(3*d)),b=a.length%4,c=0,e,f;for(e=0;e<d;e+=4)f=(l[a.charAt(e)]||0)<<18|(l[a.charAt(e+1)]||0)<<12|(l[a.charAt(e+2)]||0)<<6|(l[a.charAt(e+3)]||0),r[c]=f>>16,r[c+1]=f>>8&255,r[c+2]=f&255,c+=3;d=3*d-[0,0,2,1][b];return r.subarray(0,d)}function b(a){var d,l,r=a.length,b=0,c=new Uint8Array(new ArrayBuffer(3*r));for(d=0;d<r;d+=1)l=a[d],128>l?c[b++]=l:(2048>l?c[b++]=192|l>>>6:(c[b++]=224|l>>>12&15,c[b++]=128|l>>>6&63),c[b++]=128|l&63);return c.subarray(0,
b)}function g(a){var d,l,r,b,c=a.length,e=new Uint8Array(new ArrayBuffer(c)),f=0;for(d=0;d<c;d+=1)l=a[d],128>l?e[f++]=l:(d+=1,r=a[d],224>l?e[f++]=(l&31)<<6|r&63:(d+=1,b=a[d],e[f++]=(l&15)<<12|(r&63)<<6|b&63));return e.subarray(0,f)}function n(a){return k(h(a))}function p(a){return String.fromCharCode.apply(String,c(a))}function m(a){return g(h(a))}function q(a){a=g(a);for(var d="",l=0;l<a.length;)d+=String.fromCharCode.apply(String,a.subarray(l,l+45E3)),l+=45E3;return d}function f(a,d,l){var r,b,
c,e="";for(c=d;c<l;c+=1)d=a.charCodeAt(c)&255,128>d?e+=String.fromCharCode(d):(c+=1,r=a.charCodeAt(c)&255,224>d?e+=String.fromCharCode((d&31)<<6|r&63):(c+=1,b=a.charCodeAt(c)&255,e+=String.fromCharCode((d&15)<<12|(r&63)<<6|b&63)));return e}function e(a,d){function l(){var c=b+1E5;c>a.length&&(c=a.length);r+=f(a,b,c);b=c;c=b===a.length;d(r,c)&&!c&&runtime.setTimeout(l,0)}var r="",b=0;1E5>a.length?d(f(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),l())}function a(a){return b(h(a))}function d(a){return String.fromCharCode.apply(String,
b(a))}function r(a){return String.fromCharCode.apply(String,b(h(a)))}var l=function(a){var d={},l,r;l=0;for(r=a.length;l<r;l+=1)d[a.charAt(l)]=l;return d}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),B,y,D=runtime.getWindow(),z,t;D&&D.btoa?(z=D.btoa,B=function(a){return z(r(a))}):(z=n,B=function(d){return k(a(d))});D&&D.atob?(t=D.atob,y=function(a){a=t(a);return f(a,0,a.length)}):(t=p,y=function(a){return q(c(a))});core.Base64=function(){this.convertByteArrayToBase64=this.convertUTF8ArrayToBase64=
k;this.convertBase64ToByteArray=this.convertBase64ToUTF8Array=c;this.convertUTF16ArrayToByteArray=this.convertUTF16ArrayToUTF8Array=b;this.convertByteArrayToUTF16Array=this.convertUTF8ArrayToUTF16Array=g;this.convertUTF8StringToBase64=n;this.convertBase64ToUTF8String=p;this.convertUTF8StringToUTF16Array=m;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=q;this.convertUTF8StringToUTF16String=e;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=a;this.convertUTF16ArrayToUTF8String=
d;this.convertUTF16StringToUTF8String=r;this.convertUTF16StringToBase64=B;this.convertBase64ToUTF16String=y;this.fromBase64=p;this.toBase64=n;this.atob=t;this.btoa=z;this.utob=r;this.btou=e;this.encode=B;this.encodeURI=function(a){return B(a).replace(/[+\/]/g,function(a){return"+"===a?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return y(a.replace(/[\-_]/g,function(a){return"-"===a?"+":"/"}))};return this};return core.Base64}core.Base64=makeBase64();core.ByteArray=function(h){this.pos=0;this.data=h;this.readUInt32LE=function(){this.pos+=4;var h=this.data,c=this.pos;return h[--c]<<24|h[--c]<<16|h[--c]<<8|h[--c]};this.readUInt16LE=function(){this.pos+=2;var h=this.data,c=this.pos;return h[--c]<<8|h[--c]}};core.ByteArrayWriter=function(h){function k(c){c>g-b&&(g=Math.max(2*g,b+c),c=new Uint8Array(new ArrayBuffer(g)),c.set(n),n=c)}var c=this,b=0,g=1024,n=new Uint8Array(new ArrayBuffer(g));this.appendByteArrayWriter=function(b){c.appendByteArray(b.getByteArray())};this.appendByteArray=function(c){var g=c.length;k(g);n.set(c,b);b+=g};this.appendArray=function(c){var g=c.length;k(g);n.set(c,b);b+=g};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,h))};this.getLength=function(){return b};this.getByteArray=function(){var c=new Uint8Array(new ArrayBuffer(b));c.set(n.subarray(0,b));return c}};core.CSSUnits=function(){var h=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(c,b,g){return c*k[g]/k[b]};this.convertMeasure=function(c,b){var g,n;c&&b&&(g=parseFloat(c),n=c.replace(g.toString(),""),g=h.convert(g,n,b));return g};this.getUnits=function(c){return c.substr(c.length-2,c.length)}};(function(){function h(){var b,g,n,h,m,k,f,e,a;void 0===c&&(g=(b=runtime.getWindow())&&b.document,k=g.documentElement,f=g.body,c={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},g&&(h=g.createElement("div"),h.style.position="absolute",h.style.left="-99999px",h.style.transform="scale(2)",h.style["-webkit-transform"]="scale(2)",m=g.createElement("div"),h.appendChild(m),f.appendChild(h),b=g.createRange(),b.selectNode(m),c.rangeBCRIgnoresElementBCR=0===b.getClientRects().length,
m.appendChild(g.createTextNode("Rect transform test")),g=m.getBoundingClientRect(),n=b.getBoundingClientRect(),c.unscaledRangeClientRects=2<Math.abs(g.height-n.height),h.style.transform="",h.style["-webkit-transform"]="",g=k.style.overflow,n=f.style.overflow,e=f.style.height,a=f.scrollTop,k.style.overflow="visible",f.style.overflow="visible",f.style.height="200%",f.scrollTop=f.scrollHeight,c.elementBCRIgnoresBodyScroll=b.getBoundingClientRect().top!==m.getBoundingClientRect().top,f.scrollTop=a,f.style.height=
e,f.style.overflow=n,k.style.overflow=g,b.detach(),f.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,n){for(b=b?b.firstElementChild:null;b;){if(b.localName===n&&b.namespaceURI===c)return b;b=b.nextElementSibling}return null}var c;core.DomUtilsImpl=function(){function b(a,d){for(var b=0,c;a.parentNode!==d;)runtime.assert(null!==a.parentNode,"parent is null"),a=a.parentNode;for(c=d.firstChild;c!==
a;)b+=1,c=c.nextSibling;return b}function c(a,d){return 0>=a.compareBoundaryPoints(Range.START_TO_START,d)&&0<=a.compareBoundaryPoints(Range.END_TO_END,d)}function n(a,d){return 0>=a.compareBoundaryPoints(Range.END_TO_START,d)&&0<=a.compareBoundaryPoints(Range.START_TO_END,d)}function p(a,d){var b=null;a.nodeType===Node.TEXT_NODE&&(0===a.length?(a.parentNode.removeChild(a),d.nodeType===Node.TEXT_NODE&&(b=d)):(d.nodeType===Node.TEXT_NODE&&(a.appendData(d.data),d.parentNode.removeChild(d)),b=a));return b}
function m(a){for(var d=a.parentNode;a.firstChild;)d.insertBefore(a.firstChild,a);d.removeChild(a);return d}function q(a,d){var b=a.parentNode,c=a.firstChild,e=d(a),f;if(e===NodeFilter.FILTER_SKIP)return b;for(;c;)f=c.nextSibling,q(c,d),c=f;b&&e===NodeFilter.FILTER_REJECT&&m(a);return b}function f(a,d){return a===d||Boolean(a.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function e(a,d){return h().unscaledRangeClientRects?a:a/d}function a(d,l,b){Object.keys(l).forEach(function(c){var e=
c.split(":"),f=e[1],g=b(e[0]),e=l[c],n=typeof e;"object"===n?Object.keys(e).length&&(c=g?d.getElementsByTagNameNS(g,f)[0]||d.ownerDocument.createElementNS(g,c):d.getElementsByTagName(f)[0]||d.ownerDocument.createElement(c),d.appendChild(c),a(c,e,b)):g&&(runtime.assert("number"===n||"string"===n,"attempting to map unsupported type '"+n+"' (key: "+c+")"),d.setAttributeNS(g,c,String(e)))})}var d=null;this.splitBoundaries=function(a){var d,c=[],e,f,g;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType===
Node.TEXT_NODE){e=a.endContainer;f=a.endContainer.nodeType!==Node.TEXT_NODE?a.endOffset===a.endContainer.childNodes.length:!1;g=a.endOffset;d=a.endContainer;if(g<d.childNodes.length)for(d=d.childNodes.item(g),g=0;d.firstChild;)d=d.firstChild;else for(;d.lastChild;)d=d.lastChild,g=d.nodeType===Node.TEXT_NODE?d.textContent.length:d.childNodes.length;d===e&&(e=null);a.setEnd(d,g);g=a.endContainer;0!==a.endOffset&&g.nodeType===Node.TEXT_NODE&&(d=g,a.endOffset!==d.length&&(c.push(d.splitText(a.endOffset)),
c.push(d)));g=a.startContainer;0!==a.startOffset&&g.nodeType===Node.TEXT_NODE&&(d=g,a.startOffset!==d.length&&(g=d.splitText(a.startOffset),c.push(d),c.push(g),a.setStart(g,0)));if(null!==e){for(g=a.endContainer;g.parentNode&&g.parentNode!==e;)g=g.parentNode;f=f?e.childNodes.length:b(g,e);a.setEnd(e,f)}}return c};this.containsRange=c;this.rangesIntersect=n;this.rangeIntersection=function(a,d){var b;n(a,d)&&(b=a.cloneRange(),-1===a.compareBoundaryPoints(Range.START_TO_START,d)&&b.setStart(d.startContainer,
d.startOffset),1===a.compareBoundaryPoints(Range.END_TO_END,d)&&b.setEnd(d.endContainer,d.endOffset));return b};this.getNodesInRange=function(a,d,b){var c=[],e=a.commonAncestorContainer,e=e.nodeType===Node.TEXT_NODE?e.parentNode:e;b=a.startContainer.ownerDocument.createTreeWalker(e,b,d,!1);var f,g;a.endContainer.childNodes[a.endOffset-1]?(f=a.endContainer.childNodes[a.endOffset-1],g=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(f=a.endContainer,g=Node.DOCUMENT_POSITION_PRECEDING);
if(a.startContainer.childNodes[a.startOffset])a=a.startContainer.childNodes[a.startOffset],b.currentNode=a;else{var n=a.startContainer;a.startOffset===(n.nodeType===Node.TEXT_NODE?n.length:n.childNodes.length)?(a=a.startContainer,b.currentNode=a,b.lastChild(),a=b.nextNode()):(a=a.startContainer,b.currentNode=a)}if(a){a=b.currentNode;if(a!==e)for(a=a.parentNode;a&&a!==e;)d(a)===NodeFilter.FILTER_REJECT&&(b.currentNode=a),a=a.parentNode;a=b.currentNode;switch(d(a)){case NodeFilter.FILTER_REJECT:for(a=
b.nextSibling();!a&&b.parentNode();)a=b.nextSibling();break;case NodeFilter.FILTER_SKIP:a=b.nextNode()}for(;a;){d=f.compareDocumentPosition(a);if(0!==d&&0===(d&g))break;c.push(a);a=b.nextNode()}}return c};this.normalizeTextNodes=function(a){a&&a.nextSibling&&(a=p(a,a.nextSibling));a&&a.previousSibling&&p(a.previousSibling,a)};this.rangeContainsNode=function(a,d){var b=d.ownerDocument.createRange(),e=d.ownerDocument.createRange(),f;b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer,
a.endOffset);e.selectNodeContents(d);f=c(b,e);b.detach();e.detach();return f};this.mergeIntoParent=m;this.removeUnwantedNodes=q;this.removeAllChildNodes=function(a){for(;a.firstChild;)a.removeChild(a.firstChild)};this.getElementsByTagNameNS=function(a,d,b){var c=[];a=a.getElementsByTagNameNS(d,b);c.length=b=a.length;for(d=0;d<b;d+=1)c[d]=a.item(d);return c};this.getElementsByTagName=function(a,d){var b=[],c,e,f;c=a.getElementsByTagName(d);b.length=f=c.length;for(e=0;e<f;e+=1)b[e]=c.item(e);return b};
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 f=a.compareDocumentPosition(c);2===f?f=-1:4===f?f=1:10===f?(d=b(a,c),f=d<e?1:-1):(e=b(c,a),f=e<d?-1:1);return f};this.adaptRangeDifferenceToZoomLevel=e;this.translateRect=function(a,d,b){return{top:e(a.top-d.top,b),left:e(a.left-d.left,b),bottom:e(a.bottom-d.top,b),right:e(a.right-d.left,b),width:e(a.width,b),height:e(a.height,b)}};this.getBoundingClientRect=function(a){var b=
a.ownerDocument,c=h(),e=b.body;if((!1===c.unscaledRangeClientRects||c.rangeBCRIgnoresElementBCR)&&a.nodeType===Node.ELEMENT_NODE)return a=a.getBoundingClientRect(),c.elementBCRIgnoresBodyScroll?{left:a.left+e.scrollLeft,right:a.right+e.scrollLeft,top:a.top+e.scrollTop,bottom:a.bottom+e.scrollTop,width:a.width,height:a.height}:a;var f;d?f=d:d=f=b.createRange();c=f;c.selectNode(a);return c.getBoundingClientRect()};this.mapKeyValObjOntoNode=function(a,d,b){Object.keys(d).forEach(function(c){var e=c.split(":"),
f=e[1],e=b(e[0]),g=d[c];e?(f=a.getElementsByTagNameNS(e,f)[0],f||(f=a.ownerDocument.createElementNS(e,c),a.appendChild(f)),f.textContent=g):runtime.log("Key ignored: "+c)})};this.removeKeyElementsFromNode=function(a,d,b){d.forEach(function(d){var l=d.split(":"),c=l[1];(l=b(l[0]))?(c=a.getElementsByTagNameNS(l,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=a;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=-1!==d.indexOf("msie")||-1!==d.indexOf("trident"),
b||d)&&(a.containsNode=f)})(this)};core.DomUtils=new core.DomUtilsImpl})();core.Cursor=function(h,k){function c(a){a.parentNode&&(m.push(a.previousSibling),m.push(a.nextSibling),a.parentNode.removeChild(a))}function b(a,d,b){if(d.nodeType===Node.TEXT_NODE){runtime.assert(Boolean(d),"putCursorIntoTextNode: invalid container");var l=d.parentNode;runtime.assert(Boolean(l),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=d.length,"putCursorIntoTextNode: offset is out of bounds");0===b?l.insertBefore(a,d):(b!==d.length&&d.splitText(b),l.insertBefore(a,
d.nextSibling))}else d.nodeType===Node.ELEMENT_NODE&&d.insertBefore(a,d.childNodes.item(b));m.push(a.previousSibling);m.push(a.nextSibling)}var g=h.createElementNS("urn:webodf:names:cursor","cursor"),n=h.createElementNS("urn:webodf:names:cursor","anchor"),p,m=[],q=h.createRange(),f,e=core.DomUtils;this.getNode=function(){return g};this.getAnchorNode=function(){return n.parentNode?n:g};this.getSelectedRange=function(){f?(q.setStartBefore(g),q.collapse(!0)):(q.setStartAfter(p?n:g),q.setEndBefore(p?
g:n));return q};this.setSelectedRange=function(a,d){q&&q!==a&&q.detach();q=a;p=!1!==d;(f=a.collapsed)?(c(n),c(g),b(g,a.startContainer,a.startOffset)):(c(n),c(g),b(p?g:n,a.endContainer,a.endOffset),b(p?n:g,a.startContainer,a.startOffset));m.forEach(e.normalizeTextNodes);m.length=0};this.hasForwardSelection=function(){return p};this.remove=function(){c(g);m.forEach(e.normalizeTextNodes);m.length=0};g.setAttributeNS("urn:webodf:names:cursor","memberId",k);n.setAttributeNS("urn:webodf:names:cursor","memberId",
k)};core.Destroyable=function(){};core.Destroyable.prototype.destroy=function(h){};core.EventSource=function(){};core.EventSource.prototype.subscribe=function(h,k){};core.EventSource.prototype.unsubscribe=function(h,k){};core.EventNotifier=function(h){function k(b){runtime.assert(!c.hasOwnProperty(b),'Duplicated event ids: "'+b+'" registered more than once.');c[b]=[]}var c={};this.emit=function(b,g){var n,h;runtime.assert(c.hasOwnProperty(b),'unknown event fired "'+b+'"');h=c[b];for(n=0;n<h.length;n+=1)h[n](g)};this.subscribe=function(b,g){runtime.assert(c.hasOwnProperty(b),'tried to subscribe to unknown event "'+b+'"');c[b].push(g)};this.unsubscribe=function(b,g){var n;runtime.assert(c.hasOwnProperty(b),'tried to unsubscribe from unknown event "'+
b+'"');n=c[b].indexOf(g);runtime.assert(-1!==n,'tried to unsubscribe unknown callback from event "'+b+'"');-1!==n&&c[b].splice(n,1)};this.register=k;h&&h.forEach(k)};core.ScheduledTask=function(h,k,c){function b(){p&&(c(n),p=!1)}function g(){b();h.apply(void 0,m);m=null}var n,p=!1,m=[],q=!1;this.trigger=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");m=Array.prototype.slice.call(arguments);p||(p=!0,n=k(g))};this.triggerImmediate=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");m=Array.prototype.slice.call(arguments);g()};this.processRequests=function(){p&&g()};this.cancel=b;this.restart=function(){runtime.assert(!1===
q,"Can't trigger destroyed ScheduledTask instance");b();p=!0;n=k(g)};this.destroy=function(c){b();q=!0;c()}};(function(){var h;core.Task={};core.Task.SUPPRESS_MANUAL_PROCESSING=!1;core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||h.performRedraw()};core.Task.createRedrawTask=function(k){return new core.ScheduledTask(k,h.requestRedrawTask,h.cancelRedrawTask)};core.Task.createTimeoutTask=function(h,c){return new core.ScheduledTask(h,function(b){return runtime.setTimeout(b,c)},runtime.clearTimeout)};h=new function(){var h={};this.requestRedrawTask=function(c){var b=runtime.requestAnimationFrame(function(){c();
delete h[b]});h[b]=c;return b};this.performRedraw=function(){Object.keys(h).forEach(function(c){h[c]();runtime.cancelAnimationFrame(parseInt(c,10))});h={}};this.cancelRedrawTask=function(c){runtime.cancelAnimationFrame(c);delete h[c]}}})();core.EventSubscriptions=function(){function h(b,g,n){b.subscribe(g,n);c.push({eventSource:b,eventid:g,callback:n})}function k(){var n=[];c.forEach(function(b){b.eventSource.unsubscribe(b.eventid,b.callback)});c.length=0;Object.keys(g).forEach(function(b){g[b].forEach(function(b){n.push(b.task.destroy)});delete g[b]});core.Async.destroyAll(n,function(){});b=new core.EventNotifier}var c=[],b=new core.EventNotifier,g={},n=0;this.addSubscription=h;this.addFrameSubscription=function(c,m,k){var f,e,a,d;
g.hasOwnProperty(m)||(g[m]=[]);a=g[m];for(d=0;d<a.length;d+=1)if(a[d].eventSource===c){f=a[d];break}f||(e="s"+n,n+=1,b.register(e),f={frameEventId:e,eventSource:c,task:core.Task.createRedrawTask(function(){b.emit(e,void 0)})},a.push(f),h(c,m,f.task.trigger));b.subscribe(f.frameEventId,k)};this.unsubscribeAll=k;this.destroy=function(b){k();b()}};core.LazyProperty=function(h){var k,c=!1;this.value=function(){c||(k=h(),c=!0);return k};this.reset=function(){c=!1}};core.LoopWatchDog=function(h,k){var c=Date.now(),b=0;this.check=function(){var g;if(h&&(g=Date.now(),g-c>h))throw runtime.log("alert","watchdog timeout"),"timeout!";if(0<k&&(b+=1,b>k))throw runtime.log("alert","watchdog loop overflow"),"loop overflow";}};core.NodeFilterChain=function(h){var k=NodeFilter.FILTER_REJECT,c=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(b){var g;for(g=0;g<h.length;g+=1)if(h[g].acceptNode(b)===k)return k;return c}};core.PositionIterator=function(h,k,c,b){function g(){this.acceptNode=function(a){return!a||a.nodeType===r&&0===a.length?y:B}}function n(a){this.acceptNode=function(d){return!d||d.nodeType===r&&0===d.length?y:a.acceptNode(d)}}function p(){var d=e.currentNode,b=d.nodeType;a=b===r?d.length-1:b===l?1:0}function m(){if(null===e.previousSibling()){if(!e.parentNode()||e.currentNode===h)return e.firstChild(),!1;a=0}else p();return!0}function q(){var b=e.currentNode,l;l=d(b);if(b!==h)for(b=b.parentNode;b&&
b!==h;)d(b)===y&&(e.currentNode=b,l=y),b=b.parentNode;l===y?(a=e.currentNode.nodeType===r?b.length:1,b=f.nextPosition()):b=l===B?!0:f.nextPosition();b&&runtime.assert(d(e.currentNode)===B,"moveToAcceptedNode did not result in walker being on an accepted node");return b}var f=this,e,a,d,r=Node.TEXT_NODE,l=Node.ELEMENT_NODE,B=NodeFilter.FILTER_ACCEPT,y=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var d=e.currentNode,b=d.nodeType;if(d===h)return!1;if(0===a&&b===l)null===e.firstChild()&&(a=1);
else if(b===r&&a+1<d.length)a+=1;else if(null!==e.nextSibling())a=0;else if(e.parentNode())a=1;else return!1;return!0};this.previousPosition=function(){var d=!0,b=e.currentNode;0===a?d=m():b.nodeType===r?--a:null!==e.lastChild()?p():b===h?d=!1:a=0;return d};this.previousNode=m;this.container=function(){var d=e.currentNode,b=d.nodeType;0===a&&b!==r&&(d=d.parentNode);return d};this.rightNode=function(){var b=e.currentNode,c=b.nodeType;if(c===r&&a===b.length)for(b=b.nextSibling;b&&d(b)!==B;)b=b.nextSibling;
else c===l&&1===a&&(b=null);return b};this.leftNode=function(){var b=e.currentNode;if(0===a)for(b=b.previousSibling;b&&d(b)!==B;)b=b.previousSibling;else if(b.nodeType===l)for(b=b.lastChild;b&&d(b)!==B;)b=b.previousSibling;return b};this.getCurrentNode=function(){return e.currentNode};this.unfilteredDomOffset=function(){if(e.currentNode.nodeType===r)return a;for(var d=0,b=e.currentNode,b=1===a?b.lastChild:b.previousSibling;b;)d+=1,b=b.previousSibling;return d};this.getPreviousSibling=function(){var a=
e.currentNode,d=e.previousSibling();e.currentNode=a;return d};this.getNextSibling=function(){var a=e.currentNode,d=e.nextSibling();e.currentNode=a;return d};this.setPositionBeforeElement=function(d){runtime.assert(Boolean(d),"setPositionBeforeElement called without element");e.currentNode=d;a=0;return q()};this.setUnfilteredPosition=function(d,b){runtime.assert(Boolean(d),"PositionIterator.setUnfilteredPosition called without container");e.currentNode=d;d.nodeType===r?(a=b,runtime.assert(b<=d.length,
"Error in setPosition: "+b+" > "+d.length),runtime.assert(0<=b,"Error in setPosition: "+b+" < 0"),b===d.length&&(e.nextSibling()?a=0:e.parentNode()?a=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):b<d.childNodes.length?(e.currentNode=d.childNodes.item(b),a=0):a=1;return q()};this.moveToEnd=function(){e.currentNode=h;a=1};this.moveToEndOfNode=function(d){d.nodeType===r?f.setUnfilteredPosition(d,d.length):(e.currentNode=d,a=1)};this.isBeforeNode=function(){return 0===a};
this.getNodeFilter=function(){return d};d=(c?new n(c):new g).acceptNode;d.acceptNode=d;k=k||NodeFilter.SHOW_ALL;runtime.assert(h.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes");e=h.ownerDocument.createTreeWalker(h,k,d,b);a=0;null===e.firstChild()&&(a=1)};core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(h){};core.PositionFilterChain=function(){var h=[],k=core.PositionFilter.FilterResult.FILTER_ACCEPT,c=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(b){var g;for(g=0;g<h.length;g+=1)if(h[g].acceptPosition(b)===c)return c;return k};this.addFilter=function(b){h.push(b)}};(function(){core.RawInflate=function(){var h;(function(k){h=k()})(function(){return function c(b,g,n){function h(m,f){if(!g[m]){if(!b[m])throw Error("Cannot find module '"+m+"'");var e=g[m]={exports:{}};b[m][0].call(e.exports,function(a){var d=b[m][1][a];return h(d?d:a)},e,e.exports,c,b,g,n)}return g[m].exports}for(var m=0;m<n.length;m++)h(n[m]);return h}({1:[function(c,b,g){function n(a,d){var b=new r(d);b.push(a,!0);if(b.err)throw b.msg;return b.result}var h=c("./zlib/inflate.js"),m=c("./utils/common"),
q=c("./utils/strings"),f=c("./zlib/constants"),e=c("./zlib/messages"),a=c("./zlib/zstream"),d=c("./zlib/gzheader"),r=function(b){var c=this.options=m.assign({chunkSize:16384,windowBits:0,to:""},b||{});c.raw&&0<=c.windowBits&&16>c.windowBits&&(c.windowBits=-c.windowBits,0===c.windowBits&&(c.windowBits=-15));!(0<=c.windowBits&&16>c.windowBits)||b&&b.windowBits||(c.windowBits+=32);15<c.windowBits&&48>c.windowBits&&0===(c.windowBits&15)&&(c.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=
[];this.strm=new a;this.strm.avail_out=0;b=h.inflateInit2(this.strm,c.windowBits);if(b!==f.Z_OK)throw Error(e[b]);this.header=new d;h.inflateGetHeader(this.strm,this.header)};r.prototype.push=function(a,d){var b=this.strm,c=this.options.chunkSize,e,r,g,w,n;if(this.ended)return!1;r=d===~~d?d:!0===d?f.Z_FINISH:f.Z_NO_FLUSH;b.input="string"===typeof a?q.binstring2buf(a):a;b.next_in=0;b.avail_in=b.input.length;do{0===b.avail_out&&(b.output=new m.Buf8(c),b.next_out=0,b.avail_out=c);e=h.inflate(b,f.Z_NO_FLUSH);
if(e!==f.Z_STREAM_END&&e!==f.Z_OK)return this.onEnd(e),this.ended=!0,!1;if(b.next_out&&(0===b.avail_out||e===f.Z_STREAM_END||0===b.avail_in&&r===f.Z_FINISH))if("string"===this.options.to)g=q.utf8border(b.output,b.next_out),w=b.next_out-g,n=q.buf2string(b.output,g),b.next_out=w,b.avail_out=c-w,w&&m.arraySet(b.output,b.output,g,w,0),this.onData(n);else this.onData(m.shrinkBuf(b.output,b.next_out))}while((0<b.avail_in||0===b.avail_out)&&e!==f.Z_STREAM_END);e===f.Z_STREAM_END&&(r=f.Z_FINISH);return r===
f.Z_FINISH?(e=h.inflateEnd(this.strm),this.onEnd(e),this.ended=!0,e===f.Z_OK):!0};r.prototype.onData=function(a){this.chunks.push(a)};r.prototype.onEnd=function(a){a===f.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):m.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=this.strm.msg};g.Inflate=r;g.inflate=n;g.inflateRaw=function(a,d){d=d||{};d.raw=!0;return n(a,d)};g.ungzip=n},{"./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,g){c="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;g.assign=function(b){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var f=c.shift();if(f){if("object"!==typeof f)throw new TypeError(f+"must be non-object");for(var e in f)f.hasOwnProperty(e)&&(b[e]=f[e])}}return b};g.shrinkBuf=function(b,c){if(b.length===c)return b;if(b.subarray)return b.subarray(0,c);b.length=c;return b};
var n={arraySet:function(b,c,f,e,a){if(c.subarray&&b.subarray)b.set(c.subarray(f,f+e),a);else for(var d=0;d<e;d++)b[a+d]=c[f+d]},flattenChunks:function(b){var c,f,e,a,d;c=e=0;for(f=b.length;c<f;c++)e+=b[c].length;d=new Uint8Array(e);c=e=0;for(f=b.length;c<f;c++)a=b[c],d.set(a,e),e+=a.length;return d}},h={arraySet:function(b,c,f,e,a){for(var d=0;d<e;d++)b[a+d]=c[f+d]},flattenChunks:function(b){return[].concat.apply([],b)}};g.setTyped=function(b){b?(g.Buf8=Uint8Array,g.Buf16=Uint16Array,g.Buf32=Int32Array,
g.assign(g,n)):(g.Buf8=Array,g.Buf16=Array,g.Buf32=Array,g.assign(g,h))};g.setTyped(c)},{}],3:[function(c,b,g){function n(a,b){if(65537>b&&(a.subarray&&q||!a.subarray&&m))return String.fromCharCode.apply(null,h.shrinkBuf(a,b));for(var c="",e=0;e<b;e++)c+=String.fromCharCode(a[e]);return c}var h=c("./common"),m=!0,q=!0;try{String.fromCharCode.apply(null,[0])}catch(f){m=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){q=!1}var a=new h.Buf8(256);for(c=0;256>c;c++)a[c]=252<=c?6:248<=
c?5:240<=c?4:224<=c?3:192<=c?2:1;a[254]=a[254]=1;g.string2buf=function(a){var b,c,e,f,g,n=a.length,m=0;for(f=0;f<n;f++)c=a.charCodeAt(f),55296===(c&64512)&&f+1<n&&(e=a.charCodeAt(f+1),56320===(e&64512)&&(c=65536+(c-55296<<10)+(e-56320),f++)),m+=128>c?1:2048>c?2:65536>c?3:4;b=new h.Buf8(m);for(f=g=0;g<m;f++)c=a.charCodeAt(f),55296===(c&64512)&&f+1<n&&(e=a.charCodeAt(f+1),56320===(e&64512)&&(c=65536+(c-55296<<10)+(e-56320),f++)),128>c?b[g++]=c:(2048>c?b[g++]=192|c>>>6:(65536>c?b[g++]=224|c>>>12:(b[g++]=
240|c>>>18,b[g++]=128|c>>>12&63),b[g++]=128|c>>>6&63),b[g++]=128|c&63);return b};g.buf2binstring=function(a){return n(a,a.length)};g.binstring2buf=function(a){for(var b=new h.Buf8(a.length),c=0,e=b.length;c<e;c++)b[c]=a.charCodeAt(c);return b};g.buf2string=function(d,b){var c,e,f,g,h=b||d.length,m=Array(2*h);for(c=e=0;c<h;)if(f=d[c++],128>f)m[e++]=f;else if(g=a[f],4<g)m[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;1<g&&c<h;)f=f<<6|d[c++]&63,g--;1<g?m[e++]=65533:65536>f?m[e++]=f:(f-=65536,m[e++]=
55296|f>>10&1023,m[e++]=56320|f&1023)}return n(m,e)};g.utf8border=function(d,b){var c;b=b||d.length;b>d.length&&(b=d.length);for(c=b-1;0<=c&&128===(d[c]&192);)c--;return 0>c||0===c?b:c+a[d[c]]>b?c:b}},{"./common":2}],4:[function(c,b,g){b.exports=function(b,c,g,h){var f=b&65535|0;b=b>>>16&65535|0;for(var e=0;0!==g;){e=2E3<g?2E3:g;g-=e;do f=f+c[h++]|0,b=b+f|0;while(--e);f%=65521;b%=65521}return f|b<<16|0}},{}],5:[function(c,b,g){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,g){var n=function(){for(var b,c=[],g=0;256>g;g++){b=g;for(var f=0;8>f;f++)b=b&1?3988292384^b>>>1:b>>>1;c[g]=b}return c}();b.exports=function(b,c,g,f){g=f+g;for(b^=
-1;f<g;f++)b=b>>>8^n[(b^c[f])&255];return b^-1}},{}],7:[function(c,b,g){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,g){b.exports=function(b,c){var g,h,f,e,a,d,r,l,B,y,D,z,t,x,w,F,L,H,G,A,K,v,u,Q;g=b.state;h=b.next_in;u=b.input;f=h+(b.avail_in-5);e=b.next_out;Q=b.output;a=e-(c-b.avail_out);d=e+(b.avail_out-257);r=g.dmax;l=g.wsize;B=g.whave;y=g.wnext;D=g.window;z=g.hold;t=g.bits;
x=g.lencode;w=g.distcode;F=(1<<g.lenbits)-1;L=(1<<g.distbits)-1;a:do b:for(15>t&&(z+=u[h++]<<t,t+=8,z+=u[h++]<<t,t+=8),H=x[z&F];;){G=H>>>24;z>>>=G;t-=G;G=H>>>16&255;if(0===G)Q[e++]=H&65535;else if(G&16){A=H&65535;if(G&=15)t<G&&(z+=u[h++]<<t,t+=8),A+=z&(1<<G)-1,z>>>=G,t-=G;15>t&&(z+=u[h++]<<t,t+=8,z+=u[h++]<<t,t+=8);H=w[z&L];c:for(;;){G=H>>>24;z>>>=G;t-=G;G=H>>>16&255;if(G&16){H&=65535;G&=15;t<G&&(z+=u[h++]<<t,t+=8,t<G&&(z+=u[h++]<<t,t+=8));H+=z&(1<<G)-1;if(H>r){b.msg="invalid distance too far back";
g.mode=30;break a}z>>>=G;t-=G;G=e-a;if(H>G){G=H-G;if(G>B&&g.sane){b.msg="invalid distance too far back";g.mode=30;break a}K=0;v=D;if(0===y){if(K+=l-G,G<A){A-=G;do Q[e++]=D[K++];while(--G);K=e-H;v=Q}}else if(y<G){if(K+=l+y-G,G-=y,G<A){A-=G;do Q[e++]=D[K++];while(--G);K=0;if(y<A){G=y;A-=G;do Q[e++]=D[K++];while(--G);K=e-H;v=Q}}}else if(K+=y-G,G<A){A-=G;do Q[e++]=D[K++];while(--G);K=e-H;v=Q}for(;2<A;)Q[e++]=v[K++],Q[e++]=v[K++],Q[e++]=v[K++],A-=3;A&&(Q[e++]=v[K++],1<A&&(Q[e++]=v[K++]))}else{K=e-H;do Q[e++]=
Q[K++],Q[e++]=Q[K++],Q[e++]=Q[K++],A-=3;while(2<A);A&&(Q[e++]=Q[K++],1<A&&(Q[e++]=Q[K++]))}}else if(0===(G&64)){H=w[(H&65535)+(z&(1<<G)-1)];continue c}else{b.msg="invalid distance code";g.mode=30;break a}break}}else if(0===(G&64)){H=x[(H&65535)+(z&(1<<G)-1)];continue b}else{G&32?g.mode=12:(b.msg="invalid literal/length code",g.mode=30);break a}break}while(h<f&&e<d);A=t>>3;h-=A;t-=A<<3;b.next_in=h;b.next_out=e;b.avail_in=h<f?5+(f-h):5-(h-f);b.avail_out=e<d?257+(d-e):257-(e-d);g.hold=z&(1<<t)-1;g.bits=
t}},{}],9:[function(c,b,g){function h(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function p(){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 a.Buf16(320);this.work=
new a.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function m(d){var b;if(!d||!d.state)return-2;b=d.state;d.total_in=d.total_out=b.total=0;d.msg="";b.wrap&&(d.adler=b.wrap&1);b.mode=1;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=b.lendyn=new a.Buf32(852);b.distcode=b.distdyn=new a.Buf32(592);b.sane=1;b.back=-1;return 0}function q(a){var d;if(!a||!a.state)return-2;d=a.state;d.wsize=0;d.whave=0;d.wnext=0;return m(a)}function f(a,d){var b,c;if(!a||
!a.state)return-2;c=a.state;0>d?(b=0,d=-d):(b=(d>>4)+1,48>d&&(d&=15));if(d&&(8>d||15<d))return-2;null!==c.window&&c.wbits!==d&&(c.window=null);c.wrap=b;c.wbits=d;return q(a)}function e(a,d){var b;if(!a)return-2;b=new p;a.state=b;b.window=null;b=f(a,d);0!==b&&(a.state=null);return b}var a=c("../utils/common"),d=c("./adler32"),r=c("./crc32"),l=c("./inffast"),B=c("./inftrees"),y=!0,D,z;g.inflateReset=q;g.inflateReset2=f;g.inflateResetKeep=m;g.inflateInit=function(a){return e(a,15)};g.inflateInit2=e;
g.inflate=function(b,c){var e,f,g,m,p,A,q,v,u,Q,R,C,I,P,U=0,T,ca,Y,E=new a.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-2;e=b.state;12===e.mode&&(e.mode=13);p=b.next_out;g=b.output;q=b.avail_out;m=b.next_in;f=b.input;A=b.avail_in;v=e.hold;u=e.bits;Q=A;R=q;Y=0;a:for(;;)switch(e.mode){case 1:if(0===e.wrap){e.mode=13;break}for(;16>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if(e.wrap&2&&35615===v){e.check=0;E[0]=v&255;E[1]=v>>>
8&255;e.check=r(e.check,E,2,0);u=v=0;e.mode=2;break}e.flags=0;e.head&&(e.head.done=!1);if(!(e.wrap&1)||(((v&255)<<8)+(v>>8))%31){b.msg="incorrect header check";e.mode=30;break}if(8!==(v&15)){b.msg="unknown compression method";e.mode=30;break}v>>>=4;u-=4;I=(v&15)+8;if(0===e.wbits)e.wbits=I;else if(I>e.wbits){b.msg="invalid window size";e.mode=30;break}e.dmax=1<<I;b.adler=e.check=1;e.mode=v&512?10:12;u=v=0;break;case 2:for(;16>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.flags=v;if(8!==(e.flags&255)){b.msg=
"unknown compression method";e.mode=30;break}if(e.flags&57344){b.msg="unknown header flags set";e.mode=30;break}e.head&&(e.head.text=v>>8&1);e.flags&512&&(E[0]=v&255,E[1]=v>>>8&255,e.check=r(e.check,E,2,0));u=v=0;e.mode=3;case 3:for(;32>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.head&&(e.head.time=v);e.flags&512&&(E[0]=v&255,E[1]=v>>>8&255,E[2]=v>>>16&255,E[3]=v>>>24&255,e.check=r(e.check,E,4,0));u=v=0;e.mode=4;case 4:for(;16>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.head&&(e.head.xflags=v&255,
e.head.os=v>>8);e.flags&512&&(E[0]=v&255,E[1]=v>>>8&255,e.check=r(e.check,E,2,0));u=v=0;e.mode=5;case 5:if(e.flags&1024){for(;16>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.length=v;e.head&&(e.head.extra_len=v);e.flags&512&&(E[0]=v&255,E[1]=v>>>8&255,e.check=r(e.check,E,2,0));u=v=0}else e.head&&(e.head.extra=null);e.mode=6;case 6:if(e.flags&1024&&(C=e.length,C>A&&(C=A),C&&(e.head&&(I=e.head.extra_len-e.length,e.head.extra||(e.head.extra=Array(e.head.extra_len)),a.arraySet(e.head.extra,f,m,C,I)),
e.flags&512&&(e.check=r(e.check,f,C,m)),A-=C,m+=C,e.length-=C),e.length))break a;e.length=0;e.mode=7;case 7:if(e.flags&2048){if(0===A)break a;C=0;do I=f[m+C++],e.head&&I&&65536>e.length&&(e.head.name+=String.fromCharCode(I));while(I&&C<A);e.flags&512&&(e.check=r(e.check,f,C,m));A-=C;m+=C;if(I)break a}else e.head&&(e.head.name=null);e.length=0;e.mode=8;case 8:if(e.flags&4096){if(0===A)break a;C=0;do I=f[m+C++],e.head&&I&&65536>e.length&&(e.head.comment+=String.fromCharCode(I));while(I&&C<A);e.flags&
512&&(e.check=r(e.check,f,C,m));A-=C;m+=C;if(I)break a}else e.head&&(e.head.comment=null);e.mode=9;case 9:if(e.flags&512){for(;16>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if(v!==(e.check&65535)){b.msg="header crc mismatch";e.mode=30;break}u=v=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0);b.adler=e.check=0;e.mode=12;break;case 10:for(;32>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}b.adler=e.check=h(v);u=v=0;e.mode=11;case 11:if(0===e.havedict)return b.next_out=p,b.avail_out=q,b.next_in=m,b.avail_in=
A,e.hold=v,e.bits=u,2;b.adler=e.check=1;e.mode=12;case 12:if(5===c||6===c)break a;case 13:if(e.last){v>>>=u&7;u-=u&7;e.mode=27;break}for(;3>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.last=v&1;v>>>=1;--u;switch(v&3){case 0:e.mode=14;break;case 1:C=e;if(y){I=void 0;D=new a.Buf32(512);z=new a.Buf32(32);for(I=0;144>I;)C.lens[I++]=8;for(;256>I;)C.lens[I++]=9;for(;280>I;)C.lens[I++]=7;for(;288>I;)C.lens[I++]=8;B(1,C.lens,0,288,D,0,C.work,{bits:9});for(I=0;32>I;)C.lens[I++]=5;B(2,C.lens,0,32,z,0,C.work,
{bits:5});y=!1}C.lencode=D;C.lenbits=9;C.distcode=z;C.distbits=5;e.mode=20;if(6===c){v>>>=2;u-=2;break a}break;case 2:e.mode=17;break;case 3:b.msg="invalid block type",e.mode=30}v>>>=2;u-=2;break;case 14:v>>>=u&7;for(u-=u&7;32>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if((v&65535)!==(v>>>16^65535)){b.msg="invalid stored block lengths";e.mode=30;break}e.length=v&65535;u=v=0;e.mode=15;if(6===c)break a;case 15:e.mode=16;case 16:if(C=e.length){C>A&&(C=A);C>q&&(C=q);if(0===C)break a;a.arraySet(g,f,m,
C,p);A-=C;m+=C;q-=C;p+=C;e.length-=C;break}e.mode=12;break;case 17:for(;14>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.nlen=(v&31)+257;v>>>=5;u-=5;e.ndist=(v&31)+1;v>>>=5;u-=5;e.ncode=(v&15)+4;v>>>=4;u-=4;if(286<e.nlen||30<e.ndist){b.msg="too many length or distance symbols";e.mode=30;break}e.have=0;e.mode=18;case 18:for(;e.have<e.ncode;){for(;3>u;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.lens[Z[e.have++]]=v&7;v>>>=3;u-=3}for(;19>e.have;)e.lens[Z[e.have++]]=0;e.lencode=e.lendyn;e.lenbits=7;C={bits:e.lenbits};
Y=B(0,e.lens,0,19,e.lencode,0,e.work,C);e.lenbits=C.bits;if(Y){b.msg="invalid code lengths set";e.mode=30;break}e.have=0;e.mode=19;case 19:for(;e.have<e.nlen+e.ndist;){for(;;){U=e.lencode[v&(1<<e.lenbits)-1];C=U>>>24;U&=65535;if(C<=u)break;if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if(16>U)v>>>=C,u-=C,e.lens[e.have++]=U;else{if(16===U){for(I=C+2;u<I;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}v>>>=C;u-=C;if(0===e.have){b.msg="invalid bit length repeat";e.mode=30;break}I=e.lens[e.have-1];C=3+(v&3);v>>>=2;
u-=2}else if(17===U){for(I=C+3;u<I;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}v>>>=C;u-=C;I=0;C=3+(v&7);v>>>=3;u-=3}else{for(I=C+7;u<I;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}v>>>=C;u-=C;I=0;C=11+(v&127);v>>>=7;u-=7}if(e.have+C>e.nlen+e.ndist){b.msg="invalid bit length repeat";e.mode=30;break}for(;C--;)e.lens[e.have++]=I}}if(30===e.mode)break;if(0===e.lens[256]){b.msg="invalid code -- missing end-of-block";e.mode=30;break}e.lenbits=9;C={bits:e.lenbits};Y=B(1,e.lens,0,e.nlen,e.lencode,0,e.work,C);e.lenbits=
C.bits;if(Y){b.msg="invalid literal/lengths set";e.mode=30;break}e.distbits=6;e.distcode=e.distdyn;C={bits:e.distbits};Y=B(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,C);e.distbits=C.bits;if(Y){b.msg="invalid distances set";e.mode=30;break}e.mode=20;if(6===c)break a;case 20:e.mode=21;case 21:if(6<=A&&258<=q){b.next_out=p;b.avail_out=q;b.next_in=m;b.avail_in=A;e.hold=v;e.bits=u;l(b,R);p=b.next_out;g=b.output;q=b.avail_out;m=b.next_in;f=b.input;A=b.avail_in;v=e.hold;u=e.bits;12===e.mode&&(e.back=-1);
break}for(e.back=0;;){U=e.lencode[v&(1<<e.lenbits)-1];C=U>>>24;I=U>>>16&255;U&=65535;if(C<=u)break;if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if(I&&0===(I&240)){P=C;T=I;for(ca=U;;){U=e.lencode[ca+((v&(1<<P+T)-1)>>P)];C=U>>>24;I=U>>>16&255;U&=65535;if(P+C<=u)break;if(0===A)break a;A--;v+=f[m++]<<u;u+=8}v>>>=P;u-=P;e.back+=P}v>>>=C;u-=C;e.back+=C;e.length=U;if(0===I){e.mode=26;break}if(I&32){e.back=-1;e.mode=12;break}if(I&64){b.msg="invalid literal/length code";e.mode=30;break}e.extra=I&15;e.mode=22;case 22:if(e.extra){for(I=
e.extra;u<I;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.length+=v&(1<<e.extra)-1;v>>>=e.extra;u-=e.extra;e.back+=e.extra}e.was=e.length;e.mode=23;case 23:for(;;){U=e.distcode[v&(1<<e.distbits)-1];C=U>>>24;I=U>>>16&255;U&=65535;if(C<=u)break;if(0===A)break a;A--;v+=f[m++]<<u;u+=8}if(0===(I&240)){P=C;T=I;for(ca=U;;){U=e.distcode[ca+((v&(1<<P+T)-1)>>P)];C=U>>>24;I=U>>>16&255;U&=65535;if(P+C<=u)break;if(0===A)break a;A--;v+=f[m++]<<u;u+=8}v>>>=P;u-=P;e.back+=P}v>>>=C;u-=C;e.back+=C;if(I&64){b.msg="invalid distance code";
e.mode=30;break}e.offset=U;e.extra=I&15;e.mode=24;case 24:if(e.extra){for(I=e.extra;u<I;){if(0===A)break a;A--;v+=f[m++]<<u;u+=8}e.offset+=v&(1<<e.extra)-1;v>>>=e.extra;u-=e.extra;e.back+=e.extra}if(e.offset>e.dmax){b.msg="invalid distance too far back";e.mode=30;break}e.mode=25;case 25:if(0===q)break a;C=R-q;if(e.offset>C){C=e.offset-C;if(C>e.whave&&e.sane){b.msg="invalid distance too far back";e.mode=30;break}C>e.wnext?(C-=e.wnext,I=e.wsize-C):I=e.wnext-C;C>e.length&&(C=e.length);P=e.window}else P=
g,I=p-e.offset,C=e.length;C>q&&(C=q);q-=C;e.length-=C;do g[p++]=P[I++];while(--C);0===e.length&&(e.mode=21);break;case 26:if(0===q)break a;g[p++]=e.length;q--;e.mode=21;break;case 27:if(e.wrap){for(;32>u;){if(0===A)break a;A--;v|=f[m++]<<u;u+=8}R-=q;b.total_out+=R;e.total+=R;R&&(b.adler=e.check=e.flags?r(e.check,g,R,p-R):d(e.check,g,R,p-R));R=q;if((e.flags?v:h(v))!==e.check){b.msg="incorrect data check";e.mode=30;break}u=v=0}e.mode=28;case 28:if(e.wrap&&e.flags){for(;32>u;){if(0===A)break a;A--;v+=
f[m++]<<u;u+=8}if(v!==(e.total&4294967295)){b.msg="incorrect length check";e.mode=30;break}u=v=0}e.mode=29;case 29:Y=1;break a;case 30:Y=-3;break a;case 31:return-4;default:return-2}b.next_out=p;b.avail_out=q;b.next_in=m;b.avail_in=A;e.hold=v;e.bits=u;if(e.wsize||R!==b.avail_out&&30>e.mode&&(27>e.mode||4!==c))f=b.output,m=b.next_out,p=R-b.avail_out,q=b.state,null===q.window&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new a.Buf8(q.wsize)),p>=q.wsize?(a.arraySet(q.window,f,m-q.wsize,q.wsize,0),
q.wnext=0,q.whave=q.wsize):(A=q.wsize-q.wnext,A>p&&(A=p),a.arraySet(q.window,f,m-p,A,q.wnext),(p-=A)?(a.arraySet(q.window,f,m-p,p,0),q.wnext=p,q.whave=q.wsize):(q.wnext+=A,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=A)));Q-=b.avail_in;R-=b.avail_out;b.total_in+=Q;b.total_out+=R;e.total+=R;e.wrap&&R&&(b.adler=e.check=e.flags?r(e.check,g,R,b.next_out-R):d(e.check,g,R,b.next_out-R));b.data_type=e.bits+(e.last?64:0)+(12===e.mode?128:0)+(20===e.mode||15===e.mode?256:0);(0===Q&&0===R||4===
c)&&0===Y&&(Y=-5);return Y};g.inflateEnd=function(a){if(!a||!a.state)return-2;var d=a.state;d.window&&(d.window=null);a.state=null;return 0};g.inflateGetHeader=function(a,d){var b;if(!a||!a.state)return-2;b=a.state;if(0===(b.wrap&2))return-2;b.head=d;d.done=!1;return 0};g.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":2,"./adler32":4,"./crc32":6,"./inffast":8,"./inftrees":10}],10:[function(c,b,g){var h=c("../utils/common"),p=[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],m=[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],q=[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],f=[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,a,d,c,l,g,y,D){for(var z=D.bits,t=0,x=0,w=0,F=0,L=0,H=0,G=0,A=0,K=0,v=0,u,Q,R=null,C=0,I,P=new h.Buf16(16),H=new h.Buf16(16),
U=null,T=0,ca,Y,E,t=0;15>=t;t++)P[t]=0;for(x=0;x<c;x++)P[a[d+x]]++;L=z;for(F=15;1<=F&&0===P[F];F--);L>F&&(L=F);if(0===F)return l[g++]=20971520,l[g++]=20971520,D.bits=1,0;for(w=1;w<F&&0===P[w];w++);L<w&&(L=w);for(t=A=1;15>=t;t++)if(A<<=1,A-=P[t],0>A)return-1;if(0<A&&(0===b||1!==F))return-1;H[1]=0;for(t=1;15>t;t++)H[t+1]=H[t]+P[t];for(x=0;x<c;x++)0!==a[d+x]&&(y[H[a[d+x]]++]=x);switch(b){case 0:R=U=y;I=19;break;case 1:R=p;C-=257;U=m;T-=257;I=256;break;default:R=q,U=f,I=-1}x=v=0;t=w;z=g;H=L;G=0;Q=-1;
K=1<<L;c=K-1;if(1===b&&852<K||2===b&&592<K)return 1;for(var Z=0;;){Z++;ca=t-G;y[x]<I?(Y=0,E=y[x]):y[x]>I?(Y=U[T+y[x]],E=R[C+y[x]]):(Y=96,E=0);A=1<<t-G;w=u=1<<H;do u-=A,l[z+(v>>G)+u]=ca<<24|Y<<16|E|0;while(0!==u);for(A=1<<t-1;v&A;)A>>=1;0!==A?(v&=A-1,v+=A):v=0;x++;if(0===--P[t]){if(t===F)break;t=a[d+y[x]]}if(t>L&&(v&c)!==Q){0===G&&(G=L);z+=w;H=t-G;for(A=1<<H;H+G<F;){A-=P[H+G];if(0>=A)break;H++;A<<=1}K+=1<<H;if(1===b&&852<K||2===b&&592<K)return 1;Q=v&c;l[Q]=L<<24|H<<16|z-g|0}}0!==v&&(l[z+v]=t-G<<24|
4194304);D.bits=L;return 0}},{"../utils/common":2}],11:[function(c,b,g){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,g){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 h.inflateRaw(k)}}}()})();core.StepDirection={PREVIOUS:1,NEXT:2};core.StepIterator=function(h,k){function c(){a=null;r=d=void 0}function b(){void 0===r&&(r=h.acceptPosition(k)===f);return r}function g(a,d){c();return k.setUnfilteredPosition(a,d)}function n(){a||(a=k.container());return a}function p(){void 0===d&&(d=k.unfilteredDomOffset());return d}function m(){for(c();k.nextPosition();)if(c(),b())return!0;return!1}function q(){for(c();k.previousPosition();)if(c(),b())return!0;return!1}var f=core.PositionFilter.FilterResult.FILTER_ACCEPT,e=core.StepDirection.NEXT,
a,d,r;this.isStep=b;this.setPosition=g;this.container=n;this.offset=p;this.nextStep=m;this.previousStep=q;this.advanceStep=function(a){return a===e?m():q()};this.roundToClosestStep=function(){var a,d,e=b();e||(a=n(),d=p(),e=q(),e||(g(a,d),e=m()));return e};this.roundToPreviousStep=function(){var a=b();a||(a=q());return a};this.roundToNextStep=function(){var a=b();a||(a=m());return a};this.leftNode=function(){return k.leftNode()};this.snapshot=function(){return new core.StepIterator.StepSnapshot(n(),
p())};this.restore=function(a){g(a.container,a.offset)}};core.StepIterator.StepSnapshot=function(h,k){this.container=h;this.offset=k};core.Utils=function(){function h(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 h(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]=h(k[b],c[b])})}else k=c;return k}this.hashString=function(h){var c=0,b,g;b=0;for(g=h.length;b<g;b+=1)c=(c<<5)-c+h.charCodeAt(b),c|=0;return c};this.mergeObjects=function(k,c){Object.keys(c).forEach(function(b){k[b]=
h(k[b],c[b])});return k}};core.Zip=function(h,k){function c(a,d,b){B?b(null,B.subarray(a,a+d)):b("File data not loaded",null)}function b(a){var d=[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],b,e,c=a.length,l=0,l=0;b=-1;for(e=0;e<c;e+=1)l=(b^a[e])&255,l=d[l],b=b>>>8^l;return b^-1}function g(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 n(a){var d=a.getFullYear();return 1980>d?0:d-1980<<25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function p(a,d){var b,e,l,f,r,v,u,h=this;this.load=function(d){if(null!==h.data)d(null,h.data);else{var b=r+34+e+l+256;b+u>y&&(b=y-u);c(u,b,function(b,e){if(b||null===e)d(b,e);else a:{var c=e,l=new core.ByteArray(c),g=l.readUInt32LE(),u;if(67324752!==g)d("File entry signature is wrong."+g.toString()+" "+c.length.toString(),null);
else{l.pos+=22;g=l.readUInt16LE();u=l.readUInt16LE();l.pos+=g+u;if(f){c=c.subarray(l.pos,l.pos+r);if(r!==c.length){d("The amount of compressed bytes read was "+c.length.toString()+" instead of "+r.toString()+" for "+h.filename+" in "+a+".",null);break a}c=z(c,v)}else c=c.subarray(l.pos,l.pos+v);v!==c.length?d("The amount of bytes read was "+c.length.toString()+" instead of "+v.toString()+" for "+h.filename+" in "+a+".",null):(h.data=c,d(null,c))}}})}};this.set=function(a,d,b,e){h.filename=a;h.data=
d;h.compressed=b;h.date=e};this.error=null;d&&(b=d.readUInt32LE(),33639248!==b?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=g(d.readUInt32LE()),d.readUInt32LE(),r=d.readUInt32LE(),v=d.readUInt32LE(),e=d.readUInt16LE(),l=d.readUInt16LE(),b=d.readUInt16LE(),d.pos+=8,u=d.readUInt32LE(),this.filename=runtime.byteArrayToString(d.data.subarray(d.pos,d.pos+e),"utf8"),this.data=
null,d.pos+=e+l+b))}function m(a,d){if(22!==a.length)d("Central directory length should be 22.",t);else{var b=new core.ByteArray(a),e;e=b.readUInt32LE();101010256!==e?d("Central directory signature is wrong: "+e.toString(),t):(e=b.readUInt16LE(),0!==e?d("Zip files with non-zero disk numbers are not supported.",t):(e=b.readUInt16LE(),0!==e?d("Zip files with non-zero disk numbers are not supported.",t):(e=b.readUInt16LE(),D=b.readUInt16LE(),e!==D?d("Number of entries is inconsistent.",t):(e=b.readUInt32LE(),
b=b.readUInt16LE(),b=y-22-e,c(b,y-b,function(a,b){if(a||null===b)d(a,t);else a:{var e=new core.ByteArray(b),c,f;l=[];for(c=0;c<D;c+=1){f=new p(h,e);if(f.error){d(f.error,t);break a}l[l.length]=f}d(null,t)}})))))}}function q(a,d){var b=null,e,c;for(c=0;c<l.length;c+=1)if(e=l[c],e.filename===a){b=e;break}b?b.data?d(null,b.data):b.load(d):d(a+" not found.",null)}function f(a){var d=new core.ByteArrayWriter("utf8"),e=0;d.appendArray([80,75,3,4,20,0,0,0,0,0]);a.data&&(e=a.data.length);d.appendUInt32LE(n(a.date));
d.appendUInt32LE(a.data?b(a.data):0);d.appendUInt32LE(e);d.appendUInt32LE(e);d.appendUInt16LE(a.filename.length);d.appendUInt16LE(0);d.appendString(a.filename);a.data&&d.appendByteArray(a.data);return d}function e(a,d){var e=new core.ByteArrayWriter("utf8"),c=0;e.appendArray([80,75,1,2,20,0,20,0,0,0,0,0]);a.data&&(c=a.data.length);e.appendUInt32LE(n(a.date));e.appendUInt32LE(a.data?b(a.data):0);e.appendUInt32LE(c);e.appendUInt32LE(c);e.appendUInt16LE(a.filename.length);e.appendArray([0,0,0,0,0,0,
0,0,0,0,0,0]);e.appendUInt32LE(d);e.appendString(a.filename);return e}function a(d,b){if(d===l.length)b(null);else{var e=l[d];null!==e.data?a(d+1,b):e.load(function(e){e?b(e):a(d+1,b)})}}function d(d,b){a(0,function(a){if(a)b(a);else{var c,g,r=new core.ByteArrayWriter("utf8"),h=[0];for(c=0;c<l.length;c+=1)r.appendByteArrayWriter(f(l[c])),h.push(r.getLength());a=r.getLength();for(c=0;c<l.length;c+=1)g=l[c],r.appendByteArrayWriter(e(g,h[c]));c=r.getLength()-a;r.appendArray([80,75,5,6,0,0,0,0]);r.appendUInt16LE(l.length);
r.appendUInt16LE(l.length);r.appendUInt32LE(c);r.appendUInt32LE(a);r.appendArray([0,0]);d(r.getByteArray())}})}function r(a,b){d(function(d){runtime.writeFile(a,d,function(a){a||(B=d,y=B.length);b(a)})},b)}var l,B,y,D,z=core.RawInflate.inflate,t=this,x=new core.Base64;this.load=q;this.save=function(a,d,b,e){var c,f;for(c=0;c<l.length;c+=1)if(f=l[c],f.filename===a){f.set(a,d,b,e);return}f=new p(h);f.set(a,d,b,e);l.push(f)};this.remove=function(a){var d,b;for(d=0;d<l.length;d+=1)if(b=l[d],b.filename===
a)return l.splice(d,1),!0;return!1};this.write=function(a){r(h,a)};this.writeAs=r;this.createByteArray=d;this.loadContentXmlAsFragments=function(a,d){t.loadAsString(a,function(a,b){if(a)return d.rootElementReady(a);d.rootElementReady(null,b,!0)})};this.loadAsString=function(a,d){q(a,function(a,b){if(a||null===b)return d(a,null);var e=runtime.byteArrayToString(b,"utf8");d(null,e)})};this.loadAsDOM=function(a,d){t.loadAsString(a,function(a,b){if(a||null===b)d(a,null);else{var e=(new DOMParser).parseFromString(b,
"text/xml");d(null,e)}})};this.loadAsDataURL=function(a,d,b){q(a,function(a,e){if(a||!e)return b(a,null);var c=0,l;d||(d=80===e[1]&&78===e[2]&&71===e[3]?"image/png":255===e[0]&&216===e[1]&&255===e[2]?"image/jpeg":71===e[0]&&73===e[1]&&70===e[2]?"image/gif":"");for(l="data:"+d+";base64,";c<e.length;)l+=x.convertUTF8ArrayToBase64(e.subarray(c,Math.min(c+45E3,e.length))),c+=45E3;b(null,l)})};this.getEntries=function(){return l.slice()};y=-1;null===k?l=[]:runtime.readFile(h,"binary",function(a,d){"string"===
typeof d&&(a="file was read as a string. Should be Uint8Array.");a||!d||0===d.length?k("File '"+h+"' cannot be read. Err: "+(a||"[none]"),t):(B=d,y=B.length,c(y-22,22,function(a,d){a||null===d?k(a,t):m(d,k)}))})};core.SimpleClientRect=null;gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}};gui.SessionConstraints=function(){function h(b){k.hasOwnProperty(b)||(k[b]=!1,c.register(b))}var k={},c=new core.EventNotifier;this.registerConstraint=h;this.subscribe=function(b,g){h(b);c.subscribe(b,g)};this.unsubscribe=function(b,g){c.unsubscribe(b,g)};this.setState=function(b,g){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==g&&(k[b]=g,c.emit(b,g))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}};gui.BlacklistNamespaceNodeFilter=function(h){var k={},c=NodeFilter.FILTER_REJECT,b=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(g){return!g||k.hasOwnProperty(g.namespaceURI)?c:b};(function(){h.forEach(function(b){k[b]=!0})})()};odf.Namespaces={namespaceMap:{config:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",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",math:"http://www.w3.org/1998/Math/MathML",
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",xforms:"http://www.w3.org/2002/xforms",
xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},configns:"urn:oasis:names:tc:opendocument:xmlns:config:1.0",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",
mathns:"http://www.w3.org/1998/Math/MathML",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",
xformsns:"http://www.w3.org/2002/xforms",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"};(function(){var h=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,c;for(c in h)h.hasOwnProperty(c)&&(k[h[c]]=c)})();odf.Namespaces.forEachPrefix=function(h){var k=odf.Namespaces.namespaceMap,c;for(c in k)k.hasOwnProperty(c)&&h(c,k[c])};
odf.Namespaces.lookupNamespaceURI=function(h){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(h)&&(k=odf.Namespaces.namespaceMap[h]);return k};odf.Namespaces.lookupPrefix=function(h){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(h)?k[h]:null};odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI;(function(){odf.OdfSchemaImpl=function(){var h=[["config:config-item","uncategorized"],["form:item","object"],["form:option","uncategorized"],["math:math","field"],["meta:user-defined","uncategorized"],["number:currency-symbol","uncategorized"],["number:embedded-text","uncategorized"],["number:text","uncategorized"],["presentation:date-time-decl","uncategorized"],["presentation:footer-decl","uncategorized"],["presentation:header-decl","uncategorized"],["svg:desc","text"],["svg:title","text"],["table:desc",
"uncategorized"],["table:title","uncategorized"],["text:a","text"],["text:author-initials","field"],["text:author-name","field"],["text:bibliography-mark","field"],["text:bookmark-ref","field"],["text:chapter","field"],["text:character-count","field"],["text:conditional-text","field"],["text:creation-date","field"],["text:creation-time","field"],["text:creator","field"],["text:database-display","field"],["text:database-name","field"],["text:database-row-number","field"],["text:date","field"],["text:dde-connection",
"field"],["text:description","field"],["text:editing-cycles","field"],["text:editing-duration","field"],["text:execute-macro","uncategorized"],["text:expression","uncategorized"],["text:file-name","field"],["text:h","text"],["text:hidden-paragraph","text"],["text:hidden-text","text"],["text:image-count","field"],["text:index-entry-span","uncategorized"],["text:index-title-template","uncategorized"],["text:initial-creator","field"],["text:keywords","field"],["text:linenumbering-separator","style"],
["text:measure","uncategorized"],["text:meta","uncategorized"],["text:meta-field","uncategorized"],["text:modification-date","field"],["text:modification-time","field"],["text:note-citation","field"],["text:note-continuation-notice-backward","style"],["text:note-continuation-notice-forward","style"],["text:note-ref","field"],["text:object-count","field"],["text:p","text"],["text:page-continuation","uncategorized"],["text:page-count","field"],["text:page-number","field"],["text:page-variable-get",
"field"],["text:page-variable-set","field"],["text:paragraph-count","field"],["text:placeholder","field"],["text:print-date","field"],["text:print-time","field"],["text:printed-by","field"],["text:reference-ref","field"],["text:ruby-base","text"],["text:ruby-text","text"],["text:script","text"],["text:sender-city","field"],["text:sender-company","field"],["text:sender-country","field"],["text:sender-email","field"],["text:sender-fax","field"],["text:sender-firstname","field"],["text:sender-initials",
"field"],["text:sender-lastname","field"],["text:sender-phone-private","field"],["text:sender-phone-work","field"],["text:sender-position","field"],["text:sender-postal-code","field"],["text:sender-state-or-province","field"],["text:sender-street","field"],["text:sender-title","field"],["text:sequence","uncategorized"],["text:sequence-ref","uncategorized"],["text:sheet-name","uncategorized"],["text:span","text"],["text:subject","field"],["text:table-count","field"],["text:table-formula","deprecated"],
["text:template-name","uncategorized"],["text:text-input","field"],["text:time","field"],["text:title","field"],["text:user-defined","field"],["text:user-field-get","field"],["text:user-field-input","field"],["text:variable-get","field"],["text:variable-input","field"],["text:variable-set","field"],["text:word-count","field"],["xforms:model","uncategorized"]],k={};this.isTextContainer=function(c,b){return"text"===k[c+":"+b]};this.isField=function(c,b){return"field"===k[c+":"+b]};this.getFields=function(){return h.filter(function(c){return"field"===
c[1]}).map(function(c){return c[0]})};(function(){h.forEach(function(c){var b=c[1],g=c[0].split(":");c=g[0];var g=g[1],h=odf.Namespaces.lookupNamespaceURI(c);h?k[h+":"+g]=b:runtime.log("DEBUG: OdfSchema - unknown prefix '"+c+"'")})})()};odf.OdfSchema=new odf.OdfSchemaImpl})();odf.OdfUtilsImpl=function(){function h(a){return"image"===(a&&a.localName)&&a.namespaceURI===I}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===I&&"as-char"===a.getAttributeNS(C,"anchor-type")}function c(a){var d;(d="annotation"===(a&&a.localName)&&a.namespaceURI===odf.Namespaces.officens)||(d="div"===(a&&a.localName)&&"annotationWrapper"===a.className);return d}function b(a){return"a"===(a&&a.localName)&&a.namespaceURI===C}function g(a){var d=
a&&a.localName;return("p"===d||"h"===d)&&a.namespaceURI===C}function n(a,d){for(a&&void 0!==d&&!g(a)&&a.childNodes.item(d)&&(a=a.childNodes.item(d));a&&!g(a);)a=a.parentNode;return a}function p(a,d){for(;a&&a!==d;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function m(a){return/^[ \t\r\n]+$/.test(a)}function q(a){if(null===a||a.nodeType!==Node.ELEMENT_NODE)return!1;var d=a.localName;return ca.isTextContainer(a.namespaceURI,d)||"span"===
d&&"webodf-annotationHighlight"===a.className}function f(a){return null===a||a.nodeType!==Node.ELEMENT_NODE?!1:ca.isField(a.namespaceURI,a.localName)}function e(a){var d=a&&a.localName,b=!1;d&&(a=a.namespaceURI,a===C&&(b="s"===d||"tab"===d||"line-break"===d));return b}function a(a){return e(a)||f(a)||k(a)||c(a)}function d(a){var d=a&&a.localName,b=!1;d&&(a=a.namespaceURI,a===C&&(b="s"===d));return b}function r(a){return-1!==T.indexOf(a.namespaceURI)}function l(a){if(e(a)||f(a))return!1;if(q(a.parentNode)&&
a.nodeType===Node.TEXT_NODE)return 0===a.textContent.length;for(a=a.firstChild;a;){if(r(a)||!l(a))return!1;a=a.nextSibling}return!0}function B(a){for(;null!==a.firstChild&&q(a);)a=a.firstChild;return a}function y(a){for(;null!==a.lastChild&&q(a);)a=a.lastChild;return a}function D(a){for(;!g(a)&&null===a.previousSibling;)a=a.parentNode;return g(a)?null:y(a.previousSibling)}function z(a){for(;!g(a)&&null===a.nextSibling;)a=a.parentNode;return g(a)?null:B(a.nextSibling)}function t(b){for(var e=!1;b;)if(b.nodeType===
Node.TEXT_NODE)if(0===b.length)b=D(b);else return!m(b.data.substr(b.length-1,1));else a(b)?(e=!1===d(b),b=null):b=D(b);return e}function x(d){var b=!1,e;for(d=d&&B(d);d;){e=d.nodeType===Node.TEXT_NODE?d.length:0;if(0<e&&!m(d.data)){b=!0;break}if(a(d)){b=!0;break}d=z(d)}return b}function w(a,d){return m(a.data.substr(d))?!x(z(a)):!1}function F(d,b){var e=d.data,c;if(!m(e[b])||a(d.parentNode))return!1;0<b?m(e[b-1])||(c=!0):t(D(d))&&(c=!0);return!0===c?w(d,b)?!1:!0:!1}function L(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 H(a){return(a=L(a))&&(0>a.value||"%"===a.unit)?null:a}function G(a){return(a=L(a))&&"%"!==a.unit?null:a}function A(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 K(a){return Boolean(n(a)&&(!m(a.textContent)||F(a,0)))}function v(a,d){for(;0<d.length&&!U.rangeContainsNode(a,d[0]);)d.shift();for(;0<d.length&&!U.rangeContainsNode(a,d[d.length-1]);)d.pop()}function u(d,b,l){var g;g=U.getNodesInRange(d,function(d){var b=NodeFilter.FILTER_REJECT;if(e(d.parentNode)||f(d.parentNode)||c(d))b=NodeFilter.FILTER_REJECT;else if(d.nodeType===Node.TEXT_NODE){if(l||K(d))b=NodeFilter.FILTER_ACCEPT}else if(a(d))b=NodeFilter.FILTER_ACCEPT;else if(A(d)||q(d))b=NodeFilter.FILTER_SKIP;
return b},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);b||v(d,g);return g}function Q(a,d,b){for(;a;){if(b(a)){d[0]!==a&&d.unshift(a);break}if(c(a))break;a=a.parentNode}}function R(a,d){var b=a;if(d<b.childNodes.length-1)b=b.childNodes[d+1];else{for(;!b.nextSibling;)b=b.parentNode;b=b.nextSibling}for(;b.firstChild;)b=b.firstChild;return b}var C=odf.Namespaces.textns,I=odf.Namespaces.drawns,P=odf.Namespaces.xlinkns,U=core.DomUtils,T=[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],ca=odf.OdfSchema;this.isImage=h;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(P,"href")||""};this.isParagraph=g;this.getParagraphElement=
n;this.getParentAnnotation=p;this.isWithinAnnotation=function(a,d){return Boolean(p(a,d))};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=m;this.isGroupingElement=q;this.isFieldElement=f;this.isCharacterElement=e;this.isAnchoredAsCharacterElement=
a;this.isSpaceElement=d;this.isODFNode=r;this.hasNoODFContent=l;this.firstChild=B;this.lastChild=y;this.previousNode=D;this.nextNode=z;this.scanLeftForNonSpace=t;this.lookLeftForCharacter=function(d){var b,e=b=0;d.nodeType===Node.TEXT_NODE&&(e=d.length);0<e?(b=d.data,b=m(b.substr(e-1,1))?1===e?t(D(d))?2:0:m(b.substr(e-2,1))?0:2:1):a(d)&&(b=1);return b};this.lookRightForCharacter=function(d){var b=!1,e=0;d&&d.nodeType===Node.TEXT_NODE&&(e=d.length);0<e?b=!m(d.data.substr(0,1)):a(d)&&(b=!0);return b};
this.scanLeftForAnyCharacter=function(d){var b=!1,e;for(d=d&&y(d);d;){e=d.nodeType===Node.TEXT_NODE?d.length:0;if(0<e&&!m(d.data)){b=!0;break}if(a(d)){b=!0;break}d=D(d)}return b};this.scanRightForAnyCharacter=x;this.isTrailingWhitespace=w;this.isSignificantWhitespace=F;this.isDowngradableSpaceElement=function(a){return d(a)?t(D(a))&&x(z(a)):!1};this.parseLength=L;this.parseNonNegativeLength=H;this.parseFoFontSize=function(a){var d;d=(d=L(a))&&(0>=d.value||"%"===d.unit)?null:d;return d||G(a)};this.parseFoLineHeight=
function(a){return H(a)||G(a)};this.isTextContentContainingNode=A;this.getTextNodes=function(a,d){var b;b=U.getNodesInRange(a,function(a){var d=NodeFilter.FILTER_REJECT;a.nodeType===Node.TEXT_NODE?K(a)&&(d=NodeFilter.FILTER_ACCEPT):A(a)&&(d=NodeFilter.FILTER_SKIP);return d},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);d||v(a,b);return b};this.getTextElements=u;this.getParagraphElements=function(a){var d;d=U.getNodesInRange(a,function(a){var d=NodeFilter.FILTER_REJECT;if(g(a))d=NodeFilter.FILTER_ACCEPT;
else if(A(a)||q(a))d=NodeFilter.FILTER_SKIP;return d},NodeFilter.SHOW_ELEMENT);Q(a.startContainer,d,g);return d};this.getImageElements=function(a){var d;d=U.getNodesInRange(a,function(a){var d=NodeFilter.FILTER_SKIP;h(a)&&(d=NodeFilter.FILTER_ACCEPT);return d},NodeFilter.SHOW_ELEMENT);Q(a.startContainer,d,h);return d};this.getHyperlinkElements=function(a){var d=[],e=a.cloneRange();a.collapsed&&a.endContainer.nodeType===Node.ELEMENT_NODE&&(a=R(a.endContainer,a.endOffset),a.nodeType===Node.TEXT_NODE&&
e.setEnd(a,1));u(e,!0,!1).forEach(function(a){for(a=a.parentNode;!g(a);){if(b(a)&&-1===d.indexOf(a)){d.push(a);break}a=a.parentNode}});e.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}};odf.OdfUtils=new odf.OdfUtilsImpl;gui.OdfTextBodyNodeFilter=function(){var h=odf.OdfUtils,k=Node.TEXT_NODE,c=NodeFilter.FILTER_REJECT,b=NodeFilter.FILTER_ACCEPT,g=odf.Namespaces.textns;this.acceptNode=function(n){if(n.nodeType===k){if(!h.isGroupingElement(n.parentNode))return c}else if(n.namespaceURI===g&&"tracked-changes"===n.localName)return c;return b}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(h){};odf.OdfNodeFilter=function(){this.acceptNode=function(h){return"http://www.w3.org/1999/xhtml"===h.namespaceURI?NodeFilter.FILTER_SKIP:h.namespaceURI&&h.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};
function createXPathSingleton(){function h(b,a,d){return-1!==b&&(b<a||-1===a)&&(b<d||-1===d)}function k(b){for(var a=[],d=0,c=b.length,l;d<c;){var g=b,n=c,m=a,k="",p=[],q=g.indexOf("[",d),w=g.indexOf("/",d),F=g.indexOf("=",d);h(w,q,F)?(k=g.substring(d,w),d=w+1):h(q,w,F)?(k=g.substring(d,q),d=f(g,q,p)):h(F,w,q)?(k=g.substring(d,F),d=F):(k=g.substring(d,n),d=n);m.push({location:k,predicates:p});if(d<c&&"="===b[d]){l=b.substring(d+1,c);if(2<l.length&&("'"===l[0]||'"'===l[0]))l=l.slice(1,l.length-1);
else try{l=parseInt(l,10)}catch(L){}d=c}}return{steps:a,value:l}}function c(){var b=null,a=!1;this.setNode=function(a){b=a};this.reset=function(){a=!1};this.next=function(){var d=a?null:b;a=!0;return d}}function b(b,a,d){this.reset=function(){b.reset()};this.next=function(){for(var c=b.next();c;){c.nodeType===Node.ELEMENT_NODE&&(c=c.getAttributeNodeNS(a,d));if(c)break;c=b.next()}return c}}function g(b,a){var d=b.next(),c=null;this.reset=function(){b.reset();d=b.next();c=null};this.next=function(){for(;d;){if(c)if(a&&
c.firstChild)c=c.firstChild;else{for(;!c.nextSibling&&c!==d;)c=c.parentNode;c===d?d=b.next():c=c.nextSibling}else{do(c=d.firstChild)||(d=b.next());while(d&&!c)}if(c&&c.nodeType===Node.ELEMENT_NODE)return c}return null}}function n(b,a){this.reset=function(){b.reset()};this.next=function(){for(var d=b.next();d&&!a(d);)d=b.next();return d}}function p(b,a,d){a=a.split(":",2);var c=d(a[0]),l=a[1];return new n(b,function(a){return a.localName===l&&a.namespaceURI===c})}function m(b,a,d){var f=new c,l=q(f,
a,d),g=a.value;return void 0===g?new n(b,function(a){f.setNode(a);l.reset();return null!==l.next()}):new n(b,function(a){f.setNode(a);l.reset();return(a=l.next())?a.nodeValue===g:!1})}var q,f;f=function(b,a,d){for(var c=a,l=b.length,f=0;c<l;)"]"===b[c]?(--f,0>=f&&d.push(k(b.substring(a,c)))):"["===b[c]&&(0>=f&&(a=c+1),f+=1),c+=1;return c};q=function(e,a,d){var c,l,f,h;for(c=0;c<a.steps.length;c+=1){f=a.steps[c];l=f.location;if(""===l)e=new g(e,!1);else if("@"===l[0]){l=l.substr(1).split(":",2);h=
d(l[0]);if(!h)throw"No namespace associated with the prefix "+l[0];e=new b(e,h,l[1])}else"."!==l&&(e=new g(e,!1),-1!==l.indexOf(":")&&(e=p(e,l,d)));for(l=0;l<f.predicates.length;l+=1)h=f.predicates[l],e=m(e,h,d)}return e};return{getODFElementsWithXPath:function(b,a,d){var f=b.ownerDocument,l=[],g=null;if(f&&"function"===typeof f.evaluate)for(d=f.evaluate(a,b,d,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null),g=d.iterateNext();null!==g;)g.nodeType===Node.ELEMENT_NODE&&l.push(g),g=d.iterateNext();else{l=
new c;l.setNode(b);b=k(a);l=q(l,b,d);b=[];for(d=l.next();d;)b.push(d),d=l.next();l=b}return l}}}xmldom.XPath=createXPathSingleton();odf.StyleInfo=function(){function h(a,d){var b,e,c,l,f,g=0;if(b=H[a.localName])if(c=b[a.namespaceURI])g=c.length;for(b=0;b<g;b+=1)e=c[b],l=e.ns,f=e.localname,(e=a.getAttributeNS(l,f))&&a.setAttributeNS(l,F[l]+f,d+e);for(c=a.firstElementChild;c;)h(c,d),c=c.nextElementSibling}function k(a,d){var b,e,c,l,f,g=0;if(b=H[a.localName])if(c=b[a.namespaceURI])g=c.length;for(b=0;b<g;b+=1)if(e=c[b],l=e.ns,f=e.localname,e=a.getAttributeNS(l,f))e=e.replace(d,""),a.setAttributeNS(l,F[l]+f,e);for(c=a.firstElementChild;c;)k(c,
d),c=c.nextElementSibling}function c(a,d){var b,e,c,l,f,g=0;if(b=H[a.localName])if(c=b[a.namespaceURI])g=c.length;for(b=0;b<g;b+=1)if(l=c[b],e=l.ns,f=l.localname,e=a.getAttributeNS(e,f))d=d||{},l=l.keyname,d.hasOwnProperty(l)?d[l][e]=1:(f={},f[e]=1,d[l]=f);return d}function b(a,d){var e,l;c(a,d);for(e=a.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&(l=e,b(l,d)),e=e.nextSibling}function g(a,d,b){this.key=a;this.name=d;this.family=b;this.requires={}}function n(a,d,b){var e=a+'"'+d,c=b[e];c||(c=b[e]=
new g(e,a,d));return c}function p(a,d,b){var e,c,l,f,g,r=0;e=a.getAttributeNS(t,"name");f=a.getAttributeNS(t,"family");e&&f&&(d=n(e,f,b));if(d){if(e=H[a.localName])if(l=e[a.namespaceURI])r=l.length;for(e=0;e<r;e+=1)if(f=l[e],c=f.ns,g=f.localname,c=a.getAttributeNS(c,g))f=f.keyname,f=n(c,f,b),d.requires[f.key]=f}for(a=a.firstElementChild;a;)p(a,d,b),a=a.nextElementSibling;return b}function m(a,d){var b=d[a.family];b||(b=d[a.family]={});b[a.name]=1;Object.keys(a.requires).forEach(function(b){m(a.requires[b],
d)})}function q(a,d){var b=p(a,null,{});Object.keys(b).forEach(function(a){a=b[a];var e=d[a.family];e&&e.hasOwnProperty(a.name)&&m(a,d)})}function f(a,d){function b(d){(d=l.getAttributeNS(t,d))&&(a[d]=!0)}var e=["font-name","font-name-asian","font-name-complex"],c,l;for(c=d&&d.firstElementChild;c;)l=c,e.forEach(b),f(a,l),c=c.nextElementSibling}function e(a,d){function b(a){var e=f.getAttributeNS(t,a);e&&d.hasOwnProperty(e)&&f.setAttributeNS(t,"style:"+a,d[e])}var c=["font-name","font-name-asian",
"font-name-complex"],l,f;for(l=a&&a.firstElementChild;l;)f=l,c.forEach(b),e(f,d),l=l.nextElementSibling}var a=odf.Namespaces.chartns,d=odf.Namespaces.dbns,r=odf.Namespaces.dr3dns,l=odf.Namespaces.drawns,B=odf.Namespaces.formns,y=odf.Namespaces.numberns,D=odf.Namespaces.officens,z=odf.Namespaces.presentationns,t=odf.Namespaces.stylens,x=odf.Namespaces.tablens,w=odf.Namespaces.textns,F={"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:"},L={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:l,en:"caption",ans:l,a:"text-style-name"},{ens:l,
en:"circle",ans:l,a:"text-style-name"},{ens:l,en:"connector",ans:l,a:"text-style-name"},{ens:l,en:"control",ans:l,a:"text-style-name"},{ens:l,en:"custom-shape",ans:l,a:"text-style-name"},{ens:l,en:"ellipse",ans:l,a:"text-style-name"},{ens:l,en:"frame",ans:l,a:"text-style-name"},{ens:l,en:"line",ans:l,a:"text-style-name"},{ens:l,en:"measure",ans:l,a:"text-style-name"},{ens:l,en:"path",ans:l,a:"text-style-name"},{ens:l,en:"polygon",ans:l,a:"text-style-name"},{ens:l,en:"polyline",ans:l,a:"text-style-name"},
{ens:l,en:"rect",ans:l,a:"text-style-name"},{ens:l,en:"regular-polygon",ans:l,a:"text-style-name"},{ens:D,en:"annotation",ans:l,a:"text-style-name"},{ens:B,en:"column",ans:B,a:"text-style-name"},{ens:t,en:"style",ans:t,a:"next-style-name"},{ens:x,en:"body",ans:x,a:"paragraph-style-name"},{ens:x,en:"even-columns",ans:x,a:"paragraph-style-name"},{ens:x,en:"even-rows",ans:x,a:"paragraph-style-name"},{ens:x,en:"first-column",ans:x,a:"paragraph-style-name"},{ens:x,en:"first-row",ans:x,a:"paragraph-style-name"},
{ens:x,en:"last-column",ans:x,a:"paragraph-style-name"},{ens:x,en:"last-row",ans:x,a:"paragraph-style-name"},{ens:x,en:"odd-columns",ans:x,a:"paragraph-style-name"},{ens:x,en:"odd-rows",ans:x,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:a,en:"axis",ans:a,
a:"style-name"},{ens:a,en:"chart",ans:a,a:"style-name"},{ens:a,en:"data-label",ans:a,a:"style-name"},{ens:a,en:"data-point",ans:a,a:"style-name"},{ens:a,en:"equation",ans:a,a:"style-name"},{ens:a,en:"error-indicator",ans:a,a:"style-name"},{ens:a,en:"floor",ans:a,a:"style-name"},{ens:a,en:"footer",ans:a,a:"style-name"},{ens:a,en:"grid",ans:a,a:"style-name"},{ens:a,en:"legend",ans:a,a:"style-name"},{ens:a,en:"mean-value",ans:a,a:"style-name"},{ens:a,en:"plot-area",ans:a,a:"style-name"},{ens:a,en:"regression-curve",
ans:a,a:"style-name"},{ens:a,en:"series",ans:a,a:"style-name"},{ens:a,en:"stock-gain-marker",ans:a,a:"style-name"},{ens:a,en:"stock-loss-marker",ans:a,a:"style-name"},{ens:a,en:"stock-range-line",ans:a,a:"style-name"},{ens:a,en:"subtitle",ans:a,a:"style-name"},{ens:a,en:"title",ans:a,a:"style-name"},{ens:a,en:"wall",ans:a,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:d,en:"query",ans:d,a:"style-name"},{ens:d,en:"table-representation",ans:d,a:"style-name"},{ens:x,en:"background",ans:x,a:"style-name"},{ens:x,en:"table",ans:x,a:"style-name"}],
"table-column":[{ens:d,en:"column",ans:d,a:"style-name"},{ens:x,en:"table-column",ans:x,a:"style-name"}],"table-row":[{ens:d,en:"query",ans:d,a:"default-row-style-name"},{ens:d,en:"table-representation",ans:d,a:"default-row-style-name"},{ens:x,en:"table-row",ans:x,a:"style-name"}],"table-cell":[{ens:d,en:"column",ans:d,a:"default-cell-style-name"},{ens:x,en:"table-column",ans:x,a:"default-cell-style-name"},{ens:x,en:"table-row",ans:x,a:"default-cell-style-name"},{ens:x,en:"body",ans:x,a:"style-name"},
{ens:x,en:"covered-table-cell",ans:x,a:"style-name"},{ens:x,en:"even-columns",ans:x,a:"style-name"},{ens:x,en:"covered-table-cell",ans:x,a:"style-name"},{ens:x,en:"even-columns",ans:x,a:"style-name"},{ens:x,en:"even-rows",ans:x,a:"style-name"},{ens:x,en:"first-column",ans:x,a:"style-name"},{ens:x,en:"first-row",ans:x,a:"style-name"},{ens:x,en:"last-column",ans:x,a:"style-name"},{ens:x,en:"last-row",ans:x,a:"style-name"},{ens:x,en:"odd-columns",ans:x,a:"style-name"},{ens:x,en:"odd-rows",ans:x,a:"style-name"},
{ens:x,en:"table-cell",ans:x,a:"style-name"}],graphic:[{ens:r,en:"cube",ans:l,a:"style-name"},{ens:r,en:"extrude",ans:l,a:"style-name"},{ens:r,en:"rotate",ans:l,a:"style-name"},{ens:r,en:"scene",ans:l,a:"style-name"},{ens:r,en:"sphere",ans:l,a:"style-name"},{ens:l,en:"caption",ans:l,a:"style-name"},{ens:l,en:"circle",ans:l,a:"style-name"},{ens:l,en:"connector",ans:l,a:"style-name"},{ens:l,en:"control",ans:l,a:"style-name"},{ens:l,en:"custom-shape",ans:l,a:"style-name"},{ens:l,en:"ellipse",ans:l,a:"style-name"},
{ens:l,en:"frame",ans:l,a:"style-name"},{ens:l,en:"g",ans:l,a:"style-name"},{ens:l,en:"line",ans:l,a:"style-name"},{ens:l,en:"measure",ans:l,a:"style-name"},{ens:l,en:"page-thumbnail",ans:l,a:"style-name"},{ens:l,en:"path",ans:l,a:"style-name"},{ens:l,en:"polygon",ans:l,a:"style-name"},{ens:l,en:"polyline",ans:l,a:"style-name"},{ens:l,en:"rect",ans:l,a:"style-name"},{ens:l,en:"regular-polygon",ans:l,a:"style-name"},{ens:D,en:"annotation",ans:l,a:"style-name"}],presentation:[{ens:r,en:"cube",ans:z,
a:"style-name"},{ens:r,en:"extrude",ans:z,a:"style-name"},{ens:r,en:"rotate",ans:z,a:"style-name"},{ens:r,en:"scene",ans:z,a:"style-name"},{ens:r,en:"sphere",ans:z,a:"style-name"},{ens:l,en:"caption",ans:z,a:"style-name"},{ens:l,en:"circle",ans:z,a:"style-name"},{ens:l,en:"connector",ans:z,a:"style-name"},{ens:l,en:"control",ans:z,a:"style-name"},{ens:l,en:"custom-shape",ans:z,a:"style-name"},{ens:l,en:"ellipse",ans:z,a:"style-name"},{ens:l,en:"frame",ans:z,a:"style-name"},{ens:l,en:"g",ans:z,a:"style-name"},
{ens:l,en:"line",ans:z,a:"style-name"},{ens:l,en:"measure",ans:z,a:"style-name"},{ens:l,en:"page-thumbnail",ans:z,a:"style-name"},{ens:l,en:"path",ans:z,a:"style-name"},{ens:l,en:"polygon",ans:z,a:"style-name"},{ens:l,en:"polyline",ans:z,a:"style-name"},{ens:l,en:"rect",ans:z,a:"style-name"},{ens:l,en:"regular-polygon",ans:z,a:"style-name"},{ens:D,en:"annotation",ans:z,a:"style-name"}],"drawing-page":[{ens:l,en:"page",ans:l,a:"style-name"},{ens:z,en:"notes",ans:l,a:"style-name"},{ens:t,en:"handout-master",
ans:l,a:"style-name"},{ens:t,en:"master-page",ans:l,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:z,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:z,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"}]},H,G=xmldom.XPath;this.collectUsedFontFaces=f;this.changeFontFaceNames=e;this.UsedStyleList=function(a,d){var e={};this.uses=function(a){var d=a.localName,b=a.getAttributeNS(l,"name")||a.getAttributeNS(t,"name");a="style"===d?a.getAttributeNS(t,"family"):a.namespaceURI===y?"data":d;return(a=e[a])?0<a[b]:!1};b(a,e);d&&q(d,e)};this.getStyleName=function(a,d){var b,e,c=H[d.localName];if(c&&(c=c[d.namespaceURI]))for(e=0;e<c.length;e+=
1)if(c[e].keyname===a&&(c=c[e],d.hasAttributeNS(c.ns,c.localname))){b=d.getAttributeNS(c.ns,c.localname);break}return b};this.hasDerivedStyles=function(a,d,b){var e=b.getAttributeNS(t,"name");b=b.getAttributeNS(t,"family");return G.getODFElementsWithXPath(a,'//style:*[@style:parent-style-name="'+e+'"][@style:family="'+b+'"]',d).length?!0:!1};this.prefixStyleNames=function(a,d,b){var e;if(a){for(e=a.firstChild;e;){if(e.nodeType===Node.ELEMENT_NODE){var c=e,f=d,g=c.getAttributeNS(l,"name"),r=void 0;
g?r=l:(g=c.getAttributeNS(t,"name"))&&(r=t);r&&c.setAttributeNS(r,F[r]+"name",f+g)}e=e.nextSibling}h(a,d);b&&h(b,d)}};this.removePrefixFromStyleNames=function(a,d,b){var e=new RegExp("^"+d);if(a){for(d=a.firstChild;d;){if(d.nodeType===Node.ELEMENT_NODE){var c=d,f=e,g=c.getAttributeNS(l,"name"),r=void 0;g?r=l:(g=c.getAttributeNS(t,"name"))&&(r=t);r&&(g=g.replace(f,""),c.setAttributeNS(r,F[r]+"name",g))}d=d.nextSibling}k(a,e);b&&k(b,e)}};this.determineStylesForNode=c;H=function(){var a,d,b,e,c,l={},
f,g,r,h;for(b in L)if(L.hasOwnProperty(b))for(e=L[b],d=e.length,a=0;a<d;a+=1)c=e[a],r=c.en,h=c.ens,l.hasOwnProperty(r)?f=l[r]:l[r]=f={},f.hasOwnProperty(h)?g=f[h]:f[h]=g=[],g.push({ns:c.ans,localname:c.a,keyname:b});return l}()};"function"!==typeof Object.create&&(Object.create=function(h){var k=function(){};k.prototype=h;return new k});
xmldom.LSSerializer=function(){function h(b){var c=b||{},h=function(b){var a={},d;for(d in b)b.hasOwnProperty(d)&&(a[b[d]]=d);return a}(b),m=[c],k=[h],f=0;this.push=function(){f+=1;c=m[f]=Object.create(c);h=k[f]=Object.create(h)};this.pop=function(){m.pop();k.pop();--f;c=m[f];h=k[f]};this.getLocalNamespaceDefinitions=function(){return h};this.getQName=function(b){var a=b.namespaceURI,d=0,f;if(!a)return b.localName;if(f=h[a])return f+":"+b.localName;do{f||!b.prefix?(f="ns"+d,d+=1):f=b.prefix;if(c[f]===
a)break;if(!c[f]){c[f]=a;h[a]=f;break}f=null}while(null===f);return f+":"+b.localName}}function k(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")}function c(g,h){var p="",m=b.filter?b.filter.acceptNode(h):NodeFilter.FILTER_ACCEPT,q;if(m===NodeFilter.FILTER_ACCEPT&&h.nodeType===Node.ELEMENT_NODE){g.push();q=g.getQName(h);var f,e=h.attributes,a,d,r,l="",B;f="<"+q;a=e.length;for(d=0;d<a;d+=1)r=e.item(d),"http://www.w3.org/2000/xmlns/"!==
r.namespaceURI&&(B=b.filter?b.filter.acceptNode(r):NodeFilter.FILTER_ACCEPT,B===NodeFilter.FILTER_ACCEPT&&(B=g.getQName(r),r="string"===typeof r.value?k(r.value):r.value,l+=" "+(B+'="'+r+'"')));a=g.getLocalNamespaceDefinitions();for(d in a)a.hasOwnProperty(d)&&((e=a[d])?"xmlns"!==e&&(f+=" xmlns:"+a[d]+'="'+d+'"'):f+=' xmlns="'+d+'"');p+=f+(l+">")}if(m===NodeFilter.FILTER_ACCEPT||m===NodeFilter.FILTER_SKIP){for(m=h.firstChild;m;)p+=c(g,m),m=m.nextSibling;h.nodeValue&&(p+=k(h.nodeValue))}q&&(p+="</"+
q+">",g.pop());return p}var b=this;this.filter=null;this.writeToString=function(b,n){if(!b)return"";var k=new h(n);return c(k,b)}};(function(){function h(b){var a,d=m.length;for(a=0;a<d;a+=1)if("urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&b.localName===m[a])return a;return-1}function k(b,a){var d=new g.UsedStyleList(b,a),c=new odf.OdfNodeFilter;this.acceptNode=function(b){var e=c.acceptNode(b);e===NodeFilter.FILTER_ACCEPT&&b.parentNode===a&&b.nodeType===Node.ELEMENT_NODE&&(e=d.uses(b)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);return e}}function c(b,a){var d=new k(b,a);this.acceptNode=function(a){var b=
d.acceptNode(a);b!==NodeFilter.FILTER_ACCEPT||!a.parentNode||a.parentNode.namespaceURI!==odf.Namespaces.textns||"s"!==a.parentNode.localName&&"tab"!==a.parentNode.localName||(b=NodeFilter.FILTER_REJECT);return b}}function b(b,a){if(a){var d=h(a),c,f=b.firstChild;if(-1!==d){for(;f;){c=h(f);if(-1!==c&&c>d)break;f=f.nextSibling}b.insertBefore(a,f)}}}var g=new odf.StyleInfo,n=core.DomUtils,p=odf.Namespaces.stylens,m="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),
q=Date.now()+"_webodf_",f=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,a,d,c){var f=this;this.size=0;this.type=null;this.name=b;this.container=d;this.url=null;this.mimetype=a;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=a,c.loadAsDataURL(b,a,function(a,d){a&&runtime.log(a);f.url=d;if(f.onchange)f.onchange(f);if(f.onstatereadychange)f.onstatereadychange(f)}))}};odf.OdfPart.prototype.load=function(){};
odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+f.toBase64(this.data):null};odf.OdfContainer=function a(d,r){function l(a){for(var d=a.firstChild,b;d;)b=d.nextSibling,d.nodeType===Node.ELEMENT_NODE?l(d):d.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(d),d=b}function h(a){var d={},b,c,f=a.ownerDocument.createNodeIterator(a,NodeFilter.SHOW_ELEMENT,null,!1);for(a=f.nextNode();a;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&("annotation"===
a.localName?(b=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(d.hasOwnProperty(b)?runtime.log("Warning: annotation name used more than once with <office:annotation/>: '"+b+"'"):d[b]=a):"annotation-end"===a.localName&&((b=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?d.hasOwnProperty(b)?(c=d[b],c.annotationEndElement?runtime.log("Warning: annotation name used more than once with <office:annotation-end/>: '"+b+"'"):c.annotationEndElement=
a):runtime.log("Warning: annotation end without an annotation start, name: '"+b+"'"):runtime.log("Warning: annotation end without a name found"))),a=f.nextNode()}function m(a,d){for(var b=a&&a.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&b.setAttributeNS("urn:webodf:names:scope","scope",d),b=b.nextSibling}function D(a,d){for(var b=J.rootElement.meta,b=b&&b.firstChild;b&&(b.namespaceURI!==a||b.localName!==d);)b=b.nextSibling;for(b=b&&b.firstChild;b&&b.nodeType!==Node.TEXT_NODE;)b=b.nextSibling;return b?
b.data:null}function z(a){var d={},b;for(a=a.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&a.namespaceURI===p&&"font-face"===a.localName&&(b=a.getAttributeNS(p,"name"),d[b]=a),a=a.nextSibling;return d}function t(a,d){var b=null,c,f,l;if(a)for(b=a.cloneNode(!0),c=b.firstElementChild;c;)f=c.nextElementSibling,(l=c.getAttributeNS("urn:webodf:names:scope","scope"))&&l!==d&&b.removeChild(c),c=f;return b}function x(a,d){var b,c,f,l=null,r={};if(a)for(d.forEach(function(a){g.collectUsedFontFaces(r,a)}),
l=a.cloneNode(!0),b=l.firstElementChild;b;)c=b.nextElementSibling,f=b.getAttributeNS(p,"name"),r[f]||l.removeChild(b),b=c;return l}function w(a){var d=J.rootElement.ownerDocument,b;if(a){l(a.documentElement);try{b=d.importNode(a.documentElement,!0)}catch(c){}}return b}function F(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function L(a){V=null;J.rootElement=a;a.fontFaceDecls=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");
a.styles=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");a.automaticStyles=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");a.masterStyles=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");a.body=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");a.meta=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");a.settings=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"settings");a.scripts=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");h(a)}function H(d){var c=w(d),f=J.rootElement,l;c&&"document-styles"===c.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===c.namespaceURI?(f.fontFaceDecls=n.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),b(f,f.fontFaceDecls),l=n.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),f.styles=l||d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"styles"),b(f,f.styles),l=n.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),f.automaticStyles=l||d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),m(f.automaticStyles,"document-styles"),b(f,f.automaticStyles),c=n.getDirectChild(c,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),f.masterStyles=c||d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),b(f,f.masterStyles),
g.prefixStyleNames(f.automaticStyles,q,f.masterStyles)):F(a.INVALID)}function G(d){d=w(d);var c,f,l,r;if(d&&"document-content"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI){c=J.rootElement;l=n.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(c.fontFaceDecls&&l){r=c.fontFaceDecls;var h,v,u,k,q={};f=z(r);k=z(l);for(l=l.firstElementChild;l;){h=l.nextElementSibling;if(l.namespaceURI===p&&"font-face"===l.localName)if(v=l.getAttributeNS(p,
"name"),f.hasOwnProperty(v)){if(!l.isEqualNode(f[v])){u=v;for(var A=f,B=k,C=0,R=void 0,R=u=u.replace(/\d+$/,"");A.hasOwnProperty(R)||B.hasOwnProperty(R);)C+=1,R=u+C;u=R;l.setAttributeNS(p,"style:name",u);r.appendChild(l);f[u]=l;delete k[v];q[v]=u}}else r.appendChild(l),f[v]=l,delete k[v];l=h}r=q}else l&&(c.fontFaceDecls=l,b(c,l));f=n.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");m(f,"document-content");r&&g.changeFontFaceNames(f,r);if(c.automaticStyles&&f)for(r=
f.firstChild;r;)c.automaticStyles.appendChild(r),r=f.firstChild;else f&&(c.automaticStyles=f,b(c,f));d=n.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===d)throw"<office:body/> tag is mising.";c.body=d;b(c,c.body)}else F(a.INVALID)}function A(a){a=w(a);var d;a&&"document-meta"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=J.rootElement,d.meta=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),
b(d,d.meta))}function K(a){a=w(a);var d;a&&"document-settings"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(d=J.rootElement,d.settings=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),b(d,d.settings))}function v(a){a=w(a);var d;if(a&&"manifest"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===a.namespaceURI)for(d=J.rootElement,d.manifest=a,a=d.manifest.firstElementChild;a;)"file-entry"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===
a.namespaceURI&&(S[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,d,b){a=n.getElementsByTagName(a,d);var c;for(c=0;c<a.length;c+=1)d=a[c],b.hasOwnProperty(d.namespaceURI)||d.parentNode.removeChild(d)}function Q(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 R(a){var d=a.firstElementChild,b=[],c,f,l,g=a.attributes,r=g.length;for(c=0;c<r;c+=1)l=g.item(c),f=l.localName.substr(0,2).toLowerCase(),null===l.namespaceURI&&"on"===f&&b.push(l);r=b.length;for(c=
0;c<r;c+=1)a.removeAttributeNode(b[c]);for(;d;)R(d),d=d.nextElementSibling}function C(d){var b=d.shift();b?ba.loadAsDOM(b.path,function(c,f){f&&(Q(f),R(f.documentElement));b.handler(f);J.state===a.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),C(d))}):(h(J.rootElement),F(a.DONE))}function I(a){var d="";odf.Namespaces.forEachPrefix(function(a,b){d+=" xmlns:"+a+'="'+b+'"'});return'<?xml version="1.0" encoding="UTF-8"?><office:'+
a+" "+d+' office:version="1.2">'}function P(){var a=new xmldom.LSSerializer,d=I("document-meta");a.filter=new odf.OdfNodeFilter;d+=a.writeToString(J.rootElement.meta,odf.Namespaces.namespaceMap);return d+"</office:document-meta>"}function U(a,d){var b=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");b.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",a);b.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
"manifest:media-type",d);return b}function T(){var a=runtime.parseXML('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"></manifest:manifest>'),d=a.documentElement,b=new xmldom.LSSerializer,c;for(c in S)S.hasOwnProperty(c)&&d.appendChild(U(c,S[c]));b.filter=new odf.OdfNodeFilter;return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'+b.writeToString(a,odf.Namespaces.namespaceMap)}function ca(){var a,d,b,c=odf.Namespaces.namespaceMap,
f=new xmldom.LSSerializer,l=I("document-styles");d=t(J.rootElement.automaticStyles,"document-styles");b=J.rootElement.masterStyles.cloneNode(!0);a=x(J.rootElement.fontFaceDecls,[b,J.rootElement.styles,d]);g.removePrefixFromStyleNames(d,q,b);f.filter=new k(b,d);l+=f.writeToString(a,c);l+=f.writeToString(J.rootElement.styles,c);l+=f.writeToString(d,c);l+=f.writeToString(b,c);return l+"</office:document-styles>"}function Y(){var a,d,b=odf.Namespaces.namespaceMap,f=new xmldom.LSSerializer,l=I("document-content");
d=t(J.rootElement.automaticStyles,"document-content");a=x(J.rootElement.fontFaceDecls,[d]);f.filter=new c(J.rootElement.body,d);l+=f.writeToString(a,b);l+=f.writeToString(d,b);l+=f.writeToString(J.rootElement.body,b);return l+"</office:document-content>"}function E(d,b){runtime.loadXML(d,function(d,c){if(d)b(d);else if(c){Q(c);R(c.documentElement);var f=w(c);f&&"document"===f.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===f.namespaceURI?(L(f),F(a.DONE)):F(a.INVALID)}else b("No DOM was loaded.")})}
function Z(a,d){var c;c=J.rootElement;var f=c.meta;f||(c.meta=f=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),b(c,f));c=f;a&&n.mapKeyValObjOntoNode(c,a,odf.Namespaces.lookupNamespaceURI);d&&n.removeKeyElementsFromNode(c,d,odf.Namespaces.lookupNamespaceURI)}function da(d,b){function c(a,d){var b;d||(d=a);b=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",d);r[a]=b;r.appendChild(b)}var f=new core.Zip("",null),l="application/vnd.oasis.opendocument."+
d+(!0===b?"-template":""),g=runtime.byteArrayFromString(l,"utf8"),r=J.rootElement,h=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",d);f.save("mimetype",g,!1,new Date);c("meta");c("settings");c("scripts");c("fontFaceDecls","font-face-decls");c("styles");c("automaticStyles","automatic-styles");c("masterStyles","master-styles");c("body");r.body.appendChild(h);S["/"]=l;S["settings.xml"]="text/xml";S["meta.xml"]="text/xml";S["styles.xml"]="text/xml";S["content.xml"]="text/xml";
F(a.DONE);return f}function X(){var a,d=new Date,b="";J.rootElement.settings&&J.rootElement.settings.firstElementChild&&(a=new xmldom.LSSerializer,b=I("document-settings"),a.filter=new odf.OdfNodeFilter,b+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap),b+="</office:document-settings>");(a=b)?(a=runtime.byteArrayFromString(a,"utf8"),ba.save("settings.xml",a,!0,d)):ba.remove("settings.xml");b=runtime.getWindow();a="WebODF/"+webodf.Version;b&&(a=a+" "+b.navigator.userAgent);Z({"meta:generator":a},
null);a=runtime.byteArrayFromString(P(),"utf8");ba.save("meta.xml",a,!0,d);a=runtime.byteArrayFromString(ca(),"utf8");ba.save("styles.xml",a,!0,d);a=runtime.byteArrayFromString(Y(),"utf8");ba.save("content.xml",a,!0,d);a=runtime.byteArrayFromString(T(),"utf8");ba.save("META-INF/manifest.xml",a,!0,d)}function ha(a,d){X();ba.writeAs(a,function(a){d(a)})}var J=this,ba,S={},V,M="";this.onstatereadychange=r;this.state=this.onchange=null;this.getMetadata=D;this.setRootElement=L;this.getContentElement=function(){var a;
V||(a=J.rootElement.body,V=n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||n.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!V)throw"Could not find content element in <office:body/>.";return V};this.getDocumentType=function(){var a=J.getContentElement();return a&&a.localName};this.isTemplate=function(){return"-template"===S["/"].substr(-9)};
this.setIsTemplate=function(a){var d=S["/"],b="-template"===d.substr(-9);a!==b&&(d=a?d+"-template":d.substr(0,d.length-9),S["/"]=d,a=runtime.byteArrayFromString(d,"utf8"),ba.save("mimetype",a,!1,new Date))};this.getPart=function(a){return new odf.OdfPart(a,S[a],J,ba)};this.getPartData=function(a,d){ba.load(a,d)};this.setMetadata=Z;this.incrementEditingCycles=function(){var a=D(odf.Namespaces.metans,"editing-cycles"),a=a?parseInt(a,10):0;isNaN(a)&&(a=0);Z({"meta:editing-cycles":a+1},null);return a+
1};this.createByteArray=function(a,d){X();ba.createByteArray(a,d)};this.saveAs=ha;this.save=function(a){ha(M,a)};this.getUrl=function(){return M};this.setBlob=function(a,d,b){b=f.convertBase64ToByteArray(b);ba.save(a,b,!1,new Date);S.hasOwnProperty(a)&&runtime.log(a+" has been overwritten.");S[a]=d};this.removeBlob=function(a){var d=ba.remove(a);runtime.assert(d,"file is not found: "+a);delete S[a]};this.state=a.LOADING;this.rootElement=function(a){var d=document.createElementNS(a.namespaceURI,a.localName),
b;a=new a.Type;for(b in a)a.hasOwnProperty(b)&&(d[b]=a[b]);return d}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});d===odf.OdfContainer.DocumentType.TEXT?ba=da("text"):d===odf.OdfContainer.DocumentType.TEXT_TEMPLATE?ba=da("text",!0):d===odf.OdfContainer.DocumentType.PRESENTATION?ba=da("presentation"):d===odf.OdfContainer.DocumentType.PRESENTATION_TEMPLATE?ba=da("presentation",!0):d===odf.OdfContainer.DocumentType.SPREADSHEET?
ba=da("spreadsheet"):d===odf.OdfContainer.DocumentType.SPREADSHEET_TEMPLATE?ba=da("spreadsheet",!0):(M=d,ba=new core.Zip(M,function(d,b){ba=b;d?E(M,function(b){d&&(ba.error=d+"\n"+b,F(a.INVALID))}):C([{path:"styles.xml",handler:H},{path:"content.xml",handler:G},{path:"meta.xml",handler:A},{path:"settings.xml",handler:K},{path:"META-INF/manifest.xml",handler:v}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=
5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)}})();odf.OdfContainer.DocumentType={TEXT:1,TEXT_TEMPLATE:2,PRESENTATION:3,PRESENTATION_TEMPLATE:4,SPREADSHEET:5,SPREADSHEET_TEMPLATE:6};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){};
gui.AnnotationViewManager=function(h,k,c,b){function g(d){var b=d.annotationEndElement,c=e.createRange(),f=d.getAttributeNS(odf.Namespaces.officens,"name");b&&(c.setStart(d,d.childNodes.length),c.setEnd(b,0),d=a.getTextNodes(c,!1),d.forEach(function(a){var d;a:{for(d=a.parentNode;d.namespaceURI!==odf.Namespaces.officens||"body"!==d.localName;){if("http://www.w3.org/1999/xhtml"===d.namespaceURI&&"webodf-annotationHighlight"===d.className&&d.getAttribute("annotation")===f){d=!0;break a}d=d.parentNode}d=
!1}d||(d=e.createElement("span"),d.className="webodf-annotationHighlight",d.setAttribute("annotation",f),a.parentNode.replaceChild(d,a),d.appendChild(a))}));c.detach()}function n(a){var b=h.getSizer();a?(c.style.display="inline-block",b.style.paddingRight=d.getComputedStyle(c).width):(c.style.display="none",b.style.paddingRight=0);h.refreshSize()}function p(){f.sort(function(a,d){return 0!==(a.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function m(){var a;for(a=0;a<f.length;a+=
1){var d=f[a],b=d.parentNode,e=b.nextElementSibling,g=e.nextElementSibling,m=b.parentNode,n=0,n=f[f.indexOf(d)-1],k=void 0,d=h.getZoomLevel();b.style.left=(c.getBoundingClientRect().left-m.getBoundingClientRect().left)/d+"px";b.style.width=c.getBoundingClientRect().width/d+"px";e.style.width=parseFloat(b.style.left)-30+"px";n?(k=n.parentNode.getBoundingClientRect(),20>=(m.getBoundingClientRect().top-k.bottom)/d?b.style.top=Math.abs(m.getBoundingClientRect().top-k.bottom)/d+20+"px":b.style.top="0px"):
b.style.top="0px";g.style.left=e.getBoundingClientRect().width/d+"px";var e=g.style,m=g.getBoundingClientRect().left/d,n=g.getBoundingClientRect().top/d,k=b.getBoundingClientRect().left/d,p=b.getBoundingClientRect().top/d,q=0,L=0,q=k-m,q=q*q,L=p-n,L=L*L,m=Math.sqrt(q+L);e.width=m+"px";n=Math.asin((b.getBoundingClientRect().top-g.getBoundingClientRect().top)/(d*parseFloat(g.style.width)));g.style.transform="rotate("+n+"rad)";g.style.MozTransform="rotate("+n+"rad)";g.style.WebkitTransform="rotate("+
n+"rad)";g.style.msTransform="rotate("+n+"rad)"}}function q(a){var d=f.indexOf(a),b=a.parentNode.parentNode;"div"===b.localName&&(b.parentNode.insertBefore(a,b),b.parentNode.removeChild(b));a=a.getAttributeNS(odf.Namespaces.officens,"name");a=e.querySelectorAll('span.webodf-annotationHighlight[annotation="'+a+'"]');for(var c,b=0;b<a.length;b+=1){for(c=a.item(b);c.firstChild;)c.parentNode.insertBefore(c.firstChild,c);c.parentNode.removeChild(c)}-1!==d&&f.splice(d,1);0===f.length&&n(!1)}var f=[],e=
k.ownerDocument,a=odf.OdfUtils,d=runtime.getWindow();runtime.assert(Boolean(d),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=m;this.rehighlightAnnotations=function(){f.forEach(function(a){g(a)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==c.style.display&&0<f.length?(f[f.length-1].parentNode.getBoundingClientRect().bottom-c.getBoundingClientRect().top)/h.getZoomLevel()+"px":null};this.addAnnotations=function(d){0!==
d.length&&(n(!0),d.forEach(function(d){f.push(d);var c=e.createElement("div"),r=e.createElement("div"),h=e.createElement("div"),m=e.createElement("div"),n;c.className="annotationWrapper";c.setAttribute("creator",a.getAnnotationCreator(d));d.parentNode.insertBefore(c,d);r.className="annotationNote";r.appendChild(d);b&&(n=e.createElement("div"),n.className="annotationRemoveButton",r.appendChild(n));h.className="annotationConnector horizontal";m.className="annotationConnector angular";c.appendChild(r);
c.appendChild(h);c.appendChild(m);d.annotationEndElement&&g(d)}),p(),m())};this.forgetAnnotation=q;this.forgetAnnotations=function(){for(;f.length;)q(f[0])}};gui.Viewport=function(){};gui.Viewport.prototype.scrollIntoView=function(h,k){};gui.SingleScrollViewport=function(h){this.scrollIntoView=function(k,c){var b,g,n,p;p=h.offsetHeight-h.clientHeight;n=h.offsetWidth-h.clientWidth;var m=h.getBoundingClientRect();if(k&&m){b=m.left+5;g=m.top+5;n=m.right-(n+5);p=m.bottom-(p+5);if(c||k.top<g)h.scrollTop-=g-k.top;else if(k.top>p||k.bottom>p)h.scrollTop=k.bottom-k.top<=p-g?h.scrollTop+(k.bottom-p):h.scrollTop+(k.top-g);k.left<b?h.scrollLeft-=b-k.left:k.right>n&&(h.scrollLeft=k.right-k.left<=n-b?h.scrollLeft+(k.right-n):h.scrollLeft-(b-k.left))}}};(function(){function h(c,n,k,m,q){var f,e=0,a;for(a in c)if(c.hasOwnProperty(a)){if(e===k){f=a;break}e+=1}f?n.getPartData(c[f].href,function(a,e){if(a)runtime.log(a);else if(e){var l="@font-face { font-family: "+(c[f].family||f)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+b.convertUTF8ArrayToBase64(e)+') format("truetype"); }';try{m.insertRule(l,m.cssRules.length)}catch(B){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(B)+"\nRule: "+l)}}else runtime.log("missing font data for "+
c[f].href);h(c,n,k+1,m,q)}):q&&q()}var k=xmldom.XPath,c=odf.OdfUtils,b=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(b,n){for(var p=b.rootElement.fontFaceDecls;n.cssRules.length;)n.deleteRule(n.cssRules.length-1);if(p){var m={},q,f,e,a;if(p)for(p=k.getODFElementsWithXPath(p,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),q=0;q<p.length;q+=1)f=p[q],e=f.getAttributeNS(odf.Namespaces.stylens,"name"),a=c.getNormalizedFontFamilyName(f.getAttributeNS(odf.Namespaces.svgns,
"font-family")),f=k.getODFElementsWithXPath(f,"svg:font-face-src/svg:font-face-uri",odf.Namespaces.lookupNamespaceURI),0<f.length&&(f=f[0].getAttributeNS(odf.Namespaces.xlinkns,"href"),m[e]={href:f,family:a});h(m,b,0,n)}}}})();odf.Formatting=function(){function h(a){return(a=F[a])?x.mergeObjects({},a):{}}function k(){for(var d=a.rootElement.fontFaceDecls,b={},c,e,d=d&&d.firstElementChild;d;){if(c=d.getAttributeNS(l,"name"))if((e=d.getAttributeNS(r,"font-family"))||0<d.getElementsByTagNameNS(r,"font-face-uri").length)b[c]=e;d=d.nextElementSibling}return b}function c(d){for(var b=a.rootElement.styles.firstElementChild;b;){if(b.namespaceURI===l&&"default-style"===b.localName&&b.getAttributeNS(l,"family")===d)return b;b=b.nextElementSibling}return null}
function b(d,b,c){var e,f,g;c=c||[a.rootElement.automaticStyles,a.rootElement.styles];for(g=0;g<c.length;g+=1)for(e=c[g],e=e.firstElementChild;e;){f=e.getAttributeNS(l,"name");if(e.namespaceURI===l&&"style"===e.localName&&e.getAttributeNS(l,"family")===b&&f===d||"list-style"===b&&e.namespaceURI===B&&"list-style"===e.localName&&f===d||"data"===b&&e.namespaceURI===y&&f===d)return e;e=e.nextElementSibling}return null}function g(a){for(var d,b,c,e,f={},g=a.firstElementChild;g;){if(g.namespaceURI===l)for(c=
f[g.nodeName]={},b=g.attributes,d=0;d<b.length;d+=1)e=b.item(d),c[e.name]=e.value;g=g.nextElementSibling}b=a.attributes;for(d=0;d<b.length;d+=1)e=b.item(d),f[e.name]=e.value;return f}function n(d,e){for(var f=a.rootElement.styles,r,m={},n=d.getAttributeNS(l,"family"),u=d;u;)r=g(u),m=x.mergeObjects(r,m),u=(r=u.getAttributeNS(l,"parent-style-name"))?b(r,n,[f]):null;if(u=c(n))r=g(u),m=x.mergeObjects(r,m);!1!==e&&(r=h(n),m=x.mergeObjects(r,m));return m}function p(b,c){function e(a){Object.keys(a).forEach(function(d){Object.keys(a[d]).forEach(function(a){r+=
"|"+d+":"+a+"|"})})}for(var f=b.nodeType===Node.TEXT_NODE?b.parentNode:b,l,g=[],r="",h=!1;f&&!z.isInlineRoot(f)&&f.parentNode!==a.rootElement;)!h&&z.isGroupingElement(f)&&(h=!0),(l=d.determineStylesForNode(f))&&g.push(l),f=f.parentNode;h&&(g.forEach(e),c&&(c[r]=g));return h?g:void 0}function m(d){var c={orderedStyles:[],styleProperties:{}};d.forEach(function(d){Object.keys(d).forEach(function(e){var f=Object.keys(d[e])[0],g={name:f,family:e,displayName:void 0,isCommonStyle:!1},r;(r=b(f,e))?(e=n(r),
c.styleProperties=x.mergeObjects(e,c.styleProperties),g.displayName=r.getAttributeNS(l,"display-name")||void 0,g.isCommonStyle=r.parentNode===a.rootElement.styles):runtime.log("No style element found for '"+f+"' of family '"+e+"'");c.orderedStyles.push(g)})});return c}function q(a,d){var b={},c=[];d||(d={});a.forEach(function(a){p(a,b)});Object.keys(b).forEach(function(a){d[a]||(d[a]=m(b[a]));c.push(d[a])});return c}function f(d){for(var b=a.rootElement.masterStyles.firstElementChild;b&&(b.namespaceURI!==
l||"master-page"!==b.localName||b.getAttributeNS(l,"name")!==d);)b=b.nextElementSibling;return b}function e(a,d){var b;a&&(b=w.convertMeasure(a,"px"));void 0===b&&d&&(b=w.convertMeasure(d,"px"));return b}var a,d=new odf.StyleInfo,r=odf.Namespaces.svgns,l=odf.Namespaces.stylens,B=odf.Namespaces.textns,y=odf.Namespaces.numberns,D=odf.Namespaces.fons,z=odf.OdfUtils,t=core.DomUtils,x=new core.Utils,w=new core.CSSUnits,F={paragraph:{"style:paragraph-properties":{"fo:text-align":"left"}}};this.getSystemDefaultStyleAttributes=
h;this.setOdfContainer=function(d){a=d};this.getFontMap=k;this.getAvailableParagraphStyles=function(){for(var d=a.rootElement.styles,b,c,e=[],d=d&&d.firstElementChild;d;)"style"===d.localName&&d.namespaceURI===l&&(b=d.getAttributeNS(l,"family"),"paragraph"===b&&(b=d.getAttributeNS(l,"name"),c=d.getAttributeNS(l,"display-name")||b,b&&c&&e.push({name:b,displayName:c}))),d=d.nextElementSibling;return e};this.isStyleUsed=function(b){var c,e=a.rootElement;c=d.hasDerivedStyles(e,odf.Namespaces.lookupNamespaceURI,
b);b=(new d.UsedStyleList(e.styles)).uses(b)||(new d.UsedStyleList(e.automaticStyles)).uses(b)||(new d.UsedStyleList(e.body)).uses(b);return c||b};this.getDefaultStyleElement=c;this.getStyleElement=b;this.getStyleAttributes=g;this.getInheritedStyleAttributes=n;this.getFirstCommonParentStyleNameOrSelf=function(d){var c=a.rootElement.styles,e;if(e=b(d,"paragraph",[a.rootElement.automaticStyles]))if(d=e.getAttributeNS(l,"parent-style-name"),!d)return null;return(e=b(d,"paragraph",[c]))?d:null};this.hasParagraphStyle=
function(a){return Boolean(b(a,"paragraph"))};this.getAppliedStyles=q;this.getAppliedStylesForElement=function(a,d){return q([a],d)[0]};this.updateStyle=function(d,b){var c,e;t.mapObjOntoNode(d,b,odf.Namespaces.lookupNamespaceURI);(c=(c=b["style:text-properties"])&&c["style:font-name"])&&!k().hasOwnProperty(c)&&(e=d.ownerDocument.createElementNS(l,"style:font-face"),e.setAttributeNS(l,"style:name",c),e.setAttributeNS(r,"svg:font-family",c),a.rootElement.fontFaceDecls.appendChild(e))};this.createDerivedStyleObject=
function(d,c,e){var f=b(d,c);runtime.assert(Boolean(f),"No style element found for '"+d+"' of family '"+c+"'");d=f.parentNode===a.rootElement.styles?{"style:parent-style-name":d}:g(f);d["style:family"]=c;x.mergeObjects(d,e);return d};this.getDefaultTabStopDistance=function(){for(var a=c("paragraph"),a=a&&a.firstElementChild,d;a;)a.namespaceURI===l&&"paragraph-properties"===a.localName&&(d=a.getAttributeNS(l,"tab-stop-distance")),a=a.nextElementSibling;d||(d="1.25cm");return z.parseNonNegativeLength(d)};
this.getMasterPageElement=f;this.getContentSize=function(d,c){var g,r,h,m,n,k,p,q,B,x;a:{r=b(d,c);runtime.assert("paragraph"===c||"table"===c,"styleFamily must be either paragraph or table");if(r){if(r=r.getAttributeNS(l,"master-page-name"))(g=f(r))||runtime.log("WARN: No master page definition found for "+r);g||(g=f("Standard"));g||(g=a.rootElement.masterStyles.getElementsByTagNameNS(l,"master-page")[0])||runtime.log("WARN: Document has no master pages defined");if(g)for(r=g.getAttributeNS(l,"page-layout-name"),
h=a.rootElement.automaticStyles.getElementsByTagNameNS(l,"page-layout"),m=0;m<h.length;m+=1)if(g=h.item(m),g.getAttributeNS(l,"name")===r)break a}g=null}g||(g=t.getDirectChild(a.rootElement.styles,l,"default-page-layout"));(g=t.getDirectChild(g,l,"page-layout-properties"))?("landscape"===g.getAttributeNS(l,"print-orientation")?(r="29.7cm",h="21.001cm"):(r="21.001cm",h="29.7cm"),r=e(g.getAttributeNS(D,"page-width"),r),h=e(g.getAttributeNS(D,"page-height"),h),m=e(g.getAttributeNS(D,"margin")),void 0===
m?(m=e(g.getAttributeNS(D,"margin-left"),"2cm"),n=e(g.getAttributeNS(D,"margin-right"),"2cm"),k=e(g.getAttributeNS(D,"margin-top"),"2cm"),p=e(g.getAttributeNS(D,"margin-bottom"),"2cm")):m=n=k=p=m,q=e(g.getAttributeNS(D,"padding")),void 0===q?(q=e(g.getAttributeNS(D,"padding-left"),"0cm"),B=e(g.getAttributeNS(D,"padding-right"),"0cm"),x=e(g.getAttributeNS(D,"padding-top"),"0cm"),g=e(g.getAttributeNS(D,"padding-bottom"),"0cm")):q=B=x=g=q):(r=e("21.001cm"),h=e("29.7cm"),m=n=k=p=m=e("2cm"),q=B=x=g=q=
e("0cm"));return{width:r-m-n-q-B,height:h-k-p-x-g}}};(function(){var h=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,g){function n(b){var a,d,c,f={};if(!b)return f;for(b=b.firstElementChild;b;){if(d=b.namespaceURI!==h||"style"!==b.localName&&
"default-style"!==b.localName?b.namespaceURI===k&&"list-style"===b.localName?"list":b.namespaceURI!==h||"page-layout"!==b.localName&&"default-page-layout"!==b.localName?void 0:"page":b.getAttributeNS(h,"family"))(a=b.getAttributeNS(h,"name"))||(a=""),f.hasOwnProperty(d)?c=f[d]:f[d]=c={},c[a]=b;b=b.nextElementSibling}return f}function p(b,a){if(b.hasOwnProperty(a))return b[a];var d=null,c=Object.keys(b),f;for(f=0;f<c.length&&!(d=p(b[c[f]].derivedStyles,a));f+=1);return d}function m(b,a,d){var c,f,
g;if(!a.hasOwnProperty(b))return null;c=new odf.StyleTreeNode(a[b]);f=c.element.getAttributeNS(h,"parent-style-name");g=null;f&&(g=p(d,f)||m(f,a,d));g?g.derivedStyles[b]=c:d[b]=c;delete a[b];return c}function q(b,a){b&&Object.keys(b).forEach(function(d){m(d,b,a)})}var f={};this.getStyleTree=function(){return f};(function(){var e,a,d;a=n(b);d=n(g);Object.keys(c).forEach(function(b){e=f[b]={};q(a[b],e);q(d[b],e)})})()}})();(function(){function h(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(d,e,g,m){var k=e.namespaceURI===n&&"list"===e.localName,p=e.namespaceURI===n&&"list-item"===e.localName;if(k||p){if(k){var k=g+=1,t,x,w;m.listCounterCount+=1;p=d+"-level"+k+"-"+m.listCounterCount;e.setAttributeNS("urn:webodf:names:helper","counter-id",
p);t=m.continuedCounterIdStack.shift();t||(t=p,a+=p+" 1 ",x='text|list[webodfhelper|counter-id="'+p+'"] > text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+t+" 0;",x+="}",h(b,x));for(;m.counterIdStack.length>=k;)m.counterIdStack.pop();m.counterIdStack.push(t);w=m.contentRules[k.toString()]||"";for(x=1;x<=k;x+=1)w=w.replace(x+"webodf-listLevel",m.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+p+'"] > text|list-item > :not(text|list):first-child:before';
x+="{";x+=w;x+="counter-increment: "+t+";";x+="}";h(b,x)}for(e=e.firstElementChild;e;)c(d,e,g,m),e=e.nextElementSibling}else m.continuedCounterIdStack=[]}var e=0,a="",d={};this.createCounterRules=function(a,b,g){var h=b.getAttributeNS(p,"id"),m=[];g&&(g=g.getAttributeNS("urn:webodf:names:helper","counter-id"),m=d[g].slice(0));a=new k(a,m);h?h="Y"+h:(e+=1,h="X"+e);c(h,b,0,a);d[h+"-level1-1"]=a.counterIdStack};this.initialiseCreatedCounters=function(){var d;d="office|document{"+("counter-reset: "+a+
";");d+="}";h(b,d)}}var b=odf.Namespaces.fons,g=odf.Namespaces.stylens,n=odf.Namespaces.textns,p=odf.Namespaces.xmlns,m={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function k(a){var b=r.parseLength(a);return b?d.convert(b.value,b.unit,"px"):(runtime.log("Could not parse value '"+a+"'."),0)}function f(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function e(a,d){var b;a&&(b=a.getAttributeNS(n,"style-name"));return b===d}function a(a,
d,b){d=d.getElementsByTagNameNS(n,"list");a=new c(a);var h,r,k,q,w,F,L={},H;for(H=0;H<d.length;H+=1)if(h=d.item(H),F=h.getAttributeNS(n,"style-name")){k=h.getAttributeNS(n,"continue-numbering");q=h.getAttributeNS(n,"continue-list");(w=h.getAttributeNS(p,"id"))&&(L[w]=h);w=b[F].element.firstElementChild;for(var G=void 0,A={};w;){var G=(G=w.getAttributeNS(n,"level"))&&parseInt(G,10),K=w,v="",u=void 0,Q=void 0,R=u=void 0;if("list-level-style-number"===K.localName){var C=K,v=C.getAttributeNS(g,"num-format"),
u=C.getAttributeNS(g,"num-suffix")||"",Q=C.getAttributeNS(g,"num-prefix")||"",I="",P=C.getAttributeNS(n,"level"),C=C.getAttributeNS(n,"display-levels");Q&&(I+='"'+f(Q)+'"\n');if(m.hasOwnProperty(v))for(P=P?parseInt(P,10):1,C=C?parseInt(C,10):1;0<C;)I+=" counter("+(P-C+1)+"webodf-listLevel,"+m[v]+")",1<C&&(I+='"."'),--C;else I=v?I+(' "'+v+'"'):I+' ""';v="content:"+I+' "'+f(u)+'"'}else"list-level-style-image"===K.localName?v="content: none":"list-level-style-bullet"===K.localName&&(v=K.getAttributeNS(n,
"bullet-char"),v='content: "'+f(v)+'"');if(u=K.getElementsByTagNameNS(g,"list-level-properties")[0])Q=u.getAttributeNS(n,"list-level-position-and-space-mode"),"label-alignment"===Q&&((u=u.getElementsByTagNameNS(g,"list-level-label-alignment")[0])&&(R=u.getAttributeNS(n,"label-followed-by")),"space"===R&&(v+=' "\\a0"'));A[G]="\n"+v+";\n";w=w.nextElementSibling}w=A;k&&!q&&e(r,F)?a.createCounterRules(w,h,r):q&&e(L[q],F)?a.createCounterRules(w,h,L[q]):a.createCounterRules(w,h);r=h}a.initialiseCreatedCounters()}
var d=new core.CSSUnits,r=odf.OdfUtils;this.applyListStyles=function(d,c,e){var f,r;(f=c.list)&&Object.keys(f).forEach(function(a){r=f[a];for(var c=r.element.firstElementChild;c;){if(c.namespaceURI===n){for(var e=d,m=c,p='text|list[text|style-name="'+a+'"]',B=m.getAttributeNS(n,"level"),y=void 0,A=void 0,K=A=void 0,v=void 0,u=void 0,Q=y=void 0,R=void 0,C=void 0,I=void 0,v=void 0,K=(A=m.getElementsByTagNameNS(g,"list-level-properties")[0])&&A.getAttributeNS(n,"list-level-position-and-space-mode"),
v=A&&A.getElementsByTagNameNS(g,"list-level-label-alignment")[0],y=B=B&&parseInt(B,10);1<y;)p+=" > text|list-item > text|list",--y;y=A&&A.getAttributeNS(b,"text-align")||"left";switch(y){case "end":y="right";break;case "start":y="left"}"label-alignment"===K?(u=v&&v.getAttributeNS(b,"margin-left")||"0px",C=v&&v.getAttributeNS(b,"text-indent")||"0px",I=v&&v.getAttributeNS(n,"label-followed-by"),v=k(u)):(u=A&&A.getAttributeNS(n,"space-before")||"0px",Q=A&&A.getAttributeNS(n,"min-label-width")||"0px",
R=A&&A.getAttributeNS(n,"min-label-distance")||"0px",v=k(u)+k(Q));A=p+" > text|list-item";A+="{";A+="margin-left: "+v+"px;";A+="}";h(e,A);A=p+" > text|list-item > text|list";A+="{";A+="margin-left: "+-v+"px;";A+="}";h(e,A);A=p+" > text|list-item > :not(text|list):first-child:before";A+="{";A+="text-align: "+y+";";A+="display: inline-block;";"label-alignment"===K?(A+="margin-left: "+C+";","listtab"===I&&(A+="padding-right: 0.2cm;")):(A+="min-width: "+Q+";",A+="margin-left: "+(0===parseFloat(Q)?"":
"-")+Q+";",A+="padding-right: "+R+";");A+="}";h(e,A)}c=c.nextElementSibling}});a(d,e,f)}}})();odf.LazyStyleProperties=function(h,k){var c={};this.value=function(b){var g;c.hasOwnProperty(b)?g=c[b]:(g=k[b](),void 0===g&&h&&(g=h.value(b)),c[b]=g);return g};this.reset=function(b){h=b;c={}}};
odf.StyleParseUtils=function(){function h(c){var b,g;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;g=c&&c.unit;"px"===g?b=c.value:"cm"===g?b=c.value/2.54*96:"mm"===g?b=c.value/25.4*96:"in"===g?b=96*c.value:"pt"===g?b=c.value/.75:"pc"===g&&(b=16*c.value);return b}var k=odf.Namespaces.stylens;this.parseLength=h;this.parsePositiveLengthOrPercent=function(c,b,g){var n;c&&(n=parseFloat(c.substr(0,
c.indexOf("%"))),isNaN(n)&&(n=void 0));var k;void 0!==n?(g&&(k=g.value(b)),n=void 0===k?void 0:k/100*n):n=h(c);return n};this.getPropertiesElement=function(c,b,g){for(b=g?g.nextElementSibling:b.firstElementChild;null!==b&&(b.localName!==c||b.namespaceURI!==k);)b=b.nextElementSibling;return b};this.parseAttributeList=function(c){c&&(c=c.replace(/^\s*(.*?)\s*$/g,"$1"));return c&&0<c.length?c.split(/\s+/):[]}};odf.Style2CSS=function(){function h(a,d,b){var c=[];b=b.derivedStyles;var e;var f=D[a],g;void 0===f?d=null:(g=d?"["+f+'|style-name="'+d+'"]':"","presentation"===f&&(f="draw",g=d?'[presentation|style-name="'+d+'"]':""),d=f+"|"+z[a].join(g+","+f+"|")+g);null!==d&&c.push(d);for(e in b)b.hasOwnProperty(e)&&(d=h(a,e,b[e]),c=c.concat(d));return c}function k(a){var d="",b="",d=null;if("default-style"===a.localName)return null;d=a.getAttributeNS(e,"parent-style-name");b=a.getAttributeNS(e,"family");return d=
T.getODFElementsWithXPath(P,d?"//style:*[@style:name='"+d+"'][@style:family='"+b+"']":"//style:default-style[@style:family='"+b+"']",odf.Namespaces.lookupNamespaceURI)[0]}function c(a,d){var b="",c,f,g;for(c=0;c<d.length;c+=1)if(f=d[c],g=a.getAttributeNS(f[0],f[1])){g=g.trim();if(u.hasOwnProperty(f[1])){var l=g,h=l.indexOf(" "),r=void 0;g=void 0;-1!==h?(r=l.substring(0,h),g=l.substring(h)):(r=l,g="");(r=C.parseLength(r))&&"pt"===r.unit&&.75>r.value&&(l="0.75pt"+g);g=l}else if(Q.hasOwnProperty(f[1])){var l=
a,h=f[0],r=f[1],m=C.parseLength(g),n=void 0,v=void 0,p=void 0,q=void 0,p=void 0;if(m&&"%"===m.unit){n=m.value/100;v=k(l.parentNode);for(q="0";v;){if(p=B.getDirectChild(v,e,"paragraph-properties"))if(p=C.parseLength(p.getAttributeNS(h,r))){if("%"!==p.unit){q=p.value*n+p.unit;break}n*=p.value/100}v=k(v)}g=q}}f[2]&&(b+=f[2]+":"+g+";")}return b}function b(a,d,b,c){return d+d+b+b+c+c}function g(a,d){var b=[a],c=d.derivedStyles;Object.keys(c).forEach(function(a){a=g(a,c[a]);b=b.concat(a)});return b}function n(a,
d,b,c){function e(d,b){var c=[],g;d.forEach(function(a){f.forEach(function(d){c.push('draw|page[webodfhelper|page-style-name="'+d+'"] draw|frame[presentation|class="'+a+'"]')})});0<c.length&&(g=c.join(",")+"{visibility:"+b+";}",a.insertRule(g,a.cssRules.length))}var f=g(d,c),h=[],r=[];["page-number","date-time","header","footer"].forEach(function(a){var d;d=b.getAttributeNS(l,"display-"+a);"true"===d?h.push(a):"false"===d&&r.push(a)});e(h,"visible");e(r,"hidden")}function p(a,g,u,Q){var z,D;if("page"===
g){var J=Q.element,P="",S,V;V=S="";u=B.getDirectChild(J,e,"page-layout-properties");var M;if(u)if(M=J.getAttributeNS(e,"name"),P+=c(u,K),(S=B.getDirectChild(u,e,"background-image"))&&(V=S.getAttributeNS(r,"href"))&&(P=P+("background-image: url('odfkit:"+V+"');")+c(S,x)),"presentation"===I)for(J=(J=B.getDirectChild(J.parentNode.parentNode,f,"master-styles"))&&J.firstElementChild;J;)J.namespaceURI===e&&"master-page"===J.localName&&J.getAttributeNS(e,"page-layout-name")===M&&(V=J.getAttributeNS(e,"name"),
S='draw|page[draw|master-page-name="'+V+'"] {'+P+"}",V='office|body, draw|page[draw|master-page-name="'+V+'"] {'+c(u,v)+" }",a.insertRule(S,a.cssRules.length),a.insertRule(V,a.cssRules.length)),J=J.nextElementSibling;else"text"===I&&(S="office|text {"+P+"}",V="office|body {width: "+u.getAttributeNS(q,"page-width")+";}",a.insertRule(S,a.cssRules.length),a.insertRule(V,a.cssRules.length))}else{P=h(g,u,Q).join(",");M="";if(J=B.getDirectChild(Q.element,e,"text-properties")){var T=J,ea=D="";S="";V=1;J=
""+c(T,t);z=T.getAttributeNS(e,"text-underline-style");"solid"===z&&(D+=" underline");z=T.getAttributeNS(e,"text-line-through-style");"solid"===z&&(D+=" line-through");D.length&&(J=J+("text-decoration:"+D+";\n")+("text-decoration-line:"+D+";\n"),J+="-moz-text-decoration-line:"+D+";\n");z=T.getAttributeNS(e,"text-line-through-type");switch(z){case "double":ea+=" double";break;case "single":ea+=" single"}ea&&(J+="text-decoration-style:"+ea+";\n",J+="-moz-text-decoration-style:"+ea+";\n");if(D=T.getAttributeNS(e,
"font-name")||T.getAttributeNS(q,"font-family"))z=R[D],J+="font-family: "+(z||D)+";";if(z=T.getAttributeNS(e,"text-position"))D=y.parseAttributeList(z),z=D[0],D=D[1],J+="vertical-align: "+z+"\n; ",D&&(V=parseFloat(D)/100);if(T.hasAttributeNS(q,"font-size")||1!==V){for(T=T.parentNode;T;){if(z=(z=B.getDirectChild(T,e,"text-properties"))?C.parseFoFontSize(z.getAttributeNS(q,"font-size")):null){if("%"!==z.unit){S="font-size: "+z.value*V+z.unit+";";break}V*=z.value/100}T=k(T)}S||(S="font-size: "+parseFloat(U)*
V+ca.getUnits(U)+";")}J+=S;M+=J}if(J=B.getDirectChild(Q.element,e,"paragraph-properties"))S=J,J=""+c(S,w),(V=B.getDirectChild(S,e,"background-image"))&&(T=V.getAttributeNS(r,"href"))&&(J=J+("background-image: url('odfkit:"+T+"');")+c(V,x)),(S=S.getAttributeNS(q,"line-height"))&&"normal"!==S&&(S=C.parseFoLineHeight(S),J="%"!==S.unit?J+("line-height: "+S.value+S.unit+";"):J+("line-height: "+S.value/100+";")),M+=J;if(J=B.getDirectChild(Q.element,e,"graphic-properties"))T=J,J=""+c(T,F),S=T.getAttributeNS(m,
"opacity"),V=T.getAttributeNS(m,"fill"),T=T.getAttributeNS(m,"fill-color"),"solid"===V||"hatch"===V?T&&"none"!==T?(S=isNaN(parseFloat(S))?1:parseFloat(S)/100,V=T.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,b),(T=(V=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(V))?{r:parseInt(V[1],16),g:parseInt(V[2],16),b:parseInt(V[3],16)}:null)&&(J+="background-color: rgba("+T.r+","+T.g+","+T.b+","+S+");")):J+="background: none;":"none"===V&&(J+="background: none;"),M+=J;if(J=B.getDirectChild(Q.element,e,"drawing-page-properties"))S=
J,V=""+c(S,F),"true"===S.getAttributeNS(l,"background-visible")&&(V+="background: none;"),M+=V,n(a,u,J,Q);if(J=B.getDirectChild(Q.element,e,"table-cell-properties"))u=M,M=""+c(J,L),M=u+M;if(J=B.getDirectChild(Q.element,e,"table-row-properties"))u=M,M=""+c(J,G),M=u+M;if(J=B.getDirectChild(Q.element,e,"table-column-properties"))u=M,M=""+c(J,H),M=u+M;if(J=B.getDirectChild(Q.element,e,"table-properties"))u=M,M=""+c(J,A),J=J.getAttributeNS(d,"border-model"),"collapsing"===J?M+="border-collapse:collapse;":
"separating"===J&&(M+="border-collapse:separate;"),M=u+M;0!==M.length&&a.insertRule(P+"{"+M+"}",a.cssRules.length)}for(var aa in Q.derivedStyles)Q.derivedStyles.hasOwnProperty(aa)&&p(a,g,aa,Q.derivedStyles[aa])}var m=odf.Namespaces.drawns,q=odf.Namespaces.fons,f=odf.Namespaces.officens,e=odf.Namespaces.stylens,a=odf.Namespaces.svgns,d=odf.Namespaces.tablens,r=odf.Namespaces.xlinkns,l=odf.Namespaces.presentationns,B=core.DomUtils,y=new odf.StyleParseUtils,D={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"},z={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"]},t=[[q,"color","color"],[q,"background-color","background-color"],[q,"font-weight","font-weight"],[q,"font-style","font-style"]],x=[[e,"repeat","background-repeat"]],w=[[q,"background-color","background-color"],[q,"text-align","text-align"],[q,"text-indent","text-indent"],[q,"padding","padding"],[q,"padding-left","padding-left"],[q,"padding-right","padding-right"],[q,"padding-top","padding-top"],[q,"padding-bottom","padding-bottom"],[q,"border-left","border-left"],[q,"border-right",
"border-right"],[q,"border-top","border-top"],[q,"border-bottom","border-bottom"],[q,"margin","margin"],[q,"margin-left","margin-left"],[q,"margin-right","margin-right"],[q,"margin-top","margin-top"],[q,"margin-bottom","margin-bottom"],[q,"border","border"]],F=[[q,"background-color","background-color"],[q,"min-height","min-height"],[m,"stroke","border"],[a,"stroke-color","border-color"],[a,"stroke-width","border-width"],[q,"border","border"],[q,"border-left","border-left"],[q,"border-right","border-right"],
[q,"border-top","border-top"],[q,"border-bottom","border-bottom"]],L=[[q,"background-color","background-color"],[q,"border-left","border-left"],[q,"border-right","border-right"],[q,"border-top","border-top"],[q,"border-bottom","border-bottom"],[q,"border","border"]],H=[[e,"column-width","width"]],G=[[e,"row-height","height"],[q,"keep-together",null]],A=[[e,"width","width"],[q,"margin-left","margin-left"],[q,"margin-right","margin-right"],[q,"margin-top","margin-top"],[q,"margin-bottom","margin-bottom"]],
K=[[q,"background-color","background-color"],[q,"padding","padding"],[q,"padding-left","padding-left"],[q,"padding-right","padding-right"],[q,"padding-top","padding-top"],[q,"padding-bottom","padding-bottom"],[q,"border","border"],[q,"border-left","border-left"],[q,"border-right","border-right"],[q,"border-top","border-top"],[q,"border-bottom","border-bottom"],[q,"margin","margin"],[q,"margin-left","margin-left"],[q,"margin-right","margin-right"],[q,"margin-top","margin-top"],[q,"margin-bottom","margin-bottom"]],
v=[[q,"page-width","width"],[q,"page-height","height"]],u={border:!0,"border-left":!0,"border-right":!0,"border-top":!0,"border-bottom":!0,"stroke-width":!0},Q={margin:!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"margin-bottom":!0},R={},C=odf.OdfUtils,I,P,U,T=xmldom.XPath,ca=new core.CSSUnits;this.style2css=function(a,d,b,c,e){function f(a,d){g="@namespace "+a+" url("+d+");";try{b.insertRule(g,b.cssRules.length)}catch(c){}}var g,l,h;for(P=d;b.cssRules.length;)b.deleteRule(b.cssRules.length-
1);odf.Namespaces.forEachPrefix(f);f("webodfhelper","urn:webodf:names:helper");R=c;I=a;U=runtime.getWindow().getComputedStyle(document.body,null).getPropertyValue("font-size")||"12pt";for(h in D)if(D.hasOwnProperty(h))for(l in a=e[h],a)a.hasOwnProperty(l)&&p(b,h,l,a[l])}};(function(){function h(k,c){var b=this;this.getDistance=function(c){var h=b.x-c.x;c=b.y-c.y;return Math.sqrt(h*h+c*c)};this.getCenter=function(c){return new h((b.x+c.x)/2,(b.y+c.y)/2)};b.x=k;b.y=c}gui.ZoomHelper=function(){function k(a,b,c,e){a=e?"translate3d("+a+"px, "+b+"px, 0) scale3d("+c+", "+c+", 1)":"translate("+a+"px, "+b+"px) scale("+c+")";d.style.WebkitTransform=a;d.style.MozTransform=a;d.style.msTransform=a;d.style.OTransform=a;d.style.transform=a}function c(a){a?k(-r.x,-r.y,y,!0):(k(0,
0,y,!0),k(0,0,y,!1))}function b(a){if(z&&L){var d=z.style.overflow,b=z.classList.contains("webodf-customScrollbars");a&&b||!a&&!b||(a?(z.classList.add("webodf-customScrollbars"),z.style.overflow="hidden",runtime.requestAnimationFrame(function(){z.style.overflow=d})):z.classList.remove("webodf-customScrollbars"))}}function g(){k(-r.x,-r.y,y,!0);z.scrollLeft=0;z.scrollTop=0;H=t.style.overflow;t.style.overflow="visible";b(!1)}function n(){k(0,0,y,!0);z.scrollLeft=r.x;z.scrollTop=r.y;t.style.overflow=
H||"";b(!0)}function p(a){return new h(a.pageX-d.offsetLeft,a.pageY-d.offsetTop)}function m(a){if(l){r.x-=a.x-l.x;r.y-=a.y-l.y;var b=r;r=new h(Math.min(Math.max(b.x,d.offsetLeft),(d.offsetLeft+d.offsetWidth)*y-z.clientWidth),Math.min(Math.max(b.y,d.offsetTop),(d.offsetTop+d.offsetHeight)*y-z.clientHeight))}l=a}function q(a){var d=a.touches.length,b=0<d?p(a.touches[0]):null;a=1<d?p(a.touches[1]):null;b&&a?(B=b.getDistance(a),D=y,l=b.getCenter(a),g(),F=w.PINCH):b&&(l=b,F=w.SCROLL)}function f(a){var b=
a.touches.length,e=0<b?p(a.touches[0]):null,b=1<b?p(a.touches[1]):null;if(e&&b)if(a.preventDefault(),F===w.SCROLL)F=w.PINCH,g(),B=e.getDistance(b);else{a=e.getCenter(b);e=e.getDistance(b)/B;m(a);var b=y,f=Math.min(4,d.offsetParent.clientWidth/d.offsetWidth);y=D*e;y=Math.min(Math.max(y,f),4);e=y/b;r.x+=(e-1)*(a.x+r.x);r.y+=(e-1)*(a.y+r.y);c(!0)}else e&&(F===w.PINCH?(F=w.SCROLL,n()):m(e))}function e(){F===w.PINCH&&(x.emit(gui.ZoomHelper.signalZoomChanged,y),n(),c(!1));F=w.NONE}function a(){z&&(z.removeEventListener("touchstart",
q,!1),z.removeEventListener("touchmove",f,!1),z.removeEventListener("touchend",e,!1))}var d,r,l,B,y,D,z,t,x=new core.EventNotifier([gui.ZoomHelper.signalZoomChanged]),w={NONE:0,SCROLL:1,PINCH:2},F=w.NONE,L=runtime.getWindow().hasOwnProperty("ontouchstart"),H="";this.subscribe=function(a,d){x.subscribe(a,d)};this.unsubscribe=function(a,d){x.unsubscribe(a,d)};this.getZoomLevel=function(){return y};this.setZoomLevel=function(a){d&&(y=a,c(!1),x.emit(gui.ZoomHelper.signalZoomChanged,y))};this.destroy=
function(d){a();b(!1);d()};this.setZoomableElement=function(g){a();d=g;z=d.offsetParent;t=d.parentNode;c(!1);z&&(z.addEventListener("touchstart",q,!1),z.addEventListener("touchmove",f,!1),z.addEventListener("touchend",e,!1));b(!0)};D=y=1;r=new h(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 h(){function a(c){b=!0;runtime.setTimeout(function(){try{c()}catch(e){runtime.log(String(e)+"\n"+e.stack)}b=!1;0<d.length&&a(d.pop())},10)}var d=[],b=!1;this.clearQueue=function(){d.length=0};this.addToQueue=function(c){if(0===d.length&&!b)return a(c);d.push(c)}}function k(a){function d(){for(;0<b.cssRules.length;)b.deleteRule(0);b.insertRule("#shadowContent draw|page {display:none;}",0);b.insertRule("office|presentation draw|page {display:none;}",1);b.insertRule("#shadowContent draw|page:nth-of-type("+
c+") {display:block;}",2);b.insertRule("office|presentation draw|page:nth-of-type("+c+") {display:block;}",3)}var b=a.sheet,c=1;this.showFirstPage=function(){c=1;d()};this.showNextPage=function(){c+=1;d()};this.showPreviousPage=function(){1<c&&(--c,d())};this.showPage=function(a){0<a&&(c=a,d())};this.css=a;this.destroy=function(d){a.parentNode.removeChild(a);d()}}function c(a){a=a.sheet;for(var d=a.cssRules;d.length;)a.deleteRule(d.length-1)}function b(a,d,b){var c=new odf.Style2CSS,e=new odf.ListStyleToCss;
b=b.sheet;var f=(new odf.StyleTree(a.rootElement.styles,a.rootElement.automaticStyles)).getStyleTree();c.style2css(a.getDocumentType(),a.rootElement,b,d.getFontMap(),f);e.applyListStyles(b,f,a.rootElement.body)}function g(a,d){(new odf.FontLoader).loadFonts(a,d.sheet)}function n(a,d,b){var c=null;a=a.rootElement.body.getElementsByTagNameNS(G,b+"-decl");b=d.getAttributeNS(G,"use-"+b+"-name");var e;if(b&&0<a.length)for(d=0;d<a.length;d+=1)if(e=a[d],e.getAttributeNS(G,"name")===b){c=e.textContent;break}return c}
function p(a,d,b,c){var e=a.ownerDocument;d=K.getElementsByTagNameNS(a,d,b);for(a=0;a<d.length;a+=1)K.removeAllChildNodes(d[a]),c&&(b=d[a],b.appendChild(e.createTextNode(c)))}function m(a,d,b){d.setAttributeNS("urn:webodf:names:helper","styleid",a);var c,e=d.getAttributeNS(L,"anchor-type"),f=d.getAttributeNS(w,"x"),g=d.getAttributeNS(w,"y"),l=d.getAttributeNS(w,"width"),h=d.getAttributeNS(w,"height"),r=d.getAttributeNS(z,"min-height"),m=d.getAttributeNS(z,"min-width");if("as-char"===e)c="display: inline-block;";
else if(e||f||g)c="position: absolute;";else if(l||h||r||m)c="display: block;";f&&(c+="left: "+f+";");g&&(c+="top: "+g+";");l&&(c+="width: "+l+";");h&&(c+="height: "+h+";");r&&(c+="min-height: "+r+";");m&&(c+="min-width: "+m+";");c&&(c="draw|"+d.localName+'[webodfhelper|styleid="'+a+'"] {'+c+"}",b.insertRule(c,b.cssRules.length))}function q(a){for(a=a.firstChild;a;){if(a.namespaceURI===t&&"binary-data"===a.localName)return"data:image/png;base64,"+a.textContent.replace(/[\r\n\s]/g,"");a=a.nextSibling}return""}
function f(a,d,b,c){function e(d){d&&(d='draw|image[webodfhelper|styleid="'+a+'"] {'+("background-image: url("+d+");")+"}",c.insertRule(d,c.cssRules.length))}function f(a){e(a.url)}b.setAttributeNS("urn:webodf:names:helper","styleid",a);var g=b.getAttributeNS(H,"href"),l;if(g)try{l=d.getPart(g),l.onchange=f,l.load()}catch(h){runtime.log("slight problem: "+String(h))}else g=q(b),e(g)}function e(a){var d=a.ownerDocument;K.getElementsByTagNameNS(a,L,"line-break").forEach(function(a){a.hasChildNodes()||
a.appendChild(d.createElement("br"))})}function a(a){var d=a.ownerDocument;K.getElementsByTagNameNS(a,L,"s").forEach(function(a){var b,c;K.removeAllChildNodes(a);a.appendChild(d.createTextNode(" "));c=parseInt(a.getAttributeNS(L,"c"),10);if(1<c)for(a.removeAttributeNS(L,"c"),b=1;b<c;b+=1)a.parentNode.insertBefore(a.cloneNode(!0),a)})}function d(a){K.getElementsByTagNameNS(a,L,"tab").forEach(function(a){a.textContent="\t"})}function r(a,d){function b(a,c){var g=l.documentElement.namespaceURI;"video/"===
c.substr(0,6)?(e=l.createElementNS(g,"video"),e.setAttribute("controls","controls"),f=l.createElementNS(g,"source"),a&&f.setAttribute("src",a),f.setAttribute("type",c),e.appendChild(f),d.parentNode.appendChild(e)):d.innerHtml="Unrecognised Plugin"}function c(a){b(a.url,a.mimetype)}var e,f,g,l=d.ownerDocument,h;if(g=d.getAttributeNS(H,"href"))try{h=a.getPart(g),h.onchange=c,h.load()}catch(r){runtime.log("slight problem: "+String(r))}else runtime.log("using MP4 data fallback"),g=q(d),b(g,"video/mp4")}
function l(a){var d=a.getElementsByTagName("head")[0],b,c;b=a.styleSheets.length;for(c=d.firstElementChild;c&&("style"!==c.localName||!c.hasAttribute("webodfcss"));)c=c.nextElementSibling;if(c)return b=parseInt(c.getAttribute("webodfcss"),10),c.setAttribute("webodfcss",b+1),c;"string"===String(typeof webodf_css)?b=webodf_css:(c="webodf.css",runtime.currentDirectory&&(c=runtime.currentDirectory(),0<c.length&&"/"!==c.substr(-1)&&(c+="/"),c+="../webodf.css"),b=runtime.readFileSync(c,"utf-8"));c=a.createElementNS(d.namespaceURI,
"style");c.setAttribute("media","screen, print, handheld, projection");c.setAttribute("type","text/css");c.setAttribute("webodfcss","1");c.appendChild(a.createTextNode(b));d.appendChild(c);return c}function B(a){var d=parseInt(a.getAttribute("webodfcss"),10);1===d?a.parentNode.removeChild(a):a.setAttribute("count",d-1)}function y(a){var d=a.getElementsByTagName("head")[0],b=a.createElementNS(d.namespaceURI,"style"),c="";b.setAttribute("type","text/css");b.setAttribute("media","screen, print, handheld, projection");
odf.Namespaces.forEachPrefix(function(a,d){c+="@namespace "+a+" url("+d+");\n"});c+="@namespace webodfhelper url(urn:webodf:names:helper);\n";b.appendChild(a.createTextNode(c));d.appendChild(b);return b}var D=odf.Namespaces.drawns,z=odf.Namespaces.fons,t=odf.Namespaces.officens,x=odf.Namespaces.stylens,w=odf.Namespaces.svgns,F=odf.Namespaces.tablens,L=odf.Namespaces.textns,H=odf.Namespaces.xlinkns,G=odf.Namespaces.presentationns,A=xmldom.XPath,K=core.DomUtils;odf.OdfCanvas=function(v,u){function q(a,
d,b){function c(a,d,b,e){na.addToQueue(function(){f(a,d,b,e)})}var e,g;e=d.getElementsByTagNameNS(D,"image");for(d=0;d<e.length;d+=1)g=e.item(d),c("image"+String(d),a,g,b)}function w(a,d){function b(a,d){na.addToQueue(function(){r(a,d)})}var c,e,f;e=d.getElementsByTagNameNS(D,"plugin");for(c=0;c<e.length;c+=1)f=e.item(c),b(a,f)}function C(){var a;a=X.firstChild;var d=ga.getZoomLevel();a&&(X.style.WebkitTransformOrigin="0% 0%",X.style.MozTransformOrigin="0% 0%",X.style.msTransformOrigin="0% 0%",X.style.OTransformOrigin=
"0% 0%",X.style.transformOrigin="0% 0%",S&&((a=S.getMinimumHeightForAnnotationPane())?X.style.minHeight=a:X.style.removeProperty("min-height")),v.style.width=Math.round(d*X.offsetWidth)+"px",v.style.height=Math.round(d*X.offsetHeight)+"px",v.style.display="inline-block")}function z(b,c){var f=ea.sheet;K.removeAllChildNodes(v);X=Y.createElementNS(v.namespaceURI,"div");X.style.display="inline-block";X.style.background="white";X.style.setProperty("float","left","important");X.appendChild(c);v.appendChild(X);
ha=Y.createElementNS(v.namespaceURI,"div");ha.id="annotationsPane";aa=Y.createElementNS(v.namespaceURI,"div");aa.id="shadowContent";aa.style.position="absolute";aa.style.top=0;aa.style.left=0;b.getContentElement().appendChild(aa);var g=c.body,l,h=[],r;for(l=g.firstElementChild;l&&l!==g;)if(l.namespaceURI===D&&(h[h.length]=l),l.firstElementChild)l=l.firstElementChild;else{for(;l&&l!==g&&!l.nextElementSibling;)l=l.parentNode;l&&l.nextElementSibling&&(l=l.nextElementSibling)}for(r=0;r<h.length;r+=1)l=
h[r],m("frame"+String(r),l,f);h=A.getODFElementsWithXPath(g,".//*[*[@text:anchor-type='paragraph']]",odf.Namespaces.lookupNamespaceURI);for(l=0;l<h.length;l+=1)g=h[l],g.setAttributeNS&&g.setAttributeNS("urn:webodf:names:helper","containsparagraphanchor",!0);g=Z;l=aa;var k,u,B,C,y=0,H;r=b.rootElement.ownerDocument;if((h=c.body.firstElementChild)&&h.namespaceURI===t&&("presentation"===h.localName||"drawing"===h.localName))for(h=h.firstElementChild;h;){if(k=(k=h.getAttributeNS(D,"master-page-name"))?
g.getMasterPageElement(k):null){u=h.getAttributeNS("urn:webodf:names:helper","styleid");B=r.createElementNS(D,"draw:page");H=k.firstElementChild;for(y=0;H;)"true"!==H.getAttributeNS(G,"placeholder")&&(C=H.cloneNode(!0),B.appendChild(C)),H=H.nextElementSibling,y+=1;H=C=y=void 0;for(var I=K.getElementsByTagNameNS(B,D,"frame"),y=0;y<I.length;y+=1)C=I[y],(H=C.getAttributeNS(G,"class"))&&!/^(date-time|footer|header|page-number)$/.test(H)&&C.parentNode.removeChild(C);C=K.getElementsByTagNameNS(B,D,"*");
for(y=0;y<C.length;y+=1)m(u+"_"+y,C[y],f);l.appendChild(B);y=String(l.getElementsByTagNameNS(D,"page").length);p(B,L,"page-number",y);p(B,G,"header",n(b,h,"header"));p(B,G,"footer",n(b,h,"footer"));m(u,B,f);B.setAttributeNS("urn:webodf:names:helper","page-style-name",h.getAttributeNS(D,"style-name"));B.setAttributeNS(D,"draw:master-page-name",k.getAttributeNS(x,"name"))}h=h.nextElementSibling}g=v.namespaceURI;h=K.getElementsByTagNameNS(c.body,F,"table-cell");for(l=0;l<h.length;l+=1)r=h[l],r.hasAttributeNS(F,
"number-columns-spanned")&&r.setAttributeNS(g,"colspan",r.getAttributeNS(F,"number-columns-spanned")),r.hasAttributeNS(F,"number-rows-spanned")&&r.setAttributeNS(g,"rowspan",r.getAttributeNS(F,"number-rows-spanned"));e(c.body);a(c.body);d(c.body);q(b,c.body,f);w(b,c.body);X.insertBefore(aa,X.firstChild);ga.setZoomableElement(X)}function H(a){J?(ha.parentNode||X.appendChild(ha),S&&S.forgetAnnotations(),S=new gui.AnnotationViewManager(ca,a.body,ha,ba),a=K.getElementsByTagNameNS(a.body,t,"annotation"),
S.addAnnotations(a),C()):ha.parentNode&&(X.removeChild(ha),S.forgetAnnotations(),C())}function U(a){function d(){c(M);c(ja);c(ea);K.removeAllChildNodes(v);v.style.display="inline-block";var e=E.rootElement;v.ownerDocument.importNode(e,!0);Z.setOdfContainer(E);g(E,M);b(E,Z,ja);z(E,e);H(e);a||na.addToQueue(function(){var a=[E];if(fa.hasOwnProperty("statereadychange")){var d=fa.statereadychange,b;for(b=0;b<d.length;b+=1)d[b].apply(null,a)}})}E.state===odf.OdfContainer.DONE?d():(runtime.log("WARNING: refreshOdf called but ODF was not DONE."),
qa=runtime.setTimeout(function W(){E.state===odf.OdfContainer.DONE?d():(runtime.log("will be back later..."),qa=runtime.setTimeout(W,500))},100))}function T(a){na.clearQueue();K.removeAllChildNodes(v);v.appendChild(v.ownerDocument.createTextNode(runtime.tr("Loading")+a+"..."));v.removeAttribute("style");E=new odf.OdfContainer(a,function(a){E=a;U(!1)})}runtime.assert(null!==v&&void 0!==v,"odf.OdfCanvas constructor needs DOM element");runtime.assert(null!==v.ownerDocument&&void 0!==v.ownerDocument,
"odf.OdfCanvas constructor needs DOM");var ca=this,Y=v.ownerDocument,E,Z=new odf.Formatting,da,X=null,ha=null,J=!1,ba=!1,S=null,V,M,ja,ea,aa,fa={},qa,la,ia=!1,ma=!1,na=new h,ga=new gui.ZoomHelper,ka=u||new gui.SingleScrollViewport(v.parentNode);this.refreshCSS=function(){ia=!0;la.trigger()};this.refreshSize=function(){la.trigger()};this.odfContainer=function(){return E};this.setOdfContainer=function(a,d){E=a;U(!0===d)};this.load=this.load=T;this.save=function(a){E.save(a)};this.addListener=function(a,
d){switch(a){case "click":var b=a;v.addEventListener?v.addEventListener(b,d,!1):v.attachEvent?v.attachEvent("on"+b,d):v["on"+b]=d;break;default:b=fa.hasOwnProperty(a)?fa[a]:fa[a]=[],d&&-1===b.indexOf(d)&&b.push(d)}};this.getFormatting=function(){return Z};this.getAnnotationViewManager=function(){return S};this.refreshAnnotations=function(){H(E.rootElement)};this.rerenderAnnotations=function(){S&&(ma=!0,la.trigger())};this.getSizer=function(){return X};this.enableAnnotations=function(a,d){a!==J&&(J=
a,ba=d,E&&H(E.rootElement))};this.addAnnotation=function(a){S&&(S.addAnnotations([a]),C())};this.forgetAnnotation=function(a){S&&(S.forgetAnnotation(a),C())};this.getZoomHelper=function(){return ga};this.setZoomLevel=function(a){ga.setZoomLevel(a)};this.getZoomLevel=function(){return ga.getZoomLevel()};this.fitToContainingElement=function(a,d){var b=ga.getZoomLevel(),c=v.offsetHeight/b,b=a/(v.offsetWidth/b);d/c<b&&(b=d/c);ga.setZoomLevel(b)};this.fitToWidth=function(a){var d=v.offsetWidth/ga.getZoomLevel();
ga.setZoomLevel(a/d)};this.fitSmart=function(a,d){var b,c;c=ga.getZoomLevel();b=v.offsetWidth/c;c=v.offsetHeight/c;b=a/b;void 0!==d&&d/c<b&&(b=d/c);ga.setZoomLevel(Math.min(1,b))};this.fitToHeight=function(a){var d=v.offsetHeight/ga.getZoomLevel();ga.setZoomLevel(a/d)};this.showFirstPage=function(){da.showFirstPage()};this.showNextPage=function(){da.showNextPage()};this.showPreviousPage=function(){da.showPreviousPage()};this.showPage=function(a){da.showPage(a);C()};this.getElement=function(){return v};
this.getViewport=function(){return ka};this.addCssForFrameWithImage=function(a){var d=a.getAttributeNS(D,"name"),b=a.firstElementChild;m(d,a,ea.sheet);b&&f(d+"img",E,b,ea.sheet)};this.destroy=function(a){var d=Y.getElementsByTagName("head")[0],b=[da.destroy,la.destroy];runtime.clearTimeout(qa);ha&&ha.parentNode&&ha.parentNode.removeChild(ha);ga.destroy(function(){X&&(v.removeChild(X),X=null)});B(V);d.removeChild(M);d.removeChild(ja);d.removeChild(ea);core.Async.destroyAll(b,a)};V=l(Y);da=new k(y(Y));
M=y(Y);ja=y(Y);ea=y(Y);la=core.Task.createRedrawTask(function(){ia&&(b(E,Z,ja),ia=!1);ma&&(S&&S.rerenderAnnotations(),ma=!1);C()});ga.subscribe(gui.ZoomHelper.signalZoomChanged,C)}})();odf.StepUtils=function(){this.getContentBounds=function(h){var k=h.container(),c,b;runtime.assert(h.isStep(),"Step iterator must be on a step");k.nodeType===Node.TEXT_NODE&&0<h.offset()?c=h.offset():(k=h.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(h,k){var c=new ops.MemberProperties;this.getMemberId=function(){return h};this.getProperties=function(){return c};this.setProperties=function(b){Object.keys(b).forEach(function(g){c[g]=b[g]})};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(h),"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};ops.Document=function(){};ops.Document.prototype.getMemberIds=function(){};ops.Document.prototype.removeCursor=function(h){};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(h){};ops.Document.prototype.subscribe=function(h,k){};ops.Document.prototype.unsubscribe=function(h,k){};
ops.Document.prototype.getCanvas=function(){};ops.Document.prototype.createRootFilter=function(h){};ops.Document.prototype.createPositionIterator=function(h){};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(h,k){var c=this,b={},g,n,p=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){n.remove()};this.subscribe=function(b,c){p.subscribe(b,c)};this.unsubscribe=function(b,c){p.unsubscribe(b,c)};this.getMemberId=function(){return h};this.getNode=function(){return n.getNode()};this.getAnchorNode=function(){return n.getAnchorNode()};this.getSelectedRange=function(){return n.getSelectedRange()};this.setSelectedRange=function(b,g){n.setSelectedRange(b,
g);p.emit(ops.OdtCursor.signalCursorUpdated,c)};this.hasForwardSelection=function(){return n.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return g};this.setSelectionType=function(c){b.hasOwnProperty(c)?g=c:runtime.log("Invalid selection type: "+c)};this.resetSelectionType=function(){c.setSelectionType(ops.OdtCursor.RangeSelection)};n=new core.Cursor(k.getDOMDocument(),h);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 h=0;ops.StepsCache=function(k,c,b){function g(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 n(a,d,c){var e=this;this.nodeId=a;this.steps=d;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setUnfilteredPosition(c,0);b(e.steps,a)}}function p(a,d){var b="["+a.nodeId;d&&(b+=" => "+d.nodeId);return b+
"]"}function m(){if(!0===ops.StepsCache.ENABLE_CACHE_VERIFICATION){for(var a=y,d,b,c,e=new core.LoopWatchDog(0,1E5),f={};a;){e.check();(d=a.previousBookmark)?runtime.assert(d.nextBookmark===a,"Broken bookmark link to previous @"+p(d,a)):(runtime.assert(a===y,"Broken bookmark link @"+p(a)),runtime.assert(void 0===D||y===y||y.steps<=D,"Base point is damaged @"+p(a)));(b=a.nextBookmark)&&runtime.assert(b.previousBookmark===a,"Broken bookmark link to next @"+p(a,b));if(void 0===D||a===y||a.steps<=D)runtime.assert(B.containsNode(k,
a.node),"Disconnected node is being reported as undamaged @"+p(a)),d&&(c=a.node.compareDocumentPosition(d.node),runtime.assert(0===c||0!==(c&t),"Bookmark order with previous does not reflect DOM order @"+p(d,a))),b&&B.containsNode(k,b.node)&&(c=a.node.compareDocumentPosition(b.node),runtime.assert(0===c||0!==(c&z),"Bookmark order with next does not reflect DOM order @"+p(a,b)));a=a.nextBookmark}Object.keys(r).forEach(function(a){var d=r[a];(void 0===D||a<=D)&&runtime.assert(d.steps<=a,"Bookmark step of "+
d.steps+" exceeds cached step lookup for "+a+" @"+p(d));runtime.assert(!1===f.hasOwnProperty(d.nodeId),"Bookmark "+p(d)+" appears twice in cached step lookup at steps "+f[d.nodeId]+" and "+a);f[d.nodeId]=a})}}function q(a){var d="";a.nodeType===Node.ELEMENT_NODE&&(d=a.getAttributeNS("urn:webodf:names:steps","nodeId")||"");return d}function f(a){var d=h.toString();a.setAttributeNS("urn:webodf:names:steps","nodeId",d);h+=1;return d}function e(a){var d,b,e=new core.LoopWatchDog(0,1E4);void 0!==D&&a>
D&&(a=D);for(d=Math.floor(a/c)*c;!b&&0<=d;)b=r[d],d-=c;for(b=b||y;b.nextBookmark&&b.nextBookmark.steps<=a;)e.check(),b=b.nextBookmark;runtime.assert(-1===a||b.steps<=a,"Bookmark @"+p(b)+" at step "+b.steps+" exceeds requested step of "+a);return b}function a(a){a.previousBookmark&&(a.previousBookmark.nextBookmark=a.nextBookmark);a.nextBookmark&&(a.nextBookmark.previousBookmark=a.previousBookmark)}function d(a){for(var d,b=null;!b&&a&&a!==k;)(d=q(a))&&(b=l[d])&&b.node!==a&&(runtime.log("Cloned node detected. Creating new bookmark"),
b=null,a.removeAttributeNS("urn:webodf:names:steps","nodeId")),a=a.parentNode;return b}var r={},l={},B=core.DomUtils,y,D,z=Node.DOCUMENT_POSITION_FOLLOWING,t=Node.DOCUMENT_POSITION_PRECEDING;this.updateBookmark=function(d,b){var h,n=Math.ceil(d/c)*c,p,t,A;if(void 0!==D&&D<d){p=e(D);for(t=p.nextBookmark;t&&t.steps<=d;)h=t.nextBookmark,A=Math.ceil(t.steps/c)*c,r[A]===t&&delete r[A],B.containsNode(k,t.node)?t.steps=d+1:(a(t),delete l[t.nodeId]),t=h;D=d}else p=e(d);t=q(b)||f(b);h=l[t];h?h.node!==b&&(runtime.log("Cloned node detected. Creating new bookmark"),
t=f(b),h=l[t]=new g(t,b)):h=l[t]=new g(t,b);t=h;t.steps!==d&&(h=Math.ceil(t.steps/c)*c,h!==n&&r[h]===t&&delete r[h],t.steps=d);if(p!==t&&p.nextBookmark!==t){if(p.steps===t.steps)for(;0!==(t.node.compareDocumentPosition(p.node)&z)&&p!==y;)p=p.previousBookmark;p!==t&&p.nextBookmark!==t&&(a(t),h=p.nextBookmark,t.nextBookmark=p.nextBookmark,t.previousBookmark=p,p.nextBookmark=t,h&&(h.previousBookmark=t))}p=r[n];if(!p||t.steps>p.steps)r[n]=t;m()};this.setToClosestStep=function(a,d){var b;m();b=e(a);b.setIteratorPosition(d);
return b.steps};this.setToClosestDomPoint=function(a,b,c){var f,g;m();if(a===k&&0===b)f=y;else if(a===k&&b===k.childNodes.length)for(g in f=y,r)r.hasOwnProperty(g)&&(a=r[g],a.steps>f.steps&&(f=a));else if(f=d(a.childNodes.item(b)||a),!f)for(c.setUnfilteredPosition(a,b);!f&&c.previousNode();)f=d(c.getCurrentNode());f=f||y;void 0!==D&&f.steps>D&&(f=e(D));f.setIteratorPosition(c);return f.steps};this.damageCacheAfterStep=function(a){0>a&&(a=-1);void 0===D?D=a:a<D&&(D=a);m()};(function(){var a=q(k)||
f(k);y=new n(a,0,k)})()};ops.StepsCache.ENABLE_CACHE_VERIFICATION=!1;ops.StepsCache.Bookmark=function(){};ops.StepsCache.Bookmark.prototype.setIteratorPosition=function(h){}})();(function(){ops.OdtStepsTranslator=function(h,k,c,b){function g(a,b,c){var e=b.getCurrentNode();b.isBeforeNode()&&m.isParagraph(e)&&(c||(a+=1),p.updateBookmark(a,e))}function n(d,b){if(!b||c.acceptPosition(d)===f)return!0;for(;d.previousPosition();)if(c.acceptPosition(d)===f){if(b(e,d.container(),d.unfilteredDomOffset()))return!0;break}for(;d.nextPosition();)if(c.acceptPosition(d)===f){if(b(a,d.container(),d.unfilteredDomOffset()))return!0;break}return!1}var p,m=odf.OdfUtils,q=core.DomUtils,f=core.PositionFilter.FilterResult.FILTER_ACCEPT,
e=core.StepDirection.PREVIOUS,a=core.StepDirection.NEXT;this.convertStepsToDomPoint=function(a){var b,e;if(isNaN(a))throw new TypeError("Requested steps is not numeric ("+a+")");if(0>a)throw new RangeError("Requested steps is negative ("+a+")");for(b=p.setToClosestStep(a,k);b<a&&k.nextPosition();)(e=c.acceptPosition(k)===f)&&(b+=1),g(b,k,e);if(b!==a)throw new RangeError("Requested steps ("+a+") exceeds available steps ("+b+")");return{node:k.container(),offset:k.unfilteredDomOffset()}};this.convertDomPointToSteps=
function(a,b,e){var m;q.containsNode(h,a)||(b=0>q.comparePoints(h,0,a,b),a=h,b=b?0:h.childNodes.length);k.setUnfilteredPosition(a,b);n(k,e)||k.setUnfilteredPosition(a,b);e=k.container();b=k.unfilteredDomOffset();a=p.setToClosestDomPoint(e,b,k);if(0>q.comparePoints(k.container(),k.unfilteredDomOffset(),e,b))return 0<a?a-1:a;for(;(k.container()!==e||k.unfilteredDomOffset()!==b)&&k.nextPosition();)(m=c.acceptPosition(k)===f)&&(a+=1),g(a,k,m);return a+0};this.prime=function(){var a,b;for(a=p.setToClosestStep(0,
k);k.nextPosition();)(b=c.acceptPosition(k)===f)&&(a+=1),g(a,k,b)};this.handleStepsInserted=function(a){p.damageCacheAfterStep(a.position)};this.handleStepsRemoved=function(a){p.damageCacheAfterStep(a.position-1)};p=new ops.StepsCache(h,b,function(a,b){do{if(c.acceptPosition(b)===f){g(a,b,!0);break}g(a-1,b,!1)}while(b.nextPosition())})}})();ops.Operation=function(){};ops.Operation.prototype.init=function(h){};ops.Operation.prototype.execute=function(h){};ops.Operation.prototype.spec=function(){};ops.TextPositionFilter=function(){function h(b,c){for(;b&&c(b)!==n;)b=b.previousSibling;return b}function k(b,g,f,e){var a;if(g){if(c.isInlineRoot(g)&&c.isGroupingElement(f))return p;e=c.lookLeftForCharacter(g);if(1===e||2===e&&(c.scanRightForAnyCharacter(f)||c.scanRightForAnyCharacter(c.nextNode(b))))return n}else if(c.isGroupingElement(b)&&c.isInlineRoot(h(b.previousSibling,e)))return n;e=null===g&&c.isParagraph(b);a=c.lookRightForCharacter(f);if(e)return a?n:c.scanRightForAnyCharacter(f)?p:n;if(!a)return p;
g=g||c.previousNode(b);return c.scanLeftForAnyCharacter(g)?p:n}var c=odf.OdfUtils,b=Node.ELEMENT_NODE,g=Node.TEXT_NODE,n=core.PositionFilter.FilterResult.FILTER_ACCEPT,p=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(h){var q=h.container(),f=q.nodeType,e,a,d;if(f!==b&&f!==g)return p;if(f===g){f=h.unfilteredDomOffset();e=q.data;runtime.assert(f!==e.length,"Unexpected offset.");if(0<f){h=e[f-1];if(!c.isODFWhitespace(h))return n;if(1<f)if(h=e[f-2],!c.isODFWhitespace(h))d=
n;else{if(!c.isODFWhitespace(e.substr(0,f)))return p}else a=c.previousNode(q),c.scanLeftForNonSpace(a)&&(d=n);if(d===n)return c.isTrailingWhitespace(q,f)?p:n;h=e[f];return c.isODFWhitespace(h)?p:c.scanLeftForAnyCharacter(c.previousNode(q))?p:n}a=h.leftNode();d=q;q=q.parentNode;d=k(q,a,d,h.getNodeFilter())}else c.isGroupingElement(q)?(a=h.leftNode(),d=h.rightNode(),d=k(q,a,d,h.getNodeFilter())):d=p;return d}};function RootFilter(h,k,c){var b=core.PositionFilter.FilterResult.FILTER_ACCEPT,g=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(n){n=n.container();var p;p="string"===typeof h?k[h].getNode():h;return c(n)===c(p)?b:g}}
ops.OdtDocument=function(h){function k(a){return new core.PositionIterator(a,F,G,!1)}function c(){var a=h.odfContainer().getContentElement(),b=a&&a.localName;runtime.assert("text"===b,"Unsupported content element type '"+b+"' for OdtDocument");return a}function b(){return a.getDocumentElement().ownerDocument}function g(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 n(a,
b,d,c){c=k(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 p(a){var b=k(c());a=x.convertStepsToDomPoint(a);b.setUnfilteredPosition(a.node,a.offset);return b}function m(a){return a===z}function q(b){var d=b.spec(),c=d.memberid,e=(new Date(d.timestamp)).toISOString(),d=h.odfContainer();b.isEdit&&(c=a.getMember(c).getProperties().fullName,d.setMetadata({"dc:creator":c,"dc:date":e},null),c={setProperties:{"dc:creator":c,
"dc:date":e},removedProperties:[]},w||(c.setProperties["meta:editing-cycles"]=d.incrementEditingCycles(),d.setMetadata(null,["meta:editing-duration","meta:document-statistic"])),w=b,a.emit(ops.OdtDocument.signalMetadataUpdated,c))}function f(a){var b,c=[],e,f=2;runtime.assert(a.isStep(),"positionIterator is not at a step");do{if(b=d.getContentBounds(a))if(b=b.container,r.isDowngradableSpaceElement(b)){for(e=b.lastChild;b.firstChild;)c.push(b.firstChild),b.parentNode.insertBefore(b.firstChild,b);b.parentNode.removeChild(b);
a.setPosition(e,e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length);a.roundToPreviousStep()}--f}while(0<f&&a.nextStep());c.forEach(l.normalizeTextNodes)}function e(a,b,d){a=a.childNodes.item(b)||a;return(a=r.getParagraphElement(a))&&l.containsNode(d,a)?a:d}var a=this,d,r=odf.OdfUtils,l=core.DomUtils,B={},y={},D=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,
ops.OdtDocument.signalAnnotationAdded]),z=core.StepDirection.NEXT,t,x,w,F=NodeFilter.SHOW_ALL,L=new gui.BlacklistNamespaceNodeFilter(["urn:webodf:names:cursor","urn:webodf:names:editinfo"]),H=new gui.OdfTextBodyNodeFilter,G=new core.NodeFilterChain([L,H]);this.createPositionIterator=k;this.getDocumentElement=function(){return h.odfContainer().rootElement};this.cloneDocumentElement=function(){var b=a.getDocumentElement(),d=h.getAnnotationViewManager();d&&d.forgetAnnotations();b=b.cloneNode(!0);h.refreshAnnotations();
a.fixCursorPositions();return b};this.setDocumentElement=function(a){var b=h.odfContainer();D.unsubscribe(ops.OdtDocument.signalStepsInserted,x.handleStepsInserted);D.unsubscribe(ops.OdtDocument.signalStepsRemoved,x.handleStepsRemoved);b.setRootElement(a);h.setOdfContainer(b,!0);h.refreshCSS();a=c();x=new ops.OdtStepsTranslator(a,k(a),t,500);D.subscribe(ops.OdtDocument.signalStepsInserted,x.handleStepsInserted);D.subscribe(ops.OdtDocument.signalStepsRemoved,x.handleStepsRemoved)};this.getDOMDocument=
b;this.getRootElement=g;this.createStepIterator=n;this.getIteratorAtPosition=p;this.convertCursorStepToDomPoint=function(a){return x.convertStepsToDomPoint(a)};this.convertDomPointToCursorStep=function(a,b,d){var c;d===z&&(c=m);return x.convertDomPointToSteps(a,b,c)};this.convertDomToCursorRange=function(a){var b;b=x.convertDomPointToSteps(a.anchorNode,a.anchorOffset);a=a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset?b:x.convertDomPointToSteps(a.focusNode,a.focusOffset);return{position:b,
length:a-b}};this.convertCursorToDomRange=function(a,d){var c=b().createRange(),e,f;e=x.convertStepsToDomPoint(a);d?(f=x.convertStepsToDomPoint(a+d),0<d?(c.setStart(e.node,e.offset),c.setEnd(f.node,f.offset)):(c.setStart(f.node,f.offset),c.setEnd(e.node,e.offset))):c.setStart(e.node,e.offset);return c};this.upgradeWhitespacesAtPosition=function(a){var b=p(a),b=new core.StepIterator(t,b),c,e=2;runtime.assert(b.isStep(),"positionIterator is not at a step (requested step: "+a+")");do{if(c=d.getContentBounds(b))if(a=
c.container,c=c.startOffset,a.nodeType===Node.TEXT_NODE&&r.isSignificantWhitespace(a,c)){runtime.assert(" "===a.data[c],"upgradeWhitespaceToElement: textNode.data[offset] should be a literal space");var f=a.ownerDocument.createElementNS(odf.Namespaces.textns,"text:s"),g=a.parentNode,l=a;f.appendChild(a.ownerDocument.createTextNode(" "));1===a.length?g.replaceChild(f,a):(a.deleteData(c,1),0<c&&(c<a.length&&a.splitText(c),l=a.nextSibling),g.insertBefore(f,l));a=f;b.setPosition(a,a.childNodes.length);
b.roundToPreviousStep()}--e}while(0<e&&b.nextStep())};this.downgradeWhitespaces=f;this.downgradeWhitespacesAtPosition=function(a){a=p(a);a=new core.StepIterator(t,a);f(a)};this.getTextNodeAtStep=function(d,c){var e=p(d),f=e.container(),g,l=0,h=null;f.nodeType===Node.TEXT_NODE?(g=f,l=e.unfilteredDomOffset(),0<g.length&&(0<l&&(g=g.splitText(l)),g.parentNode.insertBefore(b().createTextNode(""),g),g=g.previousSibling,l=0)):(g=b().createTextNode(""),l=0,f.insertBefore(g,e.rightNode()));if(c){if(B[c]&&
a.getCursorPosition(c)===d){for(h=B[c].getNode();h.nextSibling&&"cursor"===h.nextSibling.localName;)h.parentNode.insertBefore(h.nextSibling,h);0<g.length&&g.nextSibling!==h&&(g=b().createTextNode(""),l=0);h.parentNode.insertBefore(g,h)}}else for(;g.nextSibling&&"cursor"===g.nextSibling.localName;)g.parentNode.insertBefore(g.nextSibling,g);for(;g.previousSibling&&g.previousSibling.nodeType===Node.TEXT_NODE;)e=g.previousSibling,e.appendData(g.data),l=e.length,g=e,g.parentNode.removeChild(g.nextSibling);
for(;g.nextSibling&&g.nextSibling.nodeType===Node.TEXT_NODE;)e=g.nextSibling,g.appendData(e.data),g.parentNode.removeChild(e);return{textNode:g,offset:l}};this.fixCursorPositions=function(){Object.keys(B).forEach(function(b){var d=B[b],c=g(d.getNode()),f=a.createRootFilter(c),l,h,r,m=!1;r=d.getSelectedRange();l=e(r.startContainer,r.startOffset,c);h=n(r.startContainer,r.startOffset,[t,f],l);r.collapsed?c=h:(l=e(r.endContainer,r.endOffset,c),c=n(r.endContainer,r.endOffset,[t,f],l));h.isStep()&&c.isStep()?
h.container()!==c.container()||h.offset()!==c.offset()||r.collapsed&&d.getAnchorNode()===d.getNode()||(m=!0,r.setStart(h.container(),h.offset()),r.collapse(!0)):(m=!0,runtime.assert(h.roundToClosestStep(),"No walkable step found for cursor owned by "+b),r.setStart(h.container(),h.offset()),runtime.assert(c.roundToClosestStep(),"No walkable step found for cursor owned by "+b),r.setEnd(c.container(),c.offset()));m&&(d.setSelectedRange(r,d.hasForwardSelection()),a.emit(ops.Document.signalCursorMoved,
d))})};this.getCursorPosition=function(a){return(a=B[a])?x.convertDomPointToSteps(a.getNode(),0):0};this.getCursorSelection=function(a){a=B[a];var b=0,d=0;a&&(b=x.convertDomPointToSteps(a.getNode(),0),d=x.convertDomPointToSteps(a.getAnchorNode(),0));return{position:d,length:b-d}};this.getPositionFilter=function(){return t};this.getOdfCanvas=function(){return h};this.getCanvas=function(){return h};this.getRootNode=c;this.addMember=function(a){runtime.assert(void 0===y[a.getMemberId()],"This member already exists");
y[a.getMemberId()]=a};this.getMember=function(a){return y.hasOwnProperty(a)?y[a]:null};this.removeMember=function(a){delete y[a]};this.getCursor=function(a){return B[a]};this.getMemberIds=function(){var a=[],b;for(b in B)B.hasOwnProperty(b)&&a.push(B[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(!B[d],"OdtDocument::addCursor is adding a duplicate cursor with memberid "+d);b.setSelectedRange(c,!0);B[d]=b};this.removeCursor=function(b){var d=B[b];return d?(d.removeFromDocument(),delete B[b],a.emit(ops.Document.signalCursorRemoved,b),!0):!1};this.moveCursor=function(b,d,c,e){b=B[b];d=a.convertCursorToDomRange(d,c);b&&(b.setSelectedRange(d,0<=c),b.setSelectionType(e||ops.OdtCursor.RangeSelection))};this.getFormatting=function(){return h.getFormatting()};this.emit=function(a,b){D.emit(a,
b)};this.subscribe=function(a,b){D.subscribe(a,b)};this.unsubscribe=function(a,b){D.unsubscribe(a,b)};this.createRootFilter=function(a){return new RootFilter(a,B,g)};this.close=function(a){a()};this.destroy=function(a){a()};(function(){var a=c();t=new ops.TextPositionFilter;d=new odf.StepUtils;x=new ops.OdtStepsTranslator(a,k(a),t,500);D.subscribe(ops.OdtDocument.signalStepsInserted,x.handleStepsInserted);D.subscribe(ops.OdtDocument.signalStepsRemoved,x.handleStepsRemoved);D.subscribe(ops.OdtDocument.signalOperationEnd,
q);D.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.OdtDocument.signalAnnotationAdded="annotation/added";ops.OpAddAnnotation=function(){function h(b,c,f){var e=b.getTextNodeAtStep(f,k);e&&(b=e.textNode,f=b.parentNode,e.offset!==b.length&&b.splitText(e.offset),f.insertBefore(c,b.nextSibling),0===b.length&&f.removeChild(b))}var k,c,b,g,n,p;this.init=function(h){k=h.memberid;c=parseInt(h.timestamp,10);b=parseInt(h.position,10);g=void 0!==h.length?parseInt(h.length,10)||0:void 0;n=h.name};this.isEdit=!0;this.group=void 0;this.execute=function(m){var q=m.getCursor(k),f,e;p=m.getDOMDocument();var a=new Date(c),
d,r,l;d=p.createElementNS(odf.Namespaces.officens,"office:annotation");d.setAttributeNS(odf.Namespaces.officens,"office:name",n);f=p.createElementNS(odf.Namespaces.dcns,"dc:creator");f.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k);f.textContent=m.getMember(k).getProperties().fullName;e=p.createElementNS(odf.Namespaces.dcns,"dc:date");e.appendChild(p.createTextNode(a.toISOString()));a=p.createElementNS(odf.Namespaces.textns,"text:list");r=p.createElementNS(odf.Namespaces.textns,
"text:list-item");l=p.createElementNS(odf.Namespaces.textns,"text:p");r.appendChild(l);a.appendChild(r);d.appendChild(f);d.appendChild(e);d.appendChild(a);void 0!==g&&(f=p.createElementNS(odf.Namespaces.officens,"office:annotation-end"),f.setAttributeNS(odf.Namespaces.officens,"office:name",n),d.annotationEndElement=f,h(m,f,b+g));h(m,d,b);m.emit(ops.OdtDocument.signalStepsInserted,{position:b});q&&(f=p.createRange(),e=d.getElementsByTagNameNS(odf.Namespaces.textns,"p")[0],f.selectNodeContents(e),
q.setSelectedRange(f,!1),q.setSelectionType(ops.OdtCursor.RangeSelection),m.emit(ops.Document.signalCursorMoved,q));m.getOdfCanvas().addAnnotation(d);m.fixCursorPositions();m.emit(ops.OdtDocument.signalAnnotationAdded,{memberId:k,annotation:d});return!0};this.spec=function(){return{optype:"AddAnnotation",memberid:k,timestamp:c,position:b,length:g,name:n}}};ops.OpAddCursor=function(){var h,k;this.init=function(c){h=c.memberid;k=c.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(c){var b=c.getCursor(h);if(b)return!1;b=new ops.OdtCursor(h,c);c.addCursor(b);c.emit(ops.Document.signalCursorAdded,b);return!0};this.spec=function(){return{optype:"AddCursor",memberid:h,timestamp:k}}};ops.OpAddMember=function(){var h,k,c;this.init=function(b){h=b.memberid;k=parseInt(b.timestamp,10);c=b.setProperties};this.isEdit=!1;this.group=void 0;this.execute=function(b){var g;if(b.getMember(h))return!1;g=new ops.Member(h,c);b.addMember(g);b.emit(ops.Document.signalMemberAdded,g);return!0};this.spec=function(){return{optype:"AddMember",memberid:h,timestamp:k,setProperties:c}}};ops.OpAddStyle=function(){var h,k,c,b,g,n,p=odf.Namespaces.stylens;this.init=function(m){h=m.memberid;k=m.timestamp;c=m.styleName;b=m.styleFamily;g="true"===m.isAutomaticStyle||!0===m.isAutomaticStyle;n=m.setProperties};this.isEdit=!0;this.group=void 0;this.execute=function(h){var k=h.getOdfCanvas().odfContainer(),f=h.getFormatting(),e=h.getDOMDocument().createElementNS(p,"style:style");if(!e)return!1;n&&f.updateStyle(e,n);e.setAttributeNS(p,"style:family",b);e.setAttributeNS(p,"style:name",c);g?
k.rootElement.automaticStyles.appendChild(e):k.rootElement.styles.appendChild(e);h.getOdfCanvas().refreshCSS();g||h.emit(ops.OdtDocument.signalCommonStyleCreated,{name:c,family:b});return!0};this.spec=function(){return{optype:"AddStyle",memberid:h,timestamp:k,styleName:c,styleFamily:b,isAutomaticStyle:g,setProperties:n}}};odf.ObjectNameGenerator=function(h,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={};[h.rootElement.automaticStyles,h.rootElement.styles].forEach(function(b){for(b=b.firstElementChild;b;)b.namespaceURI===g&&"style"===b.localName&&(a[b.getAttributeNS(g,"name")]=!0),b=b.nextElementSibling});return a}var g=odf.Namespaces.stylens,n=odf.Namespaces.drawns,p=odf.Namespaces.xlinkns,m=(new core.Utils).hashString(k),
q=null,f=null,e=null,a={},d={};this.generateStyleName=function(){null===q&&(q=new c("auto"+m+"_",function(){return b()}));return q.generateName()};this.generateFrameName=function(){var b,d,e;if(null===f){d=h.rootElement.body.getElementsByTagNameNS(n,"frame");for(b=0;b<d.length;b+=1)e=d.item(b),a[e.getAttributeNS(n,"name")]=!0;f=new c("fr"+m+"_",function(){return a})}return f.generateName()};this.generateImageName=function(){var a,b,f;if(null===e){f=h.rootElement.body.getElementsByTagNameNS(n,"image");
for(a=0;a<f.length;a+=1)b=f.item(a),b=b.getAttributeNS(p,"href"),b=b.substring(9,b.lastIndexOf(".")),d[b]=!0;e=new c("img"+m+"_",function(){return d})}return e.generateName()}};odf.TextStyleApplicator=function(h,k,c){function b(b){function c(a,b){return"object"===typeof a&&"object"===typeof b?Object.keys(a).every(function(f){return c(a[f],b[f])}):a===b}var a={};this.isStyleApplied=function(d){d=k.getAppliedStylesForElement(d,a).styleProperties;return c(b,d)}}function g(b){var e={};this.applyStyleToContainer=function(a){var d;d=a.getAttributeNS(m,"style-name");var g=a.ownerDocument;d=d||"";if(!e.hasOwnProperty(d)){var l=d,n;n=d?k.createDerivedStyleObject(d,"text",b):b;g=
g.createElementNS(q,"style:style");k.updateStyle(g,n);g.setAttributeNS(q,"style:name",h.generateStyleName());g.setAttributeNS(q,"style:family","text");g.setAttributeNS("urn:webodf:names:scope","scope","document-content");c.appendChild(g);e[l]=g}d=e[d].getAttributeNS(q,"name");a.setAttributeNS(m,"text:style-name",d)}}function n(b,c){var a=b.ownerDocument,d=b.parentNode,g,l,h,n=new core.LoopWatchDog(1E4);l=[];l.push(b);for(h=b.nextSibling;h&&p.rangeContainsNode(c,h);)n.check(),l.push(h),h=h.nextSibling;
"span"!==d.localName||d.namespaceURI!==m?(g=a.createElementNS(m,"text:span"),d.insertBefore(g,b),a=!1):(b.previousSibling&&!p.rangeContainsNode(c,d.firstChild)?(g=d.cloneNode(!1),d.parentNode.insertBefore(g,d.nextSibling)):g=d,a=!0);l.forEach(function(a){a.parentNode!==g&&g.appendChild(a)});if(h&&a)for(l=g.cloneNode(!1),g.parentNode.insertBefore(l,g.nextSibling);h;)n.check(),a=h.nextSibling,l.appendChild(h),h=a;return g}var p=core.DomUtils,m=odf.Namespaces.textns,q=odf.Namespaces.stylens;this.applyStyle=
function(c,e,a){var d={},h,l,m,k;runtime.assert(a&&a.hasOwnProperty("style:text-properties"),"applyStyle without any text properties");d["style:text-properties"]=a["style:text-properties"];m=new g(d);k=new b(d);c.forEach(function(a){h=k.isStyleApplied(a);!1===h&&(l=n(a,e),m.applyStyleToContainer(l))})}};ops.OpApplyDirectStyling=function(){function h(b,c,e){var a=b.getOdfCanvas().odfContainer(),d=m.splitBoundaries(c),g=p.getTextNodes(c,!1);(new odf.TextStyleApplicator(new odf.ObjectNameGenerator(a,k),b.getFormatting(),a.rootElement.automaticStyles)).applyStyle(g,c,e);d.forEach(m.normalizeTextNodes)}var k,c,b,g,n,p=odf.OdfUtils,m=core.DomUtils;this.init=function(h){k=h.memberid;c=h.timestamp;b=parseInt(h.position,10);g=parseInt(h.length,10);n=h.setProperties};this.isEdit=!0;this.group=void 0;this.execute=
function(m){var f=m.convertCursorToDomRange(b,g),e=p.getParagraphElements(f);h(m,f,n);f.detach();m.getOdfCanvas().refreshCSS();m.fixCursorPositions();e.forEach(function(a){m.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:a,memberId:k,timeStamp:c})});m.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"ApplyDirectStyling",memberid:k,timestamp:c,position:b,length:g,setProperties:n}}};ops.OpApplyHyperlink=function(){function h(b){for(;b;){if(m.isHyperlink(b))return!0;b=b.parentNode}return!1}var k,c,b,g,n,p=core.DomUtils,m=odf.OdfUtils;this.init=function(h){k=h.memberid;c=h.timestamp;b=h.position;g=h.length;n=h.hyperlink};this.isEdit=!0;this.group=void 0;this.execute=function(q){var f=q.getDOMDocument(),e=q.convertCursorToDomRange(b,g),a=p.splitBoundaries(e),d=[],r=m.getTextNodes(e,!1);if(0===r.length)return!1;r.forEach(function(a){var b=m.getParagraphElement(a);runtime.assert(!1===
h(a),"The given range should not contain any link.");var c=n,e=f.createElementNS(odf.Namespaces.textns,"text:a");e.setAttributeNS(odf.Namespaces.xlinkns,"xlink:type","simple");e.setAttributeNS(odf.Namespaces.xlinkns,"xlink:href",c);a.parentNode.insertBefore(e,a);e.appendChild(a);-1===d.indexOf(b)&&d.push(b)});a.forEach(p.normalizeTextNodes);e.detach();q.fixCursorPositions();q.getOdfCanvas().refreshSize();q.getOdfCanvas().rerenderAnnotations();d.forEach(function(a){q.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:g,hyperlink:n}}};ops.OpInsertImage=function(){var h,k,c,b,g,n,p,m,q=odf.Namespaces.drawns,f=odf.Namespaces.svgns,e=odf.Namespaces.textns,a=odf.Namespaces.xlinkns,d=odf.OdfUtils;this.init=function(a){h=a.memberid;k=a.timestamp;c=a.position;b=a.filename;g=a.frameWidth;n=a.frameHeight;p=a.frameStyleName;m=a.frameName};this.isEdit=!0;this.group=void 0;this.execute=function(r){var l=r.getOdfCanvas(),B=r.getTextNodeAtStep(c,h),y,D;if(!B)return!1;y=B.textNode;D=d.getParagraphElement(y);var B=B.offset!==y.length?y.splitText(B.offset):
y.nextSibling,z=r.getDOMDocument(),t=z.createElementNS(q,"draw:image"),z=z.createElementNS(q,"draw:frame");t.setAttributeNS(a,"xlink:href",b);t.setAttributeNS(a,"xlink:type","simple");t.setAttributeNS(a,"xlink:show","embed");t.setAttributeNS(a,"xlink:actuate","onLoad");z.setAttributeNS(q,"draw:style-name",p);z.setAttributeNS(q,"draw:name",m);z.setAttributeNS(e,"text:anchor-type","as-char");z.setAttributeNS(f,"svg:width",g);z.setAttributeNS(f,"svg:height",n);z.appendChild(t);y.parentNode.insertBefore(z,
B);r.emit(ops.OdtDocument.signalStepsInserted,{position:c});0===y.length&&y.parentNode.removeChild(y);l.addCssForFrameWithImage(z);l.refreshCSS();r.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:D,memberId:h,timeStamp:k});l.rerenderAnnotations();return!0};this.spec=function(){return{optype:"InsertImage",memberid:h,timestamp:k,filename:b,position:c,frameWidth:g,frameHeight:n,frameStyleName:p,frameName:m}}};ops.OpInsertTable=function(){function h(a,d){var c;if(1===f.length)c=f[0];else if(3===f.length)switch(a){case 0:c=f[0];break;case b-1:c=f[2];break;default:c=f[1]}else c=f[a];if(1===c.length)return c[0];if(3===c.length)switch(d){case 0:return c[0];case g-1:return c[2];default:return c[1]}return c[d]}var k,c,b,g,n,p,m,q,f,e=odf.OdfUtils;this.init=function(a){k=a.memberid;c=a.timestamp;n=a.position;b=a.initialRows;g=a.initialColumns;p=a.tableName;m=a.tableStyleName;q=a.tableColumnStyleName;f=a.tableCellStyleMatrix};
this.isEdit=!0;this.group=void 0;this.execute=function(a){var d=a.getTextNodeAtStep(n),f=a.getRootNode();if(d){var l=a.getDOMDocument(),B=l.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table"),y=l.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-column"),D,z,t,x;m&&B.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",m);p&&B.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:name",p);y.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0",
"table:number-columns-repeated",g);q&&y.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",q);B.appendChild(y);for(t=0;t<b;t+=1){y=l.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-row");for(x=0;x<g;x+=1)D=l.createElementNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:table-cell"),(z=h(t,x))&&D.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:table:1.0","table:style-name",z),z=l.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0",
"text:p"),D.appendChild(z),y.appendChild(D);B.appendChild(y)}d=e.getParagraphElement(d.textNode);f.insertBefore(B,d.nextSibling);a.emit(ops.OdtDocument.signalStepsInserted,{position:n});a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalTableAdded,{tableElement:B,memberId:k,timeStamp:c});a.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertTable",memberid:k,timestamp:c,position:n,initialRows:b,initialColumns:g,tableName:p,tableStyleName:m,tableColumnStyleName:q,
tableCellStyleMatrix:f}}};ops.OpInsertText=function(){function h(b){return"\t"!==b&&p.isODFWhitespace(b)}var k,c,b,g,n,p=odf.OdfUtils;this.init=function(h){k=h.memberid;c=h.timestamp;b=h.position;n=h.text;g="true"===h.moveCursor||!0===h.moveCursor};this.isEdit=!0;this.group=void 0;this.execute=function(m){var q,f,e,a=null,d=m.getDOMDocument(),r,l=0,B,y=m.getCursor(k),D;m.upgradeWhitespacesAtPosition(b);if(q=m.getTextNodeAtStep(b)){f=q.textNode;a=f.nextSibling;e=f.parentNode;r=p.getParagraphElement(f);for(D=0;D<n.length;D+=
1){if(!(B="\t"===n[D])){B=n;var z=D;B=h(B[z])&&(0===z||z===B.length-1||h(B[z-1]))}B&&(0===l?(q.offset!==f.length&&(a=f.splitText(q.offset)),0<D&&f.appendData(n.substring(0,D))):l<D&&(l=n.substring(l,D),e.insertBefore(d.createTextNode(l),a)),l=D+1,"\t"===n[D]?(B=d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:tab"),B.appendChild(d.createTextNode("\t"))):(" "!==n[D]&&runtime.log("WARN: InsertText operation contains non-tab, non-space whitespace character (character code "+n.charCodeAt(D)+
")"),B=d.createElementNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:s"),B.appendChild(d.createTextNode(" "))),e.insertBefore(B,a))}0===l?f.insertData(q.offset,n):l<n.length&&(q=n.substring(l),e.insertBefore(d.createTextNode(q),a));e=f.parentNode;a=f.nextSibling;e.removeChild(f);e.insertBefore(f,a);0===f.length&&f.parentNode.removeChild(f);m.emit(ops.OdtDocument.signalStepsInserted,{position:b});y&&g&&(m.moveCursor(k,b+n.length,0),m.emit(ops.Document.signalCursorMoved,y));m.downgradeWhitespacesAtPosition(b);
m.downgradeWhitespacesAtPosition(b+n.length);m.getOdfCanvas().refreshSize();m.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:k,timeStamp:c});m.getOdfCanvas().rerenderAnnotations();return!0}return!1};this.spec=function(){return{optype:"InsertText",memberid:k,timestamp:c,position:b,text:n,moveCursor:g}}};odf.CollapsingRules=function(h){function k(c){return b.isODFNode(c)||"br"===c.localName&&b.isLineBreak(c.parentNode)||c.nodeType===Node.TEXT_NODE&&b.isODFNode(c.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}function c(n){var p;n.nodeType===Node.TEXT_NODE?(p=n.parentNode,p.removeChild(n)):p=g.removeUnwantedNodes(n,k);if(n=p)n=p,n=!b.isParagraph(n)&&n!==h&&b.hasNoODFContent(n);return n?c(p):p}var b=odf.OdfUtils,g=core.DomUtils;this.mergeChildrenIntoParent=c};ops.OpMergeParagraph=function(){function h(a){return odf.OdfUtils.isInlineRoot(a)?NodeFilter.FILTER_SKIP:e.isGroupingElement(a)&&e.hasNoODFContent(a)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}function k(a){if(a.nodeType===Node.TEXT_NODE){if(0===a.length)return runtime.log("WARN: Empty text node found during merge operation"),!0;if(e.isODFWhitespace(a.data)&&!1===e.isSignificantWhitespace(a,0))return!0;a="#text"}else a=(a.prefix?a.prefix+":":"")+a.localName;runtime.log("WARN: Unexpected text element found near paragraph boundary ["+
a+"]");return!1}function c(b){b.collapsed||(a.splitBoundaries(b),b=e.getTextElements(b,!1,!0).filter(k),b.forEach(function(a){a.parentNode.removeChild(a)}))}function b(a,b,d){a=a.convertCursorStepToDomPoint(b);var c=e.getParagraphElement(a.node,a.offset);runtime.assert(Boolean(c),"Paragraph not found at step "+b);d&&d.setPosition(a.node,a.offset);return c}var g,n,p,m,q,f,e=odf.OdfUtils,a=core.DomUtils,d=odf.Namespaces.textns;this.init=function(a){g=a.memberid;n=a.timestamp;p=a.moveCursor;m=a.paragraphStyleName;
q=parseInt(a.sourceStartPosition,10);f=parseInt(a.destinationStartPosition,10)};this.isEdit=!0;this.group=void 0;this.execute=function(e){var l,k,y=e.getCursor(g);l=e.getRootNode();var D=new odf.CollapsingRules(l),z=e.createStepIterator(l,0,[e.getPositionFilter()],l),t;runtime.assert(f<q,"Destination paragraph ("+f+") must be before source paragraph ("+q+")");k=b(e,f);l=b(e,q,z);z.previousStep();runtime.assert(a.containsNode(k,z.container()),"Destination paragraph must be adjacent to the source paragraph");
t=k.ownerDocument.createRange();z.setPosition(k,k.childNodes.length);z.roundToPreviousStep();t.setStart(z.container(),z.offset());t.setEnd(k,k.childNodes.length);c(t);t=k.childNodes.length;var x=l.ownerDocument.createRange();z.setPosition(l,0);z.roundToNextStep();x.setStart(l,0);x.setEnd(z.container(),z.offset());c(x);for(x=l.firstChild;x;)"editinfo"===x.localName?l.removeChild(x):(k.appendChild(x),a.removeUnwantedNodes(x,h)),x=l.firstChild;runtime.assert(0===l.childNodes.length,"Source paragraph should be empty before it is removed");
D.mergeChildrenIntoParent(l);e.emit(ops.OdtDocument.signalStepsRemoved,{position:q-1});z.setPosition(k,t);z.roundToClosestStep();z.previousStep()||z.roundToNextStep();e.downgradeWhitespaces(z);m?k.setAttributeNS(d,"text:style-name",m):k.removeAttributeNS(d,"style-name");y&&p&&(e.moveCursor(g,q-1,0),e.emit(ops.Document.signalCursorMoved,y));e.fixCursorPositions();e.getOdfCanvas().refreshSize();e.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:k,memberId:g,timeStamp:n});e.getOdfCanvas().rerenderAnnotations();
return!0};this.spec=function(){return{optype:"MergeParagraph",memberid:g,timestamp:n,moveCursor:p,paragraphStyleName:m,sourceStartPosition:q,destinationStartPosition:f}}};ops.OpMoveCursor=function(){var h,k,c,b,g;this.init=function(n){h=n.memberid;k=n.timestamp;c=n.position;b=n.length||0;g=n.selectionType||ops.OdtCursor.RangeSelection};this.isEdit=!1;this.group=void 0;this.execute=function(n){var k=n.getCursor(h),m;if(!k)return!1;m=n.convertCursorToDomRange(c,b);k.setSelectedRange(m,0<=b);k.setSelectionType(g);n.emit(ops.Document.signalCursorMoved,k);return!0};this.spec=function(){return{optype:"MoveCursor",memberid:h,timestamp:k,position:c,length:b,selectionType:g}}};ops.OpRemoveAnnotation=function(){var h,k,c,b,g=core.DomUtils;this.init=function(g){h=g.memberid;k=g.timestamp;c=parseInt(g.position,10);b=parseInt(g.length,10)};this.isEdit=!0;this.group=void 0;this.execute=function(b){function h(b){k.parentNode.insertBefore(b,k)}for(var m=b.getIteratorAtPosition(c).container(),k;m.namespaceURI!==odf.Namespaces.officens||"annotation"!==m.localName;)m=m.parentNode;if(null===m)return!1;k=m;m=k.annotationEndElement;b.getOdfCanvas().forgetAnnotation(k);g.getElementsByTagNameNS(k,
"urn:webodf:names:cursor","cursor").forEach(h);g.getElementsByTagNameNS(k,"urn:webodf:names:cursor","anchor").forEach(h);k.parentNode.removeChild(k);m&&m.parentNode.removeChild(m);b.emit(ops.OdtDocument.signalStepsRemoved,{position:0<c?c-1:c});b.getOdfCanvas().rerenderAnnotations();b.fixCursorPositions();return!0};this.spec=function(){return{optype:"RemoveAnnotation",memberid:h,timestamp:k,position:c,length:b}}};ops.OpRemoveBlob=function(){var h,k,c;this.init=function(b){h=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:h,timestamp:k,filename:c}}};ops.OpRemoveCursor=function(){var h,k;this.init=function(c){h=c.memberid;k=c.timestamp};this.isEdit=!1;this.group=void 0;this.execute=function(c){return c.removeCursor(h)?!0:!1};this.spec=function(){return{optype:"RemoveCursor",memberid:h,timestamp:k}}};ops.OpRemoveHyperlink=function(){var h,k,c,b,g=core.DomUtils,n=odf.OdfUtils;this.init=function(g){h=g.memberid;k=g.timestamp;c=g.position;b=g.length};this.isEdit=!0;this.group=void 0;this.execute=function(p){var m=p.convertCursorToDomRange(c,b),q=n.getHyperlinkElements(m);runtime.assert(1===q.length,"The given range should only contain a single link.");q=g.mergeIntoParent(q[0]);m.detach();p.fixCursorPositions();p.getOdfCanvas().refreshSize();p.getOdfCanvas().rerenderAnnotations();p.emit(ops.OdtDocument.signalParagraphChanged,
{paragraphElement:n.getParagraphElement(q),memberId:h,timeStamp:k});return!0};this.spec=function(){return{optype:"RemoveHyperlink",memberid:h,timestamp:k,position:c,length:b}}};ops.OpRemoveMember=function(){var h,k;this.init=function(c){h=c.memberid;k=parseInt(c.timestamp,10)};this.isEdit=!1;this.group=void 0;this.execute=function(c){if(!c.getMember(h))return!1;c.removeMember(h);c.emit(ops.Document.signalMemberRemoved,h);return!0};this.spec=function(){return{optype:"RemoveMember",memberid:h,timestamp:k}}};ops.OpRemoveStyle=function(){var h,k,c,b;this.init=function(g){h=g.memberid;k=g.timestamp;c=g.styleName;b=g.styleFamily};this.isEdit=!0;this.group=void 0;this.execute=function(g){var h=g.getFormatting().getStyleElement(c,b);if(!h)return!1;h.parentNode.removeChild(h);g.getOdfCanvas().refreshCSS();g.emit(ops.OdtDocument.signalCommonStyleDeleted,{name:c,family:b});return!0};this.spec=function(){return{optype:"RemoveStyle",memberid:h,timestamp:k,styleName:c,styleFamily:b}}};ops.OpRemoveText=function(){var h,k,c,b,g=odf.OdfUtils,n=core.DomUtils;this.init=function(g){runtime.assert(0<=g.length,"OpRemoveText only supports positive lengths");h=g.memberid;k=g.timestamp;c=parseInt(g.position,10);b=parseInt(g.length,10)};this.isEdit=!0;this.group=void 0;this.execute=function(p){var m,q,f,e=p.getCursor(h),a=new odf.CollapsingRules(p.getRootNode());p.upgradeWhitespacesAtPosition(c);p.upgradeWhitespacesAtPosition(c+b);m=p.convertCursorToDomRange(c,b);n.splitBoundaries(m);q=g.getTextElements(m,
!1,!0);f=g.getParagraphElement(m.startContainer,m.startOffset);runtime.assert(void 0!==f,"Attempting to remove text outside a paragraph element");m.detach();q.forEach(function(b){b.parentNode?(runtime.assert(n.containsNode(f,b),"RemoveText only supports removing elements within the same paragraph"),a.mergeChildrenIntoParent(b)):runtime.log("WARN: text element has already been removed from it's container")});p.emit(ops.OdtDocument.signalStepsRemoved,{position:c});p.downgradeWhitespacesAtPosition(c);
p.fixCursorPositions();p.getOdfCanvas().refreshSize();p.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:f,memberId:h,timeStamp:k});e&&(e.resetSelectionType(),p.emit(ops.Document.signalCursorMoved,e));p.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"RemoveText",memberid:h,timestamp:k,position:c,length:b}}};ops.OpSetBlob=function(){var h,k,c,b,g;this.init=function(n){h=n.memberid;k=n.timestamp;c=n.filename;b=n.mimetype;g=n.content};this.isEdit=!0;this.group=void 0;this.execute=function(h){h.getOdfCanvas().odfContainer().setBlob(c,b,g);return!0};this.spec=function(){return{optype:"SetBlob",memberid:h,timestamp:k,filename:c,mimetype:b,content:g}}};ops.OpSetParagraphStyle=function(){function h(b,c,g){var f=[b.getPositionFilter()],e=g.container();g=g.unfilteredDomOffset();return!1===b.createStepIterator(e,g,f,c).previousStep()}var k,c,b,g,n=odf.OdfUtils;this.init=function(h){k=h.memberid;c=h.timestamp;b=h.position;g=h.styleName};this.isEdit=!0;this.group=void 0;this.execute=function(p){var m,q;m=p.getIteratorAtPosition(b);return(q=n.getParagraphElement(m.container()))?(runtime.assert(h(p,q,m),"SetParagraphStyle position should be the first position in the paragraph"),
g?q.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","text:style-name",g):q.removeAttributeNS("urn:oasis:names:tc:opendocument:xmlns:text:1.0","style-name"),p.getOdfCanvas().refreshSize(),p.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:q,timeStamp:c,memberId:k}),p.getOdfCanvas().rerenderAnnotations(),!0):!1};this.spec=function(){return{optype:"SetParagraphStyle",memberid:k,timestamp:c,position:b,styleName:g}}};ops.OpSplitParagraph=function(){var h,k,c,b,g,n,p=odf.OdfUtils,m=odf.Namespaces.textns;this.init=function(m){h=m.memberid;k=m.timestamp;b=m.position;c=m.sourceParagraphPosition;n=m.paragraphStyleName;g="true"===m.moveCursor||!0===m.moveCursor};this.isEdit=!0;this.group=void 0;this.execute=function(c){var f,e,a,d,r,l,B,y=c.getCursor(h);c.upgradeWhitespacesAtPosition(b);f=c.getTextNodeAtStep(b);if(!f)return!1;e=p.getParagraphElement(f.textNode);if(!e)return!1;a=p.isListItem(e.parentNode)?e.parentNode:
e;0===f.offset?(B=f.textNode.previousSibling,l=null):(B=f.textNode,l=f.offset>=f.textNode.length?null:f.textNode.splitText(f.offset));for(d=f.textNode;d!==a;){d=d.parentNode;r=d.cloneNode(!1);l&&r.appendChild(l);if(B)for(;B&&B.nextSibling;)r.appendChild(B.nextSibling);else for(;d.firstChild;)r.appendChild(d.firstChild);d.parentNode.insertBefore(r,d.nextSibling);B=d;l=r}p.isListItem(l)&&(l=l.childNodes.item(0));n?l.setAttributeNS(m,"text:style-name",n):l.removeAttributeNS(m,"style-name");0===f.textNode.length&&
f.textNode.parentNode.removeChild(f.textNode);c.emit(ops.OdtDocument.signalStepsInserted,{position:b});y&&g&&(c.moveCursor(h,b+1,0),c.emit(ops.Document.signalCursorMoved,y));c.fixCursorPositions();c.getOdfCanvas().refreshSize();c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:e,memberId:h,timeStamp:k});c.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:l,memberId:h,timeStamp:k});c.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",
memberid:h,timestamp:k,position:b,sourceParagraphPosition:c,paragraphStyleName:n,moveCursor:g}}};ops.OpUpdateMember=function(){function h(c){var g="//dc:creator[@editinfo:memberid='"+k+"']";c=xmldom.XPath.getODFElementsWithXPath(c.getRootNode(),g,function(b){return"editinfo"===b?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(b)});for(g=0;g<c.length;g+=1)c[g].textContent=b.fullName}var k,c,b,g;this.init=function(h){k=h.memberid;c=parseInt(h.timestamp,10);b=h.setProperties;g=h.removedProperties};this.isEdit=!1;this.group=void 0;this.execute=function(c){var p=c.getMember(k);if(!p)return!1;
g&&p.removeProperties(g);b&&(p.setProperties(b),b.fullName&&h(c));c.emit(ops.Document.signalMemberUpdated,p);return!0};this.spec=function(){return{optype:"UpdateMember",memberid:k,timestamp:c,setProperties:b,removedProperties:g}}};ops.OpUpdateMetadata=function(){var h,k,c,b;this.init=function(g){h=g.memberid;k=parseInt(g.timestamp,10);c=g.setProperties;b=g.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(g){var h=g.getOdfCanvas().odfContainer(),k=null;b&&(k=b.attributes.split(","));h.setMetadata(c,k);g.emit(ops.OdtDocument.signalMetadataUpdated,{setProperties:null!==c?c:{},removedProperties:null!==k?k:[]});return!0};this.spec=function(){return{optype:"UpdateMetadata",memberid:h,timestamp:k,setProperties:c,
removedProperties:b}}};ops.OpUpdateParagraphStyle=function(){function h(b,c){var f,e,a=c?c.split(","):[];for(f=0;f<a.length;f+=1)e=a[f].split(":"),b.removeAttributeNS(odf.Namespaces.lookupNamespaceURI(e[0]),e[1])}var k,c,b,g,n,p=odf.Namespaces.stylens;this.init=function(h){k=h.memberid;c=h.timestamp;b=h.styleName;g=h.setProperties;n=h.removedProperties};this.isEdit=!0;this.group=void 0;this.execute=function(c){var k=c.getFormatting(),f,e,a;return(f=""!==b?k.getStyleElement(b,"paragraph"):k.getDefaultStyleElement("paragraph"))?
(e=f.getElementsByTagNameNS(p,"paragraph-properties").item(0),a=f.getElementsByTagNameNS(p,"text-properties").item(0),g&&k.updateStyle(f,g),n&&(k=n["style:paragraph-properties"],e&&k&&(h(e,k.attributes),0===e.attributes.length&&f.removeChild(e)),k=n["style:text-properties"],a&&k&&(h(a,k.attributes),0===a.attributes.length&&f.removeChild(a)),h(f,n.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:g,removedProperties:n}}};ops.OperationFactory=function(){function h(c){return function(b){return new c}}var k;this.register=function(c,b){k[c]=b};this.create=function(c){var b=null,g=k[c.optype];g&&(b=g(c),b.init(c));return b};k={AddMember:h(ops.OpAddMember),UpdateMember:h(ops.OpUpdateMember),RemoveMember:h(ops.OpRemoveMember),AddCursor:h(ops.OpAddCursor),ApplyDirectStyling:h(ops.OpApplyDirectStyling),SetBlob:h(ops.OpSetBlob),RemoveBlob:h(ops.OpRemoveBlob),InsertImage:h(ops.OpInsertImage),InsertTable:h(ops.OpInsertTable),
InsertText:h(ops.OpInsertText),RemoveText:h(ops.OpRemoveText),MergeParagraph:h(ops.OpMergeParagraph),SplitParagraph:h(ops.OpSplitParagraph),SetParagraphStyle:h(ops.OpSetParagraphStyle),UpdateParagraphStyle:h(ops.OpUpdateParagraphStyle),AddStyle:h(ops.OpAddStyle),RemoveStyle:h(ops.OpRemoveStyle),MoveCursor:h(ops.OpMoveCursor),RemoveCursor:h(ops.OpRemoveCursor),AddAnnotation:h(ops.OpAddAnnotation),RemoveAnnotation:h(ops.OpRemoveAnnotation),UpdateMetadata:h(ops.OpUpdateMetadata),ApplyHyperlink:h(ops.OpApplyHyperlink),
RemoveHyperlink:h(ops.OpRemoveHyperlink)}};ops.OperationRouter=function(){};ops.OperationRouter.prototype.setOperationFactory=function(h){};ops.OperationRouter.prototype.setPlaybackFunction=function(h){};ops.OperationRouter.prototype.push=function(h){};ops.OperationRouter.prototype.close=function(h){};ops.OperationRouter.prototype.subscribe=function(h,k){};ops.OperationRouter.prototype.unsubscribe=function(h,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 h=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(g){b+=1;h.emit(ops.OperationRouter.signalProcessingBatchStart,{});g.forEach(function(g){g=g.spec();g.timestamp=Date.now();g=k.create(g);g.group="g"+b;c(g)});h.emit(ops.OperationRouter.signalProcessingBatchEnd,{})};this.close=function(b){b()};
this.subscribe=function(b,c){h.subscribe(b,c)};this.unsubscribe=function(b,c){h.unsubscribe(b,c)};this.hasLocalUnsyncedOps=function(){return!1};this.hasSessionHostConnection=function(){return!0}};ops.Session=function(h){function k(b){g.emit(ops.OdtDocument.signalProcessingBatchStart,b)}function c(b){g.emit(ops.OdtDocument.signalProcessingBatchEnd,b)}var b=new ops.OperationFactory,g=new ops.OdtDocument(h),n=null;this.setOperationFactory=function(c){b=c;n&&n.setOperationFactory(b)};this.setOperationRouter=function(h){n&&(n.unsubscribe(ops.OperationRouter.signalProcessingBatchStart,k),n.unsubscribe(ops.OperationRouter.signalProcessingBatchEnd,c));n=h;n.subscribe(ops.OperationRouter.signalProcessingBatchStart,
k);n.subscribe(ops.OperationRouter.signalProcessingBatchEnd,c);h.setPlaybackFunction(function(b){g.emit(ops.OdtDocument.signalOperationStart,b);return b.execute(g)?(g.emit(ops.OdtDocument.signalOperationEnd,b),!0):!1});h.setOperationFactory(b)};this.getOperationFactory=function(){return b};this.getOdtDocument=function(){return g};this.enqueue=function(b){n.push(b)};this.close=function(b){n.close(function(c){c?b(c):g.close(b)})};this.destroy=function(b){g.destroy(b)};this.setOperationRouter(new ops.TrivialOperationRouter)};gui.AnnotationController=function(h,k,c){function b(){var a=m.getCursor(c),a=a&&a.getNode(),b=!1;a&&(b=!e.isWithinAnnotation(a,m.getRootNode()));b!==q&&(q=b,f.emit(gui.AnnotationController.annotatableChanged,q))}function g(a){a.getMemberId()===c&&b()}function n(a){a===c&&b()}function p(a){a.getMemberId()===c&&b()}var m=h.getOdtDocument(),q=!1,f=new core.EventNotifier([gui.AnnotationController.annotatableChanged]),e=odf.OdfUtils,a=core.StepDirection.NEXT;this.isAnnotatable=function(){return q};this.addAnnotation=
function(){var a=new ops.OpAddAnnotation,b=m.getCursorSelection(c),e=b.length,b=b.position;q&&(0===e?e=void 0:(b=0<=e?b:b+e,e=Math.abs(e)),a.init({memberid:c,position:b,length:e,name:c+Date.now()}),h.enqueue([a]))};this.removeAnnotation=function(b){var f,g;f=m.getMember(c).getProperties().fullName;if(!0!==k.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)||f===e.getAnnotationCreator(b))f=m.convertDomPointToCursorStep(b,0,a),g=m.convertDomPointToCursorStep(b,b.childNodes.length),b=
new ops.OpRemoveAnnotation,b.init({memberid:c,position:f,length:g-f}),g=new ops.OpMoveCursor,g.init({memberid:c,position:0<f?f-1:f,length:0}),h.enqueue([b,g])};this.subscribe=function(a,b){f.subscribe(a,b)};this.unsubscribe=function(a,b){f.unsubscribe(a,b)};this.destroy=function(a){m.unsubscribe(ops.Document.signalCursorAdded,g);m.unsubscribe(ops.Document.signalCursorRemoved,n);m.unsubscribe(ops.Document.signalCursorMoved,p);a()};k.registerConstraint(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN);
m.subscribe(ops.Document.signalCursorAdded,g);m.subscribe(ops.Document.signalCursorRemoved,n);m.subscribe(ops.Document.signalCursorMoved,p);b()};gui.AnnotationController.annotatableChanged="annotatable/changed";gui.Avatar=function(h,k){var c=this,b,g,n;this.setColor=function(b){g.style.borderColor=b};this.setImageUrl=function(b){c.isVisible()?g.src=b:n=b};this.isVisible=function(){return"block"===b.style.display};this.show=function(){n&&(g.src=n,n=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){h.removeChild(b);c()};(function(){var c=h.ownerDocument;b=c.createElement("div");
g=c.createElement("img");b.appendChild(g);b.style.display=k?"block":"none";b.className="handle";h.appendChild(b)})()};gui.StepInfo=function(){};gui.StepInfo.VisualDirection={LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1};gui.StepInfo.prototype.container=function(){};gui.StepInfo.prototype.offset=function(){};gui.VisualStepScanner=function(){};gui.VisualStepScanner.prototype.process=function(h,k,c){};gui.GuiStepUtils=function(){function h(g){g=c.getContentBounds(g);var h,f=null;if(g)if(g.container.nodeType===Node.TEXT_NODE)h=g.container.ownerDocument.createRange(),h.setStart(g.container,g.startOffset),h.setEnd(g.container,g.endOffset),(f=0<h.getClientRects().length?h.getBoundingClientRect():null)&&" "===g.container.data.substring(g.startOffset,g.endOffset)&&1>=f.width&&(f=null),h.detach();else if(k.isCharacterElement(g.container)||k.isCharacterFrame(g.container))f=b.getBoundingClientRect(g.container);
return f}var k=odf.OdfUtils,c=new odf.StepUtils,b=core.DomUtils,g=core.StepDirection.NEXT,n=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,p=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=h;this.moveToFilteredStep=function(b,c,f){function e(a,b){b.process(z,l,B)&&(a=!0,!y&&b.token&&(y=b.token));return a}var a=c===g,d,k,l,B,y,D=b.snapshot();d=!1;var z;do d=h(b),z={token:b.snapshot(),container:b.container,offset:b.offset,direction:c,visualDirection:c===g?n:p},k=b.nextStep()?h(b):null,b.restore(z.token),
a?(l=d,B=k):(l=k,B=d),d=f.reduce(e,!1);while(!d&&b.advanceStep(c));d||f.forEach(function(a){!y&&a.token&&(y=a.token)});b.restore(y||D);return Boolean(y)}};gui.Caret=function(h,k,c,b){function g(){a.style.opacity="0"===a.style.opacity?"1":"0";w.trigger()}function n(){B.selectNodeContents(l);return B.getBoundingClientRect()}function p(a){return A[a]!==G[a]}function m(){Object.keys(G).forEach(function(a){A[a]=G[a]})}function q(){if(!1===G.isShown||h.getSelectionType()!==ops.OdtCursor.RangeSelection||!b&&!h.getSelectedRange().collapsed)G.visibility="hidden",a.style.visibility="hidden",w.cancel();else if(G.visibility="visible",a.style.visibility="visible",
!1===G.isFocused)a.style.opacity="1",w.cancel();else{if(F||p("visibility"))a.style.opacity="1",w.cancel();w.trigger()}if(H||L){var c;c=h.getNode();var f,g,l=D.getBoundingClientRect(y.getSizer()),q=!1,B=0;c.removeAttributeNS("urn:webodf:names:cursor","caret-sizer-active");if(0<c.getClientRects().length)g=n(),B=g.left-D.getBoundingClientRect(c).left,q=!0;else if(t.setPosition(c,0),g=z.getContentRect(t),!g&&t.nextStep()&&(f=z.getContentRect(t))&&(g=f,q=!0),g||(c.setAttributeNS("urn:webodf:names:cursor",
"caret-sizer-active","true"),g=n(),q=!0),!g)for(runtime.log("WARN: No suitable client rectangle found for visual caret for "+h.getMemberId());c;){if(0<c.getClientRects().length){g=D.getBoundingClientRect(c);q=!0;break}c=c.parentNode}g=D.translateRect(g,l,y.getZoomLevel());c={top:g.top,height:g.height,right:q?g.left:g.right,width:D.adaptRangeDifferenceToZoomLevel(B,y.getZoomLevel())};8>c.height&&(c={top:c.top-(8-c.height)/2,height:8,right:c.right});e.style.height=c.height+"px";e.style.top=c.top+"px";
e.style.left=c.right-c.width+"px";e.style.width=c.width?c.width+"px":"";r&&(c=runtime.getWindow().getComputedStyle(h.getNode(),null),c.font?r.style.font=c.font:(r.style.fontStyle=c.fontStyle,r.style.fontVariant=c.fontVariant,r.style.fontWeight=c.fontWeight,r.style.fontSize=c.fontSize,r.style.lineHeight=c.lineHeight,r.style.fontFamily=c.fontFamily))}G.isShown&&L&&k.scrollIntoView(a.getBoundingClientRect());p("isFocused")&&d.markAsFocussed(G.isFocused);m();H=L=F=!1}function f(a){e.parentNode.removeChild(e);
l.parentNode.removeChild(l);a()}var e,a,d,r,l,B,y=h.getDocument().getCanvas(),D=core.DomUtils,z=new gui.GuiStepUtils,t,x,w,F=!1,L=!1,H=!1,G={isFocused:!1,isShown:!0,visibility:"hidden"},A={isFocused:!G.isFocused,isShown:!G.isShown,visibility:"hidden"};this.handleUpdate=function(){H=!0;x.trigger()};this.refreshCursorBlinking=function(){F=!0;x.trigger()};this.setFocus=function(){G.isFocused=!0;x.trigger()};this.removeFocus=function(){G.isFocused=!1;x.trigger()};this.show=function(){G.isShown=!0;x.trigger()};
this.hide=function(){G.isShown=!1;x.trigger()};this.setAvatarImageUrl=function(a){d.setImageUrl(a)};this.setColor=function(b){a.style.borderColor=b;d.setColor(b)};this.getCursor=function(){return h};this.getFocusElement=function(){return a};this.toggleHandleVisibility=function(){d.isVisible()?d.hide():d.show()};this.showHandle=function(){d.show()};this.hideHandle=function(){d.hide()};this.setOverlayElement=function(a){r=a;e.appendChild(a);H=!0;x.trigger()};this.ensureVisible=function(){L=!0;x.trigger()};
this.getBoundingClientRect=function(){return D.getBoundingClientRect(e)};this.destroy=function(a){core.Async.destroyAll([x.destroy,w.destroy,d.destroy,f],a)};(function(){var b=h.getDocument(),f=[b.createRootFilter(h.getMemberId()),b.getPositionFilter()],k=b.getDOMDocument();B=k.createRange();l=k.createElement("span");l.className="webodf-caretSizer";l.textContent="|";h.getNode().appendChild(l);e=k.createElement("div");e.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",h.getMemberId());
e.className="webodf-caretOverlay";a=k.createElement("div");a.className="caret";e.appendChild(a);d=new gui.Avatar(e,c);y.getSizer().appendChild(e);t=b.createStepIterator(h.getNode(),0,f,b.getRootNode());x=core.Task.createRedrawTask(q);w=core.Task.createTimeoutTask(g,500);x.triggerImmediate()})()};odf.TextSerializer=function(){function h(b){var g="",n=k.filter?k.filter.acceptNode(b):NodeFilter.FILTER_ACCEPT,p=b.nodeType,m;if((n===NodeFilter.FILTER_ACCEPT||n===NodeFilter.FILTER_SKIP)&&c.isTextContentContainingNode(b))for(m=b.firstChild;m;)g+=h(m),m=m.nextSibling;n===NodeFilter.FILTER_ACCEPT&&(p===Node.ELEMENT_NODE&&c.isParagraph(b)?g+="\n":p===Node.TEXT_NODE&&b.textContent&&(g+=b.textContent));return g}var k=this,c=odf.OdfUtils;this.filter=null;this.writeToString=function(b){if(!b)return"";
b=h(b);"\n"===b[b.length-1]&&(b=b.substr(0,b.length-1));return b}};gui.MimeDataExporter=function(){var h;this.exportRangeToDataTransfer=function(k,c){var b;b=c.startContainer.ownerDocument.createElement("span");b.appendChild(c.cloneContents());b=h.writeToString(b);try{k.setData("text/plain",b)}catch(g){k.setData("Text",b)}};h=new odf.TextSerializer;h.filter=new odf.OdfNodeFilter};gui.Clipboard=function(h){this.setDataFromRange=function(k,c){var b,g=k.clipboardData;b=runtime.getWindow();!g&&b&&(g=b.clipboardData);g?(b=!0,h.exportRangeToDataTransfer(g,c),k.preventDefault()):b=!1;return b}};gui.SessionContext=function(h,k){var c=h.getOdtDocument(),b=odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var g=c.getCursor(k),h;if(!g)return!1;h=g&&g.getNode();g=c.getMember(k).getProperties().fullName;return(h=b.getParentAnnotation(h,c.getRootNode()))&&b.getAnnotationCreator(h)===g?!0:!1}};gui.StyleSummary=function(h){function k(b,c){var k=b+"|"+c,q;g.hasOwnProperty(k)||(q=[],h.forEach(function(f){f=(f=f.styleProperties[b])&&f[c];-1===q.indexOf(f)&&q.push(f)}),g[k]=q);return g[k]}function c(b,c,g){return function(){var h=k(b,c);return g.length>=h.length&&h.every(function(b){return-1!==g.indexOf(b)})}}function b(b,c){var g=k(b,c);return 1===g.length?g[0]:void 0}var g={};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(h,k,c,b,g,n,p){function m(){return X.value().styleSummary}function q(){return X.value().enabledFeatures}function f(a){var b;a.collapsed?(b=a.startContainer,b.hasChildNodes()&&a.startOffset<b.childNodes.length&&(b=b.childNodes.item(a.startOffset)),a=[b]):a=T.getTextElements(a,!0,!1);return a}function e(){var a=P.getCursor(b),d=a&&a.getSelectedRange(),e=[],e=[],g=!0,h={directTextStyling:!0,directParagraphStyling:!0};d&&(e=f(d),0===e.length&&(e=[d.startContainer,
d.endContainer],g=!1),e=P.getFormatting().getAppliedStyles(e));void 0!==e[0]&&Z&&(e[0].styleProperties=U.mergeObjects(e[0].styleProperties,Z));!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(h.directTextStyling=h.directParagraphStyling=c.isLocalCursorWithinOwnAnnotation());h.directTextStyling&&(h.directTextStyling=g&&void 0!==a&&a.getSelectionType()===ops.OdtCursor.RangeSelection);return{enabledFeatures:h,appliedStyles:e,styleSummary:new gui.StyleSummary(e)}}function a(a,b){var d={};Object.keys(a).forEach(function(c){var e=
a[c](),f=b[c]();e!==f&&(d[c]=f)});return d}function d(){var b,d;d=da.styleSummary;var c=X.value(),e=c.styleSummary,f=da.enabledFeatures,g=c.enabledFeatures;b=a(d.text,e.text);d=a(d.paragraph,e.paragraph);f=!(g.directTextStyling===f.directTextStyling&&g.directParagraphStyling===f.directParagraphStyling);da=c;f&&ca.emit(gui.DirectFormattingController.enabledChanged,g);0<Object.keys(b).length&&ca.emit(gui.DirectFormattingController.textStylingChanged,b);0<Object.keys(d).length&&ca.emit(gui.DirectFormattingController.paragraphStylingChanged,
d)}function r(){X.reset();d()}function l(a){("string"===typeof a?a:a.getMemberId())===b&&X.reset()}function B(){X.reset()}function y(a){var d=P.getCursor(b);a=a.paragraphElement;d&&T.getParagraphElement(d.getNode())===a&&X.reset()}function D(a,b){b(!a());return!0}function z(a){if(q().directTextStyling){var d=P.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}),h.enqueue([a])):(Z=
U.mergeObjects(Z||{},c),X.reset())}}function t(a,b){var d={};d[a]=b;z(d)}function x(a){a=a.spec();Z&&a.memberid===b&&"SplitParagraph"!==a.optype&&(Z=null,X.reset())}function w(a){t("fo:font-weight",a?"bold":"normal")}function F(a){t("fo:font-style",a?"italic":"normal")}function L(a){t("style:text-underline-style",a?"solid":"none")}function H(a){t("style:text-line-through-style",a?"solid":"none")}function G(a){if(q().directParagraphStyling){var d=P.getCursor(b).getSelectedRange(),d=T.getParagraphElements(d),
c=P.getFormatting(),e=[],f={},l;d.forEach(function(d){var h=P.convertDomPointToCursorStep(d,0,E),k=d.getAttributeNS(odf.Namespaces.textns,"style-name"),r;d=k?f.hasOwnProperty(k)?f[k]:void 0:l;d||(d=g.generateStyleName(),k?(f[k]=d,r=c.createDerivedStyleObject(k,"paragraph",{})):(l=d,r={}),r=a(r),k=new ops.OpAddStyle,k.init({memberid:b,styleName:d.toString(),styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:r}),e.push(k));k=new ops.OpSetParagraphStyle;k.init({memberid:b,styleName:d.toString(),
position:h});e.push(k)});h.enqueue(e)}}function A(a){G(function(b){return U.mergeObjects(b,a)})}function K(a){A({"style:paragraph-properties":{"fo:text-align":a}})}function v(a,b){var d=P.getFormatting().getDefaultTabStopDistance(),c=b["style:paragraph-properties"],e;c&&(c=c["fo:margin-left"],e=T.parseLength(c));return U.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=f(a),d=0===d.length?[a.startContainer]:
d,d=P.getFormatting().getAppliedStyles(d),c=0<d.length?d[0].styleProperties:void 0,e=P.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 Q(){}function R(){return!1}function C(){return!1}var I=this,P=h.getOdtDocument(),U=new core.Utils,T=odf.OdfUtils,
ca=new core.EventNotifier([gui.DirectFormattingController.enabledChanged,gui.DirectFormattingController.textStylingChanged,gui.DirectFormattingController.paragraphStylingChanged]),Y=odf.Namespaces.textns,E=core.StepDirection.NEXT,Z=null,da,X;this.enabledFeatures=q;this.formatTextSelection=z;this.createCursorStyleOp=function(a,d,c){var e=null,f=Z;c&&(f=(c=X.value().appliedStyles[0])&&c.styleProperties);f&&f["style:text-properties"]&&(e=new ops.OpApplyDirectStyling,e.init({memberid:b,position:a,length:d,
setProperties:{"style:text-properties":f["style:text-properties"]}}),Z=null,X.reset());return e};this.setBold=w;this.setItalic=F;this.setHasUnderline=L;this.setHasStrikethrough=H;this.setFontSize=function(a){t("fo:font-size",a+"pt")};this.setFontName=function(a){t("style:font-name",a)};this.getAppliedStyles=function(){return X.value().appliedStyles};this.toggleBold=D.bind(I,function(){return m().isBold()},w);this.toggleItalic=D.bind(I,function(){return m().isItalic()},F);this.toggleUnderline=D.bind(I,
function(){return m().hasUnderline()},L);this.toggleStrikethrough=D.bind(I,function(){return m().hasStrikeThrough()},H);this.isBold=function(){return m().isBold()};this.isItalic=function(){return m().isItalic()};this.hasUnderline=function(){return m().hasUnderline()};this.hasStrikeThrough=function(){return m().hasStrikeThrough()};this.fontSize=function(){return m().fontSize()};this.fontName=function(){return m().fontName()};this.isAlignedLeft=function(){return m().isAlignedLeft()};this.isAlignedCenter=
function(){return m().isAlignedCenter()};this.isAlignedRight=function(){return m().isAlignedRight()};this.isAlignedJustified=function(){return m().isAlignedJustified()};this.alignParagraphLeft=function(){K("left");return!0};this.alignParagraphCenter=function(){K("center");return!0};this.alignParagraphRight=function(){K("right");return!0};this.alignParagraphJustified=function(){K("justify");return!0};this.indent=function(){G(v.bind(null,1));return!0};this.outdent=function(){G(v.bind(null,-1));return!0};
this.createParagraphStyleOps=function(a){if(!q().directParagraphStyling)return[];var d=P.getCursor(b),c=d.getSelectedRange(),e=[],f,h;d.hasForwardSelection()?(f=d.getAnchorNode(),h=d.getNode()):(f=d.getNode(),h=d.getAnchorNode());d=T.getParagraphElement(h);runtime.assert(Boolean(d),"DirectFormattingController: Cursor outside paragraph");var l=d,k=[P.getPositionFilter(),P.createRootFilter(b)];if(!1!==P.createStepIterator(c.endContainer,c.endOffset,k,l).nextStep())return e;h!==f&&(d=T.getParagraphElement(f));
if(!Z&&!u(c,d))return e;c=(c=X.value().appliedStyles[0])&&c.styleProperties;if(!c)return e;if(d=d.getAttributeNS(Y,"style-name"))c={"style:text-properties":c["style:text-properties"]},c=P.getFormatting().createDerivedStyleObject(d,"paragraph",c);f=g.generateStyleName();d=new ops.OpAddStyle;d.init({memberid:b,styleName:f,styleFamily:"paragraph",isAutomaticStyle:!0,setProperties:c});e.push(d);d=new ops.OpSetParagraphStyle;d.init({memberid:b,styleName:f,position:a});e.push(d);return e};this.subscribe=
function(a,b){ca.subscribe(a,b)};this.unsubscribe=function(a,b){ca.unsubscribe(a,b)};this.destroy=function(a){P.unsubscribe(ops.Document.signalCursorAdded,l);P.unsubscribe(ops.Document.signalCursorRemoved,l);P.unsubscribe(ops.Document.signalCursorMoved,l);P.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,B);P.unsubscribe(ops.OdtDocument.signalParagraphChanged,y);P.unsubscribe(ops.OdtDocument.signalOperationEnd,x);P.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,d);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,
r);a()};(function(){P.subscribe(ops.Document.signalCursorAdded,l);P.subscribe(ops.Document.signalCursorRemoved,l);P.subscribe(ops.Document.signalCursorMoved,l);P.subscribe(ops.OdtDocument.signalParagraphStyleModified,B);P.subscribe(ops.OdtDocument.signalParagraphChanged,y);P.subscribe(ops.OdtDocument.signalOperationEnd,x);P.subscribe(ops.OdtDocument.signalProcessingBatchEnd,d);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,r);X=new core.LazyProperty(e);da=X.value();n||(I.formatTextSelection=Q,
I.setBold=Q,I.setItalic=Q,I.setHasUnderline=Q,I.setHasStrikethrough=Q,I.setFontSize=Q,I.setFontName=Q,I.toggleBold=C,I.toggleItalic=C,I.toggleUnderline=C,I.toggleStrikethrough=C);p||(I.alignParagraphCenter=R,I.alignParagraphJustified=R,I.alignParagraphLeft=R,I.alignParagraphRight=R,I.createParagraphStyleOps=function(){return[]},I.indent=R,I.outdent=R)})()};gui.DirectFormattingController.enabledChanged="enabled/changed";gui.DirectFormattingController.textStylingChanged="textStyling/changed";
gui.DirectFormattingController.paragraphStylingChanged="paragraphStyling/changed";gui.DirectFormattingController.SelectionInfo=function(){};gui.KeyboardHandler=function(){function h(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,p,m){c=h(c,
k);runtime.assert(m||!1===b.hasOwnProperty(c),"tried to overwrite the callback handler of key combo: "+c);b[c]=p};this.unbind=function(c,k){var p=h(c,k);delete b[p]};this.reset=function(){c=null;b={}};this.handleEvent=function(g){var n=g.keyCode,p=k.None;g.metaKey&&(p|=k.Meta);g.ctrlKey&&(p|=k.Ctrl);g.altKey&&(p|=k.Alt);g.shiftKey&&(p|=k.Shift);n=h(n,p);n=b[n];p=!1;n?p=n():null!==c&&(p=c(g));p&&(g.preventDefault?g.preventDefault():g.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(h,k,c){function b(){var a=h();runtime.assert(Boolean(a.classList),"Document container has no classList element");a.classList.remove("webodf-inactiveLinks")}function g(){var a=h();runtime.assert(Boolean(a.classList),"Document container has no classList element");a.classList.add("webodf-inactiveLinks")}function n(){a.removeEventListener("focus",g,!1);r.forEach(function(a){k.unbind(a.keyCode,a.modifier);c.unbind(a.keyCode,a.modifier)});r.length=0}function p(d){n();
if(d!==m.None){a.addEventListener("focus",g,!1);switch(d){case m.Ctrl:r.push({keyCode:q.Ctrl,modifier:m.None});break;case m.Meta:r.push({keyCode:q.LeftMeta,modifier:m.None}),r.push({keyCode:q.RightMeta,modifier:m.None}),r.push({keyCode:q.MetaInMozilla,modifier:m.None})}r.forEach(function(a){k.bind(a.keyCode,a.modifier,b);c.bind(a.keyCode,a.modifier,g)})}}var m=gui.KeyboardHandler.Modifier,q=gui.KeyboardHandler.KeyCode,f=xmldom.XPath,e=odf.OdfUtils,a=runtime.getWindow(),d=m.None,r=[];runtime.assert(null!==
a,"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,g,k;b.ctrlKey?g=m.Ctrl:b.metaKey&&(g=m.Meta);if(d===m.None||d===g){a:{for(;null!==c;){if(e.isHyperlink(c))break a;if(e.isParagraph(c))break;c=c.parentNode}c=null}c&&(c=e.getHyperlinkTarget(c),""!==c&&("#"===c[0]?(c=c.substring(1),g=h(),k=f.getODFElementsWithXPath(g,"//text:bookmark-start[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI),0===k.length&&
(k=f.getODFElementsWithXPath(g,"//text:bookmark[@text:name='"+c+"']",odf.Namespaces.lookupNamespaceURI)),0<k.length&&k[0].scrollIntoView(!0)):/^\s*(javascript|data):/.test(c)?runtime.log("WARN:","potentially malicious URL ignored"):a.open(c),b.preventDefault?b.preventDefault():b.returnValue=!1))}};this.setModifier=function(a){d!==a&&(runtime.assert(a===m.None||a===m.Ctrl||a===m.Meta,"Unsupported KeyboardHandler.Modifier value: "+a),d=a,d!==m.None?g():b(),p(d))};this.getModifier=function(){return d};
this.destroy=function(a){g();n();a()}};gui.EventManager=function(h){function k(a){function b(a,d,c){var e,f=!1;e="on"+d;a.attachEvent&&(a.attachEvent(e,c),f=!0);!f&&a.addEventListener&&(a.addEventListener(d,c,!1),f=!0);f&&!x[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===f.indexOf(b)){f.push(b);if(e.filters.every(function(a){return a(b)}))try{g.emit(a,b)}catch(d){runtime.log("Error occurred while processing "+
a+":\n"+d.message+"\n"+d.stack)}runtime.setTimeout(function(){f.splice(f.indexOf(b),1)},0)}}var e=this,f=[],g=new core.EventNotifier([a]);this.filters=[];this.subscribe=function(b){g.subscribe(a,b)};this.unsubscribe=function(b){g.unsubscribe(a,b)};this.destroy=function(){d(t,a,c);d(H,a,c);d(G,a,c)};w[a]&&b(t,a,c);b(H,a,c);b(G,a,c)}function c(a,b,d){function c(b){d(b,e,function(b){b.type=a;f.emit(a,b)})}var e={},f=new core.EventNotifier([a]);this.subscribe=function(b){f.subscribe(a,b)};this.unsubscribe=
function(b){f.unsubscribe(a,b)};this.destroy=function(){b.forEach(function(a){A.unsubscribe(a,c)})};(function(){b.forEach(function(a){A.subscribe(a,c)})})()}function b(a){runtime.clearTimeout(a);delete K[a]}function g(a,d){var c=runtime.setTimeout(function(){a();b(c)},d);K[c]=!0;return c}function n(a,d,c){var e=a.touches.length,f=a.touches[0],h=d.timer;"touchmove"===a.type||"touchend"===a.type?h&&b(h):"touchstart"===a.type&&(1!==e?runtime.clearTimeout(h):h=g(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 p(a,b,d){var c=a.touches[0],e=a.target||a.srcElement||null,f=b.target;1!==a.touches.length||"touchend"===a.type?f=null:"touchstart"===a.type&&"webodf-draggable"===e.getAttribute("class")?f=e:"touchmove"===a.type&&f&&(a.preventDefault(),a.stopPropagation(),d({clientX:c.clientX,clientY:c.clientY,pageX:c.pageX,pageY:c.pageY,target:f,detail:1}));b.target=f}function m(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 q(){G.classList.add("webodf-touchEnabled");A.unsubscribe("touchstart",q)}function f(a){var b=a.scrollX,d=a.scrollY;this.restore=function(){a.scrollX===b&&a.scrollY===d||a.scrollTo(b,d)}}function e(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 a(a,b){var d=L[a]||F[a]||null;!d&&b&&(d=L[a]=new k(a));return d}function d(b,d){a(b,!0).subscribe(d)}function r(b,d){var c=a(b,!1);c&&c.unsubscribe(d)}function l(){return h.getDOMDocument().activeElement===H}function B(){l()&&H.blur();H.setAttribute("disabled","true")}function y(){H.removeAttribute("disabled")}function D(a){for(var b=[];a;)(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight)&&b.push(new e(a)),a=a.parentNode;b.push(new f(t));return b}function z(){var a;
l()||(a=D(H),y(),H.focus(),a.forEach(function(a){a.restore()}))}var t=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},F={},L={},H,G=h.getCanvas().getElement(),A=this,K={};this.addFilter=function(b,d){a(b,!0).filters.push(d)};this.removeFilter=function(b,d){var c=a(b,!0),e=c.filters.indexOf(d);-1!==e&&c.filters.splice(e,1)};this.subscribe=d;this.unsubscribe=r;this.hasFocus=l;this.focus=z;this.getEventTrap=function(){return H};
this.setEditing=function(a){var b=l();b&&H.blur();a?H.removeAttribute("readOnly"):H.setAttribute("readOnly","true");b&&z()};this.destroy=function(a){r("touchstart",q);Object.keys(K).forEach(function(a){b(parseInt(a,10))});K.length=0;Object.keys(F).forEach(function(a){F[a].destroy()});F={};r("mousedown",B);r("mouseup",y);r("contextmenu",y);Object.keys(L).forEach(function(a){L[a].destroy()});L={};H.parentNode.removeChild(H);a()};(function(){var a=h.getOdfCanvas().getSizer(),b=a.ownerDocument;runtime.assert(Boolean(t),
"EventManager requires a window object to operate correctly");H=b.createElement("textarea");H.id="eventTrap";H.setAttribute("tabindex","-1");H.setAttribute("readOnly","true");H.setAttribute("rows","1");a.appendChild(H);d("mousedown",B);d("mouseup",y);d("contextmenu",y);F.longpress=new c("longpress",["touchstart","touchmove","touchend"],n);F.drag=new c("drag",["touchstart","touchmove","touchend"],p);F.dragstop=new c("dragstop",["drag","touchend"],m);d("touchstart",q)})()};gui.IOSSafariSupport=function(h){function k(){c.innerHeight!==c.outerHeight&&(b.style.display="none",runtime.requestAnimationFrame(function(){b.style.display="block"}))}var c=runtime.getWindow(),b=h.getEventTrap();this.destroy=function(c){h.unsubscribe("focus",k);b.removeAttribute("autocapitalize");b.style.WebkitTransform="";c()};h.subscribe("focus",k);b.setAttribute("autocapitalize","off");b.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(h,k,c,b){function g(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=c.isLocalCursorWithinOwnAnnotation());b!==f&&(f=b,q.emit(gui.HyperlinkController.enabledChanged,f))}function n(c){c.getMemberId()===b&&g()}var p=odf.OdfUtils,m=h.getOdtDocument(),q=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),f=!1;this.isEnabled=function(){return f};this.subscribe=function(b,a){q.subscribe(b,a)};this.unsubscribe=function(b,a){q.unsubscribe(b,
a)};this.addHyperlink=function(c,a){if(f){var d=m.getCursorSelection(b),g=new ops.OpApplyHyperlink,l=[];if(0===d.length||a)a=a||c,g=new ops.OpInsertText,g.init({memberid:b,position:d.position,text:a}),d.length=a.length,l.push(g);g=new ops.OpApplyHyperlink;g.init({memberid:b,position:d.position,length:d.length,hyperlink:c});l.push(g);h.enqueue(l)}};this.removeHyperlinks=function(){if(f){var c=m.createPositionIterator(m.getRootNode()),a=m.getCursor(b).getSelectedRange(),d=p.getHyperlinkElements(a),
g=a.collapsed&&1===d.length,l=m.getDOMDocument().createRange(),k=[],n,q;0!==d.length&&(d.forEach(function(a){l.selectNodeContents(a);n=m.convertDomToCursorRange({anchorNode:l.startContainer,anchorOffset:l.startOffset,focusNode:l.endContainer,focusOffset:l.endOffset});q=new ops.OpRemoveHyperlink;q.init({memberid:b,position:n.position,length:n.length});k.push(q)}),g||(g=d[0],-1===a.comparePoint(g,0)&&(l.setStart(g,0),l.setEnd(a.startContainer,a.startOffset),n=m.convertDomToCursorRange({anchorNode:l.startContainer,
anchorOffset:l.startOffset,focusNode:l.endContainer,focusOffset:l.endOffset}),0<n.length&&(q=new ops.OpApplyHyperlink,q.init({memberid:b,position:n.position,length:n.length,hyperlink:p.getHyperlinkTarget(g)}),k.push(q))),d=d[d.length-1],c.moveToEndOfNode(d),c=c.unfilteredDomOffset(),1===a.comparePoint(d,c)&&(l.setStart(a.endContainer,a.endOffset),l.setEnd(d,c),n=m.convertDomToCursorRange({anchorNode:l.startContainer,anchorOffset:l.startOffset,focusNode:l.endContainer,focusOffset:l.endOffset}),0<n.length&&
(q=new ops.OpApplyHyperlink,q.init({memberid:b,position:n.position,length:n.length,hyperlink:p.getHyperlinkTarget(d)}),k.push(q)))),h.enqueue(k),l.detach())}};this.destroy=function(b){m.unsubscribe(ops.Document.signalCursorMoved,n);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,g);b()};m.subscribe(ops.Document.signalCursorMoved,n);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,g);g()};gui.HyperlinkController.enabledChanged="enabled/changed";gui.ImageController=function(h,k,c,b,g){function n(){var a=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(a=c.isLocalCursorWithinOwnAnnotation());a!==r&&(r=a,d.emit(gui.ImageController.enabledChanged,r))}function p(a){a.getMemberId()===b&&n()}var m={"image/gif":".gif","image/jpeg":".jpg","image/png":".png"},q=odf.Namespaces.textns,f=h.getOdtDocument(),e=odf.OdfUtils,a=f.getFormatting(),d=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),r=!1;this.isEnabled=function(){return r};
this.subscribe=function(a,b){d.subscribe(a,b)};this.unsubscribe=function(a,b){d.unsubscribe(a,b)};this.insertImage=function(d,c,k,n){if(r){runtime.assert(0<k&&0<n,"Both width and height of the image should be greater than 0px.");n={width:k,height:n};if(k=e.getParagraphElement(f.getCursor(b).getNode()).getAttributeNS(q,"style-name")){k=a.getContentSize(k,"paragraph");var p=1,t=1;n.width>k.width&&(p=k.width/n.width);n.height>k.height&&(t=k.height/n.height);k=Math.min(p,t);n={width:n.width*k,height:n.height*
k}}k=n.width+"px";n=n.height+"px";var x=f.getOdfCanvas().odfContainer().rootElement.styles,p=d.toLowerCase(),t=m.hasOwnProperty(p)?m[p]:null,w,p=[];runtime.assert(null!==t,"Image type is not supported: "+d);t="Pictures/"+g.generateImageName()+t;w=new ops.OpSetBlob;w.init({memberid:b,filename:t,mimetype:d,content:c});p.push(w);a.getStyleElement("Graphics","graphic",[x])||(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=g.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);w=new ops.OpInsertImage;w.init({memberid:b,position:f.getCursorPosition(b),
filename:t,frameWidth:k,frameHeight:n,frameStyleName:d,frameName:g.generateFrameName()});p.push(w);h.enqueue(p)}};this.destroy=function(a){f.unsubscribe(ops.Document.signalCursorMoved,p);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,n);a()};f.subscribe(ops.Document.signalCursorMoved,p);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,n);n()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(h){function k(){var c=h.getSizer(),k=g.createElement("div");k.id="imageSelector";k.style.borderWidth="1px";c.appendChild(k);b.forEach(function(b){var c=g.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(" "),g=h.getElement().ownerDocument,n=!1;this.select=function(b){var m,q,f=g.getElementById("imageSelector");f||(f=k());n=!0;m=f.parentNode;
q=b.getBoundingClientRect();var e=m.getBoundingClientRect(),a=h.getZoomLevel();m=(q.left-e.left)/a-1;q=(q.top-e.top)/a-1;f.style.display="block";f.style.left=m+"px";f.style.top=q+"px";f.style.width=b.getAttributeNS(c,"width");f.style.height=b.getAttributeNS(c,"height")};this.clearSelection=function(){var b;n&&(b=g.getElementById("imageSelector"))&&(b.style.display="none");n=!1};this.isSelectorElement=function(b){var c=g.getElementById("imageSelector");return c?b===c||b.parentNode===c:!1}};(function(){function h(h){function c(b){p=b.which&&String.fromCharCode(b.which)===n;n=void 0;return!1===p}function b(){p=!1}function g(b){n=b.data;p=!1}var n,p=!1;this.destroy=function(n){h.unsubscribe("textInput",b);h.unsubscribe("compositionend",g);h.removeFilter("keypress",c);n()};h.subscribe("textInput",b);h.subscribe("compositionend",g);h.addFilter("keypress",c)}gui.InputMethodEditor=function(k,c){function b(b){a&&(b?a.getNode().setAttributeNS("urn:webodf:names:cursor","composing","true"):(a.getNode().removeAttributeNS("urn:webodf:names:cursor",
"composing"),l.textContent=""))}function g(){y&&(y=!1,b(!1),z.emit(gui.InputMethodEditor.signalCompositionEnd,{data:D}),D="")}function n(){L||(L=!0,g(),a&&a.getSelectedRange().collapsed?d.value="":d.value=x.writeToString(a.getSelectedRange().cloneContents()),d.setSelectionRange(0,d.value.length),L=!1)}function p(){c.hasFocus()&&B.trigger()}function m(){t=void 0;B.cancel();b(!0);y||z.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function q(a){a=t=a.data;y=!0;D+=a;B.trigger()}function f(a){a.data!==
t&&(a=a.data,y=!0,D+=a,B.trigger());t=void 0}function e(){l.textContent=d.value}var a=null,d=c.getEventTrap(),r=d.ownerDocument,l,B,y=!1,D="",z=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),t,x,w=[],F,L=!1;this.subscribe=z.subscribe;this.unsubscribe=z.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(a=b,a.getNode().appendChild(l),b.subscribe(ops.OdtCursor.signalCursorUpdated,p),c.subscribe("input",e),c.subscribe("compositionupdate",
e))};this.removeCursor=function(b){a&&b===k&&(a.getNode().removeChild(l),a.unsubscribe(ops.OdtCursor.signalCursorUpdated,p),c.unsubscribe("input",e),c.unsubscribe("compositionupdate",e),a=null)};this.destroy=function(a){c.unsubscribe("compositionstart",m);c.unsubscribe("compositionend",q);c.unsubscribe("textInput",f);c.unsubscribe("keypress",g);c.unsubscribe("focus",n);core.Async.destroyAll(F,a)};(function(){x=new odf.TextSerializer;x.filter=new odf.OdfNodeFilter;c.subscribe("compositionstart",m);
c.subscribe("compositionend",q);c.subscribe("textInput",f);c.subscribe("keypress",g);c.subscribe("focus",n);w.push(new h(c));F=w.map(function(a){return a.destroy});l=r.createElement("span");l.setAttribute("id","composer");B=core.Task.createTimeoutTask(n,1);F.push(B.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(h,k){function c(b){n.emit(gui.MetadataController.signalMetadataChanged,b)}function b(b){var c=-1===p.indexOf(b);c||runtime.log("Setting "+b+" is restricted.");return c}var g=h.getOdtDocument(),n=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),p=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(c,g){var f={},e="",a;c&&Object.keys(c).filter(b).forEach(function(a){f[a]=c[a]});
g&&(e=g.filter(b).join(","));if(0<e.length||0<Object.keys(f).length)a=new ops.OpUpdateMetadata,a.init({memberid:k,setProperties:f,removedProperties:0<e.length?{attributes:e}:null}),h.enqueue([a])};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 g.getOdfCanvas().odfContainer().getMetadata(b,
c[1])};this.subscribe=function(b,c){n.subscribe(b,c)};this.unsubscribe=function(b,c){n.unsubscribe(b,c)};this.destroy=function(b){g.unsubscribe(ops.OdtDocument.signalMetadataUpdated,c);b()};g.subscribe(ops.OdtDocument.signalMetadataUpdated,c)};gui.MetadataController.signalMetadataChanged="metadata/changed";gui.PasteController=function(h,k,c,b){function g(){m=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?c.isLocalCursorWithinOwnAnnotation():!0}function n(a){a.getMemberId()===b&&g()}var p=h.getOdtDocument(),m=!1,q=odf.Namespaces.textns,f=core.StepDirection.NEXT,e=odf.OdfUtils;this.isEnabled=function(){return m};this.paste=function(a){if(m){var d=p.getCursorPosition(b),c=p.getCursor(b).getNode(),c=e.getParagraphElement(c),g=c.getAttributeNS(q,"style-name")||"",k=d,n=[],D=p.convertDomPointToCursorStep(c,
0,f);a.replace(/\r/g,"").split("\n").forEach(function(a){var d=new ops.OpInsertText,c=new ops.OpSplitParagraph;d.init({memberid:b,position:k,text:a,moveCursor:!0});n.push(d);k+=a.length;c.init({memberid:b,position:k,paragraphStyleName:g,sourceParagraphPosition:D,moveCursor:!0});n.push(c);D=k+=1});n.pop();h.enqueue(n)}};this.destroy=function(a){p.unsubscribe(ops.Document.signalCursorMoved,n);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,g);a()};p.subscribe(ops.Document.signalCursorMoved,n);
k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,g);g()};gui.ClosestXOffsetScanner=function(h){function k(b){return null!==b&&void 0!==g?Math.abs(b-h)>g:!1}function c(b){null!==b&&!1===k(b)&&(g=Math.abs(b-h))}var b=this,g,n=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(g,h,q){var f,e;g.visualDirection===n?(f=h&&h.right,e=q&&q.left):(f=h&&h.left,e=q&&q.right);if(k(f)||k(e))return!0;if(h||q)c(f),c(e),b.token=g.token;return!1}};gui.LineBoundaryScanner=function(){var h=this,k=null;this.token=void 0;this.process=function(c,b,g){var n;if(n=g)if(k){var p=k;n=Math.min(p.bottom-p.top,g.bottom-g.top);var m=Math.max(p.top,g.top),p=Math.min(p.bottom,g.bottom)-m;n=.4>=(0<n?p/n:0)}else n=!1;!b||g&&!n||(h.token=c.token);if(n)return!0;k=(c=k)&&b?{left:Math.min(c.left,b.left),right:Math.max(c.right,b.right),top:Math.min(c.top,b.top),bottom:Math.min(c.bottom,b.bottom)}:c||b;return!1}};gui.ParagraphBoundaryScanner=function(){var h=this,k=!1,c,b=odf.OdfUtils;this.token=void 0;this.process=function(g){var n=b.getParagraphElement(g.container());k||(c=n,k=!0);if(c!==n)return!0;h.token=g.token;return!1}};odf.WordBoundaryFilter=function(h,k){function c(a,b,d){for(var c=null,e=h.getRootNode(),f;a!==e&&null!==a&&null===c;)f=0>b?a.previousSibling:a.nextSibling,d(f)===NodeFilter.FILTER_ACCEPT&&(c=f),a=a.parentNode;return c}function b(a,b){var d;return null===a?r.NO_NEIGHBOUR:p.isCharacterElement(a)?r.SPACE_CHAR:a.nodeType===g||p.isTextSpan(a)||p.isHyperlink(a)?(d=a.textContent.charAt(b()),q.test(d)?r.SPACE_CHAR:m.test(d)?r.PUNCTUATION_CHAR:r.WORD_CHAR):r.OTHER}var g=Node.TEXT_NODE,n=Node.ELEMENT_NODE,
p=odf.OdfUtils,m=/[!-#%-*,-\/:-;?-@\[-\]_{}\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]/,
q=/\s/,f=core.PositionFilter.FilterResult.FILTER_ACCEPT,e=core.PositionFilter.FilterResult.FILTER_REJECT,a=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,d=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,r={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(g){var h=g.container(),m=g.leftNode(),p=g.rightNode(),q=g.unfilteredDomOffset,t=function(){return g.unfilteredDomOffset()-1};h.nodeType===n&&(null===p&&(p=c(h,1,g.getNodeFilter())),null===m&&(m=
c(h,-1,g.getNodeFilter())));h!==p&&(q=function(){return 0});h!==m&&null!==m&&(t=function(){return m.textContent.length-1});h=b(m,t);p=b(p,q);return h===r.WORD_CHAR&&p===r.WORD_CHAR||h===r.PUNCTUATION_CHAR&&p===r.PUNCTUATION_CHAR||k===a&&h!==r.NO_NEIGHBOUR&&p===r.SPACE_CHAR||k===d&&h===r.SPACE_CHAR&&p!==r.NO_NEIGHBOUR?e:f}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(h,k){function c(a){var b=a.spec();if(a.isEdit||b.memberid===k)L=void 0,H.cancel()}function b(){var a=y.getCursor(k).getNode();return y.createStepIterator(a,0,[t,w],y.getRootElement(a))}function g(a,b,d){d=new odf.WordBoundaryFilter(y,d);var c=y.getRootElement(a)||y.getRootNode(),e=y.createRootFilter(c);return y.createStepIterator(a,b,[t,e,d],c)}function n(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 p(a,b,d){var c=new ops.OpMoveCursor;c.init({memberid:k,position:a,length:b||0,selectionType:d});return c}function m(a,b,d){var c;c=y.getCursor(k);c=n(c.getSelectedRange(),c.hasForwardSelection());c.focusNode=a;c.focusOffset=b;d||(c.anchorNode=c.focusNode,c.anchorOffset=c.focusOffset);a=y.convertDomToCursorRange(c);h.enqueue([p(a.position,a.length)])}function q(a){var b;b=g(a.startContainer,
a.startOffset,G);b.roundToPreviousStep()&&a.setStart(b.container(),b.offset());b=g(a.endContainer,a.endOffset,A);b.roundToNextStep()&&a.setEnd(b.container(),b.offset())}function f(a){var b=z.getParagraphElements(a),d=b[0],b=b[b.length-1];d&&a.setStart(d,0);b&&(z.isParagraph(a.endContainer)&&0===a.endOffset?a.setEndBefore(b):a.setEnd(b,b.childNodes.length))}function e(a,b,d,c){var e,f;c?(e=d.startContainer,f=d.startOffset):(e=d.endContainer,f=d.endOffset);D.containsNode(a,e)||(f=0>D.comparePoints(a,
0,e,f)?0:a.childNodes.length,e=a);a=y.createStepIterator(e,f,b,z.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 a(a,d){var c=b();c.advanceStep(a)&&m(c.container(),c.offset(),d)}function d(a,d){var c,e=L,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===e&&F&&(e=F());isNaN(e)||(c=b(),x.moveToFilteredStep(c,a,f)&&c.advanceStep(a)&&(f=[new gui.ClosestXOffsetScanner(e),
new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,a,f)&&(m(c.container(),c.offset(),d),L=e,H.restart())))}function r(a,d){var c=b(),e=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,a,e)&&m(c.container(),c.offset(),d)}function l(a,b){var d=y.getCursor(k),d=n(d.getSelectedRange(),d.hasForwardSelection()),d=g(d.focusNode,d.focusOffset,G);d.advanceStep(a)&&m(d.container(),d.offset(),b)}function B(a,b,d){var c=!1,e=y.getCursor(k),
e=n(e.getSelectedRange(),e.hasForwardSelection()),c=y.getRootElement(e.focusNode);runtime.assert(Boolean(c),"SelectionController: Cursor outside root");e=y.createStepIterator(e.focusNode,e.focusOffset,[t,w],c);e.roundToClosestStep();e.advanceStep(a)&&(d=d(e.container()))&&(a===K?(e.setPosition(d,0),c=e.roundToNextStep()):(e.setPosition(d,d.childNodes.length),c=e.roundToPreviousStep()),c&&m(e.container(),e.offset(),b))}var y=h.getOdtDocument(),D=core.DomUtils,z=odf.OdfUtils,t=y.getPositionFilter(),
x=new gui.GuiStepUtils,w=y.createRootFilter(k),F=null,L,H,G=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,A=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,K=core.StepDirection.PREVIOUS,v=core.StepDirection.NEXT;this.selectionToRange=function(a){var b=0<=D.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=n;this.selectImage=function(a){var b=y.getRootElement(a),d=y.createRootFilter(b),b=y.createStepIterator(a,0,[d,y.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=y.convertDomToCursorRange({anchorNode:d,anchorOffset:c,focusNode:b.container(),
focusOffset:b.offset()});a=p(a.position,a.length,ops.OdtCursor.RegionSelection);h.enqueue([a])};this.expandToWordBoundaries=q;this.expandToParagraphBoundaries=f;this.selectRange=function(a,b,d){var c=y.getOdfCanvas().getElement(),g,l=[t];g=D.containsNode(c,a.startContainer);c=D.containsNode(c,a.endContainer);if(g||c)if(g&&c&&(2===d?q(a):3<=d&&f(a)),(d=b?y.getRootElement(a.startContainer):y.getRootElement(a.endContainer))||(d=y.getRootNode()),l.push(y.createRootFilter(d)),e(d,l,a,!0),e(d,l,a,!1),a=
n(a,b),b=y.convertDomToCursorRange(a),a=y.getCursorSelection(k),b.position!==a.position||b.length!==a.length)a=p(b.position,b.length,ops.OdtCursor.RangeSelection),h.enqueue([a])};this.moveCursorToLeft=function(){a(K,!1);return!0};this.moveCursorToRight=function(){a(v,!1);return!0};this.extendSelectionToLeft=function(){a(K,!0);return!0};this.extendSelectionToRight=function(){a(v,!0);return!0};this.setCaretXPositionLocator=function(a){F=a};this.moveCursorUp=function(){d(K,!1);return!0};this.moveCursorDown=
function(){d(v,!1);return!0};this.extendSelectionUp=function(){d(K,!0);return!0};this.extendSelectionDown=function(){d(v,!0);return!0};this.moveCursorBeforeWord=function(){l(K,!1);return!0};this.moveCursorPastWord=function(){l(v,!1);return!0};this.extendSelectionBeforeWord=function(){l(K,!0);return!0};this.extendSelectionPastWord=function(){l(v,!0);return!0};this.moveCursorToLineStart=function(){r(K,!1);return!0};this.moveCursorToLineEnd=function(){r(v,!1);return!0};this.extendSelectionToLineStart=
function(){r(K,!0);return!0};this.extendSelectionToLineEnd=function(){r(v,!0);return!0};this.extendSelectionToParagraphStart=function(){B(K,!0,z.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){B(v,!0,z.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){B(K,!1,z.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){B(v,!1,z.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){B(K,!1,y.getRootElement);return!0};
this.moveCursorToDocumentEnd=function(){B(v,!1,y.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){B(K,!0,y.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){B(v,!0,y.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var a=y.getCursor(k),a=y.getRootElement(a.getNode()),b,d,c;runtime.assert(Boolean(a),"SelectionController: Cursor outside root");c=y.createStepIterator(a,0,[t,w],a);c.roundToClosestStep();b=c.container();d=c.offset();
c.setPosition(a,a.childNodes.length);c.roundToClosestStep();a=y.convertDomToCursorRange({anchorNode:b,anchorOffset:d,focusNode:c.container(),focusOffset:c.offset()});h.enqueue([p(a.position,a.length)]);return!0};this.destroy=function(a){y.unsubscribe(ops.OdtDocument.signalOperationStart,c);core.Async.destroyAll([H.destroy],a)};(function(){H=core.Task.createTimeoutTask(function(){L=void 0},2E3);y.subscribe(ops.OdtDocument.signalOperationStart,c)})()};gui.TextController=function(h,k,c,b,g,n){function p(){B=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?c.isLocalCursorWithinOwnAnnotation():!0}function m(a){a.getMemberId()===b&&p()}function q(a,b,c){var e=[d.getPositionFilter()];c&&e.push(d.createRootFilter(a.startContainer));c=d.createStepIterator(a.startContainer,a.startOffset,e,b);c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");b=d.convertDomPointToCursorStep(c.container(),c.offset());
a.collapsed?a=b:(c.setPosition(a.endContainer,a.endOffset),c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),a=d.convertDomPointToCursorStep(c.container(),c.offset()));return{position:b,length:a-b}}function f(a){var d,c,e,f=r.getParagraphElements(a),g=a.cloneRange(),h=[];d=f[0];1<f.length&&(r.hasNoODFContent(d)&&(d=f[f.length-1]),c=d.getAttributeNS(odf.Namespaces.textns,"style-name")||"");f.forEach(function(d,f){var k,n;g.setStart(d,0);g.collapse(!0);
k=q(g,d,!1).position;0<f&&(n=new ops.OpMergeParagraph,n.init({memberid:b,paragraphStyleName:c,destinationStartPosition:e,sourceStartPosition:k,moveCursor:1===f}),h.unshift(n));e=k;g.selectNodeContents(d);if(k=l.rangeIntersection(g,a))k=q(k,d,!0),0<k.length&&(n=new ops.OpRemoveText,n.init({memberid:b,position:k.position,length:k.length}),h.unshift(n))});return h}function e(a){0>a.length&&(a.position+=a.length,a.length=-a.length);return a}function a(a){if(!B)return!1;var c,g=d.getCursor(b).getSelectedRange().cloneRange(),
l=e(d.getCursorSelection(b)),k;if(0===l.length){l=void 0;c=d.getCursor(b).getNode();k=d.getRootElement(c);var n=[d.getPositionFilter(),d.createRootFilter(k)];k=d.createStepIterator(c,0,n,k);k.roundToClosestStep()&&(a?k.nextStep():k.previousStep())&&(l=e(d.convertDomToCursorRange({anchorNode:c,anchorOffset:0,focusNode:k.container(),focusOffset:k.offset()})),a?(g.setStart(c,0),g.setEnd(k.container(),k.offset())):(g.setStart(k.container(),k.offset()),g.setEnd(c,0)))}l&&h.enqueue(f(g));return void 0!==
l}var d=h.getOdtDocument(),r=odf.OdfUtils,l=core.DomUtils,B=!1,y=odf.Namespaces.textns,D=core.StepDirection.NEXT;this.isEnabled=function(){return B};this.enqueueParagraphSplittingOps=function(){if(!B)return!1;var a=d.getCursor(b),c=a.getSelectedRange(),g=e(d.getCursorSelection(b)),l=[],a=r.getParagraphElement(a.getNode()),k=a.getAttributeNS(y,"style-name")||"";0<g.length&&(l=l.concat(f(c)));c=new ops.OpSplitParagraph;c.init({memberid:b,position:g.position,paragraphStyleName:k,sourceParagraphPosition:d.convertDomPointToCursorStep(a,
0,D),moveCursor:!0});l.push(c);n&&(g=n(g.position+1),l=l.concat(g));h.enqueue(l);return!0};this.removeTextByBackspaceKey=function(){return a(!1)};this.removeTextByDeleteKey=function(){return a(!0)};this.removeCurrentSelection=function(){if(!B)return!1;var a=d.getCursor(b).getSelectedRange();h.enqueue(f(a));return!0};this.insertText=function(a){if(B){var c=d.getCursor(b).getSelectedRange(),l=e(d.getCursorSelection(b)),k=[],n=!1;0<l.length&&(k=k.concat(f(c)),n=!0);c=new ops.OpInsertText;c.init({memberid:b,
position:l.position,text:a,moveCursor:!0});k.push(c);g&&(a=g(l.position,a.length,n))&&k.push(a);h.enqueue(k)}};this.destroy=function(a){d.unsubscribe(ops.Document.signalCursorMoved,m);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);a()};d.subscribe(ops.Document.signalCursorMoved,m);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,p);p()};gui.UndoManager=function(){};gui.UndoManager.prototype.subscribe=function(h,k){};gui.UndoManager.prototype.unsubscribe=function(h,k){};gui.UndoManager.prototype.setDocument=function(h){};gui.UndoManager.prototype.setInitialState=function(){};gui.UndoManager.prototype.initialize=function(){};gui.UndoManager.prototype.purgeInitialState=function(){};gui.UndoManager.prototype.setPlaybackFunction=function(h){};gui.UndoManager.prototype.hasUndoStates=function(){};
gui.UndoManager.prototype.hasRedoStates=function(){};gui.UndoManager.prototype.moveForward=function(h){};gui.UndoManager.prototype.moveBackward=function(h){};gui.UndoManager.prototype.onOperationExecuted=function(h){};gui.UndoManager.prototype.isDocumentModified=function(){};gui.UndoManager.prototype.setDocumentModified=function(h){};gui.UndoManager.signalUndoStackChanged="undoStackChanged";gui.UndoManager.signalUndoStateCreated="undoStateCreated";gui.UndoManager.signalUndoStateModified="undoStateModified";
gui.UndoManager.signalDocumentModifiedChanged="documentModifiedChanged";gui.SessionControllerOptions=function(){this.annotationsEnabled=this.directParagraphStylingEnabled=this.directTextStylingEnabled=!1};
(function(){var h=core.PositionFilter.FilterResult.FILTER_ACCEPT;gui.SessionController=function(k,c,b,g){function n(a,b){var d=C.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 p(a){var b=C.getCursor(c).getSelectedRange();b.collapsed?a.preventDefault():Y.setDataFromRange(a,b)?fa.removeCurrentSelection():
runtime.log("Cut operation failed")}function m(){return!1!==C.getCursor(c).getSelectedRange().collapsed}function q(a){var b=C.getCursor(c).getSelectedRange();b.collapsed?a.preventDefault():Y.setDataFromRange(a,b)||runtime.log("Copy operation failed")}function f(a){var b;R.clipboardData&&R.clipboardData.getData?b=R.clipboardData.getData("Text"):a.clipboardData&&a.clipboardData.getData&&(b=a.clipboardData.getData("text/plain"));b&&(fa.removeCurrentSelection(),ga.paste(b));a.preventDefault?a.preventDefault():
a.returnValue=!1}function e(){return!1}function a(a){if(V)V.onOperationExecuted(a)}function d(a){C.emit(ops.OdtDocument.signalUndoStackChanged,a)}function r(){var a;return V?(a=M.hasFocus(),V.moveBackward(1),a&&M.focus(),!0):!1}function l(){var a;return V?(a=M.hasFocus(),V.moveForward(1),a&&M.focus(),!0):!1}function B(a){var d=C.getCursor(c).getSelectedRange(),e=(a.target||a.srcElement||null).getAttribute("end");d&&e&&(a=n(a.clientX,a.clientY))&&(ia.setUnfilteredPosition(a.container,a.offset),ba.acceptPosition(ia)===
h&&(d=d.cloneRange(),"left"===e?d.setStart(ia.container(),ia.unfilteredDomOffset()):d.setEnd(ia.container(),ia.unfilteredDomOffset()),b.setSelectedRange(d,"right"===e),C.emit(ops.Document.signalCursorMoved,b)))}function y(){W.selectRange(b.getSelectedRange(),b.hasForwardSelection(),1)}function D(){var a=R.getSelection(),d=0<a.rangeCount&&W.selectionToRange(a);X&&d&&(J=!0,la.clearSelection(),ia.setUnfilteredPosition(a.focusNode,a.focusOffset),ba.acceptPosition(ia)===h&&(2===oa?W.expandToWordBoundaries(d.range):
3<=oa&&W.expandToParagraphBoundaries(d.range),b.setSelectedRange(d.range,d.hasForwardSelection),C.emit(ops.Document.signalCursorMoved,b)))}function z(a){var b=a.target||a.srcElement||null,d=C.getCursor(c);if(X=null!==b&&U.containsNode(C.getOdfCanvas().getElement(),b))J=!1,b=C.getRootElement(b)||C.getRootNode(),ba=C.createRootFilter(b),oa=0===a.button?a.detail:0,d&&a.shiftKey?R.getSelection().collapse(d.getAnchorNode(),0):(a=R.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&&D()}function t(a){var b=C.getRootElement(a),d=C.createRootFilter(b),b=C.createStepIterator(a,0,[d,C.getPositionFilter()],b);b.setPosition(a,a.childNodes.length);return b.roundToNextStep()?{container:b.container(),offset:b.offset()}:null}function x(a){var b;b=(b=R.getSelection())?{anchorNode:b.anchorNode,
anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}:null;var d=R.getSelection().isCollapsed,c,e;b.anchorNode||b.focusNode||!(c=n(a.clientX,a.clientY))||(b.anchorNode=c.container,b.anchorOffset=c.offset,b.focusNode=b.anchorNode,b.focusOffset=b.anchorOffset);if(T.isImage(b.focusNode)&&0===b.focusOffset&&T.isCharacterFrame(b.focusNode.parentNode)){if(e=b.focusNode.parentNode,c=e.getBoundingClientRect(),a.clientX>c.left&&(c=t(e)))b.focusNode=c.container,b.focusOffset=c.offset,
d&&(b.anchorNode=b.focusNode,b.anchorOffset=b.focusOffset)}else T.isImage(b.focusNode.firstChild)&&1===b.focusOffset&&T.isCharacterFrame(b.focusNode)&&(c=t(b.focusNode))&&(b.anchorNode=b.focusNode=c.container,b.anchorOffset=b.focusOffset=c.offset);b.anchorNode&&b.focusNode&&(b=W.selectionToRange(b),W.selectRange(b.range,b.hasForwardSelection,0===a.button?a.detail:0));M.focus()}function w(a){var b;if(b=n(a.clientX,a.clientY))a=b.container,b=b.offset,a={anchorNode:a,anchorOffset:b,focusNode:a,focusOffset:b},
a=W.selectionToRange(a),W.selectRange(a.range,a.hasForwardSelection,2),M.focus()}function F(a){var d=a.target||a.srcElement||null,c,e,f;ma.processRequests();X&&(T.isImage(d)&&T.isCharacterFrame(d.parentNode)&&R.getSelection().isCollapsed?(W.selectImage(d.parentNode),M.focus()):la.isSelectorElement(d)?M.focus():J?(d=b.getSelectedRange(),e=d.collapsed,T.isImage(d.endContainer)&&0===d.endOffset&&T.isCharacterFrame(d.endContainer.parentNode)&&(f=d.endContainer.parentNode,f=t(f))&&(d.setEnd(f.container,
f.offset),e&&d.collapse(!1)),W.selectRange(d,b.hasForwardSelection(),0===a.button?a.detail:0),M.focus()):ua?x(a):(c=U.cloneEvent(a),S=runtime.setTimeout(function(){x(c)},0)),oa=0,J=X=!1)}function L(a){var b=C.getCursor(c).getSelectedRange();b.collapsed||ca.exportRangeToDataTransfer(a.dataTransfer,b)}function H(){X&&M.focus();oa=0;J=X=!1}function G(a){F(a)}function A(a){var b=a.target||a.srcElement||null,d=null;"annotationRemoveButton"===b.className?(runtime.assert(ja,"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),
d=b.parentNode.getElementsByTagNameNS(odf.Namespaces.officens,"annotation").item(0),ea.removeAnnotation(d),M.focus()):"webodf-draggable"!==b.getAttribute("class")&&F(a)}function K(a){(a=a.data)&&(-1===a.indexOf("\n")?fa.insertText(a):ga.paste(a))}function v(a){return function(){a();return!0}}function u(a){return function(b){return C.getCursor(c).getSelectionType()===ops.OdtCursor.RangeSelection?a(b):!0}}function Q(b){M.unsubscribe("keydown",E.handleEvent);M.unsubscribe("keypress",Z.handleEvent);M.unsubscribe("keyup",
da.handleEvent);M.unsubscribe("copy",q);M.unsubscribe("mousedown",z);M.unsubscribe("mousemove",ma.trigger);M.unsubscribe("mouseup",A);M.unsubscribe("contextmenu",G);M.unsubscribe("dragstart",L);M.unsubscribe("dragend",H);M.unsubscribe("click",pa.handleClick);M.unsubscribe("longpress",w);M.unsubscribe("drag",B);M.unsubscribe("dragstop",y);C.unsubscribe(ops.OdtDocument.signalOperationEnd,na.trigger);C.unsubscribe(ops.Document.signalCursorAdded,ka.registerCursor);C.unsubscribe(ops.Document.signalCursorRemoved,
ka.removeCursor);C.unsubscribe(ops.OdtDocument.signalOperationEnd,a);b()}var R=runtime.getWindow(),C=k.getOdtDocument(),I=new gui.SessionConstraints,P=new gui.SessionContext(k,c),U=core.DomUtils,T=odf.OdfUtils,ca=new gui.MimeDataExporter,Y=new gui.Clipboard(ca),E=new gui.KeyboardHandler,Z=new gui.KeyboardHandler,da=new gui.KeyboardHandler,X=!1,ha=new odf.ObjectNameGenerator(C.getOdfCanvas().odfContainer(),c),J=!1,ba=null,S,V=null,M=new gui.EventManager(C),ja=g.annotationsEnabled,ea=new gui.AnnotationController(k,
I,c),aa=new gui.DirectFormattingController(k,I,P,c,ha,g.directTextStylingEnabled,g.directParagraphStylingEnabled),fa=new gui.TextController(k,I,P,c,aa.createCursorStyleOp,aa.createParagraphStyleOps),qa=new gui.ImageController(k,I,P,c,ha),la=new gui.ImageSelector(C.getOdfCanvas()),ia=C.createPositionIterator(C.getRootNode()),ma,na,ga=new gui.PasteController(k,I,P,c),ka=new gui.InputMethodEditor(c,M),oa=0,pa=new gui.HyperlinkClickHandler(C.getOdfCanvas().getElement,E,da),ta=new gui.HyperlinkController(k,
I,P,c),W=new gui.SelectionController(k,c),va=new gui.MetadataController(k,c),N=gui.KeyboardHandler.Modifier,O=gui.KeyboardHandler.KeyCode,ra=-1!==R.navigator.appVersion.toLowerCase().indexOf("mac"),ua=-1!==["iPad","iPod","iPhone"].indexOf(R.navigator.platform),sa;runtime.assert(null!==R,"Expected to be run in an environment which has a global window, like a browser.");this.undo=r;this.redo=l;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]);M.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,fa.removeCurrentSelection);ka.subscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.subscribe("beforecut",m);M.subscribe("cut",p);
M.subscribe("beforepaste",e);M.subscribe("paste",f);V&&V.initialize();M.setEditing(!0);pa.setModifier(ra?N.Meta:N.Ctrl);E.bind(O.Backspace,N.None,v(fa.removeTextByBackspaceKey),!0);E.bind(O.Delete,N.None,fa.removeTextByDeleteKey);E.bind(O.Tab,N.None,u(function(){fa.insertText("\t");return!0}));ra?(E.bind(O.Clear,N.None,fa.removeCurrentSelection),E.bind(O.B,N.Meta,u(aa.toggleBold)),E.bind(O.I,N.Meta,u(aa.toggleItalic)),E.bind(O.U,N.Meta,u(aa.toggleUnderline)),E.bind(O.L,N.MetaShift,u(aa.alignParagraphLeft)),
E.bind(O.E,N.MetaShift,u(aa.alignParagraphCenter)),E.bind(O.R,N.MetaShift,u(aa.alignParagraphRight)),E.bind(O.J,N.MetaShift,u(aa.alignParagraphJustified)),ja&&E.bind(O.C,N.MetaShift,ea.addAnnotation),E.bind(O.Z,N.Meta,r),E.bind(O.Z,N.MetaShift,l)):(E.bind(O.B,N.Ctrl,u(aa.toggleBold)),E.bind(O.I,N.Ctrl,u(aa.toggleItalic)),E.bind(O.U,N.Ctrl,u(aa.toggleUnderline)),E.bind(O.L,N.CtrlShift,u(aa.alignParagraphLeft)),E.bind(O.E,N.CtrlShift,u(aa.alignParagraphCenter)),E.bind(O.R,N.CtrlShift,u(aa.alignParagraphRight)),
E.bind(O.J,N.CtrlShift,u(aa.alignParagraphJustified)),ja&&E.bind(O.C,N.CtrlAlt,ea.addAnnotation),E.bind(O.Z,N.Ctrl,r),E.bind(O.Z,N.CtrlShift,l));Z.setDefault(u(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:(fa.insertText(b),!0)}));Z.bind(O.Enter,N.None,u(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ka.unsubscribe(gui.InputMethodEditor.signalCompositionStart,
fa.removeCurrentSelection);ka.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.unsubscribe("cut",p);M.unsubscribe("beforecut",m);M.unsubscribe("paste",f);M.unsubscribe("beforepaste",e);M.setEditing(!1);pa.setModifier(N.None);E.bind(O.Backspace,N.None,function(){return!0},!0);E.unbind(O.Delete,N.None);E.unbind(O.Tab,N.None);ra?(E.unbind(O.Clear,N.None),E.unbind(O.B,N.Meta),E.unbind(O.I,N.Meta),E.unbind(O.U,N.Meta),E.unbind(O.L,N.MetaShift),E.unbind(O.E,N.MetaShift),E.unbind(O.R,N.MetaShift),
E.unbind(O.J,N.MetaShift),ja&&E.unbind(O.C,N.MetaShift),E.unbind(O.Z,N.Meta),E.unbind(O.Z,N.MetaShift)):(E.unbind(O.B,N.Ctrl),E.unbind(O.I,N.Ctrl),E.unbind(O.U,N.Ctrl),E.unbind(O.L,N.CtrlShift),E.unbind(O.E,N.CtrlShift),E.unbind(O.R,N.CtrlShift),E.unbind(O.J,N.CtrlShift),ja&&E.unbind(O.C,N.CtrlAlt),E.unbind(O.Z,N.Ctrl),E.unbind(O.Z,N.CtrlShift));Z.setDefault(null);Z.unbind(O.Enter,N.None)};this.getInputMemberId=function(){return c};this.getSession=function(){return k};this.getSessionConstraints=function(){return I};
this.setUndoManager=function(a){V&&V.unsubscribe(gui.UndoManager.signalUndoStackChanged,d);if(V=a)V.setDocument(C),V.setPlaybackFunction(k.enqueue),V.subscribe(gui.UndoManager.signalUndoStackChanged,d)};this.getUndoManager=function(){return V};this.getMetadataController=function(){return va};this.getAnnotationController=function(){return ea};this.getDirectFormattingController=function(){return aa};this.getHyperlinkClickHandler=function(){return pa};this.getHyperlinkController=function(){return ta};
this.getImageController=function(){return qa};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return M};this.getKeyboardHandlers=function(){return{keydown:E,keypress:Z}};this.destroy=function(a){var b=[ma.destroy,na.destroy,aa.destroy,ka.destroy,M.destroy,pa.destroy,ta.destroy,va.destroy,W.destroy,fa.destroy,Q];sa&&b.unshift(sa.destroy);runtime.clearTimeout(S);core.Async.destroyAll(b,a)};ma=core.Task.createRedrawTask(D);
na=core.Task.createRedrawTask(function(){var a=C.getCursor(c);if(a&&a.getSelectionType()===ops.OdtCursor.RegionSelection&&(a=T.getImageElements(a.getSelectedRange())[0])){la.select(a.parentNode);return}la.clearSelection()});E.bind(O.Left,N.None,u(W.moveCursorToLeft));E.bind(O.Right,N.None,u(W.moveCursorToRight));E.bind(O.Up,N.None,u(W.moveCursorUp));E.bind(O.Down,N.None,u(W.moveCursorDown));E.bind(O.Left,N.Shift,u(W.extendSelectionToLeft));E.bind(O.Right,N.Shift,u(W.extendSelectionToRight));E.bind(O.Up,
N.Shift,u(W.extendSelectionUp));E.bind(O.Down,N.Shift,u(W.extendSelectionDown));E.bind(O.Home,N.None,u(W.moveCursorToLineStart));E.bind(O.End,N.None,u(W.moveCursorToLineEnd));E.bind(O.Home,N.Ctrl,u(W.moveCursorToDocumentStart));E.bind(O.End,N.Ctrl,u(W.moveCursorToDocumentEnd));E.bind(O.Home,N.Shift,u(W.extendSelectionToLineStart));E.bind(O.End,N.Shift,u(W.extendSelectionToLineEnd));E.bind(O.Up,N.CtrlShift,u(W.extendSelectionToParagraphStart));E.bind(O.Down,N.CtrlShift,u(W.extendSelectionToParagraphEnd));
E.bind(O.Home,N.CtrlShift,u(W.extendSelectionToDocumentStart));E.bind(O.End,N.CtrlShift,u(W.extendSelectionToDocumentEnd));ra?(E.bind(O.Left,N.Alt,u(W.moveCursorBeforeWord)),E.bind(O.Right,N.Alt,u(W.moveCursorPastWord)),E.bind(O.Left,N.Meta,u(W.moveCursorToLineStart)),E.bind(O.Right,N.Meta,u(W.moveCursorToLineEnd)),E.bind(O.Home,N.Meta,u(W.moveCursorToDocumentStart)),E.bind(O.End,N.Meta,u(W.moveCursorToDocumentEnd)),E.bind(O.Left,N.AltShift,u(W.extendSelectionBeforeWord)),E.bind(O.Right,N.AltShift,
u(W.extendSelectionPastWord)),E.bind(O.Left,N.MetaShift,u(W.extendSelectionToLineStart)),E.bind(O.Right,N.MetaShift,u(W.extendSelectionToLineEnd)),E.bind(O.Up,N.AltShift,u(W.extendSelectionToParagraphStart)),E.bind(O.Down,N.AltShift,u(W.extendSelectionToParagraphEnd)),E.bind(O.Up,N.MetaShift,u(W.extendSelectionToDocumentStart)),E.bind(O.Down,N.MetaShift,u(W.extendSelectionToDocumentEnd)),E.bind(O.A,N.Meta,u(W.extendSelectionToEntireDocument))):(E.bind(O.Left,N.Ctrl,u(W.moveCursorBeforeWord)),E.bind(O.Right,
N.Ctrl,u(W.moveCursorPastWord)),E.bind(O.Left,N.CtrlShift,u(W.extendSelectionBeforeWord)),E.bind(O.Right,N.CtrlShift,u(W.extendSelectionPastWord)),E.bind(O.A,N.Ctrl,u(W.extendSelectionToEntireDocument)));ua&&(sa=new gui.IOSSafariSupport(M));M.subscribe("keydown",E.handleEvent);M.subscribe("keypress",Z.handleEvent);M.subscribe("keyup",da.handleEvent);M.subscribe("copy",q);M.subscribe("mousedown",z);M.subscribe("mousemove",ma.trigger);M.subscribe("mouseup",A);M.subscribe("contextmenu",G);M.subscribe("dragstart",
L);M.subscribe("dragend",H);M.subscribe("click",pa.handleClick);M.subscribe("longpress",w);M.subscribe("drag",B);M.subscribe("dragstop",y);C.subscribe(ops.OdtDocument.signalOperationEnd,na.trigger);C.subscribe(ops.Document.signalCursorAdded,ka.registerCursor);C.subscribe(ops.Document.signalCursorRemoved,ka.removeCursor);C.subscribe(ops.OdtDocument.signalOperationEnd,a)}})();gui.CaretManager=function(h,k){function c(b){return n.hasOwnProperty(b)?n[b]:null}function b(){return Object.keys(n).map(function(b){return n[b]})}function g(b){var c=n[b];c&&(delete n[b],b===h.getInputMemberId()?(m.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.ensureVisible),m.unsubscribe(ops.Document.signalCursorMoved,c.refreshCursorBlinking),q.unsubscribe("compositionupdate",c.handleUpdate),q.unsubscribe("compositionend",c.handleUpdate),q.unsubscribe("focus",c.setFocus),q.unsubscribe("blur",
c.removeFocus),p.removeEventListener("focus",c.show,!1),p.removeEventListener("blur",c.hide,!1)):m.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.handleUpdate),c.destroy(function(){}))}var n={},p=runtime.getWindow(),m=h.getSession().getOdtDocument(),q=h.getEventManager();this.registerCursor=function(b,c,a){var d=b.getMemberId();b=new gui.Caret(b,k,c,a);n[d]=b;d===h.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+d),m.subscribe(ops.OdtDocument.signalProcessingBatchEnd,
b.ensureVisible),m.subscribe(ops.Document.signalCursorMoved,b.refreshCursorBlinking),q.subscribe("compositionupdate",b.handleUpdate),q.subscribe("compositionend",b.handleUpdate),q.subscribe("focus",b.setFocus),q.subscribe("blur",b.removeFocus),p.addEventListener("focus",b.show,!1),p.addEventListener("blur",b.hide,!1),b.setOverlayElement(q.getEventTrap())):m.subscribe(ops.OdtDocument.signalProcessingBatchEnd,b.handleUpdate);return b};this.getCaret=c;this.getCarets=b;this.destroy=function(c){var e=
b().map(function(a){return a.destroy});h.getSelectionController().setCaretXPositionLocator(null);m.unsubscribe(ops.Document.signalCursorRemoved,g);n={};core.Async.destroyAll(e,c)};h.getSelectionController().setCaretXPositionLocator(function(){var b=c(h.getInputMemberId()),e;b&&(e=b.getBoundingClientRect());return e?e.right:void 0});m.subscribe(ops.Document.signalCursorRemoved,g)};gui.EditInfoHandle=function(h){var k=[],c,b=h.ownerDocument,g=b.documentElement.namespaceURI;this.setEdits=function(h){k=h;var p,m,q,f;core.DomUtils.removeAllChildNodes(c);for(h=0;h<k.length;h+=1)p=b.createElementNS(g,"div"),p.className="editInfo",m=b.createElementNS(g,"span"),m.className="editInfoColor",m.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[h].memberid),q=b.createElementNS(g,"span"),q.className="editInfoAuthor",q.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",
k[h].memberid),f=b.createElementNS(g,"span"),f.className="editInfoTime",f.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",k[h].memberid),f.appendChild(b.createTextNode(k[h].time.toString())),p.appendChild(m),p.appendChild(q),p.appendChild(f),c.appendChild(p)};this.show=function(){c.style.display="block"};this.hide=function(){c.style.display="none"};this.destroy=function(b){h.removeChild(c);b()};c=b.createElementNS(g,"div");c.setAttribute("class","editInfoHandle");c.style.display="none";
h.appendChild(c)};ops.EditInfo=function(h,k){function c(){var b=[],c;for(c in g)g.hasOwnProperty(c)&&b.push({memberid:c,time:g[c].time});b.sort(function(b,c){return b.time-c.time});return b}var b,g={};this.getNode=function(){return b};this.getOdtDocument=function(){return k};this.getEdits=function(){return g};this.getSortedEdits=function(){return c()};this.addEdit=function(b,c){g[b]={time:c}};this.clearEdits=function(){g={}};this.destroy=function(c){h.parentNode&&h.removeChild(b);c()};b=k.getDOMDocument().createElementNS("urn:webodf:names:editinfo",
"editinfo");h.insertBefore(b,h.firstChild)};gui.EditInfoMarker=function(h,k){function c(b,a){return runtime.setTimeout(function(){p.style.opacity=b},a)}var b=this,g,n,p,m,q,f;this.addEdit=function(b,a){var d=Date.now()-a;h.addEdit(b,a);n.setEdits(h.getSortedEdits());p.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",b);runtime.clearTimeout(q);runtime.clearTimeout(f);1E4>d?(m=c(1,0),q=c(.5,1E4-d),f=c(.2,2E4-d)):1E4<=d&&2E4>d?(m=c(.5,0),f=c(.2,2E4-d)):m=c(.2,0)};this.getEdits=function(){return h.getEdits()};this.clearEdits=function(){h.clearEdits();
n.setEdits([]);p.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&p.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return h};this.show=function(){p.style.display="block"};this.hide=function(){b.hideHandle();p.style.display="none"};this.showHandle=function(){n.show()};this.hideHandle=function(){n.hide()};this.destroy=function(b){runtime.clearTimeout(m);runtime.clearTimeout(q);runtime.clearTimeout(f);g.removeChild(p);n.destroy(function(a){a?
b(a):h.destroy(b)})};(function(){var c=h.getOdtDocument().getDOMDocument();p=c.createElementNS(c.documentElement.namespaceURI,"div");p.setAttribute("class","editInfoMarker");p.onmouseover=function(){b.showHandle()};p.onmouseout=function(){b.hideHandle()};g=h.getNode();g.appendChild(p);n=new gui.EditInfoHandle(g);k||b.hide()})()};gui.HyperlinkTooltipView=function(h,k){var c=core.DomUtils,b=odf.OdfUtils,g=runtime.getWindow(),n,p,m;runtime.assert(null!==g,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(q){var f=q.target||q.srcElement,e=h.getSizer(),a=h.getZoomLevel(),d;a:{for(;f;){if(b.isHyperlink(f))break a;if(b.isParagraph(f)||b.isInlineRoot(f))break;f=f.parentNode}f=null}if(f){c.containsNode(e,m)||e.appendChild(m);d=p;var r;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:r=
runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:r=runtime.tr("\u2318-click to follow link");break;default:r=""}d.textContent=r;n.textContent=b.getHyperlinkTarget(f);m.style.display="block";d=g.innerWidth-m.offsetWidth-15;f=q.clientX>d?d:q.clientX+15;d=g.innerHeight-m.offsetHeight-10;q=q.clientY>d?d:q.clientY+10;e=e.getBoundingClientRect();f=(f-e.left)/a;q=(q-e.top)/a;m.style.left=f+"px";m.style.top=q+"px"}};this.hideTooltip=function(){m.style.display="none"};this.destroy=
function(b){m.parentNode&&m.parentNode.removeChild(m);b()};(function(){var b=h.getElement().ownerDocument;n=b.createElement("span");p=b.createElement("span");n.className="webodf-hyperlinkTooltipLink";p.className="webodf-hyperlinkTooltipText";m=b.createElement("div");m.className="webodf-hyperlinkTooltip";m.appendChild(n);m.appendChild(p);h.getElement().appendChild(m)})()};gui.OdfFieldView=function(h){function k(){var b=odf.OdfSchema.getFields().map(function(b){return b.replace(":","|")}),c=b.join(",\n")+"\n{ background-color: #D0D0D0; }\n",b=b.map(function(b){return b+":empty::after"}).join(",\n")+"\n{ content:' '; white-space: pre; }\n";return c+"\n"+b}var c,b=h.getElement().ownerDocument;this.showFieldHighlight=function(){c.appendChild(b.createTextNode(k()))};this.hideFieldHighlight=function(){for(var b=c.sheet,h=b.cssRules;h.length;)b.deleteRule(h.length-1)};this.destroy=
function(b){c.parentNode&&c.parentNode.removeChild(c);b()};c=function(){var c=b.getElementsByTagName("head").item(0),h=b.createElement("style"),k="";h.type="text/css";h.media="screen, print, handheld, projection";odf.Namespaces.forEachPrefix(function(b,c){k+="@namespace "+b+" url("+c+");\n"});h.appendChild(b.createTextNode(k));c.appendChild(h);return h}()};gui.ShadowCursor=function(h){var k=h.getDOMDocument().createRange(),c=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(b,g){k=b;c=!1!==g};this.hasForwardSelection=function(){return c};this.getDocument=function(){return h};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(h.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(h){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(h){};gui.SelectionViewManager=function(h){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,g){var k=b.getMemberId(),p=new h(b);g?p.show():p.hide();return c[k]=p};this.destroy=function(b){function c(k,m){m?b(m):k<h.length?h[k].destroy(function(b){c(k+1,b)}):b()}var h=k();c(0,void 0)}};gui.SessionViewOptions=function(){this.caretBlinksOnRangeSelect=this.caretAvatarsInitiallyVisible=this.editInfoMarkersInitiallyVisible=!0};
(function(){function h(h,c){return void 0!==h?Boolean(h):c}gui.SessionView=function(k,c,b,g,n,p){function m(a){a.memberId===c&&L.getViewport().scrollIntoView(a.annotation.getBoundingClientRect())}function q(){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 f(a,b,d){function e(b,d,c){d=b+'[editinfo|memberid="'+a+'"]'+c+d;a:{var f=t.firstChild;for(b=b+'[editinfo|memberid="'+
a+'"]'+c+"{";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:t.appendChild(document.createTextNode(d))}e("div.editInfoMarker","{ background-color: "+d+"; }","");e("span.editInfoColor","{ background-color: "+d+"; }","");e("span.editInfoAuthor",'{ content: "'+b+'"; }',":before");e("dc|creator","{ background-color: "+d+"; }","");e(".webodf-selectionOverlay","{ fill: "+d+"; stroke: "+d+";}","");a===c&&(e(".webodf-touchEnabled .webodf-selectionOverlay",
"{ display: block; }"," > .webodf-draggable"),a=gui.ShadowCursor.ShadowCursorMemberId,e(".webodf-selectionOverlay","{ fill: "+d+"; stroke: "+d+";}",""),e(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function e(a){var b,d;for(d in w)w.hasOwnProperty(d)&&(b=w[d],a?b.show():b.hide())}function a(a){n.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function d(a){var b=a.getMemberId();a=a.getProperties();f(b,a.fullName,a.color)}function r(a){var d=
a.getMemberId(),c=b.getOdtDocument().getMember(d).getProperties();n.registerCursor(a,A,K);p.registerCursor(a,!0);if(a=n.getCaret(d))a.setAvatarImageUrl(c.imageUrl),a.setColor(c.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+d+"'! +++")}function l(a){a=a.getMemberId();var b=p.getSelectionView(c),d=p.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),e=n.getCaret(c);a===c?(d.hide(),b&&b.show(),e&&e.show()):a===gui.ShadowCursor.ShadowCursorMemberId&&(d.show(),b&&b.hide(),
e&&e.hide())}function B(a){p.removeSelectionView(a)}function y(a){var d=a.paragraphElement,c=a.memberId;a=a.timeStamp;var e,f="",g=d.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo").item(0);g?(f=g.getAttributeNS("urn:webodf:names:editinfo","id"),e=w[f]):(f=Math.random().toString(),e=new ops.EditInfo(d,b.getOdtDocument()),e=new gui.EditInfoMarker(e,G),g=d.getElementsByTagNameNS("urn:webodf:names:editinfo","editinfo").item(0),g.setAttributeNS("urn:webodf:names:editinfo","id",f),w[f]=e);
e.addEdit(c,new Date(a));H.trigger()}function D(){var a;x.hasChildNodes()&&core.DomUtils.removeAllChildNodes(x);!0===g.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(a=b.getOdtDocument().getMember(c))&&(a=a.getProperties().fullName,x.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+a+"']) .annotationRemoveButton { display: none; }")))}function z(a){var b=Object.keys(w).map(function(a){return w[a]});F.unsubscribe(ops.Document.signalMemberAdded,d);F.unsubscribe(ops.Document.signalMemberUpdated,
d);F.unsubscribe(ops.Document.signalCursorAdded,r);F.unsubscribe(ops.Document.signalCursorRemoved,B);F.unsubscribe(ops.OdtDocument.signalParagraphChanged,y);F.unsubscribe(ops.Document.signalCursorMoved,l);F.unsubscribe(ops.OdtDocument.signalParagraphChanged,p.rerenderSelectionViews);F.unsubscribe(ops.OdtDocument.signalTableAdded,p.rerenderSelectionViews);F.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,p.rerenderSelectionViews);g.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,
D);F.unsubscribe(ops.Document.signalMemberAdded,D);F.unsubscribe(ops.Document.signalMemberUpdated,D);t.parentNode.removeChild(t);x.parentNode.removeChild(x);(function R(d,c){c?a(c):d<b.length?b[d].destroy(function(a){R(d+1,a)}):a()})(0,void 0)}var t,x,w={},F,L,H,G=h(k.editInfoMarkersInitiallyVisible,!0),A=h(k.caretAvatarsInitiallyVisible,!0),K=h(k.caretBlinksOnRangeSelect,!0);this.showEditInfoMarkers=function(){G||(G=!0,e(G))};this.hideEditInfoMarkers=function(){G&&(G=!1,e(G))};this.showCaretAvatars=
function(){A||(A=!0,a(A))};this.hideCaretAvatars=function(){A&&(A=!1,a(A))};this.getSession=function(){return b};this.getCaret=function(a){return n.getCaret(a)};this.destroy=function(a){var b=[H.destroy,z];F.unsubscribe(ops.OdtDocument.signalAnnotationAdded,m);core.Async.destroyAll(b,a)};F=b.getOdtDocument();L=F.getOdfCanvas();F.subscribe(ops.OdtDocument.signalAnnotationAdded,m);F.subscribe(ops.Document.signalMemberAdded,d);F.subscribe(ops.Document.signalMemberUpdated,d);F.subscribe(ops.Document.signalCursorAdded,
r);F.subscribe(ops.Document.signalCursorRemoved,B);F.subscribe(ops.OdtDocument.signalParagraphChanged,y);F.subscribe(ops.Document.signalCursorMoved,l);F.subscribe(ops.OdtDocument.signalParagraphChanged,p.rerenderSelectionViews);F.subscribe(ops.OdtDocument.signalTableAdded,p.rerenderSelectionViews);F.subscribe(ops.OdtDocument.signalParagraphStyleModified,p.rerenderSelectionViews);g.subscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,D);F.subscribe(ops.Document.signalMemberAdded,D);F.subscribe(ops.Document.signalMemberUpdated,
D);t=q();t.appendChild(document.createTextNode("@namespace editinfo url(urn:webodf:names:editinfo);"));t.appendChild(document.createTextNode("@namespace dc url(http://purl.org/dc/elements/1.1/);"));x=q();D();H=core.Task.createRedrawTask(function(){var a=L.getAnnotationViewManager();a&&(a.rehighlightAnnotations(),F.fixCursorPositions())})}})();gui.SvgSelectionView=function(h){function k(){var a=d.getRootNode();r!==a&&(r=a,l=d.getCanvas().getSizer(),l.appendChild(y),y.setAttribute("class","webodf-selectionOverlay"),z.setAttribute("class","webodf-draggable"),t.setAttribute("class","webodf-draggable"),z.setAttribute("end","left"),t.setAttribute("end","right"),z.setAttribute("r",8),t.setAttribute("r",8),y.appendChild(D),y.appendChild(z),y.appendChild(t))}function c(a){a=a.getBoundingClientRect();return Boolean(a&&0!==a.height)}function b(a){var b=
x.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,l=h;d.setStart(g,h);for(d.setEnd(g,l);!c(d);){if(g.nodeType===Node.ELEMENT_NODE&&l<g.childNodes.length)l=g.childNodes.length;else if(g.nodeType===Node.TEXT_NODE&&l<g.length)l+=1;else if(b[f])g=b[f],f+=1,h=l=0;else{f=!1;break a}d.setStart(g,h);d.setEnd(g,l)}f=!0}if(!f)return null;a:{f=b.length-1;g=b[f];l=h=e.endContainer===g?e.endOffset:
g.nodeType===Node.TEXT_NODE?g.length:g.childNodes.length;e.setStart(g,h);for(e.setEnd(g,l);!c(e);){if(g.nodeType===Node.ELEMENT_NODE&&0<h)h=0;else if(g.nodeType===Node.TEXT_NODE&&0<h)--h;else if(b[f])g=b[f],--f,h=l=g.length||g.childNodes.length;else{b=!1;break a}e.setStart(g,h);e.setEnd(g,l)}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 g(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 n(a,b){b&&0<b.width&&0<b.height&&(a=a?g(a,b):b);return a}function p(a){function b(a){H.setUnfilteredPosition(a,0);return y.acceptNode(a)===G&&t.acceptPosition(H)===G?G:A}function c(a){var d=null;b(a)===G&&(d=w.getBoundingClientRect(a));return d}var e=a.commonAncestorContainer,f=a.startContainer,g=a.endContainer,h=a.startOffset,l=a.endOffset,
k,r,m=null,p,q=B.createRange(),t,y=new odf.OdfNodeFilter,z;if(f===e||g===e)return q=a.cloneRange(),m=q.getBoundingClientRect(),q.detach(),m;for(a=f;a.parentNode!==e;)a=a.parentNode;for(r=g;r.parentNode!==e;)r=r.parentNode;t=d.createRootFilter(f);for(e=a.nextSibling;e&&e!==r;)p=c(e),m=n(m,p),e=e.nextSibling;if(x.isParagraph(a))m=n(m,w.getBoundingClientRect(a));else if(a.nodeType===Node.TEXT_NODE)e=a,q.setStart(e,h),q.setEnd(e,e===r?l:e.length),p=q.getBoundingClientRect(),m=n(m,p);else for(z=B.createTreeWalker(a,
NodeFilter.SHOW_TEXT,b,!1),e=z.currentNode=f;e&&e!==g;)q.setStart(e,h),q.setEnd(e,e.length),p=q.getBoundingClientRect(),m=n(m,p),k=e,h=0,e=z.nextNode();k||(k=f);if(x.isParagraph(r))m=n(m,w.getBoundingClientRect(r));else if(r.nodeType===Node.TEXT_NODE)e=r,q.setStart(e,e===a?h:0),q.setEnd(e,l),p=q.getBoundingClientRect(),m=n(m,p);else for(z=B.createTreeWalker(r,NodeFilter.SHOW_TEXT,b,!1),e=z.currentNode=g;e&&e!==k;)if(q.setStart(e,0),q.setEnd(e,l),p=q.getBoundingClientRect(),m=n(m,p),e=z.previousNode())l=
e.length;return m}function m(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 q(){var a=h.getSelectedRange(),d;if(d=L&&h.getSelectionType()===ops.OdtCursor.RangeSelection&&!a.collapsed){k();var c=w.getBoundingClientRect(l),e=F.getZoomLevel(),a=b(a),f,r,n,q,B,A;if(a){d=a.firstRange;f=a.lastRange;r=a.fillerRange;n=w.translateRect(m(d,!1),c,e);B=w.translateRect(m(f,!0),c,e);q=(q=p(r))?w.translateRect(q,
c,e):g(n,B);A=q.left;q=n.left+Math.max(0,q.width-(n.left-q.left));c=Math.min(n.top,B.top);e=B.top+B.height;A=[{x:n.left,y:c+n.height},{x:n.left,y:c},{x:q,y:c},{x:q,y:e-B.height},{x:B.right,y:e-B.height},{x:B.right,y:e},{x:A,y:e},{x:A,y:c+n.height},{x:n.left,y:c+n.height}];q="";var x;for(x=0;x<A.length;x+=1)q+=A[x].x+","+A[x].y+" ";D.setAttribute("points",q);z.setAttribute("cx",n.left);z.setAttribute("cy",c+n.height/2);t.setAttribute("cx",B.right);t.setAttribute("cy",e-B.height/2);d.detach();f.detach();
r.detach()}d=Boolean(a)}y.style.display=d?"block":"none"}function f(a){L&&a===h&&K.trigger()}function e(a){a=8/a;z.setAttribute("r",a);t.setAttribute("r",a)}function a(a){l.removeChild(y);l.classList.remove("webodf-virtualSelections");h.getDocument().unsubscribe(ops.Document.signalCursorMoved,f);F.unsubscribe(gui.ZoomHelper.signalZoomChanged,e);a()}var d=h.getDocument(),r,l,B=d.getDOMDocument(),y=B.createElementNS("http://www.w3.org/2000/svg","svg"),D=B.createElementNS("http://www.w3.org/2000/svg",
"polygon"),z=B.createElementNS("http://www.w3.org/2000/svg","circle"),t=B.createElementNS("http://www.w3.org/2000/svg","circle"),x=odf.OdfUtils,w=core.DomUtils,F=d.getCanvas().getZoomHelper(),L=!0,H=h.getDocument().createPositionIterator(d.getRootNode()),G=NodeFilter.FILTER_ACCEPT,A=NodeFilter.FILTER_REJECT,K;this.rerender=function(){L&&K.trigger()};this.show=function(){L=!0;K.trigger()};this.hide=function(){L=!1;K.trigger()};this.destroy=function(b){core.Async.destroyAll([K.destroy,a],b)};(function(){var a=
h.getMemberId();K=core.Task.createRedrawTask(q);k();y.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",a);l.classList.add("webodf-virtualSelections");h.getDocument().subscribe(ops.Document.signalCursorMoved,f);F.subscribe(gui.ZoomHelper.signalZoomChanged,e);e(F.getZoomLevel())})()};gui.UndoStateRules=function(){function h(b,c){var h=b.length;this.previous=function(){for(--h;0<=h;--h)if(c(b[h]))return b[h];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,h){if(!h)return h=k(b)-k(c),0===h||1===Math.abs(h);b=k(b);c=k(c);h=k(h);return b-c===c-h}this.isEditOperation=c;this.isPartOfOperationSet=function(g,k){var p=void 0!==g.group,m;if(!g.isEdit||0===k.length)return!0;m=k[k.length-1];if(p&&
g.group===m.group)return!0;a:switch(g.spec().optype){case "RemoveText":case "InsertText":m=!0;break a;default:m=!1}if(m&&k.some(c)){if(p){var q;p=g.spec().optype;m=new h(k,c);var f=m.previous(),e=null,a,d;runtime.assert(Boolean(f),"No edit operations found in state");d=f.group;runtime.assert(void 0!==d,"Operation has no group");for(a=1;f&&f.group===d;){if(p===f.spec().optype){q=f;break}f=m.previous()}if(q){for(f=m.previous();f;){if(f.group!==d){if(2===a)break;d=f.group;a+=1}if(p===f.spec().optype){e=
f;break}f=m.previous()}q=b(g,q,e)}else q=!1;return q}q=g.spec().optype;p=new h(k,c);m=p.previous();runtime.assert(Boolean(m),"No edit operations found in state");q=q===m.spec().optype?b(g,m,p.previous()):!1;return q}return!1}};(function(){function h(b,c){this.mainId=void 0!==b?b:-1;this.subId=void 0!==c?c:-1}function k(b,g,k){function p(c,a){return c+(b.isEditOperation(a)?1:0)}var m,q,f;this.addOperation=function(c){b.isEditOperation(c)&&(f+=1);q.push(c)};this.isNextStateId=function(b){return b.mainId===m&&b.subId===f};this.getNextStateId=function(){return new h(m,f)};this.getOperations=function(){return q};m=c+=1;q=g||[];f=g&&k?g.reduce(p,0):0}var c=0;gui.TrivialUndoManager=function(b){function c(){return!0!==x.isNextStateId(t)}
function n(a){a=a.getOperations();0<a.length&&(G=!0,D(a),G=!1)}function p(){L.emit(gui.UndoManager.signalUndoStackChanged,{undoAvailable:r.hasUndoStates(),redoAvailable:r.hasRedoStates()})}function m(a){var b=c();a!==b&&L.emit(gui.UndoManager.signalDocumentModifiedChanged,b)}function q(){x!==y&&x!==w[w.length-1]&&w.push(x)}function f(a){var b=a.previousSibling||a.nextSibling;a.parentNode.removeChild(a);l.normalizeTextNodes(b)}function e(a){return Object.keys(a).map(function(b){return a[b]})}function a(a){function b(a){var e=
a.spec();if(f[e.memberid])switch(e.optype){case "AddCursor":d[e.memberid]||(d[e.memberid]=a,delete f[e.memberid],--g);break;case "MoveCursor":c[e.memberid]||(c[e.memberid]=a)}}var d={},c={},f={},g,h;h=a.pop();z.getMemberIds().forEach(function(a){f[a]=!0});for(g=Object.keys(f).length;h&&0<g;)h=h.getOperations(),h.reverse(),h.forEach(b),h=a.pop();return new k(H,e(d).concat(e(c)))}function d(){var b=c(),d=B=z.cloneDocumentElement();l.getElementsByTagNameNS(d,"urn:webodf:names:cursor","cursor").forEach(f);
l.getElementsByTagNameNS(d,"urn:webodf:names:cursor","anchor").forEach(f);q();x=y=a([y].concat(w));w.length=0;F.length=0;b||(t=x.getNextStateId());p();m(b)}var r=this,l=core.DomUtils,B,y,D,z,t,x,w=[],F=[],L=new core.EventNotifier([gui.UndoManager.signalUndoStackChanged,gui.UndoManager.signalUndoStateCreated,gui.UndoManager.signalUndoStateModified,gui.UndoManager.signalDocumentModifiedChanged,gui.TrivialUndoManager.signalDocumentRootReplaced]),H=b||new gui.UndoStateRules,G=!1;this.subscribe=function(a,
b){L.subscribe(a,b)};this.unsubscribe=function(a,b){L.unsubscribe(a,b)};this.isDocumentModified=c;this.setDocumentModified=function(a){c()!==a&&(t=a?new h:x.getNextStateId(),L.emit(gui.UndoManager.signalDocumentModifiedChanged,a))};this.hasUndoStates=function(){return 0<w.length};this.hasRedoStates=function(){return 0<F.length};this.setDocument=function(a){z=a};this.purgeInitialState=function(){var a=c();w.length=0;F.length=0;x=y=new k(H);t=x.getNextStateId();B=null;p();m(a)};this.setInitialState=
d;this.initialize=function(){B||d()};this.setPlaybackFunction=function(a){D=a};this.onOperationExecuted=function(a){if(!G){var b=c();H.isEditOperation(a)&&(x===y||0<F.length)||!H.isPartOfOperationSet(a,x.getOperations())?(F.length=0,q(),x=new k(H,[a],!0),w.push(x),L.emit(gui.UndoManager.signalUndoStateCreated,{operations:x.getOperations()}),p()):(x.addOperation(a),L.emit(gui.UndoManager.signalUndoStateModified,{operations:x.getOperations()}));m(b)}};this.moveForward=function(a){for(var b=0,d=c(),
e;a&&F.length;)e=F.pop(),w.push(e),n(e),--a,b+=1;b&&(x=w[w.length-1],p(),m(d));return b};this.moveBackward=function(a){for(var b=0,d=c();a&&w.length;)F.push(w.pop()),--a,b+=1;b&&(z.getMemberIds().forEach(function(a){z.removeCursor(a)}),z.setDocumentElement(B.cloneNode(!0)),L.emit(gui.TrivialUndoManager.signalDocumentRootReplaced,{}),n(y),w.forEach(n),x=w[w.length-1]||y,p(),m(d));return b};x=y=new k(H);t=x.getNextStateId()};gui.TrivialUndoManager.signalDocumentRootReplaced="documentRootReplaced"})();odf.GraphicProperties=function(h,k,c){var b=this,g=odf.Namespaces.stylens,n=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=
h.getAttributeNS(g,"vertical-pos");return""===b?void 0:b},verticalRel:function(){var b=h.getAttributeNS(g,"vertical-rel");return""===b?void 0:b},horizontalPos:function(){var b=h.getAttributeNS(g,"horizontal-pos");return""===b?void 0:b},horizontalRel:function(){var b=h.getAttributeNS(g,"horizontal-rel");return""===b?void 0:b},strokeWidth:function(){var b=h.getAttributeNS(n,"stroke-width");return k.parseLength(b)}})};
odf.ComputedGraphicProperties=function(){var h;this.setGraphicProperties=function(k){h=k};this.verticalPos=function(){return h&&h.verticalPos()||"from-top"};this.verticalRel=function(){return h&&h.verticalRel()||"page"};this.horizontalPos=function(){return h&&h.horizontalPos()||"from-left"};this.horizontalRel=function(){return h&&h.horizontalRel()||"page"}};odf.PageLayoutProperties=function(h,k,c){var b=this,g=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;h&&(b=h.getAttributeNS(g,"page-height"),b=k.parseLength(b));return b},pageWidth:function(){var b;h&&(b=h.getAttributeNS(g,"page-width"),b=k.parseLength(b));return b}})};
odf.PageLayout=function(h,k,c){var b=null;h&&(b=k.getPropertiesElement("page-layout-properties",h));this.pageLayout=new odf.PageLayoutProperties(b,k,c&&c.pageLayout)};odf.PageLayoutCache=function(){};odf.PageLayoutCache.prototype.getPageLayout=function(h){};odf.PageLayoutCache.prototype.getDefaultPageLayout=function(){};odf.ParagraphProperties=function(h,k,c){var b=this,g=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=h.getAttributeNS(g,"margin-top");return k.parsePositiveLengthOrPercent(b,"marginTop",c&&c.data)}})};
odf.ComputedParagraphProperties=function(){var h={},k=[];this.setStyleChain=function(c){k=c;h={}};this.marginTop=function(){var c,b;if(h.hasOwnProperty("marginTop"))c=h.marginTop;else{for(b=0;void 0===c&&b<k.length;b+=1)c=k[b].marginTop();h.marginTop=c}return c||0}};odf.TextProperties=function(h,k,c){var b=this,g=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=h.getAttributeNS(g,"font-size");return k.parsePositiveLengthOrPercent(b,"fontSize",c&&c.data)}})};
odf.ComputedTextProperties=function(){var h={},k=[];this.setStyleChain=function(c){k=c;h={}};this.fontSize=function(){var c,b;if(h.hasOwnProperty("fontSize"))c=h.fontSize;else{for(b=0;void 0===c&&b<k.length;b+=1)c=k[b].fontSize();h.fontSize=c}return c||12}};odf.MasterPage=function(h,k){var c;h?(c=h.getAttributeNS(odf.Namespaces.stylens,"page-layout-name"),this.pageLayout=k.getPageLayout(c)):this.pageLayout=k.getDefaultPageLayout()};odf.MasterPageCache=function(){};odf.MasterPageCache.prototype.getMasterPage=function(h){};
odf.StylePileEntry=function(h,k,c,b){this.masterPage=function(){var b=h.getAttributeNS(odf.Namespaces.stylens,"master-page-name"),k=null;b&&(k=c.getMasterPage(b));return k};(function(c){var n=h.getAttributeNS(odf.Namespaces.stylens,"family"),p=null;if("graphic"===n||"chart"===n)c.graphic=void 0===b?void 0:b.graphic,p=k.getPropertiesElement("graphic-properties",h,p),null!==p&&(c.graphic=new odf.GraphicProperties(p,k,c.graphic));if("paragraph"===n||"table-cell"===n||"graphic"===n||"presentation"===
n||"chart"===n)c.paragraph=void 0===b?void 0:b.paragraph,p=k.getPropertiesElement("paragraph-properties",h,p),null!==p&&(c.paragraph=new odf.ParagraphProperties(p,k,c.paragraph));if("text"===n||"paragraph"===n||"table-cell"===n||"graphic"===n||"presentation"===n||"chart"===n)c.text=void 0===b?void 0:b.text,p=k.getPropertiesElement("text-properties",h,p),null!==p&&(c.text=new odf.TextProperties(p,k,c.text))})(this)};
odf.StylePile=function(h,k){function c(c,a){var d,g;c.hasAttributeNS(b,"parent-style-name")&&(g=c.getAttributeNS(b,"parent-style-name"),-1===a.indexOf(g)&&(d=f(g,a)));return new odf.StylePileEntry(c,h,k,d)}var b=odf.Namespaces.stylens,g={},n={},p,m={},q={},f;f=function(b,a){var d=m[b],f;!d&&(f=g[b])&&(a.push(b),d=c(f,a),m[b]=d);return d};this.getStyle=function(b){var a=q[b]||m[b],d,f=[];a||(d=n[b],d||(d=g[b])&&f.push(b),d&&(a=c(d,f)));return a};this.addCommonStyle=function(c){var a;c.hasAttributeNS(b,
"name")&&(a=c.getAttributeNS(b,"name"),g.hasOwnProperty(a)||(g[a]=c))};this.addAutomaticStyle=function(c){var a;c.hasAttributeNS(b,"name")&&(a=c.getAttributeNS(b,"name"),n.hasOwnProperty(a)||(n[a]=c))};this.setDefaultStyle=function(b){void 0===p&&(p=c(b,[]))};this.getDefaultStyle=function(){return p}};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(h){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=y.getStyleName("paragraph",a);void 0!==d&&(b.push("paragraph"),b.push(d));a.namespaceURI!==l||"h"!==a.localName&&"p"!==a.localName||k("paragraph",l,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=m[g],h=g.getStyle(h),void 0!==h&&(h=h[b],void 0!==h&&h!==f&&(c.push(h),f=h));
g=m[d];if(h=g.getDefaultStyle())h=h[b],void 0!==h&&h!==f&&c.push(h);return c}function g(a,b){var d=y.getStyleName("text",a),e=a.parentNode;void 0!==d&&(b.push("text"),b.push(d));"span"===a.localName&&a.namespaceURI===l&&k("text",l,a,b);if(!e||e===h)return b;e.namespaceURI!==l||"p"!==e.localName&&"h"!==e.localName?g(e,b):c(e,b);return b}function n(a){a=a.getAttributeNS(B,"family");return m[a]}var p=this,m,q,f,e,a,d,r,l=odf.Namespaces.textns,B=odf.Namespaces.stylens,y=new odf.StyleInfo,D=new odf.StyleParseUtils,
z,t,x,w,F,L;this.getComputedGraphicStyle=function(a){var d=[];a=y.getStyleName("graphic",a);void 0!==a&&(d.push("graphic"),d.push(a));a=d.join("/");var c=e[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")),e[a]=c);return c};this.getComputedParagraphStyle=function(a){a=c(a,[]);var d=a.join("/"),
e=f[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")),f[d]=e);return e};this.getComputedTextStyle=function(a){a=g(a,[]);var d=a.join("/"),c=q[d];runtime.assert(0===a.length%2,"Invalid style chain.");void 0===c&&(c=new odf.ComputedTextStyle,c.text.setStyleChain(b(a,"text","text")),q[d]=c);return c};this.getPageLayout=function(a){var b=L[a];b||((b=
F[a])?(b=new odf.PageLayout(b,D,w),L[a]=b):b=w);return b};this.getDefaultPageLayout=function(){return w};this.getMasterPage=function(a){var b=t[a];void 0===b&&((b=z[a])?(b=new odf.MasterPage(b,p),t[a]=b):b=null);return b};this.getDefaultMasterPage=function(){return x};this.update=function(){var b,c,g=null,l=null;q={};f={};e={};z={};t={};L={};F={};a=new odf.StylePile(D,p);d=new odf.StylePile(D,p);r=new odf.StylePile(D,p);m={text:a,paragraph:d,graphic:r};for(b=h.styles.firstElementChild;b;)b.namespaceURI===
B&&((c=n(b))?"style"===b.localName?c.addCommonStyle(b):"default-style"===b.localName&&c.setDefaultStyle(b):"default-page-layout"===b.localName&&(g=b)),b=b.nextElementSibling;w=new odf.PageLayout(g,D);for(b=h.automaticStyles.firstElementChild;b;)b.namespaceURI===B&&((c=n(b))&&"style"===b.localName?c.addAutomaticStyle(b):"page-layout"===b.localName&&(F[b.getAttributeNS(B,"name")]=b)),b=b.nextElementSibling;for(b=h.masterStyles.firstElementChild;b;)b.namespaceURI===B&&"master-page"===b.localName&&(l=
l||b,c=b,g=c.getAttributeNS(B,"name"),0<g.length&&!z.hasOwnProperty(g)&&(z[g]=c)),b=b.nextElementSibling;x=new odf.MasterPage(l,p)}};ops.OperationTransformMatrix=function(){function h(a){a.position+=a.length;a.length*=-1}function k(a){var b=0>a.length;b&&h(a);return b}function c(a,b){function c(f){a[f]===b&&e.push(f)}var e=[];a&&["style:parent-style-name","style:next-style-name"].forEach(c);return e}function b(a,b){function c(e){a[e]===b&&delete a[e]}a&&["style:parent-style-name","style:next-style-name"].forEach(c)}function g(a){var b={};Object.keys(a).forEach(function(c){b[c]="object"===typeof a[c]?g(a[c]):a[c]});return b}function n(a,
b,c,e){var f,g=!1,h=!1,k,m=[];e&&e.attributes&&(m=e.attributes.split(","));a&&(c||0<m.length)&&Object.keys(a).forEach(function(b){var d=a[b],e;"object"!==typeof d&&(c&&(e=c[b]),void 0!==e?(delete a[b],h=!0,e===d&&(delete c[b],g=!0)):-1!==m.indexOf(b)&&(delete a[b],h=!0))});if(b&&b.attributes&&(c||0<m.length)){k=b.attributes.split(",");for(e=0;e<k.length;e+=1)if(f=k[e],c&&void 0!==c[f]||m&&-1!==m.indexOf(f))k.splice(e,1),--e,h=!0;0<k.length?b.attributes=k.join(","):delete b.attributes}return{majorChanged:g,
minorChanged:h}}function p(a){for(var b in a)if(a.hasOwnProperty(b))return!0;return!1}function m(a){for(var b in a)if(a.hasOwnProperty(b)&&("attributes"!==b||0<a.attributes.length))return!0;return!1}function q(a,b,c,e,f){var g=a?a[f]:null,h=b?b[f]:null,k=c?c[f]:null,q=e?e[f]:null,x;x=n(g,h,k,q);g&&!p(g)&&delete a[f];h&&!m(h)&&delete b[f];k&&!p(k)&&delete c[f];q&&!m(q)&&delete e[f];return x}function f(a,b){return{opSpecsA:[a],opSpecsB:[b]}}var e;e={AddAnnotation:{AddAnnotation:function(a,b,c){var e;
a.position<b.position?(e=a,c=b):b.position<a.position?(e=b,c=a):(e=c?a:b,c=c?b:a);c.position<e.position+e.length&&(e.length+=2);c.position+=2;return{opSpecsA:[a],opSpecsB:[b]}},AddCursor:f,AddMember:f,AddStyle:f,ApplyDirectStyling:function(a,b){a.position<=b.position?b.position+=2:a.position<=b.position+b.length&&(b.length+=2);return{opSpecsA:[a],opSpecsB:[b]}},InsertText:function(a,b){b.position<=a.position?a.position+=b.text.length:(void 0!==a.length&&b.position<=a.position+a.length&&(a.length+=
b.text.length),b.position+=2);return{opSpecsA:[a],opSpecsB:[b]}},MergeParagraph:function(a,b){b.sourceStartPosition<=a.position?--a.position:(void 0!==a.length&&b.sourceStartPosition<=a.position+a.length&&--a.length,b.sourceStartPosition+=2,a.position<b.destinationStartPosition&&(b.destinationStartPosition+=2));return{opSpecsA:[a],opSpecsB:[b]}},MoveCursor:function(a,b){var c=k(b);a.position<b.position?b.position+=2:a.position<b.position+b.length&&(b.length+=2);c&&h(b);return{opSpecsA:[a],opSpecsB:[b]}},
RemoveAnnotation:function(a,b){a.position<b.position?(b.position<a.position+a.length&&(a.length-=b.length+2),b.position+=2):a.position-=b.length+2;return{opSpecsA:[a],opSpecsB:[b]}},RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){var c=b.position,e=b.position+b.length,f,g=[a],h=[b];a.position<=b.position?b.position+=2:a.position<e&&(b.length=a.position-b.position,f={optype:"RemoveText",memberid:b.memberid,timestamp:b.timestamp,position:a.position+2,length:e-a.position},h.unshift(f));
b.position+b.length<=a.position?(a.position-=b.length,void 0!==a.length&&f&&(a.length=f.length>=a.length?0:a.length-f.length)):void 0!==a.length&&(f=a.position+a.length,e<=f?a.length-=b.length:c<f&&(a.length=c-a.position));return{opSpecsA:g,opSpecsB:h}},SetParagraphStyle:function(a,b){a.position<b.position&&(b.position+=2);return{opSpecsA:[a],opSpecsB:[b]}},SplitParagraph:function(a,b){a.position<b.sourceParagraphPosition&&(b.sourceParagraphPosition+=2);b.position<=a.position?a.position+=1:(void 0!==
a.length&&b.position<=a.position+a.length&&(a.length+=1),b.position+=2);return{opSpecsA:[a],opSpecsB:[b]}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},AddCursor:{AddCursor:f,AddMember:f,AddStyle:f,ApplyDirectStyling:f,InsertText:f,MergeParagraph:f,MoveCursor:f,RemoveAnnotation:f,RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:f,SetParagraphStyle:f,SplitParagraph:f,UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},AddMember:{AddStyle:f,ApplyDirectStyling:f,InsertText:f,MergeParagraph:f,
MoveCursor:f,RemoveAnnotation:f,RemoveCursor:f,RemoveStyle:f,RemoveText:f,SetParagraphStyle:f,SplitParagraph:f,UpdateMetadata:f,UpdateParagraphStyle:f},AddStyle:{AddStyle:f,ApplyDirectStyling:f,InsertText:f,MergeParagraph:f,MoveCursor:f,RemoveAnnotation:f,RemoveCursor:f,RemoveMember:f,RemoveStyle:function(a,d){var e,f=[a],g=[d];a.styleFamily===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(",")}},g.unshift(e)),b(a.setProperties,d.styleName));return{opSpecsA:f,opSpecsB:g}},RemoveText:f,SetParagraphStyle:f,SplitParagraph:f,UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},ApplyDirectStyling:{ApplyDirectStyling:function(a,b,c){var e,f,h,k,m,n,x,w;k=[a];h=[b];if(!(a.position+a.length<=b.position||a.position>=b.position+b.length)){e=c?a:b;f=c?b:a;if(a.position!==b.position||a.length!==b.length)n=g(e),x=g(f);b=q(f.setProperties,null,e.setProperties,
null,"style:text-properties");if(b.majorChanged||b.minorChanged)h=[],a=[],k=e.position+e.length,m=f.position+f.length,f.position<e.position?b.minorChanged&&(w=g(x),w.length=e.position-f.position,a.push(w),f.position=e.position,f.length=m-f.position):e.position<f.position&&b.majorChanged&&(w=g(n),w.length=f.position-e.position,h.push(w),e.position=f.position,e.length=k-e.position),m>k?b.minorChanged&&(n=x,n.position=k,n.length=m-k,a.push(n),f.length=k-f.position):k>m&&b.majorChanged&&(n.position=m,
n.length=k-m,h.push(n),e.length=m-e.position),e.setProperties&&p(e.setProperties)&&h.push(e),f.setProperties&&p(f.setProperties)&&a.push(f),c?(k=h,h=a):k=a}return{opSpecsA:k,opSpecsB:h}},InsertText:function(a,b){b.position<=a.position?a.position+=b.text.length:b.position<=a.position+a.length&&(a.length+=b.text.length);return{opSpecsA:[a],opSpecsB:[b]}},MergeParagraph:function(a,b){var c=a.position,e=a.position+a.length;c>=b.sourceStartPosition&&--c;e>=b.sourceStartPosition&&--e;a.position=c;a.length=
e-c;return{opSpecsA:[a],opSpecsB:[b]}},MoveCursor:f,RemoveAnnotation:function(a,b){var c=a.position,e=a.position+a.length,f=b.position+b.length,g=[a],h=[b];b.position<=c&&e<=f?g=[]:(f<c&&(c-=b.length+2),f<e&&(e-=b.length+2),a.position=c,a.length=e-c);return{opSpecsA:g,opSpecsB:h}},RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){var c=a.position+a.length,e=b.position+b.length,f=[a],g=[b];e<=a.position?a.position-=b.length:b.position<c&&(a.position<b.position?a.length=e<c?a.length-
b.length:b.position-a.position:(a.position=b.position,e<c?a.length=c-e:f=[]));return{opSpecsA:f,opSpecsB:g}},SetParagraphStyle:f,SplitParagraph:function(a,b){b.position<a.position?a.position+=1:b.position<a.position+a.length&&(a.length+=1);return{opSpecsA:[a],opSpecsB:[b]}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},InsertText:{InsertText:function(a,b,c){a.position<b.position?b.position+=a.text.length:a.position>b.position?a.position+=b.text.length:c?b.position+=a.text.length:a.position+=
b.text.length;return{opSpecsA:[a],opSpecsB:[b]}},MergeParagraph:function(a,b){a.position>=b.sourceStartPosition?--a.position:(a.position<b.sourceStartPosition&&(b.sourceStartPosition+=a.text.length),a.position<b.destinationStartPosition&&(b.destinationStartPosition+=a.text.length));return{opSpecsA:[a],opSpecsB:[b]}},MoveCursor:function(a,b){var c=k(b);a.position<b.position?b.position+=a.text.length:a.position<b.position+b.length&&(b.length+=a.text.length);c&&h(b);return{opSpecsA:[a],opSpecsB:[b]}},
RemoveAnnotation:function(a,b){var c=a.position,e=b.position+b.length,f=[a],g=[b];b.position<=c&&c<=e?(f=[],b.length+=a.text.length):e<a.position?a.position-=b.length+2:b.position+=a.text.length;return{opSpecsA:f,opSpecsB:g}},RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){var c;c=b.position+b.length;var e=[a],f=[b];c<=a.position?a.position-=b.length:a.position<=b.position?b.position+=a.text.length:(b.length=a.position-b.position,c={optype:"RemoveText",memberid:b.memberid,timestamp:b.timestamp,
position:a.position+a.text.length,length:c-a.position},f.unshift(c),a.position=b.position);return{opSpecsA:e,opSpecsB:f}},SetParagraphStyle:function(a,b){b.position>a.position&&(b.position+=a.text.length);return{opSpecsA:[a],opSpecsB:[b]}},SplitParagraph:function(a,b){a.position<b.sourceParagraphPosition&&(b.sourceParagraphPosition+=a.text.length);a.position<=b.position?b.position+=a.text.length:a.position+=1;return{opSpecsA:[a],opSpecsB:[b]}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},
MergeParagraph:{MergeParagraph:function(a,b,c){var e=[a],f=[b],g;a.destinationStartPosition===b.destinationStartPosition?(e=[],f=[],a.moveCursor&&(g={optype:"MoveCursor",memberid:a.memberid,timestamp:a.timestamp,position:a.sourceStartPosition-1},e.push(g)),b.moveCursor&&(g={optype:"MoveCursor",memberid:b.memberid,timestamp:b.timestamp,position:b.sourceStartPosition-1},f.push(g)),a=c?a:b,a={optype:"SetParagraphStyle",memberid:a.memberid,timestamp:a.timestamp,position:a.destinationStartPosition,styleName:a.paragraphStyleName},
c?e.push(a):f.push(a)):b.sourceStartPosition===a.destinationStartPosition?(a.destinationStartPosition=b.destinationStartPosition,--a.sourceStartPosition,a.paragraphStyleName=b.paragraphStyleName):a.sourceStartPosition===b.destinationStartPosition?(b.destinationStartPosition=a.destinationStartPosition,--b.sourceStartPosition,b.paragraphStyleName=a.paragraphStyleName):a.destinationStartPosition<b.destinationStartPosition?(--b.destinationStartPosition,--b.sourceStartPosition):(--a.destinationStartPosition,
--a.sourceStartPosition);return{opSpecsA:e,opSpecsB:f}},MoveCursor:function(a,b){var c=b.position,e=b.position+b.length,f=Math.min(c,e),c=Math.max(c,e);f>=a.sourceStartPosition&&--f;c>=a.sourceStartPosition&&--c;0<=b.length?(b.position=f,b.length=c-f):(b.position=c,b.length=f-c);return{opSpecsA:[a],opSpecsB:[b]}},RemoveAnnotation:function(a,b){var c=b.position+b.length,e=[a],f=[b];b.position<=a.destinationStartPosition&&a.sourceStartPosition<=c?(e=[],--b.length):a.sourceStartPosition<b.position?--b.position:
(c<a.destinationStartPosition&&(a.destinationStartPosition-=b.length+2),c<a.sourceStartPosition&&(a.sourceStartPosition-=b.length+2));return{opSpecsA:e,opSpecsB:f}},RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){b.position>=a.sourceStartPosition?--b.position:(b.position<a.destinationStartPosition&&(a.destinationStartPosition-=b.length),b.position<a.sourceStartPosition&&(a.sourceStartPosition-=b.length));return{opSpecsA:[a],opSpecsB:[b]}},SetParagraphStyle:function(a,b){var c=
[a],e=[b];if(b.position>a.sourceStartPosition)--b.position;else if(b.position===a.destinationStartPosition||b.position===a.sourceStartPosition)b.position=a.destinationStartPosition,a.paragraphStyleName=b.styleName;return{opSpecsA:c,opSpecsB:e}},SplitParagraph:function(a,b){var c,e=[a],f=[b];b.position<a.destinationStartPosition?(a.destinationStartPosition+=1,a.sourceStartPosition+=1):b.position>=a.destinationStartPosition&&b.position<a.sourceStartPosition?(b.paragraphStyleName=a.paragraphStyleName,
c={optype:"SetParagraphStyle",memberid:a.memberid,timestamp:a.timestamp,position:a.destinationStartPosition,styleName:a.paragraphStyleName},e.push(c),b.position===a.sourceStartPosition-1&&a.moveCursor&&(c={optype:"MoveCursor",memberid:a.memberid,timestamp:a.timestamp,position:b.position,length:0},e.push(c)),a.destinationStartPosition=b.position+1,a.sourceStartPosition+=1):b.position>=a.sourceStartPosition&&(--b.position,--b.sourceParagraphPosition);return{opSpecsA:e,opSpecsB:f}},UpdateMember:f,UpdateMetadata:f,
UpdateParagraphStyle:f},MoveCursor:{MoveCursor:f,RemoveAnnotation:function(a,b){var c=k(a),e=a.position+a.length,f=b.position+b.length;b.position<=a.position&&e<=f?(a.position=b.position-1,a.length=0):(f<a.position?a.position-=b.length+2:f<e&&(a.length-=b.length+2),c&&h(a));return{opSpecsA:[a],opSpecsB:[b]}},RemoveCursor:function(a,b){return{opSpecsA:a.memberid===b.memberid?[]:[a],opSpecsB:[b]}},RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){var c=k(a),e=a.position+a.length,f=b.position+b.length;
f<=a.position?a.position-=b.length:b.position<e&&(a.position<b.position?a.length=f<e?a.length-b.length:b.position-a.position:(a.position=b.position,a.length=f<e?e-f:0));c&&h(a);return{opSpecsA:[a],opSpecsB:[b]}},SetParagraphStyle:f,SplitParagraph:function(a,b){var c=k(a);b.position<a.position?a.position+=1:b.position<a.position+a.length&&(a.length+=1);c&&h(a);return{opSpecsA:[a],opSpecsB:[b]}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},RemoveAnnotation:{RemoveAnnotation:function(a,b){var c=
[a],e=[b];a.position===b.position&&a.length===b.length?(c=[],e=[]):a.position<b.position?b.position-=a.length+2:a.position-=b.length+2;return{opSpecsA:c,opSpecsB:e}},RemoveCursor:f,RemoveMember:f,RemoveStyle:f,RemoveText:function(a,b){var c=a.position+a.length,e=b.position+b.length,f=[a],g=[b];a.position<=b.position&&e<=c?(g=[],a.length-=b.length):e<a.position?a.position-=b.length:b.position<a.position?(a.position=b.position+1,b.length-=a.length+2):b.position-=a.length+2;return{opSpecsA:f,opSpecsB:g}},
SetParagraphStyle:function(a,b){var c=b.position,e=a.position+a.length,f=[a],g=[b];a.position<=c&&c<=e?g=[]:e<c&&(b.position-=a.length+2);return{opSpecsA:f,opSpecsB:g}},SplitParagraph:function(a,b){var c=b.position,e=a.position+a.length,f=[a],g=[b];a.position<=c&&c<=e?(g=[],a.length+=1):(e<b.sourceParagraphPosition&&(b.sourceParagraphPosition-=a.length+2),e<c?b.position-=a.length+2:a.position+=1);return{opSpecsA:f,opSpecsB:g}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},RemoveCursor:{RemoveCursor:function(a,
b){var c=a.memberid===b.memberid;return{opSpecsA:c?[]:[a],opSpecsB:c?[]:[b]}},RemoveMember:f,RemoveStyle:f,RemoveText:f,SetParagraphStyle:f,SplitParagraph:f,UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},RemoveMember:{RemoveStyle:f,RemoveText:f,SetParagraphStyle:f,SplitParagraph:f,UpdateMetadata:f,UpdateParagraphStyle:f},RemoveStyle:{RemoveStyle:function(a,b){var c=a.styleName===b.styleName&&a.styleFamily===b.styleFamily;return{opSpecsA:c?[]:[a],opSpecsB:c?[]:[b]}},RemoveText:f,SetParagraphStyle:function(a,
b){var c,e=[a],f=[b];"paragraph"===a.styleFamily&&a.styleName===b.styleName&&(c={optype:"SetParagraphStyle",memberid:a.memberid,timestamp:a.timestamp,position:b.position,styleName:""},e.unshift(c),b.styleName="");return{opSpecsA:e,opSpecsB:f}},SplitParagraph:f,UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:function(a,d){var e,f=[a],g=[d];"paragraph"===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(",")}},f.unshift(e)),a.styleName===d.styleName?g=[]:b(d.setProperties,a.styleName));return{opSpecsA:f,opSpecsB:g}}},RemoveText:{RemoveText:function(a,b){var c=a.position+a.length,e=b.position+b.length,f=[a],g=[b];e<=a.position?a.position-=b.length:c<=b.position?b.position-=a.length:b.position<c&&(a.position<b.position?(a.length=e<c?a.length-b.length:b.position-a.position,c<e?(b.position=a.position,b.length=e-c):g=[]):(c<e?b.length-=a.length:b.position<a.position?
b.length=a.position-b.position:g=[],e<c?(a.position=b.position,a.length=c-e):f=[]));return{opSpecsA:f,opSpecsB:g}},SetParagraphStyle:function(a,b){a.position<b.position&&(b.position-=a.length);return{opSpecsA:[a],opSpecsB:[b]}},SplitParagraph:function(a,b){var c=a.position+a.length,e=[a],f=[b];b.position<=a.position?a.position+=1:b.position<c&&(a.length=b.position-a.position,c={optype:"RemoveText",memberid:a.memberid,timestamp:a.timestamp,position:b.position+1,length:c-b.position},e.unshift(c));a.position+
a.length<=b.position?b.position-=a.length:a.position<b.position&&(b.position=a.position);a.position+a.length<b.sourceParagraphPosition&&(b.sourceParagraphPosition-=a.length);return{opSpecsA:e,opSpecsB:f}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},SetParagraphStyle:{SetParagraphStyle:function(a,b,c){a.position===b.position&&(c?b.styleName=a.styleName:a.styleName=b.styleName);return{opSpecsA:[a],opSpecsB:[b]}},SplitParagraph:function(a,b){var c=[a],e=[b],f;a.position>b.position?a.position+=
1:a.position===b.sourceParagraphPosition&&(b.paragraphStyleName=a.styleName,f=g(a),f.position=b.position+1,c.push(f));return{opSpecsA:c,opSpecsB:e}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},SplitParagraph:{SplitParagraph:function(a,b,c){var e,f;a.position<b.position?e=!0:b.position<a.position?f=!0:a.position===b.position&&(c?e=!0:f=!0);e?(b.position+=1,b.sourceParagraphPosition=a.position<b.sourceParagraphPosition?b.sourceParagraphPosition+1:a.position+1):f&&(a.position+=1,a.sourceParagraphPosition=
b.position<b.sourceParagraphPosition?a.sourceParagraphPosition+1:b.position+1);return{opSpecsA:[a],opSpecsB:[b]}},UpdateMember:f,UpdateMetadata:f,UpdateParagraphStyle:f},UpdateMember:{UpdateMetadata:f,UpdateParagraphStyle:f},UpdateMetadata:{UpdateMetadata:function(a,b,c){var e,f=[a],g=[b];e=c?a:b;a=c?b:a;n(a.setProperties||null,a.removedProperties||null,e.setProperties||null,e.removedProperties||null);e.setProperties&&p(e.setProperties)||e.removedProperties&&m(e.removedProperties)||(c?f=[]:g=[]);
a.setProperties&&p(a.setProperties)||a.removedProperties&&m(a.removedProperties)||(c?g=[]:f=[]);return{opSpecsA:f,opSpecsB:g}},UpdateParagraphStyle:f},UpdateParagraphStyle:{UpdateParagraphStyle:function(a,b,c){var e,f=[a],g=[b];a.styleName===b.styleName&&(e=c?a:b,a=c?b:a,q(a.setProperties,a.removedProperties,e.setProperties,e.removedProperties,"style:paragraph-properties"),q(a.setProperties,a.removedProperties,e.setProperties,e.removedProperties,"style:text-properties"),n(a.setProperties||null,a.removedProperties||
null,e.setProperties||null,e.removedProperties||null),e.setProperties&&p(e.setProperties)||e.removedProperties&&m(e.removedProperties)||(c?f=[]:g=[]),a.setProperties&&p(a.setProperties)||a.removedProperties&&m(a.removedProperties)||(c?g=[]:f=[]));return{opSpecsA:f,opSpecsB:g}}}};this.passUnchanged=f;this.extendTransformations=function(a){Object.keys(a).forEach(function(b){var c=a[b],f,g=e.hasOwnProperty(b);runtime.log((g?"Extending":"Adding")+" map for optypeA: "+b);g||(e[b]={});f=e[b];Object.keys(c).forEach(function(a){var e=
f.hasOwnProperty(a);runtime.assert(b<=a,"Wrong order:"+b+", "+a);runtime.log(" "+(e?"Overwriting":"Adding")+" entry for optypeB: "+a);f[a]=c[a]})})};this.transformOpspecVsOpspec=function(a,b){var c=a.optype<=b.optype,f;runtime.log("Crosstransforming:");runtime.log(runtime.toJson(a));runtime.log(runtime.toJson(b));c||(f=a,a=b,b=f);(f=(f=e[a.optype])&&f[b.optype])?(f=f(a,b,!c),c||null===f||(f={opSpecsA:f.opSpecsB,opSpecsB:f.opSpecsA})):f=null;runtime.log("result:");f?(runtime.log(runtime.toJson(f.opSpecsA)),
runtime.log(runtime.toJson(f.opSpecsB))):runtime.log("null");return f}};ops.OperationTransformer=function(){function h(c,b){for(var g,n,p=[],m=[];0<c.length&&b;){g=c.shift();g=k.transformOpspecVsOpspec(g,b);if(!g)return null;p=p.concat(g.opSpecsA);if(0===g.opSpecsB.length){p=p.concat(c);b=null;break}for(;1<g.opSpecsB.length;){n=h(c,g.opSpecsB.shift());if(!n)return null;m=m.concat(n.opSpecsB);c=n.opSpecsA}b=g.opSpecsB.pop()}b&&m.push(b);return{opSpecsA:p,opSpecsB:m}}var k=new ops.OperationTransformMatrix;this.getOperationTransformMatrix=function(){return k};this.transform=
function(c,b){for(var g,k=[];0<b.length;){g=h(c,b.shift());if(!g)return null;c=g.opSpecsA;k=k.concat(g.opSpecsB)}return{opSpecsA:c,opSpecsB:k}}};var webodf_css='@namespace draw url(urn:oasis:names:tc:opendocument:xmlns:drawing:1.0);@namespace fo url(urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0);@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);@namespace presentation url(urn:oasis:names:tc:opendocument:xmlns:presentation:1.0);@namespace style url(urn:oasis:names:tc:opendocument:xmlns:style:1.0);@namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0);@namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0);@namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0);@namespace webodfhelper url(urn:webodf:names:helper);@namespace cursor url(urn:webodf:names:cursor);@namespace editinfo url(urn:webodf:names:editinfo);@namespace annotation url(urn:webodf:names:annotation);@namespace dc url(http://purl.org/dc/elements/1.1/);@namespace svgns url(http://www.w3.org/2000/svg);office|document > *, office|document-content > * {display: none;}office|body, office|document {display: inline-block;position: relative;}text|p, text|h {display: block;padding: 0;margin: 0;line-height: normal;position: relative;}text|p::after, text|h::after {content: "\\200B";white-space: pre;}*[webodfhelper|containsparagraphanchor] {position: relative;}text|s {white-space: pre;}text|tab {display: inline;white-space: pre;}text|tracked-changes {display: none;}office|binary-data {display: none;}office|text {display: block;text-align: left;overflow: visible;word-wrap: break-word;}office|text::selection {background: transparent;}.webodf-virtualSelections *::selection {background: transparent;}.webodf-virtualSelections *::-moz-selection {background: transparent;}office|text * draw|text-box {display: block;border: 1px solid #d3d3d3;}office|text draw|frame {z-index: 1;}office|spreadsheet {display: block;border-collapse: collapse;empty-cells: show;font-family: sans-serif;font-size: 10pt;text-align: left;page-break-inside: avoid;overflow: hidden;}office|presentation {display: inline-block;text-align: left;}#shadowContent {display: inline-block;text-align: left;}draw|page {display: block;position: relative;overflow: hidden;}presentation|notes, presentation|footer-decl, presentation|date-time-decl {display: none;}@media print {draw|page {border: 1pt solid black;page-break-inside: avoid;}presentation|notes {}}office|spreadsheet text|p {border: 0px;padding: 1px;margin: 0px;}office|spreadsheet table|table {margin: 3px;}office|spreadsheet table|table:after {}office|spreadsheet table|table-row {counter-increment: row;}office|spreadsheet table|table-row:before {width: 3em;background: #cccccc;border: 1px solid black;text-align: center;content: counter(row);display: table-cell;}office|spreadsheet table|table-cell {border: 1px solid #cccccc;}table|table {display: table;}draw|frame table|table {width: 100%;height: 100%;background: white;}table|table-header-rows {display: table-header-group;}table|table-row {display: table-row;}table|table-column {display: table-column;}table|table-cell {width: 0.889in;display: table-cell;word-break: break-all;}draw|frame {display: block;}draw|image {display: block;width: 100%;height: 100%;top: 0px;left: 0px;background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%;}draw|frame > draw|image:nth-of-type(n+2) {display: none;}text|list:before {display: none;content:"";}text|list {display: block;}text|list-item {display: block;}text|number {display:none;}text|a {color: blue;text-decoration: underline;cursor: pointer;}.webodf-inactiveLinks text|a {cursor: text;}text|note-citation {vertical-align: super;font-size: smaller;}text|note-body {display: none;}text|note:hover text|note-citation {background: #dddddd;}text|note:hover text|note-body {display: block;left:1em;max-width: 80%;position: absolute;background: #ffffaa;}text|bibliography-source {display: none;}svg|title, svg|desc {display: none;}video {width: 100%;height: 100%}cursor|anchor {display: none;}cursor|cursor {display: none;}.webodf-caretOverlay {position: absolute;top: 5%;height: 1em;z-index: 10;padding-left: 1px;pointer-events: none;}.webodf-caretOverlay .caret {position: absolute;border-left: 2px solid black;top: 0;bottom: 0;right: 0;}.webodf-caretOverlay .handle {position: absolute;margin-top: 5px;padding-top: 3px;margin-left: auto;margin-right: auto;width: 64px;height: 68px;border-radius: 5px;opacity: 0.3;text-align: center;background-color: black;box-shadow: 0px 0px 5px rgb(90, 90, 90);border: 1px solid black;top: -85px;right: -32px;}.webodf-caretOverlay .handle > img {box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;background-color: rgb(200, 200, 200);border-radius: 5px;border: 2px solid;height: 60px;width: 60px;display: block;margin: auto;}.webodf-caretOverlay .handle.active {opacity: 0.8;}.webodf-caretOverlay .handle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 43%;}.webodf-caretSizer {display: inline-block;width: 0;visibility: hidden;}#eventTrap {display: block;position: absolute;bottom: 0;left: 0;outline: none;opacity: 0;color: rgba(255, 255, 255, 0);pointer-events: none;white-space: pre;overflow: hidden;}cursor|cursor > #composer {text-decoration: underline;}cursor|cursor[cursor|caret-sizer-active="true"],cursor|cursor[cursor|composing="true"] {display: inline;}editinfo|editinfo {display: inline-block;}.editInfoMarker {position: absolute;width: 10px;height: 100%;left: -20px;opacity: 0.8;top: 0;border-radius: 5px;background-color: transparent;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);}.editInfoMarker:hover {box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);}.editInfoHandle {position: absolute;background-color: black;padding: 5px;border-radius: 5px;opacity: 0.8;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);bottom: 100%;margin-bottom: 10px;z-index: 3;left: -25px;}.editInfoHandle:after {content: " ";position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: black transparent transparent transparent;top: 100%;left: 5px;}.editInfo {font-family: sans-serif;font-weight: normal;font-style: normal;text-decoration: none;color: white;width: 100%;height: 12pt;}.editInfoColor {float: left;width: 10pt;height: 10pt;border: 1px solid white;}.editInfoAuthor {float: left;margin-left: 5pt;font-size: 10pt;text-align: left;height: 12pt;line-height: 12pt;}.editInfoTime {float: right;margin-left: 30pt;font-size: 8pt;font-style: italic;color: yellow;height: 12pt;line-height: 12pt;}.annotationWrapper {display: inline;position: relative;}.annotationRemoveButton:before {content: "\u00d7";color: white;padding: 5px;line-height: 1em;}.annotationRemoveButton {width: 20px;height: 20px;border-radius: 10px;background-color: black;box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);position: absolute;top: -10px;left: -10px;z-index: 3;text-align: center;font-family: sans-serif;font-style: normal;font-weight: normal;text-decoration: none;font-size: 15px;}.annotationRemoveButton:hover {cursor: pointer;box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);}.annotationNote {width: 4cm;position: absolute;display: inline;z-index: 10;top: 0;}.annotationNote > office|annotation {display: block;text-align: left;}.annotationConnector {position: absolute;display: inline;top: 0;z-index: 2;border-top: 1px dashed brown;}.annotationConnector.angular {-moz-transform-origin: left top;-webkit-transform-origin: left top;-ms-transform-origin: left top;transform-origin: left top;}.annotationConnector.horizontal {left: 0;}.annotationConnector.horizontal:before {content: "";display: inline;position: absolute;width: 0px;height: 0px;border-style: solid;border-width: 8.7px 5px 0 5px;border-color: brown transparent transparent transparent;top: -1px;left: -5px;}office|annotation {width: 100%;height: 100%;display: none;background: rgb(198, 238, 184);background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);box-shadow: 0 3px 4px -3px #ccc;}office|annotation > dc|creator {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;color: white;background-color: brown;padding: 4px;}office|annotation > dc|date {display: block;font-size: 10pt;font-weight: normal;font-style: normal;font-family: sans-serif;border: 4px solid transparent;color: black;}office|annotation > text|list {display: block;padding: 5px;}office|annotation text|p {font-size: 10pt;color: black;font-weight: normal;font-style: normal;text-decoration: none;font-family: sans-serif;}#annotationsPane {background-color: #EAEAEA;width: 4cm;height: 100%;display: none;position: absolute;outline: 1px solid #ccc;}.webodf-annotationHighlight {background-color: yellow;position: relative;}.webodf-selectionOverlay {position: absolute;pointer-events: none;top: 0;left: 0;top: 0;left: 0;width: 100%;height: 100%;z-index: 15;}.webodf-selectionOverlay > polygon {fill-opacity: 0.3;stroke-opacity: 0.8;stroke-width: 1;fill-rule: evenodd;}.webodf-selectionOverlay > .webodf-draggable {fill-opacity: 0.8;stroke-opacity: 0;stroke-width: 8;pointer-events: all;display: none;-moz-transform-origin: center center;-webkit-transform-origin: center center;-ms-transform-origin: center center;transform-origin: center center;}#imageSelector {display: none;position: absolute;border-style: solid;border-color: black;}#imageSelector > div {width: 5px;height: 5px;display: block;position: absolute;border: 1px solid black;background-color: #ffffff;}#imageSelector > .topLeft {top: -4px;left: -4px;}#imageSelector > .topRight {top: -4px;right: -4px;}#imageSelector > .bottomRight {right: -4px;bottom: -4px;}#imageSelector > .bottomLeft {bottom: -4px;left: -4px;}#imageSelector > .topMiddle {top: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .rightMiddle {top: 50%;right: -4px;margin-top: -2.5px;}#imageSelector > .bottomMiddle {bottom: -4px;left: 50%;margin-left: -2.5px;}#imageSelector > .leftMiddle {top: 50%;left: -4px;margin-top: -2.5px;}div.webodf-customScrollbars::-webkit-scrollbar{width: 8px;height: 8px;background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-track{background-color: transparent;}div.webodf-customScrollbars::-webkit-scrollbar-thumb{background-color: #444;border-radius: 4px;}.webodf-hyperlinkTooltip {display: none;color: white;background-color: black;border-radius: 5px;box-shadow: 2px 2px 5px gray;padding: 3px;position: absolute;max-width: 210px;text-align: left;word-break: break-all;z-index: 16;}.webodf-hyperlinkTooltipText {display: block;font-weight: bold;}';