// Input 0 /* @licstart The JavaScript code in this page is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License (GNU AGPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The code is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details. As additional permission under GNU AGPL version 3 section 7, you may distribute non-source (e.g., minimized or compacted) forms of that code without the copy of the GNU GPL normally required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source. As a special exception to the AGPL, any HTML file which merely makes function calls to this code, and for that purpose includes it by reference shall be deemed a separate work for copyright law purposes. In addition, the copyright holders of this code give you permission to combine this code with free software libraries that are released under the GNU LGPL. You may copy and distribute such a system following the terms of the GNU AGPL for this code and the LGPL for the libraries. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. This license applies to this entire compilation. @licend @source: http://www.webodf.org/ @source: http://gitorious.org/odfkit/webodf/ */ var core={},gui={},xmldom={},odf={}; // Input 1 function Runtime(){}Runtime.ByteArray=function(){};Runtime.ByteArray.prototype.slice=function(){};Runtime.prototype.byteArrayFromArray=function(){};Runtime.prototype.byteArrayFromString=function(){};Runtime.prototype.byteArrayToString=function(){};Runtime.prototype.concatByteArrays=function(){};Runtime.prototype.read=function(){};Runtime.prototype.readFile=function(){};Runtime.prototype.readFileSync=function(){};Runtime.prototype.loadXML=function(){};Runtime.prototype.writeFile=function(){}; Runtime.prototype.isFile=function(){};Runtime.prototype.getFileSize=function(){};Runtime.prototype.deleteFile=function(){};Runtime.prototype.log=function(){};Runtime.prototype.setTimeout=function(){};Runtime.prototype.libraryPaths=function(){};Runtime.prototype.type=function(){};Runtime.prototype.getDOMImplementation=function(){};Runtime.prototype.getWindow=function(){};var IS_COMPILED_CODE=!0; Runtime.byteArrayToString=function(h,l){function f(f){var a="",c,b=f.length,d,i,e;for(c=0;cd?a+=String.fromCharCode(d):(c+=1,i=f[c],224>d?a+=String.fromCharCode((d&31)<<6|i&63):(c+=1,e=f[c],a+=String.fromCharCode((d&15)<<12|(i&63)<<6|e&63)));return a}if("utf8"===l)return f(h);"binary"!==l&&this.log("Unsupported encoding: "+l);return function(f){var a="",c,b=f.length;for(c=0;cg?(a[j]=g,j+=1):2048>g?(a[j]=192|g>>>6,a[j+1]=128|g&63,j+=2):(a[j]=224|g>>>12&15,a[j+1]=128|g>>>6&63,a[j+2]=128|g&63,j+=3);return a}"binary"!==b&&f.log("unknown encoding: "+b);d=c.length;a=new f.ByteArray(d);for(e=0;ei.status||0===i.status?a(null):a("Status "+i.status+": "+i.responseText||i.statusText))};b=b.buffer&&!i.sendAsBinary?b.buffer:f.byteArrayToString(b,"binary");try{i.sendAsBinary?i.sendAsBinary(b):i.send(b)}catch(e){f.log("HUH? "+e+" "+b),a(e.message)}};this.deleteFile=function(c,a){var d=new XMLHttpRequest;d.open("DELETE",c,!0);d.onreadystatechange=function(){4===d.readyState&&(200>d.status&&300<= d.status?a(d.responseText):a(null))};d.send(null)};this.loadXML=function(c,a){var d=new XMLHttpRequest;d.open("GET",c,!0);d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){4===d.readyState&&(0===d.status&&!d.responseText?a("File "+c+" is empty."):200===d.status||0===d.status?a(null,d.responseXML):a(d.responseText))};try{d.send(null)}catch(i){a(i.message)}};this.isFile=function(c,a){f.getFileSize(c,function(c){a(-1!==c)})};this.getFileSize=function(c,a){var d=new XMLHttpRequest; d.open("HEAD",c,!0);d.onreadystatechange=function(){if(4===d.readyState){var c=d.getResponseHeader("Content-Length");c?a(parseInt(c,10)):a(-1)}};d.send(null)};this.log=l;this.setTimeout=function(c,a){setTimeout(function(){c()},a)};this.libraryPaths=function(){return["lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.exit=function(c){l("Calling exit with code "+c+", but exit() is not implemented.")}; this.getWindow=function(){return window}} function NodeJSRuntime(){var h=require("fs"),l="";this.ByteArray=function(f){return new Buffer(f)};this.byteArrayFromArray=function(f){var m=new Buffer(f.length),a,c=f.length;for(a=0;a>>18],c+=u[b>>>12&63],c+=u[b>>>6&63],c+=u[b&63];e===d+1?(b=a[e]<<4,c+=u[b>>>6],c+=u[b&63],c+="=="):e===d&&(b=a[e]<<10|a[e+1]<<2,c+=u[b>>>12],c+=u[b>>>6&63],c+=u[b&63],c+="=");return c}function f(a){var a=a.replace(/[^A-Za-z0-9+\/]+/g,""),c=[],b=a.length%4,e,d=a.length,k;for(e=0;e>16,k>>8&255,k&255);c.length-=[0,0,2,1][b];return c}function m(a){var c=[],b,e=a.length,d;for(b=0;bd?c.push(d):2048>d?c.push(192|d>>>6,128|d&63):c.push(224|d>>>12&15,128|d>>>6&63,128|d&63);return c}function a(a){var c=[],b,e=a.length,d,k,g;for(b=0;bd?c.push(d):(b+=1,k=a[b],224>d?c.push((d&31)<<6|k&63):(b+=1,g=a[b],c.push((d&15)<<12|(k&63)<<6|g&63)));return c}function c(a){return l(h(a))} function b(a){return String.fromCharCode.apply(String,f(a))}function d(c){return a(h(c))}function i(c){for(var c=a(c),b="",e=0;ec?e+=String.fromCharCode(c):(g+=1,d=a.charCodeAt(g)&255,224>c?e+=String.fromCharCode((c&31)<<6|d&63):(g+=1,k=a.charCodeAt(g)&255,e+=String.fromCharCode((c&15)<<12|(d&63)<<6|k&63)));return e}function g(a,c){function b(){var p= g+d;if(p>a.length)p=a.length;k+=e(a,g,p);g=p;p=g===a.length;c(k,p)&&!p&&runtime.setTimeout(b,0)}var d=1E5,k="",g=0;a.lengthc;c+=1)a.push(65+c);for(c=0;26>c;c+=1)a.push(97+c);for(c= 0;10>c;c+=1)a.push(48+c);a.push(43);a.push(47);return a})();var o=function(a){var c={},b,e;for(b=0,e=a.length;b>>8):(la(c&255),la(c>>>8))},na=function(){r=(r<<5^n[q+3-1]&255)&8191;s=k[32768+r];k[q&32767]=s;k[32768+r]=q},P=function(a,c){z>16-c?(p|=a<>16-z,z+=c-16):(p|=a<a;a++)n[a]=n[a+32768];y-=32768;q-=32768;D-=32768;for(a=0;8192>a;a++)c=k[32768+a],k[32768+a]=32768<=c?c-32768:0;for(a=0;32768>a;a++)c=k[a],k[a]=32768<=c?c-32768:0;b+=32768}w||(a=xa(n,q+x,b),0>=a?w=!0:x+=a)},ya=function(a){var c=T,b=q,e,d=F,g=32506=Y&&(c>>=2);do if(e=a,!(n[e+d]!==i||n[e+d-1]!==f||n[e]!==n[b]||n[++e]!==n[b+1])){b+=2;e++;do++b; while(n[b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&n[++b]===n[++e]&&bd){y=a;d=e;if(258<=e)break;f=n[b+d-1];i=n[b+d]}}while((a=k[a&32767])>g&&0!==--c);return d},ga=function(a,c){o[V++]=c;0===a?B[c].fc++:(a--,B[$[c]+256+1].fc++,J[(256>a?Z[a]:Z[256+(a>>7)])&255].fc++,u[ia++]=a,aa|=ea);ea<<=1;0===(V&7)&&(da[pa++]=aa,aa=0,ea=1);if(2d;d++)b+=J[d].fc*(5+fa[d]); b>>=3;if(ia>=1,b<<=1;while(0<--c);return b>>1},Aa=function(a,c){var b=[];b.length=16;var e=0,d;for(d=1;15>=d;d++)e=e+M[d-1]<<1,b[d]=e;for(e=0;e<=c;e++)if(d=a[e].dl,0!==d)a[e].fc=za(b[d]++,d)},ua=function(a){var c=a.dyn_tree,b=a.static_tree,e=a.elems,d,k=-1,g=e;O=0; S=573;for(d=0;dO;)d=H[++O]=2>k?++k:0,c[d].fc=1,N[d]=0,W--,null!==b&&(ba-=b[d].dl);a.max_code=k;for(d=O>>1;1<=d;d--)ta(c,d);do d=H[1],H[1]=H[O--],ta(c,1),b=H[1],H[--S]=d,H[--S]=b,c[g].fc=c[d].fc+c[b].fc,N[g]=N[d]>N[b]+1?N[d]:N[b]+1,c[d].dl=c[b].dl=g,H[1]=g++,ta(c,1);while(2<=O);H[--S]=H[1];g=a.dyn_tree;d=a.extra_bits;var e=a.extra_base,b=a.max_code,p=a.max_length,f=a.static_tree,i,o,j,q,t=0;for(o=0;15>=o;o++)M[o]=0;g[H[S]].dl=0;for(a=S+1;573> a;a++)if(i=H[a],o=g[g[i].dl].dl+1,o>p&&(o=p,t++),g[i].dl=o,!(i>b))M[o]++,j=0,i>=e&&(j=d[i-e]),q=g[i].fc,W+=q*(o+j),null!==f&&(ba+=q*(f[i].dl+j));if(0!==t){do{for(o=p-1;0===M[o];)o--;M[o]--;M[o+1]+=2;M[p]--;t-=2}while(0b)){if(g[d].dl!==o)W+=(o-g[d].dl)*g[d].fc,g[d].fc=o;i--}}Aa(c,k)},Ba=function(a,c){var b,e=-1,d,k=a[0].dl,g=0,p=7,o=4;0===k&&(p=138,o=3);a[c+1].dl=65535;for(b=0;b<=c;b++)d=k,k=a[b+1].dl,++g=g?K[17].fc++:K[18].fc++,g=0,e=d,0===k?(p=138,o=3):d===k?(p=6,o=3):(p=7,o=4))},Ca=function(){8b?Z[b]:Z[256+(b>>7)])&255,X(p,c),i=fa[p],0!==i&&(b-=ca[p],P(b,i))),g>>=1;while(e=g?(X(17,K),P(g-3,3)):(X(18,K),P(g-11,7));g=0;e=d;0===k?(p=138,o=3):d===k?(p=6,o=3):(p=7,o=4)}},Fa=function(){var a;for(a=0;286>a;a++)B[a].fc=0;for(a=0;30>a;a++)J[a].fc=0;for(a=0;19>a;a++)K[a].fc=0;B[256].fc=1;aa=V=ia=pa=W=ba=0;ea=1},oa=function(a){var c,b,e,d;d=q-D;da[pa]=aa;ua(G);ua(C);Ba(B,G.max_code);Ba(J,C.max_code);ua(U);for(e=18;3<=e&&!(0!==K[va[e]].dl);e--);W+=3* (e+1)+14;c=W+3+7>>3;b=ba+3+7>>3;b<=c&&(c=b);if(d+4<=c&&0<=D){P(0+a,3);Ca();ma(d);ma(~d);for(e=0;eb.len)o=b.len;for(i=0;ig-j&&(o=g-j);for(i=0;if;f++){ha[f]=o;for(d= 0;d<1<f;f++){ca[f]=o;for(d=0;d<1<>=7;30>f;f++){ca[f]=o<<7;for(d=0;d<1<=d;d++)M[d]=0;for(d=0;143>=d;)I[d++].dl=8,M[8]++;for(;255>=d;)I[d++].dl=9,M[9]++;for(;279>=d;)I[d++].dl=7,M[7]++;for(;287>=d;)I[d++].dl=8,M[8]++;Aa(I,287);for(d=0;30>d;d++)Q[d].dl=5,Q[d].fc=za(d,5);Fa()}for(d=0;8192>d;d++)k[32768+d]=0;L=ka[R].max_lazy;Y=ka[R].good_length;T=ka[R].max_chain;D=q=0;x=xa(n,0,65536);if(0>=x)w=!0,x= 0;else{for(w=!1;262>x&&!w;)sa();for(d=r=0;2>d;d++)r=(r<<5^n[d]&255)&8191}b=null;j=g=0;3>=R?(F=2,v=0):(v=2,A=0);t=!1}i=!0;if(0===x)return t=!0,0}if((d=Ga(a,c,e))===e)return e;if(t)return d;if(3>=R)for(;0!==x&&null===b;){na();0!==s&&32506>=q-s&&(v=ya(s),v>x&&(v=x));if(3<=v)if(f=ga(q-y,v-3),x-=v,v<=L){v--;do q++,na();while(0!==--v);q++}else q+=v,v=0,r=n[q]&255,r=(r<<5^n[q+1]&255)&8191;else f=ga(0,n[q]&255),x--,q++;f&&(oa(0),D=q);for(;262>x&&!w;)sa()}else for(;0!==x&&null===b;){na();F=v;E=y;v=2;0!==s&& F=q-s&&(v=ya(s),v>x&&(v=x),3===v&&4096x&&!w;)sa()}0===x&&(0!==A&&ga(0,n[q-1]&255),oa(1),t=!0);return d+Ga(a,d+c,e-d)};this.deflate=function(g,p){var f,j;ja=g;qa=0;"undefined"===typeof p&&(p=6);(f=p)?1>f?f=1:9f;f++)B[f]=new h;J=[];J.length=61;for(f=0;61>f;f++)J[f]=new h;I=[];I.length=288;for(f=0;288>f;f++)I[f]=new h;Q=[];Q.length=30;for(f=0;30>f;f++)Q[f]=new h;K=[];K.length=39;for(f=0;39>f;f++)K[f]=new h;G=new l;C=new l;U=new l;M=[];M.length=16;H=[];H.length=573;N=[];N.length=573;$=[];$.length=256;Z=[];Z.length=512;ha=[];ha.length=29;ca=[];ca.length=30;da=[];da.length=1024}for(var q=Array(1024),t=[];0<(f=Ia(q,0,q.length));){var x=[];x.length=f;for(j= 0;j>8&255])};this.appendUInt32LE=function(f){l.appendArray([f&255,f>>8&255,f>>16&255,f>>24&255])};this.appendString=function(m){f=runtime.concatByteArrays(f, runtime.byteArrayFromString(m,h))};this.getLength=function(){return f.length};this.getByteArray=function(){return f}}; // Input 6 core.RawInflate=function(){var h,l,f=null,m,a,c,b,d,i,e,g,j,t,n,u,o,k,p=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],z=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],D=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],r=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],s=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=[16,17,18, 0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=function(){this.list=this.next=null},v=function(){this.n=this.b=this.e=0;this.t=null},F=function(a,c,b,d,e,k){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var g=Array(this.BMAX+1),f,p,o,i,j,q,t,w=Array(this.BMAX+1),h,n,x,y=new v,m=Array(this.BMAX);i=Array(this.N_MAX);var z,s=Array(this.BMAX+1),u,r,l;l=this.root=null;for(j=0;jj&&(k=j);for(u=1<(u-=g[q])){this.status=2;this.m=k;return}if(0>(u-=g[j]))this.status=2,this.m=k;else{g[j]+=u;s[1]=q=0;h=g;n=1;for(x=2;0<--j;)s[x++]=q+=h[n++];h=a;j=n=0;do if(0!=(q=h[n++]))i[s[q]++]=j;while(++jz+w[1+i];){z+=w[1+i];i++;r=(r=o-z)>k?k:r;if((p=1<<(q=t-z))>a+1){p-=a+1;for(x=t;++qf&&z>z-w[i],m[i-1][q].e=y.e,m[i-1][q].b=y.b,m[i-1][q].n=y.n,m[i-1][q].t=y.t}y.b=t-z;n>=c?y.e=99:h[n]h[n]?16:15,y.n= h[n++]):(y.e=e[h[n]-b],y.n=d[h[n++]-b]);p=1<>z;q>=1)j^=q;for(j^=q;(j&(1<>=a;b-=a},x=function(a,c,b){var k,p,f;if(0==b)return 0;for(f=0;;){q(n);p=j.list[y(n)];for(k=p.e;16e;e++)i[E[e]]= 0;n=7;e=new F(i,19,19,null,null,n);if(0!=e.status)return-1;j=e.root;n=e.m;p=f+o;for(d=k=0;de)i[d++]=k=e;else if(16==e){q(2);e=3+y(2);w(2);if(d+e>p)return-1;for(;0p)return-1;for(;0C;C++)G[C]=8;for(;256>C;C++)G[C]=9;for(;280>C;C++)G[C]=7;for(;288>C;C++)G[C]=8;a=7;C=new F(G,288,257,z,D,a);if(0!=C.status){alert("HufBuild error: "+C.status);I=-1;break b}f=C.root;a=C.m;for(C=0;30>C;C++)G[C]=5;T=5;C=new F(G,30,0,r,s,T);if(1e&&i.setStart(g,i.startOffset-1);i.endContainer===a?i.setEnd(g,e):i.endContainer===g&&i.endOffset>e&&i.setEnd(g,i.endOffset-1)}if(d){for(c=0;c1/f?"-0":""+f)+"."):h(c+" should be "+a+" (of type "+typeof a+"). Was "+f+" (of type "+typeof f+").")}var m=0;this.shouldBeNull=function(a,c){f(a,c,"null")};this.shouldBeNonNull=function(a,c){var b,d;try{d=eval(c)}catch(f){b=f}b?h(c+" should be non-null. Threw exception "+b):null!==d?runtime.log("pass",c+" is non-null."):h(c+" should be non-null. Was "+ d)};this.shouldBe=f;this.countFailedTests=function(){return m}}; core.UnitTester=function(){var h=0,l={};this.runTests=function(f,m){function a(b){if(0===b.length)l[c]=e,h+=d.countFailedTests(),m();else{j=b[0];var f=Runtime.getFunctionName(j);runtime.log("Running "+f);n=d.countFailedTests();i.setUp();j(function(){i.tearDown();e[f]=n===d.countFailedTests();a(b.slice(1))})}}var c=Runtime.getFunctionName(f),b,d=new core.UnitTestRunner,i=new f(d),e={},g,j,t,n;if(c.hasOwnProperty(l))runtime.log("Test "+c+" has already run.");else{runtime.log("Running "+c+": "+i.description()); t=i.tests();for(g=0;g>>8^f;return b^-1}function m(a){return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&15,a>>5&63,(a&31)<<1)}function a(a){var c=a.getFullYear();return 1980>c?0:c-1980<< 25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function c(a,c){var b,e,d,f,g,i,t,h=this;this.load=function(c){if(void 0!==h.data)c(null,h.data);else{var d=g+34+b+e+256;d+t>j&&(d=j-t);runtime.read(a,t,d,function(b,e){if(b)c(b,e);else a:{var d=e,k=new core.ByteArray(d),p=k.readUInt32LE(),j;if(67324752!==p)c("File entry signature is wrong."+p.toString()+" "+d.length.toString(),null);else{k.pos+=22;p=k.readUInt16LE();j=k.readUInt16LE();k.pos+=p+j;if(f){d=d.slice(k.pos, k.pos+g);if(g!==d.length){c("The amount of compressed bytes read was "+d.length.toString()+" instead of "+g.toString()+" for "+h.filename+" in "+a+".",null);break a}d=n(d,i)}else d=d.slice(k.pos,k.pos+i);i!==d.length?c("The amount of bytes read was "+d.length.toString()+" instead of "+i.toString()+" for "+h.filename+" in "+a+".",null):(h.data=d,c(null,d))}}})}};this.set=function(a,c,b,e){h.filename=a;h.data=c;h.compressed=b;h.date=e};this.error=null;if(c)33639248!==c.readUInt32LE()?this.error="Central directory entry has wrong signature at position "+ (c.pos-4).toString()+' for file "'+a+'": '+c.data.length.toString():(c.pos+=6,f=c.readUInt16LE(),this.date=m(c.readUInt32LE()),c.readUInt32LE(),g=c.readUInt32LE(),i=c.readUInt32LE(),b=c.readUInt16LE(),e=c.readUInt16LE(),d=c.readUInt16LE(),c.pos+=8,t=c.readUInt32LE(),this.filename=runtime.byteArrayToString(c.data.slice(c.pos,c.pos+b),"utf8"),c.pos+=b+e+d)}function b(a,b){if(22!==a.length)b("Central directory length should be 22.",u);else{var e=new core.ByteArray(a),d;d=e.readUInt32LE();101010256!== d?b("Central directory signature is wrong: "+d.toString(),u):0!==e.readUInt16LE()?b("Zip files with non-zero disk numbers are not supported.",u):0!==e.readUInt16LE()?b("Zip files with non-zero disk numbers are not supported.",u):(d=e.readUInt16LE(),t=e.readUInt16LE(),d!==t?b("Number of entries is inconsistent.",u):(d=e.readUInt32LE(),e=e.readUInt16LE(),e=j-22-d,runtime.read(h,e,j-e,function(a,e){a:{var d=new core.ByteArray(e),f,p;g=[];for(f=0;fj?l("File '"+h+"' cannot be read.",u):runtime.read(h,j-22,22,function(a,c){a||null===l?l(a,u):b(c,l)})})}; // Input 12 xmldom.LSSerializerFilter=function(){}; // Input 13 "function"!==typeof Object.create&&(Object.create=function(h){var l=function(){};l.prototype=h;return new l}); xmldom.LSSerializer=function(){function h(f,m){var a="",c=Object.create(f),b=l.filter?l.filter.acceptNode(m):1,d;if(1===b){d="";var i=m.attributes,e,g,j,t="",n;if(i){if(c[m.namespaceURI]!==m.prefix)c[m.namespaceURI]=m.prefix;d+="<"+m.nodeName;e=i.length;for(g=0;g"}a+=d}if(1===b||3===b){for(d=m.firstChild;d;)a+=h(c,d),d=d.nextSibling;m.nodeValue&&(a+=m.nodeValue)}1===b&&(c="",1===m.nodeType&&(c+=""),a+=c);return a}var l=this;this.filter=null;this.writeToString=function(f,m){if(!f)return"";var a;if(m){a=m;var c={},b;for(b in a)a.hasOwnProperty(b)&&(c[a[b]]=b);a=c}else a={};return h(a, f)}}; // Input 14 xmldom.RelaxNGParser=function(){function h(a,c){this.message=function(){c&&(a+=1===c.nodeType?" Element ":" Node ",a+=c.nodeName,c.nodeValue&&(a+=" with value '"+c.nodeValue+"'"),a+=".");return a}}function l(a){if(2>=a.e.length)return a;var c={name:a.name,e:a.e.slice(0,2)};return l({name:a.name,e:[c].concat(a.e.slice(2))})}function f(a){var a=a.split(":",2),c="",b;1===a.length?a=["",a[0]]:c=a[0];for(b in d)d[b]===c&&(a[0]=b);return a}function m(a,c){var g;var e;for(var b=0,d,i,h=a.name;a.e&&b=b.length)return c;0===f&&(f=0);for(var g=b.item(f);g.namespaceURI===e;){f+=1;if(f>=b.length)return c;g=b.item(f)}return g=d(a,c.attDeriv(a,b.item(f)),b,f+1)}function i(a,c,b){b.e[0].a?(a.push(b.e[0].text),c.push(b.e[0].a.ns)):i(a,c,b.e[0]);b.e[1].a?(a.push(b.e[1].text),c.push(b.e[1].a.ns)): i(a,c,b.e[1])}var e="http://www.w3.org/2000/xmlns/",g,j,t,n,u,o,k,p,z,D,r={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return r},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return r},endTagDeriv:function(){return r}},s={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return r},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return s},endTagDeriv:function(){return r}}, E={type:"text",nullable:!0,hash:"text",textDeriv:function(){return E},startTagOpenDeriv:function(){return r},attDeriv:function(){return r},startTagCloseDeriv:function(){return E},endTagDeriv:function(){return r}},A,v,F;g=m("choice",function(a,b){if(a===r)return b;if(b===r||a===b)return a},function(b,c){var d={},e;a(d,{p1:b,p2:c});c=b=void 0;for(e in d)d.hasOwnProperty(e)&&(void 0===b?b=d[e]:c=void 0===c?d[e]:g(c,d[e]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable||b.nullable, textDeriv:function(c,d){return g(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:f(function(c){return g(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return g(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:h(function(){return g(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:h(function(){return g(a.endTagDeriv(),b.endTagDeriv())})}}(b,c)});j=function(a,b,c){return function(){var d={},e=0;return function(f,g){var k=b&&b(f,g),i,p;if(void 0!==k)return k; k=f.hash||f.toString();i=g.hash||g.toString();k=f&&b.push(l(a.substring(c,d)))):"["===a[d]&&(0>=f&&(c=d+1),f+=1),d+=1;return d};f.prototype.next=function(){};f.prototype.reset=function(){};g=function(b,e,f){var g,k,h,j;for(g= 0;g text|list-item > text|list",c-=1;try{a.insertRule(b+" > list-item:before{"+d+"}",a.cssRules.length)}catch(f){throw f;}}function e(a,f,h,m){if("list"===f)for(var o=m.firstChild,n,l;o;){if(o.namespaceURI===t)if(n=o,"list-level-style-number"===o.localName){l=n;var w=l.getAttributeNS(j,"num-format"),x=l.getAttributeNS(j,"num-suffix"),u="",u={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},L="",L=l.getAttributeNS(j,"num-prefix")|| "",L=u.hasOwnProperty(w)?L+(" counter(list, "+u[w]+")"):w?L+("'"+w+"';"):L+" ''";x&&(L+=" '"+x+"'");l=u="content: "+L+";";i(a,h,n,l)}else"list-level-style-image"===o.localName?(l="content: none;",i(a,h,n,l)):"list-level-style-bullet"===o.localName&&(l="content: '"+n.getAttributeNS(t,"bullet-char")+"';",i(a,h,n,l));o=o.nextSibling}else{h=c(f,h,m).join(",");o="";if(n=b(m,j,"text-properties")){l=""+d(n,k);w=n.getAttributeNS(j,"text-underline-style");"solid"===w&&(l+="text-decoration: underline;");if(w= n.getAttributeNS(j,"font-name"))(w='"'+w+'"')&&(l+="font-family: "+w+";");o+=l}if(n=b(m,j,"paragraph-properties")){l=n;n=""+d(l,z);l=l.getElementsByTagNameNS(j,"background-image");if(0c)break;e=e.nextSibling}a.insertBefore(b,e)}}}function a(a){this.OdfContainer=a}function c(a,b,c){var d=this,e;this.size=0;this.type=null;this.name=a;this.container=b;this.onchange=this.onreadystatechange=this.document=this.url=null;this.EMPTY=0;this.LOADING=1;this.DONE=2;this.state=this.EMPTY;this.load=function(){c.load(a,function(b,c){e=c;d.url=null;if(e){var f=0,g=u[a];g||(g=80===e[1]&&78===e[2]&&71===e[3]?"image/png":255===e[0]&&216===e[1]&& 255===e[2]?"image/jpeg":71===e[0]&&73===e[1]&&70===e[2]?"image/gif":"");for(d.url="data:"+g+";base64,";f'}function x(){var a=i.namespaces,b=new xmldom.LSSerializer,c=w("document-meta",a);b.filter=new f(B.rootElement);c+=b.writeToString(B.rootElement.meta,a);return c+""}function T(){var a=i.namespaces,b=new xmldom.LSSerializer,c=w("document-settings",a);b.filter=new f(B.rootElement); c+=b.writeToString(B.rootElement.settings,a);return c+""}function L(){var a=i.namespaces,b=new xmldom.LSSerializer,c=w("document-styles",a);b.filter=new f(B.rootElement,B.rootElement.masterStyles);c+=b.writeToString(B.rootElement.fontFaceDecls,a);c+=b.writeToString(B.rootElement.styles,a);c+=b.writeToString(B.rootElement.automaticStyles,a);c+=b.writeToString(B.rootElement.masterStyles,a);return c+""}function R(){var a=i.namespaces,b=new xmldom.LSSerializer, c=w("document-content",a);b.filter=new f(B.rootElement,B.rootElement.body);c+=b.writeToString(B.rootElement.automaticStyles,a);c+=b.writeToString(B.rootElement.body,a);return c+""}function Y(a,b){runtime.loadXML(a,function(a,c){if(a)b(a);else{var d=r(c);!d||"document"!==d.localName||d.namespaceURI!==e?s(k.INVALID):(B.rootElement=d,d.fontFaceDecls=h(d,e,"font-face-decls"),d.styles=h(d,e,"styles"),d.automaticStyles=h(d,e,"automatic-styles"),d.masterStyles=h(d,e,"master-styles"), d.body=h(d,e,"body"),d.meta=h(d,e,"meta"),s(k.DONE))}})}var B=this,J=null;this.onstatereadychange=j;this.parts=this.rootElement=this.state=this.onchange=null;this.getPart=function(a){return new c(a,B,J)};this.save=function(a){var b;b=runtime.byteArrayFromString(T(),"utf8");J.save("settings.xml",b,!0,new Date);b=runtime.byteArrayFromString(x(),"utf8");J.save("meta.xml",b,!0,new Date);b=runtime.byteArrayFromString(L(),"utf8");J.save("styles.xml",b,!0,new Date);b=runtime.byteArrayFromString(R(),"utf8"); J.save("content.xml",b,!0,new Date);J.write(function(b){a(b)})};this.state=k.LOADING;this.rootElement=function(a){var b=document.createElementNS(a.namespaceURI,a.localName),c,a=new a;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}(a);this.parts=new b(this);J=new core.Zip(d,function(a,b){J=b;a?Y(d,function(b){if(a)J.error=a+"\n"+b,s(k.INVALID)}):y()})};odf.OdfContainer.EMPTY=0;odf.OdfContainer.LOADING=1;odf.OdfContainer.DONE=2;odf.OdfContainer.INVALID=3;odf.OdfContainer.SAVING=4;odf.OdfContainer.MODIFIED= 5;odf.OdfContainer.getContainer=function(a){return new odf.OdfContainer(a,null)};return odf.OdfContainer}(); // Input 24 odf.Formatting=function(){function h(f){function h(a,b){for(var d=a&&a.firstChild;d&&b;)d=d.nextSibling,b-=1;return d}var a=h(f.startContainer,f.startOffset);h(f.endContainer,f.endOffset);this.next=function(){return null===a?a:null}}var l=new odf.StyleInfo;this.setOdfContainer=function(){};this.isCompletelyBold=function(){return!1};this.getAlignment=function(f){this.getParagraphStyles(f)};this.getParagraphStyles=function(f){var m,a,c,b=[];for(m=0;ma?-1:a-1})};a.slideChange=function(c){var b=a.getPages(a.odf_canvas.odfContainer().rootElement),d=-1,f=0;b.forEach(function(a){a=a[1];a.hasAttribute("slide_current")&&(d=f,a.removeAttribute("slide_current"));f+=1});c=c(d,b.length);-1===c&&(c=d); b[c][1].setAttribute("slide_current","1");document.getElementById("pagelist").selectedIndex=c;"cont"===a.slide_mode&&window.scrollBy(0,b[c][1].getBoundingClientRect().top-30)};a.selectSlide=function(c){a.slideChange(function(a,d){return c>=d||0>c?-1:c})};a.scrollIntoContView=function(c){var b=a.getPages(a.odf_canvas.odfContainer().rootElement);0!==b.length&&window.scrollBy(0,b[c][1].getBoundingClientRect().top-30)};a.getPages=function(a){var a=a.getElementsByTagNameNS(f("draw"),"page"),b=[],d;for(d= 0;dd}}var a=l.node().ownerDocument,c=new core.Cursor(h,a);this.movePointForward=function(a){f(a,l.stepForward)};this.movePointBackward=function(a){f(a,l.stepBackward)};this.moveLineForward=function(a){h.modify?h.modify(a?"extend":"move","forward", "line"):f(a,m)};this.moveLineBackward=function(a){h.modify?h.modify(a?"extend":"move","backward","line"):f(a,function(){})};return this}; // Input 29 runtime.loadClass("core.PointWalker");runtime.loadClass("core.Cursor"); gui.XMLEdit=function(h,l){function f(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function m(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function a(){var a=h.ownerDocument.defaultView.getSelection();a&&!(0>=a.rangeCount)&&o&&(a=a.getRangeAt(0),o.setPoint(a.startContainer,a.startOffset))}function c(){var a=h.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();o&&o.node()&&(b=o.node(),c=b.ownerDocument.createRange(), c.setStart(b,o.position()),c.collapse(!0),a.addRange(c))}function b(b){var d=b.charCode||b.keyCode;if(o=null,o&&37===d)a(),o.stepBackward(),c();else if(16<=d&&20>=d||33<=d&&40>=d)return;m(b)}function d(){}function i(a){h.ownerDocument.defaultView.getSelection().getRangeAt(0);m(a)}function e(a){for(var b=a.firstChild;b&&b!==a;)1===b.nodeType&&e(b),b=b.nextSibling||b.parentNode;var c,d,f,b=a.attributes;c="";for(f=b.length-1;0<=f;f-=1)d=b.item(f),c=c+" "+d.nodeName+'="'+d.nodeValue+'"';a.setAttribute("customns_name", a.nodeName);a.setAttribute("customns_atts",c);b=a.firstChild;for(d=/^\s*$/;b&&b!==a;)c=b,b=b.nextSibling||b.parentNode,3===c.nodeType&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function g(a,b){for(var c=a.firstChild,d,e,f;c&&c!==a;){if(1===c.nodeType){g(c,b);d=c.attributes;for(f=d.length-1;0<=f;f-=1)if(e=d.item(f),"http://www.w3.org/2000/xmlns/"===e.namespaceURI&&!b[e.nodeValue])b[e.nodeValue]=e.localName}c=c.nextSibling||c.parentNode}}function j(){var a=h.ownerDocument.createElement("style"), b;b={};g(h,b);var c={},d,e,f=0;for(d in b)if(b.hasOwnProperty(d)&&d){e=b[d];if(!e||c.hasOwnProperty(e)||"xmlns"===e){do e="ns"+f,f+=1;while(c.hasOwnProperty(e));b[d]=e}c[e]=!0}a.type="text/css";b="@namespace customns url(customns);\n"+t;a.appendChild(h.ownerDocument.createTextNode(b));l=l.parentNode.replaceChild(a,l)}var t,n,u,o=null;if(!h.id)h.id="xml"+(""+Math.random()).substring(2);n="#"+h.id+" ";t=n+"*,"+n+":visited, "+n+":link {display:block; margin: 0px; margin-left: 10px; font-size: medium; color: black; background: white; font-variant: normal; font-weight: normal; font-style: normal; font-family: sans-serif; text-decoration: none; white-space: pre-wrap; height: auto; width: auto}\n"+ n+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+n+":after {color: blue; content: '';}\n"+n+"{overflow: auto;}\n";(function(a){f(a,"click",i);f(a,"keydown",b);f(a,"keypress",d);f(a,"drop",m);f(a,"dragend",m);f(a,"beforepaste",m);f(a,"paste",m)})(h);this.updateCSS=j;this.setXML=function(a){a=a.documentElement||a;u=a=h.ownerDocument.importNode(a,!0);for(e(a);h.lastChild;)h.removeChild(h.lastChild);h.appendChild(a);j();o=new core.PointWalker(a)}; this.getXML=function(){return u}};