From 2c4835fd8e754ccbb29de95fe820fd9fa240b264 Mon Sep 17 00:00:00 2001 From: Jos van den Oever Date: Thu, 29 Sep 2011 11:29:51 +0200 Subject: [PATCH] Better positioning of frames that are anchored to paragraphs. --- webodf/lib/odf/OdfCanvas.js | 41 ++++- webodf/lib/odf/Style2CSS.js | 7 +- webodf/webodf.css | 4 + webodf/webodf.js | 325 ++++++++++++++++++------------------ 4 files changed, 207 insertions(+), 170 deletions(-) diff --git a/webodf/lib/odf/OdfCanvas.js b/webodf/lib/odf/OdfCanvas.js index 427fe25b..660d9e93 100644 --- a/webodf/lib/odf/OdfCanvas.js +++ b/webodf/lib/odf/OdfCanvas.js @@ -31,7 +31,7 @@ * @source: http://gitorious.org/odfkit/webodf/ */ /*jslint sub: true*/ -/*global runtime: true, odf: true*/ +/*global runtime: true, odf: true, XPathResult: true*/ runtime.loadClass("odf.OdfContainer"); runtime.loadClass("odf.Formatting"); /** @@ -183,7 +183,8 @@ odf.OdfCanvas = (function () { listenEvent(element, "keyup", checkSelection); listenEvent(element, "keydown", checkSelection); } - var namespaces = (new odf.Style2CSS()).namespaces, + var style2CSS = new odf.Style2CSS(), + namespaces = style2CSS.namespaces, drawns = namespaces.draw, fons = namespaces.fo, svgns = namespaces.svg, @@ -320,6 +321,37 @@ odf.OdfCanvas = (function () { runtime.log('slight problem: ' + e); } } + /** + * @param {!Element} node + * @param {!string} xpath + * @return {!Array.} + */ + function getODFElementsWithXPath(node, xpath) { + var doc = node.ownerDocument, + nodes = doc.evaluate(xpath, node, style2CSS.namespaceResolver, + XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null), + elements = [], n; + n = nodes.iterateNext(); + while (n !== null) { + if (n.nodeType === 1) { + elements.push(n); + } + n = nodes.iterateNext(); + } + return elements; + } + function formatParagraphAnchors(odfbody) { + var runtimens = "urn:webodf", + n, i, + nodes = getODFElementsWithXPath(odfbody, + ".//*[*[@text:anchor-type='paragraph']]"); + for (i = 0; i < nodes.length; i += 1) { + n = nodes[i]; + if (n.setAttributeNS) { + n.setAttributeNS(runtimens, "containsparagraphanchor", true); + } + } + } /** * @param {!Object} container * @param {!Element} odfbody @@ -353,13 +385,14 @@ odf.OdfCanvas = (function () { } for (i = 0; i < frames.length; i += 1) { node = frames[i]; - setFramePosition('frame' + i, node, stylesheet); + setFramePosition('frame' + String(i), node, stylesheet); } images = odfbody.getElementsByTagNameNS(drawns, 'image'); for (i = 0; i < images.length; i += 1) { node = /**@type{!Element}*/(images.item(i)); - setImage('image' + i, container, node, stylesheet); + setImage('image' + String(i), container, node, stylesheet); } + formatParagraphAnchors(odfbody); } /** * @param {Document} document Put and ODF Canvas inside this element. diff --git a/webodf/lib/odf/Style2CSS.js b/webodf/lib/odf/Style2CSS.js index 2cf9f4b5..ccb1e6d3 100644 --- a/webodf/lib/odf/Style2CSS.js +++ b/webodf/lib/odf/Style2CSS.js @@ -157,7 +157,7 @@ odf.Style2CSS = function Style2CSS() { * @return {string} */ function namespaceResolver(prefix) { - return namespaces[prefix]; + return namespaces[prefix] || null; } /** * @param {!Document} doc @@ -571,9 +571,8 @@ odf.Style2CSS = function Style2CSS() { // elements this.namespaces = namespaces; - this.namespaceResolver = function (prefix) { - return namespaces[prefix]; - }; + this.namespaceResolver = namespaceResolver; + this.namespaceResolver.lookupNamespaceURI = this.namespaceResolver; /** * @param {!StyleSheet} stylesheet diff --git a/webodf/webodf.css b/webodf/webodf.css index 5763563b..8fd791e6 100644 --- a/webodf/webodf.css +++ b/webodf/webodf.css @@ -6,6 +6,7 @@ @namespace svg url(urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0); @namespace table url(urn:oasis:names:tc:opendocument:xmlns:table:1.0); @namespace text url(urn:oasis:names:tc:opendocument:xmlns:text:1.0); +@namespace runtimens url(urn:webodf); /* namespace for runtime only */ office|document > *, office|document-content > * { display: none; @@ -22,6 +23,9 @@ text|p, text|h { text|h { font-weight: bold; } +*[runtimens|containsparagraphanchor] { + position: relative; +} text|s:before { /* this needs to be the number of spaces given by text:c */ content: ' '; } diff --git a/webodf/webodf.js b/webodf/webodf.js index 4fe7a91c..8df665a4 100644 --- a/webodf/webodf.js +++ b/webodf/webodf.js @@ -35,171 +35,171 @@ 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(i,m){function g(b){var a="",h,e=b.length,c,d,f;for(h=0;h128)+(k>2048);d=new g.ByteArray(b);for(f=b=0;f>>6,d[b+1]=128|k&63,b+=2):(d[b]=224|k>>>12&15,d[b+1]=128|k>>>6&63,d[b+2]=128|k&63,b+=3);return d}else e!=="binary"&&g.log("unknown encoding: "+e);c=a.length;d=new g.ByteArray(c);for(f=0;f=200&&d.status<300||d.status===0?c(null):c("Status "+String(d.status)+": "+d.responseText||d.statusText))};e=e.buffer&&!d.sendAsBinary?e.buffer:g.byteArrayToString(e,"binary");try{d.sendAsBinary?d.sendAsBinary(e):d.send(e)}catch(f){g.log("HUH? "+f+" "+e),c(f.message)}};this.deleteFile=function(a,e){var c=new XMLHttpRequest;c.open("DELETE", -a,!0);c.onreadystatechange=function(){c.readyState===4&&(c.status<200&&c.status>=300?e(c.responseText):e(null))};c.send(null)};this.loadXML=function(a,e){var c=new XMLHttpRequest;c.open("GET",a,!0);c.overrideMimeType("text/xml");c.onreadystatechange=function(){c.readyState===4&&(c.status===0&&!c.responseText?e("File "+a+" is empty."):c.status===200||c.status===0?e(null,c.responseXML):e(c.responseText))};try{c.send(null)}catch(d){e(d.message)}};this.isFile=function(a,e){this.getFileSize(a,function(a){e(a!== --1)})};this.getFileSize=function(a,e){var c=new XMLHttpRequest;c.open("HEAD",a,!0);c.onreadystatechange=function(){if(c.readyState===4){var a=c.getResponseHeader("Content-Length");a?e(parseInt(a,10)):e(-1)}};c.send(null)};this.log=m;this.setTimeout=function(a,e){setTimeout(a,e)};this.libraryPaths=function(){return["../lib",".","lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.exit= +Runtime.byteArrayToString=function(j,m){function h(e){var a="",d,g=e.length,b,c,f;for(d=0;d128)+(l>2048);c=new h.ByteArray(e);for(f=e=0;f>>6,c[e+1]=128|l&63,e+=2):(c[e]=224|l>>>12&15,c[e+1]=128|l>>>6&63,c[e+2]=128|l&63,e+=3);return c}else g!=="binary"&&h.log("unknown encoding: "+g);b=a.length;c=new h.ByteArray(b);for(f=0;f=200&&c.status<300||c.status===0?b(null):b("Status "+String(c.status)+": "+c.responseText||c.statusText))};g=g.buffer&&!c.sendAsBinary?g.buffer:h.byteArrayToString(g,"binary");try{c.sendAsBinary?c.sendAsBinary(g):c.send(g)}catch(f){h.log("HUH? "+f+" "+g),b(f.message)}};this.deleteFile=function(a,g){var b=new XMLHttpRequest;b.open("DELETE", +a,!0);b.onreadystatechange=function(){b.readyState===4&&(b.status<200&&b.status>=300?g(b.responseText):g(null))};b.send(null)};this.loadXML=function(a,g){var b=new XMLHttpRequest;b.open("GET",a,!0);b.overrideMimeType("text/xml");b.onreadystatechange=function(){b.readyState===4&&(b.status===0&&!b.responseText?g("File "+a+" is empty."):b.status===200||b.status===0?g(null,b.responseXML):g(b.responseText))};try{b.send(null)}catch(c){g(c.message)}};this.isFile=function(a,g){this.getFileSize(a,function(a){g(a!== +-1)})};this.getFileSize=function(a,g){var b=new XMLHttpRequest;b.open("HEAD",a,!0);b.onreadystatechange=function(){if(b.readyState===4){var a=b.getResponseHeader("Content-Length");a?g(parseInt(a,10)):g(-1)}};b.send(null)};this.log=m;this.setTimeout=function(a,g){setTimeout(a,g)};this.libraryPaths=function(){return["../lib",".","lib"]};this.setCurrentDirectory=function(){};this.type=function(){return"BrowserRuntime"};this.getDOMImplementation=function(){return window.document.implementation};this.exit= function(a){m("Calling exit with code "+String(a)+", but exit() is not implemented.")};this.getWindow=function(){return window}} -function NodeJSRuntime(){var i=require("fs"),m="";this.ByteArray=function(g){return new Buffer(g)};this.byteArrayFromArray=function(g){var b=new Buffer(g.length),a,h=g.length;for(a=0;a>>18],f+=u[c>>>12&63],f+=u[c>>>6&63],f+=u[c&63];d===b+1?(c=a[d]<<4,f+=u[c>>>6],f+=u[c&63],f+="=="):d===b&&(c=a[d]<<10|a[d+1]<<2,f+=u[c>>>12],f+=u[c>>>6&63],f+=u[c&63],f+="=");return f}function g(a){var a=a.replace(/[^A-Za-z0-9+\/]+/g,""),c=[],f=a.length%4,d,b=a.length,l;for(d=0;d>16,l>>8&255,l&255);c.length-=[0,0,2,1][f];return c}function b(a){var c=[],f,d=a.length,b;for(f=0;f>>6,128|b&63):c.push(224|b>>>12&15,128|b>>>6&63,128|b&63);return c}function a(a){var c=[],f,d=a.length,b,l,e;for(f=0;fa.length)r=a.length;l+=f(a,e,r);e=r;r=e===a.length; -c(l,r)&&!r&&runtime.setTimeout(d,0)}var b=1E5,l="",e=0;a.length>>18],f+=u[b>>>12&63],f+=u[b>>>6&63],f+=u[b&63];c===i+1?(b=a[c]<<4,f+=u[b>>>6],f+=u[b&63],f+="=="):c===i&&(b=a[c]<<10|a[c+1]<<2,f+=u[b>>>12],f+=u[b>>>6&63],f+=u[b&63],f+="=");return f}function h(a){var a=a.replace(/[^A-Za-z0-9+\/]+/g,""),b=[],f=a.length%4,c,i=a.length,g;for(c=0;c>16,g>>8&255,g&255);b.length-=[0,0,2,1][f];return b}function e(a){var b=[],f,c=a.length,i;for(f=0;f>>6,128|i&63):b.push(224|i>>>12&15,128|i>>>6&63,128|i&63);return b}function a(a){var b=[],f,c=a.length,i,g,d;for(f=0;fa.length)e=a.length;g+=f(a,d,e);d=e;e=d===a.length; +b(g,e)&&!e&&runtime.setTimeout(c,0)}var i=1E5,g="",d=0;a.length>>8):(ka(c&255),ka(c>>>8))},ma=function(){s=(s<<5^j[r+3-1]&255)&8191;C=l[32768+s];l[r&32767]=C;l[32768+s]=r},V=function(a,c){O(c[a].fc,c[a].dl)},wa=function(a,c,f){return a[c].fc32506? -r-32506:0,n=r+258,g=j[f+b-1],k=j[f+b];J>=X&&(c>>=2);do if(d=a,!(j[d+b]!=k||j[d+b-1]!=g||j[d]!=j[f]||j[++d]!=j[f+1])){f+=2;d++;do;while(j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&j[++f]==j[++d]&&fb){y=a;b=d;if(d>=258)break;g=j[f+b-1];k=j[f+b]}}while((a=l[a&32767])>e&&--c!=0);return b},sa=function(){var a,c,f=65536-n-r;if(f==-1)f--;else if(r>=65274){for(a=0;a<32768;a++)j[a]=j[a+32768];y-=32768;r-=32768; -B-=32768;for(a=0;a<8192;a++)c=l[32768+a],l[32768+a]=c>=32768?c-32768:0;for(a=0;a<32768;a++)c=l[a],l[a]=c>=32768?c-32768:0;f+=32768}v||(a=xa(j,r+n,f),a<=0?v=!0:n+=a)},Ia=function(a,c,f){var b;if(!d){if(!v){x=t=0;var g,h;if(L[0].dl==0){D.dyn_tree=P;D.static_tree=G;D.extra_bits=ra;D.extra_base=257;D.elems=286;D.max_length=15;D.max_code=0;z.dyn_tree=S;z.static_tree=L;z.extra_bits=ba;z.extra_base=0;z.elems=30;z.max_length=15;z.max_code=0;N.dyn_tree=H;N.static_tree=null;N.extra_bits=Ha;N.extra_base=0;N.elems= -19;N.max_length=7;for(h=g=N.max_code=0;h<28;h++){oa[h]=g;for(b=0;b<1<>=7;h<30;h++){da[h]=g<<7;for(b=0;b<1<n&&(w=n));if(w>=3)if(h=ca(r-y,w-3),n-=w,w<=F){w--;do r++,ma();while(--w!=0);r++}else r+=w,w=0,s=j[r]&255,s=(s<<5^j[r+1]&255)&8191;else h=ca(0,j[r]&255),n--,r++;h&&(na(0),B=r);for(;n<262&&!v;)sa()}else for(;n!= -0&&e==null;){ma();J=w;A=y;w=2;C!=0&&Jn&&(w=n),w==3&&r-y>4096&&w--);if(J>=3&&w<=J){h=ca(r-1-A,J-3);n-=J-1;J-=2;do r++,ma();while(--J!=0);E=0;w=2;r++;h&&(na(0),B=r)}else E!=0?ca(0,j[r-1]&255)&&(na(0),B=r):E=1,r++,n--;for(;n<262&&!v;)sa()}n==0&&(E!=0&&ca(0,j[r-1]&255),na(1),o=!0);return b+Ca(a,b+c,f-b)},Ca=function(a,c,b){var d,l,g;for(d=0;e!=null&&de.len)l=e.len;for(g=0;gk-p&&(l=k-p);for(g=0;g>1;d>=1;d--)ta(c,d);do d=K[1],K[1]=K[T--],ta(c,1),b=K[1],K[--Y]=d,K[--Y]=b,c[e].fc=c[d].fc+c[b].fc,Q[e]=Q[d]>Q[b]+1?Q[d]:Q[b]+1,c[d].dl=c[b].dl=e,K[1]=e++,ta(c,1);while(T>=2);K[--Y]=K[1];e=a.dyn_tree;d=a.extra_bits;var f=a.extra_base,b=a.max_code,g=a.max_length, -r=a.static_tree,n,j,h,k,o=0;for(j=0;j<=15;j++)M[j]=0;e[K[Y]].dl=0;for(a=Y+1;a<573;a++)if(n=K[a],j=e[e[n].dl].dl+1,j>g&&(j=g,o++),e[n].dl=j,!(n>b))M[j]++,h=0,n>=f&&(h=d[n-f]),k=e[n].fc,Z+=k*(j+h),r!=null&&(ha+=k*(r[n].dl+h));if(o!=0){do{for(j=g-1;M[j]==0;)j--;M[j]--;M[j+1]+=2;M[g]--;o-=2}while(o>0);for(j=g;j!=0;j--)for(n=M[j];n!=0;)if(d=K[--a],!(d>b)){if(e[d].dl!=j)Z+=(j-e[d].dl)*e[d].fc,e[d].fc=j;n--}}za(c,l)},Da=function(a,c){var d,b=-1,f,l=a[0].dl,e=0,g=7,j=4;l==0&&(g=138,j=3);a[c+1].dl=65535;for(d= -0;d<=c;d++)f=l,l=a[d+1].dl,++e=3;f--)if(H[va[f]].dl!=0)break;Z+=3*(f+1)+14;c=Z+3+7>>3;d=ha+3+7>>3;d<=c&&(c=d);if(b+4<=c&&B>=0){O(0+a,3);Fa();la(b);la(~b);for(f=0;f>7)])& -255].fc++,u[fa++]=a,aa|=ga);ga<<=1;(U&7)==0&&(ea[pa++]=aa,aa=0,ga=1);if(R>2&&(U&4095)==0){var d=U*8,f=r-B,b;for(b=0;b<30;b++)d+=S[b].fc*(5+ba[b]);d>>=3;if(fa>7)])&255,V(g,c),j=ba[g],j!=0&&(d-=da[g],O(d,j))),e>>=1;while(f16-c?(t|=a<>16-x,x+=c-16):(t|=a<>=1,d<<=1;while(--c>0);return d>>1},Fa=function(){x>8?la(t):x>0&&ka(t);x=t=0};this.deflate=function(b,g){var n,r;ia=b;qa=0;typeof g=="undefined"&&(g=6);(n=g)?n<1?n=1:n>9&&(n=9):n=6;R=n;v=d=!1;if(f==null){h=e=c=null;f=Array(a);j=Array(65536);u=Array(8192);q=Array(32832);l=Array(65536);P=Array(573);for(n=0;n<573;n++)P[n]=new i;S=Array(61);for(n=0;n<61;n++)S[n]=new i;G=Array(288);for(n=0;n<288;n++)G[n]=new i; -L=Array(30);for(n=0;n<30;n++)L[n]=new i;H=Array(39);for(n=0;n<39;n++)H[n]=new i;D=new m;z=new m;N=new m;M=Array(16);K=Array(573);Q=Array(573);$=Array(256);W=Array(512);oa=Array(29);da=Array(30);ea=Array(1024)}for(var k=Array(1024),o=[];(n=Ia(k,0,k.length))>0;){var p=Array(n);for(r=0;r>>8):(ka(b&255),ka(b>>>8))},ma=function(){s=(s<<5^k[p+3-1]&255)&8191;A=i[32768+s];i[p&32767]=A;i[32768+s]=p},V=function(a,b){O(b[a].fc,b[a].dl)},wa=function(a,b,f){return a[b].fc32506? +p-32506:0,e=p+258,h=k[f+g-1],l=k[f+g];B>=X&&(b>>=2);do if(c=a,!(k[c+g]!=l||k[c+g-1]!=h||k[c]!=k[f]||k[++c]!=k[f+1])){f+=2;c++;do;while(k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&k[++f]==k[++c]&&fg){x=a;g=c;if(c>=258)break;h=k[f+g-1];l=k[f+g]}}while((a=i[a&32767])>d&&--b!=0);return g},sa=function(){var a,b,f=65536-q-p;if(f==-1)f--;else if(p>=65274){for(a=0;a<32768;a++)k[a]=k[a+32768];x-=32768;p-=32768; +C-=32768;for(a=0;a<8192;a++)b=i[32768+a],i[32768+a]=b>=32768?b-32768:0;for(a=0;a<32768;a++)b=i[a],i[a]=b>=32768?b-32768:0;f+=32768}v||(a=xa(k,p+q,f),a<=0?v=!0:q+=a)},Ia=function(a,b,f){var d;if(!c){if(!v){w=t=0;var e,h;if(M[0].dl==0){F.dyn_tree=P;F.static_tree=H;F.extra_bits=ra;F.extra_base=257;F.elems=286;F.max_length=15;F.max_code=0;z.dyn_tree=S;z.static_tree=M;z.extra_bits=ba;z.extra_base=0;z.elems=30;z.max_length=15;z.max_code=0;N.dyn_tree=I;N.static_tree=null;N.extra_bits=Ha;N.extra_base=0;N.elems= +19;N.max_length=7;for(h=e=N.max_code=0;h<28;h++){oa[h]=e;for(d=0;d<1<>=7;h<30;h++){da[h]=e<<7;for(d=0;d<1<q&&(y=q));if(y>=3)if(h=ca(p-x,y-3),q-=y,y<=G){y--;do p++,ma();while(--y!=0);p++}else p+=y,y=0,s=k[p]&255,s=(s<<5^k[p+1]&255)&8191;else h=ca(0,k[p]&255),q--,p++;h&&(na(0),C=p);for(;q<262&&!v;)sa()}else for(;q!= +0&&g==null;){ma();B=y;D=x;y=2;A!=0&&Bq&&(y=q),y==3&&p-x>4096&&y--);if(B>=3&&y<=B){h=ca(p-1-D,B-3);q-=B-1;B-=2;do p++,ma();while(--B!=0);E=0;y=2;p++;h&&(na(0),C=p)}else E!=0?ca(0,k[p-1]&255)&&(na(0),C=p):E=1,p++,q--;for(;q<262&&!v;)sa()}q==0&&(E!=0&&ca(0,k[p-1]&255),na(1),o=!0);return d+Ca(a,d+b,f-d)},Ca=function(a,b,c){var i,e,h;for(i=0;g!=null&&ig.len)e=g.len;for(h=0;hl-n&&(e=l-n);for(h=0;h>1;i>=1;i--)ta(b,i);do i=J[1],J[1]=J[T--],ta(b,1),f=J[1],J[--Y]=i,J[--Y]=f,b[g].fc=b[i].fc+b[f].fc,Q[g]=Q[i]>Q[f]+1?Q[i]:Q[f]+1,b[i].dl=b[f].dl=g,J[1]=g++,ta(b,1);while(T>=2);J[--Y]=J[1];g=a.dyn_tree;i=a.extra_bits;var c=a.extra_base,f=a.max_code,e=a.max_length, +h=a.static_tree,p,k,l,x,q=0;for(k=0;k<=15;k++)L[k]=0;g[J[Y]].dl=0;for(a=Y+1;a<573;a++)if(p=J[a],k=g[g[p].dl].dl+1,k>e&&(k=e,q++),g[p].dl=k,!(p>f))L[k]++,l=0,p>=c&&(l=i[p-c]),x=g[p].fc,Z+=x*(k+l),h!=null&&(ha+=x*(h[p].dl+l));if(q!=0){do{for(k=e-1;L[k]==0;)k--;L[k]--;L[k+1]+=2;L[e]--;q-=2}while(q>0);for(k=e;k!=0;k--)for(p=L[k];p!=0;)if(i=J[--a],!(i>f)){if(g[i].dl!=k)Z+=(k-g[i].dl)*g[i].fc,g[i].fc=k;p--}}za(b,d)},Da=function(a,b){var f,c=-1,i,d=a[0].dl,g=0,e=7,h=4;d==0&&(e=138,h=3);a[b+1].dl=65535;for(f= +0;f<=b;f++)i=d,d=a[f+1].dl,++g=3;c--)if(I[va[c]].dl!=0)break;Z+=3*(c+1)+14;b=Z+3+7>>3;f=ha+3+7>>3;f<=b&&(b=f);if(i+4<=b&&C>=0){O(0+a,3);Fa();la(i);la(~i);for(c=0;c>7)])& +255].fc++,u[fa++]=a,aa|=ga);ga<<=1;(U&7)==0&&(ea[pa++]=aa,aa=0,ga=1);if(R>2&&(U&4095)==0){var f=U*8,c=p-C,i;for(i=0;i<30;i++)f+=S[i].fc*(5+ba[i]);f>>=3;if(fa>7)])&255,V(e,b),h=ba[e],h!=0&&(f-=da[e],O(f,h))),g>>=1;while(c16-b?(t|=a<>16-w,w+=b-16):(t|=a<>=1,f<<=1;while(--b>0);return f>>1},Fa=function(){w>8?la(t):w>0&&ka(t);w=t=0};this.deflate=function(e,h){var p,l;ia=e;qa=0;typeof h=="undefined"&&(h=6);(p=h)?p<1?p=1:p>9&&(p=9):p=6;R=p;v=c=!1;if(f==null){d=g=b=null;f=Array(a);k=Array(65536);u=Array(8192);r=Array(32832);i=Array(65536);P=Array(573);for(p=0;p<573;p++)P[p]=new j;S=Array(61);for(p=0;p<61;p++)S[p]=new j;H=Array(288);for(p=0;p<288;p++)H[p]=new j; +M=Array(30);for(p=0;p<30;p++)M[p]=new j;I=Array(39);for(p=0;p<39;p++)I[p]=new j;F=new m;z=new m;N=new m;L=Array(16);J=Array(573);Q=Array(573);$=Array(256);W=Array(512);oa=Array(29);da=Array(30);ea=Array(1024)}for(var q=Array(1024),x=[];(p=Ia(q,0,q.length))>0;){var o=Array(p);for(l=0;l>8&255])};this.appendUInt32LE=function(b){m.appendArray([b&255,b>>8&255,b>>16&255,b>>24&255])};this.appendString=function(b){g=runtime.concatByteArrays(g, -runtime.byteArrayFromString(b,i))};this.getLength=function(){return g.length};this.getByteArray=function(){return g}}; +core.ByteArrayWriter=function(j){var m=this,h=new runtime.ByteArray(0);this.appendByteArrayWriter=function(e){h=runtime.concatByteArrays(h,e.getByteArray())};this.appendByteArray=function(e){h=runtime.concatByteArrays(h,e)};this.appendArray=function(e){h=runtime.concatByteArrays(h,runtime.byteArrayFromArray(e))};this.appendUInt16LE=function(e){m.appendArray([e&255,e>>8&255])};this.appendUInt32LE=function(e){m.appendArray([e&255,e>>8&255,e>>16&255,e>>24&255])};this.appendString=function(e){h=runtime.concatByteArrays(h, +runtime.byteArrayFromString(e,j))};this.getLength=function(){return h.length};this.getByteArray=function(){return h}}; // Input 6 -core.RawInflate=function(){var i,m,g=null,b,a,h,e,c,d,f,k,p,o,j,u,q,l,t=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],x=[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],B=[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],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],C=[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],A=[16,17,18, -0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=function(){this.list=this.next=null},w=function(){this.n=this.b=this.e=0;this.t=null},J=function(a,c,d,f,b,l){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var e=Array(this.BMAX+1),g,n,j,r,h,k,o,v=Array(this.BMAX+1),i,p,y,t=new w,q=Array(this.BMAX);r=Array(this.N_MAX);var F,s=Array(this.BMAX+1),x,m,C;C=this.root=null;for(h=0;h256?a[256]:this.BMAX;i=a;p=0;h=c;do e[i[p]]++,p++;while(--h>0);if(e[0]==c)this.root=null,this.status=this.m=0;else{for(k=1;k<=this.BMAX;k++)if(e[k]!=0)break;o=k;lh&&(l=h);for(x=1<0;)s[y++]=k+=i[p++];i=a;h=p=0;do if((k=i[p++])!=0)r[s[k]++]=h;while(++h0;){for(;o>F+v[1+r];){F+=v[1+r];r++;m=(m=j-F)>l?l:m;if((n=1<<(k=o-F))>a+1){n-=a+1;for(y=o;++kg&&F0)s[r]=h,t.b=v[r],t.e=16+k,t.t=y,k=(h&(1<>F-v[r],q[r-1][k].e=t.e,q[r-1][k].b=t.b,q[r-1][k].n=t.n,q[r-1][k].t=t.t}t.b=o-F;p>=c?t.e=99:i[p]>F;k>=1)h^=k;for(h^=k;(h&(1<>=a;e-=a},n=function(a,d,b){var l,e,g;if(b==0)return 0;for(g=0;;){r(j);e=p.list[y(j)];for(l=e.e;l>16;){if(l==99)return-1;v(e.b);l-=16;r(l);e=e.t[y(l)];l= -e.e}v(e.b);if(l==16)m&=32767,a[d+g++]=i[m++]=e.n;else{if(l==15)break;r(l);f=e.n+y(l);v(l);r(u);e=o.list[y(u)];for(l=e.e;l>16;){if(l==99)return-1;v(e.b);l-=16;r(l);e=e.t[y(l)];l=e.e}v(e.b);r(l);k=m-e.n-y(l);for(v(l);f>0&&g286||k>30)return-1;for(f=0;fe)return-1;for(;f-- >0;)i[b++]=l}else{f==17?(r(3),f=3+y(3),v(3)):(r(7),f=11+y(7),v(7));if(b+f>e)return-1;for(;f-- >0;)i[b++]=0;l=0}j=9;f=new J(i,h,257,x,B,j);if(j==0)f.status=1;if(f.status!=0)return-1;p=f.root;j=f.m;for(b=0;b257?-1:f.status!=0?-1:n(a,c,d)};this.inflate=function(t,w){i==null&&(i=Array(65536));e=h=m=0;c=-1;d=!1;f=k=0;p=null;q=t;l=0;var E=new runtime.ByteArray(w);a:{var A,G;for(A=0;A0){if(c!=0)for(;f>0&&A0&&A0&&D1){g=null;alert("HufBuild error: "+z.status);G=-1;break b}b=z.root;I=z.m}p=g;o=b;j=a;u=I;G=n(G,L,H)}break;case 2:G=p!=null?n(E,0+A,w-A):F(E,0+A,w-A);break;default:G=-1}if(G==-1)break a;A+=G}}q=null;return E}}; +core.RawInflate=function(){var j,m,h=null,e,a,d,g,b,c,f,l,n,o,k,u,r,i,t=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],w=[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],C=[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],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],A=[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],D=[16,17,18, +0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],E=function(){this.list=this.next=null},y=function(){this.n=this.b=this.e=0;this.t=null},B=function(a,b,f,c,i,d){this.BMAX=16;this.N_MAX=288;this.status=0;this.root=null;this.m=0;var g=Array(this.BMAX+1),e,h,p,k,l,q,x,j=Array(this.BMAX+1),o,v,n,t=new y,r=Array(this.BMAX);k=Array(this.N_MAX);var G,s=Array(this.BMAX+1),w,A,m;m=this.root=null;for(l=0;l256?a[256]:this.BMAX;o=a;v=0;l=b;do g[o[v]]++,v++;while(--l>0);if(g[0]==b)this.root=null,this.status=this.m=0;else{for(q=1;q<=this.BMAX;q++)if(g[q]!=0)break;x=q;dl&&(d=l);for(w=1<0;)s[n++]=q+=o[v++];o=a;l=v=0;do if((q=o[v++])!=0)k[s[q]++]=l;while(++l0;){for(;x>G+j[1+k];){G+=j[1+k];k++;A=(A=p-G)>d?d:A;if((h=1<<(q=x-G))>a+1){h-=a+1;for(n=x;++qe&&G0)s[k]=l,t.b=j[k],t.e=16+q,t.t=n,q=(l&(1<>G-j[k],r[k-1][q].e=t.e,r[k-1][q].b=t.b,r[k-1][q].n=t.n,r[k-1][q].t=t.t}t.b=x-G;v>=b?t.e=99:o[v]>G;q>=1)l^=q;for(l^=q;(l&(1<>=a;g-=a},q=function(a,c,i){var d,g,e;if(i==0)return 0;for(e=0;;){p(k);g=n.list[x(k)];for(d=g.e;d>16;){if(d==99)return-1;v(g.b);d-=16;p(d);g=g.t[x(d)];d= +g.e}v(g.b);if(d==16)m&=32767,a[c+e++]=j[m++]=g.n;else{if(d==15)break;p(d);f=g.n+x(d);v(d);p(u);g=o.list[x(u)];for(d=g.e;d>16;){if(d==99)return-1;v(g.b);d-=16;p(d);g=g.t[x(d)];d=g.e}v(g.b);p(d);l=m-g.n-x(d);for(v(d);f>0&&e286||l>30)return-1;for(i=0;ig)return-1;for(;i-- >0;)j[c++]=d}else{i==17?(p(3),i=3+x(3),v(3)):(p(7),i=11+x(7),v(7));if(c+i>g)return-1;for(;i-- >0;)j[c++]=0;d=0}k=9;i=new B(j,h,257,w,C,k);if(k==0)i.status=1;if(i.status!=0)return-1;n=i.root;k=i.m;for(c=0;c257?-1:i.status!=0?-1:q(a,b,f)};this.inflate=function(t,y){j==null&&(j=Array(65536));g=d=m=0;b=-1;c=!1;f=l=0;n=null;r=t;i=0;var E=new runtime.ByteArray(y);a:{var D,H;for(D=0;D0){if(b!=0)for(;f>0&&D0&&D0&&F1){h=null;alert("HufBuild error: "+z.status);H=-1;break b}e=z.root;K=z.m}n=h;o=e;k=a;u=K;H=q(H,M,I)}break;case 2:H=n!=null?q(E,0+D,y-D):G(E,0+D,y-D);break;default:H=-1}if(H==-1)break a;D+=H}}r=null;return E}}; // Input 7 -core.Cursor=function(i,m){function g(a,b){for(var c=b;c&&c!==a;)c=c.parentNode;return c||b}function b(){var b,e,c;if(a.parentNode){e=0;for(b=a.parentNode.firstChild;b&&b!==a;)e+=1,b=b.nextSibling;if(a.previousSibling&&a.previousSibling.nodeType===3&&a.nextSibling&&a.nextSibling.nodeType===3)c=a.nextSibling,a.previousSibling.appendData(c.nodeValue);for(b=0;bf&&d.setStart(k,d.startOffset-1);d.endContainer===a?d.setEnd(k,f):d.endContainer===k&&d.endOffset>f&&d.setEnd(k,d.endOffset-1)}if(c){for(b=0;bf&&c.setStart(e,c.startOffset-1);c.endContainer===a?c.setEnd(e,f):c.endContainer===e&&c.endOffset>f&&c.setEnd(e,c.endOffset-1)}if(b){for(d=0;d0)return h-=1,!0;if(b)return b.nodeType===1?(g=b,b=g.lastChild,a=null,h=m(b)+1):b.nodeType===3?(g=b,a=b=null,h=typeof g.nodeValue.length==="number"?g.nodeValue.length:g.nodeValue.length()):(a=b,b=b.previousSibling,h-=1),!0;return g!==i?(a=g,b=a.previousSibling,g=g.parentNode,h=m(a),!0):!1};this.node=function(){return g};this.position= -function(){return h};this.precedingSibling=function(){return b};this.followingSibling=function(){return a}}; +core.PointWalker=function(j){function m(a){for(var b=-1;a;)a=a.previousSibling,b+=1;return b}var h=j,e=null,a=j&&j.firstChild,d=0;this.setPoint=function(g,b){h=g;d=b;if(h.nodeType===3)e=a=null;else{for(a=h.firstChild;b;)b-=1,a=a.nextSibling;e=a?a.previousSibling:h.lastChild}};this.stepForward=function(){var g;if(h.nodeType===3&&(g=typeof h.nodeValue.length==="number"?h.nodeValue.length:h.nodeValue.length(),d0)return d-=1,!0;if(e)return e.nodeType===1?(h=e,e=h.lastChild,a=null,d=m(e)+1):e.nodeType===3?(h=e,a=e=null,d=typeof h.nodeValue.length==="number"?h.nodeValue.length:h.nodeValue.length()):(a=e,e=e.previousSibling,d-=1),!0;return h!==j?(a=h,e=a.previousSibling,h=h.parentNode,d=m(a),!0):!1};this.node=function(){return h};this.position= +function(){return d};this.precedingSibling=function(){return e};this.followingSibling=function(){return a}}; // Input 10 -core.Async=function(){this.forEach=function(i,m,g){function b(a){e!==h&&(a?(e=h,g(a)):(e+=1,e===h&&g(null)))}var a,h=i.length,e=0;for(a=0;a>>8^e;return c^-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 a(a){var b=a.getFullYear();return b<1980?0:b- -1980<<25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function h(a,c){var f,d,e,g,k,h,o,i=this;this.load=function(c){if(i.data!==void 0)c(null,i.data);else{var b=k+34+f+d+256;b+o>p&&(b=p-o);runtime.read(a,o,b,function(b,f){if(b)c(b,f);else a:{var d=f,e=new core.ByteArray(d),l=e.readUInt32LE(),r;if(l!==67324752)c("File entry signature is wrong."+l.toString()+" "+d.length.toString(),null);else{e.pos+=22;l=e.readUInt16LE();r=e.readUInt16LE();e.pos+=l+r;if(g){d= -d.slice(e.pos,e.pos+k);if(k!==d.length){c("The amount of compressed bytes read was "+d.length.toString()+" instead of "+k.toString()+" for "+i.filename+" in "+a+".",null);break a}d=j(d,h)}else d=d.slice(e.pos,e.pos+h);h!==d.length?c("The amount of bytes read was "+d.length.toString()+" instead of "+h.toString()+" for "+i.filename+" in "+a+".",null):(i.data=d,c(null,d))}}})}};this.set=function(a,c,b,f){i.filename=a;i.data=c;i.compressed=b;i.date=f};this.error=null;if(c)c.readUInt32LE()!==33639248? -this.error="Central directory entry has wrong signature at position "+(c.pos-4).toString()+' for file "'+a+'": '+c.data.length.toString():(c.pos+=6,g=c.readUInt16LE(),this.date=b(c.readUInt32LE()),c.readUInt32LE(),k=c.readUInt32LE(),h=c.readUInt32LE(),f=c.readUInt16LE(),d=c.readUInt16LE(),e=c.readUInt16LE(),c.pos+=8,o=c.readUInt32LE(),this.filename=runtime.byteArrayToString(c.data.slice(c.pos,c.pos+f),"utf8"),c.pos+=f+d+e)}function e(a,c){if(a.length!==22)c("Central directory length should be 22.", -u);else{var b=new core.ByteArray(a),f;f=b.readUInt32LE();f!==101010256?c("Central directory signature is wrong: "+f.toString(),u):b.readUInt16LE()!==0?c("Zip files with non-zero disk numbers are not supported.",u):b.readUInt16LE()!==0?c("Zip files with non-zero disk numbers are not supported.",u):(f=b.readUInt16LE(),o=b.readUInt16LE(),f!==o?c("Number of entries is inconsistent.",u):(f=b.readUInt32LE(),b=b.readUInt16LE(),b=p-22-f,runtime.read(i,b,p-b,function(a,b){a:{var f=new core.ByteArray(b),d, -e;k=[];for(d=0;d>>8^g;return f^-1}function e(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 b=a.getFullYear();return b<1980?0:b- +1980<<25|a.getMonth()+1<<21|a.getDate()<<16|a.getHours()<<11|a.getMinutes()<<5|a.getSeconds()>>1}function d(a,b){var f,c,d,g,h,l,j,o=this;this.load=function(b){if(o.data!==void 0)b(null,o.data);else{var i=h+34+f+c+256;i+j>n&&(i=n-j);runtime.read(a,j,i,function(f,c){if(f)b(f,c);else a:{var i=c,d=new core.ByteArray(i),e=d.readUInt32LE(),p;if(e!==67324752)b("File entry signature is wrong."+e.toString()+" "+i.length.toString(),null);else{d.pos+=22;e=d.readUInt16LE();p=d.readUInt16LE();d.pos+=e+p;if(g){i= +i.slice(d.pos,d.pos+h);if(h!==i.length){b("The amount of compressed bytes read was "+i.length.toString()+" instead of "+h.toString()+" for "+o.filename+" in "+a+".",null);break a}i=k(i,l)}else i=i.slice(d.pos,d.pos+l);l!==i.length?b("The amount of bytes read was "+i.length.toString()+" instead of "+l.toString()+" for "+o.filename+" in "+a+".",null):(o.data=i,b(null,i))}}})}};this.set=function(a,b,f,c){o.filename=a;o.data=b;o.compressed=f;o.date=c};this.error=null;if(b)b.readUInt32LE()!==33639248? +this.error="Central directory entry has wrong signature at position "+(b.pos-4).toString()+' for file "'+a+'": '+b.data.length.toString():(b.pos+=6,g=b.readUInt16LE(),this.date=e(b.readUInt32LE()),b.readUInt32LE(),h=b.readUInt32LE(),l=b.readUInt32LE(),f=b.readUInt16LE(),c=b.readUInt16LE(),d=b.readUInt16LE(),b.pos+=8,j=b.readUInt32LE(),this.filename=runtime.byteArrayToString(b.data.slice(b.pos,b.pos+f),"utf8"),b.pos+=f+c+d)}function g(a,b){if(a.length!==22)b("Central directory length should be 22.", +u);else{var f=new core.ByteArray(a),c;c=f.readUInt32LE();c!==101010256?b("Central directory signature is wrong: "+c.toString(),u):f.readUInt16LE()!==0?b("Zip files with non-zero disk numbers are not supported.",u):f.readUInt16LE()!==0?b("Zip files with non-zero disk numbers are not supported.",u):(c=f.readUInt16LE(),o=f.readUInt16LE(),c!==o?b("Number of entries is inconsistent.",u):(c=f.readUInt32LE(),f=f.readUInt16LE(),f=n-22-c,runtime.read(j,f,n-f,function(a,f){a:{var c=new core.ByteArray(f),g, +e;l=[];for(g=0;gb}}var a=m.node().ownerDocument,h=new core.Cursor(i,a);this.movePointForward=function(a){g(a,m.stepForward)};this.movePointBackward=function(a){g(a,m.stepBackward)};this.moveLineForward=function(a){i.modify?i.modify(a?"extend":"move", -"forward","line"):g(a,b)};this.moveLineBackward=function(a){i.modify?i.modify(a?"extend":"move","backward","line"):g(a,function(){})};return this}; +gui.SelectionMover=function(j,m){function h(a,b){if(j.rangeCount!==0){var c=j.getRangeAt(0);if(c.startContainer&&c.startContainer.nodeType===1){m.setPoint(c.startContainer,c.startOffset);b();c=m.node();m.position();var f=[],d;for(d=0;db}}var a=m.node().ownerDocument,d=new core.Cursor(j,a);this.movePointForward=function(a){h(a,m.stepForward)};this.movePointBackward=function(a){h(a,m.stepBackward)};this.moveLineForward=function(a){j.modify?j.modify(a?"extend":"move", +"forward","line"):h(a,e)};this.moveLineBackward=function(a){j.modify?j.modify(a?"extend":"move","backward","line"):h(a,function(){})};return this}; // Input 14 runtime.loadClass("core.PointWalker");runtime.loadClass("core.Cursor"); -gui.XMLEdit=function(i,m){function g(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c}function b(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function a(){var a=i.ownerDocument.defaultView.getSelection();a&&!(a.rangeCount<=0)&&q&&(a=a.getRangeAt(0),q.setPoint(a.startContainer,a.startOffset))}function h(){var a=i.ownerDocument.defaultView.getSelection(),b,c;a.removeAllRanges();q&&q.node()&&(b=q.node(),c=b.ownerDocument.createRange(), -c.setStart(b,q.position()),c.collapse(!0),a.addRange(c))}function e(c){var f=c.charCode||c.keyCode;if(q=null,q&&f===37)a(),q.stepBackward(),h();else if(f>=16&&f<=20||f>=33&&f<=40)return;b(c)}function c(){}function d(a){i.ownerDocument.defaultView.getSelection().getRangeAt(0);b(a)}function f(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===1&&f(b),b=b.nextSibling||b.parentNode;var c,d,e,b=a.attributes;c="";for(e=b.length-1;e>=0;e-=1)d=b.item(e),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,c.nodeType===3&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function k(a,b){for(var c=a.firstChild,f,d,e;c&&c!==a;){if(c.nodeType===1){k(c,b);f=c.attributes;for(e=f.length-1;e>=0;e-=1)if(d=f.item(e),d.namespaceURI==="http://www.w3.org/2000/xmlns/"&&!b[d.nodeValue])b[d.nodeValue]=d.localName}c=c.nextSibling||c.parentNode}}function p(){var a=i.ownerDocument.createElement("style"), -b;b={};k(i,b);var c={},f,d,e=0;for(f in b)if(b.hasOwnProperty(f)&&f){d=b[f];if(!d||c.hasOwnProperty(d)||d==="xmlns"){do d="ns"+e,e+=1;while(c.hasOwnProperty(d));b[f]=d}c[d]=!0}b="@namespace customns url(customns);\n";a.type="text/css";b+=o;a.appendChild(i.ownerDocument.createTextNode(b));m=m.parentNode.replaceChild(a,m)}var o,j,u,q=null;if(!i.id)i.id="xml"+String(Math.random()).substring(2);j="#"+i.id+" ";o=j+"*,"+j+":visited, "+j+":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"+ -j+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+j+":after {color: blue; content: '';}\n"+j+"{overflow: auto;}\n";(function(a){g(a,"click",d);g(a,"keydown",e);g(a,"keypress",c);g(a,"drop",b);g(a,"dragend",b);g(a,"beforepaste",b);g(a,"paste",b)})(i);this.updateCSS=p;this.setXML=function(a){a=a.documentElement||a;u=a=i.ownerDocument.importNode(a,!0);for(f(a);i.lastChild;)i.removeChild(i.lastChild);i.appendChild(a);p();q=new core.PointWalker(a)}; +gui.XMLEdit=function(j,m){function h(a,b,f){a.addEventListener?a.addEventListener(b,f,!1):a.attachEvent?a.attachEvent("on"+b,f):a["on"+b]=f}function e(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function a(){var a=j.ownerDocument.defaultView.getSelection();a&&!(a.rangeCount<=0)&&r&&(a=a.getRangeAt(0),r.setPoint(a.startContainer,a.startOffset))}function d(){var a=j.ownerDocument.defaultView.getSelection(),b,f;a.removeAllRanges();r&&r.node()&&(b=r.node(),f=b.ownerDocument.createRange(), +f.setStart(b,r.position()),f.collapse(!0),a.addRange(f))}function g(b){var f=b.charCode||b.keyCode;if(r=null,r&&f===37)a(),r.stepBackward(),d();else if(f>=16&&f<=20||f>=33&&f<=40)return;e(b)}function b(){}function c(a){j.ownerDocument.defaultView.getSelection().getRangeAt(0);e(a)}function f(a){for(var b=a.firstChild;b&&b!==a;)b.nodeType===1&&f(b),b=b.nextSibling||b.parentNode;var c,d,e,b=a.attributes;c="";for(e=b.length-1;e>=0;e-=1)d=b.item(e),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,c.nodeType===3&&d.test(c.nodeValue)&&c.parentNode.removeChild(c)}function l(a,b){for(var f=a.firstChild,c,d,e;f&&f!==a;){if(f.nodeType===1){l(f,b);c=f.attributes;for(e=c.length-1;e>=0;e-=1)if(d=c.item(e),d.namespaceURI==="http://www.w3.org/2000/xmlns/"&&!b[d.nodeValue])b[d.nodeValue]=d.localName}f=f.nextSibling||f.parentNode}}function n(){var a=j.ownerDocument.createElement("style"), +b;b={};l(j,b);var f={},c,d,e=0;for(c in b)if(b.hasOwnProperty(c)&&c){d=b[c];if(!d||f.hasOwnProperty(d)||d==="xmlns"){do d="ns"+e,e+=1;while(f.hasOwnProperty(d));b[c]=d}f[d]=!0}b="@namespace customns url(customns);\n";a.type="text/css";b+=o;a.appendChild(j.ownerDocument.createTextNode(b));m=m.parentNode.replaceChild(a,m)}var o,k,u,r=null;if(!j.id)j.id="xml"+String(Math.random()).substring(2);k="#"+j.id+" ";o=k+"*,"+k+":visited, "+k+":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"+ +k+":before {color: blue; content: '<' attr(customns_name) attr(customns_atts) '>';}\n"+k+":after {color: blue; content: '';}\n"+k+"{overflow: auto;}\n";(function(a){h(a,"click",c);h(a,"keydown",g);h(a,"keypress",b);h(a,"drop",e);h(a,"dragend",e);h(a,"beforepaste",e);h(a,"paste",e)})(j);this.updateCSS=n;this.setXML=function(a){a=a.documentElement||a;u=a=j.ownerDocument.importNode(a,!0);for(f(a);j.lastChild;)j.removeChild(j.lastChild);j.appendChild(a);n();r=new core.PointWalker(a)}; this.getXML=function(){return u}}; // Input 15 xmldom.LSSerializerFilter=function(){}; // Input 16 -typeof Object.create!=="function"&&(Object.create=function(i){var m=function(){};m.prototype=i;return new m}); -xmldom.LSSerializer=function(){function i(g,b){var a="",h=Object.create(g),e=m.filter?m.filter.acceptNode(b):1,c;if(e===1){c="";var d=b.attributes,f,k,p,o="",j;if(d){if(h[b.namespaceURI]!==b.prefix)h[b.namespaceURI]=b.prefix;c+="<"+b.nodeName;f=d.length;for(k=0;k"}a+=c}if(e===1||e===3){for(c=b.firstChild;c;)a+=i(h,c),c=c.nextSibling;b.nodeValue&&(a+=b.nodeValue)}e===1&&(h="",b.nodeType===1&&(h+=""),a+=h);return a}var m=this;this.filter=null;this.writeToString=function(g,b){if(!g)return"";var a;if(b){a=b;var h={},e;for(e in a)a.hasOwnProperty(e)&&(h[a[e]]=e);a=h}else a={};return i(a, -g)}}; +typeof Object.create!=="function"&&(Object.create=function(j){var m=function(){};m.prototype=j;return new m}); +xmldom.LSSerializer=function(){function j(h,e){var a="",d=Object.create(h),g=m.filter?m.filter.acceptNode(e):1,b;if(g===1){b="";var c=e.attributes,f,l,n,o="",k;if(c){if(d[e.namespaceURI]!==e.prefix)d[e.namespaceURI]=e.prefix;b+="<"+e.nodeName;f=c.length;for(l=0;l"}a+=b}if(g===1||g===3){for(b=e.firstChild;b;)a+=j(d,b),b=b.nextSibling;e.nodeValue&&(a+=e.nodeValue)}g===1&&(d="",e.nodeType===1&&(d+=""),a+=d);return a}var m=this;this.filter=null;this.writeToString=function(h,e){if(!h)return"";var a;if(e){a=e;var d={},g;for(g in a)a.hasOwnProperty(g)&&(d[a[g]]=g);a=d}else a={};return j(a, +h)}}; // Input 17 -xmldom.RelaxNGParser=function(){function i(a,b){this.message=function(){b&&(a+=b.nodeType===1?" Element ":" Node ",a+=b.nodeName,b.nodeValue&&(a+=" with value '"+b.nodeValue+"'"),a+=".");return a}}function m(a){if(a.e.length<=2)return a;var b={name:a.name,e:a.e.slice(0,2)};return m({name:a.name,e:[b].concat(a.e.slice(2))})}function g(a){var a=a.split(":",2),b="",d;a.length===1?a=["",a[0]]:b=a[0];for(d in c)c[d]===b&&(a[0]=d);return a}function b(a,c){var k;var f;for(var d=0,e,j,h=a.name;a.e&&d1&&(l==="define"||l==="oneOrMore"||l==="zeroOrMore"||l==="optional"||l==="list"||l==="mixed"))e=[{name:"group",e:m({name:"group",e:e}).e}];e.length>2&&l==="element"&&(e=[e[0]].concat({name:"group",e:m({name:"group",e:e.slice(1)}).e}));e.length===1&&l==="attribute"&&e.push({name:"text",text:q});if(e.length===1&&(l==="choice"||l==="group"||l==="interleave"))l= -e[0].name,t=e[0].names,h=e[0].a,q=e[0].text,e=e[0].e;else if(e.length>2&&(l==="choice"||l==="group"||l==="interleave"))e=m({name:l,e:e}).e;l==="mixed"&&(l="interleave",e=[e[0],{name:"text"}]);l==="optional"&&(l="choice",e=[e[0],{name:"empty"}]);l==="zeroOrMore"&&(l="choice",e=[{name:"oneOrMore",e:[e[0]]},{name:"empty"}]);j={name:l};if(e&&e.length>0)j.e=e;for(i in h)if(h.hasOwnProperty(i)){j.a=h;break}if(q!==void 0)j.text=q;if(t&&t.length>0)j.names=t;if(l==="element")j.id=b.length,b.push(j),j={name:"elementref", -id:j.id};return j};this.parseRelaxNGDOM=function(f,g){var p=[],o=d(f&&f.documentElement,p),j,m,q={};for(j=0;j1&&(i==="define"||i==="oneOrMore"||i==="zeroOrMore"||i==="optional"||i==="list"||i==="mixed"))e=[{name:"group",e:m({name:"group",e:e}).e}];e.length>2&&i==="element"&&(e=[e[0]].concat({name:"group",e:m({name:"group",e:e.slice(1)}).e}));e.length===1&&i==="attribute"&&e.push({name:"text",text:r});if(e.length===1&&(i==="choice"||i==="group"||i==="interleave"))i= +e[0].name,t=e[0].names,g=e[0].a,r=e[0].text,e=e[0].e;else if(e.length>2&&(i==="choice"||i==="group"||i==="interleave"))e=m({name:i,e:e}).e;i==="mixed"&&(i="interleave",e=[e[0],{name:"text"}]);i==="optional"&&(i="choice",e=[e[0],{name:"empty"}]);i==="zeroOrMore"&&(i="choice",e=[{name:"oneOrMore",e:[e[0]]},{name:"empty"}]);k={name:i};if(e&&e.length>0)k.e=e;for(j in g)if(g.hasOwnProperty(j)){k.a=g;break}if(r!==void 0)k.text=r;if(t&&t.length>0)k.names=t;if(i==="element")k.id=d.length,d.push(k),k={name:"elementref", +id:k.id};return k};this.parseRelaxNGDOM=function(f,h){var n=[],o=c(f&&f.documentElement,n),k,m,r={};for(k=0;k=d.length)return b;e===0&&(e=0);for(var g=d.item(e);g.namespaceURI===f;){e+=1;if(e>=d.length)return b;g=d.item(e)}return g=c(a,b.attDeriv(a,d.item(e)),d,e+1)}function d(a,b,c){c.e[0].a?(a.push(c.e[0].text),b.push(c.e[0].a.ns)):d(a,b,c.e[0]);c.e[1].a?(a.push(c.e[1].text),b.push(c.e[1].a.ns)): -d(a,b,c.e[1])}var f="http://www.w3.org/2000/xmlns/",k,p,o,j,u,q,l,t,x,B,s={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return s},endTagDeriv:function(){return s}},C={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return C},endTagDeriv:function(){return s}}, -A={type:"text",nullable:!0,hash:"text",textDeriv:function(){return A},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return A},endTagDeriv:function(){return s}},E,w,J;k=b("choice",function(a,b){if(a===s)return b;if(b===s)return a;if(a===b)return a},function(b,c){var d={},f;a(d,{p1:b,p2:c});c=b=void 0;for(f in d)d.hasOwnProperty(f)&&(b===void 0?b=d[f]:c=c===void 0?d[f]:k(c,d[f]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable|| -b.nullable,textDeriv:function(c,d){return k(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:g(function(c){return k(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return k(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:i(function(){return k(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:i(function(){return k(a.endTagDeriv(),b.endTagDeriv())})}}(b,c)});p=function(a,b,c){return function(){var d={},f=0;return function(e,g){var j=b&&b(e,g),h,i;if(j!== -void 0)return j;j=e.hash||e.toString();h=g.hash||g.toString();j=d.length)return c;e===0&&(e=0);for(var g=d.item(e);g.namespaceURI===f;){e+=1;if(e>=d.length)return c;g=d.item(e)}return g=b(a,c.attDeriv(a,d.item(e)),d,e+1)}function c(a,b,d){d.e[0].a?(a.push(d.e[0].text),b.push(d.e[0].a.ns)):c(a,b,d.e[0]);d.e[1].a?(a.push(d.e[1].text),b.push(d.e[1].a.ns)): +c(a,b,d.e[1])}var f="http://www.w3.org/2000/xmlns/",l,n,o,k,u,r,i,t,w,C,s={type:"notAllowed",nullable:!1,hash:"notAllowed",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return s},endTagDeriv:function(){return s}},A={type:"empty",nullable:!0,hash:"empty",textDeriv:function(){return s},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return A},endTagDeriv:function(){return s}}, +D={type:"text",nullable:!0,hash:"text",textDeriv:function(){return D},startTagOpenDeriv:function(){return s},attDeriv:function(){return s},startTagCloseDeriv:function(){return D},endTagDeriv:function(){return s}},E,y,B;l=e("choice",function(a,b){if(a===s)return b;if(b===s)return a;if(a===b)return a},function(b,c){var d={},f;a(d,{p1:b,p2:c});c=b=void 0;for(f in d)d.hasOwnProperty(f)&&(b===void 0?b=d[f]:c=c===void 0?d[f]:l(c,d[f]));return function(a,b){return{type:"choice",p1:a,p2:b,nullable:a.nullable|| +b.nullable,textDeriv:function(c,d){return l(a.textDeriv(c,d),b.textDeriv(c,d))},startTagOpenDeriv:h(function(c){return l(a.startTagOpenDeriv(c),b.startTagOpenDeriv(c))}),attDeriv:function(c,d){return l(a.attDeriv(c,d),b.attDeriv(c,d))},startTagCloseDeriv:j(function(){return l(a.startTagCloseDeriv(),b.startTagCloseDeriv())}),endTagDeriv:j(function(){return l(a.endTagDeriv(),b.endTagDeriv())})}}(b,c)});n=function(a,b,c){return function(){var d={},f=0;return function(e,g){var h=b&&b(e,g),i,k;if(h!== +void 0)return h;h=e.hash||e.toString();i=g.hash||g.toString();h1;){if(g!==8&&(g!==3||!/^\s+$/.test(b.currentNode.nodeValue)))return e-=1,[new i("Not allowed node of type "+ -g+".")];g=(f=b.nextSibling())?f.nodeType:0}if(!f)return e-=1,[new i("Missing element "+a.names)];if(a.names&&a.names.indexOf(h[f.namespaceURI]+":"+f.localName)===-1)return e-=1,[new i("Found "+f.nodeName+" instead of "+a.names+".",f)];if(b.firstChild()){for(p=m(a.e[1],b,f);b.nextSibling();)if(g=b.currentNode.nodeType,(!b.currentNode||!(b.currentNode.nodeType===3&&/^\s+$/.test(b.currentNode.nodeValue)))&&g!==8)return e-=1,[new i("Spurious content.",b.currentNode)];if(b.parentNode()!==f)return e-=1, -[new i("Implementation error.")]}else p=m(a.e[1],b,f);e-=1;b.nextSibling();return p}var b,a,h,e=0;a=function(b,d,f,e){var h=b.name,o=null;if(h==="text")a:{for(var j=(b=d.currentNode)?b.nodeType:0;b!==f&&j!==3;){if(j===1){o=[new i("Element not allowed here.",b)];break a}j=(b=d.nextSibling())?b.nodeType:0}d.nextSibling();o=null}else if(h==="data")o=null;else if(h==="value")e!==b.text&&(o=[new i("Wrong value, should be '"+b.text+"', not '"+e+"'",f)]);else if(h==="list")o=null;else if(h==="attribute")a:{if(b.e.length!== -2)throw"Attribute with wrong # of elements: "+b.e.length;h=b.localnames.length;for(o=0;o1?(d.currentNode=j,o=null):o=h}else if(h==="choice"){if(b.e.length!==2)throw"Choice with wrong # of options: "+b.e.length;j=d.currentNode;if(b.e[0].name==="empty"){if(h=a(b.e[1],d,f,e))d.currentNode=j;o=null}else{if(h=m(b.e[0],d,f,e))d.currentNode=j,h=a(b.e[1],d,f,e);o=h}}else if(h==="group"){if(b.e.length!==2)throw"Group with wrong # of members: "+b.e.length;o=a(b.e[0],d,f)||a(b.e[1],d,f)}else if(h==="interleave")a:{for(var j=b.e.length,e=Array(j),u=j,q,l,t,x;u>0;){q=0;l=d.currentNode;for(o=0;o< -j;o+=1)if(t=d.currentNode,e[o]!==!0&&e[o]!==t)x=b.e[o],(h=a(x,d,f))?(d.currentNode=t,e[o]===void 0&&(e[o]=!1)):t===d.currentNode||x.name==="oneOrMore"||x.name==="choice"&&(x.e[0].name==="oneOrMore"||x.e[1].name==="oneOrMore")?(q+=1,e[o]=t):(q+=1,e[o]=!0);if(l===d.currentNode&&q===u)break;if(q===0){for(o=0;o1;){if(e!==8&&(e!==3||!/^\s+$/.test(c.currentNode.nodeValue)))return g-=1,[new j("Not allowed node of type "+ +e+".")];e=(f=c.nextSibling())?f.nodeType:0}if(!f)return g-=1,[new j("Missing element "+a.names)];if(a.names&&a.names.indexOf(d[f.namespaceURI]+":"+f.localName)===-1)return g-=1,[new j("Found "+f.nodeName+" instead of "+a.names+".",f)];if(c.firstChild()){for(h=m(a.e[1],c,f);c.nextSibling();)if(e=c.currentNode.nodeType,(!c.currentNode||!(c.currentNode.nodeType===3&&/^\s+$/.test(c.currentNode.nodeValue)))&&e!==8)return g-=1,[new j("Spurious content.",c.currentNode)];if(c.parentNode()!==f)return g-=1, +[new j("Implementation error.")]}else h=m(a.e[1],c,f);g-=1;c.nextSibling();return h}var e,a,d,g=0;a=function(b,c,d,e){var g=b.name,o=null;if(g==="text")a:{for(var k=(b=c.currentNode)?b.nodeType:0;b!==d&&k!==3;){if(k===1){o=[new j("Element not allowed here.",b)];break a}k=(b=c.nextSibling())?b.nodeType:0}c.nextSibling();o=null}else if(g==="data")o=null;else if(g==="value")e!==b.text&&(o=[new j("Wrong value, should be '"+b.text+"', not '"+e+"'",d)]);else if(g==="list")o=null;else if(g==="attribute")a:{if(b.e.length!== +2)throw"Attribute with wrong # of elements: "+b.e.length;g=b.localnames.length;for(o=0;o1?(c.currentNode=k,o=null):o=g}else if(g==="choice"){if(b.e.length!==2)throw"Choice with wrong # of options: "+b.e.length;k=c.currentNode;if(b.e[0].name==="empty"){if(g=a(b.e[1],c,d,e))c.currentNode=k;o=null}else{if(g=m(b.e[0],c,d,e))c.currentNode=k,g=a(b.e[1],c,d,e);o=g}}else if(g==="group"){if(b.e.length!==2)throw"Group with wrong # of members: "+b.e.length;o=a(b.e[0],c,d)||a(b.e[1],c,d)}else if(g==="interleave")a:{for(var k=b.e.length,e=Array(k),u=k,r,i,t,w;u>0;){r=0;i=c.currentNode;for(o=0;o< +k;o+=1)if(t=c.currentNode,e[o]!==!0&&e[o]!==t)w=b.e[o],(g=a(w,c,d))?(c.currentNode=t,e[o]===void 0&&(e[o]=!1)):t===c.currentNode||w.name==="oneOrMore"||w.name==="choice"&&(w.e[0].name==="oneOrMore"||w.e[1].name==="oneOrMore")?(r+=1,e[o]=t):(r+=1,e[o]=!0);if(i===c.currentNode&&r===u)break;if(r===0){for(o=0;o0:!1};i(g,b)};this.canElementHaveStyle=function(g,b){var a=m[b.localName];return(a=a&&a[b.namespaceURI])&&a.length>0};m=function(g){var j;var b,a,h,e,c,d={},f;for(b in g)if(g.hasOwnProperty(b)){h=g[b];c=h.length;for(a=0;a0:!1};j(h,e)};this.canElementHaveStyle=function(h,e){var a=m[e.localName];return(a=a&&a[e.namespaceURI])&&a.length>0};m=function(h){var i;var e,a,d,g,b,c={},f;for(e in h)if(h.hasOwnProperty(e)){d=h[e];b=d.length;for(a=0;a1;)b+=" > text|list-item > text|list",c-=1;b+=" > list-item:before";try{a.insertRule(b+"{"+d+"}",a.cssRules.length)}catch(e){throw e;}}function f(a,b,g,j){if(b==="list")for(var i=j.firstChild,m,q;i;){if(i.namespaceURI===o)if(m=i,i.localName==="list-level-style-number"){q=m;var u=q.getAttributeNS(p,"num-format"),n=q.getAttributeNS(p,"num-suffix"),I="",I={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},F="",F=q.getAttributeNS(p,"num-prefix")|| -"";F+=I.hasOwnProperty(u)?" counter(list, "+I[u]+")":u?"'"+u+"';":" ''";n&&(F+=" '"+n+"'");q=I="content: "+F+";";d(a,g,m,q)}else i.localName==="list-level-style-image"?(q="content: none;",d(a,g,m,q)):i.localName==="list-level-style-bullet"&&(q="content: '"+m.getAttributeNS(o,"bullet-char")+"';",d(a,g,m,q));i=i.nextSibling}else{g=h(b,g,j).join(",");m="";if(i=e(j,p,"text-properties")){q="";q+=c(i,l);u=i.getAttributeNS(p,"text-underline-style");u==="solid"&&(q+="text-decoration: underline;");if(u=i.getAttributeNS(p, -"font-name"))(u='"'+u+'"')&&(q+="font-family: "+u+";");m+=q}if(i=e(j,p,"paragraph-properties")){q=i;i="";i+=c(q,x);q=q.getElementsByTagNameNS(p,"background-image");if(q.length>0&&(u=q.item(0).getAttributeNS(k,"href")))i+="background-image: url('odfkit:"+u+"');",q=q.item(0),i+=c(q,t);m+=i}if(i=e(j,p,"graphic-properties"))q="",q+=c(i,B),m+=q;if(i=e(j,p,"table-cell-properties"))q="",q+=c(i,s),m+=q;if(m.length!==0)try{a.insertRule(g+"{"+m+"}",a.cssRules.length)}catch(R){throw R;}}for(var X in j.derivedStyles)j.derivedStyles.hasOwnProperty(X)&& -f(a,b,X,j.derivedStyles[X])}var k="http://www.w3.org/1999/xlink",p="urn:oasis:names:tc:opendocument:xmlns:style:1.0",o="urn:oasis:names:tc:opendocument:xmlns:text:1.0",j={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:p,svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", -text:o,xlink:k},u={graphic:"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text"},q={graphic:"circle,connected,control,custom-shape,ellipse,frame,g,line,measure,page,page-thumbnail,path,polygon,polyline,rect,regular-polygon".split(","),paragraph:"alphabetical-index-entry-template,h,illustration-index-entry-template,index-source-style,object-index-entry-template,p,table-index-entry-template,table-of-content-entry-template,user-index-entry-template".split(","), +odf.Style2CSS=function(){function j(a,b){var c={},d,f,e;if(!b)return c;for(d=b.firstChild;d;){d.namespaceURI===n&&d.localName==="style"?e=d.getAttributeNS(n,"family"):d.namespaceURI===o&&d.localName==="list-style"&&(e="list");if(f=e&&d.getAttributeNS&&d.getAttributeNS(n,"name"))c[e]||(c[e]={}),c[e][f]=d;d=d.nextSibling}return c}function m(a,b){if(!b||!a)return null;if(a[b])return a[b];var c,d;for(c in a)if(a.hasOwnProperty(c)&&(d=m(a[c].derivedStyles,b)))return d;return null}function h(a,b,c){var d= +b[a],f,e;if(d)if(f=d.getAttributeNS(n,"parent-style-name"),e=null,f&&(e=m(c,f),!e&&b[f]&&(h(f,b,c),e=b[f],b[f]=null)),e){if(!e.derivedStyles)e.derivedStyles={};e.derivedStyles[a]=d}else c[a]=d}function e(a,b){for(var c in a)a.hasOwnProperty(c)&&(h(c,a,b),a[c]=null)}function a(a,b){var c=u[a],d;if(c===null)return null;d="["+c+'|style-name="'+b+'"]';c==="presentation"&&(c="draw",d='[presentation|style-name="'+b+'"]');return c+"|"+r[a].join(d+","+c+"|")+d}function d(b,c,e){var f=[],g,h;f.push(a(b,c)); +for(g in e.derivedStyles)if(e.derivedStyles.hasOwnProperty(g))for(h in c=d(b,g,e.derivedStyles[g]),c)c.hasOwnProperty(h)&&f.push(c[h]);return f}function g(a,b,c){if(!a)return null;for(a=a.firstChild;a;){if(a.namespaceURI===b&&a.localName===c)return b=a;a=a.nextSibling}return null}function b(a,b){var c="",d,e;for(d in b)b.hasOwnProperty(d)&&(d=b[d],(e=a.getAttributeNS(d[0],d[1]))&&(c+=d[2]+":"+e+";"));return c}function c(a,b,c,d){for(var b='text|list[text|style-name="'+b+'"]',c=c.getAttributeNS(o, +"level"),e="",c=c&&parseInt(c,10);c>1;)b+=" > text|list-item > text|list",c-=1;b+=" > list-item:before";try{a.insertRule(b+"{"+d+"}",a.cssRules.length)}catch(f){throw f;}}function f(a,e,h,k){if(e==="list")for(var j=k.firstChild,p,m;j;){if(j.namespaceURI===o)if(p=j,j.localName==="list-level-style-number"){m=p;var r=m.getAttributeNS(n,"num-format"),q=m.getAttributeNS(n,"num-suffix"),u="",u={1:"decimal",a:"lower-latin",A:"upper-latin",i:"lower-roman",I:"upper-roman"},G="",G=m.getAttributeNS(n,"num-prefix")|| +"";G+=u.hasOwnProperty(r)?" counter(list, "+u[r]+")":r?"'"+r+"';":" ''";q&&(G+=" '"+q+"'");m=u="content: "+G+";";c(a,h,p,m)}else j.localName==="list-level-style-image"?(m="content: none;",c(a,h,p,m)):j.localName==="list-level-style-bullet"&&(m="content: '"+p.getAttributeNS(o,"bullet-char")+"';",c(a,h,p,m));j=j.nextSibling}else{h=d(e,h,k).join(",");p="";if(j=g(k,n,"text-properties")){m="";m+=b(j,i);r=j.getAttributeNS(n,"text-underline-style");r==="solid"&&(m+="text-decoration: underline;");if(r=j.getAttributeNS(n, +"font-name"))(r='"'+r+'"')&&(m+="font-family: "+r+";");p+=m}if(j=g(k,n,"paragraph-properties")){m=j;j="";j+=b(m,w);m=m.getElementsByTagNameNS(n,"background-image");if(m.length>0&&(r=m.item(0).getAttributeNS(l,"href")))j+="background-image: url('odfkit:"+r+"');",m=m.item(0),j+=b(m,t);p+=j}if(j=g(k,n,"graphic-properties"))m="",m+=b(j,C),p+=m;if(j=g(k,n,"table-cell-properties"))m="",m+=b(j,s),p+=m;if(p.length!==0)try{a.insertRule(h+"{"+p+"}",a.cssRules.length)}catch(R){throw R;}}for(var X in k.derivedStyles)k.derivedStyles.hasOwnProperty(X)&& +f(a,e,X,k.derivedStyles[X])}var l="http://www.w3.org/1999/xlink",n="urn:oasis:names:tc:opendocument:xmlns:style:1.0",o="urn:oasis:names:tc:opendocument:xmlns:text:1.0",k={draw:"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0",fo:"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",office:"urn:oasis:names:tc:opendocument:xmlns:office:1.0",presentation:"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0",style:n,svg:"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0",table:"urn:oasis:names:tc:opendocument:xmlns:table:1.0", +text:o,xlink:l},u={graphic:"draw",paragraph:"text",presentation:"presentation",ruby:"text",section:"text",table:"table","table-cell":"table","table-column":"table","table-row":"table",text:"text",list:"text"},r={graphic:"circle,connected,control,custom-shape,ellipse,frame,g,line,measure,page,page-thumbnail,path,polygon,polyline,rect,regular-polygon".split(","),paragraph:"alphabetical-index-entry-template,h,illustration-index-entry-template,index-source-style,object-index-entry-template,p,table-index-entry-template,table-of-content-entry-template,user-index-entry-template".split(","), presentation:"caption,circle,connector,control,custom-shape,ellipse,frame,g,line,measure,page-thumbnail,path,polygon,polyline,rect,regular-polygon".split(","),ruby:["ruby","ruby-text"],section:"alphabetical-index,bibliography,illustration-index,index-title,object-index,section,table-of-content,table-index,user-index".split(","),table:["background","table"],"table-cell":"body,covered-table-cell,even-columns,even-rows,first-column,first-row,last-column,last-row,odd-columns,odd-rows,table-cell".split(","), -"table-column":["table-column"],"table-row":["table-row"],text:"a,index-entry-chapter,index-entry-link-end,index-entry-link-start,index-entry-page-number,index-entry-span,index-entry-tab-stop,index-entry-text,index-title-template,linenumbering-configuration,list-level-style-number,list-level-style-bullet,outline-level-style,span".split(","),list:["list-item"]},l=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","color","color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", -"background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-weight","font-weight"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-style","font-style"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-size","font-size"]],t=[[p,"repeat","background-repeat"]],x=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", +"table-column":["table-column"],"table-row":["table-row"],text:"a,index-entry-chapter,index-entry-link-end,index-entry-link-start,index-entry-page-number,index-entry-span,index-entry-tab-stop,index-entry-text,index-title-template,linenumbering-configuration,list-level-style-number,list-level-style-bullet,outline-level-style,span".split(","),list:["list-item"]},i=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","color","color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", +"background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-weight","font-weight"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-style","font-style"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","font-size","font-size"]],t=[[n,"repeat","background-repeat"]],w=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", "text-align","text-align"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-left","padding-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-right","padding-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-top","padding-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","padding-bottom","padding-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-left","border-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", "border-right","border-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-top","border-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-bottom","border-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-left","margin-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-right","margin-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","margin-top","margin-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", -"margin-bottom","margin-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border","border"]],B=[["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill","background"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","min-height","min-height"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","stroke","border"],["urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", +"margin-bottom","margin-bottom"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border","border"]],C=[["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","fill","background"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","min-height","min-height"],["urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","stroke","border"],["urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0", "stroke-color","border-color"]],s=[["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","background-color","background-color"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-left","border-left"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-right","border-right"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-top","border-top"],["urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","border-bottom","border-bottom"]]; -this.namespaces=j;this.namespaceResolver=function(a){return j[a]};this.style2css=function(a,c,d){for(var e,g,h,l,k;a.cssRules.length;)a.deleteRule(a.cssRules.length-1);e=null;if(c)e=c.ownerDocument;if(d)e=d.ownerDocument;if(e){for(g in j)if(j.hasOwnProperty(g)){l="@namespace "+g+" url("+j[g]+")";try{a.insertRule(l,a.cssRules.length)}catch(m){}}c=i(e,c);e=i(e,d);for(k in u)if(u.hasOwnProperty(k))for(h in d={},b(c[k],d),b(e[k],d),d)d.hasOwnProperty(h)&&f(a,k,h,d[h])}}}; +this.namespaces=k;this.namespaceResolver=function(a){return k[a]||null};this.namespaceResolver.lookupNamespaceURI=this.namespaceResolver;this.style2css=function(a,b,c){for(var d,g,h,i,l;a.cssRules.length;)a.deleteRule(a.cssRules.length-1);d=null;if(b)d=b.ownerDocument;if(c)d=c.ownerDocument;if(d){for(g in k)if(k.hasOwnProperty(g)){i="@namespace "+g+" url("+k[g]+")";try{a.insertRule(i,a.cssRules.length)}catch(m){}}b=j(d,b);d=j(d,c);for(l in u)if(u.hasOwnProperty(l))for(h in c={},e(b[l],c),e(d[l],c), +c)c.hasOwnProperty(h)&&f(a,l,h,c[h])}}}; // Input 24 runtime.loadClass("core.Base64");runtime.loadClass("core.Zip");runtime.loadClass("xmldom.LSSerializer");runtime.loadClass("odf.StyleInfo");runtime.loadClass("odf.Style2CSS"); -odf.OdfContainer=function(){function i(a,b,c){for(a=a?a.firstChild:null;a;){if(a.localName===c&&a.namespaceURI===b)return a;a=a.nextSibling}return null}function m(a){var b,c=k.length;for(b=0;bc)break;e=e.nextSibling}a.insertBefore(b,e)}}}function a(a){this.OdfContainer=a}function h(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(a,b){e=b;d.url=null;if(e){var c=0;for(d.url=e[1]===80&&e[2]===78&&e[3]===71?"data:image/png;base64,": -"data:;base64,";c'}function J(){var a=d.namespaces,b=new xmldom.LSSerializer,c=w("document-meta",a);b.filter=new g(n.rootElement);c+=b.writeToString(n.rootElement.meta,a);c+="";return c}function r(){var a=d.namespaces,b=new xmldom.LSSerializer,c=w("document-settings",a);b.filter=new g(n.rootElement); -c+=b.writeToString(n.rootElement.settings,a);c+="";return c}function y(){var a=d.namespaces,b=new xmldom.LSSerializer,c=w("document-styles",a);b.filter=new g(n.rootElement,n.rootElement.masterStyles);c+=b.writeToString(n.rootElement.fontFaceDecls,a);c+=b.writeToString(n.rootElement.styles,a);c+=b.writeToString(n.rootElement.automaticStyles,a);c+=b.writeToString(n.rootElement.masterStyles,a);c+="";return c}function v(){var a=d.namespaces,b=new xmldom.LSSerializer, -c=w("document-content",a);b.filter=new g(n.rootElement,n.rootElement.body);c+=b.writeToString(n.rootElement.automaticStyles,a);c+=b.writeToString(n.rootElement.body,a);c+="";return c}var n=this,I=null;this.onstatereadychange=k;this.parts=this.rootElement=this.state=this.onchange=null;this.getPart=function(a){return new h(a,n,I)};this.save=function(a){var b;b=runtime.byteArrayFromString(r(),"utf8");I.save("settings.xml",b,!0,new Date);b=runtime.byteArrayFromString(J(),"utf8"); -I.save("meta.xml",b,!0,new Date);b=runtime.byteArrayFromString(y(),"utf8");I.save("styles.xml",b,!0,new Date);b=runtime.byteArrayFromString(v(),"utf8");I.save("content.xml",b,!0,new Date);I.write(function(b){a(b)})};this.state=j.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 e(this);I=new core.Zip(c,function(a,b){I=b;a?(I.error=a,p(j.INVALID)):E()})};odf.OdfContainer.EMPTY= +odf.OdfContainer=function(){function j(a,b,c){for(a=a?a.firstChild:null;a;){if(a.localName===c&&a.namespaceURI===b)return a;a=a.nextSibling}return null}function m(a){var b,c=l.length;for(b=0;bc)break;e=e.nextSibling}a.insertBefore(b,e)}}}function a(a){this.OdfContainer=a}function d(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(a,b){e=b;d.url=null;if(e){var c=0;for(d.url=e[1]===80&&e[2]===78&&e[3]===71?"data:image/png;base64,": +"data:;base64,";c'}function B(){var a=c.namespaces,b=new xmldom.LSSerializer,d=y("document-meta",a);b.filter=new h(q.rootElement);d+=b.writeToString(q.rootElement.meta,a);d+="";return d}function p(){var a=c.namespaces,b=new xmldom.LSSerializer,d=y("document-settings",a);b.filter=new h(q.rootElement); +d+=b.writeToString(q.rootElement.settings,a);d+="";return d}function x(){var a=c.namespaces,b=new xmldom.LSSerializer,d=y("document-styles",a);b.filter=new h(q.rootElement,q.rootElement.masterStyles);d+=b.writeToString(q.rootElement.fontFaceDecls,a);d+=b.writeToString(q.rootElement.styles,a);d+=b.writeToString(q.rootElement.automaticStyles,a);d+=b.writeToString(q.rootElement.masterStyles,a);d+="";return d}function v(){var a=c.namespaces,b=new xmldom.LSSerializer, +d=y("document-content",a);b.filter=new h(q.rootElement,q.rootElement.body);d+=b.writeToString(q.rootElement.automaticStyles,a);d+=b.writeToString(q.rootElement.body,a);d+="";return d}var q=this,K=null;this.onstatereadychange=l;this.parts=this.rootElement=this.state=this.onchange=null;this.getPart=function(a){return new d(a,q,K)};this.save=function(a){var b;b=runtime.byteArrayFromString(p(),"utf8");K.save("settings.xml",b,!0,new Date);b=runtime.byteArrayFromString(B(),"utf8"); +K.save("meta.xml",b,!0,new Date);b=runtime.byteArrayFromString(x(),"utf8");K.save("styles.xml",b,!0,new Date);b=runtime.byteArrayFromString(v(),"utf8");K.save("content.xml",b,!0,new Date);K.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 g(this);K=new core.Zip(b,function(a,b){K=b;a?(K.error=a,n(k.INVALID)):E()})};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 25 -odf.Formatting=function(){function i(g){function b(a,b){for(var c=a&&a.firstChild;c&&b;)c=c.nextSibling,b-=1;return c}var a=b(g.startContainer,g.startOffset);b(g.endContainer,g.endOffset);this.next=function(){return a===null?a:null}}var m=new odf.StyleInfo;this.setOdfContainer=function(){};this.isCompletelyBold=function(){return!1};this.getAlignment=function(g){this.getParagraphStyles(g)};this.getParagraphStyles=function(g){var b,a,h,e=[];for(b=0;b0?c[0].cloneNode(!1):b.createElement("style"); -for(f in a)a.hasOwnProperty(f)&&f&&(e+="@namespace "+f+" url("+a[f]+");\n");c.appendChild(b.createTextNode(e));d.appendChild(c);return c}var a=(new odf.Style2CSS).namespaces,h=a.draw,e=a.fo,c=a.svg,d=a.text,f=a.xlink,k=runtime.getWindow(),p={},o;odf.OdfCanvas=function(a){function f(b){function i(){for(var f=a;f.firstChild;)f.removeChild(f.firstChild);a.style.display="inline-block";f=b.rootElement;a.ownerDocument.importNode(f,!0);x.setOdfContainer(b);var k=s;(new odf.Style2CSS).style2css(k.sheet,f.styles, -f.automaticStyles);var k=C.sheet,l=b,m=f.body,n,o,q;o=[];for(n=m.firstChild;n&&n!==m;)if(n.namespaceURI===h&&(o[o.length]=n),n.firstChild)n=n.firstChild;else{for(;n!==m&&!n.nextSibling;)n=n.parentNode;if(n.nextSibling)n=n.nextSibling}for(q=0;q0?b[0].cloneNode(!1):a.createElement("style"); +for(f in d)d.hasOwnProperty(f)&&f&&(e+="@namespace "+f+" url("+d[f]+");\n");b.appendChild(a.createTextNode(e));c.appendChild(b);return b}var a=new odf.Style2CSS,d=a.namespaces,g=d.draw,b=d.fo,c=d.svg,f=d.text,l=d.xlink,n=runtime.getWindow(),o={},k;odf.OdfCanvas=function(d){function l(e){function i(){for(var j=d;j.firstChild;)j.removeChild(j.firstChild);d.style.display="inline-block";j=e.rootElement;d.ownerDocument.importNode(j,!0);C.setOdfContainer(e);var k=A;(new odf.Style2CSS).style2css(k.sheet, +j.styles,j.automaticStyles);var k=D.sheet,l=e,m=j.body,n,s,r;s=[];for(n=m.firstChild;n&&n!==m;)if(n.namespaceURI===g&&(s[s.length]=n),n.firstChild)n=n.firstChild;else{for(;n!==m&&!n.nextSibling;)n=n.parentNode;if(n.nextSibling)n=n.nextSibling}for(r=0;r