a;a++)b[a]=252<=a?6:248<=
+a?5:240<=a?4:224<=a?3:192<=a?2:1;b[254]=b[254]=1;c.string2buf=function(b){var a,g,d,c,h,r=b.length,p=0;for(c=0;cg?1:2048>g?2:65536>g?3:4;a=new f.Buf8(p);for(c=h=0;hg?a[h++]=g:(2048>g?a[h++]=192|g>>>6:(65536>g?a[h++]=224|g>>>12:(a[h++]=
+240|g>>>18,a[h++]=128|g>>>12&63),a[h++]=128|g>>>6&63),a[h++]=128|g&63);return a};c.buf2binstring=function(b){return h(b,b.length)};c.binstring2buf=function(b){for(var a=new f.Buf8(b.length),g=0,d=a.length;gf)q[c++]=f;else if(r=b[f],4f?q[c++]=f:(f-=65536,q[c++]=
+55296|f>>10&1023,q[c++]=56320|f&1023)}return h(q,c)};c.utf8border=function(a,d){var g;d=d||a.length;d>a.length&&(d=a.length);for(g=d-1;0<=g&&128===(a[g]&192);)g--;return 0>g||0===g?d:g+b[a[g]]>d?g:d}},{"./common":2}],4:[function(a,d,c){d.exports=function(a,d,c,f){var l=a&65535|0;a=a>>>16&65535|0;for(var r=0;0!==c;){r=2E3c;c++){a=c;for(var h=0;8>h;h++)a=a&1?3988292384^a>>>1:a>>>1;d[c]=a}return d}();d.exports=function(a,d,c,f){c=f+c;for(a^=
+-1;f>>8^h[(a^d[f])&255];return a^-1}},{}],7:[function(a,d,c){d.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},{}],8:[function(a,d,c){d.exports=function(a,d){var c,f,l,r,b,e,n,g,u,t,y,v,s,x,w,B,I,C,F,J,N,K,H,z;c=a.state;f=a.next_in;H=a.input;l=f+(a.avail_in-5);r=a.next_out;z=a.output;b=r-(d-a.avail_out);e=r+(a.avail_out-257);n=c.dmax;g=c.wsize;u=c.whave;t=c.wnext;y=c.window;v=c.hold;s=c.bits;
+x=c.lencode;w=c.distcode;B=(1<s&&(v+=H[f++]<>>24;v>>>=F;s-=F;F=C>>>16&255;if(0===F)z[r++]=C&65535;else if(F&16){J=C&65535;if(F&=15)s>>=F,s-=F;15>s&&(v+=H[f++]<>>24;v>>>=F;s-=F;F=C>>>16&255;if(F&16){C&=65535;F&=15;sn){a.msg="invalid distance too far back";
+c.mode=30;break a}v>>>=F;s-=F;F=r-b;if(C>F){F=C-F;if(F>u&&c.sane){a.msg="invalid distance too far back";c.mode=30;break a}N=0;K=y;if(0===t){if(N+=g-F,F>3;f-=J;s-=J<<3;a.next_in=f;a.next_out=r;a.avail_in=f>>24&255)+(b>>>8&65280)+((b&65280)<<8)+((b&255)<<24)}function q(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new b.Buf16(320);this.work=
+new b.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function p(a){var g;if(!a||!a.state)return y;g=a.state;a.total_in=a.total_out=g.total=0;a.msg="";g.wrap&&(a.adler=g.wrap&1);g.mode=v;g.last=0;g.havedict=0;g.dmax=32768;g.head=null;g.hold=0;g.bits=0;g.lencode=g.lendyn=new b.Buf32(s);g.distcode=g.distdyn=new b.Buf32(x);g.sane=1;g.back=-1;return t}function m(b){var a;if(!b||!b.state)return y;a=b.state;a.wsize=0;a.whave=0;a.wnext=0;return p(b)}function l(b,a){var g,e;if(!b||
+!b.state)return y;e=b.state;0>a?(g=0,a=-a):(g=(a>>4)+1,48>a&&(a&=15));if(a&&(8>a||15s;){if(0===l)break a;l--;m+=r[H++]<>>8&255;c.check=n(c.check,X,2,0);s=m=0;c.mode=2;break}c.flags=0;c.head&&(c.head.done=!1);if(!(c.wrap&1)||(((m&255)<<8)+(m>>8))%31){a.msg="incorrect header check";c.mode=30;break}if(8!==(m&15)){a.msg="unknown compression method";c.mode=30;break}m>>>=4;s-=4;Q=(m&15)+8;if(0===c.wbits)c.wbits=Q;else if(Q>c.wbits){a.msg="invalid window size";c.mode=30;break}c.dmax=1<s;){if(0===l)break a;l--;m+=r[H++]<>8&1);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=3;case 3:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<>>8&255,X[2]=m>>>16&255,X[3]=m>>>24&255,c.check=n(c.check,X,4,0));s=m=0;c.mode=4;case 4:for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>8);c.flags&512&&(X[0]=m&255,X[1]=m>>>8&255,c.check=n(c.check,X,2,0));s=m=0;c.mode=5;case 5:if(c.flags&1024){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>>8&255,c.check=n(c.check,X,2,0));s=m=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(c.flags&1024&&(D=c.length,D>l&&(D=l),D&&(c.head&&(Q=c.head.extra_len-c.length,c.head.extra||(c.head.extra=Array(c.head.extra_len)),b.arraySet(c.head.extra,
+r,H,D,Q)),c.flags&512&&(c.check=n(c.check,r,D,H)),l-=D,H+=D,c.length-=D),c.length))break a;c.length=0;c.mode=7;case 7:if(c.flags&2048){if(0===l)break a;D=0;do Q=r[H+D++],c.head&&Q&&65536>c.length&&(c.head.name+=String.fromCharCode(Q));while(Q&&Dc.length&&(c.head.comment+=String.fromCharCode(Q));while(Q&&D<
+l);c.flags&512&&(c.check=n(c.check,r,D,H));l-=D;H+=D;if(Q)break a}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(c.flags&512){for(;16>s;){if(0===l)break a;l--;m+=r[H++]<>9&1,c.head.done=!0);a.adler=c.check=0;c.mode=12;break;case 10:for(;32>s;){if(0===l)break a;l--;m+=r[H++]<>>=s&7;s-=s&7;c.mode=27;break}for(;3>s;){if(0===l)break a;l--;m+=r[H++]<>>=1;s-=1;switch(m&3){case 0:c.mode=14;break;case 1:D=c;if(w){Q=void 0;B=new b.Buf32(512);I=new b.Buf32(32);for(Q=0;144>Q;)D.lens[Q++]=8;for(;256>Q;)D.lens[Q++]=9;for(;280>Q;)D.lens[Q++]=7;for(;288>Q;)D.lens[Q++]=8;u(1,D.lens,0,288,B,0,D.work,{bits:9});for(Q=0;32>Q;)D.lens[Q++]=5;u(2,D.lens,
+0,32,I,0,D.work,{bits:5});w=!1}D.lencode=B;D.lenbits=9;D.distcode=I;D.distbits=5;c.mode=20;if(6===d){m>>>=2;s-=2;break a}break;case 2:c.mode=17;break;case 3:a.msg="invalid block type",c.mode=30}m>>>=2;s-=2;break;case 14:m>>>=s&7;for(s-=s&7;32>s;){if(0===l)break a;l--;m+=r[H++]<>>16^65535)){a.msg="invalid stored block lengths";c.mode=30;break}c.length=m&65535;s=m=0;c.mode=15;if(6===d)break a;case 15:c.mode=16;case 16:if(D=c.length){D>l&&(D=l);D>p&&(D=p);if(0===D)break a;b.arraySet(K,
+r,H,D,q);l-=D;H+=D;p-=D;q+=D;c.length-=D;break}c.mode=12;break;case 17:for(;14>s;){if(0===l)break a;l--;m+=r[H++]<>>=5;s-=5;c.ndist=(m&31)+1;m>>>=5;s-=5;c.ncode=(m&15)+4;m>>>=4;s-=4;if(286s;){if(0===l)break a;l--;m+=r[H++]<>>=3;s-=3}for(;19>c.have;)c.lens[R[c.have++]]=0;c.lencode=c.lendyn;c.lenbits=7;
+D={bits:c.lenbits};E=u(0,c.lens,0,19,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid code lengths set";c.mode=30;break}c.have=0;c.mode=19;case 19:for(;c.have>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<ba)m>>>=A,s-=A,c.lens[c.have++]=ba;else{if(16===ba){for(D=A+2;s>>=A;s-=A;if(0===c.have){a.msg="invalid bit length repeat";c.mode=30;break}Q=
+c.lens[c.have-1];D=3+(m&3);m>>>=2;s-=2}else if(17===ba){for(D=A+3;s>>=A;s-=A;Q=0;D=3+(m&7);m>>>=3;s-=3}else{for(D=A+7;s>>=A;s-=A;Q=0;D=11+(m&127);m>>>=7;s-=7}if(c.have+D>c.nlen+c.ndist){a.msg="invalid bit length repeat";c.mode=30;break}for(;D--;)c.lens[c.have++]=Q}}if(30===c.mode)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block";c.mode=30;break}c.lenbits=9;D={bits:c.lenbits};E=u(1,c.lens,
+0,c.nlen,c.lencode,0,c.work,D);c.lenbits=D.bits;if(E){a.msg="invalid literal/lengths set";c.mode=30;break}c.distbits=6;c.distcode=c.distdyn;D={bits:c.distbits};E=u(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,D);c.distbits=D.bits;if(E){a.msg="invalid distances set";c.mode=30;break}c.mode=20;if(6===d)break a;case 20:c.mode=21;case 21:if(6<=l&&258<=p){a.next_out=q;a.avail_out=p;a.next_in=H;a.avail_in=l;c.hold=m;c.bits=s;g(a,P);q=a.next_out;K=a.output;p=a.avail_out;H=a.next_in;r=a.input;l=a.avail_in;
+m=c.hold;s=c.bits;12===c.mode&&(c.back=-1);break}for(c.back=0;;){D=c.lencode[m&(1<>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;c.length=ba;if(0===V){c.mode=26;break}if(V&32){c.back=-1;c.mode=12;break}if(V&64){a.msg="invalid literal/length code";
+c.mode=30;break}c.extra=V&15;c.mode=22;case 22:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}c.was=c.length;c.mode=23;case 23:for(;;){D=c.distcode[m&(1<>>24;V=D>>>16&255;ba=D&65535;if(A<=s)break;if(0===l)break a;l--;m+=r[H++]<>Q)];A=D>>>24;V=D>>>16&255;ba=D&65535;if(Q+A<=s)break;if(0===l)break a;l--;m+=r[H++]<>>=Q;s-=Q;c.back+=Q}m>>>=A;s-=A;c.back+=A;if(V&64){a.msg="invalid distance code";c.mode=30;break}c.offset=ba;c.extra=V&15;c.mode=24;case 24:if(c.extra){for(D=c.extra;s>>=c.extra;s-=c.extra;c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back";c.mode=30;break}c.mode=25;case 25:if(0===p)break a;D=P-p;if(c.offset>D){D=c.offset-D;if(D>c.whave&&c.sane){a.msg="invalid distance too far back";c.mode=30;break}D>
+c.wnext?(D-=c.wnext,Q=c.wsize-D):Q=c.wnext-D;D>c.length&&(D=c.length);$=c.window}else $=K,Q=q-c.offset,D=c.length;D>p&&(D=p);p-=D;c.length-=D;do K[q++]=$[Q++];while(--D);0===c.length&&(c.mode=21);break;case 26:if(0===p)break a;K[q++]=c.length;p--;c.mode=21;break;case 27:if(c.wrap){for(;32>s;){if(0===l)break a;l--;m|=r[H++]<s;){if(0===l)break a;l--;m+=r[H++]<c.mode&&(27>c.mode||4!==d))r=a.output,H=a.next_out,q=P-a.avail_out,p=a.state,null===p.window&&(p.wsize=1<=p.wsize?(b.arraySet(p.window,r,H-p.wsize,p.wsize,0),p.wnext=0,p.whave=p.wsize):(l=p.wsize-p.wnext,l>q&&(l=q),b.arraySet(p.window,r,H-q,l,p.wnext),(q-=l)?(b.arraySet(p.window,r,H-q,q,0),p.wnext=q,p.whave=p.wsize):(p.wnext+=l,p.wnext===p.wsize&&(p.wnext=0),p.whave=s;s++)U[s]=0;for(x=0;xB&&(I=B);if(0===B)return g[u++]=20971520,g[u++]=20971520,y.bits=1,0;for(w=1;w=s;s++)if(J<<=1,J-=U[s],0>J)return-1;if(0s;s++)C[s+1]=C[s]+U[s];for(x=0;xG?(Q=aa[P+t[x]],$=Z[T+t[x]]):(Q=96,$=0);J=1<>F)+H]=D<<24|Q<<16|$|0;while(0!==H);for(J=1<>=1;0!==J?(K&=J-1,K+=J):K=0;x++;if(0===--U[s]){if(s===B)break;s=b[c+t[x]]}if(s>I&&(K&d)!==z){0===F&&(F=I);v+=w;C=s-F;for(J=1<=J)break;C++;J<<=1}N+=1<";b+=k;b+=""+f+">";return runtime.parseXML(b)};
+core.UnitTest.cleanupTestAreaDiv=function(){var f=runtime.getWindow().document,k=f.getElementById("testarea");runtime.assert(!!k&&k.parentNode===f.body,'Test environment broken, found no div with id "testarea" below body.');f.body.removeChild(k)};core.UnitTest.createXmlDocument=function(f,k,a){var d="",d=d+("<"+f);Object.keys(a).forEach(function(c){d+=" xmlns:"+c+'="'+a[c]+'"'});d+=">";d+=k;d+=""+f+">";return runtime.parseXML(d)};
core.UnitTest.createOdtDocument=function(f,k){return core.UnitTest.createXmlDocument("office:document",f,k)};
-core.UnitTestLogger=function(){var f=[],k=0,d=0,b="",c="";this.startTest=function(h,r){f=[];k=0;b=h;c=r;d=Date.now()};this.endTest=function(){var h=Date.now();return{description:c,suite:[b,c],success:0===k,log:f,time:h-d}};this.debug=function(b){f.push({category:"debug",message:b})};this.fail=function(b){k+=1;f.push({category:"fail",message:b})};this.pass=function(b){f.push({category:"pass",message:b})}};
-core.UnitTestRunner=function(f,k){function d(a){p+=1;e?k.debug(a):k.fail(a)}function b(a,b){var e;try{if(a.length!==b.length)return d("array of length "+a.length+" should be "+b.length+" long"),!1;for(e=0;e1/h?"-0":String(h),d(b+" should be "+a+". Was "+e+".")):d(b+" should be "+a+" (of type "+typeof a+"). Was "+
-h+" (of type "+typeof h+").")}var p=0,n,q,e=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){n=p;e=!0};this.endExpectFail=function(){var a=n===p;e=!1;p=n;a&&(p+=1,k.fail("Expected at least one failed test, but none registered."))};q=function(a,e){var c=Object.keys(a),f=Object.keys(e);c.sort();f.sort();return b(c,f)&&Object.keys(a).every(function(b){var c=a[b],g=e[b];return r(c,g)?!0:(d(c+" should be "+g+" for key "+b),!1)})};this.areNodesEqual=h;this.shouldBeNull=function(a,
-b){l(a,b,"null")};this.shouldBeNonNull=function(a,b){var e,c;try{c=eval(b)}catch(f){e=f}e?d(b+" should be non-null. Threw exception "+e):null!==c?k.pass(b+" is non-null."):d(b+" should be non-null. Was "+c)};this.shouldBe=l;this.testFailed=d;this.countFailedTests=function(){return p};this.name=function(a){var b,e,c=[],d=a.length;c.length=d;for(b=0;b"+b+""}function k(b){d.reporter&&d.reporter(b)}var d=this,b=0,c=new core.UnitTestLogger,h={},r="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(b){var c,d;r?runtime.log("Running "+f(b.description,'runTest("'+b.suite[0]+'","'+b.description+'")')+""):runtime.log("Running "+b.description);if(!b.success)for(c=0;cRunning "+f(e,'runSuite("'+e+'");')+": "+m.description()+""):runtime.log("Running "+e+": "+m.description);v=m.tests();for(z=0;z>>8^d;return e^-1}function b(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function c(a){var b=a.getFullYear();return 1980>b?0:b-1980<<
-25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function h(a,e){var c,d,m,f,h,l,q,p=this;this.load=function(b){if(null!==p.data)b(null,p.data);else{var e=h+34+d+m+256;e+q>g&&(e=g-q);runtime.read(a,q,e,function(e,c){if(e||null===c)b(e,c);else a:{var g=c,d=new core.ByteArray(g),m=d.readUInt32LE(),q;if(67324752!==m)b("File entry signature is wrong."+m.toString()+" "+g.length.toString(),null);else{d.pos+=22;m=d.readUInt16LE();q=d.readUInt16LE();d.pos+=m+q;if(f){g=
-g.subarray(d.pos,d.pos+h);if(h!==g.length){b("The amount of compressed bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+p.filename+" in "+a+".",null);break a}g=t(g,l)}else g=g.subarray(d.pos,d.pos+l);l!==g.length?b("The amount of bytes read was "+g.length.toString()+" instead of "+l.toString()+" for "+p.filename+" in "+a+".",null):(p.data=g,b(null,g))}}})}};this.set=function(a,b,e,c){p.filename=a;p.data=b;p.compressed=e;p.date=c};this.error=null;e&&(c=e.readUInt32LE(),33639248!==
-c?this.error="Central directory entry has wrong signature at position "+(e.pos-4).toString()+' for file "'+a+'": '+e.data.length.toString():(e.pos+=6,f=e.readUInt16LE(),this.date=b(e.readUInt32LE()),e.readUInt32LE(),h=e.readUInt32LE(),l=e.readUInt32LE(),d=e.readUInt16LE(),m=e.readUInt16LE(),c=e.readUInt16LE(),e.pos+=8,q=e.readUInt32LE(),this.filename=runtime.byteArrayToString(e.data.subarray(e.pos,e.pos+d),"utf8"),this.data=null,e.pos+=d+m+c))}function r(a,b){if(22!==a.length)b("Central directory length should be 22.",
-v);else{var e=new core.ByteArray(a),c;c=e.readUInt32LE();101010256!==c?b("Central directory signature is wrong: "+c.toString(),v):(c=e.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",v):(c=e.readUInt16LE(),0!==c?b("Zip files with non-zero disk numbers are not supported.",v):(c=e.readUInt16LE(),z=e.readUInt16LE(),c!==z?b("Number of entries is inconsistent.",v):(c=e.readUInt32LE(),e=e.readUInt16LE(),e=g-22-c,runtime.read(f,e,g-e,function(a,e){if(a||null===e)b(a,v);else a:{var c=
-new core.ByteArray(e),g,d;m=[];for(g=0;gg?k("File '"+f+"' cannot be read.",v):runtime.read(f,g-22,22,function(a,b){a||null===k||null===b?k(a,v):
-r(b,k)})})};gui.CommonConstraints={EDIT:{ANNOTATIONS:{ONLY_DELETE_OWN:"onlyDeleteOwn"},REVIEW_MODE:"reviewMode"}};gui.SessionConstraints=function(){function f(b){k.hasOwnProperty(b)||(k[b]=!1,d.register(b))}var k={},d=new core.EventNotifier;this.registerConstraint=f;this.subscribe=function(b,c){f(b);d.subscribe(b,c)};this.unsubscribe=function(b,c){d.unsubscribe(b,c)};this.setState=function(b,c){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");k[b]!==c&&(k[b]=c,d.emit(b,c))};this.getState=function(b){runtime.assert(!0===k.hasOwnProperty(b),"No such constraint");return k[b]}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};odf.Namespaces={namespaceMap:{db:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",dc:"http://purl.org/dc/elements/1.1/",dr3d:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chart:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",form:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",meta:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",number:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",
-office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",text:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},prefixMap:{},dbns:"urn:oasis:names:tc:opendocument:xmlns:database:1.0",
-dcns:"http://purl.org/dc/elements/1.1/",dr3dns:"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0",drawns:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",chartns:"urn:oasis:names:tc:opendocument:xmlns:chart:1.0",fons:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",formns:"urn:oasis:names:tc:opendocument:xmlns:form:1.0",metans:"urn:oasis:names:tc:opendocument:xmlns:meta:1.0",numberns:"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0",officens:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
-presentationns:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",stylens:"urn:oasis:names:tc:opendocument:xmlns:style:1.0",svgns:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",tablens:"urn:oasis:names:tc:opendocument:xmlns:table:1.0",textns:"urn:oasis:names:tc:opendocument:xmlns:text:1.0",xlinkns:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/XML/1998/namespace"};
-(function(){var f=odf.Namespaces.namespaceMap,k=odf.Namespaces.prefixMap,d;for(d in f)f.hasOwnProperty(d)&&(k[f[d]]=d)})();odf.Namespaces.forEachPrefix=function(f){var k=odf.Namespaces.namespaceMap,d;for(d in k)k.hasOwnProperty(d)&&f(d,k[d])};odf.Namespaces.lookupNamespaceURI=function(f){var k=null;odf.Namespaces.namespaceMap.hasOwnProperty(f)&&(k=odf.Namespaces.namespaceMap[f]);return k};odf.Namespaces.lookupPrefix=function(f){var k=odf.Namespaces.prefixMap;return k.hasOwnProperty(f)?k[f]:null};
-odf.Namespaces.lookupNamespaceURI.lookupNamespaceURI=odf.Namespaces.lookupNamespaceURI;xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};
-function createXPathSingleton(){function f(b,e,a){return-1!==b&&(b=d&&a.push(k(b.substring(e,c)))):"["===b[c]&&(0>=d&&(e=c+1),d+=1),c+=1;return c};p=function(d,e,a){var f,g,h,p;for(f=0;f1/b)return"-0";if("object"===typeof b)try{return JSON.stringify(b)}catch(a){}return String(b)}function m(b,c,e,d){"string"===typeof c&&"string"===typeof e||k.debug("WARN: shouldBe() expects string arguments");var f,h;try{h=eval(c)}catch(m){f=m}b=eval(e);f?a(c+" should be "+b+". Threw exception "+f):q(h,b,d)?k.pass(c+" is "+e):String(typeof h)===String(typeof b)?
+a(c+" should be "+p(b)+". Was "+p(h)+"."):a(c+" should be "+b+" (of type "+typeof b+"). Was "+h+" (of type "+typeof h+").")}var l=0,r,b,e=!1;this.resourcePrefix=function(){return f};this.beginExpectFail=function(){r=l;e=!0};this.endExpectFail=function(){var b=r===l;e=!1;l=r;b&&(l+=1,k.fail("Expected at least one failed test, but none registered."))};b=function(b,c){var e=Object.keys(b),f=Object.keys(c);e.sort();f.sort();return d(e,f)&&Object.keys(b).every(function(e){var d=b[e],f=c[e];return q(d,
+f)?!0:(a(d+" should be "+f+" for key "+e),!1)})};this.areNodesEqual=h;this.shouldBeNull=function(b,a){m(b,a,"null")};this.shouldBeNonNull=function(b,c){var e,d;try{d=eval(c)}catch(f){e=f}e?a(c+" should be non-null. Threw exception "+e):null!==d?k.pass(c+" is non-null."):a(c+" should be non-null. Was "+d)};this.shouldBe=m;this.testFailed=a;this.countFailedTests=function(){return l};this.name=function(b){var a,c,e=[],d=b.length;e.length=d;for(a=0;a"+a+""}function k(c){a.reporter&&a.reporter(c)}var a=this,d=0,c=new core.UnitTestLogger,h={},q="BrowserRuntime"===runtime.type();this.resourcePrefix="";this.reporter=function(a){var c,d;q?runtime.log("Running "+f(a.description,'runTest("'+a.suite[0]+'","'+a.description+'")')+""):runtime.log("Running "+a.description);if(!a.success)for(c=0;cRunning "+f(b,'runSuite("'+b+'");')+": "+n.description()+""):runtime.log("Running "+b+": "+n.description);y=n.tests();for(u=0;u>>8^d;return c^-1}function c(b){return new Date((b>>25&127)+1980,(b>>21&15)-1,b>>16&31,b>>11&15,
+b>>5&63,(b&31)<<1)}function h(b){var a=b.getFullYear();return 1980>a?0:a-1980<<25|b.getMonth()+1<<21|b.getDate()<<16|b.getHours()<<11|b.getMinutes()<<5|b.getSeconds()>>1}function q(b,e){var g,d,n,f,h,m,l,r=this;this.load=function(c){if(null!==r.data)c(null,r.data);else{var e=h+34+d+n+256;e+l>t&&(e=t-l);a(l,e,function(a,e){if(a||null===e)c(a,e);else a:{var g=e,d=new core.ByteArray(g),n=d.readUInt32LE(),l;if(67324752!==n)c("File entry signature is wrong."+n.toString()+" "+g.length.toString(),null);
+else{d.pos+=22;n=d.readUInt16LE();l=d.readUInt16LE();d.pos+=n+l;if(f){g=g.subarray(d.pos,d.pos+h);if(h!==g.length){c("The amount of compressed bytes read was "+g.length.toString()+" instead of "+h.toString()+" for "+r.filename+" in "+b+".",null);break a}g=v(g,m)}else g=g.subarray(d.pos,d.pos+m);m!==g.length?c("The amount of bytes read was "+g.length.toString()+" instead of "+m.toString()+" for "+r.filename+" in "+b+".",null):(r.data=g,c(null,g))}}})}};this.set=function(b,a,c,e){r.filename=b;r.data=
+a;r.compressed=c;r.date=e};this.error=null;e&&(g=e.readUInt32LE(),33639248!==g?this.error="Central directory entry has wrong signature at position "+(e.pos-4).toString()+' for file "'+b+'": '+e.data.length.toString():(e.pos+=6,f=e.readUInt16LE(),this.date=c(e.readUInt32LE()),e.readUInt32LE(),h=e.readUInt32LE(),m=e.readUInt32LE(),d=e.readUInt16LE(),n=e.readUInt16LE(),g=e.readUInt16LE(),e.pos+=8,l=e.readUInt32LE(),this.filename=runtime.byteArrayToString(e.data.subarray(e.pos,e.pos+d),"utf8"),this.data=
+null,e.pos+=d+n+g))}function p(b,c){if(22!==b.length)c("Central directory length should be 22.",s);else{var e=new core.ByteArray(b),d;d=e.readUInt32LE();101010256!==d?c("Central directory signature is wrong: "+d.toString(),s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),0!==d?c("Zip files with non-zero disk numbers are not supported.",s):(d=e.readUInt16LE(),y=e.readUInt16LE(),d!==y?c("Number of entries is inconsistent.",s):(d=e.readUInt32LE(),
+e=e.readUInt16LE(),e=t-22-d,a(e,t-e,function(b,a){if(b||null===a)c(b,s);else a:{var e=new core.ByteArray(a),d,n;g=[];for(d=0;db.value||"%"===b.unit)?null:b}function F(b){return(b=I(b))&&"%"!==b.unit?null:b}function J(b){switch(b.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(b.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(b.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(b.localName){case "cursor":case "editinfo":return!1}}return!0}
+function N(b,a){for(;0=a.value||"%"===a.unit)?null:a;return a||F(b)};this.parseFoLineHeight=
+function(b){return C(b)||F(b)};this.isTextContentContainingNode=J;this.getTextNodes=function(b,a){var c;c=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT;b.nodeType===Node.TEXT_NODE?Boolean(h(b)&&(!p(b.textContent)||B(b,0)))&&(a=NodeFilter.FILTER_ACCEPT):J(b)&&(a=NodeFilter.FILTER_SKIP);return a},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);a||N(b,c);return c};this.getTextElements=K;this.getParagraphElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_REJECT;
+if(c(b))a=NodeFilter.FILTER_ACCEPT;else if(J(b)||m(b))a=NodeFilter.FILTER_SKIP;return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,c);return a};this.getImageElements=function(b){var a;a=U.getNodesInRange(b,function(b){var a=NodeFilter.FILTER_SKIP;f(b)&&(a=NodeFilter.FILTER_ACCEPT);return a},NodeFilter.SHOW_ELEMENT);H(b.startContainer,a,f);return a};this.getHyperlinkElements=function(b){var a=[],e=b.cloneRange();b.collapsed&&b.endContainer.nodeType===Node.ELEMENT_NODE&&(b=z(b.endContainer,b.endOffset),
+b.nodeType===Node.TEXT_NODE&&e.setEnd(b,1));K(e,!0,!1).forEach(function(b){for(b=b.parentNode;!c(b);){if(d(b)&&-1===a.indexOf(b)){a.push(b);break}b=b.parentNode}});e.detach();return a};this.getNormalizedFontFamilyName=function(b){/^(["'])(?:.|[\n\r])*?\1$/.test(b)||(b=b.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(b)&&(b="'"+b.replace(/[ \t\r\n\f]+/g," ")+"'"));return b}};odf.OdfUtils=new odf.OdfUtilsImpl;gui.OdfTextBodyNodeFilter=function(){var f=odf.OdfUtils,k=Node.TEXT_NODE,a=NodeFilter.FILTER_REJECT,d=NodeFilter.FILTER_ACCEPT,c=odf.Namespaces.textns;this.acceptNode=function(h){if(h.nodeType===k){if(!f.isGroupingElement(h.parentNode))return a}else if(h.namespaceURI===c&&"tracked-changes"===h.localName)return a;return d}};xmldom.LSSerializerFilter=function(){};xmldom.LSSerializerFilter.prototype.acceptNode=function(f){};odf.OdfNodeFilter=function(){this.acceptNode=function(f){return"http://www.w3.org/1999/xhtml"===f.namespaceURI?NodeFilter.FILTER_SKIP:f.namespaceURI&&f.namespaceURI.match(/^urn:webodf:/)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}};xmldom.XPathIterator=function(){};xmldom.XPathIterator.prototype.next=function(){};xmldom.XPathIterator.prototype.reset=function(){};
+function createXPathSingleton(){function f(a,b,c){return-1!==a&&(a=f&&c.push(k(a.substring(b,d)))):"["===a[d]&&(0>=f&&(b=d+1),f+=1),d+=1;return d};m=function(a,b,e){var f,g,h,m;for(f=0;f/g,">").replace(/'/g,"'").replace(/"/g,""")}function d(c,f){var r="",l=b.filter?b.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,p;if(l===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){c.push();p=c.getQName(f);var n,q=f.attributes,e,a,m,g="",z;n="<"+p;e=q.length;for(a=0;a")}if(l===NodeFilter.FILTER_ACCEPT||l===NodeFilter.FILTER_SKIP){for(l=f.firstChild;l;)r+=d(c,l),l=l.nextSibling;f.nodeValue&&(r+=k(f.nodeValue))}p&&(r+=""+
-p+">",c.pop());return r}var b=this;this.filter=null;this.writeToString=function(b,h){if(!b)return"";var k=new f(h);return d(k,b)}};(function(){function f(b){var e,a=l.length;for(e=0;ea)break;d=d.nextSibling}b.insertBefore(e,d)}}}var c=new odf.StyleInfo,h=new core.DomUtils,r=odf.Namespaces.stylens,l="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),
-p=Date.now()+"_webodf_",n=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,e,a,c){var d=this;this.size=0;this.type=null;this.name=b;this.container=a;this.url=null;this.mimetype=e;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=e,c.loadAsDataURL(b,e,function(a,b){a&&runtime.log(a);d.url=b;if(d.onchange)d.onchange(d);if(d.onstatereadychange)d.onstatereadychange(d)}))}};odf.OdfPart.prototype.load=function(){};
-odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+n.toBase64(this.data):null};odf.OdfContainer=function e(a,f){function g(a){for(var b=a.firstChild,e;b;)e=b.nextSibling,b.nodeType===Node.ELEMENT_NODE?g(b):b.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&a.removeChild(b),b=e}function l(a){var b={},e,c,d=a.ownerDocument.createNodeIterator(a,NodeFilter.SHOW_ELEMENT,null,!1);for(a=d.nextNode();a;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&("annotation"===
-a.localName?(e=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(b.hasOwnProperty(e)?runtime.log("Warning: annotation name used more than once with : '"+e+"'"):b[e]=a):"annotation-end"===a.localName&&((e=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?b.hasOwnProperty(e)?(c=b[e],c.annotationEndElement?runtime.log("Warning: annotation name used more than once with : '"+e+"'"):c.annotationEndElement=
-a):runtime.log("Warning: annotation end without an annotation start, name: '"+e+"'"):runtime.log("Warning: annotation end without a name found"))),a=d.nextNode()}function t(a,b){for(var e=a&&a.firstChild;e;)e.nodeType===Node.ELEMENT_NODE&&e.setAttributeNS("urn:webodf:names:scope","scope",b),e=e.nextSibling}function v(a,b){for(var e=J.rootElement.meta,e=e&&e.firstChild;e&&(e.namespaceURI!==a||e.localName!==b);)e=e.nextSibling;for(e=e&&e.firstChild;e&&e.nodeType!==Node.TEXT_NODE;)e=e.nextSibling;return e?
-e.data:null}function y(a){var b={},e;for(a=a.firstChild;a;)a.nodeType===Node.ELEMENT_NODE&&a.namespaceURI===r&&"font-face"===a.localName&&(e=a.getAttributeNS(r,"name"),b[e]=a),a=a.nextSibling;return b}function s(a,b){var e=null,c,d,g;if(a)for(e=a.cloneNode(!0),c=e.firstElementChild;c;)d=c.nextElementSibling,(g=c.getAttributeNS("urn:webodf:names:scope","scope"))&&g!==b&&e.removeChild(c),c=d;return e}function x(a,b){var e,d,g,f=null,m={};if(a)for(b.forEach(function(a){c.collectUsedFontFaces(m,a)}),
-f=a.cloneNode(!0),e=f.firstElementChild;e;)d=e.nextElementSibling,g=e.getAttributeNS(r,"name"),m[g]||f.removeChild(e),e=d;return f}function w(a){var b=J.rootElement.ownerDocument,e;if(a){g(a.documentElement);try{e=b.importNode(a.documentElement,!0)}catch(c){}}return e}function A(a){J.state=a;if(J.onchange)J.onchange(J);if(J.onstatereadychange)J.onstatereadychange(J)}function G(a){aa=null;J.rootElement=a;a.fontFaceDecls=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");
-a.styles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");a.automaticStyles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");a.masterStyles=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");a.body=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");a.meta=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");a.settings=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
-"settings");a.scripts=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");l(a)}function E(a){var d=w(a),g=J.rootElement,f;d&&"document-styles"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(g.fontFaceDecls=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),b(g,g.fontFaceDecls),f=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",
-"styles"),b(g,g.styles),f=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),t(g.automaticStyles,"document-styles"),b(g,g.automaticStyles),d=h.getDirectChild(d,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=d||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),b(g,g.masterStyles),
-c.prefixStyleNames(g.automaticStyles,p,g.masterStyles)):A(e.INVALID)}function F(a){a=w(a);var d,g,f,m;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){d=J.rootElement;f=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(d.fontFaceDecls&&f){m=d.fontFaceDecls;var l,p,k,n,E={};g=y(m);n=y(f);for(f=f.firstElementChild;f;){l=f.nextElementSibling;if(f.namespaceURI===r&&"font-face"===f.localName)if(p=f.getAttributeNS(r,
-"name"),g.hasOwnProperty(p)){if(!f.isEqualNode(g[p])){k=p;for(var s=g,z=n,U=0,F=void 0,F=k=k.replace(/\d+$/,"");s.hasOwnProperty(F)||z.hasOwnProperty(F);)U+=1,F=k+U;k=F;f.setAttributeNS(r,"style:name",k);m.appendChild(f);g[k]=f;delete n[p];E[p]=k}}else m.appendChild(f),g[p]=f,delete n[p];f=l}m=E}else f&&(d.fontFaceDecls=f,b(d,f));g=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");t(g,"document-content");m&&c.changeFontFaceNames(g,m);if(d.automaticStyles&&g)for(m=
-g.firstChild;m;)d.automaticStyles.appendChild(m),m=g.firstChild;else g&&(d.automaticStyles=g,b(d,g));a=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw" tag is mising.";d.body=a;b(d,d.body)}else A(e.INVALID)}function H(a){a=w(a);var e;a&&"document-meta"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(e=J.rootElement,e.meta=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),
-b(e,e.meta))}function N(a){a=w(a);var e;a&&"document-settings"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI&&(e=J.rootElement,e.settings=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),b(e,e.settings))}function I(a){a=w(a);var b;if(a&&"manifest"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===a.namespaceURI)for(b=J.rootElement,b.manifest=a,a=b.manifest.firstElementChild;a;)"file-entry"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===
-a.namespaceURI&&(V[a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=a.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),a=a.nextElementSibling}function U(a,b,e){a=h.getElementsByTagName(a,b);var c;for(c=0;c'}function Y(){var a=new xmldom.LSSerializer,b=u("document-meta");a.filter=new odf.OdfNodeFilter;b+=a.writeToString(J.rootElement.meta,odf.Namespaces.namespaceMap);return b+""}function $(a,b){var e=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");e.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",a);e.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
-"manifest:media-type",b);return e}function ea(){var a=runtime.parseXML(''),b=a.documentElement,e=new xmldom.LSSerializer,c;for(c in V)V.hasOwnProperty(c)&&b.appendChild($(c,V[c]));e.filter=new odf.OdfNodeFilter;return'\n'+e.writeToString(a,odf.Namespaces.namespaceMap)}function D(){var a,b,e,d=odf.Namespaces.namespaceMap,
-g=new xmldom.LSSerializer,f=u("document-styles");b=s(J.rootElement.automaticStyles,"document-styles");e=J.rootElement.masterStyles.cloneNode(!0);a=x(J.rootElement.fontFaceDecls,[e,J.rootElement.styles,b]);c.removePrefixFromStyleNames(b,p,e);g.filter=new k(e,b);f+=g.writeToString(a,d);f+=g.writeToString(J.rootElement.styles,d);f+=g.writeToString(b,d);f+=g.writeToString(e,d);return f+""}function P(){var a,b,e=odf.Namespaces.namespaceMap,c=new xmldom.LSSerializer,g=u("document-content");
-b=s(J.rootElement.automaticStyles,"document-content");a=x(J.rootElement.fontFaceDecls,[b]);c.filter=new d(J.rootElement.body,b);g+=c.writeToString(a,e);g+=c.writeToString(b,e);g+=c.writeToString(J.rootElement.body,e);return g+""}function X(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else if(c){B(c);Z(c.documentElement);var d=w(c);d&&"document"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(G(d),A(e.DONE)):A(e.INVALID)}else b("No DOM was loaded.")})}
-function C(a,e){var c;c=J.rootElement;var d=c.meta;d||(c.meta=d=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),b(c,d));c=d;a&&h.mapKeyValObjOntoNode(c,a,odf.Namespaces.lookupNamespaceURI);e&&h.removeKeyElementsFromNode(c,e,odf.Namespaces.lookupNamespaceURI)}function T(a){function b(a,e){var c;e||(e=a);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",e);g[a]=c;g.appendChild(c)}var c=new core.Zip("",null),d=runtime.byteArrayFromString("application/vnd.oasis.opendocument."+
-a,"utf8"),g=J.rootElement,f=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);c.save("mimetype",d,!1,new Date);b("meta");b("settings");b("scripts");b("fontFaceDecls","font-face-decls");b("styles");b("automaticStyles","automatic-styles");b("masterStyles","master-styles");b("body");g.body.appendChild(f);V["/"]="application/vnd.oasis.opendocument."+a;V["settings.xml"]="text/xml";V["meta.xml"]="text/xml";V["styles.xml"]="text/xml";V["content.xml"]="text/xml";A(e.DONE);return c}
-function L(){var a,b=new Date,e="";J.rootElement.settings&&J.rootElement.settings.firstElementChild&&(a=new xmldom.LSSerializer,e=u("document-settings"),a.filter=new odf.OdfNodeFilter,e+=a.writeToString(J.rootElement.settings,odf.Namespaces.namespaceMap),e+="");(a=e)?(a=runtime.byteArrayFromString(a,"utf8"),O.save("settings.xml",a,!0,b)):O.remove("settings.xml");e=runtime.getWindow();a="WebODF/"+webodf.Version;e&&(a=a+" "+e.navigator.userAgent);C({"meta:generator":a},null);
-a=runtime.byteArrayFromString(Y(),"utf8");O.save("meta.xml",a,!0,b);a=runtime.byteArrayFromString(D(),"utf8");O.save("styles.xml",a,!0,b);a=runtime.byteArrayFromString(P(),"utf8");O.save("content.xml",a,!0,b);a=runtime.byteArrayFromString(ea(),"utf8");O.save("META-INF/manifest.xml",a,!0,b)}function S(a,b){L();O.writeAs(a,function(a){b(a)})}var J=this,O,V={},aa,ba="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=v;this.setRootElement=G;this.getContentElement=function(){var a;
-aa||(a=J.rootElement.body,aa=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!aa)throw"Could not find content element in .";return aa};this.getDocumentType=function(){var a=J.getContentElement();return a&&a.localName};this.getPart=function(a){return new odf.OdfPart(a,V[a],J,O)};this.getPartData=
-function(a,b){O.load(a,b)};this.setMetadata=C;this.incrementEditingCycles=function(){var a=v(odf.Namespaces.metans,"editing-cycles"),a=a?parseInt(a,10):0;isNaN(a)&&(a=0);C({"meta:editing-cycles":a+1},null);return a+1};this.createByteArray=function(a,b){L();O.createByteArray(a,b)};this.saveAs=S;this.save=function(a){S(ba,a)};this.getUrl=function(){return ba};this.setBlob=function(a,b,e){e=n.convertBase64ToByteArray(e);O.save(a,e,!1,new Date);V.hasOwnProperty(a)&&runtime.log(a+" has been overwritten.");
-V[a]=b};this.removeBlob=function(a){var b=O.remove(a);runtime.assert(b,"file is not found: "+a);delete V[a]};this.state=e.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),e;a=new a.Type;for(e in a)a.hasOwnProperty(e)&&(b[e]=a[e]);return b}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});a===odf.OdfContainer.DocumentType.TEXT?O=T("text"):a===odf.OdfContainer.DocumentType.PRESENTATION?
-O=T("presentation"):a===odf.OdfContainer.DocumentType.SPREADSHEET?O=T("spreadsheet"):(ba=a,O=new core.Zip(ba,function(a,b){O=b;a?X(ba,function(b){a&&(O.error=a+"\n"+b,A(e.INVALID))}):Q([{path:"styles.xml",handler:E},{path:"content.xml",handler:F},{path:"meta.xml",handler:H},{path:"settings.xml",handler:N},{path:"META-INF/manifest.xml",handler:I}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=
-5;odf.OdfContainer.getContainer=function(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,PRESENTATION:2,SPREADSHEET:3};odf.OdfUtils=function(){function f(a){return"image"===(a&&a.localName)&&a.namespaceURI===Z}function k(a){return null!==a&&a.nodeType===Node.ELEMENT_NODE&&"frame"===a.localName&&a.namespaceURI===Z&&"as-char"===a.getAttributeNS(B,"anchor-type")}function d(a){var b;(b="annotation"===(a&&a.localName)&&a.namespaceURI===odf.Namespaces.officens)||(b="div"===(a&&a.localName)&&"annotationWrapper"===a.className);return b}function b(a){return"a"===(a&&a.localName)&&a.namespaceURI===B}function c(a){var b=a&&
-a.localName;return("p"===b||"h"===b)&&a.namespaceURI===B}function h(a,b){for(a&&void 0!==b&&!c(a)&&a.childNodes.item(b)&&(a=a.childNodes.item(b));a&&!c(a);)a=a.parentNode;return a}function r(a,b){for(;a&&a!==b;){if(a.namespaceURI===odf.Namespaces.officens&&"annotation"===a.localName)return a;a=a.parentNode}return null}function l(a){return/^[ \t\r\n]+$/.test(a)}function p(a){if(null===a||a.nodeType!==Node.ELEMENT_NODE)return!1;var b=a.localName;return/^(span|p|h|a|meta)$/.test(b)&&a.namespaceURI===
-B||"span"===b&&"webodf-annotationHighlight"===a.className}function n(a){var b=a&&a.localName,e=!1;b&&(a=a.namespaceURI,a===B&&(e="s"===b||"tab"===b||"line-break"===b));return e}function q(a){return n(a)||k(a)||d(a)}function e(a){var b=a&&a.localName,e=!1;b&&(a=a.namespaceURI,a===B&&(e="s"===b));return e}function a(a){return-1!==Y.indexOf(a.namespaceURI)}function m(b){if(n(b))return!1;if(p(b.parentNode)&&b.nodeType===Node.TEXT_NODE)return 0===b.textContent.length;for(b=b.firstChild;b;){if(a(b)||!m(b))return!1;
-b=b.nextSibling}return!0}function g(a){for(;null!==a.firstChild&&p(a);)a=a.firstChild;return a}function z(a){for(;null!==a.lastChild&&p(a);)a=a.lastChild;return a}function t(a){for(;!c(a)&&null===a.previousSibling;)a=a.parentNode;return c(a)?null:z(a.previousSibling)}function v(a){for(;!c(a)&&null===a.nextSibling;)a=a.parentNode;return c(a)?null:g(a.nextSibling)}function y(a){for(var b=!1;a;)if(a.nodeType===Node.TEXT_NODE)if(0===a.length)a=t(a);else return!l(a.data.substr(a.length-1,1));else q(a)?
-(b=!1===e(a),a=null):a=t(a);return b}function s(a){var b=!1,e;for(a=a&&g(a);a;){e=a.nodeType===Node.TEXT_NODE?a.length:0;if(0a.value||"%"===a.unit)?null:a}function E(a){return(a=A(a))&&"%"!==a.unit?null:a}function F(a){switch(a.namespaceURI){case odf.Namespaces.drawns:case odf.Namespaces.svgns:case odf.Namespaces.dr3dns:return!1;case odf.Namespaces.textns:switch(a.localName){case "note-body":case "ruby-text":return!1}break;case odf.Namespaces.officens:switch(a.localName){case "annotation":case "binary-data":case "event-listeners":return!1}break;default:switch(a.localName){case "cursor":case "editinfo":return!1}}return!0}
-function H(a,b){for(;0=b.value||"%"===b.unit)?null:b;return b||E(a)};this.parseFoLineHeight=function(a){return G(a)||E(a)};this.isTextContentContainingNode=F;this.getTextNodes=function(a,b){var e;e=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;a.nodeType===Node.TEXT_NODE?Boolean(h(a)&&(!l(a.textContent)||w(a,0)))&&(b=NodeFilter.FILTER_ACCEPT):F(a)&&(b=NodeFilter.FILTER_SKIP);return b},NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);b||H(a,e);return e};this.getTextElements=N;this.getParagraphElements=
-function(a){var b;b=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_REJECT;if(c(a))b=NodeFilter.FILTER_ACCEPT;else if(F(a)||p(a))b=NodeFilter.FILTER_SKIP;return b},NodeFilter.SHOW_ELEMENT);I(a.startContainer,b,c);return b};this.getImageElements=function(a){var b;b=u.getNodesInRange(a,function(a){var b=NodeFilter.FILTER_SKIP;f(a)&&(b=NodeFilter.FILTER_ACCEPT);return b},NodeFilter.SHOW_ELEMENT);I(a.startContainer,b,f);return b};this.getHyperlinkElements=function(a){var e=[],d=a.cloneRange();
-a.collapsed&&a.endContainer.nodeType===Node.ELEMENT_NODE&&(a=U(a.endContainer,a.endOffset),a.nodeType===Node.TEXT_NODE&&d.setEnd(a,1));N(d,!0,!1).forEach(function(a){for(a=a.parentNode;!c(a);){if(b(a)&&-1===e.indexOf(a)){e.push(a);break}a=a.parentNode}});d.detach();return e};this.getNormalizedFontFamilyName=function(a){/^(["'])(?:.|[\n\r])*?\1$/.test(a)||(a=a.replace(/^[ \t\r\n\f]*((?:.|[\n\r])*?)[ \t\r\n\f]*$/,"$1"),/[ \t\r\n\f]/.test(a)&&(a="'"+a.replace(/[ \t\r\n\f]+/g," ")+"'"));return a}};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){};
-gui.AnnotationViewManager=function(f,k,d,b){function c(b){var e=b.annotationEndElement,c=n.createRange(),d=b.getAttributeNS(odf.Namespaces.officens,"name");e&&(c.setStart(b,b.childNodes.length),c.setEnd(e,0),b=q.getTextNodes(c,!1),b.forEach(function(b){var e;a:{for(e=b.parentNode;e.namespaceURI!==odf.Namespaces.officens||"body"!==e.localName;){if(e.namespaceURI===a&&"webodf-annotationHighlight"===e.className&&e.getAttribute("annotation")===d){e=!0;break a}e=e.parentNode}e=!1}e||(e=n.createElement("span"),
-e.className="webodf-annotationHighlight",e.setAttribute("annotation",d),b.parentNode.replaceChild(e,b),e.appendChild(b))}));c.detach()}function h(a){var b=f.getSizer();a?(d.style.display="inline-block",b.style.paddingRight=e.getComputedStyle(d).width):(d.style.display="none",b.style.paddingRight=0);f.refreshSize()}function r(){p.sort(function(a,b){return 0!==(a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function l(){var a;for(a=0;a=(l.getBoundingClientRect().top-k.bottom)/b?e.style.top=Math.abs(l.getBoundingClientRect().top-k.bottom)/b+20+"px":e.style.top="0px");h.style.left=c.getBoundingClientRect().width/
-b+"px";var c=h.style,l=h.getBoundingClientRect().left/b,q=h.getBoundingClientRect().top/b,k=e.getBoundingClientRect().left/b,n=e.getBoundingClientRect().top/b,r=0,G=0,r=k-l,r=r*r,G=n-q,G=G*G,l=Math.sqrt(r+G);c.width=l+"px";q=Math.asin((e.getBoundingClientRect().top-h.getBoundingClientRect().top)/(b*parseFloat(h.style.width)));h.style.transform="rotate("+q+"rad)";h.style.MozTransform="rotate("+q+"rad)";h.style.WebkitTransform="rotate("+q+"rad)";h.style.msTransform="rotate("+q+"rad)"}}var p=[],n=k.ownerDocument,
-q=new odf.OdfUtils,e=runtime.getWindow(),a="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(e),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=l;this.rehighlightAnnotations=function(){p.forEach(function(a){c(a)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==d.style.display&&0 text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+s+" 0;",x+="}",f(b,x));for(;k.counterIdStack.length>=r;)k.counterIdStack.pop();k.counterIdStack.push(s);w=k.contentRules[r.toString()]||"";for(x=1;x<=r;x+=1)w=w.replace(x+"webodf-listLevel",k.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+q+'"] > text|list-item > :not(text|list):first-child:before';
-x+="{";x+=w;x+="counter-increment: "+s+";";x+="}";f(b,x)}for(d=d.firstElementChild;d;)c(a,d,l,k),d=d.nextElementSibling}else k.continuedCounterIdStack=[]}var d=0,e="",a={};this.createCounterRules=function(b,e,f){var h=e.getAttributeNS(r,"id"),l=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),l=a[f].slice(0));b=new k(b,l);h?h="Y"+h:(d+=1,h="X"+d);c(h,e,0,b);a[h+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var a;a="office|document{"+("counter-reset: "+e+
-";");a+="}";f(b,a)}}var b=odf.Namespaces.fons,c=odf.Namespaces.stylens,h=odf.Namespaces.textns,r=odf.Namespaces.xmlns,l={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function p(b){var e=m.parseLength(b);return e?a.convert(e.value,e.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function k(a){return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function q(a,b){var e;a&&(e=a.getAttributeNS(h,"style-name"));return e===b}function e(a,
-b,e){b=b.getElementsByTagNameNS(h,"list");a=new d(a);var f,m,p,x,w,A,G={},E;for(E=0;E text|list-item > text|list",z-=1;z=t&&t.getAttributeNS(b,"text-align")||"left";switch(z){case "end":z="right";break;case "start":z="left"}"label-alignment"===N?(U=I&&I.getAttributeNS(b,"margin-left")||"0px",Q=I&&I.getAttributeNS(b,"text-indent")||"0px",u=I&&I.getAttributeNS(h,"label-followed-by"),I=p(U)):(U=t&&t.getAttributeNS(h,"space-before")||"0px",B=t&&t.getAttributeNS(h,"min-label-width")||"0px",
-Z=t&&t.getAttributeNS(h,"min-label-distance")||"0px",I=p(U)+p(B));t=q+" > text|list-item";t+="{";t+="margin-left: "+I+"px;";t+="}";f(m,t);t=q+" > text|list-item > text|list";t+="{";t+="margin-left: "+-I+"px;";t+="}";f(m,t);t=q+" > text|list-item > :not(text|list):first-child:before";t+="{";t+="text-align: "+z+";";t+="display: inline-block;";"label-alignment"===N?(t+="margin-left: "+Q+";","listtab"===u&&(t+="padding-right: 0.2cm;")):(t+="min-width: "+B+";",t+="margin-left: "+(0===parseFloat(B)?"":
-"-")+B+";",t+="padding-right: "+Z+";");t+="}";f(m,t)}d=d.nextElementSibling}});e(a,m,l)}}})();odf.Style2CSS=function(){function f(a,b,e){var c=[];e=e.derivedStyles;var d;var g=t[a],h;void 0===g?b=null:(h=b?"["+g+'|style-name="'+b+'"]':"","presentation"===g&&(g="draw",h=b?'[presentation|style-name="'+b+'"]':""),b=g+"|"+v[a].join(h+","+g+"|")+h);null!==b&&c.push(b);for(d in e)e.hasOwnProperty(d)&&(b=f(a,d,e[d]),c=c.concat(b));return c}function k(a,b){var e="",c,d,g;for(c=0;ch.value&&(g="0.75pt"+m)}d[2]&&(e+=d[2]+":"+g+";")}return e}function d(a){return(a=z.getDirectChild(a,q,"text-properties"))?B.parseFoFontSize(a.getAttributeNS(p,"font-size")):null}function b(a,b,e,c){return b+b+e+e+c+c}function c(a,b){var e=[a],d=b.derivedStyles;Object.keys(d).forEach(function(a){a=c(a,d[a]);e=e.concat(a)});return e}function h(a,b,e,d){function f(b,e){var c=[],d;b.forEach(function(a){h.forEach(function(b){c.push("draw|page[webodfhelper|page-style-name='"+
-b+"'] draw|frame[presentation|class='"+a+"']")})});0/g,">").replace(/'/g,"'").replace(/"/g,""")}function a(c,f){var q="",p=d.filter?d.filter.acceptNode(f):NodeFilter.FILTER_ACCEPT,m;if(p===NodeFilter.FILTER_ACCEPT&&f.nodeType===Node.ELEMENT_NODE){c.push();m=c.getQName(f);var l,r=f.attributes,b,e,n,g="",u;l="<"+m;b=r.length;for(e=0;e")}if(p===NodeFilter.FILTER_ACCEPT||p===NodeFilter.FILTER_SKIP){for(p=f.firstChild;p;)q+=a(c,p),p=p.nextSibling;f.nodeValue&&(q+=k(f.nodeValue))}m&&(q+=""+
+m+">",c.pop());return q}var d=this;this.filter=null;this.writeToString=function(c,d){if(!c)return"";var q=new f(d);return a(q,c)}};(function(){function f(a){var b,c=p.length;for(b=0;bc)break;g=g.nextSibling}a.insertBefore(b,g)}}}var c=new odf.StyleInfo,h=core.DomUtils,q=odf.Namespaces.stylens,p="meta settings scripts font-face-decls styles automatic-styles master-styles body".split(" "),
+m=Date.now()+"_webodf_",l=new core.Base64;odf.ODFElement=function(){};odf.ODFDocumentElement=function(){};odf.ODFDocumentElement.prototype=new odf.ODFElement;odf.ODFDocumentElement.prototype.constructor=odf.ODFDocumentElement;odf.ODFDocumentElement.prototype.fontFaceDecls=null;odf.ODFDocumentElement.prototype.manifest=null;odf.ODFDocumentElement.prototype.settings=null;odf.ODFDocumentElement.namespaceURI="urn:oasis:names:tc:opendocument:xmlns:office:1.0";odf.ODFDocumentElement.localName="document";
+odf.AnnotationElement=function(){};odf.OdfPart=function(a,b,c,d){var g=this;this.size=0;this.type=null;this.name=a;this.container=c;this.url=null;this.mimetype=b;this.onstatereadychange=this.document=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.data="";this.load=function(){null!==d&&(this.mimetype=b,d.loadAsDataURL(a,b,function(b,a){b&&runtime.log(b);g.url=a;if(g.onchange)g.onchange(g);if(g.onstatereadychange)g.onstatereadychange(g)}))}};odf.OdfPart.prototype.load=function(){};
+odf.OdfPart.prototype.getUrl=function(){return this.data?"data:;base64,"+l.toBase64(this.data):null};odf.OdfContainer=function b(e,f){function g(b){for(var a=b.firstChild,c;a;)c=a.nextSibling,a.nodeType===Node.ELEMENT_NODE?g(a):a.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&b.removeChild(a),a=c}function p(b){var a={},c,e,d=b.ownerDocument.createNodeIterator(b,NodeFilter.SHOW_ELEMENT,null,!1);for(b=d.nextNode();b;)"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&("annotation"===
+b.localName?(c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))&&(a.hasOwnProperty(c)?runtime.log("Warning: annotation name used more than once with : '"+c+"'"):a[c]=b):"annotation-end"===b.localName&&((c=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","name"))?a.hasOwnProperty(c)?(e=a[c],e.annotationEndElement?runtime.log("Warning: annotation name used more than once with : '"+c+"'"):e.annotationEndElement=
+b):runtime.log("Warning: annotation end without an annotation start, name: '"+c+"'"):runtime.log("Warning: annotation end without a name found"))),b=d.nextNode()}function t(b,a){for(var c=b&&b.firstChild;c;)c.nodeType===Node.ELEMENT_NODE&&c.setAttributeNS("urn:webodf:names:scope","scope",a),c=c.nextSibling}function y(b,a){for(var c=E.rootElement.meta,c=c&&c.firstChild;c&&(c.namespaceURI!==b||c.localName!==a);)c=c.nextSibling;for(c=c&&c.firstChild;c&&c.nodeType!==Node.TEXT_NODE;)c=c.nextSibling;return c?
+c.data:null}function v(b){var a={},c;for(b=b.firstChild;b;)b.nodeType===Node.ELEMENT_NODE&&b.namespaceURI===q&&"font-face"===b.localName&&(c=b.getAttributeNS(q,"name"),a[c]=b),b=b.nextSibling;return a}function s(b,a){var c=null,e,d,g;if(b)for(c=b.cloneNode(!0),e=c.firstElementChild;e;)d=e.nextElementSibling,(g=e.getAttributeNS("urn:webodf:names:scope","scope"))&&g!==a&&c.removeChild(e),e=d;return c}function x(b,a){var e,d,g,f=null,n={};if(b)for(a.forEach(function(b){c.collectUsedFontFaces(n,b)}),
+f=b.cloneNode(!0),e=f.firstElementChild;e;)d=e.nextElementSibling,g=e.getAttributeNS(q,"name"),n[g]||f.removeChild(e),e=d;return f}function w(b){var a=E.rootElement.ownerDocument,c;if(b){g(b.documentElement);try{c=a.importNode(b.documentElement,!0)}catch(e){}}return c}function B(b){E.state=b;if(E.onchange)E.onchange(E);if(E.onstatereadychange)E.onstatereadychange(E)}function I(b){da=null;E.rootElement=b;b.fontFaceDecls=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");
+b.styles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles");b.automaticStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");b.masterStyles=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles");b.body=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");b.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta");b.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0",
+"settings");b.scripts=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","scripts");p(b)}function C(a){var e=w(a),g=E.rootElement,f;e&&"document-styles"===e.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===e.namespaceURI?(g.fontFaceDecls=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls"),d(g,g.fontFaceDecls),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","styles"),g.styles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",
+"styles"),d(g,g.styles),f=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),g.automaticStyles=f||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles"),t(g.automaticStyles,"document-styles"),d(g,g.automaticStyles),e=h.getDirectChild(e,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),g.masterStyles=e||a.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","master-styles"),d(g,g.masterStyles),
+c.prefixStyleNames(g.automaticStyles,m,g.masterStyles)):B(b.INVALID)}function F(a){a=w(a);var e,g,f,n;if(a&&"document-content"===a.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===a.namespaceURI){e=E.rootElement;f=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","font-face-decls");if(e.fontFaceDecls&&f){n=e.fontFaceDecls;var m,l,p,k,H={};g=v(n);k=v(f);for(f=f.firstElementChild;f;){m=f.nextElementSibling;if(f.namespaceURI===q&&"font-face"===f.localName)if(l=f.getAttributeNS(q,
+"name"),g.hasOwnProperty(l)){if(!f.isEqualNode(g[l])){p=l;for(var K=g,s=k,u=0,z=void 0,z=p=p.replace(/\d+$/,"");K.hasOwnProperty(z)||s.hasOwnProperty(z);)u+=1,z=p+u;p=z;f.setAttributeNS(q,"style:name",p);n.appendChild(f);g[p]=f;delete k[l];H[l]=p}}else n.appendChild(f),g[l]=f,delete k[l];f=m}n=H}else f&&(e.fontFaceDecls=f,d(e,f));g=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","automatic-styles");t(g,"document-content");n&&c.changeFontFaceNames(g,n);if(e.automaticStyles&&g)for(n=
+g.firstChild;n;)e.automaticStyles.appendChild(n),n=g.firstChild;else g&&(e.automaticStyles=g,d(e,g));a=h.getDirectChild(a,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","body");if(null===a)throw" tag is mising.";e.body=a;d(e,e.body)}else B(b.INVALID)}function J(b){b=w(b);var a;b&&"document-meta"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.meta=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),
+d(a,a.meta))}function N(b){b=w(b);var a;b&&"document-settings"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===b.namespaceURI&&(a=E.rootElement,a.settings=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","settings"),d(a,a.settings))}function K(b){b=w(b);var a;if(b&&"manifest"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===b.namespaceURI)for(a=E.rootElement,a.manifest=b,b=a.manifest.firstElementChild;b;)"file-entry"===b.localName&&"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"===
+b.namespaceURI&&(R[b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","full-path")]=b.getAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","media-type")),b=b.nextElementSibling}function H(b,a,c){b=h.getElementsByTagName(b,a);var e;for(e=0;e'}function U(){var b=new xmldom.LSSerializer,a=G("document-meta");b.filter=new odf.OdfNodeFilter;a+=b.writeToString(E.rootElement.meta,odf.Namespaces.namespaceMap);return a+""}function aa(b,a){var c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:file-entry");c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0","manifest:full-path",b);c.setAttributeNS("urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
+"manifest:media-type",a);return c}function P(){var b=runtime.parseXML(''),a=b.documentElement,c=new xmldom.LSSerializer,e;for(e in R)R.hasOwnProperty(e)&&a.appendChild(aa(e,R[e]));c.filter=new odf.OdfNodeFilter;return'\n'+c.writeToString(b,odf.Namespaces.namespaceMap)}function D(){var b,a,e,d=odf.Namespaces.namespaceMap,
+g=new xmldom.LSSerializer,f=G("document-styles");a=s(E.rootElement.automaticStyles,"document-styles");e=E.rootElement.masterStyles.cloneNode(!0);b=x(E.rootElement.fontFaceDecls,[e,E.rootElement.styles,a]);c.removePrefixFromStyleNames(a,m,e);g.filter=new k(e,a);f+=g.writeToString(b,d);f+=g.writeToString(E.rootElement.styles,d);f+=g.writeToString(a,d);f+=g.writeToString(e,d);return f+""}function Q(){var b,c,e=odf.Namespaces.namespaceMap,d=new xmldom.LSSerializer,g=G("document-content");
+c=s(E.rootElement.automaticStyles,"document-content");b=x(E.rootElement.fontFaceDecls,[c]);d.filter=new a(E.rootElement.body,c);g+=d.writeToString(b,e);g+=d.writeToString(c,e);g+=d.writeToString(E.rootElement.body,e);return g+""}function $(a,c){runtime.loadXML(a,function(a,e){if(a)c(a);else if(e){z(e);Z(e.documentElement);var d=w(e);d&&"document"===d.localName&&"urn:oasis:names:tc:opendocument:xmlns:office:1.0"===d.namespaceURI?(I(d),B(b.DONE)):B(b.INVALID)}else c("No DOM was loaded.")})}
+function A(b,a){var c;c=E.rootElement;var e=c.meta;e||(c.meta=e=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0","meta"),d(c,e));c=e;b&&h.mapKeyValObjOntoNode(c,b,odf.Namespaces.lookupNamespaceURI);a&&h.removeKeyElementsFromNode(c,a,odf.Namespaces.lookupNamespaceURI)}function V(a,c){function e(b,a){var c;a||(a=b);c=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);n[b]=c;n.appendChild(c)}var d=new core.Zip("",null),g="application/vnd.oasis.opendocument."+
+a+(!0===c?"-template":""),f=runtime.byteArrayFromString(g,"utf8"),n=E.rootElement,h=document.createElementNS("urn:oasis:names:tc:opendocument:xmlns:office:1.0",a);d.save("mimetype",f,!1,new Date);e("meta");e("settings");e("scripts");e("fontFaceDecls","font-face-decls");e("styles");e("automaticStyles","automatic-styles");e("masterStyles","master-styles");e("body");n.body.appendChild(h);R["/"]=g;R["settings.xml"]="text/xml";R["meta.xml"]="text/xml";R["styles.xml"]="text/xml";R["content.xml"]="text/xml";
+B(b.DONE);return d}function ba(){var b,a=new Date,c="";E.rootElement.settings&&E.rootElement.settings.firstElementChild&&(b=new xmldom.LSSerializer,c=G("document-settings"),b.filter=new odf.OdfNodeFilter,c+=b.writeToString(E.rootElement.settings,odf.Namespaces.namespaceMap),c+="");(b=c)?(b=runtime.byteArrayFromString(b,"utf8"),X.save("settings.xml",b,!0,a)):X.remove("settings.xml");c=runtime.getWindow();b="WebODF/"+webodf.Version;c&&(b=b+" "+c.navigator.userAgent);A({"meta:generator":b},
+null);b=runtime.byteArrayFromString(U(),"utf8");X.save("meta.xml",b,!0,a);b=runtime.byteArrayFromString(D(),"utf8");X.save("styles.xml",b,!0,a);b=runtime.byteArrayFromString(Q(),"utf8");X.save("content.xml",b,!0,a);b=runtime.byteArrayFromString(P(),"utf8");X.save("META-INF/manifest.xml",b,!0,a)}function Y(b,a){ba();X.writeAs(b,function(b){a(b)})}var E=this,X,R={},da,S="";this.onstatereadychange=f;this.state=this.onchange=null;this.getMetadata=y;this.setRootElement=I;this.getContentElement=function(){var b;
+da||(b=E.rootElement.body,da=h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","text")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","presentation")||h.getDirectChild(b,"urn:oasis:names:tc:opendocument:xmlns:office:1.0","spreadsheet"));if(!da)throw"Could not find content element in .";return da};this.getDocumentType=function(){var b=E.getContentElement();return b&&b.localName};this.isTemplate=function(){return"-template"===R["/"].substr(-9)};
+this.setIsTemplate=function(b){var a=R["/"],c="-template"===a.substr(-9);b!==c&&(a=b?a+"-template":a.substr(0,a.length-9),R["/"]=a,b=runtime.byteArrayFromString(a,"utf8"),X.save("mimetype",b,!1,new Date))};this.getPart=function(b){return new odf.OdfPart(b,R[b],E,X)};this.getPartData=function(b,a){X.load(b,a)};this.setMetadata=A;this.incrementEditingCycles=function(){var b=y(odf.Namespaces.metans,"editing-cycles"),b=b?parseInt(b,10):0;isNaN(b)&&(b=0);A({"meta:editing-cycles":b+1},null);return b+1};
+this.createByteArray=function(b,a){ba();X.createByteArray(b,a)};this.saveAs=Y;this.save=function(b){Y(S,b)};this.getUrl=function(){return S};this.setBlob=function(b,a,c){c=l.convertBase64ToByteArray(c);X.save(b,c,!1,new Date);R.hasOwnProperty(b)&&runtime.log(b+" has been overwritten.");R[b]=a};this.removeBlob=function(b){var a=X.remove(b);runtime.assert(a,"file is not found: "+b);delete R[b]};this.state=b.LOADING;this.rootElement=function(b){var a=document.createElementNS(b.namespaceURI,b.localName),
+c;b=new b.Type;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}({Type:odf.ODFDocumentElement,namespaceURI:odf.ODFDocumentElement.namespaceURI,localName:odf.ODFDocumentElement.localName});e===odf.OdfContainer.DocumentType.TEXT?X=V("text"):e===odf.OdfContainer.DocumentType.TEXT_TEMPLATE?X=V("text",!0):e===odf.OdfContainer.DocumentType.PRESENTATION?X=V("presentation"):e===odf.OdfContainer.DocumentType.PRESENTATION_TEMPLATE?X=V("presentation",!0):e===odf.OdfContainer.DocumentType.SPREADSHEET?X=V("spreadsheet"):
+e===odf.OdfContainer.DocumentType.SPREADSHEET_TEMPLATE?X=V("spreadsheet",!0):(S=e,X=new core.Zip(S,function(a,c){X=c;a?$(S,function(c){a&&(X.error=a+"\n"+c,B(b.INVALID))}):T([{path:"styles.xml",handler:C},{path:"content.xml",handler:F},{path:"meta.xml",handler:J},{path:"settings.xml",handler:N},{path:"META-INF/manifest.xml",handler:K}])}))};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED=5;odf.OdfContainer.getContainer=
+function(b){return new odf.OdfContainer(b,null)}})();odf.OdfContainer.DocumentType={TEXT:1,TEXT_TEMPLATE:2,PRESENTATION:3,PRESENTATION_TEMPLATE:4,SPREADSHEET:5,SPREADSHEET_TEMPLATE:6};gui.AnnotatableCanvas=function(){};gui.AnnotatableCanvas.prototype.refreshSize=function(){};gui.AnnotatableCanvas.prototype.getZoomLevel=function(){};gui.AnnotatableCanvas.prototype.getSizer=function(){};
+gui.AnnotationViewManager=function(f,k,a,d){function c(b){var a=b.annotationEndElement,c=l.createRange(),d=b.getAttributeNS(odf.Namespaces.officens,"name");a&&(c.setStart(b,b.childNodes.length),c.setEnd(a,0),b=r.getTextNodes(c,!1),b.forEach(function(b){var a;a:{for(a=b.parentNode;a.namespaceURI!==odf.Namespaces.officens||"body"!==a.localName;){if(a.namespaceURI===e&&"webodf-annotationHighlight"===a.className&&a.getAttribute("annotation")===d){a=!0;break a}a=a.parentNode}a=!1}a||(a=l.createElement("span"),
+a.className="webodf-annotationHighlight",a.setAttribute("annotation",d),b.parentNode.replaceChild(a,b),a.appendChild(b))}));c.detach()}function h(c){var e=f.getSizer();c?(a.style.display="inline-block",e.style.paddingRight=b.getComputedStyle(a).width):(a.style.display="none",e.style.paddingRight=0);f.refreshSize()}function q(){m.sort(function(b,a){return 0!==(b.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING)?-1:1})}function p(){var b;for(b=0;b=(l.getBoundingClientRect().top-q.bottom)/c?e.style.top=Math.abs(l.getBoundingClientRect().top-q.bottom)/c+20+"px":e.style.top="0px");h.style.left=d.getBoundingClientRect().width/
+c+"px";var d=h.style,l=h.getBoundingClientRect().left/c,p=h.getBoundingClientRect().top/c,q=e.getBoundingClientRect().left/c,k=e.getBoundingClientRect().top/c,r=0,I=0,r=q-l,r=r*r,I=k-p,I=I*I,l=Math.sqrt(r+I);d.width=l+"px";p=Math.asin((e.getBoundingClientRect().top-h.getBoundingClientRect().top)/(c*parseFloat(h.style.width)));h.style.transform="rotate("+p+"rad)";h.style.MozTransform="rotate("+p+"rad)";h.style.WebkitTransform="rotate("+p+"rad)";h.style.msTransform="rotate("+p+"rad)"}}var m=[],l=k.ownerDocument,
+r=odf.OdfUtils,b=runtime.getWindow(),e="http://www.w3.org/1999/xhtml";runtime.assert(Boolean(b),"Expected to be run in an environment which has a global window, like a browser.");this.rerenderAnnotations=p;this.rehighlightAnnotations=function(){m.forEach(function(b){c(b)})};this.getMinimumHeightForAnnotationPane=function(){return"none"!==a.style.display&&0q||k.bottom>q)f.scrollTop=k.bottom-k.top<=q-c?f.scrollTop+(k.bottom-q):f.scrollTop+(k.top-c);k.lefth&&(f.scrollLeft=k.right-k.left<=h-d?f.scrollLeft+(k.right-h):f.scrollLeft-(d-k.left))}}};(function(){function f(a,h,q,p,m){var l,k=0,b;for(b in a)if(a.hasOwnProperty(b)){if(k===q){l=b;break}k+=1}l?h.getPartData(a[l].href,function(b,n){if(b)runtime.log(b);else if(n){var g="@font-face { font-family: "+(a[l].family||l)+"; src: url(data:application/x-font-ttf;charset=binary;base64,"+d.convertUTF8ArrayToBase64(n)+') format("truetype"); }';try{p.insertRule(g,p.cssRules.length)}catch(k){runtime.log("Problem inserting rule in CSS: "+runtime.toJson(k)+"\nRule: "+g)}}else runtime.log("missing font data for "+
+a[l].href);f(a,h,q+1,p,m)}):m&&m()}var k=xmldom.XPath,a=odf.OdfUtils,d=new core.Base64;odf.FontLoader=function(){this.loadFonts=function(c,d){for(var q=c.rootElement.fontFaceDecls;d.cssRules.length;)d.deleteRule(d.cssRules.length-1);if(q){var p={},m,l,r,b;if(q)for(q=k.getODFElementsWithXPath(q,"style:font-face[svg:font-face-src]",odf.Namespaces.lookupNamespaceURI),m=0;m text|list-item:first-child > :not(text|list):first-child:before',x+="{",x+="counter-increment: "+s+" 0;",x+="}",f(a,x));for(;k.counterIdStack.length>=q;)k.counterIdStack.pop();k.counterIdStack.push(s);w=k.contentRules[q.toString()]||"";for(x=1;x<=q;x+=1)w=w.replace(x+"webodf-listLevel",k.counterIdStack[x-1]);x='text|list[webodfhelper|counter-id="'+r+'"] > text|list-item > :not(text|list):first-child:before';
+x+="{";x+=w;x+="counter-increment: "+s+";";x+="}";f(a,x)}for(d=d.firstElementChild;d;)c(e,d,p,k),d=d.nextElementSibling}else k.continuedCounterIdStack=[]}var d=0,b="",e={};this.createCounterRules=function(b,a,f){var h=a.getAttributeNS(q,"id"),m=[];f&&(f=f.getAttributeNS("urn:webodf:names:helper","counter-id"),m=e[f].slice(0));b=new k(b,m);h?h="Y"+h:(d+=1,h="X"+d);c(h,a,0,b);e[h+"-level1-1"]=b.counterIdStack};this.initialiseCreatedCounters=function(){var c;c="office|document{"+("counter-reset: "+b+
+";");c+="}";f(a,c)}}var d=odf.Namespaces.fons,c=odf.Namespaces.stylens,h=odf.Namespaces.textns,q=odf.Namespaces.xmlns,p={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"};odf.ListStyleToCss=function(){function m(b){var a=n.parseLength(b);return a?e.convert(a.value,a.unit,"px"):(runtime.log("Could not parse value '"+b+"'."),0)}function l(b){return b.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function k(b,a){var c;b&&(c=b.getAttributeNS(h,"style-name"));return c===a}function b(b,
+e,d){e=e.getElementsByTagNameNS(h,"list");b=new a(b);var f,n,m,x,w,B,I={},C;for(C=0;C text|list-item > text|list",t-=1;t=u&&u.getAttributeNS(d,"text-align")||"left";switch(t){case "end":t="right";break;case "start":t="left"}"label-alignment"===N?(H=K&&K.getAttributeNS(d,"margin-left")||"0px",T=K&&K.getAttributeNS(d,"text-indent")||"0px",G=K&&K.getAttributeNS(h,"label-followed-by"),K=m(H)):(H=u&&u.getAttributeNS(h,"space-before")||"0px",z=u&&u.getAttributeNS(h,"min-label-width")||"0px",
+Z=u&&u.getAttributeNS(h,"min-label-distance")||"0px",K=m(H)+m(z));u=q+" > text|list-item";u+="{";u+="margin-left: "+K+"px;";u+="}";f(n,u);u=q+" > text|list-item > text|list";u+="{";u+="margin-left: "+-K+"px;";u+="}";f(n,u);u=q+" > text|list-item > :not(text|list):first-child:before";u+="{";u+="text-align: "+t+";";u+="display: inline-block;";"label-alignment"===N?(u+="margin-left: "+T+";","listtab"===G&&(u+="padding-right: 0.2cm;")):(u+="min-width: "+z+";",u+="margin-left: "+(0===parseFloat(z)?"":
+"-")+z+";",u+="padding-right: "+Z+";");u+="}";f(n,u)}e=e.nextElementSibling}});b(a,n,l)}}})();odf.LazyStyleProperties=function(f,k){var a={};this.value=function(d){var c;a.hasOwnProperty(d)?c=a[d]:(c=k[d](),void 0===c&&f&&(c=f.value(d)),a[d]=c);return c};this.reset=function(d){f=d;a={}}};
+odf.StyleParseUtils=function(){function f(a){var d,c;a=(a=/(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/.exec(a))?{value:parseFloat(a[1]),unit:a[3]}:null;c=a&&a.unit;"px"===c?d=a.value:"cm"===c?d=96*(a.value/2.54):"mm"===c?d=96*(a.value/25.4):"in"===c?d=96*a.value:"pt"===c?d=a.value/0.75:"pc"===c&&(d=16*a.value);return d}var k=odf.Namespaces.stylens;this.parseLength=f;this.parsePositiveLengthOrPercent=function(a,d,c){var h;a&&(h=parseFloat(a.substr(0,
+a.indexOf("%"))),isNaN(h)&&(h=void 0));var k;void 0!==h?(c&&(k=c.value(d)),h=void 0===k?void 0:h*(k/100)):h=f(a);return h};this.getPropertiesElement=function(a,d,c){for(d=c?c.nextElementSibling:d.firstElementChild;null!==d&&(d.localName!==a||d.namespaceURI!==k);)d=d.nextElementSibling;return d};this.parseAttributeList=function(a){a&&(a=a.replace(/^\s*(.*?)\s*$/g,"$1"));return a&&0n.value&&(f="0.75pt"+g);g=f}else if(z.hasOwnProperty(d[1])){var f=
+b,h=d[0],n=d[1],m=T.parseLength(g),l=void 0,p=void 0,q=void 0,K=void 0,q=void 0;if(m&&"%"===m.unit){l=m.value/100;p=k(f.parentNode);for(K="0";p;){if(q=u.getDirectChild(p,r,"paragraph-properties"))if(q=T.parseLength(q.getAttributeNS(h,n))){if("%"!==q.unit){K=q.value*l+q.unit;break}l*=q.value/100}p=k(p)}g=K}}d[2]&&(c+=d[2]+":"+g+";")}return c}function d(b,a,c,e){return a+a+c+c+e+e}function c(b,a){var e=[b],d=a.derivedStyles;Object.keys(d).forEach(function(b){b=c(b,d[b]);e=e.concat(b)});return e}function h(b,
+a,e,d){function f(a,c){var e=[],d;a.forEach(function(b){h.forEach(function(a){e.push("draw|page[webodfhelper|page-style-name='"+a+"'] draw|frame[presentation|class='"+b+"']")})});0=e?f=c(a,e-1,d,!0):a.nodeType===Node.TEXT_NODE&&
-0a?-1:1;for(a=Math.abs(a);0q?n.previousPosition():n.nextPosition());)if(Q.check(),p.acceptPosition(n)===e&&(A+=1,r=n.container(),H=c(r,n.unfilteredDomOffset(),Z),H.top!==I)){if(H.top!==B&&B!==I)break;B=H.top;H=Math.abs(U-H.left);if(null===G||Ha?(g=p.previousPosition,
-f=-1):(g=p.nextPosition,f=1);for(h=c(p.container(),p.unfilteredDomOffset(),w);g.call(p);)if(b.acceptPosition(p)===e){if(n.getParagraphElement(p.getCurrentNode())!==q)break;l=c(p.container(),p.unfilteredDomOffset(),w);if(l.bottom!==h.bottom&&(h=l.top>=h.top&&l.bottomh.bottom,!h))break;r+=f;h=l}w.detach();return r}var n=new odf.OdfUtils,q,e=core.PositionFilter.FilterResult.FILTER_ACCEPT;this.getStepCounter=function(){return{convertForwardStepsBetweenFilters:h,convertBackwardStepsBetweenFilters:r,
-countLinesSteps:l,countStepsToLineBoundary:p}};(function(){q=gui.SelectionMover.createPositionIterator(k);var a=k.ownerDocument.createRange();a.setStart(q.container(),q.unfilteredDomOffset());a.collapse(!0);f.setSelectedRange(a)})()};
-gui.SelectionMover.createPositionIterator=function(f){var k=new function(){this.acceptNode=function(d){return d&&"urn:webodf:names:cursor"!==d.namespaceURI&&"urn:webodf:names:editinfo"!==d.namespaceURI?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}};return new core.PositionIterator(f,5,k,!1)};ops.Document=function(){};ops.Document.prototype.getMemberIds=function(){};ops.Document.prototype.removeCursor=function(f){};ops.Document.prototype.getDocumentElement=function(){};ops.Document.prototype.getRootNode=function(){};ops.Document.prototype.getDOMDocument=function(){};ops.Document.prototype.cloneDocumentElement=function(){};ops.Document.prototype.setDocumentElement=function(f){};ops.Document.prototype.subscribe=function(f,k){};ops.Document.prototype.unsubscribe=function(f,k){};
-ops.Document.prototype.getCanvas=function(){};ops.Document.prototype.createRootFilter=function(f){};ops.Document.signalCursorAdded="cursor/added";ops.Document.signalCursorRemoved="cursor/removed";ops.Document.signalCursorMoved="cursor/moved";ops.Document.signalMemberAdded="member/added";ops.Document.signalMemberUpdated="member/updated";ops.Document.signalMemberRemoved="member/removed";ops.OdtCursor=function(f,k){var d=this,b={},c,h,r,l=new core.EventNotifier([ops.OdtCursor.signalCursorUpdated]);this.removeFromDocument=function(){r.remove()};this.subscribe=function(b,c){l.subscribe(b,c)};this.unsubscribe=function(b,c){l.unsubscribe(b,c)};this.getStepCounter=function(){return h.getStepCounter()};this.getMemberId=function(){return f};this.getNode=function(){return r.getNode()};this.getAnchorNode=function(){return r.getAnchorNode()};this.getSelectedRange=function(){return r.getSelectedRange()};
-this.setSelectedRange=function(b,c){r.setSelectedRange(b,c);l.emit(ops.OdtCursor.signalCursorUpdated,d)};this.hasForwardSelection=function(){return r.hasForwardSelection()};this.getDocument=function(){return k};this.getSelectionType=function(){return c};this.setSelectionType=function(d){b.hasOwnProperty(d)?c=d:runtime.log("Invalid selection type: "+d)};this.resetSelectionType=function(){d.setSelectionType(ops.OdtCursor.RangeSelection)};r=new core.Cursor(k.getDOMDocument(),f);h=new gui.SelectionMover(r,
-k.getRootNode());b[ops.OdtCursor.RangeSelection]=!0;b[ops.OdtCursor.RegionSelection]=!0;d.resetSelectionType()};ops.OdtCursor.RangeSelection="Range";ops.OdtCursor.RegionSelection="Region";ops.OdtCursor.signalCursorUpdated="cursorUpdated";(function(){var f=0;ops.StepsCache=function(k,d,b){function c(a,e){var c=this;this.nodeId=a;this.steps=-1;this.node=e;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setPositionBeforeElement(e);b(c.steps,a)}}function h(a,e,c){var d=this;this.nodeId=a;this.steps=e;this.node=c;this.previousBookmark=this.nextBookmark=null;this.setIteratorPosition=function(a){a.setUnfilteredPosition(c,0);b(d.steps,a)}}function r(a,b){var e="["+a.nodeId;b&&(e+=" => "+b.nodeId);return e+
-"]"}function l(){for(var a=v,b,e,c,d=new core.LoopWatchDog(0,1E5),f={};a;){d.check();(b=a.previousBookmark)?runtime.assert(b.nextBookmark===a,"Broken bookmark link to previous @"+r(b,a)):(runtime.assert(a===v,"Broken bookmark link @"+r(a)),runtime.assert(void 0===y||v===v||v.steps<=y,"Base point is damaged @"+r(a)));(e=a.nextBookmark)&&runtime.assert(e.previousBookmark===a,"Broken bookmark link to next @"+r(a,e));if(void 0===y||a===v||a.steps<=y)runtime.assert(t.containsNode(k,a.node),"Disconnected node is being reported as undamaged @"+
-r(a)),b&&(c=a.node.compareDocumentPosition(b.node),runtime.assert(0===c||0!==(c&x),"Bookmark order with previous does not reflect DOM order @"+r(b,a))),e&&t.containsNode(k,e.node)&&(c=a.node.compareDocumentPosition(e.node),runtime.assert(0===c||0!==(c&s),"Bookmark order with next does not reflect DOM order @"+r(a,e)));a=a.nextBookmark}Object.keys(g).forEach(function(a){var b=g[a];(void 0===y||a<=y)&&runtime.assert(b.steps<=a,"Bookmark step of "+b.steps+" exceeds cached step lookup for "+a+" @"+r(b));
-runtime.assert(!1===f.hasOwnProperty(b.nodeId),"Bookmark "+r(b)+" appears twice in cached step lookup at steps "+f[b.nodeId]+" and "+a);f[b.nodeId]=a})}function p(a){var b="";a.nodeType===Node.ELEMENT_NODE&&(b=a.getAttributeNS(m,"nodeId")||"");return b}function n(a){var b=f.toString();a.setAttributeNS(m,"nodeId",b);f+=1;return b}function q(a){var b,e,c=new core.LoopWatchDog(0,1E4);void 0!==y&&a>y&&(a=y);for(b=Math.floor(a/d)*d;!e&&0<=b;)e=g[b],b-=d;for(e=e||v;e.nextBookmark&&e.nextBookmark.steps<=
-a;)c.check(),e=e.nextBookmark;runtime.assert(-1===a||e.steps<=a,"Bookmark @"+r(e)+" at step "+e.steps+" exceeds requested step of "+a);return e}function e(a){a.previousBookmark&&(a.previousBookmark.nextBookmark=a.nextBookmark);a.nextBookmark&&(a.nextBookmark.previousBookmark=a.previousBookmark)}function a(a){for(var b,e=null;!e&&a&&a!==k;)(b=p(a))&&(e=z[b])&&e.node!==a&&(runtime.log("Cloned node detected. Creating new bookmark"),e=null,a.removeAttributeNS(m,"nodeId")),a=a.parentNode;return e}var m=
-"urn:webodf:names:steps",g={},z={},t=new core.DomUtils,v,y,s=Node.DOCUMENT_POSITION_FOLLOWING,x=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(a,b){var f,h=Math.ceil(a/d)*d,l,m,r;if(void 0!==y&&yl.steps)g[h]=m;w()};this.setToClosestStep=function(a,b){var e;w();e=q(a);e.setIteratorPosition(b);
-return e.steps};this.setToClosestDomPoint=function(b,e,c){var d,f;w();if(b===k&&0===e)d=v;else if(b===k&&e===k.childNodes.length)for(f in d=v,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>d.steps&&(d=b));else if(d=a(b.childNodes.item(e)||b),!d)for(c.setUnfilteredPosition(b,e);!d&&c.previousNode();)d=a(c.getCurrentNode());d=d||v;void 0!==y&&d.steps>y&&(d=q(y));d.setIteratorPosition(c);return d.steps};this.damageCacheAfterStep=function(a){0>a&&(a=-1);void 0===y?y=a:ab)throw new RangeError("Requested steps is negative ("+b+")");r();for(e=n.setToClosestStep(b,a);ee.comparePoints(p,0,b,f),b=p,f=f?0:p.childNodes.length);a.setUnfilteredPosition(b,f);l(a,h)||a.setUnfilteredPosition(b,f);h=a.container();f=a.unfilteredDomOffset();b=n.setToClosestDomPoint(h,f,a);if(0>e.comparePoints(a.container(),
-a.unfilteredDomOffset(),h,f))return 0=n.textNode.length?null:n.textNode.splitText(n.offset));for(a=n.textNode;a!==e;){a=a.parentNode;m=a.cloneNode(!1);g&&m.appendChild(g);if(z)for(;z&&z.nextSibling;)m.appendChild(z.nextSibling);else for(;a.firstChild;)m.appendChild(a.firstChild);a.parentNode.insertBefore(m,a.nextSibling);z=a;g=m}r.isListItem(g)&&(g=g.childNodes.item(0));h?g.setAttributeNS(l,"text:style-name",h):g.removeAttributeNS(l,"style-name");0===n.textNode.length&&
-n.textNode.parentNode.removeChild(n.textNode);d.emit(ops.OdtDocument.signalStepsInserted,{position:b});t&&c&&(d.moveCursor(f,b+1,0),d.emit(ops.Document.signalCursorMoved,t));d.fixCursorPositions();d.getOdfCanvas().refreshSize();d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:q,memberId:f,timeStamp:k});d.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});d.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",
-memberid:f,timestamp:k,position:b,sourceParagraphPosition:d,paragraphStyleName:h,moveCursor:c}}};ops.OpUpdateMember=function(){function f(c){var d="//dc:creator[@editinfo:memberid='"+k+"']";c=xmldom.XPath.getODFElementsWithXPath(c.getRootNode(),d,function(b){return"editinfo"===b?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(b)});for(d=0;d "+a.nodeId);return c+
+"]"}function p(){for(var b=y,a,c,e,d=new core.LoopWatchDog(0,1E5),f={};b;){d.check();(a=b.previousBookmark)?runtime.assert(a.nextBookmark===b,"Broken bookmark link to previous @"+q(a,b)):(runtime.assert(b===y,"Broken bookmark link @"+q(b)),runtime.assert(void 0===v||y===y||y.steps<=v,"Base point is damaged @"+q(b)));(c=b.nextBookmark)&&runtime.assert(c.previousBookmark===b,"Broken bookmark link to next @"+q(b,c));if(void 0===v||b===y||b.steps<=v)runtime.assert(t.containsNode(k,b.node),"Disconnected node is being reported as undamaged @"+
+q(b)),a&&(e=b.node.compareDocumentPosition(a.node),runtime.assert(0===e||0!==(e&x),"Bookmark order with previous does not reflect DOM order @"+q(a,b))),c&&t.containsNode(k,c.node)&&(e=b.node.compareDocumentPosition(c.node),runtime.assert(0===e||0!==(e&s),"Bookmark order with next does not reflect DOM order @"+q(b,c)));b=b.nextBookmark}Object.keys(g).forEach(function(b){var a=g[b];(void 0===v||b<=v)&&runtime.assert(a.steps<=b,"Bookmark step of "+a.steps+" exceeds cached step lookup for "+b+" @"+q(a));
+runtime.assert(!1===f.hasOwnProperty(a.nodeId),"Bookmark "+q(a)+" appears twice in cached step lookup at steps "+f[a.nodeId]+" and "+b);f[a.nodeId]=b})}function m(b){var a="";b.nodeType===Node.ELEMENT_NODE&&(a=b.getAttributeNS(n,"nodeId")||"");return a}function l(b){var a=f.toString();b.setAttributeNS(n,"nodeId",a);f+=1;return a}function r(b){var c,e,d=new core.LoopWatchDog(0,1E4);void 0!==v&&b>v&&(b=v);for(c=Math.floor(b/a)*a;!e&&0<=c;)e=g[c],c-=a;for(e=e||y;e.nextBookmark&&e.nextBookmark.steps<=
+b;)d.check(),e=e.nextBookmark;runtime.assert(-1===b||e.steps<=b,"Bookmark @"+q(e)+" at step "+e.steps+" exceeds requested step of "+b);return e}function b(b){b.previousBookmark&&(b.previousBookmark.nextBookmark=b.nextBookmark);b.nextBookmark&&(b.nextBookmark.previousBookmark=b.previousBookmark)}function e(b){for(var a,c=null;!c&&b&&b!==k;)(a=m(b))&&(c=u[a])&&c.node!==b&&(runtime.log("Cloned node detected. Creating new bookmark"),c=null,b.removeAttributeNS(n,"nodeId")),b=b.parentNode;return c}var n=
+"urn:webodf:names:steps",g={},u={},t=core.DomUtils,y,v,s=Node.DOCUMENT_POSITION_FOLLOWING,x=Node.DOCUMENT_POSITION_PRECEDING,w;this.updateBookmark=function(e,d){var f,h=Math.ceil(e/a)*a,n,p,q;if(void 0!==v&&vn.steps)g[h]=p;w()};this.setToClosestStep=function(b,a){var c;w();c=r(b);c.setIteratorPosition(a);
+return c.steps};this.setToClosestDomPoint=function(b,a,c){var d,f;w();if(b===k&&0===a)d=y;else if(b===k&&a===k.childNodes.length)for(f in d=y,g)g.hasOwnProperty(f)&&(b=g[f],b.steps>d.steps&&(d=b));else if(d=e(b.childNodes.item(a)||b),!d)for(c.setUnfilteredPosition(b,a);!d&&c.previousNode();)d=e(c.getCurrentNode());d=d||y;void 0!==v&&d.steps>v&&(d=r(v));d.setIteratorPosition(c);return d.steps};this.damageCacheAfterStep=function(b){0>b&&(b=-1);void 0===v?v=b:bb)throw new RangeError("Requested steps is negative ("+
+b+")");q();for(d=l.setToClosestStep(b,e);db.comparePoints(m,0,d,g),d=m,g=g?0:m.childNodes.length);e.setUnfilteredPosition(d,g);p(e,f)||e.setUnfilteredPosition(d,g);f=e.container();g=e.unfilteredDomOffset();
+d=l.setToClosestDomPoint(f,g,e);if(0>b.comparePoints(e.container(),e.unfilteredDomOffset(),f,g))return 0=l.textNode.length?null:l.textNode.splitText(l.offset));for(e=l.textNode;e!==b;){e=e.parentNode;n=e.cloneNode(!1);g&&n.appendChild(g);if(u)for(;u&&u.nextSibling;)n.appendChild(u.nextSibling);else for(;e.firstChild;)n.appendChild(e.firstChild);e.parentNode.insertBefore(n,e.nextSibling);u=e;g=n}q.isListItem(g)&&(g=g.childNodes.item(0));h?g.setAttributeNS(p,"text:style-name",h):g.removeAttributeNS(p,"style-name");0===l.textNode.length&&
+l.textNode.parentNode.removeChild(l.textNode);a.emit(ops.OdtDocument.signalStepsInserted,{position:d});t&&c&&(a.moveCursor(f,d+1,0),a.emit(ops.Document.signalCursorMoved,t));a.fixCursorPositions();a.getOdfCanvas().refreshSize();a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:r,memberId:f,timeStamp:k});a.emit(ops.OdtDocument.signalParagraphChanged,{paragraphElement:g,memberId:f,timeStamp:k});a.getOdfCanvas().rerenderAnnotations();return!0};this.spec=function(){return{optype:"SplitParagraph",
+memberid:f,timestamp:k,position:d,sourceParagraphPosition:a,paragraphStyleName:h,moveCursor:c}}};ops.OpUpdateMember=function(){function f(a){var c="//dc:creator[@editinfo:memberid='"+k+"']";a=xmldom.XPath.getODFElementsWithXPath(a.getRootNode(),c,function(a){return"editinfo"===a?"urn:webodf:names:editinfo":odf.Namespaces.lookupNamespaceURI(a)});for(c=0;c=h.width&&(h=null),f.detach();else if(k.isCharacterElement(c.container)||k.isCharacterFrame(c.container))h=b.getBoundingClientRect(c.container);
-return h}var k=new odf.OdfUtils,d=new odf.StepUtils,b=new core.DomUtils,c=core.StepDirection.NEXT,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,r=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=f;this.moveToFilteredStep=function(b,d,k){function q(a,b){b.process(y,g,z)&&(a=!0,!t&&b.token&&(t=b.token));return a}var e=d===c,a,m,g,z,t,v=b.snapshot();a=!1;var y;do a=f(b),y={token:b.snapshot(),container:b.container,offset:b.offset,direction:d,visualDirection:d===c?h:r},m=b.nextStep()?f(b):
-null,b.restore(y.token),e?(g=a,z=m):(g=m,z=a),a=k.reduce(q,!1);while(!a&&b.advanceStep(d));a||k.forEach(function(a){!t&&a.token&&(t=a.token)});b.restore(t||v);return Boolean(t)}};gui.Caret=function(f,k,d){function b(){n.style.opacity="0"===n.style.opacity?"1":"0";s.trigger()}function c(){m.selectNodeContents(a);return m.getBoundingClientRect()}function h(){Object.keys(G).forEach(function(a){E[a]=G[a]})}function r(){var a,b,m,l;if(!1===G.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!d&&!f.getSelectedRange().collapsed)G.visibility="hidden",n.style.visibility="hidden",s.cancel();else{G.visibility="visible";n.style.visibility="visible";if(!1===G.isFocused)n.style.opacity=
-"1",s.cancel();else{if(x||E.visibility!==G.visibility)n.style.opacity="1",s.cancel();s.trigger()}if(A||w||E.visibility!==G.visibility){a=f.getNode();var k;m=z.getBoundingClientRect(g.getSizer());l=!1;if(0a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});p.style.height=a.height+"px";p.style.top=a.top+"px";p.style.left=a.right+"px";e&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?e.style.font=a.font:(e.style.fontStyle=a.fontStyle,e.style.fontVariant=a.fontVariant,e.style.fontWeight=
-a.fontWeight,e.style.fontSize=a.fontSize,e.style.lineHeight=a.lineHeight,e.style.fontFamily=a.fontFamily))}if(w){k=f.getDocument().getCanvas().getElement().parentNode;var r;m=k.offsetWidth-k.clientWidth+5;l=k.offsetHeight-k.clientHeight+5;r=n.getBoundingClientRect();a=r.left-m;b=r.top-l;m=r.right+m;l=r.bottom+l;r=k.getBoundingClientRect();br.bottom&&(k.scrollTop+=l-r.bottom);ar.right&&(k.scrollLeft+=m-r.right)}}E.isFocused!==G.isFocused&&
-q.markAsFocussed(G.isFocused);h();A=w=x=!1}function l(b){p.parentNode.removeChild(p);a.parentNode.removeChild(a);b()}var p,n,q,e,a,m,g=f.getDocument().getCanvas(),z=new core.DomUtils,t=new gui.GuiStepUtils,v,y,s,x=!1,w=!1,A=!1,G={isFocused:!1,isShown:!0,visibility:"hidden"},E={isFocused:!G.isFocused,isShown:!G.isShown,visibility:"hidden"};this.handleUpdate=function(){A=!0;"hidden"!==G.visibility&&(G.visibility="hidden",n.style.visibility="hidden",f.getNode().removeAttributeNS("urn:webodf:names:cursor",
-"caret-sizer-active"));y.trigger()};this.refreshCursorBlinking=function(){x=!0;y.trigger()};this.setFocus=function(){G.isFocused=!0;y.trigger()};this.removeFocus=function(){G.isFocused=!1;y.trigger()};this.show=function(){G.isShown=!0;y.trigger()};this.hide=function(){G.isShown=!1;y.trigger()};this.setAvatarImageUrl=function(a){q.setImageUrl(a)};this.setColor=function(a){n.style.borderColor=a;q.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return n};this.toggleHandleVisibility=
-function(){q.isVisible()?q.hide():q.show()};this.showHandle=function(){q.show()};this.hideHandle=function(){q.hide()};this.setOverlayElement=function(a){e=a;p.appendChild(a);A=!0;y.trigger()};this.ensureVisible=function(){w=!0;y.trigger()};this.getBoundingClientRect=function(){return z.getBoundingClientRect(p)};this.destroy=function(a){core.Async.destroyAll([y.destroy,s.destroy,q.destroy,l],a)};(function(){var e=f.getDocument(),c=[e.createRootFilter(f.getMemberId()),e.getPositionFilter()],d=e.getDOMDocument();
-m=d.createRange();a=d.createElement("span");a.className="webodf-caretSizer";a.textContent="|";f.getNode().appendChild(a);p=d.createElement("div");p.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());p.className="webodf-caretOverlay";n=d.createElement("div");n.className="caret";p.appendChild(n);q=new gui.Avatar(p,k);g.getSizer().appendChild(p);v=e.createStepIterator(f.getNode(),0,c,e.getRootNode());y=core.Task.createRedrawTask(r);s=core.Task.createTimeoutTask(b,500);y.triggerImmediate()})()};odf.TextSerializer=function(){function f(b){var c="",h=k.filter?k.filter.acceptNode(b):NodeFilter.FILTER_ACCEPT,r=b.nodeType,l;if((h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)&&d.isTextContentContainingNode(b))for(l=b.firstChild;l;)c+=f(l),l=l.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(r===Node.ELEMENT_NODE&&d.isParagraph(b)?c+="\n":r===Node.TEXT_NODE&&b.textContent&&(c+=b.textContent));return c}var k=this,d=new odf.OdfUtils;this.filter=null;this.writeToString=function(b){if(!b)return"";
-b=f(b);"\n"===b[b.length-1]&&(b=b.substr(0,b.length-1));return b}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,d){var b;b=d.startContainer.ownerDocument.createElement("span");b.appendChild(d.cloneContents());b=f.writeToString(b);try{k.setData("text/plain",b)}catch(c){k.setData("Text",b)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,d){var b,c=k.clipboardData;b=runtime.getWindow();!c&&b&&(c=b.clipboardData);c?(b=!0,f.exportRangeToDataTransfer(c,d),k.preventDefault()):b=!1;return b}};gui.SessionContext=function(f,k){var d=f.getOdtDocument(),b=new odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var c=d.getCursor(k),f;if(!c)return!1;f=c&&c.getNode();c=d.getMember(k).getProperties().fullName;return(f=b.getParentAnnotation(f,d.getRootNode()))&&b.getAnnotationCreator(f)===c?!0:!1}};gui.StyleSummary=function(f){function k(b,d){var k=b+"|"+d,p;c.hasOwnProperty(k)||(p=[],f.forEach(function(c){c=(c=c.styleProperties[b])&&c[d];-1===p.indexOf(c)&&p.push(c)}),c[k]=p);return c[k]}function d(b,c,d){return function(){var f=k(b,c);return d.length>=f.length&&f.every(function(b){return-1!==d.indexOf(b)})}}function b(b,c){var d=k(b,c);return 1===d.length?d[0]:void 0}var c={};this.getPropertyValues=k;this.getCommonValue=b;this.isBold=d("style:text-properties","fo:font-weight",["bold"]);this.isItalic=
-d("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=d("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=d("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=d("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter=
-d("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=d("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=d("style:paragraph-properties","fo:text-align",["justify"]);this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName};this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight,
-isAlignedJustified:this.isAlignedJustified}};gui.DirectFormattingController=function(f,k,d,b,c,h,r){function l(){return T.value().styleSummary}function p(a){var b;a.collapsed?(b=a.startContainer,b.hasChildNodes()&&a.startOffseta.clientWidth||a.scrollHeight>a.clientHeight)&&b.push(new q(a)),a=a.parentNode;b.push(new n(s));return b}function y(){var a;
-g()||(a=v(E),t(),E.focus(),a.forEach(function(a){a.restore()}))}var s=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},A={},G={},E,F=f.getCanvas().getElement(),H=this,N={};this.addFilter=function(a,b){e(a,!0).filters.push(b)};this.removeFilter=function(a,b){var c=e(a,!0),d=c.filters.indexOf(b);-1!==d&&c.filters.splice(d,1)};this.subscribe=a;this.unsubscribe=m;this.hasFocus=g;this.focus=y;this.getEventTrap=function(){return E};
-this.setEditing=function(a){var b=g();b&&E.blur();a?E.removeAttribute("readOnly"):E.setAttribute("readOnly","true");b&&y()};this.destroy=function(a){m("touchstart",p);Object.keys(N).forEach(function(a){b(parseInt(a,10))});N.length=0;Object.keys(A).forEach(function(a){A[a].destroy()});A={};m("mousedown",z);m("mouseup",t);m("contextmenu",t);Object.keys(G).forEach(function(a){G[a].destroy()});G={};E.parentNode.removeChild(E);a()};(function(){var b=f.getOdfCanvas().getSizer(),e=b.ownerDocument;runtime.assert(Boolean(s),
-"EventManager requires a window object to operate correctly");E=e.createElement("input");E.id="eventTrap";E.setAttribute("tabindex","-1");E.setAttribute("readOnly","true");b.appendChild(E);a("mousedown",z);a("mouseup",t);a("contextmenu",t);A.longpress=new d("longpress",["touchstart","touchmove","touchend"],h);A.drag=new d("drag",["touchstart","touchmove","touchend"],r);A.dragstop=new d("dragstop",["drag","touchend"],l);a("touchstart",p)})()};gui.IOSSafariSupport=function(f){function k(){d.innerHeight!==d.outerHeight&&(b.style.display="none",runtime.requestAnimationFrame(function(){b.style.display="block"}))}var d=runtime.getWindow(),b=f.getEventTrap();this.destroy=function(c){f.unsubscribe("focus",k);b.removeAttribute("autocapitalize");b.style.WebkitTransform="";c()};f.subscribe("focus",k);b.setAttribute("autocapitalize","off");b.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,d,b){function c(){var b=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(b=d.isLocalCursorWithinOwnAnnotation());b!==n&&(n=b,p.emit(gui.HyperlinkController.enabledChanged,n))}function h(d){d.getMemberId()===b&&c()}var r=new odf.OdfUtils,l=f.getOdtDocument(),p=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),n=!1;this.isEnabled=function(){return n};this.subscribe=function(b,e){p.subscribe(b,e)};this.unsubscribe=function(b,e){p.unsubscribe(b,
-e)};this.addHyperlink=function(c,e){if(n){var a=l.getCursorSelection(b),d=new ops.OpApplyHyperlink,g=[];if(0===a.length||e)e=e||c,d=new ops.OpInsertText,d.init({memberid:b,position:a.position,text:e}),a.length=e.length,g.push(d);d=new ops.OpApplyHyperlink;d.init({memberid:b,position:a.position,length:a.length,hyperlink:c});g.push(d);f.enqueue(g)}};this.removeHyperlinks=function(){if(n){var c=gui.SelectionMover.createPositionIterator(l.getRootNode()),e=l.getCursor(b).getSelectedRange(),a=r.getHyperlinkElements(e),
-d=e.collapsed&&1===a.length,g=l.getDOMDocument().createRange(),h=[],k,p;0!==a.length&&(a.forEach(function(a){g.selectNodeContents(a);k=l.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});p=new ops.OpRemoveHyperlink;p.init({memberid:b,position:k.position,length:k.length});h.push(p)}),d||(d=a[0],-1===e.comparePoint(d,0)&&(g.setStart(d,0),g.setEnd(e.startContainer,e.startOffset),k=l.convertDomToCursorRange({anchorNode:g.startContainer,
-anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0h.width&&(r=h.width/k.width);k.height>h.height&&(y=h.height/k.height);h=Math.min(r,y);k={width:k.width*h,height:k.height*h}}h=k.width+
-"px";k=k.height+"px";var s=n.getOdfCanvas().odfContainer().rootElement.styles,r=e.toLowerCase(),y=l.hasOwnProperty(r)?l[r]:null,x,r=[];runtime.assert(null!==y,"Image type is not supported: "+e);y="Pictures/"+c.generateImageName()+y;x=new ops.OpSetBlob;x.init({memberid:b,filename:y,mimetype:e,content:d});r.push(x);q.getStyleElement("Graphics","graphic",[s])||(e=new ops.OpAddStyle,e.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"}}}),r.push(e));e=c.generateStyleName();d=new ops.OpAddStyle;d.init({memberid:b,styleName:e,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"}}});r.push(d);x=new ops.OpInsertImage;x.init({memberid:b,position:n.getCursorPosition(b),
-filename:y,frameWidth:h,frameHeight:k,frameStyleName:e,frameName:c.generateFrameName()});r.push(x);f.enqueue(r)}};this.destroy=function(a){n.unsubscribe(ops.Document.signalCursorMoved,r);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);a()};n.subscribe(ops.Document.signalCursorMoved,r);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var d=f.getSizer(),h=c.createElement("div");h.id="imageSelector";h.style.borderWidth="1px";d.appendChild(h);b.forEach(function(b){var d=c.createElement("div");d.className=b;h.appendChild(d)});return h}var d=odf.Namespaces.svgns,b="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),c=f.getElement().ownerDocument,h=!1;this.select=function(b){var l,p,n=c.getElementById("imageSelector");n||(n=k());h=!0;l=n.parentNode;
-p=b.getBoundingClientRect();var q=l.getBoundingClientRect(),e=f.getZoomLevel();l=(p.left-q.left)/e-1;p=(p.top-q.top)/e-1;n.style.display="block";n.style.left=l+"px";n.style.top=p+"px";n.style.width=b.getAttributeNS(d,"width");n.style.height=b.getAttributeNS(d,"height")};this.clearSelection=function(){var b;h&&(b=c.getElementById("imageSelector"))&&(b.style.display="none");h=!1};this.isSelectorElement=function(b){var d=c.getElementById("imageSelector");return d?b===d||b.parentNode===d:!1}};(function(){function f(f){function d(b){r=b.which&&String.fromCharCode(b.which)===h;h=void 0;return!1===r}function b(){r=!1}function c(b){h=b.data;r=!1}var h,r=!1;this.destroy=function(h){f.unsubscribe("textInput",b);f.unsubscribe("compositionend",c);f.removeFilter("keypress",d);h()};f.subscribe("textInput",b);f.subscribe("compositionend",c);f.addFilter("keypress",d)}gui.InputMethodEditor=function(k,d){function b(b){a&&(b?a.getNode().setAttributeNS(e,"composing","true"):(a.getNode().removeAttributeNS(e,
-"composing"),z.textContent=""))}function c(){y&&(y=!1,b(!1),x.emit(gui.InputMethodEditor.signalCompositionEnd,{data:s}),s="")}function h(){c();a&&a.getSelectedRange().collapsed?m.value="":m.value=t;m.setSelectionRange(0,m.value.length)}function r(){d.hasFocus()&&v.trigger()}function l(){w=void 0;v.cancel();b(!0);y||x.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function p(a){a=w=a.data;y=!0;s+=a;v.trigger()}function n(a){a.data!==w&&(a=a.data,y=!0,s+=a,v.trigger());w=void 0}function q(){z.textContent=
-m.value}var e="urn:webodf:names:cursor",a=null,m=d.getEventTrap(),g=m.ownerDocument,z,t="b",v,y=!1,s="",x=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),w,A=[],G;this.subscribe=x.subscribe;this.unsubscribe=x.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(a=b,a.getNode().appendChild(z),b.subscribe(ops.OdtCursor.signalCursorUpdated,r),d.subscribe("input",q),d.subscribe("compositionupdate",q))};this.removeCursor=function(b){a&&
-b===k&&(a.getNode().removeChild(z),a.unsubscribe(ops.OdtCursor.signalCursorUpdated,r),d.unsubscribe("input",q),d.unsubscribe("compositionupdate",q),a=null)};this.destroy=function(a){d.unsubscribe("compositionstart",l);d.unsubscribe("compositionend",p);d.unsubscribe("textInput",n);d.unsubscribe("keypress",c);d.unsubscribe("focus",h);core.Async.destroyAll(G,a)};(function(){d.subscribe("compositionstart",l);d.subscribe("compositionend",p);d.subscribe("textInput",n);d.subscribe("keypress",c);d.subscribe("focus",
-h);A.push(new f(d));G=A.map(function(a){return a.destroy});z=g.createElement("span");z.setAttribute("id","composer");v=core.Task.createTimeoutTask(h,1);G.push(v.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function d(b){h.emit(gui.MetadataController.signalMetadataChanged,b)}function b(b){var c=-1===r.indexOf(b);c||runtime.log("Setting "+b+" is restricted.");return c}var c=f.getOdtDocument(),h=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),r=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(c,d){var h={},r="",e;c&&Object.keys(c).filter(b).forEach(function(a){h[a]=c[a]});
-d&&(r=d.filter(b).join(","));if(0c:!1}function d(b){null!==b&&!1===k(b)&&(c=Math.abs(b-f))}var b=this,c,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(c,f,p){var n,q;c.visualDirection===h?(n=f&&f.right,q=p&&p.left):(n=f&&f.left,q=p&&p.right);if(k(n)||k(q))return!0;if(f||p)d(n),d(q),b.token=c.token;return!1}};gui.LineBoundaryScanner=function(){var f=this,k=null;this.token=void 0;this.process=function(d,b,c){var h;if(h=c)if(k){var r=k;h=Math.min(r.bottom-r.top,c.bottom-c.top);var l=Math.max(r.top,c.top),r=Math.min(r.bottom,c.bottom)-l;h=0.4>=(0b?a.previousSibling:a.nextSibling,e(h)===NodeFilter.FILTER_ACCEPT&&(c=h),a=a.parentNode;return c}function b(a,b){var e;return null===a?m.NO_NEIGHBOUR:r.isCharacterElement(a)?m.SPACE_CHAR:a.nodeType===c||r.isTextSpan(a)||r.isHyperlink(a)?(e=a.textContent.charAt(b()),p.test(e)?m.SPACE_CHAR:l.test(e)?m.PUNCTUATION_CHAR:m.WORD_CHAR):m.OTHER}var c=Node.TEXT_NODE,h=Node.ELEMENT_NODE,
-r=new odf.OdfUtils,l=/[!-#%-*,-\/:-;?-@\[-\]_{}\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]/,
-p=/\s/,n=core.PositionFilter.FilterResult.FILTER_ACCEPT,q=core.PositionFilter.FilterResult.FILTER_REJECT,e=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,a=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,m={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(c){var f=c.container(),l=c.leftNode(),r=c.rightNode(),p=c.unfilteredDomOffset,s=function(){return c.unfilteredDomOffset()-1};f.nodeType===h&&(null===r&&(r=d(f,1,c.getNodeFilter())),null===l&&(l=
-d(f,-1,c.getNodeFilter())));f!==r&&(p=function(){return 0});f!==l&&null!==l&&(s=function(){return l.textContent.length-1});f=b(l,s);r=b(r,p);return f===m.WORD_CHAR&&r===m.WORD_CHAR||f===m.PUNCTUATION_CHAR&&r===m.PUNCTUATION_CHAR||k===e&&f!==m.NO_NEIGHBOUR&&r===m.SPACE_CHAR||k===a&&f===m.SPACE_CHAR&&r!==m.NO_NEIGHBOUR?q:n}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function d(a){var b=a.spec();if(a.isEdit||b.memberid===k)G=void 0,E.cancel()}function b(){var a=t.getCursor(k).getNode();return t.createStepIterator(a,0,[s,w],t.getRootElement(a))}function c(a,b,e){e=new odf.WordBoundaryFilter(t,e);var c=t.getRootElement(a)||t.getRootNode(),d=t.createRootFilter(c);return t.createStepIterator(a,b,[s,d,e],c)}function h(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 r(a,b,e){var c=new ops.OpMoveCursor;c.init({memberid:k,position:a,length:b||0,selectionType:e});return c}function l(a,b,e){var c;c=t.getCursor(k);c=h(c.getSelectedRange(),c.hasForwardSelection());c.focusNode=a;c.focusOffset=b;e||(c.anchorNode=c.focusNode,c.anchorOffset=c.focusOffset);a=t.convertDomToCursorRange(c);f.enqueue([r(a.position,a.length)])}function p(a){var b;b=c(a.startContainer,
-a.startOffset,F);b.roundToPreviousStep()&&a.setStart(b.container(),b.offset());b=c(a.endContainer,a.endOffset,H);b.roundToNextStep()&&a.setEnd(b.container(),b.offset())}function n(a){var b=y.getParagraphElements(a),e=b[0],b=b[b.length-1];e&&a.setStart(e,0);b&&(y.isParagraph(a.endContainer)&&0===a.endOffset?a.setEndBefore(b):a.setEnd(b,b.childNodes.length))}function q(a,b,e,c){var d,f;c?(d=e.startContainer,f=e.startOffset):(d=e.endContainer,f=e.endOffset);v.containsNode(a,d)||(f=0>v.comparePoints(a,
-0,d,f)?0:a.childNodes.length,d=a);a=t.createStepIterator(d,f,b,y.getParagraphElement(d)||a);a.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");c?e.setStart(a.container(),a.offset()):e.setEnd(a.container(),a.offset())}function e(a,e){var c=b();c.advanceStep(a)&&l(c.container(),c.offset(),e)}function a(a,e){var c,d=G,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===d&&A&&(d=A());isNaN(d)||(c=b(),x.moveToFilteredStep(c,a,f)&&c.advanceStep(a)&&(f=[new gui.ClosestXOffsetScanner(d),
-new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,a,f)&&(l(c.container(),c.offset(),e),G=d,E.restart())))}function m(a,e){var c=b(),d=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,a,d)&&l(c.container(),c.offset(),e)}function g(a,b){var e=t.getCursor(k),e=h(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,F);e.advanceStep(a)&&l(e.container(),e.offset(),b)}function z(a,b,e){var c=!1,d=t.getCursor(k),
-d=h(d.getSelectedRange(),d.hasForwardSelection()),c=t.getRootElement(d.focusNode);runtime.assert(Boolean(c),"SelectionController: Cursor outside root");d=t.createStepIterator(d.focusNode,d.focusOffset,[s,w],c);d.roundToClosestStep();d.advanceStep(a)&&(e=e(d.container()))&&(a===N?(d.setPosition(e,0),c=d.roundToNextStep()):(d.setPosition(e,e.childNodes.length),c=d.roundToPreviousStep()),c&&l(d.container(),d.offset(),b))}var t=f.getOdtDocument(),v=new core.DomUtils,y=new odf.OdfUtils,s=t.getPositionFilter(),
-x=new gui.GuiStepUtils,w=t.createRootFilter(k),A=null,G,E,F=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,H=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,N=core.StepDirection.PREVIOUS,I=core.StepDirection.NEXT;this.selectionToRange=function(a){var b=0<=v.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset),e=a.focusNode.ownerDocument.createRange();b?(e.setStart(a.anchorNode,a.anchorOffset),e.setEnd(a.focusNode,a.focusOffset)):(e.setStart(a.focusNode,a.focusOffset),e.setEnd(a.anchorNode,
-a.anchorOffset));return{range:e,hasForwardSelection:b}};this.rangeToSelection=h;this.selectImage=function(a){var b=t.getRootElement(a),e=t.createRootFilter(b),b=t.createStepIterator(a,0,[e,t.getPositionFilter()],b),c;b.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");e=b.container();c=b.offset();b.setPosition(a,a.childNodes.length);b.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");a=t.convertDomToCursorRange({anchorNode:e,anchorOffset:c,focusNode:b.container(),
-focusOffset:b.offset()});a=r(a.position,a.length,ops.OdtCursor.RegionSelection);f.enqueue([a])};this.expandToWordBoundaries=p;this.expandToParagraphBoundaries=n;this.selectRange=function(a,b,e){var c=t.getOdfCanvas().getElement(),d,g=[s];d=v.containsNode(c,a.startContainer);c=v.containsNode(c,a.endContainer);if(d||c)if(d&&c&&(2===e?p(a):3<=e&&n(a)),(e=b?t.getRootElement(a.startContainer):t.getRootElement(a.endContainer))||(e=t.getRootNode()),g.push(t.createRootFilter(e)),q(e,g,a,!0),q(e,g,a,!1),a=
-h(a,b),b=t.convertDomToCursorRange(a),a=t.getCursorSelection(k),b.position!==a.position||b.length!==a.length)a=r(b.position,b.length,ops.OdtCursor.RangeSelection),f.enqueue([a])};this.moveCursorToLeft=function(){e(N,!1);return!0};this.moveCursorToRight=function(){e(I,!1);return!0};this.extendSelectionToLeft=function(){e(N,!0);return!0};this.extendSelectionToRight=function(){e(I,!0);return!0};this.setCaretXPositionLocator=function(a){A=a};this.moveCursorUp=function(){a(N,!1);return!0};this.moveCursorDown=
-function(){a(I,!1);return!0};this.extendSelectionUp=function(){a(N,!0);return!0};this.extendSelectionDown=function(){a(I,!0);return!0};this.moveCursorBeforeWord=function(){g(N,!1);return!0};this.moveCursorPastWord=function(){g(I,!1);return!0};this.extendSelectionBeforeWord=function(){g(N,!0);return!0};this.extendSelectionPastWord=function(){g(I,!0);return!0};this.moveCursorToLineStart=function(){m(N,!1);return!0};this.moveCursorToLineEnd=function(){m(I,!1);return!0};this.extendSelectionToLineStart=
-function(){m(N,!0);return!0};this.extendSelectionToLineEnd=function(){m(I,!0);return!0};this.extendSelectionToParagraphStart=function(){z(N,!0,t.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){z(I,!0,t.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){z(N,!1,t.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){z(I,!1,t.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){z(N,!1,t.getRootElement);return!0};
-this.moveCursorToDocumentEnd=function(){z(I,!1,t.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){z(N,!0,t.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){z(I,!0,t.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var a=t.getCursor(k),a=t.getRootElement(a.getNode()),b,e,c;runtime.assert(Boolean(a),"SelectionController: Cursor outside root");c=t.createStepIterator(a,0,[s,w],a);c.roundToClosestStep();b=c.container();e=c.offset();
-c.setPosition(a,a.childNodes.length);c.roundToClosestStep();a=t.convertDomToCursorRange({anchorNode:b,anchorOffset:e,focusNode:c.container(),focusOffset:c.offset()});f.enqueue([r(a.position,a.length)]);return!0};this.destroy=function(a){t.unsubscribe(ops.OdtDocument.signalOperationStart,d);core.Async.destroyAll([E.destroy],a)};(function(){E=core.Task.createTimeoutTask(function(){G=void 0},2E3);t.subscribe(ops.OdtDocument.signalOperationStart,d)})()};gui.TextController=function(f,k,d,b,c,h){function r(){t=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?d.isLocalCursorWithinOwnAnnotation():!0}function l(a){a.getMemberId()===b&&r()}function p(a){return a===ops.OdtStepsTranslator.NEXT_STEP}function n(a,b,e){var c=[m.getPositionFilter()];e&&c.push(m.createRootFilter(a.startContainer));e=m.createStepIterator(a.startContainer,a.startOffset,c,b);e.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");
-b=m.convertDomPointToCursorStep(e.container(),e.offset());a.collapsed?a=b:(e.setPosition(a.endContainer,a.endOffset),e.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),a=m.convertDomPointToCursorStep(e.container(),e.offset()));return{position:b,length:a-b}}function q(a){var e,c,d,f=g.getParagraphElements(a),h=a.cloneRange(),k=[];e=f[0];1a.length&&(a.position+=a.length,a.length=-a.length);return a}
-function a(a){if(!t)return!1;var c,d=m.getCursor(b).getSelectedRange().cloneRange(),g=e(m.getCursorSelection(b)),h;if(0===g.length){g=void 0;c=m.getCursor(b).getNode();h=m.getRootElement(c);var k=[m.getPositionFilter(),m.createRootFilter(h)];h=m.createStepIterator(c,0,k,h);h.roundToClosestStep()&&(a?h.nextStep():h.previousStep())&&(g=e(m.convertDomToCursorRange({anchorNode:c,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),a?(d.setStart(c,0),d.setEnd(h.container(),h.offset())):(d.setStart(h.container(),
-h.offset()),d.setEnd(c,0)))}g&&f.enqueue(q(d));return void 0!==g}var m=f.getOdtDocument(),g=new odf.OdfUtils,z=new core.DomUtils,t=!1,v=odf.Namespaces.textns;this.isEnabled=function(){return t};this.enqueueParagraphSplittingOps=function(){if(!t)return!1;var a=m.getCursor(b),c=a.getSelectedRange(),d=e(m.getCursorSelection(b)),g=[],a=m.getParagraphElement(a.getNode()),k=a.getAttributeNS(v,"style-name")||"";0=h.width&&(h=null),f.detach();else if(k.isCharacterElement(c.container)||k.isCharacterFrame(c.container))h=d.getBoundingClientRect(c.container);
+return h}var k=odf.OdfUtils,a=new odf.StepUtils,d=core.DomUtils,c=core.StepDirection.NEXT,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT,q=gui.StepInfo.VisualDirection.RIGHT_TO_LEFT;this.getContentRect=f;this.moveToFilteredStep=function(a,d,k){function r(b,a){a.process(v,g,u)&&(b=!0,!t&&a.token&&(t=a.token));return b}var b=d===c,e,n,g,u,t,y=a.snapshot();e=!1;var v;do e=f(a),v={token:a.snapshot(),container:a.container,offset:a.offset,direction:d,visualDirection:d===c?h:q},n=a.nextStep()?f(a):null,a.restore(v.token),
+b?(g=e,u=n):(g=n,u=e),e=k.reduce(r,!1);while(!e&&a.advanceStep(d));e||k.forEach(function(b){!t&&b.token&&(t=b.token)});a.restore(t||y);return Boolean(t)}};gui.Caret=function(f,k,a,d){function c(){r.style.opacity="0"===r.style.opacity?"1":"0";x.trigger()}function h(){g.selectNodeContents(n);return g.getBoundingClientRect()}function q(){Object.keys(C).forEach(function(b){F[b]=C[b]})}function p(){if(!1===C.isShown||f.getSelectionType()!==ops.OdtCursor.RangeSelection||!d&&!f.getSelectedRange().collapsed)C.visibility="hidden",r.style.visibility="hidden",x.cancel();else if(C.visibility="visible",r.style.visibility="visible",!1===C.isFocused)r.style.opacity=
+"1",x.cancel();else{if(w||F.visibility!==C.visibility)r.style.opacity="1",x.cancel();x.trigger()}if(I||B){var a;a=f.getNode();var c,g,n=t.getBoundingClientRect(u.getSizer()),m=!1,p=0;a.removeAttributeNS("urn:webodf:names:cursor","caret-sizer-active");if(0a.height&&(a={top:a.top-(8-a.height)/2,height:8,right:a.right});l.style.height=a.height+"px";l.style.top=a.top+"px";l.style.left=a.right-
+a.width+"px";l.style.width=a.width?a.width+"px":"";e&&(a=runtime.getWindow().getComputedStyle(f.getNode(),null),a.font?e.style.font=a.font:(e.style.fontStyle=a.fontStyle,e.style.fontVariant=a.fontVariant,e.style.fontWeight=a.fontWeight,e.style.fontSize=a.fontSize,e.style.lineHeight=a.lineHeight,e.style.fontFamily=a.fontFamily))}C.isShown&&B&&k.scrollIntoView(r.getBoundingClientRect());F.isFocused!==C.isFocused&&b.markAsFocussed(C.isFocused);q();I=B=w=!1}function m(b){l.parentNode.removeChild(l);n.parentNode.removeChild(n);
+b()}var l,r,b,e,n,g,u=f.getDocument().getCanvas(),t=core.DomUtils,y=new gui.GuiStepUtils,v,s,x,w=!1,B=!1,I=!1,C={isFocused:!1,isShown:!0,visibility:"hidden"},F={isFocused:!C.isFocused,isShown:!C.isShown,visibility:"hidden"};this.handleUpdate=function(){I=!0;s.trigger()};this.refreshCursorBlinking=function(){w=!0;s.trigger()};this.setFocus=function(){C.isFocused=!0;s.trigger()};this.removeFocus=function(){C.isFocused=!1;s.trigger()};this.show=function(){C.isShown=!0;s.trigger()};this.hide=function(){C.isShown=
+!1;s.trigger()};this.setAvatarImageUrl=function(a){b.setImageUrl(a)};this.setColor=function(a){r.style.borderColor=a;b.setColor(a)};this.getCursor=function(){return f};this.getFocusElement=function(){return r};this.toggleHandleVisibility=function(){b.isVisible()?b.hide():b.show()};this.showHandle=function(){b.show()};this.hideHandle=function(){b.hide()};this.setOverlayElement=function(b){e=b;l.appendChild(b);I=!0;s.trigger()};this.ensureVisible=function(){B=!0;s.trigger()};this.getBoundingClientRect=
+function(){return t.getBoundingClientRect(l)};this.destroy=function(a){core.Async.destroyAll([s.destroy,x.destroy,b.destroy,m],a)};(function(){var e=f.getDocument(),d=[e.createRootFilter(f.getMemberId()),e.getPositionFilter()],h=e.getDOMDocument();g=h.createRange();n=h.createElement("span");n.className="webodf-caretSizer";n.textContent="|";f.getNode().appendChild(n);l=h.createElement("div");l.setAttributeNS("urn:webodf:names:editinfo","editinfo:memberid",f.getMemberId());l.className="webodf-caretOverlay";
+r=h.createElement("div");r.className="caret";l.appendChild(r);b=new gui.Avatar(l,a);u.getSizer().appendChild(l);v=e.createStepIterator(f.getNode(),0,d,e.getRootNode());s=core.Task.createRedrawTask(p);x=core.Task.createTimeoutTask(c,500);s.triggerImmediate()})()};odf.TextSerializer=function(){function f(d){var c="",h=k.filter?k.filter.acceptNode(d):NodeFilter.FILTER_ACCEPT,q=d.nodeType,p;if((h===NodeFilter.FILTER_ACCEPT||h===NodeFilter.FILTER_SKIP)&&a.isTextContentContainingNode(d))for(p=d.firstChild;p;)c+=f(p),p=p.nextSibling;h===NodeFilter.FILTER_ACCEPT&&(q===Node.ELEMENT_NODE&&a.isParagraph(d)?c+="\n":q===Node.TEXT_NODE&&d.textContent&&(c+=d.textContent));return c}var k=this,a=odf.OdfUtils;this.filter=null;this.writeToString=function(a){if(!a)return"";
+a=f(a);"\n"===a[a.length-1]&&(a=a.substr(0,a.length-1));return a}};gui.MimeDataExporter=function(){var f;this.exportRangeToDataTransfer=function(k,a){var d;d=a.startContainer.ownerDocument.createElement("span");d.appendChild(a.cloneContents());d=f.writeToString(d);try{k.setData("text/plain",d)}catch(c){k.setData("Text",d)}};f=new odf.TextSerializer;f.filter=new odf.OdfNodeFilter};gui.Clipboard=function(f){this.setDataFromRange=function(k,a){var d,c=k.clipboardData;d=runtime.getWindow();!c&&d&&(c=d.clipboardData);c?(d=!0,f.exportRangeToDataTransfer(c,a),k.preventDefault()):d=!1;return d}};gui.SessionContext=function(f,k){var a=f.getOdtDocument(),d=odf.OdfUtils;this.isLocalCursorWithinOwnAnnotation=function(){var c=a.getCursor(k),f;if(!c)return!1;f=c&&c.getNode();c=a.getMember(k).getProperties().fullName;return(f=d.getParentAnnotation(f,a.getRootNode()))&&d.getAnnotationCreator(f)===c?!0:!1}};gui.StyleSummary=function(f){function k(a,d){var k=a+"|"+d,m;c.hasOwnProperty(k)||(m=[],f.forEach(function(c){c=(c=c.styleProperties[a])&&c[d];-1===m.indexOf(c)&&m.push(c)}),c[k]=m);return c[k]}function a(a,c,d){return function(){var f=k(a,c);return d.length>=f.length&&f.every(function(a){return-1!==d.indexOf(a)})}}function d(a,c){var d=k(a,c);return 1===d.length?d[0]:void 0}var c={};this.getPropertyValues=k;this.getCommonValue=d;this.isBold=a("style:text-properties","fo:font-weight",["bold"]);this.isItalic=
+a("style:text-properties","fo:font-style",["italic"]);this.hasUnderline=a("style:text-properties","style:text-underline-style",["solid"]);this.hasStrikeThrough=a("style:text-properties","style:text-line-through-style",["solid"]);this.fontSize=function(){var a=d("style:text-properties","fo:font-size");return a&&parseFloat(a)};this.fontName=function(){return d("style:text-properties","style:font-name")};this.isAlignedLeft=a("style:paragraph-properties","fo:text-align",["left","start"]);this.isAlignedCenter=
+a("style:paragraph-properties","fo:text-align",["center"]);this.isAlignedRight=a("style:paragraph-properties","fo:text-align",["right","end"]);this.isAlignedJustified=a("style:paragraph-properties","fo:text-align",["justify"]);this.text={isBold:this.isBold,isItalic:this.isItalic,hasUnderline:this.hasUnderline,hasStrikeThrough:this.hasStrikeThrough,fontSize:this.fontSize,fontName:this.fontName};this.paragraph={isAlignedLeft:this.isAlignedLeft,isAlignedCenter:this.isAlignedCenter,isAlignedRight:this.isAlignedRight,
+isAlignedJustified:this.isAlignedJustified}};gui.DirectFormattingController=function(f,k,a,d,c,h,q){function p(){return V.value().styleSummary}function m(){return V.value().enabledFeatures}function l(b){var a;b.collapsed?(a=b.startContainer,a.hasChildNodes()&&b.startOffsetb.clientWidth||b.scrollHeight>b.clientHeight)&&a.push(new r(b)),b=b.parentNode;a.push(new l(s));return a}function v(){var b;
+g()||(b=y(C),t(),C.focus(),b.forEach(function(b){b.restore()}))}var s=runtime.getWindow(),x={beforecut:!0,beforepaste:!0,longpress:!0,drag:!0,dragstop:!0},w={mousedown:!0,mouseup:!0,focus:!0},B={},I={},C,F=f.getCanvas().getElement(),J=this,N={};this.addFilter=function(a,c){b(a,!0).filters.push(c)};this.removeFilter=function(a,c){var e=b(a,!0),d=e.filters.indexOf(c);-1!==d&&e.filters.splice(d,1)};this.subscribe=e;this.unsubscribe=n;this.hasFocus=g;this.focus=v;this.getEventTrap=function(){return C};
+this.setEditing=function(b){var a=g();a&&C.blur();b?C.removeAttribute("readOnly"):C.setAttribute("readOnly","true");a&&v()};this.destroy=function(b){n("touchstart",m);Object.keys(N).forEach(function(b){d(parseInt(b,10))});N.length=0;Object.keys(B).forEach(function(b){B[b].destroy()});B={};n("mousedown",u);n("mouseup",t);n("contextmenu",t);Object.keys(I).forEach(function(b){I[b].destroy()});I={};C.parentNode.removeChild(C);b()};(function(){var b=f.getOdfCanvas().getSizer(),c=b.ownerDocument;runtime.assert(Boolean(s),
+"EventManager requires a window object to operate correctly");C=c.createElement("textarea");C.id="eventTrap";C.setAttribute("tabindex","-1");C.setAttribute("readOnly","true");C.setAttribute("rows","1");b.appendChild(C);e("mousedown",u);e("mouseup",t);e("contextmenu",t);B.longpress=new a("longpress",["touchstart","touchmove","touchend"],h);B.drag=new a("drag",["touchstart","touchmove","touchend"],q);B.dragstop=new a("dragstop",["drag","touchend"],p);e("touchstart",m)})()};gui.IOSSafariSupport=function(f){function k(){a.innerHeight!==a.outerHeight&&(d.style.display="none",runtime.requestAnimationFrame(function(){d.style.display="block"}))}var a=runtime.getWindow(),d=f.getEventTrap();this.destroy=function(a){f.unsubscribe("focus",k);d.removeAttribute("autocapitalize");d.style.WebkitTransform="";a()};f.subscribe("focus",k);d.setAttribute("autocapitalize","off");d.style.WebkitTransform="translateX(-10000px)"};gui.HyperlinkController=function(f,k,a,d){function c(){var c=!0;!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)&&(c=a.isLocalCursorWithinOwnAnnotation());c!==l&&(l=c,m.emit(gui.HyperlinkController.enabledChanged,l))}function h(a){a.getMemberId()===d&&c()}var q=odf.OdfUtils,p=f.getOdtDocument(),m=new core.EventNotifier([gui.HyperlinkController.enabledChanged]),l=!1;this.isEnabled=function(){return l};this.subscribe=function(a,b){m.subscribe(a,b)};this.unsubscribe=function(a,b){m.unsubscribe(a,
+b)};this.addHyperlink=function(a,b){if(l){var c=p.getCursorSelection(d),h=new ops.OpApplyHyperlink,g=[];if(0===c.length||b)b=b||a,h=new ops.OpInsertText,h.init({memberid:d,position:c.position,text:b}),c.length=b.length,g.push(h);h=new ops.OpApplyHyperlink;h.init({memberid:d,position:c.position,length:c.length,hyperlink:a});g.push(h);f.enqueue(g)}};this.removeHyperlinks=function(){if(l){var a=p.createPositionIterator(p.getRootNode()),b=p.getCursor(d).getSelectedRange(),c=q.getHyperlinkElements(b),
+h=b.collapsed&&1===c.length,g=p.getDOMDocument().createRange(),k=[],m,y;0!==c.length&&(c.forEach(function(b){g.selectNodeContents(b);m=p.convertDomToCursorRange({anchorNode:g.startContainer,anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset});y=new ops.OpRemoveHyperlink;y.init({memberid:d,position:m.position,length:m.length});k.push(y)}),h||(h=c[0],-1===b.comparePoint(h,0)&&(g.setStart(h,0),g.setEnd(b.startContainer,b.startOffset),m=p.convertDomToCursorRange({anchorNode:g.startContainer,
+anchorOffset:g.startOffset,focusNode:g.endContainer,focusOffset:g.endOffset}),0h.width&&(q=h.width/k.width);k.height>h.height&&(s=h.height/k.height);h=Math.min(q,s);k={width:k.width*h,height:k.height*
+h}}h=k.width+"px";k=k.height+"px";var x=l.getOdfCanvas().odfContainer().rootElement.styles,q=a.toLowerCase(),s=p.hasOwnProperty(q)?p[q]:null,w,q=[];runtime.assert(null!==s,"Image type is not supported: "+a);s="Pictures/"+c.generateImageName()+s;w=new ops.OpSetBlob;w.init({memberid:d,filename:s,mimetype:a,content:e});q.push(w);b.getStyleElement("Graphics","graphic",[x])||(a=new ops.OpAddStyle,a.init({memberid:d,styleName:"Graphics",styleFamily:"graphic",isAutomaticStyle:!1,setProperties:{"style:graphic-properties":{"text:anchor-type":"paragraph",
+"svg:x":"0cm","svg:y":"0cm","style:wrap":"dynamic","style:number-wrapped-paragraphs":"no-limit","style:wrap-contour":"false","style:vertical-pos":"top","style:vertical-rel":"paragraph","style:horizontal-pos":"center","style:horizontal-rel":"paragraph"}}}),q.push(a));a=c.generateStyleName();e=new ops.OpAddStyle;e.init({memberid:d,styleName:a,styleFamily:"graphic",isAutomaticStyle:!0,setProperties:{"style:parent-style-name":"Graphics","style:graphic-properties":{"style:vertical-pos":"top","style:vertical-rel":"baseline",
+"style:horizontal-pos":"center","style:horizontal-rel":"paragraph","fo:background-color":"transparent","style:background-transparency":"100%","style:shadow":"none","style:mirror":"none","fo:clip":"rect(0cm, 0cm, 0cm, 0cm)","draw:luminance":"0%","draw:contrast":"0%","draw:red":"0%","draw:green":"0%","draw:blue":"0%","draw:gamma":"100%","draw:color-inversion":"false","draw:image-opacity":"100%","draw:color-mode":"standard"}}});q.push(e);w=new ops.OpInsertImage;w.init({memberid:d,position:l.getCursorPosition(d),
+filename:s,frameWidth:h,frameHeight:k,frameStyleName:a,frameName:c.generateFrameName()});q.push(w);f.enqueue(q)}};this.destroy=function(b){l.unsubscribe(ops.Document.signalCursorMoved,q);k.unsubscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);b()};l.subscribe(ops.Document.signalCursorMoved,q);k.subscribe(gui.CommonConstraints.EDIT.REVIEW_MODE,h);h()};gui.ImageController.enabledChanged="enabled/changed";gui.ImageSelector=function(f){function k(){var a=f.getSizer(),h=c.createElement("div");h.id="imageSelector";h.style.borderWidth="1px";a.appendChild(h);d.forEach(function(a){var d=c.createElement("div");d.className=a;h.appendChild(d)});return h}var a=odf.Namespaces.svgns,d="topLeft topRight bottomRight bottomLeft topMiddle rightMiddle bottomMiddle leftMiddle".split(" "),c=f.getElement().ownerDocument,h=!1;this.select=function(d){var p,m,l=c.getElementById("imageSelector");l||(l=k());h=!0;p=l.parentNode;
+m=d.getBoundingClientRect();var r=p.getBoundingClientRect(),b=f.getZoomLevel();p=(m.left-r.left)/b-1;m=(m.top-r.top)/b-1;l.style.display="block";l.style.left=p+"px";l.style.top=m+"px";l.style.width=d.getAttributeNS(a,"width");l.style.height=d.getAttributeNS(a,"height")};this.clearSelection=function(){var a;h&&(a=c.getElementById("imageSelector"))&&(a.style.display="none");h=!1};this.isSelectorElement=function(a){var d=c.getElementById("imageSelector");return d?a===d||a.parentNode===d:!1}};(function(){function f(f){function a(a){q=a.which&&String.fromCharCode(a.which)===h;h=void 0;return!1===q}function d(){q=!1}function c(a){h=a.data;q=!1}var h,q=!1;this.destroy=function(h){f.unsubscribe("textInput",d);f.unsubscribe("compositionend",c);f.removeFilter("keypress",a);h()};f.subscribe("textInput",d);f.subscribe("compositionend",c);f.addFilter("keypress",a)}gui.InputMethodEditor=function(k,a){function d(a){e&&(a?e.getNode().setAttributeNS(b,"composing","true"):(e.getNode().removeAttributeNS(b,
+"composing"),u.textContent=""))}function c(){y&&(y=!1,d(!1),s.emit(gui.InputMethodEditor.signalCompositionEnd,{data:v}),v="")}function h(){C||(C=!0,c(),e&&e.getSelectedRange().collapsed?n.value="":n.value=w.writeToString(e.getSelectedRange().cloneContents()),n.setSelectionRange(0,n.value.length),C=!1)}function q(){a.hasFocus()&&t.trigger()}function p(){x=void 0;t.cancel();d(!0);y||s.emit(gui.InputMethodEditor.signalCompositionStart,{data:""})}function m(b){b=x=b.data;y=!0;v+=b;t.trigger()}function l(b){b.data!==
+x&&(b=b.data,y=!0,v+=b,t.trigger());x=void 0}function r(){u.textContent=n.value}var b="urn:webodf:names:cursor",e=null,n=a.getEventTrap(),g=n.ownerDocument,u,t,y=!1,v="",s=new core.EventNotifier([gui.InputMethodEditor.signalCompositionStart,gui.InputMethodEditor.signalCompositionEnd]),x,w,B=[],I,C=!1;this.subscribe=s.subscribe;this.unsubscribe=s.unsubscribe;this.registerCursor=function(b){b.getMemberId()===k&&(e=b,e.getNode().appendChild(u),b.subscribe(ops.OdtCursor.signalCursorUpdated,q),a.subscribe("input",
+r),a.subscribe("compositionupdate",r))};this.removeCursor=function(b){e&&b===k&&(e.getNode().removeChild(u),e.unsubscribe(ops.OdtCursor.signalCursorUpdated,q),a.unsubscribe("input",r),a.unsubscribe("compositionupdate",r),e=null)};this.destroy=function(b){a.unsubscribe("compositionstart",p);a.unsubscribe("compositionend",m);a.unsubscribe("textInput",l);a.unsubscribe("keypress",c);a.unsubscribe("focus",h);core.Async.destroyAll(I,b)};(function(){w=new odf.TextSerializer;w.filter=new odf.OdfNodeFilter;
+a.subscribe("compositionstart",p);a.subscribe("compositionend",m);a.subscribe("textInput",l);a.subscribe("keypress",c);a.subscribe("focus",h);B.push(new f(a));I=B.map(function(b){return b.destroy});u=g.createElement("span");u.setAttribute("id","composer");t=core.Task.createTimeoutTask(h,1);I.push(t.destroy)})()};gui.InputMethodEditor.signalCompositionStart="input/compositionstart";gui.InputMethodEditor.signalCompositionEnd="input/compositionend"})();gui.MetadataController=function(f,k){function a(a){h.emit(gui.MetadataController.signalMetadataChanged,a)}function d(a){var c=-1===q.indexOf(a);c||runtime.log("Setting "+a+" is restricted.");return c}var c=f.getOdtDocument(),h=new core.EventNotifier([gui.MetadataController.signalMetadataChanged]),q=["dc:creator","dc:date","meta:editing-cycles","meta:editing-duration","meta:document-statistic"];this.setMetadata=function(a,c){var h={},q="",b;a&&Object.keys(a).filter(d).forEach(function(b){h[b]=a[b]});
+c&&(q=c.filter(d).join(","));if(0c:!1}function a(a){null!==a&&!1===k(a)&&(c=Math.abs(a-f))}var d=this,c,h=gui.StepInfo.VisualDirection.LEFT_TO_RIGHT;this.token=void 0;this.process=function(c,f,m){var l,r;c.visualDirection===h?(l=f&&f.right,r=m&&m.left):(l=f&&f.left,r=m&&m.right);if(k(l)||k(r))return!0;if(f||m)a(l),a(r),d.token=c.token;return!1}};gui.LineBoundaryScanner=function(){var f=this,k=null;this.token=void 0;this.process=function(a,d,c){var h;if(h=c)if(k){var q=k;h=Math.min(q.bottom-q.top,c.bottom-c.top);var p=Math.max(q.top,c.top),q=Math.min(q.bottom,c.bottom)-p;h=0.4>=(0a?b.previousSibling:b.nextSibling,c(h)===NodeFilter.FILTER_ACCEPT&&(e=h),b=b.parentNode;return e}function d(b,a){var e;return null===b?n.NO_NEIGHBOUR:q.isCharacterElement(b)?n.SPACE_CHAR:b.nodeType===c||q.isTextSpan(b)||q.isHyperlink(b)?(e=b.textContent.charAt(a()),m.test(e)?n.SPACE_CHAR:p.test(e)?n.PUNCTUATION_CHAR:n.WORD_CHAR):n.OTHER}var c=Node.TEXT_NODE,h=Node.ELEMENT_NODE,
+q=odf.OdfUtils,p=/[!-#%-*,-\/:-;?-@\[-\]_{}\u00a1\u00ab\u00b7\u00bb\u00bf;\u00b7\u055a-\u055f\u0589-\u058a\u05be\u05c0\u05c3\u05c6\u05f3-\u05f4\u0609-\u060a\u060c-\u060d\u061b\u061e-\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0964-\u0965\u0970\u0df4\u0e4f\u0e5a-\u0e5b\u0f04-\u0f12\u0f3a-\u0f3d\u0f85\u0fd0-\u0fd4\u104a-\u104f\u10fb\u1361-\u1368\u166d-\u166e\u169b-\u169c\u16eb-\u16ed\u1735-\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u180a\u1944-\u1945\u19de-\u19df\u1a1e-\u1a1f\u1b5a-\u1b60\u1c3b-\u1c3f\u1c7e-\u1c7f\u2000-\u206e\u207d-\u207e\u208d-\u208e\u3008-\u3009\u2768-\u2775\u27c5-\u27c6\u27e6-\u27ef\u2983-\u2998\u29d8-\u29db\u29fc-\u29fd\u2cf9-\u2cfc\u2cfe-\u2cff\u2e00-\u2e7e\u3000-\u303f\u30a0\u30fb\ua60d-\ua60f\ua673\ua67e\ua874-\ua877\ua8ce-\ua8cf\ua92e-\ua92f\ua95f\uaa5c-\uaa5f\ufd3e-\ufd3f\ufe10-\ufe19\ufe30-\ufe52\ufe54-\ufe61\ufe63\ufe68\ufe6a-\ufe6b\uff01-\uff03\uff05-\uff0a\uff0c-\uff0f\uff1a-\uff1b\uff1f-\uff20\uff3b-\uff3d\uff3f\uff5b\uff5d\uff5f-\uff65]|\ud800[\udd00-\udd01\udf9f\udfd0]|\ud802[\udd1f\udd3f\ude50-\ude58]|\ud809[\udc00-\udc7e]/,
+m=/\s/,l=core.PositionFilter.FilterResult.FILTER_ACCEPT,r=core.PositionFilter.FilterResult.FILTER_REJECT,b=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,e=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,n={NO_NEIGHBOUR:0,SPACE_CHAR:1,PUNCTUATION_CHAR:2,WORD_CHAR:3,OTHER:4};this.acceptPosition=function(c){var f=c.container(),m=c.leftNode(),q=c.rightNode(),p=c.unfilteredDomOffset,s=function(){return c.unfilteredDomOffset()-1};f.nodeType===h&&(null===q&&(q=a(f,1,c.getNodeFilter())),null===m&&(m=
+a(f,-1,c.getNodeFilter())));f!==q&&(p=function(){return 0});f!==m&&null!==m&&(s=function(){return m.textContent.length-1});f=d(m,s);q=d(q,p);return f===n.WORD_CHAR&&q===n.WORD_CHAR||f===n.PUNCTUATION_CHAR&&q===n.PUNCTUATION_CHAR||k===b&&f!==n.NO_NEIGHBOUR&&q===n.SPACE_CHAR||k===e&&f===n.SPACE_CHAR&&q!==n.NO_NEIGHBOUR?r:l}};odf.WordBoundaryFilter.IncludeWhitespace={None:0,TRAILING:1,LEADING:2};gui.SelectionController=function(f,k){function a(b){var a=b.spec();if(b.isEdit||a.memberid===k)I=void 0,C.cancel()}function d(){var b=t.getCursor(k).getNode();return t.createStepIterator(b,0,[s,w],t.getRootElement(b))}function c(b,a,c){c=new odf.WordBoundaryFilter(t,c);var e=t.getRootElement(b)||t.getRootNode(),d=t.createRootFilter(e);return t.createStepIterator(b,a,[s,d,c],e)}function h(b,a){return a?{anchorNode:b.startContainer,anchorOffset:b.startOffset,focusNode:b.endContainer,focusOffset:b.endOffset}:
+{anchorNode:b.endContainer,anchorOffset:b.endOffset,focusNode:b.startContainer,focusOffset:b.startOffset}}function q(b,a,c){var e=new ops.OpMoveCursor;e.init({memberid:k,position:b,length:a||0,selectionType:c});return e}function p(b,a,c){var e;e=t.getCursor(k);e=h(e.getSelectedRange(),e.hasForwardSelection());e.focusNode=b;e.focusOffset=a;c||(e.anchorNode=e.focusNode,e.anchorOffset=e.focusOffset);b=t.convertDomToCursorRange(e);f.enqueue([q(b.position,b.length)])}function m(b){var a;a=c(b.startContainer,
+b.startOffset,F);a.roundToPreviousStep()&&b.setStart(a.container(),a.offset());a=c(b.endContainer,b.endOffset,J);a.roundToNextStep()&&b.setEnd(a.container(),a.offset())}function l(b){var a=v.getParagraphElements(b),c=a[0],a=a[a.length-1];c&&b.setStart(c,0);a&&(v.isParagraph(b.endContainer)&&0===b.endOffset?b.setEndBefore(a):b.setEnd(a,a.childNodes.length))}function r(b,a,c,e){var d,f;e?(d=c.startContainer,f=c.startOffset):(d=c.endContainer,f=c.endOffset);y.containsNode(b,d)||(f=0>y.comparePoints(b,
+0,d,f)?0:b.childNodes.length,d=b);b=t.createStepIterator(d,f,a,v.getParagraphElement(d)||b);b.roundToClosestStep()||runtime.assert(!1,"No step found in requested range");e?c.setStart(b.container(),b.offset()):c.setEnd(b.container(),b.offset())}function b(b,a){var c=d();c.advanceStep(b)&&p(c.container(),c.offset(),a)}function e(b,a){var c,e=I,f=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];void 0===e&&B&&(e=B());isNaN(e)||(c=d(),x.moveToFilteredStep(c,b,f)&&c.advanceStep(b)&&(f=[new gui.ClosestXOffsetScanner(e),
+new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner],x.moveToFilteredStep(c,b,f)&&(p(c.container(),c.offset(),a),I=e,C.restart())))}function n(b,a){var c=d(),e=[new gui.LineBoundaryScanner,new gui.ParagraphBoundaryScanner];x.moveToFilteredStep(c,b,e)&&p(c.container(),c.offset(),a)}function g(b,a){var e=t.getCursor(k),e=h(e.getSelectedRange(),e.hasForwardSelection()),e=c(e.focusNode,e.focusOffset,F);e.advanceStep(b)&&p(e.container(),e.offset(),a)}function u(b,a,c){var e=!1,d=t.getCursor(k),
+d=h(d.getSelectedRange(),d.hasForwardSelection()),e=t.getRootElement(d.focusNode);runtime.assert(Boolean(e),"SelectionController: Cursor outside root");d=t.createStepIterator(d.focusNode,d.focusOffset,[s,w],e);d.roundToClosestStep();d.advanceStep(b)&&(c=c(d.container()))&&(b===N?(d.setPosition(c,0),e=d.roundToNextStep()):(d.setPosition(c,c.childNodes.length),e=d.roundToPreviousStep()),e&&p(d.container(),d.offset(),a))}var t=f.getOdtDocument(),y=core.DomUtils,v=odf.OdfUtils,s=t.getPositionFilter(),
+x=new gui.GuiStepUtils,w=t.createRootFilter(k),B=null,I,C,F=odf.WordBoundaryFilter.IncludeWhitespace.TRAILING,J=odf.WordBoundaryFilter.IncludeWhitespace.LEADING,N=core.StepDirection.PREVIOUS,K=core.StepDirection.NEXT;this.selectionToRange=function(b){var a=0<=y.comparePoints(b.anchorNode,b.anchorOffset,b.focusNode,b.focusOffset),c=b.focusNode.ownerDocument.createRange();a?(c.setStart(b.anchorNode,b.anchorOffset),c.setEnd(b.focusNode,b.focusOffset)):(c.setStart(b.focusNode,b.focusOffset),c.setEnd(b.anchorNode,
+b.anchorOffset));return{range:c,hasForwardSelection:a}};this.rangeToSelection=h;this.selectImage=function(b){var a=t.getRootElement(b),c=t.createRootFilter(a),a=t.createStepIterator(b,0,[c,t.getPositionFilter()],a),e;a.roundToPreviousStep()||runtime.assert(!1,"No walkable position before frame");c=a.container();e=a.offset();a.setPosition(b,b.childNodes.length);a.roundToNextStep()||runtime.assert(!1,"No walkable position after frame");b=t.convertDomToCursorRange({anchorNode:c,anchorOffset:e,focusNode:a.container(),
+focusOffset:a.offset()});b=q(b.position,b.length,ops.OdtCursor.RegionSelection);f.enqueue([b])};this.expandToWordBoundaries=m;this.expandToParagraphBoundaries=l;this.selectRange=function(b,a,c){var e=t.getOdfCanvas().getElement(),d,g=[s];d=y.containsNode(e,b.startContainer);e=y.containsNode(e,b.endContainer);if(d||e)if(d&&e&&(2===c?m(b):3<=c&&l(b)),(c=a?t.getRootElement(b.startContainer):t.getRootElement(b.endContainer))||(c=t.getRootNode()),g.push(t.createRootFilter(c)),r(c,g,b,!0),r(c,g,b,!1),b=
+h(b,a),a=t.convertDomToCursorRange(b),b=t.getCursorSelection(k),a.position!==b.position||a.length!==b.length)b=q(a.position,a.length,ops.OdtCursor.RangeSelection),f.enqueue([b])};this.moveCursorToLeft=function(){b(N,!1);return!0};this.moveCursorToRight=function(){b(K,!1);return!0};this.extendSelectionToLeft=function(){b(N,!0);return!0};this.extendSelectionToRight=function(){b(K,!0);return!0};this.setCaretXPositionLocator=function(b){B=b};this.moveCursorUp=function(){e(N,!1);return!0};this.moveCursorDown=
+function(){e(K,!1);return!0};this.extendSelectionUp=function(){e(N,!0);return!0};this.extendSelectionDown=function(){e(K,!0);return!0};this.moveCursorBeforeWord=function(){g(N,!1);return!0};this.moveCursorPastWord=function(){g(K,!1);return!0};this.extendSelectionBeforeWord=function(){g(N,!0);return!0};this.extendSelectionPastWord=function(){g(K,!0);return!0};this.moveCursorToLineStart=function(){n(N,!1);return!0};this.moveCursorToLineEnd=function(){n(K,!1);return!0};this.extendSelectionToLineStart=
+function(){n(N,!0);return!0};this.extendSelectionToLineEnd=function(){n(K,!0);return!0};this.extendSelectionToParagraphStart=function(){u(N,!0,v.getParagraphElement);return!0};this.extendSelectionToParagraphEnd=function(){u(K,!0,v.getParagraphElement);return!0};this.moveCursorToParagraphStart=function(){u(N,!1,v.getParagraphElement);return!0};this.moveCursorToParagraphEnd=function(){u(K,!1,v.getParagraphElement);return!0};this.moveCursorToDocumentStart=function(){u(N,!1,t.getRootElement);return!0};
+this.moveCursorToDocumentEnd=function(){u(K,!1,t.getRootElement);return!0};this.extendSelectionToDocumentStart=function(){u(N,!0,t.getRootElement);return!0};this.extendSelectionToDocumentEnd=function(){u(K,!0,t.getRootElement);return!0};this.extendSelectionToEntireDocument=function(){var b=t.getCursor(k),b=t.getRootElement(b.getNode()),a,c,e;runtime.assert(Boolean(b),"SelectionController: Cursor outside root");e=t.createStepIterator(b,0,[s,w],b);e.roundToClosestStep();a=e.container();c=e.offset();
+e.setPosition(b,b.childNodes.length);e.roundToClosestStep();b=t.convertDomToCursorRange({anchorNode:a,anchorOffset:c,focusNode:e.container(),focusOffset:e.offset()});f.enqueue([q(b.position,b.length)]);return!0};this.destroy=function(b){t.unsubscribe(ops.OdtDocument.signalOperationStart,a);core.Async.destroyAll([C.destroy],b)};(function(){C=core.Task.createTimeoutTask(function(){I=void 0},2E3);t.subscribe(ops.OdtDocument.signalOperationStart,a)})()};gui.TextController=function(f,k,a,d,c,h){function q(){u=!0===k.getState(gui.CommonConstraints.EDIT.REVIEW_MODE)?a.isLocalCursorWithinOwnAnnotation():!0}function p(b){b.getMemberId()===d&&q()}function m(b,a,c){var d=[e.getPositionFilter()];c&&d.push(e.createRootFilter(b.startContainer));c=e.createStepIterator(b.startContainer,b.startOffset,d,a);c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range start");a=e.convertDomPointToCursorStep(c.container(),c.offset());
+b.collapsed?b=a:(c.setPosition(b.endContainer,b.endOffset),c.roundToClosestStep()||runtime.assert(!1,"No walkable step found in paragraph element at range end"),b=e.convertDomPointToCursorStep(c.container(),c.offset()));return{position:a,length:b-a}}function l(b){var a,c,e,f=n.getParagraphElements(b),h=b.cloneRange(),k=[];a=f[0];1b.length&&(b.position+=b.length,b.length=-b.length);return b}function b(b){if(!u)return!1;var a,c=e.getCursor(d).getSelectedRange().cloneRange(),
+g=r(e.getCursorSelection(d)),h;if(0===g.length){g=void 0;a=e.getCursor(d).getNode();h=e.getRootElement(a);var k=[e.getPositionFilter(),e.createRootFilter(h)];h=e.createStepIterator(a,0,k,h);h.roundToClosestStep()&&(b?h.nextStep():h.previousStep())&&(g=r(e.convertDomToCursorRange({anchorNode:a,anchorOffset:0,focusNode:h.container(),focusOffset:h.offset()})),b?(c.setStart(a,0),c.setEnd(h.container(),h.offset())):(c.setStart(h.container(),h.offset()),c.setEnd(a,0)))}g&&f.enqueue(l(c));return void 0!==
+g}var e=f.getOdtDocument(),n=odf.OdfUtils,g=core.DomUtils,u=!1,t=odf.Namespaces.textns,y=core.StepDirection.NEXT;this.isEnabled=function(){return u};this.enqueueParagraphSplittingOps=function(){if(!u)return!1;var b=e.getCursor(d),a=b.getSelectedRange(),c=r(e.getCursorSelection(d)),g=[],b=n.getParagraphElement(b.getNode()),k=b.getAttributeNS(t,"style-name")||"";0c.left&&(c=x(d)))b.focusNode=c.container,b.focusOffset=c.offset,e&&(b.anchorNode=b.focusNode,b.anchorOffset=b.focusOffset)}else D.isImage(b.focusNode.firstChild)&&1===b.focusOffset&&D.isCharacterFrame(b.focusNode)&&(c=x(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));R.focus()}function A(a){var b;if(b=r(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),R.focus()}function G(a){var e=h(a),c,d,f;ja.processRequests();S&&(D.isImage(e)&&D.isCharacterFrame(e.parentNode)&&Q.getSelection().isCollapsed?(W.selectImage(e.parentNode),R.focus()):la.isSelectorElement(e)?R.focus():O?(e=b.getSelectedRange(),d=e.collapsed,D.isImage(e.endContainer)&&0===e.endOffset&&D.isCharacterFrame(e.endContainer.parentNode)&&(f=
-e.endContainer.parentNode,f=x(f))&&(e.setEnd(f.container,f.offset),d&&e.collapse(!1)),W.selectRange(e,b.hasForwardSelection(),0===a.button?a.detail:0),R.focus()):ua?w(a):(c=ea.cloneEvent(a),aa=runtime.setTimeout(function(){w(c)},0)),oa=0,O=S=!1)}function E(a){var b=u.getCursor(d).getSelectedRange();b.collapsed||P.exportRangeToDataTransfer(a.dataTransfer,b)}function F(){S&&R.focus();oa=0;O=S=!1}function H(a){G(a)}function N(a){var b=h(a),e=null;"annotationRemoveButton"===b.className?(runtime.assert(ha,
-"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),e=ea.getElementsByTagNameNS(b.parentNode,odf.Namespaces.officens,"annotation")[0],ga.removeAnnotation(e),R.focus()):"webodf-draggable"!==b.getAttribute("class")&&G(a)}function I(a){(a=a.data)&&(-1===a.indexOf("\n")?fa.insertText(a):ra.paste(a))}function U(a){return function(){a();return!0}}function B(a){return function(b){return u.getCursor(d).getSelectionType()===ops.OdtCursor.RangeSelection?a(b):
-!0}}function Z(b){R.unsubscribe("keydown",C.handleEvent);R.unsubscribe("keypress",T.handleEvent);R.unsubscribe("keyup",L.handleEvent);R.unsubscribe("copy",n);R.unsubscribe("mousedown",s);R.unsubscribe("mousemove",ja.trigger);R.unsubscribe("mouseup",N);R.unsubscribe("contextmenu",H);R.unsubscribe("dragstart",E);R.unsubscribe("dragend",F);R.unsubscribe("click",ma.handleClick);R.unsubscribe("longpress",A);R.unsubscribe("drag",t);R.unsubscribe("dragstop",v);u.unsubscribe(ops.OdtDocument.signalOperationEnd,
-da.trigger);u.unsubscribe(ops.Document.signalCursorAdded,ka.registerCursor);u.unsubscribe(ops.Document.signalCursorRemoved,ka.removeCursor);u.unsubscribe(ops.OdtDocument.signalOperationEnd,a);b()}var Q=runtime.getWindow(),u=k.getOdtDocument(),Y=new gui.SessionConstraints,$=new gui.SessionContext(k,d),ea=new core.DomUtils,D=new odf.OdfUtils,P=new gui.MimeDataExporter,X=new gui.Clipboard(P),C=new gui.KeyboardHandler,T=new gui.KeyboardHandler,L=new gui.KeyboardHandler,S=!1,J=new odf.ObjectNameGenerator(u.getOdfCanvas().odfContainer(),
-d),O=!1,V=null,aa,ba=null,R=new gui.EventManager(u),ha=c.annotationsEnabled,ga=new gui.AnnotationController(k,Y,d),ca=new gui.DirectFormattingController(k,Y,$,d,J,c.directTextStylingEnabled,c.directParagraphStylingEnabled),fa=new gui.TextController(k,Y,$,d,ca.createCursorStyleOp,ca.createParagraphStyleOps),na=new gui.ImageController(k,Y,$,d,J),la=new gui.ImageSelector(u.getOdfCanvas()),ia=gui.SelectionMover.createPositionIterator(u.getRootNode()),ja,da,ra=new gui.PasteController(k,Y,$,d),ka=new gui.InputMethodEditor(d,
-R),oa=0,ma=new gui.HyperlinkClickHandler(u.getOdfCanvas().getElement,C,L),ta=new gui.HyperlinkController(k,Y,$,d),W=new gui.SelectionController(k,d),sa=new gui.MetadataController(k,d),K=gui.KeyboardHandler.Modifier,M=gui.KeyboardHandler.KeyCode,pa=-1!==Q.navigator.appVersion.toLowerCase().indexOf("mac"),ua=-1!==["iPad","iPod","iPhone"].indexOf(Q.navigator.platform),qa;runtime.assert(null!==Q,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo=z;
-this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(d),"Inserting local cursor a second time.");var a=new ops.OpAddCursor;a.init({memberid:d});k.enqueue([a]);R.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(d),"Removing local cursor without inserting before.");var a=new ops.OpRemoveCursor;a.init({memberid:d});k.enqueue([a])};this.startEditing=function(){ka.subscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);
-ka.subscribe(gui.InputMethodEditor.signalCompositionEnd,I);R.subscribe("beforecut",p);R.subscribe("cut",l);R.subscribe("beforepaste",e);R.subscribe("paste",q);ba&&ba.initialize();R.setEditing(!0);ma.setModifier(pa?K.Meta:K.Ctrl);C.bind(M.Backspace,K.None,U(fa.removeTextByBackspaceKey),!0);C.bind(M.Delete,K.None,fa.removeTextByDeleteKey);C.bind(M.Tab,K.None,B(function(){fa.insertText("\t");return!0}));pa?(C.bind(M.Clear,K.None,fa.removeCurrentSelection),C.bind(M.B,K.Meta,B(ca.toggleBold)),C.bind(M.I,
-K.Meta,B(ca.toggleItalic)),C.bind(M.U,K.Meta,B(ca.toggleUnderline)),C.bind(M.L,K.MetaShift,B(ca.alignParagraphLeft)),C.bind(M.E,K.MetaShift,B(ca.alignParagraphCenter)),C.bind(M.R,K.MetaShift,B(ca.alignParagraphRight)),C.bind(M.J,K.MetaShift,B(ca.alignParagraphJustified)),ha&&C.bind(M.C,K.MetaShift,ga.addAnnotation),C.bind(M.Z,K.Meta,g),C.bind(M.Z,K.MetaShift,z)):(C.bind(M.B,K.Ctrl,B(ca.toggleBold)),C.bind(M.I,K.Ctrl,B(ca.toggleItalic)),C.bind(M.U,K.Ctrl,B(ca.toggleUnderline)),C.bind(M.L,K.CtrlShift,
-B(ca.alignParagraphLeft)),C.bind(M.E,K.CtrlShift,B(ca.alignParagraphCenter)),C.bind(M.R,K.CtrlShift,B(ca.alignParagraphRight)),C.bind(M.J,K.CtrlShift,B(ca.alignParagraphJustified)),ha&&C.bind(M.C,K.CtrlAlt,ga.addAnnotation),C.bind(M.Z,K.Ctrl,g),C.bind(M.Z,K.CtrlShift,z));T.setDefault(B(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)}));
-T.bind(M.Enter,K.None,B(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ka.unsubscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);ka.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,I);R.unsubscribe("cut",l);R.unsubscribe("beforecut",p);R.unsubscribe("paste",q);R.unsubscribe("beforepaste",e);R.setEditing(!1);ma.setModifier(K.None);C.bind(M.Backspace,K.None,function(){return!0},!0);C.unbind(M.Delete,K.None);C.unbind(M.Tab,K.None);pa?(C.unbind(M.Clear,
-K.None),C.unbind(M.B,K.Meta),C.unbind(M.I,K.Meta),C.unbind(M.U,K.Meta),C.unbind(M.L,K.MetaShift),C.unbind(M.E,K.MetaShift),C.unbind(M.R,K.MetaShift),C.unbind(M.J,K.MetaShift),ha&&C.unbind(M.C,K.MetaShift),C.unbind(M.Z,K.Meta),C.unbind(M.Z,K.MetaShift)):(C.unbind(M.B,K.Ctrl),C.unbind(M.I,K.Ctrl),C.unbind(M.U,K.Ctrl),C.unbind(M.L,K.CtrlShift),C.unbind(M.E,K.CtrlShift),C.unbind(M.R,K.CtrlShift),C.unbind(M.J,K.CtrlShift),ha&&C.unbind(M.C,K.CtrlAlt),C.unbind(M.Z,K.Ctrl),C.unbind(M.Z,K.CtrlShift));T.setDefault(null);
-T.unbind(M.Enter,K.None)};this.getInputMemberId=function(){return d};this.getSession=function(){return k};this.getSessionConstraints=function(){return Y};this.setUndoManager=function(a){ba&&ba.unsubscribe(gui.UndoManager.signalUndoStackChanged,m);if(ba=a)ba.setDocument(u),ba.setPlaybackFunction(k.enqueue),ba.subscribe(gui.UndoManager.signalUndoStackChanged,m)};this.getUndoManager=function(){return ba};this.getMetadataController=function(){return sa};this.getAnnotationController=function(){return ga};
-this.getDirectFormattingController=function(){return ca};this.getHyperlinkClickHandler=function(){return ma};this.getHyperlinkController=function(){return ta};this.getImageController=function(){return na};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return R};this.getKeyboardHandlers=function(){return{keydown:C,keypress:T}};this.destroy=function(a){var b=[ja.destroy,da.destroy,ca.destroy,ka.destroy,R.destroy,ma.destroy,
-ta.destroy,sa.destroy,W.destroy,fa.destroy,Z];qa&&b.unshift(qa.destroy);runtime.clearTimeout(aa);core.Async.destroyAll(b,a)};ja=core.Task.createRedrawTask(y);da=core.Task.createRedrawTask(function(){var a=u.getCursor(d);if(a&&a.getSelectionType()===ops.OdtCursor.RegionSelection&&(a=D.getImageElements(a.getSelectedRange())[0])){la.select(a.parentNode);return}la.clearSelection()});C.bind(M.Left,K.None,B(W.moveCursorToLeft));C.bind(M.Right,K.None,B(W.moveCursorToRight));C.bind(M.Up,K.None,B(W.moveCursorUp));
-C.bind(M.Down,K.None,B(W.moveCursorDown));C.bind(M.Left,K.Shift,B(W.extendSelectionToLeft));C.bind(M.Right,K.Shift,B(W.extendSelectionToRight));C.bind(M.Up,K.Shift,B(W.extendSelectionUp));C.bind(M.Down,K.Shift,B(W.extendSelectionDown));C.bind(M.Home,K.None,B(W.moveCursorToLineStart));C.bind(M.End,K.None,B(W.moveCursorToLineEnd));C.bind(M.Home,K.Ctrl,B(W.moveCursorToDocumentStart));C.bind(M.End,K.Ctrl,B(W.moveCursorToDocumentEnd));C.bind(M.Home,K.Shift,B(W.extendSelectionToLineStart));C.bind(M.End,
-K.Shift,B(W.extendSelectionToLineEnd));C.bind(M.Up,K.CtrlShift,B(W.extendSelectionToParagraphStart));C.bind(M.Down,K.CtrlShift,B(W.extendSelectionToParagraphEnd));C.bind(M.Home,K.CtrlShift,B(W.extendSelectionToDocumentStart));C.bind(M.End,K.CtrlShift,B(W.extendSelectionToDocumentEnd));pa?(C.bind(M.Left,K.Alt,B(W.moveCursorBeforeWord)),C.bind(M.Right,K.Alt,B(W.moveCursorPastWord)),C.bind(M.Left,K.Meta,B(W.moveCursorToLineStart)),C.bind(M.Right,K.Meta,B(W.moveCursorToLineEnd)),C.bind(M.Home,K.Meta,
-B(W.moveCursorToDocumentStart)),C.bind(M.End,K.Meta,B(W.moveCursorToDocumentEnd)),C.bind(M.Left,K.AltShift,B(W.extendSelectionBeforeWord)),C.bind(M.Right,K.AltShift,B(W.extendSelectionPastWord)),C.bind(M.Left,K.MetaShift,B(W.extendSelectionToLineStart)),C.bind(M.Right,K.MetaShift,B(W.extendSelectionToLineEnd)),C.bind(M.Up,K.AltShift,B(W.extendSelectionToParagraphStart)),C.bind(M.Down,K.AltShift,B(W.extendSelectionToParagraphEnd)),C.bind(M.Up,K.MetaShift,B(W.extendSelectionToDocumentStart)),C.bind(M.Down,
-K.MetaShift,B(W.extendSelectionToDocumentEnd)),C.bind(M.A,K.Meta,B(W.extendSelectionToEntireDocument))):(C.bind(M.Left,K.Ctrl,B(W.moveCursorBeforeWord)),C.bind(M.Right,K.Ctrl,B(W.moveCursorPastWord)),C.bind(M.Left,K.CtrlShift,B(W.extendSelectionBeforeWord)),C.bind(M.Right,K.CtrlShift,B(W.extendSelectionPastWord)),C.bind(M.A,K.Ctrl,B(W.extendSelectionToEntireDocument)));ua&&(qa=new gui.IOSSafariSupport(R));R.subscribe("keydown",C.handleEvent);R.subscribe("keypress",T.handleEvent);R.subscribe("keyup",
-L.handleEvent);R.subscribe("copy",n);R.subscribe("mousedown",s);R.subscribe("mousemove",ja.trigger);R.subscribe("mouseup",N);R.subscribe("contextmenu",H);R.subscribe("dragstart",E);R.subscribe("dragend",F);R.subscribe("click",ma.handleClick);R.subscribe("longpress",A);R.subscribe("drag",t);R.subscribe("dragstop",v);u.subscribe(ops.OdtDocument.signalOperationEnd,da.trigger);u.subscribe(ops.Document.signalCursorAdded,ka.registerCursor);u.subscribe(ops.Document.signalCursorRemoved,ka.removeCursor);u.subscribe(ops.OdtDocument.signalOperationEnd,
-a)}})();gui.CaretManager=function(f){function k(a){return m.hasOwnProperty(a)?m[a]:null}function d(){var a=k(f.getInputMemberId()),b;a&&(b=a.getBoundingClientRect());return b?b.right:void 0}function b(){return Object.keys(m).map(function(a){return m[a]})}function c(a){var b=m[a];b&&(delete m[a],a===f.getInputMemberId()&&f.getEventManager().unsubscribe("compositionupdate",b.handleUpdate),b.destroy(function(){}))}function h(a){a=a.getMemberId();a===f.getInputMemberId()&&(a=k(a))&&a.refreshCursorBlinking()}
-function r(){var a=k(f.getInputMemberId());t=!1;a&&a.ensureVisible()}function l(){var a=k(f.getInputMemberId());a&&(a.handleUpdate(),t||(t=!0,z=runtime.setTimeout(r,50)))}function p(a){a.memberId===f.getInputMemberId()&&l()}function n(){var a=k(f.getInputMemberId());a&&a.setFocus()}function q(){var a=k(f.getInputMemberId());a&&a.removeFocus()}function e(){var a=k(f.getInputMemberId());a&&a.show()}function a(){var a=k(f.getInputMemberId());a&&a.hide()}var m={},g=runtime.getWindow(),z,t=!1;this.registerCursor=
-function(a,b,e){var c=a.getMemberId();b=new gui.Caret(a,b,e);e=f.getEventManager();m[c]=b;c===f.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+c),a.subscribe(ops.OdtCursor.signalCursorUpdated,l),e.subscribe("compositionupdate",b.handleUpdate),b.setOverlayElement(e.getEventTrap())):a.subscribe(ops.OdtCursor.signalCursorUpdated,b.handleUpdate);return b};this.getCaret=k;this.getCarets=b;this.destroy=function(d){var k=f.getSession().getOdtDocument(),l=f.getEventManager(),
-r=b().map(function(a){return a.destroy});f.getSelectionController().setCaretXPositionLocator(null);runtime.clearTimeout(z);k.unsubscribe(ops.OdtDocument.signalParagraphChanged,p);k.unsubscribe(ops.Document.signalCursorMoved,h);k.unsubscribe(ops.Document.signalCursorRemoved,c);l.unsubscribe("focus",n);l.unsubscribe("blur",q);g.removeEventListener("focus",e,!1);g.removeEventListener("blur",a,!1);m={};core.Async.destroyAll(r,d)};(function(){var b=f.getSession().getOdtDocument(),k=f.getEventManager();
-f.getSelectionController().setCaretXPositionLocator(d);b.subscribe(ops.OdtDocument.signalParagraphChanged,p);b.subscribe(ops.Document.signalCursorMoved,h);b.subscribe(ops.Document.signalCursorRemoved,c);k.subscribe("focus",n);k.subscribe("blur",q);g.addEventListener("focus",e,!1);g.addEventListener("blur",a,!1)})()};gui.EditInfoHandle=function(f){var k=[],d,b=f.ownerDocument,c=b.documentElement.namespaceURI;this.setEdits=function(f){k=f;var r,l,p,n;d.innerHTML="";for(f=0;fa?(l=d(1,0),p=d(0.5,1E4-a),n=d(0.2,2E4-a)):1E4<=a&&2E4>a?(l=d(0.5,0),n=d(0.2,2E4-a)):l=d(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits=
-function(){f.clearEdits();h.setEdits([]);r.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&r.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){r.style.display="block"};this.hide=function(){b.hideHandle();r.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(b){runtime.clearTimeout(l);runtime.clearTimeout(p);runtime.clearTimeout(n);c.removeChild(r);
-h.destroy(function(e){e?b(e):f.destroy(b)})};(function(){var d=f.getOdtDocument().getDOMDocument();r=d.createElementNS(d.documentElement.namespaceURI,"div");r.setAttribute("class","editInfoMarker");r.onmouseover=function(){b.showHandle()};r.onmouseout=function(){b.hideHandle()};c=f.getNode();c.appendChild(r);h=new gui.EditInfoHandle(c);k||b.hide()})()};gui.HyperlinkTooltipView=function(f,k){var d=new core.DomUtils,b=new odf.OdfUtils,c=runtime.getWindow(),h,r,l;runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(p){var n=p.target||p.srcElement,q=f.getSizer(),e=f.getZoomLevel(),a;a:{for(;n;){if(b.isHyperlink(n))break a;if(b.isParagraph(n)||b.isInlineRoot(n))break;n=n.parentNode}n=null}if(n){d.containsNode(q,l)||q.appendChild(l);a=r;var m;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:m=
-runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:m=runtime.tr("\u2318-click to follow link");break;default:m=""}a.textContent=m;h.textContent=b.getHyperlinkTarget(n);l.style.display="block";a=c.innerWidth-l.offsetWidth-15;n=p.clientX>a?a:p.clientX+15;a=c.innerHeight-l.offsetHeight-10;p=p.clientY>a?a:p.clientY+10;q=q.getBoundingClientRect();n=(n-q.left)/e;p=(p-q.top)/e;l.style.left=n+"px";l.style.top=p+"px"}};this.hideTooltip=function(){l.style.display="none"};this.destroy=
-function(b){l.parentNode&&l.parentNode.removeChild(l);b()};(function(){var b=f.getElement().ownerDocument;h=b.createElement("span");r=b.createElement("span");h.className="webodf-hyperlinkTooltipLink";r.className="webodf-hyperlinkTooltipText";l=b.createElement("div");l.className="webodf-hyperlinkTooltip";l.appendChild(h);l.appendChild(r);f.getElement().appendChild(l)})()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),d=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(b,c){k=b;d=!1!==c};this.hasForwardSelection=function(){return d};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(d).map(function(b){return d[b]})}var d={};this.getSelectionView=function(b){return d.hasOwnProperty(b)?d[b]:null};this.getSelectionViews=k;this.removeSelectionView=function(b){d.hasOwnProperty(b)&&(d[b].destroy(function(){}),delete d[b])};this.hideSelectionView=function(b){d.hasOwnProperty(b)&&d[b].hide()};this.showSelectionView=function(b){d.hasOwnProperty(b)&&d[b].show()};this.rerenderSelectionViews=function(){Object.keys(d).forEach(function(b){d[b].rerender()})};
-this.registerCursor=function(b,c){var h=b.getMemberId(),k=new f(b);c?k.show():k.hide();return d[h]=k};this.destroy=function(b){function c(f,k){k?b(k):f .webodf-draggable"),a=gui.ShadowCursor.ShadowCursorMemberId,c(".webodf-selectionOverlay","{ fill: "+e+"; stroke: "+e+";}",""),
-c(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function p(a){var b,e;for(e in x)x.hasOwnProperty(e)&&(b=x[e],a?b.show():b.hide())}function n(a){c.getCarets().forEach(function(b){a?b.showHandle():b.hideHandle()})}function q(a){var b=a.getMemberId();a=a.getProperties();l(b,a.fullName,a.color)}function e(a){var b=a.getMemberId(),e=d.getOdtDocument().getMember(b).getProperties();c.registerCursor(a,F,H);h.registerCursor(a,!0);if(a=c.getCaret(b))a.setAvatarImageUrl(e.imageUrl),
-a.setColor(e.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+b+"'! +++")}function a(a){a=a.getMemberId();var b=h.getSelectionView(k),e=h.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),d=c.getCaret(k);a===k?(e.hide(),b&&b.show(),d&&d.show()):a===gui.ShadowCursor.ShadowCursorMemberId&&(e.show(),b&&b.hide(),d&&d.hide())}function m(a){h.removeSelectionView(a)}function g(a){var b=a.paragraphElement,e=a.memberId;a=a.timeStamp;var c,f="",g=b.getElementsByTagNameNS(s,"editinfo").item(0);
-g?(f=g.getAttributeNS(s,"id"),c=x[f]):(f=Math.random().toString(),c=new ops.EditInfo(b,d.getOdtDocument()),c=new gui.EditInfoMarker(c,E),g=b.getElementsByTagNameNS(s,"editinfo").item(0),g.setAttributeNS(s,"id",f),x[f]=c);c.addEdit(e,new Date(a));G.trigger()}function z(){var a;""!==y.innerHTML&&(y.innerHTML="");!0===b.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(a=d.getOdtDocument().getMember(k))&&(a=a.getProperties().fullName,y.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+
-a+"']) .annotationRemoveButton { display: none; }")))}function t(c){var d=Object.keys(x).map(function(a){return x[a]});w.unsubscribe(ops.Document.signalMemberAdded,q);w.unsubscribe(ops.Document.signalMemberUpdated,q);w.unsubscribe(ops.Document.signalCursorAdded,e);w.unsubscribe(ops.Document.signalCursorRemoved,m);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,g);w.unsubscribe(ops.Document.signalCursorMoved,a);w.unsubscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalTableAdded,
-h.rerenderSelectionViews);w.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);b.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,z);w.unsubscribe(ops.Document.signalMemberAdded,z);w.unsubscribe(ops.Document.signalMemberUpdated,z);v.parentNode.removeChild(v);y.parentNode.removeChild(y);(function B(a,b){b?c(b):ae.left&&(e=x(d)))a.focusNode=e.container,a.focusOffset=e.offset,c&&(a.anchorNode=a.focusNode,a.anchorOffset=a.focusOffset)}else D.isImage(a.focusNode.firstChild)&&1===a.focusOffset&&D.isCharacterFrame(a.focusNode)&&(e=x(a.focusNode))&&(a.anchorNode=a.focusNode=e.container,a.anchorOffset=a.focusOffset=e.offset);a.anchorNode&&a.focusNode&&(a=W.selectionToRange(a),W.selectRange(a.range,a.hasForwardSelection,0===b.button?b.detail:0));M.focus()}function B(b){var a;if(a=q(b.clientX,b.clientY))b=
+a.container,a=a.offset,b={anchorNode:b,anchorOffset:a,focusNode:b,focusOffset:a},b=W.selectionToRange(b),W.selectRange(b.range,b.hasForwardSelection,2),M.focus()}function I(b){var a=h(b),c,e,f;la.processRequests();Y&&(D.isImage(a)&&D.isCharacterFrame(a.parentNode)&&T.getSelection().isCollapsed?(W.selectImage(a.parentNode),M.focus()):ka.isSelectorElement(a)?M.focus():X?(a=d.getSelectedRange(),e=a.collapsed,D.isImage(a.endContainer)&&0===a.endOffset&&D.isCharacterFrame(a.endContainer.parentNode)&&(f=
+a.endContainer.parentNode,f=x(f))&&(a.setEnd(f.container,f.offset),e&&a.collapse(!1)),W.selectRange(a,d.hasForwardSelection(),0===b.button?b.detail:0),M.focus()):ta?w(b):(c=P.cloneEvent(b),da=runtime.setTimeout(function(){w(c)},0)),na=0,X=Y=!1)}function C(b){var c=G.getCursor(a).getSelectedRange();c.collapsed||Q.exportRangeToDataTransfer(b.dataTransfer,c)}function F(){Y&&M.focus();na=0;X=Y=!1}function J(b){I(b)}function N(b){var a=h(b),c=null;"annotationRemoveButton"===a.className?(runtime.assert(ea,
+"Remove buttons are displayed on annotations while annotation editing is disabled in the controller."),c=a.parentNode.getElementsByTagNameNS(odf.Namespaces.officens,"annotation").item(0),ha.removeAnnotation(c),M.focus()):"webodf-draggable"!==a.getAttribute("class")&&I(b)}function K(b){(b=b.data)&&(-1===b.indexOf("\n")?fa.insertText(b):ga.paste(b))}function H(b){return function(){b();return!0}}function z(b){return function(c){return G.getCursor(a).getSelectionType()===ops.OdtCursor.RangeSelection?
+b(c):!0}}function Z(b){M.unsubscribe("keydown",A.handleEvent);M.unsubscribe("keypress",V.handleEvent);M.unsubscribe("keyup",ba.handleEvent);M.unsubscribe("copy",l);M.unsubscribe("mousedown",s);M.unsubscribe("mousemove",la.trigger);M.unsubscribe("mouseup",N);M.unsubscribe("contextmenu",J);M.unsubscribe("dragstart",C);M.unsubscribe("dragend",F);M.unsubscribe("click",oa.handleClick);M.unsubscribe("longpress",B);M.unsubscribe("drag",t);M.unsubscribe("dragstop",y);G.unsubscribe(ops.OdtDocument.signalOperationEnd,
+ma.trigger);G.unsubscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.unsubscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.unsubscribe(ops.OdtDocument.signalOperationEnd,e);b()}var T=runtime.getWindow(),G=k.getOdtDocument(),U=new gui.SessionConstraints,aa=new gui.SessionContext(k,a),P=core.DomUtils,D=odf.OdfUtils,Q=new gui.MimeDataExporter,$=new gui.Clipboard(Q),A=new gui.KeyboardHandler,V=new gui.KeyboardHandler,ba=new gui.KeyboardHandler,Y=!1,E=new odf.ObjectNameGenerator(G.getOdfCanvas().odfContainer(),
+a),X=!1,R=null,da,S=null,M=new gui.EventManager(G),ea=c.annotationsEnabled,ha=new gui.AnnotationController(k,U,a),ca=new gui.DirectFormattingController(k,U,aa,a,E,c.directTextStylingEnabled,c.directParagraphStylingEnabled),fa=new gui.TextController(k,U,aa,a,ca.createCursorStyleOp,ca.createParagraphStyleOps),pa=new gui.ImageController(k,U,aa,a,E),ka=new gui.ImageSelector(G.getOdfCanvas()),ia=G.createPositionIterator(G.getRootNode()),la,ma,ga=new gui.PasteController(k,U,aa,a),ja=new gui.InputMethodEditor(a,
+M),na=0,oa=new gui.HyperlinkClickHandler(G.getOdfCanvas().getElement,A,ba),sa=new gui.HyperlinkController(k,U,aa,a),W=new gui.SelectionController(k,a),ua=new gui.MetadataController(k,a),L=gui.KeyboardHandler.Modifier,O=gui.KeyboardHandler.KeyCode,qa=-1!==T.navigator.appVersion.toLowerCase().indexOf("mac"),ta=-1!==["iPad","iPod","iPhone"].indexOf(T.navigator.platform),ra;runtime.assert(null!==T,"Expected to be run in an environment which has a global window, like a browser.");this.undo=g;this.redo=
+u;this.insertLocalCursor=function(){runtime.assert(void 0===k.getOdtDocument().getCursor(a),"Inserting local cursor a second time.");var b=new ops.OpAddCursor;b.init({memberid:a});k.enqueue([b]);M.focus()};this.removeLocalCursor=function(){runtime.assert(void 0!==k.getOdtDocument().getCursor(a),"Removing local cursor without inserting before.");var b=new ops.OpRemoveCursor;b.init({memberid:a});k.enqueue([b])};this.startEditing=function(){ja.subscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);
+ja.subscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.subscribe("beforecut",m);M.subscribe("cut",p);M.subscribe("beforepaste",b);M.subscribe("paste",r);S&&S.initialize();M.setEditing(!0);oa.setModifier(qa?L.Meta:L.Ctrl);A.bind(O.Backspace,L.None,H(fa.removeTextByBackspaceKey),!0);A.bind(O.Delete,L.None,fa.removeTextByDeleteKey);A.bind(O.Tab,L.None,z(function(){fa.insertText("\t");return!0}));qa?(A.bind(O.Clear,L.None,fa.removeCurrentSelection),A.bind(O.B,L.Meta,z(ca.toggleBold)),A.bind(O.I,
+L.Meta,z(ca.toggleItalic)),A.bind(O.U,L.Meta,z(ca.toggleUnderline)),A.bind(O.L,L.MetaShift,z(ca.alignParagraphLeft)),A.bind(O.E,L.MetaShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.MetaShift,z(ca.alignParagraphRight)),A.bind(O.J,L.MetaShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.MetaShift,ha.addAnnotation),A.bind(O.Z,L.Meta,g),A.bind(O.Z,L.MetaShift,u)):(A.bind(O.B,L.Ctrl,z(ca.toggleBold)),A.bind(O.I,L.Ctrl,z(ca.toggleItalic)),A.bind(O.U,L.Ctrl,z(ca.toggleUnderline)),A.bind(O.L,L.CtrlShift,
+z(ca.alignParagraphLeft)),A.bind(O.E,L.CtrlShift,z(ca.alignParagraphCenter)),A.bind(O.R,L.CtrlShift,z(ca.alignParagraphRight)),A.bind(O.J,L.CtrlShift,z(ca.alignParagraphJustified)),ea&&A.bind(O.C,L.CtrlAlt,ha.addAnnotation),A.bind(O.Z,L.Ctrl,g),A.bind(O.Z,L.CtrlShift,u));V.setDefault(z(function(b){var a;a=null===b.which||void 0===b.which?String.fromCharCode(b.keyCode):0!==b.which&&0!==b.charCode?String.fromCharCode(b.which):null;return!a||b.altKey||b.ctrlKey||b.metaKey?!1:(fa.insertText(a),!0)}));
+V.bind(O.Enter,L.None,z(fa.enqueueParagraphSplittingOps))};this.endEditing=function(){ja.unsubscribe(gui.InputMethodEditor.signalCompositionStart,fa.removeCurrentSelection);ja.unsubscribe(gui.InputMethodEditor.signalCompositionEnd,K);M.unsubscribe("cut",p);M.unsubscribe("beforecut",m);M.unsubscribe("paste",r);M.unsubscribe("beforepaste",b);M.setEditing(!1);oa.setModifier(L.None);A.bind(O.Backspace,L.None,function(){return!0},!0);A.unbind(O.Delete,L.None);A.unbind(O.Tab,L.None);qa?(A.unbind(O.Clear,
+L.None),A.unbind(O.B,L.Meta),A.unbind(O.I,L.Meta),A.unbind(O.U,L.Meta),A.unbind(O.L,L.MetaShift),A.unbind(O.E,L.MetaShift),A.unbind(O.R,L.MetaShift),A.unbind(O.J,L.MetaShift),ea&&A.unbind(O.C,L.MetaShift),A.unbind(O.Z,L.Meta),A.unbind(O.Z,L.MetaShift)):(A.unbind(O.B,L.Ctrl),A.unbind(O.I,L.Ctrl),A.unbind(O.U,L.Ctrl),A.unbind(O.L,L.CtrlShift),A.unbind(O.E,L.CtrlShift),A.unbind(O.R,L.CtrlShift),A.unbind(O.J,L.CtrlShift),ea&&A.unbind(O.C,L.CtrlAlt),A.unbind(O.Z,L.Ctrl),A.unbind(O.Z,L.CtrlShift));V.setDefault(null);
+V.unbind(O.Enter,L.None)};this.getInputMemberId=function(){return a};this.getSession=function(){return k};this.getSessionConstraints=function(){return U};this.setUndoManager=function(b){S&&S.unsubscribe(gui.UndoManager.signalUndoStackChanged,n);if(S=b)S.setDocument(G),S.setPlaybackFunction(k.enqueue),S.subscribe(gui.UndoManager.signalUndoStackChanged,n)};this.getUndoManager=function(){return S};this.getMetadataController=function(){return ua};this.getAnnotationController=function(){return ha};this.getDirectFormattingController=
+function(){return ca};this.getHyperlinkClickHandler=function(){return oa};this.getHyperlinkController=function(){return sa};this.getImageController=function(){return pa};this.getSelectionController=function(){return W};this.getTextController=function(){return fa};this.getEventManager=function(){return M};this.getKeyboardHandlers=function(){return{keydown:A,keypress:V}};this.destroy=function(b){var a=[la.destroy,ma.destroy,ca.destroy,ja.destroy,M.destroy,oa.destroy,sa.destroy,ua.destroy,W.destroy,
+fa.destroy,Z];ra&&a.unshift(ra.destroy);runtime.clearTimeout(da);core.Async.destroyAll(a,b)};la=core.Task.createRedrawTask(v);ma=core.Task.createRedrawTask(function(){var b=G.getCursor(a);if(b&&b.getSelectionType()===ops.OdtCursor.RegionSelection&&(b=D.getImageElements(b.getSelectedRange())[0])){ka.select(b.parentNode);return}ka.clearSelection()});A.bind(O.Left,L.None,z(W.moveCursorToLeft));A.bind(O.Right,L.None,z(W.moveCursorToRight));A.bind(O.Up,L.None,z(W.moveCursorUp));A.bind(O.Down,L.None,z(W.moveCursorDown));
+A.bind(O.Left,L.Shift,z(W.extendSelectionToLeft));A.bind(O.Right,L.Shift,z(W.extendSelectionToRight));A.bind(O.Up,L.Shift,z(W.extendSelectionUp));A.bind(O.Down,L.Shift,z(W.extendSelectionDown));A.bind(O.Home,L.None,z(W.moveCursorToLineStart));A.bind(O.End,L.None,z(W.moveCursorToLineEnd));A.bind(O.Home,L.Ctrl,z(W.moveCursorToDocumentStart));A.bind(O.End,L.Ctrl,z(W.moveCursorToDocumentEnd));A.bind(O.Home,L.Shift,z(W.extendSelectionToLineStart));A.bind(O.End,L.Shift,z(W.extendSelectionToLineEnd));A.bind(O.Up,
+L.CtrlShift,z(W.extendSelectionToParagraphStart));A.bind(O.Down,L.CtrlShift,z(W.extendSelectionToParagraphEnd));A.bind(O.Home,L.CtrlShift,z(W.extendSelectionToDocumentStart));A.bind(O.End,L.CtrlShift,z(W.extendSelectionToDocumentEnd));qa?(A.bind(O.Left,L.Alt,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Alt,z(W.moveCursorPastWord)),A.bind(O.Left,L.Meta,z(W.moveCursorToLineStart)),A.bind(O.Right,L.Meta,z(W.moveCursorToLineEnd)),A.bind(O.Home,L.Meta,z(W.moveCursorToDocumentStart)),A.bind(O.End,L.Meta,
+z(W.moveCursorToDocumentEnd)),A.bind(O.Left,L.AltShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.AltShift,z(W.extendSelectionPastWord)),A.bind(O.Left,L.MetaShift,z(W.extendSelectionToLineStart)),A.bind(O.Right,L.MetaShift,z(W.extendSelectionToLineEnd)),A.bind(O.Up,L.AltShift,z(W.extendSelectionToParagraphStart)),A.bind(O.Down,L.AltShift,z(W.extendSelectionToParagraphEnd)),A.bind(O.Up,L.MetaShift,z(W.extendSelectionToDocumentStart)),A.bind(O.Down,L.MetaShift,z(W.extendSelectionToDocumentEnd)),
+A.bind(O.A,L.Meta,z(W.extendSelectionToEntireDocument))):(A.bind(O.Left,L.Ctrl,z(W.moveCursorBeforeWord)),A.bind(O.Right,L.Ctrl,z(W.moveCursorPastWord)),A.bind(O.Left,L.CtrlShift,z(W.extendSelectionBeforeWord)),A.bind(O.Right,L.CtrlShift,z(W.extendSelectionPastWord)),A.bind(O.A,L.Ctrl,z(W.extendSelectionToEntireDocument)));ta&&(ra=new gui.IOSSafariSupport(M));M.subscribe("keydown",A.handleEvent);M.subscribe("keypress",V.handleEvent);M.subscribe("keyup",ba.handleEvent);M.subscribe("copy",l);M.subscribe("mousedown",
+s);M.subscribe("mousemove",la.trigger);M.subscribe("mouseup",N);M.subscribe("contextmenu",J);M.subscribe("dragstart",C);M.subscribe("dragend",F);M.subscribe("click",oa.handleClick);M.subscribe("longpress",B);M.subscribe("drag",t);M.subscribe("dragstop",y);G.subscribe(ops.OdtDocument.signalOperationEnd,ma.trigger);G.subscribe(ops.Document.signalCursorAdded,ja.registerCursor);G.subscribe(ops.Document.signalCursorRemoved,ja.removeCursor);G.subscribe(ops.OdtDocument.signalOperationEnd,e)}})();gui.CaretManager=function(f,k){function a(a){return h.hasOwnProperty(a)?h[a]:null}function d(){return Object.keys(h).map(function(a){return h[a]})}function c(a){var c=h[a];c&&(delete h[a],a===f.getInputMemberId()?(p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.ensureVisible),p.unsubscribe(ops.Document.signalCursorMoved,c.refreshCursorBlinking),m.unsubscribe("compositionupdate",c.handleUpdate),m.unsubscribe("compositionend",c.handleUpdate),m.unsubscribe("focus",c.setFocus),m.unsubscribe("blur",
+c.removeFocus),q.removeEventListener("focus",c.show,!1),q.removeEventListener("blur",c.hide,!1)):p.unsubscribe(ops.OdtDocument.signalProcessingBatchEnd,c.handleUpdate),c.destroy(function(){}))}var h={},q=runtime.getWindow(),p=f.getSession().getOdtDocument(),m=f.getEventManager();this.registerCursor=function(a,c,b){var e=a.getMemberId();a=new gui.Caret(a,k,c,b);h[e]=a;e===f.getInputMemberId()?(runtime.log("Starting to track input on new cursor of "+e),p.subscribe(ops.OdtDocument.signalProcessingBatchEnd,
+a.ensureVisible),p.subscribe(ops.Document.signalCursorMoved,a.refreshCursorBlinking),m.subscribe("compositionupdate",a.handleUpdate),m.subscribe("compositionend",a.handleUpdate),m.subscribe("focus",a.setFocus),m.subscribe("blur",a.removeFocus),q.addEventListener("focus",a.show,!1),q.addEventListener("blur",a.hide,!1),a.setOverlayElement(m.getEventTrap())):p.subscribe(ops.OdtDocument.signalProcessingBatchEnd,a.handleUpdate);return a};this.getCaret=a;this.getCarets=d;this.destroy=function(a){var k=
+d().map(function(b){return b.destroy});f.getSelectionController().setCaretXPositionLocator(null);p.unsubscribe(ops.Document.signalCursorRemoved,c);h={};core.Async.destroyAll(k,a)};f.getSelectionController().setCaretXPositionLocator(function(){var c=a(f.getInputMemberId()),d;c&&(d=c.getBoundingClientRect());return d?d.right:void 0});p.subscribe(ops.Document.signalCursorRemoved,c)};gui.EditInfoHandle=function(f){var k=[],a,d=f.ownerDocument,c=d.documentElement.namespaceURI;this.setEdits=function(f){k=f;var q,p,m,l;a.innerHTML="";for(f=0;fe?(p=a(1,0),m=a(0.5,1E4-e),l=a(0.2,2E4-e)):1E4<=e&&2E4>e?(p=a(0.5,0),l=a(0.2,2E4-e)):p=a(0.2,0)};this.getEdits=function(){return f.getEdits()};this.clearEdits=
+function(){f.clearEdits();h.setEdits([]);q.hasAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")&&q.removeAttributeNS("urn:webodf:names:editinfo","editinfo:memberid")};this.getEditInfo=function(){return f};this.show=function(){q.style.display="block"};this.hide=function(){d.hideHandle();q.style.display="none"};this.showHandle=function(){h.show()};this.hideHandle=function(){h.hide()};this.destroy=function(a){runtime.clearTimeout(p);runtime.clearTimeout(m);runtime.clearTimeout(l);c.removeChild(q);
+h.destroy(function(b){b?a(b):f.destroy(a)})};(function(){var a=f.getOdtDocument().getDOMDocument();q=a.createElementNS(a.documentElement.namespaceURI,"div");q.setAttribute("class","editInfoMarker");q.onmouseover=function(){d.showHandle()};q.onmouseout=function(){d.hideHandle()};c=f.getNode();c.appendChild(q);h=new gui.EditInfoHandle(c);k||d.hide()})()};gui.HyperlinkTooltipView=function(f,k){var a=core.DomUtils,d=odf.OdfUtils,c=runtime.getWindow(),h,q,p;runtime.assert(null!==c,"Expected to be run in an environment which has a global window, like a browser.");this.showTooltip=function(m){var l=m.target||m.srcElement,r=f.getSizer(),b=f.getZoomLevel(),e;a:{for(;l;){if(d.isHyperlink(l))break a;if(d.isParagraph(l)||d.isInlineRoot(l))break;l=l.parentNode}l=null}if(l){a.containsNode(r,p)||r.appendChild(p);e=q;var n;switch(k()){case gui.KeyboardHandler.Modifier.Ctrl:n=
+runtime.tr("Ctrl-click to follow link");break;case gui.KeyboardHandler.Modifier.Meta:n=runtime.tr("\u2318-click to follow link");break;default:n=""}e.textContent=n;h.textContent=d.getHyperlinkTarget(l);p.style.display="block";e=c.innerWidth-p.offsetWidth-15;l=m.clientX>e?e:m.clientX+15;e=c.innerHeight-p.offsetHeight-10;m=m.clientY>e?e:m.clientY+10;r=r.getBoundingClientRect();l=(l-r.left)/b;m=(m-r.top)/b;p.style.left=l+"px";p.style.top=m+"px"}};this.hideTooltip=function(){p.style.display="none"};this.destroy=
+function(a){p.parentNode&&p.parentNode.removeChild(p);a()};(function(){var a=f.getElement().ownerDocument;h=a.createElement("span");q=a.createElement("span");h.className="webodf-hyperlinkTooltipLink";q.className="webodf-hyperlinkTooltipText";p=a.createElement("div");p.className="webodf-hyperlinkTooltip";p.appendChild(h);p.appendChild(q);f.getElement().appendChild(p)})()};gui.OdfFieldView=function(f){function k(){var a=odf.OdfSchema.getFields().map(function(a){return a.replace(":","|")}),d=a.join(",\n")+"\n{ background-color: #D0D0D0; }\n",a=a.map(function(a){return a+":empty::after"}).join(",\n")+"\n{ content:' '; white-space: pre; }\n";return d+"\n"+a}var a,d=f.getElement().ownerDocument;this.showFieldHighlight=function(){a.appendChild(d.createTextNode(k()))};this.hideFieldHighlight=function(){for(var c=a.sheet,d=c.cssRules;d.length;)c.deleteRule(d.length-1)};this.destroy=
+function(c){a.parentNode&&a.parentNode.removeChild(a);c()};a=function(){var a=d.getElementsByTagName("head").item(0),f=d.createElement("style"),k="";f.type="text/css";f.media="screen, print, handheld, projection";odf.Namespaces.forEachPrefix(function(a,c){k+="@namespace "+a+" url("+c+");\n"});f.appendChild(d.createTextNode(k));a.appendChild(f);return f}()};gui.ShadowCursor=function(f){var k=f.getDOMDocument().createRange(),a=!0;this.removeFromDocument=function(){};this.getMemberId=function(){return gui.ShadowCursor.ShadowCursorMemberId};this.getSelectedRange=function(){return k};this.setSelectedRange=function(d,c){k=d;a=!1!==c};this.hasForwardSelection=function(){return a};this.getDocument=function(){return f};this.getSelectionType=function(){return ops.OdtCursor.RangeSelection};k.setStart(f.getRootNode(),0)};gui.ShadowCursor.ShadowCursorMemberId="";gui.SelectionView=function(f){};gui.SelectionView.prototype.rerender=function(){};gui.SelectionView.prototype.show=function(){};gui.SelectionView.prototype.hide=function(){};gui.SelectionView.prototype.destroy=function(f){};gui.SelectionViewManager=function(f){function k(){return Object.keys(a).map(function(d){return a[d]})}var a={};this.getSelectionView=function(d){return a.hasOwnProperty(d)?a[d]:null};this.getSelectionViews=k;this.removeSelectionView=function(d){a.hasOwnProperty(d)&&(a[d].destroy(function(){}),delete a[d])};this.hideSelectionView=function(d){a.hasOwnProperty(d)&&a[d].hide()};this.showSelectionView=function(d){a.hasOwnProperty(d)&&a[d].show()};this.rerenderSelectionViews=function(){Object.keys(a).forEach(function(d){a[d].rerender()})};
+this.registerCursor=function(d,c){var h=d.getMemberId(),k=new f(d);c?k.show():k.hide();return a[h]=k};this.destroy=function(a){function c(k,p){p?a(p):k .webodf-draggable"),
+b=gui.ShadowCursor.ShadowCursorMemberId,e(".webodf-selectionOverlay","{ fill: "+c+"; stroke: "+c+";}",""),e(".webodf-touchEnabled .webodf-selectionOverlay","{ display: block; }"," > .webodf-draggable"))}function l(b){var a,c;for(c in w)w.hasOwnProperty(c)&&(a=w[c],b?a.show():a.hide())}function r(b){c.getCarets().forEach(function(a){b?a.showHandle():a.hideHandle()})}function b(b){var a=b.getMemberId();b=b.getProperties();m(a,b.fullName,b.color)}function e(b){var e=b.getMemberId(),d=a.getOdtDocument().getMember(e).getProperties();
+c.registerCursor(b,J,N);h.registerCursor(b,!0);if(b=c.getCaret(e))b.setAvatarImageUrl(d.imageUrl),b.setColor(d.color);runtime.log("+++ View here +++ eagerly created an Caret for '"+e+"'! +++")}function n(b){b=b.getMemberId();var a=h.getSelectionView(k),e=h.getSelectionView(gui.ShadowCursor.ShadowCursorMemberId),d=c.getCaret(k);b===k?(e.hide(),a&&a.show(),d&&d.show()):b===gui.ShadowCursor.ShadowCursorMemberId&&(e.show(),a&&a.hide(),d&&d.hide())}function g(b){h.removeSelectionView(b)}function u(b){var c=
+b.paragraphElement,e=b.memberId;b=b.timeStamp;var d,f="",g=c.getElementsByTagNameNS(x,"editinfo").item(0);g?(f=g.getAttributeNS(x,"id"),d=w[f]):(f=Math.random().toString(),d=new ops.EditInfo(c,a.getOdtDocument()),d=new gui.EditInfoMarker(d,F),g=c.getElementsByTagNameNS(x,"editinfo").item(0),g.setAttributeNS(x,"id",f),w[f]=d);d.addEdit(e,new Date(b));C.trigger()}function t(){var b;""!==s.innerHTML&&(s.innerHTML="");!0===d.getState(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN)&&(b=a.getOdtDocument().getMember(k))&&
+(b=b.getProperties().fullName,s.appendChild(document.createTextNode(".annotationWrapper:not([creator = '"+b+"']) .annotationRemoveButton { display: none; }")))}function y(a){var c=Object.keys(w).map(function(b){return w[b]});B.unsubscribe(ops.Document.signalMemberAdded,b);B.unsubscribe(ops.Document.signalMemberUpdated,b);B.unsubscribe(ops.Document.signalCursorAdded,e);B.unsubscribe(ops.Document.signalCursorRemoved,g);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,u);B.unsubscribe(ops.Document.signalCursorMoved,
+n);B.unsubscribe(ops.OdtDocument.signalParagraphChanged,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalTableAdded,h.rerenderSelectionViews);B.unsubscribe(ops.OdtDocument.signalParagraphStyleModified,h.rerenderSelectionViews);d.unsubscribe(gui.CommonConstraints.EDIT.ANNOTATIONS.ONLY_DELETE_OWN,t);B.unsubscribe(ops.Document.signalMemberAdded,t);B.unsubscribe(ops.Document.signalMemberUpdated,t);v.parentNode.removeChild(v);s.parentNode.removeChild(s);(function Z(b,e){e?a(e):bb.length;a&&f(b);return a}function d(b,a){function c(f){b[f]===a&&d.push(f)}var d=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return d}function b(b,a){function c(d){b[d]===a&&delete b[d]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function c(b){var a={};Object.keys(b).forEach(function(d){a[d]="object"===typeof b[d]?c(b[d]):b[d]});return a}function h(b,
-a,c,d){var f,h=!1,k=!1,l,n=[];d&&d.attributes&&(n=d.attributes.split(","));b&&(c||0=a.position+a.length)){f=d?b:a;h=d?a:b;if(b.position!==a.position||b.length!==a.length)q=c(f),x=c(h);a=p(h.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)k=[],b=[],l=f.position+f.length,n=h.position+h.length,h.positionl?a.minorChanged&&(q=x,q.position=l,q.length=n-l,b.push(q),h.length=l-h.position):l>n&&a.majorChanged&&(q.position=n,q.length=l-n,k.push(q),f.length=n-f.position),f.setProperties&&r(f.setProperties)&&k.push(f),h.setProperties&&r(h.setProperties)&&b.push(h),d?(l=k,k=b):l=b}return{opSpecsA:l,opSpecsB:k}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&&(b.length+=
-a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,d=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);d>=a.sourceStartPosition&&(d-=1);b.position=c;b.length=d-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:n,RemoveCursor:n,RemoveStyle:n,RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=b.position?b.position-=a.length:a.positiona.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length;return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,
-a){b.position>=a.sourceStartPosition?b.position-=1:(b.positionb.position&&(a.position+=b.text.length);return{opSpecsA:[b],opSpecsB:[a]}},SplitParagraph:function(b,a){b.position=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&&(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:n,RemoveMember:n,RemoveStyle:n,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.positionb.sourceStartPosition)a.position-=1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:d}},SplitParagraph:function(b,a){var c,d=[b],f=[a];a.position=b.destinationStartPosition&&a.position=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:d,opSpecsB:f}},
-UpdateMember:n,UpdateMetadata:n,UpdateParagraphStyle:n},MoveCursor:{MoveCursor:n,RemoveCursor:function(b,a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:n,RemoveStyle:n,RemoveText:function(b,a){var c=k(b),d=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.positiona.position?b.position+=1:b.position===a.sourceParagraphPosition&&(a.paragraphStyleName=b.styleName,h=c(b),h.position=a.position+1,d.push(h));return{opSpecsA:d,opSpecsB:f}},UpdateMember:n,UpdateMetadata:n,UpdateParagraphStyle:n},SplitParagraph:{SplitParagraph:function(b,
-a,c){var d,f;b.position img {\n box-shadow: 0px 0px 5px rgb(90, 90, 90) inset;\n background-color: rgb(200, 200, 200);\n border-radius: 5px;\n border: 2px solid;\n height: 60px !important;\n width: 60px !important;\n display: block;\n margin: auto;\n}\n\n.webodf-caretOverlay .handle.active {\n opacity: 0.8;\n}\n\n.webodf-caretOverlay .handle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 43%;\n}\n\n.webodf-caretSizer {\n display: inline-block; /* inline-block is necessary so the width can be set to 0 */\n width: 0; /* the caret sizer shouldn't take up any horizontal space */\n visibility: hidden; /* \"hidden\" means the client rects are still calculated, but the node content is not shown */\n}\n\n/** Input Method Editor input pane & behaviours */\n/* not within a cursor */\n#eventTrap {\n height: auto;\n display: block;\n position: absolute;\n bottom: 0;\n right: 0;\n width: 1px;\n outline: none;\n opacity: 0;\n color: rgba(255, 255, 255, 0); /* hide the blinking caret by setting the colour to fully transparent */\n overflow: hidden; /* The overflow visibility is used to hide and show characters being entered */\n pointer-events: none;\n}\n\n/* within a cursor */\ncursor|cursor > #composer {\n text-decoration: underline;\n}\n\ncursor|cursor[cursor|caret-sizer-active=\"true\"],\ncursor|cursor[cursor|composing=\"true\"] {\n display: inline;\n}\n\neditinfo|editinfo {\n /* Empty or invisible display:inline elements respond very badly to mouse selection.\n Inline blocks are much more reliably selectable in Chrome & friends */\n display: inline-block;\n}\n\n.editInfoMarker {\n position: absolute;\n width: 10px;\n height: 100%;\n left: -20px;\n opacity: 0.8;\n top: 0;\n border-radius: 5px;\n background-color: transparent;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n}\n.editInfoMarker:hover {\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 1);\n}\n\n.editInfoHandle {\n position: absolute;\n background-color: black;\n padding: 5px;\n border-radius: 5px;\n opacity: 0.8;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n bottom: 100%;\n margin-bottom: 10px;\n z-index: 3;\n left: -25px;\n}\n.editInfoHandle:after {\n content: ' ';\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: black transparent transparent transparent;\n\n top: 100%;\n left: 5px;\n}\n.editInfo {\n font-family: sans-serif;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n color: white;\n width: 100%;\n height: 12pt;\n}\n.editInfoColor {\n float: left;\n width: 10pt;\n height: 10pt;\n border: 1px solid white;\n}\n.editInfoAuthor {\n float: left;\n margin-left: 5pt;\n font-size: 10pt;\n text-align: left;\n height: 12pt;\n line-height: 12pt;\n}\n.editInfoTime {\n float: right;\n margin-left: 30pt;\n font-size: 8pt;\n font-style: italic;\n color: yellow;\n height: 12pt;\n line-height: 12pt;\n}\n\n.annotationWrapper {\n display: inline;\n position: relative;\n}\n\n.annotationRemoveButton:before {\n content: '\u00d7';\n color: white;\n padding: 5px;\n line-height: 1em;\n}\n\n.annotationRemoveButton {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: black;\n box-shadow: 0px 0px 5px rgba(50, 50, 50, 0.75);\n position: absolute;\n top: -10px;\n left: -10px;\n z-index: 3;\n text-align: center;\n font-family: sans-serif;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n font-size: 15px;\n}\n.annotationRemoveButton:hover {\n cursor: pointer;\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 1);\n}\n\n.annotationNote {\n width: 4cm;\n position: absolute;\n display: inline;\n z-index: 10;\n top: 0;\n}\n.annotationNote > office|annotation {\n display: block;\n text-align: left;\n}\n\n.annotationConnector {\n position: absolute;\n display: inline;\n top: 0;\n z-index: 2;\n border-top: 1px dashed brown;\n}\n.annotationConnector.angular {\n -moz-transform-origin: left top;\n -webkit-transform-origin: left top;\n -ms-transform-origin: left top;\n transform-origin: left top;\n}\n.annotationConnector.horizontal {\n left: 0;\n}\n.annotationConnector.horizontal:before {\n content: '';\n display: inline;\n position: absolute;\n width: 0px;\n height: 0px;\n border-style: solid;\n border-width: 8.7px 5px 0 5px;\n border-color: brown transparent transparent transparent;\n top: -1px;\n left: -5px;\n}\n\noffice|annotation {\n width: 100%;\n height: 100%;\n display: none;\n background: rgb(198, 238, 184);\n background: -moz-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -webkit-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -o-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: -ms-linear-gradient(90deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n background: linear-gradient(180deg, rgb(198, 238, 184) 30%, rgb(180, 196, 159) 100%);\n box-shadow: 0 3px 4px -3px #ccc;\n}\n\noffice|annotation > dc|creator {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n color: white;\n background-color: brown;\n padding: 4px;\n}\noffice|annotation > dc|date {\n display: block;\n font-size: 10pt;\n font-weight: normal;\n font-style: normal;\n font-family: sans-serif;\n border: 4px solid transparent;\n color: black;\n}\noffice|annotation > text|list {\n display: block;\n padding: 5px;\n}\n\n/* This is very temporary CSS. This must go once\n * we start bundling webodf-default ODF styles for annotations.\n */\noffice|annotation text|p {\n font-size: 10pt;\n color: black;\n font-weight: normal;\n font-style: normal;\n text-decoration: none;\n font-family: sans-serif;\n}\n\n#annotationsPane {\n background-color: #EAEAEA;\n width: 4cm;\n height: 100%;\n display: none;\n position: absolute;\n outline: 1px solid #ccc;\n}\n\n.webodf-annotationHighlight {\n background-color: yellow;\n position: relative;\n}\n\n.webodf-selectionOverlay {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 15;\n}\n.webodf-selectionOverlay > polygon {\n fill-opacity: 0.3;\n stroke-opacity: 0.8;\n stroke-width: 1;\n fill-rule: evenodd;\n}\n\n.webodf-selectionOverlay > .webodf-draggable {\n fill-opacity: 0.8;\n stroke-opacity: 0;\n stroke-width: 8;\n pointer-events: all;\n display: none;\n\n -moz-transform-origin: center center;\n -webkit-transform-origin: center center;\n -ms-transform-origin: center center;\n transform-origin: center center;\n}\n\n#imageSelector {\n display: none;\n position: absolute;\n border-style: solid;\n border-color: black;\n}\n\n#imageSelector > div {\n width: 5px;\n height: 5px;\n display: block;\n position: absolute;\n border: 1px solid black;\n background-color: #ffffff;\n}\n\n#imageSelector > .topLeft {\n top: -4px;\n left: -4px;\n}\n\n#imageSelector > .topRight {\n top: -4px;\n right: -4px;\n}\n\n#imageSelector > .bottomRight {\n right: -4px;\n bottom: -4px;\n}\n\n#imageSelector > .bottomLeft {\n bottom: -4px;\n left: -4px;\n}\n\n#imageSelector > .topMiddle {\n top: -4px;\n left: 50%;\n margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .rightMiddle {\n top: 50%;\n right: -4px;\n margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\n#imageSelector > .bottomMiddle {\n bottom: -4px;\n left: 50%;\n margin-left: -2.5px; /* half of the width defined in #imageSelector > div */\n}\n\n#imageSelector > .leftMiddle {\n top: 50%;\n left: -4px;\n margin-top: -2.5px; /* half of the height defined in #imageSelector > div */\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar\n{\n width: 8px;\n height: 8px;\n background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-track\n{\n background-color: transparent;\n}\n\ndiv.webodf-customScrollbars::-webkit-scrollbar-thumb\n{\n background-color: #444;\n border-radius: 4px;\n}\n\n.webodf-hyperlinkTooltip {\n display: none;\n color: white;\n background-color: black;\n border-radius: 5px;\n box-shadow: 2px 2px 5px gray;\n padding: 3px;\n position: absolute;\n max-width: 210px;\n text-align: left;\n word-break: break-all;\n z-index: 16;\n}\n\n.webodf-hyperlinkTooltipText {\n display: block;\n font-weight: bold;\n}\n";
+odf.StyleCache=function(f){function k(b,a,c,e){a=c.getAttributeNS(a,"class-names");var d;if(a)for(a=a.split(" "),d=0;db.length;a&&f(b);return a}function a(b,a){function c(f){b[f]===a&&d.push(f)}var d=[];b&&["style:parent-style-name","style:next-style-name"].forEach(c);return d}function d(b,a){function c(d){b[d]===a&&delete b[d]}b&&["style:parent-style-name","style:next-style-name"].forEach(c)}function c(b){var a={};Object.keys(b).forEach(function(d){a[d]="object"===typeof b[d]?c(b[d]):b[d]});return a}function h(b,
+a,c,d){var f,h=!1,k=!1,m,l=[];d&&d.attributes&&(l=d.attributes.split(","));b&&(c||0=a.position+a.length)){f=d?b:a;h=d?a:b;if(b.position!==a.position||b.length!==a.length)r=c(f),x=c(h);a=m(h.setProperties,null,f.setProperties,null,"style:text-properties");if(a.majorChanged||a.minorChanged)k=[],b=[],l=f.position+f.length,p=h.position+h.length,h.positionl?a.minorChanged&&(r=x,r.position=l,r.length=p-l,b.push(r),h.length=l-h.position):l>p&&a.majorChanged&&(r.position=p,r.length=l-p,k.push(r),f.length=p-f.position),f.setProperties&&q(f.setProperties)&&k.push(f),h.setProperties&&q(h.setProperties)&&b.push(h),d?(l=k,k=b):l=b}return{opSpecsA:l,opSpecsB:k}},InsertText:function(b,a){a.position<=b.position?b.position+=a.text.length:a.position<=b.position+b.length&&
+(b.length+=a.text.length);return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){var c=b.position,d=b.position+b.length;c>=a.sourceStartPosition&&(c-=1);d>=a.sourceStartPosition&&(d-=1);b.position=c;b.length=d-c;return{opSpecsA:[b],opSpecsB:[a]}},MoveCursor:l,RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=b.position+b.length,d=a.position+a.length,f=[b],h=[a];d<=b.position?b.position-=a.length:a.positiona.position?b.position+=a.text.length:c?a.position+=b.text.length:b.position+=a.text.length;
+return{opSpecsA:[b],opSpecsB:[a]}},MergeParagraph:function(b,a){b.position>=a.sourceStartPosition?b.position-=1:(b.positionb.position&&(a.position+=b.text.length);return{opSpecsA:[b],
+opSpecsB:[a]}},SplitParagraph:function(b,a){b.position=b.sourceStartPosition&&(f-=1);c>=b.sourceStartPosition&&
+(c-=1);0<=a.length?(a.position=f,a.length=c-f):(a.position=c,a.length=f-c);return{opSpecsA:[b],opSpecsB:[a]}},RemoveCursor:l,RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){a.position>=b.sourceStartPosition?a.position-=1:(a.positionb.sourceStartPosition)a.position-=
+1;else if(a.position===b.destinationStartPosition||a.position===b.sourceStartPosition)a.position=b.destinationStartPosition,b.paragraphStyleName=a.styleName;return{opSpecsA:c,opSpecsB:d}},SplitParagraph:function(b,a){var c,d=[b],f=[a];a.position=b.destinationStartPosition&&a.position=b.sourceStartPosition&&(a.position-=1,a.sourceParagraphPosition-=1);return{opSpecsA:d,opSpecsB:f}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},MoveCursor:{MoveCursor:l,RemoveCursor:function(b,
+a){return{opSpecsA:b.memberid===a.memberid?[]:[b],opSpecsB:[a]}},RemoveMember:l,RemoveStyle:l,RemoveText:function(b,a){var c=k(b),d=b.position+b.length,h=a.position+a.length;h<=b.position?b.position-=a.length:a.positiond.position?a.position+=1:a.position===d.sourceParagraphPosition&&(d.paragraphStyleName=a.styleName,h=c(a),h.position=d.position+1,f.push(h));return{opSpecsA:f,opSpecsB:g}},UpdateMember:l,UpdateMetadata:l,UpdateParagraphStyle:l},SplitParagraph:{SplitParagraph:function(a,c,d){var f,h;a.position