UNPKG

npm-viewerjs

Version:

Document viewer component for PDF and ODF documents. Done with just HTML5, CSS3, and JavaScript. Powered by pdf.js and WebODF.

148 lines (139 loc) 438 kB
/* This is a generated file. DO NOT EDIT. Copyright (C) 2010-2015 KO GmbH <copyright@kogmbh.com> @licstart The code in this file is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License (GNU AGPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The code in this file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with WebODF. If not, see <http://www.gnu.org/licenses/>. As additional permission under GNU AGPL version 3 section 7, you may distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU AGPL normally required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source. As a special exception to the AGPL, any HTML file which merely makes function calls to this code, and for that purpose includes it in unmodified form by reference or in-line shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and distribute such a system following the terms of the GNU AGPL for this code and the LGPL for the libraries. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. This license applies to this entire compilation. @licend @source: http://www.webodf.org/ @source: https://github.com/kogmbh/WebODF/ */ var webodf_version="0.5.8";function Runtime(){}Runtime.prototype.getVariable=function(g){};Runtime.prototype.toJson=function(g){};Runtime.prototype.fromJson=function(g){};Runtime.prototype.byteArrayFromString=function(g,k){};Runtime.prototype.byteArrayToString=function(g,k){};Runtime.prototype.read=function(g,k,c,b){};Runtime.prototype.readFile=function(g,k,c){};Runtime.prototype.readFileSync=function(g,k){};Runtime.prototype.loadXML=function(g,k){};Runtime.prototype.writeFile=function(g,k,c){}; Runtime.prototype.deleteFile=function(g,k){};Runtime.prototype.log=function(g,k){};Runtime.prototype.setTimeout=function(g,k){};Runtime.prototype.clearTimeout=function(g){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.currentDirectory=function(){};Runtime.prototype.setCurrentDirectory=function(g){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.parseXML=function(g){};Runtime.prototype.exit=function(g){}; Runtime.prototype.getWindow=function(){};Runtime.prototype.requestAnimationFrame=function(g){};Runtime.prototype.cancelAnimationFrame=function(g){};Runtime.prototype.assert=function(g,k){};var IS_COMPILED_CODE=!0; Runtime.byteArrayToString=function(g,k){function c(b){var c="",r,q=b.length;for(r=0;r<q;r+=1)c+=String.fromCharCode(b[r]&255);return c}function b(b){var c="",r,q=b.length,e=[],l,a,d,m;for(r=3<=q&&239===b[0]&&187===b[1]&&191===b[2]?3:0;r<q;r+=1)l=b[r],128>l?e.push(l):(r+=1,a=b[r],194<=l&&224>l?e.push((l&31)<<6|a&63):(r+=1,d=b[r],224<=l&&240>l?e.push((l&15)<<12|(a&63)<<6|d&63):(r+=1,m=b[r],240<=l&&245>l&&(l=(l&7)<<18|(a&63)<<12|(d&63)<<6|m&63,l-=65536,e.push((l>>10)+55296,(l&1023)+56320))))),1E3<=e.length&& (c+=String.fromCharCode.apply(null,e),e.length=0);return c+String.fromCharCode.apply(null,e)}var f;"utf8"===k?f=b(g):("binary"!==k&&this.log("Unsupported encoding: "+k),f=c(g));return f};Runtime.getVariable=function(g){try{return eval(g)}catch(k){}};Runtime.toJson=function(g){return JSON.stringify(g)};Runtime.fromJson=function(g){return JSON.parse(g)};Runtime.getFunctionName=function(g){return void 0===g.name?(g=/function\s+(\w+)/.exec(g))&&g[1]:g.name}; Runtime.assert=function(g,k){if(!g)throw this.log("alert","ASSERTION FAILED:\n"+k),Error(k);}; function BrowserRuntime(){function g(b){var e=b.length,l,a,d=0;for(l=0;l<e;l+=1)a=b.charCodeAt(l),d+=1+(128<a)+(2048<a),55040<a&&57344>a&&(d+=1,l+=1);return d}function k(b,e,l){var a=b.length,d,m;e=new Uint8Array(new ArrayBuffer(e));l?(e[0]=239,e[1]=187,e[2]=191,m=3):m=0;for(l=0;l<a;l+=1)d=b.charCodeAt(l),128>d?(e[m]=d,m+=1):2048>d?(e[m]=192|d>>>6,e[m+1]=128|d&63,m+=2):55040>=d||57344<=d?(e[m]=224|d>>>12&15,e[m+1]=128|d>>>6&63,e[m+2]=128|d&63,m+=3):(l+=1,d=(d-55296<<10|b.charCodeAt(l)-56320)+65536, e[m]=240|d>>>18&7,e[m+1]=128|d>>>12&63,e[m+2]=128|d>>>6&63,e[m+3]=128|d&63,m+=4);return e}function c(b){var e=b.length,l=new Uint8Array(new ArrayBuffer(e)),a;for(a=0;a<e;a+=1)l[a]=b.charCodeAt(a)&255;return l}function b(b,e){var l;void 0!==e?l=b:e=b;console.log(e);r.enableAlerts&&"alert"===l&&alert(e)}function f(b,e,l){if(0!==l.status||l.responseText)if(200===l.status||0===l.status){if(l.response&&"string"!==typeof l.response)"binary"===e?(l=l.response,l=new Uint8Array(l)):l=String(l.response);else if("binary"=== e)if(null!==l.responseBody&&"undefined"!==String(typeof VBArray)){l=(new VBArray(l.responseBody)).toArray();var a=l.length;e=new Uint8Array(new ArrayBuffer(a));for(b=0;b<a;b+=1)e[b]=l[b];l=e}else{(b=l.getResponseHeader("Content-Length"))&&(b=parseInt(b,10));if(b&&b!==l.responseText.length)a:{a=l.responseText;e=!1;var d=g(a);if("number"===typeof b){if(b!==d&&b!==d+3){a=void 0;break a}e=d+3===b;d=b}a=k(a,d,e)}void 0===a&&(a=c(l.responseText));l=a}else l=l.responseText;l={err:null,data:l}}else l={err:l.responseText|| l.statusText,data:null};else l={err:"File "+b+" is empty.",data:null};return l}function n(b,e,l){var a=new XMLHttpRequest;a.open("GET",b,l);a.overrideMimeType&&("binary"!==e?a.overrideMimeType("text/plain; charset="+e):a.overrideMimeType("text/plain; charset=x-user-defined"));return a}function p(b,e,l){var a=n(b,e,!0);a.onreadystatechange=function(){var d;4===a.readyState&&(d=f(b,e,a),l(d.err,d.data))};try{a.send(null)}catch(d){l(d.message,null)}}var r=this;this.byteArrayFromString=function(b,e){var l; "utf8"===e?l=k(b,g(b),!1):("binary"!==e&&r.log("unknown encoding: "+e),l=c(b));return l};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=p;this.read=function(b,e,l,a){p(b,"binary",function(d,m){var h=null;if(m){if("string"===typeof m)throw"This should not happen.";h=m.subarray(e,e+l)}a(d,h)})};this.readFileSync=function(b,e){var l=n(b,e,!1),a;try{l.send(null);a=f(b,e,l);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,e,l){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?l(null):l("Status "+String(a.status)+": "+a.responseText||a.statusText):l("File "+b+" is empty."))};d=e.buffer&&!a.sendAsBinary?e.buffer:r.byteArrayToString(e,"binary");try{a.sendAsBinary?a.sendAsBinary(d):a.send(d)}catch(m){r.log("HUH? "+ m+" "+e),l(m.message)}};this.deleteFile=function(b,e){var l=new XMLHttpRequest;l.open("DELETE",b,!0);l.onreadystatechange=function(){4===l.readyState&&(200>l.status&&300<=l.status?e(l.responseText):e(null))};l.send(null)};this.loadXML=function(b,e){var l=new XMLHttpRequest;l.open("GET",b,!0);l.overrideMimeType&&l.overrideMimeType("text/xml");l.onreadystatechange=function(){4===l.readyState&&(0!==l.status||l.responseText?200===l.status||0===l.status?e(null,l.responseXML):e(l.responseText,null):e("File "+ b+" is empty.",null))};try{l.send(null)}catch(a){e(a.message,null)}};this.log=b;this.enableAlerts=!0;this.assert=Runtime.assert;this.setTimeout=function(b,e){return setTimeout(function(){b()},e)};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 e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,l=0;if(e)e.bind(window),l=e(b);else return setTimeout(b,15);return l};this.cancelAnimationFrame=function(b){var e=window.cancelAnimationFrame|| window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame;e?(e.bind(window),e(b)):clearTimeout(b)}} function NodeJSRuntime(){function g(b){var e=b.length,l,a=new Uint8Array(new ArrayBuffer(e));for(l=0;l<e;l+=1)a[l]=b[l];return a}function k(c,e,l){function a(a,m){if(a)return l(a,null);if(!m)return l("No data for "+c+".",null);if("string"===typeof m)return l(a,m);l(a,g(m))}c=f.resolve(n,c);"binary"!==e?b.readFile(c,e,a):b.readFile(c,null,a)}var c=this,b=require("fs"),f=require("path"),n="",p,r;this.byteArrayFromString=function(b,e){var l=new Buffer(b,e),a,d=l.length,m=new Uint8Array(new ArrayBuffer(d)); for(a=0;a<d;a+=1)m[a]=l[a];return m};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.readFile=k;this.loadXML=function(b,e){k(b,"utf-8",function(l,a){if(l)return e(l,null);if(!a)return e("No data for "+b+".",null);e(null,c.parseXML(a))})};this.writeFile=function(c,e,l){e=new Buffer(e);c=f.resolve(n,c);b.writeFile(c,e,"binary",function(a){l(a||null)})};this.deleteFile=function(c,e){c=f.resolve(n,c); b.unlink(c,e)};this.read=function(c,e,l,a){c=f.resolve(n,c);b.open(c,"r+",666,function(d,m){if(d)a(d,null);else{var h=new Buffer(l);b.read(m,h,0,l,e,function(d){b.close(m);a(d,g(h))})}})};this.readFileSync=function(c,e){var l;l=b.readFileSync(c,"binary"===e?null:e);if(null===l)throw"File "+c+" could not be read.";"binary"===e&&(l=g(l));return l};this.log=function(b,e){var l;void 0!==e?l=b:e=b;"alert"===l&&process.stderr.write("\n!!!!! ALERT !!!!!\n");process.stderr.write(e+"\n");"alert"===l&&process.stderr.write("!!!!! ALERT !!!!!\n")}; this.assert=Runtime.assert;this.setTimeout=function(b,e){return setTimeout(function(){b()},e)};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 r};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);r=c.parseXML("<a/>").implementation} function RhinoRuntime(){var g=this,k={},c=k.javax.xml.parsers.DocumentBuilderFactory.newInstance(),b,f,n="";c.setValidating(!1);c.setNamespaceAware(!0);c.setExpandEntityReferences(!1);c.setSchema(null);f=k.org.xml.sax.EntityResolver({resolveEntity:function(b,c){var f=new k.java.io.FileReader(c);return new k.org.xml.sax.InputSource(f)}});b=c.newDocumentBuilder();b.setEntityResolver(f);this.byteArrayFromString=function(b,c){var f,e=b.length,l=new Uint8Array(new ArrayBuffer(e));for(f=0;f<e;f+=1)l[f]= b.charCodeAt(f)&255;return l};this.byteArrayToString=Runtime.byteArrayToString;this.getVariable=Runtime.getVariable;this.fromJson=Runtime.fromJson;this.toJson=Runtime.toJson;this.loadXML=function(c,f){var n=new k.java.io.File(c),e=null;try{e=b.parse(n)}catch(l){return print(l),f(l,null)}f(null,e)};this.readFile=function(b,c,f){n&&(b=n+"/"+b);var e=new k.java.io.File(b),l="binary"===c?"latin1":c;e.isFile()?((b=readFile(b,l))&&"binary"===c&&(b=g.byteArrayFromString(b,"binary")),f(null,b)):f(b+" is not a file.", null)};this.writeFile=function(b,c,f){n&&(b=n+"/"+b);b=new k.java.io.FileOutputStream(b);var e,l=c.length;for(e=0;e<l;e+=1)b.write(c[e]);b.close();f(null)};this.deleteFile=function(b,c){n&&(b=n+"/"+b);var f=new k.java.io.File(b),e=b+Math.random(),e=new k.java.io.File(e);f.rename(e)?(e.deleteOnExit(),c(null)):c("Could not delete "+b)};this.read=function(b,c,f,e){n&&(b=n+"/"+b);var l;l=b;var a="binary";(new k.java.io.File(l)).isFile()?("binary"===a&&(a="latin1"),l=readFile(l,a)):l=null;l?e(null,this.byteArrayFromString(l.substring(c, c+f),"binary")):e("Cannot read "+b,null)};this.readFileSync=function(b,c){if(!c)return"";var f=readFile(b,c);if(null===f)throw"File could not be read.";return f};this.log=function(b,c){var f;void 0!==c?f=b:c=b;"alert"===f&&print("\n!!!!! ALERT !!!!!");print(c);"alert"===f&&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 g(b,c,e){var l=b+"/manifest.json",a,d;runtime.log("Loading manifest: "+l);try{a=runtime.readFileSync(l,"utf-8")}catch(m){if(e)runtime.log("No loadable manifest found.");else throw console.log(String(m)),m;return}e=JSON.parse(a);for(d in e)e.hasOwnProperty(d)&&(c[d]={dir:b,deps:e[d]})}function k(b,c,e){function l(h){if(!m[h]&&!e(h)){if(d[h])throw"Circular dependency detected for "+h+".";d[h]=!0;if(!c[h])throw"Missing dependency information for class "+h+".";var b=c[h],f=b.deps, n,r=f.length;for(n=0;n<r;n+=1)l(f[n]);d[h]=!1;m[h]=!0;a.push(b.dir+"/"+h.replace(".","/")+".js")}}var a=[],d={},m={};b.forEach(l);return a}function c(b,c){return c+("\n//# sourceURL="+b)}function b(b){var f,e;for(f=0;f<b.length;f+=1)e=runtime.readFileSync(b[f],"utf-8"),e=c(b[f],e),eval(e)}function f(b){b=b.split(".");var c,e=p,l=b.length;for(c=0;c<l;c+=1){if(!e.hasOwnProperty(b[c]))return!1;e=e[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 e;if(!(e=n)){e=[];var l=runtime.libraryPaths(),a;runtime.currentDirectory()&&-1===l.indexOf(runtime.currentDirectory())&&g(runtime.currentDirectory(),e,!0);for(a=0;a<l.length;a+=1)g(l[a],e)}n=e;c=k(c,n,f);if(0===c.length)return p&&p();if("BrowserRuntime"===runtime.type()&&p){e=c;l=document.currentScript||document.documentElement.lastChild;a=document.createDocumentFragment();var d,m;for(m=0;m<e.length;m+=1)d=document.createElement("script"),d.type= "text/javascript",d.charset="utf-8",d.async=!1,d.setAttribute("src",e[m]),a.appendChild(d);p&&(d.onload=p);l.parentNode.insertBefore(a,l)}else b(c),p&&p()};runtime.loadClass=function(b,c){runtime.loadClasses([b],c)}})();(function(){var g=function(g){return g};runtime.getTranslator=function(){return g};runtime.setTranslator=function(k){g=k};runtime.tr=function(k){var c=g(k);return c&&"string"===String(typeof c)?c:k}})(); (function(g){function k(c){if(c.length){var b=c[0];runtime.readFile(b,"utf8",function(f,n){function g(){var b;(b=eval(k))&&runtime.exit(b)}var r="",r=b.lastIndexOf("/"),k=n,r=-1!==r?b.substring(0,r):".";runtime.setCurrentDirectory(r);f?(runtime.log(f),runtime.exit(1)):null===k?(runtime.log("No code found for "+b),runtime.exit(1)):g.apply(null,c)})}}g=g?Array.prototype.slice.call(g):[];"NodeJSRuntime"===runtime.type()?k(process.argv.slice(2)):"RhinoRuntime"===runtime.type()?k(g):k(g.slice(1))})("undefined"!== String(typeof arguments)&&arguments);(function(){core.Async=function(){return{forEach:function(g,k,c){function b(b){p!==n&&(b?(p=n,c(b)):(p+=1,p===n&&c(null)))}var f,n=g.length,p=0;for(f=0;f<n;f+=1)k(g[f],b)},destroyAll:function(g,k){function c(b,f){if(f)k(f);else if(b<g.length)g[b](function(f){c(b+1,f)});else k()}c(0,void 0)}}}()})(); function makeBase64(){function g(a){var d,m=a.length,h=new Uint8Array(new ArrayBuffer(m));for(d=0;d<m;d+=1)h[d]=a.charCodeAt(d)&255;return h}function k(a){var d,m="",h,b=a.length-2;for(h=0;h<b;h+=3)d=a[h]<<16|a[h+1]<<8|a[h+2],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>18],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>12&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d& 63];h===b+1?(d=a[h]<<4,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d&63],m+="=="):h===b&&(d=a[h]<<10|a[h+1]<<2,m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>12],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d>>>6&63],m+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d&63],m+="=");return m}function c(a){a=a.replace(/[^A-Za-z0-9+\/]+/g, "");var d=a.length,m=new Uint8Array(new ArrayBuffer(3*d)),b=a.length%4,c=0,l,e;for(l=0;l<d;l+=4)e=(h[a.charAt(l)]||0)<<18|(h[a.charAt(l+1)]||0)<<12|(h[a.charAt(l+2)]||0)<<6|(h[a.charAt(l+3)]||0),m[c]=e>>16,m[c+1]=e>>8&255,m[c+2]=e&255,c+=3;d=3*d-[0,0,2,1][b];return m.subarray(0,d)}function b(a){var d,m,h=a.length,b=0,c=new Uint8Array(new ArrayBuffer(3*h));for(d=0;d<h;d+=1)m=a[d],128>m?c[b++]=m:(2048>m?c[b++]=192|m>>>6:(c[b++]=224|m>>>12&15,c[b++]=128|m>>>6&63),c[b++]=128|m&63);return c.subarray(0, b)}function f(a){var d,m,h,b,c=a.length,l=new Uint8Array(new ArrayBuffer(c)),e=0;for(d=0;d<c;d+=1)m=a[d],128>m?l[e++]=m:(d+=1,h=a[d],224>m?l[e++]=(m&31)<<6|h&63:(d+=1,b=a[d],l[e++]=(m&15)<<12|(h&63)<<6|b&63));return l.subarray(0,e)}function n(a){return k(g(a))}function p(a){return String.fromCharCode.apply(String,c(a))}function r(a){return f(g(a))}function q(a){a=f(a);for(var d="",m=0;m<a.length;)d+=String.fromCharCode.apply(String,a.subarray(m,m+45E3)),m+=45E3;return d}function e(a,d,m){var h,b, c,l="";for(c=d;c<m;c+=1)d=a.charCodeAt(c)&255,128>d?l+=String.fromCharCode(d):(c+=1,h=a.charCodeAt(c)&255,224>d?l+=String.fromCharCode((d&31)<<6|h&63):(c+=1,b=a.charCodeAt(c)&255,l+=String.fromCharCode((d&15)<<12|(h&63)<<6|b&63)));return l}function l(a,d){function m(){var c=b+1E5;c>a.length&&(c=a.length);h+=e(a,b,c);b=c;c=b===a.length;d(h,c)&&!c&&runtime.setTimeout(m,0)}var h="",b=0;1E5>a.length?d(e(a,0,a.length),!0):("string"!==typeof a&&(a=a.slice()),m())}function a(a){return b(g(a))}function d(a){return String.fromCharCode.apply(String, b(a))}function m(a){return String.fromCharCode.apply(String,b(g(a)))}var h=function(a){var d={},m,h;m=0;for(h=a.length;m<h;m+=1)d[a.charAt(m)]=m;return d}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),y,x,z=runtime.getWindow(),w,v;z&&z.btoa?(w=z.btoa,y=function(a){return w(m(a))}):(w=n,y=function(d){return k(a(d))});z&&z.atob?(v=z.atob,x=function(a){a=v(a);return e(a,0,a.length)}):(v=p,x=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=f;this.convertUTF8StringToBase64=n;this.convertBase64ToUTF8String=p;this.convertUTF8StringToUTF16Array=r;this.convertByteArrayToUTF16String=this.convertUTF8ArrayToUTF16String=q;this.convertUTF8StringToUTF16String=l;this.convertUTF16StringToByteArray=this.convertUTF16StringToUTF8Array=a;this.convertUTF16ArrayToUTF8String= d;this.convertUTF16StringToUTF8String=m;this.convertUTF16StringToBase64=y;this.convertBase64ToUTF16String=x;this.fromBase64=p;this.toBase64=n;this.atob=v;this.btoa=w;this.utob=m;this.btou=l;this.encode=y;this.encodeURI=function(a){return y(a).replace(/[+\/]/g,function(a){return"+"===a?"-":"_"}).replace(/\\=+$/,"")};this.decode=function(a){return x(a.replace(/[\-_]/g,function(a){return"-"===a?"+":"/"}))};return this};return core.Base64}core.Base64=makeBase64(); core.CSSUnits=function(){var g=this,k={"in":1,cm:2.54,mm:25.4,pt:72,pc:12,px:96};this.convert=function(c,b,f){return c*k[f]/k[b]};this.convertMeasure=function(c,b){var f,n;c&&b&&(f=parseFloat(c),n=c.replace(f.toString(),""),f=g.convert(f,n,b));return f};this.getUnits=function(c){return c.substr(c.length-2,c.length)}}; (function(){function g(){var b,f,n,g,k,q,e,l,a;void 0===c&&(f=(b=runtime.getWindow())&&b.document,q=f.documentElement,e=f.body,c={rangeBCRIgnoresElementBCR:!1,unscaledRangeClientRects:!1,elementBCRIgnoresBodyScroll:!1},f&&(g=f.createElement("div"),g.style.position="absolute",g.style.left="-99999px",g.style.transform="scale(2)",g.style["-webkit-transform"]="scale(2)",k=f.createElement("div"),g.appendChild(k),e.appendChild(g),b=f.createRange(),b.selectNode(k),c.rangeBCRIgnoresElementBCR=0===b.getClientRects().length, k.appendChild(f.createTextNode("Rect transform test")),f=k.getBoundingClientRect(),n=b.getBoundingClientRect(),c.unscaledRangeClientRects=2<Math.abs(f.height-n.height),g.style.transform="",g.style["-webkit-transform"]="",f=q.style.overflow,n=e.style.overflow,l=e.style.height,a=e.scrollTop,q.style.overflow="visible",e.style.overflow="visible",e.style.height="200%",e.scrollTop=e.scrollHeight,c.elementBCRIgnoresBodyScroll=b.getBoundingClientRect().top!==k.getBoundingClientRect().top,e.scrollTop=a,e.style.height= l,e.style.overflow=n,q.style.overflow=f,b.detach(),e.removeChild(g),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 r(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,l=d(a),e;if(l===NodeFilter.FILTER_SKIP)return b;for(;c;)e=c.nextSibling,q(c,d),c=e;b&&l===NodeFilter.FILTER_REJECT&&r(a);return b}function e(a,d){return a===d||Boolean(a.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_CONTAINED_BY)}function l(a,d){return g().unscaledRangeClientRects?a:a/d}function a(d,h,b){Object.keys(h).forEach(function(c){var l= c.split(":"),e=l[1],f=b(l[0]),l=h[c],n=typeof l;"object"===n?Object.keys(l).length&&(c=f?d.getElementsByTagNameNS(f,e)[0]||d.ownerDocument.createElementNS(f,c):d.getElementsByTagName(e)[0]||d.ownerDocument.createElement(c),d.appendChild(c),a(c,l,b)):f&&(runtime.assert("number"===n||"string"===n,"attempting to map unsupported type '"+n+"' (key: "+c+")"),d.setAttributeNS(f,c,String(l)))})}var d=null;this.splitBoundaries=function(a){var d,c=[],l,e,f;if(a.startContainer.nodeType===Node.TEXT_NODE||a.endContainer.nodeType=== Node.TEXT_NODE){l=a.endContainer;e=a.endContainer.nodeType!==Node.TEXT_NODE?a.endOffset===a.endContainer.childNodes.length:!1;f=a.endOffset;d=a.endContainer;if(f<d.childNodes.length)for(d=d.childNodes.item(f),f=0;d.firstChild;)d=d.firstChild;else for(;d.lastChild;)d=d.lastChild,f=d.nodeType===Node.TEXT_NODE?d.textContent.length:d.childNodes.length;d===l&&(l=null);a.setEnd(d,f);f=a.endContainer;0!==a.endOffset&&f.nodeType===Node.TEXT_NODE&&(d=f,a.endOffset!==d.length&&(c.push(d.splitText(a.endOffset)), c.push(d)));f=a.startContainer;0!==a.startOffset&&f.nodeType===Node.TEXT_NODE&&(d=f,a.startOffset!==d.length&&(f=d.splitText(a.startOffset),c.push(d),c.push(f),a.setStart(f,0)));if(null!==l){for(f=a.endContainer;f.parentNode&&f.parentNode!==l;)f=f.parentNode;e=e?l.childNodes.length:b(f,l);a.setEnd(l,e)}}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=[],l=a.commonAncestorContainer,l=l.nodeType===Node.TEXT_NODE?l.parentNode:l;b=a.startContainer.ownerDocument.createTreeWalker(l,b,d,!1);var e,f;a.endContainer.childNodes[a.endOffset-1]?(e=a.endContainer.childNodes[a.endOffset-1],f=Node.DOCUMENT_POSITION_PRECEDING|Node.DOCUMENT_POSITION_CONTAINED_BY):(e=a.endContainer,f=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!==l)for(a=a.parentNode;a&&a!==l;)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=e.compareDocumentPosition(a);if(0!==d&&0===(d&f))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(),l=d.ownerDocument.createRange(),e;b.setStart(a.startContainer,a.startOffset);b.setEnd(a.endContainer, a.endOffset);l.selectNodeContents(d);e=c(b,l);b.detach();l.detach();return e};this.mergeIntoParent=r;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,l,e;c=a.getElementsByTagName(d);b.length=e=c.length;for(l=0;l<e;l+=1)b[l]=c.item(l);return b}; this.containsNode=function(a,d){return a===d||a.contains(d)};this.comparePoints=function(a,d,c,l){if(a===c)return l-d;var e=a.compareDocumentPosition(c);2===e?e=-1:4===e?e=1:10===e?(d=b(a,c),e=d<l?1:-1):(l=b(c,a),e=l<d?-1:1);return e};this.adaptRangeDifferenceToZoomLevel=l;this.translateRect=function(a,d,b){return{top:l(a.top-d.top,b),left:l(a.left-d.left,b),bottom:l(a.bottom-d.top,b),right:l(a.right-d.left,b),width:l(a.width,b),height:l(a.height,b)}};this.getBoundingClientRect=function(a){var b= a.ownerDocument,c=g(),l=b.body;if((!1===c.unscaledRangeClientRects||c.rangeBCRIgnoresElementBCR)&&a.nodeType===Node.ELEMENT_NODE)return a=a.getBoundingClientRect(),c.elementBCRIgnoresBodyScroll?{left:a.left+l.scrollLeft,right:a.right+l.scrollLeft,top:a.top+l.scrollTop,bottom:a.bottom+l.scrollTop,width:a.width,height:a.height}:a;var e;d?e=d:d=e=b.createRange();c=e;c.selectNode(a);return c.getBoundingClientRect()};this.mapKeyValObjOntoNode=function(a,d,b){Object.keys(d).forEach(function(c){var l=c.split(":"), e=l[1],l=b(l[0]),f=d[c];l?(e=a.getElementsByTagNameNS(l,e)[0],e||(e=a.ownerDocument.createElementNS(l,c),a.appendChild(e)),e.textContent=f):runtime.log("Key ignored: "+c)})};this.removeKeyElementsFromNode=function(a,d,b){d.forEach(function(d){var c=d.split(":"),h=c[1];(c=b(c[0]))?(h=a.getElementsByTagNameNS(c,h)[0])?h.parentNode.removeChild(h):runtime.log("Element for "+d+" not found."):runtime.log("Property Name ignored: "+d)})};this.getKeyValRepresentationOfNode=function(a,d){for(var b={},c=a.firstElementChild, l;c;){if(l=d(c.namespaceURI))b[l+":"+c.localName]=c.textContent;c=c.nextElementSibling}return b};this.mapObjOntoNode=a;this.cloneEvent=function(a){var d=Object.create(null);Object.keys(a.constructor.prototype).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=e)})(this)};core.DomUtils=new core.DomUtilsImpl})(); core.Cursor=function(g,k){function c(a){a.parentNode&&(r.push(a.previousSibling),r.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 c=d.parentNode;runtime.assert(Boolean(c),"putCursorIntoTextNode: container without parent");runtime.assert(0<=b&&b<=d.length,"putCursorIntoTextNode: offset is out of bounds");0===b?c.insertBefore(a,d):(b!==d.length&&d.splitText(b),c.insertBefore(a, d.nextSibling))}else d.nodeType===Node.ELEMENT_NODE&&d.insertBefore(a,d.childNodes.item(b));r.push(a.previousSibling);r.push(a.nextSibling)}var f=g.createElementNS("urn:webodf:names:cursor","cursor"),n=g.createElementNS("urn:webodf:names:cursor","anchor"),p,r=[],q=g.createRange(),e,l=core.DomUtils;this.getNode=function(){return f};this.getAnchorNode=function(){return n.parentNode?n:f};this.getSelectedRange=function(){e?(q.setStartBefore(f),q.collapse(!0)):(q.setStartAfter(p?n:f),q.setEndBefore(p? f:n));return q};this.setSelectedRange=function(a,d){q&&q!==a&&q.detach();q=a;p=!1!==d;(e=a.collapsed)?(c(n),c(f),b(f,a.startContainer,a.startOffset)):(c(n),c(f),b(p?f:n,a.endContainer,a.endOffset),b(p?n:f,a.startContainer,a.startOffset));r.forEach(l.normalizeTextNodes);r.length=0};this.hasForwardSelection=function(){return p};this.remove=function(){c(f);r.forEach(l.normalizeTextNodes);r.length=0};f.setAttributeNS("urn:webodf:names:cursor","memberId",k);n.setAttributeNS("urn:webodf:names:cursor","memberId", k)};core.Destroyable=function(){};core.Destroyable.prototype.destroy=function(g){};core.EventSource=function(){};core.EventSource.prototype.subscribe=function(g,k){};core.EventSource.prototype.unsubscribe=function(g,k){}; core.EventNotifier=function(g){function k(b){runtime.assert(!c.hasOwnProperty(b),'Duplicated event ids: "'+b+'" registered more than once.');c[b]=[]}var c={};this.emit=function(b,f){var n,g;runtime.assert(c.hasOwnProperty(b),'unknown event fired "'+b+'"');g=c[b];for(n=0;n<g.length;n+=1)g[n](f)};this.subscribe=function(b,f){runtime.assert(c.hasOwnProperty(b),'tried to subscribe to unknown event "'+b+'"');c[b].push(f)};this.unsubscribe=function(b,f){var n;runtime.assert(c.hasOwnProperty(b),'tried to unsubscribe from unknown event "'+ b+'"');n=c[b].indexOf(f);runtime.assert(-1!==n,'tried to unsubscribe unknown callback from event "'+b+'"');-1!==n&&c[b].splice(n,1)};this.register=k;g&&g.forEach(k)}; core.ScheduledTask=function(g,k,c){function b(){p&&(c(n),p=!1)}function f(){b();g.apply(void 0,r);r=null}var n,p=!1,r=[],q=!1;this.trigger=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");r=Array.prototype.slice.call(arguments);p||(p=!0,n=k(f))};this.triggerImmediate=function(){runtime.assert(!1===q,"Can't trigger destroyed ScheduledTask instance");r=Array.prototype.slice.call(arguments);f()};this.processRequests=function(){p&&f()};this.cancel=b;this.restart=function(){runtime.assert(!1=== q,"Can't trigger destroyed ScheduledTask instance");b();p=!0;n=k(f)};this.destroy=function(c){b();q=!0;c()}}; (function(){var g;core.Task={};core.Task.SUPPRESS_MANUAL_PROCESSING=!1;core.Task.processTasks=function(){core.Task.SUPPRESS_MANUAL_PROCESSING||g.performRedraw()};core.Task.createRedrawTask=function(k){return new core.ScheduledTask(k,g.requestRedrawTask,g.cancelRedrawTask)};core.Task.createTimeoutTask=function(g,c){return new core.ScheduledTask(g,function(b){return runtime.setTimeout(b,c)},runtime.clearTimeout)};g=new function(){var g={};this.requestRedrawTask=function(c){var b=runtime.requestAnimationFrame(function(){c(); delete g[b]});g[b]=c;return b};this.performRedraw=function(){Object.keys(g).forEach(function(c){g[c]();runtime.cancelAnimationFrame(parseInt(c,10))});g={}};this.cancelRedrawTask=function(c){runtime.cancelAnimationFrame(c);delete g[c]}}})(); core.EventSubscriptions=function(){function g(b,f,n){b.subscribe(f,n);c.push({eventSource:b,eventid:f,callback:n})}function k(){var n=[];c.forEach(function(b){b.eventSource.unsubscribe(b.eventid,b.callback)});c.length=0;Object.keys(f).forEach(function(b){f[b].forEach(function(b){n.push(b.task.destroy)});delete f[b]});core.Async.destroyAll(n,function(){});b=new core.EventNotifier}var c=[],b=new core.EventNotifier,f={},n=0;this.addSubscription=g;this.addFrameSubscription=function(c,k,q){var e,l,a,d; f.hasOwnProperty(k)||(f[k]=[]);a=f[k];for(d=0;d<a.length;d+=1)if(a[d].eventSource===c){e=a[d];break}e||(l="s"+n,n+=1,b.register(l),e={frameEventId:l,eventSource:c,task:core.Task.createRedrawTask(function(){b.emit(l,void 0)})},a.push(e),g(c,k,e.task.trigger));b.subscribe(e.frameEventId,q)};this.unsubscribeAll=k;this.destroy=function(b){k();b()}};core.LazyProperty=function(g){var k,c=!1;this.value=function(){c||(k=g(),c=!0);return k};this.reset=function(){c=!1}}; core.LoopWatchDog=function(g,k){var c=Date.now(),b=0;this.check=function(){var f;if(g&&(f=Date.now(),f-c>g))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(g){var k=NodeFilter.FILTER_REJECT,c=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(b){var f;for(f=0;f<g.length;f+=1)if(g[f].acceptNode(b)===k)return k;return c}}; core.PositionIterator=function(g,k,c,b){function f(){this.acceptNode=function(a){return!a||a.nodeType===m&&0===a.length?x:y}}function n(a){this.acceptNode=function(d){return!d||d.nodeType===m&&0===d.length?x:a.acceptNode(d)}}function p(){var d=l.currentNode,b=d.nodeType;a=b===m?d.length-1:b===h?1:0}function r(){if(null===l.previousSibling()){if(!l.parentNode()||l.currentNode===g)return l.firstChild(),!1;a=0}else p();return!0}function q(){var b=l.currentNode,c;c=d(b);if(b!==g)for(b=b.parentNode;b&& b!==g;)d(b)===x&&(l.currentNode=b,c=x),b=b.parentNode;c===x?(a=l.currentNode.nodeType===m?b.length:1,b=e.nextPosition()):b=c===y?!0:e.nextPosition();b&&runtime.assert(d(l.currentNode)===y,"moveToAcceptedNode did not result in walker being on an accepted node");return b}var e=this,l,a,d,m=Node.TEXT_NODE,h=Node.ELEMENT_NODE,y=NodeFilter.FILTER_ACCEPT,x=NodeFilter.FILTER_REJECT;this.nextPosition=function(){var d=l.currentNode,b=d.nodeType;if(d===g)return!1;if(0===a&&b===h)null===l.firstChild()&&(a=1); else if(b===m&&a+1<d.length)a+=1;else if(null!==l.nextSibling())a=0;else if(l.parentNode())a=1;else return!1;return!0};this.previousPosition=function(){var d=!0,b=l.currentNode;0===a?d=r():b.nodeType===m?--a:null!==l.lastChild()?p():b===g?d=!1:a=0;return d};this.previousNode=r;this.container=function(){var d=l.currentNode,b=d.nodeType;0===a&&b!==m&&(d=d.parentNode);return d};this.rightNode=function(){var b=l.currentNode,c=b.nodeType;if(c===m&&a===b.length)for(b=b.nextSibling;b&&d(b)!==y;)b=b.nextSibling; else c===h&&1===a&&(b=null);return b};this.leftNode=function(){var b=l.currentNode;if(0===a)for(b=b.previousSibling;b&&d(b)!==y;)b=b.previousSibling;else if(b.nodeType===h)for(b=b.lastChild;b&&d(b)!==y;)b=b.previousSibling;return b};this.getCurrentNode=function(){return l.currentNode};this.unfilteredDomOffset=function(){if(l.currentNode.nodeType===m)return a;for(var d=0,b=l.currentNode,b=1===a?b.lastChild:b.previousSibling;b;)d+=1,b=b.previousSibling;return d};this.getPreviousSibling=function(){var a= l.currentNode,d=l.previousSibling();l.currentNode=a;return d};this.getNextSibling=function(){var a=l.currentNode,d=l.nextSibling();l.currentNode=a;return d};this.setPositionBeforeElement=function(d){runtime.assert(Boolean(d),"setPositionBeforeElement called without element");l.currentNode=d;a=0;return q()};this.setUnfilteredPosition=function(d,b){runtime.assert(Boolean(d),"PositionIterator.setUnfilteredPosition called without container");l.currentNode=d;d.nodeType===m?(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&&(l.nextSibling()?a=0:l.parentNode()?a=1:runtime.assert(!1,"Error in setUnfilteredPosition: position not valid."))):b<d.childNodes.length?(l.currentNode=d.childNodes.item(b),a=0):a=1;return q()};this.moveToEnd=function(){l.currentNode=g;a=1};this.moveToEndOfNode=function(d){d.nodeType===m?e.setUnfilteredPosition(d,d.length):(l.currentNode=d,a=1)};this.isBeforeNode=function(){return 0===a}; this.getNodeFilter=function(){return d};d=(c?new n(c):new f).acceptNode;d.acceptNode=d;k=k||NodeFilter.SHOW_ALL;runtime.assert(g.nodeType!==Node.TEXT_NODE,"Internet Explorer doesn't allow tree walker roots to be text nodes");l=g.ownerDocument.createTreeWalker(g,k,d,b);a=0;null===l.firstChild()&&(a=1)};core.PositionFilter=function(){};core.PositionFilter.FilterResult={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3};core.PositionFilter.prototype.acceptPosition=function(g){}; core.PositionFilterChain=function(){var g=[],k=core.PositionFilter.FilterResult.FILTER_ACCEPT,c=core.PositionFilter.FilterResult.FILTER_REJECT;this.acceptPosition=function(b){var f;for(f=0;f<g.length;f+=1)if(g[f].acceptPosition(b)===c)return c;return k};this.addFilter=function(b){g.push(b)}};core.StepDirection={PREVIOUS:1,NEXT:2}; core.StepIterator=function(g,k){function c(){a=null;m=d=void 0}function b(){void 0===m&&(m=g.acceptPosition(k)===e);return m}function f(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 r(){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 e=core.PositionFilter.FilterResult.FILTER_ACCEPT,l=core.StepDirection.NEXT, a,d,m;this.isStep=b;this.setPosition=f;this.container=n;this.offset=p;this.nextStep=r;this.previousStep=q;this.advanceStep=function(a){return a===l?r():q()};this.roundToClosestStep=function(){var a,d,c=b();c||(a=n(),d=p(),c=q(),c||(f(a,d),c=r()));return c};this.roundToPreviousStep=function(){var a=b();a||(a=q());return a};this.roundToNextStep=function(){var a=b();a||(a=r());return a};this.leftNode=function(){return k.leftNode()};this.snapshot=function(){return new core.StepIterator.StepSnapshot(n(), p())};this.restore=function(a){f(a.container,a.offset)}};core.StepIterator.StepSnapshot=function(g,k){this.container=g;this.offset=k}; core.Utils=function(){function g(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 g(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]=g(k[b],c[b])})}else k=c;return k}this.hashString=function(g){var c=0,b,f;b=0;for(f=g.length;b<f;b+=1)c=(c<<5)-c+g.charCodeAt(b),c|=0;return c};this.mergeObjects=function(k,c){Object.keys(c).forEach(function(b){k[b]= g(k[b],c[b])});return k}}; core.Zip=function(g,k){function c(b,c){var a=r.file(b);a?c(null,a.asUint8Array()):c(b+" not found.",null)}function b(b,l){c(b,function(a,d){if(a||null===d)return l(a,null);var b=runtime.byteArrayToString(d,"utf8");l(null,b)})}function f(b,c){try{b(r.generate({type:"uint8array",compression:"DEFLATE"}))}catch(a){c(a.message)}}function n(b,c){f(function(a){runtime.writeFile(b,a,c)},c)}var p=this,r,q=new core.Base64;this.load=c;this.save=function(b,c,a,d){r.file(b,c,{date:d,compression:a?null:"STORE"})}; this.remove=function(b){var c=null!==r.file(b);r.remove(b);return c};this.write=function(b){n(g,b)};this.writeAs=n;this.createByteArray=f;this.loadContentXmlAsFragments=function(c,l){b(c,function(a,d){if(a)return l.rootElementReady(a);l.rootElementReady(null,d,!0)})};this.loadAsString=b;this.loadAsDOM=function(c,l){b(c,function(a,d){if(a||null===d)l(a,null);else{var b=(new DOMParser).parseFromString(d,"text/xml");l(null,b)}})};this.loadAsDataURL=function(b,l,a){c(b,function(d,b){if(d||!b)return a(d, null);var c=0,e;l||(l=80===b[1]&&78===b[2]&&71===b[3]?"image/png":255===b[0]&&216===b[1]&&255===b[2]?"image/jpeg":71===b[0]&&73===b[1]&&70===b[2]?"image/gif":"");for(e="data:"+l+";base64,";c<b.length;)e+=q.convertUTF8ArrayToBase64(b.subarray(c,Math.min(c+45E3,b.length))),c+=45E3;a(null,e)})};this.getEntries=function(){return Object.keys(r.files).map(function(b){return{filename:b}})};r=new externs.JSZip;null!==k&&runtime.readFile(g,"binary",function(b,c){"string"===typeof c&&(b="file was read as a string. Should be Uint8Array."); if(b||!c||0===c.length)k("File '"+g+"' cannot be read. Err: "+(b||"[none]"),p);else try{r.load(c,{checkCRC32:!1}),k(null,p)}catch(a){k(a.message,p)}})};core.SimpleClientRect=null;gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}}; gui.SessionConstraints=function(){function g(b){k.hasOwnProperty(b)||(k[b]=!1,c.register(b))}var k={},c=new core.EventNotifier;this.registerConstraint=g;this.subscribe=function(b,f){g(b);c.subscribe(b,f)};this.unsubscribe=function(b,f){c.unsubscribe(b,f)};this.setState=function(b,f){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==f&&(k[b]=f,c.emit(b,f))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}}; gui.BlacklistNamespaceNodeFilter=function(g){var k={},c=NodeFilter.FILTER_REJECT,b=NodeFilter.FILTER_ACCEPT;this.acceptNode=function(f){return!f||k.hasOwnProperty(f.namespaceURI)?c:b};(function(){g.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 g=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,c;for(c in g)g.hasOwnProperty(c)&&(k[g[c]]=c)})();odf.Namespaces.forEachPrefix=function(g){var k=odf.Namespaces.namespaceMap,c;for(c in k)k.hasOwnProperty(c)&&g(c,k[c])}; odf.Namespaces.lookupNamespaceURI=function(g){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(g)&&(k=odf.Namespaces.namespaceMap[g]);return k};odf.Namespaces.lookupPrefix=function(g){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(g)?k[g]:null};odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI; (function(){odf.OdfSchemaImpl=function(){var g=[["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 g.filter(function(c){return"field"=== c[1]}).map(function(c){return c[0]})};(function(){g.forEach(function(c){var b=c[1],f=c[0].split(":");c=f[0];var f=f[1],n=odf.Namespaces.lookupNamespaceURI(c);n?k[n+":"+f]=b:runtime.log("DEBUG: OdfSchema - unknown prefix '"+c+"'")})})()};odf.OdfSchema=new odf.OdfSchemaImpl})(); odf.OdfUtilsImpl=function(){function g(a){return"image"===(a&&a.localName)&&a.namespaceURI===R}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===R&&"as-char"===a.getAttributeNS(J,"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}